import { compositions } from "./schema-composition.js";
import { shouldRenderArrayItemComposition } from "./should-render-array-item-composition.js";
import { resolve } from "@scalar/workspace-store/resolve";
import { isArraySchema } from "@scalar/workspace-store/schemas/v3.1/strict/type-guards";
import { isDefined } from "@scalar/helpers/array/is-defined";
//#region src/components/Content/Schema/helpers/get-compositions-to-render.ts
/**
* Computes which compositions should be rendered and with which values
*
* @param value - The schema object to check for compositions
* @returns Array of compositions to render with their values
*/
var getCompositionsToRender = (value) => {
	if (!value) return [];
	return compositions.map((composition) => {
		if (shouldRenderArrayItemComposition(value, composition) && isArraySchema(value) && value.items) return {
			composition,
			value: resolve.schema(value.items)
		};
		if (value[composition]) {
			if (!(isArraySchema(value) && value.items && typeof value.items === "object" && composition in value.items)) return {
				composition,
				value: resolve.schema(value)
			};
		}
		return null;
	}).filter(isDefined);
};
//#endregion
export { getCompositionsToRender };

//# sourceMappingURL=get-compositions-to-render.js.map