"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }"use client";




var _chunk6JINAOI7cjs = require('../../../chunk-6JINAOI7.cjs');








var _chunkN5UOJC3Vcjs = require('../../../chunk-N5UOJC3V.cjs');
require('../../../chunk-WBR7H6E3.cjs');



var _chunkFIG2RKZFcjs = require('../../../chunk-FIG2RKZF.cjs');


var _chunkWZW7C7TFcjs = require('../../../chunk-WZW7C7TF.cjs');
require('../../../chunk-VRHGVLSL.cjs');

// src/components/ui/file-manager/file-manager.tsx
_chunkFIG2RKZFcjs.init_cn.call(void 0, );
var _react = require('react'); var _react2 = _interopRequireDefault(_react);

// src/components/ui/file-manager/file-manager-breadcrumb.tsx
_chunkFIG2RKZFcjs.init_cn.call(void 0, );

var _lucidereact = require('lucide-react');
var _jsxruntime = require('react/jsx-runtime');
function FileManagerBreadcrumb({
  items,
  onItemClick,
  className
}) {
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "nav", { className: _chunkFIG2RKZFcjs.cn.call(void 0, 
    "flex flex-wrap items-center gap-x-1 gap-y-1 text-sm break-words",
    className
  ), children: items.map((item, index) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _react2.default.Fragment, { children: [
    index > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ChevronRight, { className: "h-4 w-4 text-ods-text-tertiary flex-shrink-0" }),
    /* @__PURE__ */ _jsxruntime.jsx.call(void 0, 
      "button",
      {
        onClick: () => _optionalChain([onItemClick, 'optionalCall', _2 => _2(item.path)]),
        className: _chunkFIG2RKZFcjs.cn.call(void 0, 
          "shrink-0 px-1 py-0.5 rounded hover:bg-ods-bg-secondary transition-colors",
          "text-ods-text-primary hover:text-ods-accent text-left break-all",
          index === items.length - 1 && "font-medium"
        ),
        children: item.label
      }
    )
  ] }, item.path)) });
}

// src/components/ui/file-manager/file-manager-action-bar.tsx
_chunkN5UOJC3Vcjs.init_button2.call(void 0, );
_chunkFIG2RKZFcjs.init_cn.call(void 0, );


function FileManagerActionBar({
  canPaste = false,
  hasSelection = false,
  onNewFolder,
  onPaste,
  onCopy,
  onCut,
  onUpload,
  onSelectAll,
  className
}) {
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: _chunkFIG2RKZFcjs.cn.call(void 0, "flex items-center gap-4 flex-wrap md:justify-end", className), children: [
    /* @__PURE__ */ _jsxruntime.jsx.call(void 0, 
      _chunkN5UOJC3Vcjs.Button,
      {
        variant: "outline",
        size: "small-legacy",
        onClick: onNewFolder,
        leftIcon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.FolderPlus, { className: "h-4 w-4" }),
        children: "New Folder"
      }
    ),
    /* @__PURE__ */ _jsxruntime.jsx.call(void 0, 
      _chunkN5UOJC3Vcjs.Button,
      {
        variant: "outline",
        size: "small-legacy",
        onClick: onCopy,
        disabled: !hasSelection,
        leftIcon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Copy, { className: "h-4 w-4" }),
        children: "Copy"
      }
    ),
    /* @__PURE__ */ _jsxruntime.jsx.call(void 0, 
      _chunkN5UOJC3Vcjs.Button,
      {
        variant: "outline",
        size: "small-legacy",
        onClick: onCut,
        disabled: !hasSelection,
        leftIcon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Scissors, { className: "h-4 w-4" }),
        children: "Cut"
      }
    ),
    /* @__PURE__ */ _jsxruntime.jsx.call(void 0, 
      _chunkN5UOJC3Vcjs.Button,
      {
        variant: "outline",
        size: "small-legacy",
        onClick: onPaste,
        disabled: !canPaste,
        leftIcon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Clipboard, { className: "h-4 w-4" }),
        children: "Paste"
      }
    ),
    /* @__PURE__ */ _jsxruntime.jsx.call(void 0, 
      _chunkN5UOJC3Vcjs.Button,
      {
        variant: "outline",
        size: "small-legacy",
        onClick: onUpload,
        leftIcon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Upload, { className: "h-4 w-4" }),
        children: "Upload"
      }
    ),
    /* @__PURE__ */ _jsxruntime.jsx.call(void 0, 
      _chunkN5UOJC3Vcjs.Button,
      {
        variant: "outline",
        size: "small-legacy",
        onClick: onSelectAll,
        leftIcon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CheckSquare, { className: "h-4 w-4" }),
        children: "Select All"
      }
    )
  ] });
}

// src/components/ui/file-manager/file-manager-table.tsx

_chunkFIG2RKZFcjs.init_cn.call(void 0, );

// src/components/ui/file-manager/file-manager-table-row.tsx


_chunkN5UOJC3Vcjs.init_button2.call(void 0, );
_chunkFIG2RKZFcjs.init_cn.call(void 0, );

// src/components/ui/file-manager/file-icon.tsx
_chunkFIG2RKZFcjs.init_cn.call(void 0, );


var sizeMap = {
  sm: "h-4 w-4",
  md: "h-5 w-5",
  lg: "h-6 w-6"
};
var getFileIcon = (extension) => {
  if (!extension) return _lucidereact.File;
  const ext = extension.toLowerCase();
  if (["txt", "doc", "docx", "pdf", "rtf"].includes(ext)) return _lucidereact.FileText;
  if (["jpg", "jpeg", "png", "gif", "svg", "webp", "bmp"].includes(ext)) return _lucidereact.Image;
  if (["mp4", "avi", "mov", "wmv", "flv", "mkv"].includes(ext)) return _lucidereact.FileVideo;
  if (["mp3", "wav", "flac", "aac", "ogg", "wma"].includes(ext)) return _lucidereact.FileAudio;
  if (["js", "ts", "jsx", "tsx", "py", "java", "c", "cpp", "cs", "html", "css", "json", "xml"].includes(ext)) return _lucidereact.FileCode;
  if (["zip", "rar", "7z", "tar", "gz", "bz2"].includes(ext)) return _lucidereact.FileArchive;
  return _lucidereact.File;
};
function FileIcon({ type, extension, className, size = "md" }) {
  const Icon = type === "folder" ? _lucidereact.Folder : getFileIcon(extension);
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, 
    Icon,
    {
      className: _chunkFIG2RKZFcjs.cn.call(void 0, 
        sizeMap[size],
        type === "folder" ? "text-ods-accent" : "text-ods-text-secondary",
        className
      )
    }
  );
}

// src/components/ui/file-manager/file-manager-context-menu.tsx


_chunkN5UOJC3Vcjs.init_button2.call(void 0, );
_chunkFIG2RKZFcjs.init_cn.call(void 0, );

function FileManagerContextMenu({
  open,
  onOpenChange,
  onAction,
  fileType = "file",
  hasSelection = false,
  trigger,
  className
}) {
  const menuItems = [
    {
      action: "download",
      label: "Download",
      icon: _lucidereact.Download,
      show: fileType === "file" || hasSelection
    },
    {
      action: "copy",
      label: "Copy",
      icon: _lucidereact.Copy,
      show: true
    },
    {
      action: "rename",
      label: "Rename",
      icon: _lucidereact.Edit2,
      show: !hasSelection
    },
    {
      action: "cut",
      label: "Cut",
      icon: _lucidereact.Scissors,
      show: true
    },
    {
      action: "delete",
      label: "Delete",
      icon: _lucidereact.Trash2,
      show: true,
      separator: true
    }
  ];
  const visibleItems = menuItems.filter((item) => item.show);
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkN5UOJC3Vcjs.DropdownMenu, { open, onOpenChange, children: [
    /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkN5UOJC3Vcjs.DropdownMenuTrigger, { asChild: true, children: trigger || /* @__PURE__ */ _jsxruntime.jsx.call(void 0, 
      _chunkN5UOJC3Vcjs.Button,
      {
        variant: "transparent",
        size: "small-legacy",
        className: "h-8 w-8 p-0",
        children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.MoreHorizontal, { className: "h-4 w-4" })
      }
    ) }),
    /* @__PURE__ */ _jsxruntime.jsx.call(void 0, 
      _chunkN5UOJC3Vcjs.DropdownMenuContent,
      {
        align: "end",
        className: _chunkFIG2RKZFcjs.cn.call(void 0, "w-56", className),
        onClick: (e) => e.stopPropagation(),
        children: visibleItems.map((item, index) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _react2.default.Fragment, { children: [
          item.separator && index > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkN5UOJC3Vcjs.DropdownMenuSeparator, {}),
          /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, 
            _chunkN5UOJC3Vcjs.DropdownMenuItem,
            {
              onClick: (e) => {
                e.stopPropagation();
                onAction(item.action);
              },
              className: "cursor-pointer",
              children: [
                /* @__PURE__ */ _jsxruntime.jsx.call(void 0, item.icon, { className: "mr-3 h-4 w-4" }),
                /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: item.label })
              ]
            }
          )
        ] }, item.action))
      }
    )
  ] });
}

// src/components/ui/file-manager/file-manager-table-row.tsx

function FileManagerTableRow({
  file,
  isSelected = false,
  showCheckbox = true,
  showPath = false,
  onSelect,
  onClick,
  onDoubleClick,
  onContextMenu,
  onActionClick,
  className
}) {
  const [contextMenuOpen, setContextMenuOpen] = _react.useState.call(void 0, false);
  const handleRowClick = (e) => {
    if (e.target.closest("[data-no-row-click]")) {
      return;
    }
    _optionalChain([onClick, 'optionalCall', _3 => _3()]);
  };
  const handleCheckboxChange = (checked) => {
    _optionalChain([onSelect, 'optionalCall', _4 => _4(checked)]);
  };
  const handleContextAction = (action) => {
    _optionalChain([onActionClick, 'optionalCall', _5 => _5(action)]);
    setContextMenuOpen(false);
  };
  const fileExtension = file.type === "file" ? file.name.split(".").pop() : void 0;
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, 
    "div",
    {
      className: _chunkFIG2RKZFcjs.cn.call(void 0, 
        "bg-ods-card group flex items-center h-16 px-4 border-ods-border",
        "hover:bg-ods-bg-secondary transition-colors cursor-pointer",
        isSelected && "bg-ods-bg-secondary",
        className
      ),
      onClick: handleRowClick,
      onDoubleClick,
      onContextMenu: (e) => {
        e.preventDefault();
        _optionalChain([onContextMenu, 'optionalCall', _6 => _6(e)]);
      },
      children: [
        showCheckbox && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "mr-4", "data-no-row-click": true, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, 
          _chunk6JINAOI7cjs.Checkbox,
          {
            checked: isSelected,
            onCheckedChange: handleCheckboxChange,
            className: "h-5 w-5"
          }
        ) }),
        /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-3 flex-1 min-w-0", children: [
          /* @__PURE__ */ _jsxruntime.jsx.call(void 0, 
            FileIcon,
            {
              type: file.type,
              extension: fileExtension,
              size: "md"
            }
          ),
          /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col min-w-0", children: [
            /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm text-ods-text-primary truncate", title: file.name, children: file.name }),
            showPath && file.path && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-xs text-ods-text-secondary truncate", title: file.path, children: file.path })
          ] })
        ] }),
        /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "w-24 shrink-0 pr-4 text-sm text-ods-text-secondary", children: file.size || "" }),
        /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "w-36 shrink-0 pl-4 text-sm text-ods-text-secondary", children: file.modified }),
        /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "w-48 shrink-0 pl-4 flex items-center justify-end gap-1", "data-no-row-click": true, children: [
          /* @__PURE__ */ _jsxruntime.jsx.call(void 0, 
            FileManagerContextMenu,
            {
              open: contextMenuOpen,
              onOpenChange: setContextMenuOpen,
              onAction: handleContextAction,
              fileType: file.type,
              trigger: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, 
                _chunkN5UOJC3Vcjs.Button,
                {
                  variant: "transparent",
                  size: "small-legacy",
                  className: "h-8 w-8 p-0 opacity-0 group-hover:opacity-100 transition-opacity",
                  onClick: (e) => {
                    e.stopPropagation();
                  },
                  children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.MoreHorizontal, { className: "h-4 w-4" })
                }
              )
            }
          ),
          file.type === "folder" ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, 
            _chunkN5UOJC3Vcjs.Button,
            {
              variant: "transparent",
              size: "small-legacy",
              className: "h-8 w-8 p-0",
              onClick: (e) => {
                e.stopPropagation();
                _optionalChain([onDoubleClick, 'optionalCall', _7 => _7()]);
              },
              children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ChevronRight, { className: "h-4 w-4" })
            }
          ) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "w-8" })
        ] })
      ]
    }
  );
}

// src/components/ui/file-manager/file-manager-empty.tsx
_chunkN5UOJC3Vcjs.init_button2.call(void 0, );
_chunkFIG2RKZFcjs.init_cn.call(void 0, );


function FileManagerEmpty({
  message = "No files or folders found",
  description = "This folder is empty. Create a new folder or upload files to get started.",
  action,
  className
}) {
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: _chunkFIG2RKZFcjs.cn.call(void 0, 
    "flex flex-col items-center justify-center py-20 px-4",
    className
  ), children: [
    /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "p-4 bg-ods-bg-secondary rounded-full mb-6", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.FolderOpen, { className: "h-12 w-12 text-ods-text-tertiary" }) }),
    /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-lg font-medium text-ods-text-primary mb-2", children: message }),
    /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-ods-text-secondary text-center max-w-md mb-6", children: description }),
    action && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, 
      _chunkN5UOJC3Vcjs.Button,
      {
        variant: "accent",
        size: "small-legacy",
        onClick: action.onClick,
        children: action.label
      }
    )
  ] });
}

// src/components/ui/file-manager/file-manager-table.tsx

function FileManagerTable({
  files,
  selectedFiles,
  showCheckboxes = true,
  loading = false,
  isSearchResult = false,
  onSelectFile,
  onSelectAll,
  onFileClick,
  onFolderOpen,
  onFileAction,
  className
}) {
  const allSelected = _react.useMemo.call(void 0, () => {
    return files.length > 0 && selectedFiles.length === files.length;
  }, [files.length, selectedFiles.length]);
  const someSelected = _react.useMemo.call(void 0, () => {
    return selectedFiles.length > 0 && selectedFiles.length < files.length;
  }, [files.length, selectedFiles.length]);
  const containerRef = _react.useRef.call(void 0, null);
  const [tableHeight, setTableHeight] = _react.useState.call(void 0, null);
  _react.useLayoutEffect.call(void 0, () => {
    if (loading || files.length === 0) {
      setTableHeight(null);
      return;
    }
    const handleResize = () => {
      const node = containerRef.current;
      if (!node) return;
      const rect = node.getBoundingClientRect();
      const availableHeight = window.innerHeight - rect.top;
      setTableHeight(availableHeight > 0 ? availableHeight : null);
    };
    handleResize();
    window.addEventListener("resize", handleResize);
    window.addEventListener("scroll", handleResize, true);
    const resizeObserver = new ResizeObserver(handleResize);
    const parent = _optionalChain([containerRef, 'access', _8 => _8.current, 'optionalAccess', _9 => _9.parentElement]);
    if (parent) {
      resizeObserver.observe(parent);
    } else if (containerRef.current) {
      resizeObserver.observe(containerRef.current);
    }
    return () => {
      window.removeEventListener("resize", handleResize);
      window.removeEventListener("scroll", handleResize, true);
      resizeObserver.disconnect();
    };
  }, [loading, files.length]);
  const handleSelectAll = (checked) => {
    _optionalChain([onSelectAll, 'optionalCall', _10 => _10(checked)]);
  };
  if (loading) {
    const skeletonRows = 8;
    return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: _chunkFIG2RKZFcjs.cn.call(void 0, "bg-ods-bg border border-ods-border rounded-lg flex flex-col", className), children: [
      /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center h-12 px-4 bg-ods-bg-secondary border-b border-ods-border rounded-t-lg", children: [
        showCheckboxes && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "mr-4", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6JINAOI7cjs.Skeleton, { className: "h-5 w-5 rounded" }) }),
        /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex items-center gap-3 flex-1 min-w-0 text-sm font-medium text-ods-text-secondary", children: "NAME" }),
        /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "w-24 shrink-0 pr-4 text-sm font-medium text-ods-text-secondary", children: "SIZE" }),
        /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "w-36 shrink-0 pl-4 text-sm font-medium text-ods-text-secondary", children: "EDITED" }),
        /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "w-48 shrink-0 pl-4 flex justify-end" })
      ] }),
      /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "divide-y divide-ods-border rounded-b-lg flex-1 overflow-auto", children: Array.from({ length: skeletonRows }).map((_, idx) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "bg-ods-card group flex items-center h-16 px-4 border-ods-border", children: [
        showCheckboxes && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "mr-4", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6JINAOI7cjs.Skeleton, { className: "h-5 w-5 rounded" }) }),
        /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-3 flex-1 min-w-0", children: [
          /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6JINAOI7cjs.Skeleton, { className: "h-6 w-6 rounded" }),
          /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col min-w-0", children: [
            /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6JINAOI7cjs.Skeleton, { className: "h-4 w-32" }),
            isSearchResult && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6JINAOI7cjs.Skeleton, { className: "h-3 w-48 mt-1" })
          ] })
        ] }),
        /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "w-24 shrink-0 pr-4", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6JINAOI7cjs.Skeleton, { className: "h-4 w-16" }) }),
        /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "w-36 shrink-0 pl-4", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6JINAOI7cjs.Skeleton, { className: "h-4 w-24" }) }),
        /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "w-48 shrink-0 pl-4 flex items-center justify-end gap-1", children: [
          /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6JINAOI7cjs.Skeleton, { className: "h-8 w-8 rounded" }),
          /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6JINAOI7cjs.Skeleton, { className: "h-8 w-8 rounded" })
        ] })
      ] }, idx)) })
    ] });
  }
  if (files.length === 0) {
    return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, FileManagerEmpty, {});
  }
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, 
    "div",
    {
      ref: containerRef,
      className: _chunkFIG2RKZFcjs.cn.call(void 0, "bg-ods-bg border border-ods-border rounded-lg flex flex-col", className),
      style: tableHeight ? { height: `${tableHeight}px` } : void 0,
      children: [
        /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center h-12 px-4 bg-ods-bg-secondary border-b border-ods-border rounded-t-lg", children: [
          showCheckboxes && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "mr-4", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, 
            _chunk6JINAOI7cjs.Checkbox,
            {
              checked: allSelected || someSelected,
              onCheckedChange: handleSelectAll,
              className: "h-5 w-5"
            }
          ) }),
          /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex items-center gap-3 flex-1 min-w-0 text-sm font-medium text-ods-text-secondary", children: "NAME" }),
          /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "w-24 shrink-0 pr-4 text-sm font-medium text-ods-text-secondary", children: "SIZE" }),
          /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "w-36 shrink-0 pl-4 text-sm font-medium text-ods-text-secondary", children: "EDITED" }),
          /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "w-48 shrink-0 pl-4 flex justify-end" })
        ] }),
        /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "divide-y divide-ods-border rounded-b-lg flex-1 overflow-auto", children: files.map((file) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, 
          FileManagerTableRow,
          {
            file,
            isSelected: selectedFiles.includes(file.id),
            showCheckbox: showCheckboxes,
            showPath: isSearchResult,
            onSelect: (selected) => _optionalChain([onSelectFile, 'optionalCall', _11 => _11(file.id, selected)]),
            onClick: () => {
              if (isSearchResult) {
                _optionalChain([onFileClick, 'optionalCall', _12 => _12(file)]);
              } else if (file.type === "folder") {
                _optionalChain([onFolderOpen, 'optionalCall', _13 => _13(file)]);
              }
            },
            onDoubleClick: () => {
              if (file.type === "folder" && !isSearchResult) {
                _optionalChain([onFolderOpen, 'optionalCall', _14 => _14(file)]);
              }
            },
            onActionClick: (action) => _optionalChain([onFileAction, 'optionalCall', _15 => _15(action, file.id)])
          },
          file.id
        )) })
      ]
    }
  );
}

// src/components/ui/file-manager/file-manager.tsx

function FileManager({
  files,
  currentPath,
  selectedFiles,
  searchQuery,
  loading = false,
  isSearching,
  showCheckboxes = true,
  showSearch = true,
  showActions = true,
  canPaste = false,
  disableSearch = false,
  resultsCount,
  onNavigate,
  onBreadcrumbClick,
  onSearch,
  onSelectFile,
  onSelectAll,
  onFileAction,
  onFileClick,
  onFolderOpen,
  className
}) {
  const breadcrumbItems = _react.useMemo.call(void 0, () => {
    const items = [];
    items.push({ label: "Root", path: "" });
    if (!currentPath || currentPath === "" || currentPath === "/") {
      return items;
    }
    const isWindowsPath = currentPath.includes("\\") || /^[A-Za-z]:/.test(currentPath);
    const separator = isWindowsPath ? "\\" : "/";
    const parts = currentPath.split(separator).filter(Boolean);
    let startIndex = 0;
    if (isWindowsPath && parts.length > 0) {
      const driveMatch = parts[0].match(/^([A-Za-z]:)/);
      if (driveMatch) {
        items.push({
          label: driveMatch[1],
          path: driveMatch[1] + separator
        });
        if (parts[0] === driveMatch[1]) {
          startIndex = 1;
        } else {
          parts[0] = parts[0].substring(driveMatch[1].length);
        }
      }
    }
    let accumulatedPath = "";
    if (isWindowsPath && items.length > 1) {
      accumulatedPath = items[items.length - 1].path;
    }
    for (let i = startIndex; i < parts.length; i++) {
      const part = parts[i];
      if (!part) continue;
      if (isWindowsPath) {
        accumulatedPath = accumulatedPath.endsWith(separator) ? accumulatedPath + part : accumulatedPath + separator + part;
      } else {
        accumulatedPath = accumulatedPath === "" || accumulatedPath === "/" ? "/" + part : accumulatedPath + "/" + part;
      }
      items.push({
        label: part,
        path: accumulatedPath
      });
    }
    return items;
  }, [currentPath]);
  const handleBreadcrumbClick = (path) => {
    _optionalChain([onBreadcrumbClick, 'optionalCall', _16 => _16(path)]);
    _optionalChain([onNavigate, 'optionalCall', _17 => _17(path)]);
  };
  const handleFolderOpen = (file) => {
    let newPath;
    if (!currentPath || currentPath === "") {
      if (file.name && /^[A-Za-z]:/.test(file.name)) {
        newPath = file.name + (file.name.endsWith("\\") ? "" : "\\");
      } else {
        newPath = file.name;
      }
    } else {
      const separator = currentPath.includes("\\") ? "\\" : "/";
      if (currentPath === "/") {
        newPath = "/" + file.name;
      } else if (currentPath.endsWith(separator)) {
        newPath = currentPath + file.name;
      } else {
        newPath = currentPath + separator + file.name;
      }
    }
    _optionalChain([onFolderOpen, 'optionalCall', _18 => _18(file)]);
    _optionalChain([onNavigate, 'optionalCall', _19 => _19(newPath)]);
  };
  const handleSelectAll = (selected) => {
    _optionalChain([onSelectAll, 'optionalCall', _20 => _20(selected)]);
  };
  const handleSelectFile = (fileId, selected) => {
    _optionalChain([onSelectFile, 'optionalCall', _21 => _21(fileId, selected)]);
  };
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: _chunkFIG2RKZFcjs.cn.call(void 0, "flex flex-col h-full bg-ods-bg", className), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex-1 flex flex-col py-2 space-y-6 min-h-0", children: [
    /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col justify-between gap-4 mb-4 md:flex-row", children: [
      /* @__PURE__ */ _jsxruntime.jsx.call(void 0, 
        FileManagerBreadcrumb,
        {
          items: breadcrumbItems,
          onItemClick: handleBreadcrumbClick
        }
      ),
      showActions && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, 
        FileManagerActionBar,
        {
          canPaste,
          hasSelection: selectedFiles.length > 0,
          onNewFolder: () => _optionalChain([onFileAction, 'optionalCall', _22 => _22("new-folder")]),
          onPaste: () => _optionalChain([onFileAction, 'optionalCall', _23 => _23("paste")]),
          onCopy: () => _optionalChain([onFileAction, 'optionalCall', _24 => _24("copy")]),
          onCut: () => _optionalChain([onFileAction, 'optionalCall', _25 => _25("cut")]),
          onUpload: () => _optionalChain([onFileAction, 'optionalCall', _26 => _26("upload")]),
          onSelectAll: () => handleSelectAll(true)
        }
      )
    ] }),
    showSearch && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, 
      _chunk6JINAOI7cjs.Input,
      {
        value: searchQuery,
        onChange: (e) => _optionalChain([onSearch, 'optionalCall', _27 => _27(e.target.value)]),
        placeholder: "Search...",
        disabled: disableSearch,
        startAdornment: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkWZW7C7TFcjs.SearchIcon, {}),
        loading: isSearching
      }
    ),
    /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex-1 min-h-0", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, 
      FileManagerTable,
      {
        files,
        selectedFiles,
        resultsCount: resultsCount || files.length,
        showCheckboxes,
        loading,
        isSearchResult: !!searchQuery,
        onSelectFile: handleSelectFile,
        onSelectAll: handleSelectAll,
        onFileClick,
        onFolderOpen: handleFolderOpen,
        onFileAction
      }
    ) })
  ] }) });
}

// src/components/ui/file-manager/file-manager-skeleton.tsx

function FileManagerSkeleton({
  rows = 8,
  showSearch = true,
  showActions = true
}) {
  const rowPlaceholders = Array.from({ length: rows });
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex flex-col h-full bg-ods-bg", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex-1 flex flex-col py-6 space-y-6 min-h-0", children: [
    /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-wrap items-start justify-between gap-4", children: [
      /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex-1 min-w-0 flex items-center gap-2", children: [
        /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6JINAOI7cjs.Skeleton, { className: "h-5 w-12" }),
        /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6JINAOI7cjs.Skeleton, { className: "h-4 w-4 rounded-full" }),
        /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6JINAOI7cjs.Skeleton, { className: "h-5 w-20" }),
        /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6JINAOI7cjs.Skeleton, { className: "h-4 w-4 rounded-full" }),
        /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6JINAOI7cjs.Skeleton, { className: "h-5 w-24" })
      ] }),
      showActions && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex-shrink-0 flex items-center gap-2", children: [
        /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6JINAOI7cjs.Skeleton, { className: "h-9 w-24" }),
        /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6JINAOI7cjs.Skeleton, { className: "h-9 w-20" }),
        /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6JINAOI7cjs.Skeleton, { className: "h-9 w-20" }),
        /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6JINAOI7cjs.Skeleton, { className: "h-9 w-28" })
      ] })
    ] }),
    showSearch && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6JINAOI7cjs.Skeleton, { className: "h-10 w-full rounded-lg" }),
    /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex-1 min-h-0", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "bg-ods-bg border border-ods-border rounded-lg flex flex-col", children: [
      /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center h-12 px-4 bg-ods-bg-secondary border-b border-ods-border rounded-t-lg", children: [
        /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "mr-4", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6JINAOI7cjs.Skeleton, { className: "h-5 w-5 rounded" }) }),
        /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex items-center gap-3 flex-1 min-w-0 text-sm font-medium text-ods-text-secondary", children: "NAME" }),
        /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "w-24 shrink-0 pr-4 text-sm font-medium text-ods-text-secondary", children: "SIZE" }),
        /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "w-36 shrink-0 pl-4 text-sm font-medium text-ods-text-secondary", children: "EDITED" }),
        /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "w-48 shrink-0 pl-4 flex justify-end" })
      ] }),
      /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "divide-y divide-ods-border rounded-b-lg flex-1 overflow-auto min-h-0", children: rowPlaceholders.map((_, idx) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "bg-ods-card flex items-center h-16 px-4 border-ods-border", children: [
        /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "mr-4", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6JINAOI7cjs.Skeleton, { className: "h-5 w-5 rounded" }) }),
        /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-3 flex-1 min-w-0", children: [
          /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6JINAOI7cjs.Skeleton, { className: "h-6 w-6 rounded" }),
          /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex flex-col min-w-0", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6JINAOI7cjs.Skeleton, { className: "h-4 w-32" }) })
        ] }),
        /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "w-24 shrink-0 pr-4", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6JINAOI7cjs.Skeleton, { className: "h-4 w-16" }) }),
        /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "w-36 shrink-0 pl-4", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6JINAOI7cjs.Skeleton, { className: "h-4 w-24" }) }),
        /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "w-48 shrink-0 pl-4 flex items-center justify-end gap-1", children: [
          /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6JINAOI7cjs.Skeleton, { className: "h-8 w-8 rounded" }),
          /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6JINAOI7cjs.Skeleton, { className: "h-8 w-8 rounded" })
        ] })
      ] }, idx)) })
    ] }) })
  ] }) });
}










exports.FileIcon = FileIcon; exports.FileManager = FileManager; exports.FileManagerActionBar = FileManagerActionBar; exports.FileManagerBreadcrumb = FileManagerBreadcrumb; exports.FileManagerContextMenu = FileManagerContextMenu; exports.FileManagerEmpty = FileManagerEmpty; exports.FileManagerSkeleton = FileManagerSkeleton; exports.FileManagerTable = FileManagerTable; exports.FileManagerTableRow = FileManagerTableRow;
//# sourceMappingURL=index.cjs.map