"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.browserPrefixToKey = browserPrefixToKey; exports.browserPrefixToStyle = browserPrefixToStyle; exports.default = void 0; exports.getPrefix = getPrefix; var prefixes = ['Moz', 'Webkit', 'O', 'ms']; function getPrefix() /*: string*/ { var _window$document, _window$document$docu; var prop /*: string*/ = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'transform'; // Ensure we're running in an environment where there is actually a global // `window` obj if (typeof window === 'undefined') return ''; // If we're in a pseudo-browser server-side environment, this access // path may not exist, so bail out if it doesn't. var style = (_window$document = window.document) === null || _window$document === void 0 ? void 0 : (_window$document$docu = _window$document.documentElement) === null || _window$document$docu === void 0 ? void 0 : _window$document$docu.style; if (!style) return ''; if (prop in style) return ''; for (var i = 0; i < prefixes.length; i++) { if (browserPrefixToKey(prop, prefixes[i]) in style) return prefixes[i]; } return ''; } function browserPrefixToKey(prop /*: string*/ , prefix /*: string*/ ) /*: string*/ { return prefix ? "".concat(prefix).concat(kebabToTitleCase(prop)) : prop; } function browserPrefixToStyle(prop /*: string*/ , prefix /*: string*/ ) /*: string*/ { return prefix ? "-".concat(prefix.toLowerCase(), "-").concat(prop) : prop; } function kebabToTitleCase(str /*: string*/ ) /*: string*/ { var out = ''; var shouldCapitalize = true; for (var i = 0; i < str.length; i++) { if (shouldCapitalize) { out += str[i].toUpperCase(); shouldCapitalize = false; } else if (str[i] === '-') { shouldCapitalize = true; } else { out += str[i]; } } return out; } // Default export is the prefix itself, like 'Moz', 'Webkit', etc // Note that you may have to re-test for certain things; for instance, Chrome 50 // can handle unprefixed `transform`, but not unprefixed `user-select` var _default = (getPrefix() /*: string*/ ); exports.default = _default;