"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 LegacyControllerStore_exports = {};
__export(LegacyControllerStore_exports, {
  LegacyControllerStore: () => LegacyControllerStore
});
module.exports = __toCommonJS(LegacyControllerStore_exports);
/**
 * @license
 * Copyright 2022-2026 Matter.js Authors
 * SPDX-License-Identifier: Apache-2.0
 */
class LegacyControllerStore {
  #rootStorage;
  #sessionStorage;
  #caStorage;
  // Root certificate and Fabric
  #nodesStorage;
  // Holds list of nodes in root level and then sub levels with data per client node?
  /**
   * Create a new store.
   */
  constructor(storage) {
    this.#rootStorage = storage;
  }
  async erase() {
    await this.#sessionStorage?.clearAll();
    await this.#caStorage?.clearAll();
    await this.#nodesStorage?.clearAll();
  }
  async close() {
  }
  get sessionStorage() {
    if (!this.#sessionStorage) {
      this.#sessionStorage = this.#rootStorage.createContext("SessionManager");
    }
    return this.#sessionStorage;
  }
  get caStorage() {
    if (!this.#caStorage) {
      this.#caStorage = this.#rootStorage.createContext("RootCertificateManager");
    }
    return this.#caStorage;
  }
  get nodesStorage() {
    if (this.#nodesStorage === void 0) {
      this.#nodesStorage = this.#rootStorage.createContext("MatterController");
    }
    return this.#nodesStorage;
  }
  get fabricStorage() {
    return this.nodesStorage;
  }
  clientNodeStore(nodeId) {
    return this.nodesStorage.createContext(`node-${nodeId}`);
  }
}
//# sourceMappingURL=LegacyControllerStore.js.map
