/** * @license * Copyright 2022-2026 Matter.js Authors * SPDX-License-Identifier: Apache-2.0 */ import type { Endpoint } from "#endpoint/Endpoint.js"; import { EventEmitter, Observable } from "@matter/general"; import { Behavior } from "../../Behavior.js"; /** * This behavior indexes all descendants of a {@link Endpoint} by number. * * The Descriptor's PartsList of an endpoint whose device type names every descendant (root node, aggregator, bridged * node) is built from this index, so those endpoints need it. * * Only installed endpoints are indexed. */ export declare class IndexBehavior extends Behavior { #private; static readonly id = "index"; internal: IndexBehavior.Internal; readonly events: IndexBehavior.Events; static readonly early = true; initialize(): void; [Symbol.asyncDispose](): void; get partsById(): Record>; get partsByNumber(): Record>; /** * Retrieve a {@link Endpoint} by number. * * Note that {@link internal.partsByNumber} does not include {@link endpoint} but this method will return it if the * number matches. */ forNumber(number: number): Endpoint; /** * Ensure that no endpoint of the node that {@link parent} belongs to, other than {@link claimant}, holds * {@link number}. Does nothing if {@link parent} is not part of a node. * * @throws {@link IdentityConflictError} if another endpoint holds the number * @internal */ static assertNumberAvailable(claimant: Endpoint, number: number, parent?: Endpoint): void; /** * The endpoint the index of {@link tree}'s node holds under {@link number}. Undefined if {@link tree} is not part * of a node. * * @internal */ static holderOf(tree: Endpoint, number: number): Endpoint | undefined; /** * Does the index of {@link endpoint}'s node hold {@link endpoint} under its number? False unless the node is * constructing or active. * * @internal */ static isIndexed(endpoint: Endpoint): boolean; } export declare namespace IndexBehavior { class Internal { changeBroadcastPending?: boolean; /** * Map of ID to {@link Endpoint}. */ partsById: Record; /** * Map of number to {@link Endpoint}. */ partsByNumber: Record; } class Events extends EventEmitter { /** * Emitted when the index changes. */ change: Observable<[], void>; } } //# sourceMappingURL=IndexBehavior.d.ts.map