"use client"; import { useState } from "react"; import { useRouter } from "next/navigation"; import Link from "next/link"; import { api } from "./api"; import { PRODUCT_TYPES, PRODUCT_STATUSES, SOURCE_MODELS, PRICING_MODELS, OPERATING_SYSTEMS, EXECUTION_MODES, INTERFACES, DEPLOYMENT_MODELS, SOURCE_TYPES, CONFIDENCE, DEPTHS, EDITORIAL_STATUSES, VISIBILITIES } from "@/lib/content/schema"; import { OwnerPanel } from "./owner-panel"; type Rec = Record; const EMPTY: Rec = { slug: "", name: "", aliases: [], vendor: { name: "" }, homepage_url: "", product_type: "application", product_status: "active", summary: "", description: "", capabilities: [], workflows: [], advantages: [], limitations: [], prerequisites: [], audiences: [], alternatives: [], categories: [], tags: [], use_cases: [], operating_systems: [], execution_modes: [], interfaces: [], deployment_models: [], integrations: [], data_formats: [], languages: [], source_model: "open-source", pricing_model: ["free"], self_hostable: null, sources: [{ url: "", type: "official_site", supports: [], checked_at: new Date().toISOString().slice(0, 10) }], confidence: "medium", depth: "standard", editorial_status: "draft", visibility: "public", featured: false, author: "editorial", discovery_method: "editorial-research" }; const lines = (a?: string[]) => (a ?? []).join("\n"); const unlines = (s: string) => s.split("\n").map((x) => x.trim()).filter(Boolean); function Field({ label, children, hint }: { label: string; children: React.ReactNode; hint?: string }) { return ; } function Text({ r, k, set, type = "text", required }: { r: Rec; k: string; set: (k: string, v: any) => void; type?: string; required?: boolean }) { return set(k, e.target.value || undefined)} className="input" required={required} />; } function Lines({ r, k, set, rows = 4 }: { r: Rec; k: string; set: (k: string, v: any) => void; rows?: number }) { return