{"version":3,"file":"GetEndpointWithCluster.cjs","sources":["../../../../src/methods/ESPRMMatterNode/GetEndpointWithCluster.ts"],"sourcesContent":["/*\n * SPDX-FileCopyrightText: 2026 Espressif Systems (Shanghai) CO LTD\n *\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { ESPRMMatterNode } from \"../../ESPRMMatterNode\";\n\n/**\n * Augments the ESPRMMatterNode class with the `getEndpointWithCluster` method.\n */\ndeclare module \"../../ESPRMMatterNode\" {\n  interface ESPRMMatterNode {\n    /**\n     * Finds the first endpoint that exposes a given server cluster.\n     *\n     * Searches endpoints in ascending order and returns the first match. Useful when\n     * you need the application endpoint for a control cluster (e.g. OnOff on endpoint 1).\n     *\n     * @param clusterId - Server cluster ID to locate (e.g. `6` for OnOff).\n     * @returns The endpoint ID, or `undefined` if no endpoint exposes the cluster.\n     *\n     * @example\n     * ```typescript\n     * import { ESPRMMatterNode } from \"@espressif/rainmaker-matter-sdk\";\n     *\n     * const node = ESPRMMatterNode.fromMatterMetaData(nodeDetails);\n     *\n     * const onOffEndpoint = await node.getEndpointWithCluster(6);\n     * // onOffEndpoint === 1 for a typical OnOff light\n     * ```\n     */\n    getEndpointWithCluster(\n      clusterId: number\n    ): Promise<number | undefined>;\n  }\n}\n\nESPRMMatterNode.prototype.getEndpointWithCluster = async function (\n  clusterId: number\n): Promise<number | undefined> {\n  const endpoint = this.endpoints.find((ep) =>\n    ep.serverClusters.includes(clusterId)\n  );\n  return endpoint?.endpointId;\n};\n"],"names":["ESPRMMatterNode"],"mappings":";;;;AAAA;;;;AAIG;AAkCHA,+BAAe,CAAC,SAAS,CAAC,sBAAsB,GAAG,gBACjD,SAAiB,EAAA;IAEjB,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,EAAE,KACtC,EAAE,CAAC,cAAc,CAAC,QAAQ,CAAC,SAAS,CAAC,CACtC;IACD,OAAO,QAAQ,EAAE,UAAU;AAC7B,CAAC;;"}