/**
 * @license
 * Copyright 2022-2026 Matter.js Authors
 * SPDX-License-Identifier: Apache-2.0
 */
import { ImplementationError } from "@matter/general";
import { VendorId } from "@matter/types";
class IcdMultiAdminError extends ImplementationError {
  /**
   * Distinct VendorIds of the peer's other administrator fabrics that triggered the refusal — present these to the
   * user when asking whether to register anyway.
   */
  adminVendorIds;
  constructor(message, adminVendorIds) {
    super(message);
    this.adminVendorIds = adminVendorIds;
  }
}
((IcdMultiAdminError2) => {
  IcdMultiAdminError2.TRUSTED_ECOSYSTEM_VENDORS = [
    VendorId(4996),
    VendorId(4362)
  ];
  function assertSingleAdmin(vendorIds, ignoredVendors, allowMultiAdmin) {
    if (allowMultiAdmin) {
      return;
    }
    const ignored = new Set(ignoredVendors);
    const counted = vendorIds.filter((v) => !ignored.has(v));
    if (counted.length > 1) {
      throw new IcdMultiAdminError2(
        `ICD registration refused: peer has ${counted.length} administrator fabrics from other vendors. Pass register({ allowMultiAdmin: true }) or add their VendorIds to register({ ignoredVendors }).`,
        [...new Set(counted)]
      );
    }
  }
  IcdMultiAdminError2.assertSingleAdmin = assertSingleAdmin;
})(IcdMultiAdminError || (IcdMultiAdminError = {}));
export {
  IcdMultiAdminError
};
//# sourceMappingURL=IcdMultiAdminError.js.map
