"use client"; import * as React from "react"; import { Badge } from "@/components/ui/badge"; import { Field, FieldDescription, FieldError, FieldLabel } from "@/components/ui/field"; import { Textarea } from "@/components/ui/textarea"; import { t } from "@/i18n"; import type { ParsedCompanyScopeText } from "@/lib/company-scope"; import type { CompanyScopeKind } from "@/lib/types"; const SCOPE_KIND_LABELS: Record = { domain: t("domain"), ip: "IP", cidr: "CIDR", icp: "ICP", keyword: t("keyword"), }; export function ScopeTextEditor({ id, value, onValueChange, parsed, label = t("Asset scope"), description = t("One per line; domains, IPs, CIDRs, ICP filings, and company keywords are recognized automatically."), }: { id: string; value: string; onValueChange: (value: string) => void; parsed: ParsedCompanyScopeText; label?: string; description?: string; }) { const counts = React.useMemo(() => { const result = new Map(); for (const rule of parsed.rules) result.set(rule.kind, (result.get(rule.kind) ?? 0) + 1); return result; }, [parsed.rules]); return ( 0}> {label} {description}