"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__, {
    getNewSideMenuSchema: function() {
        return getNewSideMenuSchema;
    }
});
function getNewSideMenuSchema(sideMenuSchema, searchMenuTitle) {
    const newSchema = flattenAndFilterJson(sideMenuSchema, searchMenuTitle);
    return newSchema;
}
function flattenAndFilterJson(data, targetTitle) {
    const { title, properties, ...rest } = data;
    const result = {
        title,
        ...rest,
        properties: {}
    };
    const traverse = (node)=>{
        if (!node) return;
        const isSubMenu = 'Menu.SubMenu' === node['x-component'];
        if (!isSubMenu) {
            if ('string' == typeof (null == node ? void 0 : node.title) && node.title.includes(targetTitle)) result.properties[node.name] = {
                ...node
            };
            return;
        }
        if (!node.properties) return;
        Object.values(node.properties).forEach((child)=>{
            const isSubMenu = 'Menu.SubMenu' === child['x-component'];
            if (isSubMenu) traverse(child);
            else {
                var _child_title;
                if (null == child ? void 0 : null === (_child_title = child.title) || void 0 === _child_title ? void 0 : _child_title.includes(targetTitle)) result.properties[child.name] = {
                    ...child
                };
            }
        });
    };
    traverse(data);
    return result;
}
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
});
