UNPKG

@blocknote/shadcn

Version:

A "Notion-style" block-based extensible text editor built on top of Prosemirror and Tiptap.

1,290 lines 52.7 kB
import { assertEmpty as e, mergeCSSClasses as t } from "@blocknote/core";
import { BlockNoteViewRaw as n, ComponentsContext as r, FormattingToolbar as i, FormattingToolbarController as a, elementOverflow as o, getFormattingToolbarItems as s, mergeRefs as c, preventFocusOnTap as l, useAutoFocus as u, useBlockNoteContext as d, useDictionary as f, useFocusWithin as p, useMergeRefs as m, usePortalElement as h } from "@blocknote/react";
import { createContext as g, forwardRef as _, useContext as v, useEffect as y, useMemo as b, useRef as x, useState as S } from "react";
import { Fragment as ee, jsx as C, jsxs as w } from "react/jsx-runtime";
import { Avatar as T } from "@base-ui/react/avatar";
import { clsx as te } from "clsx";
import { twMerge as ne } from "tailwind-merge";
import { mergeProps as re } from "@base-ui/react/merge-props";
import { useRender as ie } from "@base-ui/react/use-render";
import { cva as E } from "class-variance-authority";
import { Button as ae } from "@base-ui/react/button";
import { Menu as D } from "@base-ui/react/menu";
import { CheckIcon as O, ChevronDownIcon as k, ChevronRight as oe, ChevronRightIcon as se, ChevronUpIcon as ce } from "lucide-react";
import { Input as le } from "@base-ui/react/input";
import { Popover as A } from "@base-ui/react/popover";
import { Select as j } from "@base-ui/react/select";
import { Tabs as M } from "@base-ui/react/tabs";
import { Toggle as ue } from "@base-ui/react/toggle";
import { Tooltip as N } from "@base-ui/react/tooltip";
//#region src/form/Form.tsx
var de = (t) => {
	let { children: n, onSubmit: r, submitButton: i, ...a } = t;
	return e(a), /* @__PURE__ */ w("form", {
		className: "bn-form",
		onSubmit: (e) => {
			e.preventDefault(), r?.();
		},
		children: [n, i === "none" ? null : i]
	});
};
//#endregion
//#region src/lib/utils.ts
function P(...e) {
	return ne(te(e));
}
//#endregion
//#region src/components/ui/avatar.tsx
function fe({ className: e, size: t = "default", ...n }) {
	return /* @__PURE__ */ C(T.Root, {
		"data-slot": "avatar",
		"data-size": t,
		className: P("group/avatar relative flex size-8 shrink-0 rounded-full select-none after:absolute after:inset-0 after:rounded-full after:border after:border-border after:mix-blend-darken data-[size=lg]:size-10 data-[size=sm]:size-6 dark:after:mix-blend-lighten", e),
		...n
	});
}
function pe({ className: e, ...t }) {
	return /* @__PURE__ */ C(T.Image, {
		"data-slot": "avatar-image",
		className: P("aspect-square size-full rounded-full object-cover", e),
		...t
	});
}
function F({ className: e, ...t }) {
	return /* @__PURE__ */ C(T.Fallback, {
		"data-slot": "avatar-fallback",
		className: P("flex size-full items-center justify-center rounded-full bg-muted text-sm text-muted-foreground group-data-[size=sm]/avatar:text-xs", e),
		...t
	});
}
//#endregion
//#region src/components/ui/badge.tsx
var I = E("group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!", {
	variants: { variant: {
		default: "bg-primary text-primary-foreground [a]:hover:bg-primary/80",
		secondary: "bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",
		destructive: "bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20",
		outline: "border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",
		ghost: "hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",
		link: "text-primary underline-offset-4 hover:underline"
	} },
	defaultVariants: { variant: "default" }
});
function L({ className: e, variant: t = "default", render: n, ...r }) {
	return ie({
		defaultTagName: "span",
		props: re({ className: P(I({ variant: t }), e) }, r),
		render: n,
		state: {
			slot: "badge",
			variant: t
		}
	});
}
//#endregion
//#region src/components/ui/button.tsx
var R = E("group/button inline-flex shrink-0 items-center justify-center rounded-md border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", {
	variants: {
		variant: {
			default: "bg-primary text-primary-foreground hover:bg-primary/80",
			outline: "border-border bg-background shadow-xs hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",
			secondary: "bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",
			ghost: "hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",
			destructive: "bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",
			link: "text-primary underline-offset-4 hover:underline"
		},
		size: {
			default: "h-9 gap-1.5 px-2.5 in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
			xs: "h-6 gap-1 rounded-[min(var(--radius-md),8px)] px-2 text-xs in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",
			sm: "h-8 gap-1 rounded-[min(var(--radius-md),10px)] px-2.5 in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5",
			lg: "h-10 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
			icon: "size-9",
			"icon-xs": "size-6 rounded-[min(var(--radius-md),8px)] in-data-[slot=button-group]:rounded-md [&_svg:not([class*='size-'])]:size-3",
			"icon-sm": "size-8 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-md",
			"icon-lg": "size-10"
		}
	},
	defaultVariants: {
		variant: "default",
		size: "default"
	}
});
function z({ className: e, variant: t = "default", size: n = "default", ...r }) {
	return /* @__PURE__ */ C(ae, {
		"data-slot": "button",
		className: P(R({
			variant: t,
			size: n,
			className: e
		})),
		...r
	});
}
//#endregion
//#region src/components/ui/card.tsx
function B({ className: e, size: t = "default", ...n }) {
	return /* @__PURE__ */ C("div", {
		"data-slot": "card",
		"data-size": t,
		className: P("group/card flex flex-col gap-(--card-spacing) overflow-hidden rounded-xl bg-card py-(--card-spacing) text-sm text-card-foreground shadow-xs ring-1 ring-foreground/10 [--card-spacing:--spacing(6)] has-[>img:first-child]:pt-0 data-[size=sm]:[--card-spacing:--spacing(4)] *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl", e),
		...n
	});
}
function me({ className: e, ...t }) {
	return /* @__PURE__ */ C("div", {
		"data-slot": "card-content",
		className: P("px-(--card-spacing)", e),
		...t
	});
}
//#endregion
//#region src/components/ui/dropdown-menu.tsx
function he({ ...e }) {
	return /* @__PURE__ */ C(D.Root, {
		"data-slot": "dropdown-menu",
		...e
	});
}
function ge({ ...e }) {
	return /* @__PURE__ */ C(D.Trigger, {
		"data-slot": "dropdown-menu-trigger",
		...e
	});
}
function V({ align: e = "start", alignOffset: t = 0, side: n = "bottom", sideOffset: r = 4, className: i, container: a, ...o }) {
	return /* @__PURE__ */ C(D.Portal, {
		container: a,
		children: /* @__PURE__ */ C(D.Positioner, {
			className: "isolate z-50 outline-none",
			align: e,
			alignOffset: t,
			side: n,
			sideOffset: r,
			children: /* @__PURE__ */ C(D.Popup, {
				"data-slot": "dropdown-menu-content",
				className: P("z-50 max-h-(--available-height) min-w-32 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-md bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 outline-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-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 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:overflow-hidden data-closed:fade-out-0 data-closed:zoom-out-95", i),
				...o
			})
		})
	});
}
function _e({ ...e }) {
	return /* @__PURE__ */ C(D.Group, {
		"data-slot": "dropdown-menu-group",
		...e
	});
}
function ve({ className: e, inset: t, ...n }) {
	return /* @__PURE__ */ C(D.GroupLabel, {
		"data-slot": "dropdown-menu-label",
		"data-inset": t,
		className: P("px-2 py-1.5 text-xs font-medium text-muted-foreground data-inset:pl-8", e),
		...n
	});
}
function ye({ className: e, inset: t, variant: n = "default", ...r }) {
	return /* @__PURE__ */ C(D.Item, {
		"data-slot": "dropdown-menu-item",
		"data-inset": t,
		"data-variant": n,
		className: P("group/dropdown-menu-item relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-8 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive", e),
		...r
	});
}
function be({ ...e }) {
	return /* @__PURE__ */ C(D.SubmenuRoot, {
		"data-slot": "dropdown-menu-sub",
		...e
	});
}
function xe({ className: e, inset: t, children: n, ...r }) {
	return /* @__PURE__ */ w(D.SubmenuTrigger, {
		"data-slot": "dropdown-menu-sub-trigger",
		"data-inset": t,
		className: P("flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-8 data-popup-open:bg-accent data-popup-open:text-accent-foreground data-open:bg-accent data-open:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", e),
		...r,
		children: [n, /* @__PURE__ */ C(se, { className: "ml-auto" })]
	});
}
function Se({ align: e = "start", alignOffset: t = -3, side: n = "right", sideOffset: r = 0, className: i, ...a }) {
	return /* @__PURE__ */ C(V, {
		"data-slot": "dropdown-menu-sub-content",
		className: P("w-auto min-w-[96px] rounded-md bg-popover p-1 text-popover-foreground shadow-lg ring-1 ring-foreground/10 duration-100 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 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95", i),
		align: e,
		alignOffset: t,
		side: n,
		sideOffset: r,
		...a
	});
}
function Ce({ className: e, children: t, checked: n, inset: r, ...i }) {
	return /* @__PURE__ */ w(D.CheckboxItem, {
		"data-slot": "dropdown-menu-checkbox-item",
		"data-inset": r,
		className: P("relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-8 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", e),
		checked: n,
		...i,
		children: [/* @__PURE__ */ C("span", {
			className: "pointer-events-none absolute right-2 flex items-center justify-center",
			"data-slot": "dropdown-menu-checkbox-item-indicator",
			children: /* @__PURE__ */ C(D.CheckboxItemIndicator, { children: /* @__PURE__ */ C(O, {}) })
		}), t]
	});
}
function we({ className: e, ...t }) {
	return /* @__PURE__ */ C(D.Separator, {
		"data-slot": "dropdown-menu-separator",
		className: P("-mx-1 my-1 h-px bg-border", e),
		...t
	});
}
//#endregion
//#region src/components/ui/input.tsx
function Te({ className: e, type: t, ...n }) {
	return /* @__PURE__ */ C(le, {
		type: t,
		"data-slot": "input",
		className: P("h-9 w-full min-w-0 rounded-md border border-input bg-transparent px-2.5 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40", e),
		...n
	});
}
//#endregion
//#region src/components/ui/label.tsx
function Ee({ className: e, ...t }) {
	return /* @__PURE__ */ C("label", {
		"data-slot": "label",
		className: P("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50", e),
		...t
	});
}
//#endregion
//#region src/components/ui/popover.tsx
function De({ ...e }) {
	return /* @__PURE__ */ C(A.Root, {
		"data-slot": "popover",
		...e
	});
}
function Oe({ ...e }) {
	return /* @__PURE__ */ C(A.Trigger, {
		"data-slot": "popover-trigger",
		...e
	});
}
function ke({ className: e, align: t = "center", alignOffset: n = 0, side: r = "bottom", sideOffset: i = 4, container: a, ...o }) {
	return /* @__PURE__ */ C(A.Portal, {
		container: a,
		children: /* @__PURE__ */ C(A.Positioner, {
			align: t,
			alignOffset: n,
			side: r,
			sideOffset: i,
			className: "isolate z-50",
			children: /* @__PURE__ */ C(A.Popup, {
				"data-slot": "popover-content",
				className: P("z-50 flex w-72 origin-(--transform-origin) flex-col gap-4 rounded-md bg-popover p-4 text-sm text-popover-foreground shadow-md ring-1 ring-foreground/10 outline-hidden duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-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 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95", e),
				...o
			})
		})
	});
}
//#endregion
//#region src/components/ui/select.tsx
var Ae = j.Root;
function je({ className: e, ...t }) {
	return /* @__PURE__ */ C(j.Value, {
		"data-slot": "select-value",
		className: P("flex flex-1 text-left", e),
		...t
	});
}
function Me({ className: e, size: t = "default", children: n, ...r }) {
	return /* @__PURE__ */ w(j.Trigger, {
		"data-slot": "select-trigger",
		"data-size": t,
		className: P("flex w-fit items-center justify-between gap-1.5 rounded-md border border-input bg-transparent py-2 pr-2 pl-2.5 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", e),
		...r,
		children: [n, /* @__PURE__ */ C(j.Icon, { render: /* @__PURE__ */ C(k, { className: "text-muted-foreground pointer-events-none size-4" }) })]
	});
}
function Ne({ className: e, children: t, side: n = "bottom", sideOffset: r = 4, align: i = "center", alignOffset: a = 0, alignItemWithTrigger: o = !0, container: s, ...c }) {
	return /* @__PURE__ */ C(j.Portal, {
		container: s,
		children: /* @__PURE__ */ C(j.Positioner, {
			side: n,
			sideOffset: r,
			align: i,
			alignOffset: a,
			alignItemWithTrigger: o,
			className: "isolate z-50",
			children: /* @__PURE__ */ w(j.Popup, {
				"data-slot": "select-content",
				"data-align-trigger": o,
				className: P("relative isolate z-50 max-h-(--available-height) w-(--anchor-width) min-w-36 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-md bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-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 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95", e),
				...c,
				children: [
					/* @__PURE__ */ C(Fe, {}),
					/* @__PURE__ */ C(j.List, { children: t }),
					/* @__PURE__ */ C(Ie, {})
				]
			})
		})
	});
}
function Pe({ className: e, children: t, ...n }) {
	return /* @__PURE__ */ w(j.Item, {
		"data-slot": "select-item",
		className: P("relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground 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", e),
		...n,
		children: [/* @__PURE__ */ C(j.ItemText, {
			className: "flex flex-1 shrink-0 gap-2 whitespace-nowrap",
			children: t
		}), /* @__PURE__ */ C(j.ItemIndicator, {
			render: /* @__PURE__ */ C("span", { className: "pointer-events-none absolute right-2 flex size-4 items-center justify-center" }),
			children: /* @__PURE__ */ C(O, { className: "pointer-events-none" })
		})]
	});
}
function Fe({ className: e, ...t }) {
	return /* @__PURE__ */ C(j.ScrollUpArrow, {
		"data-slot": "select-scroll-up-button",
		className: P("top-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4", e),
		...t,
		children: /* @__PURE__ */ C(ce, {})
	});
}
function Ie({ className: e, ...t }) {
	return /* @__PURE__ */ C(j.ScrollDownArrow, {
		"data-slot": "select-scroll-down-button",
		className: P("bottom-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4", e),
		...t,
		children: /* @__PURE__ */ C(k, {})
	});
}
//#endregion
//#region src/components/ui/skeleton.tsx
function Le({ className: e, ...t }) {
	return /* @__PURE__ */ C("div", {
		"data-slot": "skeleton",
		className: P("animate-pulse rounded-md bg-muted", e),
		...t
	});
}
//#endregion
//#region src/components/ui/tabs.tsx
function Re({ className: e, orientation: t = "horizontal", ...n }) {
	return /* @__PURE__ */ C(M.Root, {
		"data-slot": "tabs",
		"data-orientation": t,
		className: P("group/tabs flex gap-2 data-[orientation=horizontal]:flex-col", e),
		...n
	});
}
var ze = E("group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-[orientation=horizontal]/tabs:h-9 group-data-[orientation=vertical]/tabs:h-fit group-data-[orientation=vertical]/tabs:flex-col data-[variant=line]:rounded-none", {
	variants: { variant: {
		default: "bg-muted",
		line: "gap-1 bg-transparent"
	} },
	defaultVariants: { variant: "default" }
});
function Be({ className: e, variant: t = "default", ...n }) {
	return /* @__PURE__ */ C(M.List, {
		"data-slot": "tabs-list",
		"data-variant": t,
		className: P(ze({ variant: t }), e),
		...n
	});
}
function Ve({ className: e, ...t }) {
	return /* @__PURE__ */ C(M.Tab, {
		"data-slot": "tabs-trigger",
		className: P("relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-[orientation=vertical]/tabs:w-full group-data-[orientation=vertical]/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-disabled:pointer-events-none aria-disabled:opacity-50 dark:text-muted-foreground dark:hover:text-foreground group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", "group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent", "data-active:bg-background data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground", "after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-[orientation=horizontal]/tabs:after:inset-x-0 group-data-[orientation=horizontal]/tabs:after:bottom-[-5px] group-data-[orientation=horizontal]/tabs:after:h-0.5 group-data-[orientation=vertical]/tabs:after:inset-y-0 group-data-[orientation=vertical]/tabs:after:-right-1 group-data-[orientation=vertical]/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100", e),
		...t
	});
}
function He({ className: e, ...t }) {
	return /* @__PURE__ */ C(M.Panel, {
		"data-slot": "tabs-content",
		className: P("flex-1 text-sm outline-none", e),
		...t
	});
}
//#endregion
//#region src/components/ui/toggle.tsx
var Ue = E("group/toggle inline-flex items-center justify-center gap-1 rounded-md text-sm font-medium whitespace-nowrap transition-[color,box-shadow] outline-none hover:bg-muted hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 aria-pressed:bg-muted dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", {
	variants: {
		variant: {
			default: "bg-transparent",
			outline: "border border-input bg-transparent shadow-xs hover:bg-muted"
		},
		size: {
			default: "h-9 min-w-9 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
			sm: "h-8 min-w-8 px-2.5 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5",
			lg: "h-10 min-w-10 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2"
		}
	},
	defaultVariants: {
		variant: "default",
		size: "default"
	}
});
function We({ className: e, variant: t = "default", size: n = "default", ...r }) {
	return /* @__PURE__ */ C(ue, {
		"data-slot": "toggle",
		className: P(Ue({
			variant: t,
			size: n,
			className: e
		})),
		...r
	});
}
//#endregion
//#region src/components/ui/tooltip.tsx
function Ge({ delay: e = 0, ...t }) {
	return /* @__PURE__ */ C(N.Provider, {
		"data-slot": "tooltip-provider",
		delay: e,
		...t
	});
}
function Ke({ ...e }) {
	return /* @__PURE__ */ C(N.Root, {
		"data-slot": "tooltip",
		...e
	});
}
function qe({ ...e }) {
	return /* @__PURE__ */ C(N.Trigger, {
		"data-slot": "tooltip-trigger",
		...e
	});
}
function Je({ className: e, side: t = "top", sideOffset: n = 4, align: r = "center", alignOffset: i = 0, children: a, container: o, ...s }) {
	return /* @__PURE__ */ C(N.Portal, {
		container: o,
		children: /* @__PURE__ */ C(N.Positioner, {
			align: r,
			alignOffset: i,
			side: t,
			sideOffset: n,
			className: "isolate z-50",
			children: /* @__PURE__ */ w(N.Popup, {
				"data-slot": "tooltip-content",
				className: P("z-50 inline-flex w-fit max-w-xs origin-(--transform-origin) items-center gap-1.5 rounded-md bg-foreground px-3 py-1.5 text-xs text-background has-data-[slot=kbd]:pr-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-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 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95", e),
				...s,
				children: [a, /* @__PURE__ */ C(N.Arrow, { className: "bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%-2px)] rotate-45 rounded-[2px] data-[side=bottom]:top-1 data-[side=inline-end]:top-1/2! data-[side=inline-end]:-left-1 data-[side=inline-end]:-translate-y-1/2 data-[side=inline-start]:top-1/2! data-[side=inline-start]:-right-1 data-[side=inline-start]:-translate-y-1/2 data-[side=left]:top-1/2! data-[side=left]:-right-1 data-[side=left]:-translate-y-1/2 data-[side=right]:top-1/2! data-[side=right]:-left-1 data-[side=right]:-translate-y-1/2 data-[side=top]:-bottom-2.5" })]
			})
		})
	});
}
//#endregion
//#region src/ShadCNComponentsContext.tsx
var H = {
	Avatar: {
		Avatar: fe,
		AvatarFallback: F,
		AvatarImage: pe
	},
	Badge: { Badge: L },
	Button: { Button: z },
	Card: {
		Card: B,
		CardContent: me
	},
	DropdownMenu: {
		DropdownMenu: he,
		DropdownMenuCheckboxItem: Ce,
		DropdownMenuContent: V,
		DropdownMenuGroup: _e,
		DropdownMenuItem: ye,
		DropdownMenuLabel: ve,
		DropdownMenuSeparator: we,
		DropdownMenuSub: be,
		DropdownMenuSubContent: Se,
		DropdownMenuSubTrigger: xe,
		DropdownMenuTrigger: ge
	},
	Input: { Input: Te },
	Label: { Label: Ee },
	Popover: {
		Popover: De,
		PopoverContent: ke,
		PopoverTrigger: Oe
	},
	Select: {
		Select: Ae,
		SelectContent: Ne,
		SelectItem: Pe,
		SelectTrigger: Me,
		SelectValue: je
	},
	Skeleton: { Skeleton: Le },
	Tabs: {
		Tabs: Re,
		TabsContent: He,
		TabsList: Be,
		TabsTrigger: Ve
	},
	Toggle: { Toggle: We },
	Tooltip: {
		Tooltip: Ke,
		TooltipContent: Je,
		TooltipProvider: Ge,
		TooltipTrigger: qe
	}
}, U = g(void 0);
function W() {
	return v(U);
}
//#endregion
//#region src/form/TextInput.tsx
var Ye = _((t, n) => {
	let { className: r, name: i, label: a, variant: o, icon: s, value: c, autoFocus: l, placeholder: d, disabled: f, onKeyDown: p, onChange: h, autoComplete: g, "aria-activedescendant": _, rightSection: v, ...y } = t;
	e(y);
	let b = u(l), x = m([b, n]), S = W();
	return /* @__PURE__ */ w("div", {
		className: P(r, "border-input bg-background ring-offset-background placeholder:text-muted-foreground focus-visible:ring-ring flex h-10 w-full rounded-md border px-3 py-2 text-sm file:border-0 file:bg-transparent file:text-sm file:font-medium focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50", "text-foreground items-center gap-2"),
		children: [
			s,
			/* @__PURE__ */ w("div", {
				className: "flex-1",
				children: [a && /* @__PURE__ */ C(S.Label.Label, {
					htmlFor: a,
					children: a
				}), /* @__PURE__ */ C(S.Input.Input, {
					className: P(r, "h-auto border-none p-0"),
					id: a,
					name: i,
					placeholder: d,
					disabled: f,
					value: c,
					onKeyDown: p,
					onChange: h,
					ref: x,
					"aria-activedescendant": _
				})]
			}),
			v
		]
	});
});
//#endregion
//#region src/lib/preventFocusOnOpen.ts
function G(e) {
	return e ? { onFocusCapture(e) {
		let t = e.relatedTarget;
		t instanceof HTMLElement && !e.currentTarget.contains(t) && t.focus({ preventScroll: !0 });
	} } : {};
}
//#endregion
//#region src/menu/Menu.tsx
var K = g({
	portalElement: null,
	preventFocusOnOpen: !1
}), Xe = (t) => {
	let { children: n, onOpenChange: r, position: i, portalElement: a, preventFocusOnOpen: o, sub: s, ...c } = t;
	e(c);
	let l = W(), u = {
		portalElement: a,
		preventFocusOnOpen: o ?? !1
	};
	return s ? /* @__PURE__ */ C(l.DropdownMenu.DropdownMenuSub, {
		onOpenChange: r,
		children: /* @__PURE__ */ C(K.Provider, {
			value: u,
			children: n
		})
	}) : /* @__PURE__ */ C(l.DropdownMenu.DropdownMenu, {
		modal: !1,
		onOpenChange: r,
		children: /* @__PURE__ */ C(K.Provider, {
			value: u,
			children: n
		})
	});
}, Ze = (t) => {
	let { children: n, sub: r, ...i } = t;
	e(i);
	let a = W();
	return r ? /* @__PURE__ */ C(a.DropdownMenu.DropdownMenuSubTrigger, { children: n }) : /* @__PURE__ */ C(a.DropdownMenu.DropdownMenuTrigger, { render: n });
}, Qe = _((t, n) => {
	let { className: r, children: i, sub: a, ...o } = t;
	e(o);
	let s = W(), { portalElement: c, preventFocusOnOpen: l } = v(K);
	return a ? /* @__PURE__ */ C(s.DropdownMenu.DropdownMenuSubContent, {
		className: r,
		container: c,
		ref: n,
		children: i
	}) : /* @__PURE__ */ C(s.DropdownMenu.DropdownMenuContent, {
		className: r,
		container: c,
		ref: n,
		...G(l),
		children: i
	});
}), $e = _((t, n) => {
	let { className: r, children: i, icon: a, checked: o, subTrigger: s, onClick: c, ...u } = t;
	e(u);
	let d = W();
	return s ? /* @__PURE__ */ w(ee, { children: [a, i] }) : o === void 0 ? /* @__PURE__ */ w(d.DropdownMenu.DropdownMenuItem, {
		className: r,
		ref: n,
		onClick: c,
		onMouseDown: l,
		...u,
		children: [
			a,
			i,
			s && /* @__PURE__ */ C(oe, { className: "ml-auto h-4 w-4" })
		]
	}) : /* @__PURE__ */ w(d.DropdownMenu.DropdownMenuCheckboxItem, {
		className: P(r, "gap-1", o ? "" : "px-2"),
		ref: n,
		checked: o,
		onClick: c,
		onMouseDown: l,
		...u,
		children: [a, i]
	});
}), et = _((t, n) => {
	let { className: r, ...i } = t;
	e(i);
	let a = W();
	return /* @__PURE__ */ C(a.DropdownMenu.DropdownMenuSeparator, {
		className: r,
		ref: n
	});
}), tt = _((t, n) => {
	let { className: r, children: i, ...a } = t;
	e(a);
	let o = W();
	return /* @__PURE__ */ C(o.DropdownMenu.DropdownMenuGroup, { children: /* @__PURE__ */ C(o.DropdownMenu.DropdownMenuLabel, {
		className: r,
		ref: n,
		children: i
	}) });
}), nt = _((t, n) => {
	let { className: r, children: i, icon: a, onClick: o, onDragEnd: s, onDragStart: c, draggable: l, label: u, ...d } = t;
	e(d, !1);
	let f = W();
	return /* @__PURE__ */ w(f.Button.Button, {
		variant: "ghost",
		className: P(r, "text-gray-400"),
		ref: n,
		"aria-label": u,
		onClick: o,
		onDragStart: c,
		onDragEnd: s,
		draggable: l,
		...d,
		children: [a, i]
	});
}), rt = _((t, n) => {
	let { className: r, tabs: i, defaultOpenTab: a, openTab: o, setOpenTab: s, loading: c, ...l } = t;
	e(l);
	let u = W();
	return /* @__PURE__ */ w(u.Tabs.Tabs, {
		className: P(r, "bg-popover max-w-screen rounded-lg p-2"),
		ref: n,
		value: o,
		defaultValue: a,
		onValueChange: s,
		children: [/* @__PURE__ */ C(u.Tabs.TabsList, { children: i.map((e) => /* @__PURE__ */ C(u.Tabs.TabsTrigger, {
			value: e.name,
			children: e.name
		}, e.name)) }), i.map((e) => /* @__PURE__ */ C(u.Tabs.TabsContent, {
			value: e.name,
			children: /* @__PURE__ */ C(u.Card.Card, { children: /* @__PURE__ */ C(u.Card.CardContent, {
				className: "p-4",
				children: e.tabPanel
			}) })
		}, e.name))]
	});
}), it = _((t, n) => {
	let { className: r, children: i, ...a } = t;
	return e(a), /* @__PURE__ */ C("div", {
		className: P(r, "flex flex-col items-start justify-center gap-2"),
		ref: n,
		children: i
	});
}), at = _((t, n) => {
	let { className: r, value: i, placeholder: a, onKeyDown: o, onChange: s, ...c } = t;
	e(c);
	let l = W();
	return /* @__PURE__ */ C(l.Input.Input, {
		"data-test": "embed-input",
		className: P(r, "w-80 max-w-full"),
		ref: n,
		value: i,
		placeholder: a,
		onKeyDown: o,
		onChange: s
	});
}), q = g(null), ot = (t) => {
	let { children: n, open: r, onOpenChange: i, position: a, portalElement: o, ...s } = t;
	e(s);
	let c = W();
	return /* @__PURE__ */ C(c.Popover.Popover, {
		open: r,
		onOpenChange: i,
		children: /* @__PURE__ */ C(q.Provider, {
			value: o,
			children: n
		})
	});
}, st = _((t, n) => {
	let { children: r, ...i } = t;
	e(i);
	let a = W();
	return /* @__PURE__ */ C(a.Popover.PopoverTrigger, {
		ref: n,
		render: r
	});
}), ct = _((t, n) => {
	let { className: r, variant: i, children: a, ...o } = t;
	e(o);
	let s = W(), c = v(q);
	return /* @__PURE__ */ C(s.Popover.PopoverContent, {
		sideOffset: 8,
		container: c,
		initialFocus: !1,
		className: P(r, "flex flex-col gap-2", i === "panel-popover" ? "w-fit max-w-none border-none p-0 shadow-none" : ""),
		ref: n,
		children: a
	});
}), lt = _((t, n) => {
	let { className: r, children: i, ...a } = t;
	return e(a, !1), /* @__PURE__ */ C("div", {
		className: r,
		ref: n,
		...a,
		children: i
	});
}), ut = _((t, n) => {
	let { className: r, children: i, icon: a, onClick: o, onDragEnd: s, onDragStart: c, draggable: l, label: u, ...d } = t;
	e(d, !1);
	let f = W();
	return /* @__PURE__ */ w(f.Button.Button, {
		variant: "ghost",
		className: P(r, "text-gray-400"),
		ref: n,
		"aria-label": u,
		onClick: o,
		onDragStart: c,
		onDragEnd: s,
		draggable: l,
		...d,
		children: [a, i]
	});
}), dt = _((t, n) => {
	let { className: r, children: i, id: a, columns: o, ...s } = t;
	return e(s), /* @__PURE__ */ C("div", {
		className: P("bg-popover text-popover-foreground z-50 min-w-32 overflow-x-hidden overflow-y-auto rounded-md p-1 shadow-md ring-1 ring-foreground/10", "grid", r),
		style: { gridTemplateColumns: `repeat(${o}, 1fr)` },
		ref: n,
		id: a,
		role: "grid",
		children: i
	});
}), ft = _((t, n) => {
	let { className: r, children: i, columns: a, ...o } = t;
	return e(o), /* @__PURE__ */ C("div", {
		className: r,
		style: { gridColumn: `1 / ${a + 1}` },
		ref: n,
		children: i
	});
}), pt = _((t, n) => {
	let { className: r, children: i, id: a, ...o } = t;
	return e(o), /* @__PURE__ */ C("div", {
		id: a,
		role: "listbox",
		className: P("bg-popover text-popover-foreground z-50 min-w-32 overflow-x-hidden overflow-y-auto rounded-md p-1 shadow-md ring-1 ring-foreground/10", r),
		ref: n,
		children: i
	});
}), mt = _((t, n) => {
	let { className: r, children: i, ...a } = t;
	return e(a), /* @__PURE__ */ C("div", {
		className: P("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*=text-])]:text-muted-foreground outline-hidden relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm data-[disabled]:pointer-events-none data-[inset]:pl-8 data-[disabled]:opacity-50 [&_svg:not([class*=size-])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0", "hover:bg-accent hover:text-accent-foreground data-[variant=destructive]:hover:bg-destructive/10 dark:data-[variant=destructive]:hover:bg-destructive/20 data-[variant=destructive]:hover:text-destructive", "aria-selected:bg-accent aria-selected:text-accent-foreground data-[variant=destructive]:aria-selected:bg-destructive/10 dark:data-[variant=destructive]:aria-selected:bg-destructive/20 data-[variant=destructive]:aria-selected:text-destructive", r),
		ref: n,
		children: /* @__PURE__ */ C("div", { children: i })
	});
}), ht = _((t, n) => {
	let r = W(), { className: i, item: a, isSelected: s, onClick: l, id: u, ...d } = t;
	e(d);
	let f = x(null);
	return y(() => {
		!f.current || !s || o(f.current, f.current.closest(".bn-suggestion-menu, #ai-suggestion-menu")) !== "none" && f.current.scrollIntoView({ block: "nearest" });
	}, [s]), /* @__PURE__ */ w("div", {
		className: P("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*=text-])]:text-muted-foreground outline-hidden relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm data-[disabled]:pointer-events-none data-[inset]:pl-8 data-[disabled]:opacity-50 [&_svg:not([class*=size-])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0", "hover:bg-accent hover:text-accent-foreground data-[variant=destructive]:hover:bg-destructive/10 dark:data-[variant=destructive]:hover:bg-destructive/20 data-[variant=destructive]:hover:text-destructive", "aria-selected:bg-accent aria-selected:text-accent-foreground data-[variant=destructive]:aria-selected:bg-destructive/10 dark:data-[variant=destructive]:aria-selected:bg-destructive/20 data-[variant=destructive]:aria-selected:text-destructive", t.item.size === "small" ? "gap-3 py-1" : "", i),
		"data-highlighted": !0,
		ref: c([n, f]),
		id: u,
		onMouseDown: (e) => e.preventDefault(),
		onClick: l,
		role: "option",
		"aria-selected": s || void 0,
		children: [
			a.icon && /* @__PURE__ */ C("div", {
				className: P("p-3", t.item.size === "small" ? "p-0" : "", i),
				"data-position": "left",
				children: a.icon
			}),
			/* @__PURE__ */ w("div", {
				className: "flex-1",
				children: [/* @__PURE__ */ C("div", {
					className: P("text-base", t.item.size === "small" ? "text-sm" : "", i),
					children: a.title
				}), /* @__PURE__ */ C("div", {
					className: P("text-xs", t.item.size === "small" ? "hidden" : "", i),
					children: a.subtext
				})]
			}),
			a.badge && /* @__PURE__ */ C("div", {
				"data-position": "right",
				className: "text-xs",
				children: /* @__PURE__ */ C(r.Badge.Badge, {
					variant: "secondary",
					children: a.badge
				})
			})
		]
	});
}), gt = _((t, n) => {
	let { className: r, children: i, ...a } = t;
	return e(a), /* @__PURE__ */ C("div", {
		className: P("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8", r),
		ref: n,
		children: i
	});
}), _t = _((t, n) => {
	let { className: r, ...i } = t;
	return e(i), /* @__PURE__ */ C("div", {
		className: P(r, "animate-spin"),
		ref: n,
		children: /* @__PURE__ */ C("svg", {
			xmlns: "http://www.w3.org/2000/svg",
			height: "1em",
			viewBox: "0 -960 960 960",
			width: "1em",
			fill: "#e8eaed",
			children: /* @__PURE__ */ C("path", { d: "M480-80q-82 0-155-31.5t-127.5-86Q143-252 111.5-325T80-480q0-83 31.5-155.5t86-127Q252-817 325-848.5T480-880q17 0 28.5 11.5T520-840q0 17-11.5 28.5T480-800q-133 0-226.5 93.5T160-480q0 133 93.5 226.5T480-160q133 0 226.5-93.5T800-480q0-17 11.5-28.5T840-520q17 0 28.5 11.5T880-480q0 82-31.5 155t-86 127.5q-54.5 54.5-127 86T480-80Z" })
		})
	});
}), vt = _((t, n) => {
	let { className: r, markClassName: i, backgroundColor: a, children: o, ...s } = t;
	return e(s), /* @__PURE__ */ C("span", {
		className: P(r, i),
		style: i ? void 0 : { backgroundColor: a },
		ref: n,
		children: o
	});
}), yt = _((t, n) => {
	let { className: r, children: i, onMouseDown: a, onClick: o, ...s } = t;
	e(s, !1);
	let c = W();
	return /* @__PURE__ */ C(c.Button.Button, {
		variant: "ghost",
		className: P(r, "h-full w-full p-0 text-gray-400", r?.includes("extend-button-add-remove-columns") ? "ml-1" : "mt-1", r?.includes("extend-button-editing") ? "bg-accent text-accent-foreground" : ""),
		ref: n,
		onClick: o,
		onMouseDown: a,
		...s,
		children: i
	});
}), bt = _((t, n) => {
	let { className: r, children: i, draggable: a, onDragStart: o, onDragEnd: s, style: c, label: l, ...u } = t;
	e(u, !1);
	let d = W();
	return /* @__PURE__ */ C(d.Button.Button, {
		variant: "ghost",
		className: P(r, "h-fit w-fit p-0 text-gray-400"),
		ref: n,
		"aria-label": l,
		draggable: a,
		onDragStart: o,
		onDragEnd: s,
		style: c,
		...u,
		children: i
	});
}), J = _((t, n) => {
	let { className: r, children: i, onMouseEnter: a, onMouseLeave: o, variant: s, ...c } = t;
	e(c);
	let l = W();
	return /* @__PURE__ */ C(l.Tooltip.TooltipProvider, {
		delay: 0,
		children: /* @__PURE__ */ C("div", {
			className: P(r, "bg-popover text-popover-foreground flex h-fit gap-1 rounded-lg border p-1 shadow-md", s === "action-toolbar" ? "w-fit" : ""),
			ref: n,
			onMouseEnter: a,
			onMouseLeave: o,
			children: i
		})
	});
}), Y = _((t, n) => {
	let { className: r, children: i, mainTooltip: a, secondaryTooltip: o, icon: s, isSelected: c, isDisabled: u, onClick: d, label: f, variant: p, onMouseDown: m, ...g } = t;
	e(g, !1);
	let _ = W(), v = h(), y = (e) => {
		l(e), m?.(e);
	}, b = c === void 0 ? /* @__PURE__ */ w(_.Button.Button, {
		className: P(r, p === "compact" ? "h-6 min-w-6 p-0" : ""),
		variant: "ghost",
		size: p === "compact" ? "sm" : "default",
		disabled: u,
		onClick: d,
		ref: n,
		"aria-label": f,
		...g,
		onMouseDown: y,
		children: [s, i]
	}) : /* @__PURE__ */ w(_.Toggle.Toggle, {
		className: P(r, "aria-expanded:bg-accent aria-expanded:text-accent-foreground", p === "compact" ? "h-6 min-w-6 p-0" : ""),
		size: p === "compact" ? "sm" : "default",
		"aria-label": f,
		onClick: d,
		pressed: c,
		disabled: u,
		ref: n,
		...g,
		onMouseDown: y,
		children: [s, i]
	});
	return /* @__PURE__ */ w(_.Tooltip.Tooltip, { children: [/* @__PURE__ */ C(_.Tooltip.TooltipTrigger, { render: b }), /* @__PURE__ */ w(_.Tooltip.TooltipContent, {
		container: v,
		className: "flex flex-col items-center whitespace-pre-wrap",
		children: [/* @__PURE__ */ C("span", { children: a }), o && /* @__PURE__ */ C("span", { children: o })]
	})] });
}), X = _((t, n) => {
	let { className: r, items: i, isDisabled: a, portalElement: o, preventFocusOnOpen: s, ...c } = t;
	e(c);
	let u = W(), d = (e) => /* @__PURE__ */ w("div", {
		className: "flex items-center gap-1",
		children: [e.icon, e.text]
	}), f = i.filter((e) => e.isSelected)[0];
	return f ? /* @__PURE__ */ w(u.Select.Select, {
		value: f.text,
		onValueChange: (e) => i.find((t) => t.text === e).onClick?.(),
		disabled: a,
		children: [/* @__PURE__ */ C(u.Select.SelectTrigger, {
			className: "border-none",
			onMouseDown: l,
			children: /* @__PURE__ */ C(u.Select.SelectValue, {})
		}), /* @__PURE__ */ C(u.Select.SelectContent, {
			className: r,
			container: o,
			alignItemWithTrigger: !1,
			ref: n,
			...G(s ?? !1),
			children: i.map((e) => /* @__PURE__ */ C(u.Select.SelectItem, {
				disabled: e.isDisabled,
				value: e.text,
				onMouseDown: l,
				children: /* @__PURE__ */ C(d, { ...e })
			}, e.text))
		})]
	}) : null;
}), xt = _((t, n) => {
	let { className: r, children: i, selected: a, headerText: o, onFocus: s, onBlur: c, tabIndex: l, ...u } = t;
	e(u);
	let d = W();
	return /* @__PURE__ */ w(d.Card.Card, {
		className: P(r, "w-[300px]", a ? "bg-accent text-accent-foreground" : ""),
		onFocus: s,
		onBlur: c,
		tabIndex: l,
		ref: n,
		children: [o && /* @__PURE__ */ C("div", {
			className: "px-4 pt-4 text-sm italic",
			children: o
		}), i]
	});
}), Z = _((t, n) => {
	let { className: r, children: i, ...a } = t;
	return e(a), /* @__PURE__ */ C("div", {
		className: P(r, "p-4", r?.includes("thread-comments") ? "flex flex-col gap-6 border-b" : ""),
		ref: n,
		children: i
	});
}), St = _((t, n) => {
	let { className: r, children: i, ...a } = t;
	e(a, !1);
	let o = W();
	return /* @__PURE__ */ C(o.Button.Button, {
		className: P(r, "text-foreground w-fit bg-transparent p-0 hover:bg-transparent"),
		ref: n,
		children: i
	});
}), Ct = _((t, n) => {
	let { authorInfo: r, timeString: i, edited: a, ...o } = t, s = f();
	e(o, !1);
	let c = W();
	return r === "loading" ? /* @__PURE__ */ w("div", {
		className: "flex flex-row flex-nowrap items-center gap-4",
		children: [/* @__PURE__ */ C(c.Skeleton.Skeleton, { className: "size-7 animate-pulse rounded-full bg-neutral-400" }), /* @__PURE__ */ C(c.Skeleton.Skeleton, { className: "h-3 w-32 animate-pulse rounded-full bg-neutral-400" })]
	}) : /* @__PURE__ */ w("div", {
		className: "flex flex-row flex-nowrap items-center gap-4",
		children: [/* @__PURE__ */ w(c.Avatar.Avatar, { children: [/* @__PURE__ */ C(c.Avatar.AvatarImage, {
			src: r.avatarUrl,
			alt: r.username,
			className: "h-7 rounded-full"
		}), /* @__PURE__ */ C(c.Avatar.AvatarFallback, { children: r.username[0] })] }), /* @__PURE__ */ w("div", {
			className: "flex flex-row flex-nowrap items-center gap-2",
			children: [/* @__PURE__ */ C("span", {
				className: "text-sm font-bold",
				children: r.username
			}), /* @__PURE__ */ w("span", {
				className: "text-xs",
				children: [
					i,
					" ",
					a && `(${s.comments.edited})`
				]
			})]
		})]
	});
}), wt = _((t, n) => {
	let { className: r, showActions: i, authorInfo: a, timeString: o, actions: s, edited: c, emojiPickerOpen: l, children: u, ...d } = t;
	e(d);
	let [f, m] = S(!1), { focused: h, ref: g } = p(), _ = s && (i === !0 || i === void 0 || i === "hover" && f || h || l);
	return /* @__PURE__ */ w("div", {
		ref: n,
		className: P(r, "relative flex flex-col gap-2"),
		onMouseEnter: () => m(!0),
		onMouseLeave: () => m(!1),
		children: [
			_ ? /* @__PURE__ */ C("div", {
				className: "absolute top-0 right-0 z-10",
				ref: g,
				children: s
			}) : null,
			/* @__PURE__ */ C(Ct, { ...t }),
			u
		]
	});
}), Tt = _((t, n) => {
	let { className: r, onFocus: i, onBlur: o, autoFocus: s, editor: c, editable: l, ...u } = t;
	e(u);
	let f = d();
	return /* @__PURE__ */ C($, {
		autoFocus: s,
		className: P(r, ""),
		theme: f?.colorSchemePreference,
		editor: t.editor,
		sideMenu: !1,
		slashMenu: !1,
		tableHandles: !1,
		filePanel: !1,
		formattingToolbar: !1,
		editable: l,
		ref: n,
		onFocus: i,
		onBlur: o,
		children: /* @__PURE__ */ C(a, { formattingToolbar: Et })
	});
}), Et = () => {
	let e = s([]).filter((e) => e.key !== "nestBlockButton" && e.key !== "unnestBlockButton");
	return /* @__PURE__ */ C(i, {
		blockTypeSelectItems: [],
		children: e
	});
}, Dt = _((t, n) => {
	let { className: r, text: i, icon: a, isSelected: o, mainTooltip: s, secondaryTooltip: c, onClick: l, onMouseEnter: u, ...d } = t;
	e(d, !1);
	let f = W(), p = h(), m = /* @__PURE__ */ w(f.Button.Button, {
		variant: o ? "secondary" : "outline",
		className: P(r, "flex h-7 items-center gap-1 rounded-full px-2.5"),
		onClick: l,
		onMouseEnter: u,
		ref: n,
		children: [/* @__PURE__ */ C("span", { children: a }), /* @__PURE__ */ C("span", { children: i })]
	});
	return s ? /* @__PURE__ */ w(f.Tooltip.Tooltip, { children: [/* @__PURE__ */ C(f.Tooltip.TooltipTrigger, { render: m }), /* @__PURE__ */ w(f.Tooltip.TooltipContent, {
		container: p,
		className: "flex flex-col items-center whitespace-pre-wrap",
		children: [/* @__PURE__ */ C("span", { children: s }), c && /* @__PURE__ */ C("span", { children: c })]
	})] }) : m;
}), Ot = _((t, n) => {
	let { className: r, children: i, ...a } = t;
	e(a);
	let o = W();
	return /* @__PURE__ */ C(o.Tooltip.TooltipProvider, {
		delay: 0,
		children: /* @__PURE__ */ C("div", {
			className: P(r, "flex w-full flex-row flex-wrap gap-1"),
			ref: n,
			children: i
		})
	});
}), kt = _((t, n) => {
	let { className: r, children: i, ...a } = t;
	return e(a, !1), /* @__PURE__ */ C("div", {
		className: P(r),
		ref: n,
		children: i
	});
}), At = _((t, n) => {
	let { className: r, selected: i, comparing: a, onClick: o, actions: s, children: c, ...l } = t;
	e(l, !1);
	let u = W();
	return /* @__PURE__ */ w(u.Card.Card, {
		className: P(r, i ? "selected" : "", a ? "comparing" : "", "gap-0 rounded-lg py-0 shadow-none"),
		onClick: o,
		ref: n,
		children: [c, s && /* @__PURE__ */ C("div", {
			className: "bn-snapshot-menu",
			onClick: (e) => e.stopPropagation(),
			children: s
		})]
	});
}), jt = _((t, n) => {
	let { className: r, children: i, type: a, onClick: o, label: s, ...c } = t;
	e(c);
	let l = W();
	return /* @__PURE__ */ C(l.Button.Button, {
		type: a,
		className: r,
		"aria-label": s,
		ref: n,
		onClick: o,
		children: i
	});
}), Mt = _((t, n) => {
	let { className: r, accept: i, value: a, placeholder: o, onChange: s, ...c } = t;
	e(c);
	let l = W();
	return /* @__PURE__ */ C(l.Input.Input, {
		type: "file",
		className: r,
		ref: n,
		accept: i,
		value: a ? a.name : void 0,
		onChange: async (e) => s?.(e.target.files[0]),
		placeholder: o
	});
}), Nt = _((t, n) => {
	let { className: r, isSelected: i, onClick: a, item: s, id: l, ...u } = t;
	e(u);
	let d = x(null);
	return y(() => {
		!d.current || !i || o(d.current, d.current.closest(".bn-grid-suggestion-menu")) !== "none" && d.current.scrollIntoView({ block: "nearest" });
	}, [i]), /* @__PURE__ */ C("div", {
		className: P("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*=text-])]:text-muted-foreground outline-hidden relative flex cursor-default select-none items-center gap-2 rounded-sm p-2 text-sm data-[disabled]:pointer-events-none data-[inset]:pl-8 data-[disabled]:opacity-50 [&_svg:not([class*=size-])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0", "hover:bg-accent hover:text-accent-foreground data-[variant=destructive]:hover:bg-destructive/10 dark:data-[variant=destructive]:hover:bg-destructive/20 data-[variant=destructive]:hover:text-destructive", "aria-selected:bg-accent aria-selected:text-accent-foreground data-[variant=destructive]:aria-selected:bg-destructive/10 dark:data-[variant=destructive]:aria-selected:bg-destructive/20 data-[variant=destructive]:aria-selected:text-destructive", "text-base!", r),
		ref: c([n, d]),
		id: l,
		role: "option",
		onClick: a,
		"aria-selected": i || void 0,
		children: s.icon
	});
}), Pt = _((t, n) => {
	let { className: r, children: i, columns: a, ...o } = t;
	return e(o), /* @__PURE__ */ C("div", {
		className: r,
		style: { gridColumn: `1 / ${a + 1}` },
		ref: n,
		children: i
	});
}), Q = {
	FormattingToolbar: {
		Root: J,
		Button: Y,
		Select: X
	},
	FilePanel: {
		Root: rt,
		Button: jt,
		FileInput: Mt,
		TabPanel: it,
		TextInput: at
	},
	LinkToolbar: {
		Root: J,
		Button: Y,
		Select: X
	},
	SideMenu: {
		Root: lt,
		Button: ut
	},
	SuggestionMenu: {
		Root: pt,
		Item: ht,
		EmptyItem: mt,
		Label: gt,
		Loader: _t
	},
	GridSuggestionMenu: {
		Root: dt,
		Item: Nt,
		EmptyItem: ft,
		Loader: Pt
	},
	TableHandle: {
		Root: bt,
		ExtendButton: yt
	},
	Comments: {
		Comment: wt,
		Editor: Tt,
		Card: xt,
		CardSection: Z,
		ExpandSectionsPrompt: St
	},
	Versioning: {
		Sidebar: kt,
		Snapshot: At
	},
	AttributionTooltip: { Root: vt },
	Generic: {
		Badge: {
			Root: Dt,
			Group: Ot
		},
		Toolbar: {
			Root: J,
			Button: Y,
			Select: X
		},
		Form: {
			Root: de,
			TextInput: Ye
		},
		Menu: {
			Root: Xe,
			Trigger: Ze,
			Dropdown: Qe,
			Divider: et,
			Label: tt,
			Item: $e,
			Button: nt
		},
		Popover: {
			Root: ot,
			Trigger: st,
			Content: ct
		}
	}
}, $ = (e) => {
	let { className: i, shadCNComponents: a, ...o } = e, s = b(() => ({
		...H,
		...a
	}), [a]);
	return /* @__PURE__ */ C(U.Provider, {
		value: s,
		children: /* @__PURE__ */ C(r.Provider, {
			value: Q,
			children: /* @__PURE__ */ C(n, {
				className: t("bn-shadcn", i || ""),
				...o
			})
		})
	});
};
//#endregion
export { $ as BlockNoteView, U as ShadCNComponentsContext, H as ShadCNDefaultComponents, Q as components, W as useShadCNComponentsContext };

//# sourceMappingURL=blocknote-shadcn.js.map