//#region ../react-intlayer/dist/esm/@intlayer/core/dist/esm/interpreter/getCondition.mjs
/**
* Allow to pick a content based on a condition.
*
* Usage:
*
* ```ts
* const content = getCondition({
*  'true': 'The condition is validated',
*  'false': 'The condition is not validated',
* }, true);
* // 'The condition is validated'
* ```
*
* The last key provided will be used as the fallback value.
*
* ```ts
* const content = getCondition({
*  'false': 'The condition is not validated',
*  'true': 'The condition is validated',
* }, undefined);
* // 'The condition is validated'
*/
const getCondition = (conditionContent, state) => {
	const stateList = Object.keys(conditionContent);
	const fallbackState = stateList[stateList.length - 1];
	return conditionContent[`${state}`] ?? conditionContent.fallback ?? conditionContent[fallbackState];
};

//#endregion
export { getCondition };
//# sourceMappingURL=getCondition.mjs.map