'use strict';

// src/features/gen-html-multiple/domain/scheduler-state.ts
var DEFAULT_GEN_HTML_MULTIPLE_CONCURRENCY = 1;
var MAX_GEN_HTML_MULTIPLE_CONCURRENCY = 6;
function normalizeDesiredConcurrency(value, fallback = DEFAULT_GEN_HTML_MULTIPLE_CONCURRENCY) {
  const parsed = Number(value);
  if (!Number.isFinite(parsed)) {
    return fallback;
  }
  return Math.max(1, Math.min(MAX_GEN_HTML_MULTIPLE_CONCURRENCY, Math.floor(parsed)));
}
function summarizeMultipleComponentStates(components) {
  const queueCount = components.filter((component) => component.status === "queued").length;
  const runningCount = components.filter((component) => component.status === "running" || component.status === "refreshing").length;
  const completedCount = components.filter((component) => component.status === "completed").length;
  const failedCount = components.filter((component) => component.status === "failed").length;
  const cancelledCount = components.filter((component) => component.status === "cancelled").length;
  return {
    cancelledCount,
    completedCount,
    failedCount,
    queueCount,
    runningCount
  };
}
function areAllComponentsSettled(components) {
  return components.length > 0 && components.every(
    (component) => component.status === "completed" || component.status === "failed" || component.status === "cancelled"
  );
}

exports.DEFAULT_GEN_HTML_MULTIPLE_CONCURRENCY = DEFAULT_GEN_HTML_MULTIPLE_CONCURRENCY;
exports.MAX_GEN_HTML_MULTIPLE_CONCURRENCY = MAX_GEN_HTML_MULTIPLE_CONCURRENCY;
exports.areAllComponentsSettled = areAllComponentsSettled;
exports.normalizeDesiredConcurrency = normalizeDesiredConcurrency;
exports.summarizeMultipleComponentStates = summarizeMultipleComponentStates;
