import { Form, Head, Link, createInertiaApp, router, setLayoutProps, useForm, useHttp, usePage } from "@inertiajs/react";
import { Activity, AlertCircle, AlertCircleIcon, AlertTriangle, ArrowDown, ArrowDownRight, ArrowLeft, ArrowRight, ArrowUp, ArrowUpRight, BarChart3, Beaker, Bell, BellOff, BellRing, BookOpen, Bot, Box, Briefcase, BriefcaseBusiness, Bug, Building, Building2, Check, CheckCheck, CheckCircle2, CheckIcon, ChevronDown, ChevronDownIcon, ChevronLeft, ChevronRight, ChevronUp, ChevronUpIcon, ChevronsUpDown, CircleCheck, CircleIcon, Clipboard, ClipboardList, Clock, Clock3, Cloud, Code2, Cog, Columns3, Copy, CreditCard, Database, Download, Eraser, ExternalLink, Eye, EyeOff, FileText, Filter, Flame, FlaskConical, FormInput, Gauge, GitBranch, Globe, Globe2, GripVertical, Hammer, Hand, HardDrive, Headset, HelpCircle, House, Image, Inbox, Info, Languages, LayoutDashboard, LayoutGrid, LayoutPanelLeft, Library, LifeBuoy, Lightbulb, ListFilter, Loader2, Loader2Icon, LoaderCircle, Lock, LockKeyhole, LogOut, Mail, MailCheck, Map as Map$1, Maximize2, Megaphone, Menu, MessageSquare, MessageSquareQuote, MessagesSquare, Minus, Monitor, Moon, NotebookPen, Package, Palette, PanelBottom, PanelLeftCloseIcon, PanelLeftOpenIcon, PanelRightClose, PanelRightOpen, PanelTop, Pencil, Phone, PhoneOutgoing, Play, Plug, Plus, Quote, Radio, Redo2, RefreshCcw, RefreshCw, RotateCcw, RotateCw, Route, Rss, Ruler, Save, ScanLine, Scissors, ScrollText, Search, Send, Server, Settings, Settings2, Sheet, Shield, ShieldAlert, ShieldCheck, ShieldOff, ShieldX, ShoppingBag, Slack, Sparkles, SquareSlash, Sun, Tag, Tags, Target, TestTube2, ThumbsDown, ThumbsUp, Ticket, Timer, TimerReset, ToggleRight, ToyBrick, Trash2, TrendingUp, TriangleAlert, Type, Undo2, Unplug, Upload, User, UserCheck, UserRound, Users, Wallet, Wand2, Webhook, Workflow, Wrench, X, XCircle, XIcon, Zap } from "lucide-react";
import * as React from "react";
import { Fragment, createContext, useCallback, useContext, useEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
import { clsx } from "clsx";
import { twMerge } from "tailwind-merge";
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
import { Slot } from "@radix-ui/react-slot";
import { cva } from "class-variance-authority";
import * as DialogPrimitive from "@radix-ui/react-dialog";
import * as LabelPrimitive from "@radix-ui/react-label";
import * as SeparatorPrimitive from "@radix-ui/react-separator";
import * as TooltipPrimitive from "@radix-ui/react-tooltip";
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
import * as AvatarPrimitive from "@radix-ui/react-avatar";
import { Toaster, toast } from "sonner";
import * as SelectPrimitive from "@radix-ui/react-select";
import { DndContext, KeyboardSensor, PointerSensor, closestCenter, useSensor, useSensors } from "@dnd-kit/core";
import { SortableContext, arrayMove, sortableKeyboardCoordinates, useSortable, verticalListSortingStrategy } from "@dnd-kit/sortable";
import { CSS } from "@dnd-kit/utilities";
import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
import * as ToggleGroupPrimitive from "@radix-ui/react-toggle-group";
import * as CollapsiblePrimitive from "@radix-ui/react-collapsible";
import { Background, Controls, Handle, MiniMap, Position, ReactFlow, ReactFlowProvider, addEdge, useEdgesState, useNodesState, useReactFlow } from "@xyflow/react";
import { OTPInput, OTPInputContext, REGEXP_ONLY_DIGITS } from "input-otp";
import createServer from "@inertiajs/react/server";
import { DirectionProvider } from "@radix-ui/react-direction";
import ReactDOMServer from "react-dom/server";
//#region \0rolldown/runtime.js
var __defProp = Object.defineProperty;
var __exportAll = (all, no_symbols) => {
	let target = {};
	for (var name in all) __defProp(target, name, {
		get: all[name],
		enumerable: true
	});
	if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
	return target;
};
//#endregion
//#region resources/js/lib/utils.ts
function cn(...inputs) {
	return twMerge(clsx(inputs));
}
function toUrl(url) {
	return typeof url === "string" ? url : url.url;
}
//#endregion
//#region resources/js/components/admin-surface.tsx
function AdminSurface({ children, className }) {
	return /* @__PURE__ */ jsx("div", {
		className: cn("flex min-h-0 flex-1 flex-col bg-card", className),
		children
	});
}
function AdminSurfaceBar({ children, className }) {
	return /* @__PURE__ */ jsx("div", {
		className: cn("flex min-h-10 flex-wrap items-center gap-2 border-b px-3 py-2 sm:py-1.5", className),
		children
	});
}
function AdminSurfaceTitle({ title, subtitle, meta }) {
	return /* @__PURE__ */ jsxs("div", {
		className: "min-w-0 flex-1",
		children: [/* @__PURE__ */ jsxs("div", {
			className: "flex flex-wrap items-center gap-2",
			children: [/* @__PURE__ */ jsx("h1", {
				className: "text-sm font-semibold tracking-tight text-foreground sm:text-base",
				children: title
			}), meta]
		}), subtitle ? /* @__PURE__ */ jsx("p", {
			className: "mt-0.5 text-xs text-muted-foreground sm:text-sm",
			children: subtitle
		}) : null]
	});
}
//#endregion
//#region resources/js/components/ui/button.tsx
var buttonVariants = cva("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-[background-color,border-color,color,box-shadow] disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/40 focus-visible:ring-[2px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive", {
	variants: {
		variant: {
			default: "bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",
			destructive: "bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40",
			outline: "border border-input bg-card shadow-xs hover:bg-accent hover:text-accent-foreground",
			secondary: "bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",
			ghost: "hover:bg-accent hover:text-accent-foreground",
			link: "text-primary underline-offset-4 hover:underline"
		},
		size: {
			default: "h-8 px-3 py-1.5 has-[>svg]:px-2.5",
			sm: "h-7 rounded-md px-2.5 text-xs has-[>svg]:px-2",
			lg: "h-9 rounded-md px-4 has-[>svg]:px-3",
			icon: "size-8"
		}
	},
	defaultVariants: {
		variant: "default",
		size: "default"
	}
});
function Button({ className, variant, size, asChild = false, ...props }) {
	return /* @__PURE__ */ jsx(asChild ? Slot : "button", {
		"data-slot": "button",
		className: cn(buttonVariants({
			variant,
			size,
			className
		})),
		...props
	});
}
//#endregion
//#region resources/js/components/ui/dialog.tsx
function Dialog({ ...props }) {
	return /* @__PURE__ */ jsx(DialogPrimitive.Root, {
		"data-slot": "dialog",
		...props
	});
}
function DialogTrigger({ ...props }) {
	return /* @__PURE__ */ jsx(DialogPrimitive.Trigger, {
		"data-slot": "dialog-trigger",
		...props
	});
}
function DialogPortal({ ...props }) {
	return /* @__PURE__ */ jsx(DialogPrimitive.Portal, {
		"data-slot": "dialog-portal",
		...props
	});
}
function DialogClose({ ...props }) {
	return /* @__PURE__ */ jsx(DialogPrimitive.Close, {
		"data-slot": "dialog-close",
		...props
	});
}
function DialogOverlay({ className, ...props }) {
	return /* @__PURE__ */ jsx(DialogPrimitive.Overlay, {
		"data-slot": "dialog-overlay",
		className: cn("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/80", className),
		...props
	});
}
function DialogContent({ className, children, closeLabel, ...props }) {
	return /* @__PURE__ */ jsxs(DialogPortal, {
		"data-slot": "dialog-portal",
		children: [/* @__PURE__ */ jsx(DialogOverlay, {}), /* @__PURE__ */ jsxs(DialogPrimitive.Content, {
			"data-slot": "dialog-content",
			className: cn("bg-card text-card-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] start-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-5 shadow-lg duration-200 sm:max-w-lg", className),
			...props,
			children: [children, /* @__PURE__ */ jsxs(DialogPrimitive.Close, {
				className: "ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 end-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
				children: [/* @__PURE__ */ jsx(XIcon, {}), /* @__PURE__ */ jsx("span", {
					className: "sr-only",
					children: closeLabel ?? "Close"
				})]
			})]
		})]
	});
}
function DialogHeader({ className, ...props }) {
	return /* @__PURE__ */ jsx("div", {
		"data-slot": "dialog-header",
		className: cn("flex flex-col gap-2 text-center sm:text-start", className),
		...props
	});
}
function DialogFooter({ className, ...props }) {
	return /* @__PURE__ */ jsx("div", {
		"data-slot": "dialog-footer",
		className: cn("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end", className),
		...props
	});
}
function DialogTitle({ className, ...props }) {
	return /* @__PURE__ */ jsx(DialogPrimitive.Title, {
		"data-slot": "dialog-title",
		className: cn("text-base leading-none font-semibold", className),
		...props
	});
}
function DialogDescription({ className, ...props }) {
	return /* @__PURE__ */ jsx(DialogPrimitive.Description, {
		"data-slot": "dialog-description",
		className: cn("text-muted-foreground text-sm", className),
		...props
	});
}
//#endregion
//#region resources/js/components/ui/input.tsx
function Input({ className, type, ...props }) {
	return /* @__PURE__ */ jsx("input", {
		type,
		"data-slot": "input",
		className: cn("border-input bg-background file:text-foreground placeholder:text-muted-foreground/70 selection:bg-primary selection:text-primary-foreground flex h-8 w-full min-w-0 rounded-md border px-3 py-1 text-sm shadow-xs transition-[background-color,border-color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium read-only:bg-muted/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 [&[type=color]]:p-1", "focus-visible:border-ring focus-visible:ring-ring/40 focus-visible:ring-[2px]", "aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive", className),
		...props
	});
}
//#endregion
//#region resources/js/components/confirm-dialog-provider.tsx
var ConfirmDialogContext = createContext(null);
/**
* Provider that supplies `useConfirm()`, `useAlert()`, and `usePrompt()`
* hooks backed by a shadcn Dialog. Mount once near the top of the React
* tree — usage:
*
*   const confirm = useConfirm();
*   const ok = await confirm({ message: 'Sure?', danger: true });
*
*   const alert = useAlert();
*   await alert({ message: 'Saved!' });
*
*   const prompt = usePrompt();
*   const next = await prompt({
*       title: 'Rename article',
*       message: 'New title',
*       defaultValue: current,
*       validate: (v) => (v.trim() === '' ? 'Required' : null),
*   });
*   // next is the string the user submitted, or null on cancel.
*/
function ConfirmDialogProvider({ children }) {
	const [state, setState] = useState(null);
	const [open, setOpen] = useState(false);
	const resolverRef = useRef(null);
	const close = useCallback((result) => {
		setOpen(false);
		const resolver = resolverRef.current;
		resolverRef.current = null;
		if (resolver) resolver(result);
	}, []);
	const confirm = useCallback((options) => {
		return new Promise((resolve) => {
			resolverRef.current = (value) => resolve(value === true);
			setState({
				kind: "confirm",
				options
			});
			setOpen(true);
		});
	}, []);
	const alert = useCallback((options) => {
		return new Promise((resolve) => {
			resolverRef.current = () => resolve();
			setState({
				kind: "alert",
				options
			});
			setOpen(true);
		});
	}, []);
	const prompt = useCallback((options) => {
		return new Promise((resolve) => {
			resolverRef.current = (value) => resolve(typeof value === "string" ? value : null);
			setState({
				kind: "prompt",
				options
			});
			setOpen(true);
		});
	}, []);
	const value = useMemo(() => ({
		confirm,
		alert,
		prompt
	}), [
		confirm,
		alert,
		prompt
	]);
	const isConfirm = state?.kind === "confirm";
	const isPrompt = state?.kind === "prompt";
	const title = state?.options.title;
	const message = state?.options.message ?? "";
	const confirmLabel = isConfirm ? state.options.confirmLabel ?? "Confirm" : isPrompt ? state.options.confirmLabel ?? "Save" : state?.options.confirmLabel ?? "OK";
	const cancelLabel = isConfirm ? state.options.cancelLabel ?? "Cancel" : isPrompt ? state.options.cancelLabel ?? "Cancel" : null;
	const danger = isConfirm ? Boolean(state.options.danger) : false;
	return /* @__PURE__ */ jsxs(ConfirmDialogContext.Provider, {
		value,
		children: [children, open && state !== null ? /* @__PURE__ */ jsx(Dialog, {
			open,
			onOpenChange: (next) => {
				if (!next) close(isPrompt ? null : false);
			},
			children: /* @__PURE__ */ jsxs(DialogContent, { children: [/* @__PURE__ */ jsxs(DialogHeader, { children: [title ? /* @__PURE__ */ jsx(DialogTitle, { children: title }) : null, /* @__PURE__ */ jsx(DialogDescription, { children: message })] }), isPrompt ? /* @__PURE__ */ jsx(PromptBody, {
				options: state.options,
				onSubmit: (value) => close(value),
				onCancel: () => close(null),
				confirmLabel,
				cancelLabel: cancelLabel ?? "Cancel"
			}) : /* @__PURE__ */ jsxs(DialogFooter, { children: [cancelLabel !== null ? /* @__PURE__ */ jsx(Button, {
				type: "button",
				variant: "outline",
				onClick: () => close(false),
				children: cancelLabel
			}) : null, /* @__PURE__ */ jsx(Button, {
				type: "button",
				variant: danger ? "destructive" : "default",
				onClick: () => close(true),
				autoFocus: true,
				children: confirmLabel
			})] })] })
		}) : null]
	});
}
/**
* Input + footer body for the prompt() dialog flavour. Local component
* so the input has its own state (decoupled from the provider) and we
* can autofocus + select-on-mount without re-rendering the provider on
* every keystroke.
*/
function PromptBody({ options, onSubmit, onCancel, confirmLabel, cancelLabel }) {
	const [value, setValue] = useState(options.defaultValue ?? "");
	const [error, setError] = useState(null);
	const inputRef = useRef(null);
	useEffect(() => {
		const el = inputRef.current;
		if (el) {
			el.focus();
			el.select();
		}
	}, []);
	const submit = () => {
		const errorMessage = options.validate?.(value) ?? null;
		if (errorMessage !== null) {
			setError(errorMessage);
			return;
		}
		onSubmit(value);
	};
	return /* @__PURE__ */ jsxs("form", {
		onSubmit: (e) => {
			e.preventDefault();
			submit();
		},
		className: "grid gap-3",
		children: [
			/* @__PURE__ */ jsx(Input, {
				ref: inputRef,
				type: "text",
				value,
				onChange: (e) => {
					setValue(e.target.value);
					if (error !== null) setError(null);
				},
				placeholder: options.placeholder,
				"aria-invalid": error !== null
			}),
			error !== null ? /* @__PURE__ */ jsx("p", {
				className: "text-xs text-destructive",
				children: error
			}) : null,
			/* @__PURE__ */ jsxs(DialogFooter, { children: [/* @__PURE__ */ jsx(Button, {
				type: "button",
				variant: "outline",
				onClick: onCancel,
				children: cancelLabel
			}), /* @__PURE__ */ jsx(Button, {
				type: "submit",
				variant: "default",
				children: confirmLabel
			})] })
		]
	});
}
function useDialogContext() {
	const ctx = useContext(ConfirmDialogContext);
	if (ctx === null) throw new Error("useConfirm/useAlert/usePrompt must be used inside <ConfirmDialogProvider>");
	return ctx;
}
function useConfirm() {
	return useDialogContext().confirm;
}
function useAlert() {
	return useDialogContext().alert;
}
function usePrompt() {
	return useDialogContext().prompt;
}
//#endregion
//#region resources/js/lib/i18n.ts
var FALLBACK_LOCALE = "en";
/**
* Resolve a locale's display label using the catalog the server
* shipped. Falls back to the code in upper-case when the catalog
* doesn't know about it (a JSON file dropped without a matching
* LocaleCatalog entry — still works, just shows "FOO" until someone
* curates the metadata).
*/
function localeLabel(catalog, code) {
	return catalog?.[code]?.native ?? code.toUpperCase();
}
function localeFlag(catalog, code) {
	return catalog?.[code]?.flag ?? "🌐";
}
/**
* Replace `:placeholder` markers and `{name}` markers with values from
* the replacements map. Both styles are supported because Laravel uses
* `:foo` while a lot of older React code uses `{foo}`.
*/
function interpolate(line, replacements) {
	if (!replacements) return line;
	let out = line;
	for (const [key, raw] of Object.entries(replacements)) {
		const value = String(raw);
		out = out.replace(new RegExp(":" + key + "\\b", "g"), value).replace(new RegExp("\\{" + key + "\\}", "g"), value);
	}
	return out;
}
/**
* Pick the singular or plural form from a `singular|plural` line based
* on `count`. Mirrors Laravel's basic `trans_choice` behaviour for the
* common 2-form case (en/es/fr/tr all fit).
*/
function pluralize(line, count) {
	const parts = line.split("|");
	if (parts.length < 2) return line;
	return count === 1 ? parts[0] : parts[1];
}
/**
* Translate a key. The English source string IS the key — that mirrors
* Laravel's `lang/{locale}.json` convention and means a missing
* translation simply renders the English source.
*/
function translate(translations, key, replacements) {
	return interpolate(translations?.[key] ?? key, replacements);
}
/**
* Same as translate but with explicit count for pluralization.
*/
function translateChoice(translations, key, count, replacements) {
	return interpolate(pluralize(translations?.[key] ?? key, count), {
		...replacements,
		count
	});
}
/**
* Reads the i18n payload shared by HandleInertiaRequests. Uses Inertia
* subscriptions so a partial reload that updates `i18n` re-renders
* consumers with the new translation map.
*/
function useI18n() {
	return usePage().props.i18n ?? {
		locale: FALLBACK_LOCALE,
		fallback: FALLBACK_LOCALE,
		supported: [FALLBACK_LOCALE],
		catalog: {},
		translations: {},
		multilingual: false
	};
}
/**
* Hook entry-point used everywhere in the admin SPA:
*
*   const t = useT();
*   <button>{t('Save changes')}</button>
*   <p>{t('Showing :from–:to of :total', { from: 1, to: 10, total: 42 })}</p>
*
* Must only be called inside the Inertia tree. Primitives rendered
* outside (e.g. shadcn Dialog mounted by ConfirmDialogProvider which
* sits above the Inertia root via `withApp`) must NOT call useT() —
* usePage() throws there and crashes the modal. DialogContent uses an
* English `closeLabel` prop with a hardcoded fallback so it works in
* any tree.
*/
function useT() {
	const i18n = useI18n();
	return {
		t: (key, replacements) => translate(i18n.translations, key, replacements),
		tChoice: (key, count, replacements) => translateChoice(i18n.translations, key, count, replacements),
		locale: i18n.locale,
		multilingual: i18n.multilingual
	};
}
//#endregion
//#region resources/js/components/bulk-actions-bar.tsx
/**
* Sticky bottom bar that surfaces selection count + bulk actions
* whenever any row is selected. Auto-hides at count=0.
*
* Render at the end of an index page; the bar floats above content
* via fixed positioning.
*/
function BulkActionsBar({ count, onClear, children, noun }) {
	const { t, tChoice } = useT();
	if (count === 0) return null;
	const label = tChoice(":count :noun selected|:count :nouns selected", count, {
		count,
		noun,
		nouns: `${noun}s`
	});
	return /* @__PURE__ */ jsx("div", {
		className: "pointer-events-none fixed inset-x-0 bottom-4 z-40 flex justify-center px-4",
		children: /* @__PURE__ */ jsxs("div", {
			className: "pointer-events-auto flex items-center gap-3 rounded-full border bg-card px-4 py-2 shadow-lg",
			children: [
				/* @__PURE__ */ jsx("button", {
					type: "button",
					onClick: onClear,
					"aria-label": t("Clear selection"),
					className: "inline-flex size-6 items-center justify-center rounded-md text-muted-foreground transition hover:bg-muted hover:text-foreground",
					children: /* @__PURE__ */ jsx(X, { className: "size-3.5" })
				}),
				/* @__PURE__ */ jsx("span", {
					className: "text-sm font-medium",
					children: label
				}),
				/* @__PURE__ */ jsx("div", {
					className: "flex items-center gap-2",
					children
				})
			]
		})
	});
}
/**
* Convenience destructive action button for the bar. Calls
* `window.confirm()` then invokes `onConfirm`. Most pages just need
* a single "Delete" button.
*/
function BulkDeleteButton({ confirmMessage, onConfirm, label }) {
	const { t } = useT();
	const confirm = useConfirm();
	const text = label ?? t("Delete");
	return /* @__PURE__ */ jsx(Button, {
		type: "button",
		variant: "destructive",
		size: "sm",
		onClick: async () => {
			if (await confirm({
				message: confirmMessage,
				confirmLabel: text,
				danger: true
			})) onConfirm();
		},
		children: text
	});
}
//#endregion
//#region resources/js/lib/direction.ts
/**
* Resolve the writing direction for the current locale. Reads the
* RTL flag from the shared catalog (LocaleCatalog::ENTRIES on the
* server) so adding a new RTL locale to the catalog is the only
* code change needed — every component using this hook flips
* automatically.
*
* Returns the boolean form. Use `useDirection()` if you need the
* 'ltr' | 'rtl' string (e.g. for `dir=` attributes on third-party
* components).
*/
function useIsRtl() {
	const { locale, catalog } = useI18n();
	return catalog?.[locale]?.rtl ?? false;
}
//#endregion
//#region resources/js/components/dir-icon.tsx
/**
* Renders a directional arrow that respects the document writing
* direction. `forward` always points toward the natural reading
* direction (right in LTR, left in RTL). `back` always points away
* from it.
*
*   <DirArrow direction="forward" />   // → in LTR, ← in RTL
*   <DirArrow direction="back" />      // ← in LTR, → in RTL
*
* Use this for icons whose semantic meaning is "next" / "previous" /
* "continue" / "back" — pagination, breadcrumbs, wizard steps.
*
* For icons whose direction has no semantic meaning (paper-plane in
* a chat composer, undo, redo) prefer the `.flip-rtl` utility class
* instead of swapping the icon.
*/
function DirArrow({ direction, style = "arrow", ...rest }) {
	const rtl = useIsRtl();
	const physical = direction === "forward" !== rtl ? "right" : "left";
	if (style === "chevron") return /* @__PURE__ */ jsx(physical === "right" ? ChevronRight : ChevronLeft, { ...rest });
	return /* @__PURE__ */ jsx(physical === "right" ? ArrowRight : ArrowLeft, { ...rest });
}
//#endregion
//#region resources/js/lib/table-query.ts
function buildTableQueryUrl(updates, { resetPage = false, pageParamName = "page" } = {}) {
	const params = new URLSearchParams(window.location.search);
	if (resetPage) params.delete(pageParamName);
	Object.entries(updates).forEach(([key, value]) => {
		const normalized = value?.trim();
		if (!normalized) {
			params.delete(key);
			return;
		}
		params.set(key, normalized);
	});
	const query = params.toString();
	return window.location.pathname + (query === "" ? "" : `?${query}`);
}
function replaceTableQuery(updates, options = {}) {
	router.get(buildTableQueryUrl(updates, options), void 0, {
		preserveScroll: true,
		preserveState: true,
		replace: true,
		only: options.only
	});
}
//#endregion
//#region resources/js/components/table-pagination.tsx
/**
* Page navigator for paginated index pages. It also doubles as the
* compact table status footer for single-page result sets.
*/
function TablePagination({ pagination, only, paramName = "page" }) {
	const { t } = useT();
	const { current_page, last_page, per_page, total } = pagination;
	const goTo = (page) => {
		if (page < 1 || page > last_page || page === current_page) return;
		replaceTableQuery({ [paramName]: page <= 1 ? null : String(page) }, {
			only,
			resetPage: false,
			pageParamName: paramName
		});
	};
	const start = total === 0 ? 0 : (current_page - 1) * per_page + 1;
	const end = total === 0 ? 0 : Math.min(current_page * per_page, total);
	return /* @__PURE__ */ jsxs("div", {
		className: "flex min-h-8 items-center justify-between gap-3 border-t bg-muted/20 px-4 py-1.5 text-xs text-muted-foreground",
		children: [/* @__PURE__ */ jsxs("span", { children: [
			t("Showing"),
			" ",
			/* @__PURE__ */ jsx("span", {
				className: "font-medium text-foreground",
				children: start
			}),
			"–",
			/* @__PURE__ */ jsx("span", {
				className: "font-medium text-foreground",
				children: end
			}),
			" ",
			t("of"),
			" ",
			/* @__PURE__ */ jsx("span", {
				className: "font-medium text-foreground",
				children: total
			})
		] }), /* @__PURE__ */ jsxs("div", {
			className: "flex items-center gap-1",
			children: [
				/* @__PURE__ */ jsx("button", {
					type: "button",
					onClick: () => goTo(current_page - 1),
					disabled: current_page <= 1,
					"aria-label": t("Previous page"),
					className: "flex size-6 items-center justify-center rounded-md border bg-card text-foreground transition hover:bg-muted disabled:cursor-not-allowed disabled:opacity-40",
					children: /* @__PURE__ */ jsx(DirArrow, {
						direction: "back",
						style: "chevron",
						className: "size-4"
					})
				}),
				/* @__PURE__ */ jsxs("span", {
					className: "px-2 tabular-nums",
					children: [
						current_page,
						" / ",
						last_page
					]
				}),
				/* @__PURE__ */ jsx("button", {
					type: "button",
					onClick: () => goTo(current_page + 1),
					disabled: current_page >= last_page,
					"aria-label": t("Next page"),
					className: "flex size-6 items-center justify-center rounded-md border bg-card text-foreground transition hover:bg-muted disabled:cursor-not-allowed disabled:opacity-40",
					children: /* @__PURE__ */ jsx(DirArrow, {
						direction: "forward",
						style: "chevron",
						className: "size-4"
					})
				})
			]
		})]
	});
}
//#endregion
//#region resources/js/components/table-search.tsx
/**
* Debounced search input that pushes the term into the URL via an
* Inertia replace-visit, so the controller picks it up via
* `$request->query('q')` and refilters the list. Reusable across all
* index pages — admin and app — so we don't keep wiring bespoke
* search logic per table.
*
* Skips the visit on first mount: `initialValue` already came from the
* URL, so re-issuing the same visit on render would burn a request
* and flicker the results.
*/
function TableSearch({ placeholder, initialValue = "", paramName = "q", only }) {
	const { t } = useT();
	const resolvedPlaceholder = placeholder ?? t("Search…");
	const [value, setValue] = useState(initialValue);
	const isFirstRender = useRef(true);
	useEffect(() => {
		if (isFirstRender.current) {
			isFirstRender.current = false;
			return;
		}
		const handle = window.setTimeout(() => {
			const trimmed = value.trim();
			replaceTableQuery({ [paramName]: trimmed === "" ? null : trimmed }, { only });
		}, 250);
		return () => window.clearTimeout(handle);
	}, [
		value,
		paramName,
		only
	]);
	return /* @__PURE__ */ jsxs("div", {
		className: "relative w-full max-w-xs",
		children: [
			/* @__PURE__ */ jsx(Search, { className: "pointer-events-none absolute start-2.5 top-1/2 size-3.5 -translate-y-1/2 text-muted-foreground" }),
			/* @__PURE__ */ jsx("input", {
				type: "search",
				value,
				onChange: (e) => setValue(e.target.value),
				placeholder: resolvedPlaceholder,
				className: "h-7 w-full rounded-md border border-input bg-card ps-8 pe-7 text-xs shadow-xs transition outline-none placeholder:text-muted-foreground focus:border-ring focus:ring-2 focus:ring-ring/20"
			}),
			value !== "" && /* @__PURE__ */ jsx("button", {
				type: "button",
				onClick: () => setValue(""),
				"aria-label": t("Clear search"),
				className: "absolute end-1.5 top-1/2 -translate-y-1/2 rounded p-1 text-muted-foreground transition hover:text-foreground",
				children: /* @__PURE__ */ jsx(X, { className: "size-3.5" })
			})
		]
	});
}
//#endregion
//#region resources/js/components/ui/label.tsx
function Label({ className, ...props }) {
	return /* @__PURE__ */ jsx(LabelPrimitive.Root, {
		"data-slot": "label",
		className: cn("text-xs leading-none font-medium text-foreground select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50", className),
		...props
	});
}
//#endregion
//#region resources/js/hooks/use-bulk-selection.ts
/**
* Generic bulk-selection state for index tables. Tracks a Set<string>
* of selected row ids. Plays well with paginated lists — selections
* persist across pages until cleared. Header tri-state derives from
* the current page's id slice, not the whole selection.
*
* Shift-click range select: the hook remembers the last clicked id;
* a shift+click on a row toggles every row BETWEEN the two within the
* supplied `pageIds` array. Caller passes `pageIds` on each toggle
* so the hook can compute the range.
*/
function useBulkSelection() {
	const [selected, setSelected] = useState(() => /* @__PURE__ */ new Set());
	const lastClickedRef = useRef(null);
	const size = selected.size;
	const clear = useCallback(() => {
		setSelected(/* @__PURE__ */ new Set());
		lastClickedRef.current = null;
	}, []);
	const isSelected = useCallback((id) => selected.has(id), [selected]);
	const toggle = useCallback((id, opts) => {
		setSelected((prev) => {
			const next = new Set(prev);
			const last = lastClickedRef.current;
			if (opts?.shiftKey && last && last !== id && opts.pageIds?.length) {
				const ids = opts.pageIds;
				const a = ids.indexOf(last);
				const b = ids.indexOf(id);
				if (a !== -1 && b !== -1) {
					const [start, end] = a < b ? [a, b] : [b, a];
					const turningOn = !prev.has(id);
					for (let i = start; i <= end; i++) if (turningOn) next.add(ids[i]);
					else next.delete(ids[i]);
					lastClickedRef.current = id;
					return next;
				}
			}
			if (next.has(id)) next.delete(id);
			else next.add(id);
			lastClickedRef.current = id;
			return next;
		});
	}, []);
	const selectAll = useCallback((ids) => {
		setSelected((prev) => {
			const next = new Set(prev);
			ids.forEach((id) => next.add(id));
			return next;
		});
	}, []);
	const deselectAll = useCallback((ids) => {
		setSelected((prev) => {
			const next = new Set(prev);
			ids.forEach((id) => next.delete(id));
			return next;
		});
	}, []);
	const allOnPageSelected = useCallback((pageIds) => pageIds.length > 0 && pageIds.every((id) => selected.has(id)), [selected]);
	const someOnPageSelected = useCallback((pageIds) => pageIds.some((id) => selected.has(id)), [selected]);
	const togglePage = useCallback((pageIds) => {
		if (pageIds.length > 0 && pageIds.every((id) => selected.has(id))) deselectAll(pageIds);
		else selectAll(pageIds);
	}, [
		selected,
		selectAll,
		deselectAll
	]);
	return useMemo(() => ({
		selected,
		size,
		clear,
		isSelected,
		toggle,
		selectAll,
		deselectAll,
		togglePage,
		allOnPageSelected,
		someOnPageSelected
	}), [
		selected,
		size,
		clear,
		isSelected,
		toggle,
		selectAll,
		deselectAll,
		togglePage,
		allOnPageSelected,
		someOnPageSelected
	]);
}
//#endregion
//#region resources/js/components/app-logo-icon.tsx
/**
* Pitchbar mark — a stylized speech bubble with a sparkle.
* Inherits `currentColor` so it adapts to dark mode + sidebar tinting.
*/
function AppLogoIcon(props) {
	return /* @__PURE__ */ jsxs("svg", {
		...props,
		viewBox: "0 0 24 24",
		xmlns: "http://www.w3.org/2000/svg",
		fill: "none",
		stroke: "currentColor",
		strokeWidth: "2",
		strokeLinecap: "round",
		strokeLinejoin: "round",
		children: [/* @__PURE__ */ jsx("path", { d: "M21 11.5a8.38 8.38 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.38 8.38 0 0 1-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.38 8.38 0 0 1 3.8-.9h.5a8.48 8.48 0 0 1 8 8v.5z" }), /* @__PURE__ */ jsx("path", { d: "M14 9l1 2 2 1-2 1-1 2-1-2-2-1 2-1z" })]
	});
}
//#endregion
//#region resources/js/lib/brand-display.ts
var BRAND_DISPLAY_OPTIONS = [
	{
		value: "logo_text",
		label: "Logo + text",
		description: "Show the uploaded logo together with the brand name."
	},
	{
		value: "logo_only",
		label: "Only logo",
		description: "Show the uploaded logo only."
	},
	{
		value: "text_only",
		label: "Only text",
		description: "Hide the logo and show the brand name only."
	}
];
function getBrandDisplayParts(mode) {
	switch (mode) {
		case "logo_only": return {
			showLogo: true,
			showText: false
		};
		case "text_only": return {
			showLogo: false,
			showText: true
		};
		default: return {
			showLogo: true,
			showText: true
		};
	}
}
//#endregion
//#region resources/js/components/brand-lockup.tsx
function BrandLockup({ siteTitle, logoUrl, logoDarkUrl, mode, className, logoClassName, textClassName, text, fallbackLogo, alt }) {
	const { showLogo, showText } = getBrandDisplayParts(mode);
	const altText = showText ? alt ?? `${siteTitle} logo` : "";
	const imgClass = cn("h-10 w-auto max-w-[220px] object-contain", logoClassName);
	return /* @__PURE__ */ jsxs("span", {
		className: cn("inline-flex min-w-0 items-center gap-2.5", className),
		children: [
			showLogo ? logoUrl ? logoDarkUrl ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("img", {
				src: logoUrl,
				alt: altText,
				className: cn(imgClass, "dark:hidden")
			}), /* @__PURE__ */ jsx("img", {
				src: logoDarkUrl,
				alt: altText,
				className: cn(imgClass, "hidden dark:block")
			})] }) : /* @__PURE__ */ jsx("img", {
				src: logoUrl,
				alt: altText,
				className: imgClass
			}) : fallbackLogo ?? /* @__PURE__ */ jsx("span", {
				className: "flex size-8 items-center justify-center text-current",
				children: /* @__PURE__ */ jsx(AppLogoIcon, { className: "size-full" })
			}) : null,
			showText ? text ?? /* @__PURE__ */ jsx("span", {
				className: cn("min-w-0", textClassName),
				children: siteTitle
			}) : null,
			showLogo && !showText ? /* @__PURE__ */ jsx("span", {
				className: "sr-only",
				children: siteTitle
			}) : null
		]
	});
}
//#endregion
//#region resources/js/hooks/use-branding.ts
function useBranding() {
	return usePage().props.branding;
}
//#endregion
//#region resources/js/components/app-logo.tsx
function AppLogo() {
	const branding = useBranding();
	const mode = branding.dashboard_brand_display;
	const { showLogo, showText } = getBrandDisplayParts(mode);
	return /* @__PURE__ */ jsx(BrandLockup, {
		siteTitle: branding.site_title,
		logoUrl: branding.dashboard_logo_url,
		logoDarkUrl: branding.dashboard_logo_dark_url,
		mode,
		className: cn("h-8 max-w-full items-center", showLogo && showText ? "gap-2.5" : "gap-0"),
		logoClassName: cn("h-8 w-auto shrink-0 object-contain", showText ? "max-w-[180px]" : "max-w-[220px]"),
		textClassName: "block min-w-0 truncate text-start text-sm font-semibold leading-none",
		fallbackLogo: /* @__PURE__ */ jsx("div", {
			className: "flex aspect-square size-8 items-center justify-center rounded-md bg-foreground text-background",
			children: /* @__PURE__ */ jsx(AppLogoIcon, { className: "size-4" })
		})
	});
}
//#endregion
//#region resources/js/components/ui/separator.tsx
function Separator({ className, orientation = "horizontal", decorative = true, ...props }) {
	return /* @__PURE__ */ jsx(SeparatorPrimitive.Root, {
		"data-slot": "separator-root",
		decorative,
		orientation,
		className: cn("bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px", className),
		...props
	});
}
//#endregion
//#region resources/js/components/ui/sheet.tsx
function Sheet$1({ ...props }) {
	return /* @__PURE__ */ jsx(DialogPrimitive.Root, {
		"data-slot": "sheet",
		...props
	});
}
function SheetPortal({ ...props }) {
	return /* @__PURE__ */ jsx(DialogPrimitive.Portal, {
		"data-slot": "sheet-portal",
		...props
	});
}
function SheetOverlay({ className, ...props }) {
	return /* @__PURE__ */ jsx(DialogPrimitive.Overlay, {
		"data-slot": "sheet-overlay",
		className: cn("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/80", className),
		...props
	});
}
function SheetContent({ className, children, side = "right", ...props }) {
	const { t } = useT();
	return /* @__PURE__ */ jsxs(SheetPortal, { children: [/* @__PURE__ */ jsx(SheetOverlay, {}), /* @__PURE__ */ jsxs(DialogPrimitive.Content, {
		"data-slot": "sheet-content",
		className: cn("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-50 flex flex-col gap-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500", side === "right" && "data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 end-0 h-full w-3/4 border-s sm:max-w-sm", side === "left" && "data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left inset-y-0 start-0 h-full w-3/4 border-e sm:max-w-sm", side === "top" && "data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b", side === "bottom" && "data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t", className),
		...props,
		children: [children, /* @__PURE__ */ jsxs(DialogPrimitive.Close, {
			className: "ring-offset-background focus:ring-ring data-[state=open]:bg-secondary absolute top-4 end-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none",
			children: [/* @__PURE__ */ jsx(XIcon, { className: "size-4" }), /* @__PURE__ */ jsx("span", {
				className: "sr-only",
				children: t("Close")
			})]
		})]
	})] });
}
function SheetHeader({ className, ...props }) {
	return /* @__PURE__ */ jsx("div", {
		"data-slot": "sheet-header",
		className: cn("flex flex-col gap-1.5 p-4", className),
		...props
	});
}
function SheetTitle({ className, ...props }) {
	return /* @__PURE__ */ jsx(DialogPrimitive.Title, {
		"data-slot": "sheet-title",
		className: cn("text-foreground font-semibold", className),
		...props
	});
}
function SheetDescription({ className, ...props }) {
	return /* @__PURE__ */ jsx(DialogPrimitive.Description, {
		"data-slot": "sheet-description",
		className: cn("text-muted-foreground text-sm", className),
		...props
	});
}
//#endregion
//#region resources/js/components/ui/tooltip.tsx
function TooltipProvider({ delayDuration = 0, ...props }) {
	return /* @__PURE__ */ jsx(TooltipPrimitive.Provider, {
		"data-slot": "tooltip-provider",
		delayDuration,
		...props
	});
}
function Tooltip({ ...props }) {
	return /* @__PURE__ */ jsx(TooltipPrimitive.Root, {
		"data-slot": "tooltip",
		...props
	});
}
function TooltipTrigger({ ...props }) {
	return /* @__PURE__ */ jsx(TooltipPrimitive.Trigger, {
		"data-slot": "tooltip-trigger",
		...props
	});
}
function TooltipContent({ className, sideOffset = 4, children, ...props }) {
	return /* @__PURE__ */ jsx(TooltipPrimitive.Portal, { children: /* @__PURE__ */ jsxs(TooltipPrimitive.Content, {
		"data-slot": "tooltip-content",
		sideOffset,
		className: cn("bg-primary text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-w-sm rounded-md px-3 py-1.5 text-xs", className),
		...props,
		children: [children, /* @__PURE__ */ jsx(TooltipPrimitive.Arrow, { className: "bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]" })]
	}) });
}
//#endregion
//#region resources/js/hooks/use-mobile.tsx
var mql = typeof window === "undefined" ? void 0 : window.matchMedia(`(max-width: 767px)`);
function mediaQueryListener(callback) {
	if (!mql) return () => {};
	mql.addEventListener("change", callback);
	return () => {
		mql.removeEventListener("change", callback);
	};
}
function isSmallerThanBreakpoint() {
	return mql?.matches ?? false;
}
function getServerSnapshot() {
	return false;
}
function useIsMobile() {
	return useSyncExternalStore(mediaQueryListener, isSmallerThanBreakpoint, getServerSnapshot);
}
//#endregion
//#region resources/js/components/ui/sidebar.tsx
var SIDEBAR_COOKIE_NAME = "sidebar_state";
var SIDEBAR_COOKIE_MAX_AGE = 3600 * 24 * 7;
var SIDEBAR_LS_KEY = "sidebar_state";
function readPersistedSidebarOpen(fallback) {
	if (typeof window === "undefined") return fallback;
	try {
		const ls = window.localStorage.getItem(SIDEBAR_LS_KEY);
		if (ls === "true") return true;
		if (ls === "false") return false;
	} catch {}
	return fallback;
}
function persistSidebarOpen(open) {
	if (typeof document !== "undefined") document.cookie = `${SIDEBAR_COOKIE_NAME}=${open}; path=/; max-age=${SIDEBAR_COOKIE_MAX_AGE}; SameSite=Lax`;
	try {
		window.localStorage.setItem(SIDEBAR_LS_KEY, String(open));
	} catch {}
}
var SIDEBAR_WIDTH = "16rem";
var SIDEBAR_WIDTH_MOBILE = "18rem";
var SIDEBAR_WIDTH_ICON = "3rem";
var SIDEBAR_KEYBOARD_SHORTCUT = "b";
var SidebarContext = React.createContext(null);
function useSidebar() {
	const context = React.useContext(SidebarContext);
	if (!context) throw new Error("useSidebar must be used within a SidebarProvider.");
	return context;
}
function SidebarProvider({ defaultOpen = true, open: openProp, onOpenChange: setOpenProp, className, style, children, ...props }) {
	const isMobile = useIsMobile();
	const [openMobile, setOpenMobile] = React.useState(false);
	const [_open, _setOpen] = React.useState(() => readPersistedSidebarOpen(defaultOpen));
	const open = openProp ?? _open;
	const setOpen = React.useCallback((value) => {
		const openState = typeof value === "function" ? value(open) : value;
		if (setOpenProp) setOpenProp(openState);
		else _setOpen(openState);
		persistSidebarOpen(openState);
	}, [setOpenProp, open]);
	const toggleSidebar = React.useCallback(() => {
		return isMobile ? setOpenMobile((open) => !open) : setOpen((open) => !open);
	}, [
		isMobile,
		setOpen,
		setOpenMobile
	]);
	React.useEffect(() => {
		const handleKeyDown = (event) => {
			if (event.key === SIDEBAR_KEYBOARD_SHORTCUT && (event.metaKey || event.ctrlKey)) {
				event.preventDefault();
				toggleSidebar();
			}
		};
		window.addEventListener("keydown", handleKeyDown);
		return () => window.removeEventListener("keydown", handleKeyDown);
	}, [toggleSidebar]);
	const state = open ? "expanded" : "collapsed";
	const contextValue = React.useMemo(() => ({
		state,
		open,
		setOpen,
		isMobile,
		openMobile,
		setOpenMobile,
		toggleSidebar
	}), [
		state,
		open,
		setOpen,
		isMobile,
		openMobile,
		setOpenMobile,
		toggleSidebar
	]);
	return /* @__PURE__ */ jsx(SidebarContext.Provider, {
		value: contextValue,
		children: /* @__PURE__ */ jsx("div", {
			"data-slot": "sidebar-wrapper",
			style: {
				"--sidebar-width": SIDEBAR_WIDTH,
				"--sidebar-width-icon": SIDEBAR_WIDTH_ICON,
				...style
			},
			className: cn("group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar flex min-h-svh w-full bg-background", className),
			...props,
			children
		})
	});
}
function Sidebar({ side = "left", variant = "sidebar", collapsible = "offcanvas", className, children, ...props }) {
	const { t } = useT();
	const { isMobile, state, openMobile, setOpenMobile } = useSidebar();
	if (collapsible === "none") return /* @__PURE__ */ jsx("div", {
		"data-slot": "sidebar",
		className: cn("bg-sidebar text-sidebar-foreground flex h-full w-(--sidebar-width) flex-col", className),
		...props,
		children
	});
	if (isMobile) return /* @__PURE__ */ jsxs(Sheet$1, {
		open: openMobile,
		onOpenChange: setOpenMobile,
		...props,
		children: [/* @__PURE__ */ jsxs(SheetHeader, {
			className: "sr-only",
			children: [/* @__PURE__ */ jsx(SheetTitle, { children: t("Sidebar") }), /* @__PURE__ */ jsx(SheetDescription, { children: t("Displays the mobile sidebar.") })]
		}), /* @__PURE__ */ jsx(SheetContent, {
			"data-sidebar": "sidebar",
			"data-slot": "sidebar",
			"data-mobile": "true",
			className: "bg-sidebar text-sidebar-foreground w-(--sidebar-width) p-0 [&>button]:hidden",
			style: { "--sidebar-width": SIDEBAR_WIDTH_MOBILE },
			side,
			children: /* @__PURE__ */ jsx("div", {
				className: "flex h-full w-full flex-col",
				children
			})
		})]
	});
	return /* @__PURE__ */ jsxs("div", {
		className: "group peer text-sidebar-foreground hidden md:block",
		"data-state": state,
		"data-collapsible": state === "collapsed" ? collapsible : "",
		"data-variant": variant,
		"data-side": side,
		"data-slot": "sidebar",
		children: [/* @__PURE__ */ jsx("div", { className: cn("relative h-[calc(100svh-var(--app-shell-top-offset,0px))] w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear", "group-data-[collapsible=offcanvas]:w-0", "group-data-[side=right]:rotate-180", variant === "floating" || variant === "inset" ? "group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]" : "group-data-[collapsible=icon]:w-(--sidebar-width-icon)") }), /* @__PURE__ */ jsx("div", {
			className: cn("fixed top-[var(--app-shell-top-offset,0px)] bottom-0 z-10 hidden h-[calc(100svh-var(--app-shell-top-offset,0px))] w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear md:flex", side === "left" ? "start-0 group-data-[collapsible=offcanvas]:start-[calc(var(--sidebar-width)*-1)]" : "end-0 group-data-[collapsible=offcanvas]:end-[calc(var(--sidebar-width)*-1)]", variant === "floating" || variant === "inset" ? "p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]" : "group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-e group-data-[side=right]:border-s", className),
			...props,
			children: /* @__PURE__ */ jsx("div", {
				"data-sidebar": "sidebar",
				className: "bg-sidebar group-data-[variant=floating]:border-sidebar-border flex h-full w-full flex-col group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:shadow-sm",
				children
			})
		})]
	});
}
function SidebarTrigger({ className, onClick, ...props }) {
	const { t } = useT();
	const { toggleSidebar, isMobile, state } = useSidebar();
	return /* @__PURE__ */ jsxs(Button, {
		"data-sidebar": "trigger",
		"data-slot": "sidebar-trigger",
		variant: "ghost",
		size: "icon",
		className: cn("h-7 w-7", className),
		onClick: (event) => {
			onClick?.(event);
			toggleSidebar();
		},
		...props,
		children: [isMobile || state === "collapsed" ? /* @__PURE__ */ jsx(PanelLeftOpenIcon, {}) : /* @__PURE__ */ jsx(PanelLeftCloseIcon, {}), /* @__PURE__ */ jsx("span", {
			className: "sr-only",
			children: t("Toggle sidebar")
		})]
	});
}
function SidebarInset({ className, ...props }) {
	return /* @__PURE__ */ jsx("main", {
		"data-slot": "sidebar-inset",
		className: cn("bg-background relative flex max-w-full min-h-[calc(100svh-var(--app-shell-top-offset,0px))] flex-1 flex-col", "peer-data-[variant=inset]:min-h-[calc(100svh-(--spacing(4)))] md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ms-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ms-0", className),
		...props
	});
}
function SidebarHeader({ className, ...props }) {
	return /* @__PURE__ */ jsx("div", {
		"data-slot": "sidebar-header",
		"data-sidebar": "header",
		className: cn("flex flex-col gap-1 border-b border-sidebar-border p-2", className),
		...props
	});
}
function SidebarFooter({ className, ...props }) {
	return /* @__PURE__ */ jsx("div", {
		"data-slot": "sidebar-footer",
		"data-sidebar": "footer",
		className: cn("flex flex-col gap-2 border-t border-sidebar-border p-2", className),
		...props
	});
}
function SidebarContent({ className, ...props }) {
	return /* @__PURE__ */ jsx("div", {
		"data-slot": "sidebar-content",
		"data-sidebar": "content",
		className: cn("flex min-h-0 flex-1 flex-col gap-2 overflow-auto py-2 group-data-[collapsible=icon]:overflow-hidden", className),
		...props
	});
}
function SidebarGroup({ className, ...props }) {
	return /* @__PURE__ */ jsx("div", {
		"data-slot": "sidebar-group",
		"data-sidebar": "group",
		className: cn("relative flex w-full min-w-0 flex-col p-2", className),
		...props
	});
}
function SidebarMenu({ className, ...props }) {
	return /* @__PURE__ */ jsx("ul", {
		"data-slot": "sidebar-menu",
		"data-sidebar": "menu",
		className: cn("flex w-full min-w-0 flex-col gap-1", className),
		...props
	});
}
function SidebarMenuItem({ className, ...props }) {
	return /* @__PURE__ */ jsx("li", {
		"data-slot": "sidebar-menu-item",
		"data-sidebar": "menu-item",
		className: cn("group/menu-item relative", className),
		...props
	});
}
var sidebarMenuButtonVariants = cva("peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-start text-[13px] outline-hidden ring-sidebar-ring transition-[width,height,padding,background-color,color] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-data-[sidebar=menu-action]/menu-item:pe-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:justify-center group-data-[collapsible=icon]:gap-0 group-data-[collapsible=icon]:p-2! group-data-[collapsible=icon]:[&>*:not(:first-child)]:hidden [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0", {
	variants: {
		variant: {
			default: "hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",
			outline: "bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]"
		},
		size: {
			default: "h-7 text-[13px]",
			sm: "h-7 text-xs",
			lg: "h-10 text-sm group-data-[collapsible=icon]:p-0!"
		}
	},
	defaultVariants: {
		variant: "default",
		size: "default"
	}
});
function SidebarMenuButton({ asChild = false, isActive = false, variant = "default", size = "default", tooltip, className, ...props }) {
	const Comp = asChild ? Slot : "button";
	const { isMobile, state } = useSidebar();
	const button = /* @__PURE__ */ jsx(Comp, {
		"data-slot": "sidebar-menu-button",
		"data-sidebar": "menu-button",
		"data-size": size,
		"data-active": isActive,
		className: cn(sidebarMenuButtonVariants({
			variant,
			size
		}), className),
		...props
	});
	if (!tooltip) return button;
	if (typeof tooltip === "string") tooltip = { children: tooltip };
	return /* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, {
		asChild: true,
		children: button
	}), /* @__PURE__ */ jsx(TooltipContent, {
		side: "right",
		align: "center",
		hidden: state !== "collapsed" || isMobile,
		...tooltip
	})] });
}
function SidebarMenuBadge({ className, ...props }) {
	return /* @__PURE__ */ jsx("div", {
		"data-slot": "sidebar-menu-badge",
		"data-sidebar": "menu-badge",
		className: cn("text-sidebar-foreground pointer-events-none absolute end-1 flex h-5 min-w-5 items-center justify-center rounded-md px-1 text-xs font-medium tabular-nums select-none", "peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground", "peer-data-[size=sm]/menu-button:top-1", "peer-data-[size=default]/menu-button:top-1.5", "peer-data-[size=lg]/menu-button:top-2.5", "group-data-[collapsible=icon]:hidden", className),
		...props
	});
}
//#endregion
//#region resources/js/hooks/use-current-url.ts
function useCurrentUrl() {
	const page = usePage();
	const currentUrlPath = new URL(page.url, typeof window !== "undefined" ? window.location.origin : "http://localhost").pathname;
	const isCurrentUrl = (urlToCheck, currentUrl, startsWith = false) => {
		const urlToCompare = currentUrl ?? currentUrlPath;
		const urlString = toUrl(urlToCheck);
		const comparePath = (path) => startsWith ? urlToCompare.startsWith(path) : path === urlToCompare;
		if (!urlString.startsWith("http")) return comparePath(urlString);
		try {
			return comparePath(new URL(urlString).pathname);
		} catch {
			return false;
		}
	};
	const isCurrentOrParentUrl = (urlToCheck, currentUrl) => {
		return isCurrentUrl(urlToCheck, currentUrl, true);
	};
	const whenCurrentUrl = (urlToCheck, ifTrue, ifFalse = null) => {
		return isCurrentUrl(urlToCheck) ? ifTrue : ifFalse;
	};
	return {
		currentUrl: currentUrlPath,
		isCurrentUrl,
		isCurrentOrParentUrl,
		whenCurrentUrl
	};
}
//#endregion
//#region resources/js/components/nav-main.tsx
function NavMain({ items = [] }) {
	const { isCurrentOrParentUrl } = useCurrentUrl();
	return /* @__PURE__ */ jsx(SidebarGroup, {
		className: "px-2 py-1",
		children: /* @__PURE__ */ jsx(SidebarMenu, {
			className: "gap-1.5",
			children: items.map((item) => /* @__PURE__ */ jsxs(SidebarMenuItem, { children: [/* @__PURE__ */ jsx(SidebarMenuButton, {
				size: "lg",
				asChild: true,
				isActive: isCurrentOrParentUrl(item.href),
				tooltip: { children: item.title },
				className: cn("h-10 rounded-xl px-3.5 text-sm font-medium text-sidebar-foreground/78 shadow-none transition-all hover:bg-sidebar-accent/70 hover:text-sidebar-foreground data-[active=true]:bg-background data-[active=true]:text-foreground data-[active=true]:shadow-xs data-[active=true]:ring-1 data-[active=true]:ring-sidebar-border/70 [&>svg]:text-sidebar-foreground/60 data-[active=true]:[&>svg]:text-foreground", item.className),
				children: /* @__PURE__ */ jsxs(Link, {
					href: item.href,
					prefetch: true,
					children: [item.icon && /* @__PURE__ */ jsx(item.icon, {}), /* @__PURE__ */ jsx("span", { children: item.title })]
				})
			}), item.badge && /* @__PURE__ */ jsx(SidebarMenuBadge, { children: item.badge })] }, item.title))
		})
	});
}
//#endregion
//#region resources/js/components/ui/dropdown-menu.tsx
function DropdownMenu({ ...props }) {
	return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Root, {
		"data-slot": "dropdown-menu",
		...props
	});
}
function DropdownMenuTrigger({ ...props }) {
	return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Trigger, {
		"data-slot": "dropdown-menu-trigger",
		...props
	});
}
function DropdownMenuContent({ className, sideOffset = 4, ...props }) {
	return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Portal, { children: /* @__PURE__ */ jsx(DropdownMenuPrimitive.Content, {
		"data-slot": "dropdown-menu-content",
		sideOffset,
		className: cn("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 min-w-[8rem] overflow-hidden rounded-md border p-1 shadow-md", className),
		...props
	}) });
}
function DropdownMenuGroup({ ...props }) {
	return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Group, {
		"data-slot": "dropdown-menu-group",
		...props
	});
}
function DropdownMenuItem({ className, inset, variant = "default", ...props }) {
	return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Item, {
		"data-slot": "dropdown-menu-item",
		"data-inset": inset,
		"data-variant": variant,
		className: cn("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive-foreground data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/40 data-[variant=destructive]:focus:text-destructive-foreground data-[variant=destructive]:*:[svg]:!text-destructive-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:ps-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className),
		...props
	});
}
function DropdownMenuCheckboxItem({ className, children, checked, ...props }) {
	return /* @__PURE__ */ jsxs(DropdownMenuPrimitive.CheckboxItem, {
		"data-slot": "dropdown-menu-checkbox-item",
		className: cn("focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pe-2 ps-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className),
		checked,
		...props,
		children: [/* @__PURE__ */ jsx("span", {
			className: "pointer-events-none absolute start-2 flex size-3.5 items-center justify-center",
			children: /* @__PURE__ */ jsx(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx(CheckIcon, { className: "size-4" }) })
		}), children]
	});
}
function DropdownMenuRadioGroup({ ...props }) {
	return /* @__PURE__ */ jsx(DropdownMenuPrimitive.RadioGroup, {
		"data-slot": "dropdown-menu-radio-group",
		...props
	});
}
function DropdownMenuRadioItem({ className, children, ...props }) {
	return /* @__PURE__ */ jsxs(DropdownMenuPrimitive.RadioItem, {
		"data-slot": "dropdown-menu-radio-item",
		className: cn("focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pe-2 ps-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className),
		...props,
		children: [/* @__PURE__ */ jsx("span", {
			className: "pointer-events-none absolute start-2 flex size-3.5 items-center justify-center",
			children: /* @__PURE__ */ jsx(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx(CircleIcon, { className: "size-2 fill-current" }) })
		}), children]
	});
}
function DropdownMenuLabel({ className, inset, ...props }) {
	return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Label, {
		"data-slot": "dropdown-menu-label",
		"data-inset": inset,
		className: cn("px-2 py-1.5 text-sm font-medium data-[inset]:ps-8", className),
		...props
	});
}
function DropdownMenuSeparator({ className, ...props }) {
	return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Separator, {
		"data-slot": "dropdown-menu-separator",
		className: cn("bg-border -mx-1 my-1 h-px", className),
		...props
	});
}
//#endregion
//#region resources/js/components/ui/avatar.tsx
function Avatar({ className, ...props }) {
	return /* @__PURE__ */ jsx(AvatarPrimitive.Root, {
		"data-slot": "avatar",
		className: cn("relative flex size-8 shrink-0 overflow-hidden rounded-full", className),
		...props
	});
}
function AvatarImage({ className, ...props }) {
	return /* @__PURE__ */ jsx(AvatarPrimitive.Image, {
		"data-slot": "avatar-image",
		className: cn("aspect-square size-full", className),
		...props
	});
}
function AvatarFallback({ className, ...props }) {
	return /* @__PURE__ */ jsx(AvatarPrimitive.Fallback, {
		"data-slot": "avatar-fallback",
		className: cn("bg-muted flex size-full items-center justify-center rounded-full", className),
		...props
	});
}
//#endregion
//#region resources/js/hooks/use-initials.tsx
function useInitials() {
	return useCallback((fullName) => {
		const names = fullName.trim().split(" ");
		if (names.length === 0) return "";
		if (names.length === 1) return names[0].charAt(0).toUpperCase();
		return `${names[0].charAt(0)}${names[names.length - 1].charAt(0)}`.toUpperCase();
	}, []);
}
//#endregion
//#region resources/js/components/user-info.tsx
function UserInfo({ user, showEmail = false }) {
	const getInitials = useInitials();
	return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs(Avatar, {
		className: "h-6 w-6 overflow-hidden rounded-full",
		children: [/* @__PURE__ */ jsx(AvatarImage, {
			src: user.avatar,
			alt: user.name
		}), /* @__PURE__ */ jsx(AvatarFallback, {
			className: "rounded-lg bg-neutral-200 text-black dark:bg-neutral-700 dark:text-white",
			children: getInitials(user.name)
		})]
	}), /* @__PURE__ */ jsxs("div", {
		className: "grid flex-1 text-start text-xs leading-tight",
		children: [/* @__PURE__ */ jsx("span", {
			className: "truncate font-medium",
			children: user.name
		}), showEmail && /* @__PURE__ */ jsx("span", {
			className: "truncate text-xs text-muted-foreground",
			children: user.email
		})]
	})] });
}
//#endregion
//#region resources/js/hooks/use-mobile-navigation.ts
function useMobileNavigation() {
	return useCallback(() => {
		document.body.style.removeProperty("pointer-events");
	}, []);
}
//#endregion
//#region resources/js/wayfinder/index.ts
var urlDefaults = () => ({});
var getValue = (value) => {
	if (value === true) return "1";
	if (value === false) return "0";
	return value.toString();
};
var addNestedParams = (obj, prefix, params) => {
	Object.entries(obj).forEach(([subKey, value]) => {
		if (value === void 0) return;
		const paramKey = `${prefix}[${subKey}]`;
		if (Array.isArray(value)) value.forEach((v) => params.append(`${paramKey}[]`, getValue(v)));
		else if (value !== null && typeof value === "object") addNestedParams(value, paramKey, params);
		else if ([
			"string",
			"number",
			"boolean"
		].includes(typeof value)) params.set(paramKey, getValue(value));
	});
};
var clearParamFamily = (params, key) => {
	const toDelete = /* @__PURE__ */ new Set();
	params.forEach((_, paramKey) => {
		if (paramKey === key || paramKey.startsWith(`${key}[`)) toDelete.add(paramKey);
	});
	toDelete.forEach((paramKey) => params.delete(paramKey));
};
var queryParams = (options) => {
	if (!options || !options.query && !options.mergeQuery) return "";
	const query = options.query ?? options.mergeQuery;
	const includeExisting = options.mergeQuery !== void 0;
	const params = new URLSearchParams(includeExisting && typeof window !== "undefined" ? window.location.search : "");
	for (const key in query) {
		const queryValue = query[key];
		if (includeExisting) clearParamFamily(params, key);
		if (queryValue === void 0 || queryValue === null) continue;
		if (Array.isArray(queryValue)) queryValue.forEach((value) => {
			params.append(`${key}[]`, value.toString());
		});
		else if (typeof queryValue === "object") addNestedParams(queryValue, key, params);
		else params.set(key, getValue(queryValue));
	}
	const str = params.toString();
	return str.length > 0 ? `?${str}` : "";
};
var applyUrlDefaults = (existing) => {
	const existingParams = { ...existing ?? {} };
	const defaultParams = urlDefaults();
	for (const key in defaultParams) if (existingParams[key] === void 0 && defaultParams[key] !== void 0) existingParams[key] = defaultParams[key];
	return existingParams;
};
//#endregion
//#region resources/js/routes/index.ts
/**
* @see \Laravel\Fortify\Http\Controllers\AuthenticatedSessionController::login
* @see vendor/laravel/fortify/src/Http/Controllers/AuthenticatedSessionController.php:47
* @route '/login'
*/
var login$3 = (options) => ({
	url: login$3.url(options),
	method: "get"
});
login$3.definition = {
	methods: ["get", "head"],
	url: "/login"
};
/**
* @see \Laravel\Fortify\Http\Controllers\AuthenticatedSessionController::login
* @see vendor/laravel/fortify/src/Http/Controllers/AuthenticatedSessionController.php:47
* @route '/login'
*/
login$3.url = (options) => {
	return login$3.definition.url + queryParams(options);
};
/**
* @see \Laravel\Fortify\Http\Controllers\AuthenticatedSessionController::login
* @see vendor/laravel/fortify/src/Http/Controllers/AuthenticatedSessionController.php:47
* @route '/login'
*/
login$3.get = (options) => ({
	url: login$3.url(options),
	method: "get"
});
/**
* @see \Laravel\Fortify\Http\Controllers\AuthenticatedSessionController::login
* @see vendor/laravel/fortify/src/Http/Controllers/AuthenticatedSessionController.php:47
* @route '/login'
*/
login$3.head = (options) => ({
	url: login$3.url(options),
	method: "head"
});
/**
* @see \Laravel\Fortify\Http\Controllers\AuthenticatedSessionController::login
* @see vendor/laravel/fortify/src/Http/Controllers/AuthenticatedSessionController.php:47
* @route '/login'
*/
var loginForm$1 = (options) => ({
	action: login$3.url(options),
	method: "get"
});
/**
* @see \Laravel\Fortify\Http\Controllers\AuthenticatedSessionController::login
* @see vendor/laravel/fortify/src/Http/Controllers/AuthenticatedSessionController.php:47
* @route '/login'
*/
loginForm$1.get = (options) => ({
	action: login$3.url(options),
	method: "get"
});
/**
* @see \Laravel\Fortify\Http\Controllers\AuthenticatedSessionController::login
* @see vendor/laravel/fortify/src/Http/Controllers/AuthenticatedSessionController.php:47
* @route '/login'
*/
loginForm$1.head = (options) => ({
	action: login$3.url({ [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
login$3.form = loginForm$1;
/**
* @see \Laravel\Fortify\Http\Controllers\AuthenticatedSessionController::logout
* @see vendor/laravel/fortify/src/Http/Controllers/AuthenticatedSessionController.php:100
* @route '/logout'
*/
var logout = (options) => ({
	url: logout.url(options),
	method: "post"
});
logout.definition = {
	methods: ["post"],
	url: "/logout"
};
/**
* @see \Laravel\Fortify\Http\Controllers\AuthenticatedSessionController::logout
* @see vendor/laravel/fortify/src/Http/Controllers/AuthenticatedSessionController.php:100
* @route '/logout'
*/
logout.url = (options) => {
	return logout.definition.url + queryParams(options);
};
/**
* @see \Laravel\Fortify\Http\Controllers\AuthenticatedSessionController::logout
* @see vendor/laravel/fortify/src/Http/Controllers/AuthenticatedSessionController.php:100
* @route '/logout'
*/
logout.post = (options) => ({
	url: logout.url(options),
	method: "post"
});
/**
* @see \Laravel\Fortify\Http\Controllers\AuthenticatedSessionController::logout
* @see vendor/laravel/fortify/src/Http/Controllers/AuthenticatedSessionController.php:100
* @route '/logout'
*/
var logoutForm = (options) => ({
	action: logout.url(options),
	method: "post"
});
/**
* @see \Laravel\Fortify\Http\Controllers\AuthenticatedSessionController::logout
* @see vendor/laravel/fortify/src/Http/Controllers/AuthenticatedSessionController.php:100
* @route '/logout'
*/
logoutForm.post = (options) => ({
	action: logout.url(options),
	method: "post"
});
logout.form = logoutForm;
/**
* @see \Laravel\Fortify\Http\Controllers\RegisteredUserController::register
* @see vendor/laravel/fortify/src/Http/Controllers/RegisteredUserController.php:41
* @route '/register'
*/
var register$1 = (options) => ({
	url: register$1.url(options),
	method: "get"
});
register$1.definition = {
	methods: ["get", "head"],
	url: "/register"
};
/**
* @see \Laravel\Fortify\Http\Controllers\RegisteredUserController::register
* @see vendor/laravel/fortify/src/Http/Controllers/RegisteredUserController.php:41
* @route '/register'
*/
register$1.url = (options) => {
	return register$1.definition.url + queryParams(options);
};
/**
* @see \Laravel\Fortify\Http\Controllers\RegisteredUserController::register
* @see vendor/laravel/fortify/src/Http/Controllers/RegisteredUserController.php:41
* @route '/register'
*/
register$1.get = (options) => ({
	url: register$1.url(options),
	method: "get"
});
/**
* @see \Laravel\Fortify\Http\Controllers\RegisteredUserController::register
* @see vendor/laravel/fortify/src/Http/Controllers/RegisteredUserController.php:41
* @route '/register'
*/
register$1.head = (options) => ({
	url: register$1.url(options),
	method: "head"
});
/**
* @see \Laravel\Fortify\Http\Controllers\RegisteredUserController::register
* @see vendor/laravel/fortify/src/Http/Controllers/RegisteredUserController.php:41
* @route '/register'
*/
var registerForm = (options) => ({
	action: register$1.url(options),
	method: "get"
});
/**
* @see \Laravel\Fortify\Http\Controllers\RegisteredUserController::register
* @see vendor/laravel/fortify/src/Http/Controllers/RegisteredUserController.php:41
* @route '/register'
*/
registerForm.get = (options) => ({
	action: register$1.url(options),
	method: "get"
});
/**
* @see \Laravel\Fortify\Http\Controllers\RegisteredUserController::register
* @see vendor/laravel/fortify/src/Http/Controllers/RegisteredUserController.php:41
* @route '/register'
*/
registerForm.head = (options) => ({
	action: register$1.url({ [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
register$1.form = registerForm;
/**
* @see \App\Http\Controllers\MarketingController::home
* @see app/Http/Controllers/MarketingController.php:28
* @route '/'
*/
var home = (options) => ({
	url: home.url(options),
	method: "get"
});
home.definition = {
	methods: ["get", "head"],
	url: "/"
};
/**
* @see \App\Http\Controllers\MarketingController::home
* @see app/Http/Controllers/MarketingController.php:28
* @route '/'
*/
home.url = (options) => {
	return home.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\MarketingController::home
* @see app/Http/Controllers/MarketingController.php:28
* @route '/'
*/
home.get = (options) => ({
	url: home.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\MarketingController::home
* @see app/Http/Controllers/MarketingController.php:28
* @route '/'
*/
home.head = (options) => ({
	url: home.url(options),
	method: "head"
});
/**
* @see \App\Http\Controllers\MarketingController::home
* @see app/Http/Controllers/MarketingController.php:28
* @route '/'
*/
var homeForm = (options) => ({
	action: home.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\MarketingController::home
* @see app/Http/Controllers/MarketingController.php:28
* @route '/'
*/
homeForm.get = (options) => ({
	action: home.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\MarketingController::home
* @see app/Http/Controllers/MarketingController.php:28
* @route '/'
*/
homeForm.head = (options) => ({
	action: home.url({ [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
home.form = homeForm;
/**
* @see \App\Http\Controllers\Admin\DashboardController::dashboard
* @see app/Http/Controllers/Admin/DashboardController.php:28
* @route '/dashboard'
*/
var dashboard$1 = (options) => ({
	url: dashboard$1.url(options),
	method: "get"
});
dashboard$1.definition = {
	methods: ["get", "head"],
	url: "/dashboard"
};
/**
* @see \App\Http\Controllers\Admin\DashboardController::dashboard
* @see app/Http/Controllers/Admin/DashboardController.php:28
* @route '/dashboard'
*/
dashboard$1.url = (options) => {
	return dashboard$1.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\DashboardController::dashboard
* @see app/Http/Controllers/Admin/DashboardController.php:28
* @route '/dashboard'
*/
dashboard$1.get = (options) => ({
	url: dashboard$1.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\DashboardController::dashboard
* @see app/Http/Controllers/Admin/DashboardController.php:28
* @route '/dashboard'
*/
dashboard$1.head = (options) => ({
	url: dashboard$1.url(options),
	method: "head"
});
/**
* @see \App\Http\Controllers\Admin\DashboardController::dashboard
* @see app/Http/Controllers/Admin/DashboardController.php:28
* @route '/dashboard'
*/
var dashboardForm$1 = (options) => ({
	action: dashboard$1.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\DashboardController::dashboard
* @see app/Http/Controllers/Admin/DashboardController.php:28
* @route '/dashboard'
*/
dashboardForm$1.get = (options) => ({
	action: dashboard$1.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\DashboardController::dashboard
* @see app/Http/Controllers/Admin/DashboardController.php:28
* @route '/dashboard'
*/
dashboardForm$1.head = (options) => ({
	action: dashboard$1.url({ [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
dashboard$1.form = dashboardForm$1;
/**
* @see \App\Http\Controllers\Admin\OnboardingController::onboarding
* @see app/Http/Controllers/Admin/OnboardingController.php:29
* @route '/onboarding'
*/
var onboarding = (options) => ({
	url: onboarding.url(options),
	method: "get"
});
onboarding.definition = {
	methods: ["get", "head"],
	url: "/onboarding"
};
/**
* @see \App\Http\Controllers\Admin\OnboardingController::onboarding
* @see app/Http/Controllers/Admin/OnboardingController.php:29
* @route '/onboarding'
*/
onboarding.url = (options) => {
	return onboarding.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\OnboardingController::onboarding
* @see app/Http/Controllers/Admin/OnboardingController.php:29
* @route '/onboarding'
*/
onboarding.get = (options) => ({
	url: onboarding.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\OnboardingController::onboarding
* @see app/Http/Controllers/Admin/OnboardingController.php:29
* @route '/onboarding'
*/
onboarding.head = (options) => ({
	url: onboarding.url(options),
	method: "head"
});
/**
* @see \App\Http\Controllers\Admin\OnboardingController::onboarding
* @see app/Http/Controllers/Admin/OnboardingController.php:29
* @route '/onboarding'
*/
var onboardingForm = (options) => ({
	action: onboarding.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\OnboardingController::onboarding
* @see app/Http/Controllers/Admin/OnboardingController.php:29
* @route '/onboarding'
*/
onboardingForm.get = (options) => ({
	action: onboarding.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\OnboardingController::onboarding
* @see app/Http/Controllers/Admin/OnboardingController.php:29
* @route '/onboarding'
*/
onboardingForm.head = (options) => ({
	action: onboarding.url({ [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
onboarding.form = onboardingForm;
/**
* @see \App\Http\Controllers\Admin\SearchController::__invoke
* @see app/Http/Controllers/Admin/SearchController.php:22
* @route '/app/search'
*/
var search$1 = (options) => ({
	url: search$1.url(options),
	method: "get"
});
search$1.definition = {
	methods: ["get", "head"],
	url: "/app/search"
};
/**
* @see \App\Http\Controllers\Admin\SearchController::__invoke
* @see app/Http/Controllers/Admin/SearchController.php:22
* @route '/app/search'
*/
search$1.url = (options) => {
	return search$1.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\SearchController::__invoke
* @see app/Http/Controllers/Admin/SearchController.php:22
* @route '/app/search'
*/
search$1.get = (options) => ({
	url: search$1.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\SearchController::__invoke
* @see app/Http/Controllers/Admin/SearchController.php:22
* @route '/app/search'
*/
search$1.head = (options) => ({
	url: search$1.url(options),
	method: "head"
});
/**
* @see \App\Http\Controllers\Admin\SearchController::__invoke
* @see app/Http/Controllers/Admin/SearchController.php:22
* @route '/app/search'
*/
var searchForm$1 = (options) => ({
	action: search$1.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\SearchController::__invoke
* @see app/Http/Controllers/Admin/SearchController.php:22
* @route '/app/search'
*/
searchForm$1.get = (options) => ({
	action: search$1.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\SearchController::__invoke
* @see app/Http/Controllers/Admin/SearchController.php:22
* @route '/app/search'
*/
searchForm$1.head = (options) => ({
	action: search$1.url({ [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
search$1.form = searchForm$1;
/**
* @see \App\Http\Controllers\Admin\SystemHealthController::__invoke
* @see app/Http/Controllers/Admin/SystemHealthController.php:34
* @route '/app/system-health'
*/
var systemHealth = (options) => ({
	url: systemHealth.url(options),
	method: "get"
});
systemHealth.definition = {
	methods: ["get", "head"],
	url: "/app/system-health"
};
/**
* @see \App\Http\Controllers\Admin\SystemHealthController::__invoke
* @see app/Http/Controllers/Admin/SystemHealthController.php:34
* @route '/app/system-health'
*/
systemHealth.url = (options) => {
	return systemHealth.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\SystemHealthController::__invoke
* @see app/Http/Controllers/Admin/SystemHealthController.php:34
* @route '/app/system-health'
*/
systemHealth.get = (options) => ({
	url: systemHealth.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\SystemHealthController::__invoke
* @see app/Http/Controllers/Admin/SystemHealthController.php:34
* @route '/app/system-health'
*/
systemHealth.head = (options) => ({
	url: systemHealth.url(options),
	method: "head"
});
/**
* @see \App\Http\Controllers\Admin\SystemHealthController::__invoke
* @see app/Http/Controllers/Admin/SystemHealthController.php:34
* @route '/app/system-health'
*/
var systemHealthForm = (options) => ({
	action: systemHealth.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\SystemHealthController::__invoke
* @see app/Http/Controllers/Admin/SystemHealthController.php:34
* @route '/app/system-health'
*/
systemHealthForm.get = (options) => ({
	action: systemHealth.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\SystemHealthController::__invoke
* @see app/Http/Controllers/Admin/SystemHealthController.php:34
* @route '/app/system-health'
*/
systemHealthForm.head = (options) => ({
	action: systemHealth.url({ [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
systemHealth.form = systemHealthForm;
//#endregion
//#region resources/js/routes/impersonate/index.ts
/**
* @see \App\Http\Controllers\Admin\Platform\ImpersonateController::stop
* @see app/Http/Controllers/Admin/Platform/ImpersonateController.php:60
* @route '/impersonate/stop'
*/
var stop = (options) => ({
	url: stop.url(options),
	method: "post"
});
stop.definition = {
	methods: ["post"],
	url: "/impersonate/stop"
};
/**
* @see \App\Http\Controllers\Admin\Platform\ImpersonateController::stop
* @see app/Http/Controllers/Admin/Platform/ImpersonateController.php:60
* @route '/impersonate/stop'
*/
stop.url = (options) => {
	return stop.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\Platform\ImpersonateController::stop
* @see app/Http/Controllers/Admin/Platform/ImpersonateController.php:60
* @route '/impersonate/stop'
*/
stop.post = (options) => ({
	url: stop.url(options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\Platform\ImpersonateController::stop
* @see app/Http/Controllers/Admin/Platform/ImpersonateController.php:60
* @route '/impersonate/stop'
*/
var stopForm = (options) => ({
	action: stop.url(options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\Platform\ImpersonateController::stop
* @see app/Http/Controllers/Admin/Platform/ImpersonateController.php:60
* @route '/impersonate/stop'
*/
stopForm.post = (options) => ({
	action: stop.url(options),
	method: "post"
});
stop.form = stopForm;
Object.assign(stop, stop);
//#endregion
//#region resources/js/routes/profile/index.ts
/**
* @see \App\Http\Controllers\Settings\ProfileController::edit
* @see app/Http/Controllers/Settings/ProfileController.php:20
* @route '/settings/profile'
*/
var edit$11 = (options) => ({
	url: edit$11.url(options),
	method: "get"
});
edit$11.definition = {
	methods: ["get", "head"],
	url: "/settings/profile"
};
/**
* @see \App\Http\Controllers\Settings\ProfileController::edit
* @see app/Http/Controllers/Settings/ProfileController.php:20
* @route '/settings/profile'
*/
edit$11.url = (options) => {
	return edit$11.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Settings\ProfileController::edit
* @see app/Http/Controllers/Settings/ProfileController.php:20
* @route '/settings/profile'
*/
edit$11.get = (options) => ({
	url: edit$11.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Settings\ProfileController::edit
* @see app/Http/Controllers/Settings/ProfileController.php:20
* @route '/settings/profile'
*/
edit$11.head = (options) => ({
	url: edit$11.url(options),
	method: "head"
});
/**
* @see \App\Http\Controllers\Settings\ProfileController::edit
* @see app/Http/Controllers/Settings/ProfileController.php:20
* @route '/settings/profile'
*/
var editForm$11 = (options) => ({
	action: edit$11.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Settings\ProfileController::edit
* @see app/Http/Controllers/Settings/ProfileController.php:20
* @route '/settings/profile'
*/
editForm$11.get = (options) => ({
	action: edit$11.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Settings\ProfileController::edit
* @see app/Http/Controllers/Settings/ProfileController.php:20
* @route '/settings/profile'
*/
editForm$11.head = (options) => ({
	action: edit$11.url({ [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
edit$11.form = editForm$11;
/**
* @see \App\Http\Controllers\Settings\ProfileController::update
* @see app/Http/Controllers/Settings/ProfileController.php:31
* @route '/settings/profile'
*/
var update$20 = (options) => ({
	url: update$20.url(options),
	method: "patch"
});
update$20.definition = {
	methods: ["patch"],
	url: "/settings/profile"
};
/**
* @see \App\Http\Controllers\Settings\ProfileController::update
* @see app/Http/Controllers/Settings/ProfileController.php:31
* @route '/settings/profile'
*/
update$20.url = (options) => {
	return update$20.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Settings\ProfileController::update
* @see app/Http/Controllers/Settings/ProfileController.php:31
* @route '/settings/profile'
*/
update$20.patch = (options) => ({
	url: update$20.url(options),
	method: "patch"
});
/**
* @see \App\Http\Controllers\Settings\ProfileController::update
* @see app/Http/Controllers/Settings/ProfileController.php:31
* @route '/settings/profile'
*/
var updateForm$20 = (options) => ({
	action: update$20.url({ [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "PATCH",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
/**
* @see \App\Http\Controllers\Settings\ProfileController::update
* @see app/Http/Controllers/Settings/ProfileController.php:31
* @route '/settings/profile'
*/
updateForm$20.patch = (options) => ({
	action: update$20.url({ [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "PATCH",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
update$20.form = updateForm$20;
/**
* @see \App\Http\Controllers\Settings\ProfileController::destroy
* @see app/Http/Controllers/Settings/ProfileController.php:60
* @route '/settings/profile'
*/
var destroy$26 = (options) => ({
	url: destroy$26.url(options),
	method: "delete"
});
destroy$26.definition = {
	methods: ["delete"],
	url: "/settings/profile"
};
/**
* @see \App\Http\Controllers\Settings\ProfileController::destroy
* @see app/Http/Controllers/Settings/ProfileController.php:60
* @route '/settings/profile'
*/
destroy$26.url = (options) => {
	return destroy$26.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Settings\ProfileController::destroy
* @see app/Http/Controllers/Settings/ProfileController.php:60
* @route '/settings/profile'
*/
destroy$26.delete = (options) => ({
	url: destroy$26.url(options),
	method: "delete"
});
/**
* @see \App\Http\Controllers\Settings\ProfileController::destroy
* @see app/Http/Controllers/Settings/ProfileController.php:60
* @route '/settings/profile'
*/
var destroyForm$26 = (options) => ({
	action: destroy$26.url({ [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "DELETE",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
/**
* @see \App\Http\Controllers\Settings\ProfileController::destroy
* @see app/Http/Controllers/Settings/ProfileController.php:60
* @route '/settings/profile'
*/
destroyForm$26.delete = (options) => ({
	action: destroy$26.url({ [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "DELETE",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
destroy$26.form = destroyForm$26;
Object.assign(edit$11, edit$11), Object.assign(update$20, update$20), Object.assign(destroy$26, destroy$26);
//#endregion
//#region resources/js/components/user-menu-content.tsx
function UserMenuContent({ user }) {
	const cleanup = useMobileNavigation();
	const { t } = useT();
	const { impersonating } = usePage().props;
	const handleLogout = () => {
		cleanup();
		router.flushAll();
	};
	const handleStopImpersonating = () => {
		cleanup();
		router.post(stop.url());
	};
	return /* @__PURE__ */ jsxs(Fragment$1, { children: [
		/* @__PURE__ */ jsx(DropdownMenuLabel, {
			className: "p-0 font-normal",
			children: /* @__PURE__ */ jsx("div", {
				className: "flex items-center gap-2 px-1 py-1.5 text-start text-sm",
				children: /* @__PURE__ */ jsx(UserInfo, {
					user,
					showEmail: true
				})
			})
		}),
		/* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
		/* @__PURE__ */ jsx(DropdownMenuGroup, { children: /* @__PURE__ */ jsx(DropdownMenuItem, {
			asChild: true,
			children: /* @__PURE__ */ jsxs(Link, {
				className: "block w-full cursor-pointer",
				href: edit$11(),
				prefetch: true,
				onClick: cleanup,
				children: [/* @__PURE__ */ jsx(Settings, { className: "me-2" }), t("Settings")]
			})
		}) }),
		impersonating && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(DropdownMenuSeparator, {}), /* @__PURE__ */ jsxs(DropdownMenuItem, {
			onSelect: (e) => {
				e.preventDefault();
				handleStopImpersonating();
			},
			className: "text-amber-700 dark:text-amber-300",
			"data-test": "stop-impersonating-button",
			children: [/* @__PURE__ */ jsx(ShieldOff, { className: "me-2" }), t("Switch back to :name", { name: impersonating.name })]
		})] }),
		/* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
		/* @__PURE__ */ jsx(DropdownMenuItem, {
			asChild: true,
			children: /* @__PURE__ */ jsxs(Link, {
				className: "block w-full cursor-pointer",
				href: logout(),
				as: "button",
				onClick: handleLogout,
				"data-test": "logout-button",
				children: [/* @__PURE__ */ jsx(LogOut, { className: "me-2" }), t("Log out")]
			})
		})
	] });
}
//#endregion
//#region resources/js/components/nav-user.tsx
function NavUser() {
	const { auth } = usePage().props;
	const { state } = useSidebar();
	const isMobile = useIsMobile();
	if (!auth.user) return null;
	return /* @__PURE__ */ jsx(SidebarMenu, { children: /* @__PURE__ */ jsx(SidebarMenuItem, { children: /* @__PURE__ */ jsxs(DropdownMenu, { children: [/* @__PURE__ */ jsx(DropdownMenuTrigger, {
		asChild: true,
		children: /* @__PURE__ */ jsxs(SidebarMenuButton, {
			size: "lg",
			className: "group h-9 text-sidebar-foreground/85 data-[state=open]:bg-sidebar-accent",
			"data-test": "sidebar-menu-button",
			children: [/* @__PURE__ */ jsx(UserInfo, { user: auth.user }), /* @__PURE__ */ jsx(ChevronsUpDown, { className: "ms-auto size-4" })]
		})
	}), /* @__PURE__ */ jsx(DropdownMenuContent, {
		className: "w-(--radix-dropdown-menu-trigger-width) min-w-56 rounded-lg",
		align: "end",
		side: isMobile ? "bottom" : state === "collapsed" ? "right" : "bottom",
		sideOffset: state === "collapsed" && !isMobile ? 8 : 4,
		children: /* @__PURE__ */ jsx(UserMenuContent, { user: auth.user })
	})] }) }) });
}
//#endregion
//#region resources/js/components/admin-sidebar.tsx
function AdminSidebar() {
	const branding = useBranding();
	const { t, multilingual } = useT();
	const adminNav = [
		{
			title: t("Dashboard"),
			href: "/admin",
			icon: LayoutDashboard
		},
		{
			title: t("Workspaces"),
			href: "/admin/workspaces",
			icon: Building2
		},
		{
			title: t("Users"),
			href: "/admin/users",
			icon: Users
		},
		{
			title: t("Agents"),
			href: "/admin/agents",
			icon: Bot
		},
		{
			title: t("Conversations"),
			href: "/admin/conversations",
			icon: MessagesSquare
		},
		{
			title: t("Leads"),
			href: "/admin/leads",
			icon: Inbox
		},
		{
			title: t("Pages"),
			href: "/admin/pages",
			icon: FileText
		},
		...multilingual ? [{
			title: t("Translations"),
			href: "/admin/translations",
			icon: Languages
		}] : [],
		{
			title: t("Plans"),
			href: "/admin/plans",
			icon: Tags
		},
		{
			title: t("Subscriptions"),
			href: "/admin/subscriptions",
			icon: CreditCard
		},
		{
			title: t("Usage"),
			href: "/admin/usage",
			icon: Gauge
		},
		{
			title: t("Queue Health"),
			href: "/admin/queue-health",
			icon: Server
		},
		{
			title: t("Queue Failures"),
			href: "/admin/jobs/failed",
			icon: AlertTriangle
		}
	];
	return /* @__PURE__ */ jsxs(Sidebar, {
		collapsible: "icon",
		className: "border-e border-sidebar-border",
		children: [
			/* @__PURE__ */ jsx(SidebarHeader, {
				className: "border-b border-sidebar-border/80 p-3",
				children: /* @__PURE__ */ jsx(SidebarMenu, { children: /* @__PURE__ */ jsx(SidebarMenuItem, { children: /* @__PURE__ */ jsx(SidebarMenuButton, {
					size: "lg",
					asChild: true,
					tooltip: { children: branding.site_title },
					className: "h-11 rounded-xl px-3 transition-colors group-data-[collapsible=icon]:size-10! group-data-[collapsible=icon]:p-0! hover:bg-sidebar-accent/60",
					children: /* @__PURE__ */ jsx(Link, {
						href: "/admin",
						prefetch: true,
						children: /* @__PURE__ */ jsx(AppLogo, {})
					})
				}) }) })
			}),
			/* @__PURE__ */ jsx(SidebarContent, {
				className: "gap-0 py-3",
				children: /* @__PURE__ */ jsx(NavMain, { items: adminNav })
			}),
			/* @__PURE__ */ jsx(SidebarFooter, { children: /* @__PURE__ */ jsx(NavUser, {}) })
		]
	});
}
//#endregion
//#region resources/js/components/app-content.tsx
function AppContent({ variant = "sidebar", children, ...props }) {
	if (variant === "sidebar") return /* @__PURE__ */ jsx(SidebarInset, {
		...props,
		children
	});
	return /* @__PURE__ */ jsx("main", {
		className: "mx-auto flex h-full w-full max-w-7xl flex-1 flex-col gap-4 rounded-xl",
		...props,
		children
	});
}
//#endregion
//#region resources/js/components/app-shell.tsx
function AppShell({ children, variant = "sidebar", sidebarWidth }) {
	const isOpen = usePage().props.sidebarOpen;
	if (variant === "header") return /* @__PURE__ */ jsx("div", {
		className: "flex min-h-screen w-full flex-col",
		children
	});
	return /* @__PURE__ */ jsx(SidebarProvider, {
		defaultOpen: isOpen,
		style: sidebarWidth ? { "--sidebar-width": sidebarWidth } : void 0,
		children
	});
}
//#endregion
//#region resources/js/routes/settings/system/test/index.ts
/**
* @see \App\Http\Controllers\Admin\Platform\SystemController::mail
* @see app/Http/Controllers/Admin/Platform/SystemController.php:382
* @route '/settings/system/test/mail'
*/
var mail = (options) => ({
	url: mail.url(options),
	method: "post"
});
mail.definition = {
	methods: ["post"],
	url: "/settings/system/test/mail"
};
/**
* @see \App\Http\Controllers\Admin\Platform\SystemController::mail
* @see app/Http/Controllers/Admin/Platform/SystemController.php:382
* @route '/settings/system/test/mail'
*/
mail.url = (options) => {
	return mail.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\Platform\SystemController::mail
* @see app/Http/Controllers/Admin/Platform/SystemController.php:382
* @route '/settings/system/test/mail'
*/
mail.post = (options) => ({
	url: mail.url(options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\Platform\SystemController::mail
* @see app/Http/Controllers/Admin/Platform/SystemController.php:382
* @route '/settings/system/test/mail'
*/
var mailForm = (options) => ({
	action: mail.url(options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\Platform\SystemController::mail
* @see app/Http/Controllers/Admin/Platform/SystemController.php:382
* @route '/settings/system/test/mail'
*/
mailForm.post = (options) => ({
	action: mail.url(options),
	method: "post"
});
mail.form = mailForm;
/**
* @see \App\Http\Controllers\Admin\Platform\SystemController::leadEmail
* @see app/Http/Controllers/Admin/Platform/SystemController.php:415
* @route '/settings/system/test/lead-email'
*/
var leadEmail = (options) => ({
	url: leadEmail.url(options),
	method: "post"
});
leadEmail.definition = {
	methods: ["post"],
	url: "/settings/system/test/lead-email"
};
/**
* @see \App\Http\Controllers\Admin\Platform\SystemController::leadEmail
* @see app/Http/Controllers/Admin/Platform/SystemController.php:415
* @route '/settings/system/test/lead-email'
*/
leadEmail.url = (options) => {
	return leadEmail.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\Platform\SystemController::leadEmail
* @see app/Http/Controllers/Admin/Platform/SystemController.php:415
* @route '/settings/system/test/lead-email'
*/
leadEmail.post = (options) => ({
	url: leadEmail.url(options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\Platform\SystemController::leadEmail
* @see app/Http/Controllers/Admin/Platform/SystemController.php:415
* @route '/settings/system/test/lead-email'
*/
var leadEmailForm = (options) => ({
	action: leadEmail.url(options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\Platform\SystemController::leadEmail
* @see app/Http/Controllers/Admin/Platform/SystemController.php:415
* @route '/settings/system/test/lead-email'
*/
leadEmailForm.post = (options) => ({
	action: leadEmail.url(options),
	method: "post"
});
leadEmail.form = leadEmailForm;
/**
* @see \App\Http\Controllers\Admin\Platform\SystemController::stripe
* @see app/Http/Controllers/Admin/Platform/SystemController.php:453
* @route '/settings/system/test/stripe'
*/
var stripe = (options) => ({
	url: stripe.url(options),
	method: "post"
});
stripe.definition = {
	methods: ["post"],
	url: "/settings/system/test/stripe"
};
/**
* @see \App\Http\Controllers\Admin\Platform\SystemController::stripe
* @see app/Http/Controllers/Admin/Platform/SystemController.php:453
* @route '/settings/system/test/stripe'
*/
stripe.url = (options) => {
	return stripe.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\Platform\SystemController::stripe
* @see app/Http/Controllers/Admin/Platform/SystemController.php:453
* @route '/settings/system/test/stripe'
*/
stripe.post = (options) => ({
	url: stripe.url(options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\Platform\SystemController::stripe
* @see app/Http/Controllers/Admin/Platform/SystemController.php:453
* @route '/settings/system/test/stripe'
*/
var stripeForm = (options) => ({
	action: stripe.url(options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\Platform\SystemController::stripe
* @see app/Http/Controllers/Admin/Platform/SystemController.php:453
* @route '/settings/system/test/stripe'
*/
stripeForm.post = (options) => ({
	action: stripe.url(options),
	method: "post"
});
stripe.form = stripeForm;
/**
* @see \App\Http\Controllers\Admin\Platform\SystemController::paypal
* @see app/Http/Controllers/Admin/Platform/SystemController.php:471
* @route '/settings/system/test/paypal'
*/
var paypal$1 = (options) => ({
	url: paypal$1.url(options),
	method: "post"
});
paypal$1.definition = {
	methods: ["post"],
	url: "/settings/system/test/paypal"
};
/**
* @see \App\Http\Controllers\Admin\Platform\SystemController::paypal
* @see app/Http/Controllers/Admin/Platform/SystemController.php:471
* @route '/settings/system/test/paypal'
*/
paypal$1.url = (options) => {
	return paypal$1.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\Platform\SystemController::paypal
* @see app/Http/Controllers/Admin/Platform/SystemController.php:471
* @route '/settings/system/test/paypal'
*/
paypal$1.post = (options) => ({
	url: paypal$1.url(options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\Platform\SystemController::paypal
* @see app/Http/Controllers/Admin/Platform/SystemController.php:471
* @route '/settings/system/test/paypal'
*/
var paypalForm$1 = (options) => ({
	action: paypal$1.url(options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\Platform\SystemController::paypal
* @see app/Http/Controllers/Admin/Platform/SystemController.php:471
* @route '/settings/system/test/paypal'
*/
paypalForm$1.post = (options) => ({
	action: paypal$1.url(options),
	method: "post"
});
paypal$1.form = paypalForm$1;
/**
* @see \App\Http\Controllers\Admin\Platform\SystemController::razorpay
* @see app/Http/Controllers/Admin/Platform/SystemController.php:499
* @route '/settings/system/test/razorpay'
*/
var razorpay$1 = (options) => ({
	url: razorpay$1.url(options),
	method: "post"
});
razorpay$1.definition = {
	methods: ["post"],
	url: "/settings/system/test/razorpay"
};
/**
* @see \App\Http\Controllers\Admin\Platform\SystemController::razorpay
* @see app/Http/Controllers/Admin/Platform/SystemController.php:499
* @route '/settings/system/test/razorpay'
*/
razorpay$1.url = (options) => {
	return razorpay$1.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\Platform\SystemController::razorpay
* @see app/Http/Controllers/Admin/Platform/SystemController.php:499
* @route '/settings/system/test/razorpay'
*/
razorpay$1.post = (options) => ({
	url: razorpay$1.url(options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\Platform\SystemController::razorpay
* @see app/Http/Controllers/Admin/Platform/SystemController.php:499
* @route '/settings/system/test/razorpay'
*/
var razorpayForm$1 = (options) => ({
	action: razorpay$1.url(options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\Platform\SystemController::razorpay
* @see app/Http/Controllers/Admin/Platform/SystemController.php:499
* @route '/settings/system/test/razorpay'
*/
razorpayForm$1.post = (options) => ({
	action: razorpay$1.url(options),
	method: "post"
});
razorpay$1.form = razorpayForm$1;
/**
* @see \App\Http\Controllers\Admin\Platform\SystemController::llm
* @see app/Http/Controllers/Admin/Platform/SystemController.php:526
* @route '/settings/system/test/llm'
*/
var llm = (options) => ({
	url: llm.url(options),
	method: "post"
});
llm.definition = {
	methods: ["post"],
	url: "/settings/system/test/llm"
};
/**
* @see \App\Http\Controllers\Admin\Platform\SystemController::llm
* @see app/Http/Controllers/Admin/Platform/SystemController.php:526
* @route '/settings/system/test/llm'
*/
llm.url = (options) => {
	return llm.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\Platform\SystemController::llm
* @see app/Http/Controllers/Admin/Platform/SystemController.php:526
* @route '/settings/system/test/llm'
*/
llm.post = (options) => ({
	url: llm.url(options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\Platform\SystemController::llm
* @see app/Http/Controllers/Admin/Platform/SystemController.php:526
* @route '/settings/system/test/llm'
*/
var llmForm = (options) => ({
	action: llm.url(options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\Platform\SystemController::llm
* @see app/Http/Controllers/Admin/Platform/SystemController.php:526
* @route '/settings/system/test/llm'
*/
llmForm.post = (options) => ({
	action: llm.url(options),
	method: "post"
});
llm.form = llmForm;
/**
* @see \App\Http\Controllers\Admin\Platform\SystemController::embed
* @see app/Http/Controllers/Admin/Platform/SystemController.php:634
* @route '/settings/system/test/embed'
*/
var embed = (options) => ({
	url: embed.url(options),
	method: "post"
});
embed.definition = {
	methods: ["post"],
	url: "/settings/system/test/embed"
};
/**
* @see \App\Http\Controllers\Admin\Platform\SystemController::embed
* @see app/Http/Controllers/Admin/Platform/SystemController.php:634
* @route '/settings/system/test/embed'
*/
embed.url = (options) => {
	return embed.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\Platform\SystemController::embed
* @see app/Http/Controllers/Admin/Platform/SystemController.php:634
* @route '/settings/system/test/embed'
*/
embed.post = (options) => ({
	url: embed.url(options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\Platform\SystemController::embed
* @see app/Http/Controllers/Admin/Platform/SystemController.php:634
* @route '/settings/system/test/embed'
*/
var embedForm = (options) => ({
	action: embed.url(options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\Platform\SystemController::embed
* @see app/Http/Controllers/Admin/Platform/SystemController.php:634
* @route '/settings/system/test/embed'
*/
embedForm.post = (options) => ({
	action: embed.url(options),
	method: "post"
});
embed.form = embedForm;
/**
* @see \App\Http\Controllers\Admin\Platform\SystemController::cache
* @see app/Http/Controllers/Admin/Platform/SystemController.php:650
* @route '/settings/system/test/cache'
*/
var cache = (options) => ({
	url: cache.url(options),
	method: "post"
});
cache.definition = {
	methods: ["post"],
	url: "/settings/system/test/cache"
};
/**
* @see \App\Http\Controllers\Admin\Platform\SystemController::cache
* @see app/Http/Controllers/Admin/Platform/SystemController.php:650
* @route '/settings/system/test/cache'
*/
cache.url = (options) => {
	return cache.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\Platform\SystemController::cache
* @see app/Http/Controllers/Admin/Platform/SystemController.php:650
* @route '/settings/system/test/cache'
*/
cache.post = (options) => ({
	url: cache.url(options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\Platform\SystemController::cache
* @see app/Http/Controllers/Admin/Platform/SystemController.php:650
* @route '/settings/system/test/cache'
*/
var cacheForm = (options) => ({
	action: cache.url(options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\Platform\SystemController::cache
* @see app/Http/Controllers/Admin/Platform/SystemController.php:650
* @route '/settings/system/test/cache'
*/
cacheForm.post = (options) => ({
	action: cache.url(options),
	method: "post"
});
cache.form = cacheForm;
var test$1 = {
	mail: Object.assign(mail, mail),
	leadEmail: Object.assign(leadEmail, leadEmail),
	stripe: Object.assign(stripe, stripe),
	paypal: Object.assign(paypal$1, paypal$1),
	razorpay: Object.assign(razorpay$1, razorpay$1),
	llm: Object.assign(llm, llm),
	embed: Object.assign(embed, embed),
	cache: Object.assign(cache, cache)
};
//#endregion
//#region resources/js/routes/settings/system/probe/index.ts
/**
* @see \App\Http\Controllers\Admin\Platform\SystemController::llmLatency
* @see app/Http/Controllers/Admin/Platform/SystemController.php:588
* @route '/settings/system/probe/llm-latency'
*/
var llmLatency = (options) => ({
	url: llmLatency.url(options),
	method: "post"
});
llmLatency.definition = {
	methods: ["post"],
	url: "/settings/system/probe/llm-latency"
};
/**
* @see \App\Http\Controllers\Admin\Platform\SystemController::llmLatency
* @see app/Http/Controllers/Admin/Platform/SystemController.php:588
* @route '/settings/system/probe/llm-latency'
*/
llmLatency.url = (options) => {
	return llmLatency.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\Platform\SystemController::llmLatency
* @see app/Http/Controllers/Admin/Platform/SystemController.php:588
* @route '/settings/system/probe/llm-latency'
*/
llmLatency.post = (options) => ({
	url: llmLatency.url(options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\Platform\SystemController::llmLatency
* @see app/Http/Controllers/Admin/Platform/SystemController.php:588
* @route '/settings/system/probe/llm-latency'
*/
var llmLatencyForm = (options) => ({
	action: llmLatency.url(options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\Platform\SystemController::llmLatency
* @see app/Http/Controllers/Admin/Platform/SystemController.php:588
* @route '/settings/system/probe/llm-latency'
*/
llmLatencyForm.post = (options) => ({
	action: llmLatency.url(options),
	method: "post"
});
llmLatency.form = llmLatencyForm;
/**
* @see \App\Http\Controllers\Admin\Platform\SystemController::cloudflareModels
* @see app/Http/Controllers/Admin/Platform/SystemController.php:618
* @route '/settings/system/probe/cloudflare-models'
*/
var cloudflareModels = (options) => ({
	url: cloudflareModels.url(options),
	method: "post"
});
cloudflareModels.definition = {
	methods: ["post"],
	url: "/settings/system/probe/cloudflare-models"
};
/**
* @see \App\Http\Controllers\Admin\Platform\SystemController::cloudflareModels
* @see app/Http/Controllers/Admin/Platform/SystemController.php:618
* @route '/settings/system/probe/cloudflare-models'
*/
cloudflareModels.url = (options) => {
	return cloudflareModels.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\Platform\SystemController::cloudflareModels
* @see app/Http/Controllers/Admin/Platform/SystemController.php:618
* @route '/settings/system/probe/cloudflare-models'
*/
cloudflareModels.post = (options) => ({
	url: cloudflareModels.url(options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\Platform\SystemController::cloudflareModels
* @see app/Http/Controllers/Admin/Platform/SystemController.php:618
* @route '/settings/system/probe/cloudflare-models'
*/
var cloudflareModelsForm = (options) => ({
	action: cloudflareModels.url(options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\Platform\SystemController::cloudflareModels
* @see app/Http/Controllers/Admin/Platform/SystemController.php:618
* @route '/settings/system/probe/cloudflare-models'
*/
cloudflareModelsForm.post = (options) => ({
	action: cloudflareModels.url(options),
	method: "post"
});
cloudflareModels.form = cloudflareModelsForm;
var probe = {
	llmLatency: Object.assign(llmLatency, llmLatency),
	cloudflareModels: Object.assign(cloudflareModels, cloudflareModels)
};
//#endregion
//#region resources/js/routes/settings/system/widget-monitor/index.ts
/**
* @see \App\Http\Controllers\Admin\Platform\WidgetMonitorController::resolve
* @see app/Http/Controllers/Admin/Platform/WidgetMonitorController.php:100
* @route '/settings/system/widget-monitor/{widgetEvent}/resolve'
*/
var resolve$1 = (args, options) => ({
	url: resolve$1.url(args, options),
	method: "post"
});
resolve$1.definition = {
	methods: ["post"],
	url: "/settings/system/widget-monitor/{widgetEvent}/resolve"
};
/**
* @see \App\Http\Controllers\Admin\Platform\WidgetMonitorController::resolve
* @see app/Http/Controllers/Admin/Platform/WidgetMonitorController.php:100
* @route '/settings/system/widget-monitor/{widgetEvent}/resolve'
*/
resolve$1.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { widgetEvent: args };
	if (typeof args === "object" && !Array.isArray(args) && "id" in args) args = { widgetEvent: args.id };
	if (Array.isArray(args)) args = { widgetEvent: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { widgetEvent: typeof args.widgetEvent === "object" ? args.widgetEvent.id : args.widgetEvent };
	return resolve$1.definition.url.replace("{widgetEvent}", parsedArgs.widgetEvent.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\Platform\WidgetMonitorController::resolve
* @see app/Http/Controllers/Admin/Platform/WidgetMonitorController.php:100
* @route '/settings/system/widget-monitor/{widgetEvent}/resolve'
*/
resolve$1.post = (args, options) => ({
	url: resolve$1.url(args, options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\Platform\WidgetMonitorController::resolve
* @see app/Http/Controllers/Admin/Platform/WidgetMonitorController.php:100
* @route '/settings/system/widget-monitor/{widgetEvent}/resolve'
*/
var resolveForm$1 = (args, options) => ({
	action: resolve$1.url(args, options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\Platform\WidgetMonitorController::resolve
* @see app/Http/Controllers/Admin/Platform/WidgetMonitorController.php:100
* @route '/settings/system/widget-monitor/{widgetEvent}/resolve'
*/
resolveForm$1.post = (args, options) => ({
	action: resolve$1.url(args, options),
	method: "post"
});
resolve$1.form = resolveForm$1;
var widgetMonitor$1 = { resolve: Object.assign(resolve$1, resolve$1) };
//#endregion
//#region resources/js/routes/settings/system/cron-worker/index.ts
/**
* @see \App\Http\Controllers\Admin\Platform\CronWorkerController::deploy
* @see app/Http/Controllers/Admin/Platform/CronWorkerController.php:27
* @route '/settings/system/cron-worker/deploy'
*/
var deploy = (options) => ({
	url: deploy.url(options),
	method: "post"
});
deploy.definition = {
	methods: ["post"],
	url: "/settings/system/cron-worker/deploy"
};
/**
* @see \App\Http\Controllers\Admin\Platform\CronWorkerController::deploy
* @see app/Http/Controllers/Admin/Platform/CronWorkerController.php:27
* @route '/settings/system/cron-worker/deploy'
*/
deploy.url = (options) => {
	return deploy.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\Platform\CronWorkerController::deploy
* @see app/Http/Controllers/Admin/Platform/CronWorkerController.php:27
* @route '/settings/system/cron-worker/deploy'
*/
deploy.post = (options) => ({
	url: deploy.url(options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\Platform\CronWorkerController::deploy
* @see app/Http/Controllers/Admin/Platform/CronWorkerController.php:27
* @route '/settings/system/cron-worker/deploy'
*/
var deployForm = (options) => ({
	action: deploy.url(options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\Platform\CronWorkerController::deploy
* @see app/Http/Controllers/Admin/Platform/CronWorkerController.php:27
* @route '/settings/system/cron-worker/deploy'
*/
deployForm.post = (options) => ({
	action: deploy.url(options),
	method: "post"
});
deploy.form = deployForm;
/**
* @see \App\Http\Controllers\Admin\Platform\CronWorkerController::status
* @see app/Http/Controllers/Admin/Platform/CronWorkerController.php:108
* @route '/settings/system/cron-worker/status'
*/
var status = (options) => ({
	url: status.url(options),
	method: "get"
});
status.definition = {
	methods: ["get", "head"],
	url: "/settings/system/cron-worker/status"
};
/**
* @see \App\Http\Controllers\Admin\Platform\CronWorkerController::status
* @see app/Http/Controllers/Admin/Platform/CronWorkerController.php:108
* @route '/settings/system/cron-worker/status'
*/
status.url = (options) => {
	return status.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\Platform\CronWorkerController::status
* @see app/Http/Controllers/Admin/Platform/CronWorkerController.php:108
* @route '/settings/system/cron-worker/status'
*/
status.get = (options) => ({
	url: status.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\CronWorkerController::status
* @see app/Http/Controllers/Admin/Platform/CronWorkerController.php:108
* @route '/settings/system/cron-worker/status'
*/
status.head = (options) => ({
	url: status.url(options),
	method: "head"
});
/**
* @see \App\Http\Controllers\Admin\Platform\CronWorkerController::status
* @see app/Http/Controllers/Admin/Platform/CronWorkerController.php:108
* @route '/settings/system/cron-worker/status'
*/
var statusForm = (options) => ({
	action: status.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\CronWorkerController::status
* @see app/Http/Controllers/Admin/Platform/CronWorkerController.php:108
* @route '/settings/system/cron-worker/status'
*/
statusForm.get = (options) => ({
	action: status.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\CronWorkerController::status
* @see app/Http/Controllers/Admin/Platform/CronWorkerController.php:108
* @route '/settings/system/cron-worker/status'
*/
statusForm.head = (options) => ({
	action: status.url({ [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
status.form = statusForm;
/**
* @see \App\Http\Controllers\Admin\Platform\CronWorkerController::destroy
* @see app/Http/Controllers/Admin/Platform/CronWorkerController.php:153
* @route '/settings/system/cron-worker'
*/
var destroy$25 = (options) => ({
	url: destroy$25.url(options),
	method: "delete"
});
destroy$25.definition = {
	methods: ["delete"],
	url: "/settings/system/cron-worker"
};
/**
* @see \App\Http\Controllers\Admin\Platform\CronWorkerController::destroy
* @see app/Http/Controllers/Admin/Platform/CronWorkerController.php:153
* @route '/settings/system/cron-worker'
*/
destroy$25.url = (options) => {
	return destroy$25.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\Platform\CronWorkerController::destroy
* @see app/Http/Controllers/Admin/Platform/CronWorkerController.php:153
* @route '/settings/system/cron-worker'
*/
destroy$25.delete = (options) => ({
	url: destroy$25.url(options),
	method: "delete"
});
/**
* @see \App\Http\Controllers\Admin\Platform\CronWorkerController::destroy
* @see app/Http/Controllers/Admin/Platform/CronWorkerController.php:153
* @route '/settings/system/cron-worker'
*/
var destroyForm$25 = (options) => ({
	action: destroy$25.url({ [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "DELETE",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\Platform\CronWorkerController::destroy
* @see app/Http/Controllers/Admin/Platform/CronWorkerController.php:153
* @route '/settings/system/cron-worker'
*/
destroyForm$25.delete = (options) => ({
	action: destroy$25.url({ [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "DELETE",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
destroy$25.form = destroyForm$25;
var cronWorker = {
	deploy: Object.assign(deploy, deploy),
	status: Object.assign(status, status),
	destroy: Object.assign(destroy$25, destroy$25)
};
//#endregion
//#region resources/js/routes/settings/system/index.ts
/**
* @see \App\Http\Controllers\Admin\Platform\SystemController::index
* @see app/Http/Controllers/Admin/Platform/SystemController.php:59
* @route '/settings/system'
*/
var index$35 = (options) => ({
	url: index$35.url(options),
	method: "get"
});
index$35.definition = {
	methods: ["get", "head"],
	url: "/settings/system"
};
/**
* @see \App\Http\Controllers\Admin\Platform\SystemController::index
* @see app/Http/Controllers/Admin/Platform/SystemController.php:59
* @route '/settings/system'
*/
index$35.url = (options) => {
	return index$35.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\Platform\SystemController::index
* @see app/Http/Controllers/Admin/Platform/SystemController.php:59
* @route '/settings/system'
*/
index$35.get = (options) => ({
	url: index$35.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\SystemController::index
* @see app/Http/Controllers/Admin/Platform/SystemController.php:59
* @route '/settings/system'
*/
index$35.head = (options) => ({
	url: index$35.url(options),
	method: "head"
});
/**
* @see \App\Http\Controllers\Admin\Platform\SystemController::index
* @see app/Http/Controllers/Admin/Platform/SystemController.php:59
* @route '/settings/system'
*/
var indexForm$35 = (options) => ({
	action: index$35.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\SystemController::index
* @see app/Http/Controllers/Admin/Platform/SystemController.php:59
* @route '/settings/system'
*/
indexForm$35.get = (options) => ({
	action: index$35.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\SystemController::index
* @see app/Http/Controllers/Admin/Platform/SystemController.php:59
* @route '/settings/system'
*/
indexForm$35.head = (options) => ({
	action: index$35.url({ [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
index$35.form = indexForm$35;
/**
* @see \App\Http\Controllers\Admin\Platform\SystemController::update
* @see app/Http/Controllers/Admin/Platform/SystemController.php:202
* @route '/settings/system/{section}'
*/
var update$19 = (args, options) => ({
	url: update$19.url(args, options),
	method: "patch"
});
update$19.definition = {
	methods: ["patch"],
	url: "/settings/system/{section}"
};
/**
* @see \App\Http\Controllers\Admin\Platform\SystemController::update
* @see app/Http/Controllers/Admin/Platform/SystemController.php:202
* @route '/settings/system/{section}'
*/
update$19.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { section: args };
	if (Array.isArray(args)) args = { section: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { section: args.section };
	return update$19.definition.url.replace("{section}", parsedArgs.section.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\Platform\SystemController::update
* @see app/Http/Controllers/Admin/Platform/SystemController.php:202
* @route '/settings/system/{section}'
*/
update$19.patch = (args, options) => ({
	url: update$19.url(args, options),
	method: "patch"
});
/**
* @see \App\Http\Controllers\Admin\Platform\SystemController::update
* @see app/Http/Controllers/Admin/Platform/SystemController.php:202
* @route '/settings/system/{section}'
*/
var updateForm$19 = (args, options) => ({
	action: update$19.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "PATCH",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\Platform\SystemController::update
* @see app/Http/Controllers/Admin/Platform/SystemController.php:202
* @route '/settings/system/{section}'
*/
updateForm$19.patch = (args, options) => ({
	action: update$19.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "PATCH",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
update$19.form = updateForm$19;
/**
* @see \App\Http\Controllers\Admin\Platform\HotPathLatencyController::hotpathLatency
* @see app/Http/Controllers/Admin/Platform/HotPathLatencyController.php:25
* @route '/settings/system/hotpath-latency'
*/
var hotpathLatency = (options) => ({
	url: hotpathLatency.url(options),
	method: "get"
});
hotpathLatency.definition = {
	methods: ["get", "head"],
	url: "/settings/system/hotpath-latency"
};
/**
* @see \App\Http\Controllers\Admin\Platform\HotPathLatencyController::hotpathLatency
* @see app/Http/Controllers/Admin/Platform/HotPathLatencyController.php:25
* @route '/settings/system/hotpath-latency'
*/
hotpathLatency.url = (options) => {
	return hotpathLatency.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\Platform\HotPathLatencyController::hotpathLatency
* @see app/Http/Controllers/Admin/Platform/HotPathLatencyController.php:25
* @route '/settings/system/hotpath-latency'
*/
hotpathLatency.get = (options) => ({
	url: hotpathLatency.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\HotPathLatencyController::hotpathLatency
* @see app/Http/Controllers/Admin/Platform/HotPathLatencyController.php:25
* @route '/settings/system/hotpath-latency'
*/
hotpathLatency.head = (options) => ({
	url: hotpathLatency.url(options),
	method: "head"
});
/**
* @see \App\Http\Controllers\Admin\Platform\HotPathLatencyController::hotpathLatency
* @see app/Http/Controllers/Admin/Platform/HotPathLatencyController.php:25
* @route '/settings/system/hotpath-latency'
*/
var hotpathLatencyForm = (options) => ({
	action: hotpathLatency.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\HotPathLatencyController::hotpathLatency
* @see app/Http/Controllers/Admin/Platform/HotPathLatencyController.php:25
* @route '/settings/system/hotpath-latency'
*/
hotpathLatencyForm.get = (options) => ({
	action: hotpathLatency.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\HotPathLatencyController::hotpathLatency
* @see app/Http/Controllers/Admin/Platform/HotPathLatencyController.php:25
* @route '/settings/system/hotpath-latency'
*/
hotpathLatencyForm.head = (options) => ({
	action: hotpathLatency.url({ [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
hotpathLatency.form = hotpathLatencyForm;
/**
* @see \App\Http\Controllers\Admin\Platform\WidgetMonitorController::widgetMonitor
* @see app/Http/Controllers/Admin/Platform/WidgetMonitorController.php:36
* @route '/settings/system/widget-monitor'
*/
var widgetMonitor = (options) => ({
	url: widgetMonitor.url(options),
	method: "get"
});
widgetMonitor.definition = {
	methods: ["get", "head"],
	url: "/settings/system/widget-monitor"
};
/**
* @see \App\Http\Controllers\Admin\Platform\WidgetMonitorController::widgetMonitor
* @see app/Http/Controllers/Admin/Platform/WidgetMonitorController.php:36
* @route '/settings/system/widget-monitor'
*/
widgetMonitor.url = (options) => {
	return widgetMonitor.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\Platform\WidgetMonitorController::widgetMonitor
* @see app/Http/Controllers/Admin/Platform/WidgetMonitorController.php:36
* @route '/settings/system/widget-monitor'
*/
widgetMonitor.get = (options) => ({
	url: widgetMonitor.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\WidgetMonitorController::widgetMonitor
* @see app/Http/Controllers/Admin/Platform/WidgetMonitorController.php:36
* @route '/settings/system/widget-monitor'
*/
widgetMonitor.head = (options) => ({
	url: widgetMonitor.url(options),
	method: "head"
});
/**
* @see \App\Http\Controllers\Admin\Platform\WidgetMonitorController::widgetMonitor
* @see app/Http/Controllers/Admin/Platform/WidgetMonitorController.php:36
* @route '/settings/system/widget-monitor'
*/
var widgetMonitorForm = (options) => ({
	action: widgetMonitor.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\WidgetMonitorController::widgetMonitor
* @see app/Http/Controllers/Admin/Platform/WidgetMonitorController.php:36
* @route '/settings/system/widget-monitor'
*/
widgetMonitorForm.get = (options) => ({
	action: widgetMonitor.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\WidgetMonitorController::widgetMonitor
* @see app/Http/Controllers/Admin/Platform/WidgetMonitorController.php:36
* @route '/settings/system/widget-monitor'
*/
widgetMonitorForm.head = (options) => ({
	action: widgetMonitor.url({ [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
widgetMonitor.form = widgetMonitorForm;
Object.assign(index$35, index$35), Object.assign(update$19, update$19), Object.assign(test$1, test$1), Object.assign(probe, probe), Object.assign(hotpathLatency, hotpathLatency), Object.assign(widgetMonitor, widgetMonitor$1), Object.assign(cronWorker, cronWorker);
//#endregion
//#region resources/js/components/admin-header-actions.tsx
var severityTone$1 = {
	critical: "bg-destructive/10 text-destructive",
	warning: "bg-amber-500/12 text-amber-600 dark:text-amber-400",
	info: "bg-emerald-500/12 text-emerald-600 dark:text-emerald-400"
};
function AdminHeaderActions({ header }) {
	const { t } = useT();
	if (!header) return null;
	const { site_health: siteHealth, notifications } = header;
	const HealthIcon = siteHealth.status === "healthy" ? ShieldCheck : siteHealth.status === "warning" ? ShieldAlert : ShieldX;
	const healthTone = siteHealth.status === "healthy" ? "border-emerald-500/25 bg-emerald-500/8 text-emerald-700 dark:text-emerald-300" : siteHealth.status === "warning" ? "border-amber-500/25 bg-amber-500/8 text-amber-700 dark:text-amber-300" : "border-destructive/25 bg-destructive/8 text-destructive";
	return /* @__PURE__ */ jsxs("div", {
		className: "flex items-center gap-2",
		children: [
			/* @__PURE__ */ jsxs(Link, {
				href: `${index$35.url()}#health`,
				prefetch: true,
				className: cn("inline-flex h-9 items-center gap-2 rounded-xl border px-2.5 text-xs font-medium shadow-xs transition hover:bg-accent hover:text-accent-foreground", healthTone),
				children: [
					/* @__PURE__ */ jsx(HealthIcon, { className: "size-4" }),
					/* @__PURE__ */ jsxs("span", {
						className: "font-semibold",
						children: [siteHealth.score, "%"]
					}),
					/* @__PURE__ */ jsx("span", {
						className: "hidden text-[11px] text-current/80 xl:inline",
						children: siteHealth.label
					})
				]
			}),
			/* @__PURE__ */ jsxs(DropdownMenu, { children: [/* @__PURE__ */ jsx(DropdownMenuTrigger, {
				asChild: true,
				children: /* @__PURE__ */ jsxs(Button, {
					type: "button",
					variant: "outline",
					size: "icon",
					className: "relative size-9 rounded-xl border-border/70 bg-background/80 shadow-xs",
					children: [
						/* @__PURE__ */ jsx(Bell, { className: "size-4" }),
						notifications.unread_count > 0 ? /* @__PURE__ */ jsx("span", {
							className: "absolute -end-1 -top-1 inline-flex min-w-4 items-center justify-center rounded-full bg-destructive px-1 text-[10px] font-semibold text-destructive-foreground",
							children: notifications.unread_count > 9 ? "9+" : notifications.unread_count
						}) : null,
						/* @__PURE__ */ jsx("span", {
							className: "sr-only",
							children: t("Open notifications")
						})
					]
				})
			}), /* @__PURE__ */ jsxs(DropdownMenuContent, {
				align: "end",
				className: "w-[340px] p-0",
				children: [
					/* @__PURE__ */ jsx(DropdownMenuLabel, {
						className: "px-3 py-2.5",
						children: /* @__PURE__ */ jsxs("div", {
							className: "flex items-center justify-between gap-3",
							children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
								className: "text-sm font-semibold text-foreground",
								children: t("Notifications")
							}), /* @__PURE__ */ jsx("p", {
								className: "text-xs font-normal text-muted-foreground",
								children: t(":ok of :total checks healthy", {
									ok: siteHealth.ok_checks,
									total: siteHealth.total_checks
								})
							})] }), /* @__PURE__ */ jsx("span", {
								className: "text-xs font-medium text-muted-foreground",
								children: notifications.unread_count === 0 ? t("All clear") : t(":count open", { count: notifications.unread_count })
							})]
						})
					}),
					/* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
					notifications.items.map((item, index) => /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx(DropdownMenuItem, {
						asChild: true,
						className: "cursor-pointer p-0",
						children: /* @__PURE__ */ jsxs(Link, {
							href: item.href,
							className: "flex w-full items-start gap-3 px-3 py-3",
							children: [/* @__PURE__ */ jsx("span", { className: cn("mt-0.5 inline-flex size-2.5 shrink-0 rounded-full", severityTone$1[item.severity]) }), /* @__PURE__ */ jsxs("span", {
								className: "min-w-0 space-y-1",
								children: [/* @__PURE__ */ jsx("span", {
									className: "block text-sm font-medium text-foreground",
									children: item.title
								}), /* @__PURE__ */ jsx("span", {
									className: "block text-xs leading-5 text-muted-foreground",
									children: item.body
								})]
							})]
						})
					}), index < notifications.items.length - 1 ? /* @__PURE__ */ jsx(DropdownMenuSeparator, {}) : null] }, item.key))
				]
			})] }),
			/* @__PURE__ */ jsx(Button, {
				type: "button",
				variant: "outline",
				size: "icon",
				asChild: true,
				className: "size-9 rounded-xl border-border/70 bg-background/80 shadow-xs",
				children: /* @__PURE__ */ jsxs(Link, {
					href: index$35(),
					prefetch: true,
					children: [/* @__PURE__ */ jsx(Settings2, { className: "size-4" }), /* @__PURE__ */ jsx("span", {
						className: "sr-only",
						children: t("Open platform settings")
					})]
				})
			})
		]
	});
}
//#endregion
//#region resources/js/components/ui/breadcrumb.tsx
function Breadcrumb({ ...props }) {
	return /* @__PURE__ */ jsx("nav", {
		"aria-label": "breadcrumb",
		"data-slot": "breadcrumb",
		...props
	});
}
function BreadcrumbList({ className, ...props }) {
	return /* @__PURE__ */ jsx("ol", {
		"data-slot": "breadcrumb-list",
		className: cn("text-muted-foreground flex flex-wrap items-center gap-1.5 text-sm break-words sm:gap-2.5", className),
		...props
	});
}
function BreadcrumbItem({ className, ...props }) {
	return /* @__PURE__ */ jsx("li", {
		"data-slot": "breadcrumb-item",
		className: cn("inline-flex items-center gap-1.5", className),
		...props
	});
}
function BreadcrumbLink({ asChild, className, ...props }) {
	return /* @__PURE__ */ jsx(asChild ? Slot : "a", {
		"data-slot": "breadcrumb-link",
		className: cn("hover:text-foreground transition-colors", className),
		...props
	});
}
function BreadcrumbPage({ className, ...props }) {
	return /* @__PURE__ */ jsx("span", {
		"data-slot": "breadcrumb-page",
		role: "link",
		"aria-disabled": "true",
		"aria-current": "page",
		className: cn("text-foreground font-normal", className),
		...props
	});
}
function BreadcrumbSeparator({ children, className, ...props }) {
	return /* @__PURE__ */ jsx("li", {
		"data-slot": "breadcrumb-separator",
		role: "presentation",
		"aria-hidden": "true",
		className: cn("[&>svg]:size-3.5", className),
		...props,
		children: children ?? /* @__PURE__ */ jsx(DirArrow, {
			direction: "forward",
			style: "chevron"
		})
	});
}
//#endregion
//#region resources/js/components/breadcrumbs.tsx
function Breadcrumbs({ breadcrumbs }) {
	if (breadcrumbs.length === 0) return null;
	return /* @__PURE__ */ jsx(Breadcrumb, { children: /* @__PURE__ */ jsx(BreadcrumbList, {
		className: "gap-1 text-[13px]",
		children: breadcrumbs.map((item, index) => {
			const isLast = index === breadcrumbs.length - 1;
			return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(BreadcrumbItem, { children: isLast ? /* @__PURE__ */ jsx(BreadcrumbPage, { children: item.title }) : /* @__PURE__ */ jsx(BreadcrumbLink, {
				asChild: true,
				children: /* @__PURE__ */ jsx(Link, {
					href: item.href,
					children: item.title
				})
			}) }), !isLast && /* @__PURE__ */ jsx(BreadcrumbSeparator, {})] }, index);
		})
	}) });
}
//#endregion
//#region resources/js/actions/App/Http/Controllers/Admin/Platform/SearchController.ts
/**
* @see \App\Http\Controllers\Admin\Platform\SearchController::__invoke
* @see app/Http/Controllers/Admin/Platform/SearchController.php:15
* @route '/admin/search'
*/
var SearchController$1 = (options) => ({
	url: SearchController$1.url(options),
	method: "get"
});
SearchController$1.definition = {
	methods: ["get", "head"],
	url: "/admin/search"
};
/**
* @see \App\Http\Controllers\Admin\Platform\SearchController::__invoke
* @see app/Http/Controllers/Admin/Platform/SearchController.php:15
* @route '/admin/search'
*/
SearchController$1.url = (options) => {
	return SearchController$1.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\Platform\SearchController::__invoke
* @see app/Http/Controllers/Admin/Platform/SearchController.php:15
* @route '/admin/search'
*/
SearchController$1.get = (options) => ({
	url: SearchController$1.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\SearchController::__invoke
* @see app/Http/Controllers/Admin/Platform/SearchController.php:15
* @route '/admin/search'
*/
SearchController$1.head = (options) => ({
	url: SearchController$1.url(options),
	method: "head"
});
/**
* @see \App\Http\Controllers\Admin\Platform\SearchController::__invoke
* @see app/Http/Controllers/Admin/Platform/SearchController.php:15
* @route '/admin/search'
*/
var SearchControllerForm$1 = (options) => ({
	action: SearchController$1.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\SearchController::__invoke
* @see app/Http/Controllers/Admin/Platform/SearchController.php:15
* @route '/admin/search'
*/
SearchControllerForm$1.get = (options) => ({
	action: SearchController$1.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\SearchController::__invoke
* @see app/Http/Controllers/Admin/Platform/SearchController.php:15
* @route '/admin/search'
*/
SearchControllerForm$1.head = (options) => ({
	action: SearchController$1.url({ [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
SearchController$1.form = SearchControllerForm$1;
//#endregion
//#region resources/js/actions/App/Http/Controllers/Admin/SearchController.ts
/**
* @see \App\Http\Controllers\Admin\SearchController::__invoke
* @see app/Http/Controllers/Admin/SearchController.php:22
* @route '/app/search'
*/
var SearchController = (options) => ({
	url: SearchController.url(options),
	method: "get"
});
SearchController.definition = {
	methods: ["get", "head"],
	url: "/app/search"
};
/**
* @see \App\Http\Controllers\Admin\SearchController::__invoke
* @see app/Http/Controllers/Admin/SearchController.php:22
* @route '/app/search'
*/
SearchController.url = (options) => {
	return SearchController.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\SearchController::__invoke
* @see app/Http/Controllers/Admin/SearchController.php:22
* @route '/app/search'
*/
SearchController.get = (options) => ({
	url: SearchController.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\SearchController::__invoke
* @see app/Http/Controllers/Admin/SearchController.php:22
* @route '/app/search'
*/
SearchController.head = (options) => ({
	url: SearchController.url(options),
	method: "head"
});
/**
* @see \App\Http\Controllers\Admin\SearchController::__invoke
* @see app/Http/Controllers/Admin/SearchController.php:22
* @route '/app/search'
*/
var SearchControllerForm = (options) => ({
	action: SearchController.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\SearchController::__invoke
* @see app/Http/Controllers/Admin/SearchController.php:22
* @route '/app/search'
*/
SearchControllerForm.get = (options) => ({
	action: SearchController.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\SearchController::__invoke
* @see app/Http/Controllers/Admin/SearchController.php:22
* @route '/app/search'
*/
SearchControllerForm.head = (options) => ({
	action: SearchController.url({ [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
SearchController.form = SearchControllerForm;
//#endregion
//#region resources/js/components/global-search.tsx
var WORKSPACE_EMPTY = {
	q: "",
	agents: [],
	conversations: [],
	leads: []
};
var PLATFORM_EMPTY = {
	q: "",
	workspaces: [],
	users: [],
	agents: [],
	leads: []
};
/**
* Workspace-wide command-palette-style search. Triggered by clicking
* the header search field, or with Cmd/Ctrl+K from anywhere. Hits
* a server-side search endpoint with a 200ms debounce so we don't fire
* on every keystroke.
*/
function GlobalSearch({ scope = "workspace" }) {
	const isPlatform = scope === "platform";
	const { t } = useT();
	const [open, setOpen] = useState(false);
	const [q, setQ] = useState("");
	const [results, setResults] = useState(WORKSPACE_EMPTY);
	const [platformResults, setPlatformResults] = useState(PLATFORM_EMPTY);
	const [loading, setLoading] = useState(false);
	const inputRef = useRef(null);
	useEffect(() => {
		const onKey = (e) => {
			if ((e.metaKey || e.ctrlKey) && e.key.toLowerCase() === "k") {
				e.preventDefault();
				setOpen((prev) => !prev);
				return;
			}
			if (e.key === "Escape" && open) setOpen(false);
		};
		window.addEventListener("keydown", onKey);
		return () => window.removeEventListener("keydown", onKey);
	}, [open]);
	useEffect(() => {
		if (!open) return;
		inputRef.current?.focus();
		const prev = document.body.style.overflow;
		document.body.style.overflow = "hidden";
		return () => {
			document.body.style.overflow = prev;
		};
	}, [open]);
	useEffect(() => {
		if (!open) return;
		const term = q.trim();
		const handle = window.setTimeout(async () => {
			if (term.length < 2) {
				if (isPlatform) setPlatformResults({
					...PLATFORM_EMPTY,
					q: term
				});
				else setResults({
					...WORKSPACE_EMPTY,
					q: term
				});
				return;
			}
			setLoading(true);
			try {
				const res = await fetch(isPlatform ? SearchController$1.url({ query: { q: term } }) : SearchController.url({ query: { q: term } }), {
					credentials: "same-origin",
					headers: {
						Accept: "application/json",
						"X-Requested-With": "XMLHttpRequest"
					}
				});
				if (res.ok) {
					const json = await res.json();
					if (isPlatform) setPlatformResults(json.data ?? PLATFORM_EMPTY);
					else setResults(json.data ?? WORKSPACE_EMPTY);
				}
			} finally {
				setLoading(false);
			}
		}, 200);
		return () => window.clearTimeout(handle);
	}, [
		isPlatform,
		open,
		q
	]);
	const total = isPlatform ? platformResults.workspaces.length + platformResults.users.length + platformResults.agents.length + platformResults.leads.length : results.agents.length + results.conversations.length + results.leads.length;
	const triggerLabel = isPlatform ? t("Search platform") : t("Search workspace");
	const dialogPlaceholder = isPlatform ? t("Search workspaces, users, agents, leads…") : t("Search agents, conversations, leads…");
	return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("button", {
		type: "button",
		onClick: () => setOpen(true),
		className: "inline-flex h-9 w-full items-center gap-2 rounded-xl border border-border/70 bg-background/80 px-3 text-sm text-muted-foreground shadow-xs transition hover:bg-accent hover:text-foreground sm:w-[250px] lg:w-[300px]",
		title: isPlatform ? t("Search workspaces, users, agents, and leads (⌘K)") : t("Search across agents, conversations, and leads (⌘K)"),
		children: [
			/* @__PURE__ */ jsx(Search, { className: "size-4 shrink-0" }),
			/* @__PURE__ */ jsx("span", {
				className: "min-w-0 flex-1 truncate text-start",
				children: triggerLabel
			}),
			/* @__PURE__ */ jsx("kbd", {
				className: "hidden rounded border bg-muted px-1.5 py-0.5 font-mono text-[10px] md:inline-flex",
				children: "⌘K"
			})
		]
	}), open && /* @__PURE__ */ jsx("div", {
		className: "fixed inset-0 z-50 flex items-start justify-center bg-black/40 px-4 pt-24 backdrop-blur-sm",
		onClick: () => setOpen(false),
		children: /* @__PURE__ */ jsxs("div", {
			className: "w-full max-w-2xl overflow-hidden rounded-lg border bg-card shadow-2xl",
			onClick: (e) => e.stopPropagation(),
			children: [/* @__PURE__ */ jsxs("div", {
				className: "flex items-center gap-2 border-b px-4 py-2.5",
				children: [
					/* @__PURE__ */ jsx(Search, { className: "size-4 text-muted-foreground" }),
					/* @__PURE__ */ jsx("input", {
						ref: inputRef,
						type: "search",
						placeholder: dialogPlaceholder,
						value: q,
						onChange: (e) => setQ(e.target.value),
						className: "flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground"
					}),
					loading && /* @__PURE__ */ jsx("span", {
						className: "text-[10px] text-muted-foreground",
						children: t("searching…")
					}),
					/* @__PURE__ */ jsx("button", {
						type: "button",
						onClick: () => setOpen(false),
						className: "rounded text-xs text-muted-foreground hover:text-foreground",
						children: t("Esc")
					})
				]
			}), /* @__PURE__ */ jsx("div", {
				className: "max-h-[60vh] overflow-y-auto",
				children: q.trim().length < 2 ? /* @__PURE__ */ jsx("p", {
					className: "px-4 py-8 text-center text-xs text-muted-foreground",
					children: t("Type at least 2 characters to search.")
				}) : total === 0 ? /* @__PURE__ */ jsx("p", {
					className: "px-4 py-8 text-center text-xs text-muted-foreground",
					children: loading ? t("Searching…") : t("No matches for \":query\".", { query: q })
				}) : isPlatform ? /* @__PURE__ */ jsxs(Fragment$1, { children: [
					platformResults.workspaces.length > 0 && /* @__PURE__ */ jsx(Section$6, {
						label: t("Workspaces"),
						icon: /* @__PURE__ */ jsx(Building2, { className: "size-3.5 text-sky-600" }),
						children: platformResults.workspaces.map((workspace) => /* @__PURE__ */ jsx(SearchHit, {
							href: workspace.href,
							onSelect: () => setOpen(false),
							title: workspace.name,
							sub: workspace.owner ?? t("workspace")
						}, workspace.id))
					}),
					platformResults.users.length > 0 && /* @__PURE__ */ jsx(Section$6, {
						label: t("Users"),
						icon: /* @__PURE__ */ jsx(Users, { className: "size-3.5 text-violet-600" }),
						children: platformResults.users.map((user) => /* @__PURE__ */ jsx(SearchHit, {
							href: user.href,
							onSelect: () => setOpen(false),
							title: user.name ?? user.email,
							sub: `${user.email} · ${user.role}`
						}, user.id))
					}),
					platformResults.agents.length > 0 && /* @__PURE__ */ jsx(Section$6, {
						label: t("Agents"),
						icon: /* @__PURE__ */ jsx(Bot, { className: "size-3.5 text-amber-600" }),
						children: platformResults.agents.map((agent) => /* @__PURE__ */ jsx(SearchHit, {
							href: agent.href,
							onSelect: () => setOpen(false),
							title: agent.name,
							sub: `${agent.workspace_name ?? t("workspace")} · ${agent.is_published ? t("live") : t("draft")}`
						}, agent.id))
					}),
					platformResults.leads.length > 0 && /* @__PURE__ */ jsx(Section$6, {
						label: t("Leads"),
						icon: /* @__PURE__ */ jsx(Inbox, { className: "size-3.5 text-emerald-600" }),
						children: platformResults.leads.map((lead) => /* @__PURE__ */ jsx(SearchHit, {
							href: lead.href,
							onSelect: () => setOpen(false),
							title: lead.name ?? lead.email,
							sub: `${lead.workspace_name ?? lead.email} · ${lead.status}`
						}, lead.id))
					})
				] }) : /* @__PURE__ */ jsxs(Fragment$1, { children: [
					results.agents.length > 0 && /* @__PURE__ */ jsx(Section$6, {
						label: t("Agents"),
						icon: /* @__PURE__ */ jsx(Bot, { className: "size-3.5 text-amber-600" }),
						children: results.agents.map((a) => /* @__PURE__ */ jsx(SearchHit, {
							href: a.href,
							onSelect: () => setOpen(false),
							title: a.name,
							sub: a.is_published ? t("live") : t("draft")
						}, a.id))
					}),
					results.conversations.length > 0 && /* @__PURE__ */ jsx(Section$6, {
						label: t("Conversations"),
						icon: /* @__PURE__ */ jsx(MessagesSquare, { className: "size-3.5 text-rose-600" }),
						children: results.conversations.map((c) => /* @__PURE__ */ jsx(SearchHit, {
							href: c.href,
							onSelect: () => setOpen(false),
							title: c.page_url ?? t("(no page url)"),
							sub: c.agent_name ? t("via :name", { name: c.agent_name }) : t("thread")
						}, c.id))
					}),
					results.leads.length > 0 && /* @__PURE__ */ jsx(Section$6, {
						label: t("Leads"),
						icon: /* @__PURE__ */ jsx(Inbox, { className: "size-3.5 text-emerald-600" }),
						children: results.leads.map((l) => /* @__PURE__ */ jsx(SearchHit, {
							href: l.href,
							onSelect: () => setOpen(false),
							title: l.name ?? l.email,
							sub: `${l.email} · ${l.status}`
						}, l.id))
					})
				] })
			})]
		})
	})] });
}
function Section$6({ label, icon, children }) {
	return /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsxs("div", {
		className: "flex items-center gap-2 border-t border-b bg-muted/40 px-4 py-1.5 text-[10px] font-semibold tracking-wider text-muted-foreground uppercase first:border-t-0",
		children: [icon, label]
	}), /* @__PURE__ */ jsx("div", { children })] });
}
function SearchHit({ href, title, sub, onSelect }) {
	return /* @__PURE__ */ jsxs(Link, {
		href,
		onClick: onSelect,
		className: "flex items-baseline justify-between gap-3 px-4 py-2 text-sm transition hover:bg-muted",
		children: [/* @__PURE__ */ jsx("span", {
			className: "truncate font-medium",
			children: title
		}), sub ? /* @__PURE__ */ jsx("span", {
			className: "shrink-0 text-xs text-muted-foreground",
			children: sub
		}) : null]
	});
}
//#endregion
//#region resources/js/hooks/use-lead-toasts.ts
var POLL_INTERVAL_MS = 3e4;
var STORAGE_KEY = "pitchbar:leads:since";
var HANDOFF_STORAGE_KEY = "pitchbar:handoff:since";
function readSinceFor(key) {
	if (typeof window === "undefined") return "";
	try {
		return window.sessionStorage.getItem(key) ?? "";
	} catch {
		return "";
	}
}
function writeSinceFor(key, value) {
	if (typeof window === "undefined") return;
	try {
		window.sessionStorage.setItem(key, value);
	} catch {}
}
function fireBrowserNotification(lead) {
	if (typeof window === "undefined" || !("Notification" in window)) return;
	if (Notification.permission !== "granted") return;
	try {
		const headline = lead.email ?? lead.phone ?? "New lead";
		const body = `${lead.agent_name} captured ${headline}`;
		const note = new Notification("New lead captured", {
			body,
			tag: `lead-${lead.id}`
		});
		note.onclick = () => {
			window.focus();
			router.visit(lead.inbox_url);
		};
	} catch {}
}
function fireHandoffNotification(item) {
	if (typeof window === "undefined" || !("Notification" in window)) return;
	if (Notification.permission !== "granted") return;
	try {
		const body = item.preview ? `"${item.preview}"` : `Visitor on ${item.agent_name} wants a human.`;
		const note = new Notification("🔔 Visitor wants a human", {
			body,
			tag: `handoff-${item.id}`,
			requireInteraction: true
		});
		note.onclick = () => {
			window.focus();
			router.visit(item.conversation_url);
		};
	} catch {}
}
/**
* Polls /app/leads/feed every 30 seconds; fires a sonner toast +
* (when the user has granted Notification permission) a native
* browser notification on each new lead since the previous poll.
*
* The "since" cursor lives in sessionStorage so closing and reopening
* the tab won't re-toast already-seen leads. First mount initialises
* the cursor to "now" — historical leads never trigger toasts.
*
* Polling pauses on hidden tabs so a backgrounded dashboard doesn't
* burn HTTP for nothing.
*/
function useLeadToasts(enabled) {
	const isMounted = useRef(false);
	useEffect(() => {
		if (!enabled) return;
		if (typeof window === "undefined") return;
		isMounted.current = true;
		if (readSinceFor(STORAGE_KEY) === "") writeSinceFor(STORAGE_KEY, (/* @__PURE__ */ new Date()).toISOString());
		if (readSinceFor(HANDOFF_STORAGE_KEY) === "") writeSinceFor(HANDOFF_STORAGE_KEY, (/* @__PURE__ */ new Date()).toISOString());
		let timer = null;
		let aborter = null;
		const poll = async () => {
			if (!isMounted.current) return;
			if (document.visibilityState === "hidden") return;
			const since = readSinceFor(STORAGE_KEY);
			const handoffSince = readSinceFor(HANDOFF_STORAGE_KEY);
			try {
				aborter = new AbortController();
				const params = new URLSearchParams();
				if (since) params.set("since", since);
				if (handoffSince) params.set("handoff_since", handoffSince);
				const url = "/app/leads/feed" + (params.toString() ? `?${params.toString()}` : "");
				const res = await fetch(url, {
					headers: { Accept: "application/json" },
					credentials: "same-origin",
					signal: aborter.signal
				});
				if (!res.ok) return;
				const json = await res.json();
				const leads = json.data?.leads ?? [];
				const handoffRequests = json.data?.handoff_requests ?? [];
				if (leads.length > 0) {
					[...leads].reverse().forEach((lead) => {
						const headline = lead.email ?? lead.name ?? "New lead";
						toast.success(`New lead — ${headline}`, {
							description: `Captured by ${lead.agent_name}`,
							action: {
								label: "Open",
								onClick: () => router.visit(lead.inbox_url)
							}
						});
						fireBrowserNotification(lead);
					});
					const newest = leads[0];
					if (newest?.created_at) writeSinceFor(STORAGE_KEY, newest.created_at);
				}
				if (handoffRequests.length > 0) {
					[...handoffRequests].reverse().forEach((item) => {
						toast.warning("🔔 Visitor wants a human", {
							description: item.preview ?? `On ${item.agent_name}`,
							duration: 12e3,
							action: {
								label: "Claim",
								onClick: () => router.visit(item.conversation_url)
							}
						});
						fireHandoffNotification(item);
					});
					const newestHandoff = handoffRequests[0];
					if (newestHandoff?.requested_at) writeSinceFor(HANDOFF_STORAGE_KEY, newestHandoff.requested_at);
				}
			} catch {}
		};
		const start = () => {
			poll();
			timer = window.setInterval(poll, POLL_INTERVAL_MS);
		};
		const stop = () => {
			if (timer !== null) {
				window.clearInterval(timer);
				timer = null;
			}
			aborter?.abort();
		};
		const onVisibilityChange = () => {
			if (document.visibilityState === "visible") {
				if (timer === null) start();
			} else stop();
		};
		if (document.visibilityState === "visible") start();
		document.addEventListener("visibilitychange", onVisibilityChange);
		return () => {
			isMounted.current = false;
			stop();
			document.removeEventListener("visibilitychange", onVisibilityChange);
		};
	}, [enabled]);
}
/**
* One-off helper for the "Enable browser notifications" button. Returns
* the resulting permission so callers can update their UI accordingly.
*/
async function requestLeadNotificationsPermission() {
	if (typeof window === "undefined" || !("Notification" in window)) return "denied";
	if (Notification.permission === "granted" || Notification.permission === "denied") return Notification.permission;
	try {
		return await Notification.requestPermission();
	} catch {
		return "denied";
	}
}
//#endregion
//#region resources/js/components/lead-notifications-toggle.tsx
function readPermission() {
	if (typeof window === "undefined" || !("Notification" in window)) return "unsupported";
	return Notification.permission;
}
/**
* Small header pill that lets the workspace member opt-in to browser
* notifications for new leads. The Notification API requires a user
* gesture to prompt, so we can't auto-request on page-load — this
* button is the explicit gesture.
*
* Three states: unsupported (hidden), default (Bell w/ off), granted
* (BellRing), denied (BellOff). Denied state shows a tooltip telling
* the admin to flip it from the browser settings — we cannot
* re-prompt once they've blocked.
*/
function LeadNotificationsToggle() {
	const { t } = useT();
	const [permission, setPermission] = useState(() => readPermission());
	useEffect(() => {
		const onFocus = () => setPermission(readPermission());
		window.addEventListener("focus", onFocus);
		return () => window.removeEventListener("focus", onFocus);
	}, []);
	if (permission === "unsupported") return null;
	const handleClick = async () => {
		if (permission === "granted") {
			toast.message(t("Browser alerts already enabled"));
			return;
		}
		if (permission === "denied") {
			toast.error(t("Browser alerts are blocked. Enable them from your browser settings to get pinged on new leads."));
			return;
		}
		const next = await requestLeadNotificationsPermission();
		setPermission(next);
		if (next === "granted") toast.success(t("Browser alerts on — new leads will ping you."));
	};
	const Icon = permission === "granted" ? BellRing : permission === "denied" ? BellOff : Bell;
	const tip = permission === "granted" ? t("Lead alerts are on") : permission === "denied" ? t("Lead alerts blocked — enable in browser settings") : t("Enable browser alerts for new leads");
	return /* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, {
		asChild: true,
		children: /* @__PURE__ */ jsxs(Button, {
			type: "button",
			variant: "outline",
			size: "icon",
			onClick: handleClick,
			"aria-label": tip,
			className: "size-9 rounded-xl border-border/70 bg-background/80 shadow-xs",
			children: [/* @__PURE__ */ jsx(Icon, { className: `size-4 ${permission === "granted" ? "text-emerald-600" : permission === "denied" ? "text-muted-foreground/60" : ""}` }), /* @__PURE__ */ jsx("span", {
				className: "sr-only",
				children: tip
			})]
		})
	}), /* @__PURE__ */ jsx(TooltipContent, {
		side: "bottom",
		children: tip
	})] });
}
//#endregion
//#region resources/js/components/locale-switcher.tsx
var TRIGGER_CLASS = {
	admin: "size-9 rounded-xl border-border/70 bg-background/80 shadow-xs",
	marketing: "size-9 rounded-md border-transparent bg-transparent shadow-none text-[#41483f] transition hover:bg-[#173f2c]/8 hover:text-[#173f2c]"
};
function LocaleSwitcher({ variant = "admin" } = {}) {
	const { t } = useT();
	const { locale, supported, catalog, multilingual } = useI18n();
	const [open, setOpen] = useState(false);
	const switchTo = (next) => {
		setOpen(false);
		if (next === locale) return;
		router.patch("/locale/switch", { locale: next }, {
			preserveScroll: true,
			preserveState: false
		});
	};
	const flag = localeFlag(catalog, locale);
	if (!multilingual) return null;
	return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, {
		asChild: true,
		children: /* @__PURE__ */ jsxs(Button, {
			type: "button",
			variant: "outline",
			size: "icon",
			onClick: () => setOpen(true),
			"aria-label": t("Language"),
			className: TRIGGER_CLASS[variant],
			children: [/* @__PURE__ */ jsx("span", {
				className: "text-base leading-none",
				"aria-hidden": true,
				children: flag
			}), /* @__PURE__ */ jsx("span", {
				className: "sr-only",
				children: t("Language")
			})]
		})
	}), /* @__PURE__ */ jsx(TooltipContent, {
		side: "bottom",
		children: t("Language")
	})] }), /* @__PURE__ */ jsx(LocalePickerDialog, {
		open,
		onOpenChange: setOpen,
		locale,
		supported,
		catalog,
		onPick: switchTo
	})] });
}
/**
* Reusable picker dialog. Marketing-shell, admin sidebar, settings
* page all open the same component — keeps the UX identical and
* means a fix to the search ranking lands everywhere.
*/
function LocalePickerDialog({ open, onOpenChange, locale, supported, catalog, onPick }) {
	const { t } = useT();
	const [query, setQuery] = useState("");
	const inputRef = useRef(null);
	useEffect(() => {
		if (!open) return;
		const id = window.setTimeout(() => {
			setQuery("");
			inputRef.current?.focus();
		}, 30);
		return () => window.clearTimeout(id);
	}, [open]);
	const rows = useMemo(() => {
		const items = supported.map((code) => {
			const entry = catalog[code];
			return {
				code,
				native: entry?.native ?? code.toUpperCase(),
				english: entry?.english ?? code,
				flag: entry?.flag ?? "🌐",
				rtl: entry?.rtl ?? false
			};
		});
		const q = query.trim().toLowerCase();
		if (q === "") return items;
		return items.filter((r) => r.code.toLowerCase().includes(q) || r.native.toLowerCase().includes(q) || r.english.toLowerCase().includes(q));
	}, [
		supported,
		catalog,
		query
	]);
	return /* @__PURE__ */ jsx(Dialog, {
		open,
		onOpenChange,
		children: /* @__PURE__ */ jsxs(DialogContent, {
			className: "sm:max-w-md",
			children: [
				/* @__PURE__ */ jsx(DialogHeader, { children: /* @__PURE__ */ jsxs(DialogTitle, {
					className: "flex items-center gap-2 text-base",
					children: [/* @__PURE__ */ jsx(Globe, { className: "size-4" }), t("Choose your language")]
				}) }),
				/* @__PURE__ */ jsxs("div", {
					className: "relative",
					children: [
						/* @__PURE__ */ jsx(Search, { className: "absolute start-3 top-1/2 size-4 -translate-y-1/2 text-muted-foreground" }),
						/* @__PURE__ */ jsx("input", {
							ref: inputRef,
							type: "search",
							value: query,
							onChange: (e) => setQuery(e.target.value),
							placeholder: t("Search languages…"),
							className: "w-full rounded-md border border-border bg-background py-2 ps-9 pe-9 text-sm outline-none placeholder:text-muted-foreground focus:border-ring focus:ring-1 focus:ring-ring",
							autoComplete: "off",
							spellCheck: false
						}),
						query !== "" && /* @__PURE__ */ jsx("button", {
							type: "button",
							onClick: () => setQuery(""),
							className: "absolute end-2 top-1/2 inline-flex size-6 -translate-y-1/2 items-center justify-center rounded-full text-muted-foreground transition hover:bg-muted hover:text-foreground",
							"aria-label": t("Clear search"),
							children: /* @__PURE__ */ jsx(X, { className: "size-3" })
						})
					]
				}),
				/* @__PURE__ */ jsx("ul", {
					className: "-mx-1 max-h-[60vh] overflow-y-auto",
					role: "listbox",
					children: rows.length === 0 ? /* @__PURE__ */ jsx("li", {
						className: "px-3 py-6 text-center text-sm text-muted-foreground",
						children: t("No matching languages.")
					}) : rows.map((row) => {
						const active = row.code === locale;
						return /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsxs("button", {
							type: "button",
							onClick: () => onPick(row.code),
							role: "option",
							"aria-selected": active,
							dir: row.rtl ? "rtl" : void 0,
							className: cn("flex w-full items-center gap-3 rounded-md px-3 py-2 text-sm transition hover:bg-muted/60", active && "bg-muted/40 font-semibold"),
							children: [
								/* @__PURE__ */ jsx("span", {
									className: "text-base leading-none",
									"aria-hidden": true,
									children: row.flag
								}),
								/* @__PURE__ */ jsx("span", {
									className: "flex-1 truncate text-start",
									children: row.native
								}),
								/* @__PURE__ */ jsx("span", {
									className: "text-xs text-muted-foreground",
									children: row.english
								}),
								active ? /* @__PURE__ */ jsx(Check, { className: "size-4 text-emerald-600" }) : null
							]
						}) }, row.code);
					})
				})
			]
		})
	});
}
//#endregion
//#region resources/js/hooks/use-appearance.tsx
var listeners = /* @__PURE__ */ new Set();
var currentAppearance = "system";
var prefersDark = () => {
	if (typeof window === "undefined") return false;
	return window.matchMedia("(prefers-color-scheme: dark)").matches;
};
var setCookie = (name, value, days = 365) => {
	if (typeof document === "undefined") return;
	const maxAge = days * 24 * 60 * 60;
	document.cookie = `${name}=${value};path=/;max-age=${maxAge};SameSite=Lax`;
};
var isDarkMode = (appearance) => {
	return appearance === "dark" || appearance === "system" && prefersDark();
};
var applyTheme = (appearance) => {
	if (typeof document === "undefined") return;
	const isDark = isDarkMode(appearance);
	document.documentElement.classList.toggle("dark", isDark);
	document.documentElement.style.colorScheme = isDark ? "dark" : "light";
};
var subscribe = (callback) => {
	listeners.add(callback);
	return () => listeners.delete(callback);
};
var notify = () => listeners.forEach((listener) => listener());
function useAppearance() {
	const appearance = useSyncExternalStore(subscribe, () => currentAppearance, () => "system");
	const resolvedAppearance = isDarkMode(appearance) ? "dark" : "light";
	const updateAppearance = (mode) => {
		currentAppearance = mode;
		localStorage.setItem("appearance", mode);
		setCookie("appearance", mode);
		applyTheme(mode);
		notify();
	};
	return {
		appearance,
		resolvedAppearance,
		updateAppearance
	};
}
//#endregion
//#region resources/js/components/theme-toggle.tsx
/**
* Header icon button + dropdown for switching the theme. Shows a Sun
* when the resolved appearance is light and a Moon when dark; the
* dropdown lets the user pick System / Light / Dark explicitly so the
* "follows OS" preference stays accessible.
*
* Uses the existing `useAppearance` hook so the choice persists in
* cookie + localStorage and applies to every Inertia page.
*/
function ThemeToggle({ className }) {
	const { t } = useT();
	const { appearance, resolvedAppearance, updateAppearance } = useAppearance();
	const ResolvedIcon = resolvedAppearance === "dark" ? Moon : Sun;
	const options = [
		{
			value: "system",
			label: t("System"),
			icon: Monitor
		},
		{
			value: "light",
			label: t("Light"),
			icon: Sun
		},
		{
			value: "dark",
			label: t("Dark"),
			icon: Moon
		}
	];
	const label = t("Theme: :name", { name: appearance === "system" ? t("System") : appearance === "dark" ? t("Dark") : t("Light") });
	return /* @__PURE__ */ jsxs(DropdownMenu, { children: [/* @__PURE__ */ jsx(DropdownMenuTrigger, {
		asChild: true,
		children: /* @__PURE__ */ jsxs(Button, {
			type: "button",
			variant: "outline",
			size: "icon",
			"aria-label": label,
			className: cn("size-9 rounded-xl border-border/70 bg-background/80 shadow-xs", className),
			children: [/* @__PURE__ */ jsx(ResolvedIcon, { className: "size-4" }), /* @__PURE__ */ jsx("span", {
				className: "sr-only",
				children: label
			})]
		})
	}), /* @__PURE__ */ jsxs(DropdownMenuContent, {
		align: "end",
		className: "w-40",
		children: [
			/* @__PURE__ */ jsx(DropdownMenuLabel, {
				className: "text-xs font-medium text-muted-foreground",
				children: t("Appearance")
			}),
			/* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
			options.map((opt) => {
				const Icon = opt.icon;
				const active = appearance === opt.value;
				return /* @__PURE__ */ jsxs(DropdownMenuItem, {
					onSelect: () => updateAppearance(opt.value),
					className: cn("flex items-center gap-2 text-sm", active && "font-medium"),
					children: [
						/* @__PURE__ */ jsx(Icon, { className: "size-4" }),
						/* @__PURE__ */ jsx("span", {
							className: "flex-1",
							children: opt.label
						}),
						active && /* @__PURE__ */ jsx("span", {
							"aria-hidden": "true",
							className: "size-1.5 rounded-full bg-emerald-500"
						})
					]
				}, opt.value);
			})
		]
	})] });
}
//#endregion
//#region resources/js/components/app-sidebar-header.tsx
function AppSidebarHeader({ breadcrumbs = [] }) {
	const { t } = useT();
	const { auth, adminHeader } = usePage().props;
	const isAdmin = auth?.user?.is_super_admin === true;
	return /* @__PURE__ */ jsxs("header", {
		className: "flex h-[69px] max-h-[69px] min-h-[69px] shrink-0 items-center gap-3 overflow-hidden border-b bg-card px-3 sm:px-4",
		children: [
			/* @__PURE__ */ jsx(SidebarTrigger, { className: "-ms-1 shrink-0 text-muted-foreground hover:text-foreground" }),
			/* @__PURE__ */ jsx("div", {
				className: "min-w-0 flex-1",
				children: /* @__PURE__ */ jsx(Breadcrumbs, { breadcrumbs })
			}),
			/* @__PURE__ */ jsxs("div", {
				className: "flex shrink-0 items-center gap-1.5 sm:gap-2",
				children: [
					/* @__PURE__ */ jsx("div", {
						className: "hidden sm:block",
						children: /* @__PURE__ */ jsx(GlobalSearch, { scope: isAdmin ? "platform" : "workspace" })
					}),
					/* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, {
						asChild: true,
						children: /* @__PURE__ */ jsx(Button, {
							type: "button",
							variant: "outline",
							size: "icon",
							asChild: true,
							className: "size-9 rounded-xl border-border/70 bg-background/80 shadow-xs",
							children: /* @__PURE__ */ jsxs(Link, {
								href: "/",
								prefetch: true,
								children: [/* @__PURE__ */ jsx(House, { className: "size-4" }), /* @__PURE__ */ jsx("span", {
									className: "sr-only",
									children: t("Open marketing site")
								})]
							})
						})
					}), /* @__PURE__ */ jsx(TooltipContent, {
						side: "bottom",
						children: t("Marketing site")
					})] }),
					/* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, {
						asChild: true,
						children: /* @__PURE__ */ jsx("span", {
							className: "inline-flex",
							children: /* @__PURE__ */ jsx(ThemeToggle, {})
						})
					}), /* @__PURE__ */ jsx(TooltipContent, {
						side: "bottom",
						children: t("Toggle theme")
					})] }),
					/* @__PURE__ */ jsx(LocaleSwitcher, {}),
					isAdmin ? null : /* @__PURE__ */ jsx(LeadNotificationsToggle, {}),
					isAdmin ? /* @__PURE__ */ jsx(AdminHeaderActions, { header: adminHeader }) : null
				]
			})
		]
	});
}
//#endregion
//#region resources/js/components/impersonation-banner.tsx
function ImpersonationBanner() {
	const { t } = useT();
	const cardRef = useRef(null);
	const { impersonating, auth } = usePage().props;
	const [dragOffset, setDragOffset] = useState({
		x: 0,
		y: 0
	});
	const [isDragging, setIsDragging] = useState(false);
	const dragState = useRef(null);
	if (!impersonating || !auth.user) return null;
	const clampOffset = (nextX, nextY) => {
		const card = cardRef.current;
		if (!card) return {
			x: nextX,
			y: nextY
		};
		const rect = card.getBoundingClientRect();
		const maxLeft = -(rect.left - 8);
		const maxRight = window.innerWidth - rect.right - 8;
		const maxUp = -(rect.top - 8);
		const maxDown = window.innerHeight - rect.bottom - 8;
		return {
			x: Math.min(Math.max(nextX, maxLeft), maxRight),
			y: Math.min(Math.max(nextY, maxUp), maxDown)
		};
	};
	const handlePointerDown = (event) => {
		if (event.target instanceof Element && event.target.closest("button")) return;
		dragState.current = {
			pointerId: event.pointerId,
			startX: event.clientX,
			startY: event.clientY,
			originX: dragOffset.x,
			originY: dragOffset.y
		};
		setIsDragging(true);
		event.currentTarget.setPointerCapture(event.pointerId);
	};
	const handlePointerMove = (event) => {
		const activeDrag = dragState.current;
		if (!activeDrag || activeDrag.pointerId !== event.pointerId) return;
		setDragOffset(clampOffset(activeDrag.originX + (event.clientX - activeDrag.startX), activeDrag.originY + (event.clientY - activeDrag.startY)));
	};
	const handlePointerEnd = (event) => {
		const activeDrag = dragState.current;
		if (!activeDrag || activeDrag.pointerId !== event.pointerId) return;
		dragState.current = null;
		setIsDragging(false);
		if (event.currentTarget.hasPointerCapture(event.pointerId)) event.currentTarget.releasePointerCapture(event.pointerId);
	};
	return /* @__PURE__ */ jsx("div", {
		className: "pointer-events-none fixed inset-x-3 bottom-3 z-[70] flex justify-center sm:inset-x-auto sm:end-4 sm:bottom-4",
		children: /* @__PURE__ */ jsx("div", {
			ref: cardRef,
			className: "pointer-events-auto w-full max-w-sm rounded-lg border bg-background p-3 shadow-lg",
			onPointerDown: handlePointerDown,
			onPointerMove: handlePointerMove,
			onPointerUp: handlePointerEnd,
			onPointerCancel: handlePointerEnd,
			style: {
				transform: `translate(${dragOffset.x}px, ${dragOffset.y}px)`,
				cursor: isDragging ? "grabbing" : "grab",
				touchAction: "none"
			},
			children: /* @__PURE__ */ jsxs("div", {
				className: "flex items-center gap-3",
				children: [
					/* @__PURE__ */ jsx("div", {
						className: "flex size-8 shrink-0 items-center justify-center rounded-md border bg-muted text-muted-foreground",
						children: /* @__PURE__ */ jsx(Eye, { className: "size-4" })
					}),
					/* @__PURE__ */ jsxs("div", {
						className: "min-w-0 flex-1",
						children: [/* @__PURE__ */ jsx("p", {
							className: "truncate text-sm font-medium text-foreground",
							children: t("Impersonating :name", { name: auth.user.name })
						}), /* @__PURE__ */ jsx("p", {
							className: "truncate text-xs text-muted-foreground",
							children: t("Admin: :email", { email: impersonating.email })
						})]
					}),
					/* @__PURE__ */ jsxs(Button, {
						type: "button",
						size: "sm",
						variant: "outline",
						className: "shrink-0",
						onClick: () => router.post(stop.url()),
						title: t("Switch back to admin"),
						children: [/* @__PURE__ */ jsx(ShieldAlert, { className: "size-4" }), t("Switch back")]
					})
				]
			})
		})
	});
}
//#endregion
//#region resources/js/layouts/admin-layout.tsx
function AdminLayout({ children, breadcrumbs = [] }) {
	return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(ImpersonationBanner, {}), /* @__PURE__ */ jsxs(AppShell, {
		variant: "sidebar",
		children: [/* @__PURE__ */ jsx(AdminSidebar, {}), /* @__PURE__ */ jsxs(AppContent, {
			variant: "sidebar",
			className: "overflow-x-hidden",
			children: [/* @__PURE__ */ jsx(AppSidebarHeader, { breadcrumbs }), children]
		})]
	})] });
}
//#endregion
//#region resources/js/lib/relative-time.ts
function relativeTime$8(iso, fallback = "No activity") {
	if (!iso) return fallback;
	const ms = Date.now() - new Date(iso).getTime();
	const min = Math.max(1, Math.round(ms / 6e4));
	if (min < 60) return `${min}m ago`;
	const hr = Math.round(min / 60);
	if (hr < 24) return `${hr}h ago`;
	const day = Math.round(hr / 24);
	if (day < 7) return `${day}d ago`;
	return new Date(iso).toLocaleDateString();
}
//#endregion
//#region resources/js/routes/admin/workspaces/index.ts
/**
* @see \App\Http\Controllers\Admin\Platform\WorkspaceController::index
* @see app/Http/Controllers/Admin/Platform/WorkspaceController.php:68
* @route '/admin/workspaces'
*/
var index$34 = (options) => ({
	url: index$34.url(options),
	method: "get"
});
index$34.definition = {
	methods: ["get", "head"],
	url: "/admin/workspaces"
};
/**
* @see \App\Http\Controllers\Admin\Platform\WorkspaceController::index
* @see app/Http/Controllers/Admin/Platform/WorkspaceController.php:68
* @route '/admin/workspaces'
*/
index$34.url = (options) => {
	return index$34.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\Platform\WorkspaceController::index
* @see app/Http/Controllers/Admin/Platform/WorkspaceController.php:68
* @route '/admin/workspaces'
*/
index$34.get = (options) => ({
	url: index$34.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\WorkspaceController::index
* @see app/Http/Controllers/Admin/Platform/WorkspaceController.php:68
* @route '/admin/workspaces'
*/
index$34.head = (options) => ({
	url: index$34.url(options),
	method: "head"
});
/**
* @see \App\Http\Controllers\Admin\Platform\WorkspaceController::index
* @see app/Http/Controllers/Admin/Platform/WorkspaceController.php:68
* @route '/admin/workspaces'
*/
var indexForm$34 = (options) => ({
	action: index$34.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\WorkspaceController::index
* @see app/Http/Controllers/Admin/Platform/WorkspaceController.php:68
* @route '/admin/workspaces'
*/
indexForm$34.get = (options) => ({
	action: index$34.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\WorkspaceController::index
* @see app/Http/Controllers/Admin/Platform/WorkspaceController.php:68
* @route '/admin/workspaces'
*/
indexForm$34.head = (options) => ({
	action: index$34.url({ [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
index$34.form = indexForm$34;
/**
* @see \App\Http\Controllers\Admin\Platform\WorkspaceController::show
* @see app/Http/Controllers/Admin/Platform/WorkspaceController.php:124
* @route '/admin/workspaces/{workspace}'
*/
var show$8 = (args, options) => ({
	url: show$8.url(args, options),
	method: "get"
});
show$8.definition = {
	methods: ["get", "head"],
	url: "/admin/workspaces/{workspace}"
};
/**
* @see \App\Http\Controllers\Admin\Platform\WorkspaceController::show
* @see app/Http/Controllers/Admin/Platform/WorkspaceController.php:124
* @route '/admin/workspaces/{workspace}'
*/
show$8.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { workspace: args };
	if (typeof args === "object" && !Array.isArray(args) && "id" in args) args = { workspace: args.id };
	if (Array.isArray(args)) args = { workspace: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { workspace: typeof args.workspace === "object" ? args.workspace.id : args.workspace };
	return show$8.definition.url.replace("{workspace}", parsedArgs.workspace.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\Platform\WorkspaceController::show
* @see app/Http/Controllers/Admin/Platform/WorkspaceController.php:124
* @route '/admin/workspaces/{workspace}'
*/
show$8.get = (args, options) => ({
	url: show$8.url(args, options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\WorkspaceController::show
* @see app/Http/Controllers/Admin/Platform/WorkspaceController.php:124
* @route '/admin/workspaces/{workspace}'
*/
show$8.head = (args, options) => ({
	url: show$8.url(args, options),
	method: "head"
});
/**
* @see \App\Http\Controllers\Admin\Platform\WorkspaceController::show
* @see app/Http/Controllers/Admin/Platform/WorkspaceController.php:124
* @route '/admin/workspaces/{workspace}'
*/
var showForm$8 = (args, options) => ({
	action: show$8.url(args, options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\WorkspaceController::show
* @see app/Http/Controllers/Admin/Platform/WorkspaceController.php:124
* @route '/admin/workspaces/{workspace}'
*/
showForm$8.get = (args, options) => ({
	action: show$8.url(args, options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\WorkspaceController::show
* @see app/Http/Controllers/Admin/Platform/WorkspaceController.php:124
* @route '/admin/workspaces/{workspace}'
*/
showForm$8.head = (args, options) => ({
	action: show$8.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
show$8.form = showForm$8;
/**
* @see \App\Http\Controllers\Admin\Platform\WorkspaceController::bulkDestroy
* @see app/Http/Controllers/Admin/Platform/WorkspaceController.php:41
* @route '/admin/workspaces/bulk-destroy'
*/
var bulkDestroy$8 = (options) => ({
	url: bulkDestroy$8.url(options),
	method: "post"
});
bulkDestroy$8.definition = {
	methods: ["post"],
	url: "/admin/workspaces/bulk-destroy"
};
/**
* @see \App\Http\Controllers\Admin\Platform\WorkspaceController::bulkDestroy
* @see app/Http/Controllers/Admin/Platform/WorkspaceController.php:41
* @route '/admin/workspaces/bulk-destroy'
*/
bulkDestroy$8.url = (options) => {
	return bulkDestroy$8.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\Platform\WorkspaceController::bulkDestroy
* @see app/Http/Controllers/Admin/Platform/WorkspaceController.php:41
* @route '/admin/workspaces/bulk-destroy'
*/
bulkDestroy$8.post = (options) => ({
	url: bulkDestroy$8.url(options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\Platform\WorkspaceController::bulkDestroy
* @see app/Http/Controllers/Admin/Platform/WorkspaceController.php:41
* @route '/admin/workspaces/bulk-destroy'
*/
var bulkDestroyForm$8 = (options) => ({
	action: bulkDestroy$8.url(options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\Platform\WorkspaceController::bulkDestroy
* @see app/Http/Controllers/Admin/Platform/WorkspaceController.php:41
* @route '/admin/workspaces/bulk-destroy'
*/
bulkDestroyForm$8.post = (options) => ({
	action: bulkDestroy$8.url(options),
	method: "post"
});
bulkDestroy$8.form = bulkDestroyForm$8;
/**
* @see \App\Http\Controllers\Admin\Platform\WorkspaceController::destroy
* @see app/Http/Controllers/Admin/Platform/WorkspaceController.php:28
* @route '/admin/workspaces/{workspace}'
*/
var destroy$24 = (args, options) => ({
	url: destroy$24.url(args, options),
	method: "delete"
});
destroy$24.definition = {
	methods: ["delete"],
	url: "/admin/workspaces/{workspace}"
};
/**
* @see \App\Http\Controllers\Admin\Platform\WorkspaceController::destroy
* @see app/Http/Controllers/Admin/Platform/WorkspaceController.php:28
* @route '/admin/workspaces/{workspace}'
*/
destroy$24.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { workspace: args };
	if (typeof args === "object" && !Array.isArray(args) && "id" in args) args = { workspace: args.id };
	if (Array.isArray(args)) args = { workspace: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { workspace: typeof args.workspace === "object" ? args.workspace.id : args.workspace };
	return destroy$24.definition.url.replace("{workspace}", parsedArgs.workspace.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\Platform\WorkspaceController::destroy
* @see app/Http/Controllers/Admin/Platform/WorkspaceController.php:28
* @route '/admin/workspaces/{workspace}'
*/
destroy$24.delete = (args, options) => ({
	url: destroy$24.url(args, options),
	method: "delete"
});
/**
* @see \App\Http\Controllers\Admin\Platform\WorkspaceController::destroy
* @see app/Http/Controllers/Admin/Platform/WorkspaceController.php:28
* @route '/admin/workspaces/{workspace}'
*/
var destroyForm$24 = (args, options) => ({
	action: destroy$24.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "DELETE",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\Platform\WorkspaceController::destroy
* @see app/Http/Controllers/Admin/Platform/WorkspaceController.php:28
* @route '/admin/workspaces/{workspace}'
*/
destroyForm$24.delete = (args, options) => ({
	action: destroy$24.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "DELETE",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
destroy$24.form = destroyForm$24;
var workspaces$1 = {
	index: Object.assign(index$34, index$34),
	show: Object.assign(show$8, show$8),
	bulkDestroy: Object.assign(bulkDestroy$8, bulkDestroy$8),
	destroy: Object.assign(destroy$24, destroy$24)
};
//#endregion
//#region resources/js/routes/admin/users/index.ts
/**
* @see \App\Http\Controllers\Admin\Platform\UserController::index
* @see app/Http/Controllers/Admin/Platform/UserController.php:20
* @route '/admin/users'
*/
var index$33 = (options) => ({
	url: index$33.url(options),
	method: "get"
});
index$33.definition = {
	methods: ["get", "head"],
	url: "/admin/users"
};
/**
* @see \App\Http\Controllers\Admin\Platform\UserController::index
* @see app/Http/Controllers/Admin/Platform/UserController.php:20
* @route '/admin/users'
*/
index$33.url = (options) => {
	return index$33.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\Platform\UserController::index
* @see app/Http/Controllers/Admin/Platform/UserController.php:20
* @route '/admin/users'
*/
index$33.get = (options) => ({
	url: index$33.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\UserController::index
* @see app/Http/Controllers/Admin/Platform/UserController.php:20
* @route '/admin/users'
*/
index$33.head = (options) => ({
	url: index$33.url(options),
	method: "head"
});
/**
* @see \App\Http\Controllers\Admin\Platform\UserController::index
* @see app/Http/Controllers/Admin/Platform/UserController.php:20
* @route '/admin/users'
*/
var indexForm$33 = (options) => ({
	action: index$33.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\UserController::index
* @see app/Http/Controllers/Admin/Platform/UserController.php:20
* @route '/admin/users'
*/
indexForm$33.get = (options) => ({
	action: index$33.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\UserController::index
* @see app/Http/Controllers/Admin/Platform/UserController.php:20
* @route '/admin/users'
*/
indexForm$33.head = (options) => ({
	action: index$33.url({ [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
index$33.form = indexForm$33;
/**
* @see \App\Http\Controllers\Admin\Platform\UserController::update
* @see app/Http/Controllers/Admin/Platform/UserController.php:80
* @route '/admin/users/{user}'
*/
var update$18 = (args, options) => ({
	url: update$18.url(args, options),
	method: "patch"
});
update$18.definition = {
	methods: ["patch"],
	url: "/admin/users/{user}"
};
/**
* @see \App\Http\Controllers\Admin\Platform\UserController::update
* @see app/Http/Controllers/Admin/Platform/UserController.php:80
* @route '/admin/users/{user}'
*/
update$18.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { user: args };
	if (typeof args === "object" && !Array.isArray(args) && "id" in args) args = { user: args.id };
	if (Array.isArray(args)) args = { user: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { user: typeof args.user === "object" ? args.user.id : args.user };
	return update$18.definition.url.replace("{user}", parsedArgs.user.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\Platform\UserController::update
* @see app/Http/Controllers/Admin/Platform/UserController.php:80
* @route '/admin/users/{user}'
*/
update$18.patch = (args, options) => ({
	url: update$18.url(args, options),
	method: "patch"
});
/**
* @see \App\Http\Controllers\Admin\Platform\UserController::update
* @see app/Http/Controllers/Admin/Platform/UserController.php:80
* @route '/admin/users/{user}'
*/
var updateForm$18 = (args, options) => ({
	action: update$18.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "PATCH",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\Platform\UserController::update
* @see app/Http/Controllers/Admin/Platform/UserController.php:80
* @route '/admin/users/{user}'
*/
updateForm$18.patch = (args, options) => ({
	action: update$18.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "PATCH",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
update$18.form = updateForm$18;
/**
* @see \App\Http\Controllers\Admin\Platform\UserController::updateRole
* @see app/Http/Controllers/Admin/Platform/UserController.php:99
* @route '/admin/users/{user}/role'
*/
var updateRole = (args, options) => ({
	url: updateRole.url(args, options),
	method: "patch"
});
updateRole.definition = {
	methods: ["patch"],
	url: "/admin/users/{user}/role"
};
/**
* @see \App\Http\Controllers\Admin\Platform\UserController::updateRole
* @see app/Http/Controllers/Admin/Platform/UserController.php:99
* @route '/admin/users/{user}/role'
*/
updateRole.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { user: args };
	if (typeof args === "object" && !Array.isArray(args) && "id" in args) args = { user: args.id };
	if (Array.isArray(args)) args = { user: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { user: typeof args.user === "object" ? args.user.id : args.user };
	return updateRole.definition.url.replace("{user}", parsedArgs.user.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\Platform\UserController::updateRole
* @see app/Http/Controllers/Admin/Platform/UserController.php:99
* @route '/admin/users/{user}/role'
*/
updateRole.patch = (args, options) => ({
	url: updateRole.url(args, options),
	method: "patch"
});
/**
* @see \App\Http\Controllers\Admin\Platform\UserController::updateRole
* @see app/Http/Controllers/Admin/Platform/UserController.php:99
* @route '/admin/users/{user}/role'
*/
var updateRoleForm = (args, options) => ({
	action: updateRole.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "PATCH",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\Platform\UserController::updateRole
* @see app/Http/Controllers/Admin/Platform/UserController.php:99
* @route '/admin/users/{user}/role'
*/
updateRoleForm.patch = (args, options) => ({
	action: updateRole.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "PATCH",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
updateRole.form = updateRoleForm;
/**
* @see \App\Http\Controllers\Admin\Platform\UserController::updateByok
* @see app/Http/Controllers/Admin/Platform/UserController.php:136
* @route '/admin/users/{user}/byok'
*/
var updateByok = (args, options) => ({
	url: updateByok.url(args, options),
	method: "patch"
});
updateByok.definition = {
	methods: ["patch"],
	url: "/admin/users/{user}/byok"
};
/**
* @see \App\Http\Controllers\Admin\Platform\UserController::updateByok
* @see app/Http/Controllers/Admin/Platform/UserController.php:136
* @route '/admin/users/{user}/byok'
*/
updateByok.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { user: args };
	if (typeof args === "object" && !Array.isArray(args) && "id" in args) args = { user: args.id };
	if (Array.isArray(args)) args = { user: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { user: typeof args.user === "object" ? args.user.id : args.user };
	return updateByok.definition.url.replace("{user}", parsedArgs.user.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\Platform\UserController::updateByok
* @see app/Http/Controllers/Admin/Platform/UserController.php:136
* @route '/admin/users/{user}/byok'
*/
updateByok.patch = (args, options) => ({
	url: updateByok.url(args, options),
	method: "patch"
});
/**
* @see \App\Http\Controllers\Admin\Platform\UserController::updateByok
* @see app/Http/Controllers/Admin/Platform/UserController.php:136
* @route '/admin/users/{user}/byok'
*/
var updateByokForm = (args, options) => ({
	action: updateByok.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "PATCH",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\Platform\UserController::updateByok
* @see app/Http/Controllers/Admin/Platform/UserController.php:136
* @route '/admin/users/{user}/byok'
*/
updateByokForm.patch = (args, options) => ({
	action: updateByok.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "PATCH",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
updateByok.form = updateByokForm;
/**
* @see \App\Http\Controllers\Admin\Platform\UserController::bulkDestroy
* @see app/Http/Controllers/Admin/Platform/UserController.php:234
* @route '/admin/users/bulk-destroy'
*/
var bulkDestroy$7 = (options) => ({
	url: bulkDestroy$7.url(options),
	method: "post"
});
bulkDestroy$7.definition = {
	methods: ["post"],
	url: "/admin/users/bulk-destroy"
};
/**
* @see \App\Http\Controllers\Admin\Platform\UserController::bulkDestroy
* @see app/Http/Controllers/Admin/Platform/UserController.php:234
* @route '/admin/users/bulk-destroy'
*/
bulkDestroy$7.url = (options) => {
	return bulkDestroy$7.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\Platform\UserController::bulkDestroy
* @see app/Http/Controllers/Admin/Platform/UserController.php:234
* @route '/admin/users/bulk-destroy'
*/
bulkDestroy$7.post = (options) => ({
	url: bulkDestroy$7.url(options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\Platform\UserController::bulkDestroy
* @see app/Http/Controllers/Admin/Platform/UserController.php:234
* @route '/admin/users/bulk-destroy'
*/
var bulkDestroyForm$7 = (options) => ({
	action: bulkDestroy$7.url(options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\Platform\UserController::bulkDestroy
* @see app/Http/Controllers/Admin/Platform/UserController.php:234
* @route '/admin/users/bulk-destroy'
*/
bulkDestroyForm$7.post = (options) => ({
	action: bulkDestroy$7.url(options),
	method: "post"
});
bulkDestroy$7.form = bulkDestroyForm$7;
/**
* @see \App\Http\Controllers\Admin\Platform\UserController::destroy
* @see app/Http/Controllers/Admin/Platform/UserController.php:171
* @route '/admin/users/{user}'
*/
var destroy$23 = (args, options) => ({
	url: destroy$23.url(args, options),
	method: "delete"
});
destroy$23.definition = {
	methods: ["delete"],
	url: "/admin/users/{user}"
};
/**
* @see \App\Http\Controllers\Admin\Platform\UserController::destroy
* @see app/Http/Controllers/Admin/Platform/UserController.php:171
* @route '/admin/users/{user}'
*/
destroy$23.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { user: args };
	if (typeof args === "object" && !Array.isArray(args) && "id" in args) args = { user: args.id };
	if (Array.isArray(args)) args = { user: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { user: typeof args.user === "object" ? args.user.id : args.user };
	return destroy$23.definition.url.replace("{user}", parsedArgs.user.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\Platform\UserController::destroy
* @see app/Http/Controllers/Admin/Platform/UserController.php:171
* @route '/admin/users/{user}'
*/
destroy$23.delete = (args, options) => ({
	url: destroy$23.url(args, options),
	method: "delete"
});
/**
* @see \App\Http\Controllers\Admin\Platform\UserController::destroy
* @see app/Http/Controllers/Admin/Platform/UserController.php:171
* @route '/admin/users/{user}'
*/
var destroyForm$23 = (args, options) => ({
	action: destroy$23.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "DELETE",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\Platform\UserController::destroy
* @see app/Http/Controllers/Admin/Platform/UserController.php:171
* @route '/admin/users/{user}'
*/
destroyForm$23.delete = (args, options) => ({
	action: destroy$23.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "DELETE",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
destroy$23.form = destroyForm$23;
var users = {
	index: Object.assign(index$33, index$33),
	update: Object.assign(update$18, update$18),
	updateRole: Object.assign(updateRole, updateRole),
	updateByok: Object.assign(updateByok, updateByok),
	bulkDestroy: Object.assign(bulkDestroy$7, bulkDestroy$7),
	destroy: Object.assign(destroy$23, destroy$23)
};
//#endregion
//#region resources/js/routes/admin/agents/index.ts
/**
* @see \App\Http\Controllers\Admin\Platform\AgentController::index
* @see app/Http/Controllers/Admin/Platform/AgentController.php:114
* @route '/admin/agents'
*/
var index$32 = (options) => ({
	url: index$32.url(options),
	method: "get"
});
index$32.definition = {
	methods: ["get", "head"],
	url: "/admin/agents"
};
/**
* @see \App\Http\Controllers\Admin\Platform\AgentController::index
* @see app/Http/Controllers/Admin/Platform/AgentController.php:114
* @route '/admin/agents'
*/
index$32.url = (options) => {
	return index$32.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\Platform\AgentController::index
* @see app/Http/Controllers/Admin/Platform/AgentController.php:114
* @route '/admin/agents'
*/
index$32.get = (options) => ({
	url: index$32.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\AgentController::index
* @see app/Http/Controllers/Admin/Platform/AgentController.php:114
* @route '/admin/agents'
*/
index$32.head = (options) => ({
	url: index$32.url(options),
	method: "head"
});
/**
* @see \App\Http\Controllers\Admin\Platform\AgentController::index
* @see app/Http/Controllers/Admin/Platform/AgentController.php:114
* @route '/admin/agents'
*/
var indexForm$32 = (options) => ({
	action: index$32.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\AgentController::index
* @see app/Http/Controllers/Admin/Platform/AgentController.php:114
* @route '/admin/agents'
*/
indexForm$32.get = (options) => ({
	action: index$32.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\AgentController::index
* @see app/Http/Controllers/Admin/Platform/AgentController.php:114
* @route '/admin/agents'
*/
indexForm$32.head = (options) => ({
	action: index$32.url({ [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
index$32.form = indexForm$32;
/**
* @see \App\Http\Controllers\Admin\Platform\AgentController::update
* @see app/Http/Controllers/Admin/Platform/AgentController.php:40
* @route '/admin/agents/{agent}'
*/
var update$17 = (args, options) => ({
	url: update$17.url(args, options),
	method: "patch"
});
update$17.definition = {
	methods: ["patch"],
	url: "/admin/agents/{agent}"
};
/**
* @see \App\Http\Controllers\Admin\Platform\AgentController::update
* @see app/Http/Controllers/Admin/Platform/AgentController.php:40
* @route '/admin/agents/{agent}'
*/
update$17.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { agent: args };
	if (Array.isArray(args)) args = { agent: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { agent: args.agent };
	return update$17.definition.url.replace("{agent}", parsedArgs.agent.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\Platform\AgentController::update
* @see app/Http/Controllers/Admin/Platform/AgentController.php:40
* @route '/admin/agents/{agent}'
*/
update$17.patch = (args, options) => ({
	url: update$17.url(args, options),
	method: "patch"
});
/**
* @see \App\Http\Controllers\Admin\Platform\AgentController::update
* @see app/Http/Controllers/Admin/Platform/AgentController.php:40
* @route '/admin/agents/{agent}'
*/
var updateForm$17 = (args, options) => ({
	action: update$17.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "PATCH",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\Platform\AgentController::update
* @see app/Http/Controllers/Admin/Platform/AgentController.php:40
* @route '/admin/agents/{agent}'
*/
updateForm$17.patch = (args, options) => ({
	action: update$17.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "PATCH",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
update$17.form = updateForm$17;
/**
* @see \App\Http\Controllers\Admin\Platform\AgentController::bulkDestroy
* @see app/Http/Controllers/Admin/Platform/AgentController.php:89
* @route '/admin/agents/bulk-destroy'
*/
var bulkDestroy$6 = (options) => ({
	url: bulkDestroy$6.url(options),
	method: "post"
});
bulkDestroy$6.definition = {
	methods: ["post"],
	url: "/admin/agents/bulk-destroy"
};
/**
* @see \App\Http\Controllers\Admin\Platform\AgentController::bulkDestroy
* @see app/Http/Controllers/Admin/Platform/AgentController.php:89
* @route '/admin/agents/bulk-destroy'
*/
bulkDestroy$6.url = (options) => {
	return bulkDestroy$6.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\Platform\AgentController::bulkDestroy
* @see app/Http/Controllers/Admin/Platform/AgentController.php:89
* @route '/admin/agents/bulk-destroy'
*/
bulkDestroy$6.post = (options) => ({
	url: bulkDestroy$6.url(options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\Platform\AgentController::bulkDestroy
* @see app/Http/Controllers/Admin/Platform/AgentController.php:89
* @route '/admin/agents/bulk-destroy'
*/
var bulkDestroyForm$6 = (options) => ({
	action: bulkDestroy$6.url(options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\Platform\AgentController::bulkDestroy
* @see app/Http/Controllers/Admin/Platform/AgentController.php:89
* @route '/admin/agents/bulk-destroy'
*/
bulkDestroyForm$6.post = (options) => ({
	action: bulkDestroy$6.url(options),
	method: "post"
});
bulkDestroy$6.form = bulkDestroyForm$6;
/**
* @see \App\Http\Controllers\Admin\Platform\AgentController::destroy
* @see app/Http/Controllers/Admin/Platform/AgentController.php:65
* @route '/admin/agents/{agent}'
*/
var destroy$22 = (args, options) => ({
	url: destroy$22.url(args, options),
	method: "delete"
});
destroy$22.definition = {
	methods: ["delete"],
	url: "/admin/agents/{agent}"
};
/**
* @see \App\Http\Controllers\Admin\Platform\AgentController::destroy
* @see app/Http/Controllers/Admin/Platform/AgentController.php:65
* @route '/admin/agents/{agent}'
*/
destroy$22.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { agent: args };
	if (Array.isArray(args)) args = { agent: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { agent: args.agent };
	return destroy$22.definition.url.replace("{agent}", parsedArgs.agent.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\Platform\AgentController::destroy
* @see app/Http/Controllers/Admin/Platform/AgentController.php:65
* @route '/admin/agents/{agent}'
*/
destroy$22.delete = (args, options) => ({
	url: destroy$22.url(args, options),
	method: "delete"
});
/**
* @see \App\Http\Controllers\Admin\Platform\AgentController::destroy
* @see app/Http/Controllers/Admin/Platform/AgentController.php:65
* @route '/admin/agents/{agent}'
*/
var destroyForm$22 = (args, options) => ({
	action: destroy$22.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "DELETE",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\Platform\AgentController::destroy
* @see app/Http/Controllers/Admin/Platform/AgentController.php:65
* @route '/admin/agents/{agent}'
*/
destroyForm$22.delete = (args, options) => ({
	action: destroy$22.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "DELETE",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
destroy$22.form = destroyForm$22;
var agents$1 = {
	index: Object.assign(index$32, index$32),
	update: Object.assign(update$17, update$17),
	bulkDestroy: Object.assign(bulkDestroy$6, bulkDestroy$6),
	destroy: Object.assign(destroy$22, destroy$22)
};
//#endregion
//#region resources/js/routes/admin/pages/index.ts
/**
* @see \App\Http\Controllers\Admin\Platform\PageController::index
* @see app/Http/Controllers/Admin/Platform/PageController.php:28
* @route '/admin/pages'
*/
var index$31 = (options) => ({
	url: index$31.url(options),
	method: "get"
});
index$31.definition = {
	methods: ["get", "head"],
	url: "/admin/pages"
};
/**
* @see \App\Http\Controllers\Admin\Platform\PageController::index
* @see app/Http/Controllers/Admin/Platform/PageController.php:28
* @route '/admin/pages'
*/
index$31.url = (options) => {
	return index$31.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\Platform\PageController::index
* @see app/Http/Controllers/Admin/Platform/PageController.php:28
* @route '/admin/pages'
*/
index$31.get = (options) => ({
	url: index$31.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\PageController::index
* @see app/Http/Controllers/Admin/Platform/PageController.php:28
* @route '/admin/pages'
*/
index$31.head = (options) => ({
	url: index$31.url(options),
	method: "head"
});
/**
* @see \App\Http\Controllers\Admin\Platform\PageController::index
* @see app/Http/Controllers/Admin/Platform/PageController.php:28
* @route '/admin/pages'
*/
var indexForm$31 = (options) => ({
	action: index$31.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\PageController::index
* @see app/Http/Controllers/Admin/Platform/PageController.php:28
* @route '/admin/pages'
*/
indexForm$31.get = (options) => ({
	action: index$31.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\PageController::index
* @see app/Http/Controllers/Admin/Platform/PageController.php:28
* @route '/admin/pages'
*/
indexForm$31.head = (options) => ({
	action: index$31.url({ [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
index$31.form = indexForm$31;
/**
* @see \App\Http\Controllers\Admin\Platform\PageController::create
* @see app/Http/Controllers/Admin/Platform/PageController.php:61
* @route '/admin/pages/create'
*/
var create$4 = (options) => ({
	url: create$4.url(options),
	method: "get"
});
create$4.definition = {
	methods: ["get", "head"],
	url: "/admin/pages/create"
};
/**
* @see \App\Http\Controllers\Admin\Platform\PageController::create
* @see app/Http/Controllers/Admin/Platform/PageController.php:61
* @route '/admin/pages/create'
*/
create$4.url = (options) => {
	return create$4.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\Platform\PageController::create
* @see app/Http/Controllers/Admin/Platform/PageController.php:61
* @route '/admin/pages/create'
*/
create$4.get = (options) => ({
	url: create$4.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\PageController::create
* @see app/Http/Controllers/Admin/Platform/PageController.php:61
* @route '/admin/pages/create'
*/
create$4.head = (options) => ({
	url: create$4.url(options),
	method: "head"
});
/**
* @see \App\Http\Controllers\Admin\Platform\PageController::create
* @see app/Http/Controllers/Admin/Platform/PageController.php:61
* @route '/admin/pages/create'
*/
var createForm$4 = (options) => ({
	action: create$4.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\PageController::create
* @see app/Http/Controllers/Admin/Platform/PageController.php:61
* @route '/admin/pages/create'
*/
createForm$4.get = (options) => ({
	action: create$4.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\PageController::create
* @see app/Http/Controllers/Admin/Platform/PageController.php:61
* @route '/admin/pages/create'
*/
createForm$4.head = (options) => ({
	action: create$4.url({ [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
create$4.form = createForm$4;
/**
* @see \App\Http\Controllers\Admin\Platform\PageController::store
* @see app/Http/Controllers/Admin/Platform/PageController.php:66
* @route '/admin/pages'
*/
var store$24 = (options) => ({
	url: store$24.url(options),
	method: "post"
});
store$24.definition = {
	methods: ["post"],
	url: "/admin/pages"
};
/**
* @see \App\Http\Controllers\Admin\Platform\PageController::store
* @see app/Http/Controllers/Admin/Platform/PageController.php:66
* @route '/admin/pages'
*/
store$24.url = (options) => {
	return store$24.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\Platform\PageController::store
* @see app/Http/Controllers/Admin/Platform/PageController.php:66
* @route '/admin/pages'
*/
store$24.post = (options) => ({
	url: store$24.url(options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\Platform\PageController::store
* @see app/Http/Controllers/Admin/Platform/PageController.php:66
* @route '/admin/pages'
*/
var storeForm$24 = (options) => ({
	action: store$24.url(options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\Platform\PageController::store
* @see app/Http/Controllers/Admin/Platform/PageController.php:66
* @route '/admin/pages'
*/
storeForm$24.post = (options) => ({
	action: store$24.url(options),
	method: "post"
});
store$24.form = storeForm$24;
/**
* @see \App\Http\Controllers\Admin\Platform\PageController::edit
* @see app/Http/Controllers/Admin/Platform/PageController.php:78
* @route '/admin/pages/{page}/edit'
*/
var edit$10 = (args, options) => ({
	url: edit$10.url(args, options),
	method: "get"
});
edit$10.definition = {
	methods: ["get", "head"],
	url: "/admin/pages/{page}/edit"
};
/**
* @see \App\Http\Controllers\Admin\Platform\PageController::edit
* @see app/Http/Controllers/Admin/Platform/PageController.php:78
* @route '/admin/pages/{page}/edit'
*/
edit$10.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { page: args };
	if (typeof args === "object" && !Array.isArray(args) && "id" in args) args = { page: args.id };
	if (Array.isArray(args)) args = { page: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { page: typeof args.page === "object" ? args.page.id : args.page };
	return edit$10.definition.url.replace("{page}", parsedArgs.page.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\Platform\PageController::edit
* @see app/Http/Controllers/Admin/Platform/PageController.php:78
* @route '/admin/pages/{page}/edit'
*/
edit$10.get = (args, options) => ({
	url: edit$10.url(args, options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\PageController::edit
* @see app/Http/Controllers/Admin/Platform/PageController.php:78
* @route '/admin/pages/{page}/edit'
*/
edit$10.head = (args, options) => ({
	url: edit$10.url(args, options),
	method: "head"
});
/**
* @see \App\Http\Controllers\Admin\Platform\PageController::edit
* @see app/Http/Controllers/Admin/Platform/PageController.php:78
* @route '/admin/pages/{page}/edit'
*/
var editForm$10 = (args, options) => ({
	action: edit$10.url(args, options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\PageController::edit
* @see app/Http/Controllers/Admin/Platform/PageController.php:78
* @route '/admin/pages/{page}/edit'
*/
editForm$10.get = (args, options) => ({
	action: edit$10.url(args, options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\PageController::edit
* @see app/Http/Controllers/Admin/Platform/PageController.php:78
* @route '/admin/pages/{page}/edit'
*/
editForm$10.head = (args, options) => ({
	action: edit$10.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
edit$10.form = editForm$10;
/**
* @see \App\Http\Controllers\Admin\Platform\PageController::update
* @see app/Http/Controllers/Admin/Platform/PageController.php:93
* @route '/admin/pages/{page}'
*/
var update$16 = (args, options) => ({
	url: update$16.url(args, options),
	method: "patch"
});
update$16.definition = {
	methods: ["patch"],
	url: "/admin/pages/{page}"
};
/**
* @see \App\Http\Controllers\Admin\Platform\PageController::update
* @see app/Http/Controllers/Admin/Platform/PageController.php:93
* @route '/admin/pages/{page}'
*/
update$16.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { page: args };
	if (typeof args === "object" && !Array.isArray(args) && "id" in args) args = { page: args.id };
	if (Array.isArray(args)) args = { page: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { page: typeof args.page === "object" ? args.page.id : args.page };
	return update$16.definition.url.replace("{page}", parsedArgs.page.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\Platform\PageController::update
* @see app/Http/Controllers/Admin/Platform/PageController.php:93
* @route '/admin/pages/{page}'
*/
update$16.patch = (args, options) => ({
	url: update$16.url(args, options),
	method: "patch"
});
/**
* @see \App\Http\Controllers\Admin\Platform\PageController::update
* @see app/Http/Controllers/Admin/Platform/PageController.php:93
* @route '/admin/pages/{page}'
*/
var updateForm$16 = (args, options) => ({
	action: update$16.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "PATCH",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\Platform\PageController::update
* @see app/Http/Controllers/Admin/Platform/PageController.php:93
* @route '/admin/pages/{page}'
*/
updateForm$16.patch = (args, options) => ({
	action: update$16.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "PATCH",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
update$16.form = updateForm$16;
/**
* @see \App\Http\Controllers\Admin\Platform\PageController::destroy
* @see app/Http/Controllers/Admin/Platform/PageController.php:103
* @route '/admin/pages/{page}'
*/
var destroy$21 = (args, options) => ({
	url: destroy$21.url(args, options),
	method: "delete"
});
destroy$21.definition = {
	methods: ["delete"],
	url: "/admin/pages/{page}"
};
/**
* @see \App\Http\Controllers\Admin\Platform\PageController::destroy
* @see app/Http/Controllers/Admin/Platform/PageController.php:103
* @route '/admin/pages/{page}'
*/
destroy$21.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { page: args };
	if (typeof args === "object" && !Array.isArray(args) && "id" in args) args = { page: args.id };
	if (Array.isArray(args)) args = { page: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { page: typeof args.page === "object" ? args.page.id : args.page };
	return destroy$21.definition.url.replace("{page}", parsedArgs.page.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\Platform\PageController::destroy
* @see app/Http/Controllers/Admin/Platform/PageController.php:103
* @route '/admin/pages/{page}'
*/
destroy$21.delete = (args, options) => ({
	url: destroy$21.url(args, options),
	method: "delete"
});
/**
* @see \App\Http\Controllers\Admin\Platform\PageController::destroy
* @see app/Http/Controllers/Admin/Platform/PageController.php:103
* @route '/admin/pages/{page}'
*/
var destroyForm$21 = (args, options) => ({
	action: destroy$21.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "DELETE",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\Platform\PageController::destroy
* @see app/Http/Controllers/Admin/Platform/PageController.php:103
* @route '/admin/pages/{page}'
*/
destroyForm$21.delete = (args, options) => ({
	action: destroy$21.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "DELETE",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
destroy$21.form = destroyForm$21;
/**
* @see \App\Http\Controllers\Admin\Platform\PageController::preview
* @see app/Http/Controllers/Admin/Platform/PageController.php:119
* @route '/admin/pages/preview'
*/
var preview$1 = (options) => ({
	url: preview$1.url(options),
	method: "post"
});
preview$1.definition = {
	methods: ["post"],
	url: "/admin/pages/preview"
};
/**
* @see \App\Http\Controllers\Admin\Platform\PageController::preview
* @see app/Http/Controllers/Admin/Platform/PageController.php:119
* @route '/admin/pages/preview'
*/
preview$1.url = (options) => {
	return preview$1.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\Platform\PageController::preview
* @see app/Http/Controllers/Admin/Platform/PageController.php:119
* @route '/admin/pages/preview'
*/
preview$1.post = (options) => ({
	url: preview$1.url(options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\Platform\PageController::preview
* @see app/Http/Controllers/Admin/Platform/PageController.php:119
* @route '/admin/pages/preview'
*/
var previewForm$1 = (options) => ({
	action: preview$1.url(options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\Platform\PageController::preview
* @see app/Http/Controllers/Admin/Platform/PageController.php:119
* @route '/admin/pages/preview'
*/
previewForm$1.post = (options) => ({
	action: preview$1.url(options),
	method: "post"
});
preview$1.form = previewForm$1;
var pages = {
	index: Object.assign(index$31, index$31),
	create: Object.assign(create$4, create$4),
	store: Object.assign(store$24, store$24),
	edit: Object.assign(edit$10, edit$10),
	update: Object.assign(update$16, update$16),
	destroy: Object.assign(destroy$21, destroy$21),
	preview: Object.assign(preview$1, preview$1)
};
//#endregion
//#region resources/js/routes/admin/translations/index.ts
/**
* @see \App\Http\Controllers\Admin\Platform\TranslationController::index
* @see app/Http/Controllers/Admin/Platform/TranslationController.php:84
* @route '/admin/translations'
*/
var index$30 = (options) => ({
	url: index$30.url(options),
	method: "get"
});
index$30.definition = {
	methods: ["get", "head"],
	url: "/admin/translations"
};
/**
* @see \App\Http\Controllers\Admin\Platform\TranslationController::index
* @see app/Http/Controllers/Admin/Platform/TranslationController.php:84
* @route '/admin/translations'
*/
index$30.url = (options) => {
	return index$30.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\Platform\TranslationController::index
* @see app/Http/Controllers/Admin/Platform/TranslationController.php:84
* @route '/admin/translations'
*/
index$30.get = (options) => ({
	url: index$30.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\TranslationController::index
* @see app/Http/Controllers/Admin/Platform/TranslationController.php:84
* @route '/admin/translations'
*/
index$30.head = (options) => ({
	url: index$30.url(options),
	method: "head"
});
/**
* @see \App\Http\Controllers\Admin\Platform\TranslationController::index
* @see app/Http/Controllers/Admin/Platform/TranslationController.php:84
* @route '/admin/translations'
*/
var indexForm$30 = (options) => ({
	action: index$30.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\TranslationController::index
* @see app/Http/Controllers/Admin/Platform/TranslationController.php:84
* @route '/admin/translations'
*/
indexForm$30.get = (options) => ({
	action: index$30.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\TranslationController::index
* @see app/Http/Controllers/Admin/Platform/TranslationController.php:84
* @route '/admin/translations'
*/
indexForm$30.head = (options) => ({
	action: index$30.url({ [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
index$30.form = indexForm$30;
/**
* @see \App\Http\Controllers\Admin\Platform\TranslationController::show
* @see app/Http/Controllers/Admin/Platform/TranslationController.php:127
* @route '/admin/translations/{locale}'
*/
var show$7 = (args, options) => ({
	url: show$7.url(args, options),
	method: "get"
});
show$7.definition = {
	methods: ["get", "head"],
	url: "/admin/translations/{locale}"
};
/**
* @see \App\Http\Controllers\Admin\Platform\TranslationController::show
* @see app/Http/Controllers/Admin/Platform/TranslationController.php:127
* @route '/admin/translations/{locale}'
*/
show$7.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { locale: args };
	if (Array.isArray(args)) args = { locale: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { locale: args.locale };
	return show$7.definition.url.replace("{locale}", parsedArgs.locale.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\Platform\TranslationController::show
* @see app/Http/Controllers/Admin/Platform/TranslationController.php:127
* @route '/admin/translations/{locale}'
*/
show$7.get = (args, options) => ({
	url: show$7.url(args, options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\TranslationController::show
* @see app/Http/Controllers/Admin/Platform/TranslationController.php:127
* @route '/admin/translations/{locale}'
*/
show$7.head = (args, options) => ({
	url: show$7.url(args, options),
	method: "head"
});
/**
* @see \App\Http\Controllers\Admin\Platform\TranslationController::show
* @see app/Http/Controllers/Admin/Platform/TranslationController.php:127
* @route '/admin/translations/{locale}'
*/
var showForm$7 = (args, options) => ({
	action: show$7.url(args, options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\TranslationController::show
* @see app/Http/Controllers/Admin/Platform/TranslationController.php:127
* @route '/admin/translations/{locale}'
*/
showForm$7.get = (args, options) => ({
	action: show$7.url(args, options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\TranslationController::show
* @see app/Http/Controllers/Admin/Platform/TranslationController.php:127
* @route '/admin/translations/{locale}'
*/
showForm$7.head = (args, options) => ({
	action: show$7.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
show$7.form = showForm$7;
/**
* @see \App\Http\Controllers\Admin\Platform\TranslationController::update
* @see app/Http/Controllers/Admin/Platform/TranslationController.php:215
* @route '/admin/translations/{locale}'
*/
var update$15 = (args, options) => ({
	url: update$15.url(args, options),
	method: "put"
});
update$15.definition = {
	methods: ["put"],
	url: "/admin/translations/{locale}"
};
/**
* @see \App\Http\Controllers\Admin\Platform\TranslationController::update
* @see app/Http/Controllers/Admin/Platform/TranslationController.php:215
* @route '/admin/translations/{locale}'
*/
update$15.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { locale: args };
	if (Array.isArray(args)) args = { locale: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { locale: args.locale };
	return update$15.definition.url.replace("{locale}", parsedArgs.locale.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\Platform\TranslationController::update
* @see app/Http/Controllers/Admin/Platform/TranslationController.php:215
* @route '/admin/translations/{locale}'
*/
update$15.put = (args, options) => ({
	url: update$15.url(args, options),
	method: "put"
});
/**
* @see \App\Http\Controllers\Admin\Platform\TranslationController::update
* @see app/Http/Controllers/Admin/Platform/TranslationController.php:215
* @route '/admin/translations/{locale}'
*/
var updateForm$15 = (args, options) => ({
	action: update$15.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "PUT",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\Platform\TranslationController::update
* @see app/Http/Controllers/Admin/Platform/TranslationController.php:215
* @route '/admin/translations/{locale}'
*/
updateForm$15.put = (args, options) => ({
	action: update$15.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "PUT",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
update$15.form = updateForm$15;
/**
* @see \App\Http\Controllers\Admin\Platform\TranslationController::destroy
* @see app/Http/Controllers/Admin/Platform/TranslationController.php:238
* @route '/admin/translations/{locale}'
*/
var destroy$20 = (args, options) => ({
	url: destroy$20.url(args, options),
	method: "delete"
});
destroy$20.definition = {
	methods: ["delete"],
	url: "/admin/translations/{locale}"
};
/**
* @see \App\Http\Controllers\Admin\Platform\TranslationController::destroy
* @see app/Http/Controllers/Admin/Platform/TranslationController.php:238
* @route '/admin/translations/{locale}'
*/
destroy$20.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { locale: args };
	if (Array.isArray(args)) args = { locale: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { locale: args.locale };
	return destroy$20.definition.url.replace("{locale}", parsedArgs.locale.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\Platform\TranslationController::destroy
* @see app/Http/Controllers/Admin/Platform/TranslationController.php:238
* @route '/admin/translations/{locale}'
*/
destroy$20.delete = (args, options) => ({
	url: destroy$20.url(args, options),
	method: "delete"
});
/**
* @see \App\Http\Controllers\Admin\Platform\TranslationController::destroy
* @see app/Http/Controllers/Admin/Platform/TranslationController.php:238
* @route '/admin/translations/{locale}'
*/
var destroyForm$20 = (args, options) => ({
	action: destroy$20.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "DELETE",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\Platform\TranslationController::destroy
* @see app/Http/Controllers/Admin/Platform/TranslationController.php:238
* @route '/admin/translations/{locale}'
*/
destroyForm$20.delete = (args, options) => ({
	action: destroy$20.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "DELETE",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
destroy$20.form = destroyForm$20;
var translations = {
	index: Object.assign(index$30, index$30),
	show: Object.assign(show$7, show$7),
	update: Object.assign(update$15, update$15),
	destroy: Object.assign(destroy$20, destroy$20)
};
//#endregion
//#region resources/js/routes/admin/conversations/index.ts
/**
* @see \App\Http\Controllers\Admin\Platform\ConversationController::index
* @see app/Http/Controllers/Admin/Platform/ConversationController.php:51
* @route '/admin/conversations'
*/
var index$29 = (options) => ({
	url: index$29.url(options),
	method: "get"
});
index$29.definition = {
	methods: ["get", "head"],
	url: "/admin/conversations"
};
/**
* @see \App\Http\Controllers\Admin\Platform\ConversationController::index
* @see app/Http/Controllers/Admin/Platform/ConversationController.php:51
* @route '/admin/conversations'
*/
index$29.url = (options) => {
	return index$29.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\Platform\ConversationController::index
* @see app/Http/Controllers/Admin/Platform/ConversationController.php:51
* @route '/admin/conversations'
*/
index$29.get = (options) => ({
	url: index$29.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\ConversationController::index
* @see app/Http/Controllers/Admin/Platform/ConversationController.php:51
* @route '/admin/conversations'
*/
index$29.head = (options) => ({
	url: index$29.url(options),
	method: "head"
});
/**
* @see \App\Http\Controllers\Admin\Platform\ConversationController::index
* @see app/Http/Controllers/Admin/Platform/ConversationController.php:51
* @route '/admin/conversations'
*/
var indexForm$29 = (options) => ({
	action: index$29.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\ConversationController::index
* @see app/Http/Controllers/Admin/Platform/ConversationController.php:51
* @route '/admin/conversations'
*/
indexForm$29.get = (options) => ({
	action: index$29.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\ConversationController::index
* @see app/Http/Controllers/Admin/Platform/ConversationController.php:51
* @route '/admin/conversations'
*/
indexForm$29.head = (options) => ({
	action: index$29.url({ [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
index$29.form = indexForm$29;
/**
* @see \App\Http\Controllers\Admin\Platform\ConversationController::show
* @see app/Http/Controllers/Admin/Platform/ConversationController.php:104
* @route '/admin/conversations/{conversation}'
*/
var show$6 = (args, options) => ({
	url: show$6.url(args, options),
	method: "get"
});
show$6.definition = {
	methods: ["get", "head"],
	url: "/admin/conversations/{conversation}"
};
/**
* @see \App\Http\Controllers\Admin\Platform\ConversationController::show
* @see app/Http/Controllers/Admin/Platform/ConversationController.php:104
* @route '/admin/conversations/{conversation}'
*/
show$6.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { conversation: args };
	if (typeof args === "object" && !Array.isArray(args) && "id" in args) args = { conversation: args.id };
	if (Array.isArray(args)) args = { conversation: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { conversation: typeof args.conversation === "object" ? args.conversation.id : args.conversation };
	return show$6.definition.url.replace("{conversation}", parsedArgs.conversation.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\Platform\ConversationController::show
* @see app/Http/Controllers/Admin/Platform/ConversationController.php:104
* @route '/admin/conversations/{conversation}'
*/
show$6.get = (args, options) => ({
	url: show$6.url(args, options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\ConversationController::show
* @see app/Http/Controllers/Admin/Platform/ConversationController.php:104
* @route '/admin/conversations/{conversation}'
*/
show$6.head = (args, options) => ({
	url: show$6.url(args, options),
	method: "head"
});
/**
* @see \App\Http\Controllers\Admin\Platform\ConversationController::show
* @see app/Http/Controllers/Admin/Platform/ConversationController.php:104
* @route '/admin/conversations/{conversation}'
*/
var showForm$6 = (args, options) => ({
	action: show$6.url(args, options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\ConversationController::show
* @see app/Http/Controllers/Admin/Platform/ConversationController.php:104
* @route '/admin/conversations/{conversation}'
*/
showForm$6.get = (args, options) => ({
	action: show$6.url(args, options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\ConversationController::show
* @see app/Http/Controllers/Admin/Platform/ConversationController.php:104
* @route '/admin/conversations/{conversation}'
*/
showForm$6.head = (args, options) => ({
	action: show$6.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
show$6.form = showForm$6;
/**
* @see \App\Http\Controllers\Admin\Platform\ConversationController::bulkDestroy
* @see app/Http/Controllers/Admin/Platform/ConversationController.php:34
* @route '/admin/conversations/bulk-destroy'
*/
var bulkDestroy$5 = (options) => ({
	url: bulkDestroy$5.url(options),
	method: "post"
});
bulkDestroy$5.definition = {
	methods: ["post"],
	url: "/admin/conversations/bulk-destroy"
};
/**
* @see \App\Http\Controllers\Admin\Platform\ConversationController::bulkDestroy
* @see app/Http/Controllers/Admin/Platform/ConversationController.php:34
* @route '/admin/conversations/bulk-destroy'
*/
bulkDestroy$5.url = (options) => {
	return bulkDestroy$5.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\Platform\ConversationController::bulkDestroy
* @see app/Http/Controllers/Admin/Platform/ConversationController.php:34
* @route '/admin/conversations/bulk-destroy'
*/
bulkDestroy$5.post = (options) => ({
	url: bulkDestroy$5.url(options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\Platform\ConversationController::bulkDestroy
* @see app/Http/Controllers/Admin/Platform/ConversationController.php:34
* @route '/admin/conversations/bulk-destroy'
*/
var bulkDestroyForm$5 = (options) => ({
	action: bulkDestroy$5.url(options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\Platform\ConversationController::bulkDestroy
* @see app/Http/Controllers/Admin/Platform/ConversationController.php:34
* @route '/admin/conversations/bulk-destroy'
*/
bulkDestroyForm$5.post = (options) => ({
	action: bulkDestroy$5.url(options),
	method: "post"
});
bulkDestroy$5.form = bulkDestroyForm$5;
/**
* @see \App\Http\Controllers\Admin\Platform\ConversationController::destroy
* @see app/Http/Controllers/Admin/Platform/ConversationController.php:21
* @route '/admin/conversations/{conversation}'
*/
var destroy$19 = (args, options) => ({
	url: destroy$19.url(args, options),
	method: "delete"
});
destroy$19.definition = {
	methods: ["delete"],
	url: "/admin/conversations/{conversation}"
};
/**
* @see \App\Http\Controllers\Admin\Platform\ConversationController::destroy
* @see app/Http/Controllers/Admin/Platform/ConversationController.php:21
* @route '/admin/conversations/{conversation}'
*/
destroy$19.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { conversation: args };
	if (Array.isArray(args)) args = { conversation: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { conversation: args.conversation };
	return destroy$19.definition.url.replace("{conversation}", parsedArgs.conversation.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\Platform\ConversationController::destroy
* @see app/Http/Controllers/Admin/Platform/ConversationController.php:21
* @route '/admin/conversations/{conversation}'
*/
destroy$19.delete = (args, options) => ({
	url: destroy$19.url(args, options),
	method: "delete"
});
/**
* @see \App\Http\Controllers\Admin\Platform\ConversationController::destroy
* @see app/Http/Controllers/Admin/Platform/ConversationController.php:21
* @route '/admin/conversations/{conversation}'
*/
var destroyForm$19 = (args, options) => ({
	action: destroy$19.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "DELETE",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\Platform\ConversationController::destroy
* @see app/Http/Controllers/Admin/Platform/ConversationController.php:21
* @route '/admin/conversations/{conversation}'
*/
destroyForm$19.delete = (args, options) => ({
	action: destroy$19.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "DELETE",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
destroy$19.form = destroyForm$19;
var conversations$2 = {
	index: Object.assign(index$29, index$29),
	show: Object.assign(show$6, show$6),
	bulkDestroy: Object.assign(bulkDestroy$5, bulkDestroy$5),
	destroy: Object.assign(destroy$19, destroy$19)
};
//#endregion
//#region resources/js/routes/admin/leads/index.ts
/**
* @see \App\Http\Controllers\Admin\Platform\LeadController::index
* @see app/Http/Controllers/Admin/Platform/LeadController.php:56
* @route '/admin/leads'
*/
var index$28 = (options) => ({
	url: index$28.url(options),
	method: "get"
});
index$28.definition = {
	methods: ["get", "head"],
	url: "/admin/leads"
};
/**
* @see \App\Http\Controllers\Admin\Platform\LeadController::index
* @see app/Http/Controllers/Admin/Platform/LeadController.php:56
* @route '/admin/leads'
*/
index$28.url = (options) => {
	return index$28.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\Platform\LeadController::index
* @see app/Http/Controllers/Admin/Platform/LeadController.php:56
* @route '/admin/leads'
*/
index$28.get = (options) => ({
	url: index$28.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\LeadController::index
* @see app/Http/Controllers/Admin/Platform/LeadController.php:56
* @route '/admin/leads'
*/
index$28.head = (options) => ({
	url: index$28.url(options),
	method: "head"
});
/**
* @see \App\Http\Controllers\Admin\Platform\LeadController::index
* @see app/Http/Controllers/Admin/Platform/LeadController.php:56
* @route '/admin/leads'
*/
var indexForm$28 = (options) => ({
	action: index$28.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\LeadController::index
* @see app/Http/Controllers/Admin/Platform/LeadController.php:56
* @route '/admin/leads'
*/
indexForm$28.get = (options) => ({
	action: index$28.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\LeadController::index
* @see app/Http/Controllers/Admin/Platform/LeadController.php:56
* @route '/admin/leads'
*/
indexForm$28.head = (options) => ({
	action: index$28.url({ [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
index$28.form = indexForm$28;
/**
* @see \App\Http\Controllers\Admin\Platform\LeadController::bulkDestroy
* @see app/Http/Controllers/Admin/Platform/LeadController.php:39
* @route '/admin/leads/bulk-destroy'
*/
var bulkDestroy$4 = (options) => ({
	url: bulkDestroy$4.url(options),
	method: "post"
});
bulkDestroy$4.definition = {
	methods: ["post"],
	url: "/admin/leads/bulk-destroy"
};
/**
* @see \App\Http\Controllers\Admin\Platform\LeadController::bulkDestroy
* @see app/Http/Controllers/Admin/Platform/LeadController.php:39
* @route '/admin/leads/bulk-destroy'
*/
bulkDestroy$4.url = (options) => {
	return bulkDestroy$4.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\Platform\LeadController::bulkDestroy
* @see app/Http/Controllers/Admin/Platform/LeadController.php:39
* @route '/admin/leads/bulk-destroy'
*/
bulkDestroy$4.post = (options) => ({
	url: bulkDestroy$4.url(options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\Platform\LeadController::bulkDestroy
* @see app/Http/Controllers/Admin/Platform/LeadController.php:39
* @route '/admin/leads/bulk-destroy'
*/
var bulkDestroyForm$4 = (options) => ({
	action: bulkDestroy$4.url(options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\Platform\LeadController::bulkDestroy
* @see app/Http/Controllers/Admin/Platform/LeadController.php:39
* @route '/admin/leads/bulk-destroy'
*/
bulkDestroyForm$4.post = (options) => ({
	action: bulkDestroy$4.url(options),
	method: "post"
});
bulkDestroy$4.form = bulkDestroyForm$4;
/**
* @see \App\Http\Controllers\Admin\Platform\LeadController::destroy
* @see app/Http/Controllers/Admin/Platform/LeadController.php:22
* @route '/admin/leads/{lead}'
*/
var destroy$18 = (args, options) => ({
	url: destroy$18.url(args, options),
	method: "delete"
});
destroy$18.definition = {
	methods: ["delete"],
	url: "/admin/leads/{lead}"
};
/**
* @see \App\Http\Controllers\Admin\Platform\LeadController::destroy
* @see app/Http/Controllers/Admin/Platform/LeadController.php:22
* @route '/admin/leads/{lead}'
*/
destroy$18.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { lead: args };
	if (Array.isArray(args)) args = { lead: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { lead: args.lead };
	return destroy$18.definition.url.replace("{lead}", parsedArgs.lead.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\Platform\LeadController::destroy
* @see app/Http/Controllers/Admin/Platform/LeadController.php:22
* @route '/admin/leads/{lead}'
*/
destroy$18.delete = (args, options) => ({
	url: destroy$18.url(args, options),
	method: "delete"
});
/**
* @see \App\Http\Controllers\Admin\Platform\LeadController::destroy
* @see app/Http/Controllers/Admin/Platform/LeadController.php:22
* @route '/admin/leads/{lead}'
*/
var destroyForm$18 = (args, options) => ({
	action: destroy$18.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "DELETE",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\Platform\LeadController::destroy
* @see app/Http/Controllers/Admin/Platform/LeadController.php:22
* @route '/admin/leads/{lead}'
*/
destroyForm$18.delete = (args, options) => ({
	action: destroy$18.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "DELETE",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
destroy$18.form = destroyForm$18;
var leads$1 = {
	index: Object.assign(index$28, index$28),
	bulkDestroy: Object.assign(bulkDestroy$4, bulkDestroy$4),
	destroy: Object.assign(destroy$18, destroy$18)
};
//#endregion
//#region resources/js/routes/admin/usage/index.ts
/**
* @see \App\Http\Controllers\Admin\Platform\UsageController::index
* @see app/Http/Controllers/Admin/Platform/UsageController.php:13
* @route '/admin/usage'
*/
var index$27 = (options) => ({
	url: index$27.url(options),
	method: "get"
});
index$27.definition = {
	methods: ["get", "head"],
	url: "/admin/usage"
};
/**
* @see \App\Http\Controllers\Admin\Platform\UsageController::index
* @see app/Http/Controllers/Admin/Platform/UsageController.php:13
* @route '/admin/usage'
*/
index$27.url = (options) => {
	return index$27.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\Platform\UsageController::index
* @see app/Http/Controllers/Admin/Platform/UsageController.php:13
* @route '/admin/usage'
*/
index$27.get = (options) => ({
	url: index$27.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\UsageController::index
* @see app/Http/Controllers/Admin/Platform/UsageController.php:13
* @route '/admin/usage'
*/
index$27.head = (options) => ({
	url: index$27.url(options),
	method: "head"
});
/**
* @see \App\Http\Controllers\Admin\Platform\UsageController::index
* @see app/Http/Controllers/Admin/Platform/UsageController.php:13
* @route '/admin/usage'
*/
var indexForm$27 = (options) => ({
	action: index$27.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\UsageController::index
* @see app/Http/Controllers/Admin/Platform/UsageController.php:13
* @route '/admin/usage'
*/
indexForm$27.get = (options) => ({
	action: index$27.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\UsageController::index
* @see app/Http/Controllers/Admin/Platform/UsageController.php:13
* @route '/admin/usage'
*/
indexForm$27.head = (options) => ({
	action: index$27.url({ [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
index$27.form = indexForm$27;
var usage = { index: Object.assign(index$27, index$27) };
//#endregion
//#region resources/js/routes/admin/subscriptions/index.ts
/**
* @see \App\Http\Controllers\Admin\Platform\SubscriptionController::index
* @see app/Http/Controllers/Admin/Platform/SubscriptionController.php:24
* @route '/admin/subscriptions'
*/
var index$26 = (options) => ({
	url: index$26.url(options),
	method: "get"
});
index$26.definition = {
	methods: ["get", "head"],
	url: "/admin/subscriptions"
};
/**
* @see \App\Http\Controllers\Admin\Platform\SubscriptionController::index
* @see app/Http/Controllers/Admin/Platform/SubscriptionController.php:24
* @route '/admin/subscriptions'
*/
index$26.url = (options) => {
	return index$26.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\Platform\SubscriptionController::index
* @see app/Http/Controllers/Admin/Platform/SubscriptionController.php:24
* @route '/admin/subscriptions'
*/
index$26.get = (options) => ({
	url: index$26.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\SubscriptionController::index
* @see app/Http/Controllers/Admin/Platform/SubscriptionController.php:24
* @route '/admin/subscriptions'
*/
index$26.head = (options) => ({
	url: index$26.url(options),
	method: "head"
});
/**
* @see \App\Http\Controllers\Admin\Platform\SubscriptionController::index
* @see app/Http/Controllers/Admin/Platform/SubscriptionController.php:24
* @route '/admin/subscriptions'
*/
var indexForm$26 = (options) => ({
	action: index$26.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\SubscriptionController::index
* @see app/Http/Controllers/Admin/Platform/SubscriptionController.php:24
* @route '/admin/subscriptions'
*/
indexForm$26.get = (options) => ({
	action: index$26.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\SubscriptionController::index
* @see app/Http/Controllers/Admin/Platform/SubscriptionController.php:24
* @route '/admin/subscriptions'
*/
indexForm$26.head = (options) => ({
	action: index$26.url({ [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
index$26.form = indexForm$26;
var subscriptions = { index: Object.assign(index$26, index$26) };
//#endregion
//#region resources/js/routes/admin/plans/sync/index.ts
/**
* @see \App\Http\Controllers\Admin\Platform\PlanController::gateway
* @see app/Http/Controllers/Admin/Platform/PlanController.php:149
* @route '/admin/plans/{plan}/sync/{gateway}'
*/
var gateway = (args, options) => ({
	url: gateway.url(args, options),
	method: "post"
});
gateway.definition = {
	methods: ["post"],
	url: "/admin/plans/{plan}/sync/{gateway}"
};
/**
* @see \App\Http\Controllers\Admin\Platform\PlanController::gateway
* @see app/Http/Controllers/Admin/Platform/PlanController.php:149
* @route '/admin/plans/{plan}/sync/{gateway}'
*/
gateway.url = (args, options) => {
	if (Array.isArray(args)) args = {
		plan: args[0],
		gateway: args[1]
	};
	args = applyUrlDefaults(args);
	const parsedArgs = {
		plan: typeof args.plan === "object" ? args.plan.id : args.plan,
		gateway: args.gateway
	};
	return gateway.definition.url.replace("{plan}", parsedArgs.plan.toString()).replace("{gateway}", parsedArgs.gateway.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\Platform\PlanController::gateway
* @see app/Http/Controllers/Admin/Platform/PlanController.php:149
* @route '/admin/plans/{plan}/sync/{gateway}'
*/
gateway.post = (args, options) => ({
	url: gateway.url(args, options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\Platform\PlanController::gateway
* @see app/Http/Controllers/Admin/Platform/PlanController.php:149
* @route '/admin/plans/{plan}/sync/{gateway}'
*/
var gatewayForm = (args, options) => ({
	action: gateway.url(args, options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\Platform\PlanController::gateway
* @see app/Http/Controllers/Admin/Platform/PlanController.php:149
* @route '/admin/plans/{plan}/sync/{gateway}'
*/
gatewayForm.post = (args, options) => ({
	action: gateway.url(args, options),
	method: "post"
});
gateway.form = gatewayForm;
var sync$1 = { gateway: Object.assign(gateway, gateway) };
//#endregion
//#region resources/js/routes/admin/plans/index.ts
/**
* @see \App\Http\Controllers\Admin\Platform\PlanController::index
* @see app/Http/Controllers/Admin/Platform/PlanController.php:42
* @route '/admin/plans'
*/
var index$25 = (options) => ({
	url: index$25.url(options),
	method: "get"
});
index$25.definition = {
	methods: ["get", "head"],
	url: "/admin/plans"
};
/**
* @see \App\Http\Controllers\Admin\Platform\PlanController::index
* @see app/Http/Controllers/Admin/Platform/PlanController.php:42
* @route '/admin/plans'
*/
index$25.url = (options) => {
	return index$25.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\Platform\PlanController::index
* @see app/Http/Controllers/Admin/Platform/PlanController.php:42
* @route '/admin/plans'
*/
index$25.get = (options) => ({
	url: index$25.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\PlanController::index
* @see app/Http/Controllers/Admin/Platform/PlanController.php:42
* @route '/admin/plans'
*/
index$25.head = (options) => ({
	url: index$25.url(options),
	method: "head"
});
/**
* @see \App\Http\Controllers\Admin\Platform\PlanController::index
* @see app/Http/Controllers/Admin/Platform/PlanController.php:42
* @route '/admin/plans'
*/
var indexForm$25 = (options) => ({
	action: index$25.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\PlanController::index
* @see app/Http/Controllers/Admin/Platform/PlanController.php:42
* @route '/admin/plans'
*/
indexForm$25.get = (options) => ({
	action: index$25.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\PlanController::index
* @see app/Http/Controllers/Admin/Platform/PlanController.php:42
* @route '/admin/plans'
*/
indexForm$25.head = (options) => ({
	action: index$25.url({ [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
index$25.form = indexForm$25;
/**
* @see \App\Http\Controllers\Admin\Platform\PlanController::create
* @see app/Http/Controllers/Admin/Platform/PlanController.php:58
* @route '/admin/plans/create'
*/
var create$3 = (options) => ({
	url: create$3.url(options),
	method: "get"
});
create$3.definition = {
	methods: ["get", "head"],
	url: "/admin/plans/create"
};
/**
* @see \App\Http\Controllers\Admin\Platform\PlanController::create
* @see app/Http/Controllers/Admin/Platform/PlanController.php:58
* @route '/admin/plans/create'
*/
create$3.url = (options) => {
	return create$3.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\Platform\PlanController::create
* @see app/Http/Controllers/Admin/Platform/PlanController.php:58
* @route '/admin/plans/create'
*/
create$3.get = (options) => ({
	url: create$3.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\PlanController::create
* @see app/Http/Controllers/Admin/Platform/PlanController.php:58
* @route '/admin/plans/create'
*/
create$3.head = (options) => ({
	url: create$3.url(options),
	method: "head"
});
/**
* @see \App\Http\Controllers\Admin\Platform\PlanController::create
* @see app/Http/Controllers/Admin/Platform/PlanController.php:58
* @route '/admin/plans/create'
*/
var createForm$3 = (options) => ({
	action: create$3.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\PlanController::create
* @see app/Http/Controllers/Admin/Platform/PlanController.php:58
* @route '/admin/plans/create'
*/
createForm$3.get = (options) => ({
	action: create$3.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\PlanController::create
* @see app/Http/Controllers/Admin/Platform/PlanController.php:58
* @route '/admin/plans/create'
*/
createForm$3.head = (options) => ({
	action: create$3.url({ [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
create$3.form = createForm$3;
/**
* @see \App\Http\Controllers\Admin\Platform\PlanController::store
* @see app/Http/Controllers/Admin/Platform/PlanController.php:65
* @route '/admin/plans'
*/
var store$23 = (options) => ({
	url: store$23.url(options),
	method: "post"
});
store$23.definition = {
	methods: ["post"],
	url: "/admin/plans"
};
/**
* @see \App\Http\Controllers\Admin\Platform\PlanController::store
* @see app/Http/Controllers/Admin/Platform/PlanController.php:65
* @route '/admin/plans'
*/
store$23.url = (options) => {
	return store$23.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\Platform\PlanController::store
* @see app/Http/Controllers/Admin/Platform/PlanController.php:65
* @route '/admin/plans'
*/
store$23.post = (options) => ({
	url: store$23.url(options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\Platform\PlanController::store
* @see app/Http/Controllers/Admin/Platform/PlanController.php:65
* @route '/admin/plans'
*/
var storeForm$23 = (options) => ({
	action: store$23.url(options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\Platform\PlanController::store
* @see app/Http/Controllers/Admin/Platform/PlanController.php:65
* @route '/admin/plans'
*/
storeForm$23.post = (options) => ({
	action: store$23.url(options),
	method: "post"
});
store$23.form = storeForm$23;
/**
* @see \App\Http\Controllers\Admin\Platform\PlanController::edit
* @see app/Http/Controllers/Admin/Platform/PlanController.php:80
* @route '/admin/plans/{plan}/edit'
*/
var edit$9 = (args, options) => ({
	url: edit$9.url(args, options),
	method: "get"
});
edit$9.definition = {
	methods: ["get", "head"],
	url: "/admin/plans/{plan}/edit"
};
/**
* @see \App\Http\Controllers\Admin\Platform\PlanController::edit
* @see app/Http/Controllers/Admin/Platform/PlanController.php:80
* @route '/admin/plans/{plan}/edit'
*/
edit$9.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { plan: args };
	if (typeof args === "object" && !Array.isArray(args) && "id" in args) args = { plan: args.id };
	if (Array.isArray(args)) args = { plan: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { plan: typeof args.plan === "object" ? args.plan.id : args.plan };
	return edit$9.definition.url.replace("{plan}", parsedArgs.plan.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\Platform\PlanController::edit
* @see app/Http/Controllers/Admin/Platform/PlanController.php:80
* @route '/admin/plans/{plan}/edit'
*/
edit$9.get = (args, options) => ({
	url: edit$9.url(args, options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\PlanController::edit
* @see app/Http/Controllers/Admin/Platform/PlanController.php:80
* @route '/admin/plans/{plan}/edit'
*/
edit$9.head = (args, options) => ({
	url: edit$9.url(args, options),
	method: "head"
});
/**
* @see \App\Http\Controllers\Admin\Platform\PlanController::edit
* @see app/Http/Controllers/Admin/Platform/PlanController.php:80
* @route '/admin/plans/{plan}/edit'
*/
var editForm$9 = (args, options) => ({
	action: edit$9.url(args, options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\PlanController::edit
* @see app/Http/Controllers/Admin/Platform/PlanController.php:80
* @route '/admin/plans/{plan}/edit'
*/
editForm$9.get = (args, options) => ({
	action: edit$9.url(args, options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\PlanController::edit
* @see app/Http/Controllers/Admin/Platform/PlanController.php:80
* @route '/admin/plans/{plan}/edit'
*/
editForm$9.head = (args, options) => ({
	action: edit$9.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
edit$9.form = editForm$9;
/**
* @see \App\Http\Controllers\Admin\Platform\PlanController::update
* @see app/Http/Controllers/Admin/Platform/PlanController.php:88
* @route '/admin/plans/{plan}'
*/
var update$14 = (args, options) => ({
	url: update$14.url(args, options),
	method: "patch"
});
update$14.definition = {
	methods: ["patch"],
	url: "/admin/plans/{plan}"
};
/**
* @see \App\Http\Controllers\Admin\Platform\PlanController::update
* @see app/Http/Controllers/Admin/Platform/PlanController.php:88
* @route '/admin/plans/{plan}'
*/
update$14.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { plan: args };
	if (typeof args === "object" && !Array.isArray(args) && "id" in args) args = { plan: args.id };
	if (Array.isArray(args)) args = { plan: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { plan: typeof args.plan === "object" ? args.plan.id : args.plan };
	return update$14.definition.url.replace("{plan}", parsedArgs.plan.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\Platform\PlanController::update
* @see app/Http/Controllers/Admin/Platform/PlanController.php:88
* @route '/admin/plans/{plan}'
*/
update$14.patch = (args, options) => ({
	url: update$14.url(args, options),
	method: "patch"
});
/**
* @see \App\Http\Controllers\Admin\Platform\PlanController::update
* @see app/Http/Controllers/Admin/Platform/PlanController.php:88
* @route '/admin/plans/{plan}'
*/
var updateForm$14 = (args, options) => ({
	action: update$14.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "PATCH",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\Platform\PlanController::update
* @see app/Http/Controllers/Admin/Platform/PlanController.php:88
* @route '/admin/plans/{plan}'
*/
updateForm$14.patch = (args, options) => ({
	action: update$14.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "PATCH",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
update$14.form = updateForm$14;
/**
* @see \App\Http\Controllers\Admin\Platform\PlanController::sync
* @see app/Http/Controllers/Admin/Platform/PlanController.php:149
* @route '/admin/plans/{plan}/sync'
*/
var sync = (args, options) => ({
	url: sync.url(args, options),
	method: "post"
});
sync.definition = {
	methods: ["post"],
	url: "/admin/plans/{plan}/sync"
};
/**
* @see \App\Http\Controllers\Admin\Platform\PlanController::sync
* @see app/Http/Controllers/Admin/Platform/PlanController.php:149
* @route '/admin/plans/{plan}/sync'
*/
sync.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { plan: args };
	if (typeof args === "object" && !Array.isArray(args) && "id" in args) args = { plan: args.id };
	if (Array.isArray(args)) args = { plan: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { plan: typeof args.plan === "object" ? args.plan.id : args.plan };
	return sync.definition.url.replace("{plan}", parsedArgs.plan.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\Platform\PlanController::sync
* @see app/Http/Controllers/Admin/Platform/PlanController.php:149
* @route '/admin/plans/{plan}/sync'
*/
sync.post = (args, options) => ({
	url: sync.url(args, options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\Platform\PlanController::sync
* @see app/Http/Controllers/Admin/Platform/PlanController.php:149
* @route '/admin/plans/{plan}/sync'
*/
var syncForm = (args, options) => ({
	action: sync.url(args, options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\Platform\PlanController::sync
* @see app/Http/Controllers/Admin/Platform/PlanController.php:149
* @route '/admin/plans/{plan}/sync'
*/
syncForm.post = (args, options) => ({
	action: sync.url(args, options),
	method: "post"
});
sync.form = syncForm;
/**
* @see \App\Http\Controllers\Admin\Platform\PlanController::destroy
* @see app/Http/Controllers/Admin/Platform/PlanController.php:233
* @route '/admin/plans/{plan}'
*/
var destroy$17 = (args, options) => ({
	url: destroy$17.url(args, options),
	method: "delete"
});
destroy$17.definition = {
	methods: ["delete"],
	url: "/admin/plans/{plan}"
};
/**
* @see \App\Http\Controllers\Admin\Platform\PlanController::destroy
* @see app/Http/Controllers/Admin/Platform/PlanController.php:233
* @route '/admin/plans/{plan}'
*/
destroy$17.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { plan: args };
	if (typeof args === "object" && !Array.isArray(args) && "id" in args) args = { plan: args.id };
	if (Array.isArray(args)) args = { plan: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { plan: typeof args.plan === "object" ? args.plan.id : args.plan };
	return destroy$17.definition.url.replace("{plan}", parsedArgs.plan.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\Platform\PlanController::destroy
* @see app/Http/Controllers/Admin/Platform/PlanController.php:233
* @route '/admin/plans/{plan}'
*/
destroy$17.delete = (args, options) => ({
	url: destroy$17.url(args, options),
	method: "delete"
});
/**
* @see \App\Http\Controllers\Admin\Platform\PlanController::destroy
* @see app/Http/Controllers/Admin/Platform/PlanController.php:233
* @route '/admin/plans/{plan}'
*/
var destroyForm$17 = (args, options) => ({
	action: destroy$17.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "DELETE",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\Platform\PlanController::destroy
* @see app/Http/Controllers/Admin/Platform/PlanController.php:233
* @route '/admin/plans/{plan}'
*/
destroyForm$17.delete = (args, options) => ({
	action: destroy$17.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "DELETE",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
destroy$17.form = destroyForm$17;
var plans = {
	index: Object.assign(index$25, index$25),
	create: Object.assign(create$3, create$3),
	store: Object.assign(store$23, store$23),
	edit: Object.assign(edit$9, edit$9),
	update: Object.assign(update$14, update$14),
	sync: Object.assign(sync, sync$1),
	destroy: Object.assign(destroy$17, destroy$17)
};
//#endregion
//#region resources/js/routes/admin/integrations/wordpress/index.ts
/**
* @see \App\Http\Controllers\Admin\Platform\WordPressDistributionController::index
* @see app/Http/Controllers/Admin/Platform/WordPressDistributionController.php:28
* @route '/admin/integrations/wordpress'
*/
var index$24 = (options) => ({
	url: index$24.url(options),
	method: "get"
});
index$24.definition = {
	methods: ["get", "head"],
	url: "/admin/integrations/wordpress"
};
/**
* @see \App\Http\Controllers\Admin\Platform\WordPressDistributionController::index
* @see app/Http/Controllers/Admin/Platform/WordPressDistributionController.php:28
* @route '/admin/integrations/wordpress'
*/
index$24.url = (options) => {
	return index$24.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\Platform\WordPressDistributionController::index
* @see app/Http/Controllers/Admin/Platform/WordPressDistributionController.php:28
* @route '/admin/integrations/wordpress'
*/
index$24.get = (options) => ({
	url: index$24.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\WordPressDistributionController::index
* @see app/Http/Controllers/Admin/Platform/WordPressDistributionController.php:28
* @route '/admin/integrations/wordpress'
*/
index$24.head = (options) => ({
	url: index$24.url(options),
	method: "head"
});
/**
* @see \App\Http\Controllers\Admin\Platform\WordPressDistributionController::index
* @see app/Http/Controllers/Admin/Platform/WordPressDistributionController.php:28
* @route '/admin/integrations/wordpress'
*/
var indexForm$24 = (options) => ({
	action: index$24.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\WordPressDistributionController::index
* @see app/Http/Controllers/Admin/Platform/WordPressDistributionController.php:28
* @route '/admin/integrations/wordpress'
*/
indexForm$24.get = (options) => ({
	action: index$24.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\WordPressDistributionController::index
* @see app/Http/Controllers/Admin/Platform/WordPressDistributionController.php:28
* @route '/admin/integrations/wordpress'
*/
indexForm$24.head = (options) => ({
	action: index$24.url({ [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
index$24.form = indexForm$24;
/**
* @see \App\Http\Controllers\Admin\Platform\WordPressDistributionController::build
* @see app/Http/Controllers/Admin/Platform/WordPressDistributionController.php:36
* @route '/admin/integrations/wordpress/build'
*/
var build$1 = (options) => ({
	url: build$1.url(options),
	method: "post"
});
build$1.definition = {
	methods: ["post"],
	url: "/admin/integrations/wordpress/build"
};
/**
* @see \App\Http\Controllers\Admin\Platform\WordPressDistributionController::build
* @see app/Http/Controllers/Admin/Platform/WordPressDistributionController.php:36
* @route '/admin/integrations/wordpress/build'
*/
build$1.url = (options) => {
	return build$1.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\Platform\WordPressDistributionController::build
* @see app/Http/Controllers/Admin/Platform/WordPressDistributionController.php:36
* @route '/admin/integrations/wordpress/build'
*/
build$1.post = (options) => ({
	url: build$1.url(options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\Platform\WordPressDistributionController::build
* @see app/Http/Controllers/Admin/Platform/WordPressDistributionController.php:36
* @route '/admin/integrations/wordpress/build'
*/
var buildForm$1 = (options) => ({
	action: build$1.url(options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\Platform\WordPressDistributionController::build
* @see app/Http/Controllers/Admin/Platform/WordPressDistributionController.php:36
* @route '/admin/integrations/wordpress/build'
*/
buildForm$1.post = (options) => ({
	action: build$1.url(options),
	method: "post"
});
build$1.form = buildForm$1;
/**
* @see \App\Http\Controllers\Admin\Platform\WordPressDistributionController::download
* @see app/Http/Controllers/Admin/Platform/WordPressDistributionController.php:47
* @route '/admin/integrations/wordpress/download/{version}'
*/
var download$3 = (args, options) => ({
	url: download$3.url(args, options),
	method: "get"
});
download$3.definition = {
	methods: ["get", "head"],
	url: "/admin/integrations/wordpress/download/{version}"
};
/**
* @see \App\Http\Controllers\Admin\Platform\WordPressDistributionController::download
* @see app/Http/Controllers/Admin/Platform/WordPressDistributionController.php:47
* @route '/admin/integrations/wordpress/download/{version}'
*/
download$3.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { version: args };
	if (Array.isArray(args)) args = { version: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { version: args.version };
	return download$3.definition.url.replace("{version}", parsedArgs.version.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\Platform\WordPressDistributionController::download
* @see app/Http/Controllers/Admin/Platform/WordPressDistributionController.php:47
* @route '/admin/integrations/wordpress/download/{version}'
*/
download$3.get = (args, options) => ({
	url: download$3.url(args, options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\WordPressDistributionController::download
* @see app/Http/Controllers/Admin/Platform/WordPressDistributionController.php:47
* @route '/admin/integrations/wordpress/download/{version}'
*/
download$3.head = (args, options) => ({
	url: download$3.url(args, options),
	method: "head"
});
/**
* @see \App\Http\Controllers\Admin\Platform\WordPressDistributionController::download
* @see app/Http/Controllers/Admin/Platform/WordPressDistributionController.php:47
* @route '/admin/integrations/wordpress/download/{version}'
*/
var downloadForm$3 = (args, options) => ({
	action: download$3.url(args, options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\WordPressDistributionController::download
* @see app/Http/Controllers/Admin/Platform/WordPressDistributionController.php:47
* @route '/admin/integrations/wordpress/download/{version}'
*/
downloadForm$3.get = (args, options) => ({
	action: download$3.url(args, options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\WordPressDistributionController::download
* @see app/Http/Controllers/Admin/Platform/WordPressDistributionController.php:47
* @route '/admin/integrations/wordpress/download/{version}'
*/
downloadForm$3.head = (args, options) => ({
	action: download$3.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
download$3.form = downloadForm$3;
var wordpress = {
	index: Object.assign(index$24, index$24),
	build: Object.assign(build$1, build$1),
	download: Object.assign(download$3, download$3)
};
//#endregion
//#region resources/js/routes/admin/integrations/index.ts
var integrations$2 = { wordpress: Object.assign(wordpress, wordpress) };
//#endregion
//#region resources/js/routes/admin/impersonate/index.ts
/**
* @see \App\Http\Controllers\Admin\Platform\ImpersonateController::start
* @see app/Http/Controllers/Admin/Platform/ImpersonateController.php:19
* @route '/admin/impersonate/{user}/start'
*/
var start$3 = (args, options) => ({
	url: start$3.url(args, options),
	method: "post"
});
start$3.definition = {
	methods: ["post"],
	url: "/admin/impersonate/{user}/start"
};
/**
* @see \App\Http\Controllers\Admin\Platform\ImpersonateController::start
* @see app/Http/Controllers/Admin/Platform/ImpersonateController.php:19
* @route '/admin/impersonate/{user}/start'
*/
start$3.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { user: args };
	if (typeof args === "object" && !Array.isArray(args) && "id" in args) args = { user: args.id };
	if (Array.isArray(args)) args = { user: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { user: typeof args.user === "object" ? args.user.id : args.user };
	return start$3.definition.url.replace("{user}", parsedArgs.user.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\Platform\ImpersonateController::start
* @see app/Http/Controllers/Admin/Platform/ImpersonateController.php:19
* @route '/admin/impersonate/{user}/start'
*/
start$3.post = (args, options) => ({
	url: start$3.url(args, options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\Platform\ImpersonateController::start
* @see app/Http/Controllers/Admin/Platform/ImpersonateController.php:19
* @route '/admin/impersonate/{user}/start'
*/
var startForm$3 = (args, options) => ({
	action: start$3.url(args, options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\Platform\ImpersonateController::start
* @see app/Http/Controllers/Admin/Platform/ImpersonateController.php:19
* @route '/admin/impersonate/{user}/start'
*/
startForm$3.post = (args, options) => ({
	action: start$3.url(args, options),
	method: "post"
});
start$3.form = startForm$3;
var impersonate = { start: Object.assign(start$3, start$3) };
//#endregion
//#region resources/js/routes/admin/jobs/failed/index.ts
/**
* @see \App\Http\Controllers\Admin\Platform\JobController::show
* @see app/Http/Controllers/Admin/Platform/JobController.php:65
* @route '/admin/jobs/failed/{uuid}'
*/
var show$5 = (args, options) => ({
	url: show$5.url(args, options),
	method: "get"
});
show$5.definition = {
	methods: ["get", "head"],
	url: "/admin/jobs/failed/{uuid}"
};
/**
* @see \App\Http\Controllers\Admin\Platform\JobController::show
* @see app/Http/Controllers/Admin/Platform/JobController.php:65
* @route '/admin/jobs/failed/{uuid}'
*/
show$5.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { uuid: args };
	if (Array.isArray(args)) args = { uuid: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { uuid: args.uuid };
	return show$5.definition.url.replace("{uuid}", parsedArgs.uuid.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\Platform\JobController::show
* @see app/Http/Controllers/Admin/Platform/JobController.php:65
* @route '/admin/jobs/failed/{uuid}'
*/
show$5.get = (args, options) => ({
	url: show$5.url(args, options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\JobController::show
* @see app/Http/Controllers/Admin/Platform/JobController.php:65
* @route '/admin/jobs/failed/{uuid}'
*/
show$5.head = (args, options) => ({
	url: show$5.url(args, options),
	method: "head"
});
/**
* @see \App\Http\Controllers\Admin\Platform\JobController::show
* @see app/Http/Controllers/Admin/Platform/JobController.php:65
* @route '/admin/jobs/failed/{uuid}'
*/
var showForm$5 = (args, options) => ({
	action: show$5.url(args, options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\JobController::show
* @see app/Http/Controllers/Admin/Platform/JobController.php:65
* @route '/admin/jobs/failed/{uuid}'
*/
showForm$5.get = (args, options) => ({
	action: show$5.url(args, options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\JobController::show
* @see app/Http/Controllers/Admin/Platform/JobController.php:65
* @route '/admin/jobs/failed/{uuid}'
*/
showForm$5.head = (args, options) => ({
	action: show$5.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
show$5.form = showForm$5;
/**
* @see \App\Http\Controllers\Admin\Platform\JobController::retry
* @see app/Http/Controllers/Admin/Platform/JobController.php:87
* @route '/admin/jobs/failed/{uuid}/retry'
*/
var retry = (args, options) => ({
	url: retry.url(args, options),
	method: "post"
});
retry.definition = {
	methods: ["post"],
	url: "/admin/jobs/failed/{uuid}/retry"
};
/**
* @see \App\Http\Controllers\Admin\Platform\JobController::retry
* @see app/Http/Controllers/Admin/Platform/JobController.php:87
* @route '/admin/jobs/failed/{uuid}/retry'
*/
retry.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { uuid: args };
	if (Array.isArray(args)) args = { uuid: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { uuid: args.uuid };
	return retry.definition.url.replace("{uuid}", parsedArgs.uuid.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\Platform\JobController::retry
* @see app/Http/Controllers/Admin/Platform/JobController.php:87
* @route '/admin/jobs/failed/{uuid}/retry'
*/
retry.post = (args, options) => ({
	url: retry.url(args, options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\Platform\JobController::retry
* @see app/Http/Controllers/Admin/Platform/JobController.php:87
* @route '/admin/jobs/failed/{uuid}/retry'
*/
var retryForm = (args, options) => ({
	action: retry.url(args, options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\Platform\JobController::retry
* @see app/Http/Controllers/Admin/Platform/JobController.php:87
* @route '/admin/jobs/failed/{uuid}/retry'
*/
retryForm.post = (args, options) => ({
	action: retry.url(args, options),
	method: "post"
});
retry.form = retryForm;
/**
* @see \App\Http\Controllers\Admin\Platform\JobController::forget
* @see app/Http/Controllers/Admin/Platform/JobController.php:101
* @route '/admin/jobs/failed/{uuid}/forget'
*/
var forget = (args, options) => ({
	url: forget.url(args, options),
	method: "post"
});
forget.definition = {
	methods: ["post"],
	url: "/admin/jobs/failed/{uuid}/forget"
};
/**
* @see \App\Http\Controllers\Admin\Platform\JobController::forget
* @see app/Http/Controllers/Admin/Platform/JobController.php:101
* @route '/admin/jobs/failed/{uuid}/forget'
*/
forget.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { uuid: args };
	if (Array.isArray(args)) args = { uuid: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { uuid: args.uuid };
	return forget.definition.url.replace("{uuid}", parsedArgs.uuid.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\Platform\JobController::forget
* @see app/Http/Controllers/Admin/Platform/JobController.php:101
* @route '/admin/jobs/failed/{uuid}/forget'
*/
forget.post = (args, options) => ({
	url: forget.url(args, options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\Platform\JobController::forget
* @see app/Http/Controllers/Admin/Platform/JobController.php:101
* @route '/admin/jobs/failed/{uuid}/forget'
*/
var forgetForm = (args, options) => ({
	action: forget.url(args, options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\Platform\JobController::forget
* @see app/Http/Controllers/Admin/Platform/JobController.php:101
* @route '/admin/jobs/failed/{uuid}/forget'
*/
forgetForm.post = (args, options) => ({
	action: forget.url(args, options),
	method: "post"
});
forget.form = forgetForm;
/**
* @see \App\Http\Controllers\Admin\Platform\JobController::retryAll
* @see app/Http/Controllers/Admin/Platform/JobController.php:94
* @route '/admin/jobs/failed/retry-all'
*/
var retryAll = (options) => ({
	url: retryAll.url(options),
	method: "post"
});
retryAll.definition = {
	methods: ["post"],
	url: "/admin/jobs/failed/retry-all"
};
/**
* @see \App\Http\Controllers\Admin\Platform\JobController::retryAll
* @see app/Http/Controllers/Admin/Platform/JobController.php:94
* @route '/admin/jobs/failed/retry-all'
*/
retryAll.url = (options) => {
	return retryAll.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\Platform\JobController::retryAll
* @see app/Http/Controllers/Admin/Platform/JobController.php:94
* @route '/admin/jobs/failed/retry-all'
*/
retryAll.post = (options) => ({
	url: retryAll.url(options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\Platform\JobController::retryAll
* @see app/Http/Controllers/Admin/Platform/JobController.php:94
* @route '/admin/jobs/failed/retry-all'
*/
var retryAllForm = (options) => ({
	action: retryAll.url(options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\Platform\JobController::retryAll
* @see app/Http/Controllers/Admin/Platform/JobController.php:94
* @route '/admin/jobs/failed/retry-all'
*/
retryAllForm.post = (options) => ({
	action: retryAll.url(options),
	method: "post"
});
retryAll.form = retryAllForm;
/**
* @see \App\Http\Controllers\Admin\Platform\JobController::flush
* @see app/Http/Controllers/Admin/Platform/JobController.php:108
* @route '/admin/jobs/failed/flush'
*/
var flush = (options) => ({
	url: flush.url(options),
	method: "post"
});
flush.definition = {
	methods: ["post"],
	url: "/admin/jobs/failed/flush"
};
/**
* @see \App\Http\Controllers\Admin\Platform\JobController::flush
* @see app/Http/Controllers/Admin/Platform/JobController.php:108
* @route '/admin/jobs/failed/flush'
*/
flush.url = (options) => {
	return flush.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\Platform\JobController::flush
* @see app/Http/Controllers/Admin/Platform/JobController.php:108
* @route '/admin/jobs/failed/flush'
*/
flush.post = (options) => ({
	url: flush.url(options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\Platform\JobController::flush
* @see app/Http/Controllers/Admin/Platform/JobController.php:108
* @route '/admin/jobs/failed/flush'
*/
var flushForm = (options) => ({
	action: flush.url(options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\Platform\JobController::flush
* @see app/Http/Controllers/Admin/Platform/JobController.php:108
* @route '/admin/jobs/failed/flush'
*/
flushForm.post = (options) => ({
	action: flush.url(options),
	method: "post"
});
flush.form = flushForm;
var failed$1 = {
	show: Object.assign(show$5, show$5),
	retry: Object.assign(retry, retry),
	forget: Object.assign(forget, forget),
	retryAll: Object.assign(retryAll, retryAll),
	flush: Object.assign(flush, flush)
};
//#endregion
//#region resources/js/routes/admin/jobs/index.ts
/**
* @see \App\Http\Controllers\Admin\Platform\JobController::failed
* @see app/Http/Controllers/Admin/Platform/JobController.php:35
* @route '/admin/jobs/failed'
*/
var failed = (options) => ({
	url: failed.url(options),
	method: "get"
});
failed.definition = {
	methods: ["get", "head"],
	url: "/admin/jobs/failed"
};
/**
* @see \App\Http\Controllers\Admin\Platform\JobController::failed
* @see app/Http/Controllers/Admin/Platform/JobController.php:35
* @route '/admin/jobs/failed'
*/
failed.url = (options) => {
	return failed.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\Platform\JobController::failed
* @see app/Http/Controllers/Admin/Platform/JobController.php:35
* @route '/admin/jobs/failed'
*/
failed.get = (options) => ({
	url: failed.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\JobController::failed
* @see app/Http/Controllers/Admin/Platform/JobController.php:35
* @route '/admin/jobs/failed'
*/
failed.head = (options) => ({
	url: failed.url(options),
	method: "head"
});
/**
* @see \App\Http\Controllers\Admin\Platform\JobController::failed
* @see app/Http/Controllers/Admin/Platform/JobController.php:35
* @route '/admin/jobs/failed'
*/
var failedForm = (options) => ({
	action: failed.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\JobController::failed
* @see app/Http/Controllers/Admin/Platform/JobController.php:35
* @route '/admin/jobs/failed'
*/
failedForm.get = (options) => ({
	action: failed.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\JobController::failed
* @see app/Http/Controllers/Admin/Platform/JobController.php:35
* @route '/admin/jobs/failed'
*/
failedForm.head = (options) => ({
	action: failed.url({ [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
failed.form = failedForm;
var jobs = { failed: Object.assign(failed, failed$1) };
//#endregion
//#region resources/js/routes/admin/board/index.ts
/**
* @see \App\Http\Controllers\Admin\Platform\KanbanBoardController::index
* @see app/Http/Controllers/Admin/Platform/KanbanBoardController.php:30
* @route '/admin/board'
*/
var index$23 = (options) => ({
	url: index$23.url(options),
	method: "get"
});
index$23.definition = {
	methods: ["get", "head"],
	url: "/admin/board"
};
/**
* @see \App\Http\Controllers\Admin\Platform\KanbanBoardController::index
* @see app/Http/Controllers/Admin/Platform/KanbanBoardController.php:30
* @route '/admin/board'
*/
index$23.url = (options) => {
	return index$23.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\Platform\KanbanBoardController::index
* @see app/Http/Controllers/Admin/Platform/KanbanBoardController.php:30
* @route '/admin/board'
*/
index$23.get = (options) => ({
	url: index$23.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\KanbanBoardController::index
* @see app/Http/Controllers/Admin/Platform/KanbanBoardController.php:30
* @route '/admin/board'
*/
index$23.head = (options) => ({
	url: index$23.url(options),
	method: "head"
});
/**
* @see \App\Http\Controllers\Admin\Platform\KanbanBoardController::index
* @see app/Http/Controllers/Admin/Platform/KanbanBoardController.php:30
* @route '/admin/board'
*/
var indexForm$23 = (options) => ({
	action: index$23.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\KanbanBoardController::index
* @see app/Http/Controllers/Admin/Platform/KanbanBoardController.php:30
* @route '/admin/board'
*/
indexForm$23.get = (options) => ({
	action: index$23.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\KanbanBoardController::index
* @see app/Http/Controllers/Admin/Platform/KanbanBoardController.php:30
* @route '/admin/board'
*/
indexForm$23.head = (options) => ({
	action: index$23.url({ [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
index$23.form = indexForm$23;
/**
* @see \App\Http\Controllers\Admin\Platform\KanbanBoardController::store
* @see app/Http/Controllers/Admin/Platform/KanbanBoardController.php:38
* @route '/admin/board'
*/
var store$22 = (options) => ({
	url: store$22.url(options),
	method: "post"
});
store$22.definition = {
	methods: ["post"],
	url: "/admin/board"
};
/**
* @see \App\Http\Controllers\Admin\Platform\KanbanBoardController::store
* @see app/Http/Controllers/Admin/Platform/KanbanBoardController.php:38
* @route '/admin/board'
*/
store$22.url = (options) => {
	return store$22.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\Platform\KanbanBoardController::store
* @see app/Http/Controllers/Admin/Platform/KanbanBoardController.php:38
* @route '/admin/board'
*/
store$22.post = (options) => ({
	url: store$22.url(options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\Platform\KanbanBoardController::store
* @see app/Http/Controllers/Admin/Platform/KanbanBoardController.php:38
* @route '/admin/board'
*/
var storeForm$22 = (options) => ({
	action: store$22.url(options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\Platform\KanbanBoardController::store
* @see app/Http/Controllers/Admin/Platform/KanbanBoardController.php:38
* @route '/admin/board'
*/
storeForm$22.post = (options) => ({
	action: store$22.url(options),
	method: "post"
});
store$22.form = storeForm$22;
/**
* @see \App\Http\Controllers\Admin\Platform\KanbanBoardController::update
* @see app/Http/Controllers/Admin/Platform/KanbanBoardController.php:63
* @route '/admin/board/{taskId}'
*/
var update$13 = (args, options) => ({
	url: update$13.url(args, options),
	method: "patch"
});
update$13.definition = {
	methods: ["patch"],
	url: "/admin/board/{taskId}"
};
/**
* @see \App\Http\Controllers\Admin\Platform\KanbanBoardController::update
* @see app/Http/Controllers/Admin/Platform/KanbanBoardController.php:63
* @route '/admin/board/{taskId}'
*/
update$13.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { taskId: args };
	if (Array.isArray(args)) args = { taskId: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { taskId: args.taskId };
	return update$13.definition.url.replace("{taskId}", parsedArgs.taskId.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\Platform\KanbanBoardController::update
* @see app/Http/Controllers/Admin/Platform/KanbanBoardController.php:63
* @route '/admin/board/{taskId}'
*/
update$13.patch = (args, options) => ({
	url: update$13.url(args, options),
	method: "patch"
});
/**
* @see \App\Http\Controllers\Admin\Platform\KanbanBoardController::update
* @see app/Http/Controllers/Admin/Platform/KanbanBoardController.php:63
* @route '/admin/board/{taskId}'
*/
var updateForm$13 = (args, options) => ({
	action: update$13.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "PATCH",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\Platform\KanbanBoardController::update
* @see app/Http/Controllers/Admin/Platform/KanbanBoardController.php:63
* @route '/admin/board/{taskId}'
*/
updateForm$13.patch = (args, options) => ({
	action: update$13.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "PATCH",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
update$13.form = updateForm$13;
/**
* @see \App\Http\Controllers\Admin\Platform\KanbanBoardController::destroy
* @see app/Http/Controllers/Admin/Platform/KanbanBoardController.php:94
* @route '/admin/board/{taskId}'
*/
var destroy$16 = (args, options) => ({
	url: destroy$16.url(args, options),
	method: "delete"
});
destroy$16.definition = {
	methods: ["delete"],
	url: "/admin/board/{taskId}"
};
/**
* @see \App\Http\Controllers\Admin\Platform\KanbanBoardController::destroy
* @see app/Http/Controllers/Admin/Platform/KanbanBoardController.php:94
* @route '/admin/board/{taskId}'
*/
destroy$16.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { taskId: args };
	if (Array.isArray(args)) args = { taskId: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { taskId: args.taskId };
	return destroy$16.definition.url.replace("{taskId}", parsedArgs.taskId.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\Platform\KanbanBoardController::destroy
* @see app/Http/Controllers/Admin/Platform/KanbanBoardController.php:94
* @route '/admin/board/{taskId}'
*/
destroy$16.delete = (args, options) => ({
	url: destroy$16.url(args, options),
	method: "delete"
});
/**
* @see \App\Http\Controllers\Admin\Platform\KanbanBoardController::destroy
* @see app/Http/Controllers/Admin/Platform/KanbanBoardController.php:94
* @route '/admin/board/{taskId}'
*/
var destroyForm$16 = (args, options) => ({
	action: destroy$16.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "DELETE",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\Platform\KanbanBoardController::destroy
* @see app/Http/Controllers/Admin/Platform/KanbanBoardController.php:94
* @route '/admin/board/{taskId}'
*/
destroyForm$16.delete = (args, options) => ({
	action: destroy$16.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "DELETE",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
destroy$16.form = destroyForm$16;
var board = {
	index: Object.assign(index$23, index$23),
	store: Object.assign(store$22, store$22),
	update: Object.assign(update$13, update$13),
	destroy: Object.assign(destroy$16, destroy$16)
};
//#endregion
//#region resources/js/routes/admin/changelog/index.ts
/**
* @see \App\Http\Controllers\Admin\Platform\ChangelogController::index
* @see app/Http/Controllers/Admin/Platform/ChangelogController.php:23
* @route '/admin/changelog'
*/
var index$22 = (options) => ({
	url: index$22.url(options),
	method: "get"
});
index$22.definition = {
	methods: ["get", "head"],
	url: "/admin/changelog"
};
/**
* @see \App\Http\Controllers\Admin\Platform\ChangelogController::index
* @see app/Http/Controllers/Admin/Platform/ChangelogController.php:23
* @route '/admin/changelog'
*/
index$22.url = (options) => {
	return index$22.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\Platform\ChangelogController::index
* @see app/Http/Controllers/Admin/Platform/ChangelogController.php:23
* @route '/admin/changelog'
*/
index$22.get = (options) => ({
	url: index$22.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\ChangelogController::index
* @see app/Http/Controllers/Admin/Platform/ChangelogController.php:23
* @route '/admin/changelog'
*/
index$22.head = (options) => ({
	url: index$22.url(options),
	method: "head"
});
/**
* @see \App\Http\Controllers\Admin\Platform\ChangelogController::index
* @see app/Http/Controllers/Admin/Platform/ChangelogController.php:23
* @route '/admin/changelog'
*/
var indexForm$22 = (options) => ({
	action: index$22.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\ChangelogController::index
* @see app/Http/Controllers/Admin/Platform/ChangelogController.php:23
* @route '/admin/changelog'
*/
indexForm$22.get = (options) => ({
	action: index$22.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\ChangelogController::index
* @see app/Http/Controllers/Admin/Platform/ChangelogController.php:23
* @route '/admin/changelog'
*/
indexForm$22.head = (options) => ({
	action: index$22.url({ [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
index$22.form = indexForm$22;
/**
* @see \App\Http\Controllers\Admin\Platform\ChangelogController::create
* @see app/Http/Controllers/Admin/Platform/ChangelogController.php:31
* @route '/admin/changelog/create'
*/
var create$2 = (options) => ({
	url: create$2.url(options),
	method: "get"
});
create$2.definition = {
	methods: ["get", "head"],
	url: "/admin/changelog/create"
};
/**
* @see \App\Http\Controllers\Admin\Platform\ChangelogController::create
* @see app/Http/Controllers/Admin/Platform/ChangelogController.php:31
* @route '/admin/changelog/create'
*/
create$2.url = (options) => {
	return create$2.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\Platform\ChangelogController::create
* @see app/Http/Controllers/Admin/Platform/ChangelogController.php:31
* @route '/admin/changelog/create'
*/
create$2.get = (options) => ({
	url: create$2.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\ChangelogController::create
* @see app/Http/Controllers/Admin/Platform/ChangelogController.php:31
* @route '/admin/changelog/create'
*/
create$2.head = (options) => ({
	url: create$2.url(options),
	method: "head"
});
/**
* @see \App\Http\Controllers\Admin\Platform\ChangelogController::create
* @see app/Http/Controllers/Admin/Platform/ChangelogController.php:31
* @route '/admin/changelog/create'
*/
var createForm$2 = (options) => ({
	action: create$2.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\ChangelogController::create
* @see app/Http/Controllers/Admin/Platform/ChangelogController.php:31
* @route '/admin/changelog/create'
*/
createForm$2.get = (options) => ({
	action: create$2.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\ChangelogController::create
* @see app/Http/Controllers/Admin/Platform/ChangelogController.php:31
* @route '/admin/changelog/create'
*/
createForm$2.head = (options) => ({
	action: create$2.url({ [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
create$2.form = createForm$2;
/**
* @see \App\Http\Controllers\Admin\Platform\ChangelogController::store
* @see app/Http/Controllers/Admin/Platform/ChangelogController.php:36
* @route '/admin/changelog'
*/
var store$21 = (options) => ({
	url: store$21.url(options),
	method: "post"
});
store$21.definition = {
	methods: ["post"],
	url: "/admin/changelog"
};
/**
* @see \App\Http\Controllers\Admin\Platform\ChangelogController::store
* @see app/Http/Controllers/Admin/Platform/ChangelogController.php:36
* @route '/admin/changelog'
*/
store$21.url = (options) => {
	return store$21.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\Platform\ChangelogController::store
* @see app/Http/Controllers/Admin/Platform/ChangelogController.php:36
* @route '/admin/changelog'
*/
store$21.post = (options) => ({
	url: store$21.url(options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\Platform\ChangelogController::store
* @see app/Http/Controllers/Admin/Platform/ChangelogController.php:36
* @route '/admin/changelog'
*/
var storeForm$21 = (options) => ({
	action: store$21.url(options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\Platform\ChangelogController::store
* @see app/Http/Controllers/Admin/Platform/ChangelogController.php:36
* @route '/admin/changelog'
*/
storeForm$21.post = (options) => ({
	action: store$21.url(options),
	method: "post"
});
store$21.form = storeForm$21;
/**
* @see \App\Http\Controllers\Admin\Platform\ChangelogController::edit
* @see app/Http/Controllers/Admin/Platform/ChangelogController.php:56
* @route '/admin/changelog/{entry}/edit'
*/
var edit$8 = (args, options) => ({
	url: edit$8.url(args, options),
	method: "get"
});
edit$8.definition = {
	methods: ["get", "head"],
	url: "/admin/changelog/{entry}/edit"
};
/**
* @see \App\Http\Controllers\Admin\Platform\ChangelogController::edit
* @see app/Http/Controllers/Admin/Platform/ChangelogController.php:56
* @route '/admin/changelog/{entry}/edit'
*/
edit$8.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { entry: args };
	if (Array.isArray(args)) args = { entry: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { entry: args.entry };
	return edit$8.definition.url.replace("{entry}", parsedArgs.entry.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\Platform\ChangelogController::edit
* @see app/Http/Controllers/Admin/Platform/ChangelogController.php:56
* @route '/admin/changelog/{entry}/edit'
*/
edit$8.get = (args, options) => ({
	url: edit$8.url(args, options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\ChangelogController::edit
* @see app/Http/Controllers/Admin/Platform/ChangelogController.php:56
* @route '/admin/changelog/{entry}/edit'
*/
edit$8.head = (args, options) => ({
	url: edit$8.url(args, options),
	method: "head"
});
/**
* @see \App\Http\Controllers\Admin\Platform\ChangelogController::edit
* @see app/Http/Controllers/Admin/Platform/ChangelogController.php:56
* @route '/admin/changelog/{entry}/edit'
*/
var editForm$8 = (args, options) => ({
	action: edit$8.url(args, options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\ChangelogController::edit
* @see app/Http/Controllers/Admin/Platform/ChangelogController.php:56
* @route '/admin/changelog/{entry}/edit'
*/
editForm$8.get = (args, options) => ({
	action: edit$8.url(args, options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\ChangelogController::edit
* @see app/Http/Controllers/Admin/Platform/ChangelogController.php:56
* @route '/admin/changelog/{entry}/edit'
*/
editForm$8.head = (args, options) => ({
	action: edit$8.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
edit$8.form = editForm$8;
/**
* @see \App\Http\Controllers\Admin\Platform\ChangelogController::update
* @see app/Http/Controllers/Admin/Platform/ChangelogController.php:63
* @route '/admin/changelog/{entry}'
*/
var update$12 = (args, options) => ({
	url: update$12.url(args, options),
	method: "patch"
});
update$12.definition = {
	methods: ["patch"],
	url: "/admin/changelog/{entry}"
};
/**
* @see \App\Http\Controllers\Admin\Platform\ChangelogController::update
* @see app/Http/Controllers/Admin/Platform/ChangelogController.php:63
* @route '/admin/changelog/{entry}'
*/
update$12.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { entry: args };
	if (Array.isArray(args)) args = { entry: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { entry: args.entry };
	return update$12.definition.url.replace("{entry}", parsedArgs.entry.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\Platform\ChangelogController::update
* @see app/Http/Controllers/Admin/Platform/ChangelogController.php:63
* @route '/admin/changelog/{entry}'
*/
update$12.patch = (args, options) => ({
	url: update$12.url(args, options),
	method: "patch"
});
/**
* @see \App\Http\Controllers\Admin\Platform\ChangelogController::update
* @see app/Http/Controllers/Admin/Platform/ChangelogController.php:63
* @route '/admin/changelog/{entry}'
*/
var updateForm$12 = (args, options) => ({
	action: update$12.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "PATCH",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\Platform\ChangelogController::update
* @see app/Http/Controllers/Admin/Platform/ChangelogController.php:63
* @route '/admin/changelog/{entry}'
*/
updateForm$12.patch = (args, options) => ({
	action: update$12.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "PATCH",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
update$12.form = updateForm$12;
/**
* @see \App\Http\Controllers\Admin\Platform\ChangelogController::publish
* @see app/Http/Controllers/Admin/Platform/ChangelogController.php:100
* @route '/admin/changelog/{entry}/publish'
*/
var publish$1 = (args, options) => ({
	url: publish$1.url(args, options),
	method: "post"
});
publish$1.definition = {
	methods: ["post"],
	url: "/admin/changelog/{entry}/publish"
};
/**
* @see \App\Http\Controllers\Admin\Platform\ChangelogController::publish
* @see app/Http/Controllers/Admin/Platform/ChangelogController.php:100
* @route '/admin/changelog/{entry}/publish'
*/
publish$1.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { entry: args };
	if (Array.isArray(args)) args = { entry: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { entry: args.entry };
	return publish$1.definition.url.replace("{entry}", parsedArgs.entry.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\Platform\ChangelogController::publish
* @see app/Http/Controllers/Admin/Platform/ChangelogController.php:100
* @route '/admin/changelog/{entry}/publish'
*/
publish$1.post = (args, options) => ({
	url: publish$1.url(args, options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\Platform\ChangelogController::publish
* @see app/Http/Controllers/Admin/Platform/ChangelogController.php:100
* @route '/admin/changelog/{entry}/publish'
*/
var publishForm$1 = (args, options) => ({
	action: publish$1.url(args, options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\Platform\ChangelogController::publish
* @see app/Http/Controllers/Admin/Platform/ChangelogController.php:100
* @route '/admin/changelog/{entry}/publish'
*/
publishForm$1.post = (args, options) => ({
	action: publish$1.url(args, options),
	method: "post"
});
publish$1.form = publishForm$1;
/**
* @see \App\Http\Controllers\Admin\Platform\ChangelogController::destroy
* @see app/Http/Controllers/Admin/Platform/ChangelogController.php:116
* @route '/admin/changelog/{entry}'
*/
var destroy$15 = (args, options) => ({
	url: destroy$15.url(args, options),
	method: "delete"
});
destroy$15.definition = {
	methods: ["delete"],
	url: "/admin/changelog/{entry}"
};
/**
* @see \App\Http\Controllers\Admin\Platform\ChangelogController::destroy
* @see app/Http/Controllers/Admin/Platform/ChangelogController.php:116
* @route '/admin/changelog/{entry}'
*/
destroy$15.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { entry: args };
	if (Array.isArray(args)) args = { entry: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { entry: args.entry };
	return destroy$15.definition.url.replace("{entry}", parsedArgs.entry.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\Platform\ChangelogController::destroy
* @see app/Http/Controllers/Admin/Platform/ChangelogController.php:116
* @route '/admin/changelog/{entry}'
*/
destroy$15.delete = (args, options) => ({
	url: destroy$15.url(args, options),
	method: "delete"
});
/**
* @see \App\Http\Controllers\Admin\Platform\ChangelogController::destroy
* @see app/Http/Controllers/Admin/Platform/ChangelogController.php:116
* @route '/admin/changelog/{entry}'
*/
var destroyForm$15 = (args, options) => ({
	action: destroy$15.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "DELETE",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\Platform\ChangelogController::destroy
* @see app/Http/Controllers/Admin/Platform/ChangelogController.php:116
* @route '/admin/changelog/{entry}'
*/
destroyForm$15.delete = (args, options) => ({
	action: destroy$15.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "DELETE",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
destroy$15.form = destroyForm$15;
var changelog = {
	index: Object.assign(index$22, index$22),
	create: Object.assign(create$2, create$2),
	store: Object.assign(store$21, store$21),
	edit: Object.assign(edit$8, edit$8),
	update: Object.assign(update$12, update$12),
	publish: Object.assign(publish$1, publish$1),
	destroy: Object.assign(destroy$15, destroy$15)
};
//#endregion
//#region resources/js/routes/admin/index.ts
/**
* @see \App\Http\Controllers\Admin\Platform\DashboardController::__invoke
* @see app/Http/Controllers/Admin/Platform/DashboardController.php:32
* @route '/admin'
*/
var dashboard = (options) => ({
	url: dashboard.url(options),
	method: "get"
});
dashboard.definition = {
	methods: ["get", "head"],
	url: "/admin"
};
/**
* @see \App\Http\Controllers\Admin\Platform\DashboardController::__invoke
* @see app/Http/Controllers/Admin/Platform/DashboardController.php:32
* @route '/admin'
*/
dashboard.url = (options) => {
	return dashboard.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\Platform\DashboardController::__invoke
* @see app/Http/Controllers/Admin/Platform/DashboardController.php:32
* @route '/admin'
*/
dashboard.get = (options) => ({
	url: dashboard.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\DashboardController::__invoke
* @see app/Http/Controllers/Admin/Platform/DashboardController.php:32
* @route '/admin'
*/
dashboard.head = (options) => ({
	url: dashboard.url(options),
	method: "head"
});
/**
* @see \App\Http\Controllers\Admin\Platform\DashboardController::__invoke
* @see app/Http/Controllers/Admin/Platform/DashboardController.php:32
* @route '/admin'
*/
var dashboardForm = (options) => ({
	action: dashboard.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\DashboardController::__invoke
* @see app/Http/Controllers/Admin/Platform/DashboardController.php:32
* @route '/admin'
*/
dashboardForm.get = (options) => ({
	action: dashboard.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\DashboardController::__invoke
* @see app/Http/Controllers/Admin/Platform/DashboardController.php:32
* @route '/admin'
*/
dashboardForm.head = (options) => ({
	action: dashboard.url({ [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
dashboard.form = dashboardForm;
/**
* @see \App\Http\Controllers\Admin\Platform\SearchController::__invoke
* @see app/Http/Controllers/Admin/Platform/SearchController.php:15
* @route '/admin/search'
*/
var search = (options) => ({
	url: search.url(options),
	method: "get"
});
search.definition = {
	methods: ["get", "head"],
	url: "/admin/search"
};
/**
* @see \App\Http\Controllers\Admin\Platform\SearchController::__invoke
* @see app/Http/Controllers/Admin/Platform/SearchController.php:15
* @route '/admin/search'
*/
search.url = (options) => {
	return search.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\Platform\SearchController::__invoke
* @see app/Http/Controllers/Admin/Platform/SearchController.php:15
* @route '/admin/search'
*/
search.get = (options) => ({
	url: search.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\SearchController::__invoke
* @see app/Http/Controllers/Admin/Platform/SearchController.php:15
* @route '/admin/search'
*/
search.head = (options) => ({
	url: search.url(options),
	method: "head"
});
/**
* @see \App\Http\Controllers\Admin\Platform\SearchController::__invoke
* @see app/Http/Controllers/Admin/Platform/SearchController.php:15
* @route '/admin/search'
*/
var searchForm = (options) => ({
	action: search.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\SearchController::__invoke
* @see app/Http/Controllers/Admin/Platform/SearchController.php:15
* @route '/admin/search'
*/
searchForm.get = (options) => ({
	action: search.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\SearchController::__invoke
* @see app/Http/Controllers/Admin/Platform/SearchController.php:15
* @route '/admin/search'
*/
searchForm.head = (options) => ({
	action: search.url({ [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
search.form = searchForm;
/**
* @see \App\Http\Controllers\Admin\Platform\JobController::queueHealth
* @see app/Http/Controllers/Admin/Platform/JobController.php:28
* @route '/admin/queue-health'
*/
var queueHealth = (options) => ({
	url: queueHealth.url(options),
	method: "get"
});
queueHealth.definition = {
	methods: ["get", "head"],
	url: "/admin/queue-health"
};
/**
* @see \App\Http\Controllers\Admin\Platform\JobController::queueHealth
* @see app/Http/Controllers/Admin/Platform/JobController.php:28
* @route '/admin/queue-health'
*/
queueHealth.url = (options) => {
	return queueHealth.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\Platform\JobController::queueHealth
* @see app/Http/Controllers/Admin/Platform/JobController.php:28
* @route '/admin/queue-health'
*/
queueHealth.get = (options) => ({
	url: queueHealth.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\JobController::queueHealth
* @see app/Http/Controllers/Admin/Platform/JobController.php:28
* @route '/admin/queue-health'
*/
queueHealth.head = (options) => ({
	url: queueHealth.url(options),
	method: "head"
});
/**
* @see \App\Http\Controllers\Admin\Platform\JobController::queueHealth
* @see app/Http/Controllers/Admin/Platform/JobController.php:28
* @route '/admin/queue-health'
*/
var queueHealthForm = (options) => ({
	action: queueHealth.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\JobController::queueHealth
* @see app/Http/Controllers/Admin/Platform/JobController.php:28
* @route '/admin/queue-health'
*/
queueHealthForm.get = (options) => ({
	action: queueHealth.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\JobController::queueHealth
* @see app/Http/Controllers/Admin/Platform/JobController.php:28
* @route '/admin/queue-health'
*/
queueHealthForm.head = (options) => ({
	action: queueHealth.url({ [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
queueHealth.form = queueHealthForm;
Object.assign(dashboard, dashboard), Object.assign(workspaces$1, workspaces$1), Object.assign(users, users), Object.assign(agents$1, agents$1), Object.assign(pages, pages), Object.assign(translations, translations), Object.assign(conversations$2, conversations$2), Object.assign(leads$1, leads$1), Object.assign(search, search), Object.assign(usage, usage), Object.assign(subscriptions, subscriptions), Object.assign(plans, plans), Object.assign(integrations$2, integrations$2), Object.assign(impersonate, impersonate), Object.assign(queueHealth, queueHealth), Object.assign(jobs, jobs), Object.assign(board, board), Object.assign(changelog, changelog);
//#endregion
//#region resources/js/pages/admin/agents/index.tsx
var agents_exports$1 = /* @__PURE__ */ __exportAll({ default: () => AdminAgents });
var AGENTS_ONLY$1 = [
	"agents",
	"pagination",
	"filters"
];
function PublishBadge$1({ published }) {
	const { t } = useT();
	if (published) return /* @__PURE__ */ jsxs("span", {
		className: "inline-flex items-center gap-1 rounded-md border border-emerald-200 bg-emerald-50 px-2 py-0.5 text-xs font-medium text-emerald-700 dark:border-emerald-500/30 dark:bg-emerald-500/10 dark:text-emerald-300",
		children: [/* @__PURE__ */ jsx(CheckCircle2, { className: "size-3" }), t("Published")]
	});
	return /* @__PURE__ */ jsx("span", {
		className: "inline-flex items-center rounded-md border border-amber-200 bg-amber-50 px-2 py-0.5 text-xs font-medium text-amber-700 dark:border-amber-500/30 dark:bg-amber-500/10 dark:text-amber-300",
		children: t("Draft")
	});
}
function AdminAgents({ agents, pagination, filters }) {
	const { t } = useT();
	const [editing, setEditing] = useState(null);
	const confirm = useConfirm();
	const selection = useBulkSelection();
	const pageIds = agents.map((a) => a.id);
	const onDelete = async (agent) => {
		if (!await confirm({
			title: t("Delete agent?"),
			message: t("Permanently delete \":name\" from :workspace? This removes the agent, its knowledge sources, conversations, and captured leads. Cannot be undone.", {
				name: agent.name,
				workspace: agent.workspace?.name ?? t("its workspace")
			}),
			confirmLabel: t("Delete"),
			danger: true
		})) return;
		router.delete(`/admin/agents/${agent.id}`, { preserveScroll: true });
	};
	return /* @__PURE__ */ jsxs(AdminLayout, {
		breadcrumbs: [{
			title: t("Dashboard"),
			href: dashboard()
		}, {
			title: t("Agents"),
			href: index$32()
		}],
		children: [
			/* @__PURE__ */ jsx(Head, { title: t("Agents · Admin") }),
			/* @__PURE__ */ jsxs(AdminSurface, { children: [
				/* @__PURE__ */ jsxs(AdminSurfaceBar, { children: [
					/* @__PURE__ */ jsx("span", {
						className: "inline-flex h-7 items-center rounded-md border bg-card px-2.5 text-xs font-normal text-foreground",
						children: t("All agents")
					}),
					/* @__PURE__ */ jsx("span", {
						className: "inline-flex h-7 items-center rounded-md border bg-card px-2.5 text-xs font-normal text-muted-foreground",
						children: t(":count agents", { count: pagination.total.toLocaleString() })
					}),
					/* @__PURE__ */ jsx("div", {
						className: "ms-auto w-full sm:w-auto",
						children: /* @__PURE__ */ jsx(TableSearch, {
							placeholder: t("Search by agent or workspace name..."),
							initialValue: filters.q,
							only: AGENTS_ONLY$1
						})
					})
				] }),
				/* @__PURE__ */ jsx("div", {
					className: "min-h-0 flex-1 overflow-auto",
					children: /* @__PURE__ */ jsxs("table", {
						className: "w-full min-w-[980px] border-separate border-spacing-0 text-start text-sm",
						children: [/* @__PURE__ */ jsx("thead", {
							className: "sticky top-0 z-10 bg-card text-xs font-medium text-muted-foreground",
							children: /* @__PURE__ */ jsxs("tr", { children: [
								/* @__PURE__ */ jsx("th", {
									className: "w-9 border-b px-3 py-2",
									children: /* @__PURE__ */ jsx("input", {
										type: "checkbox",
										"aria-label": t("Select all agents"),
										checked: selection.allOnPageSelected(pageIds),
										ref: (el) => {
											if (el) el.indeterminate = !selection.allOnPageSelected(pageIds) && selection.someOnPageSelected(pageIds);
										},
										onChange: () => selection.togglePage(pageIds),
										className: "size-3.5 cursor-pointer rounded border-input"
									})
								}),
								/* @__PURE__ */ jsx("th", {
									className: "border-e border-b px-3 py-2",
									children: t("Agent")
								}),
								/* @__PURE__ */ jsx("th", {
									className: "border-e border-b px-3 py-2",
									children: t("Workspace")
								}),
								/* @__PURE__ */ jsx("th", {
									className: "border-e border-b px-3 py-2",
									children: t("Status")
								}),
								/* @__PURE__ */ jsx("th", {
									className: "border-e border-b px-3 py-2",
									children: t("Reach")
								}),
								/* @__PURE__ */ jsx("th", {
									className: "border-e border-b px-3 py-2",
									children: t("Updated")
								}),
								/* @__PURE__ */ jsx("th", {
									className: "border-b px-3 py-2 text-end",
									children: t("Actions")
								})
							] })
						}), /* @__PURE__ */ jsx("tbody", { children: agents.length === 0 ? /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx("td", {
							colSpan: 7,
							className: "h-72 border-b px-4 text-center",
							children: /* @__PURE__ */ jsxs("div", {
								className: "mx-auto flex max-w-sm flex-col items-center gap-2 text-muted-foreground",
								children: [
									/* @__PURE__ */ jsx(Bot, { className: "size-8" }),
									/* @__PURE__ */ jsx("p", {
										className: "text-sm font-medium text-foreground",
										children: t("No matching agents")
									}),
									/* @__PURE__ */ jsx("p", {
										className: "text-xs",
										children: t("No agents match the current admin search.")
									})
								]
							})
						}) }) : agents.map((agent) => /* @__PURE__ */ jsxs("tr", {
							className: "group hover:bg-muted/35",
							children: [
								/* @__PURE__ */ jsx("td", {
									className: "border-b px-3 py-2",
									children: /* @__PURE__ */ jsx("input", {
										type: "checkbox",
										"aria-label": t("Select :name", { name: agent.name }),
										checked: selection.isSelected(agent.id),
										onChange: (e) => {
											const nativeEvent = e.nativeEvent;
											selection.toggle(agent.id, {
												shiftKey: nativeEvent?.shiftKey ?? false,
												pageIds
											});
										},
										onClick: (e) => e.stopPropagation(),
										className: "size-3.5 cursor-pointer rounded border-input"
									})
								}),
								/* @__PURE__ */ jsx("td", {
									className: "border-e border-b px-3 py-2",
									children: /* @__PURE__ */ jsxs("div", {
										className: "flex min-w-0 items-center gap-2 text-foreground",
										children: [/* @__PURE__ */ jsx("span", {
											className: "flex size-5 shrink-0 items-center justify-center rounded bg-muted text-muted-foreground",
											children: /* @__PURE__ */ jsx(Bot, { className: "size-3.5" })
										}), /* @__PURE__ */ jsxs("div", {
											className: "min-w-0",
											children: [/* @__PURE__ */ jsx("p", {
												className: "truncate font-medium",
												children: agent.name
											}), /* @__PURE__ */ jsx("p", {
												className: "truncate text-xs text-muted-foreground uppercase",
												children: agent.language_default
											})]
										})]
									})
								}),
								/* @__PURE__ */ jsx("td", {
									className: "border-e border-b px-3 py-2",
									children: agent.workspace ? /* @__PURE__ */ jsx(Link, {
										href: show$8(agent.workspace.id),
										className: "truncate font-medium text-foreground hover:text-primary",
										children: agent.workspace.name
									}) : /* @__PURE__ */ jsx("span", {
										className: "text-muted-foreground",
										children: "—"
									})
								}),
								/* @__PURE__ */ jsx("td", {
									className: "border-e border-b px-3 py-2",
									children: /* @__PURE__ */ jsx(PublishBadge$1, { published: agent.is_published })
								}),
								/* @__PURE__ */ jsx("td", {
									className: "border-e border-b px-3 py-2 text-muted-foreground",
									children: /* @__PURE__ */ jsxs("div", {
										className: "space-y-1",
										children: [/* @__PURE__ */ jsxs("p", {
											className: "inline-flex items-center gap-1.5",
											children: [/* @__PURE__ */ jsx(Library, { className: "size-3.5" }), agent.sources_count === 1 ? t(":count source", { count: agent.sources_count.toLocaleString() }) : t(":count sources", { count: agent.sources_count.toLocaleString() })]
										}), /* @__PURE__ */ jsxs("p", {
											className: "inline-flex items-center gap-1.5 text-xs",
											children: [/* @__PURE__ */ jsx(MessageSquare, { className: "size-3.5" }), agent.conversations_count === 1 ? t(":count conversation", { count: agent.conversations_count.toLocaleString() }) : t(":count conversations", { count: agent.conversations_count.toLocaleString() })]
										})]
									})
								}),
								/* @__PURE__ */ jsx("td", {
									className: "border-e border-b px-3 py-2 text-muted-foreground",
									children: relativeTime$8(agent.updated_at, "—")
								}),
								/* @__PURE__ */ jsx("td", {
									className: "border-b px-3 py-2 text-end",
									children: /* @__PURE__ */ jsxs("div", {
										className: "inline-flex items-center gap-1",
										children: [/* @__PURE__ */ jsxs(Button, {
											size: "sm",
											variant: "ghost",
											onClick: () => setEditing(agent),
											"aria-label": t("Edit agent"),
											children: [/* @__PURE__ */ jsx(Pencil, { className: "size-3.5" }), /* @__PURE__ */ jsx("span", {
												className: "ms-1",
												children: t("Edit")
											})]
										}), /* @__PURE__ */ jsx(Button, {
											size: "sm",
											variant: "ghost",
											onClick: () => onDelete(agent),
											"aria-label": t("Delete agent"),
											className: "text-destructive hover:bg-destructive/10 hover:text-destructive",
											children: /* @__PURE__ */ jsx(Trash2, { className: "size-3.5" })
										})]
									})
								})
							]
						}, agent.id)) })]
					})
				}),
				/* @__PURE__ */ jsx(TablePagination, {
					pagination,
					only: AGENTS_ONLY$1
				})
			] }),
			editing !== null && /* @__PURE__ */ jsx(EditAgentDialog, {
				agent: editing,
				onClose: () => setEditing(null)
			}),
			/* @__PURE__ */ jsx(BulkActionsBar, {
				count: selection.size,
				onClear: selection.clear,
				noun: t("agent"),
				children: /* @__PURE__ */ jsx(BulkDeleteButton, {
					confirmMessage: t("Delete :count selected agent(s) across workspaces? This removes their sources, conversations, leads, and embedded widget.", { count: selection.size }),
					onConfirm: () => {
						router.post("/admin/agents/bulk-destroy", { ids: Array.from(selection.selected) }, {
							preserveScroll: true,
							onSuccess: () => selection.clear()
						});
					}
				})
			})
		]
	});
}
function EditAgentDialog({ agent, onClose }) {
	const { t } = useT();
	const form = useForm({
		name: agent.name,
		is_published: agent.is_published
	});
	return /* @__PURE__ */ jsx(Dialog, {
		open: true,
		onOpenChange: (open) => {
			if (!open) onClose();
		},
		children: /* @__PURE__ */ jsxs(DialogContent, { children: [/* @__PURE__ */ jsx(DialogHeader, { children: /* @__PURE__ */ jsx(DialogTitle, { children: t("Edit agent") }) }), /* @__PURE__ */ jsxs("form", {
			onSubmit: (e) => {
				e.preventDefault();
				form.patch(`/admin/agents/${agent.id}`, {
					preserveScroll: true,
					onSuccess: onClose
				});
			},
			className: "grid gap-3",
			children: [
				/* @__PURE__ */ jsxs("div", {
					className: "grid gap-1.5",
					children: [
						/* @__PURE__ */ jsx(Label, {
							htmlFor: "agent-edit-name",
							children: t("Name")
						}),
						/* @__PURE__ */ jsx(Input, {
							id: "agent-edit-name",
							value: form.data.name,
							onChange: (e) => form.setData("name", e.target.value),
							required: true
						}),
						form.errors.name && /* @__PURE__ */ jsx("p", {
							className: "text-xs text-destructive",
							children: form.errors.name
						})
					]
				}),
				/* @__PURE__ */ jsxs(Label, {
					className: "flex items-center gap-2 text-sm",
					children: [/* @__PURE__ */ jsx("input", {
						type: "checkbox",
						checked: form.data.is_published,
						onChange: (e) => form.setData("is_published", e.target.checked),
						className: "size-4"
					}), /* @__PURE__ */ jsx("span", { children: t("Published (visitor-facing)") })]
				}),
				/* @__PURE__ */ jsxs(DialogFooter, { children: [/* @__PURE__ */ jsx(Button, {
					type: "button",
					variant: "outline",
					onClick: onClose,
					children: t("Cancel")
				}), /* @__PURE__ */ jsx(Button, {
					type: "submit",
					disabled: form.processing,
					children: form.processing ? t("Saving…") : t("Save")
				})] })
			]
		})] })
	});
}
//#endregion
//#region resources/js/components/ui/card.tsx
function Card({ className, ...props }) {
	return /* @__PURE__ */ jsx("div", {
		"data-slot": "card",
		className: cn("bg-card text-card-foreground flex flex-col gap-4 rounded-lg border shadow-xs", className),
		...props
	});
}
function CardHeader({ className, ...props }) {
	return /* @__PURE__ */ jsx("div", {
		"data-slot": "card-header",
		className: cn("flex flex-col gap-1.5 px-6 pt-6", className),
		...props
	});
}
function CardTitle({ className, ...props }) {
	return /* @__PURE__ */ jsx("div", {
		"data-slot": "card-title",
		className: cn("text-base leading-none font-semibold", className),
		...props
	});
}
function CardDescription({ className, ...props }) {
	return /* @__PURE__ */ jsx("div", {
		"data-slot": "card-description",
		className: cn("text-muted-foreground text-sm", className),
		...props
	});
}
function CardContent({ className, ...props }) {
	return /* @__PURE__ */ jsx("div", {
		"data-slot": "card-content",
		className: cn("px-6 pb-6", className),
		...props
	});
}
function CardFooter({ className, ...props }) {
	return /* @__PURE__ */ jsx("div", {
		"data-slot": "card-footer",
		className: cn("flex items-center px-6 pb-6", className),
		...props
	});
}
//#endregion
//#region resources/js/hooks/use-board-live-sync.ts
/**
* Real-time updates for an Inertia page via background polling.
*
* Memory-leak guarantees the hook upholds:
*
*   1. Single-flight: `inFlightRef` prevents a new poll while the
*      previous one is still running, so a slow connection can't pile
*      up requests.
*
*   2. Interval cleanup: the interval ID lives in a ref; the effect's
*      cleanup clears it AND every dependency change re-creates a
*      fresh interval after clearing the old one.
*
*   3. Listener cleanup: the visibilitychange listener is added and
*      removed inside the same effect, so it can never outlive the
*      hook.
*
*   4. Backgrounded tabs: polling pauses when document.visibilityState
*      is 'hidden'. On resume, it fires immediately + re-arms the
*      interval, so a returning user sees fresh data without waiting
*      a full cycle.
*
*   5. Pause on demand: the `enabled` flag makes the polling reactive
*      to UI state — open a dialog, polling stops; close it, it
*      resumes from where it left off.
*
* Inertia's `preserveState: true + only: [keys]` means the page
* component instance is kept (state survives) and only the named
* props are merged in. So the user's `selectedTaskId` / dialog state
* survive a poll.
*/
function useBoardLiveSync({ enabled, intervalMs = 8e3, only = ["tasks"] }) {
	const intervalRef = useRef(null);
	const inFlightRef = useRef(false);
	const onlyRef = useRef(only);
	useEffect(() => {
		onlyRef.current = only;
	}, [only]);
	const [lastSyncedAt, setLastSyncedAt] = useState(null);
	const [isSyncing, setIsSyncing] = useState(false);
	useEffect(() => {
		if (typeof window === "undefined") return;
		if (!enabled) return;
		const tick = () => {
			if (document.visibilityState !== "visible") return;
			if (inFlightRef.current) return;
			inFlightRef.current = true;
			setIsSyncing(true);
			router.reload({
				only: onlyRef.current,
				onSuccess: () => {
					setLastSyncedAt(/* @__PURE__ */ new Date());
				},
				onFinish: () => {
					inFlightRef.current = false;
					setIsSyncing(false);
				}
			});
		};
		const start = () => {
			if (intervalRef.current !== null) return;
			intervalRef.current = window.setInterval(tick, intervalMs);
		};
		const stop = () => {
			if (intervalRef.current !== null) {
				window.clearInterval(intervalRef.current);
				intervalRef.current = null;
			}
		};
		const onVisibilityChange = () => {
			if (document.visibilityState === "visible") {
				start();
				tick();
			} else stop();
		};
		if (document.visibilityState === "visible") start();
		document.addEventListener("visibilitychange", onVisibilityChange);
		return () => {
			stop();
			document.removeEventListener("visibilitychange", onVisibilityChange);
		};
	}, [enabled, intervalMs]);
	return {
		lastSyncedAt,
		isSyncing
	};
}
//#endregion
//#region resources/js/pages/admin/board.tsx
var board_exports = /* @__PURE__ */ __exportAll({ default: () => AdminBoardPage });
var statusTone$1 = {
	backlog: "border-slate-300 bg-slate-50 dark:bg-slate-900/40",
	doing: "border-amber-300 bg-amber-50 dark:bg-amber-900/20",
	review: "border-sky-300 bg-sky-50 dark:bg-sky-900/20",
	done: "border-emerald-300 bg-emerald-50 dark:bg-emerald-900/20"
};
function AdminBoardPage({ tasks, statuses }) {
	const { t } = useT();
	const [editing, setEditing] = useState(null);
	const [creating, setCreating] = useState(null);
	const breadcrumbs = [{
		title: t("Admin"),
		href: "/admin"
	}, {
		title: t("Board"),
		href: "/admin/board"
	}];
	const statusLabels = {
		backlog: t("Backlog"),
		doing: t("In progress"),
		review: t("Review"),
		done: t("Done")
	};
	const { lastSyncedAt, isSyncing } = useBoardLiveSync({ enabled: editing === null && creating === null });
	const grouped = useMemo(() => {
		const map = {
			backlog: [],
			doing: [],
			review: [],
			done: []
		};
		for (const task of tasks) map[task.status]?.push(task);
		return map;
	}, [tasks]);
	return /* @__PURE__ */ jsxs(AdminLayout, {
		breadcrumbs,
		children: [
			/* @__PURE__ */ jsx(Head, { title: t("Board · Admin") }),
			/* @__PURE__ */ jsxs("div", {
				className: "flex flex-1 flex-col gap-4 p-4",
				children: [/* @__PURE__ */ jsxs("header", {
					className: "flex items-start justify-between gap-3",
					children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("h1", {
						className: "text-2xl font-semibold tracking-tight",
						children: t("Internal board")
					}), /* @__PURE__ */ jsx("p", {
						className: "mt-1 max-w-2xl text-sm text-muted-foreground",
						children: t("Backlog · Doing · Review · Done. Stored as a JSON file at storage/app/private/kanban-tasks.json — survives migrate:fresh. Super-admins only.")
					})] }), /* @__PURE__ */ jsx(LiveIndicator, {
						lastSyncedAt,
						isSyncing,
						paused: editing !== null || creating !== null
					})]
				}), /* @__PURE__ */ jsx("div", {
					className: "grid flex-1 gap-3 md:grid-cols-2 xl:grid-cols-4",
					children: statuses.map((status) => /* @__PURE__ */ jsxs("div", {
						className: "flex h-full flex-col rounded-lg border " + statusTone$1[status],
						children: [/* @__PURE__ */ jsxs("div", {
							className: "flex items-center justify-between border-b border-current/10 px-3 py-2",
							children: [/* @__PURE__ */ jsxs("div", {
								className: "flex items-center gap-2",
								children: [/* @__PURE__ */ jsx("span", {
									className: "text-sm font-semibold tracking-wide uppercase",
									children: statusLabels[status]
								}), /* @__PURE__ */ jsx("span", {
									className: "rounded-full bg-background/60 px-2 py-0.5 text-xs font-medium text-muted-foreground",
									children: grouped[status]?.length ?? 0
								})]
							}), /* @__PURE__ */ jsx(Button, {
								type: "button",
								variant: "ghost",
								size: "sm",
								onClick: () => setCreating(status),
								"aria-label": t("Add task to :status", { status: statusLabels[status] }),
								children: /* @__PURE__ */ jsx(Plus, { className: "size-4" })
							})]
						}), /* @__PURE__ */ jsxs("div", {
							className: "flex flex-1 flex-col gap-2 p-2",
							children: [(grouped[status] ?? []).length === 0 && /* @__PURE__ */ jsx("p", {
								className: "px-2 py-6 text-center text-xs text-muted-foreground",
								children: t("Nothing here yet.")
							}), (grouped[status] ?? []).map((task) => /* @__PURE__ */ jsx(Card, {
								className: "cursor-pointer p-0 transition hover:shadow-md",
								onClick: () => setEditing(task),
								children: /* @__PURE__ */ jsxs(CardContent, {
									className: "p-3",
									children: [
										/* @__PURE__ */ jsxs("div", {
											className: "flex items-start gap-2",
											children: [
												/* @__PURE__ */ jsxs("span", {
													className: "rounded bg-background/70 px-1.5 py-0.5 font-mono text-[10px] font-semibold tracking-tight text-muted-foreground",
													children: ["#", task.number]
												}),
												/* @__PURE__ */ jsx("p", {
													className: "text-sm leading-snug font-medium",
													children: task.title
												}),
												task.version && /* @__PURE__ */ jsx("span", {
													className: "ms-auto shrink-0 rounded-full border border-emerald-200 bg-emerald-50 px-2 py-0.5 font-mono text-[10px] font-semibold text-emerald-700 dark:border-emerald-500/30 dark:bg-emerald-500/10 dark:text-emerald-300",
													title: t("Shipped in :version", { version: task.version }),
													children: task.version
												})
											]
										}),
										task.body && /* @__PURE__ */ jsx("p", {
											className: "mt-1 line-clamp-2 text-xs text-muted-foreground",
											children: task.body
										}),
										task.labels.length > 0 && /* @__PURE__ */ jsx("div", {
											className: "mt-2 flex flex-wrap gap-1",
											children: task.labels.map((label) => /* @__PURE__ */ jsx("span", {
												className: "rounded-full border bg-background/70 px-2 py-0.5 text-[10px] font-medium tracking-wide text-muted-foreground uppercase",
												children: label
											}, label))
										})
									]
								})
							}, task.id))]
						})]
					}, status))
				})]
			}),
			creating !== null && /* @__PURE__ */ jsx(CreateTaskDialog, {
				initialStatus: creating,
				statuses,
				statusLabels,
				onClose: () => setCreating(null)
			}),
			editing !== null && /* @__PURE__ */ jsx(EditTaskDialog, {
				task: editing,
				statuses,
				statusLabels,
				onClose: () => setEditing(null)
			})
		]
	});
}
/**
* Tiny "Live · last synced Xs ago" pill in the header. Watches a 1s
* tick so the relative-time string stays accurate without re-rendering
* the whole board. The interval lives in the same component as the
* label it drives, so unmounting the indicator cleans up the timer.
*/
function LiveIndicator({ lastSyncedAt, isSyncing, paused }) {
	const { t } = useT();
	const [, forceTick] = useState(0);
	useEffect(() => {
		const id = window.setInterval(() => forceTick((n) => n + 1), 1e3);
		return () => window.clearInterval(id);
	}, []);
	const label = (() => {
		if (paused) return t("Paused");
		if (isSyncing) return t("Syncing…");
		if (!lastSyncedAt) return t("Live");
		const seconds = Math.floor((Date.now() - lastSyncedAt.getTime()) / 1e3);
		if (seconds < 5) return t("Live · just now");
		if (seconds < 60) return t("Live · :seconds s ago", { seconds });
		return t("Live · :minutes m ago", { minutes: Math.floor(seconds / 60) });
	})();
	return /* @__PURE__ */ jsxs("span", {
		className: `inline-flex items-center gap-1.5 rounded-full border px-2.5 py-1 text-[11px] font-medium ${paused ? "border-slate-300 bg-slate-50 text-slate-600" : isSyncing ? "border-amber-300 bg-amber-50 text-amber-700" : "border-emerald-300 bg-emerald-50 text-emerald-700"}`,
		title: lastSyncedAt ? t("Last synced :time", { time: lastSyncedAt.toLocaleTimeString() }) : t("Polling every 8s, paused while a dialog is open"),
		children: [/* @__PURE__ */ jsx(RefreshCw, { className: `size-3 ${isSyncing ? "animate-spin" : ""}` }), label]
	});
}
function CreateTaskDialog({ initialStatus, statuses, statusLabels, onClose }) {
	const { t } = useT();
	const form = useForm({
		title: "",
		body: "",
		status: initialStatus,
		labels: ""
	});
	const submit = (e) => {
		e.preventDefault();
		form.transform((data) => ({
			...data,
			labels: data.labels.split(",").map((s) => s.trim()).filter(Boolean)
		}));
		form.post("/admin/board", {
			preserveScroll: true,
			onSuccess: () => onClose()
		});
	};
	return /* @__PURE__ */ jsx(Dialog, {
		open: true,
		onOpenChange: (open) => !open ? onClose() : void 0,
		children: /* @__PURE__ */ jsxs(DialogContent, { children: [/* @__PURE__ */ jsxs(DialogHeader, { children: [/* @__PURE__ */ jsx(DialogTitle, { children: t("New task") }), /* @__PURE__ */ jsx(DialogDescription, { children: t("Cards persist on the AppSetting singleton. Pick a status; you can move it later from the card detail dialog.") })] }), /* @__PURE__ */ jsxs("form", {
			onSubmit: submit,
			className: "grid gap-3",
			children: [
				/* @__PURE__ */ jsxs("div", {
					className: "grid gap-1.5",
					children: [
						/* @__PURE__ */ jsx(Label, {
							htmlFor: "kb-title",
							children: t("Title")
						}),
						/* @__PURE__ */ jsx(Input, {
							id: "kb-title",
							value: form.data.title,
							onChange: (e) => form.setData("title", e.target.value),
							placeholder: t("Add Paddle gateway"),
							required: true,
							autoFocus: true
						}),
						form.errors.title && /* @__PURE__ */ jsx("p", {
							className: "text-xs text-destructive",
							children: form.errors.title
						})
					]
				}),
				/* @__PURE__ */ jsxs("div", {
					className: "grid gap-1.5",
					children: [/* @__PURE__ */ jsx(Label, {
						htmlFor: "kb-body",
						children: t("Notes (optional)")
					}), /* @__PURE__ */ jsx("textarea", {
						id: "kb-body",
						value: form.data.body,
						onChange: (e) => form.setData("body", e.target.value),
						rows: 4,
						className: "rounded-md border bg-background p-2 text-sm",
						placeholder: t("Why this matters, links, design constraints…")
					})]
				}),
				/* @__PURE__ */ jsxs("div", {
					className: "grid gap-1.5 sm:grid-cols-2",
					children: [/* @__PURE__ */ jsxs("div", {
						className: "grid gap-1.5",
						children: [/* @__PURE__ */ jsx(Label, {
							htmlFor: "kb-status",
							children: t("Column")
						}), /* @__PURE__ */ jsx("select", {
							id: "kb-status",
							value: form.data.status,
							onChange: (e) => form.setData("status", e.target.value),
							className: "h-9 rounded-md border bg-background px-3 text-sm",
							children: statuses.map((s) => /* @__PURE__ */ jsx("option", {
								value: s,
								children: statusLabels[s]
							}, s))
						})]
					}), /* @__PURE__ */ jsxs("div", {
						className: "grid gap-1.5",
						children: [
							/* @__PURE__ */ jsx(Label, {
								htmlFor: "kb-labels",
								children: t("Labels")
							}),
							/* @__PURE__ */ jsx(Input, {
								id: "kb-labels",
								value: form.data.labels,
								onChange: (e) => form.setData("labels", e.target.value),
								placeholder: t("bug, frontend")
							}),
							/* @__PURE__ */ jsx("p", {
								className: "text-[11px] text-muted-foreground",
								children: t("Comma-separated. Up to 8.")
							})
						]
					})]
				}),
				/* @__PURE__ */ jsxs(DialogFooter, {
					className: "mt-2",
					children: [/* @__PURE__ */ jsx(Button, {
						type: "button",
						variant: "ghost",
						onClick: onClose,
						children: t("Cancel")
					}), /* @__PURE__ */ jsx(Button, {
						type: "submit",
						disabled: form.processing,
						children: form.processing ? t("Saving…") : t("Add task")
					})]
				})
			]
		})] })
	});
}
function EditTaskDialog({ task, statuses, statusLabels, onClose }) {
	const { t } = useT();
	const confirm = useConfirm();
	const form = useForm({
		title: task.title,
		body: task.body ?? "",
		status: task.status,
		labels: task.labels.join(", ")
	});
	const submit = (e) => {
		e.preventDefault();
		form.transform((data) => ({
			...data,
			labels: data.labels.split(",").map((s) => s.trim()).filter(Boolean)
		}));
		form.patch(`/admin/board/${task.id}`, {
			preserveScroll: true,
			onSuccess: () => onClose()
		});
	};
	const archive = async () => {
		if (!await confirm({
			title: t("Archive task?"),
			message: t("Archive \":title\"? This cannot be undone.", { title: task.title }),
			confirmLabel: t("Archive"),
			danger: true
		})) return;
		router.delete(`/admin/board/${task.id}`, {
			preserveScroll: true,
			onSuccess: () => onClose()
		});
	};
	return /* @__PURE__ */ jsx(Dialog, {
		open: true,
		onOpenChange: (open) => !open ? onClose() : void 0,
		children: /* @__PURE__ */ jsxs(DialogContent, { children: [/* @__PURE__ */ jsxs(DialogHeader, { children: [/* @__PURE__ */ jsxs(DialogTitle, { children: [/* @__PURE__ */ jsxs("span", {
			className: "me-2 rounded bg-muted px-2 py-0.5 font-mono text-xs font-semibold text-muted-foreground",
			children: ["#", task.number]
		}), t("Edit task")] }), /* @__PURE__ */ jsx(DialogDescription, { children: t("Move between columns by changing the status dropdown.") })] }), /* @__PURE__ */ jsxs("form", {
			onSubmit: submit,
			className: "grid gap-3",
			children: [
				/* @__PURE__ */ jsxs("div", {
					className: "grid gap-1.5",
					children: [/* @__PURE__ */ jsx(Label, {
						htmlFor: "kb-edit-title",
						children: t("Title")
					}), /* @__PURE__ */ jsx(Input, {
						id: "kb-edit-title",
						value: form.data.title,
						onChange: (e) => form.setData("title", e.target.value),
						required: true
					})]
				}),
				/* @__PURE__ */ jsxs("div", {
					className: "grid gap-1.5",
					children: [/* @__PURE__ */ jsx(Label, {
						htmlFor: "kb-edit-body",
						children: t("Notes")
					}), /* @__PURE__ */ jsx("textarea", {
						id: "kb-edit-body",
						value: form.data.body,
						onChange: (e) => form.setData("body", e.target.value),
						rows: 5,
						className: "rounded-md border bg-background p-2 text-sm"
					})]
				}),
				/* @__PURE__ */ jsxs("div", {
					className: "grid gap-1.5 sm:grid-cols-2",
					children: [/* @__PURE__ */ jsxs("div", {
						className: "grid gap-1.5",
						children: [/* @__PURE__ */ jsx(Label, {
							htmlFor: "kb-edit-status",
							children: t("Column")
						}), /* @__PURE__ */ jsx("select", {
							id: "kb-edit-status",
							value: form.data.status,
							onChange: (e) => form.setData("status", e.target.value),
							className: "h-9 rounded-md border bg-background px-3 text-sm",
							children: statuses.map((s) => /* @__PURE__ */ jsx("option", {
								value: s,
								children: statusLabels[s]
							}, s))
						})]
					}), /* @__PURE__ */ jsxs("div", {
						className: "grid gap-1.5",
						children: [/* @__PURE__ */ jsx(Label, {
							htmlFor: "kb-edit-labels",
							children: t("Labels")
						}), /* @__PURE__ */ jsx(Input, {
							id: "kb-edit-labels",
							value: form.data.labels,
							onChange: (e) => form.setData("labels", e.target.value)
						})]
					})]
				}),
				/* @__PURE__ */ jsxs(DialogFooter, {
					className: "mt-2 gap-2 sm:justify-between",
					children: [/* @__PURE__ */ jsxs(Button, {
						type: "button",
						variant: "ghost",
						onClick: archive,
						className: "text-destructive",
						children: [
							/* @__PURE__ */ jsx(Trash2, { className: "me-1 size-4" }),
							" ",
							t("Archive")
						]
					}), /* @__PURE__ */ jsxs("div", {
						className: "flex gap-2",
						children: [/* @__PURE__ */ jsxs(Button, {
							type: "button",
							variant: "ghost",
							onClick: onClose,
							children: [
								/* @__PURE__ */ jsx(X, { className: "me-1 size-4" }),
								" ",
								t("Cancel")
							]
						}), /* @__PURE__ */ jsx(Button, {
							type: "submit",
							disabled: form.processing,
							children: form.processing ? t("Saving…") : t("Save")
						})]
					})]
				})
			]
		})] })
	});
}
//#endregion
//#region resources/js/pages/admin/changelog/changelog-form.tsx
var changelog_form_exports = /* @__PURE__ */ __exportAll({ ChangelogForm: () => ChangelogForm });
function ChangelogForm({ initial, method, action, submitLabel, versionLocked = false }) {
	const { t } = useT();
	const form = useForm(initial);
	const submit = (e) => {
		e.preventDefault();
		form.submit(method, action, { preserveScroll: true });
	};
	return /* @__PURE__ */ jsxs("form", {
		onSubmit: submit,
		className: "grid gap-4",
		children: [
			/* @__PURE__ */ jsxs(Card, {
				className: "p-4",
				children: [
					/* @__PURE__ */ jsx("h2", {
						className: "font-semibold",
						children: t("Headline")
					}),
					/* @__PURE__ */ jsx("p", {
						className: "mb-4 text-xs text-muted-foreground",
						children: t("The version + title shown on the public /changelog page. Use semver (v1.4.0). Once published, the version is immutable so old buyer links keep resolving.")
					}),
					/* @__PURE__ */ jsxs("div", {
						className: "grid gap-4 md:grid-cols-2",
						children: [
							/* @__PURE__ */ jsxs("div", {
								className: "grid gap-1.5",
								children: [
									/* @__PURE__ */ jsx(Label, {
										htmlFor: "cl-version",
										children: t("Version")
									}),
									/* @__PURE__ */ jsx(Input, {
										id: "cl-version",
										value: form.data.version,
										onChange: (e) => form.setData("version", e.target.value),
										placeholder: "v1.4.0",
										disabled: versionLocked,
										required: true
									}),
									versionLocked && /* @__PURE__ */ jsx("p", {
										className: "text-[11px] text-muted-foreground",
										children: t("Locked — this entry is published. Archive it first if you need a new version.")
									}),
									form.errors.version && /* @__PURE__ */ jsx("p", {
										className: "text-xs text-destructive",
										children: form.errors.version
									})
								]
							}),
							/* @__PURE__ */ jsxs("div", {
								className: "grid gap-1.5",
								children: [
									/* @__PURE__ */ jsx(Label, {
										htmlFor: "cl-released-at",
										children: t("Released at")
									}),
									/* @__PURE__ */ jsx(Input, {
										id: "cl-released-at",
										type: "date",
										value: form.data.released_at,
										onChange: (e) => form.setData("released_at", e.target.value)
									}),
									/* @__PURE__ */ jsx("p", {
										className: "text-[11px] text-muted-foreground",
										children: t("Leave blank to use today on publish.")
									})
								]
							}),
							/* @__PURE__ */ jsxs("div", {
								className: "grid gap-1.5 md:col-span-2",
								children: [/* @__PURE__ */ jsx(Label, {
									htmlFor: "cl-title",
									children: t("Title")
								}), /* @__PURE__ */ jsx(Input, {
									id: "cl-title",
									value: form.data.title,
									onChange: (e) => form.setData("title", e.target.value),
									placeholder: t("Workflow visual editor + Phase 2 step types"),
									required: true
								})]
							}),
							/* @__PURE__ */ jsxs("div", {
								className: "grid gap-1.5",
								children: [/* @__PURE__ */ jsx(Label, {
									htmlFor: "cl-status",
									children: t("Status")
								}), /* @__PURE__ */ jsxs("select", {
									id: "cl-status",
									value: form.data.status,
									onChange: (e) => form.setData("status", e.target.value),
									className: "h-9 rounded-md border bg-background px-3 text-sm",
									children: [
										/* @__PURE__ */ jsx("option", {
											value: "draft",
											children: t("Draft (hidden)")
										}),
										/* @__PURE__ */ jsx("option", {
											value: "published",
											children: t("Published")
										}),
										/* @__PURE__ */ jsx("option", {
											value: "archived",
											children: t("Archived")
										})
									]
								})]
							})
						]
					})
				]
			}),
			/* @__PURE__ */ jsxs(Card, {
				className: "p-4",
				children: [
					/* @__PURE__ */ jsx("h2", {
						className: "font-semibold",
						children: t("Body (markdown)")
					}),
					/* @__PURE__ */ jsxs("p", {
						className: "mb-4 text-xs text-muted-foreground",
						children: [
							t("Follow the"),
							" ",
							/* @__PURE__ */ jsx("a", {
								className: "underline",
								href: "https://keepachangelog.com/",
								target: "_blank",
								rel: "noreferrer",
								children: t("Keep a Changelog")
							}),
							" ",
							t("convention — sections under"),
							" ",
							/* @__PURE__ */ jsx("code", { children: "## Added" }),
							" /",
							" ",
							/* @__PURE__ */ jsx("code", { children: "## Changed" }),
							" / ",
							/* @__PURE__ */ jsx("code", { children: "## Fixed" }),
							" /",
							" ",
							/* @__PURE__ */ jsx("code", { children: "## Removed" }),
							" / ",
							/* @__PURE__ */ jsx("code", { children: "## Security" }),
							"."
						]
					}),
					/* @__PURE__ */ jsx("textarea", {
						id: "cl-body",
						value: form.data.body,
						onChange: (e) => form.setData("body", e.target.value),
						rows: 16,
						className: "rounded-md border bg-background p-2 font-mono text-sm",
						required: true,
						placeholder: [
							"## Added",
							"- React Flow visual editor for workflows.",
							"",
							"## Changed",
							"- Workflow trigger now supports any/all/exact match modes.",
							"",
							"## Fixed",
							"- Mobile homepage hero overflow on viewports under 480px."
						].join("\n")
					}),
					form.errors.body && /* @__PURE__ */ jsx("p", {
						className: "mt-1 text-xs text-destructive",
						children: form.errors.body
					})
				]
			}),
			/* @__PURE__ */ jsxs("div", {
				className: "flex items-center justify-end gap-2",
				children: [/* @__PURE__ */ jsx(Button, {
					asChild: true,
					type: "button",
					variant: "ghost",
					children: /* @__PURE__ */ jsx(Link, {
						href: index$22(),
						children: t("Cancel")
					})
				}), /* @__PURE__ */ jsx(Button, {
					type: "submit",
					disabled: form.processing,
					children: form.processing ? t("Saving…") : submitLabel
				})]
			})
		]
	});
}
//#endregion
//#region resources/js/pages/admin/changelog/create.tsx
var create_exports$4 = /* @__PURE__ */ __exportAll({ default: () => CreateChangelog });
function CreateChangelog() {
	const { t } = useT();
	return /* @__PURE__ */ jsxs(AdminLayout, {
		breadcrumbs: [
			{
				title: t("Admin"),
				href: "/admin"
			},
			{
				title: t("Changelog"),
				href: "/admin/changelog"
			},
			{
				title: t("New"),
				href: "/admin/changelog/create"
			}
		],
		children: [/* @__PURE__ */ jsx(Head, { title: t("New changelog entry") }), /* @__PURE__ */ jsxs("div", {
			className: "flex flex-1 flex-col gap-4 p-4",
			children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("h1", {
				className: "text-2xl font-semibold tracking-tight",
				children: t("New entry")
			}), /* @__PURE__ */ jsx("p", {
				className: "mt-1 text-sm text-muted-foreground",
				children: t("Save as Draft to keep iterating, or Published to push it to /changelog right away.")
			})] }), /* @__PURE__ */ jsx(ChangelogForm, {
				initial: {
					version: "",
					released_at: "",
					status: "draft",
					title: "",
					body: ""
				},
				method: "post",
				action: "/admin/changelog",
				submitLabel: t("Create entry")
			})]
		})]
	});
}
//#endregion
//#region resources/js/pages/admin/changelog/edit.tsx
var edit_exports$4 = /* @__PURE__ */ __exportAll({ default: () => EditChangelog });
function EditChangelog({ entry }) {
	const { t } = useT();
	return /* @__PURE__ */ jsxs(AdminLayout, {
		breadcrumbs: [
			{
				title: t("Admin"),
				href: "/admin"
			},
			{
				title: t("Changelog"),
				href: "/admin/changelog"
			},
			{
				title: entry.version,
				href: `/admin/changelog/${entry.id}/edit`
			}
		],
		children: [/* @__PURE__ */ jsx(Head, { title: t("Edit :version", { version: entry.version }) }), /* @__PURE__ */ jsxs("div", {
			className: "flex flex-1 flex-col gap-4 p-4",
			children: [/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs("h1", {
				className: "text-2xl font-semibold tracking-tight",
				children: [
					t("Edit"),
					" ",
					/* @__PURE__ */ jsx("span", {
						className: "font-mono",
						children: entry.version
					})
				]
			}) }), /* @__PURE__ */ jsx(ChangelogForm, {
				initial: {
					version: entry.version,
					released_at: entry.released_at ? entry.released_at.slice(0, 10) : "",
					status: entry.status,
					title: entry.title,
					body: entry.body
				},
				method: "patch",
				action: `/admin/changelog/${entry.id}`,
				submitLabel: t("Save entry"),
				versionLocked: entry.status === "published"
			})]
		})]
	});
}
//#endregion
//#region resources/js/components/ui/badge.tsx
var badgeVariants = cva("inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden", {
	variants: { variant: {
		default: "border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",
		secondary: "border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",
		destructive: "border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
		outline: "text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"
	} },
	defaultVariants: { variant: "default" }
});
function Badge({ className, variant, asChild = false, ...props }) {
	return /* @__PURE__ */ jsx(asChild ? Slot : "span", {
		"data-slot": "badge",
		className: cn(badgeVariants({ variant }), className),
		...props
	});
}
//#endregion
//#region resources/js/pages/admin/changelog/index.tsx
var changelog_exports$3 = /* @__PURE__ */ __exportAll({ default: () => AdminChangelogIndex });
var statusTone = {
	draft: "bg-amber-50 text-amber-800 border-amber-200",
	published: "bg-emerald-50 text-emerald-800 border-emerald-200",
	archived: "bg-slate-100 text-slate-600 border-slate-200"
};
function AdminChangelogIndex({ entries }) {
	const { t } = useT();
	const confirm = useConfirm();
	const breadcrumbs = [{
		title: t("Admin"),
		href: "/admin"
	}, {
		title: t("Changelog"),
		href: "/admin/changelog"
	}];
	const statusLabel = {
		draft: t("draft"),
		published: t("published"),
		archived: t("archived")
	};
	return /* @__PURE__ */ jsxs(AdminLayout, {
		breadcrumbs,
		children: [/* @__PURE__ */ jsx(Head, { title: t("Changelog · Admin") }), /* @__PURE__ */ jsxs("div", {
			className: "flex flex-1 flex-col gap-4 p-4",
			children: [/* @__PURE__ */ jsxs("header", {
				className: "flex items-start justify-between gap-3",
				children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("h1", {
					className: "text-2xl font-semibold tracking-tight",
					children: t("Changelog")
				}), /* @__PURE__ */ jsxs("p", {
					className: "mt-1 max-w-2xl text-sm text-muted-foreground",
					children: [
						t("Authoring surface for the public"),
						" ",
						/* @__PURE__ */ jsx("a", {
							className: "font-medium text-foreground underline-offset-2 hover:underline",
							href: "/changelog",
							children: "/changelog"
						}),
						" ",
						t("page. Drafts stay invisible to buyers; once published, the entry's version becomes immutable.")
					]
				})] }), /* @__PURE__ */ jsx(Button, {
					asChild: true,
					children: /* @__PURE__ */ jsxs(Link, {
						href: create$2(),
						children: [
							/* @__PURE__ */ jsx(Plus, { className: "me-1 size-4" }),
							" ",
							t("New entry")
						]
					})
				})]
			}), entries.length === 0 ? /* @__PURE__ */ jsx(Card, {
				className: "p-8 text-center text-sm text-muted-foreground",
				children: t("No changelog entries yet. Click \"New entry\" to write the first one.")
			}) : /* @__PURE__ */ jsx("div", {
				className: "grid gap-3",
				children: entries.map((entry) => /* @__PURE__ */ jsx(Card, { children: /* @__PURE__ */ jsxs(CardContent, {
					className: "flex flex-wrap items-start justify-between gap-3 p-4",
					children: [/* @__PURE__ */ jsxs("div", {
						className: "min-w-0 flex-1",
						children: [/* @__PURE__ */ jsxs("div", {
							className: "flex items-center gap-2",
							children: [
								/* @__PURE__ */ jsx(Link, {
									href: edit$8(entry.id).url,
									className: "font-mono text-base font-semibold hover:underline",
									children: entry.version
								}),
								/* @__PURE__ */ jsx(Badge, {
									className: "border " + statusTone[entry.status],
									children: statusLabel[entry.status]
								}),
								entry.released_at && /* @__PURE__ */ jsx("span", {
									className: "text-xs text-muted-foreground",
									children: new Date(entry.released_at).toLocaleDateString()
								})
							]
						}), /* @__PURE__ */ jsx("p", {
							className: "mt-1 line-clamp-2 text-sm font-medium",
							children: entry.title
						})]
					}), /* @__PURE__ */ jsxs("div", {
						className: "flex shrink-0 items-center gap-2",
						children: [
							entry.status === "draft" && /* @__PURE__ */ jsx(Button, {
								type: "button",
								size: "sm",
								onClick: () => router.post(publish$1(entry.id).url, {}, { preserveScroll: true }),
								children: t("Publish")
							}),
							/* @__PURE__ */ jsx(Button, {
								asChild: true,
								variant: "outline",
								size: "sm",
								children: /* @__PURE__ */ jsx(Link, {
									href: edit$8(entry.id).url,
									children: t("Edit")
								})
							}),
							entry.status !== "archived" && /* @__PURE__ */ jsx(Button, {
								type: "button",
								variant: "ghost",
								size: "sm",
								onClick: async () => {
									if (!await confirm({
										title: t("Archive entry?"),
										message: t("Archive :version? It will stay in the table for linkbacks but disappear from /changelog.", { version: entry.version }),
										confirmLabel: t("Archive"),
										danger: true
									})) return;
									router.delete(destroy$15(entry.id).url, { preserveScroll: true });
								},
								children: /* @__PURE__ */ jsx(Trash2, { className: "size-4 text-destructive" })
							})
						]
					})]
				}) }, entry.id))
			})]
		})]
	});
}
//#endregion
//#region resources/js/pages/admin/conversations/index.tsx
var conversations_exports$2 = /* @__PURE__ */ __exportAll({ default: () => AdminConversations });
var CONVERSATIONS_ONLY = [
	"conversations",
	"pagination",
	"filters"
];
function AdminConversations({ conversations, pagination, filters }) {
	const { t } = useT();
	const selection = useBulkSelection();
	const pageIds = conversations.map((c) => c.id);
	return /* @__PURE__ */ jsxs(AdminLayout, {
		breadcrumbs: [{
			title: t("Dashboard"),
			href: dashboard()
		}, {
			title: t("Conversations"),
			href: index$29()
		}],
		children: [
			/* @__PURE__ */ jsx(Head, { title: t("Conversations · Admin") }),
			/* @__PURE__ */ jsxs(AdminSurface, { children: [
				/* @__PURE__ */ jsxs(AdminSurfaceBar, { children: [
					/* @__PURE__ */ jsx("span", {
						className: "inline-flex h-7 items-center rounded-md border bg-card px-2.5 text-xs font-normal text-foreground",
						children: t("Recent conversations")
					}),
					/* @__PURE__ */ jsx("span", {
						className: "inline-flex h-7 items-center rounded-md border bg-card px-2.5 text-xs font-normal text-muted-foreground",
						children: t(":count records", { count: pagination.total.toLocaleString() })
					}),
					/* @__PURE__ */ jsx("div", {
						className: "ms-auto w-full sm:w-auto",
						children: /* @__PURE__ */ jsx(TableSearch, {
							placeholder: t("Search by URL, agent, or workspace..."),
							initialValue: filters.q,
							only: CONVERSATIONS_ONLY
						})
					})
				] }),
				/* @__PURE__ */ jsx("div", {
					className: "min-h-0 flex-1 overflow-auto",
					children: /* @__PURE__ */ jsxs("table", {
						className: "w-full min-w-[1080px] border-separate border-spacing-0 text-start text-sm",
						children: [/* @__PURE__ */ jsx("thead", {
							className: "sticky top-0 z-10 bg-card text-xs font-medium text-muted-foreground",
							children: /* @__PURE__ */ jsxs("tr", { children: [
								/* @__PURE__ */ jsx("th", {
									className: "w-9 border-b px-3 py-2",
									children: /* @__PURE__ */ jsx("input", {
										type: "checkbox",
										"aria-label": t("Select all conversations"),
										checked: selection.allOnPageSelected(pageIds),
										ref: (el) => {
											if (el) el.indeterminate = !selection.allOnPageSelected(pageIds) && selection.someOnPageSelected(pageIds);
										},
										onChange: () => selection.togglePage(pageIds),
										className: "size-3.5 cursor-pointer rounded border-input"
									})
								}),
								/* @__PURE__ */ jsx("th", {
									className: "border-e border-b px-3 py-2",
									children: t("Page")
								}),
								/* @__PURE__ */ jsx("th", {
									className: "border-e border-b px-3 py-2",
									children: t("Workspace")
								}),
								/* @__PURE__ */ jsx("th", {
									className: "border-e border-b px-3 py-2",
									children: t("Agent")
								}),
								/* @__PURE__ */ jsx("th", {
									className: "border-e border-b px-3 py-2",
									children: t("Context")
								}),
								/* @__PURE__ */ jsx("th", {
									className: "border-b px-3 py-2",
									children: t("Started")
								})
							] })
						}), /* @__PURE__ */ jsx("tbody", { children: conversations.length === 0 ? /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx("td", {
							colSpan: 6,
							className: "h-72 border-b px-4 text-center",
							children: /* @__PURE__ */ jsxs("div", {
								className: "mx-auto flex max-w-sm flex-col items-center gap-2 text-muted-foreground",
								children: [
									/* @__PURE__ */ jsx(Globe, { className: "size-8" }),
									/* @__PURE__ */ jsx("p", {
										className: "text-sm font-medium text-foreground",
										children: t("No matching conversations")
									}),
									/* @__PURE__ */ jsx("p", {
										className: "text-xs",
										children: t("No conversations match the current admin search.")
									})
								]
							})
						}) }) : conversations.map((conversation) => /* @__PURE__ */ jsxs("tr", {
							className: "group hover:bg-muted/35",
							children: [
								/* @__PURE__ */ jsx("td", {
									className: "border-b px-3 py-2",
									children: /* @__PURE__ */ jsx("input", {
										type: "checkbox",
										"aria-label": t("Select :name", { name: conversation.page_url ?? t("conversation") }),
										checked: selection.isSelected(conversation.id),
										onChange: (e) => {
											const nativeEvent = e.nativeEvent;
											selection.toggle(conversation.id, {
												shiftKey: nativeEvent?.shiftKey ?? false,
												pageIds
											});
										},
										onClick: (e) => e.stopPropagation(),
										className: "size-3.5 cursor-pointer rounded border-input"
									})
								}),
								/* @__PURE__ */ jsx("td", {
									className: "border-e border-b px-3 py-2",
									children: /* @__PURE__ */ jsxs(Link, {
										href: `/admin/conversations/${conversation.id}`,
										className: "flex min-w-0 items-center gap-2 text-foreground hover:underline hover:underline-offset-4",
										children: [/* @__PURE__ */ jsx("span", {
											className: "flex size-5 shrink-0 items-center justify-center rounded bg-muted text-muted-foreground",
											children: /* @__PURE__ */ jsx(Globe, { className: "size-3.5" })
										}), /* @__PURE__ */ jsxs("div", {
											className: "min-w-0",
											children: [/* @__PURE__ */ jsx("p", {
												className: "truncate font-medium",
												children: conversation.is_playground ? t("Playground session") : conversation.page_url ?? t("Unknown page")
											}), /* @__PURE__ */ jsx("p", {
												className: "truncate text-xs text-muted-foreground",
												children: conversation.lang?.toUpperCase() ?? t("No locale")
											})]
										})]
									})
								}),
								/* @__PURE__ */ jsx("td", {
									className: "border-e border-b px-3 py-2",
									children: conversation.workspace ? /* @__PURE__ */ jsx(Link, {
										href: show$8(conversation.workspace.id),
										className: "truncate font-medium text-foreground hover:text-primary",
										children: conversation.workspace.name
									}) : /* @__PURE__ */ jsx("span", {
										className: "text-muted-foreground",
										children: "—"
									})
								}),
								/* @__PURE__ */ jsx("td", {
									className: "border-e border-b px-3 py-2 text-muted-foreground",
									children: conversation.agent?.name ?? "—"
								}),
								/* @__PURE__ */ jsx("td", {
									className: "border-e border-b px-3 py-2 text-muted-foreground",
									children: /* @__PURE__ */ jsxs("div", {
										className: "space-y-1",
										children: [/* @__PURE__ */ jsxs("p", {
											className: "inline-flex items-center gap-1.5",
											children: [/* @__PURE__ */ jsx(MessageSquare, { className: "size-3.5" }), conversation.message_count === 1 ? t(":count message", { count: conversation.message_count.toLocaleString() }) : t(":count messages", { count: conversation.message_count.toLocaleString() })]
										}), /* @__PURE__ */ jsx("p", {
											className: "text-xs",
											children: conversation.is_lead ? t("Converted to lead") : t("No lead captured")
										})]
									})
								}),
								/* @__PURE__ */ jsx("td", {
									className: "border-b px-3 py-2 text-muted-foreground",
									children: relativeTime$8(conversation.started_at, "—")
								})
							]
						}, conversation.id)) })]
					})
				}),
				/* @__PURE__ */ jsx(TablePagination, {
					pagination,
					only: CONVERSATIONS_ONLY
				})
			] }),
			/* @__PURE__ */ jsx(BulkActionsBar, {
				count: selection.size,
				onClear: selection.clear,
				noun: t("conversation"),
				children: /* @__PURE__ */ jsx(BulkDeleteButton, {
					confirmMessage: t("Delete :count selected conversation(s) and their messages? Cannot be undone.", { count: selection.size }),
					onConfirm: () => {
						router.post("/admin/conversations/bulk-destroy", { ids: Array.from(selection.selected) }, {
							preserveScroll: true,
							onSuccess: () => selection.clear()
						});
					}
				})
			})
		]
	});
}
//#endregion
//#region resources/js/pages/admin/conversations/show.tsx
var show_exports$5 = /* @__PURE__ */ __exportAll({ default: () => AdminConversationShow });
var ROLE_STYLES = {
	user: "border-sky-200 bg-sky-50 text-sky-700 dark:border-sky-500/30 dark:bg-sky-500/10 dark:text-sky-300",
	assistant: "border-violet-200 bg-violet-50 text-violet-700 dark:border-violet-500/30 dark:bg-violet-500/10 dark:text-violet-300",
	system: "border-border bg-muted text-muted-foreground"
};
var KIND_STYLES = {
	llm: "border-violet-200 bg-violet-50 text-violet-700 dark:border-violet-500/30 dark:bg-violet-500/10 dark:text-violet-300",
	error: "border-red-200 bg-red-50 text-red-700 dark:border-red-500/30 dark:bg-red-500/10 dark:text-red-300",
	curated: "border-emerald-200 bg-emerald-50 text-emerald-700 dark:border-emerald-500/30 dark:bg-emerald-500/10 dark:text-emerald-300",
	human_shortcut: "border-amber-200 bg-amber-50 text-amber-700 dark:border-amber-500/30 dark:bg-amber-500/10 dark:text-amber-300",
	human_pending: "border-amber-200 bg-amber-50 text-amber-700 dark:border-amber-500/30 dark:bg-amber-500/10 dark:text-amber-300",
	takeover: "border-amber-200 bg-amber-50 text-amber-700 dark:border-amber-500/30 dark:bg-amber-500/10 dark:text-amber-300",
	workflow: "border-sky-200 bg-sky-50 text-sky-700 dark:border-sky-500/30 dark:bg-sky-500/10 dark:text-sky-300"
};
function Row$1({ label, children }) {
	return /* @__PURE__ */ jsxs("div", {
		className: "flex gap-2 text-xs",
		children: [/* @__PURE__ */ jsx("span", {
			className: "w-24 shrink-0 font-semibold text-muted-foreground",
			children: label
		}), /* @__PURE__ */ jsx("span", {
			className: "min-w-0 flex-1 break-words",
			children
		})]
	});
}
function TraceDetail({ trace }) {
	const { t } = useT();
	const p = trace.payload;
	return /* @__PURE__ */ jsxs("div", {
		className: "flex flex-col gap-2 rounded-md border bg-muted/30 p-3",
		children: [
			p.note && /* @__PURE__ */ jsx("p", {
				className: "text-xs text-muted-foreground italic",
				children: p.note
			}),
			p.error && /* @__PURE__ */ jsx(Row$1, {
				label: t("Error"),
				children: /* @__PURE__ */ jsxs("span", {
					className: "font-mono text-red-600 dark:text-red-400",
					children: [
						p.error.code,
						p.error.exception ? ` · ${p.error.exception}` : "",
						" — ",
						p.error.message
					]
				})
			}),
			p.route && /* @__PURE__ */ jsx(Row$1, {
				label: t("Route"),
				children: /* @__PURE__ */ jsxs("span", {
					className: "font-mono",
					children: [
						p.route.route,
						" (",
						p.route.reason,
						p.route.score != null ? ` · score ${p.route.score.toFixed(3)}` : "",
						")",
						p.route.matched_tools.length > 0 && ` → ${p.route.matched_tools.join(", ")}`
					]
				})
			}),
			p.history_count !== void 0 && /* @__PURE__ */ jsxs(Row$1, {
				label: t("History"),
				children: [
					p.history_count,
					" ",
					t("prior messages in the LLM context")
				]
			}),
			p.retrieval && /* @__PURE__ */ jsx(Row$1, {
				label: t("Retrieval"),
				children: /* @__PURE__ */ jsxs("span", { children: [
					p.retrieval.cache_hit ? t("cache hit") : t("cache miss"),
					p.retrieval.rerank_skipped && ` · ${t("rerank skipped")}`,
					p.low_confidence && /* @__PURE__ */ jsxs("span", {
						className: "text-amber-600 dark:text-amber-400",
						children: [
							" ",
							"· ",
							t("LOW CONFIDENCE")
						]
					}),
					p.confidence !== void 0 && ` · ${t("confidence")} ${p.confidence}`,
					/* @__PURE__ */ jsx("span", {
						className: "mt-1 block",
						children: p.retrieval.chunks.length === 0 ? /* @__PURE__ */ jsx("span", {
							className: "text-amber-600 dark:text-amber-400",
							children: t("0 chunks passed the threshold")
						}) : p.retrieval.chunks.map((c, i) => /* @__PURE__ */ jsxs("span", {
							className: "block font-mono text-[11px]",
							children: [
								c.score.toFixed(3),
								c.rerank_score != null && `/${c.rerank_score.toFixed(3)}`,
								" ",
								c.url ?? "—",
								" · “",
								c.snippet,
								"…”"
							]
						}, i))
					})
				] })
			}),
			p.tool_loop !== void 0 && /* @__PURE__ */ jsx(Row$1, {
				label: t("Tool loop"),
				children: p.tool_loop === null ? /* @__PURE__ */ jsx("span", {
					className: "text-muted-foreground",
					children: t("skipped (fast router: knowledge route)")
				}) : p.tool_loop.length === 0 ? /* @__PURE__ */ jsx("span", {
					className: "text-muted-foreground",
					children: t("ran, no hops recorded")
				}) : /* @__PURE__ */ jsx("span", {
					className: "flex flex-col gap-1",
					children: p.tool_loop.map((hop) => /* @__PURE__ */ jsxs("span", {
						className: "font-mono text-[11px]",
						children: [
							t("hop"),
							" ",
							hop.hop,
							": ",
							hop.outcome,
							(hop.dropped_duplicates?.length ?? 0) > 0 && ` (${t("dropped duplicates")}: ${hop.dropped_duplicates.join(", ")})`,
							hop.calls.map((c, i) => /* @__PURE__ */ jsxs("span", {
								className: "block ps-4",
								children: [
									"→ ",
									c.name,
									"(",
									JSON.stringify(c.args),
									")",
									c.error ? /* @__PURE__ */ jsxs("span", {
										className: "text-red-600 dark:text-red-400",
										children: [
											" ",
											"✗ ",
											c.error
										]
									}) : /* @__PURE__ */ jsxs("span", {
										className: "text-emerald-700 dark:text-emerald-400",
										children: [
											" ",
											"⇒ ",
											c.result
										]
									})
								]
							}, i))
						]
					}, hop.hop))
				})
			}),
			(p.blocks?.length ?? 0) > 0 && /* @__PURE__ */ jsx(Row$1, {
				label: t("Blocks"),
				children: p.blocks.join(", ")
			}),
			p.partial_text && /* @__PURE__ */ jsx(Row$1, {
				label: t("Partial text"),
				children: /* @__PURE__ */ jsx("span", {
					className: "font-mono",
					children: p.partial_text
				})
			}),
			(p.latency_ms !== void 0 || p.model) && /* @__PURE__ */ jsxs(Row$1, {
				label: t("Turn"),
				children: [
					p.latency_ms !== void 0 && `${p.latency_ms}ms`,
					p.tokens_out !== void 0 && ` · ~${p.tokens_out} ${t("tokens")}`,
					p.lead_prompt && ` · ${t("lead form offered")}`,
					(p.ctas ?? 0) > 0 && ` · ${p.ctas} CTA`,
					p.model && /* @__PURE__ */ jsxs("span", {
						className: "font-mono",
						children: [" · ", p.model]
					})
				]
			})
		]
	});
}
function TraceCard({ trace }) {
	const [open, setOpen] = useState(trace.kind === "error");
	const p = trace.payload;
	return /* @__PURE__ */ jsxs("div", {
		className: `rounded-md border text-sm ${KIND_STYLES[trace.kind] ?? KIND_STYLES.llm}`,
		children: [/* @__PURE__ */ jsxs("button", {
			type: "button",
			onClick: () => setOpen((v) => !v),
			className: "flex w-full items-center gap-2 p-2 text-start",
			children: [
				open ? /* @__PURE__ */ jsx(ChevronDown, { className: "size-3.5 shrink-0" }) : /* @__PURE__ */ jsx(ChevronRight, { className: "size-3.5 shrink-0" }),
				/* @__PURE__ */ jsx(Bug, { className: "size-3.5 shrink-0" }),
				/* @__PURE__ */ jsx("span", {
					className: "text-[11px] font-semibold tracking-wider uppercase",
					children: trace.kind
				}),
				/* @__PURE__ */ jsx("span", {
					className: "min-w-0 flex-1 truncate text-xs opacity-80",
					children: p.user_message ?? ""
				}),
				trace.created_at && /* @__PURE__ */ jsx("span", {
					className: "shrink-0 text-[10px] opacity-60",
					children: new Date(trace.created_at).toLocaleTimeString()
				})
			]
		}), open && /* @__PURE__ */ jsx("div", {
			className: "px-2 pb-2 text-foreground",
			children: /* @__PURE__ */ jsx(TraceDetail, { trace })
		})]
	});
}
function AdminConversationShow({ conversation, traces }) {
	const { t } = useT();
	const traceByMessage = /* @__PURE__ */ new Map();
	const orphanTraces = [];
	for (const tr of traces) if (tr.message_id !== null && conversation.messages.some((m) => m.id === tr.message_id)) {
		const list = traceByMessage.get(tr.message_id) ?? [];
		list.push(tr);
		traceByMessage.set(tr.message_id, list);
	} else orphanTraces.push(tr);
	return /* @__PURE__ */ jsxs(AdminLayout, {
		breadcrumbs: [
			{
				title: t("Admin"),
				href: "/admin"
			},
			{
				title: t("Conversations"),
				href: "/admin/conversations"
			},
			{
				title: conversation.id.slice(0, 8),
				href: `/admin/conversations/${conversation.id}`
			}
		],
		children: [/* @__PURE__ */ jsx(Head, { title: t("Conversation · Admin") }), /* @__PURE__ */ jsxs(AdminSurface, { children: [/* @__PURE__ */ jsx(AdminSurfaceBar, { children: /* @__PURE__ */ jsxs(Link, {
			href: "/admin/conversations",
			className: "inline-flex items-center gap-1 text-sm text-muted-foreground hover:text-foreground",
			children: [/* @__PURE__ */ jsx(ArrowLeft, { className: "size-4" }), t("Back to conversations")]
		}) }), /* @__PURE__ */ jsxs("div", {
			className: "grid gap-4 p-4 md:grid-cols-[1fr_280px]",
			children: [/* @__PURE__ */ jsxs(Card, {
				className: "p-0",
				children: [/* @__PURE__ */ jsxs("div", {
					className: "flex flex-col gap-3 border-b p-4",
					children: [/* @__PURE__ */ jsxs("div", {
						className: "flex items-center gap-2",
						children: [
							/* @__PURE__ */ jsx(MessageSquare, { className: "size-4 text-muted-foreground" }),
							/* @__PURE__ */ jsx("h1", {
								className: "text-base font-semibold",
								children: conversation.agent?.name ?? t("Conversation")
							}),
							conversation.is_playground && /* @__PURE__ */ jsx(Badge, {
								variant: "outline",
								className: "border-amber-200 bg-amber-50 text-amber-700 dark:border-amber-500/30 dark:bg-amber-500/10 dark:text-amber-300",
								children: t("Playground")
							}),
							conversation.is_lead && /* @__PURE__ */ jsx(Badge, {
								variant: "outline",
								className: "border-emerald-200 bg-emerald-50 text-emerald-700 dark:border-emerald-500/30 dark:bg-emerald-500/10 dark:text-emerald-300",
								children: t("Lead captured")
							}),
							traces.length > 0 && /* @__PURE__ */ jsxs(Badge, {
								variant: "outline",
								className: "border-violet-200 bg-violet-50 text-violet-700 dark:border-violet-500/30 dark:bg-violet-500/10 dark:text-violet-300",
								children: [
									/* @__PURE__ */ jsx(Bug, { className: "me-1 size-3" }),
									traces.length,
									" ",
									t("traces")
								]
							})
						]
					}), conversation.page_url && /* @__PURE__ */ jsx("p", {
						className: "font-mono text-xs break-all text-muted-foreground",
						children: conversation.page_url
					})]
				}), /* @__PURE__ */ jsx("div", {
					className: "flex flex-col gap-3 p-4",
					children: conversation.messages.length === 0 && orphanTraces.length === 0 ? /* @__PURE__ */ jsx("p", {
						className: "rounded-md border border-dashed bg-muted/30 p-6 text-center text-sm text-muted-foreground",
						children: t("No persisted messages for this conversation (e.g. playground runs intentionally skip the messages table).")
					}) : /* @__PURE__ */ jsxs(Fragment$1, { children: [conversation.messages.map((m) => /* @__PURE__ */ jsxs("div", {
						className: "flex flex-col gap-2",
						children: [/* @__PURE__ */ jsxs("div", {
							className: `rounded-md border p-3 text-sm whitespace-pre-wrap ${ROLE_STYLES[m.role] ?? ROLE_STYLES.system}`,
							children: [/* @__PURE__ */ jsxs("div", {
								className: "mb-1 text-[10px] font-semibold tracking-wider uppercase opacity-70",
								children: [m.role, m.created_at && /* @__PURE__ */ jsx("span", {
									className: "ms-2 opacity-50",
									children: new Date(m.created_at).toLocaleString()
								})]
							}), m.content ?? ""]
						}), (traceByMessage.get(m.id) ?? []).map((tr) => /* @__PURE__ */ jsx(TraceCard, { trace: tr }, tr.id))]
					}, m.id)), orphanTraces.map((tr) => /* @__PURE__ */ jsx(TraceCard, { trace: tr }, tr.id))] })
				})]
			}), /* @__PURE__ */ jsxs(Card, {
				className: "h-fit space-y-3 p-4 text-sm",
				children: [
					/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
						className: "text-[11px] font-semibold tracking-wider text-muted-foreground uppercase",
						children: t("Workspace")
					}), /* @__PURE__ */ jsx("p", {
						className: "mt-0.5 font-medium",
						children: conversation.workspace?.name ?? "—"
					})] }),
					/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
						className: "text-[11px] font-semibold tracking-wider text-muted-foreground uppercase",
						children: t("Agent")
					}), /* @__PURE__ */ jsx("p", {
						className: "mt-0.5 font-medium",
						children: conversation.agent?.name ?? "—"
					})] }),
					/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
						className: "text-[11px] font-semibold tracking-wider text-muted-foreground uppercase",
						children: t("Started")
					}), /* @__PURE__ */ jsx("p", {
						className: "mt-0.5 font-medium",
						children: conversation.started_at ? new Date(conversation.started_at).toLocaleString() : "—"
					})] }),
					/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
						className: "text-[11px] font-semibold tracking-wider text-muted-foreground uppercase",
						children: t("Language")
					}), /* @__PURE__ */ jsx("p", {
						className: "mt-0.5 font-medium uppercase",
						children: conversation.lang ?? "—"
					})] }),
					/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
						className: "text-[11px] font-semibold tracking-wider text-muted-foreground uppercase",
						children: t("Turn traces")
					}), /* @__PURE__ */ jsx("p", {
						className: "mt-0.5 text-xs text-muted-foreground",
						children: traces.length > 0 ? t("Expand a trace under any assistant reply to see the route decision, retrieved sources, tool calls, and errors for that turn.") : t("No traces recorded yet — traces capture turns made after the debugger shipped, and are pruned after the retention window.")
					})] })
				]
			})]
		})] })]
	});
}
//#endregion
//#region resources/js/components/admin/queue-health-card.tsx
function relativeTime$7(iso) {
	if (!iso) return "";
	const ms = Date.now() - new Date(iso).getTime();
	const sec = Math.max(1, Math.round(ms / 1e3));
	if (sec < 60) return "just now";
	const min = Math.round(sec / 60);
	if (min < 60) return `${min}m ago`;
	const h = Math.round(min / 60);
	if (h < 24) return `${h}h ago`;
	const d = Math.round(h / 24);
	return `${d} day${d === 1 ? "" : "s"} ago`;
}
/**
* Live queue + cron-tick health widget. Same component on the admin
* dashboard (compact, polled every 8s) and the dedicated
* /admin/queue-health page (full-width view). Defensive against the
* `health` prop being missing — renders a "loading" placeholder
* instead of throwing so a partial deploy never blanks the dashboard.
*/
function QueueHealthCard({ health, t }) {
	if (!health) return /* @__PURE__ */ jsx(Card, {
		className: "p-4 text-sm text-muted-foreground",
		children: /* @__PURE__ */ jsxs("div", {
			className: "flex items-center gap-2",
			children: [/* @__PURE__ */ jsx(Server, { className: "size-3.5" }), t("Queue health is loading…")]
		})
	});
	const liveness = health.liveness;
	const livenessTone = {
		live: {
			dot: "bg-emerald-500",
			label: t("Live — firing on schedule")
		},
		stale: {
			dot: "bg-amber-500",
			label: t("Stale — last tick > 90s ago")
		},
		dead: {
			dot: "bg-rose-500",
			label: t("Dead — no tick in last 5 minutes")
		},
		unknown: {
			dot: "bg-slate-400",
			label: t("Waiting for first tick")
		}
	}[liveness];
	const lastTickRel = relativeTime$7(health.last_tick_at);
	return /* @__PURE__ */ jsxs(Card, {
		className: "p-0",
		children: [
			/* @__PURE__ */ jsxs("div", {
				className: "flex flex-wrap items-center gap-3 border-b px-4 py-3",
				children: [
					/* @__PURE__ */ jsx("div", {
						className: "rounded-lg bg-indigo-500/10 p-1.5",
						children: /* @__PURE__ */ jsx(Server, { className: "size-3.5 text-indigo-600" })
					}),
					/* @__PURE__ */ jsx("h2", {
						className: "text-sm font-medium",
						children: t("Queue health")
					}),
					/* @__PURE__ */ jsxs("span", {
						className: "ms-auto inline-flex items-center gap-2 rounded-full border bg-background px-2.5 py-1 text-xs",
						title: livenessTone.label,
						children: [/* @__PURE__ */ jsx("span", { className: `size-2 rounded-full ${livenessTone.dot} ${liveness === "live" ? "animate-pulse" : ""}` }), /* @__PURE__ */ jsx("span", {
							className: "font-medium",
							children: livenessTone.label
						})]
					})
				]
			}),
			/* @__PURE__ */ jsxs("div", {
				className: "grid grid-cols-2 gap-3 px-4 py-3 sm:grid-cols-4",
				children: [
					/* @__PURE__ */ jsxs("div", { children: [
						/* @__PURE__ */ jsx("div", {
							className: "text-[11px] tracking-wider text-muted-foreground uppercase",
							children: t("Last tick")
						}),
						/* @__PURE__ */ jsx("div", {
							className: "mt-1 text-base font-semibold tabular-nums",
							children: lastTickRel || t("No ticks yet")
						}),
						/* @__PURE__ */ jsx("div", {
							className: "text-xs text-muted-foreground",
							children: t("Cron expected every 60s")
						})
					] }),
					/* @__PURE__ */ jsxs("div", { children: [
						/* @__PURE__ */ jsx("div", {
							className: "text-[11px] tracking-wider text-muted-foreground uppercase",
							children: t("Pending jobs")
						}),
						/* @__PURE__ */ jsx("div", {
							className: `mt-1 text-base font-semibold tabular-nums ${health.pending_jobs > 50 ? "text-amber-600" : "text-foreground"}`,
							children: health.pending_jobs.toLocaleString()
						}),
						/* @__PURE__ */ jsx("div", {
							className: "text-xs text-muted-foreground",
							children: t("Waiting to be picked up")
						})
					] }),
					/* @__PURE__ */ jsxs("div", { children: [
						/* @__PURE__ */ jsx("div", {
							className: "text-[11px] tracking-wider text-muted-foreground uppercase",
							children: t("Processed (1h)")
						}),
						/* @__PURE__ */ jsx("div", {
							className: "mt-1 text-base font-semibold tabular-nums",
							children: health.jobs_processed_last_hour.toLocaleString()
						}),
						/* @__PURE__ */ jsx("div", {
							className: "text-xs text-muted-foreground",
							children: t(":ticks ticks · expected ≈ 60", { ticks: health.ticks_last_hour })
						})
					] }),
					/* @__PURE__ */ jsxs("div", { children: [
						/* @__PURE__ */ jsx("div", {
							className: "text-[11px] tracking-wider text-muted-foreground uppercase",
							children: t("Failed jobs")
						}),
						/* @__PURE__ */ jsx("div", {
							className: `mt-1 text-base font-semibold tabular-nums ${health.failed_jobs > 0 ? "text-rose-600" : "text-foreground"}`,
							children: health.failed_jobs.toLocaleString()
						}),
						/* @__PURE__ */ jsx(Link, {
							href: failed(),
							className: "text-xs text-indigo-600 hover:underline",
							prefetch: true,
							children: t("Open failed queue →")
						})
					] })
				]
			}),
			health.recent_ticks.length > 0 ? /* @__PURE__ */ jsxs("div", {
				className: "border-t",
				children: [/* @__PURE__ */ jsxs("div", {
					className: "hidden grid-cols-[1fr_80px_80px_80px_80px] gap-3 px-4 py-2 text-[11px] tracking-wider text-muted-foreground uppercase sm:grid",
					children: [
						/* @__PURE__ */ jsx("span", { children: t("When") }),
						/* @__PURE__ */ jsx("span", {
							className: "text-end",
							children: t("Processed")
						}),
						/* @__PURE__ */ jsx("span", {
							className: "text-end",
							children: t("Failed")
						}),
						/* @__PURE__ */ jsx("span", {
							className: "text-end",
							children: t("Remaining")
						}),
						/* @__PURE__ */ jsx("span", {
							className: "text-end",
							children: t("Elapsed")
						})
					]
				}), /* @__PURE__ */ jsx("div", {
					className: "max-h-64 divide-y overflow-y-auto",
					children: health.recent_ticks.map((tick, idx) => /* @__PURE__ */ jsxs("div", {
						className: "grid gap-1 px-4 py-2 text-xs tabular-nums sm:grid-cols-[1fr_80px_80px_80px_80px] sm:items-center sm:gap-3",
						children: [
							/* @__PURE__ */ jsx("span", {
								className: "text-muted-foreground",
								children: relativeTime$7(tick.at) || "—"
							}),
							/* @__PURE__ */ jsx("span", {
								className: "text-end",
								children: tick.processed
							}),
							/* @__PURE__ */ jsx("span", {
								className: `text-end ${tick.failed > 0 ? "text-rose-600" : ""}`,
								children: tick.failed
							}),
							/* @__PURE__ */ jsx("span", {
								className: "text-end",
								children: tick.remaining
							}),
							/* @__PURE__ */ jsxs("span", {
								className: "text-end text-muted-foreground",
								children: [tick.ms, " ms"]
							})
						]
					}, `${tick.at ?? "unknown"}-${idx}`))
				})]
			}) : null,
			health.recent_failures.length > 0 ? /* @__PURE__ */ jsxs("div", {
				className: "border-t bg-rose-500/[0.04]",
				children: [/* @__PURE__ */ jsxs("div", {
					className: "flex items-center justify-between border-b border-rose-500/15 px-4 py-2",
					children: [/* @__PURE__ */ jsxs("div", {
						className: "flex items-center gap-2 text-xs font-medium text-rose-700 dark:text-rose-400",
						children: [/* @__PURE__ */ jsx(AlertTriangle, { className: "size-3.5" }), t("Recent failures (paste to your dev team)")]
					}), /* @__PURE__ */ jsx(Link, {
						href: failed(),
						className: "text-xs text-rose-700 hover:underline dark:text-rose-400",
						prefetch: true,
						children: t("Open full failed queue →")
					})]
				}), /* @__PURE__ */ jsx("div", {
					className: "max-h-64 divide-y divide-rose-500/10 overflow-y-auto",
					children: health.recent_failures.map((fail) => /* @__PURE__ */ jsxs("div", {
						className: "grid gap-1 px-4 py-2.5 text-xs",
						children: [
							/* @__PURE__ */ jsxs("div", {
								className: "flex items-center justify-between gap-3",
								children: [/* @__PURE__ */ jsx("span", {
									className: "truncate font-mono text-[11px] font-medium text-foreground",
									children: fail.job
								}), /* @__PURE__ */ jsx("span", {
									className: "shrink-0 text-[11px] text-muted-foreground tabular-nums",
									children: fail.failed_at ? relativeTime$7(fail.failed_at) || fail.failed_at : "—"
								})]
							}),
							/* @__PURE__ */ jsx("p", {
								className: "text-[11px] leading-5 break-words text-rose-800 dark:text-rose-300",
								title: fail.exception_first_line,
								children: fail.exception_first_line
							}),
							/* @__PURE__ */ jsxs("div", {
								className: "flex flex-wrap items-center gap-3 pt-1 text-[10px] text-muted-foreground",
								children: [
									fail.agent_name || fail.agent_id ? /* @__PURE__ */ jsxs("span", {
										className: "inline-flex items-center gap-1 rounded-full bg-sky-500/10 px-2 py-0.5 text-[10px] font-medium text-sky-700 dark:text-sky-300",
										title: fail.agent_id ?? void 0,
										children: [
											t("Agent"),
											":",
											" ",
											fail.agent_name ?? fail.agent_id
										]
									}) : null,
									/* @__PURE__ */ jsx("span", { children: t("Queue: :queue", { queue: fail.queue || "default" }) }),
									/* @__PURE__ */ jsxs("span", {
										className: "font-mono",
										children: ["uuid: ", fail.uuid.slice(0, 8)]
									})
								]
							})
						]
					}, fail.uuid))
				})]
			}) : null,
			health.recent_runs.length > 0 ? /* @__PURE__ */ jsxs("div", {
				className: "border-t",
				children: [/* @__PURE__ */ jsxs("div", {
					className: "flex items-center justify-between border-b px-4 py-2",
					children: [/* @__PURE__ */ jsxs("div", {
						className: "flex items-center gap-2 text-xs font-medium text-foreground",
						children: [/* @__PURE__ */ jsx(Activity, { className: "size-3.5 text-emerald-600" }), t("Live job feed")]
					}), /* @__PURE__ */ jsxs("div", {
						className: "flex items-center gap-3 text-[11px] text-muted-foreground",
						children: [
							/* @__PURE__ */ jsxs("span", {
								className: "inline-flex items-center gap-1",
								children: [/* @__PURE__ */ jsx("span", { className: "inline-block size-1.5 rounded-full bg-amber-500" }), t("Running")]
							}),
							/* @__PURE__ */ jsxs("span", {
								className: "inline-flex items-center gap-1",
								children: [/* @__PURE__ */ jsx("span", { className: "inline-block size-1.5 rounded-full bg-emerald-500" }), t("Done")]
							}),
							/* @__PURE__ */ jsxs("span", {
								className: "inline-flex items-center gap-1",
								children: [/* @__PURE__ */ jsx("span", { className: "inline-block size-1.5 rounded-full bg-rose-500" }), t("Failed")]
							})
						]
					})]
				}), /* @__PURE__ */ jsx("div", {
					className: "max-h-[28rem] divide-y overflow-y-auto font-mono",
					children: health.recent_runs.map((run) => /* @__PURE__ */ jsx(JobRunRow, {
						run,
						t
					}, run.uuid))
				})]
			}) : null
		]
	});
}
function JobRunRow({ run, t }) {
	const statusTone = {
		running: "text-amber-600 dark:text-amber-400",
		done: "text-emerald-600 dark:text-emerald-400",
		failed: "text-rose-600 dark:text-rose-400"
	};
	const statusLabel = {
		running: t("RUNNING"),
		done: t("DONE"),
		failed: t("FAIL")
	};
	const started = run.started_at ? new Date(run.started_at) : null;
	const startedLabel = started ? `${started.toLocaleDateString("en-CA")} ${started.toLocaleTimeString("en-GB", { hour12: false })}` : "—";
	const durationLabel = run.duration_ms === null ? "" : run.duration_ms >= 1e3 ? `${(run.duration_ms / 1e3).toFixed(0)}s` : `${run.duration_ms} ms`;
	return /* @__PURE__ */ jsxs("div", {
		className: "grid gap-1 px-4 py-1.5 text-[11px]",
		title: run.exception_first_line ?? void 0,
		children: [/* @__PURE__ */ jsxs("div", {
			className: "flex items-center gap-3",
			children: [
				/* @__PURE__ */ jsx("span", {
					className: "shrink-0 text-muted-foreground tabular-nums",
					children: startedLabel
				}),
				/* @__PURE__ */ jsx("span", {
					className: "min-w-0 flex-1 truncate text-emerald-700 dark:text-emerald-300",
					children: run.job
				}),
				run.agent_name || run.agent_id ? /* @__PURE__ */ jsx("span", {
					className: "shrink-0 rounded bg-sky-500/10 px-1.5 py-0.5 text-[10px] font-medium text-sky-700 dark:text-sky-300",
					title: run.agent_id ?? void 0,
					children: run.agent_name ?? run.agent_id
				}) : null,
				/* @__PURE__ */ jsx("span", {
					className: "shrink-0 text-muted-foreground tabular-nums",
					children: durationLabel
				}),
				/* @__PURE__ */ jsx("span", {
					className: `shrink-0 font-semibold ${statusTone[run.status]}`,
					children: statusLabel[run.status]
				})
			]
		}), run.status === "failed" && run.exception_first_line ? /* @__PURE__ */ jsx("p", {
			className: "pl-0 text-[10px] leading-4 break-words text-rose-700 dark:text-rose-400",
			children: run.exception_first_line
		}) : null]
	});
}
//#endregion
//#region resources/js/components/sparkline.tsx
/**
* Tiny inline area chart for stat-card "trend at a glance" treatments.
* Pure SVG, no chart-library dependency. Caller passes the daily series
* (already pre-computed server-side) and an accent color.
*/
function Sparkline({ values, accent, width = 96, height = 28 }) {
	if (values.length === 0) return null;
	const max = Math.max(1, ...values);
	const stepX = width / Math.max(1, values.length - 1);
	const points = values.map((v, i) => `${(i * stepX).toFixed(1)},${(height - v / max * height).toFixed(1)}`).join(" ");
	const areaPoints = `0,${height} ${points} ${width},${height}`;
	return /* @__PURE__ */ jsxs("svg", {
		viewBox: `0 0 ${width} ${height}`,
		className: "h-7 w-20 shrink-0 sm:w-24",
		preserveAspectRatio: "none",
		"aria-hidden": true,
		children: [/* @__PURE__ */ jsx("polygon", {
			points: areaPoints,
			fill: accent,
			fillOpacity: "0.12"
		}), /* @__PURE__ */ jsx("polyline", {
			points,
			fill: "none",
			stroke: accent,
			strokeWidth: "1.5",
			strokeLinecap: "round",
			strokeLinejoin: "round"
		})]
	});
}
//#endregion
//#region resources/js/components/metric-card.tsx
/**
* Compute a trend object given a current and previous-period value.
* Returns `flat` when the previous value was zero (no baseline) so we
* don't render a "+infinity%" badge.
*/
function trend(current, prior) {
	if (prior === 0) return {
		dir: "flat",
		pct: 0
	};
	const pct = Math.round((current - prior) / prior * 100);
	if (pct === 0) return {
		dir: "flat",
		pct: 0
	};
	return {
		dir: pct > 0 ? "up" : "down",
		pct: Math.abs(pct)
	};
}
function MetricCard({ label, value, sub, icon, iconTone, series, accent, trendData }) {
	return /* @__PURE__ */ jsxs(Card, {
		className: "relative min-w-0 overflow-hidden p-4 sm:p-5",
		children: [
			/* @__PURE__ */ jsxs("div", {
				className: "flex items-start justify-between",
				children: [/* @__PURE__ */ jsx("div", {
					className: `rounded-lg p-2 ${iconTone}`,
					children: icon
				}), trendData && trendData.dir !== "flat" && /* @__PURE__ */ jsxs("span", {
					className: `inline-flex items-center gap-0.5 rounded-full px-2 py-0.5 text-[11px] font-medium ${trendData.dir === "up" ? "bg-emerald-500/10 text-emerald-700 dark:text-emerald-400" : "bg-rose-500/10 text-rose-700 dark:text-rose-400"}`,
					children: [
						trendData.dir === "up" ? /* @__PURE__ */ jsx(ArrowUpRight, { className: "size-3" }) : /* @__PURE__ */ jsx(ArrowDownRight, { className: "size-3" }),
						trendData.pct,
						"%"
					]
				})]
			}),
			/* @__PURE__ */ jsx("p", {
				className: "mt-3 text-xs leading-tight font-medium tracking-wider text-muted-foreground uppercase",
				children: label
			}),
			/* @__PURE__ */ jsx("p", {
				className: "mt-1 text-2xl font-semibold tracking-tight tabular-nums sm:text-3xl",
				children: value
			}),
			/* @__PURE__ */ jsxs("div", {
				className: "mt-1 flex min-w-0 flex-col gap-2 sm:flex-row sm:items-end sm:justify-between",
				children: [sub && /* @__PURE__ */ jsx("p", {
					className: "min-w-0 text-xs text-muted-foreground",
					children: sub
				}), series && accent && /* @__PURE__ */ jsx(Sparkline, {
					values: series,
					accent
				})]
			})
		]
	});
}
//#endregion
//#region resources/js/pages/admin/dashboard.tsx
var dashboard_exports$1 = /* @__PURE__ */ __exportAll({ default: () => PlatformDashboard });
var ACCENT = "#f43f5e";
function relativeTime$6(iso) {
	if (!iso) return "";
	const ms = Date.now() - new Date(iso).getTime();
	const sec = Math.max(1, Math.round(ms / 1e3));
	if (sec < 60) return "just now";
	const min = Math.round(sec / 60);
	if (min < 60) return `${min}m ago`;
	const h = Math.round(min / 60);
	if (h < 24) return `${h}h ago`;
	const d = Math.round(h / 24);
	return `${d} day${d === 1 ? "" : "s"} ago`;
}
function formatRange$2(from, to) {
	const opts = {
		month: "short",
		day: "numeric"
	};
	return `${new Date(from).toLocaleDateString("en-US", opts)} – ${new Date(to).toLocaleDateString("en-US", {
		...opts,
		year: "numeric"
	})}`;
}
function FooterMetric$2({ icon, label, value }) {
	return /* @__PURE__ */ jsxs("div", {
		className: "flex min-w-0 items-center justify-between gap-3 border-b px-4 py-2 last:border-b-0 xl:border-e xl:border-b-0 xl:last:border-e-0",
		children: [/* @__PURE__ */ jsxs("div", {
			className: "flex min-w-0 items-center gap-2 text-muted-foreground",
			children: [icon, /* @__PURE__ */ jsx("span", {
				className: "truncate text-xs",
				children: label
			})]
		}), /* @__PURE__ */ jsx("span", {
			className: "text-xs font-medium text-foreground tabular-nums",
			children: value
		})]
	});
}
/**
* Two-series line chart (conversations + messages) with a soft area
* fill on the primary series. Pure SVG, no chart-lib dependency.
*/
function PlatformChart({ chart, accent }) {
	const w = 760;
	const h = 240;
	const padX = 24;
	const padY = 16;
	const innerW = w - padX * 2;
	const innerH = h - padY * 2;
	const allValues = [...chart.conversations, ...chart.messages];
	const max = Math.max(1, ...allValues);
	const stepX = innerW / Math.max(1, chart.days.length - 1);
	const toPath = (values) => values.map((v, i) => `${(padX + i * stepX).toFixed(1)},${(padY + innerH - v / max * innerH).toFixed(1)}`).join(" ");
	const convPath = toPath(chart.conversations);
	const msgPath = toPath(chart.messages);
	const convArea = `${padX},${padY + innerH} ${convPath} ${padX + innerW},${padY + innerH}`;
	const ticks = [
		0,
		.25,
		.5,
		.75,
		1
	].map((t) => Math.round(max * t));
	const xLabels = [
		0,
		Math.floor(chart.days.length / 4),
		Math.floor(chart.days.length / 2),
		Math.floor(chart.days.length * 3 / 4),
		chart.days.length - 1
	].map((i) => ({
		i,
		label: chart.days[i] ? new Date(chart.days[i]).toLocaleDateString("en-US", {
			month: "short",
			day: "numeric"
		}) : ""
	})).filter((p) => p.label !== "");
	return /* @__PURE__ */ jsxs("svg", {
		viewBox: `0 0 ${w} ${h + 24}`,
		className: "h-64 w-full",
		preserveAspectRatio: "xMidYMid meet",
		"aria-hidden": true,
		children: [
			ticks.map((t, i) => {
				const y = padY + innerH - t / max * innerH;
				return /* @__PURE__ */ jsxs("g", { children: [/* @__PURE__ */ jsx("line", {
					x1: padX,
					y1: y,
					x2: padX + innerW,
					y2: y,
					stroke: "currentColor",
					strokeOpacity: .06
				}), /* @__PURE__ */ jsx("text", {
					x: padX - 6,
					y: y + 4,
					textAnchor: "end",
					fontSize: "10",
					fill: "currentColor",
					opacity: .45,
					children: t
				})] }, i);
			}),
			/* @__PURE__ */ jsx("polygon", {
				points: convArea,
				fill: accent,
				fillOpacity: .12
			}),
			/* @__PURE__ */ jsx("polyline", {
				points: convPath,
				fill: "none",
				stroke: accent,
				strokeWidth: 1.75,
				strokeLinecap: "round",
				strokeLinejoin: "round"
			}),
			/* @__PURE__ */ jsx("polyline", {
				points: msgPath,
				fill: "none",
				stroke: accent,
				strokeOpacity: .5,
				strokeWidth: 1.5,
				strokeDasharray: "4 4",
				strokeLinecap: "round",
				strokeLinejoin: "round"
			}),
			xLabels.map(({ i, label }) => /* @__PURE__ */ jsx("text", {
				x: padX + i * stepX,
				y: h + 16,
				textAnchor: "middle",
				fontSize: "10",
				fill: "currentColor",
				opacity: .45,
				children: label
			}, i))
		]
	});
}
function PlatformDashboard({ window, metrics, chart, reports, right_now, recent_signups, activity, queueHealth }) {
	const { t } = useT();
	useEffect(() => {
		const id = globalThis.setInterval(() => {
			router.reload({ only: ["queueHealth"] });
		}, 8e3);
		return () => globalThis.clearInterval(id);
	}, []);
	return /* @__PURE__ */ jsxs(AdminLayout, {
		breadcrumbs: [{
			title: t("Dashboard"),
			href: dashboard()
		}],
		children: [/* @__PURE__ */ jsx(Head, { title: t("Platform admin") }), /* @__PURE__ */ jsxs("div", {
			className: "flex min-h-0 flex-1 flex-col bg-card",
			children: [/* @__PURE__ */ jsxs("div", {
				className: "flex min-h-10 flex-wrap items-center gap-2 border-b px-3 py-2 sm:py-1.5",
				children: [
					/* @__PURE__ */ jsxs("span", {
						className: "inline-flex items-center gap-2 rounded-md border bg-background px-3 py-1.5 text-xs text-muted-foreground",
						children: [/* @__PURE__ */ jsx(Filter, { className: "size-3.5" }), formatRange$2(window.from, window.to)]
					}),
					/* @__PURE__ */ jsxs("span", {
						className: "inline-flex items-center gap-2 rounded-md border border-rose-500/15 bg-rose-500/10 px-3 py-1.5 text-xs text-rose-700 dark:text-rose-300",
						children: [/* @__PURE__ */ jsx(Activity, { className: "size-3.5" }), t(":count live now", { count: right_now.active_conversations.toLocaleString() })]
					}),
					/* @__PURE__ */ jsxs("span", {
						className: "inline-flex items-center gap-2 rounded-md border bg-background px-3 py-1.5 text-xs text-muted-foreground",
						children: [/* @__PURE__ */ jsx(Sparkles, { className: "size-3.5" }), t(":count messages / 30d", { count: metrics.messages.value.toLocaleString() })]
					}),
					/* @__PURE__ */ jsxs("div", {
						className: "flex w-full flex-wrap items-center gap-2 sm:ms-auto sm:w-auto",
						children: [
							/* @__PURE__ */ jsx(Button, {
								asChild: true,
								variant: "outline",
								size: "sm",
								className: "flex-1 sm:flex-none",
								children: /* @__PURE__ */ jsxs(Link, {
									href: index$34(),
									prefetch: true,
									children: [/* @__PURE__ */ jsx(Briefcase, { className: "size-3.5" }), t("Workspaces")]
								})
							}),
							/* @__PURE__ */ jsx(Button, {
								asChild: true,
								variant: "outline",
								size: "sm",
								className: "flex-1 sm:flex-none",
								children: /* @__PURE__ */ jsxs(Link, {
									href: index$33(),
									prefetch: true,
									children: [/* @__PURE__ */ jsx(Users, { className: "size-3.5" }), t("Users")]
								})
							}),
							/* @__PURE__ */ jsx(Button, {
								asChild: true,
								variant: "outline",
								size: "sm",
								className: "flex-1 sm:flex-none",
								children: /* @__PURE__ */ jsxs(Link, {
									href: failed(),
									prefetch: true,
									children: [/* @__PURE__ */ jsx(AlertTriangle, { className: "size-3.5" }), t("Queue Failures")]
								})
							})
						]
					})
				]
			}), /* @__PURE__ */ jsx("div", {
				className: "min-h-0 flex-1 overflow-y-auto",
				children: /* @__PURE__ */ jsxs("div", {
					className: "space-y-4 p-4",
					children: [
						/* @__PURE__ */ jsxs("div", {
							className: "grid gap-3 sm:grid-cols-2 xl:grid-cols-6",
							children: [
								/* @__PURE__ */ jsx(MetricCard, {
									label: t("Users"),
									value: metrics.users.value.toLocaleString(),
									sub: trendSub$2(metrics.users.last_30d ?? 0, metrics.users.prior_30d, void 0, t),
									icon: /* @__PURE__ */ jsx(Users, { className: "size-4 text-sky-600" }),
									iconTone: "bg-sky-500/10",
									series: metrics.users.series,
									accent: ACCENT,
									trendData: trend(metrics.users.last_30d ?? 0, metrics.users.prior_30d)
								}),
								/* @__PURE__ */ jsx(MetricCard, {
									label: t("Workspaces"),
									value: metrics.workspaces.value.toLocaleString(),
									sub: trendSub$2(metrics.workspaces.last_30d ?? 0, metrics.workspaces.prior_30d, void 0, t),
									icon: /* @__PURE__ */ jsx(Briefcase, { className: "size-4 text-violet-600" }),
									iconTone: "bg-violet-500/10",
									series: metrics.workspaces.series,
									accent: ACCENT,
									trendData: trend(metrics.workspaces.last_30d ?? 0, metrics.workspaces.prior_30d)
								}),
								/* @__PURE__ */ jsx(MetricCard, {
									label: t("Agents"),
									value: metrics.agents.value.toLocaleString(),
									sub: t(":count published", { count: metrics.agents.published ?? 0 }),
									icon: /* @__PURE__ */ jsx(Bot, { className: "size-4 text-amber-600" }),
									iconTone: "bg-amber-500/10",
									series: metrics.agents.series,
									accent: ACCENT,
									trendData: trend(metrics.agents.last_30d ?? 0, metrics.agents.prior_30d)
								}),
								/* @__PURE__ */ jsx(MetricCard, {
									label: t("Leads"),
									value: metrics.leads.value.toLocaleString(),
									sub: t(":count in last 30 days", { count: metrics.leads.last_30d ?? 0 }),
									icon: /* @__PURE__ */ jsx(Inbox, { className: "size-4 text-emerald-600" }),
									iconTone: "bg-emerald-500/10",
									series: metrics.leads.series,
									accent: ACCENT,
									trendData: trend(metrics.leads.last_30d ?? 0, metrics.leads.prior_30d)
								}),
								/* @__PURE__ */ jsx(MetricCard, {
									label: t("Conversations (30d)"),
									value: metrics.conversations.value.toLocaleString(),
									sub: trendSub$2(metrics.conversations.value, metrics.conversations.prior_30d, t("vs prior 30 days"), t),
									icon: /* @__PURE__ */ jsx(MessageSquare, { className: "size-4 text-rose-600" }),
									iconTone: "bg-rose-500/10",
									series: metrics.conversations.series,
									accent: ACCENT,
									trendData: trend(metrics.conversations.value, metrics.conversations.prior_30d)
								}),
								/* @__PURE__ */ jsx(MetricCard, {
									label: t("Messages (30d)"),
									value: metrics.messages.value.toLocaleString(),
									sub: trendSub$2(metrics.messages.value, metrics.messages.prior_30d, t("vs prior 30 days"), t),
									icon: /* @__PURE__ */ jsx(Sparkles, { className: "size-4 text-fuchsia-600" }),
									iconTone: "bg-fuchsia-500/10",
									series: metrics.messages.series,
									accent: ACCENT,
									trendData: trend(metrics.messages.value, metrics.messages.prior_30d)
								})
							]
						}),
						/* @__PURE__ */ jsxs("div", {
							className: "grid gap-4 xl:grid-cols-[minmax(0,1.45fr)_minmax(320px,0.95fr)]",
							children: [/* @__PURE__ */ jsxs(Card, {
								className: "overflow-hidden p-0",
								children: [
									/* @__PURE__ */ jsxs("div", {
										className: "flex items-start justify-between gap-4 border-b px-4 py-4",
										children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
											className: "text-sm font-medium",
											children: t("Platform report")
										}), /* @__PURE__ */ jsx("p", {
											className: "mt-0.5 text-xs text-muted-foreground",
											children: t("Conversations are the primary line. Messages are the dotted line, so platform activity and support load stay visible together.")
										})] }), /* @__PURE__ */ jsx("div", {
											className: "rounded-full border bg-background px-3 py-1 text-[11px] font-medium text-muted-foreground",
											children: formatRange$2(window.from, window.to)
										})]
									}),
									/* @__PURE__ */ jsx("div", {
										className: "px-3 pt-4 pb-2 sm:px-4",
										children: /* @__PURE__ */ jsx(PlatformChart, {
											chart,
											accent: ACCENT
										})
									}),
									/* @__PURE__ */ jsxs("div", {
										className: "grid gap-0 border-t sm:grid-cols-2 xl:grid-cols-5",
										children: [
											/* @__PURE__ */ jsx(FooterMetric$2, {
												icon: /* @__PURE__ */ jsx(Users, { className: "size-3.5" }),
												label: t("Total users"),
												value: metrics.users.value.toLocaleString()
											}),
											/* @__PURE__ */ jsx(FooterMetric$2, {
												icon: /* @__PURE__ */ jsx(Briefcase, { className: "size-3.5" }),
												label: t("Workspaces"),
												value: metrics.workspaces.value.toLocaleString()
											}),
											/* @__PURE__ */ jsx(FooterMetric$2, {
												icon: /* @__PURE__ */ jsx(Bot, { className: "size-3.5" }),
												label: t("Agents live"),
												value: `${metrics.agents.published ?? 0}/${metrics.agents.value || 0}`
											}),
											/* @__PURE__ */ jsx(FooterMetric$2, {
												icon: /* @__PURE__ */ jsx(Inbox, { className: "size-3.5" }),
												label: t("Leads (30d)"),
												value: (metrics.leads.last_30d ?? 0).toLocaleString()
											}),
											/* @__PURE__ */ jsx(FooterMetric$2, {
												icon: /* @__PURE__ */ jsx(MessageSquare, { className: "size-3.5" }),
												label: t("Messages today"),
												value: right_now.messages_today.toLocaleString()
											})
										]
									})
								]
							}), /* @__PURE__ */ jsxs("div", {
								className: "grid gap-4",
								children: [/* @__PURE__ */ jsxs(Card, {
									className: "p-4",
									children: [
										/* @__PURE__ */ jsxs("div", {
											className: "flex items-start justify-between gap-3",
											children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
												className: "text-sm font-medium",
												children: t("Right now")
											}), /* @__PURE__ */ jsx("p", {
												className: "mt-0.5 text-xs text-muted-foreground",
												children: t("Live platform load across active customer conversations.")
											})] }), /* @__PURE__ */ jsxs("span", {
												className: "inline-flex items-center gap-1 rounded-full bg-rose-500/10 px-2 py-0.5 text-[10px] font-semibold text-rose-600 uppercase dark:text-rose-400",
												children: [/* @__PURE__ */ jsx("span", { className: "inline-block size-1.5 animate-pulse rounded-full bg-rose-500" }), t("Live")]
											})]
										}),
										/* @__PURE__ */ jsxs("div", {
											className: "mt-4 grid grid-cols-2 gap-2",
											children: [/* @__PURE__ */ jsxs("div", {
												className: "rounded-xl border bg-background px-3 py-3",
												children: [/* @__PURE__ */ jsx("p", {
													className: "text-xs text-muted-foreground",
													children: t("Active conversations")
												}), /* @__PURE__ */ jsx("p", {
													className: "mt-1 text-2xl font-semibold text-foreground tabular-nums",
													children: right_now.active_conversations.toLocaleString()
												})]
											}), /* @__PURE__ */ jsxs("div", {
												className: "rounded-xl border bg-background px-3 py-3",
												children: [/* @__PURE__ */ jsx("p", {
													className: "text-xs text-muted-foreground",
													children: t("Messages today")
												}), /* @__PURE__ */ jsx("p", {
													className: "mt-1 text-2xl font-semibold text-foreground tabular-nums",
													children: right_now.messages_today.toLocaleString()
												})]
											})]
										}),
										/* @__PURE__ */ jsx("p", {
											className: "mt-3 text-[11px] text-muted-foreground",
											children: t("Updated :time", { time: relativeTime$6(right_now.as_of) })
										})
									]
								}), /* @__PURE__ */ jsxs(Card, {
									className: "p-4",
									children: [/* @__PURE__ */ jsxs("div", {
										className: "flex items-start justify-between gap-3",
										children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
											className: "text-sm font-medium",
											children: "30-day activation funnel"
										}), /* @__PURE__ */ jsx("p", {
											className: "mt-0.5 text-xs text-muted-foreground",
											children: "From fresh signups to captured leads."
										})] }), /* @__PURE__ */ jsx("span", {
											className: "rounded-full border bg-background px-3 py-1 text-[11px] font-medium text-muted-foreground",
											children: "Funnel"
										})]
									}), /* @__PURE__ */ jsx("div", {
										className: "mt-4 space-y-3",
										children: reports.funnel.map((stage) => /* @__PURE__ */ jsx(FunnelRow, {
											stage,
											maxValue: Math.max(...reports.funnel.map((item) => item.value), 1)
										}, stage.label))
									})]
								})]
							})]
						}),
						/* @__PURE__ */ jsxs("div", {
							className: "grid gap-4 xl:grid-cols-[minmax(0,1.45fr)_minmax(320px,0.95fr)]",
							children: [/* @__PURE__ */ jsxs(Card, {
								className: "overflow-hidden p-0",
								children: [/* @__PURE__ */ jsxs("div", {
									className: "flex flex-wrap items-center gap-2 border-b px-4 py-4",
									children: [
										/* @__PURE__ */ jsx("div", {
											className: "rounded-lg bg-violet-500/10 p-2",
											children: /* @__PURE__ */ jsx(Activity, { className: "size-4 text-violet-600" })
										}),
										/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("h2", {
											className: "text-sm font-medium text-foreground",
											children: "Growth mix"
										}), /* @__PURE__ */ jsx("p", {
											className: "text-xs text-muted-foreground",
											children: "New users, workspaces, and agents created over the last 30 days."
										})] }),
										/* @__PURE__ */ jsxs("div", {
											className: "flex w-full items-center gap-3 text-xs text-muted-foreground sm:ms-auto sm:w-auto",
											children: [
												/* @__PURE__ */ jsx(LegendDot, {
													color: "#0ea5e9",
													label: "Users"
												}),
												/* @__PURE__ */ jsx(LegendDot, {
													color: "#8b5cf6",
													label: "Workspaces"
												}),
												/* @__PURE__ */ jsx(LegendDot, {
													color: "#f59e0b",
													label: "Agents"
												})
											]
										})
									]
								}), /* @__PURE__ */ jsx("div", {
									className: "px-3 pt-4 pb-2 sm:px-4",
									children: /* @__PURE__ */ jsx(GrowthMixChart, { report: reports.growth })
								})]
							}), /* @__PURE__ */ jsxs(Card, {
								className: "p-4",
								children: [/* @__PURE__ */ jsxs("div", {
									className: "flex items-start justify-between gap-3",
									children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
										className: "text-sm font-medium",
										children: "Deployment health"
									}), /* @__PURE__ */ jsx("p", {
										className: "mt-0.5 text-xs text-muted-foreground",
										children: "Published agent activity and live workspace coverage."
									})] }), /* @__PURE__ */ jsx("div", {
										className: "rounded-lg bg-sky-500/10 p-2",
										children: /* @__PURE__ */ jsx(Bot, { className: "size-4 text-sky-600" })
									})]
								}), /* @__PURE__ */ jsxs("div", {
									className: "mt-4 grid gap-4",
									children: [
										/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsxs("div", {
											className: "flex items-end justify-between gap-3",
											children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsxs("p", {
												className: "text-3xl font-semibold tracking-tight text-foreground tabular-nums",
												children: [reports.deployment.utilization_rate.toFixed(1), "%"]
											}), /* @__PURE__ */ jsx("p", {
												className: "text-xs text-muted-foreground",
												children: "published agents active in the last 30 days"
											})] }), /* @__PURE__ */ jsxs("p", {
												className: "text-xs text-muted-foreground",
												children: [
													reports.deployment.active_published_agents.toLocaleString(),
													" ",
													"of",
													" ",
													reports.deployment.published_agents.toLocaleString()
												]
											})]
										}), /* @__PURE__ */ jsx(ProgressBar$1, {
											value: reports.deployment.utilization_rate,
											accentClass: "bg-sky-500"
										})] }),
										/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsxs("div", {
											className: "flex items-end justify-between gap-3",
											children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsxs("p", {
												className: "text-3xl font-semibold tracking-tight text-foreground tabular-nums",
												children: [reports.deployment.workspace_coverage_rate.toFixed(1), "%"]
											}), /* @__PURE__ */ jsx("p", {
												className: "text-xs text-muted-foreground",
												children: "workspaces generated live traffic in the last 30 days"
											})] }), /* @__PURE__ */ jsxs("p", {
												className: "text-xs text-muted-foreground",
												children: [
													reports.deployment.workspaces_with_traffic.toLocaleString(),
													" ",
													"of",
													" ",
													metrics.workspaces.value.toLocaleString()
												]
											})]
										}), /* @__PURE__ */ jsx(ProgressBar$1, {
											value: reports.deployment.workspace_coverage_rate,
											accentClass: "bg-violet-500"
										})] }),
										/* @__PURE__ */ jsxs("div", {
											className: "grid gap-2 rounded-xl border bg-muted/30 p-3 text-sm text-muted-foreground",
											children: [
												/* @__PURE__ */ jsxs("div", {
													className: "flex items-center justify-between gap-3",
													children: [/* @__PURE__ */ jsx("span", {
														title: t("Counts agents with is_published=true that had ZERO non-playground visitor conversations in the last 30 days. Playground tests do not count toward \"active\"."),
														children: t("Inactive published agents")
													}), /* @__PURE__ */ jsxs("span", {
														className: "font-medium text-foreground",
														children: [reports.deployment.inactive_published_agents.toLocaleString(), /* @__PURE__ */ jsxs("span", {
															className: "ms-1 text-muted-foreground",
															children: [
																"/",
																" ",
																reports.deployment.published_agents.toLocaleString()
															]
														})]
													})]
												}),
												/* @__PURE__ */ jsxs("div", {
													className: "flex items-center justify-between gap-3",
													children: [/* @__PURE__ */ jsx("span", { children: "Workspaces with published agents" }), /* @__PURE__ */ jsx("span", {
														className: "font-medium text-foreground",
														children: reports.deployment.published_workspaces.toLocaleString()
													})]
												}),
												/* @__PURE__ */ jsxs("div", {
													className: "flex items-center justify-between gap-3",
													children: [/* @__PURE__ */ jsx("span", { children: "Avg conversations / active agent" }), /* @__PURE__ */ jsx("span", {
														className: "font-medium text-foreground",
														children: reports.deployment.avg_conversations_per_active_agent.toFixed(1)
													})]
												})
											]
										})
									]
								})]
							})]
						}),
						/* @__PURE__ */ jsxs("div", {
							className: "grid gap-4 xl:grid-cols-2",
							children: [/* @__PURE__ */ jsx(ReportMetricCard, {
								title: "Lead capture rate",
								value: `${reports.lead_capture.value.toFixed(1)}%`,
								helper: `${reports.lead_capture.leads.toLocaleString()} leads from ${reports.lead_capture.conversations.toLocaleString()} conversations`,
								footer: `${reports.lead_capture.last_7d.toFixed(1)}% over the last 7 days`,
								accent: "#10b981",
								trendData: trend(reports.lead_capture.value, reports.lead_capture.prior_value),
								icon: /* @__PURE__ */ jsx(Inbox, { className: "size-4 text-emerald-600" }),
								iconTone: "bg-emerald-500/10",
								series: reports.lead_capture.series
							}), /* @__PURE__ */ jsx(ReportMetricCard, {
								title: "Conversation depth",
								value: reports.engagement.value.toFixed(2),
								helper: `${reports.engagement.messages.toLocaleString()} messages across ${reports.engagement.conversations.toLocaleString()} conversations`,
								footer: `${reports.engagement.last_7d.toFixed(2)} messages / conversation in the last 7 days`,
								accent: "#f97316",
								trendData: trend(reports.engagement.value, reports.engagement.prior_value),
								icon: /* @__PURE__ */ jsx(MessageSquare, { className: "size-4 text-orange-600" }),
								iconTone: "bg-orange-500/10",
								series: reports.engagement.series
							})]
						}),
						/* @__PURE__ */ jsx(QueueHealthCard, {
							health: queueHealth,
							t
						}),
						/* @__PURE__ */ jsxs("div", {
							className: "grid grid-cols-1 gap-4 xl:grid-cols-2",
							children: [/* @__PURE__ */ jsxs(Card, {
								className: "p-0",
								children: [
									/* @__PURE__ */ jsxs("div", {
										className: "flex items-center gap-2 border-b px-4 py-3",
										children: [/* @__PURE__ */ jsx("div", {
											className: "rounded-lg bg-sky-500/10 p-1.5",
											children: /* @__PURE__ */ jsx(Users, { className: "size-3.5 text-sky-600" })
										}), /* @__PURE__ */ jsx("h2", {
											className: "text-sm font-medium",
											children: "Recent signups"
										})]
									}),
									/* @__PURE__ */ jsxs("div", {
										className: "divide-y",
										children: [/* @__PURE__ */ jsxs("div", {
											className: "hidden grid-cols-[1fr_1.4fr_120px_120px] gap-3 px-4 py-2 text-[11px] tracking-wider text-muted-foreground uppercase sm:grid",
											children: [
												/* @__PURE__ */ jsx("span", { children: "Name" }),
												/* @__PURE__ */ jsx("span", { children: "Email" }),
												/* @__PURE__ */ jsx("span", { children: "Role" }),
												/* @__PURE__ */ jsx("span", { children: "Signed up" })
											]
										}), recent_signups.map((u) => /* @__PURE__ */ jsxs("div", {
											className: "grid gap-2 px-4 py-3 text-sm sm:grid-cols-[1fr_1.4fr_120px_120px] sm:items-center sm:gap-3",
											children: [
												/* @__PURE__ */ jsxs("div", {
													className: "flex min-w-0 items-center gap-2",
													children: [/* @__PURE__ */ jsx("span", {
														className: "inline-flex size-6 items-center justify-center rounded-full bg-rose-500/15 text-[10px] font-semibold text-rose-700 dark:text-rose-400",
														children: initials$1(u.name)
													}), /* @__PURE__ */ jsx("span", {
														className: "truncate font-medium",
														children: u.name
													})]
												}),
												/* @__PURE__ */ jsx("span", {
													className: "truncate text-muted-foreground",
													children: u.email
												}),
												/* @__PURE__ */ jsx("span", { children: /* @__PURE__ */ jsx(RolePill, { role: u.role }) }),
												/* @__PURE__ */ jsx("span", {
													className: "text-xs text-muted-foreground",
													children: relativeTime$6(u.created_at)
												})
											]
										}, u.id))]
									}),
									/* @__PURE__ */ jsx("div", {
										className: "border-t px-4 py-3",
										children: /* @__PURE__ */ jsx(Link, {
											href: index$33(),
											prefetch: true,
											className: "text-xs text-muted-foreground hover:text-foreground",
											children: "View all users →"
										})
									})
								]
							}), /* @__PURE__ */ jsxs(Card, {
								className: "p-0",
								children: [/* @__PURE__ */ jsxs("div", {
									className: "flex flex-wrap items-center gap-2 border-b px-4 py-3",
									children: [
										/* @__PURE__ */ jsx("div", {
											className: "rounded-lg bg-amber-500/10 p-1.5",
											children: /* @__PURE__ */ jsx(Activity, { className: "size-3.5 text-amber-600" })
										}),
										/* @__PURE__ */ jsx("h2", {
											className: "text-sm font-medium",
											children: "Platform activity"
										}),
										/* @__PURE__ */ jsx(Link, {
											href: index$32(),
											prefetch: true,
											className: "text-xs text-muted-foreground hover:text-foreground sm:ms-auto",
											children: "View all activity →"
										})
									]
								}), /* @__PURE__ */ jsx("div", {
									className: "divide-y",
									children: activity.length === 0 ? /* @__PURE__ */ jsx("p", {
										className: "px-4 py-6 text-sm text-muted-foreground",
										children: "No recent activity."
									}) : activity.map((a, i) => /* @__PURE__ */ jsxs("div", {
										className: "flex items-start gap-3 px-4 py-3 text-sm",
										children: [
											/* @__PURE__ */ jsx("div", {
												className: "mt-0.5 rounded-md bg-muted p-1.5",
												children: /* @__PURE__ */ jsx(ActivityIcon, { kind: a.kind })
											}),
											/* @__PURE__ */ jsxs("div", {
												className: "min-w-0 flex-1",
												children: [/* @__PURE__ */ jsx("p", {
													className: "truncate font-medium",
													children: a.title
												}), a.subtitle && /* @__PURE__ */ jsx("p", {
													className: "truncate text-xs text-muted-foreground",
													children: a.subtitle
												})]
											}),
											/* @__PURE__ */ jsx("span", {
												className: "text-xs text-muted-foreground",
												children: relativeTime$6(a.at)
											})
										]
									}, i))
								})]
							})]
						})
					]
				})
			})]
		})]
	});
}
function LegendDot({ color, label }) {
	return /* @__PURE__ */ jsxs("span", {
		className: "inline-flex items-center gap-1.5",
		children: [/* @__PURE__ */ jsx("span", {
			className: "inline-block size-2 rounded-full",
			style: { background: color }
		}), label]
	});
}
function GrowthMixChart({ report }) {
	const w = 720;
	const h = 220;
	const padX = 28;
	const padY = 16;
	const innerW = w - padX * 2;
	const innerH = h - padY * 2;
	const series = [
		report.users,
		report.workspaces,
		report.agents
	];
	const max = Math.max(1, ...series.flat());
	const stepX = innerW / Math.max(1, report.days.length - 1);
	const toPath = (values) => values.map((value, index) => `${(padX + index * stepX).toFixed(1)},${(padY + innerH - value / max * innerH).toFixed(1)}`).join(" ");
	const xLabels = [
		0,
		Math.floor(report.days.length / 4),
		Math.floor(report.days.length / 2),
		Math.floor(report.days.length * 3 / 4),
		report.days.length - 1
	].map((index) => ({
		index,
		label: report.days[index] ? new Date(report.days[index]).toLocaleDateString("en-US", {
			month: "short",
			day: "numeric"
		}) : ""
	})).filter((item) => item.label !== "");
	return /* @__PURE__ */ jsxs("svg", {
		viewBox: `0 0 ${w} ${h + 24}`,
		className: "h-64 w-full",
		preserveAspectRatio: "xMidYMid meet",
		"aria-hidden": true,
		children: [
			[
				0,
				.25,
				.5,
				.75,
				1
			].map((tick, index) => {
				const tickValue = Math.round(max * tick);
				const y = padY + innerH - tickValue / max * innerH;
				return /* @__PURE__ */ jsxs("g", { children: [/* @__PURE__ */ jsx("line", {
					x1: padX,
					y1: y,
					x2: padX + innerW,
					y2: y,
					stroke: "currentColor",
					strokeOpacity: .06
				}), /* @__PURE__ */ jsx("text", {
					x: padX - 6,
					y: y + 4,
					textAnchor: "end",
					fontSize: "10",
					fill: "currentColor",
					opacity: .45,
					children: tickValue
				})] }, index);
			}),
			/* @__PURE__ */ jsx("polyline", {
				points: toPath(report.users),
				fill: "none",
				stroke: "#0ea5e9",
				strokeWidth: "2",
				strokeLinecap: "round",
				strokeLinejoin: "round"
			}),
			/* @__PURE__ */ jsx("polyline", {
				points: toPath(report.workspaces),
				fill: "none",
				stroke: "#8b5cf6",
				strokeWidth: "2",
				strokeLinecap: "round",
				strokeLinejoin: "round"
			}),
			/* @__PURE__ */ jsx("polyline", {
				points: toPath(report.agents),
				fill: "none",
				stroke: "#f59e0b",
				strokeWidth: "2",
				strokeLinecap: "round",
				strokeLinejoin: "round"
			}),
			xLabels.map(({ index, label }) => /* @__PURE__ */ jsx("text", {
				x: padX + index * stepX,
				y: h + 16,
				textAnchor: "middle",
				fontSize: "10",
				fill: "currentColor",
				opacity: .45,
				children: label
			}, index))
		]
	});
}
function FunnelRow({ stage, maxValue }) {
	const width = maxValue > 0 ? stage.value / maxValue * 100 : 0;
	return /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsxs("div", {
		className: "flex items-baseline justify-between gap-3",
		children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
			className: "text-sm font-medium text-foreground",
			children: stage.label
		}), /* @__PURE__ */ jsx("p", {
			className: "text-xs text-muted-foreground",
			children: stage.helper
		})] }), /* @__PURE__ */ jsx("p", {
			className: "text-sm font-semibold text-foreground tabular-nums",
			children: stage.value.toLocaleString()
		})]
	}), /* @__PURE__ */ jsx("div", {
		className: "mt-2 h-2 rounded-full bg-muted",
		children: /* @__PURE__ */ jsx("div", {
			className: "h-2 rounded-full bg-emerald-500",
			style: { width: `${Math.max(width, stage.value > 0 ? 10 : 0)}%` }
		})
	})] });
}
function ReportMetricCard({ title, value, helper, footer, accent, trendData, icon, iconTone, series }) {
	return /* @__PURE__ */ jsxs(Card, {
		className: "p-4 sm:p-5",
		children: [
			/* @__PURE__ */ jsxs("div", {
				className: "flex items-start justify-between gap-3",
				children: [/* @__PURE__ */ jsx("div", {
					className: `rounded-lg p-2 ${iconTone}`,
					children: icon
				}), trendData && trendData.dir !== "flat" ? /* @__PURE__ */ jsxs("span", {
					className: `inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-[11px] font-medium ${trendData.dir === "up" ? "bg-emerald-500/10 text-emerald-700 dark:text-emerald-400" : "bg-rose-500/10 text-rose-700 dark:text-rose-400"}`,
					children: [
						trendData.dir === "up" ? "Up" : "Down",
						" ",
						trendData.pct,
						"%"
					]
				}) : null]
			}),
			/* @__PURE__ */ jsx("p", {
				className: "mt-3 text-xs font-medium tracking-wider text-muted-foreground uppercase",
				children: title
			}),
			/* @__PURE__ */ jsx("p", {
				className: "mt-1 text-3xl font-semibold tracking-tight text-foreground tabular-nums",
				children: value
			}),
			/* @__PURE__ */ jsx("p", {
				className: "mt-1 text-sm text-muted-foreground",
				children: helper
			}),
			/* @__PURE__ */ jsxs("div", {
				className: "mt-4 flex items-end justify-between gap-4",
				children: [/* @__PURE__ */ jsx("p", {
					className: "max-w-[14rem] text-xs text-muted-foreground",
					children: footer
				}), /* @__PURE__ */ jsx(Sparkline, {
					values: series,
					accent,
					width: 112,
					height: 36
				})]
			})
		]
	});
}
function ProgressBar$1({ value, accentClass }) {
	return /* @__PURE__ */ jsx("div", {
		className: "mt-2 h-2 rounded-full bg-muted",
		children: /* @__PURE__ */ jsx("div", {
			className: `h-2 rounded-full ${accentClass}`,
			style: { width: `${Math.min(Math.max(value, 0), 100)}%` }
		})
	});
}
function trendSub$2(current, prior, fallback, translate) {
	const trendData = trend(current, prior);
	const localizedFallback = fallback ?? (translate ? translate("vs prior 30 days") : "vs prior 30 days");
	if (trendData.dir === "flat") return localizedFallback;
	return `${trendData.dir === "up" ? "↑" : "↓"} ${trendData.pct}% ${localizedFallback}`;
}
function initials$1(name) {
	const parts = name.trim().split(/\s+/);
	if (parts.length === 1) return parts[0]?.slice(0, 2).toUpperCase() ?? "?";
	return ((parts[0]?.[0] ?? "") + (parts[parts.length - 1]?.[0] ?? "")).toUpperCase();
}
function RolePill({ role }) {
	return /* @__PURE__ */ jsx("span", {
		className: `rounded px-2 py-0.5 text-[11px] ${role === "super_admin" ? "bg-rose-500/15 text-rose-700 dark:text-rose-400" : "bg-muted text-muted-foreground"}`,
		children: role
	});
}
function ActivityIcon({ kind }) {
	if (kind === "agent.published") return /* @__PURE__ */ jsx(Bot, { className: "size-3.5 text-emerald-600" });
	if (kind === "workspace.created") return /* @__PURE__ */ jsx(Briefcase, { className: "size-3.5 text-violet-600" });
	return /* @__PURE__ */ jsx(Activity, { className: "size-3.5 text-muted-foreground" });
}
//#endregion
//#region resources/js/routes/workspaces/index.ts
/**
* @see \App\Http\Controllers\Admin\WorkspaceSelectController::select
* @see app/Http/Controllers/Admin/WorkspaceSelectController.php:11
* @route '/workspaces/{workspace}/select'
*/
var select = (args, options) => ({
	url: select.url(args, options),
	method: "post"
});
select.definition = {
	methods: ["post"],
	url: "/workspaces/{workspace}/select"
};
/**
* @see \App\Http\Controllers\Admin\WorkspaceSelectController::select
* @see app/Http/Controllers/Admin/WorkspaceSelectController.php:11
* @route '/workspaces/{workspace}/select'
*/
select.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { workspace: args };
	if (typeof args === "object" && !Array.isArray(args) && "id" in args) args = { workspace: args.id };
	if (Array.isArray(args)) args = { workspace: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { workspace: typeof args.workspace === "object" ? args.workspace.id : args.workspace };
	return select.definition.url.replace("{workspace}", parsedArgs.workspace.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\WorkspaceSelectController::select
* @see app/Http/Controllers/Admin/WorkspaceSelectController.php:11
* @route '/workspaces/{workspace}/select'
*/
select.post = (args, options) => ({
	url: select.url(args, options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\WorkspaceSelectController::select
* @see app/Http/Controllers/Admin/WorkspaceSelectController.php:11
* @route '/workspaces/{workspace}/select'
*/
var selectForm = (args, options) => ({
	action: select.url(args, options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\WorkspaceSelectController::select
* @see app/Http/Controllers/Admin/WorkspaceSelectController.php:11
* @route '/workspaces/{workspace}/select'
*/
selectForm.post = (args, options) => ({
	action: select.url(args, options),
	method: "post"
});
select.form = selectForm;
/**
* @see \App\Http\Controllers\Admin\WorkspaceController::store
* @see app/Http/Controllers/Admin/WorkspaceController.php:27
* @route '/workspaces'
*/
var store$20 = (options) => ({
	url: store$20.url(options),
	method: "post"
});
store$20.definition = {
	methods: ["post"],
	url: "/workspaces"
};
/**
* @see \App\Http\Controllers\Admin\WorkspaceController::store
* @see app/Http/Controllers/Admin/WorkspaceController.php:27
* @route '/workspaces'
*/
store$20.url = (options) => {
	return store$20.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\WorkspaceController::store
* @see app/Http/Controllers/Admin/WorkspaceController.php:27
* @route '/workspaces'
*/
store$20.post = (options) => ({
	url: store$20.url(options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\WorkspaceController::store
* @see app/Http/Controllers/Admin/WorkspaceController.php:27
* @route '/workspaces'
*/
var storeForm$20 = (options) => ({
	action: store$20.url(options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\WorkspaceController::store
* @see app/Http/Controllers/Admin/WorkspaceController.php:27
* @route '/workspaces'
*/
storeForm$20.post = (options) => ({
	action: store$20.url(options),
	method: "post"
});
store$20.form = storeForm$20;
Object.assign(select, select), Object.assign(store$20, store$20);
//#endregion
//#region resources/js/components/workspace-switcher.tsx
function CreateWorkspaceDialog({ open, onOpenChange }) {
	const { t } = useT();
	const form = useForm({ name: "" });
	const submit = (e) => {
		e.preventDefault();
		form.post(store$20.url(), {
			preserveScroll: true,
			onSuccess: () => {
				form.reset();
				onOpenChange(false);
			}
		});
	};
	return /* @__PURE__ */ jsx(Dialog, {
		open,
		onOpenChange,
		children: /* @__PURE__ */ jsx(DialogContent, { children: /* @__PURE__ */ jsxs("form", {
			onSubmit: submit,
			children: [
				/* @__PURE__ */ jsxs(DialogHeader, { children: [/* @__PURE__ */ jsx(DialogTitle, { children: t("Create new workspace") }), /* @__PURE__ */ jsx(DialogDescription, { children: t("A workspace keeps agents, conversations, and members separate. You can switch between workspaces from this menu.") })] }),
				/* @__PURE__ */ jsxs("div", {
					className: "grid gap-2 py-4",
					children: [
						/* @__PURE__ */ jsx(Label, {
							htmlFor: "new-workspace-name",
							children: t("Name")
						}),
						/* @__PURE__ */ jsx(Input, {
							id: "new-workspace-name",
							value: form.data.name,
							onChange: (e) => form.setData("name", e.target.value),
							placeholder: t("Acme HQ"),
							autoFocus: true
						}),
						form.errors.name && /* @__PURE__ */ jsx("p", {
							className: "text-xs text-destructive",
							children: form.errors.name
						})
					]
				}),
				/* @__PURE__ */ jsxs(DialogFooter, { children: [/* @__PURE__ */ jsx(Button, {
					type: "button",
					variant: "outline",
					onClick: () => onOpenChange(false),
					disabled: form.processing,
					children: t("Cancel")
				}), /* @__PURE__ */ jsx(Button, {
					type: "submit",
					disabled: form.processing,
					children: t("Create workspace")
				})] })
			]
		}) })
	});
}
/**
* Multi-workspace switcher. Shows the current workspace name in the
* sidebar; clicking opens a dropdown of every workspace the visitor
* is a member of so they can flip between them without re-logging.
*
* When the visitor is a member of only one workspace the dropdown is
* pointless clutter — a list of one with a checkmark next to itself.
* In that case we render the workspace name as a plain non-interactive
* label instead.
*/
function WorkspaceSwitcher() {
	const { t } = useT();
	const page = usePage();
	const { state } = useSidebar();
	const current = page.props.currentWorkspace;
	const workspaces = page.props.workspaces ?? [];
	const [createOpen, setCreateOpen] = useState(false);
	if (!current) return null;
	const isCollapsed = state === "collapsed";
	const triggerSide = isCollapsed ? "right" : "bottom";
	const triggerAlign = isCollapsed ? "center" : "start";
	const triggerSideOffset = isCollapsed ? 8 : 6;
	const expandedCardClassName = "flex h-[34px] w-full items-center gap-2 rounded-lg border px-3 text-start transition-all duration-200 border-sidebar-border/70 bg-sidebar-accent/40 text-sidebar-foreground hover:bg-sidebar-accent/60 dark:border-white/10 dark:bg-[radial-gradient(circle_at_top_left,rgba(255,255,255,0.075),transparent_44%),linear-gradient(180deg,rgba(20,22,25,0.96),rgba(13,14,17,0.98))] dark:shadow-[0_18px_44px_-36px_rgba(0,0,0,0.95),inset_0_1px_0_rgba(255,255,255,0.045)] dark:hover:border-white/15 dark:hover:bg-[radial-gradient(circle_at_top_left,rgba(255,255,255,0.105),transparent_48%),linear-gradient(180deg,rgba(24,26,30,0.98),rgba(14,15,19,1))]";
	const expandedCardContent = /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("span", {
		className: "flex size-5 shrink-0 items-center justify-center text-sidebar-foreground/70",
		children: /* @__PURE__ */ jsx(Building2, { className: "size-4 stroke-[1.65]" })
	}), /* @__PURE__ */ jsx("span", {
		className: "flex min-w-0 flex-1 items-center gap-3",
		children: /* @__PURE__ */ jsx("span", {
			className: "truncate text-[13px] leading-none font-semibold text-sidebar-foreground",
			children: current.name
		})
	})] });
	const dropdownContent = /* @__PURE__ */ jsxs(DropdownMenuContent, {
		align: triggerAlign,
		side: triggerSide,
		sideOffset: triggerSideOffset,
		className: "w-56",
		children: [
			/* @__PURE__ */ jsx(DropdownMenuLabel, { children: t("Switch workspace") }),
			/* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
			workspaces.map((ws) => /* @__PURE__ */ jsxs(DropdownMenuItem, {
				onSelect: () => {
					if (ws.id === current.id) return;
					router.post(select.url(ws.id), {}, { preserveScroll: true });
				},
				children: [/* @__PURE__ */ jsx("span", {
					className: "flex-1 truncate",
					children: ws.name
				}), ws.id === current.id && /* @__PURE__ */ jsx(Check, { className: "ms-2 size-4" })]
			}, ws.id)),
			/* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
			/* @__PURE__ */ jsxs(DropdownMenuItem, {
				onSelect: (e) => {
					e.preventDefault();
					setCreateOpen(true);
				},
				children: [/* @__PURE__ */ jsx(Plus, { className: "me-2 size-4" }), /* @__PURE__ */ jsx("span", { children: t("Create new workspace") })]
			})
		]
	});
	const createDialog = /* @__PURE__ */ jsx(CreateWorkspaceDialog, {
		open: createOpen,
		onOpenChange: setCreateOpen
	});
	if (isCollapsed) return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs(DropdownMenu, { children: [/* @__PURE__ */ jsx(DropdownMenuTrigger, {
		asChild: true,
		children: /* @__PURE__ */ jsxs(SidebarMenuButton, {
			size: "sm",
			tooltip: { children: current.name },
			className: "h-9 rounded-xl border border-sidebar-border/60 bg-sidebar-accent/35",
			children: [/* @__PURE__ */ jsx(Building2, { className: "size-4" }), /* @__PURE__ */ jsx("span", { children: current.name })]
		})
	}), dropdownContent] }), createDialog] });
	return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs(DropdownMenu, { children: [/* @__PURE__ */ jsx(DropdownMenuTrigger, {
		asChild: true,
		children: /* @__PURE__ */ jsxs("button", {
			type: "button",
			className: cn(expandedCardClassName, "focus-visible:ring-2 focus-visible:ring-sidebar-ring focus-visible:outline-none"),
			"aria-label": t("Workspace: :name", { name: current.name }),
			children: [expandedCardContent, /* @__PURE__ */ jsx(ChevronDown, { className: "ms-auto size-4 shrink-0 text-sidebar-foreground/70" })]
		})
	}), dropdownContent] }), createDialog] });
}
//#endregion
//#region resources/js/routes/agents/vertical/index.ts
/**
* @see \App\Http\Controllers\Admin\Vertical\DetectController::__invoke
* @see app/Http/Controllers/Admin/Vertical/DetectController.php:29
* @route '/app/agents/{agent}/vertical/detect'
*/
var detect = (args, options) => ({
	url: detect.url(args, options),
	method: "post"
});
detect.definition = {
	methods: ["post"],
	url: "/app/agents/{agent}/vertical/detect"
};
/**
* @see \App\Http\Controllers\Admin\Vertical\DetectController::__invoke
* @see app/Http/Controllers/Admin/Vertical/DetectController.php:29
* @route '/app/agents/{agent}/vertical/detect'
*/
detect.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { agent: args };
	if (typeof args === "object" && !Array.isArray(args) && "id" in args) args = { agent: args.id };
	if (Array.isArray(args)) args = { agent: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { agent: typeof args.agent === "object" ? args.agent.id : args.agent };
	return detect.definition.url.replace("{agent}", parsedArgs.agent.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\Vertical\DetectController::__invoke
* @see app/Http/Controllers/Admin/Vertical/DetectController.php:29
* @route '/app/agents/{agent}/vertical/detect'
*/
detect.post = (args, options) => ({
	url: detect.url(args, options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\Vertical\DetectController::__invoke
* @see app/Http/Controllers/Admin/Vertical/DetectController.php:29
* @route '/app/agents/{agent}/vertical/detect'
*/
var detectForm = (args, options) => ({
	action: detect.url(args, options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\Vertical\DetectController::__invoke
* @see app/Http/Controllers/Admin/Vertical/DetectController.php:29
* @route '/app/agents/{agent}/vertical/detect'
*/
detectForm.post = (args, options) => ({
	action: detect.url(args, options),
	method: "post"
});
detect.form = detectForm;
/**
* @see \App\Http\Controllers\Admin\Vertical\ApplyController::__invoke
* @see app/Http/Controllers/Admin/Vertical/ApplyController.php:26
* @route '/app/agents/{agent}/vertical/apply'
*/
var apply = (args, options) => ({
	url: apply.url(args, options),
	method: "post"
});
apply.definition = {
	methods: ["post"],
	url: "/app/agents/{agent}/vertical/apply"
};
/**
* @see \App\Http\Controllers\Admin\Vertical\ApplyController::__invoke
* @see app/Http/Controllers/Admin/Vertical/ApplyController.php:26
* @route '/app/agents/{agent}/vertical/apply'
*/
apply.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { agent: args };
	if (typeof args === "object" && !Array.isArray(args) && "id" in args) args = { agent: args.id };
	if (Array.isArray(args)) args = { agent: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { agent: typeof args.agent === "object" ? args.agent.id : args.agent };
	return apply.definition.url.replace("{agent}", parsedArgs.agent.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\Vertical\ApplyController::__invoke
* @see app/Http/Controllers/Admin/Vertical/ApplyController.php:26
* @route '/app/agents/{agent}/vertical/apply'
*/
apply.post = (args, options) => ({
	url: apply.url(args, options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\Vertical\ApplyController::__invoke
* @see app/Http/Controllers/Admin/Vertical/ApplyController.php:26
* @route '/app/agents/{agent}/vertical/apply'
*/
var applyForm = (args, options) => ({
	action: apply.url(args, options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\Vertical\ApplyController::__invoke
* @see app/Http/Controllers/Admin/Vertical/ApplyController.php:26
* @route '/app/agents/{agent}/vertical/apply'
*/
applyForm.post = (args, options) => ({
	action: apply.url(args, options),
	method: "post"
});
apply.form = applyForm;
var vertical$1 = {
	detect: Object.assign(detect, detect),
	apply: Object.assign(apply, apply)
};
//#endregion
//#region resources/js/routes/agents/mcp/tools/index.ts
/**
* @see \App\Http\Controllers\Admin\Mcp\McpServerController::bulk
* @see app/Http/Controllers/Admin/Mcp/McpServerController.php:211
* @route '/app/agents/{agent}/mcp/{mcpServer}/tools'
*/
var bulk$1 = (args, options) => ({
	url: bulk$1.url(args, options),
	method: "patch"
});
bulk$1.definition = {
	methods: ["patch"],
	url: "/app/agents/{agent}/mcp/{mcpServer}/tools"
};
/**
* @see \App\Http\Controllers\Admin\Mcp\McpServerController::bulk
* @see app/Http/Controllers/Admin/Mcp/McpServerController.php:211
* @route '/app/agents/{agent}/mcp/{mcpServer}/tools'
*/
bulk$1.url = (args, options) => {
	if (Array.isArray(args)) args = {
		agent: args[0],
		mcpServer: args[1]
	};
	args = applyUrlDefaults(args);
	const parsedArgs = {
		agent: typeof args.agent === "object" ? args.agent.id : args.agent,
		mcpServer: typeof args.mcpServer === "object" ? args.mcpServer.id : args.mcpServer
	};
	return bulk$1.definition.url.replace("{agent}", parsedArgs.agent.toString()).replace("{mcpServer}", parsedArgs.mcpServer.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\Mcp\McpServerController::bulk
* @see app/Http/Controllers/Admin/Mcp/McpServerController.php:211
* @route '/app/agents/{agent}/mcp/{mcpServer}/tools'
*/
bulk$1.patch = (args, options) => ({
	url: bulk$1.url(args, options),
	method: "patch"
});
/**
* @see \App\Http\Controllers\Admin\Mcp\McpServerController::bulk
* @see app/Http/Controllers/Admin/Mcp/McpServerController.php:211
* @route '/app/agents/{agent}/mcp/{mcpServer}/tools'
*/
var bulkForm$1 = (args, options) => ({
	action: bulk$1.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "PATCH",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\Mcp\McpServerController::bulk
* @see app/Http/Controllers/Admin/Mcp/McpServerController.php:211
* @route '/app/agents/{agent}/mcp/{mcpServer}/tools'
*/
bulkForm$1.patch = (args, options) => ({
	action: bulk$1.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "PATCH",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
bulk$1.form = bulkForm$1;
var tools$1 = { bulk: Object.assign(bulk$1, bulk$1) };
//#endregion
//#region resources/js/routes/agents/mcp/index.ts
/**
* @see \App\Http\Controllers\Admin\Mcp\McpServerController::index
* @see app/Http/Controllers/Admin/Mcp/McpServerController.php:40
* @route '/app/agents/{agent}/mcp'
*/
var index$21 = (args, options) => ({
	url: index$21.url(args, options),
	method: "get"
});
index$21.definition = {
	methods: ["get", "head"],
	url: "/app/agents/{agent}/mcp"
};
/**
* @see \App\Http\Controllers\Admin\Mcp\McpServerController::index
* @see app/Http/Controllers/Admin/Mcp/McpServerController.php:40
* @route '/app/agents/{agent}/mcp'
*/
index$21.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { agent: args };
	if (typeof args === "object" && !Array.isArray(args) && "id" in args) args = { agent: args.id };
	if (Array.isArray(args)) args = { agent: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { agent: typeof args.agent === "object" ? args.agent.id : args.agent };
	return index$21.definition.url.replace("{agent}", parsedArgs.agent.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\Mcp\McpServerController::index
* @see app/Http/Controllers/Admin/Mcp/McpServerController.php:40
* @route '/app/agents/{agent}/mcp'
*/
index$21.get = (args, options) => ({
	url: index$21.url(args, options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Mcp\McpServerController::index
* @see app/Http/Controllers/Admin/Mcp/McpServerController.php:40
* @route '/app/agents/{agent}/mcp'
*/
index$21.head = (args, options) => ({
	url: index$21.url(args, options),
	method: "head"
});
/**
* @see \App\Http\Controllers\Admin\Mcp\McpServerController::index
* @see app/Http/Controllers/Admin/Mcp/McpServerController.php:40
* @route '/app/agents/{agent}/mcp'
*/
var indexForm$21 = (args, options) => ({
	action: index$21.url(args, options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Mcp\McpServerController::index
* @see app/Http/Controllers/Admin/Mcp/McpServerController.php:40
* @route '/app/agents/{agent}/mcp'
*/
indexForm$21.get = (args, options) => ({
	action: index$21.url(args, options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Mcp\McpServerController::index
* @see app/Http/Controllers/Admin/Mcp/McpServerController.php:40
* @route '/app/agents/{agent}/mcp'
*/
indexForm$21.head = (args, options) => ({
	action: index$21.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
index$21.form = indexForm$21;
/**
* @see \App\Http\Controllers\Admin\Mcp\McpServerController::store
* @see app/Http/Controllers/Admin/Mcp/McpServerController.php:78
* @route '/app/agents/{agent}/mcp'
*/
var store$19 = (args, options) => ({
	url: store$19.url(args, options),
	method: "post"
});
store$19.definition = {
	methods: ["post"],
	url: "/app/agents/{agent}/mcp"
};
/**
* @see \App\Http\Controllers\Admin\Mcp\McpServerController::store
* @see app/Http/Controllers/Admin/Mcp/McpServerController.php:78
* @route '/app/agents/{agent}/mcp'
*/
store$19.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { agent: args };
	if (typeof args === "object" && !Array.isArray(args) && "id" in args) args = { agent: args.id };
	if (Array.isArray(args)) args = { agent: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { agent: typeof args.agent === "object" ? args.agent.id : args.agent };
	return store$19.definition.url.replace("{agent}", parsedArgs.agent.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\Mcp\McpServerController::store
* @see app/Http/Controllers/Admin/Mcp/McpServerController.php:78
* @route '/app/agents/{agent}/mcp'
*/
store$19.post = (args, options) => ({
	url: store$19.url(args, options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\Mcp\McpServerController::store
* @see app/Http/Controllers/Admin/Mcp/McpServerController.php:78
* @route '/app/agents/{agent}/mcp'
*/
var storeForm$19 = (args, options) => ({
	action: store$19.url(args, options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\Mcp\McpServerController::store
* @see app/Http/Controllers/Admin/Mcp/McpServerController.php:78
* @route '/app/agents/{agent}/mcp'
*/
storeForm$19.post = (args, options) => ({
	action: store$19.url(args, options),
	method: "post"
});
store$19.form = storeForm$19;
/**
* @see \App\Http\Controllers\Admin\Mcp\McpServerController::destroy
* @see app/Http/Controllers/Admin/Mcp/McpServerController.php:122
* @route '/app/agents/{agent}/mcp/{mcpServer}'
*/
var destroy$14 = (args, options) => ({
	url: destroy$14.url(args, options),
	method: "delete"
});
destroy$14.definition = {
	methods: ["delete"],
	url: "/app/agents/{agent}/mcp/{mcpServer}"
};
/**
* @see \App\Http\Controllers\Admin\Mcp\McpServerController::destroy
* @see app/Http/Controllers/Admin/Mcp/McpServerController.php:122
* @route '/app/agents/{agent}/mcp/{mcpServer}'
*/
destroy$14.url = (args, options) => {
	if (Array.isArray(args)) args = {
		agent: args[0],
		mcpServer: args[1]
	};
	args = applyUrlDefaults(args);
	const parsedArgs = {
		agent: typeof args.agent === "object" ? args.agent.id : args.agent,
		mcpServer: typeof args.mcpServer === "object" ? args.mcpServer.id : args.mcpServer
	};
	return destroy$14.definition.url.replace("{agent}", parsedArgs.agent.toString()).replace("{mcpServer}", parsedArgs.mcpServer.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\Mcp\McpServerController::destroy
* @see app/Http/Controllers/Admin/Mcp/McpServerController.php:122
* @route '/app/agents/{agent}/mcp/{mcpServer}'
*/
destroy$14.delete = (args, options) => ({
	url: destroy$14.url(args, options),
	method: "delete"
});
/**
* @see \App\Http\Controllers\Admin\Mcp\McpServerController::destroy
* @see app/Http/Controllers/Admin/Mcp/McpServerController.php:122
* @route '/app/agents/{agent}/mcp/{mcpServer}'
*/
var destroyForm$14 = (args, options) => ({
	action: destroy$14.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "DELETE",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\Mcp\McpServerController::destroy
* @see app/Http/Controllers/Admin/Mcp/McpServerController.php:122
* @route '/app/agents/{agent}/mcp/{mcpServer}'
*/
destroyForm$14.delete = (args, options) => ({
	action: destroy$14.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "DELETE",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
destroy$14.form = destroyForm$14;
/**
* @see \App\Http\Controllers\Admin\Mcp\McpServerController::test
* @see app/Http/Controllers/Admin/Mcp/McpServerController.php:133
* @route '/app/agents/{agent}/mcp/{mcpServer}/test'
*/
var test = (args, options) => ({
	url: test.url(args, options),
	method: "post"
});
test.definition = {
	methods: ["post"],
	url: "/app/agents/{agent}/mcp/{mcpServer}/test"
};
/**
* @see \App\Http\Controllers\Admin\Mcp\McpServerController::test
* @see app/Http/Controllers/Admin/Mcp/McpServerController.php:133
* @route '/app/agents/{agent}/mcp/{mcpServer}/test'
*/
test.url = (args, options) => {
	if (Array.isArray(args)) args = {
		agent: args[0],
		mcpServer: args[1]
	};
	args = applyUrlDefaults(args);
	const parsedArgs = {
		agent: typeof args.agent === "object" ? args.agent.id : args.agent,
		mcpServer: typeof args.mcpServer === "object" ? args.mcpServer.id : args.mcpServer
	};
	return test.definition.url.replace("{agent}", parsedArgs.agent.toString()).replace("{mcpServer}", parsedArgs.mcpServer.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\Mcp\McpServerController::test
* @see app/Http/Controllers/Admin/Mcp/McpServerController.php:133
* @route '/app/agents/{agent}/mcp/{mcpServer}/test'
*/
test.post = (args, options) => ({
	url: test.url(args, options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\Mcp\McpServerController::test
* @see app/Http/Controllers/Admin/Mcp/McpServerController.php:133
* @route '/app/agents/{agent}/mcp/{mcpServer}/test'
*/
var testForm = (args, options) => ({
	action: test.url(args, options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\Mcp\McpServerController::test
* @see app/Http/Controllers/Admin/Mcp/McpServerController.php:133
* @route '/app/agents/{agent}/mcp/{mcpServer}/test'
*/
testForm.post = (args, options) => ({
	action: test.url(args, options),
	method: "post"
});
test.form = testForm;
/**
* @see \App\Http\Controllers\Admin\Mcp\McpServerController::refresh
* @see app/Http/Controllers/Admin/Mcp/McpServerController.php:162
* @route '/app/agents/{agent}/mcp/{mcpServer}/refresh'
*/
var refresh = (args, options) => ({
	url: refresh.url(args, options),
	method: "post"
});
refresh.definition = {
	methods: ["post"],
	url: "/app/agents/{agent}/mcp/{mcpServer}/refresh"
};
/**
* @see \App\Http\Controllers\Admin\Mcp\McpServerController::refresh
* @see app/Http/Controllers/Admin/Mcp/McpServerController.php:162
* @route '/app/agents/{agent}/mcp/{mcpServer}/refresh'
*/
refresh.url = (args, options) => {
	if (Array.isArray(args)) args = {
		agent: args[0],
		mcpServer: args[1]
	};
	args = applyUrlDefaults(args);
	const parsedArgs = {
		agent: typeof args.agent === "object" ? args.agent.id : args.agent,
		mcpServer: typeof args.mcpServer === "object" ? args.mcpServer.id : args.mcpServer
	};
	return refresh.definition.url.replace("{agent}", parsedArgs.agent.toString()).replace("{mcpServer}", parsedArgs.mcpServer.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\Mcp\McpServerController::refresh
* @see app/Http/Controllers/Admin/Mcp/McpServerController.php:162
* @route '/app/agents/{agent}/mcp/{mcpServer}/refresh'
*/
refresh.post = (args, options) => ({
	url: refresh.url(args, options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\Mcp\McpServerController::refresh
* @see app/Http/Controllers/Admin/Mcp/McpServerController.php:162
* @route '/app/agents/{agent}/mcp/{mcpServer}/refresh'
*/
var refreshForm = (args, options) => ({
	action: refresh.url(args, options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\Mcp\McpServerController::refresh
* @see app/Http/Controllers/Admin/Mcp/McpServerController.php:162
* @route '/app/agents/{agent}/mcp/{mcpServer}/refresh'
*/
refreshForm.post = (args, options) => ({
	action: refresh.url(args, options),
	method: "post"
});
refresh.form = refreshForm;
/**
* @see \App\Http\Controllers\Admin\Mcp\McpServerController::tools
* @see app/Http/Controllers/Admin/Mcp/McpServerController.php:173
* @route '/app/agents/{agent}/mcp/{mcpServer}/tools'
*/
var tools = (args, options) => ({
	url: tools.url(args, options),
	method: "get"
});
tools.definition = {
	methods: ["get", "head"],
	url: "/app/agents/{agent}/mcp/{mcpServer}/tools"
};
/**
* @see \App\Http\Controllers\Admin\Mcp\McpServerController::tools
* @see app/Http/Controllers/Admin/Mcp/McpServerController.php:173
* @route '/app/agents/{agent}/mcp/{mcpServer}/tools'
*/
tools.url = (args, options) => {
	if (Array.isArray(args)) args = {
		agent: args[0],
		mcpServer: args[1]
	};
	args = applyUrlDefaults(args);
	const parsedArgs = {
		agent: typeof args.agent === "object" ? args.agent.id : args.agent,
		mcpServer: typeof args.mcpServer === "object" ? args.mcpServer.id : args.mcpServer
	};
	return tools.definition.url.replace("{agent}", parsedArgs.agent.toString()).replace("{mcpServer}", parsedArgs.mcpServer.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\Mcp\McpServerController::tools
* @see app/Http/Controllers/Admin/Mcp/McpServerController.php:173
* @route '/app/agents/{agent}/mcp/{mcpServer}/tools'
*/
tools.get = (args, options) => ({
	url: tools.url(args, options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Mcp\McpServerController::tools
* @see app/Http/Controllers/Admin/Mcp/McpServerController.php:173
* @route '/app/agents/{agent}/mcp/{mcpServer}/tools'
*/
tools.head = (args, options) => ({
	url: tools.url(args, options),
	method: "head"
});
/**
* @see \App\Http\Controllers\Admin\Mcp\McpServerController::tools
* @see app/Http/Controllers/Admin/Mcp/McpServerController.php:173
* @route '/app/agents/{agent}/mcp/{mcpServer}/tools'
*/
var toolsForm = (args, options) => ({
	action: tools.url(args, options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Mcp\McpServerController::tools
* @see app/Http/Controllers/Admin/Mcp/McpServerController.php:173
* @route '/app/agents/{agent}/mcp/{mcpServer}/tools'
*/
toolsForm.get = (args, options) => ({
	action: tools.url(args, options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Mcp\McpServerController::tools
* @see app/Http/Controllers/Admin/Mcp/McpServerController.php:173
* @route '/app/agents/{agent}/mcp/{mcpServer}/tools'
*/
toolsForm.head = (args, options) => ({
	action: tools.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
tools.form = toolsForm;
/**
* @see \App\Http\Controllers\Admin\Mcp\McpActivityController::activity
* @see app/Http/Controllers/Admin/Mcp/McpActivityController.php:21
* @route '/app/agents/{agent}/mcp/{mcpServer}/activity'
*/
var activity = (args, options) => ({
	url: activity.url(args, options),
	method: "get"
});
activity.definition = {
	methods: ["get", "head"],
	url: "/app/agents/{agent}/mcp/{mcpServer}/activity"
};
/**
* @see \App\Http\Controllers\Admin\Mcp\McpActivityController::activity
* @see app/Http/Controllers/Admin/Mcp/McpActivityController.php:21
* @route '/app/agents/{agent}/mcp/{mcpServer}/activity'
*/
activity.url = (args, options) => {
	if (Array.isArray(args)) args = {
		agent: args[0],
		mcpServer: args[1]
	};
	args = applyUrlDefaults(args);
	const parsedArgs = {
		agent: typeof args.agent === "object" ? args.agent.id : args.agent,
		mcpServer: typeof args.mcpServer === "object" ? args.mcpServer.id : args.mcpServer
	};
	return activity.definition.url.replace("{agent}", parsedArgs.agent.toString()).replace("{mcpServer}", parsedArgs.mcpServer.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\Mcp\McpActivityController::activity
* @see app/Http/Controllers/Admin/Mcp/McpActivityController.php:21
* @route '/app/agents/{agent}/mcp/{mcpServer}/activity'
*/
activity.get = (args, options) => ({
	url: activity.url(args, options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Mcp\McpActivityController::activity
* @see app/Http/Controllers/Admin/Mcp/McpActivityController.php:21
* @route '/app/agents/{agent}/mcp/{mcpServer}/activity'
*/
activity.head = (args, options) => ({
	url: activity.url(args, options),
	method: "head"
});
/**
* @see \App\Http\Controllers\Admin\Mcp\McpActivityController::activity
* @see app/Http/Controllers/Admin/Mcp/McpActivityController.php:21
* @route '/app/agents/{agent}/mcp/{mcpServer}/activity'
*/
var activityForm = (args, options) => ({
	action: activity.url(args, options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Mcp\McpActivityController::activity
* @see app/Http/Controllers/Admin/Mcp/McpActivityController.php:21
* @route '/app/agents/{agent}/mcp/{mcpServer}/activity'
*/
activityForm.get = (args, options) => ({
	action: activity.url(args, options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Mcp\McpActivityController::activity
* @see app/Http/Controllers/Admin/Mcp/McpActivityController.php:21
* @route '/app/agents/{agent}/mcp/{mcpServer}/activity'
*/
activityForm.head = (args, options) => ({
	action: activity.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
activity.form = activityForm;
var mcp = {
	index: Object.assign(index$21, index$21),
	store: Object.assign(store$19, store$19),
	destroy: Object.assign(destroy$14, destroy$14),
	test: Object.assign(test, test),
	refresh: Object.assign(refresh, refresh),
	tools: Object.assign(tools, tools$1),
	activity: Object.assign(activity, activity)
};
//#endregion
//#region resources/js/routes/agents/curated/index.ts
/**
* @see \App\Http\Controllers\Admin\CuratedAnswerController::index
* @see app/Http/Controllers/Admin/CuratedAnswerController.php:13
* @route '/app/agents/{agent}/curated'
*/
var index$20 = (args, options) => ({
	url: index$20.url(args, options),
	method: "get"
});
index$20.definition = {
	methods: ["get", "head"],
	url: "/app/agents/{agent}/curated"
};
/**
* @see \App\Http\Controllers\Admin\CuratedAnswerController::index
* @see app/Http/Controllers/Admin/CuratedAnswerController.php:13
* @route '/app/agents/{agent}/curated'
*/
index$20.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { agent: args };
	if (typeof args === "object" && !Array.isArray(args) && "id" in args) args = { agent: args.id };
	if (Array.isArray(args)) args = { agent: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { agent: typeof args.agent === "object" ? args.agent.id : args.agent };
	return index$20.definition.url.replace("{agent}", parsedArgs.agent.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\CuratedAnswerController::index
* @see app/Http/Controllers/Admin/CuratedAnswerController.php:13
* @route '/app/agents/{agent}/curated'
*/
index$20.get = (args, options) => ({
	url: index$20.url(args, options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\CuratedAnswerController::index
* @see app/Http/Controllers/Admin/CuratedAnswerController.php:13
* @route '/app/agents/{agent}/curated'
*/
index$20.head = (args, options) => ({
	url: index$20.url(args, options),
	method: "head"
});
/**
* @see \App\Http\Controllers\Admin\CuratedAnswerController::index
* @see app/Http/Controllers/Admin/CuratedAnswerController.php:13
* @route '/app/agents/{agent}/curated'
*/
var indexForm$20 = (args, options) => ({
	action: index$20.url(args, options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\CuratedAnswerController::index
* @see app/Http/Controllers/Admin/CuratedAnswerController.php:13
* @route '/app/agents/{agent}/curated'
*/
indexForm$20.get = (args, options) => ({
	action: index$20.url(args, options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\CuratedAnswerController::index
* @see app/Http/Controllers/Admin/CuratedAnswerController.php:13
* @route '/app/agents/{agent}/curated'
*/
indexForm$20.head = (args, options) => ({
	action: index$20.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
index$20.form = indexForm$20;
/**
* @see \App\Http\Controllers\Admin\CuratedAnswerController::store
* @see app/Http/Controllers/Admin/CuratedAnswerController.php:44
* @route '/app/agents/{agent}/curated'
*/
var store$18 = (args, options) => ({
	url: store$18.url(args, options),
	method: "post"
});
store$18.definition = {
	methods: ["post"],
	url: "/app/agents/{agent}/curated"
};
/**
* @see \App\Http\Controllers\Admin\CuratedAnswerController::store
* @see app/Http/Controllers/Admin/CuratedAnswerController.php:44
* @route '/app/agents/{agent}/curated'
*/
store$18.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { agent: args };
	if (typeof args === "object" && !Array.isArray(args) && "id" in args) args = { agent: args.id };
	if (Array.isArray(args)) args = { agent: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { agent: typeof args.agent === "object" ? args.agent.id : args.agent };
	return store$18.definition.url.replace("{agent}", parsedArgs.agent.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\CuratedAnswerController::store
* @see app/Http/Controllers/Admin/CuratedAnswerController.php:44
* @route '/app/agents/{agent}/curated'
*/
store$18.post = (args, options) => ({
	url: store$18.url(args, options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\CuratedAnswerController::store
* @see app/Http/Controllers/Admin/CuratedAnswerController.php:44
* @route '/app/agents/{agent}/curated'
*/
var storeForm$18 = (args, options) => ({
	action: store$18.url(args, options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\CuratedAnswerController::store
* @see app/Http/Controllers/Admin/CuratedAnswerController.php:44
* @route '/app/agents/{agent}/curated'
*/
storeForm$18.post = (args, options) => ({
	action: store$18.url(args, options),
	method: "post"
});
store$18.form = storeForm$18;
var curated = {
	index: Object.assign(index$20, index$20),
	store: Object.assign(store$18, store$18)
};
//#endregion
//#region resources/js/routes/agents/behavior/index.ts
/**
* @see \App\Http\Controllers\Admin\BehaviorRuleController::index
* @see app/Http/Controllers/Admin/BehaviorRuleController.php:12
* @route '/app/agents/{agent}/behavior'
*/
var index$19 = (args, options) => ({
	url: index$19.url(args, options),
	method: "get"
});
index$19.definition = {
	methods: ["get", "head"],
	url: "/app/agents/{agent}/behavior"
};
/**
* @see \App\Http\Controllers\Admin\BehaviorRuleController::index
* @see app/Http/Controllers/Admin/BehaviorRuleController.php:12
* @route '/app/agents/{agent}/behavior'
*/
index$19.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { agent: args };
	if (typeof args === "object" && !Array.isArray(args) && "id" in args) args = { agent: args.id };
	if (Array.isArray(args)) args = { agent: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { agent: typeof args.agent === "object" ? args.agent.id : args.agent };
	return index$19.definition.url.replace("{agent}", parsedArgs.agent.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\BehaviorRuleController::index
* @see app/Http/Controllers/Admin/BehaviorRuleController.php:12
* @route '/app/agents/{agent}/behavior'
*/
index$19.get = (args, options) => ({
	url: index$19.url(args, options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\BehaviorRuleController::index
* @see app/Http/Controllers/Admin/BehaviorRuleController.php:12
* @route '/app/agents/{agent}/behavior'
*/
index$19.head = (args, options) => ({
	url: index$19.url(args, options),
	method: "head"
});
/**
* @see \App\Http\Controllers\Admin\BehaviorRuleController::index
* @see app/Http/Controllers/Admin/BehaviorRuleController.php:12
* @route '/app/agents/{agent}/behavior'
*/
var indexForm$19 = (args, options) => ({
	action: index$19.url(args, options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\BehaviorRuleController::index
* @see app/Http/Controllers/Admin/BehaviorRuleController.php:12
* @route '/app/agents/{agent}/behavior'
*/
indexForm$19.get = (args, options) => ({
	action: index$19.url(args, options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\BehaviorRuleController::index
* @see app/Http/Controllers/Admin/BehaviorRuleController.php:12
* @route '/app/agents/{agent}/behavior'
*/
indexForm$19.head = (args, options) => ({
	action: index$19.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
index$19.form = indexForm$19;
/**
* @see \App\Http\Controllers\Admin\BehaviorRuleController::store
* @see app/Http/Controllers/Admin/BehaviorRuleController.php:22
* @route '/app/agents/{agent}/behavior'
*/
var store$17 = (args, options) => ({
	url: store$17.url(args, options),
	method: "post"
});
store$17.definition = {
	methods: ["post"],
	url: "/app/agents/{agent}/behavior"
};
/**
* @see \App\Http\Controllers\Admin\BehaviorRuleController::store
* @see app/Http/Controllers/Admin/BehaviorRuleController.php:22
* @route '/app/agents/{agent}/behavior'
*/
store$17.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { agent: args };
	if (typeof args === "object" && !Array.isArray(args) && "id" in args) args = { agent: args.id };
	if (Array.isArray(args)) args = { agent: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { agent: typeof args.agent === "object" ? args.agent.id : args.agent };
	return store$17.definition.url.replace("{agent}", parsedArgs.agent.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\BehaviorRuleController::store
* @see app/Http/Controllers/Admin/BehaviorRuleController.php:22
* @route '/app/agents/{agent}/behavior'
*/
store$17.post = (args, options) => ({
	url: store$17.url(args, options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\BehaviorRuleController::store
* @see app/Http/Controllers/Admin/BehaviorRuleController.php:22
* @route '/app/agents/{agent}/behavior'
*/
var storeForm$17 = (args, options) => ({
	action: store$17.url(args, options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\BehaviorRuleController::store
* @see app/Http/Controllers/Admin/BehaviorRuleController.php:22
* @route '/app/agents/{agent}/behavior'
*/
storeForm$17.post = (args, options) => ({
	action: store$17.url(args, options),
	method: "post"
});
store$17.form = storeForm$17;
var behavior = {
	index: Object.assign(index$19, index$19),
	store: Object.assign(store$17, store$17)
};
//#endregion
//#region resources/js/routes/agents/ctas/index.ts
/**
* @see \App\Http\Controllers\Admin\CtaRuleController::index
* @see app/Http/Controllers/Admin/CtaRuleController.php:12
* @route '/app/agents/{agent}/ctas'
*/
var index$18 = (args, options) => ({
	url: index$18.url(args, options),
	method: "get"
});
index$18.definition = {
	methods: ["get", "head"],
	url: "/app/agents/{agent}/ctas"
};
/**
* @see \App\Http\Controllers\Admin\CtaRuleController::index
* @see app/Http/Controllers/Admin/CtaRuleController.php:12
* @route '/app/agents/{agent}/ctas'
*/
index$18.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { agent: args };
	if (typeof args === "object" && !Array.isArray(args) && "id" in args) args = { agent: args.id };
	if (Array.isArray(args)) args = { agent: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { agent: typeof args.agent === "object" ? args.agent.id : args.agent };
	return index$18.definition.url.replace("{agent}", parsedArgs.agent.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\CtaRuleController::index
* @see app/Http/Controllers/Admin/CtaRuleController.php:12
* @route '/app/agents/{agent}/ctas'
*/
index$18.get = (args, options) => ({
	url: index$18.url(args, options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\CtaRuleController::index
* @see app/Http/Controllers/Admin/CtaRuleController.php:12
* @route '/app/agents/{agent}/ctas'
*/
index$18.head = (args, options) => ({
	url: index$18.url(args, options),
	method: "head"
});
/**
* @see \App\Http\Controllers\Admin\CtaRuleController::index
* @see app/Http/Controllers/Admin/CtaRuleController.php:12
* @route '/app/agents/{agent}/ctas'
*/
var indexForm$18 = (args, options) => ({
	action: index$18.url(args, options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\CtaRuleController::index
* @see app/Http/Controllers/Admin/CtaRuleController.php:12
* @route '/app/agents/{agent}/ctas'
*/
indexForm$18.get = (args, options) => ({
	action: index$18.url(args, options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\CtaRuleController::index
* @see app/Http/Controllers/Admin/CtaRuleController.php:12
* @route '/app/agents/{agent}/ctas'
*/
indexForm$18.head = (args, options) => ({
	action: index$18.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
index$18.form = indexForm$18;
/**
* @see \App\Http\Controllers\Admin\CtaRuleController::store
* @see app/Http/Controllers/Admin/CtaRuleController.php:22
* @route '/app/agents/{agent}/ctas'
*/
var store$16 = (args, options) => ({
	url: store$16.url(args, options),
	method: "post"
});
store$16.definition = {
	methods: ["post"],
	url: "/app/agents/{agent}/ctas"
};
/**
* @see \App\Http\Controllers\Admin\CtaRuleController::store
* @see app/Http/Controllers/Admin/CtaRuleController.php:22
* @route '/app/agents/{agent}/ctas'
*/
store$16.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { agent: args };
	if (typeof args === "object" && !Array.isArray(args) && "id" in args) args = { agent: args.id };
	if (Array.isArray(args)) args = { agent: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { agent: typeof args.agent === "object" ? args.agent.id : args.agent };
	return store$16.definition.url.replace("{agent}", parsedArgs.agent.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\CtaRuleController::store
* @see app/Http/Controllers/Admin/CtaRuleController.php:22
* @route '/app/agents/{agent}/ctas'
*/
store$16.post = (args, options) => ({
	url: store$16.url(args, options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\CtaRuleController::store
* @see app/Http/Controllers/Admin/CtaRuleController.php:22
* @route '/app/agents/{agent}/ctas'
*/
var storeForm$16 = (args, options) => ({
	action: store$16.url(args, options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\CtaRuleController::store
* @see app/Http/Controllers/Admin/CtaRuleController.php:22
* @route '/app/agents/{agent}/ctas'
*/
storeForm$16.post = (args, options) => ({
	action: store$16.url(args, options),
	method: "post"
});
store$16.form = storeForm$16;
var ctas = {
	index: Object.assign(index$18, index$18),
	store: Object.assign(store$16, store$16)
};
//#endregion
//#region resources/js/routes/agents/knowledge/index.ts
/**
* @see \App\Http\Controllers\Admin\KnowledgeController::index
* @see app/Http/Controllers/Admin/KnowledgeController.php:29
* @route '/app/agents/{agent}/knowledge'
*/
var index$17 = (args, options) => ({
	url: index$17.url(args, options),
	method: "get"
});
index$17.definition = {
	methods: ["get", "head"],
	url: "/app/agents/{agent}/knowledge"
};
/**
* @see \App\Http\Controllers\Admin\KnowledgeController::index
* @see app/Http/Controllers/Admin/KnowledgeController.php:29
* @route '/app/agents/{agent}/knowledge'
*/
index$17.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { agent: args };
	if (typeof args === "object" && !Array.isArray(args) && "id" in args) args = { agent: args.id };
	if (Array.isArray(args)) args = { agent: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { agent: typeof args.agent === "object" ? args.agent.id : args.agent };
	return index$17.definition.url.replace("{agent}", parsedArgs.agent.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\KnowledgeController::index
* @see app/Http/Controllers/Admin/KnowledgeController.php:29
* @route '/app/agents/{agent}/knowledge'
*/
index$17.get = (args, options) => ({
	url: index$17.url(args, options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\KnowledgeController::index
* @see app/Http/Controllers/Admin/KnowledgeController.php:29
* @route '/app/agents/{agent}/knowledge'
*/
index$17.head = (args, options) => ({
	url: index$17.url(args, options),
	method: "head"
});
/**
* @see \App\Http\Controllers\Admin\KnowledgeController::index
* @see app/Http/Controllers/Admin/KnowledgeController.php:29
* @route '/app/agents/{agent}/knowledge'
*/
var indexForm$17 = (args, options) => ({
	action: index$17.url(args, options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\KnowledgeController::index
* @see app/Http/Controllers/Admin/KnowledgeController.php:29
* @route '/app/agents/{agent}/knowledge'
*/
indexForm$17.get = (args, options) => ({
	action: index$17.url(args, options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\KnowledgeController::index
* @see app/Http/Controllers/Admin/KnowledgeController.php:29
* @route '/app/agents/{agent}/knowledge'
*/
indexForm$17.head = (args, options) => ({
	action: index$17.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
index$17.form = indexForm$17;
var knowledge = { index: Object.assign(index$17, index$17) };
//#endregion
//#region resources/js/routes/agents/conversations/index.ts
/**
* @see \App\Http\Controllers\Admin\ConversationController::index
* @see app/Http/Controllers/Admin/ConversationController.php:225
* @route '/app/agents/{agent}/conversations'
*/
var index$16 = (args, options) => ({
	url: index$16.url(args, options),
	method: "get"
});
index$16.definition = {
	methods: ["get", "head"],
	url: "/app/agents/{agent}/conversations"
};
/**
* @see \App\Http\Controllers\Admin\ConversationController::index
* @see app/Http/Controllers/Admin/ConversationController.php:225
* @route '/app/agents/{agent}/conversations'
*/
index$16.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { agent: args };
	if (typeof args === "object" && !Array.isArray(args) && "id" in args) args = { agent: args.id };
	if (Array.isArray(args)) args = { agent: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { agent: typeof args.agent === "object" ? args.agent.id : args.agent };
	return index$16.definition.url.replace("{agent}", parsedArgs.agent.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\ConversationController::index
* @see app/Http/Controllers/Admin/ConversationController.php:225
* @route '/app/agents/{agent}/conversations'
*/
index$16.get = (args, options) => ({
	url: index$16.url(args, options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\ConversationController::index
* @see app/Http/Controllers/Admin/ConversationController.php:225
* @route '/app/agents/{agent}/conversations'
*/
index$16.head = (args, options) => ({
	url: index$16.url(args, options),
	method: "head"
});
/**
* @see \App\Http\Controllers\Admin\ConversationController::index
* @see app/Http/Controllers/Admin/ConversationController.php:225
* @route '/app/agents/{agent}/conversations'
*/
var indexForm$16 = (args, options) => ({
	action: index$16.url(args, options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\ConversationController::index
* @see app/Http/Controllers/Admin/ConversationController.php:225
* @route '/app/agents/{agent}/conversations'
*/
indexForm$16.get = (args, options) => ({
	action: index$16.url(args, options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\ConversationController::index
* @see app/Http/Controllers/Admin/ConversationController.php:225
* @route '/app/agents/{agent}/conversations'
*/
indexForm$16.head = (args, options) => ({
	action: index$16.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
index$16.form = indexForm$16;
var conversations$1 = { index: Object.assign(index$16, index$16) };
//#endregion
//#region resources/js/routes/agents/sources/index.ts
/**
* @see \App\Http\Controllers\Admin\SourceController::index
* @see app/Http/Controllers/Admin/SourceController.php:63
* @route '/app/agents/{agent}/sources'
*/
var index$15 = (args, options) => ({
	url: index$15.url(args, options),
	method: "get"
});
index$15.definition = {
	methods: ["get", "head"],
	url: "/app/agents/{agent}/sources"
};
/**
* @see \App\Http\Controllers\Admin\SourceController::index
* @see app/Http/Controllers/Admin/SourceController.php:63
* @route '/app/agents/{agent}/sources'
*/
index$15.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { agent: args };
	if (typeof args === "object" && !Array.isArray(args) && "id" in args) args = { agent: args.id };
	if (Array.isArray(args)) args = { agent: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { agent: typeof args.agent === "object" ? args.agent.id : args.agent };
	return index$15.definition.url.replace("{agent}", parsedArgs.agent.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\SourceController::index
* @see app/Http/Controllers/Admin/SourceController.php:63
* @route '/app/agents/{agent}/sources'
*/
index$15.get = (args, options) => ({
	url: index$15.url(args, options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\SourceController::index
* @see app/Http/Controllers/Admin/SourceController.php:63
* @route '/app/agents/{agent}/sources'
*/
index$15.head = (args, options) => ({
	url: index$15.url(args, options),
	method: "head"
});
/**
* @see \App\Http\Controllers\Admin\SourceController::index
* @see app/Http/Controllers/Admin/SourceController.php:63
* @route '/app/agents/{agent}/sources'
*/
var indexForm$15 = (args, options) => ({
	action: index$15.url(args, options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\SourceController::index
* @see app/Http/Controllers/Admin/SourceController.php:63
* @route '/app/agents/{agent}/sources'
*/
indexForm$15.get = (args, options) => ({
	action: index$15.url(args, options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\SourceController::index
* @see app/Http/Controllers/Admin/SourceController.php:63
* @route '/app/agents/{agent}/sources'
*/
indexForm$15.head = (args, options) => ({
	action: index$15.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
index$15.form = indexForm$15;
/**
* @see \App\Http\Controllers\Admin\SourceController::store
* @see app/Http/Controllers/Admin/SourceController.php:281
* @route '/app/agents/{agent}/sources'
*/
var store$15 = (args, options) => ({
	url: store$15.url(args, options),
	method: "post"
});
store$15.definition = {
	methods: ["post"],
	url: "/app/agents/{agent}/sources"
};
/**
* @see \App\Http\Controllers\Admin\SourceController::store
* @see app/Http/Controllers/Admin/SourceController.php:281
* @route '/app/agents/{agent}/sources'
*/
store$15.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { agent: args };
	if (typeof args === "object" && !Array.isArray(args) && "id" in args) args = { agent: args.id };
	if (Array.isArray(args)) args = { agent: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { agent: typeof args.agent === "object" ? args.agent.id : args.agent };
	return store$15.definition.url.replace("{agent}", parsedArgs.agent.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\SourceController::store
* @see app/Http/Controllers/Admin/SourceController.php:281
* @route '/app/agents/{agent}/sources'
*/
store$15.post = (args, options) => ({
	url: store$15.url(args, options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\SourceController::store
* @see app/Http/Controllers/Admin/SourceController.php:281
* @route '/app/agents/{agent}/sources'
*/
var storeForm$15 = (args, options) => ({
	action: store$15.url(args, options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\SourceController::store
* @see app/Http/Controllers/Admin/SourceController.php:281
* @route '/app/agents/{agent}/sources'
*/
storeForm$15.post = (args, options) => ({
	action: store$15.url(args, options),
	method: "post"
});
store$15.form = storeForm$15;
/**
* @see \App\Http\Controllers\Admin\SourceController::discover
* @see app/Http/Controllers/Admin/SourceController.php:802
* @route '/app/agents/{agent}/sources/discover'
*/
var discover = (args, options) => ({
	url: discover.url(args, options),
	method: "post"
});
discover.definition = {
	methods: ["post"],
	url: "/app/agents/{agent}/sources/discover"
};
/**
* @see \App\Http\Controllers\Admin\SourceController::discover
* @see app/Http/Controllers/Admin/SourceController.php:802
* @route '/app/agents/{agent}/sources/discover'
*/
discover.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { agent: args };
	if (typeof args === "object" && !Array.isArray(args) && "id" in args) args = { agent: args.id };
	if (Array.isArray(args)) args = { agent: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { agent: typeof args.agent === "object" ? args.agent.id : args.agent };
	return discover.definition.url.replace("{agent}", parsedArgs.agent.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\SourceController::discover
* @see app/Http/Controllers/Admin/SourceController.php:802
* @route '/app/agents/{agent}/sources/discover'
*/
discover.post = (args, options) => ({
	url: discover.url(args, options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\SourceController::discover
* @see app/Http/Controllers/Admin/SourceController.php:802
* @route '/app/agents/{agent}/sources/discover'
*/
var discoverForm = (args, options) => ({
	action: discover.url(args, options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\SourceController::discover
* @see app/Http/Controllers/Admin/SourceController.php:802
* @route '/app/agents/{agent}/sources/discover'
*/
discoverForm.post = (args, options) => ({
	action: discover.url(args, options),
	method: "post"
});
discover.form = discoverForm;
/**
* @see \App\Http\Controllers\Admin\SourceController::bulk
* @see app/Http/Controllers/Admin/SourceController.php:828
* @route '/app/agents/{agent}/sources/bulk'
*/
var bulk = (args, options) => ({
	url: bulk.url(args, options),
	method: "post"
});
bulk.definition = {
	methods: ["post"],
	url: "/app/agents/{agent}/sources/bulk"
};
/**
* @see \App\Http\Controllers\Admin\SourceController::bulk
* @see app/Http/Controllers/Admin/SourceController.php:828
* @route '/app/agents/{agent}/sources/bulk'
*/
bulk.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { agent: args };
	if (typeof args === "object" && !Array.isArray(args) && "id" in args) args = { agent: args.id };
	if (Array.isArray(args)) args = { agent: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { agent: typeof args.agent === "object" ? args.agent.id : args.agent };
	return bulk.definition.url.replace("{agent}", parsedArgs.agent.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\SourceController::bulk
* @see app/Http/Controllers/Admin/SourceController.php:828
* @route '/app/agents/{agent}/sources/bulk'
*/
bulk.post = (args, options) => ({
	url: bulk.url(args, options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\SourceController::bulk
* @see app/Http/Controllers/Admin/SourceController.php:828
* @route '/app/agents/{agent}/sources/bulk'
*/
var bulkForm = (args, options) => ({
	action: bulk.url(args, options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\SourceController::bulk
* @see app/Http/Controllers/Admin/SourceController.php:828
* @route '/app/agents/{agent}/sources/bulk'
*/
bulkForm.post = (args, options) => ({
	action: bulk.url(args, options),
	method: "post"
});
bulk.form = bulkForm;
/**
* @see \App\Http\Controllers\Admin\SourceController::text
* @see app/Http/Controllers/Admin/SourceController.php:453
* @route '/app/agents/{agent}/sources/text'
*/
var text$1 = (args, options) => ({
	url: text$1.url(args, options),
	method: "post"
});
text$1.definition = {
	methods: ["post"],
	url: "/app/agents/{agent}/sources/text"
};
/**
* @see \App\Http\Controllers\Admin\SourceController::text
* @see app/Http/Controllers/Admin/SourceController.php:453
* @route '/app/agents/{agent}/sources/text'
*/
text$1.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { agent: args };
	if (typeof args === "object" && !Array.isArray(args) && "id" in args) args = { agent: args.id };
	if (Array.isArray(args)) args = { agent: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { agent: typeof args.agent === "object" ? args.agent.id : args.agent };
	return text$1.definition.url.replace("{agent}", parsedArgs.agent.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\SourceController::text
* @see app/Http/Controllers/Admin/SourceController.php:453
* @route '/app/agents/{agent}/sources/text'
*/
text$1.post = (args, options) => ({
	url: text$1.url(args, options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\SourceController::text
* @see app/Http/Controllers/Admin/SourceController.php:453
* @route '/app/agents/{agent}/sources/text'
*/
var textForm = (args, options) => ({
	action: text$1.url(args, options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\SourceController::text
* @see app/Http/Controllers/Admin/SourceController.php:453
* @route '/app/agents/{agent}/sources/text'
*/
textForm.post = (args, options) => ({
	action: text$1.url(args, options),
	method: "post"
});
text$1.form = textForm;
/**
* @see \App\Http\Controllers\Admin\SourceController::notion
* @see app/Http/Controllers/Admin/SourceController.php:533
* @route '/app/agents/{agent}/sources/notion'
*/
var notion$1 = (args, options) => ({
	url: notion$1.url(args, options),
	method: "post"
});
notion$1.definition = {
	methods: ["post"],
	url: "/app/agents/{agent}/sources/notion"
};
/**
* @see \App\Http\Controllers\Admin\SourceController::notion
* @see app/Http/Controllers/Admin/SourceController.php:533
* @route '/app/agents/{agent}/sources/notion'
*/
notion$1.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { agent: args };
	if (typeof args === "object" && !Array.isArray(args) && "id" in args) args = { agent: args.id };
	if (Array.isArray(args)) args = { agent: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { agent: typeof args.agent === "object" ? args.agent.id : args.agent };
	return notion$1.definition.url.replace("{agent}", parsedArgs.agent.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\SourceController::notion
* @see app/Http/Controllers/Admin/SourceController.php:533
* @route '/app/agents/{agent}/sources/notion'
*/
notion$1.post = (args, options) => ({
	url: notion$1.url(args, options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\SourceController::notion
* @see app/Http/Controllers/Admin/SourceController.php:533
* @route '/app/agents/{agent}/sources/notion'
*/
var notionForm = (args, options) => ({
	action: notion$1.url(args, options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\SourceController::notion
* @see app/Http/Controllers/Admin/SourceController.php:533
* @route '/app/agents/{agent}/sources/notion'
*/
notionForm.post = (args, options) => ({
	action: notion$1.url(args, options),
	method: "post"
});
notion$1.form = notionForm;
/**
* @see \App\Http\Controllers\Admin\SourceController::googleDoc
* @see app/Http/Controllers/Admin/SourceController.php:577
* @route '/app/agents/{agent}/sources/google-doc'
*/
var googleDoc = (args, options) => ({
	url: googleDoc.url(args, options),
	method: "post"
});
googleDoc.definition = {
	methods: ["post"],
	url: "/app/agents/{agent}/sources/google-doc"
};
/**
* @see \App\Http\Controllers\Admin\SourceController::googleDoc
* @see app/Http/Controllers/Admin/SourceController.php:577
* @route '/app/agents/{agent}/sources/google-doc'
*/
googleDoc.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { agent: args };
	if (typeof args === "object" && !Array.isArray(args) && "id" in args) args = { agent: args.id };
	if (Array.isArray(args)) args = { agent: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { agent: typeof args.agent === "object" ? args.agent.id : args.agent };
	return googleDoc.definition.url.replace("{agent}", parsedArgs.agent.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\SourceController::googleDoc
* @see app/Http/Controllers/Admin/SourceController.php:577
* @route '/app/agents/{agent}/sources/google-doc'
*/
googleDoc.post = (args, options) => ({
	url: googleDoc.url(args, options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\SourceController::googleDoc
* @see app/Http/Controllers/Admin/SourceController.php:577
* @route '/app/agents/{agent}/sources/google-doc'
*/
var googleDocForm = (args, options) => ({
	action: googleDoc.url(args, options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\SourceController::googleDoc
* @see app/Http/Controllers/Admin/SourceController.php:577
* @route '/app/agents/{agent}/sources/google-doc'
*/
googleDocForm.post = (args, options) => ({
	action: googleDoc.url(args, options),
	method: "post"
});
googleDoc.form = googleDocForm;
/**
* @see \App\Http\Controllers\Admin\SourceController::googleSheet
* @see app/Http/Controllers/Admin/SourceController.php:705
* @route '/app/agents/{agent}/sources/google-sheet'
*/
var googleSheet = (args, options) => ({
	url: googleSheet.url(args, options),
	method: "post"
});
googleSheet.definition = {
	methods: ["post"],
	url: "/app/agents/{agent}/sources/google-sheet"
};
/**
* @see \App\Http\Controllers\Admin\SourceController::googleSheet
* @see app/Http/Controllers/Admin/SourceController.php:705
* @route '/app/agents/{agent}/sources/google-sheet'
*/
googleSheet.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { agent: args };
	if (typeof args === "object" && !Array.isArray(args) && "id" in args) args = { agent: args.id };
	if (Array.isArray(args)) args = { agent: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { agent: typeof args.agent === "object" ? args.agent.id : args.agent };
	return googleSheet.definition.url.replace("{agent}", parsedArgs.agent.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\SourceController::googleSheet
* @see app/Http/Controllers/Admin/SourceController.php:705
* @route '/app/agents/{agent}/sources/google-sheet'
*/
googleSheet.post = (args, options) => ({
	url: googleSheet.url(args, options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\SourceController::googleSheet
* @see app/Http/Controllers/Admin/SourceController.php:705
* @route '/app/agents/{agent}/sources/google-sheet'
*/
var googleSheetForm = (args, options) => ({
	action: googleSheet.url(args, options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\SourceController::googleSheet
* @see app/Http/Controllers/Admin/SourceController.php:705
* @route '/app/agents/{agent}/sources/google-sheet'
*/
googleSheetForm.post = (args, options) => ({
	action: googleSheet.url(args, options),
	method: "post"
});
googleSheet.form = googleSheetForm;
/**
* @see \App\Http\Controllers\Admin\SourceController::googleSheetMetadata
* @see app/Http/Controllers/Admin/SourceController.php:649
* @route '/app/agents/{agent}/sources/google-sheet/metadata'
*/
var googleSheetMetadata = (args, options) => ({
	url: googleSheetMetadata.url(args, options),
	method: "post"
});
googleSheetMetadata.definition = {
	methods: ["post"],
	url: "/app/agents/{agent}/sources/google-sheet/metadata"
};
/**
* @see \App\Http\Controllers\Admin\SourceController::googleSheetMetadata
* @see app/Http/Controllers/Admin/SourceController.php:649
* @route '/app/agents/{agent}/sources/google-sheet/metadata'
*/
googleSheetMetadata.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { agent: args };
	if (typeof args === "object" && !Array.isArray(args) && "id" in args) args = { agent: args.id };
	if (Array.isArray(args)) args = { agent: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { agent: typeof args.agent === "object" ? args.agent.id : args.agent };
	return googleSheetMetadata.definition.url.replace("{agent}", parsedArgs.agent.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\SourceController::googleSheetMetadata
* @see app/Http/Controllers/Admin/SourceController.php:649
* @route '/app/agents/{agent}/sources/google-sheet/metadata'
*/
googleSheetMetadata.post = (args, options) => ({
	url: googleSheetMetadata.url(args, options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\SourceController::googleSheetMetadata
* @see app/Http/Controllers/Admin/SourceController.php:649
* @route '/app/agents/{agent}/sources/google-sheet/metadata'
*/
var googleSheetMetadataForm = (args, options) => ({
	action: googleSheetMetadata.url(args, options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\SourceController::googleSheetMetadata
* @see app/Http/Controllers/Admin/SourceController.php:649
* @route '/app/agents/{agent}/sources/google-sheet/metadata'
*/
googleSheetMetadataForm.post = (args, options) => ({
	action: googleSheetMetadata.url(args, options),
	method: "post"
});
googleSheetMetadata.form = googleSheetMetadataForm;
/**
* @see \App\Http\Controllers\Admin\SourceController::sql
* @see app/Http/Controllers/Admin/SourceController.php:401
* @route '/app/agents/{agent}/sources/sql'
*/
var sql = (args, options) => ({
	url: sql.url(args, options),
	method: "post"
});
sql.definition = {
	methods: ["post"],
	url: "/app/agents/{agent}/sources/sql"
};
/**
* @see \App\Http\Controllers\Admin\SourceController::sql
* @see app/Http/Controllers/Admin/SourceController.php:401
* @route '/app/agents/{agent}/sources/sql'
*/
sql.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { agent: args };
	if (typeof args === "object" && !Array.isArray(args) && "id" in args) args = { agent: args.id };
	if (Array.isArray(args)) args = { agent: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { agent: typeof args.agent === "object" ? args.agent.id : args.agent };
	return sql.definition.url.replace("{agent}", parsedArgs.agent.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\SourceController::sql
* @see app/Http/Controllers/Admin/SourceController.php:401
* @route '/app/agents/{agent}/sources/sql'
*/
sql.post = (args, options) => ({
	url: sql.url(args, options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\SourceController::sql
* @see app/Http/Controllers/Admin/SourceController.php:401
* @route '/app/agents/{agent}/sources/sql'
*/
var sqlForm = (args, options) => ({
	action: sql.url(args, options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\SourceController::sql
* @see app/Http/Controllers/Admin/SourceController.php:401
* @route '/app/agents/{agent}/sources/sql'
*/
sqlForm.post = (args, options) => ({
	action: sql.url(args, options),
	method: "post"
});
sql.form = sqlForm;
var sources$1 = {
	index: Object.assign(index$15, index$15),
	store: Object.assign(store$15, store$15),
	discover: Object.assign(discover, discover),
	bulk: Object.assign(bulk, bulk),
	text: Object.assign(text$1, text$1),
	notion: Object.assign(notion$1, notion$1),
	googleDoc: Object.assign(googleDoc, googleDoc),
	googleSheet: Object.assign(googleSheet, googleSheet),
	googleSheetMetadata: Object.assign(googleSheetMetadata, googleSheetMetadata),
	sql: Object.assign(sql, sql)
};
//#endregion
//#region resources/js/routes/agents/leads/index.ts
/**
* @see \App\Http\Controllers\Admin\LeadController::index
* @see app/Http/Controllers/Admin/LeadController.php:15
* @route '/app/agents/{agent}/leads'
*/
var index$14 = (args, options) => ({
	url: index$14.url(args, options),
	method: "get"
});
index$14.definition = {
	methods: ["get", "head"],
	url: "/app/agents/{agent}/leads"
};
/**
* @see \App\Http\Controllers\Admin\LeadController::index
* @see app/Http/Controllers/Admin/LeadController.php:15
* @route '/app/agents/{agent}/leads'
*/
index$14.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { agent: args };
	if (typeof args === "object" && !Array.isArray(args) && "id" in args) args = { agent: args.id };
	if (Array.isArray(args)) args = { agent: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { agent: typeof args.agent === "object" ? args.agent.id : args.agent };
	return index$14.definition.url.replace("{agent}", parsedArgs.agent.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\LeadController::index
* @see app/Http/Controllers/Admin/LeadController.php:15
* @route '/app/agents/{agent}/leads'
*/
index$14.get = (args, options) => ({
	url: index$14.url(args, options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\LeadController::index
* @see app/Http/Controllers/Admin/LeadController.php:15
* @route '/app/agents/{agent}/leads'
*/
index$14.head = (args, options) => ({
	url: index$14.url(args, options),
	method: "head"
});
/**
* @see \App\Http\Controllers\Admin\LeadController::index
* @see app/Http/Controllers/Admin/LeadController.php:15
* @route '/app/agents/{agent}/leads'
*/
var indexForm$14 = (args, options) => ({
	action: index$14.url(args, options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\LeadController::index
* @see app/Http/Controllers/Admin/LeadController.php:15
* @route '/app/agents/{agent}/leads'
*/
indexForm$14.get = (args, options) => ({
	action: index$14.url(args, options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\LeadController::index
* @see app/Http/Controllers/Admin/LeadController.php:15
* @route '/app/agents/{agent}/leads'
*/
indexForm$14.head = (args, options) => ({
	action: index$14.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
index$14.form = indexForm$14;
var leads = { index: Object.assign(index$14, index$14) };
//#endregion
//#region resources/js/routes/agents/uploads/index.ts
/**
* @see \App\Http\Controllers\Admin\UploadController::store
* @see app/Http/Controllers/Admin/UploadController.php:37
* @route '/app/agents/{agent}/uploads'
*/
var store$14 = (args, options) => ({
	url: store$14.url(args, options),
	method: "post"
});
store$14.definition = {
	methods: ["post"],
	url: "/app/agents/{agent}/uploads"
};
/**
* @see \App\Http\Controllers\Admin\UploadController::store
* @see app/Http/Controllers/Admin/UploadController.php:37
* @route '/app/agents/{agent}/uploads'
*/
store$14.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { agent: args };
	if (typeof args === "object" && !Array.isArray(args) && "id" in args) args = { agent: args.id };
	if (Array.isArray(args)) args = { agent: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { agent: typeof args.agent === "object" ? args.agent.id : args.agent };
	return store$14.definition.url.replace("{agent}", parsedArgs.agent.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\UploadController::store
* @see app/Http/Controllers/Admin/UploadController.php:37
* @route '/app/agents/{agent}/uploads'
*/
store$14.post = (args, options) => ({
	url: store$14.url(args, options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\UploadController::store
* @see app/Http/Controllers/Admin/UploadController.php:37
* @route '/app/agents/{agent}/uploads'
*/
var storeForm$14 = (args, options) => ({
	action: store$14.url(args, options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\UploadController::store
* @see app/Http/Controllers/Admin/UploadController.php:37
* @route '/app/agents/{agent}/uploads'
*/
storeForm$14.post = (args, options) => ({
	action: store$14.url(args, options),
	method: "post"
});
store$14.form = storeForm$14;
var uploads = { store: Object.assign(store$14, store$14) };
//#endregion
//#region resources/js/routes/agents/launcher-icon/index.ts
/**
* @see \App\Http\Controllers\Admin\AgentLauncherIconController::store
* @see app/Http/Controllers/Admin/AgentLauncherIconController.php:16
* @route '/app/agents/{agent}/launcher-icon'
*/
var store$13 = (args, options) => ({
	url: store$13.url(args, options),
	method: "post"
});
store$13.definition = {
	methods: ["post"],
	url: "/app/agents/{agent}/launcher-icon"
};
/**
* @see \App\Http\Controllers\Admin\AgentLauncherIconController::store
* @see app/Http/Controllers/Admin/AgentLauncherIconController.php:16
* @route '/app/agents/{agent}/launcher-icon'
*/
store$13.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { agent: args };
	if (typeof args === "object" && !Array.isArray(args) && "id" in args) args = { agent: args.id };
	if (Array.isArray(args)) args = { agent: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { agent: typeof args.agent === "object" ? args.agent.id : args.agent };
	return store$13.definition.url.replace("{agent}", parsedArgs.agent.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\AgentLauncherIconController::store
* @see app/Http/Controllers/Admin/AgentLauncherIconController.php:16
* @route '/app/agents/{agent}/launcher-icon'
*/
store$13.post = (args, options) => ({
	url: store$13.url(args, options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\AgentLauncherIconController::store
* @see app/Http/Controllers/Admin/AgentLauncherIconController.php:16
* @route '/app/agents/{agent}/launcher-icon'
*/
var storeForm$13 = (args, options) => ({
	action: store$13.url(args, options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\AgentLauncherIconController::store
* @see app/Http/Controllers/Admin/AgentLauncherIconController.php:16
* @route '/app/agents/{agent}/launcher-icon'
*/
storeForm$13.post = (args, options) => ({
	action: store$13.url(args, options),
	method: "post"
});
store$13.form = storeForm$13;
/**
* @see \App\Http\Controllers\Admin\AgentLauncherIconController::destroy
* @see app/Http/Controllers/Admin/AgentLauncherIconController.php:50
* @route '/app/agents/{agent}/launcher-icon'
*/
var destroy$13 = (args, options) => ({
	url: destroy$13.url(args, options),
	method: "delete"
});
destroy$13.definition = {
	methods: ["delete"],
	url: "/app/agents/{agent}/launcher-icon"
};
/**
* @see \App\Http\Controllers\Admin\AgentLauncherIconController::destroy
* @see app/Http/Controllers/Admin/AgentLauncherIconController.php:50
* @route '/app/agents/{agent}/launcher-icon'
*/
destroy$13.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { agent: args };
	if (typeof args === "object" && !Array.isArray(args) && "id" in args) args = { agent: args.id };
	if (Array.isArray(args)) args = { agent: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { agent: typeof args.agent === "object" ? args.agent.id : args.agent };
	return destroy$13.definition.url.replace("{agent}", parsedArgs.agent.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\AgentLauncherIconController::destroy
* @see app/Http/Controllers/Admin/AgentLauncherIconController.php:50
* @route '/app/agents/{agent}/launcher-icon'
*/
destroy$13.delete = (args, options) => ({
	url: destroy$13.url(args, options),
	method: "delete"
});
/**
* @see \App\Http\Controllers\Admin\AgentLauncherIconController::destroy
* @see app/Http/Controllers/Admin/AgentLauncherIconController.php:50
* @route '/app/agents/{agent}/launcher-icon'
*/
var destroyForm$13 = (args, options) => ({
	action: destroy$13.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "DELETE",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\AgentLauncherIconController::destroy
* @see app/Http/Controllers/Admin/AgentLauncherIconController.php:50
* @route '/app/agents/{agent}/launcher-icon'
*/
destroyForm$13.delete = (args, options) => ({
	action: destroy$13.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "DELETE",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
destroy$13.form = destroyForm$13;
var launcherIcon = {
	store: Object.assign(store$13, store$13),
	destroy: Object.assign(destroy$13, destroy$13)
};
//#endregion
//#region resources/js/routes/agents/playground/index.ts
/**
* @see \App\Http\Controllers\Admin\PlaygroundController::send
* @see app/Http/Controllers/Admin/PlaygroundController.php:57
* @route '/app/agents/{agent}/playground'
*/
var send$1 = (args, options) => ({
	url: send$1.url(args, options),
	method: "post"
});
send$1.definition = {
	methods: ["post"],
	url: "/app/agents/{agent}/playground"
};
/**
* @see \App\Http\Controllers\Admin\PlaygroundController::send
* @see app/Http/Controllers/Admin/PlaygroundController.php:57
* @route '/app/agents/{agent}/playground'
*/
send$1.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { agent: args };
	if (typeof args === "object" && !Array.isArray(args) && "id" in args) args = { agent: args.id };
	if (Array.isArray(args)) args = { agent: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { agent: typeof args.agent === "object" ? args.agent.id : args.agent };
	return send$1.definition.url.replace("{agent}", parsedArgs.agent.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\PlaygroundController::send
* @see app/Http/Controllers/Admin/PlaygroundController.php:57
* @route '/app/agents/{agent}/playground'
*/
send$1.post = (args, options) => ({
	url: send$1.url(args, options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\PlaygroundController::send
* @see app/Http/Controllers/Admin/PlaygroundController.php:57
* @route '/app/agents/{agent}/playground'
*/
var sendForm$1 = (args, options) => ({
	action: send$1.url(args, options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\PlaygroundController::send
* @see app/Http/Controllers/Admin/PlaygroundController.php:57
* @route '/app/agents/{agent}/playground'
*/
sendForm$1.post = (args, options) => ({
	action: send$1.url(args, options),
	method: "post"
});
send$1.form = sendForm$1;
/**
* @see \App\Http\Controllers\Admin\PlaygroundStreamController::__invoke
* @see app/Http/Controllers/Admin/PlaygroundStreamController.php:60
* @route '/app/agents/{agent}/playground/stream'
*/
var stream = (args, options) => ({
	url: stream.url(args, options),
	method: "post"
});
stream.definition = {
	methods: ["post"],
	url: "/app/agents/{agent}/playground/stream"
};
/**
* @see \App\Http\Controllers\Admin\PlaygroundStreamController::__invoke
* @see app/Http/Controllers/Admin/PlaygroundStreamController.php:60
* @route '/app/agents/{agent}/playground/stream'
*/
stream.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { agent: args };
	if (typeof args === "object" && !Array.isArray(args) && "id" in args) args = { agent: args.id };
	if (Array.isArray(args)) args = { agent: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { agent: typeof args.agent === "object" ? args.agent.id : args.agent };
	return stream.definition.url.replace("{agent}", parsedArgs.agent.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\PlaygroundStreamController::__invoke
* @see app/Http/Controllers/Admin/PlaygroundStreamController.php:60
* @route '/app/agents/{agent}/playground/stream'
*/
stream.post = (args, options) => ({
	url: stream.url(args, options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\PlaygroundStreamController::__invoke
* @see app/Http/Controllers/Admin/PlaygroundStreamController.php:60
* @route '/app/agents/{agent}/playground/stream'
*/
var streamForm = (args, options) => ({
	action: stream.url(args, options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\PlaygroundStreamController::__invoke
* @see app/Http/Controllers/Admin/PlaygroundStreamController.php:60
* @route '/app/agents/{agent}/playground/stream'
*/
streamForm.post = (args, options) => ({
	action: stream.url(args, options),
	method: "post"
});
stream.form = streamForm;
/**
* @see \App\Http\Controllers\Admin\PlaygroundController::reset
* @see app/Http/Controllers/Admin/PlaygroundController.php:101
* @route '/app/agents/{agent}/playground/reset'
*/
var reset$1 = (args, options) => ({
	url: reset$1.url(args, options),
	method: "post"
});
reset$1.definition = {
	methods: ["post"],
	url: "/app/agents/{agent}/playground/reset"
};
/**
* @see \App\Http\Controllers\Admin\PlaygroundController::reset
* @see app/Http/Controllers/Admin/PlaygroundController.php:101
* @route '/app/agents/{agent}/playground/reset'
*/
reset$1.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { agent: args };
	if (typeof args === "object" && !Array.isArray(args) && "id" in args) args = { agent: args.id };
	if (Array.isArray(args)) args = { agent: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { agent: typeof args.agent === "object" ? args.agent.id : args.agent };
	return reset$1.definition.url.replace("{agent}", parsedArgs.agent.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\PlaygroundController::reset
* @see app/Http/Controllers/Admin/PlaygroundController.php:101
* @route '/app/agents/{agent}/playground/reset'
*/
reset$1.post = (args, options) => ({
	url: reset$1.url(args, options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\PlaygroundController::reset
* @see app/Http/Controllers/Admin/PlaygroundController.php:101
* @route '/app/agents/{agent}/playground/reset'
*/
var resetForm$1 = (args, options) => ({
	action: reset$1.url(args, options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\PlaygroundController::reset
* @see app/Http/Controllers/Admin/PlaygroundController.php:101
* @route '/app/agents/{agent}/playground/reset'
*/
resetForm$1.post = (args, options) => ({
	action: reset$1.url(args, options),
	method: "post"
});
reset$1.form = resetForm$1;
var playground$1 = {
	send: Object.assign(send$1, send$1),
	stream: Object.assign(stream, stream),
	reset: Object.assign(reset$1, reset$1)
};
//#endregion
//#region resources/js/routes/agents/experiments/index.ts
/**
* @see \App\Http\Controllers\Admin\ExperimentController::index
* @see app/Http/Controllers/Admin/ExperimentController.php:17
* @route '/app/agents/{agent}/experiments'
*/
var index$13 = (args, options) => ({
	url: index$13.url(args, options),
	method: "get"
});
index$13.definition = {
	methods: ["get", "head"],
	url: "/app/agents/{agent}/experiments"
};
/**
* @see \App\Http\Controllers\Admin\ExperimentController::index
* @see app/Http/Controllers/Admin/ExperimentController.php:17
* @route '/app/agents/{agent}/experiments'
*/
index$13.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { agent: args };
	if (typeof args === "object" && !Array.isArray(args) && "id" in args) args = { agent: args.id };
	if (Array.isArray(args)) args = { agent: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { agent: typeof args.agent === "object" ? args.agent.id : args.agent };
	return index$13.definition.url.replace("{agent}", parsedArgs.agent.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\ExperimentController::index
* @see app/Http/Controllers/Admin/ExperimentController.php:17
* @route '/app/agents/{agent}/experiments'
*/
index$13.get = (args, options) => ({
	url: index$13.url(args, options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\ExperimentController::index
* @see app/Http/Controllers/Admin/ExperimentController.php:17
* @route '/app/agents/{agent}/experiments'
*/
index$13.head = (args, options) => ({
	url: index$13.url(args, options),
	method: "head"
});
/**
* @see \App\Http\Controllers\Admin\ExperimentController::index
* @see app/Http/Controllers/Admin/ExperimentController.php:17
* @route '/app/agents/{agent}/experiments'
*/
var indexForm$13 = (args, options) => ({
	action: index$13.url(args, options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\ExperimentController::index
* @see app/Http/Controllers/Admin/ExperimentController.php:17
* @route '/app/agents/{agent}/experiments'
*/
indexForm$13.get = (args, options) => ({
	action: index$13.url(args, options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\ExperimentController::index
* @see app/Http/Controllers/Admin/ExperimentController.php:17
* @route '/app/agents/{agent}/experiments'
*/
indexForm$13.head = (args, options) => ({
	action: index$13.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
index$13.form = indexForm$13;
/**
* @see \App\Http\Controllers\Admin\ExperimentController::store
* @see app/Http/Controllers/Admin/ExperimentController.php:45
* @route '/app/agents/{agent}/experiments'
*/
var store$12 = (args, options) => ({
	url: store$12.url(args, options),
	method: "post"
});
store$12.definition = {
	methods: ["post"],
	url: "/app/agents/{agent}/experiments"
};
/**
* @see \App\Http\Controllers\Admin\ExperimentController::store
* @see app/Http/Controllers/Admin/ExperimentController.php:45
* @route '/app/agents/{agent}/experiments'
*/
store$12.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { agent: args };
	if (typeof args === "object" && !Array.isArray(args) && "id" in args) args = { agent: args.id };
	if (Array.isArray(args)) args = { agent: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { agent: typeof args.agent === "object" ? args.agent.id : args.agent };
	return store$12.definition.url.replace("{agent}", parsedArgs.agent.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\ExperimentController::store
* @see app/Http/Controllers/Admin/ExperimentController.php:45
* @route '/app/agents/{agent}/experiments'
*/
store$12.post = (args, options) => ({
	url: store$12.url(args, options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\ExperimentController::store
* @see app/Http/Controllers/Admin/ExperimentController.php:45
* @route '/app/agents/{agent}/experiments'
*/
var storeForm$12 = (args, options) => ({
	action: store$12.url(args, options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\ExperimentController::store
* @see app/Http/Controllers/Admin/ExperimentController.php:45
* @route '/app/agents/{agent}/experiments'
*/
storeForm$12.post = (args, options) => ({
	action: store$12.url(args, options),
	method: "post"
});
store$12.form = storeForm$12;
var experiments = {
	index: Object.assign(index$13, index$13),
	store: Object.assign(store$12, store$12)
};
//#endregion
//#region resources/js/routes/agents/index.ts
/**
* @see \App\Http\Controllers\Admin\AgentController::index
* @see app/Http/Controllers/Admin/AgentController.php:30
* @route '/app/agents'
*/
var index$12 = (options) => ({
	url: index$12.url(options),
	method: "get"
});
index$12.definition = {
	methods: ["get", "head"],
	url: "/app/agents"
};
/**
* @see \App\Http\Controllers\Admin\AgentController::index
* @see app/Http/Controllers/Admin/AgentController.php:30
* @route '/app/agents'
*/
index$12.url = (options) => {
	return index$12.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\AgentController::index
* @see app/Http/Controllers/Admin/AgentController.php:30
* @route '/app/agents'
*/
index$12.get = (options) => ({
	url: index$12.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\AgentController::index
* @see app/Http/Controllers/Admin/AgentController.php:30
* @route '/app/agents'
*/
index$12.head = (options) => ({
	url: index$12.url(options),
	method: "head"
});
/**
* @see \App\Http\Controllers\Admin\AgentController::index
* @see app/Http/Controllers/Admin/AgentController.php:30
* @route '/app/agents'
*/
var indexForm$12 = (options) => ({
	action: index$12.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\AgentController::index
* @see app/Http/Controllers/Admin/AgentController.php:30
* @route '/app/agents'
*/
indexForm$12.get = (options) => ({
	action: index$12.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\AgentController::index
* @see app/Http/Controllers/Admin/AgentController.php:30
* @route '/app/agents'
*/
indexForm$12.head = (options) => ({
	action: index$12.url({ [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
index$12.form = indexForm$12;
/**
* @see \App\Http\Controllers\Admin\AgentController::create
* @see app/Http/Controllers/Admin/AgentController.php:153
* @route '/app/agents/create'
*/
var create$1 = (options) => ({
	url: create$1.url(options),
	method: "get"
});
create$1.definition = {
	methods: ["get", "head"],
	url: "/app/agents/create"
};
/**
* @see \App\Http\Controllers\Admin\AgentController::create
* @see app/Http/Controllers/Admin/AgentController.php:153
* @route '/app/agents/create'
*/
create$1.url = (options) => {
	return create$1.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\AgentController::create
* @see app/Http/Controllers/Admin/AgentController.php:153
* @route '/app/agents/create'
*/
create$1.get = (options) => ({
	url: create$1.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\AgentController::create
* @see app/Http/Controllers/Admin/AgentController.php:153
* @route '/app/agents/create'
*/
create$1.head = (options) => ({
	url: create$1.url(options),
	method: "head"
});
/**
* @see \App\Http\Controllers\Admin\AgentController::create
* @see app/Http/Controllers/Admin/AgentController.php:153
* @route '/app/agents/create'
*/
var createForm$1 = (options) => ({
	action: create$1.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\AgentController::create
* @see app/Http/Controllers/Admin/AgentController.php:153
* @route '/app/agents/create'
*/
createForm$1.get = (options) => ({
	action: create$1.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\AgentController::create
* @see app/Http/Controllers/Admin/AgentController.php:153
* @route '/app/agents/create'
*/
createForm$1.head = (options) => ({
	action: create$1.url({ [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
create$1.form = createForm$1;
/**
* @see \App\Http\Controllers\Admin\AgentController::store
* @see app/Http/Controllers/Admin/AgentController.php:162
* @route '/app/agents'
*/
var store$11 = (options) => ({
	url: store$11.url(options),
	method: "post"
});
store$11.definition = {
	methods: ["post"],
	url: "/app/agents"
};
/**
* @see \App\Http\Controllers\Admin\AgentController::store
* @see app/Http/Controllers/Admin/AgentController.php:162
* @route '/app/agents'
*/
store$11.url = (options) => {
	return store$11.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\AgentController::store
* @see app/Http/Controllers/Admin/AgentController.php:162
* @route '/app/agents'
*/
store$11.post = (options) => ({
	url: store$11.url(options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\AgentController::store
* @see app/Http/Controllers/Admin/AgentController.php:162
* @route '/app/agents'
*/
var storeForm$11 = (options) => ({
	action: store$11.url(options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\AgentController::store
* @see app/Http/Controllers/Admin/AgentController.php:162
* @route '/app/agents'
*/
storeForm$11.post = (options) => ({
	action: store$11.url(options),
	method: "post"
});
store$11.form = storeForm$11;
/**
* @see \App\Http\Controllers\Admin\AgentController::show
* @see app/Http/Controllers/Admin/AgentController.php:222
* @route '/app/agents/{agent}'
*/
var show$4 = (args, options) => ({
	url: show$4.url(args, options),
	method: "get"
});
show$4.definition = {
	methods: ["get", "head"],
	url: "/app/agents/{agent}"
};
/**
* @see \App\Http\Controllers\Admin\AgentController::show
* @see app/Http/Controllers/Admin/AgentController.php:222
* @route '/app/agents/{agent}'
*/
show$4.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { agent: args };
	if (typeof args === "object" && !Array.isArray(args) && "id" in args) args = { agent: args.id };
	if (Array.isArray(args)) args = { agent: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { agent: typeof args.agent === "object" ? args.agent.id : args.agent };
	return show$4.definition.url.replace("{agent}", parsedArgs.agent.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\AgentController::show
* @see app/Http/Controllers/Admin/AgentController.php:222
* @route '/app/agents/{agent}'
*/
show$4.get = (args, options) => ({
	url: show$4.url(args, options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\AgentController::show
* @see app/Http/Controllers/Admin/AgentController.php:222
* @route '/app/agents/{agent}'
*/
show$4.head = (args, options) => ({
	url: show$4.url(args, options),
	method: "head"
});
/**
* @see \App\Http\Controllers\Admin\AgentController::show
* @see app/Http/Controllers/Admin/AgentController.php:222
* @route '/app/agents/{agent}'
*/
var showForm$4 = (args, options) => ({
	action: show$4.url(args, options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\AgentController::show
* @see app/Http/Controllers/Admin/AgentController.php:222
* @route '/app/agents/{agent}'
*/
showForm$4.get = (args, options) => ({
	action: show$4.url(args, options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\AgentController::show
* @see app/Http/Controllers/Admin/AgentController.php:222
* @route '/app/agents/{agent}'
*/
showForm$4.head = (args, options) => ({
	action: show$4.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
show$4.form = showForm$4;
/**
* @see \App\Http\Controllers\Admin\AgentController::edit
* @see app/Http/Controllers/Admin/AgentController.php:263
* @route '/app/agents/{agent}/settings'
*/
var edit$7 = (args, options) => ({
	url: edit$7.url(args, options),
	method: "get"
});
edit$7.definition = {
	methods: ["get", "head"],
	url: "/app/agents/{agent}/settings"
};
/**
* @see \App\Http\Controllers\Admin\AgentController::edit
* @see app/Http/Controllers/Admin/AgentController.php:263
* @route '/app/agents/{agent}/settings'
*/
edit$7.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { agent: args };
	if (typeof args === "object" && !Array.isArray(args) && "id" in args) args = { agent: args.id };
	if (Array.isArray(args)) args = { agent: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { agent: typeof args.agent === "object" ? args.agent.id : args.agent };
	return edit$7.definition.url.replace("{agent}", parsedArgs.agent.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\AgentController::edit
* @see app/Http/Controllers/Admin/AgentController.php:263
* @route '/app/agents/{agent}/settings'
*/
edit$7.get = (args, options) => ({
	url: edit$7.url(args, options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\AgentController::edit
* @see app/Http/Controllers/Admin/AgentController.php:263
* @route '/app/agents/{agent}/settings'
*/
edit$7.head = (args, options) => ({
	url: edit$7.url(args, options),
	method: "head"
});
/**
* @see \App\Http\Controllers\Admin\AgentController::edit
* @see app/Http/Controllers/Admin/AgentController.php:263
* @route '/app/agents/{agent}/settings'
*/
var editForm$7 = (args, options) => ({
	action: edit$7.url(args, options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\AgentController::edit
* @see app/Http/Controllers/Admin/AgentController.php:263
* @route '/app/agents/{agent}/settings'
*/
editForm$7.get = (args, options) => ({
	action: edit$7.url(args, options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\AgentController::edit
* @see app/Http/Controllers/Admin/AgentController.php:263
* @route '/app/agents/{agent}/settings'
*/
editForm$7.head = (args, options) => ({
	action: edit$7.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
edit$7.form = editForm$7;
/**
* @see \App\Http\Controllers\Admin\AgentController::customize
* @see app/Http/Controllers/Admin/AgentController.php:283
* @route '/app/agents/{agent}/customize'
*/
var customize = (args, options) => ({
	url: customize.url(args, options),
	method: "get"
});
customize.definition = {
	methods: ["get", "head"],
	url: "/app/agents/{agent}/customize"
};
/**
* @see \App\Http\Controllers\Admin\AgentController::customize
* @see app/Http/Controllers/Admin/AgentController.php:283
* @route '/app/agents/{agent}/customize'
*/
customize.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { agent: args };
	if (typeof args === "object" && !Array.isArray(args) && "id" in args) args = { agent: args.id };
	if (Array.isArray(args)) args = { agent: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { agent: typeof args.agent === "object" ? args.agent.id : args.agent };
	return customize.definition.url.replace("{agent}", parsedArgs.agent.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\AgentController::customize
* @see app/Http/Controllers/Admin/AgentController.php:283
* @route '/app/agents/{agent}/customize'
*/
customize.get = (args, options) => ({
	url: customize.url(args, options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\AgentController::customize
* @see app/Http/Controllers/Admin/AgentController.php:283
* @route '/app/agents/{agent}/customize'
*/
customize.head = (args, options) => ({
	url: customize.url(args, options),
	method: "head"
});
/**
* @see \App\Http\Controllers\Admin\AgentController::customize
* @see app/Http/Controllers/Admin/AgentController.php:283
* @route '/app/agents/{agent}/customize'
*/
var customizeForm = (args, options) => ({
	action: customize.url(args, options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\AgentController::customize
* @see app/Http/Controllers/Admin/AgentController.php:283
* @route '/app/agents/{agent}/customize'
*/
customizeForm.get = (args, options) => ({
	action: customize.url(args, options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\AgentController::customize
* @see app/Http/Controllers/Admin/AgentController.php:283
* @route '/app/agents/{agent}/customize'
*/
customizeForm.head = (args, options) => ({
	action: customize.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
customize.form = customizeForm;
/**
* @see \App\Http\Controllers\Admin\AgentController::vertical
* @see app/Http/Controllers/Admin/AgentController.php:296
* @route '/app/agents/{agent}/vertical'
*/
var vertical = (args, options) => ({
	url: vertical.url(args, options),
	method: "get"
});
vertical.definition = {
	methods: ["get", "head"],
	url: "/app/agents/{agent}/vertical"
};
/**
* @see \App\Http\Controllers\Admin\AgentController::vertical
* @see app/Http/Controllers/Admin/AgentController.php:296
* @route '/app/agents/{agent}/vertical'
*/
vertical.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { agent: args };
	if (typeof args === "object" && !Array.isArray(args) && "id" in args) args = { agent: args.id };
	if (Array.isArray(args)) args = { agent: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { agent: typeof args.agent === "object" ? args.agent.id : args.agent };
	return vertical.definition.url.replace("{agent}", parsedArgs.agent.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\AgentController::vertical
* @see app/Http/Controllers/Admin/AgentController.php:296
* @route '/app/agents/{agent}/vertical'
*/
vertical.get = (args, options) => ({
	url: vertical.url(args, options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\AgentController::vertical
* @see app/Http/Controllers/Admin/AgentController.php:296
* @route '/app/agents/{agent}/vertical'
*/
vertical.head = (args, options) => ({
	url: vertical.url(args, options),
	method: "head"
});
/**
* @see \App\Http\Controllers\Admin\AgentController::vertical
* @see app/Http/Controllers/Admin/AgentController.php:296
* @route '/app/agents/{agent}/vertical'
*/
var verticalForm = (args, options) => ({
	action: vertical.url(args, options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\AgentController::vertical
* @see app/Http/Controllers/Admin/AgentController.php:296
* @route '/app/agents/{agent}/vertical'
*/
verticalForm.get = (args, options) => ({
	action: vertical.url(args, options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\AgentController::vertical
* @see app/Http/Controllers/Admin/AgentController.php:296
* @route '/app/agents/{agent}/vertical'
*/
verticalForm.head = (args, options) => ({
	action: vertical.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
vertical.form = verticalForm;
/**
* @see \App\Http\Controllers\Admin\AgentController::update
* @see app/Http/Controllers/Admin/AgentController.php:320
* @route '/app/agents/{agent}'
*/
var update$11 = (args, options) => ({
	url: update$11.url(args, options),
	method: "patch"
});
update$11.definition = {
	methods: ["patch"],
	url: "/app/agents/{agent}"
};
/**
* @see \App\Http\Controllers\Admin\AgentController::update
* @see app/Http/Controllers/Admin/AgentController.php:320
* @route '/app/agents/{agent}'
*/
update$11.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { agent: args };
	if (typeof args === "object" && !Array.isArray(args) && "id" in args) args = { agent: args.id };
	if (Array.isArray(args)) args = { agent: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { agent: typeof args.agent === "object" ? args.agent.id : args.agent };
	return update$11.definition.url.replace("{agent}", parsedArgs.agent.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\AgentController::update
* @see app/Http/Controllers/Admin/AgentController.php:320
* @route '/app/agents/{agent}'
*/
update$11.patch = (args, options) => ({
	url: update$11.url(args, options),
	method: "patch"
});
/**
* @see \App\Http\Controllers\Admin\AgentController::update
* @see app/Http/Controllers/Admin/AgentController.php:320
* @route '/app/agents/{agent}'
*/
var updateForm$11 = (args, options) => ({
	action: update$11.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "PATCH",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\AgentController::update
* @see app/Http/Controllers/Admin/AgentController.php:320
* @route '/app/agents/{agent}'
*/
updateForm$11.patch = (args, options) => ({
	action: update$11.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "PATCH",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
update$11.form = updateForm$11;
/**
* @see \App\Http\Controllers\Admin\AgentController::destroy
* @see app/Http/Controllers/Admin/AgentController.php:340
* @route '/app/agents/{agent}'
*/
var destroy$12 = (args, options) => ({
	url: destroy$12.url(args, options),
	method: "delete"
});
destroy$12.definition = {
	methods: ["delete"],
	url: "/app/agents/{agent}"
};
/**
* @see \App\Http\Controllers\Admin\AgentController::destroy
* @see app/Http/Controllers/Admin/AgentController.php:340
* @route '/app/agents/{agent}'
*/
destroy$12.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { agent: args };
	if (typeof args === "object" && !Array.isArray(args) && "id" in args) args = { agent: args.id };
	if (Array.isArray(args)) args = { agent: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { agent: typeof args.agent === "object" ? args.agent.id : args.agent };
	return destroy$12.definition.url.replace("{agent}", parsedArgs.agent.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\AgentController::destroy
* @see app/Http/Controllers/Admin/AgentController.php:340
* @route '/app/agents/{agent}'
*/
destroy$12.delete = (args, options) => ({
	url: destroy$12.url(args, options),
	method: "delete"
});
/**
* @see \App\Http\Controllers\Admin\AgentController::destroy
* @see app/Http/Controllers/Admin/AgentController.php:340
* @route '/app/agents/{agent}'
*/
var destroyForm$12 = (args, options) => ({
	action: destroy$12.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "DELETE",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\AgentController::destroy
* @see app/Http/Controllers/Admin/AgentController.php:340
* @route '/app/agents/{agent}'
*/
destroyForm$12.delete = (args, options) => ({
	action: destroy$12.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "DELETE",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
destroy$12.form = destroyForm$12;
/**
* @see \App\Http\Controllers\Admin\AgentController::bulkDestroy
* @see app/Http/Controllers/Admin/AgentController.php:384
* @route '/app/agents/bulk-destroy'
*/
var bulkDestroy$3 = (options) => ({
	url: bulkDestroy$3.url(options),
	method: "post"
});
bulkDestroy$3.definition = {
	methods: ["post"],
	url: "/app/agents/bulk-destroy"
};
/**
* @see \App\Http\Controllers\Admin\AgentController::bulkDestroy
* @see app/Http/Controllers/Admin/AgentController.php:384
* @route '/app/agents/bulk-destroy'
*/
bulkDestroy$3.url = (options) => {
	return bulkDestroy$3.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\AgentController::bulkDestroy
* @see app/Http/Controllers/Admin/AgentController.php:384
* @route '/app/agents/bulk-destroy'
*/
bulkDestroy$3.post = (options) => ({
	url: bulkDestroy$3.url(options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\AgentController::bulkDestroy
* @see app/Http/Controllers/Admin/AgentController.php:384
* @route '/app/agents/bulk-destroy'
*/
var bulkDestroyForm$3 = (options) => ({
	action: bulkDestroy$3.url(options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\AgentController::bulkDestroy
* @see app/Http/Controllers/Admin/AgentController.php:384
* @route '/app/agents/bulk-destroy'
*/
bulkDestroyForm$3.post = (options) => ({
	action: bulkDestroy$3.url(options),
	method: "post"
});
bulkDestroy$3.form = bulkDestroyForm$3;
/**
* @see \App\Http\Controllers\Admin\AgentController::publish
* @see app/Http/Controllers/Admin/AgentController.php:416
* @route '/app/agents/{agent}/publish'
*/
var publish = (args, options) => ({
	url: publish.url(args, options),
	method: "post"
});
publish.definition = {
	methods: ["post"],
	url: "/app/agents/{agent}/publish"
};
/**
* @see \App\Http\Controllers\Admin\AgentController::publish
* @see app/Http/Controllers/Admin/AgentController.php:416
* @route '/app/agents/{agent}/publish'
*/
publish.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { agent: args };
	if (typeof args === "object" && !Array.isArray(args) && "id" in args) args = { agent: args.id };
	if (Array.isArray(args)) args = { agent: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { agent: typeof args.agent === "object" ? args.agent.id : args.agent };
	return publish.definition.url.replace("{agent}", parsedArgs.agent.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\AgentController::publish
* @see app/Http/Controllers/Admin/AgentController.php:416
* @route '/app/agents/{agent}/publish'
*/
publish.post = (args, options) => ({
	url: publish.url(args, options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\AgentController::publish
* @see app/Http/Controllers/Admin/AgentController.php:416
* @route '/app/agents/{agent}/publish'
*/
var publishForm = (args, options) => ({
	action: publish.url(args, options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\AgentController::publish
* @see app/Http/Controllers/Admin/AgentController.php:416
* @route '/app/agents/{agent}/publish'
*/
publishForm.post = (args, options) => ({
	action: publish.url(args, options),
	method: "post"
});
publish.form = publishForm;
/**
* @see \App\Http\Controllers\Admin\AgentController::rollback
* @see app/Http/Controllers/Admin/AgentController.php:436
* @route '/app/agents/{agent}/rollback'
*/
var rollback = (args, options) => ({
	url: rollback.url(args, options),
	method: "post"
});
rollback.definition = {
	methods: ["post"],
	url: "/app/agents/{agent}/rollback"
};
/**
* @see \App\Http\Controllers\Admin\AgentController::rollback
* @see app/Http/Controllers/Admin/AgentController.php:436
* @route '/app/agents/{agent}/rollback'
*/
rollback.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { agent: args };
	if (typeof args === "object" && !Array.isArray(args) && "id" in args) args = { agent: args.id };
	if (Array.isArray(args)) args = { agent: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { agent: typeof args.agent === "object" ? args.agent.id : args.agent };
	return rollback.definition.url.replace("{agent}", parsedArgs.agent.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\AgentController::rollback
* @see app/Http/Controllers/Admin/AgentController.php:436
* @route '/app/agents/{agent}/rollback'
*/
rollback.post = (args, options) => ({
	url: rollback.url(args, options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\AgentController::rollback
* @see app/Http/Controllers/Admin/AgentController.php:436
* @route '/app/agents/{agent}/rollback'
*/
var rollbackForm = (args, options) => ({
	action: rollback.url(args, options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\AgentController::rollback
* @see app/Http/Controllers/Admin/AgentController.php:436
* @route '/app/agents/{agent}/rollback'
*/
rollbackForm.post = (args, options) => ({
	action: rollback.url(args, options),
	method: "post"
});
rollback.form = rollbackForm;
/**
* @see \App\Http\Controllers\Admin\PlaygroundController::playground
* @see app/Http/Controllers/Admin/PlaygroundController.php:19
* @route '/app/agents/{agent}/playground'
*/
var playground = (args, options) => ({
	url: playground.url(args, options),
	method: "get"
});
playground.definition = {
	methods: ["get", "head"],
	url: "/app/agents/{agent}/playground"
};
/**
* @see \App\Http\Controllers\Admin\PlaygroundController::playground
* @see app/Http/Controllers/Admin/PlaygroundController.php:19
* @route '/app/agents/{agent}/playground'
*/
playground.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { agent: args };
	if (typeof args === "object" && !Array.isArray(args) && "id" in args) args = { agent: args.id };
	if (Array.isArray(args)) args = { agent: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { agent: typeof args.agent === "object" ? args.agent.id : args.agent };
	return playground.definition.url.replace("{agent}", parsedArgs.agent.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\PlaygroundController::playground
* @see app/Http/Controllers/Admin/PlaygroundController.php:19
* @route '/app/agents/{agent}/playground'
*/
playground.get = (args, options) => ({
	url: playground.url(args, options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\PlaygroundController::playground
* @see app/Http/Controllers/Admin/PlaygroundController.php:19
* @route '/app/agents/{agent}/playground'
*/
playground.head = (args, options) => ({
	url: playground.url(args, options),
	method: "head"
});
/**
* @see \App\Http\Controllers\Admin\PlaygroundController::playground
* @see app/Http/Controllers/Admin/PlaygroundController.php:19
* @route '/app/agents/{agent}/playground'
*/
var playgroundForm = (args, options) => ({
	action: playground.url(args, options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\PlaygroundController::playground
* @see app/Http/Controllers/Admin/PlaygroundController.php:19
* @route '/app/agents/{agent}/playground'
*/
playgroundForm.get = (args, options) => ({
	action: playground.url(args, options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\PlaygroundController::playground
* @see app/Http/Controllers/Admin/PlaygroundController.php:19
* @route '/app/agents/{agent}/playground'
*/
playgroundForm.head = (args, options) => ({
	action: playground.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
playground.form = playgroundForm;
Object.assign(index$12, index$12), Object.assign(create$1, create$1), Object.assign(store$11, store$11), Object.assign(show$4, show$4), Object.assign(edit$7, edit$7), Object.assign(customize, customize), Object.assign(vertical, vertical$1), Object.assign(mcp, mcp), Object.assign(update$11, update$11), Object.assign(destroy$12, destroy$12), Object.assign(bulkDestroy$3, bulkDestroy$3), Object.assign(publish, publish), Object.assign(rollback, rollback), Object.assign(curated, curated), Object.assign(behavior, behavior), Object.assign(ctas, ctas), Object.assign(knowledge, knowledge), Object.assign(conversations$1, conversations$1), Object.assign(sources$1, sources$1), Object.assign(leads, leads), Object.assign(uploads, uploads), Object.assign(launcherIcon, launcherIcon), Object.assign(playground, playground$1), Object.assign(experiments, experiments);
//#endregion
//#region resources/js/routes/analytics/gaps/index.ts
/**
* @see \App\Http\Controllers\Admin\AnalyticsController::resolve
* @see app/Http/Controllers/Admin/AnalyticsController.php:440
* @route '/app/analytics/gaps/{contentGap}/resolve'
*/
var resolve = (args, options) => ({
	url: resolve.url(args, options),
	method: "post"
});
resolve.definition = {
	methods: ["post"],
	url: "/app/analytics/gaps/{contentGap}/resolve"
};
/**
* @see \App\Http\Controllers\Admin\AnalyticsController::resolve
* @see app/Http/Controllers/Admin/AnalyticsController.php:440
* @route '/app/analytics/gaps/{contentGap}/resolve'
*/
resolve.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { contentGap: args };
	if (typeof args === "object" && !Array.isArray(args) && "id" in args) args = { contentGap: args.id };
	if (Array.isArray(args)) args = { contentGap: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { contentGap: typeof args.contentGap === "object" ? args.contentGap.id : args.contentGap };
	return resolve.definition.url.replace("{contentGap}", parsedArgs.contentGap.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\AnalyticsController::resolve
* @see app/Http/Controllers/Admin/AnalyticsController.php:440
* @route '/app/analytics/gaps/{contentGap}/resolve'
*/
resolve.post = (args, options) => ({
	url: resolve.url(args, options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\AnalyticsController::resolve
* @see app/Http/Controllers/Admin/AnalyticsController.php:440
* @route '/app/analytics/gaps/{contentGap}/resolve'
*/
var resolveForm = (args, options) => ({
	action: resolve.url(args, options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\AnalyticsController::resolve
* @see app/Http/Controllers/Admin/AnalyticsController.php:440
* @route '/app/analytics/gaps/{contentGap}/resolve'
*/
resolveForm.post = (args, options) => ({
	action: resolve.url(args, options),
	method: "post"
});
resolve.form = resolveForm;
var gaps = { resolve: Object.assign(resolve, resolve) };
//#endregion
//#region resources/js/routes/analytics/index.ts
/**
* @see \App\Http\Controllers\Admin\AnalyticsController::overview
* @see app/Http/Controllers/Admin/AnalyticsController.php:24
* @route '/app/analytics'
*/
var overview = (options) => ({
	url: overview.url(options),
	method: "get"
});
overview.definition = {
	methods: ["get", "head"],
	url: "/app/analytics"
};
/**
* @see \App\Http\Controllers\Admin\AnalyticsController::overview
* @see app/Http/Controllers/Admin/AnalyticsController.php:24
* @route '/app/analytics'
*/
overview.url = (options) => {
	return overview.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\AnalyticsController::overview
* @see app/Http/Controllers/Admin/AnalyticsController.php:24
* @route '/app/analytics'
*/
overview.get = (options) => ({
	url: overview.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\AnalyticsController::overview
* @see app/Http/Controllers/Admin/AnalyticsController.php:24
* @route '/app/analytics'
*/
overview.head = (options) => ({
	url: overview.url(options),
	method: "head"
});
/**
* @see \App\Http\Controllers\Admin\AnalyticsController::overview
* @see app/Http/Controllers/Admin/AnalyticsController.php:24
* @route '/app/analytics'
*/
var overviewForm = (options) => ({
	action: overview.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\AnalyticsController::overview
* @see app/Http/Controllers/Admin/AnalyticsController.php:24
* @route '/app/analytics'
*/
overviewForm.get = (options) => ({
	action: overview.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\AnalyticsController::overview
* @see app/Http/Controllers/Admin/AnalyticsController.php:24
* @route '/app/analytics'
*/
overviewForm.head = (options) => ({
	action: overview.url({ [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
overview.form = overviewForm;
/**
* @see \App\Http\Controllers\Admin\AnalyticsController::contentGaps
* @see app/Http/Controllers/Admin/AnalyticsController.php:380
* @route '/app/analytics/content-gaps'
*/
var contentGaps = (options) => ({
	url: contentGaps.url(options),
	method: "get"
});
contentGaps.definition = {
	methods: ["get", "head"],
	url: "/app/analytics/content-gaps"
};
/**
* @see \App\Http\Controllers\Admin\AnalyticsController::contentGaps
* @see app/Http/Controllers/Admin/AnalyticsController.php:380
* @route '/app/analytics/content-gaps'
*/
contentGaps.url = (options) => {
	return contentGaps.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\AnalyticsController::contentGaps
* @see app/Http/Controllers/Admin/AnalyticsController.php:380
* @route '/app/analytics/content-gaps'
*/
contentGaps.get = (options) => ({
	url: contentGaps.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\AnalyticsController::contentGaps
* @see app/Http/Controllers/Admin/AnalyticsController.php:380
* @route '/app/analytics/content-gaps'
*/
contentGaps.head = (options) => ({
	url: contentGaps.url(options),
	method: "head"
});
/**
* @see \App\Http\Controllers\Admin\AnalyticsController::contentGaps
* @see app/Http/Controllers/Admin/AnalyticsController.php:380
* @route '/app/analytics/content-gaps'
*/
var contentGapsForm = (options) => ({
	action: contentGaps.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\AnalyticsController::contentGaps
* @see app/Http/Controllers/Admin/AnalyticsController.php:380
* @route '/app/analytics/content-gaps'
*/
contentGapsForm.get = (options) => ({
	action: contentGaps.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\AnalyticsController::contentGaps
* @see app/Http/Controllers/Admin/AnalyticsController.php:380
* @route '/app/analytics/content-gaps'
*/
contentGapsForm.head = (options) => ({
	action: contentGaps.url({ [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
contentGaps.form = contentGapsForm;
Object.assign(overview, overview), Object.assign(contentGaps, contentGaps), Object.assign(gaps, gaps);
//#endregion
//#region resources/js/routes/billing/webhook/index.ts
/**
* @see \App\Http\Controllers\Billing\PayPalWebhookController::__invoke
* @see app/Http/Controllers/Billing/PayPalWebhookController.php:71
* @route '/billing/webhook/paypal'
*/
var paypal = (options) => ({
	url: paypal.url(options),
	method: "post"
});
paypal.definition = {
	methods: ["post"],
	url: "/billing/webhook/paypal"
};
/**
* @see \App\Http\Controllers\Billing\PayPalWebhookController::__invoke
* @see app/Http/Controllers/Billing/PayPalWebhookController.php:71
* @route '/billing/webhook/paypal'
*/
paypal.url = (options) => {
	return paypal.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Billing\PayPalWebhookController::__invoke
* @see app/Http/Controllers/Billing/PayPalWebhookController.php:71
* @route '/billing/webhook/paypal'
*/
paypal.post = (options) => ({
	url: paypal.url(options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Billing\PayPalWebhookController::__invoke
* @see app/Http/Controllers/Billing/PayPalWebhookController.php:71
* @route '/billing/webhook/paypal'
*/
var paypalForm = (options) => ({
	action: paypal.url(options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Billing\PayPalWebhookController::__invoke
* @see app/Http/Controllers/Billing/PayPalWebhookController.php:71
* @route '/billing/webhook/paypal'
*/
paypalForm.post = (options) => ({
	action: paypal.url(options),
	method: "post"
});
paypal.form = paypalForm;
/**
* @see \App\Http\Controllers\Billing\RazorpayWebhookController::__invoke
* @see app/Http/Controllers/Billing/RazorpayWebhookController.php:51
* @route '/billing/webhook/razorpay'
*/
var razorpay = (options) => ({
	url: razorpay.url(options),
	method: "post"
});
razorpay.definition = {
	methods: ["post"],
	url: "/billing/webhook/razorpay"
};
/**
* @see \App\Http\Controllers\Billing\RazorpayWebhookController::__invoke
* @see app/Http/Controllers/Billing/RazorpayWebhookController.php:51
* @route '/billing/webhook/razorpay'
*/
razorpay.url = (options) => {
	return razorpay.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Billing\RazorpayWebhookController::__invoke
* @see app/Http/Controllers/Billing/RazorpayWebhookController.php:51
* @route '/billing/webhook/razorpay'
*/
razorpay.post = (options) => ({
	url: razorpay.url(options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Billing\RazorpayWebhookController::__invoke
* @see app/Http/Controllers/Billing/RazorpayWebhookController.php:51
* @route '/billing/webhook/razorpay'
*/
var razorpayForm = (options) => ({
	action: razorpay.url(options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Billing\RazorpayWebhookController::__invoke
* @see app/Http/Controllers/Billing/RazorpayWebhookController.php:51
* @route '/billing/webhook/razorpay'
*/
razorpayForm.post = (options) => ({
	action: razorpay.url(options),
	method: "post"
});
razorpay.form = razorpayForm;
var webhook$1 = {
	paypal: Object.assign(paypal, paypal),
	razorpay: Object.assign(razorpay, razorpay)
};
//#endregion
//#region resources/js/routes/billing/invoices/index.ts
/**
* @see \App\Http\Controllers\Admin\BillingController::download
* @see app/Http/Controllers/Admin/BillingController.php:152
* @route '/app/billing/invoices/{invoice}/download'
*/
var download$2 = (args, options) => ({
	url: download$2.url(args, options),
	method: "get"
});
download$2.definition = {
	methods: ["get", "head"],
	url: "/app/billing/invoices/{invoice}/download"
};
/**
* @see \App\Http\Controllers\Admin\BillingController::download
* @see app/Http/Controllers/Admin/BillingController.php:152
* @route '/app/billing/invoices/{invoice}/download'
*/
download$2.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { invoice: args };
	if (Array.isArray(args)) args = { invoice: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { invoice: args.invoice };
	return download$2.definition.url.replace("{invoice}", parsedArgs.invoice.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\BillingController::download
* @see app/Http/Controllers/Admin/BillingController.php:152
* @route '/app/billing/invoices/{invoice}/download'
*/
download$2.get = (args, options) => ({
	url: download$2.url(args, options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\BillingController::download
* @see app/Http/Controllers/Admin/BillingController.php:152
* @route '/app/billing/invoices/{invoice}/download'
*/
download$2.head = (args, options) => ({
	url: download$2.url(args, options),
	method: "head"
});
/**
* @see \App\Http\Controllers\Admin\BillingController::download
* @see app/Http/Controllers/Admin/BillingController.php:152
* @route '/app/billing/invoices/{invoice}/download'
*/
var downloadForm$2 = (args, options) => ({
	action: download$2.url(args, options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\BillingController::download
* @see app/Http/Controllers/Admin/BillingController.php:152
* @route '/app/billing/invoices/{invoice}/download'
*/
downloadForm$2.get = (args, options) => ({
	action: download$2.url(args, options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\BillingController::download
* @see app/Http/Controllers/Admin/BillingController.php:152
* @route '/app/billing/invoices/{invoice}/download'
*/
downloadForm$2.head = (args, options) => ({
	action: download$2.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
download$2.form = downloadForm$2;
var invoices = { download: Object.assign(download$2, download$2) };
//#endregion
//#region resources/js/routes/billing/index.ts
/**
* @see \App\Http\Controllers\Billing\WebhookController::webhook
* @see app/Http/Controllers/Billing/WebhookController.php:40
* @route '/billing/webhook'
*/
var webhook = (options) => ({
	url: webhook.url(options),
	method: "post"
});
webhook.definition = {
	methods: ["post"],
	url: "/billing/webhook"
};
/**
* @see \App\Http\Controllers\Billing\WebhookController::webhook
* @see app/Http/Controllers/Billing/WebhookController.php:40
* @route '/billing/webhook'
*/
webhook.url = (options) => {
	return webhook.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Billing\WebhookController::webhook
* @see app/Http/Controllers/Billing/WebhookController.php:40
* @route '/billing/webhook'
*/
webhook.post = (options) => ({
	url: webhook.url(options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Billing\WebhookController::webhook
* @see app/Http/Controllers/Billing/WebhookController.php:40
* @route '/billing/webhook'
*/
var webhookForm = (options) => ({
	action: webhook.url(options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Billing\WebhookController::webhook
* @see app/Http/Controllers/Billing/WebhookController.php:40
* @route '/billing/webhook'
*/
webhookForm.post = (options) => ({
	action: webhook.url(options),
	method: "post"
});
webhook.form = webhookForm;
/**
* @see \App\Http\Controllers\Admin\BillingController::show
* @see app/Http/Controllers/Admin/BillingController.php:33
* @route '/app/billing'
*/
var show$3 = (options) => ({
	url: show$3.url(options),
	method: "get"
});
show$3.definition = {
	methods: ["get", "head"],
	url: "/app/billing"
};
/**
* @see \App\Http\Controllers\Admin\BillingController::show
* @see app/Http/Controllers/Admin/BillingController.php:33
* @route '/app/billing'
*/
show$3.url = (options) => {
	return show$3.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\BillingController::show
* @see app/Http/Controllers/Admin/BillingController.php:33
* @route '/app/billing'
*/
show$3.get = (options) => ({
	url: show$3.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\BillingController::show
* @see app/Http/Controllers/Admin/BillingController.php:33
* @route '/app/billing'
*/
show$3.head = (options) => ({
	url: show$3.url(options),
	method: "head"
});
/**
* @see \App\Http\Controllers\Admin\BillingController::show
* @see app/Http/Controllers/Admin/BillingController.php:33
* @route '/app/billing'
*/
var showForm$3 = (options) => ({
	action: show$3.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\BillingController::show
* @see app/Http/Controllers/Admin/BillingController.php:33
* @route '/app/billing'
*/
showForm$3.get = (options) => ({
	action: show$3.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\BillingController::show
* @see app/Http/Controllers/Admin/BillingController.php:33
* @route '/app/billing'
*/
showForm$3.head = (options) => ({
	action: show$3.url({ [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
show$3.form = showForm$3;
/**
* @see \App\Http\Controllers\Billing\CheckoutController::__invoke
* @see app/Http/Controllers/Billing/CheckoutController.php:54
* @route '/billing/checkout'
*/
var checkout = (options) => ({
	url: checkout.url(options),
	method: "post"
});
checkout.definition = {
	methods: ["post"],
	url: "/billing/checkout"
};
/**
* @see \App\Http\Controllers\Billing\CheckoutController::__invoke
* @see app/Http/Controllers/Billing/CheckoutController.php:54
* @route '/billing/checkout'
*/
checkout.url = (options) => {
	return checkout.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Billing\CheckoutController::__invoke
* @see app/Http/Controllers/Billing/CheckoutController.php:54
* @route '/billing/checkout'
*/
checkout.post = (options) => ({
	url: checkout.url(options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Billing\CheckoutController::__invoke
* @see app/Http/Controllers/Billing/CheckoutController.php:54
* @route '/billing/checkout'
*/
var checkoutForm = (options) => ({
	action: checkout.url(options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Billing\CheckoutController::__invoke
* @see app/Http/Controllers/Billing/CheckoutController.php:54
* @route '/billing/checkout'
*/
checkoutForm.post = (options) => ({
	action: checkout.url(options),
	method: "post"
});
checkout.form = checkoutForm;
/**
* @see \App\Http\Controllers\Admin\BillingController::portal
* @see app/Http/Controllers/Admin/BillingController.php:175
* @route '/billing/portal'
*/
var portal = (options) => ({
	url: portal.url(options),
	method: "get"
});
portal.definition = {
	methods: ["get", "head"],
	url: "/billing/portal"
};
/**
* @see \App\Http\Controllers\Admin\BillingController::portal
* @see app/Http/Controllers/Admin/BillingController.php:175
* @route '/billing/portal'
*/
portal.url = (options) => {
	return portal.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\BillingController::portal
* @see app/Http/Controllers/Admin/BillingController.php:175
* @route '/billing/portal'
*/
portal.get = (options) => ({
	url: portal.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\BillingController::portal
* @see app/Http/Controllers/Admin/BillingController.php:175
* @route '/billing/portal'
*/
portal.head = (options) => ({
	url: portal.url(options),
	method: "head"
});
/**
* @see \App\Http\Controllers\Admin\BillingController::portal
* @see app/Http/Controllers/Admin/BillingController.php:175
* @route '/billing/portal'
*/
var portalForm = (options) => ({
	action: portal.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\BillingController::portal
* @see app/Http/Controllers/Admin/BillingController.php:175
* @route '/billing/portal'
*/
portalForm.get = (options) => ({
	action: portal.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\BillingController::portal
* @see app/Http/Controllers/Admin/BillingController.php:175
* @route '/billing/portal'
*/
portalForm.head = (options) => ({
	action: portal.url({ [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
portal.form = portalForm;
/**
* @see \App\Http\Controllers\Billing\LifecycleController::cancel
* @see app/Http/Controllers/Billing/LifecycleController.php:51
* @route '/billing/cancel'
*/
var cancel = (options) => ({
	url: cancel.url(options),
	method: "post"
});
cancel.definition = {
	methods: ["post"],
	url: "/billing/cancel"
};
/**
* @see \App\Http\Controllers\Billing\LifecycleController::cancel
* @see app/Http/Controllers/Billing/LifecycleController.php:51
* @route '/billing/cancel'
*/
cancel.url = (options) => {
	return cancel.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Billing\LifecycleController::cancel
* @see app/Http/Controllers/Billing/LifecycleController.php:51
* @route '/billing/cancel'
*/
cancel.post = (options) => ({
	url: cancel.url(options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Billing\LifecycleController::cancel
* @see app/Http/Controllers/Billing/LifecycleController.php:51
* @route '/billing/cancel'
*/
var cancelForm = (options) => ({
	action: cancel.url(options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Billing\LifecycleController::cancel
* @see app/Http/Controllers/Billing/LifecycleController.php:51
* @route '/billing/cancel'
*/
cancelForm.post = (options) => ({
	action: cancel.url(options),
	method: "post"
});
cancel.form = cancelForm;
/**
* @see \App\Http\Controllers\Billing\LifecycleController::resume
* @see app/Http/Controllers/Billing/LifecycleController.php:120
* @route '/billing/resume'
*/
var resume = (options) => ({
	url: resume.url(options),
	method: "post"
});
resume.definition = {
	methods: ["post"],
	url: "/billing/resume"
};
/**
* @see \App\Http\Controllers\Billing\LifecycleController::resume
* @see app/Http/Controllers/Billing/LifecycleController.php:120
* @route '/billing/resume'
*/
resume.url = (options) => {
	return resume.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Billing\LifecycleController::resume
* @see app/Http/Controllers/Billing/LifecycleController.php:120
* @route '/billing/resume'
*/
resume.post = (options) => ({
	url: resume.url(options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Billing\LifecycleController::resume
* @see app/Http/Controllers/Billing/LifecycleController.php:120
* @route '/billing/resume'
*/
var resumeForm = (options) => ({
	action: resume.url(options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Billing\LifecycleController::resume
* @see app/Http/Controllers/Billing/LifecycleController.php:120
* @route '/billing/resume'
*/
resumeForm.post = (options) => ({
	action: resume.url(options),
	method: "post"
});
resume.form = resumeForm;
/**
* @see \App\Http\Controllers\Billing\LifecycleController::swap
* @see app/Http/Controllers/Billing/LifecycleController.php:159
* @route '/billing/swap'
*/
var swap = (options) => ({
	url: swap.url(options),
	method: "post"
});
swap.definition = {
	methods: ["post"],
	url: "/billing/swap"
};
/**
* @see \App\Http\Controllers\Billing\LifecycleController::swap
* @see app/Http/Controllers/Billing/LifecycleController.php:159
* @route '/billing/swap'
*/
swap.url = (options) => {
	return swap.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Billing\LifecycleController::swap
* @see app/Http/Controllers/Billing/LifecycleController.php:159
* @route '/billing/swap'
*/
swap.post = (options) => ({
	url: swap.url(options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Billing\LifecycleController::swap
* @see app/Http/Controllers/Billing/LifecycleController.php:159
* @route '/billing/swap'
*/
var swapForm = (options) => ({
	action: swap.url(options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Billing\LifecycleController::swap
* @see app/Http/Controllers/Billing/LifecycleController.php:159
* @route '/billing/swap'
*/
swapForm.post = (options) => ({
	action: swap.url(options),
	method: "post"
});
swap.form = swapForm;
Object.assign(webhook, webhook$1), Object.assign(show$3, show$3), Object.assign(invoices, invoices), Object.assign(checkout, checkout), Object.assign(portal, portal), Object.assign(cancel, cancel), Object.assign(resume, resume), Object.assign(swap, swap);
//#endregion
//#region resources/js/routes/conversations/tags/index.ts
/**
* @see \App\Http\Controllers\Admin\ConversationTagAssignmentController::attach
* @see app/Http/Controllers/Admin/ConversationTagAssignmentController.php:18
* @route '/app/conversations/{conversation}/tags/{tag}'
*/
var attach = (args, options) => ({
	url: attach.url(args, options),
	method: "post"
});
attach.definition = {
	methods: ["post"],
	url: "/app/conversations/{conversation}/tags/{tag}"
};
/**
* @see \App\Http\Controllers\Admin\ConversationTagAssignmentController::attach
* @see app/Http/Controllers/Admin/ConversationTagAssignmentController.php:18
* @route '/app/conversations/{conversation}/tags/{tag}'
*/
attach.url = (args, options) => {
	if (Array.isArray(args)) args = {
		conversation: args[0],
		tag: args[1]
	};
	args = applyUrlDefaults(args);
	const parsedArgs = {
		conversation: typeof args.conversation === "object" ? args.conversation.id : args.conversation,
		tag: typeof args.tag === "object" ? args.tag.id : args.tag
	};
	return attach.definition.url.replace("{conversation}", parsedArgs.conversation.toString()).replace("{tag}", parsedArgs.tag.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\ConversationTagAssignmentController::attach
* @see app/Http/Controllers/Admin/ConversationTagAssignmentController.php:18
* @route '/app/conversations/{conversation}/tags/{tag}'
*/
attach.post = (args, options) => ({
	url: attach.url(args, options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\ConversationTagAssignmentController::attach
* @see app/Http/Controllers/Admin/ConversationTagAssignmentController.php:18
* @route '/app/conversations/{conversation}/tags/{tag}'
*/
var attachForm = (args, options) => ({
	action: attach.url(args, options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\ConversationTagAssignmentController::attach
* @see app/Http/Controllers/Admin/ConversationTagAssignmentController.php:18
* @route '/app/conversations/{conversation}/tags/{tag}'
*/
attachForm.post = (args, options) => ({
	action: attach.url(args, options),
	method: "post"
});
attach.form = attachForm;
/**
* @see \App\Http\Controllers\Admin\ConversationTagAssignmentController::detach
* @see app/Http/Controllers/Admin/ConversationTagAssignmentController.php:34
* @route '/app/conversations/{conversation}/tags/{tag}'
*/
var detach = (args, options) => ({
	url: detach.url(args, options),
	method: "delete"
});
detach.definition = {
	methods: ["delete"],
	url: "/app/conversations/{conversation}/tags/{tag}"
};
/**
* @see \App\Http\Controllers\Admin\ConversationTagAssignmentController::detach
* @see app/Http/Controllers/Admin/ConversationTagAssignmentController.php:34
* @route '/app/conversations/{conversation}/tags/{tag}'
*/
detach.url = (args, options) => {
	if (Array.isArray(args)) args = {
		conversation: args[0],
		tag: args[1]
	};
	args = applyUrlDefaults(args);
	const parsedArgs = {
		conversation: typeof args.conversation === "object" ? args.conversation.id : args.conversation,
		tag: typeof args.tag === "object" ? args.tag.id : args.tag
	};
	return detach.definition.url.replace("{conversation}", parsedArgs.conversation.toString()).replace("{tag}", parsedArgs.tag.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\ConversationTagAssignmentController::detach
* @see app/Http/Controllers/Admin/ConversationTagAssignmentController.php:34
* @route '/app/conversations/{conversation}/tags/{tag}'
*/
detach.delete = (args, options) => ({
	url: detach.url(args, options),
	method: "delete"
});
/**
* @see \App\Http\Controllers\Admin\ConversationTagAssignmentController::detach
* @see app/Http/Controllers/Admin/ConversationTagAssignmentController.php:34
* @route '/app/conversations/{conversation}/tags/{tag}'
*/
var detachForm = (args, options) => ({
	action: detach.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "DELETE",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\ConversationTagAssignmentController::detach
* @see app/Http/Controllers/Admin/ConversationTagAssignmentController.php:34
* @route '/app/conversations/{conversation}/tags/{tag}'
*/
detachForm.delete = (args, options) => ({
	action: detach.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "DELETE",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
detach.form = detachForm;
var tags = {
	attach: Object.assign(attach, attach),
	detach: Object.assign(detach, detach)
};
//#endregion
//#region resources/js/routes/conversations/export/index.ts
/**
* @see \App\Http\Controllers\Admin\ConversationExportController::index
* @see app/Http/Controllers/Admin/ConversationExportController.php:18
* @route '/app/conversation-exports'
*/
var index$11 = (options) => ({
	url: index$11.url(options),
	method: "get"
});
index$11.definition = {
	methods: ["get", "head"],
	url: "/app/conversation-exports"
};
/**
* @see \App\Http\Controllers\Admin\ConversationExportController::index
* @see app/Http/Controllers/Admin/ConversationExportController.php:18
* @route '/app/conversation-exports'
*/
index$11.url = (options) => {
	return index$11.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\ConversationExportController::index
* @see app/Http/Controllers/Admin/ConversationExportController.php:18
* @route '/app/conversation-exports'
*/
index$11.get = (options) => ({
	url: index$11.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\ConversationExportController::index
* @see app/Http/Controllers/Admin/ConversationExportController.php:18
* @route '/app/conversation-exports'
*/
index$11.head = (options) => ({
	url: index$11.url(options),
	method: "head"
});
/**
* @see \App\Http\Controllers\Admin\ConversationExportController::index
* @see app/Http/Controllers/Admin/ConversationExportController.php:18
* @route '/app/conversation-exports'
*/
var indexForm$11 = (options) => ({
	action: index$11.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\ConversationExportController::index
* @see app/Http/Controllers/Admin/ConversationExportController.php:18
* @route '/app/conversation-exports'
*/
indexForm$11.get = (options) => ({
	action: index$11.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\ConversationExportController::index
* @see app/Http/Controllers/Admin/ConversationExportController.php:18
* @route '/app/conversation-exports'
*/
indexForm$11.head = (options) => ({
	action: index$11.url({ [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
index$11.form = indexForm$11;
/**
* @see \App\Http\Controllers\Admin\ConversationExportController::store
* @see app/Http/Controllers/Admin/ConversationExportController.php:47
* @route '/app/conversation-exports'
*/
var store$10 = (options) => ({
	url: store$10.url(options),
	method: "post"
});
store$10.definition = {
	methods: ["post"],
	url: "/app/conversation-exports"
};
/**
* @see \App\Http\Controllers\Admin\ConversationExportController::store
* @see app/Http/Controllers/Admin/ConversationExportController.php:47
* @route '/app/conversation-exports'
*/
store$10.url = (options) => {
	return store$10.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\ConversationExportController::store
* @see app/Http/Controllers/Admin/ConversationExportController.php:47
* @route '/app/conversation-exports'
*/
store$10.post = (options) => ({
	url: store$10.url(options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\ConversationExportController::store
* @see app/Http/Controllers/Admin/ConversationExportController.php:47
* @route '/app/conversation-exports'
*/
var storeForm$10 = (options) => ({
	action: store$10.url(options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\ConversationExportController::store
* @see app/Http/Controllers/Admin/ConversationExportController.php:47
* @route '/app/conversation-exports'
*/
storeForm$10.post = (options) => ({
	action: store$10.url(options),
	method: "post"
});
store$10.form = storeForm$10;
/**
* @see \App\Http\Controllers\Admin\ConversationExportController::download
* @see app/Http/Controllers/Admin/ConversationExportController.php:80
* @route '/app/conversation-exports/{conversationExport}/download'
*/
var download$1 = (args, options) => ({
	url: download$1.url(args, options),
	method: "get"
});
download$1.definition = {
	methods: ["get", "head"],
	url: "/app/conversation-exports/{conversationExport}/download"
};
/**
* @see \App\Http\Controllers\Admin\ConversationExportController::download
* @see app/Http/Controllers/Admin/ConversationExportController.php:80
* @route '/app/conversation-exports/{conversationExport}/download'
*/
download$1.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { conversationExport: args };
	if (typeof args === "object" && !Array.isArray(args) && "id" in args) args = { conversationExport: args.id };
	if (Array.isArray(args)) args = { conversationExport: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { conversationExport: typeof args.conversationExport === "object" ? args.conversationExport.id : args.conversationExport };
	return download$1.definition.url.replace("{conversationExport}", parsedArgs.conversationExport.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\ConversationExportController::download
* @see app/Http/Controllers/Admin/ConversationExportController.php:80
* @route '/app/conversation-exports/{conversationExport}/download'
*/
download$1.get = (args, options) => ({
	url: download$1.url(args, options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\ConversationExportController::download
* @see app/Http/Controllers/Admin/ConversationExportController.php:80
* @route '/app/conversation-exports/{conversationExport}/download'
*/
download$1.head = (args, options) => ({
	url: download$1.url(args, options),
	method: "head"
});
/**
* @see \App\Http\Controllers\Admin\ConversationExportController::download
* @see app/Http/Controllers/Admin/ConversationExportController.php:80
* @route '/app/conversation-exports/{conversationExport}/download'
*/
var downloadForm$1 = (args, options) => ({
	action: download$1.url(args, options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\ConversationExportController::download
* @see app/Http/Controllers/Admin/ConversationExportController.php:80
* @route '/app/conversation-exports/{conversationExport}/download'
*/
downloadForm$1.get = (args, options) => ({
	action: download$1.url(args, options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\ConversationExportController::download
* @see app/Http/Controllers/Admin/ConversationExportController.php:80
* @route '/app/conversation-exports/{conversationExport}/download'
*/
downloadForm$1.head = (args, options) => ({
	action: download$1.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
download$1.form = downloadForm$1;
var exportMethod = {
	index: Object.assign(index$11, index$11),
	store: Object.assign(store$10, store$10),
	download: Object.assign(download$1, download$1)
};
//#endregion
//#region resources/js/routes/conversations/index.ts
/**
* @see \App\Http\Controllers\Admin\ConversationTakeoverController::claim
* @see app/Http/Controllers/Admin/ConversationTakeoverController.php:24
* @route '/app/conversations/{conversation}/claim'
*/
var claim = (args, options) => ({
	url: claim.url(args, options),
	method: "post"
});
claim.definition = {
	methods: ["post"],
	url: "/app/conversations/{conversation}/claim"
};
/**
* @see \App\Http\Controllers\Admin\ConversationTakeoverController::claim
* @see app/Http/Controllers/Admin/ConversationTakeoverController.php:24
* @route '/app/conversations/{conversation}/claim'
*/
claim.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { conversation: args };
	if (typeof args === "object" && !Array.isArray(args) && "id" in args) args = { conversation: args.id };
	if (Array.isArray(args)) args = { conversation: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { conversation: typeof args.conversation === "object" ? args.conversation.id : args.conversation };
	return claim.definition.url.replace("{conversation}", parsedArgs.conversation.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\ConversationTakeoverController::claim
* @see app/Http/Controllers/Admin/ConversationTakeoverController.php:24
* @route '/app/conversations/{conversation}/claim'
*/
claim.post = (args, options) => ({
	url: claim.url(args, options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\ConversationTakeoverController::claim
* @see app/Http/Controllers/Admin/ConversationTakeoverController.php:24
* @route '/app/conversations/{conversation}/claim'
*/
var claimForm = (args, options) => ({
	action: claim.url(args, options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\ConversationTakeoverController::claim
* @see app/Http/Controllers/Admin/ConversationTakeoverController.php:24
* @route '/app/conversations/{conversation}/claim'
*/
claimForm.post = (args, options) => ({
	action: claim.url(args, options),
	method: "post"
});
claim.form = claimForm;
/**
* @see \App\Http\Controllers\Admin\ConversationTakeoverController::release
* @see app/Http/Controllers/Admin/ConversationTakeoverController.php:60
* @route '/app/conversations/{conversation}/release'
*/
var release = (args, options) => ({
	url: release.url(args, options),
	method: "post"
});
release.definition = {
	methods: ["post"],
	url: "/app/conversations/{conversation}/release"
};
/**
* @see \App\Http\Controllers\Admin\ConversationTakeoverController::release
* @see app/Http/Controllers/Admin/ConversationTakeoverController.php:60
* @route '/app/conversations/{conversation}/release'
*/
release.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { conversation: args };
	if (typeof args === "object" && !Array.isArray(args) && "id" in args) args = { conversation: args.id };
	if (Array.isArray(args)) args = { conversation: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { conversation: typeof args.conversation === "object" ? args.conversation.id : args.conversation };
	return release.definition.url.replace("{conversation}", parsedArgs.conversation.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\ConversationTakeoverController::release
* @see app/Http/Controllers/Admin/ConversationTakeoverController.php:60
* @route '/app/conversations/{conversation}/release'
*/
release.post = (args, options) => ({
	url: release.url(args, options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\ConversationTakeoverController::release
* @see app/Http/Controllers/Admin/ConversationTakeoverController.php:60
* @route '/app/conversations/{conversation}/release'
*/
var releaseForm = (args, options) => ({
	action: release.url(args, options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\ConversationTakeoverController::release
* @see app/Http/Controllers/Admin/ConversationTakeoverController.php:60
* @route '/app/conversations/{conversation}/release'
*/
releaseForm.post = (args, options) => ({
	action: release.url(args, options),
	method: "post"
});
release.form = releaseForm;
/**
* @see \App\Http\Controllers\Admin\ConversationTakeoverController::reply
* @see app/Http/Controllers/Admin/ConversationTakeoverController.php:128
* @route '/app/conversations/{conversation}/reply'
*/
var reply = (args, options) => ({
	url: reply.url(args, options),
	method: "post"
});
reply.definition = {
	methods: ["post"],
	url: "/app/conversations/{conversation}/reply"
};
/**
* @see \App\Http\Controllers\Admin\ConversationTakeoverController::reply
* @see app/Http/Controllers/Admin/ConversationTakeoverController.php:128
* @route '/app/conversations/{conversation}/reply'
*/
reply.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { conversation: args };
	if (typeof args === "object" && !Array.isArray(args) && "id" in args) args = { conversation: args.id };
	if (Array.isArray(args)) args = { conversation: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { conversation: typeof args.conversation === "object" ? args.conversation.id : args.conversation };
	return reply.definition.url.replace("{conversation}", parsedArgs.conversation.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\ConversationTakeoverController::reply
* @see app/Http/Controllers/Admin/ConversationTakeoverController.php:128
* @route '/app/conversations/{conversation}/reply'
*/
reply.post = (args, options) => ({
	url: reply.url(args, options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\ConversationTakeoverController::reply
* @see app/Http/Controllers/Admin/ConversationTakeoverController.php:128
* @route '/app/conversations/{conversation}/reply'
*/
var replyForm = (args, options) => ({
	action: reply.url(args, options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\ConversationTakeoverController::reply
* @see app/Http/Controllers/Admin/ConversationTakeoverController.php:128
* @route '/app/conversations/{conversation}/reply'
*/
replyForm.post = (args, options) => ({
	action: reply.url(args, options),
	method: "post"
});
reply.form = replyForm;
/**
* @see \App\Http\Controllers\Admin\ConversationTakeoverController::note
* @see app/Http/Controllers/Admin/ConversationTakeoverController.php:195
* @route '/app/conversations/{conversation}/note'
*/
var note = (args, options) => ({
	url: note.url(args, options),
	method: "post"
});
note.definition = {
	methods: ["post"],
	url: "/app/conversations/{conversation}/note"
};
/**
* @see \App\Http\Controllers\Admin\ConversationTakeoverController::note
* @see app/Http/Controllers/Admin/ConversationTakeoverController.php:195
* @route '/app/conversations/{conversation}/note'
*/
note.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { conversation: args };
	if (typeof args === "object" && !Array.isArray(args) && "id" in args) args = { conversation: args.id };
	if (Array.isArray(args)) args = { conversation: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { conversation: typeof args.conversation === "object" ? args.conversation.id : args.conversation };
	return note.definition.url.replace("{conversation}", parsedArgs.conversation.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\ConversationTakeoverController::note
* @see app/Http/Controllers/Admin/ConversationTakeoverController.php:195
* @route '/app/conversations/{conversation}/note'
*/
note.post = (args, options) => ({
	url: note.url(args, options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\ConversationTakeoverController::note
* @see app/Http/Controllers/Admin/ConversationTakeoverController.php:195
* @route '/app/conversations/{conversation}/note'
*/
var noteForm = (args, options) => ({
	action: note.url(args, options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\ConversationTakeoverController::note
* @see app/Http/Controllers/Admin/ConversationTakeoverController.php:195
* @route '/app/conversations/{conversation}/note'
*/
noteForm.post = (args, options) => ({
	action: note.url(args, options),
	method: "post"
});
note.form = noteForm;
/**
* @see \App\Http\Controllers\Admin\ConversationTakeoverController::typing
* @see app/Http/Controllers/Admin/ConversationTakeoverController.php:235
* @route '/app/conversations/{conversation}/typing'
*/
var typing = (args, options) => ({
	url: typing.url(args, options),
	method: "post"
});
typing.definition = {
	methods: ["post"],
	url: "/app/conversations/{conversation}/typing"
};
/**
* @see \App\Http\Controllers\Admin\ConversationTakeoverController::typing
* @see app/Http/Controllers/Admin/ConversationTakeoverController.php:235
* @route '/app/conversations/{conversation}/typing'
*/
typing.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { conversation: args };
	if (typeof args === "object" && !Array.isArray(args) && "id" in args) args = { conversation: args.id };
	if (Array.isArray(args)) args = { conversation: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { conversation: typeof args.conversation === "object" ? args.conversation.id : args.conversation };
	return typing.definition.url.replace("{conversation}", parsedArgs.conversation.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\ConversationTakeoverController::typing
* @see app/Http/Controllers/Admin/ConversationTakeoverController.php:235
* @route '/app/conversations/{conversation}/typing'
*/
typing.post = (args, options) => ({
	url: typing.url(args, options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\ConversationTakeoverController::typing
* @see app/Http/Controllers/Admin/ConversationTakeoverController.php:235
* @route '/app/conversations/{conversation}/typing'
*/
var typingForm = (args, options) => ({
	action: typing.url(args, options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\ConversationTakeoverController::typing
* @see app/Http/Controllers/Admin/ConversationTakeoverController.php:235
* @route '/app/conversations/{conversation}/typing'
*/
typingForm.post = (args, options) => ({
	action: typing.url(args, options),
	method: "post"
});
typing.form = typingForm;
/**
* @see \App\Http\Controllers\Admin\ConversationTakeoverController::transfer
* @see app/Http/Controllers/Admin/ConversationTakeoverController.php:257
* @route '/app/conversations/{conversation}/transfer'
*/
var transfer = (args, options) => ({
	url: transfer.url(args, options),
	method: "post"
});
transfer.definition = {
	methods: ["post"],
	url: "/app/conversations/{conversation}/transfer"
};
/**
* @see \App\Http\Controllers\Admin\ConversationTakeoverController::transfer
* @see app/Http/Controllers/Admin/ConversationTakeoverController.php:257
* @route '/app/conversations/{conversation}/transfer'
*/
transfer.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { conversation: args };
	if (typeof args === "object" && !Array.isArray(args) && "id" in args) args = { conversation: args.id };
	if (Array.isArray(args)) args = { conversation: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { conversation: typeof args.conversation === "object" ? args.conversation.id : args.conversation };
	return transfer.definition.url.replace("{conversation}", parsedArgs.conversation.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\ConversationTakeoverController::transfer
* @see app/Http/Controllers/Admin/ConversationTakeoverController.php:257
* @route '/app/conversations/{conversation}/transfer'
*/
transfer.post = (args, options) => ({
	url: transfer.url(args, options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\ConversationTakeoverController::transfer
* @see app/Http/Controllers/Admin/ConversationTakeoverController.php:257
* @route '/app/conversations/{conversation}/transfer'
*/
var transferForm = (args, options) => ({
	action: transfer.url(args, options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\ConversationTakeoverController::transfer
* @see app/Http/Controllers/Admin/ConversationTakeoverController.php:257
* @route '/app/conversations/{conversation}/transfer'
*/
transferForm.post = (args, options) => ({
	action: transfer.url(args, options),
	method: "post"
});
transfer.form = transferForm;
/**
* @see \App\Http\Controllers\Admin\ConversationController::index
* @see app/Http/Controllers/Admin/ConversationController.php:31
* @route '/app/conversations'
*/
var index$10 = (options) => ({
	url: index$10.url(options),
	method: "get"
});
index$10.definition = {
	methods: ["get", "head"],
	url: "/app/conversations"
};
/**
* @see \App\Http\Controllers\Admin\ConversationController::index
* @see app/Http/Controllers/Admin/ConversationController.php:31
* @route '/app/conversations'
*/
index$10.url = (options) => {
	return index$10.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\ConversationController::index
* @see app/Http/Controllers/Admin/ConversationController.php:31
* @route '/app/conversations'
*/
index$10.get = (options) => ({
	url: index$10.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\ConversationController::index
* @see app/Http/Controllers/Admin/ConversationController.php:31
* @route '/app/conversations'
*/
index$10.head = (options) => ({
	url: index$10.url(options),
	method: "head"
});
/**
* @see \App\Http\Controllers\Admin\ConversationController::index
* @see app/Http/Controllers/Admin/ConversationController.php:31
* @route '/app/conversations'
*/
var indexForm$10 = (options) => ({
	action: index$10.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\ConversationController::index
* @see app/Http/Controllers/Admin/ConversationController.php:31
* @route '/app/conversations'
*/
indexForm$10.get = (options) => ({
	action: index$10.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\ConversationController::index
* @see app/Http/Controllers/Admin/ConversationController.php:31
* @route '/app/conversations'
*/
indexForm$10.head = (options) => ({
	action: index$10.url({ [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
index$10.form = indexForm$10;
/**
* @see \App\Http\Controllers\Admin\ConversationController::show
* @see app/Http/Controllers/Admin/ConversationController.php:377
* @route '/app/conversations/{conversation}'
*/
var show$2 = (args, options) => ({
	url: show$2.url(args, options),
	method: "get"
});
show$2.definition = {
	methods: ["get", "head"],
	url: "/app/conversations/{conversation}"
};
/**
* @see \App\Http\Controllers\Admin\ConversationController::show
* @see app/Http/Controllers/Admin/ConversationController.php:377
* @route '/app/conversations/{conversation}'
*/
show$2.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { conversation: args };
	if (typeof args === "object" && !Array.isArray(args) && "id" in args) args = { conversation: args.id };
	if (Array.isArray(args)) args = { conversation: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { conversation: typeof args.conversation === "object" ? args.conversation.id : args.conversation };
	return show$2.definition.url.replace("{conversation}", parsedArgs.conversation.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\ConversationController::show
* @see app/Http/Controllers/Admin/ConversationController.php:377
* @route '/app/conversations/{conversation}'
*/
show$2.get = (args, options) => ({
	url: show$2.url(args, options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\ConversationController::show
* @see app/Http/Controllers/Admin/ConversationController.php:377
* @route '/app/conversations/{conversation}'
*/
show$2.head = (args, options) => ({
	url: show$2.url(args, options),
	method: "head"
});
/**
* @see \App\Http\Controllers\Admin\ConversationController::show
* @see app/Http/Controllers/Admin/ConversationController.php:377
* @route '/app/conversations/{conversation}'
*/
var showForm$2 = (args, options) => ({
	action: show$2.url(args, options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\ConversationController::show
* @see app/Http/Controllers/Admin/ConversationController.php:377
* @route '/app/conversations/{conversation}'
*/
showForm$2.get = (args, options) => ({
	action: show$2.url(args, options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\ConversationController::show
* @see app/Http/Controllers/Admin/ConversationController.php:377
* @route '/app/conversations/{conversation}'
*/
showForm$2.head = (args, options) => ({
	action: show$2.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
show$2.form = showForm$2;
/**
* @see \App\Http\Controllers\Admin\ConversationController::bulkDestroy
* @see app/Http/Controllers/Admin/ConversationController.php:534
* @route '/app/conversations/bulk-destroy'
*/
var bulkDestroy$2 = (options) => ({
	url: bulkDestroy$2.url(options),
	method: "post"
});
bulkDestroy$2.definition = {
	methods: ["post"],
	url: "/app/conversations/bulk-destroy"
};
/**
* @see \App\Http\Controllers\Admin\ConversationController::bulkDestroy
* @see app/Http/Controllers/Admin/ConversationController.php:534
* @route '/app/conversations/bulk-destroy'
*/
bulkDestroy$2.url = (options) => {
	return bulkDestroy$2.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\ConversationController::bulkDestroy
* @see app/Http/Controllers/Admin/ConversationController.php:534
* @route '/app/conversations/bulk-destroy'
*/
bulkDestroy$2.post = (options) => ({
	url: bulkDestroy$2.url(options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\ConversationController::bulkDestroy
* @see app/Http/Controllers/Admin/ConversationController.php:534
* @route '/app/conversations/bulk-destroy'
*/
var bulkDestroyForm$2 = (options) => ({
	action: bulkDestroy$2.url(options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\ConversationController::bulkDestroy
* @see app/Http/Controllers/Admin/ConversationController.php:534
* @route '/app/conversations/bulk-destroy'
*/
bulkDestroyForm$2.post = (options) => ({
	action: bulkDestroy$2.url(options),
	method: "post"
});
bulkDestroy$2.form = bulkDestroyForm$2;
/**
* @see \App\Http\Controllers\Admin\ConversationController::destroy
* @see app/Http/Controllers/Admin/ConversationController.php:518
* @route '/app/conversations/{conversation}'
*/
var destroy$11 = (args, options) => ({
	url: destroy$11.url(args, options),
	method: "delete"
});
destroy$11.definition = {
	methods: ["delete"],
	url: "/app/conversations/{conversation}"
};
/**
* @see \App\Http\Controllers\Admin\ConversationController::destroy
* @see app/Http/Controllers/Admin/ConversationController.php:518
* @route '/app/conversations/{conversation}'
*/
destroy$11.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { conversation: args };
	if (typeof args === "object" && !Array.isArray(args) && "id" in args) args = { conversation: args.id };
	if (Array.isArray(args)) args = { conversation: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { conversation: typeof args.conversation === "object" ? args.conversation.id : args.conversation };
	return destroy$11.definition.url.replace("{conversation}", parsedArgs.conversation.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\ConversationController::destroy
* @see app/Http/Controllers/Admin/ConversationController.php:518
* @route '/app/conversations/{conversation}'
*/
destroy$11.delete = (args, options) => ({
	url: destroy$11.url(args, options),
	method: "delete"
});
/**
* @see \App\Http\Controllers\Admin\ConversationController::destroy
* @see app/Http/Controllers/Admin/ConversationController.php:518
* @route '/app/conversations/{conversation}'
*/
var destroyForm$11 = (args, options) => ({
	action: destroy$11.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "DELETE",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\ConversationController::destroy
* @see app/Http/Controllers/Admin/ConversationController.php:518
* @route '/app/conversations/{conversation}'
*/
destroyForm$11.delete = (args, options) => ({
	action: destroy$11.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "DELETE",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
destroy$11.form = destroyForm$11;
Object.assign(claim, claim), Object.assign(release, release), Object.assign(reply, reply), Object.assign(note, note), Object.assign(typing, typing), Object.assign(transfer, transfer), Object.assign(tags, tags), Object.assign(index$10, index$10), Object.assign(show$2, show$2), Object.assign(bulkDestroy$2, bulkDestroy$2), Object.assign(destroy$11, destroy$11), Object.assign(exportMethod, exportMethod);
//#endregion
//#region resources/js/routes/inbox/index.ts
/**
* @see \App\Http\Controllers\Admin\LeadController::index
* @see app/Http/Controllers/Admin/LeadController.php:86
* @route '/app/inbox'
*/
var index$9 = (options) => ({
	url: index$9.url(options),
	method: "get"
});
index$9.definition = {
	methods: ["get", "head"],
	url: "/app/inbox"
};
/**
* @see \App\Http\Controllers\Admin\LeadController::index
* @see app/Http/Controllers/Admin/LeadController.php:86
* @route '/app/inbox'
*/
index$9.url = (options) => {
	return index$9.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\LeadController::index
* @see app/Http/Controllers/Admin/LeadController.php:86
* @route '/app/inbox'
*/
index$9.get = (options) => ({
	url: index$9.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\LeadController::index
* @see app/Http/Controllers/Admin/LeadController.php:86
* @route '/app/inbox'
*/
index$9.head = (options) => ({
	url: index$9.url(options),
	method: "head"
});
/**
* @see \App\Http\Controllers\Admin\LeadController::index
* @see app/Http/Controllers/Admin/LeadController.php:86
* @route '/app/inbox'
*/
var indexForm$9 = (options) => ({
	action: index$9.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\LeadController::index
* @see app/Http/Controllers/Admin/LeadController.php:86
* @route '/app/inbox'
*/
indexForm$9.get = (options) => ({
	action: index$9.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\LeadController::index
* @see app/Http/Controllers/Admin/LeadController.php:86
* @route '/app/inbox'
*/
indexForm$9.head = (options) => ({
	action: index$9.url({ [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
index$9.form = indexForm$9;
/**
* @see \App\Http\Controllers\Admin\LeadController::show
* @see app/Http/Controllers/Admin/LeadController.php:172
* @route '/app/inbox/{lead}'
*/
var show$1 = (args, options) => ({
	url: show$1.url(args, options),
	method: "get"
});
show$1.definition = {
	methods: ["get", "head"],
	url: "/app/inbox/{lead}"
};
/**
* @see \App\Http\Controllers\Admin\LeadController::show
* @see app/Http/Controllers/Admin/LeadController.php:172
* @route '/app/inbox/{lead}'
*/
show$1.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { lead: args };
	if (typeof args === "object" && !Array.isArray(args) && "id" in args) args = { lead: args.id };
	if (Array.isArray(args)) args = { lead: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { lead: typeof args.lead === "object" ? args.lead.id : args.lead };
	return show$1.definition.url.replace("{lead}", parsedArgs.lead.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\LeadController::show
* @see app/Http/Controllers/Admin/LeadController.php:172
* @route '/app/inbox/{lead}'
*/
show$1.get = (args, options) => ({
	url: show$1.url(args, options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\LeadController::show
* @see app/Http/Controllers/Admin/LeadController.php:172
* @route '/app/inbox/{lead}'
*/
show$1.head = (args, options) => ({
	url: show$1.url(args, options),
	method: "head"
});
/**
* @see \App\Http\Controllers\Admin\LeadController::show
* @see app/Http/Controllers/Admin/LeadController.php:172
* @route '/app/inbox/{lead}'
*/
var showForm$1 = (args, options) => ({
	action: show$1.url(args, options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\LeadController::show
* @see app/Http/Controllers/Admin/LeadController.php:172
* @route '/app/inbox/{lead}'
*/
showForm$1.get = (args, options) => ({
	action: show$1.url(args, options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\LeadController::show
* @see app/Http/Controllers/Admin/LeadController.php:172
* @route '/app/inbox/{lead}'
*/
showForm$1.head = (args, options) => ({
	action: show$1.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
show$1.form = showForm$1;
/**
* @see \App\Http\Controllers\Admin\LeadController::update
* @see app/Http/Controllers/Admin/LeadController.php:197
* @route '/app/inbox/{lead}'
*/
var update$10 = (args, options) => ({
	url: update$10.url(args, options),
	method: "patch"
});
update$10.definition = {
	methods: ["patch"],
	url: "/app/inbox/{lead}"
};
/**
* @see \App\Http\Controllers\Admin\LeadController::update
* @see app/Http/Controllers/Admin/LeadController.php:197
* @route '/app/inbox/{lead}'
*/
update$10.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { lead: args };
	if (typeof args === "object" && !Array.isArray(args) && "id" in args) args = { lead: args.id };
	if (Array.isArray(args)) args = { lead: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { lead: typeof args.lead === "object" ? args.lead.id : args.lead };
	return update$10.definition.url.replace("{lead}", parsedArgs.lead.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\LeadController::update
* @see app/Http/Controllers/Admin/LeadController.php:197
* @route '/app/inbox/{lead}'
*/
update$10.patch = (args, options) => ({
	url: update$10.url(args, options),
	method: "patch"
});
/**
* @see \App\Http\Controllers\Admin\LeadController::update
* @see app/Http/Controllers/Admin/LeadController.php:197
* @route '/app/inbox/{lead}'
*/
var updateForm$10 = (args, options) => ({
	action: update$10.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "PATCH",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\LeadController::update
* @see app/Http/Controllers/Admin/LeadController.php:197
* @route '/app/inbox/{lead}'
*/
updateForm$10.patch = (args, options) => ({
	action: update$10.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "PATCH",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
update$10.form = updateForm$10;
/**
* @see \App\Http\Controllers\Admin\LeadController::bulkDestroy
* @see app/Http/Controllers/Admin/LeadController.php:226
* @route '/app/inbox/bulk-destroy'
*/
var bulkDestroy$1 = (options) => ({
	url: bulkDestroy$1.url(options),
	method: "post"
});
bulkDestroy$1.definition = {
	methods: ["post"],
	url: "/app/inbox/bulk-destroy"
};
/**
* @see \App\Http\Controllers\Admin\LeadController::bulkDestroy
* @see app/Http/Controllers/Admin/LeadController.php:226
* @route '/app/inbox/bulk-destroy'
*/
bulkDestroy$1.url = (options) => {
	return bulkDestroy$1.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\LeadController::bulkDestroy
* @see app/Http/Controllers/Admin/LeadController.php:226
* @route '/app/inbox/bulk-destroy'
*/
bulkDestroy$1.post = (options) => ({
	url: bulkDestroy$1.url(options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\LeadController::bulkDestroy
* @see app/Http/Controllers/Admin/LeadController.php:226
* @route '/app/inbox/bulk-destroy'
*/
var bulkDestroyForm$1 = (options) => ({
	action: bulkDestroy$1.url(options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\LeadController::bulkDestroy
* @see app/Http/Controllers/Admin/LeadController.php:226
* @route '/app/inbox/bulk-destroy'
*/
bulkDestroyForm$1.post = (options) => ({
	action: bulkDestroy$1.url(options),
	method: "post"
});
bulkDestroy$1.form = bulkDestroyForm$1;
/**
* @see \App\Http\Controllers\Admin\LeadController::destroy
* @see app/Http/Controllers/Admin/LeadController.php:209
* @route '/app/inbox/{lead}'
*/
var destroy$10 = (args, options) => ({
	url: destroy$10.url(args, options),
	method: "delete"
});
destroy$10.definition = {
	methods: ["delete"],
	url: "/app/inbox/{lead}"
};
/**
* @see \App\Http\Controllers\Admin\LeadController::destroy
* @see app/Http/Controllers/Admin/LeadController.php:209
* @route '/app/inbox/{lead}'
*/
destroy$10.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { lead: args };
	if (typeof args === "object" && !Array.isArray(args) && "id" in args) args = { lead: args.id };
	if (Array.isArray(args)) args = { lead: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { lead: typeof args.lead === "object" ? args.lead.id : args.lead };
	return destroy$10.definition.url.replace("{lead}", parsedArgs.lead.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\LeadController::destroy
* @see app/Http/Controllers/Admin/LeadController.php:209
* @route '/app/inbox/{lead}'
*/
destroy$10.delete = (args, options) => ({
	url: destroy$10.url(args, options),
	method: "delete"
});
/**
* @see \App\Http\Controllers\Admin\LeadController::destroy
* @see app/Http/Controllers/Admin/LeadController.php:209
* @route '/app/inbox/{lead}'
*/
var destroyForm$10 = (args, options) => ({
	action: destroy$10.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "DELETE",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\LeadController::destroy
* @see app/Http/Controllers/Admin/LeadController.php:209
* @route '/app/inbox/{lead}'
*/
destroyForm$10.delete = (args, options) => ({
	action: destroy$10.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "DELETE",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
destroy$10.form = destroyForm$10;
Object.assign(index$9, index$9), Object.assign(show$1, show$1), Object.assign(update$10, update$10), Object.assign(bulkDestroy$1, bulkDestroy$1), Object.assign(destroy$10, destroy$10);
//#endregion
//#region resources/js/routes/integrations/slack/index.ts
/**
* @see \App\Http\Controllers\Admin\IntegrationController::store
* @see app/Http/Controllers/Admin/IntegrationController.php:153
* @route '/app/integrations/slack'
*/
var store$9 = (options) => ({
	url: store$9.url(options),
	method: "post"
});
store$9.definition = {
	methods: ["post"],
	url: "/app/integrations/slack"
};
/**
* @see \App\Http\Controllers\Admin\IntegrationController::store
* @see app/Http/Controllers/Admin/IntegrationController.php:153
* @route '/app/integrations/slack'
*/
store$9.url = (options) => {
	return store$9.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\IntegrationController::store
* @see app/Http/Controllers/Admin/IntegrationController.php:153
* @route '/app/integrations/slack'
*/
store$9.post = (options) => ({
	url: store$9.url(options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\IntegrationController::store
* @see app/Http/Controllers/Admin/IntegrationController.php:153
* @route '/app/integrations/slack'
*/
var storeForm$9 = (options) => ({
	action: store$9.url(options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\IntegrationController::store
* @see app/Http/Controllers/Admin/IntegrationController.php:153
* @route '/app/integrations/slack'
*/
storeForm$9.post = (options) => ({
	action: store$9.url(options),
	method: "post"
});
store$9.form = storeForm$9;
var slack = { store: Object.assign(store$9, store$9) };
//#endregion
//#region resources/js/routes/integrations/webhooks/index.ts
/**
* @see \App\Http\Controllers\Admin\IntegrationController::store
* @see app/Http/Controllers/Admin/IntegrationController.php:233
* @route '/app/integrations/webhooks'
*/
var store$8 = (options) => ({
	url: store$8.url(options),
	method: "post"
});
store$8.definition = {
	methods: ["post"],
	url: "/app/integrations/webhooks"
};
/**
* @see \App\Http\Controllers\Admin\IntegrationController::store
* @see app/Http/Controllers/Admin/IntegrationController.php:233
* @route '/app/integrations/webhooks'
*/
store$8.url = (options) => {
	return store$8.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\IntegrationController::store
* @see app/Http/Controllers/Admin/IntegrationController.php:233
* @route '/app/integrations/webhooks'
*/
store$8.post = (options) => ({
	url: store$8.url(options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\IntegrationController::store
* @see app/Http/Controllers/Admin/IntegrationController.php:233
* @route '/app/integrations/webhooks'
*/
var storeForm$8 = (options) => ({
	action: store$8.url(options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\IntegrationController::store
* @see app/Http/Controllers/Admin/IntegrationController.php:233
* @route '/app/integrations/webhooks'
*/
storeForm$8.post = (options) => ({
	action: store$8.url(options),
	method: "post"
});
store$8.form = storeForm$8;
/**
* @see \App\Http\Controllers\Admin\IntegrationController::update
* @see app/Http/Controllers/Admin/IntegrationController.php:257
* @route '/app/integrations/webhooks/{webhookSubscription}'
*/
var update$9 = (args, options) => ({
	url: update$9.url(args, options),
	method: "patch"
});
update$9.definition = {
	methods: ["patch"],
	url: "/app/integrations/webhooks/{webhookSubscription}"
};
/**
* @see \App\Http\Controllers\Admin\IntegrationController::update
* @see app/Http/Controllers/Admin/IntegrationController.php:257
* @route '/app/integrations/webhooks/{webhookSubscription}'
*/
update$9.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { webhookSubscription: args };
	if (typeof args === "object" && !Array.isArray(args) && "id" in args) args = { webhookSubscription: args.id };
	if (Array.isArray(args)) args = { webhookSubscription: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { webhookSubscription: typeof args.webhookSubscription === "object" ? args.webhookSubscription.id : args.webhookSubscription };
	return update$9.definition.url.replace("{webhookSubscription}", parsedArgs.webhookSubscription.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\IntegrationController::update
* @see app/Http/Controllers/Admin/IntegrationController.php:257
* @route '/app/integrations/webhooks/{webhookSubscription}'
*/
update$9.patch = (args, options) => ({
	url: update$9.url(args, options),
	method: "patch"
});
/**
* @see \App\Http\Controllers\Admin\IntegrationController::update
* @see app/Http/Controllers/Admin/IntegrationController.php:257
* @route '/app/integrations/webhooks/{webhookSubscription}'
*/
var updateForm$9 = (args, options) => ({
	action: update$9.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "PATCH",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\IntegrationController::update
* @see app/Http/Controllers/Admin/IntegrationController.php:257
* @route '/app/integrations/webhooks/{webhookSubscription}'
*/
updateForm$9.patch = (args, options) => ({
	action: update$9.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "PATCH",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
update$9.form = updateForm$9;
/**
* @see \App\Http\Controllers\Admin\IntegrationController::destroy
* @see app/Http/Controllers/Admin/IntegrationController.php:293
* @route '/app/integrations/webhooks/{webhookSubscription}'
*/
var destroy$9 = (args, options) => ({
	url: destroy$9.url(args, options),
	method: "delete"
});
destroy$9.definition = {
	methods: ["delete"],
	url: "/app/integrations/webhooks/{webhookSubscription}"
};
/**
* @see \App\Http\Controllers\Admin\IntegrationController::destroy
* @see app/Http/Controllers/Admin/IntegrationController.php:293
* @route '/app/integrations/webhooks/{webhookSubscription}'
*/
destroy$9.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { webhookSubscription: args };
	if (typeof args === "object" && !Array.isArray(args) && "id" in args) args = { webhookSubscription: args.id };
	if (Array.isArray(args)) args = { webhookSubscription: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { webhookSubscription: typeof args.webhookSubscription === "object" ? args.webhookSubscription.id : args.webhookSubscription };
	return destroy$9.definition.url.replace("{webhookSubscription}", parsedArgs.webhookSubscription.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\IntegrationController::destroy
* @see app/Http/Controllers/Admin/IntegrationController.php:293
* @route '/app/integrations/webhooks/{webhookSubscription}'
*/
destroy$9.delete = (args, options) => ({
	url: destroy$9.url(args, options),
	method: "delete"
});
/**
* @see \App\Http\Controllers\Admin\IntegrationController::destroy
* @see app/Http/Controllers/Admin/IntegrationController.php:293
* @route '/app/integrations/webhooks/{webhookSubscription}'
*/
var destroyForm$9 = (args, options) => ({
	action: destroy$9.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "DELETE",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\IntegrationController::destroy
* @see app/Http/Controllers/Admin/IntegrationController.php:293
* @route '/app/integrations/webhooks/{webhookSubscription}'
*/
destroyForm$9.delete = (args, options) => ({
	action: destroy$9.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "DELETE",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
destroy$9.form = destroyForm$9;
/**
* @see \App\Http\Controllers\Admin\IntegrationController::rotate
* @see app/Http/Controllers/Admin/IntegrationController.php:305
* @route '/app/integrations/webhooks/{webhookSubscription}/rotate-secret'
*/
var rotate = (args, options) => ({
	url: rotate.url(args, options),
	method: "post"
});
rotate.definition = {
	methods: ["post"],
	url: "/app/integrations/webhooks/{webhookSubscription}/rotate-secret"
};
/**
* @see \App\Http\Controllers\Admin\IntegrationController::rotate
* @see app/Http/Controllers/Admin/IntegrationController.php:305
* @route '/app/integrations/webhooks/{webhookSubscription}/rotate-secret'
*/
rotate.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { webhookSubscription: args };
	if (typeof args === "object" && !Array.isArray(args) && "id" in args) args = { webhookSubscription: args.id };
	if (Array.isArray(args)) args = { webhookSubscription: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { webhookSubscription: typeof args.webhookSubscription === "object" ? args.webhookSubscription.id : args.webhookSubscription };
	return rotate.definition.url.replace("{webhookSubscription}", parsedArgs.webhookSubscription.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\IntegrationController::rotate
* @see app/Http/Controllers/Admin/IntegrationController.php:305
* @route '/app/integrations/webhooks/{webhookSubscription}/rotate-secret'
*/
rotate.post = (args, options) => ({
	url: rotate.url(args, options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\IntegrationController::rotate
* @see app/Http/Controllers/Admin/IntegrationController.php:305
* @route '/app/integrations/webhooks/{webhookSubscription}/rotate-secret'
*/
var rotateForm = (args, options) => ({
	action: rotate.url(args, options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\IntegrationController::rotate
* @see app/Http/Controllers/Admin/IntegrationController.php:305
* @route '/app/integrations/webhooks/{webhookSubscription}/rotate-secret'
*/
rotateForm.post = (args, options) => ({
	action: rotate.url(args, options),
	method: "post"
});
rotate.form = rotateForm;
var webhooks = {
	store: Object.assign(store$8, store$8),
	update: Object.assign(update$9, update$9),
	destroy: Object.assign(destroy$9, destroy$9),
	rotate: Object.assign(rotate, rotate)
};
//#endregion
//#region resources/js/routes/integrations/index.ts
/**
* @see \App\Http\Controllers\Admin\IntegrationController::index
* @see app/Http/Controllers/Admin/IntegrationController.php:35
* @route '/app/integrations'
*/
var index$8 = (options) => ({
	url: index$8.url(options),
	method: "get"
});
index$8.definition = {
	methods: ["get", "head"],
	url: "/app/integrations"
};
/**
* @see \App\Http\Controllers\Admin\IntegrationController::index
* @see app/Http/Controllers/Admin/IntegrationController.php:35
* @route '/app/integrations'
*/
index$8.url = (options) => {
	return index$8.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\IntegrationController::index
* @see app/Http/Controllers/Admin/IntegrationController.php:35
* @route '/app/integrations'
*/
index$8.get = (options) => ({
	url: index$8.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\IntegrationController::index
* @see app/Http/Controllers/Admin/IntegrationController.php:35
* @route '/app/integrations'
*/
index$8.head = (options) => ({
	url: index$8.url(options),
	method: "head"
});
/**
* @see \App\Http\Controllers\Admin\IntegrationController::index
* @see app/Http/Controllers/Admin/IntegrationController.php:35
* @route '/app/integrations'
*/
var indexForm$8 = (options) => ({
	action: index$8.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\IntegrationController::index
* @see app/Http/Controllers/Admin/IntegrationController.php:35
* @route '/app/integrations'
*/
indexForm$8.get = (options) => ({
	action: index$8.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\IntegrationController::index
* @see app/Http/Controllers/Admin/IntegrationController.php:35
* @route '/app/integrations'
*/
indexForm$8.head = (options) => ({
	action: index$8.url({ [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
index$8.form = indexForm$8;
/**
* @see \App\Http\Controllers\Admin\IntegrationController::destroy
* @see app/Http/Controllers/Admin/IntegrationController.php:281
* @route '/app/integrations/{integration}'
*/
var destroy$8 = (args, options) => ({
	url: destroy$8.url(args, options),
	method: "delete"
});
destroy$8.definition = {
	methods: ["delete"],
	url: "/app/integrations/{integration}"
};
/**
* @see \App\Http\Controllers\Admin\IntegrationController::destroy
* @see app/Http/Controllers/Admin/IntegrationController.php:281
* @route '/app/integrations/{integration}'
*/
destroy$8.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { integration: args };
	if (typeof args === "object" && !Array.isArray(args) && "id" in args) args = { integration: args.id };
	if (Array.isArray(args)) args = { integration: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { integration: typeof args.integration === "object" ? args.integration.id : args.integration };
	return destroy$8.definition.url.replace("{integration}", parsedArgs.integration.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\IntegrationController::destroy
* @see app/Http/Controllers/Admin/IntegrationController.php:281
* @route '/app/integrations/{integration}'
*/
destroy$8.delete = (args, options) => ({
	url: destroy$8.url(args, options),
	method: "delete"
});
/**
* @see \App\Http\Controllers\Admin\IntegrationController::destroy
* @see app/Http/Controllers/Admin/IntegrationController.php:281
* @route '/app/integrations/{integration}'
*/
var destroyForm$8 = (args, options) => ({
	action: destroy$8.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "DELETE",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\IntegrationController::destroy
* @see app/Http/Controllers/Admin/IntegrationController.php:281
* @route '/app/integrations/{integration}'
*/
destroyForm$8.delete = (args, options) => ({
	action: destroy$8.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "DELETE",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
destroy$8.form = destroyForm$8;
Object.assign(index$8, index$8), Object.assign(slack, slack), Object.assign(webhooks, webhooks), Object.assign(destroy$8, destroy$8);
//#endregion
//#region resources/js/routes/members/index.ts
/**
* @see \App\Http\Controllers\Admin\MemberController::index
* @see app/Http/Controllers/Admin/MemberController.php:24
* @route '/app/members'
*/
var index$7 = (options) => ({
	url: index$7.url(options),
	method: "get"
});
index$7.definition = {
	methods: ["get", "head"],
	url: "/app/members"
};
/**
* @see \App\Http\Controllers\Admin\MemberController::index
* @see app/Http/Controllers/Admin/MemberController.php:24
* @route '/app/members'
*/
index$7.url = (options) => {
	return index$7.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\MemberController::index
* @see app/Http/Controllers/Admin/MemberController.php:24
* @route '/app/members'
*/
index$7.get = (options) => ({
	url: index$7.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\MemberController::index
* @see app/Http/Controllers/Admin/MemberController.php:24
* @route '/app/members'
*/
index$7.head = (options) => ({
	url: index$7.url(options),
	method: "head"
});
/**
* @see \App\Http\Controllers\Admin\MemberController::index
* @see app/Http/Controllers/Admin/MemberController.php:24
* @route '/app/members'
*/
var indexForm$7 = (options) => ({
	action: index$7.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\MemberController::index
* @see app/Http/Controllers/Admin/MemberController.php:24
* @route '/app/members'
*/
indexForm$7.get = (options) => ({
	action: index$7.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\MemberController::index
* @see app/Http/Controllers/Admin/MemberController.php:24
* @route '/app/members'
*/
indexForm$7.head = (options) => ({
	action: index$7.url({ [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
index$7.form = indexForm$7;
/**
* @see \App\Http\Controllers\Admin\MemberController::store
* @see app/Http/Controllers/Admin/MemberController.php:55
* @route '/app/members'
*/
var store$7 = (options) => ({
	url: store$7.url(options),
	method: "post"
});
store$7.definition = {
	methods: ["post"],
	url: "/app/members"
};
/**
* @see \App\Http\Controllers\Admin\MemberController::store
* @see app/Http/Controllers/Admin/MemberController.php:55
* @route '/app/members'
*/
store$7.url = (options) => {
	return store$7.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\MemberController::store
* @see app/Http/Controllers/Admin/MemberController.php:55
* @route '/app/members'
*/
store$7.post = (options) => ({
	url: store$7.url(options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\MemberController::store
* @see app/Http/Controllers/Admin/MemberController.php:55
* @route '/app/members'
*/
var storeForm$7 = (options) => ({
	action: store$7.url(options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\MemberController::store
* @see app/Http/Controllers/Admin/MemberController.php:55
* @route '/app/members'
*/
storeForm$7.post = (options) => ({
	action: store$7.url(options),
	method: "post"
});
store$7.form = storeForm$7;
/**
* @see \App\Http\Controllers\Admin\MemberController::destroy
* @see app/Http/Controllers/Admin/MemberController.php:126
* @route '/app/members/{member}'
*/
var destroy$7 = (args, options) => ({
	url: destroy$7.url(args, options),
	method: "delete"
});
destroy$7.definition = {
	methods: ["delete"],
	url: "/app/members/{member}"
};
/**
* @see \App\Http\Controllers\Admin\MemberController::destroy
* @see app/Http/Controllers/Admin/MemberController.php:126
* @route '/app/members/{member}'
*/
destroy$7.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { member: args };
	if (typeof args === "object" && !Array.isArray(args) && "id" in args) args = { member: args.id };
	if (Array.isArray(args)) args = { member: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { member: typeof args.member === "object" ? args.member.id : args.member };
	return destroy$7.definition.url.replace("{member}", parsedArgs.member.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\MemberController::destroy
* @see app/Http/Controllers/Admin/MemberController.php:126
* @route '/app/members/{member}'
*/
destroy$7.delete = (args, options) => ({
	url: destroy$7.url(args, options),
	method: "delete"
});
/**
* @see \App\Http\Controllers\Admin\MemberController::destroy
* @see app/Http/Controllers/Admin/MemberController.php:126
* @route '/app/members/{member}'
*/
var destroyForm$7 = (args, options) => ({
	action: destroy$7.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "DELETE",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\MemberController::destroy
* @see app/Http/Controllers/Admin/MemberController.php:126
* @route '/app/members/{member}'
*/
destroyForm$7.delete = (args, options) => ({
	action: destroy$7.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "DELETE",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
destroy$7.form = destroyForm$7;
Object.assign(index$7, index$7), Object.assign(store$7, store$7), Object.assign(destroy$7, destroy$7);
//#endregion
//#region resources/js/components/app-sidebar.tsx
function makeMainNavItems(t) {
	return [
		{
			key: "Dashboard",
			title: t("Dashboard"),
			href: dashboard$1(),
			icon: LayoutGrid
		},
		{
			key: "Inbox",
			title: t("Inbox"),
			href: index$9(),
			icon: Inbox
		},
		{
			key: "Conversations",
			title: t("Conversations"),
			href: index$10(),
			icon: MessagesSquare
		},
		{
			key: "Agents",
			title: t("Agents"),
			href: index$12(),
			icon: Bot
		},
		{
			key: "Workflows",
			title: t("Workflows"),
			href: "/app/workflows",
			icon: Workflow
		},
		{
			key: "Analytics",
			title: t("Analytics"),
			href: overview(),
			icon: BarChart3
		},
		{
			key: "Integrations",
			title: t("Integrations"),
			href: index$8(),
			icon: Plug
		},
		{
			key: "Members",
			title: t("Members"),
			href: index$7().url,
			icon: Users
		},
		{
			key: "Audit",
			title: t("Audit log"),
			href: "/app/audit",
			icon: ScrollText
		},
		{
			key: "SystemHealth",
			title: t("System health"),
			href: "/app/system-health",
			icon: Activity
		},
		{
			key: "Billing",
			title: t("Billing"),
			href: show$3(),
			icon: CreditCard
		}
	];
}
var footerCardClassName = "group relative flex h-[59px] w-full items-center gap-[14px] overflow-hidden rounded-lg border px-[10px] text-start transition-all duration-200 dark:shadow-[0_22px_48px_-38px_rgba(0,0,0,0.96),inset_0_1px_0_rgba(255,255,255,0.045)]";
var footerIconWrapClassName = "relative flex size-9 shrink-0 items-center justify-center rounded-lg border dark:shadow-[0_18px_32px_-22px_rgba(0,0,0,0.92),inset_0_1px_0_rgba(255,255,255,0.16)]";
function AppSidebar() {
	const branding = useBranding();
	const { t } = useT();
	const { auth, liveHandoff, billingSummary } = usePage().props;
	const isAdmin = auth?.user?.is_super_admin === true;
	const isOnPaidPlan = (billingSummary?.plan?.price_cents ?? 0) > 0;
	const needsHuman = liveHandoff?.needs_human ?? 0;
	const customerNavItems = makeMainNavItems(t).map((item) => item.key === "Conversations" && needsHuman > 0 ? {
		...item,
		badge: String(needsHuman)
	} : item).filter((item) => !(isAdmin && item.key === "Billing")).filter((item) => item.key !== "SystemHealth" || isAdmin);
	return /* @__PURE__ */ jsxs(Sidebar, {
		collapsible: "icon",
		className: "border-e border-sidebar-border",
		children: [
			/* @__PURE__ */ jsx(SidebarHeader, {
				className: "border-b border-sidebar-border/80 p-3",
				children: /* @__PURE__ */ jsx(SidebarMenu, { children: /* @__PURE__ */ jsx(SidebarMenuItem, { children: /* @__PURE__ */ jsx(SidebarMenuButton, {
					size: "lg",
					asChild: true,
					tooltip: { children: branding.site_title },
					className: "h-11 rounded-xl px-3 transition-colors group-data-[collapsible=icon]:size-10! group-data-[collapsible=icon]:p-0! hover:bg-sidebar-accent/60",
					children: /* @__PURE__ */ jsx(Link, {
						href: dashboard$1(),
						prefetch: true,
						children: /* @__PURE__ */ jsx(AppLogo, {})
					})
				}) }) })
			}),
			/* @__PURE__ */ jsx(SidebarContent, {
				className: "gap-0 py-3",
				children: /* @__PURE__ */ jsx(NavMain, { items: customerNavItems })
			}),
			/* @__PURE__ */ jsxs(SidebarFooter, {
				className: "gap-3 border-t border-sidebar-border/70 p-[11px] group-data-[collapsible=icon]:p-2",
				children: [
					/* @__PURE__ */ jsxs("div", {
						className: "space-y-[9px] group-data-[collapsible=icon]:hidden",
						children: [
							/* @__PURE__ */ jsx(WorkspaceSwitcher, {}),
							/* @__PURE__ */ jsxs(Link, {
								href: onboarding(),
								className: cn(footerCardClassName, "border-violet-200 bg-violet-50 hover:border-violet-300 hover:bg-violet-100", "dark:border-violet-300/14 dark:bg-[radial-gradient(circle_at_18%_24%,rgba(122,91,255,0.22),transparent_38%),linear-gradient(105deg,rgba(24,23,36,0.98),rgba(16,17,25,0.98)_64%,rgba(22,23,37,0.98))] dark:hover:border-violet-200/24 dark:hover:bg-[radial-gradient(circle_at_18%_24%,rgba(147,118,255,0.28),transparent_40%),linear-gradient(105deg,rgba(28,26,43,1),rgba(17,18,27,1)_66%,rgba(25,26,42,1))]"),
								children: [
									/* @__PURE__ */ jsx("span", {
										className: cn(footerIconWrapClassName, "border-violet-300 bg-violet-500", "dark:border-violet-200/18 dark:bg-[radial-gradient(circle_at_72%_24%,rgba(255,255,255,0.22),transparent_18%),linear-gradient(180deg,rgba(92,72,159,0.62),rgba(42,36,67,0.88))]"),
										children: /* @__PURE__ */ jsx(Sparkles, { className: "size-5 text-white dark:drop-shadow-[0_0_10px_rgba(221,214,254,0.35)]" })
									}),
									/* @__PURE__ */ jsxs("span", {
										className: "flex min-w-0 flex-1 flex-col justify-center gap-1.5",
										children: [/* @__PURE__ */ jsx("span", {
											className: "truncate text-[13px] leading-none font-semibold text-violet-950 dark:text-white/96",
											children: t("Getting Started")
										}), /* @__PURE__ */ jsx("span", {
											className: "truncate text-[11px] leading-none font-medium text-violet-700/80 dark:text-white/54",
											children: t("Set up :name in a few steps", { name: branding.site_title })
										})]
									}),
									/* @__PURE__ */ jsx(ArrowRight, { className: "ms-auto size-4 shrink-0 text-violet-700 transition-transform duration-200 group-hover:translate-x-0.5 group-hover:text-violet-900 dark:text-white/78 dark:group-hover:text-white" })
								]
							}),
							!isAdmin && !isOnPaidPlan && /* @__PURE__ */ jsxs(Link, {
								href: show$3(),
								className: cn(footerCardClassName, "border-sky-200 bg-sky-50 hover:border-sky-300 hover:bg-sky-100", "dark:border-sky-300/18 dark:bg-[radial-gradient(circle_at_18%_24%,rgba(15,118,255,0.30),transparent_36%),linear-gradient(105deg,rgba(8,25,42,0.98),rgba(10,13,18,0.98)_64%,rgba(11,15,21,0.98))] dark:hover:border-sky-200/28 dark:hover:bg-[radial-gradient(circle_at_18%_24%,rgba(30,134,255,0.36),transparent_38%),linear-gradient(105deg,rgba(8,31,54,1),rgba(10,14,20,1)_66%,rgba(11,16,23,1))]"),
								children: [
									/* @__PURE__ */ jsx("span", {
										className: cn(footerIconWrapClassName, "border-sky-300 bg-[linear-gradient(180deg,#2f86ff,#164fff)] text-white", "dark:border-sky-200/34 dark:shadow-[0_0_34px_-12px_rgba(37,99,235,0.92),inset_0_1px_0_rgba(255,255,255,0.2)]"),
										children: /* @__PURE__ */ jsx(Zap, { className: "size-5 dark:drop-shadow-[0_0_8px_rgba(255,255,255,0.45)]" })
									}),
									/* @__PURE__ */ jsxs("span", {
										className: "flex min-w-0 flex-1 flex-col justify-center gap-1.5",
										children: [/* @__PURE__ */ jsx("span", {
											className: "truncate text-[13px] leading-none font-semibold text-sky-950 dark:text-white/96",
											children: t("Upgrade to Pro")
										}), /* @__PURE__ */ jsx("span", {
											className: "truncate text-[11px] leading-none font-medium text-sky-700/80 dark:text-white/54",
											children: t("Unlock more conversations")
										})]
									}),
									/* @__PURE__ */ jsx(ArrowRight, { className: "ms-auto size-4 shrink-0 text-sky-600 transition-transform duration-200 group-hover:translate-x-0.5 group-hover:text-sky-800 dark:text-blue-400 dark:group-hover:text-blue-200" })
								]
							})
						]
					}),
					/* @__PURE__ */ jsxs(SidebarMenu, {
						className: "hidden group-data-[collapsible=icon]:flex group-data-[collapsible=icon]:flex-col",
						children: [
							/* @__PURE__ */ jsx(SidebarMenuItem, { children: /* @__PURE__ */ jsx(WorkspaceSwitcher, {}) }),
							/* @__PURE__ */ jsx(SidebarMenuItem, { children: /* @__PURE__ */ jsx(SidebarMenuButton, {
								asChild: true,
								tooltip: { children: t("Getting Started") },
								className: "h-9 rounded-xl border border-sidebar-border/60 bg-sidebar-accent/35",
								children: /* @__PURE__ */ jsxs(Link, {
									href: onboarding(),
									children: [/* @__PURE__ */ jsx(Sparkles, { className: "size-4" }), /* @__PURE__ */ jsx("span", { children: t("Getting Started") })]
								})
							}) }),
							!isAdmin && !isOnPaidPlan && /* @__PURE__ */ jsx(SidebarMenuItem, { children: /* @__PURE__ */ jsx(SidebarMenuButton, {
								asChild: true,
								tooltip: { children: t("Upgrade to Pro") },
								className: "h-9 rounded-xl border border-sidebar-border/60 bg-sidebar-accent/35",
								children: /* @__PURE__ */ jsxs(Link, {
									href: show$3(),
									children: [/* @__PURE__ */ jsx(CreditCard, { className: "size-4" }), /* @__PURE__ */ jsx("span", { children: t("Upgrade to Pro") })]
								})
							}) })
						]
					}),
					/* @__PURE__ */ jsx(NavUser, {})
				]
			})
		]
	});
}
//#endregion
//#region resources/js/components/locale-suggestion-banner.tsx
/**
* Slim top-of-page banner offering the visitor's browser-locale
* country a one-tap switch to the matching translation. Server side
* (LocaleResolver::suggestionFor) suppresses the banner once the
* dismiss cookie is set or when the suggestion already matches the
* current locale, so this component just renders what it's told.
*
* Two actions:
*   - "Switch to <locale>" — PATCH /locale/switch sets users.locale +
*     pb_locale cookie, reload re-renders in the new language.
*   - "✕" — POST /locale/dismiss-suggestion sets a 180-day cookie so
*     this banner never appears on this device again.
*/
function LocaleSuggestionBanner() {
	const { t } = useT();
	const { catalog, multilingual } = useI18n();
	const { localeSuggestion } = usePage().props;
	const [hidden, setHidden] = useState(false);
	if (!multilingual || !localeSuggestion || hidden) return null;
	const { suggested } = localeSuggestion;
	const flag = localeFlag(catalog, suggested);
	const label = localeLabel(catalog, suggested);
	const accept = () => {
		setHidden(true);
		router.patch("/locale/switch", { locale: suggested }, {
			preserveScroll: true,
			preserveState: false
		});
	};
	const dismiss = () => {
		setHidden(true);
		fetch("/locale/dismiss-suggestion", {
			method: "POST",
			credentials: "same-origin",
			headers: {
				"X-CSRF-TOKEN": document.querySelector("meta[name=\"csrf-token\"]")?.getAttribute("content") ?? "",
				Accept: "application/json"
			}
		}).catch(() => {});
	};
	return /* @__PURE__ */ jsxs("div", {
		role: "status",
		className: "flex items-center gap-3 border-b border-emerald-500/25 bg-emerald-500/8 px-4 py-2 text-sm",
		children: [
			/* @__PURE__ */ jsx(Globe, { className: "size-4 shrink-0 text-emerald-700 dark:text-emerald-300" }),
			/* @__PURE__ */ jsxs("span", {
				className: "flex-1 text-foreground",
				children: [
					/* @__PURE__ */ jsx("span", {
						"aria-hidden": true,
						className: "me-1.5",
						children: flag
					}),
					t("Switch to"),
					" ",
					/* @__PURE__ */ jsx("strong", { children: label }),
					"?"
				]
			}),
			/* @__PURE__ */ jsx(Button, {
				type: "button",
				size: "sm",
				onClick: accept,
				className: "h-7 rounded-full bg-emerald-600 px-3 text-xs font-semibold text-white hover:bg-emerald-700",
				children: t("Switch to :name", { name: label })
			}),
			/* @__PURE__ */ jsx(Button, {
				type: "button",
				size: "icon",
				variant: "ghost",
				onClick: dismiss,
				"aria-label": t("Keep current language"),
				className: "size-7 rounded-full text-muted-foreground hover:bg-muted/40",
				children: /* @__PURE__ */ jsx(X, { className: "size-3.5" })
			})
		]
	});
}
//#endregion
//#region resources/js/components/trial-banner.tsx
/**
* Slim app-wide trial countdown. Renders only while a workspace is on an
* active (not-yet-expired) trial — once it expires the EnsureTrialActive
* middleware walls the surface to the billing page, so there's no app
* shell left to host a banner.
*
* Mounted inside AppContent (not fixed-position) so it never competes
* with UsageBanner for the `--app-shell-top-offset` sticky slot.
*/
function TrialBanner() {
	const { t } = useT();
	const { trial } = usePage().props;
	if (!trial || !trial.active) return null;
	const days = trial.days_left ?? 0;
	return /* @__PURE__ */ jsxs("div", {
		className: "flex flex-wrap items-center justify-between gap-3 border-b border-amber-200 bg-amber-50 px-4 py-2 text-sm text-amber-900 dark:border-amber-500/30 dark:bg-amber-500/10 dark:text-amber-200",
		children: [/* @__PURE__ */ jsxs("div", {
			className: "flex items-center gap-2",
			children: [/* @__PURE__ */ jsx(Clock, { className: "size-4 shrink-0" }), /* @__PURE__ */ jsx("span", { children: days <= 1 ? t("Your free trial ends today. Upgrade to keep your agents live.") : t(":days days left in your free trial.", { days: days.toLocaleString() }) })]
		}), /* @__PURE__ */ jsx(Link, {
			href: show$3().url,
			className: "rounded-md bg-amber-600 px-3 py-1 text-xs font-medium text-white hover:bg-amber-700",
			children: t("Upgrade now")
		})]
	});
}
//#endregion
//#region resources/js/components/usage-banner.tsx
function UsageBanner() {
	const { t } = useT();
	const { billingSummary } = usePage().props;
	const bannerRef = useRef(null);
	const hasLimit = billingSummary !== null && billingSummary.limit > 0;
	const overLimit = hasLimit && billingSummary.used >= billingSummary.limit;
	const nearLimit = hasLimit && !overLimit && billingSummary.percent >= 80;
	const isVisible = hasLimit && (overLimit || nearLimit);
	useEffect(() => {
		if (!isVisible) {
			document.documentElement.style.removeProperty("--app-shell-top-offset");
			return;
		}
		const node = bannerRef.current;
		if (!node) return;
		const syncOffset = () => {
			document.documentElement.style.setProperty("--app-shell-top-offset", `${node.offsetHeight}px`);
		};
		syncOffset();
		const observer = new ResizeObserver(syncOffset);
		observer.observe(node);
		window.addEventListener("resize", syncOffset);
		return () => {
			observer.disconnect();
			window.removeEventListener("resize", syncOffset);
			document.documentElement.style.removeProperty("--app-shell-top-offset");
		};
	}, [isVisible]);
	if (!billingSummary || !hasLimit) return null;
	if (!isVisible) return null;
	return /* @__PURE__ */ jsxs("div", {
		ref: bannerRef,
		className: `sticky top-0 z-40 flex items-center justify-between gap-3 px-4 py-2 text-sm shadow ${overLimit ? "bg-rose-600 text-white" : "bg-amber-500 text-white"}`,
		children: [/* @__PURE__ */ jsxs("div", {
			className: "flex items-center gap-2",
			children: [/* @__PURE__ */ jsx(AlertTriangle, { className: "size-4" }), /* @__PURE__ */ jsx("span", { children: overLimit ? t("Monthly conversation limit reached (:used / :limit). New visitors are paused.", {
				used: billingSummary.used.toLocaleString(),
				limit: billingSummary.limit.toLocaleString()
			}) : t(":percent% of this month's conversations used (:used / :limit).", {
				percent: billingSummary.percent,
				used: billingSummary.used.toLocaleString(),
				limit: billingSummary.limit.toLocaleString()
			}) })]
		}), /* @__PURE__ */ jsx(Link, {
			href: "/app/billing",
			className: "rounded bg-white/20 px-3 py-1 text-xs font-medium hover:bg-white/30",
			children: overLimit ? t("Upgrade now") : t("Manage plan")
		})]
	});
}
//#endregion
//#region resources/js/components/whats-new-banner.tsx
/**
* "What's new" banner shown to authenticated workspace members
* when there's a published changelog entry newer than their
* last_changelog_seen_at timestamp. Dismissing the banner POSTs to
* /changelog/seen so the timestamp updates and the banner stays
* hidden until the next entry lands.
*
* Mounted INSIDE `<AppContent>` (not above `<AppShell>`) so the
* fixed-position sidebar can't clip the banner's left edge — that
* was the v1.1.0 launch bug where "What's new in" rendered as
* "'s new in" on wide screens.
*
* Returns null when there's nothing to show — never renders for
* super_admins (they author the changelog themselves, see
* HandleInertiaRequests::changelogTeaser).
*/
function WhatsNewBanner() {
	const { t } = useT();
	const { changelogTeaser } = usePage().props;
	const [dismissed, setDismissed] = useState(false);
	if (!changelogTeaser) return null;
	if (dismissed) return null;
	if (changelogTeaser.last_seen_at !== null && changelogTeaser.released_at !== null && changelogTeaser.last_seen_at >= changelogTeaser.released_at) return null;
	const dismiss = () => {
		setDismissed(true);
		fetch("/changelog/seen", {
			method: "POST",
			credentials: "same-origin",
			headers: {
				"X-CSRF-TOKEN": document.querySelector("meta[name=\"csrf-token\"]")?.content ?? "",
				Accept: "application/json"
			}
		}).catch(() => {});
	};
	return /* @__PURE__ */ jsx("div", {
		className: "border-b border-emerald-200 bg-emerald-50/70 text-emerald-900 dark:border-emerald-900/40 dark:bg-emerald-950/40 dark:text-emerald-200",
		children: /* @__PURE__ */ jsxs("div", {
			className: "flex items-center gap-2 px-3 py-1.5 text-sm sm:gap-3 sm:px-4",
			children: [
				/* @__PURE__ */ jsx(Sparkles, {
					"aria-hidden": "true",
					className: "size-4 shrink-0 text-emerald-600"
				}),
				/* @__PURE__ */ jsx("span", {
					className: "hidden shrink-0 font-medium sm:inline",
					children: t("What's new in")
				}),
				/* @__PURE__ */ jsx("span", {
					className: "shrink-0 rounded-full border border-emerald-300 bg-white/70 px-2 py-0.5 font-mono text-xs font-semibold text-emerald-800 dark:border-emerald-700/60 dark:bg-emerald-900/40 dark:text-emerald-200",
					children: changelogTeaser.version
				}),
				/* @__PURE__ */ jsx("span", {
					className: "min-w-0 flex-1 truncate",
					title: changelogTeaser.title,
					children: changelogTeaser.title
				}),
				/* @__PURE__ */ jsx(Link, {
					href: "/changelog",
					className: "shrink-0 rounded-md border border-emerald-300 bg-white/80 px-2.5 py-0.5 text-xs font-semibold hover:bg-white dark:border-emerald-700/60 dark:bg-transparent",
					onClick: dismiss,
					children: t("Read")
				}),
				/* @__PURE__ */ jsx("button", {
					type: "button",
					onClick: dismiss,
					"aria-label": t("Dismiss"),
					className: "shrink-0 rounded p-0.5 hover:bg-emerald-100 dark:hover:bg-emerald-900/40",
					children: /* @__PURE__ */ jsx(X, { className: "size-4" })
				})
			]
		})
	});
}
//#endregion
//#region resources/js/hooks/use-presence.ts
/**
* Admin-tab presence heartbeat.
*
* Pings POST /app/me/presence every 60 seconds while the tab is the
* active foreground tab. The endpoint bumps users.last_active_at,
* which WorkspacePresence reads to decide whether the visitor's
* "Connect me with a human" pill should queue them or fall back to
* the "we're offline" treatment.
*
* Pauses when the tab is hidden (battery + cost) and on logout. Runs
* regardless of whether the user has opted into live chat — opt-in is
* read server-side; sending the heartbeat unconditionally keeps the
* shell free of policy logic.
*/
var HEARTBEAT_INTERVAL_MS = 6e4;
function usePresence(enabled) {
	useEffect(() => {
		if (!enabled) return;
		const csrf = document.querySelector("meta[name=\"csrf-token\"]")?.content ?? "";
		const tick = () => {
			if (document.visibilityState !== "visible") return;
			fetch("/app/me/presence", {
				method: "POST",
				headers: {
					"X-CSRF-TOKEN": csrf,
					"X-Requested-With": "XMLHttpRequest",
					Accept: "application/json"
				},
				credentials: "same-origin"
			}).catch(() => {});
		};
		tick();
		const id = window.setInterval(tick, HEARTBEAT_INTERVAL_MS);
		return () => {
			window.clearInterval(id);
		};
	}, [enabled]);
}
//#endregion
//#region resources/js/layouts/app/app-sidebar-layout.tsx
function AppSidebarLayout({ children, breadcrumbs = [] }) {
	useLeadToasts(true);
	usePresence(true);
	return /* @__PURE__ */ jsxs(Fragment$1, { children: [
		/* @__PURE__ */ jsx(ImpersonationBanner, {}),
		/* @__PURE__ */ jsx(UsageBanner, {}),
		/* @__PURE__ */ jsxs(AppShell, {
			variant: "sidebar",
			sidebarWidth: "20rem",
			children: [/* @__PURE__ */ jsx(AppSidebar, {}), /* @__PURE__ */ jsxs(AppContent, {
				variant: "sidebar",
				className: "overflow-x-hidden",
				children: [
					/* @__PURE__ */ jsx(TrialBanner, {}),
					/* @__PURE__ */ jsx(WhatsNewBanner, {}),
					/* @__PURE__ */ jsx(LocaleSuggestionBanner, {}),
					/* @__PURE__ */ jsx(AppSidebarHeader, { breadcrumbs }),
					children
				]
			})]
		})
	] });
}
//#endregion
//#region resources/js/layouts/app-layout.tsx
function AppLayout({ breadcrumbs = [], children }) {
	return /* @__PURE__ */ jsx(AppSidebarLayout, {
		breadcrumbs,
		children
	});
}
//#endregion
//#region resources/js/pages/admin/hotpath-latency.tsx
var hotpath_latency_exports = /* @__PURE__ */ __exportAll({ default: () => HotPathLatency });
var STAGE_CARDS = [
	{
		key: "first_token_ms",
		label: "First token"
	},
	{
		key: "tool_loop_ms",
		label: "Tool loop"
	},
	{
		key: "retrieve_ms",
		label: "Retrieval (total)"
	},
	{
		key: "embed_ms",
		label: "Embed query"
	},
	{
		key: "ann_ms",
		label: "Vector search"
	},
	{
		key: "rerank_ms",
		label: "Rerank"
	},
	{
		key: "llm_ms",
		label: "LLM full reply"
	},
	{
		key: "total_ms",
		label: "Turn total"
	}
];
function msTone(ms) {
	if (ms === 0) return "text-muted-foreground";
	if (ms < 300) return "text-emerald-600 dark:text-emerald-400";
	if (ms < 800) return "text-amber-600 dark:text-amber-400";
	return "text-red-600 dark:text-red-400";
}
function HotPathLatency({ turns, aggregates, verdict }) {
	const { t } = useT();
	return /* @__PURE__ */ jsxs(AppLayout, {
		breadcrumbs: [{
			title: t("Settings"),
			href: "/settings/system"
		}, {
			title: t("Hot path latency"),
			href: "/settings/system/hotpath-latency"
		}],
		children: [/* @__PURE__ */ jsx(Head, { title: t("Hot path latency") }), /* @__PURE__ */ jsxs("div", {
			className: "mx-auto w-full max-w-6xl space-y-5 p-4 sm:p-6",
			children: [
				/* @__PURE__ */ jsxs("div", {
					className: "flex flex-wrap items-start justify-between gap-3",
					children: [/* @__PURE__ */ jsxs("div", {
						className: "flex items-center gap-3",
						children: [/* @__PURE__ */ jsx("div", {
							className: "rounded-md border bg-muted/30 p-2",
							children: /* @__PURE__ */ jsx(Gauge, { className: "size-5 text-muted-foreground" })
						}), /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("h1", {
							className: "text-2xl font-semibold",
							children: t("Hot path latency")
						}), /* @__PURE__ */ jsx("p", {
							className: "text-sm text-muted-foreground",
							children: t("Per-stage timings for the last :count visitor turns. Find which round-trip makes the bot feel slow.", { count: turns.length })
						})] })]
					}), /* @__PURE__ */ jsxs(Button, {
						variant: "outline",
						size: "sm",
						onClick: () => router.reload(),
						children: [/* @__PURE__ */ jsx(RefreshCw, { className: "me-1.5 size-4" }), t("Refresh")]
					})]
				}),
				/* @__PURE__ */ jsx(Card, {
					className: "border-l-4 border-l-primary p-4",
					children: /* @__PURE__ */ jsxs("div", {
						className: "flex items-start gap-2",
						children: [/* @__PURE__ */ jsx(Activity, { className: "mt-0.5 size-4 shrink-0 text-primary" }), /* @__PURE__ */ jsx("p", {
							className: "text-sm",
							children: verdict
						})]
					})
				}),
				/* @__PURE__ */ jsx("div", {
					className: "grid grid-cols-2 gap-3 sm:grid-cols-4 lg:grid-cols-8",
					children: STAGE_CARDS.map(({ key, label }) => {
						const agg = aggregates[key] ?? {
							p50: 0,
							p95: 0,
							max: 0
						};
						return /* @__PURE__ */ jsxs(Card, {
							className: "p-3",
							children: [
								/* @__PURE__ */ jsx("p", {
									className: "text-[10px] font-medium tracking-wide text-muted-foreground uppercase",
									children: t(label)
								}),
								/* @__PURE__ */ jsxs("p", {
									className: cn("mt-1 text-lg font-semibold tabular-nums", msTone(agg.p50)),
									children: [agg.p50, "ms"]
								}),
								/* @__PURE__ */ jsxs("p", {
									className: "text-[10px] text-muted-foreground",
									children: [
										"p95 ",
										agg.p95,
										"ms · max ",
										agg.max,
										"ms"
									]
								})
							]
						}, key);
					})
				}),
				/* @__PURE__ */ jsx(Card, {
					className: "p-0",
					children: turns.length === 0 ? /* @__PURE__ */ jsxs("div", {
						className: "flex flex-col items-center gap-2 p-10 text-center text-muted-foreground",
						children: [/* @__PURE__ */ jsx(TimerReset, { className: "size-8 opacity-40" }), /* @__PURE__ */ jsx("p", {
							className: "text-sm",
							children: t("No turns recorded yet. Send a message through the widget or playground, then refresh.")
						})]
					}) : /* @__PURE__ */ jsx("div", {
						className: "overflow-x-auto",
						children: /* @__PURE__ */ jsxs("table", {
							className: "w-full text-sm",
							children: [/* @__PURE__ */ jsx("thead", {
								className: "bg-muted/40 text-xs text-muted-foreground",
								children: /* @__PURE__ */ jsxs("tr", { children: [
									/* @__PURE__ */ jsx("th", {
										className: "px-3 py-2 text-left font-medium",
										children: t("When")
									}),
									/* @__PURE__ */ jsx("th", {
										className: "px-3 py-2 text-right font-medium",
										children: t("First token")
									}),
									/* @__PURE__ */ jsx("th", {
										className: "px-3 py-2 text-right font-medium",
										children: t("Tool loop")
									}),
									/* @__PURE__ */ jsx("th", {
										className: "px-3 py-2 text-right font-medium",
										children: t("Retrieve")
									}),
									/* @__PURE__ */ jsx("th", {
										className: "px-3 py-2 text-right font-medium",
										children: t("Embed")
									}),
									/* @__PURE__ */ jsx("th", {
										className: "px-3 py-2 text-right font-medium",
										children: t("Search")
									}),
									/* @__PURE__ */ jsx("th", {
										className: "px-3 py-2 text-right font-medium",
										children: t("Rerank")
									}),
									/* @__PURE__ */ jsx("th", {
										className: "px-3 py-2 text-right font-medium",
										children: t("LLM")
									}),
									/* @__PURE__ */ jsx("th", {
										className: "px-3 py-2 text-right font-medium",
										children: t("Total")
									}),
									/* @__PURE__ */ jsx("th", {
										className: "px-3 py-2 text-left font-medium",
										children: t("Notes")
									})
								] })
							}), /* @__PURE__ */ jsx("tbody", { children: turns.map((turn, i) => /* @__PURE__ */ jsxs("tr", {
								className: "border-t hover:bg-muted/30",
								children: [
									/* @__PURE__ */ jsx("td", {
										className: "px-3 py-2 text-xs whitespace-nowrap text-muted-foreground",
										children: turn.at ? new Date(turn.at).toLocaleTimeString() : "—"
									}),
									/* @__PURE__ */ jsxs("td", {
										className: cn("px-3 py-2 text-right font-medium tabular-nums", msTone(turn.first_token_ms)),
										children: [turn.first_token_ms, "ms"]
									}),
									/* @__PURE__ */ jsx("td", {
										className: cn("px-3 py-2 text-right text-xs tabular-nums", turn.tool_loop_ms > 0 ? msTone(turn.tool_loop_ms) : "text-muted-foreground"),
										children: turn.tool_loop_ms > 0 ? `${turn.tool_loop_ms}ms` : "—"
									}),
									/* @__PURE__ */ jsxs("td", {
										className: cn("px-3 py-2 text-right tabular-nums", msTone(turn.retrieve_ms)),
										children: [turn.retrieve_ms, "ms"]
									}),
									/* @__PURE__ */ jsx("td", {
										className: "px-3 py-2 text-right text-xs text-muted-foreground tabular-nums",
										children: turn.cache_hit ? "—" : `${turn.embed_ms}ms`
									}),
									/* @__PURE__ */ jsx("td", {
										className: "px-3 py-2 text-right text-xs text-muted-foreground tabular-nums",
										children: turn.cache_hit ? "—" : `${turn.ann_ms}ms`
									}),
									/* @__PURE__ */ jsx("td", {
										className: "px-3 py-2 text-right text-xs text-muted-foreground tabular-nums",
										children: turn.cache_hit ? "—" : turn.rerank_skipped ? t("skipped") : `${turn.rerank_ms}ms`
									}),
									/* @__PURE__ */ jsxs("td", {
										className: "px-3 py-2 text-right text-xs text-muted-foreground tabular-nums",
										children: [turn.llm_ms, "ms"]
									}),
									/* @__PURE__ */ jsxs("td", {
										className: "px-3 py-2 text-right font-medium tabular-nums",
										children: [turn.total_ms, "ms"]
									}),
									/* @__PURE__ */ jsx("td", {
										className: "px-3 py-2 text-[11px] text-muted-foreground",
										children: [
											turn.route !== "" ? `${turn.route}${turn.route_reason !== "" ? ` (${turn.route_reason})` : ""}` : null,
											turn.cache_hit ? t("retrieve cache hit") : null,
											turn.rerank_skipped ? t("rerank skipped") : null,
											turn.is_playground ? t("playground") : null,
											`${turn.sources} ${t("sources")}`,
											`${turn.tokens_out} ${t("tokens")}`
										].filter(Boolean).join(" · ")
									})
								]
							}, `${turn.conversation_id}-${i}`)) })]
						})
					})
				}),
				/* @__PURE__ */ jsx("p", {
					className: "text-[11px] text-muted-foreground",
					children: t("Buffer holds the most recent 100 turns (7-day TTL). Timings are recorded after the reply finishes streaming — collecting them costs the visitor nothing.")
				})
			]
		})]
	});
}
//#endregion
//#region resources/js/actions/App/Http/Controllers/Admin/Platform/WordPressDistributionController.ts
/**
* @see \App\Http\Controllers\Admin\Platform\WordPressDistributionController::index
* @see app/Http/Controllers/Admin/Platform/WordPressDistributionController.php:28
* @route '/admin/integrations/wordpress'
*/
var index$6 = (options) => ({
	url: index$6.url(options),
	method: "get"
});
index$6.definition = {
	methods: ["get", "head"],
	url: "/admin/integrations/wordpress"
};
/**
* @see \App\Http\Controllers\Admin\Platform\WordPressDistributionController::index
* @see app/Http/Controllers/Admin/Platform/WordPressDistributionController.php:28
* @route '/admin/integrations/wordpress'
*/
index$6.url = (options) => {
	return index$6.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\Platform\WordPressDistributionController::index
* @see app/Http/Controllers/Admin/Platform/WordPressDistributionController.php:28
* @route '/admin/integrations/wordpress'
*/
index$6.get = (options) => ({
	url: index$6.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\WordPressDistributionController::index
* @see app/Http/Controllers/Admin/Platform/WordPressDistributionController.php:28
* @route '/admin/integrations/wordpress'
*/
index$6.head = (options) => ({
	url: index$6.url(options),
	method: "head"
});
/**
* @see \App\Http\Controllers\Admin\Platform\WordPressDistributionController::index
* @see app/Http/Controllers/Admin/Platform/WordPressDistributionController.php:28
* @route '/admin/integrations/wordpress'
*/
var indexForm$6 = (options) => ({
	action: index$6.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\WordPressDistributionController::index
* @see app/Http/Controllers/Admin/Platform/WordPressDistributionController.php:28
* @route '/admin/integrations/wordpress'
*/
indexForm$6.get = (options) => ({
	action: index$6.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\WordPressDistributionController::index
* @see app/Http/Controllers/Admin/Platform/WordPressDistributionController.php:28
* @route '/admin/integrations/wordpress'
*/
indexForm$6.head = (options) => ({
	action: index$6.url({ [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
index$6.form = indexForm$6;
/**
* @see \App\Http\Controllers\Admin\Platform\WordPressDistributionController::build
* @see app/Http/Controllers/Admin/Platform/WordPressDistributionController.php:36
* @route '/admin/integrations/wordpress/build'
*/
var build = (options) => ({
	url: build.url(options),
	method: "post"
});
build.definition = {
	methods: ["post"],
	url: "/admin/integrations/wordpress/build"
};
/**
* @see \App\Http\Controllers\Admin\Platform\WordPressDistributionController::build
* @see app/Http/Controllers/Admin/Platform/WordPressDistributionController.php:36
* @route '/admin/integrations/wordpress/build'
*/
build.url = (options) => {
	return build.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\Platform\WordPressDistributionController::build
* @see app/Http/Controllers/Admin/Platform/WordPressDistributionController.php:36
* @route '/admin/integrations/wordpress/build'
*/
build.post = (options) => ({
	url: build.url(options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\Platform\WordPressDistributionController::build
* @see app/Http/Controllers/Admin/Platform/WordPressDistributionController.php:36
* @route '/admin/integrations/wordpress/build'
*/
var buildForm = (options) => ({
	action: build.url(options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\Platform\WordPressDistributionController::build
* @see app/Http/Controllers/Admin/Platform/WordPressDistributionController.php:36
* @route '/admin/integrations/wordpress/build'
*/
buildForm.post = (options) => ({
	action: build.url(options),
	method: "post"
});
build.form = buildForm;
/**
* @see \App\Http\Controllers\Admin\Platform\WordPressDistributionController::download
* @see app/Http/Controllers/Admin/Platform/WordPressDistributionController.php:47
* @route '/admin/integrations/wordpress/download/{version}'
*/
var download = (args, options) => ({
	url: download.url(args, options),
	method: "get"
});
download.definition = {
	methods: ["get", "head"],
	url: "/admin/integrations/wordpress/download/{version}"
};
/**
* @see \App\Http\Controllers\Admin\Platform\WordPressDistributionController::download
* @see app/Http/Controllers/Admin/Platform/WordPressDistributionController.php:47
* @route '/admin/integrations/wordpress/download/{version}'
*/
download.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { version: args };
	if (Array.isArray(args)) args = { version: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { version: args.version };
	return download.definition.url.replace("{version}", parsedArgs.version.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\Platform\WordPressDistributionController::download
* @see app/Http/Controllers/Admin/Platform/WordPressDistributionController.php:47
* @route '/admin/integrations/wordpress/download/{version}'
*/
download.get = (args, options) => ({
	url: download.url(args, options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\WordPressDistributionController::download
* @see app/Http/Controllers/Admin/Platform/WordPressDistributionController.php:47
* @route '/admin/integrations/wordpress/download/{version}'
*/
download.head = (args, options) => ({
	url: download.url(args, options),
	method: "head"
});
/**
* @see \App\Http\Controllers\Admin\Platform\WordPressDistributionController::download
* @see app/Http/Controllers/Admin/Platform/WordPressDistributionController.php:47
* @route '/admin/integrations/wordpress/download/{version}'
*/
var downloadForm = (args, options) => ({
	action: download.url(args, options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\WordPressDistributionController::download
* @see app/Http/Controllers/Admin/Platform/WordPressDistributionController.php:47
* @route '/admin/integrations/wordpress/download/{version}'
*/
downloadForm.get = (args, options) => ({
	action: download.url(args, options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\WordPressDistributionController::download
* @see app/Http/Controllers/Admin/Platform/WordPressDistributionController.php:47
* @route '/admin/integrations/wordpress/download/{version}'
*/
downloadForm.head = (args, options) => ({
	action: download.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
download.form = downloadForm;
var WordPressDistributionController = {
	index: index$6,
	build,
	download
};
//#endregion
//#region resources/js/pages/admin/integrations/wordpress.tsx
var wordpress_exports = /* @__PURE__ */ __exportAll({ default: () => WordPressDistributionPage });
function formatBytes(bytes) {
	if (bytes <= 0) return "0 B";
	const units = [
		"B",
		"KB",
		"MB",
		"GB"
	];
	const exp = Math.min(units.length - 1, Math.floor(Math.log(bytes) / Math.log(1024)));
	return `${(bytes / Math.pow(1024, exp)).toFixed(1)} ${units[exp]}`;
}
function formatDate$1(iso) {
	return new Date(iso).toLocaleString();
}
function WordPressDistributionPage({ builds, source_version }) {
	const { t } = useT();
	const brand = useBranding().site_title || "Pitchbar";
	const { flash } = usePage().props;
	return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Head, { title: t("WordPress plugin distribution") }), /* @__PURE__ */ jsxs("div", {
		className: "space-y-6 p-6",
		children: [
			/* @__PURE__ */ jsxs("div", {
				className: "space-y-1",
				children: [/* @__PURE__ */ jsx("h1", {
					className: "text-2xl font-semibold",
					children: t("WordPress plugin distribution")
				}), /* @__PURE__ */ jsx("p", {
					className: "text-sm text-muted-foreground",
					children: t("Build and download the :brand WordPress + WooCommerce plugin. Upload the resulting zip to any WP install under Plugins → Add New → Upload Plugin.", { brand })
				})]
			}),
			flash?.success && /* @__PURE__ */ jsx("div", {
				className: "rounded-md border border-emerald-200 bg-emerald-50 px-3 py-2 text-sm text-emerald-900 dark:border-emerald-900/50 dark:bg-emerald-950/30 dark:text-emerald-100",
				children: flash.success
			}),
			flash?.error && /* @__PURE__ */ jsx("div", {
				className: "rounded-md border border-red-200 bg-red-50 px-3 py-2 text-sm text-red-900 dark:border-red-900/50 dark:bg-red-950/30 dark:text-red-100",
				children: flash.error
			}),
			/* @__PURE__ */ jsx(Card, {
				className: "border-border/80 p-5",
				children: /* @__PURE__ */ jsxs("div", {
					className: "flex flex-wrap items-center gap-4",
					children: [
						/* @__PURE__ */ jsx(Package, { className: "h-6 w-6 text-muted-foreground" }),
						/* @__PURE__ */ jsxs("div", {
							className: "flex-1 space-y-0.5",
							children: [/* @__PURE__ */ jsx("p", {
								className: "text-sm font-medium",
								children: t("Source version")
							}), /* @__PURE__ */ jsx("p", {
								className: "text-sm text-muted-foreground",
								children: source_version ? t("wp-plugin/pitchbar/ currently reports v{version}", { version: source_version }) : t("wp-plugin/pitchbar/ source tree is missing or malformed.")
							})]
						}),
						/* @__PURE__ */ jsx(Form, {
							...WordPressDistributionController.build.form(),
							options: { preserveScroll: true },
							children: ({ processing }) => /* @__PURE__ */ jsxs(Button, {
								type: "submit",
								disabled: processing || source_version === null,
								children: [/* @__PURE__ */ jsx(Hammer, { className: "mr-1 h-3.5 w-3.5" }), processing ? t("Building…") : t("Build latest")]
							})
						})
					]
				})
			}),
			/* @__PURE__ */ jsxs("div", {
				className: "space-y-3",
				children: [/* @__PURE__ */ jsx("h2", {
					className: "text-sm font-semibold text-muted-foreground",
					children: t("Available builds")
				}), builds.length === 0 ? /* @__PURE__ */ jsx(Card, {
					className: "border-dashed p-6 text-center text-sm text-muted-foreground",
					children: t("No builds yet. Click \"Build latest\" above to package the plugin.")
				}) : /* @__PURE__ */ jsx("div", {
					className: "grid gap-2",
					children: builds.map((build) => /* @__PURE__ */ jsxs(Card, {
						className: "flex items-center gap-4 border-border/70 p-4",
						children: [/* @__PURE__ */ jsxs("div", {
							className: "flex-1 space-y-1",
							children: [/* @__PURE__ */ jsxs("div", {
								className: "flex items-center gap-2",
								children: [/* @__PURE__ */ jsx("p", {
									className: "font-mono text-sm",
									children: build.filename
								}), /* @__PURE__ */ jsxs(Badge, {
									variant: "secondary",
									children: ["v", build.version]
								})]
							}), /* @__PURE__ */ jsxs("p", {
								className: "text-xs text-muted-foreground",
								children: [
									formatBytes(build.size),
									" ·",
									" ",
									t("Built"),
									" ",
									formatDate$1(build.modified_at)
								]
							})]
						}), /* @__PURE__ */ jsx(Button, {
							asChild: true,
							variant: "default",
							size: "sm",
							children: /* @__PURE__ */ jsxs("a", {
								href: build.download_url,
								children: [/* @__PURE__ */ jsx(Download, { className: "mr-1 h-3.5 w-3.5" }), t("Download")]
							})
						})]
					}, build.filename))
				})]
			}),
			/* @__PURE__ */ jsxs(Card, {
				className: "border-border/80 p-5",
				children: [/* @__PURE__ */ jsx("h2", {
					className: "text-sm font-semibold",
					children: t("Install the plugin in WordPress")
				}), /* @__PURE__ */ jsxs("ol", {
					className: "mt-3 list-decimal space-y-1 pl-5 text-sm text-muted-foreground",
					children: [
						/* @__PURE__ */ jsx("li", { children: t("Download the latest build above. The file is named pitchbar-{version}.zip with pitchbar.php at its root.") }),
						/* @__PURE__ */ jsx("li", { children: t("In WordPress: Plugins → Add New → Upload Plugin → select the downloaded zip → Install Now → Activate.") }),
						/* @__PURE__ */ jsx("li", { children: t("Open Settings → :brand, paste this :brand URL and an API token from Settings → API tokens, click Test connection, pick an agent, save.", { brand }) })
					]
				})]
			})
		]
	})] });
}
WordPressDistributionPage.layout = (page) => /* @__PURE__ */ jsx(AdminLayout, {
	breadcrumbs: [{
		title: "Platform admin",
		href: "/admin"
	}, {
		title: "WordPress plugin",
		href: "/admin/integrations/wordpress"
	}],
	children: page
});
//#endregion
//#region resources/js/pages/admin/jobs/failed.tsx
var failed_exports = /* @__PURE__ */ __exportAll({ default: () => FailedJobsPage });
function FailedJobsPage({ jobs, total }) {
	const { t } = useT();
	const confirm = useConfirm();
	const [openUuid, setOpenUuid] = useState(null);
	const [detail, setDetail] = useState({});
	const toggle = async (uuid) => {
		if (openUuid === uuid) {
			setOpenUuid(null);
			return;
		}
		setOpenUuid(uuid);
		if (detail[uuid]?.exception) return;
		setDetail((d) => ({
			...d,
			[uuid]: { loading: true }
		}));
		try {
			const r = await fetch(show$5.url(uuid), {
				credentials: "same-origin",
				headers: { Accept: "application/json" }
			});
			if (!r.ok) throw new Error(`HTTP ${r.status}`);
			const j = await r.json();
			setDetail((d) => ({
				...d,
				[uuid]: {
					loading: false,
					exception: j.data.exception
				}
			}));
		} catch (e) {
			setDetail((d) => ({
				...d,
				[uuid]: {
					loading: false,
					error: e instanceof Error ? e.message : t("Fetch failed")
				}
			}));
		}
	};
	return /* @__PURE__ */ jsxs(AdminLayout, {
		breadcrumbs: [{
			title: t("Dashboard"),
			href: dashboard()
		}, {
			title: t("Queue Failures"),
			href: failed()
		}],
		children: [/* @__PURE__ */ jsx(Head, { title: t("Queue Failures") }), /* @__PURE__ */ jsxs(AdminSurface, { children: [/* @__PURE__ */ jsxs(AdminSurfaceBar, { children: [
			/* @__PURE__ */ jsx("span", {
				className: "inline-flex h-7 items-center rounded-md border bg-card px-2.5 text-xs font-normal text-foreground",
				children: t("Queue Failures")
			}),
			/* @__PURE__ */ jsx("span", {
				className: "inline-flex h-7 items-center rounded-md border bg-card px-2.5 text-xs font-normal text-muted-foreground",
				children: t(":count total", { count: total.toLocaleString() })
			}),
			jobs.length > 0 ? /* @__PURE__ */ jsxs("div", {
				className: "flex w-full flex-wrap items-center gap-2 sm:ms-auto sm:w-auto sm:justify-end",
				children: [/* @__PURE__ */ jsx(Button, {
					variant: "outline",
					size: "sm",
					onClick: async () => {
						if (!await confirm({
							title: t("Retry all failures?"),
							message: t("Retry all :count queue failures?", { count: total }),
							confirmLabel: t("Retry all")
						})) return;
						router.post(retryAll.url());
					},
					children: t("Retry all")
				}), /* @__PURE__ */ jsx(Button, {
					variant: "ghost",
					size: "sm",
					onClick: async () => {
						if (!await confirm({
							title: t("Flush all records?"),
							message: t("Permanently delete all :count failed-job records? Jobs will not run.", { count: total }),
							confirmLabel: t("Flush"),
							danger: true
						})) return;
						router.post(flush.url());
					},
					children: t("Flush all")
				})]
			}) : null
		] }), /* @__PURE__ */ jsx("div", {
			className: "min-h-0 flex-1 overflow-y-auto p-3 sm:p-4",
			children: jobs.length === 0 ? /* @__PURE__ */ jsx("div", {
				className: "flex h-full items-center justify-center border-b px-4 text-center",
				children: /* @__PURE__ */ jsx("div", {
					className: "max-w-sm text-sm text-muted-foreground",
					children: t("No queue failures. Queue health is good.")
				})
			}) : /* @__PURE__ */ jsx("div", {
				className: "min-h-0 flex-1 overflow-auto rounded-lg border bg-card",
				children: /* @__PURE__ */ jsxs("table", {
					className: "min-w-full border-separate border-spacing-0 text-sm",
					children: [/* @__PURE__ */ jsx("thead", {
						className: "sticky top-0 z-10 bg-card text-start text-xs font-medium text-muted-foreground",
						children: /* @__PURE__ */ jsxs("tr", { children: [
							/* @__PURE__ */ jsx("th", { className: "w-8 border-b px-3 py-2" }),
							/* @__PURE__ */ jsx("th", {
								className: "border-e border-b px-3 py-2",
								children: t("Job")
							}),
							/* @__PURE__ */ jsx("th", {
								className: "border-e border-b px-3 py-2",
								children: t("Queue")
							}),
							/* @__PURE__ */ jsx("th", {
								className: "border-e border-b px-3 py-2",
								children: t("Failed at")
							}),
							/* @__PURE__ */ jsx("th", {
								className: "border-e border-b px-3 py-2",
								children: t("Exception")
							}),
							/* @__PURE__ */ jsx("th", {
								className: "border-b px-3 py-2 text-end",
								children: t("Actions")
							})
						] })
					}), /* @__PURE__ */ jsx("tbody", { children: jobs.map((job) => {
						const isOpen = openUuid === job.uuid;
						const d = detail[job.uuid];
						return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("tr", {
							className: "group hover:bg-muted/35",
							children: [
								/* @__PURE__ */ jsx("td", {
									className: "border-b px-3 py-2",
									children: /* @__PURE__ */ jsx("button", {
										type: "button",
										onClick: () => toggle(job.uuid),
										className: "text-muted-foreground hover:text-foreground",
										"aria-label": isOpen ? t("Collapse") : t("Expand"),
										children: isOpen ? /* @__PURE__ */ jsx(ChevronDown, { className: "size-4" }) : /* @__PURE__ */ jsx(ChevronRight, { className: "size-4" })
									})
								}),
								/* @__PURE__ */ jsx("td", {
									className: "border-e border-b px-3 py-2 font-medium text-foreground",
									children: job.job
								}),
								/* @__PURE__ */ jsx("td", {
									className: "border-e border-b px-3 py-2 text-muted-foreground",
									children: job.queue
								}),
								/* @__PURE__ */ jsx("td", {
									className: "border-e border-b px-3 py-2 whitespace-nowrap text-muted-foreground",
									children: new Date(job.failed_at).toLocaleString()
								}),
								/* @__PURE__ */ jsx("td", {
									className: "max-w-[36rem] cursor-pointer truncate border-e border-b px-3 py-2 text-destructive",
									title: job.exception_first_line,
									onClick: () => toggle(job.uuid),
									children: job.exception_first_line
								}),
								/* @__PURE__ */ jsxs("td", {
									className: "border-b px-3 py-2 text-end whitespace-nowrap",
									children: [
										/* @__PURE__ */ jsx(Button, {
											variant: "outline",
											size: "sm",
											onClick: () => router.post(retry.url(job.uuid)),
											children: t("Retry")
										}),
										" ",
										/* @__PURE__ */ jsx(Button, {
											variant: "ghost",
											size: "sm",
											onClick: async () => {
												if (!await confirm({
													title: t("Delete record?"),
													message: t("Permanently remove this failed-job record?"),
													confirmLabel: t("Delete"),
													danger: true
												})) return;
												router.post(forget.url(job.uuid));
											},
											children: t("Delete")
										})
									]
								})
							]
						}), isOpen && /* @__PURE__ */ jsx("tr", {
							className: "bg-muted/25",
							children: /* @__PURE__ */ jsxs("td", {
								colSpan: 6,
								className: "border-b px-3 py-3",
								children: [
									d?.loading && /* @__PURE__ */ jsxs("p", {
										className: "flex items-center gap-2 text-xs text-muted-foreground",
										children: [/* @__PURE__ */ jsx(Loader2, { className: "size-3 animate-spin" }), t("loading stack trace...")]
									}),
									d?.error && /* @__PURE__ */ jsx("p", {
										className: "text-xs text-destructive",
										children: d.error
									}),
									d?.exception && /* @__PURE__ */ jsx("pre", {
										className: "max-h-96 overflow-y-auto rounded border bg-background p-3 text-[11px] leading-snug whitespace-pre-wrap",
										children: d.exception
									})
								]
							})
						})] }, job.id);
					}) })]
				})
			})
		})] })]
	});
}
//#endregion
//#region resources/js/pages/admin/leads/index.tsx
var leads_exports$1 = /* @__PURE__ */ __exportAll({ default: () => AdminLeads });
var LEADS_ONLY = [
	"leads",
	"pagination",
	"filters"
];
function AdminLeads({ leads, pagination, filters }) {
	const { t } = useT();
	const selection = useBulkSelection();
	const pageIds = leads.map((l) => l.id);
	return /* @__PURE__ */ jsxs(AdminLayout, {
		breadcrumbs: [{
			title: t("Dashboard"),
			href: dashboard()
		}, {
			title: t("Leads"),
			href: index$28()
		}],
		children: [
			/* @__PURE__ */ jsx(Head, { title: t("Leads · Admin") }),
			/* @__PURE__ */ jsxs(AdminSurface, { children: [
				/* @__PURE__ */ jsxs(AdminSurfaceBar, { children: [
					/* @__PURE__ */ jsx("span", {
						className: "inline-flex h-7 items-center rounded-md border bg-card px-2.5 text-xs font-normal text-foreground",
						children: t("All leads")
					}),
					/* @__PURE__ */ jsx("span", {
						className: "inline-flex h-7 items-center rounded-md border bg-card px-2.5 text-xs font-normal text-muted-foreground",
						children: t(":count leads", { count: pagination.total.toLocaleString() })
					}),
					/* @__PURE__ */ jsx("div", {
						className: "ms-auto w-full sm:w-auto",
						children: /* @__PURE__ */ jsx(TableSearch, {
							placeholder: t("Search by email, name, or phone..."),
							initialValue: filters.q,
							only: LEADS_ONLY
						})
					})
				] }),
				/* @__PURE__ */ jsx("div", {
					className: "min-h-0 flex-1 overflow-auto",
					children: /* @__PURE__ */ jsxs("table", {
						className: "w-full min-w-[980px] border-separate border-spacing-0 text-start text-sm",
						children: [/* @__PURE__ */ jsx("thead", {
							className: "sticky top-0 z-10 bg-card text-xs font-medium text-muted-foreground",
							children: /* @__PURE__ */ jsxs("tr", { children: [
								/* @__PURE__ */ jsx("th", {
									className: "w-9 border-b px-3 py-2",
									children: /* @__PURE__ */ jsx("input", {
										type: "checkbox",
										"aria-label": t("Select all leads"),
										checked: selection.allOnPageSelected(pageIds),
										ref: (el) => {
											if (el) el.indeterminate = !selection.allOnPageSelected(pageIds) && selection.someOnPageSelected(pageIds);
										},
										onChange: () => selection.togglePage(pageIds),
										className: "size-3.5 cursor-pointer rounded border-input"
									})
								}),
								/* @__PURE__ */ jsx("th", {
									className: "border-e border-b px-3 py-2",
									children: t("Lead")
								}),
								/* @__PURE__ */ jsx("th", {
									className: "border-e border-b px-3 py-2",
									children: t("Workspace")
								}),
								/* @__PURE__ */ jsx("th", {
									className: "border-e border-b px-3 py-2",
									children: t("Agent")
								}),
								/* @__PURE__ */ jsx("th", {
									className: "border-e border-b px-3 py-2",
									children: t("Status")
								}),
								/* @__PURE__ */ jsx("th", {
									className: "border-b px-3 py-2",
									children: t("Created")
								})
							] })
						}), /* @__PURE__ */ jsx("tbody", { children: leads.length === 0 ? /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx("td", {
							colSpan: 6,
							className: "h-72 border-b px-4 text-center",
							children: /* @__PURE__ */ jsxs("div", {
								className: "mx-auto flex max-w-sm flex-col items-center gap-2 text-muted-foreground",
								children: [
									/* @__PURE__ */ jsx(Inbox, { className: "size-8" }),
									/* @__PURE__ */ jsx("p", {
										className: "text-sm font-medium text-foreground",
										children: t("No matching leads")
									}),
									/* @__PURE__ */ jsx("p", {
										className: "text-xs",
										children: t("No leads match the current admin search.")
									})
								]
							})
						}) }) : leads.map((lead) => /* @__PURE__ */ jsxs("tr", {
							className: "group hover:bg-muted/35",
							children: [
								/* @__PURE__ */ jsx("td", {
									className: "border-b px-3 py-2",
									children: /* @__PURE__ */ jsx("input", {
										type: "checkbox",
										"aria-label": t("Select :name", { name: lead.name ?? lead.email ?? t("lead") }),
										checked: selection.isSelected(lead.id),
										onChange: (e) => {
											const nativeEvent = e.nativeEvent;
											selection.toggle(lead.id, {
												shiftKey: nativeEvent?.shiftKey ?? false,
												pageIds
											});
										},
										onClick: (e) => e.stopPropagation(),
										className: "size-3.5 cursor-pointer rounded border-input"
									})
								}),
								/* @__PURE__ */ jsx("td", {
									className: "border-e border-b px-3 py-2",
									children: /* @__PURE__ */ jsxs("div", {
										className: "flex min-w-0 items-center gap-2 text-foreground",
										children: [/* @__PURE__ */ jsx("span", {
											className: "flex size-5 shrink-0 items-center justify-center rounded bg-muted text-muted-foreground",
											children: lead.email ? /* @__PURE__ */ jsx(UserRound, { className: "size-3.5" }) : /* @__PURE__ */ jsx(Inbox, { className: "size-3.5" })
										}), /* @__PURE__ */ jsxs("div", {
											className: "min-w-0",
											children: [/* @__PURE__ */ jsx("p", {
												className: "truncate font-medium",
												children: lead.name ?? lead.email ?? t("Unknown lead")
											}), /* @__PURE__ */ jsx("p", {
												className: "truncate text-xs text-muted-foreground",
												children: lead.email ?? t("No email captured")
											})]
										})]
									})
								}),
								/* @__PURE__ */ jsx("td", {
									className: "border-e border-b px-3 py-2",
									children: lead.workspace ? /* @__PURE__ */ jsx(Link, {
										href: show$8(lead.workspace.id),
										className: "text-sm font-medium text-foreground hover:text-primary",
										children: lead.workspace.name
									}) : /* @__PURE__ */ jsx("span", {
										className: "text-muted-foreground",
										children: "—"
									})
								}),
								/* @__PURE__ */ jsx("td", {
									className: "border-e border-b px-3 py-2 text-muted-foreground",
									children: lead.agent?.name ?? "—"
								}),
								/* @__PURE__ */ jsx("td", {
									className: "border-e border-b px-3 py-2",
									children: /* @__PURE__ */ jsx("span", {
										className: "inline-flex rounded-md border bg-muted/40 px-2 py-0.5 text-xs font-medium text-foreground capitalize",
										children: lead.status
									})
								}),
								/* @__PURE__ */ jsx("td", {
									className: "border-b px-3 py-2 text-muted-foreground",
									children: relativeTime$8(lead.created_at, "—")
								})
							]
						}, lead.id)) })]
					})
				}),
				/* @__PURE__ */ jsx(TablePagination, {
					pagination,
					only: LEADS_ONLY
				})
			] }),
			/* @__PURE__ */ jsx(BulkActionsBar, {
				count: selection.size,
				onClear: selection.clear,
				noun: t("lead"),
				children: /* @__PURE__ */ jsx(BulkDeleteButton, {
					confirmMessage: t("Delete :count selected lead(s) across workspaces? Cannot be undone.", { count: selection.size }),
					onConfirm: () => {
						router.post("/admin/leads/bulk-destroy", { ids: Array.from(selection.selected) }, {
							preserveScroll: true,
							onSuccess: () => selection.clear()
						});
					}
				})
			})
		]
	});
}
//#endregion
//#region resources/js/pages/admin/pages/page-form.tsx
var page_form_exports = /* @__PURE__ */ __exportAll({ PageForm: () => PageForm });
function PageForm({ initial, method, action, submitLabel }) {
	const { t } = useT();
	const prompt = usePrompt();
	const form = useForm(initial);
	const [editorView, setEditorView] = useState("split");
	const [previewHtml, setPreviewHtml] = useState("");
	const [previewLoading, setPreviewLoading] = useState(false);
	const [previewError, setPreviewError] = useState(null);
	const debounceRef = useRef(null);
	const textareaRef = useRef(null);
	/**
	* Apply a markdown formatting action to the textarea. Handles three
	* shapes: `wrap` (surround selection with markers), `linePrefix`
	* (insert at the start of every selected line), or `insertLink`
	* (prompt for URL via the shadcn usePrompt dialog). Keeps focus +
	* caret position so the operator can keep typing without reaching
	* for the mouse.
	*/
	const applyMarkdown = async (btn) => {
		const el = textareaRef.current;
		if (!el) return;
		const start = el.selectionStart ?? 0;
		const end = el.selectionEnd ?? 0;
		const value = form.data.content_markdown;
		const selected = value.slice(start, end);
		let next = value;
		let newCursor = end;
		if (btn.wrap) {
			const replacement = btn.wrap + (selected || "text") + btn.wrap;
			next = value.slice(0, start) + replacement + value.slice(end);
			newCursor = start + replacement.length;
		} else if (btn.linePrefix) {
			const lineStart = value.lastIndexOf("\n", start - 1) + 1;
			const prefixed = value.slice(lineStart, end).split("\n").map((line) => line.length === 0 ? line : btn.linePrefix + line).join("\n");
			next = value.slice(0, lineStart) + prefixed + value.slice(end);
			newCursor = lineStart + prefixed.length;
		} else if (btn.insertLink) {
			const url = await prompt({
				title: t("Insert link"),
				message: t("Link URL"),
				defaultValue: "https://",
				placeholder: "https://example.com",
				confirmLabel: t("Insert"),
				validate: (v) => v.trim() === "" || v.trim() === "https://" ? t("URL is required.") : null
			});
			if (url === null || url.trim() === "") return;
			const replacement = `[${selected || "link text"}](${url})`;
			next = value.slice(0, start) + replacement + value.slice(end);
			newCursor = start + replacement.length;
		}
		form.setData("content_markdown", next);
		window.setTimeout(() => {
			if (!textareaRef.current) return;
			textareaRef.current.focus();
			textareaRef.current.setSelectionRange(newCursor, newCursor);
		}, 0);
	};
	useEffect(() => {
		if (editorView === "edit") return;
		if (debounceRef.current) window.clearTimeout(debounceRef.current);
		const csrf = (document.querySelector("meta[name=\"csrf-token\"]")?.getAttribute("content") ?? "").toString();
		debounceRef.current = window.setTimeout(async () => {
			setPreviewLoading(true);
			setPreviewError(null);
			try {
				const response = await fetch("/admin/pages/preview", {
					method: "POST",
					headers: {
						"Content-Type": "application/json",
						"X-CSRF-TOKEN": csrf,
						Accept: "application/json"
					},
					body: JSON.stringify({ content_markdown: form.data.content_markdown })
				});
				if (!response.ok) throw new Error("Preview render failed");
				setPreviewHtml((await response.json()).html ?? "");
			} catch (e) {
				setPreviewError(e instanceof Error ? e.message : "Preview render failed");
			} finally {
				setPreviewLoading(false);
			}
		}, 400);
		return () => {
			if (debounceRef.current) window.clearTimeout(debounceRef.current);
		};
	}, [form.data.content_markdown, editorView]);
	const submit = (e) => {
		e.preventDefault();
		form.submit(method, action, { preserveScroll: true });
	};
	return /* @__PURE__ */ jsxs("form", {
		onSubmit: submit,
		className: "grid gap-4",
		children: [
			/* @__PURE__ */ jsxs(Card, {
				className: "p-4",
				children: [
					/* @__PURE__ */ jsx("h2", {
						className: "font-semibold",
						children: t("Page metadata")
					}),
					/* @__PURE__ */ jsx("p", {
						className: "mb-4 text-xs text-muted-foreground",
						children: t("Published pages live at /p/{slug}. Drafts return 404 until you flip the toggle below.")
					}),
					/* @__PURE__ */ jsxs("div", {
						className: "grid gap-4 md:grid-cols-2",
						children: [
							/* @__PURE__ */ jsxs("div", {
								className: "grid gap-1.5",
								children: [
									/* @__PURE__ */ jsx(Label, {
										htmlFor: "page-title",
										children: t("Title")
									}),
									/* @__PURE__ */ jsx(Input, {
										id: "page-title",
										value: form.data.title,
										onChange: (e) => form.setData("title", e.target.value),
										placeholder: t("About us"),
										required: true
									}),
									form.errors.title && /* @__PURE__ */ jsx("p", {
										className: "text-xs text-destructive",
										children: form.errors.title
									})
								]
							}),
							/* @__PURE__ */ jsxs("div", {
								className: "grid gap-1.5",
								children: [
									/* @__PURE__ */ jsx(Label, {
										htmlFor: "page-slug",
										children: t("Slug")
									}),
									/* @__PURE__ */ jsx(Input, {
										id: "page-slug",
										value: form.data.slug,
										onChange: (e) => form.setData("slug", e.target.value),
										placeholder: t("about")
									}),
									/* @__PURE__ */ jsx("p", {
										className: "text-xs text-muted-foreground",
										children: t("Auto-derived from the title when blank. Lowercase + hyphens only.")
									}),
									form.errors.slug && /* @__PURE__ */ jsx("p", {
										className: "text-xs text-destructive",
										children: form.errors.slug
									})
								]
							}),
							/* @__PURE__ */ jsxs("div", {
								className: "grid gap-1.5",
								children: [
									/* @__PURE__ */ jsx(Label, {
										htmlFor: "page-sort",
										children: t("Footer order")
									}),
									/* @__PURE__ */ jsx(Input, {
										id: "page-sort",
										type: "number",
										min: 0,
										value: form.data.sort_order,
										onChange: (e) => form.setData("sort_order", Math.max(0, Number.parseInt(e.target.value, 10) || 0))
									}),
									/* @__PURE__ */ jsx("p", {
										className: "text-xs text-muted-foreground",
										children: t("Lower numbers render first in the footer.")
									})
								]
							}),
							/* @__PURE__ */ jsxs("div", {
								className: "grid gap-1.5",
								children: [/* @__PURE__ */ jsxs(Label, {
									className: "flex items-center gap-2",
									children: [/* @__PURE__ */ jsx("input", {
										type: "checkbox",
										checked: form.data.is_published,
										onChange: (e) => form.setData("is_published", e.target.checked),
										className: "size-4"
									}), /* @__PURE__ */ jsx("span", { children: t("Publish (visible at /p/{slug})") })]
								}), /* @__PURE__ */ jsx("p", {
									className: "text-xs text-muted-foreground",
									children: t("Drafts 404 publicly. Publish when ready to link from the footer.")
								})]
							})
						]
					})
				]
			}),
			/* @__PURE__ */ jsxs(Card, {
				className: "p-4",
				children: [
					/* @__PURE__ */ jsxs("div", {
						className: "mb-3 flex items-center justify-between gap-3",
						children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("h2", {
							className: "font-semibold",
							children: t("Content (Markdown)")
						}), /* @__PURE__ */ jsx("p", {
							className: "text-xs text-muted-foreground",
							children: t("Same flavour as the documentation pages. Headings (#, ##), lists, links, code fences. Raw HTML is escaped for safety.")
						})] }), /* @__PURE__ */ jsxs("div", {
							className: "inline-flex shrink-0 overflow-hidden rounded-md border text-xs",
							children: [
								/* @__PURE__ */ jsx("button", {
									type: "button",
									onClick: () => setEditorView("edit"),
									className: editorView === "edit" ? "bg-foreground px-3 py-1.5 text-background" : "px-3 py-1.5 hover:bg-muted",
									children: t("Edit")
								}),
								/* @__PURE__ */ jsx("button", {
									type: "button",
									onClick: () => setEditorView("split"),
									className: editorView === "split" ? "border-x bg-foreground px-3 py-1.5 text-background" : "border-x px-3 py-1.5 hover:bg-muted",
									children: t("Split")
								}),
								/* @__PURE__ */ jsx("button", {
									type: "button",
									onClick: () => setEditorView("preview"),
									className: editorView === "preview" ? "bg-foreground px-3 py-1.5 text-background" : "px-3 py-1.5 hover:bg-muted",
									children: t("Preview")
								})
							]
						})]
					}),
					(editorView === "edit" || editorView === "split") && /* @__PURE__ */ jsx("div", {
						className: "sticky top-2 z-10 mb-3 flex flex-wrap gap-1 rounded-md border bg-background/95 p-1 shadow-sm backdrop-blur supports-[backdrop-filter]:bg-background/70",
						children: [
							{
								label: "B",
								title: "Bold",
								wrap: "**"
							},
							{
								label: "I",
								title: "Italic",
								wrap: "*"
							},
							{
								label: "H1",
								title: "Heading 1",
								linePrefix: "# "
							},
							{
								label: "H2",
								title: "Heading 2",
								linePrefix: "## "
							},
							{
								label: "H3",
								title: "Heading 3",
								linePrefix: "### "
							},
							{
								label: "•",
								title: "Bullet list",
								linePrefix: "- "
							},
							{
								label: "1.",
								title: "Numbered list",
								linePrefix: "1. "
							},
							{
								label: "🔗",
								title: "Link",
								insertLink: true
							},
							{
								label: "<>",
								title: "Inline code",
								wrap: "`"
							},
							{
								label: "```",
								title: "Code block",
								wrap: "\n```\n"
							},
							{
								label: "\"",
								title: "Blockquote",
								linePrefix: "> "
							}
						].map((btn, i) => /* @__PURE__ */ jsx("button", {
							type: "button",
							title: btn.title,
							onClick: () => applyMarkdown(btn),
							className: "rounded px-2 py-1 text-xs font-medium hover:bg-muted",
							children: btn.label
						}, i))
					}),
					/* @__PURE__ */ jsxs("div", {
						className: editorView === "split" ? "grid items-stretch gap-3 md:grid-cols-2" : "grid gap-3",
						children: [(editorView === "edit" || editorView === "split") && /* @__PURE__ */ jsx("textarea", {
							ref: textareaRef,
							value: form.data.content_markdown,
							onChange: (e) => form.setData("content_markdown", e.target.value),
							className: "min-h-[28rem] w-full resize-y rounded-md border bg-background px-3 py-2 font-mono text-xs leading-relaxed",
							required: true
						}), (editorView === "preview" || editorView === "split") && /* @__PURE__ */ jsxs("div", {
							className: "min-h-[28rem] overflow-auto rounded-md border bg-card px-4 py-3",
							children: [
								previewLoading && /* @__PURE__ */ jsx("p", {
									className: "text-xs text-muted-foreground",
									children: t("Rendering preview…")
								}),
								previewError && /* @__PURE__ */ jsx("p", {
									className: "text-xs text-destructive",
									children: previewError
								}),
								/* @__PURE__ */ jsx("div", {
									className: "page-content text-sm",
									dangerouslySetInnerHTML: { __html: previewHtml || "<p style=\"opacity:.6\">" + t("Preview will render here.") + "</p>" }
								})
							]
						})]
					}),
					form.errors.content_markdown && /* @__PURE__ */ jsx("p", {
						className: "mt-1 text-xs text-destructive",
						children: form.errors.content_markdown
					})
				]
			}),
			/* @__PURE__ */ jsxs("div", {
				className: "flex items-center justify-end gap-2",
				children: [/* @__PURE__ */ jsx(Button, {
					asChild: true,
					type: "button",
					variant: "ghost",
					children: /* @__PURE__ */ jsx(Link, {
						href: "/admin/pages",
						children: t("Cancel")
					})
				}), /* @__PURE__ */ jsx(Button, {
					type: "submit",
					disabled: form.processing,
					children: form.processing ? t("Saving…") : submitLabel
				})]
			})
		]
	});
}
//#endregion
//#region resources/js/pages/admin/pages/create.tsx
var create_exports$3 = /* @__PURE__ */ __exportAll({ default: () => CreatePage });
function CreatePage() {
	const { t } = useT();
	return /* @__PURE__ */ jsxs(AdminLayout, {
		breadcrumbs: [
			{
				title: t("Admin"),
				href: "/admin"
			},
			{
				title: t("Pages"),
				href: "/admin/pages"
			},
			{
				title: t("New page"),
				href: "/admin/pages/create"
			}
		],
		children: [/* @__PURE__ */ jsx(Head, { title: t("New page · Admin") }), /* @__PURE__ */ jsxs("div", {
			className: "flex flex-col gap-4 p-4",
			children: [/* @__PURE__ */ jsx("h1", {
				className: "text-2xl font-semibold tracking-tight",
				children: t("New page")
			}), /* @__PURE__ */ jsx(PageForm, {
				initial: {
					title: "",
					slug: "",
					content_markdown: "",
					is_published: false,
					sort_order: 0
				},
				method: "post",
				action: "/admin/pages",
				submitLabel: t("Create page")
			})]
		})]
	});
}
//#endregion
//#region resources/js/pages/admin/pages/edit.tsx
var edit_exports$3 = /* @__PURE__ */ __exportAll({ default: () => EditPage });
function EditPage({ page }) {
	const { t } = useT();
	return /* @__PURE__ */ jsxs(AdminLayout, {
		breadcrumbs: [
			{
				title: t("Admin"),
				href: "/admin"
			},
			{
				title: t("Pages"),
				href: "/admin/pages"
			},
			{
				title: page.title,
				href: `/admin/pages/${page.id}/edit`
			}
		],
		children: [/* @__PURE__ */ jsx(Head, { title: t(":title · Admin", { title: page.title }) }), /* @__PURE__ */ jsxs("div", {
			className: "flex flex-col gap-4 p-4",
			children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("h1", {
				className: "text-2xl font-semibold tracking-tight",
				children: page.title
			}), page.public_url && /* @__PURE__ */ jsxs("p", {
				className: "mt-1 text-xs text-muted-foreground",
				children: [
					t("Live at"),
					" ",
					/* @__PURE__ */ jsx("a", {
						href: page.public_url,
						target: "_blank",
						rel: "noopener noreferrer",
						className: "font-mono underline-offset-4 hover:underline",
						children: page.public_url
					})
				]
			})] }), /* @__PURE__ */ jsx(PageForm, {
				initial: {
					title: page.title,
					slug: page.slug,
					content_markdown: page.content_markdown,
					is_published: page.is_published,
					sort_order: page.sort_order
				},
				method: "patch",
				action: `/admin/pages/${page.id}`,
				submitLabel: t("Save page")
			})]
		})]
	});
}
//#endregion
//#region resources/js/pages/admin/pages/index.tsx
var pages_exports = /* @__PURE__ */ __exportAll({ default: () => AdminPagesIndex });
var PAGES_ONLY = [
	"pages",
	"pagination",
	"filters"
];
function AdminPagesIndex({ pages, pagination, filters }) {
	const { t } = useT();
	const confirm = useConfirm();
	const remove = async (page) => {
		if (!await confirm({
			title: t("Delete page?"),
			message: t("Delete \":title\"? This cannot be undone.", { title: page.title }),
			confirmLabel: t("Delete"),
			danger: true
		})) return;
		router.delete(destroy$21(page.id).url, { preserveScroll: true });
	};
	return /* @__PURE__ */ jsxs(AdminLayout, {
		breadcrumbs: [{
			title: t("Admin"),
			href: "/admin"
		}, {
			title: t("Pages"),
			href: index$31()
		}],
		children: [/* @__PURE__ */ jsx(Head, { title: t("Pages · Admin") }), /* @__PURE__ */ jsxs(AdminSurface, { children: [
			/* @__PURE__ */ jsxs(AdminSurfaceBar, { children: [
				/* @__PURE__ */ jsx("span", {
					className: "inline-flex h-7 items-center rounded-md border bg-card px-2.5 text-xs font-normal",
					children: t(":count pages", { count: pagination.total.toLocaleString() })
				}),
				/* @__PURE__ */ jsx(TableSearch, {
					placeholder: t("Search by title or slug…"),
					initialValue: filters.q,
					only: PAGES_ONLY
				}),
				/* @__PURE__ */ jsx("div", {
					className: "ms-auto",
					children: /* @__PURE__ */ jsx(Button, {
						asChild: true,
						size: "sm",
						children: /* @__PURE__ */ jsxs(Link, {
							href: create$4(),
							children: [/* @__PURE__ */ jsx(Plus, { className: "size-4" }), /* @__PURE__ */ jsx("span", {
								className: "ms-1",
								children: t("New page")
							})]
						})
					})
				})
			] }),
			/* @__PURE__ */ jsx("div", {
				className: "min-h-0 flex-1 overflow-auto",
				children: /* @__PURE__ */ jsxs("table", {
					className: "w-full border-separate border-spacing-0 text-sm",
					children: [/* @__PURE__ */ jsx("thead", {
						className: "sticky top-0 z-10 bg-card text-xs font-medium text-muted-foreground",
						children: /* @__PURE__ */ jsxs("tr", { children: [
							/* @__PURE__ */ jsx("th", {
								className: "border-e border-b px-3 py-2 text-start",
								children: t("Title")
							}),
							/* @__PURE__ */ jsx("th", {
								className: "border-e border-b px-3 py-2 text-start",
								children: t("Slug")
							}),
							/* @__PURE__ */ jsx("th", {
								className: "border-e border-b px-3 py-2",
								children: t("Status")
							}),
							/* @__PURE__ */ jsx("th", {
								className: "border-e border-b px-3 py-2",
								children: t("Order")
							}),
							/* @__PURE__ */ jsx("th", {
								className: "border-e border-b px-3 py-2",
								children: t("Updated")
							}),
							/* @__PURE__ */ jsx("th", {
								className: "border-b px-3 py-2 text-end",
								children: t("Actions")
							})
						] })
					}), /* @__PURE__ */ jsx("tbody", { children: pages.length === 0 ? /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsxs("td", {
						colSpan: 6,
						className: "border-b px-3 py-12 text-center text-muted-foreground",
						children: [
							/* @__PURE__ */ jsx(FileText, { className: "mx-auto size-6 text-muted-foreground" }),
							/* @__PURE__ */ jsx("p", {
								className: "mt-2 font-medium",
								children: t("No pages yet")
							}),
							/* @__PURE__ */ jsx("p", {
								className: "mt-1 text-xs",
								children: t("Create your first custom page (About, Company, Product…).")
							})
						]
					}) }) : pages.map((page) => /* @__PURE__ */ jsxs("tr", {
						className: "hover:bg-muted/35",
						children: [
							/* @__PURE__ */ jsx("td", {
								className: "border-e border-b px-3 py-2 font-medium",
								children: page.title
							}),
							/* @__PURE__ */ jsxs("td", {
								className: "border-e border-b px-3 py-2 font-mono text-xs text-muted-foreground",
								children: ["/p/", page.slug]
							}),
							/* @__PURE__ */ jsx("td", {
								className: "border-e border-b px-3 py-2 text-center",
								children: page.is_published ? /* @__PURE__ */ jsx("span", {
									className: "inline-flex items-center rounded-md border border-emerald-200 bg-emerald-50 px-2 py-0.5 text-xs font-medium text-emerald-700 dark:border-emerald-500/30 dark:bg-emerald-500/10 dark:text-emerald-300",
									children: t("Published")
								}) : /* @__PURE__ */ jsx("span", {
									className: "inline-flex items-center rounded-md border border-amber-200 bg-amber-50 px-2 py-0.5 text-xs font-medium text-amber-700 dark:border-amber-500/30 dark:bg-amber-500/10 dark:text-amber-300",
									children: t("Draft")
								})
							}),
							/* @__PURE__ */ jsx("td", {
								className: "border-e border-b px-3 py-2 text-center tabular-nums",
								children: page.sort_order
							}),
							/* @__PURE__ */ jsx("td", {
								className: "border-e border-b px-3 py-2 text-center text-muted-foreground",
								children: relativeTime$8(page.updated_at, "—")
							}),
							/* @__PURE__ */ jsx("td", {
								className: "border-b px-3 py-2",
								children: /* @__PURE__ */ jsxs("div", {
									className: "flex justify-end gap-1",
									children: [
										page.public_url && /* @__PURE__ */ jsx(Button, {
											asChild: true,
											size: "sm",
											variant: "ghost",
											children: /* @__PURE__ */ jsx("a", {
												href: page.public_url,
												target: "_blank",
												rel: "noopener noreferrer",
												"aria-label": t("View public page"),
												children: /* @__PURE__ */ jsx(ExternalLink, { className: "size-3.5" })
											})
										}),
										/* @__PURE__ */ jsx(Button, {
											asChild: true,
											size: "sm",
											variant: "ghost",
											children: /* @__PURE__ */ jsx(Link, {
												href: edit$10(page.id).url,
												"aria-label": t("Edit"),
												children: /* @__PURE__ */ jsx(Pencil, { className: "size-3.5" })
											})
										}),
										/* @__PURE__ */ jsx(Button, {
											size: "sm",
											variant: "ghost",
											onClick: () => remove(page),
											"aria-label": t("Delete"),
											children: /* @__PURE__ */ jsx(Trash2, { className: "size-3.5 text-rose-600 dark:text-rose-400" })
										})
									]
								})
							})
						]
					}, page.id)) })]
				})
			}),
			/* @__PURE__ */ jsx(TablePagination, {
				pagination,
				only: PAGES_ONLY
			})
		] })]
	});
}
//#endregion
//#region resources/js/components/input-error.tsx
function InputError({ message, className = "", ...props }) {
	return message ? /* @__PURE__ */ jsx("p", {
		...props,
		className: cn("text-xs font-medium text-destructive", className),
		children: message
	}) : null;
}
//#endregion
//#region resources/js/pages/admin/plans/plan-form.tsx
var plan_form_exports = /* @__PURE__ */ __exportAll({ PlanForm: () => PlanForm });
var SUPPORTED_CURRENCIES = [
	"EUR",
	"GBP",
	"INR",
	"BDT",
	"JPY",
	"CNY",
	"CAD",
	"AUD",
	"NZD",
	"SGD",
	"AED",
	"BRL",
	"MXN",
	"ZAR",
	"TRY",
	"KRW",
	"PHP",
	"MYR",
	"IDR",
	"PKR",
	"EGP",
	"NGN",
	"KES"
];
function CurrencyRows({ prices, onChange }) {
	const entries = Object.entries(prices).filter(([k]) => k !== "usd");
	const addable = SUPPORTED_CURRENCIES.filter((c) => !(c.toLowerCase() in prices));
	const update = (code, raw) => {
		const cleaned = raw.replace(/[^\d]/g, "");
		onChange({
			...prices,
			[code.toLowerCase()]: cleaned === "" ? 0 : Number(cleaned)
		});
	};
	const remove = (code) => {
		const next = { ...prices };
		delete next[code.toLowerCase()];
		onChange(next);
	};
	const add = (code) => {
		onChange({
			...prices,
			[code.toLowerCase()]: 0
		});
	};
	return /* @__PURE__ */ jsxs("div", {
		className: "space-y-2",
		children: [entries.map(([code, value]) => /* @__PURE__ */ jsxs("div", {
			className: "flex items-center gap-2 text-sm",
			children: [
				/* @__PURE__ */ jsx("span", {
					className: "w-16 font-mono text-muted-foreground uppercase",
					children: code
				}),
				/* @__PURE__ */ jsx("input", {
					type: "number",
					min: 0,
					step: 1,
					value,
					onChange: (e) => update(code, e.target.value),
					className: "flex-1 rounded-md border bg-background px-3 py-1.5",
					placeholder: "minor units"
				}),
				/* @__PURE__ */ jsx("button", {
					type: "button",
					onClick: () => remove(code),
					className: "rounded-md border px-2 py-1 text-xs hover:bg-muted",
					children: "Remove"
				})
			]
		}, code)), addable.length > 0 && /* @__PURE__ */ jsxs("select", {
			onChange: (e) => {
				if (e.target.value) {
					add(e.target.value);
					e.target.value = "";
				}
			},
			className: "rounded-md border bg-background px-3 py-1.5 text-sm",
			children: [/* @__PURE__ */ jsx("option", {
				value: "",
				children: "+ Add currency"
			}), addable.map((c) => /* @__PURE__ */ jsx("option", {
				value: c,
				children: c
			}, c))]
		})]
	});
}
var dollarsToCents = (value) => {
	const cleaned = value.replace(/[^\d.]/g, "");
	if (cleaned === "") return 0;
	const dollars = Number.parseFloat(cleaned);
	return Number.isFinite(dollars) ? Math.round(dollars * 100) : 0;
};
var centsToDollars = (cents) => {
	if (!Number.isFinite(cents) || cents === 0) return "";
	return (cents / 100).toFixed(2);
};
function PlanForm({ initial, method, action, submitLabel, currency, readonly }) {
	const { t } = useT();
	const form = useForm(initial);
	const submit = (e) => {
		e.preventDefault();
		form.submit(method, action, { preserveScroll: true });
	};
	const isPaid = form.data.price_cents > 0;
	return /* @__PURE__ */ jsxs("form", {
		onSubmit: submit,
		className: "grid gap-4",
		children: [
			/* @__PURE__ */ jsxs(Card, {
				className: "p-4",
				children: [
					/* @__PURE__ */ jsx("h2", {
						className: "font-semibold",
						children: t("Plan")
					}),
					/* @__PURE__ */ jsx("p", {
						className: "mb-4 text-xs text-muted-foreground",
						children: t("Saved here, then mirrored to Stripe as a Product + Price automatically. Free / custom plans (price ≤ 0) skip the Stripe step.")
					}),
					/* @__PURE__ */ jsxs("div", {
						className: "grid gap-4 md:grid-cols-2",
						children: [
							/* @__PURE__ */ jsxs("div", {
								className: "grid gap-1.5",
								children: [
									/* @__PURE__ */ jsx(Label, {
										htmlFor: "plan-name",
										children: t("Display name")
									}),
									/* @__PURE__ */ jsx(Input, {
										id: "plan-name",
										value: form.data.name,
										onChange: (e) => form.setData("name", e.target.value),
										placeholder: t("Standard"),
										required: true
									}),
									form.errors.name && /* @__PURE__ */ jsx("p", {
										className: "text-xs text-destructive",
										children: form.errors.name
									})
								]
							}),
							/* @__PURE__ */ jsxs("div", {
								className: "grid gap-1.5",
								children: [
									/* @__PURE__ */ jsx(Label, {
										htmlFor: "plan-conversations",
										children: t("Monthly conversations")
									}),
									/* @__PURE__ */ jsx(Input, {
										id: "plan-conversations",
										type: "number",
										min: 0,
										value: form.data.monthly_conversations,
										onChange: (e) => form.setData("monthly_conversations", Number.parseInt(e.target.value, 10) || 0),
										placeholder: "500",
										required: true
									}),
									/* @__PURE__ */ jsx("p", {
										className: "text-xs text-muted-foreground",
										children: t("0 = unlimited.")
									}),
									form.errors.monthly_conversations && /* @__PURE__ */ jsx("p", {
										className: "text-xs text-destructive",
										children: form.errors.monthly_conversations
									})
								]
							}),
							/* @__PURE__ */ jsxs("div", {
								className: "grid gap-1.5",
								children: [
									/* @__PURE__ */ jsx(Label, {
										htmlFor: "plan-price",
										children: t("Monthly price (:currency)", { currency: currency.toUpperCase() })
									}),
									/* @__PURE__ */ jsx(Input, {
										id: "plan-price",
										type: "text",
										inputMode: "decimal",
										value: centsToDollars(form.data.price_cents),
										onChange: (e) => form.setData("price_cents", dollarsToCents(e.target.value)),
										placeholder: "49.00"
									}),
									/* @__PURE__ */ jsx("p", {
										className: "text-xs text-muted-foreground",
										children: t("Set to 0 for free / custom-quote plans.")
									}),
									form.errors.price_cents && /* @__PURE__ */ jsx("p", {
										className: "text-xs text-destructive",
										children: form.errors.price_cents
									})
								]
							}),
							/* @__PURE__ */ jsxs("div", {
								className: "grid gap-1.5",
								children: [
									/* @__PURE__ */ jsx(Label, {
										htmlFor: "plan-yearly-price",
										children: t("Yearly price (:currency, optional)", { currency: currency.toUpperCase() })
									}),
									/* @__PURE__ */ jsx(Input, {
										id: "plan-yearly-price",
										type: "text",
										inputMode: "decimal",
										value: form.data.yearly_price_cents !== null ? centsToDollars(form.data.yearly_price_cents) : "",
										onChange: (e) => form.setData("yearly_price_cents", e.target.value === "" ? null : dollarsToCents(e.target.value)),
										placeholder: "490.00"
									}),
									/* @__PURE__ */ jsx("p", {
										className: "text-xs text-muted-foreground",
										children: t("Leave empty to hide the Yearly toggle for this plan. Typical discount is 2 months free (≈ monthly × 10).")
									}),
									form.errors.yearly_price_cents && /* @__PURE__ */ jsx("p", {
										className: "text-xs text-destructive",
										children: form.errors.yearly_price_cents
									})
								]
							}),
							/* @__PURE__ */ jsxs("div", {
								className: "grid gap-1.5",
								children: [
									/* @__PURE__ */ jsx(Label, {
										htmlFor: "plan-interval",
										children: t("Billing interval")
									}),
									/* @__PURE__ */ jsx("div", {
										id: "plan-interval",
										className: "inline-flex rounded-md border bg-muted/50 p-1 text-sm",
										role: "radiogroup",
										"aria-label": t("Billing interval"),
										children: [{
											v: "month",
											label: t("Monthly")
										}, {
											v: "year",
											label: t("Yearly")
										}].map((opt) => /* @__PURE__ */ jsx("button", {
											type: "button",
											role: "radio",
											"aria-checked": form.data.interval === opt.v,
											onClick: () => form.setData("interval", opt.v),
											className: `rounded px-3 py-1 transition ${form.data.interval === opt.v ? "bg-background font-semibold shadow-sm" : "text-muted-foreground hover:text-foreground"}`,
											children: opt.label
										}, opt.v))
									}),
									/* @__PURE__ */ jsx("p", {
										className: "text-xs text-muted-foreground",
										children: t("For an annual variant of an existing plan, create a separate row with the same display name and interval = Yearly. The pricing page groups them under one toggle.")
									}),
									form.errors.interval && /* @__PURE__ */ jsx("p", {
										className: "text-xs text-destructive",
										children: form.errors.interval
									})
								]
							}),
							/* @__PURE__ */ jsxs("div", {
								className: "grid gap-1.5",
								children: [/* @__PURE__ */ jsxs(Label, {
									className: "flex items-center gap-2",
									children: [/* @__PURE__ */ jsx("input", {
										type: "checkbox",
										checked: form.data.is_active,
										onChange: (e) => form.setData("is_active", e.target.checked),
										className: "size-4"
									}), /* @__PURE__ */ jsx("span", { children: t("Active (purchasable)") })]
								}), /* @__PURE__ */ jsx("p", {
									className: "text-xs text-muted-foreground",
									children: t("Inactive plans stay in the DB but don't appear on the marketing pricing page or Stripe checkout.")
								})]
							}),
							/* @__PURE__ */ jsxs("div", {
								className: "grid gap-1.5",
								children: [/* @__PURE__ */ jsxs(Label, {
									className: "flex items-center gap-2",
									children: [/* @__PURE__ */ jsx("input", {
										type: "checkbox",
										checked: form.data.show_on_pricing_page,
										onChange: (e) => form.setData("show_on_pricing_page", e.target.checked),
										className: "size-4"
									}), /* @__PURE__ */ jsx("span", { children: t("Show on public /pricing page") })]
								}), /* @__PURE__ */ jsx("p", {
									className: "text-xs text-muted-foreground",
									children: t("Hide a card when an Enterprise / Custom CTA text below the grid already covers that audience. The plan remains purchasable via direct link.")
								})]
							}),
							/* @__PURE__ */ jsxs("div", {
								className: "grid gap-1.5",
								children: [/* @__PURE__ */ jsxs(Label, {
									className: "flex items-center gap-2",
									children: [/* @__PURE__ */ jsx("input", {
										type: "checkbox",
										checked: form.data.is_default_for_signup,
										onChange: (e) => form.setData("is_default_for_signup", e.target.checked),
										className: "size-4"
									}), /* @__PURE__ */ jsx("span", { children: t("Default plan for new signups") })]
								}), /* @__PURE__ */ jsx("p", {
									className: "text-xs text-muted-foreground",
									children: t("When a new user signs up, this is the plan their first workspace is attached to. Only one plan may be the default — saving this checked demotes the previous default automatically.")
								})]
							}),
							/* @__PURE__ */ jsxs("div", {
								className: "grid gap-1.5",
								children: [
									/* @__PURE__ */ jsxs(Label, {
										className: "flex items-center gap-2",
										children: [/* @__PURE__ */ jsx("input", {
											type: "checkbox",
											checked: form.data.is_trial,
											onChange: (e) => form.setData("is_trial", e.target.checked),
											className: "size-4"
										}), /* @__PURE__ */ jsx("span", { children: t("Free trial plan") })]
									}),
									/* @__PURE__ */ jsx("p", {
										className: "text-xs text-muted-foreground",
										children: t("New signups on this plan get a no-credit-card trial. When it ends, the workspace is blocked until they upgrade to a paid plan. Combine with “Default plan for new signups” to put every new user on a trial.")
									}),
									form.data.is_trial && /* @__PURE__ */ jsxs("div", {
										className: "mt-1 grid gap-1.5",
										children: [
											/* @__PURE__ */ jsx(Label, {
												htmlFor: "plan-trial-days",
												children: t("Trial length (days)")
											}),
											/* @__PURE__ */ jsx(Input, {
												id: "plan-trial-days",
												type: "number",
												min: 1,
												max: 365,
												value: form.data.trial_days ?? "",
												onChange: (e) => form.setData("trial_days", e.target.value === "" ? null : Number(e.target.value)),
												placeholder: "14",
												className: "max-w-[160px]"
											}),
											/* @__PURE__ */ jsx(InputError, { message: form.errors.trial_days }),
											/* @__PURE__ */ jsx("p", {
												className: "text-xs text-muted-foreground",
												children: t("Common values: 7, 14, or 30. Defaults to 14 if left blank.")
											})
										]
									})
								]
							}),
							/* @__PURE__ */ jsxs("div", {
								className: "grid gap-1.5 md:col-span-2",
								children: [
									/* @__PURE__ */ jsx(Label, {
										htmlFor: "plan-billing-model",
										children: t("Billing model")
									}),
									/* @__PURE__ */ jsxs("select", {
										id: "plan-billing-model",
										value: form.data.billing_model ?? "subscription",
										onChange: (e) => form.setData("billing_model", e.target.value),
										className: "w-full max-w-xs rounded-md border bg-background px-3 py-2 text-sm",
										children: [
											/* @__PURE__ */ jsx("option", {
												value: "subscription",
												children: t("Subscription (recurring)")
											}),
											/* @__PURE__ */ jsx("option", {
												value: "lifetime",
												children: t("Lifetime deal (one-time, permanent access)")
											}),
											/* @__PURE__ */ jsx("option", {
												value: "one_time",
												children: t("One-time charge")
											})
										]
									}),
									/* @__PURE__ */ jsx("p", {
										className: "text-xs text-muted-foreground",
										children: t("Lifetime plans never renew. The buyer pays once and the workspace keeps access forever (until you revoke it).")
									})
								]
							})
						]
					}),
					/* @__PURE__ */ jsxs("div", {
						className: "mt-6 grid gap-3",
						children: [
							/* @__PURE__ */ jsx("h3", {
								className: "text-sm font-semibold",
								children: t("Multi-currency prices (optional)")
							}),
							/* @__PURE__ */ jsx("p", {
								className: "text-xs text-muted-foreground",
								children: t("Add a per-currency override in minor units (cents-equivalent). USD always uses the main Price field above. Visitor sees their currency auto-detected from country / language, with a dropdown to switch.")
							}),
							/* @__PURE__ */ jsx(CurrencyRows, {
								prices: form.data.prices ?? {},
								onChange: (p) => form.setData("prices", p)
							})
						]
					})
				]
			}),
			/* @__PURE__ */ jsxs(Card, {
				className: "p-4",
				children: [
					/* @__PURE__ */ jsx("h2", {
						className: "font-semibold",
						children: t("AI rate limits")
					}),
					/* @__PURE__ */ jsx("p", {
						className: "mb-4 text-xs text-muted-foreground",
						children: t("Optional dials for throttling LLM cost. Both fields default to \"no extra cap\" — leave blank to gate on the monthly conversation count alone.")
					}),
					/* @__PURE__ */ jsxs("div", {
						className: "grid gap-4 md:grid-cols-2",
						children: [/* @__PURE__ */ jsxs("div", {
							className: "grid gap-1.5",
							children: [
								/* @__PURE__ */ jsx(Label, {
									htmlFor: "plan-monthly-messages",
									children: t("Monthly messages cap")
								}),
								/* @__PURE__ */ jsx(Input, {
									id: "plan-monthly-messages",
									type: "number",
									min: 0,
									value: form.data.monthly_messages ?? "",
									onChange: (e) => {
										const raw = e.target.value;
										form.setData("monthly_messages", raw === "" ? null : Number.parseInt(raw, 10) || 0);
									},
									placeholder: t("leave blank for no cap")
								}),
								/* @__PURE__ */ jsx("p", {
									className: "text-xs text-muted-foreground",
									children: t("Counts every visitor message. The widget returns a \"quota exceeded\" error when the workspace passes this threshold for the current calendar month.")
								}),
								form.errors.monthly_messages && /* @__PURE__ */ jsx("p", {
									className: "text-xs text-destructive",
									children: form.errors.monthly_messages
								})
							]
						}), /* @__PURE__ */ jsxs("div", {
							className: "grid gap-1.5",
							children: [
								/* @__PURE__ */ jsx(Label, {
									htmlFor: "plan-max-tokens",
									children: t("Max tokens per response")
								}),
								/* @__PURE__ */ jsx(Input, {
									id: "plan-max-tokens",
									type: "number",
									min: 100,
									max: 8e3,
									value: form.data.max_tokens_per_response ?? "",
									onChange: (e) => {
										const raw = e.target.value;
										form.setData("max_tokens_per_response", raw === "" ? null : Number.parseInt(raw, 10) || 0);
									},
									placeholder: t("leave blank for default (800)")
								}),
								/* @__PURE__ */ jsx("p", {
									className: "text-xs text-muted-foreground",
									children: t("Caps each LLM reply at this many tokens. Useful for keeping the free tier short and the paid tiers verbose. Must be ≥ 100, ≤ 8000.")
								}),
								form.errors.max_tokens_per_response && /* @__PURE__ */ jsx("p", {
									className: "text-xs text-destructive",
									children: form.errors.max_tokens_per_response
								})
							]
						})]
					})
				]
			}),
			/* @__PURE__ */ jsxs(Card, {
				className: "p-4",
				children: [
					/* @__PURE__ */ jsx("h2", {
						className: "font-semibold",
						children: t("Resource limits")
					}),
					/* @__PURE__ */ jsx("p", {
						className: "mb-4 text-xs text-muted-foreground",
						children: t("Cap how many of each resource a workspace can create on this plan. Leave blank for \"unlimited\" (legacy default). Set to 0 to block the feature entirely (e.g. Free tier without integrations).")
					}),
					/* @__PURE__ */ jsxs("div", {
						className: "grid gap-4 md:grid-cols-2",
						children: [[
							["agents_limit", "Agents"],
							["sources_limit", "Knowledge sources"],
							["workflows_limit", "Workflows"],
							["integrations_limit", "Integrations"],
							["members_limit", "Members (seats)"],
							["workspaces_limit", "Workspaces per owner"]
						].map(([key, label]) => /* @__PURE__ */ jsxs("div", {
							className: "grid gap-1.5",
							children: [
								/* @__PURE__ */ jsx(Label, {
									htmlFor: `plan-${key}`,
									children: t(label)
								}),
								/* @__PURE__ */ jsx(Input, {
									id: `plan-${key}`,
									type: "number",
									min: 0,
									value: form.data[key] ?? "",
									onChange: (e) => {
										const raw = e.target.value;
										form.setData(key, raw === "" ? null : Math.max(0, Number.parseInt(raw, 10) || 0));
									},
									placeholder: t("blank = unlimited")
								}),
								form.errors[key] && /* @__PURE__ */ jsx("p", {
									className: "text-xs text-destructive",
									children: form.errors[key]
								})
							]
						}, key)), /* @__PURE__ */ jsxs("div", {
							className: "grid gap-1.5",
							children: [/* @__PURE__ */ jsxs(Label, {
								className: "flex items-center gap-2",
								children: [/* @__PURE__ */ jsx("input", {
									type: "checkbox",
									checked: form.data.api_access,
									onChange: (e) => form.setData("api_access", e.target.checked),
									className: "size-4"
								}), /* @__PURE__ */ jsx("span", { children: t("Allow API tokens") })]
							}), /* @__PURE__ */ jsx("p", {
								className: "text-xs text-muted-foreground",
								children: t("Workspaces on this plan can mint and use API tokens (WordPress plugin, Sources API). Disable for Free / starter tiers.")
							})]
						})]
					})
				]
			}),
			/* @__PURE__ */ jsxs(Card, {
				className: "p-4",
				children: [
					/* @__PURE__ */ jsx("h2", {
						className: "font-semibold",
						children: t("Features")
					}),
					/* @__PURE__ */ jsx("p", {
						className: "mb-4 text-xs text-muted-foreground",
						children: t("Plan-level capability flags. Stored as JSON on the plan row; consumed by middleware / UI gates.")
					}),
					/* @__PURE__ */ jsxs(Label, {
						className: "flex items-center gap-2",
						children: [/* @__PURE__ */ jsx("input", {
							type: "checkbox",
							checked: form.data.features.remove_branding,
							onChange: (e) => form.setData("features", {
								...form.data.features,
								remove_branding: e.target.checked
							}),
							className: "size-4"
						}), /* @__PURE__ */ jsx("span", {
							className: "text-sm",
							children: t("Remove \"Powered by\" widget branding")
						})]
					})
				]
			}),
			readonly && /* @__PURE__ */ jsxs(Card, {
				className: "p-4",
				children: [
					/* @__PURE__ */ jsx("h2", {
						className: "font-semibold",
						children: t("Stripe")
					}),
					/* @__PURE__ */ jsx("p", {
						className: "mb-3 text-xs text-muted-foreground",
						children: t("These are managed automatically when you save. Read-only for reference.")
					}),
					/* @__PURE__ */ jsxs("div", {
						className: "grid gap-3 md:grid-cols-2",
						children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx(Label, {
							className: "text-xs text-muted-foreground",
							children: t("Product ID")
						}), /* @__PURE__ */ jsx("p", {
							className: "mt-1 font-mono text-xs break-all",
							children: readonly.stripe_product_id ?? /* @__PURE__ */ jsx("span", {
								className: "text-muted-foreground/60",
								children: t("not synced yet (paid plans only)")
							})
						})] }), /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx(Label, {
							className: "text-xs text-muted-foreground",
							children: t("Price ID")
						}), /* @__PURE__ */ jsx("p", {
							className: "mt-1 font-mono text-xs break-all",
							children: readonly.stripe_price_id ?? /* @__PURE__ */ jsx("span", {
								className: "text-muted-foreground/60",
								children: t("not synced yet (paid plans only)")
							})
						})] })]
					}),
					isPaid && /* @__PURE__ */ jsx("p", {
						className: "mt-3 text-xs text-muted-foreground",
						children: t("Changing the price archives the current Stripe Price and creates a new one. Existing subscriptions stay on the old price until you migrate them.")
					})
				]
			}),
			/* @__PURE__ */ jsxs("div", {
				className: "flex items-center justify-end gap-2",
				children: [/* @__PURE__ */ jsx(Button, {
					asChild: true,
					type: "button",
					variant: "ghost",
					children: /* @__PURE__ */ jsx(Link, {
						href: "/admin/plans",
						children: t("Cancel")
					})
				}), /* @__PURE__ */ jsx(Button, {
					type: "submit",
					disabled: form.processing,
					children: form.processing ? t("Saving…") : submitLabel
				})]
			})
		]
	});
}
//#endregion
//#region resources/js/pages/admin/plans/create.tsx
var create_exports$2 = /* @__PURE__ */ __exportAll({ default: () => CreatePlan });
function CreatePlan({ currency }) {
	const { t } = useT();
	return /* @__PURE__ */ jsxs(AdminLayout, {
		breadcrumbs: [
			{
				title: t("Admin"),
				href: "/admin"
			},
			{
				title: t("Plans"),
				href: "/admin/plans"
			},
			{
				title: t("New plan"),
				href: "/admin/plans/create"
			}
		],
		children: [/* @__PURE__ */ jsx(Head, { title: t("New plan · Admin") }), /* @__PURE__ */ jsxs("div", {
			className: "flex flex-1 flex-col gap-4 p-4",
			children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("h1", {
				className: "text-2xl font-semibold tracking-tight",
				children: t("New plan")
			}), /* @__PURE__ */ jsx("p", {
				className: "mt-1 text-sm text-muted-foreground",
				children: t("After saving, the plan is mirrored to Stripe as a Product + Price (paid plans only). The slug is auto-generated from the display name and locked once created.")
			})] }), /* @__PURE__ */ jsx(PlanForm, {
				initial: {
					name: "",
					monthly_conversations: 500,
					monthly_messages: null,
					max_tokens_per_response: null,
					agents_limit: null,
					sources_limit: null,
					workflows_limit: null,
					integrations_limit: null,
					members_limit: null,
					workspaces_limit: null,
					api_access: true,
					price_cents: 4900,
					yearly_price_cents: null,
					interval: "month",
					is_active: true,
					is_default_for_signup: false,
					show_on_pricing_page: true,
					is_trial: false,
					trial_days: null,
					features: { remove_branding: true }
				},
				method: "post",
				action: "/admin/plans",
				submitLabel: t("Create plan"),
				currency
			})]
		})]
	});
}
//#endregion
//#region resources/js/pages/admin/plans/edit.tsx
var edit_exports$2 = /* @__PURE__ */ __exportAll({ default: () => EditPlan });
function EditPlan({ plan, currency }) {
	const { t } = useT();
	return /* @__PURE__ */ jsxs(AdminLayout, {
		breadcrumbs: [
			{
				title: t("Admin"),
				href: "/admin"
			},
			{
				title: t("Plans"),
				href: "/admin/plans"
			},
			{
				title: plan.name,
				href: `/admin/plans/${plan.id}/edit`
			}
		],
		children: [/* @__PURE__ */ jsx(Head, { title: t("Edit :name · Admin", { name: plan.name }) }), /* @__PURE__ */ jsxs("div", {
			className: "flex flex-1 flex-col gap-4 p-4",
			children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("h1", {
				className: "text-2xl font-semibold tracking-tight",
				children: plan.name
			}), /* @__PURE__ */ jsxs("p", {
				className: "mt-1 text-sm text-muted-foreground",
				children: [
					t("Slug:"),
					" ",
					/* @__PURE__ */ jsx("span", {
						className: "font-mono",
						children: plan.slug
					}),
					" ·",
					" ",
					t("Saving a price change archives the prior Stripe Price and creates a new one. Existing subscriptions stay grandfathered on the old price.")
				]
			})] }), /* @__PURE__ */ jsx(PlanForm, {
				initial: {
					name: plan.name,
					monthly_conversations: plan.monthly_conversations,
					monthly_messages: plan.monthly_messages,
					max_tokens_per_response: plan.max_tokens_per_response,
					agents_limit: plan.agents_limit ?? null,
					sources_limit: plan.sources_limit ?? null,
					workflows_limit: plan.workflows_limit ?? null,
					integrations_limit: plan.integrations_limit ?? null,
					members_limit: plan.members_limit ?? null,
					workspaces_limit: plan.workspaces_limit ?? null,
					api_access: plan.api_access !== false,
					price_cents: plan.price_cents,
					yearly_price_cents: plan.yearly_price_cents ?? null,
					interval: plan.interval ?? "month",
					is_active: plan.is_active,
					is_default_for_signup: plan.is_default_for_signup ?? false,
					show_on_pricing_page: plan.show_on_pricing_page ?? true,
					is_trial: plan.is_trial ?? false,
					trial_days: plan.trial_days ?? null,
					features: { remove_branding: Boolean(plan.features.remove_branding) }
				},
				method: "patch",
				action: `/admin/plans/${plan.id}`,
				submitLabel: t("Save plan"),
				currency,
				readonly: {
					stripe_product_id: plan.stripe_product_id,
					stripe_price_id: plan.stripe_price_id
				}
			})]
		})]
	});
}
//#endregion
//#region resources/js/pages/admin/plans/index.tsx
var plans_exports = /* @__PURE__ */ __exportAll({ default: () => PlansIndex });
var GATEWAY_LABELS = {
	stripe: "Stripe",
	paypal: "PayPal",
	razorpay: "Razorpay"
};
function gatewayState(plan, gateway, status) {
	if (plan.price_cents <= 0) return "free";
	if (!status.enabled) return "disabled";
	if (!status.configured) return "unconfigured";
	const ids = plan.gateway_ids[gateway];
	return Object.values(ids).some((v) => Boolean(v)) ? "synced" : "pending";
}
function GatewayBadge({ state }) {
	const { t } = useT();
	if (state === "free") return /* @__PURE__ */ jsx("span", {
		className: "inline-flex items-center gap-1 rounded-md border bg-muted/40 px-2 py-0.5 text-xs font-medium text-muted-foreground",
		children: t("Free")
	});
	if (state === "disabled") return /* @__PURE__ */ jsx("span", {
		className: "inline-flex items-center gap-1 rounded-md border bg-muted/40 px-2 py-0.5 text-xs font-medium text-muted-foreground",
		children: t("Off")
	});
	if (state === "unconfigured") return /* @__PURE__ */ jsxs("span", {
		className: "inline-flex items-center gap-1 rounded-md border border-rose-200 bg-rose-50 px-2 py-0.5 text-xs font-medium text-rose-700 dark:border-rose-500/30 dark:bg-rose-500/10 dark:text-rose-300",
		children: [/* @__PURE__ */ jsx(AlertCircle, { className: "size-3" }), t("No keys")]
	});
	if (state === "synced") return /* @__PURE__ */ jsxs("span", {
		className: "inline-flex items-center gap-1 rounded-md border border-emerald-200 bg-emerald-50 px-2 py-0.5 text-xs font-medium text-emerald-700 dark:border-emerald-500/30 dark:bg-emerald-500/10 dark:text-emerald-300",
		children: [/* @__PURE__ */ jsx(CheckCircle2, { className: "size-3" }), t("Synced")]
	});
	return /* @__PURE__ */ jsxs("span", {
		className: "inline-flex items-center gap-1 rounded-md border border-amber-200 bg-amber-50 px-2 py-0.5 text-xs font-medium text-amber-700 dark:border-amber-500/30 dark:bg-amber-500/10 dark:text-amber-300",
		children: [/* @__PURE__ */ jsx(AlertCircle, { className: "size-3" }), t("Not synced")]
	});
}
function GatewayCell({ plan, gateway, status }) {
	const { t } = useT();
	const state = gatewayState(plan, gateway, status);
	const ids = plan.gateway_ids[gateway];
	const idValues = Object.values(ids).filter((v) => Boolean(v));
	return /* @__PURE__ */ jsxs("div", {
		className: "space-y-1",
		children: [/* @__PURE__ */ jsx(GatewayBadge, { state }), state === "free" ? /* @__PURE__ */ jsx("p", {
			className: "text-xs text-muted-foreground",
			children: t("Local only")
		}) : state === "disabled" ? /* @__PURE__ */ jsx("p", {
			className: "text-xs text-muted-foreground",
			children: t("Disabled in Settings")
		}) : state === "unconfigured" ? /* @__PURE__ */ jsx("p", {
			className: "text-xs text-muted-foreground",
			children: t("Add keys in Settings")
		}) : idValues.length > 0 ? /* @__PURE__ */ jsx("div", {
			className: "space-y-0.5 text-[11px]",
			children: idValues.map((id) => /* @__PURE__ */ jsx("p", {
				className: "truncate font-mono",
				children: id
			}, id))
		}) : /* @__PURE__ */ jsx("p", {
			className: "text-xs text-muted-foreground",
			children: t("No IDs yet")
		})]
	});
}
function PlansIndex({ plans, currency, gateways }) {
	const { t } = useT();
	const confirm = useConfirm();
	const dollars = (cents, currency) => {
		if (cents === 0) return t("Free");
		return t(":currency :amount/mo", {
			currency: currency.toUpperCase(),
			amount: (cents / 100).toLocaleString(void 0, { minimumFractionDigits: 0 })
		});
	};
	const [syncing, setSyncing] = useState({});
	const [results, setResults] = useState({});
	const VISIBLE_GATEWAYS = [
		"stripe",
		"paypal",
		"razorpay"
	].filter((g) => gateways[g]?.enabled);
	if (VISIBLE_GATEWAYS.length === 0) VISIBLE_GATEWAYS.push("stripe");
	const deactivate = async (plan) => {
		if (!await confirm({
			title: t("Deactivate plan?"),
			message: t("Deactivate \":name\"?\n\nThe plan stays in the database (existing workspaces keep their assignment) but is archived on every enabled gateway and removed from new checkouts.", { name: plan.name }),
			confirmLabel: t("Deactivate"),
			danger: true
		})) return;
		router.delete(destroy$17(plan.id).url, { preserveScroll: true });
	};
	const sync = async (plan, gateway$1) => {
		const cellKey = `${plan.id}:${gateway$1}`;
		setSyncing((s) => ({
			...s,
			[cellKey]: true
		}));
		setResults((r) => ({
			...r,
			[cellKey]: null
		}));
		try {
			const csrf = document.querySelector("meta[name=\"csrf-token\"]")?.content ?? "";
			const response = await fetch(gateway([plan.id, gateway$1]).url, {
				method: "POST",
				headers: {
					"X-CSRF-TOKEN": csrf,
					"X-Requested-With": "XMLHttpRequest",
					Accept: "application/json"
				},
				credentials: "same-origin"
			});
			const json = await response.json();
			setResults((r) => ({
				...r,
				[cellKey]: json ? {
					ok: json.ok,
					message: json.message
				} : {
					ok: false,
					message: t("Unexpected response: HTTP :status", { status: response.status })
				}
			}));
			if (json?.ok) router.reload({ only: ["plans"] });
		} catch (e) {
			setResults((r) => ({
				...r,
				[cellKey]: {
					ok: false,
					message: e instanceof Error ? e.message : String(e)
				}
			}));
		} finally {
			setSyncing((s) => ({
				...s,
				[cellKey]: false
			}));
		}
	};
	const totalCols = 5 + VISIBLE_GATEWAYS.length + 3;
	return /* @__PURE__ */ jsxs(AdminLayout, {
		breadcrumbs: [{
			title: t("Admin"),
			href: "/admin"
		}, {
			title: t("Plans"),
			href: index$25()
		}],
		children: [/* @__PURE__ */ jsx(Head, { title: t("Plans · Admin") }), /* @__PURE__ */ jsxs(AdminSurface, { children: [/* @__PURE__ */ jsxs(AdminSurfaceBar, { children: [
			/* @__PURE__ */ jsx("span", {
				className: "inline-flex h-7 items-center rounded-md border bg-card px-2.5 text-xs font-normal text-foreground",
				children: t("Plans")
			}),
			/* @__PURE__ */ jsx("span", {
				className: "inline-flex h-7 items-center rounded-md border bg-card px-2.5 text-xs font-normal text-muted-foreground",
				children: t(":count plans", { count: plans.length.toLocaleString() })
			}),
			/* @__PURE__ */ jsx("div", {
				className: "ms-auto flex w-full items-center justify-end gap-2 sm:w-auto",
				children: /* @__PURE__ */ jsx(Button, {
					asChild: true,
					size: "sm",
					children: /* @__PURE__ */ jsxs(Link, {
						href: create$3(),
						children: [/* @__PURE__ */ jsx(Plus, { className: "size-3.5" }), t("New plan")]
					})
				})
			})
		] }), /* @__PURE__ */ jsx("div", {
			className: "min-h-0 flex-1 overflow-auto",
			children: /* @__PURE__ */ jsxs("table", {
				className: "w-full min-w-[1280px] border-separate border-spacing-0 text-start text-sm",
				children: [/* @__PURE__ */ jsx("thead", {
					className: "sticky top-0 z-10 bg-card text-xs font-medium text-muted-foreground",
					children: /* @__PURE__ */ jsxs("tr", { children: [
						/* @__PURE__ */ jsx("th", {
							className: "w-9 border-b px-3 py-2",
							children: /* @__PURE__ */ jsx("input", {
								type: "checkbox",
								"aria-label": t("Select all plans"),
								disabled: true,
								className: "size-3.5 rounded border-input"
							})
						}),
						/* @__PURE__ */ jsx("th", {
							className: "border-e border-b px-3 py-2",
							children: t("Plan")
						}),
						/* @__PURE__ */ jsx("th", {
							className: "border-e border-b px-3 py-2",
							children: t("Price")
						}),
						/* @__PURE__ */ jsx("th", {
							className: "border-e border-b px-3 py-2",
							children: t("Conversations")
						}),
						/* @__PURE__ */ jsx("th", {
							className: "border-e border-b px-3 py-2",
							children: t("Status")
						}),
						VISIBLE_GATEWAYS.map((g) => /* @__PURE__ */ jsx("th", {
							className: "border-e border-b px-3 py-2",
							children: GATEWAY_LABELS[g]
						}, g)),
						/* @__PURE__ */ jsx("th", {
							className: "border-e border-b px-3 py-2",
							children: t("Workspaces")
						}),
						/* @__PURE__ */ jsx("th", {
							className: "border-e border-b px-3 py-2",
							children: t("Created")
						}),
						/* @__PURE__ */ jsx("th", {
							className: "border-b px-3 py-2 text-end",
							children: t("Actions")
						})
					] })
				}), /* @__PURE__ */ jsx("tbody", { children: plans.length === 0 ? /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx("td", {
					colSpan: totalCols,
					className: "h-72 border-b px-4 text-center",
					children: /* @__PURE__ */ jsxs("div", {
						className: "mx-auto flex max-w-sm flex-col items-center gap-2 text-muted-foreground",
						children: [
							/* @__PURE__ */ jsx(CreditCard, { className: "size-8" }),
							/* @__PURE__ */ jsx("p", {
								className: "text-sm font-medium text-foreground",
								children: t("No plans yet")
							}),
							/* @__PURE__ */ jsx("p", {
								className: "text-xs",
								children: t("Create a plan to start accepting subscriptions.")
							}),
							/* @__PURE__ */ jsx(Button, {
								asChild: true,
								size: "sm",
								className: "mt-2",
								children: /* @__PURE__ */ jsxs(Link, {
									href: create$3(),
									children: [/* @__PURE__ */ jsx(Plus, { className: "size-3.5" }), t("New plan")]
								})
							})
						]
					})
				}) }) : plans.map((plan) => {
					return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("tr", {
						className: "group hover:bg-muted/35",
						children: [
							/* @__PURE__ */ jsx("td", {
								className: "border-b px-3 py-2",
								children: /* @__PURE__ */ jsx("input", {
									type: "checkbox",
									"aria-label": t("Select :name", { name: plan.name }),
									disabled: true,
									className: "size-3.5 rounded border-input"
								})
							}),
							/* @__PURE__ */ jsx("td", {
								className: "border-e border-b px-3 py-2",
								children: /* @__PURE__ */ jsxs("div", {
									className: "min-w-0",
									children: [/* @__PURE__ */ jsx("p", {
										className: "truncate font-medium text-foreground",
										children: plan.name
									}), /* @__PURE__ */ jsx("p", {
										className: "truncate text-xs text-muted-foreground",
										children: plan.slug
									})]
								})
							}),
							/* @__PURE__ */ jsx("td", {
								className: "border-e border-b px-3 py-2 text-foreground",
								children: /* @__PURE__ */ jsx("span", {
									className: "tabular-nums",
									children: dollars(plan.price_cents, currency)
								})
							}),
							/* @__PURE__ */ jsx("td", {
								className: "border-e border-b px-3 py-2 text-muted-foreground",
								children: plan.monthly_conversations === 0 ? t("Unlimited") : plan.monthly_conversations.toLocaleString()
							}),
							/* @__PURE__ */ jsx("td", {
								className: "border-e border-b px-3 py-2",
								children: /* @__PURE__ */ jsxs("div", {
									className: "flex flex-wrap items-center gap-1",
									children: [/* @__PURE__ */ jsx("span", {
										className: `inline-flex rounded-md border px-2 py-0.5 text-xs font-medium ${plan.is_active ? "border-emerald-200 bg-emerald-50 text-emerald-700 dark:border-emerald-500/30 dark:bg-emerald-500/10 dark:text-emerald-300" : "border-border bg-muted/40 text-muted-foreground"}`,
										children: plan.is_active ? t("Active") : t("Inactive")
									}), plan.is_default_for_signup && /* @__PURE__ */ jsx("span", {
										className: "inline-flex rounded-md border border-amber-200 bg-amber-50 px-2 py-0.5 text-xs font-medium text-amber-700 dark:border-amber-500/30 dark:bg-amber-500/10 dark:text-amber-300",
										title: t("New signups land on this plan"),
										children: t("Default")
									})]
								})
							}),
							VISIBLE_GATEWAYS.map((g) => /* @__PURE__ */ jsx("td", {
								className: "border-e border-b px-3 py-2 text-muted-foreground",
								children: /* @__PURE__ */ jsx(GatewayCell, {
									plan,
									gateway: g,
									status: gateways[g] ?? {
										enabled: false,
										configured: false,
										available: false
									}
								})
							}, g)),
							/* @__PURE__ */ jsxs("td", {
								className: "border-e border-b px-3 py-2 text-muted-foreground",
								children: [plan.workspaces_count.toLocaleString(), plan.workspaces_limit !== null ? /* @__PURE__ */ jsxs("span", {
									className: "ms-1 text-xs",
									children: [
										"/",
										" ",
										plan.workspaces_limit.toLocaleString()
									]
								}) : /* @__PURE__ */ jsx("span", {
									className: "ms-1 text-xs",
									children: "/ ∞"
								})]
							}),
							/* @__PURE__ */ jsx("td", {
								className: "border-e border-b px-3 py-2 text-muted-foreground",
								children: relativeTime$8(plan.created_at, "—")
							}),
							/* @__PURE__ */ jsx("td", {
								className: "border-b px-3 py-2",
								children: /* @__PURE__ */ jsxs("div", {
									className: "flex justify-end gap-1",
									children: [
										VISIBLE_GATEWAYS.map((g) => {
											const status = gateways[g];
											const isSyncing = syncing[`${plan.id}:${g}`] === true;
											const isFree = plan.price_cents <= 0;
											return /* @__PURE__ */ jsxs(Button, {
												variant: "ghost",
												size: "sm",
												onClick: () => sync(plan, g),
												disabled: isSyncing || isFree || !status?.available,
												title: isFree ? t("Free plans skip gateway sync") : !status?.enabled ? t(":gateway disabled", { gateway: GATEWAY_LABELS[g] }) : !status?.configured ? t(":gateway missing keys", { gateway: GATEWAY_LABELS[g] }) : t("Sync to :gateway", { gateway: GATEWAY_LABELS[g] }),
												children: [isSyncing ? /* @__PURE__ */ jsx(Loader2, { className: "size-3.5 animate-spin" }) : /* @__PURE__ */ jsx(RefreshCw, { className: "size-3.5" }), /* @__PURE__ */ jsx("span", {
													className: "ms-1 hidden text-[11px] xl:inline",
													children: GATEWAY_LABELS[g]
												})]
											}, g);
										}),
										/* @__PURE__ */ jsx(Button, {
											asChild: true,
											variant: "ghost",
											size: "sm",
											children: /* @__PURE__ */ jsx(Link, {
												href: edit$9(plan.id).url,
												children: /* @__PURE__ */ jsx(Pencil, { className: "size-3.5" })
											})
										}),
										/* @__PURE__ */ jsx(Button, {
											variant: "ghost",
											size: "sm",
											onClick: () => deactivate(plan),
											disabled: !plan.is_active,
											title: plan.is_active ? t("Deactivate") : t("Already inactive"),
											children: /* @__PURE__ */ jsx(Trash2, { className: "size-3.5" })
										})
									]
								})
							})
						]
					}), VISIBLE_GATEWAYS.map((g) => {
						const cellKey = `${plan.id}:${g}`;
						const result = results[cellKey] ?? null;
						if (result === null) return null;
						return /* @__PURE__ */ jsx("tr", {
							className: result.ok ? "bg-emerald-500/5" : "bg-rose-500/5",
							children: /* @__PURE__ */ jsx("td", {
								colSpan: totalCols,
								className: "border-b px-3 py-3",
								children: /* @__PURE__ */ jsxs("div", {
									className: `flex items-start gap-2 text-xs ${result.ok ? "text-emerald-700 dark:text-emerald-400" : "text-rose-700 dark:text-rose-400"}`,
									children: [result.ok ? /* @__PURE__ */ jsx(CheckCircle2, { className: "mt-0.5 size-3.5 shrink-0" }) : /* @__PURE__ */ jsx(AlertCircle, { className: "mt-0.5 size-3.5 shrink-0" }), /* @__PURE__ */ jsxs("span", {
										className: "break-all",
										children: [
											/* @__PURE__ */ jsxs("span", {
												className: "font-semibold",
												children: [GATEWAY_LABELS[g], ":"]
											}),
											" ",
											result.message
										]
									})]
								})
							})
						}, cellKey);
					})] }, plan.id);
				}) })]
			})
		})] })]
	});
}
//#endregion
//#region resources/js/pages/admin/queue-health.tsx
var queue_health_exports = /* @__PURE__ */ __exportAll({ default: () => QueueHealth });
/**
* Dedicated full-width Queue Health page. Same payload as the
* widget on /admin (DashboardController) but rendered with more
* vertical room — the live job feed gets ~28rem of scroll space
* here vs. the dashboard's compact slot. Polled every 4s on this
* page (vs. 8s on the dashboard) because operators landing here
* are typically debugging in real time.
*/
function QueueHealth({ health }) {
	const { t } = useT();
	useEffect(() => {
		const id = globalThis.setInterval(() => {
			router.reload({ only: ["health"] });
		}, 4e3);
		return () => globalThis.clearInterval(id);
	}, []);
	return /* @__PURE__ */ jsxs(AdminLayout, {
		breadcrumbs: [{
			title: t("Dashboard"),
			href: dashboard()
		}, {
			title: t("Queue health"),
			href: "/admin/queue-health"
		}],
		children: [/* @__PURE__ */ jsx(Head, { title: t("Queue health") }), /* @__PURE__ */ jsxs("div", {
			className: "flex min-h-0 flex-1 flex-col gap-4 bg-card p-4",
			children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("h1", {
				className: "text-lg font-semibold",
				children: t("Queue health")
			}), /* @__PURE__ */ jsx("p", {
				className: "mt-1 text-sm text-muted-foreground",
				children: t("Live view of the Cloudflare Cron Worker + queue worker. Refreshes every 4 seconds.")
			})] }), /* @__PURE__ */ jsx(QueueHealthCard, {
				health,
				t
			})]
		})]
	});
}
//#endregion
//#region resources/js/pages/admin/subscriptions/index.tsx
var subscriptions_exports = /* @__PURE__ */ __exportAll({ default: () => AdminSubscriptions });
var SUBSCRIPTIONS_ONLY = [
	"workspaces",
	"pagination",
	"filters"
];
var dollars = (cents) => `$${(cents / 100).toLocaleString(void 0, {
	minimumFractionDigits: 0,
	maximumFractionDigits: 2
})}`;
var STATUS_PILL = {
	active: "bg-emerald-500/15 text-emerald-700 dark:text-emerald-400",
	trialing: "bg-sky-500/15 text-sky-700 dark:text-sky-400",
	past_due: "bg-amber-500/15 text-amber-700 dark:text-amber-400",
	canceled: "bg-muted text-muted-foreground",
	no_subscription: "bg-muted text-muted-foreground",
	no_plan: "bg-muted text-muted-foreground",
	free: "bg-slate-500/15 text-slate-700 dark:text-slate-300",
	manual: "bg-violet-500/15 text-violet-700 dark:text-violet-300"
};
function AdminSubscriptions({ totals, plans, workspaces, pagination, filters }) {
	const { t } = useT();
	const conversionRate = totals.total_workspaces > 0 ? (totals.active_count / totals.total_workspaces * 100).toFixed(1) : "0.0";
	return /* @__PURE__ */ jsxs(AdminLayout, {
		breadcrumbs: [{
			title: t("Dashboard"),
			href: dashboard()
		}, {
			title: t("Subscriptions"),
			href: index$26()
		}],
		children: [/* @__PURE__ */ jsx(Head, { title: t("Subscriptions · Admin") }), /* @__PURE__ */ jsxs(AdminSurface, { children: [/* @__PURE__ */ jsxs(AdminSurfaceBar, { children: [
			/* @__PURE__ */ jsx("span", {
				className: "inline-flex h-7 items-center rounded-md border bg-card px-2.5 text-xs font-normal text-foreground",
				children: t("Subscriptions")
			}),
			/* @__PURE__ */ jsx("span", {
				className: "inline-flex h-7 items-center rounded-md border bg-card px-2.5 text-xs font-normal text-muted-foreground",
				children: pagination.total === 1 ? t(":count billed workspace", { count: pagination.total.toLocaleString() }) : t(":count billed workspaces", { count: pagination.total.toLocaleString() })
			}),
			/* @__PURE__ */ jsx("div", {
				className: "ms-auto w-full sm:w-auto",
				children: /* @__PURE__ */ jsx(TableSearch, {
					placeholder: t("Search by workspace, slug, or stripe id..."),
					initialValue: filters.q,
					only: SUBSCRIPTIONS_ONLY
				})
			})
		] }), /* @__PURE__ */ jsx("div", {
			className: "min-h-0 flex-1 overflow-y-auto p-3 sm:p-4",
			children: /* @__PURE__ */ jsxs("div", {
				className: "grid gap-4",
				children: [
					/* @__PURE__ */ jsxs("div", {
						className: "grid grid-cols-2 gap-4 xl:grid-cols-4",
						children: [
							/* @__PURE__ */ jsxs(Card, {
								className: "p-4",
								children: [
									/* @__PURE__ */ jsxs("div", {
										className: "flex items-center gap-2 text-muted-foreground",
										children: [/* @__PURE__ */ jsx(Wallet, { className: "size-4" }), /* @__PURE__ */ jsx("p", {
											className: "text-xs tracking-wide uppercase",
											children: t("MRR")
										})]
									}),
									/* @__PURE__ */ jsx("p", {
										className: "mt-3 text-3xl font-semibold tracking-tight",
										children: dollars(totals.mrr_cents)
									}),
									/* @__PURE__ */ jsx("p", {
										className: "mt-1 text-xs text-muted-foreground",
										children: totals.active_count === 1 ? t(":count active subscription", { count: totals.active_count }) : t(":count active subscriptions", { count: totals.active_count })
									})
								]
							}),
							/* @__PURE__ */ jsxs(Card, {
								className: "p-4",
								children: [
									/* @__PURE__ */ jsxs("div", {
										className: "flex items-center gap-2 text-muted-foreground",
										children: [/* @__PURE__ */ jsx(CreditCard, { className: "size-4" }), /* @__PURE__ */ jsx("p", {
											className: "text-xs tracking-wide uppercase",
											children: t("At risk")
										})]
									}),
									/* @__PURE__ */ jsx("p", {
										className: "mt-3 text-3xl font-semibold tracking-tight text-amber-600 dark:text-amber-400",
										children: dollars(totals.at_risk_cents)
									}),
									/* @__PURE__ */ jsx("p", {
										className: "mt-1 text-xs text-muted-foreground",
										children: totals.past_due_count === 1 ? t(":count past-due account", { count: totals.past_due_count }) : t(":count past-due accounts", { count: totals.past_due_count })
									})
								]
							}),
							/* @__PURE__ */ jsxs(Card, {
								className: "p-4",
								children: [
									/* @__PURE__ */ jsx("p", {
										className: "text-xs tracking-wide text-muted-foreground uppercase",
										children: t("Workspaces")
									}),
									/* @__PURE__ */ jsx("p", {
										className: "mt-3 text-3xl font-semibold tracking-tight",
										children: totals.total_workspaces.toLocaleString()
									}),
									/* @__PURE__ */ jsx("p", {
										className: "mt-1 text-xs text-muted-foreground",
										children: t("total signed up")
									})
								]
							}),
							/* @__PURE__ */ jsxs(Card, {
								className: "p-4",
								children: [
									/* @__PURE__ */ jsx("p", {
										className: "text-xs tracking-wide text-muted-foreground uppercase",
										children: t("Paid conversion")
									}),
									/* @__PURE__ */ jsxs("p", {
										className: "mt-3 text-3xl font-semibold tracking-tight",
										children: [conversionRate, "%"]
									}),
									/* @__PURE__ */ jsx("p", {
										className: "mt-1 text-xs text-muted-foreground",
										children: t("active subscriptions / total workspaces")
									})
								]
							})
						]
					}),
					/* @__PURE__ */ jsxs(Card, {
						className: "overflow-hidden p-0",
						children: [/* @__PURE__ */ jsx("div", {
							className: "border-b px-4 py-3",
							children: /* @__PURE__ */ jsx("h2", {
								className: "text-sm font-medium",
								children: t("Plan distribution")
							})
						}), /* @__PURE__ */ jsx("div", {
							className: "overflow-x-auto",
							children: /* @__PURE__ */ jsxs("table", {
								className: "w-full min-w-[780px] border-separate border-spacing-0 text-start text-sm",
								children: [/* @__PURE__ */ jsx("thead", {
									className: "bg-card text-xs font-medium text-muted-foreground",
									children: /* @__PURE__ */ jsxs("tr", { children: [
										/* @__PURE__ */ jsx("th", {
											className: "border-e border-b px-3 py-2",
											children: t("Plan")
										}),
										/* @__PURE__ */ jsx("th", {
											className: "border-e border-b px-3 py-2",
											children: t("Price")
										}),
										/* @__PURE__ */ jsx("th", {
											className: "border-e border-b px-3 py-2",
											children: t("Allowance")
										}),
										/* @__PURE__ */ jsx("th", {
											className: "border-b px-3 py-2 text-end",
											children: t("Subscribers")
										})
									] })
								}), /* @__PURE__ */ jsx("tbody", { children: plans.map((plan) => /* @__PURE__ */ jsxs("tr", {
									className: "group hover:bg-muted/35",
									children: [
										/* @__PURE__ */ jsx("td", {
											className: "border-e border-b px-3 py-2 font-medium text-foreground",
											children: plan.name
										}),
										/* @__PURE__ */ jsx("td", {
											className: "border-e border-b px-3 py-2 text-muted-foreground",
											children: plan.price_cents === 0 ? t("Free") : t(":amount / mo", { amount: dollars(plan.price_cents) })
										}),
										/* @__PURE__ */ jsx("td", {
											className: "border-e border-b px-3 py-2 text-muted-foreground",
											children: plan.monthly_conversations === 0 ? t("Unlimited conversations") : t(":count conversations", { count: plan.monthly_conversations.toLocaleString() })
										}),
										/* @__PURE__ */ jsxs("td", {
											className: "border-b px-3 py-2 text-end",
											children: [
												/* @__PURE__ */ jsx("span", {
													className: "font-medium text-foreground",
													children: plan.subscriber_count
												}),
												" ",
												/* @__PURE__ */ jsx("span", {
													className: "text-xs text-muted-foreground",
													children: plan.subscriber_count === 1 ? t("subscriber") : t("subscribers")
												})
											]
										})
									]
								}, plan.slug)) })]
							})
						})]
					}),
					/* @__PURE__ */ jsxs(Card, {
						className: "overflow-hidden p-0",
						children: [
							/* @__PURE__ */ jsx("div", {
								className: "border-b px-4 py-3",
								children: /* @__PURE__ */ jsx("h2", {
									className: "text-sm font-medium",
									children: t("Workspaces with a plan")
								})
							}),
							/* @__PURE__ */ jsx("div", {
								className: "overflow-x-auto",
								children: /* @__PURE__ */ jsxs("table", {
									className: "w-full min-w-[1080px] border-separate border-spacing-0 text-start text-sm",
									children: [/* @__PURE__ */ jsx("thead", {
										className: "bg-card text-xs font-medium text-muted-foreground",
										children: /* @__PURE__ */ jsxs("tr", { children: [
											/* @__PURE__ */ jsx("th", {
												className: "w-9 border-b px-3 py-2",
												children: /* @__PURE__ */ jsx("input", {
													type: "checkbox",
													"aria-label": t("Select all billed workspaces"),
													disabled: true,
													className: "size-3.5 rounded border-input"
												})
											}),
											/* @__PURE__ */ jsx("th", {
												className: "border-e border-b px-3 py-2",
												children: t("Workspace")
											}),
											/* @__PURE__ */ jsx("th", {
												className: "border-e border-b px-3 py-2",
												children: t("Plan")
											}),
											/* @__PURE__ */ jsx("th", {
												className: "border-e border-b px-3 py-2",
												children: t("$ / mo")
											}),
											/* @__PURE__ */ jsx("th", {
												className: "border-e border-b px-3 py-2",
												children: t("Stripe status")
											}),
											/* @__PURE__ */ jsx("th", {
												className: "border-b px-3 py-2",
												children: t("Joined")
											})
										] })
									}), /* @__PURE__ */ jsx("tbody", { children: workspaces.length === 0 ? /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx("td", {
										colSpan: 6,
										className: "h-72 border-b px-4 text-center",
										children: /* @__PURE__ */ jsxs("div", {
											className: "mx-auto flex max-w-sm flex-col items-center gap-2 text-muted-foreground",
											children: [
												/* @__PURE__ */ jsx(CreditCard, { className: "size-8" }),
												/* @__PURE__ */ jsx("p", {
													className: "text-sm font-medium text-foreground",
													children: t("No billed workspaces yet")
												}),
												/* @__PURE__ */ jsx("p", {
													className: "text-xs",
													children: t("Customers will appear here after they upgrade from billing.")
												})
											]
										})
									}) }) : workspaces.map((workspace) => /* @__PURE__ */ jsxs("tr", {
										className: "group hover:bg-muted/35",
										children: [
											/* @__PURE__ */ jsx("td", {
												className: "border-b px-3 py-2",
												children: /* @__PURE__ */ jsx("input", {
													type: "checkbox",
													"aria-label": t("Select :name", { name: workspace.workspace_name }),
													disabled: true,
													className: "size-3.5 rounded border-input"
												})
											}),
											/* @__PURE__ */ jsx("td", {
												className: "border-e border-b px-3 py-2",
												children: /* @__PURE__ */ jsxs("div", {
													className: "min-w-0",
													children: [/* @__PURE__ */ jsx(Link, {
														href: show$8(workspace.workspace_id),
														className: "block truncate font-medium text-foreground hover:text-primary",
														children: workspace.workspace_name
													}), /* @__PURE__ */ jsx("p", {
														className: "truncate text-xs text-muted-foreground",
														children: workspace.workspace_slug
													})]
												})
											}),
											/* @__PURE__ */ jsx("td", {
												className: "border-e border-b px-3 py-2 text-muted-foreground",
												children: workspace.plan
											}),
											/* @__PURE__ */ jsx("td", {
												className: "border-e border-b px-3 py-2 text-foreground",
												children: workspace.price_cents > 0 ? dollars(workspace.price_cents) : "—"
											}),
											/* @__PURE__ */ jsx("td", {
												className: "border-e border-b px-3 py-2",
												children: /* @__PURE__ */ jsx("span", {
													className: `inline-flex rounded-md border px-2 py-0.5 text-xs font-medium ${STATUS_PILL[workspace.stripe_status] ?? STATUS_PILL.no_subscription}`,
													children: workspace.stripe_status.replace("_", " ")
												})
											}),
											/* @__PURE__ */ jsx("td", {
												className: "border-b px-3 py-2 text-muted-foreground",
												children: relativeTime$8(workspace.created_at, "—")
											})
										]
									}, workspace.workspace_id)) })]
								})
							}),
							/* @__PURE__ */ jsx(TablePagination, {
								pagination,
								only: SUBSCRIPTIONS_ONLY
							})
						]
					})
				]
			})
		})] })]
	});
}
//#endregion
//#region resources/js/components/ui/textarea.tsx
function Textarea({ className, ...props }) {
	return /* @__PURE__ */ jsx("textarea", {
		"data-slot": "textarea",
		className: cn("border-input bg-background placeholder:text-muted-foreground/70 selection:bg-primary selection:text-primary-foreground flex min-h-20 w-full rounded-md border px-3 py-2 text-sm shadow-xs transition-[background-color,border-color,box-shadow] outline-none read-only:bg-muted/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50", "focus-visible:border-ring focus-visible:ring-ring/40 focus-visible:ring-[2px]", "aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive", className),
		...props
	});
}
//#endregion
//#region resources/js/pages/admin/translations/edit.tsx
var edit_exports$1 = /* @__PURE__ */ __exportAll({ default: () => AdminTranslationsEdit });
var FILTERS = [
	{
		key: "all",
		label: "All"
	},
	{
		key: "missing",
		label: "Missing"
	},
	{
		key: "overridden",
		label: "Edited"
	}
];
function AdminTranslationsEdit({ locale, rows, filters, pagination, stats }) {
	const { t } = useT();
	const [search, setSearch] = useState(filters.search);
	const [drafts, setDrafts] = useState({});
	const [savingKey, setSavingKey] = useState(null);
	const firstRender = useRef(true);
	useEffect(() => {
		const next = {};
		for (const row of rows) next[row.key] = row.value;
		setDrafts(next);
	}, [rows]);
	const visit = (params) => {
		router.get(show$7(locale.code).url, params, {
			preserveState: true,
			preserveScroll: true,
			replace: true,
			only: [
				"rows",
				"filters",
				"pagination",
				"stats"
			]
		});
	};
	useEffect(() => {
		if (firstRender.current) {
			firstRender.current = false;
			return;
		}
		const handle = setTimeout(() => {
			visit({
				search,
				filter: filters.filter,
				page: 1
			});
		}, 350);
		return () => clearTimeout(handle);
	}, [search]);
	const save = (row) => {
		const value = drafts[row.key] ?? "";
		if (value.trim() === "") return;
		setSavingKey(row.key);
		router.put(update$15(locale.code).url, {
			key: row.key,
			value
		}, {
			preserveScroll: true,
			preserveState: true,
			only: [
				"rows",
				"filters",
				"pagination",
				"stats",
				"flash"
			],
			onFinish: () => setSavingKey(null)
		});
	};
	const reset = (row) => {
		setSavingKey(row.key);
		router.delete(destroy$20(locale.code).url, {
			data: { key: row.key },
			preserveScroll: true,
			preserveState: true,
			only: [
				"rows",
				"filters",
				"pagination",
				"stats",
				"flash"
			],
			onFinish: () => setSavingKey(null)
		});
	};
	return /* @__PURE__ */ jsxs(AdminLayout, {
		breadcrumbs: [
			{
				title: t("Admin"),
				href: "/admin"
			},
			{
				title: t("Translations"),
				href: index$30()
			},
			{
				title: `${locale.flag} ${locale.native}`,
				href: show$7(locale.code)
			}
		],
		children: [/* @__PURE__ */ jsx(Head, { title: `${locale.native} · ${t("Translations")}` }), /* @__PURE__ */ jsxs(AdminSurface, { children: [
			/* @__PURE__ */ jsxs(AdminSurfaceBar, { children: [
				/* @__PURE__ */ jsxs("span", {
					className: "inline-flex items-center gap-1.5 text-sm font-medium",
					children: [
						/* @__PURE__ */ jsx("span", {
							className: "text-lg",
							"aria-hidden": true,
							children: locale.flag
						}),
						locale.native,
						/* @__PURE__ */ jsx("span", {
							className: "text-xs text-muted-foreground uppercase",
							children: locale.code
						})
					]
				}),
				/* @__PURE__ */ jsx("span", {
					className: "inline-flex h-7 items-center rounded-md border border-amber-200 bg-amber-50 px-2.5 text-xs font-medium text-amber-700 dark:border-amber-500/30 dark:bg-amber-500/10 dark:text-amber-300",
					children: t(":count missing", { count: stats.missing.toLocaleString() })
				}),
				/* @__PURE__ */ jsx("span", {
					className: "inline-flex h-7 items-center rounded-md border border-indigo-200 bg-indigo-50 px-2.5 text-xs font-medium text-indigo-700 dark:border-indigo-500/30 dark:bg-indigo-500/10 dark:text-indigo-300",
					children: t(":count edited", { count: stats.overrides.toLocaleString() })
				}),
				/* @__PURE__ */ jsx("div", {
					className: "ms-auto w-full max-w-xs",
					children: /* @__PURE__ */ jsxs("div", {
						className: "relative",
						children: [/* @__PURE__ */ jsx(Search, { className: "pointer-events-none absolute start-2.5 top-1/2 size-4 -translate-y-1/2 text-muted-foreground" }), /* @__PURE__ */ jsx(Input, {
							value: search,
							onChange: (e) => setSearch(e.target.value),
							placeholder: t("Search strings…"),
							className: "ps-8"
						})]
					})
				})
			] }),
			/* @__PURE__ */ jsx("div", {
				className: "flex items-center gap-1 border-b px-4 py-2",
				children: FILTERS.map((f) => /* @__PURE__ */ jsx("button", {
					type: "button",
					onClick: () => visit({
						search,
						filter: f.key,
						page: 1
					}),
					className: `rounded-md px-2.5 py-1 text-xs font-medium transition ${filters.filter === f.key ? "bg-foreground/10 text-foreground" : "text-muted-foreground hover:bg-foreground/5"}`,
					children: t(f.label)
				}, f.key))
			}),
			/* @__PURE__ */ jsx("div", {
				className: "min-h-0 flex-1 overflow-auto p-4",
				children: rows.length === 0 ? /* @__PURE__ */ jsx("div", {
					className: "rounded-md border bg-card p-12 text-center text-muted-foreground",
					children: /* @__PURE__ */ jsx("p", {
						className: "font-medium",
						children: t("No strings match.")
					})
				}) : /* @__PURE__ */ jsx("div", {
					className: "space-y-3",
					children: rows.map((row) => /* @__PURE__ */ jsxs("div", {
						className: "rounded-lg border bg-card p-3",
						children: [/* @__PURE__ */ jsxs("div", {
							className: "mb-2 flex items-start gap-2",
							children: [
								/* @__PURE__ */ jsx("p", {
									className: "flex-1 text-xs text-muted-foreground",
									children: row.source
								}),
								row.is_missing && /* @__PURE__ */ jsx("span", {
									className: "rounded-md border border-amber-200 bg-amber-50 px-1.5 py-0.5 text-[10px] font-medium text-amber-700 dark:border-amber-500/30 dark:bg-amber-500/10 dark:text-amber-300",
									children: t("Missing")
								}),
								row.is_overridden && /* @__PURE__ */ jsx("span", {
									className: "rounded-md border border-indigo-200 bg-indigo-50 px-1.5 py-0.5 text-[10px] font-medium text-indigo-700 dark:border-indigo-500/30 dark:bg-indigo-500/10 dark:text-indigo-300",
									children: t("Edited")
								})
							]
						}), /* @__PURE__ */ jsxs("div", {
							className: "flex items-end gap-2",
							children: [
								/* @__PURE__ */ jsx(Textarea, {
									dir: locale.rtl ? "rtl" : "ltr",
									rows: 1,
									value: drafts[row.key] ?? "",
									onChange: (e) => setDrafts((d) => ({
										...d,
										[row.key]: e.target.value
									})),
									placeholder: t("Translation in :lang", { lang: locale.native }),
									className: "min-h-9 flex-1 resize-y"
								}),
								/* @__PURE__ */ jsxs(Button, {
									type: "button",
									size: "sm",
									disabled: savingKey === row.key || (drafts[row.key] ?? "") === row.value || (drafts[row.key] ?? "").trim() === "",
									onClick: () => save(row),
									children: [/* @__PURE__ */ jsx(Save, { className: "size-4" }), /* @__PURE__ */ jsx("span", {
										className: "ms-1",
										children: t("Save")
									})]
								}),
								row.is_overridden && /* @__PURE__ */ jsx(Button, {
									type: "button",
									size: "sm",
									variant: "outline",
									disabled: savingKey === row.key,
									onClick: () => reset(row),
									title: t("Reset to the shipped default"),
									children: /* @__PURE__ */ jsx(RotateCcw, { className: "size-4" })
								})
							]
						})]
					}, row.key))
				})
			}),
			/* @__PURE__ */ jsxs("div", {
				className: "flex items-center justify-between border-t px-4 py-2 text-xs text-muted-foreground",
				children: [/* @__PURE__ */ jsx("span", { children: t("Showing :from–:to of :total", {
					from: ((pagination.page - 1) * pagination.per_page + (rows.length > 0 ? 1 : 0)).toLocaleString(),
					to: ((pagination.page - 1) * pagination.per_page + rows.length).toLocaleString(),
					total: pagination.total.toLocaleString()
				}) }), /* @__PURE__ */ jsxs("div", {
					className: "flex items-center gap-1",
					children: [
						/* @__PURE__ */ jsx(Button, {
							type: "button",
							size: "sm",
							variant: "outline",
							disabled: pagination.page <= 1,
							onClick: () => visit({
								search,
								filter: filters.filter,
								page: pagination.page - 1
							}),
							children: /* @__PURE__ */ jsx(ChevronLeft, { className: "size-4" })
						}),
						/* @__PURE__ */ jsx("span", { children: t(":page / :pages", {
							page: pagination.page.toLocaleString(),
							pages: pagination.last_page.toLocaleString()
						}) }),
						/* @__PURE__ */ jsx(Button, {
							type: "button",
							size: "sm",
							variant: "outline",
							disabled: pagination.page >= pagination.last_page,
							onClick: () => visit({
								search,
								filter: filters.filter,
								page: pagination.page + 1
							}),
							children: /* @__PURE__ */ jsx(ChevronRight, { className: "size-4" })
						})
					]
				})]
			})
		] })]
	});
}
//#endregion
//#region resources/js/pages/admin/translations/index.tsx
var translations_exports = /* @__PURE__ */ __exportAll({ default: () => AdminTranslationsIndex });
function AdminTranslationsIndex({ locales, total_keys }) {
	const { t } = useT();
	const [query, setQuery] = useState("");
	const filtered = useMemo(() => {
		const term = query.trim().toLowerCase();
		if (term === "") return locales;
		return locales.filter((l) => l.code.toLowerCase().includes(term) || l.native.toLowerCase().includes(term));
	}, [locales, query]);
	return /* @__PURE__ */ jsxs(AdminLayout, {
		breadcrumbs: [{
			title: t("Admin"),
			href: "/admin"
		}, {
			title: t("Translations"),
			href: index$30()
		}],
		children: [/* @__PURE__ */ jsx(Head, { title: t("Translations · Admin") }), /* @__PURE__ */ jsxs(AdminSurface, { children: [/* @__PURE__ */ jsxs(AdminSurfaceBar, { children: [
			/* @__PURE__ */ jsx("span", {
				className: "inline-flex h-7 items-center rounded-md border bg-card px-2.5 text-xs font-normal",
				children: t(":count languages", { count: locales.length.toLocaleString() })
			}),
			/* @__PURE__ */ jsx("span", {
				className: "inline-flex h-7 items-center rounded-md border bg-card px-2.5 text-xs font-normal",
				children: t(":count keys", { count: total_keys.toLocaleString() })
			}),
			/* @__PURE__ */ jsx("div", {
				className: "ms-auto w-full max-w-xs",
				children: /* @__PURE__ */ jsxs("div", {
					className: "relative",
					children: [/* @__PURE__ */ jsx(Search, { className: "pointer-events-none absolute start-2.5 top-1/2 size-4 -translate-y-1/2 text-muted-foreground" }), /* @__PURE__ */ jsx(Input, {
						value: query,
						onChange: (e) => setQuery(e.target.value),
						placeholder: t("Search languages…"),
						className: "ps-8"
					})]
				})
			})
		] }), /* @__PURE__ */ jsxs("div", {
			className: "min-h-0 flex-1 overflow-auto p-4",
			children: [
				/* @__PURE__ */ jsx("p", {
					className: "mb-4 text-sm text-muted-foreground",
					children: t("Edit the value of any string in any language, or fill in a missing one. Changes are saved as overrides on top of the shipped files and go live immediately — the original files are never touched.")
				}),
				/* @__PURE__ */ jsx("div", {
					className: "grid gap-3 sm:grid-cols-2 lg:grid-cols-3",
					children: filtered.map((l) => {
						const pct = l.total === 0 ? 100 : Math.round(l.translated / l.total * 100);
						return /* @__PURE__ */ jsxs(Link, {
							href: show$7(l.code),
							className: "flex flex-col gap-3 rounded-lg border bg-card p-4 transition hover:border-foreground/30 hover:bg-foreground/5",
							children: [
								/* @__PURE__ */ jsxs("div", {
									className: "flex items-center gap-2",
									children: [
										/* @__PURE__ */ jsx("span", {
											className: "text-xl",
											"aria-hidden": true,
											children: l.flag
										}),
										/* @__PURE__ */ jsx("span", {
											className: "font-medium",
											children: l.native
										}),
										/* @__PURE__ */ jsx("span", {
											className: "text-xs text-muted-foreground uppercase",
											children: l.code
										}),
										l.is_source && /* @__PURE__ */ jsx("span", {
											className: "ms-auto rounded-md border border-sky-200 bg-sky-50 px-1.5 py-0.5 text-[10px] font-medium text-sky-700 dark:border-sky-500/30 dark:bg-sky-500/10 dark:text-sky-300",
											children: t("Source")
										})
									]
								}),
								/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("div", {
									className: "h-1.5 w-full overflow-hidden rounded-full bg-muted",
									children: /* @__PURE__ */ jsx("div", {
										className: pct === 100 ? "h-full rounded-full bg-emerald-500" : "h-full rounded-full bg-amber-500",
										style: { width: `${pct}%` }
									})
								}), /* @__PURE__ */ jsxs("div", {
									className: "mt-1.5 flex items-center justify-between text-xs text-muted-foreground",
									children: [/* @__PURE__ */ jsx("span", { children: t(":done / :total translated", {
										done: l.translated.toLocaleString(),
										total: l.total.toLocaleString()
									}) }), /* @__PURE__ */ jsxs("span", { children: [pct, "%"] })]
								})] }),
								/* @__PURE__ */ jsxs("div", {
									className: "flex gap-2 text-xs",
									children: [l.missing > 0 && /* @__PURE__ */ jsx("span", {
										className: "rounded-md border border-amber-200 bg-amber-50 px-1.5 py-0.5 font-medium text-amber-700 dark:border-amber-500/30 dark:bg-amber-500/10 dark:text-amber-300",
										children: t(":count missing", { count: l.missing.toLocaleString() })
									}), l.overrides > 0 && /* @__PURE__ */ jsx("span", {
										className: "rounded-md border border-indigo-200 bg-indigo-50 px-1.5 py-0.5 font-medium text-indigo-700 dark:border-indigo-500/30 dark:bg-indigo-500/10 dark:text-indigo-300",
										children: t(":count edited", { count: l.overrides.toLocaleString() })
									})]
								})
							]
						}, l.code);
					})
				}),
				filtered.length === 0 && /* @__PURE__ */ jsxs("div", {
					className: "rounded-md border bg-card p-12 text-center text-muted-foreground",
					children: [/* @__PURE__ */ jsx(Languages, { className: "mx-auto size-6" }), /* @__PURE__ */ jsx("p", {
						className: "mt-2 font-medium",
						children: t("No languages match your search.")
					})]
				})
			]
		})] })]
	});
}
//#endregion
//#region resources/js/pages/admin/usage/index.tsx
var usage_exports = /* @__PURE__ */ __exportAll({ default: () => AdminUsage });
function AdminUsage({ rows, tokens = [] }) {
	const { t } = useT();
	return /* @__PURE__ */ jsxs(AdminLayout, {
		breadcrumbs: [{
			title: t("Dashboard"),
			href: dashboard()
		}, {
			title: t("Usage"),
			href: index$27()
		}],
		children: [
			/* @__PURE__ */ jsx(Head, { title: t("Usage · Admin") }),
			/* @__PURE__ */ jsxs(AdminSurface, { children: [/* @__PURE__ */ jsxs(AdminSurfaceBar, { children: [/* @__PURE__ */ jsx("span", {
				className: "inline-flex h-7 items-center rounded-md border bg-card px-2.5 text-xs font-normal text-foreground",
				children: t("Usage this month")
			}), /* @__PURE__ */ jsx("span", {
				className: "inline-flex h-7 items-center rounded-md border bg-card px-2.5 text-xs font-normal text-muted-foreground",
				children: rows.length === 1 ? t(":count workspace", { count: rows.length.toLocaleString() }) : t(":count workspaces", { count: rows.length.toLocaleString() })
			})] }), /* @__PURE__ */ jsx("div", {
				className: "min-h-0 flex-1 overflow-auto",
				children: /* @__PURE__ */ jsxs("table", {
					className: "w-full min-w-[1080px] border-separate border-spacing-0 text-start text-sm",
					children: [/* @__PURE__ */ jsx("thead", {
						className: "sticky top-0 z-10 bg-card text-xs font-medium text-muted-foreground",
						children: /* @__PURE__ */ jsxs("tr", { children: [
							/* @__PURE__ */ jsx("th", {
								className: "w-9 border-b px-3 py-2",
								children: /* @__PURE__ */ jsx("input", {
									type: "checkbox",
									"aria-label": t("Select all usage rows"),
									disabled: true,
									className: "size-3.5 rounded border-input"
								})
							}),
							/* @__PURE__ */ jsx("th", {
								className: "border-e border-b px-3 py-2",
								children: t("Workspace")
							}),
							/* @__PURE__ */ jsx("th", {
								className: "border-e border-b px-3 py-2",
								children: t("Plan")
							}),
							/* @__PURE__ */ jsx("th", {
								className: "border-e border-b px-3 py-2",
								children: t("Usage")
							}),
							/* @__PURE__ */ jsx("th", {
								className: "border-b px-3 py-2",
								children: t("Health")
							})
						] })
					}), /* @__PURE__ */ jsx("tbody", { children: rows.length === 0 ? /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx("td", {
						colSpan: 5,
						className: "h-72 border-b px-4 text-center",
						children: /* @__PURE__ */ jsxs("div", {
							className: "mx-auto flex max-w-sm flex-col items-center gap-2 text-muted-foreground",
							children: [
								/* @__PURE__ */ jsx(Gauge, { className: "size-8" }),
								/* @__PURE__ */ jsx("p", {
									className: "text-sm font-medium text-foreground",
									children: t("No usage recorded")
								}),
								/* @__PURE__ */ jsx("p", {
									className: "text-xs",
									children: t("No workspace usage has been recorded for this month.")
								})
							]
						})
					}) }) : rows.map((row) => /* @__PURE__ */ jsxs("tr", {
						className: "group hover:bg-muted/35",
						children: [
							/* @__PURE__ */ jsx("td", {
								className: "border-b px-3 py-2",
								children: /* @__PURE__ */ jsx("input", {
									type: "checkbox",
									"aria-label": t("Select :name", { name: row.workspace_name }),
									disabled: true,
									className: "size-3.5 rounded border-input"
								})
							}),
							/* @__PURE__ */ jsx("td", {
								className: "border-e border-b px-3 py-2",
								children: /* @__PURE__ */ jsxs("div", {
									className: "flex min-w-0 items-center gap-2 text-foreground",
									children: [/* @__PURE__ */ jsx("span", {
										className: "flex size-5 shrink-0 items-center justify-center rounded bg-muted text-muted-foreground",
										children: /* @__PURE__ */ jsx(BriefcaseBusiness, { className: "size-3.5" })
									}), /* @__PURE__ */ jsx(Link, {
										href: show$8(row.workspace_id),
										className: "block truncate font-medium text-foreground hover:text-primary",
										children: row.workspace_name
									})]
								})
							}),
							/* @__PURE__ */ jsx("td", {
								className: "border-e border-b px-3 py-2 text-muted-foreground",
								children: row.plan
							}),
							/* @__PURE__ */ jsx("td", {
								className: "border-e border-b px-3 py-2",
								children: /* @__PURE__ */ jsxs("div", {
									className: "space-y-2",
									children: [/* @__PURE__ */ jsxs("p", {
										className: "text-sm text-foreground",
										children: [
											row.used.toLocaleString(),
											" ",
											"/",
											" ",
											row.limit > 0 ? row.limit.toLocaleString() : t("Unlimited")
										]
									}), /* @__PURE__ */ jsx("div", {
										className: "h-2 rounded-full bg-muted",
										children: /* @__PURE__ */ jsx("div", {
											className: `h-2 rounded-full ${row.percent >= 90 ? "bg-rose-500" : row.percent >= 70 ? "bg-amber-500" : "bg-emerald-500"}`,
											style: { width: `${Math.min(row.percent, 100)}%` }
										})
									})]
								})
							}),
							/* @__PURE__ */ jsx("td", {
								className: "border-b px-3 py-2",
								children: /* @__PURE__ */ jsxs("span", {
									className: `inline-flex items-center gap-1 rounded-md border px-2 py-0.5 text-xs font-medium ${row.percent >= 90 ? "border-rose-200 bg-rose-50 text-rose-700 dark:border-rose-500/30 dark:bg-rose-500/10 dark:text-rose-300" : row.percent >= 70 ? "border-amber-200 bg-amber-50 text-amber-700 dark:border-amber-500/30 dark:bg-amber-500/10 dark:text-amber-300" : "border-emerald-200 bg-emerald-50 text-emerald-700 dark:border-emerald-500/30 dark:bg-emerald-500/10 dark:text-emerald-300"}`,
									children: [/* @__PURE__ */ jsx(Gauge, { className: "size-3.5" }), row.percent === 0 && row.used > 0 ? "<1%" : `${row.percent}%`]
								})
							})
						]
					}, row.workspace_id)) })]
				})
			})] }),
			/* @__PURE__ */ jsxs(AdminSurface, {
				className: "mt-6",
				children: [/* @__PURE__ */ jsxs(AdminSurfaceBar, { children: [/* @__PURE__ */ jsx("span", {
					className: "inline-flex h-7 items-center rounded-md border bg-card px-2.5 text-xs font-normal text-foreground",
					children: t("Token usage this month")
				}), /* @__PURE__ */ jsx("span", {
					className: "inline-flex h-7 items-center rounded-md border bg-card px-2.5 text-xs font-normal text-muted-foreground",
					children: tokens.length === 1 ? t(":count workspace", { count: tokens.length.toLocaleString() }) : t(":count workspaces", { count: tokens.length.toLocaleString() })
				})] }), /* @__PURE__ */ jsx("div", {
					className: "min-h-0 flex-1 overflow-auto",
					children: /* @__PURE__ */ jsxs("table", {
						className: "w-full min-w-[900px] border-separate border-spacing-0 text-start text-sm",
						children: [/* @__PURE__ */ jsx("thead", {
							className: "sticky top-0 z-10 bg-card text-xs font-medium text-muted-foreground",
							children: /* @__PURE__ */ jsxs("tr", { children: [
								/* @__PURE__ */ jsx("th", {
									className: "border-e border-b px-3 py-2",
									children: t("Workspace")
								}),
								/* @__PURE__ */ jsx("th", {
									className: "border-e border-b px-3 py-2 text-end",
									children: t("Tokens in")
								}),
								/* @__PURE__ */ jsx("th", {
									className: "border-e border-b px-3 py-2 text-end",
									children: t("Tokens out")
								}),
								/* @__PURE__ */ jsx("th", {
									className: "border-e border-b px-3 py-2 text-end",
									children: t("Total")
								}),
								/* @__PURE__ */ jsx("th", {
									className: "border-e border-b px-3 py-2 text-end",
									children: t("Calls")
								}),
								/* @__PURE__ */ jsx("th", {
									className: "border-b px-3 py-2 text-end",
									children: t("Cost (USD)")
								})
							] })
						}), /* @__PURE__ */ jsx("tbody", { children: tokens.length === 0 ? /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx("td", {
							colSpan: 6,
							className: "h-32 border-b px-4 text-center text-muted-foreground",
							children: t("No token usage recorded yet — chat at least once for a row to appear here.")
						}) }) : tokens.map((row) => /* @__PURE__ */ jsxs("tr", {
							className: "hover:bg-muted/35",
							children: [
								/* @__PURE__ */ jsx("td", {
									className: "border-e border-b px-3 py-2 font-medium text-foreground",
									children: row.workspace_name
								}),
								/* @__PURE__ */ jsx("td", {
									className: "border-e border-b px-3 py-2 text-end tabular-nums",
									children: row.tokens_in.toLocaleString()
								}),
								/* @__PURE__ */ jsx("td", {
									className: "border-e border-b px-3 py-2 text-end tabular-nums",
									children: row.tokens_out.toLocaleString()
								}),
								/* @__PURE__ */ jsx("td", {
									className: "border-e border-b px-3 py-2 text-end font-medium tabular-nums",
									children: row.tokens_total.toLocaleString()
								}),
								/* @__PURE__ */ jsx("td", {
									className: "border-e border-b px-3 py-2 text-end text-muted-foreground tabular-nums",
									children: row.calls.toLocaleString()
								}),
								/* @__PURE__ */ jsxs("td", {
									className: "border-b px-3 py-2 text-end tabular-nums",
									children: [/* @__PURE__ */ jsx("span", {
										title: row.breakdown && row.breakdown.length > 0 ? row.breakdown.map((b) => `${b.provider}/${b.model}: $${b.cost_usd.toFixed(6)} (${b.calls} calls, ${b.tokens_in + b.tokens_out} tok)${b.no_catalog_match ? " — no catalog match" : ""}`).join("\n") : void 0,
										children: row.cost_usd >= 1e-4 ? `$${row.cost_usd.toFixed(4)}` : row.cost_usd > 0 ? `$${row.cost_usd.toFixed(6)}` : "$0.0000"
									}), row.cost_missing && /* @__PURE__ */ jsx("span", {
										className: "ms-1 text-[10px] text-amber-700 dark:text-amber-300",
										title: t("Tokens were logged but no cost was priced. Either the model is missing from the catalog, or the LLM stream returned zero tokens. Hover the cost value for the per-model breakdown."),
										children: "⚠"
									})]
								})
							]
						}, row.workspace_id)) })]
					})
				})]
			})
		]
	});
}
//#endregion
//#region resources/js/components/ui/select.tsx
function Select({ ...props }) {
	return /* @__PURE__ */ jsx(SelectPrimitive.Root, {
		"data-slot": "select",
		...props
	});
}
function SelectGroup({ ...props }) {
	return /* @__PURE__ */ jsx(SelectPrimitive.Group, {
		"data-slot": "select-group",
		...props
	});
}
function SelectValue({ ...props }) {
	return /* @__PURE__ */ jsx(SelectPrimitive.Value, {
		"data-slot": "select-value",
		...props
	});
}
function SelectTrigger({ className, size = "default", children, ...props }) {
	return /* @__PURE__ */ jsxs(SelectPrimitive.Trigger, {
		"data-slot": "select-trigger",
		"data-size": size,
		className: cn("border-input bg-background data-[placeholder]:text-muted-foreground/70 [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/40 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive flex w-full items-center justify-between gap-2 rounded-md border px-3 py-1 text-sm whitespace-nowrap shadow-xs transition-[background-color,border-color,box-shadow] outline-none focus-visible:ring-[2px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-8 data-[size=sm]:h-7 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className),
		...props,
		children: [children, /* @__PURE__ */ jsx(SelectPrimitive.Icon, {
			asChild: true,
			children: /* @__PURE__ */ jsx(ChevronDownIcon, { className: "size-4 opacity-50" })
		})]
	});
}
function SelectContent({ className, children, position = "popper", side = "bottom", sideOffset = 4, align = "center", ...props }) {
	return /* @__PURE__ */ jsx(SelectPrimitive.Portal, { children: /* @__PURE__ */ jsxs(SelectPrimitive.Content, {
		"data-slot": "select-content",
		className: cn("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md", position === "popper" && "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1", className),
		position,
		side,
		sideOffset,
		avoidCollisions: false,
		align,
		...props,
		children: [
			/* @__PURE__ */ jsx(SelectScrollUpButton, {}),
			/* @__PURE__ */ jsx(SelectPrimitive.Viewport, {
				className: cn("p-1", position === "popper" && "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),
				children
			}),
			/* @__PURE__ */ jsx(SelectScrollDownButton, {})
		]
	}) });
}
function SelectLabel({ className, ...props }) {
	return /* @__PURE__ */ jsx(SelectPrimitive.Label, {
		"data-slot": "select-label",
		className: cn("text-muted-foreground px-2 py-1.5 text-xs", className),
		...props
	});
}
function SelectItem({ className, children, ...props }) {
	return /* @__PURE__ */ jsxs(SelectPrimitive.Item, {
		"data-slot": "select-item",
		className: cn("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pe-8 ps-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2", className),
		...props,
		children: [/* @__PURE__ */ jsx("span", {
			"data-slot": "select-item-indicator",
			className: "absolute end-2 flex size-3.5 items-center justify-center",
			children: /* @__PURE__ */ jsx(SelectPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx(CheckIcon, { className: "size-4" }) })
		}), /* @__PURE__ */ jsx(SelectPrimitive.ItemText, { children })]
	});
}
function SelectScrollUpButton({ className, ...props }) {
	return /* @__PURE__ */ jsx(SelectPrimitive.ScrollUpButton, {
		"data-slot": "select-scroll-up-button",
		className: cn("flex cursor-default items-center justify-center py-1", className),
		...props,
		children: /* @__PURE__ */ jsx(ChevronUpIcon, { className: "size-4" })
	});
}
function SelectScrollDownButton({ className, ...props }) {
	return /* @__PURE__ */ jsx(SelectPrimitive.ScrollDownButton, {
		"data-slot": "select-scroll-down-button",
		className: cn("flex cursor-default items-center justify-center py-1", className),
		...props,
		children: /* @__PURE__ */ jsx(ChevronDownIcon, { className: "size-4" })
	});
}
//#endregion
//#region resources/js/pages/admin/users/index.tsx
var users_exports = /* @__PURE__ */ __exportAll({ default: () => AdminUsers });
var USERS_ONLY = [
	"users",
	"pagination",
	"filters"
];
function AdminUsers({ users, pagination, filters, byok_globally_enabled, current_user_id }) {
	const { t } = useT();
	const confirm = useConfirm();
	const [editing, setEditing] = useState(null);
	const selection = useBulkSelection();
	const pageIds = users.map((u) => String(u.id));
	const promote = (id, to) => {
		router.patch(updateRole.url(id), { role: to }, { preserveScroll: true });
	};
	const setByok = (id, mode) => {
		router.patch(updateByok.url(id), { mode }, { preserveScroll: true });
	};
	const destroy = async (user) => {
		if (!await confirm({
			title: t("Delete user?"),
			message: user.owned_count > 0 ? t(":email owns :count workspace(s). Delete will fail unless ownership is transferred first. Continue anyway?", {
				email: user.email,
				count: user.owned_count
			}) : t("Delete :email? They lose access to every workspace. Soft-delete preserves the row for audit.", { email: user.email }),
			confirmLabel: t("Delete"),
			danger: true
		})) return;
		router.delete(destroy$23.url(user.id), { preserveScroll: true });
	};
	return /* @__PURE__ */ jsxs(AdminLayout, {
		breadcrumbs: [{
			title: t("Dashboard"),
			href: dashboard()
		}, {
			title: t("Users"),
			href: index$33()
		}],
		children: [
			/* @__PURE__ */ jsx(Head, { title: t("Users · Admin") }),
			/* @__PURE__ */ jsxs(AdminSurface, { children: [
				/* @__PURE__ */ jsxs(AdminSurfaceBar, { children: [
					/* @__PURE__ */ jsx("span", {
						className: "inline-flex h-7 items-center rounded-md border bg-card px-2.5 text-xs font-normal text-foreground",
						children: t("All users")
					}),
					/* @__PURE__ */ jsx("span", {
						className: "inline-flex h-7 items-center rounded-md border bg-card px-2.5 text-xs font-normal text-muted-foreground",
						children: t(":count users", { count: pagination.total.toLocaleString() })
					}),
					/* @__PURE__ */ jsx("span", {
						className: `inline-flex h-7 items-center rounded-md border px-2.5 text-xs font-normal ${byok_globally_enabled ? "border-amber-200 bg-amber-50 text-amber-800 dark:border-amber-500/30 dark:bg-amber-500/10 dark:text-amber-200" : "border-border bg-card text-muted-foreground"}`,
						title: t("When BYOK is on globally, every workspace must supply its own AI keys. Per-user overrides below still apply."),
						children: t("BYOK global: :state", { state: byok_globally_enabled ? t("on") : t("off") })
					}),
					/* @__PURE__ */ jsx("div", {
						className: "ms-auto w-full sm:w-auto",
						children: /* @__PURE__ */ jsx(TableSearch, {
							placeholder: t("Search by name or email..."),
							initialValue: filters.q,
							only: USERS_ONLY
						})
					})
				] }),
				/* @__PURE__ */ jsx("div", {
					className: "min-h-0 flex-1 overflow-auto",
					children: /* @__PURE__ */ jsxs("table", {
						className: "w-full min-w-[1080px] border-separate border-spacing-0 text-start text-sm",
						children: [/* @__PURE__ */ jsx("thead", {
							className: "sticky top-0 z-10 bg-card text-xs font-medium text-muted-foreground",
							children: /* @__PURE__ */ jsxs("tr", { children: [
								/* @__PURE__ */ jsx("th", {
									className: "w-9 border-b px-3 py-2",
									children: /* @__PURE__ */ jsx("input", {
										type: "checkbox",
										"aria-label": t("Select all users"),
										checked: selection.allOnPageSelected(pageIds),
										ref: (el) => {
											if (el) el.indeterminate = !selection.allOnPageSelected(pageIds) && selection.someOnPageSelected(pageIds);
										},
										onChange: () => selection.togglePage(pageIds),
										className: "size-3.5 cursor-pointer rounded border-input"
									})
								}),
								/* @__PURE__ */ jsx("th", {
									className: "border-e border-b px-3 py-2",
									children: t("User")
								}),
								/* @__PURE__ */ jsx("th", {
									className: "border-e border-b px-3 py-2",
									children: t("Role")
								}),
								/* @__PURE__ */ jsx("th", {
									className: "border-e border-b px-3 py-2",
									children: t("Workspace access")
								}),
								/* @__PURE__ */ jsx("th", {
									className: "border-e border-b px-3 py-2",
									children: t("Joined")
								}),
								/* @__PURE__ */ jsx("th", {
									className: "border-e border-b px-3 py-2",
									children: t("BYOK")
								}),
								/* @__PURE__ */ jsx("th", {
									className: "border-b px-3 py-2 text-end",
									children: t("Actions")
								})
							] })
						}), /* @__PURE__ */ jsx("tbody", { children: users.length === 0 ? /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx("td", {
							colSpan: 7,
							className: "h-72 border-b px-4 text-center",
							children: /* @__PURE__ */ jsxs("div", {
								className: "mx-auto flex max-w-sm flex-col items-center gap-2 text-muted-foreground",
								children: [
									/* @__PURE__ */ jsx(UserRound, { className: "size-8" }),
									/* @__PURE__ */ jsx("p", {
										className: "text-sm font-medium text-foreground",
										children: t("No matching users")
									}),
									/* @__PURE__ */ jsx("p", {
										className: "text-xs",
										children: t("No users match the current admin search.")
									})
								]
							})
						}) }) : users.map((user) => /* @__PURE__ */ jsxs("tr", {
							className: "group hover:bg-muted/35",
							children: [
								/* @__PURE__ */ jsx("td", {
									className: "border-b px-3 py-2",
									children: /* @__PURE__ */ jsx("input", {
										type: "checkbox",
										"aria-label": t("Select :email", { email: user.email }),
										checked: selection.isSelected(String(user.id)),
										onChange: (e) => {
											const nativeEvent = e.nativeEvent;
											selection.toggle(String(user.id), {
												shiftKey: nativeEvent?.shiftKey ?? false,
												pageIds
											});
										},
										onClick: (e) => e.stopPropagation(),
										className: "size-3.5 cursor-pointer rounded border-input"
									})
								}),
								/* @__PURE__ */ jsx("td", {
									className: "border-e border-b px-3 py-2",
									children: /* @__PURE__ */ jsxs("div", {
										className: "flex min-w-0 items-center gap-2 text-foreground",
										children: [/* @__PURE__ */ jsx("span", {
											className: "flex size-5 shrink-0 items-center justify-center rounded bg-muted text-muted-foreground",
											children: /* @__PURE__ */ jsx(UserRound, { className: "size-3.5" })
										}), /* @__PURE__ */ jsxs("div", {
											className: "min-w-0",
											children: [/* @__PURE__ */ jsx("p", {
												className: "truncate font-medium",
												children: user.name
											}), /* @__PURE__ */ jsx("p", {
												className: "truncate text-xs text-muted-foreground",
												children: user.email
											})]
										})]
									})
								}),
								/* @__PURE__ */ jsx("td", {
									className: "border-e border-b px-3 py-2",
									children: /* @__PURE__ */ jsxs("span", {
										className: `inline-flex items-center gap-1 rounded-md border px-2 py-0.5 text-xs font-medium ${user.role === "super_admin" ? "border-rose-200 bg-rose-50 text-rose-700 dark:border-rose-500/30 dark:bg-rose-500/10 dark:text-rose-300" : "border-border bg-muted/40 text-muted-foreground"}`,
										children: [user.role === "super_admin" ? /* @__PURE__ */ jsx(Shield, { className: "size-3.5" }) : null, user.role === "super_admin" ? t("super admin") : t("customer")]
									})
								}),
								/* @__PURE__ */ jsxs("td", {
									className: "border-e border-b px-3 py-2 text-muted-foreground",
									children: [/* @__PURE__ */ jsx("p", { children: user.workspaces_count === 1 ? t(":count total workspace", { count: user.workspaces_count.toLocaleString() }) : t(":count total workspaces", { count: user.workspaces_count.toLocaleString() }) }), /* @__PURE__ */ jsx("p", {
										className: "text-xs",
										children: t(":count owned", { count: user.owned_count.toLocaleString() })
									})]
								}),
								/* @__PURE__ */ jsx("td", {
									className: "border-e border-b px-3 py-2 text-muted-foreground",
									children: relativeTime$8(user.created_at, "—")
								}),
								/* @__PURE__ */ jsx("td", {
									className: "border-e border-b px-3 py-2",
									children: /* @__PURE__ */ jsxs(Select, {
										value: user.byok_mode,
										onValueChange: (v) => setByok(user.id, v),
										children: [/* @__PURE__ */ jsx(SelectTrigger, {
											"aria-label": t("BYOK mode for :email", { email: user.email }),
											className: "h-7 w-[148px] text-xs",
											children: /* @__PURE__ */ jsx(SelectValue, {})
										}), /* @__PURE__ */ jsxs(SelectContent, { children: [
											/* @__PURE__ */ jsx(SelectItem, {
												value: "inherit",
												children: t("Inherit global")
											}),
											/* @__PURE__ */ jsx(SelectItem, {
												value: "enabled",
												children: t("Force on")
											}),
											/* @__PURE__ */ jsx(SelectItem, {
												value: "disabled",
												children: t("Force off")
											})
										] })]
									})
								}),
								/* @__PURE__ */ jsx("td", {
									className: "border-b px-3 py-2",
									children: /* @__PURE__ */ jsxs("div", {
										className: "flex justify-end gap-2",
										children: [
											/* @__PURE__ */ jsxs(Button, {
												size: "sm",
												variant: "ghost",
												onClick: () => setEditing(user),
												"aria-label": t("Edit user"),
												children: [/* @__PURE__ */ jsx(Pencil, { className: "size-3.5" }), /* @__PURE__ */ jsx("span", {
													className: "ms-1",
													children: t("Edit")
												})]
											}),
											user.role === "customer" ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Button, {
												size: "sm",
												variant: "outline",
												onClick: () => router.post(start$3.url(user.id)),
												children: t("Impersonate")
											}), /* @__PURE__ */ jsx(Button, {
												size: "sm",
												variant: "ghost",
												onClick: async () => {
													if (!await confirm({
														title: t("Promote user?"),
														message: t("Promote :email to super_admin?", { email: user.email }),
														confirmLabel: t("Promote")
													})) return;
													promote(user.id, "super_admin");
												},
												children: t("Promote")
											})] }) : /* @__PURE__ */ jsx(Button, {
												size: "sm",
												variant: "ghost",
												onClick: async () => {
													if (!await confirm({
														title: t("Demote user?"),
														message: t("Demote :email to customer?", { email: user.email }),
														confirmLabel: t("Demote"),
														danger: true
													})) return;
													promote(user.id, "customer");
												},
												children: t("Demote")
											}),
											user.id !== current_user_id && /* @__PURE__ */ jsxs(Button, {
												size: "sm",
												variant: "ghost",
												className: "text-destructive hover:bg-destructive/10 hover:text-destructive",
												onClick: () => destroy(user),
												"aria-label": t("Delete user"),
												children: [/* @__PURE__ */ jsx(Trash2, { className: "size-3.5" }), /* @__PURE__ */ jsx("span", {
													className: "ms-1",
													children: t("Delete")
												})]
											})
										]
									})
								})
							]
						}, user.id)) })]
					})
				}),
				/* @__PURE__ */ jsx(TablePagination, {
					pagination,
					only: USERS_ONLY
				})
			] }),
			editing !== null && /* @__PURE__ */ jsx(EditUserDialog, {
				user: editing,
				onClose: () => setEditing(null)
			}),
			/* @__PURE__ */ jsx(BulkActionsBar, {
				count: selection.size,
				onClear: selection.clear,
				noun: t("user"),
				children: /* @__PURE__ */ jsx(BulkDeleteButton, {
					confirmMessage: t("Delete :count selected user(s)? The action skips: your own account, the last super_admin, and anyone who still owns workspaces (transfer ownership first).", { count: selection.size }),
					onConfirm: () => {
						router.post("/admin/users/bulk-destroy", { ids: Array.from(selection.selected).map((id) => Number(id)) }, {
							preserveScroll: true,
							onSuccess: () => selection.clear()
						});
					}
				})
			})
		]
	});
}
function EditUserDialog({ user, onClose }) {
	const { t } = useT();
	const form = useForm({
		name: user.name,
		email: user.email
	});
	return /* @__PURE__ */ jsx(Dialog, {
		open: true,
		onOpenChange: (open) => {
			if (!open) onClose();
		},
		children: /* @__PURE__ */ jsxs(DialogContent, { children: [/* @__PURE__ */ jsx(DialogHeader, { children: /* @__PURE__ */ jsx(DialogTitle, { children: t("Edit user") }) }), /* @__PURE__ */ jsxs("form", {
			onSubmit: (e) => {
				e.preventDefault();
				form.patch(`/admin/users/${user.id}`, {
					preserveScroll: true,
					onSuccess: onClose
				});
			},
			className: "grid gap-3",
			children: [
				/* @__PURE__ */ jsxs("div", {
					className: "grid gap-1.5",
					children: [
						/* @__PURE__ */ jsx(Label, {
							htmlFor: "edit-name",
							children: t("Name")
						}),
						/* @__PURE__ */ jsx(Input, {
							id: "edit-name",
							value: form.data.name,
							onChange: (e) => form.setData("name", e.target.value),
							required: true
						}),
						form.errors.name && /* @__PURE__ */ jsx("p", {
							className: "text-xs text-destructive",
							children: form.errors.name
						})
					]
				}),
				/* @__PURE__ */ jsxs("div", {
					className: "grid gap-1.5",
					children: [
						/* @__PURE__ */ jsx(Label, {
							htmlFor: "edit-email",
							children: t("Email")
						}),
						/* @__PURE__ */ jsx(Input, {
							id: "edit-email",
							type: "email",
							value: form.data.email,
							onChange: (e) => form.setData("email", e.target.value),
							required: true
						}),
						form.errors.email && /* @__PURE__ */ jsx("p", {
							className: "text-xs text-destructive",
							children: form.errors.email
						})
					]
				}),
				/* @__PURE__ */ jsxs(DialogFooter, { children: [/* @__PURE__ */ jsx(Button, {
					type: "button",
					variant: "outline",
					onClick: onClose,
					children: t("Cancel")
				}), /* @__PURE__ */ jsx(Button, {
					type: "submit",
					disabled: form.processing,
					children: form.processing ? t("Saving…") : t("Save")
				})] })
			]
		})] })
	});
}
//#endregion
//#region resources/js/pages/admin/widget-monitor.tsx
var widget_monitor_exports = /* @__PURE__ */ __exportAll({ default: () => WidgetMonitor });
var BASE_PATH = "/settings/system/widget-monitor";
var TYPE_LABEL = {
	provider_down: "Provider down",
	stream_failed: "Stream failed",
	provider_failover: "Failover",
	client_stalled: "Client freeze",
	tool_loop_timeout: "Tool-loop timeout",
	retrieval_failed: "Retrieval failed"
};
function severityTone(severity) {
	if (severity === "error") return "bg-red-100 text-red-700 dark:bg-red-950 dark:text-red-300";
	if (severity === "warning") return "bg-amber-100 text-amber-700 dark:bg-amber-950 dark:text-amber-300";
	return "bg-muted text-muted-foreground";
}
function WidgetMonitor({ events, summary, verdict, types, filters }) {
	const { t } = useT();
	const breadcrumbs = [{
		title: t("Settings"),
		href: "/settings/system"
	}, {
		title: t("Widget Monitor"),
		href: BASE_PATH
	}];
	const applyFilter = (key, value) => {
		router.get(BASE_PATH, {
			...filters,
			[key]: value
		}, {
			preserveScroll: true,
			preserveState: false
		});
	};
	const toggleResolve = (id) => {
		router.post(`${BASE_PATH}/${id}/resolve`, {}, { preserveScroll: true });
	};
	const typeLabel = (type) => t(TYPE_LABEL[type] ?? type);
	const verdictTone = summary.down_last_hour > 0 || (summary.by_type.stream_failed ?? 0) > 0 ? "border-l-red-500" : summary.open > 0 ? "border-l-amber-500" : "border-l-emerald-500";
	const summaryCards = [
		{
			label: t("Open"),
			value: summary.open,
			tone: summary.open > 0 ? "text-amber-600 dark:text-amber-400" : "text-muted-foreground"
		},
		{
			label: t("Provider down"),
			value: summary.by_type.provider_down ?? 0,
			tone: (summary.by_type.provider_down ?? 0) > 0 ? "text-red-600 dark:text-red-400" : "text-muted-foreground"
		},
		{
			label: t("Stream failed"),
			value: summary.by_type.stream_failed ?? 0,
			tone: (summary.by_type.stream_failed ?? 0) > 0 ? "text-red-600 dark:text-red-400" : "text-muted-foreground"
		},
		{
			label: t("Failover"),
			value: summary.by_type.provider_failover ?? 0,
			tone: "text-muted-foreground"
		},
		{
			label: t("Client freeze"),
			value: summary.by_type.client_stalled ?? 0,
			tone: (summary.by_type.client_stalled ?? 0) > 0 ? "text-amber-600 dark:text-amber-400" : "text-muted-foreground"
		},
		{
			label: t("Total (24h)"),
			value: summary.total_24h,
			tone: "text-foreground"
		}
	];
	return /* @__PURE__ */ jsxs(AppLayout, {
		breadcrumbs,
		children: [/* @__PURE__ */ jsx(Head, { title: t("Widget Monitor") }), /* @__PURE__ */ jsxs("div", {
			className: "mx-auto w-full max-w-6xl space-y-5 p-4 sm:p-6",
			children: [
				/* @__PURE__ */ jsxs("div", {
					className: "flex flex-wrap items-start justify-between gap-3",
					children: [/* @__PURE__ */ jsxs("div", {
						className: "flex items-center gap-3",
						children: [/* @__PURE__ */ jsx("div", {
							className: "rounded-md border bg-muted/30 p-2",
							children: summary.down_last_hour > 0 ? /* @__PURE__ */ jsx(ShieldAlert, { className: "size-5 text-red-500" }) : /* @__PURE__ */ jsx(ShieldCheck, { className: "size-5 text-muted-foreground" })
						}), /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("h1", {
							className: "text-2xl font-semibold",
							children: t("Widget Monitor")
						}), /* @__PURE__ */ jsx("p", {
							className: "text-sm text-muted-foreground",
							children: t("Errors, provider outages and visitor-reported freezes from the live chat widget. Track them here and mark each one resolved as you fix it.")
						})] })]
					}), /* @__PURE__ */ jsxs(Button, {
						variant: "outline",
						size: "sm",
						onClick: () => router.reload(),
						children: [/* @__PURE__ */ jsx(RefreshCw, { className: "me-1.5 size-4" }), t("Refresh")]
					})]
				}),
				/* @__PURE__ */ jsx(Card, {
					className: cn("border-l-4 p-4", verdictTone),
					children: /* @__PURE__ */ jsxs("div", {
						className: "flex items-start gap-2",
						children: [/* @__PURE__ */ jsx(Activity, { className: "mt-0.5 size-4 shrink-0 text-primary" }), /* @__PURE__ */ jsx("p", {
							className: "text-sm",
							children: verdict
						})]
					})
				}),
				/* @__PURE__ */ jsx("div", {
					className: "grid grid-cols-2 gap-3 sm:grid-cols-3 lg:grid-cols-6",
					children: summaryCards.map((card) => /* @__PURE__ */ jsxs(Card, {
						className: "p-3",
						children: [/* @__PURE__ */ jsx("p", {
							className: "text-[10px] font-medium tracking-wide text-muted-foreground uppercase",
							children: card.label
						}), /* @__PURE__ */ jsx("p", {
							className: cn("mt-1 text-2xl font-semibold tabular-nums", card.tone),
							children: card.value
						})]
					}, card.label))
				}),
				/* @__PURE__ */ jsxs("div", {
					className: "flex flex-wrap items-center gap-2",
					children: [
						/* @__PURE__ */ jsx(FilterSelect, {
							label: t("Window"),
							value: filters.window,
							onChange: (v) => applyFilter("window", v),
							options: [
								{
									value: "24h",
									label: t("Last 24h")
								},
								{
									value: "7d",
									label: t("Last 7 days")
								},
								{
									value: "30d",
									label: t("Last 30 days")
								}
							]
						}),
						/* @__PURE__ */ jsx(FilterSelect, {
							label: t("Type"),
							value: filters.type,
							onChange: (v) => applyFilter("type", v),
							options: [{
								value: "",
								label: t("All types")
							}, ...types.map((type) => ({
								value: type,
								label: typeLabel(type)
							}))]
						}),
						/* @__PURE__ */ jsx(FilterSelect, {
							label: t("Severity"),
							value: filters.severity,
							onChange: (v) => applyFilter("severity", v),
							options: [
								{
									value: "",
									label: t("All")
								},
								{
									value: "error",
									label: t("Error")
								},
								{
									value: "warning",
									label: t("Warning")
								}
							]
						}),
						/* @__PURE__ */ jsx(FilterSelect, {
							label: t("Status"),
							value: filters.status,
							onChange: (v) => applyFilter("status", v),
							options: [
								{
									value: "all",
									label: t("All")
								},
								{
									value: "open",
									label: t("Open")
								},
								{
									value: "resolved",
									label: t("Resolved")
								}
							]
						})
					]
				}),
				/* @__PURE__ */ jsx(Card, {
					className: "p-0",
					children: events.length === 0 ? /* @__PURE__ */ jsxs("div", {
						className: "flex flex-col items-center gap-2 p-10 text-center text-muted-foreground",
						children: [/* @__PURE__ */ jsx(ShieldCheck, { className: "size-8 opacity-40" }), /* @__PURE__ */ jsx("p", {
							className: "text-sm",
							children: t("No events match these filters. A quiet monitor is a healthy widget.")
						})]
					}) : /* @__PURE__ */ jsx("div", {
						className: "overflow-x-auto",
						children: /* @__PURE__ */ jsxs("table", {
							className: "w-full text-sm",
							children: [/* @__PURE__ */ jsx("thead", {
								className: "bg-muted/40 text-xs text-muted-foreground",
								children: /* @__PURE__ */ jsxs("tr", { children: [
									/* @__PURE__ */ jsx("th", {
										className: "px-3 py-2 text-left font-medium",
										children: t("When")
									}),
									/* @__PURE__ */ jsx("th", {
										className: "px-3 py-2 text-left font-medium",
										children: t("Type")
									}),
									/* @__PURE__ */ jsx("th", {
										className: "px-3 py-2 text-left font-medium",
										children: t("Provider")
									}),
									/* @__PURE__ */ jsx("th", {
										className: "px-3 py-2 text-left font-medium",
										children: t("Detail")
									}),
									/* @__PURE__ */ jsx("th", {
										className: "px-3 py-2 text-right font-medium",
										children: t("Action")
									})
								] })
							}), /* @__PURE__ */ jsx("tbody", { children: events.map((event) => /* @__PURE__ */ jsxs("tr", {
								className: cn("border-t hover:bg-muted/30", event.resolved_at !== null && "opacity-50"),
								children: [
									/* @__PURE__ */ jsx("td", {
										className: "px-3 py-2 text-xs whitespace-nowrap text-muted-foreground",
										children: event.occurred_at ? new Date(event.occurred_at).toLocaleString() : "—"
									}),
									/* @__PURE__ */ jsx("td", {
										className: "px-3 py-2",
										children: /* @__PURE__ */ jsx("span", {
											className: cn("rounded px-1.5 py-0.5 text-[11px] font-medium", severityTone(event.severity)),
											children: typeLabel(event.type)
										})
									}),
									/* @__PURE__ */ jsx("td", {
										className: "px-3 py-2 text-xs text-muted-foreground",
										children: event.provider ?? "—"
									}),
									/* @__PURE__ */ jsxs("td", {
										className: "px-3 py-2 text-[12px] text-muted-foreground",
										children: [/* @__PURE__ */ jsx("span", {
											className: "line-clamp-2",
											children: event.message ?? "—"
										}), event.context?.exception ? /* @__PURE__ */ jsx("span", {
											className: "mt-0.5 block font-mono text-[10px] text-muted-foreground/70",
											children: String(event.context.exception)
										}) : null]
									}),
									/* @__PURE__ */ jsx("td", {
										className: "px-3 py-2 text-right",
										children: /* @__PURE__ */ jsx(Button, {
											variant: "ghost",
											size: "sm",
											onClick: () => toggleResolve(event.id),
											children: event.resolved_at !== null ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(RotateCcw, { className: "me-1.5 size-3.5" }), t("Reopen")] }) : /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(ShieldCheck, { className: "me-1.5 size-3.5" }), t("Resolve")] })
										})
									})
								]
							}, event.id)) })]
						})
					})
				}),
				/* @__PURE__ */ jsx("p", {
					className: "text-[11px] text-muted-foreground",
					children: t("Events are recorded off the visitor hot path — capturing a failure never slows a working chat. Showing the most recent :count.", { count: events.length })
				})
			]
		})]
	});
}
function FilterSelect({ label, value, onChange, options }) {
	return /* @__PURE__ */ jsxs("label", {
		className: "flex items-center gap-1.5 text-xs text-muted-foreground",
		children: [/* @__PURE__ */ jsx("span", { children: label }), /* @__PURE__ */ jsx("select", {
			value,
			onChange: (e) => onChange(e.target.value),
			className: "rounded-md border bg-background px-2 py-1 text-xs text-foreground",
			children: options.map((option) => /* @__PURE__ */ jsx("option", {
				value: option.value,
				children: option.label
			}, option.value))
		})]
	});
}
//#endregion
//#region resources/js/pages/admin/workspaces/index.tsx
var workspaces_exports = /* @__PURE__ */ __exportAll({ default: () => AdminWorkspaces });
var WORKSPACES_ONLY = [
	"workspaces",
	"pagination",
	"filters"
];
function AdminWorkspaces({ workspaces, pagination, filters }) {
	const { t } = useT();
	const selection = useBulkSelection();
	const pageIds = workspaces.map((w) => w.id);
	return /* @__PURE__ */ jsxs(AdminLayout, {
		breadcrumbs: [{
			title: t("Dashboard"),
			href: dashboard()
		}, {
			title: t("Workspaces"),
			href: index$34()
		}],
		children: [
			/* @__PURE__ */ jsx(Head, { title: t("Workspaces · Admin") }),
			/* @__PURE__ */ jsxs(AdminSurface, { children: [
				/* @__PURE__ */ jsxs(AdminSurfaceBar, { children: [
					/* @__PURE__ */ jsx("span", {
						className: "inline-flex h-7 items-center rounded-md border bg-card px-2.5 text-xs font-normal text-foreground",
						children: t("All workspaces")
					}),
					/* @__PURE__ */ jsx("span", {
						className: "inline-flex h-7 items-center rounded-md border bg-card px-2.5 text-xs font-normal text-muted-foreground",
						children: t(":count workspaces", { count: pagination.total.toLocaleString() })
					}),
					/* @__PURE__ */ jsx("div", {
						className: "ms-auto w-full sm:w-auto",
						children: /* @__PURE__ */ jsx(TableSearch, {
							placeholder: t("Search by name, slug, or owner..."),
							initialValue: filters.q,
							only: WORKSPACES_ONLY
						})
					})
				] }),
				/* @__PURE__ */ jsx("div", {
					className: "min-h-0 flex-1 overflow-auto",
					children: /* @__PURE__ */ jsxs("table", {
						className: "w-full min-w-[1080px] border-separate border-spacing-0 text-start text-sm",
						children: [/* @__PURE__ */ jsx("thead", {
							className: "sticky top-0 z-10 bg-card text-xs font-medium text-muted-foreground",
							children: /* @__PURE__ */ jsxs("tr", { children: [
								/* @__PURE__ */ jsx("th", {
									className: "w-9 border-b px-3 py-2",
									children: /* @__PURE__ */ jsx("input", {
										type: "checkbox",
										"aria-label": t("Select all workspaces"),
										checked: selection.allOnPageSelected(pageIds),
										ref: (el) => {
											if (el) el.indeterminate = !selection.allOnPageSelected(pageIds) && selection.someOnPageSelected(pageIds);
										},
										onChange: () => selection.togglePage(pageIds),
										className: "size-3.5 cursor-pointer rounded border-input"
									})
								}),
								/* @__PURE__ */ jsx("th", {
									className: "border-e border-b px-3 py-2",
									children: t("Workspace")
								}),
								/* @__PURE__ */ jsx("th", {
									className: "border-e border-b px-3 py-2",
									children: t("Owner")
								}),
								/* @__PURE__ */ jsx("th", {
									className: "border-e border-b px-3 py-2",
									children: t("Plan")
								}),
								/* @__PURE__ */ jsx("th", {
									className: "border-e border-b px-3 py-2",
									children: t("Footprint")
								}),
								/* @__PURE__ */ jsx("th", {
									className: "border-b px-3 py-2",
									children: t("Created")
								})
							] })
						}), /* @__PURE__ */ jsx("tbody", { children: workspaces.length === 0 ? /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx("td", {
							colSpan: 6,
							className: "h-72 border-b px-4 text-center",
							children: /* @__PURE__ */ jsxs("div", {
								className: "mx-auto flex max-w-sm flex-col items-center gap-2 text-muted-foreground",
								children: [
									/* @__PURE__ */ jsx(BriefcaseBusiness, { className: "size-8" }),
									/* @__PURE__ */ jsx("p", {
										className: "text-sm font-medium text-foreground",
										children: t("No matching workspaces")
									}),
									/* @__PURE__ */ jsx("p", {
										className: "text-xs",
										children: t("No workspaces match the current admin search.")
									})
								]
							})
						}) }) : workspaces.map((workspace) => /* @__PURE__ */ jsxs("tr", {
							className: "group hover:bg-muted/35",
							children: [
								/* @__PURE__ */ jsx("td", {
									className: "border-b px-3 py-2",
									children: /* @__PURE__ */ jsx("input", {
										type: "checkbox",
										"aria-label": t("Select :name", { name: workspace.name }),
										checked: selection.isSelected(workspace.id),
										onChange: (e) => {
											const nativeEvent = e.nativeEvent;
											selection.toggle(workspace.id, {
												shiftKey: nativeEvent?.shiftKey ?? false,
												pageIds
											});
										},
										onClick: (e) => e.stopPropagation(),
										className: "size-3.5 cursor-pointer rounded border-input"
									})
								}),
								/* @__PURE__ */ jsx("td", {
									className: "border-e border-b px-3 py-2",
									children: /* @__PURE__ */ jsxs("div", {
										className: "flex min-w-0 items-center gap-2 text-foreground",
										children: [/* @__PURE__ */ jsx("span", {
											className: "flex size-5 shrink-0 items-center justify-center rounded bg-muted text-muted-foreground",
											children: /* @__PURE__ */ jsx(BriefcaseBusiness, { className: "size-3.5" })
										}), /* @__PURE__ */ jsxs("div", {
											className: "min-w-0",
											children: [/* @__PURE__ */ jsx(Link, {
												href: show$8(workspace.id),
												className: "block truncate font-medium text-foreground hover:text-primary",
												children: workspace.name
											}), /* @__PURE__ */ jsx("p", {
												className: "truncate text-xs text-muted-foreground",
												children: workspace.slug
											})]
										})]
									})
								}),
								/* @__PURE__ */ jsx("td", {
									className: "border-e border-b px-3 py-2",
									children: workspace.owner ? /* @__PURE__ */ jsxs("div", {
										className: "min-w-0",
										children: [/* @__PURE__ */ jsx("p", {
											className: "truncate font-medium text-foreground",
											children: workspace.owner.name
										}), /* @__PURE__ */ jsx("p", {
											className: "truncate text-xs text-muted-foreground",
											children: workspace.owner.email
										})]
									}) : /* @__PURE__ */ jsx("span", {
										className: "text-muted-foreground",
										children: "—"
									})
								}),
								/* @__PURE__ */ jsx("td", {
									className: "border-e border-b px-3 py-2 text-muted-foreground",
									children: workspace.plan?.name ?? t("No plan")
								}),
								/* @__PURE__ */ jsxs("td", {
									className: "border-e border-b px-3 py-2 text-muted-foreground",
									children: [/* @__PURE__ */ jsx("p", { children: workspace.agents_count === 1 ? t(":count agent", { count: workspace.agents_count.toLocaleString() }) : t(":count agents", { count: workspace.agents_count.toLocaleString() }) }), /* @__PURE__ */ jsx("p", {
										className: "text-xs",
										children: workspace.members_count === 1 ? t(":count member", { count: workspace.members_count.toLocaleString() }) : t(":count members", { count: workspace.members_count.toLocaleString() })
									})]
								}),
								/* @__PURE__ */ jsx("td", {
									className: "border-b px-3 py-2 text-muted-foreground",
									children: relativeTime$8(workspace.created_at, "—")
								})
							]
						}, workspace.id)) })]
					})
				}),
				/* @__PURE__ */ jsx(TablePagination, {
					pagination,
					only: WORKSPACES_ONLY
				})
			] }),
			/* @__PURE__ */ jsx(BulkActionsBar, {
				count: selection.size,
				onClear: selection.clear,
				noun: t("workspace"),
				children: /* @__PURE__ */ jsx(BulkDeleteButton, {
					confirmMessage: t("Soft-delete :count selected workspace(s)? Their agents, conversations, and leads are preserved but hidden from normal queries. Cannot delete the workspace you are currently signed into.", { count: selection.size }),
					onConfirm: () => {
						router.post("/admin/workspaces/bulk-destroy", { ids: Array.from(selection.selected) }, {
							preserveScroll: true,
							onSuccess: () => selection.clear()
						});
					}
				})
			})
		]
	});
}
//#endregion
//#region resources/js/pages/admin/workspaces/show.tsx
var show_exports$4 = /* @__PURE__ */ __exportAll({ default: () => AdminWorkspaceShow });
function AdminWorkspaceShow({ workspace, agents, metrics }) {
	const { t } = useT();
	const owner = workspace.owner;
	return /* @__PURE__ */ jsxs(AdminLayout, {
		breadcrumbs: [
			{
				title: t("Dashboard"),
				href: dashboard()
			},
			{
				title: t("Workspaces"),
				href: index$34()
			},
			{
				title: workspace.name,
				href: show$8(workspace.id)
			}
		],
		children: [/* @__PURE__ */ jsx(Head, { title: t(":name · Admin", { name: workspace.name }) }), /* @__PURE__ */ jsxs(AdminSurface, { children: [/* @__PURE__ */ jsxs(AdminSurfaceBar, { children: [/* @__PURE__ */ jsx(AdminSurfaceTitle, {
			title: workspace.name,
			subtitle: `${workspace.slug} · ${workspace.owner?.email ?? t("No owner assigned")} · ${workspace.plan?.name ?? t("No plan selected")}`,
			meta: /* @__PURE__ */ jsx("span", {
				className: "inline-flex items-center rounded-full border bg-background px-2 py-0.5 text-[11px] font-medium text-muted-foreground",
				children: t("Workspace detail")
			})
		}), owner && /* @__PURE__ */ jsx(Button, {
			size: "sm",
			onClick: () => router.post(start$3.url(owner.id)),
			children: t("Impersonate owner")
		})] }), /* @__PURE__ */ jsx("div", {
			className: "min-h-0 flex-1 overflow-y-auto p-3 sm:p-4",
			children: /* @__PURE__ */ jsxs("div", {
				className: "grid gap-4 lg:grid-cols-[1.3fr_0.9fr]",
				children: [/* @__PURE__ */ jsxs("div", {
					className: "grid gap-4",
					children: [/* @__PURE__ */ jsxs("div", {
						className: "grid gap-3 sm:grid-cols-3",
						children: [
							/* @__PURE__ */ jsxs(Card, {
								className: "p-4",
								children: [/* @__PURE__ */ jsxs("div", {
									className: "flex items-center gap-2 text-muted-foreground",
									children: [/* @__PURE__ */ jsx(Bot, { className: "size-4" }), /* @__PURE__ */ jsx("p", {
										className: "text-xs tracking-wide uppercase",
										children: t("Agents")
									})]
								}), /* @__PURE__ */ jsx("p", {
									className: "mt-3 text-3xl font-semibold tracking-tight tabular-nums",
									children: agents.length.toLocaleString()
								})]
							}),
							/* @__PURE__ */ jsxs(Card, {
								className: "p-4",
								children: [/* @__PURE__ */ jsxs("div", {
									className: "flex items-center gap-2 text-muted-foreground",
									children: [/* @__PURE__ */ jsx(MessageSquare, { className: "size-4" }), /* @__PURE__ */ jsx("p", {
										className: "text-xs tracking-wide uppercase",
										children: t("Conversations")
									})]
								}), /* @__PURE__ */ jsx("p", {
									className: "mt-3 text-3xl font-semibold tracking-tight tabular-nums",
									children: metrics.conversations.toLocaleString()
								})]
							}),
							/* @__PURE__ */ jsxs(Card, {
								className: "p-4",
								children: [/* @__PURE__ */ jsxs("div", {
									className: "flex items-center gap-2 text-muted-foreground",
									children: [/* @__PURE__ */ jsx(Sparkles, { className: "size-4" }), /* @__PURE__ */ jsx("p", {
										className: "text-xs tracking-wide uppercase",
										children: t("Leads")
									})]
								}), /* @__PURE__ */ jsx("p", {
									className: "mt-3 text-3xl font-semibold tracking-tight tabular-nums",
									children: metrics.leads.toLocaleString()
								})]
							})
						]
					}), /* @__PURE__ */ jsxs(Card, {
						className: "overflow-hidden p-0",
						children: [/* @__PURE__ */ jsx("div", {
							className: "border-b px-4 py-3",
							children: /* @__PURE__ */ jsx("h2", {
								className: "text-sm font-medium",
								children: t("Agents on this workspace")
							})
						}), agents.length === 0 ? /* @__PURE__ */ jsx("p", {
							className: "px-4 py-8 text-sm text-muted-foreground",
							children: t("No agents have been created for this workspace yet.")
						}) : /* @__PURE__ */ jsx("div", {
							className: "overflow-x-auto",
							children: /* @__PURE__ */ jsxs("table", {
								className: "w-full min-w-[720px] border-separate border-spacing-0 text-start text-sm",
								children: [/* @__PURE__ */ jsx("thead", {
									className: "bg-card text-xs font-medium text-muted-foreground",
									children: /* @__PURE__ */ jsxs("tr", { children: [
										/* @__PURE__ */ jsx("th", {
											className: "w-9 border-b px-3 py-2",
											children: /* @__PURE__ */ jsx("input", {
												type: "checkbox",
												"aria-label": t("Select all workspace agents"),
												disabled: true,
												className: "size-3.5 rounded border-input"
											})
										}),
										/* @__PURE__ */ jsx("th", {
											className: "border-e border-b px-3 py-2",
											children: t("Agent")
										}),
										/* @__PURE__ */ jsx("th", {
											className: "border-e border-b px-3 py-2",
											children: t("Language")
										}),
										/* @__PURE__ */ jsx("th", {
											className: "border-e border-b px-3 py-2",
											children: t("Status")
										}),
										/* @__PURE__ */ jsx("th", {
											className: "border-b px-3 py-2",
											children: t("Created")
										})
									] })
								}), /* @__PURE__ */ jsx("tbody", { children: agents.map((agent) => /* @__PURE__ */ jsxs("tr", {
									className: "group hover:bg-muted/35",
									children: [
										/* @__PURE__ */ jsx("td", {
											className: "border-b px-3 py-2",
											children: /* @__PURE__ */ jsx("input", {
												type: "checkbox",
												"aria-label": t("Select :name", { name: agent.name }),
												disabled: true,
												className: "size-3.5 rounded border-input"
											})
										}),
										/* @__PURE__ */ jsx("td", {
											className: "border-e border-b px-3 py-2",
											children: /* @__PURE__ */ jsxs("div", {
												className: "flex min-w-0 items-center gap-2 text-foreground",
												children: [/* @__PURE__ */ jsx("span", {
													className: "flex size-5 shrink-0 items-center justify-center rounded bg-muted text-muted-foreground",
													children: /* @__PURE__ */ jsx(Bot, { className: "size-3.5" })
												}), /* @__PURE__ */ jsx("span", {
													className: "truncate font-medium",
													children: agent.name
												})]
											})
										}),
										/* @__PURE__ */ jsx("td", {
											className: "border-e border-b px-3 py-2 text-muted-foreground uppercase",
											children: agent.language_default
										}),
										/* @__PURE__ */ jsx("td", {
											className: "border-e border-b px-3 py-2",
											children: /* @__PURE__ */ jsx("span", {
												className: `inline-flex rounded-md border px-2 py-0.5 text-xs font-medium ${agent.is_published ? "border-emerald-200 bg-emerald-50 text-emerald-700 dark:border-emerald-500/30 dark:bg-emerald-500/10 dark:text-emerald-300" : "border-amber-200 bg-amber-50 text-amber-700 dark:border-amber-500/30 dark:bg-amber-500/10 dark:text-amber-300"}`,
												children: agent.is_published ? t("Published") : t("Draft")
											})
										}),
										/* @__PURE__ */ jsx("td", {
											className: "border-b px-3 py-2 text-muted-foreground",
											children: relativeTime$8(agent.created_at, "—")
										})
									]
								}, agent.id)) })]
							})
						})]
					})]
				}), /* @__PURE__ */ jsxs("div", {
					className: "grid gap-4",
					children: [/* @__PURE__ */ jsxs(Card, {
						className: "p-4",
						children: [/* @__PURE__ */ jsxs("div", {
							className: "flex items-center gap-2 text-muted-foreground",
							children: [/* @__PURE__ */ jsx(BriefcaseBusiness, { className: "size-4" }), /* @__PURE__ */ jsx("h2", {
								className: "text-sm font-medium text-foreground",
								children: t("Workspace profile")
							})]
						}), /* @__PURE__ */ jsxs("dl", {
							className: "mt-4 grid gap-3 text-sm",
							children: [
								/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", {
									className: "text-xs tracking-wide text-muted-foreground uppercase",
									children: t("Slug")
								}), /* @__PURE__ */ jsx("dd", {
									className: "mt-1 font-medium text-foreground",
									children: workspace.slug
								})] }),
								/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", {
									className: "text-xs tracking-wide text-muted-foreground uppercase",
									children: t("Owner")
								}), /* @__PURE__ */ jsxs("dd", {
									className: "mt-1 text-foreground",
									children: [workspace.owner?.name ?? t("No owner"), /* @__PURE__ */ jsx("p", {
										className: "text-xs text-muted-foreground",
										children: workspace.owner?.email ?? "—"
									})]
								})] }),
								/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", {
									className: "text-xs tracking-wide text-muted-foreground uppercase",
									children: t("Plan")
								}), /* @__PURE__ */ jsxs("dd", {
									className: "mt-1 text-foreground",
									children: [workspace.plan?.name ?? t("No plan"), /* @__PURE__ */ jsx("p", {
										className: "text-xs text-muted-foreground",
										children: workspace.plan ? workspace.plan.monthly_conversations > 0 ? t(":count conversations / month", { count: workspace.plan.monthly_conversations.toLocaleString() }) : t("Unlimited conversations") : "—"
									})]
								})] }),
								/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", {
									className: "text-xs tracking-wide text-muted-foreground uppercase",
									children: t("Created")
								}), /* @__PURE__ */ jsx("dd", {
									className: "mt-1 text-foreground",
									children: workspace.created_at ? new Date(workspace.created_at).toLocaleDateString() : "—"
								})] }),
								/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", {
									className: "text-xs tracking-wide text-muted-foreground uppercase",
									children: t("Monthly price")
								}), /* @__PURE__ */ jsx("dd", {
									className: "mt-1 text-foreground",
									children: workspace.plan ? `$${(workspace.plan.price_cents / 100).toLocaleString(void 0, {
										minimumFractionDigits: 0,
										maximumFractionDigits: 2
									})}` : "—"
								})] })
							]
						})]
					}), /* @__PURE__ */ jsxs(Card, {
						className: "p-4",
						children: [/* @__PURE__ */ jsxs("div", {
							className: "flex items-center gap-2 text-muted-foreground",
							children: [/* @__PURE__ */ jsx(Users, { className: "size-4" }), /* @__PURE__ */ jsx("h2", {
								className: "text-sm font-medium text-foreground",
								children: t("Workspace posture")
							})]
						}), /* @__PURE__ */ jsx("p", {
							className: "mt-3 text-sm text-muted-foreground",
							children: agents.length === 1 ? t("This tenant currently runs :agents agent, generated :conversations conversations, and produced :leads leads.", {
								agents: agents.length.toLocaleString(),
								conversations: metrics.conversations.toLocaleString(),
								leads: metrics.leads.toLocaleString()
							}) : t("This tenant currently runs :agents agents, generated :conversations conversations, and produced :leads leads.", {
								agents: agents.length.toLocaleString(),
								conversations: metrics.conversations.toLocaleString(),
								leads: metrics.leads.toLocaleString()
							})
						})]
					})]
				})]
			})
		})] })]
	});
}
//#endregion
//#region resources/js/components/empty-state.tsx
function EmptyState({ icon: Icon, title, description, action, children }) {
	return /* @__PURE__ */ jsxs(Card, {
		className: "flex flex-col items-center justify-center gap-3 p-12 text-center",
		children: [
			/* @__PURE__ */ jsx("div", {
				className: "rounded-full bg-muted p-3",
				children: /* @__PURE__ */ jsx(Icon, { className: "size-5 text-muted-foreground" })
			}),
			/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
				className: "text-sm font-medium",
				children: title
			}), description && /* @__PURE__ */ jsx("p", {
				className: "mx-auto mt-1 max-w-sm text-xs text-muted-foreground",
				children: description
			})] }),
			action && ("href" in action ? /* @__PURE__ */ jsx(Button, {
				asChild: true,
				variant: "outline",
				size: "sm",
				children: /* @__PURE__ */ jsx(Link, {
					href: action.href,
					children: action.label
				})
			}) : /* @__PURE__ */ jsx(Button, {
				variant: "outline",
				size: "sm",
				onClick: action.onClick,
				children: action.label
			})),
			children
		]
	});
}
//#endregion
//#region resources/js/pages/app/agents/behavior.tsx
var behavior_exports = /* @__PURE__ */ __exportAll({ default: () => Behavior });
var KINDS$1 = [
	"exit_intent",
	"idle",
	"scroll",
	"time",
	"returning",
	"utm",
	"abandoned_cart"
];
function Behavior({ agent, rules }) {
	const { t } = useT();
	const confirm = useConfirm();
	const form = useForm({
		name: "",
		kind: "exit_intent",
		message: ""
	});
	const breadcrumbs = [
		{
			title: t("Agents"),
			href: index$12.url()
		},
		{
			title: agent.name,
			href: show$4({ agent: agent.id }).url
		},
		{
			title: t("Behavior triggers"),
			href: index$19({ agent: agent.id }).url
		}
	];
	const submit = (e) => {
		e.preventDefault();
		form.transform((data) => ({
			name: data.name,
			kind: data.kind,
			action: {
				kind: "open_with_message",
				message: data.message
			},
			conditions: {}
		}));
		form.post(`/app/agents/${agent.id}/behavior`, { onSuccess: () => form.reset() });
	};
	return /* @__PURE__ */ jsxs(AppLayout, {
		breadcrumbs,
		children: [/* @__PURE__ */ jsx(Head, { title: `${agent.name} · behavior` }), /* @__PURE__ */ jsxs("div", {
			className: "flex flex-1 flex-col gap-4 p-4",
			children: [
				/* @__PURE__ */ jsx("h1", {
					className: "text-2xl font-semibold tracking-tight",
					children: t("Behavior triggers")
				}),
				/* @__PURE__ */ jsx("p", {
					className: "text-sm text-muted-foreground",
					children: t("When a visitor exit-intents, idles, scrolls, abandons a cart, etc., open the bar with a custom message.")
				}),
				/* @__PURE__ */ jsxs(Card, {
					className: "max-w-5xl gap-0 overflow-hidden border-border/80",
					children: [/* @__PURE__ */ jsx(CardHeader, {
						className: "border-b bg-muted/20 px-4 py-4 sm:px-5",
						children: /* @__PURE__ */ jsxs("div", {
							className: "flex items-start gap-3",
							children: [/* @__PURE__ */ jsx("span", {
								className: "flex size-9 shrink-0 items-center justify-center rounded-md border bg-background text-muted-foreground shadow-xs",
								children: /* @__PURE__ */ jsx(Workflow, { className: "size-4" })
							}), /* @__PURE__ */ jsxs("div", {
								className: "min-w-0",
								children: [/* @__PURE__ */ jsx(CardTitle, {
									className: "text-sm",
									children: t("Add a trigger")
								}), /* @__PURE__ */ jsx(CardDescription, {
									className: "mt-1 text-xs leading-5",
									children: t("Define when the bar should proactively open and what it should say in that moment.")
								})]
							})]
						})
					}), /* @__PURE__ */ jsxs("form", {
						onSubmit: submit,
						children: [/* @__PURE__ */ jsxs(CardContent, {
							className: "grid gap-4 px-4 py-4 sm:px-5 sm:py-5 md:grid-cols-[minmax(0,1fr)_220px]",
							children: [
								/* @__PURE__ */ jsxs("div", {
									className: "grid gap-1.5",
									children: [
										/* @__PURE__ */ jsx(Label, {
											htmlFor: "name",
											children: t("Name")
										}),
										/* @__PURE__ */ jsx(Input, {
											id: "name",
											placeholder: t("Exit intent prompt"),
											value: form.data.name,
											"aria-invalid": Boolean(form.errors.name),
											onChange: (e) => form.setData("name", e.target.value)
										}),
										/* @__PURE__ */ jsx(InputError, { message: form.errors.name })
									]
								}),
								/* @__PURE__ */ jsxs("div", {
									className: "grid gap-1.5",
									children: [
										/* @__PURE__ */ jsx(Label, {
											htmlFor: "kind",
											children: t("Kind")
										}),
										/* @__PURE__ */ jsxs(Select, {
											value: form.data.kind,
											onValueChange: (value) => form.setData("kind", value),
											children: [/* @__PURE__ */ jsx(SelectTrigger, {
												id: "kind",
												children: /* @__PURE__ */ jsx(SelectValue, {})
											}), /* @__PURE__ */ jsx(SelectContent, { children: KINDS$1.map((kind) => /* @__PURE__ */ jsx(SelectItem, {
												value: kind,
												children: kind
											}, kind)) })]
										}),
										/* @__PURE__ */ jsx(InputError, { message: form.errors.kind })
									]
								}),
								/* @__PURE__ */ jsxs("div", {
									className: "grid gap-1.5 md:col-span-2",
									children: [
										/* @__PURE__ */ jsx(Label, {
											htmlFor: "message",
											children: t("Bar opens with message")
										}),
										/* @__PURE__ */ jsx(Input, {
											id: "message",
											placeholder: t("Still comparing options? I can help you find the right plan."),
											value: form.data.message,
											"aria-invalid": Boolean(form.errors.message),
											onChange: (e) => form.setData("message", e.target.value)
										}),
										/* @__PURE__ */ jsx("p", {
											className: "text-xs text-muted-foreground",
											children: t("Keep it short and conversational so the widget feels like a helpful nudge, not a pop-up ad.")
										}),
										/* @__PURE__ */ jsx(InputError, { message: form.errors.message })
									]
								})
							]
						}), /* @__PURE__ */ jsx(CardFooter, {
							className: "flex flex-col-reverse gap-2 border-t bg-muted/10 px-4 py-4 sm:flex-row sm:justify-end sm:px-5",
							children: /* @__PURE__ */ jsx(Button, {
								type: "submit",
								disabled: form.processing,
								className: "w-full sm:w-auto",
								children: t("Add trigger")
							})
						})]
					})]
				}),
				/* @__PURE__ */ jsxs(Card, {
					className: "p-4",
					children: [/* @__PURE__ */ jsx("h2", {
						className: "mb-3 font-medium",
						children: t("Existing")
					}), rules.length === 0 ? /* @__PURE__ */ jsx(EmptyState, {
						icon: Workflow,
						title: t("No behavior triggers yet"),
						description: t("Triggers tell the bar when to proactively pop open: visitor about to leave, idle for a while, scrolled past 50% of the page, returning visitor, arrived from a UTM campaign — that kind of thing.")
					}) : /* @__PURE__ */ jsx("div", {
						className: "divide-y",
						children: rules.map((r) => /* @__PURE__ */ jsxs("div", {
							className: "flex items-center justify-between py-3",
							children: [/* @__PURE__ */ jsxs("div", {
								className: "min-w-0 flex-1",
								children: [/* @__PURE__ */ jsx("p", {
									className: "text-sm font-medium",
									children: r.name
								}), /* @__PURE__ */ jsxs("p", {
									className: "text-xs text-muted-foreground",
									children: [
										r.kind,
										" ·",
										" ",
										r.action?.message ? `"${r.action.message}"` : t("(no message)")
									]
								})]
							}), /* @__PURE__ */ jsx(Button, {
								variant: "ghost",
								size: "sm",
								onClick: async () => {
									if (!await confirm({
										title: t("Delete rule?"),
										message: t("Delete?"),
										confirmLabel: t("Delete"),
										danger: true
									})) return;
									router.delete(`/app/behavior-rules/${r.id}`);
								},
								children: /* @__PURE__ */ jsx(Trash2, { className: "size-4" })
							})]
						}, r.id))
					})]
				})
			]
		})]
	});
}
//#endregion
//#region resources/js/pages/app/agents/conversations.tsx
var conversations_exports$1 = /* @__PURE__ */ __exportAll({ default: () => ConversationsPage });
function useRelativeTime$3() {
	const { t } = useT();
	return (iso) => {
		if (!iso) return "—";
		const ms = Date.now() - new Date(iso).getTime();
		const sec = Math.max(1, Math.round(ms / 1e3));
		if (sec < 60) return t("just now");
		const min = Math.round(sec / 60);
		if (min < 60) return t(":min m ago", { min });
		const h = Math.round(min / 60);
		if (h < 24) return t(":h h ago", { h });
		return t(":d d ago", { d: Math.round(h / 24) });
	};
}
function ConversationsPage({ agent, totals, conversations, pagination, filters, can_delete }) {
	const { t, tChoice } = useT();
	const relativeTime = useRelativeTime$3();
	const confirm = useConfirm();
	const breadcrumbs = [
		{
			title: t("Agents"),
			href: index$12.url()
		},
		{
			title: agent.name,
			href: show$4({ agent: agent.id }).url
		},
		{
			title: t("Conversations"),
			href: index$16({ agent: agent.id }).url
		}
	];
	const isEmpty = conversations.length === 0;
	const hasQuery = filters.q.trim() !== "";
	const showMode = filters.show === "all" ? "all" : "engaged";
	const setShowMode = (next) => {
		const query = {};
		if (filters.q) query.q = filters.q;
		if (next === "all") query.show = "all";
		router.get(`/app/agents/${agent.id}/conversations`, query, {
			preserveScroll: true,
			preserveState: true,
			only: [
				"conversations",
				"pagination",
				"filters",
				"totals"
			]
		});
	};
	const deleteOne = async (id) => {
		if (!can_delete) return;
		if (!await confirm({
			title: t("Delete conversation?"),
			message: t("Delete this conversation? This cannot be undone."),
			confirmLabel: t("Delete"),
			danger: true
		})) return;
		router.delete(destroy$11(id), { preserveScroll: true });
	};
	return /* @__PURE__ */ jsxs(AppLayout, {
		breadcrumbs,
		children: [/* @__PURE__ */ jsx(Head, { title: `${agent.name} · conversations` }), /* @__PURE__ */ jsxs("div", {
			className: "flex flex-1 flex-col gap-4 p-4",
			children: [
				/* @__PURE__ */ jsxs("div", {
					className: "flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",
					children: [/* @__PURE__ */ jsxs("div", {
						className: "min-w-0",
						children: [/* @__PURE__ */ jsx("h1", {
							className: "text-2xl font-semibold tracking-tight",
							children: t("Conversations")
						}), /* @__PURE__ */ jsx("p", {
							className: "mt-1 text-sm text-muted-foreground",
							children: t("Every visitor session this agent has handled. Click a row to read the full thread.")
						})]
					}), /* @__PURE__ */ jsx("div", {
						className: "w-full sm:w-64 sm:shrink-0",
						children: /* @__PURE__ */ jsx(TableSearch, {
							placeholder: t("Search by question, page URL, or anon id…"),
							initialValue: filters.q,
							only: [
								"conversations",
								"pagination",
								"filters"
							]
						})
					})]
				}),
				/* @__PURE__ */ jsxs("div", {
					className: "grid grid-cols-2 gap-3 md:grid-cols-3",
					children: [
						/* @__PURE__ */ jsxs(Card, {
							className: "p-4",
							children: [
								/* @__PURE__ */ jsx("p", {
									className: "text-xs tracking-wide text-muted-foreground uppercase",
									children: t("Total")
								}),
								/* @__PURE__ */ jsx("p", {
									className: "mt-1 text-2xl font-semibold tabular-nums",
									children: totals.conversations.toLocaleString()
								}),
								/* @__PURE__ */ jsx("p", {
									className: "mt-0.5 text-xs text-muted-foreground",
									children: t("all time")
								})
							]
						}),
						/* @__PURE__ */ jsxs(Card, {
							className: "p-4",
							children: [
								/* @__PURE__ */ jsx("p", {
									className: "text-xs tracking-wide text-muted-foreground uppercase",
									children: t("Messages")
								}),
								/* @__PURE__ */ jsx("p", {
									className: "mt-1 text-2xl font-semibold tabular-nums",
									children: totals.messages.toLocaleString()
								}),
								/* @__PURE__ */ jsx("p", {
									className: "mt-0.5 text-xs text-muted-foreground",
									children: t("across all conversations")
								})
							]
						}),
						/* @__PURE__ */ jsxs(Card, {
							className: "p-4",
							children: [
								/* @__PURE__ */ jsx("p", {
									className: "text-xs tracking-wide text-muted-foreground uppercase",
									children: t("Last 24h")
								}),
								/* @__PURE__ */ jsx("p", {
									className: "mt-1 text-2xl font-semibold tabular-nums",
									children: totals.last_24h.toLocaleString()
								}),
								/* @__PURE__ */ jsx("p", {
									className: "mt-0.5 text-xs text-muted-foreground",
									children: t("new conversations")
								})
							]
						})
					]
				}),
				/* @__PURE__ */ jsx("div", {
					className: "flex items-center gap-2",
					children: /* @__PURE__ */ jsxs("div", {
						className: "inline-flex overflow-hidden rounded-full border text-xs font-medium",
						children: [/* @__PURE__ */ jsx("button", {
							type: "button",
							onClick: () => setShowMode("engaged"),
							className: `px-3 py-1 ${showMode === "engaged" ? "bg-foreground text-background" : "hover:bg-muted"}`,
							children: t("Engaged only")
						}), /* @__PURE__ */ jsxs("button", {
							type: "button",
							onClick: () => setShowMode("all"),
							className: `border-l px-3 py-1 ${showMode === "all" ? "bg-foreground text-background" : "hover:bg-muted"}`,
							children: [t("Show all"), totals.empty > 0 && /* @__PURE__ */ jsxs("span", {
								className: "ml-1 rounded-full bg-foreground/10 px-1.5 text-[10px] tabular-nums",
								children: ["+", totals.empty]
							})]
						})]
					})
				}),
				isEmpty ? /* @__PURE__ */ jsxs(Card, {
					className: "p-8 text-center",
					children: [
						/* @__PURE__ */ jsx(MessagesSquare, { className: "mx-auto size-10 text-muted-foreground/40" }),
						/* @__PURE__ */ jsx("p", {
							className: "mt-3 text-sm font-medium",
							children: hasQuery ? t("No conversations match that search.") : showMode === "engaged" ? t("No engaged conversations yet.") : t("No conversations yet.")
						}),
						/* @__PURE__ */ jsx("p", {
							className: "mt-1 text-xs text-muted-foreground",
							children: hasQuery ? t("Try a different keyword.") : showMode === "engaged" ? t("Drive-by widget loads are hidden here. Toggle \"Show all\" to see every session.") : t("Once visitors start chatting, every session shows up here.")
						})
					]
				}) : /* @__PURE__ */ jsxs(Card, {
					className: "p-0",
					children: [/* @__PURE__ */ jsx("div", {
						className: "divide-y",
						children: conversations.map((c) => /* @__PURE__ */ jsxs("div", {
							className: "group flex items-start gap-3 px-4 py-3 transition hover:bg-muted/50",
							children: [/* @__PURE__ */ jsxs(Link, {
								href: `/app/conversations/${c.id}`,
								className: "flex min-w-0 flex-1 items-start gap-3",
								children: [
									/* @__PURE__ */ jsx("div", {
										className: "flex size-8 shrink-0 items-center justify-center rounded-full bg-muted",
										children: /* @__PURE__ */ jsx(User, { className: "size-4 text-muted-foreground" })
									}),
									/* @__PURE__ */ jsxs("div", {
										className: "min-w-0 flex-1",
										children: [
											/* @__PURE__ */ jsxs("div", {
												className: "flex flex-wrap items-center gap-2",
												children: [
													/* @__PURE__ */ jsx("p", {
														className: "truncate text-sm font-medium",
														children: c.preview
													}),
													c.is_returning && /* @__PURE__ */ jsx("span", {
														className: "rounded bg-violet-500/15 px-1.5 py-0.5 text-[10px] font-medium text-violet-700 dark:text-violet-400",
														children: t("returning")
													}),
													c.lang && c.lang !== "en" && /* @__PURE__ */ jsx("span", {
														className: "rounded bg-sky-500/15 px-1.5 py-0.5 text-[10px] font-medium text-sky-700 uppercase dark:text-sky-400",
														children: c.lang
													})
												]
											}),
											/* @__PURE__ */ jsx("p", {
												className: "mt-0.5 truncate text-xs text-muted-foreground",
												children: c.page_url ?? t("(no page url)")
											}),
											/* @__PURE__ */ jsx("p", {
												className: "mt-1 text-[11px] text-muted-foreground/80",
												children: c.visitor_anon ? c.visitor_anon.slice(0, 16) : t("(unknown visitor)")
											})
										]
									}),
									/* @__PURE__ */ jsxs("div", {
										className: "flex shrink-0 flex-col items-end gap-1 text-end",
										children: [/* @__PURE__ */ jsx("span", {
											className: "text-xs font-medium tabular-nums",
											children: tChoice(":count msg|:count msgs", c.message_count, { count: c.message_count })
										}), /* @__PURE__ */ jsx("span", {
											className: "text-[10px] text-muted-foreground",
											children: relativeTime(c.last_activity_at)
										})]
									}),
									/* @__PURE__ */ jsx(ChevronRight, { className: "mt-2 size-4 shrink-0 text-muted-foreground" })
								]
							}), can_delete && /* @__PURE__ */ jsx("button", {
								type: "button",
								onClick: () => deleteOne(c.id),
								className: "mt-1 ml-1 rounded-md p-1 text-muted-foreground opacity-0 transition group-hover:opacity-100 hover:bg-red-500/10 hover:text-red-600 focus:opacity-100",
								title: t("Delete conversation"),
								"aria-label": t("Delete conversation"),
								children: /* @__PURE__ */ jsx(Trash2, { className: "size-4" })
							})]
						}, c.id))
					}), /* @__PURE__ */ jsx(TablePagination, {
						pagination,
						only: [
							"conversations",
							"pagination",
							"filters"
						]
					})]
				})
			]
		})]
	});
}
//#endregion
//#region resources/js/components/agents/agent-form.tsx
var LANGUAGES = [
	{
		code: "en",
		label: "English"
	},
	{
		code: "nl",
		label: "Nederlands (Dutch)"
	},
	{
		code: "es",
		label: "Español (Spanish)"
	},
	{
		code: "fr",
		label: "Français (French)"
	},
	{
		code: "de",
		label: "Deutsch (German)"
	},
	{
		code: "pt",
		label: "Português (Portuguese)"
	},
	{
		code: "ja",
		label: "日本語 (Japanese)"
	},
	{
		code: "ar",
		label: "العربية (Arabic)"
	},
	{
		code: "zh",
		label: "中文 (Chinese)"
	}
];
function FieldError({ children }) {
	if (!children) return null;
	return /* @__PURE__ */ jsx("p", {
		className: "text-xs text-destructive",
		children
	});
}
function SectionIntro({ icon, eyebrow, title, description }) {
	return /* @__PURE__ */ jsxs("div", {
		className: "flex gap-3 lg:block",
		children: [/* @__PURE__ */ jsx("span", {
			className: "flex size-9 shrink-0 items-center justify-center rounded-lg border bg-background text-muted-foreground shadow-xs lg:mb-4",
			children: icon
		}), /* @__PURE__ */ jsxs("div", {
			className: "min-w-0",
			children: [
				/* @__PURE__ */ jsx("p", {
					className: "text-[11px] font-medium tracking-wider text-muted-foreground uppercase",
					children: eyebrow
				}),
				/* @__PURE__ */ jsx("h2", {
					className: "mt-1 text-sm font-semibold text-foreground",
					children: title
				}),
				/* @__PURE__ */ jsx("p", {
					className: "mt-1 max-w-sm text-xs leading-5 text-muted-foreground",
					children: description
				})
			]
		})]
	});
}
function AgentForm({ mode, agentId, initial = {}, className }) {
	const { t } = useT();
	const form = useForm({
		name: initial.name ?? "",
		language_default: initial.language_default ?? "en",
		system_prompt: initial.system_prompt ?? "",
		confidence_threshold: initial.confidence_threshold ?? .5
	});
	const confidenceValue = Number.isFinite(form.data.confidence_threshold) ? form.data.confidence_threshold : .5;
	const confidencePercent = Math.round(confidenceValue * 100);
	const submit = (e) => {
		e.preventDefault();
		if (mode === "create") form.post(store$11.url());
		else if (agentId) form.patch(update$11.url({ agent: agentId }), { preserveScroll: true });
	};
	return /* @__PURE__ */ jsxs(Card, {
		className: cn("overflow-hidden border-border/80 p-0", className),
		children: [/* @__PURE__ */ jsx("div", {
			className: "border-b bg-muted/20 px-4 py-4 sm:px-5",
			children: /* @__PURE__ */ jsxs("div", {
				className: "flex flex-wrap items-start justify-between gap-3",
				children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
					className: "text-sm font-semibold text-foreground",
					children: t("Agent profile")
				}), /* @__PURE__ */ jsx("p", {
					className: "mt-1 max-w-2xl text-xs leading-5 text-muted-foreground",
					children: t("Control the identity, instruction layer, and retrieval safety threshold that shape every visitor answer.")
				})] }), mode === "edit" && form.recentlySuccessful ? /* @__PURE__ */ jsx("span", {
					className: "rounded-md border border-emerald-500/25 bg-emerald-500/10 px-2 py-1 text-xs font-medium text-emerald-700 dark:text-emerald-300",
					children: t("Changes saved")
				}) : null]
			})
		}), /* @__PURE__ */ jsxs("form", {
			onSubmit: submit,
			children: [
				/* @__PURE__ */ jsxs("section", {
					className: "grid gap-5 border-b p-4 sm:p-5 lg:grid-cols-[220px_1fr] lg:gap-8",
					children: [/* @__PURE__ */ jsx(SectionIntro, {
						icon: /* @__PURE__ */ jsx(Bot, { className: "size-4" }),
						eyebrow: t("Basics"),
						title: t("Basics"),
						description: t("Name the agent and choose the language it should use by default.")
					}), /* @__PURE__ */ jsxs("div", {
						className: "grid gap-4 sm:grid-cols-[1fr_180px]",
						children: [/* @__PURE__ */ jsxs("div", {
							className: "grid gap-1.5",
							children: [
								/* @__PURE__ */ jsx(Label, {
									htmlFor: "name",
									children: t("Name")
								}),
								/* @__PURE__ */ jsx(Input, {
									id: "name",
									className: "h-9",
									placeholder: t("Sales assistant"),
									value: form.data.name,
									"aria-invalid": Boolean(form.errors.name),
									onChange: (e) => form.setData("name", e.target.value)
								}),
								/* @__PURE__ */ jsx(FieldError, { children: form.errors.name })
							]
						}), /* @__PURE__ */ jsxs("div", {
							className: "grid gap-1.5",
							children: [/* @__PURE__ */ jsx(Label, {
								htmlFor: "lang",
								children: t("Default language")
							}), /* @__PURE__ */ jsxs(Select, {
								value: form.data.language_default,
								onValueChange: (value) => form.setData("language_default", value),
								children: [/* @__PURE__ */ jsx(SelectTrigger, {
									id: "lang",
									className: "h-9",
									children: /* @__PURE__ */ jsx(SelectValue, {})
								}), /* @__PURE__ */ jsx(SelectContent, { children: LANGUAGES.map((language) => /* @__PURE__ */ jsx(SelectItem, {
									value: language.code,
									children: language.label
								}, language.code)) })]
							})]
						})]
					})]
				}),
				/* @__PURE__ */ jsxs("section", {
					className: "grid gap-5 border-b p-4 sm:p-5 lg:grid-cols-[220px_1fr] lg:gap-8",
					children: [/* @__PURE__ */ jsx(SectionIntro, {
						icon: /* @__PURE__ */ jsx(Globe2, { className: "size-4" }),
						eyebrow: t("Instructions"),
						title: t("Instructions"),
						description: t("Define the agent's role, tone, boundaries, and what it should prioritize when answering visitors.")
					}), /* @__PURE__ */ jsxs("div", {
						className: "grid gap-1.5",
						children: [
							/* @__PURE__ */ jsxs("div", {
								className: "flex items-center justify-between gap-3",
								children: [/* @__PURE__ */ jsx(Label, {
									htmlFor: "prompt",
									children: t("System prompt")
								}), /* @__PURE__ */ jsxs("span", {
									className: "text-xs text-muted-foreground tabular-nums",
									children: [form.data.system_prompt.length, "/2000"]
								})]
							}),
							/* @__PURE__ */ jsx(Textarea, {
								id: "prompt",
								rows: 7,
								className: "min-h-48 resize-y bg-background/80 leading-6",
								placeholder: t("You are a helpful sales assistant. Answer using the knowledge base, ask concise follow-up questions, and offer to collect contact details when a visitor is ready."),
								value: form.data.system_prompt,
								"aria-invalid": Boolean(form.errors.system_prompt),
								onChange: (e) => form.setData("system_prompt", e.target.value)
							}),
							/* @__PURE__ */ jsx(FieldError, { children: form.errors.system_prompt })
						]
					})]
				}),
				/* @__PURE__ */ jsxs("section", {
					className: "grid gap-5 border-b p-4 sm:p-5 lg:grid-cols-[220px_1fr] lg:gap-8",
					children: [/* @__PURE__ */ jsx(SectionIntro, {
						icon: /* @__PURE__ */ jsx(ShieldCheck, { className: "size-4" }),
						eyebrow: t("Retrieval"),
						title: t("Retrieval confidence"),
						description: t("Control how certain the agent must be before it answers from retrieved knowledge.")
					}), /* @__PURE__ */ jsxs("div", {
						className: "grid max-w-2xl gap-4",
						children: [/* @__PURE__ */ jsxs("div", {
							className: "rounded-lg border bg-background/70 p-4",
							children: [/* @__PURE__ */ jsxs("div", {
								className: "flex flex-wrap items-center justify-between gap-3",
								children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx(Label, {
									htmlFor: "conf",
									children: t("Threshold")
								}), /* @__PURE__ */ jsx("p", {
									className: "mt-1 text-xs leading-5 text-muted-foreground",
									children: t("Below this score, the agent will say it does not know instead of guessing.")
								})] }), /* @__PURE__ */ jsxs("div", {
									className: "flex items-center gap-2",
									children: [/* @__PURE__ */ jsxs("span", {
										className: "text-sm font-semibold text-foreground tabular-nums",
										children: [confidencePercent, "%"]
									}), /* @__PURE__ */ jsx(Input, {
										id: "conf",
										type: "number",
										min: 0,
										max: 1,
										step: .01,
										value: confidenceValue,
										onChange: (e) => form.setData("confidence_threshold", parseFloat(e.target.value)),
										className: "h-9 w-24 tabular-nums"
									})]
								})]
							}), /* @__PURE__ */ jsx("input", {
								type: "range",
								min: 0,
								max: 1,
								step: .01,
								value: confidenceValue,
								onChange: (e) => form.setData("confidence_threshold", parseFloat(e.target.value)),
								className: "mt-4 w-full accent-foreground",
								"aria-label": t("Retrieval confidence threshold")
							})]
						}), /* @__PURE__ */ jsx("p", {
							className: "rounded-lg border bg-muted/25 px-3 py-2 text-xs leading-5 text-muted-foreground",
							children: t("Default 0.5 is tuned for Cloudflare bge-base. Raise toward 0.78 if you switch to OpenAI embeddings or need stricter answer confidence.")
						})]
					})]
				}),
				/* @__PURE__ */ jsx("div", {
					className: "flex flex-col-reverse gap-2 bg-muted/20 p-4 sm:flex-row sm:items-center sm:justify-end sm:p-5",
					children: /* @__PURE__ */ jsx(Button, {
						type: "submit",
						disabled: form.processing,
						className: "w-full sm:w-auto",
						children: mode === "create" ? t("Create agent") : t("Save changes")
					})
				})
			]
		})]
	});
}
//#endregion
//#region resources/js/pages/app/agents/create.tsx
var create_exports$1 = /* @__PURE__ */ __exportAll({ default: () => CreateAgent });
function CreateAgent() {
	const { t } = useT();
	return /* @__PURE__ */ jsxs(AppLayout, {
		breadcrumbs: [{
			title: t("Agents"),
			href: index$12.url()
		}, {
			title: t("New"),
			href: create$1.url()
		}],
		children: [/* @__PURE__ */ jsx(Head, { title: "New agent" }), /* @__PURE__ */ jsxs("div", {
			className: "flex flex-1 flex-col gap-4 p-4",
			children: [/* @__PURE__ */ jsx("h1", {
				className: "text-2xl font-semibold tracking-tight",
				children: t("Create agent")
			}), /* @__PURE__ */ jsx(AgentForm, { mode: "create" })]
		})]
	});
}
//#endregion
//#region resources/js/routes/cta/index.ts
/**
* @see \App\Http\Controllers\Admin\CtaRuleController::update
* @see app/Http/Controllers/Admin/CtaRuleController.php:41
* @route '/app/cta-rules/{ctaRule}'
*/
var update$8 = (args, options) => ({
	url: update$8.url(args, options),
	method: "patch"
});
update$8.definition = {
	methods: ["patch"],
	url: "/app/cta-rules/{ctaRule}"
};
/**
* @see \App\Http\Controllers\Admin\CtaRuleController::update
* @see app/Http/Controllers/Admin/CtaRuleController.php:41
* @route '/app/cta-rules/{ctaRule}'
*/
update$8.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { ctaRule: args };
	if (typeof args === "object" && !Array.isArray(args) && "id" in args) args = { ctaRule: args.id };
	if (Array.isArray(args)) args = { ctaRule: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { ctaRule: typeof args.ctaRule === "object" ? args.ctaRule.id : args.ctaRule };
	return update$8.definition.url.replace("{ctaRule}", parsedArgs.ctaRule.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\CtaRuleController::update
* @see app/Http/Controllers/Admin/CtaRuleController.php:41
* @route '/app/cta-rules/{ctaRule}'
*/
update$8.patch = (args, options) => ({
	url: update$8.url(args, options),
	method: "patch"
});
/**
* @see \App\Http\Controllers\Admin\CtaRuleController::update
* @see app/Http/Controllers/Admin/CtaRuleController.php:41
* @route '/app/cta-rules/{ctaRule}'
*/
var updateForm$8 = (args, options) => ({
	action: update$8.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "PATCH",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\CtaRuleController::update
* @see app/Http/Controllers/Admin/CtaRuleController.php:41
* @route '/app/cta-rules/{ctaRule}'
*/
updateForm$8.patch = (args, options) => ({
	action: update$8.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "PATCH",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
update$8.form = updateForm$8;
/**
* @see \App\Http\Controllers\Admin\CtaRuleController::destroy
* @see app/Http/Controllers/Admin/CtaRuleController.php:59
* @route '/app/cta-rules/{ctaRule}'
*/
var destroy$6 = (args, options) => ({
	url: destroy$6.url(args, options),
	method: "delete"
});
destroy$6.definition = {
	methods: ["delete"],
	url: "/app/cta-rules/{ctaRule}"
};
/**
* @see \App\Http\Controllers\Admin\CtaRuleController::destroy
* @see app/Http/Controllers/Admin/CtaRuleController.php:59
* @route '/app/cta-rules/{ctaRule}'
*/
destroy$6.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { ctaRule: args };
	if (typeof args === "object" && !Array.isArray(args) && "id" in args) args = { ctaRule: args.id };
	if (Array.isArray(args)) args = { ctaRule: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { ctaRule: typeof args.ctaRule === "object" ? args.ctaRule.id : args.ctaRule };
	return destroy$6.definition.url.replace("{ctaRule}", parsedArgs.ctaRule.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\CtaRuleController::destroy
* @see app/Http/Controllers/Admin/CtaRuleController.php:59
* @route '/app/cta-rules/{ctaRule}'
*/
destroy$6.delete = (args, options) => ({
	url: destroy$6.url(args, options),
	method: "delete"
});
/**
* @see \App\Http\Controllers\Admin\CtaRuleController::destroy
* @see app/Http/Controllers/Admin/CtaRuleController.php:59
* @route '/app/cta-rules/{ctaRule}'
*/
var destroyForm$6 = (args, options) => ({
	action: destroy$6.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "DELETE",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\CtaRuleController::destroy
* @see app/Http/Controllers/Admin/CtaRuleController.php:59
* @route '/app/cta-rules/{ctaRule}'
*/
destroyForm$6.delete = (args, options) => ({
	action: destroy$6.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "DELETE",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
destroy$6.form = destroyForm$6;
Object.assign(update$8, update$8), Object.assign(destroy$6, destroy$6);
//#endregion
//#region resources/js/pages/app/agents/ctas.tsx
var ctas_exports = /* @__PURE__ */ __exportAll({ default: () => Ctas });
var KINDS = [
	"buy",
	"demo",
	"signup",
	"book",
	"link"
];
function Ctas({ agent, rules }) {
	const { t } = useT();
	const confirm = useConfirm();
	const alert = useAlert();
	const form = useForm({
		name: "",
		label: "",
		kind: "demo",
		url: "",
		forward_context: false,
		context_fields: []
	});
	const breadcrumbs = [
		{
			title: t("Agents"),
			href: index$12.url()
		},
		{
			title: agent.name,
			href: show$4({ agent: agent.id }).url
		},
		{
			title: t("CTAs"),
			href: index$18({ agent: agent.id }).url
		}
	];
	const submit = (e) => {
		e.preventDefault();
		form.transform((data) => ({
			name: data.name,
			label: data.label,
			kind: data.kind,
			target: {
				url: data.url,
				...data.forward_context && data.context_fields.length > 0 ? {
					forward_context: true,
					context_fields: data.context_fields
				} : {}
			},
			conditions: {}
		}));
		form.post(`/app/agents/${agent.id}/ctas`, { onSuccess: () => form.reset() });
	};
	const toggleField = (field) => {
		const next = form.data.context_fields.includes(field) ? form.data.context_fields.filter((f) => f !== field) : [...form.data.context_fields, field];
		form.setData("context_fields", next);
	};
	return /* @__PURE__ */ jsxs(AppLayout, {
		breadcrumbs,
		children: [/* @__PURE__ */ jsx(Head, { title: `${agent.name} · CTAs` }), /* @__PURE__ */ jsxs("div", {
			className: "flex flex-1 flex-col gap-4 p-4",
			children: [
				/* @__PURE__ */ jsx("h1", {
					className: "text-2xl font-semibold tracking-tight",
					children: t("Calls to action")
				}),
				/* @__PURE__ */ jsx("p", {
					className: "text-sm text-muted-foreground",
					children: t("Buttons that surface in conversations to drive demos, sign-ups, or purchases.")
				}),
				/* @__PURE__ */ jsxs(Card, {
					className: "max-w-5xl gap-0 overflow-hidden border-border/80",
					children: [/* @__PURE__ */ jsx(CardHeader, {
						className: "border-b bg-muted/20 px-4 py-4 sm:px-5",
						children: /* @__PURE__ */ jsxs("div", {
							className: "flex items-start gap-3",
							children: [/* @__PURE__ */ jsx("span", {
								className: "flex size-9 shrink-0 items-center justify-center rounded-md border bg-background text-muted-foreground shadow-xs",
								children: /* @__PURE__ */ jsx(BarChart3, { className: "size-4" })
							}), /* @__PURE__ */ jsxs("div", {
								className: "min-w-0",
								children: [/* @__PURE__ */ jsx(CardTitle, {
									className: "text-sm",
									children: t("Add a CTA")
								}), /* @__PURE__ */ jsx(CardDescription, {
									className: "mt-1 text-xs leading-5",
									children: t("Create a button the assistant can surface during a conversation when a visitor is ready to act.")
								})]
							})]
						})
					}), /* @__PURE__ */ jsxs("form", {
						onSubmit: submit,
						children: [/* @__PURE__ */ jsxs(CardContent, {
							className: "grid gap-4 px-4 py-4 sm:px-5 sm:py-5 md:grid-cols-2 xl:grid-cols-4",
							children: [
								/* @__PURE__ */ jsxs("div", {
									className: "grid gap-1.5",
									children: [
										/* @__PURE__ */ jsx(Label, {
											htmlFor: "name",
											children: t("Name (internal)")
										}),
										/* @__PURE__ */ jsx(Input, {
											id: "name",
											placeholder: "book_demo_primary",
											value: form.data.name,
											"aria-invalid": Boolean(form.errors.name),
											onChange: (e) => form.setData("name", e.target.value)
										}),
										/* @__PURE__ */ jsx(InputError, { message: form.errors.name })
									]
								}),
								/* @__PURE__ */ jsxs("div", {
									className: "grid gap-1.5",
									children: [
										/* @__PURE__ */ jsx(Label, {
											htmlFor: "label",
											children: t("Button label")
										}),
										/* @__PURE__ */ jsx(Input, {
											id: "label",
											placeholder: t("Book a demo"),
											value: form.data.label,
											"aria-invalid": Boolean(form.errors.label),
											onChange: (e) => form.setData("label", e.target.value)
										}),
										/* @__PURE__ */ jsx(InputError, { message: form.errors.label })
									]
								}),
								/* @__PURE__ */ jsxs("div", {
									className: "grid gap-1.5",
									children: [
										/* @__PURE__ */ jsx(Label, {
											htmlFor: "kind",
											children: t("Kind")
										}),
										/* @__PURE__ */ jsxs(Select, {
											value: form.data.kind,
											onValueChange: (value) => form.setData("kind", value),
											children: [/* @__PURE__ */ jsx(SelectTrigger, {
												id: "kind",
												children: /* @__PURE__ */ jsx(SelectValue, {})
											}), /* @__PURE__ */ jsx(SelectContent, { children: KINDS.map((kind) => /* @__PURE__ */ jsx(SelectItem, {
												value: kind,
												children: kind
											}, kind)) })]
										}),
										/* @__PURE__ */ jsx(InputError, { message: form.errors.kind })
									]
								}),
								/* @__PURE__ */ jsxs("div", {
									className: "grid gap-1.5",
									children: [
										/* @__PURE__ */ jsx(Label, {
											htmlFor: "url",
											children: t("Target URL")
										}),
										/* @__PURE__ */ jsx(Input, {
											id: "url",
											type: "url",
											placeholder: "https://your-site.com/demo",
											value: form.data.url,
											"aria-invalid": Boolean(form.errors.url),
											onChange: (e) => form.setData("url", e.target.value)
										}),
										/* @__PURE__ */ jsx(InputError, { message: form.errors.url })
									]
								}),
								/* @__PURE__ */ jsxs("div", {
									className: "grid gap-1.5 md:col-span-2 xl:col-span-4",
									children: [/* @__PURE__ */ jsxs(Label, {
										className: "flex items-center gap-2",
										children: [/* @__PURE__ */ jsx("input", {
											type: "checkbox",
											checked: form.data.forward_context,
											onChange: (e) => form.setData("forward_context", e.target.checked)
										}), /* @__PURE__ */ jsx("span", { children: t("Forward conversation context to the target URL (signed)") })]
									}), form.data.forward_context && /* @__PURE__ */ jsx("div", {
										className: "flex flex-wrap gap-2 rounded-md border bg-muted/30 p-3 text-xs",
										children: [
											"conversation_id",
											"visitor_email",
											"visitor_name",
											"captured_fields",
											"page_url",
											"agent_id"
										].map((f) => /* @__PURE__ */ jsxs("label", {
											className: "inline-flex items-center gap-1.5",
											children: [/* @__PURE__ */ jsx("input", {
												type: "checkbox",
												checked: form.data.context_fields.includes(f),
												onChange: () => toggleField(f)
											}), /* @__PURE__ */ jsx("code", { children: f })]
										}, f))
									})]
								})
							]
						}), /* @__PURE__ */ jsx(CardFooter, {
							className: "flex flex-col-reverse gap-2 border-t bg-muted/10 px-4 py-4 sm:flex-row sm:justify-end sm:px-5",
							children: /* @__PURE__ */ jsx(Button, {
								type: "submit",
								disabled: form.processing,
								className: "w-full sm:w-auto",
								children: t("Add CTA")
							})
						})]
					})]
				}),
				/* @__PURE__ */ jsxs(Card, {
					className: "p-4",
					children: [/* @__PURE__ */ jsx("h2", {
						className: "mb-3 font-medium",
						children: t("Existing")
					}), rules.length === 0 ? /* @__PURE__ */ jsx(EmptyState, {
						icon: BarChart3,
						title: t("No CTAs configured yet"),
						description: t("CTAs are buttons the bot can surface mid-conversation to push a visitor toward a demo, signup, or specific URL — most useful when you tie them to keywords like 'pricing' or 'enterprise'.")
					}) : /* @__PURE__ */ jsx("div", {
						className: "divide-y",
						children: rules.map((r) => /* @__PURE__ */ jsxs("div", {
							className: "flex items-center justify-between py-3",
							children: [/* @__PURE__ */ jsxs("div", {
								className: "min-w-0 flex-1",
								children: [/* @__PURE__ */ jsx("p", {
									className: "text-sm font-medium",
									children: r.label
								}), /* @__PURE__ */ jsxs("p", {
									className: "text-xs text-muted-foreground",
									children: [
										r.kind,
										" →",
										" ",
										r.target?.url ?? t("(no target)")
									]
								})]
							}), /* @__PURE__ */ jsx(Button, {
								variant: "ghost",
								size: "sm",
								onClick: async () => {
									if (!await confirm({
										title: t("Delete CTA?"),
										message: t("Delete?"),
										confirmLabel: t("Delete"),
										danger: true
									})) return;
									router.delete(destroy$6.url({ ctaRule: r.id }), {
										preserveScroll: true,
										onError: (errors) => {
											const message = Object.values(errors)[0] ?? t("Could not delete CTA. Try again.");
											alert({
												title: t("Delete failed"),
												message: String(message),
												confirmLabel: t("OK")
											});
										},
										onSuccess: () => {
											router.reload({ only: ["rules"] });
										}
									});
								},
								children: /* @__PURE__ */ jsx(Trash2, { className: "size-4" })
							})]
						}, r.id))
					})]
				})
			]
		})]
	});
}
//#endregion
//#region resources/js/components/sortable-list.tsx
function SortableList({ items, keyOf, onReorder, children }) {
	const sensors = useSensors(useSensor(PointerSensor, { activationConstraint: { distance: 5 } }), useSensor(KeyboardSensor, { coordinateGetter: sortableKeyboardCoordinates }));
	const handle = (event) => {
		const { active, over } = event;
		if (!over || active.id === over.id) return;
		const oldIndex = items.findIndex((i) => keyOf(i) === active.id);
		const newIndex = items.findIndex((i) => keyOf(i) === over.id);
		if (oldIndex < 0 || newIndex < 0) return;
		onReorder(arrayMove(items, oldIndex, newIndex).map(keyOf));
	};
	return /* @__PURE__ */ jsx(DndContext, {
		sensors,
		collisionDetection: closestCenter,
		onDragEnd: handle,
		children: /* @__PURE__ */ jsx(SortableContext, {
			items: items.map(keyOf),
			strategy: verticalListSortingStrategy,
			children: /* @__PURE__ */ jsx("ul", {
				className: "divide-y",
				children: items.map((item) => /* @__PURE__ */ jsx(SortableItem, {
					id: keyOf(item),
					children: children(item)
				}, keyOf(item)))
			})
		})
	});
}
function SortableItem({ id, children }) {
	const { t } = useT();
	const { attributes, listeners, setNodeRef, transform, transition, isDragging } = useSortable({ id });
	return /* @__PURE__ */ jsxs("li", {
		ref: setNodeRef,
		style: {
			transform: CSS.Transform.toString(transform),
			transition,
			opacity: isDragging ? .6 : 1
		},
		className: "flex items-start gap-2 py-2",
		children: [/* @__PURE__ */ jsx("button", {
			type: "button",
			className: "mt-1 cursor-grab text-muted-foreground hover:text-foreground active:cursor-grabbing",
			"aria-label": t("Drag to reorder"),
			...attributes,
			...listeners,
			children: /* @__PURE__ */ jsx(GripVertical, { className: "size-4" })
		}), /* @__PURE__ */ jsx("div", {
			className: "min-w-0 flex-1",
			children
		})]
	});
}
//#endregion
//#region resources/js/pages/app/agents/curated.tsx
var curated_exports = /* @__PURE__ */ __exportAll({ default: () => Curated });
function Curated({ agent, workspace_slug, answers }) {
	const { t } = useT();
	const confirm = useConfirm();
	const prompt = usePrompt();
	const form = useForm({
		question_pattern: "",
		answer: "",
		priority: 0,
		kb_title: "",
		kb_published: false
	});
	const togglePublish = (a) => {
		router.patch(`/app/curated-answers/${a.id}`, { kb_published: !a.kb_published }, {
			preserveScroll: true,
			only: ["answers"]
		});
	};
	const renameKbTitle = (a, title) => {
		router.patch(`/app/curated-answers/${a.id}`, { kb_title: title }, {
			preserveScroll: true,
			only: ["answers"]
		});
	};
	return /* @__PURE__ */ jsxs(AppLayout, {
		breadcrumbs: [
			{
				title: t("Agents"),
				href: index$12.url()
			},
			{
				title: agent.name,
				href: show$4({ agent: agent.id }).url
			},
			{
				title: t("Curated answers"),
				href: index$20({ agent: agent.id }).url
			}
		],
		children: [/* @__PURE__ */ jsx(Head, { title: `${agent.name} · curated` }), /* @__PURE__ */ jsxs("div", {
			className: "flex flex-1 flex-col gap-4 p-4",
			children: [
				/* @__PURE__ */ jsx("h1", {
					className: "text-2xl font-semibold tracking-tight",
					children: t("Curated answers")
				}),
				/* @__PURE__ */ jsx("p", {
					className: "text-sm text-muted-foreground",
					children: t("Predefined responses that short-circuit the LLM when the visitor's message contains the pattern.")
				}),
				/* @__PURE__ */ jsxs(Card, {
					className: "max-w-5xl gap-0 overflow-hidden border-border/80",
					children: [/* @__PURE__ */ jsx(CardHeader, {
						className: "border-b bg-muted/20 px-4 py-4 sm:px-5",
						children: /* @__PURE__ */ jsxs("div", {
							className: "flex items-start gap-3",
							children: [/* @__PURE__ */ jsx("span", {
								className: "flex size-9 shrink-0 items-center justify-center rounded-md border bg-background text-muted-foreground shadow-xs",
								children: /* @__PURE__ */ jsx(Sparkles, { className: "size-4" })
							}), /* @__PURE__ */ jsxs("div", {
								className: "min-w-0",
								children: [/* @__PURE__ */ jsx(CardTitle, {
									className: "text-sm",
									children: t("Add a curated answer")
								}), /* @__PURE__ */ jsx(CardDescription, {
									className: "mt-1 text-xs leading-5",
									children: t("Use curated answers for questions that should always return the same exact copy.")
								})]
							})]
						})
					}), /* @__PURE__ */ jsxs("form", {
						onSubmit: (e) => {
							e.preventDefault();
							form.post(`/app/agents/${agent.id}/curated`, { onSuccess: () => form.reset() });
						},
						children: [/* @__PURE__ */ jsxs(CardContent, {
							className: "grid gap-4 px-4 py-4 sm:px-5 sm:py-5",
							children: [
								/* @__PURE__ */ jsxs("div", {
									className: "grid gap-1.5",
									children: [
										/* @__PURE__ */ jsx(Label, {
											htmlFor: "pattern",
											children: t("Match if visitor's message contains")
										}),
										/* @__PURE__ */ jsx(Input, {
											id: "pattern",
											value: form.data.question_pattern,
											placeholder: t("pricing, refund policy, shipping time"),
											"aria-invalid": Boolean(form.errors.question_pattern),
											onChange: (e) => form.setData("question_pattern", e.target.value)
										}),
										/* @__PURE__ */ jsx("p", {
											className: "text-xs text-muted-foreground",
											children: t("Use a short phrase or keyword set the bot should recognize before reaching for the LLM.")
										}),
										/* @__PURE__ */ jsx(InputError, { message: form.errors.question_pattern })
									]
								}),
								/* @__PURE__ */ jsxs("div", {
									className: "grid gap-1.5",
									children: [
										/* @__PURE__ */ jsxs("div", {
											className: "flex items-center justify-between gap-3",
											children: [/* @__PURE__ */ jsx(Label, {
												htmlFor: "answer",
												children: t("Answer")
											}), /* @__PURE__ */ jsx("span", {
												className: "text-xs text-muted-foreground tabular-nums",
												children: t(":count chars", { count: form.data.answer.length })
											})]
										}),
										/* @__PURE__ */ jsx(Textarea, {
											id: "answer",
											rows: 5,
											value: form.data.answer,
											onChange: (e) => form.setData("answer", e.target.value),
											className: "min-h-36 resize-y leading-6",
											"aria-invalid": Boolean(form.errors.answer),
											placeholder: t("Our plans start at $49/month and include...")
										}),
										/* @__PURE__ */ jsx(InputError, { message: form.errors.answer })
									]
								}),
								/* @__PURE__ */ jsxs("div", {
									className: "grid gap-1.5 border-t pt-4",
									children: [
										/* @__PURE__ */ jsxs("div", {
											className: "flex items-center gap-2",
											children: [/* @__PURE__ */ jsx(BookOpen, { className: "size-4 text-muted-foreground" }), /* @__PURE__ */ jsx(Label, {
												htmlFor: "kb_title",
												className: "font-medium",
												children: t("Knowledge base article")
											})]
										}),
										/* @__PURE__ */ jsx(Input, {
											id: "kb_title",
											value: form.data.kb_title,
											placeholder: t("Optional: page title for the public KB page"),
											onChange: (e) => form.setData("kb_title", e.target.value)
										}),
										/* @__PURE__ */ jsxs("label", {
											className: "flex cursor-pointer items-center gap-2 text-sm",
											children: [/* @__PURE__ */ jsx("input", {
												type: "checkbox",
												checked: form.data.kb_published,
												onChange: (e) => form.setData("kb_published", e.target.checked)
											}), /* @__PURE__ */ jsx("span", { children: t("Publish to /kb (visible to anyone with the link)") })]
										}),
										/* @__PURE__ */ jsx("p", {
											className: "text-xs text-muted-foreground",
											children: t("When published, this answer renders at /kb/:slug/<auto-slug> and the agent can cite it via the send_kb_article tool.", { slug: workspace_slug ?? "<slug>" })
										}),
										/* @__PURE__ */ jsx(InputError, { message: form.errors.kb_title })
									]
								})
							]
						}), /* @__PURE__ */ jsx(CardFooter, {
							className: "flex flex-col-reverse gap-2 border-t bg-muted/10 px-4 py-4 sm:flex-row sm:justify-end sm:px-5",
							children: /* @__PURE__ */ jsx(Button, {
								type: "submit",
								disabled: form.processing,
								className: "w-full sm:w-auto",
								children: t("Add answer")
							})
						})]
					})]
				}),
				/* @__PURE__ */ jsxs(Card, {
					className: "p-4",
					children: [/* @__PURE__ */ jsx("h2", {
						className: "mb-3 font-medium",
						children: t("Existing (drag to reorder — top = highest priority)")
					}), answers.length === 0 ? /* @__PURE__ */ jsx(EmptyState, {
						icon: Sparkles,
						title: t("No curated answers yet"),
						description: t("Curated answers are exact responses the bot returns when a visitor's question matches a pattern — useful for pricing, returns, hours, anything you want answered the same way every time without an LLM call.")
					}) : /* @__PURE__ */ jsx(SortableList, {
						items: answers,
						keyOf: (a) => a.id,
						onReorder: (orderedIds) => router.post(`/app/agents/${agent.id}/curated/reorder`, { order: orderedIds }, {
							preserveScroll: true,
							only: ["answers"]
						}),
						children: (a) => /* @__PURE__ */ jsxs("div", {
							className: "flex items-start justify-between gap-3",
							children: [/* @__PURE__ */ jsxs("div", {
								className: "min-w-0 flex-1",
								children: [
									/* @__PURE__ */ jsxs("p", {
										className: "flex items-center gap-2 text-sm font-medium",
										children: [
											t("if message contains:"),
											" ",
											/* @__PURE__ */ jsx("em", { children: a.question_pattern }),
											a.is_suggested && /* @__PURE__ */ jsxs("span", {
												className: "inline-flex items-center gap-1 rounded bg-amber-500/15 px-2 py-0.5 text-xs text-amber-700 dark:text-amber-400",
												children: [
													/* @__PURE__ */ jsx(Sparkles, { className: "size-3" }),
													" ",
													t("Suggested")
												]
											}),
											!a.enabled && !a.is_suggested && /* @__PURE__ */ jsx("span", {
												className: "rounded bg-muted px-2 py-0.5 text-xs text-muted-foreground",
												children: t("Disabled")
											})
										]
									}),
									/* @__PURE__ */ jsx("p", {
										className: "mt-1 text-sm whitespace-pre-wrap text-muted-foreground",
										children: a.answer
									}),
									/* @__PURE__ */ jsxs("div", {
										className: "mt-2 flex flex-wrap items-center gap-2 text-xs",
										children: [
											/* @__PURE__ */ jsxs("button", {
												type: "button",
												onClick: () => togglePublish(a),
												className: "inline-flex items-center gap-1 rounded-full border px-2 py-0.5 font-medium transition " + (a.kb_published ? "border-emerald-200 bg-emerald-50 text-emerald-800 hover:bg-emerald-100 dark:border-emerald-500/30 dark:bg-emerald-500/10 dark:text-emerald-300" : "border-border bg-muted/30 text-muted-foreground hover:bg-muted"),
												title: a.kb_published ? t("Click to unpublish from /kb") : t("Click to publish to /kb"),
												children: [/* @__PURE__ */ jsx(BookOpen, { className: "size-3" }), a.kb_published ? t("KB published") : t("Publish to KB")]
											}),
											a.kb_published && a.kb_url && /* @__PURE__ */ jsxs("a", {
												href: a.kb_url,
												target: "_blank",
												rel: "noopener noreferrer",
												className: "inline-flex items-center gap-1 rounded-full border border-border bg-card px-2 py-0.5 font-mono text-[11px] text-muted-foreground hover:bg-muted",
												children: [a.kb_url, /* @__PURE__ */ jsx(ExternalLink, { className: "size-3" })]
											}),
											a.kb_published && /* @__PURE__ */ jsx("button", {
												type: "button",
												onClick: async () => {
													const next = await prompt({
														title: t("KB article title"),
														message: t("KB article title (used as the H1 + page title)"),
														defaultValue: a.kb_title ?? "",
														placeholder: t("e.g. How to reset your password"),
														confirmLabel: t("Save"),
														validate: (v) => v.trim() === "" ? t("Title cannot be empty.") : null
													});
													if (next !== null) renameKbTitle(a, next);
												},
												className: "rounded-full border border-border bg-card px-2 py-0.5 text-[11px] text-muted-foreground hover:bg-muted",
												children: a.kb_title ? t("Title: \":title\"", { title: a.kb_title }) : t("Set KB title")
											})
										]
									})
								]
							}), /* @__PURE__ */ jsxs("div", {
								className: "flex items-start gap-1",
								children: [a.is_suggested && /* @__PURE__ */ jsx(Button, {
									variant: "outline",
									size: "sm",
									onClick: () => router.post(`/app/curated-answers/${a.id}/approve`),
									children: t("Approve")
								}), /* @__PURE__ */ jsx(Button, {
									variant: "ghost",
									size: "sm",
									onClick: async () => {
										if (!await confirm({
											title: a.is_suggested ? t("Reject suggestion?") : t("Delete curated answer?"),
											message: a.is_suggested ? t("Reject this suggestion?") : t("Delete?"),
											confirmLabel: a.is_suggested ? t("Reject") : t("Delete"),
											danger: true
										})) return;
										router.delete(`/app/curated-answers/${a.id}`);
									},
									children: /* @__PURE__ */ jsx(Trash2, { className: "size-4" })
								})]
							})]
						})
					})]
				})
			]
		})]
	});
}
//#endregion
//#region resources/js/components/agents/lead-form-builder.tsx
var RESERVED_KEYS = new Set([
	"email",
	"name",
	"phone"
]);
var PII_FLAG_KEYS = new Set([
	"ssn",
	"passport",
	"national_id",
	"tax_id",
	"credit_card",
	"cc_number",
	"date_of_birth",
	"dob"
]);
var MAX_FIELDS = 12;
/**
* Per-agent lead-form schema editor (#34). Stores a list of field
* definitions on `agents.lead_form_fields`; the widget renders the
* same list in both `<LeadForm/>` and `<PreChatGate/>`. Null = use
* the default Name + Email shape.
*
* Reordering uses simple ↑/↓ buttons rather than dnd-kit to keep
* the bundle small and the surface accessible — drag-drop on a
* narrow form-builder card was a UX overreach.
*/
function LeadFormBuilder({ value, onChange }) {
	const { t } = useT();
	const TYPE_OPTIONS = [
		{
			value: "text",
			label: t("Text")
		},
		{
			value: "email",
			label: t("Email")
		},
		{
			value: "tel",
			label: t("Phone")
		},
		{
			value: "textarea",
			label: t("Long text")
		},
		{
			value: "select",
			label: t("Dropdown")
		},
		{
			value: "checkbox",
			label: t("Checkbox")
		}
	];
	const PRESETS = [
		{
			id: "classic",
			label: t("Classic — Name + Email"),
			fields: [{
				key: "name",
				label: t("Your name"),
				type: "text",
				required: false,
				placeholder: t("Optional")
			}, {
				key: "email",
				label: t("Email"),
				type: "email",
				required: true,
				placeholder: "email@example.com"
			}]
		},
		{
			id: "b2b",
			label: t("B2B SaaS — Name, Work email, Company, Team size"),
			fields: [
				{
					key: "name",
					label: t("Your name"),
					type: "text",
					required: true
				},
				{
					key: "email",
					label: t("Work email"),
					type: "email",
					required: true,
					placeholder: "name@company.com"
				},
				{
					key: "company",
					label: t("Company"),
					type: "text",
					required: true,
					maxlength: 120
				},
				{
					key: "team_size",
					label: t("Team size"),
					type: "select",
					required: false,
					options: [
						"1-10",
						"11-50",
						"51-200",
						"201+"
					]
				}
			]
		},
		{
			id: "support",
			label: t("Support — Email + Order ID + Issue category"),
			fields: [
				{
					key: "email",
					label: t("Email"),
					type: "email",
					required: true
				},
				{
					key: "order_id",
					label: t("Order ID"),
					type: "text",
					required: false,
					placeholder: t("e.g. #12345")
				},
				{
					key: "issue_category",
					label: t("Issue category"),
					type: "select",
					required: true,
					options: [
						t("Order status"),
						t("Refund / return"),
						t("Product question"),
						t("Other")
					]
				}
			]
		},
		{
			id: "gdpr",
			label: t("GDPR-friendly — Email + Consent checkbox"),
			fields: [{
				key: "email",
				label: t("Email"),
				type: "email",
				required: true
			}, {
				key: "consent",
				label: t("I agree to be contacted about my enquiry"),
				type: "checkbox",
				required: true
			}]
		}
	];
	const fields = value ?? [];
	const customized = value !== null;
	const [openIdx, setOpenIdx] = useState(customized && fields.length > 0 ? 0 : null);
	const apply = (next) => {
		onChange(next);
	};
	const addField = () => {
		if (fields.length >= MAX_FIELDS) return;
		const newField = {
			key: `field_${fields.length + 1}`,
			label: t("New field"),
			type: "text",
			required: false
		};
		apply([...fields, newField]);
		setOpenIdx(fields.length);
	};
	const removeField = (i) => {
		const next = fields.filter((_, idx) => idx !== i);
		apply(next.length === 0 ? [] : next);
		setOpenIdx(null);
	};
	const moveField = (i, dir) => {
		const j = i + dir;
		if (j < 0 || j >= fields.length) return;
		const next = fields.slice();
		[next[i], next[j]] = [next[j], next[i]];
		apply(next);
		setOpenIdx(j);
	};
	const updateField = (i, patch) => {
		const next = fields.slice();
		next[i] = {
			...next[i],
			...patch
		};
		apply(next);
	};
	const usePreset = (presetId) => {
		const preset = PRESETS.find((p) => p.id === presetId);
		if (preset) {
			apply(preset.fields.map((f) => ({ ...f })));
			setOpenIdx(0);
		}
	};
	const reset = () => {
		onChange(null);
		setOpenIdx(null);
	};
	return /* @__PURE__ */ jsx("div", {
		className: "grid gap-3",
		children: !customized ? /* @__PURE__ */ jsxs("div", {
			className: "rounded-md border bg-muted/20 p-3",
			children: [
				/* @__PURE__ */ jsxs("p", {
					className: "text-sm text-foreground",
					children: [
						t("Default shape:"),
						" ",
						/* @__PURE__ */ jsx("strong", { children: t("Name + Email") }),
						"."
					]
				}),
				/* @__PURE__ */ jsx("p", {
					className: "mt-1 text-xs leading-5 text-muted-foreground",
					children: t("Visitors see a name field (optional) and an email field (required). Customize to ask for company, order ID, consent, or whatever your sales / support flow needs.")
				}),
				/* @__PURE__ */ jsxs("div", {
					className: "mt-3 flex flex-wrap gap-2",
					children: [/* @__PURE__ */ jsx(Button, {
						type: "button",
						size: "sm",
						onClick: () => apply([]),
						children: t("Customize")
					}), /* @__PURE__ */ jsxs(Select, {
						onValueChange: usePreset,
						children: [/* @__PURE__ */ jsx(SelectTrigger, {
							className: "w-auto",
							children: /* @__PURE__ */ jsx(SelectValue, { placeholder: t("Start from a preset…") })
						}), /* @__PURE__ */ jsx(SelectContent, { children: PRESETS.map((p) => /* @__PURE__ */ jsx(SelectItem, {
							value: p.id,
							children: p.label
						}, p.id)) })]
					})]
				})
			]
		}) : /* @__PURE__ */ jsxs(Fragment$1, { children: [
			fields.length === 0 && /* @__PURE__ */ jsx("div", {
				className: "rounded-md border bg-amber-50 p-3 text-xs text-amber-900 dark:bg-amber-950/40 dark:text-amber-100",
				children: t("No fields yet — visitors will see an empty form. Add at least an Email field.")
			}),
			/* @__PURE__ */ jsx("ul", {
				className: "grid gap-2",
				children: fields.map((field, i) => {
					const isOpen = openIdx === i;
					const isReserved = RESERVED_KEYS.has(field.key);
					const isPiiFlag = PII_FLAG_KEYS.has(field.key);
					return /* @__PURE__ */ jsxs("li", {
						className: "rounded-md border bg-background",
						children: [/* @__PURE__ */ jsxs("div", {
							className: "flex items-center gap-2 px-3 py-2",
							children: [/* @__PURE__ */ jsxs("button", {
								type: "button",
								onClick: () => setOpenIdx(isOpen ? null : i),
								className: "flex flex-1 flex-wrap items-center gap-2 text-start",
								children: [
									/* @__PURE__ */ jsx("span", {
										className: "min-w-0 truncate font-mono text-[11px] text-muted-foreground",
										children: field.key
									}),
									/* @__PURE__ */ jsx("span", {
										className: "min-w-0 truncate text-sm font-medium text-foreground",
										children: field.label
									}),
									/* @__PURE__ */ jsx("span", {
										className: "shrink-0 rounded-full border bg-muted/50 px-2 py-0.5 text-[10px] text-muted-foreground uppercase",
										children: field.type
									}),
									field.required && /* @__PURE__ */ jsx("span", {
										className: "shrink-0 rounded-full border border-rose-300 bg-rose-50 px-2 py-0.5 text-[10px] font-medium text-rose-700 dark:border-rose-500/30 dark:bg-rose-950/40 dark:text-rose-300",
										children: t("required")
									}),
									isReserved && /* @__PURE__ */ jsx("span", {
										className: "shrink-0 rounded-full border border-emerald-300 bg-emerald-50 px-2 py-0.5 text-[10px] font-medium text-emerald-700 dark:border-emerald-500/30 dark:bg-emerald-950/40 dark:text-emerald-300",
										title: t("Reserved key — maps onto Lead.email / .name / .phone columns"),
										children: t("reserved")
									}),
									isPiiFlag && /* @__PURE__ */ jsx("span", {
										className: "shrink-0 rounded-full border border-amber-300 bg-amber-50 px-2 py-0.5 text-[10px] font-medium text-amber-800 dark:border-amber-500/30 dark:bg-amber-950/40 dark:text-amber-200",
										title: t("High-sensitivity field name. Are you sure you want to store this?"),
										children: t("PII")
									}),
									/* @__PURE__ */ jsx("span", { className: "ms-auto" })
								]
							}), /* @__PURE__ */ jsxs("div", {
								className: "flex items-center gap-1",
								children: [
									/* @__PURE__ */ jsx(Button, {
										type: "button",
										size: "icon",
										variant: "ghost",
										disabled: i === 0,
										onClick: () => moveField(i, -1),
										"aria-label": t("Move up"),
										children: /* @__PURE__ */ jsx(ChevronUp, { className: "size-4" })
									}),
									/* @__PURE__ */ jsx(Button, {
										type: "button",
										size: "icon",
										variant: "ghost",
										disabled: i === fields.length - 1,
										onClick: () => moveField(i, 1),
										"aria-label": t("Move down"),
										children: /* @__PURE__ */ jsx(ChevronDown, { className: "size-4" })
									}),
									/* @__PURE__ */ jsx(Button, {
										type: "button",
										size: "icon",
										variant: "ghost",
										onClick: () => removeField(i),
										"aria-label": t("Remove field"),
										children: /* @__PURE__ */ jsx(Trash2, { className: "size-4" })
									})
								]
							})]
						}), isOpen && /* @__PURE__ */ jsxs("div", {
							className: "grid gap-3 border-t p-3",
							children: [
								/* @__PURE__ */ jsxs("div", {
									className: "grid gap-2 sm:grid-cols-2",
									children: [/* @__PURE__ */ jsxs("div", {
										className: "grid gap-1",
										children: [
											/* @__PURE__ */ jsx(Label, {
												htmlFor: `field-${i}-key`,
												children: t("Key")
											}),
											/* @__PURE__ */ jsx(Input, {
												id: `field-${i}-key`,
												value: field.key,
												onChange: (e) => updateField(i, { key: e.target.value.toLowerCase().replace(/[^a-z0-9_]/g, "_") }),
												className: "font-mono text-xs"
											}),
											/* @__PURE__ */ jsxs("p", {
												className: "text-[11px] text-muted-foreground",
												children: [
													t("Lowercase, digits, underscores. Reserved keys"),
													" ",
													/* @__PURE__ */ jsx("code", { children: "email" }),
													",",
													" ",
													/* @__PURE__ */ jsx("code", { children: "name" }),
													",",
													" ",
													/* @__PURE__ */ jsx("code", { children: "phone" }),
													" ",
													t("map onto Lead columns.")
												]
											})
										]
									}), /* @__PURE__ */ jsxs("div", {
										className: "grid gap-1",
										children: [/* @__PURE__ */ jsx(Label, {
											htmlFor: `field-${i}-label`,
											children: t("Label")
										}), /* @__PURE__ */ jsx(Input, {
											id: `field-${i}-label`,
											value: field.label,
											onChange: (e) => updateField(i, { label: e.target.value })
										})]
									})]
								}),
								/* @__PURE__ */ jsxs("div", {
									className: "grid gap-2 sm:grid-cols-2",
									children: [/* @__PURE__ */ jsxs("div", {
										className: "grid gap-1",
										children: [/* @__PURE__ */ jsx(Label, {
											htmlFor: `field-${i}-type`,
											children: t("Type")
										}), /* @__PURE__ */ jsxs(Select, {
											value: field.type,
											onValueChange: (v) => updateField(i, { type: v }),
											children: [/* @__PURE__ */ jsx(SelectTrigger, {
												id: `field-${i}-type`,
												children: /* @__PURE__ */ jsx(SelectValue, {})
											}), /* @__PURE__ */ jsx(SelectContent, { children: TYPE_OPTIONS.map((t) => /* @__PURE__ */ jsx(SelectItem, {
												value: t.value,
												children: t.label
											}, t.value)) })]
										})]
									}), /* @__PURE__ */ jsx("div", {
										className: "flex items-end",
										children: /* @__PURE__ */ jsxs("label", {
											className: "flex cursor-pointer items-center gap-2 text-sm",
											children: [/* @__PURE__ */ jsx("input", {
												type: "checkbox",
												checked: field.required === true,
												onChange: (e) => updateField(i, { required: e.target.checked }),
												className: "size-4 rounded border-border focus:ring-2 focus:ring-ring/40"
											}), t("Required")]
										})
									})]
								}),
								field.type !== "checkbox" && /* @__PURE__ */ jsxs("div", {
									className: "grid gap-2 sm:grid-cols-2",
									children: [/* @__PURE__ */ jsxs("div", {
										className: "grid gap-1",
										children: [/* @__PURE__ */ jsx(Label, {
											htmlFor: `field-${i}-placeholder`,
											children: t("Placeholder")
										}), /* @__PURE__ */ jsx(Input, {
											id: `field-${i}-placeholder`,
											value: field.placeholder ?? "",
											onChange: (e) => updateField(i, { placeholder: e.target.value })
										})]
									}), (field.type === "text" || field.type === "textarea") && /* @__PURE__ */ jsxs("div", {
										className: "grid gap-1",
										children: [/* @__PURE__ */ jsx(Label, {
											htmlFor: `field-${i}-maxlength`,
											children: t("Max length")
										}), /* @__PURE__ */ jsx(Input, {
											id: `field-${i}-maxlength`,
											type: "number",
											min: 1,
											max: 4e3,
											value: field.maxlength ?? "",
											onChange: (e) => updateField(i, { maxlength: e.target.value === "" ? null : parseInt(e.target.value, 10) })
										})]
									})]
								}),
								field.type === "select" && /* @__PURE__ */ jsxs("div", {
									className: "grid gap-1",
									children: [/* @__PURE__ */ jsx(Label, {
										htmlFor: `field-${i}-options`,
										children: t("Options (one per line)")
									}), /* @__PURE__ */ jsx("textarea", {
										id: `field-${i}-options`,
										rows: 4,
										value: (field.options ?? []).join("\n"),
										onChange: (e) => updateField(i, { options: e.target.value.split("\n").map((s) => s.trim()).filter((s) => s !== "") }),
										className: "rounded-md border bg-background px-3 py-2 text-sm"
									})]
								})
							]
						})]
					}, i);
				})
			}),
			/* @__PURE__ */ jsxs("div", {
				className: "flex flex-wrap items-center justify-between gap-2",
				children: [/* @__PURE__ */ jsxs(Button, {
					type: "button",
					variant: "outline",
					size: "sm",
					disabled: fields.length >= MAX_FIELDS,
					onClick: addField,
					children: [
						/* @__PURE__ */ jsx(Plus, { className: "size-3.5" }),
						" ",
						t("Add field")
					]
				}), /* @__PURE__ */ jsxs("div", {
					className: "flex items-center gap-2",
					children: [/* @__PURE__ */ jsxs(Select, {
						onValueChange: usePreset,
						children: [/* @__PURE__ */ jsx(SelectTrigger, {
							className: "w-auto",
							children: /* @__PURE__ */ jsx(SelectValue, { placeholder: t("Replace with preset…") })
						}), /* @__PURE__ */ jsx(SelectContent, { children: PRESETS.map((p) => /* @__PURE__ */ jsx(SelectItem, {
							value: p.id,
							children: p.label
						}, p.id)) })]
					}), /* @__PURE__ */ jsx(Button, {
						type: "button",
						variant: "ghost",
						size: "sm",
						onClick: reset,
						children: t("Reset to default")
					})]
				})]
			}),
			/* @__PURE__ */ jsx("p", {
				className: "text-[11px] text-muted-foreground tabular-nums",
				children: t(":used/:max fields used. Required fields are enforced both by the widget and on the server.", {
					used: fields.length,
					max: MAX_FIELDS
				})
			})
		] })
	});
}
//#endregion
//#region resources/js/pages/app/agents/customize.tsx
var customize_exports = /* @__PURE__ */ __exportAll({ default: () => Customize });
function usePositionOptions() {
	const { t } = useT();
	return [
		{
			value: "bottom-center",
			title: t("Centered bar"),
			blurb: t("Default — the omnibar sits across the bottom-center of the page.")
		},
		{
			value: "bottom-right",
			title: t("Bottom right"),
			blurb: t("Floating bubble pinned to the bottom-right corner. Familiar Intercom / Drift / Tawk style.")
		},
		{
			value: "bottom-left",
			title: t("Bottom left"),
			blurb: t("Same as right, mirrored. Good for sites whose right edge is busy with other widgets.")
		}
	];
}
var MAX_PROMPTS$1 = 6;
var MAX_PROMPT_LENGTH$1 = 80;
function CustomizeSection({ icon, title, description, children }) {
	return /* @__PURE__ */ jsxs("section", {
		className: "grid gap-5 border-b px-4 py-4 last:border-b-0 sm:px-5 sm:py-5 lg:grid-cols-[220px_1fr] lg:gap-8",
		children: [/* @__PURE__ */ jsxs("div", {
			className: "flex gap-3 lg:block",
			children: [/* @__PURE__ */ jsx("span", {
				className: "flex size-9 shrink-0 items-center justify-center rounded-md border bg-background text-muted-foreground shadow-xs lg:mb-3",
				children: icon
			}), /* @__PURE__ */ jsxs("div", {
				className: "min-w-0",
				children: [/* @__PURE__ */ jsx("h2", {
					className: "text-sm font-medium text-foreground",
					children: title
				}), /* @__PURE__ */ jsx("p", {
					className: "mt-1 max-w-sm text-xs leading-5 text-muted-foreground",
					children: description
				})]
			})]
		}), /* @__PURE__ */ jsx("div", {
			className: "grid gap-4",
			children
		})]
	});
}
function Customize({ agent }) {
	const { t } = useT();
	const brand = useBranding().site_title || "Pitchbar";
	const POSITION_OPTIONS = usePositionOptions();
	const breadcrumbs = [
		{
			title: t("Agents"),
			href: index$12.url()
		},
		{
			title: agent.name,
			href: show$4({ agent: agent.id }).url
		},
		{
			title: t("Customize"),
			href: customize({ agent: agent.id }).url
		}
	];
	const form = useForm({
		persona: agent.persona ?? {
			name: agent.name,
			tone: "friendly"
		},
		theme: agent.theme ?? {
			primary: "#111827",
			accent: "#10b981",
			radius: 12,
			position: "bottom-center",
			default_open: true
		},
		guardrails: agent.guardrails ?? {
			avoid: [],
			max_chars: 2500
		},
		starter_prompts: agent.starter_prompts ?? [],
		require_lead_before_chat: agent.require_lead_before_chat ?? false,
		lead_form_fields: agent.lead_form_fields ?? null,
		lead_prompt_strategy: agent.lead_prompt_strategy ?? "engagement"
	});
	const [pendingPrompt, setPendingPrompt] = useState("");
	const [iconUploading, setIconUploading] = useState(false);
	const [iconError, setIconError] = useState(null);
	const iconInputRef = useRef(null);
	const launcherIconUrl = form.data.theme.launcher_icon_url ?? null;
	const pickIcon = (e) => {
		const file = e.target.files?.[0];
		if (!file) return;
		setIconUploading(true);
		setIconError(null);
		const fd = new FormData();
		fd.append("icon", file);
		router.post(store$13.url({ agent: agent.id }), fd, {
			forceFormData: true,
			preserveScroll: true,
			preserveState: true,
			onSuccess: (page) => {
				const next = page.props.agent?.theme?.launcher_icon_url;
				if (next) form.setData("theme", {
					...form.data.theme,
					launcher_icon_url: next
				});
			},
			onError: (errors) => {
				setIconError(errors.icon ?? t("Upload failed. Try a smaller image."));
			},
			onFinish: () => {
				setIconUploading(false);
				if (iconInputRef.current) iconInputRef.current.value = "";
			}
		});
	};
	const removeIcon = () => {
		setIconError(null);
		router.delete(destroy$13.url({ agent: agent.id }), {
			preserveScroll: true,
			preserveState: true,
			onSuccess: () => {
				form.setData("theme", {
					...form.data.theme,
					launcher_icon_url: null
				});
			}
		});
	};
	const addPrompt = () => {
		const value = pendingPrompt.trim();
		if (!value || form.data.starter_prompts.length >= MAX_PROMPTS$1 || form.data.starter_prompts.includes(value)) return;
		form.setData("starter_prompts", [...form.data.starter_prompts, value.slice(0, MAX_PROMPT_LENGTH$1)]);
		setPendingPrompt("");
	};
	const removePrompt = (index) => {
		form.setData("starter_prompts", form.data.starter_prompts.filter((_, i) => i !== index));
	};
	const submit = (e) => {
		e.preventDefault();
		form.patch(update$11.url({ agent: agent.id }), { preserveScroll: true });
	};
	return /* @__PURE__ */ jsxs(AppLayout, {
		breadcrumbs,
		children: [/* @__PURE__ */ jsx(Head, { title: `${agent.name} · customize` }), /* @__PURE__ */ jsxs("div", {
			className: "grid flex-1 grid-cols-1 gap-4 p-4 lg:grid-cols-[minmax(640px,1fr)_minmax(360px,440px)]",
			children: [/* @__PURE__ */ jsxs(Card, {
				className: "gap-0 overflow-hidden border-border/80",
				children: [/* @__PURE__ */ jsxs(CardHeader, {
					className: "border-b bg-muted/20 px-4 py-4 sm:px-5",
					children: [/* @__PURE__ */ jsx(CardTitle, {
						className: "text-base",
						children: t("Customize widget voice and look")
					}), /* @__PURE__ */ jsx(CardDescription, { children: t("Tune how the agent presents itself before visitors ever send the first message.") })]
				}), /* @__PURE__ */ jsxs("form", {
					onSubmit: submit,
					children: [
						/* @__PURE__ */ jsx(CustomizeSection, {
							icon: /* @__PURE__ */ jsx(MessageSquareQuote, { className: "size-4" }),
							title: t("Persona"),
							description: t("Choose the name shown in the widget so the conversation feels branded and deliberate."),
							children: /* @__PURE__ */ jsxs("div", {
								className: "grid gap-1.5 sm:max-w-sm",
								children: [/* @__PURE__ */ jsx(Label, {
									htmlFor: "persona-name",
									children: t("Display name")
								}), /* @__PURE__ */ jsx(Input, {
									id: "persona-name",
									placeholder: t(":brand Assistant", { brand }),
									value: form.data.persona.name ?? "",
									onChange: (e) => form.setData("persona", {
										...form.data.persona,
										name: e.target.value
									})
								})]
							})
						}),
						/* @__PURE__ */ jsxs(CustomizeSection, {
							icon: /* @__PURE__ */ jsx(Palette, { className: "size-4" }),
							title: t("Theme"),
							description: t("Adjust the primary and accent colors used by the widget shell and call-to-action surfaces."),
							children: [/* @__PURE__ */ jsxs("div", {
								className: "grid gap-4 sm:grid-cols-2",
								children: [/* @__PURE__ */ jsxs("div", {
									className: "grid gap-1.5",
									children: [/* @__PURE__ */ jsx(Label, {
										htmlFor: "primary-color",
										children: t("Primary color")
									}), /* @__PURE__ */ jsx(Input, {
										id: "primary-color",
										type: "color",
										value: form.data.theme.primary ?? "#111827",
										onChange: (e) => form.setData("theme", {
											...form.data.theme,
											primary: e.target.value
										})
									})]
								}), /* @__PURE__ */ jsxs("div", {
									className: "grid gap-1.5",
									children: [/* @__PURE__ */ jsx(Label, {
										htmlFor: "accent-color",
										children: t("Accent")
									}), /* @__PURE__ */ jsx(Input, {
										id: "accent-color",
										type: "color",
										value: form.data.theme.accent ?? "#10b981",
										onChange: (e) => form.setData("theme", {
											...form.data.theme,
											accent: e.target.value
										})
									})]
								})]
							}), /* @__PURE__ */ jsxs("div", {
								className: "flex flex-wrap gap-2",
								children: [
									/* @__PURE__ */ jsx("span", {
										className: "text-xs text-muted-foreground",
										children: t("Preview swatches:")
									}),
									/* @__PURE__ */ jsxs("span", {
										className: "inline-flex items-center gap-2 rounded-full border bg-background px-2.5 py-1 text-xs text-muted-foreground",
										children: [/* @__PURE__ */ jsx("span", {
											className: "size-2.5 rounded-full",
											style: { background: form.data.theme.primary ?? "#111827" }
										}), t("Primary")]
									}),
									/* @__PURE__ */ jsxs("span", {
										className: "inline-flex items-center gap-2 rounded-full border bg-background px-2.5 py-1 text-xs text-muted-foreground",
										children: [/* @__PURE__ */ jsx("span", {
											className: "size-2.5 rounded-full",
											style: { background: form.data.theme.accent ?? "#10b981" }
										}), t("Accent")]
									})
								]
							})]
						}),
						/* @__PURE__ */ jsxs(CustomizeSection, {
							icon: /* @__PURE__ */ jsx(Image, { className: "size-4" }),
							title: t("Launcher"),
							description: t("Customize the launcher pill visitors first see — its icon, and whether the chat panel auto-opens on page load."),
							children: [
								/* @__PURE__ */ jsxs("div", {
									className: "grid gap-2",
									children: [
										/* @__PURE__ */ jsx(Label, { children: t("Custom icon") }),
										/* @__PURE__ */ jsx("p", {
											className: "text-xs leading-5 text-muted-foreground",
											children: t("Square PNG, JPG, WEBP, or SVG up to 256KB. Replaces the default purple orb.")
										}),
										/* @__PURE__ */ jsxs("div", {
											className: "flex flex-wrap items-center gap-3",
											children: [
												launcherIconUrl ? /* @__PURE__ */ jsx("img", {
													src: launcherIconUrl,
													alt: "",
													className: "size-12 rounded-full border border-border bg-white object-cover shadow-xs"
												}) : /* @__PURE__ */ jsx("div", {
													"aria-hidden": "true",
													className: "size-12 rounded-full shadow-xs",
													style: { background: "radial-gradient(circle at 30% 30%, #a78bfa 0%, #6366f1 35%, #1e1b4b 90%)" }
												}),
												/* @__PURE__ */ jsx("input", {
													ref: iconInputRef,
													type: "file",
													accept: "image/png,image/jpeg,image/webp,image/svg+xml",
													className: "hidden",
													onChange: pickIcon
												}),
												/* @__PURE__ */ jsx(Button, {
													type: "button",
													variant: "outline",
													disabled: iconUploading,
													onClick: () => iconInputRef.current?.click(),
													children: iconUploading ? t("Uploading…") : launcherIconUrl ? t("Replace icon") : t("Upload icon")
												}),
												launcherIconUrl && /* @__PURE__ */ jsxs(Button, {
													type: "button",
													variant: "ghost",
													onClick: removeIcon,
													disabled: iconUploading,
													children: [/* @__PURE__ */ jsx(Trash2, { className: "size-4" }), /* @__PURE__ */ jsx("span", {
														className: "ms-1",
														children: t("Remove")
													})]
												})
											]
										}),
										iconError && /* @__PURE__ */ jsx("p", {
											className: "text-xs text-destructive",
											children: iconError
										})
									]
								}),
								/* @__PURE__ */ jsxs("label", {
									className: "flex cursor-pointer items-start gap-3 rounded-md border bg-background p-3",
									children: [/* @__PURE__ */ jsx("input", {
										type: "checkbox",
										checked: form.data.theme.default_open !== false,
										onChange: (e) => form.setData("theme", {
											...form.data.theme,
											default_open: e.target.checked
										}),
										className: "mt-0.5 size-4 shrink-0 rounded border-border text-foreground focus:ring-2 focus:ring-ring/40"
									}), /* @__PURE__ */ jsxs("div", {
										className: "min-w-0",
										children: [/* @__PURE__ */ jsx("p", {
											className: "text-sm font-medium text-foreground",
											children: t("Auto-open on page load")
										}), /* @__PURE__ */ jsx("p", {
											className: "mt-1 text-xs leading-5 text-muted-foreground",
											children: t("When on, the chat panel is open by default the first time a visitor lands. Once a visitor closes the bar manually, that choice persists across reloads regardless of this setting.")
										})]
									})]
								}),
								/* @__PURE__ */ jsxs("div", {
									className: "grid gap-2",
									children: [/* @__PURE__ */ jsx(Label, { children: t("Launcher size") }), /* @__PURE__ */ jsx("div", {
										role: "radiogroup",
										"aria-label": t("Launcher size"),
										className: "grid grid-cols-3 gap-2",
										children: [
											"sm",
											"md",
											"lg"
										].map((sz) => {
											const checked = (form.data.theme.launcher_size ?? "md") === sz;
											return /* @__PURE__ */ jsxs("label", {
												className: `flex cursor-pointer items-center justify-center rounded-md border px-3 py-2 text-xs transition-colors ${checked ? "border-foreground bg-muted/30 ring-1 ring-foreground/20" : "border-border hover:border-foreground/40"}`,
												children: [/* @__PURE__ */ jsx("input", {
													type: "radio",
													name: "launcher_size",
													value: sz,
													checked,
													onChange: () => form.setData("theme", {
														...form.data.theme,
														launcher_size: sz
													}),
													className: "sr-only"
												}), sz === "sm" ? t("Small") : sz === "lg" ? t("Large") : t("Medium")]
											}, sz);
										})
									})]
								}),
								/* @__PURE__ */ jsxs("div", {
									className: "grid gap-2",
									children: [
										/* @__PURE__ */ jsx(Label, {
											htmlFor: "bar-width",
											children: t("Bar width")
										}),
										/* @__PURE__ */ jsxs("div", {
											className: "flex items-center gap-3",
											children: [/* @__PURE__ */ jsx("input", {
												id: "bar-width",
												type: "range",
												min: 320,
												max: 800,
												step: 20,
												value: form.data.theme.bar_width ?? 560,
												onChange: (e) => form.setData("theme", {
													...form.data.theme,
													bar_width: parseInt(e.target.value, 10)
												}),
												className: "flex-1"
											}), /* @__PURE__ */ jsxs("span", {
												className: "w-16 text-end font-mono text-xs text-muted-foreground tabular-nums",
												children: [form.data.theme.bar_width ?? 560, "px"]
											})]
										}),
										/* @__PURE__ */ jsx("p", {
											className: "text-xs leading-5 text-muted-foreground",
											children: t("Maximum bar width (320–800). Smaller bars feel less intrusive on landing pages; the widget auto-shrinks below this on narrow screens.")
										})
									]
								}),
								/* @__PURE__ */ jsxs("div", {
									className: "grid gap-2",
									children: [
										/* @__PURE__ */ jsx(Label, { children: t("Colour scheme") }),
										/* @__PURE__ */ jsx("div", {
											role: "radiogroup",
											"aria-label": t("Colour scheme"),
											className: "grid grid-cols-3 gap-2",
											children: [
												"light",
												"dark",
												"auto"
											].map((mode) => {
												const checked = (form.data.theme.color_scheme ?? "light") === mode;
												return /* @__PURE__ */ jsxs("label", {
													className: `flex cursor-pointer items-center justify-center rounded-md border px-3 py-2 text-xs transition-colors ${checked ? "border-foreground bg-muted/30 ring-1 ring-foreground/20" : "border-border hover:border-foreground/40"}`,
													children: [/* @__PURE__ */ jsx("input", {
														type: "radio",
														name: "color_scheme",
														value: mode,
														checked,
														onChange: () => form.setData("theme", {
															...form.data.theme,
															color_scheme: mode
														}),
														className: "sr-only"
													}), mode === "light" ? t("Light") : mode === "dark" ? t("Dark") : t("Auto")]
												}, mode);
											})
										}),
										/* @__PURE__ */ jsx("p", {
											className: "text-xs leading-5 text-muted-foreground",
											children: t("Auto follows the visitor’s OS preference (prefers-color-scheme).")
										})
									]
								}),
								/* @__PURE__ */ jsxs("div", {
									className: "grid gap-2",
									children: [
										/* @__PURE__ */ jsx(Label, {
											htmlFor: "header-logo-url",
											children: t("Header logo URL")
										}),
										/* @__PURE__ */ jsx(Input, {
											id: "header-logo-url",
											type: "url",
											placeholder: t("https://yourdomain.com/logo.svg"),
											value: form.data.theme.header_logo_url ?? "",
											onChange: (e) => form.setData("theme", {
												...form.data.theme,
												header_logo_url: e.target.value === "" ? null : e.target.value
											})
										}),
										/* @__PURE__ */ jsx("p", {
											className: "text-xs leading-5 text-muted-foreground",
											children: t("Optional small logo shown next to the persona name in the chat panel header.")
										})
									]
								})
							]
						}),
						/* @__PURE__ */ jsx(CustomizeSection, {
							icon: /* @__PURE__ */ jsx(LayoutPanelLeft, { className: "size-4" }),
							title: t("Position"),
							description: t("Where the widget sits on the page. Centered bar is the default; corner bubbles match the Intercom / Drift / Tawk pattern."),
							children: /* @__PURE__ */ jsx("div", {
								role: "radiogroup",
								"aria-label": t("Widget position"),
								className: "grid auto-rows-fr gap-2 sm:grid-cols-3",
								children: POSITION_OPTIONS.map((option) => {
									const checked = (form.data.theme.position ?? "bottom-center") === option.value;
									return /* @__PURE__ */ jsxs("label", {
										className: `flex h-full cursor-pointer flex-col gap-1 rounded-md border bg-background p-3 text-start transition-colors hover:border-foreground/40 ${checked ? "border-foreground bg-muted/30 ring-1 ring-foreground/20" : "border-border"}`,
										children: [
											/* @__PURE__ */ jsx("input", {
												type: "radio",
												name: "widget-position",
												value: option.value,
												checked,
												onChange: () => form.setData("theme", {
													...form.data.theme,
													position: option.value
												}),
												className: "sr-only"
											}),
											/* @__PURE__ */ jsx("span", {
												className: "text-sm font-medium text-foreground",
												children: option.title
											}),
											/* @__PURE__ */ jsx("span", {
												className: "text-xs leading-5 text-muted-foreground",
												children: option.blurb
											})
										]
									}, option.value);
								})
							})
						}),
						/* @__PURE__ */ jsx(CustomizeSection, {
							icon: /* @__PURE__ */ jsx(MailCheck, { className: "size-4" }),
							title: t("Pre-chat lead capture"),
							description: t("Optional gate that asks for a name + email before the chat surface unlocks. Higher capture rate; the visitor is still motivated to identify themselves."),
							children: /* @__PURE__ */ jsxs("label", {
								className: "flex cursor-pointer items-start gap-3 rounded-md border bg-background p-3",
								children: [/* @__PURE__ */ jsx("input", {
									type: "checkbox",
									checked: form.data.require_lead_before_chat,
									onChange: (e) => form.setData("require_lead_before_chat", e.target.checked),
									className: "mt-0.5 size-4 shrink-0 rounded border-border text-foreground focus:ring-2 focus:ring-ring/40"
								}), /* @__PURE__ */ jsxs("div", {
									className: "min-w-0",
									children: [/* @__PURE__ */ jsx("p", {
										className: "text-sm font-medium text-foreground",
										children: t("Require name + email before chat")
									}), /* @__PURE__ */ jsx("p", {
										className: "mt-1 text-xs leading-5 text-muted-foreground",
										children: t("When on, visitors see a Name + Email form before the chat panel opens. Once submitted, the chat unlocks on the same panel — no reload. The same visitor doesn't see the form again on refresh.")
									})]
								})]
							})
						}),
						/* @__PURE__ */ jsxs(CustomizeSection, {
							icon: /* @__PURE__ */ jsx(FormInput, { className: "size-4" }),
							title: t("Lead form fields"),
							description: t("Choose which fields the lead form asks for. The same schema renders both in the inline mid-chat form and the pre-chat gate."),
							children: [/* @__PURE__ */ jsx(LeadFormBuilder, {
								value: form.data.lead_form_fields,
								onChange: (next) => form.setData("lead_form_fields", next)
							}), /* @__PURE__ */ jsxs("div", {
								className: "mt-5 grid gap-2 rounded-md border bg-background p-3",
								children: [
									/* @__PURE__ */ jsx("p", {
										className: "text-sm font-medium text-foreground",
										children: t("When should the form appear?")
									}),
									/* @__PURE__ */ jsx("p", {
										className: "text-xs leading-5 text-muted-foreground",
										children: t("Pre-chat gate (above) shows the form before chat unlocks. This setting controls the in-chat (mid-conversation) prompt instead.")
									}),
									[
										{
											value: "engagement",
											title: t("After engagement (recommended)"),
											blurb: t("Surface on a high-intent keyword (pricing, demo, contact, etc.) OR after the visitor has sent 3 messages, whichever comes first.")
										},
										{
											value: "first_turn",
											title: t("On the visitor’s first message"),
											blurb: t("Prompt every visitor immediately on their first turn. Best for sales-led agents where every conversation is a lead.")
										},
										{
											value: "keyword_only",
											title: t("Only on intent keywords"),
											blurb: t("Wait for the visitor to ask about pricing, a demo, contact, etc. Skip the 3-turn engagement fallback.")
										},
										{
											value: "never",
											title: t("Never auto-prompt"),
											blurb: t("Disable the in-chat form. You handle lead capture another way (CTA card, escalation, etc.).")
										}
									].map((opt) => {
										const checked = form.data.lead_prompt_strategy === opt.value;
										return /* @__PURE__ */ jsxs("label", {
											className: `flex cursor-pointer gap-3 rounded-md border p-2.5 transition-colors ${checked ? "border-foreground/40 bg-muted/40" : "border-border"}`,
											children: [/* @__PURE__ */ jsx("input", {
												type: "radio",
												name: "lead_prompt_strategy",
												value: opt.value,
												checked,
												onChange: () => form.setData("lead_prompt_strategy", opt.value),
												className: "mt-0.5 size-4 shrink-0 text-foreground focus:ring-2 focus:ring-ring/40"
											}), /* @__PURE__ */ jsxs("div", {
												className: "min-w-0",
												children: [/* @__PURE__ */ jsx("p", {
													className: "text-sm font-medium text-foreground",
													children: opt.title
												}), /* @__PURE__ */ jsx("p", {
													className: "mt-0.5 text-xs leading-5 text-muted-foreground",
													children: opt.blurb
												})]
											})]
										}, opt.value);
									})
								]
							})]
						}),
						/* @__PURE__ */ jsx(CustomizeSection, {
							icon: /* @__PURE__ */ jsx(ShieldCheck, { className: "size-4" }),
							title: t("Guardrails"),
							description: t("Control how long replies can be so the assistant stays concise and readable inside the widget."),
							children: /* @__PURE__ */ jsxs("div", {
								className: "grid gap-1.5 sm:max-w-xs",
								children: [/* @__PURE__ */ jsx(Label, {
									htmlFor: "max-response-length",
									children: t("Max response length")
								}), /* @__PURE__ */ jsx(Input, {
									id: "max-response-length",
									type: "number",
									value: form.data.guardrails.max_chars ?? 2500,
									onChange: (e) => form.setData("guardrails", {
										...form.data.guardrails,
										max_chars: parseInt(e.target.value, 10)
									})
								})]
							})
						}),
						/* @__PURE__ */ jsxs(CustomizeSection, {
							icon: /* @__PURE__ */ jsx(Sparkles, { className: "size-4" }),
							title: t("Starter prompts"),
							description: t("Up to :max short questions shown before the conversation starts. Visitors can tap one to send it instantly.", { max: MAX_PROMPTS$1 }),
							children: [
								/* @__PURE__ */ jsxs("div", {
									className: "flex flex-wrap gap-2",
									children: [form.data.starter_prompts.map((prompt, index) => /* @__PURE__ */ jsxs("span", {
										className: "inline-flex items-center gap-1 rounded-full border bg-muted/50 px-3 py-1 text-xs",
										children: [prompt, /* @__PURE__ */ jsx("button", {
											type: "button",
											onClick: () => removePrompt(index),
											"aria-label": t("Remove \":prompt\"", { prompt }),
											className: "-me-1 rounded-full p-0.5 text-muted-foreground hover:text-foreground",
											children: /* @__PURE__ */ jsx(X, { className: "size-3" })
										})]
									}, `${prompt}-${index}`)), form.data.starter_prompts.length === 0 && /* @__PURE__ */ jsx("p", {
										className: "text-xs text-muted-foreground",
										children: t("No starter prompts yet.")
									})]
								}),
								/* @__PURE__ */ jsxs("div", {
									className: "flex flex-col gap-2 sm:flex-row",
									children: [/* @__PURE__ */ jsx(Input, {
										placeholder: t("e.g. What's your pricing?"),
										value: pendingPrompt,
										maxLength: MAX_PROMPT_LENGTH$1,
										disabled: form.data.starter_prompts.length >= MAX_PROMPTS$1,
										onChange: (e) => setPendingPrompt(e.target.value),
										onKeyDown: (e) => {
											if (e.key === "Enter") {
												e.preventDefault();
												addPrompt();
											}
										}
									}), /* @__PURE__ */ jsx(Button, {
										type: "button",
										variant: "outline",
										disabled: !pendingPrompt.trim() || form.data.starter_prompts.length >= MAX_PROMPTS$1,
										onClick: addPrompt,
										className: "w-full sm:w-auto",
										children: t("Add prompt")
									})]
								}),
								/* @__PURE__ */ jsx("p", {
									className: "text-xs text-muted-foreground tabular-nums",
									children: t(":used/:max prompts used · max :length chars each", {
										used: form.data.starter_prompts.length,
										max: MAX_PROMPTS$1,
										length: MAX_PROMPT_LENGTH$1
									})
								}),
								/* @__PURE__ */ jsxs("div", {
									className: "mt-3 grid gap-2 rounded-md border bg-background p-3",
									children: [
										/* @__PURE__ */ jsx(Label, { children: t("Chip placement") }),
										/* @__PURE__ */ jsx("div", {
											role: "radiogroup",
											"aria-label": t("Chip placement"),
											className: "grid grid-cols-2 gap-2",
											children: ["top", "bottom"].map((pos) => {
												const checked = (form.data.theme.starter_prompts_position ?? "top") === pos;
												return /* @__PURE__ */ jsxs("label", {
													className: `flex cursor-pointer items-center justify-center rounded-md border px-3 py-2 text-xs transition-colors ${checked ? "border-foreground bg-muted/30 ring-1 ring-foreground/20" : "border-border hover:border-foreground/40"}`,
													children: [/* @__PURE__ */ jsx("input", {
														type: "radio",
														name: "starter_prompts_position",
														value: pos,
														checked,
														onChange: () => form.setData("theme", {
															...form.data.theme,
															starter_prompts_position: pos
														}),
														className: "sr-only"
													}), pos === "top" ? t("Above bar") : t("Below bar")]
												}, pos);
											})
										}),
										/* @__PURE__ */ jsx("p", {
											className: "text-xs leading-5 text-muted-foreground",
											children: t("Where the suggestion chips render relative to the input bar. Above is the recommended default — easier to scan before the visitor starts typing.")
										})
									]
								})
							]
						}),
						/* @__PURE__ */ jsx(CardFooter, {
							className: "flex flex-col-reverse gap-2 border-t bg-muted/10 px-4 py-4 sm:flex-row sm:justify-end sm:px-5",
							children: /* @__PURE__ */ jsx(Button, {
								type: "submit",
								disabled: form.processing,
								className: "w-full sm:w-auto",
								children: t("Save customization")
							})
						})
					]
				})]
			}), /* @__PURE__ */ jsxs(Card, {
				className: "gap-0 self-start overflow-hidden lg:sticky lg:top-4",
				children: [/* @__PURE__ */ jsxs(CardHeader, {
					className: "border-b bg-muted/20 px-4 py-4 sm:px-5",
					children: [/* @__PURE__ */ jsx(CardTitle, {
						className: "text-base",
						children: t("Live preview")
					}), /* @__PURE__ */ jsx(CardDescription, { children: t("A quick approximation of how the widget will feel to a visitor.") })]
				}), /* @__PURE__ */ jsx(CardContent, {
					className: "px-4 py-5 sm:px-5",
					children: /* @__PURE__ */ jsxs("div", {
						className: "rounded-[24px] border bg-white p-4 shadow-sm",
						style: { borderRadius: form.data.theme.radius ?? 12 },
						children: [
							/* @__PURE__ */ jsxs("div", {
								className: "flex items-center justify-between gap-3",
								children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
									className: "text-sm font-medium text-slate-900",
									children: form.data.persona.name ?? agent.name
								}), /* @__PURE__ */ jsx("p", {
									className: "text-xs text-slate-500",
									children: t("Ready to help")
								})] }), /* @__PURE__ */ jsx("span", {
									className: "size-3 rounded-full",
									style: { background: form.data.theme.accent ?? "#10b981" }
								})]
							}),
							/* @__PURE__ */ jsxs("div", {
								className: "mt-4 space-y-3",
								children: [/* @__PURE__ */ jsx("div", {
									className: "max-w-[85%] rounded-2xl rounded-es-md bg-slate-100 px-3 py-2 text-sm text-slate-700",
									children: t("Hi! I can help with pricing, plans, or the best next step.")
								}), /* @__PURE__ */ jsx("div", {
									className: "ms-auto inline-flex max-w-[85%] rounded-2xl rounded-ee-md px-3 py-2 text-sm text-white",
									style: { background: form.data.theme.primary ?? "#111827" },
									children: t("Ask anything")
								})]
							}),
							form.data.starter_prompts.length > 0 && /* @__PURE__ */ jsx("div", {
								className: "mt-4 flex flex-wrap gap-2",
								children: form.data.starter_prompts.slice(0, 3).map((prompt, index) => /* @__PURE__ */ jsx("span", {
									className: "rounded-full border border-slate-200 px-3 py-1 text-xs text-slate-600",
									children: prompt
								}, `${prompt}-${index}`))
							})
						]
					})
				})]
			})]
		})]
	});
}
//#endregion
//#region resources/js/pages/app/agents/experiments.tsx
var experiments_exports = /* @__PURE__ */ __exportAll({ default: () => Experiments });
var STATUS_COLOR$1 = {
	draft: "bg-amber-500/15 text-amber-700 dark:text-amber-400",
	running: "bg-emerald-500/15 text-emerald-700 dark:text-emerald-400",
	stopped: "bg-zinc-500/15 text-zinc-700 dark:text-zinc-400"
};
function Experiments({ agent, experiments }) {
	const { t, tChoice } = useT();
	const confirm = useConfirm();
	const breadcrumbs = [
		{
			title: t("Agents"),
			href: index$12.url()
		},
		{
			title: agent.name,
			href: show$4({ agent: agent.id }).url
		},
		{
			title: t("Experiments"),
			href: index$13({ agent: agent.id }).url
		}
	];
	const form = useForm({
		name: "",
		kind: "cta",
		variants: [{
			name: "control",
			weight: 50,
			config: {}
		}, {
			name: "treatment",
			weight: 50,
			config: {}
		}]
	});
	const submit = (e) => {
		e.preventDefault();
		form.post(`/app/agents/${agent.id}/experiments`, { onSuccess: () => form.reset() });
	};
	return /* @__PURE__ */ jsxs(AppLayout, {
		breadcrumbs,
		children: [/* @__PURE__ */ jsx(Head, { title: `${agent.name} · experiments` }), /* @__PURE__ */ jsxs("div", {
			className: "flex flex-1 flex-col gap-4 p-4",
			children: [
				/* @__PURE__ */ jsx("h1", {
					className: "text-2xl font-semibold tracking-tight",
					children: t("A/B testing")
				}),
				/* @__PURE__ */ jsx("p", {
					className: "text-sm text-muted-foreground",
					children: t("Test persona, CTA, or trigger variations on a percentage of visitors. Sticky assignment per visitor.")
				}),
				/* @__PURE__ */ jsxs(Card, {
					className: "max-w-5xl gap-0 overflow-hidden border-border/80",
					children: [/* @__PURE__ */ jsx(CardHeader, {
						className: "border-b bg-muted/20 px-4 py-4 sm:px-5",
						children: /* @__PURE__ */ jsxs("div", {
							className: "flex items-start gap-3",
							children: [/* @__PURE__ */ jsx("span", {
								className: "flex size-9 shrink-0 items-center justify-center rounded-md border bg-background text-muted-foreground shadow-xs",
								children: /* @__PURE__ */ jsx(Beaker, { className: "size-4" })
							}), /* @__PURE__ */ jsxs("div", {
								className: "min-w-0",
								children: [/* @__PURE__ */ jsx(CardTitle, {
									className: "text-sm",
									children: t("Create experiment")
								}), /* @__PURE__ */ jsx(CardDescription, {
									className: "mt-1 text-xs leading-5",
									children: t("Test different personas, CTAs, or triggers on a portion of your traffic with sticky visitor assignment.")
								})]
							})]
						})
					}), /* @__PURE__ */ jsxs("form", {
						onSubmit: submit,
						children: [/* @__PURE__ */ jsxs(CardContent, {
							className: "grid gap-5 px-4 py-4 sm:px-5 sm:py-5",
							children: [/* @__PURE__ */ jsxs("div", {
								className: "grid gap-4 md:grid-cols-2",
								children: [/* @__PURE__ */ jsxs("div", {
									className: "grid gap-1.5",
									children: [
										/* @__PURE__ */ jsx(Label, {
											htmlFor: "name",
											children: t("Name")
										}),
										/* @__PURE__ */ jsx(Input, {
											id: "name",
											placeholder: t("CTA copy test"),
											value: form.data.name,
											"aria-invalid": Boolean(form.errors.name),
											onChange: (e) => form.setData("name", e.target.value)
										}),
										/* @__PURE__ */ jsx(InputError, { message: form.errors.name })
									]
								}), /* @__PURE__ */ jsxs("div", {
									className: "grid gap-1.5",
									children: [/* @__PURE__ */ jsx(Label, {
										htmlFor: "kind",
										children: t("Kind")
									}), /* @__PURE__ */ jsxs(Select, {
										value: form.data.kind,
										onValueChange: (value) => form.setData("kind", value),
										children: [/* @__PURE__ */ jsx(SelectTrigger, {
											id: "kind",
											children: /* @__PURE__ */ jsx(SelectValue, {})
										}), /* @__PURE__ */ jsxs(SelectContent, { children: [
											/* @__PURE__ */ jsx(SelectItem, {
												value: "persona",
												children: t("Persona")
											}),
											/* @__PURE__ */ jsx(SelectItem, {
												value: "cta",
												children: t("CTA")
											}),
											/* @__PURE__ */ jsx(SelectItem, {
												value: "trigger",
												children: t("Trigger")
											})
										] })]
									})]
								})]
							}), /* @__PURE__ */ jsxs("div", {
								className: "grid gap-3",
								children: [/* @__PURE__ */ jsxs("div", {
									className: "flex items-center justify-between gap-3",
									children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx(Label, { children: t("Variants") }), /* @__PURE__ */ jsx("p", {
										className: "mt-1 text-xs text-muted-foreground",
										children: t("Weights are relative traffic shares. Keep the total roughly balanced so comparisons stay readable.")
									})] }), /* @__PURE__ */ jsx(Button, {
										type: "button",
										variant: "outline",
										size: "sm",
										disabled: form.data.variants.length >= 5,
										onClick: () => form.setData("variants", [...form.data.variants, {
											name: `variant_${form.data.variants.length + 1}`,
											weight: 50,
											config: {}
										}]),
										children: t("Add variant")
									})]
								}), /* @__PURE__ */ jsx("div", {
									className: "grid gap-2 rounded-lg border bg-muted/15 p-3 sm:p-4",
									children: form.data.variants.map((variant, index) => /* @__PURE__ */ jsxs("div", {
										className: "grid gap-2 rounded-md border bg-background p-2 sm:grid-cols-[minmax(0,1fr)_96px_auto]",
										children: [
											/* @__PURE__ */ jsx(Input, {
												placeholder: t("Variant name"),
												value: variant.name,
												onChange: (e) => {
													const next = [...form.data.variants];
													next[index] = {
														...next[index],
														name: e.target.value
													};
													form.setData("variants", next);
												}
											}),
											/* @__PURE__ */ jsx(Input, {
												type: "number",
												min: 1,
												max: 100,
												value: variant.weight,
												onChange: (e) => {
													const next = [...form.data.variants];
													next[index] = {
														...next[index],
														weight: parseInt(e.target.value, 10)
													};
													form.setData("variants", next);
												}
											}),
											/* @__PURE__ */ jsx(Button, {
												type: "button",
												variant: "ghost",
												size: "sm",
												disabled: form.data.variants.length <= 2,
												onClick: () => {
													form.setData("variants", form.data.variants.filter((_, i) => i !== index));
												},
												children: /* @__PURE__ */ jsx(Trash2, { className: "size-4" })
											}),
											form.data.kind === "persona" && /* @__PURE__ */ jsxs("div", {
												className: "grid gap-2 sm:col-span-3 sm:grid-cols-2",
												children: [/* @__PURE__ */ jsx(Input, {
													placeholder: t("Persona name (e.g. Aria) — defaults to variant name"),
													value: variant.config?.persona?.name ?? "",
													onChange: (e) => {
														const next = [...form.data.variants];
														next[index] = {
															...next[index],
															config: {
																...next[index].config,
																persona: {
																	...next[index].config?.persona,
																	name: e.target.value
																}
															}
														};
														form.setData("variants", next);
													}
												}), /* @__PURE__ */ jsx(Input, {
													placeholder: t("Persona tone (e.g. warm and concise)"),
													value: variant.config?.persona?.tone ?? "",
													onChange: (e) => {
														const next = [...form.data.variants];
														next[index] = {
															...next[index],
															config: {
																...next[index].config,
																persona: {
																	...next[index].config?.persona,
																	tone: e.target.value
																}
															}
														};
														form.setData("variants", next);
													}
												})]
											})
										]
									}, index))
								})]
							})]
						}), /* @__PURE__ */ jsx(CardFooter, {
							className: "flex flex-col-reverse gap-2 border-t bg-muted/10 px-4 py-4 sm:flex-row sm:justify-end sm:px-5",
							children: /* @__PURE__ */ jsx(Button, {
								type: "submit",
								disabled: form.processing,
								className: "w-full sm:w-auto",
								children: t("Create experiment")
							})
						})]
					})]
				}),
				/* @__PURE__ */ jsxs(Card, {
					className: "p-4",
					children: [/* @__PURE__ */ jsx("h2", {
						className: "mb-3 font-medium",
						children: t("Existing experiments")
					}), experiments.length === 0 ? /* @__PURE__ */ jsx(EmptyState, {
						icon: Beaker,
						title: t("No experiments running"),
						description: t("Test variants of persona, system prompt, CTAs, or triggers on a slice of visitors and compare conversation outcomes side-by-side.")
					}) : /* @__PURE__ */ jsx("div", {
						className: "divide-y",
						children: experiments.map((exp) => /* @__PURE__ */ jsxs("div", {
							className: "flex items-start justify-between gap-3 py-3",
							children: [/* @__PURE__ */ jsxs("div", {
								className: "min-w-0 flex-1",
								children: [/* @__PURE__ */ jsxs("div", {
									className: "flex items-center gap-2",
									children: [/* @__PURE__ */ jsx("p", {
										className: "text-sm font-medium",
										children: exp.name
									}), /* @__PURE__ */ jsx("span", {
										className: `rounded px-2 py-0.5 text-xs ${STATUS_COLOR$1[exp.status] ?? ""}`,
										children: t(exp.status)
									})]
								}), /* @__PURE__ */ jsxs("p", {
									className: "mt-1 text-xs text-muted-foreground",
									children: [
										exp.kind,
										" ·",
										" ",
										tChoice(":count variant|:count variants", exp.variants.length, { count: exp.variants.length }),
										":",
										" ",
										exp.variants.map((v) => `${v.name} (${v.weight})`).join(", ")
									]
								})]
							}), /* @__PURE__ */ jsxs("div", {
								className: "flex gap-2",
								children: [
									exp.status !== "running" && /* @__PURE__ */ jsx(Button, {
										size: "sm",
										onClick: () => router.post(`/app/experiments/${exp.id}/start`),
										children: t("Start")
									}),
									exp.status === "running" && /* @__PURE__ */ jsx(Button, {
										size: "sm",
										variant: "outline",
										onClick: () => router.post(`/app/experiments/${exp.id}/stop`),
										children: t("Stop")
									}),
									/* @__PURE__ */ jsx(Button, {
										variant: "ghost",
										size: "sm",
										onClick: async () => {
											if (!await confirm({
												title: t("Delete experiment?"),
												message: t("Delete this experiment?"),
												confirmLabel: t("Delete"),
												danger: true
											})) return;
											router.delete(`/app/experiments/${exp.id}`);
										},
										children: /* @__PURE__ */ jsx(Trash2, { className: "size-4" })
									})
								]
							})]
						}, exp.id))
					})]
				})
			]
		})]
	});
}
//#endregion
//#region resources/js/components/plan-limit-banner.tsx
var RESOURCE_LABELS = {
	agent: "agents",
	source: "knowledge sources",
	workflow: "workflows",
	integration: "integrations",
	member: "members"
};
function usePlanLimit(resource) {
	const { workspaceLimits } = usePage().props;
	return workspaceLimits?.[resource] ?? null;
}
/**
* Inline nudge banner that renders when the workspace has hit (or is
* 1 away from) the per-resource plan cap. Disable the matching "Add"
* button alongside this banner so the operator can't even attempt an
* action the server would reject. Buyer ask 2026-05-19 (sources page
* let user pick 10 + then failed at save).
*/
function PlanLimitBanner({ resource }) {
	const { t } = useT();
	const info = usePlanLimit(resource);
	if (info === null || info.limit === null) return null;
	if (info.allowed && (info.remaining ?? 1) > 0) return null;
	const label = RESOURCE_LABELS[resource];
	return /* @__PURE__ */ jsxs("div", {
		className: "flex flex-wrap items-start gap-3 rounded-md border border-amber-300/70 bg-amber-50 px-4 py-3 text-sm dark:border-amber-700 dark:bg-amber-900/20",
		children: [
			/* @__PURE__ */ jsx(Sparkles, { className: "mt-0.5 size-4 shrink-0 text-amber-700 dark:text-amber-300" }),
			/* @__PURE__ */ jsxs("div", {
				className: "min-w-0 flex-1",
				children: [/* @__PURE__ */ jsx("p", {
					className: "font-medium text-amber-900 dark:text-amber-100",
					children: t("You're at your plan's :label limit (:current of :limit used).", {
						label: t(label),
						current: info.current,
						limit: info.limit
					})
				}), /* @__PURE__ */ jsx("p", {
					className: "mt-0.5 text-xs leading-5 text-amber-800/90 dark:text-amber-200/80",
					children: t("Upgrade your plan to add more :label without losing what you already have.", { label: t(label) })
				})]
			}),
			/* @__PURE__ */ jsxs(Link, {
				href: "/app/billing",
				className: "inline-flex shrink-0 items-center gap-1 rounded-full bg-amber-900 px-3 py-1.5 text-xs font-medium text-amber-50 hover:bg-amber-950 dark:bg-amber-200 dark:text-amber-900 dark:hover:bg-amber-100",
				children: [t("Upgrade"), /* @__PURE__ */ jsx(ArrowUpRight, { className: "size-3.5" })]
			})
		]
	});
}
//#endregion
//#region resources/js/components/table-toolbar-controls.tsx
function ToolbarMenuButton({ children, className, ...props }) {
	return /* @__PURE__ */ jsx(Button, {
		variant: "outline",
		size: "sm",
		className: cn("h-7 gap-1.5 rounded-md bg-card px-2.5 text-xs font-normal text-muted-foreground shadow-xs", className),
		...props,
		children
	});
}
function CounterBadge({ count }) {
	return /* @__PURE__ */ jsx("span", {
		className: "inline-flex min-w-4 items-center justify-center rounded bg-foreground px-1 text-[10px] font-medium text-background",
		children: count
	});
}
function TableScopeMenu({ options, value, paramName, only }) {
	const { t } = useT();
	const defaultValue = options[0]?.value;
	const currentOption = options.find((option) => option.value === value) ?? options[0];
	if (!currentOption || !defaultValue) return null;
	return /* @__PURE__ */ jsxs(DropdownMenu, { children: [/* @__PURE__ */ jsx(DropdownMenuTrigger, {
		asChild: true,
		children: /* @__PURE__ */ jsxs(ToolbarMenuButton, { children: [currentOption.label, /* @__PURE__ */ jsx(ChevronDown, { className: "size-3.5" })] })
	}), /* @__PURE__ */ jsxs(DropdownMenuContent, {
		align: "start",
		className: "w-48",
		children: [
			/* @__PURE__ */ jsx(DropdownMenuLabel, { children: t("View") }),
			/* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
			/* @__PURE__ */ jsx(DropdownMenuRadioGroup, {
				value,
				onValueChange: (nextValue) => {
					replaceTableQuery({ [paramName]: nextValue === defaultValue ? null : nextValue }, { only });
				},
				children: options.map((option) => /* @__PURE__ */ jsx(DropdownMenuRadioItem, {
					value: option.value,
					children: option.label
				}, option.value))
			})
		]
	})] });
}
function TableSortMenu({ options, value, paramName, only }) {
	const { t } = useT();
	const defaultValue = options[0]?.value;
	if (!defaultValue) return null;
	return /* @__PURE__ */ jsxs(DropdownMenu, { children: [/* @__PURE__ */ jsx(DropdownMenuTrigger, {
		asChild: true,
		children: /* @__PURE__ */ jsxs(ToolbarMenuButton, { children: [/* @__PURE__ */ jsx(ListFilter, { className: "size-3.5" }), t("Sort")] })
	}), /* @__PURE__ */ jsxs(DropdownMenuContent, {
		align: "start",
		className: "w-52",
		children: [
			/* @__PURE__ */ jsx(DropdownMenuLabel, { children: t("Sort by") }),
			/* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
			/* @__PURE__ */ jsx(DropdownMenuRadioGroup, {
				value,
				onValueChange: (nextValue) => {
					replaceTableQuery({ [paramName]: nextValue === defaultValue ? null : nextValue }, { only });
				},
				children: options.map((option) => /* @__PURE__ */ jsx(DropdownMenuRadioItem, {
					value: option.value,
					children: option.label
				}, option.value))
			})
		]
	})] });
}
function TableFiltersMenu({ groups, only }) {
	const { t } = useT();
	const activeFilterCount = groups.filter((group) => group.value !== group.defaultValue).length;
	return /* @__PURE__ */ jsxs(DropdownMenu, { children: [/* @__PURE__ */ jsx(DropdownMenuTrigger, {
		asChild: true,
		children: /* @__PURE__ */ jsxs(ToolbarMenuButton, { children: [
			/* @__PURE__ */ jsx(Filter, { className: "size-3.5" }),
			t("Filters"),
			activeFilterCount > 0 && /* @__PURE__ */ jsx(CounterBadge, { count: activeFilterCount })
		] })
	}), /* @__PURE__ */ jsxs(DropdownMenuContent, {
		align: "start",
		className: "w-56",
		children: [
			/* @__PURE__ */ jsx(DropdownMenuLabel, { children: t("Filters") }),
			/* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
			groups.map((group, index) => /* @__PURE__ */ jsxs(Fragment, { children: [
				index > 0 && /* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
				/* @__PURE__ */ jsx(DropdownMenuLabel, {
					className: "text-xs text-muted-foreground",
					children: group.label
				}),
				/* @__PURE__ */ jsx(DropdownMenuRadioGroup, {
					value: group.value,
					onValueChange: (nextValue) => {
						replaceTableQuery({ [group.paramName]: nextValue === group.defaultValue ? null : nextValue }, { only });
					},
					children: group.options.map((option) => /* @__PURE__ */ jsx(DropdownMenuRadioItem, {
						value: option.value,
						children: option.label
					}, option.value))
				})
			] }, group.paramName)),
			activeFilterCount > 0 && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(DropdownMenuSeparator, {}), /* @__PURE__ */ jsx(DropdownMenuItem, {
				onSelect: () => {
					replaceTableQuery(Object.fromEntries(groups.map((group) => [group.paramName, null])), { only });
				},
				children: t("Clear filters")
			})] })
		]
	})] });
}
function TableColumnMenu({ columns, visibleColumns, hiddenColumnCount, onResetColumns, onSetColumnVisibility }) {
	const { t } = useT();
	return /* @__PURE__ */ jsxs(DropdownMenu, { children: [/* @__PURE__ */ jsx(DropdownMenuTrigger, {
		asChild: true,
		children: /* @__PURE__ */ jsxs(ToolbarMenuButton, { children: [
			/* @__PURE__ */ jsx(Columns3, { className: "size-3.5" }),
			t("Column settings"),
			hiddenColumnCount > 0 && /* @__PURE__ */ jsx(CounterBadge, { count: hiddenColumnCount })
		] })
	}), /* @__PURE__ */ jsxs(DropdownMenuContent, {
		align: "end",
		className: "w-56",
		children: [
			/* @__PURE__ */ jsx(DropdownMenuLabel, { children: t("Visible columns") }),
			/* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
			columns.map((column) => /* @__PURE__ */ jsx(DropdownMenuCheckboxItem, {
				checked: visibleColumns.includes(column.id),
				disabled: column.canHide === false,
				onCheckedChange: (checked) => {
					onSetColumnVisibility(column.id, checked === true);
				},
				children: column.label
			}, column.id)),
			hiddenColumnCount > 0 && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(DropdownMenuSeparator, {}), /* @__PURE__ */ jsx(DropdownMenuItem, {
				onSelect: () => onResetColumns(),
				children: t("Reset columns")
			})] })
		]
	})] });
}
//#endregion
//#region resources/js/hooks/use-persistent-table-columns.ts
function normalizeVisibleColumns(columns, candidateIds) {
	const visibleSet = new Set(candidateIds);
	columns.forEach((column) => {
		if (column.canHide === false) visibleSet.add(column.id);
	});
	const orderedVisibleColumns = columns.filter((column) => visibleSet.has(column.id)).map((column) => column.id);
	if (orderedVisibleColumns.length > 0) return orderedVisibleColumns;
	return columns.filter((column) => column.defaultVisible !== false).map((column) => column.id);
}
function getDefaultVisibleColumns(columns) {
	return columns.filter((column) => column.defaultVisible !== false).map((column) => column.id);
}
function usePersistentTableColumns(storageKey, columns) {
	const columnsSignature = useMemo(() => columns.map((column) => `${column.id}:${column.canHide === false ? "1" : "0"}:${column.defaultVisible === false ? "0" : "1"}`).join("|"), [columns]);
	const [visibleColumns, setVisibleColumns] = useState(useMemo(() => getDefaultVisibleColumns(columns), [columnsSignature]));
	const hasLoadedPreferences = useRef(false);
	const columnsRef = useRef(columns);
	useEffect(() => {
		columnsRef.current = columns;
	}, [columns]);
	useEffect(() => {
		if (typeof window === "undefined") return;
		const liveColumns = columnsRef.current;
		const fallbackColumns = getDefaultVisibleColumns(liveColumns);
		const storedColumns = window.localStorage.getItem(storageKey);
		if (!storedColumns) {
			hasLoadedPreferences.current = true;
			return;
		}
		let cancelled = false;
		try {
			const parsedColumns = JSON.parse(storedColumns);
			if (!Array.isArray(parsedColumns)) {
				hasLoadedPreferences.current = true;
				return;
			}
			const knownColumnIds = liveColumns.map((column) => column.id);
			const nextVisibleColumns = parsedColumns.filter((columnId) => knownColumnIds.includes(columnId));
			queueMicrotask(() => {
				if (cancelled) return;
				hasLoadedPreferences.current = true;
				setVisibleColumns(normalizeVisibleColumns(liveColumns, nextVisibleColumns));
			});
		} catch {
			queueMicrotask(() => {
				if (cancelled) return;
				hasLoadedPreferences.current = true;
				setVisibleColumns(fallbackColumns);
			});
		}
		return () => {
			cancelled = true;
		};
	}, [columnsSignature, storageKey]);
	useEffect(() => {
		if (typeof window === "undefined" || !hasLoadedPreferences.current) return;
		window.localStorage.setItem(storageKey, JSON.stringify(visibleColumns));
	}, [storageKey, visibleColumns]);
	const setColumnVisibility = (id, visible) => {
		const column = columns.find((entry) => entry.id === id);
		if (!column || column.canHide === false) return;
		setVisibleColumns((currentColumns) => {
			const nextColumns = new Set(currentColumns);
			if (visible) nextColumns.add(id);
			else nextColumns.delete(id);
			return normalizeVisibleColumns(columns, nextColumns);
		});
	};
	return {
		visibleColumns,
		hiddenColumnCount: columns.length - visibleColumns.length,
		isColumnVisible: (id) => visibleColumns.includes(id),
		resetColumns: () => setVisibleColumns(getDefaultVisibleColumns(columnsRef.current)),
		setColumnVisibility
	};
}
//#endregion
//#region resources/js/pages/app/agents/index.tsx
var agents_exports = /* @__PURE__ */ __exportAll({ default: () => AgentsIndex });
var AGENTS_ONLY = [
	"agents",
	"pagination",
	"filters"
];
function useRelativeTime$2() {
	const { t } = useT();
	return (iso) => {
		if (!iso) return t("No activity");
		const ms = Date.now() - new Date(iso).getTime();
		const min = Math.max(1, Math.round(ms / 6e4));
		if (min < 60) return t(":min m ago", { min });
		const hr = Math.round(min / 60);
		if (hr < 24) return t(":hr h ago", { hr });
		const day = Math.round(hr / 24);
		if (day < 7) return t(":day d ago", { day });
		return new Date(iso).toLocaleDateString();
	};
}
function PublishBadge({ published }) {
	const { t } = useT();
	if (published) return /* @__PURE__ */ jsxs("span", {
		className: "inline-flex items-center gap-1 rounded-md border border-emerald-200 bg-emerald-50 px-2 py-0.5 text-xs font-medium text-emerald-700 dark:border-emerald-500/30 dark:bg-emerald-500/10 dark:text-emerald-300",
		children: [/* @__PURE__ */ jsx(CheckCircle2, { className: "size-3" }), t("Published")]
	});
	return /* @__PURE__ */ jsx("span", {
		className: "inline-flex items-center rounded-md border border-amber-200 bg-amber-50 px-2 py-0.5 text-xs font-medium text-amber-700 dark:border-amber-500/30 dark:bg-amber-500/10 dark:text-amber-300",
		children: t("Draft")
	});
}
function AgentsIndex({ agents, pagination, filters, filterOptions, sourceQuota }) {
	const { t } = useT();
	const relativeTime = useRelativeTime$2();
	const confirm = useConfirm();
	const selection = useBulkSelection();
	const pageIds = agents.map((a) => a.id);
	const breadcrumbs = [{
		title: t("Agents"),
		href: index$12()
	}];
	const AGENT_COLUMNS = [
		{
			id: "status",
			label: t("Status")
		},
		{
			id: "language",
			label: t("Language")
		},
		{
			id: "knowledge",
			label: t("Knowledge")
		},
		{
			id: "conversations",
			label: t("Conversations")
		},
		{
			id: "leads",
			label: t("Leads")
		},
		{
			id: "updated",
			label: t("Updated")
		},
		{
			id: "settings",
			label: t("Settings")
		}
	];
	const AGENT_VIEW_OPTIONS = [
		{
			value: "all",
			label: t("All agents")
		},
		{
			value: "published",
			label: t("Published agents")
		},
		{
			value: "draft",
			label: t("Draft agents")
		}
	];
	const AGENT_SORT_OPTIONS = [
		{
			value: "updated_desc",
			label: t("Recently updated")
		},
		{
			value: "updated_asc",
			label: t("Oldest updated")
		},
		{
			value: "name_asc",
			label: t("Name A-Z")
		},
		{
			value: "name_desc",
			label: t("Name Z-A")
		}
	];
	const { hiddenColumnCount, isColumnVisible, resetColumns, setColumnVisibility, visibleColumns } = usePersistentTableColumns("table-columns:agents", AGENT_COLUMNS);
	const hasRows = agents.length > 0;
	const hasActiveFilters = filters.q.trim() !== "" || filters.view !== "all" || filters.language !== "all";
	const emptyTitle = hasActiveFilters ? t("No matching agents") : t("No agents yet");
	const visibleColumnCount = AGENT_COLUMNS.filter((column) => isColumnVisible(column.id)).length;
	const languageOptions = [{
		value: "all",
		label: t("All languages")
	}, ...filterOptions.languages.map((language) => ({
		value: language,
		label: language.toUpperCase()
	}))];
	return /* @__PURE__ */ jsxs(AppLayout, {
		breadcrumbs,
		children: [
			/* @__PURE__ */ jsx(Head, { title: "Agents" }),
			/* @__PURE__ */ jsxs("div", {
				className: "flex min-h-0 flex-1 flex-col bg-card",
				children: [
					/* @__PURE__ */ jsx("div", {
						className: "px-3 pt-2",
						children: /* @__PURE__ */ jsx(PlanLimitBanner, { resource: "agent" })
					}),
					/* @__PURE__ */ jsxs("div", {
						className: "flex min-h-10 flex-wrap items-center gap-2 border-b px-3 py-1.5",
						children: [
							/* @__PURE__ */ jsx(TableScopeMenu, {
								options: AGENT_VIEW_OPTIONS,
								value: filters.view,
								paramName: "view",
								only: AGENTS_ONLY
							}),
							/* @__PURE__ */ jsx(TableSortMenu, {
								options: AGENT_SORT_OPTIONS,
								value: filters.sort,
								paramName: "sort",
								only: AGENTS_ONLY
							}),
							/* @__PURE__ */ jsx(TableFiltersMenu, {
								groups: [{
									label: t("Language"),
									paramName: "language",
									value: filters.language,
									defaultValue: "all",
									options: languageOptions
								}],
								only: AGENTS_ONLY
							}),
							/* @__PURE__ */ jsx(TableSearch, {
								placeholder: t("Search agents..."),
								initialValue: filters.q,
								only: AGENTS_ONLY
							}),
							/* @__PURE__ */ jsxs("div", {
								className: "ms-auto flex items-center gap-2",
								children: [/* @__PURE__ */ jsx(TableColumnMenu, {
									columns: AGENT_COLUMNS,
									visibleColumns,
									hiddenColumnCount,
									onResetColumns: resetColumns,
									onSetColumnVisibility: setColumnVisibility
								}), /* @__PURE__ */ jsx(Button, {
									asChild: true,
									size: "sm",
									children: /* @__PURE__ */ jsxs(Link, {
										href: create$1(),
										prefetch: true,
										children: [/* @__PURE__ */ jsx(Plus, { className: "size-3.5" }), t("New agent")]
									})
								})]
							})
						]
					}),
					/* @__PURE__ */ jsx("div", {
						className: "min-h-0 flex-1 overflow-auto",
						children: /* @__PURE__ */ jsxs("table", {
							className: "w-full min-w-[980px] border-separate border-spacing-0 text-start text-sm",
							children: [/* @__PURE__ */ jsx("thead", {
								className: "sticky top-0 z-10 bg-card text-xs font-medium text-muted-foreground",
								children: /* @__PURE__ */ jsxs("tr", { children: [
									/* @__PURE__ */ jsx("th", {
										className: "w-9 border-b px-3 py-2",
										children: /* @__PURE__ */ jsx("input", {
											type: "checkbox",
											"aria-label": t("Select all agents"),
											checked: selection.allOnPageSelected(pageIds),
											ref: (el) => {
												if (el) el.indeterminate = !selection.allOnPageSelected(pageIds) && selection.someOnPageSelected(pageIds);
											},
											onChange: () => selection.togglePage(pageIds),
											className: "size-3.5 cursor-pointer rounded border-input"
										})
									}),
									/* @__PURE__ */ jsx("th", {
										className: "border-e border-b px-3 py-2",
										children: t("Agent")
									}),
									isColumnVisible("status") && /* @__PURE__ */ jsx("th", {
										className: "border-e border-b px-3 py-2",
										children: t("Status")
									}),
									isColumnVisible("language") && /* @__PURE__ */ jsx("th", {
										className: "border-e border-b px-3 py-2",
										children: t("Language")
									}),
									isColumnVisible("knowledge") && /* @__PURE__ */ jsx("th", {
										className: "border-e border-b px-3 py-2",
										children: t("Knowledge")
									}),
									isColumnVisible("conversations") && /* @__PURE__ */ jsx("th", {
										className: "border-e border-b px-3 py-2",
										children: t("Conversations")
									}),
									isColumnVisible("leads") && /* @__PURE__ */ jsx("th", {
										className: "border-e border-b px-3 py-2",
										children: t("Leads")
									}),
									isColumnVisible("updated") && /* @__PURE__ */ jsx("th", {
										className: "border-e border-b px-3 py-2",
										children: t("Updated")
									}),
									isColumnVisible("settings") && /* @__PURE__ */ jsx("th", {
										className: "border-b px-3 py-2",
										children: t("Settings")
									})
								] })
							}), /* @__PURE__ */ jsx("tbody", { children: hasRows ? agents.map((agent) => /* @__PURE__ */ jsxs("tr", {
								className: "group hover:bg-muted/35",
								children: [
									/* @__PURE__ */ jsx("td", {
										className: "border-b px-3 py-2",
										children: /* @__PURE__ */ jsx("input", {
											type: "checkbox",
											"aria-label": t("Select :name", { name: agent.name }),
											checked: selection.isSelected(agent.id),
											onChange: (e) => {
												const nativeEvent = e.nativeEvent;
												selection.toggle(agent.id, {
													shiftKey: nativeEvent?.shiftKey ?? false,
													pageIds
												});
											},
											onClick: (e) => e.stopPropagation(),
											className: "size-3.5 cursor-pointer rounded border-input"
										})
									}),
									/* @__PURE__ */ jsx("td", {
										className: "border-e border-b px-3 py-2",
										children: /* @__PURE__ */ jsxs(Link, {
											href: show$4(agent.id),
											className: "flex min-w-0 items-center gap-2 text-foreground",
											children: [/* @__PURE__ */ jsx("span", {
												className: "flex size-5 shrink-0 items-center justify-center rounded bg-muted text-muted-foreground",
												children: /* @__PURE__ */ jsx(Bot, { className: "size-3.5" })
											}), /* @__PURE__ */ jsx("span", {
												className: "truncate font-medium",
												children: agent.name
											})]
										})
									}),
									isColumnVisible("status") && /* @__PURE__ */ jsx("td", {
										className: "border-e border-b px-3 py-2",
										children: /* @__PURE__ */ jsx(PublishBadge, { published: agent.is_published })
									}),
									isColumnVisible("language") && /* @__PURE__ */ jsx("td", {
										className: "border-e border-b px-3 py-2 text-muted-foreground uppercase",
										children: agent.language_default
									}),
									isColumnVisible("knowledge") && /* @__PURE__ */ jsx("td", {
										className: "border-e border-b px-3 py-2 text-muted-foreground",
										children: /* @__PURE__ */ jsxs("span", {
											className: "inline-flex items-center gap-1.5",
											title: t(":indexed indexed · :total total", {
												indexed: agent.sources.indexed,
												total: agent.sources.total
											}),
											children: [
												/* @__PURE__ */ jsx(Library, { className: "size-3.5" }),
												agent.sources.total,
												sourceQuota.limit !== null ? `/${sourceQuota.limit}` : ""
											]
										})
									}),
									isColumnVisible("conversations") && /* @__PURE__ */ jsx("td", {
										className: "border-e border-b px-3 py-2 text-muted-foreground",
										children: /* @__PURE__ */ jsxs("span", {
											className: "inline-flex items-center gap-1.5 tabular-nums",
											children: [/* @__PURE__ */ jsx(MessagesSquare, { className: "size-3.5" }), agent.conversations_7d.toLocaleString()]
										})
									}),
									isColumnVisible("leads") && /* @__PURE__ */ jsx("td", {
										className: "border-e border-b px-3 py-2 text-muted-foreground",
										children: /* @__PURE__ */ jsxs("span", {
											className: "inline-flex items-center gap-1.5 tabular-nums",
											children: [/* @__PURE__ */ jsx(Inbox, { className: "size-3.5" }), agent.leads_7d.toLocaleString()]
										})
									}),
									isColumnVisible("updated") && /* @__PURE__ */ jsx("td", {
										className: "border-e border-b px-3 py-2 text-muted-foreground",
										children: relativeTime(agent.updated_at)
									}),
									isColumnVisible("settings") && /* @__PURE__ */ jsx("td", {
										className: "border-b px-3 py-2",
										children: /* @__PURE__ */ jsxs("div", {
											className: "flex items-center gap-1",
											children: [/* @__PURE__ */ jsx(Link, {
												href: edit$7(agent.id),
												className: "inline-flex size-7 items-center justify-center rounded-md text-muted-foreground transition hover:bg-muted hover:text-foreground",
												"aria-label": t("Open :name settings", { name: agent.name }),
												children: /* @__PURE__ */ jsx(Settings, { className: "size-3.5" })
											}), /* @__PURE__ */ jsx("button", {
												type: "button",
												onClick: async () => {
													if (!await confirm({
														title: t("Delete agent?"),
														message: t("Delete agent \":name\"? This removes its sources, conversations, leads, and embedded widget. This action cannot be undone.", { name: agent.name }),
														confirmLabel: t("Delete"),
														danger: true
													})) return;
													router.delete(destroy$12.url({ agent: agent.id }), { preserveScroll: true });
												},
												className: "inline-flex size-7 items-center justify-center rounded-md text-muted-foreground transition hover:bg-destructive/10 hover:text-destructive",
												"aria-label": t("Delete :name", { name: agent.name }),
												children: /* @__PURE__ */ jsx(Trash2, { className: "size-3.5" })
											})]
										})
									})
								]
							}, agent.id)) : /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx("td", {
								colSpan: 2 + visibleColumnCount,
								className: "h-72 border-b px-4 text-center",
								children: /* @__PURE__ */ jsxs("div", {
									className: "mx-auto flex max-w-sm flex-col items-center gap-2 text-muted-foreground",
									children: [
										/* @__PURE__ */ jsx(Bot, { className: "size-8" }),
										/* @__PURE__ */ jsx("p", {
											className: "text-sm font-medium text-foreground",
											children: emptyTitle
										}),
										/* @__PURE__ */ jsx("p", {
											className: "text-xs",
											children: t("Create an agent to start answering visitors and capturing leads.")
										}),
										!hasActiveFilters && /* @__PURE__ */ jsx(Button, {
											asChild: true,
											size: "sm",
											className: "mt-2",
											children: /* @__PURE__ */ jsxs(Link, {
												href: create$1(),
												children: [/* @__PURE__ */ jsx(Plus, { className: "size-3.5" }), t("New agent")]
											})
										})
									]
								})
							}) }) })]
						})
					}),
					/* @__PURE__ */ jsx(TablePagination, {
						pagination,
						only: AGENTS_ONLY
					})
				]
			}),
			/* @__PURE__ */ jsx(BulkActionsBar, {
				count: selection.size,
				onClear: selection.clear,
				noun: t("agent"),
				children: /* @__PURE__ */ jsx(BulkDeleteButton, {
					confirmMessage: t("Delete :count selected agent(s)? This removes their sources, conversations, leads, and embedded widget.", { count: selection.size }),
					onConfirm: () => {
						router.post(bulkDestroy$3.url(), { ids: Array.from(selection.selected) }, {
							preserveScroll: true,
							onSuccess: () => selection.clear()
						});
					}
				})
			})
		]
	});
}
//#endregion
//#region resources/js/pages/app/agents/knowledge.tsx
var knowledge_exports = /* @__PURE__ */ __exportAll({ default: () => KnowledgePage });
var SOURCE_TONE = {
	URL: "bg-sky-500/15 text-sky-700 dark:text-sky-400",
	Sitemap: "bg-violet-500/15 text-violet-700 dark:text-violet-400",
	Notion: "bg-amber-500/15 text-amber-700 dark:text-amber-400",
	"Google Doc": "bg-emerald-500/15 text-emerald-700 dark:text-emerald-400",
	"Pasted text": "bg-fuchsia-500/15 text-fuchsia-700 dark:text-fuchsia-400",
	"Auto-indexed (visitor visit)": "bg-rose-500/15 text-rose-700 dark:text-rose-400",
	"Uploaded file": "bg-indigo-500/15 text-indigo-700 dark:text-indigo-400"
};
function useRelativeTime$1() {
	const { t } = useT();
	return (iso) => {
		if (!iso) return "—";
		const ms = Date.now() - new Date(iso).getTime();
		const sec = Math.max(1, Math.round(ms / 1e3));
		if (sec < 60) return t("just now");
		const min = Math.round(sec / 60);
		if (min < 60) return t(":min m ago", { min });
		const h = Math.round(min / 60);
		if (h < 24) return t(":h h ago", { h });
		return t(":d d ago", { d: Math.round(h / 24) });
	};
}
/**
* Laravel's paginator emits link labels as HTML-encoded strings
* (`&laquo; Previous`, `Next &raquo;`, plain page numbers). The
* old code used dangerouslySetInnerHTML to render them — fine for
* Laravel-only content but a footgun if anyone ever pipes
* user-supplied text through the same component. Decode the few
* entities the paginator emits and render via plain `{text}`.
*/
function decodePaginatorLabel(label) {
	return label.replace(/&laquo;/g, "«").replace(/&raquo;/g, "»").replace(/&nbsp;/g, " ").replace(/&amp;/g, "&").replace(/&lt;/g, "<").replace(/&gt;/g, ">");
}
function useFormatBytes() {
	const { t } = useT();
	return (chars) => {
		if (chars < 1e3) return t(":chars chars", { chars });
		if (chars < 1e6) return t(":k k chars", { k: (chars / 1e3).toFixed(1) });
		return t(":m M chars", { m: (chars / 1e6).toFixed(2) });
	};
}
function KnowledgePage({ agent, totals, documents, q: initialQ }) {
	const { t, tChoice } = useT();
	const relativeTime = useRelativeTime$1();
	const formatBytes = useFormatBytes();
	const [q, setQ] = useState(initialQ);
	const [openId, setOpenId] = useState(null);
	const [reindexingId, setReindexingId] = useState(null);
	const search = (next) => {
		setQ(next);
		router.get(`/app/agents/${agent.id}/knowledge`, next ? { q: next } : {}, {
			preserveState: true,
			preserveScroll: true,
			replace: true,
			only: ["documents", "q"]
		});
	};
	const reindex = (docId) => {
		setReindexingId(docId);
		router.post(`/app/documents/${docId}/reindex`, {}, {
			preserveScroll: true,
			onFinish: () => setReindexingId(null)
		});
	};
	return /* @__PURE__ */ jsxs(AppLayout, {
		breadcrumbs: [
			{
				title: t("Agents"),
				href: index$12.url()
			},
			{
				title: agent.name,
				href: show$4({ agent: agent.id }).url
			},
			{
				title: t("Knowledge"),
				href: index$17({ agent: agent.id }).url
			}
		],
		children: [/* @__PURE__ */ jsx(Head, { title: `${agent.name} · knowledge` }), /* @__PURE__ */ jsxs("div", {
			className: "flex flex-1 flex-col gap-4 p-4",
			children: [
				/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("h1", {
					className: "text-2xl font-semibold tracking-tight",
					children: t("What the AI knows")
				}), /* @__PURE__ */ jsx("p", {
					className: "mt-1 text-sm text-muted-foreground",
					children: t("Every page and document we've indexed for this agent. Click a row to see the actual extracted text — that's what the model sees when answering questions.")
				})] }),
				/* @__PURE__ */ jsxs("div", {
					className: "grid grid-cols-2 gap-3 md:grid-cols-3",
					children: [
						/* @__PURE__ */ jsxs(Card, {
							className: "p-4",
							children: [
								/* @__PURE__ */ jsx("p", {
									className: "text-xs tracking-wide text-muted-foreground uppercase",
									children: t("Documents")
								}),
								/* @__PURE__ */ jsx("p", {
									className: "mt-1 text-2xl font-semibold tabular-nums",
									children: totals.documents.toLocaleString()
								}),
								/* @__PURE__ */ jsx("p", {
									className: "mt-0.5 text-xs text-muted-foreground",
									children: t("indexed pages / files")
								})
							]
						}),
						/* @__PURE__ */ jsxs(Card, {
							className: "p-4",
							children: [
								/* @__PURE__ */ jsx("p", {
									className: "text-xs tracking-wide text-muted-foreground uppercase",
									children: t("Chunks")
								}),
								/* @__PURE__ */ jsx("p", {
									className: "mt-1 text-2xl font-semibold tabular-nums",
									children: totals.chunks.toLocaleString()
								}),
								/* @__PURE__ */ jsx("p", {
									className: "mt-0.5 text-xs text-muted-foreground",
									children: t("embedding-sized text blocks")
								})
							]
						}),
						/* @__PURE__ */ jsxs(Card, {
							className: "p-4",
							children: [
								/* @__PURE__ */ jsx("p", {
									className: "text-xs tracking-wide text-muted-foreground uppercase",
									children: t("Total content")
								}),
								/* @__PURE__ */ jsx("p", {
									className: "mt-1 text-2xl font-semibold tabular-nums",
									children: formatBytes(totals.characters)
								}),
								/* @__PURE__ */ jsx("p", {
									className: "mt-0.5 text-xs text-muted-foreground",
									children: t("searchable text the AI can quote")
								})
							]
						})
					]
				}),
				/* @__PURE__ */ jsx(Card, {
					className: "p-3",
					children: /* @__PURE__ */ jsxs("div", {
						className: "relative",
						children: [/* @__PURE__ */ jsx(Search, { className: "absolute start-3 top-1/2 size-4 -translate-y-1/2 text-muted-foreground" }), /* @__PURE__ */ jsx(Input, {
							type: "search",
							placeholder: t("Search by URL or title…"),
							value: q,
							onChange: (e) => search(e.target.value),
							className: "ps-9"
						})]
					})
				}),
				documents.data.length === 0 ? /* @__PURE__ */ jsxs(Card, {
					className: "p-8 text-center",
					children: [
						/* @__PURE__ */ jsx(Database, { className: "mx-auto size-10 text-muted-foreground/40" }),
						/* @__PURE__ */ jsx("p", {
							className: "mt-3 text-sm font-medium",
							children: initialQ ? t("No documents match that search.") : t("Nothing indexed yet.")
						}),
						/* @__PURE__ */ jsx("p", {
							className: "mt-1 text-xs text-muted-foreground",
							children: initialQ ? t("Try a different keyword.") : /* @__PURE__ */ jsxs(Fragment$1, { children: [
								t("Add a knowledge source first —"),
								" ",
								/* @__PURE__ */ jsx(Link, {
									href: `/app/agents/${agent.id}/sources`,
									className: "underline hover:text-foreground",
									children: t("Sources page")
								})
							] })
						})
					]
				}) : /* @__PURE__ */ jsxs(Card, {
					className: "p-0",
					children: [/* @__PURE__ */ jsx("div", {
						className: "divide-y",
						children: documents.data.map((doc) => {
							const isOpen = openId === doc.id;
							const tone = SOURCE_TONE[doc.source_label] ?? "bg-muted text-muted-foreground";
							const indexingFailed = doc.chunks_count === 0;
							const isReindexing = reindexingId === doc.id;
							return /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsxs("div", {
								role: "button",
								tabIndex: 0,
								onClick: () => setOpenId(isOpen ? null : doc.id),
								onKeyDown: (e) => {
									if (e.key === "Enter" || e.key === " ") {
										e.preventDefault();
										setOpenId(isOpen ? null : doc.id);
									}
								},
								className: "flex w-full cursor-pointer items-start gap-3 px-4 py-3 text-start transition hover:bg-muted/50",
								children: [
									/* @__PURE__ */ jsx(ChevronRight, { className: `mt-0.5 size-4 shrink-0 text-muted-foreground transition ${isOpen ? "rotate-90" : ""}` }),
									/* @__PURE__ */ jsxs("div", {
										className: "min-w-0 flex-1",
										children: [
											/* @__PURE__ */ jsxs("div", {
												className: "flex flex-wrap items-center gap-2",
												children: [
													/* @__PURE__ */ jsx("p", {
														className: "truncate text-sm font-medium",
														children: doc.title || t("(no title)")
													}),
													/* @__PURE__ */ jsx("span", {
														className: `rounded px-1.5 py-0.5 text-[10px] font-medium ${tone}`,
														children: t(doc.source_label)
													}),
													doc.crawler && /* @__PURE__ */ jsx("span", {
														className: "rounded border px-1.5 py-0.5 text-[10px] font-medium text-muted-foreground",
														children: t("via :crawler", { crawler: doc.crawler })
													}),
													indexingFailed && /* @__PURE__ */ jsxs("span", {
														className: "inline-flex items-center gap-1 rounded bg-amber-500/15 px-1.5 py-0.5 text-[10px] font-medium text-amber-700 dark:text-amber-400",
														children: [/* @__PURE__ */ jsx(AlertTriangle, { className: "size-3" }), t("Indexing didn't finish")]
													})
												]
											}),
											/* @__PURE__ */ jsx("p", {
												className: "mt-0.5 truncate text-xs text-muted-foreground",
												children: doc.url || t("(no url)")
											}),
											indexingFailed ? /* @__PURE__ */ jsxs("div", {
												className: "mt-1 space-y-1 text-xs text-amber-700/80 dark:text-amber-400/80",
												children: [/* @__PURE__ */ jsxs("p", { children: [
													doc.source_error ? doc.source_error : doc.source_type === "file" ? t("Indexing job hasn't completed yet. Check Settings → System health → Queue worker; the indexing job may still be queued or the worker may be down.") : t("The page was fetched but yielded no indexable text. Common causes: the site is JavaScript-only (SPA) with no SEO fallback, a bot-protection / Cloudflare challenge, a login wall, or the indexing worker hasn't caught up yet. Click Reindex to retry; if it keeps failing, try a different URL or upload the content as a file."),
													" ",
													/* @__PURE__ */ jsx("a", {
														href: `/app/agents/${agent.id}/sources#paste-text`,
														className: "font-medium underline underline-offset-2 hover:no-underline",
														children: t("Paste content as text instead →")
													}),
													!doc.reindexable && /* @__PURE__ */ jsxs(Fragment$1, { children: [" ", /* @__PURE__ */ jsx("span", {
														className: "font-medium",
														children: t("(Re-upload the original file to retry.)")
													})] })
												] }), (doc.crawler || doc.fetched_at) && /* @__PURE__ */ jsxs("p", {
													className: "text-[10px] opacity-70",
													children: [
														doc.crawler && t("Fetched via :crawler", { crawler: doc.crawler }),
														doc.crawler && doc.fetched_at && " · ",
														doc.fetched_at && relativeTime(doc.fetched_at)
													]
												})]
											}) : doc.preview && /* @__PURE__ */ jsxs("div", {
												className: "mt-1",
												children: [/* @__PURE__ */ jsx("p", {
													className: "line-clamp-2 text-xs text-muted-foreground/90",
													children: doc.preview
												}), /* @__PURE__ */ jsx("p", {
													className: "mt-0.5 text-[10px] text-muted-foreground/70 italic",
													children: t("Preview only — the full text is indexed across all chunks below")
												})]
											})
										]
									}),
									/* @__PURE__ */ jsxs("div", {
										className: "flex shrink-0 flex-col items-end gap-1 text-end",
										children: [
											/* @__PURE__ */ jsx("span", {
												className: `text-xs font-medium tabular-nums ${indexingFailed ? "text-amber-700 dark:text-amber-400" : ""}`,
												children: tChoice(":count chunk|:count chunks", doc.chunks_count, { count: doc.chunks_count })
											}),
											/* @__PURE__ */ jsx("span", {
												className: "text-[10px] text-muted-foreground",
												children: relativeTime(doc.fetched_at)
											}),
											doc.reindexable && /* @__PURE__ */ jsxs(Button, {
												variant: "outline",
												size: "sm",
												className: "mt-1 h-7 px-2 text-[11px]",
												disabled: isReindexing,
												onClick: (e) => {
													e.stopPropagation();
													reindex(doc.id);
												},
												title: doc.url ? t("Re-crawl this page and rebuild its chunks") : t("Re-parse the uploaded file and rebuild its chunks"),
												children: [/* @__PURE__ */ jsx(RefreshCw, { className: `size-3 ${isReindexing ? "animate-spin" : ""}` }), isReindexing ? t("Queuing…") : t("Reindex")]
											})
										]
									})
								]
							}), isOpen && /* @__PURE__ */ jsxs("div", {
								className: "border-t bg-muted/20 px-4 py-4",
								children: [/* @__PURE__ */ jsxs("div", {
									className: "mb-3 flex flex-wrap items-center gap-3 text-xs text-muted-foreground",
									children: [/* @__PURE__ */ jsxs("span", {
										className: "inline-flex items-center gap-1",
										children: [
											/* @__PURE__ */ jsx(FileText, { className: "size-3.5" }),
											" ",
											tChoice(":count chunk shown|:count chunks shown", doc.chunks.length, { count: doc.chunks.length }),
											doc.chunks.length < doc.chunks_count ? " " + t("of :total", { total: doc.chunks_count }) : ""
										]
									}), doc.url && /* @__PURE__ */ jsxs("a", {
										href: doc.url,
										target: "_blank",
										rel: "noopener noreferrer",
										className: "inline-flex items-center gap-1 text-foreground/80 hover:underline",
										children: [
											/* @__PURE__ */ jsx(ExternalLink, { className: "size-3.5" }),
											" ",
											t("Open original")
										]
									})]
								}), /* @__PURE__ */ jsx("div", {
									className: "space-y-3",
									children: doc.chunks.map((c) => /* @__PURE__ */ jsxs("div", {
										className: "rounded-md border bg-background p-3",
										children: [
											/* @__PURE__ */ jsx("p", {
												className: "mb-2 text-[10px] tracking-wider text-muted-foreground uppercase",
												children: t("chunk :ord · :tokens tokens · :chars chars", {
													ord: c.ord,
													tokens: c.tokens,
													chars: c.chars
												})
											}),
											/* @__PURE__ */ jsx("pre", {
												className: "text-xs leading-relaxed whitespace-pre-wrap text-foreground/90",
												children: c.text
											}),
											c.chars > c.text.length && /* @__PURE__ */ jsx("p", {
												className: "mt-1 text-[10px] text-muted-foreground/60 italic",
												children: t("+:count more characters in this chunk (trimmed for display only — all of it is indexed)", { count: c.chars - c.text.length })
											})
										]
									}, c.id))
								})]
							})] }, doc.id);
						})
					}), documents.last_page > 1 && /* @__PURE__ */ jsxs("div", {
						className: "flex items-center justify-between border-t px-4 py-3 text-xs text-muted-foreground",
						children: [/* @__PURE__ */ jsx("span", { children: t("Showing :from–:to of :total", {
							from: documents.from,
							to: documents.to,
							total: documents.total.toLocaleString()
						}) }), /* @__PURE__ */ jsx("div", {
							className: "flex gap-1",
							children: documents.links.map((link, i) => /* @__PURE__ */ jsx(Link, {
								href: link.url ?? "#",
								className: `rounded px-2 py-1 ${link.active ? "bg-foreground text-background" : link.url ? "hover:bg-muted" : "cursor-not-allowed opacity-40"}`,
								preserveState: true,
								preserveScroll: true,
								only: ["documents"],
								children: decodePaginatorLabel(link.label)
							}, i))
						})]
					})]
				})
			]
		})]
	});
}
//#endregion
//#region resources/js/components/lead-score-badge.tsx
function bucketFor(score, hinted) {
	if (hinted === "low" || hinted === "medium" || hinted === "high") return hinted;
	if (score >= 70) return "high";
	if (score >= 40) return "medium";
	return "low";
}
var BUCKET_STYLES = {
	high: "border-emerald-300 bg-emerald-50 text-emerald-900 dark:border-emerald-700 dark:bg-emerald-900/30 dark:text-emerald-200",
	medium: "border-amber-300 bg-amber-50 text-amber-900 dark:border-amber-700 dark:bg-amber-900/30 dark:text-amber-200",
	low: "border-slate-300 bg-slate-50 text-slate-700 dark:border-slate-700 dark:bg-slate-900/30 dark:text-slate-300"
};
var BUCKET_LABELS = {
	high: "Hot",
	medium: "Warm",
	low: "Cold"
};
function LeadScoreBadge({ score, bucket, reasons, showNumber = true, className }) {
	const safe = Math.max(0, Math.min(100, Math.round(score)));
	const resolved = bucketFor(safe, bucket);
	const tooltipLines = [`Lead score ${safe}/100 — ${BUCKET_LABELS[resolved]}`];
	if (Array.isArray(reasons) && reasons.length > 0) tooltipLines.push("", ...reasons);
	return /* @__PURE__ */ jsxs("span", {
		className: cn("inline-flex items-center gap-1 rounded-full border px-2 py-0.5 text-xs font-medium tabular-nums", BUCKET_STYLES[resolved], className),
		title: tooltipLines.join("\n"),
		children: [
			/* @__PURE__ */ jsx("span", {
				"aria-hidden": "true",
				className: cn("size-1.5 rounded-full", resolved === "high" ? "bg-emerald-500" : resolved === "medium" ? "bg-amber-500" : "bg-slate-400")
			}),
			/* @__PURE__ */ jsx("span", { children: BUCKET_LABELS[resolved] }),
			showNumber && /* @__PURE__ */ jsxs("span", {
				className: "opacity-70",
				children: ["· ", safe]
			})
		]
	});
}
//#endregion
//#region resources/js/pages/app/agents/leads.tsx
var leads_exports = /* @__PURE__ */ __exportAll({ default: () => AgentLeadsPage });
var STATUS_STYLES$3 = {
	new: "border-sky-200 bg-sky-50 text-sky-700 dark:border-sky-500/30 dark:bg-sky-500/10 dark:text-sky-300",
	qualified: "border-emerald-200 bg-emerald-50 text-emerald-700 dark:border-emerald-500/30 dark:bg-emerald-500/10 dark:text-emerald-300",
	contacted: "border-amber-200 bg-amber-50 text-amber-700 dark:border-amber-500/30 dark:bg-amber-500/10 dark:text-amber-300",
	won: "border-violet-200 bg-violet-50 text-violet-700 dark:border-violet-500/30 dark:bg-violet-500/10 dark:text-violet-300",
	lost: "border-border bg-muted text-muted-foreground"
};
function useRelativeTime() {
	const { t } = useT();
	return (iso) => {
		if (!iso) return "—";
		const ms = Date.now() - new Date(iso).getTime();
		const min = Math.max(1, Math.round(ms / 6e4));
		if (min < 60) return t(":min m ago", { min });
		const hr = Math.round(min / 60);
		if (hr < 24) return t(":hr h ago", { hr });
		return t(":day d ago", { day: Math.round(hr / 24) });
	};
}
function StatusBadge$3({ status }) {
	const { t } = useT();
	return /* @__PURE__ */ jsx("span", {
		className: `inline-flex items-center rounded-full border px-2 py-0.5 text-[11px] font-medium capitalize ${STATUS_STYLES$3[status] ?? STATUS_STYLES$3.new}`,
		children: t(status)
	});
}
function AgentLeadsPage({ agent, totals, leads, pagination, filters }) {
	const { t } = useT();
	const relativeTime = useRelativeTime();
	const breadcrumbs = [
		{
			title: t("Agents"),
			href: index$12()
		},
		{
			title: agent.name,
			href: show$4(agent.id)
		},
		{
			title: t("Leads"),
			href: index$14({ agent: agent.id })
		}
	];
	const isEmpty = leads.length === 0;
	const hasQuery = filters.q.trim() !== "";
	return /* @__PURE__ */ jsxs(AppLayout, {
		breadcrumbs,
		children: [/* @__PURE__ */ jsx(Head, { title: `${agent.name} · leads` }), /* @__PURE__ */ jsxs("div", {
			className: "flex flex-1 flex-col gap-4 p-4",
			children: [
				/* @__PURE__ */ jsxs("div", {
					className: "flex items-start justify-between gap-4",
					children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("h1", {
						className: "text-2xl font-semibold tracking-tight",
						children: t("Leads")
					}), /* @__PURE__ */ jsx("p", {
						className: "mt-1 text-sm text-muted-foreground",
						children: t("Every lead captured by :name. Open a row to update the status or jump into the related conversation.", { name: agent.name })
					})] }), /* @__PURE__ */ jsxs("div", {
						className: "flex items-center gap-2",
						children: [/* @__PURE__ */ jsxs(Button, {
							type: "button",
							variant: filters.hot ? "default" : "outline",
							size: "sm",
							onClick: () => {
								router.get(index$14({ agent: agent.id }).url, {
									q: filters.q || void 0,
									hot: filters.hot ? void 0 : 1
								}, {
									preserveScroll: true,
									preserveState: true,
									only: [
										"leads",
										"pagination",
										"filters"
									]
								});
							},
							title: t("Show only leads with score ≥ 70"),
							children: [/* @__PURE__ */ jsx(Flame, { className: "size-4" }), /* @__PURE__ */ jsx("span", {
								className: "ms-1",
								children: t("Hot only")
							})]
						}), /* @__PURE__ */ jsx(TableSearch, {
							placeholder: t("Search by name, email, phone, or page URL..."),
							initialValue: filters.q,
							only: [
								"leads",
								"pagination",
								"filters"
							]
						})]
					})]
				}),
				/* @__PURE__ */ jsxs("div", {
					className: "grid grid-cols-2 gap-3 xl:grid-cols-4",
					children: [
						/* @__PURE__ */ jsxs(Card, {
							className: "p-4",
							children: [
								/* @__PURE__ */ jsx("p", {
									className: "text-xs tracking-wide text-muted-foreground uppercase",
									children: t("Total leads")
								}),
								/* @__PURE__ */ jsx("p", {
									className: "mt-1 text-2xl font-semibold tabular-nums",
									children: totals.leads.toLocaleString()
								}),
								/* @__PURE__ */ jsx("p", {
									className: "mt-0.5 text-xs text-muted-foreground",
									children: t("captured for this agent")
								})
							]
						}),
						/* @__PURE__ */ jsxs(Card, {
							className: "p-4",
							children: [
								/* @__PURE__ */ jsx("p", {
									className: "text-xs tracking-wide text-muted-foreground uppercase",
									children: t("Qualified")
								}),
								/* @__PURE__ */ jsx("p", {
									className: "mt-1 text-2xl font-semibold tabular-nums",
									children: totals.qualified.toLocaleString()
								}),
								/* @__PURE__ */ jsx("p", {
									className: "mt-0.5 text-xs text-muted-foreground",
									children: t("qualified, contacted, or won")
								})
							]
						}),
						/* @__PURE__ */ jsxs(Card, {
							className: "p-4",
							children: [
								/* @__PURE__ */ jsx("p", {
									className: "text-xs tracking-wide text-muted-foreground uppercase",
									children: t("With email")
								}),
								/* @__PURE__ */ jsx("p", {
									className: "mt-1 text-2xl font-semibold tabular-nums",
									children: totals.with_email.toLocaleString()
								}),
								/* @__PURE__ */ jsx("p", {
									className: "mt-0.5 text-xs text-muted-foreground",
									children: t("ready for follow-up")
								})
							]
						}),
						/* @__PURE__ */ jsxs(Card, {
							className: "p-4",
							children: [
								/* @__PURE__ */ jsx("p", {
									className: "text-xs tracking-wide text-muted-foreground uppercase",
									children: t("With phone")
								}),
								/* @__PURE__ */ jsx("p", {
									className: "mt-1 text-2xl font-semibold tabular-nums",
									children: totals.with_phone.toLocaleString()
								}),
								/* @__PURE__ */ jsx("p", {
									className: "mt-0.5 text-xs text-muted-foreground",
									children: t("callback-ready contacts")
								})
							]
						})
					]
				}),
				isEmpty ? /* @__PURE__ */ jsxs(Card, {
					className: "p-8 text-center",
					children: [
						/* @__PURE__ */ jsx(Inbox, { className: "mx-auto size-10 text-muted-foreground/40" }),
						/* @__PURE__ */ jsx("p", {
							className: "mt-3 text-sm font-medium text-foreground",
							children: hasQuery ? t("No leads match that search.") : t("No leads yet for this agent.")
						}),
						/* @__PURE__ */ jsx("p", {
							className: "mt-1 text-xs text-muted-foreground",
							children: hasQuery ? t("Try a broader keyword or search by email, phone, or page URL.") : t("Once visitors share their details, this agent-specific lead feed will populate here.")
						})
					]
				}) : /* @__PURE__ */ jsxs(Card, {
					className: "p-0",
					children: [/* @__PURE__ */ jsx("div", {
						className: "divide-y",
						children: leads.map((lead) => {
							const label = lead.name ?? lead.email ?? t("Unnamed lead");
							return /* @__PURE__ */ jsxs(Link, {
								href: show$1(lead.id),
								className: "flex items-start gap-3 px-4 py-3 transition hover:bg-muted/50",
								children: [
									/* @__PURE__ */ jsx("div", {
										className: "flex size-8 shrink-0 items-center justify-center rounded-full bg-muted text-muted-foreground",
										children: /* @__PURE__ */ jsx(UserRound, { className: "size-4" })
									}),
									/* @__PURE__ */ jsxs("div", {
										className: "min-w-0 flex-1",
										children: [
											/* @__PURE__ */ jsxs("div", {
												className: "flex flex-wrap items-center gap-2",
												children: [
													/* @__PURE__ */ jsx("p", {
														className: "truncate text-sm font-medium text-foreground",
														children: label
													}),
													/* @__PURE__ */ jsx(StatusBadge$3, { status: lead.status }),
													lead.lead_score > 0 && /* @__PURE__ */ jsx(LeadScoreBadge, {
														score: lead.lead_score,
														bucket: lead.lead_score_bucket,
														reasons: lead.lead_score_reasons
													})
												]
											}),
											/* @__PURE__ */ jsxs("div", {
												className: "mt-1 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-muted-foreground",
												children: [lead.email && /* @__PURE__ */ jsxs("span", {
													className: "inline-flex items-center gap-1.5",
													children: [/* @__PURE__ */ jsx(Mail, { className: "size-3.5" }), lead.email]
												}), lead.phone && /* @__PURE__ */ jsxs("span", {
													className: "inline-flex items-center gap-1.5",
													children: [/* @__PURE__ */ jsx(Phone, { className: "size-3.5" }), lead.phone]
												})]
											}),
											/* @__PURE__ */ jsx("p", {
												className: "mt-1 truncate text-xs text-muted-foreground/90",
												children: lead.page_url ?? t("No page URL captured")
											})
										]
									}),
									/* @__PURE__ */ jsx("div", {
										className: "flex shrink-0 flex-col items-end gap-1 text-end",
										children: /* @__PURE__ */ jsx("span", {
											className: "text-[11px] text-muted-foreground",
											children: relativeTime(lead.created_at)
										})
									}),
									/* @__PURE__ */ jsx(ChevronRight, { className: "mt-2 size-4 shrink-0 text-muted-foreground" })
								]
							}, lead.id);
						})
					}), /* @__PURE__ */ jsx(TablePagination, {
						pagination,
						only: [
							"leads",
							"pagination",
							"filters"
						]
					})]
				})
			]
		})]
	});
}
//#endregion
//#region resources/js/pages/app/agents/mcp-activity.tsx
var mcp_activity_exports = /* @__PURE__ */ __exportAll({ default: () => McpActivity });
var statusKindMap = {
	success: "ok",
	timeout: "warn",
	transport_error: "error",
	tool_error: "warn",
	unauthorized: "error",
	rate_limited: "warn",
	circuit_open: "error",
	denied_not_granted: "muted",
	denied_unknown_tool: "muted",
	schema_invalid: "error"
};
var STATUS_FILTERS$1 = [
	"",
	"success",
	"timeout",
	"transport_error",
	"tool_error",
	"unauthorized",
	"rate_limited",
	"circuit_open",
	"denied_not_granted",
	"schema_invalid"
];
function statusKind(status) {
	return statusKindMap[status] ?? "muted";
}
function StatusPill$2({ status }) {
	const kind = statusKind(status);
	const className = {
		ok: "bg-emerald-500/15 text-emerald-700 dark:text-emerald-300 border-emerald-300/40",
		warn: "bg-amber-500/15 text-amber-700 dark:text-amber-300 border-amber-300/40",
		error: "bg-red-500/15 text-red-700 dark:text-red-300 border-red-300/40",
		muted: "bg-muted text-muted-foreground border-border"
	}[kind];
	const Icon = {
		ok: CheckCircle2,
		warn: TriangleAlert,
		error: XCircle,
		muted: Clock
	}[kind];
	return /* @__PURE__ */ jsxs("span", {
		className: cn("inline-flex items-center gap-1 rounded-full border px-2 py-0.5 text-[10px] font-medium", className),
		children: [/* @__PURE__ */ jsx(Icon, { className: "size-3" }), status]
	});
}
function copy(value, label, t) {
	navigator.clipboard?.writeText(value).then(() => toast.success(`${label} ${t("copied")}`)).catch(() => toast.error(t("Copy failed")));
}
function McpActivity({ agent, server, rows, filter }) {
	const { t } = useT();
	const [expanded, setExpanded] = useState(null);
	const counts = useMemo(() => {
		const buckets = {
			ok: 0,
			warn: 0,
			error: 0,
			muted: 0
		};
		for (const row of rows) buckets[statusKind(row.status)]++;
		return buckets;
	}, [rows]);
	const setFilter = (status) => {
		router.get(activity({
			agent: agent.id,
			mcpServer: server.id
		}).url, status ? { status } : {}, {
			preserveScroll: true,
			preserveState: true,
			only: ["rows", "filter"]
		});
	};
	const refresh = () => {
		router.reload({ only: ["rows"] });
	};
	return /* @__PURE__ */ jsxs(AppLayout, {
		breadcrumbs: [
			{
				title: t("Agents"),
				href: index$12.url()
			},
			{
				title: agent.name,
				href: show$4({ agent: agent.id }).url
			},
			{
				title: t("MCP integrations"),
				href: index$21({ agent: agent.id }).url
			},
			{
				title: server.label,
				href: activity({
					agent: agent.id,
					mcpServer: server.id
				}).url
			}
		],
		children: [/* @__PURE__ */ jsx(Head, { title: `${server.label} · ${t("Activity")}` }), /* @__PURE__ */ jsxs("div", {
			className: "mx-auto w-full max-w-6xl space-y-5 p-4 sm:p-6",
			children: [
				/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx(Button, {
					variant: "ghost",
					size: "sm",
					asChild: true,
					className: "-ms-2 mb-2",
					children: /* @__PURE__ */ jsxs(Link, {
						href: index$21({ agent: agent.id }).url,
						children: [/* @__PURE__ */ jsx(ArrowLeft, { className: "me-1.5 size-4" }), t("Back to MCP servers")]
					})
				}), /* @__PURE__ */ jsxs("div", {
					className: "flex flex-wrap items-start justify-between gap-3",
					children: [/* @__PURE__ */ jsxs("div", {
						className: "flex items-center gap-3",
						children: [/* @__PURE__ */ jsx("div", {
							className: "rounded-md border bg-muted/30 p-2",
							children: /* @__PURE__ */ jsx(Activity, { className: "size-5 text-muted-foreground" })
						}), /* @__PURE__ */ jsxs("div", {
							className: "min-w-0",
							children: [/* @__PURE__ */ jsxs("h1", {
								className: "text-2xl font-semibold",
								children: [
									server.label,
									" · ",
									t("Activity")
								]
							}), /* @__PURE__ */ jsx("p", {
								className: "text-sm text-muted-foreground",
								children: t("Last 100 tool calls. Use this when a buyer reports their integration is misbehaving.")
							})]
						})]
					}), /* @__PURE__ */ jsxs(Button, {
						variant: "outline",
						size: "sm",
						onClick: refresh,
						title: t("Reload latest"),
						children: [/* @__PURE__ */ jsx(RefreshCw, { className: "me-1.5 size-4" }), t("Refresh")]
					})]
				})] }),
				/* @__PURE__ */ jsx("div", {
					className: "grid grid-cols-2 gap-3 sm:grid-cols-4",
					children: [
						{
							key: "ok",
							label: t("Success"),
							value: counts.ok,
							className: "border-emerald-200 dark:border-emerald-500/30 bg-emerald-50/50 dark:bg-emerald-500/5 text-emerald-700 dark:text-emerald-300"
						},
						{
							key: "warn",
							label: t("Warnings"),
							value: counts.warn,
							className: "border-amber-200 dark:border-amber-500/30 bg-amber-50/50 dark:bg-amber-500/5 text-amber-700 dark:text-amber-300"
						},
						{
							key: "error",
							label: t("Errors"),
							value: counts.error,
							className: "border-red-200 dark:border-red-500/30 bg-red-50/50 dark:bg-red-500/5 text-red-700 dark:text-red-300"
						},
						{
							key: "muted",
							label: t("Denied / other"),
							value: counts.muted,
							className: "border-border bg-muted/30"
						}
					].map((card) => /* @__PURE__ */ jsxs(Card, {
						className: cn("border p-3", card.className),
						children: [/* @__PURE__ */ jsx("p", {
							className: "text-[10px] font-medium tracking-wide uppercase opacity-80",
							children: card.label
						}), /* @__PURE__ */ jsx("p", {
							className: "mt-1 text-xl font-semibold tabular-nums",
							children: card.value
						})]
					}, card.key))
				}),
				/* @__PURE__ */ jsx("div", {
					className: "flex flex-wrap items-center gap-1",
					children: STATUS_FILTERS$1.map((f) => /* @__PURE__ */ jsx("button", {
						type: "button",
						onClick: () => setFilter(f),
						className: cn("rounded-full border px-3 py-1 text-xs font-medium transition", filter.status === f ? "border-foreground/20 bg-foreground text-background" : "border-border bg-card text-muted-foreground hover:text-foreground"),
						children: f === "" ? t("All") : f
					}, f || "all"))
				}),
				/* @__PURE__ */ jsx(Card, {
					className: "p-0",
					children: rows.length === 0 ? /* @__PURE__ */ jsx(EmptyState, {
						icon: Activity,
						title: filter.status ? t("No calls match this filter") : t("No tool calls recorded yet"),
						description: filter.status ? t("Try clearing the filter or pick a different status.") : t("Once a visitor triggers a granted tool, the call shows up here in real time (reload to see new rows).")
					}) : /* @__PURE__ */ jsx("div", {
						className: "overflow-x-auto",
						children: /* @__PURE__ */ jsxs("table", {
							className: "w-full text-sm",
							children: [/* @__PURE__ */ jsx("thead", {
								className: "bg-muted/40 text-xs text-muted-foreground",
								children: /* @__PURE__ */ jsxs("tr", { children: [
									/* @__PURE__ */ jsx("th", {
										className: "px-3 py-2 text-left font-medium",
										children: t("Tool")
									}),
									/* @__PURE__ */ jsx("th", {
										className: "px-3 py-2 text-left font-medium",
										children: t("Status")
									}),
									/* @__PURE__ */ jsx("th", {
										className: "px-3 py-2 text-right font-medium",
										children: t("Latency")
									}),
									/* @__PURE__ */ jsx("th", {
										className: "px-3 py-2 text-left font-medium",
										children: t("Conversation")
									}),
									/* @__PURE__ */ jsx("th", {
										className: "px-3 py-2 text-left font-medium",
										children: t("Error")
									}),
									/* @__PURE__ */ jsx("th", {
										className: "px-3 py-2 text-left font-medium",
										children: t("When")
									}),
									/* @__PURE__ */ jsx("th", {
										className: "px-3 py-2 text-right font-medium",
										children: t("Request")
									})
								] })
							}), /* @__PURE__ */ jsx("tbody", { children: rows.map((row) => {
								const isOpen = expanded === row.id;
								return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("tr", {
									className: cn("cursor-pointer border-t transition hover:bg-muted/30", isOpen && "bg-muted/30"),
									onClick: () => setExpanded(isOpen ? null : row.id),
									children: [
										/* @__PURE__ */ jsx("td", {
											className: "px-3 py-2 font-mono text-xs",
											children: /* @__PURE__ */ jsxs("div", {
												className: "flex items-center gap-1.5",
												children: [/* @__PURE__ */ jsx("span", { children: row.tool_name }), row.output_truncated && /* @__PURE__ */ jsx("span", {
													title: t("Tool output was truncated to fit the token budget"),
													children: /* @__PURE__ */ jsx(Scissors, { className: "size-3 text-amber-600 dark:text-amber-400" })
												})]
											})
										}),
										/* @__PURE__ */ jsx("td", {
											className: "px-3 py-2",
											children: /* @__PURE__ */ jsx(StatusPill$2, { status: row.status })
										}),
										/* @__PURE__ */ jsxs("td", {
											className: "px-3 py-2 text-right text-xs text-muted-foreground tabular-nums",
											children: [row.latency_ms, "ms"]
										}),
										/* @__PURE__ */ jsx("td", {
											className: "px-3 py-2",
											children: row.conversation_id ? /* @__PURE__ */ jsx(Link, {
												href: `/app/conversations/${row.conversation_id}`,
												className: "font-mono text-xs text-primary hover:underline",
												onClick: (e) => e.stopPropagation(),
												children: row.conversation_id.slice(0, 8)
											}) : /* @__PURE__ */ jsx("span", {
												className: "text-xs text-muted-foreground",
												children: "—"
											})
										}),
										/* @__PURE__ */ jsx("td", {
											className: "max-w-[280px] truncate px-3 py-2 text-xs text-muted-foreground",
											children: row.error_summary ?? "—"
										}),
										/* @__PURE__ */ jsx("td", {
											className: "px-3 py-2 text-xs whitespace-nowrap text-muted-foreground",
											children: relativeTime$8(row.created_at)
										}),
										/* @__PURE__ */ jsx("td", {
											className: "px-3 py-2 text-right",
											onClick: (e) => e.stopPropagation(),
											children: /* @__PURE__ */ jsxs("button", {
												type: "button",
												className: "inline-flex items-center gap-1 text-[10px] text-muted-foreground hover:text-foreground",
												onClick: () => copy(row.request_id, t("Request ID"), t),
												title: row.request_id,
												children: [/* @__PURE__ */ jsx(Copy, { className: "size-3" }), row.request_id.slice(0, 6)]
											})
										})
									]
								}, `row-${row.id}`), isOpen && /* @__PURE__ */ jsx("tr", {
									className: "border-t bg-muted/20",
									children: /* @__PURE__ */ jsx("td", {
										colSpan: 7,
										className: "px-3 py-3",
										children: /* @__PURE__ */ jsxs("dl", {
											className: "grid grid-cols-2 gap-x-6 gap-y-2 text-xs sm:grid-cols-4",
											children: [
												/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", {
													className: "text-[10px] tracking-wide text-muted-foreground uppercase",
													children: t("Request ID")
												}), /* @__PURE__ */ jsx("dd", {
													className: "mt-0.5 font-mono break-all",
													children: row.request_id
												})] }),
												/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", {
													className: "text-[10px] tracking-wide text-muted-foreground uppercase",
													children: t("Conversation")
												}), /* @__PURE__ */ jsx("dd", {
													className: "mt-0.5 font-mono break-all",
													children: row.conversation_id ?? "—"
												})] }),
												/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", {
													className: "text-[10px] tracking-wide text-muted-foreground uppercase",
													children: t("Recorded")
												}), /* @__PURE__ */ jsx("dd", {
													className: "mt-0.5",
													children: new Date(row.created_at).toLocaleString()
												})] }),
												/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", {
													className: "text-[10px] tracking-wide text-muted-foreground uppercase",
													children: t("Output truncated")
												}), /* @__PURE__ */ jsx("dd", {
													className: "mt-0.5",
													children: row.output_truncated ? t("Yes") : t("No")
												})] }),
												row.error_summary && /* @__PURE__ */ jsxs("div", {
													className: "sm:col-span-4",
													children: [/* @__PURE__ */ jsx("dt", {
														className: "text-[10px] tracking-wide text-muted-foreground uppercase",
														children: t("Error summary")
													}), /* @__PURE__ */ jsx("dd", {
														className: "mt-0.5 break-words whitespace-pre-wrap text-foreground",
														children: row.error_summary
													})]
												})
											]
										})
									})
								}, `detail-${row.id}`)] }, row.id);
							}) })]
						})
					})
				}),
				/* @__PURE__ */ jsx("p", {
					className: "text-[11px] text-muted-foreground",
					children: t("Logs retain for 30 days. Click a row to see the full request ID and conversation link.")
				})
			]
		})]
	});
}
//#endregion
//#region resources/js/components/ui/checkbox.tsx
function Checkbox({ className, ...props }) {
	return /* @__PURE__ */ jsx(CheckboxPrimitive.Root, {
		"data-slot": "checkbox",
		className: cn("peer border-input bg-background data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/40 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-[background-color,border-color,box-shadow] outline-none focus-visible:ring-[2px] disabled:cursor-not-allowed disabled:opacity-50", className),
		...props,
		children: /* @__PURE__ */ jsx(CheckboxPrimitive.Indicator, {
			"data-slot": "checkbox-indicator",
			className: "flex items-center justify-center text-current transition-none",
			children: /* @__PURE__ */ jsx(CheckIcon, { className: "size-3.5" })
		})
	});
}
//#endregion
//#region resources/js/pages/app/agents/mcp-tools.tsx
var mcp_tools_exports = /* @__PURE__ */ __exportAll({ default: () => McpTools });
function McpTools({ agent, server, tools: tools$2 }) {
	const { t } = useT();
	const confirm = useConfirm();
	const [state, setState] = useState(() => Object.fromEntries(tools$2.map((tool) => [tool.id, tool.enabled])));
	const [busy, setBusy] = useState(false);
	const [query, setQuery] = useState("");
	const [filter, setFilter] = useState("all");
	const dirty = useMemo(() => tools$2.some((tool) => state[tool.id] !== tool.enabled), [tools$2, state]);
	const counts = useMemo(() => {
		let enabled = 0;
		let destructive = 0;
		let destructiveEnabled = 0;
		for (const tool of tools$2) {
			if (state[tool.id]) enabled++;
			if (tool.is_destructive) {
				destructive++;
				if (state[tool.id]) destructiveEnabled++;
			}
		}
		return {
			enabled,
			total: tools$2.length,
			destructive,
			destructiveEnabled
		};
	}, [tools$2, state]);
	const filtered = useMemo(() => {
		const q = query.trim().toLowerCase();
		return tools$2.filter((tool) => {
			if (filter === "enabled" && !state[tool.id]) return false;
			if (filter === "destructive" && !tool.is_destructive) return false;
			if (!q) return true;
			return tool.namespaced_name.toLowerCase().includes(q) || (tool.description ?? "").toLowerCase().includes(q);
		});
	}, [
		tools$2,
		query,
		filter,
		state
	]);
	const toggle = async (tool) => {
		if (!state[tool.id] && tool.is_destructive) {
			if (!await confirm({
				title: t("Enable destructive tool?"),
				message: t("[:name] can modify the external system. Enabling it lets the agent write data based on visitor messages.", { name: tool.namespaced_name }),
				confirmLabel: t("Enable"),
				danger: true
			})) return;
		}
		setState((prev) => ({
			...prev,
			[tool.id]: !prev[tool.id]
		}));
	};
	const enableAll = (only) => {
		setState((prev) => {
			const next = { ...prev };
			for (const tool of tools$2) {
				if (only === "safe" && tool.is_destructive) continue;
				next[tool.id] = true;
			}
			return next;
		});
	};
	const disableAll = () => {
		setState(Object.fromEntries(tools$2.map((tool) => [tool.id, false])));
	};
	const reset = () => {
		setState(Object.fromEntries(tools$2.map((tool) => [tool.id, tool.enabled])));
	};
	const save = () => {
		setBusy(true);
		router.patch(bulk$1({
			agent: agent.id,
			mcpServer: server.id
		}).url, { grants: tools$2.map((tool) => ({
			tool_id: tool.id,
			enabled: state[tool.id] ?? false
		})) }, {
			preserveScroll: true,
			onFinish: () => setBusy(false)
		});
	};
	const refresh$2 = () => {
		router.post(refresh({
			agent: agent.id,
			mcpServer: server.id
		}).url, {}, { preserveScroll: true });
	};
	return /* @__PURE__ */ jsxs(AppLayout, {
		breadcrumbs: [
			{
				title: t("Agents"),
				href: index$12.url()
			},
			{
				title: agent.name,
				href: show$4({ agent: agent.id }).url
			},
			{
				title: t("MCP integrations"),
				href: index$21({ agent: agent.id }).url
			},
			{
				title: server.label,
				href: tools({
					agent: agent.id,
					mcpServer: server.id
				}).url
			}
		],
		children: [/* @__PURE__ */ jsx(Head, { title: `${server.label} · ${t("Tools")}` }), /* @__PURE__ */ jsxs("div", {
			className: "mx-auto w-full max-w-5xl space-y-5 p-4 sm:p-6",
			children: [
				/* @__PURE__ */ jsx("div", {
					className: "flex flex-wrap items-start justify-between gap-3",
					children: /* @__PURE__ */ jsxs("div", {
						className: "min-w-0",
						children: [
							/* @__PURE__ */ jsx(Button, {
								variant: "ghost",
								size: "sm",
								asChild: true,
								className: "-ms-2 mb-2",
								children: /* @__PURE__ */ jsxs(Link, {
									href: index$21({ agent: agent.id }).url,
									children: [/* @__PURE__ */ jsx(ArrowLeft, { className: "me-1.5 size-4" }), t("Back to MCP servers")]
								})
							}),
							/* @__PURE__ */ jsxs("h1", {
								className: "text-2xl font-semibold",
								children: [
									server.label,
									" · ",
									t("Tools")
								]
							}),
							/* @__PURE__ */ jsx("p", {
								className: "mt-1 max-w-2xl text-sm text-muted-foreground",
								children: t("Enable only the tools you want this agent to call. Destructive tools require explicit confirmation. Schema changes auto-disable a tool so you re-approve the new shape.")
							})
						]
					})
				}),
				tools$2.length > 0 && /* @__PURE__ */ jsx(Card, { children: /* @__PURE__ */ jsxs(CardContent, {
					className: "flex flex-wrap items-center justify-between gap-3 p-3",
					children: [/* @__PURE__ */ jsxs("div", {
						className: "flex flex-wrap items-center gap-3 text-xs",
						children: [/* @__PURE__ */ jsxs("span", { children: [
							/* @__PURE__ */ jsx("strong", {
								className: "font-semibold text-foreground tabular-nums",
								children: counts.enabled
							}),
							" / ",
							counts.total,
							" ",
							t("enabled")
						] }), /* @__PURE__ */ jsx("span", {
							className: "text-muted-foreground",
							children: counts.destructive > 0 && /* @__PURE__ */ jsxs(Fragment$1, { children: [
								/* @__PURE__ */ jsx("span", {
									className: "text-red-600 dark:text-red-400",
									children: counts.destructiveEnabled
								}),
								" / ",
								counts.destructive,
								" ",
								t("destructive")
							] })
						})]
					}), /* @__PURE__ */ jsxs("div", {
						className: "flex flex-wrap items-center gap-2",
						children: [
							/* @__PURE__ */ jsx(Button, {
								type: "button",
								variant: "outline",
								size: "sm",
								onClick: () => enableAll("safe"),
								children: t("Enable safe")
							}),
							/* @__PURE__ */ jsx(Button, {
								type: "button",
								variant: "outline",
								size: "sm",
								onClick: disableAll,
								children: t("Disable all")
							}),
							/* @__PURE__ */ jsx(Button, {
								type: "button",
								variant: "outline",
								size: "sm",
								onClick: refresh$2,
								children: t("Refresh catalogue")
							})
						]
					})]
				}) }),
				tools$2.length > 0 && /* @__PURE__ */ jsx(Card, { children: /* @__PURE__ */ jsxs(CardContent, {
					className: "flex flex-wrap items-center gap-2 p-3",
					children: [/* @__PURE__ */ jsxs("div", {
						className: "relative min-w-[200px] flex-1",
						children: [/* @__PURE__ */ jsx(Search, { className: "pointer-events-none absolute start-2.5 top-1/2 size-4 -translate-y-1/2 text-muted-foreground" }), /* @__PURE__ */ jsx(Input, {
							value: query,
							onChange: (e) => setQuery(e.target.value),
							placeholder: t("Search tools…"),
							className: "ps-9"
						})]
					}), /* @__PURE__ */ jsx("div", {
						className: "flex gap-1 rounded-md border bg-muted/30 p-0.5",
						children: [
							"all",
							"enabled",
							"destructive"
						].map((f) => /* @__PURE__ */ jsx("button", {
							type: "button",
							onClick: () => setFilter(f),
							className: cn("rounded px-2.5 py-1 text-xs font-medium transition", filter === f ? "bg-background text-foreground shadow-sm" : "text-muted-foreground hover:text-foreground"),
							children: f === "all" ? t("All") : f === "enabled" ? t("Enabled") : t("Destructive")
						}, f))
					})]
				}) }),
				tools$2.length === 0 ? /* @__PURE__ */ jsx(EmptyState, {
					icon: ToyBrick,
					title: t("No tools discovered yet"),
					description: t("The server returned an empty tools/list. Use Refresh catalogue to re-discover, or check that the server actually exposes any tools."),
					action: {
						label: t("Refresh catalogue"),
						onClick: refresh$2
					}
				}) : filtered.length === 0 ? /* @__PURE__ */ jsx(EmptyState, {
					icon: Search,
					title: t("No tools match your filter"),
					description: t("Try clearing the search box or switching filters.")
				}) : /* @__PURE__ */ jsx("div", {
					className: "space-y-2",
					children: filtered.map((tool) => {
						const enabled = state[tool.id] ?? false;
						const checkboxId = `mcp-tool-${tool.id}`;
						return /* @__PURE__ */ jsx(Card, {
							className: cn("overflow-hidden transition", enabled ? "border-foreground/15" : "border-border"),
							children: /* @__PURE__ */ jsx(CardContent, {
								className: "p-4",
								children: /* @__PURE__ */ jsxs("div", {
									className: "flex items-start gap-3",
									children: [/* @__PURE__ */ jsx(Checkbox, {
										id: checkboxId,
										checked: enabled,
										onCheckedChange: () => toggle(tool),
										className: "mt-1"
									}), /* @__PURE__ */ jsxs("div", {
										className: "min-w-0 flex-1",
										children: [
											/* @__PURE__ */ jsxs("div", {
												className: "flex flex-wrap items-center gap-2",
												children: [
													/* @__PURE__ */ jsx("label", {
														htmlFor: checkboxId,
														className: "cursor-pointer font-mono text-sm font-semibold",
														children: tool.namespaced_name
													}),
													tool.is_destructive && /* @__PURE__ */ jsxs("span", {
														className: "inline-flex items-center gap-1 rounded-full border border-red-300/50 bg-red-50 px-2 py-0.5 text-[10px] font-medium text-red-700 dark:border-red-500/40 dark:bg-red-500/10 dark:text-red-300",
														children: [/* @__PURE__ */ jsx(ShieldAlert, { className: "size-3" }), t("Destructive")]
													}),
													tool.is_idempotent && /* @__PURE__ */ jsx("span", {
														className: "rounded-full border bg-muted/50 px-2 py-0.5 text-[10px] font-medium text-muted-foreground",
														children: t("Idempotent")
													})
												]
											}),
											tool.description && /* @__PURE__ */ jsx("p", {
												className: "mt-1 text-xs leading-5 text-muted-foreground",
												children: tool.description
											}),
											/* @__PURE__ */ jsxs("details", {
												className: "group mt-2",
												children: [/* @__PURE__ */ jsxs("summary", {
													className: "inline-flex cursor-pointer items-center gap-1 text-[11px] text-muted-foreground hover:text-foreground",
													children: [/* @__PURE__ */ jsx(Code2, { className: "size-3" }), t("Input schema")]
												}), /* @__PURE__ */ jsx("pre", {
													className: "mt-2 max-h-64 overflow-auto rounded bg-muted p-2 text-[10px] leading-snug",
													children: JSON.stringify(tool.input_schema, null, 2)
												})]
											})
										]
									})]
								})
							})
						}, tool.id);
					})
				}),
				dirty && /* @__PURE__ */ jsxs("div", {
					className: "sticky bottom-4 mt-4 flex flex-wrap items-center justify-between gap-3 rounded-lg border border-amber-300/50 bg-amber-50/95 p-3 shadow-lg backdrop-blur dark:border-amber-500/30 dark:bg-amber-500/10",
					role: "status",
					children: [/* @__PURE__ */ jsx("p", {
						className: "text-xs font-medium text-amber-900 dark:text-amber-200",
						children: t("You have unsaved grant changes. The agent keeps the previous configuration until you save.")
					}), /* @__PURE__ */ jsxs("div", {
						className: "flex items-center gap-2",
						children: [/* @__PURE__ */ jsx(Button, {
							type: "button",
							variant: "ghost",
							size: "sm",
							onClick: reset,
							disabled: busy,
							children: t("Discard")
						}), /* @__PURE__ */ jsxs(Button, {
							type: "button",
							size: "sm",
							onClick: save,
							disabled: busy,
							children: [busy ? /* @__PURE__ */ jsx(Loader2, { className: "me-1.5 size-4 animate-spin" }) : /* @__PURE__ */ jsx(Save, { className: "me-1.5 size-4" }), t("Save changes")]
						})]
					})]
				})
			]
		})]
	});
}
//#endregion
//#region resources/js/pages/app/agents/mcp.tsx
var mcp_exports = /* @__PURE__ */ __exportAll({ default: () => McpServers });
var statusConfig = {
	pending_auth: {
		labelKey: "Pending auth",
		className: "bg-amber-500/15 text-amber-700 dark:text-amber-300 border-amber-300/50",
		icon: TriangleAlert,
		helpKey: "OAuth flow not finished. Complete it to enable tools."
	},
	active: {
		labelKey: "Active",
		className: "bg-emerald-500/15 text-emerald-700 dark:text-emerald-300 border-emerald-300/50",
		icon: CheckCircle2,
		helpKey: "Handshake succeeded and tools were discovered."
	},
	degraded: {
		labelKey: "Degraded",
		className: "bg-amber-500/15 text-amber-700 dark:text-amber-300 border-amber-300/50",
		icon: TriangleAlert,
		helpKey: "Recent calls failed. Hit Test to confirm the server is reachable."
	},
	disabled: {
		labelKey: "Disabled",
		className: "bg-muted text-muted-foreground border-border",
		icon: Unplug,
		helpKey: "Server attached but no tools enabled yet."
	},
	revoked: {
		labelKey: "Revoked",
		className: "bg-red-500/15 text-red-700 dark:text-red-300 border-red-300/50",
		icon: Unplug,
		helpKey: "Credentials were rejected. Re-attach the server with a fresh key."
	}
};
function StatusBadge$2({ status }) {
	const { t } = useT();
	const cfg = statusConfig[status];
	const Icon = cfg.icon;
	return /* @__PURE__ */ jsxs("span", {
		className: cn("inline-flex items-center gap-1 rounded-full border px-2 py-0.5 text-[11px] font-medium", cfg.className),
		title: t(cfg.helpKey),
		children: [/* @__PURE__ */ jsx(Icon, { className: "size-3" }), t(cfg.labelKey)]
	});
}
function McpServers({ agent, servers }) {
	const { t } = useT();
	const confirm = useConfirm();
	const [pending, setPending] = useState(null);
	const breadcrumbs = [
		{
			title: t("Agents"),
			href: index$12.url()
		},
		{
			title: agent.name,
			href: show$4({ agent: agent.id }).url
		},
		{
			title: t("MCP integrations"),
			href: index$21({ agent: agent.id }).url
		}
	];
	const form = useForm({
		label: "",
		server_url: "",
		auth_type: "bearer",
		api_key: ""
	});
	const submit = (e) => {
		e.preventDefault();
		form.post(store$19({ agent: agent.id }).url, {
			preserveScroll: true,
			onSuccess: () => form.reset()
		});
	};
	const disconnect = async (server) => {
		if (!await confirm({
			title: t("Disconnect [:label]?", { label: server.label }),
			message: t("Removing this server disables every tool grant tied to it on this agent. Visitor messages that previously triggered these tools will fall back to plain RAG answers."),
			confirmLabel: t("Disconnect"),
			danger: true
		})) return;
		setPending(server.id);
		router.delete(destroy$14({
			agent: agent.id,
			mcpServer: server.id
		}).url, {
			preserveScroll: true,
			onFinish: () => setPending(null)
		});
	};
	const testConnection = (server) => {
		setPending(server.id);
		router.post(test({
			agent: agent.id,
			mcpServer: server.id
		}).url, {}, {
			preserveScroll: true,
			onFinish: () => setPending(null)
		});
	};
	const refresh$1 = (server) => {
		setPending(server.id);
		router.post(refresh({
			agent: agent.id,
			mcpServer: server.id
		}).url, {}, {
			preserveScroll: true,
			onFinish: () => setPending(null)
		});
	};
	return /* @__PURE__ */ jsxs(AppLayout, {
		breadcrumbs,
		children: [/* @__PURE__ */ jsx(Head, { title: t("MCP integrations") }), /* @__PURE__ */ jsxs("div", {
			className: "mx-auto w-full max-w-5xl space-y-6 p-4 sm:p-6",
			children: [
				/* @__PURE__ */ jsxs("div", {
					className: "flex flex-wrap items-start justify-between gap-3",
					children: [/* @__PURE__ */ jsxs("div", {
						className: "min-w-0",
						children: [/* @__PURE__ */ jsx("h1", {
							className: "text-2xl font-semibold",
							children: t("MCP integrations")
						}), /* @__PURE__ */ jsx("p", {
							className: "mt-1 max-w-2xl text-sm text-muted-foreground",
							children: t("Connect your agent to external tool servers (CRM, calendar, inventory, internal APIs) via the Model Context Protocol. The agent only calls tools you explicitly enable for it.")
						})]
					}), /* @__PURE__ */ jsx(Button, {
						variant: "outline",
						size: "sm",
						asChild: true,
						children: /* @__PURE__ */ jsxs("a", {
							href: "https://modelcontextprotocol.io/docs",
							target: "_blank",
							rel: "noreferrer noopener",
							children: [/* @__PURE__ */ jsx(ExternalLink, { className: "me-1.5 size-4" }), t("MCP docs")]
						})
					})]
				}),
				/* @__PURE__ */ jsxs(Card, { children: [/* @__PURE__ */ jsxs(CardHeader, { children: [/* @__PURE__ */ jsx(CardTitle, {
					className: "text-base",
					children: t("Attach a new MCP server")
				}), /* @__PURE__ */ jsx(CardDescription, { children: t("Point us at an HTTPS endpoint that speaks the Streamable HTTP transport. We discover tools immediately after attaching — none are enabled until you whitelist them.") })] }), /* @__PURE__ */ jsx(CardContent, { children: /* @__PURE__ */ jsxs("form", {
					onSubmit: submit,
					className: "space-y-4",
					children: [
						/* @__PURE__ */ jsxs("div", {
							className: "grid gap-4 sm:grid-cols-2",
							children: [/* @__PURE__ */ jsxs("div", {
								className: "space-y-1.5",
								children: [
									/* @__PURE__ */ jsx(Label, {
										htmlFor: "label",
										children: t("Label")
									}),
									/* @__PURE__ */ jsx(Input, {
										id: "label",
										value: form.data.label,
										onChange: (e) => form.setData("label", e.target.value),
										placeholder: t("e.g. Linear, HubSpot CRM"),
										required: true,
										autoFocus: true
									}),
									/* @__PURE__ */ jsx(InputError, { message: form.errors.label })
								]
							}), /* @__PURE__ */ jsxs("div", {
								className: "space-y-1.5",
								children: [
									/* @__PURE__ */ jsx(Label, {
										htmlFor: "server_url",
										children: t("Server URL")
									}),
									/* @__PURE__ */ jsx(Input, {
										id: "server_url",
										type: "url",
										value: form.data.server_url,
										onChange: (e) => form.setData("server_url", e.target.value),
										placeholder: "https://example.com/mcp",
										required: true
									}),
									/* @__PURE__ */ jsx(InputError, { message: form.errors.server_url })
								]
							})]
						}),
						/* @__PURE__ */ jsxs("div", {
							className: "grid gap-4 sm:grid-cols-2",
							children: [/* @__PURE__ */ jsxs("div", {
								className: "space-y-1.5",
								children: [
									/* @__PURE__ */ jsx(Label, {
										htmlFor: "auth_type",
										children: t("Authentication")
									}),
									/* @__PURE__ */ jsxs("select", {
										id: "auth_type",
										value: form.data.auth_type,
										onChange: (e) => form.setData("auth_type", e.target.value),
										className: "h-9 w-full rounded-md border border-input bg-background px-3 text-sm shadow-xs focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/40 focus-visible:outline-none",
										children: [/* @__PURE__ */ jsx("option", {
											value: "bearer",
											children: t("Bearer API key")
										}), /* @__PURE__ */ jsx("option", {
											value: "none",
											children: t("No auth")
										})]
									}),
									/* @__PURE__ */ jsx("p", {
										className: "text-[11px] text-muted-foreground",
										children: t("Keys are stored encrypted (AES-GCM) and never sent to the LLM.")
									})
								]
							}), form.data.auth_type === "bearer" && /* @__PURE__ */ jsxs("div", {
								className: "space-y-1.5",
								children: [
									/* @__PURE__ */ jsx(Label, {
										htmlFor: "api_key",
										children: t("API key")
									}),
									/* @__PURE__ */ jsx(Input, {
										id: "api_key",
										type: "password",
										value: form.data.api_key,
										onChange: (e) => form.setData("api_key", e.target.value),
										placeholder: "sk-…",
										autoComplete: "off"
									}),
									/* @__PURE__ */ jsx(InputError, { message: form.errors.api_key })
								]
							})]
						}),
						/* @__PURE__ */ jsx("div", {
							className: "flex items-center justify-end gap-2 border-t pt-4",
							children: /* @__PURE__ */ jsxs(Button, {
								type: "submit",
								disabled: form.processing,
								children: [form.processing ? /* @__PURE__ */ jsx(Loader2, { className: "me-1.5 size-4 animate-spin" }) : /* @__PURE__ */ jsx(Plug, { className: "me-1.5 size-4" }), t("Attach + discover tools")]
							})
						})
					]
				}) })] }),
				/* @__PURE__ */ jsxs("div", {
					className: "space-y-3",
					children: [/* @__PURE__ */ jsxs("div", {
						className: "flex items-center justify-between",
						children: [/* @__PURE__ */ jsx("h2", {
							className: "text-sm font-semibold tracking-wide text-muted-foreground uppercase",
							children: t("Connected servers")
						}), servers.length > 0 && /* @__PURE__ */ jsx("span", {
							className: "text-xs text-muted-foreground",
							children: t(":count connected", { count: servers.length })
						})]
					}), servers.length === 0 ? /* @__PURE__ */ jsx(EmptyState, {
						icon: Plug,
						title: t("No MCP servers connected yet"),
						description: t("Attach a server above. Tool calls remain disabled until you flip them on in the Manage tools screen.")
					}) : /* @__PURE__ */ jsx("div", {
						className: "space-y-3",
						children: servers.map((server) => {
							const busy = pending === server.id;
							return /* @__PURE__ */ jsx(Card, {
								className: "overflow-hidden",
								children: /* @__PURE__ */ jsx(CardContent, {
									className: "p-4",
									children: /* @__PURE__ */ jsxs("div", {
										className: "flex flex-wrap items-start justify-between gap-3",
										children: [/* @__PURE__ */ jsxs("div", {
											className: "min-w-0 flex-1 space-y-2",
											children: [
												/* @__PURE__ */ jsxs("div", {
													className: "flex flex-wrap items-center gap-2",
													children: [
														/* @__PURE__ */ jsx("p", {
															className: "font-medium",
															children: server.label
														}),
														/* @__PURE__ */ jsx(StatusBadge$2, { status: server.status }),
														server.server_name && /* @__PURE__ */ jsxs("span", {
															className: "text-[11px] text-muted-foreground",
															children: [server.server_name, server.server_version ? ` · v${server.server_version}` : ""]
														})
													]
												}),
												/* @__PURE__ */ jsx("p", {
													className: "truncate font-mono text-xs text-muted-foreground",
													children: server.server_url
												}),
												/* @__PURE__ */ jsxs("div", {
													className: "flex flex-wrap gap-x-4 gap-y-1 text-[11px] text-muted-foreground",
													children: [
														/* @__PURE__ */ jsxs("span", { children: [
															/* @__PURE__ */ jsx("strong", {
																className: "font-semibold text-foreground",
																children: server.granted_count
															}),
															" / ",
															server.tools_count,
															" ",
															t("tools enabled")
														] }),
														/* @__PURE__ */ jsxs("span", { children: [
															t("Synced"),
															" ",
															relativeTime$8(server.tools_synced_at, t("never"))
														] }),
														/* @__PURE__ */ jsxs("span", { children: [
															t("Last used"),
															" ",
															relativeTime$8(server.last_used_at, t("never"))
														] })
													]
												}),
												server.tools_sync_error && /* @__PURE__ */ jsxs("div", {
													className: "rounded-md border border-amber-300/50 bg-amber-50 p-2 text-xs text-amber-900 dark:border-amber-500/30 dark:bg-amber-500/10 dark:text-amber-200",
													children: [
														/* @__PURE__ */ jsx("strong", {
															className: "font-semibold",
															children: t("Last sync error:")
														}),
														" ",
														server.tools_sync_error
													]
												})
											]
										}), /* @__PURE__ */ jsxs("div", {
											className: "flex flex-wrap items-center gap-2",
											children: [
												/* @__PURE__ */ jsx(Button, {
													variant: "default",
													size: "sm",
													disabled: busy,
													asChild: true,
													children: /* @__PURE__ */ jsxs(Link, {
														href: tools({
															agent: agent.id,
															mcpServer: server.id
														}).url,
														children: [t("Manage tools"), server.tools_count > 0 && /* @__PURE__ */ jsxs("span", {
															className: "ms-2 rounded-full bg-primary-foreground/15 px-1.5 text-[10px] tabular-nums",
															children: [
																server.granted_count,
																"/",
																server.tools_count
															]
														})]
													})
												}),
												/* @__PURE__ */ jsxs(Button, {
													variant: "outline",
													size: "sm",
													disabled: busy,
													onClick: () => testConnection(server),
													title: t("Send a ping to the server"),
													children: [busy ? /* @__PURE__ */ jsx(Loader2, { className: "me-1.5 size-4 animate-spin" }) : /* @__PURE__ */ jsx(TestTube2, { className: "me-1.5 size-4" }), t("Test")]
												}),
												/* @__PURE__ */ jsxs(Button, {
													variant: "outline",
													size: "sm",
													disabled: busy,
													onClick: () => refresh$1(server),
													title: t("Re-run tools/list"),
													children: [/* @__PURE__ */ jsx(RefreshCw, { className: "me-1.5 size-4" }), t("Refresh")]
												}),
												/* @__PURE__ */ jsx(Button, {
													variant: "outline",
													size: "sm",
													asChild: true,
													children: /* @__PURE__ */ jsxs(Link, {
														href: activity({
															agent: agent.id,
															mcpServer: server.id
														}).url,
														children: [/* @__PURE__ */ jsx(Activity, { className: "me-1.5 size-4" }), t("Activity")]
													})
												}),
												/* @__PURE__ */ jsxs(Button, {
													variant: "ghost",
													size: "sm",
													disabled: busy,
													onClick: () => disconnect(server),
													className: "text-red-600 hover:bg-red-50 hover:text-red-700 dark:text-red-400 dark:hover:bg-red-500/10",
													children: [/* @__PURE__ */ jsx(Unplug, { className: "me-1.5 size-4" }), t("Disconnect")]
												})
											]
										})]
									})
								})
							}, server.id);
						})
					})]
				})
			]
		})]
	});
}
//#endregion
//#region resources/js/components/markdown-lite.tsx
function MarkdownLite({ markdown, variant = "chat" }) {
	const blocks = parseMarkdown(markdown);
	const styles = variant === "changelog" ? CHANGELOG_STYLES : CHAT_STYLES;
	return /* @__PURE__ */ jsx(Fragment$1, { children: blocks.map((block, i) => {
		if (block.kind === "spacer") return null;
		if (block.kind === "heading") return block.level === 2 ? /* @__PURE__ */ jsx("h3", {
			className: styles.h2,
			children: renderInline(block.text, styles)
		}, i) : /* @__PURE__ */ jsx("h4", {
			className: styles.h3,
			children: renderInline(block.text, styles)
		}, i);
		if (block.kind === "bullets") return /* @__PURE__ */ jsx("ul", {
			className: styles.ul,
			children: block.items.map((item, j) => /* @__PURE__ */ jsx("li", { children: renderInline(item, styles) }, j))
		}, i);
		return /* @__PURE__ */ jsx("p", {
			className: styles.p,
			children: renderInline(block.text, styles)
		}, i);
	}) });
}
var CHANGELOG_STYLES = {
	h2: "mt-6 text-base font-semibold text-slate-900",
	h3: "mt-5 text-sm font-semibold text-slate-900",
	ul: "mt-2 list-disc space-y-1 ps-6 text-[15px] leading-7 text-slate-700",
	p: "mt-3",
	code: "rounded bg-slate-100 px-1 font-mono text-[0.9em] text-slate-800",
	bold: "font-semibold text-slate-900"
};
var CHAT_STYLES = {
	h2: "mt-3 first:mt-0 text-sm font-semibold leading-tight",
	h3: "mt-2 first:mt-0 text-sm font-semibold leading-tight",
	ul: "my-1 list-disc space-y-0.5 ps-5",
	p: "mt-1 first:mt-0",
	code: "rounded bg-foreground/10 px-1 font-mono text-[0.85em]",
	bold: "font-semibold"
};
function parseMarkdown(markdown) {
	const lines = markdown.replace(/\r\n?/g, "\n").split("\n");
	const blocks = [];
	let bullets = null;
	let paragraph = null;
	const flushBullets = () => {
		if (bullets && bullets.length > 0) blocks.push({
			kind: "bullets",
			items: bullets
		});
		bullets = null;
	};
	const flushParagraph = () => {
		if (paragraph && paragraph.length > 0) blocks.push({
			kind: "paragraph",
			text: paragraph.join(" ")
		});
		paragraph = null;
	};
	for (const raw of lines) {
		const line = raw.trim();
		if (line === "") {
			flushBullets();
			flushParagraph();
			blocks.push({ kind: "spacer" });
			continue;
		}
		if (line.startsWith("### ")) {
			flushBullets();
			flushParagraph();
			blocks.push({
				kind: "heading",
				level: 3,
				text: line.slice(4)
			});
			continue;
		}
		if (line.startsWith("## ")) {
			flushBullets();
			flushParagraph();
			blocks.push({
				kind: "heading",
				level: 2,
				text: line.slice(3)
			});
			continue;
		}
		if (line.startsWith("- ") || line.startsWith("* ")) {
			flushParagraph();
			if (bullets === null) bullets = [];
			bullets.push(line.slice(2));
			continue;
		}
		flushBullets();
		if (paragraph === null) paragraph = [];
		paragraph.push(line);
	}
	flushBullets();
	flushParagraph();
	return blocks;
}
function renderInline(text, styles) {
	const tokens = [];
	let cursor = 0;
	while (cursor < text.length) {
		const remaining = text.slice(cursor);
		const codeMatch = remaining.match(/^`([^`]+)`/);
		if (codeMatch) {
			tokens.push({
				kind: "code",
				text: codeMatch[1]
			});
			cursor += codeMatch[0].length;
			continue;
		}
		const boldMatch = remaining.match(/^\*\*([^*]+)\*\*/);
		if (boldMatch) {
			tokens.push({
				kind: "bold",
				text: boldMatch[1]
			});
			cursor += boldMatch[0].length;
			continue;
		}
		const nextMarker = remaining.search(/`|\*\*/);
		if (nextMarker === -1) {
			tokens.push(remaining);
			cursor = text.length;
			continue;
		}
		tokens.push(remaining.slice(0, nextMarker));
		cursor += nextMarker;
	}
	return tokens.map((token, i) => {
		if (typeof token === "string") return /* @__PURE__ */ jsx(Fragment, { children: token }, i);
		if (token.kind === "code") return /* @__PURE__ */ jsx("code", {
			className: styles.code,
			children: token.text
		}, i);
		return /* @__PURE__ */ jsx("strong", {
			className: styles.bold,
			children: token.text
		}, i);
	});
}
//#endregion
//#region resources/js/components/playground/diagnostics-panel.tsx
function DiagnosticsPanel({ state }) {
	const { t } = useT();
	if (!(state.sources.length > 0 || state.systemPrompt.length > 0 || state.totalMs !== null)) return /* @__PURE__ */ jsxs("div", {
		className: "flex flex-col gap-3 rounded-lg border border-dashed p-4",
		children: [
			/* @__PURE__ */ jsxs("div", {
				className: "flex items-center gap-2 text-sm font-medium",
				children: [/* @__PURE__ */ jsx(Activity, { className: "h-4 w-4 text-muted-foreground" }), t("Diagnostics")]
			}),
			/* @__PURE__ */ jsx("p", {
				className: "text-xs leading-relaxed text-muted-foreground",
				children: t("After your first turn, this tab shows everything that shaped the reply:")
			}),
			/* @__PURE__ */ jsxs("ul", {
				className: "ms-4 flex list-disc flex-col gap-0.5 text-xs text-muted-foreground",
				children: [
					/* @__PURE__ */ jsx("li", { children: t("First-token + total latency") }),
					/* @__PURE__ */ jsx("li", { children: t("Retrieved chunks with ANN and rerank scores") }),
					/* @__PURE__ */ jsx("li", { children: t("The exact system prompt used") }),
					/* @__PURE__ */ jsx("li", { children: t("Tool calls fired during the turn") }),
					/* @__PURE__ */ jsx("li", { children: t("Inline blocks the LLM emitted") })
				]
			})
		]
	});
	return /* @__PURE__ */ jsxs("div", {
		className: "flex flex-col gap-5",
		children: [
			/* @__PURE__ */ jsx(Section$5, {
				icon: /* @__PURE__ */ jsx(Clock, { className: "h-3.5 w-3.5" }),
				title: t("Latency"),
				children: /* @__PURE__ */ jsxs("dl", {
					className: "grid grid-cols-2 gap-x-4 gap-y-1 text-xs",
					children: [
						/* @__PURE__ */ jsx("dt", {
							className: "text-muted-foreground",
							children: t("First token")
						}),
						/* @__PURE__ */ jsx("dd", {
							className: "font-mono",
							children: state.firstTokenMs !== null ? `${state.firstTokenMs} ms` : "—"
						}),
						/* @__PURE__ */ jsx("dt", {
							className: "text-muted-foreground",
							children: t("Total")
						}),
						/* @__PURE__ */ jsx("dd", {
							className: "font-mono",
							children: state.totalMs !== null ? `${state.totalMs} ms` : "—"
						}),
						/* @__PURE__ */ jsx("dt", {
							className: "text-muted-foreground",
							children: t("Confidence")
						}),
						/* @__PURE__ */ jsx("dd", {
							className: "font-mono",
							children: state.confidence !== null ? state.confidence.toFixed(3) : "—"
						}),
						/* @__PURE__ */ jsx("dt", {
							className: "text-muted-foreground",
							children: t("Threshold")
						}),
						/* @__PURE__ */ jsx("dd", {
							className: "font-mono",
							children: state.threshold !== null ? state.threshold.toFixed(2) : "—"
						})
					]
				})
			}),
			/* @__PURE__ */ jsx(Section$5, {
				icon: /* @__PURE__ */ jsx(Database, { className: "h-3.5 w-3.5" }),
				title: t("Retrieved sources (:count)", { count: state.sources.length }),
				children: state.sources.length === 0 ? /* @__PURE__ */ jsx("p", {
					className: "text-xs text-muted-foreground",
					children: t("No chunks retrieved.")
				}) : /* @__PURE__ */ jsx("ol", {
					className: "flex flex-col gap-2",
					children: state.sources.map((source, i) => /* @__PURE__ */ jsxs("li", {
						className: "rounded-md border bg-muted/40 p-2 text-xs",
						children: [
							/* @__PURE__ */ jsxs("div", {
								className: "flex items-baseline justify-between gap-2",
								children: [/* @__PURE__ */ jsxs("span", {
									className: "font-mono text-muted-foreground",
									children: [
										"[",
										i + 1,
										"]"
									]
								}), /* @__PURE__ */ jsxs("div", {
									className: "flex items-center gap-1",
									children: [/* @__PURE__ */ jsxs(Badge, {
										variant: "outline",
										className: "font-mono text-[10px]",
										children: ["ann ", source.score.toFixed(3)]
									}), source.rerank_score !== null && /* @__PURE__ */ jsxs(Badge, {
										variant: "outline",
										className: "font-mono text-[10px]",
										children: [
											"rerank",
											" ",
											source.rerank_score.toFixed(3)
										]
									})]
								})]
							}),
							source.url && /* @__PURE__ */ jsx("a", {
								href: source.url,
								target: "_blank",
								rel: "noopener noreferrer",
								className: "mt-1 line-clamp-1 text-primary underline-offset-2 hover:underline",
								children: source.url
							}),
							/* @__PURE__ */ jsx("p", {
								className: "mt-1 line-clamp-3 leading-snug text-muted-foreground",
								children: source.snippet
							})
						]
					}, i))
				})
			}),
			state.toolCalls.length > 0 && /* @__PURE__ */ jsx(Section$5, {
				icon: /* @__PURE__ */ jsx(Wrench, { className: "h-3.5 w-3.5" }),
				title: t("Tool calls (:count)", { count: state.toolCalls.length }),
				children: /* @__PURE__ */ jsx("ol", {
					className: "flex flex-col gap-1.5",
					children: state.toolCalls.map((call, i) => /* @__PURE__ */ jsxs("li", {
						className: "rounded-md border bg-muted/40 p-2 text-xs",
						children: [/* @__PURE__ */ jsx("div", {
							className: "font-semibold",
							children: call.name
						}), /* @__PURE__ */ jsx("pre", {
							className: "mt-1 overflow-x-auto rounded bg-background p-1.5 font-mono text-[11px]",
							children: JSON.stringify(call.args, null, 2)
						})]
					}, i))
				})
			}),
			state.blocks.length > 0 && /* @__PURE__ */ jsx(Section$5, {
				icon: /* @__PURE__ */ jsx(Activity, { className: "h-3.5 w-3.5" }),
				title: t("Inline blocks (:count)", { count: state.blocks.length }),
				children: /* @__PURE__ */ jsx("div", {
					className: "flex flex-wrap gap-1",
					children: state.blocks.map((block, i) => /* @__PURE__ */ jsx(Badge, {
						variant: "secondary",
						className: "font-mono text-[10px]",
						children: block.type
					}, i))
				})
			}),
			/* @__PURE__ */ jsxs(Section$5, {
				icon: /* @__PURE__ */ jsx(FileText, { className: "h-3.5 w-3.5" }),
				title: t("System prompt"),
				children: [/* @__PURE__ */ jsxs("details", {
					className: "text-xs",
					children: [/* @__PURE__ */ jsx("summary", {
						className: "cursor-pointer text-muted-foreground hover:text-foreground",
						children: t(":count characters · expand", { count: state.systemPrompt.length.toLocaleString() })
					}), /* @__PURE__ */ jsx("pre", {
						className: "mt-2 max-h-72 overflow-auto rounded-md border bg-muted/30 p-2 font-mono text-[11px] leading-relaxed whitespace-pre-wrap",
						children: state.systemPrompt
					})]
				}), /* @__PURE__ */ jsxs("dl", {
					className: "mt-2 grid grid-cols-2 gap-x-4 gap-y-1 text-xs",
					children: [
						/* @__PURE__ */ jsx("dt", {
							className: "text-muted-foreground",
							children: t("Vertical applied")
						}),
						/* @__PURE__ */ jsx("dd", {
							className: "font-mono",
							children: state.vertical ?? t("none")
						}),
						/* @__PURE__ */ jsx("dt", {
							className: "text-muted-foreground",
							children: t("Language")
						}),
						/* @__PURE__ */ jsx("dd", {
							className: "font-mono",
							children: state.language ?? t("auto")
						}),
						/* @__PURE__ */ jsx("dt", {
							className: "text-muted-foreground",
							children: t("History turns")
						}),
						/* @__PURE__ */ jsx("dd", {
							className: "font-mono",
							children: state.historyCount
						})
					]
				})]
			})
		]
	});
}
function Section$5({ icon, title, children }) {
	return /* @__PURE__ */ jsxs("section", {
		className: "flex flex-col gap-2",
		children: [/* @__PURE__ */ jsxs("h3", {
			className: "flex items-center gap-1.5 text-xs font-semibold tracking-wide text-muted-foreground uppercase",
			children: [icon, title]
		}), children]
	});
}
var EMPTY_DIAGNOSTICS = {
	sources: [],
	confidence: null,
	threshold: null,
	pageUrlUsed: null,
	systemPrompt: "",
	historyCount: 0,
	vertical: null,
	language: null,
	toolCalls: [],
	blocks: [],
	firstTokenMs: null,
	totalMs: null
};
//#endregion
//#region resources/js/components/playground/inline-blocks.tsx
function ProductCard({ block }) {
	const { t } = useT();
	const p = block.payload;
	const title = p.title ?? t("Product");
	const url = p.url;
	const image = p.image;
	const summary = p.summary;
	const price = formatPrice$4(p.price, p.currency);
	return /* @__PURE__ */ jsxs("a", {
		href: url ?? void 0,
		target: url ? "_blank" : void 0,
		rel: url ? "noopener noreferrer" : void 0,
		className: "mt-2 flex gap-3 rounded-xl border bg-card p-3 text-sm shadow-sm transition hover:border-primary/40 hover:shadow",
		children: [image && /* @__PURE__ */ jsx("img", {
			src: image,
			alt: "",
			className: "h-16 w-16 flex-shrink-0 rounded-md bg-muted object-cover",
			onError: (e) => {
				e.currentTarget.style.display = "none";
			}
		}), /* @__PURE__ */ jsxs("div", {
			className: "flex min-w-0 flex-1 flex-col gap-0.5",
			children: [
				/* @__PURE__ */ jsx("div", {
					className: "truncate leading-tight font-semibold",
					children: title
				}),
				summary && /* @__PURE__ */ jsx("div", {
					className: "line-clamp-2 text-xs text-muted-foreground",
					children: summary
				}),
				/* @__PURE__ */ jsxs("div", {
					className: "mt-1 flex items-center justify-between gap-2",
					children: [price && /* @__PURE__ */ jsx("span", {
						className: "font-bold text-foreground",
						children: price
					}), url && /* @__PURE__ */ jsxs("span", {
						className: "flex items-center gap-1 text-xs font-semibold text-primary",
						children: [t("View"), /* @__PURE__ */ jsx(ExternalLink, { className: "h-3 w-3" })]
					})]
				})
			]
		})]
	});
}
function PricingCard({ block }) {
	const { t } = useT();
	const p = block.payload;
	const title = p.title ?? t("Plan");
	const price = formatPrice$4(p.price, p.currency);
	const period = p.period ? ` / ${p.period}` : "";
	const cta = p.cta ?? t("Get started");
	const url = p.url;
	return /* @__PURE__ */ jsxs("a", {
		href: url ?? void 0,
		target: url ? "_blank" : void 0,
		rel: url ? "noopener noreferrer" : void 0,
		className: "mt-2 block rounded-xl border border-indigo-200 bg-gradient-to-br from-indigo-50 to-background p-3 transition hover:shadow",
		children: [
			/* @__PURE__ */ jsx("div", {
				className: "text-[11px] font-semibold tracking-wider text-indigo-700 uppercase",
				children: title
			}),
			price && /* @__PURE__ */ jsxs("div", {
				className: "mt-1 text-2xl leading-none font-bold",
				children: [price, period && /* @__PURE__ */ jsx("span", {
					className: "ms-1 text-sm font-medium text-muted-foreground",
					children: period
				})]
			}),
			/* @__PURE__ */ jsxs("div", {
				className: "mt-2 inline-flex rounded-full bg-indigo-700 px-3 py-1 text-xs font-semibold text-white",
				children: [cta, " →"]
			})
		]
	});
}
function CaseStudyCard({ block }) {
	const { t } = useT();
	const p = block.payload;
	const title = p.title ?? t("Case study");
	const outcome = p.outcome;
	const url = p.url;
	return /* @__PURE__ */ jsxs("a", {
		href: url ?? void 0,
		target: url ? "_blank" : void 0,
		rel: url ? "noopener noreferrer" : void 0,
		className: "mt-2 block rounded-xl border border-amber-200 bg-amber-50 p-3 transition hover:shadow",
		children: [
			/* @__PURE__ */ jsx("div", {
				className: "text-[11px] font-semibold tracking-wider text-amber-800 uppercase",
				children: t("Case study")
			}),
			/* @__PURE__ */ jsx("div", {
				className: "mt-1 font-semibold text-foreground",
				children: title
			}),
			outcome && /* @__PURE__ */ jsx("div", {
				className: "mt-1 text-sm leading-snug text-muted-foreground",
				children: outcome
			}),
			url && /* @__PURE__ */ jsx("div", {
				className: "mt-2 text-xs font-semibold text-amber-800",
				children: t("Read more →")
			})
		]
	});
}
function EscalationButton({ block, onEscalationClick }) {
	const { t } = useT();
	const label = typeof block.payload.label === "string" ? block.payload.label : t("Connect me with a human");
	return /* @__PURE__ */ jsx("div", {
		className: "mt-2 flex",
		children: /* @__PURE__ */ jsxs("button", {
			type: "button",
			onClick: onEscalationClick,
			className: "inline-flex items-center gap-2 rounded-full bg-foreground px-3.5 py-2 text-xs font-semibold text-background shadow-sm hover:opacity-90",
			children: [/* @__PURE__ */ jsx(MessageSquare, { className: "h-3.5 w-3.5" }), label]
		})
	});
}
var RENDERERS = {
	product_card: ProductCard,
	pricing_card: PricingCard,
	case_study_card: CaseStudyCard,
	escalation_button: EscalationButton
};
function InlineBlockList({ blocks, onEscalationClick }) {
	const { t } = useT();
	if (!blocks.length) return null;
	return /* @__PURE__ */ jsx("div", {
		className: "mt-1 flex flex-col gap-1",
		children: blocks.map((block, i) => {
			const Renderer = RENDERERS[block.type];
			if (!Renderer) return /* @__PURE__ */ jsxs("div", {
				className: "mt-2 rounded-md border border-dashed border-muted-foreground/30 px-2.5 py-1.5 text-xs text-muted-foreground",
				children: [
					t("Unknown block type:"),
					" ",
					/* @__PURE__ */ jsx("code", {
						className: "font-mono",
						children: block.type
					})
				]
			}, i);
			return /* @__PURE__ */ jsx(Renderer, {
				block,
				onEscalationClick
			}, i);
		})
	});
}
function formatPrice$4(amount, currency) {
	if (!amount) return null;
	const num = parseFloat(amount.replace(/[^0-9.]/g, ""));
	if (!Number.isFinite(num)) return currency ? `${amount} ${currency}` : amount;
	if (currency) try {
		return new Intl.NumberFormat(void 0, {
			style: "currency",
			currency: currency.toUpperCase()
		}).format(num);
	} catch {
		return `${num.toFixed(2)} ${currency.toUpperCase()}`;
	}
	return `$${num.toFixed(2)}`;
}
//#endregion
//#region resources/js/components/playground/scenario-presets.ts
var PAGE_TEMPLATES = [
	{
		id: "blank",
		label: "No page context",
		vertical: "generic",
		description: "Visitor has no page metadata — same baseline as not sending any context.",
		payload: {}
	},
	{
		id: "shopify-product",
		label: "Shopify product page",
		vertical: "ecommerce",
		description: "Product detail page with og:type=product, JSON-LD Product, and a buy CTA.",
		payload: {
			url: "https://shop.example.com/products/red-canvas-tote",
			title: "Red canvas tote — Acme Goods",
			description: "Heavy-duty 16oz canvas tote, reinforced stitching, fits a 15\" laptop.",
			og: {
				type: "product",
				site_name: "Acme Goods",
				"price:amount": "49.00",
				"price:currency": "USD",
				availability: "in stock",
				brand: "Acme"
			},
			json_ld: {
				"@context": "https://schema.org",
				"@type": "Product",
				name: "Red canvas tote",
				offers: {
					"@type": "Offer",
					price: "49.00",
					priceCurrency: "USD",
					availability: "https://schema.org/InStock"
				}
			},
			h1: "Red canvas tote",
			h2: [
				"Specs",
				"Shipping",
				"Reviews"
			],
			visible_text: "Built for the long haul. 16oz cotton canvas, double-stitched seams. Free shipping on orders over $75. 30-day returns."
		}
	},
	{
		id: "stripe-pricing",
		label: "SaaS pricing page",
		vertical: "saas",
		description: "Three-plan pricing comparison with Offer JSON-LD and a \"Start free trial\" CTA.",
		payload: {
			url: "https://app.example.com/pricing",
			title: "Pricing — ExampleApp",
			description: "Choose a plan that fits your team. Start free, upgrade anytime.",
			og: {
				type: "website",
				site_name: "ExampleApp"
			},
			json_ld: {
				"@context": "https://schema.org",
				"@type": "Product",
				name: "ExampleApp",
				offers: [
					{
						"@type": "Offer",
						name: "Starter",
						price: "0"
					},
					{
						"@type": "Offer",
						name: "Pro",
						price: "29"
					},
					{
						"@type": "Offer",
						name: "Team",
						price: "99"
					}
				]
			},
			h1: "Pricing",
			h2: [
				"Starter",
				"Pro",
				"Team",
				"Frequently asked questions"
			],
			visible_text: "Starter — Free forever. Pro — $29/mo, billed annually. Team — $99/mo, billed annually. All plans include unlimited projects."
		}
	},
	{
		id: "docusaurus-page",
		label: "Docs / API reference page",
		vertical: "documentation",
		description: "Documentation site with code blocks, og:type=article, and a Generator: Docusaurus signal.",
		payload: {
			url: "https://docs.example.com/api/auth",
			title: "Authentication — ExampleApp Docs",
			description: "Auth API endpoints, request/response shapes, and code samples.",
			og: {
				type: "article",
				site_name: "ExampleApp Docs"
			},
			h1: "Authentication",
			h2: [
				"Issuing a token",
				"Refreshing a token",
				"Revoking a token",
				"Errors"
			],
			visible_text: "Issue a token with POST /v1/auth/token. Send your client_id and client_secret in the body. The response includes an access_token, refresh_token, and an expires_in field in seconds."
		}
	},
	{
		id: "help-article",
		label: "Help center article",
		vertical: "help_center",
		description: "Support article shaped like Intercom / Zendesk, with FAQPage JSON-LD.",
		payload: {
			url: "https://help.example.com/articles/reset-password",
			title: "How to reset your password — ExampleApp Help",
			description: "Steps to reset your password if you can't sign in or want to rotate it.",
			og: {
				type: "article",
				site_name: "ExampleApp Help"
			},
			json_ld: {
				"@context": "https://schema.org",
				"@type": "FAQPage",
				mainEntity: [{
					"@type": "Question",
					name: "I forgot my password",
					acceptedAnswer: {
						"@type": "Answer",
						text: "Click \"Forgot password\" on the sign-in page."
					}
				}]
			},
			h1: "How to reset your password",
			h2: [
				"If you can sign in",
				"If you can't sign in",
				"Troubleshooting"
			],
			visible_text: "If you can sign in, open Settings → Security → Change password. If you can't sign in, click \"Forgot password\" on the login screen and follow the email link."
		}
	},
	{
		id: "wordpress-post",
		label: "WordPress post / page",
		vertical: "marketing",
		description: "Mirrors what the Pitchbar WordPress plugin sends for a regular WP post — `source: \"wordpress\"`, post_id, post_type, taxonomy, plus the same og/json_ld a theme would emit.",
		payload: {
			source: "wordpress",
			site_url: "https://shop.example.com/",
			page_url: "https://shop.example.com/blog/how-to-style-a-canvas-tote",
			page_title: "How to style a canvas tote — Acme Goods",
			url: "https://shop.example.com/blog/how-to-style-a-canvas-tote",
			title: "How to style a canvas tote — Acme Goods",
			description: "Five outfit pairings for a 16oz canvas tote. Weekend, work, travel, gym, errands.",
			permalink: "https://shop.example.com/blog/how-to-style-a-canvas-tote",
			post_id: 142,
			post_type: "post",
			categories: ["style-guides", "totes"],
			tags: ["canvas", "summer"],
			og: {
				type: "article",
				site_name: "Acme Goods"
			},
			h1: "How to style a canvas tote",
			h2: [
				"Weekend",
				"Work",
				"Travel",
				"Gym",
				"Errands"
			],
			visible_text: "A 16oz canvas tote works for almost any outing — pair it with a linen shirt and slip-ons for weekend errands, or dress it up with a blazer for casual-Friday at the office. Free shipping on orders over $75."
		}
	},
	{
		id: "wordpress-woo-product",
		label: "WooCommerce product page",
		vertical: "ecommerce",
		description: "Exact payload the WP plugin emits on `is_product()` — nested `woo` object with id/sku/price/currency/stock_status, plus the regular WP fields and Product JSON-LD. Use to rehearse <product/> emission + the lookup_order tool.",
		payload: {
			source: "wordpress",
			site_url: "https://shop.example.com/",
			page_url: "https://shop.example.com/product/blue-tee",
			page_title: "Blue tee — Acme Goods",
			url: "https://shop.example.com/product/blue-tee",
			title: "Blue tee — Acme Goods",
			description: "100% combed ring-spun cotton, double-stitched seams, classic crew neck. Sizes XS–XXL.",
			permalink: "https://shop.example.com/product/blue-tee",
			post_id: 9001,
			post_type: "product",
			categories: ["tees", "summer"],
			tags: [],
			og: {
				type: "product",
				site_name: "Acme Goods",
				"price:amount": "29.00",
				"price:currency": "USD",
				availability: "in stock"
			},
			json_ld: {
				"@context": "https://schema.org",
				"@type": "Product",
				name: "Blue tee",
				sku: "T-BLU-M",
				offers: {
					"@type": "Offer",
					price: "29.00",
					priceCurrency: "USD",
					availability: "https://schema.org/InStock"
				}
			},
			woo: {
				id: 9001,
				sku: "T-BLU-M",
				name: "Blue tee",
				permalink: "https://shop.example.com/product/blue-tee",
				price: "29.00",
				regular_price: "39.00",
				sale_price: "29.00",
				currency: "USD",
				stock_status: "instock",
				on_sale: true
			},
			h1: "Blue tee",
			h2: [
				"Description",
				"Sizing",
				"Reviews"
			],
			visible_text: "100% combed ring-spun cotton, double-stitched seams, classic crew neck. Sizes XS–XXL. On sale from $39 to $29. Free shipping over $75. 30-day returns."
		}
	},
	{
		id: "marketing-landing",
		label: "Marketing landing page",
		vertical: "marketing",
		description: "Top-of-funnel landing page with a \"Book a demo\" CTA and a testimonial section.",
		payload: {
			url: "https://example.com/",
			title: "ExampleApp — The fastest way to ship",
			description: "Teams of every size use ExampleApp to ship features faster.",
			og: {
				type: "website",
				site_name: "ExampleApp"
			},
			h1: "Ship features faster.",
			h2: [
				"Trusted by teams everywhere",
				"Built for engineers",
				"Frequently asked questions",
				"Book a demo"
			],
			visible_text: "Loved by 10,000+ teams. ExampleApp gives you the tools to ship twice as fast. Book a demo or start your free trial today."
		}
	}
];
/**
* Sample buyer-realistic prompts per vertical. Rendered as clickable
* chips so the admin can fire a typical question without typing.
*
* Generic gets a "warm-up" set that works on any agent regardless of
* site type — useful for the very first manual smoke test.
*/
var SAMPLE_PROMPTS = {
	ecommerce: [
		"What's the price of this?",
		"Do you ship internationally?",
		"What's your return policy?",
		"Recommend a product for my partner's birthday",
		"Is this in stock right now?"
	],
	documentation: [
		"How do I install this?",
		"Show me an authentication example",
		"What does the rate-limit error look like?",
		"How do I refresh an access token?",
		"Where is the changelog?"
	],
	saas: [
		"Show me your pricing",
		"Whats the difference between Pro and Team?",
		"Can I get a demo?",
		"Do you have a free trial?",
		"How do you compare to {Competitor}?"
	],
	help_center: [
		"I forgot my password",
		"I can't sign in — please help",
		"Where are my invoices?",
		"How do I cancel my subscription?",
		"Connect me with a human"
	],
	marketing: [
		"What does ExampleApp do?",
		"Who is this for?",
		"Show me a customer success story",
		"How long does setup take?",
		"Can I book a demo?"
	],
	internal_kb: [
		"What is our PTO policy?",
		"How do I request access to a Notion page?",
		"Where is the on-call runbook?",
		"Who owns the billing pipeline?"
	],
	generic: [
		"What is this site about?",
		"How can you help me?",
		"What can you do?",
		"Tell me what you've been trained on"
	]
};
/**
* Look up a template by id. Returns the blank template when the id is
* unknown — keeps the form non-empty when the dropdown lands in a weird
* state during fast clicks.
*/
function pageTemplateById(id) {
	return PAGE_TEMPLATES.find((t) => t.id === id) ?? PAGE_TEMPLATES[0];
}
//#endregion
//#region resources/js/components/playground/page-context-form.tsx
function PageContextForm({ value, onChange }) {
	const { t } = useT();
	const [wpOpen, setWpOpen] = useState(() => value.source === "wordpress" || value.post_id !== void 0);
	const jsonLdString = useMemo(() => {
		if (value.json_ld === void 0 || value.json_ld === null) return "";
		try {
			return JSON.stringify(value.json_ld, null, 2);
		} catch {
			return "";
		}
	}, [value.json_ld]);
	const set = (patch) => onChange({
		...value,
		...patch
	});
	const setWoo = (patch) => {
		const next = {
			...value.woo ?? {},
			...patch
		};
		for (const [k, v] of Object.entries(next)) if (typeof v === "string" && v.trim() === "") delete next[k];
		onChange({
			...value,
			woo: Object.keys(next).length === 0 ? void 0 : next
		});
	};
	const csvFromArray = (arr) => Array.isArray(arr) ? arr.join(", ") : "";
	const arrayFromCsv = (raw) => {
		const parts = raw.split(",").map((s) => s.trim()).filter((s) => s !== "");
		return parts.length === 0 ? void 0 : parts;
	};
	return /* @__PURE__ */ jsxs("div", {
		className: "flex flex-col gap-4",
		children: [
			/* @__PURE__ */ jsxs("div", {
				className: "flex items-end gap-2",
				children: [/* @__PURE__ */ jsxs("div", {
					className: "flex-1",
					children: [/* @__PURE__ */ jsx(Label, {
						className: "text-xs font-semibold tracking-wide text-muted-foreground uppercase",
						children: t("Use template")
					}), /* @__PURE__ */ jsxs(Select, {
						value: "",
						onValueChange: (id) => {
							const tpl = pageTemplateById(id);
							onChange(structuredClone(tpl.payload));
						},
						children: [/* @__PURE__ */ jsx(SelectTrigger, { children: /* @__PURE__ */ jsx(SelectValue, { placeholder: t("Pick a starting page…") }) }), /* @__PURE__ */ jsx(SelectContent, { children: PAGE_TEMPLATES.map((tpl) => /* @__PURE__ */ jsx(SelectItem, {
							value: tpl.id,
							children: tpl.label
						}, tpl.id)) })]
					})]
				}), /* @__PURE__ */ jsx(Button, {
					type: "button",
					variant: "outline",
					size: "sm",
					onClick: () => onChange({}),
					title: t("Clear page context"),
					children: /* @__PURE__ */ jsx(Trash2, { className: "h-3.5 w-3.5" })
				})]
			}),
			/* @__PURE__ */ jsxs("div", {
				className: "flex flex-col gap-1.5",
				children: [/* @__PURE__ */ jsx(Label, {
					htmlFor: "pg-url",
					className: "text-xs font-semibold tracking-wide text-muted-foreground uppercase",
					children: t("URL")
				}), /* @__PURE__ */ jsx(Input, {
					id: "pg-url",
					value: value.url ?? "",
					placeholder: "https://example.com/products/red-pen",
					onChange: (e) => set({ url: e.target.value || void 0 })
				})]
			}),
			/* @__PURE__ */ jsxs("div", {
				className: "flex flex-col gap-1.5",
				children: [/* @__PURE__ */ jsx(Label, {
					htmlFor: "pg-title",
					className: "text-xs font-semibold tracking-wide text-muted-foreground uppercase",
					children: t("Title")
				}), /* @__PURE__ */ jsx(Input, {
					id: "pg-title",
					value: value.title ?? "",
					placeholder: t("Page title"),
					onChange: (e) => set({ title: e.target.value || void 0 })
				})]
			}),
			/* @__PURE__ */ jsxs("div", {
				className: "flex flex-col gap-1.5",
				children: [/* @__PURE__ */ jsx(Label, {
					htmlFor: "pg-desc",
					className: "text-xs font-semibold tracking-wide text-muted-foreground uppercase",
					children: t("Description")
				}), /* @__PURE__ */ jsx(Textarea, {
					id: "pg-desc",
					rows: 2,
					value: value.description ?? "",
					placeholder: t("Meta description"),
					onChange: (e) => set({ description: e.target.value || void 0 })
				})]
			}),
			/* @__PURE__ */ jsxs("div", {
				className: "flex flex-col gap-1.5",
				children: [/* @__PURE__ */ jsx(Label, {
					className: "text-xs font-semibold tracking-wide text-muted-foreground uppercase",
					children: "og:type"
				}), /* @__PURE__ */ jsxs(Select, {
					value: String(value.og?.type ?? "__none__"),
					onValueChange: (v) => set({ og: {
						...value.og ?? {},
						...v === "__none__" ? { type: void 0 } : { type: v }
					} }),
					children: [/* @__PURE__ */ jsx(SelectTrigger, { children: /* @__PURE__ */ jsx(SelectValue, {}) }), /* @__PURE__ */ jsxs(SelectContent, { children: [
						/* @__PURE__ */ jsx(SelectItem, {
							value: "__none__",
							children: t("Not set")
						}),
						/* @__PURE__ */ jsx(SelectItem, {
							value: "website",
							children: "website"
						}),
						/* @__PURE__ */ jsx(SelectItem, {
							value: "article",
							children: "article"
						}),
						/* @__PURE__ */ jsx(SelectItem, {
							value: "product",
							children: "product"
						}),
						/* @__PURE__ */ jsx(SelectItem, {
							value: "book",
							children: "book"
						}),
						/* @__PURE__ */ jsx(SelectItem, {
							value: "video.other",
							children: "video.other"
						})
					] })]
				})]
			}),
			/* @__PURE__ */ jsxs("div", {
				className: "flex flex-col gap-1.5",
				children: [/* @__PURE__ */ jsx(Label, {
					htmlFor: "pg-h1",
					className: "text-xs font-semibold tracking-wide text-muted-foreground uppercase",
					children: "H1"
				}), /* @__PURE__ */ jsx(Input, {
					id: "pg-h1",
					value: value.h1 ?? "",
					onChange: (e) => set({ h1: e.target.value || void 0 })
				})]
			}),
			/* @__PURE__ */ jsxs("div", {
				className: "flex flex-col gap-1.5",
				children: [/* @__PURE__ */ jsx(Label, {
					htmlFor: "pg-jsonld",
					className: "text-xs font-semibold tracking-wide text-muted-foreground uppercase",
					children: t("JSON-LD")
				}), /* @__PURE__ */ jsx(Textarea, {
					id: "pg-jsonld",
					rows: 6,
					className: "font-mono text-xs",
					value: jsonLdString,
					placeholder: "{\"@type\":\"Product\",...}",
					onChange: (e) => {
						const raw = e.target.value;
						if (raw.trim() === "") {
							set({ json_ld: void 0 });
							return;
						}
						try {
							set({ json_ld: JSON.parse(raw) });
						} catch {
							set({ json_ld: raw });
						}
					}
				})]
			}),
			/* @__PURE__ */ jsxs("div", {
				className: "flex flex-col gap-1.5",
				children: [/* @__PURE__ */ jsx(Label, {
					htmlFor: "pg-vis",
					className: "text-xs font-semibold tracking-wide text-muted-foreground uppercase",
					children: t("Visible body text")
				}), /* @__PURE__ */ jsx(Textarea, {
					id: "pg-vis",
					rows: 4,
					value: value.visible_text ?? "",
					placeholder: t("Body content the visitor would see"),
					onChange: (e) => set({ visible_text: e.target.value || void 0 })
				})]
			}),
			/* @__PURE__ */ jsxs("section", {
				className: "flex flex-col gap-3 rounded-md border bg-muted/20 p-3",
				children: [/* @__PURE__ */ jsxs("button", {
					type: "button",
					onClick: () => setWpOpen((v) => !v),
					className: "flex items-center justify-between text-xs font-semibold tracking-wide text-muted-foreground uppercase hover:text-foreground",
					children: [/* @__PURE__ */ jsxs("span", {
						className: "flex items-center gap-1.5",
						children: [wpOpen ? /* @__PURE__ */ jsx(ChevronDown, { className: "h-3 w-3" }) : /* @__PURE__ */ jsx(ChevronRight, { className: "h-3 w-3" }), t("WordPress / WooCommerce")]
					}), value.source === "wordpress" && /* @__PURE__ */ jsx("span", {
						className: "rounded bg-primary/15 px-1.5 py-0.5 text-[10px] font-medium tracking-normal text-primary normal-case",
						children: t("source: wordpress")
					})]
				}), wpOpen && /* @__PURE__ */ jsxs("div", {
					className: "flex flex-col gap-3",
					children: [
						/* @__PURE__ */ jsx("p", {
							className: "text-xs leading-snug text-muted-foreground",
							children: t("Match the WP plugin's PageContext::collect() payload so the playground exercises the same retrieval and prompt path your live site will. Leave blank for non-WP sites.")
						}),
						/* @__PURE__ */ jsxs("div", {
							className: "flex flex-col gap-1.5",
							children: [/* @__PURE__ */ jsx(Label, {
								className: "text-[10px] font-semibold tracking-wide text-muted-foreground uppercase",
								children: t("source")
							}), /* @__PURE__ */ jsxs(Select, {
								value: value.source ?? "__none__",
								onValueChange: (v) => set({ source: v === "wordpress" ? "wordpress" : void 0 }),
								children: [/* @__PURE__ */ jsx(SelectTrigger, { children: /* @__PURE__ */ jsx(SelectValue, {}) }), /* @__PURE__ */ jsxs(SelectContent, { children: [/* @__PURE__ */ jsx(SelectItem, {
									value: "__none__",
									children: t("Not set")
								}), /* @__PURE__ */ jsx(SelectItem, {
									value: "wordpress",
									children: "wordpress"
								})] })]
							})]
						}),
						/* @__PURE__ */ jsxs("div", {
							className: "grid grid-cols-2 gap-2",
							children: [/* @__PURE__ */ jsxs("div", {
								className: "flex flex-col gap-1.5",
								children: [/* @__PURE__ */ jsx(Label, {
									htmlFor: "pg-postid",
									className: "text-[10px] font-semibold tracking-wide text-muted-foreground uppercase",
									children: "post_id"
								}), /* @__PURE__ */ jsx(Input, {
									id: "pg-postid",
									type: "number",
									min: 1,
									value: value.post_id === void 0 ? "" : String(value.post_id),
									placeholder: "142",
									onChange: (e) => {
										const raw = e.target.value;
										const parsed = raw === "" ? void 0 : Number(raw);
										set({ post_id: parsed !== void 0 && Number.isFinite(parsed) && parsed > 0 ? Math.floor(parsed) : void 0 });
									}
								})]
							}), /* @__PURE__ */ jsxs("div", {
								className: "flex flex-col gap-1.5",
								children: [/* @__PURE__ */ jsx(Label, {
									htmlFor: "pg-posttype",
									className: "text-[10px] font-semibold tracking-wide text-muted-foreground uppercase",
									children: "post_type"
								}), /* @__PURE__ */ jsx(Input, {
									id: "pg-posttype",
									value: value.post_type ?? "",
									placeholder: "post / page / product",
									onChange: (e) => set({ post_type: e.target.value || void 0 })
								})]
							})]
						}),
						/* @__PURE__ */ jsxs("div", {
							className: "flex flex-col gap-1.5",
							children: [/* @__PURE__ */ jsx(Label, {
								htmlFor: "pg-permalink",
								className: "text-[10px] font-semibold tracking-wide text-muted-foreground uppercase",
								children: "permalink"
							}), /* @__PURE__ */ jsx(Input, {
								id: "pg-permalink",
								value: value.permalink ?? "",
								placeholder: "https://shop.example/product/blue-tee",
								onChange: (e) => set({ permalink: e.target.value || void 0 })
							})]
						}),
						/* @__PURE__ */ jsxs("div", {
							className: "grid grid-cols-2 gap-2",
							children: [/* @__PURE__ */ jsxs("div", {
								className: "flex flex-col gap-1.5",
								children: [/* @__PURE__ */ jsx(Label, {
									htmlFor: "pg-cats",
									className: "text-[10px] font-semibold tracking-wide text-muted-foreground uppercase",
									children: t("categories (comma-separated)")
								}), /* @__PURE__ */ jsx(Input, {
									id: "pg-cats",
									value: csvFromArray(value.categories),
									placeholder: "tees, summer",
									onChange: (e) => set({ categories: arrayFromCsv(e.target.value) })
								})]
							}), /* @__PURE__ */ jsxs("div", {
								className: "flex flex-col gap-1.5",
								children: [/* @__PURE__ */ jsx(Label, {
									htmlFor: "pg-tags",
									className: "text-[10px] font-semibold tracking-wide text-muted-foreground uppercase",
									children: t("tags (comma-separated)")
								}), /* @__PURE__ */ jsx(Input, {
									id: "pg-tags",
									value: csvFromArray(value.tags),
									placeholder: "canvas, summer",
									onChange: (e) => set({ tags: arrayFromCsv(e.target.value) })
								})]
							})]
						}),
						/* @__PURE__ */ jsxs("div", {
							className: "mt-2 flex flex-col gap-3 rounded-md border border-dashed bg-background/40 p-3",
							children: [
								/* @__PURE__ */ jsxs("div", {
									className: "flex items-baseline justify-between",
									children: [/* @__PURE__ */ jsx(Label, {
										className: "text-[10px] font-semibold tracking-wide text-muted-foreground uppercase",
										children: t("WooCommerce product fields")
									}), value.woo && /* @__PURE__ */ jsx("button", {
										type: "button",
										onClick: () => set({ woo: void 0 }),
										className: "text-[10px] text-muted-foreground underline-offset-2 hover:text-foreground hover:underline",
										children: t("Clear")
									})]
								}),
								/* @__PURE__ */ jsxs("div", {
									className: "grid grid-cols-2 gap-2",
									children: [/* @__PURE__ */ jsxs("div", {
										className: "flex flex-col gap-1.5",
										children: [/* @__PURE__ */ jsx(Label, {
											htmlFor: "pg-woo-sku",
											className: "text-[10px] font-semibold tracking-wide text-muted-foreground uppercase",
											children: "sku"
										}), /* @__PURE__ */ jsx(Input, {
											id: "pg-woo-sku",
											value: value.woo?.sku ?? "",
											placeholder: "T-BLU-M",
											onChange: (e) => setWoo({ sku: e.target.value })
										})]
									}), /* @__PURE__ */ jsxs("div", {
										className: "flex flex-col gap-1.5",
										children: [/* @__PURE__ */ jsx(Label, {
											htmlFor: "pg-woo-name",
											className: "text-[10px] font-semibold tracking-wide text-muted-foreground uppercase",
											children: "name"
										}), /* @__PURE__ */ jsx(Input, {
											id: "pg-woo-name",
											value: value.woo?.name ?? "",
											placeholder: "Blue tee",
											onChange: (e) => setWoo({ name: e.target.value })
										})]
									})]
								}),
								/* @__PURE__ */ jsxs("div", {
									className: "grid grid-cols-3 gap-2",
									children: [
										/* @__PURE__ */ jsxs("div", {
											className: "flex flex-col gap-1.5",
											children: [/* @__PURE__ */ jsx(Label, {
												htmlFor: "pg-woo-price",
												className: "text-[10px] font-semibold tracking-wide text-muted-foreground uppercase",
												children: "price"
											}), /* @__PURE__ */ jsx(Input, {
												id: "pg-woo-price",
												value: value.woo?.price ?? "",
												placeholder: "29.00",
												onChange: (e) => setWoo({ price: e.target.value })
											})]
										}),
										/* @__PURE__ */ jsxs("div", {
											className: "flex flex-col gap-1.5",
											children: [/* @__PURE__ */ jsx(Label, {
												htmlFor: "pg-woo-cur",
												className: "text-[10px] font-semibold tracking-wide text-muted-foreground uppercase",
												children: "currency"
											}), /* @__PURE__ */ jsx(Input, {
												id: "pg-woo-cur",
												value: value.woo?.currency ?? "",
												placeholder: "USD",
												maxLength: 3,
												onChange: (e) => setWoo({ currency: e.target.value.toUpperCase() })
											})]
										}),
										/* @__PURE__ */ jsxs("div", {
											className: "flex flex-col gap-1.5",
											children: [/* @__PURE__ */ jsx(Label, {
												htmlFor: "pg-woo-stock",
												className: "text-[10px] font-semibold tracking-wide text-muted-foreground uppercase",
												children: "stock_status"
											}), /* @__PURE__ */ jsxs(Select, {
												value: value.woo?.stock_status ?? "__none__",
												onValueChange: (v) => setWoo({ stock_status: v === "__none__" ? void 0 : v }),
												children: [/* @__PURE__ */ jsx(SelectTrigger, {
													id: "pg-woo-stock",
													children: /* @__PURE__ */ jsx(SelectValue, {})
												}), /* @__PURE__ */ jsxs(SelectContent, { children: [
													/* @__PURE__ */ jsx(SelectItem, {
														value: "__none__",
														children: t("Not set")
													}),
													/* @__PURE__ */ jsx(SelectItem, {
														value: "instock",
														children: "instock"
													}),
													/* @__PURE__ */ jsx(SelectItem, {
														value: "outofstock",
														children: "outofstock"
													}),
													/* @__PURE__ */ jsx(SelectItem, {
														value: "onbackorder",
														children: "onbackorder"
													})
												] })]
											})]
										})
									]
								})
							]
						})
					]
				})]
			})
		]
	});
}
//#endregion
//#region resources/js/lib/verticals.tsx
var VERTICALS = [
	{
		id: "ecommerce",
		name: "E-commerce",
		shortDesc: "Online store with products, pricing, and checkout",
		icon: ShoppingBag
	},
	{
		id: "documentation",
		name: "Documentation",
		shortDesc: "Technical docs, API references, and guides",
		icon: BookOpen
	},
	{
		id: "saas",
		name: "SaaS",
		shortDesc: "Software product with pricing, features, and signup",
		icon: Sparkles
	},
	{
		id: "help_center",
		name: "Help center",
		shortDesc: "Support articles, FAQs, and ticket triage",
		icon: LifeBuoy
	},
	{
		id: "marketing",
		name: "Marketing site",
		shortDesc: "Lead-capture pages, blog, and top-of-funnel content",
		icon: Megaphone
	},
	{
		id: "internal_kb",
		name: "Internal KB",
		shortDesc: "Employee wiki, runbooks, and internal documentation",
		icon: Building
	},
	{
		id: "generic",
		name: "Generic",
		shortDesc: "I'll configure this myself later",
		icon: Globe
	}
];
var VERTICAL_BY_ID = Object.fromEntries(VERTICALS.map((v) => [v.id, v]));
function confidenceBucket(score) {
	if (score >= .5) return "high";
	if (score >= .3) return "likely";
	return "guess";
}
var CONFIDENCE_LABEL = {
	high: "High confidence",
	likely: "Likely",
	guess: "Best guess"
};
function isVerticalId(value) {
	return typeof value === "string" && VERTICALS.some((v) => v.id === value);
}
//#endregion
//#region resources/js/components/playground/scenario-panel.tsx
function ScenarioPanel({ agentSiteType, siteTypeOverride, onSiteTypeOverride, languageOverride, onLanguageOverride, verticals, onPickPrompt, shopperSim, onShopperSimChange }) {
	const { t } = useT();
	const SUPPORTED_LANGUAGES = [
		{
			code: "en",
			label: t("English")
		},
		{
			code: "es",
			label: t("Spanish")
		},
		{
			code: "fr",
			label: t("French")
		},
		{
			code: "de",
			label: t("German")
		},
		{
			code: "pt",
			label: t("Portuguese")
		},
		{
			code: "ja",
			label: t("Japanese")
		},
		{
			code: "ar",
			label: t("Arabic")
		},
		{
			code: "zh",
			label: t("Chinese")
		}
	];
	const effectiveVertical = siteTypeOverride ?? agentSiteType ?? "generic";
	const previewPrompts = SAMPLE_PROMPTS[effectiveVertical] ?? [];
	const verticalEntry = verticals[effectiveVertical];
	return /* @__PURE__ */ jsxs("div", {
		className: "flex flex-col gap-5",
		children: [
			/* @__PURE__ */ jsxs("section", {
				className: "flex flex-col gap-2",
				children: [
					/* @__PURE__ */ jsxs("div", {
						className: "flex items-baseline justify-between",
						children: [/* @__PURE__ */ jsx(Label, {
							className: "text-xs font-semibold tracking-wide text-muted-foreground uppercase",
							children: t("Site type")
						}), siteTypeOverride !== null && /* @__PURE__ */ jsx("button", {
							type: "button",
							onClick: () => onSiteTypeOverride(null),
							className: "text-xs text-muted-foreground underline-offset-2 hover:text-foreground hover:underline",
							children: t("Reset")
						})]
					}),
					/* @__PURE__ */ jsxs(Select, {
						value: siteTypeOverride ?? "__agent__",
						onValueChange: (v) => onSiteTypeOverride(v === "__agent__" ? null : v),
						children: [/* @__PURE__ */ jsx(SelectTrigger, { children: /* @__PURE__ */ jsx(SelectValue, {}) }), /* @__PURE__ */ jsxs(SelectContent, { children: [/* @__PURE__ */ jsxs(SelectItem, {
							value: "__agent__",
							children: [t("Use agent setting"), agentSiteType ? ` · ${t(VERTICAL_BY_ID[agentSiteType].name)}` : ` · ${t("Not set")}`]
						}), Object.values(verticals).map((v) => /* @__PURE__ */ jsxs(SelectItem, {
							value: v.slug,
							children: [
								t(VERTICAL_BY_ID[v.slug].name),
								" —",
								" ",
								v.short_description
							]
						}, v.slug))] })]
					}),
					verticalEntry && verticalEntry.capabilities.length > 0 && /* @__PURE__ */ jsx("div", {
						className: "mt-1 flex flex-wrap gap-1",
						children: verticalEntry.capabilities.map((cap) => /* @__PURE__ */ jsx(Badge, {
							variant: "secondary",
							className: "font-mono text-[10px]",
							children: cap
						}, cap))
					})
				]
			}),
			/* @__PURE__ */ jsxs("section", {
				className: "flex flex-col gap-2",
				children: [/* @__PURE__ */ jsx(Label, {
					className: "text-xs font-semibold tracking-wide text-muted-foreground uppercase",
					children: t("Reply language")
				}), /* @__PURE__ */ jsxs(Select, {
					value: languageOverride ?? "__agent__",
					onValueChange: (v) => onLanguageOverride(v === "__agent__" ? null : v),
					children: [/* @__PURE__ */ jsx(SelectTrigger, { children: /* @__PURE__ */ jsx(SelectValue, {}) }), /* @__PURE__ */ jsxs(SelectContent, { children: [/* @__PURE__ */ jsx(SelectItem, {
						value: "__agent__",
						children: t("Detect / agent default")
					}), SUPPORTED_LANGUAGES.map((l) => /* @__PURE__ */ jsx(SelectItem, {
						value: l.code,
						children: l.label
					}, l.code))] })]
				})]
			}),
			/* @__PURE__ */ jsxs("section", {
				className: "flex flex-col gap-2",
				children: [/* @__PURE__ */ jsxs(Label, {
					className: "flex items-center gap-1.5 text-xs font-semibold tracking-wide text-muted-foreground uppercase",
					children: [/* @__PURE__ */ jsx(Sparkles, { className: "h-3 w-3" }), t("Sample prompts")]
				}), /* @__PURE__ */ jsx("div", {
					className: "flex flex-wrap gap-1.5",
					children: previewPrompts.map((prompt) => /* @__PURE__ */ jsx(Button, {
						type: "button",
						variant: "outline",
						size: "sm",
						className: "h-auto py-1.5 text-start text-xs leading-snug whitespace-normal",
						onClick: () => onPickPrompt(prompt),
						children: prompt
					}, prompt))
				})]
			}),
			/* @__PURE__ */ jsxs("section", {
				className: "flex flex-col gap-2 rounded-md border bg-muted/30 p-3",
				children: [
					/* @__PURE__ */ jsxs("div", {
						className: "flex items-center justify-between",
						children: [/* @__PURE__ */ jsxs(Label, {
							className: "flex items-center gap-1.5 text-xs font-semibold tracking-wide text-muted-foreground uppercase",
							children: [/* @__PURE__ */ jsx(UserRound, { className: "h-3 w-3" }), t("Shopper simulation")]
						}), /* @__PURE__ */ jsx(Checkbox, {
							id: "pg-shopper-toggle",
							checked: shopperSim.enabled,
							onCheckedChange: (v) => onShopperSimChange({
								...shopperSim,
								enabled: v === true
							}),
							"aria-label": t("Toggle shopper simulation")
						})]
					}),
					/* @__PURE__ */ jsx("p", {
						className: "text-xs leading-snug text-muted-foreground",
						children: t("Rehearse a logged-in WooCommerce customer turn so the lookup_order tool fires. Sandbox-only — never used for real visitor auth.")
					}),
					shopperSim.enabled && /* @__PURE__ */ jsxs("div", {
						className: "mt-1 flex flex-col gap-2",
						children: [/* @__PURE__ */ jsxs("div", {
							className: "flex flex-col gap-1",
							children: [/* @__PURE__ */ jsx(Label, {
								htmlFor: "pg-shopper-uid",
								className: "text-[10px] font-semibold tracking-wide text-muted-foreground uppercase",
								children: t("Fake wp_user_id")
							}), /* @__PURE__ */ jsx(Input, {
								id: "pg-shopper-uid",
								type: "number",
								min: 1,
								value: shopperSim.wp_user_id === null ? "" : String(shopperSim.wp_user_id),
								placeholder: "42",
								onChange: (e) => {
									const raw = e.target.value;
									const parsed = raw === "" ? null : Number(raw);
									onShopperSimChange({
										...shopperSim,
										wp_user_id: parsed !== null && Number.isFinite(parsed) && parsed > 0 ? Math.floor(parsed) : null
									});
								}
							})]
						}), /* @__PURE__ */ jsxs("div", {
							className: "flex flex-col gap-1",
							children: [
								/* @__PURE__ */ jsx(Label, {
									htmlFor: "pg-shopper-email",
									className: "text-[10px] font-semibold tracking-wide text-muted-foreground uppercase",
									children: t("Fake email")
								}),
								/* @__PURE__ */ jsx(Input, {
									id: "pg-shopper-email",
									type: "email",
									value: shopperSim.email,
									placeholder: "shopper@example.com",
									onChange: (e) => onShopperSimChange({
										...shopperSim,
										email: e.target.value
									})
								}),
								/* @__PURE__ */ jsx("p", {
									className: "text-[10px] leading-snug text-muted-foreground",
									children: t("Email is sha256-hashed server-side, identical to the WP plugin path. Plain text never persists.")
								})
							]
						})]
					})
				]
			})
		]
	});
}
//#endregion
//#region resources/js/components/playground/sse.ts
async function consumePlaygroundStream(url, body, handlers, signal) {
	const csrf = document.querySelector("meta[name=\"csrf-token\"]")?.content ?? "";
	let response;
	try {
		response = await fetch(url, {
			method: "POST",
			headers: {
				"Content-Type": "application/json",
				Accept: "text/event-stream",
				"X-CSRF-TOKEN": csrf,
				"X-Requested-With": "XMLHttpRequest"
			},
			credentials: "same-origin",
			body: JSON.stringify(body),
			signal
		});
	} catch (err) {
		handlers.onError?.({
			code: "network_failed",
			message: err instanceof Error ? err.message : "Network error"
		});
		return;
	}
	if (!response.ok || !response.body) {
		let detail;
		try {
			const data = await response.clone().json();
			detail = data.message ?? data.error ?? void 0;
		} catch {}
		handlers.onError?.({
			code: response.status === 422 ? "validation_failed" : "http_failed",
			message: detail ?? `HTTP ${response.status}`
		});
		return;
	}
	const reader = response.body.getReader();
	const decoder = new TextDecoder("utf-8");
	let buffer = "";
	let doneSeen = false;
	let errorSeen = false;
	const dispatch = (event, data) => {
		if (event === "") return;
		let payload;
		try {
			payload = JSON.parse(data);
		} catch {
			return;
		}
		const p = payload;
		switch (event) {
			case "start":
				handlers.onStart?.(p);
				break;
			case "token":
				handlers.onToken?.(p.t ?? "");
				break;
			case "retrieval":
				handlers.onRetrieval?.(p);
				break;
			case "prompt":
				handlers.onPrompt?.(p);
				break;
			case "block":
				handlers.onBlock?.(p);
				break;
			case "tool_call":
				handlers.onToolCall?.(p);
				break;
			case "done":
				doneSeen = true;
				handlers.onDone?.(p);
				break;
			case "error":
				errorSeen = true;
				handlers.onError?.(p);
				break;
		}
	};
	try {
		for (;;) {
			const { value, done } = await reader.read();
			if (done) break;
			buffer += decoder.decode(value, { stream: true });
			let boundary = buffer.indexOf("\n\n");
			while (boundary !== -1) {
				const block = buffer.slice(0, boundary);
				buffer = buffer.slice(boundary + 2);
				let eventName = "";
				let dataLines = "";
				for (const line of block.split("\n")) if (line.startsWith(":")) {} else if (line.startsWith("event:")) eventName = line.slice(6).trim();
				else if (line.startsWith("data:")) dataLines += line.slice(5).trim();
				if (eventName && dataLines) dispatch(eventName, dataLines);
				boundary = buffer.indexOf("\n\n");
			}
		}
	} catch (err) {
		if (err.name === "AbortError") return;
		handlers.onError?.({
			code: "stream_aborted",
			message: err instanceof Error ? err.message : "Stream interrupted."
		});
		return;
	}
	if (!doneSeen && !errorSeen) handlers.onError?.({
		code: "stream_ended_without_done",
		message: "Server closed the stream without a done event."
	});
}
//#endregion
//#region resources/js/components/ui/toggle.tsx
var toggleVariants = cva("inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium hover:bg-muted hover:text-muted-foreground disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0 focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] outline-none transition-[color,box-shadow] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive", {
	variants: {
		variant: {
			default: "bg-transparent",
			outline: "border border-input bg-transparent shadow-xs hover:bg-accent hover:text-accent-foreground"
		},
		size: {
			default: "h-9 px-2 min-w-9",
			sm: "h-8 px-1.5 min-w-8",
			lg: "h-10 px-2.5 min-w-10"
		}
	},
	defaultVariants: {
		variant: "default",
		size: "default"
	}
});
//#endregion
//#region resources/js/components/ui/toggle-group.tsx
var ToggleGroupContext = React.createContext({
	size: "default",
	variant: "default"
});
function ToggleGroup({ className, variant, size, children, ...props }) {
	return /* @__PURE__ */ jsx(ToggleGroupPrimitive.Root, {
		"data-slot": "toggle-group",
		"data-variant": variant,
		"data-size": size,
		className: cn("group/toggle-group flex items-center rounded-md data-[variant=outline]:shadow-xs", className),
		...props,
		children: /* @__PURE__ */ jsx(ToggleGroupContext.Provider, {
			value: {
				variant,
				size
			},
			children
		})
	});
}
function ToggleGroupItem({ className, children, variant, size, ...props }) {
	const context = React.useContext(ToggleGroupContext);
	return /* @__PURE__ */ jsx(ToggleGroupPrimitive.Item, {
		"data-slot": "toggle-group-item",
		"data-variant": context.variant || variant,
		"data-size": context.size || size,
		className: cn(toggleVariants({
			variant: context.variant || variant,
			size: context.size || size
		}), "min-w-0 shrink-0 rounded-none shadow-none first:rounded-s-md last:rounded-e-md focus:z-10 focus-visible:z-10 data-[variant=outline]:border-s-0 data-[variant=outline]:first:border-s", className),
		...props,
		children
	});
}
//#endregion
//#region resources/js/pages/app/agents/playground.tsx
var playground_exports = /* @__PURE__ */ __exportAll({ default: () => Playground });
var DEFAULT_PREFS = {
	siteTypeOverride: null,
	languageOverride: null,
	panelTab: "scenario",
	panelOpen: true,
	compareEnabled: false,
	compareSiteType: "ecommerce"
};
function Playground({ agent, verticals }) {
	const { t } = useT();
	const prefsKey = `pg:${agent.id}:prefs`;
	const initialPrefs = useMemo(() => loadPrefs(prefsKey), [prefsKey]);
	const [input, setInput] = useState("");
	const [busy, setBusy] = useState(false);
	const [messages, setMessages] = useState([]);
	const [compareMessages, setCompareMessages] = useState([]);
	const [conversationId, setConversationId] = useState(null);
	const [compareConversationId, setCompareConversationId] = useState(null);
	const [siteTypeOverride, setSiteTypeOverride] = useState(initialPrefs.siteTypeOverride);
	const [languageOverride, setLanguageOverride] = useState(initialPrefs.languageOverride);
	const [pageContext, setPageContext] = useState({});
	const [shopperSim, setShopperSim] = useState({
		enabled: false,
		wp_user_id: null,
		email: ""
	});
	const [compareEnabled, setCompareEnabled] = useState(initialPrefs.compareEnabled);
	const [compareSiteType, setCompareSiteType] = useState(initialPrefs.compareSiteType);
	const [panelOpen, setPanelOpen] = useState(initialPrefs.panelOpen);
	const [panelTab, setPanelTab] = useState(initialPrefs.panelTab);
	const [mobilePanelOpen, setMobilePanelOpen] = useState(false);
	const [mobileCompareTab, setMobileCompareTab] = useState("a");
	const [diagnostics, setDiagnostics] = useState(EMPTY_DIAGNOSTICS);
	const [lastUserMessage, setLastUserMessage] = useState("");
	const chatScrollRef = useRef(null);
	const stickToBottomRef = useRef(true);
	const abortRef = useRef(null);
	useEffect(() => {
		savePrefs(prefsKey, {
			siteTypeOverride,
			languageOverride,
			panelTab,
			panelOpen,
			compareEnabled,
			compareSiteType
		});
	}, [
		prefsKey,
		siteTypeOverride,
		languageOverride,
		panelTab,
		panelOpen,
		compareEnabled,
		compareSiteType
	]);
	const breadcrumbs = [
		{
			title: t("Agents"),
			href: index$12.url()
		},
		{
			title: agent.name,
			href: show$4({ agent: agent.id }).url
		},
		{
			title: t("Playground"),
			href: playground({ agent: agent.id }).url
		}
	];
	const handleScroll = () => {
		const el = chatScrollRef.current;
		if (!el) return;
		stickToBottomRef.current = el.scrollHeight - el.scrollTop - el.clientHeight < 120;
	};
	useEffect(() => {
		if (chatScrollRef.current && stickToBottomRef.current) chatScrollRef.current.scrollTop = chatScrollRef.current.scrollHeight;
	}, [messages, compareMessages]);
	const buildPayload = useCallback((message, convId, overrideSiteType) => {
		const body = { message };
		if (convId) body.conversation_id = convId;
		const effectiveOverride = overrideSiteType ?? siteTypeOverride ?? void 0;
		if (effectiveOverride) body.site_type_override = effectiveOverride;
		if (languageOverride) body.language_override = languageOverride;
		const ctx = sanitizePageContext(pageContext);
		if (ctx) body.page_context = ctx;
		if (shopperSim.enabled && shopperSim.wp_user_id !== null && shopperSim.email.trim() !== "") body.shopper_simulation = {
			wp_user_id: shopperSim.wp_user_id,
			email: shopperSim.email.trim().toLowerCase()
		};
		return body;
	}, [
		siteTypeOverride,
		languageOverride,
		pageContext,
		shopperSim
	]);
	const send = async (e) => {
		if (e) e.preventDefault();
		const message = input.trim();
		if (!message || busy) return;
		setInput("");
		setLastUserMessage(message);
		stickToBottomRef.current = true;
		await runTurn(message);
	};
	const stop = () => {
		abortRef.current?.abort();
	};
	const regenerate = async () => {
		if (busy || !lastUserMessage) return;
		setMessages((prev) => popLastTurn(prev));
		if (compareEnabled) setCompareMessages((prev) => popLastTurn(prev));
		stickToBottomRef.current = true;
		await runTurn(lastUserMessage);
	};
	const reset = async () => {
		setMessages([]);
		setCompareMessages([]);
		setDiagnostics(EMPTY_DIAGNOSTICS);
		setLastUserMessage("");
		const csrf = document.querySelector("meta[name=\"csrf-token\"]")?.content ?? "";
		const reqs = [];
		if (conversationId) reqs.push(fetch(`/app/agents/${agent.id}/playground/reset`, {
			method: "POST",
			headers: {
				"Content-Type": "application/json",
				"X-CSRF-TOKEN": csrf,
				"X-Requested-With": "XMLHttpRequest"
			},
			credentials: "same-origin",
			body: JSON.stringify({ conversation_id: conversationId })
		}));
		if (compareConversationId) reqs.push(fetch(`/app/agents/${agent.id}/playground/reset`, {
			method: "POST",
			headers: {
				"Content-Type": "application/json",
				"X-CSRF-TOKEN": csrf,
				"X-Requested-With": "XMLHttpRequest"
			},
			credentials: "same-origin",
			body: JSON.stringify({ conversation_id: compareConversationId })
		}));
		await Promise.allSettled(reqs);
		setConversationId(null);
		setCompareConversationId(null);
	};
	const runTurn = async (message) => {
		setBusy(true);
		const startedAt = Date.now();
		const newDiag = {
			...EMPTY_DIAGNOSTICS,
			sources: [],
			toolCalls: [],
			blocks: []
		};
		setMessages((prev) => [
			...prev,
			{
				role: "user",
				content: message
			},
			{
				role: "assistant",
				content: "",
				pending: true,
				blocks: []
			}
		]);
		if (compareEnabled) setCompareMessages((prev) => [
			...prev,
			{
				role: "user",
				content: message
			},
			{
				role: "assistant",
				content: "",
				pending: true,
				blocks: []
			}
		]);
		const controller = new AbortController();
		abortRef.current = controller;
		const mainHandlers = {
			onStart: ({ conversation_id }) => {
				setConversationId(conversation_id);
			},
			onRetrieval: (payload) => {
				newDiag.sources = payload.sources;
				newDiag.confidence = payload.confidence;
				newDiag.threshold = payload.threshold;
				newDiag.pageUrlUsed = payload.page_url_used;
				setDiagnostics({ ...newDiag });
			},
			onPrompt: (payload) => {
				newDiag.systemPrompt = payload.system;
				newDiag.historyCount = payload.history_count;
				newDiag.vertical = payload.vertical;
				newDiag.language = payload.language;
				setDiagnostics({ ...newDiag });
			},
			onToken: (text) => {
				if (newDiag.firstTokenMs === null) {
					newDiag.firstTokenMs = Date.now() - startedAt;
					setDiagnostics({ ...newDiag });
				}
				appendTokenTo(setMessages, text);
			},
			onBlock: (block) => {
				newDiag.blocks = [...newDiag.blocks, { type: block.type }];
				setDiagnostics({ ...newDiag });
				appendBlockTo(setMessages, block);
			},
			onToolCall: (event) => {
				newDiag.toolCalls = [...newDiag.toolCalls, {
					name: event.name,
					args: event.args,
					ts: Date.now()
				}];
				setDiagnostics({ ...newDiag });
			},
			onDone: (payload) => {
				newDiag.totalMs = Date.now() - startedAt;
				setDiagnostics({ ...newDiag });
				finalizeAssistantMessage(setMessages, payload);
			},
			onError: (err) => {
				finalizeError(setMessages, err);
			}
		};
		const compareHandlers = compareEnabled ? {
			onStart: ({ conversation_id }) => {
				setCompareConversationId(conversation_id);
			},
			onToken: (text) => appendTokenTo(setCompareMessages, text),
			onBlock: (block) => appendBlockTo(setCompareMessages, block),
			onDone: (payload) => finalizeAssistantMessage(setCompareMessages, payload),
			onError: (err) => finalizeError(setCompareMessages, err)
		} : {};
		const requests = [consumePlaygroundStream(`/app/agents/${agent.id}/playground/stream`, buildPayload(message, conversationId), mainHandlers, controller.signal)];
		if (compareEnabled) requests.push(consumePlaygroundStream(`/app/agents/${agent.id}/playground/stream`, buildPayload(message, compareConversationId, compareSiteType), compareHandlers, controller.signal));
		await Promise.allSettled(requests);
		abortRef.current = null;
		setBusy(false);
	};
	const onLaunchpadPrompt = (prompt) => {
		setInput(prompt);
	};
	const onCopyReply = (text) => {
		navigator.clipboard.writeText(text).then(() => toast.success(t("Copied"))).catch(() => toast.error(t("Couldn't copy")));
	};
	const onEscalationClick = () => {
		toast(t("In the live widget this opens the lead capture form so a human can pick up the conversation."), { duration: 5e3 });
	};
	const effectiveSiteType = siteTypeOverride ?? agent.site_type ?? "generic";
	const overrideActive = siteTypeOverride !== null;
	const sidePanel = /* @__PURE__ */ jsx(RightPanelTabs, {
		panelTab,
		setPanelTab,
		agent,
		siteTypeOverride,
		setSiteTypeOverride,
		languageOverride,
		setLanguageOverride,
		verticals,
		setInput,
		pageContext,
		setPageContext,
		diagnostics,
		shopperSim,
		setShopperSim
	});
	return /* @__PURE__ */ jsxs(AppLayout, {
		breadcrumbs,
		children: [
			/* @__PURE__ */ jsx(Head, { title: `${agent.name} · playground` }),
			/* @__PURE__ */ jsxs("div", {
				className: "flex flex-1 flex-col gap-3 p-3 md:p-4",
				children: [/* @__PURE__ */ jsxs("header", {
					className: "flex flex-wrap items-start justify-between gap-3",
					children: [/* @__PURE__ */ jsxs("div", { children: [
						/* @__PURE__ */ jsxs("h1", {
							className: "flex items-center gap-2 text-2xl font-semibold tracking-tight",
							children: [/* @__PURE__ */ jsx(FlaskConical, { className: "h-5 w-5" }), t("Playground")]
						}),
						/* @__PURE__ */ jsx("p", {
							className: "text-sm text-muted-foreground",
							children: t("Test :name in any vertical, on any simulated page. Conversations here aren't counted toward your billing meter.", { name: agent.name })
						}),
						/* @__PURE__ */ jsxs("div", {
							className: "mt-2 flex flex-wrap items-center gap-1.5",
							children: [
								/* @__PURE__ */ jsxs(Badge, {
									variant: overrideActive ? "default" : "secondary",
									className: "text-[11px]",
									children: [
										t("Vertical:"),
										" ",
										t(VERTICAL_BY_ID[effectiveSiteType].name),
										overrideActive ? " " + t("(override)") : ""
									]
								}),
								languageOverride && /* @__PURE__ */ jsx(Badge, {
									variant: "default",
									className: "text-[11px]",
									children: t("Language: :lang (override)", { lang: languageOverride.toUpperCase() })
								}),
								Object.keys(sanitizePageContext(pageContext) ?? {}).length > 0 && /* @__PURE__ */ jsxs(Badge, {
									variant: "default",
									className: "text-[11px]",
									children: [
										t("Page context:"),
										" ",
										pageContext.url ? safeHost(pageContext.url) : t("set")
									]
								})
							]
						})
					] }), /* @__PURE__ */ jsxs("div", {
						className: "flex flex-wrap items-center gap-2",
						children: [
							/* @__PURE__ */ jsxs(Button, {
								type: "button",
								variant: compareEnabled ? "default" : "outline",
								size: "sm",
								onClick: () => setCompareEnabled((v) => !v),
								title: t("Compare two verticals side-by-side"),
								children: [/* @__PURE__ */ jsx(Maximize2, { className: "h-3.5 w-3.5 sm:me-1.5" }), /* @__PURE__ */ jsx("span", {
									className: "hidden sm:inline",
									children: t("Compare")
								})]
							}),
							busy ? /* @__PURE__ */ jsxs(Button, {
								type: "button",
								variant: "outline",
								size: "sm",
								onClick: stop,
								title: t("Stop streaming"),
								children: [/* @__PURE__ */ jsx(SquareSlash, { className: "h-3.5 w-3.5 sm:me-1.5" }), /* @__PURE__ */ jsx("span", {
									className: "hidden sm:inline",
									children: t("Stop")
								})]
							}) : /* @__PURE__ */ jsxs(Button, {
								type: "button",
								variant: "outline",
								size: "sm",
								onClick: regenerate,
								disabled: !lastUserMessage,
								title: t("Re-run the last user message"),
								children: [/* @__PURE__ */ jsx(RotateCw, { className: "h-3.5 w-3.5 sm:me-1.5" }), /* @__PURE__ */ jsx("span", {
									className: "hidden sm:inline",
									children: t("Regenerate")
								})]
							}),
							/* @__PURE__ */ jsxs(Button, {
								type: "button",
								variant: "outline",
								size: "sm",
								onClick: reset,
								disabled: busy,
								title: t("Wipe conversation history"),
								children: [/* @__PURE__ */ jsx(RefreshCw, { className: "h-3.5 w-3.5 sm:me-1.5" }), /* @__PURE__ */ jsx("span", {
									className: "hidden sm:inline",
									children: t("Reset")
								})]
							}),
							/* @__PURE__ */ jsx(Button, {
								type: "button",
								variant: "ghost",
								size: "sm",
								onClick: () => setPanelOpen((v) => !v),
								title: panelOpen ? t("Hide side panel") : t("Show side panel"),
								className: "hidden md:inline-flex",
								children: panelOpen ? /* @__PURE__ */ jsx(PanelRightClose, { className: "h-4 w-4" }) : /* @__PURE__ */ jsx(PanelRightOpen, { className: "h-4 w-4" })
							}),
							/* @__PURE__ */ jsxs(Button, {
								type: "button",
								variant: "outline",
								size: "sm",
								onClick: () => setMobilePanelOpen(true),
								className: "md:hidden",
								title: t("Open scenario / context / diagnostics"),
								children: [/* @__PURE__ */ jsx(Settings2, { className: "h-3.5 w-3.5 sm:me-1.5" }), /* @__PURE__ */ jsx("span", {
									className: "hidden sm:inline",
									children: t("Tools")
								})]
							})
						]
					})]
				}), /* @__PURE__ */ jsxs("div", {
					className: "flex flex-1 gap-4",
					children: [/* @__PURE__ */ jsxs(Card, {
						className: "flex flex-1 flex-col overflow-hidden",
						children: [
							compareEnabled && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("div", {
								className: "hidden md:block",
								children: /* @__PURE__ */ jsx(CompareHeader, {
									left: effectiveSiteType,
									right: compareSiteType,
									onChangeRight: setCompareSiteType,
									verticals
								})
							}), /* @__PURE__ */ jsx(CompareHeaderMobile, {
								activeTab: mobileCompareTab,
								onChangeTab: setMobileCompareTab,
								left: effectiveSiteType,
								right: compareSiteType,
								onChangeRight: setCompareSiteType,
								verticals
							})] }),
							/* @__PURE__ */ jsx("div", {
								ref: chatScrollRef,
								onScroll: handleScroll,
								className: "flex-1 overflow-y-auto",
								role: "log",
								children: compareEnabled ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("div", {
									className: "hidden h-full grid-cols-2 divide-x md:grid",
									children: [/* @__PURE__ */ jsx(ChatColumn, {
										messages,
										verticalLabel: t(":name (main)", { name: t(VERTICAL_BY_ID[effectiveSiteType].name) }),
										emptyVertical: effectiveSiteType,
										onPrompt: onLaunchpadPrompt,
										onCopyReply,
										onEscalationClick,
										compareSide: true
									}), /* @__PURE__ */ jsx(ChatColumn, {
										messages: compareMessages,
										verticalLabel: t(":name (compare)", { name: t(VERTICAL_BY_ID[compareSiteType].name) }),
										emptyVertical: compareSiteType,
										onPrompt: onLaunchpadPrompt,
										onCopyReply,
										onEscalationClick,
										compareSide: true
									})]
								}), /* @__PURE__ */ jsx("div", {
									className: "md:hidden",
									children: mobileCompareTab === "a" ? /* @__PURE__ */ jsx(ChatColumn, {
										messages,
										emptyVertical: effectiveSiteType,
										onPrompt: onLaunchpadPrompt,
										onCopyReply,
										onEscalationClick
									}) : /* @__PURE__ */ jsx(ChatColumn, {
										messages: compareMessages,
										emptyVertical: compareSiteType,
										onPrompt: onLaunchpadPrompt,
										onCopyReply,
										onEscalationClick
									})
								})] }) : /* @__PURE__ */ jsx(ChatColumn, {
									messages,
									emptyVertical: effectiveSiteType,
									onPrompt: onLaunchpadPrompt,
									onCopyReply,
									onEscalationClick
								})
							}),
							/* @__PURE__ */ jsxs("form", {
								onSubmit: send,
								className: "flex items-center gap-2 border-t p-3",
								children: [/* @__PURE__ */ jsx(Input, {
									type: "text",
									value: input,
									onChange: (e) => setInput(e.target.value),
									placeholder: t("Ask anything…"),
									className: "flex-1",
									disabled: busy,
									autoFocus: true
								}), /* @__PURE__ */ jsx(Button, {
									type: "submit",
									disabled: busy,
									children: busy ? /* @__PURE__ */ jsx(Loader2, { className: "h-4 w-4 animate-spin" }) : /* @__PURE__ */ jsx(Send, { className: "h-4 w-4" })
								})]
							})
						]
					}), panelOpen && /* @__PURE__ */ jsx(Card, {
						className: "hidden w-[380px] shrink-0 flex-col md:flex",
						children: sidePanel
					})]
				})]
			}),
			/* @__PURE__ */ jsx(Sheet$1, {
				open: mobilePanelOpen,
				onOpenChange: setMobilePanelOpen,
				children: /* @__PURE__ */ jsxs(SheetContent, {
					side: "right",
					className: "w-full max-w-[420px] p-0 sm:max-w-[420px]",
					children: [/* @__PURE__ */ jsx(SheetHeader, {
						className: "border-b",
						children: /* @__PURE__ */ jsx(SheetTitle, { children: t("Playground tools") })
					}), sidePanel]
				})
			})
		]
	});
}
function RightPanelTabs({ panelTab, setPanelTab, agent, siteTypeOverride, setSiteTypeOverride, languageOverride, setLanguageOverride, verticals, setInput, pageContext, setPageContext, diagnostics, shopperSim, setShopperSim }) {
	const { t } = useT();
	return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs(ToggleGroup, {
		type: "single",
		value: panelTab,
		onValueChange: (v) => {
			if (v) setPanelTab(v);
		},
		className: "border-b p-1",
		children: [
			/* @__PURE__ */ jsx(ToggleGroupItem, {
				value: "scenario",
				className: "flex-1",
				children: t("Scenario")
			}),
			/* @__PURE__ */ jsx(ToggleGroupItem, {
				value: "context",
				className: "flex-1",
				children: t("Page context")
			}),
			/* @__PURE__ */ jsx(ToggleGroupItem, {
				value: "diagnostics",
				className: "flex-1",
				children: t("Diagnostics")
			})
		]
	}), /* @__PURE__ */ jsxs("div", {
		className: "flex-1 overflow-y-auto p-4",
		children: [
			panelTab === "scenario" && /* @__PURE__ */ jsx(ScenarioPanel, {
				agentSiteType: agent.site_type,
				siteTypeOverride,
				onSiteTypeOverride: setSiteTypeOverride,
				languageOverride,
				onLanguageOverride: setLanguageOverride,
				verticals,
				onPickPrompt: (p) => setInput(p),
				shopperSim,
				onShopperSimChange: setShopperSim
			}),
			panelTab === "context" && /* @__PURE__ */ jsx(PageContextForm, {
				value: pageContext,
				onChange: setPageContext
			}),
			panelTab === "diagnostics" && /* @__PURE__ */ jsx(DiagnosticsPanel, { state: diagnostics })
		]
	})] });
}
function ChatColumn({ messages, emptyVertical, onPrompt, onCopyReply, onEscalationClick, verticalLabel, compareSide = false }) {
	if (messages.length === 0) return /* @__PURE__ */ jsx(EmptyLaunchpad, {
		vertical: emptyVertical,
		onPrompt,
		verticalLabel
	});
	return /* @__PURE__ */ jsx("div", {
		className: `flex flex-col gap-3 ${compareSide ? "p-3" : "p-4"}`,
		children: messages.map((m, i) => /* @__PURE__ */ jsx(MessageBubble$1, {
			message: m,
			onCopyReply,
			onEscalationClick
		}, i))
	});
}
function EmptyLaunchpad({ vertical, onPrompt, verticalLabel }) {
	const { t } = useT();
	const prompts = SAMPLE_PROMPTS[vertical] ?? [];
	return /* @__PURE__ */ jsxs("div", {
		className: "flex h-full flex-col items-center justify-center gap-4 p-6",
		children: [/* @__PURE__ */ jsxs("div", {
			className: "flex flex-col items-center gap-1.5 text-center",
			children: [
				/* @__PURE__ */ jsx(FlaskConical, { className: "h-7 w-7 text-muted-foreground" }),
				/* @__PURE__ */ jsx("p", {
					className: "text-sm font-medium",
					children: verticalLabel ? t("Try :label", { label: verticalLabel }) : t("Try :name", { name: t(VERTICAL_BY_ID[vertical].name) })
				}),
				/* @__PURE__ */ jsx("p", {
					className: "text-xs text-muted-foreground",
					children: t("Pick a sample prompt to get started, or type anything below.")
				})
			]
		}), /* @__PURE__ */ jsx("div", {
			className: "grid w-full max-w-md grid-cols-1 gap-2 sm:grid-cols-2",
			children: prompts.slice(0, 4).map((prompt) => /* @__PURE__ */ jsx("button", {
				type: "button",
				onClick: () => onPrompt(prompt),
				className: "rounded-lg border bg-card px-3 py-2 text-start text-xs leading-snug shadow-sm transition hover:border-primary/50 hover:bg-muted",
				children: prompt
			}, prompt))
		})]
	});
}
function MessageBubble$1({ message, onCopyReply, onEscalationClick }) {
	const { t } = useT();
	const [copied, setCopied] = useState(false);
	if (message.role === "user") return /* @__PURE__ */ jsx("div", {
		className: "max-w-[85%] self-end rounded-2xl bg-foreground px-4 py-2 text-sm text-background",
		children: message.content
	});
	const handleCopy = () => {
		onCopyReply(message.content);
		setCopied(true);
		window.setTimeout(() => setCopied(false), 1500);
	};
	return /* @__PURE__ */ jsxs("div", {
		className: "group/msg max-w-[85%] self-start",
		children: [
			/* @__PURE__ */ jsxs("div", {
				className: `relative rounded-2xl px-4 py-2 text-sm leading-relaxed ${message.error ? "bg-destructive/10 text-destructive" : "bg-muted"}`,
				children: [message.pending && message.content === "" ? /* @__PURE__ */ jsxs("span", {
					className: "inline-flex items-center gap-1.5 italic opacity-70",
					children: [/* @__PURE__ */ jsx(Loader2, { className: "h-3 w-3 animate-spin" }), t("thinking…")]
				}) : message.error ? /* @__PURE__ */ jsx("p", {
					className: "text-xs",
					children: message.error
				}) : /* @__PURE__ */ jsx(MarkdownLite, {
					markdown: message.content,
					variant: "chat"
				}), !message.pending && message.content && !message.error && /* @__PURE__ */ jsx("button", {
					type: "button",
					onClick: handleCopy,
					title: t("Copy reply"),
					className: "absolute -end-2 -top-2 rounded-full border bg-background p-1 opacity-0 shadow-sm transition group-hover/msg:opacity-100 hover:bg-muted",
					children: copied ? /* @__PURE__ */ jsx(CheckCheck, { className: "h-3.5 w-3.5 text-emerald-600" }) : /* @__PURE__ */ jsx(Copy, { className: "h-3.5 w-3.5" })
				})]
			}),
			message.blocks && message.blocks.length > 0 && /* @__PURE__ */ jsx(InlineBlockList, {
				blocks: message.blocks,
				onEscalationClick
			}),
			message.cta && /* @__PURE__ */ jsx("div", {
				className: "mt-2",
				children: /* @__PURE__ */ jsx(Button, {
					type: "button",
					size: "sm",
					variant: "default",
					asChild: !!message.cta.url,
					children: message.cta.url ? /* @__PURE__ */ jsx("a", {
						href: message.cta.url,
						target: "_blank",
						rel: "noopener noreferrer",
						children: message.cta.label
					}) : /* @__PURE__ */ jsx("span", { children: message.cta.label })
				})
			}),
			message.leadPrompt && /* @__PURE__ */ jsx("p", {
				className: "mt-2 rounded-md border border-dashed border-amber-300 bg-amber-50 px-2.5 py-1.5 text-xs text-amber-800",
				children: t("Visitor would now see the lead-capture form.")
			}),
			message.citations && message.citations.length > 0 && /* @__PURE__ */ jsxs("p", {
				className: "mt-2 text-[11px] text-muted-foreground",
				children: [
					t("Sources:"),
					" ",
					message.citations.map((c) => /* @__PURE__ */ jsxs("a", {
						href: c.url ?? "#",
						target: "_blank",
						rel: "noopener noreferrer",
						className: "underline-offset-2 hover:underline",
						children: [
							"[",
							c.id,
							"]",
							" "
						]
					}, c.id))
				]
			}),
			/* @__PURE__ */ jsxs("div", {
				className: "mt-1 flex flex-wrap items-center gap-1",
				children: [
					message.lowConfidence && !message.pending && /* @__PURE__ */ jsx(Badge, {
						variant: "outline",
						className: "text-[10px] text-amber-600",
						children: t("Low confidence")
					}),
					message.fromFlow && /* @__PURE__ */ jsx(Badge, {
						variant: "outline",
						className: "text-[10px] text-indigo-600",
						children: t("Workflow")
					}),
					message.fromCurated && /* @__PURE__ */ jsx(Badge, {
						variant: "outline",
						className: "text-[10px] text-emerald-600",
						children: t("Curated answer")
					})
				]
			})
		]
	});
}
function CompareHeaderMobile({ activeTab, onChangeTab, left, right, onChangeRight, verticals }) {
	const { t } = useT();
	return /* @__PURE__ */ jsxs("div", {
		className: "border-b bg-muted/40 md:hidden",
		children: [/* @__PURE__ */ jsxs(ToggleGroup, {
			type: "single",
			value: activeTab,
			onValueChange: (v) => v && onChangeTab(v),
			className: "p-1",
			children: [/* @__PURE__ */ jsx(ToggleGroupItem, {
				value: "a",
				className: "flex-1 text-xs",
				children: t("A · :name", { name: t(VERTICAL_BY_ID[left].name) })
			}), /* @__PURE__ */ jsx(ToggleGroupItem, {
				value: "b",
				className: "flex-1 text-xs",
				children: t("B · :name", { name: t(VERTICAL_BY_ID[right].name) })
			})]
		}), activeTab === "b" && /* @__PURE__ */ jsxs("div", {
			className: "flex items-center gap-2 border-t px-2 py-1.5 text-xs",
			children: [/* @__PURE__ */ jsx("span", {
				className: "text-muted-foreground",
				children: t("Compare with:")
			}), /* @__PURE__ */ jsx("select", {
				value: right,
				onChange: (e) => onChangeRight(e.target.value),
				className: "flex-1 rounded-md border bg-background px-1.5 py-0.5 text-xs font-semibold",
				children: Object.values(verticals).filter((v) => v.slug !== "generic").map((v) => /* @__PURE__ */ jsx("option", {
					value: v.slug,
					children: t(VERTICAL_BY_ID[v.slug].name)
				}, v.slug))
			})]
		})]
	});
}
function CompareHeader({ left, right, onChangeRight, verticals }) {
	const { t } = useT();
	return /* @__PURE__ */ jsxs("div", {
		className: "grid grid-cols-2 divide-x border-b bg-muted/40",
		children: [/* @__PURE__ */ jsxs("div", {
			className: "flex items-center gap-2 p-2 text-xs",
			children: [
				/* @__PURE__ */ jsx("span", {
					className: "rounded bg-foreground/10 px-1.5 py-0.5 font-mono text-[10px] tracking-wide uppercase",
					children: "A"
				}),
				/* @__PURE__ */ jsx("span", {
					className: "font-semibold",
					children: t(VERTICAL_BY_ID[left].name)
				}),
				/* @__PURE__ */ jsx("span", {
					className: "text-muted-foreground",
					children: t("main")
				})
			]
		}), /* @__PURE__ */ jsxs("div", {
			className: "flex items-center gap-2 p-2 text-xs",
			children: [
				/* @__PURE__ */ jsx("span", {
					className: "rounded bg-foreground/10 px-1.5 py-0.5 font-mono text-[10px] tracking-wide uppercase",
					children: "B"
				}),
				/* @__PURE__ */ jsx("select", {
					value: right,
					onChange: (e) => onChangeRight(e.target.value),
					className: "rounded-md border bg-background px-1.5 py-0.5 text-xs font-semibold",
					children: Object.values(verticals).filter((v) => v.slug !== "generic").map((v) => /* @__PURE__ */ jsx("option", {
						value: v.slug,
						children: t(VERTICAL_BY_ID[v.slug].name)
					}, v.slug))
				}),
				/* @__PURE__ */ jsx("span", {
					className: "text-muted-foreground",
					children: t("compare")
				})
			]
		})]
	});
}
function appendTokenTo(setter, text) {
	setter((prev) => {
		const next = [...prev];
		const last = next[next.length - 1];
		if (last && last.role === "assistant") next[next.length - 1] = {
			...last,
			content: last.content + text,
			pending: true
		};
		return next;
	});
}
function appendBlockTo(setter, block) {
	setter((prev) => {
		const next = [...prev];
		const last = next[next.length - 1];
		if (last && last.role === "assistant") next[next.length - 1] = {
			...last,
			blocks: [...last.blocks ?? [], block]
		};
		return next;
	});
}
function finalizeAssistantMessage(setter, payload) {
	setter((prev) => {
		const next = [...prev];
		const last = next[next.length - 1];
		if (last && last.role === "assistant") next[next.length - 1] = {
			...last,
			content: payload.text || last.content,
			citations: payload.citations,
			lowConfidence: payload.low_confidence,
			pending: false,
			cta: payload.cta ?? null,
			leadPrompt: !!payload.lead_prompt,
			fromFlow: !!payload.flow,
			fromCurated: !!payload.curated
		};
		return next;
	});
}
function finalizeError(setter, err) {
	setter((prev) => {
		const next = [...prev];
		const last = next[next.length - 1];
		if (last && last.role === "assistant") next[next.length - 1] = {
			...last,
			content: "",
			pending: false,
			error: err.message ?? `Error: ${err.code}`
		};
		return next;
	});
}
function popLastTurn(prev) {
	const next = [...prev];
	while (next.length > 0 && next[next.length - 1].role !== "user") next.pop();
	if (next.length > 0 && next[next.length - 1].role === "user") next.pop();
	return next;
}
function sanitizePageContext(ctx) {
	const out = {};
	for (const [key, value] of Object.entries(ctx)) {
		if (value === void 0 || value === null) continue;
		if (typeof value === "string" && value.trim() === "") continue;
		if (Array.isArray(value) && value.every((v) => typeof v === "string" && v.trim() === "")) continue;
		if (typeof value === "object" && !Array.isArray(value) && Object.keys(value).length === 0) continue;
		out[key] = value;
	}
	return Object.keys(out).length === 0 ? null : out;
}
function safeHost(url) {
	try {
		return new URL(url).host;
	} catch {
		return "set";
	}
}
function loadPrefs(key) {
	if (typeof window === "undefined") return DEFAULT_PREFS;
	try {
		const raw = window.localStorage.getItem(key);
		if (!raw) return DEFAULT_PREFS;
		const parsed = JSON.parse(raw);
		return {
			...DEFAULT_PREFS,
			...parsed
		};
	} catch {
		return DEFAULT_PREFS;
	}
}
function savePrefs(key, prefs) {
	if (typeof window === "undefined") return;
	try {
		window.localStorage.setItem(key, JSON.stringify(prefs));
	} catch {}
}
//#endregion
//#region resources/js/pages/app/agents/settings.tsx
var settings_exports = /* @__PURE__ */ __exportAll({ default: () => AgentSettings });
function StatusPill$1({ published }) {
	const { t } = useT();
	return /* @__PURE__ */ jsxs("span", {
		className: "inline-flex h-7 items-center gap-2 rounded-md border px-2.5 text-xs font-medium " + (published ? "border-emerald-500/25 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300" : "border-amber-500/25 bg-amber-500/10 text-amber-700 dark:text-amber-300"),
		children: [/* @__PURE__ */ jsx("span", { className: "size-1.5 rounded-full " + (published ? "bg-emerald-500" : "bg-amber-500") }), published ? t("Published") : t("Draft")]
	});
}
function SettingMetric({ label, value, helper }) {
	return /* @__PURE__ */ jsxs("div", {
		className: "border-b px-4 py-4 last:border-b-0 sm:px-5",
		children: [
			/* @__PURE__ */ jsx("p", {
				className: "text-xs font-medium tracking-wider text-muted-foreground uppercase",
				children: label
			}),
			/* @__PURE__ */ jsx("p", {
				className: "mt-2 text-2xl font-semibold tracking-tight text-foreground",
				children: value
			}),
			/* @__PURE__ */ jsx("p", {
				className: "mt-1 text-xs leading-5 text-muted-foreground",
				children: helper
			})
		]
	});
}
function AgentSettings({ agent, embed }) {
	const { t, tChoice } = useT();
	const [copied, setCopied] = useState(false);
	const [autoIndex, setAutoIndex] = useState(agent.auto_index_visited_pages);
	const confidencePercent = Math.round(agent.confidence_threshold * 100);
	const originsCount = agent.allowed_origins?.length ?? 0;
	const languageLabel = agent.language_default.toUpperCase();
	const originsForm = useForm({ origins: (agent.allowed_origins ?? []).join("\n") });
	const [originsSaved, setOriginsSaved] = useState(false);
	const restrictedForm = useForm({ paths: (agent.restricted_paths ?? []).join("\n") });
	const [restrictedSaved, setRestrictedSaved] = useState(false);
	const copySnippet = async () => {
		await navigator.clipboard.writeText(embed.snippet);
		setCopied(true);
		window.setTimeout(() => setCopied(false), 2e3);
	};
	const toggleAutoIndex = (next) => {
		setAutoIndex(next);
		router.patch(update$11.url({ agent: agent.id }), { auto_index_visited_pages: next }, {
			preserveScroll: true,
			onError: () => setAutoIndex(!next)
		});
	};
	const originsError = originsForm.errors.allowed_origins;
	const saveOrigins = (e) => {
		e.preventDefault();
		const list = originsForm.data.origins.split("\n").map((line) => line.trim()).filter((line) => line !== "");
		originsForm.transform(() => ({ allowed_origins: list }));
		originsForm.patch(update$11.url({ agent: agent.id }), {
			preserveScroll: true,
			onSuccess: () => {
				setOriginsSaved(true);
				window.setTimeout(() => setOriginsSaved(false), 2e3);
			}
		});
	};
	const restrictedError = restrictedForm.errors.restricted_paths;
	const saveRestricted = (e) => {
		e.preventDefault();
		const list = restrictedForm.data.paths.split("\n").map((line) => line.trim()).filter((line) => line !== "");
		restrictedForm.transform(() => ({ restricted_paths: list }));
		restrictedForm.patch(update$11.url({ agent: agent.id }), {
			preserveScroll: true,
			onSuccess: () => {
				setRestrictedSaved(true);
				window.setTimeout(() => setRestrictedSaved(false), 2e3);
			}
		});
	};
	return /* @__PURE__ */ jsxs(AppLayout, {
		breadcrumbs: [
			{
				title: t("Agents"),
				href: index$12.url()
			},
			{
				title: agent.name,
				href: show$4({ agent: agent.id }).url
			},
			{
				title: t("Settings"),
				href: edit$7({ agent: agent.id }).url
			}
		],
		children: [/* @__PURE__ */ jsx(Head, { title: `${agent.name} · settings` }), /* @__PURE__ */ jsxs("div", {
			className: "flex min-h-0 flex-1 flex-col bg-card",
			children: [/* @__PURE__ */ jsxs("div", {
				className: "flex min-h-10 flex-wrap items-center gap-2 border-b px-3 py-2 sm:py-1.5",
				children: [
					/* @__PURE__ */ jsx(StatusPill$1, { published: agent.is_published }),
					/* @__PURE__ */ jsx("span", {
						className: "inline-flex h-7 items-center rounded-md border bg-background px-2.5 text-xs font-normal text-muted-foreground",
						children: t(":lang default language", { lang: languageLabel })
					}),
					/* @__PURE__ */ jsx("span", {
						className: "inline-flex h-7 items-center rounded-md border bg-background px-2.5 text-xs font-normal text-muted-foreground",
						children: t(":percent% confidence", { percent: confidencePercent })
					}),
					/* @__PURE__ */ jsx(Button, {
						asChild: true,
						variant: "outline",
						size: "sm",
						className: "ms-auto",
						children: /* @__PURE__ */ jsxs(Link, {
							href: show$4.url({ agent: agent.id }),
							prefetch: true,
							children: [t("Agent workspace"), /* @__PURE__ */ jsx(ArrowUpRight, { className: "size-3.5" })]
						})
					})
				]
			}), /* @__PURE__ */ jsx("div", {
				className: "min-h-0 flex-1 overflow-y-auto",
				children: /* @__PURE__ */ jsxs("div", {
					className: "grid gap-4 p-4 xl:grid-cols-[minmax(0,1.35fr)_minmax(340px,0.85fr)]",
					children: [/* @__PURE__ */ jsxs("div", {
						className: "grid gap-4",
						children: [
							/* @__PURE__ */ jsxs("div", { children: [
								/* @__PURE__ */ jsx("p", {
									className: "text-xs font-medium tracking-wider text-muted-foreground uppercase",
									children: t("Settings")
								}),
								/* @__PURE__ */ jsx("h1", {
									className: "mt-2 text-2xl font-semibold tracking-tight text-foreground",
									children: t("Agent settings")
								}),
								/* @__PURE__ */ jsx("p", {
									className: "mt-2 max-w-2xl text-sm leading-6 text-muted-foreground",
									children: t("Tune how this agent answers, where the widget is allowed to run, and what installation code customers should paste onto their site.")
								})
							] }),
							/* @__PURE__ */ jsx(AgentForm, {
								mode: "edit",
								agentId: agent.id,
								initial: {
									name: agent.name,
									language_default: agent.language_default,
									system_prompt: agent.system_prompt ?? "",
									confidence_threshold: agent.confidence_threshold
								}
							}),
							/* @__PURE__ */ jsx(Card, {
								className: "overflow-hidden p-0",
								children: /* @__PURE__ */ jsxs("form", {
									onSubmit: saveOrigins,
									children: [
										/* @__PURE__ */ jsx("div", {
											className: "border-b px-4 py-4 sm:px-5",
											children: /* @__PURE__ */ jsxs("div", {
												className: "flex items-start gap-3",
												children: [/* @__PURE__ */ jsx("span", {
													className: "flex size-9 shrink-0 items-center justify-center rounded-lg border bg-background text-muted-foreground shadow-xs",
													children: /* @__PURE__ */ jsx(ShieldCheck, { className: "size-4" })
												}), /* @__PURE__ */ jsxs("div", {
													className: "min-w-0",
													children: [/* @__PURE__ */ jsx("p", {
														className: "text-sm font-semibold text-foreground",
														children: t("Allowed origins")
													}), /* @__PURE__ */ jsx("p", {
														className: "mt-1 text-xs leading-5 text-muted-foreground",
														children: t("Restrict this public widget script to trusted domains. Each origin must include the scheme and host.")
													})]
												})]
											})
										}),
										/* @__PURE__ */ jsxs("div", {
											className: "grid gap-4 px-4 py-4 sm:px-5",
											children: [/* @__PURE__ */ jsxs("div", {
												className: "rounded-lg border border-amber-500/25 bg-amber-500/10 px-3 py-2 text-xs leading-5 text-amber-800 dark:text-amber-300",
												children: [
													/* @__PURE__ */ jsx("strong", { children: t("Strict match.") }),
													" ",
													t("Subdomains are not inferred."),
													" ",
													/* @__PURE__ */ jsx("code", { children: "https://example.com" }),
													" ",
													t("does not permit"),
													" ",
													/* @__PURE__ */ jsx("code", { children: "https://app.example.com" }),
													"."
												]
											}), /* @__PURE__ */ jsxs("div", {
												className: "grid gap-1.5",
												children: [
													/* @__PURE__ */ jsx(Label, {
														htmlFor: "origins",
														className: "text-xs text-muted-foreground",
														children: t("One origin per line")
													}),
													/* @__PURE__ */ jsx(Textarea, {
														id: "origins",
														rows: 5,
														spellCheck: false,
														placeholder: "https://example.com\nhttps://app.example.com",
														value: originsForm.data.origins,
														"aria-invalid": Boolean(originsError),
														onChange: (e) => originsForm.setData("origins", e.target.value),
														className: "font-mono text-xs leading-5"
													}),
													originsError ? /* @__PURE__ */ jsx("p", {
														className: "text-xs text-destructive",
														children: originsError
													}) : null
												]
											})]
										}),
										/* @__PURE__ */ jsxs("div", {
											className: "flex flex-col-reverse gap-2 border-t bg-muted/20 px-4 py-3 sm:flex-row sm:items-center sm:justify-between sm:px-5",
											children: [/* @__PURE__ */ jsx("p", {
												className: "text-xs text-muted-foreground",
												children: originsCount === 0 ? t("No production origins configured yet.") : tChoice(":count origin currently configured.|:count origins currently configured.", originsCount, { count: originsCount })
											}), /* @__PURE__ */ jsxs("div", {
												className: "flex items-center justify-end gap-3",
												children: [originsSaved ? /* @__PURE__ */ jsx("span", {
													className: "text-xs text-emerald-600 dark:text-emerald-400",
													children: t("Saved")
												}) : null, /* @__PURE__ */ jsx(Button, {
													type: "submit",
													size: "sm",
													disabled: originsForm.processing,
													children: t("Save origins")
												})]
											})]
										})
									]
								})
							}),
							/* @__PURE__ */ jsx(Card, {
								className: "overflow-hidden p-0",
								children: /* @__PURE__ */ jsxs("form", {
									onSubmit: saveRestricted,
									children: [
										/* @__PURE__ */ jsx("div", {
											className: "border-b px-4 py-4 sm:px-5",
											children: /* @__PURE__ */ jsxs("div", {
												className: "flex items-start gap-3",
												children: [/* @__PURE__ */ jsx("span", {
													className: "flex size-9 shrink-0 items-center justify-center rounded-lg border bg-background text-muted-foreground shadow-xs",
													children: /* @__PURE__ */ jsx(ShieldCheck, { className: "size-4" })
												}), /* @__PURE__ */ jsxs("div", {
													className: "min-w-0",
													children: [/* @__PURE__ */ jsx("p", {
														className: "text-sm font-semibold text-foreground",
														children: t("Restricted paths")
													}), /* @__PURE__ */ jsxs("p", {
														className: "mt-1 text-xs leading-5 text-muted-foreground",
														children: [
															t("URL paths the widget should NOT mount on. Mirrors"),
															" ",
															/* @__PURE__ */ jsx("em", { children: t("Allowed origins") }),
															" ",
															t("but for paths within an already-allowed origin — use it to keep the bot off your own /admin, /checkout, or /account flows without touching code.")
														]
													})]
												})]
											})
										}),
										/* @__PURE__ */ jsxs("div", {
											className: "grid gap-4 px-4 py-4 sm:px-5",
											children: [/* @__PURE__ */ jsxs("div", {
												className: "rounded-lg border bg-muted/30 px-3 py-2 text-xs leading-5 text-muted-foreground",
												children: [/* @__PURE__ */ jsxs("p", { children: [
													/* @__PURE__ */ jsx("strong", { children: t("Glob patterns.") }),
													" ",
													t("Use"),
													" ",
													/* @__PURE__ */ jsx("code", { children: "*" }),
													" ",
													t("as a wildcard. Example:")
												] }), /* @__PURE__ */ jsxs("ul", {
													className: "mt-1 list-disc ps-5",
													children: [
														/* @__PURE__ */ jsxs("li", { children: [
															/* @__PURE__ */ jsx("code", { children: "/admin" }),
															" ",
															t("→ exact path only")
														] }),
														/* @__PURE__ */ jsxs("li", { children: [
															/* @__PURE__ */ jsx("code", { children: "/admin/*" }),
															" ",
															t("→ anything under /admin")
														] }),
														/* @__PURE__ */ jsxs("li", { children: [
															/* @__PURE__ */ jsx("code", { children: "/checkout" }),
															",",
															" ",
															/* @__PURE__ */ jsx("code", { children: "/account/*" }),
															" ",
															t("— case-insensitive")
														] })
													]
												})]
											}), /* @__PURE__ */ jsxs("div", {
												className: "grid gap-1.5",
												children: [
													/* @__PURE__ */ jsx(Label, {
														htmlFor: "restricted-paths",
														className: "text-xs text-muted-foreground",
														children: t("One path per line")
													}),
													/* @__PURE__ */ jsx(Textarea, {
														id: "restricted-paths",
														rows: 5,
														spellCheck: false,
														placeholder: "/admin/*\n/checkout\n/account/*",
														value: restrictedForm.data.paths,
														"aria-invalid": Boolean(restrictedError),
														onChange: (e) => restrictedForm.setData("paths", e.target.value),
														className: "font-mono text-xs leading-5"
													}),
													restrictedError ? /* @__PURE__ */ jsx("p", {
														className: "text-xs text-destructive",
														children: restrictedError
													}) : null
												]
											})]
										}),
										/* @__PURE__ */ jsxs("div", {
											className: "flex flex-col-reverse gap-2 border-t bg-muted/20 px-4 py-3 sm:flex-row sm:items-center sm:justify-between sm:px-5",
											children: [/* @__PURE__ */ jsx("p", {
												className: "text-xs text-muted-foreground",
												children: (agent.restricted_paths?.length ?? 0) === 0 ? t("No path restrictions — widget mounts on every allowed origin.") : tChoice(":count path blocked.|:count paths blocked.", agent.restricted_paths?.length ?? 0, { count: agent.restricted_paths?.length ?? 0 })
											}), /* @__PURE__ */ jsxs("div", {
												className: "flex items-center justify-end gap-3",
												children: [restrictedSaved ? /* @__PURE__ */ jsx("span", {
													className: "text-xs text-emerald-600 dark:text-emerald-400",
													children: t("Saved")
												}) : null, /* @__PURE__ */ jsx(Button, {
													type: "submit",
													size: "sm",
													disabled: restrictedForm.processing,
													children: t("Save paths")
												})]
											})]
										})
									]
								})
							})
						]
					}), /* @__PURE__ */ jsxs("aside", {
						className: "grid content-start gap-4",
						children: [
							/* @__PURE__ */ jsxs(Card, {
								className: "overflow-hidden p-0",
								children: [
									/* @__PURE__ */ jsx("div", {
										className: "border-b px-4 py-4 sm:px-5",
										children: /* @__PURE__ */ jsxs("div", {
											className: "flex items-start justify-between gap-3",
											children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
												className: "text-sm font-semibold text-foreground",
												children: t("Launch snapshot")
											}), /* @__PURE__ */ jsx("p", {
												className: "mt-1 text-xs leading-5 text-muted-foreground",
												children: t("The operational state for this agent and its visitor-facing widget.")
											})] }), /* @__PURE__ */ jsx(Sparkles, { className: "size-4 text-muted-foreground" })]
										})
									}),
									/* @__PURE__ */ jsx(SettingMetric, {
										label: t("Publishing"),
										value: agent.is_published ? t("Live") : t("Draft"),
										helper: agent.is_published ? t("Widget installation is available.") : t("Publish from the agent workspace before launch.")
									}),
									/* @__PURE__ */ jsx(SettingMetric, {
										label: t("Allowed origins"),
										value: String(originsCount),
										helper: t("Exact domains allowed to load this widget.")
									}),
									/* @__PURE__ */ jsx(SettingMetric, {
										label: t("Auto-indexing"),
										value: autoIndex ? t("On") : t("Off"),
										helper: t("Visited pages can grow the knowledge base automatically.")
									})
								]
							}),
							/* @__PURE__ */ jsxs(Card, {
								className: "p-4 sm:p-5",
								children: [/* @__PURE__ */ jsxs("div", {
									className: "flex items-start justify-between gap-4",
									children: [/* @__PURE__ */ jsxs("div", {
										className: "min-w-0",
										children: [/* @__PURE__ */ jsxs("div", {
											className: "flex items-center gap-2",
											children: [/* @__PURE__ */ jsx(Globe2, { className: "size-4 text-muted-foreground" }), /* @__PURE__ */ jsx("p", {
												className: "text-sm font-semibold text-foreground",
												children: t("Auto-index visited pages")
											})]
										}), /* @__PURE__ */ jsx("p", {
											className: "mt-2 text-xs leading-5 text-muted-foreground",
											children: t("When enabled, new visitor pages are queued for crawl and indexing in the background.")
										})]
									}), /* @__PURE__ */ jsx("button", {
										type: "button",
										role: "switch",
										"aria-checked": autoIndex,
										onClick: () => toggleAutoIndex(!autoIndex),
										className: `relative inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full transition-colors ${autoIndex ? "bg-emerald-500" : "bg-muted"}`,
										children: /* @__PURE__ */ jsx("span", { className: `inline-block h-5 w-5 transform rounded-full bg-white shadow transition ${autoIndex ? "translate-x-5" : "translate-x-1"}` })
									})]
								}), /* @__PURE__ */ jsxs("div", {
									className: "mt-4 rounded-lg border bg-muted/25 px-3 py-2 text-xs leading-5 text-muted-foreground",
									children: [
										t("Auto-skips"),
										" ",
										/* @__PURE__ */ jsx("code", { children: "/admin" }),
										",",
										" ",
										/* @__PURE__ */ jsx("code", { children: "/checkout" }),
										", ",
										/* @__PURE__ */ jsx("code", { children: "/cart" }),
										",",
										" ",
										/* @__PURE__ */ jsx("code", { children: "/account" }),
										", ",
										t("and"),
										" ",
										/* @__PURE__ */ jsx("code", { children: "/login" }),
										".",
										" ",
										t("Capped at 30 pages/hour per agent.")
									]
								})]
							}),
							/* @__PURE__ */ jsxs(Card, {
								className: "overflow-hidden p-0 " + (agent.is_published ? "border-emerald-500/30 bg-emerald-500/5" : "border-amber-500/25 bg-amber-500/5"),
								children: [/* @__PURE__ */ jsx("div", {
									className: "border-b px-4 py-4 sm:px-5",
									children: /* @__PURE__ */ jsxs("div", {
										className: "flex items-start gap-3",
										children: [/* @__PURE__ */ jsx("span", {
											className: "flex size-9 shrink-0 items-center justify-center rounded-lg border bg-background text-muted-foreground shadow-xs",
											children: /* @__PURE__ */ jsx(LockKeyhole, { className: "size-4" })
										}), /* @__PURE__ */ jsxs("div", {
											className: "min-w-0",
											children: [/* @__PURE__ */ jsx("p", {
												className: "text-sm font-semibold text-foreground",
												children: t("Embed on your site")
											}), agent.is_published ? /* @__PURE__ */ jsxs("div", {
												className: "mt-1 grid gap-1.5 text-xs leading-5 text-muted-foreground",
												children: [/* @__PURE__ */ jsxs("p", { children: [
													t("Paste this snippet on every page that should show the agent. Place it just before the closing"),
													" ",
													/* @__PURE__ */ jsx("code", { children: "</body>" }),
													" ",
													t("tag so the loader runs after the rest of the page paints.")
												] }), /* @__PURE__ */ jsxs("p", { children: [
													t("Alternatively, you can place it inside"),
													" ",
													/* @__PURE__ */ jsx("code", { children: "<head>" }),
													" ",
													t("— the script tag carries `defer`, so it never blocks rendering. Pick whichever spot is easier for your CMS / theme.")
												] })]
											}) : /* @__PURE__ */ jsx("p", {
												className: "mt-1 text-xs leading-5 text-amber-700 dark:text-amber-300",
												children: t("Publish this agent before the snippet can run for visitors.")
											})]
										})]
									})
								}), /* @__PURE__ */ jsxs("div", {
									className: "grid gap-3 px-4 py-4 sm:px-5",
									children: [/* @__PURE__ */ jsx("pre", {
										className: "max-h-36 overflow-auto rounded-lg border bg-background/90 p-3 text-xs leading-5 whitespace-pre-wrap text-foreground",
										children: embed.snippet
									}), /* @__PURE__ */ jsxs("div", {
										className: "flex flex-wrap items-center justify-between gap-2",
										children: [/* @__PURE__ */ jsxs("p", {
											className: "flex items-center gap-1.5 text-xs text-muted-foreground",
											children: [/* @__PURE__ */ jsx(Info, { className: "size-3.5" }), t("One line, async loader")]
										}), /* @__PURE__ */ jsx(Button, {
											onClick: copySnippet,
											variant: "outline",
											size: "sm",
											children: copied ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Check, { className: "size-3" }), t("Copied")] }) : /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Clipboard, { className: "size-3" }), t("Copy snippet")] })
										})]
									})]
								})]
							})
						]
					})]
				})
			})]
		})]
	});
}
//#endregion
//#region resources/js/pages/app/agents/show.tsx
var show_exports$3 = /* @__PURE__ */ __exportAll({ default: () => ShowAgent });
var navTiles = (id, t) => [
	{
		title: t("Knowledge sources"),
		description: t("Add URLs or upload files. The crawler indexes them."),
		href: index$15({ agent: id }).url,
		icon: Database,
		primary: true
	},
	{
		title: t("Knowledge (what AI sees)"),
		description: t("Inspect every page and chunk we indexed — confirm the crawl pulled real content."),
		href: index$17({ agent: id }).url,
		icon: BookOpen,
		primary: true
	},
	{
		title: t("Conversations"),
		description: t("Read every visitor session — what they asked, what the bot said, when it happened."),
		href: index$16({ agent: id }).url,
		icon: MessagesSquare,
		primary: true
	},
	{
		title: t("Leads"),
		description: t("See every lead captured by this agent and jump straight into the matching record."),
		href: index$14({ agent: id }).url,
		icon: Inbox,
		primary: true
	},
	{
		title: t("Playground"),
		description: t("Chat with the agent (does not count toward billing)."),
		href: playground({ agent: id }).url,
		icon: Play,
		primary: true
	},
	{
		title: t("Curated answers"),
		description: t("Predefined responses that bypass the LLM for matching questions."),
		href: index$20({ agent: id }).url,
		icon: Sparkles
	},
	{
		title: t("Behavior triggers"),
		description: t("Open the bar on exit-intent, idle, scroll, time, returning, UTM."),
		href: index$19({ agent: id }).url,
		icon: Workflow
	},
	{
		title: t("CTAs"),
		description: t("Buttons that surface in conversations to drive demos / signups."),
		href: index$18({ agent: id }).url,
		icon: BarChart3
	},
	{
		title: t("Customize appearance"),
		description: t("Persona, tone, colors, guardrails — with live preview."),
		href: customize({ agent: id }).url,
		icon: Palette
	},
	{
		title: t("Site type"),
		description: t("Auto-detected vertical that drives starter prompts and capabilities."),
		href: vertical({ agent: id }).url,
		icon: Globe
	},
	{
		title: t("A/B experiments"),
		description: t("Test persona / CTA / trigger variations on a slice of visitors."),
		href: index$13({ agent: id }).url,
		icon: Beaker
	},
	{
		title: t("MCP integrations"),
		description: t("Plug the agent into your CRM, calendar, ticketing, or internal APIs via Model Context Protocol — the bot calls tools mid-conversation."),
		href: index$21({ agent: id }).url,
		icon: Plug
	}
];
function AgentStatusBadge({ published, className }) {
	const { t } = useT();
	return /* @__PURE__ */ jsxs("span", {
		className: cn("inline-flex items-center gap-2 rounded-md border px-2.5 py-1 text-xs font-medium", published ? "border-emerald-200 bg-emerald-50 text-emerald-700 dark:border-emerald-500/30 dark:bg-emerald-500/10 dark:text-emerald-300" : "border-amber-200 bg-amber-50 text-amber-700 dark:border-amber-500/30 dark:bg-amber-500/10 dark:text-amber-300", className),
		children: [/* @__PURE__ */ jsx("span", { className: cn("inline-block size-1.5 rounded-full", published ? "bg-emerald-500" : "bg-amber-500") }), published ? t("Live") : t("Draft")]
	});
}
function SetupStepCard({ step, done, title, description, className }) {
	return /* @__PURE__ */ jsxs("div", {
		className: cn("flex h-full gap-3 px-4 py-4", className),
		children: [/* @__PURE__ */ jsx("span", {
			className: cn("flex size-8 shrink-0 items-center justify-center rounded-full text-xs font-semibold", done ? "bg-emerald-500 text-white" : "border border-muted-foreground/25 bg-background text-muted-foreground"),
			children: done ? /* @__PURE__ */ jsx(Check, { className: "size-3.5" }) : step
		}), /* @__PURE__ */ jsxs("div", {
			className: "min-w-0",
			children: [/* @__PURE__ */ jsx("p", {
				className: "text-sm font-medium text-foreground",
				children: title
			}), /* @__PURE__ */ jsx("p", {
				className: "mt-1 text-xs leading-5 text-muted-foreground",
				children: description
			})]
		})]
	});
}
function ActionTile({ tile, prominent = false }) {
	const Icon = tile.icon;
	return /* @__PURE__ */ jsx(Link, {
		href: tile.href,
		prefetch: true,
		className: "group block h-full",
		children: /* @__PURE__ */ jsxs(Card, {
			className: cn("h-full p-4 transition duration-200 hover:-translate-y-0.5 hover:border-foreground/20 hover:shadow-lg", prominent ? "border-foreground/15 bg-[linear-gradient(180deg,hsl(var(--card))_0%,color-mix(in_oklab,hsl(var(--muted))_30%,transparent)_100%)]" : "bg-card"),
			children: [
				/* @__PURE__ */ jsxs("div", {
					className: "flex items-start justify-between gap-3",
					children: [/* @__PURE__ */ jsx("span", {
						className: cn("inline-flex rounded-xl p-2 transition", prominent ? "bg-foreground/5 text-foreground" : "bg-muted text-muted-foreground group-hover:bg-foreground/5 group-hover:text-foreground"),
						children: /* @__PURE__ */ jsx(Icon, { className: "size-4" })
					}), /* @__PURE__ */ jsx(ArrowUpRight, { className: "size-4 text-muted-foreground transition group-hover:text-foreground" })]
				}),
				/* @__PURE__ */ jsx("h3", {
					className: "mt-4 text-sm font-semibold text-foreground",
					children: tile.title
				}),
				/* @__PURE__ */ jsx("p", {
					className: "mt-2 text-xs leading-5 text-muted-foreground",
					children: tile.description
				})
			]
		})
	});
}
function SnapshotMetric({ label, value, helper, className }) {
	return /* @__PURE__ */ jsxs("div", {
		className: cn("min-w-0 px-4 py-4", className),
		children: [
			/* @__PURE__ */ jsx("p", {
				className: "text-xs font-medium tracking-wider text-muted-foreground uppercase",
				children: label
			}),
			/* @__PURE__ */ jsx("p", {
				className: "mt-2 text-2xl font-semibold tracking-tight text-foreground",
				children: value
			}),
			/* @__PURE__ */ jsx("p", {
				className: "mt-1 text-xs leading-5 text-muted-foreground",
				children: helper
			})
		]
	});
}
/**
* Amber nudge banner that surfaces when an agent has no site_type
* resolved yet. Without a site type the LLM never receives the
* vertical preset's marker-emission instruction and replies in raw
* text. Dismissible per-agent via localStorage so a customer who
* deliberately wants `generic` isn't nagged on every visit.
*/
function SiteTypeNudgeBanner({ agent }) {
	const { t } = useT();
	const storageKey = `pb:site_type_nudge_dismissed:${agent.id}`;
	const [dismissed, setDismissed] = useState(() => {
		try {
			return window.localStorage.getItem(storageKey) === "1";
		} catch {
			return false;
		}
	});
	if (agent.site_type !== null && agent.site_type !== void 0 && agent.site_type !== "") return null;
	if (dismissed) return null;
	return /* @__PURE__ */ jsxs("div", {
		className: "mx-4 mt-4 flex flex-wrap items-start gap-3 rounded-md border border-amber-300/70 bg-amber-50 px-4 py-3 text-sm dark:border-amber-700 dark:bg-amber-900/20",
		children: [
			/* @__PURE__ */ jsx(Sparkles, { className: "mt-0.5 size-4 shrink-0 text-amber-700 dark:text-amber-300" }),
			/* @__PURE__ */ jsxs("div", {
				className: "min-w-0 flex-1",
				children: [/* @__PURE__ */ jsx("p", {
					className: "font-medium text-amber-900 dark:text-amber-100",
					children: t("Pick a site type to unlock rich messages")
				}), /* @__PURE__ */ jsx("p", {
					className: "mt-0.5 text-xs leading-5 text-amber-800/90 dark:text-amber-200/80",
					children: t("Without a site type the agent replies in raw text. Pick ecommerce, saas, marketing, etc. so the LLM can emit product cards, pricing tables, and CTA buttons.")
				})]
			}),
			/* @__PURE__ */ jsxs("div", {
				className: "flex shrink-0 items-center gap-2",
				children: [/* @__PURE__ */ jsx(Button, {
					variant: "outline",
					size: "sm",
					asChild: true,
					children: /* @__PURE__ */ jsx(Link, {
						href: vertical({ agent: agent.id }).url,
						children: t("Set site type")
					})
				}), /* @__PURE__ */ jsx(Button, {
					type: "button",
					variant: "ghost",
					size: "sm",
					onClick: () => {
						try {
							window.localStorage.setItem(storageKey, "1");
						} catch {}
						setDismissed(true);
					},
					"aria-label": t("Dismiss"),
					children: t("Dismiss")
				})]
			})
		]
	});
}
function ShowAgent({ agent, setup, embed }) {
	const { t, tChoice } = useT();
	const breadcrumbs = [{
		title: t("Agents"),
		href: index$12.url()
	}, {
		title: agent.name,
		href: show$4({ agent: agent.id }).url
	}];
	const lang = (agent.language_default ?? "en").toUpperCase();
	const tiles = navTiles(agent.id, t);
	const primaryTiles = tiles.filter((tile) => tile.primary === true);
	const secondaryTiles = tiles.filter((tile) => tile.primary !== true);
	const [copied, setCopied] = useState(false);
	const [isPublishing, setIsPublishing] = useState(false);
	const sourcesDone = setup.sources_indexed > 0;
	const playgroundDone = setup.has_messages;
	const publishedDone = agent.is_published;
	const completedSteps = [
		sourcesDone,
		playgroundDone,
		publishedDone
	].filter(Boolean).length;
	const completionPercent = completedSteps / 3 * 100;
	const confidencePercent = Math.round(agent.confidence_threshold * 100);
	const stepsLeft = 3 - completedSteps;
	const readinessLabel = completedSteps === 3 ? t("Ready for installation.") : tChoice(":count setup step left|:count setup steps left", stepsLeft, { count: stepsLeft });
	const nextAction = !sourcesDone ? {
		title: t("Add your first source"),
		description: t("Index at least one URL or file so the agent has real knowledge to answer from."),
		type: "link",
		href: index$15({ agent: agent.id }).url
	} : !playgroundDone ? {
		title: t("Run a playground check"),
		description: t("Ask a few realistic questions and confirm the tone before publishing."),
		type: "link",
		href: playground({ agent: agent.id }).url
	} : !publishedDone ? {
		title: t("Publish this agent"),
		description: t("The setup is ready. Publish to unlock the install snippet and go live."),
		type: "publish"
	} : {
		title: t("Review live conversations"),
		description: t("Watch real visitor sessions and keep improving the live experience."),
		type: "link",
		href: index$16({ agent: agent.id }).url
	};
	const copySnippet = async () => {
		try {
			await navigator.clipboard.writeText(embed.snippet);
			setCopied(true);
			setTimeout(() => setCopied(false), 1800);
		} catch {}
	};
	const publish$2 = () => {
		if (isPublishing) return;
		setIsPublishing(true);
		router.post(publish.url({ agent: agent.id }), {}, {
			preserveScroll: true,
			onFinish: () => setIsPublishing(false)
		});
	};
	return /* @__PURE__ */ jsxs(AppLayout, {
		breadcrumbs,
		children: [/* @__PURE__ */ jsx(Head, { title: agent.name }), /* @__PURE__ */ jsxs("div", {
			className: "flex min-h-0 flex-1 flex-col bg-card",
			children: [/* @__PURE__ */ jsxs("div", {
				className: "flex min-h-10 flex-wrap items-center gap-2 border-b px-3 py-2 sm:py-1.5",
				children: [
					/* @__PURE__ */ jsx(AgentStatusBadge, { published: agent.is_published }),
					/* @__PURE__ */ jsx("span", {
						className: "inline-flex h-7 items-center rounded-md border bg-background px-2.5 text-xs font-normal text-muted-foreground",
						children: lang
					}),
					/* @__PURE__ */ jsx("span", {
						className: "inline-flex h-7 items-center rounded-md border bg-background px-2.5 text-xs font-normal text-muted-foreground",
						children: t(":indexed/:total indexed", {
							indexed: setup.sources_indexed,
							total: setup.sources_total
						})
					}),
					/* @__PURE__ */ jsxs("div", {
						className: "ms-auto flex w-full flex-wrap items-center justify-end gap-2 sm:w-auto",
						children: [
							/* @__PURE__ */ jsx(Button, {
								variant: "outline",
								size: "sm",
								asChild: true,
								children: /* @__PURE__ */ jsx(Link, {
									href: edit$7.url({ agent: agent.id }),
									prefetch: true,
									children: t("Settings")
								})
							}),
							/* @__PURE__ */ jsx(Button, {
								size: "sm",
								variant: agent.is_published ? "outline" : "default",
								onClick: publish$2,
								disabled: isPublishing,
								children: isPublishing ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Check, { className: "size-3.5" }), t("Working...")] }) : agent.is_published ? t("Re-publish") : t("Publish")
							}),
							/* @__PURE__ */ jsxs(Button, {
								variant: "outline",
								size: "sm",
								onClick: () => toast.warning(t("Delete the agent \":name\"?", { name: agent.name }), {
									description: t("This removes the agent, its knowledge sources, conversations, and captured leads. This cannot be undone."),
									duration: 12e3,
									action: {
										label: t("Delete"),
										onClick: () => router.delete(destroy$12.url({ agent: agent.id }))
									},
									cancel: {
										label: t("Cancel"),
										onClick: () => {}
									}
								}),
								className: "border-destructive/40 text-destructive hover:border-destructive hover:bg-destructive/10 hover:text-destructive",
								children: [/* @__PURE__ */ jsx(Trash2, { className: "size-3.5" }), t("Delete")]
							})
						]
					})
				]
			}), /* @__PURE__ */ jsxs("div", {
				className: "min-h-0 flex-1 overflow-y-auto",
				children: [/* @__PURE__ */ jsx(SiteTypeNudgeBanner, { agent }), /* @__PURE__ */ jsxs("div", {
					className: "grid gap-4 p-4 xl:grid-cols-[minmax(0,1.45fr)_minmax(320px,0.95fr)]",
					children: [/* @__PURE__ */ jsxs("div", {
						className: "grid gap-4",
						children: [
							/* @__PURE__ */ jsxs(Card, {
								className: "overflow-hidden p-0",
								children: [
									/* @__PURE__ */ jsx("div", {
										className: "border-b px-4 py-4 sm:px-5",
										children: /* @__PURE__ */ jsxs("div", {
											className: "flex flex-wrap items-start justify-between gap-4",
											children: [/* @__PURE__ */ jsxs("div", {
												className: "min-w-0 flex-1",
												children: [
													/* @__PURE__ */ jsx("span", {
														className: "inline-flex items-center rounded-full border bg-muted/30 px-3 py-1 text-[11px] font-medium text-muted-foreground",
														children: t("Agent workspace")
													}),
													/* @__PURE__ */ jsx("h1", {
														className: "mt-4 text-2xl font-semibold tracking-tight text-foreground sm:text-3xl",
														children: agent.name
													}),
													/* @__PURE__ */ jsx("p", {
														className: "mt-2 max-w-2xl text-sm leading-6 text-muted-foreground",
														children: t("Train the agent, review what it sees, test real prompts, and publish when the setup is ready for visitors.")
													}),
													/* @__PURE__ */ jsxs("div", {
														className: "mt-4 flex flex-wrap gap-2",
														children: [
															/* @__PURE__ */ jsx(AgentStatusBadge, { published: agent.is_published }),
															/* @__PURE__ */ jsx("span", {
																className: "inline-flex items-center rounded-md border bg-background px-2.5 py-1 text-xs text-muted-foreground",
																children: t(":lang default language", { lang })
															}),
															/* @__PURE__ */ jsx("span", {
																className: "inline-flex items-center rounded-md border bg-background px-2.5 py-1 text-xs text-muted-foreground",
																children: t(":percent% confidence threshold", { percent: confidencePercent })
															})
														]
													})
												]
											}), /* @__PURE__ */ jsxs("div", {
												className: "max-w-full min-w-[240px] rounded-2xl border bg-muted/25 p-4",
												children: [
													/* @__PURE__ */ jsx("p", {
														className: "text-xs font-medium tracking-wider text-muted-foreground uppercase",
														children: t("Setup progress")
													}),
													/* @__PURE__ */ jsxs("div", {
														className: "mt-3 flex items-end justify-between gap-3",
														children: [/* @__PURE__ */ jsxs("p", {
															className: "text-3xl font-semibold tracking-tight text-foreground tabular-nums",
															children: [completedSteps, "/3"]
														}), /* @__PURE__ */ jsx("p", {
															className: "max-w-[9rem] text-end text-xs text-muted-foreground",
															children: readinessLabel
														})]
													}),
													/* @__PURE__ */ jsx("div", {
														className: "mt-3 h-2 rounded-full bg-muted",
														children: /* @__PURE__ */ jsx("div", {
															className: "h-2 rounded-full bg-foreground",
															style: { width: `${completionPercent}%` }
														})
													})
												]
											})]
										})
									}),
									/* @__PURE__ */ jsxs("div", {
										className: "grid gap-0 md:grid-cols-3",
										children: [
											/* @__PURE__ */ jsx(SetupStepCard, {
												step: 1,
												done: sourcesDone,
												title: t("Train with real knowledge"),
												description: sourcesDone ? tChoice("Indexed :indexed of :total source successfully.|Indexed :indexed of :total sources successfully.", setup.sources_total, {
													indexed: setup.sources_indexed,
													total: setup.sources_total
												}) : t("Add at least one URL or file so the agent can answer from real content."),
												className: "md:border-e"
											}),
											/* @__PURE__ */ jsx(SetupStepCard, {
												step: 2,
												done: playgroundDone,
												title: t("Validate in playground"),
												description: playgroundDone ? t("The agent has already been tested in the playground.") : t("Run a few realistic prompts to check tone, accuracy, and fallback behavior."),
												className: "md:border-e"
											}),
											/* @__PURE__ */ jsx(SetupStepCard, {
												step: 3,
												done: publishedDone,
												title: t("Go live"),
												description: publishedDone ? t("Published and ready for installation on your site.") : t("Publish when the setup looks correct so you can install the widget.")
											})
										]
									}),
									/* @__PURE__ */ jsxs("div", {
										className: "flex flex-wrap items-center justify-between gap-3 border-t px-4 py-3",
										children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
											className: "text-sm font-medium text-foreground",
											children: nextAction.title
										}), /* @__PURE__ */ jsx("p", {
											className: "text-xs text-muted-foreground",
											children: nextAction.description
										})] }), nextAction.type === "publish" ? /* @__PURE__ */ jsx(Button, {
											size: "sm",
											onClick: publish$2,
											disabled: isPublishing,
											children: isPublishing ? t("Publishing...") : t("Publish agent")
										}) : /* @__PURE__ */ jsx(Button, {
											asChild: true,
											size: "sm",
											children: /* @__PURE__ */ jsxs(Link, {
												href: nextAction.href ?? "#",
												prefetch: true,
												children: [nextAction.title, /* @__PURE__ */ jsx(ArrowRight, { className: "size-3.5" })]
											})
										})]
									})
								]
							}),
							/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsxs("div", {
								className: "mb-3",
								children: [/* @__PURE__ */ jsx("h2", {
									className: "text-sm font-medium text-foreground",
									children: t("Core workflow")
								}), /* @__PURE__ */ jsx("p", {
									className: "mt-1 text-xs text-muted-foreground",
									children: t("The main places you'll use to train, test, and operate this agent day to day.")
								})]
							}), /* @__PURE__ */ jsx("div", {
								className: "grid gap-3 md:grid-cols-2 xl:grid-cols-3",
								children: primaryTiles.map((tile) => /* @__PURE__ */ jsx(ActionTile, {
									tile,
									prominent: true
								}, tile.title))
							})] }),
							/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsxs("div", {
								className: "mb-3",
								children: [/* @__PURE__ */ jsx("h2", {
									className: "text-sm font-medium text-foreground",
									children: t("Optimize and grow")
								}), /* @__PURE__ */ jsx("p", {
									className: "mt-1 text-xs text-muted-foreground",
									children: t("Refine answers, triggers, presentation, and experiments from the same workspace.")
								})]
							}), /* @__PURE__ */ jsx("div", {
								className: "grid gap-3 md:grid-cols-2 xl:grid-cols-3",
								children: secondaryTiles.map((tile) => /* @__PURE__ */ jsx(ActionTile, { tile }, tile.title))
							})] }),
							/* @__PURE__ */ jsxs(Card, {
								className: "p-4",
								children: [
									/* @__PURE__ */ jsxs("div", {
										className: "flex items-center gap-2",
										children: [/* @__PURE__ */ jsx(MessageSquare, { className: "size-4 text-muted-foreground" }), /* @__PURE__ */ jsx("p", {
											className: "text-sm font-medium text-foreground",
											children: t("System prompt")
										})]
									}),
									/* @__PURE__ */ jsx("p", {
										className: "mt-2 text-xs leading-5 text-muted-foreground",
										children: t("This is the instruction layer the model sees before indexed knowledge and live visitor messages are added.")
									}),
									/* @__PURE__ */ jsx("pre", {
										className: "mt-3 min-h-28 rounded-xl border bg-muted/30 p-3 text-xs leading-6 whitespace-pre-wrap text-foreground",
										children: agent.system_prompt ?? t("(none yet — set one in Settings)")
									})
								]
							})
						]
					}), /* @__PURE__ */ jsxs("div", {
						className: "grid gap-4",
						children: [
							/* @__PURE__ */ jsxs(Card, {
								className: "overflow-hidden p-0",
								children: [/* @__PURE__ */ jsxs("div", {
									className: "border-b px-4 py-4",
									children: [/* @__PURE__ */ jsx("h2", {
										className: "text-sm font-medium text-foreground",
										children: t("Launch snapshot")
									}), /* @__PURE__ */ jsx("p", {
										className: "mt-1 text-xs text-muted-foreground",
										children: t("Readiness, deployment state, and agent behavior at a glance.")
									})]
								}), /* @__PURE__ */ jsxs("div", {
									className: "grid grid-cols-2 gap-0",
									children: [
										/* @__PURE__ */ jsx(SnapshotMetric, {
											label: t("Knowledge"),
											value: setup.sources_total > 0 ? `${setup.sources_indexed}/${setup.sources_total}` : "0",
											helper: setup.sources_total > 0 ? t("Indexed sources") : t("Sources added so far"),
											className: "border-e border-b"
										}),
										/* @__PURE__ */ jsx(SnapshotMetric, {
											label: t("Playground"),
											value: playgroundDone ? t("Ready") : t("Pending"),
											helper: playgroundDone ? t("Tested with sample prompts") : t("Needs a validation pass"),
											className: "border-b"
										}),
										/* @__PURE__ */ jsx(SnapshotMetric, {
											label: t("Publishing"),
											value: publishedDone ? t("Live") : t("Draft"),
											helper: publishedDone ? t("Widget can be installed") : t("Private until published"),
											className: "border-e"
										}),
										/* @__PURE__ */ jsx(SnapshotMetric, {
											label: t("Confidence"),
											value: `${confidencePercent}%`,
											helper: t("Minimum confidence threshold")
										})
									]
								})]
							}),
							agent.is_published ? /* @__PURE__ */ jsxs(Card, {
								className: "overflow-hidden p-0",
								children: [/* @__PURE__ */ jsx("div", {
									className: "border-b px-4 py-4",
									children: /* @__PURE__ */ jsxs("div", {
										className: "flex items-start justify-between gap-3",
										children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("h2", {
											className: "text-sm font-medium text-foreground",
											children: t("Embed on your site")
										}), /* @__PURE__ */ jsxs("div", {
											className: "mt-1 grid gap-1 text-xs text-muted-foreground",
											children: [/* @__PURE__ */ jsxs("p", { children: [
												t("Copy this one-line snippet and paste it just before the closing"),
												" ",
												/* @__PURE__ */ jsx("code", { children: "</body>" }),
												" ",
												t("tag on any page where the agent should appear.")
											] }), /* @__PURE__ */ jsxs("p", { children: [
												t("Alternatively place it inside"),
												" ",
												/* @__PURE__ */ jsx("code", { children: "<head>" }),
												" ",
												t("— the script is async + deferred, so it never blocks rendering.")
											] })]
										})] }), /* @__PURE__ */ jsx(AgentStatusBadge, { published: true })]
									})
								}), /* @__PURE__ */ jsxs("div", {
									className: "px-4 py-4",
									children: [
										/* @__PURE__ */ jsx("pre", {
											className: "overflow-x-auto rounded-xl border bg-muted/30 p-3 text-xs leading-6 whitespace-pre-wrap text-foreground",
											children: embed.snippet
										}),
										/* @__PURE__ */ jsx("div", {
											className: "mt-3 flex flex-wrap items-center gap-2",
											children: /* @__PURE__ */ jsx(Button, {
												onClick: copySnippet,
												variant: "outline",
												size: "sm",
												children: copied ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Check, { className: "size-3.5" }), t("Copied")] }) : /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Clipboard, { className: "size-3.5" }), t("Copy snippet")] })
											})
										}),
										/* @__PURE__ */ jsxs("div", {
											className: "mt-3 rounded-xl border bg-background px-3 py-2",
											children: [/* @__PURE__ */ jsx("p", {
												className: "text-[11px] font-medium tracking-wider text-muted-foreground uppercase",
												children: t("Loader URL")
											}), /* @__PURE__ */ jsx("p", {
												className: "mt-1 text-xs break-all text-foreground",
												children: embed.widget_url
											})]
										})
									]
								})]
							}) : /* @__PURE__ */ jsxs(Card, {
								className: "p-4",
								children: [
									/* @__PURE__ */ jsxs("div", {
										className: "flex items-center gap-2",
										children: [/* @__PURE__ */ jsx(Globe, { className: "size-4 text-muted-foreground" }), /* @__PURE__ */ jsx("p", {
											className: "text-sm font-medium text-foreground",
											children: t("Publish to unlock installation")
										})]
									}),
									/* @__PURE__ */ jsx("p", {
										className: "mt-2 text-sm leading-6 text-muted-foreground",
										children: t("As soon as this agent is published, this panel will switch to the live embed snippet you can paste into your site.")
									}),
									/* @__PURE__ */ jsxs("div", {
										className: "mt-4 rounded-xl border bg-muted/30 p-3",
										children: [/* @__PURE__ */ jsx("p", {
											className: "text-xs font-medium text-foreground",
											children: t("Before you launch")
										}), /* @__PURE__ */ jsxs("div", {
											className: "mt-3 space-y-2 text-xs text-muted-foreground",
											children: [
												/* @__PURE__ */ jsxs("div", {
													className: "flex items-start gap-2",
													children: [/* @__PURE__ */ jsx("span", { className: "mt-1 size-1.5 rounded-full bg-current" }), t("Index at least one real source.")]
												}),
												/* @__PURE__ */ jsxs("div", {
													className: "flex items-start gap-2",
													children: [/* @__PURE__ */ jsx("span", { className: "mt-1 size-1.5 rounded-full bg-current" }), t("Test answers in playground with realistic prompts.")]
												}),
												/* @__PURE__ */ jsxs("div", {
													className: "flex items-start gap-2",
													children: [/* @__PURE__ */ jsx("span", { className: "mt-1 size-1.5 rounded-full bg-current" }), t("Confirm the prompt and appearance settings.")]
												})
											]
										})]
									})
								]
							}),
							/* @__PURE__ */ jsxs(Card, {
								className: "p-4",
								children: [/* @__PURE__ */ jsxs("div", {
									className: "flex items-center gap-2",
									children: [/* @__PURE__ */ jsx(Palette, { className: "size-4 text-muted-foreground" }), /* @__PURE__ */ jsx("p", {
										className: "text-sm font-medium text-foreground",
										children: t("Behavior and presentation")
									})]
								}), /* @__PURE__ */ jsxs("div", {
									className: "mt-4 space-y-4",
									children: [
										/* @__PURE__ */ jsxs("div", {
											className: "flex items-start justify-between gap-3",
											children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
												className: "text-sm font-medium text-foreground",
												children: t("Voice and prompt")
											}), /* @__PURE__ */ jsx("p", {
												className: "mt-1 text-xs leading-5 text-muted-foreground",
												children: agent.system_prompt ? t("Custom system instructions are already guiding the model.") : t("Still using the default instructions until you define a custom prompt.")
											})] }), /* @__PURE__ */ jsxs(Link, {
												href: edit$7.url({ agent: agent.id }),
												prefetch: true,
												className: "inline-flex items-center gap-1 text-xs font-medium text-foreground hover:text-foreground/80",
												children: [t("Settings"), /* @__PURE__ */ jsx(ArrowUpRight, { className: "size-3.5" })]
											})]
										}),
										/* @__PURE__ */ jsxs("div", {
											className: "flex items-start justify-between gap-3 border-t pt-4",
											children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
												className: "text-sm font-medium text-foreground",
												children: t("Appearance and widget feel")
											}), /* @__PURE__ */ jsx("p", {
												className: "mt-1 text-xs leading-5 text-muted-foreground",
												children: t("Tune colors, persona, and guardrails with a live widget preview.")
											})] }), /* @__PURE__ */ jsxs(Link, {
												href: customize({ agent: agent.id }).url,
												prefetch: true,
												className: "inline-flex items-center gap-1 text-xs font-medium text-foreground hover:text-foreground/80",
												children: [t("Customize"), /* @__PURE__ */ jsx(ArrowUpRight, { className: "size-3.5" })]
											})]
										}),
										/* @__PURE__ */ jsxs("div", {
											className: "flex items-start justify-between gap-3 border-t pt-4",
											children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
												className: "text-sm font-medium text-foreground",
												children: t("Leads and conversations")
											}), /* @__PURE__ */ jsx("p", {
												className: "mt-1 text-xs leading-5 text-muted-foreground",
												children: t("Jump into live sessions and captured leads once the agent starts talking.")
											})] }), /* @__PURE__ */ jsxs(Link, {
												href: index$16({ agent: agent.id }).url,
												prefetch: true,
												className: "inline-flex items-center gap-1 text-xs font-medium text-foreground hover:text-foreground/80",
												children: [t("Inbox"), /* @__PURE__ */ jsx(ArrowUpRight, { className: "size-3.5" })]
											})]
										})
									]
								})]
							})
						]
					})]
				})]
			})]
		})]
	});
}
//#endregion
//#region resources/js/routes/sources/text/index.ts
/**
* @see \App\Http\Controllers\Admin\SourceController::update
* @see app/Http/Controllers/Admin/SourceController.php:495
* @route '/app/sources/{source}/text'
*/
var update$7 = (args, options) => ({
	url: update$7.url(args, options),
	method: "patch"
});
update$7.definition = {
	methods: ["patch"],
	url: "/app/sources/{source}/text"
};
/**
* @see \App\Http\Controllers\Admin\SourceController::update
* @see app/Http/Controllers/Admin/SourceController.php:495
* @route '/app/sources/{source}/text'
*/
update$7.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { source: args };
	if (typeof args === "object" && !Array.isArray(args) && "id" in args) args = { source: args.id };
	if (Array.isArray(args)) args = { source: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { source: typeof args.source === "object" ? args.source.id : args.source };
	return update$7.definition.url.replace("{source}", parsedArgs.source.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\SourceController::update
* @see app/Http/Controllers/Admin/SourceController.php:495
* @route '/app/sources/{source}/text'
*/
update$7.patch = (args, options) => ({
	url: update$7.url(args, options),
	method: "patch"
});
/**
* @see \App\Http\Controllers\Admin\SourceController::update
* @see app/Http/Controllers/Admin/SourceController.php:495
* @route '/app/sources/{source}/text'
*/
var updateForm$7 = (args, options) => ({
	action: update$7.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "PATCH",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\SourceController::update
* @see app/Http/Controllers/Admin/SourceController.php:495
* @route '/app/sources/{source}/text'
*/
updateForm$7.patch = (args, options) => ({
	action: update$7.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "PATCH",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
update$7.form = updateForm$7;
var text = { update: Object.assign(update$7, update$7) };
//#endregion
//#region resources/js/routes/sources/global/index.ts
/**
* @see \App\Http\Controllers\Admin\SourceController::update
* @see app/Http/Controllers/Admin/SourceController.php:158
* @route '/app/sources/{source}/global'
*/
var update$6 = (args, options) => ({
	url: update$6.url(args, options),
	method: "patch"
});
update$6.definition = {
	methods: ["patch"],
	url: "/app/sources/{source}/global"
};
/**
* @see \App\Http\Controllers\Admin\SourceController::update
* @see app/Http/Controllers/Admin/SourceController.php:158
* @route '/app/sources/{source}/global'
*/
update$6.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { source: args };
	if (typeof args === "object" && !Array.isArray(args) && "id" in args) args = { source: args.id };
	if (Array.isArray(args)) args = { source: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { source: typeof args.source === "object" ? args.source.id : args.source };
	return update$6.definition.url.replace("{source}", parsedArgs.source.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\SourceController::update
* @see app/Http/Controllers/Admin/SourceController.php:158
* @route '/app/sources/{source}/global'
*/
update$6.patch = (args, options) => ({
	url: update$6.url(args, options),
	method: "patch"
});
/**
* @see \App\Http\Controllers\Admin\SourceController::update
* @see app/Http/Controllers/Admin/SourceController.php:158
* @route '/app/sources/{source}/global'
*/
var updateForm$6 = (args, options) => ({
	action: update$6.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "PATCH",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\SourceController::update
* @see app/Http/Controllers/Admin/SourceController.php:158
* @route '/app/sources/{source}/global'
*/
updateForm$6.patch = (args, options) => ({
	action: update$6.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "PATCH",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
update$6.form = updateForm$6;
var global = { update: Object.assign(update$6, update$6) };
//#endregion
//#region resources/js/routes/sources/index.ts
/**
* @see \App\Http\Controllers\Admin\SourceController::destroy
* @see app/Http/Controllers/Admin/SourceController.php:765
* @route '/app/sources/{source}'
*/
var destroy$5 = (args, options) => ({
	url: destroy$5.url(args, options),
	method: "delete"
});
destroy$5.definition = {
	methods: ["delete"],
	url: "/app/sources/{source}"
};
/**
* @see \App\Http\Controllers\Admin\SourceController::destroy
* @see app/Http/Controllers/Admin/SourceController.php:765
* @route '/app/sources/{source}'
*/
destroy$5.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { source: args };
	if (typeof args === "object" && !Array.isArray(args) && "id" in args) args = { source: args.id };
	if (Array.isArray(args)) args = { source: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { source: typeof args.source === "object" ? args.source.id : args.source };
	return destroy$5.definition.url.replace("{source}", parsedArgs.source.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\SourceController::destroy
* @see app/Http/Controllers/Admin/SourceController.php:765
* @route '/app/sources/{source}'
*/
destroy$5.delete = (args, options) => ({
	url: destroy$5.url(args, options),
	method: "delete"
});
/**
* @see \App\Http\Controllers\Admin\SourceController::destroy
* @see app/Http/Controllers/Admin/SourceController.php:765
* @route '/app/sources/{source}'
*/
var destroyForm$5 = (args, options) => ({
	action: destroy$5.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "DELETE",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\SourceController::destroy
* @see app/Http/Controllers/Admin/SourceController.php:765
* @route '/app/sources/{source}'
*/
destroyForm$5.delete = (args, options) => ({
	action: destroy$5.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "DELETE",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
destroy$5.form = destroyForm$5;
/**
* @see \App\Http\Controllers\Admin\SourceController::reindex
* @see app/Http/Controllers/Admin/SourceController.php:875
* @route '/app/sources/{source}/reindex'
*/
var reindex = (args, options) => ({
	url: reindex.url(args, options),
	method: "post"
});
reindex.definition = {
	methods: ["post"],
	url: "/app/sources/{source}/reindex"
};
/**
* @see \App\Http\Controllers\Admin\SourceController::reindex
* @see app/Http/Controllers/Admin/SourceController.php:875
* @route '/app/sources/{source}/reindex'
*/
reindex.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { source: args };
	if (typeof args === "object" && !Array.isArray(args) && "id" in args) args = { source: args.id };
	if (Array.isArray(args)) args = { source: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { source: typeof args.source === "object" ? args.source.id : args.source };
	return reindex.definition.url.replace("{source}", parsedArgs.source.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\SourceController::reindex
* @see app/Http/Controllers/Admin/SourceController.php:875
* @route '/app/sources/{source}/reindex'
*/
reindex.post = (args, options) => ({
	url: reindex.url(args, options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\SourceController::reindex
* @see app/Http/Controllers/Admin/SourceController.php:875
* @route '/app/sources/{source}/reindex'
*/
var reindexForm = (args, options) => ({
	action: reindex.url(args, options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\SourceController::reindex
* @see app/Http/Controllers/Admin/SourceController.php:875
* @route '/app/sources/{source}/reindex'
*/
reindexForm.post = (args, options) => ({
	action: reindex.url(args, options),
	method: "post"
});
reindex.form = reindexForm;
/**
* @see \App\Http\Controllers\Admin\SourceController::preview
* @see app/Http/Controllers/Admin/SourceController.php:937
* @route '/app/sources/{source}/preview'
*/
var preview = (args, options) => ({
	url: preview.url(args, options),
	method: "get"
});
preview.definition = {
	methods: ["get", "head"],
	url: "/app/sources/{source}/preview"
};
/**
* @see \App\Http\Controllers\Admin\SourceController::preview
* @see app/Http/Controllers/Admin/SourceController.php:937
* @route '/app/sources/{source}/preview'
*/
preview.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { source: args };
	if (typeof args === "object" && !Array.isArray(args) && "id" in args) args = { source: args.id };
	if (Array.isArray(args)) args = { source: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { source: typeof args.source === "object" ? args.source.id : args.source };
	return preview.definition.url.replace("{source}", parsedArgs.source.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\SourceController::preview
* @see app/Http/Controllers/Admin/SourceController.php:937
* @route '/app/sources/{source}/preview'
*/
preview.get = (args, options) => ({
	url: preview.url(args, options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\SourceController::preview
* @see app/Http/Controllers/Admin/SourceController.php:937
* @route '/app/sources/{source}/preview'
*/
preview.head = (args, options) => ({
	url: preview.url(args, options),
	method: "head"
});
/**
* @see \App\Http\Controllers\Admin\SourceController::preview
* @see app/Http/Controllers/Admin/SourceController.php:937
* @route '/app/sources/{source}/preview'
*/
var previewForm = (args, options) => ({
	action: preview.url(args, options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\SourceController::preview
* @see app/Http/Controllers/Admin/SourceController.php:937
* @route '/app/sources/{source}/preview'
*/
previewForm.get = (args, options) => ({
	action: preview.url(args, options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\SourceController::preview
* @see app/Http/Controllers/Admin/SourceController.php:937
* @route '/app/sources/{source}/preview'
*/
previewForm.head = (args, options) => ({
	action: preview.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
preview.form = previewForm;
Object.assign(destroy$5, destroy$5), Object.assign(reindex, reindex), Object.assign(text, text), Object.assign(global, global), Object.assign(preview, preview);
//#endregion
//#region resources/js/pages/app/agents/sources.tsx
var sources_exports = /* @__PURE__ */ __exportAll({ default: () => Sources });
var STATUS_COLOR = {
	pending: "bg-amber-500/15 text-amber-700 dark:text-amber-400",
	crawling: "bg-sky-500/15 text-sky-700 dark:text-sky-400",
	indexed: "bg-emerald-500/15 text-emerald-700 dark:text-emerald-400",
	failed: "bg-rose-500/15 text-rose-700 dark:text-rose-400"
};
/**
* Discover URLs from a domain (via robots.txt sitemap + probed paths)
* and bulk-add the operator's selection. Built on the existing
* `/sources/discover` + `/sources/bulk` endpoints — onboarding has
* always used them; this surfaces the same flow on the routine "add
* sources" page so operators don't have to paste URLs one by one.
*
* Adds Select all / Deselect all controls — buyer report 2026-05-26.
*/
function DiscoverUrlsCard({ agent }) {
	const { t } = useT();
	const [domain, setDomain] = useState("");
	const [loading, setLoading] = useState(false);
	const [error, setError] = useState(null);
	const [discovered, setDiscovered] = useState(null);
	const [picked, setPicked] = useState({});
	const [submitting, setSubmitting] = useState(false);
	const csrf = () => document.querySelector("meta[name=\"csrf-token\"]")?.content ?? "";
	const allUrls = () => {
		if (!discovered) return [];
		return [...discovered.sitemap_urls, ...discovered.probed_urls];
	};
	const pickedCount = Object.values(picked).filter(Boolean).length;
	const totalCount = allUrls().length;
	const selectAll = () => {
		const next = {};
		allUrls().forEach((u) => next[u] = true);
		setPicked(next);
	};
	const deselectAll = () => setPicked({});
	const discover = async (e) => {
		e.preventDefault();
		if (!domain || loading) return;
		setLoading(true);
		setError(null);
		try {
			const res = await fetch(`/app/agents/${agent.id}/sources/discover`, {
				method: "POST",
				credentials: "same-origin",
				headers: {
					"Content-Type": "application/json",
					Accept: "application/json",
					"X-CSRF-TOKEN": csrf(),
					"X-Requested-With": "XMLHttpRequest"
				},
				body: JSON.stringify({
					url: domain,
					max: 200
				})
			});
			if (!res.ok) {
				const text = await res.text();
				throw new Error(text || `HTTP ${res.status}`);
			}
			const json = await res.json();
			setDiscovered(json.data);
			const initial = {};
			json.data.sitemap_urls.forEach((u) => initial[u] = true);
			json.data.probed_urls.forEach((u) => initial[u] = true);
			setPicked(initial);
		} catch (err) {
			setError(err instanceof Error ? err.message : t("Discovery failed."));
		} finally {
			setLoading(false);
		}
	};
	const importPicked = async () => {
		const urls = Object.entries(picked).filter(([, v]) => v).map(([k]) => k);
		if (urls.length === 0 || submitting) return;
		setSubmitting(true);
		try {
			const formEl = document.createElement("form");
			formEl.method = "POST";
			formEl.action = `/app/agents/${agent.id}/sources/bulk`;
			const tokenInput = document.createElement("input");
			tokenInput.type = "hidden";
			tokenInput.name = "_token";
			tokenInput.value = csrf();
			formEl.appendChild(tokenInput);
			urls.forEach((u, i) => {
				const inp = document.createElement("input");
				inp.type = "hidden";
				inp.name = `urls[${i}]`;
				inp.value = u;
				formEl.appendChild(inp);
			});
			document.body.appendChild(formEl);
			formEl.submit();
		} finally {
			setSubmitting(false);
		}
	};
	return /* @__PURE__ */ jsxs(Card, {
		className: "mt-3 border-border/80 p-5",
		children: [
			/* @__PURE__ */ jsx("h2", {
				className: "mb-1 font-medium",
				children: t("Discover URLs from a domain")
			}),
			/* @__PURE__ */ jsx("p", {
				className: "mb-3 text-xs text-muted-foreground",
				children: t("We crawl robots.txt + sitemap.xml + a handful of common paths and list everything we find. Tick the URLs you want and we'll queue them all for crawling in one go.")
			}),
			/* @__PURE__ */ jsxs("form", {
				onSubmit: discover,
				className: "grid gap-3 md:grid-cols-[1fr_auto]",
				children: [/* @__PURE__ */ jsx(Input, {
					type: "url",
					placeholder: "https://your-site.com",
					value: domain,
					onChange: (e) => setDomain(e.target.value),
					disabled: loading
				}), /* @__PURE__ */ jsx(Button, {
					type: "submit",
					disabled: loading || !domain.trim(),
					children: loading ? t("Discovering…") : t("Discover URLs")
				})]
			}),
			error && /* @__PURE__ */ jsx("p", {
				className: "mt-2 text-xs text-destructive",
				children: error
			}),
			discovered && /* @__PURE__ */ jsxs("div", {
				className: "mt-4 grid gap-3",
				children: [
					/* @__PURE__ */ jsxs("div", {
						className: "flex flex-wrap items-center justify-between gap-2",
						children: [/* @__PURE__ */ jsxs("p", {
							className: "text-xs text-muted-foreground",
							children: [
								t(":n URL(s) discovered", { n: totalCount }),
								" ·",
								" ",
								t(":n selected", { n: pickedCount })
							]
						}), /* @__PURE__ */ jsxs("div", {
							className: "flex items-center gap-2",
							children: [/* @__PURE__ */ jsx(Button, {
								type: "button",
								size: "sm",
								variant: "outline",
								onClick: selectAll,
								disabled: pickedCount === totalCount,
								children: t("Select all")
							}), /* @__PURE__ */ jsx(Button, {
								type: "button",
								size: "sm",
								variant: "outline",
								onClick: deselectAll,
								disabled: pickedCount === 0,
								children: t("Deselect all")
							})]
						})]
					}),
					/* @__PURE__ */ jsx("div", {
						className: "max-h-72 overflow-y-auto rounded-md border",
						children: allUrls().map((u) => /* @__PURE__ */ jsxs("label", {
							className: "flex cursor-pointer items-center gap-2 border-b px-3 py-1.5 text-xs hover:bg-muted/50",
							children: [/* @__PURE__ */ jsx("input", {
								type: "checkbox",
								checked: picked[u] === true,
								onChange: (e) => setPicked((p) => ({
									...p,
									[u]: e.target.checked
								})),
								className: "size-3.5"
							}), /* @__PURE__ */ jsx("span", {
								className: "truncate",
								children: u
							})]
						}, u))
					}),
					/* @__PURE__ */ jsx("div", {
						className: "flex justify-end",
						children: /* @__PURE__ */ jsx(Button, {
							type: "button",
							onClick: importPicked,
							disabled: pickedCount === 0 || submitting,
							children: t("Import :n selected URL(s)", { n: pickedCount })
						})
					})
				]
			})
		]
	});
}
function SqlSourceCard({ agent }) {
	const { t } = useT();
	const form = useForm({
		driver: "mysql",
		host: "",
		port: 3306,
		database: "",
		username: "",
		password: "",
		query: "",
		title: "",
		title_column: "",
		body_column: ""
	});
	return /* @__PURE__ */ jsxs(Card, {
		className: "border-border/80 p-5",
		children: [
			/* @__PURE__ */ jsx("h2", {
				className: "mb-1 font-medium",
				children: t("Add SQL database")
			}),
			/* @__PURE__ */ jsx("p", {
				className: "mb-3 text-xs text-muted-foreground",
				children: t("Connect a read-only MySQL or PostgreSQL database. Paste a SELECT query — each row becomes part of the agent knowledge base. Credentials stay encrypted at rest.")
			}),
			/* @__PURE__ */ jsxs("form", {
				onSubmit: (e) => {
					e.preventDefault();
					form.post(`/app/agents/${agent.id}/sources/sql`, {
						preserveScroll: true,
						onSuccess: () => {
							form.reset("host", "database", "username", "password", "query", "title", "title_column", "body_column");
						}
					});
				},
				className: "grid gap-3",
				children: [
					/* @__PURE__ */ jsx("div", {
						role: "radiogroup",
						"aria-label": t("Driver"),
						className: "grid gap-2 sm:grid-cols-2",
						children: [{
							value: "mysql",
							title: "MySQL",
							port: 3306
						}, {
							value: "pgsql",
							title: "PostgreSQL",
							port: 5432
						}].map((opt) => {
							const checked = form.data.driver === opt.value;
							return /* @__PURE__ */ jsxs("label", {
								className: cn("group flex cursor-pointer items-center gap-2.5 rounded-md border bg-background p-3 text-sm transition hover:border-primary/40", checked && "border-primary ring-1 ring-primary/30"),
								children: [/* @__PURE__ */ jsx("input", {
									type: "radio",
									name: "sql-driver",
									value: opt.value,
									checked,
									onChange: () => {
										form.setData("driver", opt.value);
										form.setData("port", opt.port);
									},
									className: "size-3.5 accent-primary"
								}), /* @__PURE__ */ jsx("span", {
									className: "font-medium",
									children: opt.title
								})]
							}, opt.value);
						})
					}),
					/* @__PURE__ */ jsxs("div", {
						className: "grid gap-3 sm:grid-cols-[2fr_1fr]",
						children: [/* @__PURE__ */ jsxs("div", {
							className: "grid gap-1",
							children: [/* @__PURE__ */ jsx(Label, {
								htmlFor: "sql-host",
								children: t("Host")
							}), /* @__PURE__ */ jsx(Input, {
								id: "sql-host",
								value: form.data.host,
								onChange: (e) => form.setData("host", e.target.value),
								placeholder: "db.example.com",
								required: true
							})]
						}), /* @__PURE__ */ jsxs("div", {
							className: "grid gap-1",
							children: [/* @__PURE__ */ jsx(Label, {
								htmlFor: "sql-port",
								children: t("Port")
							}), /* @__PURE__ */ jsx(Input, {
								id: "sql-port",
								type: "number",
								value: form.data.port,
								onChange: (e) => form.setData("port", Number(e.target.value)),
								required: true
							})]
						})]
					}),
					/* @__PURE__ */ jsxs("div", {
						className: "grid gap-3 sm:grid-cols-3",
						children: [
							/* @__PURE__ */ jsxs("div", {
								className: "grid gap-1",
								children: [/* @__PURE__ */ jsx(Label, {
									htmlFor: "sql-database",
									children: t("Database")
								}), /* @__PURE__ */ jsx(Input, {
									id: "sql-database",
									value: form.data.database,
									onChange: (e) => form.setData("database", e.target.value),
									required: true
								})]
							}),
							/* @__PURE__ */ jsxs("div", {
								className: "grid gap-1",
								children: [/* @__PURE__ */ jsx(Label, {
									htmlFor: "sql-username",
									children: t("Username")
								}), /* @__PURE__ */ jsx(Input, {
									id: "sql-username",
									value: form.data.username,
									onChange: (e) => form.setData("username", e.target.value),
									autoComplete: "off",
									required: true
								})]
							}),
							/* @__PURE__ */ jsxs("div", {
								className: "grid gap-1",
								children: [/* @__PURE__ */ jsx(Label, {
									htmlFor: "sql-password",
									children: t("Password")
								}), /* @__PURE__ */ jsx(Input, {
									id: "sql-password",
									type: "password",
									value: form.data.password,
									onChange: (e) => form.setData("password", e.target.value),
									autoComplete: "new-password",
									placeholder: "••••••••"
								})]
							})
						]
					}),
					/* @__PURE__ */ jsxs("div", {
						className: "grid gap-1",
						children: [
							/* @__PURE__ */ jsx(Label, {
								htmlFor: "sql-query",
								children: t("SELECT query")
							}),
							/* @__PURE__ */ jsx(Textarea, {
								id: "sql-query",
								value: form.data.query,
								onChange: (e) => form.setData("query", e.target.value),
								rows: 4,
								spellCheck: false,
								placeholder: "SELECT id, title, body FROM articles WHERE published = 1",
								className: "font-mono text-xs",
								required: true
							}),
							/* @__PURE__ */ jsx("p", {
								className: "text-xs text-muted-foreground",
								children: t("Read-only. Must start with SELECT. Max 5,000 rows per sync. Run under a READ ONLY transaction.")
							})
						]
					}),
					/* @__PURE__ */ jsxs("div", {
						className: "grid gap-3 sm:grid-cols-3",
						children: [
							/* @__PURE__ */ jsxs("div", {
								className: "grid gap-1",
								children: [/* @__PURE__ */ jsx(Label, {
									htmlFor: "sql-title",
									children: t("Source label (optional)")
								}), /* @__PURE__ */ jsx(Input, {
									id: "sql-title",
									value: form.data.title,
									onChange: (e) => form.setData("title", e.target.value),
									placeholder: t("Production CRM tickets")
								})]
							}),
							/* @__PURE__ */ jsxs("div", {
								className: "grid gap-1",
								children: [/* @__PURE__ */ jsx(Label, {
									htmlFor: "sql-title-column",
									children: t("Title column (optional)")
								}), /* @__PURE__ */ jsx(Input, {
									id: "sql-title-column",
									value: form.data.title_column,
									onChange: (e) => form.setData("title_column", e.target.value),
									placeholder: "title"
								})]
							}),
							/* @__PURE__ */ jsxs("div", {
								className: "grid gap-1",
								children: [/* @__PURE__ */ jsx(Label, {
									htmlFor: "sql-body-column",
									children: t("Body column (optional)")
								}), /* @__PURE__ */ jsx(Input, {
									id: "sql-body-column",
									value: form.data.body_column,
									onChange: (e) => form.setData("body_column", e.target.value),
									placeholder: "body"
								})]
							})
						]
					}),
					Object.entries(form.errors).map(([field, msg]) => /* @__PURE__ */ jsxs("p", {
						className: "text-xs text-rose-600",
						children: [
							field,
							": ",
							String(msg)
						]
					}, field)),
					/* @__PURE__ */ jsx(Button, {
						type: "submit",
						disabled: form.processing,
						children: t("Connect & sync")
					})
				]
			})
		]
	});
}
function Sources({ agent, sources, pagination, filters, integrations }) {
	const { t, tChoice } = useT();
	const confirm = useConfirm();
	const alert = useAlert();
	const form = useForm({
		type: "url",
		url: ""
	});
	const textForm = useForm({
		title: "",
		body: "",
		source_url: ""
	});
	const editTextForm = useForm({
		title: "",
		body: "",
		source_url: ""
	});
	const [editingTextId, setEditingTextId] = useState(null);
	const openTextEdit = (source) => {
		editTextForm.setData({
			title: source.config?.title ?? "",
			body: source.config?.body ?? "",
			source_url: source.config?.source_url ?? ""
		});
		editTextForm.clearErrors();
		setEditingTextId(source.id);
	};
	const fileInputRef = useRef(null);
	const [activeTab, setActiveTab] = useState(typeof window !== "undefined" && [
		"web",
		"database",
		"paste",
		"sheets",
		"google_doc",
		"notion",
		"files"
	].includes(window.location.hash.slice(1)) ? window.location.hash.slice(1) : "web");
	const switchTab = (key) => {
		setActiveTab(key);
		if (typeof window !== "undefined") {
			const url = new URL(window.location.href);
			url.hash = key;
			window.history.replaceState(null, "", url.toString());
		}
	};
	const [files, setFiles] = useState([]);
	const [uploading, setUploading] = useState(false);
	const [uploadError, setUploadError] = useState(null);
	const [dragOver, setDragOver] = useState(false);
	const [preview, setPreview] = useState(null);
	const [previewLoading, setPreviewLoading] = useState(null);
	const [refreshing, setRefreshing] = useState(false);
	const [sheetUrl, setSheetUrl] = useState("");
	const [sheetTabs, setSheetTabs] = useState(null);
	const [sheetTitle, setSheetTitle] = useState("");
	const [chosenTab, setChosenTab] = useState("");
	const [sheetError, setSheetError] = useState(null);
	const [sheetLoading, setSheetLoading] = useState(false);
	const [sheetSubmitting, setSheetSubmitting] = useState(false);
	const probeSheet = async () => {
		if (sheetUrl.trim() === "" || sheetLoading) return;
		setSheetLoading(true);
		setSheetError(null);
		setSheetTabs(null);
		setChosenTab("");
		try {
			const xsrfCookie = document.cookie.split(";").map((c) => c.trim()).find((c) => c.startsWith("XSRF-TOKEN="))?.slice(11) ?? "";
			const xsrf = xsrfCookie === "" ? "" : decodeURIComponent(xsrfCookie);
			const body = await (await fetch(`/app/agents/${agent.id}/sources/google-sheet/metadata`, {
				method: "POST",
				credentials: "same-origin",
				headers: {
					"Content-Type": "application/json",
					Accept: "application/json",
					"X-Requested-With": "XMLHttpRequest",
					"X-XSRF-TOKEN": xsrf
				},
				body: JSON.stringify({ spreadsheet: sheetUrl })
			})).json();
			if (body.ok === true) {
				setSheetTabs(body.sheets);
				setSheetTitle(body.title);
				setChosenTab(body.sheets[0]?.title ?? "");
			} else setSheetError(body.error);
		} catch (err) {
			setSheetError(err instanceof Error ? err.message : "Probe failed.");
		} finally {
			setSheetLoading(false);
		}
	};
	const submitSheet = (e) => {
		e.preventDefault();
		if (chosenTab === "" || sheetUrl.trim() === "" || sheetSubmitting) return;
		setSheetSubmitting(true);
		setSheetError(null);
		router.post(`/app/agents/${agent.id}/sources/google-sheet`, {
			spreadsheet: sheetUrl,
			sheet_title: chosenTab
		}, {
			preserveScroll: true,
			onFinish: () => setSheetSubmitting(false),
			onError: (errs) => {
				setSheetError((typeof errs.spreadsheet === "string" ? errs.spreadsheet : typeof errs.sheet_title === "string" ? errs.sheet_title : null) ?? t("Could not add this Google Sheet."));
			},
			onSuccess: () => {
				setSheetUrl("");
				setSheetTabs(null);
				setSheetTitle("");
				setChosenTab("");
				setSheetError(null);
			}
		});
	};
	const [googleDocUrl, setGoogleDocUrl] = useState("");
	const [googleDocSubmitting, setGoogleDocSubmitting] = useState(false);
	const [googleDocError, setGoogleDocError] = useState(null);
	const submitGoogleDoc = (e) => {
		e.preventDefault();
		if (googleDocUrl.trim() === "" || googleDocSubmitting) return;
		setGoogleDocSubmitting(true);
		setGoogleDocError(null);
		router.post(`/app/agents/${agent.id}/sources/google-doc`, { doc: googleDocUrl }, {
			preserveScroll: true,
			onFinish: () => setGoogleDocSubmitting(false),
			onError: (errs) => {
				setGoogleDocError(typeof errs.doc === "string" ? errs.doc : t("Could not add this Google Doc."));
			},
			onSuccess: () => {
				setGoogleDocUrl("");
			}
		});
	};
	const [notionUrl, setNotionUrl] = useState("");
	const [notionSubmitting, setNotionSubmitting] = useState(false);
	const [notionError, setNotionError] = useState(null);
	const submitNotion = (e) => {
		e.preventDefault();
		if (notionUrl.trim() === "" || notionSubmitting) return;
		setNotionSubmitting(true);
		setNotionError(null);
		router.post(`/app/agents/${agent.id}/sources/notion`, { page: notionUrl }, {
			preserveScroll: true,
			onFinish: () => setNotionSubmitting(false),
			onError: (errs) => {
				setNotionError(typeof errs.page === "string" ? errs.page : t("Could not add this Notion page."));
			},
			onSuccess: () => {
				setNotionUrl("");
			}
		});
	};
	const refreshSources = () => {
		setRefreshing(true);
		router.reload({
			only: ["sources"],
			onFinish: () => setRefreshing(false)
		});
	};
	const openPreview = async (sourceId) => {
		setPreviewLoading(sourceId);
		try {
			const response = await fetch(`/app/sources/${sourceId}/preview`, {
				credentials: "same-origin",
				headers: {
					Accept: "application/json",
					"X-Requested-With": "XMLHttpRequest"
				}
			});
			if (!response.ok) throw new Error(`HTTP ${response.status}`);
			setPreview((await response.json()).data);
		} catch (e) {
			await alert({ message: e instanceof Error ? e.message : t("Preview failed.") });
		} finally {
			setPreviewLoading(null);
		}
	};
	useEffect(() => {
		if (preview === null) return;
		const onKey = (e) => {
			if (e.key === "Escape") setPreview(null);
		};
		document.addEventListener("keydown", onKey);
		const prevOverflow = document.body.style.overflow;
		document.body.style.overflow = "hidden";
		return () => {
			document.removeEventListener("keydown", onKey);
			document.body.style.overflow = prevOverflow;
		};
	}, [preview]);
	const submitFiles = async () => {
		if (files.length === 0) return;
		setUploading(true);
		setUploadError(null);
		const fd = new FormData();
		for (const f of files) fd.append("files[]", f);
		fd.append("_token", document.querySelector("meta[name=\"csrf-token\"]")?.content ?? "");
		try {
			const response = await fetch(`/app/agents/${agent.id}/uploads`, {
				method: "POST",
				body: fd,
				credentials: "same-origin",
				headers: {
					"X-Requested-With": "XMLHttpRequest",
					"X-CSRF-TOKEN": document.querySelector("meta[name=\"csrf-token\"]")?.content ?? "",
					Accept: "application/json"
				}
			});
			if (!response.ok) {
				const text = await response.text();
				throw new Error(text || `HTTP ${response.status}`);
			}
			setFiles([]);
			if (fileInputRef.current) fileInputRef.current.value = "";
			router.reload({ only: ["sources"] });
		} catch (e) {
			setUploadError(e instanceof Error ? e.message : t("Upload failed."));
		} finally {
			setUploading(false);
		}
	};
	return /* @__PURE__ */ jsxs(AppLayout, {
		breadcrumbs: [
			{
				title: t("Agents"),
				href: index$12.url()
			},
			{
				title: agent.name,
				href: show$4({ agent: agent.id }).url
			},
			{
				title: t("Sources"),
				href: index$15({ agent: agent.id }).url
			}
		],
		children: [/* @__PURE__ */ jsx(Head, { title: `${agent.name} · sources` }), /* @__PURE__ */ jsxs("div", {
			className: "flex flex-1 flex-col gap-4 p-4",
			children: [
				/* @__PURE__ */ jsx("h1", {
					className: "text-2xl font-semibold tracking-tight",
					children: t("Knowledge sources")
				}),
				/* @__PURE__ */ jsx(PlanLimitBanner, { resource: "source" }),
				/* @__PURE__ */ jsx("div", {
					className: "flex gap-1 overflow-x-auto border-b",
					role: "tablist",
					"aria-label": t("Source types"),
					children: [
						{
							key: "web",
							label: t("Web page"),
							icon: Globe
						},
						{
							key: "database",
							label: t("SQL database"),
							icon: Database
						},
						{
							key: "paste",
							label: t("Paste text"),
							icon: FileText
						},
						{
							key: "sheets",
							label: t("Google Sheets"),
							icon: Sheet
						},
						{
							key: "google_doc",
							label: t("Google Docs"),
							icon: FileText
						},
						{
							key: "notion",
							label: t("Notion"),
							icon: BookOpen
						},
						{
							key: "files",
							label: t("Upload files"),
							icon: Upload
						}
					].map((tab) => {
						const Icon = tab.icon;
						const isActive = activeTab === tab.key;
						return /* @__PURE__ */ jsxs("button", {
							type: "button",
							role: "tab",
							"aria-selected": isActive,
							"aria-controls": `source-tab-${tab.key}`,
							onClick: () => switchTab(tab.key),
							className: `-mb-px flex items-center gap-2 border-b-2 px-3 py-2 text-sm whitespace-nowrap transition ${isActive ? "border-foreground font-medium text-foreground" : "border-transparent text-muted-foreground hover:text-foreground"}`,
							children: [/* @__PURE__ */ jsx(Icon, { className: "size-4" }), tab.label]
						}, tab.key);
					})
				}),
				activeTab === "web" && /* @__PURE__ */ jsxs(Card, {
					className: "border-border/80 p-5",
					children: [
						/* @__PURE__ */ jsx("h2", {
							className: "mb-1 font-medium",
							children: t("Add a page")
						}),
						/* @__PURE__ */ jsx("p", {
							className: "mb-3 text-xs text-muted-foreground",
							children: t("Paste any page from your site. We'll fetch it, extract the text, and index it for the agent.")
						}),
						/* @__PURE__ */ jsxs("form", {
							onSubmit: (e) => {
								e.preventDefault();
								form.post(`/app/agents/${agent.id}/sources`, { onSuccess: () => form.reset("url") });
							},
							className: "grid gap-3 md:grid-cols-[1fr_auto]",
							children: [/* @__PURE__ */ jsxs("div", {
								className: "grid gap-1.5",
								children: [/* @__PURE__ */ jsx(Input, {
									id: "url",
									type: "url",
									placeholder: "https://your-site.com/about",
									value: form.data.url,
									onChange: (e) => form.setData("url", e.target.value)
								}), form.errors.url && /* @__PURE__ */ jsx("p", {
									className: "mt-1 text-xs text-destructive",
									children: form.errors.url
								})]
							}), /* @__PURE__ */ jsx(Button, {
								type: "submit",
								disabled: form.processing,
								children: form.data.type === "sitemap" ? t("Add sitemap & crawl all") : t("Add & crawl")
							})]
						}),
						/* @__PURE__ */ jsxs("div", {
							className: "mt-3 grid gap-2 rounded-md border bg-muted/20 p-3",
							children: [
								/* @__PURE__ */ jsx(Label, {
									className: "text-xs",
									children: t("Source type")
								}),
								/* @__PURE__ */ jsx("div", {
									role: "radiogroup",
									"aria-label": t("Source type"),
									className: "grid gap-2 sm:grid-cols-2",
									children: [{
										value: "url",
										title: t("Single URL"),
										desc: t("Crawl just this one page.")
									}, {
										value: "sitemap",
										title: t("Sitemap"),
										desc: t("Crawl all URLs in the sitemap.xml.")
									}].map((opt) => {
										const checked = form.data.type === opt.value;
										return /* @__PURE__ */ jsxs("label", {
											className: cn("group relative flex cursor-pointer items-start gap-2.5 rounded-md border bg-background p-3 text-sm transition hover:border-primary/40", checked && "border-primary ring-1 ring-primary/30"),
											children: [/* @__PURE__ */ jsx("input", {
												type: "radio",
												name: "source-type",
												value: opt.value,
												checked,
												onChange: () => form.setData("type", opt.value),
												className: "mt-1 size-3.5 accent-primary"
											}), /* @__PURE__ */ jsxs("div", {
												className: "min-w-0",
												children: [/* @__PURE__ */ jsx("div", {
													className: "font-medium",
													children: opt.title
												}), /* @__PURE__ */ jsx("div", {
													className: "mt-0.5 text-xs text-muted-foreground",
													children: opt.desc
												})]
											})]
										}, opt.value);
									})
								}),
								/* @__PURE__ */ jsxs("p", {
									className: "text-xs text-muted-foreground",
									children: [
										t("Only switch to \"Sitemap\" if you're pasting a real"),
										" ",
										/* @__PURE__ */ jsx("code", { children: "sitemap.xml" }),
										"."
									]
								})
							]
						})
					]
				}),
				activeTab === "web" && /* @__PURE__ */ jsx(DiscoverUrlsCard, { agent }),
				activeTab === "database" && /* @__PURE__ */ jsx(SqlSourceCard, { agent }),
				activeTab === "paste" && /* @__PURE__ */ jsxs(Card, {
					className: "border-border/80 p-5",
					children: [
						/* @__PURE__ */ jsx("h2", {
							className: "mb-1 font-medium",
							children: t("Paste content directly")
						}),
						/* @__PURE__ */ jsx("p", {
							className: "mb-3 text-xs text-muted-foreground",
							children: t("When a URL won't crawl (anti-bot challenges, login walls, JS-only sites), paste the page content here. We skip fetching and index it as-is.")
						}),
						/* @__PURE__ */ jsxs("form", {
							onSubmit: (e) => {
								e.preventDefault();
								textForm.post(`/app/agents/${agent.id}/sources/text`, { onSuccess: () => {
									textForm.reset("title", "body", "source_url");
								} });
							},
							className: "grid gap-3",
							children: [
								/* @__PURE__ */ jsxs("div", {
									className: "grid gap-3 md:grid-cols-[1fr_1fr]",
									children: [/* @__PURE__ */ jsxs("div", {
										className: "grid gap-1.5",
										children: [/* @__PURE__ */ jsx(Label, {
											htmlFor: "text-title",
											children: t("Title (optional)")
										}), /* @__PURE__ */ jsx(Input, {
											id: "text-title",
											type: "text",
											placeholder: t("MacBook Air M5 — pricing & specs"),
											value: textForm.data.title,
											onChange: (e) => textForm.setData("title", e.target.value)
										})]
									}), /* @__PURE__ */ jsxs("div", {
										className: "grid gap-1.5",
										children: [/* @__PURE__ */ jsx(Label, {
											htmlFor: "text-source-url",
											children: t("Source URL (optional)")
										}), /* @__PURE__ */ jsx(Input, {
											id: "text-source-url",
											type: "url",
											placeholder: "https://...",
											value: textForm.data.source_url,
											onChange: (e) => textForm.setData("source_url", e.target.value)
										})]
									})]
								}),
								/* @__PURE__ */ jsxs("div", {
									className: "grid gap-1.5",
									children: [
										/* @__PURE__ */ jsx(Label, {
											htmlFor: "text-body",
											children: t("Content")
										}),
										/* @__PURE__ */ jsx(Textarea, {
											id: "text-body",
											rows: 6,
											placeholder: t("Paste the text content here…"),
											className: "min-h-36 resize-y",
											value: textForm.data.body,
											onChange: (e) => textForm.setData("body", e.target.value)
										}),
										textForm.errors.body && /* @__PURE__ */ jsx("p", {
											className: "mt-1 text-xs text-destructive",
											children: textForm.errors.body
										}),
										/* @__PURE__ */ jsx("p", {
											className: "mt-1 text-xs text-muted-foreground",
											children: t(":count chars · need at least 50", { count: textForm.data.body.length.toLocaleString() })
										})
									]
								}),
								/* @__PURE__ */ jsx("div", {
									className: "flex justify-end",
									children: /* @__PURE__ */ jsx(Button, {
										type: "submit",
										disabled: textForm.processing || textForm.data.body.length < 50,
										children: textForm.processing ? t("Indexing…") : t("Add as source")
									})
								})
							]
						})
					]
				}),
				activeTab === "sheets" && /* @__PURE__ */ jsxs(Card, {
					className: "border-border/80 p-5",
					children: [
						/* @__PURE__ */ jsxs("div", {
							className: "mb-1 flex items-center gap-2 font-medium",
							children: [/* @__PURE__ */ jsx(Sheet, { className: "size-4 text-emerald-700" }), /* @__PURE__ */ jsx("h2", { children: t("Google Sheets") })]
						}),
						/* @__PURE__ */ jsx("p", {
							className: "mb-3 text-xs text-muted-foreground",
							children: t("Paste a Google Sheets URL or workbook id. The first row becomes the column headers; every subsequent row is indexed as a chunk and refreshed hourly.")
						}),
						/* @__PURE__ */ jsxs("form", {
							onSubmit: submitSheet,
							className: "grid gap-3",
							children: [
								/* @__PURE__ */ jsxs("div", {
									className: "grid gap-3 md:grid-cols-[1fr_auto]",
									children: [/* @__PURE__ */ jsxs("div", {
										className: "grid gap-1.5",
										children: [/* @__PURE__ */ jsx(Label, {
											htmlFor: "sheet-url",
											children: t("Spreadsheet URL or id")
										}), /* @__PURE__ */ jsx(Input, {
											id: "sheet-url",
											type: "text",
											placeholder: "https://docs.google.com/spreadsheets/d/...",
											value: sheetUrl,
											onChange: (e) => setSheetUrl(e.target.value)
										})]
									}), /* @__PURE__ */ jsx("div", {
										className: "grid items-end",
										children: /* @__PURE__ */ jsx(Button, {
											type: "button",
											variant: "outline",
											onClick: probeSheet,
											disabled: sheetLoading || sheetUrl.trim() === "",
											children: sheetLoading ? t("Fetching tabs…") : t("Load sheets")
										})
									})]
								}),
								sheetError && /* @__PURE__ */ jsx("p", {
									className: "text-xs text-destructive",
									children: sheetError
								}),
								sheetTabs !== null && sheetTabs.length > 0 && /* @__PURE__ */ jsxs("div", {
									className: "grid gap-1.5 rounded-md border bg-muted/20 p-3",
									children: [
										/* @__PURE__ */ jsxs("p", {
											className: "text-xs text-muted-foreground",
											children: [
												t("Workbook:"),
												" ",
												/* @__PURE__ */ jsx("span", {
													className: "font-medium text-foreground",
													children: sheetTitle
												})
											]
										}),
										/* @__PURE__ */ jsx(Label, {
											htmlFor: "sheet-tab",
											className: "text-xs",
											children: t("Sheet (tab)")
										}),
										/* @__PURE__ */ jsxs(Select, {
											value: chosenTab,
											onValueChange: setChosenTab,
											children: [/* @__PURE__ */ jsx(SelectTrigger, {
												id: "sheet-tab",
												children: /* @__PURE__ */ jsx(SelectValue, {})
											}), /* @__PURE__ */ jsx(SelectContent, { children: sheetTabs.map((s) => /* @__PURE__ */ jsxs(SelectItem, {
												value: s.title,
												children: [
													s.title,
													" (",
													s.row_count,
													" ",
													"rows × ",
													s.column_count,
													" ",
													"cols)"
												]
											}, s.title)) })]
										}),
										/* @__PURE__ */ jsx("div", {
											className: "flex justify-end pt-2",
											children: /* @__PURE__ */ jsx(Button, {
												type: "submit",
												disabled: chosenTab === "" || sheetSubmitting,
												children: sheetSubmitting ? t("Indexing…") : t("Add this sheet")
											})
										})
									]
								}),
								sheetTabs !== null && sheetTabs.length === 0 && /* @__PURE__ */ jsx("p", {
									className: "text-xs text-muted-foreground",
									children: t("This workbook has no readable sheets.")
								})
							]
						})
					]
				}),
				activeTab === "google_doc" && /* @__PURE__ */ jsxs(Card, {
					className: "border-border/80 p-5",
					children: [
						/* @__PURE__ */ jsxs("div", {
							className: "mb-1 flex items-center gap-2 font-medium",
							children: [/* @__PURE__ */ jsx(FileText, { className: "size-4 text-blue-600" }), /* @__PURE__ */ jsx("h2", { children: t("Google Docs") })]
						}),
						/* @__PURE__ */ jsx("p", {
							className: "mb-3 text-xs text-muted-foreground",
							children: t("Paste a Google Doc URL or file id. The document is ingested via the workspace Google Drive connection.")
						}),
						integrations && !integrations.google && /* @__PURE__ */ jsxs("div", {
							className: "mb-3 rounded-md border border-amber-500/30 bg-amber-500/10 p-3 text-xs",
							children: [
								t("Google Drive is not connected for this workspace yet."),
								" ",
								/* @__PURE__ */ jsx(Link, {
									href: "/app/integrations",
									className: "font-medium underline",
									children: t("Connect it in Integrations")
								}),
								" ",
								t("first.")
							]
						}),
						/* @__PURE__ */ jsxs("form", {
							onSubmit: submitGoogleDoc,
							className: "grid gap-3 md:grid-cols-[1fr_auto]",
							children: [/* @__PURE__ */ jsxs("div", {
								className: "grid gap-1.5",
								children: [
									/* @__PURE__ */ jsx(Label, {
										htmlFor: "google-doc-url",
										children: t("Google Doc URL or id")
									}),
									/* @__PURE__ */ jsx(Input, {
										id: "google-doc-url",
										type: "text",
										placeholder: "https://docs.google.com/document/d/...",
										value: googleDocUrl,
										onChange: (e) => setGoogleDocUrl(e.target.value),
										disabled: integrations !== void 0 && !integrations.google
									}),
									googleDocError && /* @__PURE__ */ jsx("p", {
										className: "text-xs text-destructive",
										children: googleDocError
									})
								]
							}), /* @__PURE__ */ jsx("div", {
								className: "grid items-end",
								children: /* @__PURE__ */ jsx(Button, {
									type: "submit",
									disabled: googleDocSubmitting || googleDocUrl.trim() === "" || integrations !== void 0 && !integrations.google,
									children: googleDocSubmitting ? t("Queuing…") : t("Add Google Doc")
								})
							})]
						})
					]
				}),
				activeTab === "notion" && /* @__PURE__ */ jsxs(Card, {
					className: "border-border/80 p-5",
					children: [
						/* @__PURE__ */ jsxs("div", {
							className: "mb-1 flex items-center gap-2 font-medium",
							children: [/* @__PURE__ */ jsx(BookOpen, { className: "size-4 text-zinc-700 dark:text-zinc-300" }), /* @__PURE__ */ jsx("h2", { children: t("Notion") })]
						}),
						/* @__PURE__ */ jsx("p", {
							className: "mb-3 text-xs text-muted-foreground",
							children: t("Paste a Notion page URL or page id. The page is ingested via the workspace Notion connection.")
						}),
						integrations && !integrations.notion && /* @__PURE__ */ jsxs("div", {
							className: "mb-3 rounded-md border border-amber-500/30 bg-amber-500/10 p-3 text-xs",
							children: [
								t("Notion is not connected for this workspace yet."),
								" ",
								/* @__PURE__ */ jsx(Link, {
									href: "/app/integrations",
									className: "font-medium underline",
									children: t("Connect it in Integrations")
								}),
								" ",
								t("first.")
							]
						}),
						/* @__PURE__ */ jsxs("form", {
							onSubmit: submitNotion,
							className: "grid gap-3 md:grid-cols-[1fr_auto]",
							children: [/* @__PURE__ */ jsxs("div", {
								className: "grid gap-1.5",
								children: [
									/* @__PURE__ */ jsx(Label, {
										htmlFor: "notion-url",
										children: t("Notion page URL or id")
									}),
									/* @__PURE__ */ jsx(Input, {
										id: "notion-url",
										type: "text",
										placeholder: "https://www.notion.so/Workspace/Page-...",
										value: notionUrl,
										onChange: (e) => setNotionUrl(e.target.value),
										disabled: integrations !== void 0 && !integrations.notion
									}),
									notionError && /* @__PURE__ */ jsx("p", {
										className: "text-xs text-destructive",
										children: notionError
									})
								]
							}), /* @__PURE__ */ jsx("div", {
								className: "grid items-end",
								children: /* @__PURE__ */ jsx(Button, {
									type: "submit",
									disabled: notionSubmitting || notionUrl.trim() === "" || integrations !== void 0 && !integrations.notion,
									children: notionSubmitting ? t("Queuing…") : t("Add Notion page")
								})
							})]
						})
					]
				}),
				activeTab === "files" && /* @__PURE__ */ jsxs(Card, {
					className: "border-border/80 p-5",
					children: [
						/* @__PURE__ */ jsx("h2", {
							className: "mb-3 font-medium",
							children: t("Upload files")
						}),
						/* @__PURE__ */ jsx("p", {
							className: "mb-3 text-xs text-muted-foreground",
							children: t("PDF, DOCX, XLSX, CSV, TXT, MD. Max 10 files, 50\xA0MB each. Spreadsheet parsing requires Cloudflare Workers AI.")
						}),
						/* @__PURE__ */ jsxs("div", {
							onDragOver: (e) => {
								e.preventDefault();
								setDragOver(true);
							},
							onDragLeave: () => setDragOver(false),
							onDrop: (e) => {
								e.preventDefault();
								setDragOver(false);
								const dropped = Array.from(e.dataTransfer?.files ?? []).slice(0, 10);
								setFiles((prev) => [...prev, ...dropped].slice(0, 10));
							},
							onClick: () => fileInputRef.current?.click(),
							className: `flex cursor-pointer flex-col items-center justify-center gap-2 rounded-lg border-2 border-dashed p-8 text-center text-sm transition ${dragOver ? "border-foreground/50 bg-muted/70" : "border-muted-foreground/25 bg-muted/20 hover:bg-muted/35"}`,
							children: [
								/* @__PURE__ */ jsx(Upload, { className: "size-5 text-muted-foreground" }),
								/* @__PURE__ */ jsx("p", {
									className: "text-muted-foreground",
									children: files.length > 0 ? tChoice(":count file selected — drop more or click|:count files selected — drop more or click", files.length, { count: files.length }) : t("Drop files here or click to browse")
								}),
								/* @__PURE__ */ jsx("input", {
									ref: fileInputRef,
									type: "file",
									multiple: true,
									accept: ".pdf,.docx,.doc,.xlsx,.xls,.ods,.odt,.csv,.txt,.md,.markdown",
									className: "hidden",
									onChange: (e) => {
										const picked = Array.from(e.currentTarget.files ?? []).slice(0, 10);
										setFiles((prev) => [...prev, ...picked].slice(0, 10));
									}
								})
							]
						}),
						files.length > 0 && /* @__PURE__ */ jsx("ul", {
							className: "mt-3 divide-y rounded-md border text-sm",
							children: files.map((f, i) => /* @__PURE__ */ jsxs("li", {
								className: "flex items-center justify-between px-3 py-2",
								children: [/* @__PURE__ */ jsx("span", {
									className: "truncate",
									children: f.name
								}), /* @__PURE__ */ jsxs("span", {
									className: "ms-2 shrink-0 text-xs text-muted-foreground",
									children: [(f.size / 1024).toFixed(1), " KB"]
								})]
							}, i))
						}),
						uploadError && /* @__PURE__ */ jsx("p", {
							className: "mt-2 text-xs text-destructive",
							children: uploadError
						}),
						/* @__PURE__ */ jsxs("div", {
							className: "mt-3 flex gap-2",
							children: [/* @__PURE__ */ jsx(Button, {
								type: "button",
								disabled: files.length === 0 || uploading,
								onClick: submitFiles,
								children: uploading ? t("Uploading…") : tChoice("Upload :count file|Upload :count files", files.length, { count: files.length })
							}), files.length > 0 && /* @__PURE__ */ jsx(Button, {
								type: "button",
								variant: "outline",
								onClick: () => setFiles([]),
								disabled: uploading,
								children: t("Clear")
							})]
						})
					]
				}),
				/* @__PURE__ */ jsxs(Card, {
					className: "p-4",
					children: [
						/* @__PURE__ */ jsxs("div", {
							className: "mb-3 flex items-center justify-between gap-2",
							children: [/* @__PURE__ */ jsxs("div", {
								className: "flex items-center gap-3",
								children: [/* @__PURE__ */ jsx("h2", {
									className: "font-medium",
									children: t("Existing sources (:total)", { total: pagination.total })
								}), /* @__PURE__ */ jsx(TableSearch, {
									placeholder: t("Search sources…"),
									initialValue: filters.q,
									only: [
										"sources",
										"pagination",
										"filters"
									]
								})]
							}), /* @__PURE__ */ jsxs(Button, {
								variant: "outline",
								size: "sm",
								onClick: refreshSources,
								disabled: refreshing,
								title: t("Re-fetch the latest status (after a crawl finishes)"),
								children: [/* @__PURE__ */ jsx(RefreshCw, { className: `size-4 ${refreshing ? "animate-spin" : ""}` }), refreshing ? t("Refreshing…") : t("Refresh")]
							})]
						}),
						sources.length === 0 ? /* @__PURE__ */ jsx("p", {
							className: "text-sm text-muted-foreground",
							children: t("None yet — add a URL above.")
						}) : /* @__PURE__ */ jsx("div", {
							className: "divide-y",
							children: sources.map((source) => /* @__PURE__ */ jsxs("div", {
								className: "flex items-center justify-between gap-3 py-3",
								children: [
									/* @__PURE__ */ jsxs("div", {
										className: "min-w-0 flex-1",
										children: [source.display.link ? /* @__PURE__ */ jsx("a", {
											href: source.display.link,
											target: "_blank",
											rel: "noopener noreferrer",
											className: "block truncate text-sm font-medium hover:underline",
											children: source.display.title
										}) : /* @__PURE__ */ jsx("p", {
											className: "truncate text-sm font-medium",
											children: source.display.title
										}), /* @__PURE__ */ jsxs("p", {
											className: "mt-0.5 text-xs text-muted-foreground",
											children: [
												source.is_global && /* @__PURE__ */ jsxs("span", {
													className: "mr-1.5 inline-flex items-center gap-1 rounded bg-primary/10 px-1.5 py-0.5 font-medium text-primary",
													children: [/* @__PURE__ */ jsx(Globe, { className: "size-3" }), t("Every page")]
												}),
												source.display.subtitle,
												" ·",
												" ",
												source.last_synced_at ? t("synced :date", { date: new Date(source.last_synced_at).toLocaleString() }) : t("never synced"),
												source.progress.pages_indexed > 0 && /* @__PURE__ */ jsxs(Fragment$1, { children: [
													" ",
													"·",
													" ",
													tChoice(":indexed page|:indexed pages", source.progress.pages_indexed, { indexed: source.progress.pages_total ? `${source.progress.pages_indexed} / ${source.progress.pages_total}` : source.progress.pages_indexed })
												] }),
												source.error && /* @__PURE__ */ jsxs(Fragment$1, { children: [
													" ",
													"·",
													" ",
													/* @__PURE__ */ jsx("span", {
														className: "text-destructive",
														children: source.error
													})
												] })
											]
										})]
									}),
									/* @__PURE__ */ jsx("span", {
										className: `rounded px-2 py-0.5 text-xs ${STATUS_COLOR[source.status] ?? ""}`,
										children: t(source.status)
									}),
									/* @__PURE__ */ jsx(Button, {
										variant: source.is_global ? "default" : "outline",
										size: "sm",
										"aria-pressed": source.is_global,
										"aria-label": t("Answer on every page"),
										onClick: () => router.patch(`/app/sources/${source.id}/global`, { is_global: !source.is_global }, { preserveScroll: true }),
										title: source.is_global ? t("Answers on every page — contact, address and opening-hours facts stay reachable from any page. Click to turn off.") : t("Answer on every page — best for contact details, address and opening hours, so visitors get them no matter which page they are on."),
										children: /* @__PURE__ */ jsx(Globe, { className: "size-4" })
									}),
									/* @__PURE__ */ jsx(Button, {
										variant: "outline",
										size: "sm",
										onClick: () => openPreview(source.id),
										disabled: previewLoading === source.id,
										title: t("Preview what was extracted"),
										children: /* @__PURE__ */ jsx(Eye, { className: "size-4" })
									}),
									source.type === "text" && /* @__PURE__ */ jsx(Button, {
										variant: "outline",
										size: "sm",
										onClick: () => openTextEdit(source),
										title: t("Edit pasted content"),
										children: /* @__PURE__ */ jsx(Pencil, { className: "size-4" })
									}),
									/* @__PURE__ */ jsx(Button, {
										variant: "outline",
										size: "sm",
										onClick: () => router.post(`/app/sources/${source.id}/reindex`),
										children: t("Reindex")
									}),
									/* @__PURE__ */ jsx(Button, {
										variant: "ghost",
										size: "sm",
										onClick: async () => {
											if (!await confirm({
												title: t("Delete source?"),
												message: t("Delete this source?"),
												confirmLabel: t("Delete"),
												danger: true
											})) return;
											router.delete(destroy$5.url({ source: source.id }), {
												preserveScroll: true,
												onError: (errors) => {
													const message = Object.values(errors)[0] ?? t("Could not delete source. Try again.");
													alert({
														title: t("Delete failed"),
														message: String(message),
														confirmLabel: t("OK")
													});
												},
												onSuccess: () => {
													router.reload({ only: [
														"sources",
														"pagination",
														"filters"
													] });
												}
											});
										},
										children: /* @__PURE__ */ jsx(Trash2, { className: "size-4" })
									})
								]
							}, source.id))
						}),
						/* @__PURE__ */ jsx(TablePagination, {
							pagination,
							only: [
								"sources",
								"pagination",
								"filters"
							]
						})
					]
				}),
				preview !== null && /* @__PURE__ */ jsx("div", {
					className: "fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4",
					onClick: () => setPreview(null),
					children: /* @__PURE__ */ jsxs("div", {
						className: "max-h-[80vh] w-full max-w-3xl overflow-y-auto rounded-lg border bg-background p-6 shadow-lg",
						onClick: (e) => e.stopPropagation(),
						children: [
							/* @__PURE__ */ jsxs("div", {
								className: "mb-4 flex items-center justify-between",
								children: [/* @__PURE__ */ jsx("h3", {
									className: "text-lg font-semibold",
									children: t("What the AI sees for this source")
								}), /* @__PURE__ */ jsx("button", {
									type: "button",
									onClick: () => setPreview(null),
									className: "text-sm text-muted-foreground hover:text-foreground",
									children: t("Close")
								})]
							}),
							/* @__PURE__ */ jsxs("p", {
								className: "mb-4 text-xs text-muted-foreground",
								children: [
									t("Status"),
									" ",
									/* @__PURE__ */ jsx("span", {
										className: "font-medium",
										children: t(preview.source.status)
									}),
									" ",
									"·",
									" ",
									tChoice(":indexed page indexed|:indexed pages indexed", preview.progress.pages_indexed, { indexed: preview.progress.pages_total ? `${preview.progress.pages_indexed} / ${preview.progress.pages_total}` : preview.progress.pages_indexed }),
									preview.source.error && /* @__PURE__ */ jsxs(Fragment$1, { children: [
										" ",
										"·",
										" ",
										/* @__PURE__ */ jsx("span", {
											className: "text-destructive",
											children: preview.source.error
										})
									] })
								]
							}),
							preview.documents.length === 0 ? /* @__PURE__ */ jsx("p", {
								className: "text-sm text-muted-foreground",
								children: t("No content extracted yet. Try Reindex, or check the error message above.")
							}) : /* @__PURE__ */ jsx("div", {
								className: "space-y-4",
								children: preview.documents.map((doc) => /* @__PURE__ */ jsxs("div", {
									className: "rounded border p-3",
									children: [
										/* @__PURE__ */ jsx("p", {
											className: "truncate text-sm font-medium",
											children: doc.title ?? t("(no title)")
										}),
										/* @__PURE__ */ jsx("p", {
											className: "mt-0.5 truncate text-xs text-muted-foreground",
											children: doc.url ?? ""
										}),
										/* @__PURE__ */ jsxs("p", {
											className: "mt-1 text-xs text-muted-foreground",
											children: [
												tChoice(":count chunk|:count chunks", doc.chunks_count, { count: doc.chunks_count }),
												doc.chunks.length < doc.chunks_count && /* @__PURE__ */ jsxs(Fragment$1, { children: [
													" ",
													"·",
													" ",
													t("showing first :count", { count: doc.chunks.length })
												] }),
												doc.fetched_at && /* @__PURE__ */ jsxs(Fragment$1, { children: [
													" ",
													"·",
													" ",
													t("fetched :date", { date: new Date(doc.fetched_at).toLocaleString() })
												] })
											]
										}),
										doc.chunks.length === 0 ? /* @__PURE__ */ jsx("pre", {
											className: "mt-2 rounded bg-muted p-2 text-xs",
											children: t("(empty)")
										}) : /* @__PURE__ */ jsxs("details", {
											className: "mt-2",
											open: true,
											children: [/* @__PURE__ */ jsx("summary", {
												className: "cursor-pointer text-xs text-muted-foreground hover:text-foreground",
												children: t("View chunks")
											}), /* @__PURE__ */ jsx("div", {
												className: "mt-2 max-h-72 space-y-2 overflow-y-auto",
												children: doc.chunks.map((c) => /* @__PURE__ */ jsxs("div", {
													className: "rounded border bg-muted/40 p-2 text-xs",
													children: [
														/* @__PURE__ */ jsx("p", {
															className: "mb-1 text-[10px] tracking-wide text-muted-foreground uppercase",
															children: t("chunk :ord · :tokens tokens", {
																ord: c.ord,
																tokens: c.tokens
															})
														}),
														/* @__PURE__ */ jsx("pre", {
															className: "leading-snug whitespace-pre-wrap",
															children: c.text
														}),
														c.chars > c.text.length && /* @__PURE__ */ jsx("p", {
															className: "mt-1 text-[10px] text-muted-foreground/60 italic",
															children: t("+:count more characters (trimmed for display only — all of it is indexed)", { count: c.chars - c.text.length })
														})
													]
												}, c.id))
											})]
										})
									]
								}, doc.id))
							})
						]
					})
				}),
				editingTextId !== null && /* @__PURE__ */ jsx("div", {
					className: "fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4",
					onClick: () => setEditingTextId(null),
					children: /* @__PURE__ */ jsxs("form", {
						className: "max-h-[85vh] w-full max-w-2xl overflow-y-auto rounded-lg border bg-background p-6 shadow-lg",
						onClick: (e) => e.stopPropagation(),
						onSubmit: (e) => {
							e.preventDefault();
							editTextForm.patch(`/app/sources/${editingTextId}/text`, {
								preserveScroll: true,
								onSuccess: () => setEditingTextId(null)
							});
						},
						children: [/* @__PURE__ */ jsxs("div", {
							className: "mb-4 flex items-center justify-between",
							children: [/* @__PURE__ */ jsx("h3", {
								className: "text-lg font-semibold",
								children: t("Edit pasted content")
							}), /* @__PURE__ */ jsx("button", {
								type: "button",
								onClick: () => setEditingTextId(null),
								className: "text-sm text-muted-foreground hover:text-foreground",
								children: t("Close")
							})]
						}), /* @__PURE__ */ jsxs("div", {
							className: "grid gap-3",
							children: [
								/* @__PURE__ */ jsxs("div", {
									className: "grid gap-1.5",
									children: [/* @__PURE__ */ jsx(Label, {
										htmlFor: "edit-text-title",
										children: t("Title (optional)")
									}), /* @__PURE__ */ jsx(Input, {
										id: "edit-text-title",
										type: "text",
										value: editTextForm.data.title,
										onChange: (e) => editTextForm.setData("title", e.target.value)
									})]
								}),
								/* @__PURE__ */ jsxs("div", {
									className: "grid gap-1.5",
									children: [/* @__PURE__ */ jsx(Label, {
										htmlFor: "edit-text-source-url",
										children: t("Source URL (optional)")
									}), /* @__PURE__ */ jsx(Input, {
										id: "edit-text-source-url",
										type: "url",
										placeholder: "https://...",
										value: editTextForm.data.source_url,
										onChange: (e) => editTextForm.setData("source_url", e.target.value)
									})]
								}),
								/* @__PURE__ */ jsxs("div", {
									className: "grid gap-1.5",
									children: [
										/* @__PURE__ */ jsx(Label, {
											htmlFor: "edit-text-body",
											children: t("Content")
										}),
										/* @__PURE__ */ jsx(Textarea, {
											id: "edit-text-body",
											rows: 10,
											className: "min-h-48 resize-y",
											value: editTextForm.data.body,
											onChange: (e) => editTextForm.setData("body", e.target.value)
										}),
										editTextForm.errors.body && /* @__PURE__ */ jsx("p", {
											className: "mt-1 text-xs text-destructive",
											children: editTextForm.errors.body
										}),
										/* @__PURE__ */ jsx("p", {
											className: "mt-1 text-xs text-muted-foreground",
											children: t(":count chars · need at least 50", { count: editTextForm.data.body.length.toLocaleString() })
										})
									]
								}),
								/* @__PURE__ */ jsxs("div", {
									className: "flex justify-end gap-2",
									children: [/* @__PURE__ */ jsx(Button, {
										type: "button",
										variant: "outline",
										onClick: () => setEditingTextId(null),
										children: t("Cancel")
									}), /* @__PURE__ */ jsx(Button, {
										type: "submit",
										disabled: editTextForm.processing,
										children: t("Save & re-index")
									})]
								})
							]
						})]
					})
				})
			]
		})]
	});
}
//#endregion
//#region resources/js/components/agents/vertical-confidence-pill.tsx
var STYLES = {
	high: "bg-emerald-50 text-emerald-700 border-emerald-200",
	likely: "bg-amber-50 text-amber-700 border-amber-200",
	guess: "bg-slate-100 text-slate-600 border-slate-200"
};
function VerticalConfidencePill({ score, className }) {
	const { t } = useT();
	const bucket = confidenceBucket(score);
	return /* @__PURE__ */ jsxs("span", {
		className: cn("inline-flex items-center rounded-full border px-2 py-0.5 text-[11px] font-medium", STYLES[bucket], className),
		children: [
			t(CONFIDENCE_LABEL[bucket]),
			" · ",
			Math.round(score * 100),
			"%"
		]
	});
}
//#endregion
//#region resources/js/components/agents/vertical-overwrite-dialog.tsx
/**
* Confirmation dialog before destructively overwriting an admin's
* customized starter prompts / launcher label / max_chars with a
* preset's defaults. Non-destructive applies skip this.
*/
function VerticalOverwriteDialog({ open, onOpenChange, targetVertical, onConfirm, pending = false }) {
	const { t } = useT();
	return /* @__PURE__ */ jsx(Dialog, {
		open,
		onOpenChange,
		children: /* @__PURE__ */ jsxs(DialogContent, { children: [/* @__PURE__ */ jsxs(DialogHeader, { children: [/* @__PURE__ */ jsx(DialogTitle, { children: t("Apply the :name preset?", { name: (targetVertical ? VERTICAL_BY_ID[targetVertical] : null)?.name ?? t("this") }) }), /* @__PURE__ */ jsx(DialogDescription, { children: t("This will replace your current starter prompts, launcher label, and reply length with the preset's defaults. Theme, name, language, and your custom system prompt are not affected.") })] }), /* @__PURE__ */ jsxs(DialogFooter, { children: [/* @__PURE__ */ jsx(Button, {
			variant: "outline",
			onClick: () => onOpenChange(false),
			disabled: pending,
			children: t("Cancel")
		}), /* @__PURE__ */ jsx(Button, {
			onClick: onConfirm,
			disabled: pending || !targetVertical,
			children: pending ? t("Applying…") : t("Replace and apply")
		})] })] })
	});
}
//#endregion
//#region resources/js/components/ui/collapsible.tsx
function Collapsible({ ...props }) {
	return /* @__PURE__ */ jsx(CollapsiblePrimitive.Root, {
		"data-slot": "collapsible",
		...props
	});
}
function CollapsibleTrigger({ ...props }) {
	return /* @__PURE__ */ jsx(CollapsiblePrimitive.CollapsibleTrigger, {
		"data-slot": "collapsible-trigger",
		...props
	});
}
function CollapsibleContent({ ...props }) {
	return /* @__PURE__ */ jsx(CollapsiblePrimitive.CollapsibleContent, {
		"data-slot": "collapsible-content",
		...props
	});
}
//#endregion
//#region resources/js/components/agents/vertical-preset-preview.tsx
function formatCapability(cap) {
	return cap.split("_").map((p) => p[0]?.toUpperCase() + p.slice(1)).join(" ");
}
/**
* Right-pane preview of a vertical preset. The collapsible explains
* what the admin gets out of the preset — split into "merged into the
* agent" (one-time copy) and "runtime applied" (always derived from
* the preset).
*/
function VerticalPresetPreview({ preview, defaultOpen = true }) {
	const { t } = useT();
	const [open, setOpen] = useState(defaultOpen);
	const Icon = VERTICAL_BY_ID[preview.slug].icon;
	return /* @__PURE__ */ jsx(Card, { children: /* @__PURE__ */ jsx(CardContent, {
		className: "p-5",
		children: /* @__PURE__ */ jsxs(Collapsible, {
			open,
			onOpenChange: setOpen,
			children: [/* @__PURE__ */ jsxs(CollapsibleTrigger, {
				className: "flex w-full items-center justify-between gap-3 text-start",
				children: [/* @__PURE__ */ jsxs("span", {
					className: "flex items-center gap-3",
					children: [/* @__PURE__ */ jsx("span", {
						className: "inline-flex size-9 items-center justify-center rounded-md border border-border bg-muted/40",
						children: /* @__PURE__ */ jsx(Icon, { className: "size-4" })
					}), /* @__PURE__ */ jsxs("span", { children: [/* @__PURE__ */ jsx("span", {
						className: "block text-sm font-semibold",
						children: preview.label
					}), /* @__PURE__ */ jsx("span", {
						className: "block text-xs text-muted-foreground",
						children: preview.short_description
					})] })]
				}), /* @__PURE__ */ jsx(ChevronDown, { className: cn("size-4 text-muted-foreground transition-transform", open && "rotate-180") })]
			}), /* @__PURE__ */ jsxs(CollapsibleContent, {
				className: "mt-5 space-y-5",
				children: [
					/* @__PURE__ */ jsx(Legend, {}),
					/* @__PURE__ */ jsx(Section$4, {
						title: t("Suggested starter prompts"),
						kind: "merged",
						description: t("Default chips shown to visitors. You can edit these later in Customize."),
						children: preview.starter_prompts.length === 0 ? /* @__PURE__ */ jsx("p", {
							className: "text-xs text-muted-foreground",
							children: t("No starter prompts in this preset — add your own in Customize.")
						}) : /* @__PURE__ */ jsx("ul", {
							className: "flex flex-wrap gap-1.5",
							children: preview.starter_prompts.map((p, i) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx("span", {
								className: "inline-flex items-center rounded-full border border-border bg-muted/40 px-2.5 py-1 text-xs",
								children: p
							}) }, i))
						})
					}),
					/* @__PURE__ */ jsx(Section$4, {
						title: t("Capabilities"),
						kind: "runtime",
						description: t("Rich UI affordances this preset can render. Phase 1 ships the contract; Phase 3 will render them."),
						children: preview.capabilities.length === 0 ? /* @__PURE__ */ jsx("p", {
							className: "text-xs text-muted-foreground",
							children: t("No special capabilities — plain-text answers only.")
						}) : /* @__PURE__ */ jsx("div", {
							className: "flex flex-wrap gap-1.5",
							children: preview.capabilities.map((c) => /* @__PURE__ */ jsxs(Badge, {
								variant: "secondary",
								className: "opacity-60",
								title: t("Coming soon — renderer ships in Phase 3"),
								children: [
									formatCapability(c),
									" ·",
									" ",
									t("Coming soon")
								]
							}, c))
						})
					}),
					/* @__PURE__ */ jsx(Section$4, {
						title: t("System prompt addition"),
						kind: "runtime",
						description: t("Appended to the LLM system prompt at every turn. Changing the vertical instantly changes this — no stale baked text."),
						children: preview.system_prompt_fragment.trim() === "" ? /* @__PURE__ */ jsx("p", {
							className: "text-xs text-muted-foreground",
							children: t("No vertical-specific instructions for this preset.")
						}) : /* @__PURE__ */ jsx("pre", {
							className: "max-h-48 overflow-auto rounded-md border border-border bg-muted/30 p-3 text-[11px] leading-5 whitespace-pre-wrap",
							children: preview.system_prompt_fragment
						})
					})
				]
			})]
		})
	}) });
}
function Legend() {
	const { t } = useT();
	return /* @__PURE__ */ jsxs("div", {
		className: "flex flex-wrap items-center gap-3 rounded-md border border-dashed border-border bg-muted/20 px-3 py-2 text-[11px] text-muted-foreground",
		children: [/* @__PURE__ */ jsxs("span", {
			className: "flex items-center gap-1.5",
			children: [/* @__PURE__ */ jsx("span", { className: "size-1.5 rounded-full bg-emerald-500" }), t("Merged into agent")]
		}), /* @__PURE__ */ jsxs("span", {
			className: "flex items-center gap-1.5",
			children: [/* @__PURE__ */ jsx("span", { className: "size-1.5 rounded-full bg-violet-500" }), t("Runtime applied")]
		})]
	});
}
function Section$4({ title, description, kind, children }) {
	return /* @__PURE__ */ jsxs("section", { children: [/* @__PURE__ */ jsxs("header", {
		className: "mb-2",
		children: [/* @__PURE__ */ jsxs("span", {
			className: "flex items-center gap-2",
			children: [/* @__PURE__ */ jsx("span", { className: cn("size-1.5 rounded-full", kind === "merged" ? "bg-emerald-500" : "bg-violet-500") }), /* @__PURE__ */ jsx("span", {
				className: "text-xs font-semibold tracking-wide text-muted-foreground uppercase",
				children: title
			})]
		}), /* @__PURE__ */ jsx("p", {
			className: "mt-1 text-xs text-muted-foreground/80",
			children: description
		})]
	}), children] });
}
//#endregion
//#region resources/js/components/agents/vertical-radio-grid.tsx
/**
* Vertical radio-card grid. Implemented as styled native
* <input type="radio"> elements (no extra dependency) so the whole grid
* is a single labelled fieldset and works with form serialization.
*/
function VerticalRadioGrid({ value, onChange, detectedId, name = "site_type", className }) {
	const { t } = useT();
	return /* @__PURE__ */ jsx("fieldset", {
		className: cn("grid gap-2 sm:grid-cols-2", className),
		children: VERTICALS.map((v) => {
			const Icon = v.icon;
			const checked = value === v.id;
			const isDetected = detectedId === v.id;
			return /* @__PURE__ */ jsxs("label", {
				htmlFor: `vertical-${v.id}`,
				className: cn("group relative flex cursor-pointer items-start gap-3 rounded-lg border bg-background p-3 transition", "hover:border-foreground/30 hover:bg-muted/40", checked ? "border-foreground/40 bg-muted/30 ring-1 ring-foreground/15" : "border-border"),
				children: [
					/* @__PURE__ */ jsx("input", {
						id: `vertical-${v.id}`,
						type: "radio",
						name,
						value: v.id,
						checked,
						onChange: () => onChange(v.id),
						className: "sr-only"
					}),
					/* @__PURE__ */ jsx("span", {
						className: cn("mt-0.5 inline-flex size-8 shrink-0 items-center justify-center rounded-md border", checked ? "border-foreground/30 bg-foreground/5" : "border-border bg-muted/40"),
						children: /* @__PURE__ */ jsx(Icon, { className: "size-4" })
					}),
					/* @__PURE__ */ jsxs("span", {
						className: "min-w-0 flex-1",
						children: [/* @__PURE__ */ jsxs("span", {
							className: "flex items-center gap-2",
							children: [/* @__PURE__ */ jsx("span", {
								className: "text-sm font-medium",
								children: t(v.name)
							}), isDetected && /* @__PURE__ */ jsx("span", {
								className: "rounded-full bg-emerald-100 px-2 py-0.5 text-[10px] font-semibold tracking-wide text-emerald-700 uppercase",
								children: t("Detected")
							})]
						}), /* @__PURE__ */ jsx("span", {
							className: "mt-1 block text-xs text-muted-foreground",
							children: t(v.shortDesc)
						})]
					}),
					checked && /* @__PURE__ */ jsx(Check, { className: "size-4 shrink-0 text-foreground" })
				]
			}, v.id);
		})
	});
}
//#endregion
//#region resources/js/pages/app/agents/vertical.tsx
var vertical_exports = /* @__PURE__ */ __exportAll({ default: () => Vertical });
function csrf$3() {
	return document.querySelector("meta[name=\"csrf-token\"]")?.content ?? "";
}
function Vertical({ agent: initialAgent, preset_preview }) {
	const { t } = useT();
	const [agent, setAgent] = useState(initialAgent);
	const initialChosen = agent.site_type && isVerticalId(agent.site_type) ? agent.site_type : "generic";
	const [chosen, setChosen] = useState(initialChosen);
	const [redetecting, setRedetecting] = useState(false);
	const [detectError, setDetectError] = useState(null);
	const [applying, setApplying] = useState(false);
	const [overwriteOpen, setOverwriteOpen] = useState(false);
	const preview = preset_preview[chosen ?? "generic"];
	const breadcrumbs = [
		{
			title: t("Agents"),
			href: index$12.url()
		},
		{
			title: agent.name,
			href: show$4.url({ agent: agent.id })
		},
		{
			title: t("Site type"),
			href: vertical({ agent: agent.id }).url
		}
	];
	const willOverwrite = () => {
		if (chosen === agent.site_type) return false;
		const startersSet = (agent.starter_prompts ?? []).length > 0;
		const launcherSet = !!agent.theme?.launcher_label?.trim();
		const maxCharsSet = typeof agent.guardrails?.max_chars === "number";
		return startersSet || launcherSet || maxCharsSet;
	};
	const submitApply = async (force) => {
		setApplying(true);
		try {
			const res = await fetch(apply.url({ agent: agent.id }), {
				method: "POST",
				credentials: "same-origin",
				headers: {
					"Content-Type": "application/json",
					Accept: "application/json",
					"X-CSRF-TOKEN": csrf$3(),
					"X-Requested-With": "XMLHttpRequest"
				},
				body: JSON.stringify({
					site_type: chosen,
					force
				})
			});
			if (!res.ok) throw new Error(`HTTP ${res.status}`);
			setAgent((await res.json()).data);
			setOverwriteOpen(false);
			router.reload({ only: ["agent"] });
		} catch (e) {
			setDetectError(e instanceof Error ? e.message : t("Could not apply preset."));
		} finally {
			setApplying(false);
		}
	};
	const onApplyClick = () => {
		if (willOverwrite()) {
			setOverwriteOpen(true);
			return;
		}
		submitApply(false);
	};
	const onRedetect = async () => {
		const url = agent.vertical_signals?.detected_url ?? window.location.origin;
		setRedetecting(true);
		setDetectError(null);
		try {
			const res = await fetch(detect.url({ agent: agent.id }), {
				method: "POST",
				credentials: "same-origin",
				headers: {
					"Content-Type": "application/json",
					Accept: "application/json",
					"X-CSRF-TOKEN": csrf$3(),
					"X-Requested-With": "XMLHttpRequest"
				},
				body: JSON.stringify({ url })
			});
			if (!res.ok) throw new Error(`HTTP ${res.status}`);
			router.reload({ only: ["agent"] });
		} catch (e) {
			setDetectError(e instanceof Error ? e.message : t("Re-detection failed."));
		} finally {
			setRedetecting(false);
		}
	};
	const meta = VERTICAL_BY_ID[initialChosen];
	const Icon = meta.icon;
	const detectedConfidence = agent.vertical_signals?.confidence ?? null;
	const detectedAt = agent.vertical_signals?.detected_at ?? null;
	return /* @__PURE__ */ jsxs(AppLayout, {
		breadcrumbs,
		children: [
			/* @__PURE__ */ jsx(Head, { title: `${agent.name} — Site type` }),
			/* @__PURE__ */ jsxs("div", {
				className: "mx-auto flex w-full max-w-5xl flex-col gap-6 p-6",
				children: [/* @__PURE__ */ jsxs("div", {
					className: "flex items-start justify-between gap-3",
					children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("h1", {
						className: "text-2xl font-semibold tracking-tight",
						children: t("Site type")
					}), /* @__PURE__ */ jsx("p", {
						className: "mt-1 text-sm text-muted-foreground",
						children: t("The vertical preset tunes starter prompts, response style, and capabilities for the kind of site this agent lives on.")
					})] }), /* @__PURE__ */ jsxs(Button, {
						variant: "ghost",
						onClick: () => router.visit(show$4.url({ agent: agent.id })),
						children: [
							/* @__PURE__ */ jsx(ArrowLeft, { className: "size-4" }),
							" ",
							t("Back to agent")
						]
					})]
				}), /* @__PURE__ */ jsxs("div", {
					className: "grid gap-6 lg:grid-cols-[minmax(0,1fr)_420px]",
					children: [/* @__PURE__ */ jsxs(Card, { children: [/* @__PURE__ */ jsxs(CardHeader, { children: [/* @__PURE__ */ jsxs(CardTitle, {
						className: "flex items-center gap-2",
						children: [/* @__PURE__ */ jsx(Sparkles, { className: "size-4" }), t("Current vertical")]
					}), /* @__PURE__ */ jsx(CardDescription, { children: agent.site_type ? t("You can change this any time. We will not touch your custom system prompt.") : t("No preset chosen yet. Pick one to get vertical-specific defaults.") })] }), /* @__PURE__ */ jsxs(CardContent, {
						className: "space-y-5",
						children: [
							/* @__PURE__ */ jsxs("div", {
								className: "flex items-center justify-between gap-3 rounded-lg border border-border bg-muted/30 px-4 py-3",
								children: [/* @__PURE__ */ jsxs("span", {
									className: "flex items-center gap-3",
									children: [/* @__PURE__ */ jsx("span", {
										className: "inline-flex size-9 items-center justify-center rounded-md border border-border bg-background",
										children: /* @__PURE__ */ jsx(Icon, { className: "size-4" })
									}), /* @__PURE__ */ jsxs("span", { children: [/* @__PURE__ */ jsx("span", {
										className: "block text-sm font-semibold",
										children: meta.name
									}), /* @__PURE__ */ jsx("span", {
										className: "block text-xs text-muted-foreground",
										children: detectedAt ? t("Auto-detected :date", { date: new Date(detectedAt).toLocaleDateString() }) : meta.shortDesc
									})] })]
								}), typeof detectedConfidence === "number" && detectedConfidence > 0 && /* @__PURE__ */ jsx(VerticalConfidencePill, { score: detectedConfidence })]
							}),
							/* @__PURE__ */ jsxs("div", {
								className: "flex items-center justify-between",
								children: [/* @__PURE__ */ jsx(Button, {
									variant: "outline",
									onClick: onRedetect,
									disabled: redetecting,
									children: redetecting ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Loader2, { className: "size-4 animate-spin" }), t("Detecting…")] }) : /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(RefreshCcw, { className: "size-4" }), t("Re-detect")] })
								}), /* @__PURE__ */ jsx("span", {
									className: "text-xs text-muted-foreground",
									children: t("Re-detection fetches the homepage again.")
								})]
							}),
							detectError && /* @__PURE__ */ jsxs("div", {
								className: "flex items-start gap-2 rounded-md border border-amber-200 bg-amber-50 px-3 py-2 text-xs text-amber-900",
								children: [/* @__PURE__ */ jsx(TriangleAlert, { className: "mt-0.5 size-3.5 shrink-0" }), /* @__PURE__ */ jsx("span", { children: detectError })]
							}),
							/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
								className: "mb-2 text-xs font-semibold tracking-wide text-muted-foreground uppercase",
								children: t("Change vertical")
							}), /* @__PURE__ */ jsx(VerticalRadioGrid, {
								value: chosen,
								onChange: setChosen,
								detectedId: isVerticalId(agent.vertical_signals?.type) ? agent.vertical_signals?.type : null
							})] }),
							/* @__PURE__ */ jsx("div", {
								className: "flex justify-end",
								children: /* @__PURE__ */ jsx(Button, {
									onClick: onApplyClick,
									disabled: applying || chosen === agent.site_type,
									children: applying ? t("Applying…") : t("Apply preset")
								})
							})
						]
					})] }), /* @__PURE__ */ jsxs("div", {
						className: "space-y-3",
						children: [/* @__PURE__ */ jsx("p", {
							className: "text-xs font-semibold tracking-wide text-muted-foreground uppercase",
							children: t("What this preset does")
						}), preview ? /* @__PURE__ */ jsx(VerticalPresetPreview, { preview }) : null]
					})]
				})]
			}),
			/* @__PURE__ */ jsx(VerticalOverwriteDialog, {
				open: overwriteOpen,
				onOpenChange: setOverwriteOpen,
				targetVertical: chosen,
				onConfirm: () => void submitApply(true),
				pending: applying
			})
		]
	});
}
//#endregion
//#region resources/js/pages/app/analytics/content-gaps.tsx
var content_gaps_exports = /* @__PURE__ */ __exportAll({ default: () => ContentGaps });
var ANY_AGENT = "__any__";
var STATUS_STYLES$2 = {
	open: "border-amber-200 bg-amber-500/15 text-amber-800 dark:text-amber-300",
	answered: "border-emerald-200 bg-emerald-500/15 text-emerald-800 dark:text-emerald-300",
	ignored: "border-border bg-muted text-muted-foreground"
};
function ContentGaps({ gaps, agents, filters }) {
	const { t } = useT();
	const [draft, setDraft] = useState(filters);
	const agentById = new Map(agents.map((a) => [a.id, a]));
	const breadcrumbs = [{
		title: t("Analytics"),
		href: "/app/analytics"
	}, {
		title: t("Content gaps"),
		href: "/app/analytics/content-gaps"
	}];
	const apply = (overrides = {}) => {
		const merged = {
			...draft,
			...overrides
		};
		const params = {};
		Object.keys(merged).forEach((key) => {
			const v = merged[key];
			if (typeof v === "string" && v.trim() !== "") params[key] = v;
		});
		router.get("/app/analytics/content-gaps", params, {
			preserveScroll: true,
			preserveState: true
		});
	};
	const resolve = (gap, action) => {
		router.post(`/app/analytics/gaps/${gap.id}/resolve`, { action }, { preserveScroll: true });
	};
	return /* @__PURE__ */ jsxs(AppLayout, {
		breadcrumbs,
		children: [/* @__PURE__ */ jsx(Head, { title: t("Content gaps") }), /* @__PURE__ */ jsxs("div", {
			className: "flex flex-1 flex-col gap-4 p-4",
			children: [
				/* @__PURE__ */ jsxs("div", {
					className: "flex items-center gap-3",
					children: [/* @__PURE__ */ jsx(Lightbulb, { className: "h-6 w-6 text-amber-500" }), /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("h1", {
						className: "text-2xl font-semibold tracking-tight",
						children: t("Content gaps")
					}), /* @__PURE__ */ jsx("p", {
						className: "text-sm text-muted-foreground",
						children: t("Questions visitors asked that the agent couldn't answer well — your top opportunities to add curated answers or new sources.")
					})] })]
				}),
				/* @__PURE__ */ jsxs(Card, {
					className: "p-4",
					children: [/* @__PURE__ */ jsxs("div", {
						className: "grid gap-3 sm:grid-cols-3",
						children: [
							/* @__PURE__ */ jsxs("div", {
								className: "space-y-1",
								children: [/* @__PURE__ */ jsx(Label, {
									htmlFor: "gap-agent",
									children: t("Agent")
								}), /* @__PURE__ */ jsxs(Select, {
									value: draft.agent_id === "" ? ANY_AGENT : draft.agent_id,
									onValueChange: (v) => setDraft((d) => ({
										...d,
										agent_id: v === ANY_AGENT ? "" : v
									})),
									children: [/* @__PURE__ */ jsx(SelectTrigger, {
										id: "gap-agent",
										children: /* @__PURE__ */ jsx(SelectValue, { placeholder: t("Any agent") })
									}), /* @__PURE__ */ jsxs(SelectContent, { children: [/* @__PURE__ */ jsx(SelectItem, {
										value: ANY_AGENT,
										children: t("Any agent")
									}), agents.map((a) => /* @__PURE__ */ jsx(SelectItem, {
										value: a.id,
										children: a.name
									}, a.id))] })]
								})]
							}),
							/* @__PURE__ */ jsxs("div", {
								className: "space-y-1",
								children: [/* @__PURE__ */ jsx(Label, {
									htmlFor: "gap-status",
									children: t("Status")
								}), /* @__PURE__ */ jsxs(Select, {
									value: draft.status,
									onValueChange: (v) => setDraft((d) => ({
										...d,
										status: v
									})),
									children: [/* @__PURE__ */ jsx(SelectTrigger, {
										id: "gap-status",
										children: /* @__PURE__ */ jsx(SelectValue, {})
									}), /* @__PURE__ */ jsxs(SelectContent, { children: [
										/* @__PURE__ */ jsx(SelectItem, {
											value: "open",
											children: t("Open")
										}),
										/* @__PURE__ */ jsx(SelectItem, {
											value: "answered",
											children: t("Answered")
										}),
										/* @__PURE__ */ jsx(SelectItem, {
											value: "ignored",
											children: t("Ignored")
										})
									] })]
								})]
							}),
							/* @__PURE__ */ jsxs("div", {
								className: "space-y-1",
								children: [/* @__PURE__ */ jsx(Label, {
									htmlFor: "gap-window",
									children: t("Window")
								}), /* @__PURE__ */ jsxs(Select, {
									value: draft.window,
									onValueChange: (v) => setDraft((d) => ({
										...d,
										window: v
									})),
									children: [/* @__PURE__ */ jsx(SelectTrigger, {
										id: "gap-window",
										children: /* @__PURE__ */ jsx(SelectValue, {})
									}), /* @__PURE__ */ jsxs(SelectContent, { children: [
										/* @__PURE__ */ jsx(SelectItem, {
											value: "7",
											children: t("Last 7 days")
										}),
										/* @__PURE__ */ jsx(SelectItem, {
											value: "30",
											children: t("Last 30 days")
										}),
										/* @__PURE__ */ jsx(SelectItem, {
											value: "90",
											children: t("Last 90 days")
										}),
										/* @__PURE__ */ jsx(SelectItem, {
											value: "all",
											children: t("All time")
										})
									] })]
								})]
							})
						]
					}), /* @__PURE__ */ jsx("div", {
						className: "mt-4 flex justify-end",
						children: /* @__PURE__ */ jsx(Button, {
							onClick: () => apply(),
							children: t("Apply")
						})
					})]
				}),
				/* @__PURE__ */ jsx(Card, {
					className: "p-4",
					children: gaps.length === 0 ? /* @__PURE__ */ jsx("p", {
						className: "text-sm text-muted-foreground",
						children: t("No gaps match the current filters. Either visitors aren't asking unanswerable questions, or your team has already triaged them.")
					}) : /* @__PURE__ */ jsx("div", {
						className: "divide-y",
						children: gaps.map((g) => {
							const agent = agentById.get(g.agent_id);
							const curatedHref = agent ? `/app/agents/${agent.id}/curated?prefill=${encodeURIComponent(g.question)}` : null;
							return /* @__PURE__ */ jsxs("div", {
								className: "flex flex-col gap-3 py-3 sm:flex-row sm:items-center sm:justify-between",
								children: [/* @__PURE__ */ jsxs("div", {
									className: "min-w-0 flex-1",
									children: [/* @__PURE__ */ jsx("p", {
										className: "text-sm font-medium",
										children: g.question
									}), /* @__PURE__ */ jsxs("p", {
										className: "mt-0.5 text-xs text-muted-foreground",
										children: [
											agent && /* @__PURE__ */ jsx("span", {
												className: "mr-2",
												children: agent.name
											}),
											t("asked :count times", { count: g.occurrences }),
											g.last_seen_at && /* @__PURE__ */ jsxs(Fragment$1, { children: [" ", t("· last :time", { time: new Date(g.last_seen_at).toLocaleString() })] })
										]
									})]
								}), /* @__PURE__ */ jsxs("div", {
									className: "flex flex-wrap items-center gap-2",
									children: [/* @__PURE__ */ jsx("span", {
										className: `rounded border px-2 py-0.5 text-xs ${STATUS_STYLES$2[g.status] ?? STATUS_STYLES$2.open}`,
										children: t(g.status)
									}), g.status === "open" && /* @__PURE__ */ jsxs(Fragment$1, { children: [
										curatedHref && /* @__PURE__ */ jsx(Button, {
											variant: "outline",
											size: "sm",
											asChild: true,
											children: /* @__PURE__ */ jsxs(Link, {
												href: curatedHref,
												children: [/* @__PURE__ */ jsx(Plus, { className: "mr-1 h-3.5 w-3.5" }), t("Curated answer")]
											})
										}),
										/* @__PURE__ */ jsxs(Button, {
											variant: "ghost",
											size: "sm",
											onClick: () => resolve(g, "answered"),
											children: [/* @__PURE__ */ jsx(CheckCircle2, { className: "mr-1 h-3.5 w-3.5" }), t("Resolve")]
										}),
										/* @__PURE__ */ jsxs(Button, {
											variant: "ghost",
											size: "sm",
											onClick: () => resolve(g, "ignore"),
											children: [/* @__PURE__ */ jsx(XCircle, { className: "mr-1 h-3.5 w-3.5" }), t("Ignore")]
										})
									] })]
								})]
							}, g.id);
						})
					})
				})
			]
		})]
	});
}
//#endregion
//#region resources/js/pages/app/analytics/index.tsx
var analytics_exports = /* @__PURE__ */ __exportAll({ default: () => AnalyticsIndex });
function relativeTime$5(iso, t) {
	if (!iso) return t("No recent activity");
	const ms = Date.now() - new Date(iso).getTime();
	const min = Math.max(1, Math.round(ms / 6e4));
	if (min < 60) return t(":count m ago", { count: min });
	const hr = Math.round(min / 60);
	if (hr < 24) return t(":count h ago", { count: hr });
	const day = Math.round(hr / 24);
	if (day < 7) return t(":count d ago", { count: day });
	return new Date(iso).toLocaleDateString();
}
function formatRange$1(from, to) {
	const opts = {
		month: "short",
		day: "numeric"
	};
	return `${new Date(from).toLocaleDateString("en-US", opts)} - ${new Date(to).toLocaleDateString("en-US", {
		...opts,
		year: "numeric"
	})}`;
}
function trendSub$1(current, prior, t, fallback) {
	const data = trend(current, prior);
	const localizedFallback = fallback ?? t("vs previous 30d");
	if (data.dir === "flat") return localizedFallback;
	return t(":dir :pct% vs previous 30d", {
		dir: data.dir === "up" ? t("Up") : t("Down"),
		pct: data.pct
	});
}
function FooterMetric$1({ icon, label, value }) {
	return /* @__PURE__ */ jsxs("div", {
		className: "flex min-w-0 items-center justify-between gap-3 border-b px-4 py-2 last:border-b-0 sm:border-e sm:border-b-0 sm:last:border-e-0",
		children: [/* @__PURE__ */ jsxs("div", {
			className: "flex min-w-0 items-center gap-2 text-muted-foreground",
			children: [icon, /* @__PURE__ */ jsx("span", {
				className: "truncate text-xs",
				children: label
			})]
		}), /* @__PURE__ */ jsx("span", {
			className: "text-xs font-medium text-foreground tabular-nums",
			children: value
		})]
	});
}
function AnalyticsChart({ chart }) {
	const width = 760;
	const height = 240;
	const padX = 24;
	const padY = 16;
	const innerWidth = width - padX * 2;
	const innerHeight = height - padY * 2;
	const values = [...chart.conversations, ...chart.leads];
	const max = Math.max(1, ...values);
	const stepX = innerWidth / Math.max(1, chart.days.length - 1);
	const toPath = (series) => series.map((value, index) => `${(padX + index * stepX).toFixed(1)},${(padY + innerHeight - value / max * innerHeight).toFixed(1)}`).join(" ");
	const conversationsPath = toPath(chart.conversations);
	const leadsPath = toPath(chart.leads);
	const conversationArea = `${padX},${padY + innerHeight} ${conversationsPath} ${padX + innerWidth},${padY + innerHeight}`;
	const ticks = [
		0,
		.25,
		.5,
		.75,
		1
	].map((ratio) => Math.round(max * ratio));
	const xLabels = [
		0,
		Math.floor(chart.days.length / 4),
		Math.floor(chart.days.length / 2),
		Math.floor(chart.days.length * 3 / 4),
		chart.days.length - 1
	].map((index) => ({
		index,
		label: chart.days[index] ? new Date(chart.days[index]).toLocaleDateString("en-US", {
			month: "short",
			day: "numeric"
		}) : ""
	})).filter((label, index, rows) => label.label !== "" && rows.findIndex((row) => row.index === label.index) === index);
	return /* @__PURE__ */ jsxs("svg", {
		viewBox: `0 0 ${width} ${height + 24}`,
		className: "h-64 w-full",
		preserveAspectRatio: "xMidYMid meet",
		"aria-hidden": true,
		children: [
			ticks.map((tick, index) => {
				const y = padY + innerHeight - tick / max * innerHeight;
				return /* @__PURE__ */ jsxs("g", { children: [/* @__PURE__ */ jsx("line", {
					x1: padX,
					y1: y,
					x2: padX + innerWidth,
					y2: y,
					stroke: "currentColor",
					strokeOpacity: .06
				}), /* @__PURE__ */ jsx("text", {
					x: padX - 6,
					y: y + 4,
					textAnchor: "end",
					fontSize: "10",
					fill: "currentColor",
					opacity: .45,
					children: tick
				})] }, index);
			}),
			/* @__PURE__ */ jsx("polygon", {
				points: conversationArea,
				fill: "#2563eb",
				fillOpacity: .12
			}),
			/* @__PURE__ */ jsx("polyline", {
				points: conversationsPath,
				fill: "none",
				stroke: "#2563eb",
				strokeWidth: 1.8,
				strokeLinecap: "round",
				strokeLinejoin: "round"
			}),
			/* @__PURE__ */ jsx("polyline", {
				points: leadsPath,
				fill: "none",
				stroke: "#f97316",
				strokeWidth: 1.7,
				strokeDasharray: "4 4",
				strokeLinecap: "round",
				strokeLinejoin: "round"
			}),
			xLabels.map(({ index, label }) => /* @__PURE__ */ jsx("text", {
				x: padX + index * stepX,
				y: height + 16,
				textAnchor: "middle",
				fontSize: "10",
				fill: "currentColor",
				opacity: .45,
				children: label
			}, index))
		]
	});
}
function AnalyticsIndex({ window, metrics, chart, summary, agents, pages, content_gaps: contentGaps$1, csat, degraded }) {
	const { t } = useT();
	const brand = useBranding().site_title || "Pitchbar";
	const { auth } = usePage().props;
	const isSuperAdmin = auth?.user?.is_super_admin === true;
	return /* @__PURE__ */ jsxs(AppLayout, {
		breadcrumbs: [{
			title: t("Analytics"),
			href: overview()
		}],
		children: [/* @__PURE__ */ jsx(Head, { title: t("Analytics") }), /* @__PURE__ */ jsxs("div", {
			className: "flex flex-1 flex-col gap-4 p-4",
			children: [
				degraded && isSuperAdmin && /* @__PURE__ */ jsx("div", {
					className: "rounded-md border border-amber-300 bg-amber-50 px-3 py-2 text-xs text-amber-800 dark:border-amber-700 dark:bg-amber-900/30 dark:text-amber-200",
					children: t("Some metrics couldn't be loaded. The most likely cause is a pending database migration — run `php artisan migrate` on the :brand host and reload. Details are in storage/logs/laravel.log.", { brand })
				}),
				/* @__PURE__ */ jsxs("div", {
					className: "flex flex-wrap items-start justify-between gap-4",
					children: [/* @__PURE__ */ jsxs("div", { children: [
						/* @__PURE__ */ jsxs("div", {
							className: "inline-flex items-center gap-2 rounded-full border bg-background px-3 py-1 text-xs text-muted-foreground",
							children: [/* @__PURE__ */ jsx(Activity, { className: "size-3.5" }), formatRange$1(window.from, window.to)]
						}),
						/* @__PURE__ */ jsx("h1", {
							className: "mt-3 text-2xl font-semibold tracking-tight",
							children: t("Analytics")
						}),
						/* @__PURE__ */ jsx("p", {
							className: "mt-1 max-w-3xl text-sm text-muted-foreground",
							children: t("Real traffic, lead capture, and knowledge signals across every agent in this workspace. Use this view to see which agents are pulling volume, which pages convert, and which unanswered questions still need attention.")
						})
					] }), /* @__PURE__ */ jsxs("div", {
						className: "flex flex-wrap items-center gap-2",
						children: [
							/* @__PURE__ */ jsx(Button, {
								asChild: true,
								variant: "outline",
								size: "sm",
								children: /* @__PURE__ */ jsxs(Link, {
									href: index$10(),
									prefetch: true,
									children: [/* @__PURE__ */ jsx(MessagesSquare, { className: "size-3.5" }), t("Conversations")]
								})
							}),
							/* @__PURE__ */ jsx(Button, {
								asChild: true,
								variant: "outline",
								size: "sm",
								children: /* @__PURE__ */ jsxs(Link, {
									href: index$9(),
									prefetch: true,
									children: [/* @__PURE__ */ jsx(Inbox, { className: "size-3.5" }), t("Inbox")]
								})
							}),
							/* @__PURE__ */ jsx(Button, {
								asChild: true,
								size: "sm",
								children: /* @__PURE__ */ jsxs(Link, {
									href: contentGaps(),
									prefetch: true,
									children: [/* @__PURE__ */ jsx(Library, { className: "size-3.5" }), t("Content gaps")]
								})
							})
						]
					})]
				}),
				/* @__PURE__ */ jsxs("div", {
					className: "grid gap-3 sm:grid-cols-2 xl:grid-cols-5",
					children: [
						/* @__PURE__ */ jsx(MetricCard, {
							label: t("Conversations"),
							value: metrics.conversations.value.toLocaleString(),
							sub: trendSub$1(metrics.conversations.value, metrics.conversations.prior_value, t),
							icon: /* @__PURE__ */ jsx(MessagesSquare, { className: "size-4" }),
							iconTone: "bg-blue-500/10 text-blue-700 dark:text-blue-300",
							series: metrics.conversations.series,
							accent: "#2563eb",
							trendData: trend(metrics.conversations.value, metrics.conversations.prior_value)
						}),
						/* @__PURE__ */ jsx(MetricCard, {
							label: t("Messages"),
							value: metrics.messages.value.toLocaleString(),
							sub: trendSub$1(metrics.messages.value, metrics.messages.prior_value, t),
							icon: /* @__PURE__ */ jsx(MessageSquare, { className: "size-4" }),
							iconTone: "bg-emerald-500/10 text-emerald-700 dark:text-emerald-300",
							series: metrics.messages.series,
							accent: "#059669",
							trendData: trend(metrics.messages.value, metrics.messages.prior_value)
						}),
						/* @__PURE__ */ jsx(MetricCard, {
							label: t("Leads"),
							value: metrics.leads.value.toLocaleString(),
							sub: trendSub$1(metrics.leads.value, metrics.leads.prior_value, t),
							icon: /* @__PURE__ */ jsx(Inbox, { className: "size-4" }),
							iconTone: "bg-amber-500/10 text-amber-700 dark:text-amber-300",
							series: metrics.leads.series,
							accent: "#f59e0b",
							trendData: trend(metrics.leads.value, metrics.leads.prior_value)
						}),
						/* @__PURE__ */ jsx(MetricCard, {
							label: t("Lead Conversion"),
							value: `${metrics.conversion_rate.value.toFixed(1)}%`,
							sub: trendSub$1(metrics.conversion_rate.value, metrics.conversion_rate.prior_value, t),
							icon: /* @__PURE__ */ jsx(TrendingUp, { className: "size-4" }),
							iconTone: "bg-rose-500/10 text-rose-700 dark:text-rose-300",
							series: metrics.conversion_rate.series,
							accent: "#e11d48",
							trendData: trend(metrics.conversion_rate.value, metrics.conversion_rate.prior_value)
						}),
						/* @__PURE__ */ jsx(MetricCard, {
							label: t("Messages / Convo"),
							value: metrics.engagement.value.toFixed(2),
							sub: trendSub$1(metrics.engagement.value, metrics.engagement.prior_value, t),
							icon: /* @__PURE__ */ jsx(Activity, { className: "size-4" }),
							iconTone: "bg-violet-500/10 text-violet-700 dark:text-violet-300",
							series: metrics.engagement.series,
							accent: "#7c3aed",
							trendData: trend(metrics.engagement.value, metrics.engagement.prior_value)
						})
					]
				}),
				/* @__PURE__ */ jsxs("div", {
					className: "grid gap-4 xl:grid-cols-[minmax(0,1.55fr)_minmax(320px,0.95fr)]",
					children: [/* @__PURE__ */ jsxs(Card, {
						className: "overflow-hidden p-0",
						children: [
							/* @__PURE__ */ jsxs("div", {
								className: "flex items-start justify-between gap-4 border-b px-4 py-4",
								children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
									className: "text-sm font-medium",
									children: t("Traffic and capture trend")
								}), /* @__PURE__ */ jsx("p", {
									className: "mt-0.5 text-xs text-muted-foreground",
									children: t("Conversations drive the blue area. Leads are the dotted line, so you can see whether capture is climbing with traffic.")
								})] }), /* @__PURE__ */ jsx("div", {
									className: "rounded-full border bg-background px-3 py-1 text-[11px] font-medium text-muted-foreground",
									children: t("Last 30 days")
								})]
							}),
							/* @__PURE__ */ jsx("div", {
								className: "px-3 pt-4 pb-2 sm:px-4",
								children: /* @__PURE__ */ jsx(AnalyticsChart, { chart })
							}),
							/* @__PURE__ */ jsxs("div", {
								className: "grid gap-0 border-t sm:grid-cols-2 xl:grid-cols-4",
								children: [
									/* @__PURE__ */ jsx(FooterMetric$1, {
										icon: /* @__PURE__ */ jsx(Bot, { className: "size-3.5" }),
										label: t("Active agents"),
										value: summary.active_agents.toLocaleString()
									}),
									/* @__PURE__ */ jsx(FooterMetric$1, {
										icon: /* @__PURE__ */ jsx(TrendingUp, { className: "size-3.5" }),
										label: t("Published agents"),
										value: summary.published_agents.toLocaleString()
									}),
									/* @__PURE__ */ jsx(FooterMetric$1, {
										icon: /* @__PURE__ */ jsx(Globe, { className: "size-3.5" }),
										label: t("Tracked pages"),
										value: summary.pages_tracked.toLocaleString()
									}),
									/* @__PURE__ */ jsx(FooterMetric$1, {
										icon: /* @__PURE__ */ jsx(Library, { className: "size-3.5" }),
										label: t("Open gaps"),
										value: summary.open_gaps.toLocaleString()
									})
								]
							})
						]
					}), /* @__PURE__ */ jsxs(Card, {
						className: "p-0",
						children: [/* @__PURE__ */ jsxs("div", {
							className: "flex items-center justify-between border-b px-4 py-4",
							children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
								className: "text-sm font-medium",
								children: t("Top agents")
							}), /* @__PURE__ */ jsx("p", {
								className: "mt-0.5 text-xs text-muted-foreground",
								children: t("Who is driving the most conversation and lead volume.")
							})] }), /* @__PURE__ */ jsx(Button, {
								asChild: true,
								variant: "ghost",
								size: "sm",
								children: /* @__PURE__ */ jsx(Link, {
									href: index$12(),
									prefetch: true,
									children: t("All agents")
								})
							})]
						}), agents.length === 0 ? /* @__PURE__ */ jsx("div", {
							className: "px-4 py-10 text-center text-sm text-muted-foreground",
							children: t("No agent activity yet. Once visitors start chatting, the strongest performers will show up here.")
						}) : /* @__PURE__ */ jsx("div", {
							className: "divide-y",
							children: agents.map((agent) => /* @__PURE__ */ jsxs(Link, {
								href: show$4(agent.id),
								className: "flex items-center gap-3 px-4 py-3 transition hover:bg-muted/50",
								children: [
									/* @__PURE__ */ jsx("div", {
										className: "flex size-9 shrink-0 items-center justify-center rounded-full bg-muted text-muted-foreground",
										children: /* @__PURE__ */ jsx(Bot, { className: "size-4" })
									}),
									/* @__PURE__ */ jsxs("div", {
										className: "min-w-0 flex-1",
										children: [/* @__PURE__ */ jsxs("div", {
											className: "flex flex-wrap items-center gap-2",
											children: [/* @__PURE__ */ jsx("p", {
												className: "truncate text-sm font-medium text-foreground",
												children: agent.name
											}), /* @__PURE__ */ jsx("span", {
												className: `rounded-full px-2 py-0.5 text-[10px] font-medium ${agent.is_published ? "bg-emerald-500/10 text-emerald-700 dark:text-emerald-300" : "bg-muted text-muted-foreground"}`,
												children: agent.is_published ? t("Live") : t("Draft")
											})]
										}), /* @__PURE__ */ jsx("p", {
											className: "mt-1 text-[11px] text-muted-foreground",
											children: t(":count messages · last active :time", {
												count: agent.messages.toLocaleString(),
												time: relativeTime$5(agent.last_seen_at, t)
											})
										})]
									}),
									/* @__PURE__ */ jsxs("div", {
										className: "text-end",
										children: [/* @__PURE__ */ jsx("p", {
											className: "text-sm font-semibold text-foreground tabular-nums",
											children: agent.conversations.toLocaleString()
										}), /* @__PURE__ */ jsx("p", {
											className: "text-[11px] text-muted-foreground",
											children: t(":count leads · :pct%", {
												count: agent.leads.toLocaleString(),
												pct: agent.conversion_rate.toFixed(1)
											})
										})]
									}),
									/* @__PURE__ */ jsx(ArrowRight, { className: "size-4 shrink-0 text-muted-foreground" })
								]
							}, agent.id))
						})]
					})]
				}),
				/* @__PURE__ */ jsxs("div", {
					className: "grid gap-4 xl:grid-cols-2",
					children: [/* @__PURE__ */ jsxs(Card, {
						className: "p-0",
						children: [/* @__PURE__ */ jsxs("div", {
							className: "flex items-center justify-between border-b px-4 py-4",
							children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
								className: "text-sm font-medium",
								children: t("Top pages")
							}), /* @__PURE__ */ jsx("p", {
								className: "mt-0.5 text-xs text-muted-foreground",
								children: t("Which entry points pull traffic and turn it into leads.")
							})] }), /* @__PURE__ */ jsx(Button, {
								asChild: true,
								variant: "ghost",
								size: "sm",
								children: /* @__PURE__ */ jsx(Link, {
									href: index$10(),
									prefetch: true,
									children: t("Open conversations")
								})
							})]
						}), pages.length === 0 ? /* @__PURE__ */ jsx("div", {
							className: "px-4 py-10 text-center text-sm text-muted-foreground",
							children: t("No tracked pages yet. Page URLs appear here once the widget sees real visitor traffic.")
						}) : /* @__PURE__ */ jsx("div", {
							className: "divide-y",
							children: pages.map((page) => {
								return /* @__PURE__ */ jsxs(Link, {
									href: page.page_url === "(no page url)" ? index$10() : index$10({ query: { q: page.page_url } }),
									className: "flex items-center gap-3 px-4 py-3 transition hover:bg-muted/50",
									children: [
										/* @__PURE__ */ jsx("div", {
											className: "flex size-9 shrink-0 items-center justify-center rounded-full bg-muted text-muted-foreground",
											children: /* @__PURE__ */ jsx(Globe, { className: "size-4" })
										}),
										/* @__PURE__ */ jsxs("div", {
											className: "min-w-0 flex-1",
											children: [/* @__PURE__ */ jsx("p", {
												className: "truncate text-sm font-medium text-foreground",
												children: page.page_url
											}), /* @__PURE__ */ jsx("p", {
												className: "mt-1 text-[11px] text-muted-foreground",
												children: t("Last seen :time", { time: relativeTime$5(page.last_seen_at, t) })
											})]
										}),
										/* @__PURE__ */ jsxs("div", {
											className: "text-end",
											children: [/* @__PURE__ */ jsx("p", {
												className: "text-sm font-semibold text-foreground tabular-nums",
												children: page.conversations.toLocaleString()
											}), /* @__PURE__ */ jsx("p", {
												className: "text-[11px] text-muted-foreground",
												children: t(":count leads · :pct%", {
													count: page.leads.toLocaleString(),
													pct: page.conversion_rate.toFixed(1)
												})
											})]
										}),
										/* @__PURE__ */ jsx(ArrowRight, { className: "size-4 shrink-0 text-muted-foreground" })
									]
								}, page.page_url);
							})
						})]
					}), /* @__PURE__ */ jsxs(Card, {
						className: "p-0",
						children: [/* @__PURE__ */ jsxs("div", {
							className: "flex items-center justify-between border-b px-4 py-4",
							children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
								className: "text-sm font-medium",
								children: t("Content gaps")
							}), /* @__PURE__ */ jsx("p", {
								className: "mt-0.5 text-xs text-muted-foreground",
								children: t("The unanswered questions creating the most friction right now.")
							})] }), /* @__PURE__ */ jsx(Button, {
								asChild: true,
								variant: "ghost",
								size: "sm",
								children: /* @__PURE__ */ jsx(Link, {
									href: contentGaps(),
									prefetch: true,
									children: t(":count open", { count: contentGaps$1.open_count.toLocaleString() })
								})
							})]
						}), contentGaps$1.top.length === 0 ? /* @__PURE__ */ jsx("div", {
							className: "px-4 py-10 text-center text-sm text-muted-foreground",
							children: t("No open gaps. Your current knowledge coverage is keeping up with visitor questions.")
						}) : /* @__PURE__ */ jsx("div", {
							className: "divide-y",
							children: contentGaps$1.top.map((gap) => /* @__PURE__ */ jsxs(Link, {
								href: contentGaps(),
								className: "flex items-center gap-3 px-4 py-3 transition hover:bg-muted/50",
								children: [
									/* @__PURE__ */ jsx("div", {
										className: "flex size-9 shrink-0 items-center justify-center rounded-full bg-amber-500/10 text-amber-700 dark:text-amber-300",
										children: /* @__PURE__ */ jsx(Library, { className: "size-4" })
									}),
									/* @__PURE__ */ jsxs("div", {
										className: "min-w-0 flex-1",
										children: [/* @__PURE__ */ jsx("p", {
											className: "line-clamp-2 text-sm font-medium text-foreground",
											children: gap.question
										}), /* @__PURE__ */ jsx("p", {
											className: "mt-1 text-[11px] text-muted-foreground",
											children: t("Last seen :time", { time: relativeTime$5(gap.last_seen_at, t) })
										})]
									}),
									/* @__PURE__ */ jsxs("div", {
										className: "text-end",
										children: [/* @__PURE__ */ jsx("p", {
											className: "text-sm font-semibold text-foreground tabular-nums",
											children: gap.occurrences.toLocaleString()
										}), /* @__PURE__ */ jsx("p", {
											className: "text-[11px] text-muted-foreground",
											children: t("occurrences")
										})]
									}),
									/* @__PURE__ */ jsx(ArrowRight, { className: "size-4 shrink-0 text-muted-foreground" })
								]
							}, gap.id))
						})]
					})]
				}),
				/* @__PURE__ */ jsx(Link, {
					href: contentGaps(),
					className: "block transition hover:opacity-90",
					children: /* @__PURE__ */ jsxs(Card, {
						className: "flex items-center justify-between gap-4 p-4",
						children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
							className: "text-sm font-medium",
							children: t("Need deeper remediation work?")
						}), /* @__PURE__ */ jsx("p", {
							className: "mt-0.5 text-xs text-muted-foreground",
							children: t("Open the full content-gap queue to see every unanswered question, sorted by repeat volume and last seen date.")
						})] }), /* @__PURE__ */ jsx(ArrowRight, { className: "size-4 shrink-0 text-muted-foreground" })]
					})
				}),
				csat && csat.total_rated > 0 && /* @__PURE__ */ jsxs(Card, {
					className: "p-4",
					children: [
						/* @__PURE__ */ jsxs("div", {
							className: "flex flex-wrap items-baseline justify-between gap-3",
							children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
								className: "text-sm font-medium",
								children: t("Visitor satisfaction (CSAT)")
							}), /* @__PURE__ */ jsx("p", {
								className: "mt-0.5 text-xs text-muted-foreground",
								children: t("Share of conversations rated good vs bad, weekly over the last 12 weeks.")
							})] }), csat.latest_score !== null && /* @__PURE__ */ jsxs("p", {
								className: "text-2xl font-semibold tabular-nums",
								children: [
									csat.latest_score,
									"%",
									/* @__PURE__ */ jsx("span", {
										className: "ml-2 text-xs font-normal text-muted-foreground",
										children: t(":n ratings", { n: csat.total_rated.toLocaleString() })
									})
								]
							})]
						}),
						/* @__PURE__ */ jsx("div", {
							className: "mt-4 flex h-24 items-end gap-1",
							children: csat.series.map((w) => {
								const score = w.score ?? 0;
								const hasData = w.score !== null;
								const barColor = hasData ? score >= 70 ? "bg-emerald-500" : score >= 40 ? "bg-amber-500" : "bg-rose-500" : "bg-muted";
								return /* @__PURE__ */ jsx("div", {
									className: "flex flex-1 flex-col items-center",
									title: `${w.week} — ${hasData ? score + "%" : t("no ratings")}`,
									children: /* @__PURE__ */ jsx("div", {
										className: `w-full rounded-t ${barColor}`,
										style: { height: hasData ? `${Math.max(score, 4)}%` : "4%" }
									})
								}, w.week);
							})
						}),
						csat.low_rated.length > 0 && /* @__PURE__ */ jsxs("div", {
							className: "mt-5",
							children: [/* @__PURE__ */ jsx("p", {
								className: "text-xs font-semibold tracking-wide text-muted-foreground uppercase",
								children: t("Recent low-rated conversations")
							}), /* @__PURE__ */ jsx("div", {
								className: "mt-2 divide-y",
								children: csat.low_rated.map((c) => /* @__PURE__ */ jsxs(Link, {
									href: `/app/conversations/${c.id}`,
									className: "block py-2 transition hover:bg-muted/40",
									children: [/* @__PURE__ */ jsx("p", {
										className: "line-clamp-2 text-sm",
										children: c.comment ?? t("No comment")
									}), /* @__PURE__ */ jsxs("p", {
										className: "mt-1 text-[11px] text-muted-foreground",
										children: [c.page_url ?? "—", c.satisfaction_at && /* @__PURE__ */ jsxs(Fragment$1, { children: [" · ", new Date(c.satisfaction_at).toLocaleString()] })]
									})]
								}, c.id))
							})]
						})
					]
				})
			]
		})]
	});
}
//#endregion
//#region resources/js/pages/app/audit/index.tsx
var audit_exports = /* @__PURE__ */ __exportAll({ default: () => AuditIndexPage });
var ALL_ENTITY_TYPES = "__all__";
function fmt(iso) {
	if (!iso) return "—";
	const d = new Date(iso);
	if (Number.isNaN(d.getTime())) return iso;
	return d.toLocaleString();
}
function AuditIndexPage({ rows, pagination, filters, entityTypes }) {
	const { t } = useT();
	const [draft, setDraft] = useState(filters);
	const [expanded, setExpanded] = useState({});
	const breadcrumbs = [{
		title: t("Audit log"),
		href: "/app/audit"
	}];
	const apply = (overrides = {}, page = 1) => {
		const merged = {
			...draft,
			...overrides
		};
		const params = { page };
		Object.keys(merged).forEach((key) => {
			const v = merged[key];
			if (typeof v === "string" && v.trim() !== "") params[key] = v;
		});
		router.get("/app/audit", params, {
			preserveState: true,
			preserveScroll: true
		});
	};
	const reset = () => {
		setDraft({
			action: "",
			entity_type: "",
			user_email: "",
			from: "",
			to: ""
		});
		router.get("/app/audit", {}, { preserveScroll: true });
	};
	const toggle = (id) => {
		setExpanded((prev) => ({
			...prev,
			[id]: !prev[id]
		}));
	};
	return /* @__PURE__ */ jsxs(AppLayout, {
		breadcrumbs,
		children: [/* @__PURE__ */ jsx(Head, { title: t("Audit log") }), /* @__PURE__ */ jsxs("div", {
			className: "space-y-6 p-6",
			children: [
				/* @__PURE__ */ jsxs("div", {
					className: "flex items-center gap-3",
					children: [/* @__PURE__ */ jsx(ScrollText, { className: "h-6 w-6 text-muted-foreground" }), /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("h1", {
						className: "text-xl font-semibold",
						children: t("Audit log")
					}), /* @__PURE__ */ jsx("p", {
						className: "text-sm text-muted-foreground",
						children: t("Workspace activity trail — member changes, integrations, GDPR requests, webhook failures.")
					})] })]
				}),
				/* @__PURE__ */ jsxs(Card, {
					className: "p-4",
					children: [/* @__PURE__ */ jsxs("div", {
						className: "grid gap-3 sm:grid-cols-2 lg:grid-cols-5",
						children: [
							/* @__PURE__ */ jsxs("div", {
								className: "space-y-1",
								children: [/* @__PURE__ */ jsx(Label, {
									htmlFor: "audit-action",
									children: t("Action")
								}), /* @__PURE__ */ jsx(Input, {
									id: "audit-action",
									placeholder: t("e.g. dsr.exported"),
									value: draft.action,
									onChange: (e) => setDraft((d) => ({
										...d,
										action: e.target.value
									}))
								})]
							}),
							/* @__PURE__ */ jsxs("div", {
								className: "space-y-1",
								children: [/* @__PURE__ */ jsx(Label, {
									htmlFor: "audit-entity",
									children: t("Entity type")
								}), /* @__PURE__ */ jsxs(Select, {
									value: draft.entity_type === "" ? ALL_ENTITY_TYPES : draft.entity_type,
									onValueChange: (v) => setDraft((d) => ({
										...d,
										entity_type: v === ALL_ENTITY_TYPES ? "" : v
									})),
									children: [/* @__PURE__ */ jsx(SelectTrigger, {
										id: "audit-entity",
										children: /* @__PURE__ */ jsx(SelectValue, { placeholder: t("Any") })
									}), /* @__PURE__ */ jsxs(SelectContent, { children: [/* @__PURE__ */ jsx(SelectItem, {
										value: ALL_ENTITY_TYPES,
										children: t("Any")
									}), entityTypes.map((et) => /* @__PURE__ */ jsx(SelectItem, {
										value: et,
										children: et
									}, et))] })]
								})]
							}),
							/* @__PURE__ */ jsxs("div", {
								className: "space-y-1",
								children: [/* @__PURE__ */ jsx(Label, {
									htmlFor: "audit-user",
									children: t("Actor email")
								}), /* @__PURE__ */ jsx(Input, {
									id: "audit-user",
									type: "email",
									placeholder: "user@example.com",
									value: draft.user_email,
									onChange: (e) => setDraft((d) => ({
										...d,
										user_email: e.target.value
									}))
								})]
							}),
							/* @__PURE__ */ jsxs("div", {
								className: "space-y-1",
								children: [/* @__PURE__ */ jsx(Label, {
									htmlFor: "audit-from",
									children: t("From")
								}), /* @__PURE__ */ jsx(Input, {
									id: "audit-from",
									type: "date",
									value: draft.from,
									onChange: (e) => setDraft((d) => ({
										...d,
										from: e.target.value
									}))
								})]
							}),
							/* @__PURE__ */ jsxs("div", {
								className: "space-y-1",
								children: [/* @__PURE__ */ jsx(Label, {
									htmlFor: "audit-to",
									children: t("To")
								}), /* @__PURE__ */ jsx(Input, {
									id: "audit-to",
									type: "date",
									value: draft.to,
									onChange: (e) => setDraft((d) => ({
										...d,
										to: e.target.value
									}))
								})]
							})
						]
					}), /* @__PURE__ */ jsxs("div", {
						className: "mt-4 flex justify-end gap-2",
						children: [/* @__PURE__ */ jsx(Button, {
							variant: "ghost",
							onClick: reset,
							children: t("Reset")
						}), /* @__PURE__ */ jsx(Button, {
							onClick: () => apply(),
							children: t("Apply")
						})]
					})]
				}),
				/* @__PURE__ */ jsxs(Card, {
					className: "overflow-hidden",
					children: [/* @__PURE__ */ jsx("div", {
						className: "overflow-x-auto",
						children: /* @__PURE__ */ jsxs("table", {
							className: "w-full text-sm",
							children: [/* @__PURE__ */ jsx("thead", {
								className: "bg-muted/40 text-left text-xs tracking-wide text-muted-foreground uppercase",
								children: /* @__PURE__ */ jsxs("tr", { children: [
									/* @__PURE__ */ jsx("th", {
										className: "p-3",
										children: t("When")
									}),
									/* @__PURE__ */ jsx("th", {
										className: "p-3",
										children: t("Actor")
									}),
									/* @__PURE__ */ jsx("th", {
										className: "p-3",
										children: t("Action")
									}),
									/* @__PURE__ */ jsx("th", {
										className: "p-3",
										children: t("Entity")
									}),
									/* @__PURE__ */ jsx("th", {
										className: "p-3",
										children: t("IP")
									}),
									/* @__PURE__ */ jsx("th", { className: "p-3" })
								] })
							}), /* @__PURE__ */ jsxs("tbody", { children: [rows.length === 0 && /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx("td", {
								colSpan: 6,
								className: "p-8 text-center text-muted-foreground",
								children: t("No audit entries match the current filters.")
							}) }), rows.map((row) => /* @__PURE__ */ jsxs("tr", {
								className: "border-t border-border align-top",
								children: [
									/* @__PURE__ */ jsx("td", {
										className: "p-3 whitespace-nowrap",
										children: fmt(row.created_at)
									}),
									/* @__PURE__ */ jsx("td", {
										className: "p-3",
										children: row.user ? /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("div", {
											className: "font-medium",
											children: row.user.name
										}), /* @__PURE__ */ jsx("div", {
											className: "text-xs text-muted-foreground",
											children: row.user.email
										})] }) : /* @__PURE__ */ jsx("span", {
											className: "text-muted-foreground",
											children: t("System")
										})
									}),
									/* @__PURE__ */ jsx("td", {
										className: "p-3",
										children: /* @__PURE__ */ jsx("code", {
											className: "rounded bg-muted px-1.5 py-0.5 text-xs",
											children: row.action
										})
									}),
									/* @__PURE__ */ jsx("td", {
										className: "p-3 text-xs",
										children: row.entity_type ? /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("div", { children: row.entity_type }), row.entity_id && /* @__PURE__ */ jsx("div", {
											className: "text-muted-foreground",
											children: row.entity_id
										})] }) : /* @__PURE__ */ jsx("span", {
											className: "text-muted-foreground",
											children: "—"
										})
									}),
									/* @__PURE__ */ jsx("td", {
										className: "p-3 text-xs text-muted-foreground",
										children: row.ip ?? "—"
									}),
									/* @__PURE__ */ jsxs("td", {
										className: "p-3 text-right",
										children: [/* @__PURE__ */ jsx(Button, {
											variant: "ghost",
											size: "sm",
											onClick: () => toggle(row.id),
											children: expanded[row.id] ? t("Hide") : t("Details")
										}), expanded[row.id] && /* @__PURE__ */ jsx("div", {
											className: "mt-2 max-w-xl text-left",
											children: /* @__PURE__ */ jsxs("details", {
												open: true,
												className: "rounded border border-border bg-muted/30 p-2 text-xs",
												children: [/* @__PURE__ */ jsx("summary", {
													className: "cursor-pointer font-medium",
													children: t("Before / After")
												}), /* @__PURE__ */ jsx("pre", {
													className: "mt-2 max-h-72 overflow-auto break-all whitespace-pre-wrap",
													children: JSON.stringify({
														before: row.before,
														after: row.after,
														ua: row.ua
													}, null, 2)
												})]
											})
										})]
									})
								]
							}, row.id))] })]
						})
					}), /* @__PURE__ */ jsxs("div", {
						className: "flex items-center justify-between border-t border-border p-3 text-sm",
						children: [/* @__PURE__ */ jsx("div", {
							className: "text-muted-foreground",
							children: t("Showing :count of :total entries", {
								count: rows.length,
								total: pagination.total
							})
						}), /* @__PURE__ */ jsxs("div", {
							className: "flex items-center gap-2",
							children: [
								/* @__PURE__ */ jsxs(Button, {
									variant: "ghost",
									size: "sm",
									disabled: pagination.current_page <= 1,
									onClick: () => apply({}, pagination.current_page - 1),
									children: [/* @__PURE__ */ jsx(ChevronLeft, { className: "h-4 w-4" }), t("Prev")]
								}),
								/* @__PURE__ */ jsxs("span", {
									className: "text-xs text-muted-foreground",
									children: [
										pagination.current_page,
										" /",
										" ",
										pagination.last_page
									]
								}),
								/* @__PURE__ */ jsxs(Button, {
									variant: "ghost",
									size: "sm",
									disabled: pagination.current_page >= pagination.last_page,
									onClick: () => apply({}, pagination.current_page + 1),
									children: [t("Next"), /* @__PURE__ */ jsx(ChevronRight, { className: "h-4 w-4" })]
								})
							]
						})]
					})]
				})
			]
		})]
	});
}
//#endregion
//#region resources/js/pages/app/billing.tsx
var billing_exports = /* @__PURE__ */ __exportAll({ default: () => BillingPage });
var formatPrice$3 = (cents, slug, t) => {
	if (slug === "custom") return t("Custom");
	if (cents === 0) return "$0";
	return `$${Math.round(cents / 100)}`;
};
function InvoiceStatusBadge({ status }) {
	const label = status.charAt(0).toUpperCase() + status.slice(1);
	if (status === "paid") return /* @__PURE__ */ jsxs("span", {
		className: "inline-flex items-center gap-1 rounded-md border border-emerald-200 bg-emerald-50 px-2 py-0.5 text-xs font-medium text-emerald-700 dark:border-emerald-500/30 dark:bg-emerald-500/10 dark:text-emerald-300",
		children: [/* @__PURE__ */ jsx(CheckCircle2, { className: "size-3" }), label]
	});
	if (status === "open" || status === "draft") return /* @__PURE__ */ jsx("span", {
		className: "inline-flex items-center rounded-md border border-amber-200 bg-amber-50 px-2 py-0.5 text-xs font-medium text-amber-700 dark:border-amber-500/30 dark:bg-amber-500/10 dark:text-amber-300",
		children: label
	});
	return /* @__PURE__ */ jsx("span", {
		className: "inline-flex items-center rounded-md border border-slate-200 bg-slate-50 px-2 py-0.5 text-xs font-medium text-slate-600 dark:border-slate-500/30 dark:bg-slate-500/10 dark:text-slate-300",
		children: label
	});
}
var formatLimit = (n, t) => {
	if (n === 0) return t("Unlimited");
	if (n >= 1e3) return `${(n / 1e3).toFixed(n % 1e3 === 0 ? 0 : 1)}k`;
	return n.toLocaleString();
};
function BillingPage({ plans, summary, stripe_configured, available_gateways, has_active_subscription, active_gateway, subscription_cancel_at_period_end, flash_checkout, invoices = [], charges = [], lifetime = null }) {
	const { t } = useT();
	const confirm = useConfirm();
	const trial = usePage().props.trial;
	const INVOICES_PER_PAGE = 10;
	const [invoicesPage, setInvoicesPage] = useState(1);
	const [invoicesStatus, setInvoicesStatus] = useState("all");
	const [invoicesSearch, setInvoicesSearch] = useState("");
	const filteredInvoices = useMemo(() => {
		const term = invoicesSearch.trim().toLowerCase();
		return invoices.filter((inv) => {
			if (invoicesStatus !== "all" && inv.status !== invoicesStatus) return false;
			if (term === "") return true;
			return (inv.number ?? inv.id).toLowerCase().includes(term);
		});
	}, [
		invoices,
		invoicesStatus,
		invoicesSearch
	]);
	const invoicesTotalPages = Math.max(1, Math.ceil(filteredInvoices.length / INVOICES_PER_PAGE));
	useEffect(() => {
		if (invoicesPage > invoicesTotalPages) setInvoicesPage(1);
	}, [invoicesPage, invoicesTotalPages]);
	const invoicesPaginated = useMemo(() => {
		const start = (invoicesPage - 1) * INVOICES_PER_PAGE;
		return filteredInvoices.slice(start, start + INVOICES_PER_PAGE);
	}, [filteredInvoices, invoicesPage]);
	const invoicesRangeStart = filteredInvoices.length === 0 ? 0 : (invoicesPage - 1) * INVOICES_PER_PAGE + 1;
	const invoicesRangeEnd = Math.min(invoicesPage * INVOICES_PER_PAGE, filteredInvoices.length);
	const invoicesStatusOptions = useMemo(() => {
		const known = [
			"paid",
			"open",
			"draft",
			"void",
			"uncollectible"
		];
		const present = new Set(invoices.map((i) => i.status));
		return known.filter((s) => present.has(s));
	}, [invoices]);
	const TAGLINE = {
		free: t("For getting live fast"),
		standard: t("Level up productivity"),
		pro: t("For teams ready to scale"),
		custom: t("Tailored solutions for enterprises")
	};
	const GATEWAY_LABEL = {
		stripe: t("Credit / debit card (Stripe)"),
		paypal: t("PayPal"),
		razorpay: t("Razorpay (UPI, cards, netbanking)")
	};
	const currentSlug = summary.plan?.slug ?? "free";
	const checkoutStatus = flash_checkout?.status ?? null;
	const gateways = available_gateways ?? [];
	const anyConfigured = gateways.length > 0;
	const [pendingSlug, setPendingSlug] = useState(null);
	const [pendingGateway, setPendingGateway] = useState(gateways[0] ?? null);
	const onChoose = async (slug) => {
		if (!anyConfigured) return;
		if (has_active_subscription && active_gateway === "stripe") {
			if (!await confirm({
				title: t("Swap plan?"),
				message: t("Swap to :name now? The change is immediate and Stripe will prorate the difference on your next invoice.", { name: slug }),
				confirmLabel: t("Swap")
			})) return;
			router.post(swap().url, { plan_slug: slug });
			return;
		}
		if (gateways.length === 1) {
			router.post(checkout().url, {
				plan_slug: slug,
				gateway: gateways[0]
			});
			return;
		}
		setPendingSlug(slug);
		setPendingGateway(gateways[0] ?? null);
	};
	const onCancel = async () => {
		if (!await confirm({
			title: t("Cancel subscription?"),
			message: t("Cancel your subscription? You keep access until the end of the current billing period, then drop back to Free."),
			confirmLabel: t("Cancel subscription"),
			danger: true
		})) return;
		router.post(cancel().url, {});
	};
	const onResume = () => {
		router.post(resume().url, {});
	};
	const onConfirmGateway = () => {
		if (pendingSlug === null || pendingGateway === null) return;
		router.post(checkout().url, {
			plan_slug: pendingSlug,
			gateway: pendingGateway
		});
		setPendingSlug(null);
	};
	const usagePercent = summary.limit === 0 ? 0 : Math.min(100, summary.percent);
	const overLimit = summary.limit > 0 && summary.used >= summary.limit;
	const nearLimit = !overLimit && usagePercent >= 80;
	const getPlanFeatures = (plan) => {
		return Array.isArray(plan.features) ? plan.features : [];
	};
	const [interval, setInterval] = useState("month");
	const anyYearly = plans.some((p) => typeof p.yearly_price_cents === "number" && p.yearly_price_cents > 0);
	const formatRowValue = (value) => {
		if (typeof value === "string") return {
			text: value,
			icon: "check"
		};
		if (typeof value === "boolean") return value ? {
			text: t("Included"),
			icon: "check"
		} : {
			text: t("Not included"),
			icon: "x"
		};
		if (value === null) return {
			text: t("Unlimited"),
			icon: "check"
		};
		if (value === 0) return {
			text: t("Not included"),
			icon: "x"
		};
		return {
			text: formatLimit(value, t),
			icon: "check"
		};
	};
	const featureRows = (plan) => [
		{
			key: "conversations",
			label: t("Conversations per month"),
			value: plan.monthly_conversations === 0 ? null : plan.monthly_conversations
		},
		{
			key: "messages",
			label: t("AI messages per month"),
			value: plan.monthly_messages
		},
		{
			key: "agents",
			label: t("AI agents"),
			value: plan.agents_limit
		},
		{
			key: "sources",
			label: t("Knowledge sources"),
			value: plan.sources_limit
		},
		{
			key: "workflows",
			label: t("Workflows"),
			value: plan.workflows_limit
		},
		{
			key: "integrations",
			label: t("Integrations"),
			value: plan.integrations_limit
		},
		{
			key: "members",
			label: t("Team members"),
			value: plan.members_limit
		},
		{
			key: "workspaces",
			label: t("Workspaces per owner"),
			value: plan.workspaces_limit
		},
		{
			key: "api",
			label: t("API access"),
			value: plan.api_access
		},
		{
			key: "branding",
			label: t("Remove \"Powered by\" branding"),
			value: plan.remove_branding
		}
	];
	const planDisplayPriceCents = (plan) => {
		if (interval === "year" && typeof plan.yearly_price_cents === "number" && plan.yearly_price_cents > 0) return plan.yearly_price_cents;
		return plan.price_cents;
	};
	const planSavingsLabel = (plan) => {
		if (interval !== "year" || !plan.yearly_price_cents || plan.yearly_price_cents <= 0 || plan.price_cents <= 0) return null;
		const fullYear = plan.price_cents * 12;
		const saved = fullYear - plan.yearly_price_cents;
		if (saved <= 0) return null;
		return t("Save :pct%", { pct: Math.round(saved / fullYear * 100) });
	};
	return /* @__PURE__ */ jsxs(AppLayout, {
		breadcrumbs: [{
			title: t("Billing"),
			href: "/app/billing"
		}],
		children: [
			/* @__PURE__ */ jsx(Head, { title: t("Billing") }),
			/* @__PURE__ */ jsxs("div", {
				className: "flex flex-1 flex-col gap-6 p-4",
				children: [
					/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("h1", {
						className: "text-2xl font-semibold tracking-tight",
						children: t("Billing")
					}), /* @__PURE__ */ jsx("p", {
						className: "mt-1 text-sm text-muted-foreground",
						children: t("Plans, usage, and subscription for this workspace.")
					})] }),
					trial?.expired && /* @__PURE__ */ jsxs(Card, {
						className: "border-rose-500/30 bg-rose-500/5 p-4",
						children: [/* @__PURE__ */ jsx("p", {
							className: "text-sm font-medium text-rose-700 dark:text-rose-400",
							children: t("Your free trial has ended.")
						}), /* @__PURE__ */ jsx("p", {
							className: "mt-1 text-sm text-rose-700/80 dark:text-rose-400/80",
							children: t("Choose a plan below to reactivate your workspace. Your agents, sources, and conversations are kept safe in the meantime.")
						})]
					}),
					checkoutStatus === "success" && /* @__PURE__ */ jsx(Card, {
						className: "border-emerald-500/30 bg-emerald-500/5 p-4",
						children: /* @__PURE__ */ jsx("p", {
							className: "text-sm text-emerald-700 dark:text-emerald-400",
							children: t("Subscription confirmed — your new plan is active. If you don't see the change yet, it'll appear once the payment provider finishes notifying us (usually within a few seconds).")
						})
					}),
					checkoutStatus === "cancelled" && /* @__PURE__ */ jsx(Card, {
						className: "border-amber-500/30 bg-amber-500/5 p-4",
						children: /* @__PURE__ */ jsx("p", {
							className: "text-sm text-amber-700 dark:text-amber-400",
							children: t("Checkout cancelled — no charge was made.")
						})
					}),
					/* @__PURE__ */ jsxs(Card, {
						className: "p-5",
						children: [
							/* @__PURE__ */ jsxs("div", {
								className: "flex flex-wrap items-center justify-between gap-3",
								children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
									className: "text-xs tracking-wide text-muted-foreground uppercase",
									children: t("Current plan")
								}), /* @__PURE__ */ jsx("p", {
									className: "mt-1 text-xl font-semibold",
									children: summary.plan?.name ?? t("Free")
								})] }), /* @__PURE__ */ jsxs("div", {
									className: "text-end",
									children: [/* @__PURE__ */ jsx("p", {
										className: "text-xs tracking-wide text-muted-foreground uppercase",
										children: t("This month")
									}), /* @__PURE__ */ jsxs("p", {
										className: "mt-1 text-xl font-semibold",
										children: [summary.used.toLocaleString(), /* @__PURE__ */ jsxs("span", {
											className: "text-sm font-normal text-muted-foreground",
											children: [
												" ",
												"/",
												" ",
												summary.limit === 0 ? t("Unlimited") : t(":count conversations", { count: summary.limit.toLocaleString() })
											]
										})]
									})]
								})]
							}),
							has_active_subscription && /* @__PURE__ */ jsxs("div", {
								className: "mt-4 flex flex-wrap justify-end gap-2",
								children: [
									subscription_cancel_at_period_end && active_gateway === "stripe" && /* @__PURE__ */ jsx(Button, {
										variant: "outline",
										size: "sm",
										onClick: onResume,
										children: t("Resume subscription")
									}),
									!subscription_cancel_at_period_end && /* @__PURE__ */ jsx(Button, {
										variant: "outline",
										size: "sm",
										onClick: onCancel,
										className: "text-rose-600 hover:bg-rose-500/10 hover:text-rose-700",
										children: t("Cancel subscription")
									}),
									/* @__PURE__ */ jsx(Button, {
										asChild: true,
										variant: "outline",
										size: "sm",
										children: /* @__PURE__ */ jsx("a", {
											href: portal().url,
											children: t("Manage subscription")
										})
									})
								]
							}),
							subscription_cancel_at_period_end && /* @__PURE__ */ jsx("p", {
								className: "mt-3 text-xs text-amber-600 dark:text-amber-400",
								children: t("Your subscription is scheduled to end at the close of the current billing period. Resume to keep your plan.")
							}),
							summary.limit > 0 && /* @__PURE__ */ jsxs("div", {
								className: "mt-4",
								children: [
									/* @__PURE__ */ jsx("div", {
										className: "h-2 w-full overflow-hidden rounded-full bg-muted",
										children: /* @__PURE__ */ jsx("div", {
											className: `h-full transition-all ${overLimit ? "bg-rose-500" : nearLimit ? "bg-amber-500" : "bg-emerald-500"}`,
											style: { width: `${usagePercent}%` }
										})
									}),
									overLimit && /* @__PURE__ */ jsx("p", {
										className: "mt-2 text-xs text-rose-600 dark:text-rose-400",
										children: t("You've reached your monthly conversation limit. New visitors get a friendly \"we're full\" message until you upgrade or the month resets.")
									}),
									nearLimit && /* @__PURE__ */ jsx("p", {
										className: "mt-2 text-xs text-amber-600 dark:text-amber-400",
										children: t(":pct% of your monthly conversation budget remaining.", { pct: 100 - usagePercent })
									})
								]
							}),
							/* @__PURE__ */ jsx("p", {
								className: "mt-3 text-xs text-muted-foreground",
								children: t("One unique visitor session counts as one conversation, no matter how many messages they send. Reopening the chat in the same browser stays on the same conversation. The counter resets on the 1st of each month.")
							})
						]
					}),
					anyYearly && /* @__PURE__ */ jsx("div", {
						className: "flex items-center justify-center",
						children: /* @__PURE__ */ jsx("div", {
							role: "radiogroup",
							"aria-label": t("Billing interval"),
							className: "inline-flex rounded-full border bg-muted/40 p-1 text-sm",
							children: [{
								v: "month",
								label: t("Monthly")
							}, {
								v: "year",
								label: t("Yearly")
							}].map((opt) => /* @__PURE__ */ jsx("button", {
								type: "button",
								role: "radio",
								"aria-checked": interval === opt.v,
								onClick: () => setInterval(opt.v),
								className: interval === opt.v ? "rounded-full bg-foreground px-4 py-1.5 font-medium text-background" : "rounded-full px-4 py-1.5 text-muted-foreground hover:text-foreground",
								children: opt.label
							}, opt.v))
						})
					}),
					/* @__PURE__ */ jsx("div", {
						className: "grid gap-4 md:grid-cols-2 xl:grid-cols-4",
						children: plans.map((plan) => {
							const isCurrent = plan.slug === currentSlug;
							const tagline = TAGLINE[plan.slug] ?? "";
							const displayCents = planDisplayPriceCents(plan);
							const savings = planSavingsLabel(plan);
							const isYearlyView = interval === "year" && typeof plan.yearly_price_cents === "number" && plan.yearly_price_cents > 0;
							return /* @__PURE__ */ jsxs(Card, {
								className: `flex flex-col p-5 ${isCurrent ? "border-foreground/30 ring-1 ring-foreground/20" : ""}`,
								children: [
									/* @__PURE__ */ jsxs("div", {
										className: "mb-4 flex items-center gap-2",
										children: [
											/* @__PURE__ */ jsx("h2", {
												className: "text-xl font-semibold tracking-tight",
												children: plan.name
											}),
											plan.slug === "standard" && /* @__PURE__ */ jsx("span", {
												className: "rounded bg-gradient-to-r from-violet-500 to-orange-500 px-1.5 py-0.5 text-[10px] font-semibold tracking-wide text-white uppercase",
												children: t("Popular")
											}),
											isCurrent && /* @__PURE__ */ jsx("span", {
												className: "rounded bg-foreground/10 px-1.5 py-0.5 text-[10px] font-semibold tracking-wide uppercase",
												children: t("Current")
											})
										]
									}),
									/* @__PURE__ */ jsx("p", {
										className: "text-xs text-muted-foreground",
										children: tagline
									}),
									/* @__PURE__ */ jsxs("div", {
										className: "mt-6",
										children: [
											/* @__PURE__ */ jsx("span", {
												className: "text-3xl font-semibold",
												children: formatPrice$3(displayCents, plan.slug, t)
											}),
											plan.slug !== "custom" && /* @__PURE__ */ jsx("span", {
												className: "ms-1 text-xs text-muted-foreground",
												children: isYearlyView ? t("/ year") : t("/ month")
											}),
											savings && /* @__PURE__ */ jsx("span", {
												className: "ms-2 rounded bg-emerald-500/15 px-1.5 py-0.5 text-[10px] font-semibold text-emerald-700 dark:text-emerald-400",
												children: savings
											})
										]
									}),
									/* @__PURE__ */ jsxs("ul", {
										className: "mt-5 flex-1 space-y-2 text-sm",
										children: [featureRows(plan).map((row) => {
											const { text, icon } = formatRowValue(row.value);
											return /* @__PURE__ */ jsxs("li", {
												className: "flex items-start gap-2",
												children: [/* @__PURE__ */ jsx(icon === "check" ? Check : icon === "x" ? X : Minus, { className: `mt-0.5 size-4 shrink-0 ${icon === "check" ? "text-emerald-600" : icon === "x" ? "text-muted-foreground/60" : "text-muted-foreground"}` }), /* @__PURE__ */ jsxs("span", {
													className: icon === "x" ? "text-muted-foreground line-through" : void 0,
													children: [
														row.label,
														": ",
														text
													]
												})]
											}, row.key);
										}), getPlanFeatures(plan).map((f) => /* @__PURE__ */ jsxs("li", {
											className: "flex items-start gap-2",
											children: [/* @__PURE__ */ jsx(Check, { className: "mt-0.5 size-4 shrink-0 text-emerald-600" }), /* @__PURE__ */ jsx("span", { children: f })]
										}, f))]
									}),
									/* @__PURE__ */ jsx("div", {
										className: "mt-6",
										children: isCurrent ? /* @__PURE__ */ jsx(Button, {
											variant: "outline",
											className: "w-full",
											disabled: true,
											children: t("Current plan")
										}) : plan.slug === "custom" ? /* @__PURE__ */ jsx(Button, {
											asChild: true,
											variant: "outline",
											className: "w-full",
											children: /* @__PURE__ */ jsx("a", {
												href: "mailto:sales@pitchbar.io?subject=Custom plan",
												children: t("Contact sales")
											})
										}) : /* @__PURE__ */ jsx(Button, {
											className: "w-full",
											disabled: !plan.is_purchasable,
											onClick: () => onChoose(plan.slug),
											title: !plan.is_purchasable ? t("No payment gateway is configured for this install yet") : void 0,
											children: !plan.is_purchasable ? t("Coming soon") : has_active_subscription ? (summary.plan?.price_cents ?? 0) < plan.price_cents ? t("Upgrade to :name", { name: plan.name }) : t("Downgrade to :name", { name: plan.name }) : t("Choose :name", { name: plan.name })
										})
									})
								]
							}, plan.id);
						})
					}),
					!anyConfigured && /* @__PURE__ */ jsx(Card, {
						className: "border-dashed p-4",
						children: /* @__PURE__ */ jsxs("p", {
							className: "text-sm text-muted-foreground",
							children: [
								t("No payment gateway is configured yet, so paid plans show as \"Coming soon\". Configure Stripe, PayPal, or Razorpay in"),
								" ",
								/* @__PURE__ */ jsx("code", {
									className: "rounded bg-muted px-1 py-0.5 text-xs",
									children: t("Settings → System → Billing")
								}),
								" ",
								t("to enable upgrades.")
							]
						})
					}),
					!stripe_configured && anyConfigured && /* @__PURE__ */ jsx(Card, {
						className: "border-dashed p-4",
						children: /* @__PURE__ */ jsx("p", {
							className: "text-xs text-muted-foreground",
							children: t("Stripe isn't configured on this install — paid plans still work via :gateways but card-only checkout via Stripe is unavailable.", { gateways: gateways.join(" / ") })
						})
					})
				]
			}),
			/* @__PURE__ */ jsx(Dialog, {
				open: pendingSlug !== null,
				onOpenChange: (open) => {
					if (!open) setPendingSlug(null);
				},
				children: /* @__PURE__ */ jsxs(DialogContent, { children: [
					/* @__PURE__ */ jsx(DialogHeader, { children: /* @__PURE__ */ jsx(DialogTitle, { children: t("Pick a payment method") }) }),
					/* @__PURE__ */ jsx("div", {
						className: "space-y-2",
						children: gateways.map((g) => /* @__PURE__ */ jsxs("label", {
							className: `flex cursor-pointer items-center gap-3 rounded border p-3 text-sm transition ${pendingGateway === g ? "border-foreground/40 bg-foreground/5" : "border-border hover:bg-foreground/5"}`,
							children: [/* @__PURE__ */ jsx("input", {
								type: "radio",
								name: "gateway",
								value: g,
								checked: pendingGateway === g,
								onChange: () => setPendingGateway(g)
							}), /* @__PURE__ */ jsx("span", { children: GATEWAY_LABEL[g] })]
						}, g))
					}),
					/* @__PURE__ */ jsxs(DialogFooter, { children: [/* @__PURE__ */ jsx(Button, {
						variant: "outline",
						onClick: () => setPendingSlug(null),
						children: t("Cancel")
					}), /* @__PURE__ */ jsx(Button, {
						onClick: onConfirmGateway,
						disabled: pendingGateway === null,
						children: t("Continue")
					})] })
				] })
			}),
			(invoices.length > 0 || charges.length > 0 || lifetime) && /* @__PURE__ */ jsxs("div", {
				className: "mt-10 space-y-6 px-4 pb-12",
				children: [
					lifetime && /* @__PURE__ */ jsxs(Card, {
						className: "p-6",
						children: [/* @__PURE__ */ jsx("h2", {
							className: "text-lg font-semibold",
							children: t("Lifetime access")
						}), /* @__PURE__ */ jsxs("p", {
							className: "mt-1 text-sm text-muted-foreground",
							children: [lifetime.plan_name, lifetime.purchased_at && " · " + t("owned since :date", { date: new Date(lifetime.purchased_at).toLocaleDateString() })]
						})]
					}),
					invoices.length > 0 && /* @__PURE__ */ jsxs(Card, {
						className: "p-6",
						children: [/* @__PURE__ */ jsxs("div", {
							className: "flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",
							children: [/* @__PURE__ */ jsx("h2", {
								className: "text-lg font-semibold",
								children: t("Invoices")
							}), /* @__PURE__ */ jsxs("div", {
								className: "flex flex-col gap-2 sm:flex-row sm:items-center",
								children: [/* @__PURE__ */ jsxs(Select, {
									value: invoicesStatus,
									onValueChange: (v) => {
										setInvoicesStatus(v);
										setInvoicesPage(1);
									},
									children: [/* @__PURE__ */ jsx(SelectTrigger, {
										className: "h-8 w-full text-xs sm:w-40",
										children: /* @__PURE__ */ jsx(SelectValue, { placeholder: t("All statuses") })
									}), /* @__PURE__ */ jsxs(SelectContent, { children: [/* @__PURE__ */ jsx(SelectItem, {
										value: "all",
										children: t("All statuses")
									}), invoicesStatusOptions.map((s) => /* @__PURE__ */ jsx(SelectItem, {
										value: s,
										children: s.charAt(0).toUpperCase() + s.slice(1)
									}, s))] })]
								}), /* @__PURE__ */ jsxs("div", {
									className: "relative w-full sm:w-64",
									children: [/* @__PURE__ */ jsx(Search, { className: "absolute top-1/2 left-2 size-3.5 -translate-y-1/2 text-muted-foreground" }), /* @__PURE__ */ jsx(Input, {
										placeholder: t("Search invoice number…"),
										value: invoicesSearch,
										onChange: (e) => {
											setInvoicesSearch(e.target.value);
											setInvoicesPage(1);
										},
										className: "h-8 pl-7 text-xs"
									})]
								})]
							})]
						}), /* @__PURE__ */ jsxs("div", {
							className: "mt-4 overflow-hidden rounded-md border",
							children: [/* @__PURE__ */ jsx("div", {
								className: "overflow-auto",
								children: /* @__PURE__ */ jsxs("table", {
									className: "w-full border-separate border-spacing-0 text-start text-sm",
									children: [/* @__PURE__ */ jsx("thead", {
										className: "bg-card text-xs font-medium text-muted-foreground",
										children: /* @__PURE__ */ jsxs("tr", { children: [
											/* @__PURE__ */ jsx("th", {
												className: "border-e border-b px-3 py-2 text-start",
												children: t("Invoice")
											}),
											/* @__PURE__ */ jsx("th", {
												className: "border-e border-b px-3 py-2 text-start",
												children: t("Date")
											}),
											/* @__PURE__ */ jsx("th", {
												className: "border-e border-b px-3 py-2 text-start",
												children: t("Status")
											}),
											/* @__PURE__ */ jsx("th", {
												className: "border-e border-b px-3 py-2 text-end",
												children: t("Amount")
											}),
											/* @__PURE__ */ jsx("th", {
												className: "border-b px-3 py-2 text-end",
												children: /* @__PURE__ */ jsx("span", {
													className: "sr-only",
													children: t("Actions")
												})
											})
										] })
									}), /* @__PURE__ */ jsxs("tbody", { children: [invoicesPaginated.length === 0 && /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx("td", {
										colSpan: 5,
										className: "border-b px-3 py-8 text-center text-muted-foreground",
										children: t("No invoices match these filters.")
									}) }), invoicesPaginated.map((inv) => /* @__PURE__ */ jsxs("tr", {
										className: "group hover:bg-muted/35",
										children: [
											/* @__PURE__ */ jsx("td", {
												className: "border-e border-b px-3 py-2 font-medium",
												children: inv.number ?? inv.id
											}),
											/* @__PURE__ */ jsx("td", {
												className: "border-e border-b px-3 py-2 text-muted-foreground",
												children: inv.created_at ? new Date(inv.created_at).toLocaleDateString() : "—"
											}),
											/* @__PURE__ */ jsx("td", {
												className: "border-e border-b px-3 py-2",
												children: /* @__PURE__ */ jsx(InvoiceStatusBadge, { status: inv.status })
											}),
											/* @__PURE__ */ jsxs("td", {
												className: "border-e border-b px-3 py-2 text-end tabular-nums",
												children: [
													inv.currency.toUpperCase(),
													" ",
													(inv.total_cents / 100).toFixed(2)
												]
											}),
											/* @__PURE__ */ jsx("td", {
												className: "border-b px-3 py-2 text-end",
												children: inv.source === "stripe" && /* @__PURE__ */ jsx("a", {
													href: `/app/billing/invoices/${inv.id}/download`,
													className: "rounded-md border px-2.5 py-1 text-xs hover:bg-muted",
													children: t("Download")
												})
											})
										]
									}, inv.id))] })]
								})
							}), filteredInvoices.length > INVOICES_PER_PAGE && /* @__PURE__ */ jsxs("div", {
								className: "flex min-h-8 items-center justify-between gap-3 border-t bg-muted/20 px-4 py-1.5 text-xs text-muted-foreground",
								children: [/* @__PURE__ */ jsxs("span", { children: [
									t("Showing"),
									" ",
									/* @__PURE__ */ jsx("span", {
										className: "font-medium text-foreground",
										children: invoicesRangeStart
									}),
									"–",
									/* @__PURE__ */ jsx("span", {
										className: "font-medium text-foreground",
										children: invoicesRangeEnd
									}),
									" ",
									t("of"),
									" ",
									/* @__PURE__ */ jsx("span", {
										className: "font-medium text-foreground",
										children: filteredInvoices.length
									})
								] }), /* @__PURE__ */ jsxs("div", {
									className: "flex items-center gap-1",
									children: [
										/* @__PURE__ */ jsx("button", {
											type: "button",
											onClick: () => setInvoicesPage((p) => Math.max(1, p - 1)),
											disabled: invoicesPage <= 1,
											"aria-label": t("Previous page"),
											className: "flex size-6 items-center justify-center rounded-md border bg-card text-foreground transition hover:bg-muted disabled:cursor-not-allowed disabled:opacity-40",
											children: /* @__PURE__ */ jsx(ChevronLeft, { className: "size-4" })
										}),
										/* @__PURE__ */ jsxs("span", {
											className: "px-2 tabular-nums",
											children: [
												invoicesPage,
												" /",
												" ",
												invoicesTotalPages
											]
										}),
										/* @__PURE__ */ jsx("button", {
											type: "button",
											onClick: () => setInvoicesPage((p) => Math.min(invoicesTotalPages, p + 1)),
											disabled: invoicesPage >= invoicesTotalPages,
											"aria-label": t("Next page"),
											className: "flex size-6 items-center justify-center rounded-md border bg-card text-foreground transition hover:bg-muted disabled:cursor-not-allowed disabled:opacity-40",
											children: /* @__PURE__ */ jsx(ChevronRight, { className: "size-4" })
										})
									]
								})]
							})]
						})]
					}),
					charges.length > 0 && /* @__PURE__ */ jsxs(Card, {
						className: "p-6",
						children: [/* @__PURE__ */ jsx("h2", {
							className: "text-lg font-semibold",
							children: t("Order history")
						}), /* @__PURE__ */ jsx("div", {
							className: "mt-4 overflow-auto rounded-md border",
							children: /* @__PURE__ */ jsxs("table", {
								className: "w-full min-w-[520px] border-separate border-spacing-0 text-start text-sm",
								children: [/* @__PURE__ */ jsx("thead", {
									className: "bg-card text-xs font-medium text-muted-foreground",
									children: /* @__PURE__ */ jsxs("tr", { children: [
										/* @__PURE__ */ jsx("th", {
											className: "border-e border-b px-3 py-2 text-start",
											children: t("Description")
										}),
										/* @__PURE__ */ jsx("th", {
											className: "border-e border-b px-3 py-2 text-start",
											children: t("Date")
										}),
										/* @__PURE__ */ jsx("th", {
											className: "border-b px-3 py-2 text-end",
											children: t("Amount")
										})
									] })
								}), /* @__PURE__ */ jsx("tbody", { children: charges.map((c) => /* @__PURE__ */ jsxs("tr", {
									className: "group hover:bg-muted/35",
									children: [
										/* @__PURE__ */ jsx("td", {
											className: "border-e border-b px-3 py-2 font-medium",
											children: c.description
										}),
										/* @__PURE__ */ jsx("td", {
											className: "border-e border-b px-3 py-2 text-muted-foreground",
											children: c.created_at ? new Date(c.created_at).toLocaleDateString() : "—"
										}),
										/* @__PURE__ */ jsxs("td", {
											className: "border-b px-3 py-2 text-end tabular-nums",
											children: [
												c.currency.toUpperCase(),
												" ",
												(c.total_cents / 100).toFixed(2)
											]
										})
									]
								}, c.id)) })]
							})
						})]
					})
				]
			})
		]
	});
}
//#endregion
//#region resources/js/pages/app/conversations/index.tsx
var conversations_exports = /* @__PURE__ */ __exportAll({ default: () => WorkspaceConversationsPage });
function useLivePoll(active) {
	useEffect(() => {
		if (!active) return;
		const tick = () => {
			if (document.visibilityState !== "visible") return;
			router.reload({ only: [
				"conversations",
				"pagination",
				"totals"
			] });
		};
		const id = window.setInterval(tick, 5e3);
		return () => window.clearInterval(id);
	}, [active]);
}
function relativeTime$4(iso, t) {
	if (!iso) return "—";
	const ms = Date.now() - new Date(iso).getTime();
	const sec = Math.max(1, Math.round(ms / 1e3));
	if (sec < 60) return t("just now");
	const min = Math.round(sec / 60);
	if (min < 60) return t(":count m ago", { count: min });
	const hour = Math.round(min / 60);
	if (hour < 24) return t(":count h ago", { count: hour });
	return t(":count d ago", { count: Math.round(hour / 24) });
}
function WorkspaceConversationsPage({ totals, conversations, pagination, filters, available_tags, can_delete }) {
	const { t } = useT();
	const confirm = useConfirm();
	const breadcrumbs = [{
		title: t("Conversations"),
		href: index$10()
	}];
	const isEmpty = conversations.length === 0;
	const hasQuery = filters.q.trim() !== "";
	const activeFilter = filters.filter ?? "";
	const activeTag = filters.tag ?? "";
	const showMode = filters.show === "all" ? "all" : "engaged";
	const [selected, setSelected] = useState(/* @__PURE__ */ new Set());
	const buildQuery = (overrides) => {
		const base = {};
		if (filters.q) base.q = filters.q;
		if (activeFilter) base.filter = activeFilter;
		if (activeTag) base.tag = activeTag;
		if (showMode === "all") base.show = "all";
		return {
			...base,
			...overrides
		};
	};
	const setFilter = (next) => {
		const query = buildQuery({});
		if (next) query.filter = next;
		else delete query.filter;
		setSelected(/* @__PURE__ */ new Set());
		router.get(index$10(), query, {
			preserveScroll: true,
			preserveState: true,
			only: [
				"conversations",
				"pagination",
				"filters",
				"totals"
			]
		});
	};
	const setShowMode = (next) => {
		const query = buildQuery({});
		if (next === "all") query.show = "all";
		else delete query.show;
		setSelected(/* @__PURE__ */ new Set());
		router.get(index$10(), query, {
			preserveScroll: true,
			preserveState: true,
			only: [
				"conversations",
				"pagination",
				"filters",
				"totals"
			]
		});
	};
	const toggleRow = (id) => {
		setSelected((prev) => {
			const next = new Set(prev);
			if (next.has(id)) next.delete(id);
			else next.add(id);
			return next;
		});
	};
	const allOnPageSelected = useMemo(() => conversations.length > 0 && conversations.every((c) => selected.has(c.id)), [conversations, selected]);
	const toggleAllOnPage = () => {
		setSelected((prev) => {
			if (allOnPageSelected) {
				const next = new Set(prev);
				conversations.forEach((c) => next.delete(c.id));
				return next;
			}
			const next = new Set(prev);
			conversations.forEach((c) => next.add(c.id));
			return next;
		});
	};
	const deleteOne = async (id) => {
		if (!can_delete) return;
		if (!await confirm({
			title: t("Delete conversation?"),
			message: t("Delete this conversation? This cannot be undone."),
			confirmLabel: t("Delete"),
			danger: true
		})) return;
		router.delete(destroy$11(id), { preserveScroll: true });
	};
	const deleteSelected = async () => {
		if (!can_delete || selected.size === 0) return;
		const count = selected.size;
		if (!await confirm({
			title: t("Delete conversations?"),
			message: t("Delete :count conversations? This cannot be undone.", { count }),
			confirmLabel: t("Delete"),
			danger: true
		})) return;
		router.post(bulkDestroy$2(), {
			mode: "ids",
			ids: Array.from(selected)
		}, {
			preserveScroll: true,
			onSuccess: () => setSelected(/* @__PURE__ */ new Set())
		});
	};
	const deleteAllEmpty = async () => {
		if (!can_delete || totals.empty === 0) return;
		if (!await confirm({
			title: t("Delete empty conversations?"),
			message: t("Delete all :count empty conversations across this workspace? Sessions with at least one visitor message are kept.", { count: totals.empty }),
			confirmLabel: t("Delete"),
			danger: true
		})) return;
		router.post(bulkDestroy$2(), { mode: "empty" }, { preserveScroll: true });
	};
	useLivePoll(activeFilter !== "");
	return /* @__PURE__ */ jsxs(AppLayout, {
		breadcrumbs,
		children: [/* @__PURE__ */ jsx(Head, { title: t("Conversations") }), /* @__PURE__ */ jsxs("div", {
			className: "flex flex-1 flex-col gap-4 p-4",
			children: [
				/* @__PURE__ */ jsxs("div", {
					className: "flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",
					children: [/* @__PURE__ */ jsxs("div", {
						className: "min-w-0",
						children: [/* @__PURE__ */ jsx("h1", {
							className: "text-2xl font-semibold tracking-tight",
							children: t("Conversations")
						}), /* @__PURE__ */ jsx("p", {
							className: "mt-1 text-sm text-muted-foreground",
							children: t("Visitor sessions across every agent in this workspace. Open a thread to see exactly what people asked and how your agent replied.")
						})]
					}), /* @__PURE__ */ jsx("div", {
						className: "w-full sm:w-64 sm:shrink-0",
						children: /* @__PURE__ */ jsx(TableSearch, {
							placeholder: t("Search by agent, question, page URL, or anon id…"),
							initialValue: filters.q,
							only: [
								"conversations",
								"pagination",
								"filters"
							]
						})
					})]
				}),
				/* @__PURE__ */ jsxs("div", {
					className: "grid grid-cols-1 gap-3 sm:grid-cols-2 xl:grid-cols-5",
					children: [
						/* @__PURE__ */ jsxs(Card, {
							className: "p-4",
							children: [
								/* @__PURE__ */ jsx("p", {
									className: "text-xs tracking-wide text-muted-foreground uppercase",
									children: t("Total conversations")
								}),
								/* @__PURE__ */ jsx("p", {
									className: "mt-1 text-2xl font-semibold tabular-nums",
									children: totals.conversations.toLocaleString()
								}),
								/* @__PURE__ */ jsx("p", {
									className: "mt-0.5 text-xs text-muted-foreground",
									children: t("all tracked visitor sessions")
								})
							]
						}),
						/* @__PURE__ */ jsxs(Card, {
							className: "p-4",
							children: [
								/* @__PURE__ */ jsx("p", {
									className: "text-xs tracking-wide text-muted-foreground uppercase",
									children: t("Messages")
								}),
								/* @__PURE__ */ jsx("p", {
									className: "mt-1 text-2xl font-semibold tabular-nums",
									children: totals.messages.toLocaleString()
								}),
								/* @__PURE__ */ jsx("p", {
									className: "mt-0.5 text-xs text-muted-foreground",
									children: t("customer and agent replies")
								})
							]
						}),
						/* @__PURE__ */ jsxs(Card, {
							className: "p-4",
							children: [
								/* @__PURE__ */ jsx("p", {
									className: "text-xs tracking-wide text-muted-foreground uppercase",
									children: t("Last 24h")
								}),
								/* @__PURE__ */ jsx("p", {
									className: "mt-1 text-2xl font-semibold tabular-nums",
									children: totals.last_24h.toLocaleString()
								}),
								/* @__PURE__ */ jsx("p", {
									className: "mt-0.5 text-xs text-muted-foreground",
									children: t("new conversations started")
								})
							]
						}),
						/* @__PURE__ */ jsxs(Card, {
							className: "p-4",
							children: [
								/* @__PURE__ */ jsx("p", {
									className: "text-xs tracking-wide text-muted-foreground uppercase",
									children: t("Leads captured")
								}),
								/* @__PURE__ */ jsx("p", {
									className: "mt-1 text-2xl font-semibold tabular-nums",
									children: totals.leads.toLocaleString()
								}),
								/* @__PURE__ */ jsx("p", {
									className: "mt-0.5 text-xs text-muted-foreground",
									children: t("handoffs from these conversations")
								})
							]
						}),
						/* @__PURE__ */ jsxs(Card, {
							className: "p-4",
							children: [
								/* @__PURE__ */ jsx("p", {
									className: "text-xs tracking-wide text-muted-foreground uppercase",
									children: t("Active agents")
								}),
								/* @__PURE__ */ jsx("p", {
									className: "mt-1 text-2xl font-semibold tabular-nums",
									children: totals.active_agents.toLocaleString()
								}),
								/* @__PURE__ */ jsx("p", {
									className: "mt-0.5 text-xs text-muted-foreground",
									children: t("agents with live traffic")
								})
							]
						})
					]
				}),
				/* @__PURE__ */ jsxs("div", {
					className: "flex flex-wrap items-center gap-2",
					children: [
						/* @__PURE__ */ jsx(FilterPill, {
							label: t("All"),
							active: activeFilter === "",
							onClick: () => setFilter("")
						}),
						/* @__PURE__ */ jsx(FilterPill, {
							label: t("Needs human"),
							count: totals.needs_human,
							active: activeFilter === "needs_human",
							onClick: () => setFilter("needs_human"),
							accent: "amber",
							icon: /* @__PURE__ */ jsx(Hand, { className: "size-3" })
						}),
						/* @__PURE__ */ jsx(FilterPill, {
							label: t("Live now"),
							count: totals.live_now,
							active: activeFilter === "live_now",
							onClick: () => setFilter("live_now"),
							accent: "emerald",
							icon: /* @__PURE__ */ jsx(Headset, { className: "size-3" })
						}),
						/* @__PURE__ */ jsxs("div", {
							className: "ml-2 inline-flex overflow-hidden rounded-full border text-xs font-medium",
							children: [/* @__PURE__ */ jsx("button", {
								type: "button",
								onClick: () => setShowMode("engaged"),
								className: `px-3 py-1 ${showMode === "engaged" ? "bg-foreground text-background" : "hover:bg-muted"}`,
								children: t("Engaged only")
							}), /* @__PURE__ */ jsxs("button", {
								type: "button",
								onClick: () => setShowMode("all"),
								className: `border-l px-3 py-1 ${showMode === "all" ? "bg-foreground text-background" : "hover:bg-muted"}`,
								children: [t("Show all"), totals.empty > 0 && /* @__PURE__ */ jsxs("span", {
									className: "ml-1 rounded-full bg-foreground/10 px-1.5 text-[10px] tabular-nums",
									children: ["+", totals.empty]
								})]
							})]
						}),
						available_tags.length > 0 && /* @__PURE__ */ jsxs("select", {
							value: activeTag,
							onChange: (e) => {
								const query = buildQuery({});
								if (e.target.value) query.tag = e.target.value;
								else delete query.tag;
								router.get(index$10(), query, {
									preserveScroll: true,
									preserveState: true,
									only: [
										"conversations",
										"pagination",
										"filters",
										"totals"
									]
								});
							},
							className: "rounded-full border bg-background px-3 py-1 text-xs font-medium hover:bg-muted",
							children: [/* @__PURE__ */ jsx("option", {
								value: "",
								children: t("All tags")
							}), available_tags.map((tag) => /* @__PURE__ */ jsx("option", {
								value: tag.id,
								children: tag.label
							}, tag.id))]
						}),
						can_delete && /* @__PURE__ */ jsxs("div", {
							className: "ml-auto flex items-center gap-2",
							children: [selected.size > 0 && /* @__PURE__ */ jsxs(Button, {
								type: "button",
								variant: "destructive",
								size: "sm",
								onClick: deleteSelected,
								className: "h-7 text-xs",
								children: [/* @__PURE__ */ jsx(Trash2, { className: "mr-1 size-3" }), t("Delete :count selected", { count: selected.size })]
							}), totals.empty > 0 && /* @__PURE__ */ jsxs(Button, {
								type: "button",
								variant: "outline",
								size: "sm",
								onClick: deleteAllEmpty,
								className: "h-7 text-xs",
								title: t("Wipes every conversation in this workspace that never received a visitor message."),
								children: [/* @__PURE__ */ jsx(Trash2, { className: "mr-1 size-3" }), t("Delete :count empty", { count: totals.empty })]
							})]
						})
					]
				}),
				isEmpty ? /* @__PURE__ */ jsxs(Card, {
					className: "p-8 text-center",
					children: [
						/* @__PURE__ */ jsx(MessagesSquare, { className: "mx-auto size-10 text-muted-foreground/40" }),
						/* @__PURE__ */ jsx("p", {
							className: "mt-3 text-sm font-medium",
							children: hasQuery ? t("No conversations match that search.") : showMode === "engaged" ? t("No engaged conversations yet.") : t("No conversations yet.")
						}),
						/* @__PURE__ */ jsx("p", {
							className: "mt-1 text-xs text-muted-foreground",
							children: hasQuery ? t("Try a different keyword or agent name.") : showMode === "engaged" ? t("Drive-by widget loads are hidden here. Toggle \"Show all\" to see every session.") : t("Once visitors start chatting with any agent in this workspace, those sessions will appear here.")
						})
					]
				}) : /* @__PURE__ */ jsxs(Card, {
					className: "p-0",
					children: [
						can_delete && /* @__PURE__ */ jsxs("div", {
							className: "flex items-center gap-2 border-b px-4 py-2 text-xs",
							children: [/* @__PURE__ */ jsx("input", {
								type: "checkbox",
								checked: allOnPageSelected,
								onChange: toggleAllOnPage,
								className: "size-3.5",
								"aria-label": t("Select all on page")
							}), /* @__PURE__ */ jsx("span", {
								className: "text-muted-foreground",
								children: selected.size > 0 ? t(":count selected", { count: selected.size }) : t("Select all on page")
							})]
						}),
						/* @__PURE__ */ jsx("div", {
							className: "divide-y",
							children: conversations.map((conversation) => {
								const isChecked = selected.has(conversation.id);
								return /* @__PURE__ */ jsxs("div", {
									className: "group flex items-start gap-3 px-4 py-3 transition hover:bg-muted/50",
									children: [
										can_delete && /* @__PURE__ */ jsx("input", {
											type: "checkbox",
											checked: isChecked,
											onChange: () => toggleRow(conversation.id),
											className: "mt-2 size-3.5",
											"aria-label": t("Select conversation")
										}),
										/* @__PURE__ */ jsxs(Link, {
											href: show$2(conversation.id),
											className: "flex min-w-0 flex-1 items-start gap-3",
											children: [
												/* @__PURE__ */ jsx("div", {
													className: "flex size-8 shrink-0 items-center justify-center rounded-full bg-muted",
													children: /* @__PURE__ */ jsx(Globe, { className: "size-4 text-muted-foreground" })
												}),
												/* @__PURE__ */ jsxs("div", {
													className: "min-w-0 flex-1",
													children: [
														/* @__PURE__ */ jsxs("div", {
															className: "flex flex-wrap items-center gap-2",
															children: [
																conversation.agent ? /* @__PURE__ */ jsxs("span", {
																	className: "inline-flex items-center gap-1 rounded-full bg-sky-500/10 px-2 py-0.5 text-[11px] font-medium text-sky-700 dark:text-sky-300",
																	children: [/* @__PURE__ */ jsx(Sparkles, { className: "size-3" }), conversation.agent.name]
																}) : null,
																conversation.is_returning && /* @__PURE__ */ jsx("span", {
																	className: "rounded bg-violet-500/15 px-1.5 py-0.5 text-[10px] font-medium text-violet-700 dark:text-violet-400",
																	children: t("returning")
																}),
																conversation.lang && conversation.lang !== "en" && /* @__PURE__ */ jsx("span", {
																	className: "rounded bg-sky-500/15 px-1.5 py-0.5 text-[10px] font-medium text-sky-700 uppercase dark:text-sky-400",
																	children: conversation.lang
																}),
																conversation.human_requested_at && !conversation.claimed_by_user_id && /* @__PURE__ */ jsxs("span", {
																	className: "inline-flex items-center gap-1 rounded-full bg-amber-500/15 px-2 py-0.5 text-[10px] font-semibold tracking-wider text-amber-700 uppercase",
																	children: [/* @__PURE__ */ jsx(Hand, { className: "size-3" }), t("Needs human")]
																}),
																conversation.claimed_by_user_id && /* @__PURE__ */ jsxs("span", {
																	className: "inline-flex items-center gap-1 rounded-full bg-emerald-500/15 px-2 py-0.5 text-[10px] font-semibold tracking-wider text-emerald-700 uppercase",
																	children: [/* @__PURE__ */ jsx(Headset, { className: "size-3" }), t("Live")]
																}),
																conversation.satisfaction === "positive" && /* @__PURE__ */ jsx("span", {
																	className: "inline-flex items-center gap-1 rounded-full bg-emerald-100 px-2 py-0.5 text-[10px] font-semibold text-emerald-800",
																	children: "👍"
																}),
																conversation.satisfaction === "negative" && /* @__PURE__ */ jsx("span", {
																	className: "inline-flex items-center gap-1 rounded-full bg-red-100 px-2 py-0.5 text-[10px] font-semibold text-red-800",
																	children: "👎"
																}),
																conversation.tags?.map((tag) => /* @__PURE__ */ jsx("span", {
																	className: "inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-[10px] font-semibold text-white",
																	style: { background: tag.color },
																	children: tag.label
																}, tag.id))
															]
														}),
														/* @__PURE__ */ jsx("p", {
															className: "mt-2 truncate text-sm font-medium",
															children: conversation.preview
														}),
														/* @__PURE__ */ jsx("p", {
															className: "mt-0.5 truncate text-xs text-muted-foreground",
															children: conversation.page_url ?? t("(no page url)")
														}),
														/* @__PURE__ */ jsxs("p", {
															className: "mt-1 inline-flex items-center gap-1 text-[11px] text-muted-foreground/80",
															children: [/* @__PURE__ */ jsx(User, { className: "size-3" }), conversation.visitor_anon ? conversation.visitor_anon.slice(0, 16) : t("(unknown visitor)")]
														})
													]
												}),
												/* @__PURE__ */ jsxs("div", {
													className: "flex shrink-0 flex-col items-end gap-1 text-end",
													children: [
														conversation.lead_score > 0 && /* @__PURE__ */ jsx(LeadScoreBadge, {
															score: conversation.lead_score,
															bucket: conversation.lead_score_bucket,
															reasons: conversation.lead_score_reasons
														}),
														/* @__PURE__ */ jsx("span", {
															className: "text-xs font-medium tabular-nums",
															children: t(":count msgs", { count: conversation.message_count })
														}),
														/* @__PURE__ */ jsx("span", {
															className: "text-[10px] text-muted-foreground",
															children: relativeTime$4(conversation.last_activity_at, t)
														})
													]
												}),
												/* @__PURE__ */ jsx(ChevronRight, { className: "mt-2 size-4 shrink-0 text-muted-foreground" })
											]
										}),
										can_delete && /* @__PURE__ */ jsx("button", {
											type: "button",
											onClick: () => deleteOne(conversation.id),
											className: "mt-1 ml-1 rounded-md p-1 text-muted-foreground opacity-0 transition group-hover:opacity-100 hover:bg-red-500/10 hover:text-red-600 focus:opacity-100",
											title: t("Delete conversation"),
											"aria-label": t("Delete conversation"),
											children: /* @__PURE__ */ jsx(Trash2, { className: "size-4" })
										})
									]
								}, conversation.id);
							})
						}),
						/* @__PURE__ */ jsx(TablePagination, {
							pagination,
							only: [
								"conversations",
								"pagination",
								"filters"
							]
						})
					]
				})
			]
		})]
	});
}
function FilterPill({ label, count, active, onClick, accent, icon }) {
	return /* @__PURE__ */ jsxs("button", {
		type: "button",
		onClick,
		className: `inline-flex items-center gap-1.5 rounded-full border px-3 py-1 text-xs font-medium transition ${accent === "amber" ? active ? "bg-amber-500 text-white border-amber-500" : "border-amber-300 bg-amber-50 text-amber-800 hover:bg-amber-100" : accent === "emerald" ? active ? "bg-emerald-600 text-white border-emerald-600" : "border-emerald-300 bg-emerald-50 text-emerald-800 hover:bg-emerald-100" : active ? "bg-foreground text-background border-foreground" : "border-border hover:bg-muted"}`,
		children: [
			icon,
			label,
			count !== void 0 && count > 0 && /* @__PURE__ */ jsx("span", {
				className: `rounded-full px-1.5 text-[10px] font-semibold tabular-nums ${active ? "bg-white/20" : "bg-foreground/10"}`,
				children: count
			})
		]
	});
}
//#endregion
//#region resources/js/components/live-chat/canned-reply-picker.tsx
/**
* Compact picker shown above the operator's reply textarea. Click the
* "Canned reply" button to drop a search list down. Selecting a row
* calls `onPick(content)` so the parent can fill its textarea
* (operator can edit before sending).
*
* Rolled in-house instead of pulling shadcn Popover because the only
* other dropdown surface in the admin shell is the workspace switcher,
* which uses dropdown-menu directly. Adding Popover for one component
* isn't worth the bundle delta.
*
* Renders nothing when the workspace has zero canned replies.
*/
function CannedReplyPicker({ replies, onPick }) {
	const { t } = useT();
	const [open, setOpen] = useState(false);
	const [query, setQuery] = useState("");
	const wrapRef = useRef(null);
	const filtered = useMemo(() => {
		const q = query.trim().toLowerCase();
		if (q === "") return replies;
		return replies.filter((r) => r.label.toLowerCase().includes(q) || r.content.toLowerCase().includes(q));
	}, [query, replies]);
	useEffect(() => {
		if (!open) return;
		const onClick = (e) => {
			if (wrapRef.current && !wrapRef.current.contains(e.target)) setOpen(false);
		};
		const onKey = (e) => {
			if (e.key === "Escape") setOpen(false);
		};
		document.addEventListener("mousedown", onClick);
		document.addEventListener("keydown", onKey);
		return () => {
			document.removeEventListener("mousedown", onClick);
			document.removeEventListener("keydown", onKey);
		};
	}, [open]);
	if (replies.length === 0) return null;
	return /* @__PURE__ */ jsxs("div", {
		ref: wrapRef,
		className: "relative",
		children: [/* @__PURE__ */ jsxs(Button, {
			type: "button",
			variant: "outline",
			size: "sm",
			className: "text-xs",
			onClick: () => setOpen((v) => !v),
			children: [/* @__PURE__ */ jsx(Sparkles, { className: "me-1.5 size-3.5" }), t("Canned reply")]
		}), open && /* @__PURE__ */ jsxs("div", {
			className: "absolute start-0 bottom-full z-50 mb-2 w-80 rounded-md border bg-popover shadow-lg",
			children: [/* @__PURE__ */ jsx("div", {
				className: "border-b p-2",
				children: /* @__PURE__ */ jsxs("div", {
					className: "relative",
					children: [/* @__PURE__ */ jsx(Search, { className: "absolute start-2 top-1/2 size-3.5 -translate-y-1/2 text-muted-foreground" }), /* @__PURE__ */ jsx(Input, {
						type: "text",
						placeholder: t("Search canned replies…"),
						value: query,
						onChange: (e) => setQuery(e.target.value),
						className: "h-8 ps-7 text-xs",
						autoFocus: true
					})]
				})
			}), /* @__PURE__ */ jsx("div", {
				className: "max-h-72 overflow-y-auto",
				children: filtered.length === 0 ? /* @__PURE__ */ jsx("p", {
					className: "p-4 text-center text-xs text-muted-foreground",
					children: t("No matches.")
				}) : filtered.map((r) => /* @__PURE__ */ jsxs("button", {
					type: "button",
					onClick: () => {
						onPick(r.content);
						setOpen(false);
						setQuery("");
					},
					className: "flex w-full flex-col gap-0.5 border-b p-2.5 text-start transition last:border-b-0 hover:bg-muted",
					children: [/* @__PURE__ */ jsx("span", {
						className: "text-xs font-semibold",
						children: r.label
					}), /* @__PURE__ */ jsx("span", {
						className: "line-clamp-2 text-[11px] text-muted-foreground",
						children: r.content
					})]
				}, r.id))
			})]
		})]
	});
}
//#endregion
//#region resources/js/components/live-chat/tag-picker.tsx
/**
* Inline tag editor for the conversation context panel. Shows already-
* applied tags as chips with an X to remove; "+ Add tag" opens a small
* fuzzy-search dropdown of unselected workspace tags.
*/
function TagPicker({ applied, available, onAttach, onDetach }) {
	const { t } = useT();
	const [open, setOpen] = useState(false);
	const [query, setQuery] = useState("");
	const wrapRef = useRef(null);
	const appliedIds = useMemo(() => new Set(applied.map((tag) => tag.id)), [applied]);
	const filtered = useMemo(() => {
		const q = query.trim().toLowerCase();
		return available.filter((tag) => !appliedIds.has(tag.id)).filter((tag) => q === "" || tag.label.toLowerCase().includes(q));
	}, [
		query,
		available,
		appliedIds
	]);
	useEffect(() => {
		if (!open) return;
		const onClick = (e) => {
			if (wrapRef.current && !wrapRef.current.contains(e.target)) setOpen(false);
		};
		const onKey = (e) => {
			if (e.key === "Escape") setOpen(false);
		};
		document.addEventListener("mousedown", onClick);
		document.addEventListener("keydown", onKey);
		return () => {
			document.removeEventListener("mousedown", onClick);
			document.removeEventListener("keydown", onKey);
		};
	}, [open]);
	return /* @__PURE__ */ jsxs("div", {
		ref: wrapRef,
		className: "relative",
		children: [/* @__PURE__ */ jsxs("div", {
			className: "flex flex-wrap gap-1.5",
			children: [applied.map((tag) => /* @__PURE__ */ jsxs("button", {
				type: "button",
				onClick: () => onDetach(tag.id),
				className: "group/tag inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-[11px] font-semibold text-white transition hover:opacity-90",
				style: { background: tag.color },
				title: t("Remove tag"),
				children: [tag.label, /* @__PURE__ */ jsx(X, { className: "size-3 opacity-0 transition group-hover/tag:opacity-100" })]
			}, tag.id)), /* @__PURE__ */ jsxs(Button, {
				type: "button",
				variant: "outline",
				size: "sm",
				onClick: () => setOpen((v) => !v),
				className: "h-6 rounded-full px-2 text-[11px]",
				children: [/* @__PURE__ */ jsx(Plus, { className: "me-1 size-3" }), applied.length === 0 ? t("Add tag") : t("Tag")]
			})]
		}), open && /* @__PURE__ */ jsxs("div", {
			className: "absolute start-0 top-full z-50 mt-1 w-72 rounded-md border bg-popover shadow-lg",
			children: [
				/* @__PURE__ */ jsx("div", {
					className: "border-b p-2",
					children: /* @__PURE__ */ jsx(Input, {
						type: "text",
						placeholder: t("Search tags…"),
						value: query,
						onChange: (e) => setQuery(e.target.value),
						className: "h-8 text-xs",
						autoFocus: true
					})
				}),
				/* @__PURE__ */ jsx("div", {
					className: "max-h-64 overflow-y-auto",
					children: filtered.length === 0 ? /* @__PURE__ */ jsx("p", {
						className: "p-4 text-center text-xs text-muted-foreground",
						children: available.length === 0 ? t("No tags configured.") : t("All available tags are already applied.")
					}) : filtered.map((tag) => /* @__PURE__ */ jsxs("button", {
						type: "button",
						onClick: () => {
							onAttach(tag.id);
							setOpen(false);
							setQuery("");
						},
						className: "flex w-full items-center gap-2 border-b p-2 text-start text-xs transition last:border-b-0 hover:bg-muted",
						children: [
							/* @__PURE__ */ jsx("span", {
								className: "size-3 shrink-0 rounded-full",
								style: { background: tag.color }
							}),
							/* @__PURE__ */ jsx(Tag, { className: "size-3 text-muted-foreground" }),
							/* @__PURE__ */ jsx("span", {
								className: "font-medium",
								children: tag.label
							})
						]
					}, tag.id))
				}),
				/* @__PURE__ */ jsx("div", {
					className: "border-t bg-muted/30 p-2 text-center",
					children: /* @__PURE__ */ jsx("a", {
						href: "/app/settings/tags",
						className: "text-xs font-medium text-primary underline-offset-4 hover:underline",
						children: available.length === 0 ? t("Create tags →") : t("Manage tags →")
					})
				})
			]
		})]
	});
}
//#endregion
//#region resources/js/components/live-chat/conversation-context-panel.tsx
/**
* Right-rail context for the conversation thread. Mirrors the shape of
* Intercom / Crisp / Tidio's "user details" sidebar — every signal an
* operator wants while a chat is live, in the order they look for it.
*
* Sections collapse gracefully: a brand-new conversation with no lead,
* no tags, no rating still renders cleanly. Each section is its own
* card so the panel doesn't feel like a wall of fields.
*/
function ConversationContextPanel({ visitor, lead, appliedTags, availableTags, onAttachTag, onDetachTag, satisfaction, satisfactionAt, satisfactionComment, sla, conversationStartedAt, leadScore, leadScoreBucket, leadScoreReasons, trajectory }) {
	const { t } = useT();
	return /* @__PURE__ */ jsxs("div", {
		className: "flex flex-col gap-4",
		children: [
			/* @__PURE__ */ jsx(Section$3, {
				icon: /* @__PURE__ */ jsx(UserRound, { className: "size-3.5" }),
				title: t("Visitor"),
				children: /* @__PURE__ */ jsxs("dl", {
					className: "grid gap-1.5 text-xs",
					children: [
						/* @__PURE__ */ jsx(Row, {
							label: t("ID"),
							children: /* @__PURE__ */ jsx("code", {
								className: "font-mono",
								children: visitor.anon?.slice(0, 16) ?? t("anonymous")
							})
						}),
						visitor.lang && /* @__PURE__ */ jsx(Row, {
							label: t("Language"),
							children: visitor.lang.toUpperCase()
						}),
						/* @__PURE__ */ jsx(Row, {
							label: t("Status"),
							children: /* @__PURE__ */ jsxs("span", {
								className: "inline-flex items-center gap-1.5",
								children: [/* @__PURE__ */ jsx("span", { className: `size-1.5 rounded-full ${visitor.is_returning ? "bg-violet-500" : "bg-emerald-500"}` }), visitor.is_returning ? t("Returning") : t("New")]
							})
						}),
						conversationStartedAt && /* @__PURE__ */ jsx(Row, {
							label: t("Started"),
							children: /* @__PURE__ */ jsx("span", {
								title: conversationStartedAt,
								children: relTime(conversationStartedAt, t)
							})
						}),
						visitor.page_url && /* @__PURE__ */ jsx(Row, {
							label: t("Page"),
							children: /* @__PURE__ */ jsxs("a", {
								href: visitor.page_url,
								target: "_blank",
								rel: "noopener noreferrer",
								className: "inline-flex max-w-full items-center gap-1 truncate text-primary hover:underline",
								children: [
									/* @__PURE__ */ jsx(Globe, { className: "size-3 shrink-0" }),
									/* @__PURE__ */ jsx("span", {
										className: "truncate",
										children: prettyHost(visitor.page_url)
									}),
									/* @__PURE__ */ jsx(ExternalLink, { className: "size-3 shrink-0" })
								]
							})
						})
					]
				})
			}),
			lead && /* @__PURE__ */ jsx(Section$3, {
				icon: /* @__PURE__ */ jsx(Mail, { className: "size-3.5" }),
				title: t("Captured lead"),
				children: /* @__PURE__ */ jsxs("dl", {
					className: "grid gap-1.5 text-xs",
					children: [
						lead.email && /* @__PURE__ */ jsx(Row, {
							label: t("Email"),
							children: /* @__PURE__ */ jsx("a", {
								href: `mailto:${lead.email}`,
								className: "font-mono text-primary hover:underline",
								children: lead.email
							})
						}),
						lead.name && /* @__PURE__ */ jsx(Row, {
							label: t("Name"),
							children: lead.name
						}),
						lead.phone && /* @__PURE__ */ jsx(Row, {
							label: t("Phone"),
							children: /* @__PURE__ */ jsx("a", {
								href: `tel:${lead.phone}`,
								className: "font-mono text-primary hover:underline",
								children: lead.phone
							})
						})
					]
				})
			}),
			/* @__PURE__ */ jsx(Section$3, {
				icon: /* @__PURE__ */ jsx(MessageSquare, { className: "size-3.5" }),
				title: t("Tags"),
				children: /* @__PURE__ */ jsx(TagPicker, {
					applied: appliedTags,
					available: availableTags,
					onAttach: onAttachTag,
					onDetach: onDetachTag
				})
			}),
			satisfaction !== null && /* @__PURE__ */ jsx(Section$3, {
				icon: satisfaction === "positive" ? /* @__PURE__ */ jsx(ThumbsUp, { className: "size-3.5" }) : /* @__PURE__ */ jsx(ThumbsDown, { className: "size-3.5" }),
				title: t("Visitor rating"),
				children: /* @__PURE__ */ jsxs("div", {
					className: "flex flex-col gap-1.5",
					children: [/* @__PURE__ */ jsxs("div", {
						className: "flex items-center gap-1.5 text-xs",
						children: [satisfaction === "positive" ? /* @__PURE__ */ jsxs("span", {
							className: "inline-flex items-center gap-1.5 rounded-full bg-emerald-100 px-2 py-0.5 font-semibold text-emerald-800",
							children: [/* @__PURE__ */ jsx(ThumbsUp, { className: "size-3" }), t("Positive")]
						}) : /* @__PURE__ */ jsxs("span", {
							className: "inline-flex items-center gap-1.5 rounded-full bg-red-100 px-2 py-0.5 font-semibold text-red-800",
							children: [/* @__PURE__ */ jsx(ThumbsDown, { className: "size-3" }), t("Negative")]
						}), satisfactionAt && /* @__PURE__ */ jsxs("span", {
							className: "text-muted-foreground",
							children: ["· ", relTime(satisfactionAt, t)]
						})]
					}), satisfactionComment && /* @__PURE__ */ jsxs("blockquote", {
						className: "rounded-md border-s-2 border-foreground/20 bg-muted/50 p-2 text-xs text-muted-foreground italic",
						children: [
							"\"",
							satisfactionComment,
							"\""
						]
					})]
				})
			}),
			sla && /* @__PURE__ */ jsx(Section$3, {
				icon: /* @__PURE__ */ jsx(Timer, { className: "size-3.5" }),
				title: t("Timing"),
				children: /* @__PURE__ */ jsx("dl", {
					className: "grid gap-1.5 text-xs",
					children: /* @__PURE__ */ jsx(Row, {
						label: sla.label,
						children: sla.value
					})
				})
			}),
			typeof leadScore === "number" && leadScore > 0 && /* @__PURE__ */ jsx(Section$3, {
				icon: /* @__PURE__ */ jsx(Sparkles, { className: "size-3.5" }),
				title: t("Lead score"),
				children: /* @__PURE__ */ jsxs("div", {
					className: "flex flex-col gap-2",
					children: [/* @__PURE__ */ jsxs("div", {
						className: "flex items-center gap-2",
						children: [/* @__PURE__ */ jsx(LeadScoreBadge, {
							score: leadScore,
							bucket: leadScoreBucket ?? null,
							reasons: leadScoreReasons ?? null
						}), /* @__PURE__ */ jsx("span", {
							className: "text-xs text-muted-foreground",
							children: t("Auto-computed from browsing + chat signals")
						})]
					}), leadScoreReasons && leadScoreReasons.length > 0 && /* @__PURE__ */ jsx("ul", {
						className: "ml-1 grid list-disc gap-0.5 pl-3 text-[11px] text-muted-foreground",
						children: leadScoreReasons.map((reason, i) => /* @__PURE__ */ jsx("li", { children: reason }, i))
					})]
				})
			}),
			trajectory && trajectory.length > 0 && /* @__PURE__ */ jsx(Section$3, {
				icon: /* @__PURE__ */ jsx(Route, { className: "size-3.5" }),
				title: t("Visitor trajectory"),
				children: /* @__PURE__ */ jsx("ol", {
					className: "grid gap-1.5 text-xs",
					children: trajectory.map((view, index) => /* @__PURE__ */ jsxs("li", {
						className: `flex flex-col gap-0.5 rounded-md border px-2 py-1.5 ${view.in_this_conversation ? "border-emerald-200 bg-emerald-50/50 dark:border-emerald-800 dark:bg-emerald-900/20" : "border-border bg-muted/30"}`,
						children: [
							/* @__PURE__ */ jsxs("a", {
								href: view.url,
								target: "_blank",
								rel: "noopener noreferrer",
								className: "inline-flex items-center gap-1 truncate font-medium text-foreground hover:underline",
								children: [view.title ?? view.url, /* @__PURE__ */ jsx(ExternalLink, { className: "size-3 shrink-0 opacity-60" })]
							}),
							view.title && /* @__PURE__ */ jsx("p", {
								className: "truncate text-[10px] text-muted-foreground",
								children: view.url
							}),
							view.viewed_at && /* @__PURE__ */ jsx("p", {
								className: "text-[10px] text-muted-foreground",
								children: relTime(view.viewed_at, t)
							})
						]
					}, `${view.url}-${index}`))
				})
			})
		]
	});
}
function Section$3({ icon, title, children }) {
	return /* @__PURE__ */ jsxs("section", {
		className: "flex flex-col gap-2 rounded-md border bg-card p-3",
		children: [/* @__PURE__ */ jsxs("h3", {
			className: "flex items-center gap-1.5 text-[10px] font-semibold tracking-wider text-muted-foreground uppercase",
			children: [icon, title]
		}), children]
	});
}
function Row({ label, children }) {
	return /* @__PURE__ */ jsxs("div", {
		className: "grid grid-cols-[80px_1fr] items-baseline gap-2",
		children: [/* @__PURE__ */ jsx("dt", {
			className: "text-[11px] tracking-wider text-muted-foreground uppercase",
			children: label
		}), /* @__PURE__ */ jsx("dd", {
			className: "min-w-0 truncate",
			children
		})]
	});
}
function relTime(iso, t) {
	const ms = Date.now() - new Date(iso).getTime();
	const sec = Math.max(1, Math.round(ms / 1e3));
	if (sec < 60) return t("just now");
	const min = Math.round(sec / 60);
	if (min < 60) return t(":count m ago", { count: min });
	const hour = Math.round(min / 60);
	if (hour < 24) return t(":count h ago", { count: hour });
	return t(":count d ago", { count: Math.round(hour / 24) });
}
function prettyHost(url) {
	try {
		const u = new URL(url);
		return u.host + u.pathname;
	} catch {
		return url;
	}
}
//#endregion
//#region resources/js/components/live-chat/transfer-dialog.tsx
/**
* Lightweight dropdown that lists workspace teammates and lets the
* current operator transfer the conversation. Online operators are
* grouped at the top; offline ones still appear (operator may want
* to assign a queue to someone who'll claim later).
*/
function TransferDialog({ teammates, onTransfer, busy = false }) {
	const { t } = useT();
	const [open, setOpen] = useState(false);
	const wrapRef = useRef(null);
	useEffect(() => {
		if (!open) return;
		const onClick = (e) => {
			if (wrapRef.current && !wrapRef.current.contains(e.target)) setOpen(false);
		};
		const onKey = (e) => {
			if (e.key === "Escape") setOpen(false);
		};
		document.addEventListener("mousedown", onClick);
		document.addEventListener("keydown", onKey);
		return () => {
			document.removeEventListener("mousedown", onClick);
			document.removeEventListener("keydown", onKey);
		};
	}, [open]);
	const online = teammates.filter((t) => t.is_online);
	const offline = teammates.filter((t) => !t.is_online);
	return /* @__PURE__ */ jsxs("div", {
		ref: wrapRef,
		className: "relative",
		children: [/* @__PURE__ */ jsxs(Button, {
			type: "button",
			size: "sm",
			variant: "outline",
			onClick: () => setOpen((v) => !v),
			disabled: busy,
			title: t("Transfer this conversation"),
			children: [/* @__PURE__ */ jsx(Users, { className: "me-1.5 size-3.5" }), t("Transfer")]
		}), open && /* @__PURE__ */ jsxs("div", {
			className: "absolute end-0 top-full z-50 mt-1 w-72 rounded-md border bg-popover shadow-lg",
			children: [/* @__PURE__ */ jsxs("div", {
				className: "flex items-center justify-between border-b p-2.5",
				children: [/* @__PURE__ */ jsx("span", {
					className: "text-xs font-semibold",
					children: t("Transfer to…")
				}), /* @__PURE__ */ jsx("button", {
					type: "button",
					onClick: () => setOpen(false),
					className: "rounded p-0.5 hover:bg-muted",
					children: /* @__PURE__ */ jsx(X, { className: "size-3.5 text-muted-foreground" })
				})]
			}), /* @__PURE__ */ jsxs("div", {
				className: "max-h-72 overflow-y-auto",
				children: [
					online.length > 0 && /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
						className: "bg-muted/40 px-2.5 py-1 text-[10px] font-semibold tracking-wider text-muted-foreground uppercase",
						children: t("Online")
					}), online.map((member) => /* @__PURE__ */ jsxs("button", {
						type: "button",
						onClick: () => {
							onTransfer(member.id);
							setOpen(false);
						},
						className: "flex w-full items-center justify-between border-b p-2.5 text-start text-sm transition last:border-b-0 hover:bg-muted",
						children: [/* @__PURE__ */ jsxs("span", {
							className: "flex items-center gap-2",
							children: [/* @__PURE__ */ jsx(Headset, { className: "size-3.5 text-emerald-600" }), member.name]
						}), /* @__PURE__ */ jsx(Badge, {
							variant: "default",
							className: "bg-emerald-600 text-[10px] text-white",
							children: t("Online")
						})]
					}, member.id))] }),
					offline.length > 0 && /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
						className: "bg-muted/40 px-2.5 py-1 text-[10px] font-semibold tracking-wider text-muted-foreground uppercase",
						children: t("Offline")
					}), offline.map((member) => /* @__PURE__ */ jsxs("button", {
						type: "button",
						onClick: () => {
							onTransfer(member.id);
							setOpen(false);
						},
						className: "flex w-full items-center justify-between border-b p-2.5 text-start text-sm transition last:border-b-0 hover:bg-muted",
						children: [/* @__PURE__ */ jsx("span", {
							className: "text-muted-foreground",
							children: member.name
						}), /* @__PURE__ */ jsx("span", {
							className: "text-[10px] text-muted-foreground",
							children: t("Offline")
						})]
					}, member.id))] }),
					teammates.length === 0 && /* @__PURE__ */ jsxs("div", {
						className: "space-y-2 p-4 text-center",
						children: [/* @__PURE__ */ jsx("p", {
							className: "text-xs text-muted-foreground",
							children: t("No teammates yet. Invite a workspace member with Editor, Admin, or Owner role to transfer conversations.")
						}), /* @__PURE__ */ jsx("a", {
							href: "/settings/members",
							className: "inline-block text-xs font-medium text-primary hover:underline",
							children: t("Invite teammates →")
						})]
					})
				]
			})]
		})]
	});
}
//#endregion
//#region resources/js/pages/app/conversations/show.tsx
var show_exports$2 = /* @__PURE__ */ __exportAll({ default: () => ConversationShow });
function fmtTime(iso) {
	if (!iso) return "";
	return new Date(iso).toLocaleString();
}
function relativeTime$3(iso, t) {
	if (!iso) return "";
	const diffMs = Date.now() - new Date(iso).getTime();
	const m = Math.floor(diffMs / 6e4);
	if (m < 1) return t("just now");
	if (m < 60) return t(":count m ago", { count: m });
	const h = Math.floor(m / 60);
	if (h < 24) return t(":count h ago", { count: h });
	return t(":count d ago", { count: Math.floor(h / 24) });
}
function durationLabel(iso) {
	const sec = Math.max(0, Math.floor((Date.now() - new Date(iso).getTime()) / 1e3));
	if (sec < 60) return `${sec}s`;
	const min = Math.floor(sec / 60);
	if (min < 60) {
		const s = sec % 60;
		return s === 0 ? `${min}m` : `${min}m ${s}s`;
	}
	return `${Math.floor(min / 60)}h ${min % 60}m`;
}
function ConversationShow({ agent, conversation, messages, trajectory, teammates, canned_replies, applied_tags, available_tags, auth_user_id, can_takeover }) {
	const { t } = useT();
	const [isLive, setIsLive] = useState(true);
	const claimedByMe = conversation.claimed_by !== null && conversation.claimed_by.id === auth_user_id;
	const claimedByOther = conversation.claimed_by !== null && !claimedByMe;
	const pollInterval = conversation.claimed_by !== null || conversation.human_requested_at !== null ? 2e3 : 8e3;
	const [reply, setReply] = useState("");
	const [replyMode, setReplyMode] = useState("reply");
	const [busy, setBusy] = useState(false);
	const [contextOpen, setContextOpen] = useState(true);
	const [mobileContextOpen, setMobileContextOpen] = useState(false);
	const dedupedMessages = useMemo(() => Array.from(new Map(messages.map((m) => [m.id, m])).values()), [messages]);
	const messagesEndRef = useRef(null);
	const lastTypingFireRef = useRef(0);
	useEffect(() => {
		if (!isLive) return;
		const tick = () => {
			if (document.visibilityState !== "visible") return;
			router.reload({ only: [
				"conversation",
				"messages",
				"applied_tags"
			] });
		};
		const interval = window.setInterval(tick, pollInterval);
		return () => window.clearInterval(interval);
	}, [isLive, pollInterval]);
	useEffect(() => {
		messagesEndRef.current?.scrollIntoView({ behavior: "smooth" });
	}, [dedupedMessages.length]);
	const breadcrumbs = [{
		title: t("Conversations"),
		href: "/app/conversations"
	}, {
		title: t("Thread"),
		href: `/app/conversations/${conversation.id}`
	}];
	const csrfHeader = () => ({
		"Content-Type": "application/json",
		Accept: "application/json",
		"X-CSRF-TOKEN": document.querySelector("meta[name=\"csrf-token\"]")?.content ?? "",
		"X-Requested-With": "XMLHttpRequest"
	});
	const claim = async () => {
		setBusy(true);
		try {
			const res = await fetch(`/app/conversations/${conversation.id}/claim`, {
				method: "POST",
				headers: csrfHeader(),
				credentials: "same-origin"
			});
			if (!res.ok) {
				if (res.status === 409) toast.error(t("Already claimed by another operator."));
				else toast.error(t("Could not claim — try again."));
				return;
			}
			toast.success(t("You are now in this conversation."));
			router.reload({ only: ["conversation", "messages"] });
		} finally {
			setBusy(false);
		}
	};
	const release = async () => {
		if (busy) return;
		setBusy(true);
		try {
			await fetch(`/app/conversations/${conversation.id}/release`, {
				method: "POST",
				headers: csrfHeader(),
				credentials: "same-origin"
			});
			toast.success(t("Released — bot will resume on the next message."));
			router.reload({ only: ["conversation", "messages"] });
		} finally {
			setBusy(false);
		}
	};
	const sendReply = async (e) => {
		e?.preventDefault();
		const text = reply.trim();
		if (!text || busy) return;
		setBusy(true);
		const endpoint = replyMode === "note" ? `/app/conversations/${conversation.id}/note` : `/app/conversations/${conversation.id}/reply`;
		try {
			const res = await fetch(endpoint, {
				method: "POST",
				headers: csrfHeader(),
				credentials: "same-origin",
				body: JSON.stringify({ content: text })
			});
			if (!res.ok) {
				if (res.status === 409) toast.error(t("You need to claim the conversation first."));
				else toast.error(t("Failed to send — please try again."));
				return;
			}
			setReply("");
			router.reload({ only: ["conversation", "messages"] });
		} finally {
			setBusy(false);
		}
	};
	const onReplyKeydown = (e) => {
		if (e.key === "Enter" && (e.metaKey || e.ctrlKey)) {
			e.preventDefault();
			sendReply();
		}
	};
	const onReplyChange = (value) => {
		setReply(value);
		if (replyMode !== "reply" || !claimedByMe) return;
		const now = Date.now();
		if (now - lastTypingFireRef.current < 2e3) return;
		lastTypingFireRef.current = now;
		fetch(`/app/conversations/${conversation.id}/typing`, {
			method: "POST",
			headers: csrfHeader(),
			credentials: "same-origin"
		}).catch(() => {});
	};
	const transfer = async (targetUserId) => {
		if (busy) return;
		setBusy(true);
		try {
			if (!(await fetch(`/app/conversations/${conversation.id}/transfer`, {
				method: "POST",
				headers: csrfHeader(),
				credentials: "same-origin",
				body: JSON.stringify({ target_user_id: targetUserId })
			})).ok) {
				toast.error(t("Could not transfer — target may not have permission."));
				return;
			}
			toast.success(t("Conversation transferred."));
			router.reload({ only: ["conversation", "messages"] });
		} finally {
			setBusy(false);
		}
	};
	const attachTag = async (tagId) => {
		if ((await fetch(`/app/conversations/${conversation.id}/tags/${tagId}`, {
			method: "POST",
			headers: csrfHeader(),
			credentials: "same-origin"
		})).ok) router.reload({ only: ["applied_tags"] });
	};
	const detachTag = async (tagId) => {
		if ((await fetch(`/app/conversations/${conversation.id}/tags/${tagId}`, {
			method: "DELETE",
			headers: csrfHeader(),
			credentials: "same-origin"
		})).ok) router.reload({ only: ["applied_tags"] });
	};
	const sla = useMemo(() => {
		if (conversation.claimed_at) return {
			label: t("In chat for"),
			value: durationLabel(conversation.claimed_at)
		};
		if (conversation.human_requested_at) return {
			label: t("Waiting"),
			value: durationLabel(conversation.human_requested_at)
		};
		if (conversation.started_at) return {
			label: t("Started"),
			value: relativeTime$3(conversation.started_at, t)
		};
		return null;
	}, [
		conversation.claimed_at,
		conversation.human_requested_at,
		conversation.started_at,
		t
	]);
	const contextPanel = /* @__PURE__ */ jsx(ConversationContextPanel, {
		visitor: {
			anon: conversation.visitor_anon,
			lang: conversation.lang,
			is_returning: conversation.is_returning,
			page_url: conversation.page_url
		},
		lead: conversation.lead,
		appliedTags: applied_tags,
		availableTags: available_tags,
		onAttachTag: attachTag,
		onDetachTag: detachTag,
		satisfaction: conversation.satisfaction,
		satisfactionAt: conversation.satisfaction_at,
		satisfactionComment: conversation.satisfaction_comment,
		sla,
		conversationStartedAt: conversation.started_at,
		leadScore: conversation.lead_score,
		leadScoreBucket: conversation.lead_score_bucket,
		leadScoreReasons: conversation.lead_score_reasons,
		trajectory
	});
	return /* @__PURE__ */ jsxs(AppLayout, {
		breadcrumbs,
		children: [
			/* @__PURE__ */ jsx(Head, { title: t("Conversation · :name", { name: agent.name }) }),
			/* @__PURE__ */ jsxs("div", {
				className: "flex flex-1 gap-3 overflow-hidden p-3 md:p-4",
				children: [/* @__PURE__ */ jsxs(Card, {
					className: "flex flex-1 flex-col overflow-hidden",
					children: [
						/* @__PURE__ */ jsxs("header", {
							className: "flex flex-wrap items-center gap-2 border-b px-4 py-3",
							children: [
								/* @__PURE__ */ jsxs(Link, {
									href: "/app/conversations",
									className: "inline-flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground",
									children: [/* @__PURE__ */ jsx(ArrowLeft, { className: "size-3" }), t("All")]
								}),
								/* @__PURE__ */ jsx("span", {
									className: "ms-1 truncate text-sm font-semibold",
									children: agent.name
								}),
								/* @__PURE__ */ jsxs("button", {
									type: "button",
									onClick: () => setIsLive(!isLive),
									className: `inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-[10px] font-semibold tracking-wider uppercase transition ${isLive ? "bg-emerald-500/15 text-emerald-700 hover:bg-emerald-500/25 dark:text-emerald-400" : "bg-muted text-muted-foreground hover:bg-muted/70"}`,
									title: isLive ? t("Auto-refreshing every :seconds s", { seconds: pollInterval / 1e3 }) : t("Click to resume auto-refresh"),
									children: [/* @__PURE__ */ jsx("span", { className: `size-1.5 rounded-full ${isLive ? "animate-pulse bg-emerald-500" : "bg-muted-foreground/50"}` }), isLive ? t("Live") : t("Paused")]
								}),
								conversation.human_requested_at && !conversation.claimed_by && /* @__PURE__ */ jsxs(Badge, {
									variant: "outline",
									className: "border-amber-300 bg-amber-50 text-[10px] font-semibold tracking-wider text-amber-800 uppercase",
									children: [
										t("Needs human"),
										" ·",
										" ",
										relativeTime$3(conversation.human_requested_at, t)
									]
								}),
								claimedByOther && /* @__PURE__ */ jsxs(Badge, {
									variant: "outline",
									className: "border-slate-300 bg-slate-50 text-[10px] font-semibold tracking-wider text-slate-700 uppercase",
									children: [/* @__PURE__ */ jsx(Lock, { className: "me-1 size-3" }), conversation.claimed_by.name]
								}),
								claimedByMe && /* @__PURE__ */ jsxs(Badge, {
									variant: "default",
									className: "bg-emerald-600 text-[10px] font-semibold tracking-wider text-white uppercase",
									children: [/* @__PURE__ */ jsx(Headset, { className: "me-1 size-3" }), t("You're in")]
								}),
								/* @__PURE__ */ jsxs("div", {
									className: "ms-auto flex items-center gap-1.5",
									children: [
										can_takeover && !conversation.claimed_by && /* @__PURE__ */ jsxs(Button, {
											type: "button",
											size: "sm",
											onClick: claim,
											disabled: busy,
											children: [/* @__PURE__ */ jsx(Hand, { className: "me-1.5 size-3.5" }), t("Claim")]
										}),
										can_takeover && claimedByMe && /* @__PURE__ */ jsxs(Button, {
											type: "button",
											size: "sm",
											variant: "outline",
											onClick: release,
											disabled: busy,
											children: [/* @__PURE__ */ jsx(LogOut, { className: "me-1.5 size-3.5" }), t("Release")]
										}),
										can_takeover && claimedByOther && conversation.human_requested_at && /* @__PURE__ */ jsxs(Button, {
											type: "button",
											size: "sm",
											variant: "outline",
											onClick: release,
											disabled: busy,
											title: t("Force-release another operator's claim"),
											children: [/* @__PURE__ */ jsx(CheckCircle2, { className: "me-1.5 size-3.5" }), t("Force release")]
										}),
										/* @__PURE__ */ jsx(Button, {
											type: "button",
											variant: "ghost",
											size: "sm",
											onClick: () => setContextOpen((v) => !v),
											title: contextOpen ? t("Hide details") : t("Show details"),
											className: "hidden md:inline-flex",
											children: contextOpen ? /* @__PURE__ */ jsx(PanelRightClose, { className: "size-4" }) : /* @__PURE__ */ jsx(PanelRightOpen, { className: "size-4" })
										}),
										/* @__PURE__ */ jsxs(Button, {
											type: "button",
											variant: "outline",
											size: "sm",
											onClick: () => setMobileContextOpen(true),
											className: "md:hidden",
											children: [/* @__PURE__ */ jsx(Settings2, { className: "me-1.5 size-3.5" }), t("Details")]
										})
									]
								})
							]
						}),
						/* @__PURE__ */ jsxs("div", {
							className: "flex flex-1 flex-col gap-2 overflow-y-auto p-4",
							children: [
								dedupedMessages.length === 0 ? /* @__PURE__ */ jsx("p", {
									className: "text-center text-sm text-muted-foreground",
									children: t("No messages yet.")
								}) : dedupedMessages.map((m) => /* @__PURE__ */ jsx(MessageBubble, { message: m }, m.id)),
								conversation.visitor_typing && claimedByMe && /* @__PURE__ */ jsxs("div", {
									className: "flex items-center gap-1.5 self-start rounded-full bg-muted px-3 py-1.5 text-xs text-muted-foreground",
									children: [/* @__PURE__ */ jsx("span", {
										className: "flex gap-0.5",
										children: [
											0,
											150,
											300
										].map((d) => /* @__PURE__ */ jsx("span", {
											className: "block size-1.5 animate-pulse rounded-full bg-muted-foreground/50",
											style: { animationDelay: `${d}ms` }
										}, d))
									}), t("Visitor is typing…")]
								}),
								/* @__PURE__ */ jsx("div", { ref: messagesEndRef })
							]
						}),
						claimedByMe ? /* @__PURE__ */ jsx("div", {
							className: `border-t p-3 ${replyMode === "note" ? "bg-amber-50/30" : ""}`,
							children: /* @__PURE__ */ jsxs("form", {
								onSubmit: sendReply,
								className: "flex flex-col gap-2",
								children: [
									/* @__PURE__ */ jsxs("div", {
										className: "flex items-center justify-between gap-2",
										children: [/* @__PURE__ */ jsxs(ToggleGroup, {
											type: "single",
											value: replyMode,
											onValueChange: (v) => {
												if (v) setReplyMode(v);
											},
											size: "sm",
											children: [/* @__PURE__ */ jsxs(ToggleGroupItem, {
												value: "reply",
												className: "text-xs",
												children: [/* @__PURE__ */ jsx(Send, { className: "me-1.5 size-3" }), t("Reply")]
											}), /* @__PURE__ */ jsxs(ToggleGroupItem, {
												value: "note",
												className: "text-xs",
												children: [/* @__PURE__ */ jsx(NotebookPen, { className: "me-1.5 size-3" }), t("Note")]
											})]
										}), /* @__PURE__ */ jsxs("div", {
											className: "flex items-center gap-2",
											children: [replyMode === "reply" && /* @__PURE__ */ jsx(CannedReplyPicker, {
												replies: canned_replies,
												onPick: (c) => setReply(c)
											}), /* @__PURE__ */ jsx(TransferDialog, {
												teammates,
												onTransfer: transfer,
												busy
											})]
										})]
									}),
									/* @__PURE__ */ jsx(Textarea, {
										value: reply,
										onChange: (e) => onReplyChange(e.target.value),
										onKeyDown: onReplyKeydown,
										placeholder: replyMode === "note" ? t("Internal note (only visible to other operators)…") : t("Reply to the visitor… (Cmd / Ctrl + Enter to send)"),
										rows: 2,
										disabled: busy,
										autoFocus: true
									}),
									/* @__PURE__ */ jsxs("div", {
										className: "flex items-center justify-between gap-2",
										children: [/* @__PURE__ */ jsx("p", {
											className: "text-xs text-muted-foreground",
											children: replyMode === "note" ? t("The visitor will not see this. Other operators will.") : t("Bot is paused while you're in this chat.")
										}), /* @__PURE__ */ jsxs(Button, {
											type: "submit",
											size: "sm",
											disabled: busy || !reply.trim(),
											children: [replyMode === "note" ? /* @__PURE__ */ jsx(NotebookPen, { className: "me-1.5 size-3.5" }) : /* @__PURE__ */ jsx(Send, { className: "me-1.5 size-3.5" }), replyMode === "note" ? t("Save note") : t("Send")]
										})]
									})
								]
							})
						}) : claimedByOther ? /* @__PURE__ */ jsx("div", {
							className: "border-t border-dashed p-3 text-center text-xs text-muted-foreground",
							children: t(":name is in this chat. Read-only for you.", { name: conversation.claimed_by.name })
						}) : conversation.human_requested_at && can_takeover ? /* @__PURE__ */ jsxs("div", {
							className: "border-t border-amber-300 bg-amber-50 p-3 text-center text-xs text-amber-800",
							children: [
								t("Visitor is waiting. Click"),
								" ",
								/* @__PURE__ */ jsx("strong", { children: t("Claim") }),
								" ",
								t("to take this conversation.")
							]
						}) : null
					]
				}), contextOpen && /* @__PURE__ */ jsx("div", {
					className: "hidden w-80 shrink-0 overflow-y-auto md:block",
					children: contextPanel
				})]
			}),
			/* @__PURE__ */ jsx(Sheet$1, {
				open: mobileContextOpen,
				onOpenChange: setMobileContextOpen,
				children: /* @__PURE__ */ jsxs(SheetContent, {
					side: "right",
					className: "w-full max-w-[420px] overflow-y-auto p-0 sm:max-w-[420px]",
					children: [/* @__PURE__ */ jsx(SheetHeader, {
						className: "border-b",
						children: /* @__PURE__ */ jsx(SheetTitle, { children: t("Conversation details") })
					}), /* @__PURE__ */ jsx("div", {
						className: "p-4",
						children: contextPanel
					})]
				})
			})
		]
	});
}
function MessageBubble({ message }) {
	const { t } = useT();
	const isUser = message.role === "user";
	const isHuman = message.is_human || message.role === "human-agent";
	if (message.is_note === true) return /* @__PURE__ */ jsxs("div", {
		className: "flex flex-col items-center",
		children: [/* @__PURE__ */ jsxs("div", {
			className: `w-full max-w-[88%] rounded-md border px-3 py-2 text-xs ${message.is_system ? "border-slate-200 bg-slate-50 text-slate-700" : "border-amber-300/60 bg-amber-50 text-amber-900"}`,
			children: [/* @__PURE__ */ jsx("p", {
				className: "mb-0.5 text-[9px] font-semibold tracking-wider uppercase opacity-70",
				children: message.is_system ? t("System") : t("Internal note")
			}), /* @__PURE__ */ jsx("p", {
				className: "leading-relaxed whitespace-pre-wrap",
				children: message.content
			})]
		}), /* @__PURE__ */ jsx("p", {
			className: "mt-1 text-[10px] text-muted-foreground",
			children: fmtTime(message.created_at)
		})]
	});
	return /* @__PURE__ */ jsxs("div", {
		className: `flex flex-col ${isUser ? "items-end" : "items-start"}`,
		children: [/* @__PURE__ */ jsxs("div", {
			className: `max-w-[85%] rounded-2xl px-4 py-2.5 ${isUser ? "bg-foreground text-background" : isHuman ? "border border-emerald-500/30 bg-emerald-500/5" : "bg-muted"}`,
			children: [
				isHuman && /* @__PURE__ */ jsx("p", {
					className: "mb-1 text-[10px] font-semibold tracking-wider text-emerald-700 uppercase dark:text-emerald-400",
					children: t("Operator")
				}),
				/* @__PURE__ */ jsx("p", {
					className: "text-sm leading-relaxed whitespace-pre-wrap",
					children: message.content
				}),
				message.citations && message.citations.length > 0 && /* @__PURE__ */ jsxs("div", {
					className: "mt-2 flex flex-wrap gap-2 text-[11px] opacity-75",
					children: [/* @__PURE__ */ jsx("span", { children: t("Sources:") }), message.citations.map((c, i) => /* @__PURE__ */ jsxs("a", {
						href: c.url ?? "#",
						target: "_blank",
						rel: "noopener noreferrer",
						className: "underline",
						children: [
							"[",
							c.id,
							"]"
						]
					}, i))]
				})
			]
		}), /* @__PURE__ */ jsxs("p", {
			className: "mt-1 px-2 text-[10px] text-muted-foreground",
			children: [fmtTime(message.created_at), message.confidence !== null && !isUser && !isHuman && /* @__PURE__ */ jsx("span", {
				className: `ms-2 ${message.confidence < .6 ? "text-amber-600" : ""}`,
				children: t("· confidence :pct%", { pct: (message.confidence * 100).toFixed(0) })
			})]
		})]
	});
}
//#endregion
//#region resources/js/pages/app/inbox/index.tsx
var inbox_exports = /* @__PURE__ */ __exportAll({ default: () => InboxIndex });
var STATUS_STYLES$1 = {
	new: "border-sky-200 bg-sky-50 text-sky-700 dark:border-sky-500/30 dark:bg-sky-500/10 dark:text-sky-300",
	qualified: "border-emerald-200 bg-emerald-50 text-emerald-700 dark:border-emerald-500/30 dark:bg-emerald-500/10 dark:text-emerald-300",
	contacted: "border-amber-200 bg-amber-50 text-amber-700 dark:border-amber-500/30 dark:bg-amber-500/10 dark:text-amber-300",
	won: "border-violet-200 bg-violet-50 text-violet-700 dark:border-violet-500/30 dark:bg-violet-500/10 dark:text-violet-300",
	lost: "border-border bg-muted text-muted-foreground"
};
var INBOX_ONLY = [
	"leads",
	"pagination",
	"filters"
];
function inboxColumns(t) {
	return [
		{
			id: "status",
			label: t("Status")
		},
		{
			id: "score",
			label: t("Score")
		},
		{
			id: "email",
			label: t("Email")
		},
		{
			id: "phone",
			label: t("Phone")
		},
		{
			id: "page",
			label: t("Page")
		},
		{
			id: "created",
			label: t("Created")
		}
	];
}
function leadViewOptions(t) {
	return [
		{
			value: "all",
			label: t("All leads")
		},
		{
			value: "new",
			label: t("New")
		},
		{
			value: "qualified",
			label: t("Qualified")
		},
		{
			value: "contacted",
			label: t("Contacted")
		},
		{
			value: "won",
			label: t("Won")
		},
		{
			value: "lost",
			label: t("Lost")
		}
	];
}
function inboxSortOptions(t) {
	return [
		{
			value: "created_desc",
			label: t("Newest first")
		},
		{
			value: "created_asc",
			label: t("Oldest first")
		},
		{
			value: "name_asc",
			label: t("Lead name A-Z")
		},
		{
			value: "name_desc",
			label: t("Lead name Z-A")
		}
	];
}
function phoneFilterOptions(t) {
	return [
		{
			value: "all",
			label: t("Any phone state")
		},
		{
			value: "with_phone",
			label: t("Has phone number")
		},
		{
			value: "without_phone",
			label: t("Missing phone number")
		}
	];
}
function relativeTime$2(iso, t) {
	if (!iso) return t("No activity");
	const ms = Date.now() - new Date(iso).getTime();
	const min = Math.max(1, Math.round(ms / 6e4));
	if (min < 60) return t(":count m ago", { count: min });
	const hr = Math.round(min / 60);
	if (hr < 24) return t(":count h ago", { count: hr });
	return t(":count d ago", { count: Math.round(hr / 24) });
}
/**
* Inline status editor that PATCHes /app/inbox/{lead} with the picked
* status. Lives on the row so an admin can triage 10 new leads without
* opening each one. Pre-fix the Status column rendered a read-only
* badge that always read "new" because the Lead model defaults to that
* value and nothing ever transitioned it.
*/
function StatusSelect({ leadId, status }) {
	const { t } = useT();
	const STATUSES = [
		"new",
		"qualified",
		"contacted",
		"won",
		"lost"
	];
	const change = (next) => {
		if (next === status) return;
		router.patch(`/app/inbox/${leadId}`, { status: next }, {
			preserveScroll: true,
			preserveState: true,
			only: INBOX_ONLY
		});
	};
	return /* @__PURE__ */ jsx("select", {
		value: STATUSES.includes(status) ? status : "new",
		onChange: (e) => change(e.target.value),
		className: `appearance-none rounded-md border px-2 py-0.5 text-xs font-medium capitalize outline-none ${STATUS_STYLES$1[status] ?? STATUS_STYLES$1.new}`,
		onClick: (e) => e.stopPropagation(),
		"aria-label": t("Lead status"),
		children: STATUSES.map((s) => /* @__PURE__ */ jsx("option", {
			value: s,
			children: t(s.charAt(0).toUpperCase() + s.slice(1))
		}, s))
	});
}
function InboxIndex({ leads, pagination, filters }) {
	const { t } = useT();
	const selection = useBulkSelection();
	const pageIds = leads.map((l) => l.id);
	const breadcrumbs = [{
		title: t("Inbox"),
		href: index$9()
	}];
	useEffect(() => {
		let pending = false;
		const refetch = () => {
			if (pending) return;
			pending = true;
			router.reload({
				only: INBOX_ONLY,
				onFinish: () => {
					pending = false;
				}
			});
		};
		const onVisible = () => {
			if (document.visibilityState === "visible") refetch();
		};
		window.addEventListener("focus", refetch);
		document.addEventListener("visibilitychange", onVisible);
		return () => {
			window.removeEventListener("focus", refetch);
			document.removeEventListener("visibilitychange", onVisible);
		};
	}, []);
	const INBOX_COLUMNS = inboxColumns(t);
	const LEAD_VIEW_OPTIONS = leadViewOptions(t);
	const INBOX_SORT_OPTIONS = inboxSortOptions(t);
	const PHONE_FILTER_OPTIONS = phoneFilterOptions(t);
	const { hiddenColumnCount, isColumnVisible, resetColumns, setColumnVisibility, visibleColumns } = usePersistentTableColumns("table-columns:inbox", INBOX_COLUMNS);
	const [density, setDensityState] = useState(() => {
		try {
			return window.localStorage.getItem("pb:inbox:density") === "comfortable" ? "comfortable" : "compact";
		} catch {
			return "compact";
		}
	});
	const setDensity = (next) => {
		setDensityState(next);
		try {
			window.localStorage.setItem("pb:inbox:density", next);
		} catch {}
	};
	const rowPyClass = density === "compact" ? "py-1.5" : "py-3";
	const hasRows = leads.length > 0;
	const emptyTitle = filters.q.trim() !== "" || filters.view !== "all" || filters.phone !== "all" ? t("No matching leads") : t("No leads yet");
	const visibleColumnCount = INBOX_COLUMNS.filter((column) => isColumnVisible(column.id)).length;
	return /* @__PURE__ */ jsxs(AppLayout, {
		breadcrumbs,
		children: [
			/* @__PURE__ */ jsx(Head, { title: t("Inbox") }),
			/* @__PURE__ */ jsxs("div", {
				className: "flex min-h-0 flex-1 flex-col bg-card",
				children: [
					/* @__PURE__ */ jsxs("div", {
						className: "flex min-h-10 flex-wrap items-center gap-2 border-b px-3 py-1.5",
						children: [
							/* @__PURE__ */ jsx(TableScopeMenu, {
								options: LEAD_VIEW_OPTIONS,
								value: filters.view,
								paramName: "view",
								only: INBOX_ONLY
							}),
							/* @__PURE__ */ jsx(TableSortMenu, {
								options: INBOX_SORT_OPTIONS,
								value: filters.sort,
								paramName: "sort",
								only: INBOX_ONLY
							}),
							/* @__PURE__ */ jsx(TableFiltersMenu, {
								groups: [{
									label: t("Phone"),
									paramName: "phone",
									value: filters.phone,
									defaultValue: "all",
									options: PHONE_FILTER_OPTIONS
								}],
								only: INBOX_ONLY
							}),
							/* @__PURE__ */ jsx(TableSearch, {
								placeholder: t("Search by email, name, or phone..."),
								initialValue: filters.q,
								only: INBOX_ONLY
							}),
							/* @__PURE__ */ jsxs(Button, {
								type: "button",
								variant: filters.hot ? "default" : "outline",
								size: "sm",
								onClick: () => {
									router.get(index$9().url, {
										q: filters.q || void 0,
										view: filters.view === "all" ? void 0 : filters.view,
										sort: filters.sort === "created_desc" ? void 0 : filters.sort,
										phone: filters.phone === "all" ? void 0 : filters.phone,
										hot: filters.hot ? void 0 : 1
									}, {
										preserveScroll: true,
										preserveState: true,
										only: INBOX_ONLY
									});
								},
								title: t("Show only leads with score ≥ 70"),
								children: [/* @__PURE__ */ jsx(Flame, { className: "size-4" }), /* @__PURE__ */ jsx("span", {
									className: "ms-1",
									children: t("Hot only")
								})]
							}),
							/* @__PURE__ */ jsxs("div", {
								className: "ms-auto flex items-center gap-2",
								children: [/* @__PURE__ */ jsxs("div", {
									className: "inline-flex overflow-hidden rounded-md border text-xs",
									children: [/* @__PURE__ */ jsx("button", {
										type: "button",
										onClick: () => setDensity("compact"),
										className: density === "compact" ? "bg-foreground px-2.5 py-1 text-background" : "px-2.5 py-1 hover:bg-muted",
										title: t("Compact rows"),
										children: t("Compact")
									}), /* @__PURE__ */ jsx("button", {
										type: "button",
										onClick: () => setDensity("comfortable"),
										className: density === "comfortable" ? "border-s bg-foreground px-2.5 py-1 text-background" : "border-s px-2.5 py-1 hover:bg-muted",
										title: t("Comfortable rows"),
										children: t("Comfortable")
									})]
								}), /* @__PURE__ */ jsx(TableColumnMenu, {
									columns: INBOX_COLUMNS,
									visibleColumns,
									hiddenColumnCount,
									onResetColumns: resetColumns,
									onSetColumnVisibility: setColumnVisibility
								})]
							})
						]
					}),
					/* @__PURE__ */ jsx("div", {
						className: "min-h-0 flex-1 overflow-auto",
						children: /* @__PURE__ */ jsxs("table", {
							className: "w-full min-w-[920px] border-separate border-spacing-0 text-start text-sm",
							children: [/* @__PURE__ */ jsx("thead", {
								className: "sticky top-0 z-10 bg-card text-xs font-medium text-muted-foreground",
								children: /* @__PURE__ */ jsxs("tr", { children: [
									/* @__PURE__ */ jsx("th", {
										className: "w-9 border-b px-3 py-2",
										children: /* @__PURE__ */ jsx("input", {
											type: "checkbox",
											"aria-label": t("Select all leads"),
											checked: selection.allOnPageSelected(pageIds),
											ref: (el) => {
												if (el) el.indeterminate = !selection.allOnPageSelected(pageIds) && selection.someOnPageSelected(pageIds);
											},
											onChange: () => selection.togglePage(pageIds),
											className: "size-3.5 cursor-pointer rounded border-input"
										})
									}),
									/* @__PURE__ */ jsx("th", {
										className: "border-e border-b px-3 py-2",
										children: t("Lead")
									}),
									isColumnVisible("status") && /* @__PURE__ */ jsx("th", {
										className: "border-e border-b px-3 py-2",
										children: t("Status")
									}),
									isColumnVisible("score") && /* @__PURE__ */ jsx("th", {
										className: "border-e border-b px-3 py-2",
										children: t("Score")
									}),
									isColumnVisible("email") && /* @__PURE__ */ jsx("th", {
										className: "border-e border-b px-3 py-2",
										children: t("Email")
									}),
									isColumnVisible("phone") && /* @__PURE__ */ jsx("th", {
										className: "border-e border-b px-3 py-2",
										children: t("Phone")
									}),
									isColumnVisible("page") && /* @__PURE__ */ jsx("th", {
										className: "border-e border-b px-3 py-2",
										children: t("Page")
									}),
									isColumnVisible("created") && /* @__PURE__ */ jsx("th", {
										className: "border-b px-3 py-2",
										children: t("Created")
									})
								] })
							}), /* @__PURE__ */ jsx("tbody", { children: hasRows ? leads.map((lead) => {
								const label = lead.name ?? lead.email ?? t("Unnamed lead");
								return /* @__PURE__ */ jsxs("tr", {
									className: "group hover:bg-muted/35",
									children: [
										/* @__PURE__ */ jsx("td", {
											className: `border-b px-3 ${rowPyClass}`,
											children: /* @__PURE__ */ jsx("input", {
												type: "checkbox",
												"aria-label": t("Select :label", { label }),
												checked: selection.isSelected(lead.id),
												onChange: (e) => {
													const nativeEvent = e.nativeEvent;
													selection.toggle(lead.id, {
														shiftKey: nativeEvent?.shiftKey ?? false,
														pageIds
													});
												},
												onClick: (e) => e.stopPropagation(),
												className: "size-3.5 cursor-pointer rounded border-input"
											})
										}),
										/* @__PURE__ */ jsx("td", {
											className: `border-e border-b px-3 ${rowPyClass}`,
											children: /* @__PURE__ */ jsxs(Link, {
												href: show$1(lead.id),
												className: "flex min-w-0 items-center gap-2 text-foreground",
												children: [/* @__PURE__ */ jsx("span", {
													className: "flex size-5 shrink-0 items-center justify-center rounded-full bg-muted text-[10px] font-semibold uppercase",
													children: label.slice(0, 1)
												}), /* @__PURE__ */ jsx("span", {
													className: "truncate font-medium",
													children: label
												})]
											})
										}),
										isColumnVisible("status") && /* @__PURE__ */ jsx("td", {
											className: `border-e border-b px-3 ${rowPyClass}`,
											children: /* @__PURE__ */ jsx(StatusSelect, {
												leadId: lead.id,
												status: lead.status
											})
										}),
										isColumnVisible("score") && /* @__PURE__ */ jsx("td", {
											className: `border-e border-b px-3 ${rowPyClass}`,
											children: lead.lead_score > 0 ? /* @__PURE__ */ jsx(LeadScoreBadge, {
												score: lead.lead_score,
												bucket: lead.lead_score_bucket,
												reasons: lead.lead_score_reasons
											}) : /* @__PURE__ */ jsx("span", {
												className: "text-xs text-muted-foreground",
												children: "—"
											})
										}),
										isColumnVisible("email") && /* @__PURE__ */ jsx("td", {
											className: `border-e border-b px-3 ${rowPyClass} text-muted-foreground`,
											children: /* @__PURE__ */ jsxs("span", {
												className: "inline-flex min-w-0 items-center gap-1.5",
												children: [/* @__PURE__ */ jsx(Mail, { className: "size-3.5 shrink-0" }), /* @__PURE__ */ jsx("span", {
													className: "truncate",
													children: lead.email
												})]
											})
										}),
										isColumnVisible("phone") && /* @__PURE__ */ jsx("td", {
											className: `border-e border-b px-3 ${rowPyClass} text-muted-foreground`,
											children: lead.phone ? /* @__PURE__ */ jsxs("span", {
												className: "inline-flex items-center gap-1.5",
												children: [/* @__PURE__ */ jsx(Phone, { className: "size-3.5" }), lead.phone]
											}) : t("No phone")
										}),
										isColumnVisible("page") && /* @__PURE__ */ jsx("td", {
											className: `max-w-[280px] border-e border-b px-3 ${rowPyClass} text-muted-foreground`,
											children: /* @__PURE__ */ jsx("span", {
												className: "block truncate",
												children: lead.page_url ?? t("No page")
											})
										}),
										isColumnVisible("created") && /* @__PURE__ */ jsx("td", {
											className: `border-b px-3 ${rowPyClass} text-muted-foreground`,
											children: relativeTime$2(lead.created_at, t)
										})
									]
								}, lead.id);
							}) : /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx("td", {
								colSpan: 2 + visibleColumnCount,
								className: "h-72 border-b px-4 text-center",
								children: /* @__PURE__ */ jsxs("div", {
									className: "mx-auto flex max-w-sm flex-col items-center gap-2 text-muted-foreground",
									children: [
										/* @__PURE__ */ jsx(Inbox, { className: "size-8" }),
										/* @__PURE__ */ jsx("p", {
											className: "text-sm font-medium text-foreground",
											children: emptyTitle
										}),
										/* @__PURE__ */ jsx("p", {
											className: "text-xs",
											children: t("Leads captured by the widget appear here, newest first.")
										})
									]
								})
							}) }) })]
						})
					}),
					/* @__PURE__ */ jsx(TablePagination, {
						pagination,
						only: INBOX_ONLY
					})
				]
			}),
			/* @__PURE__ */ jsx(BulkActionsBar, {
				count: selection.size,
				onClear: selection.clear,
				noun: t("lead"),
				children: /* @__PURE__ */ jsx(BulkDeleteButton, {
					confirmMessage: t("Delete :count selected lead(s)? This removes them from the inbox.", { count: selection.size }),
					onConfirm: () => {
						router.post("/app/inbox/bulk-destroy", { ids: Array.from(selection.selected) }, {
							preserveScroll: true,
							onSuccess: () => selection.clear()
						});
					}
				})
			})
		]
	});
}
//#endregion
//#region resources/js/pages/app/inbox/show.tsx
var show_exports$1 = /* @__PURE__ */ __exportAll({ default: () => LeadShow });
function deliveryChannels(routedTo, t) {
	if (!routedTo) return [];
	const out = [];
	if (routedTo.includes("webhook")) out.push({
		kind: "webhook",
		label: t("webhook"),
		tone: "bg-slate-500/15 text-slate-700"
	});
	if (routedTo.includes("slack")) out.push({
		kind: "slack",
		label: t("Slack"),
		tone: "bg-purple-500/15 text-purple-700"
	});
	if (routedTo.includes("email")) out.push({
		kind: "email",
		label: t("email"),
		tone: "bg-emerald-500/15 text-emerald-700"
	});
	return out;
}
function csrf$2() {
	return document.querySelector("meta[name=\"csrf-token\"]")?.content ?? "";
}
function LeadShow({ lead, messages, conversation, me }) {
	const { t } = useT();
	const alert = useAlert();
	const [reply, setReply] = useState("");
	const [sending, setSending] = useState(false);
	const [convo, setConvo] = useState(conversation);
	const dedupedMessages = useMemo(() => Array.from(new Map(messages.map((m) => [m.id, m])).values()), [messages]);
	const isClaimedByMe = convo?.claimed_by?.id === me.id;
	const isClaimedByOther = convo?.claimed_by != null && !isClaimedByMe;
	const claim = async () => {
		if (!convo) return;
		const r = await fetch(`/app/conversations/${convo.id}/claim`, {
			method: "POST",
			credentials: "same-origin",
			headers: {
				Accept: "application/json",
				"X-CSRF-TOKEN": csrf$2(),
				"X-Requested-With": "XMLHttpRequest"
			}
		});
		if (r.ok) {
			const j = await r.json();
			setConvo({
				...convo,
				claimed_by: j.data.claimed_by,
				claimed_at: j.data.claimed_at
			});
		} else if (r.status === 409) await alert({ message: t("Already claimed by :name.", { name: (await r.json()).error?.by?.name ?? t("someone else") }) });
	};
	const release = async () => {
		if (!convo) return;
		if ((await fetch(`/app/conversations/${convo.id}/release`, {
			method: "POST",
			credentials: "same-origin",
			headers: {
				Accept: "application/json",
				"X-CSRF-TOKEN": csrf$2(),
				"X-Requested-With": "XMLHttpRequest"
			}
		})).ok) setConvo({
			...convo,
			claimed_by: null,
			claimed_at: null
		});
	};
	const send = async () => {
		if (!convo || !reply.trim()) return;
		setSending(true);
		try {
			const r = await fetch(`/app/conversations/${convo.id}/reply`, {
				method: "POST",
				credentials: "same-origin",
				headers: {
					"Content-Type": "application/json",
					Accept: "application/json",
					"X-CSRF-TOKEN": csrf$2(),
					"X-Requested-With": "XMLHttpRequest"
				},
				body: JSON.stringify({ content: reply.trim() })
			});
			if (r.ok) {
				setReply("");
				router.reload({ only: ["messages"] });
			} else await alert({ message: t("Send failed: :text", { text: await r.text() }) });
		} finally {
			setSending(false);
		}
	};
	return /* @__PURE__ */ jsxs(AppLayout, {
		breadcrumbs: [{
			title: t("Inbox"),
			href: "/app/inbox"
		}, {
			title: lead.email ?? lead.id,
			href: `/app/inbox/${lead.id}`
		}],
		children: [/* @__PURE__ */ jsx(Head, { title: t("Lead · :name", { name: lead.email ?? lead.id }) }), /* @__PURE__ */ jsxs("div", {
			className: "grid flex-1 gap-4 p-4 md:grid-cols-[1fr_320px]",
			children: [/* @__PURE__ */ jsxs(Card, {
				className: "flex flex-col p-4",
				children: [
					/* @__PURE__ */ jsxs("div", {
						className: "mb-3 flex items-center justify-between",
						children: [/* @__PURE__ */ jsx("h2", {
							className: "font-medium",
							children: t("Conversation")
						}), convo && /* @__PURE__ */ jsxs("div", {
							className: "flex items-center gap-2 text-xs",
							children: [
								isClaimedByMe && /* @__PURE__ */ jsxs("span", {
									className: "inline-flex items-center gap-1 rounded bg-emerald-500/15 px-2 py-0.5 text-emerald-700 dark:text-emerald-400",
									children: [
										/* @__PURE__ */ jsx(UserCheck, { className: "size-3" }),
										" ",
										t("You're handling this")
									]
								}),
								isClaimedByOther && /* @__PURE__ */ jsx("span", {
									className: "rounded bg-amber-500/15 px-2 py-0.5 text-amber-700 dark:text-amber-400",
									children: t("With :name", { name: convo.claimed_by?.name ?? "" })
								}),
								!convo.claimed_by ? /* @__PURE__ */ jsx(Button, {
									size: "sm",
									onClick: claim,
									children: t("Take over")
								}) : isClaimedByMe ? /* @__PURE__ */ jsx(Button, {
									size: "sm",
									variant: "outline",
									onClick: release,
									children: t("Hand back to bot")
								}) : null
							]
						})]
					}),
					/* @__PURE__ */ jsx("div", {
						className: "flex flex-1 flex-col gap-3",
						children: dedupedMessages.map((m) => /* @__PURE__ */ jsx("div", {
							className: `max-w-[85%] rounded-xl px-4 py-2 text-sm ${m.role === "user" ? "self-end bg-foreground text-background" : "self-start bg-muted"}`,
							children: /* @__PURE__ */ jsx("span", {
								className: "whitespace-pre-wrap",
								children: m.content
							})
						}, m.id))
					}),
					isClaimedByMe && /* @__PURE__ */ jsxs("div", {
						className: "mt-4 flex gap-2 border-t pt-3",
						children: [/* @__PURE__ */ jsx(Textarea, {
							rows: 2,
							value: reply,
							onChange: (e) => setReply(e.target.value),
							onKeyDown: (e) => {
								if (e.key === "Enter" && (e.metaKey || e.ctrlKey)) {
									e.preventDefault();
									send();
								}
							},
							placeholder: t("Type your reply… (Cmd/Ctrl+Enter to send)"),
							className: "min-h-16 flex-1 resize-none"
						}), /* @__PURE__ */ jsx(Button, {
							onClick: send,
							disabled: sending || !reply.trim(),
							children: /* @__PURE__ */ jsx(Send, { className: "size-4" })
						})]
					})
				]
			}), /* @__PURE__ */ jsxs(Card, {
				className: "h-fit p-4",
				children: [
					/* @__PURE__ */ jsx("h2", {
						className: "mb-3 font-medium",
						children: t("Lead")
					}),
					/* @__PURE__ */ jsxs("dl", {
						className: "space-y-2 text-sm",
						children: [
							/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", {
								className: "text-muted-foreground",
								children: t("Email")
							}), /* @__PURE__ */ jsx("dd", {
								className: "font-medium",
								children: lead.email ?? "—"
							})] }),
							/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", {
								className: "text-muted-foreground",
								children: t("Name")
							}), /* @__PURE__ */ jsx("dd", { children: lead.name ?? "—" })] }),
							/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", {
								className: "text-muted-foreground",
								children: t("Phone")
							}), /* @__PURE__ */ jsx("dd", { children: lead.phone ?? "—" })] })
						]
					}),
					/* @__PURE__ */ jsxs("div", {
						className: "mt-4",
						children: [/* @__PURE__ */ jsx("p", {
							className: "mb-1 text-xs text-muted-foreground",
							children: t("Status")
						}), /* @__PURE__ */ jsxs(Select, {
							value: lead.status,
							onValueChange: (v) => router.patch(`/app/inbox/${lead.id}`, { status: v }, { preserveScroll: true }),
							children: [/* @__PURE__ */ jsx(SelectTrigger, { children: /* @__PURE__ */ jsx(SelectValue, {}) }), /* @__PURE__ */ jsx(SelectContent, { children: [
								"new",
								"qualified",
								"contacted",
								"won",
								"lost"
							].map((s) => /* @__PURE__ */ jsx(SelectItem, {
								value: s,
								children: t(s)
							}, s)) })]
						})]
					}),
					lead.routed_to && /* @__PURE__ */ jsxs("div", {
						className: "mt-4",
						children: [/* @__PURE__ */ jsx("p", {
							className: "mb-1 text-xs text-muted-foreground",
							children: t("Delivered to")
						}), /* @__PURE__ */ jsxs("div", {
							className: "flex flex-wrap gap-1",
							children: [deliveryChannels(lead.routed_to, t).map((c) => /* @__PURE__ */ jsx("span", {
								className: `rounded px-2 py-0.5 text-xs ${c.tone}`,
								children: c.label
							}, c.kind)), deliveryChannels(lead.routed_to, t).length === 0 && /* @__PURE__ */ jsx("span", {
								className: "text-xs text-muted-foreground",
								children: "—"
							})]
						})]
					})
				]
			})]
		})]
	});
}
//#endregion
//#region resources/js/routes/oauth/google/index.ts
/**
* @see \App\Http\Controllers\Admin\GoogleOAuthController::start
* @see app/Http/Controllers/Admin/GoogleOAuthController.php:32
* @route '/app/oauth/google/connect'
*/
var start$2 = (options) => ({
	url: start$2.url(options),
	method: "get"
});
start$2.definition = {
	methods: ["get", "head"],
	url: "/app/oauth/google/connect"
};
/**
* @see \App\Http\Controllers\Admin\GoogleOAuthController::start
* @see app/Http/Controllers/Admin/GoogleOAuthController.php:32
* @route '/app/oauth/google/connect'
*/
start$2.url = (options) => {
	return start$2.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\GoogleOAuthController::start
* @see app/Http/Controllers/Admin/GoogleOAuthController.php:32
* @route '/app/oauth/google/connect'
*/
start$2.get = (options) => ({
	url: start$2.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\GoogleOAuthController::start
* @see app/Http/Controllers/Admin/GoogleOAuthController.php:32
* @route '/app/oauth/google/connect'
*/
start$2.head = (options) => ({
	url: start$2.url(options),
	method: "head"
});
/**
* @see \App\Http\Controllers\Admin\GoogleOAuthController::start
* @see app/Http/Controllers/Admin/GoogleOAuthController.php:32
* @route '/app/oauth/google/connect'
*/
var startForm$2 = (options) => ({
	action: start$2.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\GoogleOAuthController::start
* @see app/Http/Controllers/Admin/GoogleOAuthController.php:32
* @route '/app/oauth/google/connect'
*/
startForm$2.get = (options) => ({
	action: start$2.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\GoogleOAuthController::start
* @see app/Http/Controllers/Admin/GoogleOAuthController.php:32
* @route '/app/oauth/google/connect'
*/
startForm$2.head = (options) => ({
	action: start$2.url({ [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
start$2.form = startForm$2;
/**
* @see \App\Http\Controllers\Admin\GoogleOAuthController::callback
* @see app/Http/Controllers/Admin/GoogleOAuthController.php:63
* @route '/app/oauth/google/callback'
*/
var callback$1 = (options) => ({
	url: callback$1.url(options),
	method: "get"
});
callback$1.definition = {
	methods: ["get", "head"],
	url: "/app/oauth/google/callback"
};
/**
* @see \App\Http\Controllers\Admin\GoogleOAuthController::callback
* @see app/Http/Controllers/Admin/GoogleOAuthController.php:63
* @route '/app/oauth/google/callback'
*/
callback$1.url = (options) => {
	return callback$1.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\GoogleOAuthController::callback
* @see app/Http/Controllers/Admin/GoogleOAuthController.php:63
* @route '/app/oauth/google/callback'
*/
callback$1.get = (options) => ({
	url: callback$1.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\GoogleOAuthController::callback
* @see app/Http/Controllers/Admin/GoogleOAuthController.php:63
* @route '/app/oauth/google/callback'
*/
callback$1.head = (options) => ({
	url: callback$1.url(options),
	method: "head"
});
/**
* @see \App\Http\Controllers\Admin\GoogleOAuthController::callback
* @see app/Http/Controllers/Admin/GoogleOAuthController.php:63
* @route '/app/oauth/google/callback'
*/
var callbackForm$1 = (options) => ({
	action: callback$1.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\GoogleOAuthController::callback
* @see app/Http/Controllers/Admin/GoogleOAuthController.php:63
* @route '/app/oauth/google/callback'
*/
callbackForm$1.get = (options) => ({
	action: callback$1.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\GoogleOAuthController::callback
* @see app/Http/Controllers/Admin/GoogleOAuthController.php:63
* @route '/app/oauth/google/callback'
*/
callbackForm$1.head = (options) => ({
	action: callback$1.url({ [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
callback$1.form = callbackForm$1;
Object.assign(start$2, start$2), Object.assign(callback$1, callback$1);
//#endregion
//#region resources/js/routes/oauth/notion/index.ts
/**
* @see \App\Http\Controllers\Admin\NotionOAuthController::start
* @see app/Http/Controllers/Admin/NotionOAuthController.php:26
* @route '/app/oauth/notion/connect'
*/
var start$1 = (options) => ({
	url: start$1.url(options),
	method: "get"
});
start$1.definition = {
	methods: ["get", "head"],
	url: "/app/oauth/notion/connect"
};
/**
* @see \App\Http\Controllers\Admin\NotionOAuthController::start
* @see app/Http/Controllers/Admin/NotionOAuthController.php:26
* @route '/app/oauth/notion/connect'
*/
start$1.url = (options) => {
	return start$1.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\NotionOAuthController::start
* @see app/Http/Controllers/Admin/NotionOAuthController.php:26
* @route '/app/oauth/notion/connect'
*/
start$1.get = (options) => ({
	url: start$1.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\NotionOAuthController::start
* @see app/Http/Controllers/Admin/NotionOAuthController.php:26
* @route '/app/oauth/notion/connect'
*/
start$1.head = (options) => ({
	url: start$1.url(options),
	method: "head"
});
/**
* @see \App\Http\Controllers\Admin\NotionOAuthController::start
* @see app/Http/Controllers/Admin/NotionOAuthController.php:26
* @route '/app/oauth/notion/connect'
*/
var startForm$1 = (options) => ({
	action: start$1.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\NotionOAuthController::start
* @see app/Http/Controllers/Admin/NotionOAuthController.php:26
* @route '/app/oauth/notion/connect'
*/
startForm$1.get = (options) => ({
	action: start$1.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\NotionOAuthController::start
* @see app/Http/Controllers/Admin/NotionOAuthController.php:26
* @route '/app/oauth/notion/connect'
*/
startForm$1.head = (options) => ({
	action: start$1.url({ [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
start$1.form = startForm$1;
/**
* @see \App\Http\Controllers\Admin\NotionOAuthController::callback
* @see app/Http/Controllers/Admin/NotionOAuthController.php:52
* @route '/app/oauth/notion/callback'
*/
var callback = (options) => ({
	url: callback.url(options),
	method: "get"
});
callback.definition = {
	methods: ["get", "head"],
	url: "/app/oauth/notion/callback"
};
/**
* @see \App\Http\Controllers\Admin\NotionOAuthController::callback
* @see app/Http/Controllers/Admin/NotionOAuthController.php:52
* @route '/app/oauth/notion/callback'
*/
callback.url = (options) => {
	return callback.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\NotionOAuthController::callback
* @see app/Http/Controllers/Admin/NotionOAuthController.php:52
* @route '/app/oauth/notion/callback'
*/
callback.get = (options) => ({
	url: callback.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\NotionOAuthController::callback
* @see app/Http/Controllers/Admin/NotionOAuthController.php:52
* @route '/app/oauth/notion/callback'
*/
callback.head = (options) => ({
	url: callback.url(options),
	method: "head"
});
/**
* @see \App\Http\Controllers\Admin\NotionOAuthController::callback
* @see app/Http/Controllers/Admin/NotionOAuthController.php:52
* @route '/app/oauth/notion/callback'
*/
var callbackForm = (options) => ({
	action: callback.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\NotionOAuthController::callback
* @see app/Http/Controllers/Admin/NotionOAuthController.php:52
* @route '/app/oauth/notion/callback'
*/
callbackForm.get = (options) => ({
	action: callback.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\NotionOAuthController::callback
* @see app/Http/Controllers/Admin/NotionOAuthController.php:52
* @route '/app/oauth/notion/callback'
*/
callbackForm.head = (options) => ({
	action: callback.url({ [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
callback.form = callbackForm;
Object.assign(start$1, start$1), Object.assign(callback, callback);
//#endregion
//#region resources/js/pages/app/integrations/index.tsx
var integrations_exports$3 = /* @__PURE__ */ __exportAll({ default: () => IntegrationsPage });
function IntegrationsPage({ integrations, wordpressConnections, webhookSubscriptions, webhookEventOptions, integrationsEnabled, wordpressPlugin }) {
	const { t } = useT();
	const confirm = useConfirm();
	const brand = useBranding().site_title || "Pitchbar";
	const pageProps = usePage().props;
	const rotatedSecret = pageProps.flash?.rotated_secret ?? null;
	const rotatedSubscriptionId = pageProps.flash?.rotated_subscription_id ?? null;
	const [showRotatedSecret, setShowRotatedSecret] = useState(null);
	const [copied, setCopied] = useState(false);
	useEffect(() => {
		if (rotatedSecret && rotatedSubscriptionId) {
			setShowRotatedSecret({
				id: rotatedSubscriptionId,
				secret: rotatedSecret
			});
			setCopied(false);
		}
	}, [rotatedSecret, rotatedSubscriptionId]);
	const slack = integrations.find((i) => i.kind === "slack") ?? null;
	const notion = integrations.find((i) => i.kind === "notion") ?? null;
	const google = integrations.find((i) => i.kind === "google") ?? null;
	const [showForm, setShowForm] = useState(slack === null);
	const [showWebhookForm, setShowWebhookForm] = useState(webhookSubscriptions.length === 0);
	const [editingWebhookId, setEditingWebhookId] = useState(null);
	const defaultWebhookEvents = webhookEventOptions.length > 0 ? webhookEventOptions.map((option) => option.value) : ["lead.captured"];
	const form = useForm({
		webhook_url: "",
		send_test: true
	});
	const webhookForm = useForm({
		url: "",
		secret: "",
		enabled: true,
		events: defaultWebhookEvents
	});
	const startCreatingWebhook = () => {
		setEditingWebhookId(null);
		webhookForm.reset();
		webhookForm.clearErrors();
		setShowWebhookForm(true);
	};
	const startEditingWebhook = (subscription) => {
		setEditingWebhookId(subscription.id);
		webhookForm.clearErrors();
		webhookForm.setData("url", subscription.url);
		webhookForm.setData("secret", "");
		webhookForm.setData("enabled", subscription.enabled);
		webhookForm.setData("events", subscription.events.length > 0 ? subscription.events : defaultWebhookEvents);
		setShowWebhookForm(true);
	};
	const resetWebhookForm = () => {
		setEditingWebhookId(null);
		webhookForm.reset();
		webhookForm.clearErrors();
		setShowWebhookForm(false);
	};
	const toggleWebhookEvent = (value, checked) => {
		const nextEvents = checked ? Array.from(new Set([...webhookForm.data.events, value])) : webhookForm.data.events.filter((event) => event !== value);
		webhookForm.setData("events", nextEvents);
	};
	return /* @__PURE__ */ jsxs(AppLayout, {
		breadcrumbs: [{
			title: t("Integrations"),
			href: index$8.url()
		}],
		children: [
			/* @__PURE__ */ jsx(Head, { title: t("Integrations") }),
			/* @__PURE__ */ jsxs("div", {
				className: "flex flex-1 flex-col gap-4 p-4",
				children: [
					/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("h1", {
						className: "text-2xl font-semibold tracking-tight",
						children: t("Integrations")
					}), /* @__PURE__ */ jsx("p", {
						className: "text-sm text-muted-foreground",
						children: t("Push captured leads to the tools your team already lives in.")
					})] }),
					/* @__PURE__ */ jsx(PlanLimitBanner, { resource: "integration" }),
					integrationsEnabled.slack && /* @__PURE__ */ jsxs(Card, {
						className: "p-5",
						children: [/* @__PURE__ */ jsxs("div", {
							className: "flex items-start justify-between gap-4",
							children: [/* @__PURE__ */ jsxs("div", {
								className: "flex items-start gap-3",
								children: [/* @__PURE__ */ jsx(Slack, { className: "mt-0.5 size-6 text-purple-600" }), /* @__PURE__ */ jsxs("div", { children: [
									/* @__PURE__ */ jsx("p", {
										className: "font-medium",
										children: t("Slack")
									}),
									/* @__PURE__ */ jsx("p", {
										className: "mt-0.5 text-sm text-muted-foreground",
										children: t("Get a message in any channel as soon as a visitor hands over their email.")
									}),
									slack?.is_configured && /* @__PURE__ */ jsxs("p", {
										className: "mt-2 inline-flex flex-wrap items-center gap-1 text-xs text-emerald-600 dark:text-emerald-400",
										children: [
											/* @__PURE__ */ jsx(CheckCircle2, { className: "size-3.5" }),
											" ",
											t("Connected"),
											slack.webhook_hint && /* @__PURE__ */ jsxs("span", {
												className: "text-muted-foreground",
												children: ["· ", slack.webhook_hint]
											}),
											slack.summary && /* @__PURE__ */ jsxs("span", {
												className: "text-muted-foreground",
												children: ["· ", slack.summary]
											})
										]
									})
								] })]
							}), /* @__PURE__ */ jsxs("div", {
								className: "flex shrink-0 gap-2",
								children: [slack?.is_configured && /* @__PURE__ */ jsx(Button, {
									variant: "ghost",
									size: "sm",
									onClick: async () => {
										if (!await confirm({
											title: t("Disconnect Slack?"),
											message: t("Disconnect Slack?"),
											confirmLabel: t("Disconnect"),
											danger: true
										})) return;
										router.delete(destroy$8.url(slack.id));
									},
									children: t("Disconnect")
								}), !showForm && /* @__PURE__ */ jsx(Button, {
									size: "sm",
									onClick: () => setShowForm(true),
									children: slack?.is_configured ? t("Replace") : t("Connect")
								})]
							})]
						}), showForm && /* @__PURE__ */ jsx("div", {
							className: "mt-5 rounded-lg border bg-muted/15",
							children: /* @__PURE__ */ jsxs("div", {
								className: "grid gap-5 p-4 sm:p-5 lg:grid-cols-[220px_1fr] lg:gap-8",
								children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
									className: "text-sm font-medium",
									children: t("Connect webhook")
								}), /* @__PURE__ */ jsx("p", {
									className: "mt-1 text-xs leading-5 text-muted-foreground",
									children: t("Paste the incoming webhook URL for the Slack channel where new leads should be delivered.")
								})] }), /* @__PURE__ */ jsxs("form", {
									onSubmit: (e) => {
										e.preventDefault();
										form.post(store$9.url(), { onSuccess: () => {
											form.reset("webhook_url");
											setShowForm(false);
										} });
									},
									className: "grid gap-4",
									children: [
										/* @__PURE__ */ jsxs("div", {
											className: "grid gap-1.5",
											children: [
												/* @__PURE__ */ jsx(Label, {
													htmlFor: "webhook",
													children: t("Slack Incoming Webhook URL")
												}),
												/* @__PURE__ */ jsx(Input, {
													id: "webhook",
													type: "url",
													placeholder: "https://hooks.slack.com/services/T.../B.../...",
													value: form.data.webhook_url,
													"aria-invalid": Boolean(form.errors.webhook_url),
													onChange: (e) => form.setData("webhook_url", e.target.value)
												}),
												/* @__PURE__ */ jsx("p", {
													className: "text-xs text-muted-foreground",
													children: t("Create one in Slack: Apps → Incoming Webhooks → New Configuration → pick a channel → copy the URL.")
												}),
												/* @__PURE__ */ jsx(InputError, { message: form.errors.webhook_url })
											]
										}),
										/* @__PURE__ */ jsxs("label", {
											htmlFor: "send-test",
											className: "flex items-start gap-3 rounded-md border bg-background px-3 py-2",
											children: [/* @__PURE__ */ jsx(Checkbox, {
												id: "send-test",
												checked: form.data.send_test,
												onCheckedChange: (checked) => form.setData("send_test", checked === true)
											}), /* @__PURE__ */ jsxs("span", { children: [/* @__PURE__ */ jsx("span", {
												className: "block text-sm font-medium",
												children: t("Send a test message")
											}), /* @__PURE__ */ jsx("span", {
												className: "mt-0.5 block text-xs text-muted-foreground",
												children: t("Useful for confirming the webhook is wired to the right channel before the next real lead arrives.")
											})] })]
										}),
										/* @__PURE__ */ jsxs("div", {
											className: "flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",
											children: [/* @__PURE__ */ jsx(Button, {
												type: "button",
												variant: "ghost",
												size: "sm",
												onClick: () => setShowForm(false),
												className: "w-full sm:w-auto",
												children: t("Cancel")
											}), /* @__PURE__ */ jsx(Button, {
												type: "submit",
												size: "sm",
												disabled: form.processing,
												className: "w-full sm:w-auto",
												children: form.processing ? t("Connecting…") : t("Save connection")
											})]
										})
									]
								})]
							})
						})]
					}),
					integrationsEnabled.webhooks && /* @__PURE__ */ jsxs(Card, {
						className: "p-5",
						children: [
							/* @__PURE__ */ jsxs("div", {
								className: "flex items-start justify-between gap-4",
								children: [/* @__PURE__ */ jsxs("div", {
									className: "flex items-start gap-3",
									children: [/* @__PURE__ */ jsx(Send, { className: "mt-0.5 size-6 text-amber-600" }), /* @__PURE__ */ jsxs("div", { children: [
										/* @__PURE__ */ jsx("p", {
											className: "font-medium",
											children: t("Outbound webhooks")
										}),
										/* @__PURE__ */ jsx("p", {
											className: "mt-0.5 text-sm text-muted-foreground",
											children: t("POST signed lead events into your CRM, workflow engine, or internal automation.")
										}),
										/* @__PURE__ */ jsxs("p", {
											className: "mt-2 text-xs text-muted-foreground",
											children: [
												t("Every request includes"),
												" ",
												/* @__PURE__ */ jsx("span", {
													className: "font-mono text-[11px]",
													children: "X-Pitchbar-Signature: t=<unix>,v1=<hmac>"
												}),
												" ",
												t("where the HMAC is SHA-256 over"),
												" ",
												/* @__PURE__ */ jsx("span", {
													className: "font-mono text-[11px]",
													children: "<timestamp>.<raw body>"
												}),
												"."
											]
										})
									] })]
								}), /* @__PURE__ */ jsx("div", {
									className: "flex shrink-0 gap-2",
									children: !showWebhookForm && /* @__PURE__ */ jsx(Button, {
										size: "sm",
										onClick: startCreatingWebhook,
										children: t("Add endpoint")
									})
								})]
							}),
							/* @__PURE__ */ jsx("div", {
								className: "mt-5 grid gap-3",
								children: webhookSubscriptions.length === 0 ? /* @__PURE__ */ jsx("div", {
									className: "rounded-lg border border-dashed bg-muted/10 px-4 py-5 text-sm text-muted-foreground",
									children: t("No outbound webhook endpoints yet.")
								}) : webhookSubscriptions.map((subscription) => /* @__PURE__ */ jsx("div", {
									className: "rounded-xl border border-border/80 bg-muted/10 p-4",
									children: /* @__PURE__ */ jsxs("div", {
										className: "flex flex-col gap-4 lg:flex-row lg:items-start lg:justify-between",
										children: [/* @__PURE__ */ jsxs("div", { children: [
											/* @__PURE__ */ jsxs("div", {
												className: "flex flex-wrap items-center gap-2",
												children: [/* @__PURE__ */ jsx("p", {
													className: "font-medium",
													children: subscription.host ?? t("Custom endpoint")
												}), /* @__PURE__ */ jsx("span", {
													className: `inline-flex items-center rounded-full px-2 py-0.5 text-[11px] font-medium ${subscription.enabled ? "bg-emerald-500/15 text-emerald-700 dark:text-emerald-400" : "bg-amber-500/15 text-amber-700 dark:text-amber-400"}`,
													children: subscription.enabled ? t("Enabled") : t("Paused")
												})]
											}),
											/* @__PURE__ */ jsx("p", {
												className: "mt-1 text-xs break-all text-muted-foreground",
												children: subscription.url
											}),
											/* @__PURE__ */ jsxs("div", {
												className: "mt-3 flex flex-wrap items-center gap-2 text-xs text-muted-foreground",
												children: [subscription.event_labels.map((label) => /* @__PURE__ */ jsx("span", {
													className: "rounded-full border border-border/80 px-2 py-1",
													children: label
												}, `${subscription.id}-${label}`)), /* @__PURE__ */ jsxs("span", {
													className: "rounded-full border border-border/80 px-2 py-1 font-mono text-[11px]",
													children: [
														t("Secret"),
														" ",
														subscription.secret_hint
													]
												})]
											})
										] }), /* @__PURE__ */ jsxs("div", {
											className: "flex shrink-0 flex-wrap gap-2",
											children: [
												/* @__PURE__ */ jsx(Button, {
													variant: "ghost",
													size: "sm",
													onClick: () => startEditingWebhook(subscription),
													children: t("Edit")
												}),
												/* @__PURE__ */ jsxs(Button, {
													variant: "ghost",
													size: "sm",
													onClick: async () => {
														if (!await confirm({
															title: t("Rotate secret?"),
															message: t("A new signing secret will be generated. Old secret stops working immediately. Update your verifier with the new value."),
															confirmLabel: t("Rotate"),
															danger: true
														})) return;
														router.post(`/app/integrations/webhooks/${subscription.id}/rotate-secret`, {}, { preserveScroll: true });
													},
													children: [/* @__PURE__ */ jsx(RefreshCcw, { className: "mr-1 h-3.5 w-3.5" }), t("Rotate secret")]
												}),
												/* @__PURE__ */ jsx(Button, {
													variant: "ghost",
													size: "sm",
													onClick: async () => {
														if (!await confirm({
															title: t("Delete webhook?"),
															message: t("Delete this webhook endpoint?"),
															confirmLabel: t("Delete"),
															danger: true
														})) return;
														router.delete(destroy$9.url(subscription.id));
													},
													children: t("Delete")
												})
											]
										})]
									})
								}, subscription.id))
							}),
							showWebhookForm && /* @__PURE__ */ jsx("div", {
								className: "mt-5 rounded-lg border bg-muted/15",
								children: /* @__PURE__ */ jsxs("div", {
									className: "grid gap-5 p-4 sm:p-5 lg:grid-cols-[220px_1fr] lg:gap-8",
									children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
										className: "text-sm font-medium",
										children: editingWebhookId === null ? t("Add endpoint") : t("Edit endpoint")
									}), /* @__PURE__ */ jsx("p", {
										className: "mt-1 text-xs leading-5 text-muted-foreground",
										children: t("Configure where signed lead events should land. Rotate the secret any time you need to invalidate an old receiver.")
									})] }), /* @__PURE__ */ jsxs("form", {
										onSubmit: (event) => {
											event.preventDefault();
											const onSuccess = () => {
												webhookForm.reset();
												setEditingWebhookId(null);
												setShowWebhookForm(false);
											};
											if (editingWebhookId === null) {
												webhookForm.post(store$8.url(), { onSuccess });
												return;
											}
											webhookForm.patch(update$9.url(editingWebhookId), { onSuccess });
										},
										className: "grid gap-4",
										children: [
											/* @__PURE__ */ jsxs("div", {
												className: "grid gap-1.5",
												children: [
													/* @__PURE__ */ jsx(Label, {
														htmlFor: "outbound-webhook-url",
														children: t("Endpoint URL")
													}),
													/* @__PURE__ */ jsx(Input, {
														id: "outbound-webhook-url",
														type: "url",
														placeholder: "https://example.com/webhooks/pitchbar",
														value: webhookForm.data.url,
														"aria-invalid": Boolean(webhookForm.errors.url),
														onChange: (event) => webhookForm.setData("url", event.target.value)
													}),
													/* @__PURE__ */ jsx("p", {
														className: "text-xs text-muted-foreground",
														children: t(":brand sends JSON with a signed HMAC header so your receiver can verify the request body.", { brand })
													}),
													/* @__PURE__ */ jsx(InputError, { message: webhookForm.errors.url })
												]
											}),
											/* @__PURE__ */ jsxs("div", {
												className: "grid gap-1.5",
												children: [
													/* @__PURE__ */ jsx(Label, {
														htmlFor: "outbound-webhook-secret",
														children: editingWebhookId === null ? t("Signing secret") : t("Rotate signing secret")
													}),
													/* @__PURE__ */ jsx(Input, {
														id: "outbound-webhook-secret",
														type: "password",
														placeholder: editingWebhookId === null ? t("Use at least 12 characters") : t("Leave blank to keep the current secret"),
														value: webhookForm.data.secret,
														"aria-invalid": Boolean(webhookForm.errors.secret),
														onChange: (event) => webhookForm.setData("secret", event.target.value)
													}),
													/* @__PURE__ */ jsxs("p", {
														className: "text-xs text-muted-foreground",
														children: [
															t("Recompute"),
															" ",
															/* @__PURE__ */ jsx("span", {
																className: "font-mono text-[11px]",
																children: "hash_hmac('sha256', '<timestamp>.<raw body>', secret)"
															}),
															" ",
															t("on the receiver and compare it to the header value.")
														]
													}),
													/* @__PURE__ */ jsx(InputError, { message: webhookForm.errors.secret })
												]
											}),
											/* @__PURE__ */ jsxs("div", {
												className: "grid gap-3 rounded-md border bg-background px-3 py-3",
												children: [
													/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
														className: "text-sm font-medium",
														children: t("Events")
													}), /* @__PURE__ */ jsx("p", {
														className: "mt-0.5 text-xs text-muted-foreground",
														children: t("Choose which platform events get pushed to this endpoint.")
													})] }),
													webhookEventOptions.map((option) => /* @__PURE__ */ jsxs("label", {
														htmlFor: `event-${option.value}`,
														className: "flex items-start gap-3 rounded-md border bg-muted/10 px-3 py-2",
														children: [/* @__PURE__ */ jsx(Checkbox, {
															id: `event-${option.value}`,
															checked: webhookForm.data.events.includes(option.value),
															onCheckedChange: (checked) => toggleWebhookEvent(option.value, checked === true)
														}), /* @__PURE__ */ jsx("span", {
															className: "block text-sm font-medium",
															children: option.label
														})]
													}, option.value)),
													/* @__PURE__ */ jsx(InputError, { message: webhookForm.errors.events })
												]
											}),
											/* @__PURE__ */ jsxs("label", {
												htmlFor: "enable-webhook",
												className: "flex items-start gap-3 rounded-md border bg-background px-3 py-2",
												children: [/* @__PURE__ */ jsx(Checkbox, {
													id: "enable-webhook",
													checked: webhookForm.data.enabled,
													onCheckedChange: (checked) => webhookForm.setData("enabled", checked === true)
												}), /* @__PURE__ */ jsxs("span", { children: [/* @__PURE__ */ jsx("span", {
													className: "block text-sm font-medium",
													children: t("Endpoint enabled")
												}), /* @__PURE__ */ jsx("span", {
													className: "mt-0.5 block text-xs text-muted-foreground",
													children: t("Pause delivery without deleting the endpoint configuration.")
												})] })]
											}),
											/* @__PURE__ */ jsxs("div", {
												className: "flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",
												children: [/* @__PURE__ */ jsx(Button, {
													type: "button",
													variant: "ghost",
													size: "sm",
													onClick: resetWebhookForm,
													className: "w-full sm:w-auto",
													children: t("Cancel")
												}), /* @__PURE__ */ jsx(Button, {
													type: "submit",
													size: "sm",
													disabled: webhookForm.processing,
													className: "w-full sm:w-auto",
													children: webhookForm.processing ? t("Saving…") : editingWebhookId === null ? t("Save endpoint") : t("Update endpoint")
												})]
											})
										]
									})]
								})
							})
						]
					}),
					integrationsEnabled.wordpress && /* @__PURE__ */ jsx(Card, {
						className: "p-5",
						children: /* @__PURE__ */ jsxs("div", {
							className: "flex items-start gap-3",
							children: [/* @__PURE__ */ jsx(Globe, { className: "mt-0.5 size-6 text-blue-600" }), /* @__PURE__ */ jsxs("div", {
								className: "min-w-0 flex-1",
								children: [
									/* @__PURE__ */ jsxs("div", {
										className: "flex flex-wrap items-center gap-2",
										children: [/* @__PURE__ */ jsx("p", {
											className: "font-medium",
											children: t("WordPress & WooCommerce")
										}), wordpressConnections.length > 0 && /* @__PURE__ */ jsxs("span", {
											className: "inline-flex items-center gap-1 rounded-full bg-emerald-500/10 px-2 py-0.5 text-xs font-medium text-emerald-600 dark:text-emerald-400",
											children: [/* @__PURE__ */ jsx(CheckCircle2, { className: "size-3" }), wordpressConnections.length === 1 ? t("1 site connected") : t(":n sites connected", { n: String(wordpressConnections.length) })]
										})]
									}),
									/* @__PURE__ */ jsx("p", {
										className: "mt-0.5 text-sm text-muted-foreground",
										children: t("Install the :brand plugin on your WordPress site to embed the chat widget, sync posts and products as agent knowledge, and (with WooCommerce) enable order lookup, coupon apply, and abandoned-cart triggers.", { brand })
									}),
									wordpressConnections.length === 0 ? /* @__PURE__ */ jsx("p", {
										className: "mt-3 text-xs text-muted-foreground",
										children: t("No WordPress sites connected yet. Install the :brand plugin from CodeCanyon (or your :brand admin) on your WP site, paste this workspace URL + an API token, and pick the agent you want to attach.", { brand })
									}) : /* @__PURE__ */ jsx("ul", {
										className: "mt-3 space-y-2",
										children: wordpressConnections.map((row) => /* @__PURE__ */ jsxs("li", {
											className: "rounded-md border border-border bg-muted/30 px-3 py-2 text-sm",
											children: [/* @__PURE__ */ jsxs("div", {
												className: "flex flex-wrap items-center justify-between gap-2",
												children: [/* @__PURE__ */ jsxs("div", {
													className: "flex min-w-0 items-center gap-2",
													children: [/* @__PURE__ */ jsx("span", {
														className: "truncate font-medium",
														children: row.agent_name
													}), row.woocommerce_active && /* @__PURE__ */ jsxs("span", {
														className: "inline-flex items-center gap-1 rounded-full bg-purple-500/10 px-1.5 py-0.5 text-[10px] font-semibold tracking-wide text-purple-600 uppercase dark:text-purple-400",
														children: [/* @__PURE__ */ jsx(ShoppingBag, { className: "size-3" }), t("WooCommerce")]
													})]
												}), row.last_seen_at && /* @__PURE__ */ jsx("span", {
													className: "shrink-0 text-xs text-muted-foreground",
													title: row.last_seen_at,
													children: t("Last seen :when", { when: relativeTime$8(row.last_seen_at) })
												})]
											}), /* @__PURE__ */ jsxs("div", {
												className: "mt-1 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-muted-foreground",
												children: [
													row.site_url && /* @__PURE__ */ jsx("a", {
														href: row.site_url,
														target: "_blank",
														rel: "noopener noreferrer",
														className: "truncate font-mono text-foreground/70 hover:underline",
														children: row.site_url.replace(/^https?:\/\//, "")
													}),
													row.plugin_version && /* @__PURE__ */ jsx("span", { children: t("Plugin v:v", { v: row.plugin_version }) }),
													row.wordpress_version && /* @__PURE__ */ jsx("span", { children: t("WordPress :v", { v: row.wordpress_version }) })
												]
											})]
										}, row.agent_id))
									}),
									/* @__PURE__ */ jsxs("p", {
										className: "mt-3 text-xs text-muted-foreground",
										children: [
											wordpressPlugin?.help_text ?? t("Need the plugin? Download it from your CodeCanyon receipt, or read the setup guide:"),
											" ",
											wordpressPlugin?.download_url && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("a", {
												href: wordpressPlugin.download_url,
												target: "_blank",
												rel: "noopener noreferrer",
												className: "font-medium underline",
												children: t("Download plugin")
											}), " · "] }),
											/* @__PURE__ */ jsx("a", {
												href: "/documentation/wordpress-install",
												className: "font-medium underline",
												children: t("WordPress install & connect")
											}),
											"."
										]
									})
								]
							})]
						})
					}),
					integrationsEnabled.notion && /* @__PURE__ */ jsxs(Card, {
						className: "p-5",
						children: [/* @__PURE__ */ jsxs("div", {
							className: "flex items-start justify-between gap-4",
							children: [/* @__PURE__ */ jsxs("div", {
								className: "flex items-start gap-3",
								children: [/* @__PURE__ */ jsx(BookOpen, { className: "mt-0.5 size-6 text-slate-700 dark:text-slate-300" }), /* @__PURE__ */ jsxs("div", { children: [
									/* @__PURE__ */ jsx("p", {
										className: "font-medium",
										children: t("Notion")
									}),
									/* @__PURE__ */ jsx("p", {
										className: "mt-0.5 text-sm text-muted-foreground",
										children: t("Index pages from your Notion workspace as agent knowledge — no manual export.")
									}),
									notion?.is_configured && /* @__PURE__ */ jsxs("p", {
										className: "mt-2 inline-flex flex-wrap items-center gap-1 text-xs text-emerald-600 dark:text-emerald-400",
										children: [
											/* @__PURE__ */ jsx(CheckCircle2, { className: "size-3.5" }),
											" ",
											t("Connected"),
											notion.webhook_hint && /* @__PURE__ */ jsxs("span", {
												className: "text-muted-foreground",
												children: ["· ", notion.webhook_hint]
											}),
											notion.summary && /* @__PURE__ */ jsxs("span", {
												className: "text-muted-foreground",
												children: ["· ", notion.summary]
											})
										]
									})
								] })]
							}), /* @__PURE__ */ jsxs("div", {
								className: "flex shrink-0 gap-2",
								children: [notion?.is_configured && /* @__PURE__ */ jsx(Button, {
									variant: "ghost",
									size: "sm",
									onClick: async () => {
										if (!await confirm({
											title: t("Disconnect Notion?"),
											message: t("Disconnect Notion?"),
											confirmLabel: t("Disconnect"),
											danger: true
										})) return;
										router.delete(destroy$8.url(notion.id));
									},
									children: t("Disconnect")
								}), /* @__PURE__ */ jsx(Button, {
									size: "sm",
									onClick: () => {
										window.location.href = start$1.url();
									},
									children: notion?.is_configured ? t("Reconnect") : t("Connect Notion")
								})]
							})]
						}), notion?.is_configured && /* @__PURE__ */ jsx("p", {
							className: "mt-3 text-xs text-muted-foreground",
							children: t("Once connected, paste a Notion page URL on any agent's Sources page to ingest it.")
						})]
					}),
					integrationsEnabled.google && /* @__PURE__ */ jsxs(Card, {
						className: "p-5",
						children: [/* @__PURE__ */ jsxs("div", {
							className: "flex items-start justify-between gap-4",
							children: [/* @__PURE__ */ jsxs("div", {
								className: "flex items-start gap-3",
								children: [/* @__PURE__ */ jsx(FileText, { className: "mt-0.5 size-6 text-blue-600" }), /* @__PURE__ */ jsxs("div", { children: [
									/* @__PURE__ */ jsx("p", {
										className: "font-medium",
										children: t("Google Drive (Docs)")
									}),
									/* @__PURE__ */ jsx("p", {
										className: "mt-0.5 text-sm text-muted-foreground",
										children: t("Index Google Docs as agent knowledge with read-only Drive access.")
									}),
									google?.is_configured && /* @__PURE__ */ jsxs("p", {
										className: "mt-2 inline-flex flex-wrap items-center gap-1 text-xs text-emerald-600 dark:text-emerald-400",
										children: [
											/* @__PURE__ */ jsx(CheckCircle2, { className: "size-3.5" }),
											" ",
											t("Connected"),
											google.summary && /* @__PURE__ */ jsxs("span", {
												className: "text-muted-foreground",
												children: ["· ", google.summary]
											})
										]
									})
								] })]
							}), /* @__PURE__ */ jsxs("div", {
								className: "flex shrink-0 gap-2",
								children: [google?.is_configured && /* @__PURE__ */ jsx(Button, {
									variant: "ghost",
									size: "sm",
									onClick: async () => {
										if (!await confirm({
											title: t("Disconnect Google?"),
											message: t("Disconnect Google?"),
											confirmLabel: t("Disconnect"),
											danger: true
										})) return;
										router.delete(destroy$8.url(google.id));
									},
									children: t("Disconnect")
								}), /* @__PURE__ */ jsx(Button, {
									size: "sm",
									onClick: () => {
										window.location.href = start$2.url();
									},
									children: google?.is_configured ? t("Reconnect") : t("Connect Google")
								})]
							})]
						}), google?.is_configured && /* @__PURE__ */ jsx("p", {
							className: "mt-3 text-xs text-muted-foreground",
							children: t("Once connected, paste a Google Doc URL on any agent's Sources page to ingest it.")
						})]
					})
				]
			}),
			showRotatedSecret && /* @__PURE__ */ jsx("div", {
				className: "fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4",
				onClick: () => setShowRotatedSecret(null),
				children: /* @__PURE__ */ jsxs("div", {
					className: "w-full max-w-lg rounded-xl border border-border bg-card p-6 shadow-2xl",
					onClick: (e) => e.stopPropagation(),
					children: [
						/* @__PURE__ */ jsx("h3", {
							className: "text-lg font-semibold",
							children: t("New webhook signing secret")
						}),
						/* @__PURE__ */ jsx("p", {
							className: "mt-2 text-sm text-muted-foreground",
							children: t("Copy this value now and paste it into your verifier. It will not be shown again — if you lose it you must rotate again.")
						}),
						/* @__PURE__ */ jsxs("div", {
							className: "mt-4 flex items-center gap-2 rounded-lg border bg-muted/30 p-3 font-mono text-sm",
							children: [/* @__PURE__ */ jsx("code", {
								className: "flex-1 break-all",
								children: showRotatedSecret.secret
							}), /* @__PURE__ */ jsx(Button, {
								size: "sm",
								variant: "ghost",
								onClick: async () => {
									try {
										await navigator.clipboard.writeText(showRotatedSecret.secret);
										setCopied(true);
									} catch {
										setCopied(false);
									}
								},
								children: copied ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(CheckCircle2, { className: "mr-1 h-4 w-4" }), t("Copied")] }) : /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Copy, { className: "mr-1 h-4 w-4" }), t("Copy")] })
							})]
						}),
						/* @__PURE__ */ jsx("div", {
							className: "mt-5 flex justify-end",
							children: /* @__PURE__ */ jsx(Button, {
								onClick: () => setShowRotatedSecret(null),
								children: t("Done")
							})
						})
					]
				})
			})
		]
	});
}
//#endregion
//#region resources/js/pages/app/razorpay-checkout.tsx
var razorpay_checkout_exports = /* @__PURE__ */ __exportAll({ default: () => RazorpayCheckout });
var SCRIPT_SRC = "https://checkout.razorpay.com/v1/checkout.js";
/**
* Thin launcher page that boots Razorpay's hosted Checkout.js with the
* server-created subscription. The webhook is the source of truth for
* the actual subscription state — this page just hands the customer off
* to Razorpay's hosted UI and forwards them back to /app/billing on
* success or cancel.
*/
function RazorpayCheckout({ razorpay_key_id, subscription_id, plan, customer, success_url, cancel_url }) {
	const { t } = useT();
	const brandName = useBranding().site_title || t("Sales AI");
	const [scriptError, setScriptError] = useState(null);
	const opened = useRef(false);
	useEffect(() => {
		if (opened.current) return;
		const open = () => {
			if (opened.current || !window.Razorpay) return;
			opened.current = true;
			const rzp = new window.Razorpay({
				key: razorpay_key_id,
				subscription_id,
				name: brandName,
				description: t(":name subscription", { name: plan.name }),
				prefill: {
					name: customer.name,
					email: customer.email
				},
				theme: { color: "#111827" },
				handler: () => {
					router.visit(success_url);
				},
				modal: { ondismiss: () => {
					router.visit(cancel_url);
				} }
			});
			rzp.on("payment.failed", () => {
				router.visit(cancel_url);
			});
			rzp.open();
		};
		if (window.Razorpay) {
			open();
			return;
		}
		const existing = document.querySelector(`script[src="${SCRIPT_SRC}"]`);
		if (existing) {
			existing.addEventListener("load", open);
			existing.addEventListener("error", () => setScriptError(t("Could not load Razorpay Checkout.")));
			return () => {
				existing.removeEventListener("load", open);
			};
		}
		const script = document.createElement("script");
		script.src = SCRIPT_SRC;
		script.async = true;
		script.onload = open;
		script.onerror = () => setScriptError(t("Could not load Razorpay Checkout."));
		document.body.appendChild(script);
	}, [
		razorpay_key_id,
		subscription_id,
		plan.name,
		customer.name,
		customer.email,
		success_url,
		cancel_url,
		brandName,
		t
	]);
	return /* @__PURE__ */ jsxs(AppLayout, {
		breadcrumbs: [{
			title: t("Billing"),
			href: "/app/billing"
		}],
		children: [/* @__PURE__ */ jsx(Head, { title: t("Razorpay checkout") }), /* @__PURE__ */ jsx("div", {
			className: "flex flex-1 items-center justify-center p-6",
			children: /* @__PURE__ */ jsxs(Card, {
				className: "w-full max-w-md p-6 text-center",
				children: [
					/* @__PURE__ */ jsx("h1", {
						className: "text-xl font-semibold tracking-tight",
						children: t("Opening Razorpay…")
					}),
					/* @__PURE__ */ jsxs("p", {
						className: "mt-2 text-sm text-muted-foreground",
						children: [
							t("Subscribing to"),
							" ",
							/* @__PURE__ */ jsx("span", {
								className: "font-medium",
								children: plan.name
							}),
							" ",
							t("for"),
							" ",
							plan.currency,
							" ",
							(plan.price_cents / 100).toFixed(2),
							" ",
							t("/ month.")
						]
					}),
					scriptError && /* @__PURE__ */ jsx("p", {
						className: "mt-4 text-sm text-rose-600",
						children: scriptError
					}),
					/* @__PURE__ */ jsx("div", {
						className: "mt-6 flex justify-center gap-2",
						children: /* @__PURE__ */ jsx(Button, {
							asChild: true,
							variant: "outline",
							children: /* @__PURE__ */ jsx("a", {
								href: cancel_url,
								children: t("Cancel")
							})
						})
					})
				]
			})
		})]
	});
}
//#endregion
//#region resources/js/pages/app/settings/canned-replies.tsx
var canned_replies_exports = /* @__PURE__ */ __exportAll({ default: () => CannedRepliesSettings });
function CannedRepliesSettings({ replies }) {
	const { t } = useT();
	const confirm = useConfirm();
	const [editingId, setEditingId] = useState(null);
	const [showCreate, setShowCreate] = useState(false);
	const breadcrumbs = [{
		title: t("Canned replies"),
		href: "/app/settings/canned-replies"
	}];
	const move = (id, direction) => {
		const idx = replies.findIndex((r) => r.id === id);
		if (idx === -1) return;
		const swap = direction === "up" ? idx - 1 : idx + 1;
		if (swap < 0 || swap >= replies.length) return;
		const next = [...replies];
		[next[idx], next[swap]] = [next[swap], next[idx]];
		router.patch("/app/settings/canned-replies/reorder", { ordered_ids: next.map((r) => r.id) }, { preserveScroll: true });
	};
	const remove = async (id) => {
		if (!await confirm({
			title: t("Delete canned reply?"),
			message: t("Delete this canned reply? This cannot be undone."),
			confirmLabel: t("Delete"),
			danger: true
		})) return;
		router.delete(`/app/settings/canned-replies/${id}`, {
			preserveScroll: true,
			onSuccess: () => toast.success(t("Removed."))
		});
	};
	return /* @__PURE__ */ jsxs(AppLayout, {
		breadcrumbs,
		children: [/* @__PURE__ */ jsx(Head, { title: t("Canned replies") }), /* @__PURE__ */ jsxs("div", {
			className: "flex flex-1 flex-col gap-4 p-4",
			children: [
				/* @__PURE__ */ jsxs("div", {
					className: "flex flex-wrap items-start justify-between gap-3",
					children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsxs("h1", {
						className: "flex items-center gap-2 text-2xl font-semibold tracking-tight",
						children: [/* @__PURE__ */ jsx(Sparkles, { className: "size-5" }), t("Canned replies")]
					}), /* @__PURE__ */ jsx("p", {
						className: "mt-1 max-w-prose text-sm text-muted-foreground",
						children: t("Save the replies you find yourself typing over and over. Operators can drop them into a live conversation in two clicks.")
					})] }), /* @__PURE__ */ jsxs(Button, {
						type: "button",
						size: "sm",
						onClick: () => setShowCreate(true),
						disabled: showCreate,
						children: [/* @__PURE__ */ jsx(Plus, { className: "me-1.5 size-3.5" }), t("New canned reply")]
					})]
				}),
				showCreate && /* @__PURE__ */ jsx(CreateForm, { onDone: () => setShowCreate(false) }),
				replies.length === 0 && !showCreate ? /* @__PURE__ */ jsxs(Card, {
					className: "p-8 text-center",
					children: [
						/* @__PURE__ */ jsx(Sparkles, { className: "mx-auto size-10 text-muted-foreground/40" }),
						/* @__PURE__ */ jsx("p", {
							className: "mt-3 text-sm font-medium",
							children: t("No canned replies yet.")
						}),
						/* @__PURE__ */ jsx("p", {
							className: "mt-1 text-xs text-muted-foreground",
							children: t("Add one to make your operators 10× faster on common questions.")
						})
					]
				}) : /* @__PURE__ */ jsx("div", {
					className: "flex flex-col gap-2",
					children: replies.map((r, i) => editingId === r.id ? /* @__PURE__ */ jsx(EditForm, {
						reply: r,
						onDone: () => setEditingId(null)
					}, r.id) : /* @__PURE__ */ jsxs(Card, {
						className: "flex flex-wrap items-start gap-3 p-3",
						children: [
							/* @__PURE__ */ jsxs("div", {
								className: "flex flex-col gap-1",
								children: [/* @__PURE__ */ jsx(Button, {
									type: "button",
									size: "sm",
									variant: "ghost",
									disabled: i === 0,
									onClick: () => move(r.id, "up"),
									className: "h-6 w-6 p-0",
									children: /* @__PURE__ */ jsx(ArrowUp, { className: "size-3" })
								}), /* @__PURE__ */ jsx(Button, {
									type: "button",
									size: "sm",
									variant: "ghost",
									disabled: i === replies.length - 1,
									onClick: () => move(r.id, "down"),
									className: "h-6 w-6 p-0",
									children: /* @__PURE__ */ jsx(ArrowDown, { className: "size-3" })
								})]
							}),
							/* @__PURE__ */ jsxs("div", {
								className: "min-w-0 flex-1",
								children: [/* @__PURE__ */ jsx("p", {
									className: "text-sm font-semibold",
									children: r.label
								}), /* @__PURE__ */ jsx("p", {
									className: "mt-1 line-clamp-2 text-xs text-muted-foreground",
									children: r.content
								})]
							}),
							/* @__PURE__ */ jsxs("div", {
								className: "flex shrink-0 items-center gap-1.5",
								children: [/* @__PURE__ */ jsx(Button, {
									type: "button",
									size: "sm",
									variant: "outline",
									onClick: () => setEditingId(r.id),
									children: t("Edit")
								}), /* @__PURE__ */ jsx(Button, {
									type: "button",
									size: "sm",
									variant: "ghost",
									onClick: () => remove(r.id),
									className: "text-red-600 hover:text-red-700",
									children: /* @__PURE__ */ jsx(Trash2, { className: "size-3.5" })
								})]
							})
						]
					}, r.id))
				})
			]
		})]
	});
}
function CreateForm({ onDone }) {
	const { t } = useT();
	const form = useForm({
		label: "",
		content: ""
	});
	const submit = (e) => {
		e.preventDefault();
		form.post("/app/settings/canned-replies", {
			preserveScroll: true,
			onSuccess: () => {
				form.reset();
				onDone();
			}
		});
	};
	return /* @__PURE__ */ jsx(Card, {
		className: "p-4",
		children: /* @__PURE__ */ jsxs("form", {
			onSubmit: submit,
			className: "grid gap-3",
			children: [
				/* @__PURE__ */ jsxs("div", {
					className: "flex items-center justify-between",
					children: [/* @__PURE__ */ jsx("h2", {
						className: "text-sm font-semibold",
						children: t("New canned reply")
					}), /* @__PURE__ */ jsx(Button, {
						type: "button",
						size: "sm",
						variant: "ghost",
						onClick: onDone,
						className: "h-7 w-7 p-0",
						children: /* @__PURE__ */ jsx(X, { className: "size-3.5" })
					})]
				}),
				/* @__PURE__ */ jsxs("div", {
					className: "grid gap-1.5",
					children: [
						/* @__PURE__ */ jsx(Label, {
							htmlFor: "label",
							children: t("Label")
						}),
						/* @__PURE__ */ jsx(Input, {
							id: "label",
							value: form.data.label,
							onChange: (e) => form.setData("label", e.target.value),
							placeholder: t("Reset password"),
							maxLength: 80,
							required: true
						}),
						form.errors.label && /* @__PURE__ */ jsx("p", {
							className: "text-xs text-red-600",
							children: form.errors.label
						})
					]
				}),
				/* @__PURE__ */ jsxs("div", {
					className: "grid gap-1.5",
					children: [
						/* @__PURE__ */ jsx(Label, {
							htmlFor: "content",
							children: t("Reply text")
						}),
						/* @__PURE__ */ jsx(Textarea, {
							id: "content",
							rows: 4,
							value: form.data.content,
							onChange: (e) => form.setData("content", e.target.value),
							placeholder: t("Click \"Forgot password\" on the sign-in page and follow the email link."),
							required: true
						}),
						form.errors.content && /* @__PURE__ */ jsx("p", {
							className: "text-xs text-red-600",
							children: form.errors.content
						})
					]
				}),
				/* @__PURE__ */ jsxs("div", {
					className: "flex justify-end gap-2",
					children: [/* @__PURE__ */ jsx(Button, {
						type: "button",
						variant: "outline",
						onClick: onDone,
						children: t("Cancel")
					}), /* @__PURE__ */ jsx(Button, {
						type: "submit",
						disabled: form.processing,
						children: t("Save")
					})]
				})
			]
		})
	});
}
function EditForm({ reply, onDone }) {
	const { t } = useT();
	const form = useForm({
		label: reply.label,
		content: reply.content
	});
	const submit = (e) => {
		e.preventDefault();
		form.patch(`/app/settings/canned-replies/${reply.id}`, {
			preserveScroll: true,
			onSuccess: onDone
		});
	};
	return /* @__PURE__ */ jsx(Card, {
		className: "p-4",
		children: /* @__PURE__ */ jsxs("form", {
			onSubmit: submit,
			className: "grid gap-3",
			children: [
				/* @__PURE__ */ jsxs("div", {
					className: "flex items-center justify-between",
					children: [/* @__PURE__ */ jsx("h2", {
						className: "text-sm font-semibold",
						children: t("Edit canned reply")
					}), /* @__PURE__ */ jsx(Button, {
						type: "button",
						size: "sm",
						variant: "ghost",
						onClick: onDone,
						className: "h-7 w-7 p-0",
						children: /* @__PURE__ */ jsx(X, { className: "size-3.5" })
					})]
				}),
				/* @__PURE__ */ jsxs("div", {
					className: "grid gap-1.5",
					children: [/* @__PURE__ */ jsx(Label, {
						htmlFor: `edit-label-${reply.id}`,
						children: t("Label")
					}), /* @__PURE__ */ jsx(Input, {
						id: `edit-label-${reply.id}`,
						value: form.data.label,
						onChange: (e) => form.setData("label", e.target.value),
						maxLength: 80,
						required: true
					})]
				}),
				/* @__PURE__ */ jsxs("div", {
					className: "grid gap-1.5",
					children: [/* @__PURE__ */ jsx(Label, {
						htmlFor: `edit-content-${reply.id}`,
						children: t("Reply text")
					}), /* @__PURE__ */ jsx(Textarea, {
						id: `edit-content-${reply.id}`,
						rows: 4,
						value: form.data.content,
						onChange: (e) => form.setData("content", e.target.value),
						required: true
					})]
				}),
				/* @__PURE__ */ jsxs("div", {
					className: "flex justify-end gap-2",
					children: [/* @__PURE__ */ jsx(Button, {
						type: "button",
						variant: "outline",
						onClick: onDone,
						children: t("Cancel")
					}), /* @__PURE__ */ jsx(Button, {
						type: "submit",
						disabled: form.processing,
						children: t("Save changes")
					})]
				})
			]
		})
	});
}
//#endregion
//#region resources/js/components/live-chat/business-hours-grid.tsx
var DAY_KEYS = [
	"monday",
	"tuesday",
	"wednesday",
	"thursday",
	"friday",
	"saturday",
	"sunday"
];
var COMMON_TIMEZONES = [
	"UTC",
	"America/New_York",
	"America/Chicago",
	"America/Denver",
	"America/Los_Angeles",
	"America/Sao_Paulo",
	"Europe/London",
	"Europe/Paris",
	"Europe/Berlin",
	"Europe/Madrid",
	"Asia/Dubai",
	"Asia/Kolkata",
	"Asia/Singapore",
	"Asia/Tokyo",
	"Australia/Sydney"
];
var DEFAULT = {
	enabled: false,
	timezone: "UTC",
	schedule: Object.fromEntries(DAY_KEYS.map((key) => [key, key === "saturday" || key === "sunday" ? [] : [{
		start: "09:00",
		end: "17:00"
	}]]))
};
/**
* Visual editor for the workspace's business_hours JSON. Replaces the
* raw textarea with a 7-row grid: per-day "Closed" toggle + repeatable
* time-window inputs.
*
* State shape on the wire matches the BusinessHours service's
* expectation exactly — no transformation needed in the parent.
*/
function BusinessHoursGrid({ value, onChange }) {
	const { t } = useT();
	const DAYS = [
		{
			key: "monday",
			label: t("Mon")
		},
		{
			key: "tuesday",
			label: t("Tue")
		},
		{
			key: "wednesday",
			label: t("Wed")
		},
		{
			key: "thursday",
			label: t("Thu")
		},
		{
			key: "friday",
			label: t("Fri")
		},
		{
			key: "saturday",
			label: t("Sat")
		},
		{
			key: "sunday",
			label: t("Sun")
		}
	];
	const v = value ?? DEFAULT;
	const isCustomTz = useMemo(() => !COMMON_TIMEZONES.includes(v.timezone), [v.timezone]);
	const setEnabled = (enabled) => {
		onChange({
			...v,
			enabled
		});
	};
	const setTimezone = (timezone) => {
		onChange({
			...v,
			timezone
		});
	};
	const setDayWindows = (day, windows) => {
		onChange({
			...v,
			schedule: {
				...v.schedule,
				[day]: windows
			}
		});
	};
	return /* @__PURE__ */ jsxs("div", {
		className: "grid gap-4",
		children: [
			/* @__PURE__ */ jsxs("div", {
				className: "flex items-center justify-between gap-3 rounded-md border bg-muted/30 p-3",
				children: [/* @__PURE__ */ jsxs("div", {
					className: "flex items-center gap-2",
					children: [/* @__PURE__ */ jsx(Checkbox, {
						id: "bh_enabled",
						checked: v.enabled,
						onCheckedChange: (c) => setEnabled(c === true)
					}), /* @__PURE__ */ jsx(Label, {
						htmlFor: "bh_enabled",
						className: "text-sm font-medium",
						children: t("Enforce business hours")
					})]
				}), /* @__PURE__ */ jsx("span", {
					className: "text-xs text-muted-foreground",
					children: v.enabled ? t("Outside the schedule, visitors get the \"we're closed\" treatment.") : t("Off → always-on (visitors can request a human anytime).")
				})]
			}),
			/* @__PURE__ */ jsxs("div", {
				className: "grid gap-1.5",
				children: [/* @__PURE__ */ jsx(Label, { children: t("Timezone") }), /* @__PURE__ */ jsxs("div", {
					className: "grid grid-cols-1 gap-2 sm:grid-cols-[1fr_auto]",
					children: [/* @__PURE__ */ jsxs(Select, {
						value: isCustomTz ? "__custom__" : v.timezone,
						onValueChange: (tz) => {
							if (tz === "__custom__") setTimezone("");
							else setTimezone(tz);
						},
						children: [/* @__PURE__ */ jsx(SelectTrigger, { children: /* @__PURE__ */ jsx(SelectValue, {}) }), /* @__PURE__ */ jsxs(SelectContent, { children: [COMMON_TIMEZONES.map((tz) => /* @__PURE__ */ jsx(SelectItem, {
							value: tz,
							children: tz
						}, tz)), /* @__PURE__ */ jsx(SelectItem, {
							value: "__custom__",
							children: t("Other (any IANA tz)…")
						})] })]
					}), isCustomTz && /* @__PURE__ */ jsx(Input, {
						type: "text",
						value: v.timezone,
						onChange: (e) => setTimezone(e.target.value),
						placeholder: t("e.g. Pacific/Auckland")
					})]
				})]
			}),
			/* @__PURE__ */ jsx("div", {
				className: "overflow-hidden rounded-md border",
				children: DAYS.map((day, i) => {
					const windows = v.schedule[day.key] ?? [];
					const closed = windows.length === 0;
					return /* @__PURE__ */ jsxs("div", {
						className: `flex flex-wrap items-start gap-3 px-3 py-2.5 ${i < DAYS.length - 1 ? "border-b" : ""} ${closed ? "bg-muted/30" : ""}`,
						children: [
							/* @__PURE__ */ jsx("div", {
								className: "flex w-16 shrink-0 items-center gap-2 pt-1.5",
								children: /* @__PURE__ */ jsx("span", {
									className: "text-xs font-semibold tracking-wider uppercase",
									children: day.label
								})
							}),
							/* @__PURE__ */ jsx("div", {
								className: "flex min-w-0 flex-1 flex-col gap-1.5",
								children: closed ? /* @__PURE__ */ jsx("p", {
									className: "pt-1.5 text-xs text-muted-foreground",
									children: t("Closed all day")
								}) : windows.map((w, wi) => /* @__PURE__ */ jsxs("div", {
									className: "flex items-center gap-2",
									children: [
										/* @__PURE__ */ jsx(Input, {
											type: "time",
											value: w.start,
											onChange: (e) => {
												const next = [...windows];
												next[wi] = {
													...next[wi],
													start: e.target.value
												};
												setDayWindows(day.key, next);
											},
											className: "h-8 w-28 text-sm"
										}),
										/* @__PURE__ */ jsx("span", {
											className: "text-muted-foreground",
											children: "–"
										}),
										/* @__PURE__ */ jsx(Input, {
											type: "time",
											value: w.end,
											onChange: (e) => {
												const next = [...windows];
												next[wi] = {
													...next[wi],
													end: e.target.value
												};
												setDayWindows(day.key, next);
											},
											className: "h-8 w-28 text-sm"
										}),
										/* @__PURE__ */ jsx(Button, {
											type: "button",
											size: "sm",
											variant: "ghost",
											onClick: () => setDayWindows(day.key, windows.filter((_, j) => j !== wi)),
											className: "h-7 w-7 p-0 text-muted-foreground hover:text-red-600",
											children: /* @__PURE__ */ jsx(X, { className: "size-3" })
										})
									]
								}, wi))
							}),
							/* @__PURE__ */ jsxs("div", {
								className: "flex shrink-0 items-center gap-2 pt-1",
								children: [/* @__PURE__ */ jsxs(Button, {
									type: "button",
									size: "sm",
									variant: "outline",
									onClick: () => setDayWindows(day.key, [...windows, {
										start: "09:00",
										end: "17:00"
									}]),
									className: "h-7 text-xs",
									children: [/* @__PURE__ */ jsx(Plus, { className: "me-1 size-3" }), t("Window")]
								}), /* @__PURE__ */ jsxs("div", {
									className: "flex items-center gap-1.5",
									children: [/* @__PURE__ */ jsx(Checkbox, {
										id: `closed_${day.key}`,
										checked: closed,
										onCheckedChange: (c) => setDayWindows(day.key, c === true ? [] : [{
											start: "09:00",
											end: "17:00"
										}])
									}), /* @__PURE__ */ jsx(Label, {
										htmlFor: `closed_${day.key}`,
										className: "text-xs text-muted-foreground",
										children: t("Closed")
									})]
								})]
							})
						]
					}, day.key);
				})
			})
		]
	});
}
//#endregion
//#region resources/js/pages/app/settings/live-chat.tsx
var live_chat_exports = /* @__PURE__ */ __exportAll({ default: () => LiveChatSettings });
function LiveChatSettings({ workspace, preview }) {
	const { t } = useT();
	const form = useForm({
		live_chat_personalize: workspace.live_chat_personalize,
		slack_webhook_url: workspace.slack_webhook_url ?? "",
		teams_webhook_url: workspace.teams_webhook_url ?? "",
		business_hours: workspace.business_hours
	});
	const breadcrumbs = [{
		title: t("Live chat settings"),
		href: "/app/settings/live-chat"
	}];
	const onSubmit = (e) => {
		e.preventDefault();
		form.patch("/app/settings/live-chat", { preserveScroll: true });
	};
	const previewLine = useMemo(() => {
		if (preview.is_open_now) return t("Workspace is currently OPEN. Visitors who request a human will be queued.");
		if (preview.next_open_at) return t("Workspace is currently CLOSED. Next open at :time.", { time: new Date(preview.next_open_at).toLocaleString() });
		return t("Workspace is currently CLOSED (no upcoming open slots configured).");
	}, [
		preview.is_open_now,
		preview.next_open_at,
		t
	]);
	return /* @__PURE__ */ jsxs(AppLayout, {
		breadcrumbs,
		children: [/* @__PURE__ */ jsx(Head, { title: t("Live chat settings") }), /* @__PURE__ */ jsxs("div", {
			className: "flex flex-1 flex-col gap-4 p-4",
			children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("h1", {
				className: "text-2xl font-semibold tracking-tight",
				children: t("Live chat settings")
			}), /* @__PURE__ */ jsx("p", {
				className: "mt-1 text-sm text-muted-foreground",
				children: t("Configure how visitors reach a human, where operators get pinged, and when you're available.")
			})] }), /* @__PURE__ */ jsxs("form", {
				onSubmit,
				className: "grid gap-4",
				children: [
					/* @__PURE__ */ jsx(Card, {
						className: "p-5",
						children: /* @__PURE__ */ jsxs("div", {
							className: "flex items-start gap-3",
							children: [/* @__PURE__ */ jsx(User, { className: "mt-0.5 size-5 text-muted-foreground" }), /* @__PURE__ */ jsxs("div", {
								className: "grid flex-1 gap-1.5",
								children: [
									/* @__PURE__ */ jsx(Label, {
										className: "text-base font-semibold",
										children: t("Show operator name to visitors")
									}),
									/* @__PURE__ */ jsx("p", {
										className: "text-sm text-muted-foreground",
										children: t("On — visitors see \"Sarah joined the chat\". Off — visitors see \"An agent joined\" with no individual identity exposed (recommended for legal, healthcare, finance).")
									}),
									/* @__PURE__ */ jsxs("div", {
										className: "mt-1 flex items-center gap-2",
										children: [/* @__PURE__ */ jsx(Checkbox, {
											id: "live_chat_personalize",
											checked: form.data.live_chat_personalize,
											onCheckedChange: (v) => form.setData("live_chat_personalize", v === true)
										}), /* @__PURE__ */ jsx(Label, {
											htmlFor: "live_chat_personalize",
											className: "text-sm font-medium",
											children: t("Personalize live chat")
										})]
									})
								]
							})]
						})
					}),
					/* @__PURE__ */ jsx(Card, {
						className: "p-5",
						children: /* @__PURE__ */ jsxs("div", {
							className: "flex items-start gap-3",
							children: [/* @__PURE__ */ jsx(MessageSquare, { className: "mt-0.5 size-5 text-muted-foreground" }), /* @__PURE__ */ jsxs("div", {
								className: "grid flex-1 gap-3",
								children: [
									/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx(Label, {
										className: "text-base font-semibold",
										children: t("Slack / Teams notifications")
									}), /* @__PURE__ */ jsx("p", {
										className: "text-sm text-muted-foreground",
										children: t("Paste an incoming-webhook URL. When a visitor asks for a human, we'll fire a compact ping with the conversation link so an operator can jump in from wherever they are.")
									})] }),
									/* @__PURE__ */ jsxs("div", {
										className: "grid gap-1.5",
										children: [
											/* @__PURE__ */ jsx(Label, {
												htmlFor: "slack_webhook_url",
												children: t("Slack webhook URL")
											}),
											/* @__PURE__ */ jsx(Input, {
												id: "slack_webhook_url",
												type: "url",
												autoComplete: "off",
												value: form.data.slack_webhook_url,
												onChange: (e) => form.setData("slack_webhook_url", e.target.value),
												placeholder: "https://hooks.slack.com/services/..."
											}),
											form.errors.slack_webhook_url && /* @__PURE__ */ jsx("p", {
												className: "text-xs text-red-600",
												children: form.errors.slack_webhook_url
											})
										]
									}),
									/* @__PURE__ */ jsxs("div", {
										className: "grid gap-1.5",
										children: [
											/* @__PURE__ */ jsx(Label, {
												htmlFor: "teams_webhook_url",
												children: t("Microsoft Teams webhook URL")
											}),
											/* @__PURE__ */ jsx(Input, {
												id: "teams_webhook_url",
												type: "url",
												autoComplete: "off",
												value: form.data.teams_webhook_url,
												onChange: (e) => form.setData("teams_webhook_url", e.target.value),
												placeholder: "https://outlook.office.com/webhook/..."
											}),
											form.errors.teams_webhook_url && /* @__PURE__ */ jsx("p", {
												className: "text-xs text-red-600",
												children: form.errors.teams_webhook_url
											})
										]
									})
								]
							})]
						})
					}),
					/* @__PURE__ */ jsx(Card, {
						className: "p-5",
						children: /* @__PURE__ */ jsxs("div", {
							className: "flex items-start gap-3",
							children: [/* @__PURE__ */ jsx(Clock, { className: "mt-0.5 size-5 text-muted-foreground" }), /* @__PURE__ */ jsxs("div", {
								className: "grid flex-1 gap-3",
								children: [
									/* @__PURE__ */ jsxs("div", {
										className: "flex items-start justify-between gap-3",
										children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx(Label, {
											className: "text-base font-semibold",
											children: t("Business hours")
										}), /* @__PURE__ */ jsx("p", {
											className: "text-sm text-muted-foreground",
											children: t("When configured + outside the schedule, the visitor sees \"We're closed right now\" and the lead form. Leave the JSON as-is with enabled: false to stay always-on.")
										})] }), /* @__PURE__ */ jsx(Badge, {
											variant: preview.is_open_now ? "default" : "secondary",
											className: preview.is_open_now ? "bg-emerald-600 text-white" : "",
											children: preview.is_open_now ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(CheckCircle2, { className: "me-1 size-3" }), t("Open")] }) : t("Closed")
										})]
									}),
									/* @__PURE__ */ jsxs("div", {
										className: "rounded-md border bg-muted/30 p-2 text-xs text-muted-foreground",
										children: [/* @__PURE__ */ jsx(Building, { className: "me-1 inline size-3" }), previewLine]
									}),
									/* @__PURE__ */ jsx(BusinessHoursGrid, {
										value: form.data.business_hours,
										onChange: (next) => form.setData("business_hours", next)
									})
								]
							})]
						})
					}),
					/* @__PURE__ */ jsx("div", {
						className: "flex justify-end",
						children: /* @__PURE__ */ jsx(Button, {
							type: "submit",
							disabled: form.processing,
							children: form.processing ? t("Saving…") : t("Save")
						})
					})
				]
			})]
		})]
	});
}
//#endregion
//#region resources/js/routes/invitations/index.ts
/**
* @see \App\Http\Controllers\Admin\InvitationController::show
* @see app/Http/Controllers/Admin/InvitationController.php:17
* @route '/invitations/{token}'
*/
var show = (args, options) => ({
	url: show.url(args, options),
	method: "get"
});
show.definition = {
	methods: ["get", "head"],
	url: "/invitations/{token}"
};
/**
* @see \App\Http\Controllers\Admin\InvitationController::show
* @see app/Http/Controllers/Admin/InvitationController.php:17
* @route '/invitations/{token}'
*/
show.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { token: args };
	if (Array.isArray(args)) args = { token: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { token: args.token };
	return show.definition.url.replace("{token}", parsedArgs.token.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\InvitationController::show
* @see app/Http/Controllers/Admin/InvitationController.php:17
* @route '/invitations/{token}'
*/
show.get = (args, options) => ({
	url: show.url(args, options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\InvitationController::show
* @see app/Http/Controllers/Admin/InvitationController.php:17
* @route '/invitations/{token}'
*/
show.head = (args, options) => ({
	url: show.url(args, options),
	method: "head"
});
/**
* @see \App\Http\Controllers\Admin\InvitationController::show
* @see app/Http/Controllers/Admin/InvitationController.php:17
* @route '/invitations/{token}'
*/
var showForm = (args, options) => ({
	action: show.url(args, options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\InvitationController::show
* @see app/Http/Controllers/Admin/InvitationController.php:17
* @route '/invitations/{token}'
*/
showForm.get = (args, options) => ({
	action: show.url(args, options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\InvitationController::show
* @see app/Http/Controllers/Admin/InvitationController.php:17
* @route '/invitations/{token}'
*/
showForm.head = (args, options) => ({
	action: show.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
show.form = showForm;
/**
* @see \App\Http\Controllers\Admin\InvitationController::accept
* @see app/Http/Controllers/Admin/InvitationController.php:35
* @route '/invitations/{token}/accept'
*/
var accept = (args, options) => ({
	url: accept.url(args, options),
	method: "post"
});
accept.definition = {
	methods: ["post"],
	url: "/invitations/{token}/accept"
};
/**
* @see \App\Http\Controllers\Admin\InvitationController::accept
* @see app/Http/Controllers/Admin/InvitationController.php:35
* @route '/invitations/{token}/accept'
*/
accept.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { token: args };
	if (Array.isArray(args)) args = { token: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { token: args.token };
	return accept.definition.url.replace("{token}", parsedArgs.token.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\InvitationController::accept
* @see app/Http/Controllers/Admin/InvitationController.php:35
* @route '/invitations/{token}/accept'
*/
accept.post = (args, options) => ({
	url: accept.url(args, options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\InvitationController::accept
* @see app/Http/Controllers/Admin/InvitationController.php:35
* @route '/invitations/{token}/accept'
*/
var acceptForm = (args, options) => ({
	action: accept.url(args, options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\InvitationController::accept
* @see app/Http/Controllers/Admin/InvitationController.php:35
* @route '/invitations/{token}/accept'
*/
acceptForm.post = (args, options) => ({
	action: accept.url(args, options),
	method: "post"
});
accept.form = acceptForm;
/**
* @see \App\Http\Controllers\Admin\InvitationController::destroy
* @see app/Http/Controllers/Admin/InvitationController.php:131
* @route '/app/invitations/{invitation}'
*/
var destroy$4 = (args, options) => ({
	url: destroy$4.url(args, options),
	method: "delete"
});
destroy$4.definition = {
	methods: ["delete"],
	url: "/app/invitations/{invitation}"
};
/**
* @see \App\Http\Controllers\Admin\InvitationController::destroy
* @see app/Http/Controllers/Admin/InvitationController.php:131
* @route '/app/invitations/{invitation}'
*/
destroy$4.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { invitation: args };
	if (typeof args === "object" && !Array.isArray(args) && "id" in args) args = { invitation: args.id };
	if (Array.isArray(args)) args = { invitation: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { invitation: typeof args.invitation === "object" ? args.invitation.id : args.invitation };
	return destroy$4.definition.url.replace("{invitation}", parsedArgs.invitation.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\InvitationController::destroy
* @see app/Http/Controllers/Admin/InvitationController.php:131
* @route '/app/invitations/{invitation}'
*/
destroy$4.delete = (args, options) => ({
	url: destroy$4.url(args, options),
	method: "delete"
});
/**
* @see \App\Http\Controllers\Admin\InvitationController::destroy
* @see app/Http/Controllers/Admin/InvitationController.php:131
* @route '/app/invitations/{invitation}'
*/
var destroyForm$4 = (args, options) => ({
	action: destroy$4.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "DELETE",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\InvitationController::destroy
* @see app/Http/Controllers/Admin/InvitationController.php:131
* @route '/app/invitations/{invitation}'
*/
destroyForm$4.delete = (args, options) => ({
	action: destroy$4.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "DELETE",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
destroy$4.form = destroyForm$4;
Object.assign(show, show), Object.assign(accept, accept), Object.assign(destroy$4, destroy$4);
//#endregion
//#region resources/js/pages/app/settings/members.tsx
var members_exports = /* @__PURE__ */ __exportAll({ default: () => MembersIndex });
function MembersIndex({ members, pendingInvitations, pagination, filters }) {
	const { t } = useT();
	const form = useForm({
		email: "",
		role: "editor"
	});
	const memberLimit = usePlanLimit("member");
	const canInvite = memberLimit === null || memberLimit.limit === null || memberLimit.allowed && (memberLimit.remaining ?? 1) > 0;
	return /* @__PURE__ */ jsxs(AppLayout, {
		breadcrumbs: [{
			title: t("Members"),
			href: "/app/members"
		}],
		children: [/* @__PURE__ */ jsx(Head, { title: t("Members") }), /* @__PURE__ */ jsxs("div", {
			className: "flex flex-1 flex-col gap-6 p-4",
			children: [
				/* @__PURE__ */ jsx("h1", {
					className: "text-2xl font-semibold tracking-tight",
					children: t("Members")
				}),
				/* @__PURE__ */ jsx(PlanLimitBanner, { resource: "member" }),
				/* @__PURE__ */ jsxs(Card, {
					className: "border-border/80 p-5",
					children: [/* @__PURE__ */ jsx("h2", {
						className: "mb-3 font-medium",
						children: t("Invite a teammate")
					}), /* @__PURE__ */ jsxs("form", {
						onSubmit: (e) => {
							e.preventDefault();
							form.post(store$7.url(), { onSuccess: () => form.reset() });
						},
						className: "grid gap-3 md:grid-cols-[1fr_180px_auto]",
						children: [
							/* @__PURE__ */ jsxs("div", {
								className: "grid gap-1.5",
								children: [
									/* @__PURE__ */ jsx(Label, {
										htmlFor: "email",
										children: t("Email")
									}),
									/* @__PURE__ */ jsx(Input, {
										id: "email",
										type: "email",
										autoComplete: "off",
										value: form.data.email,
										onChange: (e) => form.setData("email", e.target.value)
									}),
									form.errors.email && /* @__PURE__ */ jsx("p", {
										className: "mt-1 text-xs text-destructive",
										children: form.errors.email
									})
								]
							}),
							/* @__PURE__ */ jsxs("div", {
								className: "grid gap-1.5",
								children: [/* @__PURE__ */ jsx(Label, {
									htmlFor: "role",
									children: t("Role")
								}), /* @__PURE__ */ jsxs(Select, {
									value: form.data.role,
									onValueChange: (v) => form.setData("role", v),
									children: [/* @__PURE__ */ jsx(SelectTrigger, {
										id: "role",
										children: /* @__PURE__ */ jsx(SelectValue, {})
									}), /* @__PURE__ */ jsxs(SelectContent, { children: [
										/* @__PURE__ */ jsx(SelectItem, {
											value: "admin",
											children: t("Admin")
										}),
										/* @__PURE__ */ jsx(SelectItem, {
											value: "editor",
											children: t("Editor")
										}),
										/* @__PURE__ */ jsx(SelectItem, {
											value: "viewer",
											children: t("Viewer")
										})
									] })]
								})]
							}),
							/* @__PURE__ */ jsx("div", {
								className: "flex items-end",
								children: /* @__PURE__ */ jsx(Button, {
									type: "submit",
									disabled: form.processing || !canInvite,
									title: canInvite ? void 0 : t("Plan member limit reached"),
									children: t("Send invite")
								})
							})
						]
					})]
				}),
				/* @__PURE__ */ jsxs(Card, {
					className: "p-4",
					children: [
						/* @__PURE__ */ jsxs("div", {
							className: "mb-3 flex items-center justify-between gap-3",
							children: [/* @__PURE__ */ jsx("h2", {
								className: "font-medium",
								children: t("Current members (:total)", { total: pagination.total })
							}), /* @__PURE__ */ jsx(TableSearch, {
								placeholder: t("Search by name or email…"),
								initialValue: filters.q,
								only: [
									"members",
									"pagination",
									"filters"
								]
							})]
						}),
						/* @__PURE__ */ jsx("div", {
							className: "divide-y",
							children: members.map((m) => /* @__PURE__ */ jsxs("div", {
								className: "flex items-center justify-between py-2",
								children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
									className: "font-medium",
									children: m.user.name
								}), /* @__PURE__ */ jsx("p", {
									className: "text-xs text-muted-foreground",
									children: m.user.email
								})] }), /* @__PURE__ */ jsxs("div", {
									className: "flex items-center gap-3",
									children: [/* @__PURE__ */ jsx("span", {
										className: "text-xs tracking-wide text-muted-foreground uppercase",
										children: m.role
									}), m.role !== "owner" && /* @__PURE__ */ jsx(Button, {
										variant: "ghost",
										size: "sm",
										onClick: () => form.delete(destroy$7.url({ member: m.id })),
										children: t("Remove")
									})]
								})]
							}, m.id))
						}),
						/* @__PURE__ */ jsx(TablePagination, {
							pagination,
							only: [
								"members",
								"pagination",
								"filters"
							]
						})
					]
				}),
				pendingInvitations.length > 0 && /* @__PURE__ */ jsxs(Card, {
					className: "p-4",
					children: [/* @__PURE__ */ jsx("h2", {
						className: "mb-3 font-medium",
						children: t("Pending invitations")
					}), /* @__PURE__ */ jsx("div", {
						className: "divide-y",
						children: pendingInvitations.map((inv) => /* @__PURE__ */ jsxs("div", {
							className: "flex items-center justify-between py-2",
							children: [/* @__PURE__ */ jsx("p", {
								className: "font-medium",
								children: inv.email
							}), /* @__PURE__ */ jsxs("div", {
								className: "flex items-center gap-3",
								children: [/* @__PURE__ */ jsx("span", {
									className: "text-xs tracking-wide text-muted-foreground uppercase",
									children: inv.role
								}), /* @__PURE__ */ jsx(Button, {
									variant: "ghost",
									size: "sm",
									onClick: () => {
										if (confirm(t("Revoke invitation for :email?", { email: inv.email }))) router.delete(destroy$4.url({ invitation: inv.id }), { preserveScroll: true });
									},
									children: t("Revoke")
								})]
							})]
						}, inv.id))
					})]
				})
			]
		})]
	});
}
//#endregion
//#region resources/js/pages/app/settings/tags.tsx
var tags_exports = /* @__PURE__ */ __exportAll({ default: () => TagsSettings });
var PALETTE = [
	"#ef4444",
	"#f59e0b",
	"#10b981",
	"#06b6d4",
	"#3b82f6",
	"#8b5cf6",
	"#ec4899",
	"#64748b"
];
function TagsSettings({ tags }) {
	const { t } = useT();
	const confirm = useConfirm();
	const [editingId, setEditingId] = useState(null);
	const [showCreate, setShowCreate] = useState(false);
	const breadcrumbs = [{
		title: t("Tags"),
		href: "/app/settings/tags"
	}];
	const remove = async (id) => {
		if (!await confirm({
			title: t("Delete tag?"),
			message: t("Delete this tag? It will be removed from every conversation."),
			confirmLabel: t("Delete"),
			danger: true
		})) return;
		router.delete(`/app/settings/tags/${id}`, {
			preserveScroll: true,
			onSuccess: () => toast.success(t("Removed."))
		});
	};
	return /* @__PURE__ */ jsxs(AppLayout, {
		breadcrumbs,
		children: [/* @__PURE__ */ jsx(Head, { title: t("Tags") }), /* @__PURE__ */ jsxs("div", {
			className: "flex flex-1 flex-col gap-4 p-4",
			children: [
				/* @__PURE__ */ jsxs("div", {
					className: "flex flex-wrap items-start justify-between gap-3",
					children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsxs("h1", {
						className: "flex items-center gap-2 text-2xl font-semibold tracking-tight",
						children: [/* @__PURE__ */ jsx(Tag, { className: "size-5" }), t("Tags")]
					}), /* @__PURE__ */ jsx("p", {
						className: "mt-1 max-w-prose text-sm text-muted-foreground",
						children: t("Categorize conversations so your team can filter and report on them later. Apply tags from the end-side panel inside any conversation thread.")
					})] }), /* @__PURE__ */ jsxs(Button, {
						type: "button",
						size: "sm",
						onClick: () => setShowCreate(true),
						disabled: showCreate,
						children: [/* @__PURE__ */ jsx(Plus, { className: "me-1.5 size-3.5" }), t("New tag")]
					})]
				}),
				showCreate && /* @__PURE__ */ jsx(TagForm, {
					onDone: () => setShowCreate(false),
					method: "post"
				}),
				tags.length === 0 && !showCreate ? /* @__PURE__ */ jsxs(Card, {
					className: "p-8 text-center",
					children: [
						/* @__PURE__ */ jsx(Tag, { className: "mx-auto size-10 text-muted-foreground/40" }),
						/* @__PURE__ */ jsx("p", {
							className: "mt-3 text-sm font-medium",
							children: t("No tags yet.")
						}),
						/* @__PURE__ */ jsx("p", {
							className: "mt-1 text-xs text-muted-foreground",
							children: t("Try \"Billing\", \"Bug\", \"Refund\", \"Feature request\".")
						})
					]
				}) : /* @__PURE__ */ jsx("div", {
					className: "flex flex-col gap-2",
					children: tags.map((tag) => editingId === tag.id ? /* @__PURE__ */ jsx(TagForm, {
						tag,
						onDone: () => setEditingId(null),
						method: "patch"
					}, tag.id) : /* @__PURE__ */ jsxs(Card, {
						className: "flex items-center gap-3 p-3",
						children: [
							/* @__PURE__ */ jsxs("span", {
								className: "inline-flex items-center gap-1.5 rounded-full px-2.5 py-1 text-xs font-semibold text-white",
								style: { background: tag.color },
								children: [/* @__PURE__ */ jsx(Tag, { className: "size-3" }), tag.label]
							}),
							/* @__PURE__ */ jsx("span", {
								className: "font-mono text-[10px] text-muted-foreground uppercase",
								children: tag.color
							}),
							/* @__PURE__ */ jsxs("div", {
								className: "ms-auto flex items-center gap-1.5",
								children: [/* @__PURE__ */ jsx(Button, {
									type: "button",
									size: "sm",
									variant: "outline",
									onClick: () => setEditingId(tag.id),
									children: t("Edit")
								}), /* @__PURE__ */ jsx(Button, {
									type: "button",
									size: "sm",
									variant: "ghost",
									onClick: () => remove(tag.id),
									className: "text-red-600 hover:text-red-700",
									children: /* @__PURE__ */ jsx(Trash2, { className: "size-3.5" })
								})]
							})
						]
					}, tag.id))
				})
			]
		})]
	});
}
function TagForm({ tag, onDone, method }) {
	const { t } = useT();
	const form = useForm({
		label: tag?.label ?? "",
		color: tag?.color ?? PALETTE[0]
	});
	const submit = (e) => {
		e.preventDefault();
		const url = tag ? `/app/settings/tags/${tag.id}` : "/app/settings/tags";
		const opts = {
			preserveScroll: true,
			onSuccess: onDone
		};
		if (method === "patch") form.patch(url, opts);
		else form.post(url, opts);
	};
	return /* @__PURE__ */ jsx(Card, {
		className: "p-4",
		children: /* @__PURE__ */ jsxs("form", {
			onSubmit: submit,
			className: "grid gap-3",
			children: [
				/* @__PURE__ */ jsxs("div", {
					className: "flex items-center justify-between",
					children: [/* @__PURE__ */ jsx("h2", {
						className: "text-sm font-semibold",
						children: tag ? t("Edit tag") : t("New tag")
					}), /* @__PURE__ */ jsx(Button, {
						type: "button",
						size: "sm",
						variant: "ghost",
						onClick: onDone,
						className: "h-7 w-7 p-0",
						children: /* @__PURE__ */ jsx(X, { className: "size-3.5" })
					})]
				}),
				/* @__PURE__ */ jsxs("div", {
					className: "grid gap-1.5",
					children: [/* @__PURE__ */ jsx(Label, {
						htmlFor: `label-${tag?.id ?? "new"}`,
						children: t("Label")
					}), /* @__PURE__ */ jsx(Input, {
						id: `label-${tag?.id ?? "new"}`,
						value: form.data.label,
						onChange: (e) => form.setData("label", e.target.value),
						maxLength: 60,
						placeholder: t("Billing"),
						required: true
					})]
				}),
				/* @__PURE__ */ jsxs("div", {
					className: "grid gap-1.5",
					children: [
						/* @__PURE__ */ jsx(Label, { children: t("Color") }),
						/* @__PURE__ */ jsx("div", {
							className: "flex flex-wrap gap-1.5",
							children: PALETTE.map((c) => /* @__PURE__ */ jsx("button", {
								type: "button",
								onClick: () => form.setData("color", c),
								className: `size-7 rounded-full transition ${form.data.color === c ? "ring-2 ring-foreground ring-offset-2" : "hover:scale-110"}`,
								style: { background: c }
							}, c))
						}),
						/* @__PURE__ */ jsx(Input, {
							type: "text",
							value: form.data.color,
							onChange: (e) => form.setData("color", e.target.value),
							placeholder: "#64748b",
							maxLength: 7,
							className: "mt-1 w-32 font-mono text-xs"
						})
					]
				}),
				/* @__PURE__ */ jsxs("div", {
					className: "flex justify-end gap-2",
					children: [/* @__PURE__ */ jsx(Button, {
						type: "button",
						variant: "outline",
						onClick: onDone,
						children: t("Cancel")
					}), /* @__PURE__ */ jsx(Button, {
						type: "submit",
						disabled: form.processing,
						children: t("Save")
					})]
				})
			]
		})
	});
}
//#endregion
//#region resources/js/pages/app/system-health/index.tsx
var system_health_exports = /* @__PURE__ */ __exportAll({ default: () => SystemHealthPage });
function StatusIcon({ status }) {
	if (status === "ok") return /* @__PURE__ */ jsx(CheckCircle2, { className: "size-4 text-emerald-600" });
	if (status === "warn") return /* @__PURE__ */ jsx(AlertTriangle, { className: "size-4 text-amber-600" });
	return /* @__PURE__ */ jsx(XCircle, { className: "size-4 text-red-600" });
}
function CheckCard({ icon, title, status, detail, hint }) {
	return /* @__PURE__ */ jsxs(Card, {
		className: "flex flex-col gap-2 p-4",
		children: [
			/* @__PURE__ */ jsxs("div", {
				className: "flex items-center gap-2",
				children: [
					/* @__PURE__ */ jsx("span", {
						className: "flex size-7 shrink-0 items-center justify-center rounded-md border bg-background text-muted-foreground",
						children: icon
					}),
					/* @__PURE__ */ jsx("h3", {
						className: "flex-1 text-sm font-medium text-foreground",
						children: title
					}),
					/* @__PURE__ */ jsx(StatusIcon, { status })
				]
			}),
			/* @__PURE__ */ jsx("p", {
				className: "text-xs text-muted-foreground",
				children: detail
			}),
			hint && /* @__PURE__ */ jsx("p", {
				className: "rounded-md border-l-2 border-amber-300 bg-amber-50 px-2 py-1.5 text-[11px] leading-5 text-amber-900 dark:border-amber-700 dark:bg-amber-900/20 dark:text-amber-200",
				children: hint
			})
		]
	});
}
function LlmProbe() {
	const { t } = useT();
	const [busy, setBusy] = useState(false);
	const [result, setResult] = useState(null);
	const run = async () => {
		setBusy(true);
		setResult(null);
		const csrf = document.querySelector("meta[name=\"csrf-token\"]")?.getAttribute("content") ?? "";
		try {
			setResult(await (await fetch("/app/system-health/probe-llm", {
				method: "POST",
				headers: {
					"X-CSRF-TOKEN": csrf,
					Accept: "application/json"
				}
			})).json());
		} catch (e) {
			setResult({
				ok: false,
				provider: "?",
				model: "?",
				exception: "NetworkError",
				message: e instanceof Error ? e.message : "probe failed",
				elapsed_ms: 0
			});
		} finally {
			setBusy(false);
		}
	};
	return /* @__PURE__ */ jsxs(Card, {
		className: "p-4",
		children: [/* @__PURE__ */ jsxs("div", {
			className: "flex items-center justify-between gap-2",
			children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("h3", {
				className: "text-sm font-medium",
				children: t("Probe LLM model")
			}), /* @__PURE__ */ jsx("p", {
				className: "text-xs text-muted-foreground",
				children: t("Send a 1-token request to the bound provider + model and show the verbatim response (or error) so you can pin down which model name is failing.")
			})] }), /* @__PURE__ */ jsx(Button, {
				type: "button",
				variant: "outline",
				size: "sm",
				onClick: run,
				disabled: busy,
				children: busy ? t("Probing…") : t("Run probe")
			})]
		}), result && /* @__PURE__ */ jsxs("div", {
			className: "mt-3 rounded-md border p-2 text-xs " + (result.ok ? "border-emerald-300 bg-emerald-50 text-emerald-900 dark:border-emerald-700 dark:bg-emerald-900/20 dark:text-emerald-200" : "border-red-300 bg-red-50 text-red-900 dark:border-red-700 dark:bg-red-900/20 dark:text-red-200"),
			children: [/* @__PURE__ */ jsxs("p", { children: [
				/* @__PURE__ */ jsx("strong", { children: result.ok ? t("OK") : t("Failed") }),
				" ·",
				" ",
				result.provider,
				" · ",
				/* @__PURE__ */ jsx("code", { children: result.model }),
				" ·",
				" ",
				result.elapsed_ms,
				"ms"
			] }), result.ok ? /* @__PURE__ */ jsx("pre", {
				className: "mt-1 overflow-x-auto font-mono text-[11px] whitespace-pre-wrap",
				children: result.content
			}) : /* @__PURE__ */ jsxs("pre", {
				className: "mt-1 overflow-x-auto font-mono text-[11px] whitespace-pre-wrap",
				children: [
					"[",
					result.exception,
					"] ",
					result.message
				]
			})]
		})]
	});
}
function SystemHealthPage({ llm, embedding_fallback, cloudflare, queue, sources, env }) {
	const { t } = useT();
	const breadcrumbs = [{
		title: t("System health"),
		href: "/app/system-health"
	}];
	const llmStatus = llm.ok ? "ok" : "fail";
	const embeddingStatus = embedding_fallback.configured ? "ok" : "warn";
	const cloudflareStatus = cloudflare.configured ? "ok" : "warn";
	const queueStatus = (() => {
		if (queue.liveness === "dead") return "fail";
		if (queue.liveness === "stale" || queue.liveness === "unknown") return "warn";
		if (queue.failed > 0) return "warn";
		if (queue.driver === "sync") return "warn";
		return "ok";
	})();
	return /* @__PURE__ */ jsxs(AppLayout, {
		breadcrumbs,
		children: [/* @__PURE__ */ jsx(Head, { title: t("System health") }), /* @__PURE__ */ jsxs("div", {
			className: "flex flex-1 flex-col gap-4 p-4",
			children: [
				/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("h1", {
					className: "text-2xl font-semibold tracking-tight",
					children: t("System health")
				}), /* @__PURE__ */ jsx("p", {
					className: "mt-1 text-sm text-muted-foreground",
					children: t("Read-only check of provider creds, queue worker, and recent crawl failures. Surfaces gaps that block indexing or replies before you have to open the failed-jobs table.")
				})] }),
				/* @__PURE__ */ jsxs("div", {
					className: "grid gap-3 lg:grid-cols-2",
					children: [
						/* @__PURE__ */ jsxs("div", {
							className: "grid gap-2",
							children: [/* @__PURE__ */ jsx(CheckCard, {
								icon: /* @__PURE__ */ jsx(Cog, { className: "size-3.5" }),
								title: t("LLM provider"),
								status: llmStatus,
								detail: t("Resolved: :provider", { provider: llm.provider }),
								hint: llm.hint
							}), /* @__PURE__ */ jsx(LlmProbe, {})]
						}),
						/* @__PURE__ */ jsx(CheckCard, {
							icon: /* @__PURE__ */ jsx(Cloud, { className: "size-3.5" }),
							title: t("Cloudflare creds"),
							status: cloudflareStatus,
							detail: cloudflare.configured ? t("Account + token present") : t("Missing creds"),
							hint: cloudflare.hint
						}),
						/* @__PURE__ */ jsx(CheckCard, {
							icon: /* @__PURE__ */ jsx(Workflow, { className: "size-3.5" }),
							title: t("Embedding fallback"),
							status: embeddingStatus,
							detail: embedding_fallback.configured ? t("OpenAI key configured") : t("No fallback set"),
							hint: embedding_fallback.hint
						}),
						/* @__PURE__ */ jsx(CheckCard, {
							icon: /* @__PURE__ */ jsx(Database, { className: "size-3.5" }),
							title: t("Queue worker"),
							status: queueStatus,
							detail: [t("Driver: :driver · pending :pending · failed :failed", {
								driver: queue.driver,
								pending: queue.pending,
								failed: queue.failed
							}), queue.liveness === "inline" ? t("Liveness: inline (sync driver)") : queue.seconds_since_tick === null ? t("Liveness: :state · no ticks recorded", { state: queue.liveness }) : t("Liveness: :state · last tick :seconds s ago", {
								state: queue.liveness,
								seconds: queue.seconds_since_tick
							})].join(" · "),
							hint: queue.hint
						})
					]
				}),
				/* @__PURE__ */ jsxs(Card, {
					className: "p-4",
					children: [
						/* @__PURE__ */ jsx("h2", {
							className: "text-sm font-medium",
							children: t("Recent source problems")
						}),
						/* @__PURE__ */ jsx("p", {
							className: "mt-1 text-xs text-muted-foreground",
							children: t("Sources stuck in \"crawling\" or marked \"failed\" in this workspace. Most often: rate-limited embedding provider, unreachable URL, or queue worker offline.")
						}),
						sources.length === 0 ? /* @__PURE__ */ jsx("p", {
							className: "mt-3 text-xs text-muted-foreground",
							children: t("No problematic sources. Indexing pipeline looks healthy.")
						}) : /* @__PURE__ */ jsx("ul", {
							className: "mt-3 grid gap-2 text-xs",
							children: sources.map((s) => /* @__PURE__ */ jsxs("li", {
								className: "grid gap-1 rounded-md border bg-muted/20 p-2",
								children: [/* @__PURE__ */ jsxs("div", {
									className: "flex items-center gap-2",
									children: [/* @__PURE__ */ jsx("span", {
										className: s.status === "failed" ? "rounded bg-red-100 px-1.5 py-0.5 text-[10px] font-semibold text-red-800" : "rounded bg-amber-100 px-1.5 py-0.5 text-[10px] font-semibold text-amber-800",
										children: s.status
									}), /* @__PURE__ */ jsxs(Link, {
										href: `/app/agents/${s.agent_id}/sources`,
										className: "font-mono text-[11px] underline-offset-2 hover:underline",
										children: [
											s.type ?? "source",
											" · ",
											s.id
										]
									})]
								}), s.error && /* @__PURE__ */ jsx("pre", {
									className: "overflow-x-auto rounded bg-background p-2 font-mono text-[10px] text-muted-foreground",
									children: s.error
								})]
							}, s.id))
						})
					]
				}),
				/* @__PURE__ */ jsxs(Card, {
					className: "grid gap-2 p-4 text-xs",
					children: [/* @__PURE__ */ jsx("h2", {
						className: "text-sm font-medium",
						children: t("Environment")
					}), /* @__PURE__ */ jsxs("dl", {
						className: "grid gap-1.5",
						children: [
							/* @__PURE__ */ jsxs("div", {
								className: "flex justify-between gap-3",
								children: [/* @__PURE__ */ jsx("dt", {
									className: "text-muted-foreground",
									children: "APP_ENV"
								}), /* @__PURE__ */ jsx("dd", {
									className: "font-mono",
									children: env.app_env
								})]
							}),
							/* @__PURE__ */ jsxs("div", {
								className: "flex justify-between gap-3",
								children: [/* @__PURE__ */ jsx("dt", {
									className: "text-muted-foreground",
									children: "APP_URL"
								}), /* @__PURE__ */ jsx("dd", {
									className: "truncate font-mono",
									children: env.app_url
								})]
							}),
							/* @__PURE__ */ jsxs("div", {
								className: "flex justify-between gap-3",
								children: [/* @__PURE__ */ jsx("dt", {
									className: "text-muted-foreground",
									children: "APP_DEBUG"
								}), /* @__PURE__ */ jsx("dd", {
									className: "font-mono",
									children: env.app_debug ? "true" : "false"
								})]
							}),
							/* @__PURE__ */ jsxs("div", {
								className: "flex justify-between gap-3",
								children: [/* @__PURE__ */ jsx("dt", {
									className: "text-muted-foreground",
									children: "VERSION"
								}), /* @__PURE__ */ jsx("dd", {
									className: "font-mono",
									children: env.version
								})]
							})
						]
					})]
				}),
				/* @__PURE__ */ jsxs("p", {
					className: "text-xs text-muted-foreground",
					children: [/* @__PURE__ */ jsx(HelpCircle, { className: "me-1 inline size-3" }), t("This page is read-only. To fix anything flagged here, update the env / settings and re-run the related task.")]
				})
			]
		})]
	});
}
//#endregion
//#region resources/js/pages/app/tickets/index.tsx
var tickets_exports = /* @__PURE__ */ __exportAll({ default: () => TicketsIndex });
var STATUS_FILTERS = [
	{
		key: "open",
		label: "Open"
	},
	{
		key: "pending",
		label: "Pending"
	},
	{
		key: "resolved",
		label: "Resolved"
	},
	{
		key: "closed",
		label: "Closed"
	},
	{
		key: "all",
		label: "All"
	}
];
var PRIORITY_BADGE = {
	urgent: "bg-rose-100 text-rose-800 border-rose-200",
	high: "bg-amber-100 text-amber-800 border-amber-200",
	normal: "bg-slate-100 text-slate-700 border-slate-200",
	low: "bg-emerald-100 text-emerald-800 border-emerald-200"
};
function TicketsIndex({ tickets, filter, counts }) {
	const { t } = useT();
	const setStatus = (status) => {
		router.get("/app/tickets", { status }, { preserveScroll: true });
	};
	return /* @__PURE__ */ jsxs(AppLayout, { children: [/* @__PURE__ */ jsx(Head, { title: t("Tickets") }), /* @__PURE__ */ jsxs("div", {
		className: "space-y-6 p-4",
		children: [
			/* @__PURE__ */ jsxs("div", {
				className: "flex items-center justify-between gap-3",
				children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsxs("h1", {
					className: "flex items-center gap-2 text-2xl font-semibold",
					children: [/* @__PURE__ */ jsx(Ticket, { className: "size-5" }), t("Tickets")]
				}), /* @__PURE__ */ jsx("p", {
					className: "text-sm text-muted-foreground",
					children: t("Durable support items. Created by the AI when a visitor needs human follow-up, or by your team directly.")
				})] }), /* @__PURE__ */ jsxs("div", {
					className: "flex items-center gap-3 text-xs text-muted-foreground",
					children: [
						/* @__PURE__ */ jsx("span", { children: t(":n open", { n: counts.open.toLocaleString() }) }),
						/* @__PURE__ */ jsx("span", { children: t(":n pending", { n: counts.pending.toLocaleString() }) }),
						/* @__PURE__ */ jsx("span", { children: t(":n resolved", { n: counts.resolved.toLocaleString() }) })
					]
				})]
			}),
			/* @__PURE__ */ jsx("div", {
				className: "flex flex-wrap gap-2",
				children: STATUS_FILTERS.map((s) => /* @__PURE__ */ jsx("button", {
					onClick: () => setStatus(s.key),
					className: `rounded-full border px-3 py-1 text-xs font-medium transition-colors ${filter.status === s.key ? "border-foreground bg-foreground text-background" : "border-border hover:bg-muted"}`,
					children: t(s.label)
				}, s.key))
			}),
			/* @__PURE__ */ jsx("div", {
				className: "overflow-hidden rounded-md border",
				children: /* @__PURE__ */ jsxs("table", {
					className: "w-full min-w-[720px] text-sm",
					children: [/* @__PURE__ */ jsx("thead", {
						className: "bg-muted/50 text-xs font-medium text-muted-foreground",
						children: /* @__PURE__ */ jsxs("tr", { children: [
							/* @__PURE__ */ jsx("th", {
								className: "px-3 py-2 text-start",
								children: t("Subject")
							}),
							/* @__PURE__ */ jsx("th", {
								className: "px-3 py-2 text-start",
								children: t("Priority")
							}),
							/* @__PURE__ */ jsx("th", {
								className: "px-3 py-2 text-start",
								children: t("Status")
							}),
							/* @__PURE__ */ jsx("th", {
								className: "px-3 py-2 text-start",
								children: t("Assignee")
							}),
							/* @__PURE__ */ jsx("th", {
								className: "px-3 py-2 text-start",
								children: t("Created")
							})
						] })
					}), /* @__PURE__ */ jsx("tbody", { children: tickets.length === 0 ? /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx("td", {
						colSpan: 5,
						className: "p-10 text-center text-sm text-muted-foreground",
						children: t("No tickets match this filter yet.")
					}) }) : tickets.map((tk) => /* @__PURE__ */ jsxs("tr", {
						className: "border-t hover:bg-muted/30",
						children: [
							/* @__PURE__ */ jsx("td", {
								className: "px-3 py-2",
								children: /* @__PURE__ */ jsx(Link, {
									href: `/app/tickets/${tk.id}`,
									className: "font-medium text-foreground hover:text-primary",
									children: tk.subject
								})
							}),
							/* @__PURE__ */ jsx("td", {
								className: "px-3 py-2",
								children: /* @__PURE__ */ jsx("span", {
									className: `inline-flex items-center rounded-full border px-2 py-0.5 text-[10px] font-medium uppercase ${PRIORITY_BADGE[tk.priority]}`,
									children: tk.priority
								})
							}),
							/* @__PURE__ */ jsx("td", {
								className: "px-3 py-2 text-xs text-muted-foreground capitalize",
								children: tk.status
							}),
							/* @__PURE__ */ jsx("td", {
								className: "px-3 py-2 text-xs",
								children: tk.assignee ?? "—"
							}),
							/* @__PURE__ */ jsx("td", {
								className: "px-3 py-2 text-xs text-muted-foreground",
								children: tk.created_at ? new Date(tk.created_at).toLocaleString() : "—"
							})
						]
					}, tk.id)) })]
				})
			})
		]
	})] });
}
//#endregion
//#region resources/js/pages/app/tickets/show.tsx
var show_exports = /* @__PURE__ */ __exportAll({ default: () => TicketShow });
function TicketShow({ ticket }) {
	const { t } = useT();
	const form = useForm({
		status: ticket.status,
		priority: ticket.priority
	});
	const save = (e) => {
		e.preventDefault();
		form.patch(`/app/tickets/${ticket.id}`, { preserveScroll: true });
	};
	return /* @__PURE__ */ jsxs(AppLayout, { children: [/* @__PURE__ */ jsx(Head, { title: ticket.subject }), /* @__PURE__ */ jsxs("div", {
		className: "space-y-6 p-4",
		children: [
			/* @__PURE__ */ jsx("div", {
				className: "flex items-center justify-between",
				children: /* @__PURE__ */ jsxs(Link, {
					href: "/app/tickets",
					className: "inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground",
					children: [/* @__PURE__ */ jsx(ArrowLeft, { className: "size-4" }), t("Back to tickets")]
				})
			}),
			/* @__PURE__ */ jsxs(Card, {
				className: "p-6",
				children: [
					/* @__PURE__ */ jsx("h1", {
						className: "text-xl font-semibold",
						children: ticket.subject
					}),
					/* @__PURE__ */ jsxs("p", {
						className: "mt-1 text-xs text-muted-foreground",
						children: [
							t("Created"),
							" ",
							ticket.created_at ? new Date(ticket.created_at).toLocaleString() : "—",
							ticket.conversation_id && /* @__PURE__ */ jsxs(Fragment$1, { children: [" · ", /* @__PURE__ */ jsx(Link, {
								href: `/app/conversations/${ticket.conversation_id}`,
								className: "text-primary hover:underline",
								children: t("Source conversation")
							})] })
						]
					}),
					/* @__PURE__ */ jsx("pre", {
						className: "mt-4 rounded-md border bg-muted/30 p-4 text-sm leading-6 whitespace-pre-wrap",
						children: ticket.body
					})
				]
			}),
			/* @__PURE__ */ jsx(Card, {
				className: "p-6",
				children: /* @__PURE__ */ jsxs("form", {
					onSubmit: save,
					className: "grid gap-4 sm:grid-cols-2",
					children: [
						/* @__PURE__ */ jsxs("div", {
							className: "grid gap-1.5",
							children: [/* @__PURE__ */ jsx("label", {
								className: "text-xs font-medium",
								children: t("Status")
							}), /* @__PURE__ */ jsxs("select", {
								value: form.data.status,
								onChange: (e) => form.setData("status", e.target.value),
								className: "rounded-md border bg-background px-3 py-2 text-sm",
								children: [
									/* @__PURE__ */ jsx("option", {
										value: "open",
										children: t("Open")
									}),
									/* @__PURE__ */ jsx("option", {
										value: "pending",
										children: t("Pending")
									}),
									/* @__PURE__ */ jsx("option", {
										value: "resolved",
										children: t("Resolved")
									}),
									/* @__PURE__ */ jsx("option", {
										value: "closed",
										children: t("Closed")
									})
								]
							})]
						}),
						/* @__PURE__ */ jsxs("div", {
							className: "grid gap-1.5",
							children: [/* @__PURE__ */ jsx("label", {
								className: "text-xs font-medium",
								children: t("Priority")
							}), /* @__PURE__ */ jsxs("select", {
								value: form.data.priority,
								onChange: (e) => form.setData("priority", e.target.value),
								className: "rounded-md border bg-background px-3 py-2 text-sm",
								children: [
									/* @__PURE__ */ jsx("option", {
										value: "low",
										children: t("Low")
									}),
									/* @__PURE__ */ jsx("option", {
										value: "normal",
										children: t("Normal")
									}),
									/* @__PURE__ */ jsx("option", {
										value: "high",
										children: t("High")
									}),
									/* @__PURE__ */ jsx("option", {
										value: "urgent",
										children: t("Urgent")
									})
								]
							})]
						}),
						/* @__PURE__ */ jsx("div", {
							className: "sm:col-span-2",
							children: /* @__PURE__ */ jsx(Button, {
								type: "submit",
								disabled: form.processing,
								children: form.processing ? t("Saving…") : t("Save changes")
							})
						})
					]
				})
			})
		]
	})] });
}
//#endregion
//#region resources/js/pages/app/workflows/canvas-internals/inspector.tsx
var inspector_exports = /* @__PURE__ */ __exportAll({ NodeInspector: () => NodeInspector });
var matchOptions = [
	"equals",
	"contains",
	"starts_with",
	"is_empty",
	"not_empty",
	"default"
];
function NodeInspector({ node, onChange, onDelete, triggerExtras }) {
	const { t } = useT();
	if (node.id === "trigger" && triggerExtras) return /* @__PURE__ */ jsx(TriggerInspector, { extras: triggerExtras });
	const data = node.data ?? {};
	return /* @__PURE__ */ jsxs("div", {
		className: "flex flex-col gap-3",
		children: [
			/* @__PURE__ */ jsxs("div", {
				className: "flex items-center justify-between",
				children: [/* @__PURE__ */ jsx("h3", {
					className: "text-sm font-semibold capitalize",
					children: node.type.replace("_", " ")
				}), /* @__PURE__ */ jsx(Button, {
					type: "button",
					variant: "ghost",
					size: "sm",
					onClick: onDelete,
					children: /* @__PURE__ */ jsx(Trash2, { className: "size-4 text-destructive" })
				})]
			}),
			node.type === "message" && /* @__PURE__ */ jsx(Field, {
				label: t("Message text"),
				htmlFor: "ins-text",
				children: /* @__PURE__ */ jsx("textarea", {
					id: "ins-text",
					rows: 4,
					className: "rounded-md border bg-background p-2 text-sm",
					value: data.text ?? "",
					onChange: (e) => onChange({
						...data,
						text: e.target.value
					})
				})
			}),
			node.type === "question" && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Field, {
				label: t("Question text"),
				htmlFor: "ins-text",
				children: /* @__PURE__ */ jsx("textarea", {
					id: "ins-text",
					rows: 3,
					className: "rounded-md border bg-background p-2 text-sm",
					value: data.text ?? "",
					onChange: (e) => onChange({
						...data,
						text: e.target.value
					})
				})
			}), /* @__PURE__ */ jsx(Field, {
				label: t("Save answer to var_name"),
				htmlFor: "ins-var",
				children: /* @__PURE__ */ jsx(Input, {
					id: "ins-var",
					value: data.var_name ?? "",
					onChange: (e) => onChange({
						...data,
						var_name: e.target.value
					}),
					placeholder: "visitor_answer"
				})
			})] }),
			node.type === "branch" && /* @__PURE__ */ jsxs(Fragment$1, { children: [
				/* @__PURE__ */ jsx(Field, {
					label: t("Branch on var"),
					htmlFor: "ins-var",
					children: /* @__PURE__ */ jsx(Input, {
						id: "ins-var",
						value: data.var ?? "",
						onChange: (e) => onChange({
							...data,
							var: e.target.value
						}),
						placeholder: "plan_interest"
					})
				}),
				/* @__PURE__ */ jsx(Field, {
					label: t("Cases (top to bottom)"),
					htmlFor: "",
					children: /* @__PURE__ */ jsx(BranchCasesEditor, {
						cases: data.cases ?? [],
						onChange: (cases) => onChange({
							...data,
							cases
						})
					})
				}),
				/* @__PURE__ */ jsx("p", {
					className: "text-[11px] text-muted-foreground",
					children: t("Wire each case's end-side handle on the canvas to the next step. The default handle catches anything no other case matched.")
				})
			] }),
			node.type === "tag_lead" && /* @__PURE__ */ jsx(Field, {
				label: t("Tags (comma-separated)"),
				htmlFor: "ins-tags",
				children: /* @__PURE__ */ jsx(Input, {
					id: "ins-tags",
					value: (data.tags ?? []).join(", ") ?? "",
					onChange: (e) => onChange({
						...data,
						tags: e.target.value.split(",").map((t) => t.trim()).filter(Boolean)
					}),
					placeholder: "pro_intent, qualified"
				})
			}),
			node.type === "webhook" && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Field, {
				label: t("URL"),
				htmlFor: "ins-url",
				children: /* @__PURE__ */ jsx(Input, {
					id: "ins-url",
					value: data.url ?? "",
					onChange: (e) => onChange({
						...data,
						url: e.target.value
					}),
					placeholder: "https://hooks.example.com/in"
				})
			}), /* @__PURE__ */ jsx(Field, {
				label: t("Method"),
				htmlFor: "ins-method",
				children: /* @__PURE__ */ jsxs("select", {
					id: "ins-method",
					className: "h-9 rounded-md border bg-background px-3 text-sm",
					value: (data.method ?? "POST").toString(),
					onChange: (e) => onChange({
						...data,
						method: e.target.value
					}),
					children: [/* @__PURE__ */ jsx("option", {
						value: "POST",
						children: "POST"
					}), /* @__PURE__ */ jsx("option", {
						value: "GET",
						children: "GET"
					})]
				})
			})] }),
			node.type === "escalate" && /* @__PURE__ */ jsx(Field, {
				label: t("Goodbye message"),
				htmlFor: "ins-text",
				children: /* @__PURE__ */ jsx("textarea", {
					id: "ins-text",
					rows: 3,
					className: "rounded-md border bg-background p-2 text-sm",
					value: data.text ?? "",
					onChange: (e) => onChange({
						...data,
						text: e.target.value
					})
				})
			})
		]
	});
}
function TriggerInspector({ extras }) {
	const { t } = useT();
	return /* @__PURE__ */ jsxs("div", {
		className: "flex flex-col gap-3",
		children: [
			/* @__PURE__ */ jsx("h3", {
				className: "text-sm font-semibold",
				children: t("Trigger")
			}),
			/* @__PURE__ */ jsx(Field, {
				label: t("Keywords (comma-separated)"),
				htmlFor: "trg-kw",
				children: /* @__PURE__ */ jsx(Input, {
					id: "trg-kw",
					value: extras.keywords.join(", "),
					onChange: (e) => extras.onTriggerChange({ keywords: e.target.value.split(",").map((k) => k.trim()).filter(Boolean) }),
					placeholder: t("pricing, plan, cost")
				})
			}),
			/* @__PURE__ */ jsx(Field, {
				label: t("Match mode"),
				htmlFor: "trg-mode",
				children: /* @__PURE__ */ jsxs("select", {
					id: "trg-mode",
					className: "h-9 rounded-md border bg-background px-3 text-sm",
					value: extras.match_mode,
					onChange: (e) => extras.onTriggerChange({ match_mode: e.target.value }),
					children: [
						/* @__PURE__ */ jsx("option", {
							value: "any",
							children: t("any (substring)")
						}),
						/* @__PURE__ */ jsx("option", {
							value: "all",
							children: t("all (every keyword)")
						}),
						/* @__PURE__ */ jsx("option", {
							value: "exact",
							children: t("exact (verbatim)")
						})
					]
				})
			})
		]
	});
}
function Field({ label, htmlFor, children }) {
	return /* @__PURE__ */ jsxs("div", {
		className: "grid gap-1.5",
		children: [/* @__PURE__ */ jsx(Label, {
			htmlFor,
			className: "text-xs",
			children: label
		}), children]
	});
}
function BranchCasesEditor({ cases, onChange }) {
	const { t } = useT();
	const update = (i, patch) => {
		const next = [...cases];
		next[i] = {
			...next[i],
			...patch
		};
		onChange(next);
	};
	const remove = (i) => onChange(cases.filter((_, idx) => idx !== i));
	const add = () => onChange([...cases, {
		match: "equals",
		value: "",
		go_to: 0
	}]);
	return /* @__PURE__ */ jsxs("div", {
		className: "grid gap-2",
		children: [cases.map((c, i) => /* @__PURE__ */ jsxs("div", {
			className: "grid grid-cols-[1fr_2fr_auto] items-center gap-2 rounded-md border p-2",
			children: [
				/* @__PURE__ */ jsx("select", {
					className: "h-8 rounded-md border bg-background px-2 text-xs",
					value: c.match,
					onChange: (e) => update(i, { match: e.target.value }),
					children: matchOptions.map((m) => /* @__PURE__ */ jsx("option", {
						value: m,
						children: m
					}, m))
				}),
				/* @__PURE__ */ jsx(Input, {
					value: c.value ?? "",
					disabled: c.match === "is_empty" || c.match === "not_empty" || c.match === "default",
					onChange: (e) => update(i, { value: e.target.value }),
					placeholder: t("value"),
					className: "h-8 text-xs"
				}),
				/* @__PURE__ */ jsx(Button, {
					type: "button",
					variant: "ghost",
					size: "sm",
					onClick: () => remove(i),
					children: /* @__PURE__ */ jsx(Trash2, { className: "size-3.5 text-destructive" })
				})
			]
		}, i)), /* @__PURE__ */ jsx(Button, {
			type: "button",
			variant: "outline",
			size: "sm",
			onClick: add,
			children: t("+ Case")
		})]
	});
}
//#endregion
//#region resources/js/pages/app/workflows/canvas-internals/nodes.tsx
var nodes_exports = /* @__PURE__ */ __exportAll({
	BranchNode: () => BranchNode,
	EscalateNode: () => EscalateNode,
	MessageNode: () => MessageNode,
	NODE_TYPES: () => NODE_TYPES,
	NODE_TYPE_ICONS: () => NODE_TYPE_ICONS,
	QuestionNode: () => QuestionNode,
	TagLeadNode: () => TagLeadNode,
	TriggerNode: () => TriggerNode,
	WebhookNode: () => WebhookNode
});
var cardBase = "rounded-lg border bg-card shadow-sm overflow-hidden text-card-foreground min-w-[200px] max-w-[260px]";
var headerBase = "flex items-center gap-2 px-3 py-1.5 border-b text-[11px] font-semibold uppercase tracking-wide";
function NodeShell({ icon, label, headerClass, children, showInputHandle = true, showOutputHandle = true }) {
	return /* @__PURE__ */ jsxs("div", {
		className: cardBase,
		children: [
			showInputHandle && /* @__PURE__ */ jsx(Handle, {
				type: "target",
				position: Position.Top,
				className: "!size-2 !bg-foreground/40"
			}),
			/* @__PURE__ */ jsxs("div", {
				className: headerBase + " " + headerClass,
				children: [icon, /* @__PURE__ */ jsx("span", { children: label })]
			}),
			/* @__PURE__ */ jsx("div", {
				className: "px-3 py-2 text-xs leading-snug text-foreground/80",
				children
			}),
			showOutputHandle && /* @__PURE__ */ jsx(Handle, {
				id: "out",
				type: "source",
				position: Position.Bottom,
				className: "!size-2 !bg-foreground/40"
			})
		]
	});
}
function TriggerNode({ data }) {
	const { t } = useT();
	const keywords = data?.keywords ?? [];
	const matchMode = data?.match_mode ?? "any";
	return /* @__PURE__ */ jsxs(NodeShell, {
		icon: /* @__PURE__ */ jsx(Zap, { className: "size-3" }),
		label: t("Trigger · keyword"),
		headerClass: "bg-violet-100 text-violet-900 border-violet-300 dark:bg-violet-900/40 dark:text-violet-200 dark:border-violet-700",
		showInputHandle: false,
		children: [/* @__PURE__ */ jsx("p", {
			className: "font-mono text-[10px]",
			children: keywords.length === 0 ? t("No keywords yet") : keywords.join(", ")
		}), /* @__PURE__ */ jsx("span", {
			className: "mt-1 inline-block rounded bg-muted px-1.5 py-0.5 font-mono text-[9px] uppercase",
			children: t("match: :mode", { mode: matchMode })
		})]
	});
}
function MessageNode({ data }) {
	const { t } = useT();
	return /* @__PURE__ */ jsx(NodeShell, {
		icon: /* @__PURE__ */ jsx(MessageSquare, { className: "size-3" }),
		label: t("Message"),
		headerClass: "bg-slate-100 text-slate-900 border-slate-300 dark:bg-slate-900/60 dark:text-slate-100 dark:border-slate-700",
		children: /* @__PURE__ */ jsx("p", {
			className: "line-clamp-3 whitespace-pre-wrap",
			children: data?.text || /* @__PURE__ */ jsx("span", {
				className: "text-muted-foreground italic",
				children: t("empty")
			})
		})
	});
}
function QuestionNode({ data }) {
	const { t } = useT();
	return /* @__PURE__ */ jsxs(NodeShell, {
		icon: /* @__PURE__ */ jsx(MessageSquare, { className: "size-3" }),
		label: t("Question"),
		headerClass: "bg-sky-100 text-sky-900 border-sky-300 dark:bg-sky-900/40 dark:text-sky-200 dark:border-sky-700",
		children: [/* @__PURE__ */ jsx("p", {
			className: "line-clamp-3 whitespace-pre-wrap",
			children: data?.text || /* @__PURE__ */ jsx("span", {
				className: "text-muted-foreground italic",
				children: t("empty")
			})
		}), /* @__PURE__ */ jsxs("p", {
			className: "mt-1 font-mono text-[10px] text-muted-foreground",
			children: ["→ @", `{{${data?.var_name ?? "visitor_answer"}}}`]
		})]
	});
}
function BranchNode({ data }) {
	const { t } = useT();
	const cases = data?.cases ?? [];
	return /* @__PURE__ */ jsxs("div", {
		className: cardBase,
		children: [
			/* @__PURE__ */ jsx(Handle, {
				type: "target",
				position: Position.Top,
				className: "!size-2 !bg-foreground/40"
			}),
			/* @__PURE__ */ jsxs("div", {
				className: headerBase + " border-amber-300 bg-amber-100 text-amber-900 dark:border-amber-700 dark:bg-amber-900/40 dark:text-amber-200",
				children: [/* @__PURE__ */ jsx(GitBranch, { className: "size-3" }), /* @__PURE__ */ jsxs("span", { children: [
					t("Branch on"),
					" @",
					`{{${data?.var ?? "var"}}}`
				] })]
			}),
			/* @__PURE__ */ jsxs("div", {
				className: "flex flex-col gap-1 px-3 py-2 text-xs leading-snug text-foreground/80",
				children: [cases.length === 0 && /* @__PURE__ */ jsx("span", {
					className: "text-muted-foreground italic",
					children: t("No cases yet")
				}), cases.map((c, i) => /* @__PURE__ */ jsxs("div", {
					className: "relative flex items-center justify-between gap-2 rounded bg-muted/60 px-2 py-1",
					children: [/* @__PURE__ */ jsx("span", {
						className: "font-mono text-[10px]",
						children: c.match === "default" ? "default" : c.value ? `${c.match} "${c.value}"` : c.match
					}), /* @__PURE__ */ jsx(Handle, {
						id: c.match === "default" ? "default" : `case-${i}`,
						type: "source",
						position: Position.Right,
						className: "!size-2 !bg-amber-500",
						style: {
							top: "50%",
							right: -4
						}
					})]
				}, i))]
			})
		]
	});
}
function TagLeadNode({ data }) {
	const { t } = useT();
	const tags = data?.tags ?? [];
	return /* @__PURE__ */ jsx(NodeShell, {
		icon: /* @__PURE__ */ jsx(Tag, { className: "size-3" }),
		label: t("Tag lead"),
		headerClass: "bg-emerald-100 text-emerald-900 border-emerald-300 dark:bg-emerald-900/40 dark:text-emerald-200 dark:border-emerald-700",
		children: tags.length === 0 ? /* @__PURE__ */ jsx("span", {
			className: "text-muted-foreground italic",
			children: t("No tags yet")
		}) : /* @__PURE__ */ jsx("div", {
			className: "flex flex-wrap gap-1",
			children: tags.map((tag) => /* @__PURE__ */ jsx("span", {
				className: "rounded bg-emerald-50 px-1.5 py-0.5 font-mono text-[10px] text-emerald-800 dark:bg-emerald-900/40 dark:text-emerald-200",
				children: tag
			}, tag))
		})
	});
}
function WebhookNode({ data }) {
	const { t } = useT();
	return /* @__PURE__ */ jsx(NodeShell, {
		icon: /* @__PURE__ */ jsx(Webhook, { className: "size-3" }),
		label: t("Webhook :method", { method: (data?.method ?? "POST").toUpperCase() }),
		headerClass: "bg-orange-100 text-orange-900 border-orange-300 dark:bg-orange-900/40 dark:text-orange-200 dark:border-orange-700",
		children: /* @__PURE__ */ jsx("p", {
			className: "truncate font-mono text-[10px]",
			children: data?.url || /* @__PURE__ */ jsx("span", {
				className: "text-muted-foreground italic",
				children: t("no url")
			})
		})
	});
}
function EscalateNode({ data }) {
	const { t } = useT();
	return /* @__PURE__ */ jsx(NodeShell, {
		icon: /* @__PURE__ */ jsx(UserCheck, { className: "size-3" }),
		label: t("Escalate to human"),
		headerClass: "bg-rose-100 text-rose-900 border-rose-300 dark:bg-rose-900/40 dark:text-rose-200 dark:border-rose-700",
		showOutputHandle: false,
		children: /* @__PURE__ */ jsx("p", {
			className: "line-clamp-2 whitespace-pre-wrap",
			children: data?.text || /* @__PURE__ */ jsx("span", {
				className: "text-muted-foreground italic",
				children: t("Connecting you to a human…")
			})
		})
	});
}
var NODE_TYPES = {
	trigger: TriggerNode,
	message: MessageNode,
	question: QuestionNode,
	branch: BranchNode,
	tag_lead: TagLeadNode,
	webhook: WebhookNode,
	escalate: EscalateNode
};
var NODE_TYPE_ICONS = {
	message: /* @__PURE__ */ jsx(MessageSquare, { className: "size-3.5" }),
	question: /* @__PURE__ */ jsx(MessageSquare, { className: "size-3.5" }),
	branch: /* @__PURE__ */ jsx(GitBranch, { className: "size-3.5" }),
	tag_lead: /* @__PURE__ */ jsx(Tag, { className: "size-3.5" }),
	webhook: /* @__PURE__ */ jsx(Webhook, { className: "size-3.5" }),
	escalate: /* @__PURE__ */ jsx(PhoneOutgoing, { className: "size-3.5" })
};
//#endregion
//#region resources/js/routes/workflows/index.ts
/**
* @see \App\Http\Controllers\Admin\WorkflowController::index
* @see app/Http/Controllers/Admin/WorkflowController.php:43
* @route '/app/workflows'
*/
var index$5 = (options) => ({
	url: index$5.url(options),
	method: "get"
});
index$5.definition = {
	methods: ["get", "head"],
	url: "/app/workflows"
};
/**
* @see \App\Http\Controllers\Admin\WorkflowController::index
* @see app/Http/Controllers/Admin/WorkflowController.php:43
* @route '/app/workflows'
*/
index$5.url = (options) => {
	return index$5.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\WorkflowController::index
* @see app/Http/Controllers/Admin/WorkflowController.php:43
* @route '/app/workflows'
*/
index$5.get = (options) => ({
	url: index$5.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\WorkflowController::index
* @see app/Http/Controllers/Admin/WorkflowController.php:43
* @route '/app/workflows'
*/
index$5.head = (options) => ({
	url: index$5.url(options),
	method: "head"
});
/**
* @see \App\Http\Controllers\Admin\WorkflowController::index
* @see app/Http/Controllers/Admin/WorkflowController.php:43
* @route '/app/workflows'
*/
var indexForm$5 = (options) => ({
	action: index$5.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\WorkflowController::index
* @see app/Http/Controllers/Admin/WorkflowController.php:43
* @route '/app/workflows'
*/
indexForm$5.get = (options) => ({
	action: index$5.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\WorkflowController::index
* @see app/Http/Controllers/Admin/WorkflowController.php:43
* @route '/app/workflows'
*/
indexForm$5.head = (options) => ({
	action: index$5.url({ [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
index$5.form = indexForm$5;
/**
* @see \App\Http\Controllers\Admin\WorkflowController::create
* @see app/Http/Controllers/Admin/WorkflowController.php:101
* @route '/app/workflows/create'
*/
var create = (options) => ({
	url: create.url(options),
	method: "get"
});
create.definition = {
	methods: ["get", "head"],
	url: "/app/workflows/create"
};
/**
* @see \App\Http\Controllers\Admin\WorkflowController::create
* @see app/Http/Controllers/Admin/WorkflowController.php:101
* @route '/app/workflows/create'
*/
create.url = (options) => {
	return create.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\WorkflowController::create
* @see app/Http/Controllers/Admin/WorkflowController.php:101
* @route '/app/workflows/create'
*/
create.get = (options) => ({
	url: create.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\WorkflowController::create
* @see app/Http/Controllers/Admin/WorkflowController.php:101
* @route '/app/workflows/create'
*/
create.head = (options) => ({
	url: create.url(options),
	method: "head"
});
/**
* @see \App\Http\Controllers\Admin\WorkflowController::create
* @see app/Http/Controllers/Admin/WorkflowController.php:101
* @route '/app/workflows/create'
*/
var createForm = (options) => ({
	action: create.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\WorkflowController::create
* @see app/Http/Controllers/Admin/WorkflowController.php:101
* @route '/app/workflows/create'
*/
createForm.get = (options) => ({
	action: create.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\WorkflowController::create
* @see app/Http/Controllers/Admin/WorkflowController.php:101
* @route '/app/workflows/create'
*/
createForm.head = (options) => ({
	action: create.url({ [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
create.form = createForm;
/**
* @see \App\Http\Controllers\Admin\WorkflowController::store
* @see app/Http/Controllers/Admin/WorkflowController.php:156
* @route '/app/workflows'
*/
var store$6 = (options) => ({
	url: store$6.url(options),
	method: "post"
});
store$6.definition = {
	methods: ["post"],
	url: "/app/workflows"
};
/**
* @see \App\Http\Controllers\Admin\WorkflowController::store
* @see app/Http/Controllers/Admin/WorkflowController.php:156
* @route '/app/workflows'
*/
store$6.url = (options) => {
	return store$6.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\WorkflowController::store
* @see app/Http/Controllers/Admin/WorkflowController.php:156
* @route '/app/workflows'
*/
store$6.post = (options) => ({
	url: store$6.url(options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\WorkflowController::store
* @see app/Http/Controllers/Admin/WorkflowController.php:156
* @route '/app/workflows'
*/
var storeForm$6 = (options) => ({
	action: store$6.url(options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\WorkflowController::store
* @see app/Http/Controllers/Admin/WorkflowController.php:156
* @route '/app/workflows'
*/
storeForm$6.post = (options) => ({
	action: store$6.url(options),
	method: "post"
});
store$6.form = storeForm$6;
/**
* @see \App\Http\Controllers\Admin\WorkflowController::simulate
* @see app/Http/Controllers/Admin/WorkflowController.php:131
* @route '/app/workflows/simulate'
*/
var simulate = (options) => ({
	url: simulate.url(options),
	method: "post"
});
simulate.definition = {
	methods: ["post"],
	url: "/app/workflows/simulate"
};
/**
* @see \App\Http\Controllers\Admin\WorkflowController::simulate
* @see app/Http/Controllers/Admin/WorkflowController.php:131
* @route '/app/workflows/simulate'
*/
simulate.url = (options) => {
	return simulate.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\WorkflowController::simulate
* @see app/Http/Controllers/Admin/WorkflowController.php:131
* @route '/app/workflows/simulate'
*/
simulate.post = (options) => ({
	url: simulate.url(options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\WorkflowController::simulate
* @see app/Http/Controllers/Admin/WorkflowController.php:131
* @route '/app/workflows/simulate'
*/
var simulateForm = (options) => ({
	action: simulate.url(options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\WorkflowController::simulate
* @see app/Http/Controllers/Admin/WorkflowController.php:131
* @route '/app/workflows/simulate'
*/
simulateForm.post = (options) => ({
	action: simulate.url(options),
	method: "post"
});
simulate.form = simulateForm;
/**
* @see \App\Http\Controllers\Admin\WorkflowController::edit
* @see app/Http/Controllers/Admin/WorkflowController.php:203
* @route '/app/workflows/{workflow}/edit'
*/
var edit$6 = (args, options) => ({
	url: edit$6.url(args, options),
	method: "get"
});
edit$6.definition = {
	methods: ["get", "head"],
	url: "/app/workflows/{workflow}/edit"
};
/**
* @see \App\Http\Controllers\Admin\WorkflowController::edit
* @see app/Http/Controllers/Admin/WorkflowController.php:203
* @route '/app/workflows/{workflow}/edit'
*/
edit$6.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { workflow: args };
	if (typeof args === "object" && !Array.isArray(args) && "id" in args) args = { workflow: args.id };
	if (Array.isArray(args)) args = { workflow: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { workflow: typeof args.workflow === "object" ? args.workflow.id : args.workflow };
	return edit$6.definition.url.replace("{workflow}", parsedArgs.workflow.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\WorkflowController::edit
* @see app/Http/Controllers/Admin/WorkflowController.php:203
* @route '/app/workflows/{workflow}/edit'
*/
edit$6.get = (args, options) => ({
	url: edit$6.url(args, options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\WorkflowController::edit
* @see app/Http/Controllers/Admin/WorkflowController.php:203
* @route '/app/workflows/{workflow}/edit'
*/
edit$6.head = (args, options) => ({
	url: edit$6.url(args, options),
	method: "head"
});
/**
* @see \App\Http\Controllers\Admin\WorkflowController::edit
* @see app/Http/Controllers/Admin/WorkflowController.php:203
* @route '/app/workflows/{workflow}/edit'
*/
var editForm$6 = (args, options) => ({
	action: edit$6.url(args, options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\WorkflowController::edit
* @see app/Http/Controllers/Admin/WorkflowController.php:203
* @route '/app/workflows/{workflow}/edit'
*/
editForm$6.get = (args, options) => ({
	action: edit$6.url(args, options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\WorkflowController::edit
* @see app/Http/Controllers/Admin/WorkflowController.php:203
* @route '/app/workflows/{workflow}/edit'
*/
editForm$6.head = (args, options) => ({
	action: edit$6.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
edit$6.form = editForm$6;
/**
* @see \App\Http\Controllers\Admin\WorkflowController::canvas
* @see app/Http/Controllers/Admin/WorkflowController.php:221
* @route '/app/workflows/{workflow}/canvas'
*/
var canvas = (args, options) => ({
	url: canvas.url(args, options),
	method: "get"
});
canvas.definition = {
	methods: ["get", "head"],
	url: "/app/workflows/{workflow}/canvas"
};
/**
* @see \App\Http\Controllers\Admin\WorkflowController::canvas
* @see app/Http/Controllers/Admin/WorkflowController.php:221
* @route '/app/workflows/{workflow}/canvas'
*/
canvas.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { workflow: args };
	if (typeof args === "object" && !Array.isArray(args) && "id" in args) args = { workflow: args.id };
	if (Array.isArray(args)) args = { workflow: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { workflow: typeof args.workflow === "object" ? args.workflow.id : args.workflow };
	return canvas.definition.url.replace("{workflow}", parsedArgs.workflow.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\WorkflowController::canvas
* @see app/Http/Controllers/Admin/WorkflowController.php:221
* @route '/app/workflows/{workflow}/canvas'
*/
canvas.get = (args, options) => ({
	url: canvas.url(args, options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\WorkflowController::canvas
* @see app/Http/Controllers/Admin/WorkflowController.php:221
* @route '/app/workflows/{workflow}/canvas'
*/
canvas.head = (args, options) => ({
	url: canvas.url(args, options),
	method: "head"
});
/**
* @see \App\Http\Controllers\Admin\WorkflowController::canvas
* @see app/Http/Controllers/Admin/WorkflowController.php:221
* @route '/app/workflows/{workflow}/canvas'
*/
var canvasForm = (args, options) => ({
	action: canvas.url(args, options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\WorkflowController::canvas
* @see app/Http/Controllers/Admin/WorkflowController.php:221
* @route '/app/workflows/{workflow}/canvas'
*/
canvasForm.get = (args, options) => ({
	action: canvas.url(args, options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\WorkflowController::canvas
* @see app/Http/Controllers/Admin/WorkflowController.php:221
* @route '/app/workflows/{workflow}/canvas'
*/
canvasForm.head = (args, options) => ({
	action: canvas.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
canvas.form = canvasForm;
/**
* @see \App\Http\Controllers\Admin\WorkflowController::update
* @see app/Http/Controllers/Admin/WorkflowController.php:232
* @route '/app/workflows/{workflow}'
*/
var update$5 = (args, options) => ({
	url: update$5.url(args, options),
	method: "patch"
});
update$5.definition = {
	methods: ["patch"],
	url: "/app/workflows/{workflow}"
};
/**
* @see \App\Http\Controllers\Admin\WorkflowController::update
* @see app/Http/Controllers/Admin/WorkflowController.php:232
* @route '/app/workflows/{workflow}'
*/
update$5.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { workflow: args };
	if (typeof args === "object" && !Array.isArray(args) && "id" in args) args = { workflow: args.id };
	if (Array.isArray(args)) args = { workflow: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { workflow: typeof args.workflow === "object" ? args.workflow.id : args.workflow };
	return update$5.definition.url.replace("{workflow}", parsedArgs.workflow.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\WorkflowController::update
* @see app/Http/Controllers/Admin/WorkflowController.php:232
* @route '/app/workflows/{workflow}'
*/
update$5.patch = (args, options) => ({
	url: update$5.url(args, options),
	method: "patch"
});
/**
* @see \App\Http\Controllers\Admin\WorkflowController::update
* @see app/Http/Controllers/Admin/WorkflowController.php:232
* @route '/app/workflows/{workflow}'
*/
var updateForm$5 = (args, options) => ({
	action: update$5.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "PATCH",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\WorkflowController::update
* @see app/Http/Controllers/Admin/WorkflowController.php:232
* @route '/app/workflows/{workflow}'
*/
updateForm$5.patch = (args, options) => ({
	action: update$5.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "PATCH",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
update$5.form = updateForm$5;
/**
* @see \App\Http\Controllers\Admin\WorkflowController::destroy
* @see app/Http/Controllers/Admin/WorkflowController.php:277
* @route '/app/workflows/{workflow}'
*/
var destroy$3 = (args, options) => ({
	url: destroy$3.url(args, options),
	method: "delete"
});
destroy$3.definition = {
	methods: ["delete"],
	url: "/app/workflows/{workflow}"
};
/**
* @see \App\Http\Controllers\Admin\WorkflowController::destroy
* @see app/Http/Controllers/Admin/WorkflowController.php:277
* @route '/app/workflows/{workflow}'
*/
destroy$3.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { workflow: args };
	if (typeof args === "object" && !Array.isArray(args) && "id" in args) args = { workflow: args.id };
	if (Array.isArray(args)) args = { workflow: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { workflow: typeof args.workflow === "object" ? args.workflow.id : args.workflow };
	return destroy$3.definition.url.replace("{workflow}", parsedArgs.workflow.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\WorkflowController::destroy
* @see app/Http/Controllers/Admin/WorkflowController.php:277
* @route '/app/workflows/{workflow}'
*/
destroy$3.delete = (args, options) => ({
	url: destroy$3.url(args, options),
	method: "delete"
});
/**
* @see \App\Http\Controllers\Admin\WorkflowController::destroy
* @see app/Http/Controllers/Admin/WorkflowController.php:277
* @route '/app/workflows/{workflow}'
*/
var destroyForm$3 = (args, options) => ({
	action: destroy$3.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "DELETE",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\WorkflowController::destroy
* @see app/Http/Controllers/Admin/WorkflowController.php:277
* @route '/app/workflows/{workflow}'
*/
destroyForm$3.delete = (args, options) => ({
	action: destroy$3.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "DELETE",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
destroy$3.form = destroyForm$3;
/**
* @see \App\Http\Controllers\Admin\WorkflowController::bulkDestroy
* @see app/Http/Controllers/Admin/WorkflowController.php:303
* @route '/app/workflows/bulk-destroy'
*/
var bulkDestroy = (options) => ({
	url: bulkDestroy.url(options),
	method: "post"
});
bulkDestroy.definition = {
	methods: ["post"],
	url: "/app/workflows/bulk-destroy"
};
/**
* @see \App\Http\Controllers\Admin\WorkflowController::bulkDestroy
* @see app/Http/Controllers/Admin/WorkflowController.php:303
* @route '/app/workflows/bulk-destroy'
*/
bulkDestroy.url = (options) => {
	return bulkDestroy.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\WorkflowController::bulkDestroy
* @see app/Http/Controllers/Admin/WorkflowController.php:303
* @route '/app/workflows/bulk-destroy'
*/
bulkDestroy.post = (options) => ({
	url: bulkDestroy.url(options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\WorkflowController::bulkDestroy
* @see app/Http/Controllers/Admin/WorkflowController.php:303
* @route '/app/workflows/bulk-destroy'
*/
var bulkDestroyForm = (options) => ({
	action: bulkDestroy.url(options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Admin\WorkflowController::bulkDestroy
* @see app/Http/Controllers/Admin/WorkflowController.php:303
* @route '/app/workflows/bulk-destroy'
*/
bulkDestroyForm.post = (options) => ({
	action: bulkDestroy.url(options),
	method: "post"
});
bulkDestroy.form = bulkDestroyForm;
Object.assign(index$5, index$5), Object.assign(create, create), Object.assign(store$6, store$6), Object.assign(simulate, simulate), Object.assign(edit$6, edit$6), Object.assign(canvas, canvas), Object.assign(update$5, update$5), Object.assign(destroy$3, destroy$3), Object.assign(bulkDestroy, bulkDestroy);
//#endregion
//#region resources/js/pages/app/workflows/canvas-internals/test-run.tsx
var test_run_exports = /* @__PURE__ */ __exportAll({ TestRunPanel: () => TestRunPanel });
function csrf$1() {
	return document.querySelector("meta[name=\"csrf-token\"]")?.content ?? "";
}
/**
* Right-panel "Test run" — dry-runs the CURRENT canvas (saved or not)
* against the stateless simulate endpoint and renders the trace as a
* mini chat transcript. Question steps pause exactly like the live
* engine; typing a reply appends to messages[] and re-runs the whole
* simulation (stateless by design — no run rows are ever created).
*/
function TestRunPanel({ buildPayload, onTraceNodes }) {
	const { t } = useT();
	const [messages, setMessages] = useState([]);
	const [input, setInput] = useState("");
	const [result, setResult] = useState(null);
	const [running, setRunning] = useState(false);
	const [error, setError] = useState(null);
	const run = async (allMessages) => {
		const payload = buildPayload();
		if (payload.steps.length === 0) {
			setError(t("Wire at least one step to the trigger first."));
			return;
		}
		setRunning(true);
		setError(null);
		try {
			const res = await fetch(simulate().url, {
				method: "POST",
				credentials: "same-origin",
				headers: {
					"Content-Type": "application/json",
					Accept: "application/json",
					"X-CSRF-TOKEN": csrf$1(),
					"X-Requested-With": "XMLHttpRequest"
				},
				body: JSON.stringify({
					keywords: payload.keywords,
					match_mode: payload.match_mode,
					steps: payload.steps,
					messages: allMessages
				})
			});
			if (!res.ok) throw new Error(`HTTP ${res.status}`);
			const json = await res.json();
			setMessages(allMessages);
			setResult(json.data);
			onTraceNodes(json.data.events.map((e) => payload.stepOrder[e.step]).filter((id) => typeof id === "string"));
		} catch {
			setError(t("Test run failed — check the flow and try again."));
		} finally {
			setRunning(false);
		}
	};
	const submit = () => {
		const value = input.trim();
		if (value === "" || running) return;
		setInput("");
		run([...messages, value]);
	};
	const reset = () => {
		setMessages([]);
		setResult(null);
		setError(null);
		setInput("");
		onTraceNodes([]);
	};
	const waiting = result?.status === "waiting_reply";
	return /* @__PURE__ */ jsxs("div", {
		className: "flex h-full flex-col gap-3",
		children: [
			/* @__PURE__ */ jsxs("div", {
				className: "flex items-center justify-between",
				children: [/* @__PURE__ */ jsx("p", {
					className: "text-xs font-bold tracking-wide text-muted-foreground uppercase",
					children: t("Test run")
				}), (result !== null || messages.length > 0) && /* @__PURE__ */ jsxs("button", {
					type: "button",
					onClick: reset,
					className: "flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground",
					children: [/* @__PURE__ */ jsx(RotateCcw, { className: "size-3" }), t("Reset")]
				})]
			}),
			/* @__PURE__ */ jsx("p", {
				className: "text-xs text-muted-foreground",
				children: t("Dry-runs the flow exactly like the live engine — but nothing is saved, tagged, or sent.")
			}),
			/* @__PURE__ */ jsxs("div", {
				className: "flex-1 space-y-2 overflow-y-auto rounded-md border bg-muted/20 p-2",
				children: [
					messages.map((m, i) => /* @__PURE__ */ jsx("div", {
						className: "flex justify-end",
						children: /* @__PURE__ */ jsx("span", {
							className: "max-w-[90%] rounded-lg bg-primary px-2.5 py-1.5 text-xs text-primary-foreground",
							children: m
						})
					}, `m-${i}`)),
					result !== null && !result.triggered && /* @__PURE__ */ jsx("p", {
						className: "rounded-md border border-amber-300 bg-amber-50 p-2 text-xs text-amber-900 dark:border-amber-700 dark:bg-amber-900/30 dark:text-amber-200",
						children: t("The trigger did not fire — the message contains none of the keywords.")
					}),
					result?.events.map((event, i) => {
						switch (event.type) {
							case "message":
							case "question":
							case "escalate": return /* @__PURE__ */ jsx("div", {
								className: "flex",
								children: /* @__PURE__ */ jsx("span", {
									className: "max-w-[90%] rounded-lg border bg-card px-2.5 py-1.5 text-xs",
									children: event.text
								})
							}, i);
							case "reply": return /* @__PURE__ */ jsx("div", {
								className: "flex justify-end",
								children: /* @__PURE__ */ jsx("span", {
									className: "max-w-[90%] rounded-lg bg-primary px-2.5 py-1.5 text-xs text-primary-foreground",
									children: event.text
								})
							}, i);
							case "branch": return /* @__PURE__ */ jsxs("p", {
								className: "flex items-center gap-1 px-1 text-[11px] text-muted-foreground",
								children: [/* @__PURE__ */ jsx(GitBranch, { className: "size-3" }), event.matched_case === "default" ? t("Branch took the default case") : event.matched_case === null ? t("Branch fell through (no case matched)") : t("Branch matched case :n", { n: (event.matched_case ?? 0) + 1 })]
							}, i);
							case "tag_lead": return /* @__PURE__ */ jsxs("p", {
								className: "flex items-center gap-1 px-1 text-[11px] text-muted-foreground",
								children: [/* @__PURE__ */ jsx(Tag, { className: "size-3" }), t("Would tag the lead: :tags (not applied in test)", { tags: (event.tags ?? []).join(", ") })]
							}, i);
							case "webhook": return /* @__PURE__ */ jsxs("p", {
								className: "flex items-center gap-1 px-1 text-[11px] text-muted-foreground",
								children: [/* @__PURE__ */ jsx(Webhook, { className: "size-3" }), t("Would call :url (not sent in test)", { url: event.url ?? "" })]
							}, i);
							case "loop_guard": return /* @__PURE__ */ jsx("p", {
								className: "rounded-md border border-red-300 bg-red-50 p-2 text-xs text-red-900 dark:border-red-700 dark:bg-red-900/30 dark:text-red-200",
								children: t("Stopped: the branches loop forever (32-jump guard). Fix the wiring.")
							}, i);
							default: return null;
						}
					}),
					result?.status === "escalated" && /* @__PURE__ */ jsxs("p", {
						className: "flex items-center gap-1 px-1 text-[11px] text-muted-foreground",
						children: [/* @__PURE__ */ jsx(UserCheck, { className: "size-3" }), t("Flow ends here — operators would be notified.")]
					}),
					result?.status === "completed" && /* @__PURE__ */ jsx("p", {
						className: "px-1 text-[11px] text-muted-foreground",
						children: t("Flow completed.")
					})
				]
			}),
			error !== null && /* @__PURE__ */ jsx("p", {
				className: "text-xs text-red-600 dark:text-red-400",
				children: error
			}),
			/* @__PURE__ */ jsxs("div", {
				className: "flex gap-2",
				children: [/* @__PURE__ */ jsx("input", {
					className: "min-w-0 flex-1 rounded-md border bg-background px-2.5 py-1.5 text-xs",
					placeholder: waiting ? t("Visitor reply to “:q”…", { q: result?.events.filter((e) => e.type === "question").at(-1)?.text ?? "" }) : t("Type a visitor message…"),
					value: input,
					onChange: (e) => setInput(e.target.value),
					onKeyDown: (e) => {
						if (e.key === "Enter") {
							e.preventDefault();
							submit();
						}
					}
				}), /* @__PURE__ */ jsxs(Button, {
					type: "button",
					size: "sm",
					onClick: submit,
					disabled: running || input.trim() === "",
					children: [/* @__PURE__ */ jsx(Play, { className: "me-1 size-3.5" }), waiting ? t("Reply") : t("Run")]
				})]
			})
		]
	});
}
//#endregion
//#region resources/js/pages/app/workflows/canvas-internals/layout.ts
var COL_WIDTH = 280;
var ROW_HEIGHT = 180;
var ORIGIN_X = 60;
var ORIGIN_Y = 0;
/**
* "Tidy layout" — deterministic layered layout, no external library.
*
* Ranks are BFS depth from the trigger (rank 0). Within a rank, nodes
* keep their current left-to-right order (stable sort on x) so tidying
* never flips siblings the admin deliberately arranged. Unreachable
* nodes get parked on a bottom row so they stay visible — the
* validation layer flags them separately.
*/
function tidyLayout(nodes, edges) {
	const rankById = /* @__PURE__ */ new Map();
	rankById.set("trigger", 0);
	const queue = ["trigger"];
	while (queue.length > 0) {
		const id = queue.shift();
		const rank = rankById.get(id) ?? 0;
		for (const edge of edges) if (edge.source === id && !rankById.has(edge.target)) {
			rankById.set(edge.target, rank + 1);
			queue.push(edge.target);
		}
	}
	const maxRank = Math.max(0, ...rankById.values());
	const byRank = /* @__PURE__ */ new Map();
	const parked = [];
	for (const node of nodes) {
		const rank = rankById.get(node.id);
		if (rank === void 0) {
			parked.push(node);
			continue;
		}
		const bucket = byRank.get(rank) ?? [];
		bucket.push(node);
		byRank.set(rank, bucket);
	}
	const positioned = /* @__PURE__ */ new Map();
	for (const [rank, bucket] of byRank) {
		bucket.sort((a, b) => a.position.x - b.position.x);
		bucket.forEach((node, i) => {
			positioned.set(node.id, {
				x: ORIGIN_X + i * COL_WIDTH,
				y: ORIGIN_Y + rank * ROW_HEIGHT
			});
		});
	}
	parked.sort((a, b) => a.position.x - b.position.x).forEach((node, i) => {
		positioned.set(node.id, {
			x: ORIGIN_X + i * COL_WIDTH,
			y: ORIGIN_Y + (maxRank + 2) * ROW_HEIGHT
		});
	});
	return nodes.map((node) => ({
		...node,
		position: positioned.get(node.id) ?? node.position
	}));
}
//#endregion
//#region resources/js/pages/app/workflows/canvas-internals/translator.ts
/**
* Translate a React-Flow canvas (nodes + edges) into the backend's
* flat `steps[]` array. The runtime always consumes steps[]; the
* canvas state is a UI affordance the editor persists alongside.
*
* Algorithm:
*   1. Find the trigger node (synthetic, not a step).
*   2. Walk outgoing edges from the trigger to build a deterministic
*      step order. Branch nodes have multiple outgoing edges keyed by
*      `sourceHandle = case-N` or `default`.
*   3. Assign each non-trigger node an index in the order discovered.
*   4. For branches, populate `cases[*].go_to` from the destination
*      indices.
*
* Cycles in the graph (a branch case pointing back to a parent)
* are allowed — the runtime's loop-guard (32 jumps) handles them.
* The translator just records the indices.
*/
function canvasToSteps(nodes, edges) {
	const order = canvasStepOrder(nodes, edges);
	const indexById = /* @__PURE__ */ new Map();
	order.forEach((id, i) => indexById.set(id, i));
	return order.map((id) => {
		const node = nodes.find((n) => n.id === id);
		if (!node) return {
			type: "message",
			text: ""
		};
		return nodeToStep(node, edges, indexById);
	});
}
/**
* Deterministic node-id order matching the step indices canvasToSteps
* assigns — BFS from the trigger, cycles short-circuited by the
* visited set. Exported so the test-run panel can map a trace's step
* indices back to canvas node ids for path highlighting.
*/
function canvasStepOrder(nodes, edges) {
	const trigger = nodes.find((n) => n.id === "trigger");
	if (!trigger) return [];
	const order = [];
	const visited = new Set([trigger.id]);
	const queue = [];
	const triggerOuts = edges.filter((e) => e.source === trigger.id);
	for (const edge of triggerOuts) if (!visited.has(edge.target)) {
		visited.add(edge.target);
		queue.push(edge.target);
	}
	while (queue.length > 0) {
		const id = queue.shift();
		order.push(id);
		const outs = edges.filter((e) => e.source === id).sort((a, b) => (a.sourceHandle ?? "out").localeCompare(b.sourceHandle ?? "out"));
		for (const edge of outs) if (!visited.has(edge.target)) {
			visited.add(edge.target);
			queue.push(edge.target);
		}
	}
	return order;
}
function nodeToStep(node, edges, indexById) {
	const type = node.type;
	const data = node.data ?? {};
	switch (type) {
		case "message": return {
			type: "message",
			text: String(data.text ?? "")
		};
		case "question": return {
			type: "question",
			text: String(data.text ?? ""),
			var_name: String(data.var_name ?? "visitor_answer")
		};
		case "branch": {
			const casesOut = (data.cases ?? []).map((c, i) => {
				const edge = edges.find((e) => e.source === node.id && e.sourceHandle === `case-${i}`);
				const target = edge ? indexById.get(edge.target) : void 0;
				return {
					match: c.match,
					value: c.value ?? null,
					go_to: target ?? indexById.size
				};
			});
			const defaultEdge = edges.find((e) => e.source === node.id && e.sourceHandle === "default");
			if (defaultEdge) casesOut.push({
				match: "default",
				value: null,
				go_to: indexById.get(defaultEdge.target) ?? indexById.size
			});
			return {
				type: "branch",
				var: String(data.var ?? ""),
				cases: casesOut
			};
		}
		case "tag_lead": return {
			type: "tag_lead",
			tags: Array.isArray(data.tags) ? data.tags.map(String) : []
		};
		case "webhook": return {
			type: "webhook",
			url: String(data.url ?? ""),
			method: data.method ?? "POST",
			extra_payload: data.extra_payload && typeof data.extra_payload === "object" ? data.extra_payload : void 0
		};
		case "escalate": return {
			type: "escalate",
			text: String(data.text ?? "Connecting you with a human now.")
		};
	}
}
/**
* Reverse direction — take a flat steps[] (e.g. the form-edited
* shape from Phase 1 with no `definition.canvas`) and lay it out
* vertically with linear edges so the canvas can render it without
* the admin manually arranging.
*/
function stepsToCanvas(steps) {
	const nodes = [{
		id: "trigger",
		type: "message",
		position: {
			x: 50,
			y: 0
		},
		data: { __trigger: true }
	}];
	const edges = [];
	let lastNodeId = "trigger";
	steps.forEach((step, i) => {
		const id = `step-${i}`;
		nodes.push({
			id,
			type: step.type,
			position: {
				x: 50,
				y: 140 + i * 160
			},
			data: { ...step }
		});
		edges.push({
			id: `e-${lastNodeId}-${id}`,
			source: lastNodeId,
			target: id,
			sourceHandle: "out"
		});
		if (step.type === "branch") step.cases.forEach((c, ci) => {
			const targetId = `step-${c.go_to}`;
			if (steps[c.go_to] !== void 0) edges.push({
				id: `e-${id}-${ci}-${targetId}`,
				source: id,
				target: targetId,
				sourceHandle: c.match === "default" ? "default" : `case-${ci}`
			});
		});
		lastNodeId = id;
	});
	return {
		nodes,
		edges
	};
}
//#endregion
//#region resources/js/pages/app/workflows/canvas-internals/validation.ts
function computeProblems(nodes, edges, keywords, t) {
	const problems = [];
	const stepNodes = nodes.filter((n) => n.id !== "trigger");
	if (keywords.filter((k) => k.trim() !== "").length === 0) problems.push({
		nodeId: "trigger",
		message: t("Trigger has no keywords — the workflow can never fire.")
	});
	if (stepNodes.length > 0 && !edges.some((e) => e.source === "trigger")) problems.push({
		nodeId: "trigger",
		message: t("Trigger is not wired to a first step.")
	});
	if (stepNodes.length === 0) problems.push({
		nodeId: "trigger",
		message: t("The flow has no steps yet.")
	});
	const reachable = new Set(["trigger"]);
	const queue = ["trigger"];
	while (queue.length > 0) {
		const id = queue.shift();
		for (const edge of edges) if (edge.source === id && !reachable.has(edge.target)) {
			reachable.add(edge.target);
			queue.push(edge.target);
		}
	}
	for (const node of stepNodes) {
		if (!reachable.has(node.id)) problems.push({
			nodeId: node.id,
			message: t("Step is not connected to the flow — it will never run.")
		});
		const data = node.data ?? {};
		switch (node.type) {
			case "message":
			case "question":
				if (String(data.text ?? "").trim() === "") problems.push({
					nodeId: node.id,
					message: node.type === "message" ? t("Message text is empty.") : t("Question text is empty.")
				});
				break;
			case "branch": {
				if (String(data.var ?? "").trim() === "") problems.push({
					nodeId: node.id,
					message: t("Branch has no variable to check.")
				});
				const cases = data.cases ?? [];
				if (cases.length === 0) problems.push({
					nodeId: node.id,
					message: t("Branch has no cases.")
				});
				cases.forEach((c, i) => {
					if (c.match === "default") return;
					if (!edges.some((e) => e.source === node.id && e.sourceHandle === `case-${i}`)) problems.push({
						nodeId: node.id,
						message: t("Branch case :n is not wired to a step.", { n: i + 1 })
					});
				});
				break;
			}
			case "webhook": {
				const url = String(data.url ?? "").trim();
				if (url === "" || !/^https?:\/\//i.test(url)) problems.push({
					nodeId: node.id,
					message: t("Webhook URL is missing or not an http(s) address.")
				});
				break;
			}
			case "tag_lead":
				if ((Array.isArray(data.tags) ? data.tags : []).map((x) => String(x).trim()).filter((x) => x !== "").length === 0) problems.push({
					nodeId: node.id,
					message: t("Tag step has no tags.")
				});
				break;
			default: break;
		}
	}
	return problems;
}
//#endregion
//#region resources/js/pages/app/workflows/canvas.tsx
var canvas_exports = /* @__PURE__ */ __exportAll({ default: () => WorkflowCanvas });
var HISTORY_LIMIT = 50;
var DRAG_MIME = "application/pitchbar-step";
/**
* Module-scope id mint — unique across rapid add/duplicate in the same
* millisecond, and outside the component so the compiler purity lint
* stays satisfied.
*/
var stepSeq = 0;
function freshStepId() {
	stepSeq += 1;
	return `step-${Date.now().toString(36)}-${stepSeq}`;
}
function WorkflowCanvas({ workflow }) {
	return /* @__PURE__ */ jsx(ReactFlowProvider, { children: /* @__PURE__ */ jsx(CanvasInner, { workflow }) });
}
function CanvasInner({ workflow }) {
	const { t } = useT();
	const { screenToFlowPosition } = useReactFlow();
	const confirmDialog = useConfirm();
	const palette = [
		{
			type: "message",
			label: t("Message")
		},
		{
			type: "question",
			label: t("Question")
		},
		{
			type: "branch",
			label: t("Branch")
		},
		{
			type: "tag_lead",
			label: t("Tag lead")
		},
		{
			type: "webhook",
			label: t("Webhook")
		},
		{
			type: "escalate",
			label: t("Escalate")
		}
	];
	const breadcrumbs = [
		{
			title: t("Workflows"),
			href: "/app/workflows"
		},
		workflow ? {
			title: workflow.name,
			href: `/app/workflows/${workflow.id}/edit`
		} : {
			title: t("New workflow"),
			href: "/app/workflows/create?canvas=1"
		},
		{
			title: t("Canvas"),
			href: "#"
		}
	];
	const initial = useMemo(() => {
		if (!workflow) return {
			nodes: [],
			edges: []
		};
		const persisted = workflow.definition?.canvas;
		if (persisted && persisted.nodes && persisted.nodes.length > 0) return persisted;
		return stepsToCanvas(workflow.steps);
	}, [workflow]);
	const [nodes, setNodes, onNodesChange] = useNodesState([{
		id: "trigger",
		type: "trigger",
		position: {
			x: 60,
			y: 0
		},
		deletable: false,
		data: {
			keywords: workflow?.keywords ?? [],
			match_mode: workflow?.match_mode ?? "any"
		}
	}, ...initial.nodes.filter((n) => n.id !== "trigger")]);
	const [edges, setEdges, onEdgesChange] = useEdgesState(initial.edges);
	const [selectedNodeId, setSelectedNodeId] = useState(null);
	const [keywords, setKeywords] = useState(workflow?.keywords ?? []);
	const [matchMode, setMatchMode] = useState(workflow?.match_mode ?? "any");
	const [name, setName] = useState(workflow?.name ?? t("Untitled workflow"));
	const [status, setStatus] = useState(workflow?.status ?? "draft");
	const [saving, setSaving] = useState(false);
	const [saveError, setSaveError] = useState(null);
	const [rightPane, setRightPane] = useState("inspector");
	const [problemsOpen, setProblemsOpen] = useState(false);
	const [traceIds, setTraceIds] = useState(/* @__PURE__ */ new Set());
	const pastRef = useRef([]);
	const futureRef = useRef([]);
	const [historyDepth, setHistoryDepth] = useState({
		past: 0,
		future: 0
	});
	const dirtyRef = useRef(false);
	const savingRef = useRef(false);
	const leaveConfirmedRef = useRef(false);
	const lastInspectorEditRef = useRef(null);
	const dragSnapshotRef = useRef(null);
	const markDirty = () => {
		dirtyRef.current = true;
	};
	const takeSnapshot = useCallback(() => ({
		nodes: JSON.parse(JSON.stringify(nodes)),
		edges: JSON.parse(JSON.stringify(edges))
	}), [nodes, edges]);
	const syncHistoryDepth = () => {
		setHistoryDepth({
			past: pastRef.current.length,
			future: futureRef.current.length
		});
	};
	const pushHistory = useCallback((snapshot) => {
		pastRef.current = [...pastRef.current.slice(-(HISTORY_LIMIT - 1)), snapshot ?? takeSnapshot()];
		futureRef.current = [];
		syncHistoryDepth();
	}, [takeSnapshot]);
	const undo = useCallback(() => {
		const prev = pastRef.current.pop();
		if (!prev) return;
		futureRef.current.push({
			nodes: JSON.parse(JSON.stringify(nodes)),
			edges: JSON.parse(JSON.stringify(edges))
		});
		setNodes(prev.nodes);
		setEdges(prev.edges);
		syncHistoryDepth();
		markDirty();
	}, [
		nodes,
		edges,
		setNodes,
		setEdges
	]);
	const redo = useCallback(() => {
		const next = futureRef.current.pop();
		if (!next) return;
		pastRef.current.push({
			nodes: JSON.parse(JSON.stringify(nodes)),
			edges: JSON.parse(JSON.stringify(edges))
		});
		setNodes(next.nodes);
		setEdges(next.edges);
		syncHistoryDepth();
		markDirty();
	}, [
		nodes,
		edges,
		setNodes,
		setEdges
	]);
	useEffect(() => {
		const handler = (e) => {
			const target = e.target;
			if (target && (target.tagName === "INPUT" || target.tagName === "TEXTAREA" || target.isContentEditable)) return;
			if ((e.metaKey || e.ctrlKey) && e.key.toLowerCase() === "z") {
				e.preventDefault();
				if (e.shiftKey) redo();
				else undo();
			}
		};
		window.addEventListener("keydown", handler);
		return () => window.removeEventListener("keydown", handler);
	}, [undo, redo]);
	useEffect(() => {
		const beforeUnload = (e) => {
			if (dirtyRef.current && !savingRef.current) e.preventDefault();
		};
		window.addEventListener("beforeunload", beforeUnload);
		const off = router.on("before", (event) => {
			const visit = event.detail.visit;
			if (!dirtyRef.current || savingRef.current || leaveConfirmedRef.current || visit.method !== "get") return;
			event.preventDefault();
			(async () => {
				if (await confirmDialog({
					title: t("Leave the canvas?"),
					message: t("You have unsaved canvas changes. Leave anyway?"),
					confirmLabel: t("Leave"),
					danger: true
				})) {
					leaveConfirmedRef.current = true;
					router.visit(visit.url.href);
				}
			})();
		});
		return () => {
			window.removeEventListener("beforeunload", beforeUnload);
			off();
		};
	}, []);
	const selectedNode = selectedNodeId !== null ? nodes.find((n) => n.id === selectedNodeId) : null;
	const problems = useMemo(() => computeProblems(nodes, edges, keywords, t), [
		nodes,
		edges,
		keywords,
		t
	]);
	const problemNodeIds = useMemo(() => new Set(problems.map((p) => p.nodeId)), [problems]);
	const renderNodes = useMemo(() => nodes.map((n) => ({
		...n,
		deletable: n.id !== "trigger",
		className: [problemNodeIds.has(n.id) ? "pb-problem" : "", traceIds.has(n.id) ? "pb-trace" : ""].filter(Boolean).join(" ")
	})), [
		nodes,
		problemNodeIds,
		traceIds
	]);
	const edgesForExport = () => edges.map((e) => ({
		id: e.id,
		source: e.source,
		target: e.target,
		sourceHandle: e.sourceHandle ?? void 0
	}));
	const onConnect = useCallback((params) => {
		pushHistory();
		markDirty();
		setEdges((eds) => addEdge(params, eds));
	}, [setEdges, pushHistory]);
	const addNodeAt = (type, position) => {
		pushHistory();
		markDirty();
		const id = freshStepId();
		setNodes((nds) => [...nds.map((n) => ({
			...n,
			selected: false
		})), {
			id,
			type,
			position,
			data: defaultDataFor(type),
			selected: true
		}]);
		setSelectedNodeId(id);
		setRightPane("inspector");
	};
	const handleAddNode = (type) => {
		const last = nodes[nodes.length - 1];
		addNodeAt(type, {
			x: (last?.position.x ?? 60) + 40,
			y: (last?.position.y ?? 100) + 170
		});
	};
	const handleDrop = (e) => {
		e.preventDefault();
		const type = e.dataTransfer.getData(DRAG_MIME);
		if (type === "") return;
		addNodeAt(type, screenToFlowPosition({
			x: e.clientX,
			y: e.clientY
		}));
	};
	const handleNodeChange = (data) => {
		if (!selectedNodeId) return;
		if (lastInspectorEditRef.current !== selectedNodeId) {
			pushHistory();
			lastInspectorEditRef.current = selectedNodeId;
		}
		markDirty();
		setNodes((nds) => nds.map((n) => n.id === selectedNodeId ? {
			...n,
			data: { ...data }
		} : n));
	};
	const handleNodeDelete = () => {
		if (!selectedNodeId || selectedNodeId === "trigger") return;
		pushHistory();
		markDirty();
		setNodes((nds) => nds.filter((n) => n.id !== selectedNodeId));
		setEdges((eds) => eds.filter((e) => e.source !== selectedNodeId && e.target !== selectedNodeId));
		setSelectedNodeId(null);
	};
	const handleDuplicate = () => {
		if (!selectedNode || selectedNode.id === "trigger") return;
		pushHistory();
		markDirty();
		const id = freshStepId();
		setNodes((nds) => [...nds.map((n) => ({
			...n,
			selected: false
		})), {
			id,
			type: selectedNode.type,
			position: {
				x: selectedNode.position.x + 32,
				y: selectedNode.position.y + 32
			},
			data: JSON.parse(JSON.stringify(selectedNode.data ?? {})),
			selected: true
		}]);
		setSelectedNodeId(id);
	};
	const handleTidy = () => {
		pushHistory();
		markDirty();
		setNodes((nds) => tidyLayout(nds, edges));
	};
	const handleTriggerChange = (patch) => {
		markDirty();
		if (patch.keywords !== void 0) setKeywords(patch.keywords);
		if (patch.match_mode !== void 0) setMatchMode(patch.match_mode);
		setNodes((nds) => nds.map((n) => n.id === "trigger" ? {
			...n,
			data: {
				...n.data,
				keywords: patch.keywords ?? keywords,
				match_mode: patch.match_mode ?? matchMode
			}
		} : n));
	};
	const handleSave = () => {
		setSaveError(null);
		if (status === "active" && problems.length > 0) {
			setSaveError(t("Fix the :count problem(s) before activating — drafts can be saved anytime.", { count: problems.length }));
			setProblemsOpen(true);
			return;
		}
		setSaving(true);
		savingRef.current = true;
		const canvasNodes = nodes.filter((n) => n.id !== "trigger").map((n) => ({
			id: n.id,
			type: n.type,
			position: {
				x: n.position.x,
				y: n.position.y
			},
			data: n.data ?? {}
		}));
		const canvasEdges = edgesForExport();
		const steps = canvasToSteps(nodes, canvasEdges);
		const payload = {
			name,
			status,
			agent_id: workflow?.agent_id ?? null,
			segment_id: workflow?.segment_id ?? null,
			trigger_kind: "on_keyword",
			match_mode: matchMode,
			keywords,
			steps,
			definition_canvas: {
				nodes: canvasNodes,
				edges: canvasEdges
			},
			_editor: "canvas"
		};
		const opts = {
			preserveScroll: true,
			onSuccess: () => {
				dirtyRef.current = false;
			},
			onError: (errors) => {
				const first = Object.values(errors)[0];
				setSaveError(typeof first === "string" ? first : t("Could not save the workflow."));
			},
			onFinish: () => {
				setSaving(false);
				savingRef.current = false;
			}
		};
		if (workflow) router.patch(update$5(workflow.id).url, payload, opts);
		else router.post(store$6().url, payload, opts);
	};
	return /* @__PURE__ */ jsxs(AppLayout, {
		breadcrumbs,
		children: [
			/* @__PURE__ */ jsx(Head, { title: workflow ? t(":name · Canvas", { name: workflow.name }) : t("New workflow · Canvas") }),
			/* @__PURE__ */ jsx("style", { children: `
                .react-flow__node.pb-problem > div { outline: 2px solid rgba(220, 38, 38, 0.75); outline-offset: 2px; border-radius: 10px; }
                .react-flow__node.pb-trace > div { outline: 2px solid rgba(22, 163, 74, 0.85); outline-offset: 2px; border-radius: 10px; }
            ` }),
			/* @__PURE__ */ jsxs("div", {
				className: "flex flex-1 flex-col",
				children: [
					/* @__PURE__ */ jsxs("div", {
						className: "flex flex-wrap items-center gap-2 border-b bg-card px-4 py-2",
						children: [
							/* @__PURE__ */ jsx("input", {
								className: "min-w-0 flex-1 rounded-md border bg-background px-3 py-1 text-sm font-medium",
								value: name,
								onChange: (e) => {
									markDirty();
									setName(e.target.value);
								},
								"aria-label": t("Workflow name")
							}),
							/* @__PURE__ */ jsxs("select", {
								className: "rounded-md border bg-background px-3 py-1 text-sm",
								value: status,
								onChange: (e) => {
									markDirty();
									setStatus(e.target.value);
								},
								"aria-label": t("Status"),
								children: [
									/* @__PURE__ */ jsx("option", {
										value: "draft",
										children: t("Draft")
									}),
									/* @__PURE__ */ jsx("option", {
										value: "active",
										children: t("Active")
									}),
									/* @__PURE__ */ jsx("option", {
										value: "disabled",
										children: t("Disabled")
									})
								]
							}),
							/* @__PURE__ */ jsx("span", {
								className: "mx-1 h-5 w-px bg-border",
								"aria-hidden": "true"
							}),
							/* @__PURE__ */ jsx(Button, {
								type: "button",
								variant: "ghost",
								size: "sm",
								onClick: undo,
								disabled: historyDepth.past === 0,
								title: t("Undo"),
								"aria-label": t("Undo"),
								children: /* @__PURE__ */ jsx(Undo2, { className: "size-4" })
							}),
							/* @__PURE__ */ jsx(Button, {
								type: "button",
								variant: "ghost",
								size: "sm",
								onClick: redo,
								disabled: historyDepth.future === 0,
								title: t("Redo"),
								"aria-label": t("Redo"),
								children: /* @__PURE__ */ jsx(Redo2, { className: "size-4" })
							}),
							/* @__PURE__ */ jsx(Button, {
								type: "button",
								variant: "ghost",
								size: "sm",
								onClick: handleTidy,
								title: t("Tidy layout"),
								"aria-label": t("Tidy layout"),
								children: /* @__PURE__ */ jsx(Wand2, { className: "size-4" })
							}),
							/* @__PURE__ */ jsx(Button, {
								type: "button",
								variant: "ghost",
								size: "sm",
								onClick: handleDuplicate,
								disabled: !selectedNode || selectedNodeId === "trigger",
								title: t("Duplicate step"),
								"aria-label": t("Duplicate step"),
								children: /* @__PURE__ */ jsx(Copy, { className: "size-4" })
							}),
							/* @__PURE__ */ jsxs("div", {
								className: "relative",
								children: [/* @__PURE__ */ jsxs(Button, {
									type: "button",
									variant: problems.length > 0 ? "outline" : "ghost",
									size: "sm",
									onClick: () => setProblemsOpen((o) => !o),
									className: problems.length > 0 ? "border-red-300 text-red-700 dark:border-red-700 dark:text-red-300" : "",
									children: [/* @__PURE__ */ jsx(AlertTriangle, { className: "me-1 size-4" }), problems.length > 0 ? t(":count problems", { count: problems.length }) : t("No problems")]
								}), problemsOpen && problems.length > 0 && /* @__PURE__ */ jsx("div", {
									className: "absolute end-0 top-full z-50 mt-1 w-80 rounded-md border bg-popover p-2 text-popover-foreground shadow-md",
									children: /* @__PURE__ */ jsx("ul", {
										className: "space-y-1",
										children: problems.map((p, i) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx("button", {
											type: "button",
											className: "w-full rounded px-2 py-1 text-start text-xs hover:bg-accent",
											onClick: () => {
												setSelectedNodeId(p.nodeId);
												setRightPane("inspector");
												setProblemsOpen(false);
											},
											children: p.message
										}) }, i))
									})
								})]
							}),
							/* @__PURE__ */ jsxs(Button, {
								type: "button",
								variant: rightPane === "test" ? "secondary" : "ghost",
								size: "sm",
								onClick: () => setRightPane((p) => p === "test" ? "inspector" : "test"),
								children: [/* @__PURE__ */ jsx(FlaskConical, { className: "me-1 size-4" }), t("Test run")]
							}),
							workflow && /* @__PURE__ */ jsx(Button, {
								asChild: true,
								variant: "outline",
								size: "sm",
								children: /* @__PURE__ */ jsx(Link, {
									href: edit$6(workflow.id).url,
									children: t("Linear edit")
								})
							}),
							/* @__PURE__ */ jsxs(Button, {
								type: "button",
								size: "sm",
								onClick: handleSave,
								disabled: saving,
								children: [/* @__PURE__ */ jsx(Save, { className: "me-1 size-4" }), saving ? t("Saving…") : workflow ? t("Save") : t("Create workflow")]
							})
						]
					}),
					saveError !== null && /* @__PURE__ */ jsx("div", {
						className: "border-b border-red-200 bg-red-50 px-4 py-2 text-xs text-red-800 dark:border-red-900 dark:bg-red-950 dark:text-red-200",
						children: saveError
					}),
					/* @__PURE__ */ jsxs("div", {
						className: "grid flex-1 grid-cols-[180px_1fr_320px] overflow-hidden",
						children: [
							/* @__PURE__ */ jsxs("aside", {
								className: "flex flex-col gap-1 overflow-y-auto border-e bg-muted/30 p-2",
								children: [
									/* @__PURE__ */ jsx("p", {
										className: "px-2 py-1 text-[11px] font-bold tracking-wide text-muted-foreground uppercase",
										children: t("Add step")
									}),
									palette.map((p) => /* @__PURE__ */ jsxs("button", {
										type: "button",
										draggable: true,
										onDragStart: (e) => {
											e.dataTransfer.setData(DRAG_MIME, p.type);
											e.dataTransfer.effectAllowed = "move";
										},
										onClick: () => handleAddNode(p.type),
										className: "flex cursor-grab items-center gap-2 rounded-md border bg-card px-2 py-1.5 text-start text-xs font-medium transition hover:bg-accent active:cursor-grabbing",
										title: t("Click to add, or drag onto the canvas"),
										children: [
											NODE_TYPE_ICONS[p.type],
											/* @__PURE__ */ jsx("span", { children: p.label }),
											/* @__PURE__ */ jsx(Plus, { className: "ms-auto size-3 text-muted-foreground" })
										]
									}, p.type)),
									/* @__PURE__ */ jsx("p", {
										className: "mt-2 px-2 text-[10px] leading-snug text-muted-foreground",
										children: t("Tip: drag a step onto the canvas to place it exactly. Delete removes the selection.")
									})
								]
							}),
							/* @__PURE__ */ jsx("div", {
								className: "relative bg-[#fafafa] dark:bg-background",
								onDrop: handleDrop,
								onDragOver: (e) => {
									e.preventDefault();
									e.dataTransfer.dropEffect = "move";
								},
								children: /* @__PURE__ */ jsxs(ReactFlow, {
									nodes: renderNodes,
									edges,
									onNodesChange,
									onEdgesChange,
									onConnect,
									nodeTypes: NODE_TYPES,
									onNodeClick: (_, node) => setSelectedNodeId(node.id),
									onPaneClick: () => {
										setSelectedNodeId(null);
										setProblemsOpen(false);
										lastInspectorEditRef.current = null;
									},
									onNodeDragStart: () => {
										dragSnapshotRef.current = takeSnapshot();
									},
									onNodeDragStop: () => {
										if (dragSnapshotRef.current) {
											pushHistory(dragSnapshotRef.current);
											dragSnapshotRef.current = null;
											markDirty();
										}
									},
									onBeforeDelete: async ({ nodes: toDelete }) => {
										if (toDelete.some((n) => n.id === "trigger")) return false;
										pushHistory();
										markDirty();
										return true;
									},
									deleteKeyCode: ["Backspace", "Delete"],
									fitView: true,
									children: [
										/* @__PURE__ */ jsx(Background, {}),
										/* @__PURE__ */ jsx(Controls, {}),
										/* @__PURE__ */ jsx(MiniMap, {
											pannable: true,
											zoomable: true
										})
									]
								})
							}),
							/* @__PURE__ */ jsx("aside", {
								className: "flex flex-col overflow-y-auto border-s bg-card p-3",
								children: rightPane === "test" ? /* @__PURE__ */ jsx(TestRunPanel, {
									buildPayload: () => {
										const edgeList = edgesForExport();
										return {
											keywords,
											match_mode: matchMode,
											steps: canvasToSteps(nodes, edgeList),
											stepOrder: canvasStepOrder(nodes, edgeList)
										};
									},
									onTraceNodes: (ids) => setTraceIds(new Set(ids))
								}) : selectedNode ? /* @__PURE__ */ jsx(NodeInspector, {
									node: selectedNode,
									onChange: handleNodeChange,
									onDelete: handleNodeDelete,
									triggerExtras: selectedNode.id === "trigger" ? {
										keywords,
										match_mode: matchMode,
										onTriggerChange: handleTriggerChange
									} : void 0
								}) : /* @__PURE__ */ jsx("p", {
									className: "text-xs text-muted-foreground",
									children: t("Click a node to edit. Drag from a node's bottom or side handles to wire it to the next step. Branch nodes have one handle per case.")
								})
							})
						]
					})
				]
			})
		]
	});
}
function defaultDataFor(type) {
	switch (type) {
		case "message": return { text: "New message" };
		case "question": return {
			text: "New question?",
			var_name: "visitor_answer"
		};
		case "branch": return {
			var: "visitor_answer",
			cases: [{
				match: "equals",
				value: "",
				go_to: 0
			}, {
				match: "default",
				value: null,
				go_to: 0
			}]
		};
		case "tag_lead": return { tags: [] };
		case "webhook": return {
			url: "",
			method: "POST"
		};
		case "escalate": return { text: "Connecting you with a human now." };
	}
}
//#endregion
//#region resources/js/pages/app/workflows/workflow-form.tsx
var workflow_form_exports = /* @__PURE__ */ __exportAll({ WorkflowForm: () => WorkflowForm });
function WorkflowForm({ initial, method, action, submitLabel, agents }) {
	const { t } = useT();
	const stepTypeHelp = {
		message: t("Send a chat bubble — supports {{var}} interpolation."),
		question: t("Send a bubble + pause for the visitor reply; saved into var_name."),
		escalate: t("Send a goodbye line + flag the conversation for human takeover.")
	};
	const form = useForm(initial);
	const [keywordsRaw, setKeywordsRaw] = useState(initial.keywords.join(", "));
	const submit = (e) => {
		e.preventDefault();
		form.submit(method, action, { preserveScroll: true });
	};
	const updateStep = (index, patch) => {
		const next = [...form.data.steps];
		next[index] = {
			...next[index],
			...patch
		};
		form.setData("steps", next);
	};
	const removeStep = (index) => {
		form.setData("steps", form.data.steps.filter((_, i) => i !== index));
	};
	const addStep = (type) => {
		form.setData("steps", [...form.data.steps, {
			type,
			text: type === "message" ? "" : type === "question" ? "" : "I'll connect you with a human now.",
			var_name: type === "question" ? "visitor_answer" : null
		}]);
	};
	return /* @__PURE__ */ jsxs("form", {
		onSubmit: submit,
		className: "grid gap-4",
		children: [
			/* @__PURE__ */ jsxs(Card, {
				className: "p-4",
				children: [
					/* @__PURE__ */ jsx("h2", {
						className: "font-semibold",
						children: t("Basics")
					}),
					/* @__PURE__ */ jsx("p", {
						className: "mb-4 text-xs text-muted-foreground",
						children: t("Workflow runs before the LLM on every visitor turn. Status must be Active to actually fire.")
					}),
					/* @__PURE__ */ jsxs("div", {
						className: "grid gap-4 md:grid-cols-2",
						children: [
							/* @__PURE__ */ jsxs("div", {
								className: "grid gap-1.5",
								children: [
									/* @__PURE__ */ jsx(Label, {
										htmlFor: "wf-name",
										children: t("Name")
									}),
									/* @__PURE__ */ jsx(Input, {
										id: "wf-name",
										value: form.data.name,
										onChange: (e) => form.setData("name", e.target.value),
										placeholder: t("Pricing FAQ flow"),
										required: true
									}),
									form.errors.name && /* @__PURE__ */ jsx("p", {
										className: "text-xs text-destructive",
										children: form.errors.name
									})
								]
							}),
							/* @__PURE__ */ jsxs("div", {
								className: "grid gap-1.5",
								children: [/* @__PURE__ */ jsx(Label, {
									htmlFor: "wf-status",
									children: t("Status")
								}), /* @__PURE__ */ jsxs("select", {
									id: "wf-status",
									value: form.data.status,
									onChange: (e) => form.setData("status", e.target.value),
									className: "h-9 rounded-md border bg-background px-3 text-sm",
									children: [
										/* @__PURE__ */ jsx("option", {
											value: "draft",
											children: t("Draft (not running)")
										}),
										/* @__PURE__ */ jsx("option", {
											value: "active",
											children: t("Active")
										}),
										/* @__PURE__ */ jsx("option", {
											value: "disabled",
											children: t("Disabled")
										})
									]
								})]
							}),
							/* @__PURE__ */ jsxs("div", {
								className: "grid gap-1.5 md:col-span-2",
								children: [
									/* @__PURE__ */ jsx(Label, {
										htmlFor: "wf-agent",
										children: t("Scoped to agent")
									}),
									/* @__PURE__ */ jsxs("select", {
										id: "wf-agent",
										value: form.data.agent_id ?? "",
										onChange: (e) => form.setData("agent_id", e.target.value === "" ? null : e.target.value),
										className: "h-9 rounded-md border bg-background px-3 text-sm",
										children: [/* @__PURE__ */ jsx("option", {
											value: "",
											children: t("Workspace-wide (every agent)")
										}), agents.map((agent) => /* @__PURE__ */ jsx("option", {
											value: agent.id,
											children: agent.name
										}, agent.id))]
									}),
									/* @__PURE__ */ jsx("p", {
										className: "text-xs text-muted-foreground",
										children: t("Leave on workspace-wide unless this flow only makes sense for one agent (e.g. a Shopify product Q&A shouldn't fire on a docs agent).")
									})
								]
							})
						]
					})
				]
			}),
			/* @__PURE__ */ jsxs(Card, {
				className: "p-4",
				children: [
					/* @__PURE__ */ jsx("h2", {
						className: "font-semibold",
						children: t("Trigger — keywords")
					}),
					/* @__PURE__ */ jsx("p", {
						className: "mb-4 text-xs text-muted-foreground",
						children: t("Comma-separated. Match is case-insensitive substring on the visitor's first message. The first matching workflow fires.")
					}),
					/* @__PURE__ */ jsx(Input, {
						id: "wf-keywords",
						value: keywordsRaw,
						onChange: (e) => {
							setKeywordsRaw(e.target.value);
							form.setData("keywords", e.target.value.split(",").map((k) => k.trim()).filter(Boolean));
						},
						placeholder: t("price, pricing, cost, plan")
					}),
					form.errors.keywords && /* @__PURE__ */ jsx("p", {
						className: "mt-1 text-xs text-destructive",
						children: form.errors.keywords
					})
				]
			}),
			/* @__PURE__ */ jsxs(Card, {
				className: "p-4",
				children: [
					/* @__PURE__ */ jsxs("div", {
						className: "mb-3 flex items-center justify-between",
						children: [/* @__PURE__ */ jsx("h2", {
							className: "font-semibold",
							children: t("Steps")
						}), /* @__PURE__ */ jsxs("div", {
							className: "flex items-center gap-1",
							children: [
								/* @__PURE__ */ jsx(Button, {
									type: "button",
									variant: "outline",
									size: "sm",
									onClick: () => addStep("message"),
									children: t("+ Message")
								}),
								/* @__PURE__ */ jsx(Button, {
									type: "button",
									variant: "outline",
									size: "sm",
									onClick: () => addStep("question"),
									children: t("+ Question")
								}),
								/* @__PURE__ */ jsx(Button, {
									type: "button",
									variant: "outline",
									size: "sm",
									onClick: () => addStep("escalate"),
									children: t("+ Escalate")
								})
							]
						})]
					}),
					form.data.steps.length === 0 ? /* @__PURE__ */ jsx("p", {
						className: "text-sm text-muted-foreground",
						children: t("Add at least one step. Steps run top-to-bottom; a question pauses the flow until the visitor replies.")
					}) : /* @__PURE__ */ jsx("div", {
						className: "grid gap-3",
						children: form.data.steps.map((step, index) => /* @__PURE__ */ jsxs("div", {
							className: "rounded-lg border p-3",
							children: [
								/* @__PURE__ */ jsxs("div", {
									className: "flex items-center justify-between",
									children: [/* @__PURE__ */ jsxs("div", {
										className: "flex items-center gap-2 text-xs font-semibold tracking-wide text-muted-foreground uppercase",
										children: [
											/* @__PURE__ */ jsx(GripVertical, { className: "size-3.5" }),
											t("Step :index ·", { index: index + 1 }),
											" ",
											/* @__PURE__ */ jsx("span", {
												className: "text-foreground",
												children: step.type
											})
										]
									}), /* @__PURE__ */ jsx(Button, {
										type: "button",
										variant: "ghost",
										size: "sm",
										onClick: () => removeStep(index),
										children: /* @__PURE__ */ jsx(Trash2, { className: "size-4 text-destructive" })
									})]
								}),
								/* @__PURE__ */ jsx("p", {
									className: "mt-1 text-xs text-muted-foreground",
									children: stepTypeHelp[step.type]
								}),
								/* @__PURE__ */ jsxs("div", {
									className: "mt-3 grid gap-2",
									children: [
										/* @__PURE__ */ jsx(Label, {
											htmlFor: `wf-step-${index}-text`,
											className: "text-xs",
											children: t("Bubble text")
										}),
										/* @__PURE__ */ jsx("textarea", {
											id: `wf-step-${index}-text`,
											value: step.text,
											onChange: (e) => updateStep(index, { text: e.target.value }),
											rows: 2,
											className: "rounded-md border bg-background p-2 text-sm"
										}),
										step.type === "question" && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Label, {
											htmlFor: `wf-step-${index}-var`,
											className: "text-xs",
											children: t("Save the answer to var_name")
										}), /* @__PURE__ */ jsx(Input, {
											id: `wf-step-${index}-var`,
											value: step.var_name ?? "",
											onChange: (e) => updateStep(index, { var_name: e.target.value }),
											placeholder: "visitor_answer"
										})] })
									]
								})
							]
						}, index))
					}),
					typeof form.errors.steps === "string" && /* @__PURE__ */ jsx("p", {
						className: "mt-2 text-xs text-destructive",
						children: form.errors.steps
					})
				]
			}),
			/* @__PURE__ */ jsxs("div", {
				className: "flex items-center justify-end gap-2",
				children: [/* @__PURE__ */ jsx(Button, {
					asChild: true,
					type: "button",
					variant: "ghost",
					children: /* @__PURE__ */ jsx(Link, {
						href: index$5(),
						children: t("Cancel")
					})
				}), /* @__PURE__ */ jsx(Button, {
					type: "submit",
					disabled: form.processing,
					children: form.processing ? t("Saving…") : submitLabel
				})]
			})
		]
	});
}
//#endregion
//#region resources/js/pages/app/workflows/create.tsx
var create_exports = /* @__PURE__ */ __exportAll({ default: () => CreateWorkflow });
function CreateWorkflow({ agents }) {
	const { t } = useT();
	return /* @__PURE__ */ jsxs(AppLayout, {
		breadcrumbs: [{
			title: t("Workflows"),
			href: "/app/workflows"
		}, {
			title: t("New"),
			href: "/app/workflows/create"
		}],
		children: [/* @__PURE__ */ jsx(Head, { title: t("New workflow") }), /* @__PURE__ */ jsxs("div", {
			className: "flex flex-1 flex-col gap-4 p-4",
			children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("h1", {
				className: "text-2xl font-semibold tracking-tight",
				children: t("New workflow")
			}), /* @__PURE__ */ jsx("p", {
				className: "mt-1 text-sm text-muted-foreground",
				children: t("Save as Draft to keep editing, or Active to start firing on matching visitor messages.")
			})] }), /* @__PURE__ */ jsx(WorkflowForm, {
				initial: {
					name: "",
					status: "draft",
					agent_id: null,
					trigger_kind: "on_keyword",
					keywords: [],
					steps: []
				},
				method: "post",
				action: "/app/workflows",
				submitLabel: t("Create workflow"),
				agents
			})]
		})]
	});
}
//#endregion
//#region resources/js/pages/app/workflows/edit.tsx
var edit_exports = /* @__PURE__ */ __exportAll({ default: () => EditWorkflow });
function EditWorkflow({ workflow, agents }) {
	const { t } = useT();
	return /* @__PURE__ */ jsxs(AppLayout, {
		breadcrumbs: [{
			title: t("Workflows"),
			href: "/app/workflows"
		}, {
			title: workflow.name,
			href: `/app/workflows/${workflow.id}/edit`
		}],
		children: [/* @__PURE__ */ jsx(Head, { title: t("Edit :name", { name: workflow.name }) }), /* @__PURE__ */ jsxs("div", {
			className: "flex flex-1 flex-col gap-4 p-4",
			children: [/* @__PURE__ */ jsxs("div", {
				className: "flex items-start justify-between gap-3",
				children: [/* @__PURE__ */ jsx("h1", {
					className: "text-2xl font-semibold tracking-tight",
					children: workflow.name
				}), /* @__PURE__ */ jsx(Button, {
					asChild: true,
					variant: "outline",
					size: "sm",
					children: /* @__PURE__ */ jsxs(Link, {
						href: `/app/workflows/${workflow.id}/canvas`,
						children: [
							/* @__PURE__ */ jsx(Workflow, { className: "me-1 size-4" }),
							" ",
							t("Open canvas")
						]
					})
				})]
			}), /* @__PURE__ */ jsx(WorkflowForm, {
				initial: {
					name: workflow.name,
					status: workflow.status,
					agent_id: workflow.agent_id,
					trigger_kind: workflow.trigger_kind,
					keywords: workflow.keywords,
					steps: workflow.steps
				},
				method: "patch",
				action: `/app/workflows/${workflow.id}`,
				submitLabel: t("Save workflow"),
				agents
			})]
		})]
	});
}
//#endregion
//#region resources/js/pages/app/workflows/index.tsx
var workflows_exports = /* @__PURE__ */ __exportAll({ default: () => WorkflowsIndex });
var WORKFLOWS_ONLY = [
	"workflows",
	"pagination",
	"filters"
];
function relativeTime$1(iso, t) {
	if (!iso) return t("No activity");
	const ms = Date.now() - new Date(iso).getTime();
	const min = Math.max(1, Math.round(ms / 6e4));
	if (min < 60) return t(":min m ago", { min });
	const hr = Math.round(min / 60);
	if (hr < 24) return t(":hr h ago", { hr });
	const day = Math.round(hr / 24);
	if (day < 7) return t(":day d ago", { day });
	return new Date(iso).toLocaleDateString();
}
function StatusBadge$1({ status }) {
	const { t } = useT();
	if (status === "active") return /* @__PURE__ */ jsxs("span", {
		className: "inline-flex items-center gap-1 rounded-md border border-emerald-200 bg-emerald-50 px-2 py-0.5 text-xs font-medium text-emerald-700 dark:border-emerald-500/30 dark:bg-emerald-500/10 dark:text-emerald-300",
		children: [/* @__PURE__ */ jsx(CheckCircle2, { className: "size-3" }), t("Active")]
	});
	if (status === "disabled") return /* @__PURE__ */ jsx("span", {
		className: "inline-flex items-center rounded-md border border-slate-200 bg-slate-50 px-2 py-0.5 text-xs font-medium text-slate-600 dark:border-slate-500/30 dark:bg-slate-500/10 dark:text-slate-300",
		children: t("Disabled")
	});
	return /* @__PURE__ */ jsx("span", {
		className: "inline-flex items-center rounded-md border border-amber-200 bg-amber-50 px-2 py-0.5 text-xs font-medium text-amber-700 dark:border-amber-500/30 dark:bg-amber-500/10 dark:text-amber-300",
		children: t("Draft")
	});
}
function TriggerSummary({ wf }) {
	const { t } = useT();
	if (wf.trigger_kind === "on_keyword") {
		const kw = wf.keywords ?? [];
		if (kw.length === 0) return /* @__PURE__ */ jsx("span", {
			className: "text-muted-foreground italic",
			children: t("No keywords yet")
		});
		const head = kw.slice(0, 2).join(", ");
		const more = kw.length > 2 ? ` +${kw.length - 2}` : "";
		return /* @__PURE__ */ jsxs("span", {
			className: "inline-flex items-center gap-1.5",
			children: [/* @__PURE__ */ jsx(Zap, { className: "size-3.5 text-muted-foreground" }), /* @__PURE__ */ jsx("span", {
				className: "truncate",
				children: head + more
			})]
		});
	}
	return /* @__PURE__ */ jsx("span", {
		className: "text-muted-foreground",
		children: wf.trigger_kind
	});
}
function WorkflowsIndex({ workflows, pagination, filters }) {
	const { t } = useT();
	const confirm = useConfirm();
	const breadcrumbs = [{
		title: t("Workflows"),
		href: index$5()
	}];
	const WORKFLOW_COLUMNS = [
		{
			id: "status",
			label: t("Status")
		},
		{
			id: "trigger",
			label: t("Trigger")
		},
		{
			id: "steps",
			label: t("Steps")
		},
		{
			id: "updated",
			label: t("Updated")
		},
		{
			id: "settings",
			label: t("Settings")
		}
	];
	const WORKFLOW_VIEW_OPTIONS = [
		{
			value: "all",
			label: t("All workflows")
		},
		{
			value: "active",
			label: t("Active")
		},
		{
			value: "draft",
			label: t("Draft")
		},
		{
			value: "disabled",
			label: t("Disabled")
		}
	];
	const WORKFLOW_SORT_OPTIONS = [
		{
			value: "updated_desc",
			label: t("Recently updated")
		},
		{
			value: "updated_asc",
			label: t("Oldest updated")
		},
		{
			value: "name_asc",
			label: t("Name A-Z")
		},
		{
			value: "name_desc",
			label: t("Name Z-A")
		}
	];
	const { hiddenColumnCount, isColumnVisible, resetColumns, setColumnVisibility, visibleColumns } = usePersistentTableColumns("table-columns:workflows", WORKFLOW_COLUMNS);
	const selection = useBulkSelection();
	const pageIds = workflows.map((w) => w.id);
	const hasRows = workflows.length > 0;
	const hasActiveFilters = filters.q.trim() !== "" || filters.view !== "all";
	const emptyTitle = hasActiveFilters ? t("No matching workflows") : t("No workflows yet");
	const visibleColumnCount = WORKFLOW_COLUMNS.filter((c) => isColumnVisible(c.id)).length;
	const onDelete = async (wf) => {
		if (!await confirm({
			title: t("Delete workflow?"),
			message: t("Delete \":name\"? This cannot be undone.", { name: wf.name }),
			confirmLabel: t("Delete"),
			danger: true
		})) return;
		router.delete(`/app/workflows/${wf.id}`, { preserveScroll: true });
	};
	const workflowLimit = usePlanLimit("workflow");
	const canCreate = workflowLimit === null || workflowLimit.limit === null || workflowLimit.allowed && (workflowLimit.remaining ?? 1) > 0;
	return /* @__PURE__ */ jsxs(AppLayout, {
		breadcrumbs,
		children: [
			/* @__PURE__ */ jsx(Head, { title: t("Workflows") }),
			/* @__PURE__ */ jsxs("div", {
				className: "flex min-h-0 flex-1 flex-col bg-card",
				children: [
					/* @__PURE__ */ jsx("div", {
						className: "px-3 pt-3",
						children: /* @__PURE__ */ jsx(PlanLimitBanner, { resource: "workflow" })
					}),
					/* @__PURE__ */ jsxs("div", {
						className: "flex min-h-10 flex-wrap items-center gap-2 border-b px-3 py-1.5",
						children: [
							/* @__PURE__ */ jsx(TableScopeMenu, {
								options: WORKFLOW_VIEW_OPTIONS,
								value: filters.view,
								paramName: "view",
								only: WORKFLOWS_ONLY
							}),
							/* @__PURE__ */ jsx(TableSortMenu, {
								options: WORKFLOW_SORT_OPTIONS,
								value: filters.sort,
								paramName: "sort",
								only: WORKFLOWS_ONLY
							}),
							/* @__PURE__ */ jsx(TableSearch, {
								placeholder: t("Search workflows..."),
								initialValue: filters.q,
								only: WORKFLOWS_ONLY
							}),
							/* @__PURE__ */ jsxs("div", {
								className: "ms-auto flex items-center gap-2",
								children: [/* @__PURE__ */ jsx(TableColumnMenu, {
									columns: WORKFLOW_COLUMNS,
									visibleColumns,
									hiddenColumnCount,
									onResetColumns: resetColumns,
									onSetColumnVisibility: setColumnVisibility
								}), canCreate ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Button, {
									asChild: true,
									size: "sm",
									variant: "outline",
									children: /* @__PURE__ */ jsxs(Link, {
										href: create({ query: { canvas: 1 } }),
										children: [/* @__PURE__ */ jsx(Workflow, { className: "size-3.5" }), t("New in canvas")]
									})
								}), /* @__PURE__ */ jsx(Button, {
									asChild: true,
									size: "sm",
									children: /* @__PURE__ */ jsxs(Link, {
										href: create(),
										prefetch: true,
										children: [/* @__PURE__ */ jsx(Plus, { className: "size-3.5" }), t("New workflow")]
									})
								})] }) : /* @__PURE__ */ jsxs(Button, {
									size: "sm",
									disabled: true,
									title: t("Plan workflow limit reached"),
									children: [/* @__PURE__ */ jsx(Plus, { className: "size-3.5" }), t("New workflow")]
								})]
							})
						]
					}),
					/* @__PURE__ */ jsx("div", {
						className: "min-h-0 flex-1 overflow-auto",
						children: /* @__PURE__ */ jsxs("table", {
							className: "w-full min-w-[820px] border-separate border-spacing-0 text-start text-sm",
							children: [/* @__PURE__ */ jsx("thead", {
								className: "sticky top-0 z-10 bg-card text-xs font-medium text-muted-foreground",
								children: /* @__PURE__ */ jsxs("tr", { children: [
									/* @__PURE__ */ jsx("th", {
										className: "w-9 border-b px-3 py-2",
										children: /* @__PURE__ */ jsx("input", {
											type: "checkbox",
											"aria-label": t("Select all workflows"),
											checked: selection.allOnPageSelected(pageIds),
											ref: (el) => {
												if (el) el.indeterminate = !selection.allOnPageSelected(pageIds) && selection.someOnPageSelected(pageIds);
											},
											onChange: () => selection.togglePage(pageIds),
											className: "size-3.5 cursor-pointer rounded border-input"
										})
									}),
									/* @__PURE__ */ jsx("th", {
										className: "border-e border-b px-3 py-2",
										children: t("Workflow")
									}),
									isColumnVisible("status") && /* @__PURE__ */ jsx("th", {
										className: "border-e border-b px-3 py-2",
										children: t("Status")
									}),
									isColumnVisible("trigger") && /* @__PURE__ */ jsx("th", {
										className: "border-e border-b px-3 py-2",
										children: t("Trigger")
									}),
									isColumnVisible("steps") && /* @__PURE__ */ jsx("th", {
										className: "border-e border-b px-3 py-2",
										children: t("Steps")
									}),
									isColumnVisible("updated") && /* @__PURE__ */ jsx("th", {
										className: "border-e border-b px-3 py-2",
										children: t("Updated")
									}),
									isColumnVisible("settings") && /* @__PURE__ */ jsx("th", {
										className: "border-b px-3 py-2 text-end",
										children: t("Actions")
									})
								] })
							}), /* @__PURE__ */ jsx("tbody", { children: hasRows ? workflows.map((wf) => /* @__PURE__ */ jsxs("tr", {
								className: "group hover:bg-muted/35",
								children: [
									/* @__PURE__ */ jsx("td", {
										className: "border-b px-3 py-2",
										children: /* @__PURE__ */ jsx("input", {
											type: "checkbox",
											"aria-label": t("Select :name", { name: wf.name }),
											checked: selection.isSelected(wf.id),
											onChange: (e) => {
												const ne = e.nativeEvent;
												selection.toggle(wf.id, {
													shiftKey: ne?.shiftKey ?? false,
													pageIds
												});
											},
											onClick: (e) => e.stopPropagation(),
											className: "size-3.5 cursor-pointer rounded border-input"
										})
									}),
									/* @__PURE__ */ jsx("td", {
										className: "border-e border-b px-3 py-2",
										children: /* @__PURE__ */ jsxs(Link, {
											href: `/app/workflows/${wf.id}/canvas`,
											className: "flex min-w-0 items-center gap-2 text-foreground",
											children: [/* @__PURE__ */ jsx("span", {
												className: "flex size-5 shrink-0 items-center justify-center rounded bg-muted text-muted-foreground",
												children: /* @__PURE__ */ jsx(Workflow, { className: "size-3.5" })
											}), /* @__PURE__ */ jsx("span", {
												className: "truncate font-medium",
												children: wf.name
											})]
										})
									}),
									isColumnVisible("status") && /* @__PURE__ */ jsx("td", {
										className: "border-e border-b px-3 py-2",
										children: /* @__PURE__ */ jsx(StatusBadge$1, { status: wf.status })
									}),
									isColumnVisible("trigger") && /* @__PURE__ */ jsx("td", {
										className: "border-e border-b px-3 py-2 text-muted-foreground",
										children: /* @__PURE__ */ jsx(TriggerSummary, { wf })
									}),
									isColumnVisible("steps") && /* @__PURE__ */ jsx("td", {
										className: "border-e border-b px-3 py-2 text-muted-foreground tabular-nums",
										children: wf.steps.length === 1 ? t(":count step", { count: wf.steps.length }) : t(":count steps", { count: wf.steps.length })
									}),
									isColumnVisible("updated") && /* @__PURE__ */ jsx("td", {
										className: "border-e border-b px-3 py-2 text-muted-foreground",
										children: relativeTime$1(wf.updated_at, t)
									}),
									isColumnVisible("settings") && /* @__PURE__ */ jsx("td", {
										className: "border-b px-3 py-2",
										children: /* @__PURE__ */ jsxs("div", {
											className: "flex items-center justify-end gap-1",
											children: [/* @__PURE__ */ jsx(Link, {
												href: `/app/workflows/${wf.id}/canvas`,
												className: "inline-flex size-7 items-center justify-center rounded-md text-muted-foreground transition hover:bg-muted hover:text-foreground",
												"aria-label": t("Edit :name", { name: wf.name }),
												children: /* @__PURE__ */ jsx(Settings, { className: "size-3.5" })
											}), /* @__PURE__ */ jsx("button", {
												type: "button",
												onClick: () => onDelete(wf),
												"aria-label": t("Delete :name", { name: wf.name }),
												className: "inline-flex size-7 items-center justify-center rounded-md text-muted-foreground transition hover:bg-destructive/10 hover:text-destructive",
												children: /* @__PURE__ */ jsx(Trash2, { className: "size-3.5" })
											})]
										})
									})
								]
							}, wf.id)) : /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx("td", {
								colSpan: 2 + visibleColumnCount,
								className: "h-72 border-b px-4 text-center",
								children: /* @__PURE__ */ jsxs("div", {
									className: "mx-auto flex max-w-sm flex-col items-center gap-2 text-muted-foreground",
									children: [
										/* @__PURE__ */ jsx(Workflow, { className: "size-8" }),
										/* @__PURE__ */ jsx("p", {
											className: "text-sm font-medium text-foreground",
											children: emptyTitle
										}),
										/* @__PURE__ */ jsx("p", {
											className: "text-xs",
											children: t("Workflows script how the agent reacts to common questions, and let you hand a visitor off to a human on specific keywords.")
										}),
										!hasActiveFilters && (canCreate ? /* @__PURE__ */ jsx(Button, {
											asChild: true,
											size: "sm",
											className: "mt-2",
											children: /* @__PURE__ */ jsxs(Link, {
												href: create(),
												children: [/* @__PURE__ */ jsx(Plus, { className: "size-3.5" }), t("New workflow")]
											})
										}) : /* @__PURE__ */ jsxs(Button, {
											size: "sm",
											disabled: true,
											className: "mt-2",
											title: t("Plan workflow limit reached"),
											children: [/* @__PURE__ */ jsx(Plus, { className: "size-3.5" }), t("New workflow")]
										}))
									]
								})
							}) }) })]
						})
					}),
					/* @__PURE__ */ jsx(TablePagination, {
						pagination,
						only: WORKFLOWS_ONLY
					})
				]
			}),
			/* @__PURE__ */ jsx(BulkActionsBar, {
				count: selection.size,
				onClear: selection.clear,
				noun: t("workflow"),
				children: /* @__PURE__ */ jsx(BulkDeleteButton, {
					confirmMessage: t("Delete :count selected workflow(s)? This cannot be undone.", { count: selection.size }),
					onConfirm: () => {
						router.post(bulkDestroy().url, { ids: Array.from(selection.selected) }, {
							preserveScroll: true,
							onSuccess: () => selection.clear()
						});
					}
				})
			})
		]
	});
}
//#endregion
//#region resources/js/layouts/auth/auth-simple-layout.tsx
function AuthSimpleLayout({ children, name, title, description }) {
	const branding = useBranding();
	const { t } = useT();
	const brandName = branding.site_title || name || "Pitchbar";
	const headerLogoUrl = branding.header_logo_url;
	const highlights = [{
		icon: MessageSquare,
		eyebrow: t("Story"),
		title: t("Stay connected"),
		description: t("Pick up the same thoughtful product story visitors saw on the landing page."),
		note: t("Same tone from first click to sign in"),
		chips: [t("Landing-aligned"), t("Lower friction")],
		badge: t("Journey"),
		surfaceClass: "bg-[linear-gradient(160deg,#fbf8ef_0%,#f3eee2_100%)]",
		iconClass: "border-[#e3dccb] bg-[#f6f1e7] text-[#214a36]",
		badgeClass: "border-[#ddd4c4] bg-white/75 text-[#6f7469]"
	}, {
		icon: ShieldCheck,
		eyebrow: t("Fortify"),
		title: t("Secure access"),
		description: t("Passwords, verification, resets, and 2FA keep the full Fortify flow intact."),
		note: t("Everything stays protected behind the same trusted flow"),
		chips: [t("2FA ready"), t("Reset flow")],
		badge: t("Intact"),
		surfaceClass: "bg-[linear-gradient(160deg,#eef2e8_0%,#f8f5ed_100%)]",
		iconClass: "border-[#d7e0d0] bg-[#f3f7ee] text-[#214a36]",
		badgeClass: "border-[#d7dfd0] bg-white/70 text-[#5e6659]"
	}];
	return /* @__PURE__ */ jsxs("div", {
		className: "min-h-svh bg-[#f7f2e8] text-[#252a24] lg:grid lg:grid-cols-[1.04fr_0.96fr]",
		children: [/* @__PURE__ */ jsxs("aside", {
			className: "relative hidden overflow-hidden border-e border-[#e6decf] lg:flex",
			children: [
				/* @__PURE__ */ jsx("div", { className: "marketing-grid-background absolute inset-0 opacity-25" }),
				/* @__PURE__ */ jsx("div", { className: "absolute start-[18%] top-[-4rem] size-72 rounded-full bg-[#dde6d1]/80 blur-3xl" }),
				/* @__PURE__ */ jsx("div", { className: "absolute end-[10%] bottom-[-5rem] size-80 rounded-full bg-[#f0eadf]/95 blur-3xl" }),
				/* @__PURE__ */ jsxs("div", {
					className: "relative mx-auto flex min-h-svh w-full max-w-[620px] flex-col px-10 py-10 xl:px-14 xl:py-12",
					children: [/* @__PURE__ */ jsx(Link, {
						href: home(),
						className: "flex items-center gap-2.5",
						children: /* @__PURE__ */ jsx(BrandLockup, {
							siteTitle: brandName,
							logoUrl: headerLogoUrl,
							mode: branding.header_brand_display,
							className: "gap-2.5",
							logoClassName: "h-10 max-w-[220px]",
							textClassName: "text-2xl font-semibold tracking-normal text-[#263129]",
							fallbackLogo: /* @__PURE__ */ jsx(AppLogoIcon, { className: "size-8 text-[#173f2c]" })
						})
					}), /* @__PURE__ */ jsxs("div", {
						className: "mt-16 flex flex-1 flex-col justify-between",
						children: [/* @__PURE__ */ jsxs("div", { children: [
							/* @__PURE__ */ jsxs("span", {
								className: "inline-flex items-center gap-2 rounded-md border border-[#e2ddcf] bg-[#eff1e8] px-3 py-1 text-[10px] font-bold text-[#7d826f] uppercase",
								children: [/* @__PURE__ */ jsx(LockKeyhole, { className: "size-3.5" }), t("Secure workspace")]
							}),
							/* @__PURE__ */ jsx("h1", {
								className: "marketing-display mt-6 max-w-[500px] text-[4rem] leading-[0.92] text-[#252621]",
								children: t("Welcome back to the conversations.")
							}),
							/* @__PURE__ */ jsx("p", {
								className: "mt-5 max-w-[500px] text-base leading-7 font-medium text-[#666b62]",
								children: t(description || "Access your workspace with the same calm, conversion-focused experience as the public site.")
							}),
							/* @__PURE__ */ jsx("div", {
								className: "mt-10 grid max-w-[560px] gap-4 xl:grid-cols-2",
								children: highlights.map((item, index) => {
									const Icon = item.icon;
									return /* @__PURE__ */ jsxs("div", {
										className: cn("group relative overflow-hidden rounded-[28px] border border-[#d9d2c5] p-5 shadow-[0_18px_48px_rgba(48,43,34,0.055)] transition duration-200 xl:last:translate-y-6", item.surfaceClass, index === 0 && "xl:rotate-[-1deg]", index === 1 && "xl:rotate-[1deg]"),
										children: [
											/* @__PURE__ */ jsx("div", { className: "absolute inset-x-6 top-0 h-px bg-[linear-gradient(90deg,transparent,#b7c5ad,transparent)]" }),
											/* @__PURE__ */ jsxs("div", {
												className: "flex items-start justify-between gap-4",
												children: [/* @__PURE__ */ jsxs("div", {
													className: "min-w-0",
													children: [/* @__PURE__ */ jsx("span", {
														className: "inline-flex rounded-full border border-[#ddd6c8] bg-white/65 px-3 py-1 text-[10px] font-bold tracking-[0.18em] text-[#7c816f] uppercase",
														children: item.eyebrow
													}), /* @__PURE__ */ jsxs("div", {
														className: "mt-4 flex items-start gap-3.5",
														children: [/* @__PURE__ */ jsx("span", {
															className: cn("mt-0.5 flex size-11 shrink-0 items-center justify-center rounded-2xl border", item.iconClass),
															children: /* @__PURE__ */ jsx(Icon, { className: "size-4.5" })
														}), /* @__PURE__ */ jsx("h2", {
															className: "text-[1.75rem] leading-[1.1] font-semibold text-[#2b322c]",
															children: item.title
														})]
													})]
												}), /* @__PURE__ */ jsx("span", {
													className: cn("inline-flex rounded-full border px-3 py-1 text-[10px] font-bold tracking-[0.18em] uppercase", item.badgeClass),
													children: item.badge
												})]
											}),
											/* @__PURE__ */ jsx("p", {
												className: "mt-5 max-w-[320px] text-[14px] leading-6 font-medium text-[#676d64]",
												children: item.description
											}),
											/* @__PURE__ */ jsx("div", {
												className: "mt-6 flex flex-wrap gap-2",
												children: item.chips.map((chip) => /* @__PURE__ */ jsx("span", {
													className: "rounded-full border border-[#ddd5c6] bg-white/70 px-3 py-1 text-[11px] font-semibold text-[#5f665d]",
													children: chip
												}, chip))
											}),
											/* @__PURE__ */ jsxs("div", {
												className: "mt-6 flex items-center gap-2 text-[12px] font-semibold text-[#315f42]",
												children: [/* @__PURE__ */ jsx("span", { className: "size-2 rounded-full bg-current" }), item.note]
											})
										]
									}, item.title);
								})
							})
						] }), /* @__PURE__ */ jsxs(Link, {
							href: home(),
							className: "mt-10 inline-flex items-center gap-2 text-sm font-semibold text-[#315f42] transition hover:text-[#173f2c]",
							children: [/* @__PURE__ */ jsx(DirArrow, {
								direction: "back",
								className: "size-4"
							}), t("Back to site")]
						})]
					})]
				})
			]
		}), /* @__PURE__ */ jsxs("main", {
			className: "flex min-h-svh flex-col",
			children: [/* @__PURE__ */ jsxs("header", {
				className: "flex items-center justify-between px-6 py-6 lg:hidden",
				children: [/* @__PURE__ */ jsx(Link, {
					href: home(),
					className: "flex items-center gap-2.5",
					children: /* @__PURE__ */ jsx(BrandLockup, {
						siteTitle: brandName,
						logoUrl: headerLogoUrl,
						mode: branding.header_brand_display,
						className: "gap-2.5",
						logoClassName: "h-9 max-w-[180px]",
						textClassName: "text-xl font-semibold tracking-normal text-[#263129]",
						fallbackLogo: /* @__PURE__ */ jsx(AppLogoIcon, { className: "size-7 text-[#173f2c]" })
					})
				}), /* @__PURE__ */ jsxs(Link, {
					href: home(),
					className: "inline-flex items-center gap-2 text-sm font-semibold text-[#315f42] transition hover:text-[#173f2c]",
					children: [/* @__PURE__ */ jsx(DirArrow, {
						direction: "back",
						className: "size-4"
					}), t("Site")]
				})]
			}), /* @__PURE__ */ jsx("section", {
				className: "flex flex-1 items-center justify-center px-6 pb-10 lg:px-10 lg:py-10",
				children: /* @__PURE__ */ jsx("div", {
					className: "w-full max-w-[520px]",
					children: /* @__PURE__ */ jsxs("div", {
						className: "overflow-hidden rounded-[28px] border border-[#ddd5c7] bg-[#fbf8ef] shadow-[0_24px_80px_rgba(29,37,28,0.08)]",
						children: [/* @__PURE__ */ jsxs("div", {
							className: "border-b border-[#e7dfd2] bg-[linear-gradient(180deg,#f8f4eb_0%,#fbf8ef_100%)] px-7 py-8 sm:px-8",
							children: [
								/* @__PURE__ */ jsxs("span", {
									className: "inline-flex items-center gap-2 rounded-md border border-[#e2ddcf] bg-[#eff1e8] px-3 py-1 text-[10px] font-bold text-[#7d826f] uppercase",
									children: [/* @__PURE__ */ jsx(Sparkles, { className: "size-3.5" }), t("Account access")]
								}),
								/* @__PURE__ */ jsx("h1", {
									className: "marketing-display mt-5 text-4xl leading-none text-[#252621] sm:text-[2.65rem]",
									children: t(title ?? "")
								}),
								description && /* @__PURE__ */ jsx("p", {
									className: "mt-4 max-w-[430px] text-sm leading-6 font-medium text-[#686d64]",
									children: t(description)
								})
							]
						}), /* @__PURE__ */ jsx("div", {
							className: "px-7 py-8 sm:px-8",
							children
						})]
					})
				})
			})]
		})]
	});
}
//#endregion
//#region resources/js/pages/marketing-themes/aurora/auth-shell.tsx
var auth_shell_exports$1 = /* @__PURE__ */ __exportAll({ default: () => AuroraAuthShell });
/**
* Aurora-themed auth shell. Used by every auth page (login, register,
* forgot/reset password, 2FA, email verification, invitation accept,
* password confirmation) when `marketingTheme === 'aurora'` so the
* brand identity carries from the marketing site into the sign-in
* surface. Editorial paper/ink palette with the lime signal accent
* Aurora uses on the marketing site.
*/
function AuroraAuthShell({ title, description, children }) {
	const branding = useBranding();
	const { t } = useT();
	const brandName = branding.site_title || "Pitchbar";
	const eyebrow = branding.auth_aside_eyebrow ?? t("Secure workspace");
	const heading = branding.auth_aside_heading ?? null;
	const lede = branding.auth_aside_lede ?? null;
	const bullets = branding.auth_aside_bullets && branding.auth_aside_bullets.length > 0 ? branding.auth_aside_bullets : [
		t("2FA, passkeys, and recovery codes"),
		t("SSO-ready · SOC 2 controls in flight"),
		t("One workspace, every channel")
	];
	return /* @__PURE__ */ jsxs("div", {
		className: "aurora-root aurora-auth-shell theme-light font-grotesk",
		children: [
			/* @__PURE__ */ jsx("link", {
				rel: "preconnect",
				href: "https://fonts.googleapis.com"
			}),
			/* @__PURE__ */ jsx("link", {
				rel: "preconnect",
				href: "https://fonts.gstatic.com",
				crossOrigin: ""
			}),
			/* @__PURE__ */ jsx("link", {
				rel: "stylesheet",
				href: "https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;700&family=JetBrains+Mono:wght@400;500&display=swap"
			}),
			/* @__PURE__ */ jsx("aside", {
				className: "aurora-auth-aside",
				children: /* @__PURE__ */ jsxs("div", {
					className: "aurora-auth-aside-inner",
					children: [
						/* @__PURE__ */ jsxs(Link, {
							href: home().url,
							className: "aurora-auth-logo",
							children: [/* @__PURE__ */ jsx("span", { className: "brand-mark" }), /* @__PURE__ */ jsx("span", { children: brandName.toUpperCase() })]
						}),
						/* @__PURE__ */ jsxs("div", {
							className: "aurora-auth-hero",
							children: [
								/* @__PURE__ */ jsxs("span", {
									className: "eyebrow",
									children: [
										/* @__PURE__ */ jsx("span", { className: "dot" }),
										/* @__PURE__ */ jsx("span", {
											className: "idx",
											children: "A/01"
										}),
										eyebrow
									]
								}),
								/* @__PURE__ */ jsx("h1", {
									className: "aurora-auth-display",
									children: heading ?? t("Sign in to the signal.")
								}),
								/* @__PURE__ */ jsx("p", {
									className: "aurora-auth-lede",
									children: lede ?? t("Your admin can customise this copy under Settings → Branding so the auth screen reads in your brand voice.")
								}),
								/* @__PURE__ */ jsx("ul", {
									className: "aurora-auth-bullets",
									children: bullets.map((b, i) => /* @__PURE__ */ jsxs("li", { children: [/* @__PURE__ */ jsx("span", { className: "pip" }), /* @__PURE__ */ jsx("span", { children: b })] }, i))
								})
							]
						}),
						/* @__PURE__ */ jsxs("div", {
							className: "aurora-auth-foot",
							children: [/* @__PURE__ */ jsxs(Link, {
								href: home().url,
								className: "aurora-auth-back",
								children: ["← ", t("Back to site")]
							}), /* @__PURE__ */ jsx("span", {
								className: "aurora-auth-foot-meta",
								children: t("ALL SYSTEMS LIVE")
							})]
						})
					]
				})
			}),
			/* @__PURE__ */ jsxs("main", {
				className: "aurora-auth-main",
				children: [/* @__PURE__ */ jsxs("header", {
					className: "aurora-auth-mobile-bar",
					children: [/* @__PURE__ */ jsxs(Link, {
						href: home().url,
						className: "aurora-auth-logo",
						children: [/* @__PURE__ */ jsx("span", { className: "brand-mark" }), /* @__PURE__ */ jsx("span", { children: brandName.toUpperCase() })]
					}), /* @__PURE__ */ jsxs(Link, {
						href: home().url,
						className: "aurora-auth-back",
						children: ["← ", t("Site")]
					})]
				}), /* @__PURE__ */ jsx("section", {
					className: "aurora-auth-form-wrap",
					children: /* @__PURE__ */ jsxs("div", {
						className: "aurora-auth-form-card",
						children: [/* @__PURE__ */ jsxs("div", {
							className: "aurora-auth-form-head",
							children: [
								/* @__PURE__ */ jsxs("span", {
									className: "eyebrow",
									children: [/* @__PURE__ */ jsx("span", { className: "dot" }), t("Account access")]
								}),
								/* @__PURE__ */ jsx("h2", {
									className: "aurora-auth-title",
									children: t(title)
								}),
								description ? /* @__PURE__ */ jsx("p", {
									className: "aurora-auth-desc",
									children: t(description)
								}) : null
							]
						}), /* @__PURE__ */ jsx("div", {
							className: "aurora-auth-form-body",
							children
						})]
					})
				})]
			})
		]
	});
}
//#endregion
//#region resources/js/pages/marketing-themes/prism/auth-shell.tsx
var auth_shell_exports = /* @__PURE__ */ __exportAll({ default: () => PrismAuthShell });
/**
* Prism-themed auth shell. Used by every auth page (login, register,
* forgot/reset password, 2FA, email verification, invitation accept,
* password confirmation) when `marketingTheme === 'prism'` so the
* brand identity carries from the marketing site into the sign-in
* surface. Mirrors the Harvest AuthSimpleLayout's two-panel layout
* (brand on the left, form on the right) but uses the Prism gradient
* + Inter Tight body + Instrument Serif italic accents instead of
* the olive/cream Harvest palette.
*/
function PrismAuthShell({ title, description, children }) {
	const branding = useBranding();
	const { t } = useT();
	const brandName = branding.site_title || "Pitchbar";
	const eyebrow = branding.auth_aside_eyebrow ?? t("Secure workspace");
	const heading = branding.auth_aside_heading ?? null;
	const lede = branding.auth_aside_lede ?? null;
	const bullets = branding.auth_aside_bullets && branding.auth_aside_bullets.length > 0 ? branding.auth_aside_bullets : [
		t("2FA, passkeys, and recovery codes"),
		t("SSO-ready · SOC 2 controls in flight"),
		t("One workspace, every channel")
	];
	return /* @__PURE__ */ jsxs("div", {
		className: "prism-root prism-auth-shell",
		children: [
			/* @__PURE__ */ jsx("link", {
				rel: "preconnect",
				href: "https://fonts.googleapis.com"
			}),
			/* @__PURE__ */ jsx("link", {
				rel: "preconnect",
				href: "https://fonts.gstatic.com",
				crossOrigin: ""
			}),
			/* @__PURE__ */ jsx("link", {
				rel: "stylesheet",
				href: "https://fonts.googleapis.com/css2?family=Inter+Tight:wght@400;500;600;700&family=Instrument+Serif:ital@0;1&display=swap"
			}),
			/* @__PURE__ */ jsx("aside", {
				className: "prism-auth-aside",
				children: /* @__PURE__ */ jsxs("div", {
					className: "prism-auth-aside-inner",
					children: [
						/* @__PURE__ */ jsxs(Link, {
							href: home().url,
							className: "logo",
							children: [/* @__PURE__ */ jsx("span", { className: "logo-mark" }), /* @__PURE__ */ jsx("span", { children: brandName })]
						}),
						/* @__PURE__ */ jsxs("div", {
							className: "prism-auth-hero",
							children: [
								/* @__PURE__ */ jsxs("span", {
									className: "eyebrow",
									style: { color: "rgba(255,255,255,0.85)" },
									children: [/* @__PURE__ */ jsx("span", { style: { background: "rgba(255,255,255,0.85)" } }), eyebrow]
								}),
								/* @__PURE__ */ jsx("h1", {
									className: "prism-auth-display",
									children: heading ?? t("Welcome back to the conversations.")
								}),
								/* @__PURE__ */ jsx("p", {
									className: "prism-auth-lede",
									children: lede ?? t("Your admin can customise this copy under Settings → Branding so the auth screen reads in your brand voice.")
								}),
								/* @__PURE__ */ jsx("ul", {
									className: "prism-auth-bullets",
									children: bullets.map((b, i) => /* @__PURE__ */ jsxs("li", { children: [/* @__PURE__ */ jsx("span", {
										className: "ic",
										children: "✓"
									}), /* @__PURE__ */ jsx("span", { children: b })] }, i))
								})
							]
						}),
						/* @__PURE__ */ jsxs(Link, {
							href: home().url,
							className: "prism-auth-back",
							children: ["← ", t("Back to site")]
						})
					]
				})
			}),
			/* @__PURE__ */ jsxs("main", {
				className: "prism-auth-main",
				children: [/* @__PURE__ */ jsxs("header", {
					className: "prism-auth-mobile-bar",
					children: [/* @__PURE__ */ jsxs(Link, {
						href: home().url,
						className: "logo",
						children: [/* @__PURE__ */ jsx("span", { className: "logo-mark" }), /* @__PURE__ */ jsx("span", { children: brandName })]
					}), /* @__PURE__ */ jsxs(Link, {
						href: home().url,
						className: "prism-auth-back",
						children: ["← ", t("Site")]
					})]
				}), /* @__PURE__ */ jsx("section", {
					className: "prism-auth-form-wrap",
					children: /* @__PURE__ */ jsxs("div", {
						className: "prism-auth-form-card",
						children: [/* @__PURE__ */ jsxs("div", {
							className: "prism-auth-form-head",
							children: [
								/* @__PURE__ */ jsx("span", {
									className: "eyebrow",
									children: t("Account access")
								}),
								/* @__PURE__ */ jsx("h2", {
									className: "prism-auth-title",
									children: t(title)
								}),
								description ? /* @__PURE__ */ jsx("p", {
									className: "prism-auth-desc",
									children: t(description)
								}) : null
							]
						}), /* @__PURE__ */ jsx("div", {
							className: "prism-auth-form-body",
							children
						})]
					})
				})]
			})
		]
	});
}
//#endregion
//#region resources/js/layouts/auth-layout.tsx
/**
* Auth layout dispatcher. Picks the per-theme auth shell so the
* login / register / reset flows match the active marketing theme.
* Falls back to the Harvest two-panel layout when the active theme
* doesn't ship its own shell. Client report 2026-05-23: "when we
* change theme, all the frontend pages should follow the theme
* style — login page remains the default theme".
*/
function AuthLayout({ title = "", description = "", children }) {
	const { marketingTheme } = usePage().props;
	if (marketingTheme === "prism") return /* @__PURE__ */ jsx(PrismAuthShell, {
		title,
		description,
		children
	});
	if (marketingTheme === "aurora") return /* @__PURE__ */ jsx(AuroraAuthShell, {
		title,
		description,
		children
	});
	return /* @__PURE__ */ jsx(AuthSimpleLayout, {
		title,
		description,
		children
	});
}
//#endregion
//#region resources/js/pages/auth/styles.ts
var authNoticeClass = "rounded-lg border border-[#d5ddca] bg-[#eef2e8] px-4 py-3 text-sm font-medium text-[#315f42]";
var authLabelClass = "text-[11px] font-bold uppercase tracking-[0.18em] text-[#7d826f]";
var authInputClass = "h-12 rounded-lg border-[#d9d2c3] bg-white px-4 text-sm font-medium text-[#394039] shadow-[0_10px_30px_rgba(30,35,28,0.05)] placeholder:text-[#a1a49a] focus-visible:border-[#adc2a0] focus-visible:ring-[#adc2a0]/30 read-only:bg-[#f4f0e8]";
var authPrimaryButtonClass = "h-12 rounded-md bg-[#173f2c] px-5 text-sm font-bold text-[#f7f4ec] shadow-[0_12px_24px_rgba(23,63,44,0.14)] hover:bg-[#123322] hover:text-[#f7f4ec]";
var authLinkClass = "font-semibold text-[#315f42] underline decoration-[#c5d0b9] underline-offset-4 transition-colors duration-200 hover:text-[#173f2c] hover:decoration-[#173f2c]";
var authHelperTextClass = "text-sm leading-6 font-medium text-[#6a7164]";
var authCheckboxClass = "size-4 rounded-[4px] border-[#cfd8c2] bg-white data-[state=checked]:border-[#173f2c] data-[state=checked]:bg-[#173f2c]";
var authOtpSlotClass = "h-12 w-12 rounded-lg border border-[#d9d2c3] bg-white text-base font-semibold text-[#253129] shadow-[0_10px_24px_rgba(30,35,28,0.05)] first:rounded-lg first:border-s last:rounded-lg";
//#endregion
//#region resources/js/pages/auth/accept-invitation.tsx
var accept_invitation_exports = /* @__PURE__ */ __exportAll({ default: () => AcceptInvitation });
function AcceptInvitation() {
	const { t } = useT();
	const { invitation } = usePage().props;
	const [submitting, setSubmitting] = useState(false);
	const accept = () => {
		setSubmitting(true);
		router.post(`/invitations/${invitation.token}/accept`, {}, { onFinish: () => setSubmitting(false) });
	};
	return /* @__PURE__ */ jsxs(AuthLayout, {
		title: t("Accept invitation"),
		description: t("Join :workspace", { workspace: invitation.workspace.name }),
		children: [/* @__PURE__ */ jsx(Head, { title: t("Accept invitation") }), /* @__PURE__ */ jsxs(Card, {
			className: "space-y-4 rounded-[22px] border-[#e3dccf] bg-[#f7f2ea] p-6 shadow-none dark:border-zinc-700 dark:bg-zinc-900",
			children: [
				/* @__PURE__ */ jsxs("div", { children: [
					/* @__PURE__ */ jsx("p", {
						className: "text-sm font-medium text-[#6a7169] dark:text-zinc-400",
						children: t("You've been invited to join")
					}),
					/* @__PURE__ */ jsx("p", {
						className: "mt-1 text-lg font-semibold text-[#253129] dark:text-zinc-100",
						children: invitation.workspace.name
					}),
					/* @__PURE__ */ jsxs("p", {
						className: "mt-1 text-sm font-medium text-[#6a7169] dark:text-zinc-400",
						children: [
							t("as"),
							" ",
							/* @__PURE__ */ jsx("strong", { children: invitation.role }),
							" ·",
							" ",
							t("for"),
							" ",
							/* @__PURE__ */ jsx("strong", { children: invitation.email })
						]
					})
				] }),
				/* @__PURE__ */ jsxs("div", {
					className: `${authNoticeClass} text-xs`,
					children: [
						t("You must be signed in as"),
						" ",
						/* @__PURE__ */ jsx("strong", { children: invitation.email }),
						" ",
						t("to accept this invitation.")
					]
				}),
				/* @__PURE__ */ jsx(Button, {
					onClick: accept,
					disabled: submitting,
					className: `${authPrimaryButtonClass} w-full`,
					children: t("Accept invitation")
				}),
				/* @__PURE__ */ jsx("p", {
					className: `text-xs ${authHelperTextClass}`,
					children: t("If you're not signed in yet, log in or register first with this email.")
				})
			]
		})]
	});
}
//#endregion
//#region resources/js/components/password-input.tsx
function PasswordInput({ className, ref, ...props }) {
	const { t } = useT();
	const [showPassword, setShowPassword] = useState(false);
	return /* @__PURE__ */ jsxs("div", {
		className: "relative",
		children: [/* @__PURE__ */ jsx(Input, {
			type: showPassword ? "text" : "password",
			className: cn("pe-10", className),
			ref,
			...props
		}), /* @__PURE__ */ jsx("button", {
			type: "button",
			onClick: () => setShowPassword((prev) => !prev),
			className: "absolute inset-y-0 end-0 flex items-center rounded-e-md px-3 text-muted-foreground transition hover:bg-accent hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring/40 focus-visible:outline-none",
			"aria-label": showPassword ? t("Hide password") : t("Show password"),
			tabIndex: -1,
			children: showPassword ? /* @__PURE__ */ jsx(EyeOff, { className: "size-4" }) : /* @__PURE__ */ jsx(Eye, { className: "size-4" })
		})]
	});
}
//#endregion
//#region resources/js/components/ui/spinner.tsx
function Spinner({ className, ...props }) {
	return /* @__PURE__ */ jsx(Loader2Icon, {
		role: "status",
		"aria-label": "Loading",
		className: cn("size-4 animate-spin", className),
		...props
	});
}
//#endregion
//#region resources/js/routes/password/confirm/index.ts
/**
* @see \Laravel\Fortify\Http\Controllers\ConfirmablePasswordController::store
* @see vendor/laravel/fortify/src/Http/Controllers/ConfirmablePasswordController.php:51
* @route '/user/confirm-password'
*/
var store$5 = (options) => ({
	url: store$5.url(options),
	method: "post"
});
store$5.definition = {
	methods: ["post"],
	url: "/user/confirm-password"
};
/**
* @see \Laravel\Fortify\Http\Controllers\ConfirmablePasswordController::store
* @see vendor/laravel/fortify/src/Http/Controllers/ConfirmablePasswordController.php:51
* @route '/user/confirm-password'
*/
store$5.url = (options) => {
	return store$5.definition.url + queryParams(options);
};
/**
* @see \Laravel\Fortify\Http\Controllers\ConfirmablePasswordController::store
* @see vendor/laravel/fortify/src/Http/Controllers/ConfirmablePasswordController.php:51
* @route '/user/confirm-password'
*/
store$5.post = (options) => ({
	url: store$5.url(options),
	method: "post"
});
/**
* @see \Laravel\Fortify\Http\Controllers\ConfirmablePasswordController::store
* @see vendor/laravel/fortify/src/Http/Controllers/ConfirmablePasswordController.php:51
* @route '/user/confirm-password'
*/
var storeForm$5 = (options) => ({
	action: store$5.url(options),
	method: "post"
});
/**
* @see \Laravel\Fortify\Http\Controllers\ConfirmablePasswordController::store
* @see vendor/laravel/fortify/src/Http/Controllers/ConfirmablePasswordController.php:51
* @route '/user/confirm-password'
*/
storeForm$5.post = (options) => ({
	action: store$5.url(options),
	method: "post"
});
store$5.form = storeForm$5;
var confirm$3 = { store: Object.assign(store$5, store$5) };
//#endregion
//#region resources/js/pages/auth/confirm-password.tsx
var confirm_password_exports = /* @__PURE__ */ __exportAll({ default: () => ConfirmPassword });
function ConfirmPassword() {
	const { t } = useT();
	return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Head, { title: t("Confirm password") }), /* @__PURE__ */ jsx(Form, {
		...store$5.form(),
		resetOnSuccess: ["password"],
		children: ({ processing, errors }) => /* @__PURE__ */ jsxs("div", {
			className: "grid gap-5",
			children: [/* @__PURE__ */ jsxs("div", {
				className: "grid gap-2",
				children: [
					/* @__PURE__ */ jsx(Label, {
						htmlFor: "password",
						className: authLabelClass,
						children: t("Password")
					}),
					/* @__PURE__ */ jsx(PasswordInput, {
						id: "password",
						name: "password",
						placeholder: t("Password"),
						autoComplete: "current-password",
						autoFocus: true,
						className: authInputClass
					}),
					/* @__PURE__ */ jsx(InputError, { message: errors.password })
				]
			}), /* @__PURE__ */ jsxs(Button, {
				className: `${authPrimaryButtonClass} w-full`,
				disabled: processing,
				"data-test": "confirm-password-button",
				children: [processing && /* @__PURE__ */ jsx(Spinner, {}), t("Confirm password")]
			})]
		})
	})] });
}
ConfirmPassword.layout = {
	title: "Confirm your password",
	description: "This is a secure area of the application. Please confirm your password before continuing."
};
//#endregion
//#region resources/js/components/text-link.tsx
function TextLink({ className = "", children, ...props }) {
	return /* @__PURE__ */ jsx(Link, {
		className: cn("text-foreground underline decoration-neutral-300 underline-offset-4 transition-colors duration-300 ease-out hover:decoration-current! dark:decoration-neutral-500", className),
		...props,
		children
	});
}
//#endregion
//#region resources/js/routes/password/index.ts
/**
* @see \Laravel\Fortify\Http\Controllers\PasswordResetLinkController::request
* @see vendor/laravel/fortify/src/Http/Controllers/PasswordResetLinkController.php:22
* @route '/forgot-password'
*/
var request = (options) => ({
	url: request.url(options),
	method: "get"
});
request.definition = {
	methods: ["get", "head"],
	url: "/forgot-password"
};
/**
* @see \Laravel\Fortify\Http\Controllers\PasswordResetLinkController::request
* @see vendor/laravel/fortify/src/Http/Controllers/PasswordResetLinkController.php:22
* @route '/forgot-password'
*/
request.url = (options) => {
	return request.definition.url + queryParams(options);
};
/**
* @see \Laravel\Fortify\Http\Controllers\PasswordResetLinkController::request
* @see vendor/laravel/fortify/src/Http/Controllers/PasswordResetLinkController.php:22
* @route '/forgot-password'
*/
request.get = (options) => ({
	url: request.url(options),
	method: "get"
});
/**
* @see \Laravel\Fortify\Http\Controllers\PasswordResetLinkController::request
* @see vendor/laravel/fortify/src/Http/Controllers/PasswordResetLinkController.php:22
* @route '/forgot-password'
*/
request.head = (options) => ({
	url: request.url(options),
	method: "head"
});
/**
* @see \Laravel\Fortify\Http\Controllers\PasswordResetLinkController::request
* @see vendor/laravel/fortify/src/Http/Controllers/PasswordResetLinkController.php:22
* @route '/forgot-password'
*/
var requestForm = (options) => ({
	action: request.url(options),
	method: "get"
});
/**
* @see \Laravel\Fortify\Http\Controllers\PasswordResetLinkController::request
* @see vendor/laravel/fortify/src/Http/Controllers/PasswordResetLinkController.php:22
* @route '/forgot-password'
*/
requestForm.get = (options) => ({
	action: request.url(options),
	method: "get"
});
/**
* @see \Laravel\Fortify\Http\Controllers\PasswordResetLinkController::request
* @see vendor/laravel/fortify/src/Http/Controllers/PasswordResetLinkController.php:22
* @route '/forgot-password'
*/
requestForm.head = (options) => ({
	action: request.url({ [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
request.form = requestForm;
/**
* @see \Laravel\Fortify\Http\Controllers\NewPasswordController::reset
* @see vendor/laravel/fortify/src/Http/Controllers/NewPasswordController.php:44
* @route '/reset-password/{token}'
*/
var reset = (args, options) => ({
	url: reset.url(args, options),
	method: "get"
});
reset.definition = {
	methods: ["get", "head"],
	url: "/reset-password/{token}"
};
/**
* @see \Laravel\Fortify\Http\Controllers\NewPasswordController::reset
* @see vendor/laravel/fortify/src/Http/Controllers/NewPasswordController.php:44
* @route '/reset-password/{token}'
*/
reset.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { token: args };
	if (Array.isArray(args)) args = { token: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { token: args.token };
	return reset.definition.url.replace("{token}", parsedArgs.token.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \Laravel\Fortify\Http\Controllers\NewPasswordController::reset
* @see vendor/laravel/fortify/src/Http/Controllers/NewPasswordController.php:44
* @route '/reset-password/{token}'
*/
reset.get = (args, options) => ({
	url: reset.url(args, options),
	method: "get"
});
/**
* @see \Laravel\Fortify\Http\Controllers\NewPasswordController::reset
* @see vendor/laravel/fortify/src/Http/Controllers/NewPasswordController.php:44
* @route '/reset-password/{token}'
*/
reset.head = (args, options) => ({
	url: reset.url(args, options),
	method: "head"
});
/**
* @see \Laravel\Fortify\Http\Controllers\NewPasswordController::reset
* @see vendor/laravel/fortify/src/Http/Controllers/NewPasswordController.php:44
* @route '/reset-password/{token}'
*/
var resetForm = (args, options) => ({
	action: reset.url(args, options),
	method: "get"
});
/**
* @see \Laravel\Fortify\Http\Controllers\NewPasswordController::reset
* @see vendor/laravel/fortify/src/Http/Controllers/NewPasswordController.php:44
* @route '/reset-password/{token}'
*/
resetForm.get = (args, options) => ({
	action: reset.url(args, options),
	method: "get"
});
/**
* @see \Laravel\Fortify\Http\Controllers\NewPasswordController::reset
* @see vendor/laravel/fortify/src/Http/Controllers/NewPasswordController.php:44
* @route '/reset-password/{token}'
*/
resetForm.head = (args, options) => ({
	action: reset.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
reset.form = resetForm;
/**
* @see \Laravel\Fortify\Http\Controllers\PasswordResetLinkController::email
* @see vendor/laravel/fortify/src/Http/Controllers/PasswordResetLinkController.php:30
* @route '/forgot-password'
*/
var email = (options) => ({
	url: email.url(options),
	method: "post"
});
email.definition = {
	methods: ["post"],
	url: "/forgot-password"
};
/**
* @see \Laravel\Fortify\Http\Controllers\PasswordResetLinkController::email
* @see vendor/laravel/fortify/src/Http/Controllers/PasswordResetLinkController.php:30
* @route '/forgot-password'
*/
email.url = (options) => {
	return email.definition.url + queryParams(options);
};
/**
* @see \Laravel\Fortify\Http\Controllers\PasswordResetLinkController::email
* @see vendor/laravel/fortify/src/Http/Controllers/PasswordResetLinkController.php:30
* @route '/forgot-password'
*/
email.post = (options) => ({
	url: email.url(options),
	method: "post"
});
/**
* @see \Laravel\Fortify\Http\Controllers\PasswordResetLinkController::email
* @see vendor/laravel/fortify/src/Http/Controllers/PasswordResetLinkController.php:30
* @route '/forgot-password'
*/
var emailForm = (options) => ({
	action: email.url(options),
	method: "post"
});
/**
* @see \Laravel\Fortify\Http\Controllers\PasswordResetLinkController::email
* @see vendor/laravel/fortify/src/Http/Controllers/PasswordResetLinkController.php:30
* @route '/forgot-password'
*/
emailForm.post = (options) => ({
	action: email.url(options),
	method: "post"
});
email.form = emailForm;
/**
* @see \Laravel\Fortify\Http\Controllers\NewPasswordController::update
* @see vendor/laravel/fortify/src/Http/Controllers/NewPasswordController.php:55
* @route '/reset-password'
*/
var update$4 = (options) => ({
	url: update$4.url(options),
	method: "post"
});
update$4.definition = {
	methods: ["post"],
	url: "/reset-password"
};
/**
* @see \Laravel\Fortify\Http\Controllers\NewPasswordController::update
* @see vendor/laravel/fortify/src/Http/Controllers/NewPasswordController.php:55
* @route '/reset-password'
*/
update$4.url = (options) => {
	return update$4.definition.url + queryParams(options);
};
/**
* @see \Laravel\Fortify\Http\Controllers\NewPasswordController::update
* @see vendor/laravel/fortify/src/Http/Controllers/NewPasswordController.php:55
* @route '/reset-password'
*/
update$4.post = (options) => ({
	url: update$4.url(options),
	method: "post"
});
/**
* @see \Laravel\Fortify\Http\Controllers\NewPasswordController::update
* @see vendor/laravel/fortify/src/Http/Controllers/NewPasswordController.php:55
* @route '/reset-password'
*/
var updateForm$4 = (options) => ({
	action: update$4.url(options),
	method: "post"
});
/**
* @see \Laravel\Fortify\Http\Controllers\NewPasswordController::update
* @see vendor/laravel/fortify/src/Http/Controllers/NewPasswordController.php:55
* @route '/reset-password'
*/
updateForm$4.post = (options) => ({
	action: update$4.url(options),
	method: "post"
});
update$4.form = updateForm$4;
/**
* @see \Laravel\Fortify\Http\Controllers\ConfirmablePasswordController::confirm
* @see vendor/laravel/fortify/src/Http/Controllers/ConfirmablePasswordController.php:40
* @route '/user/confirm-password'
*/
var confirm$2 = (options) => ({
	url: confirm$2.url(options),
	method: "get"
});
confirm$2.definition = {
	methods: ["get", "head"],
	url: "/user/confirm-password"
};
/**
* @see \Laravel\Fortify\Http\Controllers\ConfirmablePasswordController::confirm
* @see vendor/laravel/fortify/src/Http/Controllers/ConfirmablePasswordController.php:40
* @route '/user/confirm-password'
*/
confirm$2.url = (options) => {
	return confirm$2.definition.url + queryParams(options);
};
/**
* @see \Laravel\Fortify\Http\Controllers\ConfirmablePasswordController::confirm
* @see vendor/laravel/fortify/src/Http/Controllers/ConfirmablePasswordController.php:40
* @route '/user/confirm-password'
*/
confirm$2.get = (options) => ({
	url: confirm$2.url(options),
	method: "get"
});
/**
* @see \Laravel\Fortify\Http\Controllers\ConfirmablePasswordController::confirm
* @see vendor/laravel/fortify/src/Http/Controllers/ConfirmablePasswordController.php:40
* @route '/user/confirm-password'
*/
confirm$2.head = (options) => ({
	url: confirm$2.url(options),
	method: "head"
});
/**
* @see \Laravel\Fortify\Http\Controllers\ConfirmablePasswordController::confirm
* @see vendor/laravel/fortify/src/Http/Controllers/ConfirmablePasswordController.php:40
* @route '/user/confirm-password'
*/
var confirmForm$1 = (options) => ({
	action: confirm$2.url(options),
	method: "get"
});
/**
* @see \Laravel\Fortify\Http\Controllers\ConfirmablePasswordController::confirm
* @see vendor/laravel/fortify/src/Http/Controllers/ConfirmablePasswordController.php:40
* @route '/user/confirm-password'
*/
confirmForm$1.get = (options) => ({
	action: confirm$2.url(options),
	method: "get"
});
/**
* @see \Laravel\Fortify\Http\Controllers\ConfirmablePasswordController::confirm
* @see vendor/laravel/fortify/src/Http/Controllers/ConfirmablePasswordController.php:40
* @route '/user/confirm-password'
*/
confirmForm$1.head = (options) => ({
	action: confirm$2.url({ [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
confirm$2.form = confirmForm$1;
/**
* @see \Laravel\Fortify\Http\Controllers\ConfirmedPasswordStatusController::confirmation
* @see vendor/laravel/fortify/src/Http/Controllers/ConfirmedPasswordStatusController.php:17
* @route '/user/confirmed-password-status'
*/
var confirmation = (options) => ({
	url: confirmation.url(options),
	method: "get"
});
confirmation.definition = {
	methods: ["get", "head"],
	url: "/user/confirmed-password-status"
};
/**
* @see \Laravel\Fortify\Http\Controllers\ConfirmedPasswordStatusController::confirmation
* @see vendor/laravel/fortify/src/Http/Controllers/ConfirmedPasswordStatusController.php:17
* @route '/user/confirmed-password-status'
*/
confirmation.url = (options) => {
	return confirmation.definition.url + queryParams(options);
};
/**
* @see \Laravel\Fortify\Http\Controllers\ConfirmedPasswordStatusController::confirmation
* @see vendor/laravel/fortify/src/Http/Controllers/ConfirmedPasswordStatusController.php:17
* @route '/user/confirmed-password-status'
*/
confirmation.get = (options) => ({
	url: confirmation.url(options),
	method: "get"
});
/**
* @see \Laravel\Fortify\Http\Controllers\ConfirmedPasswordStatusController::confirmation
* @see vendor/laravel/fortify/src/Http/Controllers/ConfirmedPasswordStatusController.php:17
* @route '/user/confirmed-password-status'
*/
confirmation.head = (options) => ({
	url: confirmation.url(options),
	method: "head"
});
/**
* @see \Laravel\Fortify\Http\Controllers\ConfirmedPasswordStatusController::confirmation
* @see vendor/laravel/fortify/src/Http/Controllers/ConfirmedPasswordStatusController.php:17
* @route '/user/confirmed-password-status'
*/
var confirmationForm = (options) => ({
	action: confirmation.url(options),
	method: "get"
});
/**
* @see \Laravel\Fortify\Http\Controllers\ConfirmedPasswordStatusController::confirmation
* @see vendor/laravel/fortify/src/Http/Controllers/ConfirmedPasswordStatusController.php:17
* @route '/user/confirmed-password-status'
*/
confirmationForm.get = (options) => ({
	action: confirmation.url(options),
	method: "get"
});
/**
* @see \Laravel\Fortify\Http\Controllers\ConfirmedPasswordStatusController::confirmation
* @see vendor/laravel/fortify/src/Http/Controllers/ConfirmedPasswordStatusController.php:17
* @route '/user/confirmed-password-status'
*/
confirmationForm.head = (options) => ({
	action: confirmation.url({ [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
confirmation.form = confirmationForm;
Object.assign(request, request), Object.assign(reset, reset), Object.assign(email, email), Object.assign(update$4, update$4), Object.assign(confirm$2, confirm$3), Object.assign(confirmation, confirmation);
//#endregion
//#region resources/js/pages/auth/forgot-password.tsx
var forgot_password_exports = /* @__PURE__ */ __exportAll({ default: () => ForgotPassword });
function ForgotPassword({ status }) {
	const { t } = useT();
	return /* @__PURE__ */ jsxs(Fragment$1, { children: [
		/* @__PURE__ */ jsx(Head, { title: t("Forgot password") }),
		status && /* @__PURE__ */ jsx("div", {
			className: `rounded-lg border border-[#d5ddca] bg-[#eef2e8] px-4 py-3 text-sm font-medium text-[#315f42] mb-4`,
			children: status
		}),
		/* @__PURE__ */ jsxs("div", {
			className: "space-y-6",
			children: [/* @__PURE__ */ jsx(Form, {
				...email.form(),
				className: "grid gap-5",
				children: ({ processing, errors }) => /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("div", {
					className: "grid gap-2",
					children: [
						/* @__PURE__ */ jsx(Label, {
							htmlFor: "email",
							className: authLabelClass,
							children: t("Email address")
						}),
						/* @__PURE__ */ jsx(Input, {
							id: "email",
							type: "email",
							name: "email",
							autoComplete: "off",
							autoFocus: true,
							placeholder: "email@example.com",
							className: authInputClass
						}),
						/* @__PURE__ */ jsx(InputError, { message: errors.email })
					]
				}), /* @__PURE__ */ jsx("div", {
					className: "mt-4 flex items-center justify-start",
					children: /* @__PURE__ */ jsxs(Button, {
						className: `${authPrimaryButtonClass} w-full`,
						disabled: processing,
						"data-test": "email-password-reset-link-button",
						children: [processing && /* @__PURE__ */ jsx(LoaderCircle, { className: "h-4 w-4 animate-spin" }), t("Email password reset link")]
					})
				})] })
			}), /* @__PURE__ */ jsxs("div", {
				className: `space-x-1 text-center ${authHelperTextClass}`,
				children: [/* @__PURE__ */ jsx("span", { children: t("Or, return to") }), /* @__PURE__ */ jsx(TextLink, {
					href: login$3(),
					className: authLinkClass,
					children: t("log in")
				})]
			})]
		})
	] });
}
ForgotPassword.layout = {
	title: "Forgot password",
	description: "Enter your email to receive a password reset link"
};
//#endregion
//#region resources/js/routes/login/index.ts
/**
* @see \Laravel\Fortify\Http\Controllers\AuthenticatedSessionController::store
* @see vendor/laravel/fortify/src/Http/Controllers/AuthenticatedSessionController.php:58
* @route '/login'
*/
var store$4 = (options) => ({
	url: store$4.url(options),
	method: "post"
});
store$4.definition = {
	methods: ["post"],
	url: "/login"
};
/**
* @see \Laravel\Fortify\Http\Controllers\AuthenticatedSessionController::store
* @see vendor/laravel/fortify/src/Http/Controllers/AuthenticatedSessionController.php:58
* @route '/login'
*/
store$4.url = (options) => {
	return store$4.definition.url + queryParams(options);
};
/**
* @see \Laravel\Fortify\Http\Controllers\AuthenticatedSessionController::store
* @see vendor/laravel/fortify/src/Http/Controllers/AuthenticatedSessionController.php:58
* @route '/login'
*/
store$4.post = (options) => ({
	url: store$4.url(options),
	method: "post"
});
/**
* @see \Laravel\Fortify\Http\Controllers\AuthenticatedSessionController::store
* @see vendor/laravel/fortify/src/Http/Controllers/AuthenticatedSessionController.php:58
* @route '/login'
*/
var storeForm$4 = (options) => ({
	action: store$4.url(options),
	method: "post"
});
/**
* @see \Laravel\Fortify\Http\Controllers\AuthenticatedSessionController::store
* @see vendor/laravel/fortify/src/Http/Controllers/AuthenticatedSessionController.php:58
* @route '/login'
*/
storeForm$4.post = (options) => ({
	action: store$4.url(options),
	method: "post"
});
store$4.form = storeForm$4;
Object.assign(store$4, store$4);
//#endregion
//#region resources/js/pages/auth/login.tsx
var login_exports = /* @__PURE__ */ __exportAll({ default: () => Login });
/**
* Click-to-fill helper. Walks the rendered form to the email + password
* inputs by name attribute and sets their values via the native input
* setter so React/Preact sees the change, then dispatches an `input`
* event so Inertia's <Form> picks up the new value on submit.
*/
function fillCredentials(email, password) {
	const setValue = (name, value) => {
		const el = document.querySelector(`input[name="${name}"]`);
		if (!el) return;
		const setter = Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype, "value")?.set;
		if (setter) setter.call(el, value);
		else el.value = value;
		el.dispatchEvent(new Event("input", { bubbles: true }));
	};
	setValue("email", email);
	setValue("password", password);
	document.querySelector("input[name=\"email\"]")?.focus();
}
function Login({ status, canResetPassword, canRegister, demoCredentials = [] }) {
	const { t } = useT();
	return /* @__PURE__ */ jsxs(Fragment$1, { children: [
		/* @__PURE__ */ jsx(Head, { title: t("Log in") }),
		demoCredentials.length > 0 && /* @__PURE__ */ jsxs("div", {
			className: "mb-6 grid gap-2 rounded-xl border border-amber-300 bg-amber-50 p-3 text-start",
			children: [/* @__PURE__ */ jsxs("div", {
				className: "flex items-center gap-2 text-[11px] font-semibold tracking-[0.16em] text-amber-800 uppercase",
				children: [/* @__PURE__ */ jsx(Sparkles, { className: "size-3.5" }), t("Demo credentials — click to autofill")]
			}), /* @__PURE__ */ jsx("div", {
				className: "grid gap-1.5",
				children: demoCredentials.map((c) => /* @__PURE__ */ jsxs("button", {
					type: "button",
					onClick: () => fillCredentials(c.email, c.password),
					className: "group flex items-start justify-between gap-3 rounded-md border border-amber-300 bg-white px-3 py-2 text-start shadow-sm transition hover:border-amber-500 hover:bg-amber-50",
					children: [/* @__PURE__ */ jsxs("div", {
						className: "min-w-0 flex-1",
						children: [/* @__PURE__ */ jsx("p", {
							className: "text-[13px] font-semibold text-slate-900",
							children: c.role
						}), c.description && /* @__PURE__ */ jsx("p", {
							className: "mt-0.5 text-[11px] leading-4 text-slate-600",
							children: c.description
						})]
					}), /* @__PURE__ */ jsxs("div", {
						className: "flex flex-col items-end gap-0.5 text-end",
						children: [/* @__PURE__ */ jsx("span", {
							className: "font-mono text-[11px] font-medium text-slate-800",
							children: c.email
						}), /* @__PURE__ */ jsxs("span", {
							className: "font-mono text-[11px] text-slate-500",
							children: [/* @__PURE__ */ jsx("span", {
								className: "text-slate-400",
								children: "pw:\xA0"
							}), c.password]
						})]
					})]
				}, c.email))
			})]
		}),
		/* @__PURE__ */ jsx(Form, {
			...store$4.form(),
			resetOnSuccess: ["password"],
			className: "grid gap-6",
			children: ({ processing, errors }) => /* @__PURE__ */ jsxs(Fragment$1, { children: [
				status && /* @__PURE__ */ jsx("div", {
					className: "rounded-lg border border-[#d5ddca] bg-[#eef2e8] px-4 py-3 text-sm font-medium text-[#315f42]",
					children: status
				}),
				/* @__PURE__ */ jsxs("div", {
					className: "grid gap-5",
					children: [
						/* @__PURE__ */ jsxs("div", {
							className: "grid gap-2",
							children: [
								/* @__PURE__ */ jsx(Label, {
									htmlFor: "email",
									className: authLabelClass,
									children: t("Email address")
								}),
								/* @__PURE__ */ jsx(Input, {
									id: "email",
									type: "email",
									name: "email",
									required: true,
									autoFocus: true,
									tabIndex: 1,
									autoComplete: "email",
									placeholder: "email@example.com",
									className: authInputClass
								}),
								/* @__PURE__ */ jsx(InputError, { message: errors.email })
							]
						}),
						/* @__PURE__ */ jsxs("div", {
							className: "grid gap-2",
							children: [
								/* @__PURE__ */ jsxs("div", {
									className: "flex items-center",
									children: [/* @__PURE__ */ jsx(Label, {
										htmlFor: "password",
										className: authLabelClass,
										children: t("Password")
									}), canResetPassword && /* @__PURE__ */ jsx(TextLink, {
										href: request(),
										className: `font-semibold text-[#315f42] underline decoration-[#c5d0b9] underline-offset-4 transition-colors duration-200 hover:text-[#173f2c] hover:decoration-[#173f2c] ms-auto text-sm`,
										tabIndex: 5,
										children: t("Forgot password?")
									})]
								}),
								/* @__PURE__ */ jsx(PasswordInput, {
									id: "password",
									name: "password",
									required: true,
									tabIndex: 2,
									autoComplete: "current-password",
									placeholder: t("Password"),
									className: authInputClass
								}),
								/* @__PURE__ */ jsx(InputError, { message: errors.password })
							]
						}),
						/* @__PURE__ */ jsxs("div", {
							className: "flex items-center space-x-3",
							children: [/* @__PURE__ */ jsx(Checkbox, {
								id: "remember",
								name: "remember",
								tabIndex: 3,
								className: authCheckboxClass
							}), /* @__PURE__ */ jsx(Label, {
								htmlFor: "remember",
								className: "text-sm font-medium text-[#4e564d]",
								children: t("Remember me")
							})]
						}),
						/* @__PURE__ */ jsxs(Button, {
							type: "submit",
							className: `${authPrimaryButtonClass} mt-1 w-full`,
							tabIndex: 4,
							disabled: processing,
							"data-test": "login-button",
							children: [processing && /* @__PURE__ */ jsx(Spinner, {}), t("Log in")]
						})
					]
				}),
				canRegister && /* @__PURE__ */ jsxs("div", {
					className: `text-center text-sm leading-6 font-medium text-[#6a7164]`,
					children: [
						t("Don't have an account?"),
						" ",
						/* @__PURE__ */ jsx(TextLink, {
							href: register$1(),
							tabIndex: 5,
							className: "font-semibold text-[#315f42] underline decoration-[#c5d0b9] underline-offset-4 transition-colors duration-200 hover:text-[#173f2c] hover:decoration-[#173f2c]",
							children: t("Sign up")
						})
					]
				})
			] })
		})
	] });
}
Login.layout = {
	title: "Log in to your account",
	description: "Enter your email and password below to log in"
};
//#endregion
//#region resources/js/routes/register/index.ts
/**
* @see \Laravel\Fortify\Http\Controllers\RegisteredUserController::store
* @see vendor/laravel/fortify/src/Http/Controllers/RegisteredUserController.php:53
* @route '/register'
*/
var store$3 = (options) => ({
	url: store$3.url(options),
	method: "post"
});
store$3.definition = {
	methods: ["post"],
	url: "/register"
};
/**
* @see \Laravel\Fortify\Http\Controllers\RegisteredUserController::store
* @see vendor/laravel/fortify/src/Http/Controllers/RegisteredUserController.php:53
* @route '/register'
*/
store$3.url = (options) => {
	return store$3.definition.url + queryParams(options);
};
/**
* @see \Laravel\Fortify\Http\Controllers\RegisteredUserController::store
* @see vendor/laravel/fortify/src/Http/Controllers/RegisteredUserController.php:53
* @route '/register'
*/
store$3.post = (options) => ({
	url: store$3.url(options),
	method: "post"
});
/**
* @see \Laravel\Fortify\Http\Controllers\RegisteredUserController::store
* @see vendor/laravel/fortify/src/Http/Controllers/RegisteredUserController.php:53
* @route '/register'
*/
var storeForm$3 = (options) => ({
	action: store$3.url(options),
	method: "post"
});
/**
* @see \Laravel\Fortify\Http\Controllers\RegisteredUserController::store
* @see vendor/laravel/fortify/src/Http/Controllers/RegisteredUserController.php:53
* @route '/register'
*/
storeForm$3.post = (options) => ({
	action: store$3.url(options),
	method: "post"
});
store$3.form = storeForm$3;
Object.assign(store$3, store$3);
//#endregion
//#region resources/js/pages/auth/register.tsx
var register_exports = /* @__PURE__ */ __exportAll({ default: () => Register });
function Register() {
	const { t } = useT();
	const { startDomain } = usePage().props;
	return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Head, { title: t("Register") }), /* @__PURE__ */ jsx(Form, {
		...store$3.form(),
		resetOnSuccess: ["password", "password_confirmation"],
		disableWhileProcessing: true,
		className: "grid gap-6",
		children: ({ processing, errors }) => /* @__PURE__ */ jsxs(Fragment$1, { children: [
			startDomain && /* @__PURE__ */ jsx("input", {
				type: "hidden",
				name: "domain",
				value: startDomain
			}),
			startDomain && /* @__PURE__ */ jsxs("p", {
				className: `rounded-lg border border-[#d5ddca] bg-[#eef2e8] px-4 py-3 text-sm font-medium text-[#315f42] text-xs`,
				children: [
					t("After signup we'll start crawling"),
					" ",
					/* @__PURE__ */ jsx("strong", {
						className: "font-medium",
						children: startDomain
					}),
					" ",
					t("automatically.")
				]
			}),
			/* @__PURE__ */ jsxs("div", {
				className: "grid gap-5",
				children: [
					/* @__PURE__ */ jsxs("div", {
						className: "grid gap-2",
						children: [
							/* @__PURE__ */ jsx(Label, {
								htmlFor: "name",
								className: authLabelClass,
								children: t("Name")
							}),
							/* @__PURE__ */ jsx(Input, {
								id: "name",
								type: "text",
								required: true,
								autoFocus: true,
								tabIndex: 1,
								autoComplete: "name",
								name: "name",
								placeholder: t("Full name"),
								className: authInputClass
							}),
							/* @__PURE__ */ jsx(InputError, { message: errors.name })
						]
					}),
					/* @__PURE__ */ jsxs("div", {
						className: "grid gap-2",
						children: [
							/* @__PURE__ */ jsx(Label, {
								htmlFor: "email",
								className: authLabelClass,
								children: t("Email address")
							}),
							/* @__PURE__ */ jsx(Input, {
								id: "email",
								type: "email",
								required: true,
								tabIndex: 2,
								autoComplete: "email",
								name: "email",
								placeholder: "email@example.com",
								className: authInputClass
							}),
							/* @__PURE__ */ jsx(InputError, { message: errors.email })
						]
					}),
					/* @__PURE__ */ jsxs("div", {
						className: "grid gap-2",
						children: [
							/* @__PURE__ */ jsx(Label, {
								htmlFor: "password",
								className: authLabelClass,
								children: t("Password")
							}),
							/* @__PURE__ */ jsx(PasswordInput, {
								id: "password",
								required: true,
								tabIndex: 3,
								autoComplete: "new-password",
								name: "password",
								placeholder: t("Password"),
								className: authInputClass
							}),
							/* @__PURE__ */ jsx(InputError, { message: errors.password })
						]
					}),
					/* @__PURE__ */ jsxs("div", {
						className: "grid gap-2",
						children: [
							/* @__PURE__ */ jsx(Label, {
								htmlFor: "password_confirmation",
								className: authLabelClass,
								children: t("Confirm password")
							}),
							/* @__PURE__ */ jsx(PasswordInput, {
								id: "password_confirmation",
								required: true,
								tabIndex: 4,
								autoComplete: "new-password",
								name: "password_confirmation",
								placeholder: t("Confirm password"),
								className: authInputClass
							}),
							/* @__PURE__ */ jsx(InputError, { message: errors.password_confirmation })
						]
					}),
					/* @__PURE__ */ jsxs(Button, {
						type: "submit",
						className: `${authPrimaryButtonClass} mt-1 w-full`,
						tabIndex: 5,
						"data-test": "register-user-button",
						children: [processing && /* @__PURE__ */ jsx(Spinner, {}), t("Create account")]
					})
				]
			}),
			/* @__PURE__ */ jsxs("div", {
				className: `text-center ${authHelperTextClass}`,
				children: [
					t("Already have an account?"),
					" ",
					/* @__PURE__ */ jsx(TextLink, {
						href: login$3(),
						tabIndex: 6,
						className: authLinkClass,
						children: t("Log in")
					})
				]
			})
		] })
	})] });
}
Register.layout = {
	title: "Create an account",
	description: "Enter your details below to create your account"
};
//#endregion
//#region resources/js/pages/auth/reset-password.tsx
var reset_password_exports = /* @__PURE__ */ __exportAll({ default: () => ResetPassword });
function ResetPassword({ token, email }) {
	const { t } = useT();
	return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Head, { title: t("Reset password") }), /* @__PURE__ */ jsx(Form, {
		...update$4.form(),
		transform: (data) => ({
			...data,
			token,
			email
		}),
		resetOnSuccess: ["password", "password_confirmation"],
		className: "grid gap-5",
		children: ({ processing, errors }) => /* @__PURE__ */ jsxs("div", {
			className: "grid gap-4",
			children: [
				/* @__PURE__ */ jsxs("div", {
					className: "grid gap-2",
					children: [
						/* @__PURE__ */ jsx(Label, {
							htmlFor: "email",
							className: authLabelClass,
							children: t("Email")
						}),
						/* @__PURE__ */ jsx(Input, {
							id: "email",
							type: "email",
							name: "email",
							autoComplete: "email",
							value: email,
							readOnly: true,
							className: authInputClass
						}),
						/* @__PURE__ */ jsx(InputError, { message: errors.email })
					]
				}),
				/* @__PURE__ */ jsxs("div", {
					className: "grid gap-2",
					children: [
						/* @__PURE__ */ jsx(Label, {
							htmlFor: "password",
							className: authLabelClass,
							children: t("Password")
						}),
						/* @__PURE__ */ jsx(PasswordInput, {
							id: "password",
							name: "password",
							autoComplete: "new-password",
							autoFocus: true,
							placeholder: t("Password"),
							className: authInputClass
						}),
						/* @__PURE__ */ jsx(InputError, { message: errors.password })
					]
				}),
				/* @__PURE__ */ jsxs("div", {
					className: "grid gap-2",
					children: [
						/* @__PURE__ */ jsx(Label, {
							htmlFor: "password_confirmation",
							className: authLabelClass,
							children: t("Confirm password")
						}),
						/* @__PURE__ */ jsx(PasswordInput, {
							id: "password_confirmation",
							name: "password_confirmation",
							autoComplete: "new-password",
							placeholder: t("Confirm password"),
							className: authInputClass
						}),
						/* @__PURE__ */ jsx(InputError, { message: errors.password_confirmation })
					]
				}),
				/* @__PURE__ */ jsxs(Button, {
					type: "submit",
					className: `${authPrimaryButtonClass} mt-1 w-full`,
					disabled: processing,
					"data-test": "reset-password-button",
					children: [processing && /* @__PURE__ */ jsx(Spinner, {}), t("Reset password")]
				})
			]
		})
	})] });
}
ResetPassword.layout = {
	title: "Reset password",
	description: "Please enter your new password below"
};
//#endregion
//#region resources/js/components/ui/input-otp.tsx
var InputOTP = React.forwardRef(({ className, containerClassName, ...props }, ref) => /* @__PURE__ */ jsx(OTPInput, {
	ref,
	containerClassName: cn("flex items-center gap-2 has-[:disabled]:opacity-50", containerClassName),
	className: cn("disabled:cursor-not-allowed", className),
	...props
}));
InputOTP.displayName = "InputOTP";
var InputOTPGroup = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", {
	ref,
	className: cn("flex items-center", className),
	...props
}));
InputOTPGroup.displayName = "InputOTPGroup";
var InputOTPSlot = React.forwardRef(({ index, className, ...props }, ref) => {
	const { char, hasFakeCaret, isActive } = React.useContext(OTPInputContext).slots[index];
	return /* @__PURE__ */ jsxs("div", {
		ref,
		className: cn("relative flex h-9 w-9 items-center justify-center border-y border-e border-input bg-background text-sm shadow-xs transition-[background-color,border-color,box-shadow] first:rounded-s-md first:border-s last:rounded-e-md", isActive && "z-10 border-ring ring-2 ring-ring/30", className),
		...props,
		children: [char, hasFakeCaret && /* @__PURE__ */ jsx("div", {
			className: "pointer-events-none absolute inset-0 flex items-center justify-center",
			children: /* @__PURE__ */ jsx("div", { className: "h-4 w-px animate-caret-blink bg-foreground duration-1000" })
		})]
	});
});
InputOTPSlot.displayName = "InputOTPSlot";
var InputOTPSeparator = React.forwardRef(({ ...props }, ref) => /* @__PURE__ */ jsx("div", {
	ref,
	role: "separator",
	...props,
	children: /* @__PURE__ */ jsx(Minus, {})
}));
InputOTPSeparator.displayName = "InputOTPSeparator";
//#endregion
//#region resources/js/routes/two-factor/login/index.ts
/**
* @see \Laravel\Fortify\Http\Controllers\TwoFactorAuthenticatedSessionController::store
* @see vendor/laravel/fortify/src/Http/Controllers/TwoFactorAuthenticatedSessionController.php:56
* @route '/two-factor-challenge'
*/
var store$2 = (options) => ({
	url: store$2.url(options),
	method: "post"
});
store$2.definition = {
	methods: ["post"],
	url: "/two-factor-challenge"
};
/**
* @see \Laravel\Fortify\Http\Controllers\TwoFactorAuthenticatedSessionController::store
* @see vendor/laravel/fortify/src/Http/Controllers/TwoFactorAuthenticatedSessionController.php:56
* @route '/two-factor-challenge'
*/
store$2.url = (options) => {
	return store$2.definition.url + queryParams(options);
};
/**
* @see \Laravel\Fortify\Http\Controllers\TwoFactorAuthenticatedSessionController::store
* @see vendor/laravel/fortify/src/Http/Controllers/TwoFactorAuthenticatedSessionController.php:56
* @route '/two-factor-challenge'
*/
store$2.post = (options) => ({
	url: store$2.url(options),
	method: "post"
});
/**
* @see \Laravel\Fortify\Http\Controllers\TwoFactorAuthenticatedSessionController::store
* @see vendor/laravel/fortify/src/Http/Controllers/TwoFactorAuthenticatedSessionController.php:56
* @route '/two-factor-challenge'
*/
var storeForm$2 = (options) => ({
	action: store$2.url(options),
	method: "post"
});
/**
* @see \Laravel\Fortify\Http\Controllers\TwoFactorAuthenticatedSessionController::store
* @see vendor/laravel/fortify/src/Http/Controllers/TwoFactorAuthenticatedSessionController.php:56
* @route '/two-factor-challenge'
*/
storeForm$2.post = (options) => ({
	action: store$2.url(options),
	method: "post"
});
store$2.form = storeForm$2;
var login$1 = { store: Object.assign(store$2, store$2) };
//#endregion
//#region resources/js/routes/two-factor/index.ts
/**
* @see \Laravel\Fortify\Http\Controllers\TwoFactorAuthenticatedSessionController::login
* @see vendor/laravel/fortify/src/Http/Controllers/TwoFactorAuthenticatedSessionController.php:41
* @route '/two-factor-challenge'
*/
var login = (options) => ({
	url: login.url(options),
	method: "get"
});
login.definition = {
	methods: ["get", "head"],
	url: "/two-factor-challenge"
};
/**
* @see \Laravel\Fortify\Http\Controllers\TwoFactorAuthenticatedSessionController::login
* @see vendor/laravel/fortify/src/Http/Controllers/TwoFactorAuthenticatedSessionController.php:41
* @route '/two-factor-challenge'
*/
login.url = (options) => {
	return login.definition.url + queryParams(options);
};
/**
* @see \Laravel\Fortify\Http\Controllers\TwoFactorAuthenticatedSessionController::login
* @see vendor/laravel/fortify/src/Http/Controllers/TwoFactorAuthenticatedSessionController.php:41
* @route '/two-factor-challenge'
*/
login.get = (options) => ({
	url: login.url(options),
	method: "get"
});
/**
* @see \Laravel\Fortify\Http\Controllers\TwoFactorAuthenticatedSessionController::login
* @see vendor/laravel/fortify/src/Http/Controllers/TwoFactorAuthenticatedSessionController.php:41
* @route '/two-factor-challenge'
*/
login.head = (options) => ({
	url: login.url(options),
	method: "head"
});
/**
* @see \Laravel\Fortify\Http\Controllers\TwoFactorAuthenticatedSessionController::login
* @see vendor/laravel/fortify/src/Http/Controllers/TwoFactorAuthenticatedSessionController.php:41
* @route '/two-factor-challenge'
*/
var loginForm = (options) => ({
	action: login.url(options),
	method: "get"
});
/**
* @see \Laravel\Fortify\Http\Controllers\TwoFactorAuthenticatedSessionController::login
* @see vendor/laravel/fortify/src/Http/Controllers/TwoFactorAuthenticatedSessionController.php:41
* @route '/two-factor-challenge'
*/
loginForm.get = (options) => ({
	action: login.url(options),
	method: "get"
});
/**
* @see \Laravel\Fortify\Http\Controllers\TwoFactorAuthenticatedSessionController::login
* @see vendor/laravel/fortify/src/Http/Controllers/TwoFactorAuthenticatedSessionController.php:41
* @route '/two-factor-challenge'
*/
loginForm.head = (options) => ({
	action: login.url({ [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
login.form = loginForm;
/**
* @see \Laravel\Fortify\Http\Controllers\TwoFactorAuthenticationController::enable
* @see vendor/laravel/fortify/src/Http/Controllers/TwoFactorAuthenticationController.php:21
* @route '/user/two-factor-authentication'
*/
var enable = (options) => ({
	url: enable.url(options),
	method: "post"
});
enable.definition = {
	methods: ["post"],
	url: "/user/two-factor-authentication"
};
/**
* @see \Laravel\Fortify\Http\Controllers\TwoFactorAuthenticationController::enable
* @see vendor/laravel/fortify/src/Http/Controllers/TwoFactorAuthenticationController.php:21
* @route '/user/two-factor-authentication'
*/
enable.url = (options) => {
	return enable.definition.url + queryParams(options);
};
/**
* @see \Laravel\Fortify\Http\Controllers\TwoFactorAuthenticationController::enable
* @see vendor/laravel/fortify/src/Http/Controllers/TwoFactorAuthenticationController.php:21
* @route '/user/two-factor-authentication'
*/
enable.post = (options) => ({
	url: enable.url(options),
	method: "post"
});
/**
* @see \Laravel\Fortify\Http\Controllers\TwoFactorAuthenticationController::enable
* @see vendor/laravel/fortify/src/Http/Controllers/TwoFactorAuthenticationController.php:21
* @route '/user/two-factor-authentication'
*/
var enableForm = (options) => ({
	action: enable.url(options),
	method: "post"
});
/**
* @see \Laravel\Fortify\Http\Controllers\TwoFactorAuthenticationController::enable
* @see vendor/laravel/fortify/src/Http/Controllers/TwoFactorAuthenticationController.php:21
* @route '/user/two-factor-authentication'
*/
enableForm.post = (options) => ({
	action: enable.url(options),
	method: "post"
});
enable.form = enableForm;
/**
* @see \Laravel\Fortify\Http\Controllers\ConfirmedTwoFactorAuthenticationController::confirm
* @see vendor/laravel/fortify/src/Http/Controllers/ConfirmedTwoFactorAuthenticationController.php:19
* @route '/user/confirmed-two-factor-authentication'
*/
var confirm$1 = (options) => ({
	url: confirm$1.url(options),
	method: "post"
});
confirm$1.definition = {
	methods: ["post"],
	url: "/user/confirmed-two-factor-authentication"
};
/**
* @see \Laravel\Fortify\Http\Controllers\ConfirmedTwoFactorAuthenticationController::confirm
* @see vendor/laravel/fortify/src/Http/Controllers/ConfirmedTwoFactorAuthenticationController.php:19
* @route '/user/confirmed-two-factor-authentication'
*/
confirm$1.url = (options) => {
	return confirm$1.definition.url + queryParams(options);
};
/**
* @see \Laravel\Fortify\Http\Controllers\ConfirmedTwoFactorAuthenticationController::confirm
* @see vendor/laravel/fortify/src/Http/Controllers/ConfirmedTwoFactorAuthenticationController.php:19
* @route '/user/confirmed-two-factor-authentication'
*/
confirm$1.post = (options) => ({
	url: confirm$1.url(options),
	method: "post"
});
/**
* @see \Laravel\Fortify\Http\Controllers\ConfirmedTwoFactorAuthenticationController::confirm
* @see vendor/laravel/fortify/src/Http/Controllers/ConfirmedTwoFactorAuthenticationController.php:19
* @route '/user/confirmed-two-factor-authentication'
*/
var confirmForm = (options) => ({
	action: confirm$1.url(options),
	method: "post"
});
/**
* @see \Laravel\Fortify\Http\Controllers\ConfirmedTwoFactorAuthenticationController::confirm
* @see vendor/laravel/fortify/src/Http/Controllers/ConfirmedTwoFactorAuthenticationController.php:19
* @route '/user/confirmed-two-factor-authentication'
*/
confirmForm.post = (options) => ({
	action: confirm$1.url(options),
	method: "post"
});
confirm$1.form = confirmForm;
/**
* @see \Laravel\Fortify\Http\Controllers\TwoFactorAuthenticationController::disable
* @see vendor/laravel/fortify/src/Http/Controllers/TwoFactorAuthenticationController.php:35
* @route '/user/two-factor-authentication'
*/
var disable = (options) => ({
	url: disable.url(options),
	method: "delete"
});
disable.definition = {
	methods: ["delete"],
	url: "/user/two-factor-authentication"
};
/**
* @see \Laravel\Fortify\Http\Controllers\TwoFactorAuthenticationController::disable
* @see vendor/laravel/fortify/src/Http/Controllers/TwoFactorAuthenticationController.php:35
* @route '/user/two-factor-authentication'
*/
disable.url = (options) => {
	return disable.definition.url + queryParams(options);
};
/**
* @see \Laravel\Fortify\Http\Controllers\TwoFactorAuthenticationController::disable
* @see vendor/laravel/fortify/src/Http/Controllers/TwoFactorAuthenticationController.php:35
* @route '/user/two-factor-authentication'
*/
disable.delete = (options) => ({
	url: disable.url(options),
	method: "delete"
});
/**
* @see \Laravel\Fortify\Http\Controllers\TwoFactorAuthenticationController::disable
* @see vendor/laravel/fortify/src/Http/Controllers/TwoFactorAuthenticationController.php:35
* @route '/user/two-factor-authentication'
*/
var disableForm = (options) => ({
	action: disable.url({ [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "DELETE",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
/**
* @see \Laravel\Fortify\Http\Controllers\TwoFactorAuthenticationController::disable
* @see vendor/laravel/fortify/src/Http/Controllers/TwoFactorAuthenticationController.php:35
* @route '/user/two-factor-authentication'
*/
disableForm.delete = (options) => ({
	action: disable.url({ [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "DELETE",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
disable.form = disableForm;
/**
* @see \Laravel\Fortify\Http\Controllers\TwoFactorQrCodeController::qrCode
* @see vendor/laravel/fortify/src/Http/Controllers/TwoFactorQrCodeController.php:16
* @route '/user/two-factor-qr-code'
*/
var qrCode = (options) => ({
	url: qrCode.url(options),
	method: "get"
});
qrCode.definition = {
	methods: ["get", "head"],
	url: "/user/two-factor-qr-code"
};
/**
* @see \Laravel\Fortify\Http\Controllers\TwoFactorQrCodeController::qrCode
* @see vendor/laravel/fortify/src/Http/Controllers/TwoFactorQrCodeController.php:16
* @route '/user/two-factor-qr-code'
*/
qrCode.url = (options) => {
	return qrCode.definition.url + queryParams(options);
};
/**
* @see \Laravel\Fortify\Http\Controllers\TwoFactorQrCodeController::qrCode
* @see vendor/laravel/fortify/src/Http/Controllers/TwoFactorQrCodeController.php:16
* @route '/user/two-factor-qr-code'
*/
qrCode.get = (options) => ({
	url: qrCode.url(options),
	method: "get"
});
/**
* @see \Laravel\Fortify\Http\Controllers\TwoFactorQrCodeController::qrCode
* @see vendor/laravel/fortify/src/Http/Controllers/TwoFactorQrCodeController.php:16
* @route '/user/two-factor-qr-code'
*/
qrCode.head = (options) => ({
	url: qrCode.url(options),
	method: "head"
});
/**
* @see \Laravel\Fortify\Http\Controllers\TwoFactorQrCodeController::qrCode
* @see vendor/laravel/fortify/src/Http/Controllers/TwoFactorQrCodeController.php:16
* @route '/user/two-factor-qr-code'
*/
var qrCodeForm = (options) => ({
	action: qrCode.url(options),
	method: "get"
});
/**
* @see \Laravel\Fortify\Http\Controllers\TwoFactorQrCodeController::qrCode
* @see vendor/laravel/fortify/src/Http/Controllers/TwoFactorQrCodeController.php:16
* @route '/user/two-factor-qr-code'
*/
qrCodeForm.get = (options) => ({
	action: qrCode.url(options),
	method: "get"
});
/**
* @see \Laravel\Fortify\Http\Controllers\TwoFactorQrCodeController::qrCode
* @see vendor/laravel/fortify/src/Http/Controllers/TwoFactorQrCodeController.php:16
* @route '/user/two-factor-qr-code'
*/
qrCodeForm.head = (options) => ({
	action: qrCode.url({ [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
qrCode.form = qrCodeForm;
/**
* @see \Laravel\Fortify\Http\Controllers\TwoFactorSecretKeyController::secretKey
* @see vendor/laravel/fortify/src/Http/Controllers/TwoFactorSecretKeyController.php:17
* @route '/user/two-factor-secret-key'
*/
var secretKey = (options) => ({
	url: secretKey.url(options),
	method: "get"
});
secretKey.definition = {
	methods: ["get", "head"],
	url: "/user/two-factor-secret-key"
};
/**
* @see \Laravel\Fortify\Http\Controllers\TwoFactorSecretKeyController::secretKey
* @see vendor/laravel/fortify/src/Http/Controllers/TwoFactorSecretKeyController.php:17
* @route '/user/two-factor-secret-key'
*/
secretKey.url = (options) => {
	return secretKey.definition.url + queryParams(options);
};
/**
* @see \Laravel\Fortify\Http\Controllers\TwoFactorSecretKeyController::secretKey
* @see vendor/laravel/fortify/src/Http/Controllers/TwoFactorSecretKeyController.php:17
* @route '/user/two-factor-secret-key'
*/
secretKey.get = (options) => ({
	url: secretKey.url(options),
	method: "get"
});
/**
* @see \Laravel\Fortify\Http\Controllers\TwoFactorSecretKeyController::secretKey
* @see vendor/laravel/fortify/src/Http/Controllers/TwoFactorSecretKeyController.php:17
* @route '/user/two-factor-secret-key'
*/
secretKey.head = (options) => ({
	url: secretKey.url(options),
	method: "head"
});
/**
* @see \Laravel\Fortify\Http\Controllers\TwoFactorSecretKeyController::secretKey
* @see vendor/laravel/fortify/src/Http/Controllers/TwoFactorSecretKeyController.php:17
* @route '/user/two-factor-secret-key'
*/
var secretKeyForm = (options) => ({
	action: secretKey.url(options),
	method: "get"
});
/**
* @see \Laravel\Fortify\Http\Controllers\TwoFactorSecretKeyController::secretKey
* @see vendor/laravel/fortify/src/Http/Controllers/TwoFactorSecretKeyController.php:17
* @route '/user/two-factor-secret-key'
*/
secretKeyForm.get = (options) => ({
	action: secretKey.url(options),
	method: "get"
});
/**
* @see \Laravel\Fortify\Http\Controllers\TwoFactorSecretKeyController::secretKey
* @see vendor/laravel/fortify/src/Http/Controllers/TwoFactorSecretKeyController.php:17
* @route '/user/two-factor-secret-key'
*/
secretKeyForm.head = (options) => ({
	action: secretKey.url({ [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
secretKey.form = secretKeyForm;
/**
* @see \Laravel\Fortify\Http\Controllers\RecoveryCodeController::recoveryCodes
* @see vendor/laravel/fortify/src/Http/Controllers/RecoveryCodeController.php:19
* @route '/user/two-factor-recovery-codes'
*/
var recoveryCodes = (options) => ({
	url: recoveryCodes.url(options),
	method: "get"
});
recoveryCodes.definition = {
	methods: ["get", "head"],
	url: "/user/two-factor-recovery-codes"
};
/**
* @see \Laravel\Fortify\Http\Controllers\RecoveryCodeController::recoveryCodes
* @see vendor/laravel/fortify/src/Http/Controllers/RecoveryCodeController.php:19
* @route '/user/two-factor-recovery-codes'
*/
recoveryCodes.url = (options) => {
	return recoveryCodes.definition.url + queryParams(options);
};
/**
* @see \Laravel\Fortify\Http\Controllers\RecoveryCodeController::recoveryCodes
* @see vendor/laravel/fortify/src/Http/Controllers/RecoveryCodeController.php:19
* @route '/user/two-factor-recovery-codes'
*/
recoveryCodes.get = (options) => ({
	url: recoveryCodes.url(options),
	method: "get"
});
/**
* @see \Laravel\Fortify\Http\Controllers\RecoveryCodeController::recoveryCodes
* @see vendor/laravel/fortify/src/Http/Controllers/RecoveryCodeController.php:19
* @route '/user/two-factor-recovery-codes'
*/
recoveryCodes.head = (options) => ({
	url: recoveryCodes.url(options),
	method: "head"
});
/**
* @see \Laravel\Fortify\Http\Controllers\RecoveryCodeController::recoveryCodes
* @see vendor/laravel/fortify/src/Http/Controllers/RecoveryCodeController.php:19
* @route '/user/two-factor-recovery-codes'
*/
var recoveryCodesForm = (options) => ({
	action: recoveryCodes.url(options),
	method: "get"
});
/**
* @see \Laravel\Fortify\Http\Controllers\RecoveryCodeController::recoveryCodes
* @see vendor/laravel/fortify/src/Http/Controllers/RecoveryCodeController.php:19
* @route '/user/two-factor-recovery-codes'
*/
recoveryCodesForm.get = (options) => ({
	action: recoveryCodes.url(options),
	method: "get"
});
/**
* @see \Laravel\Fortify\Http\Controllers\RecoveryCodeController::recoveryCodes
* @see vendor/laravel/fortify/src/Http/Controllers/RecoveryCodeController.php:19
* @route '/user/two-factor-recovery-codes'
*/
recoveryCodesForm.head = (options) => ({
	action: recoveryCodes.url({ [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
recoveryCodes.form = recoveryCodesForm;
/**
* @see \Laravel\Fortify\Http\Controllers\RecoveryCodeController::regenerateRecoveryCodes
* @see vendor/laravel/fortify/src/Http/Controllers/RecoveryCodeController.php:38
* @route '/user/two-factor-recovery-codes'
*/
var regenerateRecoveryCodes = (options) => ({
	url: regenerateRecoveryCodes.url(options),
	method: "post"
});
regenerateRecoveryCodes.definition = {
	methods: ["post"],
	url: "/user/two-factor-recovery-codes"
};
/**
* @see \Laravel\Fortify\Http\Controllers\RecoveryCodeController::regenerateRecoveryCodes
* @see vendor/laravel/fortify/src/Http/Controllers/RecoveryCodeController.php:38
* @route '/user/two-factor-recovery-codes'
*/
regenerateRecoveryCodes.url = (options) => {
	return regenerateRecoveryCodes.definition.url + queryParams(options);
};
/**
* @see \Laravel\Fortify\Http\Controllers\RecoveryCodeController::regenerateRecoveryCodes
* @see vendor/laravel/fortify/src/Http/Controllers/RecoveryCodeController.php:38
* @route '/user/two-factor-recovery-codes'
*/
regenerateRecoveryCodes.post = (options) => ({
	url: regenerateRecoveryCodes.url(options),
	method: "post"
});
/**
* @see \Laravel\Fortify\Http\Controllers\RecoveryCodeController::regenerateRecoveryCodes
* @see vendor/laravel/fortify/src/Http/Controllers/RecoveryCodeController.php:38
* @route '/user/two-factor-recovery-codes'
*/
var regenerateRecoveryCodesForm = (options) => ({
	action: regenerateRecoveryCodes.url(options),
	method: "post"
});
/**
* @see \Laravel\Fortify\Http\Controllers\RecoveryCodeController::regenerateRecoveryCodes
* @see vendor/laravel/fortify/src/Http/Controllers/RecoveryCodeController.php:38
* @route '/user/two-factor-recovery-codes'
*/
regenerateRecoveryCodesForm.post = (options) => ({
	action: regenerateRecoveryCodes.url(options),
	method: "post"
});
regenerateRecoveryCodes.form = regenerateRecoveryCodesForm;
Object.assign(login, login$1), Object.assign(enable, enable), Object.assign(confirm$1, confirm$1), Object.assign(disable, disable), Object.assign(qrCode, qrCode), Object.assign(secretKey, secretKey), Object.assign(recoveryCodes, recoveryCodes), Object.assign(regenerateRecoveryCodes, regenerateRecoveryCodes);
//#endregion
//#region resources/js/hooks/use-two-factor-auth.ts
var useTwoFactorAuth = () => {
	const { submit } = useHttp();
	const [qrCodeSvg, setQrCodeSvg] = useState(null);
	const [manualSetupKey, setManualSetupKey] = useState(null);
	const [recoveryCodesList, setRecoveryCodesList] = useState([]);
	const [errors, setErrors] = useState([]);
	const hasSetupData = qrCodeSvg !== null && manualSetupKey !== null;
	const clearErrors = useCallback(() => {
		setErrors([]);
	}, []);
	const clearSetupData = useCallback(() => {
		setManualSetupKey(null);
		setQrCodeSvg(null);
		setErrors([]);
	}, []);
	const clearTwoFactorAuthData = useCallback(() => {
		setManualSetupKey(null);
		setQrCodeSvg(null);
		setErrors([]);
		setRecoveryCodesList([]);
	}, []);
	const fetchQrCode = useCallback(async () => {
		try {
			const { svg } = await submit(qrCode());
			setQrCodeSvg(svg);
		} catch {
			setErrors((prev) => [...prev, "Failed to fetch QR code"]);
			setQrCodeSvg(null);
		}
	}, [submit]);
	const fetchSetupKey = useCallback(async () => {
		try {
			const { secretKey: key } = await submit(secretKey());
			setManualSetupKey(key);
		} catch {
			setErrors((prev) => [...prev, "Failed to fetch a setup key"]);
			setManualSetupKey(null);
		}
	}, [submit]);
	const fetchRecoveryCodes = useCallback(async () => {
		try {
			setErrors([]);
			setRecoveryCodesList(await submit(recoveryCodes()));
		} catch {
			setErrors((prev) => [...prev, "Failed to fetch recovery codes"]);
			setRecoveryCodesList([]);
		}
	}, [submit]);
	return {
		qrCodeSvg,
		manualSetupKey,
		recoveryCodesList,
		hasSetupData,
		errors,
		clearErrors,
		clearSetupData,
		clearTwoFactorAuthData,
		fetchQrCode,
		fetchSetupKey,
		fetchSetupData: useCallback(async () => {
			try {
				setErrors([]);
				await Promise.all([fetchQrCode(), fetchSetupKey()]);
			} catch {
				setQrCodeSvg(null);
				setManualSetupKey(null);
			}
		}, [fetchQrCode, fetchSetupKey]),
		fetchRecoveryCodes
	};
};
//#endregion
//#region resources/js/pages/auth/two-factor-challenge.tsx
var two_factor_challenge_exports = /* @__PURE__ */ __exportAll({ default: () => TwoFactorChallenge });
function TwoFactorChallenge() {
	const { t } = useT();
	const [showRecoveryInput, setShowRecoveryInput] = useState(false);
	const [code, setCode] = useState("");
	const authConfigContent = useMemo(() => {
		if (showRecoveryInput) return {
			title: t("Recovery code"),
			description: t("Please confirm access to your account by entering one of your emergency recovery codes."),
			toggleText: t("login using an authentication code")
		};
		return {
			title: t("Authentication code"),
			description: t("Enter the authentication code provided by your authenticator application."),
			toggleText: t("login using a recovery code")
		};
	}, [showRecoveryInput, t]);
	setLayoutProps({
		title: authConfigContent.title,
		description: authConfigContent.description
	});
	const toggleRecoveryMode = (clearErrors) => {
		setShowRecoveryInput(!showRecoveryInput);
		clearErrors();
		setCode("");
	};
	return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Head, { title: t("Two-factor authentication") }), /* @__PURE__ */ jsx("div", {
		className: "space-y-6",
		children: /* @__PURE__ */ jsx(Form, {
			...store$2.form(),
			className: "space-y-5",
			resetOnError: true,
			resetOnSuccess: !showRecoveryInput,
			children: ({ errors, processing, clearErrors }) => /* @__PURE__ */ jsxs(Fragment$1, { children: [
				showRecoveryInput ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Input, {
					name: "recovery_code",
					type: "text",
					placeholder: t("Enter recovery code"),
					className: `${authInputClass} text-center font-mono tracking-[0.25em]`,
					autoFocus: showRecoveryInput,
					required: true
				}), /* @__PURE__ */ jsx(InputError, { message: errors.recovery_code })] }) : /* @__PURE__ */ jsxs("div", {
					className: "flex flex-col items-center justify-center space-y-4 rounded-[20px] border border-[#e1dacd] bg-[#f7f2ea] p-5 text-center",
					children: [/* @__PURE__ */ jsx("div", {
						className: "flex w-full items-center justify-center",
						children: /* @__PURE__ */ jsx(InputOTP, {
							name: "code",
							maxLength: 6,
							value: code,
							onChange: (value) => setCode(value),
							disabled: processing,
							pattern: REGEXP_ONLY_DIGITS,
							autoFocus: true,
							containerClassName: "justify-center gap-2.5",
							children: /* @__PURE__ */ jsx(InputOTPGroup, {
								className: "gap-2.5",
								children: Array.from({ length: 6 }, (_, index) => /* @__PURE__ */ jsx(InputOTPSlot, {
									index,
									className: authOtpSlotClass
								}, index))
							})
						})
					}), /* @__PURE__ */ jsx(InputError, { message: errors.code })]
				}),
				/* @__PURE__ */ jsx(Button, {
					type: "submit",
					className: `${authPrimaryButtonClass} w-full`,
					disabled: processing,
					children: t("Continue")
				}),
				/* @__PURE__ */ jsxs("div", {
					className: `text-center ${authHelperTextClass}`,
					children: [/* @__PURE__ */ jsxs("span", { children: [t("or you can"), " "] }), /* @__PURE__ */ jsx("button", {
						type: "button",
						className: `cursor-pointer ${authLinkClass}`,
						onClick: () => toggleRecoveryMode(clearErrors),
						children: authConfigContent.toggleText
					})]
				})
			] })
		})
	})] });
}
//#endregion
//#region resources/js/routes/verification/index.ts
/**
* @see \Laravel\Fortify\Http\Controllers\EmailVerificationPromptController::notice
* @see vendor/laravel/fortify/src/Http/Controllers/EmailVerificationPromptController.php:18
* @route '/email/verify'
*/
var notice = (options) => ({
	url: notice.url(options),
	method: "get"
});
notice.definition = {
	methods: ["get", "head"],
	url: "/email/verify"
};
/**
* @see \Laravel\Fortify\Http\Controllers\EmailVerificationPromptController::notice
* @see vendor/laravel/fortify/src/Http/Controllers/EmailVerificationPromptController.php:18
* @route '/email/verify'
*/
notice.url = (options) => {
	return notice.definition.url + queryParams(options);
};
/**
* @see \Laravel\Fortify\Http\Controllers\EmailVerificationPromptController::notice
* @see vendor/laravel/fortify/src/Http/Controllers/EmailVerificationPromptController.php:18
* @route '/email/verify'
*/
notice.get = (options) => ({
	url: notice.url(options),
	method: "get"
});
/**
* @see \Laravel\Fortify\Http\Controllers\EmailVerificationPromptController::notice
* @see vendor/laravel/fortify/src/Http/Controllers/EmailVerificationPromptController.php:18
* @route '/email/verify'
*/
notice.head = (options) => ({
	url: notice.url(options),
	method: "head"
});
/**
* @see \Laravel\Fortify\Http\Controllers\EmailVerificationPromptController::notice
* @see vendor/laravel/fortify/src/Http/Controllers/EmailVerificationPromptController.php:18
* @route '/email/verify'
*/
var noticeForm = (options) => ({
	action: notice.url(options),
	method: "get"
});
/**
* @see \Laravel\Fortify\Http\Controllers\EmailVerificationPromptController::notice
* @see vendor/laravel/fortify/src/Http/Controllers/EmailVerificationPromptController.php:18
* @route '/email/verify'
*/
noticeForm.get = (options) => ({
	action: notice.url(options),
	method: "get"
});
/**
* @see \Laravel\Fortify\Http\Controllers\EmailVerificationPromptController::notice
* @see vendor/laravel/fortify/src/Http/Controllers/EmailVerificationPromptController.php:18
* @route '/email/verify'
*/
noticeForm.head = (options) => ({
	action: notice.url({ [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
notice.form = noticeForm;
/**
* @see \Laravel\Fortify\Http\Controllers\VerifyEmailController::verify
* @see vendor/laravel/fortify/src/Http/Controllers/VerifyEmailController.php:18
* @route '/email/verify/{id}/{hash}'
*/
var verify = (args, options) => ({
	url: verify.url(args, options),
	method: "get"
});
verify.definition = {
	methods: ["get", "head"],
	url: "/email/verify/{id}/{hash}"
};
/**
* @see \Laravel\Fortify\Http\Controllers\VerifyEmailController::verify
* @see vendor/laravel/fortify/src/Http/Controllers/VerifyEmailController.php:18
* @route '/email/verify/{id}/{hash}'
*/
verify.url = (args, options) => {
	if (Array.isArray(args)) args = {
		id: args[0],
		hash: args[1]
	};
	args = applyUrlDefaults(args);
	const parsedArgs = {
		id: args.id,
		hash: args.hash
	};
	return verify.definition.url.replace("{id}", parsedArgs.id.toString()).replace("{hash}", parsedArgs.hash.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \Laravel\Fortify\Http\Controllers\VerifyEmailController::verify
* @see vendor/laravel/fortify/src/Http/Controllers/VerifyEmailController.php:18
* @route '/email/verify/{id}/{hash}'
*/
verify.get = (args, options) => ({
	url: verify.url(args, options),
	method: "get"
});
/**
* @see \Laravel\Fortify\Http\Controllers\VerifyEmailController::verify
* @see vendor/laravel/fortify/src/Http/Controllers/VerifyEmailController.php:18
* @route '/email/verify/{id}/{hash}'
*/
verify.head = (args, options) => ({
	url: verify.url(args, options),
	method: "head"
});
/**
* @see \Laravel\Fortify\Http\Controllers\VerifyEmailController::verify
* @see vendor/laravel/fortify/src/Http/Controllers/VerifyEmailController.php:18
* @route '/email/verify/{id}/{hash}'
*/
var verifyForm = (args, options) => ({
	action: verify.url(args, options),
	method: "get"
});
/**
* @see \Laravel\Fortify\Http\Controllers\VerifyEmailController::verify
* @see vendor/laravel/fortify/src/Http/Controllers/VerifyEmailController.php:18
* @route '/email/verify/{id}/{hash}'
*/
verifyForm.get = (args, options) => ({
	action: verify.url(args, options),
	method: "get"
});
/**
* @see \Laravel\Fortify\Http\Controllers\VerifyEmailController::verify
* @see vendor/laravel/fortify/src/Http/Controllers/VerifyEmailController.php:18
* @route '/email/verify/{id}/{hash}'
*/
verifyForm.head = (args, options) => ({
	action: verify.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
verify.form = verifyForm;
/**
* @see \Laravel\Fortify\Http\Controllers\EmailVerificationNotificationController::send
* @see vendor/laravel/fortify/src/Http/Controllers/EmailVerificationNotificationController.php:19
* @route '/email/verification-notification'
*/
var send = (options) => ({
	url: send.url(options),
	method: "post"
});
send.definition = {
	methods: ["post"],
	url: "/email/verification-notification"
};
/**
* @see \Laravel\Fortify\Http\Controllers\EmailVerificationNotificationController::send
* @see vendor/laravel/fortify/src/Http/Controllers/EmailVerificationNotificationController.php:19
* @route '/email/verification-notification'
*/
send.url = (options) => {
	return send.definition.url + queryParams(options);
};
/**
* @see \Laravel\Fortify\Http\Controllers\EmailVerificationNotificationController::send
* @see vendor/laravel/fortify/src/Http/Controllers/EmailVerificationNotificationController.php:19
* @route '/email/verification-notification'
*/
send.post = (options) => ({
	url: send.url(options),
	method: "post"
});
/**
* @see \Laravel\Fortify\Http\Controllers\EmailVerificationNotificationController::send
* @see vendor/laravel/fortify/src/Http/Controllers/EmailVerificationNotificationController.php:19
* @route '/email/verification-notification'
*/
var sendForm = (options) => ({
	action: send.url(options),
	method: "post"
});
/**
* @see \Laravel\Fortify\Http\Controllers\EmailVerificationNotificationController::send
* @see vendor/laravel/fortify/src/Http/Controllers/EmailVerificationNotificationController.php:19
* @route '/email/verification-notification'
*/
sendForm.post = (options) => ({
	action: send.url(options),
	method: "post"
});
send.form = sendForm;
Object.assign(notice, notice), Object.assign(verify, verify), Object.assign(send, send);
//#endregion
//#region resources/js/pages/auth/verify-email.tsx
var verify_email_exports = /* @__PURE__ */ __exportAll({ default: () => VerifyEmail });
function VerifyEmail({ status }) {
	const { t } = useT();
	return /* @__PURE__ */ jsxs(Fragment$1, { children: [
		/* @__PURE__ */ jsx(Head, { title: t("Email verification") }),
		status === "verification-link-sent" && /* @__PURE__ */ jsx("div", {
			className: `rounded-lg border border-[#d5ddca] bg-[#eef2e8] px-4 py-3 text-sm font-medium text-[#315f42] mb-4`,
			children: t("A new verification link has been sent to the email address you provided during registration.")
		}),
		/* @__PURE__ */ jsx(Form, {
			...send.form(),
			className: "grid gap-4 text-center",
			children: ({ processing }) => /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs(Button, {
				disabled: processing,
				className: authPrimaryButtonClass,
				children: [processing && /* @__PURE__ */ jsx(Spinner, {}), t("Resend verification email")]
			}), /* @__PURE__ */ jsx(TextLink, {
				href: logout(),
				className: `${authLinkClass} mx-auto block text-sm`,
				children: t("Log out")
			})] })
		})
	] });
}
VerifyEmail.layout = {
	title: "Verify email",
	description: "Please verify your email address by clicking on the link we just emailed to you."
};
//#endregion
//#region resources/js/pages/dashboard.tsx
var dashboard_exports = /* @__PURE__ */ __exportAll({ default: () => Dashboard });
var DASHBOARD_ONLY = ["stats", "filters"];
var STATUS_STYLES = {
	new: "border-sky-200 bg-sky-50 text-sky-700 dark:border-sky-500/30 dark:bg-sky-500/10 dark:text-sky-300",
	qualified: "border-emerald-200 bg-emerald-50 text-emerald-700 dark:border-emerald-500/30 dark:bg-emerald-500/10 dark:text-emerald-300",
	contacted: "border-amber-200 bg-amber-50 text-amber-700 dark:border-amber-500/30 dark:bg-amber-500/10 dark:text-amber-300",
	won: "border-violet-200 bg-violet-50 text-violet-700 dark:border-violet-500/30 dark:bg-violet-500/10 dark:text-violet-300",
	lost: "border-border bg-muted text-muted-foreground"
};
function relativeTime(iso, t) {
	if (!iso) return t("No activity");
	const ms = Date.now() - new Date(iso).getTime();
	const min = Math.max(1, Math.round(ms / 6e4));
	if (min < 60) return t(":min m ago", { min });
	const hr = Math.round(min / 60);
	if (hr < 24) return t(":hr h ago", { hr });
	const day = Math.round(hr / 24);
	if (day < 7) return t(":day d ago", { day });
	return new Date(iso).toLocaleDateString();
}
function StatusBadge({ status }) {
	return /* @__PURE__ */ jsx("span", {
		className: `inline-flex items-center rounded-md border px-2 py-0.5 text-xs font-medium capitalize ${STATUS_STYLES[status] ?? STATUS_STYLES.new}`,
		children: status
	});
}
function FooterMetric({ icon, label, value }) {
	return /* @__PURE__ */ jsxs("div", {
		className: "flex min-w-0 items-center justify-between gap-3 border-b px-4 py-2 last:border-b-0 lg:border-e lg:border-b-0 lg:last:border-e-0",
		children: [/* @__PURE__ */ jsxs("div", {
			className: "flex min-w-0 items-center gap-2 text-muted-foreground",
			children: [icon, /* @__PURE__ */ jsx("span", {
				className: "truncate text-xs",
				children: label
			})]
		}), /* @__PURE__ */ jsx("span", {
			className: "text-xs font-medium text-foreground tabular-nums",
			children: value
		})]
	});
}
function formatRange(from, to) {
	const opts = {
		month: "short",
		day: "numeric"
	};
	return `${new Date(from).toLocaleDateString("en-US", opts)} - ${new Date(to).toLocaleDateString("en-US", {
		...opts,
		year: "numeric"
	})}`;
}
function trendSub(current, prior, fallback, t) {
	const data = trend(current, prior);
	if (data.dir === "flat") return fallback;
	return data.dir === "up" ? t("Up :pct% vs previous 7d", { pct: data.pct }) : t("Down :pct% vs previous 7d", { pct: data.pct });
}
function DashboardChart({ chart }) {
	const width = 760;
	const height = 240;
	const padX = 24;
	const padY = 16;
	const innerWidth = width - padX * 2;
	const innerHeight = height - padY * 2;
	const values = [...chart.conversations, ...chart.leads];
	const max = Math.max(1, ...values);
	const stepX = innerWidth / Math.max(1, chart.days.length - 1);
	const toPath = (series) => series.map((value, index) => `${(padX + index * stepX).toFixed(1)},${(padY + innerHeight - value / max * innerHeight).toFixed(1)}`).join(" ");
	const conversationsPath = toPath(chart.conversations);
	const leadsPath = toPath(chart.leads);
	const area = `${padX},${padY + innerHeight} ${conversationsPath} ${padX + innerWidth},${padY + innerHeight}`;
	const ticks = [
		0,
		.25,
		.5,
		.75,
		1
	].map((ratio) => Math.round(max * ratio));
	const labelIndexes = [
		0,
		Math.floor(chart.days.length / 4),
		Math.floor(chart.days.length / 2),
		Math.floor(chart.days.length * 3 / 4),
		chart.days.length - 1
	].filter((value, index, rows) => rows.indexOf(value) === index);
	return /* @__PURE__ */ jsxs("svg", {
		viewBox: `0 0 ${width} ${height + 24}`,
		className: "h-64 w-full",
		preserveAspectRatio: "xMidYMid meet",
		"aria-hidden": true,
		children: [
			ticks.map((tick, index) => {
				const y = padY + innerHeight - tick / max * innerHeight;
				return /* @__PURE__ */ jsxs("g", { children: [/* @__PURE__ */ jsx("line", {
					x1: padX,
					y1: y,
					x2: padX + innerWidth,
					y2: y,
					stroke: "currentColor",
					strokeOpacity: .06
				}), /* @__PURE__ */ jsx("text", {
					x: padX - 6,
					y: y + 4,
					textAnchor: "end",
					fontSize: "10",
					fill: "currentColor",
					opacity: .45,
					children: tick
				})] }, index);
			}),
			/* @__PURE__ */ jsx("polygon", {
				points: area,
				fill: "#2563eb",
				fillOpacity: .12
			}),
			/* @__PURE__ */ jsx("polyline", {
				points: conversationsPath,
				fill: "none",
				stroke: "#2563eb",
				strokeWidth: 1.8,
				strokeLinecap: "round",
				strokeLinejoin: "round"
			}),
			/* @__PURE__ */ jsx("polyline", {
				points: leadsPath,
				fill: "none",
				stroke: "#f59e0b",
				strokeWidth: 1.7,
				strokeDasharray: "4 4",
				strokeLinecap: "round",
				strokeLinejoin: "round"
			}),
			labelIndexes.map((index) => /* @__PURE__ */ jsx("text", {
				x: padX + index * stepX,
				y: height + 16,
				textAnchor: "middle",
				fontSize: "10",
				fill: "currentColor",
				opacity: .45,
				children: new Date(chart.days[index]).toLocaleDateString("en-US", {
					month: "short",
					day: "numeric"
				})
			}, index))
		]
	});
}
function ProgressBar({ value, tone }) {
	return /* @__PURE__ */ jsx("div", {
		className: "mt-1.5 h-2 overflow-hidden rounded-full bg-muted",
		children: /* @__PURE__ */ jsx("div", {
			className: `h-full rounded-full ${tone}`,
			style: { width: `${Math.max(0, Math.min(value, 100))}%` }
		})
	});
}
function MobileLeadDetail({ label, children }) {
	return /* @__PURE__ */ jsxs("div", {
		className: "min-w-0 rounded-md bg-muted/35 px-2.5 py-2",
		children: [/* @__PURE__ */ jsx("dt", {
			className: "text-[10px] font-medium tracking-wider text-muted-foreground uppercase",
			children: label
		}), /* @__PURE__ */ jsx("dd", {
			className: "mt-1 truncate text-xs text-foreground",
			children
		})]
	});
}
function MobileLeadCard({ lead, isColumnVisible, weeklyConversations }) {
	const { t } = useT();
	const label = lead.name ?? lead.email ?? t("Unknown lead");
	return /* @__PURE__ */ jsxs("div", {
		className: "px-3 py-3",
		children: [/* @__PURE__ */ jsxs("div", {
			className: "flex items-start justify-between gap-3",
			children: [/* @__PURE__ */ jsxs(Link, {
				href: show$1(lead.id),
				className: "flex min-w-0 items-center gap-2 text-foreground",
				children: [/* @__PURE__ */ jsx("span", {
					className: "flex size-8 shrink-0 items-center justify-center rounded-full bg-muted text-xs font-semibold uppercase",
					children: label.slice(0, 1)
				}), /* @__PURE__ */ jsxs("span", {
					className: "min-w-0",
					children: [/* @__PURE__ */ jsx("span", {
						className: "block truncate text-sm font-medium",
						children: label
					}), isColumnVisible("email") && /* @__PURE__ */ jsx("span", {
						className: "block truncate text-xs text-muted-foreground",
						children: lead.email ?? t("No email")
					})]
				})]
			}), isColumnVisible("status") && /* @__PURE__ */ jsx(StatusBadge, { status: lead.status })]
		}), /* @__PURE__ */ jsxs("dl", {
			className: "mt-3 grid grid-cols-1 gap-2 sm:grid-cols-2",
			children: [
				isColumnVisible("created") && /* @__PURE__ */ jsx(MobileLeadDetail, {
					label: t("Created"),
					children: relativeTime(lead.created_at, t)
				}),
				isColumnVisible("primary_agent") && /* @__PURE__ */ jsx(MobileLeadDetail, {
					label: t("Primary agent"),
					children: lead.agent ? /* @__PURE__ */ jsxs(Link, {
						href: index$12(),
						className: "inline-flex min-w-0 items-center gap-1.5 text-muted-foreground hover:text-foreground",
						children: [/* @__PURE__ */ jsx(Bot, { className: "size-3.5 shrink-0" }), /* @__PURE__ */ jsx("span", {
							className: "truncate",
							children: lead.agent.name
						})]
					}) : t("No agent")
				}),
				isColumnVisible("activity") && /* @__PURE__ */ jsx(MobileLeadDetail, {
					label: t("Activity"),
					children: t(":count conversations this week", { count: weeklyConversations.toLocaleString() })
				})
			]
		})]
	});
}
function Dashboard({ stats, window, chart, reports, filters }) {
	const { t } = useT();
	const { props } = usePage();
	const DASHBOARD_COLUMNS = [
		{
			id: "status",
			label: t("Status")
		},
		{
			id: "email",
			label: t("Email")
		},
		{
			id: "created",
			label: t("Created")
		},
		{
			id: "primary_agent",
			label: t("Primary agent")
		},
		{
			id: "activity",
			label: t("Activity")
		}
	];
	const DASHBOARD_LEAD_VIEW_OPTIONS = [
		{
			value: "all",
			label: t("All leads")
		},
		{
			value: "new",
			label: t("New")
		},
		{
			value: "qualified",
			label: t("Qualified")
		},
		{
			value: "contacted",
			label: t("Contacted")
		},
		{
			value: "won",
			label: t("Won")
		},
		{
			value: "lost",
			label: t("Lost")
		}
	];
	const DASHBOARD_LEAD_SORT_OPTIONS = [
		{
			value: "created_desc",
			label: t("Newest first")
		},
		{
			value: "created_asc",
			label: t("Oldest first")
		},
		{
			value: "name_asc",
			label: t("Lead name A-Z")
		},
		{
			value: "name_desc",
			label: t("Lead name Z-A")
		}
	];
	const DASHBOARD_LEAD_CONTACT_OPTIONS = [
		{
			value: "all",
			label: t("Any email state")
		},
		{
			value: "with_email",
			label: t("Has email")
		},
		{
			value: "without_email",
			label: t("Missing email")
		}
	];
	const { hiddenColumnCount, isColumnVisible, resetColumns, setColumnVisibility, visibleColumns } = usePersistentTableColumns("table-columns:dashboard-leads", DASHBOARD_COLUMNS);
	const showOnboarding = props.auth?.needs_onboarding ?? false;
	const emptyTitle = filters.lead_status !== "all" || filters.lead_contact !== "all" ? t("No matching leads") : t("No leads yet");
	const visibleColumnCount = DASHBOARD_COLUMNS.filter((column) => isColumnVisible(column.id)).length;
	if (!stats || !window || !chart || !reports) return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Head, { title: t("Dashboard") }), /* @__PURE__ */ jsx("div", {
		className: "p-4 text-sm text-muted-foreground",
		children: t("No workspace selected.")
	})] });
	const hasLeads = stats.recent_leads.length > 0;
	return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Head, { title: t("Dashboard") }), /* @__PURE__ */ jsxs("div", {
		className: "flex min-h-0 flex-1 flex-col bg-card",
		children: [
			/* @__PURE__ */ jsxs("div", {
				className: "flex min-h-10 flex-wrap items-center gap-2 border-b px-3 py-2 sm:py-1.5",
				children: [
					/* @__PURE__ */ jsx(TableScopeMenu, {
						options: DASHBOARD_LEAD_VIEW_OPTIONS,
						value: filters.lead_status,
						paramName: "lead_status",
						only: DASHBOARD_ONLY
					}),
					/* @__PURE__ */ jsx(TableSortMenu, {
						options: DASHBOARD_LEAD_SORT_OPTIONS,
						value: filters.lead_sort,
						paramName: "lead_sort",
						only: DASHBOARD_ONLY
					}),
					/* @__PURE__ */ jsx(TableFiltersMenu, {
						groups: [{
							label: t("Email"),
							paramName: "lead_contact",
							value: filters.lead_contact,
							defaultValue: "all",
							options: DASHBOARD_LEAD_CONTACT_OPTIONS
						}],
						only: DASHBOARD_ONLY
					}),
					/* @__PURE__ */ jsxs("div", {
						className: "flex w-full flex-wrap items-center gap-2 sm:ms-auto sm:w-auto",
						children: [
							/* @__PURE__ */ jsx(TableColumnMenu, {
								columns: DASHBOARD_COLUMNS,
								visibleColumns,
								hiddenColumnCount,
								onResetColumns: resetColumns,
								onSetColumnVisibility: setColumnVisibility
							}),
							/* @__PURE__ */ jsx(Button, {
								asChild: true,
								variant: "outline",
								size: "sm",
								className: "flex-1 sm:flex-none",
								children: /* @__PURE__ */ jsxs(Link, {
									href: index$9(),
									prefetch: true,
									children: [/* @__PURE__ */ jsx(Inbox, { className: "size-3.5" }), t("Inbox")]
								})
							}),
							/* @__PURE__ */ jsx(Button, {
								asChild: true,
								variant: "outline",
								size: "sm",
								className: "flex-1 sm:flex-none",
								children: /* @__PURE__ */ jsxs(Link, {
									href: index$10(),
									prefetch: true,
									children: [/* @__PURE__ */ jsx(MessagesSquare, { className: "size-3.5" }), t("Conversations")]
								})
							}),
							/* @__PURE__ */ jsx(Button, {
								asChild: true,
								size: "sm",
								className: "flex-1 sm:flex-none",
								children: /* @__PURE__ */ jsxs(Link, {
									href: create$1(),
									prefetch: true,
									children: [/* @__PURE__ */ jsx(Plus, { className: "size-3.5" }), t("New agent")]
								})
							})
						]
					})
				]
			}),
			showOnboarding && /* @__PURE__ */ jsxs("div", {
				className: "flex flex-col items-start gap-2 border-b bg-emerald-50 px-4 py-2 text-sm text-emerald-900 sm:flex-row sm:items-center sm:justify-between dark:bg-emerald-500/10 dark:text-emerald-200",
				children: [/* @__PURE__ */ jsxs("div", {
					className: "flex items-center gap-2",
					children: [/* @__PURE__ */ jsx(CheckCircle2, { className: "size-4 shrink-0" }), /* @__PURE__ */ jsx("span", { children: t("Finish setting up your first AI agent.") })]
				}), /* @__PURE__ */ jsxs(Link, {
					href: onboarding(),
					className: "inline-flex items-center gap-1 text-xs font-medium hover:underline",
					children: [
						t("Continue"),
						" ",
						/* @__PURE__ */ jsx(ArrowRight, { className: "size-3.5" })
					]
				})]
			}),
			/* @__PURE__ */ jsx("div", {
				className: "min-h-0 flex-1 overflow-y-auto",
				children: /* @__PURE__ */ jsxs("div", {
					className: "space-y-4 p-4",
					children: [
						/* @__PURE__ */ jsxs("div", {
							className: "grid gap-3 sm:grid-cols-2 xl:grid-cols-5",
							children: [
								/* @__PURE__ */ jsx(MetricCard, {
									label: t("Conversations 7d"),
									value: stats.conversations.last_7d.toLocaleString(),
									sub: trendSub(stats.conversations.last_7d, stats.conversations.previous_7d, t(":count in the last 30d", { count: stats.conversations.last_30d.toLocaleString() }), t),
									icon: /* @__PURE__ */ jsx(MessagesSquare, { className: "size-4" }),
									iconTone: "bg-blue-500/10 text-blue-700 dark:text-blue-300",
									series: stats.conversations.series_7d,
									accent: "#2563eb",
									trendData: trend(stats.conversations.last_7d, stats.conversations.previous_7d)
								}),
								/* @__PURE__ */ jsx(MetricCard, {
									label: t("Messages 7d"),
									value: stats.messages.last_7d.toLocaleString(),
									sub: trendSub(stats.messages.last_7d, stats.messages.previous_7d, t(":count total messages", { count: stats.messages.total.toLocaleString() }), t),
									icon: /* @__PURE__ */ jsx(Activity, { className: "size-4" }),
									iconTone: "bg-emerald-500/10 text-emerald-700 dark:text-emerald-300",
									series: stats.messages.series_7d,
									accent: "#059669",
									trendData: trend(stats.messages.last_7d, stats.messages.previous_7d)
								}),
								/* @__PURE__ */ jsx(MetricCard, {
									label: t("Leads 7d"),
									value: stats.leads.last_7d.toLocaleString(),
									sub: trendSub(stats.leads.last_7d, stats.leads.previous_7d, t(":count total leads", { count: stats.leads.total.toLocaleString() }), t),
									icon: /* @__PURE__ */ jsx(Inbox, { className: "size-4" }),
									iconTone: "bg-amber-500/10 text-amber-700 dark:text-amber-300",
									series: stats.leads.series_7d,
									accent: "#f59e0b",
									trendData: trend(stats.leads.last_7d, stats.leads.previous_7d)
								}),
								/* @__PURE__ */ jsx(MetricCard, {
									label: t("Conversion 7d"),
									value: `${reports.conversion.value.toFixed(1)}%`,
									sub: trendSub(reports.conversion.value, reports.conversion.previous_value, t(":pct% over 30d", { pct: reports.conversion.last_30d.toFixed(1) }), t),
									icon: /* @__PURE__ */ jsx(TrendingUp, { className: "size-4" }),
									iconTone: "bg-rose-500/10 text-rose-700 dark:text-rose-300",
									series: reports.conversion.series_7d,
									accent: "#e11d48",
									trendData: trend(reports.conversion.value, reports.conversion.previous_value)
								}),
								/* @__PURE__ */ jsx(MetricCard, {
									label: t("Messages / convo"),
									value: reports.engagement.value.toFixed(1),
									sub: trendSub(reports.engagement.value, reports.engagement.previous_value, t(":count avg over 30d", { count: reports.engagement.last_30d.toFixed(1) }), t),
									icon: /* @__PURE__ */ jsx(Library, { className: "size-4" }),
									iconTone: "bg-violet-500/10 text-violet-700 dark:text-violet-300",
									series: reports.engagement.series_7d,
									accent: "#7c3aed",
									trendData: trend(reports.engagement.value, reports.engagement.previous_value)
								})
							]
						}),
						/* @__PURE__ */ jsxs("div", {
							className: "grid gap-4 xl:grid-cols-[minmax(0,1.45fr)_minmax(320px,0.95fr)]",
							children: [/* @__PURE__ */ jsxs(Card, {
								className: "overflow-hidden p-0",
								children: [
									/* @__PURE__ */ jsxs("div", {
										className: "flex items-start justify-between gap-4 border-b px-4 py-4",
										children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
											className: "text-sm font-medium",
											children: t("Workspace report")
										}), /* @__PURE__ */ jsx("p", {
											className: "mt-0.5 text-xs text-muted-foreground",
											children: t("Conversations are the blue area. Leads are the dotted line, so you can see whether capture is keeping pace with traffic.")
										})] }), /* @__PURE__ */ jsx("div", {
											className: "rounded-full border bg-background px-3 py-1 text-[11px] font-medium text-muted-foreground",
											children: formatRange(window.from, window.to)
										})]
									}),
									/* @__PURE__ */ jsx("div", {
										className: "px-3 pt-4 pb-2 sm:px-4",
										children: /* @__PURE__ */ jsx(DashboardChart, { chart })
									}),
									/* @__PURE__ */ jsxs("div", {
										className: "grid gap-0 border-t sm:grid-cols-2 lg:grid-cols-5",
										children: [
											/* @__PURE__ */ jsx(FooterMetric, {
												icon: /* @__PURE__ */ jsx(MessagesSquare, { className: "size-3.5" }),
												label: t("30d conversations"),
												value: stats.conversations.last_30d.toLocaleString()
											}),
											/* @__PURE__ */ jsx(FooterMetric, {
												icon: /* @__PURE__ */ jsx(Inbox, { className: "size-3.5" }),
												label: t("30d leads"),
												value: stats.leads.last_30d.toLocaleString()
											}),
											/* @__PURE__ */ jsx(FooterMetric, {
												icon: /* @__PURE__ */ jsx(Activity, { className: "size-3.5" }),
												label: t("Indexed sources"),
												value: stats.sources.indexed.toLocaleString()
											}),
											/* @__PURE__ */ jsx(FooterMetric, {
												icon: /* @__PURE__ */ jsx(AlertTriangle, { className: "size-3.5" }),
												label: t("Sources in queue"),
												value: `${stats.sources.in_progress}/${reports.source_health.total}`
											}),
											/* @__PURE__ */ jsx(FooterMetric, {
												icon: /* @__PURE__ */ jsx(Bot, { className: "size-3.5" }),
												label: t("Agents live"),
												value: `${stats.agents.published}/${stats.agents.total || 0}`
											})
										]
									})
								]
							}), /* @__PURE__ */ jsxs("div", {
								className: "grid gap-4",
								children: [/* @__PURE__ */ jsxs(Card, {
									className: "p-4",
									children: [
										/* @__PURE__ */ jsxs("div", {
											className: "flex items-start justify-between gap-3",
											children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
												className: "text-sm font-medium",
												children: t("Lead pipeline")
											}), /* @__PURE__ */ jsx("p", {
												className: "mt-0.5 text-xs text-muted-foreground",
												children: t("Distribution of captured leads across your current statuses.")
											})] }), /* @__PURE__ */ jsx("span", {
												className: "rounded-full border bg-background px-3 py-1 text-[11px] font-medium text-muted-foreground",
												children: t(":count total", { count: reports.pipeline.total.toLocaleString() })
											})]
										}),
										/* @__PURE__ */ jsx("div", {
											className: "mt-4 space-y-3",
											children: reports.pipeline.statuses.map((status) => /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsxs("div", {
												className: "flex items-center justify-between gap-3 text-xs",
												children: [/* @__PURE__ */ jsx("span", {
													className: "font-medium text-foreground",
													children: status.label
												}), /* @__PURE__ */ jsxs("span", {
													className: "text-muted-foreground tabular-nums",
													children: [
														status.value.toLocaleString(),
														" ",
														"·",
														" ",
														status.share.toFixed(0),
														"%"
													]
												})]
											}), /* @__PURE__ */ jsx(ProgressBar, {
												value: status.share,
												tone: status.key === "won" ? "bg-violet-500" : status.key === "qualified" ? "bg-emerald-500" : status.key === "contacted" ? "bg-amber-500" : status.key === "lost" ? "bg-slate-400" : "bg-sky-500"
											})] }, status.key))
										}),
										/* @__PURE__ */ jsxs("div", {
											className: "mt-5 rounded-xl border bg-muted/30 p-3",
											children: [/* @__PURE__ */ jsxs("div", {
												className: "flex items-center justify-between gap-3 text-xs",
												children: [/* @__PURE__ */ jsx("span", {
													className: "font-medium text-foreground",
													children: t("Knowledge health")
												}), /* @__PURE__ */ jsx("span", {
													className: "text-muted-foreground tabular-nums",
													children: t(":pct% indexed", { pct: reports.source_health.indexed_rate.toFixed(0) })
												})]
											}), /* @__PURE__ */ jsxs("div", {
												className: "mt-2 grid grid-cols-3 gap-2 text-center text-xs",
												children: [
													/* @__PURE__ */ jsxs("div", {
														className: "rounded-lg bg-background px-2 py-2",
														children: [/* @__PURE__ */ jsx("p", {
															className: "font-semibold text-foreground",
															children: reports.source_health.indexed.toLocaleString()
														}), /* @__PURE__ */ jsx("p", {
															className: "mt-0.5 text-muted-foreground",
															children: t("indexed")
														})]
													}),
													/* @__PURE__ */ jsxs("div", {
														className: "rounded-lg bg-background px-2 py-2",
														children: [/* @__PURE__ */ jsx("p", {
															className: "font-semibold text-foreground",
															children: reports.source_health.in_progress.toLocaleString()
														}), /* @__PURE__ */ jsx("p", {
															className: "mt-0.5 text-muted-foreground",
															children: t("in progress")
														})]
													}),
													/* @__PURE__ */ jsxs("div", {
														className: "rounded-lg bg-background px-2 py-2",
														children: [/* @__PURE__ */ jsx("p", {
															className: "font-semibold text-foreground",
															children: reports.source_health.failed.toLocaleString()
														}), /* @__PURE__ */ jsx("p", {
															className: "mt-0.5 text-muted-foreground",
															children: t("failed")
														})]
													})
												]
											})]
										})
									]
								}), /* @__PURE__ */ jsxs(Card, {
									className: "overflow-hidden p-0",
									children: [/* @__PURE__ */ jsxs("div", {
										className: "border-b px-4 py-4",
										children: [/* @__PURE__ */ jsx("p", {
											className: "text-sm font-medium",
											children: t("Top agents")
										}), /* @__PURE__ */ jsx("p", {
											className: "mt-0.5 text-xs text-muted-foreground",
											children: t("Best-performing agents over the last 30 days.")
										})]
									}), reports.top_agents.length === 0 ? /* @__PURE__ */ jsx("div", {
										className: "px-4 py-8 text-sm text-muted-foreground",
										children: t("No agent activity yet. Once visitors start chatting, the strongest performers show up here.")
									}) : /* @__PURE__ */ jsx("div", {
										className: "divide-y",
										children: reports.top_agents.map((agent) => /* @__PURE__ */ jsxs(Link, {
											href: show$4(agent.id),
											className: "flex items-center gap-3 px-4 py-3 transition hover:bg-muted/50",
											children: [
												/* @__PURE__ */ jsx("div", {
													className: "flex size-9 shrink-0 items-center justify-center rounded-full bg-muted text-muted-foreground",
													children: /* @__PURE__ */ jsx(Bot, { className: "size-4" })
												}),
												/* @__PURE__ */ jsxs("div", {
													className: "min-w-0 flex-1",
													children: [/* @__PURE__ */ jsxs("div", {
														className: "flex flex-wrap items-center gap-2",
														children: [/* @__PURE__ */ jsx("p", {
															className: "truncate text-sm font-medium text-foreground",
															children: agent.name
														}), /* @__PURE__ */ jsx("span", {
															className: `rounded-full px-2 py-0.5 text-[10px] font-medium ${agent.is_published ? "bg-emerald-500/10 text-emerald-700 dark:text-emerald-300" : "bg-muted text-muted-foreground"}`,
															children: agent.is_published ? t("Live") : t("Draft")
														})]
													}), /* @__PURE__ */ jsx("p", {
														className: "mt-1 text-[11px] text-muted-foreground",
														children: t("Last activity :time", { time: relativeTime(agent.last_activity_at, t) })
													})]
												}),
												/* @__PURE__ */ jsxs("div", {
													className: "text-end text-xs",
													children: [/* @__PURE__ */ jsx("p", {
														className: "font-semibold text-foreground tabular-nums",
														children: t(":count convos", { count: agent.conversations.toLocaleString() })
													}), /* @__PURE__ */ jsx("p", {
														className: "mt-0.5 text-muted-foreground",
														children: t(":count leads", { count: agent.leads.toLocaleString() })
													})]
												})
											]
										}, agent.id))
									})]
								})]
							})]
						}),
						/* @__PURE__ */ jsxs(Card, {
							className: "overflow-hidden p-0",
							children: [
								/* @__PURE__ */ jsxs("div", {
									className: "border-b px-4 py-4",
									children: [/* @__PURE__ */ jsx("p", {
										className: "text-sm font-medium",
										children: t("Recent leads")
									}), /* @__PURE__ */ jsx("p", {
										className: "mt-0.5 text-xs text-muted-foreground",
										children: t("Your latest captured leads, filtered by the controls in the toolbar.")
									})]
								}),
								/* @__PURE__ */ jsx("div", {
									className: "md:hidden",
									children: hasLeads ? /* @__PURE__ */ jsx("div", {
										className: "divide-y",
										children: stats.recent_leads.map((lead) => /* @__PURE__ */ jsx(MobileLeadCard, {
											lead,
											isColumnVisible,
											weeklyConversations: lead.conversations_last_7d ?? 0
										}, lead.id))
									}) : /* @__PURE__ */ jsxs("div", {
										className: "flex h-72 flex-col items-center justify-center gap-2 px-4 text-center text-muted-foreground",
										children: [
											/* @__PURE__ */ jsx(Inbox, { className: "size-8" }),
											/* @__PURE__ */ jsx("p", {
												className: "text-sm font-medium text-foreground",
												children: emptyTitle
											}),
											/* @__PURE__ */ jsx("p", {
												className: "max-w-xs text-xs",
												children: t("Visitor leads captured by the widget will appear in this database view.")
											})
										]
									})
								}),
								/* @__PURE__ */ jsx("div", {
									className: "hidden overflow-auto md:block",
									children: /* @__PURE__ */ jsxs("table", {
										className: "w-full min-w-[880px] border-separate border-spacing-0 text-start text-sm",
										children: [/* @__PURE__ */ jsx("thead", {
											className: "sticky top-0 z-10 bg-card text-xs font-medium text-muted-foreground",
											children: /* @__PURE__ */ jsxs("tr", { children: [
												/* @__PURE__ */ jsx("th", {
													className: "w-9 border-b px-3 py-2",
													children: /* @__PURE__ */ jsx("input", {
														type: "checkbox",
														"aria-label": t("Select all leads"),
														disabled: true,
														className: "size-3.5 rounded border-input"
													})
												}),
												/* @__PURE__ */ jsx("th", {
													className: "border-e border-b px-3 py-2",
													children: t("Lead")
												}),
												isColumnVisible("status") && /* @__PURE__ */ jsx("th", {
													className: "border-e border-b px-3 py-2",
													children: t("Status")
												}),
												isColumnVisible("email") && /* @__PURE__ */ jsx("th", {
													className: "border-e border-b px-3 py-2",
													children: t("Email")
												}),
												isColumnVisible("created") && /* @__PURE__ */ jsx("th", {
													className: "border-e border-b px-3 py-2",
													children: t("Created")
												}),
												isColumnVisible("primary_agent") && /* @__PURE__ */ jsx("th", {
													className: "border-e border-b px-3 py-2",
													children: t("Primary agent")
												}),
												isColumnVisible("activity") && /* @__PURE__ */ jsx("th", {
													className: "border-b px-3 py-2",
													children: t("Activity")
												})
											] })
										}), /* @__PURE__ */ jsx("tbody", { children: hasLeads ? stats.recent_leads.map((lead) => {
											const label = lead.name ?? lead.email ?? t("Unknown lead");
											return /* @__PURE__ */ jsxs("tr", {
												className: "group hover:bg-muted/35",
												children: [
													/* @__PURE__ */ jsx("td", {
														className: "border-b px-3 py-2",
														children: /* @__PURE__ */ jsx("input", {
															type: "checkbox",
															"aria-label": t("Select :name", { name: label }),
															disabled: true,
															className: "size-3.5 rounded border-input"
														})
													}),
													/* @__PURE__ */ jsx("td", {
														className: "border-e border-b px-3 py-2",
														children: /* @__PURE__ */ jsxs(Link, {
															href: show$1(lead.id),
															className: "flex min-w-0 items-center gap-2 text-foreground",
															children: [/* @__PURE__ */ jsx("span", {
																className: "flex size-5 shrink-0 items-center justify-center rounded-full bg-muted text-[10px] font-semibold uppercase",
																children: label.slice(0, 1)
															}), /* @__PURE__ */ jsx("span", {
																className: "truncate font-medium",
																children: label
															})]
														})
													}),
													isColumnVisible("status") && /* @__PURE__ */ jsx("td", {
														className: "border-e border-b px-3 py-2",
														children: /* @__PURE__ */ jsx(StatusBadge, { status: lead.status })
													}),
													isColumnVisible("email") && /* @__PURE__ */ jsx("td", {
														className: "border-e border-b px-3 py-2 text-sm text-muted-foreground",
														children: lead.email ?? t("No email")
													}),
													isColumnVisible("created") && /* @__PURE__ */ jsx("td", {
														className: "border-e border-b px-3 py-2 text-sm text-muted-foreground",
														children: relativeTime(lead.created_at, t)
													}),
													isColumnVisible("primary_agent") && /* @__PURE__ */ jsx("td", {
														className: "border-e border-b px-3 py-2",
														children: lead.agent ? /* @__PURE__ */ jsxs(Link, {
															href: index$12(),
															className: "inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground",
															children: [/* @__PURE__ */ jsx(Bot, { className: "size-3.5" }), lead.agent.name]
														}) : /* @__PURE__ */ jsx("span", {
															className: "text-sm text-muted-foreground",
															children: t("No agent")
														})
													}),
													isColumnVisible("activity") && /* @__PURE__ */ jsx("td", {
														className: "border-b px-3 py-2 text-sm text-muted-foreground",
														children: t(":count conversations this week", { count: (lead.conversations_last_7d ?? 0).toLocaleString() })
													})
												]
											}, lead.id);
										}) : /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx("td", {
											colSpan: 2 + visibleColumnCount,
											className: "h-72 border-b px-4 text-center",
											children: /* @__PURE__ */ jsxs("div", {
												className: "mx-auto flex max-w-sm flex-col items-center gap-2 text-muted-foreground",
												children: [
													/* @__PURE__ */ jsx(Inbox, { className: "size-8" }),
													/* @__PURE__ */ jsx("p", {
														className: "text-sm font-medium text-foreground",
														children: emptyTitle
													}),
													/* @__PURE__ */ jsx("p", {
														className: "text-xs",
														children: t("Visitor leads captured by the widget will appear in this database view.")
													})
												]
											})
										}) }) })]
									})
								})
							]
						})
					]
				})
			})
		]
	})] });
}
Dashboard.layout = { breadcrumbs: [{
	title: "Dashboard",
	href: dashboard$1()
}] };
//#endregion
//#region resources/js/layouts/marketing-shell.tsx
/**
* Footer link router. External URLs (anything starting with http://,
* https://, or mailto:/tel:) render as a plain <a target="_blank"
* rel="noopener noreferrer"> so the browser handles them normally —
* Inertia <Link> would XHR-fetch the URL expecting a JSON Inertia
* response and pop its error overlay on the HTML it gets back instead
* (the "blank modal" buyer reported 2026-05-21 for the X icon). Empty
* or '#' hrefs render nothing — better than a dead button. Everything
* else stays an Inertia <Link>.
*/
function FooterLink({ href, children, className }) {
	const trimmed = (href ?? "").trim();
	if (trimmed === "" || trimmed === "#") return null;
	if (/^(https?:|mailto:|tel:)/i.test(trimmed)) return /* @__PURE__ */ jsx("a", {
		href: trimmed,
		target: "_blank",
		rel: "noopener noreferrer",
		className,
		children
	});
	return /* @__PURE__ */ jsx(Link, {
		href: trimmed,
		className,
		children
	});
}
var pineButtonClass$1 = "bg-[#173f2c] text-[#f7f4ec] hover:bg-[#123322] hover:text-[#f7f4ec]";
function LogoMark$1({ className }) {
	return /* @__PURE__ */ jsx("span", {
		className: cn("flex items-center justify-center text-[#173f2c]", className),
		children: /* @__PURE__ */ jsx(AppLogoIcon, { className: "size-full" })
	});
}
function BrandWordmark({ logoUrl, logoDarkUrl, siteTitle, mode, size = "header" }) {
	const fallbackMarkSize = size === "header" ? "size-8" : "size-7";
	const imageClassName = size === "header" ? "h-10 w-auto max-w-[220px] object-contain" : "h-9 w-auto max-w-[180px] object-contain";
	const titleClassName = size === "header" ? "text-2xl font-semibold tracking-normal text-[#263129]" : "text-xl font-semibold text-[#263129]";
	return /* @__PURE__ */ jsx(Link, {
		href: home(),
		className: "flex items-center gap-2.5",
		children: /* @__PURE__ */ jsx(BrandLockup, {
			siteTitle,
			logoUrl,
			logoDarkUrl,
			mode,
			className: "gap-2.5",
			logoClassName: imageClassName,
			textClassName: titleClassName,
			fallbackLogo: /* @__PURE__ */ jsx(LogoMark$1, { className: fallbackMarkSize })
		})
	});
}
function MarketingShell({ content, children }) {
	const branding = useBranding();
	const { auth, canRegister, demo } = usePage().props;
	const hasUser = Boolean(auth.user);
	const siteTitle = branding.site_title || "Pitchbar";
	const headerPrimaryLabel = hasUser ? "Dashboard" : "Get started";
	const headerPrimaryHref = hasUser ? dashboard$1() : canRegister ? register$1() : login$3();
	const newTabProps = Boolean(demo) && !hasUser ? {
		target: "_blank",
		rel: "noopener noreferrer"
	} : {};
	const [mobileOpen, setMobileOpen] = useState(false);
	useEffect(() => {
		if (!mobileOpen) return;
		const onKey = (e) => {
			if (e.key === "Escape") setMobileOpen(false);
		};
		window.addEventListener("keydown", onKey);
		return () => window.removeEventListener("keydown", onKey);
	}, [mobileOpen]);
	return /* @__PURE__ */ jsxs("div", {
		className: "min-h-screen overflow-x-hidden bg-[#f7f2e8] text-[#252a24]",
		children: [
			/* @__PURE__ */ jsx(LocaleSuggestionBanner, {}),
			/* @__PURE__ */ jsxs("header", {
				className: "mx-auto flex max-w-[1340px] items-center justify-between gap-5 px-6 py-7 lg:px-10",
				children: [
					/* @__PURE__ */ jsx(BrandWordmark, {
						logoUrl: branding.header_logo_url,
						logoDarkUrl: branding.header_logo_dark_url,
						siteTitle,
						mode: branding.header_brand_display
					}),
					/* @__PURE__ */ jsxs("nav", {
						className: "hidden items-center gap-10 text-sm font-semibold text-[#41483f] lg:flex",
						children: [content.nav_items.map((item) => /* @__PURE__ */ jsx(Link, {
							href: item.href,
							className: "transition hover:text-[#173f2c]",
							children: item.label
						}, `${item.label}-${item.href}`)), demo && content.header.resources_label ? /* @__PURE__ */ jsxs("a", {
							href: content.header.resources_href,
							target: "_blank",
							rel: "noopener noreferrer",
							className: "inline-flex items-center gap-1 transition hover:text-[#173f2c]",
							children: [content.header.resources_label, /* @__PURE__ */ jsx("svg", {
								viewBox: "0 0 24 24",
								fill: "none",
								stroke: "currentColor",
								strokeWidth: "2",
								strokeLinecap: "round",
								strokeLinejoin: "round",
								className: "size-3 opacity-70",
								"aria-hidden": "true",
								children: /* @__PURE__ */ jsx("path", { d: "M7 17L17 7M9 7h8v8" })
							})]
						}) : null]
					}),
					/* @__PURE__ */ jsxs("div", {
						className: "flex items-center gap-1",
						children: [
							/* @__PURE__ */ jsx(LocaleSwitcher, { variant: "marketing" }),
							!hasUser && /* @__PURE__ */ jsx(Link, {
								href: login$3(),
								...newTabProps,
								className: "hidden h-10 items-center rounded-md px-4 text-sm font-semibold text-[#41483f] transition hover:bg-[#173f2c]/8 hover:text-[#173f2c] sm:inline-flex",
								children: "Login"
							}),
							/* @__PURE__ */ jsx(Button, {
								className: cn("h-10 rounded-md px-4 text-sm font-semibold", pineButtonClass$1),
								asChild: true,
								children: /* @__PURE__ */ jsxs(Link, {
									href: headerPrimaryHref,
									...newTabProps,
									className: "inline-flex items-center gap-1.5",
									children: [headerPrimaryLabel, /* @__PURE__ */ jsx(DirArrow, {
										direction: "forward",
										className: "size-4"
									})]
								})
							}),
							/* @__PURE__ */ jsx("button", {
								type: "button",
								onClick: () => setMobileOpen((open) => !open),
								"aria-expanded": mobileOpen,
								"aria-controls": "marketing-mobile-nav",
								"aria-label": mobileOpen ? "Close menu" : "Open menu",
								className: "inline-flex size-10 items-center justify-center rounded-md text-[#41483f] transition hover:bg-[#173f2c]/8 hover:text-[#173f2c] lg:hidden",
								children: mobileOpen ? /* @__PURE__ */ jsx(X, { className: "size-5" }) : /* @__PURE__ */ jsx(Menu, { className: "size-5" })
							})
						]
					})
				]
			}),
			mobileOpen && /* @__PURE__ */ jsx("nav", {
				id: "marketing-mobile-nav",
				className: "mx-auto max-w-[1340px] px-6 pb-4 lg:hidden",
				children: /* @__PURE__ */ jsxs("div", {
					className: "flex flex-col gap-1 rounded-xl border border-[#e4dccc] bg-white/80 p-2 text-sm font-semibold text-[#41483f] shadow-sm",
					children: [
						content.nav_items.map((item) => /* @__PURE__ */ jsx(Link, {
							href: item.href,
							onClick: () => setMobileOpen(false),
							className: "rounded-lg px-3 py-2.5 transition hover:bg-[#173f2c]/8 hover:text-[#173f2c]",
							children: item.label
						}, `m-${item.label}-${item.href}`)),
						demo && content.header.resources_label ? /* @__PURE__ */ jsx("a", {
							href: content.header.resources_href,
							target: "_blank",
							rel: "noopener noreferrer",
							onClick: () => setMobileOpen(false),
							className: "rounded-lg px-3 py-2.5 transition hover:bg-[#173f2c]/8 hover:text-[#173f2c]",
							children: content.header.resources_label
						}) : null,
						!hasUser && /* @__PURE__ */ jsx(Link, {
							href: login$3(),
							...newTabProps,
							onClick: () => setMobileOpen(false),
							className: "rounded-lg px-3 py-2.5 transition hover:bg-[#173f2c]/8 hover:text-[#173f2c] sm:hidden",
							children: "Login"
						})
					]
				})
			}),
			/* @__PURE__ */ jsx("main", { children }),
			/* @__PURE__ */ jsxs("footer", {
				className: "mx-auto grid max-w-[1200px] gap-8 px-6 pt-2 pb-9 lg:grid-cols-[1.5fr_2fr_0.8fr] lg:px-10",
				children: [
					/* @__PURE__ */ jsxs("div", {
						className: "flex flex-col gap-4",
						children: [
							/* @__PURE__ */ jsx(BrandWordmark, {
								logoUrl: branding.footer_logo_url ?? branding.header_logo_url,
								logoDarkUrl: branding.footer_logo_dark_url ?? branding.header_logo_dark_url,
								siteTitle,
								mode: branding.footer_brand_display,
								size: "footer"
							}),
							/* @__PURE__ */ jsx("p", {
								className: "max-w-[260px] text-xs leading-5 font-medium text-[#777d73]",
								children: content.footer.brand_description
							}),
							/* @__PURE__ */ jsx("div", {
								className: "flex gap-5 text-sm font-bold text-[#667064]",
								children: content.footer.socials.map((item) => /* @__PURE__ */ jsx(FooterLink, {
									href: item.href,
									children: item.label
								}, `${item.label}-${item.href}`))
							})
						]
					}),
					/* @__PURE__ */ jsx("div", {
						className: "grid gap-8 sm:grid-cols-3",
						children: content.footer.groups.map((group) => /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("h3", {
							className: "text-xs font-bold text-[#30362f]",
							children: group.title
						}), /* @__PURE__ */ jsx("div", {
							className: "mt-3 flex flex-col gap-2 text-xs font-medium text-[#777d73]",
							children: group.links.map((item) => /* @__PURE__ */ jsx(FooterLink, {
								href: item.href,
								children: item.label
							}, `${group.title}-${item.label}-${item.href}`))
						})] }, group.title))
					}),
					/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("h3", {
						className: "text-xs font-bold text-[#30362f]",
						children: content.footer.legal_title
					}), /* @__PURE__ */ jsx("div", {
						className: "mt-3 flex flex-col gap-2 text-xs font-medium text-[#777d73]",
						children: content.footer.legal_links.map((item) => /* @__PURE__ */ jsx(FooterLink, {
							href: item.href,
							children: item.label
						}, `${item.label}-${item.href}`))
					})] }),
					/* @__PURE__ */ jsx("div", {
						className: "text-xs font-medium text-[#92978d] lg:col-span-3 lg:text-center",
						children: content.footer.copyright
					})
				]
			})
		]
	});
}
//#endregion
//#region resources/js/pages/marketing/changelog.tsx
var changelog_exports$2 = /* @__PURE__ */ __exportAll({ default: () => MarketingChangelog });
function MarketingChangelog({ shell, brand, entries }) {
	const { t } = useT();
	return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Head, {
		title: t("Changelog — :brand", { brand }),
		children: /* @__PURE__ */ jsx("meta", {
			name: "description",
			content: t("Release notes for :brand — every shipped change, organised by version.", { brand })
		})
	}), /* @__PURE__ */ jsxs(MarketingShell, {
		content: shell,
		children: [/* @__PURE__ */ jsx("section", {
			className: "mx-auto max-w-3xl px-6 pt-16 pb-10 lg:pt-20",
			children: /* @__PURE__ */ jsx("div", {
				className: "flex items-end justify-between gap-4",
				children: /* @__PURE__ */ jsxs("div", { children: [
					/* @__PURE__ */ jsx("span", {
						className: "inline-flex items-center gap-2 rounded-full border border-slate-900/10 bg-white/85 px-3 py-1 text-xs font-semibold tracking-[0.2em] text-slate-600 uppercase",
						children: t("Changelog")
					}),
					/* @__PURE__ */ jsx("h1", {
						className: "mt-5 text-4xl font-bold tracking-tight text-slate-950 sm:text-5xl",
						children: t("What's new in :brand", { brand })
					}),
					/* @__PURE__ */ jsxs("p", {
						className: "mt-4 max-w-2xl text-base leading-7 text-slate-600",
						children: [
							t("Every shipped change, newest first. Linkable per version — anchor on"),
							" ",
							/* @__PURE__ */ jsx("code", {
								className: "rounded bg-slate-100 px-1 font-mono text-sm",
								children: "#vX.Y.Z"
							}),
							"."
						]
					})
				] })
			})
		}), /* @__PURE__ */ jsx("section", {
			className: "mx-auto max-w-3xl px-6 pb-24",
			children: entries.length === 0 ? /* @__PURE__ */ jsx("p", {
				className: "text-sm text-slate-500",
				children: t("No published entries yet.")
			}) : /* @__PURE__ */ jsx("div", {
				className: "grid gap-12",
				children: entries.map((entry) => /* @__PURE__ */ jsxs("article", {
					id: entry.version,
					className: "scroll-mt-24",
					children: [
						/* @__PURE__ */ jsxs("header", {
							className: "flex flex-wrap items-baseline gap-3 border-b border-slate-900/10 pb-3",
							children: [/* @__PURE__ */ jsx("h2", {
								className: "font-mono text-2xl font-bold tracking-tight text-slate-950",
								children: entry.version
							}), entry.released_at_human && /* @__PURE__ */ jsx("time", {
								className: "text-sm text-slate-500",
								dateTime: entry.released_at ?? void 0,
								children: entry.released_at_human
							})]
						}),
						/* @__PURE__ */ jsx("h3", {
							className: "mt-4 text-lg font-semibold text-slate-900",
							children: entry.title
						}),
						/* @__PURE__ */ jsx("div", {
							className: "mt-3 text-[15px] leading-7 text-slate-700",
							children: /* @__PURE__ */ jsx(MarkdownLite, {
								markdown: entry.body,
								variant: "changelog"
							})
						})
					]
				}, entry.version))
			})
		})]
	})] });
}
//#endregion
//#region resources/js/routes/marketing/index.ts
/**
* @see \App\Http\Controllers\MarketingController::pricing
* @see app/Http/Controllers/MarketingController.php:47
* @route '/pricing'
*/
var pricing = (options) => ({
	url: pricing.url(options),
	method: "get"
});
pricing.definition = {
	methods: ["get", "head"],
	url: "/pricing"
};
/**
* @see \App\Http\Controllers\MarketingController::pricing
* @see app/Http/Controllers/MarketingController.php:47
* @route '/pricing'
*/
pricing.url = (options) => {
	return pricing.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\MarketingController::pricing
* @see app/Http/Controllers/MarketingController.php:47
* @route '/pricing'
*/
pricing.get = (options) => ({
	url: pricing.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\MarketingController::pricing
* @see app/Http/Controllers/MarketingController.php:47
* @route '/pricing'
*/
pricing.head = (options) => ({
	url: pricing.url(options),
	method: "head"
});
/**
* @see \App\Http\Controllers\MarketingController::pricing
* @see app/Http/Controllers/MarketingController.php:47
* @route '/pricing'
*/
var pricingForm = (options) => ({
	action: pricing.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\MarketingController::pricing
* @see app/Http/Controllers/MarketingController.php:47
* @route '/pricing'
*/
pricingForm.get = (options) => ({
	action: pricing.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\MarketingController::pricing
* @see app/Http/Controllers/MarketingController.php:47
* @route '/pricing'
*/
pricingForm.head = (options) => ({
	action: pricing.url({ [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
pricing.form = pricingForm;
/**
* @see \App\Http\Controllers\MarketingController::howItWorks
* @see app/Http/Controllers/MarketingController.php:116
* @route '/how-it-works'
*/
var howItWorks = (options) => ({
	url: howItWorks.url(options),
	method: "get"
});
howItWorks.definition = {
	methods: ["get", "head"],
	url: "/how-it-works"
};
/**
* @see \App\Http\Controllers\MarketingController::howItWorks
* @see app/Http/Controllers/MarketingController.php:116
* @route '/how-it-works'
*/
howItWorks.url = (options) => {
	return howItWorks.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\MarketingController::howItWorks
* @see app/Http/Controllers/MarketingController.php:116
* @route '/how-it-works'
*/
howItWorks.get = (options) => ({
	url: howItWorks.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\MarketingController::howItWorks
* @see app/Http/Controllers/MarketingController.php:116
* @route '/how-it-works'
*/
howItWorks.head = (options) => ({
	url: howItWorks.url(options),
	method: "head"
});
/**
* @see \App\Http\Controllers\MarketingController::howItWorks
* @see app/Http/Controllers/MarketingController.php:116
* @route '/how-it-works'
*/
var howItWorksForm = (options) => ({
	action: howItWorks.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\MarketingController::howItWorks
* @see app/Http/Controllers/MarketingController.php:116
* @route '/how-it-works'
*/
howItWorksForm.get = (options) => ({
	action: howItWorks.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\MarketingController::howItWorks
* @see app/Http/Controllers/MarketingController.php:116
* @route '/how-it-works'
*/
howItWorksForm.head = (options) => ({
	action: howItWorks.url({ [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
howItWorks.form = howItWorksForm;
/**
* @see \App\Http\Controllers\MarketingController::integrations
* @see app/Http/Controllers/MarketingController.php:128
* @route '/integrations'
*/
var integrations = (options) => ({
	url: integrations.url(options),
	method: "get"
});
integrations.definition = {
	methods: ["get", "head"],
	url: "/integrations"
};
/**
* @see \App\Http\Controllers\MarketingController::integrations
* @see app/Http/Controllers/MarketingController.php:128
* @route '/integrations'
*/
integrations.url = (options) => {
	return integrations.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\MarketingController::integrations
* @see app/Http/Controllers/MarketingController.php:128
* @route '/integrations'
*/
integrations.get = (options) => ({
	url: integrations.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\MarketingController::integrations
* @see app/Http/Controllers/MarketingController.php:128
* @route '/integrations'
*/
integrations.head = (options) => ({
	url: integrations.url(options),
	method: "head"
});
/**
* @see \App\Http\Controllers\MarketingController::integrations
* @see app/Http/Controllers/MarketingController.php:128
* @route '/integrations'
*/
var integrationsForm = (options) => ({
	action: integrations.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\MarketingController::integrations
* @see app/Http/Controllers/MarketingController.php:128
* @route '/integrations'
*/
integrationsForm.get = (options) => ({
	action: integrations.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\MarketingController::integrations
* @see app/Http/Controllers/MarketingController.php:128
* @route '/integrations'
*/
integrationsForm.head = (options) => ({
	action: integrations.url({ [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
integrations.form = integrationsForm;
/**
* @see \App\Http\Controllers\MarketingController::privacy
* @see app/Http/Controllers/MarketingController.php:141
* @route '/privacy'
*/
var privacy$1 = (options) => ({
	url: privacy$1.url(options),
	method: "get"
});
privacy$1.definition = {
	methods: ["get", "head"],
	url: "/privacy"
};
/**
* @see \App\Http\Controllers\MarketingController::privacy
* @see app/Http/Controllers/MarketingController.php:141
* @route '/privacy'
*/
privacy$1.url = (options) => {
	return privacy$1.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\MarketingController::privacy
* @see app/Http/Controllers/MarketingController.php:141
* @route '/privacy'
*/
privacy$1.get = (options) => ({
	url: privacy$1.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\MarketingController::privacy
* @see app/Http/Controllers/MarketingController.php:141
* @route '/privacy'
*/
privacy$1.head = (options) => ({
	url: privacy$1.url(options),
	method: "head"
});
/**
* @see \App\Http\Controllers\MarketingController::privacy
* @see app/Http/Controllers/MarketingController.php:141
* @route '/privacy'
*/
var privacyForm = (options) => ({
	action: privacy$1.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\MarketingController::privacy
* @see app/Http/Controllers/MarketingController.php:141
* @route '/privacy'
*/
privacyForm.get = (options) => ({
	action: privacy$1.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\MarketingController::privacy
* @see app/Http/Controllers/MarketingController.php:141
* @route '/privacy'
*/
privacyForm.head = (options) => ({
	action: privacy$1.url({ [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
privacy$1.form = privacyForm;
/**
* @see \App\Http\Controllers\MarketingController::terms
* @see app/Http/Controllers/MarketingController.php:154
* @route '/terms'
*/
var terms = (options) => ({
	url: terms.url(options),
	method: "get"
});
terms.definition = {
	methods: ["get", "head"],
	url: "/terms"
};
/**
* @see \App\Http\Controllers\MarketingController::terms
* @see app/Http/Controllers/MarketingController.php:154
* @route '/terms'
*/
terms.url = (options) => {
	return terms.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\MarketingController::terms
* @see app/Http/Controllers/MarketingController.php:154
* @route '/terms'
*/
terms.get = (options) => ({
	url: terms.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\MarketingController::terms
* @see app/Http/Controllers/MarketingController.php:154
* @route '/terms'
*/
terms.head = (options) => ({
	url: terms.url(options),
	method: "head"
});
/**
* @see \App\Http\Controllers\MarketingController::terms
* @see app/Http/Controllers/MarketingController.php:154
* @route '/terms'
*/
var termsForm = (options) => ({
	action: terms.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\MarketingController::terms
* @see app/Http/Controllers/MarketingController.php:154
* @route '/terms'
*/
termsForm.get = (options) => ({
	action: terms.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\MarketingController::terms
* @see app/Http/Controllers/MarketingController.php:154
* @route '/terms'
*/
termsForm.head = (options) => ({
	action: terms.url({ [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
terms.form = termsForm;
/**
* @see \App\Http\Controllers\MarketingController::start
* @see app/Http/Controllers/MarketingController.php:172
* @route '/marketing/start'
*/
var start = (options) => ({
	url: start.url(options),
	method: "post"
});
start.definition = {
	methods: ["post"],
	url: "/marketing/start"
};
/**
* @see \App\Http\Controllers\MarketingController::start
* @see app/Http/Controllers/MarketingController.php:172
* @route '/marketing/start'
*/
start.url = (options) => {
	return start.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\MarketingController::start
* @see app/Http/Controllers/MarketingController.php:172
* @route '/marketing/start'
*/
start.post = (options) => ({
	url: start.url(options),
	method: "post"
});
/**
* @see \App\Http\Controllers\MarketingController::start
* @see app/Http/Controllers/MarketingController.php:172
* @route '/marketing/start'
*/
var startForm = (options) => ({
	action: start.url(options),
	method: "post"
});
/**
* @see \App\Http\Controllers\MarketingController::start
* @see app/Http/Controllers/MarketingController.php:172
* @route '/marketing/start'
*/
startForm.post = (options) => ({
	action: start.url(options),
	method: "post"
});
start.form = startForm;
Object.assign(pricing, pricing), Object.assign(howItWorks, howItWorks), Object.assign(integrations, integrations), Object.assign(privacy$1, privacy$1), Object.assign(terms, terms), Object.assign(start, start);
//#endregion
//#region resources/js/pages/marketing/home.tsx
var home_exports$2 = /* @__PURE__ */ __exportAll({ default: () => MarketingHome });
var iconMap$1 = {
	BarChart3,
	BookOpen,
	Box,
	CircleCheck,
	ClipboardList,
	Clock3,
	LockKeyhole,
	ShieldCheck,
	Sparkles,
	Tags,
	Target,
	TrendingUp,
	Zap
};
var pineButtonClass = "bg-[#173f2c] text-[#f7f4ec] hover:bg-[#123322] hover:text-[#f7f4ec]";
function resolveIcon(name, fallback = Sparkles) {
	return iconMap$1[name] ?? fallback;
}
/**
* Convert a Vimeo / YouTube URL into the matching embeddable iframe
* URL plus a public thumbnail URL we can render as the card preview.
* Falls back gracefully for anything we don't recognise.
*/
function toEmbedUrl(href) {
	if (!href) return {
		url: href,
		isEmbed: false,
		thumbnail: null
	};
	const vimeo = href.match(/vimeo\.com\/(?:video\/)?(\d+)/);
	if (vimeo) return {
		url: `https://player.vimeo.com/video/${vimeo[1]}?autoplay=1&muted=1&playsinline=1`,
		isEmbed: true,
		thumbnail: `https://vumbnail.com/${vimeo[1]}.jpg`
	};
	const youtube = href.match(/(?:youtu\.be\/|youtube\.com\/(?:watch\?v=|embed\/))([\w-]{11})/);
	if (youtube) return {
		url: `https://www.youtube.com/embed/${youtube[1]}?autoplay=1&mute=1&playsinline=1&rel=0`,
		isEmbed: true,
		thumbnail: `https://i.ytimg.com/vi/${youtube[1]}/maxresdefault.jpg`
	};
	return {
		url: href,
		isEmbed: false,
		thumbnail: null
	};
}
function resolveHref$1(href, primaryHref) {
	if (href === "__primary__") return typeof primaryHref === "string" ? primaryHref : primaryHref.url;
	return href;
}
function buildChartPath(points) {
	const resolvedPoints = points.length > 0 ? points : [0];
	const maxValue = Math.max(...resolvedPoints);
	const minValue = Math.min(...resolvedPoints);
	const chartTop = 42;
	const chartBottom = 205;
	const xStep = resolvedPoints.length > 1 ? 640 / (resolvedPoints.length - 1) : 0;
	return resolvedPoints.map((point, index) => {
		const ratio = maxValue === minValue ? .5 : (point - minValue) / (maxValue - minValue);
		const x = index * xStep;
		const y = chartBottom - ratio * (chartBottom - chartTop);
		return `${index === 0 ? "M" : "L"}${x.toFixed(2)} ${y.toFixed(2)}`;
	}).join(" ");
}
function SectionLabel({ children }) {
	return /* @__PURE__ */ jsx(Badge, {
		variant: "secondary",
		className: "rounded-md border border-[#e2ddcf] bg-[#eff1e8] px-3 py-1 text-[10px] font-bold text-[#7d826f] uppercase",
		children
	});
}
function LogoMark({ className }) {
	return /* @__PURE__ */ jsx("span", {
		className: cn("flex items-center justify-center text-[#173f2c]", className),
		children: /* @__PURE__ */ jsx(AppLogoIcon, { className: "size-full" })
	});
}
function FeatureIcon({ icon: Icon, dark = false }) {
	return /* @__PURE__ */ jsx("span", {
		className: cn("flex size-12 items-center justify-center rounded-full border", dark ? "border-[#3d6147] bg-[#254b35] text-[#dcebd4]" : "border-[#e3dccb] bg-[#f4f1e8] text-[#214a36]"),
		children: /* @__PURE__ */ jsx(Icon, { className: "size-5" })
	});
}
function ChatPreview({ content, brandName }) {
	return /* @__PURE__ */ jsxs(Card, {
		className: "mx-auto w-full max-w-[540px] overflow-hidden rounded-[28px] border-[#e3dccf] bg-[#fbf9f3] shadow-[0_18px_70px_rgba(28,37,29,0.10)]",
		children: [
			/* @__PURE__ */ jsxs(CardHeader, {
				className: "flex-row items-center justify-between border-b border-[#ebe4d8] px-7 py-6",
				children: [/* @__PURE__ */ jsxs("div", {
					className: "flex items-center gap-3",
					children: [/* @__PURE__ */ jsx("span", { className: "size-2.5 rounded-full bg-[#52ad6a]" }), /* @__PURE__ */ jsx(CardTitle, {
						className: "text-[15px] font-bold text-[#2a3028]",
						children: content.title
					})]
				}), /* @__PURE__ */ jsx(Badge, {
					className: "rounded-full bg-[#e9f2e3] px-3 py-1 text-xs font-bold text-[#62805a]",
					children: content.badge
				})]
			}),
			/* @__PURE__ */ jsxs(CardContent, {
				className: "flex flex-col gap-5 px-7 py-7",
				children: [
					/* @__PURE__ */ jsxs("div", {
						className: "ms-auto flex max-w-[360px] items-start gap-3",
						children: [/* @__PURE__ */ jsx("div", {
							className: "rounded-2xl rounded-se-sm border border-[#e7dfd2] bg-[#f7f2ea] px-5 py-4 text-sm leading-6 font-medium text-[#4f514c] shadow-sm",
							children: content.question
						}), /* @__PURE__ */ jsx("div", { className: "size-10 shrink-0 rounded-full border-2 border-[#f5eee3] bg-[linear-gradient(135deg,#744026,#e2b98d)]" })]
					}),
					/* @__PURE__ */ jsxs("div", {
						className: "flex items-start gap-4",
						children: [/* @__PURE__ */ jsx(LogoMark, { className: "mt-3 size-11 rounded-full border border-[#d8d2c4] bg-[#fbf8ef] p-2.5 shadow-sm" }), /* @__PURE__ */ jsxs("div", {
							className: "flex max-w-[350px] flex-col gap-4",
							children: [/* @__PURE__ */ jsx("div", {
								className: "rounded-2xl rounded-ss-sm border border-[#e7dfd2] bg-white px-5 py-4 text-sm leading-6 font-medium text-[#40443d] shadow-sm",
								children: content.answer
							}), /* @__PURE__ */ jsxs("div", {
								className: "rounded-[18px] border border-[#e2dbcd] bg-[#fbf8ef] p-5 shadow-[0_18px_42px_rgba(48,43,34,0.08)]",
								children: [
									/* @__PURE__ */ jsx(Badge, {
										className: "rounded-md bg-[#e9ebe1] px-2 py-1 text-[10px] font-bold text-[#77806f]",
										children: content.plan_badge
									}),
									/* @__PURE__ */ jsxs("div", {
										className: "mt-4",
										children: [
											/* @__PURE__ */ jsx("p", {
												className: "text-lg font-bold text-[#3d403b]",
												children: content.plan_name
											}),
											/* @__PURE__ */ jsxs("div", {
												className: "mt-1 flex items-end gap-1 text-[#2e332d]",
												children: [/* @__PURE__ */ jsx("span", {
													className: "text-4xl font-semibold tracking-normal",
													children: content.plan_price
												}), /* @__PURE__ */ jsx("span", {
													className: "pb-1 text-sm text-[#777a70]",
													children: content.plan_interval
												})]
											}),
											/* @__PURE__ */ jsx("p", {
												className: "mt-2 text-xs text-[#777a70]",
												children: content.plan_note
											})
										]
									}),
									/* @__PURE__ */ jsx("div", {
										className: "mt-4 flex flex-col gap-2 text-xs font-medium text-[#536154]",
										children: content.plan_features.map((item) => /* @__PURE__ */ jsxs("div", {
											className: "flex items-center gap-2",
											children: [/* @__PURE__ */ jsx(Check, { className: "size-3.5 text-[#315f42]" }), /* @__PURE__ */ jsx("span", { children: item })]
										}, item))
									}),
									/* @__PURE__ */ jsx(Button, {
										className: cn("mt-5 h-10 w-full rounded-md text-sm font-bold", pineButtonClass),
										children: content.plan_button_label
									})
								]
							})]
						})]
					}),
					/* @__PURE__ */ jsxs("div", {
						className: "ms-20 flex w-fit items-center gap-2 rounded-lg border border-[#e6dfd2] bg-white px-4 py-2 text-xs font-medium text-[#818477] shadow-xs",
						children: [/* @__PURE__ */ jsxs("span", {
							className: "flex gap-1",
							children: [
								/* @__PURE__ */ jsx("span", { className: "size-1.5 rounded-full bg-[#95c780]" }),
								/* @__PURE__ */ jsx("span", { className: "size-1.5 rounded-full bg-[#95c780]" }),
								/* @__PURE__ */ jsx("span", { className: "size-1.5 rounded-full bg-[#95c780]" })
							]
						}), content.typing_label]
					})
				]
			}),
			/* @__PURE__ */ jsxs("div", {
				className: "border-t border-[#ebe4d8] py-4 text-center text-xs font-medium text-[#aaa394]",
				children: [
					content.powered_by_prefix,
					" ",
					/* @__PURE__ */ jsx("span", {
						className: "font-bold text-[#7e8176]",
						children: brandName
					}),
					/* @__PURE__ */ jsx(LogoMark, { className: "ms-1 inline-flex size-3 align-[-2px]" })
				]
			})
		]
	});
}
function GrowthChart({ content }) {
	const { t } = useT();
	const linePath = buildChartPath(content.chart_points);
	const areaPath = `${linePath} L640 250 L0 250 Z`;
	const labels = content.chart_labels.length > 0 ? content.chart_labels : [t("Now")];
	return /* @__PURE__ */ jsx(Card, {
		className: "rounded-xl border-[#ded8ca] bg-[#eef2e8] shadow-none",
		children: /* @__PURE__ */ jsxs(CardContent, {
			className: "p-8",
			children: [
				/* @__PURE__ */ jsx("h3", {
					className: "marketing-display max-w-md text-4xl leading-none text-[#252a24]",
					children: content.chart_title
				}),
				/* @__PURE__ */ jsx("p", {
					className: "mt-5 max-w-md text-sm leading-6 font-medium text-[#6c7068]",
					children: content.chart_description
				}),
				/* @__PURE__ */ jsxs("div", {
					className: "mt-7",
					children: [/* @__PURE__ */ jsx("p", {
						className: "text-xs font-medium text-[#6c7068]",
						children: content.metric_label
					}), /* @__PURE__ */ jsxs("div", {
						className: "mt-1 flex items-end gap-3",
						children: [/* @__PURE__ */ jsx("span", {
							className: "text-4xl font-semibold text-[#212720]",
							children: content.metric_value
						}), /* @__PURE__ */ jsx("span", {
							className: "pb-1 text-xs font-bold text-[#76816e]",
							children: content.metric_trend
						})]
					})]
				}),
				/* @__PURE__ */ jsx("div", {
					className: "mt-8 overflow-hidden rounded-lg",
					children: /* @__PURE__ */ jsxs("svg", {
						viewBox: "0 0 640 250",
						role: "img",
						"aria-label": content.chart_title,
						className: "h-auto w-full",
						children: [
							/* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs("linearGradient", {
								id: "growthFill",
								x1: "0",
								x2: "0",
								y1: "0",
								y2: "1",
								children: [/* @__PURE__ */ jsx("stop", {
									offset: "0%",
									stopColor: "#5d7f5d",
									stopOpacity: "0.2"
								}), /* @__PURE__ */ jsx("stop", {
									offset: "100%",
									stopColor: "#5d7f5d",
									stopOpacity: "0"
								})]
							}) }),
							[
								40,
								90,
								140,
								190
							].map((y) => /* @__PURE__ */ jsx("line", {
								x1: "0",
								x2: "640",
								y1: y,
								y2: y,
								stroke: "#d6ddce",
								strokeWidth: "1"
							}, y)),
							/* @__PURE__ */ jsx("path", {
								d: areaPath,
								fill: "url(#growthFill)"
							}),
							/* @__PURE__ */ jsx("path", {
								d: linePath,
								fill: "none",
								stroke: "#4d704e",
								strokeLinecap: "round",
								strokeLinejoin: "round",
								strokeWidth: "5"
							}),
							labels.map((label, index) => /* @__PURE__ */ jsx("text", {
								x: labels.length > 1 ? 64 + index * 520 / (labels.length - 1) : 320,
								y: "238",
								fill: "#7a8174",
								fontSize: "14",
								textAnchor: "middle",
								children: label
							}, label))
						]
					})
				})
			]
		})
	});
}
/**
* Initials fallback when a testimonial has no avatar image. Two
* letters max, uppercase. Stable across renders for a given name so
* the swatch colour stays the same.
*/
function initialsFor(name) {
	const parts = name.trim().split(/\s+/).filter(Boolean);
	if (parts.length === 0) return "–";
	if (parts.length === 1) return parts[0].slice(0, 2).toUpperCase();
	return (parts[0][0] + parts[parts.length - 1][0]).toUpperCase();
}
/**
* Auto-advancing testimonial carousel. Pure-Preact, no Embla / Splide
* dependency — keeps the marketing bundle small. Auto-advances every
* 7 s, pauses on hover/focus, supports arrow keys and the visible
* prev/next buttons. Dot pagination at the bottom.
*
* Renders one card at a time on every viewport — the testimonial
* lives or dies on the quote being readable, so we don't squeeze two
* onto a phone screen.
*/
function TestimonialCarousel({ content }) {
	const { t } = useT();
	const items = content.items;
	const [active, setActive] = useState(0);
	const [paused, setPaused] = useState(false);
	const containerRef = useRef(null);
	const count = items.length;
	useEffect(() => {
		if (count <= 1 || paused) return;
		const id = window.setInterval(() => {
			setActive((i) => (i + 1) % count);
		}, 7e3);
		return () => window.clearInterval(id);
	}, [count, paused]);
	if (count === 0) return null;
	const prev = () => setActive((i) => (i - 1 + count) % count);
	const next = () => setActive((i) => (i + 1) % count);
	const handleKey = (e) => {
		if (e.key === "ArrowLeft") {
			e.preventDefault();
			prev();
		} else if (e.key === "ArrowRight") {
			e.preventDefault();
			next();
		}
	};
	const current = items[active];
	return /* @__PURE__ */ jsx("section", {
		className: "bg-[#f4f0e8]",
		children: /* @__PURE__ */ jsx("div", {
			className: "mx-auto max-w-[1200px] px-6 py-20 lg:px-10",
			children: /* @__PURE__ */ jsxs("div", {
				className: "grid gap-10 lg:grid-cols-[0.78fr_1.45fr] lg:items-start",
				children: [/* @__PURE__ */ jsxs("div", { children: [
					/* @__PURE__ */ jsx(SectionLabel, { children: content.badge }),
					/* @__PURE__ */ jsx("h2", {
						className: "marketing-display mt-5 max-w-[520px] text-4xl leading-none text-[#173f2c] sm:text-5xl",
						children: content.title
					}),
					/* @__PURE__ */ jsx("p", {
						className: "mt-5 max-w-[420px] text-base leading-7 font-medium text-[#3d6a4d]",
						children: content.kicker
					})
				] }), /* @__PURE__ */ jsxs("div", {
					ref: containerRef,
					role: "region",
					"aria-label": t("Customer testimonials"),
					"aria-roledescription": t("carousel"),
					tabIndex: 0,
					onMouseEnter: () => setPaused(true),
					onMouseLeave: () => setPaused(false),
					onFocus: () => setPaused(true),
					onBlur: () => setPaused(false),
					onKeyDown: handleKey,
					className: "rounded-3xl border border-[#173f2c]/10 bg-white p-7 shadow-[0_24px_48px_-32px_rgba(23,63,44,0.45)] focus:outline-none focus-visible:ring-2 focus-visible:ring-[#173f2c]/40 sm:p-9",
					children: [
						/* @__PURE__ */ jsx(Quote, {
							className: "size-7 text-[#173f2c]/30",
							"aria-hidden": "true"
						}),
						/* @__PURE__ */ jsx("blockquote", {
							className: "mt-4 text-lg leading-8 text-[#173f2c] sm:text-xl sm:leading-9",
							children: current.quote
						}, `quote-${active}`),
						/* @__PURE__ */ jsxs("div", {
							className: "mt-7 flex items-center gap-4",
							children: [/* @__PURE__ */ jsx("span", {
								"aria-hidden": "true",
								className: "flex size-11 shrink-0 items-center justify-center rounded-full bg-[#173f2c] text-sm font-bold text-[#f4f0e8]",
								children: initialsFor(current.name)
							}), /* @__PURE__ */ jsxs("div", {
								className: "min-w-0",
								children: [/* @__PURE__ */ jsx("p", {
									className: "text-sm font-bold text-[#173f2c]",
									children: current.name
								}), /* @__PURE__ */ jsxs("p", {
									className: "truncate text-xs font-medium text-[#3d6a4d]",
									children: [current.role, current.company ? ` · ${current.company}` : ""]
								})]
							})]
						}),
						count > 1 && /* @__PURE__ */ jsxs("div", {
							className: "mt-7 flex items-center justify-between gap-4 border-t border-[#173f2c]/10 pt-5",
							children: [/* @__PURE__ */ jsx("div", {
								role: "tablist",
								"aria-label": t("Testimonial pagination"),
								className: "flex items-center gap-1.5",
								children: items.map((_, i) => /* @__PURE__ */ jsx("button", {
									type: "button",
									role: "tab",
									"aria-selected": i === active,
									"aria-label": t("Show testimonial :index of :count", {
										index: i + 1,
										count
									}),
									onClick: () => setActive(i),
									className: cn("h-1.5 rounded-full transition-all", i === active ? "w-8 bg-[#173f2c]" : "w-3 bg-[#173f2c]/20 hover:bg-[#173f2c]/40")
								}, i))
							}), /* @__PURE__ */ jsxs("div", {
								className: "flex items-center gap-2",
								children: [/* @__PURE__ */ jsx("button", {
									type: "button",
									onClick: prev,
									"aria-label": t("Previous testimonial"),
									className: "flex size-9 items-center justify-center rounded-full border border-[#173f2c]/15 text-[#173f2c] transition hover:bg-[#173f2c] hover:text-[#f4f0e8]",
									children: /* @__PURE__ */ jsx(DirArrow, {
										direction: "back",
										style: "chevron",
										className: "size-4"
									})
								}), /* @__PURE__ */ jsx("button", {
									type: "button",
									onClick: next,
									"aria-label": t("Next testimonial"),
									className: "flex size-9 items-center justify-center rounded-full border border-[#173f2c]/15 text-[#173f2c] transition hover:bg-[#173f2c] hover:text-[#f4f0e8]",
									children: /* @__PURE__ */ jsx(DirArrow, {
										direction: "forward",
										style: "chevron",
										className: "size-4"
									})
								})]
							})]
						})
					]
				})]
			})
		})
	});
}
/**
* FAQ accordion. Multi-open allowed (one item being open doesn't
* collapse the others) — visitors are allowed to compare two answers
* side by side. Dependency-free: just a Set<number> in state and
* controlled <details>-style toggle.
*/
function FaqAccordion({ content }) {
	const items = content.items;
	const [open, setOpen] = useState(() => new Set([0]));
	if (items.length === 0) return null;
	const toggle = (i) => {
		setOpen((prev) => {
			const next = new Set(prev);
			if (next.has(i)) next.delete(i);
			else next.add(i);
			return next;
		});
	};
	return /* @__PURE__ */ jsx("section", {
		className: "mx-auto max-w-[1200px] px-6 py-20 lg:px-10",
		children: /* @__PURE__ */ jsxs("div", {
			className: "grid gap-12 lg:grid-cols-[0.78fr_1.45fr] lg:items-start",
			children: [/* @__PURE__ */ jsxs("div", { children: [
				/* @__PURE__ */ jsx(SectionLabel, { children: content.badge }),
				/* @__PURE__ */ jsx("h2", {
					className: "marketing-display mt-5 max-w-[480px] text-4xl leading-none text-[#173f2c] sm:text-5xl",
					children: content.title
				}),
				/* @__PURE__ */ jsx("p", {
					className: "mt-5 max-w-[420px] text-base leading-7 font-medium text-[#3d6a4d]",
					children: content.kicker
				})
			] }), /* @__PURE__ */ jsx("ul", {
				className: "grid gap-3",
				children: items.map((item, i) => {
					const isOpen = open.has(i);
					return /* @__PURE__ */ jsxs("li", {
						className: cn("rounded-2xl border bg-white transition-colors", isOpen ? "border-[#173f2c]/40 shadow-[0_12px_36px_-28px_rgba(23,63,44,0.5)]" : "border-[#173f2c]/12 hover:border-[#173f2c]/25"),
						children: [/* @__PURE__ */ jsxs("button", {
							type: "button",
							onClick: () => toggle(i),
							"aria-expanded": isOpen,
							"aria-controls": `faq-panel-${i}`,
							id: `faq-trigger-${i}`,
							className: "flex w-full items-start gap-4 px-5 py-4 text-start transition-colors hover:bg-[#173f2c]/[0.03] sm:px-6 sm:py-5",
							children: [/* @__PURE__ */ jsx("span", {
								className: "flex-1 text-base font-semibold text-[#173f2c] sm:text-lg",
								children: item.question
							}), /* @__PURE__ */ jsx("span", {
								"aria-hidden": "true",
								className: cn("mt-0.5 flex size-7 shrink-0 items-center justify-center rounded-full border transition-colors", isOpen ? "border-[#173f2c] bg-[#173f2c] text-[#f4f0e8]" : "border-[#173f2c]/25 text-[#173f2c]"),
								children: isOpen ? /* @__PURE__ */ jsx(Minus, { className: "size-3.5" }) : /* @__PURE__ */ jsx(Plus, { className: "size-3.5" })
							})]
						}), isOpen && /* @__PURE__ */ jsx("div", {
							role: "region",
							id: `faq-panel-${i}`,
							"aria-labelledby": `faq-trigger-${i}`,
							className: "px-5 pb-5 text-sm leading-7 text-[#3d6a4d] sm:px-6 sm:pb-6 sm:text-base",
							children: item.answer
						})]
					}, i);
				})
			})]
		})
	});
}
function MarketingHome({ canRegister, demoAgentId, content }) {
	const branding = useBranding();
	const [videoOpen, setVideoOpen] = useState(false);
	const videoEmbed = useMemo(() => toEmbedUrl(content.video.href), [content.video.href]);
	const { auth, demo } = usePage().props;
	const hasUser = Boolean(auth.user);
	const siteTitle = branding.site_title || content.brand_name;
	const primaryHref = hasUser ? dashboard$1() : canRegister ? register$1() : login$3();
	const ctaTargetProps = Boolean(demo) && !hasUser ? {
		target: "_blank",
		rel: "noopener noreferrer"
	} : {};
	return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Head, {
		title: "",
		children: /* @__PURE__ */ jsx("meta", {
			name: "description",
			content: content.hero.description
		})
	}), /* @__PURE__ */ jsx(MarketingShell, {
		content,
		children: /* @__PURE__ */ jsxs("div", {
			className: "bg-[#f7f2e8]",
			children: [
				/* @__PURE__ */ jsxs("section", {
					className: "mx-auto grid max-w-[1240px] gap-14 px-6 pt-14 pb-16 lg:grid-cols-[0.95fr_1fr] lg:items-start lg:px-10 lg:pt-20 lg:pb-20",
					children: [/* @__PURE__ */ jsxs("div", {
						className: "flex flex-col gap-8",
						children: [
							/* @__PURE__ */ jsx(SectionLabel, { children: content.hero.badge }),
							/* @__PURE__ */ jsxs("div", {
								className: "flex flex-col gap-6",
								children: [/* @__PURE__ */ jsxs("h1", {
									className: "marketing-display max-w-[610px] text-[2.75rem] leading-[1.0] break-words text-[#252621] sm:text-[5.35rem] sm:leading-[0.95] lg:text-[5.6rem] xl:text-[5.95rem]",
									children: [
										/* @__PURE__ */ jsx("span", {
											className: "block",
											children: content.hero.line_one
										}),
										/* @__PURE__ */ jsxs("span", {
											className: "block sm:whitespace-nowrap",
											children: [
												/* @__PURE__ */ jsx("span", {
													className: "text-[#1d5139] italic",
													children: content.hero.accent
												}),
												" ",
												/* @__PURE__ */ jsx("span", { children: content.hero.line_two_suffix })
											]
										}),
										/* @__PURE__ */ jsxs("span", {
											className: "block",
											children: [
												content.hero.line_three_prefix,
												" ",
												/* @__PURE__ */ jsxs("span", {
													className: "relative isolate inline-block w-fit text-[#173f2c]",
													children: [/* @__PURE__ */ jsx("span", {
														"aria-hidden": "true",
														className: "absolute inset-x-[-0.03em] bottom-[0.12em] -z-10 h-[0.2em] rounded-full bg-[#dce7ce]"
													}), /* @__PURE__ */ jsx("span", {
														className: "italic",
														children: content.hero.line_three_highlight
													})]
												})
											]
										}),
										/* @__PURE__ */ jsx("span", {
											className: "block",
											children: /* @__PURE__ */ jsxs("span", {
												className: "relative isolate inline-block w-fit pe-[0.04em] text-[#173f2c]",
												children: [/* @__PURE__ */ jsx("span", {
													"aria-hidden": "true",
													className: "absolute inset-x-[-0.03em] bottom-[0.12em] -z-10 h-[0.2em] rounded-full bg-[#dce7ce]"
												}), /* @__PURE__ */ jsx("span", {
													className: "italic",
													children: content.hero.line_four_highlight
												})]
											})
										})
									]
								}), /* @__PURE__ */ jsx("p", {
									className: "max-w-[560px] text-lg leading-8 font-medium text-[#666b62]",
									children: content.hero.description
								})]
							}),
							/* @__PURE__ */ jsxs("div", {
								className: "flex flex-col gap-7",
								children: [/* @__PURE__ */ jsxs("div", {
									className: "flex max-w-[520px] flex-col gap-3",
									children: [
										/* @__PURE__ */ jsx("p", {
											className: "text-[11px] font-bold text-[#8a8f82] uppercase",
											children: content.hero.site_test_label
										}),
										/* @__PURE__ */ jsx(Form, {
											...start.form(),
											className: "flex flex-col gap-2",
											children: ({ processing, errors }) => /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("div", {
												className: "flex rounded-lg border border-[#d9d2c3] bg-white p-1 shadow-[0_10px_30px_rgba(30,35,28,0.05)]",
												children: [/* @__PURE__ */ jsxs("div", {
													className: "flex min-w-0 grow items-center gap-3 px-3",
													children: [/* @__PURE__ */ jsx(Globe2, { className: "size-4 shrink-0 text-[#8a8f82]" }), /* @__PURE__ */ jsx(Input, {
														"aria-invalid": Boolean(errors.domain),
														className: "h-11 border-0 bg-transparent px-0 text-sm font-medium text-[#394039] shadow-none placeholder:text-[#a1a49a] focus-visible:ring-0",
														name: "domain",
														placeholder: content.hero.site_test_placeholder,
														required: true,
														type: "url"
													})]
												}), /* @__PURE__ */ jsx(Button, {
													className: cn("h-11 rounded-md px-5 text-sm font-bold", pineButtonClass),
													disabled: processing,
													type: "submit",
													children: content.hero.site_test_button_label
												})]
											}), errors.domain && /* @__PURE__ */ jsx("p", {
												className: "text-sm text-destructive",
												children: errors.domain
											})] })
										}),
										/* @__PURE__ */ jsxs("p", {
											className: "flex items-center gap-2 text-xs font-medium text-[#85887f]",
											children: [/* @__PURE__ */ jsx(LockKeyhole, { className: "size-3.5" }), content.hero.site_test_helper]
										})
									]
								}), demoAgentId && /* @__PURE__ */ jsx("p", {
									className: "text-sm font-semibold text-[#315f42]",
									children: content.hero.live_demo_notice
								})]
							})
						]
					}), /* @__PURE__ */ jsx(ChatPreview, {
						content: content.chat_preview,
						brandName: siteTitle
					})]
				}),
				/* @__PURE__ */ jsx("section", {
					className: "mx-auto max-w-[1200px] px-6 lg:px-10",
					children: /* @__PURE__ */ jsx(Card, {
						className: "rounded-xl border-[#ded8ca] bg-[#fbf8ef] shadow-none",
						children: /* @__PURE__ */ jsx(CardContent, {
							className: "grid p-0 sm:grid-cols-2 lg:grid-cols-4",
							children: content.stats.map((stat, index) => {
								return /* @__PURE__ */ jsxs("div", {
									className: "relative flex flex-col gap-4 px-10 py-8",
									children: [
										/* @__PURE__ */ jsx(resolveIcon(stat.icon, Sparkles), { className: "size-5 text-[#8a9284]" }),
										/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
											className: "text-4xl font-semibold text-[#2b302a]",
											children: stat.value
										}), /* @__PURE__ */ jsx("p", {
											className: "mt-3 max-w-[170px] text-sm leading-5 font-medium text-[#5e655d]",
											children: stat.label
										})] }),
										index < content.stats.length - 1 && /* @__PURE__ */ jsx(Separator, {
											className: "absolute end-0 top-1/2 hidden h-24 -translate-y-1/2 bg-[#e1d9ca] lg:block",
											orientation: "vertical"
										})
									]
								}, `${stat.value}-${index}`);
							})
						})
					})
				}),
				/* @__PURE__ */ jsxs("section", {
					className: "mx-auto grid max-w-[1200px] gap-12 px-6 py-24 lg:grid-cols-[0.78fr_1.22fr] lg:items-center lg:px-10",
					children: [
						/* @__PURE__ */ jsxs("div", {
							className: "flex flex-col gap-6",
							children: [
								/* @__PURE__ */ jsx(SectionLabel, { children: content.video.badge }),
								/* @__PURE__ */ jsx("h2", {
									className: "marketing-display max-w-[470px] text-4xl leading-none text-[#252621] sm:text-5xl",
									children: content.video.title
								}),
								/* @__PURE__ */ jsx("p", {
									className: "max-w-[470px] text-base leading-7 font-medium text-[#686d64]",
									children: content.video.description
								}),
								/* @__PURE__ */ jsx("div", {
									className: "flex flex-col gap-3 text-sm font-medium text-[#4c554c]",
									children: content.video.bullets.map((item) => /* @__PURE__ */ jsxs("div", {
										className: "flex items-center gap-3",
										children: [/* @__PURE__ */ jsx(Check, { className: "size-4 text-[#315f42]" }), /* @__PURE__ */ jsx("span", { children: item })]
									}, item))
								})
							]
						}),
						videoEmbed.isEmbed ? /* @__PURE__ */ jsx("button", {
							type: "button",
							onClick: () => setVideoOpen(true),
							"aria-label": content.video.button_label,
							className: "group block w-full text-start",
							children: /* @__PURE__ */ jsx(Card, {
								className: "overflow-hidden rounded-[30px] border-[#ded8ca] bg-[#fbf8ef] shadow-[0_24px_80px_rgba(29,37,28,0.10)] transition duration-200 group-hover:-translate-y-1 group-hover:shadow-[0_30px_90px_rgba(29,37,28,0.14)]",
								children: /* @__PURE__ */ jsxs(CardContent, {
									className: "p-0",
									children: [/* @__PURE__ */ jsxs("div", {
										className: "relative aspect-video overflow-hidden border-b border-[#e9e2d5] bg-[#0a0a0b]",
										children: [
											videoEmbed.thumbnail && /* @__PURE__ */ jsx("img", {
												src: videoEmbed.thumbnail,
												alt: content.video.title,
												loading: "lazy",
												className: "absolute inset-0 size-full object-cover transition duration-300 group-hover:scale-[1.02]"
											}),
											/* @__PURE__ */ jsx("div", { className: "absolute inset-0 bg-[linear-gradient(180deg,rgba(0,0,0,0.18)_0%,rgba(0,0,0,0)_28%,rgba(0,0,0,0)_60%,rgba(0,0,0,0.32)_100%)]" }),
											/* @__PURE__ */ jsxs("div", {
												className: "absolute start-5 top-5 flex flex-wrap items-center gap-2",
												children: [/* @__PURE__ */ jsx("span", {
													className: "rounded-full bg-white/95 px-3 py-1 text-[11px] font-bold tracking-[0.18em] text-[#2a3327] uppercase shadow-sm",
													children: content.video.duration_label
												}), /* @__PURE__ */ jsx("span", {
													className: "rounded-full bg-[#173f2c] px-3 py-1 text-[11px] font-bold tracking-[0.18em] text-[#eef5e9] uppercase shadow-sm",
													children: content.video.tag_label
												})]
											}),
											/* @__PURE__ */ jsx("span", {
												className: "absolute inset-0 flex items-center justify-center",
												children: /* @__PURE__ */ jsx("span", {
													className: "flex size-20 items-center justify-center rounded-full border border-white/70 bg-white/95 shadow-[0_18px_40px_rgba(0,0,0,0.32)] transition duration-200 group-hover:scale-105",
													children: /* @__PURE__ */ jsx(Play, { className: "ms-1 size-8 text-[#173f2c]" })
												})
											})
										]
									}), /* @__PURE__ */ jsxs("div", {
										className: "grid gap-4 px-6 py-5 md:grid-cols-[1fr_auto] md:items-center",
										children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
											className: "text-sm font-bold text-[#253129]",
											children: content.video.footer_title
										}), /* @__PURE__ */ jsx("p", {
											className: "mt-1 text-sm leading-6 font-medium text-[#6a7169]",
											children: content.video.footer_description
										})] }), /* @__PURE__ */ jsxs("div", {
											className: "inline-flex items-center gap-2 text-sm font-bold text-[#173f2c]",
											children: [content.video.button_label, /* @__PURE__ */ jsx(DirArrow, {
												direction: "forward",
												className: "size-4"
											})]
										})]
									})]
								})
							})
						}) : /* @__PURE__ */ jsx(Link, {
							href: content.video.href,
							className: "group block",
							children: /* @__PURE__ */ jsx(Card, {
								className: "overflow-hidden rounded-[30px] border-[#ded8ca] bg-[#fbf8ef] shadow-[0_24px_80px_rgba(29,37,28,0.10)] transition duration-200 group-hover:-translate-y-1 group-hover:shadow-[0_30px_90px_rgba(29,37,28,0.14)]",
								children: /* @__PURE__ */ jsxs(CardContent, {
									className: "px-6 py-6",
									children: [
										/* @__PURE__ */ jsx("p", {
											className: "text-sm font-bold text-[#253129]",
											children: content.video.footer_title
										}),
										/* @__PURE__ */ jsx("p", {
											className: "mt-1 text-sm leading-6 font-medium text-[#6a7169]",
											children: content.video.footer_description
										}),
										/* @__PURE__ */ jsxs("div", {
											className: "mt-4 inline-flex items-center gap-2 text-sm font-bold text-[#173f2c]",
											children: [content.video.button_label, /* @__PURE__ */ jsx(DirArrow, {
												direction: "forward",
												className: "size-4"
											})]
										})
									]
								})
							})
						}),
						/* @__PURE__ */ jsx(Dialog, {
							open: videoOpen,
							onOpenChange: setVideoOpen,
							children: /* @__PURE__ */ jsx(DialogContent, {
								className: "overflow-hidden border-none bg-black p-0 sm:max-w-4xl",
								children: videoEmbed.isEmbed && videoOpen && /* @__PURE__ */ jsx("div", {
									className: "relative w-full",
									style: { aspectRatio: "16 / 9" },
									children: /* @__PURE__ */ jsx("iframe", {
										src: videoEmbed.url,
										title: content.video.card_title,
										allow: "autoplay; fullscreen; picture-in-picture; encrypted-media",
										allowFullScreen: true,
										className: "absolute inset-0 size-full"
									})
								})
							})
						})
					]
				}),
				/* @__PURE__ */ jsxs("section", {
					className: "mx-auto grid max-w-[1200px] gap-12 px-6 py-24 lg:grid-cols-[0.8fr_1.4fr] lg:items-center lg:px-10",
					children: [/* @__PURE__ */ jsxs("div", {
						className: "flex flex-col gap-6",
						children: [/* @__PURE__ */ jsx(SectionLabel, { children: content.where_it_fits.badge }), /* @__PURE__ */ jsx("h2", {
							className: "marketing-display max-w-[440px] text-4xl leading-none text-[#252621] sm:text-5xl",
							children: content.where_it_fits.title
						})]
					}), /* @__PURE__ */ jsx("div", {
						className: "grid gap-5 md:grid-cols-3",
						children: content.where_it_fits.cards.map((item) => {
							return /* @__PURE__ */ jsx(Card, {
								className: "rounded-lg border-[#ded8ca] bg-[#fbf8ef] shadow-none",
								children: /* @__PURE__ */ jsxs(CardContent, {
									className: "flex min-h-[220px] flex-col gap-6 p-7",
									children: [/* @__PURE__ */ jsx(FeatureIcon, { icon: resolveIcon(item.icon, Sparkles) }), /* @__PURE__ */ jsxs("div", {
										className: "flex flex-col gap-3",
										children: [/* @__PURE__ */ jsx("h3", {
											className: "text-base font-bold text-[#2d332d]",
											children: item.title
										}), /* @__PURE__ */ jsx("p", {
											className: "text-sm leading-6 font-medium text-[#676d64]",
											children: item.description
										})]
									})]
								})
							}, item.title);
						})
					})]
				}),
				/* @__PURE__ */ jsx("section", {
					className: "bg-[#071b17] text-white",
					children: /* @__PURE__ */ jsxs("div", {
						className: "mx-auto grid max-w-[1240px] gap-12 px-6 py-20 lg:grid-cols-[0.7fr_1.4fr] lg:px-10",
						style: { backgroundImage: "repeating-radial-gradient(circle at 8% 56%, rgba(184, 223, 168, 0.12) 0 1px, transparent 1px 16px)" },
						children: [/* @__PURE__ */ jsxs("div", {
							className: "flex flex-col gap-6 pt-10",
							children: [/* @__PURE__ */ jsx(SectionLabel, { children: content.feature_grid.badge }), /* @__PURE__ */ jsx("h2", {
								className: "marketing-display max-w-[360px] text-5xl leading-none text-[#f4f0e8]",
								children: content.feature_grid.title
							})]
						}), /* @__PURE__ */ jsx("div", {
							className: "grid gap-5 md:grid-cols-2 xl:grid-cols-3",
							children: content.feature_grid.cards.map((item) => {
								return /* @__PURE__ */ jsx(Card, {
									className: "rounded-lg border-white/12 bg-white/[0.04] text-white shadow-none backdrop-blur-sm",
									children: /* @__PURE__ */ jsxs(CardContent, {
										className: "flex min-h-[190px] flex-col gap-6 p-7",
										children: [/* @__PURE__ */ jsx(FeatureIcon, {
											dark: true,
											icon: resolveIcon(item.icon, Sparkles)
										}), /* @__PURE__ */ jsxs("div", {
											className: "flex flex-col gap-3",
											children: [/* @__PURE__ */ jsx("h3", {
												className: "text-base font-bold text-[#f5f1e8]",
												children: item.title
											}), /* @__PURE__ */ jsx("p", {
												className: "text-sm leading-6 font-medium text-[#b5c2b7]",
												children: item.description
											})]
										})]
									})
								}, item.title);
							})
						})]
					})
				}),
				/* @__PURE__ */ jsxs("section", {
					className: "mx-auto grid max-w-[1200px] gap-14 px-6 py-20 lg:grid-cols-[0.78fr_1.45fr] lg:px-10",
					children: [/* @__PURE__ */ jsxs("div", {
						className: "flex flex-col gap-8",
						children: [/* @__PURE__ */ jsxs("div", {
							className: "flex flex-col gap-6",
							children: [
								/* @__PURE__ */ jsx(SectionLabel, { children: content.control.badge }),
								/* @__PURE__ */ jsx("h2", {
									className: "marketing-display max-w-[430px] text-4xl leading-none text-[#252621] sm:text-5xl",
									children: content.control.title
								}),
								/* @__PURE__ */ jsx("p", {
									className: "max-w-[420px] text-base leading-7 font-medium text-[#686d64]",
									children: content.control.description
								})
							]
						}), /* @__PURE__ */ jsx("div", {
							className: "flex flex-col gap-7",
							children: content.control.callouts.map((item) => {
								return /* @__PURE__ */ jsxs("div", {
									className: "flex gap-4",
									children: [/* @__PURE__ */ jsx(FeatureIcon, { icon: resolveIcon(item.icon, Sparkles) }), /* @__PURE__ */ jsxs("div", {
										className: "max-w-[330px]",
										children: [/* @__PURE__ */ jsx("h3", {
											className: "text-sm font-bold text-[#2d332d]",
											children: item.title
										}), /* @__PURE__ */ jsx("p", {
											className: "mt-1 text-sm leading-6 font-medium text-[#686d64]",
											children: item.description
										})]
									})]
								}, item.title);
							})
						})]
					}), /* @__PURE__ */ jsx(Card, {
						className: "rounded-xl border-[#ded8ca] bg-[#fbf8ef] shadow-none",
						children: /* @__PURE__ */ jsxs(CardContent, {
							className: "p-7 lg:p-10",
							children: [
								/* @__PURE__ */ jsx("h3", {
									className: "text-lg font-bold text-[#3d413b]",
									children: content.control.settings_card_title
								}),
								/* @__PURE__ */ jsx("div", {
									className: "mt-8 flex flex-col gap-0 overflow-hidden rounded-lg border border-[#e2dbcd]",
									children: content.control.settings_rows.map((item) => /* @__PURE__ */ jsxs("div", {
										className: "grid gap-4 border-b border-[#e2dbcd] bg-[#fbf8ef] p-5 last:border-b-0 md:grid-cols-[0.75fr_1.3fr] md:items-center",
										children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
											className: "text-sm font-bold text-[#4a5048]",
											children: item.label
										}), /* @__PURE__ */ jsx("p", {
											className: "mt-1 text-xs font-medium text-[#85897e]",
											children: item.hint
										})] }), /* @__PURE__ */ jsxs("div", {
											className: "flex min-h-11 items-center justify-between gap-4 rounded-md border border-[#ddd6c8] bg-[#f8f4ed] px-4 text-sm font-medium text-[#6a6f66]",
											children: [/* @__PURE__ */ jsx("span", { children: item.value }), /* @__PURE__ */ jsx(ChevronDown, { className: "size-4 text-[#9a9d92]" })]
										})]
									}, item.label))
								}),
								/* @__PURE__ */ jsxs("div", {
									className: "mt-7 flex items-center justify-end gap-5",
									children: [/* @__PURE__ */ jsx("button", {
										className: "text-sm font-semibold text-[#8a8f82]",
										type: "button",
										children: content.control.cancel_label
									}), /* @__PURE__ */ jsx(Button, {
										className: cn("h-12 rounded-md px-6 text-sm font-bold", pineButtonClass),
										children: content.control.save_button_label
									})]
								})
							]
						})
					})]
				}),
				/* @__PURE__ */ jsxs("section", {
					className: "mx-auto max-w-[1200px] px-6 pb-20 lg:px-10",
					children: [/* @__PURE__ */ jsxs("div", {
						className: "flex flex-col gap-6",
						children: [/* @__PURE__ */ jsx(SectionLabel, { children: content.steps.badge }), /* @__PURE__ */ jsx("h2", {
							className: "marketing-display text-4xl leading-none text-[#252621] sm:text-5xl",
							children: content.steps.title
						})]
					}), /* @__PURE__ */ jsx("div", {
						className: "mt-10 grid gap-16 lg:grid-cols-3 lg:gap-16",
						children: content.steps.items.map((item, index) => {
							const Icon = resolveIcon(item.icon, Sparkles);
							return /* @__PURE__ */ jsxs(Card, {
								className: "relative rounded-lg border-[#ded8ca] bg-[#fbf8ef] shadow-none",
								children: [index < content.steps.items.length - 1 && /* @__PURE__ */ jsx("div", { className: "absolute start-[calc(100%+10px)] top-1/2 hidden h-px w-12 border-t border-dashed border-[#bbc6ad] lg:block" }), /* @__PURE__ */ jsxs(CardContent, {
									className: "flex min-h-[150px] items-center gap-5 p-7",
									children: [/* @__PURE__ */ jsx(FeatureIcon, { icon: Icon }), /* @__PURE__ */ jsxs("div", {
										className: "flex flex-col gap-2",
										children: [/* @__PURE__ */ jsx("h3", {
											className: "text-base font-bold text-[#2d332d]",
											children: item.title
										}), /* @__PURE__ */ jsx("p", {
											className: "text-sm leading-6 font-medium text-[#676d64]",
											children: item.description
										})]
									})]
								})]
							}, item.title);
						})
					})]
				}),
				/* @__PURE__ */ jsxs("section", {
					className: "mx-auto grid max-w-[1200px] gap-7 px-6 pb-20 lg:grid-cols-[1.25fr_0.85fr] lg:items-stretch lg:px-10",
					children: [/* @__PURE__ */ jsxs("div", {
						className: "flex flex-col gap-6",
						children: [/* @__PURE__ */ jsx(SectionLabel, { children: content.insights.badge }), /* @__PURE__ */ jsx(GrowthChart, { content: content.insights })]
					}), /* @__PURE__ */ jsx("div", {
						className: "flex flex-col gap-5 lg:grid lg:min-h-full lg:grid-rows-3 lg:pt-12",
						children: content.insights.cards.map((item) => {
							return /* @__PURE__ */ jsx(Card, {
								className: "h-full rounded-lg border-[#ded8ca] bg-[#fbf8ef] shadow-none",
								children: /* @__PURE__ */ jsxs(CardContent, {
									className: "flex h-full items-center gap-5 p-7",
									children: [
										/* @__PURE__ */ jsx(FeatureIcon, { icon: resolveIcon(item.icon, Sparkles) }),
										/* @__PURE__ */ jsxs("div", {
											className: "min-w-0 grow",
											children: [/* @__PURE__ */ jsx("h3", {
												className: "text-base font-bold text-[#2d332d]",
												children: item.title
											}), /* @__PURE__ */ jsx("p", {
												className: "mt-2 text-sm leading-6 font-medium text-[#676d64]",
												children: item.description
											})]
										}),
										/* @__PURE__ */ jsx(DirArrow, {
											direction: "forward",
											className: "size-5 shrink-0 text-[#566256]"
										})
									]
								})
							}, item.title);
						})
					})]
				}),
				/* @__PURE__ */ jsx(TestimonialCarousel, { content: content.testimonials }),
				/* @__PURE__ */ jsx(FaqAccordion, { content: content.faq }),
				/* @__PURE__ */ jsx("section", {
					className: "mx-auto max-w-[1200px] px-6 pb-10 lg:px-10",
					children: /* @__PURE__ */ jsx("div", {
						className: "overflow-hidden rounded-xl bg-[#071b17] px-9 py-9 text-white lg:px-20",
						style: { backgroundImage: "repeating-radial-gradient(circle at 82% 120%, rgba(184, 223, 168, 0.16) 0 1px, transparent 1px 15px)" },
						children: /* @__PURE__ */ jsxs("div", {
							className: "flex flex-col gap-8 lg:flex-row lg:items-center lg:justify-between",
							children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("h2", {
								className: "marketing-display max-w-[520px] text-4xl leading-none text-[#f4f0e8] sm:text-5xl",
								children: content.final_cta.title
							}), /* @__PURE__ */ jsx("p", {
								className: "mt-4 max-w-[520px] text-sm leading-6 font-medium text-[#bdc8bd]",
								children: content.final_cta.description
							})] }), /* @__PURE__ */ jsxs("div", {
								className: "flex flex-wrap gap-4",
								children: [/* @__PURE__ */ jsx(Button, {
									className: "h-[52px] rounded-md bg-[#f5f1e8] px-7 text-sm font-bold text-[#173f2c] hover:bg-white",
									asChild: true,
									children: /* @__PURE__ */ jsxs(Link, {
										href: resolveHref$1(content.final_cta.primary_button_href, primaryHref),
										...ctaTargetProps,
										children: [content.final_cta.primary_button_label, /* @__PURE__ */ jsx(DirArrow, {
											direction: "forward",
											"data-icon": "inline-end"
										})]
									})
								}), /* @__PURE__ */ jsx(Button, {
									variant: "outline",
									className: "h-[52px] rounded-md border-white/35 bg-transparent px-7 text-sm font-bold text-white hover:bg-white/10 hover:text-white",
									asChild: true,
									children: /* @__PURE__ */ jsx(Link, {
										href: resolveHref$1(content.final_cta.secondary_button_href, primaryHref),
										...ctaTargetProps,
										children: content.final_cta.secondary_button_label
									})
								})]
							})]
						})
					})
				})
			]
		})
	})] });
}
//#endregion
//#region resources/js/pages/marketing/how-it-works.tsx
var how_it_works_exports$2 = /* @__PURE__ */ __exportAll({ default: () => HowItWorks });
function HowItWorks({ shell, brand, steps, latency }) {
	const { t } = useT();
	return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Head, {
		title: t("How it works — :brand", { brand }),
		children: /* @__PURE__ */ jsx("meta", {
			name: "description",
			content: t("How the :brand sales AI widget turns your website into a 24/7 sales rep — from setup to first conversation in under 5 minutes.", { brand })
		})
	}), /* @__PURE__ */ jsxs(MarketingShell, {
		content: shell,
		children: [
			/* @__PURE__ */ jsx("section", {
				className: "mx-auto max-w-5xl px-6 pt-16 pb-16 lg:pt-20",
				children: /* @__PURE__ */ jsxs("div", {
					className: "mx-auto max-w-3xl text-center",
					children: [
						/* @__PURE__ */ jsx("span", {
							className: "inline-flex items-center gap-2 rounded-full border border-slate-900/10 bg-white/85 px-3 py-1 text-xs font-semibold tracking-[0.2em] text-slate-600 uppercase",
							children: t("How it works")
						}),
						/* @__PURE__ */ jsxs("h1", {
							className: "mt-6 text-4xl font-bold tracking-tight text-slate-950 sm:text-5xl",
							children: [
								t("From URL to live sales agent in"),
								" ",
								/* @__PURE__ */ jsx("span", {
									className: "marketing-display italic",
									children: t("under 5 minutes")
								})
							]
						}),
						/* @__PURE__ */ jsx("p", {
							className: "mt-5 text-base leading-7 text-slate-600 sm:text-lg",
							children: t(":brand reads your website, builds an AI agent grounded in your own content, and embeds it on any page with one line of HTML. Here's exactly what happens.", { brand })
						})
					]
				})
			}),
			/* @__PURE__ */ jsx("section", {
				className: "relative mx-auto max-w-4xl px-6 pb-16",
				children: /* @__PURE__ */ jsx("div", {
					className: "space-y-6",
					children: steps.map((step) => /* @__PURE__ */ jsxs("div", {
						className: "relative rounded-3xl border border-slate-900/10 bg-white/85 p-6 ps-20 shadow-[0_30px_70px_-60px_rgba(15,23,42,0.4)] backdrop-blur sm:ps-24",
						children: [
							/* @__PURE__ */ jsx("span", {
								className: "absolute start-4 top-6 flex size-12 items-center justify-center rounded-2xl border border-slate-900/10 bg-slate-950 text-sm font-semibold text-white shadow-lg shadow-slate-900/20 sm:start-5",
								children: step.number
							}),
							/* @__PURE__ */ jsxs("div", {
								className: "flex flex-wrap items-baseline justify-between gap-3",
								children: [/* @__PURE__ */ jsx("h3", {
									className: "text-xl font-semibold tracking-tight text-slate-950 sm:text-2xl",
									children: step.title
								}), /* @__PURE__ */ jsx("span", {
									className: "rounded-full border border-emerald-600/30 bg-emerald-500/10 px-3 py-1 text-[11px] font-semibold tracking-[0.14em] text-emerald-700 uppercase",
									children: step.duration
								})]
							}),
							/* @__PURE__ */ jsx("p", {
								className: "mt-3 text-sm leading-6 text-slate-600 sm:text-base",
								children: step.description
							}),
							step.sub_points.length > 0 && /* @__PURE__ */ jsx("ul", {
								className: "mt-4 grid gap-2 sm:grid-cols-2",
								children: step.sub_points.map((point) => /* @__PURE__ */ jsxs("li", {
									className: "flex items-start gap-2 text-sm text-slate-700",
									children: [/* @__PURE__ */ jsx(Check, { className: "mt-[3px] size-4 flex-shrink-0 stroke-[2.4] text-emerald-600" }), /* @__PURE__ */ jsx("span", { children: point })]
								}, point))
							})
						]
					}, step.number))
				})
			}),
			/* @__PURE__ */ jsx("section", {
				className: "mx-auto max-w-5xl px-6 py-16",
				children: /* @__PURE__ */ jsx("div", {
					className: "rounded-3xl border border-slate-900/10 bg-white/70 p-6 backdrop-blur sm:p-10",
					children: /* @__PURE__ */ jsxs("div", {
						className: "grid gap-8 lg:grid-cols-[1.2fr_1fr] lg:items-start",
						children: [/* @__PURE__ */ jsxs("div", { children: [
							/* @__PURE__ */ jsx("span", {
								className: "inline-flex items-center gap-2 rounded-full border border-slate-900/10 bg-white px-3 py-1 text-[11px] font-semibold tracking-[0.18em] text-slate-600 uppercase",
								children: t("Hot path contract")
							}),
							/* @__PURE__ */ jsx("h2", {
								className: "mt-4 text-2xl font-semibold tracking-tight text-slate-950 sm:text-3xl",
								children: t("1 second to first token. Every time.")
							}),
							/* @__PURE__ */ jsx("p", {
								className: "mt-3 text-sm leading-6 text-slate-600 sm:text-base",
								children: t("The visitor-message → first-token path has a hard p95 budget. No DB writes, no synchronous webhooks, no retries. Persistence and analytics are dispatched async after the stream completes.")
							}),
							/* @__PURE__ */ jsx("p", {
								className: "mt-3 text-sm leading-6 text-slate-600 sm:text-base",
								children: t("OpenTelemetry spans wrap every phase so when the budget breaks the span heatmap points right at the offender.")
							})
						] }), /* @__PURE__ */ jsxs("div", {
							className: "rounded-2xl border border-slate-900/10 bg-white p-5",
							children: [/* @__PURE__ */ jsx("p", {
								className: "text-xs font-semibold tracking-[0.16em] text-slate-500 uppercase",
								children: t("p95 latency budget")
							}), /* @__PURE__ */ jsxs("ul", {
								className: "mt-4 space-y-3",
								children: [latency.map((row) => /* @__PURE__ */ jsxs("li", {
									className: "flex items-center justify-between text-sm text-slate-700",
									children: [/* @__PURE__ */ jsx("span", { children: row.phase }), /* @__PURE__ */ jsx("span", {
										className: "font-mono text-slate-950",
										children: row.budget
									})]
								}, row.phase)), /* @__PURE__ */ jsxs("li", {
									className: "flex items-center justify-between border-t border-slate-900/10 pt-3 text-sm font-semibold text-slate-950",
									children: [/* @__PURE__ */ jsx("span", { children: t("Total to first token") }), /* @__PURE__ */ jsx("span", {
										className: "font-mono text-emerald-700",
										children: t("~ 865 ms")
									})]
								})]
							})]
						})]
					})
				})
			}),
			/* @__PURE__ */ jsx("section", {
				className: "mx-auto max-w-5xl px-6 pb-16",
				children: /* @__PURE__ */ jsxs("div", {
					className: "rounded-3xl bg-slate-950 px-8 py-12 text-center sm:px-12",
					children: [
						/* @__PURE__ */ jsx("h2", {
							className: "text-2xl font-semibold tracking-tight text-white sm:text-3xl",
							children: t("Try it on your own site.")
						}),
						/* @__PURE__ */ jsx("p", {
							className: "mt-3 text-sm text-slate-300 sm:text-base",
							children: t("Free to start. No card required. Live in 5 minutes.")
						}),
						/* @__PURE__ */ jsxs("div", {
							className: "mt-6 flex flex-col items-center justify-center gap-3 sm:flex-row",
							children: [/* @__PURE__ */ jsx(Link, {
								href: "/register",
								className: "inline-flex items-center justify-center rounded-full bg-white px-6 py-3 text-sm font-semibold text-slate-950 transition hover:bg-emerald-100",
								children: t("Start free")
							}), /* @__PURE__ */ jsx(Link, {
								href: "/pricing",
								className: "inline-flex items-center justify-center rounded-full border border-white/20 px-6 py-3 text-sm font-medium text-white transition hover:bg-white/10",
								children: t("See pricing")
							})]
						})
					]
				})
			})
		]
	})] });
}
//#endregion
//#region resources/js/pages/marketing/integrations.tsx
var integrations_exports$2 = /* @__PURE__ */ __exportAll({ default: () => Integrations });
var iconMap = {
	BookOpen,
	CreditCard,
	FileText,
	Globe2,
	Map: Map$1,
	MessageSquare,
	Rss,
	Sparkles,
	Type
};
var accentClass = {
	slate: "bg-slate-100 text-slate-700 ring-slate-200/80",
	sky: "bg-sky-100 text-sky-700 ring-sky-200/80",
	violet: "bg-violet-100 text-violet-700 ring-violet-200/80",
	indigo: "bg-indigo-100 text-indigo-700 ring-indigo-200/80",
	emerald: "bg-emerald-100 text-emerald-700 ring-emerald-200/80",
	amber: "bg-amber-100 text-amber-700 ring-amber-200/80"
};
function Icon({ name, className }) {
	return /* @__PURE__ */ jsx(iconMap[name] ?? Sparkles, { className });
}
function Integrations({ shell, brand, native, data_sources, roadmap }) {
	const { t } = useT();
	return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Head, {
		title: t("Integrations — :brand", { brand }),
		children: /* @__PURE__ */ jsx("meta", {
			name: "description",
			content: t("Plug :brand into the tools your team already uses — Notion, Google Docs, Slack, Stripe, webhooks, and more.", { brand })
		})
	}), /* @__PURE__ */ jsxs(MarketingShell, {
		content: shell,
		children: [
			/* @__PURE__ */ jsx("section", {
				className: "mx-auto max-w-5xl px-6 pt-16 pb-14 lg:pt-20",
				children: /* @__PURE__ */ jsxs("div", {
					className: "mx-auto max-w-3xl text-center",
					children: [
						/* @__PURE__ */ jsx("span", {
							className: "inline-flex items-center gap-2 rounded-full border border-slate-900/10 bg-white/85 px-3 py-1 text-xs font-semibold tracking-[0.2em] text-slate-600 uppercase",
							children: t("Integrations")
						}),
						/* @__PURE__ */ jsxs("h1", {
							className: "mt-6 text-4xl font-bold tracking-tight text-slate-950 sm:text-5xl",
							children: [
								t("Plug :brand into the", { brand }),
								" ",
								/* @__PURE__ */ jsx("span", {
									className: "marketing-display italic",
									children: t("tools you already use")
								})
							]
						}),
						/* @__PURE__ */ jsx("p", {
							className: "mt-5 text-base leading-7 text-slate-600 sm:text-lg",
							children: t("Native sync where it matters, signed webhooks everywhere else. Bring your knowledge in. Push leads out. Capture human escalations without leaving Slack.")
						})
					]
				})
			}),
			/* @__PURE__ */ jsx("section", {
				className: "mx-auto max-w-6xl px-6 pb-16",
				children: /* @__PURE__ */ jsx("div", {
					className: "grid gap-5 md:grid-cols-2",
					children: native.map((item) => /* @__PURE__ */ jsxs("div", {
						className: "rounded-3xl border border-slate-900/10 bg-white/85 p-6 shadow-[0_30px_70px_-60px_rgba(15,23,42,0.4)] backdrop-blur",
						children: [
							/* @__PURE__ */ jsxs("div", {
								className: "flex items-start gap-4",
								children: [/* @__PURE__ */ jsx("span", {
									className: `flex size-12 shrink-0 items-center justify-center rounded-2xl ring-1 ${accentClass[item.accent]}`,
									children: /* @__PURE__ */ jsx(Icon, {
										name: item.icon,
										className: "size-5"
									})
								}), /* @__PURE__ */ jsxs("div", {
									className: "min-w-0 flex-1",
									children: [/* @__PURE__ */ jsx("p", {
										className: "text-[11px] font-semibold tracking-[0.16em] text-slate-500 uppercase",
										children: item.category
									}), /* @__PURE__ */ jsx("h3", {
										className: "mt-1 text-xl font-semibold tracking-tight text-slate-950",
										children: item.name
									})]
								})]
							}),
							/* @__PURE__ */ jsx("p", {
								className: "mt-4 text-sm font-medium text-slate-800",
								children: item.tagline
							}),
							/* @__PURE__ */ jsx("p", {
								className: "mt-2 text-sm leading-6 text-slate-600",
								children: item.description
							})
						]
					}, item.name))
				})
			}),
			/* @__PURE__ */ jsx("section", {
				className: "mx-auto max-w-6xl px-6 pb-16",
				children: /* @__PURE__ */ jsx("div", {
					className: "rounded-3xl border border-slate-900/10 bg-white/70 p-6 backdrop-blur sm:p-10",
					children: /* @__PURE__ */ jsxs("div", {
						className: "grid gap-8 lg:grid-cols-[0.9fr_1.1fr]",
						children: [/* @__PURE__ */ jsxs("div", { children: [
							/* @__PURE__ */ jsx("span", {
								className: "inline-flex items-center gap-2 rounded-full border border-slate-900/10 bg-white px-3 py-1 text-[11px] font-semibold tracking-[0.18em] text-slate-600 uppercase",
								children: t("Knowledge in")
							}),
							/* @__PURE__ */ jsx("h2", {
								className: "mt-4 text-2xl font-semibold tracking-tight text-slate-950 sm:text-3xl",
								children: t("Five ways to feed the agent")
							}),
							/* @__PURE__ */ jsx("p", {
								className: "mt-3 text-sm leading-6 text-slate-600 sm:text-base",
								children: t("Mix and match — most teams start with a sitemap crawl, paste a few FAQs, and turn on auto-index for the long tail.")
							})
						] }), /* @__PURE__ */ jsx("ul", {
							className: "grid gap-3",
							children: data_sources.map((src) => /* @__PURE__ */ jsxs("li", {
								className: "flex items-start gap-3 rounded-2xl border border-slate-900/5 bg-white px-4 py-3",
								children: [/* @__PURE__ */ jsx("span", {
									className: "mt-0.5 flex size-8 shrink-0 items-center justify-center rounded-lg bg-emerald-500/10 text-emerald-700",
									children: /* @__PURE__ */ jsx(Icon, {
										name: src.icon,
										className: "size-4"
									})
								}), /* @__PURE__ */ jsxs("div", {
									className: "min-w-0",
									children: [/* @__PURE__ */ jsx("p", {
										className: "text-sm font-semibold text-slate-950",
										children: src.name
									}), /* @__PURE__ */ jsx("p", {
										className: "mt-0.5 text-xs leading-5 text-slate-600",
										children: src.tagline
									})]
								})]
							}, src.name))
						})]
					})
				})
			}),
			/* @__PURE__ */ jsx("section", {
				className: "mx-auto max-w-5xl px-6 pb-16",
				children: /* @__PURE__ */ jsxs("div", {
					className: "rounded-3xl border border-amber-300/40 bg-gradient-to-br from-amber-50 to-white p-6 backdrop-blur sm:p-10",
					children: [/* @__PURE__ */ jsx("div", {
						className: "flex flex-wrap items-center justify-between gap-3",
						children: /* @__PURE__ */ jsxs("div", { children: [
							/* @__PURE__ */ jsx("span", {
								className: "inline-flex items-center gap-2 rounded-full border border-amber-400/40 bg-white px-3 py-1 text-[11px] font-semibold tracking-[0.18em] text-amber-700 uppercase",
								children: t("On the roadmap")
							}),
							/* @__PURE__ */ jsx("h2", {
								className: "mt-3 text-2xl font-semibold tracking-tight text-slate-950 sm:text-3xl",
								children: t("Coming soon")
							}),
							/* @__PURE__ */ jsx("p", {
								className: "mt-2 text-sm text-slate-600",
								children: t("Until these ship natively, the outgoing webhook + a Zapier catch-hook covers every CRM in your stack.")
							})
						] })
					}), /* @__PURE__ */ jsx("ul", {
						className: "mt-6 grid gap-3 sm:grid-cols-2 lg:grid-cols-3",
						children: roadmap.map((item) => /* @__PURE__ */ jsxs("li", {
							className: "rounded-2xl border border-slate-900/5 bg-white p-4",
							children: [/* @__PURE__ */ jsx("p", {
								className: "text-sm font-semibold text-slate-950",
								children: item.name
							}), /* @__PURE__ */ jsx("p", {
								className: "mt-1 text-xs leading-5 text-slate-600",
								children: item.tagline
							})]
						}, item.name))
					})]
				})
			}),
			/* @__PURE__ */ jsx("section", {
				className: "mx-auto max-w-5xl px-6 pb-16",
				children: /* @__PURE__ */ jsxs("div", {
					className: "rounded-3xl bg-slate-950 px-8 py-12 text-center sm:px-12",
					children: [
						/* @__PURE__ */ jsx("h2", {
							className: "text-2xl font-semibold tracking-tight text-white sm:text-3xl",
							children: t("Ready to plug it in?")
						}),
						/* @__PURE__ */ jsx("p", {
							className: "mt-3 text-sm text-slate-300 sm:text-base",
							children: t("Free to start. Connect Notion, Slack, and your first webhook in under 5 minutes.")
						}),
						/* @__PURE__ */ jsxs("div", {
							className: "mt-6 flex flex-col items-center justify-center gap-3 sm:flex-row",
							children: [/* @__PURE__ */ jsx(Link, {
								href: "/register",
								className: "inline-flex items-center justify-center rounded-full bg-white px-6 py-3 text-sm font-semibold text-slate-950 transition hover:bg-emerald-100",
								children: t("Get started free")
							}), /* @__PURE__ */ jsxs("a", {
								href: "/documentation/integrations",
								target: "_blank",
								rel: "noopener noreferrer",
								className: "inline-flex items-center justify-center gap-2 rounded-full border border-white/20 px-6 py-3 text-sm font-medium text-white transition hover:bg-white/10",
								children: [t("Read the integration docs"), /* @__PURE__ */ jsx("svg", {
									viewBox: "0 0 24 24",
									fill: "none",
									stroke: "currentColor",
									strokeWidth: "2",
									strokeLinecap: "round",
									strokeLinejoin: "round",
									className: "size-3.5",
									"aria-hidden": "true",
									children: /* @__PURE__ */ jsx("path", { d: "M7 17L17 7M9 7h8v8" })
								})]
							})]
						})
					]
				})
			})
		]
	})] });
}
//#endregion
//#region resources/js/pages/marketing/page.tsx
var page_exports = /* @__PURE__ */ __exportAll({ default: () => CustomPage });
function CustomPage({ shell, brand, page }) {
	const { t } = useT();
	return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Head, { title: `${page.title} — ${brand}` }), /* @__PURE__ */ jsx(MarketingShell, {
		content: shell,
		children: /* @__PURE__ */ jsxs("article", {
			className: "mx-auto max-w-3xl px-6 pt-16 pb-20 lg:pt-20",
			children: [
				/* @__PURE__ */ jsx("h1", {
					className: "text-4xl font-bold tracking-tight text-slate-950 sm:text-5xl",
					children: page.title
				}),
				/* @__PURE__ */ jsx("div", {
					className: "page-content mt-8 text-base leading-7 text-slate-900",
					dangerouslySetInnerHTML: { __html: page.html }
				}),
				page.updated_at && /* @__PURE__ */ jsxs("p", {
					className: "mt-12 border-t border-slate-900/10 pt-4 text-xs text-slate-500",
					children: [
						t("Last updated:"),
						" ",
						/* @__PURE__ */ jsx("time", {
							dateTime: page.updated_at,
							children: new Date(page.updated_at).toLocaleDateString(void 0, {
								year: "numeric",
								month: "long",
								day: "numeric"
							})
						})
					]
				})
			]
		})
	})] });
}
//#endregion
//#region resources/js/pages/marketing/pricing.tsx
var pricing_exports$2 = /* @__PURE__ */ __exportAll({ default: () => Pricing });
function formatPrice$2(value, symbol, decimals) {
	return `${symbol}${value.toLocaleString(void 0, {
		minimumFractionDigits: decimals,
		maximumFractionDigits: decimals
	})}`;
}
function MatrixValue$2({ value }) {
	if (value === true) return /* @__PURE__ */ jsx(Check, { className: "mx-auto size-4 stroke-[2.4] text-emerald-600" });
	if (value === false) return /* @__PURE__ */ jsx("span", {
		className: "text-slate-300",
		children: "—"
	});
	return /* @__PURE__ */ jsx("span", {
		className: "text-slate-700",
		children: value
	});
}
function FaqItem$2({ q, a }) {
	const [open, setOpen] = useState(false);
	return /* @__PURE__ */ jsxs("div", {
		className: "rounded-2xl border border-slate-900/10 bg-white/80 p-5 backdrop-blur transition hover:bg-white",
		children: [/* @__PURE__ */ jsxs("button", {
			type: "button",
			onClick: () => setOpen((v) => !v),
			className: "flex w-full items-center justify-between text-start text-base font-medium text-slate-950",
			children: [/* @__PURE__ */ jsx("span", { children: q }), /* @__PURE__ */ jsx(ChevronDown, { className: "size-4 text-slate-500 transition" + (open ? " rotate-180" : "") })]
		}), open && /* @__PURE__ */ jsx("p", {
			className: "mt-3 text-sm leading-6 text-slate-600",
			children: a
		})]
	});
}
function Pricing({ shell, brand, plans, lifetime_plans, currency, currencies, matrix, faqs, contact_email }) {
	const { t } = useT();
	const [interval, setInterval] = useState("month");
	const onCurrencyChange = (code) => {
		if (code === currency) return;
		router.visit(`/pricing?currency=${encodeURIComponent(code)}`, {
			preserveScroll: true,
			preserveState: false
		});
	};
	const hasAnnualOption = plans.some((p) => p.yearly_price > 0 && p.monthly_price > 0);
	const annualSavingsPercent = (() => {
		const candidate = plans.find((p) => p.monthly_price > 0 && p.yearly_price > 0);
		if (!candidate) return 0;
		const monthlyOverYear = candidate.monthly_price * 12;
		const saved = monthlyOverYear - candidate.yearly_price;
		return monthlyOverYear === 0 ? 0 : Math.round(saved / monthlyOverYear * 100);
	})();
	return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Head, {
		title: t("Pricing — :brand", { brand }),
		children: /* @__PURE__ */ jsx("meta", {
			name: "description",
			content: t("Simple, conversation-based pricing for the :brand sales AI widget. Start free; scale as you grow.", { brand })
		})
	}), /* @__PURE__ */ jsxs(MarketingShell, {
		content: shell,
		children: [
			/* @__PURE__ */ jsx("section", {
				className: "relative mx-auto max-w-6xl px-6 pt-16 pb-12 lg:pt-20",
				children: /* @__PURE__ */ jsxs("div", {
					className: "mx-auto max-w-3xl text-center",
					children: [
						/* @__PURE__ */ jsx("span", {
							className: "inline-flex items-center gap-2 rounded-full border border-slate-900/10 bg-white/85 px-3 py-1 text-xs font-semibold tracking-[0.2em] text-slate-600 uppercase",
							children: t("Pricing")
						}),
						/* @__PURE__ */ jsxs("h1", {
							className: "mt-6 text-4xl font-bold tracking-tight text-slate-950 sm:text-5xl",
							children: [
								t("Simple,"),
								" ",
								/* @__PURE__ */ jsx("span", {
									className: "marketing-display italic",
									children: t("conversation-based")
								}),
								" ",
								t("pricing")
							]
						}),
						/* @__PURE__ */ jsx("p", {
							className: "mt-5 text-base leading-7 text-slate-600 sm:text-lg",
							children: t("Start free. Upgrade when you outgrow it. No per-seat fees, no setup fees, no surprise overages — just a clear conversation limit.")
						}),
						/* @__PURE__ */ jsxs("div", {
							className: "mt-8 flex flex-wrap items-center justify-center gap-3",
							children: [hasAnnualOption && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("div", {
								className: "inline-flex rounded-full border border-slate-900/10 bg-white/85 p-1 text-sm font-medium shadow-sm",
								role: "radiogroup",
								"aria-label": t("Billing interval"),
								children: [{
									v: "month",
									label: t("Monthly")
								}, {
									v: "year",
									label: t("Yearly")
								}].map((opt) => /* @__PURE__ */ jsx("button", {
									type: "button",
									role: "radio",
									"aria-checked": interval === opt.v,
									onClick: () => setInterval(opt.v),
									className: "rounded-full px-4 py-1.5 transition " + (interval === opt.v ? "bg-slate-950 text-white" : "text-slate-600 hover:text-slate-950"),
									children: opt.label
								}, opt.v))
							}), annualSavingsPercent > 0 && /* @__PURE__ */ jsx("span", {
								className: "rounded-full border border-emerald-200 bg-emerald-50 px-3 py-1 text-xs font-semibold text-emerald-700",
								children: t("Save :percent% with yearly", { percent: annualSavingsPercent })
							})] }), currencies.length > 1 && /* @__PURE__ */ jsxs("label", {
								className: "inline-flex items-center gap-2 rounded-full border border-slate-900/10 bg-white/85 px-3 py-1.5 text-sm font-medium text-slate-700 shadow-sm",
								children: [/* @__PURE__ */ jsx("span", {
									className: "text-xs tracking-wide text-slate-500 uppercase",
									children: t("Currency")
								}), /* @__PURE__ */ jsx("select", {
									value: currency,
									onChange: (e) => onCurrencyChange(e.target.value),
									"aria-label": t("Display currency"),
									className: "bg-transparent text-sm font-semibold text-slate-950 focus:outline-none",
									children: currencies.map((c) => /* @__PURE__ */ jsxs("option", {
										value: c.code,
										children: [
											c.code,
											" — ",
											c.name
										]
									}, c.code))
								})]
							})]
						})
					]
				})
			}),
			/* @__PURE__ */ jsxs("section", {
				className: "mx-auto max-w-6xl px-6 pb-12",
				children: [(() => {
					const n = plans.length;
					return /* @__PURE__ */ jsx("div", {
						className: `grid gap-6 ${n <= 1 ? "mx-auto max-w-md md:grid-cols-1" : n === 2 ? "md:grid-cols-2" : n === 3 ? "md:grid-cols-3" : "md:grid-cols-2 lg:grid-cols-4"}`,
						children: plans.map((plan) => {
							const showYearly = interval === "year" && plan.yearly_price > 0;
							const headlinePrice = showYearly ? Math.round(plan.yearly_price / 12) : plan.monthly_price;
							const ctaHref = interval === "year" && plan.yearly_price > 0 ? plan.cta_href + (plan.cta_href.includes("?") ? "&" : "?") + "interval=year" : plan.cta_href;
							return /* @__PURE__ */ jsxs("div", {
								className: "relative flex flex-col rounded-3xl border bg-white/85 p-7 shadow-[0_30px_70px_-50px_rgba(15,23,42,0.4)] backdrop-blur " + (plan.highlight ? "border-emerald-500/40 ring-2 ring-emerald-500/30" : "border-slate-900/10"),
								children: [
									plan.highlight && /* @__PURE__ */ jsx("span", {
										className: "absolute start-1/2 -top-3 -translate-x-1/2 rounded-full bg-emerald-600 px-3 py-1 text-[11px] font-semibold tracking-[0.18em] text-white uppercase shadow-lg shadow-emerald-600/30",
										children: t("Most popular")
									}),
									/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("h3", {
										className: "text-xl font-semibold text-slate-950",
										children: plan.name
									}), /* @__PURE__ */ jsx("p", {
										className: "mt-1 text-sm text-slate-500",
										children: plan.tagline
									})] }),
									/* @__PURE__ */ jsxs("div", {
										className: "mt-6 flex items-baseline gap-1",
										children: [/* @__PURE__ */ jsx("span", {
											className: "text-5xl font-bold tracking-tight text-slate-950",
											children: formatPrice$2(headlinePrice, plan.currency_symbol, plan.decimal_places)
										}), headlinePrice > 0 && /* @__PURE__ */ jsx("span", {
											className: "text-sm text-slate-500",
											children: t("/month")
										})]
									}),
									showYearly && plan.yearly_price > 0 && /* @__PURE__ */ jsx("p", {
										className: "mt-1 text-xs text-slate-500",
										children: t(":price billed annually", { price: formatPrice$2(plan.yearly_price, plan.currency_symbol, plan.decimal_places) })
									}),
									/* @__PURE__ */ jsx("p", {
										className: "mt-2 text-sm font-medium text-slate-700",
										children: plan.volume
									}),
									/* @__PURE__ */ jsx("ul", {
										className: "mt-6 flex-1 space-y-3 text-sm text-slate-700",
										children: plan.features.map((feature) => /* @__PURE__ */ jsxs("li", {
											className: "flex items-start gap-2",
											children: [/* @__PURE__ */ jsx(Check, { className: "mt-[3px] size-4 flex-shrink-0 stroke-[2.4] text-emerald-600" }), /* @__PURE__ */ jsx("span", { children: feature })]
										}, feature))
									}),
									/* @__PURE__ */ jsx(Link, {
										href: ctaHref,
										className: "mt-8 inline-flex items-center justify-center rounded-full px-5 py-3 text-sm font-semibold transition " + (plan.highlight ? "bg-slate-950 text-white hover:bg-slate-800" : "border border-slate-900/15 bg-white text-slate-950 hover:bg-slate-50"),
										children: plan.cta_label
									})
								]
							}, plan.name);
						})
					});
				})(), /* @__PURE__ */ jsxs("p", {
					className: "mt-8 text-center text-sm text-slate-500",
					children: [
						t("Need higher limits or a self-hosted license?"),
						" ",
						/* @__PURE__ */ jsx("a", {
							href: `mailto:${contact_email}`,
							className: "font-medium text-slate-950 underline underline-offset-4",
							children: t("Talk to us about Enterprise")
						}),
						"."
					]
				})]
			}),
			lifetime_plans.length > 0 && /* @__PURE__ */ jsxs("section", {
				className: "mx-auto max-w-6xl px-6 pb-12",
				children: [/* @__PURE__ */ jsxs("div", {
					className: "mx-auto mb-8 max-w-3xl text-center",
					children: [
						/* @__PURE__ */ jsx("span", {
							className: "inline-flex items-center gap-2 rounded-full border border-amber-300 bg-amber-50 px-3 py-1 text-xs font-semibold tracking-[0.2em] text-amber-700 uppercase",
							children: t("Lifetime deal")
						}),
						/* @__PURE__ */ jsx("h2", {
							className: "mt-5 text-3xl font-bold tracking-tight text-slate-950 sm:text-4xl",
							children: t("Pay once. Use forever.")
						}),
						/* @__PURE__ */ jsx("p", {
							className: "mt-3 text-sm leading-7 text-slate-600 sm:text-base",
							children: t("A one-time purchase that unlocks the agent for the lifetime of your account — no monthly bill, no surprise renewal.")
						})
					]
				}), /* @__PURE__ */ jsx("div", {
					className: "grid gap-6 " + (lifetime_plans.length === 1 ? "mx-auto max-w-md md:grid-cols-1" : lifetime_plans.length === 2 ? "mx-auto max-w-3xl md:grid-cols-2" : "md:grid-cols-3"),
					children: lifetime_plans.map((plan) => /* @__PURE__ */ jsxs("div", {
						className: "relative flex flex-col rounded-3xl border border-amber-200 bg-gradient-to-br from-amber-50 via-white to-white p-7 shadow-[0_30px_70px_-50px_rgba(180,83,9,0.45)] backdrop-blur",
						children: [
							/* @__PURE__ */ jsx("h3", {
								className: "text-xl font-semibold text-slate-950",
								children: plan.name
							}),
							/* @__PURE__ */ jsx("p", {
								className: "mt-1 text-sm text-slate-500",
								children: plan.tagline
							}),
							/* @__PURE__ */ jsxs("div", {
								className: "mt-6 flex items-baseline gap-2",
								children: [/* @__PURE__ */ jsx("span", {
									className: "text-5xl font-bold tracking-tight text-slate-950",
									children: plan.price === null ? "—" : formatPrice$2(plan.price, plan.currency_symbol, plan.decimal_places)
								}), /* @__PURE__ */ jsx("span", {
									className: "text-sm text-slate-500",
									children: t("one-time")
								})]
							}),
							plan.monthly_conversations > 0 && /* @__PURE__ */ jsx("p", {
								className: "mt-2 text-sm font-medium text-slate-700",
								children: t(":count conversations / month", { count: plan.monthly_conversations.toLocaleString() })
							}),
							/* @__PURE__ */ jsx("ul", {
								className: "mt-6 flex-1 space-y-3 text-sm text-slate-700",
								children: plan.features.map((feature) => /* @__PURE__ */ jsxs("li", {
									className: "flex items-start gap-2",
									children: [/* @__PURE__ */ jsx(Check, { className: "mt-[3px] size-4 flex-shrink-0 stroke-[2.4] text-amber-600" }), /* @__PURE__ */ jsx("span", { children: feature })]
								}, feature))
							}),
							/* @__PURE__ */ jsx(Link, {
								href: plan.cta_href,
								className: "mt-8 inline-flex items-center justify-center rounded-full bg-amber-600 px-5 py-3 text-sm font-semibold text-white transition hover:bg-amber-700",
								children: plan.cta_label
							})
						]
					}, plan.id))
				})]
			}),
			/* @__PURE__ */ jsx("section", {
				className: "mx-auto max-w-6xl px-6 py-16",
				children: /* @__PURE__ */ jsxs("div", {
					className: "rounded-3xl border border-slate-900/10 bg-white/70 p-6 shadow-[0_30px_70px_-60px_rgba(15,23,42,0.4)] backdrop-blur sm:p-10",
					children: [/* @__PURE__ */ jsxs("div", {
						className: "mb-6",
						children: [/* @__PURE__ */ jsx("h2", {
							className: "text-2xl font-semibold tracking-tight text-slate-950 sm:text-3xl",
							children: t("Compare every feature")
						}), /* @__PURE__ */ jsx("p", {
							className: "mt-2 text-sm text-slate-600",
							children: t("Everything you can do on each plan, side by side.")
						})]
					}), /* @__PURE__ */ jsx("div", {
						className: "overflow-x-auto",
						children: /* @__PURE__ */ jsxs("table", {
							className: "w-full min-w-[640px] border-separate border-spacing-0 text-sm",
							children: [/* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", {
								className: "text-start text-slate-500",
								children: [
									/* @__PURE__ */ jsx("th", {
										className: "border-b border-slate-900/10 py-3 pe-4 text-xs font-medium tracking-wider uppercase",
										children: t("Feature")
									}),
									/* @__PURE__ */ jsx("th", {
										className: "border-b border-slate-900/10 px-4 py-3 text-center font-semibold text-slate-950",
										children: t("Free")
									}),
									/* @__PURE__ */ jsx("th", {
										className: "border-b border-slate-900/10 px-4 py-3 text-center font-semibold text-emerald-700",
										children: t("Standard")
									}),
									/* @__PURE__ */ jsx("th", {
										className: "border-b border-slate-900/10 px-4 py-3 text-center font-semibold text-slate-950",
										children: t("Pro")
									})
								]
							}) }), /* @__PURE__ */ jsx("tbody", { children: matrix.map((row) => /* @__PURE__ */ jsxs("tr", {
								className: "text-slate-700",
								children: [
									/* @__PURE__ */ jsx("td", {
										className: "border-b border-slate-900/5 py-3 pe-4 font-medium text-slate-950",
										children: row.label
									}),
									/* @__PURE__ */ jsx("td", {
										className: "border-b border-slate-900/5 px-4 py-3 text-center",
										children: /* @__PURE__ */ jsx(MatrixValue$2, { value: row.free })
									}),
									/* @__PURE__ */ jsx("td", {
										className: "border-b border-slate-900/5 px-4 py-3 text-center",
										children: /* @__PURE__ */ jsx(MatrixValue$2, { value: row.standard })
									}),
									/* @__PURE__ */ jsx("td", {
										className: "border-b border-slate-900/5 px-4 py-3 text-center",
										children: /* @__PURE__ */ jsx(MatrixValue$2, { value: row.pro })
									})
								]
							}, row.label)) })]
						})
					})]
				})
			}),
			/* @__PURE__ */ jsxs("section", {
				className: "mx-auto max-w-4xl px-6 py-16",
				children: [/* @__PURE__ */ jsx("h2", {
					className: "text-center text-2xl font-semibold tracking-tight text-slate-950 sm:text-3xl",
					children: t("Frequently asked")
				}), /* @__PURE__ */ jsx("div", {
					className: "mt-10 grid gap-4",
					children: faqs.map((faq) => /* @__PURE__ */ jsx(FaqItem$2, {
						q: faq.q,
						a: faq.a
					}, faq.q))
				})]
			}),
			/* @__PURE__ */ jsx("section", {
				className: "mx-auto max-w-5xl px-6 pb-16",
				children: /* @__PURE__ */ jsxs("div", {
					className: "rounded-3xl bg-slate-950 px-8 py-12 text-center sm:px-12",
					children: [
						/* @__PURE__ */ jsx("h2", {
							className: "text-2xl font-semibold tracking-tight text-white sm:text-3xl",
							children: t("Ready to ship a real sales AI?")
						}),
						/* @__PURE__ */ jsx("p", {
							className: "mt-3 text-sm text-slate-300 sm:text-base",
							children: t("Free to start. Deploys in 5 minutes. No card required.")
						}),
						/* @__PURE__ */ jsx(Link, {
							href: "/register",
							className: "mt-6 inline-flex items-center justify-center rounded-full bg-white px-6 py-3 text-sm font-semibold text-slate-950 transition hover:bg-emerald-100",
							children: t("Get started free")
						})
					]
				})
			})
		]
	})] });
}
//#endregion
//#region resources/js/pages/marketing/privacy.tsx
var privacy_exports$2 = /* @__PURE__ */ __exportAll({ default: () => Privacy });
function Section$2({ title, section }) {
	if (!section) return null;
	return /* @__PURE__ */ jsxs("section", {
		className: "mt-10",
		children: [
			/* @__PURE__ */ jsx("h2", {
				className: "text-xl font-semibold tracking-tight text-slate-950",
				children: title
			}),
			section.summary && /* @__PURE__ */ jsx("p", {
				className: "mt-2 text-sm leading-6 text-slate-600",
				children: section.summary
			}),
			section.items && section.items.length > 0 && /* @__PURE__ */ jsx("ul", {
				className: "mt-3 list-disc space-y-1 ps-6 text-sm leading-6 text-slate-600",
				children: section.items.map((item) => /* @__PURE__ */ jsx("li", { children: item }, item))
			})
		]
	});
}
function Privacy({ shell, brand, content }) {
	const { t } = useT();
	const title = content.title ?? t("Privacy policy");
	return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Head, { title: `${title} — ${brand}` }), /* @__PURE__ */ jsx(MarketingShell, {
		content: shell,
		children: /* @__PURE__ */ jsxs("article", {
			className: "mx-auto max-w-3xl px-6 pt-16 pb-20",
			children: [
				content.eyebrow && /* @__PURE__ */ jsx("p", {
					className: "text-sm font-medium tracking-wider text-emerald-700 uppercase",
					children: content.eyebrow
				}),
				/* @__PURE__ */ jsx("h1", {
					className: "mt-4 text-4xl font-bold tracking-tight text-slate-950 sm:text-5xl",
					children: title
				}),
				content.summary && /* @__PURE__ */ jsx("p", {
					className: "mt-5 text-base leading-7 text-slate-600 sm:text-lg",
					children: content.summary
				}),
				content.effective_date && /* @__PURE__ */ jsxs("p", {
					className: "mt-2 text-sm text-slate-500",
					children: [
						/* @__PURE__ */ jsx("strong", {
							className: "text-slate-700",
							children: t("Effective date:")
						}),
						" ",
						content.effective_date
					]
				}),
				content.contact && /* @__PURE__ */ jsxs("section", {
					className: "mt-10",
					children: [/* @__PURE__ */ jsx("h2", {
						className: "text-xl font-semibold tracking-tight text-slate-950",
						children: t("Contact")
					}), /* @__PURE__ */ jsxs("p", {
						className: "mt-2 text-sm leading-6 text-slate-600",
						children: [
							content.contact.team_name,
							content.contact.email && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("br", {}), /* @__PURE__ */ jsx("a", {
								href: `mailto:${content.contact.email}`,
								className: "text-emerald-700 underline underline-offset-4",
								children: content.contact.email
							})] }),
							content.contact.response_sla && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("br", {}), content.contact.response_sla] })
						]
					})]
				}),
				/* @__PURE__ */ jsx(Section$2, {
					title: t("What we collect"),
					section: content.collection
				}),
				/* @__PURE__ */ jsx(Section$2, {
					title: t("How we use data"),
					section: content.usage
				}),
				/* @__PURE__ */ jsx(Section$2, {
					title: t("Retention"),
					section: content.retention
				}),
				/* @__PURE__ */ jsx(Section$2, {
					title: t("Your rights"),
					section: content.rights
				}),
				content.gdpr && /* @__PURE__ */ jsxs("section", {
					className: "mt-10",
					children: [
						/* @__PURE__ */ jsx("h2", {
							className: "text-xl font-semibold tracking-tight text-slate-950",
							children: t("Data export & deletion (GDPR)")
						}),
						content.gdpr.summary && /* @__PURE__ */ jsx("p", {
							className: "mt-2 text-sm leading-6 text-slate-600",
							children: content.gdpr.summary
						}),
						content.gdpr.request_email && /* @__PURE__ */ jsxs("p", {
							className: "mt-2 text-sm text-slate-600",
							children: [
								/* @__PURE__ */ jsx("strong", {
									className: "text-slate-700",
									children: t("Request contact:")
								}),
								" ",
								/* @__PURE__ */ jsx("a", {
									href: `mailto:${content.gdpr.request_email}`,
									className: "text-emerald-700 underline underline-offset-4",
									children: content.gdpr.request_email
								})
							]
						}),
						content.gdpr.request_instructions && /* @__PURE__ */ jsx("p", {
							className: "mt-2 text-sm leading-6 text-slate-600",
							children: content.gdpr.request_instructions
						})
					]
				})
			]
		})
	})] });
}
//#endregion
//#region resources/js/pages/marketing/terms.tsx
var terms_exports$2 = /* @__PURE__ */ __exportAll({ default: () => Terms });
function Terms({ shell, brand, effective_date, contact_email, intro, sections }) {
	const { t } = useT();
	return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Head, { title: t("Terms of service — :brand", { brand }) }), /* @__PURE__ */ jsx(MarketingShell, {
		content: shell,
		children: /* @__PURE__ */ jsxs("article", {
			className: "mx-auto max-w-3xl px-6 pt-16 pb-20",
			children: [
				/* @__PURE__ */ jsx("p", {
					className: "text-sm font-medium tracking-wider text-emerald-700 uppercase",
					children: t("Legal")
				}),
				/* @__PURE__ */ jsx("h1", {
					className: "mt-4 text-4xl font-bold tracking-tight text-slate-950 sm:text-5xl",
					children: t("Terms of service")
				}),
				/* @__PURE__ */ jsx("p", {
					className: "mt-5 text-base leading-7 text-slate-600 sm:text-lg",
					children: intro
				}),
				/* @__PURE__ */ jsxs("p", {
					className: "mt-2 text-sm text-slate-500",
					children: [
						/* @__PURE__ */ jsx("strong", {
							className: "text-slate-700",
							children: t("Effective date:")
						}),
						" ",
						effective_date
					]
				}),
				/* @__PURE__ */ jsxs("div", {
					className: "mt-10 space-y-10",
					children: [sections.map((section) => /* @__PURE__ */ jsxs("section", { children: [
						/* @__PURE__ */ jsx("h2", {
							className: "text-xl font-semibold tracking-tight text-slate-950",
							children: section.title
						}),
						section.body?.map((para) => /* @__PURE__ */ jsx("p", {
							className: "mt-3 text-sm leading-6 text-slate-600",
							children: para
						}, para)),
						section.bullets && section.bullets.length > 0 && /* @__PURE__ */ jsx("ul", {
							className: "mt-3 list-disc space-y-1 ps-6 text-sm leading-6 text-slate-600",
							children: section.bullets.map((b) => /* @__PURE__ */ jsx("li", { children: b }, b))
						})
					] }, section.title)), /* @__PURE__ */ jsxs("section", { children: [/* @__PURE__ */ jsx("h2", {
						className: "text-xl font-semibold tracking-tight text-slate-950",
						children: t("Contact")
					}), /* @__PURE__ */ jsxs("p", {
						className: "mt-3 text-sm leading-6 text-slate-600",
						children: [
							t("Questions about these terms? Email"),
							" ",
							/* @__PURE__ */ jsx("a", {
								href: `mailto:${contact_email}`,
								className: "text-emerald-700 underline underline-offset-4",
								children: contact_email
							}),
							"."
						]
					})] })]
				}),
				/* @__PURE__ */ jsx("hr", { className: "my-12 border-slate-200" }),
				/* @__PURE__ */ jsx("p", {
					className: "text-xs text-slate-500 italic",
					children: t("Operators deploying :brand: this template is reasonable boilerplate but is not legal advice. Adjust to reflect your jurisdiction, business model, and consult counsel before relying on it in production.", { brand })
				})
			]
		})
	})] });
}
//#endregion
//#region resources/js/pages/marketing-themes/aurora/_layout.tsx
var _layout_exports$1 = /* @__PURE__ */ __exportAll({ default: () => AuroraLayout });
function AuroraLayout({ brand, navItems, footer, ticker, title, description, children }) {
	useEffect(() => {
		document.body.classList.add("aurora-body");
		return () => document.body.classList.remove("aurora-body");
	}, []);
	const tickerItems = ticker && ticker.length > 0 ? ticker : defaultTicker(brand);
	const repeated = [...tickerItems, ...tickerItems];
	return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs(Head, {
		title: title ?? brand,
		children: [
			description ? /* @__PURE__ */ jsx("meta", {
				name: "description",
				content: description
			}) : null,
			/* @__PURE__ */ jsx("link", {
				rel: "preconnect",
				href: "https://fonts.googleapis.com"
			}),
			/* @__PURE__ */ jsx("link", {
				rel: "preconnect",
				href: "https://fonts.gstatic.com",
				crossOrigin: ""
			}),
			/* @__PURE__ */ jsx("link", {
				rel: "stylesheet",
				href: "https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;700&family=JetBrains+Mono:wght@400;500&display=swap"
			})
		]
	}), /* @__PURE__ */ jsxs("div", {
		className: "aurora-root font-grotesk density-regular theme-light",
		children: [
			/* @__PURE__ */ jsx(Nav$1, {
				brand,
				navItems
			}),
			/* @__PURE__ */ jsx("div", {
				className: "ticker",
				children: /* @__PURE__ */ jsx("div", {
					className: "ticker-track",
					children: repeated.map((label, idx) => /* @__PURE__ */ jsxs("span", { children: [/* @__PURE__ */ jsx("span", { className: "pip" }), label] }, `${label}-${idx}`))
				})
			}),
			children,
			/* @__PURE__ */ jsx(Footer$1, {
				brand,
				footer
			})
		]
	})] });
}
function defaultTicker(brand) {
	return [
		`LIVE DEMO — ASK ${brand.toUpperCase()} ANYTHING`,
		"NO CREDIT CARD REQUIRED",
		"INSTALL IN 5 MINUTES",
		"SOC 2 · GDPR · HIPAA READY"
	];
}
function Nav$1({ brand, navItems }) {
	return /* @__PURE__ */ jsxs("nav", {
		className: "nav",
		children: [
			/* @__PURE__ */ jsxs("div", {
				className: "nav-brand",
				children: [/* @__PURE__ */ jsx("span", { className: "brand-mark" }), /* @__PURE__ */ jsx("span", { children: brand.toUpperCase() })]
			}),
			/* @__PURE__ */ jsx("div", {
				className: "nav-links",
				children: navItems.map((item) => /* @__PURE__ */ jsx(Link, {
					href: item.href,
					children: item.label
				}, `${item.label}-${item.href}`))
			}),
			/* @__PURE__ */ jsxs("div", {
				className: "nav-end",
				children: [/* @__PURE__ */ jsxs("span", {
					className: "status",
					children: [/* @__PURE__ */ jsx("span", { className: "pulse" }), "ALL SYSTEMS LIVE"]
				}), /* @__PURE__ */ jsxs(Link, {
					className: "cta",
					href: login$3().url,
					children: ["Login\xA0", /* @__PURE__ */ jsx("span", {
						className: "arrow",
						children: "→"
					})]
				})]
			})
		]
	});
}
function Footer$1({ brand, footer }) {
	const groups = footer.groups.slice(0, 3);
	const legal = {
		title: footer.legal_title,
		links: footer.legal_links
	};
	return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("div", {
		className: "foot-mark-wrap",
		children: /* @__PURE__ */ jsx("svg", {
			viewBox: "0 0 1000 200",
			preserveAspectRatio: "xMidYMid meet",
			"aria-hidden": "true",
			children: /* @__PURE__ */ jsx("text", {
				x: "500",
				y: "170",
				textAnchor: "middle",
				fontSize: "220",
				children: brand.toUpperCase()
			})
		})
	}), /* @__PURE__ */ jsx("footer", {
		className: "footer",
		children: /* @__PURE__ */ jsxs("div", {
			className: "wrap",
			children: [/* @__PURE__ */ jsxs("div", {
				className: "foot-grid",
				children: [/* @__PURE__ */ jsxs("div", {
					className: "foot-brand",
					children: [
						/* @__PURE__ */ jsx("span", { className: "brand-mark" }),
						/* @__PURE__ */ jsx("p", { children: footer.brand_description }),
						/* @__PURE__ */ jsx("div", {
							className: "social",
							children: footer.socials.map((social) => /* @__PURE__ */ jsx("a", {
								href: social.href,
								"aria-label": social.label,
								children: social.label
							}, `${social.label}-${social.href}`))
						})
					]
				}), [...groups, legal].map((group) => /* @__PURE__ */ jsxs("div", {
					className: "foot-col",
					children: [/* @__PURE__ */ jsx("h5", { children: group.title }), /* @__PURE__ */ jsx("ul", { children: group.links.map((link) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx("a", {
						href: link.href,
						children: link.label
					}) }, `${link.label}-${link.href}`)) })]
				}, group.title))]
			}), /* @__PURE__ */ jsx("div", {
				className: "foot-bar",
				children: /* @__PURE__ */ jsx("span", { children: footer.copyright.toUpperCase() })
			})]
		})
	})] });
}
//#endregion
//#region resources/js/pages/marketing-themes/aurora/changelog.tsx
var changelog_exports$1 = /* @__PURE__ */ __exportAll({ default: () => AuroraChangelog });
function AuroraChangelog({ shell, brand, entries }) {
	return /* @__PURE__ */ jsxs(AuroraLayout, {
		brand,
		navItems: shell.nav_items,
		footer: shell.footer,
		title: `Changelog — ${brand}`,
		description: `Release notes for ${brand} — every shipped change, organised by version.`,
		children: [/* @__PURE__ */ jsx("section", {
			className: "section",
			"data-screen-label": "Changelog hero",
			style: { paddingBottom: 32 },
			children: /* @__PURE__ */ jsx("div", {
				className: "wrap",
				children: /* @__PURE__ */ jsxs("div", {
					style: { maxWidth: 760 },
					children: [
						/* @__PURE__ */ jsxs("span", {
							className: "eyebrow",
							children: [
								/* @__PURE__ */ jsx("span", { className: "dot" }),
								/* @__PURE__ */ jsx("span", {
									className: "idx",
									children: "L/01"
								}),
								"CHANGELOG"
							]
						}),
						/* @__PURE__ */ jsxs("h1", {
							className: "h-display",
							style: {
								marginTop: 28,
								fontSize: "clamp(40px, 6vw, 88px)"
							},
							children: [
								"What's ",
								/* @__PURE__ */ jsx("span", {
									className: "signal-mark",
									children: "new"
								}),
								" in",
								" ",
								brand,
								"."
							]
						}),
						/* @__PURE__ */ jsxs("p", {
							className: "lead",
							style: {
								marginTop: 22,
								color: "var(--muted)"
							},
							children: [
								"Every shipped change, newest first. Anchor any version with",
								" ",
								/* @__PURE__ */ jsx("code", {
									style: { fontFamily: "var(--mono)" },
									children: "#vX.Y.Z"
								}),
								"."
							]
						})
					]
				})
			})
		}), /* @__PURE__ */ jsx("section", {
			className: "section",
			"data-screen-label": "Changelog body",
			style: { paddingTop: 0 },
			children: /* @__PURE__ */ jsx("div", {
				className: "wrap",
				children: entries.length === 0 ? /* @__PURE__ */ jsx("p", {
					style: {
						color: "var(--muted)",
						fontFamily: "var(--mono)",
						fontSize: 12
					},
					children: "NO PUBLISHED ENTRIES YET."
				}) : /* @__PURE__ */ jsx("div", {
					style: {
						display: "flex",
						flexDirection: "column",
						gap: 56,
						maxWidth: 760
					},
					children: entries.map((entry) => /* @__PURE__ */ jsxs("article", {
						id: entry.version,
						style: {
							borderTop: "2px solid var(--ink)",
							paddingTop: 28
						},
						children: [
							/* @__PURE__ */ jsxs("header", {
								style: {
									display: "flex",
									alignItems: "baseline",
									justifyContent: "space-between",
									gap: 12,
									flexWrap: "wrap"
								},
								children: [/* @__PURE__ */ jsx("h2", {
									style: {
										fontFamily: "var(--mono)",
										fontSize: 24,
										letterSpacing: "-0.01em"
									},
									children: /* @__PURE__ */ jsx("span", {
										style: {
											background: "var(--signal)",
											padding: "2px 8px"
										},
										children: entry.version
									})
								}), entry.released_at_human && /* @__PURE__ */ jsx("time", {
									style: {
										fontFamily: "var(--mono)",
										fontSize: 11,
										letterSpacing: "0.08em",
										textTransform: "uppercase",
										color: "var(--muted)"
									},
									dateTime: entry.released_at ?? void 0,
									children: entry.released_at_human
								})]
							}),
							/* @__PURE__ */ jsx("h3", {
								style: {
									marginTop: 16,
									fontFamily: "var(--display)",
									fontSize: 22,
									fontWeight: 500,
									letterSpacing: "-0.015em"
								},
								children: entry.title
							}),
							/* @__PURE__ */ jsx("div", {
								className: "aurora-markdown",
								style: {
									marginTop: 12,
									fontSize: 15.5,
									lineHeight: 1.6,
									color: "var(--muted)"
								},
								children: /* @__PURE__ */ jsx(MarkdownLite, {
									markdown: entry.body,
									variant: "changelog"
								})
							})
						]
					}, entry.version))
				})
			})
		})]
	});
}
//#endregion
//#region resources/js/pages/marketing-themes/aurora/interactive-chat.tsx
var interactive_chat_exports$1 = /* @__PURE__ */ __exportAll({ default: () => InteractiveChat });
function InteractiveChat({ agentId, title, badge, placeholder, starters, seedQuestion, seedAnswer, offlineMessage }) {
	const [jwt, setJwt] = useState(null);
	const [conversationId, setConversationId] = useState(null);
	const [messages, setMessages] = useState([{
		role: "user",
		text: seedQuestion
	}, {
		role: "assistant",
		text: seedAnswer
	}]);
	const [input, setInput] = useState("");
	const [busy, setBusy] = useState(false);
	const [error, setError] = useState(null);
	const bodyRef = useRef(null);
	const initStarted = useRef(false);
	useEffect(() => {
		if (bodyRef.current) bodyRef.current.scrollTop = bodyRef.current.scrollHeight;
	}, [messages, busy]);
	const ensureSession = useCallback(async () => {
		if (jwt && conversationId) return {
			jwt,
			conversationId
		};
		if (!agentId) throw new Error("no_agent");
		const anonKey = "aurora-anon";
		let anonId = null;
		try {
			anonId = window.localStorage.getItem(anonKey);
		} catch {
			anonId = null;
		}
		const response = await fetch("/api/v1/widget/init", {
			method: "POST",
			headers: {
				"Content-Type": "application/json",
				Accept: "application/json"
			},
			credentials: "omit",
			body: JSON.stringify({
				agent_id: agentId,
				page_url: window.location.href,
				page_title: document.title,
				referrer: document.referrer || null,
				anon_id: anonId
			})
		});
		if (!response.ok) throw new Error(`init_${response.status}`);
		const payload = await response.json();
		try {
			const aId = payload.data && payload.data.anonymous_id;
			if (aId) window.localStorage.setItem(anonKey, aId);
		} catch {}
		setJwt(payload.data.jwt);
		setConversationId(payload.data.conversation_id);
		return {
			jwt: payload.data.jwt,
			conversationId: payload.data.conversation_id
		};
	}, [
		agentId,
		conversationId,
		jwt
	]);
	const streamReply = useCallback(async (token, _conv, prompt) => {
		const response = await fetch("/api/v1/widget/messages/stream", {
			method: "POST",
			headers: {
				"Content-Type": "application/json",
				Accept: "text/event-stream",
				Authorization: `Bearer ${token}`
			},
			body: JSON.stringify({
				message: prompt,
				page_context: {
					title: document.title,
					url: window.location.href
				}
			})
		});
		if (!response.ok || !response.body) throw new Error(`stream_${response.status}`);
		const reader = response.body.getReader();
		const decoder = new TextDecoder();
		let buffer = "";
		let assistant = "";
		setMessages((m) => [...m, {
			role: "assistant",
			text: ""
		}]);
		const flush = () => {
			let idx;
			while ((idx = buffer.indexOf("\n\n")) !== -1) {
				const raw = buffer.slice(0, idx);
				buffer = buffer.slice(idx + 2);
				const event = parseSseEvent$1(raw);
				if (!event) continue;
				if (event.name === "token") {
					const piece = typeof event.data?.t === "string" && event.data.t || typeof event.data?.text === "string" && event.data.text || "";
					if (piece) {
						assistant += piece;
						setMessages((m) => {
							const next = [...m];
							next[next.length - 1] = {
								role: "assistant",
								text: assistant
							};
							return next;
						});
					}
				}
				if (event.name === "done") {
					const finalText = typeof event.data?.text === "string" && event.data.text || "";
					if (finalText) {
						assistant = finalText;
						setMessages((m) => {
							const next = [...m];
							next[next.length - 1] = {
								role: "assistant",
								text: assistant
							};
							return next;
						});
					}
				}
				if (event.name === "error") {
					assistant = typeof event.data?.message === "string" && event.data.message || "Stream error.";
					setMessages((m) => {
						const next = [...m];
						next[next.length - 1] = {
							role: "assistant",
							text: assistant
						};
						return next;
					});
				}
			}
		};
		while (true) {
			const { value, done } = await reader.read();
			if (done) {
				buffer += "\n\n";
				flush();
				break;
			}
			buffer += decoder.decode(value, { stream: true });
			flush();
		}
	}, []);
	const send = useCallback(async (text) => {
		const trimmed = (text ?? input).trim();
		if (!trimmed || busy) return;
		setError(null);
		setMessages((m) => [...m, {
			role: "user",
			text: trimmed
		}]);
		setInput("");
		setBusy(true);
		try {
			const session = await ensureSession();
			await streamReply(session.jwt, session.conversationId, trimmed);
		} catch {
			setError(offlineMessage);
			setMessages((m) => [...m, {
				role: "assistant",
				text: offlineMessage
			}]);
		} finally {
			setBusy(false);
		}
	}, [
		busy,
		ensureSession,
		input,
		offlineMessage,
		streamReply
	]);
	useEffect(() => {
		if (!agentId || initStarted.current) return;
		initStarted.current = true;
		ensureSession().catch(() => {});
	}, [agentId, ensureSession]);
	return /* @__PURE__ */ jsxs("div", {
		className: "demo",
		children: [
			/* @__PURE__ */ jsx("div", {
				className: "demo-tag",
				children: badge.toUpperCase()
			}),
			/* @__PURE__ */ jsxs("div", {
				className: "demo-head",
				children: [/* @__PURE__ */ jsxs("div", {
					className: "left",
					children: [/* @__PURE__ */ jsxs("div", {
						className: "dots",
						children: [
							/* @__PURE__ */ jsx("span", {}),
							/* @__PURE__ */ jsx("span", {}),
							/* @__PURE__ */ jsx("span", {})
						]
					}), /* @__PURE__ */ jsx("span", { children: title.toUpperCase() })]
				}), /* @__PURE__ */ jsxs("div", {
					className: "live",
					children: [/* @__PURE__ */ jsx("span", { className: "pulse" }), agentId ? "SESSION OPEN" : "PREVIEW"]
				})]
			}),
			/* @__PURE__ */ jsxs("div", {
				className: "demo-body",
				ref: bodyRef,
				children: [messages.map((m, i) => /* @__PURE__ */ jsx("div", {
					className: `msg ${m.role === "user" ? "you" : "bot"}`,
					children: /* @__PURE__ */ jsxs("div", {
						className: "msg-content",
						children: [/* @__PURE__ */ jsx("div", {
							className: "who",
							children: m.role === "user" ? "You" : title
						}), /* @__PURE__ */ jsx("div", {
							className: "bubble",
							children: m.text || "…"
						})]
					})
				}, i)), busy && /* @__PURE__ */ jsx("div", {
					className: "msg bot",
					children: /* @__PURE__ */ jsxs("div", {
						className: "msg-content",
						children: [/* @__PURE__ */ jsx("div", {
							className: "who",
							children: title
						}), /* @__PURE__ */ jsx("div", {
							className: "bubble",
							children: /* @__PURE__ */ jsxs("div", {
								className: "typing",
								children: [
									/* @__PURE__ */ jsx("span", {}),
									/* @__PURE__ */ jsx("span", {}),
									/* @__PURE__ */ jsx("span", {})
								]
							})
						})]
					})
				})]
			}),
			/* @__PURE__ */ jsx("div", {
				className: "demo-suggest",
				children: starters.slice(0, 4).map((s) => /* @__PURE__ */ jsx("button", {
					type: "button",
					onClick: () => send(s),
					disabled: busy || !agentId,
					children: s
				}, s))
			}),
			/* @__PURE__ */ jsxs("form", {
				className: "demo-input",
				onSubmit: (e) => {
					e.preventDefault();
					send();
				},
				"aria-label": placeholder,
				children: [/* @__PURE__ */ jsx("input", {
					placeholder,
					value: input,
					onChange: (e) => setInput(e.target.value),
					disabled: busy || !agentId
				}), /* @__PURE__ */ jsx("button", {
					type: "submit",
					disabled: busy || !agentId,
					children: busy ? "Thinking…" : "Send →"
				})]
			}),
			error ? /* @__PURE__ */ jsx("div", {
				style: {
					padding: "8px 14px",
					borderTop: "1px solid var(--hairline)",
					fontFamily: "var(--mono)",
					fontSize: 11,
					color: "var(--muted)"
				},
				children: error
			}) : null
		]
	});
}
function parseSseEvent$1(raw) {
	let name = "message";
	const dataLines = [];
	for (const line of raw.split("\n")) if (line.startsWith("event:")) name = line.slice(6).trim();
	else if (line.startsWith("data:")) dataLines.push(line.slice(5).trim());
	if (dataLines.length === 0) return {
		name,
		data: {}
	};
	const joined = dataLines.join("\n");
	try {
		return {
			name,
			data: JSON.parse(joined)
		};
	} catch {
		return {
			name,
			data: { text: joined }
		};
	}
}
//#endregion
//#region resources/js/pages/marketing-themes/aurora/home.tsx
var home_exports$1 = /* @__PURE__ */ __exportAll({ default: () => AuroraHome });
function resolveHref(href, primaryHref) {
	if (href === "__primary__") return typeof primaryHref === "string" ? primaryHref : primaryHref.url;
	return href;
}
function initials(name) {
	return name.split(/\s+/).filter(Boolean).map((part) => part[0]).join("").slice(0, 2).toUpperCase();
}
function buildSparkPath(points) {
	const resolved = points.length > 0 ? points : [0];
	const maxY = Math.max(...resolved, 1);
	const w = 600;
	const h = 220;
	const stepX = resolved.length > 1 ? w / (resolved.length - 1) : 0;
	const coords = resolved.map((p, i) => ({
		x: i * stepX,
		y: h - p / maxY * h
	}));
	const line = coords.map((c, i) => `${i === 0 ? "M" : "L"} ${c.x.toFixed(2)} ${c.y.toFixed(2)}`).join(" ");
	return {
		line,
		area: `${line} L ${w} ${h} L 0 ${h} Z`,
		dots: coords.filter((_, i) => i % Math.max(1, Math.round(coords.length / 4)) === 0),
		w,
		h
	};
}
function shortStarter$1(question) {
	const trimmed = question.replace(/^\s*[A-Za-z]+\s*[:.]?\s*/, "").trim();
	if (trimmed.length <= 38) return trimmed.replace(/[.?!]+$/, "?");
	return trimmed.slice(0, 36).trim() + "…";
}
function AuroraHome({ canRegister, demoAgentId, content }) {
	const { auth } = usePage().props;
	const primaryHref = Boolean(auth.user) ? dashboard$1() : canRegister ? register$1() : login$3();
	const [openFaq, setOpenFaq] = useState(0);
	const [tIdx, setTIdx] = useState(0);
	const testimonialCount = content.testimonials.items.length;
	const testimonial = content.testimonials.items[tIdx % Math.max(1, testimonialCount)] ?? null;
	const stats = content.stats;
	const spark = useMemo(() => buildSparkPath(content.insights.chart_points), [content.insights.chart_points]);
	const ticker = useMemo(() => {
		const labels = stats.slice(0, 3).map((s) => `${s.value} · ${s.label.toUpperCase()}`);
		return [
			`LIVE DEMO — ASK ${content.brand_name.toUpperCase()} ANYTHING`,
			...labels,
			content.hero.site_test_helper.toUpperCase()
		];
	}, [
		content.brand_name,
		content.hero.site_test_helper,
		stats
	]);
	const chatStarters = useMemo(() => content.faq.items.slice(0, 4).map((item) => shortStarter$1(item.question)), [content.faq.items]);
	return /* @__PURE__ */ jsxs(AuroraLayout, {
		brand: content.brand_name,
		navItems: content.nav_items,
		footer: content.footer,
		ticker,
		title: `${content.brand_name} — ${content.hero.badge}`,
		description: content.hero.description,
		children: [
			/* @__PURE__ */ jsx(Hero$1, {
				hero: content.hero,
				chat: content.chat_preview,
				stats,
				demoAgentId,
				starters: chatStarters
			}),
			/* @__PURE__ */ jsx(Stats$1, { stats }),
			/* @__PURE__ */ jsx(Walkthrough$1, { video: content.video }),
			/* @__PURE__ */ jsx(Pages, { whereItFits: content.where_it_fits }),
			/* @__PURE__ */ jsx(Features$1, { featureGrid: content.feature_grid }),
			/* @__PURE__ */ jsx(Tune$1, {
				control: content.control,
				brandName: content.brand_name
			}),
			/* @__PURE__ */ jsx(Steps$1, { steps: content.steps }),
			/* @__PURE__ */ jsx(Insights, {
				insights: content.insights,
				spark
			}),
			/* @__PURE__ */ jsx(Testimonial$1, {
				testimonials: content.testimonials,
				current: testimonial,
				index: tIdx,
				total: testimonialCount,
				onPrev: () => setTIdx((i) => (i - 1 + testimonialCount) % Math.max(1, testimonialCount)),
				onNext: () => setTIdx((i) => (i + 1) % Math.max(1, testimonialCount))
			}),
			/* @__PURE__ */ jsx(FAQ$1, {
				faq: content.faq,
				open: openFaq,
				onToggle: (i) => setOpenFaq((cur) => cur === i ? -1 : i)
			}),
			/* @__PURE__ */ jsx(CTA$1, {
				finalCta: content.final_cta,
				primaryHref: resolveHref(content.final_cta.primary_button_href, primaryHref),
				secondaryHref: resolveHref(content.final_cta.secondary_button_href, primaryHref)
			})
		]
	});
}
function Hero$1({ hero, chat, stats, demoAgentId, starters }) {
	const [first, second, third] = stats;
	return /* @__PURE__ */ jsx("section", {
		className: "hero",
		"data-screen-label": "01 Hero",
		children: /* @__PURE__ */ jsx("div", {
			className: "wrap",
			children: /* @__PURE__ */ jsxs("div", {
				className: "hero-grid",
				children: [/* @__PURE__ */ jsxs("div", {
					className: "hero-lead",
					children: [
						/* @__PURE__ */ jsxs("span", {
							className: "eyebrow",
							children: [
								/* @__PURE__ */ jsx("span", { className: "dot" }),
								/* @__PURE__ */ jsx("span", {
									className: "idx",
									children: "S/01"
								}),
								hero.badge.toUpperCase()
							]
						}),
						/* @__PURE__ */ jsxs("h1", {
							className: "h-display",
							children: [
								hero.line_one,
								" ",
								/* @__PURE__ */ jsx("span", {
									className: "signal-mark",
									children: hero.accent
								}),
								" ",
								hero.line_two_suffix,
								" ",
								hero.line_three_prefix,
								" ",
								hero.line_three_highlight,
								" ",
								hero.line_four_highlight
							]
						}),
						/* @__PURE__ */ jsx("p", {
							className: "hero-sub",
							children: hero.description
						}),
						/* @__PURE__ */ jsxs("div", {
							className: "hero-meta",
							children: [
								first && /* @__PURE__ */ jsxs("div", { children: [first.label, /* @__PURE__ */ jsx("strong", { children: first.value })] }),
								second && /* @__PURE__ */ jsxs("div", { children: [second.label, /* @__PURE__ */ jsx("strong", { children: second.value })] }),
								third && /* @__PURE__ */ jsxs("div", { children: [third.label, /* @__PURE__ */ jsx("strong", { children: third.value })] })
							]
						})
					]
				}), /* @__PURE__ */ jsx("div", {
					className: "hero-right",
					children: /* @__PURE__ */ jsx(InteractiveChat, {
						agentId: demoAgentId,
						title: chat.title,
						badge: chat.badge,
						placeholder: hero.site_test_placeholder,
						starters,
						seedQuestion: chat.question,
						seedAnswer: chat.answer,
						offlineMessage: hero.live_demo_notice
					})
				})]
			})
		})
	});
}
function Stats$1({ stats }) {
	return /* @__PURE__ */ jsx("section", {
		"data-screen-label": "02 Stats",
		style: { paddingBottom: 0 },
		children: /* @__PURE__ */ jsx("div", {
			className: "wrap",
			children: /* @__PURE__ */ jsx("div", {
				className: "stats",
				children: stats.map((stat, idx) => /* @__PURE__ */ jsxs("div", {
					className: "stat",
					children: [
						/* @__PURE__ */ jsx("span", { className: "corner" }),
						/* @__PURE__ */ jsxs("div", {
							className: "label",
							children: [/* @__PURE__ */ jsx("span", { children: `0${idx + 1} / ${stat.label.split(" ").slice(0, 2).join(" ").toUpperCase()}` }), /* @__PURE__ */ jsx("span", { children: "↗" })]
						}),
						/* @__PURE__ */ jsx("div", {
							className: "num",
							children: stat.value
						}),
						/* @__PURE__ */ jsx("div", {
							className: "desc",
							children: stat.label
						})
					]
				}, `${stat.label}-${idx}`))
			})
		})
	});
}
function Walkthrough$1({ video }) {
	return /* @__PURE__ */ jsx("section", {
		className: "section",
		"data-screen-label": "03 Walkthrough",
		children: /* @__PURE__ */ jsx("div", {
			className: "wrap",
			children: /* @__PURE__ */ jsxs("div", {
				className: "split",
				children: [/* @__PURE__ */ jsxs("div", {
					className: "split-text",
					children: [
						/* @__PURE__ */ jsxs("span", {
							className: "eyebrow",
							children: [
								/* @__PURE__ */ jsx("span", { className: "dot" }),
								/* @__PURE__ */ jsx("span", {
									className: "idx",
									children: "S/03"
								}),
								video.badge.toUpperCase()
							]
						}),
						/* @__PURE__ */ jsx("h2", {
							className: "h-section",
							style: { marginTop: 24 },
							children: video.title
						}),
						/* @__PURE__ */ jsx("p", {
							className: "lead",
							children: video.description
						}),
						/* @__PURE__ */ jsx("ul", {
							className: "bullets",
							children: video.bullets.map((bullet) => /* @__PURE__ */ jsxs("li", { children: [/* @__PURE__ */ jsx("span", { className: "pip" }), /* @__PURE__ */ jsx("span", { children: bullet })] }, bullet))
						})
					]
				}), /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs("a", {
					className: "video-frame",
					href: video.href,
					target: "_blank",
					rel: "noopener noreferrer",
					children: [
						/* @__PURE__ */ jsxs("div", {
							className: "chrome",
							children: [
								/* @__PURE__ */ jsxs("div", {
									className: "dots",
									children: [
										/* @__PURE__ */ jsx("span", {}),
										/* @__PURE__ */ jsx("span", {}),
										/* @__PURE__ */ jsx("span", {})
									]
								}),
								/* @__PURE__ */ jsxs("span", { children: [
									video.duration_label.toUpperCase(),
									" /",
									" ",
									video.tag_label.toUpperCase()
								] }),
								/* @__PURE__ */ jsx("span", { children: video.scene_label.toUpperCase() })
							]
						}),
						/* @__PURE__ */ jsx("div", {
							className: "canvas",
							children: /* @__PURE__ */ jsx("span", {
								className: "video-play",
								"aria-label": video.button_label,
								children: /* @__PURE__ */ jsx("svg", {
									width: "28",
									height: "32",
									viewBox: "0 0 28 32",
									fill: "currentColor",
									children: /* @__PURE__ */ jsx("path", { d: "M0 0 L28 16 L0 32 Z" })
								})
							})
						}),
						/* @__PURE__ */ jsxs("div", {
							className: "runtime",
							children: ["00:00 / ", video.timecode]
						}),
						/* @__PURE__ */ jsx("div", {
							className: "runtime",
							children: video.button_label.toUpperCase()
						})
					]
				}) })]
			})
		})
	});
}
function Pages({ whereItFits }) {
	return /* @__PURE__ */ jsx("section", {
		className: "section",
		"data-screen-label": "04 Pages",
		style: { paddingTop: 0 },
		children: /* @__PURE__ */ jsxs("div", {
			className: "wrap",
			children: [/* @__PURE__ */ jsx("div", {
				className: "pages-head",
				children: /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsxs("span", {
					className: "eyebrow",
					children: [
						/* @__PURE__ */ jsx("span", { className: "dot" }),
						/* @__PURE__ */ jsx("span", {
							className: "idx",
							children: "S/04"
						}),
						whereItFits.badge.toUpperCase()
					]
				}), /* @__PURE__ */ jsx("h2", {
					className: "h-section",
					children: whereItFits.title
				})] })
			}), /* @__PURE__ */ jsx("div", {
				className: "pages-grid",
				children: whereItFits.cards.map((card, idx) => /* @__PURE__ */ jsxs("div", {
					className: "page-card",
					children: [
						/* @__PURE__ */ jsxs("div", {
							className: "page-num",
							children: [
								`0${idx + 1}`,
								" / ",
								card.title.toUpperCase()
							]
						}),
						/* @__PURE__ */ jsx("h3", {
							className: "h-card",
							children: card.title
						}),
						/* @__PURE__ */ jsx("p", { children: card.description }),
						/* @__PURE__ */ jsx("div", {
							className: "page-illust",
							children: /* @__PURE__ */ jsx(PagePreview, { kind: idx })
						}),
						/* @__PURE__ */ jsx("div", {
							className: "page-arrow",
							children: "→"
						})
					]
				}, card.title))
			})]
		})
	});
}
function PagePreview({ kind }) {
	const cell = (w, color) => ({
		height: 10,
		width: w,
		background: color,
		marginBottom: 6
	});
	return /* @__PURE__ */ jsxs("div", {
		style: {
			padding: 14,
			height: "100%"
		},
		children: [
			kind === 0 && /* @__PURE__ */ jsxs(Fragment$1, { children: [
				/* @__PURE__ */ jsx("div", { style: cell("40%", "var(--ink)") }),
				/* @__PURE__ */ jsx("div", { style: cell("70%", "var(--hairline)") }),
				/* @__PURE__ */ jsxs("div", {
					style: {
						display: "flex",
						gap: 6,
						marginTop: 10
					},
					children: [
						/* @__PURE__ */ jsx("div", { style: {
							flex: 1,
							height: 46,
							border: "1px solid var(--hairline)"
						} }),
						/* @__PURE__ */ jsx("div", { style: {
							flex: 1,
							height: 46,
							border: "1px solid var(--ink)",
							background: "var(--signal)"
						} }),
						/* @__PURE__ */ jsx("div", { style: {
							flex: 1,
							height: 46,
							border: "1px solid var(--hairline)"
						} })
					]
				})
			] }),
			kind === 1 && /* @__PURE__ */ jsxs("div", {
				style: {
					display: "flex",
					gap: 8
				},
				children: [/* @__PURE__ */ jsx("div", { style: {
					width: 50,
					height: 50,
					background: "var(--ink)"
				} }), /* @__PURE__ */ jsxs("div", {
					style: { flex: 1 },
					children: [
						/* @__PURE__ */ jsx("div", { style: cell("80%", "var(--ink)") }),
						/* @__PURE__ */ jsx("div", { style: cell("60%", "var(--hairline)") }),
						/* @__PURE__ */ jsx("div", { style: cell("40%", "var(--signal)") })
					]
				})]
			}),
			kind === 2 && /* @__PURE__ */ jsxs(Fragment$1, { children: [
				/* @__PURE__ */ jsx("div", { style: cell("30%", "var(--ink)") }),
				/* @__PURE__ */ jsx("div", { style: cell("90%", "var(--hairline)") }),
				/* @__PURE__ */ jsx("div", { style: cell("85%", "var(--hairline)") }),
				/* @__PURE__ */ jsx("div", { style: cell("50%", "var(--hairline)") })
			] })
		]
	});
}
function Features$1({ featureGrid }) {
	return /* @__PURE__ */ jsx("section", {
		className: "dark-section",
		"data-screen-label": "05 Features",
		children: /* @__PURE__ */ jsxs("div", {
			className: "wrap",
			children: [/* @__PURE__ */ jsx("div", {
				className: "feat-head",
				children: /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsxs("span", {
					className: "eyebrow",
					children: [
						/* @__PURE__ */ jsx("span", { className: "dot" }),
						/* @__PURE__ */ jsx("span", {
							className: "idx",
							children: "S/05"
						}),
						featureGrid.badge.toUpperCase()
					]
				}), /* @__PURE__ */ jsx("h2", {
					className: "h-section",
					children: featureGrid.title
				})] })
			}), /* @__PURE__ */ jsx("div", {
				className: "features",
				children: featureGrid.cards.map((card, idx) => {
					const code = card.title.split(" ")[0].slice(0, 3).toUpperCase();
					return /* @__PURE__ */ jsxs("div", {
						className: "feat",
						children: [
							/* @__PURE__ */ jsx("div", {
								className: "feat-icon",
								children: code
							}),
							/* @__PURE__ */ jsx("h3", { children: card.title }),
							/* @__PURE__ */ jsx("p", { children: card.description }),
							/* @__PURE__ */ jsxs("div", {
								className: "meta",
								children: [/* @__PURE__ */ jsxs("span", { children: ["MODULE / ", code] }), /* @__PURE__ */ jsx("span", {
									className: idx % 2 === 1 ? "live" : void 0,
									children: idx % 2 === 1 ? "LIVE" : "READY"
								})]
							})
						]
					}, card.title);
				})
			})]
		})
	});
}
function Tune$1({ control, brandName }) {
	return /* @__PURE__ */ jsx("section", {
		className: "section",
		"data-screen-label": "06 Tune",
		children: /* @__PURE__ */ jsx("div", {
			className: "wrap",
			children: /* @__PURE__ */ jsxs("div", {
				className: "tune",
				children: [/* @__PURE__ */ jsxs("div", {
					className: "tune-text",
					children: [
						/* @__PURE__ */ jsxs("span", {
							className: "eyebrow",
							children: [
								/* @__PURE__ */ jsx("span", { className: "dot" }),
								/* @__PURE__ */ jsx("span", {
									className: "idx",
									children: "S/06"
								}),
								control.badge.toUpperCase()
							]
						}),
						/* @__PURE__ */ jsx("h2", {
							className: "h-section",
							style: { marginTop: 24 },
							children: control.title
						}),
						/* @__PURE__ */ jsx("p", {
							className: "lead",
							children: control.description
						}),
						control.callouts.map((callout) => /* @__PURE__ */ jsxs("div", {
							className: "cred",
							children: [/* @__PURE__ */ jsx("div", {
								className: "lock",
								children: "★"
							}), /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("strong", { children: callout.title }), /* @__PURE__ */ jsx("span", { children: callout.description })] })]
						}, callout.title))
					]
				}), /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs("div", {
					className: "settings",
					children: [
						/* @__PURE__ */ jsxs("div", {
							className: "settings-head",
							children: [/* @__PURE__ */ jsx("span", { children: control.settings_card_title.toUpperCase() }), /* @__PURE__ */ jsxs("span", {
								className: "right",
								children: [brandName.toUpperCase(), " / CONFIG"]
							})]
						}),
						control.settings_rows.map((row, idx) => /* @__PURE__ */ jsxs("div", {
							className: "field",
							children: [/* @__PURE__ */ jsxs("div", {
								className: "label",
								children: [row.label, /* @__PURE__ */ jsx("span", {
									className: "sub",
									children: row.hint
								})]
							}), /* @__PURE__ */ jsxs("div", {
								className: idx === 0 ? "control focus" : "control",
								children: [/* @__PURE__ */ jsx("span", { children: row.value }), /* @__PURE__ */ jsx("span", {
									className: "caret",
									children: "▾"
								})]
							})]
						}, `${row.label}-${idx}`)),
						/* @__PURE__ */ jsxs("div", {
							className: "settings-foot",
							children: [/* @__PURE__ */ jsx("button", {
								type: "button",
								className: "cancel",
								tabIndex: -1,
								children: control.cancel_label
							}), /* @__PURE__ */ jsx("button", {
								type: "button",
								className: "save",
								tabIndex: -1,
								children: control.save_button_label
							})]
						})
					]
				}) })]
			})
		})
	});
}
function Steps$1({ steps }) {
	return /* @__PURE__ */ jsx("section", {
		className: "section",
		"data-screen-label": "07 Steps",
		style: { paddingTop: 0 },
		children: /* @__PURE__ */ jsxs("div", {
			className: "wrap",
			children: [/* @__PURE__ */ jsx("div", {
				className: "steps-head",
				children: /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsxs("span", {
					className: "eyebrow",
					children: [
						/* @__PURE__ */ jsx("span", { className: "dot" }),
						/* @__PURE__ */ jsx("span", {
							className: "idx",
							children: "S/07"
						}),
						steps.badge.toUpperCase()
					]
				}), /* @__PURE__ */ jsx("h2", {
					className: "h-section",
					children: steps.title
				})] })
			}), /* @__PURE__ */ jsx("div", {
				className: "steps",
				children: steps.items.map((step, idx) => /* @__PURE__ */ jsxs("div", {
					className: "step",
					children: [
						/* @__PURE__ */ jsx("span", { className: "pip-track" }),
						/* @__PURE__ */ jsxs("div", {
							className: "num",
							children: [`0${idx + 1}`, /* @__PURE__ */ jsx("small", { children: `STEP / ${idx + 1}` })]
						}),
						/* @__PURE__ */ jsx("h3", { children: step.title }),
						/* @__PURE__ */ jsx("p", { children: step.description })
					]
				}, step.title))
			})]
		})
	});
}
function Insights({ insights, spark }) {
	return /* @__PURE__ */ jsx("section", {
		className: "section",
		"data-screen-label": "08 Insights",
		style: { paddingTop: 0 },
		children: /* @__PURE__ */ jsxs("div", {
			className: "wrap",
			children: [/* @__PURE__ */ jsx("div", {
				className: "pages-head",
				children: /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsxs("span", {
					className: "eyebrow",
					children: [
						/* @__PURE__ */ jsx("span", { className: "dot" }),
						/* @__PURE__ */ jsx("span", {
							className: "idx",
							children: "S/08"
						}),
						insights.badge.toUpperCase()
					]
				}), /* @__PURE__ */ jsx("h2", {
					className: "h-section",
					children: insights.chart_title
				})] })
			}), /* @__PURE__ */ jsxs("div", {
				className: "insights",
				children: [/* @__PURE__ */ jsxs("div", {
					className: "chart-card",
					children: [
						/* @__PURE__ */ jsxs("div", {
							className: "chart-head",
							children: [
								/* @__PURE__ */ jsx("h3", { children: insights.chart_title }),
								/* @__PURE__ */ jsx("p", { children: insights.chart_description }),
								/* @__PURE__ */ jsxs("div", {
									className: "chart-num",
									children: [/* @__PURE__ */ jsx("span", {
										className: "big",
										children: insights.metric_value
									}), /* @__PURE__ */ jsx("span", {
										className: "delta",
										children: insights.metric_trend.toUpperCase()
									})]
								}),
								/* @__PURE__ */ jsxs("div", {
									className: "chart-cap",
									children: [insights.metric_label.toUpperCase(), " / SOURCE: PITCHBAR ANALYTICS"]
								})
							]
						}),
						/* @__PURE__ */ jsxs("svg", {
							className: "chart-svg",
							viewBox: `0 0 ${spark.w} ${spark.h}`,
							preserveAspectRatio: "none",
							children: [
								/* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsx("pattern", {
									id: "aurora-grid",
									width: "50",
									height: "40",
									patternUnits: "userSpaceOnUse",
									children: /* @__PURE__ */ jsx("path", {
										d: "M 50 0 L 0 0 0 40",
										fill: "none",
										stroke: "var(--hairline)",
										strokeWidth: "1"
									})
								}) }),
								/* @__PURE__ */ jsx("rect", {
									width: spark.w,
									height: spark.h,
									fill: "url(#aurora-grid)"
								}),
								/* @__PURE__ */ jsx("path", {
									d: spark.area,
									fill: "var(--signal)",
									opacity: "0.45"
								}),
								/* @__PURE__ */ jsx("path", {
									d: spark.line,
									fill: "none",
									stroke: "var(--ink)",
									strokeWidth: "2.5"
								}),
								spark.dots.map((c, i) => /* @__PURE__ */ jsx("circle", {
									cx: c.x,
									cy: c.y,
									r: "4",
									fill: "var(--paper)",
									stroke: "var(--ink)",
									strokeWidth: "2"
								}, `dot-${i}`))
							]
						}),
						/* @__PURE__ */ jsx("div", {
							className: "chart-x",
							children: insights.chart_labels.map((label) => /* @__PURE__ */ jsx("span", { children: label.toUpperCase() }, label))
						})
					]
				}), /* @__PURE__ */ jsx("div", {
					className: "insight-list",
					children: insights.cards.map((card) => /* @__PURE__ */ jsxs("div", {
						className: "insight-row",
						children: [
							/* @__PURE__ */ jsx("div", {
								className: "insight-icon",
								children: card.title.split(" ")[0].slice(0, 2).toUpperCase()
							}),
							/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("h4", { children: card.title }), /* @__PURE__ */ jsx("p", { children: card.description })] }),
							/* @__PURE__ */ jsx("div", {
								className: "row-arrow",
								children: "→"
							})
						]
					}, card.title))
				})]
			})]
		})
	});
}
function Testimonial$1({ testimonials, current, index, total, onPrev, onNext }) {
	if (!current) return null;
	return /* @__PURE__ */ jsx("section", {
		className: "section",
		"data-screen-label": "09 Testimonial",
		style: { paddingTop: 0 },
		children: /* @__PURE__ */ jsx("div", {
			className: "wrap",
			children: /* @__PURE__ */ jsxs("div", {
				className: "testimonial",
				children: [/* @__PURE__ */ jsxs("div", {
					className: "t-side",
					children: [
						/* @__PURE__ */ jsxs("span", {
							className: "eyebrow",
							children: [
								/* @__PURE__ */ jsx("span", { className: "dot" }),
								/* @__PURE__ */ jsx("span", {
									className: "idx",
									children: "S/09"
								}),
								testimonials.badge.toUpperCase()
							]
						}),
						/* @__PURE__ */ jsx("h2", {
							className: "h-section",
							style: { marginTop: 24 },
							children: testimonials.title
						}),
						/* @__PURE__ */ jsx("p", { children: testimonials.kicker })
					]
				}), /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsxs("div", {
					className: "quote-card",
					children: [
						/* @__PURE__ */ jsx("div", {
							className: "open",
							children: "“"
						}),
						/* @__PURE__ */ jsx("div", {
							className: "body",
							children: current.quote
						}),
						/* @__PURE__ */ jsxs("div", {
							className: "by",
							children: [/* @__PURE__ */ jsx("div", {
								className: "avatar",
								children: initials(current.name)
							}), /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("strong", { children: current.name }), /* @__PURE__ */ jsxs("span", {
								style: { display: "block" },
								children: [
									current.role.toUpperCase(),
									" ·",
									" ",
									current.company.toUpperCase()
								]
							})] })]
						})
					]
				}), /* @__PURE__ */ jsxs("div", {
					className: "quote-pager",
					children: [
						/* @__PURE__ */ jsxs("span", { children: [
							String(index + 1).padStart(2, "0"),
							" /",
							" ",
							String(total).padStart(2, "0")
						] }),
						/* @__PURE__ */ jsx("button", {
							type: "button",
							onClick: onPrev,
							"aria-label": "Previous testimonial",
							children: "←"
						}),
						/* @__PURE__ */ jsx("button", {
							type: "button",
							onClick: onNext,
							"aria-label": "Next testimonial",
							children: "→"
						})
					]
				})] })]
			})
		})
	});
}
function FAQ$1({ faq, open, onToggle }) {
	return /* @__PURE__ */ jsx("section", {
		className: "section",
		"data-screen-label": "10 FAQ",
		style: { paddingTop: 0 },
		children: /* @__PURE__ */ jsxs("div", {
			className: "wrap",
			children: [/* @__PURE__ */ jsx("div", {
				className: "faq-head",
				children: /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsxs("span", {
					className: "eyebrow",
					children: [
						/* @__PURE__ */ jsx("span", { className: "dot" }),
						/* @__PURE__ */ jsx("span", {
							className: "idx",
							children: "S/10"
						}),
						faq.badge.toUpperCase()
					]
				}), /* @__PURE__ */ jsx("h2", {
					className: "h-section",
					children: faq.title
				})] })
			}), /* @__PURE__ */ jsx("div", {
				className: "faq",
				children: faq.items.map((item, i) => /* @__PURE__ */ jsxs("div", {
					className: `faq-row ${open === i ? "open" : ""}`,
					children: [/* @__PURE__ */ jsxs("button", {
						type: "button",
						className: "faq-q",
						onClick: () => onToggle(i),
						children: [
							/* @__PURE__ */ jsxs("span", {
								className: "qnum",
								children: ["Q.", String(i + 1).padStart(2, "0")]
							}),
							/* @__PURE__ */ jsx("span", { children: item.question }),
							/* @__PURE__ */ jsxs("span", {
								className: "toggle",
								children: [/* @__PURE__ */ jsx("span", { className: "h" }), /* @__PURE__ */ jsx("span", { className: "v" })]
							})
						]
					}), /* @__PURE__ */ jsx("div", {
						className: "faq-a",
						children: /* @__PURE__ */ jsx("div", {
							className: "faq-a-inner",
							children: item.answer
						})
					})]
				}, item.question))
			})]
		})
	});
}
function CTA$1({ finalCta, primaryHref, secondaryHref }) {
	return /* @__PURE__ */ jsx("section", {
		className: "cta",
		"data-screen-label": "11 CTA",
		children: /* @__PURE__ */ jsx("div", {
			className: "wrap",
			children: /* @__PURE__ */ jsxs("div", {
				className: "cta-grid",
				children: [/* @__PURE__ */ jsxs("div", { children: [
					/* @__PURE__ */ jsxs("span", {
						className: "eyebrow",
						style: { color: "var(--paper)" },
						children: [
							/* @__PURE__ */ jsx("span", { className: "dot" }),
							/* @__PURE__ */ jsx("span", {
								className: "idx",
								style: { color: "rgba(255,255,255,0.5)" },
								children: "S/11"
							}),
							"READY?"
						]
					}),
					/* @__PURE__ */ jsx("h2", {
						style: { marginTop: 24 },
						children: finalCta.title
					}),
					/* @__PURE__ */ jsx("p", { children: finalCta.description })
				] }), /* @__PURE__ */ jsxs("div", {
					className: "cta-actions",
					children: [/* @__PURE__ */ jsxs(Link, {
						href: primaryHref,
						className: "btn-big primary",
						children: [/* @__PURE__ */ jsx("span", { children: finalCta.primary_button_label }), /* @__PURE__ */ jsx("span", { children: "→" })]
					}), /* @__PURE__ */ jsxs(Link, {
						href: secondaryHref,
						className: "btn-big",
						children: [/* @__PURE__ */ jsx("span", { children: finalCta.secondary_button_label }), /* @__PURE__ */ jsx("span", { children: "→" })]
					})]
				})]
			})
		})
	});
}
//#endregion
//#region resources/js/pages/marketing-themes/aurora/how-it-works.tsx
var how_it_works_exports$1 = /* @__PURE__ */ __exportAll({ default: () => AuroraHowItWorks });
function AuroraHowItWorks({ shell, brand, steps, latency }) {
	return /* @__PURE__ */ jsxs(AuroraLayout, {
		brand,
		navItems: shell.nav_items,
		footer: shell.footer,
		title: `How it works — ${brand}`,
		description: `How the ${brand} sales AI widget turns your website into a 24/7 sales rep — from setup to first conversation in under 5 minutes.`,
		children: [
			/* @__PURE__ */ jsx("section", {
				className: "section",
				"data-screen-label": "HIW hero",
				style: { paddingBottom: 24 },
				children: /* @__PURE__ */ jsx("div", {
					className: "wrap",
					children: /* @__PURE__ */ jsxs("div", {
						style: { maxWidth: 880 },
						children: [
							/* @__PURE__ */ jsxs("span", {
								className: "eyebrow",
								children: [
									/* @__PURE__ */ jsx("span", { className: "dot" }),
									/* @__PURE__ */ jsx("span", {
										className: "idx",
										children: "H/01"
									}),
									"HOW IT WORKS"
								]
							}),
							/* @__PURE__ */ jsxs("h1", {
								className: "h-display",
								style: {
									marginTop: 28,
									fontSize: "clamp(40px, 6.5vw, 96px)"
								},
								children: [
									"From URL to live agent in",
									" ",
									/* @__PURE__ */ jsx("span", {
										className: "signal-mark",
										children: "under 5 minutes"
									}),
									"."
								]
							}),
							/* @__PURE__ */ jsxs("p", {
								className: "lead",
								style: {
									marginTop: 22,
									color: "var(--muted)"
								},
								children: [brand, " reads your website, builds an AI agent grounded in your own content, and embeds it on any page with one line of HTML. Here's exactly what happens."]
							})
						]
					})
				})
			}),
			/* @__PURE__ */ jsx("section", {
				className: "section",
				"data-screen-label": "HIW steps",
				style: { paddingTop: 0 },
				children: /* @__PURE__ */ jsx("div", {
					className: "wrap",
					children: /* @__PURE__ */ jsx("div", {
						className: "steps",
						children: steps.map((step) => /* @__PURE__ */ jsxs("div", {
							className: "step",
							children: [
								/* @__PURE__ */ jsx("span", { className: "pip-track" }),
								/* @__PURE__ */ jsxs("div", {
									className: "num",
									children: [step.number, /* @__PURE__ */ jsx("small", { children: step.duration.toUpperCase() })]
								}),
								/* @__PURE__ */ jsx("h3", { children: step.title }),
								/* @__PURE__ */ jsx("p", { children: step.description }),
								step.sub_points.length > 0 && /* @__PURE__ */ jsx("ul", {
									className: "bullets",
									style: {
										marginTop: 12,
										borderTop: "var(--hair)",
										paddingTop: 12
									},
									children: step.sub_points.map((point) => /* @__PURE__ */ jsxs("li", { children: [/* @__PURE__ */ jsx("span", { className: "pip" }), /* @__PURE__ */ jsx("span", { children: point })] }, point))
								})
							]
						}, step.number))
					})
				})
			}),
			/* @__PURE__ */ jsx("section", {
				className: "section",
				"data-screen-label": "HIW latency",
				style: { paddingTop: 0 },
				children: /* @__PURE__ */ jsx("div", {
					className: "wrap",
					children: /* @__PURE__ */ jsxs("div", {
						className: "tune",
						children: [/* @__PURE__ */ jsxs("div", {
							className: "tune-text",
							children: [
								/* @__PURE__ */ jsxs("span", {
									className: "eyebrow",
									children: [
										/* @__PURE__ */ jsx("span", { className: "dot" }),
										/* @__PURE__ */ jsx("span", {
											className: "idx",
											children: "H/02"
										}),
										"HOT PATH CONTRACT"
									]
								}),
								/* @__PURE__ */ jsxs("h2", {
									className: "h-section",
									style: { marginTop: 24 },
									children: [
										"1 second to",
										" ",
										/* @__PURE__ */ jsx("span", {
											className: "signal-mark",
											children: "first token"
										}),
										". Every time."
									]
								}),
								/* @__PURE__ */ jsx("p", {
									className: "lead",
									children: "The visitor-message → first-token path has a hard p95 budget. No DB writes, no synchronous webhooks, no retries. Persistence and analytics are dispatched async after the stream completes."
								}),
								/* @__PURE__ */ jsx("p", {
									style: {
										fontSize: 15.5,
										lineHeight: 1.6,
										color: "var(--muted)",
										marginTop: 12
									},
									children: "OpenTelemetry spans wrap every phase, so when the budget breaks the span heatmap points right at the offender."
								})
							]
						}), /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs("div", {
							className: "settings",
							children: [
								/* @__PURE__ */ jsxs("div", {
									className: "settings-head",
									children: [/* @__PURE__ */ jsx("span", { children: "P95 LATENCY BUDGET" }), /* @__PURE__ */ jsxs("span", {
										className: "right",
										children: [brand.toUpperCase(), " / HOT PATH"]
									})]
								}),
								latency.map((row, idx) => /* @__PURE__ */ jsxs("div", {
									className: "field",
									children: [/* @__PURE__ */ jsxs("div", {
										className: "label",
										children: [row.phase, /* @__PURE__ */ jsx("span", {
											className: "sub",
											children: `PHASE ${idx + 1}`
										})]
									}), /* @__PURE__ */ jsxs("div", {
										className: "control",
										children: [/* @__PURE__ */ jsx("span", {
											style: { fontFamily: "var(--mono)" },
											children: row.budget
										}), /* @__PURE__ */ jsx("span", {
											className: "caret",
											children: "·"
										})]
									})]
								}, row.phase)),
								/* @__PURE__ */ jsxs("div", {
									className: "field",
									style: {
										borderTop: "2px solid var(--ink)",
										background: "var(--paper-2)"
									},
									children: [/* @__PURE__ */ jsxs("div", {
										className: "label",
										children: ["Total to first token", /* @__PURE__ */ jsx("span", {
											className: "sub",
											children: "P95 BUDGET"
										})]
									}), /* @__PURE__ */ jsxs("div", {
										className: "control focus",
										children: [/* @__PURE__ */ jsx("span", {
											style: {
												fontFamily: "var(--mono)",
												fontWeight: 600
											},
											children: "~ 865 ms"
										}), /* @__PURE__ */ jsx("span", {
											className: "caret",
											children: "↗"
										})]
									})]
								})
							]
						}) })]
					})
				})
			}),
			/* @__PURE__ */ jsx("section", {
				className: "cta",
				"data-screen-label": "HIW CTA",
				children: /* @__PURE__ */ jsx("div", {
					className: "wrap",
					children: /* @__PURE__ */ jsxs("div", {
						className: "cta-grid",
						children: [/* @__PURE__ */ jsxs("div", { children: [
							/* @__PURE__ */ jsxs("span", {
								className: "eyebrow",
								style: { color: "var(--paper)" },
								children: [
									/* @__PURE__ */ jsx("span", { className: "dot" }),
									/* @__PURE__ */ jsx("span", {
										className: "idx",
										style: { color: "rgba(255,255,255,0.5)" },
										children: "H/03"
									}),
									"START NOW"
								]
							}),
							/* @__PURE__ */ jsxs("h2", {
								style: { marginTop: 24 },
								children: [
									"Try it on your",
									" ",
									/* @__PURE__ */ jsx("span", {
										className: "signal-mark",
										children: "own site"
									}),
									"."
								]
							}),
							/* @__PURE__ */ jsx("p", { children: "Free to start. No card required. Live in 5 minutes." })
						] }), /* @__PURE__ */ jsxs("div", {
							className: "cta-actions",
							children: [/* @__PURE__ */ jsxs(Link, {
								href: "/register",
								className: "btn-big primary",
								children: [/* @__PURE__ */ jsx("span", { children: "Start free" }), /* @__PURE__ */ jsx("span", { children: "→" })]
							}), /* @__PURE__ */ jsxs(Link, {
								href: "/pricing",
								className: "btn-big",
								children: [/* @__PURE__ */ jsx("span", { children: "See pricing" }), /* @__PURE__ */ jsx("span", { children: "→" })]
							})]
						})]
					})
				})
			})
		]
	});
}
//#endregion
//#region resources/js/pages/marketing-themes/aurora/integrations.tsx
var integrations_exports$1 = /* @__PURE__ */ __exportAll({ default: () => AuroraIntegrations });
function code$1(name) {
	return name.split(/\s+/).slice(0, 2).map((p) => p[0]).join("").toUpperCase().slice(0, 3) || "IN";
}
function AuroraIntegrations({ shell, brand, native, data_sources, roadmap }) {
	return /* @__PURE__ */ jsxs(AuroraLayout, {
		brand,
		navItems: shell.nav_items,
		footer: shell.footer,
		title: `Integrations — ${brand}`,
		description: `Plug ${brand} into the tools your team already uses — Notion, Google Docs, Slack, Stripe, webhooks, and more.`,
		children: [
			/* @__PURE__ */ jsx("section", {
				className: "section",
				"data-screen-label": "INT hero",
				style: { paddingBottom: 32 },
				children: /* @__PURE__ */ jsx("div", {
					className: "wrap",
					children: /* @__PURE__ */ jsxs("div", {
						style: { maxWidth: 900 },
						children: [
							/* @__PURE__ */ jsxs("span", {
								className: "eyebrow",
								children: [
									/* @__PURE__ */ jsx("span", { className: "dot" }),
									/* @__PURE__ */ jsx("span", {
										className: "idx",
										children: "I/01"
									}),
									"INTEGRATIONS"
								]
							}),
							/* @__PURE__ */ jsxs("h1", {
								className: "h-display",
								style: {
									marginTop: 28,
									fontSize: "clamp(40px, 6vw, 96px)"
								},
								children: [
									"Plug ",
									brand,
									" into the",
									" ",
									/* @__PURE__ */ jsx("span", {
										className: "signal-mark",
										children: "tools you already use"
									}),
									"."
								]
							}),
							/* @__PURE__ */ jsx("p", {
								className: "lead",
								style: {
									marginTop: 22,
									color: "var(--muted)"
								},
								children: "Native sync where it matters, signed webhooks everywhere else. Bring your knowledge in. Push leads out. Capture human escalations without leaving Slack."
							})
						]
					})
				})
			}),
			/* @__PURE__ */ jsx("section", {
				className: "dark-section",
				"data-screen-label": "INT native",
				children: /* @__PURE__ */ jsxs("div", {
					className: "wrap",
					children: [/* @__PURE__ */ jsx("div", {
						className: "feat-head",
						children: /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsxs("span", {
							className: "eyebrow",
							children: [
								/* @__PURE__ */ jsx("span", { className: "dot" }),
								/* @__PURE__ */ jsx("span", {
									className: "idx",
									children: "I/02"
								}),
								"NATIVE INTEGRATIONS"
							]
						}), /* @__PURE__ */ jsx("h2", {
							className: "h-section",
							children: "Ship-ready connectors, no glue code."
						})] })
					}), /* @__PURE__ */ jsx("div", {
						className: "features",
						children: native.map((item) => /* @__PURE__ */ jsxs("div", {
							className: "feat",
							children: [
								/* @__PURE__ */ jsx("div", {
									className: "feat-icon",
									children: code$1(item.name)
								}),
								/* @__PURE__ */ jsx("h3", { children: item.name }),
								/* @__PURE__ */ jsxs("p", { children: [
									/* @__PURE__ */ jsx("strong", {
										style: { color: "var(--paper)" },
										children: item.tagline
									}),
									/* @__PURE__ */ jsx("br", {}),
									item.description
								] }),
								/* @__PURE__ */ jsxs("div", {
									className: "meta",
									children: [/* @__PURE__ */ jsx("span", { children: item.category.toUpperCase() }), /* @__PURE__ */ jsx("span", {
										className: "live",
										children: "LIVE"
									})]
								})
							]
						}, item.name))
					})]
				})
			}),
			/* @__PURE__ */ jsx("section", {
				className: "section",
				"data-screen-label": "INT sources",
				children: /* @__PURE__ */ jsx("div", {
					className: "wrap",
					children: /* @__PURE__ */ jsxs("div", {
						className: "tune",
						children: [/* @__PURE__ */ jsxs("div", {
							className: "tune-text",
							children: [
								/* @__PURE__ */ jsxs("span", {
									className: "eyebrow",
									children: [
										/* @__PURE__ */ jsx("span", { className: "dot" }),
										/* @__PURE__ */ jsx("span", {
											className: "idx",
											children: "I/03"
										}),
										"KNOWLEDGE IN"
									]
								}),
								/* @__PURE__ */ jsx("h2", {
									className: "h-section",
									style: { marginTop: 24 },
									children: "Five ways to feed the agent."
								}),
								/* @__PURE__ */ jsx("p", {
									className: "lead",
									children: "Mix and match — most teams start with a sitemap crawl, paste a few FAQs, and turn on auto-index for the long tail."
								})
							]
						}), /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs("div", {
							className: "settings",
							children: [/* @__PURE__ */ jsxs("div", {
								className: "settings-head",
								children: [/* @__PURE__ */ jsx("span", { children: "SOURCE TYPES" }), /* @__PURE__ */ jsxs("span", {
									className: "right",
									children: [brand.toUpperCase(), " / INGEST"]
								})]
							}), data_sources.map((src) => /* @__PURE__ */ jsxs("div", {
								className: "field",
								children: [/* @__PURE__ */ jsxs("div", {
									className: "label",
									children: [src.name, /* @__PURE__ */ jsx("span", {
										className: "sub",
										children: src.tagline
									})]
								}), /* @__PURE__ */ jsxs("div", {
									className: "control",
									children: [/* @__PURE__ */ jsx("span", {
										style: { fontFamily: "var(--mono)" },
										children: code$1(src.name)
									}), /* @__PURE__ */ jsx("span", {
										className: "caret",
										children: "+"
									})]
								})]
							}, src.name))]
						}) })]
					})
				})
			}),
			/* @__PURE__ */ jsx("section", {
				className: "section",
				"data-screen-label": "INT roadmap",
				style: { paddingTop: 0 },
				children: /* @__PURE__ */ jsxs("div", {
					className: "wrap",
					children: [/* @__PURE__ */ jsxs("div", {
						className: "pages-head",
						children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsxs("span", {
							className: "eyebrow",
							children: [
								/* @__PURE__ */ jsx("span", { className: "dot" }),
								/* @__PURE__ */ jsx("span", {
									className: "idx",
									children: "I/04"
								}),
								"ON THE ROADMAP"
							]
						}), /* @__PURE__ */ jsx("h2", {
							className: "h-section",
							children: "Coming soon."
						})] }), /* @__PURE__ */ jsx("p", {
							className: "lead",
							style: {
								color: "var(--muted)",
								fontSize: 15
							},
							children: "Until these ship natively, the outgoing webhook + a Zapier catch-hook covers every CRM in your stack."
						})]
					}), /* @__PURE__ */ jsx("div", {
						className: "pages-grid",
						children: roadmap.map((item, idx) => /* @__PURE__ */ jsxs("div", {
							className: "page-card",
							children: [
								/* @__PURE__ */ jsxs("div", {
									className: "page-num",
									children: [
										`0${idx + 1}`,
										" / ",
										item.name.toUpperCase()
									]
								}),
								/* @__PURE__ */ jsx("h3", {
									className: "h-card",
									children: item.name
								}),
								/* @__PURE__ */ jsx("p", { children: item.tagline }),
								/* @__PURE__ */ jsx("div", {
									className: "page-arrow",
									children: "→"
								})
							]
						}, item.name))
					})]
				})
			}),
			/* @__PURE__ */ jsx("section", {
				className: "cta",
				"data-screen-label": "INT CTA",
				children: /* @__PURE__ */ jsx("div", {
					className: "wrap",
					children: /* @__PURE__ */ jsxs("div", {
						className: "cta-grid",
						children: [/* @__PURE__ */ jsxs("div", { children: [
							/* @__PURE__ */ jsxs("span", {
								className: "eyebrow",
								style: { color: "var(--paper)" },
								children: [
									/* @__PURE__ */ jsx("span", { className: "dot" }),
									/* @__PURE__ */ jsx("span", {
										className: "idx",
										style: { color: "rgba(255,255,255,0.5)" },
										children: "I/05"
									}),
									"READY?"
								]
							}),
							/* @__PURE__ */ jsxs("h2", {
								style: { marginTop: 24 },
								children: [
									"Ready to",
									" ",
									/* @__PURE__ */ jsx("span", {
										className: "signal-mark",
										children: "plug it in?"
									})
								]
							}),
							/* @__PURE__ */ jsx("p", { children: "Free to start. Connect Notion, Slack, and your first webhook in under 5 minutes." })
						] }), /* @__PURE__ */ jsxs("div", {
							className: "cta-actions",
							children: [/* @__PURE__ */ jsxs(Link, {
								href: "/register",
								className: "btn-big primary",
								children: [/* @__PURE__ */ jsx("span", { children: "Get started free" }), /* @__PURE__ */ jsx("span", { children: "→" })]
							}), /* @__PURE__ */ jsxs("a", {
								href: "/documentation/integrations",
								target: "_blank",
								rel: "noopener noreferrer",
								className: "btn-big",
								children: [/* @__PURE__ */ jsx("span", { children: "Read integration docs" }), /* @__PURE__ */ jsx("span", { children: "↗" })]
							})]
						})]
					})
				})
			})
		]
	});
}
//#endregion
//#region resources/js/pages/marketing-themes/aurora/pricing.tsx
var pricing_exports$1 = /* @__PURE__ */ __exportAll({ default: () => AuroraPricing });
function formatPrice$1(value, symbol, decimals) {
	return `${symbol}${value.toLocaleString(void 0, {
		minimumFractionDigits: decimals,
		maximumFractionDigits: decimals
	})}`;
}
function MatrixValue$1({ value }) {
	if (value === true) return /* @__PURE__ */ jsx("span", { style: {
		display: "inline-block",
		width: 12,
		height: 12,
		background: "var(--signal)",
		border: "1px solid var(--ink)"
	} });
	if (value === false) return /* @__PURE__ */ jsx("span", {
		style: { color: "var(--muted)" },
		children: "—"
	});
	return /* @__PURE__ */ jsx("span", {
		style: {
			fontFamily: "var(--mono)",
			fontSize: 13
		},
		children: value
	});
}
function FaqItem$1({ q, a, index }) {
	const [open, setOpen] = useState(false);
	return /* @__PURE__ */ jsxs("div", {
		className: `faq-row ${open ? "open" : ""}`,
		children: [/* @__PURE__ */ jsxs("button", {
			type: "button",
			className: "faq-q",
			onClick: () => setOpen((v) => !v),
			children: [
				/* @__PURE__ */ jsxs("span", {
					className: "qnum",
					children: ["Q.", String(index + 1).padStart(2, "0")]
				}),
				/* @__PURE__ */ jsx("span", { children: q }),
				/* @__PURE__ */ jsxs("span", {
					className: "toggle",
					children: [/* @__PURE__ */ jsx("span", { className: "h" }), /* @__PURE__ */ jsx("span", { className: "v" })]
				})
			]
		}), /* @__PURE__ */ jsx("div", {
			className: "faq-a",
			children: /* @__PURE__ */ jsx("div", {
				className: "faq-a-inner",
				children: a
			})
		})]
	});
}
function AuroraPricing({ shell, brand, plans, lifetime_plans, currency, currencies, matrix, faqs, contact_email }) {
	const [interval, setInterval] = useState("month");
	const onCurrencyChange = (code) => {
		if (code === currency) return;
		router.visit(`/pricing?currency=${encodeURIComponent(code)}`, {
			preserveScroll: true,
			preserveState: false
		});
	};
	const hasAnnualOption = plans.some((p) => p.yearly_price > 0 && p.monthly_price > 0);
	const annualSavingsPercent = (() => {
		const candidate = plans.find((p) => p.monthly_price > 0 && p.yearly_price > 0);
		if (!candidate) return 0;
		const monthlyOverYear = candidate.monthly_price * 12;
		const saved = monthlyOverYear - candidate.yearly_price;
		return monthlyOverYear === 0 ? 0 : Math.round(saved / monthlyOverYear * 100);
	})();
	return /* @__PURE__ */ jsxs(AuroraLayout, {
		brand,
		navItems: shell.nav_items,
		footer: shell.footer,
		title: `Pricing — ${brand}`,
		description: `Simple, conversation-based pricing for the ${brand} sales AI widget. Start free; scale as you grow.`,
		children: [
			/* @__PURE__ */ jsx("section", {
				className: "section",
				"data-screen-label": "Pricing hero",
				style: { paddingBottom: 32 },
				children: /* @__PURE__ */ jsx("div", {
					className: "wrap",
					children: /* @__PURE__ */ jsxs("div", {
						style: { maxWidth: 880 },
						children: [
							/* @__PURE__ */ jsxs("span", {
								className: "eyebrow",
								children: [
									/* @__PURE__ */ jsx("span", { className: "dot" }),
									/* @__PURE__ */ jsx("span", {
										className: "idx",
										children: "$/01"
									}),
									"PRICING"
								]
							}),
							/* @__PURE__ */ jsxs("h1", {
								className: "h-display",
								style: {
									marginTop: 28,
									fontSize: "clamp(40px, 6vw, 96px)"
								},
								children: [
									"Simple,",
									" ",
									/* @__PURE__ */ jsx("span", {
										className: "signal-mark",
										children: "conversation-based"
									}),
									" ",
									"pricing."
								]
							}),
							/* @__PURE__ */ jsx("p", {
								className: "lead",
								style: {
									marginTop: 22,
									color: "var(--muted)"
								},
								children: "Start free. Upgrade when you outgrow it. No per-seat fees, no setup fees, no surprise overages — just a clear conversation limit."
							}),
							/* @__PURE__ */ jsxs("div", {
								style: {
									marginTop: 36,
									display: "flex",
									flexWrap: "wrap",
									gap: 12,
									alignItems: "center"
								},
								children: [hasAnnualOption && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("div", {
									role: "radiogroup",
									"aria-label": "Billing interval",
									style: {
										display: "inline-flex",
										border: "1px solid var(--ink)"
									},
									children: ["month", "year"].map((v) => /* @__PURE__ */ jsx("button", {
										type: "button",
										role: "radio",
										"aria-checked": interval === v,
										onClick: () => setInterval(v),
										style: {
											padding: "10px 18px",
											fontFamily: "var(--mono)",
											fontSize: 11,
											letterSpacing: "0.08em",
											textTransform: "uppercase",
											background: interval === v ? "var(--ink)" : "transparent",
											color: interval === v ? "var(--paper)" : "var(--ink)"
										},
										children: v === "month" ? "Monthly" : "Yearly"
									}, v))
								}), annualSavingsPercent > 0 && /* @__PURE__ */ jsxs("span", {
									style: {
										background: "var(--signal)",
										border: "1px solid var(--ink)",
										padding: "8px 12px",
										fontFamily: "var(--mono)",
										fontSize: 11,
										letterSpacing: "0.06em",
										textTransform: "uppercase"
									},
									children: [
										"Save ",
										annualSavingsPercent,
										"% yearly"
									]
								})] }), currencies.length > 1 && /* @__PURE__ */ jsxs("label", {
									style: {
										display: "inline-flex",
										alignItems: "center",
										gap: 8,
										border: "1px solid var(--ink)",
										padding: "8px 12px",
										fontFamily: "var(--mono)",
										fontSize: 11,
										letterSpacing: "0.06em"
									},
									children: [/* @__PURE__ */ jsx("span", {
										style: { color: "var(--muted)" },
										children: "CURRENCY"
									}), /* @__PURE__ */ jsx("select", {
										value: currency,
										onChange: (e) => onCurrencyChange(e.target.value),
										"aria-label": "Display currency",
										style: {
											background: "transparent",
											border: 0,
											fontWeight: 600,
											color: "var(--ink)"
										},
										children: currencies.map((c) => /* @__PURE__ */ jsxs("option", {
											value: c.code,
											children: [
												c.code,
												" — ",
												c.name
											]
										}, c.code))
									})]
								})]
							})
						]
					})
				})
			}),
			/* @__PURE__ */ jsx("section", {
				className: "section",
				"data-screen-label": "Pricing plans",
				style: { paddingTop: 0 },
				children: /* @__PURE__ */ jsxs("div", {
					className: "wrap",
					children: [/* @__PURE__ */ jsx("div", {
						className: "aurora-plans-grid",
						style: {
							display: "grid",
							gridTemplateColumns: plans.length <= 1 ? "1fr" : `repeat(auto-fit, minmax(${plans.length === 2 ? "300px" : plans.length === 3 ? "240px" : "220px"}, 1fr))`,
							gap: 0,
							border: "2px solid var(--ink)"
						},
						children: plans.map((plan, idx) => {
							const showYearly = interval === "year" && plan.yearly_price > 0;
							const headlinePrice = showYearly ? Math.round(plan.yearly_price / 12) : plan.monthly_price;
							const ctaHref = interval === "year" && plan.yearly_price > 0 ? plan.cta_href + (plan.cta_href.includes("?") ? "&" : "?") + "interval=year" : plan.cta_href;
							return /* @__PURE__ */ jsxs("div", {
								className: "aurora-plan-card",
								"data-first": idx === 0 ? "true" : void 0,
								style: {
									padding: 28,
									borderLeft: idx === 0 ? 0 : "1px solid var(--hairline)",
									background: plan.highlight ? "var(--signal)" : "transparent",
									position: "relative",
									display: "flex",
									flexDirection: "column"
								},
								children: [
									plan.highlight && /* @__PURE__ */ jsx("span", {
										style: {
											position: "absolute",
											top: -1,
											right: -1,
											background: "var(--ink)",
											color: "var(--paper)",
											fontFamily: "var(--mono)",
											fontSize: 10,
											letterSpacing: "0.1em",
											padding: "6px 10px"
										},
										children: "MOST POPULAR"
									}),
									/* @__PURE__ */ jsx("h3", {
										style: {
											fontFamily: "var(--display)",
											fontSize: 22,
											fontWeight: 500,
											letterSpacing: "-0.015em"
										},
										children: plan.name
									}),
									/* @__PURE__ */ jsx("p", {
										style: {
											marginTop: 6,
											fontSize: 13,
											color: "var(--muted)",
											lineHeight: 1.5
										},
										children: plan.tagline
									}),
									/* @__PURE__ */ jsxs("div", {
										style: {
											marginTop: 24,
											display: "flex",
											alignItems: "baseline",
											gap: 4
										},
										children: [/* @__PURE__ */ jsx("span", {
											style: {
												fontFamily: "var(--display)",
												fontWeight: 500,
												fontSize: "clamp(36px, 4vw, 56px)",
												letterSpacing: "-0.04em",
												lineHeight: 1
											},
											children: formatPrice$1(headlinePrice, plan.currency_symbol, plan.decimal_places)
										}), headlinePrice > 0 && /* @__PURE__ */ jsx("span", {
											style: {
												fontFamily: "var(--mono)",
												fontSize: 12,
												color: "var(--muted)"
											},
											children: "/month"
										})]
									}),
									showYearly && plan.yearly_price > 0 && /* @__PURE__ */ jsxs("p", {
										style: {
											marginTop: 6,
											fontFamily: "var(--mono)",
											fontSize: 11,
											color: "var(--muted)"
										},
										children: [
											formatPrice$1(plan.yearly_price, plan.currency_symbol, plan.decimal_places),
											" ",
											"billed annually"
										]
									}),
									/* @__PURE__ */ jsx("p", {
										style: {
											marginTop: 14,
											fontSize: 14,
											fontWeight: 600
										},
										children: plan.volume
									}),
									/* @__PURE__ */ jsx("ul", {
										style: {
											marginTop: 22,
											listStyle: "none",
											display: "flex",
											flexDirection: "column",
											gap: 10,
											flex: 1
										},
										children: plan.features.map((feature) => /* @__PURE__ */ jsxs("li", {
											style: {
												display: "grid",
												gridTemplateColumns: "auto 1fr",
												gap: 10,
												fontSize: 13.5,
												lineHeight: 1.5
											},
											children: [/* @__PURE__ */ jsx("span", { style: {
												width: 8,
												height: 8,
												marginTop: 6,
												background: "var(--ink)"
											} }), /* @__PURE__ */ jsx("span", { children: feature })]
										}, feature))
									}),
									/* @__PURE__ */ jsxs(Link, {
										href: ctaHref,
										className: "btn",
										style: {
											marginTop: 24,
											justifyContent: "center"
										},
										children: [plan.cta_label, /* @__PURE__ */ jsx("span", {
											className: "arrow",
											children: "→"
										})]
									})
								]
							}, plan.name);
						})
					}), /* @__PURE__ */ jsxs("p", {
						style: {
							marginTop: 24,
							fontFamily: "var(--mono)",
							fontSize: 11,
							letterSpacing: "0.06em",
							textTransform: "uppercase",
							color: "var(--muted)",
							textAlign: "center"
						},
						children: [
							"Need higher limits or a self-hosted license?",
							" ",
							/* @__PURE__ */ jsx("a", {
								href: `mailto:${contact_email}`,
								style: {
									background: "var(--signal)",
									padding: "2px 6px",
									color: "var(--ink)"
								},
								children: "Talk to us about Enterprise"
							}),
							"."
						]
					})]
				})
			}),
			lifetime_plans.length > 0 && /* @__PURE__ */ jsx("section", {
				className: "section",
				"data-screen-label": "Pricing lifetime",
				style: { paddingTop: 0 },
				children: /* @__PURE__ */ jsxs("div", {
					className: "wrap",
					children: [/* @__PURE__ */ jsxs("div", {
						className: "pages-head",
						children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsxs("span", {
							className: "eyebrow",
							children: [
								/* @__PURE__ */ jsx("span", { className: "dot" }),
								/* @__PURE__ */ jsx("span", {
									className: "idx",
									children: "$/02"
								}),
								"LIFETIME DEAL"
							]
						}), /* @__PURE__ */ jsxs("h2", {
							className: "h-section",
							children: [
								"Pay once.",
								" ",
								/* @__PURE__ */ jsx("span", {
									className: "signal-mark",
									children: "Use forever."
								})
							]
						})] }), /* @__PURE__ */ jsx("p", {
							className: "lead",
							style: {
								color: "var(--muted)",
								fontSize: 15
							},
							children: "A one-time purchase that unlocks the agent for the lifetime of your account — no monthly bill, no surprise renewal."
						})]
					}), /* @__PURE__ */ jsx("div", {
						className: "pages-grid",
						children: lifetime_plans.map((plan) => /* @__PURE__ */ jsxs("div", {
							className: "page-card",
							children: [
								/* @__PURE__ */ jsxs("div", {
									className: "page-num",
									children: ["LTD / ", plan.name.toUpperCase()]
								}),
								/* @__PURE__ */ jsx("h3", {
									className: "h-card",
									children: plan.name
								}),
								/* @__PURE__ */ jsx("p", { children: plan.tagline }),
								/* @__PURE__ */ jsxs("div", {
									style: { marginTop: 16 },
									children: [/* @__PURE__ */ jsxs("div", {
										style: {
											fontFamily: "var(--display)",
											fontWeight: 500,
											fontSize: 38,
											letterSpacing: "-0.03em",
											lineHeight: 1
										},
										children: [plan.price === null ? "—" : formatPrice$1(plan.price, plan.currency_symbol, plan.decimal_places), /* @__PURE__ */ jsx("span", {
											style: {
												fontFamily: "var(--mono)",
												fontSize: 12,
												color: "var(--muted)",
												marginLeft: 8
											},
											children: "ONE-TIME"
										})]
									}), plan.monthly_conversations > 0 && /* @__PURE__ */ jsxs("p", {
										style: {
											marginTop: 6,
											fontFamily: "var(--mono)",
											fontSize: 11,
											color: "var(--muted)"
										},
										children: [
											plan.monthly_conversations.toLocaleString(),
											" ",
											"CONVERSATIONS / MONTH"
										]
									})]
								}),
								/* @__PURE__ */ jsx("ul", {
									style: {
										marginTop: 18,
										listStyle: "none",
										display: "flex",
										flexDirection: "column",
										gap: 8,
										fontSize: 13
									},
									children: plan.features.map((feature) => /* @__PURE__ */ jsxs("li", {
										style: {
											display: "grid",
											gridTemplateColumns: "auto 1fr",
											gap: 8
										},
										children: [/* @__PURE__ */ jsx("span", { style: {
											width: 6,
											height: 6,
											marginTop: 6,
											background: "var(--signal)",
											border: "1px solid var(--ink)"
										} }), /* @__PURE__ */ jsx("span", { children: feature })]
									}, feature))
								}),
								/* @__PURE__ */ jsxs(Link, {
									href: plan.cta_href,
									className: "btn",
									style: {
										marginTop: 20,
										justifyContent: "center",
										background: "var(--signal)",
										color: "var(--ink)"
									},
									children: [plan.cta_label, /* @__PURE__ */ jsx("span", {
										className: "arrow",
										children: "→"
									})]
								})
							]
						}, plan.id))
					})]
				})
			}),
			/* @__PURE__ */ jsx("section", {
				className: "section",
				"data-screen-label": "Pricing matrix",
				style: { paddingTop: 0 },
				children: /* @__PURE__ */ jsxs("div", {
					className: "wrap",
					children: [/* @__PURE__ */ jsx("div", {
						className: "pages-head",
						children: /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsxs("span", {
							className: "eyebrow",
							children: [
								/* @__PURE__ */ jsx("span", { className: "dot" }),
								/* @__PURE__ */ jsx("span", {
									className: "idx",
									children: "$/03"
								}),
								"COMPARE"
							]
						}), /* @__PURE__ */ jsx("h2", {
							className: "h-section",
							children: "Every feature, side by side."
						})] })
					}), /* @__PURE__ */ jsx("div", {
						style: {
							border: "2px solid var(--ink)",
							overflowX: "auto",
							marginTop: 24
						},
						children: /* @__PURE__ */ jsxs("table", {
							style: {
								width: "100%",
								minWidth: 640,
								borderCollapse: "collapse",
								fontSize: 14
							},
							children: [/* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", { children: [/* @__PURE__ */ jsx("th", {
								style: {
									textAlign: "left",
									padding: "14px 18px",
									fontFamily: "var(--mono)",
									fontSize: 11,
									letterSpacing: "0.08em",
									textTransform: "uppercase",
									color: "var(--muted)",
									borderBottom: "2px solid var(--ink)"
								},
								children: "Feature"
							}), [
								"Free",
								"Standard",
								"Pro"
							].map((h) => /* @__PURE__ */ jsx("th", {
								style: {
									textAlign: "center",
									padding: "14px 18px",
									fontFamily: "var(--display)",
									fontSize: 14,
									fontWeight: 600,
									borderBottom: "2px solid var(--ink)",
									background: h === "Standard" ? "var(--signal)" : "transparent"
								},
								children: h
							}, h))] }) }), /* @__PURE__ */ jsx("tbody", { children: matrix.map((row) => /* @__PURE__ */ jsxs("tr", { children: [
								/* @__PURE__ */ jsx("td", {
									style: {
										padding: "14px 18px",
										fontWeight: 500,
										borderTop: "1px solid var(--hairline)"
									},
									children: row.label
								}),
								/* @__PURE__ */ jsx("td", {
									style: {
										padding: "14px 18px",
										textAlign: "center",
										borderTop: "1px solid var(--hairline)"
									},
									children: /* @__PURE__ */ jsx(MatrixValue$1, { value: row.free })
								}),
								/* @__PURE__ */ jsx("td", {
									style: {
										padding: "14px 18px",
										textAlign: "center",
										borderTop: "1px solid var(--hairline)"
									},
									children: /* @__PURE__ */ jsx(MatrixValue$1, { value: row.standard })
								}),
								/* @__PURE__ */ jsx("td", {
									style: {
										padding: "14px 18px",
										textAlign: "center",
										borderTop: "1px solid var(--hairline)"
									},
									children: /* @__PURE__ */ jsx(MatrixValue$1, { value: row.pro })
								})
							] }, row.label)) })]
						})
					})]
				})
			}),
			faqs.length > 0 && /* @__PURE__ */ jsx("section", {
				className: "section",
				"data-screen-label": "Pricing FAQ",
				style: { paddingTop: 0 },
				children: /* @__PURE__ */ jsxs("div", {
					className: "wrap",
					children: [/* @__PURE__ */ jsx("div", {
						className: "faq-head",
						children: /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsxs("span", {
							className: "eyebrow",
							children: [
								/* @__PURE__ */ jsx("span", { className: "dot" }),
								/* @__PURE__ */ jsx("span", {
									className: "idx",
									children: "$/04"
								}),
								"FREQUENTLY ASKED"
							]
						}), /* @__PURE__ */ jsx("h2", {
							className: "h-section",
							children: "About plans and billing."
						})] })
					}), /* @__PURE__ */ jsx("div", {
						className: "faq",
						children: faqs.map((faq, idx) => /* @__PURE__ */ jsx(FaqItem$1, {
							q: faq.q,
							a: faq.a,
							index: idx
						}, faq.q))
					})]
				})
			}),
			/* @__PURE__ */ jsx("section", {
				className: "cta",
				"data-screen-label": "Pricing CTA",
				children: /* @__PURE__ */ jsx("div", {
					className: "wrap",
					children: /* @__PURE__ */ jsxs("div", {
						className: "cta-grid",
						children: [/* @__PURE__ */ jsxs("div", { children: [
							/* @__PURE__ */ jsxs("span", {
								className: "eyebrow",
								style: { color: "var(--paper)" },
								children: [
									/* @__PURE__ */ jsx("span", { className: "dot" }),
									/* @__PURE__ */ jsx("span", {
										className: "idx",
										style: { color: "rgba(255,255,255,0.5)" },
										children: "$/05"
									}),
									"READY?"
								]
							}),
							/* @__PURE__ */ jsxs("h2", {
								style: { marginTop: 24 },
								children: [
									"Ready to ship a",
									" ",
									/* @__PURE__ */ jsx("span", {
										className: "signal-mark",
										children: "real sales AI?"
									})
								]
							}),
							/* @__PURE__ */ jsx("p", { children: "Free to start. Deploys in 5 minutes. No card required." })
						] }), /* @__PURE__ */ jsx("div", {
							className: "cta-actions",
							children: /* @__PURE__ */ jsxs(Link, {
								href: "/register",
								className: "btn-big primary",
								children: [/* @__PURE__ */ jsx("span", { children: "Get started free" }), /* @__PURE__ */ jsx("span", { children: "→" })]
							})
						})]
					})
				})
			})
		]
	});
}
//#endregion
//#region resources/js/pages/marketing-themes/aurora/privacy.tsx
var privacy_exports$1 = /* @__PURE__ */ __exportAll({ default: () => AuroraPrivacy });
function Section$1({ title, section, index }) {
	if (!section) return null;
	return /* @__PURE__ */ jsxs("section", {
		style: {
			marginTop: 56,
			borderTop: "var(--hair)",
			paddingTop: 28
		},
		children: [
			/* @__PURE__ */ jsxs("span", {
				className: "eyebrow",
				children: [
					/* @__PURE__ */ jsx("span", { className: "dot" }),
					/* @__PURE__ */ jsx("span", {
						className: "idx",
						children: index
					}),
					title.toUpperCase()
				]
			}),
			/* @__PURE__ */ jsx("h2", {
				className: "h-section",
				style: {
					marginTop: 14,
					fontSize: "clamp(28px, 3vw, 38px)"
				},
				children: title
			}),
			section.summary && /* @__PURE__ */ jsx("p", {
				style: {
					marginTop: 12,
					fontSize: 16,
					lineHeight: 1.6,
					color: "var(--muted)"
				},
				children: section.summary
			}),
			section.items && section.items.length > 0 && /* @__PURE__ */ jsx("ul", {
				className: "bullets",
				style: { marginTop: 14 },
				children: section.items.map((item) => /* @__PURE__ */ jsxs("li", { children: [/* @__PURE__ */ jsx("span", { className: "pip" }), /* @__PURE__ */ jsx("span", { children: item })] }, item))
			})
		]
	});
}
function AuroraPrivacy({ shell, brand, content }) {
	const title = content.title ?? "Privacy policy";
	return /* @__PURE__ */ jsx(AuroraLayout, {
		brand,
		navItems: shell.nav_items,
		footer: shell.footer,
		title: `${title} — ${brand}`,
		description: content.summary,
		children: /* @__PURE__ */ jsx("section", {
			className: "section",
			"data-screen-label": "Privacy",
			children: /* @__PURE__ */ jsx("div", {
				className: "wrap",
				children: /* @__PURE__ */ jsxs("article", {
					style: { maxWidth: 760 },
					children: [
						/* @__PURE__ */ jsxs("span", {
							className: "eyebrow",
							children: [
								/* @__PURE__ */ jsx("span", { className: "dot" }),
								/* @__PURE__ */ jsx("span", {
									className: "idx",
									children: "P/01"
								}),
								(content.eyebrow ?? "Legal").toUpperCase()
							]
						}),
						/* @__PURE__ */ jsxs("h1", {
							className: "h-display",
							style: {
								marginTop: 28,
								fontSize: "clamp(40px, 6vw, 88px)"
							},
							children: [
								title.split(" ")[0],
								" ",
								/* @__PURE__ */ jsx("span", {
									className: "signal-mark",
									children: title.split(" ").slice(1).join(" ") || "policy"
								})
							]
						}),
						content.summary && /* @__PURE__ */ jsx("p", {
							className: "lead",
							style: {
								marginTop: 22,
								color: "var(--muted)"
							},
							children: content.summary
						}),
						content.effective_date && /* @__PURE__ */ jsxs("p", {
							style: {
								marginTop: 16,
								fontFamily: "var(--mono)",
								fontSize: 12,
								letterSpacing: "0.06em",
								textTransform: "uppercase",
								color: "var(--muted)"
							},
							children: ["Effective date: ", content.effective_date]
						}),
						content.contact && /* @__PURE__ */ jsxs("section", {
							style: {
								marginTop: 56,
								borderTop: "var(--hair)",
								paddingTop: 28
							},
							children: [/* @__PURE__ */ jsxs("span", {
								className: "eyebrow",
								children: [
									/* @__PURE__ */ jsx("span", { className: "dot" }),
									/* @__PURE__ */ jsx("span", {
										className: "idx",
										children: "P/02"
									}),
									"CONTACT"
								]
							}), /* @__PURE__ */ jsxs("p", {
								style: {
									marginTop: 14,
									fontSize: 16,
									lineHeight: 1.6,
									color: "var(--muted)"
								},
								children: [
									content.contact.team_name,
									content.contact.email && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("br", {}), /* @__PURE__ */ jsx("a", {
										href: `mailto:${content.contact.email}`,
										style: {
											borderBottom: "2px solid var(--signal)",
											paddingBottom: 2
										},
										children: content.contact.email
									})] }),
									content.contact.response_sla && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("br", {}), content.contact.response_sla] })
								]
							})]
						}),
						/* @__PURE__ */ jsx(Section$1, {
							title: "What we collect",
							section: content.collection,
							index: "P/03"
						}),
						/* @__PURE__ */ jsx(Section$1, {
							title: "How we use data",
							section: content.usage,
							index: "P/04"
						}),
						/* @__PURE__ */ jsx(Section$1, {
							title: "Retention",
							section: content.retention,
							index: "P/05"
						}),
						/* @__PURE__ */ jsx(Section$1, {
							title: "Your rights",
							section: content.rights,
							index: "P/06"
						}),
						content.gdpr && /* @__PURE__ */ jsxs("section", {
							style: {
								marginTop: 56,
								borderTop: "var(--hair)",
								paddingTop: 28
							},
							children: [
								/* @__PURE__ */ jsxs("span", {
									className: "eyebrow",
									children: [
										/* @__PURE__ */ jsx("span", { className: "dot" }),
										/* @__PURE__ */ jsx("span", {
											className: "idx",
											children: "P/07"
										}),
										"DATA EXPORT & DELETION (GDPR)"
									]
								}),
								content.gdpr.summary && /* @__PURE__ */ jsx("p", {
									style: {
										marginTop: 14,
										fontSize: 16,
										lineHeight: 1.6,
										color: "var(--muted)"
									},
									children: content.gdpr.summary
								}),
								content.gdpr.request_email && /* @__PURE__ */ jsxs("p", {
									style: {
										marginTop: 12,
										fontFamily: "var(--mono)",
										fontSize: 13
									},
									children: [
										"Request contact:",
										" ",
										/* @__PURE__ */ jsx("a", {
											href: `mailto:${content.gdpr.request_email}`,
											style: {
												background: "var(--signal)",
												padding: "2px 6px"
											},
											children: content.gdpr.request_email
										})
									]
								}),
								content.gdpr.request_instructions && /* @__PURE__ */ jsx("p", {
									style: {
										marginTop: 12,
										fontSize: 15,
										lineHeight: 1.6,
										color: "var(--muted)"
									},
									children: content.gdpr.request_instructions
								})
							]
						})
					]
				})
			})
		})
	});
}
//#endregion
//#region resources/js/pages/marketing-themes/aurora/terms.tsx
var terms_exports$1 = /* @__PURE__ */ __exportAll({ default: () => AuroraTerms });
function AuroraTerms({ shell, brand, effective_date, contact_email, intro, sections }) {
	return /* @__PURE__ */ jsx(AuroraLayout, {
		brand,
		navItems: shell.nav_items,
		footer: shell.footer,
		title: `Terms of service — ${brand}`,
		description: intro,
		children: /* @__PURE__ */ jsx("section", {
			className: "section",
			"data-screen-label": "Terms",
			children: /* @__PURE__ */ jsx("div", {
				className: "wrap",
				children: /* @__PURE__ */ jsxs("article", {
					style: { maxWidth: 760 },
					children: [
						/* @__PURE__ */ jsxs("span", {
							className: "eyebrow",
							children: [
								/* @__PURE__ */ jsx("span", { className: "dot" }),
								/* @__PURE__ */ jsx("span", {
									className: "idx",
									children: "T/01"
								}),
								"LEGAL"
							]
						}),
						/* @__PURE__ */ jsxs("h1", {
							className: "h-display",
							style: {
								marginTop: 28,
								fontSize: "clamp(40px, 6vw, 88px)"
							},
							children: [
								"Terms of",
								" ",
								/* @__PURE__ */ jsx("span", {
									className: "signal-mark",
									children: "service"
								}),
								"."
							]
						}),
						/* @__PURE__ */ jsx("p", {
							className: "lead",
							style: {
								marginTop: 22,
								color: "var(--muted)"
							},
							children: intro
						}),
						/* @__PURE__ */ jsxs("p", {
							style: {
								marginTop: 16,
								fontFamily: "var(--mono)",
								fontSize: 12,
								letterSpacing: "0.06em",
								textTransform: "uppercase",
								color: "var(--muted)"
							},
							children: ["Effective date: ", effective_date]
						}),
						/* @__PURE__ */ jsxs("div", {
							style: { marginTop: 40 },
							children: [sections.map((section, idx) => /* @__PURE__ */ jsxs("section", {
								style: {
									marginTop: idx === 0 ? 0 : 40,
									paddingTop: 28,
									borderTop: "var(--hair)"
								},
								children: [
									/* @__PURE__ */ jsxs("span", {
										className: "eyebrow",
										children: [
											/* @__PURE__ */ jsx("span", { className: "dot" }),
											/* @__PURE__ */ jsxs("span", {
												className: "idx",
												children: ["T/", String(idx + 2).padStart(2, "0")]
											}),
											"SECTION"
										]
									}),
									/* @__PURE__ */ jsx("h2", {
										className: "h-section",
										style: {
											marginTop: 14,
											fontSize: "clamp(26px, 3vw, 36px)"
										},
										children: section.title
									}),
									section.body?.map((para) => /* @__PURE__ */ jsx("p", {
										style: {
											marginTop: 14,
											fontSize: 16,
											lineHeight: 1.6,
											color: "var(--muted)"
										},
										children: para
									}, para)),
									section.bullets && section.bullets.length > 0 && /* @__PURE__ */ jsx("ul", {
										className: "bullets",
										style: { marginTop: 14 },
										children: section.bullets.map((b) => /* @__PURE__ */ jsxs("li", { children: [/* @__PURE__ */ jsx("span", { className: "pip" }), /* @__PURE__ */ jsx("span", { children: b })] }, b))
									})
								]
							}, section.title)), /* @__PURE__ */ jsxs("section", {
								style: {
									marginTop: 40,
									paddingTop: 28,
									borderTop: "var(--hair)"
								},
								children: [/* @__PURE__ */ jsxs("span", {
									className: "eyebrow",
									children: [
										/* @__PURE__ */ jsx("span", { className: "dot" }),
										/* @__PURE__ */ jsx("span", {
											className: "idx",
											children: "T/99"
										}),
										"CONTACT"
									]
								}), /* @__PURE__ */ jsxs("p", {
									style: {
										marginTop: 14,
										fontSize: 16,
										lineHeight: 1.6,
										color: "var(--muted)"
									},
									children: [
										"Questions about these terms? Email",
										" ",
										/* @__PURE__ */ jsx("a", {
											href: `mailto:${contact_email}`,
											style: {
												background: "var(--signal)",
												padding: "2px 6px"
											},
											children: contact_email
										}),
										"."
									]
								})]
							})]
						}),
						/* @__PURE__ */ jsx("hr", { style: {
							marginTop: 56,
							border: 0,
							borderTop: "2px solid var(--ink)"
						} }),
						/* @__PURE__ */ jsxs("p", {
							style: {
								marginTop: 24,
								fontStyle: "italic",
								fontSize: 13,
								color: "var(--muted)"
							},
							children: [
								"Operators deploying ",
								brand,
								": this template is reasonable boilerplate but is not legal advice. Adjust to reflect your jurisdiction, business model, and consult counsel before relying on it in production."
							]
						})
					]
				})
			})
		})
	});
}
//#endregion
//#region resources/js/pages/marketing-themes/prism/_layout.tsx
var _layout_exports = /* @__PURE__ */ __exportAll({ default: () => PrismLayout });
function PrismLayout({ brand, navItems, footer, title, description, canRegister = false, hasUser = false, children }) {
	useEffect(() => {
		document.body.classList.add("prism-body");
		return () => document.body.classList.remove("prism-body");
	}, []);
	const primaryHref = hasUser ? dashboard$1().url : canRegister ? register$1().url : login$3().url;
	return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs(Head, {
		title: title ?? brand,
		children: [
			description ? /* @__PURE__ */ jsx("meta", {
				name: "description",
				content: description
			}) : null,
			/* @__PURE__ */ jsx("link", {
				rel: "preconnect",
				href: "https://fonts.googleapis.com"
			}),
			/* @__PURE__ */ jsx("link", {
				rel: "preconnect",
				href: "https://fonts.gstatic.com",
				crossOrigin: ""
			}),
			/* @__PURE__ */ jsx("link", {
				rel: "stylesheet",
				href: "https://fonts.googleapis.com/css2?family=Inter+Tight:wght@400;500;600;700&family=Instrument+Serif:ital@0;1&display=swap"
			})
		]
	}), /* @__PURE__ */ jsxs("div", {
		className: "prism-root",
		children: [
			/* @__PURE__ */ jsx(Nav, {
				brand,
				navItems,
				primaryHref,
				hasUser
			}),
			children,
			/* @__PURE__ */ jsx(Footer, {
				brand,
				footer
			})
		]
	})] });
}
function Nav({ brand, navItems, primaryHref, hasUser }) {
	const [open, setOpen] = useState(false);
	return /* @__PURE__ */ jsxs("header", {
		className: "nav-shell",
		children: [/* @__PURE__ */ jsxs("div", {
			className: "wrap nav",
			children: [
				/* @__PURE__ */ jsxs(Link, {
					href: "/",
					className: "logo",
					"aria-label": brand,
					children: [/* @__PURE__ */ jsx("span", { className: "logo-mark" }), /* @__PURE__ */ jsx("span", { children: brand })]
				}),
				/* @__PURE__ */ jsx("nav", {
					className: "nav-links",
					"aria-label": "Primary",
					children: navItems.map((item) => /* @__PURE__ */ jsx(Link, {
						href: item.href,
						children: item.label
					}, `${item.label}-${item.href}`))
				}),
				/* @__PURE__ */ jsxs("div", {
					className: "nav-right",
					children: [
						/* @__PURE__ */ jsx(Link, {
							className: "signin",
							href: login$3().url,
							children: "Sign in"
						}),
						/* @__PURE__ */ jsxs(Link, {
							className: "btn btn-sm btn-primary",
							href: primaryHref,
							children: [
								hasUser ? "Dashboard" : "Get started",
								" ",
								/* @__PURE__ */ jsx("span", {
									"aria-hidden": "true",
									children: "↗"
								})
							]
						}),
						/* @__PURE__ */ jsx("button", {
							type: "button",
							className: "menu-btn",
							"aria-label": "Menu",
							"aria-expanded": open,
							onClick: () => setOpen((v) => !v),
							children: /* @__PURE__ */ jsx("svg", {
								width: "16",
								height: "16",
								viewBox: "0 0 24 24",
								fill: "none",
								stroke: "currentColor",
								strokeWidth: "2",
								children: /* @__PURE__ */ jsx("path", { d: "M4 7h16M4 12h16M4 17h16" })
							})
						})
					]
				})
			]
		}), /* @__PURE__ */ jsxs("div", {
			className: `mobile-sheet ${open ? "open" : ""}`,
			children: [navItems.map((item) => /* @__PURE__ */ jsx(Link, {
				href: item.href,
				onClick: () => setOpen(false),
				children: item.label
			}, `${item.label}-${item.href}`)), /* @__PURE__ */ jsxs("div", {
				className: "mobile-actions",
				children: [/* @__PURE__ */ jsx(Link, {
					className: "btn btn-sm btn-light",
					href: login$3().url,
					onClick: () => setOpen(false),
					children: "Sign in"
				}), /* @__PURE__ */ jsxs(Link, {
					className: "btn btn-sm btn-primary",
					href: primaryHref,
					onClick: () => setOpen(false),
					children: [
						hasUser ? "Dashboard" : "Get started",
						" ",
						/* @__PURE__ */ jsx("span", {
							"aria-hidden": "true",
							children: "↗"
						})
					]
				})]
			})]
		})]
	});
}
function Footer({ brand, footer }) {
	const groups = footer.groups.slice(0, 3);
	const legal = {
		title: footer.legal_title,
		links: footer.legal_links
	};
	return /* @__PURE__ */ jsx("footer", {
		className: "footer",
		children: /* @__PURE__ */ jsxs("div", {
			className: "wrap",
			children: [/* @__PURE__ */ jsxs("div", {
				className: "foot-grid",
				children: [/* @__PURE__ */ jsxs("div", {
					className: "foot-col",
					children: [
						/* @__PURE__ */ jsxs(Link, {
							href: "/",
							className: "logo",
							children: [/* @__PURE__ */ jsx("span", { className: "logo-mark" }), /* @__PURE__ */ jsx("span", { children: brand })]
						}),
						/* @__PURE__ */ jsx("p", {
							className: "foot-tag",
							children: footer.brand_description
						}),
						/* @__PURE__ */ jsx("div", {
							className: "foot-social",
							children: footer.socials.map((social) => /* @__PURE__ */ jsx("a", {
								href: social.href,
								"aria-label": social.label,
								children: /* @__PURE__ */ jsx("span", {
									style: {
										fontSize: 11,
										fontWeight: 600
									},
									children: social.label.slice(0, 2).toUpperCase()
								})
							}, `${social.label}-${social.href}`))
						})
					]
				}), [...groups, legal].map((group) => /* @__PURE__ */ jsxs("div", {
					className: "foot-col",
					children: [/* @__PURE__ */ jsx("h5", { children: group.title }), /* @__PURE__ */ jsx("ul", { children: group.links.map((link) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx("a", {
						href: link.href,
						children: link.label
					}) }, `${link.label}-${link.href}`)) })]
				}, group.title))]
			}), /* @__PURE__ */ jsxs("div", {
				className: "foot-bottom",
				children: [/* @__PURE__ */ jsx("span", { children: footer.copyright }), /* @__PURE__ */ jsx("span", { children: "Made for high-intent visitors." })]
			})]
		})
	});
}
//#endregion
//#region resources/js/pages/marketing-themes/prism/changelog.tsx
var changelog_exports = /* @__PURE__ */ __exportAll({ default: () => PrismChangelog });
function PrismChangelog({ shell, brand, canRegister = false, entries }) {
	return /* @__PURE__ */ jsxs(PrismLayout, {
		brand,
		navItems: shell.nav_items,
		footer: shell.footer,
		canRegister,
		title: `Changelog — ${brand}`,
		description: `Release notes for ${brand} — every shipped change, organised by version.`,
		children: [/* @__PURE__ */ jsx("section", {
			className: "hero",
			"data-screen-label": "Changelog hero",
			children: /* @__PURE__ */ jsxs("div", {
				className: "wrap",
				children: [/* @__PURE__ */ jsxs("h1", { children: [
					"What's ",
					/* @__PURE__ */ jsx("span", {
						className: "ital",
						children: "new"
					}),
					" in ",
					brand,
					"."
				] }), /* @__PURE__ */ jsxs("p", {
					className: "hero-sub",
					children: [
						"Every shipped change, newest first. Anchor any version with",
						" ",
						/* @__PURE__ */ jsx("code", {
							style: { fontFamily: "ui-monospace, Menlo, monospace" },
							children: "#vX.Y.Z"
						}),
						"."
					]
				})]
			})
		}), /* @__PURE__ */ jsx("section", {
			className: "sec",
			style: { paddingTop: 0 },
			"data-screen-label": "Changelog body",
			children: /* @__PURE__ */ jsx("div", {
				className: "wrap",
				children: entries.length === 0 ? /* @__PURE__ */ jsx("p", {
					style: {
						color: "var(--muted)",
						fontFamily: "ui-monospace, Menlo, monospace",
						fontSize: 13,
						letterSpacing: "0.08em",
						textTransform: "uppercase"
					},
					children: "No published entries yet."
				}) : /* @__PURE__ */ jsx("div", {
					style: {
						display: "flex",
						flexDirection: "column",
						gap: 56,
						maxWidth: 760,
						margin: "0 auto"
					},
					children: entries.map((entry) => /* @__PURE__ */ jsxs("article", {
						id: entry.version,
						style: {
							borderTop: "1px solid var(--line)",
							paddingTop: 28
						},
						children: [
							/* @__PURE__ */ jsxs("header", {
								style: {
									display: "flex",
									alignItems: "baseline",
									justifyContent: "space-between",
									gap: 12,
									flexWrap: "wrap"
								},
								children: [/* @__PURE__ */ jsx("h2", {
									style: {
										fontFamily: "ui-monospace, Menlo, monospace",
										fontSize: 18,
										fontWeight: 700,
										letterSpacing: "-0.01em"
									},
									children: /* @__PURE__ */ jsx("span", {
										style: {
											background: "var(--grad-soft)",
											color: "var(--accent-ink)",
											padding: "4px 10px",
											borderRadius: 8
										},
										children: entry.version
									})
								}), entry.released_at_human ? /* @__PURE__ */ jsx("time", {
									style: {
										fontSize: 11,
										letterSpacing: "0.08em",
										textTransform: "uppercase",
										color: "var(--muted)",
										fontWeight: 600
									},
									dateTime: entry.released_at ?? void 0,
									children: entry.released_at_human
								}) : null]
							}),
							/* @__PURE__ */ jsx("h3", {
								style: {
									marginTop: 16,
									fontFamily: "var(--sans)",
									fontSize: 22,
									fontWeight: 600,
									letterSpacing: "-0.015em",
									lineHeight: 1.25
								},
								children: entry.title
							}),
							/* @__PURE__ */ jsx("div", {
								className: "page-content",
								style: {
									marginTop: 12,
									fontSize: 15.5,
									lineHeight: 1.6,
									color: "var(--fg-2)"
								},
								children: /* @__PURE__ */ jsx(MarkdownLite, {
									markdown: entry.body,
									variant: "changelog"
								})
							})
						]
					}, entry.version))
				})
			})
		})]
	});
}
//#endregion
//#region resources/js/pages/marketing-themes/prism/interactive-chat.tsx
var interactive_chat_exports = /* @__PURE__ */ __exportAll({ default: () => PrismChat });
function PrismChat({ agentId, title, placeholder, starters, seedQuestion, seedAnswer, offlineMessage, priceCard, intent = null, seedAsAssistantOnly = false, handleRef, tryToken = null, tryIntro, tryStarters }) {
	const [jwt, setJwt] = useState(null);
	const [conversationId, setConversationId] = useState(null);
	const [messages, setMessages] = useState(() => {
		if (tryToken && tryIntro) return [{
			role: "assistant",
			text: tryIntro
		}];
		return seedAsAssistantOnly ? [{
			role: "assistant",
			text: `${seedQuestion} ${seedAnswer}`.trim()
		}] : [{
			role: "user",
			text: seedQuestion
		}, {
			role: "assistant",
			text: seedAnswer
		}];
	});
	const [input, setInput] = useState("");
	const [busy, setBusy] = useState(false);
	const [showPriceCard, setShowPriceCard] = useState(true);
	const [showIntent, setShowIntent] = useState(true);
	const [error, setError] = useState(null);
	const bodyRef = useRef(null);
	const initStarted = useRef(false);
	useEffect(() => {
		if (bodyRef.current) bodyRef.current.scrollTop = bodyRef.current.scrollHeight;
	}, [messages, busy]);
	const ensureSession = useCallback(async () => {
		if (tryToken) return {
			jwt: "",
			conversationId: ""
		};
		if (jwt && conversationId) return {
			jwt,
			conversationId
		};
		if (!agentId) throw new Error("no_agent");
		const anonKey = "prism-anon";
		let anonId = null;
		try {
			anonId = window.localStorage.getItem(anonKey);
		} catch {
			anonId = null;
		}
		const response = await fetch("/api/v1/widget/init", {
			method: "POST",
			headers: {
				"Content-Type": "application/json",
				Accept: "application/json"
			},
			credentials: "omit",
			body: JSON.stringify({
				agent_id: agentId,
				page_url: window.location.href,
				page_title: document.title,
				referrer: document.referrer || null,
				anon_id: anonId
			})
		});
		if (!response.ok) throw new Error(`init_${response.status}`);
		const payload = await response.json();
		try {
			if (payload.data.anonymous_id) window.localStorage.setItem(anonKey, payload.data.anonymous_id);
		} catch {}
		setJwt(payload.data.jwt);
		setConversationId(payload.data.conversation_id);
		return {
			jwt: payload.data.jwt,
			conversationId: payload.data.conversation_id
		};
	}, [
		agentId,
		conversationId,
		jwt,
		tryToken
	]);
	const messagesRef = useRef(messages);
	useEffect(() => {
		messagesRef.current = messages;
	}, [messages]);
	const streamReply = useCallback(async (token, _conv, prompt) => {
		const response = tryToken ? await fetch("/api/v1/widget/try-now/stream", {
			method: "POST",
			headers: {
				"Content-Type": "application/json",
				Accept: "text/event-stream"
			},
			body: JSON.stringify({
				token: tryToken,
				message: prompt,
				history: messagesRef.current.slice(-10).map((m) => ({
					role: m.role,
					text: m.text
				}))
			})
		}) : await fetch("/api/v1/widget/messages/stream", {
			method: "POST",
			headers: {
				"Content-Type": "application/json",
				Accept: "text/event-stream",
				Authorization: `Bearer ${token}`
			},
			body: JSON.stringify({
				message: prompt,
				page_context: {
					title: document.title,
					url: window.location.href
				}
			})
		});
		if (!response.ok || !response.body) throw new Error(`stream_${response.status}`);
		const reader = response.body.getReader();
		const decoder = new TextDecoder();
		let buffer = "";
		let assistant = "";
		setMessages((m) => [...m, {
			role: "assistant",
			text: ""
		}]);
		const flush = () => {
			let idx;
			while ((idx = buffer.indexOf("\n\n")) !== -1) {
				const raw = buffer.slice(0, idx);
				buffer = buffer.slice(idx + 2);
				const event = parseSseEvent(raw);
				if (!event) continue;
				if (event.name === "token") {
					const piece = typeof event.data?.t === "string" && event.data.t || typeof event.data?.text === "string" && event.data.text || "";
					if (piece) {
						assistant += piece;
						setMessages((m) => {
							const next = [...m];
							next[next.length - 1] = {
								role: "assistant",
								text: assistant
							};
							return next;
						});
					}
				}
				if (event.name === "done") {
					const finalText = typeof event.data?.text === "string" && event.data.text || "";
					if (finalText) {
						assistant = finalText;
						setMessages((m) => {
							const next = [...m];
							next[next.length - 1] = {
								role: "assistant",
								text: assistant
							};
							return next;
						});
					}
				}
				if (event.name === "error") {
					assistant = typeof event.data?.message === "string" && event.data.message || "Stream error.";
					setMessages((m) => {
						const next = [...m];
						next[next.length - 1] = {
							role: "assistant",
							text: assistant
						};
						return next;
					});
				}
			}
		};
		while (true) {
			const { value, done } = await reader.read();
			if (done) {
				buffer += "\n\n";
				flush();
				break;
			}
			buffer += decoder.decode(value, { stream: true });
			flush();
		}
	}, [tryToken]);
	const send = useCallback(async (text) => {
		const trimmed = (text ?? input).trim();
		if (!trimmed || busy) return;
		setError(null);
		setShowPriceCard(false);
		setShowIntent(false);
		setMessages((m) => [...m, {
			role: "user",
			text: trimmed
		}]);
		setInput("");
		setBusy(true);
		try {
			const session = await ensureSession();
			await streamReply(session.jwt, session.conversationId, trimmed);
		} catch {
			setError(offlineMessage);
			setMessages((m) => [...m, {
				role: "assistant",
				text: offlineMessage
			}]);
		} finally {
			setBusy(false);
		}
	}, [
		busy,
		ensureSession,
		input,
		offlineMessage,
		streamReply
	]);
	useEffect(() => {
		if (tryToken || !agentId || initStarted.current) return;
		initStarted.current = true;
		ensureSession().catch(() => {});
	}, [
		agentId,
		ensureSession,
		tryToken
	]);
	useEffect(() => {
		if (!handleRef) return;
		handleRef.current = { ask: (text) => {
			send(text);
		} };
		return () => {
			handleRef.current = null;
		};
	}, [handleRef, send]);
	return /* @__PURE__ */ jsxs("div", {
		className: "chat",
		role: "dialog",
		"aria-label": `${title} conversation`,
		children: [
			/* @__PURE__ */ jsxs("div", {
				className: "chat-hd",
				children: [/* @__PURE__ */ jsxs("div", {
					className: "chat-title",
					children: [
						/* @__PURE__ */ jsx("span", { className: "dot" }),
						" ",
						title
					]
				}), /* @__PURE__ */ jsx("span", {
					className: "chat-live",
					children: tryToken ? "Your site" : agentId ? "Live" : "Preview"
				})]
			}),
			/* @__PURE__ */ jsxs("div", {
				className: "chat-body",
				ref: bodyRef,
				children: [
					messages.map((m, i) => /* @__PURE__ */ jsx("div", {
						className: `bbl ${m.role === "user" ? "bbl-u" : "bbl-b"}`,
						children: m.text || "…"
					}, i)),
					busy && /* @__PURE__ */ jsx("div", {
						className: "bbl bbl-b",
						children: /* @__PURE__ */ jsxs("div", {
							className: "typing",
							children: [
								/* @__PURE__ */ jsx("span", {}),
								/* @__PURE__ */ jsx("span", {}),
								/* @__PURE__ */ jsx("span", {})
							]
						})
					}),
					showIntent && intent && /* @__PURE__ */ jsxs("div", {
						className: "intent-card",
						children: [/* @__PURE__ */ jsxs("div", {
							className: "intent-left",
							children: [/* @__PURE__ */ jsx("span", {
								className: "intent-ic",
								children: /* @__PURE__ */ jsxs("svg", {
									width: "14",
									height: "14",
									viewBox: "0 0 24 24",
									fill: "none",
									stroke: "currentColor",
									strokeWidth: "2",
									children: [/* @__PURE__ */ jsx("circle", {
										cx: "12",
										cy: "12",
										r: "9"
									}), /* @__PURE__ */ jsx("circle", {
										cx: "12",
										cy: "12",
										r: "3"
									})]
								})
							}), /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("span", {
								className: "intent-label",
								children: "Detected intent:"
							}), /* @__PURE__ */ jsx("span", {
								className: "intent-value",
								children: intent
							})] })]
						}), /* @__PURE__ */ jsxs("div", {
							className: "intent-right",
							children: [/* @__PURE__ */ jsxs("span", { children: [/* @__PURE__ */ jsx("svg", {
								width: "12",
								height: "12",
								viewBox: "0 0 24 24",
								fill: "none",
								stroke: "currentColor",
								strokeWidth: "2.5",
								children: /* @__PURE__ */ jsx("path", { d: "M5 12l5 5L20 7" })
							}), "High intent"] }), /* @__PURE__ */ jsxs("span", { children: [/* @__PURE__ */ jsx("svg", {
								width: "12",
								height: "12",
								viewBox: "0 0 24 24",
								fill: "none",
								stroke: "currentColor",
								strokeWidth: "2.5",
								children: /* @__PURE__ */ jsx("path", { d: "M5 12l5 5L20 7" })
							}), "Active 2m 18s"] })]
						})]
					}),
					showPriceCard && priceCard && /* @__PURE__ */ jsxs("div", {
						className: "price-mini price-mini-h",
						children: [/* @__PURE__ */ jsxs("div", {
							className: "price-mini-left",
							children: [/* @__PURE__ */ jsxs("p", {
								className: "price-mini-desc",
								children: [
									"The ",
									priceCard.plan,
									" plan includes everything you need to scale your business."
								]
							}), /* @__PURE__ */ jsx("ul", { children: priceCard.features.map((f) => /* @__PURE__ */ jsxs("li", { children: [/* @__PURE__ */ jsxs("svg", {
								width: "16",
								height: "16",
								viewBox: "0 0 24 24",
								fill: "none",
								stroke: "currentColor",
								strokeWidth: "2.5",
								children: [/* @__PURE__ */ jsx("circle", {
									cx: "12",
									cy: "12",
									r: "11",
									fill: "rgba(140,91,255,0.12)",
									stroke: "none"
								}), /* @__PURE__ */ jsx("path", { d: "M7 12l3 3 7-7" })]
							}), /* @__PURE__ */ jsx("span", { children: f })] }, f)) })]
						}), /* @__PURE__ */ jsxs("div", {
							className: "price-mini-right",
							children: [/* @__PURE__ */ jsx("div", {
								className: "plan",
								children: priceCard.plan
							}), /* @__PURE__ */ jsxs("div", {
								className: "amt",
								children: [priceCard.price, /* @__PURE__ */ jsx("small", { children: priceCard.interval ? `/${priceCard.interval}` : "" })]
							})]
						})]
					})
				]
			}),
			(() => {
				const activeStarters = tryToken && tryStarters ? tryStarters : starters;
				const sendDisabled = busy || !agentId && !tryToken;
				return activeStarters.length > 0 ? /* @__PURE__ */ jsx("div", {
					className: "chat-suggest",
					children: activeStarters.slice(0, 4).map((s) => /* @__PURE__ */ jsx("button", {
						type: "button",
						onClick: () => send(s),
						disabled: sendDisabled,
						children: s
					}, s))
				}) : null;
			})(),
			/* @__PURE__ */ jsxs("form", {
				className: "chat-form",
				onSubmit: (e) => {
					e.preventDefault();
					send();
				},
				"aria-label": placeholder,
				children: [/* @__PURE__ */ jsx("input", {
					placeholder,
					value: input,
					onChange: (e) => setInput(e.target.value),
					disabled: busy || !agentId && !tryToken
				}), /* @__PURE__ */ jsx("button", {
					type: "submit",
					disabled: busy || !agentId && !tryToken,
					"aria-label": "Send",
					className: "chat-send",
					children: /* @__PURE__ */ jsxs("svg", {
						width: "16",
						height: "16",
						viewBox: "0 0 24 24",
						fill: "none",
						stroke: "currentColor",
						strokeWidth: "2",
						strokeLinecap: "round",
						strokeLinejoin: "round",
						children: [/* @__PURE__ */ jsx("path", { d: "M22 2L11 13" }), /* @__PURE__ */ jsx("path", { d: "M22 2l-7 20-4-9-9-4z" })]
					})
				})]
			}),
			error ? /* @__PURE__ */ jsx("div", {
				style: {
					padding: "8px 16px 12px",
					fontSize: 11,
					color: "var(--muted)"
				},
				children: error
			}) : null
		]
	});
}
function parseSseEvent(raw) {
	let name = "message";
	const dataLines = [];
	for (const line of raw.split("\n")) if (line.startsWith("event:")) name = line.slice(6).trim();
	else if (line.startsWith("data:")) dataLines.push(line.slice(5).trim());
	if (dataLines.length === 0) return {
		name,
		data: {}
	};
	const joined = dataLines.join("\n");
	try {
		return {
			name,
			data: JSON.parse(joined)
		};
	} catch {
		return {
			name,
			data: { text: joined }
		};
	}
}
//#endregion
//#region resources/js/pages/marketing-themes/prism/home.tsx
var home_exports = /* @__PURE__ */ __exportAll({ default: () => PrismHome });
function shortStarter(question) {
	const trimmed = question.replace(/^\s*[A-Za-z]+\s*[:.]?\s*/, "").trim();
	if (trimmed.length <= 38) return trimmed.replace(/[.?!]+$/, "?");
	return trimmed.slice(0, 36).trim() + "…";
}
function PrismHome({ canRegister, demoAgentId, content }) {
	const { auth } = usePage().props;
	const hasUser = Boolean(auth.user);
	const primaryHref = hasUser ? dashboard$1().url : canRegister ? register$1().url : login$3().url;
	const [openFaq, setOpenFaq] = useState(0);
	const [tIdx, setTIdx] = useState(0);
	const testimonialCount = content.testimonials.items.length;
	const testimonial = content.testimonials.items[tIdx % Math.max(1, testimonialCount)] ?? null;
	const chatStarters = useMemo(() => content.faq.items.slice(0, 4).map((item) => shortStarter(item.question)), [content.faq.items]);
	const priceCard = content.chat_preview.plan_features.length > 0 ? {
		plan: content.chat_preview.plan_name,
		price: content.chat_preview.plan_price,
		interval: content.chat_preview.plan_interval,
		features: content.chat_preview.plan_features.slice(0, 3),
		cta: content.chat_preview.plan_button_label
	} : null;
	return /* @__PURE__ */ jsxs(PrismLayout, {
		brand: content.brand_name,
		navItems: content.nav_items,
		footer: content.footer,
		canRegister,
		hasUser,
		title: `${content.brand_name} — ${content.hero.badge}`,
		description: content.hero.description,
		children: [
			/* @__PURE__ */ jsx(Hero, {
				hero: content.hero,
				chat: content.chat_preview,
				stats: content.stats,
				brandName: content.brand_name,
				demoAgentId,
				starters: chatStarters,
				priceCard
			}),
			/* @__PURE__ */ jsx(Stats, { stats: content.stats }),
			/* @__PURE__ */ jsx(Walkthrough, { video: content.video }),
			/* @__PURE__ */ jsx(UseCases, {
				whereItFits: content.where_it_fits,
				primaryHref
			}),
			/* @__PURE__ */ jsx(Features, { featureGrid: content.feature_grid }),
			/* @__PURE__ */ jsx(Tune, { control: content.control }),
			/* @__PURE__ */ jsx(Steps, { steps: content.steps }),
			/* @__PURE__ */ jsx(Analytics, { insights: content.insights }),
			/* @__PURE__ */ jsx(Testimonial, {
				testimonials: content.testimonials,
				current: testimonial,
				total: testimonialCount,
				onPrev: () => setTIdx((i) => (i - 1 + testimonialCount) % Math.max(1, testimonialCount)),
				onNext: () => setTIdx((i) => (i + 1) % Math.max(1, testimonialCount))
			}),
			/* @__PURE__ */ jsx(FAQ, {
				faq: content.faq,
				open: openFaq,
				onToggle: (i) => setOpenFaq((cur) => cur === i ? -1 : i)
			}),
			/* @__PURE__ */ jsx(CTA, {
				finalCta: content.final_cta,
				primaryHref,
				hasUser
			})
		]
	});
}
function Hero({ hero, chat, stats, brandName, demoAgentId, starters, priceCard }) {
	const [domain, setDomain] = useState("");
	const [tryToken, setTryToken] = useState(null);
	const [tryTitle, setTryTitle] = useState(null);
	const [tryIntro, setTryIntro] = useState(null);
	const [tryStatus, setTryStatus] = useState("idle");
	const [tryError, setTryError] = useState(null);
	const chatRef = useRef(null);
	const ask = (text) => {
		chatRef.current?.ask(text);
	};
	const onSubmit = async (event) => {
		event.preventDefault();
		const url = domain.trim();
		if (!url || tryStatus === "loading") return;
		setTryStatus("loading");
		setTryError(null);
		try {
			const response = await fetch("/api/v1/widget/try-now", {
				method: "POST",
				headers: {
					"Content-Type": "application/json",
					Accept: "application/json"
				},
				credentials: "omit",
				body: JSON.stringify({ url })
			});
			const payload = await response.json();
			if (!response.ok) {
				const message = payload?.error?.message || "We could not load that page. Try a different URL.";
				throw new Error(message);
			}
			setTryToken(payload.data.token);
			setTryTitle(payload.data.title);
			setTryIntro(payload.data.initial_message);
			setTryStatus("ready");
		} catch (error) {
			setTryStatus("error");
			setTryError(error instanceof Error && error.message ? error.message : "We could not load that page. Try a different URL.");
		}
	};
	return /* @__PURE__ */ jsx("section", {
		className: "hero",
		"data-screen-label": "01 Hero",
		children: /* @__PURE__ */ jsxs("div", {
			className: "wrap",
			children: [
				/* @__PURE__ */ jsxs("h1", { children: [
					hero.line_one,
					" ",
					/* @__PURE__ */ jsx("span", {
						className: "ital",
						children: hero.accent
					}),
					" ",
					hero.line_two_suffix,
					" ",
					hero.line_three_prefix,
					" ",
					/* @__PURE__ */ jsx("span", {
						className: "ital",
						children: hero.line_three_highlight
					}),
					" ",
					hero.line_four_highlight
				] }),
				/* @__PURE__ */ jsx("p", {
					className: "hero-sub",
					children: hero.description
				}),
				/* @__PURE__ */ jsxs("form", {
					className: "hero-form",
					onSubmit,
					children: [/* @__PURE__ */ jsxs("div", {
						className: "field",
						children: [/* @__PURE__ */ jsxs("svg", {
							width: "16",
							height: "16",
							viewBox: "0 0 24 24",
							fill: "none",
							stroke: "currentColor",
							strokeWidth: "2",
							"aria-hidden": "true",
							children: [/* @__PURE__ */ jsx("circle", {
								cx: "12",
								cy: "12",
								r: "9"
							}), /* @__PURE__ */ jsx("path", { d: "M3 12h18M12 3a14 14 0 0 1 0 18 14 14 0 0 1 0-18" })]
						}), /* @__PURE__ */ jsx("input", {
							type: "url",
							placeholder: hero.site_test_placeholder,
							value: domain,
							onChange: (e) => setDomain(e.target.value),
							"aria-label": hero.site_test_label,
							disabled: tryStatus === "loading"
						})]
					}), /* @__PURE__ */ jsxs("button", {
						className: "submit",
						type: "submit",
						disabled: tryStatus === "loading" || !domain.trim(),
						children: [
							tryStatus === "loading" ? "Reading…" : hero.site_test_button_label,
							" ",
							/* @__PURE__ */ jsx("span", {
								className: "arr",
								children: "→"
							})
						]
					})]
				}),
				tryStatus === "ready" && tryTitle ? /* @__PURE__ */ jsxs("div", {
					className: "hero-status hero-status-ready",
					role: "status",
					children: [/* @__PURE__ */ jsx("span", { className: "hero-status-dot" }), /* @__PURE__ */ jsxs("span", { children: [
						"Loaded ",
						/* @__PURE__ */ jsx("b", { children: tryTitle }),
						" — ask the chat below about it."
					] })]
				}) : tryStatus === "error" && tryError ? /* @__PURE__ */ jsxs("div", {
					className: "hero-status hero-status-error",
					role: "alert",
					children: [/* @__PURE__ */ jsx("span", { className: "hero-status-dot" }), /* @__PURE__ */ jsx("span", { children: tryError })]
				}) : /* @__PURE__ */ jsxs("div", {
					className: "hero-tags",
					children: [
						/* @__PURE__ */ jsxs("span", {
							className: "pill-tag",
							children: [/* @__PURE__ */ jsx("span", { className: "dot" }), hero.site_test_helper || "No credit card required"]
						}),
						/* @__PURE__ */ jsxs("span", {
							className: "pill-tag",
							children: [/* @__PURE__ */ jsx("span", { className: "dot" }), "Instant preview"]
						}),
						/* @__PURE__ */ jsxs("span", {
							className: "pill-tag live",
							children: [/* @__PURE__ */ jsx("span", { className: "dot" }), hero.live_demo_notice || "Live demo on this page"]
						})
					]
				}),
				/* @__PURE__ */ jsxs("div", {
					className: "hero-mock hero-mock-light",
					children: [
						/* @__PURE__ */ jsx("div", {
							className: "hero-mock-noise",
							"aria-hidden": "true"
						}),
						/* @__PURE__ */ jsx(HeroMockConnectors, {}),
						/* @__PURE__ */ jsxs("div", {
							className: "hero-grid",
							children: [
								/* @__PURE__ */ jsxs("div", {
									className: "hero-col hero-col-left",
									children: [
										/* @__PURE__ */ jsxs("div", {
											className: "hero-flag hero-flag-input",
											children: [/* @__PURE__ */ jsx("span", { className: "hero-flag-dot" }), /* @__PURE__ */ jsxs("span", { children: [/* @__PURE__ */ jsx("b", { children: "INPUT:" }), " Visitor lands on your pricing page"] })]
										}),
										/* @__PURE__ */ jsx(PricingMockCard, {
											url: `${brandName.toLowerCase().replace(/\s+/g, "")}.com/pricing`,
											heading: "Pricing",
											plans: [
												{
													name: "Starter",
													price: null,
													highlight: false
												},
												{
													name: "Pro",
													price: `${chat.plan_price || "$199"}`,
													interval: `/${chat.plan_interval || "month"}`,
													highlight: true
												},
												{
													name: "Enterprise",
													price: null,
													highlight: false
												}
											],
											onPlanClick: (plan) => ask(`Tell me about the ${plan} plan.`)
										}),
										/* @__PURE__ */ jsxs("button", {
											type: "button",
											className: "hero-chip hero-chip-visitor hero-chip-btn",
											onClick: () => ask("What's included in Pro?"),
											"aria-label": "Ask what is included in Pro",
											children: [/* @__PURE__ */ jsx("span", {
												className: "hero-chip-ic",
												children: /* @__PURE__ */ jsxs("svg", {
													width: "16",
													height: "16",
													viewBox: "0 0 24 24",
													fill: "none",
													stroke: "currentColor",
													strokeWidth: "2",
													children: [/* @__PURE__ */ jsx("circle", {
														cx: "12",
														cy: "8",
														r: "4"
													}), /* @__PURE__ */ jsx("path", { d: "M4 21c1-4 5-6 8-6s7 2 8 6" })]
												})
											}), /* @__PURE__ */ jsxs("span", { children: [/* @__PURE__ */ jsx("b", { children: "Visitor asks" }), /* @__PURE__ */ jsx("span", { children: "what's included in Pro?" })] })]
										})
									]
								}),
								/* @__PURE__ */ jsx("div", {
									className: "hero-col hero-col-center",
									children: /* @__PURE__ */ jsx("div", {
										className: "hero-mock-stage",
										children: /* @__PURE__ */ jsx(PrismChat, {
											agentId: demoAgentId,
											title: tryToken && tryTitle ? tryTitle : chat.title,
											placeholder: tryToken ? "Ask about this page…" : "Ask anything…",
											starters,
											seedQuestion: "I can help you find the right plan.",
											seedAnswer: "What would you like to know?",
											offlineMessage: hero.live_demo_notice,
											priceCard,
											intent: "Pricing Information",
											seedAsAssistantOnly: true,
											handleRef: chatRef,
											tryToken,
											tryIntro: tryIntro ?? void 0,
											tryStarters: tryToken ? [
												"What is this page about?",
												"Summarize this in 3 bullets.",
												"What does it cost?"
											] : void 0
										}, tryToken ?? "agent")
									})
								}),
								/* @__PURE__ */ jsxs("div", {
									className: "hero-col hero-col-right",
									children: [
										/* @__PURE__ */ jsxs("div", {
											className: "hero-flag hero-flag-output",
											children: [/* @__PURE__ */ jsx("span", { className: "hero-flag-dot" }), /* @__PURE__ */ jsxs("span", { children: [
												/* @__PURE__ */ jsx("b", { children: "OUTPUT:" }),
												" Qualified & synced",
												/* @__PURE__ */ jsx("span", {
													className: "hero-flag-sub",
													children: "to your CRM"
												})
											] })]
										}),
										/* @__PURE__ */ jsx(CrmCard, {
											intent: "Pricing Information",
											planInterest: chat.plan_name || "Pro Plan",
											engagementTime: "2m 18s",
											leadScore: 4.5
										}),
										/* @__PURE__ */ jsx(NotifyCard, {})
									]
								})
							]
						}),
						stats.length > 0 ? /* @__PURE__ */ jsx("div", {
							className: "hero-stats",
							"aria-hidden": "true",
							children: [
								{
									value: "2.6x",
									label: "More meetings booked",
									icon: 0
								},
								{
									value: "35%",
									label: "Higher conversion",
									icon: 1
								},
								{
									value: "24/7",
									label: "AI sales coverage",
									icon: 2
								},
								{
									value: "90%+",
									label: "Intent detection accuracy",
									icon: 3
								}
							].map((s, i) => /* @__PURE__ */ jsxs("div", {
								className: "hero-stat",
								children: [/* @__PURE__ */ jsx("span", {
									className: "hero-stat-ic",
									children: STAT_ICONS[s.icon] ?? STAT_ICONS[0]
								}), /* @__PURE__ */ jsxs("span", { children: [/* @__PURE__ */ jsx("b", { children: s.value }), /* @__PURE__ */ jsx("span", { children: s.label })] })]
							}, `${s.label}-${i}`))
						}) : null
					]
				})
			]
		})
	});
}
var STAT_ICONS = [
	/* @__PURE__ */ jsxs("svg", {
		width: "20",
		height: "20",
		viewBox: "0 0 24 24",
		fill: "none",
		stroke: "currentColor",
		strokeWidth: "2",
		children: [/* @__PURE__ */ jsx("path", { d: "M3 17l6-6 4 4 8-8" }), /* @__PURE__ */ jsx("path", { d: "M14 7h7v7" })]
	}, "trend"),
	/* @__PURE__ */ jsxs("svg", {
		width: "20",
		height: "20",
		viewBox: "0 0 24 24",
		fill: "none",
		stroke: "currentColor",
		strokeWidth: "2",
		children: [
			/* @__PURE__ */ jsx("circle", {
				cx: "12",
				cy: "12",
				r: "9"
			}),
			/* @__PURE__ */ jsx("circle", {
				cx: "12",
				cy: "12",
				r: "5"
			}),
			/* @__PURE__ */ jsx("circle", {
				cx: "12",
				cy: "12",
				r: "1.5",
				fill: "currentColor"
			})
		]
	}, "target"),
	/* @__PURE__ */ jsxs("svg", {
		width: "20",
		height: "20",
		viewBox: "0 0 24 24",
		fill: "none",
		stroke: "currentColor",
		strokeWidth: "2",
		children: [/* @__PURE__ */ jsx("circle", {
			cx: "12",
			cy: "12",
			r: "9"
		}), /* @__PURE__ */ jsx("path", { d: "M12 7v5l3 2" })]
	}, "clock"),
	/* @__PURE__ */ jsxs("svg", {
		width: "20",
		height: "20",
		viewBox: "0 0 24 24",
		fill: "none",
		stroke: "currentColor",
		strokeWidth: "2",
		children: [/* @__PURE__ */ jsx("path", { d: "M12 3l8 3v6c0 5-3.5 8-8 9-4.5-1-8-4-8-9V6z" }), /* @__PURE__ */ jsx("path", { d: "M9 12l2 2 4-4" })]
	}, "shield")
];
function PricingMockCard({ url, heading, plans, onPlanClick }) {
	return /* @__PURE__ */ jsxs("div", {
		className: "pricing-mock",
		children: [
			/* @__PURE__ */ jsxs("div", {
				className: "pricing-mock-url",
				children: [
					/* @__PURE__ */ jsx("span", { className: "d" }),
					/* @__PURE__ */ jsx("span", { className: "d" }),
					/* @__PURE__ */ jsx("span", { className: "d" }),
					/* @__PURE__ */ jsx("span", { children: url })
				]
			}),
			/* @__PURE__ */ jsxs("div", {
				className: "pricing-mock-heading",
				children: [/* @__PURE__ */ jsx("span", {
					className: "pricing-mock-title",
					children: heading
				}), /* @__PURE__ */ jsx("span", { className: "pricing-mock-bar" })]
			}),
			/* @__PURE__ */ jsx("div", {
				className: "pricing-mock-plans",
				children: plans.map((p) => /* @__PURE__ */ jsxs("button", {
					type: "button",
					className: `pricing-mock-plan ${p.highlight ? "is-highlight" : ""}`,
					onClick: () => onPlanClick?.(p.name),
					"aria-label": `Ask about the ${p.name} plan`,
					children: [
						/* @__PURE__ */ jsx("span", {
							className: "pricing-mock-plan-name",
							children: p.name
						}),
						p.price ? /* @__PURE__ */ jsxs("span", {
							className: "pricing-mock-plan-price",
							children: [p.price, p.interval ? /* @__PURE__ */ jsx("small", { children: p.interval }) : null]
						}) : /* @__PURE__ */ jsxs("div", {
							className: "pricing-mock-plan-lines",
							children: [/* @__PURE__ */ jsx("span", {}), /* @__PURE__ */ jsx("span", { style: { width: "60%" } })]
						}),
						/* @__PURE__ */ jsx("span", {
							className: "pricing-mock-plan-cta",
							children: "Get started"
						})
					]
				}, p.name))
			})
		]
	});
}
function CrmCard({ intent, planInterest, engagementTime, leadScore }) {
	return /* @__PURE__ */ jsxs("div", {
		className: "crm-mock",
		"aria-hidden": "true",
		children: [/* @__PURE__ */ jsxs("div", {
			className: "crm-mock-head",
			children: [/* @__PURE__ */ jsx("span", {
				className: "crm-logo crm-logo-wp",
				children: /* @__PURE__ */ jsx("svg", {
					width: "20",
					height: "20",
					viewBox: "0 0 24 24",
					fill: "currentColor",
					children: /* @__PURE__ */ jsx("path", { d: "M12 2a10 10 0 1 0 10 10A10 10 0 0 0 12 2zm-8.5 10A8.5 8.5 0 0 1 5 8l4.65 12.74A8.51 8.51 0 0 1 3.5 12zm8.5 8.5a8.46 8.46 0 0 1-2.4-.35l2.55-7.4 2.61 7.16a.78.78 0 0 0 .06.11 8.49 8.49 0 0 1-2.82.48zm1.17-12.5c.51 0 1-.07 1-.07s-.46-.05.59-.05c.51 0 .45.7 0 .73s-.74.62-.74.62l1 2.85.93-2.85s-.71-.59-.71-.62 0-.7.51-.7c.94 0 1.43.05 1.43.05a.66.66 0 0 1 .43.06.59.59 0 0 0-.07-.06l-2.34 6.93-1.66-4.5-1.55 4.5L9.42 8.4a.62.62 0 0 1 .39-.06s.51.05 1 .05.93-.05.93-.05c.46 0 .51.7 0 .73s-.69.05-.69.05l3.07 9.16 1.65-4.93-1.18-3.23s-.49-.06-1-.06c-.4 0-.43-.7.07-.7zm6.13 4a8.5 8.5 0 0 1-3.15 11.43l2.59-7.5c.5-1.21.65-2.17.65-3.04a8 8 0 0 0-.09-1z" })
				})
			}), /* @__PURE__ */ jsx("span", {
				className: "crm-mock-name",
				children: "WordPress"
			})]
		}), /* @__PURE__ */ jsxs("div", {
			className: "crm-mock-body",
			children: [/* @__PURE__ */ jsxs("div", {
				className: "crm-mock-row crm-mock-row-head",
				children: [/* @__PURE__ */ jsx("span", { children: "New qualified lead" }), /* @__PURE__ */ jsxs("span", {
					className: "crm-synced",
					children: [/* @__PURE__ */ jsx("svg", {
						width: "12",
						height: "12",
						viewBox: "0 0 24 24",
						fill: "none",
						stroke: "currentColor",
						strokeWidth: "3",
						children: /* @__PURE__ */ jsx("path", { d: "M5 12l5 5L20 7" })
					}), "Synced"]
				})]
			}), /* @__PURE__ */ jsxs("div", {
				className: "crm-detail",
				children: [
					/* @__PURE__ */ jsxs("div", {
						className: "crm-detail-row",
						children: [/* @__PURE__ */ jsx("span", {
							className: "crm-detail-label",
							children: "Intent"
						}), /* @__PURE__ */ jsx("span", {
							className: "crm-detail-value crm-detail-value-accent",
							children: intent
						})]
					}),
					/* @__PURE__ */ jsxs("div", {
						className: "crm-detail-row",
						children: [/* @__PURE__ */ jsx("span", {
							className: "crm-detail-label",
							children: "Plan Interest"
						}), /* @__PURE__ */ jsx("span", {
							className: "crm-detail-value",
							children: planInterest
						})]
					}),
					/* @__PURE__ */ jsxs("div", {
						className: "crm-detail-row",
						children: [/* @__PURE__ */ jsx("span", {
							className: "crm-detail-label",
							children: "Engagement time"
						}), /* @__PURE__ */ jsx("span", {
							className: "crm-detail-value",
							children: engagementTime
						})]
					}),
					/* @__PURE__ */ jsxs("div", {
						className: "crm-detail-row",
						children: [/* @__PURE__ */ jsx("span", {
							className: "crm-detail-label",
							children: "Lead Score"
						}), /* @__PURE__ */ jsx("span", {
							className: "crm-detail-stars",
							children: renderStars(leadScore)
						})]
					})
				]
			})]
		})]
	});
}
function renderStars(score) {
	const full = Math.floor(score);
	const half = score - full >= .5;
	const out = [];
	for (let i = 0; i < 5; i++) if (i < full) out.push(/* @__PURE__ */ jsx(Star, { fill: "#fbbf24" }, i));
	else if (i === full && half) out.push(/* @__PURE__ */ jsx(Star, {
		fill: "#fbbf24",
		half: true
	}, i));
	else out.push(/* @__PURE__ */ jsx(Star, { fill: "rgba(255,255,255,0.18)" }, i));
	return out;
}
function Star({ fill, half }) {
	return /* @__PURE__ */ jsxs("svg", {
		width: "14",
		height: "14",
		viewBox: "0 0 24 24",
		"aria-hidden": "true",
		children: [/* @__PURE__ */ jsx("defs", { children: half ? /* @__PURE__ */ jsxs("linearGradient", {
			id: `star-half-${fill}`,
			children: [/* @__PURE__ */ jsx("stop", {
				offset: "50%",
				stopColor: fill
			}), /* @__PURE__ */ jsx("stop", {
				offset: "50%",
				stopColor: "rgba(255,255,255,0.18)"
			})]
		}) : null }), /* @__PURE__ */ jsx("path", {
			d: "M12 2l3 6 6 .9-4.5 4.4 1 6.2L12 17l-5.5 3.5 1-6.2L3 9.9 9 8.9z",
			fill: half ? `url(#star-half-${fill})` : fill
		})]
	});
}
function NotifyCard() {
	return /* @__PURE__ */ jsxs("div", {
		className: "notify-card",
		"aria-hidden": "true",
		children: [
			/* @__PURE__ */ jsxs("span", {
				className: "notify-card-ic",
				children: [/* @__PURE__ */ jsxs("svg", {
					width: "18",
					height: "18",
					viewBox: "0 0 24 24",
					fill: "none",
					stroke: "currentColor",
					strokeWidth: "2",
					children: [/* @__PURE__ */ jsx("path", { d: "M6 8a6 6 0 0 1 12 0c0 7 3 7 3 9H3c0-2 3-2 3-9z" }), /* @__PURE__ */ jsx("path", { d: "M10 21a2 2 0 0 0 4 0" })]
				}), /* @__PURE__ */ jsx("span", { className: "notify-dot" })]
			}),
			/* @__PURE__ */ jsxs("div", {
				className: "notify-card-text",
				children: [/* @__PURE__ */ jsx("b", { children: "Your team gets notified" }), /* @__PURE__ */ jsx("span", { children: "and can follow up" })]
			}),
			/* @__PURE__ */ jsxs("div", {
				className: "notify-avatars",
				children: [
					/* @__PURE__ */ jsx("span", { className: "avatar avatar-a" }),
					/* @__PURE__ */ jsx("span", { className: "avatar avatar-b" }),
					/* @__PURE__ */ jsx("span", { className: "avatar avatar-c" }),
					/* @__PURE__ */ jsx("span", {
						className: "notify-more",
						children: "+3"
					})
				]
			})
		]
	});
}
function HeroMockConnectors() {
	return /* @__PURE__ */ jsxs("svg", {
		className: "hero-connectors",
		viewBox: "0 0 1080 620",
		preserveAspectRatio: "none",
		"aria-hidden": "true",
		children: [
			/* @__PURE__ */ jsxs("defs", { children: [/* @__PURE__ */ jsxs("linearGradient", {
				id: "prism-conn-l",
				x1: "0",
				y1: "0",
				x2: "1",
				y2: "0",
				children: [/* @__PURE__ */ jsx("stop", {
					offset: "0%",
					stopColor: "rgba(180,140,255,0)"
				}), /* @__PURE__ */ jsx("stop", {
					offset: "100%",
					stopColor: "rgba(180,140,255,0.6)"
				})]
			}), /* @__PURE__ */ jsxs("linearGradient", {
				id: "prism-conn-r",
				x1: "0",
				y1: "0",
				x2: "1",
				y2: "0",
				children: [/* @__PURE__ */ jsx("stop", {
					offset: "0%",
					stopColor: "rgba(255,150,90,0.6)"
				}), /* @__PURE__ */ jsx("stop", {
					offset: "100%",
					stopColor: "rgba(255,150,90,0)"
				})]
			})] }),
			/* @__PURE__ */ jsx("path", {
				d: "M 240 250 Q 360 220 420 280",
				fill: "none",
				stroke: "url(#prism-conn-l)",
				strokeWidth: "1.2",
				strokeDasharray: "3 4"
			}),
			/* @__PURE__ */ jsx("path", {
				d: "M 660 280 Q 740 230 860 250",
				fill: "none",
				stroke: "url(#prism-conn-r)",
				strokeWidth: "1.2",
				strokeDasharray: "3 4"
			}),
			/* @__PURE__ */ jsx("circle", {
				cx: "420",
				cy: "280",
				r: "3",
				fill: "#b18bff"
			}),
			/* @__PURE__ */ jsx("circle", {
				cx: "660",
				cy: "280",
				r: "3",
				fill: "#ff9c5a"
			})
		]
	});
}
function Stats({ stats }) {
	return /* @__PURE__ */ jsx("section", {
		className: "stats",
		"aria-label": "Key results",
		children: /* @__PURE__ */ jsx("div", {
			className: "wrap",
			children: /* @__PURE__ */ jsx("div", {
				className: "stats-grid",
				children: stats.map((s, idx) => /* @__PURE__ */ jsxs("div", {
					className: "stat",
					children: [
						/* @__PURE__ */ jsx("div", {
							className: "k",
							children: s.label
						}),
						/* @__PURE__ */ jsx("div", {
							className: "v",
							children: s.value
						}),
						/* @__PURE__ */ jsx("div", {
							className: "l",
							children: s.label
						})
					]
				}, `${s.label}-${idx}`))
			})
		})
	});
}
function Walkthrough({ video }) {
	return /* @__PURE__ */ jsx("section", {
		className: "sec",
		id: "product",
		"data-screen-label": "02 Walkthrough",
		children: /* @__PURE__ */ jsxs("div", {
			className: "wrap",
			children: [/* @__PURE__ */ jsxs("div", {
				className: "sec-hd",
				children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("span", {
					className: "eyebrow",
					children: video.badge
				}), /* @__PURE__ */ jsx("h2", { children: video.title })] }), /* @__PURE__ */ jsxs("a", {
					className: "btn btn-ghost btn-sm",
					href: video.href,
					target: "_blank",
					rel: "noopener noreferrer",
					children: ["See live demo ", /* @__PURE__ */ jsx("span", {
						className: "arr",
						children: "→"
					})]
				})]
			}), /* @__PURE__ */ jsxs("div", {
				className: "video-wrap",
				children: [/* @__PURE__ */ jsxs("div", {
					className: "video",
					"aria-label": "Product walkthrough",
					children: [
						/* @__PURE__ */ jsx("span", {
							className: "video-tag",
							children: video.duration_label
						}),
						/* @__PURE__ */ jsx("button", {
							type: "button",
							className: "video-play",
							"aria-label": video.button_label,
							children: "▶"
						}),
						/* @__PURE__ */ jsxs("div", {
							className: "video-cap",
							children: [/* @__PURE__ */ jsxs("span", { children: ["00:00 / ", video.timecode] }), /* @__PURE__ */ jsx("span", { children: video.scene_label })]
						})
					]
				}), /* @__PURE__ */ jsxs("aside", {
					className: "video-meta",
					children: [
						/* @__PURE__ */ jsx("h4", { children: video.footer_title || "What you'll see" }),
						/* @__PURE__ */ jsx("ul", { children: video.bullets.map((b) => /* @__PURE__ */ jsxs("li", { children: [/* @__PURE__ */ jsx("span", {
							className: "ic",
							children: /* @__PURE__ */ jsx("svg", {
								width: "12",
								height: "12",
								viewBox: "0 0 24 24",
								fill: "none",
								stroke: "currentColor",
								strokeWidth: "2.4",
								"aria-hidden": "true",
								children: /* @__PURE__ */ jsx("path", { d: "M5 12l5 5L20 7" })
							})
						}), /* @__PURE__ */ jsx("span", { children: b })] }, b)) }),
						/* @__PURE__ */ jsxs("a", {
							className: "btn btn-light btn-sm more",
							href: video.href,
							style: { alignSelf: "flex-start" },
							children: [
								video.button_label,
								" ",
								/* @__PURE__ */ jsx("span", {
									className: "arr",
									children: "→"
								})
							]
						})
					]
				})]
			})]
		})
	});
}
function UseCases({ whereItFits, primaryHref }) {
	return /* @__PURE__ */ jsx("section", {
		className: "sec",
		style: { paddingTop: 0 },
		"data-screen-label": "03 Use cases",
		children: /* @__PURE__ */ jsxs("div", {
			className: "wrap",
			children: [/* @__PURE__ */ jsxs("div", {
				className: "sec-hd",
				children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("span", {
					className: "eyebrow",
					children: whereItFits.badge
				}), /* @__PURE__ */ jsx("h2", { children: whereItFits.title })] }), /* @__PURE__ */ jsxs(Link, {
					className: "btn btn-ghost btn-sm",
					href: primaryHref,
					children: ["Get started ", /* @__PURE__ */ jsx("span", {
						className: "arr",
						children: "→"
					})]
				})]
			}), /* @__PURE__ */ jsx("div", {
				className: "uc-grid",
				children: whereItFits.cards.map((card) => /* @__PURE__ */ jsxs("article", {
					className: "uc",
					children: [
						/* @__PURE__ */ jsx("div", {
							className: "uc-ic",
							children: /* @__PURE__ */ jsxs("svg", {
								width: "20",
								height: "20",
								viewBox: "0 0 24 24",
								fill: "none",
								stroke: "currentColor",
								strokeWidth: "1.7",
								children: [/* @__PURE__ */ jsx("rect", {
									x: "3",
									y: "4",
									width: "18",
									height: "16",
									rx: "2"
								}), /* @__PURE__ */ jsx("path", { d: "M3 9h18M8 14h3M8 17h6" })]
							})
						}),
						/* @__PURE__ */ jsx("h3", { children: card.title }),
						/* @__PURE__ */ jsx("p", { children: card.description })
					]
				}, card.title))
			})]
		})
	});
}
function Features({ featureGrid }) {
	return /* @__PURE__ */ jsx("section", {
		className: "sec",
		style: { paddingTop: 0 },
		"data-screen-label": "04 Features",
		children: /* @__PURE__ */ jsxs("div", {
			className: "wrap",
			children: [/* @__PURE__ */ jsxs("div", {
				className: "sec-hd-center",
				children: [/* @__PURE__ */ jsx("span", {
					className: "eyebrow",
					children: featureGrid.badge
				}), /* @__PURE__ */ jsx("h2", { children: featureGrid.title })]
			}), /* @__PURE__ */ jsx("div", {
				className: "features",
				children: featureGrid.cards.map((card, idx) => /* @__PURE__ */ jsxs("article", {
					className: "feat",
					children: [
						/* @__PURE__ */ jsx("div", {
							className: "ic",
							children: /* @__PURE__ */ jsxs("svg", {
								width: "18",
								height: "18",
								viewBox: "0 0 24 24",
								fill: "none",
								stroke: "currentColor",
								strokeWidth: "1.8",
								children: [/* @__PURE__ */ jsx("circle", {
									cx: "12",
									cy: "12",
									r: "3"
								}), /* @__PURE__ */ jsx("path", { d: "M12 1v6M12 17v6M4.2 4.2l4.3 4.3M15.5 15.5l4.3 4.3M1 12h6M17 12h6" })]
							})
						}),
						/* @__PURE__ */ jsx("h4", { children: card.title }),
						/* @__PURE__ */ jsx("p", { children: card.description }),
						/* @__PURE__ */ jsxs("div", {
							className: "tag",
							children: [
								String(idx + 1).padStart(2, "0"),
								" /",
								" ",
								card.title.split(" ")[0]
							]
						})
					]
				}, card.title))
			})]
		})
	});
}
function Tune({ control }) {
	return /* @__PURE__ */ jsx("section", {
		className: "sec",
		style: { paddingTop: 0 },
		"data-screen-label": "05 Tune",
		children: /* @__PURE__ */ jsxs("div", {
			className: "wrap",
			children: [/* @__PURE__ */ jsx("div", {
				className: "sec-hd",
				children: /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("span", {
					className: "eyebrow",
					children: control.badge
				}), /* @__PURE__ */ jsx("h2", { children: control.title })] })
			}), /* @__PURE__ */ jsxs("div", {
				className: "tune-grid",
				children: [/* @__PURE__ */ jsxs("div", {
					className: "tune-left",
					children: [
						/* @__PURE__ */ jsx("h4", { children: control.title }),
						/* @__PURE__ */ jsx("p", { children: control.description }),
						/* @__PURE__ */ jsx("div", {
							className: "tune-points",
							children: control.callouts.map((callout) => /* @__PURE__ */ jsxs("div", {
								className: "tune-pt",
								children: [/* @__PURE__ */ jsx("div", {
									className: "ic",
									children: /* @__PURE__ */ jsxs("svg", {
										width: "14",
										height: "14",
										viewBox: "0 0 24 24",
										fill: "none",
										stroke: "currentColor",
										strokeWidth: "2",
										children: [/* @__PURE__ */ jsx("rect", {
											x: "3",
											y: "11",
											width: "18",
											height: "11",
											rx: "2"
										}), /* @__PURE__ */ jsx("path", { d: "M7 11V7a5 5 0 0 1 10 0v4" })]
									})
								}), /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("b", { children: callout.title }), /* @__PURE__ */ jsx("span", {
									className: "t-sub",
									children: callout.description
								})] })]
							}, callout.title))
						})
					]
				}), /* @__PURE__ */ jsx("div", {
					className: "tune-right",
					children: /* @__PURE__ */ jsxs("div", {
						className: "settings",
						children: [
							/* @__PURE__ */ jsxs("div", {
								className: "settings-hd",
								children: [/* @__PURE__ */ jsx("h5", { children: control.settings_card_title }), /* @__PURE__ */ jsx("span", {
									className: "badge",
									children: "/ pricing-page"
								})]
							}),
							control.settings_rows.map((row) => /* @__PURE__ */ jsxs("div", {
								className: "settings-row",
								children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("div", {
									className: "lbl",
									children: row.label
								}), /* @__PURE__ */ jsx("div", {
									className: "hint",
									children: row.hint
								})] }), /* @__PURE__ */ jsx("div", {
									className: "field",
									children: row.value
								})]
							}, row.label)),
							/* @__PURE__ */ jsxs("div", {
								className: "settings-foot",
								children: [/* @__PURE__ */ jsx("button", {
									type: "button",
									className: "btn btn-sm btn-light",
									tabIndex: -1,
									children: control.cancel_label
								}), /* @__PURE__ */ jsx("button", {
									type: "button",
									className: "btn btn-sm btn-primary",
									tabIndex: -1,
									children: control.save_button_label
								})]
							})
						]
					})
				})]
			})]
		})
	});
}
function Steps({ steps }) {
	return /* @__PURE__ */ jsx("section", {
		className: "sec",
		id: "how",
		style: { paddingTop: 0 },
		"data-screen-label": "06 Steps",
		children: /* @__PURE__ */ jsxs("div", {
			className: "wrap",
			children: [/* @__PURE__ */ jsxs("div", {
				className: "sec-hd-center",
				children: [/* @__PURE__ */ jsx("span", {
					className: "eyebrow",
					children: steps.badge
				}), /* @__PURE__ */ jsx("h2", { children: steps.title })]
			}), /* @__PURE__ */ jsx("div", {
				className: "steps-grid",
				children: steps.items.map((step, idx) => /* @__PURE__ */ jsxs("article", {
					className: "step",
					children: [
						/* @__PURE__ */ jsxs("span", {
							className: "step-n",
							children: [
								/* @__PURE__ */ jsx("span", {
									className: "step-num",
									children: idx + 1
								}),
								"Step ",
								[
									"one",
									"two",
									"three"
								][idx] || idx + 1
							]
						}),
						/* @__PURE__ */ jsx("h3", { children: step.title }),
						/* @__PURE__ */ jsx("p", { children: step.description })
					]
				}, step.title))
			})]
		})
	});
}
function buildSparkline(points) {
	const resolved = points.length > 0 ? points : [
		10,
		20,
		30,
		40,
		60,
		80,
		100
	];
	const w = 600;
	const h = 160;
	const max = Math.max(...resolved, 1);
	const min = Math.min(...resolved, 0);
	const range = Math.max(max - min, 1);
	const stepX = resolved.length > 1 ? w / (resolved.length - 1) : 0;
	const coords = resolved.map((p, i) => ({
		x: i * stepX,
		y: h - (p - min) / range * h
	}));
	const line = coords.map((c, i) => `${i === 0 ? "M" : "L"}${c.x.toFixed(2)},${c.y.toFixed(2)}`).join(" ");
	return {
		line,
		area: `${line} L${w},${h} L0,${h} Z`,
		w,
		h,
		last: coords[coords.length - 1]
	};
}
function Analytics({ insights }) {
	const spark = useMemo(() => buildSparkline(insights.chart_points), [insights.chart_points]);
	return /* @__PURE__ */ jsx("section", {
		className: "sec",
		style: { paddingTop: 0 },
		"data-screen-label": "07 Signal",
		children: /* @__PURE__ */ jsxs("div", {
			className: "wrap",
			children: [/* @__PURE__ */ jsx("div", {
				className: "sec-hd",
				children: /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("span", {
					className: "eyebrow",
					children: insights.badge
				}), /* @__PURE__ */ jsx("h2", { children: insights.chart_title })] })
			}), /* @__PURE__ */ jsxs("div", {
				className: "ana-grid",
				children: [/* @__PURE__ */ jsxs("div", {
					className: "ana-main",
					children: [/* @__PURE__ */ jsxs("div", {
						style: {
							display: "flex",
							justifyContent: "space-between",
							alignItems: "end",
							gap: 16,
							flexWrap: "wrap"
						},
						children: [/* @__PURE__ */ jsxs("div", { children: [
							/* @__PURE__ */ jsx("span", {
								className: "eyebrow",
								children: insights.metric_label
							}),
							/* @__PURE__ */ jsx("div", {
								className: "big",
								children: insights.metric_value
							}),
							/* @__PURE__ */ jsx("div", {
								className: "delta",
								children: insights.metric_trend
							})
						] }), /* @__PURE__ */ jsx("div", {
							className: "legend",
							children: /* @__PURE__ */ jsx("div", { children: insights.chart_description })
						})]
					}), /* @__PURE__ */ jsxs("div", {
						className: "ana-chart",
						children: [/* @__PURE__ */ jsxs("svg", {
							viewBox: `0 0 ${spark.w} ${spark.h + 20}`,
							preserveAspectRatio: "none",
							width: "100%",
							height: "100%",
							style: {
								position: "absolute",
								inset: 0
							},
							children: [
								/* @__PURE__ */ jsxs("defs", { children: [/* @__PURE__ */ jsxs("linearGradient", {
									id: "prism-agrad",
									x1: "0",
									y1: "0",
									x2: "0",
									y2: "1",
									children: [/* @__PURE__ */ jsx("stop", {
										offset: "0%",
										stopColor: "#8C5BFF",
										stopOpacity: ".28"
									}), /* @__PURE__ */ jsx("stop", {
										offset: "100%",
										stopColor: "#8C5BFF",
										stopOpacity: "0"
									})]
								}), /* @__PURE__ */ jsx("pattern", {
									id: "prism-agrid",
									width: "60",
									height: "36",
									patternUnits: "userSpaceOnUse",
									children: /* @__PURE__ */ jsx("path", {
										d: "M 60 0 L 0 0 0 36",
										fill: "none",
										stroke: "#F2F2F0",
										strokeWidth: ".7"
									})
								})] }),
								/* @__PURE__ */ jsx("rect", {
									width: spark.w,
									height: spark.h,
									fill: "url(#prism-agrid)"
								}),
								/* @__PURE__ */ jsx("path", {
									d: spark.line,
									fill: "none",
									stroke: "#6B4FE8",
									strokeWidth: "2"
								}),
								/* @__PURE__ */ jsx("path", {
									d: spark.area,
									fill: "url(#prism-agrad)"
								}),
								spark.last ? /* @__PURE__ */ jsx("circle", {
									cx: spark.last.x,
									cy: spark.last.y,
									r: "5",
									fill: "#6B4FE8",
									stroke: "#fff",
									strokeWidth: "2"
								}) : null
							]
						}), /* @__PURE__ */ jsx("div", {
							className: "ana-x",
							children: insights.chart_labels.map((l) => /* @__PURE__ */ jsx("span", { children: l }, l))
						})]
					})]
				}), /* @__PURE__ */ jsx("div", {
					className: "ana-side",
					children: insights.cards.map((card) => /* @__PURE__ */ jsxs("div", {
						className: "ana-card",
						children: [
							/* @__PURE__ */ jsx("div", {
								className: "ic",
								children: /* @__PURE__ */ jsx("svg", {
									width: "14",
									height: "14",
									viewBox: "0 0 24 24",
									fill: "none",
									stroke: "currentColor",
									strokeWidth: "2",
									children: /* @__PURE__ */ jsx("path", { d: "M5 12l5 5L20 7" })
								})
							}),
							/* @__PURE__ */ jsx("h5", { children: card.title }),
							/* @__PURE__ */ jsx("p", { children: card.description }),
							/* @__PURE__ */ jsx("span", {
								className: "more",
								children: "View report"
							})
						]
					}, card.title))
				})]
			})]
		})
	});
}
function Testimonial({ testimonials, current, total, onPrev, onNext }) {
	if (!current) return null;
	return /* @__PURE__ */ jsx("section", {
		className: "sec",
		style: { paddingTop: 0 },
		"data-screen-label": "08 Testimonial",
		children: /* @__PURE__ */ jsxs("div", {
			className: "wrap",
			children: [/* @__PURE__ */ jsxs("div", {
				className: "sec-hd-center",
				children: [/* @__PURE__ */ jsx("span", {
					className: "eyebrow",
					children: testimonials.badge
				}), /* @__PURE__ */ jsx("h2", { children: testimonials.title })]
			}), /* @__PURE__ */ jsxs("div", {
				className: "testi",
				children: [/* @__PURE__ */ jsx("div", {
					className: "testi-photo",
					children: /* @__PURE__ */ jsx("span", { children: current.name.charAt(0) })
				}), /* @__PURE__ */ jsxs("div", {
					className: "testi-body",
					children: [
						/* @__PURE__ */ jsx("span", {
							className: "qmark",
							children: "“"
						}),
						/* @__PURE__ */ jsx("blockquote", { children: current.quote }),
						/* @__PURE__ */ jsxs("div", {
							className: "testi-foot",
							children: [/* @__PURE__ */ jsxs("div", {
								className: "testi-who",
								children: [/* @__PURE__ */ jsx("b", { children: current.name }), /* @__PURE__ */ jsxs("span", { children: [
									current.role,
									" · ",
									current.company
								] })]
							}), total > 1 ? /* @__PURE__ */ jsxs("div", {
								className: "testi-nav",
								children: [/* @__PURE__ */ jsx("button", {
									type: "button",
									"aria-label": "Previous",
									onClick: onPrev,
									children: "←"
								}), /* @__PURE__ */ jsx("button", {
									type: "button",
									"aria-label": "Next",
									onClick: onNext,
									children: "→"
								})]
							}) : null]
						})
					]
				})]
			})]
		})
	});
}
function FAQ({ faq, open, onToggle }) {
	return /* @__PURE__ */ jsx("section", {
		className: "sec",
		style: { paddingTop: 0 },
		"data-screen-label": "09 FAQ",
		children: /* @__PURE__ */ jsx("div", {
			className: "wrap",
			children: /* @__PURE__ */ jsxs("div", {
				className: "faq-grid",
				children: [/* @__PURE__ */ jsxs("aside", {
					className: "faq-side",
					children: [
						/* @__PURE__ */ jsx("span", {
							className: "eyebrow",
							children: faq.badge
						}),
						/* @__PURE__ */ jsx("h2", { children: faq.title }),
						/* @__PURE__ */ jsx("p", { children: faq.kicker })
					]
				}), /* @__PURE__ */ jsx("div", {
					className: "faq",
					children: faq.items.map((item, i) => /* @__PURE__ */ jsxs("div", {
						className: `faq-item ${open === i ? "open" : ""}`,
						children: [/* @__PURE__ */ jsxs("button", {
							type: "button",
							className: "faq-q",
							onClick: () => onToggle(i),
							"aria-expanded": open === i,
							children: [/* @__PURE__ */ jsx("span", { children: item.question }), /* @__PURE__ */ jsx("span", {
								className: "sign",
								children: open === i ? "–" : "+"
							})]
						}), open === i ? /* @__PURE__ */ jsx("div", {
							className: "faq-a",
							children: item.answer
						}) : null]
					}, item.question))
				})]
			})
		})
	});
}
function CTA({ finalCta, primaryHref, hasUser }) {
	const label = hasUser ? "Open dashboard" : "Get started";
	return /* @__PURE__ */ jsx("section", {
		className: "wrap",
		"data-screen-label": "10 CTA",
		children: /* @__PURE__ */ jsxs("div", {
			className: "final",
			children: [
				/* @__PURE__ */ jsx("span", {
					className: "eyebrow",
					children: "Ready when you are"
				}),
				/* @__PURE__ */ jsx("h2", { children: finalCta.title }),
				/* @__PURE__ */ jsx("p", { children: finalCta.description }),
				/* @__PURE__ */ jsx("div", {
					className: "final-actions",
					children: /* @__PURE__ */ jsxs(Link, {
						href: primaryHref,
						className: "btn btn-primary",
						children: [
							label,
							" ",
							/* @__PURE__ */ jsx("span", {
								"aria-hidden": "true",
								children: "→"
							})
						]
					})
				})
			]
		})
	});
}
//#endregion
//#region resources/js/pages/marketing-themes/prism/how-it-works.tsx
var how_it_works_exports = /* @__PURE__ */ __exportAll({ default: () => PrismHowItWorks });
function PrismHowItWorks({ shell, brand, canRegister = false, steps, latency }) {
	return /* @__PURE__ */ jsxs(PrismLayout, {
		brand,
		navItems: shell.nav_items,
		footer: shell.footer,
		canRegister,
		title: `How it works — ${brand}`,
		description: `How the ${brand} sales AI widget turns your website into a 24/7 sales rep — from setup to first conversation in under 5 minutes.`,
		children: [
			/* @__PURE__ */ jsx("section", {
				className: "hero",
				"data-screen-label": "HIW hero",
				children: /* @__PURE__ */ jsxs("div", {
					className: "wrap",
					children: [/* @__PURE__ */ jsxs("h1", { children: [
						"From URL to a live agent in",
						" ",
						/* @__PURE__ */ jsx("span", {
							className: "ital",
							children: "under 5 minutes"
						}),
						"."
					] }), /* @__PURE__ */ jsxs("p", {
						className: "hero-sub",
						children: [brand, " reads your website, builds an AI agent grounded in your own content, and embeds it on any page with one line of HTML. Here's exactly what happens."]
					})]
				})
			}),
			/* @__PURE__ */ jsx("section", {
				className: "sec",
				style: { paddingTop: 0 },
				"data-screen-label": "HIW steps",
				children: /* @__PURE__ */ jsxs("div", {
					className: "wrap",
					children: [/* @__PURE__ */ jsxs("div", {
						className: "sec-hd-center",
						children: [
							/* @__PURE__ */ jsx("span", {
								className: "eyebrow",
								children: "From paste to live"
							}),
							/* @__PURE__ */ jsxs("h2", { children: [
								"Ship a working assistant in",
								" ",
								/* @__PURE__ */ jsx("span", {
									className: "ital",
									children: "three"
								}),
								" steps."
							] }),
							/* @__PURE__ */ jsx("p", {
								className: "lede",
								children: "Most teams go live before lunch — no engineering required."
							})
						]
					}), /* @__PURE__ */ jsx("div", {
						className: "steps-grid",
						children: steps.map((step, idx) => /* @__PURE__ */ jsxs("article", {
							className: "step",
							children: [
								/* @__PURE__ */ jsxs("span", {
									className: "step-n",
									children: [
										/* @__PURE__ */ jsx("span", {
											className: "step-num",
											children: idx + 1
										}),
										step.number,
										" · ",
										step.duration
									]
								}),
								/* @__PURE__ */ jsx("h3", { children: step.title }),
								/* @__PURE__ */ jsx("p", { children: step.description }),
								step.sub_points.length > 0 ? /* @__PURE__ */ jsx("ul", {
									style: {
										listStyle: "none",
										padding: 0,
										margin: 0,
										display: "flex",
										flexDirection: "column",
										gap: 6,
										fontSize: 13,
										color: "var(--muted)"
									},
									children: step.sub_points.map((point) => /* @__PURE__ */ jsxs("li", {
										style: {
											display: "flex",
											gap: 8,
											alignItems: "flex-start",
											lineHeight: 1.5
										},
										children: [/* @__PURE__ */ jsx("span", {
											"aria-hidden": "true",
											style: {
												width: 14,
												height: 14,
												borderRadius: 4,
												background: "var(--grad-soft)",
												flex: "0 0 auto",
												marginTop: 3
											}
										}), /* @__PURE__ */ jsx("span", { children: point })]
									}, point))
								}) : null
							]
						}, step.title))
					})]
				})
			}),
			/* @__PURE__ */ jsx("section", {
				className: "sec",
				style: { paddingTop: 0 },
				"data-screen-label": "HIW latency",
				children: /* @__PURE__ */ jsxs("div", {
					className: "wrap",
					children: [/* @__PURE__ */ jsx("div", {
						className: "sec-hd",
						children: /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("span", {
							className: "eyebrow",
							children: "Hot path contract"
						}), /* @__PURE__ */ jsxs("h2", { children: [
							"1 second to",
							" ",
							/* @__PURE__ */ jsx("span", {
								className: "ital",
								children: "first token"
							}),
							". Every time."
						] })] })
					}), /* @__PURE__ */ jsxs("div", {
						className: "tune-grid",
						children: [/* @__PURE__ */ jsxs("div", {
							className: "tune-left",
							children: [/* @__PURE__ */ jsxs("h4", { children: [
								"The visitor-message → first-token path has a hard p95 ",
								/* @__PURE__ */ jsx("span", {
									className: "ital",
									children: "budget"
								}),
								"."
							] }), /* @__PURE__ */ jsx("p", { children: "No DB writes, no synchronous webhooks, no retries. Persistence and analytics are dispatched async after the stream completes. OpenTelemetry spans wrap every phase, so when the budget breaks, the span heatmap points right at the offender." })]
						}), /* @__PURE__ */ jsx("div", {
							className: "tune-right",
							children: /* @__PURE__ */ jsxs("div", {
								className: "settings",
								children: [
									/* @__PURE__ */ jsxs("div", {
										className: "settings-hd",
										children: [/* @__PURE__ */ jsx("h5", { children: "P95 LATENCY BUDGET" }), /* @__PURE__ */ jsx("span", {
											className: "badge",
											children: "/ hot path"
										})]
									}),
									latency.map((row, idx) => /* @__PURE__ */ jsxs("div", {
										className: "settings-row",
										children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("div", {
											className: "lbl",
											children: row.phase
										}), /* @__PURE__ */ jsx("div", {
											className: "hint",
											children: `Phase ${idx + 1}`
										})] }), /* @__PURE__ */ jsx("div", {
											className: "field",
											style: { fontFamily: "ui-monospace, Menlo, monospace" },
											children: row.budget
										})]
									}, row.phase)),
									/* @__PURE__ */ jsxs("div", {
										className: "settings-row",
										style: { borderTop: "2px solid var(--fg)" },
										children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("div", {
											className: "lbl",
											children: "Total to first token"
										}), /* @__PURE__ */ jsx("div", {
											className: "hint",
											children: "P95 BUDGET"
										})] }), /* @__PURE__ */ jsx("div", {
											className: "field",
											style: {
												fontWeight: 600,
												fontFamily: "ui-monospace, Menlo, monospace"
											},
											children: "~ 865 ms"
										})]
									})
								]
							})
						})]
					})]
				})
			}),
			/* @__PURE__ */ jsx("section", {
				className: "wrap",
				"data-screen-label": "HIW CTA",
				children: /* @__PURE__ */ jsxs("div", {
					className: "final",
					children: [
						/* @__PURE__ */ jsx("span", {
							className: "eyebrow",
							children: "Start now"
						}),
						/* @__PURE__ */ jsxs("h2", { children: [
							"Try it on your ",
							/* @__PURE__ */ jsx("span", {
								className: "ital",
								children: "own site"
							}),
							"."
						] }),
						/* @__PURE__ */ jsx("p", { children: "Free to start. No card required. Live in 5 minutes." }),
						/* @__PURE__ */ jsxs("div", {
							className: "final-actions",
							children: [/* @__PURE__ */ jsx(Link, {
								href: "/register",
								className: "btn btn-primary",
								children: "Start free"
							}), /* @__PURE__ */ jsx(Link, {
								href: "/pricing",
								className: "btn btn-ghost",
								children: "See pricing"
							})]
						})
					]
				})
			})
		]
	});
}
//#endregion
//#region resources/js/pages/marketing-themes/prism/integrations.tsx
var integrations_exports = /* @__PURE__ */ __exportAll({ default: () => PrismIntegrations });
function code(name) {
	return name.split(/\s+/).slice(0, 2).map((p) => p[0]).join("").toUpperCase().slice(0, 3) || "IN";
}
function PrismIntegrations({ shell, brand, canRegister = false, native, data_sources, roadmap }) {
	return /* @__PURE__ */ jsxs(PrismLayout, {
		brand,
		navItems: shell.nav_items,
		footer: shell.footer,
		canRegister,
		title: `Integrations — ${brand}`,
		description: `Plug ${brand} into the tools your team already uses — Notion, Google Docs, Slack, Stripe, webhooks, and more.`,
		children: [
			/* @__PURE__ */ jsx("section", {
				className: "hero",
				"data-screen-label": "INT hero",
				children: /* @__PURE__ */ jsxs("div", {
					className: "wrap",
					children: [/* @__PURE__ */ jsxs("h1", { children: [
						"Plug ",
						brand,
						" into the",
						" ",
						/* @__PURE__ */ jsx("span", {
							className: "ital",
							children: "tools you already use"
						}),
						"."
					] }), /* @__PURE__ */ jsx("p", {
						className: "hero-sub",
						children: "Native sync where it matters, signed webhooks everywhere else. Bring your knowledge in. Push leads out. Capture human escalations without leaving Slack."
					})]
				})
			}),
			/* @__PURE__ */ jsx("section", {
				className: "sec",
				style: { paddingTop: 0 },
				"data-screen-label": "INT native",
				children: /* @__PURE__ */ jsxs("div", {
					className: "wrap",
					children: [/* @__PURE__ */ jsx("div", {
						className: "sec-hd",
						children: /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("span", {
							className: "eyebrow",
							children: "Native integrations"
						}), /* @__PURE__ */ jsx("h2", { children: "Ship-ready connectors, no glue code." })] })
					}), /* @__PURE__ */ jsx("div", {
						className: "features",
						children: native.map((item) => /* @__PURE__ */ jsxs("article", {
							className: "feat",
							children: [
								/* @__PURE__ */ jsx("div", {
									className: "ic",
									children: /* @__PURE__ */ jsx("span", {
										style: {
											fontSize: 12,
											fontWeight: 700
										},
										children: code(item.name)
									})
								}),
								/* @__PURE__ */ jsx("h4", { children: item.name }),
								/* @__PURE__ */ jsxs("p", { children: [
									/* @__PURE__ */ jsx("strong", {
										style: { color: "var(--fg)" },
										children: item.tagline
									}),
									/* @__PURE__ */ jsx("br", {}),
									item.description
								] }),
								/* @__PURE__ */ jsxs("div", {
									className: "tag",
									children: [item.category.toUpperCase(), " · LIVE"]
								})
							]
						}, item.name))
					})]
				})
			}),
			/* @__PURE__ */ jsx("section", {
				className: "sec",
				style: { paddingTop: 0 },
				"data-screen-label": "INT sources",
				children: /* @__PURE__ */ jsxs("div", {
					className: "wrap",
					children: [/* @__PURE__ */ jsx("div", {
						className: "sec-hd",
						children: /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("span", {
							className: "eyebrow",
							children: "Knowledge in"
						}), /* @__PURE__ */ jsxs("h2", { children: [
							"Five ways to ",
							/* @__PURE__ */ jsx("span", {
								className: "ital",
								children: "feed"
							}),
							" ",
							"the agent."
						] })] })
					}), /* @__PURE__ */ jsxs("div", {
						className: "tune-grid",
						children: [/* @__PURE__ */ jsxs("div", {
							className: "tune-left",
							children: [/* @__PURE__ */ jsxs("h4", { children: [
								"Mix and match — most teams start with a",
								" ",
								/* @__PURE__ */ jsx("span", {
									className: "ital",
									children: "sitemap crawl"
								}),
								", paste a few FAQs, then enable auto-index for the long tail."
							] }), /* @__PURE__ */ jsx("p", { children: "Every source type ships with idempotent ingest, dedup, and automatic re-crawl on a schedule you control." })]
						}), /* @__PURE__ */ jsx("div", {
							className: "tune-right",
							children: /* @__PURE__ */ jsxs("div", {
								className: "settings",
								children: [/* @__PURE__ */ jsxs("div", {
									className: "settings-hd",
									children: [/* @__PURE__ */ jsx("h5", { children: "SOURCE TYPES" }), /* @__PURE__ */ jsx("span", {
										className: "badge",
										children: "/ ingest"
									})]
								}), data_sources.map((src) => /* @__PURE__ */ jsxs("div", {
									className: "settings-row",
									children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("div", {
										className: "lbl",
										children: src.name
									}), /* @__PURE__ */ jsx("div", {
										className: "hint",
										children: src.tagline
									})] }), /* @__PURE__ */ jsx("div", {
										className: "field",
										style: { fontFamily: "ui-monospace, Menlo, monospace" },
										children: code(src.name)
									})]
								}, src.name))]
							})
						})]
					})]
				})
			}),
			/* @__PURE__ */ jsx("section", {
				className: "sec",
				style: { paddingTop: 0 },
				"data-screen-label": "INT roadmap",
				children: /* @__PURE__ */ jsxs("div", {
					className: "wrap",
					children: [/* @__PURE__ */ jsxs("div", {
						className: "sec-hd",
						children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("span", {
							className: "eyebrow",
							children: "On the roadmap"
						}), /* @__PURE__ */ jsx("h2", { children: "Coming soon." })] }), /* @__PURE__ */ jsx("p", {
							style: {
								color: "var(--muted)",
								fontSize: 14.5,
								maxWidth: "36ch"
							},
							children: "Until these ship natively, the outgoing webhook + a Zapier catch-hook covers every CRM in your stack."
						})]
					}), /* @__PURE__ */ jsx("div", {
						className: "uc-grid",
						children: roadmap.map((item) => /* @__PURE__ */ jsxs("article", {
							className: "uc",
							children: [
								/* @__PURE__ */ jsx("div", {
									className: "uc-ic",
									children: /* @__PURE__ */ jsx("span", {
										style: {
											fontSize: 11,
											fontWeight: 700
										},
										children: code(item.name)
									})
								}),
								/* @__PURE__ */ jsx("h3", { children: item.name }),
								/* @__PURE__ */ jsx("p", { children: item.tagline })
							]
						}, item.name))
					})]
				})
			}),
			/* @__PURE__ */ jsx("section", {
				className: "wrap",
				"data-screen-label": "INT CTA",
				children: /* @__PURE__ */ jsxs("div", {
					className: "final",
					children: [
						/* @__PURE__ */ jsx("span", {
							className: "eyebrow",
							children: "Ready?"
						}),
						/* @__PURE__ */ jsxs("h2", { children: ["Ready to ", /* @__PURE__ */ jsx("span", {
							className: "ital",
							children: "plug it in?"
						})] }),
						/* @__PURE__ */ jsx("p", { children: "Free to start. Connect Notion, Slack, and your first webhook in under 5 minutes." }),
						/* @__PURE__ */ jsxs("div", {
							className: "final-actions",
							children: [/* @__PURE__ */ jsx(Link, {
								href: "/register",
								className: "btn btn-primary",
								children: "Get started free"
							}), /* @__PURE__ */ jsx("a", {
								href: "/documentation/integrations",
								target: "_blank",
								rel: "noopener noreferrer",
								className: "btn btn-ghost",
								children: "Read integration docs"
							})]
						})
					]
				})
			})
		]
	});
}
//#endregion
//#region resources/js/pages/marketing-themes/prism/pricing.tsx
var pricing_exports = /* @__PURE__ */ __exportAll({ default: () => PrismPricing });
function formatPrice(value, symbol, decimals) {
	return `${symbol}${value.toLocaleString(void 0, {
		minimumFractionDigits: decimals,
		maximumFractionDigits: decimals
	})}`;
}
function MatrixValue({ value }) {
	if (value === true) return /* @__PURE__ */ jsx("svg", {
		width: "16",
		height: "16",
		viewBox: "0 0 24 24",
		fill: "none",
		stroke: "currentColor",
		strokeWidth: "2.5",
		style: {
			color: "var(--accent)",
			display: "inline-block",
			verticalAlign: "middle"
		},
		children: /* @__PURE__ */ jsx("path", { d: "M5 12l5 5L20 7" })
	});
	if (value === false) return /* @__PURE__ */ jsx("span", {
		style: { color: "var(--muted-2)" },
		children: "—"
	});
	return /* @__PURE__ */ jsx("span", {
		style: { fontWeight: 600 },
		children: value
	});
}
function FaqItem({ q, a, open, onToggle }) {
	return /* @__PURE__ */ jsxs("div", {
		className: `faq-item ${open ? "open" : ""}`,
		children: [/* @__PURE__ */ jsxs("button", {
			type: "button",
			className: "faq-q",
			onClick: onToggle,
			"aria-expanded": open,
			children: [/* @__PURE__ */ jsx("span", { children: q }), /* @__PURE__ */ jsx("span", {
				className: "sign",
				children: open ? "–" : "+"
			})]
		}), open ? /* @__PURE__ */ jsx("div", {
			className: "faq-a",
			children: a
		}) : null]
	});
}
function PrismPricing({ shell, brand, canRegister = false, plans, lifetime_plans, currency, currencies, matrix, faqs, contact_email }) {
	const [billingInterval, setBillingInterval] = useState("month");
	const [openFaq, setOpenFaq] = useState(0);
	const onCurrencyChange = (code) => {
		if (code === currency) return;
		router.visit(`/pricing?currency=${encodeURIComponent(code)}`, {
			preserveScroll: true,
			preserveState: false
		});
	};
	const hasAnnualOption = plans.some((p) => p.yearly_price > 0 && p.monthly_price > 0);
	const annualSavingsPercent = (() => {
		const candidate = plans.find((p) => p.monthly_price > 0 && p.yearly_price > 0);
		if (!candidate) return 0;
		const monthlyOverYear = candidate.monthly_price * 12;
		const saved = monthlyOverYear - candidate.yearly_price;
		return monthlyOverYear === 0 ? 0 : Math.round(saved / monthlyOverYear * 100);
	})();
	return /* @__PURE__ */ jsxs(PrismLayout, {
		brand,
		navItems: shell.nav_items,
		footer: shell.footer,
		canRegister,
		title: `Pricing — ${brand}`,
		description: `Simple, conversation-based pricing for the ${brand} sales AI widget. Start free; scale as you grow.`,
		children: [
			/* @__PURE__ */ jsx("section", {
				className: "hero",
				"data-screen-label": "Pricing hero",
				children: /* @__PURE__ */ jsxs("div", {
					className: "wrap",
					children: [
						/* @__PURE__ */ jsxs("h1", { children: [
							"Simple, ",
							/* @__PURE__ */ jsx("span", {
								className: "ital",
								children: "conversation-based"
							}),
							" ",
							"pricing."
						] }),
						/* @__PURE__ */ jsx("p", {
							className: "hero-sub",
							children: "Start free. Upgrade when you outgrow it. No per-seat fees, no setup fees, no surprise overages — just a clear conversation limit."
						}),
						/* @__PURE__ */ jsxs("div", {
							style: {
								marginTop: 28,
								display: "flex",
								flexWrap: "wrap",
								gap: 12,
								justifyContent: "center",
								alignItems: "center"
							},
							children: [hasAnnualOption ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("div", {
								role: "radiogroup",
								"aria-label": "Billing interval",
								style: {
									display: "inline-flex",
									border: "1px solid var(--line)",
									borderRadius: "var(--r-pill)",
									overflow: "hidden",
									background: "#fff"
								},
								children: ["month", "year"].map((v) => /* @__PURE__ */ jsx("button", {
									type: "button",
									role: "radio",
									"aria-checked": billingInterval === v,
									onClick: () => setBillingInterval(v),
									style: {
										padding: "8px 18px",
										fontSize: 13,
										fontWeight: 500,
										background: billingInterval === v ? "var(--fg)" : "transparent",
										color: billingInterval === v ? "#fff" : "var(--fg-2)",
										cursor: "pointer",
										border: 0
									},
									children: v === "month" ? "Monthly" : "Yearly"
								}, v))
							}), annualSavingsPercent > 0 ? /* @__PURE__ */ jsxs("span", {
								className: "pill-tag",
								children: [
									/* @__PURE__ */ jsx("span", { className: "dot" }),
									"Save ",
									annualSavingsPercent,
									"% yearly"
								]
							}) : null] }) : null, currencies.length > 1 ? /* @__PURE__ */ jsxs("label", {
								style: {
									display: "inline-flex",
									alignItems: "center",
									gap: 8,
									border: "1px solid var(--line)",
									borderRadius: "var(--r-pill)",
									padding: "6px 14px",
									background: "#fff",
									fontSize: 13
								},
								children: [/* @__PURE__ */ jsx("span", {
									style: {
										color: "var(--muted)",
										fontSize: 11,
										letterSpacing: "0.08em",
										textTransform: "uppercase",
										fontWeight: 600
									},
									children: "Currency"
								}), /* @__PURE__ */ jsx("select", {
									value: currency,
									onChange: (e) => onCurrencyChange(e.target.value),
									"aria-label": "Display currency",
									style: {
										background: "transparent",
										border: 0,
										fontWeight: 600,
										color: "var(--fg)",
										fontSize: 13,
										cursor: "pointer"
									},
									children: currencies.map((c) => /* @__PURE__ */ jsxs("option", {
										value: c.code,
										children: [
											c.code,
											" — ",
											c.name
										]
									}, c.code))
								})]
							}) : null]
						})
					]
				})
			}),
			/* @__PURE__ */ jsx("section", {
				className: "sec",
				style: { paddingTop: 0 },
				"data-screen-label": "Pricing plans",
				children: /* @__PURE__ */ jsxs("div", {
					className: "wrap",
					children: [/* @__PURE__ */ jsx("div", {
						style: {
							display: "grid",
							gridTemplateColumns: plans.length <= 1 ? "1fr" : `repeat(auto-fit, minmax(${plans.length === 2 ? "300px" : "240px"}, 1fr))`,
							gap: 14
						},
						children: plans.map((plan) => {
							const showYearly = billingInterval === "year" && plan.yearly_price > 0;
							const headlinePrice = showYearly ? Math.round(plan.yearly_price / 12) : plan.monthly_price;
							const ctaHref = billingInterval === "year" && plan.yearly_price > 0 ? plan.cta_href + (plan.cta_href.includes("?") ? "&" : "?") + "interval=year" : plan.cta_href;
							return /* @__PURE__ */ jsxs("div", {
								style: {
									position: "relative",
									border: "1px solid var(--line)",
									borderRadius: "var(--r-lg)",
									padding: 28,
									display: "flex",
									flexDirection: "column",
									background: plan.highlight ? "var(--grad-soft)" : "#fff",
									boxShadow: plan.highlight ? "var(--shadow-md)" : "none"
								},
								children: [
									plan.highlight ? /* @__PURE__ */ jsx("span", {
										style: {
											position: "absolute",
											top: -12,
											left: 24,
											background: "var(--grad)",
											color: "#fff",
											fontSize: 10,
											letterSpacing: "0.1em",
											textTransform: "uppercase",
											fontWeight: 700,
											padding: "4px 12px",
											borderRadius: "var(--r-pill)"
										},
										children: "Most popular"
									}) : null,
									/* @__PURE__ */ jsx("h3", {
										style: {
											fontFamily: "var(--sans)",
											fontSize: 22,
											fontWeight: 600,
											letterSpacing: "-0.015em"
										},
										children: plan.name
									}),
									/* @__PURE__ */ jsx("p", {
										style: {
											marginTop: 6,
											fontSize: 13,
											color: "var(--muted)",
											lineHeight: 1.5
										},
										children: plan.tagline
									}),
									/* @__PURE__ */ jsxs("div", {
										style: {
											marginTop: 22,
											display: "flex",
											alignItems: "baseline",
											gap: 6
										},
										children: [/* @__PURE__ */ jsx("span", {
											style: {
												fontFamily: "var(--sans)",
												fontWeight: 600,
												fontSize: "clamp(34px, 4vw, 52px)",
												letterSpacing: "-0.03em",
												lineHeight: 1
											},
											children: formatPrice(headlinePrice, plan.currency_symbol, plan.decimal_places)
										}), headlinePrice > 0 ? /* @__PURE__ */ jsx("span", {
											style: {
												fontSize: 12,
												color: "var(--muted)",
												fontWeight: 500
											},
											children: "/ month"
										}) : null]
									}),
									showYearly && plan.yearly_price > 0 ? /* @__PURE__ */ jsxs("p", {
										style: {
											marginTop: 6,
											fontSize: 11,
											color: "var(--muted)"
										},
										children: [
											formatPrice(plan.yearly_price, plan.currency_symbol, plan.decimal_places),
											" ",
											"billed annually"
										]
									}) : null,
									/* @__PURE__ */ jsx("p", {
										style: {
											marginTop: 14,
											fontSize: 14,
											fontWeight: 600
										},
										children: plan.volume
									}),
									/* @__PURE__ */ jsx("ul", {
										style: {
											marginTop: 18,
											listStyle: "none",
											padding: 0,
											display: "flex",
											flexDirection: "column",
											gap: 8,
											flex: 1
										},
										children: plan.features.map((feature) => /* @__PURE__ */ jsxs("li", {
											style: {
												display: "grid",
												gridTemplateColumns: "auto 1fr",
												gap: 10,
												fontSize: 13.5,
												lineHeight: 1.5,
												color: "var(--fg-2)"
											},
											children: [/* @__PURE__ */ jsx("svg", {
												width: "14",
												height: "14",
												viewBox: "0 0 24 24",
												fill: "none",
												stroke: "currentColor",
												strokeWidth: "2.5",
												style: {
													color: "var(--accent)",
													flex: "0 0 auto",
													marginTop: 4
												},
												children: /* @__PURE__ */ jsx("path", { d: "M5 12l5 5L20 7" })
											}), /* @__PURE__ */ jsx("span", { children: feature })]
										}, feature))
									}),
									/* @__PURE__ */ jsxs(Link, {
										href: ctaHref,
										className: plan.highlight ? "btn btn-primary" : "btn btn-light",
										style: {
											marginTop: 22,
											justifyContent: "center"
										},
										children: [plan.cta_label, /* @__PURE__ */ jsx("span", {
											className: "arr",
											children: "→"
										})]
									})
								]
							}, plan.name);
						})
					}), /* @__PURE__ */ jsxs("p", {
						style: {
							marginTop: 28,
							fontSize: 13,
							color: "var(--muted)",
							textAlign: "center"
						},
						children: [
							"Need higher limits or a self-hosted license?",
							" ",
							/* @__PURE__ */ jsx("a", {
								href: `mailto:${contact_email}`,
								style: {
									color: "var(--accent-ink)",
									fontWeight: 600,
									borderBottom: "2px solid var(--accent)"
								},
								children: "Talk to us about Enterprise"
							}),
							"."
						]
					})]
				})
			}),
			lifetime_plans.length > 0 ? /* @__PURE__ */ jsx("section", {
				className: "sec",
				style: { paddingTop: 0 },
				"data-screen-label": "Pricing lifetime",
				children: /* @__PURE__ */ jsxs("div", {
					className: "wrap",
					children: [/* @__PURE__ */ jsxs("div", {
						className: "sec-hd",
						children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("span", {
							className: "eyebrow",
							children: "Lifetime deal"
						}), /* @__PURE__ */ jsxs("h2", { children: [
							"Pay once.",
							" ",
							/* @__PURE__ */ jsx("span", {
								className: "ital",
								children: "Use forever."
							})
						] })] }), /* @__PURE__ */ jsx("p", {
							style: {
								color: "var(--muted)",
								fontSize: 14.5,
								maxWidth: "36ch"
							},
							children: "A one-time purchase that unlocks the agent for the lifetime of your account — no monthly bill, no surprise renewal."
						})]
					}), /* @__PURE__ */ jsx("div", {
						className: "uc-grid",
						children: lifetime_plans.map((plan) => /* @__PURE__ */ jsxs("article", {
							className: "uc",
							children: [
								/* @__PURE__ */ jsx("div", {
									className: "uc-ic",
									children: /* @__PURE__ */ jsx("span", {
										style: {
											fontSize: 11,
											fontWeight: 700
										},
										children: "LTD"
									})
								}),
								/* @__PURE__ */ jsx("h3", { children: plan.name }),
								/* @__PURE__ */ jsx("p", { children: plan.tagline }),
								/* @__PURE__ */ jsxs("div", {
									style: {
										fontFamily: "var(--sans)",
										fontWeight: 600,
										fontSize: 32,
										letterSpacing: "-0.03em",
										lineHeight: 1,
										marginTop: 10
									},
									children: [plan.price === null ? "—" : formatPrice(plan.price, plan.currency_symbol, plan.decimal_places), /* @__PURE__ */ jsx("span", {
										style: {
											fontSize: 12,
											color: "var(--muted)",
											marginLeft: 8,
											fontWeight: 500
										},
										children: "ONE-TIME"
									})]
								}),
								plan.monthly_conversations > 0 ? /* @__PURE__ */ jsxs("p", {
									style: {
										fontSize: 11,
										color: "var(--muted)",
										letterSpacing: "0.06em",
										textTransform: "uppercase",
										fontWeight: 600
									},
									children: [
										plan.monthly_conversations.toLocaleString(),
										" ",
										"conversations / month"
									]
								}) : null,
								/* @__PURE__ */ jsx("ul", {
									style: {
										marginTop: 12,
										listStyle: "none",
										padding: 0,
										display: "flex",
										flexDirection: "column",
										gap: 6
									},
									children: plan.features.map((feature) => /* @__PURE__ */ jsxs("li", {
										style: {
											display: "grid",
											gridTemplateColumns: "auto 1fr",
											gap: 8,
											fontSize: 13,
											color: "var(--fg-2)",
											lineHeight: 1.5
										},
										children: [/* @__PURE__ */ jsx("svg", {
											width: "12",
											height: "12",
											viewBox: "0 0 24 24",
											fill: "none",
											stroke: "currentColor",
											strokeWidth: "2.5",
											style: {
												color: "var(--accent)",
												flex: "0 0 auto",
												marginTop: 5
											},
											children: /* @__PURE__ */ jsx("path", { d: "M5 12l5 5L20 7" })
										}), /* @__PURE__ */ jsx("span", { children: feature })]
									}, feature))
								}),
								/* @__PURE__ */ jsxs(Link, {
									href: plan.cta_href,
									className: "btn btn-primary",
									style: {
										marginTop: 16,
										justifyContent: "center"
									},
									children: [plan.cta_label, /* @__PURE__ */ jsx("span", {
										className: "arr",
										children: "→"
									})]
								})
							]
						}, plan.id))
					})]
				})
			}) : null,
			/* @__PURE__ */ jsx("section", {
				className: "sec",
				style: { paddingTop: 0 },
				"data-screen-label": "Pricing matrix",
				children: /* @__PURE__ */ jsxs("div", {
					className: "wrap",
					children: [/* @__PURE__ */ jsx("div", {
						className: "sec-hd",
						children: /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("span", {
							className: "eyebrow",
							children: "Compare"
						}), /* @__PURE__ */ jsxs("h2", { children: [
							"Every feature,",
							" ",
							/* @__PURE__ */ jsx("span", {
								className: "ital",
								children: "side by side."
							})
						] })] })
					}), /* @__PURE__ */ jsx("div", {
						style: {
							border: "1px solid var(--line)",
							borderRadius: "var(--r-lg)",
							overflowX: "auto",
							background: "#fff"
						},
						children: /* @__PURE__ */ jsxs("table", {
							style: {
								width: "100%",
								minWidth: 640,
								borderCollapse: "collapse",
								fontSize: 14
							},
							children: [/* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", { children: [/* @__PURE__ */ jsx("th", {
								style: {
									textAlign: "left",
									padding: "14px 18px",
									fontSize: 11,
									letterSpacing: "0.08em",
									textTransform: "uppercase",
									color: "var(--muted)",
									borderBottom: "1px solid var(--line)",
									fontWeight: 600
								},
								children: "Feature"
							}), [
								"Free",
								"Standard",
								"Pro"
							].map((h) => /* @__PURE__ */ jsx("th", {
								style: {
									textAlign: "center",
									padding: "14px 18px",
									fontFamily: "var(--sans)",
									fontSize: 14,
									fontWeight: 600,
									borderBottom: "1px solid var(--line)",
									background: h === "Standard" ? "var(--grad-soft)" : "transparent",
									color: h === "Standard" ? "var(--accent-ink)" : "var(--fg)"
								},
								children: h
							}, h))] }) }), /* @__PURE__ */ jsx("tbody", { children: matrix.map((row) => /* @__PURE__ */ jsxs("tr", { children: [
								/* @__PURE__ */ jsx("td", {
									style: {
										padding: "14px 18px",
										fontWeight: 500,
										borderTop: "1px solid var(--line-2)",
										color: "var(--fg)"
									},
									children: row.label
								}),
								/* @__PURE__ */ jsx("td", {
									style: {
										padding: "14px 18px",
										textAlign: "center",
										borderTop: "1px solid var(--line-2)"
									},
									children: /* @__PURE__ */ jsx(MatrixValue, { value: row.free })
								}),
								/* @__PURE__ */ jsx("td", {
									style: {
										padding: "14px 18px",
										textAlign: "center",
										borderTop: "1px solid var(--line-2)",
										background: "var(--grad-soft)"
									},
									children: /* @__PURE__ */ jsx(MatrixValue, { value: row.standard })
								}),
								/* @__PURE__ */ jsx("td", {
									style: {
										padding: "14px 18px",
										textAlign: "center",
										borderTop: "1px solid var(--line-2)"
									},
									children: /* @__PURE__ */ jsx(MatrixValue, { value: row.pro })
								})
							] }, row.label)) })]
						})
					})]
				})
			}),
			faqs.length > 0 ? /* @__PURE__ */ jsx("section", {
				className: "sec",
				style: { paddingTop: 0 },
				"data-screen-label": "Pricing FAQ",
				children: /* @__PURE__ */ jsx("div", {
					className: "wrap",
					children: /* @__PURE__ */ jsxs("div", {
						className: "faq-grid",
						children: [/* @__PURE__ */ jsxs("aside", {
							className: "faq-side",
							children: [
								/* @__PURE__ */ jsx("span", {
									className: "eyebrow",
									children: "Frequently asked"
								}),
								/* @__PURE__ */ jsxs("h2", { children: [
									"About ",
									/* @__PURE__ */ jsx("span", {
										className: "ital",
										children: "plans"
									}),
									" ",
									"and billing."
								] }),
								/* @__PURE__ */ jsxs("p", { children: [
									"Don't see your question?",
									" ",
									/* @__PURE__ */ jsx("a", {
										href: `mailto:${contact_email}`,
										children: contact_email
									}),
									" ",
									"— we reply within a business day."
								] })
							]
						}), /* @__PURE__ */ jsx("div", {
							className: "faq",
							children: faqs.map((faq, idx) => /* @__PURE__ */ jsx(FaqItem, {
								q: faq.q,
								a: faq.a,
								open: openFaq === idx,
								onToggle: () => setOpenFaq((cur) => cur === idx ? -1 : idx)
							}, faq.q))
						})]
					})
				})
			}) : null,
			/* @__PURE__ */ jsx("section", {
				className: "wrap",
				"data-screen-label": "Pricing CTA",
				children: /* @__PURE__ */ jsxs("div", {
					className: "final",
					children: [
						/* @__PURE__ */ jsx("span", {
							className: "eyebrow",
							children: "Ready?"
						}),
						/* @__PURE__ */ jsxs("h2", { children: [
							"Ready to ship a",
							" ",
							/* @__PURE__ */ jsx("span", {
								className: "ital",
								children: "real sales AI?"
							})
						] }),
						/* @__PURE__ */ jsx("p", { children: "Free to start. Deploys in 5 minutes. No card required." }),
						/* @__PURE__ */ jsx("div", {
							className: "final-actions",
							children: /* @__PURE__ */ jsx(Link, {
								href: "/register",
								className: "btn btn-primary",
								children: "Get started free"
							})
						})
					]
				})
			})
		]
	});
}
//#endregion
//#region resources/js/pages/marketing-themes/prism/privacy.tsx
var privacy_exports = /* @__PURE__ */ __exportAll({ default: () => PrismPrivacy });
function ListBlock({ title, section }) {
	if (!section) return null;
	return /* @__PURE__ */ jsxs("section", {
		style: {
			marginTop: 40,
			borderTop: "1px solid var(--line)",
			paddingTop: 28
		},
		children: [
			/* @__PURE__ */ jsx("span", {
				className: "eyebrow",
				children: title
			}),
			/* @__PURE__ */ jsx("h2", {
				style: {
					marginTop: 14,
					fontFamily: "var(--sans)",
					fontWeight: 600,
					fontSize: "clamp(22px, 3vw, 32px)",
					letterSpacing: "-0.02em",
					lineHeight: 1.15
				},
				children: title
			}),
			section.summary ? /* @__PURE__ */ jsx("p", {
				style: {
					marginTop: 12,
					color: "var(--muted)",
					lineHeight: 1.6
				},
				children: section.summary
			}) : null,
			section.items && section.items.length > 0 ? /* @__PURE__ */ jsx("ul", {
				style: {
					listStyle: "none",
					padding: 0,
					margin: "14px 0 0",
					display: "flex",
					flexDirection: "column",
					gap: 10
				},
				children: section.items.map((item) => /* @__PURE__ */ jsxs("li", {
					style: {
						display: "flex",
						gap: 12,
						alignItems: "flex-start",
						color: "var(--fg-2)",
						lineHeight: 1.55
					},
					children: [/* @__PURE__ */ jsx("span", {
						"aria-hidden": "true",
						style: {
							width: 6,
							height: 6,
							borderRadius: "50%",
							background: "var(--accent)",
							marginTop: 8,
							flex: "0 0 auto"
						}
					}), /* @__PURE__ */ jsx("span", { children: item })]
				}, item))
			}) : null
		]
	});
}
function PrismPrivacy({ shell, brand, canRegister = false, content }) {
	const title = content.title ?? "Privacy policy";
	return /* @__PURE__ */ jsx(PrismLayout, {
		brand,
		navItems: shell.nav_items,
		footer: shell.footer,
		canRegister,
		title: `${title} — ${brand}`,
		description: content.summary,
		children: /* @__PURE__ */ jsx("section", {
			className: "sec",
			"data-screen-label": "Privacy",
			children: /* @__PURE__ */ jsx("div", {
				className: "wrap",
				children: /* @__PURE__ */ jsxs("article", {
					style: {
						maxWidth: 760,
						margin: "0 auto"
					},
					children: [
						/* @__PURE__ */ jsx("span", {
							className: "eyebrow",
							children: (content.eyebrow ?? "Legal").toString()
						}),
						/* @__PURE__ */ jsxs("h1", {
							style: {
								marginTop: 18,
								fontFamily: "var(--sans)",
								fontWeight: 600,
								fontSize: "clamp(34px, 6vw, 72px)",
								lineHeight: 1.05,
								letterSpacing: "-0.03em"
							},
							children: [
								title.split(" ")[0],
								" ",
								/* @__PURE__ */ jsx("span", {
									className: "ital",
									children: title.split(" ").slice(1).join(" ") || "policy"
								})
							]
						}),
						content.summary ? /* @__PURE__ */ jsx("p", {
							style: {
								marginTop: 18,
								color: "var(--muted)",
								fontSize: 16,
								lineHeight: 1.6
							},
							children: content.summary
						}) : null,
						content.effective_date ? /* @__PURE__ */ jsxs("p", {
							style: {
								marginTop: 16,
								fontSize: 12,
								letterSpacing: "0.08em",
								textTransform: "uppercase",
								color: "var(--muted)",
								fontWeight: 600
							},
							children: ["Effective date: ", content.effective_date]
						}) : null,
						content.contact ? /* @__PURE__ */ jsxs("section", {
							style: {
								marginTop: 40,
								borderTop: "1px solid var(--line)",
								paddingTop: 28
							},
							children: [/* @__PURE__ */ jsx("span", {
								className: "eyebrow",
								children: "Contact"
							}), /* @__PURE__ */ jsxs("p", {
								style: {
									marginTop: 14,
									color: "var(--fg-2)",
									lineHeight: 1.6
								},
								children: [
									content.contact.team_name,
									content.contact.email ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("br", {}), /* @__PURE__ */ jsx("a", {
										href: `mailto:${content.contact.email}`,
										style: {
											color: "var(--accent-ink)",
											borderBottom: "2px solid var(--accent)",
											paddingBottom: 1
										},
										children: content.contact.email
									})] }) : null,
									content.contact.response_sla ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("br", {}), content.contact.response_sla] }) : null
								]
							})]
						}) : null,
						/* @__PURE__ */ jsx(ListBlock, {
							title: "What we collect",
							section: content.collection
						}),
						/* @__PURE__ */ jsx(ListBlock, {
							title: "How we use data",
							section: content.usage
						}),
						/* @__PURE__ */ jsx(ListBlock, {
							title: "Retention",
							section: content.retention
						}),
						/* @__PURE__ */ jsx(ListBlock, {
							title: "Your rights",
							section: content.rights
						}),
						content.gdpr ? /* @__PURE__ */ jsxs("section", {
							style: {
								marginTop: 40,
								borderTop: "1px solid var(--line)",
								paddingTop: 28
							},
							children: [
								/* @__PURE__ */ jsx("span", {
									className: "eyebrow",
									children: "Data export & deletion (GDPR)"
								}),
								content.gdpr.summary ? /* @__PURE__ */ jsx("p", {
									style: {
										marginTop: 14,
										color: "var(--muted)",
										lineHeight: 1.6
									},
									children: content.gdpr.summary
								}) : null,
								content.gdpr.request_email ? /* @__PURE__ */ jsxs("p", {
									style: { marginTop: 12 },
									children: [
										"Request contact:",
										" ",
										/* @__PURE__ */ jsx("a", {
											href: `mailto:${content.gdpr.request_email}`,
											style: {
												background: "var(--grad-soft)",
												color: "var(--accent-ink)",
												padding: "2px 8px",
												borderRadius: 6,
												fontWeight: 600
											},
											children: content.gdpr.request_email
										})
									]
								}) : null,
								content.gdpr.request_instructions ? /* @__PURE__ */ jsx("p", {
									style: {
										marginTop: 12,
										color: "var(--muted)",
										lineHeight: 1.6
									},
									children: content.gdpr.request_instructions
								}) : null
							]
						}) : null
					]
				})
			})
		})
	});
}
//#endregion
//#region resources/js/pages/marketing-themes/prism/terms.tsx
var terms_exports = /* @__PURE__ */ __exportAll({ default: () => PrismTerms });
function PrismTerms({ shell, brand, canRegister = false, effective_date, contact_email, intro, sections }) {
	return /* @__PURE__ */ jsx(PrismLayout, {
		brand,
		navItems: shell.nav_items,
		footer: shell.footer,
		canRegister,
		title: `Terms of service — ${brand}`,
		description: intro,
		children: /* @__PURE__ */ jsx("section", {
			className: "sec",
			"data-screen-label": "Terms",
			children: /* @__PURE__ */ jsx("div", {
				className: "wrap",
				children: /* @__PURE__ */ jsxs("article", {
					style: {
						maxWidth: 760,
						margin: "0 auto"
					},
					children: [
						/* @__PURE__ */ jsx("span", {
							className: "eyebrow",
							children: "Legal"
						}),
						/* @__PURE__ */ jsxs("h1", {
							style: {
								marginTop: 18,
								fontFamily: "var(--sans)",
								fontWeight: 600,
								fontSize: "clamp(34px, 6vw, 72px)",
								lineHeight: 1.05,
								letterSpacing: "-0.03em"
							},
							children: [
								"Terms of ",
								/* @__PURE__ */ jsx("span", {
									className: "ital",
									children: "service"
								}),
								"."
							]
						}),
						/* @__PURE__ */ jsx("p", {
							style: {
								marginTop: 18,
								color: "var(--muted)",
								lineHeight: 1.6,
								fontSize: 16
							},
							children: intro
						}),
						/* @__PURE__ */ jsxs("p", {
							style: {
								marginTop: 16,
								fontSize: 12,
								letterSpacing: "0.08em",
								textTransform: "uppercase",
								color: "var(--muted)",
								fontWeight: 600
							},
							children: ["Effective date: ", effective_date]
						}),
						/* @__PURE__ */ jsxs("div", {
							style: { marginTop: 40 },
							children: [sections.map((section, idx) => /* @__PURE__ */ jsxs("section", {
								style: {
									marginTop: idx === 0 ? 0 : 40,
									paddingTop: 28,
									borderTop: "1px solid var(--line)"
								},
								children: [
									/* @__PURE__ */ jsx("span", {
										className: "eyebrow",
										children: `Section ${idx + 1}`
									}),
									/* @__PURE__ */ jsx("h2", {
										style: {
											marginTop: 14,
											fontFamily: "var(--sans)",
											fontWeight: 600,
											fontSize: "clamp(22px, 3vw, 32px)",
											letterSpacing: "-0.02em",
											lineHeight: 1.15
										},
										children: section.title
									}),
									section.body?.map((para) => /* @__PURE__ */ jsx("p", {
										style: {
											marginTop: 14,
											color: "var(--muted)",
											lineHeight: 1.6
										},
										children: para
									}, para)),
									section.bullets && section.bullets.length > 0 ? /* @__PURE__ */ jsx("ul", {
										style: {
											listStyle: "none",
											padding: 0,
											margin: "14px 0 0",
											display: "flex",
											flexDirection: "column",
											gap: 10
										},
										children: section.bullets.map((b) => /* @__PURE__ */ jsxs("li", {
											style: {
												display: "flex",
												gap: 12,
												alignItems: "flex-start",
												color: "var(--fg-2)",
												lineHeight: 1.55
											},
											children: [/* @__PURE__ */ jsx("span", {
												"aria-hidden": "true",
												style: {
													width: 6,
													height: 6,
													borderRadius: "50%",
													background: "var(--accent)",
													marginTop: 8,
													flex: "0 0 auto"
												}
											}), /* @__PURE__ */ jsx("span", { children: b })]
										}, b))
									}) : null
								]
							}, section.title)), /* @__PURE__ */ jsxs("section", {
								style: {
									marginTop: 40,
									paddingTop: 28,
									borderTop: "1px solid var(--line)"
								},
								children: [/* @__PURE__ */ jsx("span", {
									className: "eyebrow",
									children: "Contact"
								}), /* @__PURE__ */ jsxs("p", {
									style: {
										marginTop: 14,
										color: "var(--muted)",
										lineHeight: 1.6
									},
									children: [
										"Questions about these terms? Email",
										" ",
										/* @__PURE__ */ jsx("a", {
											href: `mailto:${contact_email}`,
											style: {
												background: "var(--grad-soft)",
												color: "var(--accent-ink)",
												padding: "2px 8px",
												borderRadius: 6,
												fontWeight: 600
											},
											children: contact_email
										}),
										"."
									]
								})]
							})]
						}),
						/* @__PURE__ */ jsx("hr", { style: {
							marginTop: 56,
							border: 0,
							borderTop: "1px solid var(--line)"
						} }),
						/* @__PURE__ */ jsxs("p", {
							style: {
								marginTop: 24,
								fontStyle: "italic",
								fontSize: 13,
								color: "var(--muted)"
							},
							children: [
								"Operators deploying ",
								brand,
								": this template is reasonable boilerplate but is not legal advice. Adjust to reflect your jurisdiction, business model, and consult counsel before relying on it in production."
							]
						})
					]
				})
			})
		})
	});
}
//#endregion
//#region resources/js/pages/onboarding/index.tsx
var onboarding_exports = /* @__PURE__ */ __exportAll({ default: () => Onboarding });
function csrf() {
	return document.querySelector("meta[name=\"csrf-token\"]")?.content ?? "";
}
function Onboarding({ agent: initialAgent, workspace, is_new_agent: isNewAgent, start_url, widget, current_plan: currentPlan, available_plans: availablePlans }) {
	const { t } = useT();
	const [step, setStep] = useState(initialAgent.sources_count === 0 ? "connect" : "install");
	const [domain, setDomain] = useState(start_url ?? "");
	const [discovering, setDiscovering] = useState(false);
	const [discoverError, setDiscoverError] = useState(null);
	const [discovered, setDiscovered] = useState(null);
	const [picked, setPicked] = useState({});
	const [adding, setAdding] = useState(false);
	const [agent, setAgent] = useState(initialAgent);
	const pollRef = useRef(null);
	const [detection, setDetection] = useState(null);
	const [detecting, setDetecting] = useState(false);
	const [detectError, setDetectError] = useState(null);
	const [chosenVertical, setChosenVertical] = useState(null);
	const [applying, setApplying] = useState(false);
	const [editingName, setEditingName] = useState(false);
	const [draftName, setDraftName] = useState(initialAgent.name);
	const [savingName, setSavingName] = useState(false);
	const [nameError, setNameError] = useState(null);
	const saveName = async () => {
		const trimmed = draftName.trim();
		if (trimmed === "" || trimmed === agent.name) {
			setEditingName(false);
			setDraftName(agent.name);
			setNameError(null);
			return;
		}
		setSavingName(true);
		setNameError(null);
		try {
			const res = await fetch(`/app/agents/${agent.id}`, {
				method: "PATCH",
				credentials: "same-origin",
				redirect: "manual",
				headers: {
					"Content-Type": "application/json",
					Accept: "application/json",
					"X-CSRF-TOKEN": csrf(),
					"X-Requested-With": "XMLHttpRequest"
				},
				body: JSON.stringify({ name: trimmed })
			});
			if (!res.ok && res.type !== "opaqueredirect") throw new Error(`HTTP ${res.status}`);
			setAgent((a) => ({
				...a,
				name: trimmed
			}));
			setEditingName(false);
		} catch (e) {
			setNameError(e instanceof Error ? e.message : t("Could not save name."));
		} finally {
			setSavingName(false);
		}
	};
	const allUrls = useMemo(() => discovered ? [...discovered.sitemap_urls, ...discovered.probed_urls] : [], [discovered]);
	const pickedCount = useMemo(() => Object.values(picked).filter(Boolean).length, [picked]);
	const snippet = `<script src="${widget.src}" data-agent-id="${widget.agent_id}" defer><\/script>`;
	const discover = async () => {
		if (!domain) return;
		setDiscovering(true);
		setDiscoverError(null);
		try {
			const res = await fetch(`/app/agents/${agent.id}/sources/discover`, {
				method: "POST",
				credentials: "same-origin",
				headers: {
					"Content-Type": "application/json",
					Accept: "application/json",
					"X-CSRF-TOKEN": csrf(),
					"X-Requested-With": "XMLHttpRequest"
				},
				body: JSON.stringify({ url: domain })
			});
			if (!res.ok) {
				const text = await res.text();
				throw new Error(text || `HTTP ${res.status}`);
			}
			const json = await res.json();
			setDiscovered(json.data);
			const initial = {};
			json.data.sitemap_urls.slice(0, 8).forEach((u) => initial[u] = true);
			json.data.probed_urls.forEach((u) => initial[u] = true);
			setPicked(initial);
			setStep("detect");
		} catch (e) {
			setDiscoverError(e instanceof Error ? e.message : t("Discovery failed."));
		} finally {
			setDiscovering(false);
		}
	};
	const detectStartedRef = useRef(null);
	useEffect(() => {
		if (step !== "detect") {
			detectStartedRef.current = null;
			return;
		}
		const key = `${agent.id}|${domain}`;
		if (detectStartedRef.current === key) return;
		detectStartedRef.current = key;
		const controller = new AbortController();
		const timeoutId = window.setTimeout(() => controller.abort(), 2e4);
		const run = async () => {
			setDetecting(true);
			setDetectError(null);
			try {
				const res = await fetch(`/app/agents/${agent.id}/vertical/detect`, {
					method: "POST",
					credentials: "same-origin",
					headers: {
						"Content-Type": "application/json",
						Accept: "application/json",
						"X-CSRF-TOKEN": csrf(),
						"X-Requested-With": "XMLHttpRequest"
					},
					body: JSON.stringify({ url: domain }),
					signal: controller.signal
				});
				if (!res.ok) throw new Error(`HTTP ${res.status}`);
				const result = (await res.json()).data;
				const safeType = isVerticalId(result.type) ? result.type : "generic";
				setDetection({
					...result,
					type: safeType
				});
				setChosenVertical(safeType);
			} catch (e) {
				const aborted = e instanceof DOMException && e.name === "AbortError";
				setDetectError(aborted ? t("Detection timed out — pick a vertical manually.") : e instanceof Error ? e.message : t("Detection failed — pick a vertical manually."));
				setDetection({
					type: "generic",
					confidence: 0,
					alternatives: [],
					signals: [aborted ? "timeout" : "fetch_failed"]
				});
				setChosenVertical("generic");
			} finally {
				window.clearTimeout(timeoutId);
				setDetecting(false);
			}
		};
		run();
		return () => {
			window.clearTimeout(timeoutId);
			controller.abort();
		};
	}, [
		step,
		agent.id,
		domain,
		t
	]);
	const applyVertical = async (slug) => {
		setApplying(true);
		try {
			const res = await fetch(`/app/agents/${agent.id}/vertical/apply`, {
				method: "POST",
				credentials: "same-origin",
				headers: {
					"Content-Type": "application/json",
					Accept: "application/json",
					"X-CSRF-TOKEN": csrf(),
					"X-Requested-With": "XMLHttpRequest"
				},
				body: JSON.stringify({ site_type: slug })
			});
			if (!res.ok) throw new Error(`HTTP ${res.status}`);
			setStep("pick");
		} catch (e) {
			setDetectError(e instanceof Error ? e.message : t("Could not apply preset — try again."));
		} finally {
			setApplying(false);
		}
	};
	const addPicked = async () => {
		const urls = Object.entries(picked).filter(([, v]) => v).map(([u]) => u);
		if (urls.length === 0) return;
		setAdding(true);
		try {
			const fd = new FormData();
			for (const u of urls) fd.append("urls[]", u);
			fd.append("_token", csrf());
			const res = await fetch(`/app/agents/${agent.id}/sources/bulk`, {
				method: "POST",
				credentials: "same-origin",
				headers: {
					"X-CSRF-TOKEN": csrf(),
					"X-Requested-With": "XMLHttpRequest",
					Accept: "application/json"
				},
				body: fd
			});
			if (!res.ok) throw new Error(`HTTP ${res.status}`);
			setStep("install");
			setAgent((a) => ({
				...a,
				sources_count: a.sources_count + urls.length
			}));
		} catch (e) {
			setDiscoverError(e instanceof Error ? e.message : t("Bulk add failed."));
		} finally {
			setAdding(false);
		}
	};
	useEffect(() => {
		if (step !== "install") return;
		if (agent.sources_count > 0 && agent.sources_indexed >= agent.sources_count) return;
		const MAX_TICKS = 60;
		let ticks = 0;
		let stopped = false;
		const tick = async () => {
			ticks++;
			if (stopped) return;
			try {
				const r = await fetch(`/api/v1/agents/${agent.id}/onboarding-status`, {
					credentials: "same-origin",
					headers: { Accept: "application/json" }
				});
				if (r.ok) {
					const data = (await r.json()).data ?? {};
					setAgent((a) => ({
						...a,
						...data
					}));
					if (data.sources_count > 0 && data.sources_indexed >= data.sources_count || ticks >= MAX_TICKS) {
						if (pollRef.current !== null) {
							window.clearInterval(pollRef.current);
							pollRef.current = null;
						}
					}
				}
			} catch {}
		};
		pollRef.current = window.setInterval(tick, 3e3);
		return () => {
			stopped = true;
			if (pollRef.current !== null) {
				window.clearInterval(pollRef.current);
				pollRef.current = null;
			}
		};
	}, [
		step,
		agent.id,
		agent.sources_count,
		agent.sources_indexed
	]);
	return /* @__PURE__ */ jsxs(AppLayout, {
		breadcrumbs: [{
			title: t("Setup"),
			href: "/onboarding"
		}],
		children: [/* @__PURE__ */ jsx(Head, { title: t("Set up your AI agent") }), /* @__PURE__ */ jsxs("div", {
			className: "mx-auto flex w-full max-w-3xl flex-col gap-6 p-6",
			children: [
				/* @__PURE__ */ jsxs("div", {
					className: "flex items-center gap-2 text-sm text-muted-foreground",
					children: [
						/* @__PURE__ */ jsx(Sparkles, { className: "size-4" }),
						" ",
						t("First-time setup · 4 quick steps")
					]
				}),
				availablePlans.length > 1 && /* @__PURE__ */ jsxs(Card, {
					className: "border-border/80 p-4",
					children: [/* @__PURE__ */ jsxs("div", {
						className: "mb-2 flex items-center justify-between gap-3",
						children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
							className: "text-sm font-medium",
							children: t("Your starting plan")
						}), /* @__PURE__ */ jsx("p", {
							className: "text-xs text-muted-foreground",
							children: currentPlan ? t("You're on :name. Switch any time from billing.", { name: currentPlan.name }) : t("No plan attached yet. Pick one to lift limits.")
						})] }), /* @__PURE__ */ jsx("a", {
							href: "/app/billing",
							className: "shrink-0 rounded-full border border-foreground bg-foreground px-3 py-1.5 text-xs font-medium text-background hover:bg-foreground/90",
							children: t("View plans")
						})]
					}), /* @__PURE__ */ jsx("div", {
						className: "grid grid-cols-1 gap-2 sm:grid-cols-2 md:grid-cols-3",
						children: availablePlans.slice(0, 3).map((p) => {
							const isCurrent = currentPlan?.id === p.id;
							return /* @__PURE__ */ jsxs("div", {
								className: `flex items-center justify-between rounded-md border p-2 text-xs ${isCurrent ? "border-foreground bg-foreground/5" : "border-border bg-background"}`,
								children: [/* @__PURE__ */ jsxs("div", {
									className: "min-w-0",
									children: [/* @__PURE__ */ jsx("p", {
										className: "truncate font-medium",
										children: p.name
									}), /* @__PURE__ */ jsx("p", {
										className: "text-[10px] text-muted-foreground",
										children: p.price_cents === 0 ? t("Free") : t(":amount /:period", {
											amount: `$${(p.price_cents / 100).toFixed(0)}`,
											period: p.interval === "year" ? t("yr") : t("mo")
										})
									})]
								}), isCurrent && /* @__PURE__ */ jsx("span", {
									className: "rounded-full bg-foreground px-1.5 py-0.5 text-[9px] font-semibold text-background",
									children: t("Current")
								})]
							}, p.id);
						})
					})]
				}),
				/* @__PURE__ */ jsx(Card, {
					className: "border-border/80 bg-muted/20 p-5",
					children: /* @__PURE__ */ jsx("div", {
						className: "flex items-start justify-between gap-4",
						children: /* @__PURE__ */ jsxs("div", {
							className: "min-w-0 flex-1",
							children: [
								/* @__PURE__ */ jsxs("p", {
									className: "text-[11px] font-semibold tracking-wide text-muted-foreground uppercase",
									children: [
										isNewAgent ? t("Creating your first agent in") : t("Configuring agent in"),
										" ",
										workspace.name
									]
								}),
								/* @__PURE__ */ jsx("div", {
									className: "mt-1 flex items-center gap-2",
									children: editingName ? /* @__PURE__ */ jsxs(Fragment$1, { children: [
										/* @__PURE__ */ jsx(Input, {
											autoFocus: true,
											value: draftName,
											disabled: savingName,
											onChange: (e) => setDraftName(e.target.value),
											onKeyDown: (e) => {
												if (e.key === "Enter") saveName();
												else if (e.key === "Escape") {
													setEditingName(false);
													setDraftName(agent.name);
													setNameError(null);
												}
											},
											className: "max-w-sm text-lg font-semibold"
										}),
										/* @__PURE__ */ jsx(Button, {
											size: "sm",
											onClick: () => void saveName(),
											disabled: savingName,
											children: savingName ? t("Saving…") : t("Save")
										}),
										/* @__PURE__ */ jsx(Button, {
											size: "sm",
											variant: "ghost",
											onClick: () => {
												setEditingName(false);
												setDraftName(agent.name);
												setNameError(null);
											},
											disabled: savingName,
											children: t("Cancel")
										})
									] }) : /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("h2", {
										className: "text-lg font-semibold tracking-tight",
										children: agent.name
									}), /* @__PURE__ */ jsx("button", {
										type: "button",
										onClick: () => setEditingName(true),
										className: "rounded-md border border-border bg-background px-2 py-0.5 text-xs text-muted-foreground transition hover:text-foreground",
										title: t("Rename this agent"),
										children: t("Rename")
									})] })
								}),
								nameError && /* @__PURE__ */ jsx("p", {
									className: "mt-2 text-xs text-destructive",
									children: nameError
								}),
								/* @__PURE__ */ jsxs("p", {
									className: "mt-3 text-sm text-muted-foreground",
									children: [
										isNewAgent ? t("We've created an agent for you in this workspace. The 4 steps below feed it the knowledge it needs and give you a snippet to embed on your site.") : t("These 4 steps configure this agent: pick which pages it learns from, then grab a snippet to embed it on your site."),
										" ",
										t("You can always add more agents, edit personality, theme, or knowledge sources from the agent dashboard later.")
									]
								})
							]
						})
					})
				}),
				/* @__PURE__ */ jsxs("div", {
					className: "flex items-center gap-2 text-xs",
					children: [
						/* @__PURE__ */ jsx(StepDot, {
							active: step === "connect",
							done: step !== "connect",
							label: t("1. Connect")
						}),
						/* @__PURE__ */ jsx(DirArrow, {
							direction: "forward",
							style: "chevron",
							className: "size-3 text-muted-foreground"
						}),
						/* @__PURE__ */ jsx(StepDot, {
							active: step === "detect",
							done: step === "pick" || step === "install",
							label: t("2. Detect")
						}),
						/* @__PURE__ */ jsx(DirArrow, {
							direction: "forward",
							style: "chevron",
							className: "size-3 text-muted-foreground"
						}),
						/* @__PURE__ */ jsx(StepDot, {
							active: step === "pick",
							done: step === "install",
							label: t("3. Pick pages")
						}),
						/* @__PURE__ */ jsx(DirArrow, {
							direction: "forward",
							style: "chevron",
							className: "size-3 text-muted-foreground"
						}),
						/* @__PURE__ */ jsx(StepDot, {
							active: step === "install",
							done: false,
							label: t("4. Install")
						})
					]
				}),
				step === "connect" && /* @__PURE__ */ jsxs(Card, {
					className: "border-border/80 p-6",
					children: [
						/* @__PURE__ */ jsx("h1", {
							className: "text-xl font-semibold tracking-tight",
							children: t("Where does your agent live?")
						}),
						/* @__PURE__ */ jsx("p", {
							className: "mt-1 text-sm text-muted-foreground",
							children: t("Paste your website URL. We'll auto-discover the pages worth indexing.")
						}),
						/* @__PURE__ */ jsxs("div", {
							className: "mt-4 grid gap-1.5",
							children: [
								/* @__PURE__ */ jsx(Label, {
									htmlFor: "domain",
									children: t("Website URL")
								}),
								/* @__PURE__ */ jsx(Input, {
									id: "domain",
									type: "url",
									placeholder: "https://your-site.com",
									value: domain,
									onChange: (e) => setDomain(e.target.value)
								}),
								discoverError && /* @__PURE__ */ jsx("p", {
									className: "mt-2 text-xs text-destructive",
									children: discoverError
								})
							]
						}),
						/* @__PURE__ */ jsxs("div", {
							className: "mt-4 flex gap-2",
							children: [/* @__PURE__ */ jsx(Button, {
								onClick: discover,
								disabled: !domain || discovering,
								children: discovering ? /* @__PURE__ */ jsxs(Fragment$1, { children: [
									/* @__PURE__ */ jsx(Loader2, { className: "size-4 animate-spin" }),
									" ",
									t("Scanning…")
								] }) : t("Scan my site")
							}), /* @__PURE__ */ jsx(Button, {
								variant: "ghost",
								onClick: () => router.visit(dashboard$1().url),
								children: t("Skip for now")
							})]
						})
					]
				}),
				step === "detect" && /* @__PURE__ */ jsxs(Card, {
					className: "border-border/80 p-6",
					children: [
						/* @__PURE__ */ jsx("h1", {
							className: "text-xl font-semibold tracking-tight",
							children: t("What kind of site is this?")
						}),
						/* @__PURE__ */ jsx("p", {
							className: "mt-1 text-sm text-muted-foreground",
							children: t("We'll tune starter prompts, response style, and capabilities to match. You can change this any time later.")
						}),
						detecting && !detection && /* @__PURE__ */ jsxs("div", {
							className: "mt-6 flex flex-col items-center gap-3 rounded-lg border border-dashed border-border bg-muted/20 px-6 py-10 text-center",
							children: [
								/* @__PURE__ */ jsx(Loader2, { className: "size-6 animate-spin text-muted-foreground" }),
								/* @__PURE__ */ jsx("p", {
									className: "text-sm text-muted-foreground",
									children: t("Looking at your homepage…")
								}),
								/* @__PURE__ */ jsx("p", {
									className: "text-xs text-muted-foreground/80",
									children: t("We're scanning a few signals (page metadata, schema, URL shape) to suggest the best preset.")
								})
							]
						}),
						detection && /* @__PURE__ */ jsxs(Fragment$1, { children: [
							detectError && /* @__PURE__ */ jsxs("div", {
								className: "mt-4 flex items-start gap-2 rounded-md border border-amber-200 bg-amber-50 px-3 py-2 text-xs text-amber-900",
								children: [/* @__PURE__ */ jsx(TriangleAlert, { className: "mt-0.5 size-3.5 shrink-0" }), /* @__PURE__ */ jsxs("span", { children: [
									detectError,
									" ",
									t("You can pick a vertical manually below.")
								] })]
							}),
							detection.confidence > 0 && detection.type !== "generic" && /* @__PURE__ */ jsxs("div", {
								className: "mt-5 flex flex-col gap-2 rounded-lg border border-border bg-muted/30 px-4 py-3",
								children: [/* @__PURE__ */ jsxs("div", {
									className: "flex items-center justify-between gap-3",
									children: [/* @__PURE__ */ jsxs("span", {
										className: "flex items-center gap-3",
										children: [(() => {
											const Icon = VERTICAL_BY_ID[detection.type].icon;
											return /* @__PURE__ */ jsx("span", {
												className: "inline-flex size-9 items-center justify-center rounded-md border border-border bg-background",
												children: /* @__PURE__ */ jsx(Icon, { className: "size-4" })
											});
										})(), /* @__PURE__ */ jsxs("span", { children: [/* @__PURE__ */ jsxs("span", {
											className: "block text-sm font-semibold",
											children: [
												t("Detected:"),
												" ",
												VERTICAL_BY_ID[detection.type].name
											]
										}), /* @__PURE__ */ jsx("span", {
											className: "block text-xs text-muted-foreground",
											children: VERTICAL_BY_ID[detection.type].shortDesc
										})] })]
									}), /* @__PURE__ */ jsx(VerticalConfidencePill, { score: detection.confidence })]
								}), detection.alternatives && detection.alternatives.length > 0 && /* @__PURE__ */ jsxs("p", {
									className: "text-xs text-muted-foreground",
									children: [
										t("Other possibilities:"),
										" ",
										detection.alternatives.slice(0, 3).map((alt, i) => /* @__PURE__ */ jsxs("span", { children: [i > 0 && ", ", /* @__PURE__ */ jsx("button", {
											type: "button",
											className: "font-medium text-foreground underline-offset-2 hover:underline",
											onClick: () => setChosenVertical(alt.type),
											children: VERTICAL_BY_ID[alt.type]?.name ?? alt.type
										})] }, alt.type))
									]
								})]
							}),
							/* @__PURE__ */ jsxs("div", {
								className: "mt-5",
								children: [/* @__PURE__ */ jsx("p", {
									className: "mb-2 text-xs font-semibold tracking-wide text-muted-foreground uppercase",
									children: t("Confirm or pick a different match")
								}), /* @__PURE__ */ jsx(VerticalRadioGrid, {
									value: chosenVertical,
									onChange: setChosenVertical,
									detectedId: detection.type
								})]
							}),
							/* @__PURE__ */ jsxs("div", {
								className: "mt-6 flex items-center justify-between",
								children: [/* @__PURE__ */ jsx(Button, {
									variant: "ghost",
									onClick: () => void applyVertical("generic"),
									disabled: applying,
									children: t("I'll configure later")
								}), /* @__PURE__ */ jsx(Button, {
									onClick: () => void applyVertical(chosenVertical ?? detection.type),
									disabled: applying || !chosenVertical,
									children: applying ? t("Applying…") : t("Use this preset")
								})]
							})
						] })
					]
				}),
				step === "pick" && discovered && /* @__PURE__ */ jsxs(Card, {
					className: "border-border/80 p-6",
					children: [
						/* @__PURE__ */ jsx("h1", {
							className: "text-xl font-semibold tracking-tight",
							children: discovered.total === 1 ? t("Found :count page", { count: discovered.total }) : t("Found :count pages", { count: discovered.total })
						}),
						/* @__PURE__ */ jsx("p", {
							className: "mt-1 text-sm text-muted-foreground",
							children: t("Pick the ones you want the agent to learn from. You can add more later.")
						}),
						/* @__PURE__ */ jsx("div", {
							className: "mt-4 max-h-96 overflow-y-auto rounded-md border bg-muted/20",
							children: allUrls.length === 0 ? /* @__PURE__ */ jsx("p", {
								className: "p-4 text-sm text-muted-foreground",
								children: t("No pages found from sitemap or common paths. You can paste URLs manually on the next page.")
							}) : /* @__PURE__ */ jsx("ul", {
								className: "divide-y text-sm",
								children: allUrls.map((url) => /* @__PURE__ */ jsxs("li", {
									className: "flex items-center gap-3 px-3 py-2",
									children: [/* @__PURE__ */ jsx("input", {
										type: "checkbox",
										checked: picked[url] ?? false,
										className: "size-3.5 rounded border-input accent-foreground",
										onChange: (e) => setPicked((p) => ({
											...p,
											[url]: e.target.checked
										}))
									}), /* @__PURE__ */ jsx("span", {
										className: "truncate",
										children: url
									})]
								}, url))
							})
						}),
						/* @__PURE__ */ jsxs("div", {
							className: "mt-4 flex items-center justify-between",
							children: [/* @__PURE__ */ jsx("p", {
								className: "text-xs text-muted-foreground",
								children: t(":count selected", { count: pickedCount })
							}), /* @__PURE__ */ jsxs("div", {
								className: "flex gap-2",
								children: [/* @__PURE__ */ jsx(Button, {
									variant: "outline",
									onClick: () => setStep("connect"),
									children: t("Back")
								}), /* @__PURE__ */ jsx(Button, {
									onClick: addPicked,
									disabled: pickedCount === 0 || adding,
									children: adding ? t("Adding…") : t("Add :count & continue", { count: pickedCount })
								})]
							})]
						})
					]
				}),
				step === "install" && /* @__PURE__ */ jsxs(Card, {
					className: "border-border/80 p-6",
					children: [
						/* @__PURE__ */ jsx("h1", {
							className: "text-xl font-semibold tracking-tight",
							children: t("Install on your site")
						}),
						/* @__PURE__ */ jsxs("p", {
							className: "mt-1 text-sm text-muted-foreground",
							children: [
								t("Paste this snippet just before"),
								" ",
								/* @__PURE__ */ jsx("code", { children: "</body>" }),
								".",
								" ",
								t("The widget loads in under 50\xA0KB.")
							]
						}),
						/* @__PURE__ */ jsx("div", {
							className: "mt-4 rounded-md border bg-muted/50 p-3 font-mono text-xs",
							children: snippet
						}),
						/* @__PURE__ */ jsx("div", {
							className: "mt-3 flex gap-2",
							children: /* @__PURE__ */ jsxs(Button, {
								variant: "outline",
								size: "sm",
								onClick: () => {
									navigator.clipboard.writeText(snippet);
								},
								children: [
									/* @__PURE__ */ jsx(Copy, { className: "size-4" }),
									" ",
									t("Copy snippet")
								]
							})
						}),
						/* @__PURE__ */ jsxs("div", {
							className: "mt-6 rounded-md border bg-muted/20 p-4",
							children: [/* @__PURE__ */ jsx("p", {
								className: "text-sm",
								children: agent.sources_count === 1 ? t(":indexed of :total page indexed.", {
									indexed: agent.sources_indexed,
									total: agent.sources_count
								}) : t(":indexed of :total pages indexed.", {
									indexed: agent.sources_indexed,
									total: agent.sources_count
								})
							}), agent.sources_indexed < agent.sources_count && /* @__PURE__ */ jsxs("p", {
								className: "mt-1 flex items-center gap-2 text-xs text-muted-foreground",
								children: [
									/* @__PURE__ */ jsx(Loader2, { className: "size-3 animate-spin" }),
									" ",
									t("Crawling in progress — refreshes every 3\xA0seconds.")
								]
							})]
						}),
						/* @__PURE__ */ jsxs("div", {
							className: "mt-4 flex justify-between",
							children: [/* @__PURE__ */ jsx(Button, {
								variant: "ghost",
								onClick: () => router.visit(index$15(agent.id).url),
								children: t("Add more sources")
							}), /* @__PURE__ */ jsxs(Button, {
								onClick: () => router.visit(dashboard$1().url),
								children: [
									/* @__PURE__ */ jsx(Check, { className: "size-4" }),
									" ",
									t("All set — go to dashboard")
								]
							})]
						})
					]
				})
			]
		})]
	});
}
function StepDot({ active, done, label }) {
	return /* @__PURE__ */ jsx("span", {
		className: `rounded-full px-3 py-1 ${done ? "bg-emerald-500/20 text-emerald-700 dark:text-emerald-400" : active ? "bg-foreground text-background" : "bg-muted text-muted-foreground"}`,
		children: label
	});
}
//#endregion
//#region resources/js/actions/App/Http/Controllers/Settings/WorkspaceApiTokenController.ts
/**
* @see \App\Http\Controllers\Settings\WorkspaceApiTokenController::index
* @see app/Http/Controllers/Settings/WorkspaceApiTokenController.php:35
* @route '/settings/api-tokens'
*/
var index$4 = (options) => ({
	url: index$4.url(options),
	method: "get"
});
index$4.definition = {
	methods: ["get", "head"],
	url: "/settings/api-tokens"
};
/**
* @see \App\Http\Controllers\Settings\WorkspaceApiTokenController::index
* @see app/Http/Controllers/Settings/WorkspaceApiTokenController.php:35
* @route '/settings/api-tokens'
*/
index$4.url = (options) => {
	return index$4.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Settings\WorkspaceApiTokenController::index
* @see app/Http/Controllers/Settings/WorkspaceApiTokenController.php:35
* @route '/settings/api-tokens'
*/
index$4.get = (options) => ({
	url: index$4.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Settings\WorkspaceApiTokenController::index
* @see app/Http/Controllers/Settings/WorkspaceApiTokenController.php:35
* @route '/settings/api-tokens'
*/
index$4.head = (options) => ({
	url: index$4.url(options),
	method: "head"
});
/**
* @see \App\Http\Controllers\Settings\WorkspaceApiTokenController::index
* @see app/Http/Controllers/Settings/WorkspaceApiTokenController.php:35
* @route '/settings/api-tokens'
*/
var indexForm$4 = (options) => ({
	action: index$4.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Settings\WorkspaceApiTokenController::index
* @see app/Http/Controllers/Settings/WorkspaceApiTokenController.php:35
* @route '/settings/api-tokens'
*/
indexForm$4.get = (options) => ({
	action: index$4.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Settings\WorkspaceApiTokenController::index
* @see app/Http/Controllers/Settings/WorkspaceApiTokenController.php:35
* @route '/settings/api-tokens'
*/
indexForm$4.head = (options) => ({
	action: index$4.url({ [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
index$4.form = indexForm$4;
/**
* @see \App\Http\Controllers\Settings\WorkspaceApiTokenController::store
* @see app/Http/Controllers/Settings/WorkspaceApiTokenController.php:53
* @route '/settings/api-tokens'
*/
var store$1 = (options) => ({
	url: store$1.url(options),
	method: "post"
});
store$1.definition = {
	methods: ["post"],
	url: "/settings/api-tokens"
};
/**
* @see \App\Http\Controllers\Settings\WorkspaceApiTokenController::store
* @see app/Http/Controllers/Settings/WorkspaceApiTokenController.php:53
* @route '/settings/api-tokens'
*/
store$1.url = (options) => {
	return store$1.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Settings\WorkspaceApiTokenController::store
* @see app/Http/Controllers/Settings/WorkspaceApiTokenController.php:53
* @route '/settings/api-tokens'
*/
store$1.post = (options) => ({
	url: store$1.url(options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Settings\WorkspaceApiTokenController::store
* @see app/Http/Controllers/Settings/WorkspaceApiTokenController.php:53
* @route '/settings/api-tokens'
*/
var storeForm$1 = (options) => ({
	action: store$1.url(options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Settings\WorkspaceApiTokenController::store
* @see app/Http/Controllers/Settings/WorkspaceApiTokenController.php:53
* @route '/settings/api-tokens'
*/
storeForm$1.post = (options) => ({
	action: store$1.url(options),
	method: "post"
});
store$1.form = storeForm$1;
/**
* @see \App\Http\Controllers\Settings\WorkspaceApiTokenController::destroy
* @see app/Http/Controllers/Settings/WorkspaceApiTokenController.php:105
* @route '/settings/api-tokens/{token}'
*/
var destroy$2 = (args, options) => ({
	url: destroy$2.url(args, options),
	method: "delete"
});
destroy$2.definition = {
	methods: ["delete"],
	url: "/settings/api-tokens/{token}"
};
/**
* @see \App\Http\Controllers\Settings\WorkspaceApiTokenController::destroy
* @see app/Http/Controllers/Settings/WorkspaceApiTokenController.php:105
* @route '/settings/api-tokens/{token}'
*/
destroy$2.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { token: args };
	if (typeof args === "object" && !Array.isArray(args) && "id" in args) args = { token: args.id };
	if (Array.isArray(args)) args = { token: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { token: typeof args.token === "object" ? args.token.id : args.token };
	return destroy$2.definition.url.replace("{token}", parsedArgs.token.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Settings\WorkspaceApiTokenController::destroy
* @see app/Http/Controllers/Settings/WorkspaceApiTokenController.php:105
* @route '/settings/api-tokens/{token}'
*/
destroy$2.delete = (args, options) => ({
	url: destroy$2.url(args, options),
	method: "delete"
});
/**
* @see \App\Http\Controllers\Settings\WorkspaceApiTokenController::destroy
* @see app/Http/Controllers/Settings/WorkspaceApiTokenController.php:105
* @route '/settings/api-tokens/{token}'
*/
var destroyForm$2 = (args, options) => ({
	action: destroy$2.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "DELETE",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
/**
* @see \App\Http\Controllers\Settings\WorkspaceApiTokenController::destroy
* @see app/Http/Controllers/Settings/WorkspaceApiTokenController.php:105
* @route '/settings/api-tokens/{token}'
*/
destroyForm$2.delete = (args, options) => ({
	action: destroy$2.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "DELETE",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
destroy$2.form = destroyForm$2;
/**
* @see \App\Http\Controllers\Settings\WorkspaceApiTokenController::forceDestroy
* @see app/Http/Controllers/Settings/WorkspaceApiTokenController.php:130
* @route '/settings/api-tokens/{token}/forget'
*/
var forceDestroy$1 = (args, options) => ({
	url: forceDestroy$1.url(args, options),
	method: "delete"
});
forceDestroy$1.definition = {
	methods: ["delete"],
	url: "/settings/api-tokens/{token}/forget"
};
/**
* @see \App\Http\Controllers\Settings\WorkspaceApiTokenController::forceDestroy
* @see app/Http/Controllers/Settings/WorkspaceApiTokenController.php:130
* @route '/settings/api-tokens/{token}/forget'
*/
forceDestroy$1.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { token: args };
	if (typeof args === "object" && !Array.isArray(args) && "id" in args) args = { token: args.id };
	if (Array.isArray(args)) args = { token: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { token: typeof args.token === "object" ? args.token.id : args.token };
	return forceDestroy$1.definition.url.replace("{token}", parsedArgs.token.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Settings\WorkspaceApiTokenController::forceDestroy
* @see app/Http/Controllers/Settings/WorkspaceApiTokenController.php:130
* @route '/settings/api-tokens/{token}/forget'
*/
forceDestroy$1.delete = (args, options) => ({
	url: forceDestroy$1.url(args, options),
	method: "delete"
});
/**
* @see \App\Http\Controllers\Settings\WorkspaceApiTokenController::forceDestroy
* @see app/Http/Controllers/Settings/WorkspaceApiTokenController.php:130
* @route '/settings/api-tokens/{token}/forget'
*/
var forceDestroyForm$1 = (args, options) => ({
	action: forceDestroy$1.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "DELETE",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
/**
* @see \App\Http\Controllers\Settings\WorkspaceApiTokenController::forceDestroy
* @see app/Http/Controllers/Settings/WorkspaceApiTokenController.php:130
* @route '/settings/api-tokens/{token}/forget'
*/
forceDestroyForm$1.delete = (args, options) => ({
	action: forceDestroy$1.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "DELETE",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
forceDestroy$1.form = forceDestroyForm$1;
/**
* @see \App\Http\Controllers\Settings\WorkspaceApiTokenController::purgeRevoked
* @see app/Http/Controllers/Settings/WorkspaceApiTokenController.php:164
* @route '/settings/api-tokens/purge-revoked'
*/
var purgeRevoked$1 = (options) => ({
	url: purgeRevoked$1.url(options),
	method: "post"
});
purgeRevoked$1.definition = {
	methods: ["post"],
	url: "/settings/api-tokens/purge-revoked"
};
/**
* @see \App\Http\Controllers\Settings\WorkspaceApiTokenController::purgeRevoked
* @see app/Http/Controllers/Settings/WorkspaceApiTokenController.php:164
* @route '/settings/api-tokens/purge-revoked'
*/
purgeRevoked$1.url = (options) => {
	return purgeRevoked$1.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Settings\WorkspaceApiTokenController::purgeRevoked
* @see app/Http/Controllers/Settings/WorkspaceApiTokenController.php:164
* @route '/settings/api-tokens/purge-revoked'
*/
purgeRevoked$1.post = (options) => ({
	url: purgeRevoked$1.url(options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Settings\WorkspaceApiTokenController::purgeRevoked
* @see app/Http/Controllers/Settings/WorkspaceApiTokenController.php:164
* @route '/settings/api-tokens/purge-revoked'
*/
var purgeRevokedForm$1 = (options) => ({
	action: purgeRevoked$1.url(options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Settings\WorkspaceApiTokenController::purgeRevoked
* @see app/Http/Controllers/Settings/WorkspaceApiTokenController.php:164
* @route '/settings/api-tokens/purge-revoked'
*/
purgeRevokedForm$1.post = (options) => ({
	action: purgeRevoked$1.url(options),
	method: "post"
});
purgeRevoked$1.form = purgeRevokedForm$1;
var WorkspaceApiTokenController = {
	index: index$4,
	store: store$1,
	destroy: destroy$2,
	forceDestroy: forceDestroy$1,
	purgeRevoked: purgeRevoked$1
};
//#endregion
//#region resources/js/components/heading.tsx
function Heading({ title, description, variant = "default" }) {
	return /* @__PURE__ */ jsxs("header", {
		className: variant === "small" ? "" : "mb-8 space-y-0.5",
		children: [/* @__PURE__ */ jsx("h2", {
			className: variant === "small" ? "mb-0.5 text-base font-medium" : "text-xl font-semibold tracking-tight",
			children: title
		}), description && /* @__PURE__ */ jsx("p", {
			className: "text-sm text-muted-foreground",
			children: description
		})]
	});
}
//#endregion
//#region resources/js/routes/settings/api-tokens/index.ts
/**
* @see \App\Http\Controllers\Settings\WorkspaceApiTokenController::index
* @see app/Http/Controllers/Settings/WorkspaceApiTokenController.php:35
* @route '/settings/api-tokens'
*/
var index$3 = (options) => ({
	url: index$3.url(options),
	method: "get"
});
index$3.definition = {
	methods: ["get", "head"],
	url: "/settings/api-tokens"
};
/**
* @see \App\Http\Controllers\Settings\WorkspaceApiTokenController::index
* @see app/Http/Controllers/Settings/WorkspaceApiTokenController.php:35
* @route '/settings/api-tokens'
*/
index$3.url = (options) => {
	return index$3.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Settings\WorkspaceApiTokenController::index
* @see app/Http/Controllers/Settings/WorkspaceApiTokenController.php:35
* @route '/settings/api-tokens'
*/
index$3.get = (options) => ({
	url: index$3.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Settings\WorkspaceApiTokenController::index
* @see app/Http/Controllers/Settings/WorkspaceApiTokenController.php:35
* @route '/settings/api-tokens'
*/
index$3.head = (options) => ({
	url: index$3.url(options),
	method: "head"
});
/**
* @see \App\Http\Controllers\Settings\WorkspaceApiTokenController::index
* @see app/Http/Controllers/Settings/WorkspaceApiTokenController.php:35
* @route '/settings/api-tokens'
*/
var indexForm$3 = (options) => ({
	action: index$3.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Settings\WorkspaceApiTokenController::index
* @see app/Http/Controllers/Settings/WorkspaceApiTokenController.php:35
* @route '/settings/api-tokens'
*/
indexForm$3.get = (options) => ({
	action: index$3.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Settings\WorkspaceApiTokenController::index
* @see app/Http/Controllers/Settings/WorkspaceApiTokenController.php:35
* @route '/settings/api-tokens'
*/
indexForm$3.head = (options) => ({
	action: index$3.url({ [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
index$3.form = indexForm$3;
/**
* @see \App\Http\Controllers\Settings\WorkspaceApiTokenController::store
* @see app/Http/Controllers/Settings/WorkspaceApiTokenController.php:53
* @route '/settings/api-tokens'
*/
var store = (options) => ({
	url: store.url(options),
	method: "post"
});
store.definition = {
	methods: ["post"],
	url: "/settings/api-tokens"
};
/**
* @see \App\Http\Controllers\Settings\WorkspaceApiTokenController::store
* @see app/Http/Controllers/Settings/WorkspaceApiTokenController.php:53
* @route '/settings/api-tokens'
*/
store.url = (options) => {
	return store.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Settings\WorkspaceApiTokenController::store
* @see app/Http/Controllers/Settings/WorkspaceApiTokenController.php:53
* @route '/settings/api-tokens'
*/
store.post = (options) => ({
	url: store.url(options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Settings\WorkspaceApiTokenController::store
* @see app/Http/Controllers/Settings/WorkspaceApiTokenController.php:53
* @route '/settings/api-tokens'
*/
var storeForm = (options) => ({
	action: store.url(options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Settings\WorkspaceApiTokenController::store
* @see app/Http/Controllers/Settings/WorkspaceApiTokenController.php:53
* @route '/settings/api-tokens'
*/
storeForm.post = (options) => ({
	action: store.url(options),
	method: "post"
});
store.form = storeForm;
/**
* @see \App\Http\Controllers\Settings\WorkspaceApiTokenController::destroy
* @see app/Http/Controllers/Settings/WorkspaceApiTokenController.php:105
* @route '/settings/api-tokens/{token}'
*/
var destroy$1 = (args, options) => ({
	url: destroy$1.url(args, options),
	method: "delete"
});
destroy$1.definition = {
	methods: ["delete"],
	url: "/settings/api-tokens/{token}"
};
/**
* @see \App\Http\Controllers\Settings\WorkspaceApiTokenController::destroy
* @see app/Http/Controllers/Settings/WorkspaceApiTokenController.php:105
* @route '/settings/api-tokens/{token}'
*/
destroy$1.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { token: args };
	if (typeof args === "object" && !Array.isArray(args) && "id" in args) args = { token: args.id };
	if (Array.isArray(args)) args = { token: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { token: typeof args.token === "object" ? args.token.id : args.token };
	return destroy$1.definition.url.replace("{token}", parsedArgs.token.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Settings\WorkspaceApiTokenController::destroy
* @see app/Http/Controllers/Settings/WorkspaceApiTokenController.php:105
* @route '/settings/api-tokens/{token}'
*/
destroy$1.delete = (args, options) => ({
	url: destroy$1.url(args, options),
	method: "delete"
});
/**
* @see \App\Http\Controllers\Settings\WorkspaceApiTokenController::destroy
* @see app/Http/Controllers/Settings/WorkspaceApiTokenController.php:105
* @route '/settings/api-tokens/{token}'
*/
var destroyForm$1 = (args, options) => ({
	action: destroy$1.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "DELETE",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
/**
* @see \App\Http\Controllers\Settings\WorkspaceApiTokenController::destroy
* @see app/Http/Controllers/Settings/WorkspaceApiTokenController.php:105
* @route '/settings/api-tokens/{token}'
*/
destroyForm$1.delete = (args, options) => ({
	action: destroy$1.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "DELETE",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
destroy$1.form = destroyForm$1;
/**
* @see \App\Http\Controllers\Settings\WorkspaceApiTokenController::forceDestroy
* @see app/Http/Controllers/Settings/WorkspaceApiTokenController.php:130
* @route '/settings/api-tokens/{token}/forget'
*/
var forceDestroy = (args, options) => ({
	url: forceDestroy.url(args, options),
	method: "delete"
});
forceDestroy.definition = {
	methods: ["delete"],
	url: "/settings/api-tokens/{token}/forget"
};
/**
* @see \App\Http\Controllers\Settings\WorkspaceApiTokenController::forceDestroy
* @see app/Http/Controllers/Settings/WorkspaceApiTokenController.php:130
* @route '/settings/api-tokens/{token}/forget'
*/
forceDestroy.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { token: args };
	if (typeof args === "object" && !Array.isArray(args) && "id" in args) args = { token: args.id };
	if (Array.isArray(args)) args = { token: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { token: typeof args.token === "object" ? args.token.id : args.token };
	return forceDestroy.definition.url.replace("{token}", parsedArgs.token.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Settings\WorkspaceApiTokenController::forceDestroy
* @see app/Http/Controllers/Settings/WorkspaceApiTokenController.php:130
* @route '/settings/api-tokens/{token}/forget'
*/
forceDestroy.delete = (args, options) => ({
	url: forceDestroy.url(args, options),
	method: "delete"
});
/**
* @see \App\Http\Controllers\Settings\WorkspaceApiTokenController::forceDestroy
* @see app/Http/Controllers/Settings/WorkspaceApiTokenController.php:130
* @route '/settings/api-tokens/{token}/forget'
*/
var forceDestroyForm = (args, options) => ({
	action: forceDestroy.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "DELETE",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
/**
* @see \App\Http\Controllers\Settings\WorkspaceApiTokenController::forceDestroy
* @see app/Http/Controllers/Settings/WorkspaceApiTokenController.php:130
* @route '/settings/api-tokens/{token}/forget'
*/
forceDestroyForm.delete = (args, options) => ({
	action: forceDestroy.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "DELETE",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
forceDestroy.form = forceDestroyForm;
/**
* @see \App\Http\Controllers\Settings\WorkspaceApiTokenController::purgeRevoked
* @see app/Http/Controllers/Settings/WorkspaceApiTokenController.php:164
* @route '/settings/api-tokens/purge-revoked'
*/
var purgeRevoked = (options) => ({
	url: purgeRevoked.url(options),
	method: "post"
});
purgeRevoked.definition = {
	methods: ["post"],
	url: "/settings/api-tokens/purge-revoked"
};
/**
* @see \App\Http\Controllers\Settings\WorkspaceApiTokenController::purgeRevoked
* @see app/Http/Controllers/Settings/WorkspaceApiTokenController.php:164
* @route '/settings/api-tokens/purge-revoked'
*/
purgeRevoked.url = (options) => {
	return purgeRevoked.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Settings\WorkspaceApiTokenController::purgeRevoked
* @see app/Http/Controllers/Settings/WorkspaceApiTokenController.php:164
* @route '/settings/api-tokens/purge-revoked'
*/
purgeRevoked.post = (options) => ({
	url: purgeRevoked.url(options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Settings\WorkspaceApiTokenController::purgeRevoked
* @see app/Http/Controllers/Settings/WorkspaceApiTokenController.php:164
* @route '/settings/api-tokens/purge-revoked'
*/
var purgeRevokedForm = (options) => ({
	action: purgeRevoked.url(options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Settings\WorkspaceApiTokenController::purgeRevoked
* @see app/Http/Controllers/Settings/WorkspaceApiTokenController.php:164
* @route '/settings/api-tokens/purge-revoked'
*/
purgeRevokedForm.post = (options) => ({
	action: purgeRevoked.url(options),
	method: "post"
});
purgeRevoked.form = purgeRevokedForm;
Object.assign(index$3, index$3), Object.assign(store, store), Object.assign(destroy$1, destroy$1), Object.assign(forceDestroy, forceDestroy), Object.assign(purgeRevoked, purgeRevoked);
//#endregion
//#region resources/js/pages/settings/api-tokens.tsx
var api_tokens_exports = /* @__PURE__ */ __exportAll({ default: () => ApiTokensPage });
function formatDate(value) {
	if (value === null) return "—";
	return new Date(value).toLocaleString();
}
function ApiTokensPage({ tokens, abilities, new_token }) {
	const { t } = useT();
	const confirm = useConfirm();
	const { flash } = usePage().props;
	const [copied, setCopied] = useState(false);
	const copy = async () => {
		if (new_token === null) return;
		await navigator.clipboard.writeText(new_token);
		setCopied(true);
		setTimeout(() => setCopied(false), 2e3);
	};
	return /* @__PURE__ */ jsxs(Fragment$1, { children: [
		/* @__PURE__ */ jsx(Head, { title: t("API tokens") }),
		/* @__PURE__ */ jsx("h1", {
			className: "sr-only",
			children: t("API tokens")
		}),
		/* @__PURE__ */ jsxs("div", {
			className: "space-y-6",
			children: [
				/* @__PURE__ */ jsx(Heading, {
					variant: "small",
					title: t("API tokens"),
					description: t("Workspace tokens authenticate first-party integrations like the WordPress plugin. Tokens carry only the abilities you grant them.")
				}),
				new_token !== null && /* @__PURE__ */ jsxs(Card, {
					className: "border-emerald-200 bg-emerald-50/60 p-4 dark:border-emerald-900/50 dark:bg-emerald-950/30",
					children: [
						/* @__PURE__ */ jsx("p", {
							className: "text-sm font-medium text-emerald-900 dark:text-emerald-100",
							children: t("Copy this token now")
						}),
						/* @__PURE__ */ jsx("p", {
							className: "mt-1 text-xs text-emerald-800/80 dark:text-emerald-100/70",
							children: t("For your security we only show the plaintext once. If you lose it, revoke and create a new one.")
						}),
						/* @__PURE__ */ jsxs("div", {
							className: "mt-3 flex items-center gap-2",
							children: [/* @__PURE__ */ jsx("code", {
								className: "flex-1 truncate rounded-md bg-background px-3 py-2 font-mono text-sm",
								children: new_token
							}), /* @__PURE__ */ jsxs(Button, {
								type: "button",
								variant: "secondary",
								size: "sm",
								onClick: copy,
								children: [/* @__PURE__ */ jsx(Copy, { className: "mr-1 h-3.5 w-3.5" }), copied ? t("Copied") : t("Copy")]
							})]
						})
					]
				}),
				flash?.success && new_token === null && /* @__PURE__ */ jsx("div", {
					className: "rounded-md border border-emerald-200 bg-emerald-50 px-3 py-2 text-sm text-emerald-900 dark:border-emerald-900/50 dark:bg-emerald-950/30 dark:text-emerald-100",
					children: flash.success
				}),
				/* @__PURE__ */ jsx(Card, {
					className: "border-border/80 p-5",
					children: /* @__PURE__ */ jsx(Form, {
						...WorkspaceApiTokenController.store.form(),
						options: { preserveScroll: true },
						resetOnSuccess: true,
						className: "grid gap-4",
						children: ({ processing, errors }) => /* @__PURE__ */ jsxs(Fragment$1, { children: [
							/* @__PURE__ */ jsxs("div", {
								className: "grid gap-1.5",
								children: [
									/* @__PURE__ */ jsx(Label, {
										htmlFor: "name",
										children: t("Name")
									}),
									/* @__PURE__ */ jsx(Input, {
										id: "name",
										name: "name",
										required: true,
										placeholder: t("e.g. WordPress: shop.example.com"),
										maxLength: 120
									}),
									/* @__PURE__ */ jsx(InputError, { message: errors.name })
								]
							}),
							/* @__PURE__ */ jsxs("div", {
								className: "grid gap-2",
								children: [
									/* @__PURE__ */ jsx(Label, { children: t("Abilities") }),
									abilities.map((ability) => /* @__PURE__ */ jsxs("div", {
										className: "flex items-start gap-3",
										children: [/* @__PURE__ */ jsx(Checkbox, {
											id: `ability-${ability}`,
											name: "abilities[]",
											value: ability,
											defaultChecked: true
										}), /* @__PURE__ */ jsx(Label, {
											htmlFor: `ability-${ability}`,
											className: "font-mono text-sm font-normal",
											children: ability
										})]
									}, ability)),
									/* @__PURE__ */ jsx(InputError, { message: errors["abilities"] })
								]
							}),
							/* @__PURE__ */ jsx("div", {
								className: "flex items-center justify-end gap-4 border-t pt-4",
								children: /* @__PURE__ */ jsx(Button, {
									disabled: processing,
									"data-test": "create-api-token-button",
									children: t("Create token")
								})
							})
						] })
					})
				}),
				/* @__PURE__ */ jsxs("div", {
					className: "space-y-3",
					children: [/* @__PURE__ */ jsxs("div", {
						className: "flex items-center justify-between gap-2",
						children: [/* @__PURE__ */ jsx("h2", {
							className: "text-sm font-semibold text-muted-foreground",
							children: t("Existing tokens")
						}), tokens.some((tk) => tk.revoked_at !== null) && /* @__PURE__ */ jsxs(Button, {
							type: "button",
							variant: "ghost",
							size: "sm",
							onClick: async () => {
								if (!await confirm({
									title: t("Purge revoked tokens?"),
									message: t("Permanently delete every revoked token in this workspace. Active tokens are kept."),
									confirmLabel: t("Purge"),
									danger: true
								})) return;
								router.post(WorkspaceApiTokenController.purgeRevoked.url(), {}, { preserveScroll: true });
							},
							children: [/* @__PURE__ */ jsx(Eraser, { className: "mr-1 h-3.5 w-3.5" }), t("Purge revoked")]
						})]
					}), tokens.length === 0 ? /* @__PURE__ */ jsx(Card, {
						className: "border-dashed p-6 text-center text-sm text-muted-foreground",
						children: t("No tokens yet.")
					}) : /* @__PURE__ */ jsx("div", {
						className: "grid gap-2",
						children: tokens.map((token) => /* @__PURE__ */ jsxs(Card, {
							className: "flex items-center gap-4 border-border/70 p-4",
							children: [/* @__PURE__ */ jsxs("div", {
								className: "flex-1 space-y-1",
								children: [
									/* @__PURE__ */ jsxs("div", {
										className: "flex items-center gap-2",
										children: [/* @__PURE__ */ jsx("p", {
											className: "font-medium",
											children: token.name
										}), token.revoked_at !== null && /* @__PURE__ */ jsx(Badge, {
											variant: "destructive",
											children: t("Revoked")
										})]
									}),
									/* @__PURE__ */ jsx("div", {
										className: "flex flex-wrap gap-1.5",
										children: token.abilities.map((ability) => /* @__PURE__ */ jsx(Badge, {
											variant: "secondary",
											className: "font-mono text-[10px]",
											children: ability
										}, ability))
									}),
									/* @__PURE__ */ jsxs("p", {
										className: "text-xs text-muted-foreground",
										children: [
											t("Created"),
											" ",
											formatDate(token.created_at),
											" · ",
											t("Last used"),
											" ",
											formatDate(token.last_used_at)
										]
									})
								]
							}), /* @__PURE__ */ jsxs("div", {
								className: "flex items-center gap-1",
								children: [token.revoked_at === null && /* @__PURE__ */ jsx(Form, {
									...WorkspaceApiTokenController.destroy.form(token.id),
									options: { preserveScroll: true },
									children: ({ processing }) => /* @__PURE__ */ jsxs(Button, {
										type: "submit",
										variant: "ghost",
										size: "sm",
										disabled: processing,
										onClick: async (e) => {
											e.preventDefault();
											const form = e.currentTarget.closest("form");
											if (!await confirm({
												title: t("Revoke token?"),
												message: t("Revoke this token? Integrations using it will stop working immediately."),
												confirmLabel: t("Revoke"),
												danger: true
											})) return;
											form?.requestSubmit();
										},
										children: [/* @__PURE__ */ jsx(Trash2, { className: "mr-1 h-3.5 w-3.5" }), t("Revoke")]
									})
								}), /* @__PURE__ */ jsxs(Button, {
									type: "button",
									variant: "ghost",
									size: "sm",
									onClick: async () => {
										if (!await confirm({
											title: t("Forget token?"),
											message: token.revoked_at === null ? t("This will revoke and then permanently delete the token. Anything using it stops working immediately. Continue?") : t("Permanently delete this revoked token? The row disappears from the list."),
											confirmLabel: t("Forget"),
											danger: true
										})) return;
										router.delete(WorkspaceApiTokenController.forceDestroy.url(token.id), { preserveScroll: true });
									},
									children: [/* @__PURE__ */ jsx(Eraser, { className: "mr-1 h-3.5 w-3.5" }), t("Forget")]
								})]
							})]
						}, token.id))
					})]
				})
			]
		})
	] });
}
ApiTokensPage.layout = { breadcrumbs: [{
	title: "API tokens",
	href: index$3()
}] };
//#endregion
//#region resources/js/components/appearance-tabs.tsx
function AppearanceToggleTab({ className = "", ...props }) {
	const { appearance, updateAppearance } = useAppearance();
	const { t } = useT();
	const tabs = [
		{
			value: "light",
			icon: Sun,
			label: t("Light")
		},
		{
			value: "dark",
			icon: Moon,
			label: t("Dark")
		},
		{
			value: "system",
			icon: Monitor,
			label: t("System")
		}
	];
	return /* @__PURE__ */ jsx("div", {
		className: cn("inline-flex gap-1 rounded-lg bg-neutral-100 p-1 dark:bg-neutral-800", className),
		...props,
		children: tabs.map(({ value, icon: Icon, label }) => /* @__PURE__ */ jsxs("button", {
			onClick: () => updateAppearance(value),
			className: cn("flex items-center rounded-md px-3.5 py-1.5 transition-colors", appearance === value ? "bg-white shadow-xs dark:bg-neutral-700 dark:text-neutral-100" : "text-neutral-500 hover:bg-neutral-200/60 hover:text-black dark:text-neutral-400 dark:hover:bg-neutral-700/60"),
			children: [/* @__PURE__ */ jsx(Icon, { className: "-ms-1 h-4 w-4" }), /* @__PURE__ */ jsx("span", {
				className: "ms-1.5 text-sm",
				children: label
			})]
		}, value))
	});
}
//#endregion
//#region resources/js/routes/appearance/index.ts
/**
* @see \Inertia\Controller::__invoke
* @see vendor/inertiajs/inertia-laravel/src/Controller.php:13
* @route '/settings/appearance'
*/
var edit$5 = (options) => ({
	url: edit$5.url(options),
	method: "get"
});
edit$5.definition = {
	methods: ["get", "head"],
	url: "/settings/appearance"
};
/**
* @see \Inertia\Controller::__invoke
* @see vendor/inertiajs/inertia-laravel/src/Controller.php:13
* @route '/settings/appearance'
*/
edit$5.url = (options) => {
	return edit$5.definition.url + queryParams(options);
};
/**
* @see \Inertia\Controller::__invoke
* @see vendor/inertiajs/inertia-laravel/src/Controller.php:13
* @route '/settings/appearance'
*/
edit$5.get = (options) => ({
	url: edit$5.url(options),
	method: "get"
});
/**
* @see \Inertia\Controller::__invoke
* @see vendor/inertiajs/inertia-laravel/src/Controller.php:13
* @route '/settings/appearance'
*/
edit$5.head = (options) => ({
	url: edit$5.url(options),
	method: "head"
});
/**
* @see \Inertia\Controller::__invoke
* @see vendor/inertiajs/inertia-laravel/src/Controller.php:13
* @route '/settings/appearance'
*/
var editForm$5 = (options) => ({
	action: edit$5.url(options),
	method: "get"
});
/**
* @see \Inertia\Controller::__invoke
* @see vendor/inertiajs/inertia-laravel/src/Controller.php:13
* @route '/settings/appearance'
*/
editForm$5.get = (options) => ({
	action: edit$5.url(options),
	method: "get"
});
/**
* @see \Inertia\Controller::__invoke
* @see vendor/inertiajs/inertia-laravel/src/Controller.php:13
* @route '/settings/appearance'
*/
editForm$5.head = (options) => ({
	action: edit$5.url({ [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
edit$5.form = editForm$5;
Object.assign(edit$5, edit$5);
//#endregion
//#region resources/js/pages/settings/appearance.tsx
var appearance_exports = /* @__PURE__ */ __exportAll({ default: () => Appearance });
function Appearance() {
	const { t } = useT();
	return /* @__PURE__ */ jsxs(Fragment$1, { children: [
		/* @__PURE__ */ jsx(Head, { title: t("Appearance settings") }),
		/* @__PURE__ */ jsx("h1", {
			className: "sr-only",
			children: t("Appearance settings")
		}),
		/* @__PURE__ */ jsxs("div", {
			className: "space-y-6",
			children: [/* @__PURE__ */ jsx(Heading, {
				variant: "small",
				title: t("Appearance settings"),
				description: t("Update your account's appearance settings")
			}), /* @__PURE__ */ jsx(AppearanceToggleTab, {})]
		})
	] });
}
Appearance.layout = { breadcrumbs: [{
	title: "Appearance settings",
	href: edit$5()
}] };
//#endregion
//#region resources/js/pages/settings/byok-keys.tsx
var byok_keys_exports = /* @__PURE__ */ __exportAll({ default: () => ByokKeysPage });
function ByokKeysPage({ has_keys, public_fields, global_byok_required }) {
	const { t } = useT();
	const confirm = useConfirm();
	const form = useForm({
		cloudflare_account_id: public_fields.cloudflare_account_id ?? "",
		cloudflare_api_token: "",
		cloudflare_vectorize_index: public_fields.cloudflare_vectorize_index ?? "",
		cloudflare_chat_model: public_fields.cloudflare_chat_model ?? "",
		cloudflare_embed_model: public_fields.cloudflare_embed_model ?? "",
		openai_api_key: "",
		openai_chat_model: public_fields.openai_chat_model ?? "",
		openai_embed_model: public_fields.openai_embed_model ?? "",
		openrouter_api_key: "",
		openrouter_chat_model: public_fields.openrouter_chat_model ?? "",
		qdrant_url: public_fields.qdrant_url ?? "",
		qdrant_api_key: "",
		qdrant_collection: public_fields.qdrant_collection ?? ""
	});
	const submit = (e) => {
		e.preventDefault();
		form.patch("/settings/byok-keys", { preserveScroll: true });
	};
	const clear = async (provider) => {
		if (!await confirm({
			title: t("Clear keys?"),
			message: t("Clear all keys for this provider?"),
			confirmLabel: t("Clear"),
			danger: true
		})) return;
		form.delete(`/settings/byok-keys/${provider}`, { preserveScroll: true });
	};
	return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Head, { title: t("API keys") }), /* @__PURE__ */ jsxs("div", {
		className: "space-y-6 p-4",
		children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("h1", {
			className: "text-2xl font-semibold",
			children: t("API keys (BYOK)")
		}), /* @__PURE__ */ jsx("p", {
			className: "text-sm text-muted-foreground",
			children: global_byok_required ? t("This deployment requires every workspace to supply its own AI provider keys. Pick whichever provider you want to use and drop the credentials below.") : t("BYOK is enabled for your workspace. Paste your own AI provider keys to take the chat off the operator’s shared infrastructure.")
		})] }), /* @__PURE__ */ jsxs("form", {
			onSubmit: submit,
			className: "space-y-6",
			children: [
				/* @__PURE__ */ jsxs(Card, { children: [
					/* @__PURE__ */ jsxs(CardHeader, { children: [/* @__PURE__ */ jsxs(CardTitle, {
						className: "flex items-center gap-2",
						children: [t("Cloudflare Workers AI"), has_keys.cloudflare ? /* @__PURE__ */ jsx(Badge, {
							variant: "default",
							children: t("configured")
						}) : /* @__PURE__ */ jsx(Badge, {
							variant: "outline",
							children: t("not set")
						})]
					}), /* @__PURE__ */ jsx(CardDescription, { children: t("Recommended. Same vendor for chat, embeddings, vector DB, browser rendering — single bill, lowest per-conversation cost.") })] }),
					/* @__PURE__ */ jsxs(CardContent, {
						className: "grid gap-4 sm:grid-cols-2",
						children: [
							/* @__PURE__ */ jsxs("div", {
								className: "grid gap-1.5",
								children: [/* @__PURE__ */ jsx(Label, {
									htmlFor: "cf-account",
									children: t("Account ID")
								}), /* @__PURE__ */ jsx(Input, {
									id: "cf-account",
									value: form.data.cloudflare_account_id,
									onChange: (e) => form.setData("cloudflare_account_id", e.target.value)
								})]
							}),
							/* @__PURE__ */ jsxs("div", {
								className: "grid gap-1.5",
								children: [/* @__PURE__ */ jsx(Label, {
									htmlFor: "cf-token",
									children: t("API token (write to set, blank to keep)")
								}), /* @__PURE__ */ jsx(Input, {
									id: "cf-token",
									type: "password",
									placeholder: "••••••••",
									value: form.data.cloudflare_api_token,
									onChange: (e) => form.setData("cloudflare_api_token", e.target.value)
								})]
							}),
							/* @__PURE__ */ jsxs("div", {
								className: "grid gap-1.5",
								children: [/* @__PURE__ */ jsx(Label, {
									htmlFor: "cf-vec",
									children: t("Vectorize index")
								}), /* @__PURE__ */ jsx(Input, {
									id: "cf-vec",
									placeholder: "pitchbar-chunks",
									value: form.data.cloudflare_vectorize_index,
									onChange: (e) => form.setData("cloudflare_vectorize_index", e.target.value)
								})]
							}),
							/* @__PURE__ */ jsxs("div", {
								className: "grid gap-1.5",
								children: [/* @__PURE__ */ jsx(Label, {
									htmlFor: "cf-chat",
									children: t("Chat model")
								}), /* @__PURE__ */ jsx(Input, {
									id: "cf-chat",
									placeholder: "@cf/meta/llama-3.3-70b-instruct-fp8-fast",
									value: form.data.cloudflare_chat_model,
									onChange: (e) => form.setData("cloudflare_chat_model", e.target.value)
								})]
							})
						]
					}),
					has_keys.cloudflare && /* @__PURE__ */ jsx(CardContent, {
						className: "pt-0",
						children: /* @__PURE__ */ jsx(Button, {
							type: "button",
							variant: "outline",
							size: "sm",
							onClick: () => clear("cloudflare"),
							children: t("Clear Cloudflare keys")
						})
					})
				] }),
				/* @__PURE__ */ jsxs(Card, { children: [
					/* @__PURE__ */ jsx(CardHeader, { children: /* @__PURE__ */ jsxs(CardTitle, {
						className: "flex items-center gap-2",
						children: [t("OpenAI"), has_keys.openai ? /* @__PURE__ */ jsx(Badge, {
							variant: "default",
							children: t("configured")
						}) : /* @__PURE__ */ jsx(Badge, {
							variant: "outline",
							children: t("not set")
						})]
					}) }),
					/* @__PURE__ */ jsxs(CardContent, {
						className: "grid gap-4 sm:grid-cols-2",
						children: [/* @__PURE__ */ jsxs("div", {
							className: "grid gap-1.5",
							children: [/* @__PURE__ */ jsx(Label, {
								htmlFor: "oa-key",
								children: t("API key")
							}), /* @__PURE__ */ jsx(Input, {
								id: "oa-key",
								type: "password",
								placeholder: "••••••••",
								value: form.data.openai_api_key,
								onChange: (e) => form.setData("openai_api_key", e.target.value)
							})]
						}), /* @__PURE__ */ jsxs("div", {
							className: "grid gap-1.5",
							children: [/* @__PURE__ */ jsx(Label, {
								htmlFor: "oa-chat",
								children: t("Chat model")
							}), /* @__PURE__ */ jsx(Input, {
								id: "oa-chat",
								placeholder: "gpt-4o-mini",
								value: form.data.openai_chat_model,
								onChange: (e) => form.setData("openai_chat_model", e.target.value)
							})]
						})]
					}),
					has_keys.openai && /* @__PURE__ */ jsx(CardContent, {
						className: "pt-0",
						children: /* @__PURE__ */ jsx(Button, {
							type: "button",
							variant: "outline",
							size: "sm",
							onClick: () => clear("openai"),
							children: t("Clear OpenAI keys")
						})
					})
				] }),
				/* @__PURE__ */ jsxs(Card, { children: [
					/* @__PURE__ */ jsxs(CardHeader, { children: [/* @__PURE__ */ jsxs(CardTitle, {
						className: "flex items-center gap-2",
						children: [t("Qdrant"), has_keys.qdrant ? /* @__PURE__ */ jsx(Badge, {
							variant: "default",
							children: t("configured")
						}) : /* @__PURE__ */ jsx(Badge, {
							variant: "outline",
							children: t("not set")
						})]
					}), /* @__PURE__ */ jsx(CardDescription, { children: t("Self-hosted vector store. Use this when you don’t want chunks to leave your infrastructure.") })] }),
					/* @__PURE__ */ jsxs(CardContent, {
						className: "grid gap-4 sm:grid-cols-2",
						children: [
							/* @__PURE__ */ jsxs("div", {
								className: "grid gap-1.5",
								children: [/* @__PURE__ */ jsx(Label, {
									htmlFor: "q-url",
									children: t("Qdrant URL")
								}), /* @__PURE__ */ jsx(Input, {
									id: "q-url",
									placeholder: "https://qdrant.example.com",
									value: form.data.qdrant_url,
									onChange: (e) => form.setData("qdrant_url", e.target.value)
								})]
							}),
							/* @__PURE__ */ jsxs("div", {
								className: "grid gap-1.5",
								children: [/* @__PURE__ */ jsx(Label, {
									htmlFor: "q-key",
									children: t("API key")
								}), /* @__PURE__ */ jsx(Input, {
									id: "q-key",
									type: "password",
									placeholder: "••••••••",
									value: form.data.qdrant_api_key,
									onChange: (e) => form.setData("qdrant_api_key", e.target.value)
								})]
							}),
							/* @__PURE__ */ jsxs("div", {
								className: "grid gap-1.5",
								children: [/* @__PURE__ */ jsx(Label, {
									htmlFor: "q-col",
									children: t("Collection")
								}), /* @__PURE__ */ jsx(Input, {
									id: "q-col",
									placeholder: "pitchbar_chunks",
									value: form.data.qdrant_collection,
									onChange: (e) => form.setData("qdrant_collection", e.target.value)
								})]
							})
						]
					}),
					has_keys.qdrant && /* @__PURE__ */ jsx(CardContent, {
						className: "pt-0",
						children: /* @__PURE__ */ jsx(Button, {
							type: "button",
							variant: "outline",
							size: "sm",
							onClick: () => clear("qdrant"),
							children: t("Clear Qdrant keys")
						})
					})
				] }),
				/* @__PURE__ */ jsx(Button, {
					type: "submit",
					disabled: form.processing,
					children: form.processing ? t("Saving…") : t("Save API keys")
				})
			]
		})]
	})] });
}
//#endregion
//#region resources/js/routes/locale/index.ts
/**
* @see \App\Http\Controllers\Settings\LocaleController::switchMethod
* @see app/Http/Controllers/Settings/LocaleController.php:24
* @route '/locale/switch'
*/
var switchMethod = (options) => ({
	url: switchMethod.url(options),
	method: "patch"
});
switchMethod.definition = {
	methods: ["patch"],
	url: "/locale/switch"
};
/**
* @see \App\Http\Controllers\Settings\LocaleController::switchMethod
* @see app/Http/Controllers/Settings/LocaleController.php:24
* @route '/locale/switch'
*/
switchMethod.url = (options) => {
	return switchMethod.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Settings\LocaleController::switchMethod
* @see app/Http/Controllers/Settings/LocaleController.php:24
* @route '/locale/switch'
*/
switchMethod.patch = (options) => ({
	url: switchMethod.url(options),
	method: "patch"
});
/**
* @see \App\Http\Controllers\Settings\LocaleController::switchMethod
* @see app/Http/Controllers/Settings/LocaleController.php:24
* @route '/locale/switch'
*/
var switchMethodForm = (options) => ({
	action: switchMethod.url({ [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "PATCH",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
/**
* @see \App\Http\Controllers\Settings\LocaleController::switchMethod
* @see app/Http/Controllers/Settings/LocaleController.php:24
* @route '/locale/switch'
*/
switchMethodForm.patch = (options) => ({
	action: switchMethod.url({ [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "PATCH",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
switchMethod.form = switchMethodForm;
/**
* @see \App\Http\Controllers\Settings\LocaleController::dismissSuggestion
* @see app/Http/Controllers/Settings/LocaleController.php:60
* @route '/locale/dismiss-suggestion'
*/
var dismissSuggestion = (options) => ({
	url: dismissSuggestion.url(options),
	method: "post"
});
dismissSuggestion.definition = {
	methods: ["post"],
	url: "/locale/dismiss-suggestion"
};
/**
* @see \App\Http\Controllers\Settings\LocaleController::dismissSuggestion
* @see app/Http/Controllers/Settings/LocaleController.php:60
* @route '/locale/dismiss-suggestion'
*/
dismissSuggestion.url = (options) => {
	return dismissSuggestion.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Settings\LocaleController::dismissSuggestion
* @see app/Http/Controllers/Settings/LocaleController.php:60
* @route '/locale/dismiss-suggestion'
*/
dismissSuggestion.post = (options) => ({
	url: dismissSuggestion.url(options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Settings\LocaleController::dismissSuggestion
* @see app/Http/Controllers/Settings/LocaleController.php:60
* @route '/locale/dismiss-suggestion'
*/
var dismissSuggestionForm = (options) => ({
	action: dismissSuggestion.url(options),
	method: "post"
});
/**
* @see \App\Http\Controllers\Settings\LocaleController::dismissSuggestion
* @see app/Http/Controllers/Settings/LocaleController.php:60
* @route '/locale/dismiss-suggestion'
*/
dismissSuggestionForm.post = (options) => ({
	action: dismissSuggestion.url(options),
	method: "post"
});
dismissSuggestion.form = dismissSuggestionForm;
/**
* @see \App\Http\Controllers\Settings\LocaleController::edit
* @see app/Http/Controllers/Settings/LocaleController.php:17
* @route '/settings/locale'
*/
var edit$4 = (options) => ({
	url: edit$4.url(options),
	method: "get"
});
edit$4.definition = {
	methods: ["get", "head"],
	url: "/settings/locale"
};
/**
* @see \App\Http\Controllers\Settings\LocaleController::edit
* @see app/Http/Controllers/Settings/LocaleController.php:17
* @route '/settings/locale'
*/
edit$4.url = (options) => {
	return edit$4.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Settings\LocaleController::edit
* @see app/Http/Controllers/Settings/LocaleController.php:17
* @route '/settings/locale'
*/
edit$4.get = (options) => ({
	url: edit$4.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Settings\LocaleController::edit
* @see app/Http/Controllers/Settings/LocaleController.php:17
* @route '/settings/locale'
*/
edit$4.head = (options) => ({
	url: edit$4.url(options),
	method: "head"
});
/**
* @see \App\Http\Controllers\Settings\LocaleController::edit
* @see app/Http/Controllers/Settings/LocaleController.php:17
* @route '/settings/locale'
*/
var editForm$4 = (options) => ({
	action: edit$4.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Settings\LocaleController::edit
* @see app/Http/Controllers/Settings/LocaleController.php:17
* @route '/settings/locale'
*/
editForm$4.get = (options) => ({
	action: edit$4.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Settings\LocaleController::edit
* @see app/Http/Controllers/Settings/LocaleController.php:17
* @route '/settings/locale'
*/
editForm$4.head = (options) => ({
	action: edit$4.url({ [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
edit$4.form = editForm$4;
/**
* @see \App\Http\Controllers\Settings\LocaleController::update
* @see app/Http/Controllers/Settings/LocaleController.php:24
* @route '/settings/locale'
*/
var update$3 = (options) => ({
	url: update$3.url(options),
	method: "patch"
});
update$3.definition = {
	methods: ["patch"],
	url: "/settings/locale"
};
/**
* @see \App\Http\Controllers\Settings\LocaleController::update
* @see app/Http/Controllers/Settings/LocaleController.php:24
* @route '/settings/locale'
*/
update$3.url = (options) => {
	return update$3.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Settings\LocaleController::update
* @see app/Http/Controllers/Settings/LocaleController.php:24
* @route '/settings/locale'
*/
update$3.patch = (options) => ({
	url: update$3.url(options),
	method: "patch"
});
/**
* @see \App\Http\Controllers\Settings\LocaleController::update
* @see app/Http/Controllers/Settings/LocaleController.php:24
* @route '/settings/locale'
*/
var updateForm$3 = (options) => ({
	action: update$3.url({ [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "PATCH",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
/**
* @see \App\Http\Controllers\Settings\LocaleController::update
* @see app/Http/Controllers/Settings/LocaleController.php:24
* @route '/settings/locale'
*/
updateForm$3.patch = (options) => ({
	action: update$3.url({ [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "PATCH",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
update$3.form = updateForm$3;
Object.assign(switchMethod, switchMethod), Object.assign(dismissSuggestion, dismissSuggestion), Object.assign(edit$4, edit$4), Object.assign(update$3, update$3);
//#endregion
//#region resources/js/pages/settings/locale.tsx
var locale_exports = /* @__PURE__ */ __exportAll({ default: () => Locale });
function Locale({ supported }) {
	const { t, locale } = useT();
	const { catalog } = useI18n();
	const [pickerOpen, setPickerOpen] = useState(false);
	const switchTo = (next) => {
		setPickerOpen(false);
		if (next === locale) return;
		router.patch("/locale/switch", { locale: next }, {
			preserveScroll: true,
			preserveState: false
		});
	};
	const flag = localeFlag(catalog, locale);
	const label = localeLabel(catalog, locale);
	const english = catalog[locale]?.english ?? locale;
	return /* @__PURE__ */ jsxs(Fragment$1, { children: [
		/* @__PURE__ */ jsx(Head, { title: t("Language") }),
		/* @__PURE__ */ jsx("h1", {
			className: "sr-only",
			children: t("Language")
		}),
		/* @__PURE__ */ jsxs("div", {
			className: "space-y-6",
			children: [/* @__PURE__ */ jsx(Heading, {
				variant: "small",
				title: t("Language"),
				description: t("Choose your language")
			}), /* @__PURE__ */ jsxs(Card, {
				className: "border-border/80 p-5",
				children: [/* @__PURE__ */ jsxs("div", {
					className: "flex items-center gap-4",
					children: [
						/* @__PURE__ */ jsx("span", {
							className: "text-3xl leading-none",
							"aria-hidden": true,
							children: flag
						}),
						/* @__PURE__ */ jsxs("div", {
							className: "flex-1",
							children: [/* @__PURE__ */ jsx("p", {
								className: "text-sm font-medium",
								children: label
							}), /* @__PURE__ */ jsxs("p", {
								className: "text-xs text-muted-foreground",
								children: [
									english,
									" ",
									/* @__PURE__ */ jsxs("span", {
										className: "tracking-widest uppercase",
										children: ["· ", locale]
									})
								]
							})]
						}),
						/* @__PURE__ */ jsx(Button, {
							type: "button",
							onClick: () => setPickerOpen(true),
							variant: "outline",
							children: t("Change language")
						})
					]
				}), /* @__PURE__ */ jsxs("p", {
					className: "mt-4 flex items-center gap-2 text-xs text-muted-foreground",
					children: [/* @__PURE__ */ jsx(Globe, { className: "h-3.5 w-3.5" }), t("Applies immediately. Affects only your account.")]
				})]
			})]
		}),
		/* @__PURE__ */ jsx(LocalePickerDialog, {
			open: pickerOpen,
			onOpenChange: setPickerOpen,
			locale,
			supported,
			catalog,
			onPick: switchTo
		})
	] });
}
Locale.layout = { breadcrumbs: [{
	title: "Language",
	href: edit$4()
}] };
//#endregion
//#region resources/js/pages/settings/marketing-content-editor.tsx
var marketing_content_editor_exports = /* @__PURE__ */ __exportAll({ default: () => MarketingContentEditor });
function useMarketingTabs() {
	const { t } = useT();
	return [
		{
			key: "brand",
			label: t("Brand & nav"),
			description: t("Header identity, resources link, and navigation items.")
		},
		{
			key: "hero",
			label: t("Hero"),
			description: t("Main headline, site-test form copy, and live demo notice.")
		},
		{
			key: "preview",
			label: t("Preview & video"),
			description: t("Chat preview card, headline stats, and walkthrough block.")
		},
		{
			key: "features",
			label: t("Feature sections"),
			description: t("Where-it-fits, feature grid, control area, and setup steps.")
		},
		{
			key: "closing",
			label: t("Closing sections"),
			description: t("Insights, testimonials, FAQ, and the final call to action.")
		},
		{
			key: "footer",
			label: t("Footer"),
			description: t("Footer description, socials, grouped links, legal links, and copyright.")
		}
	];
}
function cloneContent$1(content) {
	return JSON.parse(JSON.stringify(content));
}
function setNestedValue$1(source, path, value) {
	const draft = cloneContent$1(source);
	let cursor = draft;
	for (let index = 0; index < path.length - 1; index++) cursor = cursor[path[index]];
	cursor[path[path.length - 1]] = value;
	return draft;
}
function updateNestedList(source, path, updater) {
	const draft = cloneContent$1(source);
	let cursor = draft;
	for (let index = 0; index < path.length - 1; index++) cursor = cursor[path[index]];
	const key = path[path.length - 1];
	const current = Array.isArray(cursor[key]) ? cursor[key] : [];
	cursor[key] = updater(current);
	return draft;
}
function stringListToText$1(values) {
	return values.join("\n");
}
function textToStringList$1(value) {
	return value.split("\n").map((item) => item.trim()).filter((item) => item.length > 0);
}
function numberListToText(values) {
	return values.join(", ");
}
function textToNumberList(value) {
	return value.split(/[\n,]+/).map((item) => Number(item.trim())).filter((item) => Number.isFinite(item));
}
function blankLink() {
	return {
		label: "",
		href: ""
	};
}
function blankIconCard() {
	return {
		icon: "Sparkles",
		title: "",
		description: ""
	};
}
function blankStat() {
	return {
		icon: "Sparkles",
		value: "",
		label: ""
	};
}
function blankSettingRow() {
	return {
		label: "",
		hint: "",
		value: ""
	};
}
function blankTestimonial() {
	return {
		name: "",
		role: "",
		company: "",
		quote: "",
		avatar: null
	};
}
function blankFaq() {
	return {
		question: "",
		answer: ""
	};
}
function blankFooterGroup() {
	return {
		title: "",
		links: [blankLink()]
	};
}
function EditorSection({ title, description, children }) {
	return /* @__PURE__ */ jsxs(Card, {
		className: "border-border/80 p-5",
		children: [/* @__PURE__ */ jsxs("div", {
			className: "space-y-1",
			children: [/* @__PURE__ */ jsx("h3", {
				className: "font-semibold",
				children: title
			}), /* @__PURE__ */ jsx("p", {
				className: "text-xs text-muted-foreground",
				children: description
			})]
		}), /* @__PURE__ */ jsx("div", {
			className: "mt-4 space-y-4",
			children
		})]
	});
}
function FieldRow({ children }) {
	return /* @__PURE__ */ jsx("div", {
		className: "grid gap-4 md:grid-cols-2",
		children
	});
}
function StringListField({ id, label, value, onChange, help }) {
	return /* @__PURE__ */ jsxs("div", {
		className: "grid gap-1.5",
		children: [
			/* @__PURE__ */ jsx(Label, {
				htmlFor: id,
				children: label
			}),
			/* @__PURE__ */ jsx(Textarea, {
				id,
				value: stringListToText$1(value),
				onChange: (event) => onChange(textToStringList$1(event.target.value)),
				className: "min-h-28"
			}),
			help && /* @__PURE__ */ jsx("p", {
				className: "text-xs text-muted-foreground",
				children: help
			})
		]
	});
}
function NumberListField({ id, label, value, onChange, help }) {
	return /* @__PURE__ */ jsxs("div", {
		className: "grid gap-1.5",
		children: [
			/* @__PURE__ */ jsx(Label, {
				htmlFor: id,
				children: label
			}),
			/* @__PURE__ */ jsx(Textarea, {
				id,
				value: numberListToText(value),
				onChange: (event) => onChange(textToNumberList(event.target.value)),
				className: "min-h-24"
			}),
			help && /* @__PURE__ */ jsx("p", {
				className: "text-xs text-muted-foreground",
				children: help
			})
		]
	});
}
function LinkListEditor({ title, items, onChange, addLabel }) {
	const { t } = useT();
	const keyed = items.map((item, index) => ({
		item,
		key: String(index)
	}));
	return /* @__PURE__ */ jsxs("div", {
		className: "space-y-3",
		children: [
			/* @__PURE__ */ jsxs("div", {
				className: "flex items-center justify-between gap-3",
				children: [/* @__PURE__ */ jsx("p", {
					className: "text-sm font-medium",
					children: title
				}), /* @__PURE__ */ jsxs(Button, {
					type: "button",
					size: "sm",
					variant: "outline",
					onClick: () => onChange([...items, blankLink()]),
					children: [/* @__PURE__ */ jsx(Plus, { className: "size-3.5" }), addLabel ?? t("Add link")]
				})]
			}),
			items.length === 0 && /* @__PURE__ */ jsx("p", {
				className: "rounded-md border border-dashed border-border/70 px-3 py-4 text-center text-xs text-muted-foreground",
				children: t("No links — this section will be hidden on the public site until you add one.")
			}),
			items.length > 0 && /* @__PURE__ */ jsx(SortableList, {
				items: keyed,
				keyOf: (entry) => entry.key,
				onReorder: (orderedIds) => {
					onChange(orderedIds.map((id) => items[Number(id)]).filter((it) => Boolean(it)));
				},
				children: (entry) => {
					const index = Number(entry.key);
					return /* @__PURE__ */ jsx(Card, {
						className: "border-border/70 p-4",
						children: /* @__PURE__ */ jsxs("div", {
							className: "grid gap-3 md:grid-cols-[1fr_1fr_auto] md:items-end",
							children: [
								/* @__PURE__ */ jsxs("div", {
									className: "grid gap-1",
									children: [/* @__PURE__ */ jsx(Label, {
										htmlFor: `${title}-label-${index}`,
										children: t("Label")
									}), /* @__PURE__ */ jsx(Input, {
										id: `${title}-label-${index}`,
										value: entry.item.label,
										onChange: (event) => onChange(items.map((current, currentIndex) => currentIndex === index ? {
											...current,
											label: event.target.value
										} : current))
									})]
								}),
								/* @__PURE__ */ jsxs("div", {
									className: "grid gap-1",
									children: [/* @__PURE__ */ jsx(Label, {
										htmlFor: `${title}-href-${index}`,
										children: t("Href")
									}), /* @__PURE__ */ jsx(Input, {
										id: `${title}-href-${index}`,
										value: entry.item.href,
										onChange: (event) => onChange(items.map((current, currentIndex) => currentIndex === index ? {
											...current,
											href: event.target.value
										} : current))
									})]
								}),
								/* @__PURE__ */ jsxs(Button, {
									type: "button",
									variant: "ghost",
									size: "sm",
									onClick: () => onChange(items.filter((_, currentIndex) => currentIndex !== index)),
									children: [/* @__PURE__ */ jsx(Trash2, { className: "size-3.5" }), t("Remove")]
								})
							]
						})
					});
				}
			})
		]
	});
}
function IconCardListEditor({ title, items, onChange, addLabel }) {
	const { t } = useT();
	return /* @__PURE__ */ jsxs("div", {
		className: "space-y-3",
		children: [/* @__PURE__ */ jsxs("div", {
			className: "flex items-center justify-between gap-3",
			children: [/* @__PURE__ */ jsx("p", {
				className: "text-sm font-medium",
				children: title
			}), /* @__PURE__ */ jsxs(Button, {
				type: "button",
				size: "sm",
				variant: "outline",
				onClick: () => onChange([...items, blankIconCard()]),
				children: [/* @__PURE__ */ jsx(Plus, { className: "size-3.5" }), addLabel]
			})]
		}), items.map((item, index) => /* @__PURE__ */ jsx(Card, {
			className: "border-border/70 p-4",
			children: /* @__PURE__ */ jsxs("div", {
				className: "grid gap-3 md:grid-cols-[160px_1fr_auto] md:items-end",
				children: [
					/* @__PURE__ */ jsxs("div", {
						className: "grid gap-1",
						children: [/* @__PURE__ */ jsx(Label, {
							htmlFor: `${title}-icon-${index}`,
							children: t("Icon")
						}), /* @__PURE__ */ jsx(Input, {
							id: `${title}-icon-${index}`,
							value: item.icon,
							onChange: (event) => onChange(items.map((current, currentIndex) => currentIndex === index ? {
								...current,
								icon: event.target.value
							} : current))
						})]
					}),
					/* @__PURE__ */ jsxs("div", {
						className: "grid gap-3",
						children: [/* @__PURE__ */ jsxs("div", {
							className: "grid gap-1",
							children: [/* @__PURE__ */ jsx(Label, {
								htmlFor: `${title}-title-${index}`,
								children: t("Title")
							}), /* @__PURE__ */ jsx(Input, {
								id: `${title}-title-${index}`,
								value: item.title,
								onChange: (event) => onChange(items.map((current, currentIndex) => currentIndex === index ? {
									...current,
									title: event.target.value
								} : current))
							})]
						}), /* @__PURE__ */ jsxs("div", {
							className: "grid gap-1",
							children: [/* @__PURE__ */ jsx(Label, {
								htmlFor: `${title}-description-${index}`,
								children: t("Description")
							}), /* @__PURE__ */ jsx(Textarea, {
								id: `${title}-description-${index}`,
								value: item.description,
								onChange: (event) => onChange(items.map((current, currentIndex) => currentIndex === index ? {
									...current,
									description: event.target.value
								} : current))
							})]
						})]
					}),
					/* @__PURE__ */ jsxs(Button, {
						type: "button",
						variant: "ghost",
						size: "sm",
						onClick: () => onChange(items.filter((_, currentIndex) => currentIndex !== index)),
						disabled: items.length === 1,
						children: [/* @__PURE__ */ jsx(Trash2, { className: "size-3.5" }), t("Remove")]
					})
				]
			})
		}, `${title}-${index}`))]
	});
}
function TestimonialListEditor({ items, onChange }) {
	const { t } = useT();
	const update = (index, patch) => {
		onChange(items.map((current, currentIndex) => currentIndex === index ? {
			...current,
			...patch
		} : current));
	};
	return /* @__PURE__ */ jsxs("div", {
		className: "space-y-3",
		children: [/* @__PURE__ */ jsxs("div", {
			className: "flex items-center justify-between gap-3",
			children: [/* @__PURE__ */ jsx("p", {
				className: "text-sm font-medium",
				children: t("Quotes")
			}), /* @__PURE__ */ jsxs(Button, {
				type: "button",
				size: "sm",
				variant: "outline",
				onClick: () => onChange([...items, blankTestimonial()]),
				children: [/* @__PURE__ */ jsx(Plus, { className: "size-3.5" }), t("Add testimonial")]
			})]
		}), items.map((item, index) => /* @__PURE__ */ jsxs(Card, {
			className: "space-y-3 border-border/70 p-4",
			children: [
				/* @__PURE__ */ jsxs("div", {
					className: "grid gap-3 md:grid-cols-3",
					children: [
						/* @__PURE__ */ jsxs("div", {
							className: "grid gap-1",
							children: [/* @__PURE__ */ jsx(Label, {
								htmlFor: `testimonial-name-${index}`,
								children: t("Name")
							}), /* @__PURE__ */ jsx(Input, {
								id: `testimonial-name-${index}`,
								value: item.name,
								onChange: (event) => update(index, { name: event.target.value })
							})]
						}),
						/* @__PURE__ */ jsxs("div", {
							className: "grid gap-1",
							children: [/* @__PURE__ */ jsx(Label, {
								htmlFor: `testimonial-role-${index}`,
								children: t("Role")
							}), /* @__PURE__ */ jsx(Input, {
								id: `testimonial-role-${index}`,
								value: item.role,
								onChange: (event) => update(index, { role: event.target.value })
							})]
						}),
						/* @__PURE__ */ jsxs("div", {
							className: "grid gap-1",
							children: [/* @__PURE__ */ jsx(Label, {
								htmlFor: `testimonial-company-${index}`,
								children: t("Company")
							}), /* @__PURE__ */ jsx(Input, {
								id: `testimonial-company-${index}`,
								value: item.company,
								onChange: (event) => update(index, { company: event.target.value })
							})]
						})
					]
				}),
				/* @__PURE__ */ jsxs("div", {
					className: "grid gap-1",
					children: [/* @__PURE__ */ jsx(Label, {
						htmlFor: `testimonial-quote-${index}`,
						children: t("Quote")
					}), /* @__PURE__ */ jsx(Textarea, {
						id: `testimonial-quote-${index}`,
						value: item.quote,
						rows: 3,
						onChange: (event) => update(index, { quote: event.target.value })
					})]
				}),
				/* @__PURE__ */ jsxs("div", {
					className: "grid gap-3 md:grid-cols-[1fr_auto] md:items-end",
					children: [/* @__PURE__ */ jsxs("div", {
						className: "grid gap-1",
						children: [/* @__PURE__ */ jsx(Label, {
							htmlFor: `testimonial-avatar-${index}`,
							children: t("Avatar URL (optional)")
						}), /* @__PURE__ */ jsx(Input, {
							id: `testimonial-avatar-${index}`,
							value: item.avatar ?? "",
							onChange: (event) => update(index, { avatar: event.target.value === "" ? null : event.target.value }),
							placeholder: "https://…/face.jpg"
						})]
					}), /* @__PURE__ */ jsxs(Button, {
						type: "button",
						variant: "ghost",
						size: "sm",
						onClick: () => onChange(items.filter((_, currentIndex) => currentIndex !== index)),
						children: [/* @__PURE__ */ jsx(Trash2, { className: "size-3.5" }), t("Remove")]
					})]
				})
			]
		}, `testimonial-${index}`))]
	});
}
function FaqListEditor({ items, onChange }) {
	const { t } = useT();
	const update = (index, patch) => {
		onChange(items.map((current, currentIndex) => currentIndex === index ? {
			...current,
			...patch
		} : current));
	};
	return /* @__PURE__ */ jsxs("div", {
		className: "space-y-3",
		children: [/* @__PURE__ */ jsxs("div", {
			className: "flex items-center justify-between gap-3",
			children: [/* @__PURE__ */ jsx("p", {
				className: "text-sm font-medium",
				children: t("Q&A items")
			}), /* @__PURE__ */ jsxs(Button, {
				type: "button",
				size: "sm",
				variant: "outline",
				onClick: () => onChange([...items, blankFaq()]),
				children: [/* @__PURE__ */ jsx(Plus, { className: "size-3.5" }), t("Add FAQ")]
			})]
		}), items.map((item, index) => /* @__PURE__ */ jsxs(Card, {
			className: "space-y-3 border-border/70 p-4",
			children: [
				/* @__PURE__ */ jsxs("div", {
					className: "grid gap-1",
					children: [/* @__PURE__ */ jsx(Label, {
						htmlFor: `faq-question-${index}`,
						children: t("Question")
					}), /* @__PURE__ */ jsx(Input, {
						id: `faq-question-${index}`,
						value: item.question,
						onChange: (event) => update(index, { question: event.target.value })
					})]
				}),
				/* @__PURE__ */ jsxs("div", {
					className: "grid gap-1",
					children: [/* @__PURE__ */ jsx(Label, {
						htmlFor: `faq-answer-${index}`,
						children: t("Answer")
					}), /* @__PURE__ */ jsx(Textarea, {
						id: `faq-answer-${index}`,
						value: item.answer,
						rows: 3,
						onChange: (event) => update(index, { answer: event.target.value })
					})]
				}),
				/* @__PURE__ */ jsx("div", {
					className: "flex justify-end",
					children: /* @__PURE__ */ jsxs(Button, {
						type: "button",
						variant: "ghost",
						size: "sm",
						onClick: () => onChange(items.filter((_, currentIndex) => currentIndex !== index)),
						children: [/* @__PURE__ */ jsx(Trash2, { className: "size-3.5" }), t("Remove")]
					})
				})
			]
		}, `faq-${index}`))]
	});
}
function StatsEditor({ items, onChange }) {
	const { t } = useT();
	return /* @__PURE__ */ jsxs("div", {
		className: "space-y-3",
		children: [/* @__PURE__ */ jsxs("div", {
			className: "flex items-center justify-between gap-3",
			children: [/* @__PURE__ */ jsx("p", {
				className: "text-sm font-medium",
				children: t("Stats")
			}), /* @__PURE__ */ jsxs(Button, {
				type: "button",
				size: "sm",
				variant: "outline",
				onClick: () => onChange([...items, blankStat()]),
				children: [/* @__PURE__ */ jsx(Plus, { className: "size-3.5" }), t("Add stat")]
			})]
		}), items.map((item, index) => /* @__PURE__ */ jsx(Card, {
			className: "border-border/70 p-4",
			children: /* @__PURE__ */ jsxs("div", {
				className: "grid gap-3 md:grid-cols-[140px_120px_1fr_auto] md:items-end",
				children: [
					/* @__PURE__ */ jsxs("div", {
						className: "grid gap-1",
						children: [/* @__PURE__ */ jsx(Label, {
							htmlFor: `stat-icon-${index}`,
							children: t("Icon")
						}), /* @__PURE__ */ jsx(Input, {
							id: `stat-icon-${index}`,
							value: item.icon,
							onChange: (event) => onChange(items.map((current, currentIndex) => currentIndex === index ? {
								...current,
								icon: event.target.value
							} : current))
						})]
					}),
					/* @__PURE__ */ jsxs("div", {
						className: "grid gap-1",
						children: [/* @__PURE__ */ jsx(Label, {
							htmlFor: `stat-value-${index}`,
							children: t("Value")
						}), /* @__PURE__ */ jsx(Input, {
							id: `stat-value-${index}`,
							value: item.value,
							onChange: (event) => onChange(items.map((current, currentIndex) => currentIndex === index ? {
								...current,
								value: event.target.value
							} : current))
						})]
					}),
					/* @__PURE__ */ jsxs("div", {
						className: "grid gap-1",
						children: [/* @__PURE__ */ jsx(Label, {
							htmlFor: `stat-label-${index}`,
							children: t("Label")
						}), /* @__PURE__ */ jsx(Input, {
							id: `stat-label-${index}`,
							value: item.label,
							onChange: (event) => onChange(items.map((current, currentIndex) => currentIndex === index ? {
								...current,
								label: event.target.value
							} : current))
						})]
					}),
					/* @__PURE__ */ jsxs(Button, {
						type: "button",
						variant: "ghost",
						size: "sm",
						onClick: () => onChange(items.filter((_, currentIndex) => currentIndex !== index)),
						disabled: items.length === 1,
						children: [/* @__PURE__ */ jsx(Trash2, { className: "size-3.5" }), t("Remove")]
					})
				]
			})
		}, `stat-${index}`))]
	});
}
function SettingRowsEditor({ rows, onChange }) {
	const { t } = useT();
	return /* @__PURE__ */ jsxs("div", {
		className: "space-y-3",
		children: [/* @__PURE__ */ jsxs("div", {
			className: "flex items-center justify-between gap-3",
			children: [/* @__PURE__ */ jsx("p", {
				className: "text-sm font-medium",
				children: t("Settings rows")
			}), /* @__PURE__ */ jsxs(Button, {
				type: "button",
				size: "sm",
				variant: "outline",
				onClick: () => onChange([...rows, blankSettingRow()]),
				children: [/* @__PURE__ */ jsx(Plus, { className: "size-3.5" }), t("Add row")]
			})]
		}), rows.map((row, index) => /* @__PURE__ */ jsxs(Card, {
			className: "border-border/70 p-4",
			children: [/* @__PURE__ */ jsxs("div", {
				className: "grid gap-3 md:grid-cols-[1fr_1fr_auto] md:items-end",
				children: [
					/* @__PURE__ */ jsxs("div", {
						className: "grid gap-1",
						children: [/* @__PURE__ */ jsx(Label, {
							htmlFor: `setting-row-label-${index}`,
							children: t("Label")
						}), /* @__PURE__ */ jsx(Input, {
							id: `setting-row-label-${index}`,
							value: row.label,
							onChange: (event) => onChange(rows.map((current, currentIndex) => currentIndex === index ? {
								...current,
								label: event.target.value
							} : current))
						})]
					}),
					/* @__PURE__ */ jsxs("div", {
						className: "grid gap-1",
						children: [/* @__PURE__ */ jsx(Label, {
							htmlFor: `setting-row-hint-${index}`,
							children: t("Hint")
						}), /* @__PURE__ */ jsx(Input, {
							id: `setting-row-hint-${index}`,
							value: row.hint,
							onChange: (event) => onChange(rows.map((current, currentIndex) => currentIndex === index ? {
								...current,
								hint: event.target.value
							} : current))
						})]
					}),
					/* @__PURE__ */ jsxs(Button, {
						type: "button",
						variant: "ghost",
						size: "sm",
						onClick: () => onChange(rows.filter((_, currentIndex) => currentIndex !== index)),
						disabled: rows.length === 1,
						children: [/* @__PURE__ */ jsx(Trash2, { className: "size-3.5" }), t("Remove")]
					})
				]
			}), /* @__PURE__ */ jsxs("div", {
				className: "mt-3 grid gap-1",
				children: [/* @__PURE__ */ jsx(Label, {
					htmlFor: `setting-row-value-${index}`,
					children: t("Value")
				}), /* @__PURE__ */ jsx(Textarea, {
					id: `setting-row-value-${index}`,
					value: row.value,
					onChange: (event) => onChange(rows.map((current, currentIndex) => currentIndex === index ? {
						...current,
						value: event.target.value
					} : current))
				})]
			})]
		}, `setting-row-${index}`))]
	});
}
function FooterGroupsEditor({ groups, onChange }) {
	const { t } = useT();
	return /* @__PURE__ */ jsxs("div", {
		className: "space-y-3",
		children: [/* @__PURE__ */ jsxs("div", {
			className: "flex items-center justify-between gap-3",
			children: [/* @__PURE__ */ jsx("p", {
				className: "text-sm font-medium",
				children: t("Footer groups")
			}), /* @__PURE__ */ jsxs(Button, {
				type: "button",
				size: "sm",
				variant: "outline",
				onClick: () => onChange([...groups, blankFooterGroup()]),
				children: [/* @__PURE__ */ jsx(Plus, { className: "size-3.5" }), t("Add group")]
			})]
		}), groups.map((group, index) => /* @__PURE__ */ jsxs(Card, {
			className: "border-border/70 p-4",
			children: [/* @__PURE__ */ jsxs("div", {
				className: "grid gap-3 md:grid-cols-[1fr_auto] md:items-end",
				children: [/* @__PURE__ */ jsxs("div", {
					className: "grid gap-1",
					children: [/* @__PURE__ */ jsx(Label, {
						htmlFor: `footer-group-title-${index}`,
						children: t("Group title")
					}), /* @__PURE__ */ jsx(Input, {
						id: `footer-group-title-${index}`,
						value: group.title,
						onChange: (event) => onChange(groups.map((current, currentIndex) => currentIndex === index ? {
							...current,
							title: event.target.value
						} : current))
					})]
				}), /* @__PURE__ */ jsxs(Button, {
					type: "button",
					variant: "ghost",
					size: "sm",
					onClick: () => onChange(groups.filter((_, currentIndex) => currentIndex !== index)),
					disabled: groups.length === 1,
					children: [/* @__PURE__ */ jsx(Trash2, { className: "size-3.5" }), t("Remove")]
				})]
			}), /* @__PURE__ */ jsx("div", {
				className: "mt-4",
				children: /* @__PURE__ */ jsx(LinkListEditor, {
					title: t("Links"),
					items: group.links,
					onChange: (links) => onChange(groups.map((current, currentIndex) => currentIndex === index ? {
						...current,
						links
					} : current)),
					addLabel: t("Add group link")
				})
			})]
		}, `footer-group-${index}`))]
	});
}
function MarketingContentEditor({ initial }) {
	const { t } = useT();
	const MARKETING_TABS = useMarketingTabs();
	const form = useForm({ marketing_home_content: initial });
	const [activeTab, setActiveTab] = useState("brand");
	const content = form.data.marketing_home_content;
	const activeTabMeta = MARKETING_TABS.find((tab) => tab.key === activeTab) ?? MARKETING_TABS[0];
	const setField = (path, value) => {
		form.setData("marketing_home_content", setNestedValue$1(content, path, value));
	};
	const setList = (path, items) => {
		form.setData("marketing_home_content", updateNestedList(content, path, () => items));
	};
	const submit = (event) => {
		event.preventDefault();
		form.patch(update$19.url("marketing"), { preserveScroll: true });
	};
	const switchTab = (tab) => {
		setActiveTab(tab);
	};
	return /* @__PURE__ */ jsxs("form", {
		onSubmit: submit,
		className: "space-y-6",
		children: [
			/* @__PURE__ */ jsxs("div", {
				className: "space-y-3",
				children: [/* @__PURE__ */ jsx("div", {
					className: "overflow-x-auto pb-1",
					children: /* @__PURE__ */ jsx("div", {
						className: "inline-flex min-w-full gap-2 rounded-2xl border border-border/80 bg-muted/15 p-1.5",
						children: MARKETING_TABS.map((tab) => {
							return /* @__PURE__ */ jsx("button", {
								type: "button",
								onClick: () => switchTab(tab.key),
								className: cn("rounded-xl px-4 py-2 text-sm font-medium whitespace-nowrap transition", tab.key === activeTab ? "bg-background text-foreground shadow-sm ring-1 ring-border/80" : "text-muted-foreground hover:bg-background/70 hover:text-foreground"),
								children: tab.label
							}, tab.key);
						})
					})
				}), /* @__PURE__ */ jsxs("div", {
					className: "rounded-2xl border border-border/80 bg-muted/15 px-4 py-3",
					children: [
						/* @__PURE__ */ jsx("p", {
							className: "text-[11px] font-semibold tracking-[0.16em] text-muted-foreground uppercase",
							children: t("Editing tab")
						}),
						/* @__PURE__ */ jsx("h3", {
							className: "mt-1 text-sm font-semibold",
							children: activeTabMeta.label
						}),
						/* @__PURE__ */ jsx("p", {
							className: "mt-1 text-xs leading-5 text-muted-foreground",
							children: activeTabMeta.description
						})
					]
				})]
			}),
			activeTab === "brand" && /* @__PURE__ */ jsxs(EditorSection, {
				title: t("Brand and navigation"),
				description: t("Manage the header brand name, resources link, and the navigation items shown across the landing page."),
				children: [
					/* @__PURE__ */ jsxs(FieldRow, { children: [/* @__PURE__ */ jsxs("div", {
						className: "grid gap-1.5",
						children: [/* @__PURE__ */ jsx(Label, {
							htmlFor: "marketing-brand-name",
							children: t("Brand name")
						}), /* @__PURE__ */ jsx(Input, {
							id: "marketing-brand-name",
							value: content.brand_name,
							onChange: (event) => setField(["brand_name"], event.target.value)
						})]
					}), /* @__PURE__ */ jsxs("div", {
						className: "grid gap-1.5",
						children: [
							/* @__PURE__ */ jsx(Label, {
								htmlFor: "marketing-header-resource-label",
								children: t("Header resources label")
							}),
							/* @__PURE__ */ jsx(Input, {
								id: "marketing-header-resource-label",
								value: content.header.resources_label,
								onChange: (event) => setField(["header", "resources_label"], event.target.value)
							}),
							/* @__PURE__ */ jsx("p", {
								className: "text-xs text-muted-foreground",
								children: t("Leave empty to hide this link from the top navigation.")
							})
						]
					})] }),
					/* @__PURE__ */ jsx(FieldRow, { children: /* @__PURE__ */ jsxs("div", {
						className: "grid gap-1.5 md:col-span-2",
						children: [/* @__PURE__ */ jsx(Label, {
							htmlFor: "marketing-header-resource-href",
							children: t("Header resources href")
						}), /* @__PURE__ */ jsx(Input, {
							id: "marketing-header-resource-href",
							value: content.header.resources_href,
							onChange: (event) => setField(["header", "resources_href"], event.target.value)
						})]
					}) }),
					/* @__PURE__ */ jsx(FieldRow, { children: /* @__PURE__ */ jsxs("div", {
						className: "grid gap-1.5 md:col-span-2",
						children: [
							/* @__PURE__ */ jsx(Label, {
								htmlFor: "marketing-header-docs-external",
								children: t("External documentation URL")
							}),
							/* @__PURE__ */ jsx(Input, {
								id: "marketing-header-docs-external",
								placeholder: "https://docs.yoursite.com",
								value: content.header.docs_external_url ?? "",
								onChange: (event) => setField(["header", "docs_external_url"], event.target.value)
							}),
							/* @__PURE__ */ jsx("p", {
								className: "text-xs text-muted-foreground",
								children: t("Point all built-in documentation links (top nav + footer) at your own docs site. Leave empty to use the built-in /documentation.")
							})
						]
					}) }),
					/* @__PURE__ */ jsxs("label", {
						className: "flex items-start gap-3 rounded-md border border-border p-3",
						children: [/* @__PURE__ */ jsx(Checkbox, {
							id: "header-show-documentation",
							checked: content.header.show_documentation === true,
							onCheckedChange: (checked) => setField(["header", "show_documentation"], checked === true),
							className: "mt-0.5"
						}), /* @__PURE__ */ jsxs("span", {
							className: "grid gap-0.5",
							children: [/* @__PURE__ */ jsx("span", {
								className: "text-sm font-medium",
								children: t("Show the documentation link in the header")
							}), /* @__PURE__ */ jsx("span", {
								className: "text-xs text-muted-foreground",
								children: t("Adds the resources link (above) to the public navigation. Off by default; turn it on to expose your documentation to visitors.")
							})]
						})]
					}),
					/* @__PURE__ */ jsx("div", {
						className: "rounded-md border border-border/70 bg-muted/20 px-3 py-2 text-xs text-muted-foreground",
						children: t("The top-right header CTA is now handled automatically and follows the current auth state, so it is no longer edited here.")
					}),
					/* @__PURE__ */ jsx(LinkListEditor, {
						title: t("Header navigation"),
						items: content.nav_items,
						onChange: (items) => setList(["nav_items"], items),
						addLabel: t("Add nav item")
					})
				]
			}),
			activeTab === "hero" && /* @__PURE__ */ jsxs(EditorSection, {
				title: t("Hero"),
				description: t("Update the hero copy, badge, and the embedded site test prompt."),
				children: [
					/* @__PURE__ */ jsx(FieldRow, { children: /* @__PURE__ */ jsxs("div", {
						className: "grid gap-1.5 md:col-span-2",
						children: [/* @__PURE__ */ jsx(Label, {
							htmlFor: "marketing-hero-badge",
							children: t("Badge")
						}), /* @__PURE__ */ jsx(Input, {
							id: "marketing-hero-badge",
							value: content.hero.badge,
							onChange: (event) => setField(["hero", "badge"], event.target.value)
						})]
					}) }),
					/* @__PURE__ */ jsxs(FieldRow, { children: [/* @__PURE__ */ jsxs("div", {
						className: "grid gap-1.5",
						children: [/* @__PURE__ */ jsx(Label, {
							htmlFor: "marketing-hero-line-one",
							children: t("Line one")
						}), /* @__PURE__ */ jsx(Input, {
							id: "marketing-hero-line-one",
							value: content.hero.line_one,
							onChange: (event) => setField(["hero", "line_one"], event.target.value)
						})]
					}), /* @__PURE__ */ jsxs("div", {
						className: "grid gap-1.5",
						children: [/* @__PURE__ */ jsx(Label, {
							htmlFor: "marketing-hero-accent",
							children: t("Accent word")
						}), /* @__PURE__ */ jsx(Input, {
							id: "marketing-hero-accent",
							value: content.hero.accent,
							onChange: (event) => setField(["hero", "accent"], event.target.value)
						})]
					})] }),
					/* @__PURE__ */ jsxs(FieldRow, { children: [/* @__PURE__ */ jsxs("div", {
						className: "grid gap-1.5",
						children: [/* @__PURE__ */ jsx(Label, {
							htmlFor: "marketing-hero-line-two",
							children: t("Line two suffix")
						}), /* @__PURE__ */ jsx(Input, {
							id: "marketing-hero-line-two",
							value: content.hero.line_two_suffix,
							onChange: (event) => setField(["hero", "line_two_suffix"], event.target.value)
						})]
					}), /* @__PURE__ */ jsxs("div", {
						className: "grid gap-1.5",
						children: [/* @__PURE__ */ jsx(Label, {
							htmlFor: "marketing-hero-line-three-prefix",
							children: t("Line three prefix")
						}), /* @__PURE__ */ jsx(Input, {
							id: "marketing-hero-line-three-prefix",
							value: content.hero.line_three_prefix,
							onChange: (event) => setField(["hero", "line_three_prefix"], event.target.value)
						})]
					})] }),
					/* @__PURE__ */ jsxs(FieldRow, { children: [/* @__PURE__ */ jsxs("div", {
						className: "grid gap-1.5",
						children: [/* @__PURE__ */ jsx(Label, {
							htmlFor: "marketing-hero-line-three-highlight",
							children: t("Line three highlight")
						}), /* @__PURE__ */ jsx(Input, {
							id: "marketing-hero-line-three-highlight",
							value: content.hero.line_three_highlight,
							onChange: (event) => setField(["hero", "line_three_highlight"], event.target.value)
						})]
					}), /* @__PURE__ */ jsxs("div", {
						className: "grid gap-1.5",
						children: [/* @__PURE__ */ jsx(Label, {
							htmlFor: "marketing-hero-line-four-highlight",
							children: t("Line four highlight")
						}), /* @__PURE__ */ jsx(Input, {
							id: "marketing-hero-line-four-highlight",
							value: content.hero.line_four_highlight,
							onChange: (event) => setField(["hero", "line_four_highlight"], event.target.value)
						})]
					})] }),
					/* @__PURE__ */ jsxs("div", {
						className: "grid gap-1.5",
						children: [/* @__PURE__ */ jsx(Label, {
							htmlFor: "marketing-hero-description",
							children: t("Description")
						}), /* @__PURE__ */ jsx(Textarea, {
							id: "marketing-hero-description",
							value: content.hero.description,
							onChange: (event) => setField(["hero", "description"], event.target.value)
						})]
					}),
					/* @__PURE__ */ jsxs(FieldRow, { children: [/* @__PURE__ */ jsxs("div", {
						className: "grid gap-1.5",
						children: [/* @__PURE__ */ jsx(Label, {
							htmlFor: "marketing-site-test-label",
							children: t("Site test label")
						}), /* @__PURE__ */ jsx(Input, {
							id: "marketing-site-test-label",
							value: content.hero.site_test_label,
							onChange: (event) => setField(["hero", "site_test_label"], event.target.value)
						})]
					}), /* @__PURE__ */ jsxs("div", {
						className: "grid gap-1.5",
						children: [/* @__PURE__ */ jsx(Label, {
							htmlFor: "marketing-site-test-button",
							children: t("Site test button")
						}), /* @__PURE__ */ jsx(Input, {
							id: "marketing-site-test-button",
							value: content.hero.site_test_button_label,
							onChange: (event) => setField(["hero", "site_test_button_label"], event.target.value)
						})]
					})] }),
					/* @__PURE__ */ jsxs(FieldRow, { children: [/* @__PURE__ */ jsxs("div", {
						className: "grid gap-1.5",
						children: [/* @__PURE__ */ jsx(Label, {
							htmlFor: "marketing-site-test-placeholder",
							children: "Site test placeholder"
						}), /* @__PURE__ */ jsx(Input, {
							id: "marketing-site-test-placeholder",
							value: content.hero.site_test_placeholder,
							onChange: (event) => setField(["hero", "site_test_placeholder"], event.target.value)
						})]
					}), /* @__PURE__ */ jsxs("div", {
						className: "grid gap-1.5",
						children: [/* @__PURE__ */ jsx(Label, {
							htmlFor: "marketing-site-test-helper",
							children: "Site test helper"
						}), /* @__PURE__ */ jsx(Input, {
							id: "marketing-site-test-helper",
							value: content.hero.site_test_helper,
							onChange: (event) => setField(["hero", "site_test_helper"], event.target.value)
						})]
					})] }),
					/* @__PURE__ */ jsxs("div", {
						className: "grid gap-1.5",
						children: [/* @__PURE__ */ jsx(Label, {
							htmlFor: "marketing-live-demo-notice",
							children: t("Live demo notice")
						}), /* @__PURE__ */ jsx(Input, {
							id: "marketing-live-demo-notice",
							value: content.hero.live_demo_notice,
							onChange: (event) => setField(["hero", "live_demo_notice"], event.target.value)
						})]
					})
				]
			}),
			activeTab === "preview" && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs(EditorSection, {
				title: t("Chat preview and stats"),
				description: t("Manage the interactive preview card and the headline stat row below the hero."),
				children: [
					/* @__PURE__ */ jsxs(FieldRow, { children: [/* @__PURE__ */ jsxs("div", {
						className: "grid gap-1.5",
						children: [/* @__PURE__ */ jsx(Label, {
							htmlFor: "chat-title",
							children: t("Preview title")
						}), /* @__PURE__ */ jsx(Input, {
							id: "chat-title",
							value: content.chat_preview.title,
							onChange: (event) => setField(["chat_preview", "title"], event.target.value)
						})]
					}), /* @__PURE__ */ jsxs("div", {
						className: "grid gap-1.5",
						children: [/* @__PURE__ */ jsx(Label, {
							htmlFor: "chat-badge",
							children: t("Preview badge")
						}), /* @__PURE__ */ jsx(Input, {
							id: "chat-badge",
							value: content.chat_preview.badge,
							onChange: (event) => setField(["chat_preview", "badge"], event.target.value)
						})]
					})] }),
					/* @__PURE__ */ jsxs("div", {
						className: "grid gap-1.5",
						children: [/* @__PURE__ */ jsx(Label, {
							htmlFor: "chat-question",
							children: t("Question bubble")
						}), /* @__PURE__ */ jsx(Textarea, {
							id: "chat-question",
							value: content.chat_preview.question,
							onChange: (event) => setField(["chat_preview", "question"], event.target.value)
						})]
					}),
					/* @__PURE__ */ jsxs("div", {
						className: "grid gap-1.5",
						children: [/* @__PURE__ */ jsx(Label, {
							htmlFor: "chat-answer",
							children: t("Answer bubble")
						}), /* @__PURE__ */ jsx(Textarea, {
							id: "chat-answer",
							value: content.chat_preview.answer,
							onChange: (event) => setField(["chat_preview", "answer"], event.target.value)
						})]
					}),
					/* @__PURE__ */ jsxs(FieldRow, { children: [/* @__PURE__ */ jsxs("div", {
						className: "grid gap-1.5",
						children: [/* @__PURE__ */ jsx(Label, {
							htmlFor: "chat-plan-badge",
							children: t("Plan badge")
						}), /* @__PURE__ */ jsx(Input, {
							id: "chat-plan-badge",
							value: content.chat_preview.plan_badge,
							onChange: (event) => setField(["chat_preview", "plan_badge"], event.target.value)
						})]
					}), /* @__PURE__ */ jsxs("div", {
						className: "grid gap-1.5",
						children: [/* @__PURE__ */ jsx(Label, {
							htmlFor: "chat-plan-name",
							children: t("Plan name")
						}), /* @__PURE__ */ jsx(Input, {
							id: "chat-plan-name",
							value: content.chat_preview.plan_name,
							onChange: (event) => setField(["chat_preview", "plan_name"], event.target.value)
						})]
					})] }),
					/* @__PURE__ */ jsxs(FieldRow, { children: [/* @__PURE__ */ jsxs("div", {
						className: "grid gap-1.5",
						children: [/* @__PURE__ */ jsx(Label, {
							htmlFor: "chat-plan-price",
							children: t("Plan price")
						}), /* @__PURE__ */ jsx(Input, {
							id: "chat-plan-price",
							value: content.chat_preview.plan_price,
							onChange: (event) => setField(["chat_preview", "plan_price"], event.target.value)
						})]
					}), /* @__PURE__ */ jsxs("div", {
						className: "grid gap-1.5",
						children: [/* @__PURE__ */ jsx(Label, {
							htmlFor: "chat-plan-interval",
							children: t("Plan interval")
						}), /* @__PURE__ */ jsx(Input, {
							id: "chat-plan-interval",
							value: content.chat_preview.plan_interval,
							onChange: (event) => setField(["chat_preview", "plan_interval"], event.target.value)
						})]
					})] }),
					/* @__PURE__ */ jsxs("div", {
						className: "grid gap-1.5",
						children: [/* @__PURE__ */ jsx(Label, {
							htmlFor: "chat-plan-note",
							children: t("Plan note")
						}), /* @__PURE__ */ jsx(Textarea, {
							id: "chat-plan-note",
							value: content.chat_preview.plan_note,
							onChange: (event) => setField(["chat_preview", "plan_note"], event.target.value)
						})]
					}),
					/* @__PURE__ */ jsx(StringListField, {
						id: "chat-plan-features",
						label: "Plan features",
						value: content.chat_preview.plan_features,
						onChange: (value) => setField(["chat_preview", "plan_features"], value)
					}),
					/* @__PURE__ */ jsxs(FieldRow, { children: [/* @__PURE__ */ jsxs("div", {
						className: "grid gap-1.5",
						children: [/* @__PURE__ */ jsx(Label, {
							htmlFor: "chat-plan-button",
							children: t("Plan button")
						}), /* @__PURE__ */ jsx(Input, {
							id: "chat-plan-button",
							value: content.chat_preview.plan_button_label,
							onChange: (event) => setField(["chat_preview", "plan_button_label"], event.target.value)
						})]
					}), /* @__PURE__ */ jsxs("div", {
						className: "grid gap-1.5",
						children: [/* @__PURE__ */ jsx(Label, {
							htmlFor: "chat-typing-label",
							children: t("Typing label")
						}), /* @__PURE__ */ jsx(Input, {
							id: "chat-typing-label",
							value: content.chat_preview.typing_label,
							onChange: (event) => setField(["chat_preview", "typing_label"], event.target.value)
						})]
					})] }),
					/* @__PURE__ */ jsxs("div", {
						className: "grid gap-1.5",
						children: [/* @__PURE__ */ jsx(Label, {
							htmlFor: "chat-powered-by-prefix",
							children: t("Powered by prefix")
						}), /* @__PURE__ */ jsx(Input, {
							id: "chat-powered-by-prefix",
							value: content.chat_preview.powered_by_prefix,
							onChange: (event) => setField(["chat_preview", "powered_by_prefix"], event.target.value)
						})]
					}),
					/* @__PURE__ */ jsx(StatsEditor, {
						items: content.stats,
						onChange: (items) => setList(["stats"], items)
					})
				]
			}), /* @__PURE__ */ jsxs(EditorSection, {
				title: t("Video walkthrough"),
				description: t("Edit the video teaser copy and the labels around its preview card."),
				children: [
					/* @__PURE__ */ jsxs(FieldRow, { children: [/* @__PURE__ */ jsxs("div", {
						className: "grid gap-1.5",
						children: [/* @__PURE__ */ jsx(Label, {
							htmlFor: "video-badge",
							children: t("Badge")
						}), /* @__PURE__ */ jsx(Input, {
							id: "video-badge",
							value: content.video.badge,
							onChange: (event) => setField(["video", "badge"], event.target.value)
						})]
					}), /* @__PURE__ */ jsxs("div", {
						className: "grid gap-1.5",
						children: [/* @__PURE__ */ jsx(Label, {
							htmlFor: "video-href",
							children: t("Video href")
						}), /* @__PURE__ */ jsx(Input, {
							id: "video-href",
							value: content.video.href,
							onChange: (event) => setField(["video", "href"], event.target.value)
						})]
					})] }),
					/* @__PURE__ */ jsxs("div", {
						className: "grid gap-1.5",
						children: [/* @__PURE__ */ jsx(Label, {
							htmlFor: "video-title",
							children: t("Title")
						}), /* @__PURE__ */ jsx(Input, {
							id: "video-title",
							value: content.video.title,
							onChange: (event) => setField(["video", "title"], event.target.value)
						})]
					}),
					/* @__PURE__ */ jsxs("div", {
						className: "grid gap-1.5",
						children: [/* @__PURE__ */ jsx(Label, {
							htmlFor: "video-description",
							children: t("Description")
						}), /* @__PURE__ */ jsx(Textarea, {
							id: "video-description",
							value: content.video.description,
							onChange: (event) => setField(["video", "description"], event.target.value)
						})]
					}),
					/* @__PURE__ */ jsx(StringListField, {
						id: "video-bullets",
						label: "Bullets",
						value: content.video.bullets,
						onChange: (value) => setField(["video", "bullets"], value)
					}),
					/* @__PURE__ */ jsxs(FieldRow, { children: [/* @__PURE__ */ jsxs("div", {
						className: "grid gap-1.5",
						children: [/* @__PURE__ */ jsx(Label, {
							htmlFor: "video-duration-label",
							children: t("Duration label")
						}), /* @__PURE__ */ jsx(Input, {
							id: "video-duration-label",
							value: content.video.duration_label,
							onChange: (event) => setField(["video", "duration_label"], event.target.value)
						})]
					}), /* @__PURE__ */ jsxs("div", {
						className: "grid gap-1.5",
						children: [/* @__PURE__ */ jsx(Label, {
							htmlFor: "video-tag-label",
							children: t("Tag label")
						}), /* @__PURE__ */ jsx(Input, {
							id: "video-tag-label",
							value: content.video.tag_label,
							onChange: (event) => setField(["video", "tag_label"], event.target.value)
						})]
					})] }),
					/* @__PURE__ */ jsxs(FieldRow, { children: [/* @__PURE__ */ jsxs("div", {
						className: "grid gap-1.5",
						children: [/* @__PURE__ */ jsx(Label, {
							htmlFor: "video-scene-label",
							children: t("Scene label")
						}), /* @__PURE__ */ jsx(Input, {
							id: "video-scene-label",
							value: content.video.scene_label,
							onChange: (event) => setField(["video", "scene_label"], event.target.value)
						})]
					}), /* @__PURE__ */ jsxs("div", {
						className: "grid gap-1.5",
						children: [/* @__PURE__ */ jsx(Label, {
							htmlFor: "video-timecode",
							children: t("Timecode")
						}), /* @__PURE__ */ jsx(Input, {
							id: "video-timecode",
							value: content.video.timecode,
							onChange: (event) => setField(["video", "timecode"], event.target.value)
						})]
					})] }),
					/* @__PURE__ */ jsxs("div", {
						className: "grid gap-1.5",
						children: [/* @__PURE__ */ jsx(Label, {
							htmlFor: "video-card-title",
							children: t("Card title")
						}), /* @__PURE__ */ jsx(Input, {
							id: "video-card-title",
							value: content.video.card_title,
							onChange: (event) => setField(["video", "card_title"], event.target.value)
						})]
					}),
					/* @__PURE__ */ jsx(StringListField, {
						id: "video-chips",
						label: "Chips",
						value: content.video.chips,
						onChange: (value) => setField(["video", "chips"], value)
					}),
					/* @__PURE__ */ jsxs("div", {
						className: "grid gap-1.5",
						children: [/* @__PURE__ */ jsx(Label, {
							htmlFor: "video-footer-title",
							children: t("Footer title")
						}), /* @__PURE__ */ jsx(Input, {
							id: "video-footer-title",
							value: content.video.footer_title,
							onChange: (event) => setField(["video", "footer_title"], event.target.value)
						})]
					}),
					/* @__PURE__ */ jsxs("div", {
						className: "grid gap-1.5",
						children: [/* @__PURE__ */ jsx(Label, {
							htmlFor: "video-footer-description",
							children: t("Footer description")
						}), /* @__PURE__ */ jsx(Textarea, {
							id: "video-footer-description",
							value: content.video.footer_description,
							onChange: (event) => setField(["video", "footer_description"], event.target.value)
						})]
					}),
					/* @__PURE__ */ jsxs("div", {
						className: "grid gap-1.5",
						children: [/* @__PURE__ */ jsx(Label, {
							htmlFor: "video-button-label",
							children: t("Button label")
						}), /* @__PURE__ */ jsx(Input, {
							id: "video-button-label",
							value: content.video.button_label,
							onChange: (event) => setField(["video", "button_label"], event.target.value)
						})]
					})
				]
			})] }),
			activeTab === "features" && /* @__PURE__ */ jsxs(EditorSection, {
				title: t("Feature sections"),
				description: t("Manage the where-it-fits cards, feature grid, control area, and setup steps."),
				children: [
					/* @__PURE__ */ jsxs(FieldRow, { children: [/* @__PURE__ */ jsxs("div", {
						className: "grid gap-1.5",
						children: [/* @__PURE__ */ jsx(Label, {
							htmlFor: "fits-badge",
							children: t("Where it fits badge")
						}), /* @__PURE__ */ jsx(Input, {
							id: "fits-badge",
							value: content.where_it_fits.badge,
							onChange: (event) => setField(["where_it_fits", "badge"], event.target.value)
						})]
					}), /* @__PURE__ */ jsxs("div", {
						className: "grid gap-1.5",
						children: [/* @__PURE__ */ jsx(Label, {
							htmlFor: "feature-grid-badge",
							children: t("Feature grid badge")
						}), /* @__PURE__ */ jsx(Input, {
							id: "feature-grid-badge",
							value: content.feature_grid.badge,
							onChange: (event) => setField(["feature_grid", "badge"], event.target.value)
						})]
					})] }),
					/* @__PURE__ */ jsxs("div", {
						className: "grid gap-1.5",
						children: [/* @__PURE__ */ jsx(Label, {
							htmlFor: "fits-title",
							children: t("Where it fits title")
						}), /* @__PURE__ */ jsx(Textarea, {
							id: "fits-title",
							value: content.where_it_fits.title,
							onChange: (event) => setField(["where_it_fits", "title"], event.target.value)
						})]
					}),
					/* @__PURE__ */ jsxs("div", {
						className: "grid gap-1.5",
						children: [/* @__PURE__ */ jsx(Label, {
							htmlFor: "feature-grid-title",
							children: t("Feature grid title")
						}), /* @__PURE__ */ jsx(Textarea, {
							id: "feature-grid-title",
							value: content.feature_grid.title,
							onChange: (event) => setField(["feature_grid", "title"], event.target.value)
						})]
					}),
					/* @__PURE__ */ jsx(IconCardListEditor, {
						title: t("Where it fits cards"),
						items: content.where_it_fits.cards,
						onChange: (items) => setList(["where_it_fits", "cards"], items),
						addLabel: t("Add fit card")
					}),
					/* @__PURE__ */ jsx(IconCardListEditor, {
						title: t("Feature grid cards"),
						items: content.feature_grid.cards,
						onChange: (items) => setList(["feature_grid", "cards"], items),
						addLabel: t("Add feature card")
					}),
					/* @__PURE__ */ jsxs(FieldRow, { children: [/* @__PURE__ */ jsxs("div", {
						className: "grid gap-1.5",
						children: [/* @__PURE__ */ jsx(Label, {
							htmlFor: "control-badge",
							children: t("Control badge")
						}), /* @__PURE__ */ jsx(Input, {
							id: "control-badge",
							value: content.control.badge,
							onChange: (event) => setField(["control", "badge"], event.target.value)
						})]
					}), /* @__PURE__ */ jsxs("div", {
						className: "grid gap-1.5",
						children: [/* @__PURE__ */ jsx(Label, {
							htmlFor: "steps-badge",
							children: t("Steps badge")
						}), /* @__PURE__ */ jsx(Input, {
							id: "steps-badge",
							value: content.steps.badge,
							onChange: (event) => setField(["steps", "badge"], event.target.value)
						})]
					})] }),
					/* @__PURE__ */ jsxs("div", {
						className: "grid gap-1.5",
						children: [/* @__PURE__ */ jsx(Label, {
							htmlFor: "control-title",
							children: t("Control title")
						}), /* @__PURE__ */ jsx(Textarea, {
							id: "control-title",
							value: content.control.title,
							onChange: (event) => setField(["control", "title"], event.target.value)
						})]
					}),
					/* @__PURE__ */ jsxs("div", {
						className: "grid gap-1.5",
						children: [/* @__PURE__ */ jsx(Label, {
							htmlFor: "control-description",
							children: t("Control description")
						}), /* @__PURE__ */ jsx(Textarea, {
							id: "control-description",
							value: content.control.description,
							onChange: (event) => setField(["control", "description"], event.target.value)
						})]
					}),
					/* @__PURE__ */ jsx(IconCardListEditor, {
						title: t("Control callouts"),
						items: content.control.callouts,
						onChange: (items) => setList(["control", "callouts"], items),
						addLabel: t("Add callout")
					}),
					/* @__PURE__ */ jsxs(FieldRow, { children: [/* @__PURE__ */ jsxs("div", {
						className: "grid gap-1.5",
						children: [/* @__PURE__ */ jsx(Label, {
							htmlFor: "control-settings-card-title",
							children: t("Settings card title")
						}), /* @__PURE__ */ jsx(Input, {
							id: "control-settings-card-title",
							value: content.control.settings_card_title,
							onChange: (event) => setField(["control", "settings_card_title"], event.target.value)
						})]
					}), /* @__PURE__ */ jsxs("div", {
						className: "grid gap-1.5",
						children: [/* @__PURE__ */ jsx(Label, {
							htmlFor: "steps-title",
							children: t("Steps title")
						}), /* @__PURE__ */ jsx(Textarea, {
							id: "steps-title",
							value: content.steps.title,
							onChange: (event) => setField(["steps", "title"], event.target.value)
						})]
					})] }),
					/* @__PURE__ */ jsx(SettingRowsEditor, {
						rows: content.control.settings_rows,
						onChange: (rows) => setList(["control", "settings_rows"], rows)
					}),
					/* @__PURE__ */ jsxs(FieldRow, { children: [/* @__PURE__ */ jsxs("div", {
						className: "grid gap-1.5",
						children: [/* @__PURE__ */ jsx(Label, {
							htmlFor: "control-cancel-label",
							children: t("Cancel label")
						}), /* @__PURE__ */ jsx(Input, {
							id: "control-cancel-label",
							value: content.control.cancel_label,
							onChange: (event) => setField(["control", "cancel_label"], event.target.value)
						})]
					}), /* @__PURE__ */ jsxs("div", {
						className: "grid gap-1.5",
						children: [/* @__PURE__ */ jsx(Label, {
							htmlFor: "control-save-label",
							children: t("Save button label")
						}), /* @__PURE__ */ jsx(Input, {
							id: "control-save-label",
							value: content.control.save_button_label,
							onChange: (event) => setField(["control", "save_button_label"], event.target.value)
						})]
					})] }),
					/* @__PURE__ */ jsx(IconCardListEditor, {
						title: t("Setup steps"),
						items: content.steps.items,
						onChange: (items) => setList(["steps", "items"], items),
						addLabel: t("Add step")
					})
				]
			}),
			activeTab === "closing" && /* @__PURE__ */ jsxs(EditorSection, {
				title: t("Insights and final CTA"),
				description: t("Manage the analytics section and the closing call to action."),
				children: [
					/* @__PURE__ */ jsxs(FieldRow, { children: [/* @__PURE__ */ jsxs("div", {
						className: "grid gap-1.5",
						children: [/* @__PURE__ */ jsx(Label, {
							htmlFor: "insights-badge",
							children: t("Insights badge")
						}), /* @__PURE__ */ jsx(Input, {
							id: "insights-badge",
							value: content.insights.badge,
							onChange: (event) => setField(["insights", "badge"], event.target.value)
						})]
					}), /* @__PURE__ */ jsxs("div", {
						className: "grid gap-1.5",
						children: [/* @__PURE__ */ jsx(Label, {
							htmlFor: "insights-metric-label",
							children: t("Metric label")
						}), /* @__PURE__ */ jsx(Input, {
							id: "insights-metric-label",
							value: content.insights.metric_label,
							onChange: (event) => setField(["insights", "metric_label"], event.target.value)
						})]
					})] }),
					/* @__PURE__ */ jsxs("div", {
						className: "grid gap-1.5",
						children: [/* @__PURE__ */ jsx(Label, {
							htmlFor: "insights-chart-title",
							children: t("Chart title")
						}), /* @__PURE__ */ jsx(Textarea, {
							id: "insights-chart-title",
							value: content.insights.chart_title,
							onChange: (event) => setField(["insights", "chart_title"], event.target.value)
						})]
					}),
					/* @__PURE__ */ jsxs("div", {
						className: "grid gap-1.5",
						children: [/* @__PURE__ */ jsx(Label, {
							htmlFor: "insights-chart-description",
							children: t("Chart description")
						}), /* @__PURE__ */ jsx(Textarea, {
							id: "insights-chart-description",
							value: content.insights.chart_description,
							onChange: (event) => setField(["insights", "chart_description"], event.target.value)
						})]
					}),
					/* @__PURE__ */ jsxs(FieldRow, { children: [/* @__PURE__ */ jsxs("div", {
						className: "grid gap-1.5",
						children: [/* @__PURE__ */ jsx(Label, {
							htmlFor: "insights-metric-value",
							children: t("Metric value")
						}), /* @__PURE__ */ jsx(Input, {
							id: "insights-metric-value",
							value: content.insights.metric_value,
							onChange: (event) => setField(["insights", "metric_value"], event.target.value)
						})]
					}), /* @__PURE__ */ jsxs("div", {
						className: "grid gap-1.5",
						children: [/* @__PURE__ */ jsx(Label, {
							htmlFor: "insights-metric-trend",
							children: t("Metric trend")
						}), /* @__PURE__ */ jsx(Input, {
							id: "insights-metric-trend",
							value: content.insights.metric_trend,
							onChange: (event) => setField(["insights", "metric_trend"], event.target.value)
						})]
					})] }),
					/* @__PURE__ */ jsxs(FieldRow, { children: [/* @__PURE__ */ jsx(NumberListField, {
						id: "insights-chart-points",
						label: t("Chart points"),
						value: content.insights.chart_points,
						onChange: (value) => setField(["insights", "chart_points"], value),
						help: t("Enter numbers separated by commas or new lines.")
					}), /* @__PURE__ */ jsx(StringListField, {
						id: "insights-chart-labels",
						label: t("Chart labels"),
						value: content.insights.chart_labels,
						onChange: (value) => setField(["insights", "chart_labels"], value)
					})] }),
					/* @__PURE__ */ jsx(IconCardListEditor, {
						title: t("Insight cards"),
						items: content.insights.cards,
						onChange: (items) => setList(["insights", "cards"], items),
						addLabel: t("Add insight card")
					}),
					/* @__PURE__ */ jsxs("div", {
						className: "grid gap-1.5",
						children: [/* @__PURE__ */ jsx(Label, {
							htmlFor: "final-cta-title",
							children: t("Final CTA title")
						}), /* @__PURE__ */ jsx(Textarea, {
							id: "final-cta-title",
							value: content.final_cta.title,
							onChange: (event) => setField(["final_cta", "title"], event.target.value)
						})]
					}),
					/* @__PURE__ */ jsxs("div", {
						className: "grid gap-1.5",
						children: [/* @__PURE__ */ jsx(Label, {
							htmlFor: "final-cta-description",
							children: t("Final CTA description")
						}), /* @__PURE__ */ jsx(Textarea, {
							id: "final-cta-description",
							value: content.final_cta.description,
							onChange: (event) => setField(["final_cta", "description"], event.target.value)
						})]
					}),
					/* @__PURE__ */ jsxs(FieldRow, { children: [/* @__PURE__ */ jsxs("div", {
						className: "grid gap-1.5",
						children: [/* @__PURE__ */ jsx(Label, {
							htmlFor: "final-cta-primary-label",
							children: t("Primary button label")
						}), /* @__PURE__ */ jsx(Input, {
							id: "final-cta-primary-label",
							value: content.final_cta.primary_button_label,
							onChange: (event) => setField(["final_cta", "primary_button_label"], event.target.value)
						})]
					}), /* @__PURE__ */ jsxs("div", {
						className: "grid gap-1.5",
						children: [/* @__PURE__ */ jsx(Label, {
							htmlFor: "final-cta-primary-href",
							children: t("Primary button href")
						}), /* @__PURE__ */ jsx(Input, {
							id: "final-cta-primary-href",
							value: content.final_cta.primary_button_href,
							onChange: (event) => setField(["final_cta", "primary_button_href"], event.target.value)
						})]
					})] }),
					/* @__PURE__ */ jsxs(FieldRow, { children: [/* @__PURE__ */ jsxs("div", {
						className: "grid gap-1.5",
						children: [/* @__PURE__ */ jsx(Label, {
							htmlFor: "final-cta-secondary-label",
							children: t("Secondary button label")
						}), /* @__PURE__ */ jsx(Input, {
							id: "final-cta-secondary-label",
							value: content.final_cta.secondary_button_label,
							onChange: (event) => setField(["final_cta", "secondary_button_label"], event.target.value)
						})]
					}), /* @__PURE__ */ jsxs("div", {
						className: "grid gap-1.5",
						children: [/* @__PURE__ */ jsx(Label, {
							htmlFor: "final-cta-secondary-href",
							children: t("Secondary button href")
						}), /* @__PURE__ */ jsx(Input, {
							id: "final-cta-secondary-href",
							value: content.final_cta.secondary_button_href,
							onChange: (event) => setField(["final_cta", "secondary_button_href"], event.target.value)
						})]
					})] })
				]
			}),
			activeTab === "closing" && /* @__PURE__ */ jsxs(EditorSection, {
				title: t("Testimonials"),
				description: t("Quotes shown in the marketing-site testimonial carousel. Edit, reorder by removing and re-adding, or leave the items blank to hide the section."),
				children: [
					/* @__PURE__ */ jsxs(FieldRow, { children: [/* @__PURE__ */ jsxs("div", {
						className: "grid gap-1.5",
						children: [/* @__PURE__ */ jsx(Label, {
							htmlFor: "testimonials-badge",
							children: t("Badge")
						}), /* @__PURE__ */ jsx(Input, {
							id: "testimonials-badge",
							value: content.testimonials.badge,
							onChange: (event) => setField(["testimonials", "badge"], event.target.value)
						})]
					}), /* @__PURE__ */ jsxs("div", {
						className: "grid gap-1.5",
						children: [/* @__PURE__ */ jsx(Label, {
							htmlFor: "testimonials-kicker",
							children: t("Kicker")
						}), /* @__PURE__ */ jsx(Input, {
							id: "testimonials-kicker",
							value: content.testimonials.kicker,
							onChange: (event) => setField(["testimonials", "kicker"], event.target.value)
						})]
					})] }),
					/* @__PURE__ */ jsxs("div", {
						className: "grid gap-1.5",
						children: [/* @__PURE__ */ jsx(Label, {
							htmlFor: "testimonials-title",
							children: t("Title")
						}), /* @__PURE__ */ jsx(Textarea, {
							id: "testimonials-title",
							value: content.testimonials.title,
							onChange: (event) => setField(["testimonials", "title"], event.target.value)
						})]
					}),
					/* @__PURE__ */ jsx(TestimonialListEditor, {
						items: content.testimonials.items,
						onChange: (items) => setField(["testimonials", "items"], items)
					})
				]
			}),
			activeTab === "closing" && /* @__PURE__ */ jsxs(EditorSection, {
				title: t("FAQ"),
				description: t("Questions and answers in the marketing-site FAQ accordion. Removing every item hides the section."),
				children: [
					/* @__PURE__ */ jsxs(FieldRow, { children: [/* @__PURE__ */ jsxs("div", {
						className: "grid gap-1.5",
						children: [/* @__PURE__ */ jsx(Label, {
							htmlFor: "faq-badge",
							children: t("Badge")
						}), /* @__PURE__ */ jsx(Input, {
							id: "faq-badge",
							value: content.faq.badge,
							onChange: (event) => setField(["faq", "badge"], event.target.value)
						})]
					}), /* @__PURE__ */ jsxs("div", {
						className: "grid gap-1.5",
						children: [/* @__PURE__ */ jsx(Label, {
							htmlFor: "faq-kicker",
							children: t("Kicker")
						}), /* @__PURE__ */ jsx(Input, {
							id: "faq-kicker",
							value: content.faq.kicker,
							onChange: (event) => setField(["faq", "kicker"], event.target.value)
						})]
					})] }),
					/* @__PURE__ */ jsxs("div", {
						className: "grid gap-1.5",
						children: [/* @__PURE__ */ jsx(Label, {
							htmlFor: "faq-title",
							children: t("Title")
						}), /* @__PURE__ */ jsx(Textarea, {
							id: "faq-title",
							value: content.faq.title,
							onChange: (event) => setField(["faq", "title"], event.target.value)
						})]
					}),
					/* @__PURE__ */ jsx(FaqListEditor, {
						items: content.faq.items,
						onChange: (items) => setField(["faq", "items"], items)
					})
				]
			}),
			activeTab === "footer" && /* @__PURE__ */ jsxs(EditorSection, {
				title: t("Footer"),
				description: t("Edit the footer description, social links, grouped links, legal links, and copyright line."),
				children: [
					/* @__PURE__ */ jsxs("div", {
						className: "grid gap-1.5",
						children: [/* @__PURE__ */ jsx(Label, {
							htmlFor: "footer-brand-description",
							children: t("Brand description")
						}), /* @__PURE__ */ jsx(Textarea, {
							id: "footer-brand-description",
							value: content.footer.brand_description,
							onChange: (event) => setField(["footer", "brand_description"], event.target.value)
						})]
					}),
					/* @__PURE__ */ jsx(LinkListEditor, {
						title: t("Social links"),
						items: content.footer.socials,
						onChange: (items) => setList(["footer", "socials"], items),
						addLabel: t("Add social")
					}),
					/* @__PURE__ */ jsx(FooterGroupsEditor, {
						groups: content.footer.groups,
						onChange: (groups) => setList(["footer", "groups"], groups)
					}),
					/* @__PURE__ */ jsx(FieldRow, { children: /* @__PURE__ */ jsxs("div", {
						className: "grid gap-1.5 md:col-span-2",
						children: [/* @__PURE__ */ jsx(Label, {
							htmlFor: "footer-legal-title",
							children: t("Legal title")
						}), /* @__PURE__ */ jsx(Input, {
							id: "footer-legal-title",
							value: content.footer.legal_title,
							onChange: (event) => setField(["footer", "legal_title"], event.target.value)
						})]
					}) }),
					/* @__PURE__ */ jsx(LinkListEditor, {
						title: t("Legal links"),
						items: content.footer.legal_links,
						onChange: (items) => setList(["footer", "legal_links"], items),
						addLabel: t("Add legal link")
					}),
					/* @__PURE__ */ jsxs("div", {
						className: "grid gap-1.5",
						children: [/* @__PURE__ */ jsx(Label, {
							htmlFor: "footer-copyright",
							children: t("Copyright")
						}), /* @__PURE__ */ jsx(Input, {
							id: "footer-copyright",
							value: content.footer.copyright,
							onChange: (event) => setField(["footer", "copyright"], event.target.value)
						})]
					})
				]
			}),
			form.errors.marketing_home_content && /* @__PURE__ */ jsx("p", {
				className: "text-sm text-destructive",
				children: form.errors.marketing_home_content
			}),
			/* @__PURE__ */ jsx("div", {
				className: "flex justify-end",
				children: /* @__PURE__ */ jsx(Button, {
					type: "submit",
					disabled: form.processing,
					children: t("Save marketing content")
				})
			})
		]
	});
}
//#endregion
//#region resources/js/pages/settings/privacy-policy-editor.tsx
var privacy_policy_editor_exports = /* @__PURE__ */ __exportAll({ default: () => PrivacyPolicyEditor });
function usePrivacyTabs() {
	const { t } = useT();
	return [
		{
			key: "overview",
			label: t("Overview"),
			description: t("Headline, effective date, and the privacy contact block.")
		},
		{
			key: "processing",
			label: t("Collection & use"),
			description: t("What you collect, how you use it, and what stays on record.")
		},
		{
			key: "rights",
			label: t("Rights & GDPR"),
			description: t("Visitor rights, deletion workflows, and request instructions.")
		}
	];
}
function cloneContent(content) {
	return JSON.parse(JSON.stringify(content));
}
function setNestedValue(source, path, value) {
	const draft = cloneContent(source);
	let cursor = draft;
	for (let index = 0; index < path.length - 1; index++) cursor = cursor[path[index]];
	cursor[path[path.length - 1]] = value;
	return draft;
}
function stringListToText(values) {
	return values.join("\n");
}
function textToStringList(value) {
	return value.split("\n").map((item) => item.trim()).filter((item) => item.length > 0);
}
function PrivacyPolicyEditor({ initial }) {
	const { t } = useT();
	const PRIVACY_TABS = usePrivacyTabs();
	const [active, setActive] = useState("overview");
	const form = useForm({ privacy_policy_content: initial });
	const updateField = (path, value) => {
		form.setData("privacy_policy_content", setNestedValue(form.data.privacy_policy_content, path, value));
	};
	const submit = (event) => {
		event.preventDefault();
		form.patch(update$19.url("privacy"), { preserveScroll: true });
	};
	return /* @__PURE__ */ jsxs("div", {
		className: "space-y-4",
		children: [/* @__PURE__ */ jsx("div", {
			className: "grid gap-2 md:grid-cols-3",
			children: PRIVACY_TABS.map((tab) => {
				return /* @__PURE__ */ jsxs("button", {
					type: "button",
					onClick: () => setActive(tab.key),
					className: cn("rounded-xl border px-4 py-3 text-start transition", active === tab.key ? "border-foreground bg-foreground/5" : "border-border/80 hover:border-foreground/40"),
					children: [/* @__PURE__ */ jsx("p", {
						className: "text-sm font-medium",
						children: tab.label
					}), /* @__PURE__ */ jsx("p", {
						className: "mt-1 text-xs leading-5 text-muted-foreground",
						children: tab.description
					})]
				}, tab.key);
			})
		}), /* @__PURE__ */ jsxs("form", {
			onSubmit: submit,
			className: "space-y-4",
			children: [
				active === "overview" && /* @__PURE__ */ jsx(Card, {
					className: "border-border/80 p-5",
					children: /* @__PURE__ */ jsxs("div", {
						className: "grid gap-4",
						children: [
							/* @__PURE__ */ jsxs("div", {
								className: "grid gap-3 sm:grid-cols-2",
								children: [/* @__PURE__ */ jsxs("div", {
									className: "grid gap-1.5",
									children: [/* @__PURE__ */ jsx(Label, {
										htmlFor: "privacy_eyebrow",
										children: t("Eyebrow")
									}), /* @__PURE__ */ jsx(Input, {
										id: "privacy_eyebrow",
										value: form.data.privacy_policy_content.eyebrow,
										onChange: (event) => updateField(["eyebrow"], event.target.value)
									})]
								}), /* @__PURE__ */ jsxs("div", {
									className: "grid gap-1.5",
									children: [/* @__PURE__ */ jsx(Label, {
										htmlFor: "privacy_effective_date",
										children: t("Effective date")
									}), /* @__PURE__ */ jsx(Input, {
										id: "privacy_effective_date",
										value: form.data.privacy_policy_content.effective_date,
										onChange: (event) => updateField(["effective_date"], event.target.value)
									})]
								})]
							}),
							/* @__PURE__ */ jsxs("div", {
								className: "grid gap-1.5",
								children: [/* @__PURE__ */ jsx(Label, {
									htmlFor: "privacy_title",
									children: t("Page title")
								}), /* @__PURE__ */ jsx(Input, {
									id: "privacy_title",
									value: form.data.privacy_policy_content.title,
									onChange: (event) => updateField(["title"], event.target.value)
								})]
							}),
							/* @__PURE__ */ jsxs("div", {
								className: "grid gap-1.5",
								children: [/* @__PURE__ */ jsx(Label, {
									htmlFor: "privacy_summary",
									children: t("Summary")
								}), /* @__PURE__ */ jsx(Textarea, {
									id: "privacy_summary",
									rows: 4,
									value: form.data.privacy_policy_content.summary,
									onChange: (event) => updateField(["summary"], event.target.value)
								})]
							}),
							/* @__PURE__ */ jsxs("div", {
								className: "grid gap-4 rounded-xl border border-border/80 bg-muted/10 p-4",
								children: [
									/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
										className: "text-sm font-medium",
										children: t("Privacy contact")
									}), /* @__PURE__ */ jsx("p", {
										className: "mt-1 text-xs leading-5 text-muted-foreground",
										children: t("This block is shown near the top of the public policy page so visitors know where to send formal requests.")
									})] }),
									/* @__PURE__ */ jsxs("div", {
										className: "grid gap-3 sm:grid-cols-2",
										children: [/* @__PURE__ */ jsxs("div", {
											className: "grid gap-1.5",
											children: [/* @__PURE__ */ jsx(Label, {
												htmlFor: "privacy_team_name",
												children: t("Team name")
											}), /* @__PURE__ */ jsx(Input, {
												id: "privacy_team_name",
												value: form.data.privacy_policy_content.contact.team_name,
												onChange: (event) => updateField(["contact", "team_name"], event.target.value)
											})]
										}), /* @__PURE__ */ jsxs("div", {
											className: "grid gap-1.5",
											children: [/* @__PURE__ */ jsx(Label, {
												htmlFor: "privacy_contact_email",
												children: t("Email")
											}), /* @__PURE__ */ jsx(Input, {
												id: "privacy_contact_email",
												type: "email",
												value: form.data.privacy_policy_content.contact.email,
												onChange: (event) => updateField(["contact", "email"], event.target.value)
											})]
										})]
									}),
									/* @__PURE__ */ jsxs("div", {
										className: "grid gap-1.5",
										children: [/* @__PURE__ */ jsx(Label, {
											htmlFor: "privacy_response_sla",
											children: t("Response promise")
										}), /* @__PURE__ */ jsx(Textarea, {
											id: "privacy_response_sla",
											rows: 3,
											value: form.data.privacy_policy_content.contact.response_sla,
											onChange: (event) => updateField(["contact", "response_sla"], event.target.value)
										})]
									})
								]
							})
						]
					})
				}),
				active === "processing" && /* @__PURE__ */ jsxs("div", {
					className: "space-y-4",
					children: [/* @__PURE__ */ jsx(Card, {
						className: "border-border/80 p-5",
						children: /* @__PURE__ */ jsxs("div", {
							className: "grid gap-4",
							children: [
								/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
									className: "text-sm font-medium",
									children: t("What you collect")
								}), /* @__PURE__ */ jsx("p", {
									className: "mt-1 text-xs leading-5 text-muted-foreground",
									children: t("Each bullet becomes a line item on the public privacy page.")
								})] }),
								/* @__PURE__ */ jsxs("div", {
									className: "grid gap-1.5",
									children: [/* @__PURE__ */ jsx(Label, {
										htmlFor: "privacy_collection_summary",
										children: t("Summary")
									}), /* @__PURE__ */ jsx(Textarea, {
										id: "privacy_collection_summary",
										rows: 3,
										value: form.data.privacy_policy_content.collection.summary,
										onChange: (event) => updateField(["collection", "summary"], event.target.value)
									})]
								}),
								/* @__PURE__ */ jsxs("div", {
									className: "grid gap-1.5",
									children: [/* @__PURE__ */ jsx(Label, {
										htmlFor: "privacy_collection_items",
										children: t("Bullet list")
									}), /* @__PURE__ */ jsx(Textarea, {
										id: "privacy_collection_items",
										rows: 6,
										value: stringListToText(form.data.privacy_policy_content.collection.items),
										onChange: (event) => updateField(["collection", "items"], textToStringList(event.target.value))
									})]
								})
							]
						})
					}), /* @__PURE__ */ jsx(Card, {
						className: "border-border/80 p-5",
						children: /* @__PURE__ */ jsxs("div", {
							className: "grid gap-4",
							children: [
								/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
									className: "text-sm font-medium",
									children: t("How you use data")
								}), /* @__PURE__ */ jsx("p", {
									className: "mt-1 text-xs leading-5 text-muted-foreground",
									children: t("Use this section to explain AI replies, lead routing, analytics, and security processing.")
								})] }),
								/* @__PURE__ */ jsxs("div", {
									className: "grid gap-1.5",
									children: [/* @__PURE__ */ jsx(Label, {
										htmlFor: "privacy_usage_summary",
										children: t("Summary")
									}), /* @__PURE__ */ jsx(Textarea, {
										id: "privacy_usage_summary",
										rows: 3,
										value: form.data.privacy_policy_content.usage.summary,
										onChange: (event) => updateField(["usage", "summary"], event.target.value)
									})]
								}),
								/* @__PURE__ */ jsxs("div", {
									className: "grid gap-1.5",
									children: [/* @__PURE__ */ jsx(Label, {
										htmlFor: "privacy_usage_items",
										children: t("Bullet list")
									}), /* @__PURE__ */ jsx(Textarea, {
										id: "privacy_usage_items",
										rows: 6,
										value: stringListToText(form.data.privacy_policy_content.usage.items),
										onChange: (event) => updateField(["usage", "items"], textToStringList(event.target.value))
									})]
								})
							]
						})
					})]
				}),
				active === "rights" && /* @__PURE__ */ jsxs("div", {
					className: "space-y-4",
					children: [
						/* @__PURE__ */ jsx(Card, {
							className: "border-border/80 p-5",
							children: /* @__PURE__ */ jsxs("div", {
								className: "grid gap-4",
								children: [
									/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
										className: "text-sm font-medium",
										children: t("Retention")
									}), /* @__PURE__ */ jsx("p", {
										className: "mt-1 text-xs leading-5 text-muted-foreground",
										children: t("Explain how long conversations, leads, logs, or backups stick around.")
									})] }),
									/* @__PURE__ */ jsxs("div", {
										className: "grid gap-1.5",
										children: [/* @__PURE__ */ jsx(Label, {
											htmlFor: "privacy_retention_summary",
											children: t("Summary")
										}), /* @__PURE__ */ jsx(Textarea, {
											id: "privacy_retention_summary",
											rows: 3,
											value: form.data.privacy_policy_content.retention.summary,
											onChange: (event) => updateField(["retention", "summary"], event.target.value)
										})]
									}),
									/* @__PURE__ */ jsxs("div", {
										className: "grid gap-1.5",
										children: [/* @__PURE__ */ jsx(Label, {
											htmlFor: "privacy_retention_items",
											children: t("Bullet list")
										}), /* @__PURE__ */ jsx(Textarea, {
											id: "privacy_retention_items",
											rows: 6,
											value: stringListToText(form.data.privacy_policy_content.retention.items),
											onChange: (event) => updateField(["retention", "items"], textToStringList(event.target.value))
										})]
									})
								]
							})
						}),
						/* @__PURE__ */ jsx(Card, {
							className: "border-border/80 p-5",
							children: /* @__PURE__ */ jsxs("div", {
								className: "grid gap-4",
								children: [
									/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
										className: "text-sm font-medium",
										children: t("Visitor rights")
									}), /* @__PURE__ */ jsx("p", {
										className: "mt-1 text-xs leading-5 text-muted-foreground",
										children: t("This becomes the “Your rights” section.")
									})] }),
									/* @__PURE__ */ jsxs("div", {
										className: "grid gap-1.5",
										children: [/* @__PURE__ */ jsx(Label, {
											htmlFor: "privacy_rights_summary",
											children: t("Summary")
										}), /* @__PURE__ */ jsx(Textarea, {
											id: "privacy_rights_summary",
											rows: 3,
											value: form.data.privacy_policy_content.rights.summary,
											onChange: (event) => updateField(["rights", "summary"], event.target.value)
										})]
									}),
									/* @__PURE__ */ jsxs("div", {
										className: "grid gap-1.5",
										children: [/* @__PURE__ */ jsx(Label, {
											htmlFor: "privacy_rights_items",
											children: t("Bullet list")
										}), /* @__PURE__ */ jsx(Textarea, {
											id: "privacy_rights_items",
											rows: 6,
											value: stringListToText(form.data.privacy_policy_content.rights.items),
											onChange: (event) => updateField(["rights", "items"], textToStringList(event.target.value))
										})]
									})
								]
							})
						}),
						/* @__PURE__ */ jsx(Card, {
							className: "border-border/80 p-5",
							children: /* @__PURE__ */ jsxs("div", {
								className: "grid gap-4",
								children: [
									/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
										className: "text-sm font-medium",
										children: t("GDPR request flow")
									}), /* @__PURE__ */ jsx("p", {
										className: "mt-1 text-xs leading-5 text-muted-foreground",
										children: t("Clarify self-serve widget deletion, manual export requests, and where to send authenticated erasure requests.")
									})] }),
									/* @__PURE__ */ jsxs("div", {
										className: "grid gap-1.5",
										children: [/* @__PURE__ */ jsx(Label, {
											htmlFor: "privacy_gdpr_summary",
											children: t("Summary")
										}), /* @__PURE__ */ jsx(Textarea, {
											id: "privacy_gdpr_summary",
											rows: 4,
											value: form.data.privacy_policy_content.gdpr.summary,
											onChange: (event) => updateField(["gdpr", "summary"], event.target.value)
										})]
									}),
									/* @__PURE__ */ jsx("div", {
										className: "grid gap-3 sm:grid-cols-2",
										children: /* @__PURE__ */ jsxs("div", {
											className: "grid gap-1.5",
											children: [/* @__PURE__ */ jsx(Label, {
												htmlFor: "privacy_gdpr_email",
												children: t("Request email")
											}), /* @__PURE__ */ jsx(Input, {
												id: "privacy_gdpr_email",
												type: "email",
												value: form.data.privacy_policy_content.gdpr.request_email,
												onChange: (event) => updateField(["gdpr", "request_email"], event.target.value)
											})]
										})
									}),
									/* @__PURE__ */ jsxs("div", {
										className: "grid gap-1.5",
										children: [/* @__PURE__ */ jsx(Label, {
											htmlFor: "privacy_gdpr_instructions",
											children: t("Request instructions")
										}), /* @__PURE__ */ jsx(Textarea, {
											id: "privacy_gdpr_instructions",
											rows: 4,
											value: form.data.privacy_policy_content.gdpr.request_instructions,
											onChange: (event) => updateField(["gdpr", "request_instructions"], event.target.value)
										})]
									})
								]
							})
						})
					]
				}),
				/* @__PURE__ */ jsx("div", {
					className: "flex justify-end",
					children: /* @__PURE__ */ jsx(Button, {
						type: "submit",
						disabled: form.processing,
						children: t("Save privacy policy")
					})
				})
			]
		})]
	});
}
//#endregion
//#region resources/js/actions/App/Http/Controllers/Settings/ProfileController.ts
/**
* @see \App\Http\Controllers\Settings\ProfileController::edit
* @see app/Http/Controllers/Settings/ProfileController.php:20
* @route '/settings/profile'
*/
var edit$3 = (options) => ({
	url: edit$3.url(options),
	method: "get"
});
edit$3.definition = {
	methods: ["get", "head"],
	url: "/settings/profile"
};
/**
* @see \App\Http\Controllers\Settings\ProfileController::edit
* @see app/Http/Controllers/Settings/ProfileController.php:20
* @route '/settings/profile'
*/
edit$3.url = (options) => {
	return edit$3.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Settings\ProfileController::edit
* @see app/Http/Controllers/Settings/ProfileController.php:20
* @route '/settings/profile'
*/
edit$3.get = (options) => ({
	url: edit$3.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Settings\ProfileController::edit
* @see app/Http/Controllers/Settings/ProfileController.php:20
* @route '/settings/profile'
*/
edit$3.head = (options) => ({
	url: edit$3.url(options),
	method: "head"
});
/**
* @see \App\Http\Controllers\Settings\ProfileController::edit
* @see app/Http/Controllers/Settings/ProfileController.php:20
* @route '/settings/profile'
*/
var editForm$3 = (options) => ({
	action: edit$3.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Settings\ProfileController::edit
* @see app/Http/Controllers/Settings/ProfileController.php:20
* @route '/settings/profile'
*/
editForm$3.get = (options) => ({
	action: edit$3.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Settings\ProfileController::edit
* @see app/Http/Controllers/Settings/ProfileController.php:20
* @route '/settings/profile'
*/
editForm$3.head = (options) => ({
	action: edit$3.url({ [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
edit$3.form = editForm$3;
/**
* @see \App\Http\Controllers\Settings\ProfileController::update
* @see app/Http/Controllers/Settings/ProfileController.php:31
* @route '/settings/profile'
*/
var update$2 = (options) => ({
	url: update$2.url(options),
	method: "patch"
});
update$2.definition = {
	methods: ["patch"],
	url: "/settings/profile"
};
/**
* @see \App\Http\Controllers\Settings\ProfileController::update
* @see app/Http/Controllers/Settings/ProfileController.php:31
* @route '/settings/profile'
*/
update$2.url = (options) => {
	return update$2.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Settings\ProfileController::update
* @see app/Http/Controllers/Settings/ProfileController.php:31
* @route '/settings/profile'
*/
update$2.patch = (options) => ({
	url: update$2.url(options),
	method: "patch"
});
/**
* @see \App\Http\Controllers\Settings\ProfileController::update
* @see app/Http/Controllers/Settings/ProfileController.php:31
* @route '/settings/profile'
*/
var updateForm$2 = (options) => ({
	action: update$2.url({ [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "PATCH",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
/**
* @see \App\Http\Controllers\Settings\ProfileController::update
* @see app/Http/Controllers/Settings/ProfileController.php:31
* @route '/settings/profile'
*/
updateForm$2.patch = (options) => ({
	action: update$2.url({ [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "PATCH",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
update$2.form = updateForm$2;
/**
* @see \App\Http\Controllers\Settings\ProfileController::destroy
* @see app/Http/Controllers/Settings/ProfileController.php:60
* @route '/settings/profile'
*/
var destroy = (options) => ({
	url: destroy.url(options),
	method: "delete"
});
destroy.definition = {
	methods: ["delete"],
	url: "/settings/profile"
};
/**
* @see \App\Http\Controllers\Settings\ProfileController::destroy
* @see app/Http/Controllers/Settings/ProfileController.php:60
* @route '/settings/profile'
*/
destroy.url = (options) => {
	return destroy.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Settings\ProfileController::destroy
* @see app/Http/Controllers/Settings/ProfileController.php:60
* @route '/settings/profile'
*/
destroy.delete = (options) => ({
	url: destroy.url(options),
	method: "delete"
});
/**
* @see \App\Http\Controllers\Settings\ProfileController::destroy
* @see app/Http/Controllers/Settings/ProfileController.php:60
* @route '/settings/profile'
*/
var destroyForm = (options) => ({
	action: destroy.url({ [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "DELETE",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
/**
* @see \App\Http\Controllers\Settings\ProfileController::destroy
* @see app/Http/Controllers/Settings/ProfileController.php:60
* @route '/settings/profile'
*/
destroyForm.delete = (options) => ({
	action: destroy.url({ [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "DELETE",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
destroy.form = destroyForm;
var ProfileController = {
	edit: edit$3,
	update: update$2,
	destroy
};
//#endregion
//#region resources/js/components/delete-user.tsx
function DeleteUser() {
	const { t } = useT();
	const passwordInput = useRef(null);
	return /* @__PURE__ */ jsxs("div", {
		className: "space-y-6",
		children: [/* @__PURE__ */ jsx(Heading, {
			variant: "small",
			title: t("Delete account"),
			description: t("Delete your account and all of its resources")
		}), /* @__PURE__ */ jsxs("div", {
			className: "space-y-4 rounded-lg border border-destructive/20 bg-destructive/5 p-4",
			children: [/* @__PURE__ */ jsxs("div", {
				className: "relative space-y-0.5 text-destructive",
				children: [/* @__PURE__ */ jsx("p", {
					className: "font-medium",
					children: t("Warning")
				}), /* @__PURE__ */ jsx("p", {
					className: "text-sm text-destructive/80",
					children: t("Please proceed with caution, this cannot be undone.")
				})]
			}), /* @__PURE__ */ jsxs(Dialog, { children: [/* @__PURE__ */ jsx(DialogTrigger, {
				asChild: true,
				children: /* @__PURE__ */ jsx(Button, {
					variant: "destructive",
					"data-test": "delete-user-button",
					children: t("Delete account")
				})
			}), /* @__PURE__ */ jsxs(DialogContent, { children: [
				/* @__PURE__ */ jsx(DialogTitle, { children: t("Are you sure you want to delete your account?") }),
				/* @__PURE__ */ jsx(DialogDescription, { children: t("Once your account is deleted, all of its resources and data will also be permanently deleted. Please enter your password to confirm you would like to permanently delete your account.") }),
				/* @__PURE__ */ jsx(Form, {
					...ProfileController.destroy.form(),
					options: { preserveScroll: true },
					onError: () => passwordInput.current?.focus(),
					resetOnSuccess: true,
					className: "grid gap-4",
					children: ({ resetAndClearErrors, processing, errors }) => /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("div", {
						className: "grid gap-1.5",
						children: [
							/* @__PURE__ */ jsx(Label, {
								htmlFor: "password",
								className: "sr-only",
								children: t("Password")
							}),
							/* @__PURE__ */ jsx(PasswordInput, {
								id: "password",
								name: "password",
								ref: passwordInput,
								placeholder: t("Password"),
								autoComplete: "current-password"
							}),
							/* @__PURE__ */ jsx(InputError, { message: errors.password })
						]
					}), /* @__PURE__ */ jsxs(DialogFooter, {
						className: "gap-2",
						children: [/* @__PURE__ */ jsx(DialogClose, {
							asChild: true,
							children: /* @__PURE__ */ jsx(Button, {
								variant: "secondary",
								onClick: () => resetAndClearErrors(),
								children: t("Cancel")
							})
						}), /* @__PURE__ */ jsx(Button, {
							variant: "destructive",
							disabled: processing,
							asChild: true,
							children: /* @__PURE__ */ jsx("button", {
								type: "submit",
								"data-test": "confirm-delete-user-button",
								children: t("Delete account")
							})
						})]
					})] })
				})
			] })] })]
		})]
	});
}
//#endregion
//#region resources/js/pages/settings/profile.tsx
var profile_exports = /* @__PURE__ */ __exportAll({ default: () => Profile });
function Profile({ mustVerifyEmail, status }) {
	const { t } = useT();
	const { auth } = usePage().props;
	return /* @__PURE__ */ jsxs(Fragment$1, { children: [
		/* @__PURE__ */ jsx(Head, { title: t("Profile settings") }),
		/* @__PURE__ */ jsx("h1", {
			className: "sr-only",
			children: t("Profile settings")
		}),
		/* @__PURE__ */ jsxs("div", {
			className: "space-y-6",
			children: [/* @__PURE__ */ jsx(Heading, {
				variant: "small",
				title: t("Profile information"),
				description: t("Update your name and email address")
			}), /* @__PURE__ */ jsx(Card, {
				className: "border-border/80 p-5",
				children: /* @__PURE__ */ jsx(Form, {
					...ProfileController.update.form(),
					options: { preserveScroll: true },
					className: "grid gap-4",
					children: ({ processing, errors }) => /* @__PURE__ */ jsxs(Fragment$1, { children: [
						/* @__PURE__ */ jsxs("div", {
							className: "grid gap-1.5",
							children: [
								/* @__PURE__ */ jsx(Label, {
									htmlFor: "name",
									children: t("Name")
								}),
								/* @__PURE__ */ jsx(Input, {
									id: "name",
									defaultValue: auth.user.name,
									name: "name",
									required: true,
									autoComplete: "name",
									placeholder: t("Full name")
								}),
								/* @__PURE__ */ jsx(InputError, { message: errors.name })
							]
						}),
						/* @__PURE__ */ jsxs("div", {
							className: "grid gap-1.5",
							children: [
								/* @__PURE__ */ jsx(Label, {
									htmlFor: "email",
									children: t("Email address")
								}),
								/* @__PURE__ */ jsx(Input, {
									id: "email",
									type: "email",
									defaultValue: auth.user.email,
									name: "email",
									required: true,
									autoComplete: "username",
									placeholder: t("Email address")
								}),
								/* @__PURE__ */ jsx(InputError, { message: errors.email })
							]
						}),
						/* @__PURE__ */ jsx("div", {
							className: "grid gap-2 rounded-md border bg-muted/30 p-3",
							children: /* @__PURE__ */ jsxs("div", {
								className: "flex items-start gap-3",
								children: [/* @__PURE__ */ jsx(Checkbox, {
									id: "live_chat_available",
									name: "live_chat_available",
									value: "1",
									defaultChecked: auth.user.live_chat_available === true
								}), /* @__PURE__ */ jsxs("div", {
									className: "grid gap-0.5",
									children: [/* @__PURE__ */ jsx(Label, {
										htmlFor: "live_chat_available",
										className: "font-medium",
										children: t("Receive live chats")
									}), /* @__PURE__ */ jsx("p", {
										className: "text-xs text-muted-foreground",
										children: t("When on, visitors who click \"Connect me with a human\" can be routed to you while this browser tab is open.")
									})]
								})]
							})
						}),
						mustVerifyEmail && auth.user.email_verified_at === null && /* @__PURE__ */ jsxs("div", {
							className: "rounded-md border bg-muted/20 px-3 py-2 text-sm text-muted-foreground",
							children: [
								t("Your email address is unverified."),
								" ",
								/* @__PURE__ */ jsx(Link, {
									href: send(),
									as: "button",
									className: "text-foreground underline decoration-neutral-300 underline-offset-4 transition-colors duration-300 ease-out hover:decoration-current! dark:decoration-neutral-500",
									children: t("Click here to resend the verification email.")
								}),
								status === "verification-link-sent" && /* @__PURE__ */ jsx("div", {
									className: "mt-2 text-xs font-medium text-emerald-700 dark:text-emerald-400",
									children: t("A new verification link has been sent to your email address.")
								})
							]
						}),
						/* @__PURE__ */ jsx("div", {
							className: "flex items-center justify-end gap-4 border-t pt-4",
							children: /* @__PURE__ */ jsx(Button, {
								disabled: processing,
								"data-test": "update-profile-button",
								children: t("Save")
							})
						})
					] })
				})
			})]
		}),
		/* @__PURE__ */ jsx(DeleteUser, {})
	] });
}
Profile.layout = { breadcrumbs: [{
	title: "Profile settings",
	href: edit$11()
}] };
//#endregion
//#region resources/js/actions/App/Http/Controllers/Settings/SecurityController.ts
/**
* @see \App\Http\Controllers\Settings\SecurityController::edit
* @see app/Http/Controllers/Settings/SecurityController.php:31
* @route '/settings/security'
*/
var edit$2 = (options) => ({
	url: edit$2.url(options),
	method: "get"
});
edit$2.definition = {
	methods: ["get", "head"],
	url: "/settings/security"
};
/**
* @see \App\Http\Controllers\Settings\SecurityController::edit
* @see app/Http/Controllers/Settings/SecurityController.php:31
* @route '/settings/security'
*/
edit$2.url = (options) => {
	return edit$2.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Settings\SecurityController::edit
* @see app/Http/Controllers/Settings/SecurityController.php:31
* @route '/settings/security'
*/
edit$2.get = (options) => ({
	url: edit$2.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Settings\SecurityController::edit
* @see app/Http/Controllers/Settings/SecurityController.php:31
* @route '/settings/security'
*/
edit$2.head = (options) => ({
	url: edit$2.url(options),
	method: "head"
});
/**
* @see \App\Http\Controllers\Settings\SecurityController::edit
* @see app/Http/Controllers/Settings/SecurityController.php:31
* @route '/settings/security'
*/
var editForm$2 = (options) => ({
	action: edit$2.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Settings\SecurityController::edit
* @see app/Http/Controllers/Settings/SecurityController.php:31
* @route '/settings/security'
*/
editForm$2.get = (options) => ({
	action: edit$2.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Settings\SecurityController::edit
* @see app/Http/Controllers/Settings/SecurityController.php:31
* @route '/settings/security'
*/
editForm$2.head = (options) => ({
	action: edit$2.url({ [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
edit$2.form = editForm$2;
/**
* @see \App\Http\Controllers\Settings\SecurityController::update
* @see app/Http/Controllers/Settings/SecurityController.php:50
* @route '/settings/password'
*/
var update$1 = (options) => ({
	url: update$1.url(options),
	method: "put"
});
update$1.definition = {
	methods: ["put"],
	url: "/settings/password"
};
/**
* @see \App\Http\Controllers\Settings\SecurityController::update
* @see app/Http/Controllers/Settings/SecurityController.php:50
* @route '/settings/password'
*/
update$1.url = (options) => {
	return update$1.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Settings\SecurityController::update
* @see app/Http/Controllers/Settings/SecurityController.php:50
* @route '/settings/password'
*/
update$1.put = (options) => ({
	url: update$1.url(options),
	method: "put"
});
/**
* @see \App\Http\Controllers\Settings\SecurityController::update
* @see app/Http/Controllers/Settings/SecurityController.php:50
* @route '/settings/password'
*/
var updateForm$1 = (options) => ({
	action: update$1.url({ [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "PUT",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
/**
* @see \App\Http\Controllers\Settings\SecurityController::update
* @see app/Http/Controllers/Settings/SecurityController.php:50
* @route '/settings/password'
*/
updateForm$1.put = (options) => ({
	action: update$1.url({ [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "PUT",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
update$1.form = updateForm$1;
var SecurityController = {
	edit: edit$2,
	update: update$1
};
//#endregion
//#region resources/js/components/ui/alert.tsx
var alertVariants = cva("relative w-full rounded-lg border px-4 py-3 text-sm grid has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] grid-cols-[0_1fr] has-[>svg]:gap-x-3 gap-y-0.5 items-start [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current", {
	variants: { variant: {
		default: "bg-background text-foreground",
		destructive: "text-destructive-foreground [&>svg]:text-current *:data-[slot=alert-description]:text-destructive-foreground/80"
	} },
	defaultVariants: { variant: "default" }
});
function Alert({ className, variant, ...props }) {
	return /* @__PURE__ */ jsx("div", {
		"data-slot": "alert",
		role: "alert",
		className: cn(alertVariants({ variant }), className),
		...props
	});
}
function AlertTitle({ className, ...props }) {
	return /* @__PURE__ */ jsx("div", {
		"data-slot": "alert-title",
		className: cn("col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight", className),
		...props
	});
}
function AlertDescription({ className, ...props }) {
	return /* @__PURE__ */ jsx("div", {
		"data-slot": "alert-description",
		className: cn("text-muted-foreground col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed", className),
		...props
	});
}
//#endregion
//#region resources/js/components/alert-error.tsx
function AlertError({ errors, title }) {
	const { t } = useT();
	return /* @__PURE__ */ jsxs(Alert, {
		variant: "destructive",
		children: [
			/* @__PURE__ */ jsx(AlertCircleIcon, {}),
			/* @__PURE__ */ jsx(AlertTitle, { children: title || t("Something went wrong.") }),
			/* @__PURE__ */ jsx(AlertDescription, { children: /* @__PURE__ */ jsx("ul", {
				className: "list-inside list-disc text-sm",
				children: Array.from(new Set(errors)).map((error, index) => /* @__PURE__ */ jsx("li", { children: error }, index))
			}) })
		]
	});
}
//#endregion
//#region resources/js/components/two-factor-recovery-codes.tsx
function TwoFactorRecoveryCodes({ recoveryCodesList, fetchRecoveryCodes, errors }) {
	const { t } = useT();
	const [codesAreVisible, setCodesAreVisible] = useState(false);
	const codesSectionRef = useRef(null);
	const canRegenerateCodes = recoveryCodesList.length > 0 && codesAreVisible;
	const toggleCodesVisibility = useCallback(async () => {
		if (!codesAreVisible && !recoveryCodesList.length) await fetchRecoveryCodes();
		setCodesAreVisible(!codesAreVisible);
		if (!codesAreVisible) setTimeout(() => {
			codesSectionRef.current?.scrollIntoView({
				behavior: "smooth",
				block: "nearest"
			});
		});
	}, [
		codesAreVisible,
		recoveryCodesList.length,
		fetchRecoveryCodes
	]);
	useEffect(() => {
		if (!recoveryCodesList.length) fetchRecoveryCodes();
	}, [recoveryCodesList.length, fetchRecoveryCodes]);
	const RecoveryCodeIconComponent = codesAreVisible ? EyeOff : Eye;
	return /* @__PURE__ */ jsxs(Card, { children: [/* @__PURE__ */ jsxs(CardHeader, { children: [/* @__PURE__ */ jsxs(CardTitle, {
		className: "flex gap-3",
		children: [/* @__PURE__ */ jsx(LockKeyhole, {
			className: "size-4",
			"aria-hidden": "true"
		}), t("2FA recovery codes")]
	}), /* @__PURE__ */ jsx(CardDescription, { children: t("Recovery codes let you regain access if you lose your 2FA device. Store them in a secure password manager.") })] }), /* @__PURE__ */ jsxs(CardContent, { children: [/* @__PURE__ */ jsxs("div", {
		className: "flex flex-col gap-3 select-none sm:flex-row sm:items-center sm:justify-between",
		children: [/* @__PURE__ */ jsxs(Button, {
			onClick: toggleCodesVisibility,
			className: "w-fit",
			"aria-expanded": codesAreVisible,
			"aria-controls": "recovery-codes-section",
			children: [/* @__PURE__ */ jsx(RecoveryCodeIconComponent, {
				className: "size-4",
				"aria-hidden": "true"
			}), codesAreVisible ? t("Hide recovery codes") : t("View recovery codes")]
		}), canRegenerateCodes && /* @__PURE__ */ jsx(Form, {
			...regenerateRecoveryCodes.form(),
			options: { preserveScroll: true },
			onSuccess: fetchRecoveryCodes,
			children: ({ processing }) => /* @__PURE__ */ jsxs(Button, {
				variant: "secondary",
				type: "submit",
				disabled: processing,
				"aria-describedby": "regenerate-warning",
				children: [
					/* @__PURE__ */ jsx(RefreshCw, {}),
					" ",
					t("Regenerate codes")
				]
			})
		})]
	}), /* @__PURE__ */ jsx("div", {
		id: "recovery-codes-section",
		className: `relative overflow-hidden transition-all duration-300 ${codesAreVisible ? "h-auto opacity-100" : "h-0 opacity-0"}`,
		"aria-hidden": !codesAreVisible,
		children: /* @__PURE__ */ jsx("div", {
			className: "mt-3 space-y-3",
			children: errors?.length ? /* @__PURE__ */ jsx(AlertError, { errors }) : /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("div", {
				ref: codesSectionRef,
				className: "grid gap-1 rounded-lg bg-muted p-4 font-mono text-sm",
				role: "list",
				"aria-label": t("Recovery codes"),
				children: recoveryCodesList.length ? recoveryCodesList.map((code, index) => /* @__PURE__ */ jsx("div", {
					role: "listitem",
					className: "select-text",
					children: code
				}, index)) : /* @__PURE__ */ jsx("div", {
					className: "space-y-2",
					"aria-label": t("Loading recovery codes"),
					children: Array.from({ length: 8 }, (_, index) => /* @__PURE__ */ jsx("div", {
						className: "h-4 animate-pulse rounded bg-muted-foreground/20",
						"aria-hidden": "true"
					}, index))
				})
			}), /* @__PURE__ */ jsx("div", {
				className: "text-xs text-muted-foreground select-none",
				children: /* @__PURE__ */ jsxs("p", {
					id: "regenerate-warning",
					children: [
						t("Each recovery code can be used once to access your account and will be removed after use. If you need more, click"),
						" ",
						/* @__PURE__ */ jsx("span", {
							className: "font-bold",
							children: t("Regenerate codes")
						}),
						" ",
						t("above.")
					]
				})
			})] })
		})
	})] })] });
}
//#endregion
//#region resources/js/hooks/use-clipboard.ts
function useClipboard() {
	const [copiedText, setCopiedText] = useState(null);
	const copy = async (text) => {
		if (!navigator?.clipboard) {
			console.warn("Clipboard not supported");
			return false;
		}
		try {
			await navigator.clipboard.writeText(text);
			setCopiedText(text);
			return true;
		} catch (error) {
			console.warn("Copy failed", error);
			setCopiedText(null);
			return false;
		}
	};
	return [copiedText, copy];
}
//#endregion
//#region resources/js/components/two-factor-setup-modal.tsx
function GridScanIcon() {
	return /* @__PURE__ */ jsx("div", {
		className: "mb-3 rounded-full border border-border bg-card p-0.5 shadow-sm",
		children: /* @__PURE__ */ jsxs("div", {
			className: "relative overflow-hidden rounded-full border border-border bg-muted p-2.5",
			children: [
				/* @__PURE__ */ jsx("div", {
					className: "absolute inset-0 grid grid-cols-5 opacity-50",
					children: Array.from({ length: 5 }, (_, i) => /* @__PURE__ */ jsx("div", { className: "border-e border-border last:border-e-0" }, `col-${i + 1}`))
				}),
				/* @__PURE__ */ jsx("div", {
					className: "absolute inset-0 grid grid-rows-5 opacity-50",
					children: Array.from({ length: 5 }, (_, i) => /* @__PURE__ */ jsx("div", { className: "border-b border-border last:border-b-0" }, `row-${i + 1}`))
				}),
				/* @__PURE__ */ jsx(ScanLine, { className: "relative z-20 size-6 text-foreground" })
			]
		})
	});
}
function TwoFactorSetupStep({ qrCodeSvg, manualSetupKey, buttonText, onNextStep, errors }) {
	const { t } = useT();
	const { resolvedAppearance } = useAppearance();
	const [copiedText, copy] = useClipboard();
	const IconComponent = copiedText === manualSetupKey ? Check : Copy;
	return /* @__PURE__ */ jsx(Fragment$1, { children: errors?.length ? /* @__PURE__ */ jsx(AlertError, { errors }) : /* @__PURE__ */ jsxs(Fragment$1, { children: [
		/* @__PURE__ */ jsx("div", {
			className: "mx-auto flex max-w-md overflow-hidden",
			children: /* @__PURE__ */ jsx("div", {
				className: "mx-auto aspect-square w-64 rounded-lg border border-border",
				children: /* @__PURE__ */ jsx("div", {
					className: "z-10 flex h-full w-full items-center justify-center p-5",
					children: qrCodeSvg ? /* @__PURE__ */ jsx("div", {
						className: "aspect-square w-full rounded-lg bg-white p-2 [&_svg]:size-full",
						dangerouslySetInnerHTML: { __html: qrCodeSvg },
						style: { filter: resolvedAppearance === "dark" ? "invert(1) brightness(1.5)" : void 0 }
					}) : /* @__PURE__ */ jsx(Spinner, {})
				})
			})
		}),
		/* @__PURE__ */ jsx("div", {
			className: "flex w-full space-x-5",
			children: /* @__PURE__ */ jsx(Button, {
				className: "w-full",
				onClick: onNextStep,
				children: buttonText
			})
		}),
		/* @__PURE__ */ jsxs("div", {
			className: "relative flex w-full items-center justify-center",
			children: [/* @__PURE__ */ jsx("div", { className: "absolute inset-0 top-1/2 h-px w-full bg-border" }), /* @__PURE__ */ jsx("span", {
				className: "relative bg-card px-2 py-1",
				children: t("or, enter the code manually")
			})]
		}),
		/* @__PURE__ */ jsx("div", {
			className: "flex w-full space-x-2",
			children: /* @__PURE__ */ jsx("div", {
				className: "flex w-full items-stretch overflow-hidden rounded-xl border border-border",
				children: !manualSetupKey ? /* @__PURE__ */ jsx("div", {
					className: "flex h-full w-full items-center justify-center bg-muted p-3",
					children: /* @__PURE__ */ jsx(Spinner, {})
				}) : /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("input", {
					type: "text",
					readOnly: true,
					value: manualSetupKey,
					className: "h-full w-full bg-background p-3 text-foreground outline-none"
				}), /* @__PURE__ */ jsx("button", {
					onClick: () => copy(manualSetupKey),
					className: "border-s border-border px-3 hover:bg-muted",
					children: /* @__PURE__ */ jsx(IconComponent, { className: "w-4" })
				})] })
			})
		})
	] }) });
}
function TwoFactorVerificationStep({ onClose, onBack }) {
	const { t } = useT();
	const [code, setCode] = useState("");
	const pinInputContainerRef = useRef(null);
	useEffect(() => {
		setTimeout(() => {
			pinInputContainerRef.current?.querySelector("input")?.focus();
		}, 0);
	}, []);
	return /* @__PURE__ */ jsx(Form, {
		...confirm$1.form(),
		onSuccess: () => onClose(),
		resetOnError: true,
		resetOnSuccess: true,
		children: ({ processing, errors }) => /* @__PURE__ */ jsx(Fragment$1, { children: /* @__PURE__ */ jsxs("div", {
			ref: pinInputContainerRef,
			className: "relative w-full space-y-3",
			children: [/* @__PURE__ */ jsxs("div", {
				className: "flex w-full flex-col items-center space-y-3 py-2",
				children: [/* @__PURE__ */ jsx(InputOTP, {
					id: "otp",
					name: "code",
					maxLength: 6,
					onChange: setCode,
					disabled: processing,
					pattern: REGEXP_ONLY_DIGITS,
					autoFocus: true,
					children: /* @__PURE__ */ jsx(InputOTPGroup, { children: Array.from({ length: 6 }, (_, index) => /* @__PURE__ */ jsx(InputOTPSlot, { index }, index)) })
				}), /* @__PURE__ */ jsx(InputError, { message: errors?.confirmTwoFactorAuthentication?.code })]
			}), /* @__PURE__ */ jsxs("div", {
				className: "flex w-full space-x-5",
				children: [/* @__PURE__ */ jsx(Button, {
					type: "button",
					variant: "outline",
					className: "flex-1",
					onClick: onBack,
					disabled: processing,
					children: t("Back")
				}), /* @__PURE__ */ jsx(Button, {
					type: "submit",
					className: "flex-1",
					disabled: processing || code.length < 6,
					children: t("Confirm")
				})]
			})]
		}) })
	});
}
function TwoFactorSetupModal({ isOpen, onClose, requiresConfirmation, twoFactorEnabled, qrCodeSvg, manualSetupKey, clearSetupData, fetchSetupData, errors }) {
	const { t } = useT();
	const [showVerificationStep, setShowVerificationStep] = useState(false);
	const modalConfig = useMemo(() => {
		if (twoFactorEnabled) return {
			title: t("Two-factor authentication enabled"),
			description: t("Two-factor authentication is now enabled. Scan the QR code or enter the setup key in your authenticator app."),
			buttonText: t("Close")
		};
		if (showVerificationStep) return {
			title: t("Verify authentication code"),
			description: t("Enter the 6-digit code from your authenticator app"),
			buttonText: t("Continue")
		};
		return {
			title: t("Enable two-factor authentication"),
			description: t("To finish enabling two-factor authentication, scan the QR code or enter the setup key in your authenticator app"),
			buttonText: t("Continue")
		};
	}, [
		t,
		twoFactorEnabled,
		showVerificationStep
	]);
	const resetModalState = useCallback(() => {
		setShowVerificationStep(false);
		clearSetupData();
	}, [clearSetupData]);
	const handleClose = useCallback(() => {
		resetModalState();
		onClose();
	}, [onClose, resetModalState]);
	const handleModalNextStep = useCallback(() => {
		if (requiresConfirmation) {
			setShowVerificationStep(true);
			return;
		}
		handleClose();
	}, [requiresConfirmation, handleClose]);
	const fetchSetupDataRef = useRef(fetchSetupData);
	useEffect(() => {
		fetchSetupDataRef.current = fetchSetupData;
	}, [fetchSetupData]);
	useEffect(() => {
		if (isOpen && !qrCodeSvg) fetchSetupDataRef.current();
	}, [isOpen, qrCodeSvg]);
	return /* @__PURE__ */ jsx(Dialog, {
		open: isOpen,
		onOpenChange: (open) => !open && handleClose(),
		children: /* @__PURE__ */ jsxs(DialogContent, {
			className: "sm:max-w-md",
			children: [/* @__PURE__ */ jsxs(DialogHeader, {
				className: "flex items-center justify-center",
				children: [
					/* @__PURE__ */ jsx(GridScanIcon, {}),
					/* @__PURE__ */ jsx(DialogTitle, { children: modalConfig.title }),
					/* @__PURE__ */ jsx(DialogDescription, {
						className: "text-center",
						children: modalConfig.description
					})
				]
			}), /* @__PURE__ */ jsx("div", {
				className: "flex flex-col items-center space-y-5",
				children: showVerificationStep ? /* @__PURE__ */ jsx(TwoFactorVerificationStep, {
					onClose: handleClose,
					onBack: () => setShowVerificationStep(false)
				}) : /* @__PURE__ */ jsx(TwoFactorSetupStep, {
					qrCodeSvg,
					manualSetupKey,
					buttonText: modalConfig.buttonText,
					onNextStep: handleModalNextStep,
					errors
				})
			})]
		})
	});
}
//#endregion
//#region resources/js/routes/security/index.ts
/**
* @see \App\Http\Controllers\Settings\SecurityController::edit
* @see app/Http/Controllers/Settings/SecurityController.php:31
* @route '/settings/security'
*/
var edit$1 = (options) => ({
	url: edit$1.url(options),
	method: "get"
});
edit$1.definition = {
	methods: ["get", "head"],
	url: "/settings/security"
};
/**
* @see \App\Http\Controllers\Settings\SecurityController::edit
* @see app/Http/Controllers/Settings/SecurityController.php:31
* @route '/settings/security'
*/
edit$1.url = (options) => {
	return edit$1.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Settings\SecurityController::edit
* @see app/Http/Controllers/Settings/SecurityController.php:31
* @route '/settings/security'
*/
edit$1.get = (options) => ({
	url: edit$1.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Settings\SecurityController::edit
* @see app/Http/Controllers/Settings/SecurityController.php:31
* @route '/settings/security'
*/
edit$1.head = (options) => ({
	url: edit$1.url(options),
	method: "head"
});
/**
* @see \App\Http\Controllers\Settings\SecurityController::edit
* @see app/Http/Controllers/Settings/SecurityController.php:31
* @route '/settings/security'
*/
var editForm$1 = (options) => ({
	action: edit$1.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Settings\SecurityController::edit
* @see app/Http/Controllers/Settings/SecurityController.php:31
* @route '/settings/security'
*/
editForm$1.get = (options) => ({
	action: edit$1.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Settings\SecurityController::edit
* @see app/Http/Controllers/Settings/SecurityController.php:31
* @route '/settings/security'
*/
editForm$1.head = (options) => ({
	action: edit$1.url({ [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
edit$1.form = editForm$1;
Object.assign(edit$1, edit$1);
//#endregion
//#region resources/js/pages/settings/security.tsx
var security_exports = /* @__PURE__ */ __exportAll({ default: () => Security });
function Security({ canManageTwoFactor = false, requiresConfirmation = false, twoFactorEnabled = false }) {
	const passwordInput = useRef(null);
	const currentPasswordInput = useRef(null);
	const { qrCodeSvg, hasSetupData, manualSetupKey, clearSetupData, clearTwoFactorAuthData, fetchSetupData, recoveryCodesList, fetchRecoveryCodes, errors } = useTwoFactorAuth();
	const [showSetupModal, setShowSetupModal] = useState(false);
	const prevTwoFactorEnabled = useRef(twoFactorEnabled);
	useEffect(() => {
		if (prevTwoFactorEnabled.current && !twoFactorEnabled) clearTwoFactorAuthData();
		prevTwoFactorEnabled.current = twoFactorEnabled;
	}, [twoFactorEnabled, clearTwoFactorAuthData]);
	return /* @__PURE__ */ jsxs(Fragment$1, { children: [
		/* @__PURE__ */ jsx(Head, { title: "Security settings" }),
		/* @__PURE__ */ jsx("h1", {
			className: "sr-only",
			children: "Security settings"
		}),
		/* @__PURE__ */ jsxs("div", {
			className: "space-y-6",
			children: [/* @__PURE__ */ jsx(Heading, {
				variant: "small",
				title: "Update password",
				description: "Ensure your account is using a long, random password to stay secure"
			}), /* @__PURE__ */ jsx(Card, {
				className: "border-border/80 p-5",
				children: /* @__PURE__ */ jsx(Form, {
					...SecurityController.update.form(),
					options: { preserveScroll: true },
					resetOnError: [
						"password",
						"password_confirmation",
						"current_password"
					],
					resetOnSuccess: true,
					onError: (errors) => {
						if (errors.password) passwordInput.current?.focus();
						if (errors.current_password) currentPasswordInput.current?.focus();
					},
					className: "grid gap-4",
					children: ({ errors, processing }) => /* @__PURE__ */ jsxs(Fragment$1, { children: [
						/* @__PURE__ */ jsxs("div", {
							className: "grid gap-1.5",
							children: [
								/* @__PURE__ */ jsx(Label, {
									htmlFor: "current_password",
									children: "Current password"
								}),
								/* @__PURE__ */ jsx(PasswordInput, {
									id: "current_password",
									ref: currentPasswordInput,
									name: "current_password",
									autoComplete: "current-password",
									placeholder: "Current password"
								}),
								/* @__PURE__ */ jsx(InputError, { message: errors.current_password })
							]
						}),
						/* @__PURE__ */ jsxs("div", {
							className: "grid gap-1.5",
							children: [
								/* @__PURE__ */ jsx(Label, {
									htmlFor: "password",
									children: "New password"
								}),
								/* @__PURE__ */ jsx(PasswordInput, {
									id: "password",
									ref: passwordInput,
									name: "password",
									autoComplete: "new-password",
									placeholder: "New password"
								}),
								/* @__PURE__ */ jsx(InputError, { message: errors.password })
							]
						}),
						/* @__PURE__ */ jsxs("div", {
							className: "grid gap-1.5",
							children: [
								/* @__PURE__ */ jsx(Label, {
									htmlFor: "password_confirmation",
									children: "Confirm password"
								}),
								/* @__PURE__ */ jsx(PasswordInput, {
									id: "password_confirmation",
									name: "password_confirmation",
									autoComplete: "new-password",
									placeholder: "Confirm password"
								}),
								/* @__PURE__ */ jsx(InputError, { message: errors.password_confirmation })
							]
						}),
						/* @__PURE__ */ jsx("div", {
							className: "flex items-center justify-end gap-4 border-t pt-4",
							children: /* @__PURE__ */ jsx(Button, {
								disabled: processing,
								"data-test": "update-password-button",
								children: "Save password"
							})
						})
					] })
				})
			})]
		}),
		canManageTwoFactor && /* @__PURE__ */ jsxs("div", {
			className: "space-y-6",
			children: [
				/* @__PURE__ */ jsx(Heading, {
					variant: "small",
					title: "Two-factor authentication",
					description: "Manage your two-factor authentication settings"
				}),
				twoFactorEnabled ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Card, {
					className: "border-border/80 p-5",
					children: /* @__PURE__ */ jsxs("div", {
						className: "flex flex-col items-start justify-start space-y-4",
						children: [/* @__PURE__ */ jsx("p", {
							className: "text-sm text-muted-foreground",
							children: "You will be prompted for a secure, random pin during login, which you can retrieve from the TOTP-supported application on your phone."
						}), /* @__PURE__ */ jsx("div", {
							className: "relative inline",
							children: /* @__PURE__ */ jsx(Form, {
								...disable.form(),
								children: ({ processing }) => /* @__PURE__ */ jsx(Button, {
									variant: "destructive",
									type: "submit",
									disabled: processing,
									children: "Disable 2FA"
								})
							})
						})]
					})
				}), /* @__PURE__ */ jsx(TwoFactorRecoveryCodes, {
					recoveryCodesList,
					fetchRecoveryCodes,
					errors
				})] }) : /* @__PURE__ */ jsx(Card, {
					className: "border-border/80 p-5",
					children: /* @__PURE__ */ jsxs("div", {
						className: "flex flex-col items-start justify-start space-y-4",
						children: [/* @__PURE__ */ jsx("p", {
							className: "text-sm text-muted-foreground",
							children: "When you enable two-factor authentication, you will be prompted for a secure pin during login. This pin can be retrieved from a TOTP-supported application on your phone."
						}), /* @__PURE__ */ jsx("div", { children: hasSetupData ? /* @__PURE__ */ jsxs(Button, {
							onClick: () => setShowSetupModal(true),
							children: [/* @__PURE__ */ jsx(ShieldCheck, {}), "Continue setup"]
						}) : /* @__PURE__ */ jsx(Form, {
							...enable.form(),
							onSuccess: () => setShowSetupModal(true),
							children: ({ processing }) => /* @__PURE__ */ jsx(Button, {
								type: "submit",
								disabled: processing,
								children: "Enable 2FA"
							})
						}) })]
					})
				}),
				/* @__PURE__ */ jsx(TwoFactorSetupModal, {
					isOpen: showSetupModal,
					onClose: () => setShowSetupModal(false),
					requiresConfirmation,
					twoFactorEnabled,
					qrCodeSvg,
					manualSetupKey,
					clearSetupData,
					fetchSetupData,
					errors
				})
			]
		})
	] });
}
Security.layout = { breadcrumbs: [{
	title: "Security settings",
	href: edit$1()
}] };
//#endregion
//#region resources/js/components/settings/embed-model-picker.tsx
var CUSTOM_VALUE$1 = "__custom__";
var languageLabels = {
	en: "English",
	multilingual: "Multilingual",
	ja: "Japanese"
};
var languageStyles = {
	en: "border-sky-300/40 bg-sky-50 text-sky-700 dark:border-sky-500/30 dark:bg-sky-500/10 dark:text-sky-300",
	multilingual: "border-violet-300/40 bg-violet-50 text-violet-700 dark:border-violet-500/30 dark:bg-violet-500/10 dark:text-violet-300",
	ja: "border-rose-300/40 bg-rose-50 text-rose-700 dark:border-rose-500/30 dark:bg-rose-500/10 dark:text-rose-300"
};
function EmbedModelPicker({ id, label, value, onChange, catalog, currentVectorDim, placeholder }) {
	const { t } = useT();
	const inCatalog = catalog.find((c) => c.id === value);
	const isCustom = value !== "" && !inCatalog;
	const selectValue = value === "" ? "" : isCustom ? CUSTOM_VALUE$1 : value;
	const active = inCatalog ?? null;
	const groups = useMemo(() => {
		const recommended = catalog.filter((e) => e.recommended);
		const rest = catalog.filter((e) => !e.recommended);
		return [{
			key: "recommended",
			label: "Recommended",
			items: recommended
		}, {
			key: "other",
			label: "All models",
			items: rest
		}].filter((g) => g.items.length > 0);
	}, [catalog]);
	const dimensionWillChange = active !== null && active.dimensions !== currentVectorDim;
	return /* @__PURE__ */ jsxs("div", {
		className: "grid gap-1.5",
		children: [
			/* @__PURE__ */ jsx(Label, {
				htmlFor: id,
				children: label
			}),
			/* @__PURE__ */ jsxs(Select, {
				value: selectValue,
				onValueChange: (v) => {
					if (v === CUSTOM_VALUE$1) return;
					onChange(v);
				},
				children: [/* @__PURE__ */ jsx(SelectTrigger, {
					id,
					className: "min-w-[260px]",
					children: /* @__PURE__ */ jsx(SelectValue, { placeholder: placeholder ?? t("Pick an embed model…") })
				}), /* @__PURE__ */ jsxs(SelectContent, {
					className: "max-h-[440px]",
					children: [groups.map((group) => /* @__PURE__ */ jsxs(SelectGroup, { children: [/* @__PURE__ */ jsxs(SelectLabel, {
						className: "text-[10px] tracking-wide text-muted-foreground uppercase",
						children: [
							t(group.label),
							" · ",
							group.items.length
						]
					}), group.items.map((entry) => /* @__PURE__ */ jsx(SelectItem, {
						value: entry.id,
						className: "py-2",
						children: /* @__PURE__ */ jsxs("div", {
							className: "flex w-full items-center justify-between gap-3",
							children: [/* @__PURE__ */ jsxs("div", {
								className: "flex min-w-0 flex-col",
								children: [/* @__PURE__ */ jsxs("span", {
									className: "flex items-center gap-1.5 truncate text-sm font-medium",
									children: [entry.label, entry.recommended && /* @__PURE__ */ jsx(Sparkles, { className: "size-3 text-amber-500" })]
								}), /* @__PURE__ */ jsx("span", {
									className: "truncate text-[10px] text-muted-foreground",
									children: entry.id
								})]
							}), /* @__PURE__ */ jsxs("div", {
								className: "flex shrink-0 items-center gap-1.5",
								children: [
									/* @__PURE__ */ jsxs("span", {
										className: "inline-flex items-center gap-0.5 rounded-full border border-border bg-muted/40 px-1.5 py-0.5 text-[10px] font-medium text-muted-foreground tabular-nums",
										children: [
											/* @__PURE__ */ jsx(Ruler, { className: "size-2.5" }),
											entry.dimensions,
											"d"
										]
									}),
									/* @__PURE__ */ jsxs("span", {
										className: cn("inline-flex items-center gap-0.5 rounded-full border px-1.5 py-0.5 text-[10px] font-medium", languageStyles[entry.languages] ?? "border-border bg-muted text-muted-foreground"),
										children: [/* @__PURE__ */ jsx(Globe, { className: "size-2.5" }), languageLabels[entry.languages] ?? entry.languages]
									}),
									/* @__PURE__ */ jsx("span", {
										className: "rounded-full bg-muted px-1.5 py-0.5 font-mono text-[10px] text-muted-foreground",
										children: entry.cost
									})
								]
							})]
						})
					}, entry.id))] }, group.key)), isCustom && /* @__PURE__ */ jsxs(SelectGroup, { children: [/* @__PURE__ */ jsx(SelectLabel, {
						className: "text-[10px] tracking-wide text-muted-foreground uppercase",
						children: t("Custom")
					}), /* @__PURE__ */ jsx(SelectItem, {
						value: CUSTOM_VALUE$1,
						disabled: true,
						children: /* @__PURE__ */ jsxs("div", {
							className: "flex w-full items-center justify-between gap-3",
							children: [/* @__PURE__ */ jsx("span", {
								className: "text-sm font-medium",
								children: value
							}), /* @__PURE__ */ jsx("span", {
								className: "rounded-full bg-amber-500/20 px-1.5 py-0.5 text-[10px] font-medium text-amber-700 dark:text-amber-300",
								children: t("Custom")
							})]
						})
					})] })]
				})]
			}),
			active && /* @__PURE__ */ jsxs("div", {
				className: "mt-1 flex flex-wrap items-center gap-3 text-[11px] text-muted-foreground",
				children: [
					/* @__PURE__ */ jsxs("span", { children: [
						/* @__PURE__ */ jsx("strong", {
							className: "text-foreground",
							children: active.dimensions
						}),
						" ",
						t("dims")
					] }),
					/* @__PURE__ */ jsxs("span", { children: [
						/* @__PURE__ */ jsx("strong", {
							className: "text-foreground",
							children: active.max_input_tokens.toLocaleString()
						}),
						" ",
						t("max input tokens")
					] }),
					/* @__PURE__ */ jsxs("span", { children: [
						t("Languages:"),
						" ",
						/* @__PURE__ */ jsx("strong", {
							className: "text-foreground",
							children: languageLabels[active.languages] ?? active.languages
						})
					] }),
					/* @__PURE__ */ jsx("span", {
						className: "basis-full",
						children: active.notes
					})
				]
			}),
			dimensionWillChange && active !== null && /* @__PURE__ */ jsxs("div", {
				className: "mt-2 flex items-start gap-2 rounded-md border border-amber-300/50 bg-amber-50 p-2.5 text-xs text-amber-900 dark:border-amber-500/40 dark:bg-amber-500/10 dark:text-amber-200",
				children: [/* @__PURE__ */ jsx(AlertTriangle, { className: "mt-0.5 size-4 shrink-0" }), /* @__PURE__ */ jsxs("div", { children: [
					/* @__PURE__ */ jsx("strong", {
						className: "font-semibold",
						children: t("Vector dimension change")
					}),
					" ",
					"—",
					" ",
					t("current index uses :current dims, this model emits :next dims. After saving you MUST re-index every source so old vectors stop polluting search results.", {
						current: currentVectorDim,
						next: active.dimensions
					})
				] })]
			}),
			isCustom && /* @__PURE__ */ jsx(Input, {
				id: `${id}-custom`,
				value,
				onChange: (e) => onChange(e.target.value),
				placeholder,
				className: "mt-1"
			})
		]
	});
}
//#endregion
//#region resources/js/components/settings/model-picker.tsx
var CUSTOM_VALUE = "__custom__";
var tierStyles = {
	fast: "border-emerald-300/40 bg-emerald-50 text-emerald-700 dark:border-emerald-500/30 dark:bg-emerald-500/10 dark:text-emerald-300",
	medium: "border-amber-300/40 bg-amber-50 text-amber-700 dark:border-amber-500/30 dark:bg-amber-500/10 dark:text-amber-300",
	slow: "border-red-300/40 bg-red-50 text-red-700 dark:border-red-500/30 dark:bg-red-500/10 dark:text-red-300"
};
var tierLabels = {
	fast: "Fast",
	medium: "Medium",
	slow: "Slow"
};
function ModelPicker({ id, label, provider, value, onChange, catalog, initialLatency = null, placeholder, helpText }) {
	const { t } = useT();
	const [latency, setLatency] = useState(initialLatency);
	const [probing, setProbing] = useState(false);
	const [refreshing, setRefreshing] = useState(false);
	const refreshCloudflareModels = async () => {
		setRefreshing(true);
		try {
			const csrf = document.querySelector("meta[name=\"csrf-token\"]")?.getAttribute("content") ?? "";
			const data = await (await fetch("/settings/system/probe/cloudflare-models", {
				method: "POST",
				credentials: "same-origin",
				headers: {
					"Content-Type": "application/json",
					Accept: "application/json",
					"X-CSRF-TOKEN": csrf,
					"X-Requested-With": "XMLHttpRequest"
				}
			})).json();
			if (data.ok) toast.success(t("Pulled :count models from Cloudflare. Reload page.", { count: data.ids?.length ?? 0 }));
			else toast.error(data.error ?? t("Refresh failed."));
		} catch (e) {
			toast.error(e.message ?? t("Could not reach the refresh endpoint."));
		} finally {
			setRefreshing(false);
		}
	};
	const inCatalog = catalog.find((c) => c.id === value);
	const isCustom = value !== "" && !inCatalog;
	const selectValue = value === "" ? "" : isCustom ? CUSTOM_VALUE : value;
	const active = inCatalog ?? null;
	const groups = useMemo(() => {
		const buckets = {
			recommended: [],
			fast: [],
			medium: [],
			slow: []
		};
		for (const entry of catalog) {
			if (entry.recommended) {
				buckets.recommended.push(entry);
				continue;
			}
			buckets[entry.tier].push(entry);
		}
		const sortByTtft = (a, b) => a.ttft_ms - b.ttft_ms;
		return [
			{
				key: "recommended",
				label: "Recommended",
				items: buckets.recommended.sort(sortByTtft)
			},
			{
				key: "fast",
				label: "Fast (< 250ms TTFT)",
				items: buckets.fast.sort(sortByTtft)
			},
			{
				key: "medium",
				label: "Medium (250-600ms)",
				items: buckets.medium.sort(sortByTtft)
			},
			{
				key: "slow",
				label: "Slow (> 600ms)",
				items: buckets.slow.sort(sortByTtft)
			}
		].filter((g) => g.items.length > 0);
	}, [catalog]);
	const probe = async () => {
		if (!value) {
			toast.error(t("Pick a model first."));
			return;
		}
		setProbing(true);
		try {
			const csrf = document.querySelector("meta[name=\"csrf-token\"]")?.getAttribute("content") ?? "";
			const data = await (await fetch("/settings/system/probe/llm-latency", {
				method: "POST",
				credentials: "same-origin",
				headers: {
					"Content-Type": "application/json",
					Accept: "application/json",
					"X-CSRF-TOKEN": csrf,
					"X-Requested-With": "XMLHttpRequest"
				},
				body: JSON.stringify({
					provider,
					model: value,
					force: true
				})
			})).json();
			setLatency(data);
			if (data.ok) toast.success(t("Measured :ms ms TTFT", { ms: data.ttft_ms ?? 0 }));
			else toast.error(data.error ?? t("Probe failed."));
		} catch (e) {
			toast.error(e.message ?? t("Could not reach the probe endpoint."));
		} finally {
			setProbing(false);
		}
	};
	return /* @__PURE__ */ jsxs("div", {
		className: "grid gap-1.5",
		children: [
			/* @__PURE__ */ jsx(Label, {
				htmlFor: id,
				children: label
			}),
			/* @__PURE__ */ jsxs("div", {
				className: "flex flex-wrap items-center gap-2",
				children: [
					/* @__PURE__ */ jsxs(Select, {
						value: selectValue,
						onValueChange: (v) => {
							if (v === CUSTOM_VALUE) return;
							onChange(v);
							setLatency(null);
						},
						children: [/* @__PURE__ */ jsx(SelectTrigger, {
							id,
							className: "min-w-[260px] flex-1",
							children: /* @__PURE__ */ jsx(SelectValue, { placeholder: placeholder ?? t("Pick a model…") })
						}), /* @__PURE__ */ jsxs(SelectContent, {
							className: "max-h-[480px]",
							children: [groups.map((group) => /* @__PURE__ */ jsxs(SelectGroup, { children: [/* @__PURE__ */ jsxs(SelectLabel, {
								className: "text-[10px] tracking-wide text-muted-foreground uppercase",
								children: [
									t(group.label),
									" · ",
									group.items.length
								]
							}), group.items.map((entry) => /* @__PURE__ */ jsx(SelectItem, {
								value: entry.id,
								className: "py-2",
								children: /* @__PURE__ */ jsxs("div", {
									className: "flex w-full items-center justify-between gap-3",
									children: [/* @__PURE__ */ jsxs("div", {
										className: "flex min-w-0 flex-col",
										children: [/* @__PURE__ */ jsxs("span", {
											className: "flex items-center gap-1.5 truncate text-sm font-medium",
											children: [
												entry.label,
												entry.recommended && /* @__PURE__ */ jsx(Sparkles, { className: "size-3 text-amber-500" }),
												entry.supports_tools && /* @__PURE__ */ jsx(Wrench, { className: "size-3 text-muted-foreground" })
											]
										}), /* @__PURE__ */ jsx("span", {
											className: "truncate text-[10px] text-muted-foreground",
											children: entry.id
										})]
									}), /* @__PURE__ */ jsxs("div", {
										className: "flex shrink-0 items-center gap-1.5",
										children: [/* @__PURE__ */ jsxs("span", {
											className: cn("inline-flex items-center gap-0.5 rounded-full border px-1.5 py-0.5 text-[10px] font-medium", tierStyles[entry.tier]),
											children: [
												/* @__PURE__ */ jsx(Gauge, { className: "size-2.5" }),
												"~",
												entry.ttft_ms,
												"ms"
											]
										}), /* @__PURE__ */ jsx("span", {
											className: "rounded-full bg-muted px-1.5 py-0.5 font-mono text-[10px] text-muted-foreground",
											children: entry.cost === "free" ? "free" : entry.cost
										})]
									})]
								})
							}, entry.id))] }, group.key)), isCustom && /* @__PURE__ */ jsxs(SelectGroup, { children: [/* @__PURE__ */ jsx(SelectLabel, {
								className: "text-[10px] tracking-wide text-muted-foreground uppercase",
								children: t("Custom")
							}), /* @__PURE__ */ jsx(SelectItem, {
								value: CUSTOM_VALUE,
								disabled: true,
								children: /* @__PURE__ */ jsxs("div", {
									className: "flex w-full items-center justify-between gap-3",
									children: [/* @__PURE__ */ jsx("span", {
										className: "text-sm font-medium",
										children: value
									}), /* @__PURE__ */ jsx("span", {
										className: "rounded-full bg-amber-500/20 px-1.5 py-0.5 text-[10px] font-medium text-amber-700 dark:text-amber-300",
										children: t("Custom")
									})]
								})
							})] })]
						})]
					}),
					/* @__PURE__ */ jsxs(Button, {
						type: "button",
						variant: "outline",
						size: "sm",
						disabled: probing || !value,
						onClick: probe,
						title: t("Send a 1-token request and measure latency"),
						children: [probing ? /* @__PURE__ */ jsx(Loader2, { className: "me-1.5 size-4 animate-spin" }) : /* @__PURE__ */ jsx(Gauge, { className: "me-1.5 size-4" }), t("Test connection")]
					}),
					provider === "cloudflare" && /* @__PURE__ */ jsxs(Button, {
						type: "button",
						variant: "outline",
						size: "sm",
						disabled: refreshing,
						onClick: refreshCloudflareModels,
						title: t("Fetch the latest model list from Cloudflare Workers AI"),
						children: [refreshing ? /* @__PURE__ */ jsx(Loader2, { className: "me-1.5 size-4 animate-spin" }) : /* @__PURE__ */ jsx(Cloud, { className: "me-1.5 size-4" }), t("Refresh from Cloudflare")]
					})
				]
			}),
			/* @__PURE__ */ jsxs("div", {
				className: "mt-1 flex flex-wrap items-center gap-3 text-[11px] text-muted-foreground",
				children: [
					active && /* @__PURE__ */ jsxs("span", { children: [
						t("Estimated TTFT:"),
						" ",
						/* @__PURE__ */ jsxs("strong", {
							className: "text-foreground",
							children: [
								"~",
								active.ttft_ms,
								"ms"
							]
						}),
						" ",
						"(",
						tierLabels[active.tier],
						")"
					] }),
					latency?.ok && latency.ttft_ms !== null && /* @__PURE__ */ jsxs("span", {
						className: "text-emerald-700 dark:text-emerald-400",
						children: [
							t("Measured:"),
							" ",
							/* @__PURE__ */ jsxs("strong", { children: [latency.ttft_ms, "ms"] }),
							" ",
							latency.total_ms !== null && /* @__PURE__ */ jsxs(Fragment$1, { children: [
								"· total ",
								latency.total_ms,
								"ms"
							] })
						]
					}),
					latency && !latency.ok && latency.error && /* @__PURE__ */ jsxs("span", {
						className: "text-red-700 dark:text-red-400",
						children: [
							t("Probe failed:"),
							" ",
							latency.error
						]
					}),
					active?.notes && /* @__PURE__ */ jsx("span", {
						className: "basis-full text-muted-foreground",
						children: active.notes
					})
				]
			}),
			isCustom && /* @__PURE__ */ jsx(Input, {
				id: `${id}-custom`,
				value,
				onChange: (e) => {
					onChange(e.target.value);
					setLatency(null);
				},
				placeholder,
				className: "mt-1"
			}),
			!isCustom && helpText && /* @__PURE__ */ jsx("p", {
				className: "text-[11px] text-muted-foreground",
				children: helpText
			})
		]
	});
}
//#endregion
//#region resources/js/pages/settings/system.tsx
var system_exports = /* @__PURE__ */ __exportAll({ default: () => SystemSettings });
function StatusPill({ configured }) {
	const { t } = useT();
	return /* @__PURE__ */ jsxs("span", {
		className: `inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-[10px] font-medium tracking-wide uppercase ${configured ? "bg-emerald-500/15 text-emerald-700 dark:text-emerald-400" : "bg-amber-500/15 text-amber-700 dark:text-amber-400"}`,
		children: [configured ? /* @__PURE__ */ jsx(CheckCircle2, { className: "size-3" }) : /* @__PURE__ */ jsx(AlertCircle, { className: "size-3" }), configured ? t("configured") : t("missing")]
	});
}
function ResultBanner({ result }) {
	if (result === null) return null;
	return /* @__PURE__ */ jsxs("div", {
		className: `mt-3 flex items-start gap-2 rounded border p-3 text-xs ${result.ok ? "border-emerald-500/30 bg-emerald-500/5 text-emerald-700 dark:text-emerald-400" : "border-rose-500/30 bg-rose-500/5 text-rose-700 dark:text-rose-400"}`,
		children: [result.ok ? /* @__PURE__ */ jsx(CheckCircle2, { className: "mt-0.5 size-4 shrink-0" }) : /* @__PURE__ */ jsx(AlertCircle, { className: "mt-0.5 size-4 shrink-0" }), /* @__PURE__ */ jsx("span", {
			className: "break-all",
			children: result.message
		})]
	});
}
function SectionShell({ icon: Icon, title, description, statusPill, testEndpoint, testLabel, secondaryTestEndpoint, secondaryTestLabel, children }) {
	const { t } = useT();
	const [runningPrimary, setRunningPrimary] = useState(false);
	const [runningSecondary, setRunningSecondary] = useState(false);
	const [result, setResult] = useState(null);
	const run = async (endpoint, isSecondary) => {
		if (isSecondary) setRunningSecondary(true);
		else setRunningPrimary(true);
		setResult(null);
		try {
			const csrf = document.querySelector("meta[name=\"csrf-token\"]")?.content ?? "";
			const response = await fetch(endpoint, {
				method: "POST",
				headers: {
					"X-CSRF-TOKEN": csrf,
					"X-Requested-With": "XMLHttpRequest",
					Accept: "application/json"
				},
				credentials: "same-origin"
			});
			setResult(await response.json() ?? {
				ok: false,
				message: t("Unexpected response: HTTP :status", { status: response.status })
			});
		} catch (e) {
			setResult({
				ok: false,
				message: e instanceof Error ? e.message : String(e)
			});
		} finally {
			if (isSecondary) setRunningSecondary(false);
			else setRunningPrimary(false);
		}
	};
	return /* @__PURE__ */ jsxs(Card, {
		className: "border-border/80 p-5",
		children: [
			/* @__PURE__ */ jsxs("div", {
				className: "mb-4 flex items-start justify-between gap-3",
				children: [/* @__PURE__ */ jsxs("div", {
					className: "flex items-start gap-3",
					children: [/* @__PURE__ */ jsx("div", {
						className: "rounded-lg bg-foreground/5 p-2",
						children: /* @__PURE__ */ jsx(Icon, { className: "size-4" })
					}), /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsxs("div", {
						className: "flex items-center gap-2",
						children: [/* @__PURE__ */ jsx("h2", {
							className: "font-semibold",
							children: title
						}), statusPill]
					}), /* @__PURE__ */ jsx("p", {
						className: "mt-0.5 text-xs text-muted-foreground",
						children: description
					})] })]
				}), /* @__PURE__ */ jsxs("div", {
					className: "flex flex-wrap items-center gap-2",
					children: [testEndpoint && /* @__PURE__ */ jsxs(Button, {
						size: "sm",
						variant: "outline",
						type: "button",
						onClick: () => run(testEndpoint, false),
						disabled: runningPrimary || runningSecondary,
						children: [runningPrimary ? /* @__PURE__ */ jsx(Loader2, { className: "size-3 animate-spin" }) : null, runningPrimary ? t("Testing…") : testLabel ?? t("Run test")]
					}), secondaryTestEndpoint && /* @__PURE__ */ jsxs(Button, {
						size: "sm",
						variant: "outline",
						type: "button",
						onClick: () => run(secondaryTestEndpoint, true),
						disabled: runningPrimary || runningSecondary,
						children: [runningSecondary ? /* @__PURE__ */ jsx(Loader2, { className: "size-3 animate-spin" }) : null, runningSecondary ? t("Testing…") : secondaryTestLabel ?? t("Run secondary test")]
					})]
				})]
			}),
			/* @__PURE__ */ jsx("div", {
				className: "space-y-4",
				children
			}),
			/* @__PURE__ */ jsx(ResultBanner, { result })
		]
	});
}
function BrandSurfacePreview({ title, caption, icon: Icon, siteTitle, logoUrl, mode, shellClassName, logoClassName, textClassName }) {
	return /* @__PURE__ */ jsxs("div", {
		className: "rounded-xl border border-border/70 bg-card/80 p-3 shadow-sm",
		children: [/* @__PURE__ */ jsxs("div", {
			className: "flex items-center gap-2",
			children: [/* @__PURE__ */ jsx("span", {
				className: "flex size-8 shrink-0 items-center justify-center rounded-lg border border-border/70 bg-background text-muted-foreground shadow-xs",
				children: /* @__PURE__ */ jsx(Icon, { className: "size-4" })
			}), /* @__PURE__ */ jsxs("div", {
				className: "min-w-0",
				children: [/* @__PURE__ */ jsx("p", {
					className: "text-xs font-semibold text-foreground",
					children: title
				}), /* @__PURE__ */ jsx("p", {
					className: "text-[11px] leading-5 text-muted-foreground",
					children: caption
				})]
			})]
		}), /* @__PURE__ */ jsx("div", {
			className: cn("mt-3 flex min-h-[86px] items-center rounded-xl border border-dashed border-border/70 p-3", shellClassName),
			children: /* @__PURE__ */ jsx(BrandLockup, {
				siteTitle,
				logoUrl,
				mode,
				className: "min-w-0 gap-2.5",
				logoClassName: cn("h-9 max-w-[150px]", logoClassName),
				textClassName: cn("truncate text-sm font-semibold tracking-tight text-foreground", textClassName)
			})
		})]
	});
}
function FaviconSurfacePreview({ siteTitle, faviconUrl }) {
	const { t } = useT();
	const initial = (siteTitle.trim().charAt(0) || "S").toUpperCase();
	return /* @__PURE__ */ jsxs("div", {
		className: "rounded-xl border border-border/70 bg-card/80 p-3 shadow-sm",
		children: [/* @__PURE__ */ jsxs("div", {
			className: "flex items-center gap-2",
			children: [/* @__PURE__ */ jsx("span", {
				className: "flex size-8 shrink-0 items-center justify-center rounded-lg border border-border/70 bg-background text-muted-foreground shadow-xs",
				children: /* @__PURE__ */ jsx(Globe2, { className: "size-4" })
			}), /* @__PURE__ */ jsxs("div", {
				className: "min-w-0",
				children: [/* @__PURE__ */ jsx("p", {
					className: "text-xs font-semibold text-foreground",
					children: t("Browser tab")
				}), /* @__PURE__ */ jsx("p", {
					className: "text-[11px] leading-5 text-muted-foreground",
					children: t("Favicon + page title shell")
				})]
			})]
		}), /* @__PURE__ */ jsx("div", {
			className: "mt-3 rounded-xl border border-dashed border-border/70 bg-gradient-to-br from-background to-muted/35 p-3",
			children: /* @__PURE__ */ jsxs("div", {
				className: "flex items-center gap-2 rounded-lg border border-border/70 bg-background px-2.5 py-2 shadow-xs",
				children: [faviconUrl ? /* @__PURE__ */ jsx("img", {
					src: faviconUrl,
					alt: "",
					className: "size-4 shrink-0 rounded-[4px] object-contain"
				}) : /* @__PURE__ */ jsx("span", {
					className: "flex size-4 shrink-0 items-center justify-center rounded-[4px] bg-foreground text-[10px] font-bold text-background",
					children: initial
				}), /* @__PURE__ */ jsx("span", {
					className: "truncate text-xs font-medium text-foreground",
					children: siteTitle || t("Site title")
				})]
			})
		})]
	});
}
function useSelectedFilePreview(selectedFile) {
	const previewUrl = useMemo(() => selectedFile ? URL.createObjectURL(selectedFile) : null, [selectedFile]);
	useEffect(() => {
		if (!previewUrl) return;
		return () => {
			URL.revokeObjectURL(previewUrl);
		};
	}, [previewUrl]);
	return previewUrl;
}
/**
* Dedicated input for sensitive fields. When the server reports the
* value is `_set`, the input shows a "•••• stored" placeholder until
* the admin starts typing — making it obvious that the secret is
* already stored without leaking it.
*/
function SecretInput({ id, value, isSet, onChange, placeholder }) {
	const { t } = useT();
	const fallbackPlaceholder = placeholder ?? t("Leave blank to keep current");
	return /* @__PURE__ */ jsx(Input, {
		id,
		type: "password",
		autoComplete: "off",
		spellCheck: false,
		value,
		placeholder: isSet ? t("•••• stored — leave blank to keep") : fallbackPlaceholder,
		onChange: (e) => onChange(e.target.value)
	});
}
function StripeSection({ summary, initial }) {
	const { t } = useT();
	const form = useForm({
		stripe_key: initial.stripe_key ?? "",
		stripe_secret: "",
		stripe_webhook_secret: "",
		cashier_currency: initial.cashier_currency ?? ""
	});
	const submit = (e) => {
		e.preventDefault();
		form.patch("/settings/system/stripe", { preserveScroll: true });
	};
	return /* @__PURE__ */ jsx(SectionShell, {
		icon: CreditCard,
		title: t("Stripe"),
		description: t("Subscription billing, webhook signatures, and Cashier."),
		statusPill: /* @__PURE__ */ jsx(StatusPill, { configured: summary.configured }),
		testEndpoint: "/settings/system/test/stripe",
		children: /* @__PURE__ */ jsxs("form", {
			onSubmit: submit,
			className: "grid gap-3",
			children: [
				/* @__PURE__ */ jsxs("div", {
					className: "grid gap-1",
					children: [/* @__PURE__ */ jsx(Label, {
						htmlFor: "stripe_key",
						children: t("Public key")
					}), /* @__PURE__ */ jsx(Input, {
						id: "stripe_key",
						autoComplete: "off",
						value: form.data.stripe_key,
						onChange: (e) => form.setData("stripe_key", e.target.value),
						placeholder: "pk_live_…"
					})]
				}),
				/* @__PURE__ */ jsxs("div", {
					className: "grid gap-1",
					children: [/* @__PURE__ */ jsx(Label, {
						htmlFor: "stripe_secret",
						children: t("Secret key")
					}), /* @__PURE__ */ jsx(SecretInput, {
						id: "stripe_secret",
						value: form.data.stripe_secret,
						isSet: initial.stripe_secret_set,
						onChange: (v) => form.setData("stripe_secret", v),
						placeholder: "sk_live_…"
					})]
				}),
				/* @__PURE__ */ jsxs("div", {
					className: "grid gap-1",
					children: [/* @__PURE__ */ jsx(Label, {
						htmlFor: "stripe_webhook_secret",
						children: t("Webhook signing secret")
					}), /* @__PURE__ */ jsx(SecretInput, {
						id: "stripe_webhook_secret",
						value: form.data.stripe_webhook_secret,
						isSet: initial.stripe_webhook_secret_set,
						onChange: (v) => form.setData("stripe_webhook_secret", v),
						placeholder: "whsec_…"
					})]
				}),
				/* @__PURE__ */ jsxs("div", {
					className: "grid gap-1",
					children: [/* @__PURE__ */ jsx(Label, {
						htmlFor: "cashier_currency",
						children: t("Currency")
					}), /* @__PURE__ */ jsx(Input, {
						id: "cashier_currency",
						autoComplete: "off",
						value: form.data.cashier_currency,
						onChange: (e) => form.setData("cashier_currency", e.target.value),
						placeholder: "usd"
					})]
				}),
				/* @__PURE__ */ jsx("div", {
					className: "flex justify-end",
					children: /* @__PURE__ */ jsx(Button, {
						type: "submit",
						disabled: form.processing,
						children: t("Save Stripe")
					})
				})
			]
		})
	});
}
function PayPalSection({ summary, initial }) {
	const { t } = useT();
	const form = useForm({
		paypal_mode: initial.paypal_mode || "sandbox",
		paypal_client_id: initial.paypal_client_id ?? "",
		paypal_client_secret: "",
		paypal_webhook_id: initial.paypal_webhook_id ?? ""
	});
	const submit = (e) => {
		e.preventDefault();
		form.patch("/settings/system/paypal", { preserveScroll: true });
	};
	return /* @__PURE__ */ jsx(SectionShell, {
		icon: Wallet,
		title: t("PayPal"),
		description: t("Subscriptions via PayPal Billing Plans (sandbox or live mode)."),
		statusPill: /* @__PURE__ */ jsx(StatusPill, { configured: summary.configured }),
		testEndpoint: "/settings/system/test/paypal",
		children: /* @__PURE__ */ jsxs("form", {
			onSubmit: submit,
			className: "grid gap-3",
			children: [
				/* @__PURE__ */ jsxs("div", {
					className: "grid gap-1",
					children: [/* @__PURE__ */ jsx(Label, {
						htmlFor: "paypal_mode",
						children: t("Mode")
					}), /* @__PURE__ */ jsxs(Select, {
						value: form.data.paypal_mode || "sandbox",
						onValueChange: (v) => form.setData("paypal_mode", v),
						children: [/* @__PURE__ */ jsx(SelectTrigger, {
							id: "paypal_mode",
							children: /* @__PURE__ */ jsx(SelectValue, {})
						}), /* @__PURE__ */ jsxs(SelectContent, { children: [/* @__PURE__ */ jsx(SelectItem, {
							value: "sandbox",
							children: t("sandbox")
						}), /* @__PURE__ */ jsx(SelectItem, {
							value: "live",
							children: t("live")
						})] })]
					})]
				}),
				/* @__PURE__ */ jsxs("div", {
					className: "grid gap-1",
					children: [/* @__PURE__ */ jsx(Label, {
						htmlFor: "paypal_client_id",
						children: t("Client ID")
					}), /* @__PURE__ */ jsx(Input, {
						id: "paypal_client_id",
						autoComplete: "off",
						value: form.data.paypal_client_id,
						onChange: (e) => form.setData("paypal_client_id", e.target.value),
						placeholder: "Axx…"
					})]
				}),
				/* @__PURE__ */ jsxs("div", {
					className: "grid gap-1",
					children: [/* @__PURE__ */ jsx(Label, {
						htmlFor: "paypal_client_secret",
						children: t("Client secret")
					}), /* @__PURE__ */ jsx(SecretInput, {
						id: "paypal_client_secret",
						value: form.data.paypal_client_secret,
						isSet: initial.paypal_client_secret_set,
						onChange: (v) => form.setData("paypal_client_secret", v),
						placeholder: "EFx…"
					})]
				}),
				/* @__PURE__ */ jsxs("div", {
					className: "grid gap-1",
					children: [/* @__PURE__ */ jsx(Label, {
						htmlFor: "paypal_webhook_id",
						children: t("Webhook ID")
					}), /* @__PURE__ */ jsx(Input, {
						id: "paypal_webhook_id",
						autoComplete: "off",
						value: form.data.paypal_webhook_id,
						onChange: (e) => form.setData("paypal_webhook_id", e.target.value),
						placeholder: "WH-…"
					})]
				}),
				/* @__PURE__ */ jsx("div", {
					className: "flex justify-end",
					children: /* @__PURE__ */ jsx(Button, {
						type: "submit",
						disabled: form.processing,
						children: t("Save PayPal")
					})
				})
			]
		})
	});
}
function RazorpaySection({ summary, initial }) {
	const { t } = useT();
	const form = useForm({
		razorpay_key_id: initial.razorpay_key_id ?? "",
		razorpay_key_secret: "",
		razorpay_webhook_secret: ""
	});
	const submit = (e) => {
		e.preventDefault();
		form.patch("/settings/system/razorpay", { preserveScroll: true });
	};
	return /* @__PURE__ */ jsx(SectionShell, {
		icon: Wallet,
		title: t("Razorpay"),
		description: t("Subscriptions via Razorpay Plans + Subscriptions API (UPI, cards, netbanking)."),
		statusPill: /* @__PURE__ */ jsx(StatusPill, { configured: summary.configured }),
		testEndpoint: "/settings/system/test/razorpay",
		children: /* @__PURE__ */ jsxs("form", {
			onSubmit: submit,
			className: "grid gap-3",
			children: [
				/* @__PURE__ */ jsxs("div", {
					className: "grid gap-1",
					children: [/* @__PURE__ */ jsx(Label, {
						htmlFor: "razorpay_key_id",
						children: t("Key ID")
					}), /* @__PURE__ */ jsx(Input, {
						id: "razorpay_key_id",
						autoComplete: "off",
						value: form.data.razorpay_key_id,
						onChange: (e) => form.setData("razorpay_key_id", e.target.value),
						placeholder: "rzp_test_…"
					})]
				}),
				/* @__PURE__ */ jsxs("div", {
					className: "grid gap-1",
					children: [/* @__PURE__ */ jsx(Label, {
						htmlFor: "razorpay_key_secret",
						children: t("Key secret")
					}), /* @__PURE__ */ jsx(SecretInput, {
						id: "razorpay_key_secret",
						value: form.data.razorpay_key_secret,
						isSet: initial.razorpay_key_secret_set,
						onChange: (v) => form.setData("razorpay_key_secret", v),
						placeholder: t("Key secret from dashboard")
					})]
				}),
				/* @__PURE__ */ jsxs("div", {
					className: "grid gap-1",
					children: [/* @__PURE__ */ jsx(Label, {
						htmlFor: "razorpay_webhook_secret",
						children: t("Webhook secret")
					}), /* @__PURE__ */ jsx(SecretInput, {
						id: "razorpay_webhook_secret",
						value: form.data.razorpay_webhook_secret,
						isSet: initial.razorpay_webhook_secret_set,
						onChange: (v) => form.setData("razorpay_webhook_secret", v),
						placeholder: t("Webhook signing secret")
					})]
				}),
				/* @__PURE__ */ jsx("div", {
					className: "flex justify-end",
					children: /* @__PURE__ */ jsx(Button, {
						type: "submit",
						disabled: form.processing,
						children: t("Save Razorpay")
					})
				})
			]
		})
	});
}
function GatewayTogglesSection({ initial }) {
	const { t } = useT();
	const form = useForm({
		stripe_enabled: initial.stripe_enabled,
		paypal_enabled: initial.paypal_enabled,
		razorpay_enabled: initial.razorpay_enabled
	});
	const submit = (e) => {
		e.preventDefault();
		form.patch("/settings/system/gateways", { preserveScroll: true });
	};
	const toggle = (key) => /* @__PURE__ */ jsxs("label", {
		className: "flex cursor-pointer items-center justify-between rounded border border-border p-3 text-sm",
		children: [/* @__PURE__ */ jsx("span", {
			className: "capitalize",
			children: key.replace("_enabled", "")
		}), /* @__PURE__ */ jsx("input", {
			type: "checkbox",
			checked: form.data[key],
			onChange: (e) => form.setData(key, e.target.checked)
		})]
	});
	return /* @__PURE__ */ jsx(SectionShell, {
		icon: ToggleRight,
		title: t("Payment gateways"),
		description: t("Enable or disable each gateway. Disabled gateways never appear on the customer billing page, even when credentials are configured."),
		children: /* @__PURE__ */ jsxs("form", {
			onSubmit: submit,
			className: "grid gap-3",
			children: [/* @__PURE__ */ jsxs("div", {
				className: "grid gap-2 sm:grid-cols-3",
				children: [
					toggle("stripe_enabled"),
					toggle("paypal_enabled"),
					toggle("razorpay_enabled")
				]
			}), /* @__PURE__ */ jsx("div", {
				className: "flex justify-end",
				children: /* @__PURE__ */ jsx(Button, {
					type: "submit",
					disabled: form.processing,
					children: t("Save gateway toggles")
				})
			})]
		})
	});
}
function CloudflareSection({ summary, initial }) {
	const { t } = useT();
	const form = useForm({
		cloudflare_account_id: initial.cloudflare_account_id ?? "",
		cloudflare_api_token: "",
		cloudflare_chat_model: initial.cloudflare_chat_model ?? "",
		cloudflare_embed_model: initial.cloudflare_embed_model ?? "",
		cloudflare_vectorize_index: initial.cloudflare_vectorize_index ?? "",
		cloudflare_ai_gateway_url: initial.cloudflare_ai_gateway_url ?? "",
		cloudflare_browser_rendering: initial.cloudflare_browser_rendering ?? true
	});
	const submit = (e) => {
		e.preventDefault();
		form.patch("/settings/system/cloudflare", { preserveScroll: true });
	};
	return /* @__PURE__ */ jsx(SectionShell, {
		icon: Sparkles,
		title: t("Cloudflare (Workers AI + Vectorize)"),
		description: /* @__PURE__ */ jsxs(Fragment$1, { children: [
			t("Default chat / embed / vector provider when keys are present. Cloudflare bills your account directly —"),
			" ",
			/* @__PURE__ */ jsx("a", {
				href: "/documentation/cloudflare-costs",
				target: "_blank",
				rel: "noopener noreferrer",
				className: "font-semibold underline-offset-2 hover:underline",
				children: t("what does this cost?")
			})
		] }),
		statusPill: /* @__PURE__ */ jsx(StatusPill, { configured: summary.resolved === "cloudflare" }),
		children: /* @__PURE__ */ jsxs("form", {
			onSubmit: submit,
			className: "grid gap-3",
			children: [
				/* @__PURE__ */ jsxs("div", {
					className: "rounded-md border border-amber-300/30 bg-amber-50/40 p-3 text-xs leading-5 text-amber-900 dark:border-amber-500/20 dark:bg-amber-500/5 dark:text-amber-200",
					children: [
						/* @__PURE__ */ jsx("p", {
							className: "font-semibold",
							children: t("Required token permissions")
						}),
						/* @__PURE__ */ jsx("p", {
							className: "mt-1",
							children: t("Create the token at My Profile → API Tokens → Create Token → Get started → Create Custom Token. Add ALL of these account-scoped permissions or some features will silently break:")
						}),
						/* @__PURE__ */ jsxs("ul", {
							className: "ms-4 mt-2 list-disc space-y-0.5",
							children: [
								/* @__PURE__ */ jsxs("li", { children: [
									/* @__PURE__ */ jsx("span", {
										className: "font-mono text-[11px]",
										children: "Account → Workers AI → Read"
									}),
									" ",
									"—",
									" ",
									t("chat completion + embedding (bge-base-en-v1.5).")
								] }),
								/* @__PURE__ */ jsxs("li", { children: [
									/* @__PURE__ */ jsx("span", {
										className: "font-mono text-[11px]",
										children: "Account → Vectorize → Edit"
									}),
									" ",
									"—",
									" ",
									t("creates the chunks index on first run, upserts vectors, queries on every visitor message.")
								] }),
								/* @__PURE__ */ jsxs("li", { children: [
									/* @__PURE__ */ jsx("span", {
										className: "font-mono text-[11px]",
										children: "Account → Browser Rendering → Edit"
									}),
									" ",
									"—",
									" ",
									t("JS-rendered crawl of customer sites (Shopify, Next.js, Vue, SPA pages).")
								] }),
								/* @__PURE__ */ jsxs("li", { children: [
									/* @__PURE__ */ jsx("span", {
										className: "font-mono text-[11px]",
										children: "Account → Workers R2 Storage → Edit"
									}),
									" ",
									"—",
									" ",
									t("optional, only if you store assets (logos, uploaded source PDFs) in R2.")
								] }),
								/* @__PURE__ */ jsxs("li", { children: [
									/* @__PURE__ */ jsx("span", {
										className: "font-mono text-[11px]",
										children: "Account → Workers Scripts → Edit"
									}),
									" ",
									"—",
									" ",
									t("lets the \"Deploy Cron Worker\" button push the queue-tick Worker for you.")
								] })
							]
						}),
						/* @__PURE__ */ jsxs("p", {
							className: "mt-2",
							children: [
								/* @__PURE__ */ jsx("strong", { children: t("Resources scope:") }),
								" ",
								t("set \"Include — All accounts\" OR pick the specific account whose ID you paste below. Mismatched account = code 10000 \"Authentication error\" on every Vectorize call.")
							]
						}),
						/* @__PURE__ */ jsx("p", {
							className: "mt-2",
							children: /* @__PURE__ */ jsx("a", {
								href: "/documentation/cloudflare-costs",
								target: "_blank",
								rel: "noopener noreferrer",
								className: "font-semibold underline-offset-2 hover:underline",
								children: t("Full setup guide →")
							})
						})
					]
				}),
				/* @__PURE__ */ jsxs("div", {
					className: "grid gap-1",
					children: [
						/* @__PURE__ */ jsx(Label, {
							htmlFor: "cloudflare_account_id",
							children: t("Account ID")
						}),
						/* @__PURE__ */ jsx(Input, {
							id: "cloudflare_account_id",
							autoComplete: "off",
							value: form.data.cloudflare_account_id,
							onChange: (e) => form.setData("cloudflare_account_id", e.target.value)
						}),
						/* @__PURE__ */ jsx("p", {
							className: "text-[11px] text-muted-foreground",
							children: t("Find it on the right sidebar of the Cloudflare dashboard home (32-character hex string).")
						})
					]
				}),
				/* @__PURE__ */ jsxs("div", {
					className: "grid gap-1",
					children: [
						/* @__PURE__ */ jsx(Label, {
							htmlFor: "cloudflare_api_token",
							children: t("API token")
						}),
						/* @__PURE__ */ jsx(SecretInput, {
							id: "cloudflare_api_token",
							value: form.data.cloudflare_api_token,
							isSet: initial.cloudflare_api_token_set,
							onChange: (v) => form.setData("cloudflare_api_token", v)
						}),
						/* @__PURE__ */ jsx("p", {
							className: "text-[11px] text-muted-foreground",
							children: t("Token from My Profile → API Tokens with the permissions listed above. Starts with a long alphanumeric string; treat as a password.")
						})
					]
				}),
				/* @__PURE__ */ jsxs("div", {
					className: "grid gap-3",
					children: [/* @__PURE__ */ jsx(ModelPicker, {
						id: "cloudflare_chat_model",
						label: t("Chat model"),
						provider: "cloudflare",
						value: form.data.cloudflare_chat_model,
						onChange: (v) => form.setData("cloudflare_chat_model", v),
						catalog: summary.model_catalog.cloudflare,
						initialLatency: summary.model_latencies.cloudflare,
						placeholder: "@cf/meta/llama-3.3-70b-instruct-fp8-fast",
						helpText: t("Click \"Test connection\" to measure the real time-to-first-token from this server.")
					}), /* @__PURE__ */ jsx(EmbedModelPicker, {
						id: "cloudflare_embed_model",
						label: t("Embed model"),
						value: form.data.cloudflare_embed_model,
						onChange: (v) => form.setData("cloudflare_embed_model", v),
						catalog: summary.embed_catalog.cloudflare,
						currentVectorDim: summary.current_vector_dim,
						placeholder: "@cf/baai/bge-base-en-v1.5"
					})]
				}),
				/* @__PURE__ */ jsxs("div", {
					className: "grid gap-1",
					children: [/* @__PURE__ */ jsx(Label, {
						htmlFor: "cloudflare_vectorize_index",
						children: t("Vectorize index")
					}), /* @__PURE__ */ jsx(Input, {
						id: "cloudflare_vectorize_index",
						autoComplete: "off",
						value: form.data.cloudflare_vectorize_index,
						onChange: (e) => form.setData("cloudflare_vectorize_index", e.target.value),
						placeholder: "pitchbar-chunks"
					})]
				}),
				/* @__PURE__ */ jsxs("div", {
					className: "grid gap-1",
					children: [
						/* @__PURE__ */ jsx(Label, {
							htmlFor: "cloudflare_ai_gateway_url",
							children: t("AI Gateway URL (optional)")
						}),
						/* @__PURE__ */ jsx(Input, {
							id: "cloudflare_ai_gateway_url",
							type: "url",
							autoComplete: "off",
							value: form.data.cloudflare_ai_gateway_url,
							onChange: (e) => form.setData("cloudflare_ai_gateway_url", e.target.value),
							placeholder: "https://gateway.ai.cloudflare.com/v1/<account>/<gateway>"
						}),
						/* @__PURE__ */ jsx("p", {
							className: "text-xs text-muted-foreground",
							children: t("Route Workers AI calls through Cloudflare AI Gateway for observability + caching. Leave blank to call Workers AI directly.")
						})
					]
				}),
				/* @__PURE__ */ jsxs("label", {
					className: "flex cursor-pointer items-center justify-between rounded border border-border p-3 text-sm",
					children: [/* @__PURE__ */ jsxs("span", { children: [t("Use Cloudflare Browser Rendering for crawled pages"), /* @__PURE__ */ jsx("span", {
						className: "ml-2 text-xs text-muted-foreground",
						children: t("(falls back to Browserless / plain HTTP when disabled)")
					})] }), /* @__PURE__ */ jsx("input", {
						type: "checkbox",
						checked: form.data.cloudflare_browser_rendering,
						onChange: (e) => form.setData("cloudflare_browser_rendering", e.target.checked)
					})]
				}),
				/* @__PURE__ */ jsx("div", {
					className: "flex justify-end",
					children: /* @__PURE__ */ jsx(Button, {
						type: "submit",
						disabled: form.processing,
						children: t("Save Cloudflare")
					})
				})
			]
		})
	});
}
function OpenAiSection({ summary, initial }) {
	const { t } = useT();
	const form = useForm({
		openai_api_key: "",
		openai_chat_model: initial.openai_chat_model ?? "",
		openai_embed_model: initial.openai_embed_model ?? ""
	});
	const submit = (e) => {
		e.preventDefault();
		form.patch("/settings/system/openai", { preserveScroll: true });
	};
	return /* @__PURE__ */ jsx(SectionShell, {
		icon: Sparkles,
		title: t("OpenAI"),
		description: t("Fallback / quality-bump for chat + embed fallback when CF embed fails."),
		statusPill: /* @__PURE__ */ jsx(StatusPill, { configured: initial.openai_api_key_set }),
		children: /* @__PURE__ */ jsxs("form", {
			onSubmit: submit,
			className: "grid gap-3",
			children: [
				/* @__PURE__ */ jsxs("div", {
					className: "grid gap-1",
					children: [/* @__PURE__ */ jsx(Label, {
						htmlFor: "openai_api_key",
						children: t("API key")
					}), /* @__PURE__ */ jsx(SecretInput, {
						id: "openai_api_key",
						value: form.data.openai_api_key,
						isSet: initial.openai_api_key_set,
						onChange: (v) => form.setData("openai_api_key", v),
						placeholder: "sk-…"
					})]
				}),
				/* @__PURE__ */ jsxs("div", {
					className: "grid gap-3",
					children: [/* @__PURE__ */ jsx(ModelPicker, {
						id: "openai_chat_model",
						label: t("Chat model"),
						provider: "openai",
						value: form.data.openai_chat_model,
						onChange: (v) => form.setData("openai_chat_model", v),
						catalog: summary.model_catalog.openai,
						initialLatency: summary.model_latencies.openai,
						placeholder: "gpt-4o-mini",
						helpText: t("Click \"Test connection\" to measure the real time-to-first-token from this server.")
					}), /* @__PURE__ */ jsx(EmbedModelPicker, {
						id: "openai_embed_model",
						label: t("Embed model"),
						value: form.data.openai_embed_model,
						onChange: (v) => form.setData("openai_embed_model", v),
						catalog: summary.embed_catalog.openai,
						currentVectorDim: summary.current_vector_dim,
						placeholder: "text-embedding-3-small"
					})]
				}),
				/* @__PURE__ */ jsx("div", {
					className: "flex justify-end",
					children: /* @__PURE__ */ jsx(Button, {
						type: "submit",
						disabled: form.processing,
						children: t("Save OpenAI")
					})
				})
			]
		})
	});
}
function OpenRouterSection({ summary, initial }) {
	const { t } = useT();
	const form = useForm({
		openrouter_api_key: "",
		openrouter_chat_model: initial.openrouter_chat_model ?? ""
	});
	const submit = (e) => {
		e.preventDefault();
		form.patch("/settings/system/openrouter", { preserveScroll: true });
	};
	return /* @__PURE__ */ jsx(SectionShell, {
		icon: Sparkles,
		title: t("OpenRouter"),
		description: t("Free-tier chat models. Only used when LLM_PROVIDER is set to openrouter explicitly."),
		statusPill: /* @__PURE__ */ jsx(StatusPill, { configured: initial.openrouter_api_key_set }),
		children: /* @__PURE__ */ jsxs("form", {
			onSubmit: submit,
			className: "grid gap-3",
			children: [
				/* @__PURE__ */ jsxs("div", {
					className: "grid gap-1",
					children: [/* @__PURE__ */ jsx(Label, {
						htmlFor: "openrouter_api_key",
						children: t("API key")
					}), /* @__PURE__ */ jsx(SecretInput, {
						id: "openrouter_api_key",
						value: form.data.openrouter_api_key,
						isSet: initial.openrouter_api_key_set,
						onChange: (v) => form.setData("openrouter_api_key", v),
						placeholder: "sk-or-…"
					})]
				}),
				/* @__PURE__ */ jsx(ModelPicker, {
					id: "openrouter_chat_model",
					label: t("Chat model"),
					provider: "openrouter",
					value: form.data.openrouter_chat_model,
					onChange: (v) => form.setData("openrouter_chat_model", v),
					catalog: summary.model_catalog.openrouter,
					initialLatency: summary.model_latencies.openrouter,
					placeholder: "meta-llama/llama-3.3-70b-instruct:free",
					helpText: t("Click \"Test connection\" to measure the real time-to-first-token from this server.")
				}),
				/* @__PURE__ */ jsx("div", {
					className: "flex justify-end",
					children: /* @__PURE__ */ jsx(Button, {
						type: "submit",
						disabled: form.processing,
						children: t("Save OpenRouter")
					})
				})
			]
		})
	});
}
function RoutingSection({ initial }) {
	const { t } = useT();
	const form = useForm({
		llm_provider: initial.llm_provider ?? "",
		vector_provider: initial.vector_provider ?? ""
	});
	const submit = (e) => {
		e.preventDefault();
		form.patch("/settings/system/routing", { preserveScroll: true });
	};
	return /* @__PURE__ */ jsx(SectionShell, {
		icon: Route,
		title: t("Provider routing"),
		description: t("Force a specific LLM or vector provider. Leave blank to auto-pick from configured keys."),
		children: /* @__PURE__ */ jsxs("form", {
			onSubmit: submit,
			className: "grid gap-3",
			children: [/* @__PURE__ */ jsxs("div", {
				className: "grid gap-3 sm:grid-cols-2",
				children: [/* @__PURE__ */ jsxs("div", {
					className: "grid gap-1",
					children: [/* @__PURE__ */ jsx(Label, {
						htmlFor: "llm_provider",
						children: "LLM_PROVIDER"
					}), /* @__PURE__ */ jsxs(Select, {
						value: form.data.llm_provider || "auto",
						onValueChange: (v) => form.setData("llm_provider", v === "auto" ? "" : v),
						children: [/* @__PURE__ */ jsx(SelectTrigger, {
							id: "llm_provider",
							children: /* @__PURE__ */ jsx(SelectValue, {})
						}), /* @__PURE__ */ jsxs(SelectContent, { children: [
							/* @__PURE__ */ jsx(SelectItem, {
								value: "auto",
								children: t("auto (from keys)")
							}),
							/* @__PURE__ */ jsx(SelectItem, {
								value: "cloudflare",
								children: "cloudflare"
							}),
							/* @__PURE__ */ jsx(SelectItem, {
								value: "openai",
								children: "openai"
							}),
							/* @__PURE__ */ jsx(SelectItem, {
								value: "openrouter",
								children: "openrouter"
							})
						] })]
					})]
				}), /* @__PURE__ */ jsxs("div", {
					className: "grid gap-1",
					children: [/* @__PURE__ */ jsx(Label, {
						htmlFor: "vector_provider",
						children: "VECTOR_PROVIDER"
					}), /* @__PURE__ */ jsxs(Select, {
						value: form.data.vector_provider || "auto",
						onValueChange: (v) => form.setData("vector_provider", v === "auto" ? "" : v),
						children: [/* @__PURE__ */ jsx(SelectTrigger, {
							id: "vector_provider",
							children: /* @__PURE__ */ jsx(SelectValue, {})
						}), /* @__PURE__ */ jsxs(SelectContent, { children: [
							/* @__PURE__ */ jsx(SelectItem, {
								value: "auto",
								children: t("auto (from keys)")
							}),
							/* @__PURE__ */ jsx(SelectItem, {
								value: "cloudflare",
								children: "cloudflare"
							}),
							/* @__PURE__ */ jsx(SelectItem, {
								value: "qdrant",
								children: "qdrant"
							})
						] })]
					})]
				})]
			}), /* @__PURE__ */ jsx("div", {
				className: "flex justify-end",
				children: /* @__PURE__ */ jsx(Button, {
					type: "submit",
					disabled: form.processing,
					children: t("Save routing")
				})
			})]
		})
	});
}
function AdminDigestSection({ initial }) {
	const { t } = useT();
	const form = useForm({ admin_daily_digest_enabled: initial.admin_daily_digest_enabled ?? false });
	const submit = (e) => {
		e.preventDefault();
		form.patch("/settings/system/notifications", { preserveScroll: true });
	};
	return /* @__PURE__ */ jsx(SectionShell, {
		icon: Sparkles,
		title: t("Daily admin digest"),
		description: t("Email every super_admin a 24-hour summary of new users, new paid subscriptions, new workspaces, and new leads captured platform-wide. The summary is sent at 09:00 UTC every day via the scheduled command admin:send-daily-digest. Disable to stop the emails — opt-in by default."),
		children: /* @__PURE__ */ jsxs("form", {
			onSubmit: submit,
			className: "grid gap-3",
			children: [/* @__PURE__ */ jsxs("label", {
				className: "flex cursor-pointer items-center justify-between rounded border border-border p-3 text-sm",
				children: [/* @__PURE__ */ jsx("span", { children: t("Send a daily summary email to every super_admin") }), /* @__PURE__ */ jsx("input", {
					type: "checkbox",
					checked: form.data.admin_daily_digest_enabled,
					onChange: (e) => form.setData("admin_daily_digest_enabled", e.target.checked)
				})]
			}), /* @__PURE__ */ jsx("div", {
				className: "flex justify-end",
				children: /* @__PURE__ */ jsx(Button, {
					type: "submit",
					disabled: form.processing,
					children: t("Save digest preference")
				})
			})]
		})
	});
}
function WordpressPluginSection({ initial }) {
	const { t } = useT();
	const form = useForm({
		wordpress_plugin_download_url: initial.wordpress_plugin_download_url ?? "",
		wordpress_plugin_help_text: initial.wordpress_plugin_help_text ?? ""
	});
	const submit = (e) => {
		e.preventDefault();
		form.patch("/settings/system/wordpress_plugin", { preserveScroll: true });
	};
	return /* @__PURE__ */ jsx(SectionShell, {
		icon: Sparkles,
		title: t("WordPress plugin distribution"),
		description: t("Override the help blurb + download link shown on every workspace's Integrations → WordPress card. Leave blank to keep the default text. Use the URL field to point customers to your own plugin mirror (WordPress.org listing, S3 bucket, marketing site, etc.)."),
		children: /* @__PURE__ */ jsxs("form", {
			onSubmit: submit,
			className: "grid gap-3",
			children: [
				/* @__PURE__ */ jsxs("div", {
					className: "grid gap-1.5",
					children: [
						/* @__PURE__ */ jsx(Label, {
							htmlFor: "wp-plugin-url",
							children: t("Download URL")
						}),
						/* @__PURE__ */ jsx("input", {
							id: "wp-plugin-url",
							type: "url",
							placeholder: "https://yourdomain.com/plugin/pitchbar.zip",
							value: form.data.wordpress_plugin_download_url,
							onChange: (e) => form.setData("wordpress_plugin_download_url", e.target.value),
							className: "rounded border border-border bg-background px-3 py-2 text-sm"
						}),
						form.errors.wordpress_plugin_download_url && /* @__PURE__ */ jsx("p", {
							className: "text-xs text-destructive",
							children: form.errors.wordpress_plugin_download_url
						})
					]
				}),
				/* @__PURE__ */ jsxs("div", {
					className: "grid gap-1.5",
					children: [
						/* @__PURE__ */ jsx(Label, {
							htmlFor: "wp-plugin-text",
							children: t("Help text")
						}),
						/* @__PURE__ */ jsx("textarea", {
							id: "wp-plugin-text",
							rows: 3,
							placeholder: t("Need the plugin? Download it below, or read the setup guide:"),
							value: form.data.wordpress_plugin_help_text,
							onChange: (e) => form.setData("wordpress_plugin_help_text", e.target.value),
							className: "rounded border border-border bg-background px-3 py-2 text-sm"
						}),
						form.errors.wordpress_plugin_help_text && /* @__PURE__ */ jsx("p", {
							className: "text-xs text-destructive",
							children: form.errors.wordpress_plugin_help_text
						})
					]
				}),
				/* @__PURE__ */ jsx("div", {
					className: "flex justify-end",
					children: /* @__PURE__ */ jsx(Button, {
						type: "submit",
						disabled: form.processing,
						children: t("Save plugin link")
					})
				})
			]
		})
	});
}
function SignupVerificationSection({ initial }) {
	const { t } = useT();
	const form = useForm({ require_email_verification: initial.require_email_verification ?? false });
	const submit = (e) => {
		e.preventDefault();
		form.patch("/settings/system/signup", { preserveScroll: true });
	};
	return /* @__PURE__ */ jsx(SectionShell, {
		icon: Sparkles,
		title: t("Email verification on signup"),
		description: t("When enabled, new users must click a verification link emailed to them before they can sign in. When disabled, signups are auto-verified and can log in immediately. Most B2B SaaS keeps this off so the very first signup-to-magic-moment funnel is friction-free."),
		children: /* @__PURE__ */ jsxs("form", {
			onSubmit: submit,
			className: "grid gap-3",
			children: [/* @__PURE__ */ jsxs("label", {
				className: "flex cursor-pointer items-center justify-between rounded border border-border p-3 text-sm",
				children: [/* @__PURE__ */ jsx("span", { children: t("Require email verification before first login") }), /* @__PURE__ */ jsx("input", {
					type: "checkbox",
					checked: form.data.require_email_verification,
					onChange: (e) => form.setData("require_email_verification", e.target.checked)
				})]
			}), /* @__PURE__ */ jsx("div", {
				className: "flex justify-end",
				children: /* @__PURE__ */ jsx(Button, {
					type: "submit",
					disabled: form.processing,
					children: t("Save signup setting")
				})
			})]
		})
	});
}
function ByokGlobalSection({ initial }) {
	const { t } = useT();
	const form = useForm({ byok_enabled_globally: initial.byok_enabled_globally });
	const submit = (e) => {
		e.preventDefault();
		form.patch("/settings/system/byok", { preserveScroll: true });
	};
	return /* @__PURE__ */ jsx(SectionShell, {
		icon: Sparkles,
		title: t("Bring Your Own Keys (BYOK)"),
		description: t("When enabled, every workspace must supply its own Cloudflare / OpenAI / OpenRouter / Qdrant credentials in Settings → BYOK Keys. The platform keys configured above will not resolve for any tenant. Per-user overrides on the /admin/users page still apply."),
		children: /* @__PURE__ */ jsxs("form", {
			onSubmit: submit,
			className: "grid gap-3",
			children: [/* @__PURE__ */ jsxs("label", {
				className: "flex cursor-pointer items-center justify-between rounded border border-border p-3 text-sm",
				children: [/* @__PURE__ */ jsx("span", { children: t("Force every workspace to use their own AI keys") }), /* @__PURE__ */ jsx("input", {
					type: "checkbox",
					checked: form.data.byok_enabled_globally,
					onChange: (e) => form.setData("byok_enabled_globally", e.target.checked)
				})]
			}), /* @__PURE__ */ jsx("div", {
				className: "flex justify-end",
				children: /* @__PURE__ */ jsx(Button, {
					type: "submit",
					disabled: form.processing,
					children: t("Save BYOK gate")
				})
			})]
		})
	});
}
function MailSection({ summary, initial }) {
	const { t } = useT();
	const brand = useBranding().site_title || "Pitchbar";
	const form = useForm({
		mail_driver: initial.mail_driver ?? "",
		mail_host: initial.mail_host ?? "",
		mail_port: initial.mail_port ? String(initial.mail_port) : "",
		mail_encryption: initial.mail_encryption ?? "",
		mail_username: initial.mail_username ?? "",
		mail_password: "",
		mail_from_address: initial.mail_from_address ?? "",
		mail_from_name: initial.mail_from_name ?? ""
	});
	const submit = (e) => {
		e.preventDefault();
		form.patch("/settings/system/mail", { preserveScroll: true });
	};
	return /* @__PURE__ */ jsx(SectionShell, {
		icon: Mail,
		title: t("Mail (SMTP)"),
		description: t("Outbound transactional email. Raw SMTP test probes the mail driver only. Lead-email test goes through the queue worker too — use it to confirm the full lead-captured pipeline."),
		statusPill: /* @__PURE__ */ jsx(StatusPill, { configured: summary.configured }),
		testEndpoint: "/settings/system/test/mail",
		testLabel: t("Send raw SMTP test"),
		secondaryTestEndpoint: "/settings/system/test/lead-email",
		secondaryTestLabel: t("Send test lead email"),
		children: /* @__PURE__ */ jsxs("form", {
			onSubmit: submit,
			className: "grid gap-3",
			children: [
				/* @__PURE__ */ jsxs("div", {
					className: "grid gap-3 sm:grid-cols-2",
					children: [/* @__PURE__ */ jsxs("div", {
						className: "grid gap-1",
						children: [/* @__PURE__ */ jsx(Label, {
							htmlFor: "mail_driver",
							children: t("Driver")
						}), /* @__PURE__ */ jsx(Input, {
							id: "mail_driver",
							autoComplete: "off",
							value: form.data.mail_driver,
							onChange: (e) => form.setData("mail_driver", e.target.value),
							placeholder: "smtp"
						})]
					}), /* @__PURE__ */ jsxs("div", {
						className: "grid gap-1",
						children: [/* @__PURE__ */ jsx(Label, {
							htmlFor: "mail_host",
							children: t("Host")
						}), /* @__PURE__ */ jsx(Input, {
							id: "mail_host",
							autoComplete: "off",
							value: form.data.mail_host,
							onChange: (e) => form.setData("mail_host", e.target.value),
							placeholder: "smtp.example.com"
						})]
					})]
				}),
				/* @__PURE__ */ jsxs("div", {
					className: "grid gap-3 sm:grid-cols-3",
					children: [
						/* @__PURE__ */ jsxs("div", {
							className: "grid gap-1",
							children: [/* @__PURE__ */ jsx(Label, {
								htmlFor: "mail_port",
								children: t("Port")
							}), /* @__PURE__ */ jsx(Input, {
								id: "mail_port",
								type: "number",
								autoComplete: "off",
								value: form.data.mail_port,
								onChange: (e) => form.setData("mail_port", e.target.value),
								placeholder: "587"
							})]
						}),
						/* @__PURE__ */ jsxs("div", {
							className: "grid gap-1",
							children: [/* @__PURE__ */ jsx(Label, {
								htmlFor: "mail_encryption",
								children: t("Encryption")
							}), /* @__PURE__ */ jsxs(Select, {
								value: form.data.mail_encryption || "none",
								onValueChange: (v) => form.setData("mail_encryption", v === "none" ? "" : v),
								children: [/* @__PURE__ */ jsx(SelectTrigger, {
									id: "mail_encryption",
									children: /* @__PURE__ */ jsx(SelectValue, {})
								}), /* @__PURE__ */ jsxs(SelectContent, { children: [
									/* @__PURE__ */ jsx(SelectItem, {
										value: "none",
										children: t("none")
									}),
									/* @__PURE__ */ jsx(SelectItem, {
										value: "tls",
										children: "tls"
									}),
									/* @__PURE__ */ jsx(SelectItem, {
										value: "ssl",
										children: "ssl"
									})
								] })]
							})]
						}),
						/* @__PURE__ */ jsxs("div", {
							className: "grid gap-1",
							children: [/* @__PURE__ */ jsx(Label, {
								htmlFor: "mail_username",
								children: t("Username")
							}), /* @__PURE__ */ jsx(Input, {
								id: "mail_username",
								autoComplete: "off",
								value: form.data.mail_username,
								onChange: (e) => form.setData("mail_username", e.target.value)
							})]
						})
					]
				}),
				/* @__PURE__ */ jsxs("div", {
					className: "grid gap-1",
					children: [/* @__PURE__ */ jsx(Label, {
						htmlFor: "mail_password",
						children: t("Password")
					}), /* @__PURE__ */ jsx(SecretInput, {
						id: "mail_password",
						value: form.data.mail_password,
						isSet: initial.mail_password_set,
						onChange: (v) => form.setData("mail_password", v)
					})]
				}),
				/* @__PURE__ */ jsxs("div", {
					className: "grid gap-3 sm:grid-cols-2",
					children: [/* @__PURE__ */ jsxs("div", {
						className: "grid gap-1",
						children: [/* @__PURE__ */ jsx(Label, {
							htmlFor: "mail_from_address",
							children: t("From address")
						}), /* @__PURE__ */ jsx(Input, {
							id: "mail_from_address",
							type: "email",
							autoComplete: "off",
							value: form.data.mail_from_address,
							onChange: (e) => form.setData("mail_from_address", e.target.value),
							placeholder: "hello@example.com"
						})]
					}), /* @__PURE__ */ jsxs("div", {
						className: "grid gap-1",
						children: [/* @__PURE__ */ jsx(Label, {
							htmlFor: "mail_from_name",
							children: t("From name")
						}), /* @__PURE__ */ jsx(Input, {
							id: "mail_from_name",
							autoComplete: "off",
							value: form.data.mail_from_name,
							onChange: (e) => form.setData("mail_from_name", e.target.value),
							placeholder: brand
						})]
					})]
				}),
				/* @__PURE__ */ jsx("div", {
					className: "flex justify-end",
					children: /* @__PURE__ */ jsx(Button, {
						type: "submit",
						disabled: form.processing,
						children: t("Save mail")
					})
				})
			]
		})
	});
}
/**
* Live health card for the Cloudflare cron Worker. Reads the
* `cron_tick_logs` aggregate the controller folded into the page
* payload. Answers the single question: "is the worker actually
* firing AND actually doing work?"
*/
function CronWorkerHealth({ summary }) {
	const { t } = useT();
	const liveness = summary.liveness ?? "unknown";
	const sinceLast = summary.seconds_since_last_tick;
	const lastTickAt = summary.last_tick_at;
	const recent = summary.recent_ticks ?? [];
	const livenessTone = liveness === "live" ? "border-emerald-300 bg-emerald-50 text-emerald-900 dark:bg-emerald-950/40 dark:text-emerald-100" : liveness === "stale" ? "border-amber-300 bg-amber-50 text-amber-900 dark:bg-amber-950/40 dark:text-amber-100" : liveness === "dead" ? "border-rose-300 bg-rose-50 text-rose-900 dark:bg-rose-950/40 dark:text-rose-100" : "border-slate-300 bg-slate-50 text-slate-900 dark:bg-slate-900/40 dark:text-slate-100";
	const livenessLabel = liveness === "live" ? t("Live — firing on schedule") : liveness === "stale" ? t("Stale — last tick > 90s ago") : liveness === "dead" ? t("Dead — no tick in last 5 minutes") : t("Waiting for first tick");
	const sinceText = (() => {
		if (sinceLast === null || sinceLast === void 0) return t("No ticks yet — give the cron 60s after deploy.");
		if (sinceLast < 60) return t("Last tick :sec s ago", { sec: sinceLast });
		return t("Last tick :min m :sec s ago", {
			min: Math.floor(sinceLast / 60),
			sec: sinceLast % 60
		});
	})();
	return /* @__PURE__ */ jsxs("div", {
		className: "grid gap-3",
		children: [
			/* @__PURE__ */ jsx("div", {
				className: `rounded-md border p-4 ${livenessTone}`,
				children: /* @__PURE__ */ jsxs("div", {
					className: "flex items-center justify-between gap-3",
					children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
						className: "text-sm font-semibold",
						children: livenessLabel
					}), /* @__PURE__ */ jsxs("p", {
						className: "mt-0.5 text-xs opacity-80",
						children: [sinceText, lastTickAt && /* @__PURE__ */ jsxs(Fragment$1, { children: [" · ", new Date(lastTickAt).toLocaleString()] })]
					})] }), /* @__PURE__ */ jsx("span", { className: `inline-flex size-2.5 rounded-full ${liveness === "live" ? "animate-pulse bg-emerald-500" : liveness === "stale" ? "bg-amber-500" : liveness === "dead" ? "bg-rose-500" : "bg-slate-400"}` })]
				})
			}),
			/* @__PURE__ */ jsxs("div", {
				className: "grid gap-3 sm:grid-cols-4",
				children: [
					/* @__PURE__ */ jsx(HealthStat, {
						label: t("Ticks (last hour)"),
						value: summary.ticks_last_hour ?? 0,
						hint: t("should be ≈ 60 when live")
					}),
					/* @__PURE__ */ jsx(HealthStat, {
						label: t("Jobs processed (1h)"),
						value: summary.jobs_processed_last_hour ?? 0
					}),
					/* @__PURE__ */ jsx(HealthStat, {
						label: t("Pending in queue"),
						value: summary.pending_jobs ?? 0,
						tone: (summary.pending_jobs ?? 0) > 100 ? "warn" : "normal"
					}),
					/* @__PURE__ */ jsx(HealthStat, {
						label: t("Failed jobs"),
						value: summary.failed_jobs ?? 0,
						tone: (summary.failed_jobs ?? 0) > 0 ? "warn" : "normal"
					})
				]
			}),
			recent.length > 0 && /* @__PURE__ */ jsxs("details", {
				className: "rounded-md border border-border bg-muted/20 p-3",
				children: [/* @__PURE__ */ jsx("summary", {
					className: "cursor-pointer text-xs font-semibold tracking-wide text-muted-foreground uppercase",
					children: t("Recent ticks (:count)", { count: recent.length })
				}), /* @__PURE__ */ jsx("div", {
					className: "mt-3 overflow-x-auto",
					children: /* @__PURE__ */ jsxs("table", {
						className: "w-full text-xs",
						children: [/* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", {
							className: "border-b border-border text-start text-muted-foreground",
							children: [
								/* @__PURE__ */ jsx("th", {
									className: "px-2 py-1.5 font-medium",
									children: t("When")
								}),
								/* @__PURE__ */ jsx("th", {
									className: "px-2 py-1.5 font-medium",
									children: t("Processed")
								}),
								/* @__PURE__ */ jsx("th", {
									className: "px-2 py-1.5 font-medium",
									children: t("Failed")
								}),
								/* @__PURE__ */ jsx("th", {
									className: "px-2 py-1.5 font-medium",
									children: t("Remaining")
								}),
								/* @__PURE__ */ jsx("th", {
									className: "px-2 py-1.5 font-medium",
									children: t("Elapsed")
								})
							]
						}) }), /* @__PURE__ */ jsx("tbody", {
							className: "font-mono",
							children: recent.map((r, i) => /* @__PURE__ */ jsxs("tr", {
								className: "border-b border-border/40 last:border-0",
								children: [
									/* @__PURE__ */ jsx("td", {
										className: "px-2 py-1.5",
										children: r.at ? new Date(r.at).toLocaleTimeString() : "-"
									}),
									/* @__PURE__ */ jsx("td", {
										className: "px-2 py-1.5 text-emerald-700",
										children: r.processed
									}),
									/* @__PURE__ */ jsx("td", {
										className: `px-2 py-1.5 ${r.failed > 0 ? "text-rose-600" : ""}`,
										children: r.failed
									}),
									/* @__PURE__ */ jsx("td", {
										className: "px-2 py-1.5",
										children: r.remaining
									}),
									/* @__PURE__ */ jsxs("td", {
										className: "px-2 py-1.5",
										children: [r.ms, " ms"]
									})
								]
							}, i))
						})]
					})
				})]
			})
		]
	});
}
function HealthStat({ label, value, hint, tone = "normal" }) {
	return /* @__PURE__ */ jsxs("div", {
		className: `rounded-md border p-3 ${tone === "warn" ? "border-amber-300 bg-amber-50/40" : "border-border bg-muted/20"}`,
		children: [
			/* @__PURE__ */ jsx("p", {
				className: "text-[11px] font-medium tracking-wide text-muted-foreground uppercase",
				children: label
			}),
			/* @__PURE__ */ jsx("p", {
				className: "mt-1 font-mono text-lg font-semibold",
				children: value
			}),
			hint && /* @__PURE__ */ jsx("p", {
				className: "mt-0.5 text-[10px] text-muted-foreground/80",
				children: hint
			})
		]
	});
}
function CronWorkerSection({ summary }) {
	const { t } = useT();
	const confirm = useConfirm();
	const [pending, setPending] = useState(false);
	const [result, setResult] = useState(null);
	const [deployed, setDeployed] = useState(summary.deployed);
	const [workerName, setWorkerName] = useState(summary.worker_name);
	const [deployedAt, setDeployedAt] = useState(summary.deployed_at);
	const csrf = document.querySelector("meta[name=\"csrf-token\"]")?.content ?? "";
	const call = async (method, path) => {
		return fetch(path, {
			method,
			credentials: "same-origin",
			headers: {
				"Content-Type": "application/json",
				Accept: "application/json",
				"X-CSRF-TOKEN": csrf,
				"X-Requested-With": "XMLHttpRequest"
			}
		});
	};
	const onDeploy = async () => {
		setPending(true);
		setResult(null);
		try {
			const res = await call("POST", "/settings/system/cron-worker/deploy");
			const json = await res.json();
			if (!res.ok) {
				setResult({
					ok: false,
					message: json?.error?.message ?? t("Deploy failed (HTTP :status).", { status: res.status })
				});
				return;
			}
			const data = json.data;
			setDeployed(true);
			setWorkerName(data.worker_name);
			setDeployedAt(data.deployed_at);
			setResult({
				ok: true,
				message: t("Deployed. Cloudflare will run the worker every minute."),
				worker_url: data.worker_url
			});
		} catch (e) {
			setResult({
				ok: false,
				message: e instanceof Error ? e.message : t("Network error reaching the deploy endpoint.")
			});
		} finally {
			setPending(false);
		}
	};
	const onRemove = async () => {
		if (!await confirm({
			title: t("Remove worker?"),
			message: t("Remove the deployed Cloudflare worker? Your queue will stop processing until you re-deploy or set up another cron source."),
			confirmLabel: t("Remove"),
			danger: true
		})) return;
		setPending(true);
		setResult(null);
		try {
			const res = await call("DELETE", "/settings/system/cron-worker");
			if (!res.ok) {
				setResult({
					ok: false,
					message: (await res.json())?.error?.message ?? t("Remove failed (HTTP :status).", { status: res.status })
				});
				return;
			}
			setDeployed(false);
			setWorkerName(null);
			setDeployedAt(null);
			setResult({
				ok: true,
				message: t("Worker removed.")
			});
		} catch (e) {
			setResult({
				ok: false,
				message: e instanceof Error ? e.message : t("Network error.")
			});
		} finally {
			setPending(false);
		}
	};
	return /* @__PURE__ */ jsx(SectionShell, {
		icon: Workflow,
		title: t("Cloudflare Cron Worker"),
		description: t("One-click deploy: run your queue from Cloudflare's free cron infrastructure. No cPanel cron required."),
		statusPill: /* @__PURE__ */ jsx(StatusPill, { configured: deployed }),
		children: /* @__PURE__ */ jsxs("div", {
			className: "grid gap-4",
			children: [
				!summary.cloudflare_configured && /* @__PURE__ */ jsxs("div", {
					className: "rounded-md border border-amber-300 bg-amber-50 p-3 text-sm text-amber-900",
					children: [
						t("Save your Cloudflare account ID + API token under"),
						" ",
						/* @__PURE__ */ jsx("strong", { children: t("AI providers → Cloudflare") }),
						" ",
						t("first. The same credentials drive Workers AI and the queue cron.")
					]
				}),
				deployed && /* @__PURE__ */ jsx(CronWorkerHealth, { summary }),
				/* @__PURE__ */ jsxs("div", {
					className: "rounded-md border border-border bg-muted/30 p-3 text-xs",
					children: [/* @__PURE__ */ jsx("p", {
						className: "text-muted-foreground",
						children: t("The worker pings this endpoint every minute:")
					}), /* @__PURE__ */ jsxs("p", {
						className: "mt-1 font-mono break-all",
						children: ["POST ", summary.callback_url]
					})]
				}),
				deployed ? /* @__PURE__ */ jsxs("div", {
					className: "rounded-md border border-emerald-300 bg-emerald-50 p-3 text-sm dark:bg-emerald-950/40",
					children: [/* @__PURE__ */ jsx("p", {
						className: "font-medium text-emerald-900 dark:text-emerald-100",
						children: t("Deployed")
					}), /* @__PURE__ */ jsxs("p", {
						className: "mt-1 text-xs text-emerald-800/80 dark:text-emerald-200/80",
						children: [
							t("Worker name:"),
							" ",
							/* @__PURE__ */ jsx("span", {
								className: "font-mono",
								children: workerName
							}),
							deployedAt && /* @__PURE__ */ jsxs(Fragment$1, { children: [
								" ",
								"· ",
								t("deployed"),
								" ",
								new Date(deployedAt).toLocaleString()
							] })
						]
					})]
				}) : /* @__PURE__ */ jsx("p", {
					className: "text-sm text-muted-foreground",
					children: t("Not deployed yet. Click the button to push the worker to your Cloudflare account.")
				}),
				result && /* @__PURE__ */ jsxs("div", {
					className: `rounded-md border p-3 text-sm ${result.ok ? "border-emerald-300 bg-emerald-50 text-emerald-900" : "border-rose-300 bg-rose-50 text-rose-900"}`,
					children: [result.message, result.worker_url && /* @__PURE__ */ jsxs(Fragment$1, { children: [" ", /* @__PURE__ */ jsx("a", {
						className: "underline",
						href: result.worker_url,
						target: "_blank",
						rel: "noopener noreferrer",
						children: t("Open in Cloudflare dashboard ↗")
					})] })]
				}),
				/* @__PURE__ */ jsxs("div", {
					className: "flex flex-wrap gap-2",
					children: [/* @__PURE__ */ jsxs(Button, {
						type: "button",
						onClick: onDeploy,
						disabled: pending || !summary.cloudflare_configured,
						children: [pending && /* @__PURE__ */ jsx(Loader2, { className: "size-4 animate-spin" }), deployed ? t("Re-deploy worker") : t("Deploy worker")]
					}), deployed && /* @__PURE__ */ jsx(Button, {
						type: "button",
						variant: "outline",
						onClick: onRemove,
						disabled: pending,
						children: t("Remove worker")
					})]
				})
			]
		})
	});
}
function BrandingAssetField({ id, label, description, surfaceLabel, icon: Icon, accept, currentUrl, selectedFile, fileName, error, onChange, siteTitle, displayMode, onDisplayModeChange, previewClassName, surfacePreviewClassName, secondaryPreviewLabel, secondaryPreview }) {
	const { t } = useT();
	const assetPreviewUrl = useSelectedFilePreview(selectedFile) ?? currentUrl;
	const supportsDisplayMode = displayMode !== void 0 && onDisplayModeChange !== void 0;
	const hasSecondaryPreview = supportsDisplayMode || secondaryPreview !== void 0;
	const renderedSecondaryPreview = typeof secondaryPreview === "function" ? secondaryPreview(assetPreviewUrl) : secondaryPreview;
	const uploadHint = fileName ? t("Selected file: :name", { name: fileName }) : t("PNG, JPG, SVG, or WEBP. Use a wider wordmark for public surfaces and a compact mark for dashboard surfaces.");
	return /* @__PURE__ */ jsx("div", {
		className: "rounded-2xl border border-border/70 bg-card/70 p-5 shadow-sm",
		children: /* @__PURE__ */ jsxs("div", {
			className: "flex flex-col gap-5",
			children: [
				/* @__PURE__ */ jsxs("div", {
					className: "flex flex-col gap-4 md:flex-row md:items-start md:justify-between",
					children: [/* @__PURE__ */ jsxs("div", {
						className: "max-w-2xl min-w-0",
						children: [/* @__PURE__ */ jsxs("div", {
							className: "flex flex-wrap items-center gap-2",
							children: [/* @__PURE__ */ jsx("span", {
								className: "flex size-9 shrink-0 items-center justify-center rounded-xl border border-border/70 bg-muted/20 text-muted-foreground shadow-xs",
								children: /* @__PURE__ */ jsx(Icon, { className: "size-4" })
							}), /* @__PURE__ */ jsx("div", {
								className: "min-w-0",
								children: /* @__PURE__ */ jsxs("div", {
									className: "flex flex-wrap items-center gap-2",
									children: [/* @__PURE__ */ jsx(Label, {
										htmlFor: id,
										className: "text-sm font-semibold",
										children: label
									}), /* @__PURE__ */ jsx(Badge, {
										variant: "outline",
										className: "border-border/70 bg-background/80 px-2 py-1 text-[10px] font-semibold tracking-[0.14em] text-muted-foreground uppercase",
										children: surfaceLabel
									})]
								})
							})]
						}), /* @__PURE__ */ jsx("p", {
							className: "mt-1 text-xs leading-5 text-muted-foreground",
							children: description
						})]
					}), supportsDisplayMode ? /* @__PURE__ */ jsxs("div", {
						className: "grid gap-2 md:w-[220px] md:shrink-0",
						children: [
							/* @__PURE__ */ jsx(Label, {
								htmlFor: `${id}_display`,
								children: t("Display mode")
							}),
							/* @__PURE__ */ jsxs(Select, {
								value: displayMode,
								onValueChange: (value) => onDisplayModeChange(value),
								children: [/* @__PURE__ */ jsx(SelectTrigger, {
									id: `${id}_display`,
									children: /* @__PURE__ */ jsx(SelectValue, { placeholder: t("Choose display mode") })
								}), /* @__PURE__ */ jsx(SelectContent, { children: BRAND_DISPLAY_OPTIONS.map((option) => /* @__PURE__ */ jsx(SelectItem, {
									value: option.value,
									children: option.label
								}, option.value)) })]
							}),
							/* @__PURE__ */ jsx("p", {
								className: "text-[11px] leading-5 text-muted-foreground",
								children: BRAND_DISPLAY_OPTIONS.find((option) => option.value === displayMode)?.description
							})
						]
					}) : null]
				}),
				/* @__PURE__ */ jsxs("div", {
					className: cn("grid gap-3", hasSecondaryPreview ? "md:grid-cols-2" : ""),
					children: [/* @__PURE__ */ jsxs("div", {
						className: "rounded-xl border border-border/70 bg-muted/15 p-4",
						children: [/* @__PURE__ */ jsx("p", {
							className: "text-[11px] font-semibold tracking-[0.16em] text-muted-foreground uppercase",
							children: t("Current asset")
						}), /* @__PURE__ */ jsx("div", {
							className: "mt-3 flex min-h-[120px] items-center justify-center rounded-xl border border-dashed border-border/70 bg-background/85 p-4",
							children: assetPreviewUrl ? /* @__PURE__ */ jsx("img", {
								src: assetPreviewUrl,
								alt: "",
								className: cn("h-12 w-auto max-w-full object-contain", previewClassName)
							}) : /* @__PURE__ */ jsx("span", {
								className: "text-center text-xs font-medium text-muted-foreground",
								children: t("No uploaded asset yet")
							})
						})]
					}), hasSecondaryPreview ? /* @__PURE__ */ jsxs("div", {
						className: "rounded-xl border border-border/70 bg-muted/15 p-4",
						children: [/* @__PURE__ */ jsx("p", {
							className: "text-[11px] font-semibold tracking-[0.16em] text-muted-foreground uppercase",
							children: secondaryPreviewLabel ?? t("Surface preview")
						}), /* @__PURE__ */ jsx("div", {
							className: cn("mt-3 flex min-h-[120px] items-center rounded-xl border border-dashed border-border/70 p-4", surfacePreviewClassName ?? "bg-gradient-to-br from-background to-muted/40"),
							children: supportsDisplayMode ? /* @__PURE__ */ jsx(BrandLockup, {
								siteTitle,
								logoUrl: assetPreviewUrl,
								mode: displayMode,
								className: "min-w-0 gap-3",
								logoClassName: cn("h-11 max-w-[170px]", previewClassName),
								textClassName: "truncate text-sm font-semibold tracking-tight text-foreground"
							}) : renderedSecondaryPreview
						})]
					}) : null]
				}),
				/* @__PURE__ */ jsxs("div", {
					className: "rounded-xl border border-dashed border-border/70 bg-muted/10 p-4",
					children: [
						/* @__PURE__ */ jsx(Input, {
							id,
							type: "file",
							accept,
							className: "sr-only",
							onChange: (event) => onChange(event.target.files?.[0] ?? null)
						}),
						/* @__PURE__ */ jsxs("div", {
							className: "flex flex-col gap-3",
							children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
								className: "text-sm font-medium text-foreground",
								children: t("Upload replacement")
							}), /* @__PURE__ */ jsx("p", {
								className: "mt-1 text-xs leading-5 text-muted-foreground",
								children: uploadHint
							})] }), /* @__PURE__ */ jsxs("div", {
								className: "flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",
								children: [/* @__PURE__ */ jsxs("label", {
									htmlFor: id,
									className: "inline-flex h-9 cursor-pointer items-center justify-center gap-2 rounded-lg border border-input bg-background px-3 text-sm font-medium text-foreground shadow-xs transition hover:bg-accent hover:text-accent-foreground",
									children: [/* @__PURE__ */ jsx(Upload, { className: "size-4" }), fileName ? t("Replace file") : t("Choose file")]
								}), /* @__PURE__ */ jsx("p", {
									className: "min-w-0 text-xs text-muted-foreground sm:max-w-[260px] sm:text-end",
									children: fileName ? /* @__PURE__ */ jsx("span", {
										className: "truncate font-medium text-foreground",
										children: fileName
									}) : t("No file selected yet")
								})]
							})]
						}),
						error ? /* @__PURE__ */ jsx("p", {
							className: "mt-3 text-xs font-medium text-destructive",
							children: error
						}) : null
					]
				})
			]
		})
	});
}
function BrandingSection({ initial }) {
	const { t } = useT();
	const brand = useBranding().site_title || "Pitchbar";
	const form = useForm({
		site_title: initial.site_title ?? "",
		header_logo: null,
		footer_logo: null,
		dashboard_logo: null,
		header_logo_dark: null,
		footer_logo_dark: null,
		dashboard_logo_dark: null,
		favicon: null,
		header_brand_display: initial.header_brand_display,
		footer_brand_display: initial.footer_brand_display,
		dashboard_brand_display: initial.dashboard_brand_display,
		pitchbar_brand_url: initial.pitchbar_brand_url ?? "",
		pitchbar_brand_label: initial.pitchbar_brand_label ?? "",
		marketing_site_enabled: initial.marketing_site_enabled ?? true,
		auth_aside_eyebrow: initial.auth_aside_eyebrow ?? "",
		auth_aside_heading: initial.auth_aside_heading ?? "",
		auth_aside_lede: initial.auth_aside_lede ?? "",
		auth_aside_bullets: Array.isArray(initial.auth_aside_bullets) ? initial.auth_aside_bullets : []
	});
	const headerLogoPreview = useSelectedFilePreview(form.data.header_logo);
	const footerLogoPreview = useSelectedFilePreview(form.data.footer_logo);
	const dashboardLogoPreview = useSelectedFilePreview(form.data.dashboard_logo);
	const faviconPreview = useSelectedFilePreview(form.data.favicon);
	const resetBrandingTransform = () => {
		form.transform((data) => data);
	};
	const submit = (e) => {
		e.preventDefault();
		const hasUploads = [
			form.data.header_logo,
			form.data.footer_logo,
			form.data.dashboard_logo,
			form.data.header_logo_dark,
			form.data.footer_logo_dark,
			form.data.dashboard_logo_dark,
			form.data.favicon
		].some((file) => file !== null);
		const onSuccess = () => {
			form.reset("header_logo", "footer_logo", "dashboard_logo", "header_logo_dark", "footer_logo_dark", "dashboard_logo_dark", "favicon");
		};
		if (!hasUploads) {
			resetBrandingTransform();
			form.patch(update$19.url("branding"), {
				preserveScroll: true,
				onSuccess
			});
			return;
		}
		form.transform((data) => ({
			...data,
			_method: "patch"
		}));
		form.post(update$19.url("branding"), {
			preserveScroll: true,
			forceFormData: true,
			onSuccess,
			onFinish: resetBrandingTransform
		});
	};
	return /* @__PURE__ */ jsx(SectionShell, {
		icon: Palette,
		title: t("Site branding"),
		description: t("Manage the global site title, uploaded logos for public and dashboard surfaces, the favicon, and the widget footer link used on free plans."),
		children: /* @__PURE__ */ jsxs("form", {
			onSubmit: submit,
			className: "grid gap-5",
			children: [
				/* @__PURE__ */ jsx("div", {
					className: "rounded-[28px] border border-border/70 bg-gradient-to-br from-card via-card to-muted/25 p-6 shadow-sm",
					children: /* @__PURE__ */ jsxs("div", {
						className: "grid gap-6 xl:grid-cols-[minmax(0,1fr)_460px] xl:items-start",
						children: [/* @__PURE__ */ jsxs("div", {
							className: "space-y-5",
							children: [
								/* @__PURE__ */ jsxs("div", {
									className: "space-y-3",
									children: [/* @__PURE__ */ jsx(Badge, {
										variant: "outline",
										className: "border-border/70 bg-background/70 px-2.5 py-1 text-[10px] font-semibold tracking-[0.16em] text-muted-foreground uppercase",
										children: t("Brand system")
									}), /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("h3", {
										className: "text-lg font-semibold tracking-tight text-foreground",
										children: t("Control every brand surface from one place")
									}), /* @__PURE__ */ jsx("p", {
										className: "mt-1 max-w-2xl text-sm leading-6 text-muted-foreground",
										children: t("Update the brand title, preview how each surface renders, and replace assets without guessing how they will appear in the app.")
									})] })]
								}),
								/* @__PURE__ */ jsxs("div", {
									className: "grid gap-2.5 rounded-2xl border border-border/70 bg-background/75 p-4 shadow-xs",
									children: [
										/* @__PURE__ */ jsx(Label, {
											htmlFor: "site_title",
											children: t("Site title")
										}),
										/* @__PURE__ */ jsx(Input, {
											id: "site_title",
											autoComplete: "off",
											value: form.data.site_title,
											onChange: (e) => form.setData("site_title", e.target.value),
											placeholder: brand
										}),
										/* @__PURE__ */ jsx("p", {
											className: "text-xs leading-5 text-muted-foreground",
											children: t("Used in the browser title, shared app branding props, and text fallbacks when no custom logo is uploaded.")
										}),
										form.errors.site_title ? /* @__PURE__ */ jsx("p", {
											className: "text-xs font-medium text-destructive",
											children: form.errors.site_title
										}) : null
									]
								}),
								/* @__PURE__ */ jsxs("div", {
									className: "flex flex-wrap gap-2",
									children: [
										/* @__PURE__ */ jsx(Badge, {
											variant: "outline",
											className: "border-border/70 bg-background/70 text-[11px] text-muted-foreground",
											children: t("Landing + auth")
										}),
										/* @__PURE__ */ jsx(Badge, {
											variant: "outline",
											className: "border-border/70 bg-background/70 text-[11px] text-muted-foreground",
											children: t("Dashboard shell")
										}),
										/* @__PURE__ */ jsx(Badge, {
											variant: "outline",
											className: "border-border/70 bg-background/70 text-[11px] text-muted-foreground",
											children: t("Footer + widget badge")
										}),
										/* @__PURE__ */ jsx(Badge, {
											variant: "outline",
											className: "border-border/70 bg-background/70 text-[11px] text-muted-foreground",
											children: t("Browser tab")
										})
									]
								})
							]
						}), /* @__PURE__ */ jsxs("div", {
							className: "grid gap-3 sm:grid-cols-2",
							children: [
								/* @__PURE__ */ jsx(BrandSurfacePreview, {
									title: t("Header"),
									caption: t("Landing and auth"),
									icon: PanelTop,
									siteTitle: form.data.site_title || t("Site title"),
									logoUrl: headerLogoPreview ?? initial.header_logo_url,
									mode: form.data.header_brand_display,
									shellClassName: "bg-gradient-to-br from-background via-background to-sky-500/5"
								}),
								/* @__PURE__ */ jsx(BrandSurfacePreview, {
									title: t("Dashboard"),
									caption: t("App shell"),
									icon: LayoutDashboard,
									siteTitle: form.data.site_title || t("Site title"),
									logoUrl: dashboardLogoPreview ?? initial.dashboard_logo_url,
									mode: form.data.dashboard_brand_display,
									shellClassName: "bg-gradient-to-br from-muted/25 via-background to-muted/45"
								}),
								/* @__PURE__ */ jsx(BrandSurfacePreview, {
									title: t("Footer"),
									caption: t("Marketing footer + widget"),
									icon: PanelBottom,
									siteTitle: form.data.site_title || t("Site title"),
									logoUrl: footerLogoPreview ?? initial.footer_logo_url ?? headerLogoPreview ?? initial.header_logo_url,
									mode: form.data.footer_brand_display,
									shellClassName: "bg-gradient-to-br from-[#17181b] to-[#22252b]",
									textClassName: "truncate text-sm font-semibold tracking-tight text-white"
								}),
								/* @__PURE__ */ jsx(FaviconSurfacePreview, {
									siteTitle: form.data.site_title || t("Site title"),
									faviconUrl: faviconPreview ?? initial.favicon_url
								})
							]
						})]
					})
				}),
				/* @__PURE__ */ jsxs("div", {
					className: "grid gap-5 lg:grid-cols-2",
					children: [
						/* @__PURE__ */ jsx(BrandingAssetField, {
							id: "header_logo",
							label: t("Header logo"),
							surfaceLabel: t("Public + auth"),
							icon: PanelTop,
							description: t("Used in the public landing-page header and the auth entry points."),
							accept: "image/png,image/jpeg,image/webp,image/svg+xml",
							currentUrl: initial.header_logo_url,
							selectedFile: form.data.header_logo,
							fileName: form.data.header_logo?.name,
							error: form.errors.header_logo,
							siteTitle: form.data.site_title || t("Site title"),
							displayMode: form.data.header_brand_display,
							onDisplayModeChange: (value) => form.setData("header_brand_display", value),
							surfacePreviewClassName: "bg-gradient-to-br from-background via-background to-sky-500/5",
							onChange: (file) => form.setData("header_logo", file)
						}),
						/* @__PURE__ */ jsx(BrandingAssetField, {
							id: "header_logo_dark",
							label: t("Header logo (dark mode)"),
							surfaceLabel: t("Public + auth"),
							icon: PanelTop,
							description: t("Optional. Swapped in when the visitor or operator is in dark mode. Leave empty to reuse the light logo (works for transparent or duotone wordmarks)."),
							accept: "image/png,image/jpeg,image/webp,image/svg+xml",
							currentUrl: initial.header_logo_dark_url,
							selectedFile: form.data.header_logo_dark,
							fileName: form.data.header_logo_dark?.name,
							error: form.errors.header_logo_dark,
							siteTitle: form.data.site_title || t("Site title"),
							displayMode: form.data.header_brand_display,
							onDisplayModeChange: (value) => form.setData("header_brand_display", value),
							surfacePreviewClassName: "bg-gradient-to-br from-[#0c0e12] via-[#101216] to-[#1a1d24]",
							onChange: (file) => form.setData("header_logo_dark", file)
						}),
						/* @__PURE__ */ jsx(BrandingAssetField, {
							id: "footer_logo",
							label: t("Footer logo"),
							surfaceLabel: t("Footer + widget"),
							icon: PanelBottom,
							description: t("Used in the public footer and the free-plan widget branding badge."),
							accept: "image/png,image/jpeg,image/webp,image/svg+xml",
							currentUrl: initial.footer_logo_url,
							selectedFile: form.data.footer_logo,
							fileName: form.data.footer_logo?.name,
							error: form.errors.footer_logo,
							siteTitle: form.data.site_title || t("Site title"),
							displayMode: form.data.footer_brand_display,
							onDisplayModeChange: (value) => form.setData("footer_brand_display", value),
							surfacePreviewClassName: "bg-gradient-to-br from-[#17181b] to-[#22252b]",
							onChange: (file) => form.setData("footer_logo", file)
						}),
						/* @__PURE__ */ jsx(BrandingAssetField, {
							id: "footer_logo_dark",
							label: t("Footer logo (dark mode)"),
							surfaceLabel: t("Footer + widget"),
							icon: PanelBottom,
							description: t("Optional. Swapped in when the visitor or operator is in dark mode."),
							accept: "image/png,image/jpeg,image/webp,image/svg+xml",
							currentUrl: initial.footer_logo_dark_url,
							selectedFile: form.data.footer_logo_dark,
							fileName: form.data.footer_logo_dark?.name,
							error: form.errors.footer_logo_dark,
							siteTitle: form.data.site_title || t("Site title"),
							displayMode: form.data.footer_brand_display,
							onDisplayModeChange: (value) => form.setData("footer_brand_display", value),
							surfacePreviewClassName: "bg-gradient-to-br from-[#0c0e12] to-[#1a1d24]",
							onChange: (file) => form.setData("footer_logo_dark", file)
						}),
						/* @__PURE__ */ jsx(BrandingAssetField, {
							id: "dashboard_logo",
							label: t("Dashboard logo"),
							surfaceLabel: t("App shell"),
							icon: LayoutDashboard,
							description: t("Used in the logged-in app shell and platform admin sidebar."),
							accept: "image/png,image/jpeg,image/webp,image/svg+xml",
							currentUrl: initial.dashboard_logo_url,
							selectedFile: form.data.dashboard_logo,
							fileName: form.data.dashboard_logo?.name,
							error: form.errors.dashboard_logo,
							siteTitle: form.data.site_title || t("Site title"),
							displayMode: form.data.dashboard_brand_display,
							onDisplayModeChange: (value) => form.setData("dashboard_brand_display", value),
							surfacePreviewClassName: "bg-gradient-to-br from-muted/25 via-background to-muted/45",
							onChange: (file) => form.setData("dashboard_logo", file)
						}),
						/* @__PURE__ */ jsx(BrandingAssetField, {
							id: "dashboard_logo_dark",
							label: t("Dashboard logo (dark mode)"),
							surfaceLabel: t("App shell"),
							icon: LayoutDashboard,
							description: t("Optional. Swapped in when the operator is in dark mode."),
							accept: "image/png,image/jpeg,image/webp,image/svg+xml",
							currentUrl: initial.dashboard_logo_dark_url,
							selectedFile: form.data.dashboard_logo_dark,
							fileName: form.data.dashboard_logo_dark?.name,
							error: form.errors.dashboard_logo_dark,
							siteTitle: form.data.site_title || t("Site title"),
							displayMode: form.data.dashboard_brand_display,
							onDisplayModeChange: (value) => form.setData("dashboard_brand_display", value),
							surfacePreviewClassName: "bg-gradient-to-br from-[#0d1015] to-[#181c22]",
							onChange: (file) => form.setData("dashboard_logo_dark", file)
						}),
						/* @__PURE__ */ jsx(BrandingAssetField, {
							id: "favicon",
							label: t("Favicon"),
							surfaceLabel: t("Browser tab"),
							icon: Globe2,
							description: t("Used for browser tabs and the initial HTML shell before the app hydrates."),
							accept: "image/png,image/jpeg,image/webp,image/svg+xml,image/x-icon",
							currentUrl: initial.favicon_url,
							selectedFile: form.data.favicon,
							fileName: form.data.favicon?.name,
							error: form.errors.favicon,
							siteTitle: form.data.site_title || t("Site title"),
							secondaryPreviewLabel: t("Tab preview"),
							secondaryPreview: (previewUrl) => /* @__PURE__ */ jsx("div", {
								className: "w-full rounded-xl border border-border/70 bg-background/95 p-3 shadow-xs",
								children: /* @__PURE__ */ jsxs("div", {
									className: "flex items-center gap-2",
									children: [previewUrl ? /* @__PURE__ */ jsx("img", {
										src: previewUrl,
										alt: "",
										className: "size-4 shrink-0 rounded-[4px] object-contain"
									}) : /* @__PURE__ */ jsx("span", {
										className: "flex size-4 shrink-0 items-center justify-center rounded-[4px] bg-foreground text-[10px] font-bold text-background",
										children: (form.data.site_title.trim().charAt(0) || "S").toUpperCase()
									}), /* @__PURE__ */ jsx("span", {
										className: "truncate text-xs font-medium text-foreground",
										children: form.data.site_title || t("Site title")
									})]
								})
							}),
							surfacePreviewClassName: "bg-gradient-to-br from-background to-muted/35",
							onChange: (file) => form.setData("favicon", file),
							previewClassName: "h-8"
						})
					]
				}),
				/* @__PURE__ */ jsx("div", {
					className: "rounded-2xl border border-border/70 bg-card/70 p-5 shadow-sm",
					children: /* @__PURE__ */ jsxs("div", {
						className: "grid gap-5 lg:grid-cols-[minmax(0,1fr)_280px] lg:items-start",
						children: [/* @__PURE__ */ jsxs("div", {
							className: "grid gap-4",
							children: [
								/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("h3", {
									className: "text-sm font-semibold text-foreground",
									children: t("Widget footer link")
								}), /* @__PURE__ */ jsx("p", {
									className: "mt-1 text-xs leading-5 text-muted-foreground",
									children: t("This still controls the free-plan “Powered by …” link inside the visitor widget.")
								})] }),
								/* @__PURE__ */ jsxs("div", {
									className: "grid gap-3 md:grid-cols-2",
									children: [/* @__PURE__ */ jsxs("div", {
										className: "grid gap-1",
										children: [
											/* @__PURE__ */ jsx(Label, {
												htmlFor: "pitchbar_brand_url",
												children: t("Link URL")
											}),
											/* @__PURE__ */ jsx(Input, {
												id: "pitchbar_brand_url",
												type: "url",
												autoComplete: "off",
												value: form.data.pitchbar_brand_url,
												onChange: (e) => form.setData("pitchbar_brand_url", e.target.value),
												placeholder: "https://pitchbar.thecodestudio.xyz"
											}),
											form.errors.pitchbar_brand_url ? /* @__PURE__ */ jsx("p", {
												className: "text-xs font-medium text-destructive",
												children: form.errors.pitchbar_brand_url
											}) : null
										]
									}), /* @__PURE__ */ jsxs("div", {
										className: "grid gap-1",
										children: [
											/* @__PURE__ */ jsx(Label, {
												htmlFor: "pitchbar_brand_label",
												children: t("Label")
											}),
											/* @__PURE__ */ jsx(Input, {
												id: "pitchbar_brand_label",
												autoComplete: "off",
												value: form.data.pitchbar_brand_label,
												onChange: (e) => form.setData("pitchbar_brand_label", e.target.value),
												placeholder: t("Powered by :brand", { brand })
											}),
											form.errors.pitchbar_brand_label ? /* @__PURE__ */ jsx("p", {
												className: "text-xs font-medium text-destructive",
												children: form.errors.pitchbar_brand_label
											}) : null
										]
									})]
								}),
								/* @__PURE__ */ jsx(Separator, {}),
								/* @__PURE__ */ jsx("p", {
									className: "text-xs leading-5 text-muted-foreground",
									children: t("Keep this label short so it reads cleanly inside the widget badge.")
								})
							]
						}), /* @__PURE__ */ jsxs("div", {
							className: "rounded-xl border border-border/70 bg-muted/15 p-4",
							children: [
								/* @__PURE__ */ jsx("p", {
									className: "text-[11px] font-semibold tracking-[0.16em] text-muted-foreground uppercase",
									children: t("Widget badge preview")
								}),
								/* @__PURE__ */ jsx("div", {
									className: "mt-3 flex min-h-[108px] items-end rounded-xl border border-dashed border-border/70 bg-[#111214] p-4",
									children: /* @__PURE__ */ jsx("span", {
										className: "inline-flex max-w-full items-center rounded-full bg-background px-3 py-2 text-xs font-medium text-foreground shadow-sm ring-1 ring-white/10",
										children: /* @__PURE__ */ jsx("span", {
											className: "truncate",
											children: form.data.pitchbar_brand_label || t("Powered by :brand", { brand })
										})
									})
								}),
								/* @__PURE__ */ jsxs("p", {
									className: "mt-3 text-[11px] leading-5 text-muted-foreground",
									children: [
										t("Link target:"),
										" ",
										form.data.pitchbar_brand_url || t("No URL set yet")
									]
								})
							]
						})]
					})
				}),
				/* @__PURE__ */ jsx("div", {
					className: "rounded-xl border border-border/70 bg-muted/15 p-4",
					children: /* @__PURE__ */ jsxs("label", {
						className: "flex cursor-pointer items-start gap-3",
						children: [/* @__PURE__ */ jsx("input", {
							type: "checkbox",
							checked: form.data.marketing_site_enabled,
							onChange: (e) => form.setData("marketing_site_enabled", e.target.checked),
							className: "mt-0.5 size-4 shrink-0 rounded border-border focus:ring-2 focus:ring-ring/40"
						}), /* @__PURE__ */ jsxs("div", {
							className: "min-w-0",
							children: [/* @__PURE__ */ jsx("p", {
								className: "text-sm font-medium text-foreground",
								children: t("Public marketing site")
							}), /* @__PURE__ */ jsx("p", {
								className: "mt-1 text-xs leading-5 text-muted-foreground",
								children: t("When on, anyone landing on /, /pricing, /changelog, or /documentation sees the public marketing site. Turn it off for a private SaaS install — visitors are redirected to /login instead, and search engines are told to skip the whole domain. Privacy / terms / auth flows stay reachable always.")
							})]
						})]
					})
				}),
				/* @__PURE__ */ jsxs("div", {
					className: "grid gap-3 rounded-xl border border-border/70 bg-muted/15 p-4",
					children: [
						/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("h3", {
							className: "text-sm font-semibold text-foreground",
							children: t("Auth page side panel")
						}), /* @__PURE__ */ jsx("p", {
							className: "mt-1 text-xs leading-5 text-muted-foreground",
							children: t("Customise the copy that appears on the login / register / forgot-password pages of the Aurora and Prism marketing themes. Leave blank to use the theme’s default.")
						})] }),
						/* @__PURE__ */ jsxs("div", {
							className: "grid gap-3 md:grid-cols-2",
							children: [/* @__PURE__ */ jsxs("div", {
								className: "grid gap-1",
								children: [/* @__PURE__ */ jsx(Label, {
									htmlFor: "auth_aside_eyebrow",
									children: t("Eyebrow tag")
								}), /* @__PURE__ */ jsx(Input, {
									id: "auth_aside_eyebrow",
									autoComplete: "off",
									value: form.data.auth_aside_eyebrow,
									onChange: (e) => form.setData("auth_aside_eyebrow", e.target.value),
									placeholder: "SECURE WORKSPACE"
								})]
							}), /* @__PURE__ */ jsxs("div", {
								className: "grid gap-1",
								children: [/* @__PURE__ */ jsx(Label, {
									htmlFor: "auth_aside_heading",
									children: t("Heading")
								}), /* @__PURE__ */ jsx(Input, {
									id: "auth_aside_heading",
									autoComplete: "off",
									value: form.data.auth_aside_heading,
									onChange: (e) => form.setData("auth_aside_heading", e.target.value),
									placeholder: "Sign in to the signal."
								})]
							})]
						}),
						/* @__PURE__ */ jsxs("div", {
							className: "grid gap-1",
							children: [/* @__PURE__ */ jsx(Label, {
								htmlFor: "auth_aside_lede",
								children: t("Lede paragraph")
							}), /* @__PURE__ */ jsx("textarea", {
								id: "auth_aside_lede",
								rows: 3,
								value: form.data.auth_aside_lede,
								onChange: (e) => form.setData("auth_aside_lede", e.target.value),
								className: "min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm",
								placeholder: t("Short paragraph shown under the heading. Speaks in your brand voice — keep under ~200 characters.")
							})]
						}),
						/* @__PURE__ */ jsxs("div", {
							className: "grid gap-1",
							children: [
								/* @__PURE__ */ jsx(Label, { children: t("Bullet points (up to 6)") }),
								[
									0,
									1,
									2,
									3,
									4,
									5
								].map((i) => /* @__PURE__ */ jsx(Input, {
									autoComplete: "off",
									value: form.data.auth_aside_bullets[i] ?? "",
									onChange: (e) => {
										const next = [...form.data.auth_aside_bullets];
										next[i] = e.target.value;
										form.setData("auth_aside_bullets", next.filter((_, idx) => idx < 6 && (idx <= i || (next[idx] ?? "").trim() !== "")));
									},
									placeholder: t("Bullet point :n", { n: i + 1 })
								}, i)),
								/* @__PURE__ */ jsx("p", {
									className: "text-xs text-muted-foreground",
									children: t("Empty rows are dropped on save. Leave all blank to fall back to the theme defaults.")
								})
							]
						})
					]
				}),
				/* @__PURE__ */ jsx("div", {
					className: "flex justify-end",
					children: /* @__PURE__ */ jsx(Button, {
						type: "submit",
						disabled: form.processing,
						children: t("Save branding")
					})
				})
			]
		})
	});
}
function MarketingSection({ summary, initial }) {
	const { t } = useT();
	return /* @__PURE__ */ jsxs(Fragment$1, { children: [
		/* @__PURE__ */ jsx(SectionShell, {
			icon: Sparkles,
			title: t("Marketing homepage"),
			description: t("Manage the public landing page with structured fields instead of raw JSON. Missing keys still fall back to the server defaults when you save."),
			statusPill: /* @__PURE__ */ jsx(StatusPill, { configured: summary.customized }),
			children: /* @__PURE__ */ jsx(MarketingContentEditor, { initial: initial.marketing_home_content })
		}),
		/* @__PURE__ */ jsx(MarketingThemeSection, {
			themeOptions: summary.theme_options ?? [],
			initialTheme: initial.marketing_theme
		}),
		/* @__PURE__ */ jsx(MarketingWidgetSection, {
			agentOptions: summary.agent_options ?? [],
			initialEnabled: initial.marketing_widget_enabled,
			initialAgentId: initial.marketing_widget_agent_id
		}),
		/* @__PURE__ */ jsx(PricingFaqsSection, { initial: initial.pricing_faqs ?? [] })
	] });
}
function MarketingThemeSection({ themeOptions, initialTheme }) {
	const { t } = useT();
	const form = useForm({ marketing_theme: initialTheme });
	const activeTheme = themeOptions.find((opt) => opt.slug === form.data.marketing_theme);
	return /* @__PURE__ */ jsx(SectionShell, {
		icon: Sparkles,
		title: t("Marketing theme"),
		description: t("Swap the entire marketing-site layout (home, pricing, how-it-works, integrations, privacy, terms, changelog) to a different theme bundle. Operators add new themes under resources/js/pages/marketing-themes/{slug}/ — see the Marketing themes documentation page for the convention."),
		statusPill: /* @__PURE__ */ jsx("span", {
			className: "rounded-full border border-border bg-background px-2 py-0.5 text-[10px] font-semibold tracking-wide text-foreground uppercase",
			children: activeTheme?.name ?? form.data.marketing_theme
		}),
		children: /* @__PURE__ */ jsxs("form", {
			onSubmit: (e) => {
				e.preventDefault();
				form.patch(update$19({ section: "marketing" }).url, { preserveScroll: true });
			},
			className: "space-y-4",
			children: [/* @__PURE__ */ jsxs("div", {
				className: "grid gap-1.5",
				children: [
					/* @__PURE__ */ jsx(Label, {
						htmlFor: "marketing-theme",
						children: t("Active theme")
					}),
					/* @__PURE__ */ jsx("select", {
						id: "marketing-theme",
						className: "rounded-md border bg-background px-2 py-1.5 text-sm",
						value: form.data.marketing_theme,
						onChange: (e) => form.setData("marketing_theme", e.target.value),
						children: themeOptions.map((opt) => /* @__PURE__ */ jsx("option", {
							value: opt.slug,
							children: opt.name
						}, opt.slug))
					}),
					activeTheme?.description && /* @__PURE__ */ jsx("p", {
						className: "text-xs text-muted-foreground",
						children: activeTheme.description
					}),
					themeOptions.length === 1 && /* @__PURE__ */ jsx("p", {
						className: "text-xs text-muted-foreground",
						children: t("Only the built-in Harvest theme is installed. Add a folder at resources/js/pages/marketing-themes/{slug}/ with a theme.json manifest to register more themes.")
					})
				]
			}), /* @__PURE__ */ jsx("div", {
				className: "flex justify-end",
				children: /* @__PURE__ */ jsx(Button, {
					type: "submit",
					disabled: form.processing,
					children: t("Save theme")
				})
			})]
		})
	});
}
function MarketingWidgetSection({ agentOptions, initialEnabled, initialAgentId }) {
	const { t } = useT();
	const form = useForm({
		marketing_widget_enabled: initialEnabled,
		marketing_widget_agent_id: initialAgentId
	});
	return /* @__PURE__ */ jsx(SectionShell, {
		icon: Sparkles,
		title: t("Marketing-site widget"),
		description: t("Mount one of your published agents on the public marketing pages (/, /welcome, /marketing/*). Anonymous visitors get a real chat surface, not a demo sandbox."),
		statusPill: /* @__PURE__ */ jsx(StatusPill, { configured: initialEnabled && initialAgentId !== null }),
		children: /* @__PURE__ */ jsxs("form", {
			onSubmit: (e) => {
				e.preventDefault();
				form.patch(update$19({ section: "marketing" }).url, { preserveScroll: true });
			},
			className: "space-y-4",
			children: [
				/* @__PURE__ */ jsxs("label", {
					className: "flex cursor-pointer items-start gap-3 rounded-md border bg-background p-3",
					children: [/* @__PURE__ */ jsx("input", {
						type: "checkbox",
						checked: form.data.marketing_widget_enabled,
						onChange: (e) => form.setData("marketing_widget_enabled", e.target.checked),
						className: "mt-0.5 size-4 shrink-0 rounded border-border text-foreground focus:ring-2 focus:ring-ring/40"
					}), /* @__PURE__ */ jsxs("div", {
						className: "min-w-0",
						children: [/* @__PURE__ */ jsx("p", {
							className: "text-sm font-medium text-foreground",
							children: t("Enable widget on marketing pages")
						}), /* @__PURE__ */ jsx("p", {
							className: "mt-1 text-xs leading-5 text-muted-foreground",
							children: t("When off, the marketing site has no chat surface (default). When on, the selected agent below mounts for anonymous visitors only — signed-in admins never see it.")
						})]
					})]
				}),
				/* @__PURE__ */ jsxs("div", {
					className: "grid gap-1.5",
					children: [
						/* @__PURE__ */ jsx(Label, {
							htmlFor: "marketing-widget-agent",
							children: t("Agent to mount")
						}),
						/* @__PURE__ */ jsxs("select", {
							id: "marketing-widget-agent",
							className: "rounded-md border bg-background px-2 py-1.5 text-sm",
							value: form.data.marketing_widget_agent_id ?? "",
							onChange: (e) => form.setData("marketing_widget_agent_id", e.target.value === "" ? null : e.target.value),
							disabled: !form.data.marketing_widget_enabled,
							children: [/* @__PURE__ */ jsx("option", {
								value: "",
								children: t("— Pick an agent —")
							}), agentOptions.map((opt) => /* @__PURE__ */ jsx("option", {
								value: opt.id,
								children: opt.label
							}, opt.id))]
						}),
						agentOptions.length === 0 && /* @__PURE__ */ jsx("p", {
							className: "text-xs text-amber-700 dark:text-amber-300",
							children: t("No published agents found. Publish an agent first, then come back here to wire it up.")
						})
					]
				}),
				/* @__PURE__ */ jsx("div", {
					className: "flex justify-end",
					children: /* @__PURE__ */ jsx(Button, {
						type: "submit",
						disabled: form.processing,
						children: t("Save marketing widget")
					})
				})
			]
		})
	});
}
function PricingFaqsSection({ initial }) {
	const { t } = useT();
	const form = useForm({ pricing_faqs: initial });
	const update = (idx, field, value) => {
		const next = [...form.data.pricing_faqs];
		next[idx] = {
			...next[idx],
			[field]: value
		};
		form.setData("pricing_faqs", next);
	};
	const add = () => {
		form.setData("pricing_faqs", [...form.data.pricing_faqs, {
			q: "",
			a: ""
		}]);
	};
	const remove = (idx) => {
		form.setData("pricing_faqs", form.data.pricing_faqs.filter((_, i) => i !== idx));
	};
	return /* @__PURE__ */ jsx(SectionShell, {
		icon: Sparkles,
		title: t("Pricing page FAQ"),
		description: t("Edit the FAQ shown on the public /pricing page. Saved entries override the default copy; clear all rows to fall back to defaults."),
		children: /* @__PURE__ */ jsxs("form", {
			onSubmit: (e) => {
				e.preventDefault();
				form.patch(update$19({ section: "pricing" }).url);
			},
			className: "space-y-3",
			children: [form.data.pricing_faqs.map((row, i) => /* @__PURE__ */ jsxs("div", {
				className: "grid gap-2 rounded-lg border bg-muted/15 p-3",
				children: [
					/* @__PURE__ */ jsx(Input, {
						placeholder: t("Question"),
						value: row.q,
						onChange: (e) => update(i, "q", e.target.value),
						maxLength: 240
					}),
					/* @__PURE__ */ jsx("textarea", {
						placeholder: t("Answer"),
						value: row.a,
						onChange: (e) => update(i, "a", e.target.value),
						maxLength: 2e3,
						rows: 3,
						className: "rounded-md border bg-background p-2 text-sm"
					}),
					/* @__PURE__ */ jsx("div", {
						className: "flex justify-end",
						children: /* @__PURE__ */ jsx(Button, {
							type: "button",
							variant: "ghost",
							size: "sm",
							onClick: () => remove(i),
							children: t("Remove")
						})
					})
				]
			}, i)), /* @__PURE__ */ jsxs("div", {
				className: "flex justify-between gap-2",
				children: [/* @__PURE__ */ jsx(Button, {
					type: "button",
					variant: "outline",
					onClick: add,
					children: t("Add FAQ")
				}), /* @__PURE__ */ jsx(Button, {
					type: "submit",
					disabled: form.processing,
					children: t("Save FAQ")
				})]
			})]
		})
	});
}
var INTEGRATION_KINDS = [
	{
		key: "slack",
		label: "Slack"
	},
	{
		key: "webhooks",
		label: "Outbound webhooks"
	},
	{
		key: "notion",
		label: "Notion"
	},
	{
		key: "google",
		label: "Google Drive (Docs)"
	},
	{
		key: "wordpress",
		label: "WordPress & WooCommerce"
	}
];
function IntegrationsToggleSection({ initial }) {
	const { t } = useT();
	const form = useForm({ integrations_enabled: initial });
	const toggle = (kind, on) => {
		form.setData("integrations_enabled", {
			...form.data.integrations_enabled,
			[kind]: on
		});
	};
	return /* @__PURE__ */ jsx(SectionShell, {
		icon: Sparkles,
		title: t("Integrations available to workspaces"),
		description: t("Turn an integration off here to hide its card from every workspace owner under /app/integrations. Disabled integrations still preserve any existing connections in the DB."),
		children: /* @__PURE__ */ jsxs("form", {
			onSubmit: (e) => {
				e.preventDefault();
				form.patch(update$19({ section: "integrations" }).url);
			},
			className: "space-y-3",
			children: [/* @__PURE__ */ jsx("div", {
				className: "grid gap-2",
				children: INTEGRATION_KINDS.map(({ key, label }) => {
					const current = form.data.integrations_enabled[key] !== false;
					return /* @__PURE__ */ jsxs("label", {
						className: "flex items-center justify-between rounded-lg border bg-muted/15 p-3",
						children: [/* @__PURE__ */ jsx("span", {
							className: "text-sm font-medium",
							children: t(label)
						}), /* @__PURE__ */ jsx("input", {
							type: "checkbox",
							checked: current,
							onChange: (e) => toggle(key, e.target.checked),
							className: "size-4"
						})]
					}, key);
				})
			}), /* @__PURE__ */ jsx("div", {
				className: "flex justify-end",
				children: /* @__PURE__ */ jsx(Button, {
					type: "submit",
					disabled: form.processing,
					children: t("Save integrations")
				})
			})]
		})
	});
}
function IntegrationCardsSection({ initial }) {
	const { t } = useT();
	const form = useForm({ integration_cards: initial });
	const updateField = (index, field, value) => {
		const next = form.data.integration_cards.map((row, i) => i === index ? {
			...row,
			[field]: value
		} : row);
		form.setData("integration_cards", next);
	};
	return /* @__PURE__ */ jsx(SectionShell, {
		icon: Sparkles,
		title: t("Integration card copy"),
		description: t("Edit the name, category, tagline, and description of each card on the public /integrations page. Leave a field blank to fall back to the shipped default."),
		children: /* @__PURE__ */ jsxs("form", {
			onSubmit: (e) => {
				e.preventDefault();
				form.patch(update$19({ section: "integrations" }).url);
			},
			className: "space-y-4",
			children: [/* @__PURE__ */ jsx("div", {
				className: "space-y-4",
				children: form.data.integration_cards.map((row, index) => /* @__PURE__ */ jsxs("div", {
					className: "space-y-3 rounded-lg border bg-muted/15 p-4",
					children: [
						/* @__PURE__ */ jsx("div", {
							className: "text-xs font-semibold tracking-wide text-muted-foreground uppercase",
							children: row.key
						}),
						/* @__PURE__ */ jsxs("div", {
							className: "grid gap-3 sm:grid-cols-2",
							children: [/* @__PURE__ */ jsxs("label", {
								className: "space-y-1 text-sm",
								children: [/* @__PURE__ */ jsx("span", {
									className: "font-medium",
									children: t("Name")
								}), /* @__PURE__ */ jsx(Input, {
									value: row.name,
									onChange: (e) => updateField(index, "name", e.target.value)
								})]
							}), /* @__PURE__ */ jsxs("label", {
								className: "space-y-1 text-sm",
								children: [/* @__PURE__ */ jsx("span", {
									className: "font-medium",
									children: t("Category")
								}), /* @__PURE__ */ jsx(Input, {
									value: row.category,
									onChange: (e) => updateField(index, "category", e.target.value)
								})]
							})]
						}),
						/* @__PURE__ */ jsxs("label", {
							className: "space-y-1 text-sm",
							children: [/* @__PURE__ */ jsx("span", {
								className: "font-medium",
								children: t("Tagline")
							}), /* @__PURE__ */ jsx(Input, {
								value: row.tagline,
								onChange: (e) => updateField(index, "tagline", e.target.value)
							})]
						}),
						/* @__PURE__ */ jsxs("label", {
							className: "space-y-1 text-sm",
							children: [/* @__PURE__ */ jsx("span", {
								className: "font-medium",
								children: t("Description")
							}), /* @__PURE__ */ jsx("textarea", {
								rows: 3,
								value: row.description,
								onChange: (e) => updateField(index, "description", e.target.value),
								className: "w-full rounded-md border bg-background p-2 text-sm"
							})]
						})
					]
				}, row.key))
			}), /* @__PURE__ */ jsx("div", {
				className: "flex justify-end",
				children: /* @__PURE__ */ jsx(Button, {
					type: "submit",
					disabled: form.processing,
					children: t("Save card copy")
				})
			})]
		})
	});
}
function PrivacySection({ summary, initial }) {
	const { t } = useT();
	return /* @__PURE__ */ jsx(SectionShell, {
		icon: Shield,
		title: t("Privacy & GDPR"),
		description: t("Manage the public privacy policy and the GDPR request guidance shown on the marketing site."),
		statusPill: /* @__PURE__ */ jsx(StatusPill, { configured: summary.customized }),
		children: /* @__PURE__ */ jsx(PrivacyPolicyEditor, { initial: initial.privacy_policy_content })
	});
}
function ReadOnlyHealthSection({ icon: Icon, title, description, statusPill, rows, testEndpoint, testLabel }) {
	return /* @__PURE__ */ jsx(SectionShell, {
		icon: Icon,
		title,
		description,
		statusPill,
		testEndpoint,
		testLabel,
		children: /* @__PURE__ */ jsx("div", {
			className: "space-y-1.5",
			children: rows.map((r) => /* @__PURE__ */ jsxs("div", {
				className: "grid grid-cols-[140px_1fr] gap-3 text-sm",
				children: [/* @__PURE__ */ jsx("span", {
					className: "text-muted-foreground",
					children: r.label
				}), /* @__PURE__ */ jsx("span", {
					className: "font-mono text-xs break-all",
					children: r.value === null || r.value === "" || r.value === void 0 ? /* @__PURE__ */ jsx("span", {
						className: "text-muted-foreground/60",
						children: "—"
					}) : r.value
				})]
			}, r.label))
		})
	});
}
var TAB_KEYS = [
	"billing",
	"ai",
	"mail",
	"integrations",
	"features",
	"cron",
	"health"
];
function SystemSettings({ page, sections, form: initial }) {
	const { t } = useT();
	const TABS = [
		{
			key: "billing",
			label: t("Billing"),
			icon: CreditCard
		},
		{
			key: "ai",
			label: t("AI providers"),
			icon: Sparkles
		},
		{
			key: "mail",
			label: t("Mail"),
			icon: Mail
		},
		{
			key: "integrations",
			label: t("Integrations"),
			icon: Workflow
		},
		{
			key: "features",
			label: t("Features"),
			icon: Sparkles
		},
		{
			key: "cron",
			label: t("Cron worker"),
			icon: Workflow
		},
		{
			key: "health",
			label: t("Health"),
			icon: HardDrive
		}
	];
	const [active, setActive] = useState(typeof window !== "undefined" && TAB_KEYS.includes(window.location.hash.slice(1)) ? window.location.hash.slice(1) : "billing");
	const switchTab = (key) => {
		setActive(key);
		if (typeof window !== "undefined") window.history.replaceState(null, "", `${window.location.pathname}#${key}`);
	};
	const pageMeta = {
		system: {
			headTitle: t("System settings"),
			title: t("System config"),
			description: t("Edit provider keys and run smoke tests. Sensitive values are encrypted at rest and never sent back to the browser; leave a secret blank to keep its current value.")
		},
		branding: {
			headTitle: t("Branding settings"),
			title: t("Branding"),
			description: t("Manage the global site title, uploaded logos, favicon, and widget footer branding from one place.")
		},
		marketing: {
			headTitle: t("Marketing site settings"),
			title: t("Marketing site"),
			description: t("Edit the landing page using structured fields so content stays easy to manage and review.")
		},
		privacy: {
			headTitle: t("Privacy settings"),
			title: t("Privacy & GDPR"),
			description: t("Control the public privacy policy copy, contact details, and visitor rights guidance from the admin settings area.")
		}
	};
	return /* @__PURE__ */ jsxs(Fragment$1, { children: [
		/* @__PURE__ */ jsx(Head, { title: pageMeta[page].headTitle }),
		/* @__PURE__ */ jsx(Heading, {
			variant: "small",
			title: pageMeta[page].title,
			description: pageMeta[page].description
		}),
		page === "system" && /* @__PURE__ */ jsx("div", {
			className: "mt-4 flex gap-1 overflow-x-auto border-b",
			role: "tablist",
			"aria-label": t("System config sections"),
			children: TABS.map((tab) => {
				const Icon = tab.icon;
				const isActive = active === tab.key;
				return /* @__PURE__ */ jsxs("button", {
					type: "button",
					role: "tab",
					"aria-selected": isActive,
					"aria-controls": `system-tab-${tab.key}`,
					onClick: () => switchTab(tab.key),
					className: `-mb-px flex items-center gap-2 border-b-2 px-3 py-2 text-sm whitespace-nowrap transition ${isActive ? "border-foreground font-medium text-foreground" : "border-transparent text-muted-foreground hover:text-foreground"}`,
					children: [/* @__PURE__ */ jsx(Icon, { className: "size-4" }), tab.label]
				}, tab.key);
			})
		}),
		/* @__PURE__ */ jsxs("div", {
			className: "mt-4 space-y-4",
			role: "tabpanel",
			id: `system-tab-${page === "system" ? active : page}`,
			children: [
				page === "system" && active === "billing" && /* @__PURE__ */ jsxs(Fragment$1, { children: [
					/* @__PURE__ */ jsx(GatewayTogglesSection, { initial }),
					/* @__PURE__ */ jsx(StripeSection, {
						summary: sections.stripe,
						initial
					}),
					/* @__PURE__ */ jsx(PayPalSection, {
						summary: sections.paypal,
						initial
					}),
					/* @__PURE__ */ jsx(RazorpaySection, {
						summary: sections.razorpay,
						initial
					})
				] }),
				page === "system" && active === "ai" && /* @__PURE__ */ jsxs(Fragment$1, { children: [
					/* @__PURE__ */ jsx(CloudflareSection, {
						summary: sections.llm,
						initial
					}),
					/* @__PURE__ */ jsx(OpenAiSection, {
						summary: sections.llm,
						initial
					}),
					/* @__PURE__ */ jsx(OpenRouterSection, {
						summary: sections.llm,
						initial
					}),
					/* @__PURE__ */ jsx(RoutingSection, { initial }),
					/* @__PURE__ */ jsx(ByokGlobalSection, { initial })
				] }),
				page === "system" && active === "mail" && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(MailSection, {
					summary: sections.mail,
					initial
				}), /* @__PURE__ */ jsx(AdminDigestSection, { initial })] }),
				page === "system" && active === "integrations" && /* @__PURE__ */ jsxs(Fragment$1, { children: [
					/* @__PURE__ */ jsx(IntegrationsToggleSection, { initial: initial.integrations_enabled ?? {} }),
					/* @__PURE__ */ jsx(IntegrationCardsSection, { initial: initial.integration_cards ?? [] }),
					/* @__PURE__ */ jsx(WordpressPluginSection, { initial })
				] }),
				page === "system" && active === "features" && /* @__PURE__ */ jsx(Fragment$1, { children: /* @__PURE__ */ jsx(SignupVerificationSection, { initial }) }),
				page === "system" && active === "cron" && /* @__PURE__ */ jsx(CronWorkerSection, { summary: sections.cron_worker }),
				page === "branding" && /* @__PURE__ */ jsx(BrandingSection, { initial }),
				page === "marketing" && /* @__PURE__ */ jsx(MarketingSection, {
					summary: sections.marketing,
					initial
				}),
				page === "privacy" && /* @__PURE__ */ jsx(PrivacySection, {
					summary: sections.privacy,
					initial
				}),
				page === "system" && active === "health" && /* @__PURE__ */ jsxs(Fragment$1, { children: [
					/* @__PURE__ */ jsx(ReadOnlyHealthSection, {
						icon: Sparkles,
						title: t("LLM (chat) probe"),
						description: t("Verifies the currently-resolved chat provider responds end-to-end."),
						statusPill: /* @__PURE__ */ jsx(StatusPill, { configured: sections.llm.configured }),
						testEndpoint: "/settings/system/test/llm",
						testLabel: t("Run chat probe"),
						rows: [{
							label: "LLM_PROVIDER",
							value: sections.llm.provider_env
						}, {
							label: t("Resolved"),
							value: sections.llm.resolved
						}]
					}),
					/* @__PURE__ */ jsx(ReadOnlyHealthSection, {
						icon: Sparkles,
						title: t("LLM (embed) probe"),
						description: t("Verifies the embed endpoint produces a vector."),
						statusPill: /* @__PURE__ */ jsx(StatusPill, { configured: sections.llm.configured }),
						testEndpoint: "/settings/system/test/embed",
						testLabel: t("Run embed probe"),
						rows: [{
							label: t("Resolved"),
							value: sections.llm.resolved
						}]
					}),
					/* @__PURE__ */ jsx(ReadOnlyHealthSection, {
						icon: HardDrive,
						title: t("Cache (Redis)"),
						description: t("Backs queues, sessions, and short-TTL RAG history."),
						statusPill: /* @__PURE__ */ jsx(StatusPill, { configured: sections.cache.configured }),
						testEndpoint: "/settings/system/test/cache",
						testLabel: t("Run write/read probe"),
						rows: [
							{
								label: t("Driver"),
								value: sections.cache.driver
							},
							{
								label: t("Redis host"),
								value: sections.cache.redis_host
							},
							{
								label: t("Redis port"),
								value: sections.cache.redis_port
							}
						]
					}),
					/* @__PURE__ */ jsx(ReadOnlyHealthSection, {
						icon: Database,
						title: t("Vector store"),
						description: t("Embedding storage + similarity search. Provider auto-picks from configured keys."),
						statusPill: /* @__PURE__ */ jsx(StatusPill, { configured: sections.vector.configured }),
						rows: [
							{
								label: "VECTOR_PROVIDER",
								value: sections.vector.provider_env
							},
							{
								label: t("Resolved"),
								value: sections.vector.resolved
							},
							{
								label: t("Vectorize index"),
								value: sections.vector.vectorize_index
							},
							{
								label: t("Qdrant URL"),
								value: sections.vector.qdrant_url
							}
						]
					}),
					/* @__PURE__ */ jsx(ReadOnlyHealthSection, {
						icon: Radio,
						title: t("Reverb (WebSocket)"),
						description: t("Live broadcasts for the inbox + widget human-takeover."),
						statusPill: /* @__PURE__ */ jsx(StatusPill, { configured: sections.reverb.configured }),
						rows: [
							{
								label: t("App key"),
								value: sections.reverb.app_key
							},
							{
								label: t("Host"),
								value: sections.reverb.host
							},
							{
								label: t("Port"),
								value: sections.reverb.port
							},
							{
								label: t("Scheme"),
								value: sections.reverb.scheme
							}
						]
					})
				] })
			]
		})
	] });
}
SystemSettings.layout = { breadcrumbs: [{
	title: "System config",
	href: "/settings/system"
}] };
//#endregion
//#region resources/js/pages/settings/widget.tsx
var widget_exports = /* @__PURE__ */ __exportAll({ default: () => WidgetSettings });
var MAX_PROMPTS = 6;
var MAX_PROMPT_LENGTH = 80;
function useToneOptions() {
	const { t } = useT();
	return [
		{
			value: "friendly",
			label: t("Friendly"),
			sample: t("Sure thing — happy to help! Here’s what I found.")
		},
		{
			value: "expert",
			label: t("Expert"),
			sample: t("The pricing page lists three tiers; the differences are below.")
		},
		{
			value: "concise",
			label: t("Concise"),
			sample: t("Pricing: $29 / $99 / custom. Pro adds priority support.")
		}
	];
}
function Section({ icon, title, description, children }) {
	return /* @__PURE__ */ jsxs("section", {
		className: "border-b last:border-b-0",
		children: [/* @__PURE__ */ jsxs("div", {
			className: "flex items-start gap-3 px-5 pt-5",
			children: [/* @__PURE__ */ jsx("span", {
				className: "flex size-8 shrink-0 items-center justify-center rounded-md border bg-background text-muted-foreground shadow-xs",
				children: icon
			}), /* @__PURE__ */ jsxs("div", {
				className: "min-w-0 flex-1",
				children: [/* @__PURE__ */ jsx("h2", {
					className: "text-sm font-medium text-foreground",
					children: title
				}), /* @__PURE__ */ jsx("p", {
					className: "mt-0.5 text-xs leading-5 text-muted-foreground",
					children: description
				})]
			})]
		}), /* @__PURE__ */ jsx("div", {
			className: "px-5 pt-4 pb-5",
			children
		})]
	});
}
/**
* Compact swatch + hex pair. Color picker is the visual primary; the
* hex input is below for paste-in. Stacks cleanly even at 220px wide.
*/
function ColorField({ id, label, value, placeholder, onChange }) {
	return /* @__PURE__ */ jsxs("div", {
		className: "grid gap-1.5",
		children: [/* @__PURE__ */ jsx(Label, {
			htmlFor: id,
			children: label
		}), /* @__PURE__ */ jsxs("div", {
			className: "flex items-center gap-2",
			children: [/* @__PURE__ */ jsx("input", {
				id,
				type: "color",
				value: value || placeholder,
				onChange: (e) => onChange(e.target.value),
				className: "h-9 w-12 shrink-0 cursor-pointer rounded-md border bg-background p-1"
			}), /* @__PURE__ */ jsx(Input, {
				value,
				onChange: (e) => onChange(e.target.value),
				placeholder,
				className: "flex-1 font-mono text-xs"
			})]
		})]
	});
}
/**
* Live preview that mirrors the actual visitor widget — same white
* capsule pill at the bottom, colored "orb" circle on the left, input
* placeholder showing the launcher_label, accent-colored send button
* on the right. Above the pill: a sample chat bubble using the
* selected persona/tone, and accent-bordered starter chips.
*
* The real widget lives in resources/widget/src/ui/Bar.tsx; this is
* not the bundle, just a same-shape mock so admins can iterate on
* colour + persona without saving + reloading + re-opening the
* launcher on a real site.
*/
function WidgetPreview({ defaults }) {
	const { t } = useT();
	const TONE_OPTIONS = useToneOptions();
	const primary = defaults.theme.primary || "#111827";
	const accent = defaults.theme.accent || "#10b981";
	const radius = defaults.theme.radius ?? 12;
	const launcherLabel = defaults.theme.launcher_label?.trim() || t("Ask anything");
	const personaName = defaults.persona.name?.trim() || t("Assistant");
	const tone = TONE_OPTIONS.find((o) => o.value === defaults.persona.tone) ?? TONE_OPTIONS[0];
	return /* @__PURE__ */ jsxs("div", {
		className: "sticky top-6 space-y-3",
		children: [/* @__PURE__ */ jsxs("div", {
			className: "overflow-hidden rounded-2xl border border-border/70 bg-gradient-to-br from-slate-100 to-slate-50 dark:from-slate-900/60 dark:to-slate-950/40",
			children: [/* @__PURE__ */ jsxs("div", {
				className: "flex items-center justify-between border-b border-border/50 bg-card/60 px-4 py-2 backdrop-blur-sm",
				children: [/* @__PURE__ */ jsx("span", {
					className: "text-[11px] font-semibold tracking-wide text-muted-foreground uppercase",
					children: t("Live preview")
				}), /* @__PURE__ */ jsx("span", {
					className: "text-[11px] text-muted-foreground",
					children: t("Visitor view")
				})]
			}), /* @__PURE__ */ jsxs("div", {
				className: "flex flex-col gap-3 px-5 py-6",
				children: [
					/* @__PURE__ */ jsxs("div", {
						className: "max-w-[260px] self-start",
						style: {
							background: "white",
							borderRadius: radius,
							boxShadow: "0 14px 32px rgba(0,0,0,0.06)",
							padding: "10px 12px"
						},
						children: [/* @__PURE__ */ jsx("div", {
							className: "text-[10px] font-semibold tracking-wide uppercase",
							style: { color: "#64748b" },
							children: personaName
						}), /* @__PURE__ */ jsx("div", {
							className: "mt-1 text-[13px] leading-snug",
							style: { color: "#0f172a" },
							children: tone.sample
						})]
					}),
					defaults.starter_prompts.length > 0 && /* @__PURE__ */ jsx("div", {
						className: "flex flex-wrap justify-center gap-1.5 py-1",
						children: defaults.starter_prompts.slice(0, 3).map((prompt, i) => /* @__PURE__ */ jsx("span", {
							className: "rounded-full border bg-white px-3 py-1 text-[11px] text-slate-900 shadow-sm",
							style: { borderColor: "rgba(15,23,42,0.08)" },
							children: prompt || t("Chip :n", { n: i + 1 })
						}, i))
					}),
					/* @__PURE__ */ jsxs("div", {
						className: "flex items-center gap-2.5 self-stretch",
						style: {
							background: "white",
							borderRadius: 9999,
							boxShadow: "0 14px 32px rgba(0,0,0,0.16)",
							padding: "6px 8px 6px 8px"
						},
						children: [
							/* @__PURE__ */ jsxs("span", {
								className: "relative inline-flex size-9 shrink-0 items-center justify-center",
								children: [/* @__PURE__ */ jsx("span", {
									className: "absolute inset-0 rounded-full",
									style: { background: `radial-gradient(circle at 30% 30%, ${accent}, ${primary})` }
								}), /* @__PURE__ */ jsx("span", {
									className: "absolute inset-1 rounded-full opacity-80",
									style: { background: `radial-gradient(circle at 70% 70%, ${primary}, transparent 60%)` }
								})]
							}),
							/* @__PURE__ */ jsx("span", {
								className: "flex-1 truncate text-[13px]",
								style: { color: "#94a3b8" },
								children: launcherLabel
							}),
							/* @__PURE__ */ jsx("span", {
								className: "inline-flex size-8 shrink-0 items-center justify-center text-white",
								style: {
									background: accent,
									borderRadius: 9999
								},
								children: /* @__PURE__ */ jsx("svg", {
									width: "14",
									height: "14",
									viewBox: "0 0 24 24",
									fill: "none",
									stroke: "currentColor",
									strokeWidth: "2.5",
									strokeLinecap: "round",
									strokeLinejoin: "round",
									children: /* @__PURE__ */ jsx("path", { d: "M5 12l14-7-7 14-2-5-5-2z" })
								})
							})
						]
					})
				]
			})]
		}), /* @__PURE__ */ jsx("p", {
			className: "text-[11px] leading-relaxed text-muted-foreground",
			children: t("Mirrors the real omnibar — white capsule, orb on the left, accent-coloured send. Reply length and tone tune the LLM at runtime, not the visual.")
		})]
	});
}
function WidgetSettings({ scope, effective, workspace_overrides, agents_count, endpoints }) {
	const { t } = useT();
	const confirm = useConfirm();
	const TONE_OPTIONS = useToneOptions();
	const form = useForm({
		theme: effective.theme,
		persona: effective.persona,
		guardrails: effective.guardrails,
		starter_prompts: effective.starter_prompts
	});
	const isPlatform = scope === "platform";
	const [pushingToAll, setPushingToAll] = useState(false);
	const isUsingPlatformDefault = useMemo(() => Object.keys(workspace_overrides).length === 0, [workspace_overrides]);
	const submit = (e) => {
		e.preventDefault();
		form.patch(endpoints.update, { preserveScroll: true });
	};
	const applyToAll = async () => {
		if (!endpoints.apply_to_all || agents_count === 0) return;
		if (!await confirm({
			title: t("Apply to all agents?"),
			message: t("This replaces theme, persona, starter prompts, and reply length on ALL :count agents in this workspace with the workspace defaults you just saved.\n\nPer-agent customisations will be overwritten. Continue?", { count: agents_count }),
			confirmLabel: t("Apply"),
			danger: true
		})) return;
		setPushingToAll(true);
		router.post(endpoints.apply_to_all, {}, {
			preserveScroll: true,
			onFinish: () => setPushingToAll(false)
		});
	};
	const updatePrompt = (i, val) => {
		const next = [...form.data.starter_prompts];
		next[i] = val.slice(0, MAX_PROMPT_LENGTH);
		form.setData("starter_prompts", next);
	};
	const removePrompt = (i) => {
		const next = form.data.starter_prompts.filter((_, idx) => idx !== i);
		form.setData("starter_prompts", next);
	};
	const addPrompt = () => {
		if (form.data.starter_prompts.length >= MAX_PROMPTS) return;
		form.setData("starter_prompts", [...form.data.starter_prompts, ""]);
	};
	return /* @__PURE__ */ jsxs(Fragment$1, { children: [
		/* @__PURE__ */ jsx(Head, { title: isPlatform ? t("Platform widget defaults") : t("Widget defaults") }),
		/* @__PURE__ */ jsx("h1", {
			className: "sr-only",
			children: isPlatform ? t("Platform widget defaults") : t("Widget defaults")
		}),
		/* @__PURE__ */ jsxs("div", {
			className: "flex flex-col gap-2 border-b pb-5",
			children: [/* @__PURE__ */ jsx(Heading, {
				variant: "small",
				title: isPlatform ? t("Platform-wide widget defaults") : t("Widget defaults"),
				description: isPlatform ? t("Sets the look, voice, and starter prompts NEW workspaces inherit on creation. Workspace owners override these via Settings → Widget.") : t("Set the look, voice, and starter prompts every new agent in this workspace inherits at creation.")
			}), /* @__PURE__ */ jsx("p", {
				className: "text-xs text-muted-foreground",
				children: isPlatform ? t("Existing workspaces are not affected — defaults apply only to NEW workspaces.") : isUsingPlatformDefault ? t("Currently inheriting the platform-wide defaults. Saving creates a workspace override.") : t("Workspace override active — changes only affect this workspace.")
			})]
		}),
		/* @__PURE__ */ jsxs("form", {
			onSubmit: submit,
			className: "grid gap-6 pt-6 lg:grid-cols-[minmax(0,1fr)_minmax(280px,360px)]",
			children: [/* @__PURE__ */ jsxs("div", {
				className: "rounded-xl border bg-card",
				children: [
					/* @__PURE__ */ jsx(Section, {
						icon: /* @__PURE__ */ jsx(Palette, { className: "size-4" }),
						title: t("Theme"),
						description: t("Colour palette and corner radius applied to the visitor widget."),
						children: /* @__PURE__ */ jsxs("div", {
							className: "grid gap-4 sm:grid-cols-2",
							children: [
								/* @__PURE__ */ jsx(ColorField, {
									id: "primary",
									label: t("Primary colour"),
									value: form.data.theme.primary ?? "",
									placeholder: "#111827",
									onChange: (v) => form.setData("theme", {
										...form.data.theme,
										primary: v
									})
								}),
								/* @__PURE__ */ jsx(ColorField, {
									id: "accent",
									label: t("Accent colour"),
									value: form.data.theme.accent ?? "",
									placeholder: "#10b981",
									onChange: (v) => form.setData("theme", {
										...form.data.theme,
										accent: v
									})
								}),
								/* @__PURE__ */ jsxs("div", {
									className: "grid gap-1.5",
									children: [/* @__PURE__ */ jsx(Label, {
										htmlFor: "radius",
										children: t("Corner radius")
									}), /* @__PURE__ */ jsxs("div", {
										className: "flex items-center gap-3",
										children: [/* @__PURE__ */ jsx("input", {
											id: "radius",
											type: "range",
											min: 0,
											max: 32,
											value: form.data.theme.radius ?? 12,
											onChange: (e) => form.setData("theme", {
												...form.data.theme,
												radius: Number(e.target.value)
											}),
											className: "flex-1"
										}), /* @__PURE__ */ jsxs("span", {
											className: "w-10 text-end font-mono text-xs text-muted-foreground tabular-nums",
											children: [form.data.theme.radius ?? 12, "px"]
										})]
									})]
								}),
								/* @__PURE__ */ jsxs("div", {
									className: "grid gap-1.5",
									children: [
										/* @__PURE__ */ jsx(Label, {
											htmlFor: "launcher_label",
											children: t("Launcher label")
										}),
										/* @__PURE__ */ jsx(Input, {
											id: "launcher_label",
											type: "text",
											maxLength: 48,
											placeholder: t("Ask anything"),
											value: form.data.theme.launcher_label ?? "",
											onChange: (e) => form.setData("theme", {
												...form.data.theme,
												launcher_label: e.target.value
											})
										}),
										/* @__PURE__ */ jsx("p", {
											className: "text-[11px] leading-snug text-muted-foreground",
											children: t("Leave blank to use the vertical preset's suggestion.")
										})
									]
								})
							]
						})
					}),
					/* @__PURE__ */ jsx(Section, {
						icon: /* @__PURE__ */ jsx(MessageSquareQuote, { className: "size-4" }),
						title: t("Persona"),
						description: t("The agent's display name and conversational tone."),
						children: /* @__PURE__ */ jsxs("div", {
							className: "grid gap-4",
							children: [
								/* @__PURE__ */ jsxs("div", {
									className: "grid gap-1.5",
									children: [/* @__PURE__ */ jsx(Label, {
										htmlFor: "persona_name",
										children: t("Display name")
									}), /* @__PURE__ */ jsx(Input, {
										id: "persona_name",
										type: "text",
										maxLength: 64,
										placeholder: t("Assistant"),
										value: form.data.persona.name ?? "",
										onChange: (e) => form.setData("persona", {
											...form.data.persona,
											name: e.target.value
										}),
										className: "sm:max-w-md"
									})]
								}),
								/* @__PURE__ */ jsxs("div", {
									className: "grid gap-1.5",
									children: [/* @__PURE__ */ jsx(Label, { children: t("Tone") }), /* @__PURE__ */ jsx("div", {
										className: "grid gap-2 sm:grid-cols-3",
										children: TONE_OPTIONS.map((option) => {
											return /* @__PURE__ */ jsxs("button", {
												type: "button",
												onClick: () => form.setData("persona", {
													...form.data.persona,
													tone: option.value
												}),
												className: `rounded-lg border p-3 text-start transition ${form.data.persona.tone === option.value ? "border-foreground bg-muted/30 text-foreground shadow-xs" : "border-border text-muted-foreground hover:border-foreground/40 hover:text-foreground"}`,
												children: [/* @__PURE__ */ jsx("span", {
													className: "block text-sm font-medium",
													children: option.label
												}), /* @__PURE__ */ jsx("span", {
													className: "mt-1 block text-[11px] leading-snug",
													children: option.sample
												})]
											}, option.value);
										})
									})]
								}),
								/* @__PURE__ */ jsxs("div", {
									className: "grid gap-1.5 sm:max-w-md",
									children: [
										/* @__PURE__ */ jsx(Label, {
											htmlFor: "max_chars",
											children: t("Reply length cap")
										}),
										/* @__PURE__ */ jsxs("div", {
											className: "flex items-center gap-3",
											children: [/* @__PURE__ */ jsx("input", {
												id: "max_chars",
												type: "range",
												min: 400,
												max: 4e3,
												step: 100,
												value: form.data.guardrails.max_chars ?? 2500,
												onChange: (e) => form.setData("guardrails", {
													...form.data.guardrails,
													max_chars: Number(e.target.value)
												}),
												className: "flex-1"
											}), /* @__PURE__ */ jsx("span", {
												className: "w-16 text-end font-mono text-xs text-muted-foreground tabular-nums",
												children: form.data.guardrails.max_chars ?? 2500
											})]
										}),
										/* @__PURE__ */ jsx("p", {
											className: "text-[11px] leading-snug text-muted-foreground",
											children: t("Hard cap on the assistant's reply. Lower values force tighter answers.")
										})
									]
								})
							]
						})
					}),
					/* @__PURE__ */ jsx(Section, {
						icon: /* @__PURE__ */ jsx(Sparkles, { className: "size-4" }),
						title: t("Starter prompts"),
						description: t("Up to 6 chips visitors see before sending their first message."),
						children: /* @__PURE__ */ jsxs("div", {
							className: "grid gap-2",
							children: [
								form.data.starter_prompts.length === 0 && /* @__PURE__ */ jsx("p", {
									className: "rounded-md border border-dashed bg-muted/20 px-3 py-3 text-xs text-muted-foreground",
									children: t("No starter prompts yet. New agents will fall back to the vertical preset's suggestions.")
								}),
								form.data.starter_prompts.map((prompt, i) => /* @__PURE__ */ jsxs("div", {
									className: "flex items-center gap-2",
									children: [
										/* @__PURE__ */ jsxs("span", {
											className: "font-mono text-xs text-muted-foreground tabular-nums",
											children: [i + 1, "."]
										}),
										/* @__PURE__ */ jsx(Input, {
											type: "text",
											value: prompt,
											maxLength: MAX_PROMPT_LENGTH,
											placeholder: t("Chip :n", { n: i + 1 }),
											onChange: (e) => updatePrompt(i, e.target.value)
										}),
										/* @__PURE__ */ jsx(Button, {
											type: "button",
											variant: "ghost",
											size: "icon",
											onClick: () => removePrompt(i),
											title: t("Remove"),
											children: /* @__PURE__ */ jsx(X, { className: "size-4" })
										})
									]
								}, i)),
								form.data.starter_prompts.length < MAX_PROMPTS && /* @__PURE__ */ jsx(Button, {
									type: "button",
									variant: "ghost",
									size: "sm",
									onClick: addPrompt,
									className: "w-fit",
									children: t("+ Add starter prompt")
								})
							]
						})
					}),
					/* @__PURE__ */ jsxs("div", {
						className: "flex flex-col-reverse gap-3 border-t bg-muted/20 px-5 py-4 sm:flex-row sm:items-center sm:justify-end",
						children: [!isPlatform && endpoints.apply_to_all && /* @__PURE__ */ jsxs(Button, {
							type: "button",
							variant: "outline",
							onClick: applyToAll,
							disabled: pushingToAll || form.processing || agents_count === 0,
							title: agents_count === 0 ? t("No agents yet — defaults will apply on the next agent created") : t("Push these defaults onto all :count existing agent(s)", { count: agents_count }),
							children: [pushingToAll && /* @__PURE__ */ jsx(Loader2, { className: "me-1 size-3.5 animate-spin" }), agents_count > 0 ? t("Apply to all (:count)", { count: agents_count }) : t("Apply to all")]
						}), /* @__PURE__ */ jsxs(Button, {
							type: "submit",
							disabled: form.processing,
							children: [form.processing && /* @__PURE__ */ jsx(Loader2, { className: "me-1 size-3.5 animate-spin" }), t("Save defaults")]
						})]
					})
				]
			}), /* @__PURE__ */ jsx(WidgetPreview, { defaults: form.data })]
		}),
		!isPlatform && /* @__PURE__ */ jsxs("p", {
			className: "mt-3 text-xs text-muted-foreground",
			children: [
				t("Platform-wide defaults are set by super-admins under"),
				" ",
				/* @__PURE__ */ jsx("code", {
					className: "rounded bg-muted px-1 py-0.5 font-mono text-[11px]",
					children: t("Settings → Widget defaults")
				}),
				".",
				" ",
				t("Workspace defaults override the platform default; per-agent customisations override both.")
			]
		})
	] });
}
//#endregion
//#region resources/js/pages/settings/workspace.tsx
var workspace_exports = /* @__PURE__ */ __exportAll({ default: () => WorkspaceSettings });
function CopyableField({ label, value }) {
	const { t } = useT();
	const [copied, setCopied] = useState(false);
	const copy = async () => {
		try {
			await navigator.clipboard.writeText(value);
			setCopied(true);
			window.setTimeout(() => setCopied(false), 1500);
		} catch {}
	};
	return /* @__PURE__ */ jsxs("div", {
		className: "grid gap-1.5",
		children: [/* @__PURE__ */ jsx(Label, { children: label }), /* @__PURE__ */ jsxs("div", {
			className: "flex items-stretch gap-2",
			children: [/* @__PURE__ */ jsx(Input, {
				value,
				readOnly: true,
				className: "font-mono text-xs"
			}), /* @__PURE__ */ jsx(Button, {
				type: "button",
				variant: "outline",
				onClick: copy,
				"aria-label": t("Copy"),
				className: "shrink-0",
				children: copied ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Check, { className: "size-4" }), /* @__PURE__ */ jsx("span", {
					className: "ms-1.5",
					children: t("Copied")
				})] }) : /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Copy, { className: "size-4" }), /* @__PURE__ */ jsx("span", {
					className: "ms-1.5",
					children: t("Copy")
				})] })
			})]
		})]
	});
}
function WorkspaceSettings({ workspace }) {
	const { t } = useT();
	const form = useForm({ name: workspace.name });
	const submit = (e) => {
		e.preventDefault();
		form.patch("/settings/workspace", { preserveScroll: true });
	};
	return /* @__PURE__ */ jsxs(Fragment$1, { children: [
		/* @__PURE__ */ jsx(Head, { title: t("Workspace settings") }),
		/* @__PURE__ */ jsx("h1", {
			className: "sr-only",
			children: t("Workspace settings")
		}),
		/* @__PURE__ */ jsxs("div", {
			className: "space-y-6",
			children: [
				/* @__PURE__ */ jsx(Heading, {
					variant: "small",
					title: t("Workspace"),
					description: t("Rename the workspace your team sees in the sidebar and on outgoing emails.")
				}),
				/* @__PURE__ */ jsx(Card, {
					className: "border-border/80 p-5",
					children: /* @__PURE__ */ jsxs("form", {
						onSubmit: submit,
						className: "grid gap-4",
						children: [/* @__PURE__ */ jsxs("div", {
							className: "grid gap-1.5",
							children: [
								/* @__PURE__ */ jsx(Label, {
									htmlFor: "name",
									children: t("Workspace name")
								}),
								/* @__PURE__ */ jsx(Input, {
									id: "name",
									value: form.data.name,
									onChange: (e) => form.setData("name", e.target.value),
									required: true,
									placeholder: t("Acme, Inc."),
									autoComplete: "organization",
									"data-test": "workspace-name"
								}),
								/* @__PURE__ */ jsx(InputError, { message: form.errors.name })
							]
						}), /* @__PURE__ */ jsx("div", {
							className: "flex items-center justify-end gap-4 border-t pt-4",
							children: /* @__PURE__ */ jsx(Button, {
								type: "submit",
								disabled: form.processing,
								"data-test": "update-workspace-button",
								children: t("Save")
							})
						})]
					})
				}),
				(workspace.slug || workspace.public_kb_url) && /* @__PURE__ */ jsx(Card, {
					className: "border-border/80 p-5",
					children: /* @__PURE__ */ jsxs("div", {
						className: "grid gap-4",
						children: [
							/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("h2", {
								className: "text-base font-semibold",
								children: t("Workspace identity")
							}), /* @__PURE__ */ jsx("p", {
								className: "mt-1 text-sm text-muted-foreground",
								children: t("These identifiers belong to your workspace. The slug is used in public URLs (knowledge base, share links). The URL below is your public knowledge-base page — share it with customers who want to read your published answers.")
							})] }),
							workspace.slug && /* @__PURE__ */ jsx(CopyableField, {
								label: t("Workspace slug"),
								value: workspace.slug
							}),
							workspace.public_kb_url && /* @__PURE__ */ jsx(CopyableField, {
								label: t("Public knowledge-base URL"),
								value: workspace.public_kb_url
							})
						]
					})
				})
			]
		})
	] });
}
WorkspaceSettings.layout = { breadcrumbs: [{
	title: "Workspace settings",
	href: "/settings/workspace"
}] };
//#endregion
//#region resources/js/pages/welcome.tsx
var welcome_exports = /* @__PURE__ */ __exportAll({ default: () => MarketingHome });
//#endregion
//#region resources/js/components/marketing-widget-mount.tsx
var SCRIPT_MARKER = "data-marketing-widget";
/**
* Reactively mounts / unmounts the marketing-site widget based on the
* `marketingWidget` Inertia shared prop. Without this, the Blade-emitted
* `<script>` tag only re-evaluates on a full HTTP reload — so when an
* operator toggled the widget off in /settings/system, the widget
* stayed visible on the marketing tab until Ctrl+R (client report
* 2026-05-25).
*
* Lives OUTSIDE the Inertia component (under DirectedApp in app.tsx),
* so it reads page props by hand from the Inertia dataset on mount
* and via `router.on('navigate')` afterwards — `usePage()` is only
* valid INSIDE the Inertia tree.
*
* Three trigger paths:
*   1. Initial mount — reads `#app[data-page]`.
*   2. Same-tab navigation — `router.on('navigate')` swaps the prop
*      and the useEffect tears down / re-mounts.
*   3. Cross-tab — `visibilitychange` does a partial reload of just
*      the `marketingWidget` shared prop so a background marketing
*      tab picks up admin-side toggles without an Inertia visit.
*/
function MarketingWidgetMount() {
	const [widget, setWidget] = useState(readWidgetFromDom);
	useEffect(() => {
		const off = router.on("success", (event) => {
			const next = event.detail?.page?.props?.marketingWidget;
			if (next !== void 0) setWidget(next);
		});
		return () => {
			off();
		};
	}, []);
	useEffect(() => {
		if (widget === void 0) return;
		const desiredAgentId = widget.enabled ? widget.agent_id : null;
		const currentScript = document.querySelector(`script[${SCRIPT_MARKER}]`);
		if ((currentScript?.getAttribute("data-agent-id") ?? null) === desiredAgentId) return;
		teardown(currentScript);
		if (desiredAgentId !== null) injectScript({
			src: `${widget.src}?v=${widget.version}`,
			agentId: desiredAgentId,
			demo: widget.is_demo
		});
	}, [widget]);
	const isMarketingSurface = widget !== void 0;
	useEffect(() => {
		if (!isMarketingSurface) return;
		const handleVisibility = () => {
			if (document.visibilityState === "visible") router.reload({ only: ["marketingWidget"] });
		};
		document.addEventListener("visibilitychange", handleVisibility);
		return () => {
			document.removeEventListener("visibilitychange", handleVisibility);
		};
	}, [isMarketingSurface]);
	return null;
}
function readWidgetFromDom() {
	if (typeof document === "undefined") return;
	const raw = document.querySelector("script[type=\"application/json\"][data-page]")?.textContent;
	if (!raw) return;
	try {
		return JSON.parse(raw).props?.marketingWidget;
	} catch {
		return;
	}
}
function teardown(script) {
	if (script !== null) script.remove();
	if (typeof window !== "undefined" && window.Pitchbar?.unmount) try {
		window.Pitchbar.unmount();
	} catch {}
	document.querySelectorAll("#pitchbar-root").forEach((node) => node.remove());
}
function injectScript({ src, agentId, demo }) {
	const tag = document.createElement("script");
	tag.src = src;
	tag.defer = true;
	tag.setAttribute("data-agent-id", agentId);
	tag.setAttribute(SCRIPT_MARKER, "true");
	if (demo) tag.setAttribute("data-demo", "true");
	document.body.appendChild(tag);
}
//#endregion
//#region resources/js/hooks/use-flash-toast.ts
var LOADING_TOAST_DELAY_MS = 350;
var mutatingMethods = new Set([
	"post",
	"put",
	"patch",
	"delete"
]);
function isMutatingVisit(visit) {
	return !!visit && !visit.prefetch && mutatingMethods.has((visit.method ?? "").toLowerCase());
}
function loadingMessageForVisit(visit) {
	switch ((visit.method ?? "").toLowerCase()) {
		case "delete": return "Deleting...";
		case "put":
		case "patch": return "Saving...";
		default: return "Submitting...";
	}
}
function successMessageForVisit(visit) {
	switch ((visit.method ?? "").toLowerCase()) {
		case "delete": return "Deleted successfully.";
		case "put":
		case "patch": return "Saved successfully.";
		default: return "Submitted successfully.";
	}
}
function showFlashToast(data) {
	toast[data.type](data.message);
}
function useFlashToast() {
	useEffect(() => {
		let activeVisit = null;
		const pendingToasts = /* @__PURE__ */ new Map();
		const getPendingToast = (visit) => {
			const existing = pendingToasts.get(visit);
			if (existing) return existing;
			const next = {
				timerId: null,
				toastId: null,
				hasTerminalToast: false,
				hasFlashToast: false
			};
			pendingToasts.set(visit, next);
			return next;
		};
		const showTerminalToast = (visit, type, message) => {
			const pending = getPendingToast(visit);
			if (pending.timerId !== null) {
				window.clearTimeout(pending.timerId);
				pending.timerId = null;
			}
			const options = pending.toastId === null ? void 0 : { id: pending.toastId };
			pending.toastId = toast[type](message, options);
			pending.hasTerminalToast = true;
		};
		const cleanupVisit = (visit) => {
			const pending = pendingToasts.get(visit);
			if (!pending) return;
			if (pending.timerId !== null) window.clearTimeout(pending.timerId);
			if (pending.toastId !== null && !pending.hasTerminalToast) toast.dismiss(pending.toastId);
			pendingToasts.delete(visit);
		};
		const removeStartListener = router.on("start", (event) => {
			const visit = event.detail?.visit;
			if (!isMutatingVisit(visit)) return;
			activeVisit = visit;
			const pending = getPendingToast(visit);
			pending.timerId = window.setTimeout(() => {
				pending.toastId = toast.loading(loadingMessageForVisit(visit));
				pending.timerId = null;
			}, LOADING_TOAST_DELAY_MS);
		});
		const removeFlashListener = router.on("flash", (event) => {
			const data = (event.detail?.flash)?.toast;
			if (!data) return;
			if (isMutatingVisit(activeVisit)) getPendingToast(activeVisit).hasFlashToast = true;
			showFlashToast(data);
		});
		const removeErrorListener = router.on("error", () => {
			if (!isMutatingVisit(activeVisit)) return;
			showTerminalToast(activeVisit, "error", "Please review the highlighted fields and try again.");
		});
		const removeNetworkErrorListener = router.on("networkError", () => {
			if (!isMutatingVisit(activeVisit)) return;
			showTerminalToast(activeVisit, "error", "Network error. Please try again.");
		});
		const removeHttpExceptionListener = router.on("httpException", () => {
			if (!isMutatingVisit(activeVisit)) return;
			showTerminalToast(activeVisit, "error", "Something went wrong. Please try again.");
		});
		const removeSuccessListener = router.on("success", (event) => {
			if (!isMutatingVisit(activeVisit)) return;
			const page = event.detail?.page;
			const pending = getPendingToast(activeVisit);
			if (page?.flash?.toast || pending.hasFlashToast) return;
			showTerminalToast(activeVisit, "success", successMessageForVisit(activeVisit));
		});
		const removeFinishListener = router.on("finish", (event) => {
			const visit = event.detail?.visit;
			if (!isMutatingVisit(visit)) return;
			cleanupVisit(visit);
			if (activeVisit === visit) activeVisit = null;
		});
		return () => {
			removeStartListener();
			removeFlashListener();
			removeErrorListener();
			removeNetworkErrorListener();
			removeHttpExceptionListener();
			removeSuccessListener();
			removeFinishListener();
		};
	}, []);
}
//#endregion
//#region resources/js/components/ui/sonner.tsx
function Toaster$1({ ...props }) {
	const { appearance } = useAppearance();
	useFlashToast();
	return /* @__PURE__ */ jsx(Toaster, {
		theme: appearance,
		className: "toaster group",
		position: "bottom-right",
		style: {
			"--normal-bg": "var(--popover)",
			"--normal-text": "var(--popover-foreground)",
			"--normal-border": "var(--border)"
		},
		...props
	});
}
//#endregion
//#region resources/js/layouts/account-layout.tsx
/**
* Account-level pages (profile, security, appearance) live outside both
* /app and /admin since super_admins also need to update their own
* profile. We pick the layout chrome at render time based on the
* authenticated user's role: super_admins get the admin sidebar so
* they don't see customer-only items (Agents, Inbox, etc.) that they
* don't have access to anyway, regular customers get the workspace
* sidebar.
*/
function AccountLayout({ children, breadcrumbs }) {
	const { auth } = usePage().props;
	if (auth?.user?.is_super_admin === true) return /* @__PURE__ */ jsx(AdminLayout, {
		breadcrumbs,
		children
	});
	return /* @__PURE__ */ jsx(AppLayout, {
		breadcrumbs,
		children
	});
}
//#endregion
//#region resources/js/routes/settings/branding/index.ts
/**
* @see \App\Http\Controllers\Admin\Platform\SystemController::index
* @see app/Http/Controllers/Admin/Platform/SystemController.php:64
* @route '/settings/branding'
*/
var index$2 = (options) => ({
	url: index$2.url(options),
	method: "get"
});
index$2.definition = {
	methods: ["get", "head"],
	url: "/settings/branding"
};
/**
* @see \App\Http\Controllers\Admin\Platform\SystemController::index
* @see app/Http/Controllers/Admin/Platform/SystemController.php:64
* @route '/settings/branding'
*/
index$2.url = (options) => {
	return index$2.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\Platform\SystemController::index
* @see app/Http/Controllers/Admin/Platform/SystemController.php:64
* @route '/settings/branding'
*/
index$2.get = (options) => ({
	url: index$2.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\SystemController::index
* @see app/Http/Controllers/Admin/Platform/SystemController.php:64
* @route '/settings/branding'
*/
index$2.head = (options) => ({
	url: index$2.url(options),
	method: "head"
});
/**
* @see \App\Http\Controllers\Admin\Platform\SystemController::index
* @see app/Http/Controllers/Admin/Platform/SystemController.php:64
* @route '/settings/branding'
*/
var indexForm$2 = (options) => ({
	action: index$2.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\SystemController::index
* @see app/Http/Controllers/Admin/Platform/SystemController.php:64
* @route '/settings/branding'
*/
indexForm$2.get = (options) => ({
	action: index$2.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\SystemController::index
* @see app/Http/Controllers/Admin/Platform/SystemController.php:64
* @route '/settings/branding'
*/
indexForm$2.head = (options) => ({
	action: index$2.url({ [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
index$2.form = indexForm$2;
Object.assign(index$2, index$2);
//#endregion
//#region resources/js/routes/settings/byok-keys/index.ts
/**
* @see \App\Http\Controllers\Settings\ByokKeysController::edit
* @see app/Http/Controllers/Settings/ByokKeysController.php:28
* @route '/settings/byok-keys'
*/
var edit = (options) => ({
	url: edit.url(options),
	method: "get"
});
edit.definition = {
	methods: ["get", "head"],
	url: "/settings/byok-keys"
};
/**
* @see \App\Http\Controllers\Settings\ByokKeysController::edit
* @see app/Http/Controllers/Settings/ByokKeysController.php:28
* @route '/settings/byok-keys'
*/
edit.url = (options) => {
	return edit.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Settings\ByokKeysController::edit
* @see app/Http/Controllers/Settings/ByokKeysController.php:28
* @route '/settings/byok-keys'
*/
edit.get = (options) => ({
	url: edit.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Settings\ByokKeysController::edit
* @see app/Http/Controllers/Settings/ByokKeysController.php:28
* @route '/settings/byok-keys'
*/
edit.head = (options) => ({
	url: edit.url(options),
	method: "head"
});
/**
* @see \App\Http\Controllers\Settings\ByokKeysController::edit
* @see app/Http/Controllers/Settings/ByokKeysController.php:28
* @route '/settings/byok-keys'
*/
var editForm = (options) => ({
	action: edit.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Settings\ByokKeysController::edit
* @see app/Http/Controllers/Settings/ByokKeysController.php:28
* @route '/settings/byok-keys'
*/
editForm.get = (options) => ({
	action: edit.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Settings\ByokKeysController::edit
* @see app/Http/Controllers/Settings/ByokKeysController.php:28
* @route '/settings/byok-keys'
*/
editForm.head = (options) => ({
	action: edit.url({ [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
edit.form = editForm;
/**
* @see \App\Http\Controllers\Settings\ByokKeysController::update
* @see app/Http/Controllers/Settings/ByokKeysController.php:62
* @route '/settings/byok-keys'
*/
var update = (options) => ({
	url: update.url(options),
	method: "patch"
});
update.definition = {
	methods: ["patch"],
	url: "/settings/byok-keys"
};
/**
* @see \App\Http\Controllers\Settings\ByokKeysController::update
* @see app/Http/Controllers/Settings/ByokKeysController.php:62
* @route '/settings/byok-keys'
*/
update.url = (options) => {
	return update.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Settings\ByokKeysController::update
* @see app/Http/Controllers/Settings/ByokKeysController.php:62
* @route '/settings/byok-keys'
*/
update.patch = (options) => ({
	url: update.url(options),
	method: "patch"
});
/**
* @see \App\Http\Controllers\Settings\ByokKeysController::update
* @see app/Http/Controllers/Settings/ByokKeysController.php:62
* @route '/settings/byok-keys'
*/
var updateForm = (options) => ({
	action: update.url({ [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "PATCH",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
/**
* @see \App\Http\Controllers\Settings\ByokKeysController::update
* @see app/Http/Controllers/Settings/ByokKeysController.php:62
* @route '/settings/byok-keys'
*/
updateForm.patch = (options) => ({
	action: update.url({ [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "PATCH",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
update.form = updateForm;
/**
* @see \App\Http\Controllers\Settings\ByokKeysController::clear
* @see app/Http/Controllers/Settings/ByokKeysController.php:103
* @route '/settings/byok-keys/{provider}'
*/
var clear = (args, options) => ({
	url: clear.url(args, options),
	method: "delete"
});
clear.definition = {
	methods: ["delete"],
	url: "/settings/byok-keys/{provider}"
};
/**
* @see \App\Http\Controllers\Settings\ByokKeysController::clear
* @see app/Http/Controllers/Settings/ByokKeysController.php:103
* @route '/settings/byok-keys/{provider}'
*/
clear.url = (args, options) => {
	if (typeof args === "string" || typeof args === "number") args = { provider: args };
	if (Array.isArray(args)) args = { provider: args[0] };
	args = applyUrlDefaults(args);
	const parsedArgs = { provider: args.provider };
	return clear.definition.url.replace("{provider}", parsedArgs.provider.toString()).replace(/\/+$/, "") + queryParams(options);
};
/**
* @see \App\Http\Controllers\Settings\ByokKeysController::clear
* @see app/Http/Controllers/Settings/ByokKeysController.php:103
* @route '/settings/byok-keys/{provider}'
*/
clear.delete = (args, options) => ({
	url: clear.url(args, options),
	method: "delete"
});
/**
* @see \App\Http\Controllers\Settings\ByokKeysController::clear
* @see app/Http/Controllers/Settings/ByokKeysController.php:103
* @route '/settings/byok-keys/{provider}'
*/
var clearForm = (args, options) => ({
	action: clear.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "DELETE",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
/**
* @see \App\Http\Controllers\Settings\ByokKeysController::clear
* @see app/Http/Controllers/Settings/ByokKeysController.php:103
* @route '/settings/byok-keys/{provider}'
*/
clearForm.delete = (args, options) => ({
	action: clear.url(args, { [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "DELETE",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "post"
});
clear.form = clearForm;
Object.assign(edit, edit), Object.assign(update, update), Object.assign(clear, clear);
//#endregion
//#region resources/js/routes/settings/marketing/index.ts
/**
* @see \App\Http\Controllers\Admin\Platform\SystemController::index
* @see app/Http/Controllers/Admin/Platform/SystemController.php:69
* @route '/settings/marketing'
*/
var index$1 = (options) => ({
	url: index$1.url(options),
	method: "get"
});
index$1.definition = {
	methods: ["get", "head"],
	url: "/settings/marketing"
};
/**
* @see \App\Http\Controllers\Admin\Platform\SystemController::index
* @see app/Http/Controllers/Admin/Platform/SystemController.php:69
* @route '/settings/marketing'
*/
index$1.url = (options) => {
	return index$1.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\Platform\SystemController::index
* @see app/Http/Controllers/Admin/Platform/SystemController.php:69
* @route '/settings/marketing'
*/
index$1.get = (options) => ({
	url: index$1.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\SystemController::index
* @see app/Http/Controllers/Admin/Platform/SystemController.php:69
* @route '/settings/marketing'
*/
index$1.head = (options) => ({
	url: index$1.url(options),
	method: "head"
});
/**
* @see \App\Http\Controllers\Admin\Platform\SystemController::index
* @see app/Http/Controllers/Admin/Platform/SystemController.php:69
* @route '/settings/marketing'
*/
var indexForm$1 = (options) => ({
	action: index$1.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\SystemController::index
* @see app/Http/Controllers/Admin/Platform/SystemController.php:69
* @route '/settings/marketing'
*/
indexForm$1.get = (options) => ({
	action: index$1.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\SystemController::index
* @see app/Http/Controllers/Admin/Platform/SystemController.php:69
* @route '/settings/marketing'
*/
indexForm$1.head = (options) => ({
	action: index$1.url({ [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
index$1.form = indexForm$1;
Object.assign(index$1, index$1);
//#endregion
//#region resources/js/routes/settings/privacy/index.ts
/**
* @see \App\Http\Controllers\Admin\Platform\SystemController::index
* @see app/Http/Controllers/Admin/Platform/SystemController.php:74
* @route '/settings/privacy'
*/
var index = (options) => ({
	url: index.url(options),
	method: "get"
});
index.definition = {
	methods: ["get", "head"],
	url: "/settings/privacy"
};
/**
* @see \App\Http\Controllers\Admin\Platform\SystemController::index
* @see app/Http/Controllers/Admin/Platform/SystemController.php:74
* @route '/settings/privacy'
*/
index.url = (options) => {
	return index.definition.url + queryParams(options);
};
/**
* @see \App\Http\Controllers\Admin\Platform\SystemController::index
* @see app/Http/Controllers/Admin/Platform/SystemController.php:74
* @route '/settings/privacy'
*/
index.get = (options) => ({
	url: index.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\SystemController::index
* @see app/Http/Controllers/Admin/Platform/SystemController.php:74
* @route '/settings/privacy'
*/
index.head = (options) => ({
	url: index.url(options),
	method: "head"
});
/**
* @see \App\Http\Controllers\Admin\Platform\SystemController::index
* @see app/Http/Controllers/Admin/Platform/SystemController.php:74
* @route '/settings/privacy'
*/
var indexForm = (options) => ({
	action: index.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\SystemController::index
* @see app/Http/Controllers/Admin/Platform/SystemController.php:74
* @route '/settings/privacy'
*/
indexForm.get = (options) => ({
	action: index.url(options),
	method: "get"
});
/**
* @see \App\Http\Controllers\Admin\Platform\SystemController::index
* @see app/Http/Controllers/Admin/Platform/SystemController.php:74
* @route '/settings/privacy'
*/
indexForm.head = (options) => ({
	action: index.url({ [options?.mergeQuery ? "mergeQuery" : "query"]: {
		_method: "HEAD",
		...options?.query ?? options?.mergeQuery ?? {}
	} }),
	method: "get"
});
index.form = indexForm;
Object.assign(index, index);
//#endregion
//#region resources/js/layouts/settings/layout.tsx
function SettingsLayout({ children }) {
	const { isCurrentOrParentUrl } = useCurrentUrl();
	const { t } = useT();
	const { auth, byok, workspaceRole } = usePage().props;
	const isAdmin = auth?.user?.is_super_admin === true;
	const canManageWorkspace = workspaceRole === "owner" || workspaceRole === "admin";
	const byokUnlocked = byok?.unlocked === true;
	const baseNavItems = [
		{
			title: t("Profile"),
			href: edit$11(),
			icon: null
		},
		{
			title: t("Security"),
			href: edit$1(),
			icon: null
		},
		{
			title: t("Appearance"),
			href: edit$5(),
			icon: null
		},
		{
			title: t("Language"),
			href: edit$4(),
			icon: null
		},
		{
			title: t("Widget"),
			href: "/settings/widget",
			icon: null
		},
		{
			title: t("API tokens"),
			href: index$3(),
			icon: null
		},
		...byokUnlocked ? [{
			title: t("AI keys"),
			href: edit(),
			icon: null
		}] : []
	];
	const workspaceNavItems = [
		...canManageWorkspace ? [{
			title: t("Workspace name"),
			href: "/settings/workspace",
			icon: null
		}] : [],
		{
			title: t("Tags"),
			href: "/app/settings/tags",
			icon: null
		},
		{
			title: t("Canned replies"),
			href: "/app/settings/canned-replies",
			icon: null
		}
	];
	const adminOnlyNavItems = [
		{
			title: t("System"),
			href: index$35(),
			icon: null
		},
		{
			title: t("Widget defaults"),
			href: "/settings/widget-defaults",
			icon: null
		},
		{
			title: t("Branding"),
			href: index$2(),
			icon: null
		},
		{
			title: t("Marketing site"),
			href: index$1(),
			icon: null
		},
		{
			title: t("Privacy & GDPR"),
			href: index(),
			icon: null
		},
		{
			title: t("Widget Monitor"),
			href: "/settings/system/widget-monitor",
			icon: null
		},
		{
			title: t("Hot path latency"),
			href: "/settings/system/hotpath-latency",
			icon: null
		}
	];
	const navGroups = isAdmin ? [{
		title: t("Account"),
		items: baseNavItems
	}, {
		title: t("Platform"),
		items: adminOnlyNavItems
	}] : [{
		title: t("Account"),
		items: baseNavItems
	}, {
		title: t("Workspace"),
		items: workspaceNavItems
	}];
	return /* @__PURE__ */ jsxs("div", {
		className: "px-4 py-6 lg:px-6",
		children: [/* @__PURE__ */ jsx(Heading, {
			title: t("Settings"),
			description: t("Manage your profile and account settings")
		}), /* @__PURE__ */ jsxs("div", {
			className: "mt-6 grid gap-8 xl:grid-cols-[240px_minmax(0,1fr)] xl:items-start xl:gap-10",
			children: [/* @__PURE__ */ jsx("aside", {
				className: "w-full xl:sticky xl:top-6",
				children: /* @__PURE__ */ jsx("div", {
					className: "overflow-hidden rounded-2xl border border-border/70 bg-muted/20 shadow-sm",
					children: navGroups.map((group, groupIndex) => /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsxs("div", {
						className: "p-3",
						children: [/* @__PURE__ */ jsx("p", {
							className: "px-3 pb-2 text-[11px] font-semibold tracking-[0.16em] text-muted-foreground uppercase",
							children: group.title
						}), /* @__PURE__ */ jsx("nav", {
							className: "grid gap-1",
							"aria-label": `${group.title} settings`,
							children: group.items.map((item, index) => {
								const isActive = isCurrentOrParentUrl(item.href);
								return /* @__PURE__ */ jsxs(Link, {
									href: item.href,
									className: cn("flex w-full items-center gap-2 rounded-xl px-3 py-2.5 text-sm font-medium transition", {
										"bg-background text-foreground shadow-sm ring-1 ring-border/80": isActive,
										"text-muted-foreground hover:bg-background/80 hover:text-foreground": !isActive
									}),
									children: [item.icon && /* @__PURE__ */ jsx(item.icon, { className: "h-4 w-4" }), /* @__PURE__ */ jsx("span", { children: item.title })]
								}, `${toUrl(item.href)}-${index}`);
							})
						})]
					}), groupIndex < navGroups.length - 1 ? /* @__PURE__ */ jsx(Separator, {}) : null] }, group.title))
				})
			}), /* @__PURE__ */ jsx("div", {
				className: "min-w-0",
				children: /* @__PURE__ */ jsx("section", {
					className: "w-full max-w-[1120px] space-y-8",
					children
				})
			})]
		})]
	});
}
//#endregion
//#region resources/js/ssr.tsx
var defaultAppName = "Pitchbar";
function dirFromI18nProps(locale, catalog) {
	if (!locale || !catalog) return "ltr";
	return catalog[locale]?.rtl ? "rtl" : "ltr";
}
function titleFor(siteTitle, pageTitle) {
	return pageTitle ? `${pageTitle} - ${siteTitle}` : siteTitle;
}
function DirectedApp({ children, initialDir }) {
	const [dir, setDir] = useState(initialDir);
	useEffect(() => {
		return router.on("navigate", (event) => {
			const i18n = event.detail?.page?.props?.i18n;
			const next = dirFromI18nProps(i18n?.locale, i18n?.catalog);
			if (typeof document !== "undefined") document.documentElement.setAttribute("dir", next);
			setDir((prev) => prev === next ? prev : next);
		});
	}, []);
	return /* @__PURE__ */ jsx(DirectionProvider, {
		dir,
		children: /* @__PURE__ */ jsx(TooltipProvider, {
			delayDuration: 0,
			children: /* @__PURE__ */ jsxs(ConfirmDialogProvider, { children: [
				children,
				/* @__PURE__ */ jsx(Toaster$1, {}),
				/* @__PURE__ */ jsx(MarketingWidgetMount, {})
			] })
		})
	});
}
var renderPage = (page) => createInertiaApp({
	page,
	render: ReactDOMServer.renderToString,
	title: (pageTitle) => {
		return titleFor((page.props ?? {}).branding?.site_title?.trim() || defaultAppName, pageTitle);
	},
	resolve: (name) => {
		const pages = /* @__PURE__ */ Object.assign({
			"./pages/admin/agents/index.tsx": agents_exports$1,
			"./pages/admin/board.tsx": board_exports,
			"./pages/admin/changelog/changelog-form.tsx": changelog_form_exports,
			"./pages/admin/changelog/create.tsx": create_exports$4,
			"./pages/admin/changelog/edit.tsx": edit_exports$4,
			"./pages/admin/changelog/index.tsx": changelog_exports$3,
			"./pages/admin/conversations/index.tsx": conversations_exports$2,
			"./pages/admin/conversations/show.tsx": show_exports$5,
			"./pages/admin/dashboard.tsx": dashboard_exports$1,
			"./pages/admin/hotpath-latency.tsx": hotpath_latency_exports,
			"./pages/admin/integrations/wordpress.tsx": wordpress_exports,
			"./pages/admin/jobs/failed.tsx": failed_exports,
			"./pages/admin/leads/index.tsx": leads_exports$1,
			"./pages/admin/pages/create.tsx": create_exports$3,
			"./pages/admin/pages/edit.tsx": edit_exports$3,
			"./pages/admin/pages/index.tsx": pages_exports,
			"./pages/admin/pages/page-form.tsx": page_form_exports,
			"./pages/admin/plans/create.tsx": create_exports$2,
			"./pages/admin/plans/edit.tsx": edit_exports$2,
			"./pages/admin/plans/index.tsx": plans_exports,
			"./pages/admin/plans/plan-form.tsx": plan_form_exports,
			"./pages/admin/queue-health.tsx": queue_health_exports,
			"./pages/admin/subscriptions/index.tsx": subscriptions_exports,
			"./pages/admin/translations/edit.tsx": edit_exports$1,
			"./pages/admin/translations/index.tsx": translations_exports,
			"./pages/admin/usage/index.tsx": usage_exports,
			"./pages/admin/users/index.tsx": users_exports,
			"./pages/admin/widget-monitor.tsx": widget_monitor_exports,
			"./pages/admin/workspaces/index.tsx": workspaces_exports,
			"./pages/admin/workspaces/show.tsx": show_exports$4,
			"./pages/app/agents/behavior.tsx": behavior_exports,
			"./pages/app/agents/conversations.tsx": conversations_exports$1,
			"./pages/app/agents/create.tsx": create_exports$1,
			"./pages/app/agents/ctas.tsx": ctas_exports,
			"./pages/app/agents/curated.tsx": curated_exports,
			"./pages/app/agents/customize.tsx": customize_exports,
			"./pages/app/agents/experiments.tsx": experiments_exports,
			"./pages/app/agents/index.tsx": agents_exports,
			"./pages/app/agents/knowledge.tsx": knowledge_exports,
			"./pages/app/agents/leads.tsx": leads_exports,
			"./pages/app/agents/mcp-activity.tsx": mcp_activity_exports,
			"./pages/app/agents/mcp-tools.tsx": mcp_tools_exports,
			"./pages/app/agents/mcp.tsx": mcp_exports,
			"./pages/app/agents/playground.tsx": playground_exports,
			"./pages/app/agents/settings.tsx": settings_exports,
			"./pages/app/agents/show.tsx": show_exports$3,
			"./pages/app/agents/sources.tsx": sources_exports,
			"./pages/app/agents/vertical.tsx": vertical_exports,
			"./pages/app/analytics/content-gaps.tsx": content_gaps_exports,
			"./pages/app/analytics/index.tsx": analytics_exports,
			"./pages/app/audit/index.tsx": audit_exports,
			"./pages/app/billing.tsx": billing_exports,
			"./pages/app/conversations/index.tsx": conversations_exports,
			"./pages/app/conversations/show.tsx": show_exports$2,
			"./pages/app/inbox/index.tsx": inbox_exports,
			"./pages/app/inbox/show.tsx": show_exports$1,
			"./pages/app/integrations/index.tsx": integrations_exports$3,
			"./pages/app/razorpay-checkout.tsx": razorpay_checkout_exports,
			"./pages/app/settings/canned-replies.tsx": canned_replies_exports,
			"./pages/app/settings/live-chat.tsx": live_chat_exports,
			"./pages/app/settings/members.tsx": members_exports,
			"./pages/app/settings/tags.tsx": tags_exports,
			"./pages/app/system-health/index.tsx": system_health_exports,
			"./pages/app/tickets/index.tsx": tickets_exports,
			"./pages/app/tickets/show.tsx": show_exports,
			"./pages/app/workflows/canvas-internals/inspector.tsx": inspector_exports,
			"./pages/app/workflows/canvas-internals/nodes.tsx": nodes_exports,
			"./pages/app/workflows/canvas-internals/test-run.tsx": test_run_exports,
			"./pages/app/workflows/canvas.tsx": canvas_exports,
			"./pages/app/workflows/create.tsx": create_exports,
			"./pages/app/workflows/edit.tsx": edit_exports,
			"./pages/app/workflows/index.tsx": workflows_exports,
			"./pages/app/workflows/workflow-form.tsx": workflow_form_exports,
			"./pages/auth/accept-invitation.tsx": accept_invitation_exports,
			"./pages/auth/confirm-password.tsx": confirm_password_exports,
			"./pages/auth/forgot-password.tsx": forgot_password_exports,
			"./pages/auth/login.tsx": login_exports,
			"./pages/auth/register.tsx": register_exports,
			"./pages/auth/reset-password.tsx": reset_password_exports,
			"./pages/auth/two-factor-challenge.tsx": two_factor_challenge_exports,
			"./pages/auth/verify-email.tsx": verify_email_exports,
			"./pages/dashboard.tsx": dashboard_exports,
			"./pages/marketing/changelog.tsx": changelog_exports$2,
			"./pages/marketing/home.tsx": home_exports$2,
			"./pages/marketing/how-it-works.tsx": how_it_works_exports$2,
			"./pages/marketing/integrations.tsx": integrations_exports$2,
			"./pages/marketing/page.tsx": page_exports,
			"./pages/marketing/pricing.tsx": pricing_exports$2,
			"./pages/marketing/privacy.tsx": privacy_exports$2,
			"./pages/marketing/terms.tsx": terms_exports$2,
			"./pages/marketing-themes/aurora/_layout.tsx": _layout_exports$1,
			"./pages/marketing-themes/aurora/auth-shell.tsx": auth_shell_exports$1,
			"./pages/marketing-themes/aurora/changelog.tsx": changelog_exports$1,
			"./pages/marketing-themes/aurora/home.tsx": home_exports$1,
			"./pages/marketing-themes/aurora/how-it-works.tsx": how_it_works_exports$1,
			"./pages/marketing-themes/aurora/integrations.tsx": integrations_exports$1,
			"./pages/marketing-themes/aurora/interactive-chat.tsx": interactive_chat_exports$1,
			"./pages/marketing-themes/aurora/pricing.tsx": pricing_exports$1,
			"./pages/marketing-themes/aurora/privacy.tsx": privacy_exports$1,
			"./pages/marketing-themes/aurora/terms.tsx": terms_exports$1,
			"./pages/marketing-themes/prism/_layout.tsx": _layout_exports,
			"./pages/marketing-themes/prism/auth-shell.tsx": auth_shell_exports,
			"./pages/marketing-themes/prism/changelog.tsx": changelog_exports,
			"./pages/marketing-themes/prism/home.tsx": home_exports,
			"./pages/marketing-themes/prism/how-it-works.tsx": how_it_works_exports,
			"./pages/marketing-themes/prism/integrations.tsx": integrations_exports,
			"./pages/marketing-themes/prism/interactive-chat.tsx": interactive_chat_exports,
			"./pages/marketing-themes/prism/pricing.tsx": pricing_exports,
			"./pages/marketing-themes/prism/privacy.tsx": privacy_exports,
			"./pages/marketing-themes/prism/terms.tsx": terms_exports,
			"./pages/onboarding/index.tsx": onboarding_exports,
			"./pages/settings/api-tokens.tsx": api_tokens_exports,
			"./pages/settings/appearance.tsx": appearance_exports,
			"./pages/settings/byok-keys.tsx": byok_keys_exports,
			"./pages/settings/locale.tsx": locale_exports,
			"./pages/settings/marketing-content-editor.tsx": marketing_content_editor_exports,
			"./pages/settings/privacy-policy-editor.tsx": privacy_policy_editor_exports,
			"./pages/settings/profile.tsx": profile_exports,
			"./pages/settings/security.tsx": security_exports,
			"./pages/settings/system.tsx": system_exports,
			"./pages/settings/widget.tsx": widget_exports,
			"./pages/settings/workspace.tsx": workspace_exports,
			"./pages/welcome.tsx": welcome_exports
		});
		const key = `./pages/${name}.tsx`;
		const mod = pages[key];
		if (!mod) throw new Error(`Inertia SSR: page component "${name}" not found at ${key}.`);
		return mod;
	},
	layout: (name) => {
		switch (true) {
			case name === "welcome": return null;
			case name.startsWith("auth/"): return AuthLayout;
			case name.startsWith("settings/"): return [AccountLayout, SettingsLayout];
			case name === "dashboard": return AppLayout;
			default: return null;
		}
	},
	setup: ({ App, props }) => {
		const pageProps = page.props ?? {};
		return /* @__PURE__ */ jsx(DirectedApp, {
			initialDir: dirFromI18nProps(pageProps.i18n?.locale, pageProps.i18n?.catalog),
			children: /* @__PURE__ */ jsx(App, { ...props })
		});
	}
});
createServer(renderPage);
//#endregion
export { renderPage as default };

//# sourceMappingURL=ssr.js.map