import type { NobjcObject } from "objc-js";
import type { _NSArray } from "../Foundation/NSArray.js";
import type { _NSString } from "../Foundation/NSString.js";
import type { _NSView } from "./NSView.js";
import type { NSRange } from "../structs/NSRange.js";
export interface _NSTextFinderClient {
    /**
     * If the client cannot logically or efficiently flatten itself into a single string, then the following two methods should be used instead. These methods require the client to conceptually map its content to a single string, which is composed of a concatenation of all its substrings. The first method asks for the string that contains the given character index, which the client should return. This client should also return, by reference, the "effective range" of that substring in the full conceptually concatenated string. Finally, the client should return whether the substring ends with a "search boundary", meaning that NSTextFinder should not attempt to find any matches that overlap this boundary. The client should report the full length of the conceptually concatenated string in the second model -- the sum of the lengths of all of its substrings.
     */
    stringAtIndex$effectiveRange$endsWithSearchBoundary$?(characterIndex: number, outRange: NobjcObject, outFlag: NobjcObject): _NSString;
    stringLength?(): number;
    /**
     * This method is used by all actions, but is not strictly required by any. This method instructs the client to scroll its view to make the given range visible.
     */
    scrollRangeToVisible$?(range: NSRange): void;
    /**
     * These methods are used by the ShowReplaceInterface, Replace, ReplaceAll(InSelection) and ReplaceAndFind actions. Since NSTextFinder can only read the content from the client, the client is responsible for performing replace operations itself, which are done via these methods. Before a replace operation is performed, NSTextFinder calls the first method to determine if a replacement should take place. If it returns NO, then the characters in the given ranges will not be replaced. If the method returns YES, or is not implemented, then it will call the second method, instructing the client to carry out the replacement. Finally, the third method will be called, if implemented, to indicate that the replacement was completed. For ReplaceAll actions, these methods will be called multiple times, starting from the last match and moving toward the first, in order to preserve the indexes of the matches which precede the current one.
     */
    shouldReplaceCharactersInRanges$withStrings$?(ranges: _NSArray, strings: _NSArray): boolean;
    replaceCharactersInRange$withString$?(range: NSRange, string_: _NSString): void;
    didReplaceCharacters?(): void;
    /**
     * This method is used when displaying feedback about find operations to the user. The client should return the view the contains the character at the given index. It should also return by reference the entire range of the string displayed by the view.
     */
    contentViewAtIndex$effectiveCharacterRange$?(index: number, outRange: NobjcObject): _NSView;
    /**
     * NSTextFinder uses this method to determine the location to display the find indicator. The client should convert the given content range to an array of rectangles in the contentView's coordinate system and return that array. The given range is guaranteed not to overlap multiple views.
     */
    rectsForCharacterRange$?(range: NSRange): _NSArray | null;
    /**
     * Draw the glyphs for the requested character range as they are drawn in the given content view. If the character range partially intersects a glyph range, then the full glyph is can be drawn to avoid additional layout. The given range is guaranteed to be completely contained by the given view. When this method is called, a drawing context effectively identical to the one provided to the view’s -drawRect: will be set up. This method is mainly used to draw find indicator contents, so implementations should check -isDrawingFindIndicator to ensure that the text will be easily readable against the background of the find indicator when it returns YES. If this method is not implemented, then the find indicator will be drawn using the content view’s -drawRect: method instead.
     */
    drawCharactersInRange$forContentView$?(range: NSRange, view: _NSView): void;
    /**
     * NSTextFinder uses the following properties to validate individual actions. If these properties are not implemented, NSTextFinder will act as if they returned YES.
     */
    selectable?(): boolean;
    allowsMultipleSelection?(): boolean;
    editable?(): boolean;
    /**
     * If the client contains a single string, then the client can implement this property to return that string to be searched.
     */
    string?(): _NSString;
    /**
     * This property is required for the NextMatch, PreviousMatch, Replace, ReplaceAndFind, and SetSearchString actions. The client just needs to return its first selected range, or {index, 0} to indicate the location of the insertion point if there is no selection.
     */
    firstSelectedRange?(): NSRange;
    /**
     * This property is required for the ReplaceAllInSelection, SelectAll, and SelectAllInSelection actions. The NSArray should contain NSRanges wrapped by NSValues.
     */
    selectedRanges?(): _NSArray;
    setSelectedRanges$?(value: _NSArray): void;
    /**
     * NSTextFinder uses this property's value to determine which ranges it should search to show all of the incremental matches that are currently visible. If this property is not implemented, then the incremental matches cannot be shown.
     */
    visibleCharacterRanges?(): _NSArray;
}
