'use strict';

var tslib_es6 = require('../../node_modules/.pnpm/@rollup_plugin-typescript@12.1.4_rollup@4.46.2_tslib@2.8.1_typescript@5.9.3/node_modules/tslib/tslib.es6.js');
var jsxRuntime = require('react/jsx-runtime');
var server = require('@windrun-huaiin/base-ui/components/server');
var React = require('react');
var utils = require('@windrun-huaiin/lib/utils');
var collapsible = require('fumadocs-ui/components/ui/collapsible');
var Link = require('next/link');

const itemVariants = 'flex flex-row items-center gap-2 rounded-md px-2 py-1.5 text-sm hover:bg-fd-accent hover:text-fd-accent-foreground [&_svg]:size-4';
const anotionClass = 'ms-2 px-2 py-0.5 rounded text-xs font-semibold bg-fd-accent/80 text-fd-accent-foreground dark:bg-white/20 dark:text-white';
function ZiaFile(_a) {
    var { name, icon = jsxRuntime.jsx(server.globalLucideIcons.File, {}), className, anotion, href } = _a, rest = tslib_es6.__rest(_a, ["name", "icon", "className", "anotion", "href"]);
    const validHref = typeof href === 'string' && href.trim() !== '';
    const validAnotion = typeof anotion === 'string' && anotion.trim() !== '';
    if (validHref) {
        return (jsxRuntime.jsxs(Link, { href: href, className: utils.cn(itemVariants, className), children: [icon, jsxRuntime.jsx("span", { children: name }), validAnotion && jsxRuntime.jsx("span", { className: anotionClass, children: anotion })] }));
    }
    return (jsxRuntime.jsxs("div", Object.assign({ className: utils.cn(itemVariants, className) }, rest, { children: [icon, jsxRuntime.jsx("span", { children: name }), validAnotion && jsxRuntime.jsx("span", { className: anotionClass, children: anotion })] })));
}
function ZiaFolder(_a) {
    var { name, anotion, defaultOpen = false, className, children } = _a, props = tslib_es6.__rest(_a, ["name", "anotion", "defaultOpen", "className", "children"]);
    const [open, setOpen] = React.useState(defaultOpen);
    const validAnotion = typeof anotion === 'string' && anotion.trim() !== '';
    return (jsxRuntime.jsxs(collapsible.Collapsible, Object.assign({ open: open, onOpenChange: setOpen }, props, { children: [jsxRuntime.jsxs(collapsible.CollapsibleTrigger, { className: utils.cn(itemVariants, className, 'w-full'), children: [open ? jsxRuntime.jsx(server.globalLucideIcons.FolderOpen, {}) : jsxRuntime.jsx(server.globalLucideIcons.Folder, {}), jsxRuntime.jsx("span", { children: name }), validAnotion && (jsxRuntime.jsx("span", { className: anotionClass, children: anotion }))] }), jsxRuntime.jsx(collapsible.CollapsibleContent, { children: jsxRuntime.jsx("div", { className: "ms-2 flex flex-col border-l ps-2", children: children }) })] })));
}

exports.ZiaFile = ZiaFile;
exports.ZiaFolder = ZiaFolder;
