text: 'use strict';
  
  Object.defineProperty(exports, "__esModule", {
      value: true
  });
  
  var _map = require('babel-runtime/core-js/map');
  
  var _map2 = _interopRequireDefault(_map);
  
  var _weakMap = require('babel-runtime/core-js/weak-map');
  
  var _weakMap2 = _interopRequireDefault(_weakMap);
  
  var _lodash = require('lodash');
  
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  
  /**
   * @private
   * @type {RegExp}
   */
  const DEFAULT_INTERPOLATE = /\[([\w\s]+?)]/g;
  
  /**
   * @private
   * @type {WeakMap}
   */
  const INTERPOLATE = new _weakMap2.default();
  
  /**
   * @class
   * @extends {Map}
   */
  class ConfigPatternCache extends _map2.default {
      /**
       * @constructor
       * @param {RegExp} [interpolate=/\[([\w\s]+?)]/g]
       */
      constructor(interpolate = DEFAULT_INTERPOLATE) {
          super();
  
          this.interpolate = interpolate;
      }
  
      /**
       * @type {RegExp}
       */
      get interpolate() {
          return INTERPOLATE.get(this);
      }
  
      /**
       * @example
       * import {
       *   patternCache
       * } from 'webpack-config';
       *
       * patternCache.interpolate = /{([\w\s]+?)}/g;
       * @param {RegExp} value
       */
      set interpolate(value) {
          INTERPOLATE.set(this, value);
      }
  
      /**
       * @param {*} key
       * @returns {RegExp}
       */
      getOrSet(key) {
          if (!this.has(key)) {
              this.set(key, key);
          }
  
          return this.get(key);
      }
  
      /**
       * @override
       * @param {*} key
       * @param {String} value
       * @returns {RegExp}
       */
      set(key, value) {
          return super.set(key, this.compile(value));
      }
  
      /**
       * @param {String} value
       * @param {Object} options
       * @returns {String}
       */
      eval(value, options = {}) {
          const compiledTemplate = this.getOrSet(value);
  
          return compiledTemplate(options);
      }
  
      /**
       * @param {String} value
       * @returns {Function}
       */
      compile(value) {
          return (0, _lodash.template)(value, {
              interpolate: this.interpolate
          });
      }
  }
  
  exports.default = ConfigPatternCache;
  //# sourceMappingURL=ConfigPatternCache.js.map