"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var ClientBehaviorBacking_exports = {};
__export(ClientBehaviorBacking_exports, {
  ClientBehaviorBacking: () => ClientBehaviorBacking
});
module.exports = __toCommonJS(ClientBehaviorBacking_exports);
var import_general = require("#general");
var import_BehaviorBacking = require("./BehaviorBacking.js");
/**
 * @license
 * Copyright 2022-2025 Matter.js Authors
 * SPDX-License-Identifier: Apache-2.0
 */
class ClientBehaviorBacking extends import_BehaviorBacking.BehaviorBacking {
  #elements;
  get elements() {
    if (this.#elements) {
      return this.#elements;
    }
    const { attributeList, acceptedCommandList } = this.endpoint.stateOf(this.type);
    const schema = this.type.schema;
    const attributes = /* @__PURE__ */ new Set();
    const attributeIds = new Set(attributeList);
    for (const attr of schema.attributes) {
      if (attributeIds.has(attr.id)) {
        attributes.add((0, import_general.camelize)(attr.name));
      }
    }
    const commands = /* @__PURE__ */ new Set();
    const commandIds = new Set(acceptedCommandList);
    for (const cmd of schema.commands) {
      if (cmd.isRequest && commandIds.has(cmd.id)) {
        commands.add((0, import_general.camelize)(cmd.name));
      }
    }
    return this.#elements = {
      features: schema.supportedFeatures,
      attributes,
      commands,
      events: /* @__PURE__ */ new Set()
      // Not published
    };
  }
  get datasourceOptions() {
    const options = super.datasourceOptions;
    options.primaryKey = "id";
    return options;
  }
  close() {
    this.store.reclaimValues?.();
    super.close();
  }
}
//# sourceMappingURL=ClientBehaviorBacking.js.map
