import { ItemLayout } from "../ItemLayout.mjs";
import { NodeWrapper } from "./index.mjs";
import { jsx } from "react/jsx-runtime";
import { isSameKeyPath } from "@intlayer/core";
import { NodeType } from "@intlayer/types";

//#region src/components/DictionaryEditor/NodeWrapper/ArrayWrapper.tsx
const ArrayWrapper = (props) => {
	const { keyPath, section, onFocusKeyPath, focusedKeyPath = [] } = props;
	return section.map((subSection, key) => {
		const newKeyPathEl = {
			key,
			type: NodeType.Array
		};
		const newKeyPath = [...keyPath, newKeyPathEl];
		return /* @__PURE__ */ jsx(ItemLayout, {
			level: keyPath.length,
			title: `${key}`,
			description: "",
			isSelected: isSameKeyPath(newKeyPath, focusedKeyPath),
			onClick: (e) => {
				e.stopPropagation();
				onFocusKeyPath(newKeyPath);
			},
			children: /* @__PURE__ */ jsx(NodeWrapper, {
				...props,
				keyPath: newKeyPath,
				section: subSection
			})
		}, JSON.stringify(subSection));
	});
};

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