{"dependencies":[{"name":"../utils/getBrowserInformation","loc":{"line":11,"column":37}},{"name":"../utils/getPrefixedKeyframes","loc":{"line":15,"column":36}},{"name":"../utils/capitalizeString","loc":{"line":19,"column":32}},{"name":"../utils/addNewValuesOnly","loc":{"line":23,"column":32}},{"name":"../utils/isObject","loc":{"line":27,"column":24}},{"name":"../utils/prefixValue","loc":{"line":31,"column":27}}],"generated":{"js":"'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\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\nexports.default = createPrefixer;\n\nvar _getBrowserInformation = require('../utils/getBrowserInformation');\n\nvar _getBrowserInformation2 = _interopRequireDefault(_getBrowserInformation);\n\nvar _getPrefixedKeyframes = require('../utils/getPrefixedKeyframes');\n\nvar _getPrefixedKeyframes2 = _interopRequireDefault(_getPrefixedKeyframes);\n\nvar _capitalizeString = require('../utils/capitalizeString');\n\nvar _capitalizeString2 = _interopRequireDefault(_capitalizeString);\n\nvar _addNewValuesOnly = require('../utils/addNewValuesOnly');\n\nvar _addNewValuesOnly2 = _interopRequireDefault(_addNewValuesOnly);\n\nvar _isObject = require('../utils/isObject');\n\nvar _isObject2 = _interopRequireDefault(_isObject);\n\nvar _prefixValue = require('../utils/prefixValue');\n\nvar _prefixValue2 = _interopRequireDefault(_prefixValue);\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\nfunction createPrefixer(_ref) {\n  var prefixMap = _ref.prefixMap,\n      plugins = _ref.plugins;\n  var fallback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function (style) {\n    return style;\n  };\n\n  return function () {\n    /**\n    * Instantiante a new prefixer\n    * @param {string} userAgent - userAgent to gather prefix information according to caniuse.com\n    * @param {string} keepUnprefixed - keeps unprefixed properties and values\n    */\n    function Prefixer() {\n      var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n      _classCallCheck(this, Prefixer);\n\n      var defaultUserAgent = typeof navigator !== 'undefined' ? navigator.userAgent : undefined;\n\n      this._userAgent = options.userAgent || defaultUserAgent;\n      this._keepUnprefixed = options.keepUnprefixed || false;\n\n      if (this._userAgent) {\n        this._browserInfo = (0, _getBrowserInformation2.default)(this._userAgent);\n      }\n\n      // Checks if the userAgent was resolved correctly\n      if (this._browserInfo && this._browserInfo.cssPrefix) {\n        this.prefixedKeyframes = (0, _getPrefixedKeyframes2.default)(this._browserInfo.browserName, this._browserInfo.browserVersion, this._browserInfo.cssPrefix);\n      } else {\n        this._useFallback = true;\n        return false;\n      }\n\n      var prefixData = this._browserInfo.browserName && prefixMap[this._browserInfo.browserName];\n      if (prefixData) {\n        this._requiresPrefix = {};\n\n        for (var property in prefixData) {\n          if (prefixData[property] >= this._browserInfo.browserVersion) {\n            this._requiresPrefix[property] = true;\n          }\n        }\n\n        this._hasPropsRequiringPrefix = Object.keys(this._requiresPrefix).length > 0;\n      } else {\n        this._useFallback = true;\n      }\n\n      this._metaData = {\n        browserVersion: this._browserInfo.browserVersion,\n        browserName: this._browserInfo.browserName,\n        cssPrefix: this._browserInfo.cssPrefix,\n        jsPrefix: this._browserInfo.jsPrefix,\n        keepUnprefixed: this._keepUnprefixed,\n        requiresPrefix: this._requiresPrefix\n      };\n    }\n\n    _createClass(Prefixer, [{\n      key: 'prefix',\n      value: function prefix(style) {\n        // use static prefixer as fallback if userAgent can not be resolved\n        if (this._useFallback) {\n          return fallback(style);\n        }\n\n        // only add prefixes if needed\n        if (!this._hasPropsRequiringPrefix) {\n          return style;\n        }\n\n        return this._prefixStyle(style);\n      }\n    }, {\n      key: '_prefixStyle',\n      value: function _prefixStyle(style) {\n        for (var property in style) {\n          var value = style[property];\n\n          // handle nested objects\n          if ((0, _isObject2.default)(value)) {\n            style[property] = this.prefix(value);\n            // handle array values\n          } else if (Array.isArray(value)) {\n            var combinedValue = [];\n\n            for (var i = 0, len = value.length; i < len; ++i) {\n              var processedValue = (0, _prefixValue2.default)(plugins, property, value[i], style, this._metaData);\n              (0, _addNewValuesOnly2.default)(combinedValue, processedValue || value[i]);\n            }\n\n            // only modify the value if it was touched\n            // by any plugin to prevent unnecessary mutations\n            if (combinedValue.length > 0) {\n              style[property] = combinedValue;\n            }\n          } else {\n            var _processedValue = (0, _prefixValue2.default)(plugins, property, value, style, this._metaData);\n\n            // only modify the value if it was touched\n            // by any plugin to prevent unnecessary mutations\n            if (_processedValue) {\n              style[property] = _processedValue;\n            }\n\n            // add prefixes to properties\n            if (this._requiresPrefix.hasOwnProperty(property)) {\n              style[this._browserInfo.jsPrefix + (0, _capitalizeString2.default)(property)] = value;\n              if (!this._keepUnprefixed) {\n                delete style[property];\n              }\n            }\n          }\n        }\n\n        return style;\n      }\n\n      /**\n      * Returns a prefixed version of the style object using all vendor prefixes\n      * @param {Object} styles - Style object that gets prefixed properties added\n      * @returns {Object} - Style object with prefixed properties and values\n      */\n\n    }], [{\n      key: 'prefixAll',\n      value: function prefixAll(styles) {\n        return fallback(styles);\n      }\n    }]);\n\n    return Prefixer;\n  }();\n}\nmodule.exports = exports['default'];"},"hash":"3a48b605824060a7fc97ee8c831b8af6"}