/**
 * Tools - Heavy components with lazy loading (React.lazy + Suspense)
 *
 * All components are lazy-loaded to reduce initial bundle size:
 * - Mermaid: ~800KB (diagram rendering)
 * - PrettyCode: ~500KB (code syntax highlighting)
 * - JsonTree: ~100KB (JSON visualization)
 * - LottiePlayer: ~200KB (Lottie animation player)
 * - JsonForm: ~300KB (JSON Schema form generator)
 * - OpenapiViewer: ~400KB (OpenAPI schema viewer & playground)
 * - VideoPlayer: ~150KB (Professional video player with Vidstack)
 * - AudioPlayer: ~200KB (Audio player with WaveSurfer.js)
 * - ImageViewer: ~50KB (Image viewer with zoom/pan/rotate)
 * - CronScheduler: ~15KB (Cron expression builder)
 *
 * Works in any React environment: Next.js, Vite, Wails, CRA
 */

// Export tools as named exports (all use React.lazy internally)
export { default as JsonTree } from './data/JsonTree';
export type { JsonTreeProps, JsonValue, JsonAction, JsonSize } from './data/JsonTree';
export { default as Mermaid } from './dev/Mermaid';
export { default as PrettyCode } from './dev/code/PrettyCode';
export type { Language } from './dev/code/PrettyCode';
export { LottiePlayer, useLottie, usePrefersReducedMotion } from './media/LottiePlayer';
export type {
  LottiePlayerProps,
  LottieSize,
  LottieSpeed,
  LottieDirection,
  LottieSegment,
  UseLottieOptions,
  UseLottieReturn,
} from './media/LottiePlayer';

// Export JsonForm components
export { JsonSchemaForm } from './forms/JsonForm';
export type { JsonSchemaFormProps } from './forms/JsonForm';
export * from './forms/JsonForm/widgets';
export * from './forms/JsonForm/templates';
export * from './forms/JsonForm/utils';

// Export OpenapiViewer
export { default as OpenapiViewer } from './dev/api/OpenapiViewer';
export type { PlaygroundConfig, SchemaSource, PlaygroundProps } from './dev/api/OpenapiViewer';

// Export VideoPlayer (media-chrome shell with provider-aware canvases)
export {
  VideoPlayer,
  CanvasDispatcher,
  NativeCanvas,
  YouTubeCanvas,
  VimeoCanvas,
  HlsCanvas,
  IframeCanvas,
  PlayButton,
  SeekBar,
  Volume,
  Fullscreen,
  Pip,
  PlaybackRate,
  ControlsBar,
  Poster,
  parseEmbedUrl,
  extractYouTubeId,
  extractVimeoId,
} from './media/VideoPlayer';
export type {
  VideoSource,
  UrlSource,
  YouTubeSource,
  VimeoSource,
  HlsSource,
  IframeSource,
  AspectRatioValue,
  VideoPlayerProps,
  VideoPlayerSettings,
  PlayButtonProps,
  SeekBarProps,
  VolumeProps,
  FullscreenProps,
  PipProps,
  PlaybackRateProps,
  ControlsBarProps,
  CanvasDispatcherProps,
  NativeCanvasProps,
  YouTubeCanvasProps,
  VimeoCanvasProps,
  HlsCanvasProps,
  IframeCanvasProps,
} from './media/VideoPlayer';

// AudioPlayer v6 — under construction (see @dev/@refactoring6-audioplayer/).
// The previous Hybrid* surface lives at ./AudioPlayer_old/ for reference and
// is intentionally not re-exported.
export { Player as AudioPlayer } from './media/AudioPlayer';
export type { PlayerProps as AudioPlayerProps } from './media/AudioPlayer';

// Export ImageViewer
export { ImageViewer } from './media/ImageViewer';
export type { ImageViewerProps, ImageFile } from './media/ImageViewer';

// Export CronScheduler (~15KB)
export {
  CronScheduler,
  // Context & Hooks
  CronSchedulerProvider,
  useCronSchedulerContext,
  useCronType,
  useCronTime,
  useCronWeekDays,
  useCronMonthDays,
  useCronCustom,
  useCronPreview,
  useCronSize,
  useCronScheduler,
  // Utilities
  buildCron,
  parseCron,
  isValidCron,
  humanizeCron,
  getNextRuns,
  formatNextRun,
  // Components
  ScheduleTypeSelector,
  TimeSelector,
  DayChips,
  MonthDayGrid,
  CustomInput,
  SchedulePreview,
  CronPreview,
} from './input/CronScheduler';
export type {
  CronSchedulerProps,
  CronSchedulerSize,
  ScheduleType,
  WeekDay,
  MonthDay,
  CronSchedulerState,
  CronSchedulerContextValue,
  CronPreviewProps,
} from './input/CronScheduler';

// Export CodeEditor (Monaco ~550KB)
export {
  Editor,
  DiffEditor,
} from './forms/CodeEditor/components';
export type { EditorRef } from './forms/CodeEditor/components/Editor';
export {
  EditorProvider,
  useEditorContext,
} from './forms/CodeEditor/context';
export {
  useMonaco,
  useEditor,
  useLanguage,
} from './forms/CodeEditor/hooks';
export type {
  EditorFile,
  EditorOptions,
  EditorProps,
  DiffEditorProps,
  EditorContextValue,
  UseEditorReturn,
  UseMonacoReturn,
} from './forms/CodeEditor/types';

// Export MarkdownEditor (Tiptap ~200KB)
export { MarkdownEditor, mentionPresets } from './forms/MarkdownEditor';
export type {
  MarkdownEditorProps,
  MentionItem,
  MentionConfig,
  MentionAttrs,
  MentionMarkdownRenderer,
} from './forms/MarkdownEditor';

// Export Tree (decomposed shadcn-style tree, our own engine)
export {
  TreeRoot,
  Tree,
  TreeProvider,
  useTreeContext,
  useTreeLabels,
  useTreeRows,
  useTreeSelection,
  useTreeExpansion,
  useTreeFocus,
  useTreeSearch,
  useTreeActions,
  useTreeTypeAhead,
  useTreeKeyboard,
  TreeContent,
  TreeRow,
  TreeChevron,
  TreeIcon,
  TreeLabel,
  TreeSearchInput,
  TreeEmpty,
  TreeSkeleton,
  TreeError,
  TreeIndentGuides,
  createChildCache,
  resolveChildren,
  flattenTree,
  loadTreeState,
  saveTreeState,
  clearTreeState,
  createDemoTree,
  DEFAULT_TREE_LABELS,
  DEFAULT_TREE_APPEARANCE,
  resolveAppearance,
  appearanceToStyle,
} from './data/Tree';
export type {
  TreeRootProps,
  TreeProviderProps,
  TreeContextValue,
  TreeContextMenuSlot,
  TreeContentProps,
  TreeRowProps,
  TreeChevronProps,
  TreeIconProps,
  TreeLabelProps,
  TreeSearchInputProps,
  TreeEmptyProps,
  TreeSkeletonProps,
  TreeErrorProps,
  TreeIndentGuidesProps,
  TreeNode,
  TreeItemId,
  TreeLabels,
  TreeSelectionMode,
  TreeRowRenderProps,
  TreeRowSlot,
  TreeLoadChildren,
  FlatRow,
  ChildCache,
  ChildEntry,
  ChildEntryStatus,
  FlattenInput,
  PersistedTreeState,
  UseTreeTypeAheadOptions,
  UseTreeKeyboardOptions,
  DemoNode,
  TreeAppearance,
  ResolvedAppearance,
  TreeDensity,
  TreeAccentIntensity,
  TreeRadius,
} from './data/Tree';

// Export Media Cache Store
export {
  useMediaCacheStore,
  useImageCache,
  useAudioCache,
  useVideoCache,
  useBlobUrlCleanup,
  generateContentKey,
} from '../stores/mediaCache';

// Export ResponsiveDialog
export {
  ResponsiveDialog,
  ResponsiveDialogContent,
  ResponsiveDialogHeader,
  ResponsiveDialogTitle,
  ResponsiveDialogDescription,
  ResponsiveDialogFooter,
  ResponsiveDialogProvider,
  useResponsiveDialogContext,
} from './overlay/ResponsiveDialog';
export type {
  ResponsiveDialogProps,
  ResponsiveDialogContentProps,
  ResponsiveDialogHeaderProps,
  ResponsiveDialogTitleProps,
  ResponsiveDialogDescriptionProps,
  ResponsiveDialogFooterProps,
  ResponsiveDialogContextValue,
} from './overlay/ResponsiveDialog';

// Export ScrollSpy
export {
  ScrollSpy,
  ScrollSpyNav,
  ScrollSpyNavItem,
  ScrollSpySection,
  ScrollSpyProvider,
  useScrollSpyContext,
} from './overlay/ScrollSpy';
export type {
  ScrollSpyProps,
  ScrollSpyNavProps,
  ScrollSpyNavItemProps,
  ScrollSpySectionProps,
  ScrollSpyContextValue,
} from './overlay/ScrollSpy';

// Export Scroller
export {
  Scroller,
  ScrollerItem,
  ScrollerProvider,
  useScrollerContext,
} from './input/Scroller';
export type {
  ScrollerProps,
  ScrollerItemProps,
  ScrollerIndicatorProps,
  ScrollerContextValue,
  SnapAlign,
} from './input/Scroller';

// Export SelectionToolbar
export {
  SelectionToolbar,
  SelectionToolbarContent,
  SelectionToolbarAction,
  SelectionToolbarProvider,
  useSelectionToolbarContext,
} from './overlay/SelectionToolbar';
export type {
  SelectionToolbarProps,
  SelectionToolbarContentProps,
  SelectionToolbarActionProps,
  SelectionToolbarContextValue,
} from './overlay/SelectionToolbar';

// Export Sortable
export {
  Sortable,
  SortableItem,
  SortableHandle,
  SortableProvider,
  useSortableContext,
} from './input/Sortable';
export type {
  SortableProps,
  SortableItemProps,
  SortableHandleProps,
  SortableContextValue,
  SortableItemData,
  SortableAxis,
} from './input/Sortable';

// Export Tour
export {
  Tour,
  TourPopover,
  TourNavigation,
  TourProvider,
  useTourContext,
} from './overlay/Tour';
export type {
  TourProps,
  TourStep,
  TourPopoverProps,
  TourNavigationProps,
  TourContextValue,
} from './overlay/Tour';

// Export Combobox
export {
  Combobox,
  ComboboxTrigger,
  ComboboxInput,
  ComboboxList,
  ComboboxItem,
  ComboboxEmpty,
  ComboboxProvider,
  useComboboxContext,
} from './input/Combobox';
export type {
  ComboboxProps,
  ComboboxTriggerProps,
  ComboboxInputProps,
  ComboboxListProps,
  ComboboxItemProps,
  ComboboxEmptyProps,
  ComboboxContextValue,
  ComboboxOption,
} from './input/Combobox';

// Export ColorPalette (jalcoui port, Phase 1 Wave 3)
export {
  ColorPalette,
  ColorPaletteSwatch,
  formatColor as colorPaletteFormatColor,
  getReadableContrast as colorPaletteGetReadableContrast,
} from './visual/design/ColorPalette';
export type {
  ColorEntry as ColorPaletteEntry,
  ColorFormat as ColorPaletteFormat,
  ColorPaletteMode,
  ColorPaletteProps,
} from './visual/design/ColorPalette';

// Export ColorPicker
export {
  ColorPicker,
  ColorPickerTrigger,
  ColorPickerContent,
  ColorPickerArea,
  ColorPickerHueSlider,
  ColorPickerAlphaSlider,
  ColorPickerSwatch,
  ColorPickerEyeDropper,
  ColorPickerFormatSelect,
  ColorPickerInput,
} from './visual/design/ColorPicker';
export type {
  ColorPickerProps,
  ColorPickerInputProps,
} from './visual/design/ColorPicker';

// Export FileUpload
export {
  FileUpload,
  FileUploadDropzone,
  FileUploadTrigger,
  FileUploadList,
  FileUploadItem,
  FileUploadItemPreview,
  FileUploadItemMetadata,
  FileUploadItemProgress,
  FileUploadItemDelete,
  FileUploadClear,
} from './forms/FileUpload';
export type {
  FileUploadProps,
  FileState,
  StoreState,
  StoreAction,
  Store,
} from './forms/FileUpload';

// Export Fps
export { Fps } from './visual/indicators/Fps';
export type { FpsProps } from './visual/indicators/Fps';

// Export Gauge
export {
  Gauge,
  GaugeIndicator,
  GaugeTrack,
  GaugeRange,
  GaugeValueText,
  GaugeLabel,
  GaugeCombined,
} from './visual/charts/Gauge';
export type { GaugeProps } from './visual/charts/Gauge';

// Export Marquee
export {
  Marquee,
  MarqueeContent,
  MarqueeEdge,
  MarqueeItem,
} from './visual/Marquee';
export type {
  MarqueeProps,
  MarqueeEdgeProps,
} from './visual/Marquee';

// Export QRCode
export {
  QRCode,
  QRCodeCanvas,
  QRCodeSvg,
  QRCodeImage,
  QRCodeDownload,
  QRCodeOverlay,
  QRCodeSkeleton,
} from './visual/QRCode';
export type {
  QRCodeProps,
  QRCodeCanvasOpts,
} from './visual/QRCode';

// Export Rating
export {
  Rating,
  RatingItem,
} from './visual/indicators/Rating';
export type {
  RatingProps,
  RatingItemProps,
} from './visual/indicators/Rating';

// Export ActivityGraph (jalcoui port, Phase 1)
export { ActivityGraph } from './visual/charts/ActivityGraph';
export type { ActivityGraphProps, ActivityEntry } from './visual/charts/ActivityGraph';

// Export CommitGraph (jalcoui port, Phase 1)
export {
  CommitGraph,
  useLaneColors as useCommitGraphLaneColors,
  useGraphLayout as useCommitGraphLayout,
  pickLaneColor as pickCommitGraphLaneColor,
  ROW_HEIGHT as COMMIT_GRAPH_ROW_HEIGHT,
} from './visual/charts/CommitGraph';
export type {
  Commit,
  CommitAuthor,
  CommitGraphProps,
  Edge as CommitGraphEdge,
  EdgeType as CommitGraphEdgeType,
  GraphRow as CommitGraphRow,
} from './visual/charts/CommitGraph';

// Export StatusIndicator (golden sample — jalcoui port, Phase 0)
export {
  StatusIndicator,
  STATUS_CONFIG,
  TONE_CLASSES as STATUS_TONE_CLASSES,
  statusIndicatorVariants,
} from './visual/indicators/StatusIndicator';
export type {
  Status,
  StatusTone,
  StatusIndicatorProps,
  StatusIndicatorSize,
} from './visual/indicators/StatusIndicator';

// Export EnvTable (jalcoui port, Phase 2)
export {
  EnvTable,
  ENV_TONE_CLASSES,
  getEnvTone,
  maskValue as envMaskValue,
  useEnvMask,
} from './dev/ops/EnvTable';
export type {
  EnvTableProps,
  EnvVariable,
  EnvEnvironment,
  EnvBadgeTone,
} from './dev/ops/EnvTable';

// Export LogViewer (jalcoui port, Phase 2 Wave 2)
export {
  LogViewer,
  LEVEL_LABELS as LOG_LEVEL_LABELS,
  LEVEL_TONE as LOG_LEVEL_TONE,
  LOG_TONE_CLASSES,
  getLevelToneClasses,
  parseAnsi,
  stripAnsi,
} from './dev/ops/LogViewer';
export type {
  LogEntry,
  LogLevel,
  LogTone,
  LogToneClasses,
  LogViewerProps,
  AnsiSegment,
} from './dev/ops/LogViewer';

// Export ApiRefTable (jalcoui port, Phase 2)
export {
  ApiRefTable,
  TYPE_TAG_CLASSES as API_REF_TYPE_TAG_CLASSES,
  classifyTypeToken as classifyApiRefTypeToken,
  splitTypeSignature as splitApiRefTypeSignature,
} from './dev/api/ApiRefTable';
export type {
  ApiProp,
  ApiRefTableProps,
  TypeTag as ApiRefTypeTag,
} from './dev/api/ApiRefTable';

// Export DiffViewer (jalcoui port, Phase 2 Wave 3)
export {
  DiffViewer,
  DIFF_TONE_CLASSES,
  diffLines,
  parseUnifiedPatch,
  computeDiffStats,
  diffLineNumberWidth,
  useDiff,
  normalizeDiffLanguage,
} from './dev/code/DiffViewer';
export type {
  DiffLayout,
  DiffLine,
  DiffLineType,
  DiffStats,
  DiffInput,
  DiffToneClasses,
  DiffViewerProps,
} from './dev/code/DiffViewer';

// Export RequestViewer (jalcoui port, Phase 2)
export { RequestViewer } from './dev/api/RequestViewer';
export type {
  RequestViewerProps,
  RequestViewerTab,
  NetworkRequest,
  HeaderEntry as RequestViewerHeaderEntry,
  TimingEntry as RequestViewerTimingEntry,
} from './dev/api/RequestViewer';

// Export Sparkline (jalcoui port, Phase 1)
export { Sparkline } from './visual/charts/Sparkline';
export type {
  SparklineProps,
  SparklineColor,
  SparklineVariant,
  SparklineDatum,
} from './visual/charts/Sparkline';

// Export DataGrid
export {
  DataGrid,
  DataGridProvider,
  useDataGridContext,
  DataGridHeader,
  DataGridRow,
  DataGridCell,
  DataGridPagination,
} from './data/DataGrid';
export type {
  DataGridProps,
  DataGridColumn,
  DataGridSortState,
  DataGridFilterState,
  DataGridPaginationState,
  DataGridSelectionMode,
  DataGridRowId,
  SortDirection,
} from './data/DataGrid';

// Export DataTable
export {
  DataTable,
  DataTableProvider,
  useDataTableContext,
  DataTableHeader,
  DataTableRow,
  DataTablePagination,
} from './data/DataTable';
export type {
  DataTableProps,
  DataTableColumn,
  DataTableSortState,
  DataTableFilterState,
  DataTablePaginationState,
  DataTableSelectionMode,
  DataTableRowId,
  DataTableSortDirection,
} from './data/DataTable';

// Export Kanban
export {
  Kanban,
  KanbanProvider,
  useKanbanContext,
  KanbanColumn,
  KanbanCard,
  KanbanDragOverlay,
} from './data/Kanban';
export type {
  KanbanProps,
  KanbanCardType,
  KanbanColumnType,
  KanbanDragState,
  KanbanCardId,
  KanbanColumnId,
} from './data/Kanban';
