import type { Signal } from "@preact/signals-core";
import { TAnchor } from "../../components/canvas/anchors";
import { Block, TBlock } from "../../components/canvas/blocks/Block";
import { ESelectionStrategy, ISelectionBucket } from "../../services/selection/types";
import { AnchorState } from "../anchor/Anchor";
import { BlockListStore } from "./BlocksList";
export type TBlockId = string | number;
export declare const IS_BLOCK_TYPE: "Block";
export declare class BlockState<T extends TBlock = TBlock> {
    readonly store: BlockListStore;
    private readonly blockSelectionBucket;
    static fromTBlock(store: BlockListStore, block: TBlock): BlockState<TBlock>;
    protected $rawState: Signal<T>;
    /**
     * Block state signal
     *
     * @returns {ReadonlySignal<T>} Block state
     */
    $state: import("@preact/signals-core").ReadonlySignal<T & {
        selected: boolean;
    }>;
    /**
     * Block id
     */
    get id(): TBlockId;
    /**
     * Block x position
     */
    get x(): number;
    /**
     * Block y position
     */
    get y(): number;
    /**
     * Block width
     */
    get width(): number;
    /**
     * Block height
     */
    get height(): number;
    /**
     * Block selected
     */
    get selected(): boolean;
    /**
     * Computed signal that reactively determines if this block is selected
     * by checking if its ID exists in the selection bucket
     */
    readonly $selected: import("@preact/signals-core").ReadonlySignal<boolean>;
    readonly $anchorStates: Signal<AnchorState[]>;
    /**
     * Block geometry signal
     *
     * Pay attention!! x and y are rounded to integer
     *
     * @returns {ReadonlySignal<{x: number, y: number, width: number, height: number}>} Block geometry
     */
    readonly $geometry: import("@preact/signals-core").ReadonlySignal<{
        x: number;
        y: number;
        width: number;
        height: number;
    }>;
    /**
     * Block anchor indexes signal
     *
     * @returns {ReadonlySignal<Map<string, number>>} Block anchor indexes
     */
    $anchorIndexs: import("@preact/signals-core").ReadonlySignal<Map<string, number>>;
    /**
     * Block anchors signal
     *
     * @returns {ReadonlySignal<TAnchor[]>} Block anchors
     */
    $anchors: import("@preact/signals-core").ReadonlySignal<TAnchor[]>;
    /**
     * Block selected anchors signal
     *
     * @returns {TAnchor[]} Block selected anchors
     */
    $selectedAnchors: import("@preact/signals-core").ReadonlySignal<AnchorState[]>;
    readonly $viewComponent: Signal<Block<TBlock<{}>, import("../../components/canvas/blocks/Block").TBlockProps>>;
    private pendingHidden?;
    /** Reactive flag that mirrors the canvas component's hidden state. */
    readonly $hidden: Signal<boolean>;
    constructor(store: BlockListStore, block: T, blockSelectionBucket: ISelectionBucket<string | number>);
    onAnchorSelected(anchorId: AnchorState["id"], selected: boolean): void;
    setSelection(selected: boolean, strategy?: ESelectionStrategy): void;
    getSelectedAnchor(): AnchorState;
    getAnchorState(id: AnchorState["id"]): AnchorState;
    updateXY(x: number, y: number, forceUpdate?: boolean): void;
    setViewComponent(blockComponent: Block): void;
    /**
     * Request to hide or show this block's canvas component.
     * Safe to call before the canvas component is mounted — the request is
     * deferred and applied automatically in setViewComponent().
     */
    requestHidden(hidden: boolean): void;
    getViewComponent(): Block<TBlock<{}>, import("../../components/canvas/blocks/Block").TBlockProps>;
    getConnections(): import("../..").ConnectionState<{
        id?: import("../..").TConnectionId;
        sourceBlockId?: TBlockId;
        targetBlockId?: TBlockId;
        sourceAnchorId?: string;
        targetAnchorId?: string;
        sourcePortId?: import("../..").TPortId;
        targetPortId?: import("../..").TPortId;
        label?: string;
        styles?: Partial<import("../../graphConfig").TConnectionColors> & {
            dashes?: number[];
        };
        dashed?: boolean;
        selected?: boolean;
    }>[];
    clearAnchorsSelection(): void;
    setName(newName: string): void;
    updateAnchors(anchors: TAnchor[]): void;
    /**
     * Updates block state
     *
     * @param block {Partial<TBlock>} Block to update
     * @returns void
     */
    updateBlock(block: Partial<TBlock>): void;
    getAnchorById(anchorId: string): AnchorState;
    /**
     * Converts the block state to a TBlock
     *
     * @returns {TBlock} TBlock
     */
    asTBlock(): TBlock;
    /**
     * Cheap snapshot for graph events (e.g. `block-change`): one object spread, no deep clone.
     * Nested values (`anchors`, `meta`, `settings`, …) are shared with the live store — treat as read-only.
     */
    asTBlockShallow(): Readonly<TBlock>;
}
