"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__, {
    applyMixins: function() {
        return applyMixins;
    },
    collectionTransform: function() {
        return collectionTransform;
    }
});
const collectionTransform = (collection, app)=>{
    const { rawTitle, title, fields = [], ...rest } = collection;
    return {
        ...rest,
        title: rawTitle ? title : app.i18n.t(title),
        rawTitle: rawTitle || title,
        fields: null == fields ? void 0 : fields.map((param)=>{
            let { uiSchema, ...field } = param;
            if (null == uiSchema ? void 0 : uiSchema.title) {
                const title = uiSchema.title;
                uiSchema.title = uiSchema.rawTitle ? title : app.i18n.t(title, {
                    ns: 'lm-collections'
                });
                uiSchema.rawTitle = uiSchema.rawTitle || title;
            }
            if (Array.isArray(null == uiSchema ? void 0 : uiSchema.enum)) uiSchema.enum = uiSchema.enum.map((item)=>({
                    ...item,
                    value: (null == item ? void 0 : item.value) === void 0 ? item : item.value,
                    label: item.rawLabel ? item.label : app.i18n.t(item.label, {
                        ns: 'lm-collections'
                    }),
                    rawLabel: item.rawLabel || item.label
                }));
            return {
                uiSchema,
                ...field
            };
        })
    };
};
function applyMixins(Cls, mixins, options, collectionManager) {
    const instance = new Cls(options, collectionManager);
    mixins.forEach((MixinClass)=>{
        const mixin = new MixinClass(options, collectionManager);
        Object.getOwnPropertyNames(mixin).forEach((key)=>{
            const descriptor = Object.getOwnPropertyDescriptor(mixin, key);
            if (descriptor) Object.defineProperty(instance, key, descriptor);
            else instance[key] = mixin[key];
        });
        Object.getOwnPropertyNames(MixinClass.prototype).forEach((key)=>{
            if ('constructor' !== key) instance.__proto__[key] = MixinClass.prototype[key];
        });
    });
    return instance;
}
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
});
