"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 electrical_power_measurement_exports = {};
__export(electrical_power_measurement_exports, {
  ElectricalPowerMeasurement: () => ElectricalPowerMeasurement,
  ElectricalPowerMeasurementCluster: () => ElectricalPowerMeasurementCluster
});
module.exports = __toCommonJS(electrical_power_measurement_exports);
var import_MutableCluster = require("../cluster/mutation/MutableCluster.js");
var import_Cluster = require("../cluster/Cluster.js");
var import_TlvNumber = require("../tlv/TlvNumber.js");
var import_TlvNullable = require("../tlv/TlvNullable.js");
var import_TlvArray = require("../tlv/TlvArray.js");
var import_TlvObject = require("../tlv/TlvObject.js");
var import_BitmapSchema = require("../schema/BitmapSchema.js");
var import_MeasurementAccuracy = require("../globals/MeasurementAccuracy.js");
var import_Priority = require("../globals/Priority.js");
var import_ClusterRegistry = require("../cluster/ClusterRegistry.js");
/**
 * @license
 * Copyright 2022-2026 Matter.js Authors
 * SPDX-License-Identifier: Apache-2.0
 */
var ElectricalPowerMeasurement;
((ElectricalPowerMeasurement2) => {
  let Feature;
  ((Feature2) => {
    Feature2["DirectCurrent"] = "DirectCurrent";
    Feature2["AlternatingCurrent"] = "AlternatingCurrent";
    Feature2["PolyphasePower"] = "PolyphasePower";
    Feature2["Harmonics"] = "Harmonics";
    Feature2["PowerQuality"] = "PowerQuality";
  })(Feature = ElectricalPowerMeasurement2.Feature || (ElectricalPowerMeasurement2.Feature = {}));
  ElectricalPowerMeasurement2.TlvHarmonicMeasurement = (0, import_TlvObject.TlvObject)({
    /**
     * This field shall be the order of the harmonic being measured. Typically this is an odd number, but servers
     * may choose to report even harmonics.
     *
     * @see {@link MatterSpecification.v142.Cluster} § 2.13.5.4.1
     */
    order: (0, import_TlvObject.TlvField)(0, import_TlvNumber.TlvUInt8.bound({ min: 1 })),
    /**
     * This field shall be the measured value for the given harmonic order.
     *
     * For the Harmonic Currents attribute, this value is the most recently measured harmonic current reading in
     * milliamps (mA). A positive value indicates that the measured harmonic current is positive, and a negative
     * value indicates that the measured harmonic current is negative.
     *
     * For the Harmonic Phases attribute, this value is the most recent phase of the given harmonic order in
     * millidegrees (mDeg). A positive value indicates that the measured phase is leading, and a negative value
     * indicates that the measured phase is lagging.
     *
     * If this measurement is not currently available, a value of null shall be returned.
     *
     * @see {@link MatterSpecification.v142.Cluster} § 2.13.5.4.2
     */
    measurement: (0, import_TlvObject.TlvField)(1, (0, import_TlvNullable.TlvNullable)(import_TlvNumber.TlvInt64))
  });
  let PowerMode;
  ((PowerMode2) => {
    PowerMode2[PowerMode2["Unknown"] = 0] = "Unknown";
    PowerMode2[PowerMode2["Dc"] = 1] = "Dc";
    PowerMode2[PowerMode2["Ac"] = 2] = "Ac";
  })(PowerMode = ElectricalPowerMeasurement2.PowerMode || (ElectricalPowerMeasurement2.PowerMode = {}));
  let MeasurementType;
  ((MeasurementType2) => {
    MeasurementType2[MeasurementType2["Unspecified"] = 0] = "Unspecified";
    MeasurementType2[MeasurementType2["Voltage"] = 1] = "Voltage";
    MeasurementType2[MeasurementType2["ActiveCurrent"] = 2] = "ActiveCurrent";
    MeasurementType2[MeasurementType2["ReactiveCurrent"] = 3] = "ReactiveCurrent";
    MeasurementType2[MeasurementType2["ApparentCurrent"] = 4] = "ApparentCurrent";
    MeasurementType2[MeasurementType2["ActivePower"] = 5] = "ActivePower";
    MeasurementType2[MeasurementType2["ReactivePower"] = 6] = "ReactivePower";
    MeasurementType2[MeasurementType2["ApparentPower"] = 7] = "ApparentPower";
    MeasurementType2[MeasurementType2["RmsVoltage"] = 8] = "RmsVoltage";
    MeasurementType2[MeasurementType2["RmsCurrent"] = 9] = "RmsCurrent";
    MeasurementType2[MeasurementType2["RmsPower"] = 10] = "RmsPower";
    MeasurementType2[MeasurementType2["Frequency"] = 11] = "Frequency";
    MeasurementType2[MeasurementType2["PowerFactor"] = 12] = "PowerFactor";
    MeasurementType2[MeasurementType2["NeutralCurrent"] = 13] = "NeutralCurrent";
    MeasurementType2[MeasurementType2["ElectricalEnergy"] = 14] = "ElectricalEnergy";
    MeasurementType2[MeasurementType2["ReactiveEnergy"] = 15] = "ReactiveEnergy";
    MeasurementType2[MeasurementType2["ApparentEnergy"] = 16] = "ApparentEnergy";
  })(MeasurementType = ElectricalPowerMeasurement2.MeasurementType || (ElectricalPowerMeasurement2.MeasurementType = {}));
  ElectricalPowerMeasurement2.TlvMeasurementRange = (0, import_TlvObject.TlvObject)({
    /**
     * This field shall be the type of measurement for the range provided.
     *
     * @see {@link MatterSpecification.v142.Cluster} § 2.13.5.3.1
     */
    measurementType: (0, import_TlvObject.TlvField)(0, (0, import_TlvNumber.TlvEnum)()),
    /**
     * This field shall be the smallest measured value for the associated measurement over either the period between
     * StartTimestamp and EndTimestamp, or the period between StartSystime and EndSystime, or both.
     *
     * @see {@link MatterSpecification.v142.Cluster} § 2.13.5.3.2
     */
    min: (0, import_TlvObject.TlvField)(1, import_TlvNumber.TlvInt64),
    /**
     * This field shall be the largest measured value for the associated measurement over the period between either
     * StartTimestamp and EndTimestamp or the period between StartSystime and EndSystime, or both.
     *
     * @see {@link MatterSpecification.v142.Cluster} § 2.13.5.3.3
     */
    max: (0, import_TlvObject.TlvField)(2, import_TlvNumber.TlvInt64),
    /**
     * This field shall be the timestamp in UTC of the beginning of the measurement period.
     *
     * If the server had not yet determined the time in UTC at or before the beginning of the measurement period, or
     * does not have the capability of determining the time in UTC, this field shall be omitted.
     *
     * @see {@link MatterSpecification.v142.Cluster} § 2.13.5.3.4
     */
    startTimestamp: (0, import_TlvObject.TlvOptionalField)(3, import_TlvNumber.TlvEpochS),
    /**
     * This field shall be the timestamp in UTC of the end of the measurement period.
     *
     * If the server had not yet determined the time in UTC at or before the beginning of the measurement period, or
     * does not have the capability of determining the time in UTC, this field shall be omitted.
     *
     * @see {@link MatterSpecification.v142.Cluster} § 2.13.5.3.5
     */
    endTimestamp: (0, import_TlvObject.TlvOptionalField)(4, import_TlvNumber.TlvEpochS),
    /**
     * This field shall be the most recent timestamp in UTC that the value in the Min field was measured.
     *
     * This field shall be greater than or equal to the value of the StartTimestamp field.
     *
     * This field shall be less than or equal to the value of the EndTimestamp field.
     *
     * @see {@link MatterSpecification.v142.Cluster} § 2.13.5.3.6
     */
    minTimestamp: (0, import_TlvObject.TlvOptionalField)(5, import_TlvNumber.TlvEpochS),
    /**
     * This field shall be the most recent timestamp in UTC of the value in the Max field.
     *
     * This field shall be greater than or equal to the value of the StartTimestamp field.
     *
     * This field shall be less than or equal to the value of the EndTimestamp field.
     *
     * @see {@link MatterSpecification.v142.Cluster} § 2.13.5.3.7
     */
    maxTimestamp: (0, import_TlvObject.TlvOptionalField)(6, import_TlvNumber.TlvEpochS),
    /**
     * This field shall be the time since boot of the beginning of the measurement period.
     *
     * If the server had determined the time in UTC at or before the start of the measurement period, this field may
     * be omitted along with the EndSystime, MinSystime, and MaxSystime fields.
     *
     * @see {@link MatterSpecification.v142.Cluster} § 2.13.5.3.8
     */
    startSystime: (0, import_TlvObject.TlvOptionalField)(7, import_TlvNumber.TlvSysTimeMS),
    /**
     * This field shall be the time since boot of the end of the measurement period.
     *
     * If the server had determined the time in UTC at the end of the measurement period, this field may be omitted
     * along with the StartSystime field, MinSystime, and MaxSystime fields.
     *
     * @see {@link MatterSpecification.v142.Cluster} § 2.13.5.3.9
     */
    endSystime: (0, import_TlvObject.TlvOptionalField)(8, import_TlvNumber.TlvSysTimeMS),
    /**
     * This field shall be the measurement time since boot of the value in the Min field was measured.
     *
     * This field shall be greater than or equal to the value of the StartSystime field.
     *
     * This field shall be less than or equal to the value of the EndSystime field.
     *
     * @see {@link MatterSpecification.v142.Cluster} § 2.13.5.3.10
     */
    minSystime: (0, import_TlvObject.TlvOptionalField)(9, import_TlvNumber.TlvSysTimeMS),
    /**
     * This field shall be the measurement time since boot of the value in the Max field.
     *
     * This field shall be greater than or equal to the value of the StartSystime field.
     *
     * This field shall be less than or equal to the value of the EndSystime field.
     *
     * @see {@link MatterSpecification.v142.Cluster} § 2.13.5.3.11
     */
    maxSystime: (0, import_TlvObject.TlvOptionalField)(10, import_TlvNumber.TlvSysTimeMS)
  });
  ElectricalPowerMeasurement2.TlvMeasurementPeriodRangesEvent = (0, import_TlvObject.TlvObject)({
    /**
     * This shall indicate the value of the Ranges attribute at the time of event generation.
     *
     * @see {@link MatterSpecification.v142.Cluster} § 2.13.7.1.1
     */
    ranges: (0, import_TlvObject.TlvField)(0, (0, import_TlvArray.TlvArray)(ElectricalPowerMeasurement2.TlvMeasurementRange, { minLength: 1 }))
  });
  ElectricalPowerMeasurement2.AlternatingCurrentComponent = import_MutableCluster.MutableCluster.Component({
    attributes: {
      /**
       * This shall indicate the most recent ReactiveCurrent reading in milliamps (mA).
       *
       * A positive value represents current flowing into the server, while a negative value represents current
       * flowing out of the server.
       *
       * The reporting interval of this attribute shall be manufacturer dependent. The server may choose to omit
       * publication of deltas considered not meaningful.
       *
       * The server shall NOT mark this attribute ready for report if the last time this was done was more
       * recently than 1 second ago.
       *
       * The server may delay marking this attribute ready for report for longer periods if needed, however the
       * server shall NOT delay marking this attribute as ready for report for longer than 60 seconds.
       *
       * If the current cannot be measured, a value of null shall be returned.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 2.13.6.7
       */
      reactiveCurrent: (0, import_Cluster.OptionalAttribute)(6, (0, import_TlvNullable.TlvNullable)(import_TlvNumber.TlvInt64), { default: null }),
      /**
       * This shall indicate the most recent ApparentCurrent (square root sum of the squares of active and
       * reactive currents) reading in milliamps (mA).
       *
       * A positive value represents current flowing into the server, while a negative value represents current
       * flowing out of the server.
       *
       * The reporting interval of this attribute shall be manufacturer dependent. The server may choose to omit
       * publication of deltas considered not meaningful.
       *
       * The server shall NOT mark this attribute ready for report if the last time this was done was more
       * recently than 1 second ago.
       *
       * The server may delay marking this attribute ready for report for longer periods if needed, however the
       * server shall NOT delay marking this attribute as ready for report for longer than 60 seconds.
       *
       * If the active or reactive currents cannot be measured, a value of null shall be returned.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 2.13.6.8
       */
      apparentCurrent: (0, import_Cluster.OptionalAttribute)(7, (0, import_TlvNullable.TlvNullable)(import_TlvNumber.TlvInt64), { default: null }),
      /**
       * This shall indicate the most recent ReactivePower reading in millivolt-amps reactive (mVAR).
       *
       * A positive value represents power imported, while a negative value represents power exported.
       *
       * The reporting interval of this attribute shall be manufacturer dependent. The server may choose to omit
       * publication of deltas considered not meaningful.
       *
       * The server shall NOT mark this attribute ready for report if the last time this was done was more
       * recently than 1 second ago.
       *
       * The server may delay marking this attribute ready for report for longer periods if needed, however the
       * server shall NOT delay marking this attribute as ready for report for longer than 60 seconds.
       *
       * If the reactive power cannot be measured, a value of null shall be returned.
       *
       * If the Polyphase Power feature is supported, this value represents the combined reactive power imported
       * or exported.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 2.13.6.10
       */
      reactivePower: (0, import_Cluster.OptionalAttribute)(9, (0, import_TlvNullable.TlvNullable)(import_TlvNumber.TlvInt64), { default: null }),
      /**
       * This shall indicate the most recent ApparentPower reading in millivolt-amps (mVA).
       *
       * A positive value represents power imported, while a negative value represents power exported.
       *
       * The reporting interval of this attribute shall be manufacturer dependent. The server may choose to omit
       * publication of deltas considered not meaningful.
       *
       * The server shall NOT mark this attribute ready for report if the last time this was done was more
       * recently than 1 second ago.
       *
       * The server may delay marking this attribute ready for report for longer periods if needed, however the
       * server shall NOT delay marking this attribute as ready for report for longer than 60 seconds.
       *
       * If the apparent power cannot be measured, a value of null shall be returned.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 2.13.6.11
       */
      apparentPower: (0, import_Cluster.OptionalAttribute)(10, (0, import_TlvNullable.TlvNullable)(import_TlvNumber.TlvInt64), { default: null }),
      /**
       * This shall indicate the most recent RMSVoltage reading in millivolts (mV).
       *
       * The reporting interval of this attribute shall be manufacturer dependent. The server may choose to omit
       * publication of deltas considered not meaningful.
       *
       * The server shall NOT mark this attribute ready for report if the last time this was done was more
       * recently than 1 second ago.
       *
       * The server may delay marking this attribute ready for report for longer periods if needed, however the
       * server shall NOT delay marking this attribute as ready for report for longer than 60 seconds.
       *
       * If the RMS voltage cannot be measured, a value of null shall be returned.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 2.13.6.12
       */
      rmsVoltage: (0, import_Cluster.OptionalAttribute)(11, (0, import_TlvNullable.TlvNullable)(import_TlvNumber.TlvInt64), { default: null }),
      /**
       * This shall indicate the most recent RMSCurrent reading in milliamps (mA).
       *
       * A positive value represents current flowing into the server, while a negative value represents current
       * flowing out of the server.
       *
       * The reporting interval of this attribute shall be manufacturer dependent. The server may choose to omit
       * publication of deltas considered not meaningful.
       *
       * The server shall NOT mark this attribute ready for report if the last time this was done was more
       * recently than 1 second ago.
       *
       * The server may delay marking this attribute ready for report for longer periods if needed, however the
       * server shall NOT delay marking this attribute as ready for report for longer than 60 seconds.
       *
       * If the RMS current cannot be measured, a value of null shall be returned.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 2.13.6.13
       */
      rmsCurrent: (0, import_Cluster.OptionalAttribute)(12, (0, import_TlvNullable.TlvNullable)(import_TlvNumber.TlvInt64), { default: null }),
      /**
       * This shall indicate the most recent RMSPower reading in milliwatts (mW).
       *
       * A positive value represents power imported, while a negative value represents power exported.
       *
       * The reporting interval of this attribute shall be manufacturer dependent. The server may choose to omit
       * publication of deltas considered not meaningful.
       *
       * The server shall NOT mark this attribute ready for report if the last time this was done was more
       * recently than 1 second ago.
       *
       * The server may delay marking this attribute ready for report for longer periods if needed, however the
       * server shall NOT delay marking this attribute as ready for report for longer than 60 seconds.
       *
       * If the RMS power cannot be measured, a value of null shall be returned.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 2.13.6.14
       */
      rmsPower: (0, import_Cluster.OptionalAttribute)(13, (0, import_TlvNullable.TlvNullable)(import_TlvNumber.TlvInt64), { default: null }),
      /**
       * This shall indicate the most recent Frequency reading in millihertz (mHz).
       *
       * The reporting interval of this attribute shall be manufacturer dependent. The server may choose to omit
       * publication of deltas considered not meaningful.
       *
       * The server shall NOT mark this attribute ready for report if the last time this was done was more
       * recently than 1 second ago.
       *
       * The server may delay marking this attribute ready for report for longer periods if needed, however the
       * server shall NOT delay marking this attribute as ready for report for longer than 60 seconds.
       *
       * If the frequency cannot be measured, a value of null shall be returned.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 2.13.6.15
       */
      frequency: (0, import_Cluster.OptionalAttribute)(14, (0, import_TlvNullable.TlvNullable)(import_TlvNumber.TlvInt64.bound({ min: 0, max: 1e6 })), { default: null }),
      /**
       * This shall indicate the Power Factor ratio in +/- 1/100ths of a percent.
       *
       * The reporting interval of this attribute shall be manufacturer dependent. The server may choose to omit
       * publication of deltas considered not meaningful.
       *
       * The server shall NOT mark this attribute ready for report if the last time this was done was more
       * recently than 1 second ago.
       *
       * The server may delay marking this attribute ready for report for longer periods if needed, however the
       * server shall NOT delay marking this attribute as ready for report for longer than 60 seconds.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 2.13.6.18
       */
      powerFactor: (0, import_Cluster.OptionalAttribute)(
        17,
        (0, import_TlvNullable.TlvNullable)(import_TlvNumber.TlvInt64.bound({ min: -1e4, max: 1e4 })),
        { default: null }
      )
    }
  });
  ElectricalPowerMeasurement2.HarmonicsComponent = import_MutableCluster.MutableCluster.Component({
    attributes: {
      /**
       * This shall indicate a list of HarmonicMeasurementStruct values, with each HarmonicMeasurementStruct
       * representing the harmonic current reading for the harmonic order specified by Order.
       *
       * The reporting interval of this attribute shall be manufacturer dependent. The server may choose to omit
       * publication of deltas considered not meaningful.
       *
       * The server shall NOT mark this attribute ready for report if the last time this was done was more
       * recently than 1 second ago.
       *
       * The server may delay marking this attribute ready for report for longer periods if needed, however the
       * server shall NOT delay marking this attribute as ready for report for longer than 60 seconds.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 2.13.6.16
       */
      harmonicCurrents: (0, import_Cluster.Attribute)(15, (0, import_TlvNullable.TlvNullable)((0, import_TlvArray.TlvArray)(ElectricalPowerMeasurement2.TlvHarmonicMeasurement, { maxLength: 25 })))
    }
  });
  ElectricalPowerMeasurement2.PowerQualityComponent = import_MutableCluster.MutableCluster.Component({
    attributes: {
      /**
       * This shall indicate a list of HarmonicMeasurementStruct values, with each HarmonicMeasurementStruct
       * representing the most recent phase of the harmonic current reading for the harmonic order specified by
       * Order.
       *
       * The reporting interval of this attribute shall be manufacturer dependent. The server may choose to omit
       * publication of deltas considered not meaningful.
       *
       * The server shall NOT mark this attribute ready for report if the last time this was done was more
       * recently than 1 second ago.
       *
       * The server may delay marking this attribute ready for report for longer periods if needed, however the
       * server shall NOT delay marking this attribute as ready for report for longer than 60 seconds.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 2.13.6.17
       */
      harmonicPhases: (0, import_Cluster.Attribute)(16, (0, import_TlvNullable.TlvNullable)((0, import_TlvArray.TlvArray)(ElectricalPowerMeasurement2.TlvHarmonicMeasurement, { maxLength: 25 })))
    }
  });
  ElectricalPowerMeasurement2.PolyphasePowerComponent = import_MutableCluster.MutableCluster.Component({
    attributes: {
      /**
       * This shall indicate the most recent NeutralCurrent reading in milliamps (mA). Typically this is a derived
       * value, taking the magnitude of the vector sum of phase currents.
       *
       * If the neutral current cannot be measured or derived, a value of null shall be returned.
       *
       * A positive value represents an imbalance between the phase currents when power is imported.
       *
       * A negative value represents an imbalance between the phase currents when power is exported.
       *
       * The reporting interval of this attribute shall be manufacturer dependent. The server may choose to omit
       * publication of deltas considered not meaningful.
       *
       * The server shall NOT mark this attribute ready for report if the last time this was done was more
       * recently than 1 second ago.
       *
       * The server may delay marking this attribute ready for report for longer periods if needed, however the
       * server shall NOT delay marking this attribute as ready for report for longer than 60 seconds.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 2.13.6.19
       */
      neutralCurrent: (0, import_Cluster.OptionalAttribute)(18, (0, import_TlvNullable.TlvNullable)(import_TlvNumber.TlvInt64), { default: null })
    }
  });
  ElectricalPowerMeasurement2.Base = import_MutableCluster.MutableCluster.Component({
    id: 144,
    name: "ElectricalPowerMeasurement",
    revision: 3,
    features: {
      /**
       * This feature indicates the cluster can measure a direct current.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 2.13.4.1
       */
      directCurrent: (0, import_BitmapSchema.BitFlag)(0),
      /**
       * This feature indicates the cluster can measure an alternating current.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 2.13.4.2
       */
      alternatingCurrent: (0, import_BitmapSchema.BitFlag)(1),
      /**
       * This feature indicates the cluster represents the collective measurements for a Polyphase power supply.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 2.13.4.3
       */
      polyphasePower: (0, import_BitmapSchema.BitFlag)(2),
      /**
       * This feature indicates the cluster can measure the harmonics of an alternating current.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 2.13.4.4
       */
      harmonics: (0, import_BitmapSchema.BitFlag)(3),
      /**
       * This feature indicates the cluster can measure the harmonic phases of an alternating current.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 2.13.4.5
       */
      powerQuality: (0, import_BitmapSchema.BitFlag)(4)
    },
    attributes: {
      /**
       * This shall indicate the current mode of the server. For some servers, such as an EV, this may change
       * depending on the mode of charging or discharging.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 2.13.6.1
       */
      powerMode: (0, import_Cluster.Attribute)(0, (0, import_TlvNumber.TlvEnum)()),
      /**
       * This shall indicate the maximum number of measurement types the server is capable of reporting.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 2.13.6.2
       */
      numberOfMeasurementTypes: (0, import_Cluster.FixedAttribute)(1, import_TlvNumber.TlvUInt8.bound({ max: 32 })),
      /**
       * This shall indicate a list of accuracy specifications for the measurement types supported bytheserver.
       * There shall be an entry for ActivePower, as well as any other measurement types implemented by this
       * server.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 2.13.6.3
       */
      accuracy: (0, import_Cluster.FixedAttribute)(2, (0, import_TlvArray.TlvArray)(import_MeasurementAccuracy.TlvMeasurementAccuracy, { minLength: 1 })),
      /**
       * This shall indicate a list of measured ranges for different measurement types. Each measurement type
       * shall have at most one entry in this list, representing the range of measurements in the most recent
       * measurement period.
       *
       * The reporting interval of this attribute shall be manufacturer dependent. The server may choose to omit
       * publication of deltas considered not meaningful.
       *
       * The server shall NOT mark this attribute ready for report if the last time this was done was more
       * recently than 1 second ago.
       *
       * The server may delay marking this attribute ready for report for longer periods if needed, however the
       * server shall NOT delay marking this attribute as ready for report for longer than 60 seconds.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 2.13.6.4
       */
      ranges: (0, import_Cluster.OptionalAttribute)(3, (0, import_TlvArray.TlvArray)(ElectricalPowerMeasurement2.TlvMeasurementRange, { minLength: 0 }), { default: [] }),
      /**
       * This shall indicate the most recent Voltage reading in millivolts (mV).
       *
       * The reporting interval of this attribute shall be manufacturer dependent. The server may choose to omit
       * publication of deltas considered not meaningful.
       *
       * The server shall NOT mark this attribute ready for report if the last time this was done was more
       * recently than 1 second ago.
       *
       * The server may delay marking this attribute ready for report for longer periods if needed, however the
       * server shall NOT delay marking this attribute as ready for report for longer than 60 seconds.
       *
       * If the voltage cannot be measured, a value of null shall be returned.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 2.13.6.5
       */
      voltage: (0, import_Cluster.OptionalAttribute)(4, (0, import_TlvNullable.TlvNullable)(import_TlvNumber.TlvInt64), { default: null }),
      /**
       * This shall indicate the most recent ActiveCurrent reading in milliamps (mA).
       *
       * A positive value represents current flowing into the server, while a negative value represents current
       * flowing out of the server.
       *
       * The reporting interval of this attribute shall be manufacturer dependent. The server may choose to omit
       * publication of deltas considered not meaningful.
       *
       * The server shall NOT mark this attribute ready for report if the last time this was done was more
       * recently than 1 second ago.
       *
       * The server may delay marking this attribute ready for report for longer periods if needed, however the
       * server shall NOT delay marking this attribute as ready for report for longer than 60 seconds.
       *
       * If the current cannot be measured, a value of null shall be returned.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 2.13.6.6
       */
      activeCurrent: (0, import_Cluster.OptionalAttribute)(5, (0, import_TlvNullable.TlvNullable)(import_TlvNumber.TlvInt64), { default: null }),
      /**
       * This shall indicate the most recent ActivePower reading in milliwatts (mW). If the power cannot be
       * measured, a value of null shall be returned.
       *
       * A positive value represents power imported, while a negative value represents power exported.
       *
       * The reporting interval of this attribute shall be manufacturer dependent. The server may choose to omit
       * publication of deltas considered not meaningful.
       *
       * The server shall NOT mark this attribute ready for report if the last time this was done was more
       * recently than 1 second ago.
       *
       * The server may delay marking this attribute ready for report for longer periods if needed, however the
       * server shall NOT delay marking this attribute as ready for report for longer than 60 seconds.
       *
       * If the Polyphase Power feature is set, this value represents the combined active power imported or
       * exported.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 2.13.6.9
       */
      activePower: (0, import_Cluster.Attribute)(8, (0, import_TlvNullable.TlvNullable)(import_TlvNumber.TlvInt64))
    },
    events: {
      /**
       * If supported, this event shall be generated at the end of a measurement period. The start and end times
       * for measurement periods shall be determined by the server, and may represent overlapping periods.
       *
       * @see {@link MatterSpecification.v142.Cluster} § 2.13.7.1
       */
      measurementPeriodRanges: (0, import_Cluster.OptionalEvent)(0, import_Priority.Priority.Info, ElectricalPowerMeasurement2.TlvMeasurementPeriodRangesEvent)
    },
    /**
     * This metadata controls which ElectricalPowerMeasurementCluster elements matter.js activates for specific
     * feature combinations.
     */
    extensions: import_MutableCluster.MutableCluster.Extensions(
      { flags: { alternatingCurrent: true }, component: ElectricalPowerMeasurement2.AlternatingCurrentComponent },
      { flags: { harmonics: true }, component: ElectricalPowerMeasurement2.HarmonicsComponent },
      { flags: { powerQuality: true }, component: ElectricalPowerMeasurement2.PowerQualityComponent },
      { flags: { polyphasePower: true }, component: ElectricalPowerMeasurement2.PolyphasePowerComponent },
      { flags: { polyphasePower: true, alternatingCurrent: false }, component: false },
      { flags: { harmonics: true, alternatingCurrent: false }, component: false },
      { flags: { powerQuality: true, alternatingCurrent: false }, component: false },
      { flags: { directCurrent: false, alternatingCurrent: false }, component: false }
    )
  });
  ElectricalPowerMeasurement2.ClusterInstance = import_MutableCluster.MutableCluster.ExtensibleOnly(ElectricalPowerMeasurement2.Base);
  ElectricalPowerMeasurement2.Cluster = ElectricalPowerMeasurement2.ClusterInstance;
  const ALTC = { alternatingCurrent: true };
  const HARM = { harmonics: true };
  const PWRQ = { powerQuality: true };
  const POLY = { polyphasePower: true };
  ElectricalPowerMeasurement2.CompleteInstance = (0, import_MutableCluster.MutableCluster)({
    id: ElectricalPowerMeasurement2.Base.id,
    name: ElectricalPowerMeasurement2.Base.name,
    revision: ElectricalPowerMeasurement2.Base.revision,
    features: ElectricalPowerMeasurement2.Base.features,
    attributes: {
      ...ElectricalPowerMeasurement2.Base.attributes,
      reactiveCurrent: import_MutableCluster.MutableCluster.AsConditional(
        ElectricalPowerMeasurement2.AlternatingCurrentComponent.attributes.reactiveCurrent,
        { optionalIf: [ALTC] }
      ),
      apparentCurrent: import_MutableCluster.MutableCluster.AsConditional(
        ElectricalPowerMeasurement2.AlternatingCurrentComponent.attributes.apparentCurrent,
        { optionalIf: [ALTC] }
      ),
      reactivePower: import_MutableCluster.MutableCluster.AsConditional(
        ElectricalPowerMeasurement2.AlternatingCurrentComponent.attributes.reactivePower,
        { optionalIf: [ALTC] }
      ),
      apparentPower: import_MutableCluster.MutableCluster.AsConditional(
        ElectricalPowerMeasurement2.AlternatingCurrentComponent.attributes.apparentPower,
        { optionalIf: [ALTC] }
      ),
      rmsVoltage: import_MutableCluster.MutableCluster.AsConditional(
        ElectricalPowerMeasurement2.AlternatingCurrentComponent.attributes.rmsVoltage,
        { optionalIf: [ALTC] }
      ),
      rmsCurrent: import_MutableCluster.MutableCluster.AsConditional(
        ElectricalPowerMeasurement2.AlternatingCurrentComponent.attributes.rmsCurrent,
        { optionalIf: [ALTC] }
      ),
      rmsPower: import_MutableCluster.MutableCluster.AsConditional(
        ElectricalPowerMeasurement2.AlternatingCurrentComponent.attributes.rmsPower,
        { optionalIf: [ALTC] }
      ),
      frequency: import_MutableCluster.MutableCluster.AsConditional(
        ElectricalPowerMeasurement2.AlternatingCurrentComponent.attributes.frequency,
        { optionalIf: [ALTC] }
      ),
      harmonicCurrents: import_MutableCluster.MutableCluster.AsConditional(
        ElectricalPowerMeasurement2.HarmonicsComponent.attributes.harmonicCurrents,
        { mandatoryIf: [HARM] }
      ),
      harmonicPhases: import_MutableCluster.MutableCluster.AsConditional(
        ElectricalPowerMeasurement2.PowerQualityComponent.attributes.harmonicPhases,
        { mandatoryIf: [PWRQ] }
      ),
      powerFactor: import_MutableCluster.MutableCluster.AsConditional(
        ElectricalPowerMeasurement2.AlternatingCurrentComponent.attributes.powerFactor,
        { optionalIf: [ALTC] }
      ),
      neutralCurrent: import_MutableCluster.MutableCluster.AsConditional(
        ElectricalPowerMeasurement2.PolyphasePowerComponent.attributes.neutralCurrent,
        { optionalIf: [POLY] }
      )
    },
    events: ElectricalPowerMeasurement2.Base.events
  });
  ElectricalPowerMeasurement2.Complete = ElectricalPowerMeasurement2.CompleteInstance;
})(ElectricalPowerMeasurement || (ElectricalPowerMeasurement = {}));
const ElectricalPowerMeasurementCluster = ElectricalPowerMeasurement.Cluster;
import_ClusterRegistry.ClusterRegistry.register(ElectricalPowerMeasurement.Complete);
//# sourceMappingURL=electrical-power-measurement.js.map
