"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__, {
    SchemaInitializerManager: function() {
        return SchemaInitializerManager;
    }
});
function _define_property(obj, key, value) {
    if (key in obj) Object.defineProperty(obj, key, {
        value: value,
        enumerable: true,
        configurable: true,
        writable: true
    });
    else obj[key] = value;
    return obj;
}
class SchemaInitializerManager {
    add() {
        for(var _len = arguments.length, schemaInitializerList = new Array(_len), _key = 0; _key < _len; _key++)schemaInitializerList[_key] = arguments[_key];
        schemaInitializerList.forEach((schemaInitializer)=>{
            this.schemaInitializers[schemaInitializer.name] = schemaInitializer;
            if (Array.isArray(this.actionList[schemaInitializer.name])) {
                this.actionList[schemaInitializer.name].forEach((item)=>{
                    schemaInitializer[item.type](item.itemName, item.data);
                });
                this.actionList[schemaInitializer.name] = void 0;
            }
        });
    }
    addItem(schemaInitializerName, itemName, data) {
        const schemaInitializer = this.get(schemaInitializerName);
        if (schemaInitializer) schemaInitializer.add(itemName, data);
        else {
            if (!this.actionList[schemaInitializerName]) this.actionList[schemaInitializerName] = [];
            this.actionList[schemaInitializerName].push({
                type: 'add',
                itemName: itemName,
                data
            });
        }
    }
    get(name) {
        return this.schemaInitializers[name];
    }
    getAll() {
        return this.schemaInitializers;
    }
    has(name) {
        return !!this.get(name);
    }
    remove(name) {
        delete this.schemaInitializers[name];
    }
    removeItem(schemaInitializerName, itemName) {
        const schemaInitializer = this.get(schemaInitializerName);
        if (schemaInitializer) schemaInitializer.remove(itemName);
        else {
            if (!this.actionList[schemaInitializerName]) this.actionList[schemaInitializerName] = [];
            this.actionList[schemaInitializerName].push({
                type: 'remove',
                itemName: itemName
            });
        }
    }
    constructor(_schemaInitializers = [], app){
        _define_property(this, "_schemaInitializers", void 0);
        _define_property(this, "app", void 0);
        _define_property(this, "schemaInitializers", void 0);
        _define_property(this, "actionList", void 0);
        this._schemaInitializers = _schemaInitializers;
        this.app = app;
        this.schemaInitializers = {};
        this.actionList = {};
        this.app = app;
        this.add(..._schemaInitializers);
    }
}
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
});
