/**
 * Copyright IBM Corp. 2020, 2026
 *
 * This source code is licensed under the Apache-2.0 license found in the
 * LICENSE file in the root directory of this source tree.
 */

import { __toESM } from "../../_virtual/_rolldown/runtime.js";
import { require_classnames } from "../../node_modules/classnames/index.js";
import { pkg } from "../../settings.js";
import "../../global/js/utils/props-helper.js";
import React from "react";
import PropTypes from "prop-types";
import { Heading, ProgressIndicator, ProgressStep, Section } from "@carbon/react";
//#region src/components/CreateInfluencer/CreateInfluencer.tsx
/**
* Copyright IBM Corp. 2021, 2022
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/
var import_classnames = /* @__PURE__ */ __toESM(require_classnames());
const blockClass = `${pkg.prefix}--create-influencer`;
const componentName = "CreateInfluencer";
const CreateInfluencer = ({ className, currentStep, onClickStep, stepData, title }) => {
	const getNumberOfDynamicStepsBeforeCurrentStep = (array, key) => {
		const dynamicSteps = [];
		array.forEach((item, index) => {
			if (array[index]?.[key] === false && index <= currentStep - 1) dynamicSteps.push(item);
		});
		return dynamicSteps.length;
	};
	const renderProgressSteps = () => {
		const progressSteps = (stepData?.filter((item) => !item?.introStep))?.filter((item) => item?.shouldIncludeStep);
		const totalDynamicSteps = getNumberOfDynamicStepsBeforeCurrentStep(stepData, "shouldIncludeStep") || 0;
		return /* @__PURE__ */ React.createElement(Section, { className: `${blockClass}__left-nav` }, title && /* @__PURE__ */ React.createElement(Heading, { className: `${blockClass}__title` }, title), currentStep === 1 && stepData[0]?.introStep ? null : /* @__PURE__ */ React.createElement(ProgressIndicator, {
			currentIndex: stepData[0]?.introStep ? currentStep - totalDynamicSteps - 2 : currentStep - totalDynamicSteps - 1,
			spaceEqually: true,
			vertical: true,
			className: (0, import_classnames.default)(`${blockClass}__progress-indicator`),
			onChange: onClickStep
		}, progressSteps.map((step, stepIndex) => {
			return /* @__PURE__ */ React.createElement(ProgressStep, {
				label: step?.title,
				key: stepIndex,
				secondaryLabel: step.secondaryLabel || void 0,
				invalid: step.invalid
			});
		})));
	};
	return /* @__PURE__ */ React.createElement("div", { className: (0, import_classnames.default)(blockClass, className) }, renderProgressSteps());
};
CreateInfluencer.displayName = componentName;
CreateInfluencer.propTypes = {
	/**
	* Provide an optional class to be applied to the containing node.
	*/
	className: PropTypes.string,
	/**
	* Used to mark the current step on the ProgressIndicator component
	*/
	currentStep: PropTypes.number.isRequired,
	/**
	* onChange event for Progress Indicator
	*/
	onClickStep: PropTypes.func,
	/**
	* The step data that renders the progress items
	*/
	stepData: PropTypes.arrayOf(PropTypes.shape({
		introStep: PropTypes.bool,
		secondaryLabel: PropTypes.string,
		shouldIncludeStep: PropTypes.bool,
		title: PropTypes.node
	})),
	/**
	* The main title of the full page, displayed in the influencer area.
	*/
	title: PropTypes.string
};
//#endregion
export { CreateInfluencer };
