/**
 * DevExtreme (cjs/__internal/ui/html_editor/utils/m_templates_storage.js)
 * Version: 24.1.7-build-24272-1937
 * Build date: Sat Sep 28 2024
 *
 * Copyright (c) 2012 - 2024 Developer Express Inc. ALL RIGHTS RESERVED
 * Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/
 */
"use strict";
Object.defineProperty(exports, "__esModule", {
    value: true
});
exports.default = void 0;
var _type = require("../../../../core/utils/type");
class TemplatesStorage {
    constructor() {
        this._storage = {}
    }
    set(_ref, value) {
        let {
            editorKey: editorKey,
            marker: marker
        } = _ref;
        var _a;
        (_a = this._storage)[editorKey] ?? (_a[editorKey] = {});
        this._storage[editorKey][marker] = value
    }
    get(_ref2) {
        var _Object$values$at, _this$_storage$editor;
        let {
            editorKey: editorKey,
            marker: marker
        } = _ref2;
        const isQuillFormatCall = !(0, _type.isDefined)(editorKey);
        return isQuillFormatCall ? null === (_Object$values$at = Object.values(this._storage).at(-1)) || void 0 === _Object$values$at ? void 0 : _Object$values$at[marker] : null === (_this$_storage$editor = this._storage[editorKey]) || void 0 === _this$_storage$editor ? void 0 : _this$_storage$editor[marker]
    }
    delete(_ref3) {
        let {
            editorKey: editorKey,
            marker: marker
        } = _ref3;
        if (!this._storage[editorKey]) {
            return
        }
        delete this._storage[editorKey][marker];
        if ((0, _type.isEmptyObject)(this._storage[editorKey])) {
            delete this._storage[editorKey]
        }
    }
}
exports.default = TemplatesStorage;
