import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { cn } from "../../lib/utils";
import { useEditContext } from "../client/editContext";
import { ItemLanguageVersion } from "../menubar/ItemLanguageVersion";
import { DeviceSwitchToolbar } from "../menubar/toolbar-sections/DeviceSwitchToolbar";
import { EditorSlotContextProvider } from "./editorSlotContext";
import { SingleEditView } from "./SingleEditView";
export function ItemEditorPane({ name, emptyTitle = "No item selected", emptyDescription, className, toolbarClassName, contentClassName, }) {
    const editContext = useEditContext();
    const slotContext = editContext?.getActiveSlotContext();
    if (!slotContext) {
        return (_jsxs("div", { className: "flex h-full min-h-0 flex-col items-center justify-center gap-3 p-6 text-center", children: [_jsx("div", { className: "text-neutral-grey-100 text-sm font-medium", children: emptyTitle }), emptyDescription && (_jsx("div", { className: "text-neutral-grey-50 max-w-sm text-xs", children: emptyDescription }))] }));
    }
    const showDeviceSwitch = slotContext.item?.hasLayout ??
        slotContext.primaryPageViewContext.page?.item?.hasLayout ??
        false;
    return (_jsx(EditorSlotContextProvider, { value: slotContext, children: _jsxs("div", { className: cn("flex h-full min-h-0 flex-col", className), children: [_jsxs("div", { className: cn("border-border-default flex shrink-0 items-center gap-2 border-b bg-white px-2 py-1.5 shadow-[0_1px_2px_color-mix(in_srgb,var(--color-neutral-grey-100)_3%,transparent)]", toolbarClassName), children: [_jsx("div", { className: "min-w-0 flex-1", children: _jsx(ItemLanguageVersion, { hideFavorites: true, hideActions: true }) }), showDeviceSwitch && (_jsx(DeviceSwitchToolbar, { buttonSize: "small", iconClassName: "size-5 p-0.5" }))] }), _jsx("div", { className: cn("min-h-0 flex-1 overflow-hidden", contentClassName), children: _jsx(SingleEditView, { compareView: false, name: name, view: "primary" }) })] }) }));
}
//# sourceMappingURL=ItemEditorPane.js.map