/**
 * @license
 * Copyright 2022-2026 Matter.js Authors
 * SPDX-License-Identifier: Apache-2.0
 */
import { merge as mergeObjects, Minutes, Seconds } from "@matter/general";
const complete = /* @__PURE__ */ Symbol("complete-timing-parameters");
function PeerTimingParameters(options) {
  if (options && options[complete]) {
    return options;
  }
  const result = { ...PeerTimingParameters.defaults };
  if (options) {
    for (const key of Object.keys(options)) {
      const value = options[key];
      if (value !== void 0) {
        result[key] = value;
      }
    }
  }
  result[complete] = true;
  return result;
}
((PeerTimingParameters2) => {
  function merge(base, overrides) {
    const result = mergeObjects(base, overrides);
    result[complete] = true;
    return result;
  }
  PeerTimingParameters2.merge = merge;
  PeerTimingParameters2.defaults = {
    defaultConnectionTimeout: Seconds(90),
    maxDelayBetweenInitialContactRetries: Minutes(2),
    // We assume 30s processing time on peer for single Sigma actions, so give one IP a bit of time
    // to have a chance before potentially adding a load with a second try
    delayBeforeNextAddress: Seconds(45),
    delayAfterNetworkError: Seconds(15),
    delayAfterPeerError: Minutes(5),
    delayAfterUnhandledError: Minutes(2),
    kickThrottleInterval: Seconds(3),
    kickMinRetransmissions: 2,
    kickRestartCooldown: {
      addressChange: Minutes(30),
      connect: Minutes(10)
    },
    addressChangeStabilizationDelay: Seconds(10),
    addressChangeProbeCooldown: {
      minimum: Minutes(2),
      maximum: Minutes(60)
    }
  };
})(PeerTimingParameters || (PeerTimingParameters = {}));
export {
  PeerTimingParameters
};
//# sourceMappingURL=PeerTimingParameters.js.map
