"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const XEUtils = require("xe-utils");
const log = require("./log.js");
const renderMap = {};
const renderer = {
  mixin(opts) {
    XEUtils.each(opts, (options, name) => renderer.add(name, options));
    return renderer;
  },
  get(name) {
    return renderMap[name] || null;
  },
  add(name, options) {
    if (name && options) {
      const renders = renderMap[name];
      if (renders) {
        XEUtils.each(options, (val, key) => {
          if (!XEUtils.eqNull(renders[key]) && renders[key] !== val) {
            log.log.warn("vxe.error.coverProp", [`Renderer.${name}`, key]);
          }
        });
        Object.assign(renders, options);
      } else {
        renderMap[name] = options;
      }
    }
    return renderer;
  },
  forEach(callback) {
    XEUtils.objectEach(renderMap, callback);
    return renderer;
  },
  delete(name) {
    delete renderMap[name];
    return renderer;
  }
};
exports.renderer = renderer;
