text: "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.PluginStore = void 0;
  const utils_1 = require("../utils");
  class PluginStore {
      constructor() {
          this.plugins = new Set();
      }
      add(plugin) {
          const plugins = [];
          utils_1.asArray(plugin).forEach(plugin => plugin && this.plugins.add(utils_1.append(plugins, plugin)));
          return () => {
              plugins.forEach(plugin => this.plugins.delete(plugin));
          };
      }
      exec(type, data, context) {
          let output = data;
          const contextual = Object.freeze(Object.create(context));
          for (const plugin of this.plugins) {
              if (plugin.type === type) {
                  output = plugin.action(output, contextual);
              }
          }
          return output;
      }
  }
  exports.PluginStore = PluginStore;
  //# sourceMappingURL=plugin-store.js.map