const require_runtime = require("../../../_virtual/_rolldown/runtime.js");
const require_useEngineContext = require("../../../hooks/useEngineContext.js");
const require_useVariables = require("../hooks/useVariables.js");
const require_index = require("../../pisellMenu/index.js");
const require_Basic = require("./Basic.js");
let react = require("react");
react = require_runtime.__toESM(react);
//#region src/components/dataSourceComponents/dataSourceMenu/index.tsx
/**
* @title: 数据源表单组件
* @description: 基于数据源动态生成表单，支持编辑、查看、禁用三种模式
*/
const DataSourceMenu = (props, ref) => {
	var _appHelper$utils, _appHelper$utils$getA;
	const { dataSource } = props;
	const { parseVariable } = require_useVariables.default();
	const { appHelper } = require_useEngineContext.default();
	const _dataSource = (0, react.useMemo)(() => {
		if (Array.isArray(dataSource)) return dataSource;
		if (props.__designMode === "design") return [{
			label: "菜单项1",
			key: "item-1",
			path: "/item-1"
		}, {
			label: "菜单项2",
			key: "item-2",
			path: "/item-2"
		}];
		if (typeof dataSource === "string") return parseVariable === null || parseVariable === void 0 ? void 0 : parseVariable(dataSource);
		return [];
	}, [dataSource]);
	if (props.__designMode === "design") return /* @__PURE__ */ react.default.createElement(require_index.default, props);
	const MenuProvider = appHelper === null || appHelper === void 0 || (_appHelper$utils = appHelper.utils) === null || _appHelper$utils === void 0 || (_appHelper$utils$getA = _appHelper$utils.getApp) === null || _appHelper$utils$getA === void 0 || (_appHelper$utils$getA = _appHelper$utils$getA.call(_appHelper$utils)) === null || _appHelper$utils$getA === void 0 || (_appHelper$utils$getA = _appHelper$utils$getA.menuManager) === null || _appHelper$utils$getA === void 0 ? void 0 : _appHelper$utils$getA.MenuProvider;
	console.log("MenuProvider11", appHelper);
	return /* @__PURE__ */ react.default.createElement(MenuProvider, { menus: _dataSource }, /* @__PURE__ */ react.default.createElement(require_Basic.default, props));
};
//#endregion
exports.default = DataSourceMenu;
