diff --git a/plugins/woocommerce-admin/dist/app/index.js b/plugins/woocommerce-admin/dist/app/index.js index 3452aa55..4e265130 100644 --- a/plugins/woocommerce-admin/dist/app/index.js +++ b/plugins/woocommerce-admin/dist/app/index.js @@ -35,7 +35,7 @@ this["wc"] = this["wc"] || {}; this["wc"]["app"] = /******/ /******/ // object to store loaded CSS chunks /******/ var installedCssChunks = { -/******/ 24: 0 +/******/ 21: 0 /******/ } /******/ var isCssRtlEnabled = function() { /******/ return document.dir === 'rtl'; @@ -45,14 +45,14 @@ this["wc"] = this["wc"] || {}; this["wc"]["app"] = /******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched /******/ // Promise = chunk loading, 0 = chunk loaded /******/ var installedChunks = { -/******/ 24: 0 +/******/ 21: 0 /******/ }; /******/ /******/ /******/ /******/ // script path function /******/ function webpackJsonpScriptSrc(chunkId) { -/******/ return __webpack_require__.p + "chunks/" + ({"10":"activity-panels-help","11":"activity-panels-inbox","12":"analytics-report","13":"analytics-report-categories","14":"analytics-report-coupons","15":"analytics-report-customers","16":"analytics-report-downloads","17":"analytics-report-orders","18":"analytics-report-products","19":"analytics-report-revenue","20":"analytics-report-stock","21":"analytics-report-taxes","22":"analytics-report-variations","23":"analytics-settings","29":"customizable-dashboard","30":"dashboard","31":"dashboard-charts","34":"homescreen","36":"leaderboards","38":"marketing-overview","47":"profile-wizard","48":"store-alerts","49":"store-performance","50":"task-list","52":"wcpay-usage-modal"}[chunkId]||chunkId) + ".js" +/******/ return __webpack_require__.p + "chunks/" + ({"7":"activity-panels-help","8":"activity-panels-inbox","9":"analytics-report","10":"analytics-report-categories","11":"analytics-report-coupons","12":"analytics-report-customers","13":"analytics-report-downloads","14":"analytics-report-orders","15":"analytics-report-products","16":"analytics-report-revenue","17":"analytics-report-stock","18":"analytics-report-taxes","19":"analytics-report-variations","20":"analytics-settings","27":"customizable-dashboard","28":"dashboard","29":"dashboard-charts","32":"homescreen","34":"leaderboards","36":"marketing-overview","46":"profile-wizard","47":"store-alerts","48":"store-performance","49":"task-list","51":"wcpay-usage-modal"}[chunkId]||chunkId) + ".js" /******/ } /******/ /******/ function jsonpScriptSrc(chunkId) { @@ -95,7 +95,7 @@ this["wc"] = this["wc"] || {}; this["wc"]["app"] = /******/ /******/ /******/ // mini-css-extract-plugin CSS loading -/******/ var cssChunks = {"0":1,"6":1,"10":1,"11":1,"12":1,"17":1,"23":1,"30":1,"31":1,"34":1,"36":1,"38":1,"47":1,"48":1,"49":1}; +/******/ var cssChunks = {"0":1,"3":1,"4":1,"7":1,"9":1,"14":1,"20":1,"28":1,"29":1,"32":1,"34":1,"36":1,"46":1,"47":1,"48":1,"49":1}; /******/ if(installedCssChunks[chunkId]) promises.push(installedCssChunks[chunkId]); /******/ else if(installedCssChunks[chunkId] !== 0 && cssChunks[chunkId]) { /******/ promises.push(installedCssChunks[chunkId] = new Promise(function(resolve, reject) { @@ -259,17 +259,19 @@ this["wc"] = this["wc"] || {}; this["wc"]["app"] = /******/ /******/ /******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = 367); +/******/ return __webpack_require__(__webpack_require__.s = 294); /******/ }) /************************************************************************/ -/******/ ([ -/* 0 */ +/******/ ({ + +/***/ 0: /***/ (function(module, exports) { (function() { module.exports = this["wp"]["element"]; }()); /***/ }), -/* 1 */ + +/***/ 1: /***/ (function(module, exports, __webpack_require__) { /** @@ -282,3110 +284,3181 @@ this["wc"] = this["wc"] || {}; this["wc"]["app"] = if (false) { var throwOnDirectAccess, ReactIs; } else { // By explicitly using `prop-types` you are opting into new production behavior. // http://fb.me/prop-types-in-prod - module.exports = __webpack_require__(120)(); + module.exports = __webpack_require__(77)(); } /***/ }), -/* 2 */ -/***/ (function(module, exports) { - -(function() { module.exports = this["lodash"]; }()); -/***/ }), -/* 3 */ +/***/ 10: /***/ (function(module, exports) { -(function() { module.exports = this["wp"]["i18n"]; }()); +(function() { module.exports = this["React"]; }()); /***/ }), -/* 4 */ -/***/ (function(module, exports, __webpack_require__) { - -/*! - Copyright (c) 2017 Jed Watson. - Licensed under the MIT License (MIT), see - http://jedwatson.github.io/classnames -*/ -/* global define */ -(function () { - 'use strict'; - - var hasOwn = {}.hasOwnProperty; - - function classNames () { - var classes = []; - - for (var i = 0; i < arguments.length; i++) { - var arg = arguments[i]; - if (!arg) continue; - - var argType = typeof arg; +/***/ 11: +/***/ (function(module, exports) { - if (argType === 'string' || argType === 'number') { - classes.push(arg); - } else if (Array.isArray(arg) && arg.length) { - var inner = classNames.apply(null, arg); - if (inner) { - classes.push(inner); - } - } else if (argType === 'object') { - for (var key in arg) { - if (hasOwn.call(arg, key) && arg[key]) { - classes.push(key); - } - } - } - } +(function() { module.exports = this["wp"]["data"]; }()); - return classes.join(' '); - } +/***/ }), - if ( true && module.exports) { - classNames.default = classNames; - module.exports = classNames; - } else if (typeof define === 'function' && typeof define.amd === 'object' && define.amd) { - // register as 'classnames', consistent with npm package name - define('classnames', [], function () { - return classNames; - }); - } else { - window.classNames = classNames; - } -}()); +/***/ 111: +/***/ (function(module, exports) { +(function() { module.exports = this["wc"]["currency"]; }()); /***/ }), -/* 5 */ + +/***/ 12: /***/ (function(module, exports) { -function _defineProperty(obj, key, value) { - if (key in obj) { - Object.defineProperty(obj, key, { - value: value, - enumerable: true, - configurable: true, - writable: true - }); - } else { - obj[key] = value; +function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); } - - return obj; } -module.exports = _defineProperty; +module.exports = _classCallCheck; /***/ }), -/* 6 */ + +/***/ 121: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _defineProperty; }); -function _defineProperty(obj, key, value) { - if (key in obj) { - Object.defineProperty(obj, key, { - value: value, - enumerable: true, - configurable: true, - writable: true - }); - } else { - obj[key] = value; - } - return obj; -} +// EXPORTS +__webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ build_module_focus; }); -/***/ }), -/* 7 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { +// UNUSED EXPORTS: isHorizontalEdge, isVerticalEdge, getRectangleFromRange, computeCaretRect, placeCaretAtHorizontalEdge, placeCaretAtVerticalEdge, isTextField, isNumberInput, documentHasTextSelection, documentHasUncollapsedSelection, documentHasSelection, isEntirelySelected, getScrollContainer, getOffsetParent, replace, remove, insertAfter, unwrap, replaceTag, wrap, __unstableStripHTML, isEmpty, removeInvalidHTML, getPhrasingContentSchema, isPhrasingContent, isTextContent, getFilesFromDataTransfer -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _extends; }); -function _extends() { - _extends = Object.assign || function (target) { - for (var i = 1; i < arguments.length; i++) { - var source = arguments[i]; +// NAMESPACE OBJECT: ./node_modules/@wordpress/dom/build-module/focusable.js +var focusable_namespaceObject = {}; +__webpack_require__.r(focusable_namespaceObject); +__webpack_require__.d(focusable_namespaceObject, "find", function() { return find; }); - for (var key in source) { - if (Object.prototype.hasOwnProperty.call(source, key)) { - target[key] = source[key]; - } - } - } +// NAMESPACE OBJECT: ./node_modules/@wordpress/dom/build-module/tabbable.js +var tabbable_namespaceObject = {}; +__webpack_require__.r(tabbable_namespaceObject); +__webpack_require__.d(tabbable_namespaceObject, "isTabbableIndex", function() { return isTabbableIndex; }); +__webpack_require__.d(tabbable_namespaceObject, "find", function() { return tabbable_find; }); +__webpack_require__.d(tabbable_namespaceObject, "findPrevious", function() { return findPrevious; }); +__webpack_require__.d(tabbable_namespaceObject, "findNext", function() { return findNext; }); - return target; - }; +// CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/focusable.js +/** + * References: + * + * Focusable: + * - https://www.w3.org/TR/html5/editing.html#focus-management + * + * Sequential focus navigation: + * - https://www.w3.org/TR/html5/editing.html#sequential-focus-navigation-and-the-tabindex-attribute + * + * Disabled elements: + * - https://www.w3.org/TR/html5/disabled-elements.html#disabled-elements + * + * getClientRects algorithm (requiring layout box): + * - https://www.w3.org/TR/cssom-view-1/#extension-to-the-element-interface + * + * AREA elements associated with an IMG: + * - https://w3c.github.io/html/editing.html#data-model + */ +var SELECTOR = ['[tabindex]', 'a[href]', 'button:not([disabled])', 'input:not([type="hidden"]):not([disabled])', 'select:not([disabled])', 'textarea:not([disabled])', 'iframe', 'object', 'embed', 'area[href]', '[contenteditable]:not([contenteditable=false])'].join(','); +/** + * Returns true if the specified element is visible (i.e. neither display: none + * nor visibility: hidden). + * + * @param {Element} element DOM element to test. + * + * @return {boolean} Whether element is visible. + */ - return _extends.apply(this, arguments); +function isVisible(element) { + return element.offsetWidth > 0 || element.offsetHeight > 0 || element.getClientRects().length > 0; } +/** + * Returns true if the specified element should be skipped from focusable elements. + * For now it rather specific for `iframes` and if tabindex attribute is set to -1. + * + * @param {Element} element DOM element to test. + * + * @return {boolean} Whether element should be skipped from focusable elements. + */ -/***/ }), -/* 8 */ -/***/ (function(module, exports) { - -(function() { module.exports = this["React"]; }()); - -/***/ }), -/* 9 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _getPrototypeOf; }); -function _getPrototypeOf(o) { - _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { - return o.__proto__ || Object.getPrototypeOf(o); - }; - return _getPrototypeOf(o); +function skipFocus(element) { + return element.nodeName.toLowerCase() === 'iframe' && element.getAttribute('tabindex') === '-1'; } +/** + * Returns true if the specified area element is a valid focusable element, or + * false otherwise. Area is only focusable if within a map where a named map + * referenced by an image somewhere in the document. + * + * @param {Element} element DOM area element to test. + * + * @return {boolean} Whether area element is valid for focus. + */ -/***/ }), -/* 10 */ -/***/ (function(module, exports) { -function _getPrototypeOf(o) { - module.exports = _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { - return o.__proto__ || Object.getPrototypeOf(o); - }; - return _getPrototypeOf(o); -} +function isValidFocusableArea(element) { + var map = element.closest('map[name]'); -module.exports = _getPrototypeOf; + if (!map) { + return false; + } -/***/ }), -/* 11 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { + var img = element.ownerDocument.querySelector('img[usemap="#' + map.name + '"]'); + return !!img && isVisible(img); +} +/** + * Returns all focusable elements within a given context. + * + * @param {Element} context Element in which to search. + * + * @return {Element[]} Focusable elements. + */ -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _objectWithoutProperties; }); -/* harmony import */ var _babel_runtime_helpers_esm_objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(54); -function _objectWithoutProperties(source, excluded) { - if (source == null) return {}; - var target = Object(_babel_runtime_helpers_esm_objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(source, excluded); - var key, i; +function find(context) { + var elements = context.querySelectorAll(SELECTOR); + return Array.from(elements).filter(function (element) { + if (!isVisible(element) || skipFocus(element)) { + return false; + } - if (Object.getOwnPropertySymbols) { - var sourceSymbolKeys = Object.getOwnPropertySymbols(source); + var nodeName = element.nodeName; - for (i = 0; i < sourceSymbolKeys.length; i++) { - key = sourceSymbolKeys[i]; - if (excluded.indexOf(key) >= 0) continue; - if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; - target[key] = source[key]; + if ('AREA' === nodeName) { + return isValidFocusableArea(element); } - } - return target; + return true; + }); } +//# sourceMappingURL=focusable.js.map +// EXTERNAL MODULE: external "lodash" +var external_lodash_ = __webpack_require__(3); -/***/ }), -/* 12 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _assertThisInitialized; }); -function _assertThisInitialized(self) { - if (self === void 0) { - throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); - } +// CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/tabbable.js +/** + * External dependencies + */ - return self; -} +/** + * Internal dependencies + */ -/***/ }), -/* 13 */ -/***/ (function(module, exports) { -function _assertThisInitialized(self) { - if (self === void 0) { - throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); - } +/** + * Returns the tab index of the given element. In contrast with the tabIndex + * property, this normalizes the default (0) to avoid browser inconsistencies, + * operating under the assumption that this function is only ever called with a + * focusable node. + * + * @see https://bugzilla.mozilla.org/show_bug.cgi?id=1190261 + * + * @param {Element} element Element from which to retrieve. + * + * @return {?number} Tab index of element (default 0). + */ - return self; +function getTabIndex(element) { + var tabIndex = element.getAttribute('tabindex'); + return tabIndex === null ? 0 : parseInt(tabIndex, 10); } +/** + * Returns true if the specified element is tabbable, or false otherwise. + * + * @param {Element} element Element to test. + * + * @return {boolean} Whether element is tabbable. + */ -module.exports = _assertThisInitialized; -/***/ }), -/* 14 */ -/***/ (function(module, exports, __webpack_require__) { +function isTabbableIndex(element) { + return getTabIndex(element) !== -1; +} +/** + * Returns a stateful reducer function which constructs a filtered array of + * tabbable elements, where at most one radio input is selected for a given + * name, giving priority to checked input, falling back to the first + * encountered. + * + * @return {Function} Radio group collapse reducer. + */ -module.exports = __webpack_require__(119); +function createStatefulCollapseRadioGroup() { + var CHOSEN_RADIO_BY_NAME = {}; + return function collapseRadioGroup(result, element) { + var nodeName = element.nodeName, + type = element.type, + checked = element.checked, + name = element.name; // For all non-radio tabbables, construct to array by concatenating. + if (nodeName !== 'INPUT' || type !== 'radio' || !name) { + return result.concat(element); + } -/***/ }), -/* 15 */ -/***/ (function(module, exports) { + var hasChosen = CHOSEN_RADIO_BY_NAME.hasOwnProperty(name); // Omit by skipping concatenation if the radio element is not chosen. -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); - } -} + var isChosen = checked || !hasChosen; -function _createClass(Constructor, protoProps, staticProps) { - if (protoProps) _defineProperties(Constructor.prototype, protoProps); - if (staticProps) _defineProperties(Constructor, staticProps); - return Constructor; + if (!isChosen) { + return result; + } // At this point, if there had been a chosen element, the current + // element is checked and should take priority. Retroactively remove + // the element which had previously been considered the chosen one. + + + if (hasChosen) { + var hadChosenElement = CHOSEN_RADIO_BY_NAME[name]; + result = Object(external_lodash_["without"])(result, hadChosenElement); + } + + CHOSEN_RADIO_BY_NAME[name] = element; + return result.concat(element); + }; } +/** + * An array map callback, returning an object with the element value and its + * array index location as properties. This is used to emulate a proper stable + * sort where equal tabIndex should be left in order of their occurrence in the + * document. + * + * @param {Element} element Element. + * @param {number} index Array index of element. + * + * @return {Object} Mapped object with element, index. + */ -module.exports = _createClass; -/***/ }), -/* 16 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { +function mapElementToObjectTabbable(element, index) { + return { + element: element, + index: index + }; +} +/** + * An array map callback, returning an element of the given mapped object's + * element value. + * + * @param {Object} object Mapped object with index. + * + * @return {Element} Mapped object element. + */ -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _classCallCheck; }); -function _classCallCheck(instance, Constructor) { - if (!(instance instanceof Constructor)) { - throw new TypeError("Cannot call a class as a function"); - } + +function mapObjectTabbableToElement(object) { + return object.element; } +/** + * A sort comparator function used in comparing two objects of mapped elements. + * + * @see mapElementToObjectTabbable + * + * @param {Object} a First object to compare. + * @param {Object} b Second object to compare. + * + * @return {number} Comparator result. + */ -/***/ }), -/* 17 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _createClass; }); -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); +function compareObjectTabbables(a, b) { + var aTabIndex = getTabIndex(a.element); + var bTabIndex = getTabIndex(b.element); + + if (aTabIndex === bTabIndex) { + return a.index - b.index; } -} -function _createClass(Constructor, protoProps, staticProps) { - if (protoProps) _defineProperties(Constructor.prototype, protoProps); - if (staticProps) _defineProperties(Constructor, staticProps); - return Constructor; + return aTabIndex - bTabIndex; } +/** + * Givin focusable elements, filters out tabbable element. + * + * @param {Array} focusables Focusable elements to filter. + * + * @return {Array} Tabbable elements. + */ -/***/ }), -/* 18 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { -"use strict"; +function filterTabbable(focusables) { + return focusables.filter(isTabbableIndex).map(mapElementToObjectTabbable).sort(compareObjectTabbables).map(mapObjectTabbableToElement).reduce(createStatefulCollapseRadioGroup(), []); +} -// EXPORTS -__webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ _inherits; }); +function tabbable_find(context) { + return filterTabbable(find(context)); +} +/** + * Given a focusable element, find the preceding tabbable element. + * + * @param {Element} element The focusable element before which to look. Defaults + * to the active element. + */ -// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js -function _setPrototypeOf(o, p) { - _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { - o.__proto__ = p; - return o; - }; +function findPrevious(element) { + var focusables = find(element.ownerDocument.body); + var index = focusables.indexOf(element); // Remove all focusables after and including `element`. - return _setPrototypeOf(o, p); + focusables.length = index; + return Object(external_lodash_["last"])(filterTabbable(focusables)); } -// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/inherits.js +/** + * Given a focusable element, find the next tabbable element. + * + * @param {Element} element The focusable element after which to look. Defaults + * to the active element. + */ -function _inherits(subClass, superClass) { - if (typeof superClass !== "function" && superClass !== null) { - throw new TypeError("Super expression must either be null or a function"); - } +function findNext(element) { + var focusables = find(element.ownerDocument.body); + var index = focusables.indexOf(element); // Remove all focusables before and inside `element`. - subClass.prototype = Object.create(superClass && superClass.prototype, { - constructor: { - value: subClass, - writable: true, - configurable: true - } + var remaining = focusables.slice(index + 1).filter(function (node) { + return !element.contains(node); }); - if (superClass) _setPrototypeOf(subClass, superClass); + return Object(external_lodash_["first"])(filterTabbable(remaining)); } +//# sourceMappingURL=tabbable.js.map +// CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/index.js +/** + * Internal dependencies + */ -/***/ }), -/* 19 */ -/***/ (function(module, exports) { -(function() { module.exports = this["moment"]; }()); +/** + * Object grouping `focusable` and `tabbable` utils + * under the keys with the same name. + */ -/***/ }), -/* 20 */ -/***/ (function(module, exports) { +var build_module_focus = { + focusable: focusable_namespaceObject, + tabbable: tabbable_namespaceObject +}; -function _classCallCheck(instance, Constructor) { - if (!(instance instanceof Constructor)) { - throw new TypeError("Cannot call a class as a function"); - } -} -module.exports = _classCallCheck; + +//# sourceMappingURL=index.js.map /***/ }), -/* 21 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { + +/***/ 122: +/***/ (function(module, exports, __webpack_require__) { "use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _possibleConstructorReturn; }); -/* harmony import */ var _babel_runtime_helpers_esm_typeof__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(41); -/* harmony import */ var _babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(12); +var _extends=Object.assign||function(a){for(var c,b=1;b 1) { + for (var i = 1; i < arguments.length; i++) { + args[i - 1] = arguments[i]; + } } - } catch (err) { - _d = true; - _e = err; - } finally { - try { - if (!_n && _i["return"] != null) _i["return"](); - } finally { - if (_d) throw _e; + queue.push(new Item(fun, args)); + if (queue.length === 1 && !draining) { + runTimeout(drainQueue); } - } - - return _arr; -} -// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js -var unsupportedIterableToArray = __webpack_require__(59); +}; -// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/nonIterableRest.js -function _nonIterableRest() { - throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); +// v8 likes predictible objects +function Item(fun, array) { + this.fun = fun; + this.array = array; } -// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js +Item.prototype.run = function () { + this.fun.apply(null, this.array); +}; +process.title = 'browser'; +process.browser = true; +process.env = {}; +process.argv = []; +process.version = ''; // empty string to avoid regexp issues +process.versions = {}; +function noop() {} +process.on = noop; +process.addListener = noop; +process.once = noop; +process.off = noop; +process.removeListener = noop; +process.removeAllListeners = noop; +process.emit = noop; +process.prependListener = noop; +process.prependOnceListener = noop; +process.listeners = function (name) { return [] } -function _slicedToArray(arr, i) { - return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || Object(unsupportedIterableToArray["a" /* default */])(arr, i) || _nonIterableRest(); -} +process.binding = function (name) { + throw new Error('process.binding is not supported'); +}; -/***/ }), -/* 25 */ -/***/ (function(module, exports) { +process.cwd = function () { return '/' }; +process.chdir = function (dir) { + throw new Error('process.chdir is not supported'); +}; +process.umask = function() { return 0; }; -(function() { module.exports = this["wp"]["data"]; }()); /***/ }), -/* 26 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -// EXPORTS -__webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ _toConsumableArray; }); - -// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js -var arrayLikeToArray = __webpack_require__(49); +/***/ 126: +/***/ (function(module, exports, __webpack_require__) { -// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js +"use strict"; -function _arrayWithoutHoles(arr) { - if (Array.isArray(arr)) return Object(arrayLikeToArray["a" /* default */])(arr); -} -// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/iterableToArray.js -function _iterableToArray(iter) { - if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); -} -// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js -var unsupportedIterableToArray = __webpack_require__(59); -// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js -function _nonIterableSpread() { - throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); -} -// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js +if (true) { + module.exports = __webpack_require__(152); +} else {} +/***/ }), +/***/ 13: +/***/ (function(module, exports) { -function _toConsumableArray(arr) { - return _arrayWithoutHoles(arr) || _iterableToArray(arr) || Object(unsupportedIterableToArray["a" /* default */])(arr) || _nonIterableSpread(); +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); + } } -/***/ }), -/* 27 */ -/***/ (function(module, exports) { +function _createClass(Constructor, protoProps, staticProps) { + if (protoProps) _defineProperties(Constructor.prototype, protoProps); + if (staticProps) _defineProperties(Constructor, staticProps); + return Constructor; +} -(function() { module.exports = this["wp"]["dataControls"]; }()); +module.exports = _createClass; /***/ }), -/* 28 */ -/***/ (function(module, exports, __webpack_require__) { -var arrayWithoutHoles = __webpack_require__(93); - -var iterableToArray = __webpack_require__(94); - -var unsupportedIterableToArray = __webpack_require__(63); - -var nonIterableSpread = __webpack_require__(95); - -function _toConsumableArray(arr) { - return arrayWithoutHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableSpread(); -} - -module.exports = _toConsumableArray; - -/***/ }), -/* 29 */ -/***/ (function(module, exports) { - -(function() { module.exports = this["wc"]["navigation"]; }()); - -/***/ }), -/* 30 */ +/***/ 137: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return rgba; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return color; }); -/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2); -/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var tinycolor2__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(106); -/* harmony import */ var tinycolor2__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(tinycolor2__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _colors_values__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(86); +/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2); +/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _wordpress_hooks__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(43); +/* harmony import */ var _wordpress_hooks__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_hooks__WEBPACK_IMPORTED_MODULE_1__); +/* harmony import */ var _woocommerce_wc_admin_settings__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(25); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(0); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__); /** * External dependencies */ -/** - * Internal dependencies - */ +var manageStock = Object(_woocommerce_wc_admin_settings__WEBPACK_IMPORTED_MODULE_2__[/* getSetting */ "g"])('manageStock', 'no'); +var REPORTS_FILTER = 'woocommerce_admin_reports_list'; /** - * Generating a CSS complient rgba() color value. - * - * @param {string} hexValue The hex value to convert to rgba(). - * @param {number} alpha The alpha value for opacity. - * @return {string} The converted rgba() color value. - * - * @example - * rgba( '#000000', 0.5 ) - * // rgba(0, 0, 0, 0.5) + * Internal dependencies */ -function rgba() { - var hexValue = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ''; - var alpha = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1; +var RevenueReport = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["lazy"])(function () { + return Promise.all(/* import() | analytics-report-revenue */[__webpack_require__.e(0), __webpack_require__.e(16)]).then(__webpack_require__.bind(null, 486)); +}); +var ProductsReport = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["lazy"])(function () { + return Promise.all(/* import() | analytics-report-products */[__webpack_require__.e(0), __webpack_require__.e(3), __webpack_require__.e(15)]).then(__webpack_require__.bind(null, 482)); +}); +var VariationsReport = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["lazy"])(function () { + return Promise.all(/* import() | analytics-report-variations */[__webpack_require__.e(0), __webpack_require__.e(19)]).then(__webpack_require__.bind(null, 487)); +}); +var OrdersReport = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["lazy"])(function () { + return Promise.all(/* import() | analytics-report-orders */[__webpack_require__.e(0), __webpack_require__.e(5), __webpack_require__.e(14)]).then(__webpack_require__.bind(null, 488)); +}); +var CategoriesReport = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["lazy"])(function () { + return Promise.all(/* import() | analytics-report-categories */[__webpack_require__.e(0), __webpack_require__.e(3), __webpack_require__.e(10)]).then(__webpack_require__.bind(null, 484)); +}); +var CouponsReport = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["lazy"])(function () { + return Promise.all(/* import() | analytics-report-coupons */[__webpack_require__.e(0), __webpack_require__.e(11)]).then(__webpack_require__.bind(null, 489)); +}); +var TaxesReport = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["lazy"])(function () { + return Promise.all(/* import() | analytics-report-taxes */[__webpack_require__.e(0), __webpack_require__.e(18)]).then(__webpack_require__.bind(null, 490)); +}); +var DownloadsReport = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["lazy"])(function () { + return Promise.all(/* import() | analytics-report-downloads */[__webpack_require__.e(0), __webpack_require__.e(13)]).then(__webpack_require__.bind(null, 491)); +}); +var StockReport = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["lazy"])(function () { + return Promise.all(/* import() | analytics-report-stock */[__webpack_require__.e(0), __webpack_require__.e(17)]).then(__webpack_require__.bind(null, 483)); +}); +var CustomersReport = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["lazy"])(function () { + return Promise.all(/* import() | analytics-report-customers */[__webpack_require__.e(0), __webpack_require__.e(12)]).then(__webpack_require__.bind(null, 485)); +}); +/* harmony default export */ __webpack_exports__["a"] = (function () { + var reports = [{ + report: 'revenue', + title: Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__["__"])('Revenue', 'woocommerce-admin'), + component: RevenueReport, + navArgs: { + id: 'woocommerce-analytics-revenue' + } + }, { + report: 'products', + title: Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__["__"])('Products', 'woocommerce-admin'), + component: ProductsReport, + navArgs: { + id: 'woocommerce-analytics-products' + } + }, { + report: 'variations', + title: Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__["__"])('Variations', 'woocommerce-admin'), + component: VariationsReport, + navArgs: { + id: 'woocommerce-analytics-variations' + } + }, { + report: 'orders', + title: Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__["__"])('Orders', 'woocommerce-admin'), + component: OrdersReport, + navArgs: { + id: 'woocommerce-analytics-orders' + } + }, { + report: 'categories', + title: Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__["__"])('Categories', 'woocommerce-admin'), + component: CategoriesReport, + navArgs: { + id: 'woocommerce-analytics-categories' + } + }, { + report: 'coupons', + title: Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__["__"])('Coupons', 'woocommerce-admin'), + component: CouponsReport, + navArgs: { + id: 'woocommerce-analytics-coupons' + } + }, { + report: 'taxes', + title: Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__["__"])('Taxes', 'woocommerce-admin'), + component: TaxesReport, + navArgs: { + id: 'woocommerce-analytics-taxes' + } + }, manageStock === 'yes' ? { + report: 'stock', + title: Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__["__"])('Stock', 'woocommerce-admin'), + component: StockReport, + navArgs: { + id: 'woocommerce-analytics-stock' + } + } : null, { + report: 'customers', + title: Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__["__"])('Customers', 'woocommerce-admin'), + component: CustomersReport + }, { + report: 'downloads', + title: Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__["__"])('Downloads', 'woocommerce-admin'), + component: DownloadsReport, + navArgs: { + id: 'woocommerce-analytics-downloads' + } + }].filter(Boolean); + return Object(_wordpress_hooks__WEBPACK_IMPORTED_MODULE_1__["applyFilters"])(REPORTS_FILTER, reports); +}); - var _tinycolor$toRgb = tinycolor2__WEBPACK_IMPORTED_MODULE_1___default()(hexValue).toRgb(), - r = _tinycolor$toRgb.r, - g = _tinycolor$toRgb.g, - b = _tinycolor$toRgb.b; +/***/ }), - return "rgba(".concat(r, ", ").concat(g, ", ").concat(b, ", ").concat(alpha, ")"); -} -/** - * Retrieves a color from the color palette. - * - * @param {string} value The value to retrieve. - * @return {string} The color (or fallback, if not found). - * - * @example - * color( 'blue.wordpress.700' ) - * // #00669b - */ +/***/ 138: +/***/ (function(module, exports, __webpack_require__) { -function color(value) { - var fallbackColor = '#000'; - return Object(lodash__WEBPACK_IMPORTED_MODULE_0__["get"])(_colors_values__WEBPACK_IMPORTED_MODULE_2__[/* COLORS */ "a"], value, fallbackColor); -} -//# sourceMappingURL=colors.js.map +"use strict"; -/***/ }), -/* 31 */ -/***/ (function(module, exports, __webpack_require__) { -var arrayWithHoles = __webpack_require__(100); +var reactIs = __webpack_require__(126); -var iterableToArrayLimit = __webpack_require__(101); +/** + * Copyright 2015, Yahoo! Inc. + * Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms. + */ +var REACT_STATICS = { + childContextTypes: true, + contextType: true, + contextTypes: true, + defaultProps: true, + displayName: true, + getDefaultProps: true, + getDerivedStateFromError: true, + getDerivedStateFromProps: true, + mixins: true, + propTypes: true, + type: true +}; +var KNOWN_STATICS = { + name: true, + length: true, + prototype: true, + caller: true, + callee: true, + arguments: true, + arity: true +}; +var FORWARD_REF_STATICS = { + '$$typeof': true, + render: true, + defaultProps: true, + displayName: true, + propTypes: true +}; +var MEMO_STATICS = { + '$$typeof': true, + compare: true, + defaultProps: true, + displayName: true, + propTypes: true, + type: true +}; +var TYPE_STATICS = {}; +TYPE_STATICS[reactIs.ForwardRef] = FORWARD_REF_STATICS; +TYPE_STATICS[reactIs.Memo] = MEMO_STATICS; -var unsupportedIterableToArray = __webpack_require__(63); +function getStatics(component) { + // React v16.11 and below + if (reactIs.isMemo(component)) { + return MEMO_STATICS; + } // React v16.12 and above -var nonIterableRest = __webpack_require__(102); -function _slicedToArray(arr, i) { - return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || unsupportedIterableToArray(arr, i) || nonIterableRest(); + return TYPE_STATICS[component['$$typeof']] || REACT_STATICS; } -module.exports = _slicedToArray; - -/***/ }), -/* 32 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { +var defineProperty = Object.defineProperty; +var getOwnPropertyNames = Object.getOwnPropertyNames; +var getOwnPropertySymbols = Object.getOwnPropertySymbols; +var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; +var getPrototypeOf = Object.getPrototypeOf; +var objectPrototype = Object.prototype; +function hoistNonReactStatics(targetComponent, sourceComponent, blacklist) { + if (typeof sourceComponent !== 'string') { + // don't hoist over string (html) components + if (objectPrototype) { + var inheritedComponent = getPrototypeOf(sourceComponent); -"use strict"; + if (inheritedComponent && inheritedComponent !== objectPrototype) { + hoistNonReactStatics(targetComponent, inheritedComponent, blacklist); + } + } -// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/defineProperty.js -var defineProperty = __webpack_require__(5); -var defineProperty_default = /*#__PURE__*/__webpack_require__.n(defineProperty); + var keys = getOwnPropertyNames(sourceComponent); -// EXTERNAL MODULE: external "React" -var external_React_ = __webpack_require__(8); + if (getOwnPropertySymbols) { + keys = keys.concat(getOwnPropertySymbols(sourceComponent)); + } -// EXTERNAL MODULE: ./node_modules/@emotion/memoize/dist/memoize.browser.esm.js -var memoize_browser_esm = __webpack_require__(73); + var targetStatics = getStatics(targetComponent); + var sourceStatics = getStatics(sourceComponent); -// CONCATENATED MODULE: ./node_modules/@emotion/is-prop-valid/dist/is-prop-valid.browser.esm.js + for (var i = 0; i < keys.length; ++i) { + var key = keys[i]; + if (!KNOWN_STATICS[key] && !(blacklist && blacklist[key]) && !(sourceStatics && sourceStatics[key]) && !(targetStatics && targetStatics[key])) { + var descriptor = getOwnPropertyDescriptor(sourceComponent, key); -var reactPropsRegex = /^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|download|draggable|encType|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|inert|itemProp|itemScope|itemType|itemID|itemRef|on|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/; // https://esbench.com/bench/5bfee68a4cd7e6009ef61d23 + try { + // Avoid failures from read-only properties + defineProperty(targetComponent, key, descriptor); + } catch (e) {} + } + } + } -var index = Object(memoize_browser_esm["a" /* default */])(function (prop) { - return reactPropsRegex.test(prop) || prop.charCodeAt(0) === 111 - /* o */ - && prop.charCodeAt(1) === 110 - /* n */ - && prop.charCodeAt(2) < 91; + return targetComponent; } -/* Z+1 */ -); -/* harmony default export */ var is_prop_valid_browser_esm = (index); - -// EXTERNAL MODULE: ./node_modules/@emotion/core/dist/core.browser.esm.js + 6 modules -var core_browser_esm = __webpack_require__(48); +module.exports = hoistNonReactStatics; -// EXTERNAL MODULE: ./node_modules/@emotion/utils/dist/utils.browser.esm.js -var utils_browser_esm = __webpack_require__(38); -// EXTERNAL MODULE: ./node_modules/@emotion/serialize/dist/serialize.browser.esm.js + 2 modules -var serialize_browser_esm = __webpack_require__(37); +/***/ }), -// CONCATENATED MODULE: ./node_modules/@emotion/styled-base/dist/styled-base.browser.esm.js +/***/ 139: +/***/ (function(module, exports) { +(function() { module.exports = this["wp"]["plugins"]; }()); +/***/ }), +/***/ 14: +/***/ (function(module, exports, __webpack_require__) { +var setPrototypeOf = __webpack_require__(72); +function _inherits(subClass, superClass) { + if (typeof superClass !== "function" && superClass !== null) { + throw new TypeError("Super expression must either be null or a function"); + } + subClass.prototype = Object.create(superClass && superClass.prototype, { + constructor: { + value: subClass, + writable: true, + configurable: true + } + }); + if (superClass) setPrototypeOf(subClass, superClass); +} -var testOmitPropsOnStringTag = is_prop_valid_browser_esm; +module.exports = _inherits; -var testOmitPropsOnComponent = function testOmitPropsOnComponent(key) { - return key !== 'theme' && key !== 'innerRef'; -}; +/***/ }), -var getDefaultShouldForwardProp = function getDefaultShouldForwardProp(tag) { - return typeof tag === 'string' && // 96 is one less than the char code - // for "a" so this is checking that - // it's a lowercase character - tag.charCodeAt(0) > 96 ? testOmitPropsOnStringTag : testOmitPropsOnComponent; -}; +/***/ 140: +/***/ (function(module, __webpack_exports__, __webpack_require__) { -function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } +"use strict"; -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { defineProperty_default()(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } -var ILLEGAL_ESCAPE_SEQUENCE_ERROR = "You have illegal escape sequence in your template literal, most likely inside content's property value.\nBecause you write your CSS inside a JavaScript string you actually have to do double escaping, so for example \"content: '\\00d7';\" should become \"content: '\\\\00d7';\".\nYou can read more about this here:\nhttps://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#ES2018_revision_of_illegal_escape_sequences"; +// EXPORTS +__webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ speak; }); -var styled_base_browser_esm_createStyled = function createStyled(tag, options) { - if (false) {} +// UNUSED EXPORTS: setup - var identifierName; - var shouldForwardProp; - var targetClassName; - - if (options !== undefined) { - identifierName = options.label; - targetClassName = options.target; - shouldForwardProp = tag.__emotion_forwardProp && options.shouldForwardProp ? function (propName) { - return tag.__emotion_forwardProp(propName) && // $FlowFixMe - options.shouldForwardProp(propName); - } : options.shouldForwardProp; - } +// EXTERNAL MODULE: ./node_modules/@wordpress/dom-ready/build-module/index.js +var build_module = __webpack_require__(54); - var isReal = tag.__emotion_real === tag; - var baseTag = isReal && tag.__emotion_base || tag; +// EXTERNAL MODULE: external {"this":["wp","i18n"]} +var external_this_wp_i18n_ = __webpack_require__(2); - if (typeof shouldForwardProp !== 'function' && isReal) { - shouldForwardProp = tag.__emotion_forwardProp; - } +// CONCATENATED MODULE: ./node_modules/@wordpress/a11y/build-module/add-intro-text.js +/** + * WordPress dependencies + */ - var defaultShouldForwardProp = shouldForwardProp || getDefaultShouldForwardProp(baseTag); - var shouldUseAs = !defaultShouldForwardProp('as'); - return function () { - var args = arguments; - var styles = isReal && tag.__emotion_styles !== undefined ? tag.__emotion_styles.slice(0) : []; +/** + * Build the explanatory text to be placed before the aria live regions. + * + * This text is initially hidden from assistive technologies by using a `hidden` + * HTML attribute which is then removed once a message fills the aria-live regions. + * + * @return {HTMLParagraphElement} The explanatory text HTML element. + */ - if (identifierName !== undefined) { - styles.push("label:" + identifierName + ";"); - } +function addIntroText() { + var introText = document.createElement('p'); + introText.id = 'a11y-speak-intro-text'; + introText.className = 'a11y-speak-intro-text'; + introText.textContent = Object(external_this_wp_i18n_["__"])('Notifications'); + introText.setAttribute('style', 'position: absolute;' + 'margin: -1px;' + 'padding: 0;' + 'height: 1px;' + 'width: 1px;' + 'overflow: hidden;' + 'clip: rect(1px, 1px, 1px, 1px);' + '-webkit-clip-path: inset(50%);' + 'clip-path: inset(50%);' + 'border: 0;' + 'word-wrap: normal !important;'); + introText.setAttribute('hidden', 'hidden'); + var _document = document, + body = _document.body; - if (args[0] == null || args[0].raw === undefined) { - styles.push.apply(styles, args); - } else { - if (false) {} + if (body) { + body.appendChild(introText); + } - styles.push(args[0][0]); - var len = args.length; - var i = 1; + return introText; +} +//# sourceMappingURL=add-intro-text.js.map +// CONCATENATED MODULE: ./node_modules/@wordpress/a11y/build-module/add-container.js +/** + * Build the live regions markup. + * + * @param {string} [ariaLive] Value for the 'aria-live' attribute; default: 'polite'. + * + * @return {HTMLDivElement} The ARIA live region HTML element. + */ +function addContainer() { + var ariaLive = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'polite'; + var container = document.createElement('div'); + container.id = "a11y-speak-".concat(ariaLive); + container.className = 'a11y-speak-region'; + container.setAttribute('style', 'position: absolute;' + 'margin: -1px;' + 'padding: 0;' + 'height: 1px;' + 'width: 1px;' + 'overflow: hidden;' + 'clip: rect(1px, 1px, 1px, 1px);' + '-webkit-clip-path: inset(50%);' + 'clip-path: inset(50%);' + 'border: 0;' + 'word-wrap: normal !important;'); + container.setAttribute('aria-live', ariaLive); + container.setAttribute('aria-relevant', 'additions text'); + container.setAttribute('aria-atomic', 'true'); + var _document = document, + body = _document.body; - for (; i < len; i++) { - if (false) {} + if (body) { + body.appendChild(container); + } - styles.push(args[i], args[0][i]); - } - } // $FlowFixMe: we need to cast StatelessFunctionalComponent to our PrivateStyledComponent class + return container; +} +//# sourceMappingURL=add-container.js.map +// CONCATENATED MODULE: ./node_modules/@wordpress/a11y/build-module/clear.js +/** + * Clears the a11y-speak-region elements and hides the explanatory text. + */ +function clear() { + var regions = document.getElementsByClassName('a11y-speak-region'); + var introText = document.getElementById('a11y-speak-intro-text'); + for (var i = 0; i < regions.length; i++) { + regions[i].textContent = ''; + } // Make sure the explanatory text is hidden from assistive technologies. - var Styled = Object(core_browser_esm["c" /* withEmotionCache */])(function (props, context, ref) { - return Object(external_React_["createElement"])(core_browser_esm["a" /* ThemeContext */].Consumer, null, function (theme) { - var finalTag = shouldUseAs && props.as || baseTag; - var className = ''; - var classInterpolations = []; - var mergedProps = props; - if (props.theme == null) { - mergedProps = {}; + if (introText) { + introText.setAttribute('hidden', 'hidden'); + } +} +//# sourceMappingURL=clear.js.map +// CONCATENATED MODULE: ./node_modules/@wordpress/a11y/build-module/filter-message.js +var previousMessage = ''; +/** + * Filter the message to be announced to the screenreader. + * + * @param {string} message The message to be announced. + * + * @return {string} The filtered message. + */ - for (var key in props) { - mergedProps[key] = props[key]; - } +function filterMessage(message) { + /* + * Strip HTML tags (if any) from the message string. Ideally, messages should + * be simple strings, carefully crafted for specific use with A11ySpeak. + * When re-using already existing strings this will ensure simple HTML to be + * stripped out and replaced with a space. Browsers will collapse multiple + * spaces natively. + */ + message = message.replace(/<[^<>]+>/g, ' '); + /* + * Safari + VoiceOver don't announce repeated, identical strings. We use + * a `no-break space` to force them to think identical strings are different. + */ - mergedProps.theme = theme; - } + if (previousMessage === message) { + message += "\xA0"; + } - if (typeof props.className === 'string') { - className = Object(utils_browser_esm["a" /* getRegisteredStyles */])(context.registered, classInterpolations, props.className); - } else if (props.className != null) { - className = props.className + " "; - } + previousMessage = message; + return message; +} +//# sourceMappingURL=filter-message.js.map +// CONCATENATED MODULE: ./node_modules/@wordpress/a11y/build-module/index.js +/** + * WordPress dependencies + */ - var serialized = Object(serialize_browser_esm["a" /* serializeStyles */])(styles.concat(classInterpolations), context.registered, mergedProps); - var rules = Object(utils_browser_esm["b" /* insertStyles */])(context, serialized, typeof finalTag === 'string'); - className += context.key + "-" + serialized.name; +/** + * Internal dependencies + */ - if (targetClassName !== undefined) { - className += " " + targetClassName; - } - var finalShouldForwardProp = shouldUseAs && shouldForwardProp === undefined ? getDefaultShouldForwardProp(finalTag) : defaultShouldForwardProp; - var newProps = {}; - for (var _key in props) { - if (shouldUseAs && _key === 'as') continue; - if ( // $FlowFixMe - finalShouldForwardProp(_key)) { - newProps[_key] = props[_key]; - } - } - newProps.className = className; - newProps.ref = ref || props.innerRef; +/** + * Create the live regions. + */ - if (false) {} +function setup() { + var introText = document.getElementById('a11y-speak-intro-text'); + var containerAssertive = document.getElementById('a11y-speak-assertive'); + var containerPolite = document.getElementById('a11y-speak-polite'); - var ele = Object(external_React_["createElement"])(finalTag, newProps); + if (introText === null) { + addIntroText(); + } - return ele; - }); - }); - Styled.displayName = identifierName !== undefined ? identifierName : "Styled(" + (typeof baseTag === 'string' ? baseTag : baseTag.displayName || baseTag.name || 'Component') + ")"; - Styled.defaultProps = tag.defaultProps; - Styled.__emotion_real = Styled; - Styled.__emotion_base = baseTag; - Styled.__emotion_styles = styles; - Styled.__emotion_forwardProp = shouldForwardProp; - Object.defineProperty(Styled, 'toString', { - value: function value() { - if (targetClassName === undefined && "production" !== 'production') { - return 'NO_COMPONENT_SELECTOR'; - } // $FlowFixMe: coerce undefined to string - - - return "." + targetClassName; - } - }); + if (containerAssertive === null) { + addContainer('assertive'); + } - Styled.withComponent = function (nextTag, nextOptions) { - return createStyled(nextTag, nextOptions !== undefined ? _objectSpread({}, options || {}, {}, nextOptions) : options).apply(void 0, styles); - }; + if (containerPolite === null) { + addContainer('polite'); + } +} +/** + * Run setup on domReady. + */ - return Styled; - }; -}; +Object(build_module["a" /* default */])(setup); +/** + * Allows you to easily announce dynamic interface updates to screen readers using ARIA live regions. + * This module is inspired by the `speak` function in `wp-a11y.js`. + * + * @param {string} message The message to be announced by assistive technologies. + * @param {string} [ariaLive] The politeness level for aria-live; default: 'polite'. + * + * @example + * ```js + * import { speak } from '@wordpress/a11y'; + * + * // For polite messages that shouldn't interrupt what screen readers are currently announcing. + * speak( 'The message you want to send to the ARIA live region' ); + * + * // For assertive messages that should interrupt what screen readers are currently announcing. + * speak( 'The message you want to send to the ARIA live region', 'assertive' ); + * ``` + */ -/* harmony default export */ var styled_base_browser_esm = __webpack_exports__["a"] = (styled_base_browser_esm_createStyled); +function speak(message, ariaLive) { + /* + * Clear previous messages to allow repeated strings being read out and hide + * the explanatory text from assistive technologies. + */ + clear(); + message = filterMessage(message); + var introText = document.getElementById('a11y-speak-intro-text'); + var containerAssertive = document.getElementById('a11y-speak-assertive'); + var containerPolite = document.getElementById('a11y-speak-polite'); + if (containerAssertive && ariaLive === 'assertive') { + containerAssertive.textContent = message; + } else if (containerPolite) { + containerPolite.textContent = message; + } + /* + * Make the explanatory text available to assistive technologies by removing + * the 'hidden' HTML attribute. + */ -/***/ }), -/* 33 */ -/***/ (function(module, exports) { -(function() { module.exports = this["wp"]["url"]; }()); + if (introText) { + introText.removeAttribute('hidden'); + } +} +//# sourceMappingURL=index.js.map /***/ }), -/* 34 */ -/***/ (function(module, exports) { - -(function() { module.exports = this["wc"]["data"]; }()); -/***/ }), -/* 35 */ +/***/ 141: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ADMIN_URL; }); -/* unused harmony export COUNTRIES */ -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return CURRENCY; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return LOCALE; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return ORDER_STATUSES; }); -/* unused harmony export SITE_TITLE */ -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return WC_ASSET_URL; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return getSetting; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return setSetting; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return getAdminLink; }); -/* harmony import */ var _babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(52); -/* harmony import */ var _babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(3); -/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__); +// EXPORTS +__webpack_require__.d(__webpack_exports__, "c", function() { return /* binding */ layout_PrimaryLayout; }); +__webpack_require__.d(__webpack_exports__, "b", function() { return /* binding */ PageLayout; }); +__webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ EmbedLayout; }); -/** - * External dependencies - */ - // Remove mutable data from settings object to prevent access. Data stores should be used instead. +// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/extends.js +var helpers_extends = __webpack_require__(24); +var extends_default = /*#__PURE__*/__webpack_require__.n(helpers_extends); -var mutableSources = ['wcAdminSettings', 'preloadSettings']; -var settings = (typeof wcSettings === "undefined" ? "undefined" : _babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0___default()(wcSettings)) === 'object' ? wcSettings : {}; -var SOURCE = Object.keys(settings).reduce(function (source, key) { - if (!mutableSources.includes(key)) { - source[key] = settings[key]; - } +// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/objectWithoutProperties.js +var objectWithoutProperties = __webpack_require__(34); +var objectWithoutProperties_default = /*#__PURE__*/__webpack_require__.n(objectWithoutProperties); - return source; -}, {}); -var ADMIN_URL = SOURCE.adminUrl; -var COUNTRIES = SOURCE.countries; -var CURRENCY = SOURCE.currency; -var LOCALE = SOURCE.locale; -var ORDER_STATUSES = SOURCE.orderStatuses; -var SITE_TITLE = SOURCE.siteTitle; -var WC_ASSET_URL = SOURCE.wcAssetUrl; -/** - * Retrieves a setting value from the setting state. - * - * @param {string} name The identifier for the setting. - * @param {*} [fallback=false] The value to use as a fallback - * if the setting is not in the - * state. - * @param {Function} [filter=( val ) => val] A callback for filtering the - * value before it's returned. - * Receives both the found value - * (if it exists for the key) and - * the provided fallback arg. - * - * @return {*} The value present in the settings state for the given - * name. - */ +// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/defineProperty.js +var defineProperty = __webpack_require__(5); +var defineProperty_default = /*#__PURE__*/__webpack_require__.n(defineProperty); -function getSetting(name) { - var fallback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; - var filter = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function (val) { - return val; - }; +// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/classCallCheck.js +var classCallCheck = __webpack_require__(12); +var classCallCheck_default = /*#__PURE__*/__webpack_require__.n(classCallCheck); - if (mutableSources.includes(name)) { - throw new Error(Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__["__"])('Mutable settings should be accessed via data store.')); - } +// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/createClass.js +var createClass = __webpack_require__(13); +var createClass_default = /*#__PURE__*/__webpack_require__.n(createClass); - var value = SOURCE.hasOwnProperty(name) ? SOURCE[name] : fallback; - return filter(value, fallback); -} -/** - * Sets a value to a property on the settings state. - * - * NOTE: This feature is to be removed in favour of data stores when a full migration - * is complete. - * - * @deprecated - * - * @param {string} name The setting property key for the - * setting being mutated. - * @param {*} value The value to set. - * @param {Function} [filter=( val ) => val] Allows for providing a callback - * to sanitize the setting (eg. - * ensure it's a number) - */ - -function setSetting(name, value) { - var filter = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function (val) { - return val; - }; - - if (mutableSources.includes(name)) { - throw new Error(Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__["__"])('Mutable settings should be mutated via data store.')); - } - - SOURCE[name] = filter(value); -} -/** - * Returns a string with the site's wp-admin URL appended. JS version of `admin_url`. - * - * @param {string} path Relative path. - * @return {string} Full admin URL. - */ - -function getAdminLink(path) { - return (ADMIN_URL || '') + path; -} - -/***/ }), -/* 36 */ -/***/ (function(module, exports) { - -function _extends() { - module.exports = _extends = Object.assign || function (target) { - for (var i = 1; i < arguments.length; i++) { - var source = arguments[i]; - - for (var key in source) { - if (Object.prototype.hasOwnProperty.call(source, key)) { - target[key] = source[key]; - } - } - } - - return target; - }; - - return _extends.apply(this, arguments); -} +// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/inherits.js +var inherits = __webpack_require__(14); +var inherits_default = /*#__PURE__*/__webpack_require__.n(inherits); -module.exports = _extends; +// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js +var possibleConstructorReturn = __webpack_require__(15); +var possibleConstructorReturn_default = /*#__PURE__*/__webpack_require__.n(possibleConstructorReturn); -/***/ }), -/* 37 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { +// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/getPrototypeOf.js +var getPrototypeOf = __webpack_require__(7); +var getPrototypeOf_default = /*#__PURE__*/__webpack_require__.n(getPrototypeOf); -"use strict"; +// EXTERNAL MODULE: external {"this":["wp","element"]} +var external_this_wp_element_ = __webpack_require__(0); -// EXPORTS -__webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ serialize_browser_esm_serializeStyles; }); - -// CONCATENATED MODULE: ./node_modules/@emotion/hash/dist/hash.browser.esm.js -/* eslint-disable */ -// Inspired by https://github.com/garycourt/murmurhash-js -// Ported from https://github.com/aappleby/smhasher/blob/61a0530f28277f2e850bfc39600ce61d02b518de/src/MurmurHash2.cpp#L37-L86 -function murmur2(str) { - // 'm' and 'r' are mixing constants generated offline. - // They're not really 'magic', they just happen to work well. - // const m = 0x5bd1e995; - // const r = 24; - // Initialize the hash - var h = 0; // Mix 4 bytes at a time into the hash - - var k, - i = 0, - len = str.length; - - for (; len >= 4; ++i, len -= 4) { - k = str.charCodeAt(i) & 0xff | (str.charCodeAt(++i) & 0xff) << 8 | (str.charCodeAt(++i) & 0xff) << 16 | (str.charCodeAt(++i) & 0xff) << 24; - k = - /* Math.imul(k, m): */ - (k & 0xffff) * 0x5bd1e995 + ((k >>> 16) * 0xe995 << 16); - k ^= - /* k >>> r: */ - k >>> 24; - h = - /* Math.imul(k, m): */ - (k & 0xffff) * 0x5bd1e995 + ((k >>> 16) * 0xe995 << 16) ^ - /* Math.imul(h, m): */ - (h & 0xffff) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16); - } // Handle the last few bytes of the input array - - - switch (len) { - case 3: - h ^= (str.charCodeAt(i + 2) & 0xff) << 16; - - case 2: - h ^= (str.charCodeAt(i + 1) & 0xff) << 8; - - case 1: - h ^= str.charCodeAt(i) & 0xff; - h = - /* Math.imul(h, m): */ - (h & 0xffff) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16); - } // Do a few final mixes of the hash to ensure the last few - // bytes are well-incorporated. - - - h ^= h >>> 13; - h = - /* Math.imul(h, m): */ - (h & 0xffff) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16); - return ((h ^ h >>> 15) >>> 0).toString(36); -} +// EXTERNAL MODULE: external {"this":["wp","compose"]} +var external_this_wp_compose_ = __webpack_require__(20); -/* harmony default export */ var hash_browser_esm = (murmur2); - -// CONCATENATED MODULE: ./node_modules/@emotion/unitless/dist/unitless.browser.esm.js -var unitlessKeys = { - animationIterationCount: 1, - borderImageOutset: 1, - borderImageSlice: 1, - borderImageWidth: 1, - boxFlex: 1, - boxFlexGroup: 1, - boxOrdinalGroup: 1, - columnCount: 1, - columns: 1, - flex: 1, - flexGrow: 1, - flexPositive: 1, - flexShrink: 1, - flexNegative: 1, - flexOrder: 1, - gridRow: 1, - gridRowEnd: 1, - gridRowSpan: 1, - gridRowStart: 1, - gridColumn: 1, - gridColumnEnd: 1, - gridColumnSpan: 1, - gridColumnStart: 1, - msGridRow: 1, - msGridRowSpan: 1, - msGridColumn: 1, - msGridColumnSpan: 1, - fontWeight: 1, - lineHeight: 1, - opacity: 1, - order: 1, - orphans: 1, - tabSize: 1, - widows: 1, - zIndex: 1, - zoom: 1, - WebkitLineClamp: 1, - // SVG-related properties - fillOpacity: 1, - floodOpacity: 1, - stopOpacity: 1, - strokeDasharray: 1, - strokeDashoffset: 1, - strokeMiterlimit: 1, - strokeOpacity: 1, - strokeWidth: 1 -}; +// EXTERNAL MODULE: external {"this":["wp","data"]} +var external_this_wp_data_ = __webpack_require__(11); -/* harmony default export */ var unitless_browser_esm = (unitlessKeys); +// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js + 1 modules +var inheritsLoose = __webpack_require__(38); -// EXTERNAL MODULE: ./node_modules/@emotion/memoize/dist/memoize.browser.esm.js -var memoize_browser_esm = __webpack_require__(73); +// EXTERNAL MODULE: external "React" +var external_React_ = __webpack_require__(10); +var external_React_default = /*#__PURE__*/__webpack_require__.n(external_React_); -// CONCATENATED MODULE: ./node_modules/@emotion/serialize/dist/serialize.browser.esm.js +// EXTERNAL MODULE: ./node_modules/prop-types/index.js +var prop_types = __webpack_require__(1); +var prop_types_default = /*#__PURE__*/__webpack_require__.n(prop_types); +// EXTERNAL MODULE: ./node_modules/history/esm/history.js + 2 modules +var esm_history = __webpack_require__(71); +// EXTERNAL MODULE: ./node_modules/mini-create-react-context/dist/esm/index.js +var esm = __webpack_require__(183); +// EXTERNAL MODULE: ./node_modules/tiny-invariant/dist/tiny-invariant.esm.js +var tiny_invariant_esm = __webpack_require__(56); -var ILLEGAL_ESCAPE_SEQUENCE_ERROR = "You have illegal escape sequence in your template literal, most likely inside content's property value.\nBecause you write your CSS inside a JavaScript string you actually have to do double escaping, so for example \"content: '\\00d7';\" should become \"content: '\\\\00d7';\".\nYou can read more about this here:\nhttps://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#ES2018_revision_of_illegal_escape_sequences"; -var UNDEFINED_AS_OBJECT_KEY_ERROR = "You have passed in falsy value as style object's key (can happen when in example you pass unexported component as computed key)."; -var hyphenateRegex = /[A-Z]|^ms/g; -var animationRegex = /_EMO_([^_]+?)_([^]*?)_EMO_/g; +// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js +var esm_extends = __webpack_require__(32); -var isCustomProperty = function isCustomProperty(property) { - return property.charCodeAt(1) === 45; -}; +// EXTERNAL MODULE: ./node_modules/path-to-regexp/index.js +var path_to_regexp = __webpack_require__(184); +var path_to_regexp_default = /*#__PURE__*/__webpack_require__.n(path_to_regexp); -var isProcessableValue = function isProcessableValue(value) { - return value != null && typeof value !== 'boolean'; -}; +// EXTERNAL MODULE: ./node_modules/react-is/index.js +var react_is = __webpack_require__(126); -var processStyleName = Object(memoize_browser_esm["a" /* default */])(function (styleName) { - return isCustomProperty(styleName) ? styleName : styleName.replace(hyphenateRegex, '-$&').toLowerCase(); -}); +// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js +var objectWithoutPropertiesLoose = __webpack_require__(42); -var serialize_browser_esm_processStyleValue = function processStyleValue(key, value) { - switch (key) { - case 'animation': - case 'animationName': - { - if (typeof value === 'string') { - return value.replace(animationRegex, function (match, p1, p2) { - cursor = { - name: p1, - styles: p2, - next: cursor - }; - return p1; - }); - } - } - } +// EXTERNAL MODULE: ./node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.cjs.js +var hoist_non_react_statics_cjs = __webpack_require__(138); +var hoist_non_react_statics_cjs_default = /*#__PURE__*/__webpack_require__.n(hoist_non_react_statics_cjs); - if (unitless_browser_esm[key] !== 1 && !isCustomProperty(key) && typeof value === 'number' && value !== 0) { - return value + 'px'; - } +// CONCATENATED MODULE: ./node_modules/react-router/esm/react-router.js - return value; -}; -if (false) { var hyphenatedCache, hyphenPattern, msPattern, oldProcessStyleValue, contentValues, contentValuePattern; } -var shouldWarnAboutInterpolatingClassNameFromCss = true; -function handleInterpolation(mergedProps, registered, interpolation, couldBeSelectorInterpolation) { - if (interpolation == null) { - return ''; - } - if (interpolation.__emotion_styles !== undefined) { - if (false) {} - return interpolation; - } - switch (typeof interpolation) { - case 'boolean': - { - return ''; - } - case 'object': - { - if (interpolation.anim === 1) { - cursor = { - name: interpolation.name, - styles: interpolation.styles, - next: cursor - }; - return interpolation.name; - } - if (interpolation.styles !== undefined) { - var next = interpolation.next; - - if (next !== undefined) { - // not the most efficient thing ever but this is a pretty rare case - // and there will be very few iterations of this generally - while (next !== undefined) { - cursor = { - name: next.name, - styles: next.styles, - next: cursor - }; - next = next.next; - } - } - var styles = interpolation.styles + ";"; - if (false) {} - return styles; - } - return createStringFromObject(mergedProps, registered, interpolation); - } +// TODO: Replace with React.createContext once we can assume React 16+ - case 'function': - { - if (mergedProps !== undefined) { - var previousCursor = cursor; - var result = interpolation(mergedProps); - cursor = previousCursor; - return handleInterpolation(mergedProps, registered, result, couldBeSelectorInterpolation); - } else if (false) {} +var react_router_createNamedContext = function createNamedContext(name) { + var context = Object(esm["a" /* default */])(); + context.displayName = name; + return context; +}; - break; - } +var historyContext = +/*#__PURE__*/ +react_router_createNamedContext("Router-History"); - case 'string': - if (false) { var replaced, matched; } +// TODO: Replace with React.createContext once we can assume React 16+ - break; - } // finalize string values (regular strings and functions interpolated into css calls) +var createNamedContext$1 = function createNamedContext(name) { + var context = Object(esm["a" /* default */])(); + context.displayName = name; + return context; +}; +var react_router_context = +/*#__PURE__*/ +createNamedContext$1("Router"); - if (registered == null) { - return interpolation; - } +/** + * The public API for putting history on context. + */ - var cached = registered[interpolation]; +var react_router_Router = +/*#__PURE__*/ +function (_React$Component) { + Object(inheritsLoose["a" /* default */])(Router, _React$Component); - if (false) {} + Router.computeRootMatch = function computeRootMatch(pathname) { + return { + path: "/", + url: "/", + params: {}, + isExact: pathname === "/" + }; + }; - return cached !== undefined && !couldBeSelectorInterpolation ? cached : interpolation; -} + function Router(props) { + var _this; -function createStringFromObject(mergedProps, registered, obj) { - var string = ''; + _this = _React$Component.call(this, props) || this; + _this.state = { + location: props.history.location + }; // This is a bit of a hack. We have to start listening for location + // changes here in the constructor in case there are any s + // on the initial render. If there are, they will replace/push when + // they mount and since cDM fires in children before parents, we may + // get a new location before the is mounted. - if (Array.isArray(obj)) { - for (var i = 0; i < obj.length; i++) { - string += handleInterpolation(mergedProps, registered, obj[i], false); - } - } else { - for (var _key in obj) { - var value = obj[_key]; - - if (typeof value !== 'object') { - if (registered != null && registered[value] !== undefined) { - string += _key + "{" + registered[value] + "}"; - } else if (isProcessableValue(value)) { - string += processStyleName(_key) + ":" + serialize_browser_esm_processStyleValue(_key, value) + ";"; - } - } else { - if (_key === 'NO_COMPONENT_SELECTOR' && "production" !== 'production') { - throw new Error('Component selectors can only be used in conjunction with babel-plugin-emotion.'); - } + _this._isMounted = false; + _this._pendingLocation = null; - if (Array.isArray(value) && typeof value[0] === 'string' && (registered == null || registered[value[0]] === undefined)) { - for (var _i = 0; _i < value.length; _i++) { - if (isProcessableValue(value[_i])) { - string += processStyleName(_key) + ":" + serialize_browser_esm_processStyleValue(_key, value[_i]) + ";"; - } - } + if (!props.staticContext) { + _this.unlisten = props.history.listen(function (location) { + if (_this._isMounted) { + _this.setState({ + location: location + }); } else { - var interpolated = handleInterpolation(mergedProps, registered, value, false); - - switch (_key) { - case 'animation': - case 'animationName': - { - string += processStyleName(_key) + ":" + interpolated + ";"; - break; - } - - default: - { - if (false) {} - - string += _key + "{" + interpolated + "}"; - } - } + _this._pendingLocation = location; } - } + }); } - } - return string; -} + return _this; + } -var labelPattern = /label:\s*([^\s;\n{]+)\s*;/g; -var sourceMapPattern; + var _proto = Router.prototype; -if (false) {} // this is the cursor for keyframes -// keyframes are stored on the SerializedStyles object as a linked list + _proto.componentDidMount = function componentDidMount() { + this._isMounted = true; + if (this._pendingLocation) { + this.setState({ + location: this._pendingLocation + }); + } + }; -var cursor; -var serialize_browser_esm_serializeStyles = function serializeStyles(args, registered, mergedProps) { - if (args.length === 1 && typeof args[0] === 'object' && args[0] !== null && args[0].styles !== undefined) { - return args[0]; - } + _proto.componentWillUnmount = function componentWillUnmount() { + if (this.unlisten) this.unlisten(); + }; - var stringMode = true; - var styles = ''; - cursor = undefined; - var strings = args[0]; + _proto.render = function render() { + return external_React_default.a.createElement(react_router_context.Provider, { + value: { + history: this.props.history, + location: this.state.location, + match: Router.computeRootMatch(this.state.location.pathname), + staticContext: this.props.staticContext + } + }, external_React_default.a.createElement(historyContext.Provider, { + children: this.props.children || null, + value: this.props.history + })); + }; - if (strings == null || strings.raw === undefined) { - stringMode = false; - styles += handleInterpolation(mergedProps, registered, strings, false); - } else { - if (false) {} + return Router; +}(external_React_default.a.Component); - styles += strings[0]; - } // we start at 1 since we've already handled the first arg +if (false) {} +/** + * The public API for a that stores location in memory. + */ - for (var i = 1; i < args.length; i++) { - styles += handleInterpolation(mergedProps, registered, args[i], styles.charCodeAt(styles.length - 1) === 46); +var react_router_MemoryRouter = +/*#__PURE__*/ +function (_React$Component) { + Object(inheritsLoose["a" /* default */])(MemoryRouter, _React$Component); - if (stringMode) { - if (false) {} + function MemoryRouter() { + var _this; - styles += strings[i]; + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; } + + _this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this; + _this.history = Object(esm_history["c" /* createMemoryHistory */])(_this.props); + return _this; } - var sourceMap; + var _proto = MemoryRouter.prototype; + + _proto.render = function render() { + return external_React_default.a.createElement(react_router_Router, { + history: this.history, + children: this.props.children + }); + }; - if (false) {} // using a global regex with .exec is stateful so lastIndex has to be reset each time + return MemoryRouter; +}(external_React_default.a.Component); +if (false) {} - labelPattern.lastIndex = 0; - var identifierName = ''; - var match; // https://esbench.com/bench/5b809c2cf2949800a0f61fb5 +var react_router_Lifecycle = +/*#__PURE__*/ +function (_React$Component) { + Object(inheritsLoose["a" /* default */])(Lifecycle, _React$Component); - while ((match = labelPattern.exec(styles)) !== null) { - identifierName += '-' + // $FlowFixMe we know it's not null - match[1]; + function Lifecycle() { + return _React$Component.apply(this, arguments) || this; } - var name = hash_browser_esm(styles) + identifierName; + var _proto = Lifecycle.prototype; - if (false) {} + _proto.componentDidMount = function componentDidMount() { + if (this.props.onMount) this.props.onMount.call(this, this); + }; - return { - name: name, - styles: styles, - next: cursor + _proto.componentDidUpdate = function componentDidUpdate(prevProps) { + if (this.props.onUpdate) this.props.onUpdate.call(this, this, prevProps); }; -}; + _proto.componentWillUnmount = function componentWillUnmount() { + if (this.props.onUnmount) this.props.onUnmount.call(this, this); + }; + _proto.render = function render() { + return null; + }; + return Lifecycle; +}(external_React_default.a.Component); -/***/ }), -/* 38 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { +/** + * The public API for prompting the user before navigating away from a screen. + */ -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return getRegisteredStyles; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return insertStyles; }); -var isBrowser = "object" !== 'undefined'; -function getRegisteredStyles(registered, registeredStyles, classNames) { - var rawClassName = ''; - classNames.split(' ').forEach(function (className) { - if (registered[className] !== undefined) { - registeredStyles.push(registered[className]); - } else { - rawClassName += className + " "; - } +function Prompt(_ref) { + var message = _ref.message, + _ref$when = _ref.when, + when = _ref$when === void 0 ? true : _ref$when; + return external_React_default.a.createElement(react_router_context.Consumer, null, function (context) { + !context ? false ? undefined : Object(tiny_invariant_esm["a" /* default */])(false) : void 0; + if (!when || context.staticContext) return null; + var method = context.history.block; + return external_React_default.a.createElement(react_router_Lifecycle, { + onMount: function onMount(self) { + self.release = method(message); + }, + onUpdate: function onUpdate(self, prevProps) { + if (prevProps.message !== message) { + self.release(); + self.release = method(message); + } + }, + onUnmount: function onUnmount(self) { + self.release(); + }, + message: message + }); }); - return rawClassName; } -var insertStyles = function insertStyles(cache, serialized, isStringTag) { - var className = cache.key + "-" + serialized.name; - - if ( // we only need to add the styles to the registered cache if the - // class name could be used further down - // the tree but if it's a string tag, we know it won't - // so we don't have to add it to registered cache. - // this improves memory usage since we can avoid storing the whole style string - (isStringTag === false || // we need to always store it if we're in compat mode and - // in node since emotion-server relies on whether a style is in - // the registered cache to know whether a style is global or not - // also, note that this check will be dead code eliminated in the browser - isBrowser === false && cache.compat !== undefined) && cache.registered[className] === undefined) { - cache.registered[className] = serialized.styles; - } - if (cache.inserted[serialized.name] === undefined) { - var current = serialized; +if (false) { var messageType; } - do { - var maybeStyles = cache.insert("." + className, current, cache.sheet, true); +var cache = {}; +var cacheLimit = 10000; +var cacheCount = 0; - current = current.next; - } while (current !== undefined); - } -}; +function compilePath(path) { + if (cache[path]) return cache[path]; + var generator = path_to_regexp_default.a.compile(path); + if (cacheCount < cacheLimit) { + cache[path] = generator; + cacheCount++; + } + return generator; +} +/** + * Public API for generating a URL pathname from a path and parameters. + */ -/***/ }), -/* 39 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { +function generatePath(path, params) { + if (path === void 0) { + path = "/"; + } -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _taggedTemplateLiteral; }); -function _taggedTemplateLiteral(strings, raw) { - if (!raw) { - raw = strings.slice(0); + if (params === void 0) { + params = {}; } - return Object.freeze(Object.defineProperties(strings, { - raw: { - value: Object.freeze(raw) - } - })); + return path === "/" ? path : compilePath(path)(params, { + pretty: true + }); } -/***/ }), -/* 40 */, -/* 41 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { +/** + * The public API for navigating programmatically with a component. + */ -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _typeof; }); -function _typeof(obj) { - "@babel/helpers - typeof"; +function Redirect(_ref) { + var computedMatch = _ref.computedMatch, + to = _ref.to, + _ref$push = _ref.push, + push = _ref$push === void 0 ? false : _ref$push; + return external_React_default.a.createElement(react_router_context.Consumer, null, function (context) { + !context ? false ? undefined : Object(tiny_invariant_esm["a" /* default */])(false) : void 0; + var history = context.history, + staticContext = context.staticContext; + var method = push ? history.push : history.replace; + var location = Object(esm_history["b" /* createLocation */])(computedMatch ? typeof to === "string" ? generatePath(to, computedMatch.params) : Object(esm_extends["a" /* default */])({}, to, { + pathname: generatePath(to.pathname, computedMatch.params) + }) : to); // When rendering in a static context, + // set the new location immediately. - if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { - _typeof = function _typeof(obj) { - return typeof obj; - }; - } else { - _typeof = function _typeof(obj) { - return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; - }; - } + if (staticContext) { + method(location); + return null; + } - return _typeof(obj); -} + return external_React_default.a.createElement(react_router_Lifecycle, { + onMount: function onMount() { + method(location); + }, + onUpdate: function onUpdate(self, prevProps) { + var prevLocation = Object(esm_history["b" /* createLocation */])(prevProps.to); -/***/ }), -/* 42 */ -/***/ (function(module, exports) { + if (!Object(esm_history["e" /* locationsAreEqual */])(prevLocation, Object(esm_extends["a" /* default */])({}, location, { + key: prevLocation.key + }))) { + method(location); + } + }, + to: to + }); + }); +} -(function() { module.exports = this["wc"]["date"]; }()); +if (false) {} -/***/ }), -/* 43 */, -/* 44 */ -/***/ (function(module, exports) { +var cache$1 = {}; +var cacheLimit$1 = 10000; +var cacheCount$1 = 0; -(function() { module.exports = this["wp"]["apiFetch"]; }()); +function compilePath$1(path, options) { + var cacheKey = "" + options.end + options.strict + options.sensitive; + var pathCache = cache$1[cacheKey] || (cache$1[cacheKey] = {}); + if (pathCache[path]) return pathCache[path]; + var keys = []; + var regexp = path_to_regexp_default()(path, keys, options); + var result = { + regexp: regexp, + keys: keys + }; -/***/ }), -/* 45 */, -/* 46 */, -/* 47 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { + if (cacheCount$1 < cacheLimit$1) { + pathCache[path] = result; + cacheCount$1++; + } -"use strict"; -/* unused harmony export logged */ -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return deprecated; }); -/* harmony import */ var _wordpress_hooks__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(51); -/* harmony import */ var _wordpress_hooks__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_hooks__WEBPACK_IMPORTED_MODULE_0__); + return result; +} /** - * WordPress dependencies + * Public API for matching a URL pathname to a path. */ -/** - * Object map tracking messages which have been logged, for use in ensuring a - * message is only logged once. - * - * @type {Object} - */ -var logged = Object.create(null); -/** - * Logs a message to notify developers about a deprecated feature. - * - * @param {string} feature Name of the deprecated feature. - * @param {?Object} options Personalisation options - * @param {?string} options.version Version in which the feature will be removed. - * @param {?string} options.alternative Feature to use instead - * @param {?string} options.plugin Plugin name if it's a plugin feature - * @param {?string} options.link Link to documentation - * @param {?string} options.hint Additional message to help transition away from the deprecated feature. - * - * @example - * ```js - * import deprecated from '@wordpress/deprecated'; - * - * deprecated( 'Eating meat', { - * version: 'the future', - * alternative: 'vegetables', - * plugin: 'the earth', - * hint: 'You may find it beneficial to transition gradually.', - * } ); - * - * // Logs: 'Eating meat is deprecated and will be removed from the earth in the future. Please use vegetables instead. Note: You may find it beneficial to transition gradually.' - * ``` - */ +function matchPath(pathname, options) { + if (options === void 0) { + options = {}; + } -function deprecated(feature) { - var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - var version = options.version, - alternative = options.alternative, - plugin = options.plugin, - link = options.link, - hint = options.hint; - var pluginMessage = plugin ? " from ".concat(plugin) : ''; - var versionMessage = version ? " and will be removed".concat(pluginMessage, " in version ").concat(version) : ''; - var useInsteadMessage = alternative ? " Please use ".concat(alternative, " instead.") : ''; - var linkMessage = link ? " See: ".concat(link) : ''; - var hintMessage = hint ? " Note: ".concat(hint) : ''; - var message = "".concat(feature, " is deprecated").concat(versionMessage, ".").concat(useInsteadMessage).concat(linkMessage).concat(hintMessage); // Skip if already logged. - - if (message in logged) { - return; + if (typeof options === "string" || Array.isArray(options)) { + options = { + path: options + }; } - /** - * Fires whenever a deprecated feature is encountered - * - * @param {string} feature Name of the deprecated feature. - * @param {?Object} options Personalisation options - * @param {?string} options.version Version in which the feature will be removed. - * @param {?string} options.alternative Feature to use instead - * @param {?string} options.plugin Plugin name if it's a plugin feature - * @param {?string} options.link Link to documentation - * @param {?string} options.hint Additional message to help transition away from the deprecated feature. - * @param {?string} message Message sent to console.warn - */ + var _options = options, + path = _options.path, + _options$exact = _options.exact, + exact = _options$exact === void 0 ? false : _options$exact, + _options$strict = _options.strict, + strict = _options$strict === void 0 ? false : _options$strict, + _options$sensitive = _options.sensitive, + sensitive = _options$sensitive === void 0 ? false : _options$sensitive; + var paths = [].concat(path); + return paths.reduce(function (matched, path) { + if (!path && path !== "") return null; + if (matched) return matched; - Object(_wordpress_hooks__WEBPACK_IMPORTED_MODULE_0__["doAction"])('deprecated', feature, options, message); // eslint-disable-next-line no-console + var _compilePath = compilePath$1(path, { + end: exact, + strict: strict, + sensitive: sensitive + }), + regexp = _compilePath.regexp, + keys = _compilePath.keys; - console.warn(message); - logged[message] = true; + var match = regexp.exec(pathname); + if (!match) return null; + var url = match[0], + values = match.slice(1); + var isExact = pathname === url; + if (exact && !isExact) return null; + return { + path: path, + // the path used to match + url: path === "/" && url === "" ? "/" : url, + // the matched portion of the URL + isExact: isExact, + // whether or not we matched exactly + params: keys.reduce(function (memo, key, index) { + memo[key.name] = values[index]; + return memo; + }, {}) + }; + }, null); } -//# sourceMappingURL=index.js.map -/***/ }), -/* 48 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { +function isEmptyChildren(children) { + return external_React_default.a.Children.count(children) === 0; +} -"use strict"; +function evalChildrenDev(children, props, path) { + var value = children(props); + false ? undefined : void 0; + return value || null; +} +/** + * The public API for matching a single path and rendering. + */ -// EXPORTS -__webpack_require__.d(__webpack_exports__, "a", function() { return /* reexport */ ThemeContext; }); -__webpack_require__.d(__webpack_exports__, "c", function() { return /* reexport */ emotion_element_57a3a7a3_browser_esm_withEmotionCache; }); -__webpack_require__.d(__webpack_exports__, "b", function() { return /* reexport */ css_browser_esm; }); -// UNUSED EXPORTS: CacheProvider, ClassNames, Global, createElement, jsx, keyframes +var react_router_Route = +/*#__PURE__*/ +function (_React$Component) { + Object(inheritsLoose["a" /* default */])(Route, _React$Component); -// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js -var inheritsLoose = __webpack_require__(53); + function Route() { + return _React$Component.apply(this, arguments) || this; + } -// EXTERNAL MODULE: external "React" -var external_React_ = __webpack_require__(8); + var _proto = Route.prototype; -// CONCATENATED MODULE: ./node_modules/@emotion/sheet/dist/sheet.browser.esm.js -/* + _proto.render = function render() { + var _this = this; -Based off glamor's StyleSheet, thanks Sunil ❤️ + return external_React_default.a.createElement(react_router_context.Consumer, null, function (context$1) { + !context$1 ? false ? undefined : Object(tiny_invariant_esm["a" /* default */])(false) : void 0; + var location = _this.props.location || context$1.location; + var match = _this.props.computedMatch ? _this.props.computedMatch // already computed the match for us + : _this.props.path ? matchPath(location.pathname, _this.props) : context$1.match; -high performance StyleSheet for css-in-js systems + var props = Object(esm_extends["a" /* default */])({}, context$1, { + location: location, + match: match + }); -- uses multiple style tags behind the scenes for millions of rules -- uses `insertRule` for appending in production for *much* faster performance + var _this$props = _this.props, + children = _this$props.children, + component = _this$props.component, + render = _this$props.render; // Preact uses an empty array as children by + // default, so use null if that's the case. -// usage - -import { StyleSheet } from '@emotion/sheet' - -let styleSheet = new StyleSheet({ key: '', container: document.head }) - -styleSheet.insert('#box { border: 1px solid red; }') -- appends a css rule into the stylesheet - -styleSheet.flush() -- empties the stylesheet of all its contents + if (Array.isArray(children) && children.length === 0) { + children = null; + } -*/ -// $FlowFixMe -function sheetForTag(tag) { - if (tag.sheet) { - // $FlowFixMe - return tag.sheet; - } // this weirdness brought to you by firefox + return external_React_default.a.createElement(react_router_context.Provider, { + value: props + }, props.match ? children ? typeof children === "function" ? false ? undefined : children(props) : children : component ? external_React_default.a.createElement(component, props) : render ? render(props) : null : typeof children === "function" ? false ? undefined : children(props) : null); + }); + }; - /* istanbul ignore next */ + return Route; +}(external_React_default.a.Component); +if (false) {} - for (var i = 0; i < document.styleSheets.length; i++) { - if (document.styleSheets[i].ownerNode === tag) { - // $FlowFixMe - return document.styleSheets[i]; - } - } +function addLeadingSlash(path) { + return path.charAt(0) === "/" ? path : "/" + path; } -function createStyleElement(options) { - var tag = document.createElement('style'); - tag.setAttribute('data-emotion', options.key); - - if (options.nonce !== undefined) { - tag.setAttribute('nonce', options.nonce); - } +function addBasename(basename, location) { + if (!basename) return location; + return Object(esm_extends["a" /* default */])({}, location, { + pathname: addLeadingSlash(basename) + location.pathname + }); +} - tag.appendChild(document.createTextNode('')); - return tag; +function stripBasename(basename, location) { + if (!basename) return location; + var base = addLeadingSlash(basename); + if (location.pathname.indexOf(base) !== 0) return location; + return Object(esm_extends["a" /* default */])({}, location, { + pathname: location.pathname.substr(base.length) + }); } -var StyleSheet = -/*#__PURE__*/ -function () { - function StyleSheet(options) { - this.isSpeedy = options.speedy === undefined ? "production" === 'production' : options.speedy; - this.tags = []; - this.ctr = 0; - this.nonce = options.nonce; // key is the value of the data-emotion attribute, it's used to identify different sheets - - this.key = options.key; - this.container = options.container; - this.before = null; - } +function createURL(location) { + return typeof location === "string" ? location : Object(esm_history["d" /* createPath */])(location); +} - var _proto = StyleSheet.prototype; +function staticHandler(methodName) { + return function () { + false ? undefined : Object(tiny_invariant_esm["a" /* default */])(false) ; + }; +} - _proto.insert = function insert(rule) { - // the max length is how many rules we have per style tag, it's 65000 in speedy mode - // it's 1 in dev because we insert source maps that map a single rule to a location - // and you can only have one source map per style tag - if (this.ctr % (this.isSpeedy ? 65000 : 1) === 0) { - var _tag = createStyleElement(this); +function noop() {} +/** + * The public top-level API for a "static" , so-called because it + * can't actually change the current location. Instead, it just records + * location changes in a context object. Useful mainly in testing and + * server-rendering scenarios. + */ - var before; - if (this.tags.length === 0) { - before = this.before; - } else { - before = this.tags[this.tags.length - 1].nextSibling; - } +var react_router_StaticRouter = +/*#__PURE__*/ +function (_React$Component) { + Object(inheritsLoose["a" /* default */])(StaticRouter, _React$Component); - this.container.insertBefore(_tag, before); - this.tags.push(_tag); - } + function StaticRouter() { + var _this; - var tag = this.tags[this.tags.length - 1]; - - if (this.isSpeedy) { - var sheet = sheetForTag(tag); - - try { - // this is a really hot path - // we check the second character first because having "i" - // as the second character will happen less often than - // having "@" as the first character - var isImportRule = rule.charCodeAt(1) === 105 && rule.charCodeAt(0) === 64; // this is the ultrafast version, works across browsers - // the big drawback is that the css won't be editable in devtools - - sheet.insertRule(rule, // we need to insert @import rules before anything else - // otherwise there will be an error - // technically this means that the @import rules will - // _usually_(not always since there could be multiple style tags) - // be the first ones in prod and generally later in dev - // this shouldn't really matter in the real world though - // @import is generally only used for font faces from google fonts and etc. - // so while this could be technically correct then it would be slower and larger - // for a tiny bit of correctness that won't matter in the real world - isImportRule ? 0 : sheet.cssRules.length); - } catch (e) { - if (false) {} - } - } else { - tag.appendChild(document.createTextNode(rule)); + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; } - this.ctr++; - }; + _this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this; - _proto.flush = function flush() { - // $FlowFixMe - this.tags.forEach(function (tag) { - return tag.parentNode.removeChild(tag); - }); - this.tags = []; - this.ctr = 0; - }; + _this.handlePush = function (location) { + return _this.navigateTo(location, "PUSH"); + }; - return StyleSheet; -}(); + _this.handleReplace = function (location) { + return _this.navigateTo(location, "REPLACE"); + }; + _this.handleListen = function () { + return noop; + }; + _this.handleBlock = function () { + return noop; + }; -// CONCATENATED MODULE: ./node_modules/@emotion/stylis/dist/stylis.browser.esm.js -function stylis_min (W) { - function M(d, c, e, h, a) { - for (var m = 0, b = 0, v = 0, n = 0, q, g, x = 0, K = 0, k, u = k = q = 0, l = 0, r = 0, I = 0, t = 0, B = e.length, J = B - 1, y, f = '', p = '', F = '', G = '', C; l < B;) { - g = e.charCodeAt(l); - l === J && 0 !== b + n + v + m && (0 !== b && (g = 47 === b ? 10 : 47), n = v = m = 0, B++, J++); + return _this; + } - if (0 === b + n + v + m) { - if (l === J && (0 < r && (f = f.replace(N, '')), 0 < f.trim().length)) { - switch (g) { - case 32: - case 9: - case 59: - case 13: - case 10: - break; + var _proto = StaticRouter.prototype; - default: - f += e.charAt(l); - } + _proto.navigateTo = function navigateTo(location, action) { + var _this$props = this.props, + _this$props$basename = _this$props.basename, + basename = _this$props$basename === void 0 ? "" : _this$props$basename, + _this$props$context = _this$props.context, + context = _this$props$context === void 0 ? {} : _this$props$context; + context.action = action; + context.location = addBasename(basename, Object(esm_history["b" /* createLocation */])(location)); + context.url = createURL(context.location); + }; - g = 59; - } + _proto.render = function render() { + var _this$props2 = this.props, + _this$props2$basename = _this$props2.basename, + basename = _this$props2$basename === void 0 ? "" : _this$props2$basename, + _this$props2$context = _this$props2.context, + context = _this$props2$context === void 0 ? {} : _this$props2$context, + _this$props2$location = _this$props2.location, + location = _this$props2$location === void 0 ? "/" : _this$props2$location, + rest = Object(objectWithoutPropertiesLoose["a" /* default */])(_this$props2, ["basename", "context", "location"]); - switch (g) { - case 123: - f = f.trim(); - q = f.charCodeAt(0); - k = 1; + var history = { + createHref: function createHref(path) { + return addLeadingSlash(basename + createURL(path)); + }, + action: "POP", + location: stripBasename(basename, Object(esm_history["b" /* createLocation */])(location)), + push: this.handlePush, + replace: this.handleReplace, + go: staticHandler("go"), + goBack: staticHandler("goBack"), + goForward: staticHandler("goForward"), + listen: this.handleListen, + block: this.handleBlock + }; + return external_React_default.a.createElement(react_router_Router, Object(esm_extends["a" /* default */])({}, rest, { + history: history, + staticContext: context + })); + }; - for (t = ++l; l < B;) { - switch (g = e.charCodeAt(l)) { - case 123: - k++; - break; + return StaticRouter; +}(external_React_default.a.Component); - case 125: - k--; - break; +if (false) {} - case 47: - switch (g = e.charCodeAt(l + 1)) { - case 42: - case 47: - a: { - for (u = l + 1; u < J; ++u) { - switch (e.charCodeAt(u)) { - case 47: - if (42 === g && 42 === e.charCodeAt(u - 1) && l + 2 !== u) { - l = u + 1; - break a; - } +/** + * The public API for rendering the first that matches. + */ - break; +var react_router_Switch = +/*#__PURE__*/ +function (_React$Component) { + Object(inheritsLoose["a" /* default */])(Switch, _React$Component); - case 10: - if (47 === g) { - l = u + 1; - break a; - } + function Switch() { + return _React$Component.apply(this, arguments) || this; + } - } - } + var _proto = Switch.prototype; - l = u; - } + _proto.render = function render() { + var _this = this; - } + return external_React_default.a.createElement(react_router_context.Consumer, null, function (context) { + !context ? false ? undefined : Object(tiny_invariant_esm["a" /* default */])(false) : void 0; + var location = _this.props.location || context.location; + var element, match; // We use React.Children.forEach instead of React.Children.toArray().find() + // here because toArray adds keys to all child elements and we do not want + // to trigger an unmount/remount for two s that render the same + // component at different URLs. - break; + external_React_default.a.Children.forEach(_this.props.children, function (child) { + if (match == null && external_React_default.a.isValidElement(child)) { + element = child; + var path = child.props.path || child.props.from; + match = path ? matchPath(location.pathname, Object(esm_extends["a" /* default */])({}, child.props, { + path: path + })) : context.match; + } + }); + return match ? external_React_default.a.cloneElement(element, { + location: location, + computedMatch: match + }) : null; + }); + }; - case 91: - g++; + return Switch; +}(external_React_default.a.Component); - case 40: - g++; +if (false) {} - case 34: - case 39: - for (; l++ < J && e.charCodeAt(l) !== g;) { - } +/** + * A public higher-order component to access the imperative API + */ - } +function withRouter(Component) { + var displayName = "withRouter(" + (Component.displayName || Component.name) + ")"; - if (0 === k) break; - l++; - } + var C = function C(props) { + var wrappedComponentRef = props.wrappedComponentRef, + remainingProps = Object(objectWithoutPropertiesLoose["a" /* default */])(props, ["wrappedComponentRef"]); - k = e.substring(t, l); - 0 === q && (q = (f = f.replace(ca, '').trim()).charCodeAt(0)); + return external_React_default.a.createElement(react_router_context.Consumer, null, function (context) { + !context ? false ? undefined : Object(tiny_invariant_esm["a" /* default */])(false) : void 0; + return external_React_default.a.createElement(Component, Object(esm_extends["a" /* default */])({}, remainingProps, context, { + ref: wrappedComponentRef + })); + }); + }; - switch (q) { - case 64: - 0 < r && (f = f.replace(N, '')); - g = f.charCodeAt(1); + C.displayName = displayName; + C.WrappedComponent = Component; - switch (g) { - case 100: - case 109: - case 115: - case 45: - r = c; - break; + if (false) {} - default: - r = O; - } + return hoist_non_react_statics_cjs_default()(C, Component); +} - k = M(c, r, k, g, a + 1); - t = k.length; - 0 < A && (r = X(O, f, I), C = H(3, k, r, c, D, z, t, g, a, h), f = r.join(''), void 0 !== C && 0 === (t = (k = C.trim()).length) && (g = 0, k = '')); - if (0 < t) switch (g) { - case 115: - f = f.replace(da, ea); - - case 100: - case 109: - case 45: - k = f + '{' + k + '}'; - break; - - case 107: - f = f.replace(fa, '$1 $2'); - k = f + '{' + k + '}'; - k = 1 === w || 2 === w && L('@' + k, 3) ? '@-webkit-' + k + '@' + k : '@' + k; - break; - - default: - k = f + k, 112 === h && (k = (p += k, '')); - } else k = ''; - break; - - default: - k = M(c, X(c, f, I), k, h, a + 1); - } +var useContext = external_React_default.a.useContext; +function useHistory() { + if (false) {} - F += k; - k = I = r = u = q = 0; - f = ''; - g = e.charCodeAt(++l); - break; + return useContext(historyContext); +} +function useLocation() { + if (false) {} - case 125: - case 59: - f = (0 < r ? f.replace(N, '') : f).trim(); - if (1 < (t = f.length)) switch (0 === u && (q = f.charCodeAt(0), 45 === q || 96 < q && 123 > q) && (t = (f = f.replace(' ', ':')).length), 0 < A && void 0 !== (C = H(1, f, c, d, D, z, p.length, h, a, h)) && 0 === (t = (f = C.trim()).length) && (f = '\x00\x00'), q = f.charCodeAt(0), g = f.charCodeAt(1), q) { - case 0: - break; - - case 64: - if (105 === g || 99 === g) { - G += f + e.charAt(l); - break; - } + return useContext(react_router_context).location; +} +function useParams() { + if (false) {} - default: - 58 !== f.charCodeAt(t - 1) && (p += P(f, q, g, f.charCodeAt(2))); - } - I = r = u = q = 0; - f = ''; - g = e.charCodeAt(++l); - } - } + var match = useContext(react_router_context).match; + return match ? match.params : {}; +} +function useRouteMatch(path) { + if (false) {} - switch (g) { - case 13: - case 10: - 47 === b ? b = 0 : 0 === 1 + q && 107 !== h && 0 < f.length && (r = 1, f += '\x00'); - 0 < A * Y && H(0, f, c, d, D, z, p.length, h, a, h); - z = 1; - D++; - break; + var location = useLocation(); + var match = useContext(react_router_context).match; + return path ? matchPath(location.pathname, path) : match; +} - case 59: - case 125: - if (0 === b + n + v + m) { - z++; - break; - } +if (false) { var secondaryBuildName, initialBuildName, buildNames, react_router_key, global; } - default: - z++; - y = e.charAt(l); - - switch (g) { - case 9: - case 32: - if (0 === n + m + b) switch (x) { - case 44: - case 58: - case 9: - case 32: - y = ''; - break; - - default: - 32 !== g && (y = ' '); - } - break; - case 0: - y = '\\0'; - break; +//# sourceMappingURL=react-router.js.map - case 12: - y = '\\f'; - break; +// EXTERNAL MODULE: external "lodash" +var external_lodash_ = __webpack_require__(3); - case 11: - y = '\\v'; - break; +// EXTERNAL MODULE: ./node_modules/qs/lib/index.js +var lib = __webpack_require__(49); - case 38: - 0 === n + b + m && (r = I = 1, y = '\f' + y); - break; +// EXTERNAL MODULE: external {"this":["wc","components"]} +var external_this_wc_components_ = __webpack_require__(47); - case 108: - if (0 === n + b + m + E && 0 < u) switch (l - u) { - case 2: - 112 === x && 58 === e.charCodeAt(l - 3) && (E = x); +// EXTERNAL MODULE: external {"this":["wc","navigation"]} +var external_this_wc_navigation_ = __webpack_require__(21); - case 8: - 111 === K && (E = K); - } - break; +// EXTERNAL MODULE: ./client/wc-admin-settings/index.js +var wc_admin_settings = __webpack_require__(25); - case 58: - 0 === n + b + m && (u = l); - break; +// EXTERNAL MODULE: external {"this":["wc","data"]} +var external_this_wc_data_ = __webpack_require__(22); - case 44: - 0 === b + v + n + m && (r = 1, y += '\r'); - break; +// EXTERNAL MODULE: external {"this":["wc","tracks"]} +var external_this_wc_tracks_ = __webpack_require__(27); - case 34: - case 39: - 0 === b && (n = n === g ? 0 : 0 === n ? g : n); - break; +// EXTERNAL MODULE: ./client/layout/style.scss +var layout_style = __webpack_require__(297); - case 91: - 0 === n + b + v && m++; - break; +// EXTERNAL MODULE: external {"this":["wp","hooks"]} +var external_this_wp_hooks_ = __webpack_require__(43); - case 93: - 0 === n + b + v && m--; - break; +// EXTERNAL MODULE: external {"this":["wp","i18n"]} +var external_this_wp_i18n_ = __webpack_require__(2); - case 41: - 0 === n + b + m && v--; - break; +// EXTERNAL MODULE: ./client/analytics/report/get-reports.js +var get_reports = __webpack_require__(137); - case 40: - if (0 === n + b + m) { - if (0 === q) switch (2 * x + 3 * K) { - case 533: - break; +// EXTERNAL MODULE: ./client/dashboard/utils.js +var utils = __webpack_require__(95); - default: - q = 1; - } - v++; - } +// CONCATENATED MODULE: ./client/layout/controller.js - break; - case 64: - 0 === b + v + n + m + u + k && (k = 1); - break; - case 42: - case 47: - if (!(0 < n + m + v)) switch (b) { - case 0: - switch (2 * g + 3 * e.charCodeAt(l + 1)) { - case 235: - b = 47; - break; - case 220: - t = l, b = 42; - } - break; - case 42: - 47 === g && 42 === x && t + 2 !== l && (33 === e.charCodeAt(t + 2) && (p += e.substring(t, l + 1)), y = '', b = 0); - } - } - 0 === b && (f += y); - } +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = getPrototypeOf_default()(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = getPrototypeOf_default()(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return possibleConstructorReturn_default()(this, result); }; } - K = x; - x = g; - l++; - } +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } - t = p.length; +/** + * External dependencies + */ - if (0 < t) { - r = c; - if (0 < A && (C = H(2, p, r, d, D, z, t, h, a, h), void 0 !== C && 0 === (p = C).length)) return G + p + F; - p = r.join(',') + '{' + p + '}'; - if (0 !== w * E) { - 2 !== w || L(p, 2) || (E = 0); - switch (E) { - case 111: - p = p.replace(ha, ':-moz-$1') + p; - break; - case 112: - p = p.replace(Q, '::-webkit-input-$1') + p.replace(Q, '::-moz-$1') + p.replace(Q, ':-ms-input-$1') + p; - } - E = 0; - } - } - return G + p + F; - } - function X(d, c, e) { - var h = c.trim().split(ia); - c = h; - var a = h.length, - m = d.length; - switch (m) { - case 0: - case 1: - var b = 0; +/** + * Internal dependencies + */ - for (d = 0 === m ? '' : d[0] + ' '; b < a; ++b) { - c[b] = Z(d, c[b], e).trim(); - } - break; - default: - var v = b = 0; +var AnalyticsReport = Object(external_this_wp_element_["lazy"])(function () { + return __webpack_require__.e(/* import() | analytics-report */ 9).then(__webpack_require__.bind(null, 589)); +}); +var AnalyticsSettings = Object(external_this_wp_element_["lazy"])(function () { + return __webpack_require__.e(/* import() | analytics-settings */ 20).then(__webpack_require__.bind(null, 608)); +}); +var Dashboard = Object(external_this_wp_element_["lazy"])(function () { + return __webpack_require__.e(/* import() | dashboard */ 28).then(__webpack_require__.bind(null, 590)); +}); +var Homescreen = Object(external_this_wp_element_["lazy"])(function () { + return Promise.all(/* import() | homescreen */[__webpack_require__.e(1), __webpack_require__.e(2), __webpack_require__.e(52), __webpack_require__.e(4), __webpack_require__.e(32)]).then(__webpack_require__.bind(null, 605)); +}); +var MarketingOverview = Object(external_this_wp_element_["lazy"])(function () { + return Promise.all(/* import() | marketing-overview */[__webpack_require__.e(2), __webpack_require__.e(36)]).then(__webpack_require__.bind(null, 609)); +}); +var ProfileWizard = Object(external_this_wp_element_["lazy"])(function () { + return Promise.all(/* import() | profile-wizard */[__webpack_require__.e(53), __webpack_require__.e(46)]).then(__webpack_require__.bind(null, 606)); +}); +var SettingsGroup = Object(external_this_wp_element_["lazy"])(function () { + return Promise.all(/* import() | profile-wizard */[__webpack_require__.e(53), __webpack_require__.e(46)]).then(__webpack_require__.bind(null, 601)); +}); +var PAGES_FILTER = 'woocommerce_admin_pages_list'; +var controller_getPages = function getPages() { + var pages = []; + var initialBreadcrumbs = [['', wcSettings.woocommerceTranslation]]; + pages.push({ + container: Homescreen, + path: '/', + breadcrumbs: [].concat(initialBreadcrumbs, [Object(external_this_wp_i18n_["__"])('Home', 'woocommerce-admin')]), + wpOpenMenu: 'toplevel_page_woocommerce', + navArgs: { + id: 'woocommerce-home' + }, + capability: 'manage_woocommerce' + }); - for (c = []; b < a; ++b) { - for (var n = 0; n < m; ++n) { - c[v++] = Z(d[n] + ' ', h[b], e).trim(); - } - } + if (window.wcAdminFeatures.analytics) { + pages.push({ + container: Dashboard, + path: '/analytics/overview', + breadcrumbs: [].concat(initialBreadcrumbs, [['/analytics/overview', Object(external_this_wp_i18n_["__"])('Analytics', 'woocommerce-admin')], Object(external_this_wp_i18n_["__"])('Overview', 'woocommerce-admin')]), + wpOpenMenu: 'toplevel_page_wc-admin-path--analytics-overview', + navArgs: { + id: 'woocommerce-analytics-overview' + }, + capability: 'view_woocommerce_reports' + }); + pages.push({ + container: AnalyticsSettings, + path: '/analytics/settings', + breadcrumbs: [].concat(initialBreadcrumbs, [['/analytics/revenue', Object(external_this_wp_i18n_["__"])('Analytics', 'woocommerce-admin')], Object(external_this_wp_i18n_["__"])('Settings', 'woocommerce-admin')]), + wpOpenMenu: 'toplevel_page_wc-admin-path--analytics-overview', + navArgs: { + id: 'woocommerce-analytics-settings' + }, + capability: 'view_woocommerce_reports' + }); + pages.push({ + container: AnalyticsReport, + path: '/customers', + breadcrumbs: [].concat(initialBreadcrumbs, [Object(external_this_wp_i18n_["__"])('Customers', 'woocommerce-admin')]), + wpOpenMenu: 'toplevel_page_woocommerce', + navArgs: { + id: 'woocommerce-analytics-customers' + }, + capability: 'view_woocommerce_reports' + }); + pages.push({ + container: AnalyticsReport, + path: '/analytics/:report', + breadcrumbs: function breadcrumbs(_ref) { + var match = _ref.match; + var report = Object(external_lodash_["find"])(Object(get_reports["a" /* default */])(), { + report: match.params.report + }); - } + if (!report) { + return []; + } - return c; + return [].concat(initialBreadcrumbs, [['/analytics/revenue', Object(external_this_wp_i18n_["__"])('Analytics', 'woocommerce-admin')], report.title]); + }, + wpOpenMenu: 'toplevel_page_wc-admin-path--analytics-overview', + capability: 'view_woocommerce_reports' + }); } - function Z(d, c, e) { - var h = c.charCodeAt(0); - 33 > h && (h = (c = c.trim()).charCodeAt(0)); - - switch (h) { - case 38: - return c.replace(F, '$1' + d.trim()); - - case 58: - return d.trim() + c.replace(F, '$1' + d.trim()); - - default: - if (0 < 1 * e && 0 < c.indexOf('\f')) return c.replace(F, (58 === d.charCodeAt(0) ? '' : '$1') + d.trim()); - } + if (window.wcAdminFeatures.marketing) { + pages.push({ + container: MarketingOverview, + path: '/marketing', + breadcrumbs: [].concat(initialBreadcrumbs, [['/marketing', Object(external_this_wp_i18n_["__"])('Marketing', 'woocommerce-admin')], Object(external_this_wp_i18n_["__"])('Overview', 'woocommerce-admin')]), + wpOpenMenu: 'toplevel_page_woocommerce-marketing', + navArgs: { + id: 'woocommerce-marketing-overview' + }, + capability: 'view_woocommerce_reports' + }); + } - return d + c; + if (window.wcAdminFeatures.onboarding) { + pages.push({ + container: ProfileWizard, + path: '/setup-wizard', + breadcrumbs: [].concat(initialBreadcrumbs, [['/setup-wizard', Object(external_this_wp_i18n_["__"])('Setup Wizard', 'woocommerce-admin')]]), + capability: 'manage_woocommerce' + }); } - function P(d, c, e, h) { - var a = d + ';', - m = 2 * c + 3 * e + 4 * h; + if (window.wcAdminFeatures.settings) { + pages.push({ + container: SettingsGroup, + path: '/settings/:page', + breadcrumbs: function breadcrumbs(_ref2) { + var match = _ref2.match; + // @todo This might need to be refactored to retreive groups via data store. + var settingsPages = Object(wc_admin_settings["g" /* getSetting */])('settingsPages'); + var page = settingsPages[match.params.page]; + + if (!page) { + return []; + } - if (944 === m) { - d = a.indexOf(':', 9) + 1; - var b = a.substring(d, a.length - 1).trim(); - b = a.substring(0, d).trim() + b + ';'; - return 1 === w || 2 === w && L(b, 1) ? '-webkit-' + b + b : b; - } + return [].concat(initialBreadcrumbs, [[settingsPages.general ? '/settings/general' : "/settings/".concat(Object.keys(settingsPages)[0]), Object(external_this_wp_i18n_["__"])('Settings', 'woocommerce-admin')], page]); + }, + wpOpenMenu: 'toplevel_page_woocommerce', + capability: 'manage_woocommerce' + }); + } - if (0 === w || 2 === w && !L(a, 1)) return a; + return Object(external_this_wp_hooks_["applyFilters"])(PAGES_FILTER, pages); +}; +var controller_Controller = /*#__PURE__*/function (_Component) { + inherits_default()(Controller, _Component); - switch (m) { - case 1015: - return 97 === a.charCodeAt(10) ? '-webkit-' + a + a : a; + var _super = _createSuper(Controller); - case 951: - return 116 === a.charCodeAt(3) ? '-webkit-' + a + a : a; + function Controller() { + classCallCheck_default()(this, Controller); - case 963: - return 110 === a.charCodeAt(5) ? '-webkit-' + a + a : a; + return _super.apply(this, arguments); + } - case 1009: - if (100 !== a.charCodeAt(4)) break; + createClass_default()(Controller, [{ + key: "componentDidMount", + value: function componentDidMount() { + window.document.documentElement.scrollTop = 0; + window.document.body.classList.remove('woocommerce-admin-is-loading'); + } + }, { + key: "componentDidUpdate", + value: function componentDidUpdate(prevProps) { + var prevBaseQuery = Object(external_lodash_["omit"])(prevProps.query, 'chartType', 'filter', 'paged'); + var baseQuery = Object(external_lodash_["omit"])(this.props.query, 'chartType', 'filter', 'paged'); - case 969: - case 942: - return '-webkit-' + a + a; + if (prevProps.query.paged > 1 && !Object(external_lodash_["isEqual"])(prevBaseQuery, baseQuery)) { + Object(external_this_wc_navigation_["getHistory"])().replace(Object(external_this_wc_navigation_["getNewPath"])({ + paged: 1 + })); + } - case 978: - return '-webkit-' + a + '-moz-' + a + a; + if (prevProps.match.url !== this.props.match.url) { + window.document.documentElement.scrollTop = 0; + } + } + }, { + key: "render", + value: function render() { + var _this$props = this.props, + page = _this$props.page, + match = _this$props.match, + query = _this$props.query; + var url = match.url, + params = match.params; + window.wpNavMenuUrlUpdate(query); + window.wpNavMenuClassChange(page, url); + return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Suspense"], { + fallback: Object(external_this_wp_element_["createElement"])(external_this_wc_components_["Spinner"], null) + }, Object(external_this_wp_element_["createElement"])(page.container, { + params: params, + path: url, + pathMatch: page.path, + query: query + })); + } + }]); - case 1019: - case 983: - return '-webkit-' + a + '-moz-' + a + '-ms-' + a + a; + return Controller; +}(external_this_wp_element_["Component"]); +/** + * Update an anchor's link in sidebar to include persisted queries. Leave excluded screens + * as is. + * + * @param {HTMLElement} item - Sidebar anchor link. + * @param {Object} nextQuery - A query object to be added to updated hrefs. + * @param {Array} excludedScreens - wc-admin screens to avoid updating. + */ - case 883: - if (45 === a.charCodeAt(8)) return '-webkit-' + a + a; - if (0 < a.indexOf('image-set(', 11)) return a.replace(ja, '$1-webkit-$2') + a; - break; +function updateLinkHref(item, nextQuery, excludedScreens) { + if (Object(utils["f" /* isWCAdmin */])(item.href)) { + var search = Object(external_lodash_["last"])(item.href.split('?')); + var query = Object(lib["parse"])(search); + var path = query.path || 'homescreen'; + var screen = Object(external_this_wc_navigation_["getScreenFromPath"])(path); + var isExcludedScreen = excludedScreens.includes(screen); + var href = 'admin.php?' + Object(lib["stringify"])(Object.assign(query, isExcludedScreen ? {} : nextQuery)); // Replace the href so you can see the url on hover. - case 932: - if (45 === a.charCodeAt(4)) switch (a.charCodeAt(5)) { - case 103: - return '-webkit-box-' + a.replace('-grow', '') + '-webkit-' + a + '-ms-' + a.replace('grow', 'positive') + a; + item.href = href; - case 115: - return '-webkit-' + a + '-ms-' + a.replace('shrink', 'negative') + a; + item.onclick = function (e) { + e.preventDefault(); + Object(external_this_wc_navigation_["getHistory"])().push(href); + }; + } +} // Update's wc-admin links in wp-admin menu - case 98: - return '-webkit-' + a + '-ms-' + a.replace('basis', 'preferred-size') + a; - } - return '-webkit-' + a + '-ms-' + a + a; +window.wpNavMenuUrlUpdate = function (query) { + var nextQuery = Object(external_this_wc_navigation_["getPersistedQuery"])(query); + var excludedScreens = Object(external_this_wc_navigation_["getQueryExcludedScreens"])(); + Array.from(document.querySelectorAll('#adminmenu a')).forEach(function (item) { + return updateLinkHref(item, nextQuery, excludedScreens); + }); +}; // When the route changes, we need to update wp-admin's menu with the correct section & current link - case 964: - return '-webkit-' + a + '-ms-flex-' + a + a; - case 1023: - if (99 !== a.charCodeAt(8)) break; - b = a.substring(a.indexOf(':', 15)).replace('flex-', '').replace('space-between', 'justify'); - return '-webkit-box-pack' + b + '-webkit-' + a + '-ms-flex-pack' + b + a; +window.wpNavMenuClassChange = function (page, url) { + Array.from(document.getElementsByClassName('current')).forEach(function (item) { + item.classList.remove('current'); + }); + var submenu = Array.from(document.querySelectorAll('.wp-has-current-submenu')); + submenu.forEach(function (element) { + element.classList.remove('wp-has-current-submenu'); + element.classList.remove('wp-menu-open'); + element.classList.remove('selected'); + element.classList.add('wp-not-current-submenu'); + element.classList.add('menu-top'); + }); + var pageUrl = url === '/' ? 'admin.php?page=wc-admin' : 'admin.php?page=wc-admin&path=' + encodeURIComponent(url); + var currentItemsSelector = url === '/' ? "li > a[href$=\"".concat(pageUrl, "\"], li > a[href*=\"").concat(pageUrl, "?\"]") : "li > a[href*=\"".concat(pageUrl, "\"]"); + var currentItems = document.querySelectorAll(currentItemsSelector); + Array.from(currentItems).forEach(function (item) { + item.parentElement.classList.add('current'); + }); - case 1005: - return ka.test(a) ? a.replace(aa, ':-webkit-') + a.replace(aa, ':-moz-') + a : a; + if (page.wpOpenMenu) { + var currentMenu = document.querySelector('#' + page.wpOpenMenu); - case 1e3: - b = a.substring(13).trim(); - c = b.indexOf('-') + 1; + if (currentMenu) { + currentMenu.classList.remove('wp-not-current-submenu'); + currentMenu.classList.add('wp-has-current-submenu'); + currentMenu.classList.add('wp-menu-open'); + currentMenu.classList.add('current'); + } + } - switch (b.charCodeAt(0) + b.charCodeAt(c)) { - case 226: - b = a.replace(G, 'tb'); - break; + var wpWrap = document.querySelector('#wpwrap'); + wpWrap.classList.remove('wp-responsive-open'); +}; +// EXTERNAL MODULE: ./node_modules/classnames/index.js +var classnames = __webpack_require__(6); +var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames); - case 232: - b = a.replace(G, 'tb-rl'); - break; +// EXTERNAL MODULE: external {"this":["wp","htmlEntities"]} +var external_this_wp_htmlEntities_ = __webpack_require__(41); - case 220: - b = a.replace(G, 'lr'); - break; +// EXTERNAL MODULE: ./packages/experimental/build-module/index.js +var build_module = __webpack_require__(30); - default: - return a; - } +// EXTERNAL MODULE: ./client/header/style.scss +var header_style = __webpack_require__(298); - return '-webkit-' + a + '-ms-' + b + a; +// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/slicedToArray.js +var slicedToArray = __webpack_require__(18); +var slicedToArray_default = /*#__PURE__*/__webpack_require__.n(slicedToArray); - case 1017: - if (-1 === a.indexOf('sticky', 9)) break; +// EXTERNAL MODULE: external {"this":["wp","components"]} +var external_this_wp_components_ = __webpack_require__(4); - case 975: - c = (a = d).length - 10; - b = (33 === a.charCodeAt(c) ? a.substring(0, c) : a).substring(d.indexOf(':', 7) + 1).trim(); +// EXTERNAL MODULE: ./node_modules/gridicons/dist/cross-small.js +var cross_small = __webpack_require__(122); +var cross_small_default = /*#__PURE__*/__webpack_require__.n(cross_small); - switch (m = b.charCodeAt(0) + (b.charCodeAt(7) | 0)) { - case 203: - if (111 > b.charCodeAt(8)) break; +// EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/icon/index.js +var build_module_icon = __webpack_require__(197); - case 115: - a = a.replace(b, '-webkit-' + b) + ';' + a; - break; +// EXTERNAL MODULE: ./node_modules/@wordpress/primitives/build-module/svg/index.js +var svg = __webpack_require__(67); - case 207: - case 102: - a = a.replace(b, '-webkit-' + (102 < m ? 'inline-' : '') + 'box') + ';' + a.replace(b, '-webkit-' + b) + ';' + a.replace(b, '-ms-' + b + 'box') + ';' + a; - } +// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/inbox.js - return a + ';'; - case 938: - if (45 === a.charCodeAt(5)) switch (a.charCodeAt(6)) { - case 105: - return b = a.replace('-items', ''), '-webkit-' + a + '-webkit-box-' + b + '-ms-flex-' + b + a; +/** + * WordPress dependencies + */ - case 115: - return '-webkit-' + a + '-ms-flex-item-' + a.replace(ba, '') + a; +var inbox_inbox = Object(external_this_wp_element_["createElement"])(svg["b" /* SVG */], { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, Object(external_this_wp_element_["createElement"])(svg["a" /* Path */], { + fillRule: "evenodd", + d: "M6 5.5h12a.5.5 0 01.5.5v7H14a2 2 0 11-4 0H5.5V6a.5.5 0 01.5-.5zm-.5 9V18a.5.5 0 00.5.5h12a.5.5 0 00.5-.5v-3.5h-3.337a3.5 3.5 0 01-6.326 0H5.5zM4 13V6a2 2 0 012-2h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2v-5z", + clipRule: "evenodd" +})); +/* harmony default export */ var library_inbox = (inbox_inbox); +//# sourceMappingURL=inbox.js.map +// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/help.js - default: - return '-webkit-' + a + '-ms-flex-line-pack' + a.replace('align-content', '').replace(ba, '') + a; - } - break; - case 973: - case 989: - if (45 !== a.charCodeAt(3) || 122 === a.charCodeAt(4)) break; +/** + * WordPress dependencies + */ - case 931: - case 953: - if (!0 === la.test(d)) return 115 === (b = d.substring(d.indexOf(':') + 1)).charCodeAt(0) ? P(d.replace('stretch', 'fill-available'), c, e, h).replace(':fill-available', ':stretch') : a.replace(b, '-webkit-' + b) + a.replace(b, '-moz-' + b.replace('fill-', '')) + a; - break; +var help_help = Object(external_this_wp_element_["createElement"])(svg["b" /* SVG */], { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, Object(external_this_wp_element_["createElement"])(svg["a" /* Path */], { + d: "M12 4.75a7.25 7.25 0 100 14.5 7.25 7.25 0 000-14.5zM3.25 12a8.75 8.75 0 1117.5 0 8.75 8.75 0 01-17.5 0zM12 8.75a1.5 1.5 0 01.167 2.99c-.465.052-.917.44-.917 1.01V14h1.5v-.845A3 3 0 109 10.25h1.5a1.5 1.5 0 011.5-1.5zM11.25 15v1.5h1.5V15h-1.5z" +})); +/* harmony default export */ var library_help = (help_help); +//# sourceMappingURL=help.js.map +// EXTERNAL MODULE: ./client/header/activity-panel/style.scss +var activity_panel_style = __webpack_require__(299); - case 962: - if (a = '-webkit-' + a + (102 === a.charCodeAt(5) ? '-ms-' + a : '') + a, 211 === e + h && 105 === a.charCodeAt(13) && 0 < a.indexOf('transform', 10)) return a.substring(0, a.indexOf(';', 27) + 1).replace(ma, '$1-webkit-$2') + a; - } +// CONCATENATED MODULE: ./client/header/activity-panel/toggle-bubble.js - return a; - } - function L(d, c) { - var e = d.indexOf(1 === c ? ':' : '{'), - h = d.substring(0, 3 !== c ? e : 10); - e = d.substring(e + 1, d.length - 1); - return R(2 !== c ? h : h.replace(na, '$1'), e, c); - } +/** + * External dependencies + */ - function ea(d, c) { - var e = P(c, c.charCodeAt(0), c.charCodeAt(1), c.charCodeAt(2)); - return e !== c + ';' ? e.replace(oa, ' or ($1)').substring(4) : '(' + c + ')'; - } - function H(d, c, e, h, a, m, b, v, n, q) { - for (var g = 0, x = c, w; g < A; ++g) { - switch (w = S[g].call(B, d, x, e, h, a, m, b, v, n, q)) { - case void 0: - case !1: - case !0: - case null: - break; - default: - x = w; - } - } - - if (x !== c) return x; - } - - function T(d) { - switch (d) { - case void 0: - case null: - A = S.length = 0; - break; - - default: - if ('function' === typeof d) S[A++] = d;else if ('object' === typeof d) for (var c = 0, e = d.length; c < e; ++c) { - T(d[c]); - } else Y = !!d | 0; - } - - return T; - } - - function U(d) { - d = d.prefix; - void 0 !== d && (R = null, d ? 'function' !== typeof d ? w = 1 : (w = 2, R = d) : w = 0); - return U; - } - - function B(d, c) { - var e = d; - 33 > e.charCodeAt(0) && (e = e.trim()); - V = e; - e = [V]; - - if (0 < A) { - var h = H(-1, c, e, e, D, z, 0, 0, 0, 0); - void 0 !== h && 'string' === typeof h && (c = h); - } - - var a = M(O, e, c, 0, 0); - 0 < A && (h = H(-2, a, e, e, D, z, a.length, 0, 0, 0), void 0 !== h && (a = h)); - V = ''; - E = 0; - z = D = 1; - return a; - } - - var ca = /^\0+/g, - N = /[\0\r\f]/g, - aa = /: */g, - ka = /zoo|gra/, - ma = /([,: ])(transform)/g, - ia = /,\r+?/g, - F = /([\t\r\n ])*\f?&/g, - fa = /@(k\w+)\s*(\S*)\s*/, - Q = /::(place)/g, - ha = /:(read-only)/g, - G = /[svh]\w+-[tblr]{2}/, - da = /\(\s*(.*)\s*\)/g, - oa = /([\s\S]*?);/g, - ba = /-self|flex-/g, - na = /[^]*?(:[rp][el]a[\w-]+)[^]*/, - la = /stretch|:\s*\w+\-(?:conte|avail)/, - ja = /([^-])(image-set\()/, - z = 1, - D = 1, - E = 0, - w = 1, - O = [], - S = [], - A = 0, - R = null, - Y = 0, - V = ''; - B.use = T; - B.set = U; - void 0 !== W && U(W); - return B; -} - -/* harmony default export */ var stylis_browser_esm = (stylis_min); - -// CONCATENATED MODULE: ./node_modules/@emotion/weak-memoize/dist/weak-memoize.browser.esm.js -var weakMemoize = function weakMemoize(func) { - // $FlowFixMe flow doesn't include all non-primitive types as allowed for weakmaps - var cache = new WeakMap(); - return function (arg) { - if (cache.has(arg)) { - // $FlowFixMe - return cache.get(arg); - } +var toggle_bubble_ActivityPanelToggleBubble = function ActivityPanelToggleBubble(_ref) { + var _ref$height = _ref.height, + height = _ref$height === void 0 ? 24 : _ref$height, + _ref$width = _ref.width, + width = _ref$width === void 0 ? 24 : _ref$width, + _ref$hasUnread = _ref.hasUnread, + hasUnread = _ref$hasUnread === void 0 ? false : _ref$hasUnread; + var classes = classnames_default()('woocommerce-layout__activity-panel-toggle-bubble', { + 'has-unread': hasUnread + }); + /* eslint-disable max-len */ - var ret = func(arg); - cache.set(arg, ret); - return ret; - }; + return Object(external_this_wp_element_["createElement"])("div", { + className: classes + }, Object(external_this_wp_element_["createElement"])("svg", { + height: height, + width: width, + viewBox: "0 0 24 24" + }, Object(external_this_wp_element_["createElement"])("path", { + d: "M18.9 2H5.1C3.4 2 2 3.4 2 5.1v10.7C2 17.6 3.4 19 5.1 19H9l6 3-1-3h4.9c1.7 0 3.1-1.4 3.1-3.1V5.1C22 3.4 20.6 2 18.9 2zm-1.5 4.5c-.4.8-.8 2.1-1 3.9-.3 1.8-.4 3.1-.3 4.1 0 .3 0 .5-.1.7-.1.2-.3.4-.6.4s-.6-.1-.9-.4c-1-1-1.8-2.6-2.4-4.6-.7 1.4-1.2 2.4-1.6 3.1-.6 1.2-1.2 1.8-1.6 1.9-.3 0-.5-.2-.8-.7-.5-1.4-1.1-4.2-1.7-8.2 0-.3 0-.5.2-.7.1-.2.4-.3.7-.4.5 0 .9.2.9.8.3 2.3.7 4.2 1.1 5.7l2.4-4.5c.2-.4.4-.6.8-.6.5 0 .8.3.9.9.3 1.4.6 2.6 1 3.7.3-2.7.8-4.7 1.4-5.9.2-.3.4-.5.7-.5.2 0 .5.1.7.2.2.2.3.4.3.6 0 .2 0 .4-.1.5z" + }))); + /* eslint-enable max-len */ }; -/* harmony default export */ var weak_memoize_browser_esm = (weakMemoize); - -// CONCATENATED MODULE: ./node_modules/@emotion/cache/dist/cache.browser.esm.js - +toggle_bubble_ActivityPanelToggleBubble.propTypes = { + height: prop_types_default.a.number, + width: prop_types_default.a.number, + hasUnread: prop_types_default.a.bool +}; +/* harmony default export */ var toggle_bubble = (toggle_bubble_ActivityPanelToggleBubble); +// EXTERNAL MODULE: ./client/inbox-panel/utils.js +var inbox_panel_utils = __webpack_require__(196); +// CONCATENATED MODULE: ./client/header/activity-panel/unread-indicators.js +/** + * External dependencies + */ -// https://github.com/thysultan/stylis.js/tree/master/plugins/rule-sheet -// inlined to avoid umd wrapper and peerDep warnings/installing stylis -// since we use stylis after closure compiler -var delimiter = '/*|*/'; -var needle = delimiter + '}'; +/** + * Internal dependencies + */ -function toSheet(block) { - if (block) { - Sheet.current.insert(block + '}'); - } -} -var Sheet = { - current: null +var UNREAD_NOTES_QUERY = { + page: 1, + per_page: external_this_wc_data_["QUERY_DEFAULTS"].pageSize, + status: 'unactioned', + type: external_this_wc_data_["QUERY_DEFAULTS"].noteTypes, + orderby: 'date', + order: 'desc' }; -var ruleSheet = function ruleSheet(context, content, selectors, parents, line, column, length, ns, depth, at) { - switch (context) { - // property - case 1: - { - switch (content.charCodeAt(0)) { - case 64: - { - // @import - Sheet.current.insert(content + ';'); - return ''; - } - // charcode for l - - case 108: - { - // charcode for b - // this ignores label - if (content.charCodeAt(2) === 98) { - return ''; - } - } - } - - break; - } - // selector - - case 2: - { - if (ns === 0) return content + delimiter; - break; - } - // at-rule - - case 3: - { - switch (ns) { - // @font-face, @page - case 102: - case 112: - { - Sheet.current.insert(selectors[0] + content); - return ''; - } - - default: - { - return content + (at === 0 ? delimiter : ''); - } - } - } +function getUnreadNotes(select) { + var _select = select(external_this_wc_data_["NOTES_STORE_NAME"]), + getNotes = _select.getNotes, + getNotesError = _select.getNotesError, + isResolving = _select.isResolving; - case -2: - { - content.split(needle).forEach(toSheet); - } - } -}; + var _select2 = select(external_this_wc_data_["USER_STORE_NAME"]), + getCurrentUser = _select2.getCurrentUser; -var cache_browser_esm_createCache = function createCache(options) { - if (options === undefined) options = {}; - var key = options.key || 'css'; - var stylisOptions; + var userData = getCurrentUser(); + var lastRead = parseInt(userData && userData.woocommerce_meta && userData.woocommerce_meta.activity_panel_inbox_last_read, 10); - if (options.prefix !== undefined) { - stylisOptions = { - prefix: options.prefix - }; + if (!lastRead) { + return null; } - var stylis = new stylis_browser_esm(stylisOptions); - - if (false) {} - - var inserted = {}; // $FlowFixMe - - var container; - - { - container = options.container || document.head; - var nodes = document.querySelectorAll("style[data-emotion-" + key + "]"); - Array.prototype.forEach.call(nodes, function (node) { - var attrib = node.getAttribute("data-emotion-" + key); // $FlowFixMe - - attrib.split(' ').forEach(function (id) { - inserted[id] = true; - }); + getNotes(UNREAD_NOTES_QUERY); + var isError = Boolean(getNotesError('getNotes', [UNREAD_NOTES_QUERY])); + var isRequesting = isResolving('getNotes', [UNREAD_NOTES_QUERY]); - if (node.parentNode !== container) { - container.appendChild(node); - } - }); + if (isError || isRequesting) { + return null; } - var _insert; - - { - stylis.use(options.stylisPlugins)(ruleSheet); - - _insert = function insert(selector, serialized, sheet, shouldCache) { - var name = serialized.name; - Sheet.current = sheet; + var latestNotes = getNotes(UNREAD_NOTES_QUERY); + var unreadNotesCount = Object(inbox_panel_utils["a" /* getUnreadNotesCount */])(latestNotes, lastRead); + return unreadNotesCount > 0; +} +function getLowStockCount() { + return Object(wc_admin_settings["g" /* getSetting */])('lowStockCount', 0); +} +// CONCATENATED MODULE: ./client/header/activity-panel/tab/index.js - if (false) { var map; } - stylis(selector, serialized.styles); +/** + * External dependencies + */ - if (shouldCache) { - cache.inserted[name] = true; - } - }; - } - if (false) { var commentEnd, commentStart; } - var cache = { - key: key, - sheet: new StyleSheet({ - key: key, - container: container, - nonce: options.nonce, - speedy: options.speedy - }), - nonce: options.nonce, - inserted: inserted, - registered: {}, - insert: _insert - }; - return cache; +var tab_Tab = function Tab(_ref) { + var icon = _ref.icon, + title = _ref.title, + name = _ref.name, + unread = _ref.unread, + selected = _ref.selected, + isPanelOpen = _ref.isPanelOpen, + onTabClick = _ref.onTabClick; + var className = classnames_default()('woocommerce-layout__activity-panel-tab', { + 'is-active': isPanelOpen && selected, + 'has-unread': unread + }); + var tabKey = "activity-panel-tab-".concat(name); + return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], { + role: "tab", + className: className, + "aria-selected": selected, + "aria-controls": "activity-panel-".concat(name), + key: tabKey, + id: tabKey, + onClick: function onClick() { + onTabClick(name); + } + }, icon, title, ' ', unread && Object(external_this_wp_element_["createElement"])("span", { + className: "screen-reader-text" + }, Object(external_this_wp_i18n_["__"])('unread activity', 'woocommerce-admin'))); }; +// CONCATENATED MODULE: ./client/header/activity-panel/tabs/index.js -/* harmony default export */ var cache_browser_esm = (cache_browser_esm_createCache); - -// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/inheritsLoose.js -var helpers_inheritsLoose = __webpack_require__(130); -// EXTERNAL MODULE: ./node_modules/@emotion/utils/dist/utils.browser.esm.js -var utils_browser_esm = __webpack_require__(38); -// EXTERNAL MODULE: ./node_modules/@emotion/serialize/dist/serialize.browser.esm.js + 2 modules -var serialize_browser_esm = __webpack_require__(37); -// CONCATENATED MODULE: ./node_modules/@emotion/core/dist/emotion-element-57a3a7a3.browser.esm.js +/** + * External dependencies + */ +/** + * Internal dependencies + */ +var tabs_Tabs = function Tabs(_ref) { + var tabs = _ref.tabs, + _onTabClick = _ref.onTabClick, + selectedTabName = _ref.selectedTab, + _ref$tabOpen = _ref.tabOpen, + tabOpen = _ref$tabOpen === void 0 ? false : _ref$tabOpen; -var emotion_element_57a3a7a3_browser_esm_hasOwnProperty = Object.prototype.hasOwnProperty; + var _useState = Object(external_this_wp_element_["useState"])({ + tabOpen: tabOpen, + currentTab: selectedTabName + }), + _useState2 = slicedToArray_default()(_useState, 2), + _useState2$ = _useState2[0], + tabIsOpenState = _useState2$.tabOpen, + currentTab = _useState2$.currentTab, + setTabState = _useState2[1]; // Keep state synced with props -var EmotionCacheContext = /*#__PURE__*/Object(external_React_["createContext"])( // we're doing this to avoid preconstruct's dead code elimination in this one case -// because this module is primarily intended for the browser and node -// but it's also required in react native and similar environments sometimes -// and we could have a special build just for that -// but this is much easier and the native packages -// might use a different theme context in the future anyway -typeof HTMLElement !== 'undefined' ? cache_browser_esm() : null); -var ThemeContext = /*#__PURE__*/Object(external_React_["createContext"])({}); -var CacheProvider = EmotionCacheContext.Provider; -var emotion_element_57a3a7a3_browser_esm_withEmotionCache = function withEmotionCache(func) { - var render = function render(props, ref) { - return /*#__PURE__*/Object(external_React_["createElement"])(EmotionCacheContext.Consumer, null, function (cache) { - return func(props, cache, ref); + Object(external_this_wp_element_["useEffect"])(function () { + setTabState({ + tabOpen: tabOpen, + currentTab: selectedTabName }); - }; // $FlowFixMe + }, [tabOpen, selectedTabName]); + return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["NavigableMenu"], { + role: "tablist", + orientation: "horizontal", + className: "woocommerce-layout__activity-panel-tabs" + }, tabs && tabs.map(function (tab, i) { + if (tab.component) { + var Comp = tab.component, + options = tab.options; + return Object(external_this_wp_element_["createElement"])(Comp, extends_default()({ + key: i + }, options)); + } + return Object(external_this_wp_element_["createElement"])(tab_Tab, extends_default()({ + key: i, + index: i, + isPanelOpen: tabIsOpenState, + selected: currentTab === tab.name + }, tab, { + onTabClick: function onTabClick() { + var isTabOpen = currentTab === tab.name || currentTab === '' ? !tabIsOpenState : true; // If a panel is being opened, or if an existing panel is already open and a different one is being opened, record a track. - return /*#__PURE__*/Object(external_React_["forwardRef"])(render); -}; + if (!isTabOpen || currentTab !== tab.name) { + Object(external_this_wc_tracks_["recordEvent"])('activity_panel_open', { + tab: tab.name + }); + } -// thus we only need to replace what is a valid character for JS, but not for CSS + setTabState({ + tabOpen: isTabOpen, + currentTab: tab.name + }); -var sanitizeIdentifier = function sanitizeIdentifier(identifier) { - return identifier.replace(/\$/g, '-'); + _onTabClick(tab, isTabOpen); + } + })); + })); }; +// CONCATENATED MODULE: ./client/header/activity-panel/setup-progress.js -var typePropName = '__EMOTION_TYPE_PLEASE_DO_NOT_USE__'; -var labelPropName = '__EMOTION_LABEL_PLEASE_DO_NOT_USE__'; -var createEmotionProps = function createEmotionProps(type, props) { - if (false) {} - - var newProps = {}; - - for (var key in props) { - if (emotion_element_57a3a7a3_browser_esm_hasOwnProperty.call(props, key)) { - newProps[key] = props[key]; - } - } - - newProps[typePropName] = type; // TODO: check if this still works with all of those different JSX functions - - if (false) { var match, error; } - - return newProps; +var setup_progress_SetupProgress = function SetupProgress() { + return Object(external_this_wp_element_["createElement"])("svg", { + className: "woocommerce-layout__activity-panel-tab-icon setup-progress", + width: "18", + height: "18", + viewBox: "0 0 24 24", + fill: "none", + xmlns: "http://www.w3.org/2000/svg" + }, Object(external_this_wp_element_["createElement"])("path", { + d: "M12 20C16.4183 20 20 16.4183 20 12C20 7.58172 16.4183 4 12 4C7.58172 4 4 7.58172 4 12C4 16.4183 7.58172 20 12 20Z", + stroke: "#DCDCDE", + strokeWidth: "2" + }), Object(external_this_wp_element_["createElement"])("path", { + d: "M4 12V12C4 16.4183 7.58172 20 12 20V20C16.4183 20 20 16.4183 20 12V12C20 7.58172 16.4183 4 12 4V4", + strokeWidth: "2", + strokeLinecap: "round" + })); }; - -var emotion_element_57a3a7a3_browser_esm_render = function render(cache, props, theme, ref) { - var cssProp = theme === null ? props.css : props.css(theme); // so that using `css` from `emotion` and passing the result to the css prop works - // not passing the registered cache to serializeStyles because it would - // make certain babel optimisations not possible - - if (typeof cssProp === 'string' && cache.registered[cssProp] !== undefined) { - cssProp = cache.registered[cssProp]; - } - - var type = props[typePropName]; - var registeredStyles = [cssProp]; - var className = ''; - - if (typeof props.className === 'string') { - className = Object(utils_browser_esm["a" /* getRegisteredStyles */])(cache.registered, registeredStyles, props.className); - } else if (props.className != null) { - className = props.className + " "; - } - - var serialized = Object(serialize_browser_esm["a" /* serializeStyles */])(registeredStyles); - - if (false) { var labelFromStack; } - - var rules = Object(utils_browser_esm["b" /* insertStyles */])(cache, serialized, typeof type === 'string'); - className += cache.key + "-" + serialized.name; - var newProps = {}; - - for (var key in props) { - if (emotion_element_57a3a7a3_browser_esm_hasOwnProperty.call(props, key) && key !== 'css' && key !== typePropName && ( true || false)) { - newProps[key] = props[key]; - } - } - - newProps.ref = ref; - newProps.className = className; - var ele = /*#__PURE__*/Object(external_React_["createElement"])(type, newProps); - - return ele; -}; // eslint-disable-next-line no-undef - - -var Emotion = /* #__PURE__ */emotion_element_57a3a7a3_browser_esm_withEmotionCache(function (props, cache, ref) { - if (typeof props.css === 'function') { - return /*#__PURE__*/Object(external_React_["createElement"])(ThemeContext.Consumer, null, function (theme) { - return emotion_element_57a3a7a3_browser_esm_render(cache, props, theme, ref); - }); - } - - return emotion_element_57a3a7a3_browser_esm_render(cache, props, null, ref); -}); - -if (false) {} +// CONCATENATED MODULE: ./client/header/activity-panel/display-options/icons/display.js +/** + * External dependencies + */ -// CONCATENATED MODULE: ./node_modules/@emotion/css/dist/css.browser.esm.js +var display_DisplayIcon = function DisplayIcon() { + return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, Object(external_this_wp_element_["createElement"])("svg", { + className: "woocommerce-layout__activity-panel-tab-icon", + width: "24", + height: "24", + viewBox: "3 3 24 24", + fill: "none", + xmlns: "http://www.w3.org/2000/svg" + }, Object(external_this_wp_element_["createElement"])("path", { + d: "M13.8053 15.3982C13.8053 15.7965 13.4867 16.1947 13.0089 16.1947H6.79646C6.55752 16.1947 6.39823 16.115 6.23894 15.9558C6.07965 15.7965 6 15.6372 6 15.3982V6.79646C6 6.63717 6.15929 6.39823 6.23894 6.23894C6.39823 6.07965 6.55752 6 6.79646 6H13.0089C13.4071 6 13.8053 6.31858 13.8053 6.79646V15.3982Z", + strokeWidth: "1.5", + strokeLinecap: "round", + strokeLinejoin: "round" + }), Object(external_this_wp_element_["createElement"])("path", { + d: "M23.9203 10.6195C23.9203 11.0177 23.6017 11.4159 23.1238 11.4159H16.9115C16.6725 11.4159 16.5132 11.3363 16.3539 11.177C16.1946 11.0177 16.115 10.8584 16.115 10.6195V6.79646C16.115 6.39823 16.4336 6 16.9115 6H23.1238C23.5221 6 23.9203 6.31858 23.9203 6.79646V10.6195Z", + strokeWidth: "1.5", + strokeLinecap: "round", + strokeLinejoin: "round" + }), Object(external_this_wp_element_["createElement"])("path", { + d: "M13.8053 23.2035C13.8053 23.4424 13.7257 23.6017 13.5664 23.761C13.4071 23.9203 13.2478 23.9999 13.0089 23.9999H6.79646C6.39823 23.9999 6 23.6813 6 23.2035V19.3804C6 19.1415 6.07965 18.9822 6.23894 18.8229C6.39823 18.6636 6.55752 18.584 6.79646 18.584H13.0089C13.4071 18.584 13.8053 18.9026 13.8053 19.3804V23.2035Z", + strokeWidth: "1.5", + strokeLinecap: "round", + strokeLinejoin: "round" + }), Object(external_this_wp_element_["createElement"])("path", { + d: "M16.9912 23.9999C16.7522 23.9999 16.5929 23.9202 16.4336 23.7609C16.2743 23.6016 16.1947 23.4423 16.1947 23.2034V14.6016C16.1947 14.3627 16.2743 14.2034 16.4336 14.0441C16.5929 13.8848 16.7522 13.8052 16.9912 13.8052H23.2036C23.4425 13.8052 23.6018 13.8848 23.7611 14.0441C23.9204 14.2034 24 14.3627 24 14.6016V23.2034C24 23.6016 23.6814 23.9999 23.2036 23.9999H16.9912Z", + strokeWidth: "1.5", + strokeLinecap: "round", + strokeLinejoin: "round" + })), Object(external_this_wp_i18n_["__"])('Display', 'woocommerce-admin')); +}; +// CONCATENATED MODULE: ./client/header/activity-panel/display-options/icons/single-column.js +var single_column_SingleColumnIcon = function SingleColumnIcon() { + return Object(external_this_wp_element_["createElement"])("svg", { + className: "woocommerce-layout__activity-panel-tab-icon", + width: "12", + height: "14", + viewBox: "0 0 12 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg" + }, Object(external_this_wp_element_["createElement"])("rect", { + x: "0.5", + y: "0.5", + width: "11", + height: "13", + strokeWidth: "1" + })); +}; +// CONCATENATED MODULE: ./client/header/activity-panel/display-options/icons/two-columns.js -function css_browser_esm_css() { - for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } +var two_columns_TwoColumnsIcon = function TwoColumnsIcon() { + return Object(external_this_wp_element_["createElement"])("svg", { + className: "woocommerce-layout__activity-panel-tab-icon", + width: "18", + height: "14", + viewBox: "0 0 18 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg" + }, Object(external_this_wp_element_["createElement"])("rect", { + x: "0.5", + y: "0.5", + width: "7", + height: "13", + strokeWidth: "1" + }), Object(external_this_wp_element_["createElement"])("rect", { + x: "9.5", + y: "0.5", + width: "7", + height: "13", + strokeWidth: "1" + })); +}; +// CONCATENATED MODULE: ./client/header/activity-panel/display-options/index.js - return Object(serialize_browser_esm["a" /* serializeStyles */])(args); -} -/* harmony default export */ var css_browser_esm = (css_browser_esm_css); +/** + * External dependencies + */ -// CONCATENATED MODULE: ./node_modules/@emotion/core/dist/core.browser.esm.js +/** + * Internal dependencies + */ +var LAYOUTS = [{ + value: 'single_column', + label: Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, Object(external_this_wp_element_["createElement"])(single_column_SingleColumnIcon, null), Object(external_this_wp_i18n_["__"])('Single column', 'woocommerce-admin')) +}, { + value: 'two_columns', + label: Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, Object(external_this_wp_element_["createElement"])(two_columns_TwoColumnsIcon, null), Object(external_this_wp_i18n_["__"])('Two columns', 'woocommerce-admin')) +}]; +var display_options_DisplayOptions = function DisplayOptions() { + var defaultHomescreenLayout = Object(external_this_wp_data_["useSelect"])(function (select) { + var _select = select(external_this_wc_data_["OPTIONS_STORE_NAME"]), + getOption = _select.getOption; + return getOption('woocommerce_default_homepage_layout') || 'single_column'; + }); + var _useUserPreferences = Object(external_this_wc_data_["useUserPreferences"])(), + updateUserPreferences = _useUserPreferences.updateUserPreferences, + layout = _useUserPreferences.homepage_layout; -var core_browser_esm_jsx = function jsx(type, props) { - var args = arguments; + return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["DropdownMenu"], { + icon: Object(external_this_wp_element_["createElement"])(display_DisplayIcon, null) + /* translators: button label text should, if possible, be under 16 characters. */ + , + label: Object(external_this_wp_i18n_["__"])('Display options', 'woocommerce-admin'), + toggleProps: { + className: 'woocommerce-layout__activity-panel-tab display-options', + onClick: function onClick() { + return Object(external_this_wc_tracks_["recordEvent"])('homescreen_display_click'); + } + }, + popoverProps: { + className: 'woocommerce-layout__activity-panel-popover' + } + }, function (_ref) { + var onClose = _ref.onClose; + return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["MenuGroup"], { + className: "woocommerce-layout__homescreen-display-options", + label: Object(external_this_wp_i18n_["__"])('Layout', 'woocommerce-admin') + }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["MenuItemsChoice"], { + choices: LAYOUTS, + onSelect: function onSelect(newLayout) { + updateUserPreferences({ + homepage_layout: newLayout + }); + onClose(); + Object(external_this_wc_tracks_["recordEvent"])('homescreen_display_option', { + display_option: newLayout + }); + }, + value: layout || defaultHomescreenLayout + })); + }); +}; +// EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/close.js +var library_close = __webpack_require__(497); - if (props == null || !emotion_element_57a3a7a3_browser_esm_hasOwnProperty.call(props, 'css')) { - // $FlowFixMe - return external_React_["createElement"].apply(undefined, args); - } +// EXTERNAL MODULE: ./client/header/activity-panel/highlight-tooltip/style.scss +var highlight_tooltip_style = __webpack_require__(300); - var argsLength = args.length; - var createElementArgArray = new Array(argsLength); - createElementArgArray[0] = Emotion; - createElementArgArray[1] = createEmotionProps(type, props); +// CONCATENATED MODULE: ./client/header/activity-panel/highlight-tooltip/index.js - for (var i = 2; i < argsLength; i++) { - createElementArgArray[i] = args[i]; - } // $FlowFixMe - return external_React_["createElement"].apply(null, createElementArgArray); -}; +/** + * External dependencies + */ -var warnedAboutCssPropForGlobal = false; -var Global = /* #__PURE__ */emotion_element_57a3a7a3_browser_esm_withEmotionCache(function (props, cache) { - if (false) {} - var styles = props.styles; - if (typeof styles === 'function') { - return /*#__PURE__*/Object(external_React_["createElement"])(ThemeContext.Consumer, null, function (theme) { - var serialized = Object(serialize_browser_esm["a" /* serializeStyles */])([styles(theme)]); - return /*#__PURE__*/Object(external_React_["createElement"])(core_browser_esm_InnerGlobal, { - serialized: serialized, - cache: cache - }); - }); - } - var serialized = Object(serialize_browser_esm["a" /* serializeStyles */])([styles]); - return /*#__PURE__*/Object(external_React_["createElement"])(core_browser_esm_InnerGlobal, { - serialized: serialized, - cache: cache - }); -}); -// maintain place over rerenders. -// initial render from browser, insertBefore context.sheet.tags[0] or if a style hasn't been inserted there yet, appendChild -// initial client-side render from SSR, use place of hydrating tag -var core_browser_esm_InnerGlobal = /*#__PURE__*/function (_React$Component) { - Object(inheritsLoose["a" /* default */])(InnerGlobal, _React$Component); - function InnerGlobal(props, context, updater) { - return _React$Component.call(this, props, context, updater) || this; - } +/** + * Internal dependencies + */ - var _proto = InnerGlobal.prototype; - _proto.componentDidMount = function componentDidMount() { - this.sheet = new StyleSheet({ - key: this.props.cache.key + "-global", - nonce: this.props.cache.sheet.nonce, - container: this.props.cache.sheet.container - }); // $FlowFixMe +var SHOW_CLASS = 'highlight-tooltip__show'; - var node = document.querySelector("style[data-emotion-" + this.props.cache.key + "=\"" + this.props.serialized.name + "\"]"); +function HighlightTooltip(_ref) { + var title = _ref.title, + closeButtonText = _ref.closeButtonText, + content = _ref.content, + _ref$show = _ref.show, + show = _ref$show === void 0 ? true : _ref$show, + id = _ref.id, + onClose = _ref.onClose, + delay = _ref.delay, + _ref$onShow = _ref.onShow, + onShow = _ref$onShow === void 0 ? external_lodash_["noop"] : _ref$onShow, + _ref$useAnchor = _ref.useAnchor, + useAnchor = _ref$useAnchor === void 0 ? false : _ref$useAnchor; - if (node !== null) { - this.sheet.tags.push(node); - } + var _useState = Object(external_this_wp_element_["useState"])(delay > 0 ? null : show), + _useState2 = slicedToArray_default()(_useState, 2), + showHighlight = _useState2[0], + setShowHighlight = _useState2[1]; - if (this.props.cache.sheet.tags.length) { - this.sheet.before = this.props.cache.sheet.tags[0]; - } + var _useState3 = Object(external_this_wp_element_["useState"])(null), + _useState4 = slicedToArray_default()(_useState3, 2), + node = _useState4[0], + setNode = _useState4[1]; - this.insertStyles(); - }; + var _useState5 = Object(external_this_wp_element_["useState"])(null), + _useState6 = slicedToArray_default()(_useState5, 2), + anchorRect = _useState6[0], + setAnchorRect = _useState6[1]; - _proto.componentDidUpdate = function componentDidUpdate(prevProps) { - if (prevProps.serialized.name !== this.props.serialized.name) { - this.insertStyles(); - } - }; + Object(external_this_wp_element_["useEffect"])(function () { + var element = document.getElementById(id); + var container, parent; - _proto.insertStyles = function insertStyles$1() { - if (this.props.serialized.next !== undefined) { - // insert keyframes - Object(utils_browser_esm["b" /* insertStyles */])(this.props.cache, this.props.serialized.next, true); - } + if (element && !node) { + // Add tooltip container + if (!useAnchor) { + parent = element.parentElement; + } else { + parent = document.createElement('div'); + document.body.appendChild(parent); + } - if (this.sheet.tags.length) { - // if this doesn't exist then it will be null so the style element will be appended - var element = this.sheet.tags[this.sheet.tags.length - 1].nextElementSibling; - this.sheet.before = element; - this.sheet.flush(); + container = document.createElement('div'); + container.classList.add('highlight-tooltip__container'); + parent.appendChild(container); + setNode(container); } - this.props.cache.insert("", this.props.serialized, this.sheet, false); - }; + var timeoutId = triggerShowTooltip(container); + return function () { + if (container) { + var parentElement = container.parentElement; + parentElement.removeChild(container); - _proto.componentWillUnmount = function componentWillUnmount() { - this.sheet.flush(); - }; + if (useAnchor) { + parentElement.remove(); + } + } - _proto.render = function render() { + if (timeoutId) { + clearTimeout(timeoutId); + } + }; + }, []); + Object(external_this_wp_element_["useEffect"])(function () { + if (!showHighlight && node) { + node.classList.remove(SHOW_CLASS); + } + }, [showHighlight]); + Object(external_this_wp_element_["useEffect"])(function () { + if (show !== showHighlight && showHighlight !== null && node) { + setShowHighlight(show); - return null; - }; + if (!show) { + node.classList.remove(SHOW_CLASS); + } else if (node) { + triggerShowTooltip(node); + } + } + }, [show]); + Object(external_this_wp_element_["useLayoutEffect"])(function () { + window.addEventListener('resize', updateSize); + return function () { + return window.removeEventListener('resize', updateSize); + }; + }, []); - return InnerGlobal; -}(external_React_["Component"]); + function updateSize() { + if (useAnchor) { + var element = document.getElementById(id); + setAnchorRect(element.getBoundingClientRect()); + } + } -var core_browser_esm_keyframes = function keyframes() { - var insertable = css_browser_esm.apply(void 0, arguments); - var name = "animation-" + insertable.name; // $FlowFixMe + var triggerShowTooltip = function triggerShowTooltip(container) { + var timeoutId = null; - return { - name: name, - styles: "@keyframes " + name + "{" + insertable.styles + "}", - anim: 1, - toString: function toString() { - return "_EMO_" + this.name + "_" + this.styles + "_EMO_"; + if (delay > 0) { + timeoutId = setTimeout(function () { + timeoutId = null; + showTooltip(container); + }, delay); + } else if (!showHighlight) { + showTooltip(container); } - }; -}; -var classnames = function classnames(args) { - var len = args.length; - var i = 0; - var cls = ''; + return timeoutId; + }; - for (; i < len; i++) { - var arg = args[i]; - if (arg == null) continue; - var toAdd = void 0; + var showTooltip = function showTooltip(container) { + var element = document.getElementById(id); - switch (typeof arg) { - case 'boolean': - break; + if (element && useAnchor) { + setAnchorRect(element.getBoundingClientRect()); + } - case 'object': - { - if (Array.isArray(arg)) { - toAdd = classnames(arg); - } else { - toAdd = ''; + if (container) { + container.classList.add(SHOW_CLASS); + } - for (var k in arg) { - if (arg[k] && k) { - toAdd && (toAdd += ' '); - toAdd += k; - } - } - } + setShowHighlight(true); + onShow(); + }; - break; - } + var triggerClose = function triggerClose() { + setShowHighlight(false); - default: - { - toAdd = arg; - } + if (onClose) { + onClose(); } + }; - if (toAdd) { - cls && (cls += ' '); - cls += toAdd; - } + if (!node) { + return null; } - return cls; -}; + return Object(external_this_wp_element_["createPortal"])(Object(external_this_wp_element_["createElement"])("div", { + className: "highlight-tooltip__portal" + }, showHighlight ? Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["IsolatedEventContainer"], { + className: "highlight-tooltip__overlay" + }), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Popover"], { + className: "highlight-tooltip__popover", + noArrow: false, + anchorRect: anchorRect, + focusOnMount: "container" + }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Card"], { + size: "medium" + }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["CardHeader"], null, title, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], { + isSmall: true, + onClick: triggerClose, + icon: library_close["a" /* default */] + })), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["CardBody"], null, content || null), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["CardFooter"], { + isBorderless: true + }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], { + size: "small", + isPrimary: true, + onClick: triggerClose + }, closeButtonText || Object(external_this_wp_i18n_["__"])('Close', 'woocommerce-admin')))))) : null), node); +} + +HighlightTooltip.propTypes = { + /** + * The id of the element it should highlight, should be unique per HighlightTooltip. + */ + id: prop_types_default.a.string.isRequired, -function merge(registered, css, className) { - var registeredStyles = []; - var rawClassName = Object(utils_browser_esm["a" /* getRegisteredStyles */])(registered, registeredStyles, className); + /** + * Title of the popup + */ + title: prop_types_default.a.string.isRequired, - if (registeredStyles.length < 2) { - return className; - } + /** + * Text of the close button. + */ + closeButtonText: prop_types_default.a.string.isRequired, - return rawClassName + css(registeredStyles); -} + /** + * Content of the popup, can be either text or react element. + */ + content: prop_types_default.a.oneOfType([prop_types_default.a.string, prop_types_default.a.node]), -var ClassNames = emotion_element_57a3a7a3_browser_esm_withEmotionCache(function (props, context) { - return /*#__PURE__*/Object(external_React_["createElement"])(ThemeContext.Consumer, null, function (theme) { - var hasRendered = false; + /** + * If to show the popup, defaults to true. + */ + show: prop_types_default.a.bool, - var css = function css() { - if (hasRendered && "production" !== 'production') { - throw new Error('css can only be used during render'); - } + /** + * Callback for when the user closes the popup. + */ + onClose: prop_types_default.a.func, - for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } + /** + * This will delay the popup from appearing by the number of ms. + */ + delay: prop_types_default.a.number, - var serialized = Object(serialize_browser_esm["a" /* serializeStyles */])(args, context.registered); + /** + * A callback for when the tooltip is shown. + */ + onShow: prop_types_default.a.func, - { - Object(utils_browser_esm["b" /* insertStyles */])(context, serialized, false); - } + /** + * useAnchor, will append the tooltip to the body tag, and make use of the anchorRect to display the tooltip. + * Defaults to false. + */ + useAnchor: prop_types_default.a.bool +}; - return context.key + "-" + serialized.name; - }; +// EXTERNAL MODULE: ./node_modules/@wordpress/dom/build-module/index.js + 2 modules +var dom_build_module = __webpack_require__(121); - var cx = function cx() { - if (hasRendered && "production" !== 'production') { - throw new Error('cx can only be used during render'); - } +// CONCATENATED MODULE: ./client/hooks/useFocusOnMount.js +/** + * This hook was directly copied from https://github.com/WordPress/gutenberg/blob/master/packages/compose/src/hooks/use-focus-on-mount/index.js + * to avoid its absence in older versions of WordPress. + * + * This can be removed once the minimum supported version of WordPress includes this hook. + */ - for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { - args[_key2] = arguments[_key2]; - } +/** + * External dependencies + */ - return merge(context.registered, css, classnames(args)); - }; - var content = { - css: css, - cx: cx, - theme: theme - }; - var ele = props.children(content); - hasRendered = true; +/** + * Hook used to focus the first tabbable element on mount. + * + * @param {boolean|string} focusOnMount Focus on mount mode. + * @return {Function} Ref callback. + * + * @example + * ```js + * import { useFocusOnMount } from '@wordpress/compose'; + * + * const WithFocusOnMount = () => { + * const ref = useFocusOnMount() + * return ( + *
+ *
+ * ); + * } + * ``` + */ - return ele; - }); -}); +function useFocusOnMount() { + var focusOnMount = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'firstElement'; + var focusOnMountRef = Object(external_this_wp_element_["useRef"])(focusOnMount); + Object(external_this_wp_element_["useEffect"])(function () { + focusOnMountRef.current = focusOnMount; + }, [focusOnMount]); + return Object(external_this_wp_element_["useCallback"])(function (node) { + if (!node || focusOnMountRef.current === false) { + return; + } + if (node.contains(node.ownerDocument.activeElement)) { + return; + } + var target = node; + if (focusOnMountRef.current === 'firstElement') { + var firstTabbable = dom_build_module["a" /* focus */].tabbable.find(node)[0]; -/***/ }), -/* 49 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _arrayLikeToArray; }); -function _arrayLikeToArray(arr, len) { - if (len == null || len > arr.length) len = arr.length; - - for (var i = 0, arr2 = new Array(len); i < len; i++) { - arr2[i] = arr[i]; - } + if (firstTabbable) { + target = firstTabbable; + } + } - return arr2; + target.focus(); + }, []); } +// CONCATENATED MODULE: ./client/hooks/useFocusOutside.js +/** + * External dependencies + */ -/***/ }), -/* 50 */ -/***/ (function(module, exports) { - -(function() { module.exports = this["wc"]["tracks"]; }()); -/***/ }), -/* 51 */ -/***/ (function(module, exports) { +/** + * Input types which are classified as button types, for use in considering + * whether element is a (focus-normalized) button. + * + * @type {string[]} + */ -(function() { module.exports = this["wp"]["hooks"]; }()); +var INPUT_BUTTON_TYPES = ['button', 'submit']; +/** + * @typedef {HTMLButtonElement | HTMLLinkElement | HTMLInputElement} FocusNormalizedButton + */ +// Disable reason: Rule doesn't support predicate return types -/***/ }), -/* 52 */ -/***/ (function(module, exports) { +/* eslint-disable jsdoc/valid-types */ -function _typeof(obj) { - "@babel/helpers - typeof"; +/** + * Returns true if the given element is a button element subject to focus + * normalization, or false otherwise. + * + * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#Clicking_and_focus + * + * @param {EventTarget} eventTarget The target from a mouse or touch event. + * + * @return {eventTarget is FocusNormalizedButton} Whether element is a button. + */ - if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { - module.exports = _typeof = function _typeof(obj) { - return typeof obj; - }; - } else { - module.exports = _typeof = function _typeof(obj) { - return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; - }; +function isFocusNormalizedButton(eventTarget) { + if (!(eventTarget instanceof window.HTMLElement)) { + return false; } - return _typeof(obj); -} - -module.exports = _typeof; - -/***/ }), -/* 53 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _inheritsLoose; }); -function _inheritsLoose(subClass, superClass) { - subClass.prototype = Object.create(superClass.prototype); - subClass.prototype.constructor = subClass; - subClass.__proto__ = superClass; -} - -/***/ }), -/* 54 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _objectWithoutPropertiesLoose; }); -function _objectWithoutPropertiesLoose(source, excluded) { - if (source == null) return {}; - var target = {}; - var sourceKeys = Object.keys(source); - var key, i; + switch (eventTarget.nodeName) { + case 'A': + case 'BUTTON': + return true; - for (i = 0; i < sourceKeys.length; i++) { - key = sourceKeys[i]; - if (excluded.indexOf(key) >= 0) continue; - target[key] = source[key]; + case 'INPUT': + return Object(external_lodash_["includes"])(INPUT_BUTTON_TYPES, + /** @type {HTMLInputElement} */ + eventTarget.type); } - return target; + return false; } +/* eslint-enable jsdoc/valid-types */ -/***/ }), -/* 55 */, -/* 56 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; - -// EXPORTS -__webpack_require__.d(__webpack_exports__, "c", function() { return /* binding */ context_useSlot; }); -__webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ Consumer; }); - -// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js + 3 modules -var slicedToArray = __webpack_require__(24); - -// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js + 3 modules -var toConsumableArray = __webpack_require__(26); - -// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/classCallCheck.js -var classCallCheck = __webpack_require__(16); - -// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/createClass.js -var createClass = __webpack_require__(17); - -// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js -var assertThisInitialized = __webpack_require__(12); - -// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/inherits.js + 1 modules -var inherits = __webpack_require__(18); - -// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js -var possibleConstructorReturn = __webpack_require__(21); +/** + * @typedef {import('react').SyntheticEvent} SyntheticEvent + */ -// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js -var getPrototypeOf = __webpack_require__(9); +/** + * @callback EventCallback + * @param {SyntheticEvent} event input related event. + */ -// EXTERNAL MODULE: external {"this":["wp","element"]} -var external_this_wp_element_ = __webpack_require__(0); +/** + * @typedef FocusOutsideReactElement + * @property {EventCallback} handleFocusOutside callback for a focus outside event. + */ -// EXTERNAL MODULE: external "lodash" -var external_lodash_ = __webpack_require__(2); +/** + * @typedef {import('react').MutableRefObject} FocusOutsideRef + */ -// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/typeof.js -var esm_typeof = __webpack_require__(41); +/** + * @typedef {Object} FocusOutsideReturnValue + * @property {EventCallback} onFocus An event handler for focus events. + * @property {EventCallback} onBlur An event handler for blur events. + * @property {EventCallback} onMouseDown An event handler for mouse down events. + * @property {EventCallback} onMouseUp An event handler for mouse up events. + * @property {EventCallback} onTouchStart An event handler for touch start events. + * @property {EventCallback} onTouchEnd An event handler for touch end events. + */ -// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js -var objectWithoutProperties = __webpack_require__(11); +/** + * A react hook that can be used to check whether focus has moved outside the + * element the event handlers are bound to. + * + * @param {EventCallback} onFocusOutside A callback triggered when focus moves outside + * the element the event handlers are bound to. + * + * @return {FocusOutsideReturnValue} An object containing event handlers. Bind the event handlers + * to a wrapping element element to capture when focus moves + * outside that element. + */ -// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/defineProperty.js -var defineProperty = __webpack_require__(6); -// EXTERNAL MODULE: ./node_modules/@wordpress/is-shallow-equal/lib/index.js -var lib = __webpack_require__(66); -var lib_default = /*#__PURE__*/__webpack_require__.n(lib); +function useFocusOutside(onFocusOutside) { + var currentOnFocusOutside = Object(external_this_wp_element_["useRef"])(onFocusOutside); + Object(external_this_wp_element_["useEffect"])(function () { + currentOnFocusOutside.current = onFocusOutside; + }, [onFocusOutside]); + var preventBlurCheck = Object(external_this_wp_element_["useRef"])(false); + /** + * @type {import('react').MutableRefObject} + */ -// EXTERNAL MODULE: ./node_modules/@wordpress/components/build-module/slot-fill/bubbles-virtually/slot-fill-context.js -var slot_fill_context = __webpack_require__(61); + var blurCheckTimeoutId = Object(external_this_wp_element_["useRef"])(); + /** + * Cancel a blur check timeout. + */ -// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/slot-fill/bubbles-virtually/slot-fill-provider.js + var cancelBlurCheck = Object(external_this_wp_element_["useCallback"])(function () { + clearTimeout(blurCheckTimeoutId.current); + }, []); // Cancel blur checks on unmount. + Object(external_this_wp_element_["useEffect"])(function () { + return function () { + return cancelBlurCheck(); + }; + }, []); // Cancel a blur check if the callback or ref is no longer provided. + Object(external_this_wp_element_["useEffect"])(function () { + if (!onFocusOutside) { + cancelBlurCheck(); + } + }, [onFocusOutside, cancelBlurCheck]); + /** + * Handles a mousedown or mouseup event to respectively assign and + * unassign a flag for preventing blur check on button elements. Some + * browsers, namely Firefox and Safari, do not emit a focus event on + * button elements when clicked, while others do. The logic here + * intends to normalize this as treating click on buttons as focus. + * + * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#Clicking_and_focus + * + * @param {SyntheticEvent} event Event for mousedown or mouseup. + */ + var normalizeButtonFocus = Object(external_this_wp_element_["useCallback"])(function (event) { + var type = event.type, + target = event.target; + var isInteractionEnd = Object(external_lodash_["includes"])(['mouseup', 'touchend'], type); + if (isInteractionEnd) { + preventBlurCheck.current = false; + } else if (isFocusNormalizedButton(target)) { + preventBlurCheck.current = true; + } + }, []); + /** + * A callback triggered when a blur event occurs on the element the handler + * is bound to. + * + * Calls the `onFocusOutside` callback in an immediate timeout if focus has + * move outside the bound element and is still within the document. + * + * @param {SyntheticEvent} event Blur event. + */ + var queueBlurCheck = Object(external_this_wp_element_["useCallback"])(function (event) { + // React does not allow using an event reference asynchronously + // due to recycling behavior, except when explicitly persisted. + event.persist(); // Skip blur check if clicking button. See `normalizeButtonFocus`. + if (preventBlurCheck.current) { + return; + } -function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return Object(esm_typeof["a" /* default */])(key) === "symbol" ? key : String(key); } + blurCheckTimeoutId.current = setTimeout(function () { + // If document is not focused then focus should remain + // inside the wrapped component and therefore we cancel + // this blur event thereby leaving focus in place. + // https://developer.mozilla.org/en-US/docs/Web/API/Document/hasFocus. + if (!document.hasFocus()) { + event.preventDefault(); + return; + } -function _toPrimitive(input, hint) { if (Object(esm_typeof["a" /* default */])(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (Object(esm_typeof["a" /* default */])(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } + if (typeof currentOnFocusOutside.current === 'function') { + currentOnFocusOutside.current(event); + } + }, 0); + }, []); + return { + onFocus: cancelBlurCheck, + onMouseDown: normalizeButtonFocus, + onMouseUp: normalizeButtonFocus, + onTouchStart: normalizeButtonFocus, + onTouchEnd: normalizeButtonFocus, + onBlur: queueBlurCheck + }; +} +// CONCATENATED MODULE: ./client/header/activity-panel/panel.js -function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } /** - * WordPress dependencies + * External dependencies */ + /** * Internal dependencies */ -function useSlotRegistry() { - var _useState = Object(external_this_wp_element_["useState"])({}), - _useState2 = Object(slicedToArray["a" /* default */])(_useState, 2), - slots = _useState2[0], - setSlots = _useState2[1]; - - var _useState3 = Object(external_this_wp_element_["useState"])({}), - _useState4 = Object(slicedToArray["a" /* default */])(_useState3, 2), - fills = _useState4[0], - setFills = _useState4[1]; - - var registerSlot = Object(external_this_wp_element_["useCallback"])(function (name, ref, fillProps) { - setSlots(function (prevSlots) { - var slot = prevSlots[name] || {}; - return _objectSpread(_objectSpread({}, prevSlots), {}, Object(defineProperty["a" /* default */])({}, name, _objectSpread(_objectSpread({}, slot), {}, { - ref: ref || slot.ref, - fillProps: fillProps || slot.fillProps || {} - }))); - }); - }, []); - var unregisterSlot = Object(external_this_wp_element_["useCallback"])(function (name, ref) { - setSlots(function (prevSlots) { - var slot = prevSlots[name], - nextSlots = Object(objectWithoutProperties["a" /* default */])(prevSlots, [name].map(_toPropertyKey)); // Make sure we're not unregistering a slot registered by another element - // See https://github.com/WordPress/gutenberg/pull/19242#issuecomment-590295412 - +var panel_Panel = function Panel(_ref) { + var content = _ref.content, + isPanelOpen = _ref.isPanelOpen, + isPanelSwitching = _ref.isPanelSwitching, + currentTab = _ref.currentTab, + tab = _ref.tab, + closePanel = _ref.closePanel, + clearPanel = _ref.clearPanel; - if ((slot === null || slot === void 0 ? void 0 : slot.ref) === ref) { - return nextSlots; - } + var handleFocusOutside = function handleFocusOutside(event) { + var isClickOnModalOrSnackbar = event.target.closest('.woocommerce-inbox-dismiss-confirmation_modal') || event.target.closest('.components-snackbar__action'); - return prevSlots; - }); - }, []); - var updateSlot = Object(external_this_wp_element_["useCallback"])(function (name, fillProps) { - var slot = slots[name]; + if (isPanelOpen && !isClickOnModalOrSnackbar) { + closePanel(); + } + }; - if (!slot) { + var possibleFocusPanel = function possibleFocusPanel() { + if (!containerRef.current || !isPanelOpen || !tab) { return; } - if (!lib_default()(slot.fillProps, fillProps)) { - slot.fillProps = fillProps; - var slotFills = fills[name]; + focusOnMountRef(containerRef.current); + }; - if (slotFills) { - // Force update fills - slotFills.map(function (fill) { - return fill.current.rerender(); - }); - } + var finishTransition = function finishTransition(e) { + if (e && e.propertyName === 'transform') { + clearPanel(); + possibleFocusPanel(); } - }, [slots, fills]); - var registerFill = Object(external_this_wp_element_["useCallback"])(function (name, ref) { - setFills(function (prevFills) { - return _objectSpread(_objectSpread({}, prevFills), {}, Object(defineProperty["a" /* default */])({}, name, [].concat(Object(toConsumableArray["a" /* default */])(prevFills[name] || []), [ref]))); - }); + }; + + var focusOnMountRef = useFocusOnMount(); + var useFocusOutsideProps = useFocusOutside(handleFocusOutside); + var containerRef = Object(external_this_wp_element_["useRef"])(null); + var mergedContainerRef = Object(external_this_wp_element_["useCallback"])(function (node) { + containerRef.current = node; + focusOnMountRef(node); }, []); - var unregisterFill = Object(external_this_wp_element_["useCallback"])(function (name, ref) { - setFills(function (prevFills) { - if (prevFills[name]) { - return _objectSpread(_objectSpread({}, prevFills), {}, Object(defineProperty["a" /* default */])({}, name, prevFills[name].filter(function (fillRef) { - return fillRef !== ref; - }))); - } - return prevFills; + if (!tab) { + return Object(external_this_wp_element_["createElement"])("div", { + className: "woocommerce-layout__activity-panel-wrapper" }); - }, []); // Memoizing the return value so it can be directly passed to Provider value + } - var registry = Object(external_this_wp_element_["useMemo"])(function () { - return { - slots: slots, - fills: fills, - registerSlot: registerSlot, - updateSlot: updateSlot, - unregisterSlot: unregisterSlot, - registerFill: registerFill, - unregisterFill: unregisterFill - }; - }, [slots, fills, registerSlot, updateSlot, unregisterSlot, registerFill, unregisterFill]); - return registry; -} + if (!content) { + return null; + } -function slot_fill_provider_SlotFillProvider(_ref) { - var children = _ref.children; - var registry = useSlotRegistry(); - return Object(external_this_wp_element_["createElement"])(slot_fill_context["a" /* default */].Provider, { - value: registry - }, children); -} -//# sourceMappingURL=slot-fill-provider.js.map -// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/slot-fill/context.js + var classNames = classnames_default()('woocommerce-layout__activity-panel-wrapper', { + 'is-open': isPanelOpen, + 'is-switching': isPanelSwitching + }); + return Object(external_this_wp_element_["createElement"])("div", extends_default()({ + className: classNames, + tabIndex: 0, + role: "tabpanel", + "aria-label": tab.title, + onTransitionEnd: finishTransition + }, useFocusOutsideProps, { + ref: mergedContainerRef + }), Object(external_this_wp_element_["createElement"])("div", { + className: "woocommerce-layout__activity-panel-content", + key: 'activity-panel-' + currentTab, + id: 'activity-panel-' + currentTab + }, Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Suspense"], { + fallback: Object(external_this_wp_element_["createElement"])(external_this_wc_components_["Spinner"], null) + }, content))); +}; +/* harmony default export */ var panel = (panel_Panel); +// CONCATENATED MODULE: ./client/header/activity-panel/index.js +/** + * External dependencies + */ + @@ -3393,17 +3466,9 @@ function slot_fill_provider_SlotFillProvider(_ref) { -function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = Object(getPrototypeOf["a" /* default */])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = Object(getPrototypeOf["a" /* default */])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return Object(possibleConstructorReturn["a" /* default */])(this, result); }; } -function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } -/** - * External dependencies - */ -/** - * WordPress dependencies - */ /** @@ -3411,18077 +3476,7485 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re */ -var SlotFillContext = Object(external_this_wp_element_["createContext"])({ - registerSlot: function registerSlot() {}, - unregisterSlot: function unregisterSlot() {}, - registerFill: function registerFill() {}, - unregisterFill: function unregisterFill() {}, - getSlot: function getSlot() {}, - getFills: function getFills() {}, - subscribe: function subscribe() {} -}); -var Provider = SlotFillContext.Provider, - Consumer = SlotFillContext.Consumer; -var context_SlotFillProvider = /*#__PURE__*/function (_Component) { - Object(inherits["a" /* default */])(SlotFillProvider, _Component); - var _super = _createSuper(SlotFillProvider); - function SlotFillProvider() { - var _this; - Object(classCallCheck["a" /* default */])(this, SlotFillProvider); - - _this = _super.apply(this, arguments); - _this.registerSlot = _this.registerSlot.bind(Object(assertThisInitialized["a" /* default */])(_this)); - _this.registerFill = _this.registerFill.bind(Object(assertThisInitialized["a" /* default */])(_this)); - _this.unregisterSlot = _this.unregisterSlot.bind(Object(assertThisInitialized["a" /* default */])(_this)); - _this.unregisterFill = _this.unregisterFill.bind(Object(assertThisInitialized["a" /* default */])(_this)); - _this.getSlot = _this.getSlot.bind(Object(assertThisInitialized["a" /* default */])(_this)); - _this.getFills = _this.getFills.bind(Object(assertThisInitialized["a" /* default */])(_this)); - _this.hasFills = _this.hasFills.bind(Object(assertThisInitialized["a" /* default */])(_this)); - _this.subscribe = _this.subscribe.bind(Object(assertThisInitialized["a" /* default */])(_this)); - _this.slots = {}; - _this.fills = {}; - _this.listeners = []; - _this.contextValue = { - registerSlot: _this.registerSlot, - unregisterSlot: _this.unregisterSlot, - registerFill: _this.registerFill, - unregisterFill: _this.unregisterFill, - getSlot: _this.getSlot, - getFills: _this.getFills, - hasFills: _this.hasFills, - subscribe: _this.subscribe - }; - return _this; - } - Object(createClass["a" /* default */])(SlotFillProvider, [{ - key: "registerSlot", - value: function registerSlot(name, slot) { - var previousSlot = this.slots[name]; - this.slots[name] = slot; - this.triggerListeners(); // Sometimes the fills are registered after the initial render of slot - // But before the registerSlot call, we need to rerender the slot - - this.forceUpdateSlot(name); // If a new instance of a slot is being mounted while another with the - // same name exists, force its update _after_ the new slot has been - // assigned into the instance, such that its own rendering of children - // will be empty (the new Slot will subsume all fills for this name). - - if (previousSlot) { - previousSlot.forceUpdate(); - } - } - }, { - key: "registerFill", - value: function registerFill(name, instance) { - this.fills[name] = [].concat(Object(toConsumableArray["a" /* default */])(this.fills[name] || []), [instance]); - this.forceUpdateSlot(name); - } - }, { - key: "unregisterSlot", - value: function unregisterSlot(name, instance) { - // If a previous instance of a Slot by this name unmounts, do nothing, - // as the slot and its fills should only be removed for the current - // known instance. - if (this.slots[name] !== instance) { - return; - } - delete this.slots[name]; - this.triggerListeners(); - } - }, { - key: "unregisterFill", - value: function unregisterFill(name, instance) { - this.fills[name] = Object(external_lodash_["without"])(this.fills[name], instance); - this.resetFillOccurrence(name); - this.forceUpdateSlot(name); - } - }, { - key: "getSlot", - value: function getSlot(name) { - return this.slots[name]; - } - }, { - key: "getFills", - value: function getFills(name, slotInstance) { - // Fills should only be returned for the current instance of the slot - // in which they occupy. - if (this.slots[name] !== slotInstance) { - return []; - } - return Object(external_lodash_["sortBy"])(this.fills[name], 'occurrence'); - } - }, { - key: "hasFills", - value: function hasFills(name) { - return this.fills[name] && !!this.fills[name].length; - } - }, { - key: "resetFillOccurrence", - value: function resetFillOccurrence(name) { - Object(external_lodash_["forEach"])(this.fills[name], function (instance) { - instance.occurrence = undefined; - }); - } - }, { - key: "forceUpdateSlot", - value: function forceUpdateSlot(name) { - var slot = this.getSlot(name); - if (slot) { - slot.forceUpdate(); - } - } - }, { - key: "triggerListeners", - value: function triggerListeners() { - this.listeners.forEach(function (listener) { - return listener(); - }); - } - }, { - key: "subscribe", - value: function subscribe(listener) { - var _this2 = this; +var HelpPanel = Object(external_this_wp_element_["lazy"])(function () { + return Promise.all(/* import() | activity-panels-help */[__webpack_require__.e(54), __webpack_require__.e(6), __webpack_require__.e(7)]).then(__webpack_require__.bind(null, 602)); +}); +var InboxPanel = Object(external_this_wp_element_["lazy"])(function () { + return Promise.all(/* import() | activity-panels-inbox */[__webpack_require__.e(1), __webpack_require__.e(2), __webpack_require__.e(4), __webpack_require__.e(8)]).then(__webpack_require__.bind(null, 587)); +}); +var activity_panel_ActivityPanel = function ActivityPanel(_ref) { + var isEmbedded = _ref.isEmbedded, + query = _ref.query, + userPreferencesData = _ref.userPreferencesData; - this.listeners.push(listener); - return function () { - _this2.listeners = Object(external_lodash_["without"])(_this2.listeners, listener); - }; - } - }, { - key: "render", - value: function render() { - return Object(external_this_wp_element_["createElement"])(Provider, { - value: this.contextValue - }, Object(external_this_wp_element_["createElement"])(slot_fill_provider_SlotFillProvider, null, this.props.children)); - } - }]); + var _useState = Object(external_this_wp_element_["useState"])(''), + _useState2 = slicedToArray_default()(_useState, 2), + currentTab = _useState2[0], + setCurrentTab = _useState2[1]; - return SlotFillProvider; -}(external_this_wp_element_["Component"]); -/** - * React hook returning the active slot given a name. - * - * @param {string} name Slot name. - * @return {Object} Slot object. - */ + var _useState3 = Object(external_this_wp_element_["useState"])(false), + _useState4 = slicedToArray_default()(_useState3, 2), + isPanelOpen = _useState4[0], + setIsPanelOpen = _useState4[1]; + var _useState5 = Object(external_this_wp_element_["useState"])(false), + _useState6 = slicedToArray_default()(_useState5, 2), + isPanelSwitching = _useState6[0], + setIsPanelSwitching = _useState6[1]; -var context_useSlot = function useSlot(name) { - var _useContext = Object(external_this_wp_element_["useContext"])(SlotFillContext), - getSlot = _useContext.getSlot, - subscribe = _useContext.subscribe; + var _useState7 = Object(external_this_wp_element_["useState"])(false), + _useState8 = slicedToArray_default()(_useState7, 2), + mobileOpen = _useState8[0], + setMobileOpen = _useState8[1]; - var _useState = Object(external_this_wp_element_["useState"])(getSlot(name)), - _useState2 = Object(slicedToArray["a" /* default */])(_useState, 2), - slot = _useState2[0], - setSlot = _useState2[1]; + var _useSelect = Object(external_this_wp_data_["useSelect"])(function (select) { + var _select = select(external_this_wc_data_["OPTIONS_STORE_NAME"]), + getOption = _select.getOption, + isResolving = _select.isResolving; - Object(external_this_wp_element_["useEffect"])(function () { - setSlot(getSlot(name)); - var unsubscribe = subscribe(function () { - setSlot(getSlot(name)); - }); - return unsubscribe; - }, [name]); - return slot; -}; -/* harmony default export */ var context = __webpack_exports__["b"] = (context_SlotFillProvider); + return { + hasUnreadNotes: getUnreadNotes(select), + requestingTaskListOptions: isResolving('getOption', ['woocommerce_task_list_complete']) || isResolving('getOption', ['woocommerce_task_list_hidden']), + setupTaskListComplete: getOption('woocommerce_task_list_complete') === 'yes', + setupTaskListHidden: getOption('woocommerce_task_list_hidden') === 'yes', + trackedCompletedTasks: getOption('woocommerce_task_list_tracked_completed_tasks') || [] + }; + }), + hasUnreadNotes = _useSelect.hasUnreadNotes, + requestingTaskListOptions = _useSelect.requestingTaskListOptions, + setupTaskListComplete = _useSelect.setupTaskListComplete, + setupTaskListHidden = _useSelect.setupTaskListHidden, + trackedCompletedTasks = _useSelect.trackedCompletedTasks; -//# sourceMappingURL=context.js.map + var _useDispatch = Object(external_this_wp_data_["useDispatch"])(external_this_wc_data_["OPTIONS_STORE_NAME"]), + updateOptions = _useDispatch.updateOptions; -/***/ }), -/* 57 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { + var _useUser = Object(external_this_wc_data_["useUser"])(), + currentUserCan = _useUser.currentUserCan; -"use strict"; - -// EXPORTS -__webpack_require__.d(__webpack_exports__, "e", function() { return /* binding */ TAB; }); -__webpack_require__.d(__webpack_exports__, "b", function() { return /* binding */ ESCAPE; }); -__webpack_require__.d(__webpack_exports__, "c", function() { return /* binding */ LEFT; }); -__webpack_require__.d(__webpack_exports__, "f", function() { return /* binding */ UP; }); -__webpack_require__.d(__webpack_exports__, "d", function() { return /* binding */ RIGHT; }); -__webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ DOWN; }); - -// UNUSED EXPORTS: BACKSPACE, ENTER, SPACE, DELETE, F10, ALT, CTRL, COMMAND, SHIFT, ZERO, modifiers, rawShortcut, displayShortcutList, displayShortcut, shortcutAriaLabel, isKeyboardEvent + var togglePanel = function togglePanel(_ref2, isTabOpen) { + var tabName = _ref2.name; + var panelSwitching = tabName !== currentTab && currentTab !== '' && isTabOpen && isPanelOpen; + setCurrentTab(tabName); + setMobileOpen(isTabOpen); + setIsPanelOpen(isTabOpen); + setIsPanelSwitching(panelSwitching); + }; -// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/defineProperty.js -var defineProperty = __webpack_require__(6); + var _closePanel = function closePanel() { + setIsPanelOpen(false); + }; -// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js + 3 modules -var toConsumableArray = __webpack_require__(26); + var _clearPanel = function clearPanel() { + if (!isPanelOpen) { + setIsPanelSwitching(false); + setCurrentTab(''); + } + }; // On smaller screen, the panel buttons are hidden behind a toggle. -// EXTERNAL MODULE: external "lodash" -var external_lodash_ = __webpack_require__(2); -// EXTERNAL MODULE: external {"this":["wp","i18n"]} -var external_this_wp_i18n_ = __webpack_require__(3); + var toggleMobile = function toggleMobile() { + var tabs = getTabs(); + setCurrentTab(mobileOpen ? '' : tabs[0].name); + setMobileOpen(!mobileOpen); + setIsPanelOpen(!mobileOpen); + }; -// CONCATENATED MODULE: ./node_modules/@wordpress/components/node_modules/@wordpress/keycodes/build-module/platform.js -/** - * External dependencies - */ + var isHomescreen = function isHomescreen() { + return query.page === 'wc-admin' && !query.path; + }; -/** - * Return true if platform is MacOS. - * - * @param {Object} _window window object by default; used for DI testing. - * - * @return {boolean} True if MacOS; false otherwise. - */ + var isPerformingSetupTask = function isPerformingSetupTask() { + return query.task && !query.path && (requestingTaskListOptions === true || setupTaskListHidden === false && setupTaskListComplete === false); + }; // @todo Pull in dynamic unread status/count -function isAppleOS() { - var _window = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : window; - var platform = _window.navigator.platform; - return platform.indexOf('Mac') !== -1 || Object(external_lodash_["includes"])(['iPad', 'iPhone'], platform); -} -//# sourceMappingURL=platform.js.map -// CONCATENATED MODULE: ./node_modules/@wordpress/components/node_modules/@wordpress/keycodes/build-module/index.js + var getTabs = function getTabs() { + var inbox = { + name: 'inbox', + title: Object(external_this_wp_i18n_["__"])('Inbox', 'woocommerce-admin'), + icon: Object(external_this_wp_element_["createElement"])(build_module_icon["a" /* default */], { + icon: library_inbox + }), + unread: hasUnreadNotes, + visible: (isEmbedded || !isHomescreen()) && !isPerformingSetupTask() + }; + var setup = { + name: 'setup', + title: Object(external_this_wp_i18n_["__"])('Store Setup', 'woocommerce-admin'), + icon: Object(external_this_wp_element_["createElement"])(setup_progress_SetupProgress, null), + onClick: function onClick() { + var currentLocation = window.location.href; + var homescreenLocation = Object(wc_admin_settings["f" /* getAdminLink */])('admin.php?page=wc-admin'); // Don't navigate if we're already on the homescreen, this will cause an infinite loop + if (currentLocation !== homescreenLocation) { + // Ensure that if the user is trying to get to the task list they can see it even if + // it was dismissed. + if (setupTaskListHidden === 'no') { + redirectToHomeScreen(); + } else { + updateOptions({ + woocommerce_task_list_hidden: 'no' + }).then(redirectToHomeScreen); + } + } + return null; + }, + visible: currentUserCan('manage_woocommerce') && !setupTaskListComplete && !setupTaskListHidden && !isPerformingSetupTask() && (!isHomescreen() || isEmbedded) + }; + var help = { + name: 'help', + title: Object(external_this_wp_i18n_["__"])('Help', 'woocommerce-admin'), + icon: Object(external_this_wp_element_["createElement"])(build_module_icon["a" /* default */], { + icon: library_help + }), + visible: isHomescreen() && !isEmbedded || isPerformingSetupTask() + }; + var displayOptions = { + component: display_options_DisplayOptions, + visible: !isEmbedded && isHomescreen() && !isPerformingSetupTask() + }; + return [inbox, setup, displayOptions, help].filter(function (tab) { + return tab.visible; + }); + }; -/** - * Note: The order of the modifier keys in many of the [foo]Shortcut() - * functions in this file are intentional and should not be changed. They're - * designed to fit with the standard menu keyboard shortcuts shown in the - * user's platform. - * - * For example, on MacOS menu shortcuts will place Shift before Command, but - * on Windows Control will usually come first. So don't provide your own - * shortcut combos directly to keyboardShortcut(). - */ + var getPanelContent = function getPanelContent(tab) { + var task = query.task; -/** - * External dependencies - */ + switch (tab) { + case 'inbox': + return Object(external_this_wp_element_["createElement"])(InboxPanel, null); -/** - * WordPress dependencies - */ + case 'help': + return Object(external_this_wp_element_["createElement"])(HelpPanel, { + taskName: task + }); + default: + return null; + } + }; -/** - * Internal dependencies - */ + var redirectToHomeScreen = function redirectToHomeScreen() { + if (Object(utils["f" /* isWCAdmin */])(window.location.href)) { + Object(external_this_wc_navigation_["getHistory"])().push(Object(external_this_wc_navigation_["getNewPath"])({}, '/', {})); + } else { + window.location.href = Object(wc_admin_settings["f" /* getAdminLink */])('admin.php?page=wc-admin'); + } + }; + var closedHelpPanelHighlight = function closedHelpPanelHighlight() { + Object(external_this_wc_tracks_["recordEvent"])('help_tooltip_click'); -/** - * @typedef {'primary'|'primaryShift'|'primaryAlt'|'secondary'|'access'|'ctrl'|'alt'|'ctrlShift'|'shift'|'shiftAlt'} WPKeycodeModifier - */ + if (userPreferencesData && userPreferencesData.updateUserPreferences) { + userPreferencesData.updateUserPreferences({ + help_panel_highlight_shown: 'yes' + }); + } + }; -/** - * An object of handler functions for each of the possible modifier - * combinations. A handler will return a value for a given key. - * - * @typedef {Recordany>} WPKeycodeHandlerByModifier - */ + var shouldShowHelpTooltip = function shouldShowHelpTooltip() { + var task = query.task; + var startedTasks = userPreferencesData && userPreferencesData.task_list_tracked_started_tasks; + var highlightShown = userPreferencesData && userPreferencesData.help_panel_highlight_shown; -/** - * Keycode for BACKSPACE key. - */ + if (task && highlightShown !== 'yes' && (startedTasks || {})[task] > 1 && !trackedCompletedTasks.includes(task)) { + return true; + } -var BACKSPACE = 8; -/** - * Keycode for TAB key. - */ + return false; + }; -var TAB = 9; -/** - * Keycode for ENTER key. - */ + var tabs = getTabs(); + var headerId = Object(external_lodash_["uniqueId"])('activity-panel-header_'); + var panelClasses = classnames_default()('woocommerce-layout__activity-panel', { + 'is-mobile-open': mobileOpen + }); + var showHelpHighlightTooltip = shouldShowHelpTooltip(); + var hasUnread = tabs.some(function (tab) { + return tab.unread; + }); + var viewLabel = hasUnread ? Object(external_this_wp_i18n_["__"])('View Activity Panel, you have unread activity', 'woocommerce-admin') : Object(external_this_wp_i18n_["__"])('View Activity Panel', 'woocommerce-admin'); + return Object(external_this_wp_element_["createElement"])("div", null, Object(external_this_wp_element_["createElement"])(external_this_wc_components_["H"], { + id: headerId, + className: "screen-reader-text" + }, Object(external_this_wp_i18n_["__"])('Store Activity', 'woocommerce-admin')), Object(external_this_wp_element_["createElement"])(external_this_wc_components_["Section"], { + component: "aside", + id: "woocommerce-activity-panel", + "aria-labelledby": headerId + }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], { + onClick: function onClick() { + toggleMobile(); + }, + label: mobileOpen ? Object(external_this_wp_i18n_["__"])('Close Activity Panel', 'woocommerce-admin') : viewLabel, + "aria-expanded": mobileOpen, + className: "woocommerce-layout__activity-panel-mobile-toggle" + }, mobileOpen ? Object(external_this_wp_element_["createElement"])(cross_small_default.a, null) : Object(external_this_wp_element_["createElement"])(toggle_bubble, { + hasUnread: hasUnread + })), Object(external_this_wp_element_["createElement"])("div", { + className: panelClasses + }, Object(external_this_wp_element_["createElement"])(tabs_Tabs, { + tabs: tabs, + tabOpen: isPanelOpen, + selectedTab: currentTab, + onTabClick: function onTabClick(tab, tabOpen) { + if (tab.onClick) { + tab.onClick(); + return; + } -var ENTER = 13; + togglePanel(tab, tabOpen); + } + }), Object(external_this_wp_element_["createElement"])(panel_Panel, { + currentTab: true, + isPanelOpen: isPanelOpen, + isPanelSwitching: isPanelSwitching, + tab: Object(external_lodash_["find"])(getTabs(), { + name: currentTab + }), + content: getPanelContent(currentTab), + closePanel: function closePanel() { + return _closePanel(); + }, + clearPanel: function clearPanel() { + return _clearPanel(); + } + }))), showHelpHighlightTooltip ? Object(external_this_wp_element_["createElement"])(HighlightTooltip, { + delay: 1000, + useAnchor: true, + title: Object(external_this_wp_i18n_["__"])("We're here for help", 'woocommerce-admin'), + content: Object(external_this_wp_i18n_["__"])('If you have any questions, feel free to explore the WooCommerce docs listed here.', 'woocommerce-admin'), + closeButtonText: Object(external_this_wp_i18n_["__"])('Got it', 'woocommerce-admin'), + id: "activity-panel-tab-help", + onClose: function onClose() { + return closedHelpPanelHighlight(); + }, + onShow: function onShow() { + return Object(external_this_wc_tracks_["recordEvent"])('help_tooltip_view'); + } + }) : null); +}; +activity_panel_ActivityPanel.defaultProps = { + getHistory: external_this_wc_navigation_["getHistory"] +}; +/* harmony default export */ var activity_panel = (activity_panel_ActivityPanel); +// CONCATENATED MODULE: ./client/lib/platform/index.js +var ANDROID_PLATFORM = 'android'; +var IOS_PLATFORM = 'ios'; +var UNKNOWN_PLATFORM = 'unknown'; /** - * Keycode for ESCAPE key. + * Provide basic detection of platform based on user agent. This is not + * a robust check for browser features or the like. You should only use + * this for non-critical display logic. */ -var ESCAPE = 27; -/** - * Keycode for SPACE key. - */ +var platform = function platform() { + if (/iPhone|iPad|iPod/i.test(window.navigator.userAgent)) { + return IOS_PLATFORM; + } else if (/Android/i.test(window.navigator.userAgent)) { + return ANDROID_PLATFORM; + } -var SPACE = 32; -/** - * Keycode for LEFT key. - */ + return UNKNOWN_PLATFORM; +}; +// CONCATENATED MODULE: ./client/mobile-banner/app-icon.js -var LEFT = 37; -/** - * Keycode for UP key. - */ +var app_icon_AppIcon = function AppIcon() { + return Object(external_this_wp_element_["createElement"])("svg", { + width: "37", + height: "37", + viewBox: "0 0 92 92", + fill: "none", + xmlns: "http://www.w3.org/2000/svg" + }, Object(external_this_wp_element_["createElement"])("rect", { + width: "92", + height: "92", + rx: "21.3953", + fill: "#7F54B3" + }), Object(external_this_wp_element_["createElement"])("path", { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M72.5937 28.043H19.8094C16.4781 28.0459 13.7783 30.7705 13.7754 34.1324V54.4501C13.7783 57.812 16.4781 60.5366 19.8094 60.5395H44.8229L56.2573 66.9607L53.6672 60.5395H72.599C74.2009 60.5402 75.7374 59.8983 76.8702 58.7552C78.0029 57.612 78.639 56.0614 78.6383 54.4447V34.1324C78.6376 32.5157 78.0002 30.9657 76.8664 29.8235C75.7327 28.6814 74.1956 28.0408 72.5937 28.043ZM19.1057 32.4208C18.4658 32.4324 17.8646 32.7359 17.467 33.2482C17.0888 33.7635 16.9404 34.4175 17.058 35.0502C18.5962 45.0986 20.0338 51.8757 21.371 55.3816C21.8779 56.658 22.4896 57.2703 23.2063 57.2185C24.3075 57.1489 25.6263 55.5968 27.1627 52.5621C27.9964 50.8412 29.2602 48.2662 30.9539 44.837C32.3785 49.88 34.309 53.6787 36.7456 56.2331C37.4291 56.9436 38.1204 57.2748 38.8195 57.2266C39.4185 57.1931 39.953 56.8315 40.217 56.2813C40.4753 55.7358 40.5806 55.1278 40.5211 54.5248C40.3516 52.0703 40.5919 48.667 41.2421 44.3149C41.9081 39.8057 42.7523 36.5818 43.7749 34.6432C43.9822 34.2526 44.0733 33.8087 44.037 33.366C44.0039 32.7587 43.7116 32.1969 43.2374 31.829C42.7745 31.4367 42.1799 31.2446 41.5803 31.2935C40.8334 31.3325 40.1682 31.7885 39.8499 32.4797C38.2331 35.5019 37.0812 40.4109 36.3943 47.2068C35.2823 44.2394 34.4509 41.1703 33.9114 38.0412C33.623 36.4613 32.9037 35.7125 31.7536 35.7946C30.9592 35.8589 30.3063 36.3944 29.7819 37.4012L24.0348 48.5643C23.0997 44.6692 22.2205 39.9289 21.3972 34.3433C21.1997 32.9652 20.4358 32.3244 19.1057 32.4208ZM69.9089 34.6877C71.6969 35.0381 73.2407 36.2 74.1186 37.8559C74.9693 39.3247 75.3946 41.1161 75.3946 43.23C75.4148 45.9567 74.7062 48.6357 73.3477 50.9687C71.7778 53.7023 69.7195 55.0691 67.1727 55.0691C66.6933 55.0668 66.2153 55.0128 65.7467 54.9078C63.9584 54.5581 62.4143 53.396 61.5371 51.7396C60.6864 50.2452 60.261 48.4411 60.261 46.3272C60.2357 43.6127 60.945 40.9454 62.3079 38.6295C63.9023 35.8959 65.9607 34.5291 68.4829 34.5291C68.9623 34.5304 69.4402 34.5836 69.9089 34.6877ZM68.7937 49.4848C69.7707 48.5773 70.4399 47.2269 70.8012 45.4337V45.4419C70.9315 44.7826 70.9959 44.1112 70.9933 43.4382C70.986 42.5849 70.8291 41.74 70.5302 40.9452C70.1443 39.901 69.6304 39.3124 68.9884 39.1793C68.0378 38.9643 67.1239 39.5256 66.2469 40.8632C65.5812 41.8393 65.109 42.9432 64.8577 44.1106C64.7276 44.7708 64.6632 45.4432 64.6657 46.1171C64.6739 46.9677 64.8308 47.8096 65.1287 48.6019C65.5146 49.6388 66.0294 50.2274 66.6731 50.3678C67.3169 50.5081 68.0237 50.2138 68.7937 49.4848ZM57.9079 37.8559C57.0291 36.2008 55.4854 35.0392 53.6976 34.6877C53.2279 34.5837 52.749 34.5306 52.2687 34.5291C49.7443 34.5291 47.6856 35.8959 46.0927 38.6295C44.7295 40.9454 44.0201 43.6127 44.0454 46.3272C44.0454 48.4411 44.4699 50.2452 45.319 51.7396C46.1976 53.3949 47.7414 54.5566 49.5294 54.9078C49.999 55.0126 50.4779 55.0667 50.9582 55.0691C53.5055 55.0691 55.5642 53.7023 57.1343 50.9687C58.4922 48.6355 59.2001 45.9565 59.1789 43.23C59.1789 41.1161 58.7544 39.3247 57.9053 37.8559H57.9079ZM54.5903 45.4337C54.2307 47.2269 53.5614 48.5773 52.5825 49.4848C51.8115 50.2065 51.101 50.5017 50.4589 50.3678C49.8169 50.2338 49.3011 49.6461 48.9169 48.6019C48.6181 47.8097 48.4603 46.9678 48.4511 46.1171C48.4495 45.4431 48.5148 44.7707 48.6459 44.1106C48.8971 42.9432 49.3694 41.8393 50.0353 40.8632C50.9124 39.5256 51.8264 38.9643 52.7773 39.1793C53.4193 39.3124 53.9333 39.901 54.3193 40.9452C54.617 41.7404 54.7739 42.585 54.7824 43.4382C54.785 44.1112 54.7207 44.7826 54.5903 45.4419V45.4337Z", + fill: "white" + })); +}; +// EXTERNAL MODULE: ./client/mobile-banner/style.scss +var mobile_banner_style = __webpack_require__(301); -var UP = 38; -/** - * Keycode for RIGHT key. - */ +// CONCATENATED MODULE: ./client/mobile-banner/constants.js +// The Play Store link is defined as an exported constant mainly for the sake of testing the Mobile App Banner. +// It is nearly impossible to fake navigation in JSDOM 16, so exposing this link for mocking allows us to +// avoid triggering a navigation. +var PLAY_STORE_LINK = 'https://play.google.com/store/apps/details?id=com.woocommerce.android'; +var TRACKING_EVENT_NAME = 'wcadmin_mobile_android_banner_click'; +// CONCATENATED MODULE: ./client/mobile-banner/index.js -var RIGHT = 39; -/** - * Keycode for DOWN key. - */ -var DOWN = 40; -/** - * Keycode for DELETE key. - */ -var DELETE = 46; /** - * Keycode for F10 key. + * External dependencies */ -var F10 = 121; -/** - * Keycode for ALT key. - */ -var ALT = 'alt'; -/** - * Keycode for CTRL key. - */ -var CTRL = 'ctrl'; -/** - * Keycode for COMMAND/META key. - */ -var COMMAND = 'meta'; /** - * Keycode for SHIFT key. + * Internal dependencies */ -var SHIFT = 'shift'; -/** - * Keycode for ZERO key. - */ -var ZERO = 48; -/** - * Object that contains functions that return the available modifier - * depending on platform. - * - * - `primary`: takes a isApple function as a parameter. - * - `primaryShift`: takes a isApple function as a parameter. - * - `primaryAlt`: takes a isApple function as a parameter. - * - `secondary`: takes a isApple function as a parameter. - * - `access`: takes a isApple function as a parameter. - * - `ctrl` - * - `alt` - * - `ctrlShift` - * - `shift` - * - `shiftAlt` - */ -var modifiers = { - primary: function primary(_isApple) { - return _isApple() ? [COMMAND] : [CTRL]; - }, - primaryShift: function primaryShift(_isApple) { - return _isApple() ? [SHIFT, COMMAND] : [CTRL, SHIFT]; - }, - primaryAlt: function primaryAlt(_isApple) { - return _isApple() ? [ALT, COMMAND] : [CTRL, ALT]; - }, - secondary: function secondary(_isApple) { - return _isApple() ? [SHIFT, ALT, COMMAND] : [CTRL, SHIFT, ALT]; - }, - access: function access(_isApple) { - return _isApple() ? [CTRL, ALT] : [SHIFT, ALT]; - }, - ctrl: function ctrl() { - return [CTRL]; - }, - alt: function alt() { - return [ALT]; - }, - ctrlShift: function ctrlShift() { - return [CTRL, SHIFT]; - }, - shift: function shift() { - return [SHIFT]; - }, - shiftAlt: function shiftAlt() { - return [SHIFT, ALT]; - } -}; -/** - * An object that contains functions to get raw shortcuts. - * E.g. rawShortcut.primary( 'm' ) will return 'meta+m' on Mac. - * These are intended for user with the KeyboardShortcuts component or TinyMCE. - * - * @type {WPKeycodeHandlerByModifier} Keyed map of functions to raw shortcuts. - */ -var rawShortcut = Object(external_lodash_["mapValues"])(modifiers, function (modifier) { - return function (character) { - var _isApple = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : isAppleOS; - return [].concat(Object(toConsumableArray["a" /* default */])(modifier(_isApple)), [character.toLowerCase()]).join('+'); - }; -}); -/** - * Return an array of the parts of a keyboard shortcut chord for display - * E.g displayShortcutList.primary( 'm' ) will return [ '⌘', 'M' ] on Mac. - * - * @type {WPKeycodeHandlerByModifier} Keyed map of functions to shortcut - * sequences. - */ +var SHOW_APP_BANNER_MODIFIER_CLASS = 'woocommerce-layout__show-app-banner'; +var mobile_banner_MobileAppBanner = function MobileAppBanner(_ref) { + var onInstall = _ref.onInstall, + onDismiss = _ref.onDismiss; + Object(external_this_wp_element_["useEffect"])(function () { + var layout = document.getElementsByClassName('woocommerce-layout')[0]; -var displayShortcutList = Object(external_lodash_["mapValues"])(modifiers, function (modifier) { - return function (character) { - var _replacementKeyMap; + if (platform() === ANDROID_PLATFORM) { + if (layout) { + // This is a hack to allow the mobile banner to work in the context of the header which is + // position fixed. This can be refactored away when we move away from the activity panel + // in future. + layout.classList.add(SHOW_APP_BANNER_MODIFIER_CLASS); + } + } - var _isApple = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : isAppleOS; + return function () { + if (layout) { + layout.classList.remove(SHOW_APP_BANNER_MODIFIER_CLASS); + } + }; + }, []); - var isApple = _isApple(); + var _useState = Object(external_this_wp_element_["useState"])(false), + _useState2 = slicedToArray_default()(_useState, 2), + isDismissed = _useState2[0], + setDismissed = _useState2[1]; // On iOS the "Smart App Banner" meta tag is used so only display this on Android. - var replacementKeyMap = (_replacementKeyMap = {}, Object(defineProperty["a" /* default */])(_replacementKeyMap, ALT, isApple ? '⌥' : 'Alt'), Object(defineProperty["a" /* default */])(_replacementKeyMap, CTRL, isApple ? '⌃' : 'Ctrl'), Object(defineProperty["a" /* default */])(_replacementKeyMap, COMMAND, '⌘'), Object(defineProperty["a" /* default */])(_replacementKeyMap, SHIFT, isApple ? '⇧' : 'Shift'), _replacementKeyMap); - var modifierKeys = modifier(_isApple).reduce(function (accumulator, key) { - var replacementKey = Object(external_lodash_["get"])(replacementKeyMap, key, key); // If on the Mac, adhere to platform convention and don't show plus between keys. - if (isApple) { - return [].concat(Object(toConsumableArray["a" /* default */])(accumulator), [replacementKey]); + if (platform() === ANDROID_PLATFORM && !isDismissed) { + return Object(external_this_wp_element_["createElement"])("div", { + className: "woocommerce-mobile-app-banner" + }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Icon"], { + icon: "no-alt", + "data-testid": "dismiss-btn", + onClick: function onClick() { + onDismiss(); + setDismissed(true); + Object(external_this_wc_tracks_["recordEvent"])(TRACKING_EVENT_NAME, { + action: 'dismiss' + }); + } + }), Object(external_this_wp_element_["createElement"])(app_icon_AppIcon, null), Object(external_this_wp_element_["createElement"])("div", { + className: "woocommerce-mobile-app-banner__description" + }, Object(external_this_wp_element_["createElement"])("p", { + className: "woocommerce-mobile-app-banner__description__text" + }, Object(external_this_wp_i18n_["__"])('Run your store from anywhere', 'woocommerce-admin')), Object(external_this_wp_element_["createElement"])("p", { + className: "woocommerce-mobile-app-banner__description__text" + }, Object(external_this_wp_i18n_["__"])('Download the WooCommerce app', 'woocommerce-admin'))), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], { + href: PLAY_STORE_LINK, + isSecondary: true, + onClick: function onClick() { + onInstall(); + setDismissed(true); + Object(external_this_wc_tracks_["recordEvent"])(TRACKING_EVENT_NAME, { + action: 'install' + }); } + }, Object(external_this_wp_i18n_["__"])('Install', 'woocommerce-admin'))); + } - return [].concat(Object(toConsumableArray["a" /* default */])(accumulator), [replacementKey, '+']); - }, []); - var capitalizedCharacter = Object(external_lodash_["capitalize"])(character); - return [].concat(Object(toConsumableArray["a" /* default */])(modifierKeys), [capitalizedCharacter]); - }; -}); -/** - * An object that contains functions to display shortcuts. - * E.g. displayShortcut.primary( 'm' ) will return '⌘M' on Mac. - * - * @type {WPKeycodeHandlerByModifier} Keyed map of functions to display - * shortcuts. - */ + return null; +}; +// CONCATENATED MODULE: ./client/hooks/useIsScrolled.js -var displayShortcut = Object(external_lodash_["mapValues"])(displayShortcutList, function (shortcutList) { - return function (character) { - var _isApple = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : isAppleOS; - return shortcutList(character, _isApple).join(''); - }; -}); /** - * An object that contains functions to return an aria label for a keyboard shortcut. - * E.g. shortcutAriaLabel.primary( '.' ) will return 'Command + Period' on Mac. - * - * @type {WPKeycodeHandlerByModifier} Keyed map of functions to shortcut ARIA - * labels. + * External dependencies */ -var shortcutAriaLabel = Object(external_lodash_["mapValues"])(modifiers, function (modifier) { - return function (character) { - var _replacementKeyMap2; +function useIsScrolled() { + var _useState = Object(external_this_wp_element_["useState"])(false), + _useState2 = slicedToArray_default()(_useState, 2), + isScrolled = _useState2[0], + setIsScrolled = _useState2[1]; - var _isApple = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : isAppleOS; + var rafHandle = Object(external_this_wp_element_["useRef"])(null); + Object(external_this_wp_element_["useEffect"])(function () { + var updateIsScrolled = function updateIsScrolled() { + setIsScrolled(window.pageYOffset > 20); + }; - var isApple = _isApple(); + var scrollListener = function scrollListener() { + rafHandle.current = window.requestAnimationFrame(updateIsScrolled); + }; + + window.addEventListener('scroll', scrollListener); + return function () { + window.removeEventListener('scroll', scrollListener); + window.cancelAnimationFrame(rafHandle.current); + }; + }, []); + return isScrolled; +} +// EXTERNAL MODULE: external {"this":["wp","plugins"]} +var external_this_wp_plugins_ = __webpack_require__(139); + +// EXTERNAL MODULE: ./client/navigation/style.scss +var navigation_style = __webpack_require__(302); + +// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/toConsumableArray.js +var toConsumableArray = __webpack_require__(19); +var toConsumableArray_default = /*#__PURE__*/__webpack_require__.n(toConsumableArray); + +// CONCATENATED MODULE: ./client/navigation/utils.js + + + +function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } + +function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { defineProperty_default()(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } - var replacementKeyMap = (_replacementKeyMap2 = {}, Object(defineProperty["a" /* default */])(_replacementKeyMap2, SHIFT, 'Shift'), Object(defineProperty["a" /* default */])(_replacementKeyMap2, COMMAND, isApple ? 'Command' : 'Control'), Object(defineProperty["a" /* default */])(_replacementKeyMap2, CTRL, 'Control'), Object(defineProperty["a" /* default */])(_replacementKeyMap2, ALT, isApple ? 'Option' : 'Alt'), Object(defineProperty["a" /* default */])(_replacementKeyMap2, ',', Object(external_this_wp_i18n_["__"])('Comma')), Object(defineProperty["a" /* default */])(_replacementKeyMap2, '.', Object(external_this_wp_i18n_["__"])('Period')), Object(defineProperty["a" /* default */])(_replacementKeyMap2, '`', Object(external_this_wp_i18n_["__"])('Backtick')), _replacementKeyMap2); - return [].concat(Object(toConsumableArray["a" /* default */])(modifier(_isApple)), [character]).map(function (key) { - return Object(external_lodash_["capitalize"])(Object(external_lodash_["get"])(replacementKeyMap, key, key)); - }).join(isApple ? ' ' : ' + '); - }; -}); /** - * From a given KeyboardEvent, returns an array of active modifier constants for - * the event. - * - * @param {KeyboardEvent} event Keyboard event. - * - * @return {Array} Active modifier constants. + * External dependencies */ -function getEventModifiers(event) { - return [ALT, CTRL, COMMAND, SHIFT].filter(function (key) { - return event["".concat(key, "Key")]; - }); -} /** - * An object that contains functions to check if a keyboard event matches a - * predefined shortcut combination. - * E.g. isKeyboardEvent.primary( event, 'm' ) will return true if the event - * signals pressing ⌘M. + * Get the full URL if a relative path is passed. * - * @type {WPKeycodeHandlerByModifier} Keyed map of functions to match events. + * @param {string} url URL + * @return {string} Full URL */ +var getFullUrl = function getFullUrl(url) { + var _window$location = window.location, + origin = _window$location.origin, + pathname = _window$location.pathname, + search = _window$location.search; -var isKeyboardEvent = Object(external_lodash_["mapValues"])(modifiers, function (getModifiers) { - return function (event, character) { - var _isApple = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : isAppleOS; - - var mods = getModifiers(_isApple); - var eventMods = getEventModifiers(event); + if (url.indexOf('#') === 0) { + return origin + pathname + search + url; + } - if (Object(external_lodash_["xor"])(mods, eventMods).length) { - return false; - } + if (url.indexOf('http') === 0) { + return url; + } - if (!character) { - return Object(external_lodash_["includes"])(mods, event.key.toLowerCase()); - } + return origin + url; +}; +/** + * Get a match score for a menu item given a location. + * + * @param {Object} location Window location + * @param {string} itemUrl URL to compare + * @param {string} itemExpression Custom match expression + * @return {number} Number of matches or 0 if not matched. + */ - return event.key === character; - }; -}); -//# sourceMappingURL=index.js.map +var getMatchScore = function getMatchScore(location, itemUrl) { + var itemExpression = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; -/***/ }), -/* 58 */ -/***/ (function(module, exports, __webpack_require__) { + if (!itemUrl) { + return; + } -var objectWithoutPropertiesLoose = __webpack_require__(150); + var fullUrl = getFullUrl(itemUrl); + var href = location.href; // Return highest possible score for exact match. -function _objectWithoutProperties(source, excluded) { - if (source == null) return {}; - var target = objectWithoutPropertiesLoose(source, excluded); - var key, i; + if (fullUrl === href) { + return Number.MAX_SAFE_INTEGER; + } - if (Object.getOwnPropertySymbols) { - var sourceSymbolKeys = Object.getOwnPropertySymbols(source); + var defaultExpression = utils_getDefaultMatchExpression(fullUrl); + var regexp = new RegExp(itemExpression || defaultExpression, 'i'); + return (decodeURIComponent(href).match(regexp) || []).length; +}; +/** + * Get a default expression to match the path and provided params. + * + * @param {string} url URL to match. + * @return {string} Regex expression. + */ - for (i = 0; i < sourceSymbolKeys.length; i++) { - key = sourceSymbolKeys[i]; - if (excluded.indexOf(key) >= 0) continue; - if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; - target[key] = source[key]; - } - } +var utils_getDefaultMatchExpression = function getDefaultMatchExpression(url) { + var escapedUrl = url.replace(/[-\/\\^$*+?.()|[\]{}]/gi, '\\$&'); - return target; -} + var _escapedUrl$split = escapedUrl.split(/\\\?|#/), + _escapedUrl$split2 = slicedToArray_default()(_escapedUrl$split, 3), + path = _escapedUrl$split2[0], + args = _escapedUrl$split2[1], + hash = _escapedUrl$split2[2]; -module.exports = _objectWithoutProperties; + var hashExpression = hash ? "(.*#".concat(hash, "$)") : ''; + var argsExpression = args ? args.split('&').reduce(function (acc, param) { + return "".concat(acc, "(?=.*[?|&]").concat(param, "(&|$|#))"); + }, '') : ''; + return '^' + path + argsExpression + hashExpression; +}; +/** + * Adds a listener that runs on history change. + * + * @param {Function} listener Listener to add on history change. + * @return {Function} Function to remove listeners. + */ -/***/ }), -/* 59 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { +var addHistoryListener = function addHistoryListener(listener) { + // Monkey patch pushState to allow trigger the pushstate event listener. + if (!window.wcNavigation.historyPatched) { + (function (history) { + /* global CustomEvent */ + var pushState = history.pushState; + var replaceState = history.replaceState; -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _unsupportedIterableToArray; }); -/* harmony import */ var _babel_runtime_helpers_esm_arrayLikeToArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(49); + history.pushState = function (state) { + var pushStateEvent = new CustomEvent('pushstate', { + state: state + }); + window.dispatchEvent(pushStateEvent); + return pushState.apply(history, arguments); + }; -function _unsupportedIterableToArray(o, minLen) { - if (!o) return; - if (typeof o === "string") return Object(_babel_runtime_helpers_esm_arrayLikeToArray__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(o, minLen); - var n = Object.prototype.toString.call(o).slice(8, -1); - if (n === "Object" && o.constructor) n = o.constructor.name; - if (n === "Map" || n === "Set") return Array.from(o); - if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return Object(_babel_runtime_helpers_esm_arrayLikeToArray__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(o, minLen); -} + history.replaceState = function (state) { + var replaceStateEvent = new CustomEvent('replacestate', { + state: state + }); + window.dispatchEvent(replaceStateEvent); + return replaceState.apply(history, arguments); + }; -/***/ }), -/* 60 */, -/* 61 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { + window.wcNavigation.historyPatched = true; + })(window.history); + } -"use strict"; -/* WEBPACK VAR INJECTION */(function(process) {/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _wordpress_warning__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(72); + window.addEventListener('popstate', listener); + window.addEventListener('pushstate', listener); + window.addEventListener('replacestate', listener); + return function () { + window.removeEventListener('popstate', listener); + window.removeEventListener('pushstate', listener); + window.removeEventListener('replacestate', listener); + }; +}; /** - * WordPress dependencies + * Get the closest matching item. + * + * @param {Array} items An array of items to match against. */ +var utils_getMatchingItem = function getMatchingItem(items) { + var matchedItem = null; + var highestMatchScore = 0; + items.forEach(function (item) { + var score = getMatchScore(window.location, Object(wc_admin_settings["f" /* getAdminLink */])(item.url), item.matchExpression); -var SlotFillContext = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createContext"])({ - slots: {}, - fills: {}, - registerSlot: function registerSlot() { - typeof process !== "undefined" && process.env && "production" !== "production" ? Object(_wordpress_warning__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])('Components must be wrapped within `SlotFillProvider`. ' + 'See https://developer.wordpress.org/block-editor/components/slot-fill/') : void 0; - }, - updateSlot: function updateSlot() {}, - unregisterSlot: function unregisterSlot() {}, - registerFill: function registerFill() {}, - unregisterFill: function unregisterFill() {} -}); -/* harmony default export */ __webpack_exports__["a"] = (SlotFillContext); -//# sourceMappingURL=slot-fill-context.js.map -/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(64))) - -/***/ }), -/* 62 */ -/***/ (function(module, exports) { + if (score > 0 && score >= highestMatchScore) { + highestMatchScore = score; + matchedItem = item; + } + }); + return matchedItem || null; +}; +/** + * Available menu IDs. + */ -function _arrayLikeToArray(arr, len) { - if (len == null || len > arr.length) len = arr.length; +var menuIds = ['primary', 'favorites', 'plugins', 'secondary']; +/** + * Default categories for the menu. + */ - for (var i = 0, arr2 = new Array(len); i < len; i++) { - arr2[i] = arr[i]; +var defaultCategories = { + woocommerce: { + id: 'woocommerce', + isCategory: true, + menuId: 'primary', + migrate: true, + order: 10, + parent: '', + title: 'WooCommerce' } +}; +/** + * Sort an array of menu items by their order property. + * + * @param {Array} menuItems Array of menu items. + * @return {Array} Sorted menu items. + */ - return arr2; -} +var sortMenuItems = function sortMenuItems(menuItems) { + return menuItems.sort(function (a, b) { + if (a.order === b.order) { + return a.title.localeCompare(b.title); + } -module.exports = _arrayLikeToArray; + return a.order - b.order; + }); +}; +/** + * Get a flat tree structure of all Categories and thier children grouped by menuId + * + * @param {Array} menuItems Array of menu items. + * @param {Function} currentUserCan Callback method passed the capability to determine if a menu item is visible. + * @return {Object} Mapped menu items and categories. + */ -/***/ }), -/* 63 */ -/***/ (function(module, exports, __webpack_require__) { +var getMappedItemsCategories = function getMappedItemsCategories(menuItems) { + var currentUserCan = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; -var arrayLikeToArray = __webpack_require__(62); + var categories = _objectSpread({}, defaultCategories); -function _unsupportedIterableToArray(o, minLen) { - if (!o) return; - if (typeof o === "string") return arrayLikeToArray(o, minLen); - var n = Object.prototype.toString.call(o).slice(8, -1); - if (n === "Object" && o.constructor) n = o.constructor.name; - if (n === "Map" || n === "Set") return Array.from(o); - if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray(o, minLen); -} + var items = sortMenuItems(menuItems).reduce(function (acc, item) { + // Set up the category if it doesn't yet exist. + if (!acc[item.parent]) { + acc[item.parent] = {}; + menuIds.forEach(function (menuId) { + acc[item.parent][menuId] = []; + }); + } // Incorrect menu ID. -module.exports = _unsupportedIterableToArray; -/***/ }), -/* 64 */ -/***/ (function(module, exports) { + if (!acc[item.parent][item.menuId]) { + return acc; + } // User does not have permission to view this item. -// shim for using process in browser -var process = module.exports = {}; -// cached from whatever global is present so that test runners that stub it -// don't break things. But we need to wrap it in a try catch in case it is -// wrapped in strict mode code which doesn't define any globals. It's inside a -// function because try/catches deoptimize in certain engines. + if (currentUserCan && item.capability && !currentUserCan(item.capability)) { + return acc; + } // Add categories. -var cachedSetTimeout; -var cachedClearTimeout; -function defaultSetTimout() { - throw new Error('setTimeout has not been defined'); -} -function defaultClearTimeout () { - throw new Error('clearTimeout has not been defined'); -} -(function () { - try { - if (typeof setTimeout === 'function') { - cachedSetTimeout = setTimeout; - } else { - cachedSetTimeout = defaultSetTimout; - } - } catch (e) { - cachedSetTimeout = defaultSetTimout; + if (item.isCategory) { + categories[item.id] = item; } - try { - if (typeof clearTimeout === 'function') { - cachedClearTimeout = clearTimeout; - } else { - cachedClearTimeout = defaultClearTimeout; - } - } catch (e) { - cachedClearTimeout = defaultClearTimeout; - } -} ()) -function runTimeout(fun) { - if (cachedSetTimeout === setTimeout) { - //normal enviroments in sane situations - return setTimeout(fun, 0); - } - // if setTimeout wasn't available but was latter defined - if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { - cachedSetTimeout = setTimeout; - return setTimeout(fun, 0); - } - try { - // when when somebody has screwed with setTimeout but no I.E. maddness - return cachedSetTimeout(fun, 0); - } catch(e){ - try { - // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally - return cachedSetTimeout.call(null, fun, 0); - } catch(e){ - // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error - return cachedSetTimeout.call(this, fun, 0); - } - } - - -} -function runClearTimeout(marker) { - if (cachedClearTimeout === clearTimeout) { - //normal enviroments in sane situations - return clearTimeout(marker); - } - // if clearTimeout wasn't available but was latter defined - if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { - cachedClearTimeout = clearTimeout; - return clearTimeout(marker); - } - try { - // when when somebody has screwed with setTimeout but no I.E. maddness - return cachedClearTimeout(marker); - } catch (e){ - try { - // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally - return cachedClearTimeout.call(null, marker); - } catch (e){ - // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. - // Some versions of I.E. have different rules for clearTimeout vs setTimeout - return cachedClearTimeout.call(this, marker); - } - } - - - -} -var queue = []; -var draining = false; -var currentQueue; -var queueIndex = -1; - -function cleanUpNextTick() { - if (!draining || !currentQueue) { - return; - } - draining = false; - if (currentQueue.length) { - queue = currentQueue.concat(queue); - } else { - queueIndex = -1; - } - if (queue.length) { - drainQueue(); - } -} - -function drainQueue() { - if (draining) { - return; - } - var timeout = runTimeout(cleanUpNextTick); - draining = true; - - var len = queue.length; - while(len) { - currentQueue = queue; - queue = []; - while (++queueIndex < len) { - if (currentQueue) { - currentQueue[queueIndex].run(); - } - } - queueIndex = -1; - len = queue.length; - } - currentQueue = null; - draining = false; - runClearTimeout(timeout); -} - -process.nextTick = function (fun) { - var args = new Array(arguments.length - 1); - if (arguments.length > 1) { - for (var i = 1; i < arguments.length; i++) { - args[i - 1] = arguments[i]; - } - } - queue.push(new Item(fun, args)); - if (queue.length === 1 && !draining) { - runTimeout(drainQueue); - } -}; - -// v8 likes predictible objects -function Item(fun, array) { - this.fun = fun; - this.array = array; -} -Item.prototype.run = function () { - this.fun.apply(null, this.array); -}; -process.title = 'browser'; -process.browser = true; -process.env = {}; -process.argv = []; -process.version = ''; // empty string to avoid regexp issues -process.versions = {}; - -function noop() {} - -process.on = noop; -process.addListener = noop; -process.once = noop; -process.off = noop; -process.removeListener = noop; -process.removeAllListeners = noop; -process.emit = noop; -process.prependListener = noop; -process.prependOnceListener = noop; - -process.listeners = function (name) { return [] } - -process.binding = function (name) { - throw new Error('process.binding is not supported'); -}; -process.cwd = function () { return '/' }; -process.chdir = function (dir) { - throw new Error('process.chdir is not supported'); + acc[item.parent][item.menuId].push(item); + return acc; + }, {}); + return { + items: items, + categories: categories + }; }; -process.umask = function() { return 0; }; - - -/***/ }), -/* 65 */, -/* 66 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; +// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/wordpress.js /** - * Internal dependencies; + * WordPress dependencies */ -var isShallowEqualObjects = __webpack_require__( 103 ); -var isShallowEqualArrays = __webpack_require__( 104 ); -var isArray = Array.isArray; +var wordpress = Object(external_this_wp_element_["createElement"])(svg["b" /* SVG */], { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "-2 -2 24 24" +}, Object(external_this_wp_element_["createElement"])(svg["a" /* Path */], { + d: "M20 10c0-5.51-4.49-10-10-10C4.48 0 0 4.49 0 10c0 5.52 4.48 10 10 10 5.51 0 10-4.48 10-10zM7.78 15.37L4.37 6.22c.55-.02 1.17-.08 1.17-.08.5-.06.44-1.13-.06-1.11 0 0-1.45.11-2.37.11-.18 0-.37 0-.58-.01C4.12 2.69 6.87 1.11 10 1.11c2.33 0 4.45.87 6.05 2.34-.68-.11-1.65.39-1.65 1.58 0 .74.45 1.36.9 2.1.35.61.55 1.36.55 2.46 0 1.49-1.4 5-1.4 5l-3.03-8.37c.54-.02.82-.17.82-.17.5-.05.44-1.25-.06-1.22 0 0-1.44.12-2.38.12-.87 0-2.33-.12-2.33-.12-.5-.03-.56 1.2-.06 1.22l.92.08 1.26 3.41zM17.41 10c.24-.64.74-1.87.43-4.25.7 1.29 1.05 2.71 1.05 4.25 0 3.29-1.73 6.24-4.4 7.78.97-2.59 1.94-5.2 2.92-7.78zM6.1 18.09C3.12 16.65 1.11 13.53 1.11 10c0-1.3.23-2.48.72-3.59C3.25 10.3 4.67 14.2 6.1 18.09zm4.03-6.63l2.58 6.98c-.86.29-1.76.45-2.71.45-.79 0-1.57-.11-2.29-.33.81-2.38 1.62-4.74 2.42-7.1z" +})); +/* harmony default export */ var library_wordpress = (wordpress); +//# sourceMappingURL=wordpress.js.map +// CONCATENATED MODULE: ./client/navigation/components/header/index.js + -/** - * @typedef {Record} ComparableObject - */ /** - * Returns true if the two arrays or objects are shallow equal, or false - * otherwise. - * - * @param {any[]|ComparableObject} a First object or array to compare. - * @param {any[]|ComparableObject} b Second object or array to compare. - * - * @return {boolean} Whether the two values are shallow equal. + * External dependencies */ -function isShallowEqual( a, b ) { - if ( a && b ) { - if ( a.constructor === Object && b.constructor === Object ) { - return isShallowEqualObjects( a, b ); - } else if ( isArray( a ) && isArray( b ) ) { - return isShallowEqualArrays( a, b ); - } - } - - return a === b; -} - -module.exports = isShallowEqual; -module.exports.isShallowEqualObjects = isShallowEqualObjects; -module.exports.isShallowEqualArrays = isShallowEqualArrays; - - -/***/ }), -/* 67 */, -/* 68 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* unused harmony export Button */ -/* harmony import */ var _babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7); -/* harmony import */ var _babel_runtime_helpers_esm_objectWithoutProperties__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(11); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(0); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_2__); -/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(4); -/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_3__); -/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(2); -/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_4__); -/* harmony import */ var _wordpress_deprecated__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(47); -/* harmony import */ var _tooltip__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(133); -/* harmony import */ var _icon__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(114); -function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; } -function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } -function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } -/** - * External dependencies - */ /** - * WordPress dependencies + * Internal dependencies */ -/** - * Internal dependencies - */ - +var header_Header = function Header() { + var siteTitle = Object(wc_admin_settings["g" /* getSetting */])('siteTitle', ''); + var homeUrl = Object(wc_admin_settings["g" /* getSetting */])('homeUrl', ''); + var isScrolled = useIsScrolled(); -var disabledEventsOnDisabledButton = ['onMouseDown', 'onClick']; -function Button(props, ref) { - var href = props.href, - target = props.target, - isPrimary = props.isPrimary, - isSmall = props.isSmall, - isTertiary = props.isTertiary, - isPressed = props.isPressed, - isBusy = props.isBusy, - isDefault = props.isDefault, - isSecondary = props.isSecondary, - isLink = props.isLink, - isDestructive = props.isDestructive, - className = props.className, - disabled = props.disabled, - icon = props.icon, - iconSize = props.iconSize, - showTooltip = props.showTooltip, - tooltipPosition = props.tooltipPosition, - shortcut = props.shortcut, - label = props.label, - children = props.children, - isFocusable = props.__experimentalIsFocusable, - additionalProps = Object(_babel_runtime_helpers_esm_objectWithoutProperties__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])(props, ["href", "target", "isPrimary", "isSmall", "isTertiary", "isPressed", "isBusy", "isDefault", "isSecondary", "isLink", "isDestructive", "className", "disabled", "icon", "iconSize", "showTooltip", "tooltipPosition", "shortcut", "label", "children", "__experimentalIsFocusable"]); + var _useState = Object(external_this_wp_element_["useState"])(document.body.classList.contains(false)), + _useState2 = slicedToArray_default()(_useState, 2), + isFolded = _useState2[0], + setIsFolded = _useState2[1]; - if (isDefault) { - Object(_wordpress_deprecated__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"])('Button isDefault prop', { - alternative: 'isSecondary' - }); - } + var navClasses = { + folded: 'is-wc-nav-folded', + expanded: 'is-wc-nav-expanded' + }; - var classes = classnames__WEBPACK_IMPORTED_MODULE_3___default()('components-button', className, { - 'is-secondary': isDefault || isSecondary, - 'is-primary': isPrimary, - 'is-small': isSmall, - 'is-tertiary': isTertiary, - 'is-pressed': isPressed, - 'is-busy': isBusy, - 'is-link': isLink, - 'is-destructive': isDestructive, - 'has-text': !!icon && !!children, - 'has-icon': !!icon - }); - var trulyDisabled = disabled && !isFocusable; - var Tag = href !== undefined && !trulyDisabled ? 'a' : 'button'; - var tagProps = Tag === 'a' ? { - href: href, - target: target - } : { - type: 'button', - disabled: trulyDisabled, - 'aria-pressed': isPressed + var foldNav = function foldNav() { + document.body.classList.add(navClasses.folded); + document.body.classList.remove(navClasses.expanded); + setIsFolded(true); }; - if (disabled && isFocusable) { - // In this case, the button will be disabled, but still focusable and - // perceivable by screen reader users. - tagProps['aria-disabled'] = true; + var expandNav = function expandNav() { + document.body.classList.remove(navClasses.folded); + document.body.classList.add(navClasses.expanded); + setIsFolded(false); + }; - var _iterator = _createForOfIteratorHelper(disabledEventsOnDisabledButton), - _step; + var toggleFolded = function toggleFolded() { + if (document.body.classList.contains(navClasses.folded)) { + expandNav(); + } else { + foldNav(); + } + }; - try { - for (_iterator.s(); !(_step = _iterator.n()).done;) { - var disabledEvent = _step.value; + var foldOnMobile = function foldOnMobile() { + var screenWidth = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document.body.clientWidth; - additionalProps[disabledEvent] = function (event) { - event.stopPropagation(); - event.preventDefault(); - }; - } - } catch (err) { - _iterator.e(err); - } finally { - _iterator.f(); + if (screenWidth <= 960) { + foldNav(); + } else { + expandNav(); } - } // Should show the tooltip if... - + }; - var shouldShowTooltip = !trulyDisabled && ( // an explicit tooltip is passed or... - showTooltip && label || // there's a shortcut or... - shortcut || // there's a label and... - !!label && ( // the children are empty and... - !children || Object(lodash__WEBPACK_IMPORTED_MODULE_4__["isArray"])(children) && !children.length) && // the tooltip is not explicitly disabled. - false !== showTooltip); - var element = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_2__["createElement"])(Tag, Object(_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])({}, tagProps, additionalProps, { - className: classes, - "aria-label": additionalProps['aria-label'] || label, - ref: ref - }), icon && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_2__["createElement"])(_icon__WEBPACK_IMPORTED_MODULE_7__[/* default */ "a"], { - icon: icon, - size: iconSize - }), children); - - if (!shouldShowTooltip) { - return element; - } + Object(external_this_wp_element_["useEffect"])(function () { + foldOnMobile(); + var foldEvents = [{ + eventName: 'orientationchange', + handler: function handler(e) { + return foldOnMobile(e.target.screen.availWidth); + } + }, { + eventName: 'resize', + handler: Object(external_lodash_["debounce"])(function () { + return foldOnMobile(); + }, 200) + }]; - return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_2__["createElement"])(_tooltip__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"], { - text: label, - shortcut: shortcut, - position: tooltipPosition - }, element); -} -/* harmony default export */ __webpack_exports__["a"] = (Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_2__["forwardRef"])(Button)); -//# sourceMappingURL=index.js.map + for (var _i = 0, _foldEvents = foldEvents; _i < _foldEvents.length; _i++) { + var _foldEvents$_i = _foldEvents[_i], + eventName = _foldEvents$_i.eventName, + handler = _foldEvents$_i.handler; + window.addEventListener(eventName, handler, false); + } -/***/ }), -/* 69 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { + addHistoryListener(function () { + return foldOnMobile(); + }); + }, []); + var buttonIcon = Object(external_this_wp_element_["createElement"])(build_module_icon["a" /* default */], { + size: "36px", + icon: library_wordpress + }); -"use strict"; + var _useSelect = Object(external_this_wp_data_["useSelect"])(function (select) { + var _select = select('core/data'), + isResolving = _select.isResolving; -// EXPORTS -__webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ build_module_focus; }); + var _select2 = select('core'), + getEntityRecord = _select2.getEntityRecord; -// UNUSED EXPORTS: isHorizontalEdge, isVerticalEdge, getRectangleFromRange, computeCaretRect, placeCaretAtHorizontalEdge, placeCaretAtVerticalEdge, isTextField, isNumberInput, documentHasTextSelection, documentHasUncollapsedSelection, documentHasSelection, isEntirelySelected, getScrollContainer, getOffsetParent, replace, remove, insertAfter, unwrap, replaceTag, wrap, __unstableStripHTML, isEmpty, removeInvalidHTML, getPhrasingContentSchema, isPhrasingContent, isTextContent + var siteData = getEntityRecord('root', '__unstableBase', undefined) || {}; + return { + isRequestingSiteIcon: isResolving('core', 'getEntityRecord', ['root', '__unstableBase', undefined]), + siteIconUrl: siteData.siteIconUrl + }; + }), + isRequestingSiteIcon = _useSelect.isRequestingSiteIcon, + siteIconUrl = _useSelect.siteIconUrl; -// NAMESPACE OBJECT: ./node_modules/@wordpress/components/node_modules/@wordpress/dom/build-module/focusable.js -var focusable_namespaceObject = {}; -__webpack_require__.r(focusable_namespaceObject); -__webpack_require__.d(focusable_namespaceObject, "find", function() { return find; }); + if (siteIconUrl) { + buttonIcon = Object(external_this_wp_element_["createElement"])("img", { + alt: Object(external_this_wp_i18n_["__"])('Site Icon'), + src: siteIconUrl + }); + } else if (isRequestingSiteIcon) { + buttonIcon = null; + } -// NAMESPACE OBJECT: ./node_modules/@wordpress/components/node_modules/@wordpress/dom/build-module/tabbable.js -var tabbable_namespaceObject = {}; -__webpack_require__.r(tabbable_namespaceObject); -__webpack_require__.d(tabbable_namespaceObject, "isTabbableIndex", function() { return isTabbableIndex; }); -__webpack_require__.d(tabbable_namespaceObject, "find", function() { return tabbable_find; }); -__webpack_require__.d(tabbable_namespaceObject, "findPrevious", function() { return findPrevious; }); -__webpack_require__.d(tabbable_namespaceObject, "findNext", function() { return findNext; }); + var className = classnames_default()('woocommerce-navigation-header', { + 'is-scrolled': isScrolled + }); + return Object(external_this_wp_element_["createElement"])("div", { + className: className + }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], { + onClick: function onClick() { + return toggleFolded(); + }, + className: "woocommerce-navigation-header__site-icon", + "aria-label": "Fold navigation", + role: "switch", + "aria-checked": isFolded ? 'true' : 'false' + }, buttonIcon), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], { + href: homeUrl, + className: "woocommerce-navigation-header__site-title", + as: "span" + }, Object(external_this_wp_htmlEntities_["decodeEntities"])(siteTitle))); +}; -// CONCATENATED MODULE: ./node_modules/@wordpress/components/node_modules/@wordpress/dom/build-module/focusable.js -/** - * References: - * - * Focusable: - * - https://www.w3.org/TR/html5/editing.html#focus-management - * - * Sequential focus navigation: - * - https://www.w3.org/TR/html5/editing.html#sequential-focus-navigation-and-the-tabindex-attribute - * - * Disabled elements: - * - https://www.w3.org/TR/html5/disabled-elements.html#disabled-elements - * - * getClientRects algorithm (requiring layout box): - * - https://www.w3.org/TR/cssom-view-1/#extension-to-the-element-interface - * - * AREA elements associated with an IMG: - * - https://w3c.github.io/html/editing.html#data-model - */ -var SELECTOR = ['[tabindex]', 'a[href]', 'button:not([disabled])', 'input:not([type="hidden"]):not([disabled])', 'select:not([disabled])', 'textarea:not([disabled])', 'iframe', 'object', 'embed', 'area[href]', '[contenteditable]:not([contenteditable=false])'].join(','); -/** - * Returns true if the specified element is visible (i.e. neither display: none - * nor visibility: hidden). - * - * @param {Element} element DOM element to test. - * - * @return {boolean} Whether element is visible. - */ +/* harmony default export */ var header = (header_Header); +// EXTERNAL MODULE: ./client/navigation/components/category-title/style.scss +var category_title_style = __webpack_require__(303); -function isVisible(element) { - return element.offsetWidth > 0 || element.offsetHeight > 0 || element.getClientRects().length > 0; -} -/** - * Returns true if the specified element should be skipped from focusable elements. - * For now it rather specific for `iframes` and if tabindex attribute is set to -1. - * - * @param {Element} element DOM element to test. - * - * @return {boolean} Whether element should be skipped from focusable elements. - */ +// EXTERNAL MODULE: ./client/navigation/components/favorite-button/style.scss +var favorite_button_style = __webpack_require__(304); + +// CONCATENATED MODULE: ./client/navigation/components/favorite-button/index.js -function skipFocus(element) { - return element.nodeName.toLowerCase() === 'iframe' && element.getAttribute('tabindex') === '-1'; -} /** - * Returns true if the specified area element is a valid focusable element, or - * false otherwise. Area is only focusable if within a map where a named map - * referenced by an image somewhere in the document. - * - * @param {Element} element DOM area element to test. - * - * @return {boolean} Whether area element is valid for focus. + * External dependencies */ -function isValidFocusableArea(element) { - var map = element.closest('map[name]'); - if (!map) { - return false; - } - var img = element.ownerDocument.querySelector('img[usemap="#' + map.name + '"]'); - return !!img && isVisible(img); -} + /** - * Returns all focusable elements within a given context. - * - * @param {Element} context Element in which to search. - * - * @return {Element[]} Focusable elements. + * Internal dependencies */ -function find(context) { - var elements = context.querySelectorAll(SELECTOR); - return Array.from(elements).filter(function (element) { - if (!isVisible(element) || skipFocus(element)) { - return false; - } +var favorite_button_FavoriteButton = function FavoriteButton(_ref) { + var id = _ref.id; - var nodeName = element.nodeName; + var _useSelect = Object(external_this_wp_data_["useSelect"])(function (select) { + return { + favorites: select(external_this_wc_data_["NAVIGATION_STORE_NAME"]).getFavorites(), + isResolving: select(external_this_wc_data_["NAVIGATION_STORE_NAME"]).isResolving('getFavorites') + }; + }), + favorites = _useSelect.favorites, + isResolving = _useSelect.isResolving; - if ('AREA' === nodeName) { - return isValidFocusableArea(element); - } + var _useDispatch = Object(external_this_wp_data_["useDispatch"])(external_this_wc_data_["NAVIGATION_STORE_NAME"]), + addFavorite = _useDispatch.addFavorite, + removeFavorite = _useDispatch.removeFavorite; - return true; + var isFavorited = favorites.includes(id); + + var toggleFavorite = function toggleFavorite() { + var toggle = isFavorited ? removeFavorite : addFavorite; + toggle(id); + Object(external_this_wc_tracks_["recordEvent"])('navigation_favorite', { + id: id, + action: isFavorited ? 'unfavorite' : 'favorite' + }); + }; + + if (isResolving) { + return null; + } + + return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], { + id: "woocommerce-navigation-favorite-button", + className: "woocommerce-navigation-favorite-button", + isTertiary: true, + onClick: toggleFavorite, + icon: isFavorited ? 'star-filled' : 'star-empty', + "aria-label": isFavorited ? Object(external_this_wp_i18n_["__"])('Add this item to your favorites.', 'woocommerce-admin') : Object(external_this_wp_i18n_["__"])('Remove this item from your favorites.', 'woocommerce-admin') }); -} -//# sourceMappingURL=focusable.js.map -// EXTERNAL MODULE: external "lodash" -var external_lodash_ = __webpack_require__(2); +}; +/* harmony default export */ var favorite_button = (favorite_button_FavoriteButton); +// CONCATENATED MODULE: ./client/navigation/components/favorites-tooltip/index.js + + -// CONCATENATED MODULE: ./node_modules/@wordpress/components/node_modules/@wordpress/dom/build-module/tabbable.js /** * External dependencies */ + + /** * Internal dependencies */ -/** - * Returns the tab index of the given element. In contrast with the tabIndex - * property, this normalizes the default (0) to avoid browser inconsistencies, - * operating under the assumption that this function is only ever called with a - * focusable node. - * - * @see https://bugzilla.mozilla.org/show_bug.cgi?id=1190261 - * - * @param {Element} element Element from which to retrieve. - * - * @return {?number} Tab index of element (default 0). - */ +var tooltipHiddenOption = 'woocommerce_navigation_favorites_tooltip_hidden'; +var favorites_tooltip_FavoritesTooltip = function FavoritesTooltip() { + var _useSelect = Object(external_this_wp_data_["useSelect"])(function (select) { + var _select = select(external_this_wc_data_["OPTIONS_STORE_NAME"]), + getOption = _select.getOption, + isResolving = _select.isResolving; -function getTabIndex(element) { - var tabIndex = element.getAttribute('tabindex'); - return tabIndex === null ? 0 : parseInt(tabIndex, 10); -} -/** - * Returns true if the specified element is tabbable, or false otherwise. - * - * @param {Element} element Element to test. - * - * @return {boolean} Whether element is tabbable. - */ + return { + isFavoritesResolving: select(external_this_wc_data_["NAVIGATION_STORE_NAME"]).isResolving('getFavorites'), + isOptionResolving: isResolving('getOption', [tooltipHiddenOption]), + isTooltipHidden: getOption(tooltipHiddenOption) === 'yes' + }; + }), + isFavoritesResolving = _useSelect.isFavoritesResolving, + isOptionResolving = _useSelect.isOptionResolving, + isTooltipHidden = _useSelect.isTooltipHidden; + + var _useDispatch = Object(external_this_wp_data_["useDispatch"])(external_this_wc_data_["OPTIONS_STORE_NAME"]), + updateOptions = _useDispatch.updateOptions; + + if (isFavoritesResolving || isTooltipHidden || isOptionResolving) { + return null; + } + + if (document.body.classList.contains('is-wc-nav-folded')) { + return null; + } + + return Object(external_this_wp_element_["createElement"])(HighlightTooltip, { + delay: 1000, + title: Object(external_this_wp_i18n_["__"])('Introducing favorites', 'woocommerce-admin'), + content: Object(external_this_wp_i18n_["__"])('You can now favorite your extensions to pin them in the top level of the navigation.', 'woocommerce-admin'), + closeButtonText: Object(external_this_wp_i18n_["__"])('Got it', 'woocommerce-admin'), + id: "woocommerce-navigation-favorite-button", + onClose: function onClose() { + return updateOptions(defineProperty_default()({}, tooltipHiddenOption, 'yes')); + }, + useAnchor: true + }); +}; +/* harmony default export */ var favorites_tooltip = (favorites_tooltip_FavoritesTooltip); +// CONCATENATED MODULE: ./client/navigation/components/category-title/index.js -function isTabbableIndex(element) { - return getTabIndex(element) !== -1; -} /** - * Returns a stateful reducer function which constructs a filtered array of - * tabbable elements, where at most one radio input is selected for a given - * name, giving priority to checked input, falling back to the first - * encountered. - * - * @return {Function} Radio group collapse reducer. + * Internal dependencies */ -function createStatefulCollapseRadioGroup() { - var CHOSEN_RADIO_BY_NAME = {}; - return function collapseRadioGroup(result, element) { - var nodeName = element.nodeName, - type = element.type, - checked = element.checked, - name = element.name; // For all non-radio tabbables, construct to array by concatenating. - - if (nodeName !== 'INPUT' || type !== 'radio' || !name) { - return result.concat(element); - } - var hasChosen = CHOSEN_RADIO_BY_NAME.hasOwnProperty(name); // Omit by skipping concatenation if the radio element is not chosen. - var isChosen = checked || !hasChosen; +var category_title_CategoryTitle = function CategoryTitle(_ref) { + var category = _ref.category; + var id = category.id, + title = category.title; + var className = 'woocommerce-navigation-category-title'; - if (!isChosen) { - return result; - } // At this point, if there had been a chosen element, the current - // element is checked and should take priority. Retroactively remove - // the element which had previously been considered the chosen one. + if (['plugins', 'favorites'].includes(category.menuId)) { + return Object(external_this_wp_element_["createElement"])("span", { + className: className + }, Object(external_this_wp_element_["createElement"])("span", { + className: "".concat(className, "__text") + }, title), Object(external_this_wp_element_["createElement"])(favorite_button_FavoriteButton, { + id: id + }), Object(external_this_wp_element_["createElement"])(favorites_tooltip_FavoritesTooltip, null)); + } + return Object(external_this_wp_element_["createElement"])("span", { + className: className + }, title); +}; +/* harmony default export */ var category_title = (category_title_CategoryTitle); +// CONCATENATED MODULE: ./client/navigation/components/Item/index.js - if (hasChosen) { - var hadChosenElement = CHOSEN_RADIO_BY_NAME[name]; - result = Object(external_lodash_["without"])(result, hadChosenElement); - } - CHOSEN_RADIO_BY_NAME[name] = element; - return result.concat(element); - }; -} /** - * An array map callback, returning an object with the element value and its - * array index location as properties. This is used to emulate a proper stable - * sort where equal tabIndex should be left in order of their occurrence in the - * document. - * - * @param {Element} element Element. - * @param {number} index Array index of element. - * - * @return {Object} Mapped object with element, index. + * External dependencies */ -function mapElementToObjectTabbable(element, index) { - return { - element: element, - index: index - }; -} -/** - * An array map callback, returning an element of the given mapped object's - * element value. - * - * @param {Object} object Mapped object with index. - * - * @return {Element} Mapped object element. - */ - -function mapObjectTabbableToElement(object) { - return object.element; -} -/** - * A sort comparator function used in comparing two objects of mapped elements. - * - * @see mapElementToObjectTabbable - * - * @param {Object} a First object to compare. - * @param {Object} b Second object to compare. - * - * @return {number} Comparator result. - */ +var Item_Item = function Item(_ref) { + var item = _ref.item; + var slot = Object(external_this_wc_navigation_["useNavSlot"])('woocommerce_navigation_' + item.id); + var hasFills = Boolean(slot.fills && slot.fills.length); -function compareObjectTabbables(a, b) { - var aTabIndex = getTabIndex(a.element); - var bTabIndex = getTabIndex(b.element); + var trackClick = function trackClick(id) { + Object(external_this_wc_tracks_["recordEvent"])('navigation_click', { + menu_item: id + }); + }; // Disable reason: The div wrapping the slot item is used for tracking purposes + // and should not be a tabbable element. - if (aTabIndex === bTabIndex) { - return a.index - b.index; - } + /* eslint-disable jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events */ + // Only render a slot if a coresponding Fill exists and the item is not a category - return aTabIndex - bTabIndex; -} -/** - * Givin focusable elements, filters out tabbable element. - * - * @param {Array} focusables Focusable elements to filter. - * - * @return {Array} Tabbable elements. - */ + if (hasFills && !item.isCategory) { + return Object(external_this_wp_element_["createElement"])(build_module["c" /* NavigationItem */], { + key: item.id, + item: item.id + }, Object(external_this_wp_element_["createElement"])("div", { + onClick: function onClick() { + return trackClick(item.id); + } + }, Object(external_this_wp_element_["createElement"])(external_this_wc_navigation_["WooNavigationItem"].Slot, { + name: item.id + }))); + } -function filterTabbable(focusables) { - return focusables.filter(isTabbableIndex).map(mapElementToObjectTabbable).sort(compareObjectTabbables).map(mapObjectTabbableToElement).reduce(createStatefulCollapseRadioGroup(), []); -} + return Object(external_this_wp_element_["createElement"])(build_module["c" /* NavigationItem */], { + key: item.id, + item: item.id, + title: item.title, + href: item.url, + navigateToMenu: !item.url && item.id, + onClick: function onClick() { + return trackClick(item.id); + }, + hideIfTargetMenuEmpty: true + }); + /* eslint-enable jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events */ +}; -function tabbable_find(context) { - return filterTabbable(find(context)); -} -/** - * Given a focusable element, find the preceding tabbable element. - * - * @param {Element} element The focusable element before which to look. Defaults - * to the active element. - */ +/* harmony default export */ var components_Item = (Item_Item); +// CONCATENATED MODULE: ./client/navigation/components/container/primary-menu.js -function findPrevious(element) { - var focusables = find(element.ownerDocument.body); - var index = focusables.indexOf(element); // Remove all focusables after and including `element`. - focusables.length = index; - return Object(external_lodash_["last"])(filterTabbable(focusables)); -} /** - * Given a focusable element, find the next tabbable element. - * - * @param {Element} element The focusable element after which to look. Defaults - * to the active element. + * External dependencies */ -function findNext(element) { - var focusables = find(element.ownerDocument.body); - var index = focusables.indexOf(element); // Remove all focusables before and inside `element`. - var remaining = focusables.slice(index + 1).filter(function (node) { - return !element.contains(node); - }); - return Object(external_lodash_["first"])(filterTabbable(remaining)); -} -//# sourceMappingURL=tabbable.js.map -// CONCATENATED MODULE: ./node_modules/@wordpress/components/node_modules/@wordpress/dom/build-module/index.js /** * Internal dependencies */ -/** - * Object grouping `focusable` and `tabbable` utils - * under the keys with the same name. - */ - -var build_module_focus = { - focusable: focusable_namespaceObject, - tabbable: tabbable_namespaceObject -}; - - -//# sourceMappingURL=index.js.map - -/***/ }), -/* 70 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { -"use strict"; -/* unused harmony export getPhrasingContentSchema */ -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return isPhrasingContent; }); -/* unused harmony export isTextContent */ -/* harmony import */ var _babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6); -/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2); -/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_1__); +var primary_menu_PrimaryMenu = function PrimaryMenu(_ref) { + var category = _ref.category, + onBackClick = _ref.onBackClick, + pluginItems = _ref.pluginItems, + primaryItems = _ref.primaryItems; + if (!primaryItems.length && !pluginItems.length) { + return null; + } -function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } + var _window$wcNavigation = window.wcNavigation, + rootBackLabel = _window$wcNavigation.rootBackLabel, + rootBackUrl = _window$wcNavigation.rootBackUrl; + var isRootBackVisible = category.id === 'woocommerce' && rootBackUrl; + return Object(external_this_wp_element_["createElement"])(build_module["d" /* NavigationMenu */], { + title: Object(external_this_wp_element_["createElement"])(category_title, { + category: category + }), + menu: category.id, + parentMenu: category.parent, + backButtonLabel: isRootBackVisible ? rootBackLabel : category.backButtonLabel || null, + onBackButtonClick: isRootBackVisible ? function () { + onBackClick('woocommerce'); + window.location = rootBackUrl; + } : function () { + return onBackClick(category.id); + } + }, !!primaryItems.length && Object(external_this_wp_element_["createElement"])(build_module["b" /* NavigationGroup */], null, primaryItems.map(function (item) { + return Object(external_this_wp_element_["createElement"])(components_Item, { + key: item.id, + item: item + }); + })), !!pluginItems.length && Object(external_this_wp_element_["createElement"])(build_module["b" /* NavigationGroup */], { + title: category.id === 'woocommerce' ? Object(external_this_wp_i18n_["__"])('Extensions', 'woocommerce-admin') : null + }, pluginItems.map(function (item) { + return Object(external_this_wp_element_["createElement"])(components_Item, { + key: item.id, + item: item + }); + }))); +}; +// CONCATENATED MODULE: ./client/navigation/components/container/secondary-menu.js -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { Object(_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } /** * External dependencies */ /** - * All phrasing content elements. - * - * @see https://www.w3.org/TR/2011/WD-html5-20110525/content-models.html#phrasing-content-0 + * Internal dependencies */ -/** - * All text-level semantic elements. - * - * @see https://html.spec.whatwg.org/multipage/text-level-semantics.html - */ -var textContentSchema = { - strong: {}, - em: {}, - s: {}, - del: {}, - ins: {}, - a: { - attributes: ['href', 'target', 'rel'] - }, - code: {}, - abbr: { - attributes: ['title'] - }, - sub: {}, - sup: {}, - br: {}, - small: {}, - // To do: fix blockquote. - // cite: {}, - q: { - attributes: ['cite'] - }, - dfn: { - attributes: ['title'] - }, - data: { - attributes: ['value'] - }, - time: { - attributes: ['datetime'] - }, - var: {}, - samp: {}, - kbd: {}, - i: {}, - b: {}, - u: {}, - mark: {}, - ruby: {}, - rt: {}, - rp: {}, - bdi: { - attributes: ['dir'] - }, - bdo: { - attributes: ['dir'] - }, - wbr: {}, - '#text': {} -}; // Recursion is needed. -// Possible: strong > em > strong. -// Impossible: strong > strong. - -Object(lodash__WEBPACK_IMPORTED_MODULE_1__["without"])(Object.keys(textContentSchema), '#text', 'br').forEach(function (tag) { - textContentSchema[tag].children = Object(lodash__WEBPACK_IMPORTED_MODULE_1__["omit"])(textContentSchema, tag); -}); -/** - * Embedded content elements. - * - * @see https://www.w3.org/TR/2011/WD-html5-20110525/content-models.html#embedded-content-0 - */ -var embeddedContentSchema = { - audio: { - attributes: ['src', 'preload', 'autoplay', 'mediagroup', 'loop', 'muted'] - }, - canvas: { - attributes: ['width', 'height'] - }, - embed: { - attributes: ['src', 'type', 'width', 'height'] - }, - img: { - attributes: ['alt', 'src', 'srcset', 'usemap', 'ismap', 'width', 'height'] - }, - object: { - attributes: ['data', 'type', 'name', 'usemap', 'form', 'width', 'height'] - }, - video: { - attributes: ['src', 'poster', 'preload', 'autoplay', 'mediagroup', 'loop', 'muted', 'controls', 'width', 'height'] +var secondary_menu_SecondaryMenu = function SecondaryMenu(_ref) { + var category = _ref.category, + items = _ref.items, + onBackClick = _ref.onBackClick; + + if (!items.length) { + return null; } + + var isRoot = category.id === 'woocommerce'; + return Object(external_this_wp_element_["createElement"])(build_module["d" /* NavigationMenu */], { + className: "components-navigation__menu-secondary", + title: !isRoot && Object(external_this_wp_element_["createElement"])(category_title, { + category: category + }), + menu: category.id, + parentMenu: category.parent, + backButtonLabel: category.backButtonLabel || null, + onBackButtonClick: isRoot ? null : function () { + return onBackClick(category.id); + } + }, Object(external_this_wp_element_["createElement"])(build_module["b" /* NavigationGroup */], { + onBackButtonClick: function onBackButtonClick() { + return onBackClick(category.id); + } + }, items.map(function (item) { + return Object(external_this_wp_element_["createElement"])(components_Item, { + key: item.id, + item: item + }); + }))); }; -/** - * Phrasing content elements. - * - * @see https://www.w3.org/TR/2011/WD-html5-20110525/content-models.html#phrasing-content-0 - */ +// CONCATENATED MODULE: ./client/navigation/components/container/index.js -var phrasingContentSchema = _objectSpread(_objectSpread({}, textContentSchema), embeddedContentSchema); -/** - * Get schema of possible paths for phrasing content. - * - * @see https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Content_categories#Phrasing_content - * - * @param {string} context Set to "paste" to exclude invisible elements and - * sensitive data. - * - * @return {Object} Schema. - */ -function getPhrasingContentSchema(context) { - if (context !== 'paste') { - return phrasingContentSchema; - } - return Object(lodash__WEBPACK_IMPORTED_MODULE_1__["omit"])(_objectSpread(_objectSpread({}, phrasingContentSchema), {}, { - // We shouldn't paste potentially sensitive information which is not - // visible to the user when pasted, so strip the attributes. - ins: { - children: phrasingContentSchema.ins.children - }, - del: { - children: phrasingContentSchema.del.children - } - }), ['u', // Used to mark misspelling. Shouldn't be pasted. - 'abbr', // Invisible. - 'data', // Invisible. - 'time', // Invisible. - 'wbr', // Invisible. - 'bdi', // Invisible. - 'bdo' // Invisible. - ]); -} /** - * Find out whether or not the given node is phrasing content. - * - * @see https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Content_categories#Phrasing_content - * - * @param {Element} node The node to test. - * - * @return {boolean} True if phrasing content, false if not. + * External dependencies */ -function isPhrasingContent(node) { - var tag = node.nodeName.toLowerCase(); - return getPhrasingContentSchema().hasOwnProperty(tag) || tag === 'span'; -} -function isTextContent(node) { - var tag = node.nodeName.toLowerCase(); - return textContentSchema.hasOwnProperty(tag) || tag === 'span'; -} -//# sourceMappingURL=phrasing-content.js.map - -/***/ }), -/* 71 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return useSlot; }); -/* harmony import */ var _babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(0); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _slot_fill_context__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(61); -function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { Object(_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } -/** - * WordPress dependencies - */ /** * Internal dependencies */ -function useSlot(name) { - var registry = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__["useContext"])(_slot_fill_context__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"]); - var slot = registry.slots[name] || {}; - var slotFills = registry.fills[name]; - var fills = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__["useMemo"])(function () { - return slotFills || []; - }, [slotFills]); - var updateSlot = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__["useCallback"])(function (fillProps) { - registry.updateSlot(name, fillProps); - }, [name, registry.updateSlot]); - var unregisterSlot = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__["useCallback"])(function (slotRef) { - registry.unregisterSlot(name, slotRef); - }, [name, registry.unregisterSlot]); - var registerFill = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__["useCallback"])(function (fillRef) { - registry.registerFill(name, fillRef); - }, [name, registry.registerFill]); - var unregisterFill = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__["useCallback"])(function (fillRef) { - registry.unregisterFill(name, fillRef); - }, [name, registry.unregisterFill]); - return _objectSpread(_objectSpread({}, slot), {}, { - updateSlot: updateSlot, - unregisterSlot: unregisterSlot, - fills: fills, - registerFill: registerFill, - unregisterFill: unregisterFill - }); -} -//# sourceMappingURL=use-slot.js.map - -/***/ }), -/* 72 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { -"use strict"; -/* WEBPACK VAR INJECTION */(function(process) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return warning; }); -function isDev() { - return typeof process !== 'undefined' && process.env && "production" !== 'production'; -} -/** - * Shows a warning with `message` if environment is not `production`. - * - * @param {string} message Message to show in the warning. - * - * @example - * ```js - * import warning from '@wordpress/warning'; - * - * function MyComponent( props ) { - * if ( ! props.title ) { - * warning( '`props.title` was not passed' ); - * } - * ... - * } - * ``` - */ -function warning(message) { - if (!isDev()) { - return; - } // eslint-disable-next-line no-console +var container_Container = function Container(_ref) { + var menuItems = _ref.menuItems; + Object(external_this_wp_element_["useEffect"])(function () { + // Collapse the original WP Menu. + document.documentElement.classList.remove('wp-toolbar'); + document.body.classList.add('has-woocommerce-navigation'); + var adminMenu = document.getElementById('adminmenumain'); - console.warn(message); // Throwing an error and catching it immediately to improve debugging - // A consumer can use 'pause on caught exceptions' - // https://github.com/facebook/react/issues/4216 + if (!adminMenu) { + return; + } - try { - throw Error(message); - } catch (x) {// do nothing - } -} -//# sourceMappingURL=index.js.map -/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(64))) + adminMenu.classList.add('folded'); + }, []); -/***/ }), -/* 73 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { + var _useState = Object(external_this_wp_element_["useState"])('woocommerce-home'), + _useState2 = slicedToArray_default()(_useState, 2), + activeItem = _useState2[0], + setActiveItem = _useState2[1]; -"use strict"; -function memoize(fn) { - var cache = {}; - return function (arg) { - if (cache[arg] === undefined) cache[arg] = fn(arg); - return cache[arg]; - }; -} + var _useState3 = Object(external_this_wp_element_["useState"])('woocommerce'), + _useState4 = slicedToArray_default()(_useState3, 2), + activeLevel = _useState4[0], + setActiveLevel = _useState4[1]; -/* harmony default export */ __webpack_exports__["a"] = (memoize); + Object(external_this_wp_element_["useEffect"])(function () { + var initialMatchedItem = utils_getMatchingItem(menuItems); + if (initialMatchedItem && activeItem !== initialMatchedItem) { + setActiveItem(initialMatchedItem); + setActiveLevel(initialMatchedItem.parent); + } -/***/ }), -/* 74 */ -/***/ (function(module, exports) { - -(function() { module.exports = this["wc"]["components"]; }()); - -/***/ }), -/* 75 */ -/***/ (function(module, exports) { - -function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { - try { - var info = gen[key](arg); - var value = info.value; - } catch (error) { - reject(error); - return; - } + var removeListener = addHistoryListener(function () { + setTimeout(function () { + var matchedItem = utils_getMatchingItem(menuItems); - if (info.done) { - resolve(value); - } else { - Promise.resolve(value).then(_next, _throw); - } -} + if (matchedItem) { + setActiveItem(matchedItem); + } + }, 0); + }); + return removeListener; + }, [menuItems]); -function _asyncToGenerator(fn) { - return function () { - var self = this, - args = arguments; - return new Promise(function (resolve, reject) { - var gen = fn.apply(self, args); + var _useUser = Object(external_this_wc_data_["useUser"])(), + currentUserCan = _useUser.currentUserCan; - function _next(value) { - asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); - } + var _useMemo = Object(external_this_wp_element_["useMemo"])(function () { + return getMappedItemsCategories(menuItems, currentUserCan); + }, [menuItems, currentUserCan]), + categories = _useMemo.categories, + items = _useMemo.items; - function _throw(err) { - asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); - } + var navDomRef = Object(external_this_wp_element_["useRef"])(null); - _next(undefined); + var onBackClick = function onBackClick(id) { + Object(external_this_wc_tracks_["recordEvent"])('navigation_back_click', { + category: id }); }; -} -module.exports = _asyncToGenerator; + var isRoot = activeLevel === 'woocommerce'; + var classes = classnames_default()('woocommerce-navigation', { + 'is-root': isRoot + }); + return Object(external_this_wp_element_["createElement"])("div", { + className: classes + }, Object(external_this_wp_element_["createElement"])(header, null), Object(external_this_wp_element_["createElement"])("div", { + className: "woocommerce-navigation__wrapper", + ref: navDomRef + }, Object(external_this_wp_element_["createElement"])(build_module["a" /* Navigation */], { + activeItem: activeItem ? activeItem.id : null, + activeMenu: activeLevel, + onActivateMenu: function onActivateMenu() { + if (navDomRef && navDomRef.current) { + navDomRef.current.scrollTop = 0; + } -/***/ }), -/* 76 */ -/***/ (function(module, exports) { + setActiveLevel.apply(void 0, arguments); + } + }, Object.values(categories).map(function (category) { + var categoryItems = items[category.id]; + return !!categoryItems && [Object(external_this_wp_element_["createElement"])(primary_menu_PrimaryMenu, { + key: category.id, + category: category, + onBackClick: onBackClick, + primaryItems: [].concat(toConsumableArray_default()(categoryItems.primary), toConsumableArray_default()(categoryItems.favorites)), + pluginItems: categoryItems.plugins + }), Object(external_this_wp_element_["createElement"])(secondary_menu_SecondaryMenu, { + key: "secondary/".concat(category.id), + category: category, + onBackClick: onBackClick, + items: categoryItems.secondary + })]; + })))); +}; -(function() { module.exports = this["wp"]["htmlEntities"]; }()); +/* harmony default export */ var container = (Object(external_this_wp_compose_["compose"])(Object(external_this_wp_data_["withSelect"])(function (select) { + var _select = select(external_this_wc_data_["NAVIGATION_STORE_NAME"]), + getActiveItem = _select.getActiveItem, + getMenuItems = _select.getMenuItems; + + return { + activeItem: getActiveItem(), + menuItems: getMenuItems() + }; +}))(container_Container)); +// CONCATENATED MODULE: ./client/navigation/index.js -/***/ }), -/* 77 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { -"use strict"; -/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2); -/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_0__); /** * External dependencies */ + + /** - * Given a function mapping a component to an enhanced component and modifier - * name, returns the enhanced component augmented with a generated displayName. - * - * @param {Function} mapComponentToEnhancedComponent Function mapping component - * to enhanced component. - * @param {string} modifierName Seed name from which to - * generated display name. - * - * @return {WPComponent} Component class with generated display name assigned. + * Internal dependencies */ -function createHigherOrderComponent(mapComponentToEnhancedComponent, modifierName) { - return function (OriginalComponent) { - var EnhancedComponent = mapComponentToEnhancedComponent(OriginalComponent); - var _OriginalComponent$di = OriginalComponent.displayName, - displayName = _OriginalComponent$di === void 0 ? OriginalComponent.name || 'Component' : _OriginalComponent$di; - EnhancedComponent.displayName = "".concat(Object(lodash__WEBPACK_IMPORTED_MODULE_0__["upperFirst"])(Object(lodash__WEBPACK_IMPORTED_MODULE_0__["camelCase"])(modifierName)), "(").concat(displayName, ")"); - return EnhancedComponent; - }; -} -/* harmony default export */ __webpack_exports__["a"] = (createHigherOrderComponent); -//# sourceMappingURL=index.js.map -/***/ }), -/* 78 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Circle; }); -/* unused harmony export G */ -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return Path; }); -/* unused harmony export Polygon */ -/* unused harmony export Rect */ -/* unused harmony export Defs */ -/* unused harmony export RadialGradient */ -/* unused harmony export LinearGradient */ -/* unused harmony export Stop */ -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return SVG; }); -/* harmony import */ var _babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6); -/* harmony import */ var _babel_runtime_helpers_esm_objectWithoutProperties__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(11); -/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(4); -/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_2__); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(0); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__); +var navigation_Navigation = function Navigation() { + return Object(external_this_wp_element_["createElement"])(external_this_wc_navigation_["NavSlotFillProvider"], null, Object(external_this_wp_element_["createElement"])(container, null), Object(external_this_wp_element_["createElement"])(external_this_wp_plugins_["PluginArea"], null)); +}; +var HydratedNavigation = Object(external_this_wc_data_["withNavigationHydration"])(window.wcNavigation)(navigation_Navigation); +/* harmony default export */ var navigation = (HydratedNavigation); +// CONCATENATED MODULE: ./client/header/index.js -function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { Object(_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } + +function header_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } + +function header_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { header_ownKeys(Object(source), true).forEach(function (key) { defineProperty_default()(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { header_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } /** * External dependencies */ -/** - * WordPress dependencies - */ -/** @typedef {{isPressed?: boolean} & import('react').ComponentPropsWithoutRef<'svg'>} SVGProps */ -/** - * @param {import('react').ComponentPropsWithoutRef<'circle'>} props - * - * @return {JSX.Element} Circle component - */ -var Circle = function Circle(props) { - return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])('circle', props); -}; -/** - * @param {import('react').ComponentPropsWithoutRef<'g'>} props - * - * @return {JSX.Element} G component - */ -var G = function G(props) { - return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])('g', props); -}; -/** - * @param {import('react').ComponentPropsWithoutRef<'path'>} props - * - * @return {JSX.Element} Path component - */ -var Path = function Path(props) { - return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])('path', props); -}; /** - * @param {import('react').ComponentPropsWithoutRef<'polygon'>} props - * - * @return {JSX.Element} Polygon component + * Internal dependencies */ -var Polygon = function Polygon(props) { - return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])('polygon', props); -}; -/** - * @param {import('react').ComponentPropsWithoutRef<'rect'>} props - * - * @return {JSX.Element} Rect component - */ -var Rect = function Rect(props) { - return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])('rect', props); -}; -/** - * @param {import('react').ComponentPropsWithoutRef<'defs'>} props - * - * @return {JSX.Element} Defs component - */ -var Defs = function Defs(props) { - return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])('defs', props); -}; -/** - * @param {import('react').ComponentPropsWithoutRef<'radialGradient'>} props - * - * @return {JSX.Element} RadialGradient component - */ -var RadialGradient = function RadialGradient(props) { - return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])('radialGradient', props); -}; -/** - * @param {import('react').ComponentPropsWithoutRef<'linearGradient'>} props - * - * @return {JSX.Element} LinearGradient component - */ -var LinearGradient = function LinearGradient(props) { - return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])('linearGradient', props); -}; -/** - * @param {import('react').ComponentPropsWithoutRef<'stop'>} props - * - * @return {JSX.Element} Stop component - */ -var Stop = function Stop(props) { - return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])('stop', props); -}; -/** - * - * @param {SVGProps} props isPressed indicates whether the SVG should appear as pressed. - * Other props will be passed through to svg component. - * - * @return {JSX.Element} Stop component - */ +var client_header_Header = function Header(_ref) { + var sections = _ref.sections, + _ref$isEmbedded = _ref.isEmbedded, + isEmbedded = _ref$isEmbedded === void 0 ? false : _ref$isEmbedded, + query = _ref.query; + var headerElement = Object(external_this_wp_element_["useRef"])(null); + var siteTitle = Object(wc_admin_settings["g" /* getSetting */])('siteTitle', ''); + var pageTitle = sections.slice(-1)[0]; + var isScrolled = useIsScrolled(); -var SVG = function SVG(_ref) { - var className = _ref.className, - isPressed = _ref.isPressed, - props = Object(_babel_runtime_helpers_esm_objectWithoutProperties__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])(_ref, ["className", "isPressed"]); + var _useUserPreferences = Object(external_this_wc_data_["useUserPreferences"])(), + updateUserPreferences = _useUserPreferences.updateUserPreferences, + userData = objectWithoutProperties_default()(_useUserPreferences, ["updateUserPreferences"]); - var appliedProps = _objectSpread(_objectSpread({}, props), {}, { - className: classnames__WEBPACK_IMPORTED_MODULE_2___default()(className, { - 'is-pressed': isPressed - }) || undefined, - role: 'img', - 'aria-hidden': true, - focusable: false - }); // Disable reason: We need to have a way to render HTML tag for web. - // eslint-disable-next-line react/forbid-elements + var isModalDismissed = userData.android_app_banner_dismissed === 'yes'; + var debounceTimer = null; + var className = classnames_default()('woocommerce-layout__header', { + 'is-scrolled': isScrolled + }); + Object(external_this_wp_element_["useLayoutEffect"])(function () { + updateBodyMargin(); + window.addEventListener('resize', updateBodyMargin); + return function () { + window.removeEventListener('resize', updateBodyMargin); + var wpBody = document.querySelector('#wpbody'); + if (!wpBody) { + return; + } - return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])("svg", appliedProps); -}; -//# sourceMappingURL=index.js.map + wpBody.style.marginTop = null; + }; + }, [isModalDismissed]); -/***/ }), -/* 79 */, -/* 80 */, -/* 81 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { + var updateBodyMargin = function updateBodyMargin() { + clearTimeout(debounceTimer); + debounceTimer = setTimeout(function () { + var wpBody = document.querySelector('#wpbody'); -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return domReady; }); -/** - * @typedef {() => void} Callback - * - * TODO: Remove this typedef and inline `() => void` type. - * - * This typedef is used so that a descriptive type is provided in our - * automatically generated documentation. - * - * An in-line type `() => void` would be preferable, but the generated - * documentation is `null` in that case. - * - * @see https://github.com/WordPress/gutenberg/issues/18045 - */ + if (!wpBody || !headerElement.current) { + return; + } -/** - * Specify a function to execute when the DOM is fully loaded. - * - * @param {Callback} callback A function to execute after the DOM is ready. - * - * @example - * ```js - * import domReady from '@wordpress/dom-ready'; - * - * domReady( function() { - * //do something after DOM loads. - * } ); - * ``` - * - * @return {void} - */ -function domReady(callback) { - if (document.readyState === 'complete' || // DOMContentLoaded + Images/Styles/etc loaded, so we call directly. - document.readyState === 'interactive' // DOMContentLoaded fires at this point, so we call directly. - ) { - return void callback(); - } // DOMContentLoaded has not fired yet, delay callback until then. - - - document.addEventListener('DOMContentLoaded', callback); -} -//# sourceMappingURL=index.js.map - -/***/ }), -/* 82 */ -/***/ (function(module, exports, __webpack_require__) { + wpBody.style.marginTop = "".concat(headerElement.current.offsetHeight, "px"); + }, 200); + }; -"use strict"; + Object(external_this_wp_element_["useEffect"])(function () { + if (!isEmbedded) { + var documentTitle = sections.map(function (section) { + return Array.isArray(section) ? section[1] : section; + }).reverse().join(' ‹ '); + var decodedTitle = Object(external_this_wp_htmlEntities_["decodeEntities"])(Object(external_this_wp_i18n_["sprintf"])( + /* translators: 1: document title. 2: page title */ + Object(external_this_wp_i18n_["__"])('%1$s ‹ %2$s — WooCommerce', 'woocommerce-admin'), documentTitle, siteTitle)); + if (document.title !== decodedTitle) { + document.title = decodedTitle; + } + } + }, [isEmbedded, sections, siteTitle]); -var stringify = __webpack_require__(136); -var parse = __webpack_require__(137); -var formats = __webpack_require__(99); + var dismissHandler = function dismissHandler() { + updateUserPreferences({ + android_app_banner_dismissed: 'yes' + }); + }; -module.exports = { - formats: formats, - parse: parse, - stringify: stringify + return Object(external_this_wp_element_["createElement"])("div", { + className: className, + ref: headerElement + }, !isModalDismissed && Object(external_this_wp_element_["createElement"])(mobile_banner_MobileAppBanner, { + onDismiss: dismissHandler, + onInstall: dismissHandler + }), Object(external_this_wp_element_["createElement"])("div", { + className: "woocommerce-layout__header-wrapper" + }, window.wcAdminFeatures.navigation && Object(external_this_wp_element_["createElement"])(navigation, null), Object(external_this_wp_element_["createElement"])(build_module["e" /* Text */], { + className: "woocommerce-layout__header-heading", + as: "h1", + variant: "subtitle.small" + }, Object(external_this_wp_htmlEntities_["decodeEntities"])(pageTitle)), window.wcAdminFeatures['activity-panels'] && Object(external_this_wp_element_["createElement"])(activity_panel, { + isEmbedded: isEmbedded, + query: query, + userPreferencesData: header_objectSpread(header_objectSpread({}, userData), {}, { + updateUserPreferences: updateUserPreferences + }) + }))); }; +// CONCATENATED MODULE: ./client/layout/notices.js -/***/ }), -/* 83 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { -"use strict"; -// EXPORTS -__webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ get_get; }); -// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js -var getPrototypeOf = __webpack_require__(9); -// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/superPropBase.js -function _superPropBase(object, property) { - while (!Object.prototype.hasOwnProperty.call(object, property)) { - object = Object(getPrototypeOf["a" /* default */])(object); - if (object === null) break; - } +function notices_createSuper(Derived) { var hasNativeReflectConstruct = notices_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = getPrototypeOf_default()(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = getPrototypeOf_default()(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return possibleConstructorReturn_default()(this, result); }; } - return object; -} -// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/get.js +function notices_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } -function get_get(target, property, receiver) { - if (typeof Reflect !== "undefined" && Reflect.get) { - get_get = Reflect.get; - } else { - get_get = function _get(target, property, receiver) { - var base = _superPropBase(target, property); - if (!base) return; - var desc = Object.getOwnPropertyDescriptor(base, property); +/** + * External dependencies + */ - if (desc.get) { - return desc.get.call(receiver); - } - return desc.value; - }; - } +var notices_Notices = /*#__PURE__*/function (_Component) { + inherits_default()(Notices, _Component); - return get_get(target, property, receiver || target); -} + var _super = notices_createSuper(Notices); -/***/ }), -/* 84 */, -/* 85 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { + function Notices() { + classCallCheck_default()(this, Notices); -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return useMediaQuery; }); -/* harmony import */ var _babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(24); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(0); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__); + return _super.apply(this, arguments); + } + createClass_default()(Notices, [{ + key: "render", + value: function render() { + return Object(external_this_wp_element_["createElement"])("div", { + id: "woocommerce-layout__notice-list", + className: "woocommerce-layout__notice-list" + }); + } + }]); -/** - * WordPress dependencies - */ + return Notices; +}(external_this_wp_element_["Component"]); -/** - * Runs a media query and returns its value when it changes. - * - * @param {string} [query] Media Query. - * @return {boolean} return value of the media query. - */ +/* harmony default export */ var layout_notices = (notices_Notices); +// EXTERNAL MODULE: ./node_modules/@babel/runtime/regenerator/index.js +var regenerator = __webpack_require__(8); +var regenerator_default = /*#__PURE__*/__webpack_require__.n(regenerator); -function useMediaQuery(query) { - var _useState = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__["useState"])(query && window.matchMedia(query).matches), - _useState2 = Object(_babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(_useState, 2), - match = _useState2[0], - setMatch = _useState2[1]; +// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/asyncToGenerator.js +var asyncToGenerator = __webpack_require__(44); +var asyncToGenerator_default = /*#__PURE__*/__webpack_require__.n(asyncToGenerator); - Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__["useEffect"])(function () { - if (!query) { - return; - } +// EXTERNAL MODULE: ./node_modules/react-spring/web.cjs.js +var web_cjs = __webpack_require__(182); - var updateMatch = function updateMatch() { - return setMatch(window.matchMedia(query).matches); - }; +// EXTERNAL MODULE: ./client/layout/transient-notices/snackbar/index.js +var snackbar = __webpack_require__(277); - updateMatch(); - var list = window.matchMedia(query); - list.addListener(updateMatch); - return function () { - list.removeListener(updateMatch); - }; - }, [query]); - return query && match; -} -//# sourceMappingURL=index.js.map +// CONCATENATED MODULE: ./client/layout/transient-notices/snackbar/list.js -/***/ }), -/* 86 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { -"use strict"; -/* unused harmony export BASE */ -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return G2; }); -/* unused harmony export DARK_GRAY */ -/* unused harmony export DARK_OPACITY */ -/* unused harmony export DARK_OPACITY_LIGHT */ -/* unused harmony export LIGHT_GRAY */ -/* unused harmony export LIGHT_OPACITY_LIGHT */ -/* unused harmony export BLUE */ -/* unused harmony export ALERT */ -/* unused harmony export ADMIN */ -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return UI; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return COLORS; }); -/* harmony import */ var _babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6); -/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2); -/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _colors__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(30); -function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { Object(_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } /** * External dependencies */ + + + + /** * Internal dependencies */ -var BASE = { - black: '#000', - white: '#fff' -}; /** - * TODO: Continue to update values as "G2" design evolves. + * Renders a list of notices. * - * "G2" refers to the movement to advance the interface of the block editor. - * https://github.com/WordPress/gutenberg/issues/18667 + * @param {Object} $0 Props passed to the component. + * @param {Array} $0.notices Array of notices to render. + * @param {Function} $0.onRemove Function called when a notice should be removed / dismissed. + * @param {Function} $0.onRemove2 Function called when a notice should be removed / dismissed. + * @param {Object} $0.className Name of the class used by the component. + * @param {Object} $0.children Array of children to be rendered inside the notice list. + * @return {Object} The rendered notices list. */ -var G2 = { - blue: { - medium: { - focus: '#007cba', - focusDark: '#fff' - } - }, - gray: { - 900: '#1e1e1e', - 700: '#757575', - // Meets 4.6:1 text contrast against white. - 600: '#949494', - // Meets 3:1 UI or large text contrast against white. - 400: '#ccc', - 200: '#ddd', - // Used for most borders. - 100: '#f0f0f0' - }, - darkGray: { - primary: '#1e1e1e' - }, - mediumGray: { - text: '#757575' - }, - lightGray: { - ui: '#949494', - secondary: '#ccc', - tertiary: '#e7e8e9' - } -}; -var DARK_GRAY = { - 900: '#191e23', - 800: '#23282d', - 700: '#32373c', - 600: '#40464d', - 500: '#555d66', - // Use this most of the time for dark items. - 400: '#606a73', - 300: '#6c7781', - // Lightest gray that can be used for AA text contrast. - 200: '#7e8993', - 150: '#8d96a0', - // Lightest gray that can be used for AA non-text contrast. - 100: '#8f98a1' -}; -var DARK_OPACITY = { - 900: Object(_colors__WEBPACK_IMPORTED_MODULE_2__[/* rgba */ "b"])('#000510', 0.9), - 800: Object(_colors__WEBPACK_IMPORTED_MODULE_2__[/* rgba */ "b"])('#00000a', 0.85), - 700: Object(_colors__WEBPACK_IMPORTED_MODULE_2__[/* rgba */ "b"])('#06060b', 0.8), - 600: Object(_colors__WEBPACK_IMPORTED_MODULE_2__[/* rgba */ "b"])('#000913', 0.75), - 500: Object(_colors__WEBPACK_IMPORTED_MODULE_2__[/* rgba */ "b"])('#0a1829', 0.7), - 400: Object(_colors__WEBPACK_IMPORTED_MODULE_2__[/* rgba */ "b"])('#0a1829', 0.65), - 300: Object(_colors__WEBPACK_IMPORTED_MODULE_2__[/* rgba */ "b"])('#0e1c2e', 0.62), - 200: Object(_colors__WEBPACK_IMPORTED_MODULE_2__[/* rgba */ "b"])('#162435', 0.55), - 100: Object(_colors__WEBPACK_IMPORTED_MODULE_2__[/* rgba */ "b"])('#223443', 0.5), - backgroundFill: Object(_colors__WEBPACK_IMPORTED_MODULE_2__[/* rgba */ "b"])(DARK_GRAY[700], 0.7) -}; -var DARK_OPACITY_LIGHT = { - 900: Object(_colors__WEBPACK_IMPORTED_MODULE_2__[/* rgba */ "b"])('#304455', 0.45), - 800: Object(_colors__WEBPACK_IMPORTED_MODULE_2__[/* rgba */ "b"])('#425863', 0.4), - 700: Object(_colors__WEBPACK_IMPORTED_MODULE_2__[/* rgba */ "b"])('#667886', 0.35), - 600: Object(_colors__WEBPACK_IMPORTED_MODULE_2__[/* rgba */ "b"])('#7b86a2', 0.3), - 500: Object(_colors__WEBPACK_IMPORTED_MODULE_2__[/* rgba */ "b"])('#9197a2', 0.25), - 400: Object(_colors__WEBPACK_IMPORTED_MODULE_2__[/* rgba */ "b"])('#95959c', 0.2), - 300: Object(_colors__WEBPACK_IMPORTED_MODULE_2__[/* rgba */ "b"])('#829493', 0.15), - 200: Object(_colors__WEBPACK_IMPORTED_MODULE_2__[/* rgba */ "b"])('#8b8b96', 0.1), - 100: Object(_colors__WEBPACK_IMPORTED_MODULE_2__[/* rgba */ "b"])('#747474', 0.05) -}; -var LIGHT_GRAY = { - 900: '#a2aab2', - 800: '#b5bcc2', - 700: '#ccd0d4', - 600: '#d7dade', - 500: '#e2e4e7', - // Good for "grayed" items and borders. - 400: '#e8eaeb', - // Good for "readonly" input fields and special text selection. - 300: '#edeff0', - 200: '#f3f4f5', - 100: '#f8f9f9' -}; -var LIGHT_OPACITY_LIGHT = { - 900: Object(_colors__WEBPACK_IMPORTED_MODULE_2__[/* rgba */ "b"])(BASE.white, 0.5), - 800: Object(_colors__WEBPACK_IMPORTED_MODULE_2__[/* rgba */ "b"])(BASE.white, 0.45), - 700: Object(_colors__WEBPACK_IMPORTED_MODULE_2__[/* rgba */ "b"])(BASE.white, 0.4), - 600: Object(_colors__WEBPACK_IMPORTED_MODULE_2__[/* rgba */ "b"])(BASE.white, 0.35), - 500: Object(_colors__WEBPACK_IMPORTED_MODULE_2__[/* rgba */ "b"])(BASE.white, 0.3), - 400: Object(_colors__WEBPACK_IMPORTED_MODULE_2__[/* rgba */ "b"])(BASE.white, 0.25), - 300: Object(_colors__WEBPACK_IMPORTED_MODULE_2__[/* rgba */ "b"])(BASE.white, 0.2), - 200: Object(_colors__WEBPACK_IMPORTED_MODULE_2__[/* rgba */ "b"])(BASE.white, 0.15), - 100: Object(_colors__WEBPACK_IMPORTED_MODULE_2__[/* rgba */ "b"])(BASE.white, 0.1), - backgroundFill: Object(_colors__WEBPACK_IMPORTED_MODULE_2__[/* rgba */ "b"])(LIGHT_GRAY[300], 0.8) -}; // Additional colors. -// Some are from https://make.wordpress.org/design/handbook/foundations/colors/. - -var BLUE = { - wordpress: { - 700: '#00669b' - }, - dark: { - 900: '#0071a1' - }, - medium: { - 900: '#006589', - 800: '#00739c', - 700: '#007fac', - 600: '#008dbe', - 500: '#00a0d2', - 400: '#33b3db', - 300: '#66c6e4', - 200: '#bfe7f3', - 100: '#e5f5fa', - highlight: '#b3e7fe', - focus: '#007cba' - } -}; -var ALERT = { - yellow: '#f0b849', - red: '#d94f4f', - green: '#4ab866' -}; -var ADMIN = { - theme: "var( --wp-admin-theme-color, ".concat(BLUE.wordpress[700], ")"), - themeDark10: "var( --wp-admin-theme-color-darker-10, ".concat(BLUE.medium.focus, ")") -}; // Namespaced values for raw colors hex codes - -var UI = { - theme: ADMIN.theme, - background: BASE.white, - backgroundDisabled: LIGHT_GRAY[200], - border: G2.gray[700], - borderFocus: ADMIN.themeDark10, - borderDisabled: G2.gray[400], - borderLight: G2.gray[200], - label: DARK_GRAY[500], - textDisabled: DARK_GRAY[150], - textDark: BASE.white, - textLight: BASE.black -}; -var COLORS = _objectSpread(_objectSpread({}, BASE), {}, { - darkGray: Object(lodash__WEBPACK_IMPORTED_MODULE_1__["merge"])({}, DARK_GRAY, G2.darkGray), - darkOpacity: DARK_OPACITY, - darkOpacityLight: DARK_OPACITY_LIGHT, - mediumGray: G2.mediumGray, - lightGray: Object(lodash__WEBPACK_IMPORTED_MODULE_1__["merge"])({}, LIGHT_GRAY, G2.lightGray), - lightGrayLight: LIGHT_OPACITY_LIGHT, - blue: Object(lodash__WEBPACK_IMPORTED_MODULE_1__["merge"])({}, BLUE, G2.blue), - alert: ALERT, - admin: ADMIN, - ui: UI -}); -/* unused harmony default export */ var _unused_webpack_default_export = (COLORS); -//# sourceMappingURL=colors-values.js.map +function SnackbarList(_ref) { + var notices = _ref.notices, + className = _ref.className, + children = _ref.children, + _ref$onRemove = _ref.onRemove, + onRemove = _ref$onRemove === void 0 ? external_lodash_["noop"] : _ref$onRemove, + _ref$onRemove2 = _ref.onRemove2, + onRemove2 = _ref$onRemove2 === void 0 ? external_lodash_["noop"] : _ref$onRemove2; + var isReducedMotion = Object(external_this_wp_compose_["useReducedMotion"])(); -/***/ }), -/* 87 */ -/***/ (function(module, exports, __webpack_require__) { + var _useState = Object(external_this_wp_element_["useState"])(function () { + return new WeakMap(); + }), + _useState2 = slicedToArray_default()(_useState, 1), + refMap = _useState2[0]; -"use strict"; + var transitions = Object(web_cjs["useTransition"])(notices, function (notice) { + return notice.id; + }, { + from: { + opacity: 0, + height: 0 + }, + enter: function enter(item) { + return /*#__PURE__*/function () { + var _ref2 = asyncToGenerator_default()( /*#__PURE__*/regenerator_default.a.mark(function _callee(next) { + return regenerator_default.a.wrap(function _callee$(_context) { + while (1) { + switch (_context.prev = _context.next) { + case 0: + _context.next = 2; + return next({ + opacity: 1, + height: refMap.get(item).offsetHeight + }); + case 2: + return _context.abrupt("return", _context.sent); -var has = Object.prototype.hasOwnProperty; -var isArray = Array.isArray; + case 3: + case "end": + return _context.stop(); + } + } + }, _callee); + })); -var hexTable = (function () { - var array = []; - for (var i = 0; i < 256; ++i) { - array.push('%' + ((i < 16 ? '0' : '') + i.toString(16)).toUpperCase()); - } + return function (_x) { + return _ref2.apply(this, arguments); + }; + }(); + }, + leave: function leave() { + return /*#__PURE__*/function () { + var _ref3 = asyncToGenerator_default()( /*#__PURE__*/regenerator_default.a.mark(function _callee2(next) { + return regenerator_default.a.wrap(function _callee2$(_context2) { + while (1) { + switch (_context2.prev = _context2.next) { + case 0: + _context2.next = 2; + return next({ + opacity: 0 + }); - return array; -}()); + case 2: + _context2.next = 4; + return next({ + height: 0 + }); -var compactQueue = function compactQueue(queue) { - while (queue.length > 1) { - var item = queue.pop(); - var obj = item.obj[item.prop]; + case 4: + case "end": + return _context2.stop(); + } + } + }, _callee2); + })); - if (isArray(obj)) { - var compacted = []; + return function (_x2) { + return _ref3.apply(this, arguments); + }; + }(); + }, + immediate: isReducedMotion + }); + className = classnames_default()('components-snackbar-list', className); - for (var j = 0; j < obj.length; ++j) { - if (typeof obj[j] !== 'undefined') { - compacted.push(obj[j]); - } - } + var removeNotice = function removeNotice(notice) { + return function () { + onRemove(notice.id); // To be removed when we're no longer using core/notices2. - item.obj[item.prop] = compacted; - } - } -}; - -var arrayToObject = function arrayToObject(source, options) { - var obj = options && options.plainObjects ? Object.create(null) : {}; - for (var i = 0; i < source.length; ++i) { - if (typeof source[i] !== 'undefined') { - obj[i] = source[i]; - } - } - - return obj; -}; + onRemove2(notice.id); + }; + }; -var merge = function merge(target, source, options) { - /* eslint no-param-reassign: 0 */ - if (!source) { - return target; - } + return Object(external_this_wp_element_["createElement"])("div", { + className: className + }, children, transitions.map(function (_ref4) { + var notice = _ref4.item, + key = _ref4.key, + style = _ref4.props; + return Object(external_this_wp_element_["createElement"])(web_cjs["animated"].div, { + key: key, + style: style + }, Object(external_this_wp_element_["createElement"])("div", { + className: "components-snackbar-list__notice-container", + ref: function ref(_ref5) { + return _ref5 && refMap.set(notice, _ref5); + } + }, Object(external_this_wp_element_["createElement"])(snackbar["a" /* default */], extends_default()({}, Object(external_lodash_["omit"])(notice, ['content']), { + onRemove: removeNotice(notice) + }), notice.content))); + })); +} - if (typeof source !== 'object') { - if (isArray(target)) { - target.push(source); - } else if (target && typeof target === 'object') { - if ((options && (options.plainObjects || options.allowPrototypes)) || !has.call(Object.prototype, source)) { - target[source] = true; - } - } else { - return [target, source]; - } +/* harmony default export */ var list = (SnackbarList); +// EXTERNAL MODULE: ./client/layout/transient-notices/style.scss +var transient_notices_style = __webpack_require__(306); - return target; - } +// CONCATENATED MODULE: ./client/layout/transient-notices/index.js - if (!target || typeof target !== 'object') { - return [target].concat(source); - } - var mergeTarget = target; - if (isArray(target) && !isArray(source)) { - mergeTarget = arrayToObject(target, options); - } +/** + * External dependencies + */ - if (isArray(target) && isArray(source)) { - source.forEach(function (item, i) { - if (has.call(target, i)) { - var targetItem = target[i]; - if (targetItem && typeof targetItem === 'object' && item && typeof item === 'object') { - target[i] = merge(targetItem, item, options); - } else { - target.push(item); - } - } else { - target[i] = item; - } - }); - return target; - } - return Object.keys(source).reduce(function (acc, key) { - var value = source[key]; - if (has.call(acc, key)) { - acc[key] = merge(acc[key], value, options); - } else { - acc[key] = value; - } - return acc; - }, mergeTarget); -}; +/** + * Internal dependencies + */ -var assign = function assignSingleSource(target, source) { - return Object.keys(source).reduce(function (acc, key) { - acc[key] = source[key]; - return acc; - }, target); -}; -var decode = function (str, decoder, charset) { - var strWithoutPlus = str.replace(/\+/g, ' '); - if (charset === 'iso-8859-1') { - // unescape never throws, no try...catch needed: - return strWithoutPlus.replace(/%[0-9a-f]{2}/gi, unescape); - } - // utf-8 - try { - return decodeURIComponent(strWithoutPlus); - } catch (e) { - return strWithoutPlus; - } -}; -var encode = function encode(str, defaultEncoder, charset) { - // This code was originally written by Brian White (mscdex) for the io.js core querystring library. - // It has been adapted here for stricter adherence to RFC 3986 - if (str.length === 0) { - return str; - } - var string = str; - if (typeof str === 'symbol') { - string = Symbol.prototype.toString.call(str); - } else if (typeof str !== 'string') { - string = String(str); - } +function TransientNotices(props) { + var _useDispatch = Object(external_this_wp_data_["useDispatch"])('core/notices'), + onRemove = _useDispatch.removeNotice; - if (charset === 'iso-8859-1') { - return escape(string).replace(/%u[0-9a-f]{4}/gi, function ($0) { - return '%26%23' + parseInt($0.slice(2), 16) + '%3B'; - }); - } + var _useDispatch2 = Object(external_this_wp_data_["useDispatch"])('core/notices2'), + onRemove2 = _useDispatch2.removeNotice; - var out = ''; - for (var i = 0; i < string.length; ++i) { - var c = string.charCodeAt(i); + var noticeData = Object(external_this_wp_data_["useSelect"])(function (select) { + // NOTE: This uses core/notices2, if this file is copied back upstream + // to Gutenberg this needs to be changed back to just core/notices. + var notices = select('core/notices').getNotices(); + var notices2 = select('core/notices2').getNotices(); + return { + notices: notices, + notices2: notices2 + }; + }); + /** + * Combines the two notices in the component vs in the useSelect, as we don't want to + * create new object references on each useSelect call. + */ - if ( - c === 0x2D // - - || c === 0x2E // . - || c === 0x5F // _ - || c === 0x7E // ~ - || (c >= 0x30 && c <= 0x39) // 0-9 - || (c >= 0x41 && c <= 0x5A) // a-z - || (c >= 0x61 && c <= 0x7A) // A-Z - ) { - out += string.charAt(i); - continue; - } + var getNotices = function getNotices() { + var notices = noticeData.notices, + _noticeData$notices = noticeData.notices2, + notices2 = _noticeData$notices === void 0 ? [] : _noticeData$notices; + return notices.concat(notices2); + }; - if (c < 0x80) { - out = out + hexTable[c]; - continue; - } + var className = props.className; + var classes = classnames_default()('woocommerce-transient-notices', 'components-notices__snackbar', className); + var notices = getNotices(); + return Object(external_this_wp_element_["createElement"])(list, { + notices: notices, + className: classes, + onRemove: onRemove, + onRemove2: onRemove2 + }); +} - if (c < 0x800) { - out = out + (hexTable[0xC0 | (c >> 6)] + hexTable[0x80 | (c & 0x3F)]); - continue; - } +TransientNotices.propTypes = { + /** + * Additional class name to style the component. + */ + className: prop_types_default.a.string, - if (c < 0xD800 || c >= 0xE000) { - out = out + (hexTable[0xE0 | (c >> 12)] + hexTable[0x80 | ((c >> 6) & 0x3F)] + hexTable[0x80 | (c & 0x3F)]); - continue; - } + /** + * Array of notices to be displayed. + */ + notices: prop_types_default.a.array +}; +/* harmony default export */ var transient_notices = (TransientNotices); +// CONCATENATED MODULE: ./client/layout/navigation.js - i += 1; - c = 0x10000 + (((c & 0x3FF) << 10) | (string.charCodeAt(i) & 0x3FF)); - out += hexTable[0xF0 | (c >> 18)] - + hexTable[0x80 | ((c >> 12) & 0x3F)] - + hexTable[0x80 | ((c >> 6) & 0x3F)] - + hexTable[0x80 | (c & 0x3F)]; - } - return out; -}; -var compact = function compact(value) { - var queue = [{ obj: { o: value }, prop: 'o' }]; - var refs = []; - for (var i = 0; i < queue.length; ++i) { - var item = queue[i]; - var obj = item.obj[item.prop]; +function navigation_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } - var keys = Object.keys(obj); - for (var j = 0; j < keys.length; ++j) { - var key = keys[j]; - var val = obj[key]; - if (typeof val === 'object' && val !== null && refs.indexOf(val) === -1) { - queue.push({ obj: obj, prop: key }); - refs.push(val); - } - } - } +function navigation_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { navigation_ownKeys(Object(source), true).forEach(function (key) { defineProperty_default()(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { navigation_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } - compactQueue(queue); +/** + * External dependencies + */ - return value; -}; -var isRegExp = function isRegExp(obj) { - return Object.prototype.toString.call(obj) === '[object RegExp]'; -}; -var isBuffer = function isBuffer(obj) { - if (!obj || typeof obj !== 'object') { - return false; - } - return !!(obj.constructor && obj.constructor.isBuffer && obj.constructor.isBuffer(obj)); -}; -var combine = function combine(a, b) { - return [].concat(a, b); -}; +/** + * Internal dependencies + */ -var maybeMap = function maybeMap(val, fn) { - if (isArray(val)) { - var mapped = []; - for (var i = 0; i < val.length; i += 1) { - mapped.push(fn(val[i])); - } - return mapped; - } - return fn(val); -}; -module.exports = { - arrayToObject: arrayToObject, - assign: assign, - combine: combine, - compact: compact, - decode: decode, - encode: encode, - isBuffer: isBuffer, - isRegExp: isRegExp, - maybeMap: maybeMap, - merge: merge -}; -/***/ }), -/* 88 */, -/* 89 */, -/* 90 */ -/***/ (function(module, exports) { -(function() { module.exports = this["ReactDOM"]; }()); -/***/ }), -/* 91 */ -/***/ (function(module, exports, __webpack_require__) { +var navigation_NavigationPlugin = function NavigationPlugin() { + var _useState = Object(external_this_wp_element_["useState"])(Object(external_this_wc_navigation_["getPersistedQuery"])()), + _useState2 = slicedToArray_default()(_useState, 2), + persistedQuery = _useState2[0], + setPersistedQuery = _useState2[1]; -var e=__webpack_require__(8),n={display:"block",opacity:0,position:"absolute",top:0,left:0,height:"100%",width:"100%",overflow:"hidden",pointerEvents:"none",zIndex:-1},t=function(t){var r=t.onResize,u=e.useRef();return function(n,t){var r=function(){return n.current&&n.current.contentDocument&&n.current.contentDocument.defaultView};function u(){t();var e=r();e&&e.addEventListener("resize",t)}e.useEffect((function(){return r()?u():n.current&&n.current.addEventListener&&n.current.addEventListener("load",u),function(){var e=r();e&&"function"==typeof e.removeEventListener&&e.removeEventListener("resize",t)}}),[])}(u,(function(){return r(u)})),e.createElement("iframe",{style:n,src:"about:blank",ref:u,"aria-hidden":!0,tabIndex:-1,frameBorder:0})},r=function(e){return{width:null!=e?e.offsetWidth:null,height:null!=e?e.offsetHeight:null}};module.exports=function(n){void 0===n&&(n=r);var u=e.useState(n(null)),o=u[0],i=u[1],c=e.useCallback((function(e){return i(n(e.current))}),[n]);return[e.useMemo((function(){return e.createElement(t,{onResize:c})}),[c]),o]}; -//# sourceMappingURL=index.js.map + var pathIsExcluded = function pathIsExcluded(path) { + return Object(external_this_wc_navigation_["getQueryExcludedScreens"])().includes(Object(external_this_wc_navigation_["getScreenFromPath"])(path)); + }; // Update the persisted queries when history is updated -/***/ }), -/* 92 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -var isProduction = "production" === 'production'; -var prefix = 'Invariant failed'; -function invariant(condition, message) { - if (condition) { - return; - } - if (isProduction) { - throw new Error(prefix); - } - throw new Error(prefix + ": " + (message || '')); -} - -/* harmony default export */ __webpack_exports__["a"] = (invariant); - - -/***/ }), -/* 93 */ -/***/ (function(module, exports, __webpack_require__) { - -var arrayLikeToArray = __webpack_require__(62); + Object(external_this_wp_element_["useEffect"])(function () { + return addHistoryListener(function () { + setTimeout(function () { + if (pathIsExcluded()) { + return; + } -function _arrayWithoutHoles(arr) { - if (Array.isArray(arr)) return arrayLikeToArray(arr); -} + setPersistedQuery(Object(external_this_wc_navigation_["getPersistedQuery"])()); + }, 0); + }); + }, []); + /** + * If the current page is embedded, stay with the default urls + * provided by Navigation because the router isn't present to + * respond to component's manipulation of the url. + */ -module.exports = _arrayWithoutHoles; + if (!Object(utils["f" /* isWCAdmin */])(window.location.href)) { + return null; + } -/***/ }), -/* 94 */ -/***/ (function(module, exports) { + var reports = Object(get_reports["a" /* default */])().filter(function (item) { + return item.navArgs; + }); + var pages = controller_getPages().filter(function (page) { + return page.navArgs; + }).map(function (page) { + if (page.path === '/analytics/settings') { + return navigation_objectSpread(navigation_objectSpread({}, page), {}, { + breadcrumbs: [Object(external_this_wp_i18n_["__"])('Analytics', 'woocommerce-admin')] + }); + } -function _iterableToArray(iter) { - if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); -} + return page; + }); + return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, pages.map(function (page) { + return Object(external_this_wp_element_["createElement"])(external_this_wc_navigation_["WooNavigationItem"], { + item: page.navArgs.id, + key: page.navArgs.id + }, Object(external_this_wp_element_["createElement"])(external_this_wc_components_["Link"], { + className: "components-button", + href: Object(external_this_wc_navigation_["getNewPath"])(pathIsExcluded(page.path) ? {} : persistedQuery, page.path, {}), + type: "wc-admin" + }, page.breadcrumbs[page.breadcrumbs.length - 1])); + }), reports.map(function (item) { + return Object(external_this_wp_element_["createElement"])(external_this_wc_navigation_["WooNavigationItem"], { + item: item.navArgs.id, + key: item.navArgs.id + }, Object(external_this_wp_element_["createElement"])(external_this_wc_components_["Link"], { + className: "components-button", + href: Object(external_this_wc_navigation_["getNewPath"])(pathIsExcluded(item.report) ? {} : persistedQuery, "/analytics/".concat(item.report), {}), + type: "wc-admin" + }, item.title)); + })); +}; -module.exports = _iterableToArray; +Object(external_this_wp_plugins_["registerPlugin"])('wc-admin-navigation', { + render: navigation_NavigationPlugin +}); +// CONCATENATED MODULE: ./client/layout/index.js -/***/ }), -/* 95 */ -/***/ (function(module, exports) { -function _nonIterableSpread() { - throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); -} -module.exports = _nonIterableSpread; -/***/ }), -/* 96 */, -/* 97 */, -/* 98 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { -"use strict"; -// EXPORTS -__webpack_require__.d(__webpack_exports__, "b", function() { return /* binding */ slot_fill_Slot; }); -__webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ slot_fill_Fill; }); -// UNUSED EXPORTS: createSlotFill, useSlot, Provider -// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js -var esm_extends = __webpack_require__(7); -// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js -var objectWithoutProperties = __webpack_require__(11); -// EXTERNAL MODULE: external {"this":["wp","element"]} -var external_this_wp_element_ = __webpack_require__(0); +function layout_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } -// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/classCallCheck.js -var classCallCheck = __webpack_require__(16); +function layout_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { layout_ownKeys(Object(source), true).forEach(function (key) { defineProperty_default()(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { layout_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } -// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/createClass.js -var createClass = __webpack_require__(17); +function layout_createSuper(Derived) { var hasNativeReflectConstruct = layout_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = getPrototypeOf_default()(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = getPrototypeOf_default()(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return possibleConstructorReturn_default()(this, result); }; } -// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js -var assertThisInitialized = __webpack_require__(12); +function layout_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } -// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/get.js + 1 modules -var get = __webpack_require__(83); +/** + * External dependencies + */ -// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/inherits.js + 1 modules -var inherits = __webpack_require__(18); -// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js -var possibleConstructorReturn = __webpack_require__(21); -// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js -var getPrototypeOf = __webpack_require__(9); -// EXTERNAL MODULE: external "lodash" -var external_lodash_ = __webpack_require__(2); -// EXTERNAL MODULE: ./node_modules/@wordpress/components/build-module/slot-fill/context.js + 1 modules -var context = __webpack_require__(56); -// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/slot-fill/slot.js +/** + * Internal dependencies + */ -function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = Object(getPrototypeOf["a" /* default */])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = Object(getPrototypeOf["a" /* default */])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return Object(possibleConstructorReturn["a" /* default */])(this, result); }; } -function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } -/** - * External dependencies - */ -/** - * WordPress dependencies - */ +var StoreAlerts = Object(external_this_wp_element_["lazy"])(function () { + return Promise.all(/* import() | store-alerts */[__webpack_require__.e(1), __webpack_require__.e(47)]).then(__webpack_require__.bind(null, 611)); +}); +var WCPayUsageModal = Object(external_this_wp_element_["lazy"])(function () { + return __webpack_require__.e(/* import() | wcpay-usage-modal */ 51).then(__webpack_require__.bind(null, 527)); +}); +var layout_PrimaryLayout = /*#__PURE__*/function (_Component) { + inherits_default()(PrimaryLayout, _Component); + var _super = layout_createSuper(PrimaryLayout); -/** - * Internal dependencies - */ + function PrimaryLayout() { + classCallCheck_default()(this, PrimaryLayout); + return _super.apply(this, arguments); + } + createClass_default()(PrimaryLayout, [{ + key: "render", + value: function render() { + var children = this.props.children; + return Object(external_this_wp_element_["createElement"])("div", { + className: "woocommerce-layout__primary", + id: "woocommerce-layout__primary" + }, window.wcAdminFeatures['store-alerts'] && Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Suspense"], { + fallback: Object(external_this_wp_element_["createElement"])(external_this_wc_components_["Spinner"], null) + }, Object(external_this_wp_element_["createElement"])(StoreAlerts, null)), Object(external_this_wp_element_["createElement"])(layout_notices, null), children); + } + }]); -var slot_SlotComponent = /*#__PURE__*/function (_Component) { - Object(inherits["a" /* default */])(SlotComponent, _Component); + return PrimaryLayout; +}(external_this_wp_element_["Component"]); - var _super = _createSuper(SlotComponent); +var layout_Layout = /*#__PURE__*/function (_Component2) { + inherits_default()(_Layout, _Component2); - function SlotComponent() { - var _this; + var _super2 = layout_createSuper(_Layout); - Object(classCallCheck["a" /* default */])(this, SlotComponent); + function _Layout() { + classCallCheck_default()(this, _Layout); - _this = _super.apply(this, arguments); - _this.isUnmounted = false; - _this.bindNode = _this.bindNode.bind(Object(assertThisInitialized["a" /* default */])(_this)); - return _this; + return _super2.apply(this, arguments); } - Object(createClass["a" /* default */])(SlotComponent, [{ + createClass_default()(_Layout, [{ key: "componentDidMount", value: function componentDidMount() { - var registerSlot = this.props.registerSlot; - registerSlot(this.props.name, this); - } - }, { - key: "componentWillUnmount", - value: function componentWillUnmount() { - var unregisterSlot = this.props.unregisterSlot; - this.isUnmounted = true; - unregisterSlot(this.props.name, this); + this.recordPageViewTrack(); } }, { key: "componentDidUpdate", value: function componentDidUpdate(prevProps) { - var _this$props = this.props, - name = _this$props.name, - unregisterSlot = _this$props.unregisterSlot, - registerSlot = _this$props.registerSlot; + var previousPath = Object(external_lodash_["get"])(prevProps, 'location.pathname'); + var currentPath = Object(external_lodash_["get"])(this.props, 'location.pathname'); + + if (!previousPath || !currentPath) { + return; + } - if (prevProps.name !== name) { - unregisterSlot(prevProps.name); - registerSlot(name, this); + if (previousPath !== currentPath) { + this.recordPageViewTrack(); } } }, { - key: "bindNode", - value: function bindNode(node) { - this.node = node; + key: "recordPageViewTrack", + value: function recordPageViewTrack() { + var _this$props = this.props, + activePlugins = _this$props.activePlugins, + installedPlugins = _this$props.installedPlugins, + isEmbedded = _this$props.isEmbedded, + isJetpackConnected = _this$props.isJetpackConnected; + var navigationFlag = { + has_navigation: !!window.wcNavigation + }; + + if (isEmbedded) { + var _path = document.location.pathname + document.location.search; + + Object(external_this_wc_tracks_["recordPageView"])(_path, layout_objectSpread({ + is_embedded: true + }, navigationFlag)); + return; + } + + var pathname = Object(external_lodash_["get"])(this.props, 'location.pathname'); + + if (!pathname) { + return; + } // Remove leading slash, and camel case remaining pathname + + + var path = pathname.substring(1).replace(/\//g, '_'); // When pathname is `/` we are on the home screen. + + if (path.length === 0) { + path = 'home_screen'; + } + + Object(external_this_wc_tracks_["recordPageView"])(path, layout_objectSpread({ + jetpack_installed: installedPlugins.includes('jetpack'), + jetpack_active: activePlugins.includes('jetpack'), + jetpack_connected: isJetpackConnected + }, navigationFlag)); } }, { - key: "forceUpdate", - value: function forceUpdate() { - if (this.isUnmounted) { - return; + key: "getQuery", + value: function getQuery(searchString) { + if (!searchString) { + return {}; } - Object(get["a" /* default */])(Object(getPrototypeOf["a" /* default */])(SlotComponent.prototype), "forceUpdate", this).call(this); + var search = searchString.substring(1); + return Object(lib["parse"])(search); + } + }, { + key: "isWCPaySettingsPage", + value: function isWCPaySettingsPage() { + var _getQuery = Object(external_this_wc_navigation_["getQuery"])(), + page = _getQuery.page, + section = _getQuery.section, + tab = _getQuery.tab; + + return page === 'wc-settings' && tab === 'checkout' && section === 'woocommerce_payments'; } }, { key: "render", value: function render() { var _this$props2 = this.props, - children = _this$props2.children, - name = _this$props2.name, - _this$props2$fillProp = _this$props2.fillProps, - fillProps = _this$props2$fillProp === void 0 ? {} : _this$props2$fillProp, - getFills = _this$props2.getFills; - var fills = Object(external_lodash_["map"])(getFills(name, this), function (fill) { - var fillKey = fill.occurrence; - var fillChildren = Object(external_lodash_["isFunction"])(fill.children) ? fill.children(fillProps) : fill.children; - return external_this_wp_element_["Children"].map(fillChildren, function (child, childIndex) { - if (!child || Object(external_lodash_["isString"])(child)) { - return child; - } + isEmbedded = _this$props2.isEmbedded, + restProps = objectWithoutProperties_default()(_this$props2, ["isEmbedded"]); - var childKey = "".concat(fillKey, "---").concat(child.key || childIndex); - return Object(external_this_wp_element_["cloneElement"])(child, { - key: childKey - }); - }); - }).filter( // In some cases fills are rendered only when some conditions apply. - // This ensures that we only use non-empty fills when rendering, i.e., - // it allows us to render wrappers only when the fills are actually present. - Object(external_lodash_["negate"])(external_this_wp_element_["isEmptyElement"])); - return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, Object(external_lodash_["isFunction"])(children) ? children(fills) : fills); + var _this$props3 = this.props, + location = _this$props3.location, + page = _this$props3.page; + var breadcrumbs = page.breadcrumbs; + var query = this.getQuery(location && location.search); + return Object(external_this_wp_element_["createElement"])("div", { + className: "woocommerce-layout" + }, Object(external_this_wp_element_["createElement"])(client_header_Header, { + sections: Object(external_lodash_["isFunction"])(breadcrumbs) ? breadcrumbs(this.props) : breadcrumbs, + isEmbedded: isEmbedded, + query: query + }), Object(external_this_wp_element_["createElement"])(transient_notices, null), !isEmbedded && Object(external_this_wp_element_["createElement"])(layout_PrimaryLayout, null, Object(external_this_wp_element_["createElement"])("div", { + className: "woocommerce-layout__main" + }, Object(external_this_wp_element_["createElement"])(controller_Controller, extends_default()({}, restProps, { + query: query + })))), isEmbedded && this.isWCPaySettingsPage() && Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Suspense"], { + fallback: null + }, Object(external_this_wp_element_["createElement"])(WCPayUsageModal, null))); } }]); - return SlotComponent; + return _Layout; }(external_this_wp_element_["Component"]); -var slot_Slot = function Slot(props) { - return Object(external_this_wp_element_["createElement"])(context["a" /* Consumer */], null, function (_ref) { - var registerSlot = _ref.registerSlot, - unregisterSlot = _ref.unregisterSlot, - getFills = _ref.getFills; - return Object(external_this_wp_element_["createElement"])(slot_SlotComponent, Object(esm_extends["a" /* default */])({}, props, { - registerSlot: registerSlot, - unregisterSlot: unregisterSlot, - getFills: getFills - })); - }); +layout_Layout.propTypes = { + isEmbedded: prop_types_default.a.bool, + page: prop_types_default.a.shape({ + container: prop_types_default.a.oneOfType([prop_types_default.a.func, prop_types_default.a.object // Support React.lazy + ]), + path: prop_types_default.a.string, + breadcrumbs: prop_types_default.a.oneOfType([prop_types_default.a.func, prop_types_default.a.arrayOf(prop_types_default.a.oneOfType([prop_types_default.a.arrayOf(prop_types_default.a.string), prop_types_default.a.string]))]).isRequired, + wpOpenMenu: prop_types_default.a.string + }).isRequired }; +var Layout = Object(external_this_wp_compose_["compose"])(Object(external_this_wc_data_["withPluginsHydration"])(layout_objectSpread(layout_objectSpread({}, window.wcSettings.plugins || {}), {}, { + jetpackStatus: window.wcSettings.dataEndpoints && window.wcSettings.dataEndpoints.jetpackStatus || false +})), Object(external_this_wp_data_["withSelect"])(function (select, _ref) { + var isEmbedded = _ref.isEmbedded; -/* harmony default export */ var slot_fill_slot = (slot_Slot); -//# sourceMappingURL=slot.js.map -// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/slot-fill/fill.js - - - -/** - * External dependencies - */ + // Embedded pages don't send plugin info to Tracks. + if (isEmbedded) { + return; + } -/** - * WordPress dependencies - */ + var _select = select(external_this_wc_data_["PLUGINS_STORE_NAME"]), + getActivePlugins = _select.getActivePlugins, + getInstalledPlugins = _select.getInstalledPlugins, + isJetpackConnected = _select.isJetpackConnected; + return { + activePlugins: getActivePlugins(), + isJetpackConnected: isJetpackConnected(), + installedPlugins: getInstalledPlugins() + }; +}))(layout_Layout); -/** - * Internal dependencies - */ +var layout_PageLayout = function _PageLayout() { + var _useUser = Object(external_this_wc_data_["useUser"])(), + currentUserCan = _useUser.currentUserCan; + return Object(external_this_wp_element_["createElement"])(react_router_Router, { + history: Object(external_this_wc_navigation_["getHistory"])() + }, Object(external_this_wp_element_["createElement"])(react_router_Switch, null, controller_getPages().filter(function (page) { + return !page.capability || currentUserCan(page.capability); + }).map(function (page) { + return Object(external_this_wp_element_["createElement"])(react_router_Route, { + key: page.path, + path: page.path, + exact: true, + render: function render(props) { + return Object(external_this_wp_element_["createElement"])(Layout, extends_default()({ + page: page + }, props)); + } + }); + }))); +}; -var occurrences = 0; +var PageLayout = Object(external_this_wp_compose_["compose"])(window.wcSettings.preloadOptions ? Object(external_this_wc_data_["withOptionsHydration"])(layout_objectSpread({}, window.wcSettings.preloadOptions)) : external_lodash_["identity"])(layout_PageLayout); -function fill_FillComponent(_ref) { - var name = _ref.name, - children = _ref.children, - registerFill = _ref.registerFill, - unregisterFill = _ref.unregisterFill; - var slot = Object(context["c" /* useSlot */])(name); - var ref = Object(external_this_wp_element_["useRef"])({ - name: name, - children: children +var layout_EmbedLayout = function _EmbedLayout() { + return Object(external_this_wp_element_["createElement"])(Layout, { + page: { + breadcrumbs: Object(wc_admin_settings["g" /* getSetting */])('embedBreadcrumbs', []) + }, + isEmbedded: true }); +}; - if (!ref.current.occurrence) { - ref.current.occurrence = ++occurrences; - } - - Object(external_this_wp_element_["useLayoutEffect"])(function () { - registerFill(name, ref.current); - return function () { - return unregisterFill(name, ref.current); - }; - }, []); - Object(external_this_wp_element_["useLayoutEffect"])(function () { - ref.current.children = children; - - if (slot) { - slot.forceUpdate(); - } - }, [children]); - Object(external_this_wp_element_["useLayoutEffect"])(function () { - if (name === ref.current.name) { - // ignore initial effect - return; - } +var EmbedLayout = Object(external_this_wp_compose_["compose"])(window.wcSettings.preloadOptions ? Object(external_this_wc_data_["withOptionsHydration"])(layout_objectSpread({}, window.wcSettings.preloadOptions)) : external_lodash_["identity"])(layout_EmbedLayout); - unregisterFill(ref.current.name, ref.current); - ref.current.name = name; - registerFill(name, ref.current); - }, [name]); +/***/ }), - if (!slot || !slot.node) { - return null; - } // If a function is passed as a child, provide it with the fillProps. +/***/ 142: +/***/ (function(module, exports) { +(function() { module.exports = this["wc"]["number"]; }()); - if (Object(external_lodash_["isFunction"])(children)) { - children = children(slot.props.fillProps); - } +/***/ }), - return Object(external_this_wp_element_["createPortal"])(children, slot.node); -} +/***/ 15: +/***/ (function(module, exports, __webpack_require__) { -var fill_Fill = function Fill(props) { - return Object(external_this_wp_element_["createElement"])(context["a" /* Consumer */], null, function (_ref2) { - var registerFill = _ref2.registerFill, - unregisterFill = _ref2.unregisterFill; - return Object(external_this_wp_element_["createElement"])(fill_FillComponent, Object(esm_extends["a" /* default */])({}, props, { - registerFill: registerFill, - unregisterFill: unregisterFill - })); - }); -}; +var _typeof = __webpack_require__(31); -/* harmony default export */ var slot_fill_fill = (fill_Fill); -//# sourceMappingURL=fill.js.map -// EXTERNAL MODULE: ./node_modules/@wordpress/components/build-module/slot-fill/bubbles-virtually/slot-fill-context.js -var slot_fill_context = __webpack_require__(61); +var assertThisInitialized = __webpack_require__(9); -// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/slot-fill/bubbles-virtually/slot.js +function _possibleConstructorReturn(self, call) { + if (call && (_typeof(call) === "object" || typeof call === "function")) { + return call; + } + return assertThisInitialized(self); +} +module.exports = _possibleConstructorReturn; +/***/ }), -/** - * WordPress dependencies - */ +/***/ 152: +/***/ (function(module, exports, __webpack_require__) { -/** - * Internal dependencies +"use strict"; +/** @license React v16.13.1 + * react-is.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. */ +var b="function"===typeof Symbol&&Symbol.for,c=b?Symbol.for("react.element"):60103,d=b?Symbol.for("react.portal"):60106,e=b?Symbol.for("react.fragment"):60107,f=b?Symbol.for("react.strict_mode"):60108,g=b?Symbol.for("react.profiler"):60114,h=b?Symbol.for("react.provider"):60109,k=b?Symbol.for("react.context"):60110,l=b?Symbol.for("react.async_mode"):60111,m=b?Symbol.for("react.concurrent_mode"):60111,n=b?Symbol.for("react.forward_ref"):60112,p=b?Symbol.for("react.suspense"):60113,q=b? +Symbol.for("react.suspense_list"):60120,r=b?Symbol.for("react.memo"):60115,t=b?Symbol.for("react.lazy"):60116,v=b?Symbol.for("react.block"):60121,w=b?Symbol.for("react.fundamental"):60117,x=b?Symbol.for("react.responder"):60118,y=b?Symbol.for("react.scope"):60119; +function z(a){if("object"===typeof a&&null!==a){var u=a.$$typeof;switch(u){case c:switch(a=a.type,a){case l:case m:case e:case g:case f:case p:return a;default:switch(a=a&&a.$$typeof,a){case k:case n:case t:case r:case h:return a;default:return u}}case d:return u}}}function A(a){return z(a)===m}exports.AsyncMode=l;exports.ConcurrentMode=m;exports.ContextConsumer=k;exports.ContextProvider=h;exports.Element=c;exports.ForwardRef=n;exports.Fragment=e;exports.Lazy=t;exports.Memo=r;exports.Portal=d; +exports.Profiler=g;exports.StrictMode=f;exports.Suspense=p;exports.isAsyncMode=function(a){return A(a)||z(a)===l};exports.isConcurrentMode=A;exports.isContextConsumer=function(a){return z(a)===k};exports.isContextProvider=function(a){return z(a)===h};exports.isElement=function(a){return"object"===typeof a&&null!==a&&a.$$typeof===c};exports.isForwardRef=function(a){return z(a)===n};exports.isFragment=function(a){return z(a)===e};exports.isLazy=function(a){return z(a)===t}; +exports.isMemo=function(a){return z(a)===r};exports.isPortal=function(a){return z(a)===d};exports.isProfiler=function(a){return z(a)===g};exports.isStrictMode=function(a){return z(a)===f};exports.isSuspense=function(a){return z(a)===p}; +exports.isValidElementType=function(a){return"string"===typeof a||"function"===typeof a||a===e||a===m||a===g||a===f||a===p||a===q||"object"===typeof a&&null!==a&&(a.$$typeof===t||a.$$typeof===r||a.$$typeof===h||a.$$typeof===k||a.$$typeof===n||a.$$typeof===w||a.$$typeof===x||a.$$typeof===y||a.$$typeof===v)};exports.typeOf=z; -function bubbles_virtually_slot_Slot(_ref) { - var name = _ref.name, - _ref$fillProps = _ref.fillProps, - fillProps = _ref$fillProps === void 0 ? {} : _ref$fillProps, - _ref$as = _ref.as, - Component = _ref$as === void 0 ? 'div' : _ref$as, - props = Object(objectWithoutProperties["a" /* default */])(_ref, ["name", "fillProps", "as"]); - - var registry = Object(external_this_wp_element_["useContext"])(slot_fill_context["a" /* default */]); - var ref = Object(external_this_wp_element_["useRef"])(); - Object(external_this_wp_element_["useLayoutEffect"])(function () { - registry.registerSlot(name, ref, fillProps); - return function () { - registry.unregisterSlot(name, ref); - }; // We are not including fillProps in the deps because we don't want to - // unregister and register the slot whenever fillProps change, which would - // cause the fill to be re-mounted. We are only considering the initial value - // of fillProps. - }, [registry.registerSlot, registry.unregisterSlot, name]); // fillProps may be an update that interacts with the layout, so we - // useLayoutEffect - - Object(external_this_wp_element_["useLayoutEffect"])(function () { - registry.updateSlot(name, fillProps); - }); - return Object(external_this_wp_element_["createElement"])(Component, Object(esm_extends["a" /* default */])({ - ref: ref - }, props)); -} -//# sourceMappingURL=slot.js.map -// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js + 3 modules -var slicedToArray = __webpack_require__(24); -// EXTERNAL MODULE: ./node_modules/@wordpress/components/build-module/slot-fill/bubbles-virtually/use-slot.js -var use_slot = __webpack_require__(71); +/***/ }), -// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/slot-fill/bubbles-virtually/fill.js +/***/ 16: +/***/ (function(module, exports) { +(function() { module.exports = this["moment"]; }()); -/** - * WordPress dependencies - */ +/***/ }), -/** - * Internal dependencies - */ +/***/ 17: +/***/ (function(module, exports) { +(function() { module.exports = this["wp"]["dataControls"]; }()); +/***/ }), -function useForceUpdate() { - var _useState = Object(external_this_wp_element_["useState"])({}), - _useState2 = Object(slicedToArray["a" /* default */])(_useState, 2), - setState = _useState2[1]; +/***/ 18: +/***/ (function(module, exports, __webpack_require__) { - return function () { - return setState({}); - }; -} +var arrayWithHoles = __webpack_require__(60); -function bubbles_virtually_fill_Fill(_ref) { - var name = _ref.name, - children = _ref.children; - var slot = Object(use_slot["a" /* default */])(name); - var ref = Object(external_this_wp_element_["useRef"])({ - rerender: useForceUpdate() - }); - Object(external_this_wp_element_["useEffect"])(function () { - // We register fills so we can keep track of their existance. - // Some Slot implementations need to know if there're already fills - // registered so they can choose to render themselves or not. - slot.registerFill(ref); - return function () { - slot.unregisterFill(ref); - }; - }, [slot.registerFill, slot.unregisterFill]); +var iterableToArrayLimit = __webpack_require__(61); - if (!slot.ref || !slot.ref.current) { - return null; - } +var unsupportedIterableToArray = __webpack_require__(40); - if (typeof children === 'function') { - children = children(slot.fillProps); - } +var nonIterableRest = __webpack_require__(62); - return Object(external_this_wp_element_["createPortal"])(children, slot.ref.current); +function _slicedToArray(arr, i) { + return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || unsupportedIterableToArray(arr, i) || nonIterableRest(); } -//# sourceMappingURL=fill.js.map -// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/slot-fill/index.js +module.exports = _slicedToArray; +/***/ }), +/***/ 182: +/***/ (function(module, exports, __webpack_require__) { -/** - * Internal dependencies - */ +"use strict"; +Object.defineProperty(exports, '__esModule', { value: true }); + +function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } +var _extends = _interopDefault(__webpack_require__(24)); +var _objectWithoutPropertiesLoose = _interopDefault(__webpack_require__(97)); +var React = __webpack_require__(10); +var React__default = _interopDefault(React); +var _inheritsLoose = _interopDefault(__webpack_require__(305)); +var _assertThisInitialized = _interopDefault(__webpack_require__(9)); +var is = { + arr: Array.isArray, + obj: function obj(a) { + return Object.prototype.toString.call(a) === '[object Object]'; + }, + fun: function fun(a) { + return typeof a === 'function'; + }, + str: function str(a) { + return typeof a === 'string'; + }, + num: function num(a) { + return typeof a === 'number'; + }, + und: function und(a) { + return a === void 0; + }, + nul: function nul(a) { + return a === null; + }, + set: function set(a) { + return a instanceof Set; + }, + map: function map(a) { + return a instanceof Map; + }, + equ: function equ(a, b) { + if (typeof a !== typeof b) return false; + if (is.str(a) || is.num(a)) return a === b; + if (is.obj(a) && is.obj(b) && Object.keys(a).length + Object.keys(b).length === 0) return true; + var i; + for (i in a) { + if (!(i in b)) return false; + } -function slot_fill_Slot(_ref) { - var bubblesVirtually = _ref.bubblesVirtually, - props = Object(objectWithoutProperties["a" /* default */])(_ref, ["bubblesVirtually"]); + for (i in b) { + if (a[i] !== b[i]) return false; + } - if (bubblesVirtually) { - return Object(external_this_wp_element_["createElement"])(bubbles_virtually_slot_Slot, props); + return is.und(i) ? a === b : true; + } +}; +function merge(target, lowercase) { + if (lowercase === void 0) { + lowercase = true; } - return Object(external_this_wp_element_["createElement"])(slot_fill_slot, props); + return function (object) { + return (is.arr(object) ? object : Object.keys(object)).reduce(function (acc, element) { + var key = lowercase ? element[0].toLowerCase() + element.substring(1) : element; + acc[key] = target(key); + return acc; + }, target); + }; +} +function useForceUpdate() { + var _useState = React.useState(false), + f = _useState[1]; + + var forceUpdate = React.useCallback(function () { + return f(function (v) { + return !v; + }); + }, []); + return forceUpdate; } -function slot_fill_Fill(props) { - // We're adding both Fills here so they can register themselves before - // their respective slot has been registered. Only the Fill that has a slot - // will render. The other one will return null. - return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, Object(external_this_wp_element_["createElement"])(slot_fill_fill, props), Object(external_this_wp_element_["createElement"])(bubbles_virtually_fill_Fill, props)); +function withDefault(value, defaultValue) { + return is.und(value) || is.nul(value) ? defaultValue : value; } -function createSlotFill(name) { - var FillComponent = function FillComponent(props) { - return Object(external_this_wp_element_["createElement"])(slot_fill_Fill, Object(esm_extends["a" /* default */])({ - name: name - }, props)); - }; +function toArray(a) { + return !is.und(a) ? is.arr(a) ? a : [a] : []; +} +function callProp(obj) { + for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { + args[_key - 1] = arguments[_key]; + } - FillComponent.displayName = name + 'Fill'; + return is.fun(obj) ? obj.apply(void 0, args) : obj; +} - var SlotComponent = function SlotComponent(props) { - return Object(external_this_wp_element_["createElement"])(slot_fill_Slot, Object(esm_extends["a" /* default */])({ - name: name - }, props)); - }; +function getForwardProps(props) { + var to = props.to, + from = props.from, + config = props.config, + onStart = props.onStart, + onRest = props.onRest, + onFrame = props.onFrame, + children = props.children, + reset = props.reset, + reverse = props.reverse, + force = props.force, + immediate = props.immediate, + delay = props.delay, + attach = props.attach, + destroyed = props.destroyed, + interpolateTo = props.interpolateTo, + ref = props.ref, + lazy = props.lazy, + forward = _objectWithoutPropertiesLoose(props, ["to", "from", "config", "onStart", "onRest", "onFrame", "children", "reset", "reverse", "force", "immediate", "delay", "attach", "destroyed", "interpolateTo", "ref", "lazy"]); - SlotComponent.displayName = name + 'Slot'; - return { - Fill: FillComponent, - Slot: SlotComponent - }; + return forward; } -//# sourceMappingURL=index.js.map - -/***/ }), -/* 99 */ -/***/ (function(module, exports, __webpack_require__) { +function interpolateTo(props) { + var forward = getForwardProps(props); + if (is.und(forward)) return _extends({ + to: forward + }, props); + var rest = Object.keys(props).reduce(function (a, k) { + var _extends2; -"use strict"; + return !is.und(forward[k]) ? a : _extends({}, a, (_extends2 = {}, _extends2[k] = props[k], _extends2)); + }, {}); + return _extends({ + to: forward + }, rest); +} +function handleRef(ref, forward) { + if (forward) { + // If it's a function, assume it's a ref callback + if (is.fun(forward)) forward(ref);else if (is.obj(forward)) { + forward.current = ref; + } + } + return ref; +} -var replace = String.prototype.replace; -var percentTwenties = /%20/g; +var Animated = +/*#__PURE__*/ +function () { + function Animated() { + this.payload = void 0; + this.children = []; + } -var util = __webpack_require__(87); + var _proto = Animated.prototype; -var Format = { - RFC1738: 'RFC1738', - RFC3986: 'RFC3986' -}; + _proto.getAnimatedValue = function getAnimatedValue() { + return this.getValue(); + }; -module.exports = util.assign( - { - 'default': Format.RFC3986, - formatters: { - RFC1738: function (value) { - return replace.call(value, percentTwenties, '+'); - }, - RFC3986: function (value) { - return String(value); - } - } - }, - Format -); + _proto.getPayload = function getPayload() { + return this.payload || this; + }; + _proto.attach = function attach() {}; -/***/ }), -/* 100 */ -/***/ (function(module, exports) { + _proto.detach = function detach() {}; -function _arrayWithHoles(arr) { - if (Array.isArray(arr)) return arr; -} + _proto.getChildren = function getChildren() { + return this.children; + }; -module.exports = _arrayWithHoles; + _proto.addChild = function addChild(child) { + if (this.children.length === 0) this.attach(); + this.children.push(child); + }; -/***/ }), -/* 101 */ -/***/ (function(module, exports) { + _proto.removeChild = function removeChild(child) { + var index = this.children.indexOf(child); + this.children.splice(index, 1); + if (this.children.length === 0) this.detach(); + }; -function _iterableToArrayLimit(arr, i) { - if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; - var _arr = []; - var _n = true; - var _d = false; - var _e = undefined; + return Animated; +}(); +var AnimatedArray = +/*#__PURE__*/ +function (_Animated) { + _inheritsLoose(AnimatedArray, _Animated); - try { - for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { - _arr.push(_s.value); + function AnimatedArray() { + var _this; - if (i && _arr.length === i) break; - } - } catch (err) { - _d = true; - _e = err; - } finally { - try { - if (!_n && _i["return"] != null) _i["return"](); - } finally { - if (_d) throw _e; + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; } - } - - return _arr; -} -module.exports = _iterableToArrayLimit; + _this = _Animated.call.apply(_Animated, [this].concat(args)) || this; + _this.payload = []; -/***/ }), -/* 102 */ -/***/ (function(module, exports) { + _this.attach = function () { + return _this.payload.forEach(function (p) { + return p instanceof Animated && p.addChild(_assertThisInitialized(_this)); + }); + }; -function _nonIterableRest() { - throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); -} + _this.detach = function () { + return _this.payload.forEach(function (p) { + return p instanceof Animated && p.removeChild(_assertThisInitialized(_this)); + }); + }; -module.exports = _nonIterableRest; + return _this; + } -/***/ }), -/* 103 */ -/***/ (function(module, exports, __webpack_require__) { + return AnimatedArray; +}(Animated); +var AnimatedObject = +/*#__PURE__*/ +function (_Animated2) { + _inheritsLoose(AnimatedObject, _Animated2); -"use strict"; + function AnimatedObject() { + var _this2; + for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) { + args[_key3] = arguments[_key3]; + } -var keys = Object.keys; + _this2 = _Animated2.call.apply(_Animated2, [this].concat(args)) || this; + _this2.payload = {}; -/** - * Returns true if the two objects are shallow equal, or false otherwise. - * - * @param {import('.').ComparableObject} a First object to compare. - * @param {import('.').ComparableObject} b Second object to compare. - * - * @return {boolean} Whether the two objects are shallow equal. - */ -function isShallowEqualObjects( a, b ) { - var aKeys, bKeys, i, key, aValue; + _this2.attach = function () { + return Object.values(_this2.payload).forEach(function (s) { + return s instanceof Animated && s.addChild(_assertThisInitialized(_this2)); + }); + }; - if ( a === b ) { - return true; - } + _this2.detach = function () { + return Object.values(_this2.payload).forEach(function (s) { + return s instanceof Animated && s.removeChild(_assertThisInitialized(_this2)); + }); + }; - aKeys = keys( a ); - bKeys = keys( b ); + return _this2; + } - if ( aKeys.length !== bKeys.length ) { - return false; - } + var _proto2 = AnimatedObject.prototype; - i = 0; - - while ( i < aKeys.length ) { - key = aKeys[ i ]; - aValue = a[ key ]; - - if ( - // In iterating only the keys of the first object after verifying - // equal lengths, account for the case that an explicit `undefined` - // value in the first is implicitly undefined in the second. - // - // Example: isShallowEqualObjects( { a: undefined }, { b: 5 } ) - ( aValue === undefined && ! b.hasOwnProperty( key ) ) || - aValue !== b[ key ] - ) { - return false; - } + _proto2.getValue = function getValue(animated) { + if (animated === void 0) { + animated = false; + } - i++; - } + var payload = {}; - return true; -} + for (var _key4 in this.payload) { + var value = this.payload[_key4]; + if (animated && !(value instanceof Animated)) continue; + payload[_key4] = value instanceof Animated ? value[animated ? 'getAnimatedValue' : 'getValue']() : value; + } -module.exports = isShallowEqualObjects; + return payload; + }; + _proto2.getAnimatedValue = function getAnimatedValue() { + return this.getValue(true); + }; -/***/ }), -/* 104 */ -/***/ (function(module, exports, __webpack_require__) { + return AnimatedObject; +}(Animated); -"use strict"; +var applyAnimatedValues; +function injectApplyAnimatedValues(fn, transform) { + applyAnimatedValues = { + fn: fn, + transform: transform + }; +} +var colorNames; +function injectColorNames(names) { + colorNames = names; +} +var requestFrame = function requestFrame(cb) { + return typeof window !== 'undefined' ? window.requestAnimationFrame(cb) : -1; +}; +var cancelFrame = function cancelFrame(id) { + typeof window !== 'undefined' && window.cancelAnimationFrame(id); +}; +function injectFrame(raf, caf) { + requestFrame = raf; + cancelFrame = caf; +} +var interpolation; +function injectStringInterpolator(fn) { + interpolation = fn; +} +var now = function now() { + return Date.now(); +}; +function injectNow(nowFn) { + now = nowFn; +} +var defaultElement; +function injectDefaultElement(el) { + defaultElement = el; +} +var animatedApi = function animatedApi(node) { + return node.current; +}; +function injectAnimatedApi(fn) { + animatedApi = fn; +} +var createAnimatedStyle; +function injectCreateAnimatedStyle(factory) { + createAnimatedStyle = factory; +} +var manualFrameloop; +function injectManualFrameloop(callback) { + manualFrameloop = callback; +} +var Globals = /*#__PURE__*/Object.freeze({ + get applyAnimatedValues () { return applyAnimatedValues; }, + injectApplyAnimatedValues: injectApplyAnimatedValues, + get colorNames () { return colorNames; }, + injectColorNames: injectColorNames, + get requestFrame () { return requestFrame; }, + get cancelFrame () { return cancelFrame; }, + injectFrame: injectFrame, + get interpolation () { return interpolation; }, + injectStringInterpolator: injectStringInterpolator, + get now () { return now; }, + injectNow: injectNow, + get defaultElement () { return defaultElement; }, + injectDefaultElement: injectDefaultElement, + get animatedApi () { return animatedApi; }, + injectAnimatedApi: injectAnimatedApi, + get createAnimatedStyle () { return createAnimatedStyle; }, + injectCreateAnimatedStyle: injectCreateAnimatedStyle, + get manualFrameloop () { return manualFrameloop; }, + injectManualFrameloop: injectManualFrameloop +}); /** - * Returns true if the two arrays are shallow equal, or false otherwise. - * - * @param {any[]} a First array to compare. - * @param {any[]} b Second array to compare. - * - * @return {boolean} Whether the two arrays are shallow equal. + * Wraps the `style` property with `AnimatedStyle`. */ -function isShallowEqualArrays( a, b ) { - var i; - if ( a === b ) { - return true; - } +var AnimatedProps = +/*#__PURE__*/ +function (_AnimatedObject) { + _inheritsLoose(AnimatedProps, _AnimatedObject); - if ( a.length !== b.length ) { - return false; - } + function AnimatedProps(props, callback) { + var _this; - for ( i = 0; i < a.length; i++ ) { - if ( a[ i ] !== b[ i ] ) { - return false; - } - } + _this = _AnimatedObject.call(this) || this; + _this.update = void 0; + _this.payload = !props.style ? props : _extends({}, props, { + style: createAnimatedStyle(props.style) + }); + _this.update = callback; - return true; -} + _this.attach(); -module.exports = isShallowEqualArrays; + return _this; + } + return AnimatedProps; +}(AnimatedObject); -/***/ }), -/* 105 */, -/* 106 */ -/***/ (function(module, exports, __webpack_require__) { +var isFunctionComponent = function isFunctionComponent(val) { + return is.fun(val) && !(val.prototype instanceof React__default.Component); +}; -// TinyColor v1.4.2 -// https://github.com/bgrins/TinyColor -// Brian Grinstead, MIT License - -(function(Math) { - -var trimLeft = /^\s+/, - trimRight = /\s+$/, - tinyCounter = 0, - mathRound = Math.round, - mathMin = Math.min, - mathMax = Math.max, - mathRandom = Math.random; - -function tinycolor (color, opts) { - - color = (color) ? color : ''; - opts = opts || { }; - - // If input is already a tinycolor, return itself - if (color instanceof tinycolor) { - return color; - } - // If we are called as a function, call using new instead - if (!(this instanceof tinycolor)) { - return new tinycolor(color, opts); - } - - var rgb = inputToRGB(color); - this._originalInput = color, - this._r = rgb.r, - this._g = rgb.g, - this._b = rgb.b, - this._a = rgb.a, - this._roundA = mathRound(100*this._a) / 100, - this._format = opts.format || rgb.format; - this._gradientType = opts.gradientType; - - // Don't let the range of [0,255] come back in [0,1]. - // Potentially lose a little bit of precision here, but will fix issues where - // .5 gets interpreted as half of the total, instead of half of 1 - // If it was supposed to be 128, this was already taken care of by `inputToRgb` - if (this._r < 1) { this._r = mathRound(this._r); } - if (this._g < 1) { this._g = mathRound(this._g); } - if (this._b < 1) { this._b = mathRound(this._b); } - - this._ok = rgb.ok; - this._tc_id = tinyCounter++; -} +var createAnimatedComponent = function createAnimatedComponent(Component) { + var AnimatedComponent = React.forwardRef(function (props, ref) { + var forceUpdate = useForceUpdate(); + var mounted = React.useRef(true); + var propsAnimated = React.useRef(null); + var node = React.useRef(null); + var attachProps = React.useCallback(function (props) { + var oldPropsAnimated = propsAnimated.current; -tinycolor.prototype = { - isDark: function() { - return this.getBrightness() < 128; - }, - isLight: function() { - return !this.isDark(); - }, - isValid: function() { - return this._ok; - }, - getOriginalInput: function() { - return this._originalInput; - }, - getFormat: function() { - return this._format; - }, - getAlpha: function() { - return this._a; - }, - getBrightness: function() { - //http://www.w3.org/TR/AERT#color-contrast - var rgb = this.toRgb(); - return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1000; - }, - getLuminance: function() { - //http://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef - var rgb = this.toRgb(); - var RsRGB, GsRGB, BsRGB, R, G, B; - RsRGB = rgb.r/255; - GsRGB = rgb.g/255; - BsRGB = rgb.b/255; - - if (RsRGB <= 0.03928) {R = RsRGB / 12.92;} else {R = Math.pow(((RsRGB + 0.055) / 1.055), 2.4);} - if (GsRGB <= 0.03928) {G = GsRGB / 12.92;} else {G = Math.pow(((GsRGB + 0.055) / 1.055), 2.4);} - if (BsRGB <= 0.03928) {B = BsRGB / 12.92;} else {B = Math.pow(((BsRGB + 0.055) / 1.055), 2.4);} - return (0.2126 * R) + (0.7152 * G) + (0.0722 * B); - }, - setAlpha: function(value) { - this._a = boundAlpha(value); - this._roundA = mathRound(100*this._a) / 100; - return this; - }, - toHsv: function() { - var hsv = rgbToHsv(this._r, this._g, this._b); - return { h: hsv.h * 360, s: hsv.s, v: hsv.v, a: this._a }; - }, - toHsvString: function() { - var hsv = rgbToHsv(this._r, this._g, this._b); - var h = mathRound(hsv.h * 360), s = mathRound(hsv.s * 100), v = mathRound(hsv.v * 100); - return (this._a == 1) ? - "hsv(" + h + ", " + s + "%, " + v + "%)" : - "hsva(" + h + ", " + s + "%, " + v + "%, "+ this._roundA + ")"; - }, - toHsl: function() { - var hsl = rgbToHsl(this._r, this._g, this._b); - return { h: hsl.h * 360, s: hsl.s, l: hsl.l, a: this._a }; - }, - toHslString: function() { - var hsl = rgbToHsl(this._r, this._g, this._b); - var h = mathRound(hsl.h * 360), s = mathRound(hsl.s * 100), l = mathRound(hsl.l * 100); - return (this._a == 1) ? - "hsl(" + h + ", " + s + "%, " + l + "%)" : - "hsla(" + h + ", " + s + "%, " + l + "%, "+ this._roundA + ")"; - }, - toHex: function(allow3Char) { - return rgbToHex(this._r, this._g, this._b, allow3Char); - }, - toHexString: function(allow3Char) { - return '#' + this.toHex(allow3Char); - }, - toHex8: function(allow4Char) { - return rgbaToHex(this._r, this._g, this._b, this._a, allow4Char); - }, - toHex8String: function(allow4Char) { - return '#' + this.toHex8(allow4Char); - }, - toRgb: function() { - return { r: mathRound(this._r), g: mathRound(this._g), b: mathRound(this._b), a: this._a }; - }, - toRgbString: function() { - return (this._a == 1) ? - "rgb(" + mathRound(this._r) + ", " + mathRound(this._g) + ", " + mathRound(this._b) + ")" : - "rgba(" + mathRound(this._r) + ", " + mathRound(this._g) + ", " + mathRound(this._b) + ", " + this._roundA + ")"; - }, - toPercentageRgb: function() { - return { r: mathRound(bound01(this._r, 255) * 100) + "%", g: mathRound(bound01(this._g, 255) * 100) + "%", b: mathRound(bound01(this._b, 255) * 100) + "%", a: this._a }; - }, - toPercentageRgbString: function() { - return (this._a == 1) ? - "rgb(" + mathRound(bound01(this._r, 255) * 100) + "%, " + mathRound(bound01(this._g, 255) * 100) + "%, " + mathRound(bound01(this._b, 255) * 100) + "%)" : - "rgba(" + mathRound(bound01(this._r, 255) * 100) + "%, " + mathRound(bound01(this._g, 255) * 100) + "%, " + mathRound(bound01(this._b, 255) * 100) + "%, " + this._roundA + ")"; - }, - toName: function() { - if (this._a === 0) { - return "transparent"; - } + var callback = function callback() { + var didUpdate = false; - if (this._a < 1) { - return false; + if (node.current) { + didUpdate = applyAnimatedValues.fn(node.current, propsAnimated.current.getAnimatedValue()); } - return hexNames[rgbToHex(this._r, this._g, this._b, true)] || false; - }, - toFilter: function(secondColor) { - var hex8String = '#' + rgbaToArgbHex(this._r, this._g, this._b, this._a); - var secondHex8String = hex8String; - var gradientType = this._gradientType ? "GradientType = 1, " : ""; - - if (secondColor) { - var s = tinycolor(secondColor); - secondHex8String = '#' + rgbaToArgbHex(s._r, s._g, s._b, s._a); + if (!node.current || didUpdate === false) { + // If no referenced node has been found, or the update target didn't have a + // native-responder, then forceUpdate the animation ... + forceUpdate(); } + }; - return "progid:DXImageTransform.Microsoft.gradient("+gradientType+"startColorstr="+hex8String+",endColorstr="+secondHex8String+")"; - }, - toString: function(format) { - var formatSet = !!format; - format = format || this._format; - - var formattedString = false; - var hasAlpha = this._a < 1 && this._a >= 0; - var needsAlphaFormat = !formatSet && hasAlpha && (format === "hex" || format === "hex6" || format === "hex3" || format === "hex4" || format === "hex8" || format === "name"); - - if (needsAlphaFormat) { - // Special case for "transparent", all other non-alpha formats - // will return rgba when there is transparency. - if (format === "name" && this._a === 0) { - return this.toName(); - } - return this.toRgbString(); - } - if (format === "rgb") { - formattedString = this.toRgbString(); - } - if (format === "prgb") { - formattedString = this.toPercentageRgbString(); - } - if (format === "hex" || format === "hex6") { - formattedString = this.toHexString(); - } - if (format === "hex3") { - formattedString = this.toHexString(true); - } - if (format === "hex4") { - formattedString = this.toHex8String(true); - } - if (format === "hex8") { - formattedString = this.toHex8String(); - } - if (format === "name") { - formattedString = this.toName(); - } - if (format === "hsl") { - formattedString = this.toHslString(); - } - if (format === "hsv") { - formattedString = this.toHsvString(); - } + propsAnimated.current = new AnimatedProps(props, callback); + oldPropsAnimated && oldPropsAnimated.detach(); + }, []); + React.useEffect(function () { + return function () { + mounted.current = false; + propsAnimated.current && propsAnimated.current.detach(); + }; + }, []); + React.useImperativeHandle(ref, function () { + return animatedApi(node, mounted, forceUpdate); + }); + attachProps(props); - return formattedString || this.toHexString(); - }, - clone: function() { - return tinycolor(this.toString()); - }, + var _getValue = propsAnimated.current.getValue(), + scrollTop = _getValue.scrollTop, + scrollLeft = _getValue.scrollLeft, + animatedProps = _objectWithoutPropertiesLoose(_getValue, ["scrollTop", "scrollLeft"]); // Functions cannot have refs, see: + // See: https://github.com/react-spring/react-spring/issues/569 - _applyModification: function(fn, args) { - var color = fn.apply(null, [this].concat([].slice.call(args))); - this._r = color._r; - this._g = color._g; - this._b = color._b; - this.setAlpha(color._a); - return this; - }, - lighten: function() { - return this._applyModification(lighten, arguments); - }, - brighten: function() { - return this._applyModification(brighten, arguments); - }, - darken: function() { - return this._applyModification(darken, arguments); - }, - desaturate: function() { - return this._applyModification(desaturate, arguments); - }, - saturate: function() { - return this._applyModification(saturate, arguments); - }, - greyscale: function() { - return this._applyModification(greyscale, arguments); - }, - spin: function() { - return this._applyModification(spin, arguments); - }, - _applyCombination: function(fn, args) { - return fn.apply(null, [this].concat([].slice.call(args))); - }, - analogous: function() { - return this._applyCombination(analogous, arguments); - }, - complement: function() { - return this._applyCombination(complement, arguments); - }, - monochromatic: function() { - return this._applyCombination(monochromatic, arguments); - }, - splitcomplement: function() { - return this._applyCombination(splitcomplement, arguments); - }, - triad: function() { - return this._applyCombination(triad, arguments); - }, - tetrad: function() { - return this._applyCombination(tetrad, arguments); - } + var refFn = isFunctionComponent(Component) ? undefined : function (childRef) { + return node.current = handleRef(childRef, ref); + }; + return React__default.createElement(Component, _extends({}, animatedProps, { + ref: refFn + })); + }); + return AnimatedComponent; }; -// If input is an object, force 1 into "1.0" to handle ratios properly -// String input requires "1.0" as input, so 1 will be treated as 1 -tinycolor.fromRatio = function(color, opts) { - if (typeof color == "object") { - var newColor = {}; - for (var i in color) { - if (color.hasOwnProperty(i)) { - if (i === "a") { - newColor[i] = color[i]; - } - else { - newColor[i] = convertToPercentage(color[i]); - } - } - } - color = newColor; - } - - return tinycolor(color, opts); -}; +var active = false; +var controllers = new Set(); -// Given a string or object, convert that input to RGB -// Possible string inputs: -// -// "red" -// "#f00" or "f00" -// "#ff0000" or "ff0000" -// "#ff000000" or "ff000000" -// "rgb 255 0 0" or "rgb (255, 0, 0)" -// "rgb 1.0 0 0" or "rgb (1, 0, 0)" -// "rgba (255, 0, 0, 1)" or "rgba 255, 0, 0, 1" -// "rgba (1.0, 0, 0, 1)" or "rgba 1.0, 0, 0, 1" -// "hsl(0, 100%, 50%)" or "hsl 0 100% 50%" -// "hsla(0, 100%, 50%, 1)" or "hsla 0 100% 50%, 1" -// "hsv(0, 100%, 100%)" or "hsv 0 100% 100%" -// -function inputToRGB(color) { - - var rgb = { r: 0, g: 0, b: 0 }; - var a = 1; - var s = null; - var v = null; - var l = null; - var ok = false; - var format = false; - - if (typeof color == "string") { - color = stringInputToObject(color); - } +var update = function update() { + if (!active) return false; + var time = now(); - if (typeof color == "object") { - if (isValidCSSUnit(color.r) && isValidCSSUnit(color.g) && isValidCSSUnit(color.b)) { - rgb = rgbToRgb(color.r, color.g, color.b); - ok = true; - format = String(color.r).substr(-1) === "%" ? "prgb" : "rgb"; - } - else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.v)) { - s = convertToPercentage(color.s); - v = convertToPercentage(color.v); - rgb = hsvToRgb(color.h, s, v); - ok = true; - format = "hsv"; - } - else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.l)) { - s = convertToPercentage(color.s); - l = convertToPercentage(color.l); - rgb = hslToRgb(color.h, s, l); - ok = true; - format = "hsl"; - } + for (var _iterator = controllers, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { + var _ref; - if (color.hasOwnProperty("a")) { - a = color.a; - } + if (_isArray) { + if (_i >= _iterator.length) break; + _ref = _iterator[_i++]; + } else { + _i = _iterator.next(); + if (_i.done) break; + _ref = _i.value; } - a = boundAlpha(a); - - return { - ok: ok, - format: color.format || format, - r: mathMin(255, mathMax(rgb.r, 0)), - g: mathMin(255, mathMax(rgb.g, 0)), - b: mathMin(255, mathMax(rgb.b, 0)), - a: a - }; -} - - -// Conversion Functions -// -------------------- + var controller = _ref; + var isActive = false; -// `rgbToHsl`, `rgbToHsv`, `hslToRgb`, `hsvToRgb` modified from: -// + for (var configIdx = 0; configIdx < controller.configs.length; configIdx++) { + var config = controller.configs[configIdx]; + var endOfAnimation = void 0, + lastTime = void 0; -// `rgbToRgb` -// Handle bounds / percentage checking to conform to CSS color spec -// -// *Assumes:* r, g, b in [0, 255] or [0, 1] -// *Returns:* { r, g, b } in [0, 255] -function rgbToRgb(r, g, b){ - return { - r: bound01(r, 255) * 255, - g: bound01(g, 255) * 255, - b: bound01(b, 255) * 255 - }; -} + for (var valIdx = 0; valIdx < config.animatedValues.length; valIdx++) { + var animation = config.animatedValues[valIdx]; // If an animation is done, skip, until all of them conclude -// `rgbToHsl` -// Converts an RGB color value to HSL. -// *Assumes:* r, g, and b are contained in [0, 255] or [0, 1] -// *Returns:* { h, s, l } in [0,1] -function rgbToHsl(r, g, b) { + if (animation.done) continue; + var from = config.fromValues[valIdx]; + var to = config.toValues[valIdx]; + var position = animation.lastPosition; + var isAnimated = to instanceof Animated; + var velocity = Array.isArray(config.initialVelocity) ? config.initialVelocity[valIdx] : config.initialVelocity; + if (isAnimated) to = to.getValue(); // Conclude animation if it's either immediate, or from-values match end-state - r = bound01(r, 255); - g = bound01(g, 255); - b = bound01(b, 255); + if (config.immediate) { + animation.setValue(to); + animation.done = true; + continue; + } // Break animation when string values are involved - var max = mathMax(r, g, b), min = mathMin(r, g, b); - var h, s, l = (max + min) / 2; - if(max == min) { - h = s = 0; // achromatic - } - else { - var d = max - min; - s = l > 0.5 ? d / (2 - max - min) : d / (max + min); - switch(max) { - case r: h = (g - b) / d + (g < b ? 6 : 0); break; - case g: h = (b - r) / d + 2; break; - case b: h = (r - g) / d + 4; break; + if (typeof from === 'string' || typeof to === 'string') { + animation.setValue(to); + animation.done = true; + continue; } - h /= 6; - } + if (config.duration !== void 0) { + /** Duration easing */ + position = from + config.easing((time - animation.startTime) / config.duration) * (to - from); + endOfAnimation = time >= animation.startTime + config.duration; + } else if (config.decay) { + /** Decay easing */ + position = from + velocity / (1 - 0.998) * (1 - Math.exp(-(1 - 0.998) * (time - animation.startTime))); + endOfAnimation = Math.abs(animation.lastPosition - position) < 0.1; + if (endOfAnimation) to = position; + } else { + /** Spring easing */ + lastTime = animation.lastTime !== void 0 ? animation.lastTime : time; + velocity = animation.lastVelocity !== void 0 ? animation.lastVelocity : config.initialVelocity; // If we lost a lot of frames just jump to the end. - return { h: h, s: s, l: l }; -} + if (time > lastTime + 64) lastTime = time; // http://gafferongames.com/game-physics/fix-your-timestep/ -// `hslToRgb` -// Converts an HSL color value to RGB. -// *Assumes:* h is contained in [0, 1] or [0, 360] and s and l are contained [0, 1] or [0, 100] -// *Returns:* { r, g, b } in the set [0, 255] -function hslToRgb(h, s, l) { - var r, g, b; - - h = bound01(h, 360); - s = bound01(s, 100); - l = bound01(l, 100); - - function hue2rgb(p, q, t) { - if(t < 0) t += 1; - if(t > 1) t -= 1; - if(t < 1/6) return p + (q - p) * 6 * t; - if(t < 1/2) return q; - if(t < 2/3) return p + (q - p) * (2/3 - t) * 6; - return p; - } + var numSteps = Math.floor(time - lastTime); - if(s === 0) { - r = g = b = l; // achromatic - } - else { - var q = l < 0.5 ? l * (1 + s) : l + s - l * s; - var p = 2 * l - q; - r = hue2rgb(p, q, h + 1/3); - g = hue2rgb(p, q, h); - b = hue2rgb(p, q, h - 1/3); - } + for (var i = 0; i < numSteps; ++i) { + var force = -config.tension * (position - to); + var damping = -config.friction * velocity; + var acceleration = (force + damping) / config.mass; + velocity = velocity + acceleration * 1 / 1000; + position = position + velocity * 1 / 1000; + } // Conditions for stopping the spring animation - return { r: r * 255, g: g * 255, b: b * 255 }; -} -// `rgbToHsv` -// Converts an RGB color value to HSV -// *Assumes:* r, g, and b are contained in the set [0, 255] or [0, 1] -// *Returns:* { h, s, v } in [0,1] -function rgbToHsv(r, g, b) { + var isOvershooting = config.clamp && config.tension !== 0 ? from < to ? position > to : position < to : false; + var isVelocity = Math.abs(velocity) <= config.precision; + var isDisplacement = config.tension !== 0 ? Math.abs(to - position) <= config.precision : true; + endOfAnimation = isOvershooting || isVelocity && isDisplacement; + animation.lastVelocity = velocity; + animation.lastTime = time; + } // Trails aren't done until their parents conclude + - r = bound01(r, 255); - g = bound01(g, 255); - b = bound01(b, 255); + if (isAnimated && !config.toValues[valIdx].done) endOfAnimation = false; - var max = mathMax(r, g, b), min = mathMin(r, g, b); - var h, s, v = max; + if (endOfAnimation) { + // Ensure that we end up with a round value + if (animation.value !== to) position = to; + animation.done = true; + } else isActive = true; - var d = max - min; - s = max === 0 ? 0 : d / max; + animation.setValue(position); + animation.lastPosition = position; + } // Keep track of updated values only when necessary - if(max == min) { - h = 0; // achromatic - } - else { - switch(max) { - case r: h = (g - b) / d + (g < b ? 6 : 0); break; - case g: h = (b - r) / d + 2; break; - case b: h = (r - g) / d + 4; break; - } - h /= 6; - } - return { h: h, s: s, v: v }; -} -// `hsvToRgb` -// Converts an HSV color value to RGB. -// *Assumes:* h is contained in [0, 1] or [0, 360] and s and v are contained in [0, 1] or [0, 100] -// *Returns:* { r, g, b } in the set [0, 255] - function hsvToRgb(h, s, v) { - - h = bound01(h, 360) * 6; - s = bound01(s, 100); - v = bound01(v, 100); - - var i = Math.floor(h), - f = h - i, - p = v * (1 - s), - q = v * (1 - f * s), - t = v * (1 - (1 - f) * s), - mod = i % 6, - r = [v, q, p, p, t, v][mod], - g = [t, v, v, q, p, p][mod], - b = [p, p, t, v, v, q][mod]; - - return { r: r * 255, g: g * 255, b: b * 255 }; -} + if (controller.props.onFrame) controller.values[config.name] = config.interpolation.getValue(); + } // Update callbacks in the end of the frame -// `rgbToHex` -// Converts an RGB color to hex -// Assumes r, g, and b are contained in the set [0, 255] -// Returns a 3 or 6 character hex -function rgbToHex(r, g, b, allow3Char) { - - var hex = [ - pad2(mathRound(r).toString(16)), - pad2(mathRound(g).toString(16)), - pad2(mathRound(b).toString(16)) - ]; - - // Return a 3 character hex if possible - if (allow3Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1)) { - return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0); - } - return hex.join(""); -} + if (controller.props.onFrame) controller.props.onFrame(controller.values); // Either call onEnd or next frame -// `rgbaToHex` -// Converts an RGBA color plus alpha transparency to hex -// Assumes r, g, b are contained in the set [0, 255] and -// a in [0, 1]. Returns a 4 or 8 character rgba hex -function rgbaToHex(r, g, b, a, allow4Char) { - - var hex = [ - pad2(mathRound(r).toString(16)), - pad2(mathRound(g).toString(16)), - pad2(mathRound(b).toString(16)), - pad2(convertDecimalToHex(a)) - ]; - - // Return a 4 character hex if possible - if (allow4Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1) && hex[3].charAt(0) == hex[3].charAt(1)) { - return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0) + hex[3].charAt(0); + if (!isActive) { + controllers.delete(controller); + controller.stop(true); } + } // Loop over as long as there are controllers ... - return hex.join(""); -} -// `rgbaToArgbHex` -// Converts an RGBA color to an ARGB Hex8 string -// Rarely used, but required for "toFilter()" -function rgbaToArgbHex(r, g, b, a) { + if (controllers.size) { + if (manualFrameloop) manualFrameloop();else requestFrame(update); + } else { + active = false; + } - var hex = [ - pad2(convertDecimalToHex(a)), - pad2(mathRound(r).toString(16)), - pad2(mathRound(g).toString(16)), - pad2(mathRound(b).toString(16)) - ]; + return active; +}; - return hex.join(""); -} +var start = function start(controller) { + if (!controllers.has(controller)) controllers.add(controller); -// `equals` -// Can be called with any tinycolor input -tinycolor.equals = function (color1, color2) { - if (!color1 || !color2) { return false; } - return tinycolor(color1).toRgbString() == tinycolor(color2).toRgbString(); + if (!active) { + active = true; + if (manualFrameloop) requestFrame(manualFrameloop);else requestFrame(update); + } }; -tinycolor.random = function() { - return tinycolor.fromRatio({ - r: mathRandom(), - g: mathRandom(), - b: mathRandom() - }); +var stop = function stop(controller) { + if (controllers.has(controller)) controllers.delete(controller); }; +function createInterpolator(range, output, extrapolate) { + if (typeof range === 'function') { + return range; + } -// Modification Functions -// ---------------------- -// Thanks to less.js for some of the basics here -// + if (Array.isArray(range)) { + return createInterpolator({ + range: range, + output: output, + extrapolate: extrapolate + }); + } -function desaturate(color, amount) { - amount = (amount === 0) ? 0 : (amount || 10); - var hsl = tinycolor(color).toHsl(); - hsl.s -= amount / 100; - hsl.s = clamp01(hsl.s); - return tinycolor(hsl); -} - -function saturate(color, amount) { - amount = (amount === 0) ? 0 : (amount || 10); - var hsl = tinycolor(color).toHsl(); - hsl.s += amount / 100; - hsl.s = clamp01(hsl.s); - return tinycolor(hsl); -} + if (interpolation && typeof range.output[0] === 'string') { + return interpolation(range); + } -function greyscale(color) { - return tinycolor(color).desaturate(100); -} + var config = range; + var outputRange = config.output; + var inputRange = config.range || [0, 1]; + var extrapolateLeft = config.extrapolateLeft || config.extrapolate || 'extend'; + var extrapolateRight = config.extrapolateRight || config.extrapolate || 'extend'; -function lighten (color, amount) { - amount = (amount === 0) ? 0 : (amount || 10); - var hsl = tinycolor(color).toHsl(); - hsl.l += amount / 100; - hsl.l = clamp01(hsl.l); - return tinycolor(hsl); -} + var easing = config.easing || function (t) { + return t; + }; -function brighten(color, amount) { - amount = (amount === 0) ? 0 : (amount || 10); - var rgb = tinycolor(color).toRgb(); - rgb.r = mathMax(0, mathMin(255, rgb.r - mathRound(255 * - (amount / 100)))); - rgb.g = mathMax(0, mathMin(255, rgb.g - mathRound(255 * - (amount / 100)))); - rgb.b = mathMax(0, mathMin(255, rgb.b - mathRound(255 * - (amount / 100)))); - return tinycolor(rgb); + return function (input) { + var range = findRange(input, inputRange); + return interpolate(input, inputRange[range], inputRange[range + 1], outputRange[range], outputRange[range + 1], easing, extrapolateLeft, extrapolateRight, config.map); + }; } -function darken (color, amount) { - amount = (amount === 0) ? 0 : (amount || 10); - var hsl = tinycolor(color).toHsl(); - hsl.l -= amount / 100; - hsl.l = clamp01(hsl.l); - return tinycolor(hsl); -} +function interpolate(input, inputMin, inputMax, outputMin, outputMax, easing, extrapolateLeft, extrapolateRight, map) { + var result = map ? map(input) : input; // Extrapolate -// Spin takes a positive or negative amount within [-360, 360] indicating the change of hue. -// Values outside of this range will be wrapped into this range. -function spin(color, amount) { - var hsl = tinycolor(color).toHsl(); - var hue = (hsl.h + amount) % 360; - hsl.h = hue < 0 ? 360 + hue : hue; - return tinycolor(hsl); -} + if (result < inputMin) { + if (extrapolateLeft === 'identity') return result;else if (extrapolateLeft === 'clamp') result = inputMin; + } -// Combination Functions -// --------------------- -// Thanks to jQuery xColor for some of the ideas behind these -// + if (result > inputMax) { + if (extrapolateRight === 'identity') return result;else if (extrapolateRight === 'clamp') result = inputMax; + } -function complement(color) { - var hsl = tinycolor(color).toHsl(); - hsl.h = (hsl.h + 180) % 360; - return tinycolor(hsl); -} + if (outputMin === outputMax) return outputMin; + if (inputMin === inputMax) return input <= inputMin ? outputMin : outputMax; // Input Range -function triad(color) { - var hsl = tinycolor(color).toHsl(); - var h = hsl.h; - return [ - tinycolor(color), - tinycolor({ h: (h + 120) % 360, s: hsl.s, l: hsl.l }), - tinycolor({ h: (h + 240) % 360, s: hsl.s, l: hsl.l }) - ]; -} + if (inputMin === -Infinity) result = -result;else if (inputMax === Infinity) result = result - inputMin;else result = (result - inputMin) / (inputMax - inputMin); // Easing -function tetrad(color) { - var hsl = tinycolor(color).toHsl(); - var h = hsl.h; - return [ - tinycolor(color), - tinycolor({ h: (h + 90) % 360, s: hsl.s, l: hsl.l }), - tinycolor({ h: (h + 180) % 360, s: hsl.s, l: hsl.l }), - tinycolor({ h: (h + 270) % 360, s: hsl.s, l: hsl.l }) - ]; -} + result = easing(result); // Output Range -function splitcomplement(color) { - var hsl = tinycolor(color).toHsl(); - var h = hsl.h; - return [ - tinycolor(color), - tinycolor({ h: (h + 72) % 360, s: hsl.s, l: hsl.l}), - tinycolor({ h: (h + 216) % 360, s: hsl.s, l: hsl.l}) - ]; + if (outputMin === -Infinity) result = -result;else if (outputMax === Infinity) result = result + outputMin;else result = result * (outputMax - outputMin) + outputMin; + return result; } -function analogous(color, results, slices) { - results = results || 6; - slices = slices || 30; - - var hsl = tinycolor(color).toHsl(); - var part = 360 / slices; - var ret = [tinycolor(color)]; +function findRange(input, inputRange) { + for (var i = 1; i < inputRange.length - 1; ++i) { + if (inputRange[i] >= input) break; + } - for (hsl.h = ((hsl.h - (part * results >> 1)) + 720) % 360; --results; ) { - hsl.h = (hsl.h + part) % 360; - ret.push(tinycolor(hsl)); - } - return ret; + return i - 1; } -function monochromatic(color, results) { - results = results || 6; - var hsv = tinycolor(color).toHsv(); - var h = hsv.h, s = hsv.s, v = hsv.v; - var ret = []; - var modification = 1 / results; +var AnimatedInterpolation = +/*#__PURE__*/ +function (_AnimatedArray) { + _inheritsLoose(AnimatedInterpolation, _AnimatedArray); - while (results--) { - ret.push(tinycolor({ h: h, s: s, v: v})); - v = (v + modification) % 1; - } + function AnimatedInterpolation(parents, range, output, extrapolate) { + var _this; - return ret; -} + _this = _AnimatedArray.call(this) || this; + _this.calc = void 0; + _this.payload = parents instanceof AnimatedArray && !(parents instanceof AnimatedInterpolation) ? parents.getPayload() : Array.isArray(parents) ? parents : [parents]; + _this.calc = createInterpolator(range, output, extrapolate); + return _this; + } -// Utility Functions -// --------------------- + var _proto = AnimatedInterpolation.prototype; -tinycolor.mix = function(color1, color2, amount) { - amount = (amount === 0) ? 0 : (amount || 50); + _proto.getValue = function getValue() { + return this.calc.apply(this, this.payload.map(function (value) { + return value.getValue(); + })); + }; - var rgb1 = tinycolor(color1).toRgb(); - var rgb2 = tinycolor(color2).toRgb(); + _proto.updateConfig = function updateConfig(range, output, extrapolate) { + this.calc = createInterpolator(range, output, extrapolate); + }; - var p = amount / 100; + _proto.interpolate = function interpolate(range, output, extrapolate) { + return new AnimatedInterpolation(this, range, output, extrapolate); + }; - var rgba = { - r: ((rgb2.r - rgb1.r) * p) + rgb1.r, - g: ((rgb2.g - rgb1.g) * p) + rgb1.g, - b: ((rgb2.b - rgb1.b) * p) + rgb1.b, - a: ((rgb2.a - rgb1.a) * p) + rgb1.a - }; + return AnimatedInterpolation; +}(AnimatedArray); - return tinycolor(rgba); +var interpolate$1 = function interpolate(parents, range, output) { + return parents && new AnimatedInterpolation(parents, range, output); }; +var config = { + default: { + tension: 170, + friction: 26 + }, + gentle: { + tension: 120, + friction: 14 + }, + wobbly: { + tension: 180, + friction: 12 + }, + stiff: { + tension: 210, + friction: 20 + }, + slow: { + tension: 280, + friction: 60 + }, + molasses: { + tension: 280, + friction: 120 + } +}; -// Readability Functions -// --------------------- -// false -// tinycolor.isReadable("#000", "#111",{level:"AA",size:"large"}) => false -tinycolor.isReadable = function(color1, color2, wcag2) { - var readability = tinycolor.readability(color1, color2); - var wcag2Parms, out; - - out = false; - - wcag2Parms = validateWCAG2Parms(wcag2); - switch (wcag2Parms.level + wcag2Parms.size) { - case "AAsmall": - case "AAAlarge": - out = readability >= 4.5; - break; - case "AAlarge": - out = readability >= 3; - break; - case "AAAsmall": - out = readability >= 7; - break; - } - return out; + var previous = React.useRef(); + React.useEffect(function () { + if (is.equ(refs, previous.current)) refs.forEach(function (_ref) { + var current = _ref.current; + return current && current.start(); + });else if (timeSteps) { + refs.forEach(function (_ref2, index) { + var current = _ref2.current; -}; + if (current) { + var ctrls = current.controllers; -// `mostReadable` -// Given a base color and a list of possible foreground or background -// colors for that base, returns the most readable color. -// Optionally returns Black or White if the most readable color is unreadable. -// *Example* -// tinycolor.mostReadable(tinycolor.mostReadable("#123", ["#124", "#125"],{includeFallbackColors:false}).toHexString(); // "#112255" -// tinycolor.mostReadable(tinycolor.mostReadable("#123", ["#124", "#125"],{includeFallbackColors:true}).toHexString(); // "#ffffff" -// tinycolor.mostReadable("#a8015a", ["#faf3f3"],{includeFallbackColors:true,level:"AAA",size:"large"}).toHexString(); // "#faf3f3" -// tinycolor.mostReadable("#a8015a", ["#faf3f3"],{includeFallbackColors:true,level:"AAA",size:"small"}).toHexString(); // "#ffffff" -tinycolor.mostReadable = function(baseColor, colorList, args) { - var bestColor = null; - var bestScore = 0; - var readability; - var includeFallbackColors, level, size ; - args = args || {}; - includeFallbackColors = args.includeFallbackColors ; - level = args.level; - size = args.size; - - for (var i= 0; i < colorList.length ; i++) { - readability = tinycolor.readability(baseColor, colorList[i]); - if (readability > bestScore) { - bestScore = readability; - bestColor = tinycolor(colorList[i]); + if (ctrls.length) { + var t = timeFrame * timeSteps[index]; + ctrls.forEach(function (ctrl) { + ctrl.queue = ctrl.queue.map(function (e) { + return _extends({}, e, { + delay: e.delay + t + }); + }); + ctrl.start(); + }); + } } - } + }); + } else refs.reduce(function (q, _ref3, rI) { + var current = _ref3.current; + return q = q.then(function () { + return current.start(); + }); + }, Promise.resolve()); + previous.current = refs; + }); +} - if (tinycolor.isReadable(baseColor, bestColor, {"level":level,"size":size}) || !includeFallbackColors) { - return bestColor; - } - else { - args.includeFallbackColors=false; - return tinycolor.mostReadable(baseColor,["#fff", "#000"],args); - } -}; +/** + * Animated works by building a directed acyclic graph of dependencies + * transparently when you render your Animated components. + * + * new Animated.Value(0) + * .interpolate() .interpolate() new Animated.Value(1) + * opacity translateY scale + * style transform + * View#234 style + * View#123 + * + * A) Top Down phase + * When an AnimatedValue is updated, we recursively go down through this + * graph in order to find leaf nodes: the views that we flag as needing + * an update. + * + * B) Bottom Up phase + * When a view is flagged as needing an update, we recursively go back up + * in order to build the new value that it needs. The reason why we need + * this two-phases process is to deal with composite props such as + * transform which can receive values from multiple parents. + */ +function addAnimatedStyles(node, styles) { + if ('update' in node) { + styles.add(node); + } else { + node.getChildren().forEach(function (child) { + return addAnimatedStyles(child, styles); + }); + } +} +var AnimatedValue = +/*#__PURE__*/ +function (_Animated) { + _inheritsLoose(AnimatedValue, _Animated); -// Big List of Colors -// ------------------ -// -var names = tinycolor.names = { - aliceblue: "f0f8ff", - antiquewhite: "faebd7", - aqua: "0ff", - aquamarine: "7fffd4", - azure: "f0ffff", - beige: "f5f5dc", - bisque: "ffe4c4", - black: "000", - blanchedalmond: "ffebcd", - blue: "00f", - blueviolet: "8a2be2", - brown: "a52a2a", - burlywood: "deb887", - burntsienna: "ea7e5d", - cadetblue: "5f9ea0", - chartreuse: "7fff00", - chocolate: "d2691e", - coral: "ff7f50", - cornflowerblue: "6495ed", - cornsilk: "fff8dc", - crimson: "dc143c", - cyan: "0ff", - darkblue: "00008b", - darkcyan: "008b8b", - darkgoldenrod: "b8860b", - darkgray: "a9a9a9", - darkgreen: "006400", - darkgrey: "a9a9a9", - darkkhaki: "bdb76b", - darkmagenta: "8b008b", - darkolivegreen: "556b2f", - darkorange: "ff8c00", - darkorchid: "9932cc", - darkred: "8b0000", - darksalmon: "e9967a", - darkseagreen: "8fbc8f", - darkslateblue: "483d8b", - darkslategray: "2f4f4f", - darkslategrey: "2f4f4f", - darkturquoise: "00ced1", - darkviolet: "9400d3", - deeppink: "ff1493", - deepskyblue: "00bfff", - dimgray: "696969", - dimgrey: "696969", - dodgerblue: "1e90ff", - firebrick: "b22222", - floralwhite: "fffaf0", - forestgreen: "228b22", - fuchsia: "f0f", - gainsboro: "dcdcdc", - ghostwhite: "f8f8ff", - gold: "ffd700", - goldenrod: "daa520", - gray: "808080", - green: "008000", - greenyellow: "adff2f", - grey: "808080", - honeydew: "f0fff0", - hotpink: "ff69b4", - indianred: "cd5c5c", - indigo: "4b0082", - ivory: "fffff0", - khaki: "f0e68c", - lavender: "e6e6fa", - lavenderblush: "fff0f5", - lawngreen: "7cfc00", - lemonchiffon: "fffacd", - lightblue: "add8e6", - lightcoral: "f08080", - lightcyan: "e0ffff", - lightgoldenrodyellow: "fafad2", - lightgray: "d3d3d3", - lightgreen: "90ee90", - lightgrey: "d3d3d3", - lightpink: "ffb6c1", - lightsalmon: "ffa07a", - lightseagreen: "20b2aa", - lightskyblue: "87cefa", - lightslategray: "789", - lightslategrey: "789", - lightsteelblue: "b0c4de", - lightyellow: "ffffe0", - lime: "0f0", - limegreen: "32cd32", - linen: "faf0e6", - magenta: "f0f", - maroon: "800000", - mediumaquamarine: "66cdaa", - mediumblue: "0000cd", - mediumorchid: "ba55d3", - mediumpurple: "9370db", - mediumseagreen: "3cb371", - mediumslateblue: "7b68ee", - mediumspringgreen: "00fa9a", - mediumturquoise: "48d1cc", - mediumvioletred: "c71585", - midnightblue: "191970", - mintcream: "f5fffa", - mistyrose: "ffe4e1", - moccasin: "ffe4b5", - navajowhite: "ffdead", - navy: "000080", - oldlace: "fdf5e6", - olive: "808000", - olivedrab: "6b8e23", - orange: "ffa500", - orangered: "ff4500", - orchid: "da70d6", - palegoldenrod: "eee8aa", - palegreen: "98fb98", - paleturquoise: "afeeee", - palevioletred: "db7093", - papayawhip: "ffefd5", - peachpuff: "ffdab9", - peru: "cd853f", - pink: "ffc0cb", - plum: "dda0dd", - powderblue: "b0e0e6", - purple: "800080", - rebeccapurple: "663399", - red: "f00", - rosybrown: "bc8f8f", - royalblue: "4169e1", - saddlebrown: "8b4513", - salmon: "fa8072", - sandybrown: "f4a460", - seagreen: "2e8b57", - seashell: "fff5ee", - sienna: "a0522d", - silver: "c0c0c0", - skyblue: "87ceeb", - slateblue: "6a5acd", - slategray: "708090", - slategrey: "708090", - snow: "fffafa", - springgreen: "00ff7f", - steelblue: "4682b4", - tan: "d2b48c", - teal: "008080", - thistle: "d8bfd8", - tomato: "ff6347", - turquoise: "40e0d0", - violet: "ee82ee", - wheat: "f5deb3", - white: "fff", - whitesmoke: "f5f5f5", - yellow: "ff0", - yellowgreen: "9acd32" -}; + function AnimatedValue(_value) { + var _this; -// Make it easy to access colors via `hexNames[hex]` -var hexNames = tinycolor.hexNames = flip(names); + _this = _Animated.call(this) || this; + _this.animatedStyles = new Set(); + _this.value = void 0; + _this.startPosition = void 0; + _this.lastPosition = void 0; + _this.lastVelocity = void 0; + _this.startTime = void 0; + _this.lastTime = void 0; + _this.done = false; + _this.setValue = function (value, flush) { + if (flush === void 0) { + flush = true; + } -// Utilities -// --------- + _this.value = value; + if (flush) _this.flush(); + }; -// `{ 'name1': 'val1' }` becomes `{ 'val1': 'name1' }` -function flip(o) { - var flipped = { }; - for (var i in o) { - if (o.hasOwnProperty(i)) { - flipped[o[i]] = i; - } - } - return flipped; -} + _this.value = _value; + _this.startPosition = _value; + _this.lastPosition = _value; + return _this; + } -// Return a valid alpha value [0,1] with all invalid values being set to 1 -function boundAlpha(a) { - a = parseFloat(a); + var _proto = AnimatedValue.prototype; - if (isNaN(a) || a < 0 || a > 1) { - a = 1; + _proto.flush = function flush() { + if (this.animatedStyles.size === 0) { + addAnimatedStyles(this, this.animatedStyles); } - return a; -} - -// Take input from [0, n] and return it as [0, 1] -function bound01(n, max) { - if (isOnePointZero(n)) { n = "100%"; } + this.animatedStyles.forEach(function (animatedStyle) { + return animatedStyle.update(); + }); + }; - var processPercent = isPercentage(n); - n = mathMin(max, mathMax(0, parseFloat(n))); + _proto.clearStyles = function clearStyles() { + this.animatedStyles.clear(); + }; - // Automatically convert percentage into number - if (processPercent) { - n = parseInt(n * max, 10) / 100; - } + _proto.getValue = function getValue() { + return this.value; + }; - // Handle floating point rounding errors - if ((Math.abs(n - max) < 0.000001)) { - return 1; - } + _proto.interpolate = function interpolate(range, output, extrapolate) { + return new AnimatedInterpolation(this, range, output, extrapolate); + }; - // Convert into [0, 1] range if it isn't already - return (n % max) / parseFloat(max); -} + return AnimatedValue; +}(Animated); -// Force a number between 0 and 1 -function clamp01(val) { - return mathMin(1, mathMax(0, val)); -} +var AnimatedValueArray = +/*#__PURE__*/ +function (_AnimatedArray) { + _inheritsLoose(AnimatedValueArray, _AnimatedArray); -// Parse a base-16 hex value into a base-10 integer -function parseIntFromHex(val) { - return parseInt(val, 16); -} + function AnimatedValueArray(values) { + var _this; -// Need to handle 1.0 as 100%, since once it is a number, there is no difference between it and 1 -// -function isOnePointZero(n) { - return typeof n == "string" && n.indexOf('.') != -1 && parseFloat(n) === 1; -} + _this = _AnimatedArray.call(this) || this; + _this.payload = values.map(function (n) { + return new AnimatedValue(n); + }); + return _this; + } -// Check to see if string passed in is a percentage -function isPercentage(n) { - return typeof n === "string" && n.indexOf('%') != -1; -} + var _proto = AnimatedValueArray.prototype; -// Force a hex value to have 2 characters -function pad2(c) { - return c.length == 1 ? '0' + c : '' + c; -} + _proto.setValue = function setValue(value, flush) { + var _this2 = this; -// Replace a decimal with it's percentage value -function convertToPercentage(n) { - if (n <= 1) { - n = (n * 100) + "%"; + if (flush === void 0) { + flush = true; } - return n; -} + if (Array.isArray(value)) { + if (value.length === this.payload.length) { + value.forEach(function (v, i) { + return _this2.payload[i].setValue(v, flush); + }); + } + } else { + this.payload.forEach(function (p) { + return p.setValue(value, flush); + }); + } + }; -// Converts a decimal to a hex value -function convertDecimalToHex(d) { - return Math.round(parseFloat(d) * 255).toString(16); -} -// Converts a hex value to a decimal -function convertHexToDecimal(h) { - return (parseIntFromHex(h) / 255); -} + _proto.getValue = function getValue() { + return this.payload.map(function (v) { + return v.getValue(); + }); + }; -var matchers = (function() { + _proto.interpolate = function interpolate(range, output) { + return new AnimatedInterpolation(this, range, output); + }; - // - var CSS_INTEGER = "[-\\+]?\\d+%?"; + return AnimatedValueArray; +}(AnimatedArray); - // - var CSS_NUMBER = "[-\\+]?\\d*\\.\\d+%?"; +var G = 0; - // Allow positive/negative integer/number. Don't capture the either/or, just the entire outcome. - var CSS_UNIT = "(?:" + CSS_NUMBER + ")|(?:" + CSS_INTEGER + ")"; +var Controller = +/*#__PURE__*/ +function () { + function Controller() { + var _this = this; - // Actual matching. - // Parentheses and commas are optional, but not required. - // Whitespace can take the place of commas or opening paren - var PERMISSIVE_MATCH3 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?"; - var PERMISSIVE_MATCH4 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?"; + this.id = void 0; + this.idle = true; + this.hasChanged = false; + this.guid = 0; + this.local = 0; + this.props = {}; + this.merged = {}; + this.animations = {}; + this.interpolations = {}; + this.values = {}; + this.configs = []; + this.listeners = []; + this.queue = []; + this.localQueue = void 0; - return { - CSS_UNIT: new RegExp(CSS_UNIT), - rgb: new RegExp("rgb" + PERMISSIVE_MATCH3), - rgba: new RegExp("rgba" + PERMISSIVE_MATCH4), - hsl: new RegExp("hsl" + PERMISSIVE_MATCH3), - hsla: new RegExp("hsla" + PERMISSIVE_MATCH4), - hsv: new RegExp("hsv" + PERMISSIVE_MATCH3), - hsva: new RegExp("hsva" + PERMISSIVE_MATCH4), - hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/, - hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/, - hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/, - hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/ + this.getValues = function () { + return _this.interpolations; }; -})(); -// `isValidCSSUnit` -// Take in a single string / number and check to see if it looks like a CSS unit -// (see `matchers` above for definition). -function isValidCSSUnit(color) { - return !!matchers.CSS_UNIT.exec(color); -} + this.id = G++; + } + /** update(props) + * This function filters input props and creates an array of tasks which are executed in .start() + * Each task is allowed to carry a delay, which means it can execute asnychroneously */ -// `stringInputToObject` -// Permissive string parsing. Take in a number of formats, and output an object -// based on detected format. Returns `{ r, g, b }` or `{ h, s, l }` or `{ h, s, v}` -function stringInputToObject(color) { - color = color.replace(trimLeft,'').replace(trimRight, '').toLowerCase(); - var named = false; - if (names[color]) { - color = names[color]; - named = true; - } - else if (color == 'transparent') { - return { r: 0, g: 0, b: 0, a: 0, format: "name" }; - } + var _proto = Controller.prototype; - // Try to match string input using regular expressions. - // Keep most of the number bounding out of this function - don't worry about [0,1] or [0,100] or [0,360] - // Just return an object and let the conversion functions handle that. - // This way the result will be the same whether the tinycolor is initialized with string or object. - var match; - if ((match = matchers.rgb.exec(color))) { - return { r: match[1], g: match[2], b: match[3] }; - } - if ((match = matchers.rgba.exec(color))) { - return { r: match[1], g: match[2], b: match[3], a: match[4] }; - } - if ((match = matchers.hsl.exec(color))) { - return { h: match[1], s: match[2], l: match[3] }; - } - if ((match = matchers.hsla.exec(color))) { - return { h: match[1], s: match[2], l: match[3], a: match[4] }; - } - if ((match = matchers.hsv.exec(color))) { - return { h: match[1], s: match[2], v: match[3] }; - } - if ((match = matchers.hsva.exec(color))) { - return { h: match[1], s: match[2], v: match[3], a: match[4] }; - } - if ((match = matchers.hex8.exec(color))) { - return { - r: parseIntFromHex(match[1]), - g: parseIntFromHex(match[2]), - b: parseIntFromHex(match[3]), - a: convertHexToDecimal(match[4]), - format: named ? "name" : "hex8" - }; - } - if ((match = matchers.hex6.exec(color))) { - return { - r: parseIntFromHex(match[1]), - g: parseIntFromHex(match[2]), - b: parseIntFromHex(match[3]), - format: named ? "name" : "hex" - }; - } - if ((match = matchers.hex4.exec(color))) { - return { - r: parseIntFromHex(match[1] + '' + match[1]), - g: parseIntFromHex(match[2] + '' + match[2]), - b: parseIntFromHex(match[3] + '' + match[3]), - a: convertHexToDecimal(match[4] + '' + match[4]), - format: named ? "name" : "hex8" - }; - } - if ((match = matchers.hex3.exec(color))) { - return { - r: parseIntFromHex(match[1] + '' + match[1]), - g: parseIntFromHex(match[2] + '' + match[2]), - b: parseIntFromHex(match[3] + '' + match[3]), - format: named ? "name" : "hex" - }; - } + _proto.update = function update$$1(args) { + //this._id = n + this.id + if (!args) return this; // Extract delay and the to-prop from props - return false; -} + var _ref = interpolateTo(args), + _ref$delay = _ref.delay, + delay = _ref$delay === void 0 ? 0 : _ref$delay, + to = _ref.to, + props = _objectWithoutPropertiesLoose(_ref, ["delay", "to"]); -function validateWCAG2Parms(parms) { - // return valid WCAG2 parms for isReadable. - // If input parms are invalid, return {"level":"AA", "size":"small"} - var level, size; - parms = parms || {"level":"AA", "size":"small"}; - level = (parms.level || "AA").toUpperCase(); - size = (parms.size || "small").toLowerCase(); - if (level !== "AA" && level !== "AAA") { - level = "AA"; - } - if (size !== "small" && size !== "large") { - size = "small"; - } - return {"level":level, "size":size}; -} + if (is.arr(to) || is.fun(to)) { + // If config is either a function or an array queue it up as is + this.queue.push(_extends({}, props, { + delay: delay, + to: to + })); + } else if (to) { + // Otherwise go through each key since it could be delayed individually + var ops = {}; + Object.entries(to).forEach(function (_ref2) { + var _to; -// Node: Export function -if ( true && module.exports) { - module.exports = tinycolor; -} -// AMD/requirejs: Define the module -else if (typeof define === 'function' && define.amd) { - define(function () {return tinycolor;}); -} -// Browser: Expose to window -else { - window.tinycolor = tinycolor; -} + var k = _ref2[0], + v = _ref2[1]; + + // Fetch delay and create an entry, consisting of the to-props, the delay, and basic props + var entry = _extends({ + to: (_to = {}, _to[k] = v, _to), + delay: callProp(delay, k) + }, props); -})(Math); + var previous = ops[entry.delay] && ops[entry.delay].to; + ops[entry.delay] = _extends({}, ops[entry.delay], entry, { + to: _extends({}, previous, entry.to) + }); + }); + this.queue = Object.values(ops); + } // Sort queue, so that async calls go last -/***/ }), -/* 107 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { + this.queue = this.queue.sort(function (a, b) { + return a.delay - b.delay; + }); // Diff the reduced props immediately (they'll contain the from-prop and some config) -"use strict"; -/* harmony import */ var _babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7); -/* harmony import */ var _babel_runtime_helpers_esm_objectWithoutProperties__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(11); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(0); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_2__); + this.diff(props); + return this; + } + /** start(onEnd) + * This function either executes a queue, if present, or starts the frameloop, which animates */ + ; + _proto.start = function start$$1(onEnd) { + var _this2 = this; + // If a queue is present we must excecute it + if (this.queue.length) { + this.idle = false; // Updates can interrupt trailing queues, in that case we just merge values + if (this.localQueue) { + this.localQueue.forEach(function (_ref3) { + var _ref3$from = _ref3.from, + from = _ref3$from === void 0 ? {} : _ref3$from, + _ref3$to = _ref3.to, + to = _ref3$to === void 0 ? {} : _ref3$to; + if (is.obj(from)) _this2.merged = _extends({}, from, _this2.merged); + if (is.obj(to)) _this2.merged = _extends({}, _this2.merged, to); + }); + } // The guid helps us tracking frames, a new queue over an old one means an override + // We discard async calls in that caseÍ -function Dashicon(_ref) { - var icon = _ref.icon, - _ref$size = _ref.size, - size = _ref$size === void 0 ? 20 : _ref$size, - className = _ref.className, - extraProps = Object(_babel_runtime_helpers_esm_objectWithoutProperties__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])(_ref, ["icon", "size", "className"]); - var iconClass = ['dashicon', 'dashicons', 'dashicons-' + icon, className].filter(Boolean).join(' '); - return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_2__["createElement"])("span", Object(_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])({ - className: iconClass, - width: size, - height: size - }, extraProps)); -} + var local = this.local = ++this.guid; + var queue = this.localQueue = this.queue; + this.queue = []; // Go through each entry and execute it -/* harmony default export */ __webpack_exports__["a"] = (Dashicon); -//# sourceMappingURL=index.js.map + queue.forEach(function (_ref4, index) { + var delay = _ref4.delay, + props = _objectWithoutPropertiesLoose(_ref4, ["delay"]); -/***/ }), -/* 108 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { + var cb = function cb(finished) { + if (index === queue.length - 1 && local === _this2.guid && finished) { + _this2.idle = true; + if (_this2.props.onRest) _this2.props.onRest(_this2.merged); + } -"use strict"; + if (onEnd) onEnd(); + }; // Entries can be delayed, ansyc or immediate -// EXPORTS -__webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ createBrowserHistory; }); -__webpack_require__.d(__webpack_exports__, "c", function() { return /* binding */ createMemoryHistory; }); -__webpack_require__.d(__webpack_exports__, "b", function() { return /* binding */ createLocation; }); -__webpack_require__.d(__webpack_exports__, "e", function() { return /* binding */ locationsAreEqual; }); -__webpack_require__.d(__webpack_exports__, "d", function() { return /* binding */ createPath; }); -// UNUSED EXPORTS: createHashHistory, parsePath + var async = is.arr(props.to) || is.fun(props.to); -// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js -var esm_extends = __webpack_require__(7); + if (delay) { + setTimeout(function () { + if (local === _this2.guid) { + if (async) _this2.runAsync(props, cb);else _this2.diff(props).start(cb); + } + }, delay); + } else if (async) _this2.runAsync(props, cb);else _this2.diff(props).start(cb); + }); + } // Otherwise we kick of the frameloop + else { + if (is.fun(onEnd)) this.listeners.push(onEnd); + if (this.props.onStart) this.props.onStart(); -// CONCATENATED MODULE: ./node_modules/resolve-pathname/esm/resolve-pathname.js -function isAbsolute(pathname) { - return pathname.charAt(0) === '/'; -} + start(this); + } -// About 1.5x faster than the two-arg version of Array#splice() -function spliceOne(list, index) { - for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) { - list[i] = list[k]; + return this; + }; + + _proto.stop = function stop$$1(finished) { + this.listeners.forEach(function (onEnd) { + return onEnd(finished); + }); + this.listeners = []; + return this; } + /** Pause sets onEnd listeners free, but also removes the controller from the frameloop */ + ; - list.pop(); -} + _proto.pause = function pause(finished) { + this.stop(true); + if (finished) stop(this); + return this; + }; -// This implementation is based heavily on node's url.parse -function resolvePathname(to, from) { - if (from === undefined) from = ''; + _proto.runAsync = function runAsync(_ref5, onEnd) { + var _this3 = this; - var toParts = (to && to.split('/')) || []; - var fromParts = (from && from.split('/')) || []; + var delay = _ref5.delay, + props = _objectWithoutPropertiesLoose(_ref5, ["delay"]); - var isToAbs = to && isAbsolute(to); - var isFromAbs = from && isAbsolute(from); - var mustEndAbs = isToAbs || isFromAbs; + var local = this.local; // If "to" is either a function or an array it will be processed async, therefor "to" should be empty right now + // If the view relies on certain values "from" has to be present - if (to && isAbsolute(to)) { - // to is absolute - fromParts = toParts; - } else if (toParts.length) { - // to is relative, drop the filename - fromParts.pop(); - fromParts = fromParts.concat(toParts); - } + var queue = Promise.resolve(undefined); - if (!fromParts.length) return '/'; + if (is.arr(props.to)) { + var _loop = function _loop(i) { + var index = i; - var hasTrailingSlash; - if (fromParts.length) { - var last = fromParts[fromParts.length - 1]; - hasTrailingSlash = last === '.' || last === '..' || last === ''; - } else { - hasTrailingSlash = false; - } + var fresh = _extends({}, props, interpolateTo(props.to[index])); - var up = 0; - for (var i = fromParts.length; i >= 0; i--) { - var part = fromParts[i]; + if (is.arr(fresh.config)) fresh.config = fresh.config[index]; + queue = queue.then(function () { + //this.stop() + if (local === _this3.guid) return new Promise(function (r) { + return _this3.diff(fresh).start(r); + }); + }); + }; - if (part === '.') { - spliceOne(fromParts, i); - } else if (part === '..') { - spliceOne(fromParts, i); - up++; - } else if (up) { - spliceOne(fromParts, i); - up--; - } - } + for (var i = 0; i < props.to.length; i++) { + _loop(i); + } + } else if (is.fun(props.to)) { + var index = 0; + var last; + queue = queue.then(function () { + return props.to( // next(props) + function (p) { + var fresh = _extends({}, props, interpolateTo(p)); - if (!mustEndAbs) for (; up--; up) fromParts.unshift('..'); + if (is.arr(fresh.config)) fresh.config = fresh.config[index]; + index++; //this.stop() - if ( - mustEndAbs && - fromParts[0] !== '' && - (!fromParts[0] || !isAbsolute(fromParts[0])) - ) - fromParts.unshift(''); + if (local === _this3.guid) return last = new Promise(function (r) { + return _this3.diff(fresh).start(r); + }); + return; + }, // cancel() + function (finished) { + if (finished === void 0) { + finished = true; + } - var result = fromParts.join('/'); + return _this3.stop(finished); + }).then(function () { + return last; + }); + }); + } - if (hasTrailingSlash && result.substr(-1) !== '/') result += '/'; + queue.then(onEnd); + }; - return result; -} + _proto.diff = function diff(props) { + var _this4 = this; -/* harmony default export */ var resolve_pathname = (resolvePathname); + this.props = _extends({}, this.props, props); + var _this$props = this.props, + _this$props$from = _this$props.from, + from = _this$props$from === void 0 ? {} : _this$props$from, + _this$props$to = _this$props.to, + to = _this$props$to === void 0 ? {} : _this$props$to, + _this$props$config = _this$props.config, + config = _this$props$config === void 0 ? {} : _this$props$config, + reverse = _this$props.reverse, + attach = _this$props.attach, + reset = _this$props.reset, + immediate = _this$props.immediate; // Reverse values when requested -// CONCATENATED MODULE: ./node_modules/value-equal/esm/value-equal.js -function value_equal_valueOf(obj) { - return obj.valueOf ? obj.valueOf() : Object.prototype.valueOf.call(obj); -} + if (reverse) { + var _ref6 = [to, from]; + from = _ref6[0]; + to = _ref6[1]; + } // This will collect all props that were ever set, reset merged props when necessary -function valueEqual(a, b) { - // Test for strict equality first. - if (a === b) return true; - // Otherwise, if either of them == null they are not equal. - if (a == null || b == null) return false; + this.merged = _extends({}, from, this.merged, to); + this.hasChanged = false; // Attachment handling, trailed springs can "attach" themselves to a previous spring - if (Array.isArray(a)) { - return ( - Array.isArray(b) && - a.length === b.length && - a.every(function(item, index) { - return valueEqual(item, b[index]); - }) - ); - } + var target = attach && attach(this); // Reduces input { name: value } pairs into animated values - if (typeof a === 'object' || typeof b === 'object') { - var aValue = value_equal_valueOf(a); - var bValue = value_equal_valueOf(b); + this.animations = Object.entries(this.merged).reduce(function (acc, _ref7) { + var name = _ref7[0], + value = _ref7[1]; + // Issue cached entries, except on reset + var entry = acc[name] || {}; // Figure out what the value is supposed to be - if (aValue !== a || bValue !== b) return valueEqual(aValue, bValue); + var isNumber = is.num(value); + var isString = is.str(value) && !value.startsWith('#') && !/\d/.test(value) && !colorNames[value]; + var isArray = is.arr(value); + var isInterpolation = !isNumber && !isArray && !isString; + var fromValue = !is.und(from[name]) ? from[name] : value; + var toValue = isNumber || isArray ? value : isString ? value : 1; + var toConfig = callProp(config, name); + if (target) toValue = target.animations[name].parent; + var parent = entry.parent, + interpolation$$1 = entry.interpolation, + toValues = toArray(target ? toValue.getPayload() : toValue), + animatedValues; + var newValue = value; + if (isInterpolation) newValue = interpolation({ + range: [0, 1], + output: [value, value] + })(1); + var currentValue = interpolation$$1 && interpolation$$1.getValue(); // Change detection flags - return Object.keys(Object.assign({}, a, b)).every(function(key) { - return valueEqual(a[key], b[key]); - }); - } + var isFirst = is.und(parent); + var isActive = !isFirst && entry.animatedValues.some(function (v) { + return !v.done; + }); + var currentValueDiffersFromGoal = !is.equ(newValue, currentValue); + var hasNewGoal = !is.equ(newValue, entry.previous); + var hasNewConfig = !is.equ(toConfig, entry.config); // Change animation props when props indicate a new goal (new value differs from previous one) + // and current values differ from it. Config changes trigger a new update as well (though probably shouldn't?) - return false; -} + if (reset || hasNewGoal && currentValueDiffersFromGoal || hasNewConfig) { + var _extends2; -/* harmony default export */ var value_equal = (valueEqual); + // Convert regular values into animated values, ALWAYS re-use if possible + if (isNumber || isString) parent = interpolation$$1 = entry.parent || new AnimatedValue(fromValue);else if (isArray) parent = interpolation$$1 = entry.parent || new AnimatedValueArray(fromValue);else if (isInterpolation) { + var prev = entry.interpolation && entry.interpolation.calc(entry.parent.value); + prev = prev !== void 0 && !reset ? prev : fromValue; -// EXTERNAL MODULE: ./node_modules/tiny-invariant/dist/tiny-invariant.esm.js -var tiny_invariant_esm = __webpack_require__(92); + if (entry.parent) { + parent = entry.parent; + parent.setValue(0, false); + } else parent = new AnimatedValue(0); -// CONCATENATED MODULE: ./node_modules/history/esm/history.js + var range = { + output: [prev, value] + }; + if (entry.interpolation) { + interpolation$$1 = entry.interpolation; + entry.interpolation.updateConfig(range); + } else interpolation$$1 = parent.interpolate(range); + } + toValues = toArray(target ? toValue.getPayload() : toValue); + animatedValues = toArray(parent.getPayload()); + if (reset && !isInterpolation) parent.setValue(fromValue, false); + _this4.hasChanged = true; // Reset animated values + animatedValues.forEach(function (value) { + value.startPosition = value.value; + value.lastPosition = value.value; + value.lastVelocity = isActive ? value.lastVelocity : undefined; + value.lastTime = isActive ? value.lastTime : undefined; + value.startTime = now(); + value.done = false; + value.animatedStyles.clear(); + }); // Set immediate values + if (callProp(immediate, name)) { + parent.setValue(isInterpolation ? toValue : value, false); + } + return _extends({}, acc, (_extends2 = {}, _extends2[name] = _extends({}, entry, { + name: name, + parent: parent, + interpolation: interpolation$$1, + animatedValues: animatedValues, + toValues: toValues, + previous: newValue, + config: toConfig, + fromValues: toArray(parent.getValue()), + immediate: callProp(immediate, name), + initialVelocity: withDefault(toConfig.velocity, 0), + clamp: withDefault(toConfig.clamp, false), + precision: withDefault(toConfig.precision, 0.01), + tension: withDefault(toConfig.tension, 170), + friction: withDefault(toConfig.friction, 26), + mass: withDefault(toConfig.mass, 1), + duration: toConfig.duration, + easing: withDefault(toConfig.easing, function (t) { + return t; + }), + decay: toConfig.decay + }), _extends2)); + } else { + if (!currentValueDiffersFromGoal) { + var _extends3; + // So ... the current target value (newValue) appears to be different from the previous value, + // which normally constitutes an update, but the actual value (currentValue) matches the target! + // In order to resolve this without causing an animation update we silently flag the animation as done, + // which it technically is. Interpolations also needs a config update with their target set to 1. + if (isInterpolation) { + parent.setValue(1, false); + interpolation$$1.updateConfig({ + output: [newValue, newValue] + }); + } -function addLeadingSlash(path) { - return path.charAt(0) === '/' ? path : '/' + path; -} -function stripLeadingSlash(path) { - return path.charAt(0) === '/' ? path.substr(1) : path; -} -function hasBasename(path, prefix) { - return path.toLowerCase().indexOf(prefix.toLowerCase()) === 0 && '/?#'.indexOf(path.charAt(prefix.length)) !== -1; -} -function stripBasename(path, prefix) { - return hasBasename(path, prefix) ? path.substr(prefix.length) : path; -} -function stripTrailingSlash(path) { - return path.charAt(path.length - 1) === '/' ? path.slice(0, -1) : path; -} -function parsePath(path) { - var pathname = path || '/'; - var search = ''; - var hash = ''; - var hashIndex = pathname.indexOf('#'); + parent.done = true; + _this4.hasChanged = true; + return _extends({}, acc, (_extends3 = {}, _extends3[name] = _extends({}, acc[name], { + previous: newValue + }), _extends3)); + } - if (hashIndex !== -1) { - hash = pathname.substr(hashIndex); - pathname = pathname.substr(0, hashIndex); - } + return acc; + } + }, this.animations); - var searchIndex = pathname.indexOf('?'); + if (this.hasChanged) { + // Make animations available to frameloop + this.configs = Object.values(this.animations); + this.values = {}; + this.interpolations = {}; - if (searchIndex !== -1) { - search = pathname.substr(searchIndex); - pathname = pathname.substr(0, searchIndex); - } + for (var key in this.animations) { + this.interpolations[key] = this.animations[key].interpolation; + this.values[key] = this.animations[key].interpolation.getValue(); + } + } - return { - pathname: pathname, - search: search === '?' ? '' : search, - hash: hash === '#' ? '' : hash + return this; }; -} -function createPath(location) { - var pathname = location.pathname, - search = location.search, - hash = location.hash; - var path = pathname || '/'; - if (search && search !== '?') path += search.charAt(0) === '?' ? search : "?" + search; - if (hash && hash !== '#') path += hash.charAt(0) === '#' ? hash : "#" + hash; - return path; -} - -function createLocation(path, state, key, currentLocation) { - var location; - - if (typeof path === 'string') { - // Two-arg form: push(path, state) - location = parsePath(path); - location.state = state; - } else { - // One-arg form: push(location) - location = Object(esm_extends["a" /* default */])({}, path); - if (location.pathname === undefined) location.pathname = ''; - - if (location.search) { - if (location.search.charAt(0) !== '?') location.search = '?' + location.search; - } else { - location.search = ''; - } - if (location.hash) { - if (location.hash.charAt(0) !== '#') location.hash = '#' + location.hash; - } else { - location.hash = ''; - } + _proto.destroy = function destroy() { + this.stop(); + this.props = {}; + this.merged = {}; + this.animations = {}; + this.interpolations = {}; + this.values = {}; + this.configs = []; + this.local = 0; + }; - if (state !== undefined && location.state === undefined) location.state = state; - } + return Controller; +}(); - try { - location.pathname = decodeURI(location.pathname); - } catch (e) { - if (e instanceof URIError) { - throw new URIError('Pathname "' + location.pathname + '" could not be decoded. ' + 'This is likely caused by an invalid percent-encoding.'); - } else { - throw e; - } - } +/** API + * const props = useSprings(number, [{ ... }, { ... }, ...]) + * const [props, set] = useSprings(number, (i, controller) => ({ ... })) + */ - if (key) location.key = key; +var useSprings = function useSprings(length, props) { + var mounted = React.useRef(false); + var ctrl = React.useRef(); + var isFn = is.fun(props); // The controller maintains the animation values, starts and stops animations - if (currentLocation) { - // Resolve incomplete/relative pathname relative to current location. - if (!location.pathname) { - location.pathname = currentLocation.pathname; - } else if (location.pathname.charAt(0) !== '/') { - location.pathname = resolve_pathname(location.pathname, currentLocation.pathname); - } - } else { - // When there is no prior location and pathname is empty, set it to / - if (!location.pathname) { - location.pathname = '/'; + var _useMemo = React.useMemo(function () { + // Remove old controllers + if (ctrl.current) { + ctrl.current.map(function (c) { + return c.destroy(); + }); + ctrl.current = undefined; } - } - return location; -} -function locationsAreEqual(a, b) { - return a.pathname === b.pathname && a.search === b.search && a.hash === b.hash && a.key === b.key && value_equal(a.state, b.state); -} - -function createTransitionManager() { - var prompt = null; + var ref; + return [new Array(length).fill().map(function (_, i) { + var ctrl = new Controller(); + var newProps = isFn ? callProp(props, i, ctrl) : props[i]; + if (i === 0) ref = newProps.ref; + ctrl.update(newProps); + if (!ref) ctrl.start(); + return ctrl; + }), ref]; + }, [length]), + controllers = _useMemo[0], + ref = _useMemo[1]; - function setPrompt(nextPrompt) { - false ? undefined : void 0; - prompt = nextPrompt; - return function () { - if (prompt === nextPrompt) prompt = null; - }; - } + ctrl.current = controllers; // The hooks reference api gets defined here ... - function confirmTransitionTo(location, action, getUserConfirmation, callback) { - // TODO: If another transition starts while we're still confirming - // the previous one, we may end up in a weird state. Figure out the - // best way to handle this. - if (prompt != null) { - var result = typeof prompt === 'function' ? prompt(location, action) : prompt; + var api = React.useImperativeHandle(ref, function () { + return { + start: function start() { + return Promise.all(ctrl.current.map(function (c) { + return new Promise(function (r) { + return c.start(r); + }); + })); + }, + stop: function stop(finished) { + return ctrl.current.forEach(function (c) { + return c.stop(finished); + }); + }, - if (typeof result === 'string') { - if (typeof getUserConfirmation === 'function') { - getUserConfirmation(result, callback); - } else { - false ? undefined : void 0; - callback(true); - } - } else { - // Return false from a transition hook to cancel the transition. - callback(result !== false); + get controllers() { + return ctrl.current; } - } else { - callback(true); - } - } - var listeners = []; + }; + }); // This function updates the controllers - function appendListener(fn) { - var isActive = true; + var updateCtrl = React.useMemo(function () { + return function (updateProps) { + return ctrl.current.map(function (c, i) { + c.update(isFn ? callProp(updateProps, i, c) : updateProps[i]); + if (!ref) c.start(); + }); + }; + }, [length]); // Update controller if props aren't functional - function listener() { - if (isActive) fn.apply(void 0, arguments); - } + React.useEffect(function () { + if (mounted.current) { + if (!isFn) updateCtrl(props); + } else if (!ref) ctrl.current.forEach(function (c) { + return c.start(); + }); + }); // Update mounted flag and destroy controller on unmount - listeners.push(listener); - return function () { - isActive = false; - listeners = listeners.filter(function (item) { - return item !== listener; + React.useEffect(function () { + return mounted.current = true, function () { + return ctrl.current.forEach(function (c) { + return c.destroy(); }); }; - } - - function notifyListeners() { - for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } + }, []); // Return animated props, or, anim-props + the update-setter above - listeners.forEach(function (listener) { - return listener.apply(void 0, args); + var propValues = ctrl.current.map(function (c) { + return c.getValues(); + }); + return isFn ? [propValues, updateCtrl, function (finished) { + return ctrl.current.forEach(function (c) { + return c.pause(finished); }); - } - - return { - setPrompt: setPrompt, - confirmTransitionTo: confirmTransitionTo, - appendListener: appendListener, - notifyListeners: notifyListeners - }; -} + }] : propValues; +}; -var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement); -function getConfirmation(message, callback) { - callback(window.confirm(message)); // eslint-disable-line no-alert -} -/** - * Returns true if the HTML5 history API is supported. Taken from Modernizr. - * - * https://github.com/Modernizr/Modernizr/blob/master/LICENSE - * https://github.com/Modernizr/Modernizr/blob/master/feature-detects/history.js - * changed to avoid false negatives for Windows Phones: https://github.com/reactjs/react-router/issues/586 +/** API + * const props = useSpring({ ... }) + * const [props, set] = useSpring(() => ({ ... })) */ -function supportsHistory() { - var ua = window.navigator.userAgent; - if ((ua.indexOf('Android 2.') !== -1 || ua.indexOf('Android 4.0') !== -1) && ua.indexOf('Mobile Safari') !== -1 && ua.indexOf('Chrome') === -1 && ua.indexOf('Windows Phone') === -1) return false; - return window.history && 'pushState' in window.history; -} -/** - * Returns true if browser fires popstate on hash change. - * IE10 and IE11 do not. - */ +var useSpring = function useSpring(props) { + var isFn = is.fun(props); -function supportsPopStateOnHashChange() { - return window.navigator.userAgent.indexOf('Trident') === -1; -} -/** - * Returns false if using go(n) with hash history causes a full page reload. - */ + var _useSprings = useSprings(1, isFn ? props : [props]), + result = _useSprings[0], + set = _useSprings[1], + pause = _useSprings[2]; -function supportsGoWithoutReloadUsingHash() { - return window.navigator.userAgent.indexOf('Firefox') === -1; -} -/** - * Returns true if a given popstate event is an extraneous WebKit event. - * Accounts for the fact that Chrome on iOS fires real popstate events - * containing undefined state when pressing the back button. - */ - -function isExtraneousPopstateEvent(event) { - return event.state === undefined && navigator.userAgent.indexOf('CriOS') === -1; -} - -var PopStateEvent = 'popstate'; -var HashChangeEvent = 'hashchange'; + return isFn ? [result[0], set, pause] : result; +}; -function getHistoryState() { - try { - return window.history.state || {}; - } catch (e) { - // IE 11 sometimes throws when accessing window.history.state - // See https://github.com/ReactTraining/history/pull/289 - return {}; - } -} -/** - * Creates a history object that uses the HTML5 history API including - * pushState, replaceState, and the popstate event. +/** API + * const trails = useTrail(number, { ... }) + * const [trails, set] = useTrail(number, () => ({ ... })) */ +var useTrail = function useTrail(length, props) { + var mounted = React.useRef(false); + var isFn = is.fun(props); + var updateProps = callProp(props); + var instances = React.useRef(); -function createBrowserHistory(props) { - if (props === void 0) { - props = {}; - } + var _useSprings = useSprings(length, function (i, ctrl) { + if (i === 0) instances.current = []; + instances.current.push(ctrl); + return _extends({}, updateProps, { + config: callProp(updateProps.config, i), + attach: i > 0 && function () { + return instances.current[i - 1]; + } + }); + }), + result = _useSprings[0], + set = _useSprings[1], + pause = _useSprings[2]; // Set up function to update controller - !canUseDOM ? false ? undefined : Object(tiny_invariant_esm["a" /* default */])(false) : void 0; - var globalHistory = window.history; - var canUseHistory = supportsHistory(); - var needsHashChangeListener = !supportsPopStateOnHashChange(); - var _props = props, - _props$forceRefresh = _props.forceRefresh, - forceRefresh = _props$forceRefresh === void 0 ? false : _props$forceRefresh, - _props$getUserConfirm = _props.getUserConfirmation, - getUserConfirmation = _props$getUserConfirm === void 0 ? getConfirmation : _props$getUserConfirm, - _props$keyLength = _props.keyLength, - keyLength = _props$keyLength === void 0 ? 6 : _props$keyLength; - var basename = props.basename ? stripTrailingSlash(addLeadingSlash(props.basename)) : ''; - function getDOMLocation(historyState) { - var _ref = historyState || {}, - key = _ref.key, - state = _ref.state; + var updateCtrl = React.useMemo(function () { + return function (props) { + return set(function (i, ctrl) { + var last = props.reverse ? i === 0 : length - 1 === i; + var attachIdx = props.reverse ? i + 1 : i - 1; + var attachController = instances.current[attachIdx]; + return _extends({}, props, { + config: callProp(props.config || updateProps.config, i), + attach: attachController && function () { + return attachController; + } + }); + }); + }; + }, [length, updateProps.reverse]); // Update controller if props aren't functional - var _window$location = window.location, - pathname = _window$location.pathname, - search = _window$location.search, - hash = _window$location.hash; - var path = pathname + search + hash; - false ? undefined : void 0; - if (basename) path = stripBasename(path, basename); - return createLocation(path, state, key); - } + React.useEffect(function () { + return void (mounted.current && !isFn && updateCtrl(props)); + }); // Update mounted flag and destroy controller on unmount - function createKey() { - return Math.random().toString(36).substr(2, keyLength); - } + React.useEffect(function () { + return void (mounted.current = true); + }, []); + return isFn ? [result, updateCtrl, pause] : result; +}; - var transitionManager = createTransitionManager(); +/** API + * const transitions = useTransition(items, itemKeys, { ... }) + * const [transitions, update] = useTransition(items, itemKeys, () => ({ ... })) + */ - function setState(nextState) { - Object(esm_extends["a" /* default */])(history, nextState); +var guid = 0; +var ENTER = 'enter'; +var LEAVE = 'leave'; +var UPDATE = 'update'; - history.length = globalHistory.length; - transitionManager.notifyListeners(history.location, history.action); - } +var mapKeys = function mapKeys(items, keys) { + return (typeof keys === 'function' ? items.map(keys) : toArray(keys)).map(String); +}; - function handlePopState(event) { - // Ignore extraneous popstate events in WebKit. - if (isExtraneousPopstateEvent(event)) return; - handlePop(getDOMLocation(event.state)); - } +var get = function get(props) { + var items = props.items, + _props$keys = props.keys, + keys = _props$keys === void 0 ? function (item) { + return item; + } : _props$keys, + rest = _objectWithoutPropertiesLoose(props, ["items", "keys"]); - function handleHashChange() { - handlePop(getDOMLocation(getHistoryState())); - } + items = toArray(items !== void 0 ? items : null); + return _extends({ + items: items, + keys: mapKeys(items, keys) + }, rest); +}; - var forceNextPop = false; +function useTransition(input, keyTransform, config) { + var props = _extends({ + items: input, + keys: keyTransform || function (i) { + return i; + } + }, config); - function handlePop(location) { - if (forceNextPop) { - forceNextPop = false; - setState(); - } else { - var action = 'POP'; - transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) { - if (ok) { - setState({ - action: action, - location: location + var _get = get(props), + _get$lazy = _get.lazy, + lazy = _get$lazy === void 0 ? false : _get$lazy, + _get$unique = _get.unique, + _get$reset = _get.reset, + reset = _get$reset === void 0 ? false : _get$reset, + enter = _get.enter, + leave = _get.leave, + update = _get.update, + onDestroyed = _get.onDestroyed, + keys = _get.keys, + items = _get.items, + onFrame = _get.onFrame, + _onRest = _get.onRest, + onStart = _get.onStart, + ref = _get.ref, + extra = _objectWithoutPropertiesLoose(_get, ["lazy", "unique", "reset", "enter", "leave", "update", "onDestroyed", "keys", "items", "onFrame", "onRest", "onStart", "ref"]); + + var forceUpdate = useForceUpdate(); + var mounted = React.useRef(false); + var state = React.useRef({ + mounted: false, + first: true, + deleted: [], + current: {}, + transitions: [], + prevProps: {}, + paused: !!props.ref, + instances: !mounted.current && new Map(), + forceUpdate: forceUpdate + }); + React.useImperativeHandle(props.ref, function () { + return { + start: function start() { + return Promise.all(Array.from(state.current.instances).map(function (_ref) { + var c = _ref[1]; + return new Promise(function (r) { + return c.start(r); }); - } else { - revertPop(location); - } - }); - } - } + })); + }, + stop: function stop(finished) { + return Array.from(state.current.instances).forEach(function (_ref2) { + var c = _ref2[1]; + return c.stop(finished); + }); + }, - function revertPop(fromLocation) { - var toLocation = history.location; // TODO: We could probably make this more reliable by - // keeping a list of keys we've seen in sessionStorage. - // Instead, we just default to 0 for keys we don't know. + get controllers() { + return Array.from(state.current.instances).map(function (_ref3) { + var c = _ref3[1]; + return c; + }); + } - var toIndex = allKeys.indexOf(toLocation.key); - if (toIndex === -1) toIndex = 0; - var fromIndex = allKeys.indexOf(fromLocation.key); - if (fromIndex === -1) fromIndex = 0; - var delta = toIndex - fromIndex; + }; + }); // Update state - if (delta) { - forceNextPop = true; - go(delta); - } - } + state.current = diffItems(state.current, props); - var initialLocation = getDOMLocation(getHistoryState()); - var allKeys = [initialLocation.key]; // Public interface + if (state.current.changed) { + // Update state + state.current.transitions.forEach(function (transition) { + var slot = transition.slot, + from = transition.from, + to = transition.to, + config = transition.config, + trail = transition.trail, + key = transition.key, + item = transition.item; + if (!state.current.instances.has(key)) state.current.instances.set(key, new Controller()); // update the map object - function createHref(location) { - return basename + createPath(location); - } + var ctrl = state.current.instances.get(key); - function push(path, state) { - false ? undefined : void 0; - var action = 'PUSH'; - var location = createLocation(path, state, createKey(), history.location); - transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) { - if (!ok) return; - var href = createHref(location); - var key = location.key, - state = location.state; - - if (canUseHistory) { - globalHistory.pushState({ - key: key, - state: state - }, null, href); + var newProps = _extends({}, extra, { + to: to, + from: from, + config: config, + ref: ref, + onRest: function onRest(values) { + if (state.current.mounted) { + if (transition.destroyed) { + // If no ref is given delete destroyed items immediately + if (!ref && !lazy) cleanUp(state, key); + if (onDestroyed) onDestroyed(item); + } // A transition comes to rest once all its springs conclude - if (forceRefresh) { - window.location.href = href; - } else { - var prevIndex = allKeys.indexOf(history.location.key); - var nextKeys = allKeys.slice(0, prevIndex + 1); - nextKeys.push(location.key); - allKeys = nextKeys; - setState({ - action: action, - location: location - }); - } - } else { - false ? undefined : void 0; - window.location.href = href; - } - }); - } - function replace(path, state) { - false ? undefined : void 0; - var action = 'REPLACE'; - var location = createLocation(path, state, createKey(), history.location); - transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) { - if (!ok) return; - var href = createHref(location); - var key = location.key, - state = location.state; + var curInstances = Array.from(state.current.instances); + var active = curInstances.some(function (_ref4) { + var c = _ref4[1]; + return !c.idle; + }); + if (!active && (ref || lazy) && state.current.deleted.length > 0) cleanUp(state); + if (_onRest) _onRest(item, slot, values); + } + }, + onStart: onStart && function () { + return onStart(item, slot); + }, + onFrame: onFrame && function (values) { + return onFrame(item, slot, values); + }, + delay: trail, + reset: reset && slot === ENTER // Update controller - if (canUseHistory) { - globalHistory.replaceState({ - key: key, - state: state - }, null, href); + }); - if (forceRefresh) { - window.location.replace(href); - } else { - var prevIndex = allKeys.indexOf(history.location.key); - if (prevIndex !== -1) allKeys[prevIndex] = location.key; - setState({ - action: action, - location: location - }); - } - } else { - false ? undefined : void 0; - window.location.replace(href); - } + ctrl.update(newProps); + if (!state.current.paused) ctrl.start(); }); } - function go(n) { - globalHistory.go(n); - } - - function goBack() { - go(-1); - } - - function goForward() { - go(1); - } - - var listenerCount = 0; + React.useEffect(function () { + state.current.mounted = mounted.current = true; + return function () { + state.current.mounted = mounted.current = false; + Array.from(state.current.instances).map(function (_ref5) { + var c = _ref5[1]; + return c.destroy(); + }); + state.current.instances.clear(); + }; + }, []); + return state.current.transitions.map(function (_ref6) { + var item = _ref6.item, + slot = _ref6.slot, + key = _ref6.key; + return { + item: item, + key: key, + state: slot, + props: state.current.instances.get(key).getValues() + }; + }); +} - function checkDOMListeners(delta) { - listenerCount += delta; +function cleanUp(state, filterKey) { + var deleted = state.current.deleted; - if (listenerCount === 1 && delta === 1) { - window.addEventListener(PopStateEvent, handlePopState); - if (needsHashChangeListener) window.addEventListener(HashChangeEvent, handleHashChange); - } else if (listenerCount === 0) { - window.removeEventListener(PopStateEvent, handlePopState); - if (needsHashChangeListener) window.removeEventListener(HashChangeEvent, handleHashChange); + var _loop = function _loop() { + if (_isArray) { + if (_i >= _iterator.length) return "break"; + _ref8 = _iterator[_i++]; + } else { + _i = _iterator.next(); + if (_i.done) return "break"; + _ref8 = _i.value; } - } - - var isBlocked = false; - function block(prompt) { - if (prompt === void 0) { - prompt = false; - } + var _ref7 = _ref8; + var key = _ref7.key; - var unblock = transitionManager.setPrompt(prompt); + var filter = function filter(t) { + return t.key !== key; + }; - if (!isBlocked) { - checkDOMListeners(1); - isBlocked = true; + if (is.und(filterKey) || filterKey === key) { + state.current.instances.delete(key); + state.current.transitions = state.current.transitions.filter(filter); + state.current.deleted = state.current.deleted.filter(filter); } + }; - return function () { - if (isBlocked) { - isBlocked = false; - checkDOMListeners(-1); - } + for (var _iterator = deleted, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { + var _ref8; - return unblock(); - }; - } + var _ret = _loop(); - function listen(listener) { - var unlisten = transitionManager.appendListener(listener); - checkDOMListeners(1); - return function () { - checkDOMListeners(-1); - unlisten(); - }; + if (_ret === "break") break; } - var history = { - length: globalHistory.length, - action: 'POP', - location: initialLocation, - createHref: createHref, - push: push, - replace: replace, - go: go, - goBack: goBack, - goForward: goForward, - block: block, - listen: listen - }; - return history; + state.current.forceUpdate(); } -var HashChangeEvent$1 = 'hashchange'; -var HashPathCoders = { - hashbang: { - encodePath: function encodePath(path) { - return path.charAt(0) === '!' ? path : '!/' + stripLeadingSlash(path); - }, - decodePath: function decodePath(path) { - return path.charAt(0) === '!' ? path.substr(1) : path; - } - }, - noslash: { - encodePath: stripLeadingSlash, - decodePath: addLeadingSlash - }, - slash: { - encodePath: addLeadingSlash, - decodePath: addLeadingSlash - } -}; +function diffItems(_ref9, props) { + var first = _ref9.first, + prevProps = _ref9.prevProps, + state = _objectWithoutPropertiesLoose(_ref9, ["first", "prevProps"]); -function stripHash(url) { - var hashIndex = url.indexOf('#'); - return hashIndex === -1 ? url : url.slice(0, hashIndex); -} + var _get2 = get(props), + items = _get2.items, + keys = _get2.keys, + initial = _get2.initial, + from = _get2.from, + enter = _get2.enter, + leave = _get2.leave, + update = _get2.update, + _get2$trail = _get2.trail, + trail = _get2$trail === void 0 ? 0 : _get2$trail, + unique = _get2.unique, + config = _get2.config, + _get2$order = _get2.order, + order = _get2$order === void 0 ? [ENTER, LEAVE, UPDATE] : _get2$order; -function getHashPath() { - // We can't use window.location.hash here because it's not - // consistent across browsers - Firefox will pre-decode it! - var href = window.location.href; - var hashIndex = href.indexOf('#'); - return hashIndex === -1 ? '' : href.substring(hashIndex + 1); -} + var _get3 = get(prevProps), + _keys = _get3.keys, + _items = _get3.items; -function pushHashPath(path) { - window.location.hash = path; -} + var current = _extends({}, state.current); -function replaceHashPath(path) { - window.location.replace(stripHash(window.location.href) + '#' + path); -} + var deleted = [].concat(state.deleted); // Compare next keys with current keys -function createHashHistory(props) { - if (props === void 0) { - props = {}; - } - - !canUseDOM ? false ? undefined : Object(tiny_invariant_esm["a" /* default */])(false) : void 0; - var globalHistory = window.history; - var canGoWithoutReload = supportsGoWithoutReloadUsingHash(); - var _props = props, - _props$getUserConfirm = _props.getUserConfirmation, - getUserConfirmation = _props$getUserConfirm === void 0 ? getConfirmation : _props$getUserConfirm, - _props$hashType = _props.hashType, - hashType = _props$hashType === void 0 ? 'slash' : _props$hashType; - var basename = props.basename ? stripTrailingSlash(addLeadingSlash(props.basename)) : ''; - var _HashPathCoders$hashT = HashPathCoders[hashType], - encodePath = _HashPathCoders$hashT.encodePath, - decodePath = _HashPathCoders$hashT.decodePath; - - function getDOMLocation() { - var path = decodePath(getHashPath()); - false ? undefined : void 0; - if (basename) path = stripBasename(path, basename); - return createLocation(path); - } - - var transitionManager = createTransitionManager(); - - function setState(nextState) { - Object(esm_extends["a" /* default */])(history, nextState); - - history.length = globalHistory.length; - transitionManager.notifyListeners(history.location, history.action); - } - - var forceNextPop = false; - var ignorePath = null; - - function locationsAreEqual$$1(a, b) { - return a.pathname === b.pathname && a.search === b.search && a.hash === b.hash; - } + var currentKeys = Object.keys(current); + var currentSet = new Set(currentKeys); + var nextSet = new Set(keys); + var added = keys.filter(function (item) { + return !currentSet.has(item); + }); + var removed = state.transitions.filter(function (item) { + return !item.destroyed && !nextSet.has(item.originalKey); + }).map(function (i) { + return i.originalKey; + }); + var updated = keys.filter(function (item) { + return currentSet.has(item); + }); + var delay = -trail; - function handleHashChange() { - var path = getHashPath(); - var encodedPath = encodePath(path); + while (order.length) { + var changeType = order.shift(); - if (path !== encodedPath) { - // Ensure we always have a properly-encoded hash. - replaceHashPath(encodedPath); - } else { - var location = getDOMLocation(); - var prevLocation = history.location; - if (!forceNextPop && locationsAreEqual$$1(prevLocation, location)) return; // A hashchange doesn't always == location change. + switch (changeType) { + case ENTER: + { + added.forEach(function (key, index) { + // In unique mode, remove fading out transitions if their key comes in again + if (unique && deleted.find(function (d) { + return d.originalKey === key; + })) deleted = deleted.filter(function (t) { + return t.originalKey !== key; + }); + var keyIndex = keys.indexOf(key); + var item = items[keyIndex]; + var slot = first && initial !== void 0 ? 'initial' : ENTER; + current[key] = { + slot: slot, + originalKey: key, + key: unique ? String(key) : guid++, + item: item, + trail: delay = delay + trail, + config: callProp(config, item, slot), + from: callProp(first ? initial !== void 0 ? initial || {} : from : from, item), + to: callProp(enter, item) + }; + }); + break; + } - if (ignorePath === createPath(location)) return; // Ignore this change; we already setState in push/replace. + case LEAVE: + { + removed.forEach(function (key) { + var keyIndex = _keys.indexOf(key); - ignorePath = null; - handlePop(location); - } - } + var item = _items[keyIndex]; + var slot = LEAVE; + deleted.unshift(_extends({}, current[key], { + slot: slot, + destroyed: true, + left: _keys[Math.max(0, keyIndex - 1)], + right: _keys[Math.min(_keys.length, keyIndex + 1)], + trail: delay = delay + trail, + config: callProp(config, item, slot), + to: callProp(leave, item) + })); + delete current[key]; + }); + break; + } - function handlePop(location) { - if (forceNextPop) { - forceNextPop = false; - setState(); - } else { - var action = 'POP'; - transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) { - if (ok) { - setState({ - action: action, - location: location + case UPDATE: + { + updated.forEach(function (key) { + var keyIndex = keys.indexOf(key); + var item = items[keyIndex]; + var slot = UPDATE; + current[key] = _extends({}, current[key], { + item: item, + slot: slot, + trail: delay = delay + trail, + config: callProp(config, item, slot), + to: callProp(update, item) + }); }); - } else { - revertPop(location); + break; } - }); } } - function revertPop(fromLocation) { - var toLocation = history.location; // TODO: We could probably make this more reliable by - // keeping a list of paths we've seen in sessionStorage. - // Instead, we just default to 0 for paths we don't know. + var out = keys.map(function (key) { + return current[key]; + }); // This tries to restore order for deleted items by finding their last known siblings + // only using the left sibling to keep order placement consistent for all deleted items - var toIndex = allPaths.lastIndexOf(createPath(toLocation)); - if (toIndex === -1) toIndex = 0; - var fromIndex = allPaths.lastIndexOf(createPath(fromLocation)); - if (fromIndex === -1) fromIndex = 0; - var delta = toIndex - fromIndex; + deleted.forEach(function (_ref10) { + var left = _ref10.left, + right = _ref10.right, + item = _objectWithoutPropertiesLoose(_ref10, ["left", "right"]); - if (delta) { - forceNextPop = true; - go(delta); - } - } // Ensure the hash is encoded properly before doing anything else. + var pos; // Was it the element on the left, if yes, move there ... + if ((pos = out.findIndex(function (t) { + return t.originalKey === left; + })) !== -1) pos += 1; // And if nothing else helps, move it to the start ¯\_(ツ)_/¯ - var path = getHashPath(); - var encodedPath = encodePath(path); - if (path !== encodedPath) replaceHashPath(encodedPath); - var initialLocation = getDOMLocation(); - var allPaths = [createPath(initialLocation)]; // Public interface + pos = Math.max(0, pos); + out = [].concat(out.slice(0, pos), [item], out.slice(pos)); + }); + return _extends({}, state, { + changed: added.length || removed.length || updated.length, + first: first && added.length === 0, + transitions: out, + current: current, + deleted: deleted, + prevProps: props + }); +} - function createHref(location) { - var baseTag = document.querySelector('base'); - var href = ''; +var AnimatedStyle = +/*#__PURE__*/ +function (_AnimatedObject) { + _inheritsLoose(AnimatedStyle, _AnimatedObject); - if (baseTag && baseTag.getAttribute('href')) { - href = stripHash(window.location.href); + function AnimatedStyle(style) { + var _this; + + if (style === void 0) { + style = {}; } - return href + '#' + encodePath(basename + createPath(location)); - } + _this = _AnimatedObject.call(this) || this; - function push(path, state) { - false ? undefined : void 0; - var action = 'PUSH'; - var location = createLocation(path, undefined, undefined, history.location); - transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) { - if (!ok) return; - var path = createPath(location); - var encodedPath = encodePath(basename + path); - var hashChanged = getHashPath() !== encodedPath; + if (style.transform && !(style.transform instanceof Animated)) { + style = applyAnimatedValues.transform(style); + } - if (hashChanged) { - // We cannot tell if a hashchange was caused by a PUSH, so we'd - // rather setState here and ignore the hashchange. The caveat here - // is that other hash histories in the page will consider it a POP. - ignorePath = path; - pushHashPath(encodedPath); - var prevIndex = allPaths.lastIndexOf(createPath(history.location)); - var nextPaths = allPaths.slice(0, prevIndex + 1); - nextPaths.push(path); - allPaths = nextPaths; - setState({ - action: action, - location: location - }); - } else { - false ? undefined : void 0; - setState(); - } - }); + _this.payload = style; + return _this; } - function replace(path, state) { - false ? undefined : void 0; - var action = 'REPLACE'; - var location = createLocation(path, undefined, undefined, history.location); - transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) { - if (!ok) return; - var path = createPath(location); - var encodedPath = encodePath(basename + path); - var hashChanged = getHashPath() !== encodedPath; - - if (hashChanged) { - // We cannot tell if a hashchange was caused by a REPLACE, so we'd - // rather setState here and ignore the hashchange. The caveat here - // is that other hash histories in the page will consider it a POP. - ignorePath = path; - replaceHashPath(encodedPath); - } + return AnimatedStyle; +}(AnimatedObject); - var prevIndex = allPaths.indexOf(createPath(history.location)); - if (prevIndex !== -1) allPaths[prevIndex] = path; - setState({ - action: action, - location: location - }); - }); - } +// http://www.w3.org/TR/css3-color/#svg-color +var colors = { + transparent: 0x00000000, + aliceblue: 0xf0f8ffff, + antiquewhite: 0xfaebd7ff, + aqua: 0x00ffffff, + aquamarine: 0x7fffd4ff, + azure: 0xf0ffffff, + beige: 0xf5f5dcff, + bisque: 0xffe4c4ff, + black: 0x000000ff, + blanchedalmond: 0xffebcdff, + blue: 0x0000ffff, + blueviolet: 0x8a2be2ff, + brown: 0xa52a2aff, + burlywood: 0xdeb887ff, + burntsienna: 0xea7e5dff, + cadetblue: 0x5f9ea0ff, + chartreuse: 0x7fff00ff, + chocolate: 0xd2691eff, + coral: 0xff7f50ff, + cornflowerblue: 0x6495edff, + cornsilk: 0xfff8dcff, + crimson: 0xdc143cff, + cyan: 0x00ffffff, + darkblue: 0x00008bff, + darkcyan: 0x008b8bff, + darkgoldenrod: 0xb8860bff, + darkgray: 0xa9a9a9ff, + darkgreen: 0x006400ff, + darkgrey: 0xa9a9a9ff, + darkkhaki: 0xbdb76bff, + darkmagenta: 0x8b008bff, + darkolivegreen: 0x556b2fff, + darkorange: 0xff8c00ff, + darkorchid: 0x9932ccff, + darkred: 0x8b0000ff, + darksalmon: 0xe9967aff, + darkseagreen: 0x8fbc8fff, + darkslateblue: 0x483d8bff, + darkslategray: 0x2f4f4fff, + darkslategrey: 0x2f4f4fff, + darkturquoise: 0x00ced1ff, + darkviolet: 0x9400d3ff, + deeppink: 0xff1493ff, + deepskyblue: 0x00bfffff, + dimgray: 0x696969ff, + dimgrey: 0x696969ff, + dodgerblue: 0x1e90ffff, + firebrick: 0xb22222ff, + floralwhite: 0xfffaf0ff, + forestgreen: 0x228b22ff, + fuchsia: 0xff00ffff, + gainsboro: 0xdcdcdcff, + ghostwhite: 0xf8f8ffff, + gold: 0xffd700ff, + goldenrod: 0xdaa520ff, + gray: 0x808080ff, + green: 0x008000ff, + greenyellow: 0xadff2fff, + grey: 0x808080ff, + honeydew: 0xf0fff0ff, + hotpink: 0xff69b4ff, + indianred: 0xcd5c5cff, + indigo: 0x4b0082ff, + ivory: 0xfffff0ff, + khaki: 0xf0e68cff, + lavender: 0xe6e6faff, + lavenderblush: 0xfff0f5ff, + lawngreen: 0x7cfc00ff, + lemonchiffon: 0xfffacdff, + lightblue: 0xadd8e6ff, + lightcoral: 0xf08080ff, + lightcyan: 0xe0ffffff, + lightgoldenrodyellow: 0xfafad2ff, + lightgray: 0xd3d3d3ff, + lightgreen: 0x90ee90ff, + lightgrey: 0xd3d3d3ff, + lightpink: 0xffb6c1ff, + lightsalmon: 0xffa07aff, + lightseagreen: 0x20b2aaff, + lightskyblue: 0x87cefaff, + lightslategray: 0x778899ff, + lightslategrey: 0x778899ff, + lightsteelblue: 0xb0c4deff, + lightyellow: 0xffffe0ff, + lime: 0x00ff00ff, + limegreen: 0x32cd32ff, + linen: 0xfaf0e6ff, + magenta: 0xff00ffff, + maroon: 0x800000ff, + mediumaquamarine: 0x66cdaaff, + mediumblue: 0x0000cdff, + mediumorchid: 0xba55d3ff, + mediumpurple: 0x9370dbff, + mediumseagreen: 0x3cb371ff, + mediumslateblue: 0x7b68eeff, + mediumspringgreen: 0x00fa9aff, + mediumturquoise: 0x48d1ccff, + mediumvioletred: 0xc71585ff, + midnightblue: 0x191970ff, + mintcream: 0xf5fffaff, + mistyrose: 0xffe4e1ff, + moccasin: 0xffe4b5ff, + navajowhite: 0xffdeadff, + navy: 0x000080ff, + oldlace: 0xfdf5e6ff, + olive: 0x808000ff, + olivedrab: 0x6b8e23ff, + orange: 0xffa500ff, + orangered: 0xff4500ff, + orchid: 0xda70d6ff, + palegoldenrod: 0xeee8aaff, + palegreen: 0x98fb98ff, + paleturquoise: 0xafeeeeff, + palevioletred: 0xdb7093ff, + papayawhip: 0xffefd5ff, + peachpuff: 0xffdab9ff, + peru: 0xcd853fff, + pink: 0xffc0cbff, + plum: 0xdda0ddff, + powderblue: 0xb0e0e6ff, + purple: 0x800080ff, + rebeccapurple: 0x663399ff, + red: 0xff0000ff, + rosybrown: 0xbc8f8fff, + royalblue: 0x4169e1ff, + saddlebrown: 0x8b4513ff, + salmon: 0xfa8072ff, + sandybrown: 0xf4a460ff, + seagreen: 0x2e8b57ff, + seashell: 0xfff5eeff, + sienna: 0xa0522dff, + silver: 0xc0c0c0ff, + skyblue: 0x87ceebff, + slateblue: 0x6a5acdff, + slategray: 0x708090ff, + slategrey: 0x708090ff, + snow: 0xfffafaff, + springgreen: 0x00ff7fff, + steelblue: 0x4682b4ff, + tan: 0xd2b48cff, + teal: 0x008080ff, + thistle: 0xd8bfd8ff, + tomato: 0xff6347ff, + turquoise: 0x40e0d0ff, + violet: 0xee82eeff, + wheat: 0xf5deb3ff, + white: 0xffffffff, + whitesmoke: 0xf5f5f5ff, + yellow: 0xffff00ff, + yellowgreen: 0x9acd32ff +}; - function go(n) { - false ? undefined : void 0; - globalHistory.go(n); - } +// const INTEGER = '[-+]?\\d+'; +var NUMBER = '[-+]?\\d*\\.?\\d+'; +var PERCENTAGE = NUMBER + '%'; - function goBack() { - go(-1); +function call() { + for (var _len = arguments.length, parts = new Array(_len), _key = 0; _key < _len; _key++) { + parts[_key] = arguments[_key]; } - function goForward() { - go(1); - } + return '\\(\\s*(' + parts.join(')\\s*,\\s*(') + ')\\s*\\)'; +} - var listenerCount = 0; +var rgb = new RegExp('rgb' + call(NUMBER, NUMBER, NUMBER)); +var rgba = new RegExp('rgba' + call(NUMBER, NUMBER, NUMBER, NUMBER)); +var hsl = new RegExp('hsl' + call(NUMBER, PERCENTAGE, PERCENTAGE)); +var hsla = new RegExp('hsla' + call(NUMBER, PERCENTAGE, PERCENTAGE, NUMBER)); +var hex3 = /^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/; +var hex4 = /^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/; +var hex6 = /^#([0-9a-fA-F]{6})$/; +var hex8 = /^#([0-9a-fA-F]{8})$/; - function checkDOMListeners(delta) { - listenerCount += delta; +/* +https://github.com/react-community/normalize-css-color - if (listenerCount === 1 && delta === 1) { - window.addEventListener(HashChangeEvent$1, handleHashChange); - } else if (listenerCount === 0) { - window.removeEventListener(HashChangeEvent$1, handleHashChange); - } - } +BSD 3-Clause License - var isBlocked = false; +Copyright (c) 2016, React Community +All rights reserved. - function block(prompt) { - if (prompt === void 0) { - prompt = false; - } +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: - var unblock = transitionManager.setPrompt(prompt); +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. - if (!isBlocked) { - checkDOMListeners(1); - isBlocked = true; - } +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. - return function () { - if (isBlocked) { - isBlocked = false; - checkDOMListeners(-1); - } +* Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. - return unblock(); - }; - } +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ +function normalizeColor(color) { + var match; - function listen(listener) { - var unlisten = transitionManager.appendListener(listener); - checkDOMListeners(1); - return function () { - checkDOMListeners(-1); - unlisten(); - }; - } + if (typeof color === 'number') { + return color >>> 0 === color && color >= 0 && color <= 0xffffffff ? color : null; + } // Ordered based on occurrences on Facebook codebase - var history = { - length: globalHistory.length, - action: 'POP', - location: initialLocation, - createHref: createHref, - push: push, - replace: replace, - go: go, - goBack: goBack, - goForward: goForward, - block: block, - listen: listen - }; - return history; -} - -function clamp(n, lowerBound, upperBound) { - return Math.min(Math.max(n, lowerBound), upperBound); -} -/** - * Creates a history object that stores locations in memory. - */ - - -function createMemoryHistory(props) { - if (props === void 0) { - props = {}; - } - - var _props = props, - getUserConfirmation = _props.getUserConfirmation, - _props$initialEntries = _props.initialEntries, - initialEntries = _props$initialEntries === void 0 ? ['/'] : _props$initialEntries, - _props$initialIndex = _props.initialIndex, - initialIndex = _props$initialIndex === void 0 ? 0 : _props$initialIndex, - _props$keyLength = _props.keyLength, - keyLength = _props$keyLength === void 0 ? 6 : _props$keyLength; - var transitionManager = createTransitionManager(); - - function setState(nextState) { - Object(esm_extends["a" /* default */])(history, nextState); - - history.length = history.entries.length; - transitionManager.notifyListeners(history.location, history.action); - } - - function createKey() { - return Math.random().toString(36).substr(2, keyLength); - } - - var index = clamp(initialIndex, 0, initialEntries.length - 1); - var entries = initialEntries.map(function (entry) { - return typeof entry === 'string' ? createLocation(entry, undefined, createKey()) : createLocation(entry, undefined, entry.key || createKey()); - }); // Public interface - - var createHref = createPath; - - function push(path, state) { - false ? undefined : void 0; - var action = 'PUSH'; - var location = createLocation(path, state, createKey(), history.location); - transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) { - if (!ok) return; - var prevIndex = history.index; - var nextIndex = prevIndex + 1; - var nextEntries = history.entries.slice(0); - if (nextEntries.length > nextIndex) { - nextEntries.splice(nextIndex, nextEntries.length - nextIndex, location); - } else { - nextEntries.push(location); - } + if (match = hex6.exec(color)) return parseInt(match[1] + 'ff', 16) >>> 0; + if (colors.hasOwnProperty(color)) return colors[color]; - setState({ - action: action, - location: location, - index: nextIndex, - entries: nextEntries - }); - }); + if (match = rgb.exec(color)) { + return (parse255(match[1]) << 24 | // r + parse255(match[2]) << 16 | // g + parse255(match[3]) << 8 | // b + 0x000000ff) >>> // a + 0; } - function replace(path, state) { - false ? undefined : void 0; - var action = 'REPLACE'; - var location = createLocation(path, state, createKey(), history.location); - transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) { - if (!ok) return; - history.entries[history.index] = location; - setState({ - action: action, - location: location - }); - }); + if (match = rgba.exec(color)) { + return (parse255(match[1]) << 24 | // r + parse255(match[2]) << 16 | // g + parse255(match[3]) << 8 | // b + parse1(match[4])) >>> // a + 0; } - function go(n) { - var nextIndex = clamp(history.index + n, 0, history.entries.length - 1); - var action = 'POP'; - var location = history.entries[nextIndex]; - transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) { - if (ok) { - setState({ - action: action, - location: location, - index: nextIndex - }); - } else { - // Mimic the behavior of DOM histories by - // causing a render after a cancelled POP. - setState(); - } - }); - } + if (match = hex3.exec(color)) { + return parseInt(match[1] + match[1] + // r + match[2] + match[2] + // g + match[3] + match[3] + // b + 'ff', // a + 16) >>> 0; + } // https://drafts.csswg.org/css-color-4/#hex-notation - function goBack() { - go(-1); - } - function goForward() { - go(1); - } + if (match = hex8.exec(color)) return parseInt(match[1], 16) >>> 0; - function canGo(n) { - var nextIndex = history.index + n; - return nextIndex >= 0 && nextIndex < history.entries.length; + if (match = hex4.exec(color)) { + return parseInt(match[1] + match[1] + // r + match[2] + match[2] + // g + match[3] + match[3] + // b + match[4] + match[4], // a + 16) >>> 0; } - function block(prompt) { - if (prompt === void 0) { - prompt = false; - } - - return transitionManager.setPrompt(prompt); + if (match = hsl.exec(color)) { + return (hslToRgb(parse360(match[1]), // h + parsePercentage(match[2]), // s + parsePercentage(match[3]) // l + ) | 0x000000ff) >>> // a + 0; } - function listen(listener) { - return transitionManager.appendListener(listener); + if (match = hsla.exec(color)) { + return (hslToRgb(parse360(match[1]), // h + parsePercentage(match[2]), // s + parsePercentage(match[3]) // l + ) | parse1(match[4])) >>> // a + 0; } - var history = { - length: entries.length, - action: 'POP', - location: entries[index], - index: index, - entries: entries, - createHref: createHref, - push: push, - replace: replace, - go: go, - goBack: goBack, - goForward: goForward, - canGo: canGo, - block: block, - listen: listen - }; - return history; + return null; } +function hue2rgb(p, q, t) { + if (t < 0) t += 1; + if (t > 1) t -= 1; + if (t < 1 / 6) return p + (q - p) * 6 * t; + if (t < 1 / 2) return q; + if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6; + return p; +} +function hslToRgb(h, s, l) { + var q = l < 0.5 ? l * (1 + s) : l + s - l * s; + var p = 2 * l - q; + var r = hue2rgb(p, q, h + 1 / 3); + var g = hue2rgb(p, q, h); + var b = hue2rgb(p, q, h - 1 / 3); + return Math.round(r * 255) << 24 | Math.round(g * 255) << 16 | Math.round(b * 255) << 8; +} +function parse255(str) { + var int = parseInt(str, 10); + if (int < 0) return 0; + if (int > 255) return 255; + return int; +} -/***/ }), -/* 109 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var _babel_runtime_helpers_esm_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(16); -/* harmony import */ var _babel_runtime_helpers_esm_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(17); -/* harmony import */ var _babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(12); -/* harmony import */ var _babel_runtime_helpers_esm_inherits__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(18); -/* harmony import */ var _babel_runtime_helpers_esm_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(21); -/* harmony import */ var _babel_runtime_helpers_esm_getPrototypeOf__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(9); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(0); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_6__); -/* harmony import */ var _wordpress_compose__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(77); -/* harmony import */ var _wordpress_keycodes__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(57); -/* harmony import */ var _wordpress_dom__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(69); - - - +function parse360(str) { + var int = parseFloat(str); + return (int % 360 + 360) % 360 / 360; +} +function parse1(str) { + var num = parseFloat(str); + if (num < 0) return 0; + if (num > 1) return 255; + return Math.round(num * 255); +} +function parsePercentage(str) { + // parseFloat conveniently ignores the final % + var int = parseFloat(str); + if (int < 0) return 0; + if (int > 100) return 1; + return int / 100; +} +function colorToRgba(input) { + var int32Color = normalizeColor(input); + if (int32Color === null) return input; + int32Color = int32Color || 0; + var r = (int32Color & 0xff000000) >>> 24; + var g = (int32Color & 0x00ff0000) >>> 16; + var b = (int32Color & 0x0000ff00) >>> 8; + var a = (int32Color & 0x000000ff) / 255; + return "rgba(" + r + ", " + g + ", " + b + ", " + a + ")"; +} // Problem: https://github.com/animatedjs/animated/pull/102 +// Solution: https://stackoverflow.com/questions/638565/parsing-scientific-notation-sensibly/658662 -function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = Object(_babel_runtime_helpers_esm_getPrototypeOf__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = Object(_babel_runtime_helpers_esm_getPrototypeOf__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return Object(_babel_runtime_helpers_esm_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"])(this, result); }; } +var stringShapeRegex = /[+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?/g; // Covers rgb, rgba, hsl, hsla +// Taken from https://gist.github.com/olmokramer/82ccce673f86db7cda5e -function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } +var colorRegex = /(#(?:[0-9a-f]{2}){2,4}|(#[0-9a-f]{3})|(rgb|hsl)a?\((-?\d+%?[,\s]+){2,3}\s*[\d\.]+%?\))/gi; // Covers color names (transparent, blue, etc.) +var colorNamesRegex = new RegExp("(" + Object.keys(colors).join('|') + ")", 'g'); /** - * WordPress dependencies + * Supports string shapes by extracting numbers so new values can be computed, + * and recombines those values into new strings of the same shape. Supports + * things like: + * + * rgba(123, 42, 99, 0.36) // colors + * -45deg // values with units + * 0 2px 2px 0px rgba(0, 0, 0, 0.12) // box shadows */ +var createStringInterpolator = function createStringInterpolator(config) { + // Replace colors with rgba + var outputRange = config.output.map(function (rangeValue) { + return rangeValue.replace(colorRegex, colorToRgba); + }).map(function (rangeValue) { + return rangeValue.replace(colorNamesRegex, colorToRgba); + }); + var outputRanges = outputRange[0].match(stringShapeRegex).map(function () { + return []; + }); + outputRange.forEach(function (value) { + value.match(stringShapeRegex).forEach(function (number, i) { + return outputRanges[i].push(+number); + }); + }); + var interpolations = outputRange[0].match(stringShapeRegex).map(function (_value, i) { + return createInterpolator(_extends({}, config, { + output: outputRanges[i] + })); + }); + return function (input) { + var i = 0; + return outputRange[0] // 'rgba(0, 100, 200, 0)' + // -> + // 'rgba(${interpolations[0](input)}, ${interpolations[1](input)}, ...' + .replace(stringShapeRegex, function () { + return interpolations[i++](input); + }) // rgba requires that the r,g,b are integers.... so we want to round them, but we *dont* want to + // round the opacity (4th column). + .replace(/rgba\(([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+)\)/gi, function (_, p1, p2, p3, p4) { + return "rgba(" + Math.round(p1) + ", " + Math.round(p2) + ", " + Math.round(p3) + ", " + p4 + ")"; + }); + }; +}; +var isUnitlessNumber = { + animationIterationCount: true, + borderImageOutset: true, + borderImageSlice: true, + borderImageWidth: true, + boxFlex: true, + boxFlexGroup: true, + boxOrdinalGroup: true, + columnCount: true, + columns: true, + flex: true, + flexGrow: true, + flexPositive: true, + flexShrink: true, + flexNegative: true, + flexOrder: true, + gridRow: true, + gridRowEnd: true, + gridRowSpan: true, + gridRowStart: true, + gridColumn: true, + gridColumnEnd: true, + gridColumnSpan: true, + gridColumnStart: true, + fontWeight: true, + lineClamp: true, + lineHeight: true, + opacity: true, + order: true, + orphans: true, + tabSize: true, + widows: true, + zIndex: true, + zoom: true, + // SVG-related properties + fillOpacity: true, + floodOpacity: true, + stopOpacity: true, + strokeDasharray: true, + strokeDashoffset: true, + strokeMiterlimit: true, + strokeOpacity: true, + strokeWidth: true +}; +var prefixKey = function prefixKey(prefix, key) { + return prefix + key.charAt(0).toUpperCase() + key.substring(1); +}; -var withConstrainedTabbing = Object(_wordpress_compose__WEBPACK_IMPORTED_MODULE_7__[/* default */ "a"])(function (WrappedComponent) { - return /*#__PURE__*/function (_Component) { - Object(_babel_runtime_helpers_esm_inherits__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"])(_class, _Component); - - var _super = _createSuper(_class); - - function _class() { - var _this; - - Object(_babel_runtime_helpers_esm_classCallCheck__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(this, _class); - - _this = _super.apply(this, arguments); - _this.focusContainRef = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_6__["createRef"])(); - _this.handleTabBehaviour = _this.handleTabBehaviour.bind(Object(_babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"])(_this)); - return _this; - } - - Object(_babel_runtime_helpers_esm_createClass__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])(_class, [{ - key: "handleTabBehaviour", - value: function handleTabBehaviour(event) { - if (event.keyCode !== _wordpress_keycodes__WEBPACK_IMPORTED_MODULE_8__[/* TAB */ "e"]) { - return; - } - - var tabbables = _wordpress_dom__WEBPACK_IMPORTED_MODULE_9__[/* focus */ "a"].tabbable.find(this.focusContainRef.current); - - if (!tabbables.length) { - return; - } +var prefixes = ['Webkit', 'Ms', 'Moz', 'O']; +isUnitlessNumber = Object.keys(isUnitlessNumber).reduce(function (acc, prop) { + prefixes.forEach(function (prefix) { + return acc[prefixKey(prefix, prop)] = acc[prop]; + }); + return acc; +}, isUnitlessNumber); - var firstTabbable = tabbables[0]; - var lastTabbable = tabbables[tabbables.length - 1]; - - if (event.shiftKey && event.target === firstTabbable) { - event.preventDefault(); - lastTabbable.focus(); - } else if (!event.shiftKey && event.target === lastTabbable) { - event.preventDefault(); - firstTabbable.focus(); - /* - * When pressing Tab and none of the tabbables has focus, the keydown - * event happens on the wrapper div: move focus on the first tabbable. - */ - } else if (!tabbables.includes(event.target)) { - event.preventDefault(); - firstTabbable.focus(); - } - } - }, { - key: "render", - value: function render() { - // Disable reason: this component is non-interactive, but must capture - // events from the wrapped component to determine when the Tab key is used. - - /* eslint-disable jsx-a11y/no-static-element-interactions */ - return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_6__["createElement"])("div", { - onKeyDown: this.handleTabBehaviour, - ref: this.focusContainRef, - tabIndex: "-1" - }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_6__["createElement"])(WrappedComponent, this.props)); - /* eslint-enable jsx-a11y/no-static-element-interactions */ - } - }]); +function dangerousStyleValue(name, value, isCustomProperty) { + if (value == null || typeof value === 'boolean' || value === '') return ''; + if (!isCustomProperty && typeof value === 'number' && value !== 0 && !(isUnitlessNumber.hasOwnProperty(name) && isUnitlessNumber[name])) return value + 'px'; // Presumes implicit 'px' suffix for unitless numbers - return _class; - }(_wordpress_element__WEBPACK_IMPORTED_MODULE_6__["Component"]); -}, 'withConstrainedTabbing'); -/* harmony default export */ __webpack_exports__["a"] = (withConstrainedTabbing); -//# sourceMappingURL=index.js.map + return ('' + value).trim(); +} -/***/ }), -/* 110 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { +var attributeCache = {}; +injectCreateAnimatedStyle(function (style) { + return new AnimatedStyle(style); +}); +injectDefaultElement('div'); +injectStringInterpolator(createStringInterpolator); +injectColorNames(colors); +injectApplyAnimatedValues(function (instance, props) { + if (instance.nodeType && instance.setAttribute !== undefined) { + var style = props.style, + children = props.children, + scrollTop = props.scrollTop, + scrollLeft = props.scrollLeft, + attributes = _objectWithoutPropertiesLoose(props, ["style", "children", "scrollTop", "scrollLeft"]); -"use strict"; -/* harmony import */ var _babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7); -/* harmony import */ var _babel_runtime_helpers_esm_classCallCheck__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(16); -/* harmony import */ var _babel_runtime_helpers_esm_createClass__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(17); -/* harmony import */ var _babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(12); -/* harmony import */ var _babel_runtime_helpers_esm_inherits__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(18); -/* harmony import */ var _babel_runtime_helpers_esm_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(21); -/* harmony import */ var _babel_runtime_helpers_esm_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(9); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(0); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_7__); -/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(2); -/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_8__); -/* harmony import */ var _wordpress_compose__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(77); + var filter = instance.nodeName === 'filter' || instance.parentNode && instance.parentNode.nodeName === 'filter'; + if (scrollTop !== void 0) instance.scrollTop = scrollTop; + if (scrollLeft !== void 0) instance.scrollLeft = scrollLeft; // Set textContent, if children is an animatable value + if (children !== void 0) instance.textContent = children; // Set styles ... + for (var styleName in style) { + if (!style.hasOwnProperty(styleName)) continue; + var isCustomProperty = styleName.indexOf('--') === 0; + var styleValue = dangerousStyleValue(styleName, style[styleName], isCustomProperty); + if (styleName === 'float') styleName = 'cssFloat'; + if (isCustomProperty) instance.style.setProperty(styleName, styleValue);else instance.style[styleName] = styleValue; + } // Set attributes ... + for (var name in attributes) { + // Attributes are written in dash case + var dashCase = filter ? name : attributeCache[name] || (attributeCache[name] = name.replace(/([A-Z])/g, function (n) { + return '-' + n.toLowerCase(); + })); + if (typeof instance.getAttribute(dashCase) !== 'undefined') instance.setAttribute(dashCase, attributes[name]); + } + return; + } else return false; +}, function (style) { + return style; +}); +var domElements = ['a', 'abbr', 'address', 'area', 'article', 'aside', 'audio', 'b', 'base', 'bdi', 'bdo', 'big', 'blockquote', 'body', 'br', 'button', 'canvas', 'caption', 'cite', 'code', 'col', 'colgroup', 'data', 'datalist', 'dd', 'del', 'details', 'dfn', 'dialog', 'div', 'dl', 'dt', 'em', 'embed', 'fieldset', 'figcaption', 'figure', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'i', 'iframe', 'img', 'input', 'ins', 'kbd', 'keygen', 'label', 'legend', 'li', 'link', 'main', 'map', 'mark', 'menu', 'menuitem', 'meta', 'meter', 'nav', 'noscript', 'object', 'ol', 'optgroup', 'option', 'output', 'p', 'param', 'picture', 'pre', 'progress', 'q', 'rp', 'rt', 'ruby', 's', 'samp', 'script', 'section', 'select', 'small', 'source', 'span', 'strong', 'style', 'sub', 'summary', 'sup', 'table', 'tbody', 'td', 'textarea', 'tfoot', 'th', 'thead', 'time', 'title', 'tr', 'track', 'u', 'ul', 'var', 'video', 'wbr', // SVG +'circle', 'clipPath', 'defs', 'ellipse', 'foreignObject', 'g', 'image', 'line', 'linearGradient', 'mask', 'path', 'pattern', 'polygon', 'polyline', 'radialGradient', 'rect', 'stop', 'svg', 'text', 'tspan']; +// Extend animated with all the available THREE elements +var apply = merge(createAnimatedComponent, false); +var extendedAnimated = apply(domElements); +exports.apply = apply; +exports.config = config; +exports.update = update; +exports.animated = extendedAnimated; +exports.a = extendedAnimated; +exports.interpolate = interpolate$1; +exports.Globals = Globals; +exports.useSpring = useSpring; +exports.useTrail = useTrail; +exports.useTransition = useTransition; +exports.useChain = useChain; +exports.useSprings = useSprings; -function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = Object(_babel_runtime_helpers_esm_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = Object(_babel_runtime_helpers_esm_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return Object(_babel_runtime_helpers_esm_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"])(this, result); }; } +/***/ }), -function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } +/***/ 183: +/***/ (function(module, __webpack_exports__, __webpack_require__) { -/** - * External dependencies - */ +"use strict"; +/* WEBPACK VAR INJECTION */(function(global) {/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(10); +/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _babel_runtime_helpers_esm_inheritsLoose__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(38); +/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(1); +/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_2__); -/** - * WordPress dependencies - */ -/** - * Input types which are classified as button types, for use in considering - * whether element is a (focus-normalized) button. - * - * @type {string[]} - */ -var INPUT_BUTTON_TYPES = ['button', 'submit']; -/** - * Returns true if the given element is a button element subject to focus - * normalization, or false otherwise. - * - * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#Clicking_and_focus - * - * @param {Element} element Element to test. - * - * @return {boolean} Whether element is a button. - */ +var MAX_SIGNED_31_BIT_INT = 1073741823; +var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : {}; -function isFocusNormalizedButton(element) { - switch (element.nodeName) { - case 'A': - case 'BUTTON': - return true; +function getUniqueId() { + var key = '__global_unique_id__'; + return commonjsGlobal[key] = (commonjsGlobal[key] || 0) + 1; +} - case 'INPUT': - return Object(lodash__WEBPACK_IMPORTED_MODULE_8__["includes"])(INPUT_BUTTON_TYPES, element.type); +function objectIs(x, y) { + if (x === y) { + return x !== 0 || 1 / x === 1 / y; + } else { + return x !== x && y !== y; } +} - return false; +function createEventEmitter(value) { + var handlers = []; + return { + on: function on(handler) { + handlers.push(handler); + }, + off: function off(handler) { + handlers = handlers.filter(function (h) { + return h !== handler; + }); + }, + get: function get() { + return value; + }, + set: function set(newValue, changedBits) { + value = newValue; + handlers.forEach(function (handler) { + return handler(value, changedBits); + }); + } + }; +} + +function onlyChild(children) { + return Array.isArray(children) ? children[0] : children; } -/* harmony default export */ __webpack_exports__["a"] = (Object(_wordpress_compose__WEBPACK_IMPORTED_MODULE_9__[/* default */ "a"])(function (WrappedComponent) { - return /*#__PURE__*/function (_Component) { - Object(_babel_runtime_helpers_esm_inherits__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"])(_class, _Component); +function createReactContext(defaultValue, calculateChangedBits) { + var _Provider$childContex, _Consumer$contextType; - var _super = _createSuper(_class); + var contextProp = '__create-react-context-' + getUniqueId() + '__'; - function _class() { - var _this; + var Provider = /*#__PURE__*/function (_Component) { + Object(_babel_runtime_helpers_esm_inheritsLoose__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])(Provider, _Component); - Object(_babel_runtime_helpers_esm_classCallCheck__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])(this, _class); + function Provider() { + var _this; - _this = _super.apply(this, arguments); - _this.bindNode = _this.bindNode.bind(Object(_babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"])(_this)); - _this.cancelBlurCheck = _this.cancelBlurCheck.bind(Object(_babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"])(_this)); - _this.queueBlurCheck = _this.queueBlurCheck.bind(Object(_babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"])(_this)); - _this.normalizeButtonFocus = _this.normalizeButtonFocus.bind(Object(_babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"])(_this)); + _this = _Component.apply(this, arguments) || this; + _this.emitter = createEventEmitter(_this.props.value); return _this; } - Object(_babel_runtime_helpers_esm_createClass__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"])(_class, [{ - key: "componentWillUnmount", - value: function componentWillUnmount() { - this.cancelBlurCheck(); - } - }, { - key: "bindNode", - value: function bindNode(node) { - if (node) { - this.node = node; - } else { - delete this.node; - this.cancelBlurCheck(); - } - } - }, { - key: "queueBlurCheck", - value: function queueBlurCheck(event) { - var _this2 = this; + var _proto = Provider.prototype; - // React does not allow using an event reference asynchronously - // due to recycling behavior, except when explicitly persisted. - event.persist(); // Skip blur check if clicking button. See `normalizeButtonFocus`. + _proto.getChildContext = function getChildContext() { + var _ref; - if (this.preventBlurCheck) { - return; - } + return _ref = {}, _ref[contextProp] = this.emitter, _ref; + }; - this.blurCheckTimeout = setTimeout(function () { - // If document is not focused then focus should remain - // inside the wrapped component and therefore we cancel - // this blur event thereby leaving focus in place. - // https://developer.mozilla.org/en-US/docs/Web/API/Document/hasFocus. - if (!document.hasFocus()) { - event.preventDefault(); - return; - } + _proto.componentWillReceiveProps = function componentWillReceiveProps(nextProps) { + if (this.props.value !== nextProps.value) { + var oldValue = this.props.value; + var newValue = nextProps.value; + var changedBits; - if ('function' === typeof _this2.node.handleFocusOutside) { - _this2.node.handleFocusOutside(event); - } - }, 0); - } - }, { - key: "cancelBlurCheck", - value: function cancelBlurCheck() { - clearTimeout(this.blurCheckTimeout); - } - /** - * Handles a mousedown or mouseup event to respectively assign and - * unassign a flag for preventing blur check on button elements. Some - * browsers, namely Firefox and Safari, do not emit a focus event on - * button elements when clicked, while others do. The logic here - * intends to normalize this as treating click on buttons as focus. - * - * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#Clicking_and_focus - * - * @param {MouseEvent} event Event for mousedown or mouseup. - */ + if (objectIs(oldValue, newValue)) { + changedBits = 0; + } else { + changedBits = typeof calculateChangedBits === 'function' ? calculateChangedBits(oldValue, newValue) : MAX_SIGNED_31_BIT_INT; - }, { - key: "normalizeButtonFocus", - value: function normalizeButtonFocus(event) { - var type = event.type, - target = event.target; - var isInteractionEnd = Object(lodash__WEBPACK_IMPORTED_MODULE_8__["includes"])(['mouseup', 'touchend'], type); - - if (isInteractionEnd) { - this.preventBlurCheck = false; - } else if (isFocusNormalizedButton(target)) { - this.preventBlurCheck = true; + if (false) {} + + changedBits |= 0; + + if (changedBits !== 0) { + this.emitter.set(nextProps.value, changedBits); + } } } - }, { - key: "render", - value: function render() { - // Disable reason: See `normalizeButtonFocus` for browser-specific - // focus event normalization. - - /* eslint-disable jsx-a11y/no-static-element-interactions */ - return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_7__["createElement"])("div", { - onFocus: this.cancelBlurCheck, - onMouseDown: this.normalizeButtonFocus, - onMouseUp: this.normalizeButtonFocus, - onTouchStart: this.normalizeButtonFocus, - onTouchEnd: this.normalizeButtonFocus, - onBlur: this.queueBlurCheck - }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_7__["createElement"])(WrappedComponent, Object(_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])({ - ref: this.bindNode - }, this.props))); - /* eslint-enable jsx-a11y/no-static-element-interactions */ - } - }]); + }; - return _class; - }(_wordpress_element__WEBPACK_IMPORTED_MODULE_7__["Component"]); -}, 'withFocusOutside')); -//# sourceMappingURL=index.js.map + _proto.render = function render() { + return this.props.children; + }; -/***/ }), -/* 111 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { + return Provider; + }(react__WEBPACK_IMPORTED_MODULE_0__["Component"]); -"use strict"; -/* harmony import */ var _babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7); -/* harmony import */ var _babel_runtime_helpers_esm_objectWithoutProperties__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(11); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(0); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_2__); + Provider.childContextTypes = (_Provider$childContex = {}, _Provider$childContex[contextProp] = prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.object.isRequired, _Provider$childContex); + var Consumer = /*#__PURE__*/function (_Component2) { + Object(_babel_runtime_helpers_esm_inheritsLoose__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])(Consumer, _Component2); + function Consumer() { + var _this2; + _this2 = _Component2.apply(this, arguments) || this; + _this2.state = { + value: _this2.getValue() + }; -/** - * WordPress dependencies - */ + _this2.onUpdate = function (newValue, changedBits) { + var observedBits = _this2.observedBits | 0; + if ((observedBits & changedBits) !== 0) { + _this2.setState({ + value: _this2.getValue() + }); + } + }; -function stopPropagation(event) { - event.stopPropagation(); -} + return _this2; + } -/* harmony default export */ __webpack_exports__["a"] = (Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_2__["forwardRef"])(function (_ref, ref) { - var children = _ref.children, - props = Object(_babel_runtime_helpers_esm_objectWithoutProperties__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])(_ref, ["children"]); + var _proto2 = Consumer.prototype; - // Disable reason: this stops certain events from propagating outside of the component. - // - onMouseDown is disabled as this can cause interactions with other DOM elements + _proto2.componentWillReceiveProps = function componentWillReceiveProps(nextProps) { + var observedBits = nextProps.observedBits; + this.observedBits = observedBits === undefined || observedBits === null ? MAX_SIGNED_31_BIT_INT : observedBits; + }; - /* eslint-disable jsx-a11y/no-static-element-interactions */ - return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_2__["createElement"])("div", Object(_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])({}, props, { - ref: ref, - onMouseDown: stopPropagation - }), children); - /* eslint-enable jsx-a11y/no-static-element-interactions */ -})); -//# sourceMappingURL=index.js.map + _proto2.componentDidMount = function componentDidMount() { + if (this.context[contextProp]) { + this.context[contextProp].on(this.onUpdate); + } -/***/ }), -/* 112 */, -/* 113 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { + var observedBits = this.props.observedBits; + this.observedBits = observedBits === undefined || observedBits === null ? MAX_SIGNED_31_BIT_INT : observedBits; + }; -"use strict"; + _proto2.componentWillUnmount = function componentWillUnmount() { + if (this.context[contextProp]) { + this.context[contextProp].off(this.onUpdate); + } + }; -// UNUSED EXPORTS: Provider + _proto2.getValue = function getValue() { + if (this.context[contextProp]) { + return this.context[contextProp].get(); + } else { + return defaultValue; + } + }; -// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js + 3 modules -var toConsumableArray = __webpack_require__(26); + _proto2.render = function render() { + return onlyChild(this.props.children)(this.state.value); + }; -// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/classCallCheck.js -var classCallCheck = __webpack_require__(16); + return Consumer; + }(react__WEBPACK_IMPORTED_MODULE_0__["Component"]); -// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/createClass.js -var createClass = __webpack_require__(17); + Consumer.contextTypes = (_Consumer$contextType = {}, _Consumer$contextType[contextProp] = prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.object, _Consumer$contextType); + return { + Provider: Provider, + Consumer: Consumer + }; +} -// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/inherits.js + 1 modules -var inherits = __webpack_require__(18); +var index = react__WEBPACK_IMPORTED_MODULE_0___default.a.createContext || createReactContext; -// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js -var possibleConstructorReturn = __webpack_require__(21); +/* harmony default export */ __webpack_exports__["a"] = (index); -// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js -var getPrototypeOf = __webpack_require__(9); +/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(84))) -// EXTERNAL MODULE: external {"this":["wp","element"]} -var external_this_wp_element_ = __webpack_require__(0); +/***/ }), -// EXTERNAL MODULE: external "lodash" -var external_lodash_ = __webpack_require__(2); +/***/ 184: +/***/ (function(module, exports, __webpack_require__) { -// EXTERNAL MODULE: ./node_modules/@wordpress/compose/build-module/utils/create-higher-order-component/index.js -var create_higher_order_component = __webpack_require__(77); +var isarray = __webpack_require__(307) -// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js -var assertThisInitialized = __webpack_require__(12); +/** + * Expose `pathToRegexp`. + */ +module.exports = pathToRegexp +module.exports.parse = parse +module.exports.compile = compile +module.exports.tokensToFunction = tokensToFunction +module.exports.tokensToRegExp = tokensToRegExp -// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/higher-order/with-focus-return/context.js +/** + * The main path matching regexp utility. + * + * @type {RegExp} + */ +var PATH_REGEXP = new RegExp([ + // Match escaped characters that would otherwise appear in future matches. + // This allows the user to escape special characters that won't transform. + '(\\\\.)', + // Match Express-style parameters and un-named parameters with a prefix + // and optional suffixes. Matches appear as: + // + // "/:test(\\d+)?" => ["/", "test", "\d+", undefined, "?", undefined] + // "/route(\\d+)" => [undefined, undefined, undefined, "\d+", undefined, undefined] + // "/*" => ["/", undefined, undefined, undefined, undefined, "*"] + '([\\/.])?(?:(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?|(\\*))' +].join('|'), 'g') +/** + * Parse a string for the raw tokens. + * + * @param {string} str + * @param {Object=} options + * @return {!Array} + */ +function parse (str, options) { + var tokens = [] + var key = 0 + var index = 0 + var path = '' + var defaultDelimiter = options && options.delimiter || '/' + var res + while ((res = PATH_REGEXP.exec(str)) != null) { + var m = res[0] + var escaped = res[1] + var offset = res.index + path += str.slice(index, offset) + index = offset + m.length + // Ignore already escaped sequences. + if (escaped) { + path += escaped[1] + continue + } + var next = str[index] + var prefix = res[2] + var name = res[3] + var capture = res[4] + var group = res[5] + var modifier = res[6] + var asterisk = res[7] + // Push the current path onto the tokens. + if (path) { + tokens.push(path) + path = '' + } + var partial = prefix != null && next != null && next !== prefix + var repeat = modifier === '+' || modifier === '*' + var optional = modifier === '?' || modifier === '*' + var delimiter = res[2] || defaultDelimiter + var pattern = capture || group + tokens.push({ + name: name || key++, + prefix: prefix || '', + delimiter: delimiter, + optional: optional, + repeat: repeat, + partial: partial, + asterisk: !!asterisk, + pattern: pattern ? escapeGroup(pattern) : (asterisk ? '.*' : '[^' + escapeString(delimiter) + ']+?') + }) + } + // Match any characters still remaining. + if (index < str.length) { + path += str.substr(index) + } -function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = Object(getPrototypeOf["a" /* default */])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = Object(getPrototypeOf["a" /* default */])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return Object(possibleConstructorReturn["a" /* default */])(this, result); }; } + // If the path exists, push it onto the end. + if (path) { + tokens.push(path) + } -function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } + return tokens +} /** - * External dependencies + * Compile a string to a template function for the path. + * + * @param {string} str + * @param {Object=} options + * @return {!function(Object=, Object=)} */ +function compile (str, options) { + return tokensToFunction(parse(str, options), options) +} /** - * WordPress dependencies + * Prettier encoding of URI path segments. + * + * @param {string} + * @return {string} */ +function encodeURIComponentPretty (str) { + return encodeURI(str).replace(/[\/?#]/g, function (c) { + return '%' + c.charCodeAt(0).toString(16).toUpperCase() + }) +} - - -var _createContext = Object(external_this_wp_element_["createContext"])({ - focusHistory: [] -}), - Provider = _createContext.Provider, - Consumer = _createContext.Consumer; - -Provider.displayName = 'FocusReturnProvider'; -Consumer.displayName = 'FocusReturnConsumer'; /** - * The maximum history length to capture for the focus stack. When exceeded, - * items should be shifted from the stack for each consecutive push. + * Encode the asterisk parameter. Similar to `pretty`, but allows slashes. * - * @type {number} + * @param {string} + * @return {string} */ +function encodeAsterisk (str) { + return encodeURI(str).replace(/[?#]/g, function (c) { + return '%' + c.charCodeAt(0).toString(16).toUpperCase() + }) +} -var MAX_STACK_LENGTH = 100; +/** + * Expose a method for transforming tokens into the path function. + */ +function tokensToFunction (tokens, options) { + // Compile all the tokens into regexps. + var matches = new Array(tokens.length) -var context_FocusReturnProvider = /*#__PURE__*/function (_Component) { - Object(inherits["a" /* default */])(FocusReturnProvider, _Component); + // Compile all the patterns before compilation. + for (var i = 0; i < tokens.length; i++) { + if (typeof tokens[i] === 'object') { + matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$', flags(options)) + } + } - var _super = _createSuper(FocusReturnProvider); + return function (obj, opts) { + var path = '' + var data = obj || {} + var options = opts || {} + var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent - function FocusReturnProvider() { - var _this; + for (var i = 0; i < tokens.length; i++) { + var token = tokens[i] - Object(classCallCheck["a" /* default */])(this, FocusReturnProvider); + if (typeof token === 'string') { + path += token - _this = _super.apply(this, arguments); - _this.onFocus = _this.onFocus.bind(Object(assertThisInitialized["a" /* default */])(_this)); - _this.state = { - focusHistory: [] - }; - return _this; - } + continue + } - Object(createClass["a" /* default */])(FocusReturnProvider, [{ - key: "onFocus", - value: function onFocus(event) { - var focusHistory = this.state.focusHistory; // Push the focused element to the history stack, keeping only unique - // members but preferring the _last_ occurrence of any duplicates. - // Lodash's `uniq` behavior favors the first occurrence, so the array - // is temporarily reversed prior to it being called upon. Uniqueness - // helps avoid situations where, such as in a constrained tabbing area, - // the user changes focus enough within a transient element that the - // stack may otherwise only consist of members pending destruction, at - // which point focus might have been lost. - - var nextFocusHistory = Object(external_lodash_["uniq"])([].concat(Object(toConsumableArray["a" /* default */])(focusHistory), [event.target]).slice(-1 * MAX_STACK_LENGTH).reverse()).reverse(); - this.setState({ - focusHistory: nextFocusHistory - }); - } - }, { - key: "render", - value: function render() { - var _this$props = this.props, - children = _this$props.children, - className = _this$props.className; - return Object(external_this_wp_element_["createElement"])(Provider, { - value: this.state - }, Object(external_this_wp_element_["createElement"])("div", { - onFocus: this.onFocus, - className: className - }, children)); - } - }]); + var value = data[token.name] + var segment - return FocusReturnProvider; -}(external_this_wp_element_["Component"]); + if (value == null) { + if (token.optional) { + // Prepend partial segment prefixes. + if (token.partial) { + path += token.prefix + } -/* harmony default export */ var with_focus_return_context = (context_FocusReturnProvider); + continue + } else { + throw new TypeError('Expected "' + token.name + '" to be defined') + } + } -//# sourceMappingURL=context.js.map -// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/higher-order/with-focus-return/index.js + if (isarray(value)) { + if (!token.repeat) { + throw new TypeError('Expected "' + token.name + '" to not repeat, but received `' + JSON.stringify(value) + '`') + } + if (value.length === 0) { + if (token.optional) { + continue + } else { + throw new TypeError('Expected "' + token.name + '" to not be empty') + } + } + for (var j = 0; j < value.length; j++) { + segment = encode(value[j]) + if (!matches[i].test(segment)) { + throw new TypeError('Expected all "' + token.name + '" to match "' + token.pattern + '", but received `' + JSON.stringify(segment) + '`') + } + path += (j === 0 ? token.prefix : token.delimiter) + segment + } + continue + } + segment = token.asterisk ? encodeAsterisk(value) : encode(value) + if (!matches[i].test(segment)) { + throw new TypeError('Expected "' + token.name + '" to match "' + token.pattern + '", but received "' + segment + '"') + } -function with_focus_return_createSuper(Derived) { var hasNativeReflectConstruct = with_focus_return_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = Object(getPrototypeOf["a" /* default */])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = Object(getPrototypeOf["a" /* default */])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return Object(possibleConstructorReturn["a" /* default */])(this, result); }; } + path += token.prefix + segment + } -function with_focus_return_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } + return path + } +} /** - * External dependencies + * Escape a regular expression string. + * + * @param {string} str + * @return {string} */ +function escapeString (str) { + return str.replace(/([.+*?=^!:${}()[\]|\/\\])/g, '\\$1') +} /** - * WordPress dependencies + * Escape the capturing group by escaping special characters and meaning. + * + * @param {string} group + * @return {string} */ +function escapeGroup (group) { + return group.replace(/([=!:$\/()])/g, '\\$1') +} +/** + * Attach the keys as a property of the regexp. + * + * @param {!RegExp} re + * @param {Array} keys + * @return {!RegExp} + */ +function attachKeys (re, keys) { + re.keys = keys + return re +} +/** + * Get the flags for a regexp from the options. + * + * @param {Object} options + * @return {string} + */ +function flags (options) { + return options && options.sensitive ? '' : 'i' +} /** - * Internal dependencies + * Pull out keys from a regexp. + * + * @param {!RegExp} path + * @param {!Array} keys + * @return {!RegExp} */ +function regexpToRegexp (path, keys) { + // Use a negative lookahead to match only capturing groups. + var groups = path.source.match(/\((?!\?)/g) + + if (groups) { + for (var i = 0; i < groups.length; i++) { + keys.push({ + name: i, + prefix: null, + delimiter: null, + optional: false, + repeat: false, + partial: false, + asterisk: false, + pattern: null + }) + } + } + return attachKeys(path, keys) +} /** - * Returns true if the given object is component-like. An object is component- - * like if it is an instance of wp.element.Component, or is a function. - * - * @param {*} object Object to test. + * Transform an array into a regexp. * - * @return {boolean} Whether object is component-like. + * @param {!Array} path + * @param {Array} keys + * @param {!Object} options + * @return {!RegExp} */ +function arrayToRegexp (path, keys, options) { + var parts = [] + + for (var i = 0; i < path.length; i++) { + parts.push(pathToRegexp(path[i], keys, options).source) + } + + var regexp = new RegExp('(?:' + parts.join('|') + ')', flags(options)) -function isComponentLike(object) { - return object instanceof external_this_wp_element_["Component"] || typeof object === 'function'; + return attachKeys(regexp, keys) } + /** - * Higher Order Component used to be used to wrap disposable elements like - * sidebars, modals, dropdowns. When mounting the wrapped component, we track a - * reference to the current active element so we know where to restore focus - * when the component is unmounted. - * - * @param {(WPComponent|Object)} options The component to be enhanced with - * focus return behavior, or an object - * describing the component and the - * focus return characteristics. + * Create a path regexp from string input. * - * @return {WPComponent} Component with the focus restauration behaviour. + * @param {string} path + * @param {!Array} keys + * @param {!Object} options + * @return {!RegExp} */ +function stringToRegexp (path, keys, options) { + return tokensToRegExp(parse(path, options), keys, options) +} - -function withFocusReturn(options) { - // Normalize as overloaded form `withFocusReturn( options )( Component )` - // or as `withFocusReturn( Component )`. - if (isComponentLike(options)) { - var WrappedComponent = options; - return withFocusReturn({})(WrappedComponent); +/** + * Expose a function for taking tokens and returning a RegExp. + * + * @param {!Array} tokens + * @param {(Array|Object)=} keys + * @param {Object=} options + * @return {!RegExp} + */ +function tokensToRegExp (tokens, keys, options) { + if (!isarray(keys)) { + options = /** @type {!Object} */ (keys || options) + keys = [] } - var _options$onFocusRetur = options.onFocusReturn, - onFocusReturn = _options$onFocusRetur === void 0 ? external_lodash_["stubTrue"] : _options$onFocusRetur; - return function (WrappedComponent) { - var FocusReturn = /*#__PURE__*/function (_Component) { - Object(inherits["a" /* default */])(FocusReturn, _Component); + options = options || {} - var _super = with_focus_return_createSuper(FocusReturn); + var strict = options.strict + var end = options.end !== false + var route = '' - function FocusReturn() { - var _this; + // Iterate over the tokens and create our regexp string. + for (var i = 0; i < tokens.length; i++) { + var token = tokens[i] - Object(classCallCheck["a" /* default */])(this, FocusReturn); + if (typeof token === 'string') { + route += escapeString(token) + } else { + var prefix = escapeString(token.prefix) + var capture = '(?:' + token.pattern + ')' - _this = _super.apply(this, arguments); - _this.ownFocusedElements = new Set(); - _this.activeElementOnMount = document.activeElement; + keys.push(token) - _this.setIsFocusedFalse = function () { - return _this.isFocused = false; - }; + if (token.repeat) { + capture += '(?:' + prefix + capture + ')*' + } - _this.setIsFocusedTrue = function (event) { - _this.ownFocusedElements.add(event.target); + if (token.optional) { + if (!token.partial) { + capture = '(?:' + prefix + '(' + capture + '))?' + } else { + capture = prefix + '(' + capture + ')?' + } + } else { + capture = prefix + '(' + capture + ')' + } - _this.isFocused = true; - }; + route += capture + } + } - return _this; - } + var delimiter = escapeString(options.delimiter || '/') + var endsWithDelimiter = route.slice(-delimiter.length) === delimiter - Object(createClass["a" /* default */])(FocusReturn, [{ - key: "componentWillUnmount", - value: function componentWillUnmount() { - var activeElementOnMount = this.activeElementOnMount, - isFocused = this.isFocused, - ownFocusedElements = this.ownFocusedElements; + // In non-strict mode we allow a slash at the end of match. If the path to + // match already ends with a slash, we remove it for consistency. The slash + // is valid at the end of a path match, not in the middle. This is important + // in non-ending mode, where "/test/" shouldn't match "/test//route". + if (!strict) { + route = (endsWithDelimiter ? route.slice(0, -delimiter.length) : route) + '(?:' + delimiter + '(?=$))?' + } - if (!isFocused) { - return; - } // Defer to the component's own explicit focus return behavior, - // if specified. The function should return `false` to prevent - // the default behavior otherwise occurring here. This allows - // for support that the `onFocusReturn` decides to allow the - // default behavior to occur under some conditions. + if (end) { + route += '$' + } else { + // In non-ending mode, we need the capturing groups to match as much as + // possible by using a positive lookahead to the end or next path segment. + route += strict && endsWithDelimiter ? '' : '(?=' + delimiter + '|$)' + } + return attachKeys(new RegExp('^' + route, flags(options)), keys) +} - if (onFocusReturn() === false) { - return; - } +/** + * Normalize the given path string, returning a regular expression. + * + * An empty array can be passed in for the keys, which will hold the + * placeholder key descriptions. For example, using `/user/:id`, `keys` will + * contain `[{ name: 'id', delimiter: '/', optional: false, repeat: false }]`. + * + * @param {(string|RegExp|Array)} path + * @param {(Array|Object)=} keys + * @param {Object=} options + * @return {!RegExp} + */ +function pathToRegexp (path, keys, options) { + if (!isarray(keys)) { + options = /** @type {!Object} */ (keys || options) + keys = [] + } - var stack = [].concat(Object(toConsumableArray["a" /* default */])(external_lodash_["without"].apply(void 0, [this.props.focus.focusHistory].concat(Object(toConsumableArray["a" /* default */])(ownFocusedElements)))), [activeElementOnMount]); - var candidate; + options = options || {} - while (candidate = stack.pop()) { - if (document.body.contains(candidate)) { - candidate.focus(); - return; - } - } - } - }, { - key: "render", - value: function render() { - return Object(external_this_wp_element_["createElement"])("div", { - onFocus: this.setIsFocusedTrue, - onBlur: this.setIsFocusedFalse - }, Object(external_this_wp_element_["createElement"])(WrappedComponent, this.props.childProps)); - } - }]); + if (path instanceof RegExp) { + return regexpToRegexp(path, /** @type {!Array} */ (keys)) + } - return FocusReturn; - }(external_this_wp_element_["Component"]); + if (isarray(path)) { + return arrayToRegexp(/** @type {!Array} */ (path), /** @type {!Array} */ (keys), options) + } - return function (props) { - return Object(external_this_wp_element_["createElement"])(Consumer, null, function (context) { - return Object(external_this_wp_element_["createElement"])(FocusReturn, { - childProps: props, - focus: context - }); - }); - }; - }; + return stringToRegexp(/** @type {string} */ (path), /** @type {!Array} */ (keys), options) } -/* harmony default export */ var with_focus_return = __webpack_exports__["a"] = (Object(create_higher_order_component["a" /* default */])(withFocusReturn, 'withFocusReturn')); - -//# sourceMappingURL=index.js.map /***/ }), -/* 114 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { -"use strict"; -/* harmony import */ var _babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6); -/* harmony import */ var _babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(7); -/* harmony import */ var _babel_runtime_helpers_esm_objectWithoutProperties__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(11); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(0); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__); -/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(78); -/* harmony import */ var _dashicon__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(107); +/***/ 19: +/***/ (function(module, exports, __webpack_require__) { +var arrayWithoutHoles = __webpack_require__(57); +var iterableToArray = __webpack_require__(58); +var unsupportedIterableToArray = __webpack_require__(40); -function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } +var nonIterableSpread = __webpack_require__(59); -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { Object(_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } +function _toConsumableArray(arr) { + return arrayWithoutHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableSpread(); +} -/** - * WordPress dependencies - */ +module.exports = _toConsumableArray; +/***/ }), -/** - * Internal dependencies - */ +/***/ 196: +/***/ (function(module, __webpack_exports__, __webpack_require__) { +"use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return getUnreadNotesCount; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return hasValidNotes; }); +/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(3); +/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_0__); +/** + * External dependencies + */ +/** + * Get the count of the unread notes from the received list. + * + * @param {Array} notes - List of notes, contains read and unread notes. + * @param {number} lastRead - The timestamp that the user read a note. + * @return {number} - Unread notes count. + */ -function Icon(_ref) { - var _ref$icon = _ref.icon, - icon = _ref$icon === void 0 ? null : _ref$icon, - size = _ref.size, - additionalProps = Object(_babel_runtime_helpers_esm_objectWithoutProperties__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"])(_ref, ["icon", "size"]); +function getUnreadNotesCount(notes, lastRead) { + var unreadNotes = Object(lodash__WEBPACK_IMPORTED_MODULE_0__["filter"])(notes, function (note) { + var isDeleted = note.is_deleted, + dateCreatedGmt = note.date_created_gmt, + status = note.status; + + if (!isDeleted) { + var unread = !lastRead || !dateCreatedGmt || new Date(dateCreatedGmt + 'Z').getTime() > lastRead; + return unread && status === 'unactioned'; + } + }); + return unreadNotes.length; +} +/** + * Verifies if there are any valid notes in the list. + * + * @param {Array} notes - List of notes, contains read and unread notes. + * @return {boolean} - Whether there are valid notes or not. + */ + +function hasValidNotes(notes) { + var validNotes = Object(lodash__WEBPACK_IMPORTED_MODULE_0__["filter"])(notes, function (note) { + var isDeleted = note.is_deleted; + return !isDeleted; + }); + return validNotes.length > 0; +} - // Dashicons should be 20x20 by default. - var dashiconSize = size || 20; +/***/ }), - if ('string' === typeof icon) { - return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])(_dashicon__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"], Object(_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])({ - icon: icon, - size: dashiconSize - }, additionalProps)); - } +/***/ 197: +/***/ (function(module, __webpack_exports__, __webpack_require__) { - if (icon && _dashicon__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"] === icon.type) { - return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["cloneElement"])(icon, _objectSpread({ - size: dashiconSize - }, additionalProps)); - } // Icons should be 24x24 by default. +"use strict"; +/* harmony import */ var _babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(36); +/* harmony import */ var _babel_runtime_helpers_esm_objectWithoutProperties__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(55); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(0); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_2__); - var iconSize = size || 24; - if ('function' === typeof icon) { - if (icon.prototype instanceof _wordpress_element__WEBPACK_IMPORTED_MODULE_3__["Component"]) { - return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])(icon, _objectSpread({ - size: iconSize - }, additionalProps)); - } +function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } - return icon(_objectSpread({ - size: iconSize - }, additionalProps)); - } +function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { Object(_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } - if (icon && (icon.type === 'svg' || icon.type === _wordpress_primitives__WEBPACK_IMPORTED_MODULE_4__[/* SVG */ "c"])) { - var appliedProps = _objectSpread(_objectSpread({ - width: iconSize, - height: iconSize - }, icon.props), additionalProps); +/** + * WordPress dependencies + */ - return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_4__[/* SVG */ "c"], appliedProps); - } +/** @typedef {{icon: JSX.Element, size?: number} & import('@wordpress/primitives').SVGProps} IconProps */ - if (Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["isValidElement"])(icon)) { - return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["cloneElement"])(icon, _objectSpread({ - size: iconSize - }, additionalProps)); - } +/** + * Return an SVG icon. + * + * @param {IconProps} props icon is the SVG component to render + * size is a number specifiying the icon size in pixels + * Other props will be passed to wrapped SVG component + * + * @return {JSX.Element} Icon component + */ + +function Icon(_ref) { + var icon = _ref.icon, + _ref$size = _ref.size, + size = _ref$size === void 0 ? 24 : _ref$size, + props = Object(_babel_runtime_helpers_esm_objectWithoutProperties__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])(_ref, ["icon", "size"]); - return icon; + return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_2__["cloneElement"])(icon, _objectSpread({ + width: size, + height: size + }, props)); } /* harmony default export */ __webpack_exports__["a"] = (Icon); //# sourceMappingURL=index.js.map /***/ }), -/* 115 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { -"use strict"; -/* harmony import */ var _babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6); -/* harmony import */ var _babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(24); -/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(4); -/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_2__); +/***/ 2: +/***/ (function(module, exports) { +(function() { module.exports = this["wp"]["i18n"]; }()); +/***/ }), -/** - * External dependencies - */ +/***/ 20: +/***/ (function(module, exports) { +(function() { module.exports = this["wp"]["compose"]; }()); -function Animate(_ref) { - var type = _ref.type, - _ref$options = _ref.options, - options = _ref$options === void 0 ? {} : _ref$options, - children = _ref.children; +/***/ }), - if (type === 'appear') { - var _classnames; +/***/ 21: +/***/ (function(module, exports) { - var _options$origin = options.origin, - origin = _options$origin === void 0 ? 'top' : _options$origin; +(function() { module.exports = this["wc"]["navigation"]; }()); - var _origin$split = origin.split(' '), - _origin$split2 = Object(_babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])(_origin$split, 2), - yAxis = _origin$split2[0], - _origin$split2$ = _origin$split2[1], - xAxis = _origin$split2$ === void 0 ? 'center' : _origin$split2$; +/***/ }), - return children({ - className: classnames__WEBPACK_IMPORTED_MODULE_2___default()('components-animate__appear', (_classnames = {}, Object(_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(_classnames, 'is-from-' + xAxis, xAxis !== 'center'), Object(_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(_classnames, 'is-from-' + yAxis, yAxis !== 'middle'), _classnames)) - }); - } +/***/ 22: +/***/ (function(module, exports) { - if (type === 'slide-in') { - var _options$origin2 = options.origin, - _origin = _options$origin2 === void 0 ? 'left' : _options$origin2; +(function() { module.exports = this["wc"]["data"]; }()); - return children({ - className: classnames__WEBPACK_IMPORTED_MODULE_2___default()('components-animate__slide-in', 'is-from-' + _origin) - }); - } +/***/ }), - if (type === 'loading') { - return children({ - className: classnames__WEBPACK_IMPORTED_MODULE_2___default()('components-animate__loading') - }); - } +/***/ 23: +/***/ (function(module, exports) { + +(function() { module.exports = this["wp"]["url"]; }()); + +/***/ }), + +/***/ 24: +/***/ (function(module, exports) { + +function _extends() { + module.exports = _extends = Object.assign || function (target) { + for (var i = 1; i < arguments.length; i++) { + var source = arguments[i]; + + for (var key in source) { + if (Object.prototype.hasOwnProperty.call(source, key)) { + target[key] = source[key]; + } + } + } + + return target; + }; - return children({}); + return _extends.apply(this, arguments); } -/* harmony default export */ __webpack_exports__["a"] = (Animate); -//# sourceMappingURL=index.js.map +module.exports = _extends; /***/ }), -/* 116 */ + +/***/ 25: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2); -/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_1__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ADMIN_URL; }); +/* unused harmony export COUNTRIES */ +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return CURRENCY; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return LOCALE; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return ORDER_STATUSES; }); +/* unused harmony export SITE_TITLE */ +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return WC_ASSET_URL; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return getSetting; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return setSetting; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return getAdminLink; }); +/* harmony import */ var _babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(31); +/* harmony import */ var _babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2); +/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__); /** * External dependencies */ + // Remove mutable data from settings object to prevent access. Data stores should be used instead. - -function Shortcut(_ref) { - var shortcut = _ref.shortcut, - className = _ref.className; - - if (!shortcut) { - return null; +var mutableSources = ['wcAdminSettings', 'preloadSettings']; +var settings = (typeof wcSettings === "undefined" ? "undefined" : _babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0___default()(wcSettings)) === 'object' ? wcSettings : {}; +var SOURCE = Object.keys(settings).reduce(function (source, key) { + if (!mutableSources.includes(key)) { + source[key] = settings[key]; } - var displayText; - var ariaLabel; + return source; +}, {}); +var ADMIN_URL = SOURCE.adminUrl; +var COUNTRIES = SOURCE.countries; +var CURRENCY = SOURCE.currency; +var LOCALE = SOURCE.locale; +var ORDER_STATUSES = SOURCE.orderStatuses; +var SITE_TITLE = SOURCE.siteTitle; +var WC_ASSET_URL = SOURCE.wcAssetUrl; +/** + * Retrieves a setting value from the setting state. + * + * @param {string} name The identifier for the setting. + * @param {*} [fallback=false] The value to use as a fallback + * if the setting is not in the + * state. + * @param {Function} [filter=( val ) => val] A callback for filtering the + * value before it's returned. + * Receives both the found value + * (if it exists for the key) and + * the provided fallback arg. + * + * @return {*} The value present in the settings state for the given + * name. + */ - if (Object(lodash__WEBPACK_IMPORTED_MODULE_1__["isString"])(shortcut)) { - displayText = shortcut; - } +function getSetting(name) { + var fallback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; + var filter = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function (val) { + return val; + }; - if (Object(lodash__WEBPACK_IMPORTED_MODULE_1__["isObject"])(shortcut)) { - displayText = shortcut.display; - ariaLabel = shortcut.ariaLabel; + if (mutableSources.includes(name)) { + throw new Error(Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__["__"])('Mutable settings should be accessed via data store.')); } - return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])("span", { - className: className, - "aria-label": ariaLabel - }, displayText); + var value = SOURCE.hasOwnProperty(name) ? SOURCE[name] : fallback; + return filter(value, fallback); } +/** + * Sets a value to a property on the settings state. + * + * NOTE: This feature is to be removed in favour of data stores when a full migration + * is complete. + * + * @deprecated + * + * @param {string} name The setting property key for the + * setting being mutated. + * @param {*} value The value to set. + * @param {Function} [filter=( val ) => val] Allows for providing a callback + * to sanitize the setting (eg. + * ensure it's a number) + */ -/* harmony default export */ __webpack_exports__["a"] = (Shortcut); -//# sourceMappingURL=index.js.map +function setSetting(name, value) { + var filter = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function (val) { + return val; + }; -/***/ }), -/* 117 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { + if (mutableSources.includes(name)) { + throw new Error(Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__["__"])('Mutable settings should be mutated via data store.')); + } -"use strict"; + SOURCE[name] = filter(value); +} +/** + * Returns a string with the site's wp-admin URL appended. JS version of `admin_url`. + * + * @param {string} path Relative path. + * @return {string} Full admin URL. + */ -// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js -var esm_extends = __webpack_require__(7); +function getAdminLink(path) { + return (ADMIN_URL || '') + path; +} -// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js + 3 modules -var slicedToArray = __webpack_require__(24); +/***/ }), -// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js -var objectWithoutProperties = __webpack_require__(11); +/***/ 26: +/***/ (function(module, exports) { -// EXTERNAL MODULE: external {"this":["wp","element"]} -var external_this_wp_element_ = __webpack_require__(0); +(function() { module.exports = this["wp"]["apiFetch"]; }()); -// EXTERNAL MODULE: ./node_modules/classnames/index.js -var classnames = __webpack_require__(4); -var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames); +/***/ }), -// EXTERNAL MODULE: ./node_modules/@wordpress/components/node_modules/@wordpress/dom/build-module/dom.js -var dom = __webpack_require__(129); +/***/ 27: +/***/ (function(module, exports) { -// EXTERNAL MODULE: ./node_modules/@wordpress/components/node_modules/@wordpress/dom/build-module/index.js + 2 modules -var build_module = __webpack_require__(69); +(function() { module.exports = this["wc"]["tracks"]; }()); -// EXTERNAL MODULE: ./node_modules/@wordpress/components/node_modules/@wordpress/keycodes/build-module/index.js + 1 modules -var keycodes_build_module = __webpack_require__(57); +/***/ }), -// EXTERNAL MODULE: ./node_modules/@wordpress/deprecated/build-module/index.js -var deprecated_build_module = __webpack_require__(47); +/***/ 277: +/***/ (function(module, __webpack_exports__, __webpack_require__) { -// EXTERNAL MODULE: ./node_modules/@wordpress/compose/build-module/hooks/use-viewport-match/index.js -var use_viewport_match = __webpack_require__(180); +"use strict"; +/* WEBPACK VAR INJECTION */(function(process) {/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(3); +/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_1__); +/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(6); +/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_2__); +/* harmony import */ var _wordpress_a11y__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(140); +/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(2); +/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__); +/* harmony import */ var _wordpress_warning__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(278); +/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(4); +/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_6__); -// EXTERNAL MODULE: ./node_modules/@wordpress/compose/build-module/hooks/use-resize-observer/index.js -var use_resize_observer = __webpack_require__(207); -// EXTERNAL MODULE: ./node_modules/@wordpress/components/node_modules/@wordpress/icons/build-module/library/close.js -var library_close = __webpack_require__(257); +/** + * External dependencies + */ -// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/defineProperty.js -var defineProperty = __webpack_require__(6); -// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/popover/utils.js -function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } -/** - * WordPress dependencies - */ +var NOTICE_TIMEOUT = 10000; +/** @typedef {import('@wordpress/element').WPElement} WPElement */ /** - * Module constants - */ - -var HEIGHT_OFFSET = 10; // used by the arrow and a bit of empty space - -/** - * Utility used to compute the popover position over the xAxis - * - * @param {Object} anchorRect Anchor Rect. - * @param {Object} contentSize Content Size. - * @param {string} xAxis Desired xAxis. - * @param {string} corner Desired corner. - * @param {boolean} sticky Whether or not to stick the popover to the - * scroll container edge when part of the anchor - * leaves view. - * @param {string} chosenYAxis yAxis to be used. - * @param {Element} boundaryElement Boundary element. + * Custom hook which announces the message with the given politeness, if a + * valid message is provided. * - * @return {Object} Popover xAxis position and constraints. + * @param {string|WPElement} [message] Message to announce. + * @param {'polite'|'assertive'} politeness Politeness to announce. */ -function computePopoverXAxisPosition(anchorRect, contentSize, xAxis, corner, sticky, chosenYAxis, boundaryElement) { - var width = contentSize.width; - var isRTL = document.documentElement.dir === 'rtl'; // Correct xAxis for RTL support - - if (xAxis === 'left' && isRTL) { - xAxis = 'right'; - } else if (xAxis === 'right' && isRTL) { - xAxis = 'left'; - } - - if (corner === 'left' && isRTL) { - corner = 'right'; - } else if (corner === 'right' && isRTL) { - corner = 'left'; - } // x axis alignment choices +function useSpokenMessage(message, politeness) { + var spokenMessage = typeof message === 'string' ? message : Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["renderToString"])(message); + Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["useEffect"])(function () { + if (spokenMessage) { + Object(_wordpress_a11y__WEBPACK_IMPORTED_MODULE_3__[/* speak */ "a"])(spokenMessage, politeness); + } + }, [spokenMessage, politeness]); +} +function Snackbar(_ref, ref) { + var className = _ref.className, + children = _ref.children, + _ref$spokenMessage = _ref.spokenMessage, + spokenMessage = _ref$spokenMessage === void 0 ? children : _ref$spokenMessage, + _ref$politeness = _ref.politeness, + politeness = _ref$politeness === void 0 ? 'polite' : _ref$politeness, + _ref$actions = _ref.actions, + actions = _ref$actions === void 0 ? [] : _ref$actions, + _ref$onRemove = _ref.onRemove, + onRemove = _ref$onRemove === void 0 ? lodash__WEBPACK_IMPORTED_MODULE_1__["noop"] : _ref$onRemove, + _ref$icon = _ref.icon, + icon = _ref$icon === void 0 ? null : _ref$icon, + _ref$explicitDismiss = _ref.explicitDismiss, + explicitDismiss = _ref$explicitDismiss === void 0 ? false : _ref$explicitDismiss, + _ref$onDismiss = _ref.onDismiss, + onDismiss = _ref$onDismiss === void 0 ? null : _ref$onDismiss; + onDismiss = onDismiss || lodash__WEBPACK_IMPORTED_MODULE_1__["noop"]; - var anchorMidPoint = Math.round(anchorRect.left + anchorRect.width / 2); - var centerAlignment = { - popoverLeft: anchorMidPoint, - contentWidth: (anchorMidPoint - width / 2 > 0 ? width / 2 : anchorMidPoint) + (anchorMidPoint + width / 2 > window.innerWidth ? window.innerWidth - anchorMidPoint : width / 2) - }; - var leftAlignmentX = anchorRect.left; + function dismissMe(event) { + if (event && event.preventDefault) { + event.preventDefault(); + } - if (corner === 'right') { - leftAlignmentX = anchorRect.right; - } else if (chosenYAxis !== 'middle') { - leftAlignmentX = anchorMidPoint; + onDismiss(); + onRemove(); } - var rightAlignmentX = anchorRect.right; - - if (corner === 'left') { - rightAlignmentX = anchorRect.left; - } else if (chosenYAxis !== 'middle') { - rightAlignmentX = anchorMidPoint; - } + function onActionClick(event, onClick) { + event.stopPropagation(); + onRemove(); - var leftAlignment = { - popoverLeft: leftAlignmentX, - contentWidth: leftAlignmentX - width > 0 ? width : leftAlignmentX - }; - var rightAlignment = { - popoverLeft: rightAlignmentX, - contentWidth: rightAlignmentX + width > window.innerWidth ? window.innerWidth - rightAlignmentX : width - }; // Choosing the x axis - - var chosenXAxis = xAxis; - var contentWidth = null; - - if (!sticky) { - if (xAxis === 'center' && centerAlignment.contentWidth === width) { - chosenXAxis = 'center'; - } else if (xAxis === 'left' && leftAlignment.contentWidth === width) { - chosenXAxis = 'left'; - } else if (xAxis === 'right' && rightAlignment.contentWidth === width) { - chosenXAxis = 'right'; - } else { - chosenXAxis = leftAlignment.contentWidth > rightAlignment.contentWidth ? 'left' : 'right'; - var chosenWidth = chosenXAxis === 'left' ? leftAlignment.contentWidth : rightAlignment.contentWidth; - contentWidth = chosenWidth !== width ? chosenWidth : null; + if (onClick) { + onClick(event); } } - var popoverLeft; + useSpokenMessage(spokenMessage, politeness); // Only set up the timeout dismiss if we're not explicitly dismissing. - if (chosenXAxis === 'center') { - popoverLeft = centerAlignment.popoverLeft; - } else if (chosenXAxis === 'left') { - popoverLeft = leftAlignment.popoverLeft; - } else { - popoverLeft = rightAlignment.popoverLeft; - } + Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["useEffect"])(function () { + var timeoutHandle = setTimeout(function () { + if (!explicitDismiss) { + onDismiss(); + onRemove(); + } + }, NOTICE_TIMEOUT); + return function () { + return clearTimeout(timeoutHandle); + }; + }, [explicitDismiss, onDismiss, onRemove]); + var classes = classnames__WEBPACK_IMPORTED_MODULE_2___default()(className, 'components-snackbar', { + 'components-snackbar-explicit-dismiss': !!explicitDismiss + }); + + if (actions && actions.length > 1) { + // we need to inform developers that snackbar only accepts 1 action + typeof process !== "undefined" && process.env && "production" !== "production" ? Object(_wordpress_warning__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"])('Snackbar can only have 1 action, use Notice if your message require many messages') : void 0; // return first element only while keeping it inside an array - if (boundaryElement) { - var boundaryRect = boundaryElement.getBoundingClientRect(); - popoverLeft = Math.min(popoverLeft, boundaryRect.right - width); + actions = [actions[0]]; } - return { - xAxis: chosenXAxis, - popoverLeft: popoverLeft, - contentWidth: contentWidth - }; + var snackbarContentClassnames = classnames__WEBPACK_IMPORTED_MODULE_2___default()('components-snackbar__content', { + 'components-snackbar__content-with-icon': !!icon + }); + return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])("div", { + ref: ref, + className: classes, + onClick: !explicitDismiss ? dismissMe : lodash__WEBPACK_IMPORTED_MODULE_1__["noop"], + tabIndex: "0", + role: !explicitDismiss ? 'button' : '', + onKeyPress: !explicitDismiss ? dismissMe : lodash__WEBPACK_IMPORTED_MODULE_1__["noop"], + "aria-label": !explicitDismiss ? Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__["__"])('Dismiss this notice') : '' + }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])("div", { + className: snackbarContentClassnames + }, icon && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])("div", { + className: "components-snackbar__icon" + }, icon), children, actions.map(function (_ref2, index) { + var label = _ref2.label, + _onClick = _ref2.onClick, + url = _ref2.url; + return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_6__["Button"], { + key: index, + href: url, + isTertiary: true, + onClick: function onClick(event) { + return onActionClick(event, _onClick); + }, + className: "components-snackbar__action" + }, label); + }), explicitDismiss && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])("span", { + role: "button", + "aria-label": "Dismiss this notice", + tabIndex: "0", + className: "components-snackbar__dismiss-button", + onClick: dismissMe, + onKeyPress: dismissMe + }, "\u2715"))); } -/** - * Utility used to compute the popover position over the yAxis - * - * @param {Object} anchorRect Anchor Rect. - * @param {Object} contentSize Content Size. - * @param {string} yAxis Desired yAxis. - * @param {string} corner Desired corner. - * @param {boolean} sticky Whether or not to stick the popover to the - * scroll container edge when part of the - * anchor leaves view. - * @param {Element} anchorRef The anchor element. - * @param {Element} relativeOffsetTop If applicable, top offset of the relative - * positioned parent container. - * - * @return {Object} Popover xAxis position and constraints. - */ - -function computePopoverYAxisPosition(anchorRect, contentSize, yAxis, corner, sticky, anchorRef, relativeOffsetTop) { - var height = contentSize.height; - - if (sticky) { - var scrollContainerEl = Object(dom["b" /* getScrollContainer */])(anchorRef) || document.body; - var scrollRect = scrollContainerEl.getBoundingClientRect(); - var stickyPosition = scrollRect.top + height - relativeOffsetTop; - - if (anchorRect.top <= stickyPosition) { - return { - yAxis: yAxis, - popoverTop: Math.min(anchorRect.bottom, stickyPosition) - }; - } - } // y axis alignment choices - - - var anchorMidPoint = anchorRect.top + anchorRect.height / 2; - - if (corner === 'bottom') { - anchorMidPoint = anchorRect.bottom; - } else if (corner === 'top') { - anchorMidPoint = anchorRect.top; - } - var middleAlignment = { - popoverTop: anchorMidPoint, - contentHeight: (anchorMidPoint - height / 2 > 0 ? height / 2 : anchorMidPoint) + (anchorMidPoint + height / 2 > window.innerHeight ? window.innerHeight - anchorMidPoint : height / 2) - }; - var topAlignment = { - popoverTop: anchorRect.top, - contentHeight: anchorRect.top - HEIGHT_OFFSET - height > 0 ? height : anchorRect.top - HEIGHT_OFFSET - }; - var bottomAlignment = { - popoverTop: anchorRect.bottom, - contentHeight: anchorRect.bottom + HEIGHT_OFFSET + height > window.innerHeight ? window.innerHeight - HEIGHT_OFFSET - anchorRect.bottom : height - }; // Choosing the y axis - - var chosenYAxis = yAxis; - var contentHeight = null; - - if (!sticky) { - if (yAxis === 'middle' && middleAlignment.contentHeight === height) { - chosenYAxis = 'middle'; - } else if (yAxis === 'top' && topAlignment.contentHeight === height) { - chosenYAxis = 'top'; - } else if (yAxis === 'bottom' && bottomAlignment.contentHeight === height) { - chosenYAxis = 'bottom'; - } else { - chosenYAxis = topAlignment.contentHeight > bottomAlignment.contentHeight ? 'top' : 'bottom'; - var chosenHeight = chosenYAxis === 'top' ? topAlignment.contentHeight : bottomAlignment.contentHeight; - contentHeight = chosenHeight !== height ? chosenHeight : null; - } - } +/* harmony default export */ __webpack_exports__["a"] = (Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["forwardRef"])(Snackbar)); +/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(125))) - var popoverTop; +/***/ }), - if (chosenYAxis === 'middle') { - popoverTop = middleAlignment.popoverTop; - } else if (chosenYAxis === 'top') { - popoverTop = topAlignment.popoverTop; - } else { - popoverTop = bottomAlignment.popoverTop; - } +/***/ 278: +/***/ (function(module, __webpack_exports__, __webpack_require__) { - return { - yAxis: chosenYAxis, - popoverTop: popoverTop, - contentHeight: contentHeight - }; +"use strict"; +/* WEBPACK VAR INJECTION */(function(process) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return warning; }); +function isDev() { + return typeof process !== 'undefined' && process.env && "production" !== 'production'; } /** - * Utility used to compute the popover position and the content max width/height - * for a popover given its anchor rect and its content size. + * Shows a warning with `message` if environment is not `production`. + * + * @param {string} message Message to show in the warning. * - * @param {Object} anchorRect Anchor Rect. - * @param {Object} contentSize Content Size. - * @param {string} position Position. - * @param {boolean} sticky Whether or not to stick the popover to the - * scroll container edge when part of the - * anchor leaves view. - * @param {Element} anchorRef The anchor element. - * @param {number} relativeOffsetTop If applicable, top offset of the relative - * positioned parent container. - * @param {Element} boundaryElement Boundary element. + * @example + * ```js + * import warning from '@wordpress/warning'; * - * @return {Object} Popover position and constraints. + * function MyComponent( props ) { + * if ( ! props.title ) { + * warning( '`props.title` was not passed' ); + * } + * ... + * } + * ``` */ -function computePopoverPosition(anchorRect, contentSize) { - var position = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'top'; - var sticky = arguments.length > 3 ? arguments[3] : undefined; - var anchorRef = arguments.length > 4 ? arguments[4] : undefined; - var relativeOffsetTop = arguments.length > 5 ? arguments[5] : undefined; - var boundaryElement = arguments.length > 6 ? arguments[6] : undefined; - - var _position$split = position.split(' '), - _position$split2 = Object(slicedToArray["a" /* default */])(_position$split, 3), - yAxis = _position$split2[0], - _position$split2$ = _position$split2[1], - xAxis = _position$split2$ === void 0 ? 'center' : _position$split2$, - corner = _position$split2[2]; - - var yAxisPosition = computePopoverYAxisPosition(anchorRect, contentSize, yAxis, corner, sticky, anchorRef, relativeOffsetTop); - var xAxisPosition = computePopoverXAxisPosition(anchorRect, contentSize, xAxis, corner, sticky, yAxisPosition.yAxis, boundaryElement); - return _objectSpread(_objectSpread({}, xAxisPosition), yAxisPosition); -} -//# sourceMappingURL=utils.js.map -// EXTERNAL MODULE: ./node_modules/@wordpress/components/build-module/higher-order/with-focus-return/index.js + 1 modules -var with_focus_return = __webpack_require__(113); - -// EXTERNAL MODULE: ./node_modules/@wordpress/components/build-module/higher-order/with-constrained-tabbing/index.js -var with_constrained_tabbing = __webpack_require__(109); -// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/classCallCheck.js -var classCallCheck = __webpack_require__(16); - -// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/createClass.js -var createClass = __webpack_require__(17); +function warning(message) { + if (!isDev()) { + return; + } // eslint-disable-next-line no-console -// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/inherits.js + 1 modules -var inherits = __webpack_require__(18); -// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js -var possibleConstructorReturn = __webpack_require__(21); + console.warn(message); // Throwing an error and catching it immediately to improve debugging + // A consumer can use 'pause on caught exceptions' + // https://github.com/facebook/react/issues/4216 -// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js -var getPrototypeOf = __webpack_require__(9); + try { + throw Error(message); + } catch (x) {// do nothing + } +} +//# sourceMappingURL=index.js.map +/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(125))) -// EXTERNAL MODULE: ./node_modules/@wordpress/components/build-module/higher-order/with-focus-outside/index.js -var with_focus_outside = __webpack_require__(110); +/***/ }), -// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/popover/detect-outside.js +/***/ 279: +/***/ (function(module, exports) { +(function() { module.exports = this["wc"]["customerEffortScore"]; }()); +/***/ }), +/***/ 286: +/***/ (function(module, __webpack_exports__, __webpack_require__) { +"use strict"; +// EXPORTS +__webpack_require__.d(__webpack_exports__, "a", function() { return /* reexport */ customer_effort_score_tracks_container; }); -function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = Object(getPrototypeOf["a" /* default */])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = Object(getPrototypeOf["a" /* default */])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return Object(possibleConstructorReturn["a" /* default */])(this, result); }; } +// UNUSED EXPORTS: CustomerEffortScoreTracks -function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } +// NAMESPACE OBJECT: ./client/customer-effort-score-tracks/data/actions.js +var actions_namespaceObject = {}; +__webpack_require__.r(actions_namespaceObject); +__webpack_require__.d(actions_namespaceObject, "setCesSurveyQueue", function() { return setCesSurveyQueue; }); +__webpack_require__.d(actions_namespaceObject, "addCesSurvey", function() { return addCesSurvey; }); +__webpack_require__.d(actions_namespaceObject, "addCesSurveyForAnalytics", function() { return addCesSurveyForAnalytics; }); -/** - * WordPress dependencies - */ +// NAMESPACE OBJECT: ./client/customer-effort-score-tracks/data/resolvers.js +var resolvers_namespaceObject = {}; +__webpack_require__.r(resolvers_namespaceObject); +__webpack_require__.d(resolvers_namespaceObject, "getCesSurveyQueue", function() { return resolvers_getCesSurveyQueue; }); -/** - * Internal dependencies - */ +// NAMESPACE OBJECT: ./client/customer-effort-score-tracks/data/selectors.js +var selectors_namespaceObject = {}; +__webpack_require__.r(selectors_namespaceObject); +__webpack_require__.d(selectors_namespaceObject, "getCesSurveyQueue", function() { return selectors_getCesSurveyQueue; }); +// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/toConsumableArray.js +var toConsumableArray = __webpack_require__(19); +var toConsumableArray_default = /*#__PURE__*/__webpack_require__.n(toConsumableArray); +// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/defineProperty.js +var defineProperty = __webpack_require__(5); +var defineProperty_default = /*#__PURE__*/__webpack_require__.n(defineProperty); -var detect_outside_PopoverDetectOutside = /*#__PURE__*/function (_Component) { - Object(inherits["a" /* default */])(PopoverDetectOutside, _Component); +// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/slicedToArray.js +var slicedToArray = __webpack_require__(18); +var slicedToArray_default = /*#__PURE__*/__webpack_require__.n(slicedToArray); - var _super = _createSuper(PopoverDetectOutside); +// EXTERNAL MODULE: external {"this":["wp","element"]} +var external_this_wp_element_ = __webpack_require__(0); - function PopoverDetectOutside() { - Object(classCallCheck["a" /* default */])(this, PopoverDetectOutside); +// EXTERNAL MODULE: ./node_modules/prop-types/index.js +var prop_types = __webpack_require__(1); +var prop_types_default = /*#__PURE__*/__webpack_require__.n(prop_types); - return _super.apply(this, arguments); - } +// EXTERNAL MODULE: external {"this":["wc","tracks"]} +var external_this_wc_tracks_ = __webpack_require__(27); - Object(createClass["a" /* default */])(PopoverDetectOutside, [{ - key: "handleFocusOutside", - value: function handleFocusOutside(event) { - this.props.onFocusOutside(event); - } - }, { - key: "render", - value: function render() { - return this.props.children; - } - }]); +// EXTERNAL MODULE: external {"this":["wc","customerEffortScore"]} +var external_this_wc_customerEffortScore_ = __webpack_require__(279); +var external_this_wc_customerEffortScore_default = /*#__PURE__*/__webpack_require__.n(external_this_wc_customerEffortScore_); - return PopoverDetectOutside; -}(external_this_wp_element_["Component"]); +// EXTERNAL MODULE: external {"this":["wp","compose"]} +var external_this_wp_compose_ = __webpack_require__(20); -/* harmony default export */ var detect_outside = (Object(with_focus_outside["a" /* default */])(detect_outside_PopoverDetectOutside)); -//# sourceMappingURL=detect-outside.js.map -// EXTERNAL MODULE: ./node_modules/@wordpress/components/build-module/button/index.js -var build_module_button = __webpack_require__(68); +// EXTERNAL MODULE: external {"this":["wp","data"]} +var external_this_wp_data_ = __webpack_require__(11); -// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/scroll-lock/index.js +// EXTERNAL MODULE: external {"this":["wc","data"]} +var external_this_wc_data_ = __webpack_require__(22); +// EXTERNAL MODULE: external {"this":["wp","i18n"]} +var external_this_wp_i18n_ = __webpack_require__(2); +// CONCATENATED MODULE: ./client/customer-effort-score-tracks/customer-effort-score-tracks.js -function scroll_lock_createSuper(Derived) { var hasNativeReflectConstruct = scroll_lock_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = Object(getPrototypeOf["a" /* default */])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = Object(getPrototypeOf["a" /* default */])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return Object(possibleConstructorReturn["a" /* default */])(this, result); }; } -function scroll_lock_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } +function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } -/** - * WordPress dependencies - */ +function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { defineProperty_default()(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } /** - * Creates a ScrollLock component bound to the specified document. - * - * This function creates a ScrollLock component for the specified document - * and is exposed so we can create an isolated component for unit testing. - * - * @param {Object} args Keyword args. - * @param {HTMLDocument} args.htmlDocument The document to lock the scroll for. - * @param {string} args.className The name of the class used to lock scrolling. - * @return {WPComponent} The bound ScrollLock component. + * External dependencies */ -function createScrollLockComponent() { - var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, - _ref$htmlDocument = _ref.htmlDocument, - htmlDocument = _ref$htmlDocument === void 0 ? document : _ref$htmlDocument, - _ref$className = _ref.className, - className = _ref$className === void 0 ? 'lockscroll' : _ref$className; - - var lockCounter = 0; - /* - * Setting `overflow: hidden` on html and body elements resets body scroll in iOS. - * Save scroll top so we can restore it after locking scroll. - * - * NOTE: It would be cleaner and possibly safer to find a localized solution such - * as preventing default on certain touchmove events. - */ - - var previousScrollTop = 0; - /** - * Locks and unlocks scroll depending on the boolean argument. - * - * @param {boolean} locked Whether or not scroll should be locked. - */ - - function setLocked(locked) { - var scrollingElement = htmlDocument.scrollingElement || htmlDocument.body; - if (locked) { - previousScrollTop = scrollingElement.scrollTop; - } - var methodName = locked ? 'add' : 'remove'; - scrollingElement.classList[methodName](className); // Adding the class to the document element seems to be necessary in iOS. - htmlDocument.documentElement.classList[methodName](className); - if (!locked) { - scrollingElement.scrollTop = previousScrollTop; - } - } - /** - * Requests scroll lock. - * - * This function tracks requests for scroll lock. It locks scroll on the first - * request and counts each request so `releaseLock` can unlock scroll when - * all requests have been released. - */ - function requestLock() { - if (lockCounter === 0) { - setLocked(true); - } - ++lockCounter; - } - /** - * Releases a request for scroll lock. - * - * This function tracks released requests for scroll lock. When all requests - * have been released, it unlocks scroll. - */ - - - function releaseLock() { - if (lockCounter === 1) { - setLocked(false); - } - - --lockCounter; - } - - return /*#__PURE__*/function (_Component) { - Object(inherits["a" /* default */])(ScrollLock, _Component); - - var _super = scroll_lock_createSuper(ScrollLock); - - function ScrollLock() { - Object(classCallCheck["a" /* default */])(this, ScrollLock); - - return _super.apply(this, arguments); - } - - Object(createClass["a" /* default */])(ScrollLock, [{ - key: "componentDidMount", - - /** - * Requests scroll lock on mount. - */ - value: function componentDidMount() { - requestLock(); - } - /** - * Releases scroll lock before unmount. - */ - - }, { - key: "componentWillUnmount", - value: function componentWillUnmount() { - releaseLock(); - } - /** - * Render nothing as this component is merely a way to declare scroll lock. - * - * @return {null} Render nothing by returning `null`. - */ - - }, { - key: "render", - value: function render() { - return null; - } - }]); - - return ScrollLock; - }(external_this_wp_element_["Component"]); -} -/* harmony default export */ var scroll_lock = (createScrollLockComponent()); -//# sourceMappingURL=index.js.map -// EXTERNAL MODULE: ./node_modules/@wordpress/components/build-module/isolated-event-container/index.js -var isolated_event_container = __webpack_require__(111); - -// EXTERNAL MODULE: ./node_modules/@wordpress/components/build-module/slot-fill/bubbles-virtually/use-slot.js -var use_slot = __webpack_require__(71); - -// EXTERNAL MODULE: ./node_modules/@wordpress/components/build-module/slot-fill/index.js + 4 modules -var slot_fill = __webpack_require__(98); - -// EXTERNAL MODULE: ./node_modules/@wordpress/components/build-module/animate/index.js -var build_module_animate = __webpack_require__(115); - -// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/popover/index.js - - - - - -/** - * External dependencies - */ - -/** - * WordPress dependencies - */ - - - - - - - -/** - * Internal dependencies - */ - - - - - - - - - - -var FocusManaged = Object(with_constrained_tabbing["a" /* default */])(Object(with_focus_return["a" /* default */])(function (_ref) { - var children = _ref.children; - return children; -})); -/** - * Name of slot in which popover should fill. - * - * @type {string} - */ - -var SLOT_NAME = 'Popover'; - -function computeAnchorRect(anchorRefFallback, anchorRect, getAnchorRect) { - var anchorRef = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false; - var shouldAnchorIncludePadding = arguments.length > 4 ? arguments[4] : undefined; - - if (anchorRect) { - return anchorRect; - } - - if (getAnchorRect) { - if (!anchorRefFallback.current) { - return; - } - - return getAnchorRect(anchorRefFallback.current); - } - - if (anchorRef !== false) { - if (!anchorRef || !window.Range || !window.Element || !window.DOMRect) { - return; - } - - if (anchorRef instanceof window.Range) { - return Object(dom["a" /* getRectangleFromRange */])(anchorRef); - } - - if (anchorRef instanceof window.Element) { - var _rect2 = anchorRef.getBoundingClientRect(); - - if (shouldAnchorIncludePadding) { - return _rect2; - } - - return withoutPadding(_rect2, anchorRef); - } - - var top = anchorRef.top, - bottom = anchorRef.bottom; - var topRect = top.getBoundingClientRect(); - var bottomRect = bottom.getBoundingClientRect(); - - var _rect = new window.DOMRect(topRect.left, topRect.top, topRect.width, bottomRect.bottom - topRect.top); - - if (shouldAnchorIncludePadding) { - return _rect; - } - - return withoutPadding(_rect, anchorRef); - } - - if (!anchorRefFallback.current) { - return; - } - - var parentNode = anchorRefFallback.current.parentNode; - var rect = parentNode.getBoundingClientRect(); - - if (shouldAnchorIncludePadding) { - return rect; - } - - return withoutPadding(rect, parentNode); -} - -function getComputedStyle(node) { - return node.ownerDocument.defaultView.getComputedStyle(node); -} - -function withoutPadding(rect, element) { - var _getComputedStyle = getComputedStyle(element), - paddingTop = _getComputedStyle.paddingTop, - paddingBottom = _getComputedStyle.paddingBottom, - paddingLeft = _getComputedStyle.paddingLeft, - paddingRight = _getComputedStyle.paddingRight; - - var top = paddingTop ? parseInt(paddingTop, 10) : 0; - var bottom = paddingBottom ? parseInt(paddingBottom, 10) : 0; - var left = paddingLeft ? parseInt(paddingLeft, 10) : 0; - var right = paddingRight ? parseInt(paddingRight, 10) : 0; - return { - x: rect.left + left, - y: rect.top + top, - width: rect.width - left - right, - height: rect.height - top - bottom, - left: rect.left + left, - right: rect.right - right, - top: rect.top + top, - bottom: rect.bottom - bottom - }; -} -/** - * Hook used to focus the first tabbable element on mount. - * - * @param {boolean|string} focusOnMount Focus on mount mode. - * @param {Object} contentRef Reference to the popover content element. - */ - - -function useFocusContentOnMount(focusOnMount, contentRef) { - // Focus handling - Object(external_this_wp_element_["useEffect"])(function () { - /* - * Without the setTimeout, the dom node is not being focused. Related: - * https://stackoverflow.com/questions/35522220/react-ref-with-focus-doesnt-work-without-settimeout-my-example - * - * TODO: Treat the cause, not the symptom. - */ - var focusTimeout = setTimeout(function () { - if (!focusOnMount || !contentRef.current) { - return; - } - - if (focusOnMount === 'firstElement') { - // Find first tabbable node within content and shift focus, falling - // back to the popover panel itself. - var firstTabbable = build_module["a" /* focus */].tabbable.find(contentRef.current)[0]; - - if (firstTabbable) { - firstTabbable.focus(); - } else { - contentRef.current.focus(); - } - - return; - } - - if (focusOnMount === 'container') { - // Focus the popover panel itself so items in the popover are easily - // accessed via keyboard navigation. - contentRef.current.focus(); - } - }, 0); - return function () { - return clearTimeout(focusTimeout); - }; - }, []); -} -/** - * Sets or removes an element attribute. - * - * @param {Element} element The element to modify. - * @param {string} name The attribute name to set or remove. - * @param {?string} value The value to set. A falsy value will remove the - * attribute. - */ - - -function setAttribute(element, name, value) { - if (!value) { - if (element.hasAttribute(name)) { - element.removeAttribute(name); - } - } else if (element.getAttribute(name) !== value) { - element.setAttribute(name, value); - } -} -/** - * Sets or removes an element style property. - * - * @param {Element} element The element to modify. - * @param {string} property The property to set or remove. - * @param {?string} value The value to set. A falsy value will remove the - * property. - */ - - -function setStyle(element, property) { - var value = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ''; - - if (element.style[property] !== value) { - element.style[property] = value; - } -} +var SHOWN_FOR_ACTIONS_OPTION_NAME = 'woocommerce_ces_shown_for_actions'; +var ADMIN_INSTALL_TIMESTAMP_OPTION_NAME = 'woocommerce_admin_install_timestamp'; +var ALLOW_TRACKING_OPTION_NAME = 'woocommerce_allow_tracking'; /** - * Sets or removes an element class. + * A CustomerEffortScore wrapper that uses tracks to track the selected + * customer effort score. * - * @param {Element} element The element to modify. - * @param {string} name The class to set or remove. - * @param {boolean} toggle True to set the class, false to remove. + * @param {Object} props Component props. + * @param {string} props.action The action name sent to Tracks. + * @param {Object} props.trackProps Additional props sent to Tracks. + * @param {string} props.label The label displayed in the modal. + * @param {string} props.onSubmitLabel The label displayed upon survey submission. + * @param {Array} props.cesShownForActions The array of actions that the CES modal has been shown for. + * @param {boolean} props.allowTracking Whether tracking is allowed or not. + * @param {boolean} props.resolving Are values still being resolved. + * @param {number} props.storeAgeInWeeks The age of the store in weeks. + * @param {Function} props.updateOptions Function to update options. + * @param {Function} props.createNotice Function to create a snackbar. */ +function CustomerEffortScoreTracks(_ref) { + var action = _ref.action, + trackProps = _ref.trackProps, + label = _ref.label, + _ref$onSubmitLabel = _ref.onSubmitLabel, + onSubmitLabel = _ref$onSubmitLabel === void 0 ? Object(external_this_wp_i18n_["__"])('Thank you for your feedback!', 'woocommerce-admin') : _ref$onSubmitLabel, + cesShownForActions = _ref.cesShownForActions, + allowTracking = _ref.allowTracking, + resolving = _ref.resolving, + storeAgeInWeeks = _ref.storeAgeInWeeks, + updateOptions = _ref.updateOptions, + createNotice = _ref.createNotice; -function setClass(element, name, toggle) { - if (toggle) { - if (!element.classList.contains(name)) { - element.classList.add(name); - } - } else if (element.classList.contains(name)) { - element.classList.remove(name); - } -} - -var popover_Popover = function Popover(_ref2) { - var headerTitle = _ref2.headerTitle, - onClose = _ref2.onClose, - onKeyDown = _ref2.onKeyDown, - children = _ref2.children, - className = _ref2.className, - _ref2$noArrow = _ref2.noArrow, - noArrow = _ref2$noArrow === void 0 ? true : _ref2$noArrow, - isAlternate = _ref2.isAlternate, - _ref2$position = _ref2.position, - position = _ref2$position === void 0 ? 'bottom right' : _ref2$position, - range = _ref2.range, - _ref2$focusOnMount = _ref2.focusOnMount, - focusOnMount = _ref2$focusOnMount === void 0 ? 'firstElement' : _ref2$focusOnMount, - anchorRef = _ref2.anchorRef, - shouldAnchorIncludePadding = _ref2.shouldAnchorIncludePadding, - anchorRect = _ref2.anchorRect, - getAnchorRect = _ref2.getAnchorRect, - expandOnMobile = _ref2.expandOnMobile, - _ref2$animate = _ref2.animate, - animate = _ref2$animate === void 0 ? true : _ref2$animate, - onClickOutside = _ref2.onClickOutside, - onFocusOutside = _ref2.onFocusOutside, - __unstableSticky = _ref2.__unstableSticky, - _ref2$__unstableSlotN = _ref2.__unstableSlotName, - __unstableSlotName = _ref2$__unstableSlotN === void 0 ? SLOT_NAME : _ref2$__unstableSlotN, - __unstableObserveElement = _ref2.__unstableObserveElement, - __unstableBoundaryParent = _ref2.__unstableBoundaryParent, - contentProps = Object(objectWithoutProperties["a" /* default */])(_ref2, ["headerTitle", "onClose", "onKeyDown", "children", "className", "noArrow", "isAlternate", "position", "range", "focusOnMount", "anchorRef", "shouldAnchorIncludePadding", "anchorRect", "getAnchorRect", "expandOnMobile", "animate", "onClickOutside", "onFocusOutside", "__unstableSticky", "__unstableSlotName", "__unstableObserveElement", "__unstableBoundaryParent"]); - - var anchorRefFallback = Object(external_this_wp_element_["useRef"])(null); - var contentRef = Object(external_this_wp_element_["useRef"])(null); - var containerRef = Object(external_this_wp_element_["useRef"])(); - var isMobileViewport = Object(use_viewport_match["a" /* default */])('medium', '<'); - - var _useState = Object(external_this_wp_element_["useState"])(), - _useState2 = Object(slicedToArray["a" /* default */])(_useState, 2), - animateOrigin = _useState2[0], - setAnimateOrigin = _useState2[1]; - - var slot = Object(use_slot["a" /* default */])(__unstableSlotName); - var isExpanded = expandOnMobile && isMobileViewport; - - var _useResizeObserver = Object(use_resize_observer["a" /* default */])(), - _useResizeObserver2 = Object(slicedToArray["a" /* default */])(_useResizeObserver, 2), - containerResizeListener = _useResizeObserver2[0], - contentSize = _useResizeObserver2[1]; - - noArrow = isExpanded || noArrow; - Object(external_this_wp_element_["useLayoutEffect"])(function () { - if (isExpanded) { - setClass(containerRef.current, 'is-without-arrow', noArrow); - setClass(containerRef.current, 'is-alternate', isAlternate); - setAttribute(containerRef.current, 'data-x-axis'); - setAttribute(containerRef.current, 'data-y-axis'); - setStyle(containerRef.current, 'top'); - setStyle(containerRef.current, 'left'); - setStyle(contentRef.current, 'maxHeight'); - setStyle(contentRef.current, 'maxWidth'); - return; - } - - var refresh = function refresh() { - if (!containerRef.current || !contentRef.current) { - return; - } - - var anchor = computeAnchorRect(anchorRefFallback, anchorRect, getAnchorRect, anchorRef, shouldAnchorIncludePadding); - - if (!anchor) { - return; - } - - var _containerRef$current = containerRef.current, - offsetParent = _containerRef$current.offsetParent, - ownerDocument = _containerRef$current.ownerDocument; - var relativeOffsetTop = 0; // If there is a positioned ancestor element that is not the body, - // subtract the position from the anchor rect. If the position of - // the popover is fixed, the offset parent is null or the body - // element, in which case the position is relative to the viewport. - // See https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/offsetParent - - if (offsetParent && offsetParent !== ownerDocument.body) { - var offsetParentRect = offsetParent.getBoundingClientRect(); - relativeOffsetTop = offsetParentRect.top; - anchor = new window.DOMRect(anchor.left - offsetParentRect.left, anchor.top - offsetParentRect.top, anchor.width, anchor.height); - } - - var boundaryElement; - - if (__unstableBoundaryParent) { - var _containerRef$current2; - - boundaryElement = (_containerRef$current2 = containerRef.current.closest('.popover-slot')) === null || _containerRef$current2 === void 0 ? void 0 : _containerRef$current2.parentNode; - } - - var usedContentSize = !contentSize.height ? contentRef.current.getBoundingClientRect() : contentSize; - - var _computePopoverPositi = computePopoverPosition(anchor, usedContentSize, position, __unstableSticky, containerRef.current, relativeOffsetTop, boundaryElement), - popoverTop = _computePopoverPositi.popoverTop, - popoverLeft = _computePopoverPositi.popoverLeft, - xAxis = _computePopoverPositi.xAxis, - yAxis = _computePopoverPositi.yAxis, - contentHeight = _computePopoverPositi.contentHeight, - contentWidth = _computePopoverPositi.contentWidth; - - if (typeof popoverTop === 'number' && typeof popoverLeft === 'number') { - setStyle(containerRef.current, 'top', popoverTop + 'px'); - setStyle(containerRef.current, 'left', popoverLeft + 'px'); - } - - setClass(containerRef.current, 'is-without-arrow', noArrow || xAxis === 'center' && yAxis === 'middle'); - setClass(containerRef.current, 'is-alternate', isAlternate); - setAttribute(containerRef.current, 'data-x-axis', xAxis); - setAttribute(containerRef.current, 'data-y-axis', yAxis); - setStyle(contentRef.current, 'maxHeight', typeof contentHeight === 'number' ? contentHeight + 'px' : ''); - setStyle(contentRef.current, 'maxWidth', typeof contentWidth === 'number' ? contentWidth + 'px' : ''); // Compute the animation position - - var yAxisMapping = { - top: 'bottom', - bottom: 'top' - }; - var xAxisMapping = { - left: 'right', - right: 'left' - }; - var animateYAxis = yAxisMapping[yAxis] || 'middle'; - var animateXAxis = xAxisMapping[xAxis] || 'center'; - setAnimateOrigin(animateXAxis + ' ' + animateYAxis); - }; - - refresh(); - /* - * There are sometimes we need to reposition or resize the popover that - * are not handled by the resize/scroll window events (i.e. CSS changes - * in the layout that changes the position of the anchor). - * - * For these situations, we refresh the popover every 0.5s - */ - - var intervalHandle = window.setInterval(refresh, 500); - var rafId; - - var refreshOnAnimationFrame = function refreshOnAnimationFrame() { - window.cancelAnimationFrame(rafId); - rafId = window.requestAnimationFrame(refresh); - }; // Sometimes a click trigger a layout change that affects the popover - // position. This is an opportunity to immediately refresh rather than - // at the interval. - - - window.addEventListener('click', refreshOnAnimationFrame); - window.addEventListener('resize', refresh); - window.addEventListener('scroll', refresh, true); - var observer; - - if (__unstableObserveElement) { - observer = new window.MutationObserver(refresh); - observer.observe(__unstableObserveElement, { - attributes: true - }); - } - - return function () { - window.clearInterval(intervalHandle); - window.removeEventListener('resize', refresh); - window.removeEventListener('scroll', refresh, true); - window.removeEventListener('click', refreshOnAnimationFrame); - window.cancelAnimationFrame(rafId); - - if (observer) { - observer.disconnect(); - } - }; - }, [isExpanded, anchorRect, getAnchorRect, anchorRef, shouldAnchorIncludePadding, position, contentSize, __unstableSticky, __unstableObserveElement, __unstableBoundaryParent]); - useFocusContentOnMount(focusOnMount, contentRef); // Event handlers - - var maybeClose = function maybeClose(event) { - // Close on escape - if (event.keyCode === keycodes_build_module["b" /* ESCAPE */] && onClose) { - event.stopPropagation(); - onClose(); - } // Preserve original content prop behavior - - - if (onKeyDown) { - onKeyDown(event); - } - }; - /** - * Shims an onFocusOutside callback to be compatible with a deprecated - * onClickOutside prop function, if provided. - * - * @param {FocusEvent} event Focus event from onFocusOutside. - */ - - - function handleOnFocusOutside(event) { - // Defer to given `onFocusOutside` if specified. Call `onClose` only if - // both `onFocusOutside` and `onClickOutside` are unspecified. Doing so - // assures backwards-compatibility for prior `onClickOutside` default. - if (onFocusOutside) { - onFocusOutside(event); - return; - } else if (!onClickOutside) { - if (onClose) { - onClose(); - } - - return; - } // Simulate MouseEvent using FocusEvent#relatedTarget as emulated click - // target. MouseEvent constructor is unsupported in Internet Explorer. - - - var clickEvent; - - try { - clickEvent = new window.MouseEvent('click'); - } catch (error) { - clickEvent = document.createEvent('MouseEvent'); - clickEvent.initMouseEvent('click', true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null); - } - - Object.defineProperty(clickEvent, 'target', { - get: function get() { - return event.relatedTarget; - } - }); - Object(deprecated_build_module["a" /* default */])('Popover onClickOutside prop', { - alternative: 'onFocusOutside' - }); - onClickOutside(clickEvent); - } // Disable reason: We care to capture the _bubbled_ events from inputs - // within popover as inferring close intent. - - - var content = Object(external_this_wp_element_["createElement"])(detect_outside, { - onFocusOutside: handleOnFocusOutside - }, Object(external_this_wp_element_["createElement"])(build_module_animate["a" /* default */], { - type: animate && animateOrigin ? 'appear' : null, - options: { - origin: animateOrigin - } - }, function (_ref3) { - var animateClassName = _ref3.className; - return Object(external_this_wp_element_["createElement"])(isolated_event_container["a" /* default */], Object(esm_extends["a" /* default */])({ - className: classnames_default()('components-popover', className, animateClassName, { - 'is-expanded': isExpanded, - 'is-without-arrow': noArrow, - 'is-alternate': isAlternate - }) - }, contentProps, { - onKeyDown: maybeClose, - ref: containerRef - }), isExpanded && Object(external_this_wp_element_["createElement"])(scroll_lock, null), isExpanded && Object(external_this_wp_element_["createElement"])("div", { - className: "components-popover__header" - }, Object(external_this_wp_element_["createElement"])("span", { - className: "components-popover__header-title" - }, headerTitle), Object(external_this_wp_element_["createElement"])(build_module_button["a" /* default */], { - className: "components-popover__close", - icon: library_close["a" /* default */], - onClick: onClose - })), Object(external_this_wp_element_["createElement"])("div", { - ref: contentRef, - className: "components-popover__content", - tabIndex: "-1" - }, Object(external_this_wp_element_["createElement"])("div", { - style: { - position: 'relative' - } - }, containerResizeListener, children))); - })); // Apply focus to element as long as focusOnMount is truthy; false is - // the only "disabled" value. - - if (focusOnMount) { - content = Object(external_this_wp_element_["createElement"])(FocusManaged, null, content); - } - - if (slot.ref) { - content = Object(external_this_wp_element_["createElement"])(slot_fill["a" /* Fill */], { - name: __unstableSlotName - }, content); - } - - if (anchorRef || anchorRect) { - return content; - } + var _useState = Object(external_this_wp_element_["useState"])(false), + _useState2 = slicedToArray_default()(_useState, 2), + modalShown = _useState2[0], + setModalShown = _useState2[1]; - return Object(external_this_wp_element_["createElement"])("span", { - ref: anchorRefFallback - }, content); -}; + if (resolving) { + return null; + } // Don't show if tracking is disallowed. -var PopoverContainer = popover_Popover; -PopoverContainer.Slot = function (_ref4) { - var _ref4$name = _ref4.name, - name = _ref4$name === void 0 ? SLOT_NAME : _ref4$name; - return Object(external_this_wp_element_["createElement"])(slot_fill["b" /* Slot */], { - bubblesVirtually: true, - name: name, - className: "popover-slot" - }); -}; - -/* harmony default export */ var popover = __webpack_exports__["a"] = (PopoverContainer); -//# sourceMappingURL=index.js.map - -/***/ }), -/* 118 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return STORE_KEY; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return API_NAMESPACE; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return QUEUE_OPTION_NAME; }); -var STORE_KEY = 'wc/customer-effort-score'; -var API_NAMESPACE = '/wc-admin'; -var QUEUE_OPTION_NAME = 'woocommerce_ces_tracks_queue'; - -/***/ }), -/* 119 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * Copyright (c) 2014-present, Facebook, Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -var runtime = (function (exports) { - "use strict"; - - var Op = Object.prototype; - var hasOwn = Op.hasOwnProperty; - var undefined; // More compressible than void 0. - var $Symbol = typeof Symbol === "function" ? Symbol : {}; - var iteratorSymbol = $Symbol.iterator || "@@iterator"; - var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator"; - var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; - - function define(obj, key, value) { - Object.defineProperty(obj, key, { - value: value, - enumerable: true, - configurable: true, - writable: true - }); - return obj[key]; - } - try { - // IE 8 has a broken Object.defineProperty that only works on DOM objects. - define({}, ""); - } catch (err) { - define = function(obj, key, value) { - return obj[key] = value; - }; - } - - function wrap(innerFn, outerFn, self, tryLocsList) { - // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator. - var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator; - var generator = Object.create(protoGenerator.prototype); - var context = new Context(tryLocsList || []); - - // The ._invoke method unifies the implementations of the .next, - // .throw, and .return methods. - generator._invoke = makeInvokeMethod(innerFn, self, context); - - return generator; - } - exports.wrap = wrap; - - // Try/catch helper to minimize deoptimizations. Returns a completion - // record like context.tryEntries[i].completion. This interface could - // have been (and was previously) designed to take a closure to be - // invoked without arguments, but in all the cases we care about we - // already have an existing method we want to call, so there's no need - // to create a new function object. We can even get away with assuming - // the method takes exactly one argument, since that happens to be true - // in every case, so we don't have to touch the arguments object. The - // only additional allocation required is the completion record, which - // has a stable shape and so hopefully should be cheap to allocate. - function tryCatch(fn, obj, arg) { - try { - return { type: "normal", arg: fn.call(obj, arg) }; - } catch (err) { - return { type: "throw", arg: err }; - } - } - - var GenStateSuspendedStart = "suspendedStart"; - var GenStateSuspendedYield = "suspendedYield"; - var GenStateExecuting = "executing"; - var GenStateCompleted = "completed"; - - // Returning this object from the innerFn has the same effect as - // breaking out of the dispatch switch statement. - var ContinueSentinel = {}; - - // Dummy constructor functions that we use as the .constructor and - // .constructor.prototype properties for functions that return Generator - // objects. For full spec compliance, you may wish to configure your - // minifier not to mangle the names of these two functions. - function Generator() {} - function GeneratorFunction() {} - function GeneratorFunctionPrototype() {} - - // This is a polyfill for %IteratorPrototype% for environments that - // don't natively support it. - var IteratorPrototype = {}; - IteratorPrototype[iteratorSymbol] = function () { - return this; - }; - - var getProto = Object.getPrototypeOf; - var NativeIteratorPrototype = getProto && getProto(getProto(values([]))); - if (NativeIteratorPrototype && - NativeIteratorPrototype !== Op && - hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) { - // This environment has a native %IteratorPrototype%; use it instead - // of the polyfill. - IteratorPrototype = NativeIteratorPrototype; - } - - var Gp = GeneratorFunctionPrototype.prototype = - Generator.prototype = Object.create(IteratorPrototype); - GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype; - GeneratorFunctionPrototype.constructor = GeneratorFunction; - GeneratorFunction.displayName = define( - GeneratorFunctionPrototype, - toStringTagSymbol, - "GeneratorFunction" - ); - - // Helper for defining the .next, .throw, and .return methods of the - // Iterator interface in terms of a single ._invoke method. - function defineIteratorMethods(prototype) { - ["next", "throw", "return"].forEach(function(method) { - define(prototype, method, function(arg) { - return this._invoke(method, arg); - }); - }); - } - - exports.isGeneratorFunction = function(genFun) { - var ctor = typeof genFun === "function" && genFun.constructor; - return ctor - ? ctor === GeneratorFunction || - // For the native GeneratorFunction constructor, the best we can - // do is to check its .name property. - (ctor.displayName || ctor.name) === "GeneratorFunction" - : false; - }; - - exports.mark = function(genFun) { - if (Object.setPrototypeOf) { - Object.setPrototypeOf(genFun, GeneratorFunctionPrototype); - } else { - genFun.__proto__ = GeneratorFunctionPrototype; - define(genFun, toStringTagSymbol, "GeneratorFunction"); - } - genFun.prototype = Object.create(Gp); - return genFun; - }; - - // Within the body of any async function, `await x` is transformed to - // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test - // `hasOwn.call(value, "__await")` to determine if the yielded value is - // meant to be awaited. - exports.awrap = function(arg) { - return { __await: arg }; - }; - - function AsyncIterator(generator, PromiseImpl) { - function invoke(method, arg, resolve, reject) { - var record = tryCatch(generator[method], generator, arg); - if (record.type === "throw") { - reject(record.arg); - } else { - var result = record.arg; - var value = result.value; - if (value && - typeof value === "object" && - hasOwn.call(value, "__await")) { - return PromiseImpl.resolve(value.__await).then(function(value) { - invoke("next", value, resolve, reject); - }, function(err) { - invoke("throw", err, resolve, reject); - }); - } - - return PromiseImpl.resolve(value).then(function(unwrapped) { - // When a yielded Promise is resolved, its final value becomes - // the .value of the Promise<{value,done}> result for the - // current iteration. - result.value = unwrapped; - resolve(result); - }, function(error) { - // If a rejected Promise was yielded, throw the rejection back - // into the async generator function so it can be handled there. - return invoke("throw", error, resolve, reject); - }); - } - } - - var previousPromise; - - function enqueue(method, arg) { - function callInvokeWithMethodAndArg() { - return new PromiseImpl(function(resolve, reject) { - invoke(method, arg, resolve, reject); - }); - } - - return previousPromise = - // If enqueue has been called before, then we want to wait until - // all previous Promises have been resolved before calling invoke, - // so that results are always delivered in the correct order. If - // enqueue has not been called before, then it is important to - // call invoke immediately, without waiting on a callback to fire, - // so that the async generator function has the opportunity to do - // any necessary setup in a predictable way. This predictability - // is why the Promise constructor synchronously invokes its - // executor callback, and why async functions synchronously - // execute code before the first await. Since we implement simple - // async functions in terms of async generators, it is especially - // important to get this right, even though it requires care. - previousPromise ? previousPromise.then( - callInvokeWithMethodAndArg, - // Avoid propagating failures to Promises returned by later - // invocations of the iterator. - callInvokeWithMethodAndArg - ) : callInvokeWithMethodAndArg(); - } - - // Define the unified helper method that is used to implement .next, - // .throw, and .return (see defineIteratorMethods). - this._invoke = enqueue; - } - - defineIteratorMethods(AsyncIterator.prototype); - AsyncIterator.prototype[asyncIteratorSymbol] = function () { - return this; - }; - exports.AsyncIterator = AsyncIterator; - - // Note that simple async functions are implemented on top of - // AsyncIterator objects; they just return a Promise for the value of - // the final result produced by the iterator. - exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) { - if (PromiseImpl === void 0) PromiseImpl = Promise; - - var iter = new AsyncIterator( - wrap(innerFn, outerFn, self, tryLocsList), - PromiseImpl - ); - - return exports.isGeneratorFunction(outerFn) - ? iter // If outerFn is a generator, return the full iterator. - : iter.next().then(function(result) { - return result.done ? result.value : iter.next(); - }); - }; - - function makeInvokeMethod(innerFn, self, context) { - var state = GenStateSuspendedStart; - - return function invoke(method, arg) { - if (state === GenStateExecuting) { - throw new Error("Generator is already running"); - } - - if (state === GenStateCompleted) { - if (method === "throw") { - throw arg; - } - - // Be forgiving, per 25.3.3.3.3 of the spec: - // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume - return doneResult(); - } - - context.method = method; - context.arg = arg; - - while (true) { - var delegate = context.delegate; - if (delegate) { - var delegateResult = maybeInvokeDelegate(delegate, context); - if (delegateResult) { - if (delegateResult === ContinueSentinel) continue; - return delegateResult; - } - } - - if (context.method === "next") { - // Setting context._sent for legacy support of Babel's - // function.sent implementation. - context.sent = context._sent = context.arg; - - } else if (context.method === "throw") { - if (state === GenStateSuspendedStart) { - state = GenStateCompleted; - throw context.arg; - } - - context.dispatchException(context.arg); - - } else if (context.method === "return") { - context.abrupt("return", context.arg); - } - - state = GenStateExecuting; - - var record = tryCatch(innerFn, self, context); - if (record.type === "normal") { - // If an exception is thrown from innerFn, we leave state === - // GenStateExecuting and loop back for another invocation. - state = context.done - ? GenStateCompleted - : GenStateSuspendedYield; - - if (record.arg === ContinueSentinel) { - continue; - } - - return { - value: record.arg, - done: context.done - }; - - } else if (record.type === "throw") { - state = GenStateCompleted; - // Dispatch the exception by looping back around to the - // context.dispatchException(context.arg) call above. - context.method = "throw"; - context.arg = record.arg; - } - } - }; - } - - // Call delegate.iterator[context.method](context.arg) and handle the - // result, either by returning a { value, done } result from the - // delegate iterator, or by modifying context.method and context.arg, - // setting context.delegate to null, and returning the ContinueSentinel. - function maybeInvokeDelegate(delegate, context) { - var method = delegate.iterator[context.method]; - if (method === undefined) { - // A .throw or .return when the delegate iterator has no .throw - // method always terminates the yield* loop. - context.delegate = null; - - if (context.method === "throw") { - // Note: ["return"] must be used for ES3 parsing compatibility. - if (delegate.iterator["return"]) { - // If the delegate iterator has a return method, give it a - // chance to clean up. - context.method = "return"; - context.arg = undefined; - maybeInvokeDelegate(delegate, context); - - if (context.method === "throw") { - // If maybeInvokeDelegate(context) changed context.method from - // "return" to "throw", let that override the TypeError below. - return ContinueSentinel; - } - } - - context.method = "throw"; - context.arg = new TypeError( - "The iterator does not provide a 'throw' method"); - } - - return ContinueSentinel; - } - - var record = tryCatch(method, delegate.iterator, context.arg); - - if (record.type === "throw") { - context.method = "throw"; - context.arg = record.arg; - context.delegate = null; - return ContinueSentinel; - } - - var info = record.arg; - - if (! info) { - context.method = "throw"; - context.arg = new TypeError("iterator result is not an object"); - context.delegate = null; - return ContinueSentinel; - } - - if (info.done) { - // Assign the result of the finished delegate to the temporary - // variable specified by delegate.resultName (see delegateYield). - context[delegate.resultName] = info.value; - - // Resume execution at the desired location (see delegateYield). - context.next = delegate.nextLoc; - - // If context.method was "throw" but the delegate handled the - // exception, let the outer generator proceed normally. If - // context.method was "next", forget context.arg since it has been - // "consumed" by the delegate iterator. If context.method was - // "return", allow the original .return call to continue in the - // outer generator. - if (context.method !== "return") { - context.method = "next"; - context.arg = undefined; - } - - } else { - // Re-yield the result returned by the delegate method. - return info; - } - - // The delegate iterator is finished, so forget it and continue with - // the outer generator. - context.delegate = null; - return ContinueSentinel; - } - - // Define Generator.prototype.{next,throw,return} in terms of the - // unified ._invoke helper method. - defineIteratorMethods(Gp); - - define(Gp, toStringTagSymbol, "Generator"); - - // A Generator should always return itself as the iterator object when the - // @@iterator function is called on it. Some browsers' implementations of the - // iterator prototype chain incorrectly implement this, causing the Generator - // object to not be returned from this call. This ensures that doesn't happen. - // See https://github.com/facebook/regenerator/issues/274 for more details. - Gp[iteratorSymbol] = function() { - return this; - }; - - Gp.toString = function() { - return "[object Generator]"; - }; - - function pushTryEntry(locs) { - var entry = { tryLoc: locs[0] }; - - if (1 in locs) { - entry.catchLoc = locs[1]; - } - - if (2 in locs) { - entry.finallyLoc = locs[2]; - entry.afterLoc = locs[3]; - } - - this.tryEntries.push(entry); - } - - function resetTryEntry(entry) { - var record = entry.completion || {}; - record.type = "normal"; - delete record.arg; - entry.completion = record; - } - - function Context(tryLocsList) { - // The root entry object (effectively a try statement without a catch - // or a finally block) gives us a place to store values thrown from - // locations where there is no enclosing try statement. - this.tryEntries = [{ tryLoc: "root" }]; - tryLocsList.forEach(pushTryEntry, this); - this.reset(true); - } - - exports.keys = function(object) { - var keys = []; - for (var key in object) { - keys.push(key); - } - keys.reverse(); - - // Rather than returning an object with a next method, we keep - // things simple and return the next function itself. - return function next() { - while (keys.length) { - var key = keys.pop(); - if (key in object) { - next.value = key; - next.done = false; - return next; - } - } - - // To avoid creating an additional object, we just hang the .value - // and .done properties off the next function object itself. This - // also ensures that the minifier will not anonymize the function. - next.done = true; - return next; - }; - }; - - function values(iterable) { - if (iterable) { - var iteratorMethod = iterable[iteratorSymbol]; - if (iteratorMethod) { - return iteratorMethod.call(iterable); - } - - if (typeof iterable.next === "function") { - return iterable; - } - - if (!isNaN(iterable.length)) { - var i = -1, next = function next() { - while (++i < iterable.length) { - if (hasOwn.call(iterable, i)) { - next.value = iterable[i]; - next.done = false; - return next; - } - } - - next.value = undefined; - next.done = true; - - return next; - }; - - return next.next = next; - } - } - - // Return an iterator with no values. - return { next: doneResult }; - } - exports.values = values; - - function doneResult() { - return { value: undefined, done: true }; - } - - Context.prototype = { - constructor: Context, - - reset: function(skipTempReset) { - this.prev = 0; - this.next = 0; - // Resetting context._sent for legacy support of Babel's - // function.sent implementation. - this.sent = this._sent = undefined; - this.done = false; - this.delegate = null; - - this.method = "next"; - this.arg = undefined; - - this.tryEntries.forEach(resetTryEntry); - - if (!skipTempReset) { - for (var name in this) { - // Not sure about the optimal order of these conditions: - if (name.charAt(0) === "t" && - hasOwn.call(this, name) && - !isNaN(+name.slice(1))) { - this[name] = undefined; - } - } - } - }, - - stop: function() { - this.done = true; - - var rootEntry = this.tryEntries[0]; - var rootRecord = rootEntry.completion; - if (rootRecord.type === "throw") { - throw rootRecord.arg; - } - - return this.rval; - }, - - dispatchException: function(exception) { - if (this.done) { - throw exception; - } - - var context = this; - function handle(loc, caught) { - record.type = "throw"; - record.arg = exception; - context.next = loc; - - if (caught) { - // If the dispatched exception was caught by a catch block, - // then let that catch block handle the exception normally. - context.method = "next"; - context.arg = undefined; - } - - return !! caught; - } - - for (var i = this.tryEntries.length - 1; i >= 0; --i) { - var entry = this.tryEntries[i]; - var record = entry.completion; - - if (entry.tryLoc === "root") { - // Exception thrown outside of any try block that could handle - // it, so set the completion value of the entire function to - // throw the exception. - return handle("end"); - } - - if (entry.tryLoc <= this.prev) { - var hasCatch = hasOwn.call(entry, "catchLoc"); - var hasFinally = hasOwn.call(entry, "finallyLoc"); - - if (hasCatch && hasFinally) { - if (this.prev < entry.catchLoc) { - return handle(entry.catchLoc, true); - } else if (this.prev < entry.finallyLoc) { - return handle(entry.finallyLoc); - } - - } else if (hasCatch) { - if (this.prev < entry.catchLoc) { - return handle(entry.catchLoc, true); - } - - } else if (hasFinally) { - if (this.prev < entry.finallyLoc) { - return handle(entry.finallyLoc); - } - - } else { - throw new Error("try statement without catch or finally"); - } - } - } - }, - - abrupt: function(type, arg) { - for (var i = this.tryEntries.length - 1; i >= 0; --i) { - var entry = this.tryEntries[i]; - if (entry.tryLoc <= this.prev && - hasOwn.call(entry, "finallyLoc") && - this.prev < entry.finallyLoc) { - var finallyEntry = entry; - break; - } - } - - if (finallyEntry && - (type === "break" || - type === "continue") && - finallyEntry.tryLoc <= arg && - arg <= finallyEntry.finallyLoc) { - // Ignore the finally entry if control is not jumping to a - // location outside the try/catch block. - finallyEntry = null; - } - - var record = finallyEntry ? finallyEntry.completion : {}; - record.type = type; - record.arg = arg; - - if (finallyEntry) { - this.method = "next"; - this.next = finallyEntry.finallyLoc; - return ContinueSentinel; - } - - return this.complete(record); - }, - - complete: function(record, afterLoc) { - if (record.type === "throw") { - throw record.arg; - } - - if (record.type === "break" || - record.type === "continue") { - this.next = record.arg; - } else if (record.type === "return") { - this.rval = this.arg = record.arg; - this.method = "return"; - this.next = "end"; - } else if (record.type === "normal" && afterLoc) { - this.next = afterLoc; - } - - return ContinueSentinel; - }, - - finish: function(finallyLoc) { - for (var i = this.tryEntries.length - 1; i >= 0; --i) { - var entry = this.tryEntries[i]; - if (entry.finallyLoc === finallyLoc) { - this.complete(entry.completion, entry.afterLoc); - resetTryEntry(entry); - return ContinueSentinel; - } - } - }, - - "catch": function(tryLoc) { - for (var i = this.tryEntries.length - 1; i >= 0; --i) { - var entry = this.tryEntries[i]; - if (entry.tryLoc === tryLoc) { - var record = entry.completion; - if (record.type === "throw") { - var thrown = record.arg; - resetTryEntry(entry); - } - return thrown; - } - } - - // The context.catch method must only be called with a location - // argument that corresponds to a known catch block. - throw new Error("illegal catch attempt"); - }, - - delegateYield: function(iterable, resultName, nextLoc) { - this.delegate = { - iterator: values(iterable), - resultName: resultName, - nextLoc: nextLoc - }; - - if (this.method === "next") { - // Deliberately forget the last sent value so that we don't - // accidentally pass it on to the delegate. - this.arg = undefined; - } - - return ContinueSentinel; - } - }; - - // Regardless of whether this script is executing as a CommonJS module - // or not, return the runtime object so that we can declare the variable - // regeneratorRuntime in the outer scope, which allows this module to be - // injected easily by `bin/regenerator --include-runtime script.js`. - return exports; - -}( - // If this script is executing as a CommonJS module, use module.exports - // as the regeneratorRuntime namespace. Otherwise create a new empty - // object. Either way, the resulting object will be used to initialize - // the regeneratorRuntime variable at the top of this file. - true ? module.exports : undefined -)); - -try { - regeneratorRuntime = runtime; -} catch (accidentalStrictMode) { - // This module should not be running in strict mode, so the above - // assignment should always work unless something is misconfigured. Just - // in case runtime.js accidentally runs in strict mode, we can escape - // strict mode using a global Function call. This could conceivably fail - // if a Content Security Policy forbids using Function, but in that case - // the proper solution is to fix the accidental strict mode problem. If - // you've misconfigured your bundler to force strict mode and applied a - // CSP to forbid Function, and you're not willing to fix either of those - // problems, please detail your unique predicament in a GitHub issue. - Function("r", "regeneratorRuntime = r")(runtime); -} - - -/***/ }), -/* 120 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * Copyright (c) 2013-present, Facebook, Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - - - -var ReactPropTypesSecret = __webpack_require__(121); - -function emptyFunction() {} -function emptyFunctionWithReset() {} -emptyFunctionWithReset.resetWarningCache = emptyFunction; - -module.exports = function() { - function shim(props, propName, componentName, location, propFullName, secret) { - if (secret === ReactPropTypesSecret) { - // It is still safe when called from React. - return; - } - var err = new Error( - 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' + - 'Use PropTypes.checkPropTypes() to call them. ' + - 'Read more at http://fb.me/use-check-prop-types' - ); - err.name = 'Invariant Violation'; - throw err; - }; - shim.isRequired = shim; - function getShim() { - return shim; - }; - // Important! - // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`. - var ReactPropTypes = { - array: shim, - bool: shim, - func: shim, - number: shim, - object: shim, - string: shim, - symbol: shim, - - any: shim, - arrayOf: getShim, - element: shim, - elementType: shim, - instanceOf: getShim, - node: shim, - objectOf: getShim, - oneOf: getShim, - oneOfType: getShim, - shape: getShim, - exact: getShim, - - checkPropTypes: emptyFunctionWithReset, - resetWarningCache: emptyFunction - }; - - ReactPropTypes.PropTypes = ReactPropTypes; - - return ReactPropTypes; -}; - - -/***/ }), -/* 121 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/** - * Copyright (c) 2013-present, Facebook, Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - - - -var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'; - -module.exports = ReactPropTypesSecret; - - -/***/ }), -/* 122 */, -/* 123 */, -/* 124 */, -/* 125 */, -/* 126 */, -/* 127 */ -/***/ (function(module, exports) { - -var g; - -// This works in non-strict mode -g = (function() { - return this; -})(); - -try { - // This works if eval is allowed (see CSP) - g = g || new Function("return this")(); -} catch (e) { - // This works if the window reference is available - if (typeof window === "object") g = window; -} - -// g can still be undefined, but nothing to do about it... -// We return undefined, instead of nothing here, so it's -// easier to handle this case. if(!global) { ...} - -module.exports = g; - - -/***/ }), -/* 128 */, -/* 129 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* unused harmony export isHorizontalEdge */ -/* unused harmony export isVerticalEdge */ -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return getRectangleFromRange; }); -/* unused harmony export computeCaretRect */ -/* unused harmony export placeCaretAtHorizontalEdge */ -/* unused harmony export placeCaretAtVerticalEdge */ -/* unused harmony export isTextField */ -/* unused harmony export isNumberInput */ -/* unused harmony export documentHasTextSelection */ -/* unused harmony export documentHasUncollapsedSelection */ -/* unused harmony export documentHasSelection */ -/* unused harmony export isEntirelySelected */ -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return getScrollContainer; }); -/* unused harmony export getOffsetParent */ -/* unused harmony export replace */ -/* unused harmony export remove */ -/* unused harmony export insertAfter */ -/* unused harmony export unwrap */ -/* unused harmony export replaceTag */ -/* unused harmony export wrap */ -/* unused harmony export __unstableStripHTML */ -/* unused harmony export isEmpty */ -/* unused harmony export removeInvalidHTML */ -/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2); -/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _phrasing_content__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(70); -/** - * External dependencies - */ - -/** - * Internal dependencies - */ - - - -function getComputedStyle(node) { - return node.ownerDocument.defaultView.getComputedStyle(node); -} -/** - * Returns true if the given selection object is in the forward direction, or - * false otherwise. - * - * @see https://developer.mozilla.org/en-US/docs/Web/API/Node/compareDocumentPosition - * - * @param {Selection} selection Selection object to check. - * - * @return {boolean} Whether the selection is forward. - */ - - -function isSelectionForward(selection) { - var anchorNode = selection.anchorNode, - focusNode = selection.focusNode, - anchorOffset = selection.anchorOffset, - focusOffset = selection.focusOffset; - var position = anchorNode.compareDocumentPosition(focusNode); // Disable reason: `Node#compareDocumentPosition` returns a bitmask value, - // so bitwise operators are intended. - - /* eslint-disable no-bitwise */ - // Compare whether anchor node precedes focus node. If focus node (where - // end of selection occurs) is after the anchor node, it is forward. - - if (position & anchorNode.DOCUMENT_POSITION_PRECEDING) { - return false; - } - - if (position & anchorNode.DOCUMENT_POSITION_FOLLOWING) { - return true; - } - /* eslint-enable no-bitwise */ - // `compareDocumentPosition` returns 0 when passed the same node, in which - // case compare offsets. - - - if (position === 0) { - return anchorOffset <= focusOffset; - } // This should never be reached, but return true as default case. - - - return true; -} -/** - * Check whether the selection is at the edge of the container. Checks for - * horizontal position by default. Set `onlyVertical` to true to check only - * vertically. - * - * @param {Element} container Focusable element. - * @param {boolean} isReverse Set to true to check left, false to check right. - * @param {boolean} onlyVertical Set to true to check only vertical position. - * - * @return {boolean} True if at the edge, false if not. - */ - - -function isEdge(container, isReverse, onlyVertical) { - if (Object(lodash__WEBPACK_IMPORTED_MODULE_0__["includes"])(['INPUT', 'TEXTAREA'], container.tagName)) { - if (container.selectionStart !== container.selectionEnd) { - return false; - } - - if (isReverse) { - return container.selectionStart === 0; - } - - return container.value.length === container.selectionStart; - } - - if (!container.isContentEditable) { - return true; - } - - var ownerDocument = container.ownerDocument; - var defaultView = ownerDocument.defaultView; - var selection = defaultView.getSelection(); - - if (!selection.rangeCount) { - return false; - } - - var originalRange = selection.getRangeAt(0); - var range = originalRange.cloneRange(); - var isForward = isSelectionForward(selection); - var isCollapsed = selection.isCollapsed; // Collapse in direction of selection. - - if (!isCollapsed) { - range.collapse(!isForward); - } - - var rangeRect = getRectangleFromRange(range); - - if (!rangeRect) { - return false; - } - - var computedStyle = getComputedStyle(container); - var lineHeight = parseInt(computedStyle.lineHeight, 10) || 0; // Only consider the multiline selection at the edge if the direction is - // towards the edge. - - if (!isCollapsed && rangeRect.height > lineHeight && isForward === isReverse) { - return false; - } - - var padding = parseInt(computedStyle["padding".concat(isReverse ? 'Top' : 'Bottom')], 10) || 0; // Calculate a buffer that is half the line height. In some browsers, the - // selection rectangle may not fill the entire height of the line, so we add - // 3/4 the line height to the selection rectangle to ensure that it is well - // over its line boundary. - - var buffer = 3 * parseInt(lineHeight, 10) / 4; - var containerRect = container.getBoundingClientRect(); - var originalRangeRect = getRectangleFromRange(originalRange); - var verticalEdge = isReverse ? containerRect.top + padding > originalRangeRect.top - buffer : containerRect.bottom - padding < originalRangeRect.bottom + buffer; - - if (!verticalEdge) { - return false; - } - - if (onlyVertical) { - return true; - } // In the case of RTL scripts, the horizontal edge is at the opposite side. - - - var direction = computedStyle.direction; - var isReverseDir = direction === 'rtl' ? !isReverse : isReverse; // To calculate the horizontal position, we insert a test range and see if - // this test range has the same horizontal position. This method proves to - // be better than a DOM-based calculation, because it ignores empty text - // nodes and a trailing line break element. In other words, we need to check - // visual positioning, not DOM positioning. - - var x = isReverseDir ? containerRect.left + 1 : containerRect.right - 1; - var y = isReverse ? containerRect.top + buffer : containerRect.bottom - buffer; - var testRange = hiddenCaretRangeFromPoint(ownerDocument, x, y, container); - - if (!testRange) { - return false; - } - - var side = isReverseDir ? 'left' : 'right'; - var testRect = getRectangleFromRange(testRange); // Allow the position to be 1px off. - - return Math.abs(testRect[side] - rangeRect[side]) <= 1; -} -/** - * Check whether the selection is horizontally at the edge of the container. - * - * @param {Element} container Focusable element. - * @param {boolean} isReverse Set to true to check left, false for right. - * - * @return {boolean} True if at the horizontal edge, false if not. - */ - - -function isHorizontalEdge(container, isReverse) { - return isEdge(container, isReverse); -} -/** - * Check whether the selection is vertically at the edge of the container. - * - * @param {Element} container Focusable element. - * @param {boolean} isReverse Set to true to check top, false for bottom. - * - * @return {boolean} True if at the vertical edge, false if not. - */ - -function isVerticalEdge(container, isReverse) { - return isEdge(container, isReverse, true); -} -/** - * Get the rectangle of a given Range. - * - * @param {Range} range The range. - * - * @return {DOMRect} The rectangle. - */ - -function getRectangleFromRange(range) { - // For uncollapsed ranges, get the rectangle that bounds the contents of the - // range; this a rectangle enclosing the union of the bounding rectangles - // for all the elements in the range. - if (!range.collapsed) { - return range.getBoundingClientRect(); - } - - var _range = range, - startContainer = _range.startContainer; - var ownerDocument = startContainer.ownerDocument; // Correct invalid "BR" ranges. The cannot contain any children. - - if (startContainer.nodeName === 'BR') { - var parentNode = startContainer.parentNode; - var index = Array.from(parentNode.childNodes).indexOf(startContainer); - range = ownerDocument.createRange(); - range.setStart(parentNode, index); - range.setEnd(parentNode, index); - } - - var rect = range.getClientRects()[0]; // If the collapsed range starts (and therefore ends) at an element node, - // `getClientRects` can be empty in some browsers. This can be resolved - // by adding a temporary text node with zero-width space to the range. - // - // See: https://stackoverflow.com/a/6847328/995445 - - if (!rect) { - var padNode = ownerDocument.createTextNode("\u200B"); // Do not modify the live range. - - range = range.cloneRange(); - range.insertNode(padNode); - rect = range.getClientRects()[0]; - padNode.parentNode.removeChild(padNode); - } - - return rect; -} -/** - * Get the rectangle for the selection in a container. - * - * @param {Window} win The window of the selection. - * - * @return {?DOMRect} The rectangle. - */ - -function computeCaretRect(win) { - var selection = win.getSelection(); - var range = selection.rangeCount ? selection.getRangeAt(0) : null; - - if (!range) { - return; - } - - return getRectangleFromRange(range); -} -/** - * Places the caret at start or end of a given element. - * - * @param {Element} container Focusable element. - * @param {boolean} isReverse True for end, false for start. - */ - -function placeCaretAtHorizontalEdge(container, isReverse) { - if (!container) { - return; - } - - if (Object(lodash__WEBPACK_IMPORTED_MODULE_0__["includes"])(['INPUT', 'TEXTAREA'], container.tagName)) { - container.focus(); - - if (isReverse) { - container.selectionStart = container.value.length; - container.selectionEnd = container.value.length; - } else { - container.selectionStart = 0; - container.selectionEnd = 0; - } - - return; - } - - container.focus(); - - if (!container.isContentEditable) { - return; - } // Select on extent child of the container, not the container itself. This - // avoids the selection always being `endOffset` of 1 when placed at end, - // where `startContainer`, `endContainer` would always be container itself. - - - var rangeTarget = container[isReverse ? 'lastChild' : 'firstChild']; // If no range target, it implies that the container is empty. Focusing is - // sufficient for caret to be placed correctly. - - if (!rangeTarget) { - return; - } - - var ownerDocument = container.ownerDocument; - var defaultView = ownerDocument.defaultView; - var selection = defaultView.getSelection(); - var range = ownerDocument.createRange(); - range.selectNodeContents(rangeTarget); - range.collapse(!isReverse); - selection.removeAllRanges(); - selection.addRange(range); -} -/** - * Polyfill. - * Get a collapsed range for a given point. - * - * @see https://developer.mozilla.org/en-US/docs/Web/API/Document/caretRangeFromPoint - * - * @param {Document} doc The document of the range. - * @param {number} x Horizontal position within the current viewport. - * @param {number} y Vertical position within the current viewport. - * - * @return {?Range} The best range for the given point. - */ - -function caretRangeFromPoint(doc, x, y) { - if (doc.caretRangeFromPoint) { - return doc.caretRangeFromPoint(x, y); - } - - if (!doc.caretPositionFromPoint) { - return null; - } - - var point = doc.caretPositionFromPoint(x, y); // If x or y are negative, outside viewport, or there is no text entry node. - // https://developer.mozilla.org/en-US/docs/Web/API/Document/caretRangeFromPoint - - if (!point) { - return null; - } - - var range = doc.createRange(); - range.setStart(point.offsetNode, point.offset); - range.collapse(true); - return range; -} -/** - * Get a collapsed range for a given point. - * Gives the container a temporary high z-index (above any UI). - * This is preferred over getting the UI nodes and set styles there. - * - * @param {Document} doc The document of the range. - * @param {number} x Horizontal position within the current viewport. - * @param {number} y Vertical position within the current viewport. - * @param {Element} container Container in which the range is expected to be found. - * - * @return {?Range} The best range for the given point. - */ - - -function hiddenCaretRangeFromPoint(doc, x, y, container) { - var originalZIndex = container.style.zIndex; - var originalPosition = container.style.position; // A z-index only works if the element position is not static. - - container.style.zIndex = '10000'; - container.style.position = 'relative'; - var range = caretRangeFromPoint(doc, x, y); - container.style.zIndex = originalZIndex; - container.style.position = originalPosition; - return range; -} -/** - * Places the caret at the top or bottom of a given element. - * - * @param {Element} container Focusable element. - * @param {boolean} isReverse True for bottom, false for top. - * @param {DOMRect} [rect] The rectangle to position the caret with. - * @param {boolean} [mayUseScroll=true] True to allow scrolling, false to disallow. - */ - - -function placeCaretAtVerticalEdge(container, isReverse, rect) { - var mayUseScroll = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true; - - if (!container) { - return; - } - - if (!rect || !container.isContentEditable) { - placeCaretAtHorizontalEdge(container, isReverse); - return; - } // Offset by a buffer half the height of the caret rect. This is needed - // because caretRangeFromPoint may default to the end of the selection if - // offset is too close to the edge. It's unclear how to precisely calculate - // this threshold; it may be the padded area of some combination of line - // height, caret height, and font size. The buffer offset is effectively - // equivalent to a point at half the height of a line of text. - - - var buffer = rect.height / 2; - var editableRect = container.getBoundingClientRect(); - var x = rect.left; - var y = isReverse ? editableRect.bottom - buffer : editableRect.top + buffer; - var ownerDocument = container.ownerDocument; - var defaultView = ownerDocument.defaultView; - var range = hiddenCaretRangeFromPoint(ownerDocument, x, y, container); - - if (!range || !container.contains(range.startContainer)) { - if (mayUseScroll && (!range || !range.startContainer || !range.startContainer.contains(container))) { - // Might be out of view. - // Easier than attempting to calculate manually. - container.scrollIntoView(isReverse); - placeCaretAtVerticalEdge(container, isReverse, rect, false); - return; - } - - placeCaretAtHorizontalEdge(container, isReverse); - return; - } - - var selection = defaultView.getSelection(); - selection.removeAllRanges(); - selection.addRange(range); - container.focus(); // Editable was already focussed, it goes back to old range... - // This fixes it. - - selection.removeAllRanges(); - selection.addRange(range); -} -/** - * Check whether the given element is a text field, where text field is defined - * by the ability to select within the input, or that it is contenteditable. - * - * See: https://html.spec.whatwg.org/#textFieldSelection - * - * @param {HTMLElement} element The HTML element. - * - * @return {boolean} True if the element is an text field, false if not. - */ - -function isTextField(element) { - var nodeName = element.nodeName, - contentEditable = element.contentEditable; - var nonTextInputs = ['button', 'checkbox', 'hidden', 'file', 'radio', 'image', 'range', 'reset', 'submit', 'number']; - return nodeName === 'INPUT' && !nonTextInputs.includes(element.type) || nodeName === 'TEXTAREA' || contentEditable === 'true'; -} -/** - * Check whether the given element is an input field of type number - * and has a valueAsNumber - * - * @param {HTMLElement} element The HTML element. - * - * @return {boolean} True if the element is input and holds a number. - */ - -function isNumberInput(element) { - var nodeName = element.nodeName, - type = element.type, - valueAsNumber = element.valueAsNumber; - return nodeName === 'INPUT' && type === 'number' && !!valueAsNumber; -} -/** - * Check whether the current document has selected text. This applies to ranges - * of text in the document, and not selection inside and