"use strict";
var __webpack_require__ = {};
(()=>{
    __webpack_require__.d = function(exports1, definition) {
        for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
            enumerable: true,
            get: definition[key]
        });
    };
})();
(()=>{
    __webpack_require__.o = function(obj, prop) {
        return Object.prototype.hasOwnProperty.call(obj, prop);
    };
})();
(()=>{
    __webpack_require__.r = function(exports1) {
        if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
            value: 'Module'
        });
        Object.defineProperty(exports1, '__esModule', {
            value: true
        });
    };
})();
var __webpack_exports__ = {};
__webpack_require__.r(__webpack_exports__);
__webpack_require__.d(__webpack_exports__, {
    AdminMenu: ()=>AdminMenu
});
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
const schema_namespaceObject = require("@tachybase/schema");
const external_antd_namespaceObject = require("antd");
const external_react_i18next_namespaceObject = require("react-i18next");
const external_index_js_namespaceObject = require("../../index.js");
const external_index_js_namespaceObject_1 = require("../../../index.js");
const DragHandleMenu_js_namespaceObject = require("../../common/sortable-item/DragHandleMenu.js");
const external_AdminMenu_style_js_namespaceObject = require("./AdminMenu.style.js");
const AdminMenu = (props)=>{
    const { items, onClick } = props;
    const { styles } = (0, external_AdminMenu_style_js_namespaceObject.useStyles)();
    return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.Card, {
        className: styles.adminMenuStyle,
        children: null == items ? void 0 : items.map((item)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(AdminMenuCard, {
                item: item,
                onClick: onClick
            }, item.key))
    });
};
const AdminMenuCard = (props)=>{
    const { item, onClick } = props;
    const { icon, field, Designer, schema } = (null == item ? void 0 : item.menu) || {};
    const { t } = (0, external_react_i18next_namespaceObject.useTranslation)();
    const { styles } = (0, external_AdminMenu_style_js_namespaceObject.useStyles)();
    const handleClick = ()=>onClick(item);
    return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.Card.Grid, {
        className: styles.adminMenuCardStyle,
        onClick: handleClick,
        children: item.menu ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(schema_namespaceObject.SchemaContext.Provider, {
            value: schema,
            children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(schema_namespaceObject.FieldContext.Provider, {
                value: field,
                children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_index_js_namespaceObject.SortableItem, {
                    className: "card-wrapper",
                    role: "button",
                    "aria-label": t(field.title),
                    removeParentsIfNoChildren: false,
                    overStyle: {
                        background: 'transparent'
                    },
                    children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(DragHandleMenu_js_namespaceObject.DragHandleMenu, {
                        className: "drag-handle-menu",
                        isAdminMenu: true,
                        children: [
                            /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
                                className: "field-link",
                                role: "button",
                                "aria-label": t(field.title),
                                title: t(field.title),
                                children: [
                                    /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
                                        className: "icon-wrapper",
                                        children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_index_js_namespaceObject_1.Icon, {
                                            type: null != icon ? icon : 'QuestionCircleOutlined'
                                        })
                                    }),
                                    /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
                                        className: "field-title",
                                        children: t(field.title)
                                    })
                                ]
                            }),
                            /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(Designer, {
                                isAdminMenu: true
                            })
                        ]
                    })
                })
            })
        }) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(jsx_runtime_namespaceObject.Fragment, {
            children: item.label
        })
    });
};
var __webpack_export_target__ = exports;
for(var __webpack_i__ in __webpack_exports__)__webpack_export_target__[__webpack_i__] = __webpack_exports__[__webpack_i__];
if (__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, '__esModule', {
    value: true
});
