import GirafeSingleton from '../../base/GirafeSingleton.js';
import BaseLayer from '../../models/layers/baselayer.js';
import { LayerId } from '../../models/layerdefinitions.js';
import GroupLayer from '../../models/layers/grouplayer.js';
import Layer from '../../models/layers/layer.js';
import ThemeLayer from '../../models/layers/themelayer.js';
export type LayerTreeChanges = {
    insertedLayers: BaseLayer[];
    activatedLayers: BaseLayer[];
};
export default class ThemesHelper extends GirafeSingleton {
    initializeSingleton(): Promise<void>;
    private get state();
    findBaseLayerById(layerId: LayerId): BaseLayer;
    findBaseLayerRecursiveById(layers: BaseLayer[], layerId: LayerId): BaseLayer | null;
    findThemeByName(themename: string): ThemeLayer | null;
    findGroupByName(groupname: string): GroupLayer | null;
    findLayerByName(layername: string): Layer | null;
    private findBaseLayerByName;
    private findLayerRecursive;
    /**
     * @param layer any layer or layer group (or theme) to find the related theme.
     * @returns The original theme configuration.
     */
    getOriginalTheme(layer: BaseLayer): ThemeLayer | null;
    /**
     * Count the layer in both the given theme and the matching original theme.
     * @param theme the theme to check.
     * @returns true if the count is the same. False otherwise.
     */
    isThemeComplete(theme: ThemeLayer): boolean;
    /**
     * @return the number of all sublayers (recursively) of the given layer.
     * @private
     */
    private countLayer;
    /**
     * Add the related theme if it's not already (even partially) in the layertree. If it's
     * already in it, don't add it, warn the user, and highlight it.
     * @returns true if the related theme is added to the layertree, false otherwise.
     */
    addThemeIfNotPresent(theme: ThemeLayer): boolean;
    /**
     * Add the missing layers of an in-use theme, from an original theme description.
     * The added layers are deactivated.
     * @param originalTheme a Theme object, or model, as initially defined.
     */
    completeTheme(originalTheme: ThemeLayer): void;
    /**
     * Deactivate all layers and sublayer recursively.
     * Meaning state="off" and isDefaultChecked=false.
     * @private
     */
    private deactivateAllLayers;
    private onSelectedThemeChanged;
    private getThemeInLayersList;
    private onThemeChanged;
    getMinimalClonedThemeForLayer(layer: BaseLayer): ThemeLayer;
    private removeOthers;
    private getHierarchyFromLayer;
    addThemesFromUrl(): boolean;
    addGroupsFromUrl(): boolean;
    addLayersFromUrl(): boolean;
    addLayerFromName(layername: string): boolean;
    private addLayerBaseFromName;
    private extractLayerOptions;
    private extractLayerOptionOpacity;
    private extractLayerOptionFilter;
    private extractLayerOptionTime;
    /**
     * Calculates the initial order (=position) for a new theme in the tree.
     * Themes are added at the top of the tree, but underneath any pinned themes. Defaults to 0.
     * This prevents themes of visibly "jumping" around in the tree after being added due to reordering.
     */
    getInitialOrderForNewTheme(): number;
    mergeThemeInLayerTree(theme: ThemeLayer, activate?: boolean, forceTop?: boolean): LayerTreeChanges;
    /**
     * This function merges the newLayer at its right place in the LayerTree
     * @param newLayer The layer to insert somewhere in the hierarchy
     * @param existingList
     * @param parent
     * @returns
     */
    private mergeLayerWithExistingLayerTree;
    private highlightLayerInLayerTree;
    private addLayerToLayerTree;
    removeLayersFromLayerTree(layersToRemove: BaseLayer[]): void;
    private removeLayersFromExistingLayerTree;
    /**
     * Find the initial position of the layer (relative to its sibling layers) by looking
     * at the original theme object and insert the layer following this original order.
     * (The "layer.order" value is incremented with the user operations, that's why we can
     * rely on it for new layers and must adapt it to the existing sibling layers.)
     * @private
     */
    private insertLayerToLayerTreeAtInitialPosition;
    /**
     * Removes all layers from the layer tree except themes that are pinned.
     */
    emptyLayerTree(): void;
}
