"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 type { ParsedCompanyScopeText } from "@/lib/company-scope"; import type { CompanyScopeKind } from "@/lib/types"; const SCOPE_KIND_LABELS: Record = { domain: "域名", ip: "IP", cidr: "CIDR", icp: "ICP", keyword: "关键词", }; export function ScopeTextEditor({ id, value, onValueChange, parsed, label = "资产范围", description = "每行一条,自动识别域名、IP、CIDR、ICP 备案和企业关键词。", }: { 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}