/// <reference types="node" />
/// <reference types="node" />
import React from 'react';
import { InjectorOptions, SplitSpec } from './SplitInjector';
import { ScalarResponse, Tab as KuiTab, CommandStartEvent, CommandCompleteEvent } from '@kui-shell/core';
import ScrollbackState from './ScrollbackState';
import { SplitPositionProps } from './SplitPosition';
import KuiConfiguration from '../../Client/KuiConfiguration';
import SessionInitStatus from '../../Client/SessionInitStatus';
import '../../../../web/scss/components/Terminal/_index.scss';
export interface TerminalOptions {
    noActiveInput?: boolean;
}
type Props = TerminalOptions & SplitPositionProps & React.PropsWithChildren<{
    /** tab UUID */
    uuid: string;
    /** tab model */
    tab: KuiTab;
    snapshot?: Buffer;
    tabTitle?: string;
    /** Callback after we mount */
    onReady?: () => void;
    /** handler for terminal clear */
    onClear?: () => void;
    /** KuiConfiguration */
    config: KuiConfiguration;
    /** Toggle attribute on Tab DOM */
    toggleAttribute(attr: string): void;
    /** Status of the proxy session (for client-server architectures of Kui) */
    sessionInit: SessionInitStatus;
    /** Reset any notion of left strip etc. */
    resetSplitLayout(): void;
    /** Toggle whether we have a left strip split */
    willToggleLeftStripMode(): void;
    /** Toggle whether we have a right strip split */
    willToggleRightStripMode(): void;
}>;
interface State {
    /** Index of the focused split (index into State.splits) */
    focusedIdx: number;
    /** Splits model */
    splits: ScrollbackState[];
}
/** get the selected texts in window */
export declare function getSelectionText(): string;
export default class ScrollableTerminal extends React.PureComponent<Props, State> {
    /**
     * For UUID generation, keep a running counter of the total number
     * of scrollbacks created. This index will be fed to the uuid.v5()
     * generator. Note: we can't use the scrollback's index in the
     * current split array, because the user might reorder them, e.g. by
     * creating two splits, then deleting the *first*, then creating
     * (again) a second split. What was the second split is now in the
     * first position, and the new split will have the same ID as the
     * (now) first-ordinal split. Thus, instead we keep a running
     * counter. This will preserve cross-session UUID sequence equality,
     * while avoiding the reordering dilemma.
     */
    private scrollbackCounter;
    private cleaners;
    constructor(props: Props);
    private initialState;
    /** Listen for copy and paste (TODO: cut) events to facilitate moving blocks */
    private initClipboardEvents;
    /** Listen for snapshot request events */
    private initSnapshotEvents;
    /** add welcome blocks at the top of scrollback */
    private scrollbackWithWelcome;
    /** Create a split with the given position and coloration */
    private makePositionedSplit;
    /**
     * This is the `inject` handler for the `SplitInjector`
     * interface. Injects the given React `node` into the given
     * `position`. Uses `uuid` to determine whether the a prior version
     * of the node already exists in that position.
     */
    readonly inject: (splitSpecs: SplitSpec[]) => NodeJS.Timeout;
    private readonly injectOne;
    /** This is the `modify` handler for the `SplitInjector`
     * interface. Modifies the properties of an existing split as
     * specified by `sbuuid`, and then returns the given `node`
     * unchanged. */
    readonly modify: (sbuuid: string, node: React.ReactNode, { hasActiveInput, inverseColors, maximized }: InjectorOptions) => React.ReactNode;
    private allocateUUIDForScrollback;
    /** Restore from localStorage for a given tab UUID */
    private restoreBlocks;
    /** @return the number of splits with `position=default` */
    private numDefaultSplits;
    private scrollback;
    private execUUIDOfLastActiveBlock;
    /** @return a reasonable default split */
    private findMainSplit;
    /** @return a reasonable default split */
    private get current();
    /** @return the uuid of a reasonable default split */
    private get currentUUID();
    /** Invert colors of the given Scrollback uuid */
    private invert;
    /** Clear Terminal; TODO: also clear persisted state, when we have it */
    private clear;
    /** Some splits may not be ideal receptacles for arbitrary content */
    private isOkSplitForContent;
    /**
     * We want to direct the command execution UI to a default-position
     * terminal.
     *
     * @return the sbuuid of a default-position split
     *
     */
    private redirectToPlainSplitIfNeeded;
    /** the REPL started executing a command */
    onExecStart(uuid: string, asReplay: boolean, event: CommandStartEvent, _insertIdx?: number): void;
    /** Format a MarkdownResponse */
    private markdown;
    /** the REPL finished executing a command */
    onExecEnd(uuid: string, asReplay: boolean, event: CommandCompleteEvent<ScalarResponse>, insertIdx?: number): Promise<void>;
    /** Only set focus if we haven't, yet */
    doFocusIfNeeded(): void;
    /** Owner wants us to focus on the current prompt */
    private _focusDebouncer;
    private doFocus;
    private setFocusOnScrollback;
    /**
     * Handle CommandStart/Complete events directed at the given
     * scrollback region.
     *
     */
    private hookIntoREPL;
    /**
     * Handle events directed at the given scrollback region.
     *
     */
    private initEvents;
    /** A controller has requested a tab layout modification */
    private onTabLayoutModificationRequest;
    /** Swap the position of the two splits; a and b are 1-indexed from the controller */
    private swapSplits;
    /** Split the view */
    private onSplit;
    /** Detach hooks that might have been registered */
    private uninitEvents;
    private mounted;
    componentDidMount(): void;
    componentWillUnmount(): void;
    /**
     * @return the index of the given scrollback, in the context of the
     * current (given) state
     *
     */
    findSplit(curState: State, uuid: string): number;
    /**
     * @return the index of the given scrollback, in the context of the
     * current (given) state
     *
     */
    private findAvailableSplit;
    /** If the block has watchable response, abort the job */
    private removeWatchableBlock;
    /** As per `removeWatchableBlock`, but for all blocks */
    private terminateAllWatchables;
    /**
     * Remove the given split (identified by `sbuuid`) from the state.
     *
     */
    private removeSplit;
    /**
     * Splice in an update to the given split (identified by `sbuuid`),
     * using the giving ScrollbackState mutator.
     *
     */
    private splice;
    /** Helper for splice; i.e. splice() does the setState, while this method does them mutate */
    private spliceMutate;
    /** whether the given scrollback has Active Block */
    private hasActiveBlock;
    /** return the index of the Active Block from a scrollback */
    private findActiveBlock;
    private tabFor;
    /** Is this scrollback not-100% width? */
    private isWidthConstrained;
    /** Render the blocks in one split */
    private blocks;
    /** Render one split */
    private split;
    render(): JSX.Element;
}
export {};
