/**
 * Copyright 2023-present DreamNum Co., Ltd.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
import type { Injector, ITextStyle } from '@univerjs/core';
import type { FDocument } from './f-document';
import type { IFDocumentTextRange } from './utils';
import { ICommandService } from '@univerjs/core';
import { FBaseInitialable } from '@univerjs/core/facade';
/** A clipped text-style run in document offsets. */
export interface IFDocumentTextStyleRun {
    /** Inclusive start offset in the document segment. */
    startOffset: number;
    /** Exclusive end offset in the document segment. */
    endOffset: number;
    /** Explicit text style stored on this run. */
    textStyle: ITextStyle;
}
/** Agent-friendly summary of a document text range. */
export interface IFDocumentTextRangeDescription extends IFDocumentTextRange {
    text: string;
    length: number;
    /** Explicit styles stored directly in text runs. */
    explicitTextStyleRuns: IFDocumentTextStyleRun[];
    /** Top-level explicit style properties common to the complete range. */
    commonExplicitTextStyle: ITextStyle;
}
/**
 * Facade wrapper for reading and styling a fixed document text range.
 *
 * Offsets are fixed when the wrapper is created. Create a new range after edits
 * that insert or remove content before it.
 * @hideconstructor
 */
export declare class FDocumentTextRange extends FBaseInitialable {
    protected readonly _document: FDocument;
    protected readonly _startOffset: number;
    protected readonly _endOffset: number;
    protected readonly _segmentId: string;
    protected readonly _injector: Injector;
    private readonly _commandService;
    constructor(_document: FDocument, _startOffset: number, _endOffset: number, _segmentId: string, _injector: Injector, _commandService: ICommandService);
    /**
     * Returns the serializable document range.
     * @example
     * ```ts
     * const fDocument = univerAPI.getActiveDocument();
     * const range = fDocument?.findParagraphByText('Launch')?.getTextRange();
     * console.log(range?.getRange());
     * ```
     */
    getRange(): IFDocumentTextRange;
    /**
     * Returns the plain data-stream text in this range.
     * @example
     * ```ts
     * const fDocument = univerAPI.getActiveDocument();
     * const range = fDocument?.findParagraphByText('Launch')?.getTextRange();
     * console.log(range?.getText());
     * ```
     */
    getText(): string;
    /**
     * Returns explicit text-style runs intersecting this range.
     * Returned offsets are clipped to the range and remain document-relative.
     * @example
     * ```ts
     * const fDocument = univerAPI.getActiveDocument();
     * const range = fDocument?.findParagraphByText('Launch')?.getTextRange();
     * console.log(range?.getExplicitTextStyleRuns());
     * ```
     */
    getExplicitTextStyleRuns(): IFDocumentTextStyleRun[];
    /**
     * Returns top-level style properties that have the same explicit value
     * across the complete range. Unstyled gaps make a property non-common.
     * @example
     * ```ts
     * const fDocument = univerAPI.getActiveDocument();
     * const range = fDocument?.findParagraphByText('Launch')?.getTextRange();
     * console.log(range?.getCommonExplicitTextStyle());
     * ```
     */
    getCommonExplicitTextStyle(): ITextStyle;
    /**
     * Returns a serializable summary suitable for an agent/tool response.
     * @example
     * ```ts
     * const fDocument = univerAPI.getActiveDocument();
     * const range = fDocument?.findParagraphByText('Launch')?.getTextRange();
     * console.log(range?.describe());
     * ```
     */
    describe(): IFDocumentTextRangeDescription;
    /**
     * Merges a text-style patch into every character in the range.
     * Existing text-run splitting, merging, and normalization are handled by
     * the document mutation pipeline.
     * `style.fs` is a font size in points (pt), not CSS pixels.
     * @example
     * ```ts
     * const fDocument = univerAPI.getActiveDocument();
     * const range = fDocument?.findParagraphByText('Launch')?.getTextRange();
     * range?.setTextStyle({ fs: 10.5, bl: univerAPI.Enum.BooleanNumber.TRUE });
     * ```
     */
    setTextStyle(style: ITextStyle): boolean;
    /**
     * Replaces the range with plain text while preserving document mutation semantics.
     * @example
     * ```ts
     * const fDocument = univerAPI.getActiveDocument();
     * const range = fDocument?.findParagraphByText('Draft')?.getTextRange();
     * range?.setText('Final');
     * ```
     */
    setText(text: string): boolean;
    private _validateRange;
    private _getStyleSegments;
}
