text: import * as tslib_1 from "tslib";
  import { GlobalSettings } from './GlobalSettings';
  import { EventGroup } from './EventGroup';
  var CustomizationsGlobalKey = 'customizations';
  var NO_CUSTOMIZATIONS = { settings: {}, scopedSettings: {}, inCustomizerContext: false };
  var _allSettings = GlobalSettings.getValue(CustomizationsGlobalKey, {
      settings: {},
      scopedSettings: {},
      inCustomizerContext: false
  });
  var _events = new EventGroup(_allSettings);
  var Customizations = /** @class */ (function () {
      function Customizations() {
      }
      Customizations.reset = function () {
          _allSettings.settings = {};
          _allSettings.scopedSettings = {};
      };
      // tslint:disable-next-line:no-any
      Customizations.applySettings = function (settings) {
          _allSettings.settings = tslib_1.__assign({}, _allSettings.settings, settings);
          Customizations._raiseChange();
      };
      // tslint:disable-next-line:no-any
      Customizations.applyScopedSettings = function (scopeName, settings) {
          _allSettings.scopedSettings[scopeName] = tslib_1.__assign({}, _allSettings.scopedSettings[scopeName], settings);
          Customizations._raiseChange();
      };
      Customizations.getSettings = function (properties, scopeName, localSettings
      // tslint:disable-next-line:no-any
      ) {
          if (localSettings === void 0) { localSettings = NO_CUSTOMIZATIONS; }
          // tslint:disable-next-line:no-any
          var settings = {};
          var localScopedSettings = (scopeName && localSettings.scopedSettings[scopeName]) || {};
          var globalScopedSettings = (scopeName && _allSettings.scopedSettings[scopeName]) || {};
          for (var _i = 0, properties_1 = properties; _i < properties_1.length; _i++) {
              var property = properties_1[_i];
              settings[property] =
                  localScopedSettings[property] ||
                      localSettings.settings[property] ||
                      globalScopedSettings[property] ||
                      _allSettings.settings[property];
          }
          return settings;
      };
      Customizations.observe = function (onChange) {
          _events.on(_allSettings, 'change', onChange);
      };
      Customizations.unobserve = function (onChange) {
          _events.off(_allSettings, 'change', onChange);
      };
      Customizations._raiseChange = function () {
          _events.raise('change');
      };
      return Customizations;
  }());
  export { Customizations };
  //# sourceMappingURL=Customizations.js.map