"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 PeerDescriptor_exports = {};
__export(PeerDescriptor_exports, {
  ObservablePeerDescriptor: () => ObservablePeerDescriptor
});
module.exports = __toCommonJS(PeerDescriptor_exports);
var import_general = require("@matter/general");
var import_PeerAddress = require("./PeerAddress.js");
/**
 * @license
 * Copyright 2022-2026 Matter.js Authors
 * SPDX-License-Identifier: Apache-2.0
 */
class ObservablePeerDescriptor {
  #address;
  #operationalAddress;
  #discoveryData;
  #caseAuthenticatedTags;
  #sessionParameters;
  #onChange;
  constructor({ address, operationalAddress, discoveryData, caseAuthenticatedTags }, onChange) {
    this.#address = (0, import_PeerAddress.PeerAddress)(address);
    this.#operationalAddress = operationalAddress;
    this.#discoveryData = discoveryData;
    this.#caseAuthenticatedTags = caseAuthenticatedTags;
    this.#onChange = onChange;
  }
  get address() {
    return this.#address;
  }
  get operationalAddress() {
    return this.#operationalAddress;
  }
  set operationalAddress(value) {
    if ((0, import_general.isDeepEqual)(this.#operationalAddress, value)) {
      return;
    }
    this.#operationalAddress = value ? { ...value } : void 0;
    this.#onChange();
  }
  get discoveryData() {
    return this.#discoveryData;
  }
  set discoveryData(value) {
    if ((0, import_general.isDeepEqual)(value, this.#discoveryData)) {
      return;
    }
    this.#discoveryData = { ...this.#discoveryData, ...value };
    this.#onChange();
  }
  get sessionParameters() {
    return this.#sessionParameters;
  }
  set sessionParameters(value) {
    if (value === void 0 || (0, import_general.isDeepEqual)(value, this.#sessionParameters)) {
      return;
    }
    this.#sessionParameters = { ...value };
    this.#onChange();
  }
  get caseAuthenticatedTags() {
    return this.#caseAuthenticatedTags;
  }
  set caseAuthenticatedTags(cats) {
    if ((0, import_general.isDeepEqual)(cats, this.#caseAuthenticatedTags)) {
      return;
    }
    this.#caseAuthenticatedTags = cats ? [...cats] : void 0;
    this.#onChange();
  }
}
//# sourceMappingURL=PeerDescriptor.js.map
