"""Native terminal TUI core primitives."""

from loushang.tui.basic import Box, Spacer, Text, TruncatedText
from loushang.tui.cell_width import (
    ColumnSlice,
    ambiguous_width,
    autowrap_safe_width,
    configure_cell_width_from_environment,
    grapheme_clusters,
    normalize_box_drawing_diagram,
    normalize_terminal_output,
    set_ambiguous_width,
    slice_by_column,
    slice_with_width,
    strip_control_sequences,
    truncate_to_width,
    visible_width,
    wrap_ansi,
    wrap_cells,
)
from loushang.tui.compat import (
    CommandPalette,
    CommandPaletteItem,
    CompletionApplication,
    CompletionItem,
    CompletionProvider,
    CompletionSuggestions,
    InfoPanel,
    SettingItem,
    SettingsList,
    SettingsListRenderer,
)
from loushang.tui.completion import (
    CombinedCompletionProvider,
    CompletionCancellationToken,
    CompletionContext,
    PathCompletionProvider,
    SlashCommand,
    SlashCommandCompletionProvider,
    get_completion_suggestions,
)
from loushang.tui.content import (
    CapabilityAwareCodeHighlighter,
    CodeBlock,
    CodeHighlighter,
    CodeHighlighterLike,
    DiffBlock,
    ImageBlock,
    MarkdownRenderCache,
    MarkdownRenderer,
    PygmentsCodeHighlighter,
)
from loushang.tui.core import (
    CURSOR_MARKER,
    CursorDeclaration,
    RenderConstraints,
    RenderLine,
    RenderResult,
)
from loushang.tui.extensions import (
    ExtensionHandle,
    ExtensionHost,
    PublicTuiApi,
    RenderableAdapter,
)
from loushang.tui.feedback import (
    CancellableLoader,
    DynamicBorder,
    Loader,
    Rule,
    WorkedDivider,
)
from loushang.tui.framework import (
    Container,
    Focusable,
    FocusableMixin,
    Renderable,
    ScreenRoot,
    Surface,
    SurfaceHandle,
    SurfaceHost,
    surface_is_bottom_exclusive,
    surface_is_inline_presentation,
    surface_is_overlay_presentation,
    surface_presentation,
)
from loushang.tui.fuzzy import FuzzyMatch, fuzzy_filter, fuzzy_match
from loushang.tui.input import (
    InputBatch,
    InputEvent,
    InputIntent,
    InputReader,
    InputRouter,
    sanitize_paste_text,
)
from loushang.tui.keybindings import (
    KeybindingConfig,
    KeybindingConflict,
    KeybindingManager,
    normalize_key_id,
)
from loushang.tui.keyboard_protocol import KeyboardProtocolController
from loushang.tui.playback import (
    PLAYBACK_ARTIFACTS_ENV,
    PlaybackArtifacts,
    PlaybackEvent,
    PlaybackFrameBudget,
    PlaybackHarness,
    PlaybackResult,
    PlaybackScenario,
    PlaybackStep,
    RenderDiagnostics,
    playback_artifacts_directory_from_env,
)
from loushang.tui.render_loop import RenderLoop
from loushang.tui.runner import (
    TerminalSessionFactory,
    TerminalSizeProvider,
    TuiInputHandler,
    TuiInputResult,
    TuiRunContext,
    TuiRunner,
)
from loushang.tui.runtime import TuiRuntime
from loushang.tui.scheduler import (
    AnimationFrameSource,
    RenderRequestKind,
    RenderScheduleDecision,
    RenderScheduler,
    RenderSchedulerConfig,
)
from loushang.tui.selection import SelectionRange
from loushang.tui.selection_controller import SelectionController
from loushang.tui.selection_rendering import (
    DEFAULT_SELECTION_STYLE,
    highlight_selection_by_columns,
)
from loushang.tui.surfaces import (
    ApprovalSurface,
    AutocompleteSurface,
    CommandSurface,
    DialogSurface,
    SelectionSurface,
    SelectItem,
    SettingsSurface,
)
from loushang.tui.terminal import (
    FakeCellStyle,
    FakeScreen,
    FakeTerminalPort,
    ProcessTerminalPort,
    TerminalFrame,
    TerminalOperation,
    TerminalPort,
    TerminalProgressReporter,
    TerminalSize,
    terminal_size_from_environment,
)
from loushang.tui.terminal_capabilities import (
    ImageProtocol as TerminalRuntimeImageProtocol,
)
from loushang.tui.terminal_capabilities import (
    KeyboardProtocolStrategy,
    TerminalEnvironment,
    TerminalRuntimeCapabilities,
    detect_terminal_capabilities,
    format_terminal_capability_diagnostics,
    terminal_environment_from_env,
)
from loushang.tui.terminal_image import (
    CellDimensions,
    Image,
    ImageCellSize,
    ImageDimensions,
    ImageProtocol,
    ImageProtocolSelection,
    TerminalImageRender,
    allocate_image_id,
    calculate_image_cell_size,
    delete_all_kitty_images,
    delete_kitty_image,
    detect_image_protocol,
    encode_iterm2_image,
    encode_kitty_image,
    extract_kitty_image_ids,
    get_gif_dimensions,
    get_image_dimensions,
    get_jpeg_dimensions,
    get_png_dimensions,
    get_webp_dimensions,
    hyperlink,
    image_fallback,
    is_terminal_image_line,
    render_terminal_image,
    render_terminal_image_result,
    wrap_tmux_passthrough,
)
from loushang.tui.terminal_input import (
    TerminalInputMode,
    drain_input,
    read_input_chunk,
    read_input_chunk_or_render_tick,
    stream_is_tty,
)
from loushang.tui.terminal_platform import (
    APPLE_TERMINAL_SHIFT_ENTER_SEQUENCE,
    DefaultTerminalPlatformAdapter,
    TerminalPlatformAdapter,
)
from loushang.tui.terminal_session import TerminalSession
from loushang.tui.theme import (
    TerminalCapabilities,
    ThemeResolver,
    apply_theme_style,
    theme_capabilities_from_runtime,
)
from loushang.tui.transcript import (
    AssistantMessageRecord,
    ContextCompactionRecord,
    DisplayRecord,
    ErrorRecord,
    StatusRecord,
    StreamingTextBuffer,
    ThinkingRecord,
    ThinkingVisibility,
    ToolExecutionRecord,
    TranscriptBuffer,
    TranscriptView,
    UserPromptRecord,
    WorkedDividerRecord,
    render_transcript_records,
)
from loushang.tui.tui import InputListener, Tui
from loushang.tui.ui_parts import (
    LOUSHANG_BANNER_LOGO,
    LOUSHANG_GUANQUE_TOWER_LOGO,
    Badge,
    BadgeKind,
    BottomFrame,
    Button,
    ButtonKind,
    Checkbox,
    Choice,
    Composer,
    ConfirmDialog,
    Dialog,
    DialogAction,
    FooterField,
    FooterStatusLine,
    FooterView,
    Form,
    FormRow,
    FormValidationResult,
    IconButton,
    KeyValueItem,
    KeyValueList,
    LoushangWelcomePanel,
    Menu,
    MenuItem,
    PendingQueueView,
    PendingSection,
    ProgressBar,
    QuestionDialog,
    RadioGroup,
    ScreenLayout,
    ScreenRegion,
    ScreenRegionStack,
    SelectList,
    Spinner,
    StatusBar,
    StatusField,
    StatusKind,
    StatusPill,
    TabItem,
    Table,
    TableAlign,
    TableColumn,
    TableRow,
    Tabs,
    TextArea,
    TextField,
    TextInput,
    Toast,
    ToastKind,
    ToastStack,
    Toggle,
    Toolbar,
    ToolbarAction,
    TreeNode,
    TreeView,
    WorkingLine,
    loushang_welcome_theme,
)

__all__ = [
    "ApprovalSurface",
    "AnimationFrameSource",
    "APPLE_TERMINAL_SHIFT_ENTER_SEQUENCE",
    "AutocompleteSurface",
    "Badge",
    "BadgeKind",
    "BottomFrame",
    "Box",
    "Button",
    "ButtonKind",
    "CURSOR_MARKER",
    "CellDimensions",
    "CapabilityAwareCodeHighlighter",
    "CancellableLoader",
    "Checkbox",
    "Choice",
    "ColumnSlice",
    "CodeBlock",
    "CodeHighlighter",
    "CodeHighlighterLike",
    "CommandSurface",
    "ContextCompactionRecord",
    "CommandPalette",
    "CommandPaletteItem",
    "CombinedCompletionProvider",
    "CompletionApplication",
    "CompletionCancellationToken",
    "CompletionContext",
    "CompletionItem",
    "CompletionProvider",
    "CompletionSuggestions",
    "Composer",
    "ConfirmDialog",
    "Container",
    "CursorDeclaration",
    "DisplayRecord",
    "Dialog",
    "DialogAction",
    "DialogSurface",
    "DiffBlock",
    "DefaultTerminalPlatformAdapter",
    "DEFAULT_SELECTION_STYLE",
    "AssistantMessageRecord",
    "DynamicBorder",
    "ErrorRecord",
    "ExtensionHandle",
    "ExtensionHost",
    "FakeCellStyle",
    "FakeScreen",
    "FakeTerminalPort",
    "Focusable",
    "FocusableMixin",
    "FuzzyMatch",
    "FooterField",
    "FooterStatusLine",
    "FooterView",
    "Form",
    "FormRow",
    "FormValidationResult",
    "fuzzy_filter",
    "fuzzy_match",
    "InputBatch",
    "InputEvent",
    "InputIntent",
    "InputReader",
    "InputRouter",
    "InputListener",
    "Image",
    "ImageBlock",
    "ImageCellSize",
    "ImageDimensions",
    "ImageProtocol",
    "ImageProtocolSelection",
    "InfoPanel",
    "KeybindingConfig",
    "KeybindingConflict",
    "KeybindingManager",
    "KeyValueItem",
    "KeyValueList",
    "Menu",
    "MenuItem",
    "KeyboardProtocolStrategy",
    "KeyboardProtocolController",
    "is_terminal_image_line",
    "IconButton",
    "Loader",
    "LOUSHANG_BANNER_LOGO",
    "LOUSHANG_GUANQUE_TOWER_LOGO",
    "LoushangWelcomePanel",
    "loushang_welcome_theme",
    "MarkdownRenderCache",
    "MarkdownRenderer",
    "PLAYBACK_ARTIFACTS_ENV",
    "PlaybackArtifacts",
    "PlaybackEvent",
    "PlaybackFrameBudget",
    "PlaybackHarness",
    "PlaybackResult",
    "PlaybackScenario",
    "PlaybackStep",
    "playback_artifacts_directory_from_env",
    "PendingQueueView",
    "PendingSection",
    "PathCompletionProvider",
    "ProgressBar",
    "QuestionDialog",
    "PygmentsCodeHighlighter",
    "ScreenRegion",
    "ScreenRegionStack",
    "ScreenLayout",
    "ProcessTerminalPort",
    "PublicTuiApi",
    "RadioGroup",
    "RenderConstraints",
    "RenderDiagnostics",
    "RenderLine",
    "Renderable",
    "RenderableAdapter",
    "RenderResult",
    "RenderLoop",
    "RenderRequestKind",
    "RenderScheduleDecision",
    "RenderScheduler",
    "RenderSchedulerConfig",
    "Rule",
    "ScreenRoot",
    "SelectItem",
    "SelectList",
    "SelectionRange",
    "SelectionController",
    "SelectionSurface",
    "SettingsSurface",
    "SettingItem",
    "SettingsList",
    "SettingsListRenderer",
    "SlashCommand",
    "SlashCommandCompletionProvider",
    "Spinner",
    "StatusBar",
    "StatusField",
    "StatusKind",
    "StatusPill",
    "StatusRecord",
    "Spacer",
    "Table",
    "TableAlign",
    "TableColumn",
    "TableRow",
    "TabItem",
    "Tabs",
    "StreamingTextBuffer",
    "Surface",
    "SurfaceHandle",
    "SurfaceHost",
    "surface_is_bottom_exclusive",
    "surface_is_inline_presentation",
    "surface_is_overlay_presentation",
    "surface_presentation",
    "TerminalFrame",
    "TerminalImageRender",
    "TerminalInputMode",
    "TerminalOperation",
    "TerminalPlatformAdapter",
    "TerminalPort",
    "TerminalProgressReporter",
    "TerminalEnvironment",
    "TerminalRuntimeCapabilities",
    "TerminalRuntimeImageProtocol",
    "TerminalSession",
    "TerminalSessionFactory",
    "TerminalSize",
    "TerminalSizeProvider",
    "TerminalCapabilities",
    "ThemeResolver",
    "ThinkingRecord",
    "ThinkingVisibility",
    "Text",
    "TextArea",
    "TextField",
    "TextInput",
    "Toggle",
    "Toolbar",
    "ToolbarAction",
    "Toast",
    "ToastKind",
    "ToastStack",
    "ToolExecutionRecord",
    "TranscriptBuffer",
    "TranscriptView",
    "TruncatedText",
    "TreeNode",
    "TreeView",
    "TuiInputHandler",
    "TuiInputResult",
    "TuiRunContext",
    "TuiRunner",
    "TuiRuntime",
    "Tui",
    "UserPromptRecord",
    "WorkingLine",
    "WorkedDivider",
    "WorkedDividerRecord",
    "ambiguous_width",
    "apply_theme_style",
    "allocate_image_id",
    "autowrap_safe_width",
    "configure_cell_width_from_environment",
    "calculate_image_cell_size",
    "delete_all_kitty_images",
    "delete_kitty_image",
    "detect_terminal_capabilities",
    "detect_image_protocol",
    "format_terminal_capability_diagnostics",
    "drain_input",
    "encode_iterm2_image",
    "encode_kitty_image",
    "extract_kitty_image_ids",
    "get_gif_dimensions",
    "get_image_dimensions",
    "get_jpeg_dimensions",
    "get_png_dimensions",
    "get_webp_dimensions",
    "hyperlink",
    "highlight_selection_by_columns",
    "get_completion_suggestions",
    "grapheme_clusters",
    "image_fallback",
    "normalize_terminal_output",
    "normalize_key_id",
    "normalize_box_drawing_diagram",
    "sanitize_paste_text",
    "set_ambiguous_width",
    "read_input_chunk",
    "read_input_chunk_or_render_tick",
    "render_transcript_records",
    "render_terminal_image",
    "render_terminal_image_result",
    "slice_by_column",
    "slice_with_width",
    "stream_is_tty",
    "strip_control_sequences",
    "terminal_size_from_environment",
    "terminal_environment_from_env",
    "theme_capabilities_from_runtime",
    "truncate_to_width",
    "visible_width",
    "wrap_ansi",
    "wrap_cells",
    "wrap_tmux_passthrough",
]
