/**
 * 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.
 */

const require_runtime = require('../../../_virtual/_rolldown/runtime.js');
let react = require("react");

//#region src/global/js/hooks/useRetrieveFormTitles.js
/**
* Copyright IBM Corp. 2024
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/
const useRetrieveFormTitles = ({ formContext, formNumber, title }) => {
	(0, react.useEffect)(() => {
		if (formContext) formContext.setFormTitles((prev) => {
			if (prev[formNumber] !== title) {
				const clone = [...prev];
				clone[formNumber] = title;
				return clone;
			}
			return prev;
		});
	}, [
		title,
		formContext,
		formNumber
	]);
};

//#endregion
exports.useRetrieveFormTitles = useRetrieveFormTitles;