'use client';
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { useId } from 'react';
import { CheckCircle2 } from 'lucide-react';
import { SettingsCard, SettingsSourceBadge } from './components.js';
const INPUT_CLASS = 'w-full rounded-md border border-border bg-input-background px-3 py-2 text-base text-foreground focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-60';
const LABEL_CLASS = 'mb-1 flex items-center gap-2 text-sm font-medium text-foreground';
export function SiteInformationCard({ form, setField, sources, issues, canEdit, }) {
    const titleId = useId();
    const taglineId = useId();
    const urlId = useId();
    const urlErrId = useId();
    const titleIssue = issues.find((i) => i.field === 'siteTitle');
    const urlIssue = issues.find((i) => i.field === 'siteUrl');
    const urlEditable = sources.siteUrl?.editable !== false && canEdit;
    const urlValid = !urlIssue && form.siteUrl.trim().length > 0;
    return (_jsx(SettingsCard, { title: "Site Information", description: "Your site's name, tagline, and public URL.", children: _jsxs("div", { className: "space-y-4", children: [_jsxs("div", { children: [_jsx("label", { htmlFor: titleId, className: LABEL_CLASS, children: "Site Title" }), _jsx("input", { id: titleId, type: "text", value: form.siteTitle, disabled: !canEdit, "aria-invalid": titleIssue?.severity === 'error', onChange: (e) => setField('siteTitle', e.target.value), className: INPUT_CLASS }), titleIssue && _jsx("p", { className: "text-destructive mt-1 text-sm", children: titleIssue.message })] }), _jsxs("div", { children: [_jsx("label", { htmlFor: taglineId, className: LABEL_CLASS, children: "Tagline" }), _jsx("input", { id: taglineId, type: "text", value: form.tagline, disabled: !canEdit, onChange: (e) => setField('tagline', e.target.value), className: INPUT_CLASS })] }), _jsxs("div", { children: [_jsxs("label", { htmlFor: urlId, className: LABEL_CLASS, children: ["Site URL", _jsx(SettingsSourceBadge, { meta: sources.siteUrl })] }), _jsx("input", { id: urlId, type: "url", inputMode: "url", placeholder: "https://example.com", value: form.siteUrl, disabled: !urlEditable, "aria-invalid": urlIssue?.severity === 'error', "aria-describedby": urlIssue ? urlErrId : undefined, onChange: (e) => setField('siteUrl', e.target.value), className: INPUT_CLASS }), urlIssue ? (_jsx("p", { id: urlErrId, className: urlIssue.severity === 'error'
                                ? 'text-destructive mt-1 text-sm'
                                : 'text-warning mt-1 text-sm', children: urlIssue.message })) : urlValid ? (_jsxs("p", { className: "text-muted-foreground mt-1 flex items-center gap-1.5 text-sm", children: [_jsx(CheckCircle2, { size: 13, className: "text-success", "aria-hidden": "true" }), "Valid \u2014 used for canonical URLs, sitemap, robots.txt, and Open Graph."] })) : (_jsx("p", { className: "text-muted-foreground mt-1 text-sm", children: "Used for canonical URLs, sitemap, robots.txt, and Open Graph fallbacks." }))] })] }) }));
}
//# sourceMappingURL=SiteInformationCard.js.map