"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 EndpointNumber_exports = {};
__export(EndpointNumber_exports, {
  EndpointNumber: () => EndpointNumber,
  TlvEndpointNumber: () => TlvEndpointNumber
});
module.exports = __toCommonJS(EndpointNumber_exports);
var import_ValidationError = require("../common/ValidationError.js");
var import_TlvNumber = require("../tlv/TlvNumber.js");
var import_TlvWrapper = require("../tlv/TlvWrapper.js");
/**
 * @license
 * Copyright 2022-2026 Matter.js Authors
 * SPDX-License-Identifier: Apache-2.0
 */
function EndpointNumber(endpointId, validate = true) {
  if (!validate || endpointId >= 0 && endpointId <= 65534) {
    return endpointId;
  }
  throw new import_ValidationError.ValidationOutOfBoundsError(`EndpointNumber must be between 0 and 0xFFFE, got ${endpointId}`);
}
((EndpointNumber2) => {
  EndpointNumber2.isValid = (0, import_ValidationError.validatorOf)(EndpointNumber2);
})(EndpointNumber || (EndpointNumber = {}));
const TlvEndpointNumber = new import_TlvWrapper.TlvWrapper(
  import_TlvNumber.TlvUInt16,
  (endpointNumber) => endpointNumber,
  (value) => EndpointNumber(value, false)
  // No automatic validation on decode
);
//# sourceMappingURL=EndpointNumber.js.map
