{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///proxy-storage.min.js","webpack:///webpack/bootstrap dbbc7ae164219c6cf697","webpack:///./src/utils.js","webpack:///./src/is-available.js","webpack:///./src/proxy-storage.js","webpack:///./src/web-storage.js","webpack:///./src/interceptors.js","webpack:///./src/proxy-mechanism.js","webpack:///./src/cookie-storage.js","webpack:///./src/format-metadata.js","webpack:///./src/expiration-date.js","webpack:///./src/memory-storage.js"],"names":["root","factory","exports","module","define","amd","this","modules","__webpack_require__","moduleId","installedModules","i","l","call","m","c","d","name","getter","o","Object","defineProperty","configurable","enumerable","get","n","__esModule","object","property","prototype","hasOwnProperty","p","s","isObject","value","toString","checkEmpty","key","Error","setProperty","obj","descriptor","writable","tryParse","parsed","JSON","parse","e","isAvailable","localStorage","cookieStorage","sessionStorage","memoryStorage","isStorageAvailable","storageType","storageObj","_webStorage","proxy","data","setItem","removeItem","storageAvailable","_isAvailable","webStorageSettings","default","configStorage","set","WebStorage","undefined","_webStorage2","storage","__storage__","keys","some","_classCallCheck","instance","Constructor","TypeError","copyKeys","forEach","_utils","fallback","msg","console","warn","_createClass","defineProperties","target","props","length","protoProps","staticProps","_interceptors","_interceptors2","_proxyMechanism","INSTANCES","BANNED_KEYS","cachedInstance","options","test","v","stringify","getItem","noParse","_this","clear","command","action","INTERCEPTORS","push","executeInterceptors","_len","arguments","args","Array","_key","shift","_typeof","reduce","val","transformed","concat","Symbol","iterator","constructor","_interopRequireDefault","_cookieStorage","_cookieStorage2","_memoryStorage","_memoryStorage2","window","findCookie","cookie","nameEQ","trim","indexOf","api","assign","path","$cookie","metadata","expires","Date","_expirationDate2","domain","secure","encodeURIComponent","_formatMetadata2","split","find","substring","decodeURIComponent","days","indexEQ","initialize","prop","index","_formatMetadata","_expirationDate","document","buildMetadataFor","formatMetadata","alterDate","opt","date","minutes","setMinutes","getMinutes","hours","setHours","getHours","setDate","getDate","months","setMonth","getMonth","years","setFullYear","getFullYear","buildExpiration","toUTCString","getStore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,GACZjD,EX8zBTpH,OAAOC,eAAenB,EAAS,cAC7BgC,OAAO,GAGT,IAAImF,GAA4B,kBAAXK,SAAoD,gBAApBA,QAAOC,SAAwB,SAAUnF,GAAO,aAAcA,IAAS,SAAUA,GAAO,MAAOA,IAAyB,kBAAXkF,SAAyBlF,EAAIoF,cAAgBF,QAAUlF,IAAQkF,OAAO7F,UAAY,eAAkBW,GAEtQtC,GAAQ8D,QWh3BgBZ,CA1CxB,IAAA4B,GAAAxE,EAAA","file":"proxy-storage.min.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"proxyStorage\"] = factory();\n\telse\n\t\troot[\"proxyStorage\"] = factory();\n})(this, function() {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition","(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"proxyStorage\"] = factory();\n\telse\n\t\troot[\"proxyStorage\"] = factory();\n})(this, function() {\nreturn /******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, {\n/******/ \t\t\t\tconfigurable: false,\n/******/ \t\t\t\tenumerable: true,\n/******/ \t\t\t\tget: getter\n/******/ \t\t\t});\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = 2);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.isObject = isObject;\nexports.checkEmpty = checkEmpty;\nexports.setProperty = setProperty;\nexports.tryParse = tryParse;\n/**\n * Determines whether a value is a plain object.\n *\n * @param  {any} value: the object to test\n * @return {boolean}\n */\nfunction isObject(value) {\n  return Object.prototype.toString.call(value) === '[object Object]';\n}\n\n/**\n * Validates if the key is not empty.\n * (null, undefined or empty string)\n *\n * @param  {string} key: keyname of an element in the storage mechanism\n * @return {void}\n */\nfunction checkEmpty(key) {\n  if (key == null || key === '') {\n    throw new Error('The key provided can not be empty');\n  }\n}\n\n/**\n * Creates a non-enumerable read-only property.\n *\n * @param  {object} obj: the object to add the property\n * @param  {string} name: the name of the property\n * @param  {any} value: the value of the property\n * @return {void}\n */\nfunction setProperty(obj, name, value) {\n  var descriptor = {\n    configurable: false,\n    enumerable: false,\n    writable: false\n  };\n  if (typeof value !== 'undefined') {\n    descriptor.value = value;\n  }\n  Object.defineProperty(obj, name, descriptor);\n}\n\n/**\n * Try to parse a value from JSON.\n *\n * @param  {string} value: the value to parse\n * @return {any}\n */\nfunction tryParse(value) {\n  var parsed = void 0;\n  try {\n    parsed = JSON.parse(value);\n  } catch (e) {\n    parsed = value;\n  }\n  return parsed;\n}\n\n/***/ }),\n/* 1 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\n/**\n * @public\n *\n * Used to determine which storage mechanisms are available.\n *\n * @type {object}\n */\nvar isAvailable = exports.isAvailable = {\n  localStorage: false,\n  cookieStorage: false,\n  sessionStorage: false,\n  memoryStorage: true // fallback storage\n};\n\n/***/ }),\n/* 2 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.isAvailable = exports.configStorage = exports.WebStorage = exports.default = undefined;\n\nvar _webStorage = __webpack_require__(3);\n\nvar _webStorage2 = _interopRequireDefault(_webStorage);\n\nvar _isAvailable = __webpack_require__(1);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n/**\n * @public\n *\n * Current storage mechanism.\n *\n * @type {object}\n */\n/**\n * This library uses an adapter that implements the Web Storage interface,\n * which is very useful to deal with the lack of compatibility between\n * document.cookie and localStorage and sessionStorage.\n *\n * It also provides a memoryStorage fallback that stores the data in memory\n * when all of above mechanisms are not available.\n *\n * Author: David Rivera\n * Github: https://github.com/jherax\n * License: \"MIT\"\n *\n * You can fork this project on github:\n * https://github.com/jherax/proxy-storage.git\n */\n\nvar storage = null;\n\n/**\n * @public\n *\n * Get/Set the storage mechanism to use by default.\n *\n * @type {object}\n */\nvar configStorage = {\n  get: function get() {\n    return storage.__storage__;\n  },\n\n\n  /**\n   * Sets the storage mechanism to use by default.\n   *\n   * @param  {string} storageType: it can be \"localStorage\", \"sessionStorage\", \"cookieStorage\", or \"memoryStorage\"\n   * @return {void}\n   */\n  set: function set(storageType) {\n    exports.default = storage = new _webStorage2.default(storageType);\n  }\n};\n\n/**\n * @private\n *\n * Checks whether a storage mechanism is available.\n *\n * @param  {string} storageType: it can be \"localStorage\", \"sessionStorage\", \"cookieStorage\", or \"memoryStorage\"\n * @return {boolean}\n */\nfunction isStorageAvailable(storageType) {\n  var storageObj = _webStorage.proxy[storageType];\n  var data = '__proxy-storage__';\n  try {\n    storageObj.setItem(data, data);\n    storageObj.removeItem(data);\n  } catch (e) {\n    return false;\n  }\n  return true;\n}\n\n/**\n * @private\n *\n * Sets the first or default storage available.\n *\n * @param  {string} storageType: it can be \"localStorage\", \"sessionStorage\", \"cookieStorage\", or \"memoryStorage\"\n * @return {boolean}\n */\nfunction storageAvailable(storageType) {\n  if (_isAvailable.isAvailable[storageType]) {\n    _webStorage.webStorageSettings.default = storageType;\n    configStorage.set(storageType);\n  }\n  return _isAvailable.isAvailable[storageType];\n}\n\n/**\n * @private\n *\n * Initializes the module.\n *\n * @return {void}\n */\nfunction init() {\n  _isAvailable.isAvailable.localStorage = isStorageAvailable('localStorage');\n  _isAvailable.isAvailable.cookieStorage = isStorageAvailable('cookieStorage');\n  _isAvailable.isAvailable.sessionStorage = isStorageAvailable('sessionStorage');\n  _webStorage.webStorageSettings.isAvailable = _isAvailable.isAvailable;\n  // sets the default storage mechanism available\n  Object.keys(_isAvailable.isAvailable).some(storageAvailable);\n}\n\ninit();\n\n/**\n * @public API\n */\nexports.default = storage;\nexports.WebStorage = _webStorage2.default;\nexports.configStorage = configStorage;\nexports.isAvailable = _isAvailable.isAvailable;\n\n/***/ }),\n/* 3 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.proxy = exports.webStorageSettings = exports.default = undefined;\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nvar _interceptors = __webpack_require__(4);\n\nvar _interceptors2 = _interopRequireDefault(_interceptors);\n\nvar _utils = __webpack_require__(0);\n\nvar _isAvailable = __webpack_require__(1);\n\nvar _proxyMechanism = __webpack_require__(5);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n/**\n * @private\n *\n * Keeps WebStorage instances by type as singletons.\n *\n * @type {object}\n */\nvar INSTANCES = {};\n\n/**\n * @private\n *\n * Keys not allowed for cookies.\n *\n * @type {RegExp}\n */\nvar BANNED_KEYS = /^(?:expires|max-age|path|domain|secure)$/i;\n\n/**\n * @private\n *\n * Copies all existing keys in the storage.\n *\n * @param  {CookieStorage} instance: the object to where copy the keys\n * @param  {object} storage: the storage mechanism\n * @return {object}\n */\nfunction copyKeys(instance, storage) {\n  Object.keys(storage).forEach(function (key) {\n    instance[key] = (0, _utils.tryParse)(storage[key]);\n  });\n  return instance;\n}\n\n/**\n * @public\n *\n * Allows to validate if a storage mechanism is valid\n *\n * @type {object}\n */\nvar webStorageSettings = {\n  default: null,\n  isAvailable: _isAvailable.isAvailable\n};\n\n/**\n * @private\n *\n * Validates if the storage mechanism is available and can be used safely.\n *\n * @param  {string} storageType: it can be \"localStorage\", \"sessionStorage\", \"cookieStorage\", or \"memoryStorage\"\n * @return {string}\n */\nfunction storageAvailable(storageType) {\n  if (webStorageSettings.isAvailable[storageType]) return storageType;\n  var fallback = storageType === 'sessionStorage' ? 'memoryStorage' : webStorageSettings.default;\n  var msg = storageType + ' is not available. Falling back to ' + fallback;\n  console.warn(msg); // eslint-disable-line\n  return fallback;\n}\n\n/**\n * @public\n *\n * Implementation of the Web Storage interface.\n * It saves and retrieves values as JSON.\n *\n * @see\n * https://developer.mozilla.org/en-US/docs/Web/API/Storage\n *\n * @type {class}\n */\n\nvar WebStorage = function () {\n  /**\n   * Creates an instance of WebStorage.\n   *\n   * @param {string} storageType: it can be \"localStorage\", \"sessionStorage\", \"cookieStorage\", or \"memoryStorage\"\n   *\n   * @memberOf WebStorage\n   */\n  function WebStorage(storageType) {\n    _classCallCheck(this, WebStorage);\n\n    if (!Object.prototype.hasOwnProperty.call(_proxyMechanism.proxy, storageType)) {\n      throw new Error('Storage type \"' + storageType + '\" is not valid');\n    }\n    // gets the requested storage mechanism\n    var storage = _proxyMechanism.proxy[storageType];\n    // if the storage is not available, sets the default\n    storageType = storageAvailable(storageType);\n    // keeps only one instance by storageType (singleton)\n    var cachedInstance = INSTANCES[storageType];\n    if (cachedInstance) {\n      return copyKeys(cachedInstance, storage);\n    }\n    (0, _utils.setProperty)(this, '__storage__', storageType);\n    // copies all existing keys in the storage mechanism\n    INSTANCES[storageType] = copyKeys(this, storage);\n  }\n\n  /**\n   * Stores a value given a key name.\n   *\n   * @param  {string} key: keyname of the storage\n   * @param  {any} value: data to save in the storage\n   * @param  {object} options: additional options for cookieStorage\n   * @return {void}\n   *\n   * @memberOf WebStorage\n   */\n\n\n  _createClass(WebStorage, [{\n    key: 'setItem',\n    value: function setItem(key, value, options) {\n      (0, _utils.checkEmpty)(key);\n      var storageType = this.__storage__;\n      if (storageType === 'cookieStorage' && BANNED_KEYS.test(key)) {\n        throw new Error('The key is a reserved word, therefore not allowed');\n      }\n      var v = (0, _interceptors2.default)('setItem', key, value, options);\n      if (v !== undefined) value = v;\n      this[key] = value;\n      // prevents converting strings to JSON to avoid extra quotes\n      if (typeof value !== 'string') value = JSON.stringify(value);\n      _proxyMechanism.proxy[storageType].setItem(key, value, options);\n      // checks if the cookie was created, or delete it if the domain or path are not valid\n      if (storageType === 'cookieStorage' && _proxyMechanism.proxy[storageType].getItem(key) === null) {\n        delete this[key];\n      }\n    }\n\n    /**\n     * Retrieves a value by its key name.\n     *\n     * @param  {string} key: keyname of the storage\n     * @param  {boolean} noParse: if the value shoudn't be parsed with `JSON.parse`\n     * @return {void}\n     *\n     * @memberOf WebStorage\n     */\n\n  }, {\n    key: 'getItem',\n    value: function getItem(key, noParse) {\n      (0, _utils.checkEmpty)(key);\n      var value = _proxyMechanism.proxy[this.__storage__].getItem(key);\n      if (value == null) {\n        // null or undefined\n        delete this[key];\n        value = null;\n      } else {\n        if (noParse !== true) value = (0, _utils.tryParse)(value);\n        this[key] = value;\n      }\n      var v = (0, _interceptors2.default)('getItem', key, value);\n      if (v !== undefined) value = v;\n      return value;\n    }\n\n    /**\n     * Deletes a key from the storage.\n     *\n     * @param  {string} key: keyname of the storage\n     * @param  {object} options: additional options for cookieStorage\n     * @return {void}\n     *\n     * @memberOf WebStorage\n     */\n\n  }, {\n    key: 'removeItem',\n    value: function removeItem(key, options) {\n      (0, _utils.checkEmpty)(key);\n      (0, _interceptors2.default)('removeItem', key, options);\n      delete this[key];\n      _proxyMechanism.proxy[this.__storage__].removeItem(key, options);\n    }\n\n    /**\n     * Removes all keys from the storage.\n     *\n     * @return {void}\n     *\n     * @memberOf WebStorage\n     */\n\n  }, {\n    key: 'clear',\n    value: function clear() {\n      var _this = this;\n\n      (0, _interceptors2.default)('clear');\n      Object.keys(this).forEach(function (key) {\n        delete _this[key];\n      }, this);\n      _proxyMechanism.proxy[this.__storage__].clear();\n    }\n\n    /**\n     * Gets the number of data items stored in the Storage object.\n     *\n     * @readonly\n     *\n     * @memberOf WebStorage\n     */\n\n  }, {\n    key: 'length',\n    get: function get() {\n      return Object.keys(this).length;\n    }\n\n    /**\n     * Adds an interceptor to a WebStorage method.\n     *\n     * @param  {string} command: name of the API method to intercept\n     * @param  {function} action: callback executed when the API method is called\n     * @return {void}\n     *\n     * @memberOf WebStorage\n     */\n\n  }], [{\n    key: 'interceptors',\n    value: function interceptors(command, action) {\n      if (command in _interceptors.INTERCEPTORS && typeof action === 'function') {\n        _interceptors.INTERCEPTORS[command].push(action);\n      }\n    }\n  }]);\n\n  return WebStorage;\n}();\n\n/**\n * @public API\n */\n\n\nexports.default = WebStorage;\nexports.webStorageSettings = webStorageSettings;\nexports.proxy = _proxyMechanism.proxy;\n\n/***/ }),\n/* 4 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; };\n\nexports.default = executeInterceptors;\n/**\n * Stores the interceptors for WebStorage methods.\n *\n * @type {object}\n */\nvar INTERCEPTORS = exports.INTERCEPTORS = {\n  setItem: [],\n  getItem: [],\n  removeItem: [],\n  clear: []\n};\n\n/**\n * Executes the interceptors for a WebStorage method and allows\n * the transformation in chain of the value passed through.\n *\n * @param  {string} command: name of the method to intercept\n * @return {any}\n */\nfunction executeInterceptors(command) {\n  for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n    args[_key - 1] = arguments[_key];\n  }\n\n  var key = args.shift();\n  var value = args.shift();\n  if (value && (typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object') {\n    // clone the object to prevent mutations\n    value = JSON.parse(JSON.stringify(value));\n  }\n  return INTERCEPTORS[command].reduce(function (val, action) {\n    var transformed = action.apply(undefined, [key, val].concat(args));\n    if (transformed == null) return val;\n    return transformed;\n  }, value);\n}\n\n/***/ }),\n/* 5 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.proxy = undefined;\n\nvar _cookieStorage = __webpack_require__(6);\n\nvar _cookieStorage2 = _interopRequireDefault(_cookieStorage);\n\nvar _memoryStorage = __webpack_require__(9);\n\nvar _memoryStorage2 = _interopRequireDefault(_memoryStorage);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n/**\n * @public\n *\n * Proxy for the storage mechanisms.\n * All members implement the Web Storage interface.\n *\n * @see\n * https://developer.mozilla.org/en-US/docs/Web/API/Storage\n *\n * @type {object}\n */\nvar proxy = exports.proxy = {\n  localStorage: window.localStorage,\n  sessionStorage: window.sessionStorage,\n  cookieStorage: (0, _cookieStorage2.default)(),\n  memoryStorage: (0, _memoryStorage2.default)()\n};\n\n/***/ }),\n/* 6 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\n\nvar _utils = __webpack_require__(0);\n\nvar _formatMetadata = __webpack_require__(7);\n\nvar _formatMetadata2 = _interopRequireDefault(_formatMetadata);\n\nvar _expirationDate = __webpack_require__(8);\n\nvar _expirationDate2 = _interopRequireDefault(_expirationDate);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n/**\n * @private\n *\n * Proxy for document.cookie\n *\n * @see\n * https://developer.mozilla.org/en-US/docs/Web/API/Document/cookie\n *\n * @type {object}\n */\nvar $cookie = {\n  get: function get() {\n    return document.cookie;\n  },\n  set: function set(value) {\n    document.cookie = value;\n  },\n  data: {} // metadata associated to the cookies\n};\n\n/**\n * @private\n *\n * Finds an element in the array.\n *\n * @param  {string} cookie: key=value\n * @return {boolean}\n */\nfunction findCookie(cookie) {\n  var nameEQ = this.toString();\n  // prevent leading spaces before the key\n  return cookie.trim().indexOf(nameEQ) === 0;\n}\n\n/**\n * @public\n *\n * Create, read, and delete elements from document.cookie,\n * and implements the Web Storage interface.\n *\n * @return {object}\n */\nfunction cookieStorage() {\n  var api = {\n    setItem: function setItem(key, value, options) {\n      options = Object.assign({ path: '/' }, options);\n      // keep track of the metadata associated to the cookie\n      $cookie.data[key] = { path: options.path };\n      var metadata = $cookie.data[key];\n      if ((0, _utils.isObject)(options.expires) || options.expires instanceof Date) {\n        metadata.expires = (0, _expirationDate2.default)(options.expires);\n      }\n      if (options.domain && typeof options.domain === 'string') {\n        metadata.domain = options.domain.trim();\n      }\n      if (options.secure === true) metadata.secure = true;\n      var cookie = key + '=' + encodeURIComponent(value) + (0, _formatMetadata2.default)(metadata);\n      // TODO: should encodeURIComponent(key) ?\n      $cookie.set(cookie);\n    },\n    getItem: function getItem(key) {\n      var value = null;\n      var nameEQ = key + '=';\n      var cookie = $cookie.get().split(';').find(findCookie, nameEQ);\n      if (cookie) {\n        // prevent leading spaces before the key name\n        value = cookie.trim().substring(nameEQ.length, cookie.length);\n        value = decodeURIComponent(value);\n      }\n      if (value === null) delete $cookie.data[key];\n      return value;\n    },\n\n\n    // TODO: Add the method getAll() to get all cookies\n    // https://github.com/jherax/proxy-storage/issues/6\n\n    removeItem: function removeItem(key, options) {\n      var metadata = Object.assign({}, $cookie.data[key], options);\n      metadata.expires = { days: -1 };\n      api.setItem(key, '', metadata);\n      delete $cookie.data[key];\n    },\n    clear: function clear() {\n      var key = void 0,\n          indexEQ = void 0;\n      $cookie.get().split(';').forEach(function (cookie) {\n        indexEQ = cookie.indexOf('=');\n        if (indexEQ > -1) {\n          key = cookie.substring(0, indexEQ);\n          // prevent leading spaces before the key\n          api.removeItem(key.trim());\n        }\n      });\n    }\n  };\n\n  return initialize(api);\n}\n\n/**\n * @private\n *\n * Copy the current items in the cookie storage.\n *\n * @param  {object} api: the storage mechanism to initialize\n * @return {object}\n */\nfunction initialize(api) {\n  // sets API members to read-only and non-enumerable\n  for (var prop in api) {\n    // eslint-disable-line\n    (0, _utils.setProperty)(api, prop);\n  }\n  // copies all existing elements in the storage\n  $cookie.get().split(';').forEach(function (cookie) {\n    var index = cookie.indexOf('=');\n    var key = cookie.substring(0, index).trim();\n    var value = cookie.substring(index + 1).trim();\n    if (key) api[key] = decodeURIComponent(value);\n  });\n  return api;\n}\n\n/**\n * @public API\n */\nexports.default = cookieStorage;\n\n/***/ }),\n/* 7 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.default = formatMetadata;\n/**\n * @private\n *\n * Builds the string for the cookie metadata.\n *\n * @param  {string} key: name of the metadata\n * @param  {object} data: metadata of the cookie\n * @return {string}\n */\nfunction buildMetadataFor(key, data) {\n  if (!data[key]) return '';\n  return ';' + key + '=' + data[key];\n}\n\n/**\n * Builds the whole string for the cookie metadata.\n *\n * @param  {object} data: metadata of the cookie\n * @return {string}\n */\nfunction formatMetadata(data) {\n  var expires = buildMetadataFor('expires', data);\n  var domain = buildMetadataFor('domain', data);\n  var path = buildMetadataFor('path', data);\n  var secure = data.secure ? ';secure' : '';\n  return '' + expires + domain + path + secure;\n}\n\n/***/ }),\n/* 8 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.default = buildExpiration;\n/**\n * @private\n *\n * Adds or subtracts date portions to the given date and returns the new date.\n * @see https://gist.github.com/jherax/bbc43e479a492cc9cbfc7ccc20c53cd2\n *\n * @param  {object} options: It contains the date parts to add or remove, and can have the following properties:\n *         - {Date} date: if provided, this date will be affected, otherwise the current date will be used.\n *         - {number} minutes: minutes to add/subtract\n *         - {number} hours: hours to add/subtract\n *         - {number} days: days to add/subtract\n *         - {number} months: months to add/subtract\n *         - {number} years: years to add/subtract\n * @return {Date}\n */\nfunction alterDate() {\n  var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n  var opt = Object.assign({}, options);\n  var d = opt.date instanceof Date ? opt.date : new Date();\n  if (+opt.minutes) d.setMinutes(d.getMinutes() + opt.minutes);\n  if (+opt.hours) d.setHours(d.getHours() + opt.hours);\n  if (+opt.days) d.setDate(d.getDate() + opt.days);\n  if (+opt.months) d.setMonth(d.getMonth() + opt.months);\n  if (+opt.years) d.setFullYear(d.getFullYear() + opt.years);\n  return d;\n}\n\n/**\n * Builds the expiration for the cookie.\n *\n * @param  {Date|object} date: the expiration date\n * @return {string}\n */\nfunction buildExpiration(date) {\n  var expires = date instanceof Date ? alterDate({ date: date }) : alterDate(date);\n  return expires.toUTCString();\n}\n\n/***/ }),\n/* 9 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; };\n\nexports.default = memoryStorage;\n\nvar _utils = __webpack_require__(0);\n\n/**\n * @private\n *\n * Gets the hashtable-store from the current window.\n *\n * @return {object}\n */\nfunction getStoreFromWindow() {\n  var store = void 0;\n  try {\n    store = JSON.parse(window.self.name);\n  } catch (e) {\n    return {};\n  }\n  if (store && (typeof store === 'undefined' ? 'undefined' : _typeof(store)) === 'object') return store;\n  return {};\n}\n\n/**\n * @private\n *\n * Saves the hashtable-store in the current window.\n *\n * @param  {object} hashtable: {key,value} pairs stored in memoryStorage\n * @return {void}\n */\nfunction setStoreToWindow(hashtable) {\n  var store = JSON.stringify(hashtable);\n  window.self.name = store;\n}\n\n/**\n * @public\n *\n * Create, read, and delete elements from memory, and implements\n * the Web Storage interface. It also adds a hack to persist\n * the storage in the session for the current tab (browser).\n *\n * @return {object}\n */\nfunction memoryStorage() {\n  var hashtable = getStoreFromWindow();\n  var api = {\n    setItem: function setItem(key, value) {\n      hashtable[key] = value;\n      setStoreToWindow(hashtable);\n    },\n    getItem: function getItem(key) {\n      var value = hashtable[key];\n      return value === undefined ? null : value;\n    },\n    removeItem: function removeItem(key) {\n      delete hashtable[key];\n      setStoreToWindow(hashtable);\n    },\n    clear: function clear() {\n      Object.keys(hashtable).forEach(function (key) {\n        return delete hashtable[key];\n      });\n      setStoreToWindow(hashtable);\n    }\n  };\n\n  return initialize(api, hashtable);\n}\n\n/**\n * @private\n *\n * Copy the current items in the cookie storage.\n *\n * @param  {object} api: the storage mechanism to initialize\n * @param  {object} hashtable: store from the window tab\n * @return {object}\n */\nfunction initialize(api, hashtable) {\n  // sets API members to read-only and non-enumerable\n  for (var prop in api) {\n    // eslint-disable-line\n    (0, _utils.setProperty)(api, prop);\n  }\n  // copies all existing elements in the storage\n  Object.assign(api, hashtable);\n  return api;\n}\n\n/***/ })\n/******/ ]);\n});\n\n\n// WEBPACK FOOTER //\n// proxy-storage.min.js"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 2);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap dbbc7ae164219c6cf697","/**\n * Determines whether a value is a plain object.\n *\n * @param  {any} value: the object to test\n * @return {boolean}\n */\nexport function isObject(value) {\n  return Object.prototype.toString.call(value) === '[object Object]';\n}\n\n/**\n * Validates if the key is not empty.\n * (null, undefined or empty string)\n *\n * @param  {string} key: keyname of an element in the storage mechanism\n * @return {void}\n */\nexport function checkEmpty(key) {\n  if (key == null || key === '') {\n    throw new Error('The key provided can not be empty');\n  }\n}\n\n/**\n * Creates a non-enumerable read-only property.\n *\n * @param  {object} obj: the object to add the property\n * @param  {string} name: the name of the property\n * @param  {any} value: the value of the property\n * @return {void}\n */\nexport function setProperty(obj, name, value) {\n  const descriptor = {\n    configurable: false,\n    enumerable: false,\n    writable: false,\n  };\n  if (typeof value !== 'undefined') {\n    descriptor.value = value;\n  }\n  Object.defineProperty(obj, name, descriptor);\n}\n\n/**\n * Try to parse a value from JSON.\n *\n * @param  {string} value: the value to parse\n * @return {any}\n */\nexport function tryParse(value) {\n  let parsed;\n  try {\n    parsed = JSON.parse(value);\n  } catch (e) {\n    parsed = value;\n  }\n  return parsed;\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/utils.js","/**\n * @public\n *\n * Used to determine which storage mechanisms are available.\n *\n * @type {object}\n */\nexport const isAvailable = {\n  localStorage: false,\n  cookieStorage: false,\n  sessionStorage: false,\n  memoryStorage: true, // fallback storage\n};\n\n\n\n// WEBPACK FOOTER //\n// ./src/is-available.js","/**\n * This library uses an adapter that implements the Web Storage interface,\n * which is very useful to deal with the lack of compatibility between\n * document.cookie and localStorage and sessionStorage.\n *\n * It also provides a memoryStorage fallback that stores the data in memory\n * when all of above mechanisms are not available.\n *\n * Author: David Rivera\n * Github: https://github.com/jherax\n * License: \"MIT\"\n *\n * You can fork this project on github:\n * https://github.com/jherax/proxy-storage.git\n */\n\nimport WebStorage, {proxy, webStorageSettings} from './web-storage';\nimport {isAvailable} from './is-available';\n\n/**\n * @public\n *\n * Current storage mechanism.\n *\n * @type {object}\n */\nlet storage = null;\n\n/**\n * @public\n *\n * Get/Set the storage mechanism to use by default.\n *\n * @type {object}\n */\nconst configStorage = {\n  get() {\n    return storage.__storage__;\n  },\n\n  /**\n   * Sets the storage mechanism to use by default.\n   *\n   * @param  {string} storageType: it can be \"localStorage\", \"sessionStorage\", \"cookieStorage\", or \"memoryStorage\"\n   * @return {void}\n   */\n  set(storageType) {\n    storage = new WebStorage(storageType);\n  },\n};\n\n/**\n * @private\n *\n * Checks whether a storage mechanism is available.\n *\n * @param  {string} storageType: it can be \"localStorage\", \"sessionStorage\", \"cookieStorage\", or \"memoryStorage\"\n * @return {boolean}\n */\nfunction isStorageAvailable(storageType) {\n  const storageObj = proxy[storageType];\n  const data = '__proxy-storage__';\n  try {\n    storageObj.setItem(data, data);\n    storageObj.removeItem(data);\n  } catch (e) {\n    return false;\n  }\n  return true;\n}\n\n/**\n * @private\n *\n * Sets the first or default storage available.\n *\n * @param  {string} storageType: it can be \"localStorage\", \"sessionStorage\", \"cookieStorage\", or \"memoryStorage\"\n * @return {boolean}\n */\nfunction storageAvailable(storageType) {\n  if (isAvailable[storageType]) {\n    webStorageSettings.default = storageType;\n    configStorage.set(storageType);\n  }\n  return isAvailable[storageType];\n}\n\n/**\n * @private\n *\n * Initializes the module.\n *\n * @return {void}\n */\nfunction init() {\n  isAvailable.localStorage = isStorageAvailable('localStorage');\n  isAvailable.cookieStorage = isStorageAvailable('cookieStorage');\n  isAvailable.sessionStorage = isStorageAvailable('sessionStorage');\n  webStorageSettings.isAvailable = isAvailable;\n  // sets the default storage mechanism available\n  Object.keys(isAvailable).some(storageAvailable);\n}\n\ninit();\n\n/**\n * @public API\n */\nexport {storage as default, WebStorage, configStorage, isAvailable};\n\n\n\n// WEBPACK FOOTER //\n// ./src/proxy-storage.js","import executeInterceptors, {INTERCEPTORS} from './interceptors';\nimport {setProperty, checkEmpty, tryParse} from './utils';\nimport {isAvailable} from './is-available';\nimport {proxy} from './proxy-mechanism';\n\n/**\n * @private\n *\n * Keeps WebStorage instances by type as singletons.\n *\n * @type {object}\n */\nconst INSTANCES = {};\n\n/**\n * @private\n *\n * Keys not allowed for cookies.\n *\n * @type {RegExp}\n */\nconst BANNED_KEYS = /^(?:expires|max-age|path|domain|secure)$/i;\n\n/**\n * @private\n *\n * Copies all existing keys in the storage.\n *\n * @param  {CookieStorage} instance: the object to where copy the keys\n * @param  {object} storage: the storage mechanism\n * @return {object}\n */\nfunction copyKeys(instance, storage) {\n  Object.keys(storage).forEach((key) => {\n    instance[key] = tryParse(storage[key]);\n  });\n  return instance;\n}\n\n/**\n * @public\n *\n * Allows to validate if a storage mechanism is valid\n *\n * @type {object}\n */\nconst webStorageSettings = {\n  default: null,\n  isAvailable,\n};\n\n/**\n * @private\n *\n * Validates if the storage mechanism is available and can be used safely.\n *\n * @param  {string} storageType: it can be \"localStorage\", \"sessionStorage\", \"cookieStorage\", or \"memoryStorage\"\n * @return {string}\n */\nfunction storageAvailable(storageType) {\n  if (webStorageSettings.isAvailable[storageType]) return storageType;\n  const fallback =\n    storageType === 'sessionStorage' ? 'memoryStorage' : webStorageSettings.default;\n  const msg = `${storageType} is not available. Falling back to ${fallback}`;\n  console.warn(msg); // eslint-disable-line\n  return fallback;\n}\n\n/**\n * @public\n *\n * Implementation of the Web Storage interface.\n * It saves and retrieves values as JSON.\n *\n * @see\n * https://developer.mozilla.org/en-US/docs/Web/API/Storage\n *\n * @type {class}\n */\nclass WebStorage {\n  /**\n   * Creates an instance of WebStorage.\n   *\n   * @param {string} storageType: it can be \"localStorage\", \"sessionStorage\", \"cookieStorage\", or \"memoryStorage\"\n   *\n   * @memberOf WebStorage\n   */\n  constructor(storageType) {\n    if (!Object.prototype.hasOwnProperty.call(proxy, storageType)) {\n      throw new Error(`Storage type \"${storageType}\" is not valid`);\n    }\n    // gets the requested storage mechanism\n    const storage = proxy[storageType];\n    // if the storage is not available, sets the default\n    storageType = storageAvailable(storageType);\n    // keeps only one instance by storageType (singleton)\n    const cachedInstance = INSTANCES[storageType];\n    if (cachedInstance) {\n      return copyKeys(cachedInstance, storage);\n    }\n    setProperty(this, '__storage__', storageType);\n    // copies all existing keys in the storage mechanism\n    INSTANCES[storageType] = copyKeys(this, storage);\n  }\n\n  /**\n   * Stores a value given a key name.\n   *\n   * @param  {string} key: keyname of the storage\n   * @param  {any} value: data to save in the storage\n   * @param  {object} options: additional options for cookieStorage\n   * @return {void}\n   *\n   * @memberOf WebStorage\n   */\n  setItem(key, value, options) {\n    checkEmpty(key);\n    const storageType = this.__storage__;\n    if (storageType === 'cookieStorage' && BANNED_KEYS.test(key)) {\n      throw new Error('The key is a reserved word, therefore not allowed');\n    }\n    const v = executeInterceptors('setItem', key, value, options);\n    if (v !== undefined) value = v;\n    this[key] = value;\n    // prevents converting strings to JSON to avoid extra quotes\n    if (typeof value !== 'string') value = JSON.stringify(value);\n    proxy[storageType].setItem(key, value, options);\n    // checks if the cookie was created, or delete it if the domain or path are not valid\n    if (storageType === 'cookieStorage' && proxy[storageType].getItem(key) === null) {\n      delete this[key];\n    }\n  }\n\n  /**\n   * Retrieves a value by its key name.\n   *\n   * @param  {string} key: keyname of the storage\n   * @param  {boolean} noParse: if the value shoudn't be parsed with `JSON.parse`\n   * @return {void}\n   *\n   * @memberOf WebStorage\n   */\n  getItem(key, noParse) {\n    checkEmpty(key);\n    let value = proxy[this.__storage__].getItem(key);\n    if (value == null) { // null or undefined\n      delete this[key];\n      value = null;\n    } else {\n      if (noParse !== true) value = tryParse(value);\n      this[key] = value;\n    }\n    const v = executeInterceptors('getItem', key, value);\n    if (v !== undefined) value = v;\n    return value;\n  }\n\n  /**\n   * Deletes a key from the storage.\n   *\n   * @param  {string} key: keyname of the storage\n   * @param  {object} options: additional options for cookieStorage\n   * @return {void}\n   *\n   * @memberOf WebStorage\n   */\n  removeItem(key, options) {\n    checkEmpty(key);\n    executeInterceptors('removeItem', key, options);\n    delete this[key];\n    proxy[this.__storage__].removeItem(key, options);\n  }\n\n  /**\n   * Removes all keys from the storage.\n   *\n   * @return {void}\n   *\n   * @memberOf WebStorage\n   */\n  clear() {\n    executeInterceptors('clear');\n    Object.keys(this).forEach((key) => {\n      delete this[key];\n    }, this);\n    proxy[this.__storage__].clear();\n  }\n\n  /**\n   * Gets the number of data items stored in the Storage object.\n   *\n   * @readonly\n   *\n   * @memberOf WebStorage\n   */\n  get length() {\n    return Object.keys(this).length;\n  }\n\n  /**\n   * Adds an interceptor to a WebStorage method.\n   *\n   * @param  {string} command: name of the API method to intercept\n   * @param  {function} action: callback executed when the API method is called\n   * @return {void}\n   *\n   * @memberOf WebStorage\n   */\n  static interceptors(command, action) {\n    if (command in INTERCEPTORS && typeof action === 'function') {\n      INTERCEPTORS[command].push(action);\n    }\n  }\n}\n\n/**\n * @public API\n */\nexport {WebStorage as default, webStorageSettings, proxy};\n\n\n\n// WEBPACK FOOTER //\n// ./src/web-storage.js","/**\n * Stores the interceptors for WebStorage methods.\n *\n * @type {object}\n */\nexport const INTERCEPTORS = {\n  setItem: [],\n  getItem: [],\n  removeItem: [],\n  clear: [],\n};\n\n/**\n * Executes the interceptors for a WebStorage method and allows\n * the transformation in chain of the value passed through.\n *\n * @param  {string} command: name of the method to intercept\n * @return {any}\n */\nexport default function executeInterceptors(command, ...args) {\n  const key = args.shift();\n  let value = args.shift();\n  if (value && typeof value === 'object') {\n    // clone the object to prevent mutations\n    value = JSON.parse(JSON.stringify(value));\n  }\n  return INTERCEPTORS[command].reduce((val, action) => {\n    const transformed = action(key, val, ...args);\n    if (transformed == null) return val;\n    return transformed;\n  }, value);\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/interceptors.js","import cookieStorage from './cookie-storage';\nimport memoryStorage from './memory-storage';\n\n/**\n * @public\n *\n * Proxy for the storage mechanisms.\n * All members implement the Web Storage interface.\n *\n * @see\n * https://developer.mozilla.org/en-US/docs/Web/API/Storage\n *\n * @type {object}\n */\nexport const proxy = {\n  localStorage: window.localStorage,\n  sessionStorage: window.sessionStorage,\n  cookieStorage: cookieStorage(),\n  memoryStorage: memoryStorage(),\n};\n\n\n\n// WEBPACK FOOTER //\n// ./src/proxy-mechanism.js","import {isObject, setProperty} from './utils';\nimport formatMetadata from './format-metadata';\nimport buildExpiration from './expiration-date';\n\n/**\n * @private\n *\n * Proxy for document.cookie\n *\n * @see\n * https://developer.mozilla.org/en-US/docs/Web/API/Document/cookie\n *\n * @type {object}\n */\nconst $cookie = {\n  get: () => document.cookie,\n  set: (value) => {\n    document.cookie = value;\n  },\n  data: {}, // metadata associated to the cookies\n};\n\n/**\n * @private\n *\n * Finds an element in the array.\n *\n * @param  {string} cookie: key=value\n * @return {boolean}\n */\nfunction findCookie(cookie) {\n  const nameEQ = this.toString();\n  // prevent leading spaces before the key\n  return cookie.trim().indexOf(nameEQ) === 0;\n}\n\n/**\n * @public\n *\n * Create, read, and delete elements from document.cookie,\n * and implements the Web Storage interface.\n *\n * @return {object}\n */\nfunction cookieStorage() {\n  const api = {\n\n    setItem(key, value, options) {\n      options = Object.assign({path: '/'}, options);\n      // keep track of the metadata associated to the cookie\n      $cookie.data[key] = {path: options.path};\n      const metadata = $cookie.data[key];\n      if (isObject(options.expires) || options.expires instanceof Date) {\n        metadata.expires = buildExpiration(options.expires);\n      }\n      if (options.domain && typeof options.domain === 'string') {\n        metadata.domain = options.domain.trim();\n      }\n      if (options.secure === true) metadata.secure = true;\n      const cookie = `${key}=${encodeURIComponent(value)}${formatMetadata(metadata)}`;\n      // TODO: should encodeURIComponent(key) ?\n      $cookie.set(cookie);\n    },\n\n    getItem(key) {\n      let value = null;\n      const nameEQ = `${key}=`;\n      const cookie = $cookie.get().split(';').find(findCookie, nameEQ);\n      if (cookie) {\n        // prevent leading spaces before the key name\n        value = cookie.trim().substring(nameEQ.length, cookie.length);\n        value = decodeURIComponent(value);\n      }\n      if (value === null) delete $cookie.data[key];\n      return value;\n    },\n\n    // TODO: Add the method getAll() to get all cookies\n    // https://github.com/jherax/proxy-storage/issues/6\n\n    removeItem(key, options) {\n      const metadata = Object.assign({}, $cookie.data[key], options);\n      metadata.expires = {days: -1};\n      api.setItem(key, '', metadata);\n      delete $cookie.data[key];\n    },\n\n    clear() {\n      let key, indexEQ;\n      $cookie.get().split(';').forEach((cookie) => {\n        indexEQ = cookie.indexOf('=');\n        if (indexEQ > -1) {\n          key = cookie.substring(0, indexEQ);\n          // prevent leading spaces before the key\n          api.removeItem(key.trim());\n        }\n      });\n    },\n  };\n\n  return initialize(api);\n}\n\n/**\n * @private\n *\n * Copy the current items in the cookie storage.\n *\n * @param  {object} api: the storage mechanism to initialize\n * @return {object}\n */\nfunction initialize(api) {\n  // sets API members to read-only and non-enumerable\n  for (let prop in api) { // eslint-disable-line\n    setProperty(api, prop);\n  }\n  // copies all existing elements in the storage\n  $cookie.get().split(';').forEach((cookie) => {\n    const index = cookie.indexOf('=');\n    const key = cookie.substring(0, index).trim();\n    const value = cookie.substring(index + 1).trim();\n    if (key) api[key] = decodeURIComponent(value);\n  });\n  return api;\n}\n\n/**\n * @public API\n */\nexport default cookieStorage;\n\n\n\n// WEBPACK FOOTER //\n// ./src/cookie-storage.js","/**\n * @private\n *\n * Builds the string for the cookie metadata.\n *\n * @param  {string} key: name of the metadata\n * @param  {object} data: metadata of the cookie\n * @return {string}\n */\nfunction buildMetadataFor(key, data) {\n  if (!data[key]) return '';\n  return `;${key}=${data[key]}`;\n}\n\n/**\n * Builds the whole string for the cookie metadata.\n *\n * @param  {object} data: metadata of the cookie\n * @return {string}\n */\nexport default function formatMetadata(data) {\n  const expires = buildMetadataFor('expires', data);\n  const domain = buildMetadataFor('domain', data);\n  const path = buildMetadataFor('path', data);\n  const secure = data.secure ? ';secure' : '';\n  return `${expires}${domain}${path}${secure}`;\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/format-metadata.js","/**\n * @private\n *\n * Adds or subtracts date portions to the given date and returns the new date.\n * @see https://gist.github.com/jherax/bbc43e479a492cc9cbfc7ccc20c53cd2\n *\n * @param  {object} options: It contains the date parts to add or remove, and can have the following properties:\n *         - {Date} date: if provided, this date will be affected, otherwise the current date will be used.\n *         - {number} minutes: minutes to add/subtract\n *         - {number} hours: hours to add/subtract\n *         - {number} days: days to add/subtract\n *         - {number} months: months to add/subtract\n *         - {number} years: years to add/subtract\n * @return {Date}\n */\nfunction alterDate(options = {}) {\n  const opt = Object.assign({}, options);\n  const d = opt.date instanceof Date ? opt.date : new Date();\n  if (+opt.minutes) d.setMinutes(d.getMinutes() + opt.minutes);\n  if (+opt.hours) d.setHours(d.getHours() + opt.hours);\n  if (+opt.days) d.setDate(d.getDate() + opt.days);\n  if (+opt.months) d.setMonth(d.getMonth() + opt.months);\n  if (+opt.years) d.setFullYear(d.getFullYear() + opt.years);\n  return d;\n}\n\n/**\n * Builds the expiration for the cookie.\n *\n * @param  {Date|object} date: the expiration date\n * @return {string}\n */\nexport default function buildExpiration(date) {\n  const expires = (date instanceof Date ?\n    alterDate({date}) :\n    alterDate(date));\n  return expires.toUTCString();\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/expiration-date.js","import {setProperty} from './utils';\n\n/**\n * @private\n *\n * Gets the hashtable-store from the current window.\n *\n * @return {object}\n */\nfunction getStoreFromWindow() {\n  let store;\n  try {\n    store = JSON.parse(window.self.name);\n  } catch (e) {\n    return {};\n  }\n  if (store && typeof store === 'object') return store;\n  return {};\n}\n\n/**\n * @private\n *\n * Saves the hashtable-store in the current window.\n *\n * @param  {object} hashtable: {key,value} pairs stored in memoryStorage\n * @return {void}\n */\nfunction setStoreToWindow(hashtable) {\n  const store = JSON.stringify(hashtable);\n  window.self.name = store;\n}\n\n/**\n * @public\n *\n * Create, read, and delete elements from memory, and implements\n * the Web Storage interface. It also adds a hack to persist\n * the storage in the session for the current tab (browser).\n *\n * @return {object}\n */\nexport default function memoryStorage() {\n  const hashtable = getStoreFromWindow();\n  const api = {\n\n    setItem(key, value) {\n      hashtable[key] = value;\n      setStoreToWindow(hashtable);\n    },\n\n    getItem(key) {\n      const value = hashtable[key];\n      return value === undefined ? null : value;\n    },\n\n    removeItem(key) {\n      delete hashtable[key];\n      setStoreToWindow(hashtable);\n    },\n\n    clear() {\n      Object.keys(hashtable).forEach(key => delete hashtable[key]);\n      setStoreToWindow(hashtable);\n    },\n  };\n\n  return initialize(api, hashtable);\n}\n\n/**\n * @private\n *\n * Copy the current items in the cookie storage.\n *\n * @param  {object} api: the storage mechanism to initialize\n * @param  {object} hashtable: store from the window tab\n * @return {object}\n */\nfunction initialize(api, hashtable) {\n  // sets API members to read-only and non-enumerable\n  for (let prop in api) { // eslint-disable-line\n    setProperty(api, prop);\n  }\n  // copies all existing elements in the storage\n  Object.assign(api, hashtable);\n  return api;\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/memory-storage.js"],"sourceRoot":""}