, import('./polymorphic-component').PropsFromViewOwnProps>} The connected PolymorphicComponent
*/
function contextConnect(Component, namespace, options = {}) {
/* eslint-enable jsdoc/valid-types */
const {
memo: memoProp = false
} = options;
let WrappedComponent = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__["forwardRef"])(Component);
if (memoProp) {
// @ts-ignore
WrappedComponent = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__["memo"])(WrappedComponent);
}
if (typeof namespace === 'undefined') {
typeof process !== "undefined" && process.env && "production" !== "production" ? _wordpress_warning__WEBPACK_IMPORTED_MODULE_2___default()('contextConnect: Please provide a namespace') : void 0;
} // @ts-ignore internal property
let mergedNamespace = WrappedComponent[_constants__WEBPACK_IMPORTED_MODULE_3__[/* CONNECT_STATIC_NAMESPACE */ "c"]] || [namespace];
/**
* Consolidate (merge) namespaces before attaching it to the WrappedComponent.
*/
if (Array.isArray(namespace)) {
mergedNamespace = [...mergedNamespace, ...namespace];
}
if (typeof namespace === 'string') {
mergedNamespace = [...mergedNamespace, namespace];
}
WrappedComponent.displayName = namespace; // @ts-ignore internal property
WrappedComponent[_constants__WEBPACK_IMPORTED_MODULE_3__[/* CONNECT_STATIC_NAMESPACE */ "c"]] = Object(lodash__WEBPACK_IMPORTED_MODULE_0__["uniq"])(mergedNamespace); // @ts-ignore PolymorphicComponent property
WrappedComponent.selector = `.${Object(_get_styled_class_name_from_key__WEBPACK_IMPORTED_MODULE_4__[/* getStyledClassNameFromKey */ "a"])(namespace)}`; // @ts-ignore
return WrappedComponent;
}
/**
* Attempts to retrieve the connected namespace from a component.
*
* @param {import('react').ReactChild | undefined | {}} Component The component to retrieve a namespace from.
* @return {Array} The connected namespaces.
*/
function getConnectNamespace(Component) {
if (!Component) return [];
let namespaces = []; // @ts-ignore internal property
if (Component[_constants__WEBPACK_IMPORTED_MODULE_3__[/* CONNECT_STATIC_NAMESPACE */ "c"]]) {
// @ts-ignore internal property
namespaces = Component[_constants__WEBPACK_IMPORTED_MODULE_3__[/* CONNECT_STATIC_NAMESPACE */ "c"]];
} // @ts-ignore
if (Component.type && Component.type[_constants__WEBPACK_IMPORTED_MODULE_3__[/* CONNECT_STATIC_NAMESPACE */ "c"]]) {
// @ts-ignore
namespaces = Component.type[_constants__WEBPACK_IMPORTED_MODULE_3__[/* CONNECT_STATIC_NAMESPACE */ "c"]];
}
return namespaces;
}
/**
* Checks to see if a component is connected within the Context system.
*
* @param {import('react').ReactNode} Component The component to retrieve a namespace from.
* @param {Array|string} match The namespace to check.
* @return {boolean} The result.
*/
function hasConnectNamespace(Component, match) {
if (!Component) return false;
if (typeof match === 'string') {
return getConnectNamespace(Component).includes(match);
}
if (Array.isArray(match)) {
return match.some(result => getConnectNamespace(Component).includes(result));
}
return false;
}
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__("8oxB")))
/***/ }),
/***/ "82c2":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var keys = __webpack_require__("1seS");
var hasSymbols = typeof Symbol === 'function' && typeof Symbol('foo') === 'symbol';
var toStr = Object.prototype.toString;
var concat = Array.prototype.concat;
var origDefineProperty = Object.defineProperty;
var isFunction = function (fn) {
return typeof fn === 'function' && toStr.call(fn) === '[object Function]';
};
var arePropertyDescriptorsSupported = function () {
var obj = {};
try {
origDefineProperty(obj, 'x', { enumerable: false, value: obj });
// eslint-disable-next-line no-unused-vars, no-restricted-syntax
for (var _ in obj) { // jscs:ignore disallowUnusedVariables
return false;
}
return obj.x === obj;
} catch (e) { /* this is IE 8. */
return false;
}
};
var supportsDescriptors = origDefineProperty && arePropertyDescriptorsSupported();
var defineProperty = function (object, name, value, predicate) {
if (name in object && (!isFunction(predicate) || !predicate())) {
return;
}
if (supportsDescriptors) {
origDefineProperty(object, name, {
configurable: true,
enumerable: false,
value: value,
writable: true
});
} else {
object[name] = value;
}
};
var defineProperties = function (object, map) {
var predicates = arguments.length > 2 ? arguments[2] : {};
var props = keys(map);
if (hasSymbols) {
props = concat.call(props, Object.getOwnPropertySymbols(map));
}
for (var i = 0; i < props.length; i += 1) {
defineProperty(object, props[i], map[props[i]], predicates[props[i]]);
}
};
defineProperties.supportsDescriptors = !!supportsDescriptors;
module.exports = defineProperties;
/***/ }),
/***/ "8OQS":
/***/ (function(module, exports) {
function _objectWithoutPropertiesLoose(source, excluded) {
if (source == null) return {};
var target = {};
var sourceKeys = Object.keys(source);
var key, i;
for (i = 0; i < sourceKeys.length; i++) {
key = sourceKeys[i];
if (excluded.indexOf(key) >= 0) continue;
target[key] = source[key];
}
return target;
}
module.exports = _objectWithoutPropertiesLoose;
module.exports["default"] = module.exports, module.exports.__esModule = true;
/***/ }),
/***/ "8R9v":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var define = __webpack_require__("82c2");
var getPolyfill = __webpack_require__("yLpt");
module.exports = function shimAssign() {
var polyfill = getPolyfill();
define(
Object,
{ assign: polyfill },
{ assign: function () { return Object.assign !== polyfill; } }
);
return polyfill;
};
/***/ }),
/***/ "8oxB":
/***/ (function(module, exports) {
// 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.
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;
}
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');
};
process.umask = function() { return 0; };
/***/ }),
/***/ "9Do8":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
module.exports = __webpack_require__("zt9T");
/***/ }),
/***/ "9NHk":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return withNext; });
/* harmony import */ var _babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("wx14");
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("GRId");
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__);
/**
* Internal dependencies
*/
/**
* @template {{}} TCurrentProps
* @template {{}} TNextProps
* @param {import('react').ForwardRefExoticComponent} CurrentComponent
* @param {import('react').ComponentType} NextComponent
* @param {string} namespace
* @param {(props: TCurrentProps) => TNextProps} adapter
*/
function withNext(CurrentComponent, NextComponent = () => null, namespace = 'Component', adapter = p =>
/** @type {any} */
p) {
if (false) {}
return CurrentComponent;
}
/***/ }),
/***/ "9VDH":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var _babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("wx14");
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("GRId");
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("Tqx9");
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _dashicon__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("vUUf");
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function Icon({
icon = null,
size,
...additionalProps
}) {
if ('string' === typeof icon) {
return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__["createElement"])(_dashicon__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"], Object(_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])({
icon: icon
}, additionalProps));
}
if (icon && _dashicon__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"] === icon.type) {
return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__["cloneElement"])(icon, { ...additionalProps
});
} // Icons should be 24x24 by default.
const iconSize = size || 24;
if ('function' === typeof icon) {
if (icon.prototype instanceof _wordpress_element__WEBPACK_IMPORTED_MODULE_1__["Component"]) {
return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__["createElement"])(icon, {
size: iconSize,
...additionalProps
});
}
return icon({
size: iconSize,
...additionalProps
});
}
if (icon && (icon.type === 'svg' || icon.type === _wordpress_primitives__WEBPACK_IMPORTED_MODULE_2__["SVG"])) {
const appliedProps = {
width: iconSize,
height: iconSize,
...icon.props,
...additionalProps
};
return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_2__["SVG"], appliedProps);
}
if (Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__["isValidElement"])(icon)) {
return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__["cloneElement"])(icon, {
size: iconSize,
...additionalProps
});
}
return icon;
}
/* harmony default export */ __webpack_exports__["a"] = (Icon);
/***/ }),
/***/ "9cOx":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var GetIntrinsic = __webpack_require__("rZ7t");
var $Array = GetIntrinsic('%Array%');
// eslint-disable-next-line global-require
var toStr = !$Array.isArray && __webpack_require__("EXo9")('Object.prototype.toString');
// https://ecma-international.org/ecma-262/6.0/#sec-isarray
module.exports = $Array.isArray || function IsArray(argument) {
return toStr(argument) === '[object Array]';
};
/***/ }),
/***/ "9gmn":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _react = __webpack_require__("cDcd");
var _react2 = _interopRequireDefault(_react);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var ChevronUp = function () {
function ChevronUp(props) {
return _react2['default'].createElement(
'svg',
props,
_react2['default'].createElement('path', {
d: 'M32.1 712.6l453.2-452.2c11-11 21-11 32 0l453.2 452.2c4 5 6 10 6 16 0 13-10 23-22 23-7 0-12-2-16-7L501.3 308.5 64.1 744.7c-4 5-9 7-15 7-7 0-12-2-17-7-9-11-9-21 0-32.1z'
})
);
}
return ChevronUp;
}();
ChevronUp.defaultProps = {
viewBox: '0 0 1000 1000'
};
exports['default'] = ChevronUp;
/***/ }),
/***/ "9pTB":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/* WEBPACK VAR INJECTION */(function(global) {
var define = __webpack_require__("82c2");
var isSymbol = __webpack_require__("/sVA");
var globalKey = '__ global cache key __';
/* istanbul ignore else */
// eslint-disable-next-line no-restricted-properties
if (typeof Symbol === 'function' && isSymbol(Symbol('foo')) && typeof Symbol['for'] === 'function') {
// eslint-disable-next-line no-restricted-properties
globalKey = Symbol['for'](globalKey);
}
var trueThunk = function () {
return true;
};
var ensureCache = function ensureCache() {
if (!global[globalKey]) {
var properties = {};
properties[globalKey] = {};
var predicates = {};
predicates[globalKey] = trueThunk;
define(global, properties, predicates);
}
return global[globalKey];
};
var cache = ensureCache();
var isPrimitive = function isPrimitive(val) {
return val === null || (typeof val !== 'object' && typeof val !== 'function');
};
var getPrimitiveKey = function getPrimitiveKey(val) {
if (isSymbol(val)) {
return Symbol.prototype.valueOf.call(val);
}
return typeof val + ' | ' + String(val);
};
var requirePrimitiveKey = function requirePrimitiveKey(val) {
if (!isPrimitive(val)) {
throw new TypeError('key must not be an object');
}
};
var globalCache = {
clear: function clear() {
delete global[globalKey];
cache = ensureCache();
},
'delete': function deleteKey(key) {
requirePrimitiveKey(key);
delete cache[getPrimitiveKey(key)];
return !globalCache.has(key);
},
get: function get(key) {
requirePrimitiveKey(key);
return cache[getPrimitiveKey(key)];
},
has: function has(key) {
requirePrimitiveKey(key);
return getPrimitiveKey(key) in cache;
},
set: function set(key, value) {
requirePrimitiveKey(key);
var primitiveKey = getPrimitiveKey(key);
var props = {};
props[primitiveKey] = value;
var predicates = {};
predicates[primitiveKey] = trueThunk;
define(cache, props, predicates);
return globalCache.has(key);
},
setIfMissingThenGet: function setIfMissingThenGet(key, valueThunk) {
if (globalCache.has(key)) {
return globalCache.get(key);
}
var item = valueThunk();
globalCache.set(key, item);
return item;
}
};
module.exports = globalCache;
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__("yLpj")))
/***/ }),
/***/ "9uj6":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _emotion_memoize__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("4qRI");
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
var index = Object(_emotion_memoize__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(function (prop) {
return reactPropsRegex.test(prop) || prop.charCodeAt(0) === 111
/* o */
&& prop.charCodeAt(1) === 110
/* n */
&& prop.charCodeAt(2) < 91;
}
/* Z+1 */
);
/* harmony default export */ __webpack_exports__["default"] = (index);
/***/ }),
/***/ "AClM":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
// EXPORTS
__webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ ensureFocus; });
// EXTERNAL MODULE: ./node_modules/reakit-utils/es/getActiveElement.js
var getActiveElement = __webpack_require__("Nym8");
// CONCATENATED MODULE: ./node_modules/reakit-utils/es/hasFocus.js
/**
* Checks if `element` has focus. Elements that are referenced by
* `aria-activedescendant` are also considered.
*
* @example
* import { hasFocus } from "reakit-utils";
*
* hasFocus(document.getElementById("id"));
*/
function hasFocus(element) {
var activeElement = Object(getActiveElement["a" /* getActiveElement */])(element);
if (!activeElement) return false;
if (activeElement === element) return true;
var activeDescendant = activeElement.getAttribute("aria-activedescendant");
if (!activeDescendant) return false;
return activeDescendant === element.id;
}
// CONCATENATED MODULE: ./node_modules/reakit-utils/es/ensureFocus.js
/**
* Ensures `element` will receive focus if it's not already.
*
* @example
* import { ensureFocus } from "reakit-utils";
*
* ensureFocus(document.activeElement); // does nothing
*
* const element = document.querySelector("input");
*
* ensureFocus(element); // focuses element
* ensureFocus(element, { preventScroll: true }); // focuses element preventing scroll jump
*
* function isActive(el) {
* return el.dataset.active === "true";
* }
*
* ensureFocus(document.querySelector("[data-active='true']"), { isActive }); // does nothing
*
* @returns {number} `requestAnimationFrame` call ID so it can be passed to `cancelAnimationFrame` if needed.
*/
function ensureFocus(element, _temp) {
var _ref = _temp === void 0 ? {} : _temp,
preventScroll = _ref.preventScroll,
_ref$isActive = _ref.isActive,
isActive = _ref$isActive === void 0 ? hasFocus : _ref$isActive;
if (isActive(element)) return -1;
element.focus({
preventScroll: preventScroll
});
if (isActive(element)) return -1;
return requestAnimationFrame(function () {
element.focus({
preventScroll: preventScroll
});
});
}
/***/ }),
/***/ "AM7I":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/* globals
AggregateError,
Atomics,
FinalizationRegistry,
SharedArrayBuffer,
WeakRef,
*/
var undefined;
var $SyntaxError = SyntaxError;
var $Function = Function;
var $TypeError = TypeError;
// eslint-disable-next-line consistent-return
var getEvalledConstructor = function (expressionSyntax) {
try {
// eslint-disable-next-line no-new-func
return Function('"use strict"; return (' + expressionSyntax + ').constructor;')();
} catch (e) {}
};
var $gOPD = Object.getOwnPropertyDescriptor;
if ($gOPD) {
try {
$gOPD({}, '');
} catch (e) {
$gOPD = null; // this is IE 8, which has a broken gOPD
}
}
var throwTypeError = function () {
throw new $TypeError();
};
var ThrowTypeError = $gOPD
? (function () {
try {
// eslint-disable-next-line no-unused-expressions, no-caller, no-restricted-properties
arguments.callee; // IE 8 does not throw here
return throwTypeError;
} catch (calleeThrows) {
try {
// IE 8 throws on Object.getOwnPropertyDescriptor(arguments, '')
return $gOPD(arguments, 'callee').get;
} catch (gOPDthrows) {
return throwTypeError;
}
}
}())
: throwTypeError;
var hasSymbols = __webpack_require__("UVaH")();
var getProto = Object.getPrototypeOf || function (x) { return x.__proto__; }; // eslint-disable-line no-proto
var asyncGenFunction = getEvalledConstructor('async function* () {}');
var asyncGenFunctionPrototype = asyncGenFunction ? asyncGenFunction.prototype : undefined;
var asyncGenPrototype = asyncGenFunctionPrototype ? asyncGenFunctionPrototype.prototype : undefined;
var TypedArray = typeof Uint8Array === 'undefined' ? undefined : getProto(Uint8Array);
var INTRINSICS = {
'%AggregateError%': typeof AggregateError === 'undefined' ? undefined : AggregateError,
'%Array%': Array,
'%ArrayBuffer%': typeof ArrayBuffer === 'undefined' ? undefined : ArrayBuffer,
'%ArrayIteratorPrototype%': hasSymbols ? getProto([][Symbol.iterator]()) : undefined,
'%AsyncFromSyncIteratorPrototype%': undefined,
'%AsyncFunction%': getEvalledConstructor('async function () {}'),
'%AsyncGenerator%': asyncGenFunctionPrototype,
'%AsyncGeneratorFunction%': asyncGenFunction,
'%AsyncIteratorPrototype%': asyncGenPrototype ? getProto(asyncGenPrototype) : undefined,
'%Atomics%': typeof Atomics === 'undefined' ? undefined : Atomics,
'%BigInt%': typeof BigInt === 'undefined' ? undefined : BigInt,
'%Boolean%': Boolean,
'%DataView%': typeof DataView === 'undefined' ? undefined : DataView,
'%Date%': Date,
'%decodeURI%': decodeURI,
'%decodeURIComponent%': decodeURIComponent,
'%encodeURI%': encodeURI,
'%encodeURIComponent%': encodeURIComponent,
'%Error%': Error,
'%eval%': eval, // eslint-disable-line no-eval
'%EvalError%': EvalError,
'%Float32Array%': typeof Float32Array === 'undefined' ? undefined : Float32Array,
'%Float64Array%': typeof Float64Array === 'undefined' ? undefined : Float64Array,
'%FinalizationRegistry%': typeof FinalizationRegistry === 'undefined' ? undefined : FinalizationRegistry,
'%Function%': $Function,
'%GeneratorFunction%': getEvalledConstructor('function* () {}'),
'%Int8Array%': typeof Int8Array === 'undefined' ? undefined : Int8Array,
'%Int16Array%': typeof Int16Array === 'undefined' ? undefined : Int16Array,
'%Int32Array%': typeof Int32Array === 'undefined' ? undefined : Int32Array,
'%isFinite%': isFinite,
'%isNaN%': isNaN,
'%IteratorPrototype%': hasSymbols ? getProto(getProto([][Symbol.iterator]())) : undefined,
'%JSON%': typeof JSON === 'object' ? JSON : undefined,
'%Map%': typeof Map === 'undefined' ? undefined : Map,
'%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols ? undefined : getProto(new Map()[Symbol.iterator]()),
'%Math%': Math,
'%Number%': Number,
'%Object%': Object,
'%parseFloat%': parseFloat,
'%parseInt%': parseInt,
'%Promise%': typeof Promise === 'undefined' ? undefined : Promise,
'%Proxy%': typeof Proxy === 'undefined' ? undefined : Proxy,
'%RangeError%': RangeError,
'%ReferenceError%': ReferenceError,
'%Reflect%': typeof Reflect === 'undefined' ? undefined : Reflect,
'%RegExp%': RegExp,
'%Set%': typeof Set === 'undefined' ? undefined : Set,
'%SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols ? undefined : getProto(new Set()[Symbol.iterator]()),
'%SharedArrayBuffer%': typeof SharedArrayBuffer === 'undefined' ? undefined : SharedArrayBuffer,
'%String%': String,
'%StringIteratorPrototype%': hasSymbols ? getProto(''[Symbol.iterator]()) : undefined,
'%Symbol%': hasSymbols ? Symbol : undefined,
'%SyntaxError%': $SyntaxError,
'%ThrowTypeError%': ThrowTypeError,
'%TypedArray%': TypedArray,
'%TypeError%': $TypeError,
'%Uint8Array%': typeof Uint8Array === 'undefined' ? undefined : Uint8Array,
'%Uint8ClampedArray%': typeof Uint8ClampedArray === 'undefined' ? undefined : Uint8ClampedArray,
'%Uint16Array%': typeof Uint16Array === 'undefined' ? undefined : Uint16Array,
'%Uint32Array%': typeof Uint32Array === 'undefined' ? undefined : Uint32Array,
'%URIError%': URIError,
'%WeakMap%': typeof WeakMap === 'undefined' ? undefined : WeakMap,
'%WeakRef%': typeof WeakRef === 'undefined' ? undefined : WeakRef,
'%WeakSet%': typeof WeakSet === 'undefined' ? undefined : WeakSet
};
var LEGACY_ALIASES = {
'%ArrayBufferPrototype%': ['ArrayBuffer', 'prototype'],
'%ArrayPrototype%': ['Array', 'prototype'],
'%ArrayProto_entries%': ['Array', 'prototype', 'entries'],
'%ArrayProto_forEach%': ['Array', 'prototype', 'forEach'],
'%ArrayProto_keys%': ['Array', 'prototype', 'keys'],
'%ArrayProto_values%': ['Array', 'prototype', 'values'],
'%AsyncFunctionPrototype%': ['AsyncFunction', 'prototype'],
'%AsyncGenerator%': ['AsyncGeneratorFunction', 'prototype'],
'%AsyncGeneratorPrototype%': ['AsyncGeneratorFunction', 'prototype', 'prototype'],
'%BooleanPrototype%': ['Boolean', 'prototype'],
'%DataViewPrototype%': ['DataView', 'prototype'],
'%DatePrototype%': ['Date', 'prototype'],
'%ErrorPrototype%': ['Error', 'prototype'],
'%EvalErrorPrototype%': ['EvalError', 'prototype'],
'%Float32ArrayPrototype%': ['Float32Array', 'prototype'],
'%Float64ArrayPrototype%': ['Float64Array', 'prototype'],
'%FunctionPrototype%': ['Function', 'prototype'],
'%Generator%': ['GeneratorFunction', 'prototype'],
'%GeneratorPrototype%': ['GeneratorFunction', 'prototype', 'prototype'],
'%Int8ArrayPrototype%': ['Int8Array', 'prototype'],
'%Int16ArrayPrototype%': ['Int16Array', 'prototype'],
'%Int32ArrayPrototype%': ['Int32Array', 'prototype'],
'%JSONParse%': ['JSON', 'parse'],
'%JSONStringify%': ['JSON', 'stringify'],
'%MapPrototype%': ['Map', 'prototype'],
'%NumberPrototype%': ['Number', 'prototype'],
'%ObjectPrototype%': ['Object', 'prototype'],
'%ObjProto_toString%': ['Object', 'prototype', 'toString'],
'%ObjProto_valueOf%': ['Object', 'prototype', 'valueOf'],
'%PromisePrototype%': ['Promise', 'prototype'],
'%PromiseProto_then%': ['Promise', 'prototype', 'then'],
'%Promise_all%': ['Promise', 'all'],
'%Promise_reject%': ['Promise', 'reject'],
'%Promise_resolve%': ['Promise', 'resolve'],
'%RangeErrorPrototype%': ['RangeError', 'prototype'],
'%ReferenceErrorPrototype%': ['ReferenceError', 'prototype'],
'%RegExpPrototype%': ['RegExp', 'prototype'],
'%SetPrototype%': ['Set', 'prototype'],
'%SharedArrayBufferPrototype%': ['SharedArrayBuffer', 'prototype'],
'%StringPrototype%': ['String', 'prototype'],
'%SymbolPrototype%': ['Symbol', 'prototype'],
'%SyntaxErrorPrototype%': ['SyntaxError', 'prototype'],
'%TypedArrayPrototype%': ['TypedArray', 'prototype'],
'%TypeErrorPrototype%': ['TypeError', 'prototype'],
'%Uint8ArrayPrototype%': ['Uint8Array', 'prototype'],
'%Uint8ClampedArrayPrototype%': ['Uint8ClampedArray', 'prototype'],
'%Uint16ArrayPrototype%': ['Uint16Array', 'prototype'],
'%Uint32ArrayPrototype%': ['Uint32Array', 'prototype'],
'%URIErrorPrototype%': ['URIError', 'prototype'],
'%WeakMapPrototype%': ['WeakMap', 'prototype'],
'%WeakSetPrototype%': ['WeakSet', 'prototype']
};
var bind = __webpack_require__("D3zA");
var hasOwn = __webpack_require__("oNNP");
var $concat = bind.call(Function.call, Array.prototype.concat);
var $spliceApply = bind.call(Function.apply, Array.prototype.splice);
var $replace = bind.call(Function.call, String.prototype.replace);
var $strSlice = bind.call(Function.call, String.prototype.slice);
/* adapted from https://github.com/lodash/lodash/blob/4.17.15/dist/lodash.js#L6735-L6744 */
var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g;
var reEscapeChar = /\\(\\)?/g; /** Used to match backslashes in property paths. */
var stringToPath = function stringToPath(string) {
var first = $strSlice(string, 0, 1);
var last = $strSlice(string, -1);
if (first === '%' && last !== '%') {
throw new $SyntaxError('invalid intrinsic syntax, expected closing `%`');
} else if (last === '%' && first !== '%') {
throw new $SyntaxError('invalid intrinsic syntax, expected opening `%`');
}
var result = [];
$replace(string, rePropName, function (match, number, quote, subString) {
result[result.length] = quote ? $replace(subString, reEscapeChar, '$1') : number || match;
});
return result;
};
/* end adaptation */
var getBaseIntrinsic = function getBaseIntrinsic(name, allowMissing) {
var intrinsicName = name;
var alias;
if (hasOwn(LEGACY_ALIASES, intrinsicName)) {
alias = LEGACY_ALIASES[intrinsicName];
intrinsicName = '%' + alias[0] + '%';
}
if (hasOwn(INTRINSICS, intrinsicName)) {
var value = INTRINSICS[intrinsicName];
if (typeof value === 'undefined' && !allowMissing) {
throw new $TypeError('intrinsic ' + name + ' exists, but is not available. Please file an issue!');
}
return {
alias: alias,
name: intrinsicName,
value: value
};
}
throw new $SyntaxError('intrinsic ' + name + ' does not exist!');
};
module.exports = function GetIntrinsic(name, allowMissing) {
if (typeof name !== 'string' || name.length === 0) {
throw new $TypeError('intrinsic name must be a non-empty string');
}
if (arguments.length > 1 && typeof allowMissing !== 'boolean') {
throw new $TypeError('"allowMissing" argument must be a boolean');
}
var parts = stringToPath(name);
var intrinsicBaseName = parts.length > 0 ? parts[0] : '';
var intrinsic = getBaseIntrinsic('%' + intrinsicBaseName + '%', allowMissing);
var intrinsicRealName = intrinsic.name;
var value = intrinsic.value;
var skipFurtherCaching = false;
var alias = intrinsic.alias;
if (alias) {
intrinsicBaseName = alias[0];
$spliceApply(parts, $concat([0, 1], alias));
}
for (var i = 1, isOwn = true; i < parts.length; i += 1) {
var part = parts[i];
var first = $strSlice(part, 0, 1);
var last = $strSlice(part, -1);
if (
(
(first === '"' || first === "'" || first === '`')
|| (last === '"' || last === "'" || last === '`')
)
&& first !== last
) {
throw new $SyntaxError('property names with quotes must have matching quotes');
}
if (part === 'constructor' || !isOwn) {
skipFurtherCaching = true;
}
intrinsicBaseName += '.' + part;
intrinsicRealName = '%' + intrinsicBaseName + '%';
if (hasOwn(INTRINSICS, intrinsicRealName)) {
value = INTRINSICS[intrinsicRealName];
} else if (value != null) {
if (!(part in value)) {
if (!allowMissing) {
throw new $TypeError('base intrinsic for ' + name + ' exists, but the property is not available.');
}
return void undefined;
}
if ($gOPD && (i + 1) >= parts.length) {
var desc = $gOPD(value, part);
isOwn = !!desc;
// By convention, when a data property is converted to an accessor
// property to emulate a data property that does not suffer from
// the override mistake, that accessor's getter is marked with
// an `originalValue` property. Here, when we detect this, we
// uphold the illusion by pretending to see that original data
// property, i.e., returning the value rather than the getter
// itself.
if (isOwn && 'get' in desc && !('originalValue' in desc.get)) {
value = desc.get;
} else {
value = value[part];
}
} else {
isOwn = hasOwn(value, part);
value = value[part];
}
if (isOwn && !skipFurtherCaching) {
INTRINSICS[intrinsicRealName] = value;
}
}
}
return value;
};
/***/ }),
/***/ "AP2z":
/***/ (function(module, exports, __webpack_require__) {
var Symbol = __webpack_require__("nmnc");
/** Used for built-in method references. */
var objectProto = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;
/**
* Used to resolve the
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
* of values.
*/
var nativeObjectToString = objectProto.toString;
/** Built-in value references. */
var symToStringTag = Symbol ? Symbol.toStringTag : undefined;
/**
* A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
*
* @private
* @param {*} value The value to query.
* @returns {string} Returns the raw `toStringTag`.
*/
function getRawTag(value) {
var isOwn = hasOwnProperty.call(value, symToStringTag),
tag = value[symToStringTag];
try {
value[symToStringTag] = undefined;
var unmasked = true;
} catch (e) {}
var result = nativeObjectToString.call(value);
if (unmasked) {
if (isOwn) {
value[symToStringTag] = tag;
} else {
delete value[symToStringTag];
}
}
return result;
}
module.exports = getRawTag;
/***/ }),
/***/ "AXvK":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return useIsomorphicEffect; });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("cDcd");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _canUseDOM_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("+ipW");
/**
* `React.useLayoutEffect` that fallbacks to `React.useEffect` on server side
* rendering.
*/
var useIsomorphicEffect = !_canUseDOM_js__WEBPACK_IMPORTED_MODULE_1__[/* canUseDOM */ "a"] ? react__WEBPACK_IMPORTED_MODULE_0__["useEffect"] : react__WEBPACK_IMPORTED_MODULE_0__["useLayoutEffect"];
/***/ }),
/***/ "Ae65":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports['default'] = getCalendarDaySettings;
var _getPhrase = __webpack_require__("oOcr");
var _getPhrase2 = _interopRequireDefault(_getPhrase);
var _constants = __webpack_require__("Fv1B");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function getCalendarDaySettings(day, ariaLabelFormat, daySize, modifiers, phrases) {
var chooseAvailableDate = phrases.chooseAvailableDate,
dateIsUnavailable = phrases.dateIsUnavailable,
dateIsSelected = phrases.dateIsSelected;
var daySizeStyles = {
width: daySize,
height: daySize - 1
};
var useDefaultCursor = modifiers.has('blocked-minimum-nights') || modifiers.has('blocked-calendar') || modifiers.has('blocked-out-of-range');
var selected = modifiers.has('selected') || modifiers.has('selected-start') || modifiers.has('selected-end');
var hoveredSpan = !selected && (modifiers.has('hovered-span') || modifiers.has('after-hovered-start'));
var isOutsideRange = modifiers.has('blocked-out-of-range');
var formattedDate = { date: day.format(ariaLabelFormat) };
var ariaLabel = (0, _getPhrase2['default'])(chooseAvailableDate, formattedDate);
if (modifiers.has(_constants.BLOCKED_MODIFIER)) {
ariaLabel = (0, _getPhrase2['default'])(dateIsUnavailable, formattedDate);
} else if (selected) {
ariaLabel = (0, _getPhrase2['default'])(dateIsSelected, formattedDate);
}
return {
daySizeStyles: daySizeStyles,
useDefaultCursor: useDefaultCursor,
selected: selected,
hoveredSpan: hoveredSpan,
isOutsideRange: isOutsideRange,
ariaLabel: ariaLabel
};
}
/***/ }),
/***/ "Asd8":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var fnToStr = Function.prototype.toString;
var reflectApply = typeof Reflect === 'object' && Reflect !== null && Reflect.apply;
var badArrayLike;
var isCallableMarker;
if (typeof reflectApply === 'function' && typeof Object.defineProperty === 'function') {
try {
badArrayLike = Object.defineProperty({}, 'length', {
get: function () {
throw isCallableMarker;
}
});
isCallableMarker = {};
// eslint-disable-next-line no-throw-literal
reflectApply(function () { throw 42; }, null, badArrayLike);
} catch (_) {
if (_ !== isCallableMarker) {
reflectApply = null;
}
}
} else {
reflectApply = null;
}
var constructorRegex = /^\s*class\b/;
var isES6ClassFn = function isES6ClassFunction(value) {
try {
var fnStr = fnToStr.call(value);
return constructorRegex.test(fnStr);
} catch (e) {
return false; // not a function
}
};
var tryFunctionObject = function tryFunctionToStr(value) {
try {
if (isES6ClassFn(value)) { return false; }
fnToStr.call(value);
return true;
} catch (e) {
return false;
}
};
var toStr = Object.prototype.toString;
var fnClass = '[object Function]';
var genClass = '[object GeneratorFunction]';
var hasToStringTag = typeof Symbol === 'function' && typeof Symbol.toStringTag === 'symbol';
/* globals document: false */
var documentDotAll = typeof document === 'object' && typeof document.all === 'undefined' && document.all !== undefined ? document.all : {};
module.exports = reflectApply
? function isCallable(value) {
if (value === documentDotAll) { return true; }
if (!value) { return false; }
if (typeof value !== 'function' && typeof value !== 'object') { return false; }
if (typeof value === 'function' && !value.prototype) { return true; }
try {
reflectApply(value, null, badArrayLike);
} catch (e) {
if (e !== isCallableMarker) { return false; }
}
return !isES6ClassFn(value);
}
: function isCallable(value) {
if (value === documentDotAll) { return true; }
if (!value) { return false; }
if (typeof value !== 'function' && typeof value !== 'object') { return false; }
if (typeof value === 'function' && !value.prototype) { return true; }
if (hasToStringTag) { return tryFunctionObject(value); }
if (isES6ClassFn(value)) { return false; }
var strClass = toStr.call(value);
return strClass === fnClass || strClass === genClass;
};
/***/ }),
/***/ "B9Az":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
// EXTERNAL MODULE: external ["wp","element"]
var external_wp_element_ = __webpack_require__("GRId");
// EXTERNAL MODULE: external ["wp","primitives"]
var external_wp_primitives_ = __webpack_require__("Tqx9");
// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/pencil.js
/**
* WordPress dependencies
*/
const pencil = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], {
d: "M20.1 5.1L16.9 2 6.2 12.7l-1.3 4.4 4.5-1.3L20.1 5.1zM4 20.8h8v-1.5H4v1.5z"
}));
/* harmony default export */ var library_pencil = (pencil);
// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/edit.js
/**
* Internal dependencies
*/
/* harmony default export */ var edit = __webpack_exports__["a"] = (library_pencil);
/***/ }),
/***/ "BZp5":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _objectWithoutPropertiesLoose; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return _objectSpread2; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return _createForOfIteratorHelperLoose; });
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;
}
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 _objectSpread2(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(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 _objectWithoutPropertiesLoose(source, excluded) {
if (source == null) return {};
var target = {};
var sourceKeys = Object.keys(source);
var key, i;
for (i = 0; i < sourceKeys.length; i++) {
key = sourceKeys[i];
if (excluded.indexOf(key) >= 0) continue;
target[key] = source[key];
}
return target;
}
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;
}
function _createForOfIteratorHelperLoose(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;
return function () {
if (i >= o.length) return {
done: true
};
return {
done: false,
value: o[i++]
};
};
}
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
it = o[Symbol.iterator]();
return it.next.bind(it);
}
/***/ }),
/***/ "BeK9":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
module.exports = function isPrimitive(value) {
return value === null || (typeof value !== 'function' && typeof value !== 'object');
};
/***/ }),
/***/ "Bpkj":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId");
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9");
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__);
/**
* WordPress dependencies
*/
const link = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], {
d: "M15.6 7.2H14v1.5h1.6c2 0 3.7 1.7 3.7 3.7s-1.7 3.7-3.7 3.7H14v1.5h1.6c2.8 0 5.2-2.3 5.2-5.2 0-2.9-2.3-5.2-5.2-5.2zM4.7 12.4c0-2 1.7-3.7 3.7-3.7H10V7.2H8.4c-2.9 0-5.2 2.3-5.2 5.2 0 2.9 2.3 5.2 5.2 5.2H10v-1.5H8.4c-2 0-3.7-1.7-3.7-3.7zm4.6.9h5.3v-1.5H9.3v1.5z"
}));
/* harmony default export */ __webpack_exports__["a"] = (link);
/***/ }),
/***/ "C6yU":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* WEBPACK VAR INJECTION */(function(process) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return useContextSystem; });
/* harmony import */ var emotion__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("kDDq");
/* harmony import */ var _wordpress_warning__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Z23Y");
/* harmony import */ var _wordpress_warning__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_warning__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _context_system_provider__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("6zzY");
/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("Ohaz");
/* harmony import */ var _get_styled_class_name_from_key__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("UAm0");
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/* eslint-disable jsdoc/valid-types */
/**
* @template TProps
* @typedef {TProps & { className: string; children?: import('react').ReactNode }} ConnectedProps
*/
/* eslint-enable jsdoc/valid-types */
/**
* Custom hook that derives registered props from the Context system.
* These derived props are then consolidated with incoming component props.
*
* @template {{ className?: string }} P
* @param {P} props Incoming props from the component.
* @param {string} namespace The namespace to register and to derive context props from.
* @return {ConnectedProps} The connected props.
*/
function useContextSystem(props, namespace) {
const contextSystemProps = Object(_context_system_provider__WEBPACK_IMPORTED_MODULE_2__[/* useComponentsContext */ "a"])();
if (typeof namespace === 'undefined') {
typeof process !== "undefined" && process.env && "production" !== "production" ? _wordpress_warning__WEBPACK_IMPORTED_MODULE_1___default()('useContextSystem: Please provide a namespace') : void 0;
}
const contextProps = (contextSystemProps === null || contextSystemProps === void 0 ? void 0 : contextSystemProps[namespace]) || {};
/* eslint-disable jsdoc/no-undefined-types */
/** @type {ConnectedProps
} */
// @ts-ignore We fill in the missing properties below
const finalComponentProps = { ...Object(_utils__WEBPACK_IMPORTED_MODULE_3__[/* getConnectedNamespace */ "a"])(),
...Object(_utils__WEBPACK_IMPORTED_MODULE_3__[/* getNamespace */ "b"])(namespace)
};
/* eslint-enable jsdoc/no-undefined-types */
const {
_overrides: overrideProps,
...otherContextProps
} = contextProps;
const initialMergedProps = Object.entries(otherContextProps).length ? Object.assign({}, otherContextProps, props) : props;
const classes = Object(emotion__WEBPACK_IMPORTED_MODULE_0__[/* cx */ "b"])(Object(_get_styled_class_name_from_key__WEBPACK_IMPORTED_MODULE_4__[/* getStyledClassNameFromKey */ "a"])(namespace), props.className); // Provides the ability to customize the render of the component.
const rendered = typeof initialMergedProps.renderChildren === 'function' ? initialMergedProps.renderChildren(initialMergedProps) : initialMergedProps.children;
for (const key in initialMergedProps) {
// @ts-ignore filling in missing props
finalComponentProps[key] = initialMergedProps[key];
}
for (const key in overrideProps) {
// @ts-ignore filling in missing props
finalComponentProps[key] = overrideProps[key];
}
finalComponentProps.children = rendered;
finalComponentProps.className = classes;
return finalComponentProps;
}
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__("8oxB")))
/***/ }),
/***/ "CGNl":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var has = __webpack_require__("oNNP");
var assertRecord = __webpack_require__("10Kj");
var Type = __webpack_require__("V1cy");
// https://ecma-international.org/ecma-262/6.0/#sec-isdatadescriptor
module.exports = function IsDataDescriptor(Desc) {
if (typeof Desc === 'undefined') {
return false;
}
assertRecord(Type, 'Property Descriptor', 'Desc', Desc);
if (!has(Desc, '[[Value]]') && !has(Desc, '[[Writable]]')) {
return false;
}
return true;
};
/***/ }),
/***/ "Cw+6":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId");
/* 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__("YLtl");
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_1__);
/**
* External dependencies
*/
/** @typedef {string | { display: string, ariaLabel: string }} Shortcut */
/**
* @typedef Props
* @property {Shortcut} shortcut Shortcut configuration
* @property {string} [className] Classname
*/
/**
* @param {Props} props Props
* @return {JSX.Element | null} Element
*/
function Shortcut({
shortcut,
className
}) {
if (!shortcut) {
return null;
}
let displayText;
let ariaLabel;
if (Object(lodash__WEBPACK_IMPORTED_MODULE_1__["isString"])(shortcut)) {
displayText = shortcut;
}
if (Object(lodash__WEBPACK_IMPORTED_MODULE_1__["isObject"])(shortcut)) {
displayText = shortcut.display;
ariaLabel = shortcut.ariaLabel;
}
return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])("span", {
className: className,
"aria-label": ariaLabel
}, displayText);
}
/* harmony default export */ __webpack_exports__["a"] = (Shortcut);
/***/ }),
/***/ "D3zA":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var implementation = __webpack_require__("aI7X");
module.exports = Function.prototype.bind || implementation;
/***/ }),
/***/ "DHWS":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _react = __webpack_require__("cDcd");
var _react2 = _interopRequireDefault(_react);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var ChevronDown = function () {
function ChevronDown(props) {
return _react2['default'].createElement(
'svg',
props,
_react2['default'].createElement('path', {
d: 'M967.5 288.5L514.3 740.7c-11 11-21 11-32 0L29.1 288.5c-4-5-6-11-6-16 0-13 10-23 23-23 6 0 11 2 15 7l437.2 436.2 437.2-436.2c4-5 9-7 16-7 6 0 11 2 16 7 9 10.9 9 21 0 32z'
})
);
}
return ChevronDown;
}();
ChevronDown.defaultProps = {
viewBox: '0 0 1000 1000'
};
exports['default'] = ChevronDown;
/***/ }),
/***/ "DciD":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
function noop() {
return null;
}
noop.isRequired = noop;
function noopThunk() {
return noop;
}
module.exports = {
and: noopThunk,
between: noopThunk,
booleanSome: noopThunk,
childrenHavePropXorChildren: noopThunk,
childrenOf: noopThunk,
childrenOfType: noopThunk,
childrenSequenceOf: noopThunk,
componentWithName: noopThunk,
disallowedIf: noopThunk,
elementType: noopThunk,
empty: noopThunk,
explicitNull: noopThunk,
forbidExtraProps: Object,
integer: noopThunk,
keysOf: noopThunk,
mutuallyExclusiveProps: noopThunk,
mutuallyExclusiveTrueProps: noopThunk,
nChildren: noopThunk,
nonNegativeInteger: noop,
nonNegativeNumber: noopThunk,
numericString: noopThunk,
object: noopThunk,
or: noopThunk,
predicate: noopThunk,
range: noopThunk,
ref: noopThunk,
requiredBy: noopThunk,
restrictedProp: noopThunk,
sequenceOf: noopThunk,
shape: noopThunk,
stringEndsWith: noopThunk,
stringStartsWith: noopThunk,
uniqueArray: noopThunk,
uniqueArrayOf: noopThunk,
valuesOf: noopThunk,
withShape: noopThunk
};
/***/ }),
/***/ "DmXP":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var getDay = Date.prototype.getDay;
var tryDateObject = function tryDateGetDayCall(value) {
try {
getDay.call(value);
return true;
} catch (e) {
return false;
}
};
var toStr = Object.prototype.toString;
var dateClass = '[object Date]';
var hasToStringTag = typeof Symbol === 'function' && typeof Symbol.toStringTag === 'symbol';
module.exports = function isDateObject(value) {
if (typeof value !== 'object' || value === null) {
return false;
}
return hasToStringTag ? tryDateObject(value) : toStr.call(value) === dateClass;
};
/***/ }),
/***/ "DvWQ":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var GetIntrinsic = __webpack_require__("rZ7t");
var $TypeError = GetIntrinsic('%TypeError%');
var DefineOwnProperty = __webpack_require__("wTIp");
var FromPropertyDescriptor = __webpack_require__("zYbv");
var OrdinaryGetOwnProperty = __webpack_require__("kgBv");
var IsDataDescriptor = __webpack_require__("CGNl");
var IsExtensible = __webpack_require__("rDFq");
var IsPropertyKey = __webpack_require__("i10q");
var SameValue = __webpack_require__("HI8u");
var Type = __webpack_require__("V1cy");
// https://ecma-international.org/ecma-262/6.0/#sec-createdataproperty
module.exports = function CreateDataProperty(O, P, V) {
if (Type(O) !== 'Object') {
throw new $TypeError('Assertion failed: Type(O) is not Object');
}
if (!IsPropertyKey(P)) {
throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true');
}
var oldDesc = OrdinaryGetOwnProperty(O, P);
var extensible = !oldDesc || IsExtensible(O);
var immutable = oldDesc && (!oldDesc['[[Writable]]'] || !oldDesc['[[Configurable]]']);
if (immutable || !extensible) {
return false;
}
return DefineOwnProperty(
IsDataDescriptor,
SameValue,
FromPropertyDescriptor,
O,
P,
{
'[[Configurable]]': true,
'[[Enumerable]]': true,
'[[Value]]': V,
'[[Writable]]': true
}
);
};
/***/ }),
/***/ "DzJC":
/***/ (function(module, exports, __webpack_require__) {
var debounce = __webpack_require__("sEfC"),
isObject = __webpack_require__("GoyQ");
/** Error message constants. */
var FUNC_ERROR_TEXT = 'Expected a function';
/**
* Creates a throttled function that only invokes `func` at most once per
* every `wait` milliseconds. The throttled function comes with a `cancel`
* method to cancel delayed `func` invocations and a `flush` method to
* immediately invoke them. Provide `options` to indicate whether `func`
* should be invoked on the leading and/or trailing edge of the `wait`
* timeout. The `func` is invoked with the last arguments provided to the
* throttled function. Subsequent calls to the throttled function return the
* result of the last `func` invocation.
*
* **Note:** If `leading` and `trailing` options are `true`, `func` is
* invoked on the trailing edge of the timeout only if the throttled function
* is invoked more than once during the `wait` timeout.
*
* If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
* until to the next tick, similar to `setTimeout` with a timeout of `0`.
*
* See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
* for details over the differences between `_.throttle` and `_.debounce`.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Function
* @param {Function} func The function to throttle.
* @param {number} [wait=0] The number of milliseconds to throttle invocations to.
* @param {Object} [options={}] The options object.
* @param {boolean} [options.leading=true]
* Specify invoking on the leading edge of the timeout.
* @param {boolean} [options.trailing=true]
* Specify invoking on the trailing edge of the timeout.
* @returns {Function} Returns the new throttled function.
* @example
*
* // Avoid excessively updating the position while scrolling.
* jQuery(window).on('scroll', _.throttle(updatePosition, 100));
*
* // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
* var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
* jQuery(element).on('click', throttled);
*
* // Cancel the trailing throttled invocation.
* jQuery(window).on('popstate', throttled.cancel);
*/
function throttle(func, wait, options) {
var leading = true,
trailing = true;
if (typeof func != 'function') {
throw new TypeError(FUNC_ERROR_TEXT);
}
if (isObject(options)) {
leading = 'leading' in options ? !!options.leading : leading;
trailing = 'trailing' in options ? !!options.trailing : trailing;
}
return debounce(func, wait, {
'leading': leading,
'maxWait': wait,
'trailing': trailing
});
}
module.exports = throttle;
/***/ }),
/***/ "EXo9":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var GetIntrinsic = __webpack_require__("rZ7t");
var callBind = __webpack_require__("hZ2/");
var $indexOf = callBind(GetIntrinsic('String.prototype.indexOf'));
module.exports = function callBoundIntrinsic(name, allowMissing) {
var intrinsic = GetIntrinsic(name, !!allowMissing);
if (typeof intrinsic === 'function' && $indexOf(name, '.prototype.') > -1) {
return callBind(intrinsic);
}
return intrinsic;
};
/***/ }),
/***/ "ExA7":
/***/ (function(module, exports) {
/**
* Checks if `value` is object-like. A value is object-like if it's not `null`
* and has a `typeof` result of "object".
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
* @example
*
* _.isObjectLike({});
* // => true
*
* _.isObjectLike([1, 2, 3]);
* // => true
*
* _.isObjectLike(_.noop);
* // => false
*
* _.isObjectLike(null);
* // => false
*/
function isObjectLike(value) {
return value != null && typeof value == 'object';
}
module.exports = isObjectLike;
/***/ }),
/***/ "F7ZS":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports['default'] = getCalendarMonthWeeks;
var _moment = __webpack_require__("wy2R");
var _moment2 = _interopRequireDefault(_moment);
var _constants = __webpack_require__("Fv1B");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function getCalendarMonthWeeks(month, enableOutsideDays) {
var firstDayOfWeek = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _moment2['default'].localeData().firstDayOfWeek();
if (!_moment2['default'].isMoment(month) || !month.isValid()) {
throw new TypeError('`month` must be a valid moment object');
}
if (_constants.WEEKDAYS.indexOf(firstDayOfWeek) === -1) {
throw new TypeError('`firstDayOfWeek` must be an integer between 0 and 6');
}
// set utc offset to get correct dates in future (when timezone changes)
var firstOfMonth = month.clone().startOf('month').hour(12);
var lastOfMonth = month.clone().endOf('month').hour(12);
// calculate the exact first and last days to fill the entire matrix
// (considering days outside month)
var prevDays = (firstOfMonth.day() + 7 - firstDayOfWeek) % 7;
var nextDays = (firstDayOfWeek + 6 - lastOfMonth.day()) % 7;
var firstDay = firstOfMonth.clone().subtract(prevDays, 'day');
var lastDay = lastOfMonth.clone().add(nextDays, 'day');
var totalDays = lastDay.diff(firstDay, 'days') + 1;
var currentDay = firstDay.clone();
var weeksInMonth = [];
for (var i = 0; i < totalDays; i += 1) {
if (i % 7 === 0) {
weeksInMonth.push([]);
}
var day = null;
if (i >= prevDays && i < totalDays - nextDays || enableOutsideDays) {
day = currentDay.clone();
}
weeksInMonth[weeksInMonth.length - 1].push(day);
currentDay.add(1, 'day');
}
return weeksInMonth;
}
/***/ }),
/***/ "FpZJ":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/* eslint complexity: [2, 18], max-statements: [2, 33] */
module.exports = function hasSymbols() {
if (typeof Symbol !== 'function' || typeof Object.getOwnPropertySymbols !== 'function') { return false; }
if (typeof Symbol.iterator === 'symbol') { return true; }
var obj = {};
var sym = Symbol('test');
var symObj = Object(sym);
if (typeof sym === 'string') { return false; }
if (Object.prototype.toString.call(sym) !== '[object Symbol]') { return false; }
if (Object.prototype.toString.call(symObj) !== '[object Symbol]') { return false; }
// temp disabled per https://github.com/ljharb/object.assign/issues/17
// if (sym instanceof Symbol) { return false; }
// temp disabled per https://github.com/WebReflection/get-own-property-symbols/issues/4
// if (!(symObj instanceof Symbol)) { return false; }
// if (typeof Symbol.prototype.toString !== 'function') { return false; }
// if (String(sym) !== Symbol.prototype.toString.call(sym)) { return false; }
var symVal = 42;
obj[sym] = symVal;
for (sym in obj) { return false; } // eslint-disable-line no-restricted-syntax
if (typeof Object.keys === 'function' && Object.keys(obj).length !== 0) { return false; }
if (typeof Object.getOwnPropertyNames === 'function' && Object.getOwnPropertyNames(obj).length !== 0) { return false; }
var syms = Object.getOwnPropertySymbols(obj);
if (syms.length !== 1 || syms[0] !== sym) { return false; }
if (!Object.prototype.propertyIsEnumerable.call(obj, sym)) { return false; }
if (typeof Object.getOwnPropertyDescriptor === 'function') {
var descriptor = Object.getOwnPropertyDescriptor(obj, sym);
if (descriptor.value !== symVal || descriptor.enumerable !== true) { return false; }
}
return true;
};
/***/ }),
/***/ "FqII":
/***/ (function(module, exports) {
(function() { module.exports = window["wp"]["date"]; }());
/***/ }),
/***/ "FufO":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
// modified from https://github.com/es-shims/es6-shim
var keys = __webpack_require__("1seS");
var canBeObject = function (obj) {
return typeof obj !== 'undefined' && obj !== null;
};
var hasSymbols = __webpack_require__("FpZJ")();
var callBound = __webpack_require__("VF6F");
var toObject = Object;
var $push = callBound('Array.prototype.push');
var $propIsEnumerable = callBound('Object.prototype.propertyIsEnumerable');
var originalGetSymbols = hasSymbols ? Object.getOwnPropertySymbols : null;
// eslint-disable-next-line no-unused-vars
module.exports = function assign(target, source1) {
if (!canBeObject(target)) { throw new TypeError('target must be an object'); }
var objTarget = toObject(target);
var s, source, i, props, syms, value, key;
for (s = 1; s < arguments.length; ++s) {
source = toObject(arguments[s]);
props = keys(source);
var getSymbols = hasSymbols && (Object.getOwnPropertySymbols || originalGetSymbols);
if (getSymbols) {
syms = getSymbols(source);
for (i = 0; i < syms.length; ++i) {
key = syms[i];
if ($propIsEnumerable(source, key)) {
$push(props, key);
}
}
}
for (i = 0; i < props.length; ++i) {
key = props[i];
value = source[key];
if ($propIsEnumerable(source, key)) {
objTarget[key] = value;
}
}
}
return objTarget;
};
/***/ }),
/***/ "Fv1B":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var DISPLAY_FORMAT = exports.DISPLAY_FORMAT = 'L';
var ISO_FORMAT = exports.ISO_FORMAT = 'YYYY-MM-DD';
var ISO_MONTH_FORMAT = exports.ISO_MONTH_FORMAT = 'YYYY-MM';
var START_DATE = exports.START_DATE = 'startDate';
var END_DATE = exports.END_DATE = 'endDate';
var HORIZONTAL_ORIENTATION = exports.HORIZONTAL_ORIENTATION = 'horizontal';
var VERTICAL_ORIENTATION = exports.VERTICAL_ORIENTATION = 'vertical';
var VERTICAL_SCROLLABLE = exports.VERTICAL_SCROLLABLE = 'verticalScrollable';
var ICON_BEFORE_POSITION = exports.ICON_BEFORE_POSITION = 'before';
var ICON_AFTER_POSITION = exports.ICON_AFTER_POSITION = 'after';
var INFO_POSITION_TOP = exports.INFO_POSITION_TOP = 'top';
var INFO_POSITION_BOTTOM = exports.INFO_POSITION_BOTTOM = 'bottom';
var INFO_POSITION_BEFORE = exports.INFO_POSITION_BEFORE = 'before';
var INFO_POSITION_AFTER = exports.INFO_POSITION_AFTER = 'after';
var ANCHOR_LEFT = exports.ANCHOR_LEFT = 'left';
var ANCHOR_RIGHT = exports.ANCHOR_RIGHT = 'right';
var OPEN_DOWN = exports.OPEN_DOWN = 'down';
var OPEN_UP = exports.OPEN_UP = 'up';
var DAY_SIZE = exports.DAY_SIZE = 39;
var BLOCKED_MODIFIER = exports.BLOCKED_MODIFIER = 'blocked';
var WEEKDAYS = exports.WEEKDAYS = [0, 1, 2, 3, 4, 5, 6];
var FANG_WIDTH_PX = exports.FANG_WIDTH_PX = 20;
var FANG_HEIGHT_PX = exports.FANG_HEIGHT_PX = 10;
var DEFAULT_VERTICAL_SPACING = exports.DEFAULT_VERTICAL_SPACING = 22;
var MODIFIER_KEY_NAMES = exports.MODIFIER_KEY_NAMES = new Set(['Shift', 'Control', 'Alt', 'Meta']);
/***/ }),
/***/ "G3V0":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* unused harmony export Tabbable */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return useTabbable; });
/* harmony import */ var _rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("BZp5");
/* harmony import */ var reakit_system_createComponent__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("hE48");
/* harmony import */ var reakit_system_createHook__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("qdes");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("cDcd");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var reakit_utils_useForkRef__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("aU41");
/* harmony import */ var reakit_utils_isButton__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__("71Og");
/* harmony import */ var reakit_warning__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__("KA1K");
/* harmony import */ var reakit_utils_useLiveRef__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__("eNtd");
/* harmony import */ var reakit_utils_useIsomorphicEffect__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__("AXvK");
/* harmony import */ var reakit_utils_hasFocusWithin__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__("PcHe");
/* harmony import */ var reakit_utils_isPortalEvent__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__("Vq1w");
/* harmony import */ var reakit_utils_dom__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__("reMF");
/* harmony import */ var reakit_utils_tabbable__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__("kqkJ");
/* harmony import */ var _Role_Role_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__("zGFp");
// Automatically generated
var TABBABLE_KEYS = ["disabled", "focusable"];
var isSafariOrFirefoxOnMac = Object(reakit_utils_dom__WEBPACK_IMPORTED_MODULE_11__[/* isUA */ "a"])("Mac") && !Object(reakit_utils_dom__WEBPACK_IMPORTED_MODULE_11__[/* isUA */ "a"])("Chrome") && (Object(reakit_utils_dom__WEBPACK_IMPORTED_MODULE_11__[/* isUA */ "a"])("Safari") || Object(reakit_utils_dom__WEBPACK_IMPORTED_MODULE_11__[/* isUA */ "a"])("Firefox"));
function focusIfNeeded(element) {
if (!Object(reakit_utils_hasFocusWithin__WEBPACK_IMPORTED_MODULE_9__[/* hasFocusWithin */ "a"])(element) && Object(reakit_utils_tabbable__WEBPACK_IMPORTED_MODULE_12__[/* isFocusable */ "a"])(element)) {
element.focus();
}
}
function isNativeTabbable(element) {
return element.tagName === "BUTTON" || element.tagName === "INPUT" || element.tagName === "SELECT" || element.tagName === "TEXTAREA" || element.tagName === "A";
}
function supportsDisabledAttribute(element) {
return element.tagName === "BUTTON" || element.tagName === "INPUT" || element.tagName === "SELECT" || element.tagName === "TEXTAREA";
}
function getTabIndex(trulyDisabled, nativeTabbable, supportsDisabled, htmlTabIndex) {
if (trulyDisabled) {
if (nativeTabbable && !supportsDisabled) {
// Anchor, audio and video tags don't support the `disabled` attribute.
// We must pass tabIndex={-1} so they don't receive focus on tab.
return -1;
} // Elements that support the `disabled` attribute don't need tabIndex.
return undefined;
}
if (nativeTabbable) {
// If the element is enabled and it's natively tabbable, we don't need to
// specify a tabIndex attribute unless it's explicitly set by the user.
return htmlTabIndex;
} // If the element is enabled and is not natively tabbable, we have to
// fallback tabIndex={0}.
return htmlTabIndex || 0;
}
function useDisableEvent(htmlEventRef, disabled) {
return Object(react__WEBPACK_IMPORTED_MODULE_3__["useCallback"])(function (event) {
var _htmlEventRef$current;
(_htmlEventRef$current = htmlEventRef.current) === null || _htmlEventRef$current === void 0 ? void 0 : _htmlEventRef$current.call(htmlEventRef, event);
if (event.defaultPrevented) return;
if (disabled) {
event.stopPropagation();
event.preventDefault();
}
}, [htmlEventRef, disabled]);
}
var useTabbable = Object(reakit_system_createHook__WEBPACK_IMPORTED_MODULE_2__[/* createHook */ "a"])({
name: "Tabbable",
compose: _Role_Role_js__WEBPACK_IMPORTED_MODULE_13__[/* useRole */ "a"],
keys: TABBABLE_KEYS,
useOptions: function useOptions(options, _ref) {
var disabled = _ref.disabled;
return Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({
disabled: disabled
}, options);
},
useProps: function useProps(options, _ref2) {
var htmlRef = _ref2.ref,
htmlTabIndex = _ref2.tabIndex,
htmlOnClickCapture = _ref2.onClickCapture,
htmlOnMouseDownCapture = _ref2.onMouseDownCapture,
htmlOnMouseDown = _ref2.onMouseDown,
htmlOnKeyPressCapture = _ref2.onKeyPressCapture,
htmlStyle = _ref2.style,
htmlProps = Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* _ */ "a"])(_ref2, ["ref", "tabIndex", "onClickCapture", "onMouseDownCapture", "onMouseDown", "onKeyPressCapture", "style"]);
var ref = Object(react__WEBPACK_IMPORTED_MODULE_3__["useRef"])(null);
var onClickCaptureRef = Object(reakit_utils_useLiveRef__WEBPACK_IMPORTED_MODULE_7__[/* useLiveRef */ "a"])(htmlOnClickCapture);
var onMouseDownCaptureRef = Object(reakit_utils_useLiveRef__WEBPACK_IMPORTED_MODULE_7__[/* useLiveRef */ "a"])(htmlOnMouseDownCapture);
var onMouseDownRef = Object(reakit_utils_useLiveRef__WEBPACK_IMPORTED_MODULE_7__[/* useLiveRef */ "a"])(htmlOnMouseDown);
var onKeyPressCaptureRef = Object(reakit_utils_useLiveRef__WEBPACK_IMPORTED_MODULE_7__[/* useLiveRef */ "a"])(htmlOnKeyPressCapture);
var trulyDisabled = !!options.disabled && !options.focusable;
var _React$useState = Object(react__WEBPACK_IMPORTED_MODULE_3__["useState"])(true),
nativeTabbable = _React$useState[0],
setNativeTabbable = _React$useState[1];
var _React$useState2 = Object(react__WEBPACK_IMPORTED_MODULE_3__["useState"])(true),
supportsDisabled = _React$useState2[0],
setSupportsDisabled = _React$useState2[1];
var style = options.disabled ? Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({
pointerEvents: "none"
}, htmlStyle) : htmlStyle;
Object(reakit_utils_useIsomorphicEffect__WEBPACK_IMPORTED_MODULE_8__[/* useIsomorphicEffect */ "a"])(function () {
var tabbable = ref.current;
if (!tabbable) {
false ? undefined : void 0;
return;
}
if (!isNativeTabbable(tabbable)) {
setNativeTabbable(false);
}
if (!supportsDisabledAttribute(tabbable)) {
setSupportsDisabled(false);
}
}, []);
var onClickCapture = useDisableEvent(onClickCaptureRef, options.disabled);
var onMouseDownCapture = useDisableEvent(onMouseDownCaptureRef, options.disabled);
var onKeyPressCapture = useDisableEvent(onKeyPressCaptureRef, options.disabled);
var onMouseDown = Object(react__WEBPACK_IMPORTED_MODULE_3__["useCallback"])(function (event) {
var _onMouseDownRef$curre;
(_onMouseDownRef$curre = onMouseDownRef.current) === null || _onMouseDownRef$curre === void 0 ? void 0 : _onMouseDownRef$curre.call(onMouseDownRef, event);
var element = event.currentTarget;
if (event.defaultPrevented) return; // Safari and Firefox on MacOS don't focus on buttons on mouse down
// like other browsers/platforms. Instead, they focus on the closest
// focusable ancestor element, which is ultimately the body element. So
// we make sure to give focus to the tabbable element on mouse down so
// it works consistently across browsers.
if (!isSafariOrFirefoxOnMac) return;
if (Object(reakit_utils_isPortalEvent__WEBPACK_IMPORTED_MODULE_10__[/* isPortalEvent */ "a"])(event)) return;
if (!Object(reakit_utils_isButton__WEBPACK_IMPORTED_MODULE_5__[/* isButton */ "a"])(element)) return; // We can't focus right away after on mouse down, otherwise it would
// prevent drag events from happening. So we schedule the focus to the
// next animation frame.
var raf = requestAnimationFrame(function () {
element.removeEventListener("mouseup", focusImmediately, true);
focusIfNeeded(element);
}); // If mouseUp happens before the next animation frame (which is common
// on touch screens or by just tapping the trackpad on MacBook's), we
// cancel the animation frame and immediately focus on the element.
var focusImmediately = function focusImmediately() {
cancelAnimationFrame(raf);
focusIfNeeded(element);
}; // By listening to the event in the capture phase, we make sure the
// focus event is fired before the onMouseUp and onMouseUpCapture React
// events, which is aligned with the default browser behavior.
element.addEventListener("mouseup", focusImmediately, {
once: true,
capture: true
});
}, []);
return Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({
ref: Object(reakit_utils_useForkRef__WEBPACK_IMPORTED_MODULE_4__[/* useForkRef */ "a"])(ref, htmlRef),
style: style,
tabIndex: getTabIndex(trulyDisabled, nativeTabbable, supportsDisabled, htmlTabIndex),
disabled: trulyDisabled && supportsDisabled ? true : undefined,
"aria-disabled": options.disabled ? true : undefined,
onClickCapture: onClickCapture,
onMouseDownCapture: onMouseDownCapture,
onMouseDown: onMouseDown,
onKeyPressCapture: onKeyPressCapture
}, htmlProps);
}
});
var Tabbable = Object(reakit_system_createComponent__WEBPACK_IMPORTED_MODULE_1__[/* createComponent */ "a"])({
as: "div",
useHook: useTabbable
});
/***/ }),
/***/ "GET3":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.PureCustomizableCalendarDay = exports.selectedStyles = exports.lastInRangeStyles = exports.selectedSpanStyles = exports.hoveredSpanStyles = exports.blockedOutOfRangeStyles = exports.blockedCalendarStyles = exports.blockedMinNightsStyles = exports.highlightedCalendarStyles = exports.outsideStyles = exports.defaultStyles = undefined;
var _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; };
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _object = __webpack_require__("Koq/");
var _object2 = _interopRequireDefault(_object);
var _react = __webpack_require__("cDcd");
var _react2 = _interopRequireDefault(_react);
var _propTypes = __webpack_require__("17x9");
var _propTypes2 = _interopRequireDefault(_propTypes);
var _reactAddonsShallowCompare = __webpack_require__("YZDV");
var _reactAddonsShallowCompare2 = _interopRequireDefault(_reactAddonsShallowCompare);
var _reactMomentProptypes = __webpack_require__("XGBb");
var _reactMomentProptypes2 = _interopRequireDefault(_reactMomentProptypes);
var _airbnbPropTypes = __webpack_require__("Hsqg");
var _reactWithStyles = __webpack_require__("TG4+");
var _moment = __webpack_require__("wy2R");
var _moment2 = _interopRequireDefault(_moment);
var _defaultPhrases = __webpack_require__("vV+G");
var _getPhrasePropTypes = __webpack_require__("yc2e");
var _getPhrasePropTypes2 = _interopRequireDefault(_getPhrasePropTypes);
var _getCalendarDaySettings = __webpack_require__("Ae65");
var _getCalendarDaySettings2 = _interopRequireDefault(_getCalendarDaySettings);
var _constants = __webpack_require__("Fv1B");
var _DefaultTheme = __webpack_require__("xOhs");
var _DefaultTheme2 = _interopRequireDefault(_DefaultTheme);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var color = _DefaultTheme2['default'].reactDates.color;
function getStyles(stylesObj, isHovered) {
if (!stylesObj) return null;
var hover = stylesObj.hover;
if (isHovered && hover) {
return hover;
}
return stylesObj;
}
var DayStyleShape = _propTypes2['default'].shape({
background: _propTypes2['default'].string,
border: (0, _airbnbPropTypes.or)([_propTypes2['default'].string, _propTypes2['default'].number]),
color: _propTypes2['default'].string,
hover: _propTypes2['default'].shape({
background: _propTypes2['default'].string,
border: (0, _airbnbPropTypes.or)([_propTypes2['default'].string, _propTypes2['default'].number]),
color: _propTypes2['default'].string
})
});
var propTypes = (0, _airbnbPropTypes.forbidExtraProps)((0, _object2['default'])({}, _reactWithStyles.withStylesPropTypes, {
day: _reactMomentProptypes2['default'].momentObj,
daySize: _airbnbPropTypes.nonNegativeInteger,
isOutsideDay: _propTypes2['default'].bool,
modifiers: _propTypes2['default'].instanceOf(Set),
isFocused: _propTypes2['default'].bool,
tabIndex: _propTypes2['default'].oneOf([0, -1]),
onDayClick: _propTypes2['default'].func,
onDayMouseEnter: _propTypes2['default'].func,
onDayMouseLeave: _propTypes2['default'].func,
renderDayContents: _propTypes2['default'].func,
ariaLabelFormat: _propTypes2['default'].string,
// style overrides
defaultStyles: DayStyleShape,
outsideStyles: DayStyleShape,
todayStyles: DayStyleShape,
firstDayOfWeekStyles: DayStyleShape,
lastDayOfWeekStyles: DayStyleShape,
highlightedCalendarStyles: DayStyleShape,
blockedMinNightsStyles: DayStyleShape,
blockedCalendarStyles: DayStyleShape,
blockedOutOfRangeStyles: DayStyleShape,
hoveredSpanStyles: DayStyleShape,
selectedSpanStyles: DayStyleShape,
lastInRangeStyles: DayStyleShape,
selectedStyles: DayStyleShape,
selectedStartStyles: DayStyleShape,
selectedEndStyles: DayStyleShape,
afterHoveredStartStyles: DayStyleShape,
// internationalization
phrases: _propTypes2['default'].shape((0, _getPhrasePropTypes2['default'])(_defaultPhrases.CalendarDayPhrases))
}));
var defaultStyles = exports.defaultStyles = {
border: '1px solid ' + String(color.core.borderLight),
color: color.text,
background: color.background,
hover: {
background: color.core.borderLight,
border: '1px double ' + String(color.core.borderLight),
color: 'inherit'
}
};
var outsideStyles = exports.outsideStyles = {
background: color.outside.backgroundColor,
border: 0,
color: color.outside.color
};
var highlightedCalendarStyles = exports.highlightedCalendarStyles = {
background: color.highlighted.backgroundColor,
color: color.highlighted.color,
hover: {
background: color.highlighted.backgroundColor_hover,
color: color.highlighted.color_active
}
};
var blockedMinNightsStyles = exports.blockedMinNightsStyles = {
background: color.minimumNights.backgroundColor,
border: '1px solid ' + String(color.minimumNights.borderColor),
color: color.minimumNights.color,
hover: {
background: color.minimumNights.backgroundColor_hover,
color: color.minimumNights.color_active
}
};
var blockedCalendarStyles = exports.blockedCalendarStyles = {
background: color.blocked_calendar.backgroundColor,
border: '1px solid ' + String(color.blocked_calendar.borderColor),
color: color.blocked_calendar.color,
hover: {
background: color.blocked_calendar.backgroundColor_hover,
border: '1px solid ' + String(color.blocked_calendar.borderColor),
color: color.blocked_calendar.color_active
}
};
var blockedOutOfRangeStyles = exports.blockedOutOfRangeStyles = {
background: color.blocked_out_of_range.backgroundColor,
border: '1px solid ' + String(color.blocked_out_of_range.borderColor),
color: color.blocked_out_of_range.color,
hover: {
background: color.blocked_out_of_range.backgroundColor_hover,
border: '1px solid ' + String(color.blocked_out_of_range.borderColor),
color: color.blocked_out_of_range.color_active
}
};
var hoveredSpanStyles = exports.hoveredSpanStyles = {
background: color.hoveredSpan.backgroundColor,
border: '1px solid ' + String(color.hoveredSpan.borderColor),
color: color.hoveredSpan.color,
hover: {
background: color.hoveredSpan.backgroundColor_hover,
border: '1px solid ' + String(color.hoveredSpan.borderColor),
color: color.hoveredSpan.color_active
}
};
var selectedSpanStyles = exports.selectedSpanStyles = {
background: color.selectedSpan.backgroundColor,
border: '1px solid ' + String(color.selectedSpan.borderColor),
color: color.selectedSpan.color,
hover: {
background: color.selectedSpan.backgroundColor_hover,
border: '1px solid ' + String(color.selectedSpan.borderColor),
color: color.selectedSpan.color_active
}
};
var lastInRangeStyles = exports.lastInRangeStyles = {
borderRight: color.core.primary
};
var selectedStyles = exports.selectedStyles = {
background: color.selected.backgroundColor,
border: '1px solid ' + String(color.selected.borderColor),
color: color.selected.color,
hover: {
background: color.selected.backgroundColor_hover,
border: '1px solid ' + String(color.selected.borderColor),
color: color.selected.color_active
}
};
var defaultProps = {
day: (0, _moment2['default'])(),
daySize: _constants.DAY_SIZE,
isOutsideDay: false,
modifiers: new Set(),
isFocused: false,
tabIndex: -1,
onDayClick: function () {
function onDayClick() {}
return onDayClick;
}(),
onDayMouseEnter: function () {
function onDayMouseEnter() {}
return onDayMouseEnter;
}(),
onDayMouseLeave: function () {
function onDayMouseLeave() {}
return onDayMouseLeave;
}(),
renderDayContents: null,
ariaLabelFormat: 'dddd, LL',
// style defaults
defaultStyles: defaultStyles,
outsideStyles: outsideStyles,
todayStyles: {},
highlightedCalendarStyles: highlightedCalendarStyles,
blockedMinNightsStyles: blockedMinNightsStyles,
blockedCalendarStyles: blockedCalendarStyles,
blockedOutOfRangeStyles: blockedOutOfRangeStyles,
hoveredSpanStyles: hoveredSpanStyles,
selectedSpanStyles: selectedSpanStyles,
lastInRangeStyles: lastInRangeStyles,
selectedStyles: selectedStyles,
selectedStartStyles: {},
selectedEndStyles: {},
afterHoveredStartStyles: {},
firstDayOfWeekStyles: {},
lastDayOfWeekStyles: {},
// internationalization
phrases: _defaultPhrases.CalendarDayPhrases
};
var CustomizableCalendarDay = function (_React$Component) {
_inherits(CustomizableCalendarDay, _React$Component);
function CustomizableCalendarDay() {
var _ref;
_classCallCheck(this, CustomizableCalendarDay);
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
var _this = _possibleConstructorReturn(this, (_ref = CustomizableCalendarDay.__proto__ || Object.getPrototypeOf(CustomizableCalendarDay)).call.apply(_ref, [this].concat(args)));
_this.state = {
isHovered: false
};
_this.setButtonRef = _this.setButtonRef.bind(_this);
return _this;
}
_createClass(CustomizableCalendarDay, [{
key: 'shouldComponentUpdate',
value: function () {
function shouldComponentUpdate(nextProps, nextState) {
return (0, _reactAddonsShallowCompare2['default'])(this, nextProps, nextState);
}
return shouldComponentUpdate;
}()
}, {
key: 'componentDidUpdate',
value: function () {
function componentDidUpdate(prevProps) {
var _props = this.props,
isFocused = _props.isFocused,
tabIndex = _props.tabIndex;
if (tabIndex === 0) {
if (isFocused || tabIndex !== prevProps.tabIndex) {
this.buttonRef.focus();
}
}
}
return componentDidUpdate;
}()
}, {
key: 'onDayClick',
value: function () {
function onDayClick(day, e) {
var onDayClick = this.props.onDayClick;
onDayClick(day, e);
}
return onDayClick;
}()
}, {
key: 'onDayMouseEnter',
value: function () {
function onDayMouseEnter(day, e) {
var onDayMouseEnter = this.props.onDayMouseEnter;
this.setState({ isHovered: true });
onDayMouseEnter(day, e);
}
return onDayMouseEnter;
}()
}, {
key: 'onDayMouseLeave',
value: function () {
function onDayMouseLeave(day, e) {
var onDayMouseLeave = this.props.onDayMouseLeave;
this.setState({ isHovered: false });
onDayMouseLeave(day, e);
}
return onDayMouseLeave;
}()
}, {
key: 'onKeyDown',
value: function () {
function onKeyDown(day, e) {
var onDayClick = this.props.onDayClick;
var key = e.key;
if (key === 'Enter' || key === ' ') {
onDayClick(day, e);
}
}
return onKeyDown;
}()
}, {
key: 'setButtonRef',
value: function () {
function setButtonRef(ref) {
this.buttonRef = ref;
}
return setButtonRef;
}()
}, {
key: 'render',
value: function () {
function render() {
var _this2 = this;
var _props2 = this.props,
day = _props2.day,
ariaLabelFormat = _props2.ariaLabelFormat,
daySize = _props2.daySize,
isOutsideDay = _props2.isOutsideDay,
modifiers = _props2.modifiers,
tabIndex = _props2.tabIndex,
renderDayContents = _props2.renderDayContents,
styles = _props2.styles,
phrases = _props2.phrases,
defaultStylesWithHover = _props2.defaultStyles,
outsideStylesWithHover = _props2.outsideStyles,
todayStylesWithHover = _props2.todayStyles,
firstDayOfWeekStylesWithHover = _props2.firstDayOfWeekStyles,
lastDayOfWeekStylesWithHover = _props2.lastDayOfWeekStyles,
highlightedCalendarStylesWithHover = _props2.highlightedCalendarStyles,
blockedMinNightsStylesWithHover = _props2.blockedMinNightsStyles,
blockedCalendarStylesWithHover = _props2.blockedCalendarStyles,
blockedOutOfRangeStylesWithHover = _props2.blockedOutOfRangeStyles,
hoveredSpanStylesWithHover = _props2.hoveredSpanStyles,
selectedSpanStylesWithHover = _props2.selectedSpanStyles,
lastInRangeStylesWithHover = _props2.lastInRangeStyles,
selectedStylesWithHover = _props2.selectedStyles,
selectedStartStylesWithHover = _props2.selectedStartStyles,
selectedEndStylesWithHover = _props2.selectedEndStyles,
afterHoveredStartStylesWithHover = _props2.afterHoveredStartStyles;
var isHovered = this.state.isHovered;
if (!day) return _react2['default'].createElement('td', null);
var _getCalendarDaySettin = (0, _getCalendarDaySettings2['default'])(day, ariaLabelFormat, daySize, modifiers, phrases),
daySizeStyles = _getCalendarDaySettin.daySizeStyles,
useDefaultCursor = _getCalendarDaySettin.useDefaultCursor,
selected = _getCalendarDaySettin.selected,
hoveredSpan = _getCalendarDaySettin.hoveredSpan,
isOutsideRange = _getCalendarDaySettin.isOutsideRange,
ariaLabel = _getCalendarDaySettin.ariaLabel;
return _react2['default'].createElement(
'td',
_extends({}, (0, _reactWithStyles.css)(styles.CalendarDay, useDefaultCursor && styles.CalendarDay__defaultCursor, daySizeStyles, getStyles(defaultStylesWithHover, isHovered), isOutsideDay && getStyles(outsideStylesWithHover, isHovered), modifiers.has('today') && getStyles(todayStylesWithHover, isHovered), modifiers.has('first-day-of-week') && getStyles(firstDayOfWeekStylesWithHover, isHovered), modifiers.has('last-day-of-week') && getStyles(lastDayOfWeekStylesWithHover, isHovered), modifiers.has('highlighted-calendar') && getStyles(highlightedCalendarStylesWithHover, isHovered), modifiers.has('blocked-minimum-nights') && getStyles(blockedMinNightsStylesWithHover, isHovered), modifiers.has('blocked-calendar') && getStyles(blockedCalendarStylesWithHover, isHovered), hoveredSpan && getStyles(hoveredSpanStylesWithHover, isHovered), modifiers.has('after-hovered-start') && getStyles(afterHoveredStartStylesWithHover, isHovered), modifiers.has('selected-span') && getStyles(selectedSpanStylesWithHover, isHovered), modifiers.has('last-in-range') && getStyles(lastInRangeStylesWithHover, isHovered), selected && getStyles(selectedStylesWithHover, isHovered), modifiers.has('selected-start') && getStyles(selectedStartStylesWithHover, isHovered), modifiers.has('selected-end') && getStyles(selectedEndStylesWithHover, isHovered), isOutsideRange && getStyles(blockedOutOfRangeStylesWithHover, isHovered)), {
role: 'button' // eslint-disable-line jsx-a11y/no-noninteractive-element-to-interactive-role
, ref: this.setButtonRef,
'aria-label': ariaLabel,
onMouseEnter: function () {
function onMouseEnter(e) {
_this2.onDayMouseEnter(day, e);
}
return onMouseEnter;
}(),
onMouseLeave: function () {
function onMouseLeave(e) {
_this2.onDayMouseLeave(day, e);
}
return onMouseLeave;
}(),
onMouseUp: function () {
function onMouseUp(e) {
e.currentTarget.blur();
}
return onMouseUp;
}(),
onClick: function () {
function onClick(e) {
_this2.onDayClick(day, e);
}
return onClick;
}(),
onKeyDown: function () {
function onKeyDown(e) {
_this2.onKeyDown(day, e);
}
return onKeyDown;
}(),
tabIndex: tabIndex
}),
renderDayContents ? renderDayContents(day, modifiers) : day.format('D')
);
}
return render;
}()
}]);
return CustomizableCalendarDay;
}(_react2['default'].Component);
CustomizableCalendarDay.propTypes = propTypes;
CustomizableCalendarDay.defaultProps = defaultProps;
exports.PureCustomizableCalendarDay = CustomizableCalendarDay;
exports['default'] = (0, _reactWithStyles.withStyles)(function (_ref2) {
var font = _ref2.reactDates.font;
return {
CalendarDay: {
boxSizing: 'border-box',
cursor: 'pointer',
fontSize: font.size,
textAlign: 'center',
':active': {
outline: 0
}
},
CalendarDay__defaultCursor: {
cursor: 'default'
}
};
})(CustomizableCalendarDay);
/***/ }),
/***/ "GG7f":
/***/ (function(module, exports, __webpack_require__) {
// eslint-disable-next-line import/no-unresolved
__webpack_require__("H24B");
/***/ }),
/***/ "GK4x":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId");
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
/**
* WordPress dependencies
*/
const ToolbarContext = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createContext"])();
/* harmony default export */ __webpack_exports__["a"] = (ToolbarContext);
/***/ }),
/***/ "GRId":
/***/ (function(module, exports) {
(function() { module.exports = window["wp"]["element"]; }());
/***/ }),
/***/ "Gn0q":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var define = __webpack_require__("82c2");
var getPolyfill = __webpack_require__("5yQQ");
module.exports = function shimContains() {
var polyfill = getPolyfill();
if (typeof document !== 'undefined') {
define(
document,
{ contains: polyfill },
{ contains: function () { return document.contains !== polyfill; } }
);
if (typeof Element !== 'undefined') {
define(
Element.prototype,
{ contains: polyfill },
{ contains: function () { return Element.prototype.contains !== polyfill; } }
);
}
}
return polyfill;
};
/***/ }),
/***/ "GoyQ":
/***/ (function(module, exports) {
/**
* Checks if `value` is the
* [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
* of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
* @example
*
* _.isObject({});
* // => true
*
* _.isObject([1, 2, 3]);
* // => true
*
* _.isObject(_.noop);
* // => true
*
* _.isObject(null);
* // => false
*/
function isObject(value) {
var type = typeof value;
return value != null && (type == 'object' || type == 'function');
}
module.exports = isObject;
/***/ }),
/***/ "H24B":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _registerCSSInterfaceWithDefaultTheme = __webpack_require__("TUyu");
var _registerCSSInterfaceWithDefaultTheme2 = _interopRequireDefault(_registerCSSInterfaceWithDefaultTheme);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
(0, _registerCSSInterfaceWithDefaultTheme2['default'])();
/***/ }),
/***/ "HI8u":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var $isNaN = __webpack_require__("HwJD");
// http://262.ecma-international.org/5.1/#sec-9.12
module.exports = function SameValue(x, y) {
if (x === y) { // 0 === -0, but they are not identical.
if (x === 0) { return 1 / x === 1 / y; }
return true;
}
return $isNaN(x) && $isNaN(y);
};
/***/ }),
/***/ "Hsqg":
/***/ (function(module, exports, __webpack_require__) {
module.exports = true ? __webpack_require__("DciD") : undefined;
/***/ }),
/***/ "HwJD":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
module.exports = Number.isNaN || function isNaN(a) {
return a !== a;
};
/***/ }),
/***/ "Hx/O":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var GetIntrinsic = __webpack_require__("rZ7t");
var $String = GetIntrinsic('%String%');
var $TypeError = GetIntrinsic('%TypeError%');
// https://ecma-international.org/ecma-262/6.0/#sec-tostring
module.exports = function ToString(argument) {
if (typeof argument === 'symbol') {
throw new $TypeError('Cannot convert a Symbol value to a string');
}
return $String(argument);
};
/***/ }),
/***/ "HyUg":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var origSymbol = typeof Symbol !== 'undefined' && Symbol;
var hasSymbolSham = __webpack_require__("eJkf");
module.exports = function hasNativeSymbols() {
if (typeof origSymbol !== 'function') { return false; }
if (typeof Symbol !== 'function') { return false; }
if (typeof origSymbol('foo') !== 'symbol') { return false; }
if (typeof Symbol('bar') !== 'symbol') { return false; }
return hasSymbolSham();
};
/***/ }),
/***/ "I/A+":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _objectWithoutPropertiesLoose; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return _objectSpread2; });
/* unused harmony export b */
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;
}
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 _objectSpread2(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(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 _objectWithoutPropertiesLoose(source, excluded) {
if (source == null) return {};
var target = {};
var sourceKeys = Object.keys(source);
var key, i;
for (i = 0; i < sourceKeys.length; i++) {
key = sourceKeys[i];
if (excluded.indexOf(key) >= 0) continue;
target[key] = source[key];
}
return target;
}
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;
}
function _createForOfIteratorHelperLoose(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;
return function () {
if (i >= o.length) return {
done: true
};
return {
done: false,
value: o[i++]
};
};
}
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
it = o[Symbol.iterator]();
return it.next.bind(it);
}
/***/ }),
/***/ "IVEb":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return useCreateElement; });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("cDcd");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _SystemContext_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("eUCI");
/* harmony import */ var _rollupPluginBabelHelpers_0c84a174_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("RDTF");
function isRenderProp(children) {
return typeof children === "function";
}
/**
* Custom hook that will call `children` if it's a function. If
* `useCreateElement` has been passed to the context, it'll be used instead.
*
* @example
* import React from "react";
* import { SystemProvider, useCreateElement } from "reakit-system";
*
* const system = {
* useCreateElement(type, props, children = props.children) {
* // very similar to what `useCreateElement` does already
* if (typeof children === "function") {
* const { children: _, ...rest } = props;
* return children(rest);
* }
* return React.createElement(type, props, children);
* },
* };
*
* function Component(props) {
* return useCreateElement("div", props);
* }
*
* function App() {
* return (
*
* {({ url }) => link}
*
* );
* }
*/
var useCreateElement = function useCreateElement(type, props, children) {
if (children === void 0) {
children = props.children;
}
var context = Object(react__WEBPACK_IMPORTED_MODULE_0__["useContext"])(_SystemContext_js__WEBPACK_IMPORTED_MODULE_1__[/* SystemContext */ "a"]);
if (context.useCreateElement) {
return context.useCreateElement(type, props, children);
}
if (typeof type === "string" && isRenderProp(children)) {
var _ = props.children,
rest = Object(_rollupPluginBabelHelpers_0c84a174_js__WEBPACK_IMPORTED_MODULE_2__[/* a */ "b"])(props, ["children"]);
return children(rest);
}
return /*#__PURE__*/Object(react__WEBPACK_IMPORTED_MODULE_0__["createElement"])(type, props, children);
};
/***/ }),
/***/ "IdCN":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var fnToStr = Function.prototype.toString;
var reflectApply = typeof Reflect === 'object' && Reflect !== null && Reflect.apply;
var badArrayLike;
var isCallableMarker;
if (typeof reflectApply === 'function' && typeof Object.defineProperty === 'function') {
try {
badArrayLike = Object.defineProperty({}, 'length', {
get: function () {
throw isCallableMarker;
}
});
isCallableMarker = {};
// eslint-disable-next-line no-throw-literal
reflectApply(function () { throw 42; }, null, badArrayLike);
} catch (_) {
if (_ !== isCallableMarker) {
reflectApply = null;
}
}
} else {
reflectApply = null;
}
var constructorRegex = /^\s*class\b/;
var isES6ClassFn = function isES6ClassFunction(value) {
try {
var fnStr = fnToStr.call(value);
return constructorRegex.test(fnStr);
} catch (e) {
return false; // not a function
}
};
var tryFunctionObject = function tryFunctionToStr(value) {
try {
if (isES6ClassFn(value)) { return false; }
fnToStr.call(value);
return true;
} catch (e) {
return false;
}
};
var toStr = Object.prototype.toString;
var fnClass = '[object Function]';
var genClass = '[object GeneratorFunction]';
var hasToStringTag = typeof Symbol === 'function' && typeof Symbol.toStringTag === 'symbol';
module.exports = reflectApply
? function isCallable(value) {
if (!value) { return false; }
if (typeof value !== 'function' && typeof value !== 'object') { return false; }
if (typeof value === 'function' && !value.prototype) { return true; }
try {
reflectApply(value, null, badArrayLike);
} catch (e) {
if (e !== isCallableMarker) { return false; }
}
return !isES6ClassFn(value);
}
: function isCallable(value) {
if (!value) { return false; }
if (typeof value !== 'function' && typeof value !== 'object') { return false; }
if (typeof value === 'function' && !value.prototype) { return true; }
if (hasToStringTag) { return tryFunctionObject(value); }
if (isES6ClassFn(value)) { return false; }
var strClass = toStr.call(value);
return strClass === fnClass || strClass === genClass;
};
/***/ }),
/***/ "IgE5":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports['default'] = isDayVisible;
var _isBeforeDay = __webpack_require__("h6xH");
var _isBeforeDay2 = _interopRequireDefault(_isBeforeDay);
var _isAfterDay = __webpack_require__("Nho6");
var _isAfterDay2 = _interopRequireDefault(_isAfterDay);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function isDayVisible(day, month, numberOfMonths, enableOutsideDays) {
var firstDayOfFirstMonth = month.clone().startOf('month');
if (enableOutsideDays) firstDayOfFirstMonth = firstDayOfFirstMonth.startOf('week');
if ((0, _isBeforeDay2['default'])(day, firstDayOfFirstMonth)) return false;
var lastDayOfLastMonth = month.clone().add(numberOfMonths - 1, 'months').endOf('month');
if (enableOutsideDays) lastDayOfLastMonth = lastDayOfLastMonth.endOf('week');
return !(0, _isAfterDay2['default'])(day, lastDayOfLastMonth);
}
/***/ }),
/***/ "In1I":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var GetIntrinsic = __webpack_require__("rZ7t");
var $abs = GetIntrinsic('%Math.abs%');
// http://262.ecma-international.org/5.1/#sec-5.2
module.exports = function abs(x) {
return $abs(x);
};
/***/ }),
/***/ "J7JS":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _propTypes = __webpack_require__("17x9");
var _propTypes2 = _interopRequireDefault(_propTypes);
var _airbnbPropTypes = __webpack_require__("Hsqg");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
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; }
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
exports['default'] = (0, _airbnbPropTypes.and)([_propTypes2['default'].instanceOf(Set), function () {
function modifiers(props, propName) {
for (var _len = arguments.length, rest = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
rest[_key - 2] = arguments[_key];
}
var propValue = props[propName];
var firstError = void 0;
[].concat(_toConsumableArray(propValue)).some(function (v, i) {
var _PropTypes$string;
var fakePropName = String(propName) + ': index ' + String(i);
firstError = (_PropTypes$string = _propTypes2['default'].string).isRequired.apply(_PropTypes$string, [_defineProperty({}, fakePropName, v), fakePropName].concat(rest));
return firstError != null;
});
return firstError == null ? null : firstError;
}
return modifiers;
}()], 'Modifiers (Set of Strings)');
/***/ }),
/***/ "JLmN":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* unused harmony export Clickable */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return useClickable; });
/* harmony import */ var _rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("BZp5");
/* harmony import */ var reakit_system_createComponent__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("hE48");
/* harmony import */ var reakit_system_createHook__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("qdes");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("cDcd");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var reakit_utils_isButton__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("71Og");
/* harmony import */ var reakit_warning__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__("KA1K");
/* harmony import */ var reakit_utils_useLiveRef__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__("eNtd");
/* harmony import */ var reakit_utils_isSelfTarget__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__("k2cL");
/* harmony import */ var _Tabbable_Tabbable_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__("G3V0");
// Automatically generated
var CLICKABLE_KEYS = ["unstable_clickOnEnter", "unstable_clickOnSpace"];
function isNativeClick(event) {
var element = event.currentTarget;
if (!event.isTrusted) return false; // istanbul ignore next: can't test trusted events yet
return Object(reakit_utils_isButton__WEBPACK_IMPORTED_MODULE_4__[/* isButton */ "a"])(element) || element.tagName === "INPUT" || element.tagName === "TEXTAREA" || element.tagName === "A" || element.tagName === "SELECT";
}
var useClickable = Object(reakit_system_createHook__WEBPACK_IMPORTED_MODULE_2__[/* createHook */ "a"])({
name: "Clickable",
compose: _Tabbable_Tabbable_js__WEBPACK_IMPORTED_MODULE_8__[/* useTabbable */ "a"],
keys: CLICKABLE_KEYS,
useOptions: function useOptions(_ref) {
var _ref$unstable_clickOn = _ref.unstable_clickOnEnter,
unstable_clickOnEnter = _ref$unstable_clickOn === void 0 ? true : _ref$unstable_clickOn,
_ref$unstable_clickOn2 = _ref.unstable_clickOnSpace,
unstable_clickOnSpace = _ref$unstable_clickOn2 === void 0 ? true : _ref$unstable_clickOn2,
options = Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* _ */ "a"])(_ref, ["unstable_clickOnEnter", "unstable_clickOnSpace"]);
return Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({
unstable_clickOnEnter: unstable_clickOnEnter,
unstable_clickOnSpace: unstable_clickOnSpace
}, options);
},
useProps: function useProps(options, _ref2) {
var htmlOnKeyDown = _ref2.onKeyDown,
htmlOnKeyUp = _ref2.onKeyUp,
htmlProps = Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* _ */ "a"])(_ref2, ["onKeyDown", "onKeyUp"]);
var _React$useState = Object(react__WEBPACK_IMPORTED_MODULE_3__["useState"])(false),
active = _React$useState[0],
setActive = _React$useState[1];
var onKeyDownRef = Object(reakit_utils_useLiveRef__WEBPACK_IMPORTED_MODULE_6__[/* useLiveRef */ "a"])(htmlOnKeyDown);
var onKeyUpRef = Object(reakit_utils_useLiveRef__WEBPACK_IMPORTED_MODULE_6__[/* useLiveRef */ "a"])(htmlOnKeyUp);
var onKeyDown = Object(react__WEBPACK_IMPORTED_MODULE_3__["useCallback"])(function (event) {
var _onKeyDownRef$current;
(_onKeyDownRef$current = onKeyDownRef.current) === null || _onKeyDownRef$current === void 0 ? void 0 : _onKeyDownRef$current.call(onKeyDownRef, event);
if (event.defaultPrevented) return;
if (options.disabled) return;
if (event.metaKey) return;
if (!Object(reakit_utils_isSelfTarget__WEBPACK_IMPORTED_MODULE_7__[/* isSelfTarget */ "a"])(event)) return;
var isEnter = options.unstable_clickOnEnter && event.key === "Enter";
var isSpace = options.unstable_clickOnSpace && event.key === " ";
if (isEnter || isSpace) {
if (isNativeClick(event)) return;
event.preventDefault();
if (isEnter) {
event.currentTarget.click();
} else if (isSpace) {
setActive(true);
}
}
}, [options.disabled, options.unstable_clickOnEnter, options.unstable_clickOnSpace]);
var onKeyUp = Object(react__WEBPACK_IMPORTED_MODULE_3__["useCallback"])(function (event) {
var _onKeyUpRef$current;
(_onKeyUpRef$current = onKeyUpRef.current) === null || _onKeyUpRef$current === void 0 ? void 0 : _onKeyUpRef$current.call(onKeyUpRef, event);
if (event.defaultPrevented) return;
if (options.disabled) return;
if (event.metaKey) return;
var isSpace = options.unstable_clickOnSpace && event.key === " ";
if (active && isSpace) {
setActive(false);
event.currentTarget.click();
}
}, [options.disabled, options.unstable_clickOnSpace, active]);
return Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({
"data-active": active || undefined,
onKeyDown: onKeyDown,
onKeyUp: onKeyUp
}, htmlProps);
}
});
var Clickable = Object(reakit_system_createComponent__WEBPACK_IMPORTED_MODULE_1__[/* createComponent */ "a"])({
as: "button",
memo: true,
useHook: useClickable
});
/***/ }),
/***/ "JYkG":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* WEBPACK VAR INJECTION */(function(process) {/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId");
/* 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__("Z23Y");
/* harmony import */ var _wordpress_warning__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_warning__WEBPACK_IMPORTED_MODULE_1__);
/**
* WordPress dependencies
*/
const SlotFillContext = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createContext"])({
slots: {},
fills: {},
registerSlot: () => {
typeof process !== "undefined" && process.env && "production" !== "production" ? _wordpress_warning__WEBPACK_IMPORTED_MODULE_1___default()('Components must be wrapped within `SlotFillProvider`. ' + 'See https://developer.wordpress.org/block-editor/components/slot-fill/') : void 0;
},
updateSlot: () => {},
unregisterSlot: () => {},
registerFill: () => {},
unregisterFill: () => {}
});
/* harmony default export */ __webpack_exports__["a"] = (SlotFillContext);
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__("8oxB")))
/***/ }),
/***/ "Jt44":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
// TODO: remove, semver-major
module.exports = __webpack_require__("rZ7t");
/***/ }),
/***/ "Jx1U":
/***/ (function(module, exports) {
// Copyright (c) 2014 Rafael Caricio. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
var GradientParser = {};
GradientParser.parse = (function() {
var tokens = {
linearGradient: /^(\-(webkit|o|ms|moz)\-)?(linear\-gradient)/i,
repeatingLinearGradient: /^(\-(webkit|o|ms|moz)\-)?(repeating\-linear\-gradient)/i,
radialGradient: /^(\-(webkit|o|ms|moz)\-)?(radial\-gradient)/i,
repeatingRadialGradient: /^(\-(webkit|o|ms|moz)\-)?(repeating\-radial\-gradient)/i,
sideOrCorner: /^to (left (top|bottom)|right (top|bottom)|left|right|top|bottom)/i,
extentKeywords: /^(closest\-side|closest\-corner|farthest\-side|farthest\-corner|contain|cover)/,
positionKeywords: /^(left|center|right|top|bottom)/i,
pixelValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))px/,
percentageValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))\%/,
emValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))em/,
angleValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,
startCall: /^\(/,
endCall: /^\)/,
comma: /^,/,
hexColor: /^\#([0-9a-fA-F]+)/,
literalColor: /^([a-zA-Z]+)/,
rgbColor: /^rgb/i,
rgbaColor: /^rgba/i,
number: /^(([0-9]*\.[0-9]+)|([0-9]+\.?))/
};
var input = '';
function error(msg) {
var err = new Error(input + ': ' + msg);
err.source = input;
throw err;
}
function getAST() {
var ast = matchListDefinitions();
if (input.length > 0) {
error('Invalid input not EOF');
}
return ast;
}
function matchListDefinitions() {
return matchListing(matchDefinition);
}
function matchDefinition() {
return matchGradient(
'linear-gradient',
tokens.linearGradient,
matchLinearOrientation) ||
matchGradient(
'repeating-linear-gradient',
tokens.repeatingLinearGradient,
matchLinearOrientation) ||
matchGradient(
'radial-gradient',
tokens.radialGradient,
matchListRadialOrientations) ||
matchGradient(
'repeating-radial-gradient',
tokens.repeatingRadialGradient,
matchListRadialOrientations);
}
function matchGradient(gradientType, pattern, orientationMatcher) {
return matchCall(pattern, function(captures) {
var orientation = orientationMatcher();
if (orientation) {
if (!scan(tokens.comma)) {
error('Missing comma before color stops');
}
}
return {
type: gradientType,
orientation: orientation,
colorStops: matchListing(matchColorStop)
};
});
}
function matchCall(pattern, callback) {
var captures = scan(pattern);
if (captures) {
if (!scan(tokens.startCall)) {
error('Missing (');
}
result = callback(captures);
if (!scan(tokens.endCall)) {
error('Missing )');
}
return result;
}
}
function matchLinearOrientation() {
return matchSideOrCorner() ||
matchAngle();
}
function matchSideOrCorner() {
return match('directional', tokens.sideOrCorner, 1);
}
function matchAngle() {
return match('angular', tokens.angleValue, 1);
}
function matchListRadialOrientations() {
var radialOrientations,
radialOrientation = matchRadialOrientation(),
lookaheadCache;
if (radialOrientation) {
radialOrientations = [];
radialOrientations.push(radialOrientation);
lookaheadCache = input;
if (scan(tokens.comma)) {
radialOrientation = matchRadialOrientation();
if (radialOrientation) {
radialOrientations.push(radialOrientation);
} else {
input = lookaheadCache;
}
}
}
return radialOrientations;
}
function matchRadialOrientation() {
var radialType = matchCircle() ||
matchEllipse();
if (radialType) {
radialType.at = matchAtPosition();
} else {
var defaultPosition = matchPositioning();
if (defaultPosition) {
radialType = {
type: 'default-radial',
at: defaultPosition
};
}
}
return radialType;
}
function matchCircle() {
var circle = match('shape', /^(circle)/i, 0);
if (circle) {
circle.style = matchLength() || matchExtentKeyword();
}
return circle;
}
function matchEllipse() {
var ellipse = match('shape', /^(ellipse)/i, 0);
if (ellipse) {
ellipse.style = matchDistance() || matchExtentKeyword();
}
return ellipse;
}
function matchExtentKeyword() {
return match('extent-keyword', tokens.extentKeywords, 1);
}
function matchAtPosition() {
if (match('position', /^at/, 0)) {
var positioning = matchPositioning();
if (!positioning) {
error('Missing positioning value');
}
return positioning;
}
}
function matchPositioning() {
var location = matchCoordinates();
if (location.x || location.y) {
return {
type: 'position',
value: location
};
}
}
function matchCoordinates() {
return {
x: matchDistance(),
y: matchDistance()
};
}
function matchListing(matcher) {
var captures = matcher(),
result = [];
if (captures) {
result.push(captures);
while (scan(tokens.comma)) {
captures = matcher();
if (captures) {
result.push(captures);
} else {
error('One extra comma');
}
}
}
return result;
}
function matchColorStop() {
var color = matchColor();
if (!color) {
error('Expected color definition');
}
color.length = matchDistance();
return color;
}
function matchColor() {
return matchHexColor() ||
matchRGBAColor() ||
matchRGBColor() ||
matchLiteralColor();
}
function matchLiteralColor() {
return match('literal', tokens.literalColor, 0);
}
function matchHexColor() {
return match('hex', tokens.hexColor, 1);
}
function matchRGBColor() {
return matchCall(tokens.rgbColor, function() {
return {
type: 'rgb',
value: matchListing(matchNumber)
};
});
}
function matchRGBAColor() {
return matchCall(tokens.rgbaColor, function() {
return {
type: 'rgba',
value: matchListing(matchNumber)
};
});
}
function matchNumber() {
return scan(tokens.number)[1];
}
function matchDistance() {
return match('%', tokens.percentageValue, 1) ||
matchPositionKeyword() ||
matchLength();
}
function matchPositionKeyword() {
return match('position-keyword', tokens.positionKeywords, 1);
}
function matchLength() {
return match('px', tokens.pixelValue, 1) ||
match('em', tokens.emValue, 1);
}
function match(type, pattern, captureIndex) {
var captures = scan(pattern);
if (captures) {
return {
type: type,
value: captures[captureIndex]
};
}
}
function scan(regexp) {
var captures,
blankCaptures;
blankCaptures = /^[\n\r\t\s]+/.exec(input);
if (blankCaptures) {
consume(blankCaptures[0].length);
}
captures = regexp.exec(input);
if (captures) {
consume(captures[0].length);
}
return captures;
}
function consume(size) {
input = input.substr(size);
}
return function(code) {
input = code.toString();
return getAST();
};
})();
exports.parse = (GradientParser || {}).parse;
/***/ }),
/***/ "K+tz":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId");
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9");
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__);
/**
* WordPress dependencies
*/
const external = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], {
d: "M18.2 17c0 .7-.6 1.2-1.2 1.2H7c-.7 0-1.2-.6-1.2-1.2V7c0-.7.6-1.2 1.2-1.2h3.2V4.2H7C5.5 4.2 4.2 5.5 4.2 7v10c0 1.5 1.2 2.8 2.8 2.8h10c1.5 0 2.8-1.2 2.8-2.8v-3.6h-1.5V17zM14.9 3v1.5h3.7l-6.4 6.4 1.1 1.1 6.4-6.4v3.7h1.5V3h-6.3z"
}));
/* harmony default export */ __webpack_exports__["a"] = (external);
/***/ }),
/***/ "K9lf":
/***/ (function(module, exports) {
(function() { module.exports = window["wp"]["compose"]; }());
/***/ }),
/***/ "KA1K":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
// UNUSED EXPORTS: warning, useWarning
// EXTERNAL MODULE: ./node_modules/reakit-warning/es/warning.js
var warning = __webpack_require__("WnOg");
// EXTERNAL MODULE: external "React"
var external_React_ = __webpack_require__("cDcd");
// EXTERNAL MODULE: ./node_modules/reakit-utils/es/isObject.js
var isObject = __webpack_require__("Ptb8");
// CONCATENATED MODULE: ./node_modules/reakit-warning/es/useWarning.js
function isRefObject(ref) {
return Object(isObject["a" /* isObject */])(ref) && "current" in ref;
}
/**
* Logs `messages` to the console using `console.warn` based on a `condition`.
* This should be used inside components.
*/
function useWarning(condition) {
for (var _len = arguments.length, messages = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
messages[_key - 1] = arguments[_key];
}
if (false) {}
}
// CONCATENATED MODULE: ./node_modules/reakit-warning/es/index.js
/***/ }),
/***/ "KCH1":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return unstable_IdContext; });
/* unused harmony export unstable_IdProvider */
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("cDcd");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
var defaultPrefix = "id";
function generateRandomString(prefix) {
if (prefix === void 0) {
prefix = defaultPrefix;
}
return "" + (prefix ? prefix + "-" : "") + Math.random().toString(32).substr(2, 6);
}
var unstable_IdContext = /*#__PURE__*/Object(react__WEBPACK_IMPORTED_MODULE_0__["createContext"])(generateRandomString);
function unstable_IdProvider(_ref) {
var children = _ref.children,
_ref$prefix = _ref.prefix,
prefix = _ref$prefix === void 0 ? defaultPrefix : _ref$prefix;
var count = Object(react__WEBPACK_IMPORTED_MODULE_0__["useRef"])(0);
var generateId = Object(react__WEBPACK_IMPORTED_MODULE_0__["useCallback"])(function (localPrefix) {
if (localPrefix === void 0) {
localPrefix = prefix;
}
return "" + (localPrefix ? localPrefix + "-" : "") + ++count.current;
}, [prefix]);
return /*#__PURE__*/Object(react__WEBPACK_IMPORTED_MODULE_0__["createElement"])(unstable_IdContext.Provider, {
value: generateId
}, children);
}
/***/ }),
/***/ "KfNM":
/***/ (function(module, exports) {
/** Used for built-in method references. */
var objectProto = Object.prototype;
/**
* Used to resolve the
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
* of values.
*/
var nativeObjectToString = objectProto.toString;
/**
* Converts `value` to a string using `Object.prototype.toString`.
*
* @private
* @param {*} value The value to convert.
* @returns {string} Returns the converted string.
*/
function objectToString(value) {
return nativeObjectToString.call(value);
}
module.exports = objectToString;
/***/ }),
/***/ "Koq/":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var defineProperties = __webpack_require__("82c2");
var callBind = __webpack_require__("PrET");
var implementation = __webpack_require__("FufO");
var getPolyfill = __webpack_require__("yLpt");
var shim = __webpack_require__("8R9v");
var polyfill = callBind.apply(getPolyfill());
// eslint-disable-next-line no-unused-vars
var bound = function assign(target, source1) {
return polyfill(Object, arguments);
};
defineProperties(bound, {
getPolyfill: getPolyfill,
implementation: implementation,
shim: shim
});
module.exports = bound;
/***/ }),
/***/ "Kz5y":
/***/ (function(module, exports, __webpack_require__) {
var freeGlobal = __webpack_require__("WFqU");
/** Detect free variable `self`. */
var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
/** Used as a reference to the global object. */
var root = freeGlobal || freeSelf || Function('return this')();
module.exports = root;
/***/ }),
/***/ "L7Wv":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var toPrimitive = __webpack_require__("WZeS");
// https://ecma-international.org/ecma-262/6.0/#sec-toprimitive
module.exports = function ToPrimitive(input) {
if (arguments.length > 1) {
return toPrimitive(input, arguments[1]);
}
return toPrimitive(input);
};
/***/ }),
/***/ "L8Kx":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return getAnimateClassName; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Animate; });
/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("TSYQ");
/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_0__);
/**
* External dependencies
*/
/**
* @typedef {'top' | 'top left' | 'top right' | 'middle' | 'middle left' | 'middle right' | 'bottom' | 'bottom left' | 'bottom right'} AppearOrigin
* @typedef {'left' | 'right'} SlideInOrigin
* @typedef {{ type: 'appear'; origin?: AppearOrigin }} AppearOptions
* @typedef {{ type: 'slide-in'; origin?: SlideInOrigin }} SlideInOptions
* @typedef {{ type: 'loading'; }} LoadingOptions
* @typedef {AppearOptions | SlideInOptions | LoadingOptions} GetAnimateOptions
*/
/* eslint-disable jsdoc/valid-types */
/**
* @param {GetAnimateOptions['type']} type The animation type
* @return {'top' | 'left'} Default origin
*/
function getDefaultOrigin(type) {
return type === 'appear' ? 'top' : 'left';
}
/* eslint-enable jsdoc/valid-types */
/**
* @param {GetAnimateOptions} options
*
* @return {string | void} ClassName that applies the animations
*/
function getAnimateClassName(options) {
if (options.type === 'loading') {
return classnames__WEBPACK_IMPORTED_MODULE_0___default()('components-animate__loading');
}
const {
type,
origin = getDefaultOrigin(type)
} = options;
if (type === 'appear') {
const [yAxis, xAxis = 'center'] = origin.split(' ');
return classnames__WEBPACK_IMPORTED_MODULE_0___default()('components-animate__appear', {
['is-from-' + xAxis]: xAxis !== 'center',
['is-from-' + yAxis]: yAxis !== 'middle'
});
}
if (type === 'slide-in') {
return classnames__WEBPACK_IMPORTED_MODULE_0___default()('components-animate__slide-in', 'is-from-' + origin);
}
} // @ts-ignore Reason: Planned for deprecation
function Animate({
type,
options = {},
children
}) {
return children({
className: getAnimateClassName({
type,
...options
})
});
}
/***/ }),
/***/ "LTAC":
/***/ (function(module, exports) {
Object.defineProperty(exports, "__esModule", {
value: true
});
exports['default'] = isTouchDevice;
function isTouchDevice() {
return !!(typeof window !== 'undefined' && ('ontouchstart' in window || window.DocumentTouch && typeof document !== 'undefined' && document instanceof window.DocumentTouch)) || !!(typeof navigator !== 'undefined' && (navigator.maxTouchPoints || navigator.msMaxTouchPoints));
}
module.exports = exports['default'];
/***/ }),
/***/ "Lxf3":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var toStr = Object.prototype.toString;
var isPrimitive = __webpack_require__("Teho");
var isCallable = __webpack_require__("IdCN");
// http://ecma-international.org/ecma-262/5.1/#sec-8.12.8
var ES5internalSlots = {
'[[DefaultValue]]': function (O) {
var actualHint;
if (arguments.length > 1) {
actualHint = arguments[1];
} else {
actualHint = toStr.call(O) === '[object Date]' ? String : Number;
}
if (actualHint === String || actualHint === Number) {
var methods = actualHint === String ? ['toString', 'valueOf'] : ['valueOf', 'toString'];
var value, i;
for (i = 0; i < methods.length; ++i) {
if (isCallable(O[methods[i]])) {
value = O[methods[i]]();
if (isPrimitive(value)) {
return value;
}
}
}
throw new TypeError('No default value');
}
throw new TypeError('invalid [[DefaultValue]] hint supplied');
}
};
// http://ecma-international.org/ecma-262/5.1/#sec-9.1
module.exports = function ToPrimitive(input) {
if (isPrimitive(input)) {
return input;
}
if (arguments.length > 1) {
return ES5internalSlots['[[DefaultValue]]'](input, arguments[1]);
}
return ES5internalSlots['[[DefaultValue]]'](input);
};
/***/ }),
/***/ "MiSq":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
// 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);
}
/* 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
};
/* harmony default export */ var unitless_browser_esm = (unitlessKeys);
// EXTERNAL MODULE: ./node_modules/@emotion/memoize/dist/memoize.browser.esm.js
var memoize_browser_esm = __webpack_require__("4qRI");
// CONCATENATED MODULE: ./node_modules/@emotion/serialize/dist/serialize.browser.esm.js
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;
var isCustomProperty = function isCustomProperty(property) {
return property.charCodeAt(1) === 45;
};
var isProcessableValue = function isProcessableValue(value) {
return value != null && typeof value !== 'boolean';
};
var processStyleName = Object(memoize_browser_esm["a" /* default */])(function (styleName) {
return isCustomProperty(styleName) ? styleName : styleName.replace(hyphenateRegex, '-$&').toLowerCase();
});
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;
});
}
}
}
if (unitless_browser_esm[key] !== 1 && !isCustomProperty(key) && typeof value === 'number' && value !== 0) {
return value + 'px';
}
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);
}
case 'function':
{
if (mergedProps !== undefined) {
var previousCursor = cursor;
var result = interpolation(mergedProps);
cursor = previousCursor;
return handleInterpolation(mergedProps, registered, result, couldBeSelectorInterpolation);
} else if (false) {}
break;
}
case 'string':
if (false) { var replaced, matched; }
break;
} // finalize string values (regular strings and functions interpolated into css calls)
if (registered == null) {
return interpolation;
}
var cached = registered[interpolation];
if (false) {}
return cached !== undefined && !couldBeSelectorInterpolation ? cached : interpolation;
}
function createStringFromObject(mergedProps, registered, obj) {
var string = '';
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.');
}
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]) + ";";
}
}
} 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 + "}";
}
}
}
}
}
}
return string;
}
var labelPattern = /label:\s*([^\s;\n{]+)\s*;/g;
var sourceMapPattern;
if (false) {} // this is the cursor for keyframes
// keyframes are stored on the SerializedStyles object as a linked list
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];
}
var stringMode = true;
var styles = '';
cursor = undefined;
var strings = args[0];
if (strings == null || strings.raw === undefined) {
stringMode = false;
styles += handleInterpolation(mergedProps, registered, strings, false);
} else {
if (false) {}
styles += strings[0];
} // we start at 1 since we've already handled the first arg
for (var i = 1; i < args.length; i++) {
styles += handleInterpolation(mergedProps, registered, args[i], styles.charCodeAt(styles.length - 1) === 46);
if (stringMode) {
if (false) {}
styles += strings[i];
}
}
var sourceMap;
if (false) {} // using a global regex with .exec is stateful so lastIndex has to be reset each time
labelPattern.lastIndex = 0;
var identifierName = '';
var match; // https://esbench.com/bench/5b809c2cf2949800a0f61fb5
while ((match = labelPattern.exec(styles)) !== null) {
identifierName += '-' + // $FlowFixMe we know it's not null
match[1];
}
var name = hash_browser_esm(styles) + identifierName;
if (false) {}
return {
name: name,
styles: styles,
next: cursor
};
};
/***/ }),
/***/ "Mih7":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return hasUserFocus; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return setUserFocus; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return userFocus; });
function userFocus(element) {
element.userFocus = true;
element.focus();
element.userFocus = false;
}
function hasUserFocus(element) {
return !!element.userFocus;
}
function setUserFocus(element, value) {
element.userFocus = value;
}
/***/ }),
/***/ "Mp0b":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId");
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9");
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__);
/**
* WordPress dependencies
*/
const linkOff = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], {
d: "M15.6 7.3h-.7l1.6-3.5-.9-.4-3.9 8.5H9v1.5h2l-1.3 2.8H8.4c-2 0-3.7-1.7-3.7-3.7s1.7-3.7 3.7-3.7H10V7.3H8.4c-2.9 0-5.2 2.3-5.2 5.2 0 2.9 2.3 5.2 5.2 5.2H9l-1.4 3.2.9.4 5.7-12.5h1.4c2 0 3.7 1.7 3.7 3.7s-1.7 3.7-3.7 3.7H14v1.5h1.6c2.9 0 5.2-2.3 5.2-5.2 0-2.9-2.4-5.2-5.2-5.2z"
}));
/* harmony default export */ __webpack_exports__["a"] = (linkOff);
/***/ }),
/***/ "N3k4":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.PureCalendarDay = undefined;
var _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; };
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _object = __webpack_require__("Koq/");
var _object2 = _interopRequireDefault(_object);
var _react = __webpack_require__("cDcd");
var _react2 = _interopRequireDefault(_react);
var _propTypes = __webpack_require__("17x9");
var _propTypes2 = _interopRequireDefault(_propTypes);
var _reactAddonsShallowCompare = __webpack_require__("YZDV");
var _reactAddonsShallowCompare2 = _interopRequireDefault(_reactAddonsShallowCompare);
var _reactMomentProptypes = __webpack_require__("XGBb");
var _reactMomentProptypes2 = _interopRequireDefault(_reactMomentProptypes);
var _airbnbPropTypes = __webpack_require__("Hsqg");
var _reactWithStyles = __webpack_require__("TG4+");
var _moment = __webpack_require__("wy2R");
var _moment2 = _interopRequireDefault(_moment);
var _defaultPhrases = __webpack_require__("vV+G");
var _getPhrasePropTypes = __webpack_require__("yc2e");
var _getPhrasePropTypes2 = _interopRequireDefault(_getPhrasePropTypes);
var _getCalendarDaySettings = __webpack_require__("Ae65");
var _getCalendarDaySettings2 = _interopRequireDefault(_getCalendarDaySettings);
var _ModifiersShape = __webpack_require__("J7JS");
var _ModifiersShape2 = _interopRequireDefault(_ModifiersShape);
var _constants = __webpack_require__("Fv1B");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var propTypes = (0, _airbnbPropTypes.forbidExtraProps)((0, _object2['default'])({}, _reactWithStyles.withStylesPropTypes, {
day: _reactMomentProptypes2['default'].momentObj,
daySize: _airbnbPropTypes.nonNegativeInteger,
isOutsideDay: _propTypes2['default'].bool,
modifiers: _ModifiersShape2['default'],
isFocused: _propTypes2['default'].bool,
tabIndex: _propTypes2['default'].oneOf([0, -1]),
onDayClick: _propTypes2['default'].func,
onDayMouseEnter: _propTypes2['default'].func,
onDayMouseLeave: _propTypes2['default'].func,
renderDayContents: _propTypes2['default'].func,
ariaLabelFormat: _propTypes2['default'].string,
// internationalization
phrases: _propTypes2['default'].shape((0, _getPhrasePropTypes2['default'])(_defaultPhrases.CalendarDayPhrases))
}));
var defaultProps = {
day: (0, _moment2['default'])(),
daySize: _constants.DAY_SIZE,
isOutsideDay: false,
modifiers: new Set(),
isFocused: false,
tabIndex: -1,
onDayClick: function () {
function onDayClick() {}
return onDayClick;
}(),
onDayMouseEnter: function () {
function onDayMouseEnter() {}
return onDayMouseEnter;
}(),
onDayMouseLeave: function () {
function onDayMouseLeave() {}
return onDayMouseLeave;
}(),
renderDayContents: null,
ariaLabelFormat: 'dddd, LL',
// internationalization
phrases: _defaultPhrases.CalendarDayPhrases
};
var CalendarDay = function (_React$Component) {
_inherits(CalendarDay, _React$Component);
function CalendarDay() {
var _ref;
_classCallCheck(this, CalendarDay);
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
var _this = _possibleConstructorReturn(this, (_ref = CalendarDay.__proto__ || Object.getPrototypeOf(CalendarDay)).call.apply(_ref, [this].concat(args)));
_this.setButtonRef = _this.setButtonRef.bind(_this);
return _this;
}
_createClass(CalendarDay, [{
key: 'shouldComponentUpdate',
value: function () {
function shouldComponentUpdate(nextProps, nextState) {
return (0, _reactAddonsShallowCompare2['default'])(this, nextProps, nextState);
}
return shouldComponentUpdate;
}()
}, {
key: 'componentDidUpdate',
value: function () {
function componentDidUpdate(prevProps) {
var _props = this.props,
isFocused = _props.isFocused,
tabIndex = _props.tabIndex;
if (tabIndex === 0) {
if (isFocused || tabIndex !== prevProps.tabIndex) {
this.buttonRef.focus();
}
}
}
return componentDidUpdate;
}()
}, {
key: 'onDayClick',
value: function () {
function onDayClick(day, e) {
var onDayClick = this.props.onDayClick;
onDayClick(day, e);
}
return onDayClick;
}()
}, {
key: 'onDayMouseEnter',
value: function () {
function onDayMouseEnter(day, e) {
var onDayMouseEnter = this.props.onDayMouseEnter;
onDayMouseEnter(day, e);
}
return onDayMouseEnter;
}()
}, {
key: 'onDayMouseLeave',
value: function () {
function onDayMouseLeave(day, e) {
var onDayMouseLeave = this.props.onDayMouseLeave;
onDayMouseLeave(day, e);
}
return onDayMouseLeave;
}()
}, {
key: 'onKeyDown',
value: function () {
function onKeyDown(day, e) {
var onDayClick = this.props.onDayClick;
var key = e.key;
if (key === 'Enter' || key === ' ') {
onDayClick(day, e);
}
}
return onKeyDown;
}()
}, {
key: 'setButtonRef',
value: function () {
function setButtonRef(ref) {
this.buttonRef = ref;
}
return setButtonRef;
}()
}, {
key: 'render',
value: function () {
function render() {
var _this2 = this;
var _props2 = this.props,
day = _props2.day,
ariaLabelFormat = _props2.ariaLabelFormat,
daySize = _props2.daySize,
isOutsideDay = _props2.isOutsideDay,
modifiers = _props2.modifiers,
renderDayContents = _props2.renderDayContents,
tabIndex = _props2.tabIndex,
styles = _props2.styles,
phrases = _props2.phrases;
if (!day) return _react2['default'].createElement('td', null);
var _getCalendarDaySettin = (0, _getCalendarDaySettings2['default'])(day, ariaLabelFormat, daySize, modifiers, phrases),
daySizeStyles = _getCalendarDaySettin.daySizeStyles,
useDefaultCursor = _getCalendarDaySettin.useDefaultCursor,
selected = _getCalendarDaySettin.selected,
hoveredSpan = _getCalendarDaySettin.hoveredSpan,
isOutsideRange = _getCalendarDaySettin.isOutsideRange,
ariaLabel = _getCalendarDaySettin.ariaLabel;
return _react2['default'].createElement(
'td',
_extends({}, (0, _reactWithStyles.css)(styles.CalendarDay, useDefaultCursor && styles.CalendarDay__defaultCursor, styles.CalendarDay__default, isOutsideDay && styles.CalendarDay__outside, modifiers.has('today') && styles.CalendarDay__today, modifiers.has('first-day-of-week') && styles.CalendarDay__firstDayOfWeek, modifiers.has('last-day-of-week') && styles.CalendarDay__lastDayOfWeek, modifiers.has('hovered-offset') && styles.CalendarDay__hovered_offset, modifiers.has('highlighted-calendar') && styles.CalendarDay__highlighted_calendar, modifiers.has('blocked-minimum-nights') && styles.CalendarDay__blocked_minimum_nights, modifiers.has('blocked-calendar') && styles.CalendarDay__blocked_calendar, hoveredSpan && styles.CalendarDay__hovered_span, modifiers.has('selected-span') && styles.CalendarDay__selected_span, modifiers.has('last-in-range') && styles.CalendarDay__last_in_range, modifiers.has('selected-start') && styles.CalendarDay__selected_start, modifiers.has('selected-end') && styles.CalendarDay__selected_end, selected && styles.CalendarDay__selected, isOutsideRange && styles.CalendarDay__blocked_out_of_range, daySizeStyles), {
role: 'button' // eslint-disable-line jsx-a11y/no-noninteractive-element-to-interactive-role
, ref: this.setButtonRef,
'aria-label': ariaLabel,
onMouseEnter: function () {
function onMouseEnter(e) {
_this2.onDayMouseEnter(day, e);
}
return onMouseEnter;
}(),
onMouseLeave: function () {
function onMouseLeave(e) {
_this2.onDayMouseLeave(day, e);
}
return onMouseLeave;
}(),
onMouseUp: function () {
function onMouseUp(e) {
e.currentTarget.blur();
}
return onMouseUp;
}(),
onClick: function () {
function onClick(e) {
_this2.onDayClick(day, e);
}
return onClick;
}(),
onKeyDown: function () {
function onKeyDown(e) {
_this2.onKeyDown(day, e);
}
return onKeyDown;
}(),
tabIndex: tabIndex
}),
renderDayContents ? renderDayContents(day, modifiers) : day.format('D')
);
}
return render;
}()
}]);
return CalendarDay;
}(_react2['default'].Component);
CalendarDay.propTypes = propTypes;
CalendarDay.defaultProps = defaultProps;
exports.PureCalendarDay = CalendarDay;
exports['default'] = (0, _reactWithStyles.withStyles)(function (_ref2) {
var _ref2$reactDates = _ref2.reactDates,
color = _ref2$reactDates.color,
font = _ref2$reactDates.font;
return {
CalendarDay: {
boxSizing: 'border-box',
cursor: 'pointer',
fontSize: font.size,
textAlign: 'center',
':active': {
outline: 0
}
},
CalendarDay__defaultCursor: {
cursor: 'default'
},
CalendarDay__default: {
border: '1px solid ' + String(color.core.borderLight),
color: color.text,
background: color.background,
':hover': {
background: color.core.borderLight,
border: '1px double ' + String(color.core.borderLight),
color: 'inherit'
}
},
CalendarDay__hovered_offset: {
background: color.core.borderBright,
border: '1px double ' + String(color.core.borderLight),
color: 'inherit'
},
CalendarDay__outside: {
border: 0,
background: color.outside.backgroundColor,
color: color.outside.color,
':hover': {
border: 0
}
},
CalendarDay__blocked_minimum_nights: {
background: color.minimumNights.backgroundColor,
border: '1px solid ' + String(color.minimumNights.borderColor),
color: color.minimumNights.color,
':hover': {
background: color.minimumNights.backgroundColor_hover,
color: color.minimumNights.color_active
},
':active': {
background: color.minimumNights.backgroundColor_active,
color: color.minimumNights.color_active
}
},
CalendarDay__highlighted_calendar: {
background: color.highlighted.backgroundColor,
color: color.highlighted.color,
':hover': {
background: color.highlighted.backgroundColor_hover,
color: color.highlighted.color_active
},
':active': {
background: color.highlighted.backgroundColor_active,
color: color.highlighted.color_active
}
},
CalendarDay__selected_span: {
background: color.selectedSpan.backgroundColor,
border: '1px solid ' + String(color.selectedSpan.borderColor),
color: color.selectedSpan.color,
':hover': {
background: color.selectedSpan.backgroundColor_hover,
border: '1px solid ' + String(color.selectedSpan.borderColor),
color: color.selectedSpan.color_active
},
':active': {
background: color.selectedSpan.backgroundColor_active,
border: '1px solid ' + String(color.selectedSpan.borderColor),
color: color.selectedSpan.color_active
}
},
CalendarDay__last_in_range: {
borderRight: color.core.primary
},
CalendarDay__selected: {
background: color.selected.backgroundColor,
border: '1px solid ' + String(color.selected.borderColor),
color: color.selected.color,
':hover': {
background: color.selected.backgroundColor_hover,
border: '1px solid ' + String(color.selected.borderColor),
color: color.selected.color_active
},
':active': {
background: color.selected.backgroundColor_active,
border: '1px solid ' + String(color.selected.borderColor),
color: color.selected.color_active
}
},
CalendarDay__hovered_span: {
background: color.hoveredSpan.backgroundColor,
border: '1px solid ' + String(color.hoveredSpan.borderColor),
color: color.hoveredSpan.color,
':hover': {
background: color.hoveredSpan.backgroundColor_hover,
border: '1px solid ' + String(color.hoveredSpan.borderColor),
color: color.hoveredSpan.color_active
},
':active': {
background: color.hoveredSpan.backgroundColor_active,
border: '1px solid ' + String(color.hoveredSpan.borderColor),
color: color.hoveredSpan.color_active
}
},
CalendarDay__blocked_calendar: {
background: color.blocked_calendar.backgroundColor,
border: '1px solid ' + String(color.blocked_calendar.borderColor),
color: color.blocked_calendar.color,
':hover': {
background: color.blocked_calendar.backgroundColor_hover,
border: '1px solid ' + String(color.blocked_calendar.borderColor),
color: color.blocked_calendar.color_active
},
':active': {
background: color.blocked_calendar.backgroundColor_active,
border: '1px solid ' + String(color.blocked_calendar.borderColor),
color: color.blocked_calendar.color_active
}
},
CalendarDay__blocked_out_of_range: {
background: color.blocked_out_of_range.backgroundColor,
border: '1px solid ' + String(color.blocked_out_of_range.borderColor),
color: color.blocked_out_of_range.color,
':hover': {
background: color.blocked_out_of_range.backgroundColor_hover,
border: '1px solid ' + String(color.blocked_out_of_range.borderColor),
color: color.blocked_out_of_range.color_active
},
':active': {
background: color.blocked_out_of_range.backgroundColor_active,
border: '1px solid ' + String(color.blocked_out_of_range.borderColor),
color: color.blocked_out_of_range.color_active
}
},
CalendarDay__selected_start: {},
CalendarDay__selected_end: {},
CalendarDay__today: {},
CalendarDay__firstDayOfWeek: {},
CalendarDay__lastDayOfWeek: {}
};
})(CalendarDay);
/***/ }),
/***/ "NMb1":
/***/ (function(module, exports) {
(function() { module.exports = window["wp"]["deprecated"]; }());
/***/ }),
/***/ "NTP4":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId");
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9");
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__);
/**
* WordPress dependencies
*/
const upload = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], {
d: "M18.5 15v3.5H13V6.7l4.5 4.1 1-1.1-6.2-5.8-5.8 5.8 1 1.1 4-4v11.7h-6V15H4v5h16v-5z"
}));
/* harmony default export */ __webpack_exports__["a"] = (upload);
/***/ }),
/***/ "NWDH":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId");
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9");
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__);
/**
* WordPress dependencies
*/
const chevronDown = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], {
viewBox: "0 0 24 24",
xmlns: "http://www.w3.org/2000/svg"
}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], {
d: "M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z"
}));
/* harmony default export */ __webpack_exports__["a"] = (chevronDown);
/***/ }),
/***/ "Nho6":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports['default'] = isAfterDay;
var _moment = __webpack_require__("wy2R");
var _moment2 = _interopRequireDefault(_moment);
var _isBeforeDay = __webpack_require__("h6xH");
var _isBeforeDay2 = _interopRequireDefault(_isBeforeDay);
var _isSameDay = __webpack_require__("pRvc");
var _isSameDay2 = _interopRequireDefault(_isSameDay);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function isAfterDay(a, b) {
if (!_moment2['default'].isMoment(a) || !_moment2['default'].isMoment(b)) return false;
return !(0, _isBeforeDay2['default'])(a, b) && !(0, _isSameDay2['default'])(a, b);
}
/***/ }),
/***/ "Nloh":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.PureDayPicker = exports.defaultProps = undefined;
var _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; };
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _object = __webpack_require__("Koq/");
var _object2 = _interopRequireDefault(_object);
var _react = __webpack_require__("cDcd");
var _react2 = _interopRequireDefault(_react);
var _propTypes = __webpack_require__("17x9");
var _propTypes2 = _interopRequireDefault(_propTypes);
var _reactAddonsShallowCompare = __webpack_require__("YZDV");
var _reactAddonsShallowCompare2 = _interopRequireDefault(_reactAddonsShallowCompare);
var _airbnbPropTypes = __webpack_require__("Hsqg");
var _reactWithStyles = __webpack_require__("TG4+");
var _moment = __webpack_require__("wy2R");
var _moment2 = _interopRequireDefault(_moment);
var _throttle = __webpack_require__("DzJC");
var _throttle2 = _interopRequireDefault(_throttle);
var _isTouchDevice = __webpack_require__("LTAC");
var _isTouchDevice2 = _interopRequireDefault(_isTouchDevice);
var _reactOutsideClickHandler = __webpack_require__("3gBW");
var _reactOutsideClickHandler2 = _interopRequireDefault(_reactOutsideClickHandler);
var _defaultPhrases = __webpack_require__("vV+G");
var _getPhrasePropTypes = __webpack_require__("yc2e");
var _getPhrasePropTypes2 = _interopRequireDefault(_getPhrasePropTypes);
var _CalendarMonthGrid = __webpack_require__("Thzv");
var _CalendarMonthGrid2 = _interopRequireDefault(_CalendarMonthGrid);
var _DayPickerNavigation = __webpack_require__("zfJ5");
var _DayPickerNavigation2 = _interopRequireDefault(_DayPickerNavigation);
var _DayPickerKeyboardShortcuts = __webpack_require__("1+Kn");
var _DayPickerKeyboardShortcuts2 = _interopRequireDefault(_DayPickerKeyboardShortcuts);
var _getNumberOfCalendarMonthWeeks = __webpack_require__("0Dl3");
var _getNumberOfCalendarMonthWeeks2 = _interopRequireDefault(_getNumberOfCalendarMonthWeeks);
var _getCalendarMonthWidth = __webpack_require__("m2ax");
var _getCalendarMonthWidth2 = _interopRequireDefault(_getCalendarMonthWidth);
var _calculateDimension = __webpack_require__("ixyq");
var _calculateDimension2 = _interopRequireDefault(_calculateDimension);
var _getActiveElement = __webpack_require__("+51k");
var _getActiveElement2 = _interopRequireDefault(_getActiveElement);
var _isDayVisible = __webpack_require__("IgE5");
var _isDayVisible2 = _interopRequireDefault(_isDayVisible);
var _ModifiersShape = __webpack_require__("J7JS");
var _ModifiersShape2 = _interopRequireDefault(_ModifiersShape);
var _ScrollableOrientationShape = __webpack_require__("aE6U");
var _ScrollableOrientationShape2 = _interopRequireDefault(_ScrollableOrientationShape);
var _DayOfWeekShape = __webpack_require__("2S2E");
var _DayOfWeekShape2 = _interopRequireDefault(_DayOfWeekShape);
var _CalendarInfoPositionShape = __webpack_require__("oR9Z");
var _CalendarInfoPositionShape2 = _interopRequireDefault(_CalendarInfoPositionShape);
var _constants = __webpack_require__("Fv1B");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var MONTH_PADDING = 23;
var PREV_TRANSITION = 'prev';
var NEXT_TRANSITION = 'next';
var MONTH_SELECTION_TRANSITION = 'month_selection';
var YEAR_SELECTION_TRANSITION = 'year_selection';
var propTypes = (0, _airbnbPropTypes.forbidExtraProps)((0, _object2['default'])({}, _reactWithStyles.withStylesPropTypes, {
// calendar presentation props
enableOutsideDays: _propTypes2['default'].bool,
numberOfMonths: _propTypes2['default'].number,
orientation: _ScrollableOrientationShape2['default'],
withPortal: _propTypes2['default'].bool,
onOutsideClick: _propTypes2['default'].func,
hidden: _propTypes2['default'].bool,
initialVisibleMonth: _propTypes2['default'].func,
firstDayOfWeek: _DayOfWeekShape2['default'],
renderCalendarInfo: _propTypes2['default'].func,
calendarInfoPosition: _CalendarInfoPositionShape2['default'],
hideKeyboardShortcutsPanel: _propTypes2['default'].bool,
daySize: _airbnbPropTypes.nonNegativeInteger,
isRTL: _propTypes2['default'].bool,
verticalHeight: _airbnbPropTypes.nonNegativeInteger,
noBorder: _propTypes2['default'].bool,
transitionDuration: _airbnbPropTypes.nonNegativeInteger,
verticalBorderSpacing: _airbnbPropTypes.nonNegativeInteger,
horizontalMonthPadding: _airbnbPropTypes.nonNegativeInteger,
// navigation props
navPrev: _propTypes2['default'].node,
navNext: _propTypes2['default'].node,
noNavButtons: _propTypes2['default'].bool,
onPrevMonthClick: _propTypes2['default'].func,
onNextMonthClick: _propTypes2['default'].func,
onMonthChange: _propTypes2['default'].func,
onYearChange: _propTypes2['default'].func,
onMultiplyScrollableMonths: _propTypes2['default'].func, // VERTICAL_SCROLLABLE daypickers only
// month props
renderMonthText: (0, _airbnbPropTypes.mutuallyExclusiveProps)(_propTypes2['default'].func, 'renderMonthText', 'renderMonthElement'),
renderMonthElement: (0, _airbnbPropTypes.mutuallyExclusiveProps)(_propTypes2['default'].func, 'renderMonthText', 'renderMonthElement'),
// day props
modifiers: _propTypes2['default'].objectOf(_propTypes2['default'].objectOf(_ModifiersShape2['default'])),
renderCalendarDay: _propTypes2['default'].func,
renderDayContents: _propTypes2['default'].func,
onDayClick: _propTypes2['default'].func,
onDayMouseEnter: _propTypes2['default'].func,
onDayMouseLeave: _propTypes2['default'].func,
// accessibility props
isFocused: _propTypes2['default'].bool,
getFirstFocusableDay: _propTypes2['default'].func,
onBlur: _propTypes2['default'].func,
showKeyboardShortcuts: _propTypes2['default'].bool,
// internationalization
monthFormat: _propTypes2['default'].string,
weekDayFormat: _propTypes2['default'].string,
phrases: _propTypes2['default'].shape((0, _getPhrasePropTypes2['default'])(_defaultPhrases.DayPickerPhrases)),
dayAriaLabelFormat: _propTypes2['default'].string
}));
var defaultProps = exports.defaultProps = {
// calendar presentation props
enableOutsideDays: false,
numberOfMonths: 2,
orientation: _constants.HORIZONTAL_ORIENTATION,
withPortal: false,
onOutsideClick: function () {
function onOutsideClick() {}
return onOutsideClick;
}(),
hidden: false,
initialVisibleMonth: function () {
function initialVisibleMonth() {
return (0, _moment2['default'])();
}
return initialVisibleMonth;
}(),
firstDayOfWeek: null,
renderCalendarInfo: null,
calendarInfoPosition: _constants.INFO_POSITION_BOTTOM,
hideKeyboardShortcutsPanel: false,
daySize: _constants.DAY_SIZE,
isRTL: false,
verticalHeight: null,
noBorder: false,
transitionDuration: undefined,
verticalBorderSpacing: undefined,
horizontalMonthPadding: 13,
// navigation props
navPrev: null,
navNext: null,
noNavButtons: false,
onPrevMonthClick: function () {
function onPrevMonthClick() {}
return onPrevMonthClick;
}(),
onNextMonthClick: function () {
function onNextMonthClick() {}
return onNextMonthClick;
}(),
onMonthChange: function () {
function onMonthChange() {}
return onMonthChange;
}(),
onYearChange: function () {
function onYearChange() {}
return onYearChange;
}(),
onMultiplyScrollableMonths: function () {
function onMultiplyScrollableMonths() {}
return onMultiplyScrollableMonths;
}(),
// month props
renderMonthText: null,
renderMonthElement: null,
// day props
modifiers: {},
renderCalendarDay: undefined,
renderDayContents: null,
onDayClick: function () {
function onDayClick() {}
return onDayClick;
}(),
onDayMouseEnter: function () {
function onDayMouseEnter() {}
return onDayMouseEnter;
}(),
onDayMouseLeave: function () {
function onDayMouseLeave() {}
return onDayMouseLeave;
}(),
// accessibility props
isFocused: false,
getFirstFocusableDay: null,
onBlur: function () {
function onBlur() {}
return onBlur;
}(),
showKeyboardShortcuts: false,
// internationalization
monthFormat: 'MMMM YYYY',
weekDayFormat: 'dd',
phrases: _defaultPhrases.DayPickerPhrases,
dayAriaLabelFormat: undefined
};
var DayPicker = function (_React$Component) {
_inherits(DayPicker, _React$Component);
function DayPicker(props) {
_classCallCheck(this, DayPicker);
var _this = _possibleConstructorReturn(this, (DayPicker.__proto__ || Object.getPrototypeOf(DayPicker)).call(this, props));
var currentMonth = props.hidden ? (0, _moment2['default'])() : props.initialVisibleMonth();
var focusedDate = currentMonth.clone().startOf('month');
if (props.getFirstFocusableDay) {
focusedDate = props.getFirstFocusableDay(currentMonth);
}
var horizontalMonthPadding = props.horizontalMonthPadding;
var translationValue = props.isRTL && _this.isHorizontal() ? -(0, _getCalendarMonthWidth2['default'])(props.daySize, horizontalMonthPadding) : 0;
_this.hasSetInitialVisibleMonth = !props.hidden;
_this.state = {
currentMonth: currentMonth,
monthTransition: null,
translationValue: translationValue,
scrollableMonthMultiple: 1,
calendarMonthWidth: (0, _getCalendarMonthWidth2['default'])(props.daySize, horizontalMonthPadding),
focusedDate: !props.hidden || props.isFocused ? focusedDate : null,
nextFocusedDate: null,
showKeyboardShortcuts: props.showKeyboardShortcuts,
onKeyboardShortcutsPanelClose: function () {
function onKeyboardShortcutsPanelClose() {}
return onKeyboardShortcutsPanelClose;
}(),
isTouchDevice: (0, _isTouchDevice2['default'])(),
withMouseInteractions: true,
calendarInfoWidth: 0,
monthTitleHeight: null,
hasSetHeight: false
};
_this.setCalendarMonthWeeks(currentMonth);
_this.calendarMonthGridHeight = 0;
_this.setCalendarInfoWidthTimeout = null;
_this.onKeyDown = _this.onKeyDown.bind(_this);
_this.throttledKeyDown = (0, _throttle2['default'])(_this.onFinalKeyDown, 200, { trailing: false });
_this.onPrevMonthClick = _this.onPrevMonthClick.bind(_this);
_this.onNextMonthClick = _this.onNextMonthClick.bind(_this);
_this.onMonthChange = _this.onMonthChange.bind(_this);
_this.onYearChange = _this.onYearChange.bind(_this);
_this.multiplyScrollableMonths = _this.multiplyScrollableMonths.bind(_this);
_this.updateStateAfterMonthTransition = _this.updateStateAfterMonthTransition.bind(_this);
_this.openKeyboardShortcutsPanel = _this.openKeyboardShortcutsPanel.bind(_this);
_this.closeKeyboardShortcutsPanel = _this.closeKeyboardShortcutsPanel.bind(_this);
_this.setCalendarInfoRef = _this.setCalendarInfoRef.bind(_this);
_this.setContainerRef = _this.setContainerRef.bind(_this);
_this.setTransitionContainerRef = _this.setTransitionContainerRef.bind(_this);
_this.setMonthTitleHeight = _this.setMonthTitleHeight.bind(_this);
return _this;
}
_createClass(DayPicker, [{
key: 'componentDidMount',
value: function () {
function componentDidMount() {
var currentMonth = this.state.currentMonth;
if (this.calendarInfo) {
this.setState({
isTouchDevice: (0, _isTouchDevice2['default'])(),
calendarInfoWidth: (0, _calculateDimension2['default'])(this.calendarInfo, 'width', true, true)
});
} else {
this.setState({ isTouchDevice: (0, _isTouchDevice2['default'])() });
}
this.setCalendarMonthWeeks(currentMonth);
}
return componentDidMount;
}()
}, {
key: 'componentWillReceiveProps',
value: function () {
function componentWillReceiveProps(nextProps) {
var hidden = nextProps.hidden,
isFocused = nextProps.isFocused,
showKeyboardShortcuts = nextProps.showKeyboardShortcuts,
onBlur = nextProps.onBlur,
renderMonthText = nextProps.renderMonthText,
horizontalMonthPadding = nextProps.horizontalMonthPadding;
var currentMonth = this.state.currentMonth;
if (!hidden) {
if (!this.hasSetInitialVisibleMonth) {
this.hasSetInitialVisibleMonth = true;
this.setState({
currentMonth: nextProps.initialVisibleMonth()
});
}
}
var _props = this.props,
daySize = _props.daySize,
prevIsFocused = _props.isFocused,
prevRenderMonthText = _props.renderMonthText;
if (nextProps.daySize !== daySize) {
this.setState({
calendarMonthWidth: (0, _getCalendarMonthWidth2['default'])(nextProps.daySize, horizontalMonthPadding)
});
}
if (isFocused !== prevIsFocused) {
if (isFocused) {
var focusedDate = this.getFocusedDay(currentMonth);
var onKeyboardShortcutsPanelClose = this.state.onKeyboardShortcutsPanelClose;
if (nextProps.showKeyboardShortcuts) {
// the ? shortcut came from the input and we should return input there once it is close
onKeyboardShortcutsPanelClose = onBlur;
}
this.setState({
showKeyboardShortcuts: showKeyboardShortcuts,
onKeyboardShortcutsPanelClose: onKeyboardShortcutsPanelClose,
focusedDate: focusedDate,
withMouseInteractions: false
});
} else {
this.setState({ focusedDate: null });
}
}
if (renderMonthText !== prevRenderMonthText) {
this.setState({
monthTitleHeight: null
});
}
}
return componentWillReceiveProps;
}()
}, {
key: 'shouldComponentUpdate',
value: function () {
function shouldComponentUpdate(nextProps, nextState) {
return (0, _reactAddonsShallowCompare2['default'])(this, nextProps, nextState);
}
return shouldComponentUpdate;
}()
}, {
key: 'componentWillUpdate',
value: function () {
function componentWillUpdate() {
var _this2 = this;
var transitionDuration = this.props.transitionDuration;
// Calculating the dimensions trigger a DOM repaint which
// breaks the CSS transition.
// The setTimeout will wait until the transition ends.
if (this.calendarInfo) {
this.setCalendarInfoWidthTimeout = setTimeout(function () {
var calendarInfoWidth = _this2.state.calendarInfoWidth;
var calendarInfoPanelWidth = (0, _calculateDimension2['default'])(_this2.calendarInfo, 'width', true, true);
if (calendarInfoWidth !== calendarInfoPanelWidth) {
_this2.setState({
calendarInfoWidth: calendarInfoPanelWidth
});
}
}, transitionDuration);
}
}
return componentWillUpdate;
}()
}, {
key: 'componentDidUpdate',
value: function () {
function componentDidUpdate(prevProps) {
var _props2 = this.props,
orientation = _props2.orientation,
daySize = _props2.daySize,
isFocused = _props2.isFocused,
numberOfMonths = _props2.numberOfMonths;
var _state = this.state,
focusedDate = _state.focusedDate,
monthTitleHeight = _state.monthTitleHeight;
if (this.isHorizontal() && (orientation !== prevProps.orientation || daySize !== prevProps.daySize)) {
var visibleCalendarWeeks = this.calendarMonthWeeks.slice(1, numberOfMonths + 1);
var calendarMonthWeeksHeight = Math.max.apply(Math, [0].concat(_toConsumableArray(visibleCalendarWeeks))) * (daySize - 1);
var newMonthHeight = monthTitleHeight + calendarMonthWeeksHeight + 1;
this.adjustDayPickerHeight(newMonthHeight);
}
if (!prevProps.isFocused && isFocused && !focusedDate) {
this.container.focus();
}
}
return componentDidUpdate;
}()
}, {
key: 'componentWillUnmount',
value: function () {
function componentWillUnmount() {
clearTimeout(this.setCalendarInfoWidthTimeout);
}
return componentWillUnmount;
}()
}, {
key: 'onKeyDown',
value: function () {
function onKeyDown(e) {
e.stopPropagation();
if (!_constants.MODIFIER_KEY_NAMES.has(e.key)) {
this.throttledKeyDown(e);
}
}
return onKeyDown;
}()
}, {
key: 'onFinalKeyDown',
value: function () {
function onFinalKeyDown(e) {
this.setState({ withMouseInteractions: false });
var _props3 = this.props,
onBlur = _props3.onBlur,
isRTL = _props3.isRTL;
var _state2 = this.state,
focusedDate = _state2.focusedDate,
showKeyboardShortcuts = _state2.showKeyboardShortcuts;
if (!focusedDate) return;
var newFocusedDate = focusedDate.clone();
var didTransitionMonth = false;
// focus might be anywhere when the keyboard shortcuts panel is opened so we want to
// return it to wherever it was before when the panel was opened
var activeElement = (0, _getActiveElement2['default'])();
var onKeyboardShortcutsPanelClose = function () {
function onKeyboardShortcutsPanelClose() {
if (activeElement) activeElement.focus();
}
return onKeyboardShortcutsPanelClose;
}();
switch (e.key) {
case 'ArrowUp':
e.preventDefault();
newFocusedDate.subtract(1, 'week');
didTransitionMonth = this.maybeTransitionPrevMonth(newFocusedDate);
break;
case 'ArrowLeft':
e.preventDefault();
if (isRTL) {
newFocusedDate.add(1, 'day');
} else {
newFocusedDate.subtract(1, 'day');
}
didTransitionMonth = this.maybeTransitionPrevMonth(newFocusedDate);
break;
case 'Home':
e.preventDefault();
newFocusedDate.startOf('week');
didTransitionMonth = this.maybeTransitionPrevMonth(newFocusedDate);
break;
case 'PageUp':
e.preventDefault();
newFocusedDate.subtract(1, 'month');
didTransitionMonth = this.maybeTransitionPrevMonth(newFocusedDate);
break;
case 'ArrowDown':
e.preventDefault();
newFocusedDate.add(1, 'week');
didTransitionMonth = this.maybeTransitionNextMonth(newFocusedDate);
break;
case 'ArrowRight':
e.preventDefault();
if (isRTL) {
newFocusedDate.subtract(1, 'day');
} else {
newFocusedDate.add(1, 'day');
}
didTransitionMonth = this.maybeTransitionNextMonth(newFocusedDate);
break;
case 'End':
e.preventDefault();
newFocusedDate.endOf('week');
didTransitionMonth = this.maybeTransitionNextMonth(newFocusedDate);
break;
case 'PageDown':
e.preventDefault();
newFocusedDate.add(1, 'month');
didTransitionMonth = this.maybeTransitionNextMonth(newFocusedDate);
break;
case '?':
this.openKeyboardShortcutsPanel(onKeyboardShortcutsPanelClose);
break;
case 'Escape':
if (showKeyboardShortcuts) {
this.closeKeyboardShortcutsPanel();
} else {
onBlur();
}
break;
default:
break;
}
// If there was a month transition, do not update the focused date until the transition has
// completed. Otherwise, attempting to focus on a DOM node may interrupt the CSS animation. If
// didTransitionMonth is true, the focusedDate gets updated in #updateStateAfterMonthTransition
if (!didTransitionMonth) {
this.setState({
focusedDate: newFocusedDate
});
}
}
return onFinalKeyDown;
}()
}, {
key: 'onPrevMonthClick',
value: function () {
function onPrevMonthClick(nextFocusedDate, e) {
var _props4 = this.props,
daySize = _props4.daySize,
isRTL = _props4.isRTL,
numberOfMonths = _props4.numberOfMonths;
var _state3 = this.state,
calendarMonthWidth = _state3.calendarMonthWidth,
monthTitleHeight = _state3.monthTitleHeight;
if (e) e.preventDefault();
var translationValue = void 0;
if (this.isVertical()) {
var calendarMonthWeeksHeight = this.calendarMonthWeeks[0] * (daySize - 1);
translationValue = monthTitleHeight + calendarMonthWeeksHeight + 1;
} else if (this.isHorizontal()) {
translationValue = calendarMonthWidth;
if (isRTL) {
translationValue = -2 * calendarMonthWidth;
}
var visibleCalendarWeeks = this.calendarMonthWeeks.slice(0, numberOfMonths);
var _calendarMonthWeeksHeight = Math.max.apply(Math, [0].concat(_toConsumableArray(visibleCalendarWeeks))) * (daySize - 1);
var newMonthHeight = monthTitleHeight + _calendarMonthWeeksHeight + 1;
this.adjustDayPickerHeight(newMonthHeight);
}
this.setState({
monthTransition: PREV_TRANSITION,
translationValue: translationValue,
focusedDate: null,
nextFocusedDate: nextFocusedDate
});
}
return onPrevMonthClick;
}()
}, {
key: 'onMonthChange',
value: function () {
function onMonthChange(currentMonth) {
this.setCalendarMonthWeeks(currentMonth);
this.calculateAndSetDayPickerHeight();
// Translation value is a hack to force an invisible transition that
// properly rerenders the CalendarMonthGrid
this.setState({
monthTransition: MONTH_SELECTION_TRANSITION,
translationValue: 0.00001,
focusedDate: null,
nextFocusedDate: currentMonth,
currentMonth: currentMonth
});
}
return onMonthChange;
}()
}, {
key: 'onYearChange',
value: function () {
function onYearChange(currentMonth) {
this.setCalendarMonthWeeks(currentMonth);
this.calculateAndSetDayPickerHeight();
// Translation value is a hack to force an invisible transition that
// properly rerenders the CalendarMonthGrid
this.setState({
monthTransition: YEAR_SELECTION_TRANSITION,
translationValue: 0.0001,
focusedDate: null,
nextFocusedDate: currentMonth,
currentMonth: currentMonth
});
}
return onYearChange;
}()
}, {
key: 'onNextMonthClick',
value: function () {
function onNextMonthClick(nextFocusedDate, e) {
var _props5 = this.props,
isRTL = _props5.isRTL,
numberOfMonths = _props5.numberOfMonths,
daySize = _props5.daySize;
var _state4 = this.state,
calendarMonthWidth = _state4.calendarMonthWidth,
monthTitleHeight = _state4.monthTitleHeight;
if (e) e.preventDefault();
var translationValue = void 0;
if (this.isVertical()) {
var firstVisibleMonthWeeks = this.calendarMonthWeeks[1];
var calendarMonthWeeksHeight = firstVisibleMonthWeeks * (daySize - 1);
translationValue = -(monthTitleHeight + calendarMonthWeeksHeight + 1);
}
if (this.isHorizontal()) {
translationValue = -calendarMonthWidth;
if (isRTL) {
translationValue = 0;
}
var visibleCalendarWeeks = this.calendarMonthWeeks.slice(2, numberOfMonths + 2);
var _calendarMonthWeeksHeight2 = Math.max.apply(Math, [0].concat(_toConsumableArray(visibleCalendarWeeks))) * (daySize - 1);
var newMonthHeight = monthTitleHeight + _calendarMonthWeeksHeight2 + 1;
this.adjustDayPickerHeight(newMonthHeight);
}
this.setState({
monthTransition: NEXT_TRANSITION,
translationValue: translationValue,
focusedDate: null,
nextFocusedDate: nextFocusedDate
});
}
return onNextMonthClick;
}()
}, {
key: 'getFirstDayOfWeek',
value: function () {
function getFirstDayOfWeek() {
var firstDayOfWeek = this.props.firstDayOfWeek;
if (firstDayOfWeek == null) {
return _moment2['default'].localeData().firstDayOfWeek();
}
return firstDayOfWeek;
}
return getFirstDayOfWeek;
}()
}, {
key: 'getFirstVisibleIndex',
value: function () {
function getFirstVisibleIndex() {
var orientation = this.props.orientation;
var monthTransition = this.state.monthTransition;
if (orientation === _constants.VERTICAL_SCROLLABLE) return 0;
var firstVisibleMonthIndex = 1;
if (monthTransition === PREV_TRANSITION) {
firstVisibleMonthIndex -= 1;
} else if (monthTransition === NEXT_TRANSITION) {
firstVisibleMonthIndex += 1;
}
return firstVisibleMonthIndex;
}
return getFirstVisibleIndex;
}()
}, {
key: 'getFocusedDay',
value: function () {
function getFocusedDay(newMonth) {
var _props6 = this.props,
getFirstFocusableDay = _props6.getFirstFocusableDay,
numberOfMonths = _props6.numberOfMonths;
var focusedDate = void 0;
if (getFirstFocusableDay) {
focusedDate = getFirstFocusableDay(newMonth);
}
if (newMonth && (!focusedDate || !(0, _isDayVisible2['default'])(focusedDate, newMonth, numberOfMonths))) {
focusedDate = newMonth.clone().startOf('month');
}
return focusedDate;
}
return getFocusedDay;
}()
}, {
key: 'setMonthTitleHeight',
value: function () {
function setMonthTitleHeight(monthTitleHeight) {
var _this3 = this;
this.setState({
monthTitleHeight: monthTitleHeight
}, function () {
_this3.calculateAndSetDayPickerHeight();
});
}
return setMonthTitleHeight;
}()
}, {
key: 'setCalendarMonthWeeks',
value: function () {
function setCalendarMonthWeeks(currentMonth) {
var numberOfMonths = this.props.numberOfMonths;
this.calendarMonthWeeks = [];
var month = currentMonth.clone().subtract(1, 'months');
var firstDayOfWeek = this.getFirstDayOfWeek();
for (var i = 0; i < numberOfMonths + 2; i += 1) {
var numberOfWeeks = (0, _getNumberOfCalendarMonthWeeks2['default'])(month, firstDayOfWeek);
this.calendarMonthWeeks.push(numberOfWeeks);
month = month.add(1, 'months');
}
}
return setCalendarMonthWeeks;
}()
}, {
key: 'setContainerRef',
value: function () {
function setContainerRef(ref) {
this.container = ref;
}
return setContainerRef;
}()
}, {
key: 'setCalendarInfoRef',
value: function () {
function setCalendarInfoRef(ref) {
this.calendarInfo = ref;
}
return setCalendarInfoRef;
}()
}, {
key: 'setTransitionContainerRef',
value: function () {
function setTransitionContainerRef(ref) {
this.transitionContainer = ref;
}
return setTransitionContainerRef;
}()
}, {
key: 'maybeTransitionNextMonth',
value: function () {
function maybeTransitionNextMonth(newFocusedDate) {
var numberOfMonths = this.props.numberOfMonths;
var _state5 = this.state,
currentMonth = _state5.currentMonth,
focusedDate = _state5.focusedDate;
var newFocusedDateMonth = newFocusedDate.month();
var focusedDateMonth = focusedDate.month();
var isNewFocusedDateVisible = (0, _isDayVisible2['default'])(newFocusedDate, currentMonth, numberOfMonths);
if (newFocusedDateMonth !== focusedDateMonth && !isNewFocusedDateVisible) {
this.onNextMonthClick(newFocusedDate);
return true;
}
return false;
}
return maybeTransitionNextMonth;
}()
}, {
key: 'maybeTransitionPrevMonth',
value: function () {
function maybeTransitionPrevMonth(newFocusedDate) {
var numberOfMonths = this.props.numberOfMonths;
var _state6 = this.state,
currentMonth = _state6.currentMonth,
focusedDate = _state6.focusedDate;
var newFocusedDateMonth = newFocusedDate.month();
var focusedDateMonth = focusedDate.month();
var isNewFocusedDateVisible = (0, _isDayVisible2['default'])(newFocusedDate, currentMonth, numberOfMonths);
if (newFocusedDateMonth !== focusedDateMonth && !isNewFocusedDateVisible) {
this.onPrevMonthClick(newFocusedDate);
return true;
}
return false;
}
return maybeTransitionPrevMonth;
}()
}, {
key: 'multiplyScrollableMonths',
value: function () {
function multiplyScrollableMonths(e) {
var onMultiplyScrollableMonths = this.props.onMultiplyScrollableMonths;
if (e) e.preventDefault();
if (onMultiplyScrollableMonths) onMultiplyScrollableMonths(e);
this.setState(function (_ref) {
var scrollableMonthMultiple = _ref.scrollableMonthMultiple;
return {
scrollableMonthMultiple: scrollableMonthMultiple + 1
};
});
}
return multiplyScrollableMonths;
}()
}, {
key: 'isHorizontal',
value: function () {
function isHorizontal() {
var orientation = this.props.orientation;
return orientation === _constants.HORIZONTAL_ORIENTATION;
}
return isHorizontal;
}()
}, {
key: 'isVertical',
value: function () {
function isVertical() {
var orientation = this.props.orientation;
return orientation === _constants.VERTICAL_ORIENTATION || orientation === _constants.VERTICAL_SCROLLABLE;
}
return isVertical;
}()
}, {
key: 'updateStateAfterMonthTransition',
value: function () {
function updateStateAfterMonthTransition() {
var _this4 = this;
var _props7 = this.props,
onPrevMonthClick = _props7.onPrevMonthClick,
onNextMonthClick = _props7.onNextMonthClick,
numberOfMonths = _props7.numberOfMonths,
onMonthChange = _props7.onMonthChange,
onYearChange = _props7.onYearChange,
isRTL = _props7.isRTL;
var _state7 = this.state,
currentMonth = _state7.currentMonth,
monthTransition = _state7.monthTransition,
focusedDate = _state7.focusedDate,
nextFocusedDate = _state7.nextFocusedDate,
withMouseInteractions = _state7.withMouseInteractions,
calendarMonthWidth = _state7.calendarMonthWidth;
if (!monthTransition) return;
var newMonth = currentMonth.clone();
var firstDayOfWeek = this.getFirstDayOfWeek();
if (monthTransition === PREV_TRANSITION) {
newMonth.subtract(1, 'month');
if (onPrevMonthClick) onPrevMonthClick(newMonth);
var newInvisibleMonth = newMonth.clone().subtract(1, 'month');
var numberOfWeeks = (0, _getNumberOfCalendarMonthWeeks2['default'])(newInvisibleMonth, firstDayOfWeek);
this.calendarMonthWeeks = [numberOfWeeks].concat(_toConsumableArray(this.calendarMonthWeeks.slice(0, -1)));
} else if (monthTransition === NEXT_TRANSITION) {
newMonth.add(1, 'month');
if (onNextMonthClick) onNextMonthClick(newMonth);
var _newInvisibleMonth = newMonth.clone().add(numberOfMonths, 'month');
var _numberOfWeeks = (0, _getNumberOfCalendarMonthWeeks2['default'])(_newInvisibleMonth, firstDayOfWeek);
this.calendarMonthWeeks = [].concat(_toConsumableArray(this.calendarMonthWeeks.slice(1)), [_numberOfWeeks]);
} else if (monthTransition === MONTH_SELECTION_TRANSITION) {
if (onMonthChange) onMonthChange(newMonth);
} else if (monthTransition === YEAR_SELECTION_TRANSITION) {
if (onYearChange) onYearChange(newMonth);
}
var newFocusedDate = null;
if (nextFocusedDate) {
newFocusedDate = nextFocusedDate;
} else if (!focusedDate && !withMouseInteractions) {
newFocusedDate = this.getFocusedDay(newMonth);
}
this.setState({
currentMonth: newMonth,
monthTransition: null,
translationValue: isRTL && this.isHorizontal() ? -calendarMonthWidth : 0,
nextFocusedDate: null,
focusedDate: newFocusedDate
}, function () {
// we don't want to focus on the relevant calendar day after a month transition
// if the user is navigating around using a mouse
if (withMouseInteractions) {
var activeElement = (0, _getActiveElement2['default'])();
if (activeElement && activeElement !== document.body && _this4.container.contains(activeElement)) {
activeElement.blur();
}
}
});
}
return updateStateAfterMonthTransition;
}()
}, {
key: 'adjustDayPickerHeight',
value: function () {
function adjustDayPickerHeight(newMonthHeight) {
var _this5 = this;
var monthHeight = newMonthHeight + MONTH_PADDING;
if (monthHeight !== this.calendarMonthGridHeight) {
this.transitionContainer.style.height = String(monthHeight) + 'px';
if (!this.calendarMonthGridHeight) {
setTimeout(function () {
_this5.setState({ hasSetHeight: true });
}, 0);
}
this.calendarMonthGridHeight = monthHeight;
}
}
return adjustDayPickerHeight;
}()
}, {
key: 'calculateAndSetDayPickerHeight',
value: function () {
function calculateAndSetDayPickerHeight() {
var _props8 = this.props,
daySize = _props8.daySize,
numberOfMonths = _props8.numberOfMonths;
var monthTitleHeight = this.state.monthTitleHeight;
var visibleCalendarWeeks = this.calendarMonthWeeks.slice(1, numberOfMonths + 1);
var calendarMonthWeeksHeight = Math.max.apply(Math, [0].concat(_toConsumableArray(visibleCalendarWeeks))) * (daySize - 1);
var newMonthHeight = monthTitleHeight + calendarMonthWeeksHeight + 1;
if (this.isHorizontal()) {
this.adjustDayPickerHeight(newMonthHeight);
}
}
return calculateAndSetDayPickerHeight;
}()
}, {
key: 'openKeyboardShortcutsPanel',
value: function () {
function openKeyboardShortcutsPanel(onCloseCallBack) {
this.setState({
showKeyboardShortcuts: true,
onKeyboardShortcutsPanelClose: onCloseCallBack
});
}
return openKeyboardShortcutsPanel;
}()
}, {
key: 'closeKeyboardShortcutsPanel',
value: function () {
function closeKeyboardShortcutsPanel() {
var onKeyboardShortcutsPanelClose = this.state.onKeyboardShortcutsPanelClose;
if (onKeyboardShortcutsPanelClose) {
onKeyboardShortcutsPanelClose();
}
this.setState({
onKeyboardShortcutsPanelClose: null,
showKeyboardShortcuts: false
});
}
return closeKeyboardShortcutsPanel;
}()
}, {
key: 'renderNavigation',
value: function () {
function renderNavigation() {
var _this6 = this;
var _props9 = this.props,
navPrev = _props9.navPrev,
navNext = _props9.navNext,
noNavButtons = _props9.noNavButtons,
orientation = _props9.orientation,
phrases = _props9.phrases,
isRTL = _props9.isRTL;
if (noNavButtons) {
return null;
}
var onNextMonthClick = void 0;
if (orientation === _constants.VERTICAL_SCROLLABLE) {
onNextMonthClick = this.multiplyScrollableMonths;
} else {
onNextMonthClick = function () {
function onNextMonthClick(e) {
_this6.onNextMonthClick(null, e);
}
return onNextMonthClick;
}();
}
return _react2['default'].createElement(_DayPickerNavigation2['default'], {
onPrevMonthClick: function () {
function onPrevMonthClick(e) {
_this6.onPrevMonthClick(null, e);
}
return onPrevMonthClick;
}(),
onNextMonthClick: onNextMonthClick,
navPrev: navPrev,
navNext: navNext,
orientation: orientation,
phrases: phrases,
isRTL: isRTL
});
}
return renderNavigation;
}()
}, {
key: 'renderWeekHeader',
value: function () {
function renderWeekHeader(index) {
var _props10 = this.props,
daySize = _props10.daySize,
horizontalMonthPadding = _props10.horizontalMonthPadding,
orientation = _props10.orientation,
weekDayFormat = _props10.weekDayFormat,
styles = _props10.styles;
var calendarMonthWidth = this.state.calendarMonthWidth;
var verticalScrollable = orientation === _constants.VERTICAL_SCROLLABLE;
var horizontalStyle = {
left: index * calendarMonthWidth
};
var verticalStyle = {
marginLeft: -calendarMonthWidth / 2
};
var weekHeaderStyle = {}; // no styles applied to the vertical-scrollable orientation
if (this.isHorizontal()) {
weekHeaderStyle = horizontalStyle;
} else if (this.isVertical() && !verticalScrollable) {
weekHeaderStyle = verticalStyle;
}
var firstDayOfWeek = this.getFirstDayOfWeek();
var header = [];
for (var i = 0; i < 7; i += 1) {
header.push(_react2['default'].createElement(
'li',
_extends({ key: i }, (0, _reactWithStyles.css)(styles.DayPicker_weekHeader_li, { width: daySize })),
_react2['default'].createElement(
'small',
null,
(0, _moment2['default'])().day((i + firstDayOfWeek) % 7).format(weekDayFormat)
)
));
}
return _react2['default'].createElement(
'div',
_extends({}, (0, _reactWithStyles.css)(styles.DayPicker_weekHeader, this.isVertical() && styles.DayPicker_weekHeader__vertical, verticalScrollable && styles.DayPicker_weekHeader__verticalScrollable, weekHeaderStyle, { padding: '0 ' + String(horizontalMonthPadding) + 'px' }), {
key: 'week-' + String(index)
}),
_react2['default'].createElement(
'ul',
(0, _reactWithStyles.css)(styles.DayPicker_weekHeader_ul),
header
)
);
}
return renderWeekHeader;
}()
}, {
key: 'render',
value: function () {
function render() {
var _this7 = this;
var _state8 = this.state,
calendarMonthWidth = _state8.calendarMonthWidth,
currentMonth = _state8.currentMonth,
monthTransition = _state8.monthTransition,
translationValue = _state8.translationValue,
scrollableMonthMultiple = _state8.scrollableMonthMultiple,
focusedDate = _state8.focusedDate,
showKeyboardShortcuts = _state8.showKeyboardShortcuts,
isTouch = _state8.isTouchDevice,
hasSetHeight = _state8.hasSetHeight,
calendarInfoWidth = _state8.calendarInfoWidth,
monthTitleHeight = _state8.monthTitleHeight;
var _props11 = this.props,
enableOutsideDays = _props11.enableOutsideDays,
numberOfMonths = _props11.numberOfMonths,
orientation = _props11.orientation,
modifiers = _props11.modifiers,
withPortal = _props11.withPortal,
onDayClick = _props11.onDayClick,
onDayMouseEnter = _props11.onDayMouseEnter,
onDayMouseLeave = _props11.onDayMouseLeave,
firstDayOfWeek = _props11.firstDayOfWeek,
renderMonthText = _props11.renderMonthText,
renderCalendarDay = _props11.renderCalendarDay,
renderDayContents = _props11.renderDayContents,
renderCalendarInfo = _props11.renderCalendarInfo,
renderMonthElement = _props11.renderMonthElement,
calendarInfoPosition = _props11.calendarInfoPosition,
hideKeyboardShortcutsPanel = _props11.hideKeyboardShortcutsPanel,
onOutsideClick = _props11.onOutsideClick,
monthFormat = _props11.monthFormat,
daySize = _props11.daySize,
isFocused = _props11.isFocused,
isRTL = _props11.isRTL,
styles = _props11.styles,
theme = _props11.theme,
phrases = _props11.phrases,
verticalHeight = _props11.verticalHeight,
dayAriaLabelFormat = _props11.dayAriaLabelFormat,
noBorder = _props11.noBorder,
transitionDuration = _props11.transitionDuration,
verticalBorderSpacing = _props11.verticalBorderSpacing,
horizontalMonthPadding = _props11.horizontalMonthPadding;
var dayPickerHorizontalPadding = theme.reactDates.spacing.dayPickerHorizontalPadding;
var isHorizontal = this.isHorizontal();
var numOfWeekHeaders = this.isVertical() ? 1 : numberOfMonths;
var weekHeaders = [];
for (var i = 0; i < numOfWeekHeaders; i += 1) {
weekHeaders.push(this.renderWeekHeader(i));
}
var verticalScrollable = orientation === _constants.VERTICAL_SCROLLABLE;
var height = void 0;
if (isHorizontal) {
height = this.calendarMonthGridHeight;
} else if (this.isVertical() && !verticalScrollable && !withPortal) {
// If the user doesn't set a desired height,
// we default back to this kind of made-up value that generally looks good
height = verticalHeight || 1.75 * calendarMonthWidth;
}
var isCalendarMonthGridAnimating = monthTransition !== null;
var shouldFocusDate = !isCalendarMonthGridAnimating && isFocused;
var keyboardShortcutButtonLocation = _DayPickerKeyboardShortcuts.BOTTOM_RIGHT;
if (this.isVertical()) {
keyboardShortcutButtonLocation = withPortal ? _DayPickerKeyboardShortcuts.TOP_LEFT : _DayPickerKeyboardShortcuts.TOP_RIGHT;
}
var shouldAnimateHeight = isHorizontal && hasSetHeight;
var calendarInfoPositionTop = calendarInfoPosition === _constants.INFO_POSITION_TOP;
var calendarInfoPositionBottom = calendarInfoPosition === _constants.INFO_POSITION_BOTTOM;
var calendarInfoPositionBefore = calendarInfoPosition === _constants.INFO_POSITION_BEFORE;
var calendarInfoPositionAfter = calendarInfoPosition === _constants.INFO_POSITION_AFTER;
var calendarInfoIsInline = calendarInfoPositionBefore || calendarInfoPositionAfter;
var calendarInfo = renderCalendarInfo && _react2['default'].createElement(
'div',
_extends({
ref: this.setCalendarInfoRef
}, (0, _reactWithStyles.css)(calendarInfoIsInline && styles.DayPicker_calendarInfo__horizontal)),
renderCalendarInfo()
);
var calendarInfoPanelWidth = renderCalendarInfo && calendarInfoIsInline ? calendarInfoWidth : 0;
var firstVisibleMonthIndex = this.getFirstVisibleIndex();
var wrapperHorizontalWidth = calendarMonthWidth * numberOfMonths + 2 * dayPickerHorizontalPadding;
// Adding `1px` because of whitespace between 2 inline-block
var fullHorizontalWidth = wrapperHorizontalWidth + calendarInfoPanelWidth + 1;
var transitionContainerStyle = {
width: isHorizontal && wrapperHorizontalWidth,
height: height
};
var dayPickerWrapperStyle = {
width: isHorizontal && wrapperHorizontalWidth
};
var dayPickerStyle = {
width: isHorizontal && fullHorizontalWidth,
// These values are to center the datepicker (approximately) on the page
marginLeft: isHorizontal && withPortal ? -fullHorizontalWidth / 2 : null,
marginTop: isHorizontal && withPortal ? -calendarMonthWidth / 2 : null
};
return _react2['default'].createElement(
'div',
_extends({
role: 'application',
'aria-label': phrases.calendarLabel
}, (0, _reactWithStyles.css)(styles.DayPicker, isHorizontal && styles.DayPicker__horizontal, verticalScrollable && styles.DayPicker__verticalScrollable, isHorizontal && withPortal && styles.DayPicker_portal__horizontal, this.isVertical() && withPortal && styles.DayPicker_portal__vertical, dayPickerStyle, !monthTitleHeight && styles.DayPicker__hidden, !noBorder && styles.DayPicker__withBorder)),
_react2['default'].createElement(
_reactOutsideClickHandler2['default'],
{ onOutsideClick: onOutsideClick },
(calendarInfoPositionTop || calendarInfoPositionBefore) && calendarInfo,
_react2['default'].createElement(
'div',
(0, _reactWithStyles.css)(dayPickerWrapperStyle, calendarInfoIsInline && isHorizontal && styles.DayPicker_wrapper__horizontal),
_react2['default'].createElement(
'div',
_extends({}, (0, _reactWithStyles.css)(styles.DayPicker_weekHeaders, isHorizontal && styles.DayPicker_weekHeaders__horizontal), {
'aria-hidden': 'true',
role: 'presentation'
}),
weekHeaders
),
_react2['default'].createElement(
'div',
_extends({}, (0, _reactWithStyles.css)(styles.DayPicker_focusRegion), {
ref: this.setContainerRef,
onClick: function () {
function onClick(e) {
e.stopPropagation();
}
return onClick;
}(),
onKeyDown: this.onKeyDown,
onMouseUp: function () {
function onMouseUp() {
_this7.setState({ withMouseInteractions: true });
}
return onMouseUp;
}(),
role: 'region',
tabIndex: -1
}),
!verticalScrollable && this.renderNavigation(),
_react2['default'].createElement(
'div',
_extends({}, (0, _reactWithStyles.css)(styles.DayPicker_transitionContainer, shouldAnimateHeight && styles.DayPicker_transitionContainer__horizontal, this.isVertical() && styles.DayPicker_transitionContainer__vertical, verticalScrollable && styles.DayPicker_transitionContainer__verticalScrollable, transitionContainerStyle), {
ref: this.setTransitionContainerRef
}),
_react2['default'].createElement(_CalendarMonthGrid2['default'], {
setMonthTitleHeight: !monthTitleHeight ? this.setMonthTitleHeight : undefined,
translationValue: translationValue,
enableOutsideDays: enableOutsideDays,
firstVisibleMonthIndex: firstVisibleMonthIndex,
initialMonth: currentMonth,
isAnimating: isCalendarMonthGridAnimating,
modifiers: modifiers,
orientation: orientation,
numberOfMonths: numberOfMonths * scrollableMonthMultiple,
onDayClick: onDayClick,
onDayMouseEnter: onDayMouseEnter,
onDayMouseLeave: onDayMouseLeave,
onMonthChange: this.onMonthChange,
onYearChange: this.onYearChange,
renderMonthText: renderMonthText,
renderCalendarDay: renderCalendarDay,
renderDayContents: renderDayContents,
renderMonthElement: renderMonthElement,
onMonthTransitionEnd: this.updateStateAfterMonthTransition,
monthFormat: monthFormat,
daySize: daySize,
firstDayOfWeek: firstDayOfWeek,
isFocused: shouldFocusDate,
focusedDate: focusedDate,
phrases: phrases,
isRTL: isRTL,
dayAriaLabelFormat: dayAriaLabelFormat,
transitionDuration: transitionDuration,
verticalBorderSpacing: verticalBorderSpacing,
horizontalMonthPadding: horizontalMonthPadding
}),
verticalScrollable && this.renderNavigation()
),
!isTouch && !hideKeyboardShortcutsPanel && _react2['default'].createElement(_DayPickerKeyboardShortcuts2['default'], {
block: this.isVertical() && !withPortal,
buttonLocation: keyboardShortcutButtonLocation,
showKeyboardShortcutsPanel: showKeyboardShortcuts,
openKeyboardShortcutsPanel: this.openKeyboardShortcutsPanel,
closeKeyboardShortcutsPanel: this.closeKeyboardShortcutsPanel,
phrases: phrases
})
)
),
(calendarInfoPositionBottom || calendarInfoPositionAfter) && calendarInfo
)
);
}
return render;
}()
}]);
return DayPicker;
}(_react2['default'].Component);
DayPicker.propTypes = propTypes;
DayPicker.defaultProps = defaultProps;
exports.PureDayPicker = DayPicker;
exports['default'] = (0, _reactWithStyles.withStyles)(function (_ref2) {
var _ref2$reactDates = _ref2.reactDates,
color = _ref2$reactDates.color,
font = _ref2$reactDates.font,
noScrollBarOnVerticalScrollable = _ref2$reactDates.noScrollBarOnVerticalScrollable,
spacing = _ref2$reactDates.spacing,
zIndex = _ref2$reactDates.zIndex;
return {
DayPicker: {
background: color.background,
position: 'relative',
textAlign: 'left'
},
DayPicker__horizontal: {
background: color.background
},
DayPicker__verticalScrollable: {
height: '100%'
},
DayPicker__hidden: {
visibility: 'hidden'
},
DayPicker__withBorder: {
boxShadow: '0 2px 6px rgba(0, 0, 0, 0.05), 0 0 0 1px rgba(0, 0, 0, 0.07)',
borderRadius: 3
},
DayPicker_portal__horizontal: {
boxShadow: 'none',
position: 'absolute',
left: '50%',
top: '50%'
},
DayPicker_portal__vertical: {
position: 'initial'
},
DayPicker_focusRegion: {
outline: 'none'
},
DayPicker_calendarInfo__horizontal: {
display: 'inline-block',
verticalAlign: 'top'
},
DayPicker_wrapper__horizontal: {
display: 'inline-block',
verticalAlign: 'top'
},
DayPicker_weekHeaders: {
position: 'relative'
},
DayPicker_weekHeaders__horizontal: {
marginLeft: spacing.dayPickerHorizontalPadding
},
DayPicker_weekHeader: {
color: color.placeholderText,
position: 'absolute',
top: 62,
zIndex: zIndex + 2,
textAlign: 'left'
},
DayPicker_weekHeader__vertical: {
left: '50%'
},
DayPicker_weekHeader__verticalScrollable: {
top: 0,
display: 'table-row',
borderBottom: '1px solid ' + String(color.core.border),
background: color.background,
marginLeft: 0,
left: 0,
width: '100%',
textAlign: 'center'
},
DayPicker_weekHeader_ul: {
listStyle: 'none',
margin: '1px 0',
paddingLeft: 0,
paddingRight: 0,
fontSize: font.size
},
DayPicker_weekHeader_li: {
display: 'inline-block',
textAlign: 'center'
},
DayPicker_transitionContainer: {
position: 'relative',
overflow: 'hidden',
borderRadius: 3
},
DayPicker_transitionContainer__horizontal: {
transition: 'height 0.2s ease-in-out'
},
DayPicker_transitionContainer__vertical: {
width: '100%'
},
DayPicker_transitionContainer__verticalScrollable: (0, _object2['default'])({
paddingTop: 20,
height: '100%',
position: 'absolute',
top: 0,
bottom: 0,
right: 0,
left: 0,
overflowY: 'scroll'
}, noScrollBarOnVerticalScrollable && {
'-webkitOverflowScrolling': 'touch',
'::-webkit-scrollbar': {
'-webkit-appearance': 'none',
display: 'none'
}
})
};
})(DayPicker);
/***/ }),
/***/ "NykK":
/***/ (function(module, exports, __webpack_require__) {
var Symbol = __webpack_require__("nmnc"),
getRawTag = __webpack_require__("AP2z"),
objectToString = __webpack_require__("KfNM");
/** `Object#toString` result references. */
var nullTag = '[object Null]',
undefinedTag = '[object Undefined]';
/** Built-in value references. */
var symToStringTag = Symbol ? Symbol.toStringTag : undefined;
/**
* The base implementation of `getTag` without fallbacks for buggy environments.
*
* @private
* @param {*} value The value to query.
* @returns {string} Returns the `toStringTag`.
*/
function baseGetTag(value) {
if (value == null) {
return value === undefined ? undefinedTag : nullTag;
}
return (symToStringTag && symToStringTag in Object(value))
? getRawTag(value)
: objectToString(value);
}
module.exports = baseGetTag;
/***/ }),
/***/ "Nym8":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return getActiveElement; });
/* harmony import */ var _getDocument_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("ouKs");
/**
* Returns `element.ownerDocument.activeElement`.
*/
function getActiveElement(element) {
var _getDocument = Object(_getDocument_js__WEBPACK_IMPORTED_MODULE_0__[/* getDocument */ "a"])(element),
activeElement = _getDocument.activeElement;
if (!(activeElement !== null && activeElement !== void 0 && activeElement.nodeName)) {
// In IE11, activeElement might be an empty object if we're interacting
// with elements inside of an iframe.
return null;
}
return activeElement;
}
/***/ }),
/***/ "Ohaz":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return getNamespace; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return getConnectedNamespace; });
/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("tQ+x");
/**
* Internal dependencies
*/
/**
* Creates a dedicated context namespace HTML attribute for components.
* ns is short for "namespace"
*
* @example
* ```jsx
*
* ```
*
* @param {string} componentName The name for the component.
* @return {Record} A props object with the namespaced HTML attribute.
*/
function getNamespace(componentName) {
return {
[_constants__WEBPACK_IMPORTED_MODULE_0__[/* COMPONENT_NAMESPACE */ "a"]]: componentName
};
}
/**
* Creates a dedicated connected context namespace HTML attribute for components.
* ns is short for "namespace"
*
* @example
* ```jsx
*
* ```
*
* @return {Record} A props object with the namespaced HTML attribute.
*/
function getConnectedNamespace() {
return {
[_constants__WEBPACK_IMPORTED_MODULE_0__[/* CONNECTED_NAMESPACE */ "b"]]: true
};
}
/***/ }),
/***/ "PJYZ":
/***/ (function(module, exports) {
function _assertThisInitialized(self) {
if (self === void 0) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}
return self;
}
module.exports = _assertThisInitialized;
module.exports["default"] = module.exports, module.exports.__esModule = true;
/***/ }),
/***/ "PcHe":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return hasFocusWithin; });
/* harmony import */ var _getActiveElement_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("Nym8");
/* harmony import */ var _contains_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("utzN");
/**
* Checks if `element` has focus within. Elements that are referenced by
* `aria-activedescendant` are also considered.
*
* @example
* import { hasFocusWithin } from "reakit-utils";
*
* hasFocusWithin(document.getElementById("id"));
*/
function hasFocusWithin(element) {
var activeElement = Object(_getActiveElement_js__WEBPACK_IMPORTED_MODULE_0__[/* getActiveElement */ "a"])(element);
if (!activeElement) return false;
if (Object(_contains_js__WEBPACK_IMPORTED_MODULE_1__[/* contains */ "a"])(element, activeElement)) return true;
var activeDescendant = activeElement.getAttribute("aria-activedescendant");
if (!activeDescendant) return false;
if (activeDescendant === element.id) return true;
return !!element.querySelector("#" + activeDescendant);
}
/***/ }),
/***/ "Pjai":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var ToPrimitive = __webpack_require__("vLdR");
// http://262.ecma-international.org/5.1/#sec-9.3
module.exports = function ToNumber(value) {
var prim = ToPrimitive(value, Number);
if (typeof prim !== 'string') {
return +prim; // eslint-disable-line no-implicit-coercion
}
// eslint-disable-next-line no-control-regex
var trimmed = prim.replace(/^[ \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u0085]+|[ \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u0085]+$/g, '');
if ((/^0[ob]|^[+-]0x/).test(trimmed)) {
return NaN;
}
return +trimmed; // eslint-disable-line no-implicit-coercion
};
/***/ }),
/***/ "Pq96":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports['default'] = isPrevMonth;
var _moment = __webpack_require__("wy2R");
var _moment2 = _interopRequireDefault(_moment);
var _isSameMonth = __webpack_require__("ulUS");
var _isSameMonth2 = _interopRequireDefault(_isSameMonth);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function isPrevMonth(a, b) {
if (!_moment2['default'].isMoment(a) || !_moment2['default'].isMoment(b)) return false;
return (0, _isSameMonth2['default'])(a.clone().subtract(1, 'month'), b);
}
/***/ }),
/***/ "PrET":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var bind = __webpack_require__("D3zA");
var GetIntrinsic = __webpack_require__("AM7I");
var $apply = GetIntrinsic('%Function.prototype.apply%');
var $call = GetIntrinsic('%Function.prototype.call%');
var $reflectApply = GetIntrinsic('%Reflect.apply%', true) || bind.call($call, $apply);
var $defineProperty = GetIntrinsic('%Object.defineProperty%', true);
if ($defineProperty) {
try {
$defineProperty({}, 'a', { value: 1 });
} catch (e) {
// IE 8 has a broken defineProperty
$defineProperty = null;
}
}
module.exports = function callBind() {
return $reflectApply(bind, $call, arguments);
};
var applyBind = function applyBind() {
return $reflectApply(bind, $apply, arguments);
};
if ($defineProperty) {
$defineProperty(module.exports, 'apply', { value: applyBind });
} else {
module.exports.apply = applyBind;
}
/***/ }),
/***/ "Ptb8":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return isObject; });
/**
* Checks whether `arg` is an object or not.
*
* @returns {boolean}
*/
function isObject(arg) {
return typeof arg === "object" && arg != null;
}
/***/ }),
/***/ "Q4Sy":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId");
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9");
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__);
/**
* WordPress dependencies
*/
const plus = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], {
d: "M18 11.2h-5.2V6h-1.6v5.2H6v1.6h5.2V18h1.6v-5.2H18z"
}));
/* harmony default export */ __webpack_exports__["a"] = (plus);
/***/ }),
/***/ "QEu6":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var CHANNEL = exports.CHANNEL = '__direction__';
var DIRECTIONS = exports.DIRECTIONS = {
LTR: 'ltr',
RTL: 'rtl'
};
/***/ }),
/***/ "QIyF":
/***/ (function(module, exports, __webpack_require__) {
var root = __webpack_require__("Kz5y");
/**
* Gets the timestamp of the number of milliseconds that have elapsed since
* the Unix epoch (1 January 1970 00:00:00 UTC).
*
* @static
* @memberOf _
* @since 2.4.0
* @category Date
* @returns {number} Returns the timestamp.
* @example
*
* _.defer(function(stamp) {
* console.log(_.now() - stamp);
* }, _.now());
* // => Logs the number of milliseconds it took for the deferred invocation.
*/
var now = function() {
return root.Date.now();
};
module.exports = now;
/***/ }),
/***/ "Qmvf":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var GetIntrinsic = __webpack_require__("rZ7t");
var has = __webpack_require__("oNNP");
var $TypeError = GetIntrinsic('%TypeError%');
module.exports = function IsPropertyDescriptor(ES, Desc) {
if (ES.Type(Desc) !== 'Object') {
return false;
}
var allowed = {
'[[Configurable]]': true,
'[[Enumerable]]': true,
'[[Get]]': true,
'[[Set]]': true,
'[[Value]]': true,
'[[Writable]]': true
};
for (var key in Desc) { // eslint-disable-line no-restricted-syntax
if (has(Desc, key) && !allowed[key]) {
return false;
}
}
if (ES.IsDataDescriptor(Desc) && ES.IsAccessorDescriptor(Desc)) {
throw new $TypeError('Property Descriptors may not be both accessor and data descriptors');
}
return true;
};
/***/ }),
/***/ "R/b7":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var abs = __webpack_require__("In1I");
var floor = __webpack_require__("4HRn");
var $isNaN = __webpack_require__("HwJD");
var $isFinite = __webpack_require__("ald4");
// https://ecma-international.org/ecma-262/6.0/#sec-isinteger
module.exports = function IsInteger(argument) {
if (typeof argument !== 'number' || $isNaN(argument) || !$isFinite(argument)) {
return false;
}
var absValue = abs(argument);
return floor(absValue) === absValue;
};
/***/ }),
/***/ "RDTF":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _objectSpread2; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return _objectWithoutPropertiesLoose; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return _createForOfIteratorHelperLoose; });
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;
}
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 _objectSpread2(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(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 _objectWithoutPropertiesLoose(source, excluded) {
if (source == null) return {};
var target = {};
var sourceKeys = Object.keys(source);
var key, i;
for (i = 0; i < sourceKeys.length; i++) {
key = sourceKeys[i];
if (excluded.indexOf(key) >= 0) continue;
target[key] = source[key];
}
return target;
}
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;
}
function _createForOfIteratorHelperLoose(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;
return function () {
if (i >= o.length) return {
done: true
};
return {
done: false,
value: o[i++]
};
};
}
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
it = o[Symbol.iterator]();
return it.next.bind(it);
}
/***/ }),
/***/ "RMJe":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId");
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9");
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__);
/**
* WordPress dependencies
*/
const check = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], {
d: "M18.3 5.6L9.9 16.9l-4.6-3.4-.9 1.2 5.8 4.3 9.3-12.6z"
}));
/* harmony default export */ __webpack_exports__["a"] = (check);
/***/ }),
/***/ "RxS6":
/***/ (function(module, exports) {
(function() { module.exports = window["wp"]["keycodes"]; }());
/***/ }),
/***/ "S0jC":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
module.exports = __webpack_require__("laOf");
/***/ }),
/***/ "SB3u":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);
// EXPORTS
__webpack_require__.d(__webpack_exports__, "SVG", function() { return /* reexport */ external_wp_primitives_["SVG"]; });
__webpack_require__.d(__webpack_exports__, "Path", function() { return /* reexport */ external_wp_primitives_["Path"]; });
__webpack_require__.d(__webpack_exports__, "Circle", function() { return /* reexport */ external_wp_primitives_["Circle"]; });
__webpack_require__.d(__webpack_exports__, "Polygon", function() { return /* reexport */ external_wp_primitives_["Polygon"]; });
__webpack_require__.d(__webpack_exports__, "Rect", function() { return /* reexport */ external_wp_primitives_["Rect"]; });
__webpack_require__.d(__webpack_exports__, "G", function() { return /* reexport */ external_wp_primitives_["G"]; });
__webpack_require__.d(__webpack_exports__, "HorizontalRule", function() { return /* reexport */ external_wp_primitives_["HorizontalRule"]; });
__webpack_require__.d(__webpack_exports__, "BlockQuotation", function() { return /* reexport */ external_wp_primitives_["BlockQuotation"]; });
__webpack_require__.d(__webpack_exports__, "__experimentalAlignmentMatrixControl", function() { return /* reexport */ AlignmentMatrixControl; });
__webpack_require__.d(__webpack_exports__, "Animate", function() { return /* reexport */ animate["a" /* default */]; });
__webpack_require__.d(__webpack_exports__, "__unstableGetAnimateClassName", function() { return /* reexport */ animate["b" /* getAnimateClassName */]; });
__webpack_require__.d(__webpack_exports__, "AnglePickerControl", function() { return /* reexport */ AnglePickerControl; });
__webpack_require__.d(__webpack_exports__, "Autocomplete", function() { return /* reexport */ Autocomplete; });
__webpack_require__.d(__webpack_exports__, "__unstableUseAutocompleteProps", function() { return /* reexport */ useAutocompleteProps; });
__webpack_require__.d(__webpack_exports__, "BaseControl", function() { return /* reexport */ base_control; });
__webpack_require__.d(__webpack_exports__, "__experimentalBoxControl", function() { return /* reexport */ BoxControl; });
__webpack_require__.d(__webpack_exports__, "Button", function() { return /* reexport */ build_module_button["a" /* default */]; });
__webpack_require__.d(__webpack_exports__, "ButtonGroup", function() { return /* reexport */ button_group; });
__webpack_require__.d(__webpack_exports__, "Card", function() { return /* reexport */ card; });
__webpack_require__.d(__webpack_exports__, "CardBody", function() { return /* reexport */ card_body; });
__webpack_require__.d(__webpack_exports__, "CardDivider", function() { return /* reexport */ divider; });
__webpack_require__.d(__webpack_exports__, "CardFooter", function() { return /* reexport */ footer; });
__webpack_require__.d(__webpack_exports__, "CardHeader", function() { return /* reexport */ card_header; });
__webpack_require__.d(__webpack_exports__, "CardMedia", function() { return /* reexport */ media; });
__webpack_require__.d(__webpack_exports__, "CheckboxControl", function() { return /* reexport */ CheckboxControl; });
__webpack_require__.d(__webpack_exports__, "ClipboardButton", function() { return /* reexport */ ClipboardButton; });
__webpack_require__.d(__webpack_exports__, "__experimentalColorEdit", function() { return /* reexport */ ColorEdit; });
__webpack_require__.d(__webpack_exports__, "ColorIndicator", function() { return /* reexport */ color_indicator; });
__webpack_require__.d(__webpack_exports__, "ColorPalette", function() { return /* reexport */ ColorPalette; });
__webpack_require__.d(__webpack_exports__, "ColorPicker", function() { return /* reexport */ color_picker_ColorPicker; });
__webpack_require__.d(__webpack_exports__, "ComboboxControl", function() { return /* reexport */ combobox_control; });
__webpack_require__.d(__webpack_exports__, "__unstableComposite", function() { return /* reexport */ Composite; });
__webpack_require__.d(__webpack_exports__, "__unstableCompositeGroup", function() { return /* reexport */ CompositeGroup; });
__webpack_require__.d(__webpack_exports__, "__unstableCompositeItem", function() { return /* reexport */ CompositeItem["a" /* CompositeItem */]; });
__webpack_require__.d(__webpack_exports__, "__unstableUseCompositeState", function() { return /* reexport */ useCompositeState; });
__webpack_require__.d(__webpack_exports__, "CustomSelectControl", function() { return /* reexport */ CustomSelectControl; });
__webpack_require__.d(__webpack_exports__, "Dashicon", function() { return /* reexport */ dashicon["a" /* default */]; });
__webpack_require__.d(__webpack_exports__, "DateTimePicker", function() { return /* reexport */ date_time; });
__webpack_require__.d(__webpack_exports__, "DatePicker", function() { return /* reexport */ date_time_date; });
__webpack_require__.d(__webpack_exports__, "TimePicker", function() { return /* reexport */ time; });
__webpack_require__.d(__webpack_exports__, "__experimentalDimensionControl", function() { return /* reexport */ dimension_control; });
__webpack_require__.d(__webpack_exports__, "Disabled", function() { return /* reexport */ build_module_disabled; });
__webpack_require__.d(__webpack_exports__, "__unstableDisclosureContent", function() { return /* reexport */ DisclosureContent; });
__webpack_require__.d(__webpack_exports__, "__experimentalDivider", function() { return /* reexport */ divider_component; });
__webpack_require__.d(__webpack_exports__, "Draggable", function() { return /* reexport */ Draggable; });
__webpack_require__.d(__webpack_exports__, "DropZone", function() { return /* reexport */ DropZoneComponent; });
__webpack_require__.d(__webpack_exports__, "DropZoneProvider", function() { return /* reexport */ DropZoneProvider; });
__webpack_require__.d(__webpack_exports__, "Dropdown", function() { return /* reexport */ Dropdown; });
__webpack_require__.d(__webpack_exports__, "DropdownMenu", function() { return /* reexport */ dropdown_menu; });
__webpack_require__.d(__webpack_exports__, "DuotoneSwatch", function() { return /* reexport */ duotone_swatch; });
__webpack_require__.d(__webpack_exports__, "DuotonePicker", function() { return /* reexport */ duotone_picker; });
__webpack_require__.d(__webpack_exports__, "ExternalLink", function() { return /* reexport */ external_link; });
__webpack_require__.d(__webpack_exports__, "Flex", function() { return /* reexport */ flex_component; });
__webpack_require__.d(__webpack_exports__, "FlexBlock", function() { return /* reexport */ flex_block_component; });
__webpack_require__.d(__webpack_exports__, "FlexItem", function() { return /* reexport */ flex_item_component; });
__webpack_require__.d(__webpack_exports__, "FocalPointPicker", function() { return /* reexport */ focal_point_picker; });
__webpack_require__.d(__webpack_exports__, "FocusableIframe", function() { return /* reexport */ FocusableIframe; });
__webpack_require__.d(__webpack_exports__, "FontSizePicker", function() { return /* reexport */ font_size_picker; });
__webpack_require__.d(__webpack_exports__, "FormFileUpload", function() { return /* reexport */ form_file_upload; });
__webpack_require__.d(__webpack_exports__, "FormToggle", function() { return /* reexport */ form_toggle; });
__webpack_require__.d(__webpack_exports__, "FormTokenField", function() { return /* reexport */ form_token_field; });
__webpack_require__.d(__webpack_exports__, "__experimentalGradientPicker", function() { return /* reexport */ GradientPicker; });
__webpack_require__.d(__webpack_exports__, "__experimentalCustomGradientPicker", function() { return /* reexport */ CustomGradientPicker; });
__webpack_require__.d(__webpack_exports__, "__experimentalGrid", function() { return /* reexport */ grid_component; });
__webpack_require__.d(__webpack_exports__, "Guide", function() { return /* reexport */ Guide; });
__webpack_require__.d(__webpack_exports__, "GuidePage", function() { return /* reexport */ GuidePage; });
__webpack_require__.d(__webpack_exports__, "__experimentalHeading", function() { return /* reexport */ heading_component; });
__webpack_require__.d(__webpack_exports__, "__experimentalHStack", function() { return /* reexport */ h_stack_component; });
__webpack_require__.d(__webpack_exports__, "Icon", function() { return /* reexport */ components_build_module_icon["a" /* default */]; });
__webpack_require__.d(__webpack_exports__, "IconButton", function() { return /* reexport */ deprecated; });
__webpack_require__.d(__webpack_exports__, "__experimentalInputControl", function() { return /* reexport */ input_control; });
__webpack_require__.d(__webpack_exports__, "KeyboardShortcuts", function() { return /* reexport */ keyboard_shortcuts; });
__webpack_require__.d(__webpack_exports__, "MenuGroup", function() { return /* reexport */ menu_group; });
__webpack_require__.d(__webpack_exports__, "MenuItem", function() { return /* reexport */ menu_item; });
__webpack_require__.d(__webpack_exports__, "MenuItemsChoice", function() { return /* reexport */ MenuItemsChoice; });
__webpack_require__.d(__webpack_exports__, "Modal", function() { return /* reexport */ modal; });
__webpack_require__.d(__webpack_exports__, "ScrollLock", function() { return /* reexport */ scroll_lock["a" /* default */]; });
__webpack_require__.d(__webpack_exports__, "NavigableMenu", function() { return /* reexport */ navigable_container_menu; });
__webpack_require__.d(__webpack_exports__, "TabbableContainer", function() { return /* reexport */ tabbable; });
__webpack_require__.d(__webpack_exports__, "__experimentalNavigation", function() { return /* reexport */ Navigation; });
__webpack_require__.d(__webpack_exports__, "__experimentalNavigationBackButton", function() { return /* reexport */ back_button; });
__webpack_require__.d(__webpack_exports__, "__experimentalNavigationGroup", function() { return /* reexport */ NavigationGroup; });
__webpack_require__.d(__webpack_exports__, "__experimentalNavigationItem", function() { return /* reexport */ NavigationItem; });
__webpack_require__.d(__webpack_exports__, "__experimentalNavigationMenu", function() { return /* reexport */ NavigationMenu; });
__webpack_require__.d(__webpack_exports__, "Notice", function() { return /* reexport */ build_module_notice; });
__webpack_require__.d(__webpack_exports__, "__experimentalNumberControl", function() { return /* reexport */ number_control; });
__webpack_require__.d(__webpack_exports__, "NoticeList", function() { return /* reexport */ list; });
__webpack_require__.d(__webpack_exports__, "Panel", function() { return /* reexport */ panel; });
__webpack_require__.d(__webpack_exports__, "PanelBody", function() { return /* reexport */ panel_body; });
__webpack_require__.d(__webpack_exports__, "PanelHeader", function() { return /* reexport */ panel_header; });
__webpack_require__.d(__webpack_exports__, "PanelRow", function() { return /* reexport */ panel_row; });
__webpack_require__.d(__webpack_exports__, "Placeholder", function() { return /* reexport */ build_module_placeholder; });
__webpack_require__.d(__webpack_exports__, "Popover", function() { return /* reexport */ build_module_popover["a" /* default */]; });
__webpack_require__.d(__webpack_exports__, "QueryControls", function() { return /* reexport */ QueryControls; });
__webpack_require__.d(__webpack_exports__, "__experimentalRadio", function() { return /* reexport */ build_module_radio; });
__webpack_require__.d(__webpack_exports__, "__experimentalRadioGroup", function() { return /* reexport */ radio_group; });
__webpack_require__.d(__webpack_exports__, "RadioControl", function() { return /* reexport */ RadioControl; });
__webpack_require__.d(__webpack_exports__, "RangeControl", function() { return /* reexport */ range_control; });
__webpack_require__.d(__webpack_exports__, "ResizableBox", function() { return /* reexport */ resizable_box; });
__webpack_require__.d(__webpack_exports__, "ResponsiveWrapper", function() { return /* reexport */ responsive_wrapper; });
__webpack_require__.d(__webpack_exports__, "SandBox", function() { return /* reexport */ Sandbox; });
__webpack_require__.d(__webpack_exports__, "SelectControl", function() { return /* reexport */ select_control; });
__webpack_require__.d(__webpack_exports__, "Snackbar", function() { return /* reexport */ snackbar["a" /* default */]; });
__webpack_require__.d(__webpack_exports__, "SnackbarList", function() { return /* reexport */ snackbar_list; });
__webpack_require__.d(__webpack_exports__, "__experimentalSpacer", function() { return /* reexport */ spacer_component; });
__webpack_require__.d(__webpack_exports__, "Spinner", function() { return /* reexport */ Spinner; });
__webpack_require__.d(__webpack_exports__, "TabPanel", function() { return /* reexport */ TabPanel; });
__webpack_require__.d(__webpack_exports__, "__experimentalText", function() { return /* reexport */ text_component; });
__webpack_require__.d(__webpack_exports__, "TextControl", function() { return /* reexport */ text_control; });
__webpack_require__.d(__webpack_exports__, "TextareaControl", function() { return /* reexport */ TextareaControl; });
__webpack_require__.d(__webpack_exports__, "TextHighlight", function() { return /* reexport */ text_highlight; });
__webpack_require__.d(__webpack_exports__, "Tip", function() { return /* reexport */ tip; });
__webpack_require__.d(__webpack_exports__, "ToggleControl", function() { return /* reexport */ ToggleControl; });
__webpack_require__.d(__webpack_exports__, "Toolbar", function() { return /* reexport */ toolbar; });
__webpack_require__.d(__webpack_exports__, "ToolbarButton", function() { return /* reexport */ toolbar_button; });
__webpack_require__.d(__webpack_exports__, "ToolbarDropdownMenu", function() { return /* reexport */ toolbar_dropdown_menu; });
__webpack_require__.d(__webpack_exports__, "__experimentalToolbarContext", function() { return /* reexport */ toolbar_context["a" /* default */]; });
__webpack_require__.d(__webpack_exports__, "ToolbarGroup", function() { return /* reexport */ toolbar_group; });
__webpack_require__.d(__webpack_exports__, "ToolbarItem", function() { return /* reexport */ toolbar_item["a" /* default */]; });
__webpack_require__.d(__webpack_exports__, "Tooltip", function() { return /* reexport */ build_module_tooltip["a" /* default */]; });
__webpack_require__.d(__webpack_exports__, "__experimentalTreeGrid", function() { return /* reexport */ tree_grid; });
__webpack_require__.d(__webpack_exports__, "__experimentalTreeGridRow", function() { return /* reexport */ tree_grid_row; });
__webpack_require__.d(__webpack_exports__, "__experimentalTreeGridCell", function() { return /* reexport */ tree_grid_cell; });
__webpack_require__.d(__webpack_exports__, "__experimentalTreeGridItem", function() { return /* reexport */ tree_grid_item; });
__webpack_require__.d(__webpack_exports__, "TreeSelect", function() { return /* reexport */ TreeSelect; });
__webpack_require__.d(__webpack_exports__, "__experimentalTruncate", function() { return /* reexport */ truncate_component; });
__webpack_require__.d(__webpack_exports__, "__experimentalUnitControl", function() { return /* reexport */ unit_control; });
__webpack_require__.d(__webpack_exports__, "__experimentalUseCustomUnits", function() { return /* reexport */ useCustomUnits; });
__webpack_require__.d(__webpack_exports__, "VisuallyHidden", function() { return /* reexport */ visually_hidden["a" /* default */]; });
__webpack_require__.d(__webpack_exports__, "__experimentalVStack", function() { return /* reexport */ v_stack_component; });
__webpack_require__.d(__webpack_exports__, "IsolatedEventContainer", function() { return /* reexport */ isolated_event_container; });
__webpack_require__.d(__webpack_exports__, "createSlotFill", function() { return /* reexport */ slot_fill["d" /* createSlotFill */]; });
__webpack_require__.d(__webpack_exports__, "Slot", function() { return /* reexport */ slot_fill["c" /* Slot */]; });
__webpack_require__.d(__webpack_exports__, "Fill", function() { return /* reexport */ slot_fill["a" /* Fill */]; });
__webpack_require__.d(__webpack_exports__, "SlotFillProvider", function() { return /* reexport */ slot_fill["b" /* Provider */]; });
__webpack_require__.d(__webpack_exports__, "__experimentalUseSlot", function() { return /* reexport */ use_slot["a" /* default */]; });
__webpack_require__.d(__webpack_exports__, "__experimentalStyleProvider", function() { return /* reexport */ StyleProvider; });
__webpack_require__.d(__webpack_exports__, "navigateRegions", function() { return /* reexport */ navigate_regions; });
__webpack_require__.d(__webpack_exports__, "__unstableUseNavigateRegions", function() { return /* reexport */ useNavigateRegions; });
__webpack_require__.d(__webpack_exports__, "withConstrainedTabbing", function() { return /* reexport */ with_constrained_tabbing; });
__webpack_require__.d(__webpack_exports__, "withFallbackStyles", function() { return /* reexport */ with_fallback_styles; });
__webpack_require__.d(__webpack_exports__, "withFilters", function() { return /* reexport */ withFilters; });
__webpack_require__.d(__webpack_exports__, "withFocusOutside", function() { return /* reexport */ with_focus_outside; });
__webpack_require__.d(__webpack_exports__, "withFocusReturn", function() { return /* reexport */ with_focus_return; });
__webpack_require__.d(__webpack_exports__, "FocusReturnProvider", function() { return /* reexport */ with_focus_return_Provider; });
__webpack_require__.d(__webpack_exports__, "withNotices", function() { return /* reexport */ with_notices; });
__webpack_require__.d(__webpack_exports__, "withSpokenMessages", function() { return /* reexport */ with_spoken_messages; });
__webpack_require__.d(__webpack_exports__, "__unstableWithNext", function() { return /* reexport */ with_next["a" /* withNext */]; });
__webpack_require__.d(__webpack_exports__, "__unstableComponentSystemProvider", function() { return /* reexport */ ComponentSystemProvider; });
// NAMESPACE OBJECT: ./node_modules/@wordpress/components/build-module/text/styles.js
var text_styles_namespaceObject = {};
__webpack_require__.r(text_styles_namespaceObject);
__webpack_require__.d(text_styles_namespaceObject, "Text", function() { return Text; });
__webpack_require__.d(text_styles_namespaceObject, "block", function() { return styles_block; });
__webpack_require__.d(text_styles_namespaceObject, "positive", function() { return positive; });
__webpack_require__.d(text_styles_namespaceObject, "destructive", function() { return destructive; });
__webpack_require__.d(text_styles_namespaceObject, "muted", function() { return styles_muted; });
__webpack_require__.d(text_styles_namespaceObject, "highlighterText", function() { return highlighterText; });
__webpack_require__.d(text_styles_namespaceObject, "upperCase", function() { return styles_upperCase; });
// EXTERNAL MODULE: external ["wp","primitives"]
var external_wp_primitives_ = __webpack_require__("Tqx9");
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js
var esm_extends = __webpack_require__("wx14");
// EXTERNAL MODULE: external ["wp","element"]
var external_wp_element_ = __webpack_require__("GRId");
// EXTERNAL MODULE: external "lodash"
var external_lodash_ = __webpack_require__("YLtl");
// EXTERNAL MODULE: ./node_modules/classnames/index.js
var classnames = __webpack_require__("TSYQ");
var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames);
// EXTERNAL MODULE: external ["wp","i18n"]
var external_wp_i18n_ = __webpack_require__("l3Sj");
// EXTERNAL MODULE: external ["wp","compose"]
var external_wp_compose_ = __webpack_require__("K9lf");
// EXTERNAL MODULE: ./node_modules/reakit/es/Composite/CompositeItem.js
var CompositeItem = __webpack_require__("kTC8");
// EXTERNAL MODULE: ./node_modules/@wordpress/components/build-module/tooltip/index.js + 1 modules
var build_module_tooltip = __webpack_require__("W/NR");
// EXTERNAL MODULE: ./node_modules/@wordpress/components/build-module/visually-hidden/index.js + 2 modules
var visually_hidden = __webpack_require__("ldlY");
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/alignment-matrix-control/utils.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
const GRID = [['top left', 'top center', 'top right'], ['center left', 'center center', 'center right'], ['bottom left', 'bottom center', 'bottom right']]; // Stored as map as i18n __() only accepts strings (not variables)
const ALIGNMENT_LABEL = {
'top left': Object(external_wp_i18n_["__"])('Top Left'),
'top center': Object(external_wp_i18n_["__"])('Top Center'),
'top right': Object(external_wp_i18n_["__"])('Top Right'),
'center left': Object(external_wp_i18n_["__"])('Center Left'),
'center center': Object(external_wp_i18n_["__"])('Center Center'),
'center right': Object(external_wp_i18n_["__"])('Center Right'),
'bottom left': Object(external_wp_i18n_["__"])('Bottom Left'),
'bottom center': Object(external_wp_i18n_["__"])('Bottom Center'),
'bottom right': Object(external_wp_i18n_["__"])('Bottom Right')
}; // Transforms GRID into a flat Array of values
const ALIGNMENTS = Object(external_lodash_["flattenDeep"])(GRID);
/**
* Parses and transforms an incoming value to better match the alignment values
*
* @param {string} value An alignment value to parse.
*
* @return {string} The parsed value.
*/
function transformValue(value) {
const nextValue = value === 'center' ? 'center center' : value;
return nextValue.replace('-', ' ');
}
/**
* Creates an item ID based on a prefix ID and an alignment value.
*
* @param {string} prefixId An ID to prefix.
* @param {string} value An alignment value.
*
* @return {string} The item id.
*/
function utils_getItemId(prefixId, value) {
const valueId = transformValue(value).replace(' ', '-');
return `${prefixId}-${valueId}`;
}
/**
* Retrieves the alignment index from a value.
*
* @param {string} alignment Value to check.
*
* @return {number} The index of a matching alignment.
*/
function getAlignmentIndex(alignment = 'center') {
const item = transformValue(alignment).replace('-', ' ');
const index = ALIGNMENTS.indexOf(item);
return index > -1 ? index : undefined;
}
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/defineProperty.js
var defineProperty = __webpack_require__("lSNA");
var defineProperty_default = /*#__PURE__*/__webpack_require__.n(defineProperty);
// EXTERNAL MODULE: external "React"
var external_React_ = __webpack_require__("cDcd");
var external_React_default = /*#__PURE__*/__webpack_require__.n(external_React_);
// EXTERNAL MODULE: ./node_modules/@emotion/is-prop-valid/dist/is-prop-valid.browser.esm.js
var is_prop_valid_browser_esm = __webpack_require__("9uj6");
// 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;
};
return _setPrototypeOf(o, p);
}
// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js
function _inheritsLoose(subClass, superClass) {
subClass.prototype = Object.create(superClass.prototype);
subClass.prototype.constructor = subClass;
_setPrototypeOf(subClass, superClass);
}
// EXTERNAL MODULE: ./node_modules/@emotion/cache/dist/cache.browser.esm.js + 2 modules
var cache_browser_esm = __webpack_require__("TqVZ");
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/inheritsLoose.js
var inheritsLoose = __webpack_require__("VbXa");
// EXTERNAL MODULE: ./node_modules/@emotion/utils/dist/utils.browser.esm.js
var utils_browser_esm = __webpack_require__("SIPS");
// EXTERNAL MODULE: ./node_modules/@emotion/serialize/dist/serialize.browser.esm.js + 2 modules
var serialize_browser_esm = __webpack_require__("MiSq");
// CONCATENATED MODULE: ./node_modules/@emotion/core/dist/emotion-element-57a3a7a3.browser.esm.js
var emotion_element_57a3a7a3_browser_esm_hasOwnProperty = Object.prototype.hasOwnProperty;
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' ? Object(cache_browser_esm["a" /* default */])() : 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);
});
}; // $FlowFixMe
return /*#__PURE__*/Object(external_React_["forwardRef"])(render);
};
// thus we only need to replace what is a valid character for JS, but not for CSS
var sanitizeIdentifier = function sanitizeIdentifier(identifier) {
return identifier.replace(/\$/g, '-');
};
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 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) {}
// EXTERNAL MODULE: ./node_modules/@emotion/sheet/dist/sheet.browser.esm.js
var sheet_browser_esm = __webpack_require__("z9I/");
// CONCATENATED MODULE: ./node_modules/@emotion/css/dist/css.browser.esm.js
function css_browser_esm_css() {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return Object(serialize_browser_esm["a" /* serializeStyles */])(args);
}
/* harmony default export */ var css_browser_esm = (css_browser_esm_css);
// CONCATENATED MODULE: ./node_modules/@emotion/core/dist/core.browser.esm.js
var core_browser_esm_jsx = function jsx(type, props) {
var args = arguments;
if (props == null || !emotion_element_57a3a7a3_browser_esm_hasOwnProperty.call(props, 'css')) {
// $FlowFixMe
return external_React_["createElement"].apply(undefined, args);
}
var argsLength = args.length;
var createElementArgArray = new Array(argsLength);
createElementArgArray[0] = Emotion;
createElementArgArray[1] = createEmotionProps(type, props);
for (var i = 2; i < argsLength; i++) {
createElementArgArray[i] = args[i];
} // $FlowFixMe
return external_React_["createElement"].apply(null, createElementArgArray);
};
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) {
_inheritsLoose(InnerGlobal, _React$Component);
function InnerGlobal(props, context, updater) {
return _React$Component.call(this, props, context, updater) || this;
}
var _proto = InnerGlobal.prototype;
_proto.componentDidMount = function componentDidMount() {
this.sheet = new sheet_browser_esm["a" /* StyleSheet */]({
key: this.props.cache.key + "-global",
nonce: this.props.cache.sheet.nonce,
container: this.props.cache.sheet.container
}); // $FlowFixMe
var node = document.querySelector("style[data-emotion-" + this.props.cache.key + "=\"" + this.props.serialized.name + "\"]");
if (node !== null) {
this.sheet.tags.push(node);
}
if (this.props.cache.sheet.tags.length) {
this.sheet.before = this.props.cache.sheet.tags[0];
}
this.insertStyles();
};
_proto.componentDidUpdate = function componentDidUpdate(prevProps) {
if (prevProps.serialized.name !== this.props.serialized.name) {
this.insertStyles();
}
};
_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 (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();
}
this.props.cache.insert("", this.props.serialized, this.sheet, false);
};
_proto.componentWillUnmount = function componentWillUnmount() {
this.sheet.flush();
};
_proto.render = function render() {
return null;
};
return InnerGlobal;
}(external_React_["Component"]);
var core_browser_esm_keyframes = function keyframes() {
var insertable = css_browser_esm.apply(void 0, arguments);
var name = "animation-" + insertable.name; // $FlowFixMe
return {
name: name,
styles: "@keyframes " + name + "{" + insertable.styles + "}",
anim: 1,
toString: function toString() {
return "_EMO_" + this.name + "_" + this.styles + "_EMO_";
}
};
};
var core_browser_esm_classnames = function classnames(args) {
var len = args.length;
var i = 0;
var cls = '';
for (; i < len; i++) {
var arg = args[i];
if (arg == null) continue;
var toAdd = void 0;
switch (typeof arg) {
case 'boolean':
break;
case 'object':
{
if (Array.isArray(arg)) {
toAdd = classnames(arg);
} else {
toAdd = '';
for (var k in arg) {
if (arg[k] && k) {
toAdd && (toAdd += ' ');
toAdd += k;
}
}
}
break;
}
default:
{
toAdd = arg;
}
}
if (toAdd) {
cls && (cls += ' ');
cls += toAdd;
}
}
return cls;
};
function merge(registered, css, className) {
var registeredStyles = [];
var rawClassName = Object(utils_browser_esm["a" /* getRegisteredStyles */])(registered, registeredStyles, className);
if (registeredStyles.length < 2) {
return className;
}
return rawClassName + css(registeredStyles);
}
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;
var css = function css() {
if (hasRendered && "production" !== 'production') {
throw new Error('css can only be used during render');
}
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
var serialized = Object(serialize_browser_esm["a" /* serializeStyles */])(args, context.registered);
{
Object(utils_browser_esm["b" /* insertStyles */])(context, serialized, false);
}
return context.key + "-" + serialized.name;
};
var cx = function cx() {
if (hasRendered && "production" !== 'production') {
throw new Error('cx can only be used during render');
}
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
args[_key2] = arguments[_key2];
}
return merge(context.registered, css, core_browser_esm_classnames(args));
};
var content = {
css: css,
cx: cx,
theme: theme
};
var ele = props.children(content);
hasRendered = true;
return ele;
});
});
// CONCATENATED MODULE: ./node_modules/@emotion/styled-base/dist/styled-base.browser.esm.js
var testOmitPropsOnStringTag = is_prop_valid_browser_esm["default"];
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;
};
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(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";
var styled_base_browser_esm_createStyled = function createStyled(tag, options) {
if (false) {}
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;
}
var isReal = tag.__emotion_real === tag;
var baseTag = isReal && tag.__emotion_base || tag;
if (typeof shouldForwardProp !== 'function' && isReal) {
shouldForwardProp = tag.__emotion_forwardProp;
}
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) : [];
if (identifierName !== undefined) {
styles.push("label:" + identifierName + ";");
}
if (args[0] == null || args[0].raw === undefined) {
styles.push.apply(styles, args);
} else {
if (false) {}
styles.push(args[0][0]);
var len = args.length;
var i = 1;
for (; i < len; i++) {
if (false) {}
styles.push(args[i], args[0][i]);
}
} // $FlowFixMe: we need to cast StatelessFunctionalComponent to our PrivateStyledComponent class
var Styled = emotion_element_57a3a7a3_browser_esm_withEmotionCache(function (props, context, ref) {
return Object(external_React_["createElement"])(ThemeContext.Consumer, null, function (theme) {
var finalTag = shouldUseAs && props.as || baseTag;
var className = '';
var classInterpolations = [];
var mergedProps = props;
if (props.theme == null) {
mergedProps = {};
for (var key in props) {
mergedProps[key] = props[key];
}
mergedProps.theme = theme;
}
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 + " ";
}
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;
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;
if (false) {}
var ele = Object(external_React_["createElement"])(finalTag, newProps);
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;
}
});
Styled.withComponent = function (nextTag, nextOptions) {
return createStyled(nextTag, nextOptions !== undefined ? _objectSpread({}, options || {}, {}, nextOptions) : options).apply(void 0, styles);
};
return Styled;
};
};
/* harmony default export */ var styled_base_browser_esm = (styled_base_browser_esm_createStyled);
// EXTERNAL MODULE: ./node_modules/tinycolor2/tinycolor.js
var tinycolor = __webpack_require__("Zss7");
var tinycolor_default = /*#__PURE__*/__webpack_require__.n(tinycolor);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/utils/colors.js
/**
* External dependencies
*/
/**
* Generating a CSS compliant 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)
*/
function rgba(hexValue = '', alpha = 1) {
const {
r,
g,
b
} = tinycolor_default()(hexValue).toRgb();
return `rgba(${r}, ${g}, ${b}, ${alpha})`;
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/utils/colors-values.js
/**
* External dependencies
*/
/**
* Internal dependencies
*/
const BASE = {
black: '#000',
white: '#fff'
};
/**
* TODO: Continue to update values as "G2" design evolves.
*
* "G2" refers to the movement to advance the interface of the block editor.
* https://github.com/WordPress/gutenberg/issues/18667
*/
const 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',
heading: '#050505'
},
mediumGray: {
text: '#757575'
},
lightGray: {
ui: '#949494',
secondary: '#ccc',
tertiary: '#e7e8e9'
}
};
const 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',
placeholder: rgba(G2.gray[900], 0.62)
};
const DARK_OPACITY = {
900: rgba('#000510', 0.9),
800: rgba('#00000a', 0.85),
700: rgba('#06060b', 0.8),
600: rgba('#000913', 0.75),
500: rgba('#0a1829', 0.7),
400: rgba('#0a1829', 0.65),
300: rgba('#0e1c2e', 0.62),
200: rgba('#162435', 0.55),
100: rgba('#223443', 0.5),
backgroundFill: rgba(DARK_GRAY[700], 0.7)
};
const DARK_OPACITY_LIGHT = {
900: rgba('#304455', 0.45),
800: rgba('#425863', 0.4),
700: rgba('#667886', 0.35),
600: rgba('#7b86a2', 0.3),
500: rgba('#9197a2', 0.25),
400: rgba('#95959c', 0.2),
300: rgba('#829493', 0.15),
200: rgba('#8b8b96', 0.1),
100: rgba('#747474', 0.05)
};
const 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',
placeholder: rgba(BASE.white, 0.65)
};
const LIGHT_OPACITY_LIGHT = {
900: rgba(BASE.white, 0.5),
800: rgba(BASE.white, 0.45),
700: rgba(BASE.white, 0.4),
600: rgba(BASE.white, 0.35),
500: rgba(BASE.white, 0.3),
400: rgba(BASE.white, 0.25),
300: rgba(BASE.white, 0.2),
200: rgba(BASE.white, 0.15),
100: rgba(BASE.white, 0.1),
backgroundFill: rgba(LIGHT_GRAY[300], 0.8)
}; // Additional colors.
// Some are from https://make.wordpress.org/design/handbook/foundations/colors/.
const 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'
}
};
const ALERT = {
yellow: '#f0b849',
red: '#d94f4f',
green: '#4ab866'
};
const ADMIN = {
theme: `var( --wp-admin-theme-color, ${BLUE.wordpress[700]})`,
themeDark10: `var( --wp-admin-theme-color-darker-10, ${BLUE.medium.focus})`
}; // Namespaced values for raw colors hex codes
const 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
};
const COLORS = { ...BASE,
darkGray: Object(external_lodash_["merge"])({}, DARK_GRAY, G2.darkGray),
darkOpacity: DARK_OPACITY,
darkOpacityLight: DARK_OPACITY_LIGHT,
mediumGray: G2.mediumGray,
gray: G2.gray,
lightGray: Object(external_lodash_["merge"])({}, LIGHT_GRAY, G2.lightGray),
lightGrayLight: LIGHT_OPACITY_LIGHT,
blue: Object(external_lodash_["merge"])({}, BLUE, G2.blue),
alert: ALERT,
admin: ADMIN,
ui: UI
};
/* harmony default export */ var colors_values = (COLORS);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/utils/reduce-motion.js
/**
* Allows users to opt-out of animations via OS-level preferences.
*
* @param {'transition' | 'animation' | string} [prop='transition'] CSS Property name
* @return {string} Generated CSS code for the reduced style
*/
function reduceMotion(prop = 'transition') {
let style;
switch (prop) {
case 'transition':
style = 'transition-duration: 0ms;';
break;
case 'animation':
style = 'animation-duration: 1ms;';
break;
default:
style = `
animation-duration: 1ms;
transition-duration: 0ms;
`;
}
return `
@media ( prefers-reduced-motion: reduce ) {
${style};
}
`;
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/alignment-matrix-control/styles/alignment-matrix-control-styles.js
function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
/**
* Internal dependencies
*/
var alignment_matrix_control_styles_ref = true ? {
name: "1xiracb",
styles: "border-radius:2px;box-sizing:border-box;display:grid;grid-template-columns:repeat( 3,1fr );outline:none;"
} : undefined;
const rootBase = () => {
return alignment_matrix_control_styles_ref;
};
const rootSize = ({
size = 92
}) => {
return /*#__PURE__*/css_browser_esm("grid-template-rows:repeat( 3,calc( ", size, "px / 3 ) );width:", size, "px;" + ( true ? "" : undefined));
};
const Root = styled_base_browser_esm("div", {
target: "e1od1u4s0",
label: "Root"
})(rootBase, ";border:1px solid transparent;cursor:pointer;grid-template-columns:auto;", rootSize, ";" + ( true ? "" : undefined));
const Row = styled_base_browser_esm("div", {
target: "e1od1u4s1",
label: "Row"
})( true ? {
name: "1177s8r",
styles: "box-sizing:border-box;display:grid;grid-template-columns:repeat( 3,1fr );"
} : undefined);
const pointActive = ({
isActive
}) => {
const boxShadow = isActive ? `0 0 0 2px ${COLORS.black}` : null;
const pointColor = isActive ? COLORS.black : COLORS.lightGray[800];
const pointColorHover = isActive ? COLORS.black : COLORS.blue.medium.focus;
return /*#__PURE__*/css_browser_esm("box-shadow:", boxShadow, ";color:", pointColor, ";*:hover > &{color:", pointColorHover, ";}" + ( true ? "" : undefined));
};
const pointBase = props => {
return /*#__PURE__*/css_browser_esm("background:currentColor;box-sizing:border-box;display:grid;margin:auto;transition:all 120ms linear;", reduceMotion('transition'), " ", pointActive(props), true ? "" : undefined);
};
const Point = styled_base_browser_esm("span", {
target: "e1od1u4s2",
label: "Point"
})("height:6px;width:6px;", pointBase, true ? "" : undefined);
const Cell = styled_base_browser_esm("span", {
target: "e1od1u4s3",
label: "Cell"
})( true ? {
name: "10ro24i",
styles: "appearance:none;border:none;box-sizing:border-box;margin:0;display:flex;position:relative;outline:none;align-items:center;justify-content:center;padding:0;"
} : undefined);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/alignment-matrix-control/cell.js
/**
* Internal dependencies
*/
/**
* Internal dependencies
*/
function cell_Cell({
isActive = false,
value,
...props
}) {
const tooltipText = ALIGNMENT_LABEL[value];
return Object(external_wp_element_["createElement"])(build_module_tooltip["a" /* default */], {
text: tooltipText
}, Object(external_wp_element_["createElement"])(CompositeItem["a" /* CompositeItem */], Object(esm_extends["a" /* default */])({
as: Cell,
role: "gridcell"
}, props), Object(external_wp_element_["createElement"])(visually_hidden["a" /* default */], null, value), Object(external_wp_element_["createElement"])(Point, {
isActive: isActive,
role: "presentation"
})));
}
// EXTERNAL MODULE: ./node_modules/reakit/es/_rollupPluginBabelHelpers-1f0bf8c2.js
var _rollupPluginBabelHelpers_1f0bf8c2 = __webpack_require__("BZp5");
// EXTERNAL MODULE: ./node_modules/reakit-utils/es/useIsomorphicEffect.js
var useIsomorphicEffect = __webpack_require__("AXvK");
// CONCATENATED MODULE: ./node_modules/reakit-utils/es/useSealedState.js
/**
* React custom hook that returns the very first value passed to `initialState`,
* even if it changes between re-renders.
*/
function useSealedState(initialState) {
var _React$useState = Object(external_React_["useState"])(initialState),
sealed = _React$useState[0];
return sealed;
}
// EXTERNAL MODULE: ./node_modules/reakit-utils/es/getDocument.js
var getDocument = __webpack_require__("ouKs");
// CONCATENATED MODULE: ./node_modules/reakit/es/reverse-30eaa122.js
function groupItems(items) {
var groups = [[]];
var _loop = function _loop() {
var item = _step.value;
var group = groups.find(function (g) {
return !g[0] || g[0].groupId === item.groupId;
});
if (group) {
group.push(item);
} else {
groups.push([item]);
}
};
for (var _iterator = Object(_rollupPluginBabelHelpers_1f0bf8c2["c" /* b */])(items), _step; !(_step = _iterator()).done;) {
_loop();
}
return groups;
}
function flatten(grid) {
var flattened = [];
for (var _iterator = Object(_rollupPluginBabelHelpers_1f0bf8c2["c" /* b */])(grid), _step; !(_step = _iterator()).done;) {
var row = _step.value;
flattened.push.apply(flattened, row);
}
return flattened;
}
function reverse(array) {
return array.slice().reverse();
}
// EXTERNAL MODULE: ./node_modules/reakit/es/getCurrentId-5aa9849e.js
var getCurrentId_5aa9849e = __webpack_require__("iYXd");
// CONCATENATED MODULE: ./node_modules/reakit/es/findEnabledItemById-8ddca752.js
function findEnabledItemById(items, id) {
if (!id) return undefined;
return items === null || items === void 0 ? void 0 : items.find(function (item) {
return item.id === id && !item.disabled;
});
}
// CONCATENATED MODULE: ./node_modules/reakit-utils/es/applyState.js
function isUpdater(argument) {
return typeof argument === "function";
}
/**
* Receives a `setState` argument and calls it with `currentValue` if it's a
* function. Otherwise return the argument as the new value.
*
* @example
* import { applyState } from "reakit-utils";
*
* applyState((value) => value + 1, 1); // 2
* applyState(2, 1); // 2
*/
function applyState(argument, currentValue) {
if (isUpdater(argument)) {
return argument(currentValue);
}
return argument;
}
// EXTERNAL MODULE: ./node_modules/reakit/es/Id/IdProvider.js
var IdProvider = __webpack_require__("KCH1");
// CONCATENATED MODULE: ./node_modules/reakit/es/Id/IdState.js
function unstable_useIdState(initialState) {
if (initialState === void 0) {
initialState = {};
}
var _useSealedState = useSealedState(initialState),
initialBaseId = _useSealedState.baseId;
var generateId = Object(external_React_["useContext"])(IdProvider["a" /* unstable_IdContext */]);
var idCountRef = Object(external_React_["useRef"])(0);
var _React$useState = Object(external_React_["useState"])(function () {
return initialBaseId || generateId();
}),
baseId = _React$useState[0],
setBaseId = _React$useState[1];
return {
baseId: baseId,
setBaseId: setBaseId,
unstable_idCountRef: idCountRef
};
}
// CONCATENATED MODULE: ./node_modules/reakit/es/Composite/CompositeState.js
function isElementPreceding(element1, element2) {
return Boolean(element2.compareDocumentPosition(element1) & Node.DOCUMENT_POSITION_PRECEDING);
}
function findDOMIndex(items, item) {
return items.findIndex(function (currentItem) {
if (!currentItem.ref.current || !item.ref.current) {
return false;
}
return isElementPreceding(item.ref.current, currentItem.ref.current);
});
}
function getMaxLength(rows) {
var maxLength = 0;
for (var _iterator = Object(_rollupPluginBabelHelpers_1f0bf8c2["c" /* b */])(rows), _step; !(_step = _iterator()).done;) {
var length = _step.value.length;
if (length > maxLength) {
maxLength = length;
}
}
return maxLength;
}
/**
* Turns [row1, row1, row2, row2] into [row1, row2, row1, row2]
*/
function verticalizeItems(items) {
var groups = groupItems(items);
var maxLength = getMaxLength(groups);
var verticalized = [];
for (var i = 0; i < maxLength; i += 1) {
for (var _iterator = Object(_rollupPluginBabelHelpers_1f0bf8c2["c" /* b */])(groups), _step; !(_step = _iterator()).done;) {
var group = _step.value;
if (group[i]) {
verticalized.push(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({}, group[i]), {}, {
// If there's no groupId, it means that it's not a grid composite,
// but a single row instead. So, instead of verticalizing it, that
// is, assigning a different groupId based on the column index, we
// keep it undefined so they will be part of the same group.
// It's useful when using up/down on one-dimensional composites.
groupId: group[i].groupId ? "" + i : undefined
}));
}
}
}
return verticalized;
}
function createEmptyItem(groupId) {
return {
id: "__EMPTY_ITEM__",
disabled: true,
ref: {
current: null
},
groupId: groupId
};
}
/**
* Turns [[row1, row1], [row2]] into [[row1, row1], [row2, row2]]
*/
function fillGroups(groups, currentId, shift) {
var maxLength = getMaxLength(groups);
for (var _iterator = Object(_rollupPluginBabelHelpers_1f0bf8c2["c" /* b */])(groups), _step; !(_step = _iterator()).done;) {
var group = _step.value;
for (var i = 0; i < maxLength; i += 1) {
var item = group[i];
if (!item || shift && item.disabled) {
var isFrist = i === 0;
var previousItem = isFrist && shift ? Object(getCurrentId_5aa9849e["a" /* f */])(group) : group[i - 1];
group[i] = previousItem && currentId !== (previousItem === null || previousItem === void 0 ? void 0 : previousItem.id) && shift ? previousItem : createEmptyItem(previousItem === null || previousItem === void 0 ? void 0 : previousItem.groupId);
}
}
}
return groups;
}
var nullItem = {
id: null,
ref: {
current: null
}
};
function placeItemsAfter(items, id, shouldInsertNullItem) {
var index = items.findIndex(function (item) {
return item.id === id;
});
return [].concat(items.slice(index + 1), shouldInsertNullItem ? [nullItem] : [], items.slice(0, index));
}
function getItemsInGroup(items, groupId) {
return items.filter(function (item) {
return item.groupId === groupId;
});
}
var map = {
horizontal: "vertical",
vertical: "horizontal"
};
function getOppositeOrientation(orientation) {
return orientation && map[orientation];
}
function addItemAtIndex(array, item, index) {
if (!(index in array)) {
return [].concat(array, [item]);
}
return [].concat(array.slice(0, index), [item], array.slice(index));
}
function sortBasedOnDOMPosition(items) {
var pairs = items.map(function (item, index) {
return [index, item];
});
var isOrderDifferent = false;
pairs.sort(function (_ref, _ref2) {
var indexA = _ref[0],
a = _ref[1];
var indexB = _ref2[0],
b = _ref2[1];
var elementA = a.ref.current;
var elementB = b.ref.current;
if (!elementA || !elementB) return 0; // a before b
if (isElementPreceding(elementA, elementB)) {
if (indexA > indexB) {
isOrderDifferent = true;
}
return -1;
} // a after b
if (indexA < indexB) {
isOrderDifferent = true;
}
return 1;
});
if (isOrderDifferent) {
return pairs.map(function (_ref3) {
var _ = _ref3[0],
item = _ref3[1];
return item;
});
}
return items;
}
function setItemsBasedOnDOMPosition(items, setItems) {
var sortedItems = sortBasedOnDOMPosition(items);
if (items !== sortedItems) {
setItems(sortedItems);
}
}
function getCommonParent(items) {
var _firstItem$ref$curren;
var firstItem = items[0],
nextItems = items.slice(1);
var parentElement = firstItem === null || firstItem === void 0 ? void 0 : (_firstItem$ref$curren = firstItem.ref.current) === null || _firstItem$ref$curren === void 0 ? void 0 : _firstItem$ref$curren.parentElement;
var _loop = function _loop() {
var parent = parentElement;
if (nextItems.every(function (item) {
return parent.contains(item.ref.current);
})) {
return {
v: parentElement
};
}
parentElement = parentElement.parentElement;
};
while (parentElement) {
var _ret = _loop();
if (typeof _ret === "object") return _ret.v;
}
return Object(getDocument["a" /* getDocument */])(parentElement).body;
} // istanbul ignore next: JSDOM doesn't support IntersectionObverser
// See https://github.com/jsdom/jsdom/issues/2032
function useIntersectionObserver(items, setItems) {
var previousItems = Object(external_React_["useRef"])([]);
Object(external_React_["useEffect"])(function () {
var callback = function callback() {
var hasPreviousItems = !!previousItems.current.length; // We don't want to sort items if items have been just registered.
if (hasPreviousItems) {
setItemsBasedOnDOMPosition(items, setItems);
}
previousItems.current = items;
};
var root = getCommonParent(items);
var observer = new IntersectionObserver(callback, {
root: root
});
for (var _iterator = Object(_rollupPluginBabelHelpers_1f0bf8c2["c" /* b */])(items), _step; !(_step = _iterator()).done;) {
var item = _step.value;
if (item.ref.current) {
observer.observe(item.ref.current);
}
}
return function () {
observer.disconnect();
};
}, [items]);
}
function useTimeoutObserver(items, setItems) {
Object(external_React_["useEffect"])(function () {
var callback = function callback() {
return setItemsBasedOnDOMPosition(items, setItems);
};
var timeout = setTimeout(callback, 250);
return function () {
return clearTimeout(timeout);
};
});
}
function useSortBasedOnDOMPosition(items, setItems) {
if (typeof IntersectionObserver === "function") {
useIntersectionObserver(items, setItems);
} else {
useTimeoutObserver(items, setItems);
}
}
function CompositeState_reducer(state, action) {
var virtual = state.unstable_virtual,
rtl = state.rtl,
orientation = state.orientation,
items = state.items,
groups = state.groups,
currentId = state.currentId,
loop = state.loop,
wrap = state.wrap,
pastIds = state.pastIds,
shift = state.shift,
moves = state.unstable_moves,
includesBaseElement = state.unstable_includesBaseElement,
initialVirtual = state.initialVirtual,
initialRTL = state.initialRTL,
initialOrientation = state.initialOrientation,
initialCurrentId = state.initialCurrentId,
initialLoop = state.initialLoop,
initialWrap = state.initialWrap,
initialShift = state.initialShift,
hasSetCurrentId = state.hasSetCurrentId;
switch (action.type) {
case "registerGroup":
{
var _group = action.group; // If there are no groups yet, just add it as the first one
if (groups.length === 0) {
return Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({}, state), {}, {
groups: [_group]
});
} // Finds the group index based on DOM position
var index = findDOMIndex(groups, _group);
return Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({}, state), {}, {
groups: addItemAtIndex(groups, _group, index)
});
}
case "unregisterGroup":
{
var _id = action.id;
var nextGroups = groups.filter(function (group) {
return group.id !== _id;
}); // The group isn't registered, so do nothing
if (nextGroups.length === groups.length) {
return state;
}
return Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({}, state), {}, {
groups: nextGroups
});
}
case "registerItem":
{
var _item = action.item; // Finds the item group based on the DOM hierarchy
var _group2 = groups.find(function (r) {
var _r$ref$current;
return (_r$ref$current = r.ref.current) === null || _r$ref$current === void 0 ? void 0 : _r$ref$current.contains(_item.ref.current);
}); // Group will be null if it's a one-dimensional composite
var nextItem = Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({
groupId: _group2 === null || _group2 === void 0 ? void 0 : _group2.id
}, _item);
var _index = findDOMIndex(items, nextItem);
var nextState = Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({}, state), {}, {
items: addItemAtIndex(items, nextItem, _index)
});
if (!hasSetCurrentId && !moves && initialCurrentId === undefined) {
var _findFirstEnabledItem;
// Sets currentId to the first enabled item. This runs whenever an item
// is registered because the first enabled item may be registered
// asynchronously.
return Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({}, nextState), {}, {
currentId: (_findFirstEnabledItem = Object(getCurrentId_5aa9849e["a" /* f */])(nextState.items)) === null || _findFirstEnabledItem === void 0 ? void 0 : _findFirstEnabledItem.id
});
}
return nextState;
}
case "unregisterItem":
{
var _id2 = action.id;
var nextItems = items.filter(function (item) {
return item.id !== _id2;
}); // The item isn't registered, so do nothing
if (nextItems.length === items.length) {
return state;
} // Filters out the item that is being removed from the pastIds list
var nextPastIds = pastIds.filter(function (pastId) {
return pastId !== _id2;
});
var _nextState = Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({}, state), {}, {
pastIds: nextPastIds,
items: nextItems
}); // If the current item is the item that is being removed, focus pastId
if (currentId && currentId === _id2) {
var nextId = includesBaseElement ? null : Object(getCurrentId_5aa9849e["b" /* g */])(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({}, _nextState), {}, {
currentId: nextPastIds[0]
}));
return Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({}, _nextState), {}, {
currentId: nextId
});
}
return _nextState;
}
case "move":
{
var _id3 = action.id; // move() does nothing
if (_id3 === undefined) {
return state;
} // Removes the current item and the item that is receiving focus from the
// pastIds list
var filteredPastIds = pastIds.filter(function (pastId) {
return pastId !== currentId && pastId !== _id3;
}); // If there's a currentId, add it to the pastIds list so it can be focused
// if the new item gets removed or disabled
var _nextPastIds = currentId ? [currentId].concat(filteredPastIds) : filteredPastIds;
var _nextState2 = Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({}, state), {}, {
pastIds: _nextPastIds
}); // move(null) will focus the composite element itself, not an item
if (_id3 === null) {
return Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({}, _nextState2), {}, {
unstable_moves: moves + 1,
currentId: Object(getCurrentId_5aa9849e["b" /* g */])(_nextState2, _id3)
});
}
var _item2 = findEnabledItemById(items, _id3);
return Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({}, _nextState2), {}, {
unstable_moves: _item2 ? moves + 1 : moves,
currentId: Object(getCurrentId_5aa9849e["b" /* g */])(_nextState2, _item2 === null || _item2 === void 0 ? void 0 : _item2.id)
});
}
case "next":
{
// If there's no item focused, we just move the first one
if (currentId == null) {
return CompositeState_reducer(state, Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({}, action), {}, {
type: "first"
}));
} // RTL doesn't make sense on vertical navigation
var isHorizontal = orientation !== "vertical";
var isRTL = rtl && isHorizontal;
var allItems = isRTL ? reverse(items) : items;
var currentItem = allItems.find(function (item) {
return item.id === currentId;
}); // If there's no item focused, we just move the first one
if (!currentItem) {
return CompositeState_reducer(state, Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({}, action), {}, {
type: "first"
}));
}
var isGrid = !!currentItem.groupId;
var currentIndex = allItems.indexOf(currentItem);
var _nextItems = allItems.slice(currentIndex + 1);
var nextItemsInGroup = getItemsInGroup(_nextItems, currentItem.groupId); // Home, End
if (action.allTheWay) {
// We reverse so we can get the last enabled item in the group. If it's
// RTL, nextItems and nextItemsInGroup are already reversed and don't
// have the items before the current one anymore. So we have to get
// items in group again with allItems.
var _nextItem2 = Object(getCurrentId_5aa9849e["a" /* f */])(isRTL ? getItemsInGroup(allItems, currentItem.groupId) : reverse(nextItemsInGroup));
return CompositeState_reducer(state, Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({}, action), {}, {
type: "move",
id: _nextItem2 === null || _nextItem2 === void 0 ? void 0 : _nextItem2.id
}));
}
var oppositeOrientation = getOppositeOrientation( // If it's a grid and orientation is not set, it's a next/previous
// call, which is inherently horizontal. up/down will call next with
// orientation set to vertical by default (see below on up/down cases).
isGrid ? orientation || "horizontal" : orientation);
var canLoop = loop && loop !== oppositeOrientation;
var canWrap = isGrid && wrap && wrap !== oppositeOrientation;
var hasNullItem = // `previous` and `up` will set action.hasNullItem, but when calling
// next directly, hasNullItem will only be true if it's not a grid and
// loop is set to true, which means that pressing right or down keys on
// grids will never focus the composite element. On one-dimensional
// composites that don't loop, pressing right or down keys also doesn't
// focus the composite element.
action.hasNullItem || !isGrid && canLoop && includesBaseElement;
if (canLoop) {
var loopItems = canWrap && !hasNullItem ? allItems : getItemsInGroup(allItems, currentItem.groupId); // Turns [0, 1, current, 3, 4] into [3, 4, 0, 1]
var sortedItems = placeItemsAfter(loopItems, currentId, hasNullItem);
var _nextItem3 = Object(getCurrentId_5aa9849e["a" /* f */])(sortedItems, currentId);
return CompositeState_reducer(state, Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({}, action), {}, {
type: "move",
id: _nextItem3 === null || _nextItem3 === void 0 ? void 0 : _nextItem3.id
}));
}
if (canWrap) {
var _nextItem4 = Object(getCurrentId_5aa9849e["a" /* f */])( // We can use nextItems, which contains all the next items, including
// items from other groups, to wrap between groups. However, if there
// is a null item (the composite element), we'll only use the next
// items in the group. So moving next from the last item will focus
// the composite element (null). On grid composites, horizontal
// navigation never focuses the composite element, only vertical.
hasNullItem ? nextItemsInGroup : _nextItems, currentId);
var _nextId = hasNullItem ? (_nextItem4 === null || _nextItem4 === void 0 ? void 0 : _nextItem4.id) || null : _nextItem4 === null || _nextItem4 === void 0 ? void 0 : _nextItem4.id;
return CompositeState_reducer(state, Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({}, action), {}, {
type: "move",
id: _nextId
}));
}
var _nextItem = Object(getCurrentId_5aa9849e["a" /* f */])(nextItemsInGroup, currentId);
if (!_nextItem && hasNullItem) {
return CompositeState_reducer(state, Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({}, action), {}, {
type: "move",
id: null
}));
}
return CompositeState_reducer(state, Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({}, action), {}, {
type: "move",
id: _nextItem === null || _nextItem === void 0 ? void 0 : _nextItem.id
}));
}
case "previous":
{
// If currentId is initially set to null, the composite element will be
// focusable while navigating with arrow keys. But, if it's a grid, we
// don't want to focus the composite element with horizontal navigation.
var _isGrid = !!groups.length;
var _hasNullItem = !_isGrid && includesBaseElement;
var _nextState3 = CompositeState_reducer(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({}, state), {}, {
items: reverse(items)
}), Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({}, action), {}, {
type: "next",
hasNullItem: _hasNullItem
}));
return Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({}, _nextState3), {}, {
items: items
});
}
case "down":
{
var shouldShift = shift && !action.allTheWay; // First, we make sure groups have the same number of items by filling it
// with disabled fake items. Then, we reorganize the items list so
// [1-1, 1-2, 2-1, 2-2] becomes [1-1, 2-1, 1-2, 2-2].
var verticalItems = verticalizeItems(flatten(fillGroups(groupItems(items), currentId, shouldShift)));
var _canLoop = loop && loop !== "horizontal"; // Pressing down arrow key will only focus the composite element if loop
// is true or vertical.
var _hasNullItem2 = _canLoop && includesBaseElement;
var _nextState4 = CompositeState_reducer(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({}, state), {}, {
orientation: "vertical",
items: verticalItems
}), Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({}, action), {}, {
type: "next",
hasNullItem: _hasNullItem2
}));
return Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({}, _nextState4), {}, {
orientation: orientation,
items: items
});
}
case "up":
{
var _shouldShift = shift && !action.allTheWay;
var _verticalItems = verticalizeItems(reverse(flatten(fillGroups(groupItems(items), currentId, _shouldShift)))); // If currentId is initially set to null, we'll always focus the
// composite element when the up arrow key is pressed in the first row.
var _hasNullItem3 = includesBaseElement;
var _nextState5 = CompositeState_reducer(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({}, state), {}, {
orientation: "vertical",
items: _verticalItems
}), Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({}, action), {}, {
type: "next",
hasNullItem: _hasNullItem3
}));
return Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({}, _nextState5), {}, {
orientation: orientation,
items: items
});
}
case "first":
{
var firstItem = Object(getCurrentId_5aa9849e["a" /* f */])(items);
return CompositeState_reducer(state, Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({}, action), {}, {
type: "move",
id: firstItem === null || firstItem === void 0 ? void 0 : firstItem.id
}));
}
case "last":
{
var _nextState6 = CompositeState_reducer(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({}, state), {}, {
items: reverse(items)
}), Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({}, action), {}, {
type: "first"
}));
return Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({}, _nextState6), {}, {
items: items
});
}
case "sort":
{
return Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({}, state), {}, {
items: sortBasedOnDOMPosition(items),
groups: sortBasedOnDOMPosition(groups)
});
}
case "setVirtual":
return Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({}, state), {}, {
unstable_virtual: applyState(action.virtual, virtual)
});
case "setRTL":
return Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({}, state), {}, {
rtl: applyState(action.rtl, rtl)
});
case "setOrientation":
return Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({}, state), {}, {
orientation: applyState(action.orientation, orientation)
});
case "setCurrentId":
{
var nextCurrentId = Object(getCurrentId_5aa9849e["b" /* g */])(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({}, state), {}, {
currentId: applyState(action.currentId, currentId)
}));
return Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({}, state), {}, {
currentId: nextCurrentId,
hasSetCurrentId: true
});
}
case "setLoop":
return Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({}, state), {}, {
loop: applyState(action.loop, loop)
});
case "setWrap":
return Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({}, state), {}, {
wrap: applyState(action.wrap, wrap)
});
case "setShift":
return Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({}, state), {}, {
shift: applyState(action.shift, shift)
});
case "setIncludesBaseElement":
{
return Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({}, state), {}, {
unstable_includesBaseElement: applyState(action.includesBaseElement, includesBaseElement)
});
}
case "reset":
return Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({}, state), {}, {
unstable_virtual: initialVirtual,
rtl: initialRTL,
orientation: initialOrientation,
currentId: Object(getCurrentId_5aa9849e["b" /* g */])(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({}, state), {}, {
currentId: initialCurrentId
})),
loop: initialLoop,
wrap: initialWrap,
shift: initialShift,
unstable_moves: 0,
pastIds: []
});
case "setItems":
{
return Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({}, state), {}, {
items: action.items
});
}
default:
throw new Error();
}
}
function useAction(fn) {
return Object(external_React_["useCallback"])(fn, []);
}
function useIsUnmountedRef() {
var isUnmountedRef = Object(external_React_["useRef"])(false);
Object(useIsomorphicEffect["a" /* useIsomorphicEffect */])(function () {
return function () {
isUnmountedRef.current = true;
};
}, []);
return isUnmountedRef;
}
function useCompositeState(initialState) {
if (initialState === void 0) {
initialState = {};
}
var _useSealedState = useSealedState(initialState),
_useSealedState$unsta = _useSealedState.unstable_virtual,
virtual = _useSealedState$unsta === void 0 ? false : _useSealedState$unsta,
_useSealedState$rtl = _useSealedState.rtl,
rtl = _useSealedState$rtl === void 0 ? false : _useSealedState$rtl,
orientation = _useSealedState.orientation,
currentId = _useSealedState.currentId,
_useSealedState$loop = _useSealedState.loop,
loop = _useSealedState$loop === void 0 ? false : _useSealedState$loop,
_useSealedState$wrap = _useSealedState.wrap,
wrap = _useSealedState$wrap === void 0 ? false : _useSealedState$wrap,
_useSealedState$shift = _useSealedState.shift,
shift = _useSealedState$shift === void 0 ? false : _useSealedState$shift,
unstable_includesBaseElement = _useSealedState.unstable_includesBaseElement,
sealed = Object(_rollupPluginBabelHelpers_1f0bf8c2["a" /* _ */])(_useSealedState, ["unstable_virtual", "rtl", "orientation", "currentId", "loop", "wrap", "shift", "unstable_includesBaseElement"]);
var idState = unstable_useIdState(sealed);
var _React$useReducer = Object(external_React_["useReducer"])(CompositeState_reducer, {
unstable_virtual: virtual,
rtl: rtl,
orientation: orientation,
items: [],
groups: [],
currentId: currentId,
loop: loop,
wrap: wrap,
shift: shift,
unstable_moves: 0,
pastIds: [],
unstable_includesBaseElement: unstable_includesBaseElement != null ? unstable_includesBaseElement : currentId === null,
initialVirtual: virtual,
initialRTL: rtl,
initialOrientation: orientation,
initialCurrentId: currentId,
initialLoop: loop,
initialWrap: wrap,
initialShift: shift
}),
_React$useReducer$ = _React$useReducer[0],
pastIds = _React$useReducer$.pastIds,
initialVirtual = _React$useReducer$.initialVirtual,
initialRTL = _React$useReducer$.initialRTL,
initialOrientation = _React$useReducer$.initialOrientation,
initialCurrentId = _React$useReducer$.initialCurrentId,
initialLoop = _React$useReducer$.initialLoop,
initialWrap = _React$useReducer$.initialWrap,
initialShift = _React$useReducer$.initialShift,
hasSetCurrentId = _React$useReducer$.hasSetCurrentId,
state = Object(_rollupPluginBabelHelpers_1f0bf8c2["a" /* _ */])(_React$useReducer$, ["pastIds", "initialVirtual", "initialRTL", "initialOrientation", "initialCurrentId", "initialLoop", "initialWrap", "initialShift", "hasSetCurrentId"]),
dispatch = _React$useReducer[1];
var _React$useState = Object(external_React_["useState"])(false),
hasActiveWidget = _React$useState[0],
setHasActiveWidget = _React$useState[1]; // register/unregister may be called when this component is unmounted. We
// store the unmounted state here so we don't update the state if it's true.
// This only happens in a very specific situation.
// See https://github.com/reakit/reakit/issues/650
var isUnmountedRef = useIsUnmountedRef();
var setItems = Object(external_React_["useCallback"])(function (items) {
return dispatch({
type: "setItems",
items: items
});
}, []);
useSortBasedOnDOMPosition(state.items, setItems);
return Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({}, idState), state), {}, {
unstable_hasActiveWidget: hasActiveWidget,
unstable_setHasActiveWidget: setHasActiveWidget,
registerItem: useAction(function (item) {
if (isUnmountedRef.current) return;
dispatch({
type: "registerItem",
item: item
});
}),
unregisterItem: useAction(function (id) {
if (isUnmountedRef.current) return;
dispatch({
type: "unregisterItem",
id: id
});
}),
registerGroup: useAction(function (group) {
if (isUnmountedRef.current) return;
dispatch({
type: "registerGroup",
group: group
});
}),
unregisterGroup: useAction(function (id) {
if (isUnmountedRef.current) return;
dispatch({
type: "unregisterGroup",
id: id
});
}),
move: useAction(function (id) {
return dispatch({
type: "move",
id: id
});
}),
next: useAction(function (allTheWay) {
return dispatch({
type: "next",
allTheWay: allTheWay
});
}),
previous: useAction(function (allTheWay) {
return dispatch({
type: "previous",
allTheWay: allTheWay
});
}),
up: useAction(function (allTheWay) {
return dispatch({
type: "up",
allTheWay: allTheWay
});
}),
down: useAction(function (allTheWay) {
return dispatch({
type: "down",
allTheWay: allTheWay
});
}),
first: useAction(function () {
return dispatch({
type: "first"
});
}),
last: useAction(function () {
return dispatch({
type: "last"
});
}),
sort: useAction(function () {
return dispatch({
type: "sort"
});
}),
unstable_setVirtual: useAction(function (value) {
return dispatch({
type: "setVirtual",
virtual: value
});
}),
setRTL: useAction(function (value) {
return dispatch({
type: "setRTL",
rtl: value
});
}),
setOrientation: useAction(function (value) {
return dispatch({
type: "setOrientation",
orientation: value
});
}),
setCurrentId: useAction(function (value) {
return dispatch({
type: "setCurrentId",
currentId: value
});
}),
setLoop: useAction(function (value) {
return dispatch({
type: "setLoop",
loop: value
});
}),
setWrap: useAction(function (value) {
return dispatch({
type: "setWrap",
wrap: value
});
}),
setShift: useAction(function (value) {
return dispatch({
type: "setShift",
shift: value
});
}),
unstable_setIncludesBaseElement: useAction(function (value) {
return dispatch({
type: "setIncludesBaseElement",
includesBaseElement: value
});
}),
reset: useAction(function () {
return dispatch({
type: "reset"
});
})
});
}
// EXTERNAL MODULE: ./node_modules/reakit-system/es/createComponent.js + 3 modules
var createComponent = __webpack_require__("hE48");
// EXTERNAL MODULE: ./node_modules/reakit-system/es/createHook.js + 4 modules
var createHook = __webpack_require__("qdes");
// EXTERNAL MODULE: ./node_modules/reakit-utils/es/useForkRef.js
var useForkRef = __webpack_require__("aU41");
// EXTERNAL MODULE: ./node_modules/reakit-warning/es/index.js + 1 modules
var es = __webpack_require__("KA1K");
// EXTERNAL MODULE: ./node_modules/reakit-utils/es/useLiveRef.js
var useLiveRef = __webpack_require__("eNtd");
// EXTERNAL MODULE: ./node_modules/reakit-utils/es/isSelfTarget.js
var isSelfTarget = __webpack_require__("k2cL");
// EXTERNAL MODULE: ./node_modules/reakit/es/Role/Role.js
var Role = __webpack_require__("zGFp");
// EXTERNAL MODULE: ./node_modules/reakit/es/Tabbable/Tabbable.js
var Tabbable = __webpack_require__("G3V0");
// EXTERNAL MODULE: ./node_modules/reakit-system/es/useCreateElement.js
var useCreateElement = __webpack_require__("IVEb");
// EXTERNAL MODULE: ./node_modules/reakit-utils/es/_rollupPluginBabelHelpers-1f0bf8c2.js
var es_rollupPluginBabelHelpers_1f0bf8c2 = __webpack_require__("I/A+");
// EXTERNAL MODULE: ./node_modules/reakit-utils/es/createEvent.js
var createEvent = __webpack_require__("khzz");
// CONCATENATED MODULE: ./node_modules/reakit-utils/es/fireBlurEvent.js
function createFocusEvent(element, type, eventInit) {
if (eventInit === void 0) {
eventInit = {};
}
if (typeof FocusEvent === "function") {
return new FocusEvent(type, eventInit);
}
return Object(createEvent["a" /* createEvent */])(element, type, eventInit);
}
/**
* Creates and dispatches a blur event in a way that also works on IE 11.
*
* @example
* import { fireBlurEvent } from "reakit-utils";
*
* fireBlurEvent(document.getElementById("id"));
*/
function fireBlurEvent(element, eventInit) {
var event = createFocusEvent(element, "blur", eventInit);
var defaultAllowed = element.dispatchEvent(event);
var bubbleInit = Object(es_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])(Object(es_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({}, eventInit), {}, {
bubbles: true
});
element.dispatchEvent(createFocusEvent(element, "focusout", bubbleInit));
return defaultAllowed;
}
// EXTERNAL MODULE: ./node_modules/reakit-utils/es/getWindow.js
var getWindow = __webpack_require__("SyVe");
// CONCATENATED MODULE: ./node_modules/reakit-utils/es/fireKeyboardEvent.js
function createKeyboardEvent(element, type, eventInit) {
if (eventInit === void 0) {
eventInit = {};
}
if (typeof KeyboardEvent === "function") {
return new KeyboardEvent(type, eventInit);
} // IE 11 doesn't support Event constructors
var event = Object(getDocument["a" /* getDocument */])(element).createEvent("KeyboardEvent");
event.initKeyboardEvent(type, eventInit.bubbles, eventInit.cancelable, Object(getWindow["a" /* getWindow */])(element), eventInit.key, eventInit.location, eventInit.ctrlKey, eventInit.altKey, eventInit.shiftKey, eventInit.metaKey);
return event;
}
/**
* Creates and dispatches `KeyboardEvent` in a way that also works on IE 11.
*
* @example
* import { fireKeyboardEvent } from "reakit-utils";
*
* fireKeyboardEvent(document.getElementById("id"), "keydown", {
* key: "ArrowDown",
* shiftKey: true,
* });
*/
function fireKeyboardEvent(element, type, eventInit) {
return element.dispatchEvent(createKeyboardEvent(element, type, eventInit));
}
// EXTERNAL MODULE: ./node_modules/reakit-utils/es/canUseDOM.js
var canUseDOM = __webpack_require__("+ipW");
// EXTERNAL MODULE: ./node_modules/reakit-utils/es/getActiveElement.js
var getActiveElement = __webpack_require__("Nym8");
// CONCATENATED MODULE: ./node_modules/reakit-utils/es/getNextActiveElementOnBlur.js
var isIE11 = canUseDOM["a" /* canUseDOM */] && "msCrypto" in window;
/**
* Cross-browser method that returns the next active element (the element that
* is receiving focus) after a blur event is dispatched. It receives the blur
* event object as the argument.
*
* @example
* import { getNextActiveElementOnBlur } from "reakit-utils";
*
* const element = document.getElementById("id");
* element.addEventListener("blur", (event) => {
* const nextActiveElement = getNextActiveElementOnBlur(event);
* });
*/
function getNextActiveElementOnBlur(event) {
// IE 11 doesn't support event.relatedTarget on blur.
// document.activeElement points the the next active element.
// On modern browsers, document.activeElement points to the current target.
if (isIE11) {
var activeElement = Object(getActiveElement["a" /* getActiveElement */])(event.currentTarget);
return activeElement;
}
return event.relatedTarget;
}
// EXTERNAL MODULE: ./node_modules/reakit/es/__keys-6742f591.js
var _keys_6742f591 = __webpack_require__("TFuP");
// EXTERNAL MODULE: ./node_modules/reakit/es/userFocus-e16425e3.js
var userFocus_e16425e3 = __webpack_require__("Mih7");
// CONCATENATED MODULE: ./node_modules/reakit/es/Composite/Composite.js
var Composite_isIE11 = canUseDOM["a" /* canUseDOM */] && "msCrypto" in window;
function canProxyKeyboardEvent(event) {
if (!Object(isSelfTarget["a" /* isSelfTarget */])(event)) return false;
if (event.metaKey) return false;
if (event.key === "Tab") return false;
return true;
}
function useKeyboardEventProxy(virtual, currentItem, htmlEventHandler) {
var eventHandlerRef = Object(useLiveRef["a" /* useLiveRef */])(htmlEventHandler);
return Object(external_React_["useCallback"])(function (event) {
var _eventHandlerRef$curr;
(_eventHandlerRef$curr = eventHandlerRef.current) === null || _eventHandlerRef$curr === void 0 ? void 0 : _eventHandlerRef$curr.call(eventHandlerRef, event);
if (event.defaultPrevented) return;
if (virtual && canProxyKeyboardEvent(event)) {
var currentElement = currentItem === null || currentItem === void 0 ? void 0 : currentItem.ref.current;
if (currentElement) {
if (!fireKeyboardEvent(currentElement, event.type, event)) {
event.preventDefault();
} // The event will be triggered on the composite item and then
// propagated up to this composite element again, so we can pretend
// that it wasn't called on this component in the first place.
if (event.currentTarget.contains(currentElement)) {
event.stopPropagation();
}
}
}
}, [virtual, currentItem]);
} // istanbul ignore next
function useActiveElementRef(elementRef) {
var activeElementRef = Object(external_React_["useRef"])(null);
Object(external_React_["useEffect"])(function () {
var document = Object(getDocument["a" /* getDocument */])(elementRef.current);
var onFocus = function onFocus(event) {
var target = event.target;
activeElementRef.current = target;
};
document.addEventListener("focus", onFocus, true);
return function () {
document.removeEventListener("focus", onFocus, true);
};
}, []);
return activeElementRef;
}
function findFirstEnabledItemInTheLastRow(items) {
return Object(getCurrentId_5aa9849e["a" /* f */])(flatten(reverse(groupItems(items))));
}
function isItem(items, element) {
return items === null || items === void 0 ? void 0 : items.some(function (item) {
return !!element && item.ref.current === element;
});
}
function useScheduleUserFocus(currentItem) {
var currentItemRef = Object(useLiveRef["a" /* useLiveRef */])(currentItem);
var _React$useReducer = Object(external_React_["useReducer"])(function (n) {
return n + 1;
}, 0),
scheduled = _React$useReducer[0],
schedule = _React$useReducer[1];
Object(external_React_["useEffect"])(function () {
var _currentItemRef$curre;
var currentElement = (_currentItemRef$curre = currentItemRef.current) === null || _currentItemRef$curre === void 0 ? void 0 : _currentItemRef$curre.ref.current;
if (scheduled && currentElement) {
Object(userFocus_e16425e3["c" /* u */])(currentElement);
}
}, [scheduled]);
return schedule;
}
var useComposite = Object(createHook["a" /* createHook */])({
name: "Composite",
compose: [Tabbable["a" /* useTabbable */]],
keys: _keys_6742f591["a" /* C */],
useOptions: function useOptions(options) {
return Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({}, options), {}, {
currentId: Object(getCurrentId_5aa9849e["b" /* g */])(options)
});
},
useProps: function useProps(options, _ref) {
var htmlRef = _ref.ref,
htmlOnFocusCapture = _ref.onFocusCapture,
htmlOnFocus = _ref.onFocus,
htmlOnBlurCapture = _ref.onBlurCapture,
htmlOnKeyDown = _ref.onKeyDown,
htmlOnKeyDownCapture = _ref.onKeyDownCapture,
htmlOnKeyUpCapture = _ref.onKeyUpCapture,
htmlProps = Object(_rollupPluginBabelHelpers_1f0bf8c2["a" /* _ */])(_ref, ["ref", "onFocusCapture", "onFocus", "onBlurCapture", "onKeyDown", "onKeyDownCapture", "onKeyUpCapture"]);
var ref = Object(external_React_["useRef"])(null);
var currentItem = findEnabledItemById(options.items, options.currentId);
var previousElementRef = Object(external_React_["useRef"])(null);
var onFocusCaptureRef = Object(useLiveRef["a" /* useLiveRef */])(htmlOnFocusCapture);
var onFocusRef = Object(useLiveRef["a" /* useLiveRef */])(htmlOnFocus);
var onBlurCaptureRef = Object(useLiveRef["a" /* useLiveRef */])(htmlOnBlurCapture);
var onKeyDownRef = Object(useLiveRef["a" /* useLiveRef */])(htmlOnKeyDown);
var scheduleUserFocus = useScheduleUserFocus(currentItem); // IE 11 doesn't support event.relatedTarget, so we use the active element
// ref instead.
var activeElementRef = Composite_isIE11 ? useActiveElementRef(ref) : undefined;
Object(external_React_["useEffect"])(function () {
var element = ref.current;
if (options.unstable_moves && !currentItem) {
false ? undefined : void 0; // If composite.move(null) has been called, the composite container
// will receive focus.
element === null || element === void 0 ? void 0 : element.focus();
}
}, [options.unstable_moves, currentItem]);
var onKeyDownCapture = useKeyboardEventProxy(options.unstable_virtual, currentItem, htmlOnKeyDownCapture);
var onKeyUpCapture = useKeyboardEventProxy(options.unstable_virtual, currentItem, htmlOnKeyUpCapture);
var onFocusCapture = Object(external_React_["useCallback"])(function (event) {
var _onFocusCaptureRef$cu;
(_onFocusCaptureRef$cu = onFocusCaptureRef.current) === null || _onFocusCaptureRef$cu === void 0 ? void 0 : _onFocusCaptureRef$cu.call(onFocusCaptureRef, event);
if (event.defaultPrevented) return;
if (!options.unstable_virtual) return; // IE11 doesn't support event.relatedTarget, so we use the active
// element ref instead.
var previousActiveElement = (activeElementRef === null || activeElementRef === void 0 ? void 0 : activeElementRef.current) || event.relatedTarget;
var previousActiveElementWasItem = isItem(options.items, previousActiveElement);
if (Object(isSelfTarget["a" /* isSelfTarget */])(event) && previousActiveElementWasItem) {
// Composite has been focused as a result of an item receiving focus.
// The composite item will move focus back to the composite
// container. In this case, we don't want to propagate this
// additional event nor call the onFocus handler passed to
// .
event.stopPropagation(); // We keep track of the previous active item element so we can
// manually fire a blur event on it later when the focus is moved to
// another item on the onBlurCapture event below.
previousElementRef.current = previousActiveElement;
}
}, [options.unstable_virtual, options.items]);
var onFocus = Object(external_React_["useCallback"])(function (event) {
var _onFocusRef$current;
(_onFocusRef$current = onFocusRef.current) === null || _onFocusRef$current === void 0 ? void 0 : _onFocusRef$current.call(onFocusRef, event);
if (event.defaultPrevented) return;
if (options.unstable_virtual) {
if (Object(isSelfTarget["a" /* isSelfTarget */])(event)) {
// This means that the composite element has been focused while the
// composite item has not. For example, by clicking on the
// composite element without touching any item, or by tabbing into
// the composite element. In this case, we want to trigger focus on
// the item, just like it would happen with roving tabindex.
// When it receives focus, the composite item will put focus back
// on the composite element, in which case hasItemWithFocus will be
// true.
scheduleUserFocus();
}
} else if (Object(isSelfTarget["a" /* isSelfTarget */])(event)) {
var _options$setCurrentId;
// When the roving tabindex composite gets intentionally focused (for
// example, by clicking directly on it, and not on an item), we make
// sure to set the current id to null (which means the composite
// itself is focused).
(_options$setCurrentId = options.setCurrentId) === null || _options$setCurrentId === void 0 ? void 0 : _options$setCurrentId.call(options, null);
}
}, [options.unstable_virtual, options.setCurrentId]);
var onBlurCapture = Object(external_React_["useCallback"])(function (event) {
var _onBlurCaptureRef$cur;
(_onBlurCaptureRef$cur = onBlurCaptureRef.current) === null || _onBlurCaptureRef$cur === void 0 ? void 0 : _onBlurCaptureRef$cur.call(onBlurCaptureRef, event);
if (event.defaultPrevented) return;
if (!options.unstable_virtual) return; // When virtual is set to true, we move focus from the composite
// container (this component) to the composite item that is being
// selected. Then we move focus back to the composite container. This
// is so we can provide the same API as the roving tabindex method,
// which means people can attach onFocus/onBlur handlers on the
// CompositeItem component regardless of whether it's virtual or not.
// This sequence of blurring and focusing items and composite may be
// confusing, so we ignore intermediate focus and blurs by stopping its
// propagation and not calling the passed onBlur handler (htmlOnBlur).
var currentElement = (currentItem === null || currentItem === void 0 ? void 0 : currentItem.ref.current) || null;
var nextActiveElement = getNextActiveElementOnBlur(event);
var nextActiveElementIsItem = isItem(options.items, nextActiveElement);
if (Object(isSelfTarget["a" /* isSelfTarget */])(event) && nextActiveElementIsItem) {
// This is an intermediate blur event: blurring the composite
// container to focus an item (nextActiveElement).
if (nextActiveElement === currentElement) {
// The next active element will be the same as the current item in
// the state in two scenarios:
// - Moving focus with keyboard: the state is updated before the
// blur event is triggered, so here the current item is already
// pointing to the next active element.
// - Clicking on the current active item with a pointer: this
// will trigger blur on the composite element and then the next
// active element will be the same as the current item. Clicking on
// an item other than the current one doesn't end up here as the
// currentItem state will be updated only after it.
if (previousElementRef.current && previousElementRef.current !== nextActiveElement) {
// If there's a previous active item and it's not a click action,
// then we fire a blur event on it so it will work just like if
// it had DOM focus before (like when using roving tabindex).
fireBlurEvent(previousElementRef.current, event);
}
} else if (currentElement) {
// This will be true when the next active element is not the
// current element, but there's a current item. This will only
// happen when clicking with a pointer on a different item, when
// there's already an item selected, in which case currentElement
// is the item that is getting blurred, and nextActiveElement is
// the item that is being clicked.
fireBlurEvent(currentElement, event);
} // We want to ignore intermediate blur events, so we stop its
// propagation and return early so onFocus will not be called.
event.stopPropagation();
} else {
var targetIsItem = isItem(options.items, event.target);
if (!targetIsItem && currentElement) {
// If target is not a composite item, it may be the composite
// element itself (isSelfTarget) or a tabbable element inside the
// composite widget. This may be triggered by clicking outside the
// composite widget or by tabbing out of it. In either cases we
// want to fire a blur event on the current item.
fireBlurEvent(currentElement, event);
}
}
}, [options.unstable_virtual, options.items, currentItem]);
var onKeyDown = Object(external_React_["useCallback"])(function (event) {
var _onKeyDownRef$current, _options$groups;
(_onKeyDownRef$current = onKeyDownRef.current) === null || _onKeyDownRef$current === void 0 ? void 0 : _onKeyDownRef$current.call(onKeyDownRef, event);
if (event.defaultPrevented) return;
if (options.currentId !== null) return;
if (!Object(isSelfTarget["a" /* isSelfTarget */])(event)) return;
var isVertical = options.orientation !== "horizontal";
var isHorizontal = options.orientation !== "vertical";
var isGrid = !!((_options$groups = options.groups) !== null && _options$groups !== void 0 && _options$groups.length);
var up = function up() {
if (isGrid) {
var item = findFirstEnabledItemInTheLastRow(options.items);
if (item !== null && item !== void 0 && item.id) {
var _options$move;
(_options$move = options.move) === null || _options$move === void 0 ? void 0 : _options$move.call(options, item.id);
}
} else {
var _options$last;
(_options$last = options.last) === null || _options$last === void 0 ? void 0 : _options$last.call(options);
}
};
var keyMap = {
ArrowUp: (isGrid || isVertical) && up,
ArrowRight: (isGrid || isHorizontal) && options.first,
ArrowDown: (isGrid || isVertical) && options.first,
ArrowLeft: (isGrid || isHorizontal) && options.last,
Home: options.first,
End: options.last,
PageUp: options.first,
PageDown: options.last
};
var action = keyMap[event.key];
if (action) {
event.preventDefault();
action();
}
}, [options.currentId, options.orientation, options.groups, options.items, options.move, options.last, options.first]);
return Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({
ref: Object(useForkRef["a" /* useForkRef */])(ref, htmlRef),
id: options.baseId,
onFocus: onFocus,
onFocusCapture: onFocusCapture,
onBlurCapture: onBlurCapture,
onKeyDownCapture: onKeyDownCapture,
onKeyDown: onKeyDown,
onKeyUpCapture: onKeyUpCapture,
"aria-activedescendant": options.unstable_virtual ? (currentItem === null || currentItem === void 0 ? void 0 : currentItem.id) || undefined : undefined
}, htmlProps);
},
useComposeProps: function useComposeProps(options, htmlProps) {
htmlProps = Object(Role["a" /* useRole */])(options, htmlProps, true);
var tabbableHTMLProps = Object(Tabbable["a" /* useTabbable */])(options, htmlProps, true);
if (options.unstable_virtual || options.currentId === null) {
// Composite will only be tabbable by default if the focus is managed
// using aria-activedescendant, which requires DOM focus on the container
// element (the composite)
return Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({
tabIndex: 0
}, tabbableHTMLProps);
}
return Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({}, htmlProps), {}, {
ref: tabbableHTMLProps.ref
});
}
});
var Composite = Object(createComponent["a" /* createComponent */])({
as: "div",
useHook: useComposite,
useCreateElement: function useCreateElement$1(type, props, children) {
false ? undefined : void 0;
return Object(useCreateElement["a" /* useCreateElement */])(type, props, children);
}
});
// EXTERNAL MODULE: ./node_modules/reakit/es/Id/Id.js
var Id = __webpack_require__("ym77");
// CONCATENATED MODULE: ./node_modules/reakit/es/Group/Group.js
// Automatically generated
var GROUP_KEYS = [];
var useGroup = Object(createHook["a" /* createHook */])({
name: "Group",
compose: Role["a" /* useRole */],
keys: GROUP_KEYS,
useProps: function useProps(_, htmlProps) {
return Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({
role: "group"
}, htmlProps);
}
});
var Group = Object(createComponent["a" /* createComponent */])({
as: "div",
useHook: useGroup
});
// CONCATENATED MODULE: ./node_modules/reakit/es/Composite/CompositeGroup.js
var useCompositeGroup = Object(createHook["a" /* createHook */])({
name: "CompositeGroup",
compose: [useGroup, Id["a" /* unstable_useId */]],
keys: _keys_6742f591["b" /* a */],
propsAreEqual: function propsAreEqual(prev, next) {
if (!next.id || prev.id !== next.id) {
return useGroup.unstable_propsAreEqual(prev, next);
}
var prevCurrentId = prev.currentId,
prevMoves = prev.unstable_moves,
prevProps = Object(_rollupPluginBabelHelpers_1f0bf8c2["a" /* _ */])(prev, ["currentId", "unstable_moves"]);
var nextCurrentId = next.currentId,
nextMoves = next.unstable_moves,
nextProps = Object(_rollupPluginBabelHelpers_1f0bf8c2["a" /* _ */])(next, ["currentId", "unstable_moves"]);
if (prev.items && next.items) {
var prevCurrentItem = findEnabledItemById(prev.items, prevCurrentId);
var nextCurrentItem = findEnabledItemById(next.items, nextCurrentId);
var prevGroupId = prevCurrentItem === null || prevCurrentItem === void 0 ? void 0 : prevCurrentItem.groupId;
var nextGroupId = nextCurrentItem === null || nextCurrentItem === void 0 ? void 0 : nextCurrentItem.groupId;
if (next.id === nextGroupId || next.id === prevGroupId) {
return false;
}
}
return useGroup.unstable_propsAreEqual(prevProps, nextProps);
},
useProps: function useProps(options, _ref) {
var htmlRef = _ref.ref,
htmlProps = Object(_rollupPluginBabelHelpers_1f0bf8c2["a" /* _ */])(_ref, ["ref"]);
var ref = Object(external_React_["useRef"])(null);
var id = options.id; // We need this to be called before CompositeItems' register
Object(useIsomorphicEffect["a" /* useIsomorphicEffect */])(function () {
var _options$registerGrou;
if (!id) return undefined;
(_options$registerGrou = options.registerGroup) === null || _options$registerGrou === void 0 ? void 0 : _options$registerGrou.call(options, {
id: id,
ref: ref
});
return function () {
var _options$unregisterGr;
(_options$unregisterGr = options.unregisterGroup) === null || _options$unregisterGr === void 0 ? void 0 : _options$unregisterGr.call(options, id);
};
}, [id, options.registerGroup, options.unregisterGroup]);
return Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({
ref: Object(useForkRef["a" /* useForkRef */])(ref, htmlRef)
}, htmlProps);
}
});
var CompositeGroup = Object(createComponent["a" /* createComponent */])({
as: "div",
useHook: useCompositeGroup
});
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/alignment-matrix-control/styles/alignment-matrix-control-icon-styles.js
function alignment_matrix_control_icon_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
/**
* Internal dependencies
*/
const alignment_matrix_control_icon_styles_rootSize = () => {
const padding = 1.5;
const size = 24;
return /*#__PURE__*/css_browser_esm({
gridTemplateRows: `repeat( 3, calc( ${size - padding * 2}px / 3))`,
padding,
maxHeight: size,
maxWidth: size
}, true ? "" : undefined);
};
const rootPointerEvents = ({
disablePointerEvents
}) => {
return /*#__PURE__*/css_browser_esm({
pointerEvents: disablePointerEvents ? 'none' : null
}, true ? "" : undefined);
};
const alignment_matrix_control_icon_styles_Wrapper = styled_base_browser_esm("div", {
target: "elqsdmc0",
label: "Wrapper"
})( true ? {
name: "co61ta",
styles: "box-sizing:border-box;padding:2px;"
} : undefined);
const alignment_matrix_control_icon_styles_Root = styled_base_browser_esm("div", {
target: "elqsdmc1",
label: "Root"
})("transform-origin:top left;height:100%;width:100%;", rootBase, ";", alignment_matrix_control_icon_styles_rootSize, ";", rootPointerEvents, ";" + ( true ? "" : undefined));
const alignment_matrix_control_icon_styles_pointActive = ({
isActive
}) => {
const boxShadow = isActive ? `0 0 0 1px currentColor` : null;
return /*#__PURE__*/css_browser_esm("box-shadow:", boxShadow, ";color:currentColor;*:hover > &{color:currentColor;}" + ( true ? "" : undefined));
};
const alignment_matrix_control_icon_styles_Point = styled_base_browser_esm("span", {
target: "elqsdmc2",
label: "Point"
})("height:2px;width:2px;", pointBase, ";", alignment_matrix_control_icon_styles_pointActive, ";" + ( true ? "" : undefined));
const alignment_matrix_control_icon_styles_Cell = Cell;
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/alignment-matrix-control/icon.js
/**
* External dependencies
*/
/**
* Internal dependencies
*/
const BASE_SIZE = 24;
function AlignmentMatrixControlIcon({
className,
disablePointerEvents = true,
size = BASE_SIZE,
style = {},
value = 'center',
...props
}) {
const alignIndex = getAlignmentIndex(value);
const scale = (size / BASE_SIZE).toFixed(2);
const classes = classnames_default()('component-alignment-matrix-control-icon', className);
const styles = { ...style,
transform: `scale(${scale})`
};
return Object(external_wp_element_["createElement"])(alignment_matrix_control_icon_styles_Root, Object(esm_extends["a" /* default */])({}, props, {
className: classes,
disablePointerEvents: disablePointerEvents,
role: "presentation",
size: size,
style: styles
}), ALIGNMENTS.map((align, index) => {
const isActive = alignIndex === index;
return Object(external_wp_element_["createElement"])(alignment_matrix_control_icon_styles_Cell, {
key: align
}, Object(external_wp_element_["createElement"])(alignment_matrix_control_icon_styles_Point, {
isActive: isActive
}));
}));
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/alignment-matrix-control/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function useBaseId(id) {
const instanceId = Object(external_wp_compose_["useInstanceId"])(AlignmentMatrixControl, 'alignment-matrix-control');
return id || instanceId;
}
function AlignmentMatrixControl({
className,
id,
label = Object(external_wp_i18n_["__"])('Alignment Matrix Control'),
defaultValue = 'center center',
value,
onChange = external_lodash_["noop"],
width = 92,
...props
}) {
const [immutableDefaultValue] = Object(external_wp_element_["useState"])(value !== null && value !== void 0 ? value : defaultValue);
const baseId = useBaseId(id);
const initialCurrentId = utils_getItemId(baseId, immutableDefaultValue);
const composite = useCompositeState({
baseId,
currentId: initialCurrentId,
rtl: Object(external_wp_i18n_["isRTL"])()
});
const handleOnChange = nextValue => {
onChange(nextValue);
};
Object(external_wp_element_["useEffect"])(() => {
if (typeof value !== 'undefined') {
composite.setCurrentId(utils_getItemId(baseId, value));
}
}, [value, composite.setCurrentId]);
const classes = classnames_default()('component-alignment-matrix-control', className);
return Object(external_wp_element_["createElement"])(Composite, Object(esm_extends["a" /* default */])({}, props, composite, {
"aria-label": label,
as: Root,
className: classes,
role: "grid",
width: width
}), GRID.map((cells, index) => Object(external_wp_element_["createElement"])(CompositeGroup, Object(esm_extends["a" /* default */])({}, composite, {
as: Row,
role: "row",
key: index
}), cells.map(cell => {
const cellId = utils_getItemId(baseId, cell);
const isActive = composite.currentId === cellId;
return Object(external_wp_element_["createElement"])(cell_Cell, Object(esm_extends["a" /* default */])({}, composite, {
id: cellId,
isActive: isActive,
key: cell,
value: cell,
onFocus: () => handleOnChange(cell),
tabIndex: isActive ? 0 : -1
}));
}))));
}
AlignmentMatrixControl.Icon = AlignmentMatrixControlIcon;
// EXTERNAL MODULE: ./node_modules/@wordpress/components/build-module/animate/index.js
var animate = __webpack_require__("L8Kx");
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/utils/font-values.js
/* harmony default export */ var font_values = ({
'default.fontFamily': "-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif",
'default.fontSize': '13px',
'helpText.fontSize': '12px',
mobileTextMinFontSize: '16px'
});
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/utils/font.js
/**
* External dependencies
*/
/**
* Internal dependencies
*/
/**
*
* @param {keyof FONT} value Path of value from `FONT`
* @return {string} Font rule value
*/
function font(value) {
return Object(external_lodash_["get"])(font_values, value, '');
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/utils/space.js
const SPACE_GRID_BASE = 8;
/**
* Creates a spacing CSS value (px) based on grid system values.
*
* @param {number} [value=1] Multiplier against the grid base value (8)
* @return {string} The spacing value (px).
*/
function space(value = 1) {
if (isNaN(value)) return `${SPACE_GRID_BASE}px`;
return `${SPACE_GRID_BASE * value}px`;
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/base-control/styles/base-control-styles.js
/**
* Internal dependencies
*/
const base_control_styles_Wrapper = styled_base_browser_esm("div", {
target: "e1puf3u0",
label: "Wrapper"
})("font-family:", font('default.fontFamily'), ";font-size:", font('default.fontSize'), ";" + ( true ? "" : undefined));
const StyledField = styled_base_browser_esm("div", {
target: "e1puf3u1",
label: "StyledField"
})("margin-bottom:", space(1), ";.components-panel__row &{margin-bottom:inherit;}" + ( true ? "" : undefined));
const StyledLabel = styled_base_browser_esm("label", {
target: "e1puf3u2",
label: "StyledLabel"
})("display:inline-block;margin-bottom:", space(1), ";" + ( true ? "" : undefined));
const StyledHelp = styled_base_browser_esm("p", {
target: "e1puf3u3",
label: "StyledHelp"
})("font-size:", font('helpText.fontSize'), ";font-style:normal;color:", COLORS.mediumGray.text, ";" + ( true ? "" : undefined));
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/base-control/index.js
/**
* External dependencies
*/
/**
* Internal dependencies
*/
/**
* @typedef Props
* @property {string} id The id of the element to which labels and help text are being generated.
* That element should be passed as a child.
* @property {import('react').ReactNode} help If this property is added, a help text will be
* generated using help property as the content.
* @property {import('react').ReactNode} label If this property is added, a label will be generated
* using label property as the content.
* @property {boolean} [hideLabelFromVision] If true, the label will only be visible to screen readers.
* @property {string} [className] The class that will be added with "components-base-control" to the
* classes of the wrapper div. If no className is passed only
* components-base-control is used.
* @property {import('react').ReactNode} [children] The content to be displayed within
* the BaseControl.
*/
/**
* @param {Props} props
* @return {JSX.Element} Element
*/
function BaseControl({
id,
label,
hideLabelFromVision,
help,
className,
children
}) {
return Object(external_wp_element_["createElement"])(base_control_styles_Wrapper, {
className: classnames_default()('components-base-control', className)
}, Object(external_wp_element_["createElement"])(StyledField, {
className: "components-base-control__field"
}, label && id && (hideLabelFromVision ? Object(external_wp_element_["createElement"])(visually_hidden["a" /* default */], {
as: "label",
htmlFor: id
}, label) : Object(external_wp_element_["createElement"])(StyledLabel, {
className: "components-base-control__label",
htmlFor: id
}, label)), label && !id && (hideLabelFromVision ? Object(external_wp_element_["createElement"])(visually_hidden["a" /* default */], {
as: "label"
}, label) : Object(external_wp_element_["createElement"])(BaseControl.VisualLabel, null, label)), children), !!help && Object(external_wp_element_["createElement"])(StyledHelp, {
id: id + '__help',
className: "components-base-control__help"
}, help));
}
/**
* @typedef VisualLabelProps
* @property {string} [className] Class name
* @property {import('react').ReactNode} [children] Children
*/
/**
* @param {VisualLabelProps} Props
* @return {JSX.Element} Element
*/
BaseControl.VisualLabel = ({
className,
children
}) => {
className = classnames_default()('components-base-control__label', className);
return Object(external_wp_element_["createElement"])("span", {
className: className
}, children);
};
/* harmony default export */ var base_control = (BaseControl);
// EXTERNAL MODULE: ./node_modules/@wordpress/components/build-module/ui/context/context-connect.js
var context_connect = __webpack_require__("7Jlx");
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/view/component.js
/**
* `View` is a core component that renders everything in the library.
* It is the principle component in the entire library.
*
* @example
* ```jsx
* import { View } from `@wordpress/components`;
*
* function Example() {
* return (
*
* Code is Poetry
*
* );
* }
* ```
*/
const View = styled_base_browser_esm("div", {
target: "em57xhy0",
label: "View"
})( true ? "" : undefined);
View.displayName = 'View';
/* harmony default export */ var component = (View);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/ui/utils/create-component.js
/**
* External dependencies
*/
// eslint-disable-next-line no-restricted-imports
/**
* Internal dependencies
*/
// eslint-disable-next-line no-duplicate-imports
/**
* Factory that creates a React component from a hook
*
* @param options
* @param options.as The element to render for the component.
* @param options.name The name of the component.
* @param options.useHook The hook to use for the component
* @param options.memo Whether to memo the component.
* @return A polymorphic component that uses the hook to process props.
*/
const create_component_createComponent = ({
as,
name,
useHook,
memo = false
}) => {
function Component(props, forwardedRef) {
const otherProps = useHook(props);
return Object(external_wp_element_["createElement"])(component, Object(esm_extends["a" /* default */])({
as: as || 'div'
}, otherProps, {
ref: forwardedRef
}));
}
Component.displayName = name;
return Object(context_connect["a" /* contextConnect */])(Component, name, {
memo
});
};
// EXTERNAL MODULE: ./node_modules/@wordpress/components/build-module/ui/context/use-context-system.js
var use_context_system = __webpack_require__("C6yU");
// EXTERNAL MODULE: ./node_modules/emotion/dist/emotion.esm.js + 1 modules
var emotion_esm = __webpack_require__("kDDq");
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/flex/context.js
/**
* WordPress dependencies
*/
const FlexContext = Object(external_wp_element_["createContext"])({
flexItemDisplay: undefined
});
const useFlexContext = () => Object(external_wp_element_["useContext"])(FlexContext);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/flex/styles.js
function styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
const Flex = /*#__PURE__*/Object(emotion_esm["a" /* css */])( true ? {
name: "142v397-Flex",
styles: "display:flex;;label:Flex;"
} : undefined);
const Item = /*#__PURE__*/Object(emotion_esm["a" /* css */])( true ? {
name: "1636tkh-Item",
styles: "display:block;max-height:100%;max-width:100%;min-height:0;min-width:0;;label:Item;"
} : undefined);
const block = /*#__PURE__*/Object(emotion_esm["a" /* css */])( true ? {
name: "jhhyjf-block",
styles: "flex:1;;label:block;"
} : undefined);
/**
* Workaround to optimize DOM rendering.
* We'll enhance alignment with naive parent flex assumptions.
*
* Trade-off:
* Far less DOM less. However, UI rendering is not as reliable.
*/
/**
* Improves stability of width/height rendering.
* https://github.com/ItsJonQ/g2/pull/149
*/
const ItemsColumn = /*#__PURE__*/Object(emotion_esm["a" /* css */])( true ? {
name: "1u16kd2-ItemsColumn",
styles: "> *{min-height:0;};label:ItemsColumn;"
} : undefined);
const ItemsRow = /*#__PURE__*/Object(emotion_esm["a" /* css */])( true ? {
name: "1yewyqa-ItemsRow",
styles: "> *{min-width:0;};label:ItemsRow;"
} : undefined);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/flex/flex-item/hook.js
/**
* Internal dependencies
*/
/**
* @param {import('../../ui/context').ViewOwnProps} props
*/
function useFlexItem(props) {
const {
className,
display: displayProp,
isBlock = false,
...otherProps
} = Object(use_context_system["a" /* useContextSystem */])(props, 'FlexItem');
const sx = {};
const contextDisplay = useFlexContext().flexItemDisplay;
sx.Base = /*#__PURE__*/Object(emotion_esm["a" /* css */])({
display: displayProp || contextDisplay
}, true ? "" : undefined);
const classes = Object(emotion_esm["b" /* cx */])(Item, sx.Base, isBlock && block, className);
return { ...otherProps,
className: classes
};
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/flex/flex-block/hook.js
/**
* Internal dependencies
*/
/**
* @param {import('../../ui/context').ViewOwnProps} props
*/
function useFlexBlock(props) {
const otherProps = Object(use_context_system["a" /* useContextSystem */])(props, 'FlexBlock');
const flexItemProps = useFlexItem({
isBlock: true,
...otherProps
});
return flexItemProps;
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/flex/flex-block/component.js
/**
* Internal dependencies
*/
/**
* `FlexBlock` is a primitive layout component that adaptively resizes content within layout containers like `Flex`.
*
* @example
* ```jsx
*
* ...
*
* ```
*/
const FlexBlock = create_component_createComponent({
as: 'div',
useHook: useFlexBlock,
name: 'FlexBlock'
});
/* harmony default export */ var flex_block_component = (FlexBlock);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/flex/flex-item/component.js
/**
* Internal dependencies
*/
/**
* `FlexItem` is a primitive layout component that aligns content within layout containers like `Flex`.
*
* @example
* ```jsx
*
* ...
*
* ```
*/
const FlexItem = create_component_createComponent({
as: 'div',
useHook: useFlexItem,
name: 'FlexItem'
});
/* harmony default export */ var flex_item_component = (FlexItem);
// EXTERNAL MODULE: external ["wp","deprecated"]
var external_wp_deprecated_ = __webpack_require__("NMb1");
var external_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_wp_deprecated_);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/ui/utils/use-responsive-value.js
/**
* WordPress dependencies
*/
const breakpoints = ['40em', '52em', '64em'];
const useBreakpointIndex = (options = {}) => {
const {
defaultIndex = 0
} = options;
if (typeof defaultIndex !== 'number') {
throw new TypeError(`Default breakpoint index should be a number. Got: ${defaultIndex}, ${typeof defaultIndex}`);
} else if (defaultIndex < 0 || defaultIndex > breakpoints.length - 1) {
throw new RangeError(`Default breakpoint index out of range. Theme has ${breakpoints.length} breakpoints, got index ${defaultIndex}`);
}
const [value, setValue] = Object(external_wp_element_["useState"])(defaultIndex);
Object(external_wp_element_["useEffect"])(() => {
const getIndex = () => breakpoints.filter(bp => {
return typeof window !== 'undefined' ? window.matchMedia(`screen and (min-width: ${bp})`).matches : false;
}).length;
const onResize = () => {
const newValue = getIndex();
if (value !== newValue) {
setValue(newValue);
}
};
onResize();
if (typeof document !== 'undefined') {
// Disable reason: We don't really care about what document we listen to, we just want to know that we're resizing.
/* eslint-disable @wordpress/no-global-event-listener */
document.addEventListener('resize', onResize);
}
return () => {
if (typeof document !== 'undefined') {
document.removeEventListener('resize', onResize);
/* eslint-enable @wordpress/no-global-event-listener */
}
};
}, [value]);
return value;
};
function useResponsiveValue(values, options = {}) {
const index = useBreakpointIndex(options); // Allow calling the function with a "normal" value without having to check on the outside.
if (!Array.isArray(values) && typeof values !== 'function') return values;
const array = values || [];
/* eslint-disable jsdoc/no-undefined-types */
return (
/** @type {T[]} */
array[
/* eslint-enable jsdoc/no-undefined-types */
index >= array.length ? array.length - 1 : index]
);
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/ui/utils/space.js
/**
* External dependencies
*/
// eslint-disable-next-line no-restricted-imports
/**
* Internal dependencies
*/
const GRID_BASE = '4px';
function space_space(value) {
return typeof value === 'number' ? `calc(${GRID_BASE} * ${value})` : value;
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/flex/flex/hook.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
*
* @param {import('../../ui/context').ViewOwnProps} props
* @return {import('../../ui/context').ViewOwnProps} Props with the deprecated props removed.
*/
function useDeprecatedProps({
isReversed,
...otherProps
}) {
if (typeof isReversed !== 'undefined') {
external_wp_deprecated_default()('Flex isReversed', {
alternative: 'Flex direction="row-reverse" or "column-reverse"',
since: '5.9'
});
return { ...otherProps,
direction: isReversed ? 'row-reverse' : 'row'
};
}
return otherProps;
}
/**
* @param {import('../../ui/context').ViewOwnProps} props
*/
function useFlex(props) {
const {
align = 'center',
className,
direction: directionProp = 'row',
expanded = true,
gap = 2,
justify = 'space-between',
wrap = false,
...otherProps
} = Object(use_context_system["a" /* useContextSystem */])(useDeprecatedProps(props), 'Flex');
const directionAsArray = Array.isArray(directionProp) ? directionProp : [directionProp];
const direction = useResponsiveValue(directionAsArray);
const isColumn = typeof direction === 'string' && !!direction.includes('column');
const isReverse = typeof direction === 'string' && direction.includes('reverse');
const classes = Object(external_wp_element_["useMemo"])(() => {
const sx = {};
sx.Base = /*#__PURE__*/Object(emotion_esm["a" /* css */])({
alignItems: isColumn ? 'normal' : align,
flexDirection: direction,
flexWrap: wrap ? 'wrap' : undefined,
justifyContent: justify,
height: isColumn && expanded ? '100%' : undefined,
width: !isColumn && expanded ? '100%' : undefined,
marginBottom: wrap ? `calc(${space_space(gap)} * -1)` : undefined
}, true ? "" : undefined);
sx.Items = /*#__PURE__*/Object(emotion_esm["a" /* css */])({
/**
* Workaround to optimize DOM rendering.
* We'll enhance alignment with naive parent flex assumptions.
*
* Trade-off:
* Far less DOM less. However, UI rendering is not as reliable.
*/
'> * + *:not(marquee)': {
marginTop: isColumn ? space_space(gap) : undefined,
marginRight: !isColumn && isReverse ? space_space(gap) : undefined,
marginLeft: !isColumn && !isReverse ? space_space(gap) : undefined
}
}, true ? "" : undefined);
sx.WrapItems = /*#__PURE__*/Object(emotion_esm["a" /* css */])({
'> *:not(marquee)': {
marginBottom: space_space(gap),
marginLeft: !isColumn && isReverse ? space_space(gap) : undefined,
marginRight: !isColumn && !isReverse ? space_space(gap) : undefined
},
'> *:last-child:not(marquee)': {
marginLeft: !isColumn && isReverse ? 0 : undefined,
marginRight: !isColumn && !isReverse ? 0 : undefined
}
}, true ? "" : undefined);
return Object(emotion_esm["b" /* cx */])(Flex, sx.Base, wrap ? sx.WrapItems : sx.Items, isColumn ? ItemsColumn : ItemsRow, className);
}, [align, className, direction, expanded, gap, isColumn, isReverse, justify, wrap]);
return { ...otherProps,
className: classes,
isColumn
};
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/flex/flex/component.js
/**
* Internal dependencies
*/
/**
* @param {import('../../ui/context').ViewOwnProps} props
* @param {import('react').Ref} forwardedRef
*/
function component_Flex(props, forwardedRef) {
const {
children,
isColumn,
...otherProps
} = useFlex(props);
return Object(external_wp_element_["createElement"])(FlexContext.Provider, {
value: {
flexItemDisplay: isColumn ? 'block' : undefined
}
}, Object(external_wp_element_["createElement"])(component, Object(esm_extends["a" /* default */])({}, otherProps, {
ref: forwardedRef
}), children));
}
/**
* `Flex` is a primitive layout component that adaptively aligns child content
* horizontally or vertically. `Flex` powers components like `HStack` and
* `VStack`.
*
* `Flex` is used with any of it's two sub-components, `FlexItem` and `FlexBlock`.
*
* @example
* ```jsx
* import {
* __experimentalFlex as Flex,
* __experimentalFlexBlock as FlexBlock,
* __experimentalFlexItem as FlexItem,
* __experimentalText as Text
* } from `@wordpress/components`;
*
* function Example() {
* return (
*
*
* Code
*
*
* Poetry
*
*
* );
* }
* ```
*
*/
const ConnectedFlex = Object(context_connect["a" /* contextConnect */])(component_Flex, 'Flex');
/* harmony default export */ var flex_component = (ConnectedFlex);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/truncate/styles.js
function truncate_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
const Truncate = /*#__PURE__*/Object(emotion_esm["a" /* css */])( true ? {
name: "w4wjp3-Truncate",
styles: "display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;;label:Truncate;"
} : undefined);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/truncate/utils.js
/**
* External dependencies
*/
const TRUNCATE_ELLIPSIS = '…';
const TRUNCATE_TYPE = {
auto: 'auto',
head: 'head',
middle: 'middle',
tail: 'tail',
none: 'none'
};
const TRUNCATE_DEFAULT_PROPS = {
ellipsis: TRUNCATE_ELLIPSIS,
ellipsizeMode: TRUNCATE_TYPE.auto,
limit: 0,
numberOfLines: 0
}; // Source
// https://github.com/kahwee/truncate-middle
/**
* @param {string} word
* @param {number} headLength
* @param {number} tailLength
* @param {string} ellipsis
*/
function truncateMiddle(word, headLength, tailLength, ellipsis) {
if (typeof word !== 'string') {
return '';
}
const wordLength = word.length; // Setting default values
// eslint-disable-next-line no-bitwise
const frontLength = ~~headLength; // will cast to integer
// eslint-disable-next-line no-bitwise
const backLength = ~~tailLength;
/* istanbul ignore next */
const truncateStr = !Object(external_lodash_["isNil"])(ellipsis) ? ellipsis : TRUNCATE_ELLIPSIS;
if (frontLength === 0 && backLength === 0 || frontLength >= wordLength || backLength >= wordLength || frontLength + backLength >= wordLength) {
return word;
} else if (backLength === 0) {
return word.slice(0, frontLength) + truncateStr;
}
return word.slice(0, frontLength) + truncateStr + word.slice(wordLength - backLength);
}
/**
*
* @param {string} words
* @param {typeof TRUNCATE_DEFAULT_PROPS} props
*/
function truncateContent(words = '', props) {
const mergedProps = { ...TRUNCATE_DEFAULT_PROPS,
...props
};
const {
ellipsis,
ellipsizeMode,
limit
} = mergedProps;
if (ellipsizeMode === TRUNCATE_TYPE.none) {
return words;
}
let truncateHead;
let truncateTail;
switch (ellipsizeMode) {
case TRUNCATE_TYPE.head:
truncateHead = 0;
truncateTail = limit;
break;
case TRUNCATE_TYPE.middle:
truncateHead = Math.floor(limit / 2);
truncateTail = Math.floor(limit / 2);
break;
default:
truncateHead = limit;
truncateTail = 0;
}
const truncatedContent = ellipsizeMode !== TRUNCATE_TYPE.auto ? truncateMiddle(words, truncateHead, truncateTail, ellipsis) : words;
return truncatedContent;
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/truncate/hook.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* @param {import('../ui/context').ViewOwnProps} props
*/
function useTruncate(props) {
const {
className,
children,
ellipsis = TRUNCATE_ELLIPSIS,
ellipsizeMode = TRUNCATE_TYPE.auto,
limit = 0,
numberOfLines = 0,
...otherProps
} = Object(use_context_system["a" /* useContextSystem */])(props, 'Truncate');
const truncatedContent = truncateContent(typeof children === 'string' ?
/** @type {string} */
children : '', {
ellipsis,
ellipsizeMode,
limit,
numberOfLines
});
const shouldTruncate = ellipsizeMode === TRUNCATE_TYPE.auto;
const classes = Object(external_wp_element_["useMemo"])(() => {
const sx = {};
sx.numberOfLines = /*#__PURE__*/Object(emotion_esm["a" /* css */])("-webkit-box-orient:vertical;-webkit-line-clamp:", numberOfLines, ";display:-webkit-box;overflow:hidden;" + ( true ? "" : undefined));
return Object(emotion_esm["b" /* cx */])(shouldTruncate && !numberOfLines && Truncate, shouldTruncate && !!numberOfLines && sx.numberOfLines, className);
}, [className, numberOfLines, shouldTruncate]);
return { ...otherProps,
className: classes,
children: truncatedContent
};
}
// EXTERNAL MODULE: ./node_modules/memize/index.js
var memize = __webpack_require__("4eJC");
var memize_default = /*#__PURE__*/__webpack_require__.n(memize);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/ui/utils/colors.js
/**
* External dependencies
*/
/** @type {HTMLDivElement} */
let colorComputationNode;
/**
* @return {HTMLDivElement | undefined} The HTML element for color computation.
*/
function getColorComputationNode() {
if (typeof document === 'undefined') return;
if (!colorComputationNode) {
// Create a temporary element for style computation.
const el = document.createElement('div');
el.setAttribute('data-g2-color-computation-node', ''); // Inject for window computed style.
document.body.appendChild(el);
colorComputationNode = el;
}
return colorComputationNode;
}
/**
* @param {string | unknown} value
*
* @return {boolean} Whether the value is a valid color.
*/
function isColor(value) {
if (typeof value !== 'string') return false;
const test = tinycolor_default()(value);
return test.isValid();
}
/**
* Retrieves the computed background color. This is useful for getting the
* value of a CSS variable color.
*
* @param {string | unknown} backgroundColor The background color to compute.
*
* @return {string} The computed background color.
*/
function _getComputedBackgroundColor(backgroundColor) {
var _window;
if (typeof backgroundColor !== 'string') return '';
if (isColor(backgroundColor)) return backgroundColor;
if (!backgroundColor.includes('var(')) return '';
if (typeof document === 'undefined') return ''; // Attempts to gracefully handle CSS variables color values.
const el = getColorComputationNode();
if (!el) return '';
el.style.background = backgroundColor; // Grab the style
const computedColor = (_window = window) === null || _window === void 0 ? void 0 : _window.getComputedStyle(el).background; // Reset
el.style.background = '';
return computedColor || '';
}
const getComputedBackgroundColor = memize_default()(_getComputedBackgroundColor);
/**
* Get the text shade optimized for readability, based on a background color.
*
* @param {string | unknown} backgroundColor The background color.
*
* @return {string} The optimized text color (black or white).
*/
function getOptimalTextColor(backgroundColor) {
const background = getComputedBackgroundColor(backgroundColor);
const isReadableWithBlackText = tinycolor_default.a.isReadable(background, '#000000');
return isReadableWithBlackText ? '#000000' : '#ffffff';
}
/**
* Get the text shade optimized for readability, based on a background color.
*
* @param {string | unknown} backgroundColor The background color.
*
* @return {string} The optimized text shade (dark or light).
*/
function getOptimalTextShade(backgroundColor) {
const result = getOptimalTextColor(backgroundColor);
return result === '#000000' ? 'dark' : 'light';
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/utils/config-values.js
/**
* Internal dependencies
*/
const CONTROL_HEIGHT = '30px';
const CARD_PADDING_X = space_space(3);
const CARD_PADDING_Y = space_space(3);
/* harmony default export */ var config_values = ({
colorDivider: 'rgba(0, 0, 0, 0.1)',
colorScrollbarThumb: 'rgba(0, 0, 0, 0.2)',
colorScrollbarThumbHover: 'rgba(0, 0, 0, 0.5)',
colorScrollbarTrack: 'rgba(0, 0, 0, 0.04)',
elevationIntensity: 1,
radiusBlockUi: '2px',
borderWidth: '1px',
borderWidthFocus: '1.5px',
borderWidthTab: '4px',
spinnerSize: '18px',
fontSize: '13px',
fontSizeH1: 'calc(2.44 * 13px)',
fontSizeH2: 'calc(1.95 * 13px)',
fontSizeH3: 'calc(1.56 * 13px)',
fontSizeH4: 'calc(1.25 * 13px)',
fontSizeH5: '13px',
fontSizeH6: 'calc(0.8 * 13px)',
fontSizeInputMobile: '16px',
fontSizeMobile: '15px',
fontSizeSmall: 'calc(0.92 * 13px)',
fontSizeXSmall: 'calc(0.75 * 13px)',
fontLineHeightBase: '1.2',
fontWeight: 'normal',
fontWeightHeading: '600',
gridBase: '4px',
controlHeight: CONTROL_HEIGHT,
controlHeightLarge: `calc( ${CONTROL_HEIGHT} * 1.2 )`,
controlHeightSmall: `calc( ${CONTROL_HEIGHT} * 0.8 )`,
controlHeightXSmall: `calc( ${CONTROL_HEIGHT} * 0.6 )`,
cardBorderRadius: '2px',
cardPaddingX: CARD_PADDING_X,
cardPaddingY: CARD_PADDING_Y,
cardPadding: `${CARD_PADDING_X} ${CARD_PADDING_Y}`,
cardHeaderFooterPaddingY: space_space(1),
cardHeaderHeight: '44px',
surfaceBackgroundColor: COLORS.white,
surfaceBackgroundSubtleColor: '#F3F3F3',
surfaceBackgroundTintColor: '#F5F5F5',
surfaceBorderColor: 'rgba(0, 0, 0, 0.1)',
surfaceBorderBoldColor: 'rgba(0, 0, 0, 0.15)',
surfaceBorderSubtleColor: 'rgba(0, 0, 0, 0.05)',
surfaceBackgroundTertiaryColor: COLORS.white,
surfaceColor: COLORS.white,
transitionDuration: '200ms',
transitionDurationFast: '160ms',
transitionDurationFaster: '120ms',
transitionDurationFastest: '100ms',
transitionTimingFunction: 'cubic-bezier(0.08, 0.52, 0.52, 1)',
transitionTimingFunctionControl: 'cubic-bezier(0.12, 0.8, 0.32, 1)'
});
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/text/styles.js
function text_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
/**
* Internal dependencies
*/
const Text = /*#__PURE__*/Object(emotion_esm["a" /* css */])("color:", COLORS.black, ";line-height:", config_values.fontLineHeightBase, ";margin:0;;label:Text;" + ( true ? "" : undefined));
const styles_block = /*#__PURE__*/Object(emotion_esm["a" /* css */])( true ? {
name: "w2ur5d-block",
styles: "display:block;;label:block;"
} : undefined);
const positive = /*#__PURE__*/Object(emotion_esm["a" /* css */])("color:", COLORS.alert.green, ";;label:positive;" + ( true ? "" : undefined));
const destructive = /*#__PURE__*/Object(emotion_esm["a" /* css */])("color:", COLORS.alert.red, ";;label:destructive;" + ( true ? "" : undefined));
const styles_muted = /*#__PURE__*/Object(emotion_esm["a" /* css */])("color:", COLORS.mediumGray.text, ";;label:muted;" + ( true ? "" : undefined));
const highlighterText = /*#__PURE__*/Object(emotion_esm["a" /* css */])("mark{background:", COLORS.alert.yellow, ";border-radius:2px;box-shadow:0 0 0 1px rgba( 0,0,0,0.05 ) inset,0 -1px 0 rgba( 0,0,0,0.1 ) inset;};label:highlighterText;" + ( true ? "" : undefined));
const styles_upperCase = /*#__PURE__*/Object(emotion_esm["a" /* css */])( true ? {
name: "a0nhhd-upperCase",
styles: "text-transform:uppercase;;label:upperCase;"
} : undefined);
// EXTERNAL MODULE: ./node_modules/highlight-words-core/dist/index.js
var dist = __webpack_require__("5V/u");
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/text/utils.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Source:
* https://github.com/bvaughn/react-highlight-words/blob/HEAD/src/Highlighter.js
*/
/* eslint-disable jsdoc/valid-types */
/**
* @typedef Options
* @property {string} [activeClassName=''] Classname for active highlighted areas.
* @property {number} [activeIndex=-1] The index of the active highlighted area.
* @property {import('react').AllHTMLAttributes['style']} [activeStyle] Styles to apply to the active highlighted area.
* @property {boolean} [autoEscape] Whether to automatically escape text.
* @property {boolean} [caseSensitive=false] Whether to highlight in a case-sensitive manner.
* @property {string} children Children to highlight.
* @property {import('highlight-words-core').FindAllArgs['findChunks']} [findChunks] Custom `findChunks` function to pass to `highlight-words-core`.
* @property {string | Record} [highlightClassName=''] Classname to apply to highlighted text or a Record of classnames to apply to given text (which should be the key).
* @property {import('react').AllHTMLAttributes['style']} [highlightStyle={}] Styles to apply to highlighted text.
* @property {keyof JSX.IntrinsicElements} [highlightTag='mark'] Tag to use for the highlighted text.
* @property {import('highlight-words-core').FindAllArgs['sanitize']} [sanitize] Custom `santize` function to pass to `highlight-words-core`.
* @property {string[]} [searchWords=[]] Words to search for and highlight.
* @property {string} [unhighlightClassName=''] Classname to apply to unhighlighted text.
* @property {import('react').AllHTMLAttributes['style']} [unhighlightStyle] Style to apply to unhighlighted text.
*/
/**
* Maps props to lowercase names.
*
* @template {Record} T
* @param {T} object Props to map.
* @return {{[K in keyof T as Lowercase]: T[K]}} The mapped props.
*/
/* eslint-enable jsdoc/valid-types */
const lowercaseProps = object => {
/** @type {any} */
const mapped = {};
for (const key in object) {
mapped[key.toLowerCase()] = object[key];
}
return mapped;
};
const memoizedLowercaseProps = memize_default()(lowercaseProps);
/**
*
* @param {Options} options
*/
function createHighlighterText({
activeClassName = '',
activeIndex = -1,
activeStyle,
autoEscape,
caseSensitive = false,
children,
findChunks,
highlightClassName = '',
highlightStyle = {},
highlightTag = 'mark',
sanitize,
searchWords = [],
unhighlightClassName = '',
unhighlightStyle
}) {
if (!children) return null;
if (typeof children !== 'string') return children;
const textToHighlight = children;
const chunks = Object(dist["findAll"])({
autoEscape,
caseSensitive,
findChunks,
sanitize,
searchWords,
textToHighlight
});
const HighlightTag = highlightTag;
let highlightIndex = -1;
let highlightClassNames = '';
let highlightStyles;
const textContent = chunks.map((chunk, index) => {
const text = textToHighlight.substr(chunk.start, chunk.end - chunk.start);
if (chunk.highlight) {
highlightIndex++;
let highlightClass;
if (typeof highlightClassName === 'object') {
if (!caseSensitive) {
highlightClassName = memoizedLowercaseProps(highlightClassName);
highlightClass = highlightClassName[text.toLowerCase()];
} else {
highlightClass = highlightClassName[text];
}
} else {
highlightClass = highlightClassName;
}
const isActive = highlightIndex === +activeIndex;
highlightClassNames = `${highlightClass} ${isActive ? activeClassName : ''}`;
highlightStyles = isActive === true && activeStyle !== null ? Object.assign({}, highlightStyle, activeStyle) : highlightStyle;
/** @type {Record} */
const props = {
children: text,
className: highlightClassNames,
key: index,
style: highlightStyles
}; // Don't attach arbitrary props to DOM elements; this triggers React DEV warnings (https://fb.me/react-unknown-prop)
// Only pass through the highlightIndex attribute for custom components.
if (typeof HighlightTag !== 'string') {
props.highlightIndex = highlightIndex;
}
return Object(external_wp_element_["createElement"])(HighlightTag, props);
}
return Object(external_wp_element_["createElement"])('span', {
children: text,
className: unhighlightClassName,
key: index,
style: unhighlightStyle
});
});
return textContent;
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/ui/utils/font-size.js
/**
* External dependencies
*/
// eslint-disable-next-line no-restricted-imports
/**
* Internal dependencies
*/
const BASE_FONT_SIZE = 13;
const PRESET_FONT_SIZES = {
body: BASE_FONT_SIZE,
caption: 10,
footnote: 11,
largeTitle: 28,
subheadline: 12,
title: 20
};
const HEADING_FONT_SIZES = [1, 2, 3, 4, 5, 6].flatMap(n => [n, n.toString()]);
function getFontSize(size = BASE_FONT_SIZE) {
if (size in PRESET_FONT_SIZES) {
return getFontSize(PRESET_FONT_SIZES[size]);
}
if (typeof size !== 'number') {
const parsed = parseFloat(size);
if (Number.isNaN(parsed)) return size;
size = parsed;
}
const ratio = `(${size} / ${BASE_FONT_SIZE})`;
return `calc(${ratio} * ${config_values.fontSize})`;
}
function getHeadingFontSize(size = 3) {
if (!HEADING_FONT_SIZES.includes(size)) {
return getFontSize(size);
}
const headingSize = `fontSizeH${size}`;
return config_values[headingSize];
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/text/get-line-height.js
/**
* External dependencies
*/
// eslint-disable-next-line no-restricted-imports
/**
* Internal dependencies
*/
function getLineHeight(adjustLineHeightForInnerControls, lineHeight) {
if (lineHeight) return lineHeight;
if (!adjustLineHeightForInnerControls) return;
let value = `calc(${config_values.controlHeight} + ${space_space(2)})`;
switch (adjustLineHeightForInnerControls) {
case 'large':
value = `calc(${config_values.controlHeightLarge} + ${space_space(2)})`;
break;
case 'small':
value = `calc(${config_values.controlHeightSmall} + ${space_space(2)})`;
break;
case 'xSmall':
value = `calc(${config_values.controlHeightXSmall} + ${space_space(2)})`;
break;
default:
break;
}
return value;
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/text/hook.js
function hook_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* @param {import('../ui/context').ViewOwnProps} props
*/
function useText(props) {
const {
adjustLineHeightForInnerControls,
align,
children,
className,
color,
ellipsizeMode,
isDestructive = false,
display,
highlightEscape = false,
highlightCaseSensitive = false,
highlightWords,
highlightSanitize,
isBlock = false,
letterSpacing,
lineHeight: lineHeightProp,
optimizeReadabilityFor,
size,
truncate = false,
upperCase = false,
variant,
weight = config_values.fontWeight,
...otherProps
} = Object(use_context_system["a" /* useContextSystem */])(props, 'Text');
/** @type {import('react').ReactNode} */
let content = children;
const isHighlighter = Array.isArray(highlightWords);
const isCaption = size === 'caption';
if (isHighlighter) {
if (typeof children !== 'string') {
throw new TypeError('`children` of `Text` must only be `string` types when `highlightWords` is defined');
}
content = createHighlighterText({
autoEscape: highlightEscape,
// Disable reason: We need to disable this otherwise it erases the cast
// eslint-disable-next-line object-shorthand
children:
/** @type {string} */
children,
caseSensitive: highlightCaseSensitive,
searchWords: highlightWords,
sanitize: highlightSanitize
});
}
const classes = Object(external_wp_element_["useMemo"])(() => {
const sx = {};
const lineHeight = getLineHeight(adjustLineHeightForInnerControls, lineHeightProp);
sx.Base = /*#__PURE__*/Object(emotion_esm["a" /* css */])({
color,
display,
fontSize: getFontSize(size),
/* eslint-disable jsdoc/valid-types */
fontWeight:
/** @type {import('react').CSSProperties['fontWeight']} */
weight,
/* eslint-enable jsdoc/valid-types */
lineHeight,
letterSpacing,
textAlign: align
}, true ? "" : undefined);
sx.upperCase = /*#__PURE__*/Object(emotion_esm["a" /* css */])( true ? {
name: "1lejymi",
styles: "text-transform:uppercase;"
} : undefined);
sx.optimalTextColor = null;
if (optimizeReadabilityFor) {
const isOptimalTextColorDark = getOptimalTextShade(optimizeReadabilityFor) === 'dark';
sx.optimalTextColor = isOptimalTextColorDark ? /*#__PURE__*/Object(emotion_esm["a" /* css */])({
color: COLORS.black
}, true ? "" : undefined) : /*#__PURE__*/Object(emotion_esm["a" /* css */])({
color: COLORS.white
}, true ? "" : undefined);
}
return Object(emotion_esm["b" /* cx */])(Text, sx.Base, sx.optimalTextColor, isDestructive && destructive, !!isHighlighter && highlighterText, isBlock && styles_block, isCaption && styles_muted, variant && text_styles_namespaceObject[variant], upperCase && sx.upperCase, className);
}, [adjustLineHeightForInnerControls, align, className, color, display, isBlock, isCaption, isDestructive, isHighlighter, letterSpacing, lineHeightProp, optimizeReadabilityFor, size, upperCase, variant, weight]);
/** @type {undefined | 'auto' | 'none'} */
let finalEllipsizeMode;
if (truncate === true) {
finalEllipsizeMode = 'auto';
}
if (truncate === false) {
finalEllipsizeMode = 'none';
}
const finalComponentProps = { ...otherProps,
className: classes,
children,
ellipsizeMode: ellipsizeMode || finalEllipsizeMode
};
const truncateProps = useTruncate(finalComponentProps);
/**
* Enhance child `` components to inherit font size.
*/
if (!truncate && Array.isArray(children)) {
content = external_wp_element_["Children"].map(children, child => {
// @ts-ignore
if (!Object(external_lodash_["isPlainObject"])(child) || !('props' in child)) {
return child;
}
const isLink = Object(context_connect["b" /* hasConnectNamespace */])(child, ['Link']);
if (isLink) {
return Object(external_wp_element_["cloneElement"])(child, {
size: child.props.size || 'inherit'
});
}
return child;
});
}
return { ...truncateProps,
children: truncate ? truncateProps.children : content
};
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/text/component.js
/**
* Internal dependencies
*/
/**
* `Text` is a core component that renders text in the library, using the
* library's typography system.
*
* `Text` can be used to render any text-content, like an HTML `p` or `span`.
*
* @example
*
* ```jsx
* import { __experimentalText as Text } from `@wordpress/components`;
*
* function Example() {
* return Code is Poetry;
* }
* ```
*/
const component_Text = create_component_createComponent({
as: 'span',
useHook: useText,
name: 'Text'
});
/* harmony default export */ var text_component = (component_Text);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/utils/rtl.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
const LOWER_LEFT_REGEXP = new RegExp(/-left/g);
const LOWER_RIGHT_REGEXP = new RegExp(/-right/g);
const UPPER_LEFT_REGEXP = new RegExp(/Left/g);
const UPPER_RIGHT_REGEXP = new RegExp(/Right/g);
/**
* Flips a CSS property from left <-> right.
*
* @param {string} key The CSS property name.
*
* @return {string} The flipped CSS property name, if applicable.
*/
function getConvertedKey(key) {
if (key === 'left') {
return 'right';
}
if (key === 'right') {
return 'left';
}
if (LOWER_LEFT_REGEXP.test(key)) {
return key.replace(LOWER_LEFT_REGEXP, '-right');
}
if (LOWER_RIGHT_REGEXP.test(key)) {
return key.replace(LOWER_RIGHT_REGEXP, '-left');
}
if (UPPER_LEFT_REGEXP.test(key)) {
return key.replace(UPPER_LEFT_REGEXP, 'Right');
}
if (UPPER_RIGHT_REGEXP.test(key)) {
return key.replace(UPPER_RIGHT_REGEXP, 'Left');
}
return key;
}
/**
* An incredibly basic ltr -> rtl converter for style properties
*
* @param {import('react').CSSProperties} ltrStyles
*
* @return {import('react').CSSProperties} Converted ltr -> rtl styles
*/
const convertLTRToRTL = (ltrStyles = {}) => {
return Object(external_lodash_["mapKeys"])(ltrStyles, (_value, key) => getConvertedKey(key));
};
/**
* A higher-order function that create an incredibly basic ltr -> rtl style converter for CSS objects.
*
* @param {import('react').CSSProperties} ltrStyles Ltr styles. Converts and renders from ltr -> rtl styles, if applicable.
* @param {import('react').CSSProperties} [rtlStyles] Rtl styles. Renders if provided.
*
* @return {Function} A function to output CSS styles for Emotion's renderer
*/
function rtl_rtl(ltrStyles = {}, rtlStyles) {
return () => {
if (rtlStyles) {
// @ts-ignore: `css` types are wrong, it can accept an object: https://emotion.sh/docs/object-styles#with-css
return Object(external_wp_i18n_["isRTL"])() ? /*#__PURE__*/css_browser_esm(rtlStyles, true ? "" : undefined) : /*#__PURE__*/css_browser_esm(ltrStyles, true ? "" : undefined);
} // @ts-ignore: `css` types are wrong, it can accept an object: https://emotion.sh/docs/object-styles#with-css
return Object(external_wp_i18n_["isRTL"])() ? /*#__PURE__*/css_browser_esm(convertLTRToRTL(ltrStyles), true ? "" : undefined) : /*#__PURE__*/css_browser_esm(ltrStyles, true ? "" : undefined);
};
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/input-control/styles/input-control-styles.js
function input_control_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
/**
* External dependencies
*/
/**
* Internal dependencies
*/
var input_control_styles_ref = true ? {
name: "1dacand",
styles: "padding-top:0;"
} : undefined;
const rootFloatLabelStyles = () => {
return input_control_styles_ref;
};
var input_control_styles_ref2 = true ? {
name: "r6z5ec",
styles: "z-index:1;"
} : undefined;
const rootFocusedStyles = ({
isFocused
}) => {
if (!isFocused) return '';
return input_control_styles_ref2;
};
var input_control_styles_ref3 = true ? {
name: "uz6002",
styles: "align-items:flex-start;flex-direction:column;"
} : undefined;
var input_control_styles_ref4 = true ? {
name: "53hdd7",
styles: "align-items:flex-start;flex-direction:column-reverse;"
} : undefined;
var input_control_styles_ref5 = true ? {
name: "x4dmss",
styles: "justify-content:space-between;"
} : undefined;
const rootLabelPositionStyles = ({
labelPosition
}) => {
switch (labelPosition) {
case 'top':
return input_control_styles_ref3;
case 'bottom':
return input_control_styles_ref4;
case 'edge':
return input_control_styles_ref5;
default:
return '';
}
};
const input_control_styles_Root = /*#__PURE__*/styled_base_browser_esm(flex_component, {
target: "e1cr7zh10",
label: "Root"
})("position:relative;border-radius:2px;", rootFloatLabelStyles, " ", rootFocusedStyles, " ", rootLabelPositionStyles, true ? "" : undefined);
const containerDisabledStyles = ({
disabled
}) => {
const backgroundColor = disabled ? COLORS.ui.backgroundDisabled : COLORS.ui.background;
return /*#__PURE__*/css_browser_esm({
backgroundColor
}, true ? "" : undefined);
}; // Normalizes the margins from the (components/ui/flex/) container.
var input_control_styles_ref6 = true ? {
name: "1ibawvu",
styles: "margin:0 !important;"
} : undefined;
const containerMarginStyles = ({
hideLabel
}) => {
return hideLabel ? input_control_styles_ref6 : null;
};
var input_control_styles_ref7 = true ? {
name: "8atqhb",
styles: "width:100%;"
} : undefined;
const containerWidthStyles = ({
__unstableInputWidth,
labelPosition
}) => {
if (!__unstableInputWidth) return input_control_styles_ref7;
if (labelPosition === 'side') return '';
if (labelPosition === 'edge') {
return /*#__PURE__*/css_browser_esm({
flex: `0 0 ${__unstableInputWidth}`
}, true ? "" : undefined);
}
return /*#__PURE__*/css_browser_esm({
width: __unstableInputWidth
}, true ? "" : undefined);
};
const Container = styled_base_browser_esm("div", {
target: "e1cr7zh11",
label: "Container"
})("align-items:center;box-sizing:border-box;border-radius:inherit;display:flex;flex:1;position:relative;", containerDisabledStyles, " ", containerMarginStyles, " ", containerWidthStyles, true ? "" : undefined);
const disabledStyles = ({
disabled
}) => {
if (!disabled) return '';
return /*#__PURE__*/css_browser_esm({
color: COLORS.ui.textDisabled
}, true ? "" : undefined);
};
const fontSizeStyles = ({
size
}) => {
const sizes = {
default: '13px',
small: '11px'
};
const fontSize = sizes[size];
const fontSizeMobile = '16px';
if (!fontSize) return '';
return /*#__PURE__*/css_browser_esm("font-size:", fontSizeMobile, ";@media ( min-width:600px ){font-size:", fontSize, ";}" + ( true ? "" : undefined));
};
const sizeStyles = ({
size
}) => {
const sizes = {
default: {
height: 30,
lineHeight: 1,
minHeight: 30
},
small: {
height: 24,
lineHeight: 1,
minHeight: 24
}
};
const style = sizes[size] || sizes.default;
return /*#__PURE__*/css_browser_esm(style, true ? "" : undefined);
};
var input_control_styles_ref8 = true ? {
name: "103r1kr",
styles: "&::-webkit-input-placeholder{line-height:normal;}"
} : undefined;
const placeholderStyles = () => {
return input_control_styles_ref8;
};
const dragStyles = ({
isDragging,
dragCursor
}) => {
let defaultArrowStyles = '';
let activeDragCursorStyles = '';
if (isDragging) {
defaultArrowStyles = /*#__PURE__*/css_browser_esm("cursor:", dragCursor, ";user-select:none;&::-webkit-outer-spin-button,&::-webkit-inner-spin-button{-webkit-appearance:none !important;margin:0 !important;}" + ( true ? "" : undefined));
}
if (isDragging && dragCursor) {
activeDragCursorStyles = /*#__PURE__*/css_browser_esm("&:active{cursor:", dragCursor, ";}" + ( true ? "" : undefined));
}
return /*#__PURE__*/css_browser_esm(defaultArrowStyles, " ", activeDragCursorStyles, true ? "" : undefined);
}; // TODO: Resolve need to use &&& to increase specificity
// https://github.com/WordPress/gutenberg/issues/18483
const input_control_styles_Input = styled_base_browser_esm("input", {
target: "e1cr7zh12",
label: "Input"
})("&&&{background-color:transparent;box-sizing:border-box;border:none;box-shadow:none !important;color:", COLORS.black, ";display:block;margin:0;outline:none;padding-left:8px;padding-right:8px;width:100%;", dragStyles, " ", disabledStyles, " ", fontSizeStyles, " ", sizeStyles, " ", placeholderStyles, "}" + ( true ? "" : undefined));
var input_control_styles_ref9 = true ? {
name: "8uhtka",
styles: "overflow:hidden;text-overflow:ellipsis;white-space:nowrap;"
} : undefined;
const labelTruncation = () => {
return input_control_styles_ref9;
};
const labelPadding = ({
labelPosition
}) => {
let paddingBottom = 4;
if (labelPosition === 'edge' || labelPosition === 'side') {
paddingBottom = 0;
}
return /*#__PURE__*/css_browser_esm({
paddingTop: 0,
paddingBottom
}, true ? "" : undefined);
};
const BaseLabel = /*#__PURE__*/styled_base_browser_esm(text_component, {
target: "e1cr7zh13",
label: "BaseLabel"
})("&&&{box-sizing:border-box;color:currentColor;display:block;margin:0;max-width:100%;z-index:1;", labelPadding, " ", labelTruncation, "}" + ( true ? "" : undefined));
const Label = props => Object(external_wp_element_["createElement"])(BaseLabel, Object(esm_extends["a" /* default */])({}, props, {
as: "label"
}));
const LabelWrapper = /*#__PURE__*/styled_base_browser_esm(flex_item_component, {
target: "e1cr7zh14",
label: "LabelWrapper"
})( true ? {
name: "120o8im",
styles: "max-width:calc( 100% - 10px );"
} : undefined);
const backdropFocusedStyles = ({
disabled,
isFocused
}) => {
let borderColor = isFocused ? COLORS.ui.borderFocus : COLORS.ui.border;
let boxShadow = null;
if (isFocused) {
boxShadow = `0 0 0 1px ${COLORS.ui.borderFocus} inset`;
}
if (disabled) {
borderColor = COLORS.ui.borderDisabled;
}
return /*#__PURE__*/css_browser_esm({
boxShadow,
borderColor,
borderStyle: 'solid',
borderWidth: 1
}, true ? "" : undefined);
};
const BackdropUI = styled_base_browser_esm("div", {
target: "e1cr7zh15",
label: "BackdropUI"
})("&&&{box-sizing:border-box;border-radius:inherit;bottom:0;left:0;margin:0;padding:0;pointer-events:none;position:absolute;right:0;top:0;", backdropFocusedStyles, " ", rtl_rtl({
paddingLeft: 2
}), "}" + ( true ? "" : undefined));
const Prefix = styled_base_browser_esm("span", {
target: "e1cr7zh16",
label: "Prefix"
})( true ? {
name: "1pxuk39",
styles: "box-sizing:border-box;display:block;"
} : undefined);
const Suffix = styled_base_browser_esm("span", {
target: "e1cr7zh17",
label: "Suffix"
})( true ? {
name: "1pxuk39",
styles: "box-sizing:border-box;display:block;"
} : undefined);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/input-control/backdrop.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function Backdrop({
disabled = false,
isFocused = false
}) {
return Object(external_wp_element_["createElement"])(BackdropUI, {
"aria-hidden": "true",
className: "components-input-control__backdrop",
disabled: disabled,
isFocused: isFocused
});
}
const MemoizedBackdrop = Object(external_wp_element_["memo"])(Backdrop);
/* harmony default export */ var backdrop = (MemoizedBackdrop);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/input-control/label.js
/**
* Internal dependencies
*/
function label_Label({
children,
hideLabelFromVision,
htmlFor,
...props
}) {
if (!children) return null;
if (hideLabelFromVision) {
return Object(external_wp_element_["createElement"])(visually_hidden["a" /* default */], {
as: "label",
htmlFor: htmlFor
}, children);
}
return Object(external_wp_element_["createElement"])(Label, Object(esm_extends["a" /* default */])({
htmlFor: htmlFor
}, props), children);
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/input-control/input-base.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function useUniqueId(idProp) {
const instanceId = Object(external_wp_compose_["useInstanceId"])(InputBase);
const id = `input-base-control-${instanceId}`;
return idProp || id;
} // Adapter to map props for the new ui/flex compopnent.
function getUIFlexProps({
labelPosition
}) {
const props = {};
switch (labelPosition) {
case 'top':
props.direction = 'column';
props.gap = 0;
break;
case 'bottom':
props.direction = 'column-reverse';
props.gap = 0;
break;
case 'edge':
props.justify = 'space-between';
break;
}
return props;
}
function InputBase({
__unstableInputWidth,
children,
className,
disabled = false,
hideLabelFromVision = false,
labelPosition,
id: idProp,
isFocused = false,
label,
prefix,
size = 'default',
suffix,
...props
}, ref) {
const id = useUniqueId(idProp);
const hideLabel = hideLabelFromVision || !label;
return Object(external_wp_element_["createElement"])(input_control_styles_Root, Object(esm_extends["a" /* default */])({}, props, getUIFlexProps({
labelPosition
}), {
className: className,
isFocused: isFocused,
labelPosition: labelPosition,
ref: ref,
__unstableVersion: "next"
}), Object(external_wp_element_["createElement"])(LabelWrapper, null, Object(external_wp_element_["createElement"])(label_Label, {
className: "components-input-control__label",
hideLabelFromVision: hideLabelFromVision,
labelPosition: labelPosition,
htmlFor: id,
size: size
}, label)), Object(external_wp_element_["createElement"])(Container, {
__unstableInputWidth: __unstableInputWidth,
className: "components-input-control__container",
disabled: disabled,
hideLabel: hideLabel,
isFocused: isFocused,
labelPosition: labelPosition
}, prefix && Object(external_wp_element_["createElement"])(Prefix, {
className: "components-input-control__prefix"
}, prefix), children, suffix && Object(external_wp_element_["createElement"])(Suffix, {
className: "components-input-control__suffix"
}, suffix), Object(external_wp_element_["createElement"])(backdrop, {
"aria-hidden": "true",
disabled: disabled,
isFocused: isFocused,
label: label,
size: size
})));
}
/* harmony default export */ var input_base = (Object(external_wp_element_["forwardRef"])(InputBase));
// CONCATENATED MODULE: ./node_modules/react-use-gesture/dist/reactusegesture.esm.js
// vector add
function addV(v1, v2) {
return v1.map(function (v, i) {
return v + v2[i];
});
} // vector substract
function subV(v1, v2) {
return v1.map(function (v, i) {
return v - v2[i];
});
}
/**
* Calculates distance
* @param movement the difference between current and initial vectors
* @returns distance
*/
function calculateDistance(movement) {
return Math.hypot.apply(Math, movement);
}
function calculateAllGeometry(movement, delta) {
if (delta === void 0) {
delta = movement;
}
var dl = calculateDistance(delta);
var alpha = dl === 0 ? 0 : 1 / dl;
var direction = delta.map(function (v) {
return alpha * v;
});
var distance = calculateDistance(movement);
return {
distance: distance,
direction: direction
};
}
/**
* Calculates all kinematics
* @template T the expected vector type
* @param movement the difference between current and initial vectors
* @param delta the difference between current and previous vectors
* @param delta_t the time difference between current and previous timestamps
* @returns all kinematics
*/
function calculateAllKinematics(movement, delta, dt) {
var dl = calculateDistance(delta);
var alpha = dl === 0 ? 0 : 1 / dl;
var beta = dt === 0 ? 0 : 1 / dt;
var velocity = beta * dl;
var velocities = delta.map(function (v) {
return beta * v;
});
var direction = delta.map(function (v) {
return alpha * v;
});
var distance = calculateDistance(movement);
return {
velocities: velocities,
velocity: velocity,
distance: distance,
direction: direction
};
}
/**
* Because IE doesn't support `Math.sign` function, so we use the polyfill version of the function.
* This polyfill function is suggested by Mozilla:
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/sign#Polyfill
* @param x target number
*/
function sign(x) {
if (Math.sign) return Math.sign(x);
return Number(x > 0) - Number(x < 0) || +x;
}
function minMax(value, min, max) {
return Math.max(min, Math.min(value, max));
} // Based on @aholachek ;)
// https://twitter.com/chpwn/status/285540192096497664
// iOS constant = 0.55
// https://medium.com/@nathangitter/building-fluid-interfaces-ios-swift-9732bb934bf5
function rubberband2(distance, constant) {
// default constant from the article is 0.7
return Math.pow(distance, constant * 5);
}
function rubberband(distance, dimension, constant) {
if (dimension === 0 || Math.abs(dimension) === Infinity) return rubberband2(distance, constant);
return distance * dimension * constant / (dimension + constant * distance);
}
function rubberbandIfOutOfBounds(position, min, max, constant) {
if (constant === void 0) {
constant = 0.15;
}
if (constant === 0) return minMax(position, min, max);
if (position < min) return -rubberband(min - position, max - min, constant) + min;
if (position > max) return +rubberband(position - max, max - min, constant) + max;
return position;
}
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 _createClass(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
return Constructor;
}
function _extends() {
_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);
}
function reactusegesture_esm_inheritsLoose(subClass, superClass) {
subClass.prototype = Object.create(superClass.prototype);
subClass.prototype.constructor = subClass;
subClass.__proto__ = superClass;
}
function _objectWithoutPropertiesLoose(source, excluded) {
if (source == null) return {};
var target = {};
var sourceKeys = Object.keys(source);
var key, i;
for (i = 0; i < sourceKeys.length; i++) {
key = sourceKeys[i];
if (excluded.indexOf(key) >= 0) continue;
target[key] = source[key];
}
return target;
}
function _assertThisInitialized(self) {
if (self === void 0) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}
return self;
}
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;
}
function _createForOfIteratorHelperLoose(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;
return function () {
if (i >= o.length) return {
done: true
};
return {
done: false,
value: o[i++]
};
};
}
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
it = o[Symbol.iterator]();
return it.next.bind(it);
}
function noop() {}
/**
* TODO Beware that only optimized cases are covered in tests =)
* TODO Need to cover general case as well
*
* @param fns
*/
function chainFns() {
for (var _len = arguments.length, fns = new Array(_len), _key = 0; _key < _len; _key++) {
fns[_key] = arguments[_key];
}
if (fns.length === 0) return noop;
if (fns.length === 1) return fns[0];
return function () {
var result;
for (var _iterator = _createForOfIteratorHelperLoose(fns), _step; !(_step = _iterator()).done;) {
var fn = _step.value;
result = fn.apply(this, arguments) || result;
}
return result;
};
}
/**
* Expects a simple value or 2D vector (an array with 2 elements) and
* always returns 2D vector. If simple value is passed, returns a
* vector with this value as both coordinates.
*
* @param value
*/
function ensureVector(value, fallback) {
if (value === undefined) {
if (fallback === undefined) {
throw new Error('Must define fallback value if undefined is expected');
}
value = fallback;
}
if (Array.isArray(value)) return value;
return [value, value];
}
/**
* Helper for defining a default value
*
* @param value
* @param fallback
*/
function assignDefault(value, fallback) {
return Object.assign({}, fallback, value || {});
}
/**
* Resolves getters (functions) by calling them
* If simple value is given it just passes through
*
* @param v
*/
function valueFn(v) {
if (typeof v === 'function') {
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
args[_key2 - 1] = arguments[_key2];
}
// @ts-ignore
return v.apply(void 0, args);
} else {
return v;
}
}
function resolveWith(config, resolvers) {
if (config === void 0) {
config = {};
}
var result = {};
for (var _i = 0, _Object$entries = Object.entries(resolvers); _i < _Object$entries.length; _i++) {
var _Object$entries$_i = _Object$entries[_i],
key = _Object$entries$_i[0],
resolver = _Object$entries$_i[1];
switch (typeof resolver) {
case 'function':
result[key] = resolver.call(result, config[key], key, config);
break;
case 'object':
result[key] = resolveWith(config[key], resolver);
break;
case 'boolean':
if (resolver) result[key] = config[key];
break;
}
}
return result;
}
/**
* Whether the browser supports GestureEvent (ie Safari)
* @returns true if the browser supports gesture event
*/
function supportsGestureEvents() {
try {
// TODO [TS] possibly find GestureEvent definitions?
// @ts-ignore: no type definitions for webkit GestureEvents
return 'constructor' in GestureEvent;
} catch (e) {
return false;
}
}
function supportsTouchEvents() {
return typeof window !== 'undefined' && 'ontouchstart' in window;
}
function supportsPointerEvents() {
return typeof window !== 'undefined' && 'onpointerdown' in window;
}
function getEventTouches(event) {
if ('pointerId' in event) return null;
return event.type === 'touchend' ? event.changedTouches : event.targetTouches;
}
function getTouchIds(event) {
return Array.from(getEventTouches(event)).map(function (t) {
return t.identifier;
});
}
function getGenericEventData(event) {
var buttons = 'buttons' in event ? event.buttons : 0;
var shiftKey = event.shiftKey,
altKey = event.altKey,
metaKey = event.metaKey,
ctrlKey = event.ctrlKey; // TODO check if this might create some overrides?
return {
buttons: buttons,
shiftKey: shiftKey,
altKey: altKey,
metaKey: metaKey,
ctrlKey: ctrlKey
};
}
var identity = function identity(xy) {
return xy;
};
/**
* Gets pointer event values.
* @param event
* @returns pointer event values
*/
function getPointerEventValues(event, transform) {
if (transform === void 0) {
transform = identity;
}
var touchEvents = getEventTouches(event);
var _ref = touchEvents ? touchEvents[0] : event,
clientX = _ref.clientX,
clientY = _ref.clientY;
return transform([clientX, clientY]);
}
/**
* Gets two touches event data
* @param event
* @returns two touches event data
*/
function getTwoTouchesEventValues(event, pointerIds, transform) {
if (transform === void 0) {
transform = identity;
}
var _Array$from$filter = Array.from(event.touches).filter(function (t) {
return pointerIds.includes(t.identifier);
}),
A = _Array$from$filter[0],
B = _Array$from$filter[1];
if (!A || !B) throw Error("The event doesn't have two pointers matching the pointerIds");
var dx = B.clientX - A.clientX;
var dy = B.clientY - A.clientY;
var cx = (B.clientX + A.clientX) / 2;
var cy = (B.clientY + A.clientY) / 2; // const e: any = 'nativeEvent' in event ? event.nativeEvent : event
var distance = Math.hypot(dx, dy); // FIXME rotation has inconsistant values so we're not using it atm
// const angle = (e.rotation as number) ?? -(Math.atan2(dx, dy) * 180) / Math.PI
var angle = -(Math.atan2(dx, dy) * 180) / Math.PI;
var values = transform([distance, angle]);
var origin = transform([cx, cy]);
return {
values: values,
origin: origin
};
}
/**
* Gets scroll event values
* @param event
* @returns scroll event values
*/
function getScrollEventValues(event, transform) {
if (transform === void 0) {
transform = identity;
}
// If the currentTarget is the window then we return the scrollX/Y position.
// If not (ie the currentTarget is a DOM element), then we return scrollLeft/Top
var _event$currentTarget = event.currentTarget,
scrollX = _event$currentTarget.scrollX,
scrollY = _event$currentTarget.scrollY,
scrollLeft = _event$currentTarget.scrollLeft,
scrollTop = _event$currentTarget.scrollTop;
return transform([scrollX || scrollLeft || 0, scrollY || scrollTop || 0]);
} // wheel delta defaults from https://github.com/facebookarchive/fixed-data-table/blob/master/src/vendor_upstream/dom/normalizeWheel.js
var LINE_HEIGHT = 40;
var PAGE_HEIGHT = 800;
/**
* Gets wheel event values.
* @param event
* @returns wheel event values
*/
function getWheelEventValues(event, transform) {
if (transform === void 0) {
transform = identity;
}
var deltaX = event.deltaX,
deltaY = event.deltaY,
deltaMode = event.deltaMode; // normalize wheel values, especially for Firefox
if (deltaMode === 1) {
deltaX *= LINE_HEIGHT;
deltaY *= LINE_HEIGHT;
} else if (deltaMode === 2) {
deltaX *= PAGE_HEIGHT;
deltaY *= PAGE_HEIGHT;
}
return transform([deltaX, deltaY]);
}
/**
* Gets webkit gesture event values.
* @param event
* @returns webkit gesture event values
*/
function getWebkitGestureEventValues(event, transform) {
if (transform === void 0) {
transform = identity;
}
return transform([event.scale, event.rotation]);
}
var DEFAULT_DRAG_DELAY = 180;
var DEFAULT_RUBBERBAND = 0.15;
var DEFAULT_SWIPE_VELOCITY = 0.5;
var DEFAULT_SWIPE_DISTANCE = 50;
var DEFAULT_SWIPE_DURATION = 250;
var InternalGestureOptionsNormalizers = {
threshold: function threshold(value) {
if (value === void 0) {
value = 0;
}
return ensureVector(value);
},
rubberband: function rubberband(value) {
if (value === void 0) {
value = 0;
}
switch (value) {
case true:
return ensureVector(DEFAULT_RUBBERBAND);
case false:
return ensureVector(0);
default:
return ensureVector(value);
}
},
enabled: function enabled(value) {
if (value === void 0) {
value = true;
}
return value;
},
triggerAllEvents: function triggerAllEvents(value) {
if (value === void 0) {
value = false;
}
return value;
},
initial: function initial(value) {
if (value === void 0) {
value = 0;
}
if (typeof value === 'function') return value;
return ensureVector(value);
},
transform: true
};
var InternalCoordinatesOptionsNormalizers = /*#__PURE__*/_extends({}, InternalGestureOptionsNormalizers, {
axis: true,
lockDirection: function lockDirection(value) {
if (value === void 0) {
value = false;
}
return value;
},
bounds: function bounds(value) {
if (value === void 0) {
value = {};
}
if (typeof value === 'function') return function (state) {
return InternalCoordinatesOptionsNormalizers.bounds(value(state));
};
var _value2 = value,
_value2$left = _value2.left,
left = _value2$left === void 0 ? -Infinity : _value2$left,
_value2$right = _value2.right,
right = _value2$right === void 0 ? Infinity : _value2$right,
_value2$top = _value2.top,
top = _value2$top === void 0 ? -Infinity : _value2$top,
_value2$bottom = _value2.bottom,
bottom = _value2$bottom === void 0 ? Infinity : _value2$bottom;
return [[left, right], [top, bottom]];
}
});
var isBrowser = typeof window !== 'undefined' && window.document && window.document.createElement;
var InternalGenericOptionsNormalizers = {
enabled: function enabled(value) {
if (value === void 0) {
value = true;
}
return value;
},
domTarget: true,
window: /*#__PURE__*/function (_window) {
function window(_x) {
return _window.apply(this, arguments);
}
window.toString = function () {
return _window.toString();
};
return window;
}(function (value) {
if (value === void 0) {
value = isBrowser ? window : undefined;
}
return value;
}),
eventOptions: function eventOptions(_temp) {
var _ref = _temp === void 0 ? {} : _temp,
_ref$passive = _ref.passive,
passive = _ref$passive === void 0 ? true : _ref$passive,
_ref$capture = _ref.capture,
capture = _ref$capture === void 0 ? false : _ref$capture;
return {
passive: passive,
capture: capture
};
},
transform: true
};
var InternalDistanceAngleOptionsNormalizers = /*#__PURE__*/_extends({}, InternalGestureOptionsNormalizers, {
bounds: function bounds(_value, _key, _ref2) {
var _ref2$distanceBounds = _ref2.distanceBounds,
distanceBounds = _ref2$distanceBounds === void 0 ? {} : _ref2$distanceBounds,
_ref2$angleBounds = _ref2.angleBounds,
angleBounds = _ref2$angleBounds === void 0 ? {} : _ref2$angleBounds;
var _distanceBounds = function _distanceBounds(state) {
var D = assignDefault(valueFn(distanceBounds, state), {
min: -Infinity,
max: Infinity
});
return [D.min, D.max];
};
var _angleBounds = function _angleBounds(state) {
var A = assignDefault(valueFn(angleBounds, state), {
min: -Infinity,
max: Infinity
});
return [A.min, A.max];
};
if (typeof distanceBounds !== 'function' && typeof angleBounds !== 'function') return [_distanceBounds(), _angleBounds()];
return function (state) {
return [_distanceBounds(state), _angleBounds(state)];
};
}
});
var InternalDragOptionsNormalizers = /*#__PURE__*/_extends({}, InternalCoordinatesOptionsNormalizers, {
useTouch: function useTouch(value) {
if (value === void 0) {
value = false;
}
var supportsTouch = supportsTouchEvents();
var supportsPointer = supportsPointerEvents();
if (value && supportsTouch) return true;
if (supportsTouch && !supportsPointer) return true;
return false;
},
experimental_preventWindowScrollY: function experimental_preventWindowScrollY(value) {
if (value === void 0) {
value = false;
}
return value;
},
threshold: function threshold(v, _k, _ref3) {
var _ref3$filterTaps = _ref3.filterTaps,
filterTaps = _ref3$filterTaps === void 0 ? false : _ref3$filterTaps,
_ref3$lockDirection = _ref3.lockDirection,
lockDirection = _ref3$lockDirection === void 0 ? false : _ref3$lockDirection,
_ref3$axis = _ref3.axis,
axis = _ref3$axis === void 0 ? undefined : _ref3$axis;
var A = ensureVector(v, filterTaps ? 3 : lockDirection ? 1 : axis ? 1 : 0);
this.filterTaps = filterTaps;
return A;
},
swipeVelocity: function swipeVelocity(v) {
if (v === void 0) {
v = DEFAULT_SWIPE_VELOCITY;
}
return ensureVector(v);
},
swipeDistance: function swipeDistance(v) {
if (v === void 0) {
v = DEFAULT_SWIPE_DISTANCE;
}
return ensureVector(v);
},
swipeDuration: function swipeDuration(value) {
if (value === void 0) {
value = DEFAULT_SWIPE_DURATION;
}
return value;
},
delay: function delay(value) {
if (value === void 0) {
value = 0;
}
switch (value) {
case true:
return DEFAULT_DRAG_DELAY;
case false:
return 0;
default:
return value;
}
}
});
function getInternalGenericOptions(config) {
if (config === void 0) {
config = {};
}
// TODO warn when passive is set to true and domTarget is undefined
return resolveWith(config, InternalGenericOptionsNormalizers);
}
function getInternalCoordinatesOptions(config) {
if (config === void 0) {
config = {};
}
return resolveWith(config, InternalCoordinatesOptionsNormalizers);
}
function getInternalDistanceAngleOptions(config) {
if (config === void 0) {
config = {};
}
return resolveWith(config, InternalDistanceAngleOptionsNormalizers);
}
function getInternalDragOptions(config) {
if (config === void 0) {
config = {};
}
return resolveWith(config, InternalDragOptionsNormalizers);
}
function _buildMoveConfig(_ref) {
var domTarget = _ref.domTarget,
eventOptions = _ref.eventOptions,
window = _ref.window,
enabled = _ref.enabled,
rest = _objectWithoutPropertiesLoose(_ref, ["domTarget", "eventOptions", "window", "enabled"]);
var opts = getInternalGenericOptions({
domTarget: domTarget,
eventOptions: eventOptions,
window: window,
enabled: enabled
});
opts.move = getInternalCoordinatesOptions(rest);
return opts;
}
function _buildHoverConfig(_ref2) {
var domTarget = _ref2.domTarget,
eventOptions = _ref2.eventOptions,
window = _ref2.window,
enabled = _ref2.enabled,
rest = _objectWithoutPropertiesLoose(_ref2, ["domTarget", "eventOptions", "window", "enabled"]);
var opts = getInternalGenericOptions({
domTarget: domTarget,
eventOptions: eventOptions,
window: window,
enabled: enabled
});
opts.hover = _extends({
enabled: true
}, rest);
return opts;
}
function _buildDragConfig(_ref3) {
var domTarget = _ref3.domTarget,
eventOptions = _ref3.eventOptions,
window = _ref3.window,
enabled = _ref3.enabled,
rest = _objectWithoutPropertiesLoose(_ref3, ["domTarget", "eventOptions", "window", "enabled"]);
var opts = getInternalGenericOptions({
domTarget: domTarget,
eventOptions: eventOptions,
window: window,
enabled: enabled
});
opts.drag = getInternalDragOptions(rest);
return opts;
}
function _buildPinchConfig(_ref4) {
var domTarget = _ref4.domTarget,
eventOptions = _ref4.eventOptions,
window = _ref4.window,
enabled = _ref4.enabled,
rest = _objectWithoutPropertiesLoose(_ref4, ["domTarget", "eventOptions", "window", "enabled"]);
var opts = getInternalGenericOptions({
domTarget: domTarget,
eventOptions: eventOptions,
window: window,
enabled: enabled
});
opts.pinch = getInternalDistanceAngleOptions(rest);
return opts;
}
function _buildScrollConfig(_ref5) {
var domTarget = _ref5.domTarget,
eventOptions = _ref5.eventOptions,
window = _ref5.window,
enabled = _ref5.enabled,
rest = _objectWithoutPropertiesLoose(_ref5, ["domTarget", "eventOptions", "window", "enabled"]);
var opts = getInternalGenericOptions({
domTarget: domTarget,
eventOptions: eventOptions,
window: window,
enabled: enabled
});
opts.scroll = getInternalCoordinatesOptions(rest);
return opts;
}
function _buildWheelConfig(_ref6) {
var domTarget = _ref6.domTarget,
eventOptions = _ref6.eventOptions,
window = _ref6.window,
enabled = _ref6.enabled,
rest = _objectWithoutPropertiesLoose(_ref6, ["domTarget", "eventOptions", "window", "enabled"]);
var opts = getInternalGenericOptions({
domTarget: domTarget,
eventOptions: eventOptions,
window: window,
enabled: enabled
});
opts.wheel = getInternalCoordinatesOptions(rest);
return opts;
}
function buildComplexConfig(config, actions) {
if (config === void 0) {
config = {};
}
if (actions === void 0) {
actions = new Set();
}
var _config = config,
drag = _config.drag,
wheel = _config.wheel,
move = _config.move,
scroll = _config.scroll,
pinch = _config.pinch,
hover = _config.hover,
eventOptions = _config.eventOptions,
window = _config.window,
transform = _config.transform,
domTarget = _config.domTarget,
enabled = _config.enabled;
var mergedConfig = getInternalGenericOptions({
domTarget: domTarget,
eventOptions: eventOptions,
transform: transform,
window: window,
enabled: enabled
});
if (actions.has('onDrag')) mergedConfig.drag = getInternalDragOptions(drag);
if (actions.has('onWheel')) mergedConfig.wheel = getInternalCoordinatesOptions(wheel);
if (actions.has('onScroll')) mergedConfig.scroll = getInternalCoordinatesOptions(scroll);
if (actions.has('onMove')) mergedConfig.move = getInternalCoordinatesOptions(move);
if (actions.has('onPinch')) mergedConfig.pinch = getInternalDistanceAngleOptions(pinch);
if (actions.has('onHover')) mergedConfig.hover = _extends({
enabled: true
}, hover);
return mergedConfig;
}
function getInitial(mixed) {
return _extends({
_active: false,
_blocked: false,
_intentional: [false, false],
_movement: [0, 0],
_initial: [0, 0],
_bounds: [[-Infinity, Infinity], [-Infinity, Infinity]],
_threshold: [0, 0],
_lastEventType: undefined,
_dragStarted: false,
_dragPreventScroll: false,
_dragIsTap: true,
_dragDelayed: false,
event: undefined,
intentional: false,
values: [0, 0],
velocities: [0, 0],
delta: [0, 0],
movement: [0, 0],
offset: [0, 0],
lastOffset: [0, 0],
direction: [0, 0],
initial: [0, 0],
previous: [0, 0],
first: false,
last: false,
active: false,
timeStamp: 0,
startTime: 0,
elapsedTime: 0,
cancel: noop,
canceled: false,
memo: undefined,
args: undefined
}, mixed);
}
function getInitialState() {
var shared = {
hovering: false,
scrolling: false,
wheeling: false,
dragging: false,
moving: false,
pinching: false,
touches: 0,
buttons: 0,
down: false,
shiftKey: false,
altKey: false,
metaKey: false,
ctrlKey: false,
locked: false
};
var drag = getInitial({
_pointerId: undefined,
axis: undefined,
xy: [0, 0],
vxvy: [0, 0],
velocity: 0,
distance: 0,
tap: false,
swipe: [0, 0]
});
var pinch = getInitial({
// @ts-expect-error when used _pointerIds we can assert its type will be [number, number]
_pointerIds: [],
da: [0, 0],
vdva: [0, 0],
// @ts-expect-error origin can never be passed as undefined in userland
origin: undefined,
turns: 0
});
var wheel = getInitial({
axis: undefined,
xy: [0, 0],
vxvy: [0, 0],
velocity: 0,
distance: 0
});
var move = getInitial({
axis: undefined,
xy: [0, 0],
vxvy: [0, 0],
velocity: 0,
distance: 0
});
var scroll = getInitial({
axis: undefined,
xy: [0, 0],
vxvy: [0, 0],
velocity: 0,
distance: 0
});
return {
shared: shared,
drag: drag,
pinch: pinch,
wheel: wheel,
move: move,
scroll: scroll
};
}
var RecognizersMap = /*#__PURE__*/new Map();
var identity$1 = function identity(xy) {
return xy;
};
/**
* @private
* Recognizer abstract class.
*/
var Recognizer = /*#__PURE__*/function () {
/**
* Creates an instance of a gesture recognizer.
* @param stateKey drag, move, pinch, etc.
* @param controller the controller attached to the gesture
* @param [args] the args that should be passed to the gesture handler
*/
function Recognizer(controller, args) {
var _this = this;
if (args === void 0) {
args = [];
}
this.controller = controller;
this.args = args;
this.debounced = true; // Convenience method to set a timeout for a given gesture
this.setTimeout = function (callback, ms) {
var _window;
if (ms === void 0) {
ms = 140;
}
clearTimeout(_this.controller.timeouts[_this.stateKey]);
for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
args[_key - 2] = arguments[_key];
}
_this.controller.timeouts[_this.stateKey] = (_window = window).setTimeout.apply(_window, [callback, ms].concat(args));
}; // Convenience method to clear a timeout for a given gesture
this.clearTimeout = function () {
clearTimeout(_this.controller.timeouts[_this.stateKey]);
};
/**
* Fires the gesture handler
*/
this.fireGestureHandler = function (forceFlag) {
if (forceFlag === void 0) {
forceFlag = false;
}
/**
* If the gesture has been blocked (this can happen when the gesture has started in an unwanted direction),
* clean everything and don't do anything.
*/
if (_this.state._blocked) {
// we need debounced gestures to end by themselves
if (!_this.debounced) {
_this.state._active = false;
_this.clean();
}
return null;
} // If the gesture has no intentional dimension, don't fire the handler.
if (!forceFlag && !_this.state.intentional && !_this.config.triggerAllEvents) return null;
if (_this.state.intentional) {
var prev_active = _this.state.active;
var next_active = _this.state._active;
_this.state.active = next_active;
_this.state.first = next_active && !prev_active;
_this.state.last = prev_active && !next_active;
_this.controller.state.shared[_this.ingKey] = next_active; // Sets dragging, pinching, etc. to the gesture active state
}
var touches = _this.controller.pointerIds.size || _this.controller.touchIds.size;
var down = _this.controller.state.shared.buttons > 0 || touches > 0;
var state = _extends({}, _this.controller.state.shared, _this.state, _this.mapStateValues(_this.state), {
locked: !!document.pointerLockElement,
touches: touches,
down: down
}); // @ts-expect-error
var newMemo = _this.handler(state); // Sets memo to the returned value of the handler (unless it's not undefined)
_this.state.memo = newMemo !== void 0 ? newMemo : _this.state.memo;
return state;
};
this.controller = controller;
this.args = args;
} // Returns the gesture config
var _proto = Recognizer.prototype;
// Convenience method to update the shared state
_proto.updateSharedState = function updateSharedState(sharedState) {
Object.assign(this.controller.state.shared, sharedState);
} // Convenience method to update the gesture state
;
_proto.updateGestureState = function updateGestureState(gestureState) {
Object.assign(this.state, gestureState);
}
/**
* Returns state properties depending on the movement and state.
*
* Should be overriden for custom behavior, doesn't do anything in the implementation
* below.
*/
;
_proto.checkIntentionality = function checkIntentionality(_intentional, _movement) {
return {
_intentional: _intentional,
_blocked: false
};
}
/**
* Returns basic movement properties for the gesture based on the next values and current state.
*/
;
_proto.getMovement = function getMovement(values) {
var rubberband = this.config.rubberband;
var _this$state = this.state,
_bounds = _this$state._bounds,
_initial = _this$state._initial,
_active = _this$state._active,
wasIntentional = _this$state._intentional,
lastOffset = _this$state.lastOffset,
prevMovement = _this$state.movement,
_T = _this$state._threshold;
var M = this.getInternalMovement(values, this.state);
var i0 = wasIntentional[0] === false ? getIntentionalDisplacement(M[0], _T[0]) : wasIntentional[0];
var i1 = wasIntentional[1] === false ? getIntentionalDisplacement(M[1], _T[1]) : wasIntentional[1]; // Get gesture specific state properties based on intentionality and movement.
var intentionalityCheck = this.checkIntentionality([i0, i1], M);
if (intentionalityCheck._blocked) {
return _extends({}, intentionalityCheck, {
_movement: M,
delta: [0, 0]
});
}
var _intentional = intentionalityCheck._intentional;
var _movement = M;
/**
* The movement sent to the handler has 0 in its dimensions when intentionality is false.
* It is calculated from the actual movement minus the threshold.
*/
var movement = [_intentional[0] !== false ? M[0] - _intentional[0] : 0, _intentional[1] !== false ? M[1] - _intentional[1] : 0];
var offset = addV(movement, lastOffset);
/**
* Rubberband should be 0 when the gesture is no longer active, so that movement
* and offset can return within their bounds.
*/
var _rubberband = _active ? rubberband : [0, 0];
movement = computeRubberband(_bounds, addV(movement, _initial), _rubberband);
return _extends({}, intentionalityCheck, {
intentional: _intentional[0] !== false || _intentional[1] !== false,
_initial: _initial,
_movement: _movement,
movement: movement,
values: values,
offset: computeRubberband(_bounds, offset, _rubberband),
delta: subV(movement, prevMovement)
});
} // Cleans the gesture. Can be overriden by gestures.
;
_proto.clean = function clean() {
this.clearTimeout();
};
_createClass(Recognizer, [{
key: "config",
get: function get() {
return this.controller.config[this.stateKey];
} // Is the gesture enabled
}, {
key: "enabled",
get: function get() {
return this.controller.config.enabled && this.config.enabled;
} // Returns the controller state for a given gesture
}, {
key: "state",
get: function get() {
return this.controller.state[this.stateKey];
} // Returns the gesture handler
}, {
key: "handler",
get: function get() {
return this.controller.handlers[this.stateKey];
}
}, {
key: "transform",
get: function get() {
return this.config.transform || this.controller.config.transform || identity$1;
}
}]);
return Recognizer;
}(); //--------------------------------------------
function getIntentionalDisplacement(movement, threshold) {
if (Math.abs(movement) >= threshold) {
return sign(movement) * threshold;
} else {
return false;
}
}
function computeRubberband(bounds, _ref, _ref2) {
var Vx = _ref[0],
Vy = _ref[1];
var Rx = _ref2[0],
Ry = _ref2[1];
var _bounds$ = bounds[0],
X1 = _bounds$[0],
X2 = _bounds$[1],
_bounds$2 = bounds[1],
Y1 = _bounds$2[0],
Y2 = _bounds$2[1];
return [rubberbandIfOutOfBounds(Vx, X1, X2, Rx), rubberbandIfOutOfBounds(Vy, Y1, Y2, Ry)];
}
/**
* Returns a generic, common payload for all gestures from an event.
*/
function getGenericPayload(_ref3, event, isStartEvent) {
var state = _ref3.state;
var timeStamp = event.timeStamp,
_lastEventType = event.type;
var previous = state.values;
var elapsedTime = isStartEvent ? 0 : timeStamp - state.startTime;
return {
_lastEventType: _lastEventType,
event: event,
timeStamp: timeStamp,
elapsedTime: elapsedTime,
previous: previous
};
}
/**
* Returns the reinitialized start state for the gesture.
* Should be common to all gestures.
*/
function getStartGestureState(_ref4, values, event, initial) {
var state = _ref4.state,
config = _ref4.config,
stateKey = _ref4.stateKey,
args = _ref4.args,
transform = _ref4.transform;
var offset = state.offset;
var startTime = event.timeStamp;
var initialFn = config.initial,
bounds = config.bounds,
threshold = config.threshold; // the _threshold is the difference between a [0,0] offset converted to
// its new space coordinates
var _threshold = subV(transform(threshold), transform([0, 0])).map(Math.abs);
var _state = _extends({}, getInitialState()[stateKey], {
_active: true,
args: args,
values: values,
initial: initial != null ? initial : values,
_threshold: _threshold,
offset: offset,
lastOffset: offset,
startTime: startTime
});
return _extends({}, _state, {
_initial: valueFn(initialFn, _state),
_bounds: valueFn(bounds, _state)
});
}
/**
* The controller will keep track of the state for all gestures and also keep
* track of timeouts, and window listeners.
*/
var Controller = function Controller(classes) {
var _this = this;
this.classes = classes;
this.pointerIds = new Set(); // register Pointer Events pointerIds
this.touchIds = new Set(); // register Touch Events identifiers
this.supportsTouchEvents = supportsTouchEvents();
this.supportsGestureEvents = supportsGestureEvents();
this.bind = function () {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
var bindings = {};
for (var _iterator = _createForOfIteratorHelperLoose(_this.classes), _step; !(_step = _iterator()).done;) {
var RecognizerClass = _step.value;
new RecognizerClass(_this, args).addBindings(bindings);
} // // we also add event bindings for native handlers
var _loop = function _loop(eventKey) {
addBindings(bindings, eventKey, function (event) {
return _this.nativeRefs[eventKey](_extends({}, _this.state.shared, {
event: event,
args: args
}));
});
};
for (var eventKey in _this.nativeRefs) {
_loop(eventKey);
}
if (_this.config.domTarget) {
// If config.domTarget is set we add event listeners to it and return the clean function.
return updateDomListeners(_this, bindings);
} else {
// If not, we return an object that contains gesture handlers mapped to react handler event keys.
return getPropsListener(_this, bindings);
}
};
this.effect = function () {
if (_this.config.domTarget) _this.bind();
return _this.clean;
};
/**
* Function ran on component unmount: cleans timeouts and removes dom listeners set by the bind function.
*/
this.clean = function () {
var domTarget = getDomTargetFromConfig(_this.config);
var eventOptions = _this.config.eventOptions;
if (domTarget) removeListeners(domTarget, takeAll(_this.domListeners), eventOptions);
Object.values(_this.timeouts).forEach(clearTimeout);
clearAllWindowListeners(_this);
};
this.classes = classes;
this.state = getInitialState();
this.timeouts = {};
this.domListeners = [];
this.windowListeners = {};
};
function addEventIds(controller, event) {
if ('pointerId' in event) {
controller.pointerIds.add(event.pointerId);
} else {
controller.touchIds = new Set(getTouchIds(event));
}
}
function removeEventIds(controller, event) {
if ('pointerId' in event) {
controller.pointerIds["delete"](event.pointerId);
} else {
getTouchIds(event).forEach(function (id) {
return controller.touchIds["delete"](id);
});
}
}
function clearAllWindowListeners(controller) {
var _controller$config = controller.config,
el = _controller$config.window,
eventOptions = _controller$config.eventOptions,
windowListeners = controller.windowListeners;
if (!el) return;
for (var stateKey in windowListeners) {
var handlers = windowListeners[stateKey];
removeListeners(el, handlers, eventOptions);
}
controller.windowListeners = {};
}
function clearWindowListeners(_ref, stateKey, options) {
var config = _ref.config,
windowListeners = _ref.windowListeners;
if (options === void 0) {
options = config.eventOptions;
}
if (!config.window) return;
removeListeners(config.window, windowListeners[stateKey], options);
delete windowListeners[stateKey];
}
function updateWindowListeners(_ref2, stateKey, listeners, options) {
var config = _ref2.config,
windowListeners = _ref2.windowListeners;
if (listeners === void 0) {
listeners = [];
}
if (options === void 0) {
options = config.eventOptions;
}
if (!config.window) return;
removeListeners(config.window, windowListeners[stateKey], options);
addListeners(config.window, windowListeners[stateKey] = listeners, options);
}
function updateDomListeners(_ref3, bindings) {
var config = _ref3.config,
domListeners = _ref3.domListeners;
var domTarget = getDomTargetFromConfig(config);
if (!domTarget) throw new Error('domTarget must be defined');
var eventOptions = config.eventOptions;
removeListeners(domTarget, takeAll(domListeners), eventOptions);
for (var _i = 0, _Object$entries = Object.entries(bindings); _i < _Object$entries.length; _i++) {
var _Object$entries$_i = _Object$entries[_i],
key = _Object$entries$_i[0],
fns = _Object$entries$_i[1];
var name = key.slice(2).toLowerCase();
domListeners.push([name, chainFns.apply(void 0, fns)]);
}
addListeners(domTarget, domListeners, eventOptions);
}
function getPropsListener(_ref4, bindings) {
var config = _ref4.config;
var props = {};
var captureString = config.eventOptions.capture ? 'Capture' : '';
for (var _i2 = 0, _Object$entries2 = Object.entries(bindings); _i2 < _Object$entries2.length; _i2++) {
var _Object$entries2$_i = _Object$entries2[_i2],
event = _Object$entries2$_i[0],
fns = _Object$entries2$_i[1];
var fnsArray = Array.isArray(fns) ? fns : [fns];
var key = event + captureString;
props[key] = chainFns.apply(void 0, fnsArray);
}
return props;
}
function takeAll(array) {
if (array === void 0) {
array = [];
}
return array.splice(0, array.length);
}
function getDomTargetFromConfig(_ref5) {
var domTarget = _ref5.domTarget;
return domTarget && 'current' in domTarget ? domTarget.current : domTarget;
}
/**
* bindings is an object which keys match ReactEventHandlerKeys.
* Since a recognizer might want to bind a handler function to an event key already used by a previously
* added recognizer, we need to make sure that each event key is an array of all the functions mapped for
* that key.
*/
function addBindings(bindings, name, fn) {
if (!bindings[name]) bindings[name] = [];
bindings[name].push(fn);
}
function addListeners(el, listeners, options) {
if (listeners === void 0) {
listeners = [];
}
if (options === void 0) {
options = {};
}
for (var _iterator2 = _createForOfIteratorHelperLoose(listeners), _step2; !(_step2 = _iterator2()).done;) {
var _step2$value = _step2.value,
eventName = _step2$value[0],
eventHandler = _step2$value[1];
el.addEventListener(eventName, eventHandler, options);
}
}
function removeListeners(el, listeners, options) {
if (listeners === void 0) {
listeners = [];
}
if (options === void 0) {
options = {};
}
for (var _iterator3 = _createForOfIteratorHelperLoose(listeners), _step3; !(_step3 = _iterator3()).done;) {
var _step3$value = _step3.value,
eventName = _step3$value[0],
eventHandler = _step3$value[1];
el.removeEventListener(eventName, eventHandler, options);
}
}
/* eslint-disable react-hooks/exhaustive-deps */
/**
* Utility hook called by all gesture hooks and that will be responsible for the internals.
*
* @param handlers
* @param classes
* @param config
* @param nativeHandlers - native handlers such as onClick, onMouseDown, etc.
*/
function useRecognizers(handlers, config, nativeHandlers) {
if (nativeHandlers === void 0) {
nativeHandlers = {};
}
var classes = resolveClasses(handlers);
var controller = external_React_default.a.useMemo(function () {
return new Controller(classes);
}, []);
controller.config = config;
controller.handlers = handlers;
controller.nativeRefs = nativeHandlers;
external_React_default.a.useEffect(controller.effect, []); // @ts-ignore
if (controller.config.domTarget) return deprecationNoticeForDomTarget; // @ts-ignore
return controller.bind;
}
function deprecationNoticeForDomTarget() {
if (false) {}
}
function resolveClasses(internalHandlers) {
var classes = new Set();
if (internalHandlers.drag) classes.add(RecognizersMap.get('drag'));
if (internalHandlers.wheel) classes.add(RecognizersMap.get('wheel'));
if (internalHandlers.scroll) classes.add(RecognizersMap.get('scroll'));
if (internalHandlers.move) classes.add(RecognizersMap.get('move'));
if (internalHandlers.pinch) classes.add(RecognizersMap.get('pinch'));
if (internalHandlers.hover) classes.add(RecognizersMap.get('hover'));
return classes;
}
/**
* @private
* Abstract class for coordinates-based gesture recongizers
*/
var CoordinatesRecognizer = /*#__PURE__*/function (_Recognizer) {
reactusegesture_esm_inheritsLoose(CoordinatesRecognizer, _Recognizer);
function CoordinatesRecognizer() {
return _Recognizer.apply(this, arguments) || this;
}
var _proto = CoordinatesRecognizer.prototype;
/**
* Returns the real movement (without taking intentionality into account)
*/
_proto.getInternalMovement = function getInternalMovement(values, state) {
return subV(values, state.initial);
}
/**
* In coordinates-based gesture, this function will detect the first intentional axis,
* lock the gesture axis if lockDirection is specified in the config, block the gesture
* if the first intentional axis doesn't match the specified axis in config.
*/
;
_proto.checkIntentionality = function checkIntentionality(_intentional, _movement) {
if (_intentional[0] === false && _intentional[1] === false) {
return {
_intentional: _intentional,
axis: this.state.axis
};
}
var _movement$map = _movement.map(Math.abs),
absX = _movement$map[0],
absY = _movement$map[1];
var axis = this.state.axis || (absX > absY ? 'x' : absX < absY ? 'y' : undefined);
if (!this.config.axis && !this.config.lockDirection) return {
_intentional: _intentional,
_blocked: false,
axis: axis
};
if (!axis) return {
_intentional: [false, false],
_blocked: false,
axis: axis
};
if (!!this.config.axis && axis !== this.config.axis) return {
_intentional: _intentional,
_blocked: true,
axis: axis
};
_intentional[axis === 'x' ? 1 : 0] = false;
return {
_intentional: _intentional,
_blocked: false,
axis: axis
};
};
_proto.getKinematics = function getKinematics(values, event) {
var state = this.getMovement(values);
if (!state._blocked) {
var dt = event.timeStamp - this.state.timeStamp;
Object.assign(state, calculateAllKinematics(state.movement, state.delta, dt));
}
return state;
};
_proto.mapStateValues = function mapStateValues(state) {
return {
xy: state.values,
vxvy: state.velocities
};
};
return CoordinatesRecognizer;
}(Recognizer);
var TAP_DISTANCE_THRESHOLD = 3;
function persistEvent(event) {
'persist' in event && typeof event.persist === 'function' && event.persist();
}
var DragRecognizer = /*#__PURE__*/function (_CoordinatesRecognize) {
reactusegesture_esm_inheritsLoose(DragRecognizer, _CoordinatesRecognize);
function DragRecognizer() {
var _this;
_this = _CoordinatesRecognize.apply(this, arguments) || this;
_this.ingKey = 'dragging';
_this.stateKey = 'drag'; // TODO add back when setPointerCapture is widely wupported
// https://caniuse.com/#search=setPointerCapture
_this.setPointerCapture = function (event) {
// don't perform pointere capture when user wants to use touch events or
// when a pointerLockElement exists as this would throw an error
if (_this.config.useTouch || document.pointerLockElement) return;
var target = event.target,
pointerId = event.pointerId;
if (target && 'setPointerCapture' in target) {
// this would work in the DOM but doesn't with react three fiber
// target.addEventListener('pointermove', this.onDragChange, this.controller.config.eventOptions)
// @ts-expect-error
target.setPointerCapture(pointerId);
}
_this.updateGestureState({
_dragTarget: target,
_dragPointerId: pointerId
});
};
_this.releasePointerCapture = function () {
if (_this.config.useTouch || document.pointerLockElement) return;
var _this$state = _this.state,
_dragTarget = _this$state._dragTarget,
_dragPointerId = _this$state._dragPointerId;
if (_dragPointerId && _dragTarget && 'releasePointerCapture' in _dragTarget) {
// this would work in the DOM but doesn't with react three fiber
// target.removeEventListener('pointermove', this.onDragChange, this.controller.config.eventOptions)
if (!('hasPointerCapture' in _dragTarget) || _dragTarget.hasPointerCapture(_dragPointerId)) try {
_dragTarget.releasePointerCapture(_dragPointerId);
} catch (e) {}
}
};
_this.preventScroll = function (event) {
if (_this.state._dragPreventScroll && event.cancelable) {
event.preventDefault();
}
};
_this.getEventId = function (event) {
if (_this.config.useTouch) return event.changedTouches[0].identifier;
return event.pointerId;
};
_this.isValidEvent = function (event) {
// if we were using pointer events only event.isPrimary === 1 would suffice
return _this.state._pointerId === _this.getEventId(event);
};
_this.shouldPreventWindowScrollY = _this.config.experimental_preventWindowScrollY && _this.controller.supportsTouchEvents;
_this.setUpWindowScrollDetection = function (event) {
persistEvent(event); // we add window listeners that will prevent the scroll when the user has started dragging
updateWindowListeners(_this.controller, _this.stateKey, [['touchmove', _this.preventScroll], ['touchend', _this.clean.bind(_assertThisInitialized(_this))], ['touchcancel', _this.clean.bind(_assertThisInitialized(_this))]], {
passive: false
});
_this.setTimeout(_this.startDrag.bind(_assertThisInitialized(_this)), 250, event);
};
_this.setUpDelayedDragTrigger = function (event) {
_this.state._dragDelayed = true;
persistEvent(event);
_this.setTimeout(_this.startDrag.bind(_assertThisInitialized(_this)), _this.config.delay, event);
};
_this.setStartState = function (event) {
var values = getPointerEventValues(event, _this.transform);
_this.updateSharedState(getGenericEventData(event));
_this.updateGestureState(_extends({}, getStartGestureState(_assertThisInitialized(_this), values, event), getGenericPayload(_assertThisInitialized(_this), event, true), {
_pointerId: _this.getEventId(event)
}));
_this.updateGestureState(_this.getMovement(values));
};
_this.onDragStart = function (event) {
addEventIds(_this.controller, event);
if (!_this.enabled || _this.state._active) return;
_this.setStartState(event);
_this.setPointerCapture(event);
if (_this.shouldPreventWindowScrollY) _this.setUpWindowScrollDetection(event);else if (_this.config.delay > 0) _this.setUpDelayedDragTrigger(event);else _this.startDrag(event, true); // we pass the values to the startDrag event
};
_this.onDragChange = function (event) {
if ( // if the gesture was canceled or
_this.state.canceled || // if onDragStart wasn't fired or
!_this.state._active || // if the event pointerId doesn't match the one that initiated the drag
!_this.isValidEvent(event) || // if the event has the same timestamp as the previous event
// note that checking type equality is ONLY for tests ¯\_(ツ)_/¯
_this.state._lastEventType === event.type && event.timeStamp === _this.state.timeStamp) return;
var values;
if (document.pointerLockElement) {
var movementX = event.movementX,
movementY = event.movementY;
values = addV(_this.transform([movementX, movementY]), _this.state.values);
} else values = getPointerEventValues(event, _this.transform);
var kinematics = _this.getKinematics(values, event); // if startDrag hasn't fired
if (!_this.state._dragStarted) {
// If the gesture isn't active then respond to the event only if
// it's been delayed via the `delay` option, in which case start
// the gesture immediately.
if (_this.state._dragDelayed) {
_this.startDrag(event);
return;
} // if the user wants to prevent vertical window scroll when user starts dragging
if (_this.shouldPreventWindowScrollY) {
if (!_this.state._dragPreventScroll && kinematics.axis) {
// if the user is dragging horizontally then we should allow the drag
if (kinematics.axis === 'x') {
_this.startDrag(event);
} else {
_this.state._active = false;
return;
}
} else return;
} else return;
}
var genericEventData = getGenericEventData(event);
_this.updateSharedState(genericEventData);
var genericPayload = getGenericPayload(_assertThisInitialized(_this), event); // This verifies if the drag can be assimilated to a tap by checking
// if the real distance of the drag (ie not accounting for the threshold) is
// greater than the TAP_DISTANCE_THRESHOLD.
var realDistance = calculateDistance(kinematics._movement);
var _dragIsTap = _this.state._dragIsTap;
if (_dragIsTap && realDistance >= TAP_DISTANCE_THRESHOLD) _dragIsTap = false;
_this.updateGestureState(_extends({}, genericPayload, kinematics, {
_dragIsTap: _dragIsTap
}));
_this.fireGestureHandler();
};
_this.onDragEnd = function (event) {
removeEventIds(_this.controller, event); // if the event pointerId doesn't match the one that initiated the drag
// we don't want to end the drag
if (!_this.isValidEvent(event)) return;
_this.clean(); // if the gesture is no longer active (ie canceled)
// don't do anything
if (!_this.state._active) return;
_this.state._active = false;
var tap = _this.state._dragIsTap;
var _this$state$velocitie = _this.state.velocities,
vx = _this$state$velocitie[0],
vy = _this$state$velocitie[1];
var _this$state$movement = _this.state.movement,
mx = _this$state$movement[0],
my = _this$state$movement[1];
var _this$state$_intentio = _this.state._intentional,
ix = _this$state$_intentio[0],
iy = _this$state$_intentio[1];
var _this$config$swipeVel = _this.config.swipeVelocity,
svx = _this$config$swipeVel[0],
svy = _this$config$swipeVel[1];
var _this$config$swipeDis = _this.config.swipeDistance,
sx = _this$config$swipeDis[0],
sy = _this$config$swipeDis[1];
var sd = _this.config.swipeDuration;
var endState = _extends({}, getGenericPayload(_assertThisInitialized(_this), event), _this.getMovement(_this.state.values));
var swipe = [0, 0];
if (endState.elapsedTime < sd) {
if (ix !== false && Math.abs(vx) > svx && Math.abs(mx) > sx) swipe[0] = sign(vx);
if (iy !== false && Math.abs(vy) > svy && Math.abs(my) > sy) swipe[1] = sign(vy);
}
_this.updateSharedState({
buttons: 0
});
_this.updateGestureState(_extends({}, endState, {
tap: tap,
swipe: swipe
}));
_this.fireGestureHandler(_this.config.filterTaps && tap === true);
};
_this.clean = function () {
_CoordinatesRecognize.prototype.clean.call(_assertThisInitialized(_this));
_this.state._dragStarted = false;
_this.releasePointerCapture();
clearWindowListeners(_this.controller, _this.stateKey);
};
_this.onCancel = function () {
if (_this.state.canceled) return;
_this.updateGestureState({
canceled: true,
_active: false
});
_this.updateSharedState({
buttons: 0
});
setTimeout(function () {
return _this.fireGestureHandler();
}, 0);
};
_this.onClick = function (event) {
if (!_this.state._dragIsTap) event.stopPropagation();
};
return _this;
}
var _proto = DragRecognizer.prototype;
_proto.startDrag = function startDrag(event, onDragIsStart) {
if (onDragIsStart === void 0) {
onDragIsStart = false;
}
// startDrag can happen after a timeout, so we need to check if the gesture is still active
// as the user might have lift up the pointer in between.
if ( // if the gesture isn't active (probably means)
!this.state._active || // if the drag has already started we should ignore subsequent attempts
this.state._dragStarted) return;
if (!onDragIsStart) this.setStartState(event);
this.updateGestureState({
_dragStarted: true,
_dragPreventScroll: true,
cancel: this.onCancel
});
this.clearTimeout();
this.fireGestureHandler();
};
_proto.addBindings = function addBindings$1(bindings) {
if (this.config.useTouch) {
addBindings(bindings, 'onTouchStart', this.onDragStart);
addBindings(bindings, 'onTouchMove', this.onDragChange); // this is needed for react-three-fiber
addBindings(bindings, 'onTouchEnd', this.onDragEnd);
addBindings(bindings, 'onTouchCancel', this.onDragEnd);
} else {
addBindings(bindings, 'onPointerDown', this.onDragStart);
addBindings(bindings, 'onPointerMove', this.onDragChange); // this is needed for react-three-fiber
addBindings(bindings, 'onPointerUp', this.onDragEnd);
addBindings(bindings, 'onPointerCancel', this.onDragEnd);
}
if (this.config.filterTaps) {
var handler = this.controller.config.eventOptions.capture ? 'onClick' : 'onClickCapture';
addBindings(bindings, handler, this.onClick);
}
};
return DragRecognizer;
}(CoordinatesRecognizer);
/**
* Inlined from https://github.com/alexreardon/memoize-one
*/
function memoizeOne(resultFn, isEqual) {
var lastThis;
var lastArgs = [];
var lastResult;
var calledOnce = false;
function memoized() {
for (var _len = arguments.length, newArgs = new Array(_len), _key = 0; _key < _len; _key++) {
newArgs[_key] = arguments[_key];
}
if (calledOnce && lastThis === this && isEqual(newArgs, lastArgs)) {
return lastResult;
}
lastResult = resultFn.apply(this, newArgs);
calledOnce = true;
lastThis = this;
lastArgs = newArgs;
return lastResult;
}
return memoized;
}
/**
* Taken from https://github.com/FormidableLabs/react-fast-compare
*
* Dropped comments and ArrayBuffer handling
*/
function equal(a, b) {
if (a === b) return true;
if (a && b && typeof a == 'object' && typeof b == 'object') {
if (a.constructor !== b.constructor) return false;
var length, i, keys;
if (Array.isArray(a)) {
length = a.length;
if (length !== b.length) return false;
for (i = length; i-- !== 0;) {
if (!equal(a[i], b[i])) return false;
}
return true;
}
var it;
if (typeof Map === 'function' && a instanceof Map && b instanceof Map) {
if (a.size !== b.size) return false;
it = a.entries();
while (!(i = it.next()).done) {
if (!b.has(i.value[0])) return false;
}
it = a.entries();
while (!(i = it.next()).done) {
if (!equal(i.value[1], b.get(i.value[0]))) return false;
}
return true;
}
if (typeof Set === 'function' && a instanceof Set && b instanceof Set) {
if (a.size !== b.size) return false;
it = a.entries();
while (!(i = it.next()).done) {
if (!b.has(i.value[0])) return false;
}
return true;
}
if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;
if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();
if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();
keys = Object.keys(a);
length = keys.length;
if (length !== Object.keys(b).length) return false;
for (i = length; i-- !== 0;) {
if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;
}
if (typeof Element !== 'undefined' && a instanceof Element) return false;
for (i = length; i-- !== 0;) {
if (keys[i] === '_owner' && a.$$typeof) continue;
if (!equal(a[keys[i]], b[keys[i]])) return false;
}
return true;
} // true if both NaN, false otherwise — NaN !== NaN → true
// eslint-disable-next-line no-self-compare
return a !== a && b !== b;
}
function isEqual(a, b) {
try {
return equal(a, b);
} catch (error) {
if ((error.message || '').match(/stack|recursion/i)) {
// eslint-disable-next-line no-console
console.warn('react-fast-compare cannot handle circular refs');
return false;
}
throw error;
}
}
/**
* Drag hook.
*
* @param handler - the function fired every time the drag gesture updates
* @param [config={}] - the config object including generic options and drag options
*/
function useDrag(handler, config) {
if (config === void 0) {
config = {};
}
RecognizersMap.set('drag', DragRecognizer);
var buildDragConfig = Object(external_React_["useRef"])();
if (!buildDragConfig.current) {
buildDragConfig.current = memoizeOne(_buildDragConfig, isEqual);
}
return useRecognizers({
drag: handler
}, buildDragConfig.current(config));
}
/**
* @private
* Abstract class for distance/angle-based gesture recongizers
*/
var DistanceAngleRecognizer = /*#__PURE__*/function (_Recognizer) {
reactusegesture_esm_inheritsLoose(DistanceAngleRecognizer, _Recognizer);
function DistanceAngleRecognizer() {
return _Recognizer.apply(this, arguments) || this;
}
var _proto = DistanceAngleRecognizer.prototype;
_proto.getInternalMovement = function getInternalMovement(values, state) {
var prev_a = state.values[1]; // not be defined if ctrl+wheel is used for zoom only
var d = values[0],
_values$ = values[1],
a = _values$ === void 0 ? prev_a : _values$;
var delta_a = a - prev_a;
var next_turns = state.turns;
if (Math.abs(delta_a) > 270) next_turns += sign(delta_a);
return subV([d, a - 360 * next_turns], state.initial);
};
_proto.getKinematics = function getKinematics(values, event) {
var state = this.getMovement(values);
var turns = (values[1] - state._movement[1] - this.state.initial[1]) / 360;
var dt = event.timeStamp - this.state.timeStamp;
var _calculateAllKinemati = calculateAllKinematics(state.movement, state.delta, dt),
kinematics = _objectWithoutPropertiesLoose(_calculateAllKinemati, ["distance", "velocity"]);
return _extends({
turns: turns
}, state, kinematics);
};
_proto.mapStateValues = function mapStateValues(state) {
return {
da: state.values,
vdva: state.velocities
};
};
return DistanceAngleRecognizer;
}(Recognizer);
var ZOOM_CONSTANT = 7;
var WEBKIT_DISTANCE_SCALE_FACTOR = 260;
var PinchRecognizer = /*#__PURE__*/function (_DistanceAngleRecogni) {
reactusegesture_esm_inheritsLoose(PinchRecognizer, _DistanceAngleRecogni);
function PinchRecognizer() {
var _this;
_this = _DistanceAngleRecogni.apply(this, arguments) || this;
_this.ingKey = 'pinching';
_this.stateKey = 'pinch';
_this.onPinchStart = function (event) {
addEventIds(_this.controller, event);
var touchIds = _this.controller.touchIds;
if (!_this.enabled) return;
if (_this.state._active) {
// check that the pointerIds that initiated the gesture
// are still enabled. This is useful for when the page
// loses track of the pointers (minifying gesture on iPad).
if (_this.state._pointerIds.every(function (id) {
return touchIds.has(id);
})) return; // something was wrong with the pointers but we let it go.
} // until we reach two fingers on the target don't react
if (touchIds.size < 2) return;
var _pointerIds = Array.from(touchIds).slice(0, 2);
var _getTwoTouchesEventVa = getTwoTouchesEventValues(event, _pointerIds, _this.transform),
values = _getTwoTouchesEventVa.values,
origin = _getTwoTouchesEventVa.origin;
_this.updateSharedState(getGenericEventData(event));
_this.updateGestureState(_extends({}, getStartGestureState(_assertThisInitialized(_this), values, event), getGenericPayload(_assertThisInitialized(_this), event, true), {
_pointerIds: _pointerIds,
cancel: _this.onCancel,
origin: origin
}));
_this.updateGestureState(_this.getMovement(values));
_this.fireGestureHandler();
};
_this.onPinchChange = function (event) {
var _this$state = _this.state,
canceled = _this$state.canceled,
_active = _this$state._active;
if (canceled || !_active || // if the event has the same timestamp as the previous event
event.timeStamp === _this.state.timeStamp) return;
var genericEventData = getGenericEventData(event);
_this.updateSharedState(genericEventData);
try {
var _getTwoTouchesEventVa2 = getTwoTouchesEventValues(event, _this.state._pointerIds, _this.transform),
values = _getTwoTouchesEventVa2.values,
origin = _getTwoTouchesEventVa2.origin;
var kinematics = _this.getKinematics(values, event);
_this.updateGestureState(_extends({}, getGenericPayload(_assertThisInitialized(_this), event), kinematics, {
origin: origin
}));
_this.fireGestureHandler();
} catch (e) {
_this.onPinchEnd(event);
}
};
_this.onPinchEnd = function (event) {
removeEventIds(_this.controller, event);
var pointerIds = getTouchIds(event); // if none of the lifted pointerIds is in the state pointerIds don't do anything
if (_this.state._pointerIds.every(function (id) {
return !pointerIds.includes(id);
})) return;
_this.clean();
if (!_this.state._active) return;
_this.updateGestureState(_extends({}, getGenericPayload(_assertThisInitialized(_this), event), _this.getMovement(_this.state.values), {
_active: false
}));
_this.fireGestureHandler();
};
_this.onCancel = function () {
if (_this.state.canceled) return;
_this.updateGestureState({
_active: false,
canceled: true
});
setTimeout(function () {
return _this.fireGestureHandler();
}, 0);
};
/**
* PINCH WITH WEBKIT GESTURES
*/
_this.onGestureStart = function (event) {
if (!_this.enabled) return;
event.preventDefault();
var values = getWebkitGestureEventValues(event, _this.transform);
_this.updateSharedState(getGenericEventData(event));
_this.updateGestureState(_extends({}, getStartGestureState(_assertThisInitialized(_this), values, event), getGenericPayload(_assertThisInitialized(_this), event, true), {
origin: [event.clientX, event.clientY],
cancel: _this.onCancel
}));
_this.updateGestureState(_this.getMovement(values));
_this.fireGestureHandler();
};
_this.onGestureChange = function (event) {
var _this$state2 = _this.state,
canceled = _this$state2.canceled,
_active = _this$state2._active;
if (canceled || !_active) return;
event.preventDefault();
var genericEventData = getGenericEventData(event);
_this.updateSharedState(genericEventData); // this normalizes the values of the Safari's WebKitEvent by calculating
// the delta and then multiplying it by a constant.
var values = getWebkitGestureEventValues(event, _this.transform);
values[0] = (values[0] - _this.state.event.scale) * WEBKIT_DISTANCE_SCALE_FACTOR + _this.state.values[0];
var kinematics = _this.getKinematics(values, event);
_this.updateGestureState(_extends({}, getGenericPayload(_assertThisInitialized(_this), event), kinematics, {
origin: [event.clientX, event.clientY]
}));
_this.fireGestureHandler();
};
_this.onGestureEnd = function (event) {
_this.clean();
if (!_this.state._active) return;
_this.updateGestureState(_extends({}, getGenericPayload(_assertThisInitialized(_this), event), _this.getMovement(_this.state.values), {
_active: false,
origin: [event.clientX, event.clientY]
}));
_this.fireGestureHandler();
};
/**
* PINCH WITH WHEEL
*/
_this.wheelShouldRun = function (event) {
return _this.enabled && event.ctrlKey;
};
_this.getWheelValuesFromEvent = function (event) {
var _getWheelEventValues = getWheelEventValues(event, _this.transform),
delta_d = _getWheelEventValues[1];
var _this$state$values = _this.state.values,
prev_d = _this$state$values[0],
prev_a = _this$state$values[1]; // ZOOM_CONSTANT is based on Safari trackpad natural zooming
var _delta_d = -delta_d * ZOOM_CONSTANT; // new distance is the previous state distance added to the delta
var d = prev_d + _delta_d;
var a = prev_a !== void 0 ? prev_a : 0;
return {
values: [d, a],
origin: [event.clientX, event.clientY],
delta: [_delta_d, a]
};
};
_this.onWheel = function (event) {
if (!_this.wheelShouldRun(event)) return;
_this.setTimeout(_this.onWheelEnd);
if (!_this.state._active) _this.onWheelStart(event);else _this.onWheelChange(event);
};
_this.onWheelStart = function (event) {
var _this$getWheelValuesF = _this.getWheelValuesFromEvent(event),
values = _this$getWheelValuesF.values,
delta = _this$getWheelValuesF.delta,
origin = _this$getWheelValuesF.origin;
if (event.cancelable) event.preventDefault();else if (false) {}
_this.updateSharedState(getGenericEventData(event));
_this.updateGestureState(_extends({}, getStartGestureState(_assertThisInitialized(_this), values, event, _this.state.values), getGenericPayload(_assertThisInitialized(_this), event, true), {
offset: values,
delta: delta,
origin: origin
}));
_this.updateGestureState(_this.getMovement(values));
_this.fireGestureHandler();
};
_this.onWheelChange = function (event) {
if (event.cancelable) event.preventDefault();
_this.updateSharedState(getGenericEventData(event));
var _this$getWheelValuesF2 = _this.getWheelValuesFromEvent(event),
values = _this$getWheelValuesF2.values,
origin = _this$getWheelValuesF2.origin,
delta = _this$getWheelValuesF2.delta;
_this.updateGestureState(_extends({}, getGenericPayload(_assertThisInitialized(_this), event), _this.getKinematics(values, event), {
origin: origin,
delta: delta
}));
_this.fireGestureHandler();
};
_this.onWheelEnd = function () {
_this.clean();
if (!_this.state._active) return;
_this.state._active = false;
_this.updateGestureState(_this.getMovement(_this.state.values));
_this.fireGestureHandler();
};
return _this;
}
var _proto = PinchRecognizer.prototype;
_proto.addBindings = function addBindings$1(bindings) {
// Only try to use gesture events when they are supported and domTarget is set
// as React doesn't support gesture handlers.
if (this.controller.config.domTarget && !this.controller.supportsTouchEvents && this.controller.supportsGestureEvents) {
addBindings(bindings, 'onGestureStart', this.onGestureStart);
addBindings(bindings, 'onGestureChange', this.onGestureChange);
addBindings(bindings, 'onGestureEnd', this.onGestureEnd);
} else {
addBindings(bindings, 'onTouchStart', this.onPinchStart);
addBindings(bindings, 'onTouchMove', this.onPinchChange);
addBindings(bindings, 'onTouchEnd', this.onPinchEnd);
addBindings(bindings, 'onTouchCancel', this.onPinchEnd);
addBindings(bindings, 'onWheel', this.onWheel);
}
};
return PinchRecognizer;
}(DistanceAngleRecognizer);
/**
* Pinch hook.
*
* @param handler - the function fired every time the pinch gesture updates
* @param [config={}] - the config object including generic options and pinch options
*/
function usePinch(handler, config) {
if (config === void 0) {
config = {};
}
RecognizersMap.set('pinch', PinchRecognizer);
var buildPinchConfig = Object(external_React_["useRef"])();
if (!buildPinchConfig.current) {
buildPinchConfig.current = memoizeOne(_buildPinchConfig, isEqual);
}
return useRecognizers({
pinch: handler
}, buildPinchConfig.current(config));
}
var WheelRecognizer = /*#__PURE__*/function (_CoordinatesRecognize) {
reactusegesture_esm_inheritsLoose(WheelRecognizer, _CoordinatesRecognize);
function WheelRecognizer() {
var _this;
_this = _CoordinatesRecognize.apply(this, arguments) || this;
_this.ingKey = 'wheeling';
_this.stateKey = 'wheel';
_this.debounced = true;
_this.handleEvent = function (event) {
if (event.ctrlKey && 'pinch' in _this.controller.handlers) return;
if (!_this.enabled) return;
_this.setTimeout(_this.onEnd);
_this.updateSharedState(getGenericEventData(event));
var values = addV(getWheelEventValues(event, _this.transform), _this.state.values);
if (!_this.state._active) {
_this.updateGestureState(_extends({}, getStartGestureState(_assertThisInitialized(_this), values, event, _this.state.values), getGenericPayload(_assertThisInitialized(_this), event, true)));
var movement = _this.getMovement(values);
var geometry = calculateAllGeometry(movement.delta);
_this.updateGestureState(movement);
_this.updateGestureState(geometry);
} else {
_this.updateGestureState(_extends({}, getGenericPayload(_assertThisInitialized(_this), event), _this.getKinematics(values, event)));
}
_this.fireGestureHandler();
};
_this.onEnd = function () {
_this.clean();
if (!_this.state._active) return;
var movement = _this.getMovement(_this.state.values);
_this.updateGestureState(movement);
_this.updateGestureState({
_active: false,
velocities: [0, 0],
velocity: 0
});
_this.fireGestureHandler();
};
return _this;
}
var _proto = WheelRecognizer.prototype;
_proto.addBindings = function addBindings$1(bindings) {
addBindings(bindings, 'onWheel', this.handleEvent);
};
return WheelRecognizer;
}(CoordinatesRecognizer);
/**
* Wheel hook.
*
* @param handler - the function fired every time the wheel gesture updates
* @param the config object including generic options and wheel options
*/
function useWheel(handler, config) {
if (config === void 0) {
config = {};
}
RecognizersMap.set('wheel', WheelRecognizer);
var buildWheelConfig = Object(external_React_["useRef"])();
if (!buildWheelConfig.current) {
buildWheelConfig.current = memoizeOne(_buildWheelConfig, isEqual);
}
return useRecognizers({
wheel: handler
}, buildWheelConfig.current(config));
}
var MoveRecognizer = /*#__PURE__*/function (_CoordinatesRecognize) {
reactusegesture_esm_inheritsLoose(MoveRecognizer, _CoordinatesRecognize);
function MoveRecognizer() {
var _this;
_this = _CoordinatesRecognize.apply(this, arguments) || this;
_this.ingKey = 'moving';
_this.stateKey = 'move';
_this.debounced = true;
_this.onMove = function (event) {
if (!_this.enabled) return;
_this.setTimeout(_this.onMoveEnd);
if (!_this.state._active) _this.onMoveStart(event);else _this.onMoveChange(event);
};
_this.onMoveStart = function (event) {
_this.updateSharedState(getGenericEventData(event));
var values = getPointerEventValues(event, _this.transform);
_this.updateGestureState(_extends({}, getStartGestureState(_assertThisInitialized(_this), values, event), getGenericPayload(_assertThisInitialized(_this), event, true)));
_this.updateGestureState(_this.getMovement(values));
_this.fireGestureHandler();
};
_this.onMoveChange = function (event) {
_this.updateSharedState(getGenericEventData(event));
var values = getPointerEventValues(event, _this.transform);
_this.updateGestureState(_extends({}, getGenericPayload(_assertThisInitialized(_this), event), _this.getKinematics(values, event)));
_this.fireGestureHandler();
};
_this.onMoveEnd = function () {
_this.clean();
if (!_this.state._active) return;
var values = _this.state.values;
_this.updateGestureState(_this.getMovement(values));
_this.updateGestureState({
velocities: [0, 0],
velocity: 0,
_active: false
});
_this.fireGestureHandler();
};
_this.hoverTransform = function () {
return _this.controller.config.hover.transform || _this.controller.config.transform;
};
_this.onPointerEnter = function (event) {
_this.controller.state.shared.hovering = true;
if (!_this.controller.config.enabled) return;
if (_this.controller.config.hover.enabled) {
var values = getPointerEventValues(event, _this.hoverTransform());
var state = _extends({}, _this.controller.state.shared, _this.state, getGenericPayload(_assertThisInitialized(_this), event, true), {
args: _this.args,
values: values,
active: true,
hovering: true
});
_this.controller.handlers.hover(_extends({}, state, _this.mapStateValues(state)));
}
if ('move' in _this.controller.handlers) _this.onMoveStart(event);
};
_this.onPointerLeave = function (event) {
_this.controller.state.shared.hovering = false;
if ('move' in _this.controller.handlers) _this.onMoveEnd();
if (!_this.controller.config.hover.enabled) return;
var values = getPointerEventValues(event, _this.hoverTransform());
var state = _extends({}, _this.controller.state.shared, _this.state, getGenericPayload(_assertThisInitialized(_this), event), {
args: _this.args,
values: values,
active: false
});
_this.controller.handlers.hover(_extends({}, state, _this.mapStateValues(state)));
};
return _this;
}
var _proto = MoveRecognizer.prototype;
_proto.addBindings = function addBindings$1(bindings) {
if ('move' in this.controller.handlers) {
addBindings(bindings, 'onPointerMove', this.onMove);
}
if ('hover' in this.controller.handlers) {
addBindings(bindings, 'onPointerEnter', this.onPointerEnter);
addBindings(bindings, 'onPointerLeave', this.onPointerLeave);
}
};
return MoveRecognizer;
}(CoordinatesRecognizer);
/**
* Move hook.
*
* @param handler - the function fired every time the move gesture updates
* @param [config={}] - the config object including generic options and move options
*/
function useMove(handler, config) {
if (config === void 0) {
config = {};
}
RecognizersMap.set('move', MoveRecognizer);
var buildMoveConfig = Object(external_React_["useRef"])();
if (!buildMoveConfig.current) {
buildMoveConfig.current = memoizeOne(_buildMoveConfig, isEqual);
}
return useRecognizers({
move: handler
}, buildMoveConfig.current(config));
}
/**
* Hover hook.
*
* @param handler - the function fired every time the hover gesture updates
* @param [config={}] - the config object including generic options and hover options
*/
function useHover(handler, config) {
if (config === void 0) {
config = {};
}
RecognizersMap.set('hover', MoveRecognizer);
var buildHoverConfig = Object(external_React_["useRef"])();
if (!buildHoverConfig.current) {
buildHoverConfig.current = memoizeOne(_buildHoverConfig, isEqual);
}
return useRecognizers({
hover: handler
}, buildHoverConfig.current(config));
}
var ScrollRecognizer = /*#__PURE__*/function (_CoordinatesRecognize) {
reactusegesture_esm_inheritsLoose(ScrollRecognizer, _CoordinatesRecognize);
function ScrollRecognizer() {
var _this;
_this = _CoordinatesRecognize.apply(this, arguments) || this;
_this.ingKey = 'scrolling';
_this.stateKey = 'scroll';
_this.debounced = true;
_this.handleEvent = function (event) {
if (!_this.enabled) return;
_this.clearTimeout();
_this.setTimeout(_this.onEnd);
var values = getScrollEventValues(event, _this.transform);
_this.updateSharedState(getGenericEventData(event));
if (!_this.state._active) {
_this.updateGestureState(_extends({}, getStartGestureState(_assertThisInitialized(_this), values, event, _this.state.values), getGenericPayload(_assertThisInitialized(_this), event, true)));
var movementDetection = _this.getMovement(values);
var geometry = calculateAllGeometry(movementDetection.delta);
_this.updateGestureState(movementDetection);
_this.updateGestureState(geometry);
} else {
_this.updateGestureState(_extends({}, getGenericPayload(_assertThisInitialized(_this), event), _this.getKinematics(values, event)));
}
_this.fireGestureHandler();
};
_this.onEnd = function () {
_this.clean();
if (!_this.state._active) return;
_this.updateGestureState(_extends({}, _this.getMovement(_this.state.values), {
_active: false,
velocities: [0, 0],
velocity: 0
}));
_this.fireGestureHandler();
};
return _this;
}
var _proto = ScrollRecognizer.prototype;
_proto.addBindings = function addBindings$1(bindings) {
addBindings(bindings, 'onScroll', this.handleEvent);
};
return ScrollRecognizer;
}(CoordinatesRecognizer);
/**
* Scroll hook.
*
* @param handler - the function fired every time the scroll gesture updates
* @param [config={}] - the config object including generic options and scroll options
*/
function useScroll(handler, config) {
if (config === void 0) {
config = {};
}
RecognizersMap.set('scroll', ScrollRecognizer);
var buildScrollConfig = Object(external_React_["useRef"])();
if (!buildScrollConfig.current) {
buildScrollConfig.current = memoizeOne(_buildScrollConfig, isEqual);
}
return useRecognizers({
scroll: handler
}, buildScrollConfig.current(config));
}
var RE_NOT_NATIVE = /^on(Drag|Wheel|Scroll|Move|Pinch|Hover)/;
function sortHandlers(handlers) {
var _native = {};
var handle = {};
var actions = new Set();
for (var key in handlers) {
if (RE_NOT_NATIVE.test(key)) {
actions.add(RegExp.lastMatch);
handle[key] = handlers[key];
} else {
_native[key] = handlers[key];
}
}
return [handle, _native, actions];
}
/**
* @public
*
* The most complete gesture hook, allowing support for multiple gestures.
*
* @param {Handlers} handlers - an object with on[Gesture] keys containg gesture handlers
* @param {UseGestureConfig} [config={}] - the full config object
* @returns {(...args: any[]) => HookReturnType}
*/
function useGesture(_handlers, config) {
if (config === void 0) {
config = {};
}
var _sortHandlers = sortHandlers(_handlers),
handlers = _sortHandlers[0],
nativeHandlers = _sortHandlers[1],
actions = _sortHandlers[2];
RecognizersMap.set('drag', DragRecognizer);
RecognizersMap.set('hover', MoveRecognizer);
RecognizersMap.set('move', MoveRecognizer);
RecognizersMap.set('pinch', PinchRecognizer);
RecognizersMap.set('scroll', ScrollRecognizer);
RecognizersMap.set('wheel', WheelRecognizer);
var mergedConfig = buildComplexConfig(config, actions);
var internalHandlers = {};
if (actions.has('onDrag')) internalHandlers.drag = includeStartEndHandlers(handlers, 'onDrag');
if (actions.has('onWheel')) internalHandlers.wheel = includeStartEndHandlers(handlers, 'onWheel');
if (actions.has('onScroll')) internalHandlers.scroll = includeStartEndHandlers(handlers, 'onScroll');
if (actions.has('onMove')) internalHandlers.move = includeStartEndHandlers(handlers, 'onMove');
if (actions.has('onPinch')) internalHandlers.pinch = includeStartEndHandlers(handlers, 'onPinch');
if (actions.has('onHover')) internalHandlers.hover = handlers.onHover;
return useRecognizers(internalHandlers, mergedConfig, nativeHandlers);
}
function includeStartEndHandlers(handlers, handlerKey) {
var startKey = handlerKey + 'Start';
var endKey = handlerKey + 'End';
var fn = function fn(state) {
var memo = undefined;
if (state.first && startKey in handlers) handlers[startKey](state);
if (handlerKey in handlers) memo = handlers[handlerKey](state);
if (state.last && endKey in handlers) handlers[endKey](state);
return memo;
};
return fn;
}
// EXTERNAL MODULE: external ["wp","keycodes"]
var external_wp_keycodes_ = __webpack_require__("RxS6");
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/input-control/utils.js
/**
* WordPress dependencies
*/
/**
* Gets a CSS cursor value based on a drag direction.
*
* @param {string} dragDirection The drag direction.
* @return {string} The CSS cursor value.
*/
function getDragCursor(dragDirection) {
let dragCursor = 'ns-resize';
switch (dragDirection) {
case 'n':
case 's':
dragCursor = 'ns-resize';
break;
case 'e':
case 'w':
dragCursor = 'ew-resize';
break;
}
return dragCursor;
}
/**
* Custom hook that renders a drag cursor when dragging.
*
* @param {boolean} isDragging The dragging state.
* @param {string} dragDirection The drag direction.
*
* @return {string} The CSS cursor value.
*/
function useDragCursor(isDragging, dragDirection) {
const dragCursor = getDragCursor(dragDirection);
Object(external_wp_element_["useEffect"])(() => {
if (isDragging) {
document.documentElement.style.cursor = dragCursor;
} else {
document.documentElement.style.cursor = null;
}
}, [isDragging]);
return dragCursor;
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/input-control/state.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
const initialStateReducer = state => state;
const initialInputControlState = {
_event: {},
error: null,
initialValue: '',
isDirty: false,
isDragEnabled: false,
isDragging: false,
isPressEnterToChange: false,
value: ''
};
const actionTypes = {
CHANGE: 'CHANGE',
COMMIT: 'COMMIT',
DRAG_END: 'DRAG_END',
DRAG_START: 'DRAG_START',
DRAG: 'DRAG',
INVALIDATE: 'INVALIDATE',
PRESS_DOWN: 'PRESS_DOWN',
PRESS_ENTER: 'PRESS_ENTER',
PRESS_UP: 'PRESS_UP',
RESET: 'RESET',
UPDATE: 'UPDATE'
};
const inputControlActionTypes = actionTypes;
/**
* Prepares initialState for the reducer.
*
* @param {Object} initialState The initial state.
* @return {Object} Prepared initialState for the reducer
*/
function mergeInitialState(initialState = initialInputControlState) {
const {
value
} = initialState;
return { ...initialInputControlState,
...initialState,
initialValue: value
};
}
/**
* Composes multiple stateReducers into a single stateReducer, building
* the pipeline to control the flow for state and actions.
*
* @param {...Function} fns State reducers.
* @return {Function} The single composed stateReducer.
*/
const composeStateReducers = (...fns) => {
return (...args) => {
return fns.reduceRight((state, fn) => {
const fnState = fn(...args);
return Object(external_lodash_["isEmpty"])(fnState) ? state : { ...state,
...fnState
};
}, {});
};
};
/**
* Creates a reducer that opens the channel for external state subscription
* and modification.
*
* This technique uses the "stateReducer" design pattern:
* https://kentcdodds.com/blog/the-state-reducer-pattern/
*
* @param {Function} composedStateReducers A custom reducer that can subscribe and modify state.
* @return {Function} The reducer.
*/
function inputControlStateReducer(composedStateReducers) {
return (state, action) => {
const nextState = { ...state
};
const {
type,
payload
} = action;
switch (type) {
/**
* Keyboard events
*/
case actionTypes.PRESS_UP:
nextState.isDirty = false;
break;
case actionTypes.PRESS_DOWN:
nextState.isDirty = false;
break;
/**
* Drag events
*/
case actionTypes.DRAG_START:
nextState.isDragging = true;
break;
case actionTypes.DRAG_END:
nextState.isDragging = false;
break;
/**
* Input events
*/
case actionTypes.CHANGE:
nextState.error = null;
nextState.value = payload.value;
if (state.isPressEnterToChange) {
nextState.isDirty = true;
}
break;
case actionTypes.COMMIT:
nextState.value = payload.value;
nextState.isDirty = false;
break;
case actionTypes.RESET:
nextState.error = null;
nextState.isDirty = false;
nextState.value = payload.value || state.initialValue;
break;
case actionTypes.UPDATE:
nextState.value = payload.value;
nextState.isDirty = false;
break;
/**
* Validation
*/
case actionTypes.INVALIDATE:
nextState.error = payload.error;
break;
}
if (payload.event) {
nextState._event = payload.event;
}
/**
* Send the nextState + action to the composedReducers via
* this "bridge" mechanism. This allows external stateReducers
* to hook into actions, and modify state if needed.
*/
return composedStateReducers(nextState, action);
};
}
/**
* A custom hook that connects and external stateReducer with an internal
* reducer. This hook manages the internal state of InputControl.
* However, by connecting an external stateReducer function, other
* components can react to actions as well as modify state before it is
* applied.
*
* This technique uses the "stateReducer" design pattern:
* https://kentcdodds.com/blog/the-state-reducer-pattern/
*
* @param {Function} stateReducer An external state reducer.
* @param {Object} initialState The initial state for the reducer.
* @return {Object} State, dispatch, and a collection of actions.
*/
function useInputControlStateReducer(stateReducer = initialStateReducer, initialState = initialInputControlState) {
const [state, dispatch] = Object(external_wp_element_["useReducer"])(inputControlStateReducer(stateReducer), mergeInitialState(initialState));
const createChangeEvent = type => (nextValue, event) => {
/**
* Persist allows for the (Synthetic) event to be used outside of
* this function call.
* https://reactjs.org/docs/events.html#event-pooling
*/
if (event && event.persist) {
event.persist();
}
dispatch({
type,
payload: {
value: nextValue,
event
}
});
};
const createKeyEvent = type => event => {
/**
* Persist allows for the (Synthetic) event to be used outside of
* this function call.
* https://reactjs.org/docs/events.html#event-pooling
*/
if (event && event.persist) {
event.persist();
}
dispatch({
type,
payload: {
event
}
});
};
const createDragEvent = type => dragProps => {
dispatch({
type,
payload: dragProps
});
};
/**
* Actions for the reducer
*/
const change = createChangeEvent(actionTypes.CHANGE);
const invalidate = createChangeEvent(actionTypes.INVALIDATE);
const reset = createChangeEvent(actionTypes.RESET);
const commit = createChangeEvent(actionTypes.COMMIT);
const update = createChangeEvent(actionTypes.UPDATE);
const dragStart = createDragEvent(actionTypes.DRAG_START);
const drag = createDragEvent(actionTypes.DRAG);
const dragEnd = createDragEvent(actionTypes.DRAG_END);
const pressUp = createKeyEvent(actionTypes.PRESS_UP);
const pressDown = createKeyEvent(actionTypes.PRESS_DOWN);
const pressEnter = createKeyEvent(actionTypes.PRESS_ENTER);
return {
change,
commit,
dispatch,
drag,
dragEnd,
dragStart,
invalidate,
pressDown,
pressEnter,
pressUp,
reset,
state,
update
};
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/utils/values.js
/* eslint-disable jsdoc/valid-types */
/**
* Determines if a value is null or undefined.
*
* @template T
*
* @param {T | null | undefined} value The value to check.
* @return {value is T} Whether value is not null or undefined.
*/
function isValueDefined(value) {
return value !== undefined && value !== null;
}
/* eslint-enable jsdoc/valid-types */
/* eslint-disable jsdoc/valid-types */
/**
* Determines if a value is empty, null, or undefined.
*
* @template T
*
* @param {T | "" | null | undefined} value The value to check.
* @return {value is T} Whether value is empty.
*/
function isValueEmpty(value) {
const isEmptyString = value === '';
return !isValueDefined(value) || isEmptyString;
}
/* eslint-enable jsdoc/valid-types */
/**
* Get the first defined/non-null value from an array.
*
* @template T
*
* @param {Array} values Values to derive from.
* @param {T} fallbackValue Fallback value if there are no defined values.
* @return {T} A defined value or the fallback value.
*/
function getDefinedValue(values = [], fallbackValue) {
var _values$find;
return (_values$find = values.find(isValueDefined)) !== null && _values$find !== void 0 ? _values$find : fallbackValue;
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/utils/hooks/use-update-effect.js
/**
* WordPress dependencies
*/
/**
* A `React.useEffect` that will not run on the first render.
* Source:
* https://github.com/reakit/reakit/blob/HEAD/packages/reakit-utils/src/useUpdateEffect.ts
*
* @param {import('react').EffectCallback} effect
* @param {import('react').DependencyList} deps
*/
function useUpdateEffect(effect, deps) {
const mounted = Object(external_wp_element_["useRef"])(false);
Object(external_wp_element_["useEffect"])(() => {
if (mounted.current) {
return effect();
}
mounted.current = true;
return undefined;
}, deps);
}
/* harmony default export */ var use_update_effect = (useUpdateEffect);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/input-control/input-field.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function InputField({
disabled = false,
dragDirection = 'n',
dragThreshold = 10,
id,
isDragEnabled = false,
isFocused,
isPressEnterToChange = false,
onBlur = external_lodash_["noop"],
onChange = external_lodash_["noop"],
onDrag = external_lodash_["noop"],
onDragEnd = external_lodash_["noop"],
onDragStart = external_lodash_["noop"],
onFocus = external_lodash_["noop"],
onKeyDown = external_lodash_["noop"],
onValidate = external_lodash_["noop"],
size = 'default',
setIsFocused,
stateReducer = state => state,
value: valueProp,
type,
...props
}, ref) {
const {
// State
state,
// Actions
change,
commit,
drag,
dragEnd,
dragStart,
invalidate,
pressDown,
pressEnter,
pressUp,
reset,
update
} = useInputControlStateReducer(stateReducer, {
isDragEnabled,
value: valueProp,
isPressEnterToChange
});
const {
_event,
value,
isDragging,
isDirty
} = state;
const wasDirtyOnBlur = Object(external_wp_element_["useRef"])(false);
const dragCursor = useDragCursor(isDragging, dragDirection);
/*
* Handles synchronization of external and internal value state.
* If not focused and did not hold a dirty value[1] on blur
* updates the value from the props. Otherwise if not holding
* a dirty value[1] propagates the value and event through onChange.
* [1] value is only made dirty if isPressEnterToChange is true
*/
use_update_effect(() => {
if (valueProp === value) {
return;
}
if (!isFocused && !wasDirtyOnBlur.current) {
update(valueProp);
} else if (!isDirty) {
onChange(value, {
event: _event
});
wasDirtyOnBlur.current = false;
}
}, [value, isDirty, isFocused, valueProp]);
const handleOnBlur = event => {
onBlur(event);
setIsFocused(false);
/**
* If isPressEnterToChange is set, this commits the value to
* the onChange callback.
*/
if (isPressEnterToChange && isDirty) {
wasDirtyOnBlur.current = true;
if (!isValueEmpty(value)) {
handleOnCommit(event);
} else {
reset(valueProp);
}
}
};
const handleOnFocus = event => {
onFocus(event);
setIsFocused(true);
};
const handleOnChange = event => {
const nextValue = event.target.value;
change(nextValue, event);
};
const handleOnCommit = event => {
const nextValue = event.target.value;
try {
onValidate(nextValue, event);
commit(nextValue, event);
} catch (err) {
invalidate(err, event);
}
};
const handleOnKeyDown = event => {
const {
keyCode
} = event;
onKeyDown(event);
switch (keyCode) {
case external_wp_keycodes_["UP"]:
pressUp(event);
break;
case external_wp_keycodes_["DOWN"]:
pressDown(event);
break;
case external_wp_keycodes_["ENTER"]:
pressEnter(event);
if (isPressEnterToChange) {
event.preventDefault();
handleOnCommit(event);
}
break;
}
};
const dragGestureProps = useDrag(dragProps => {
const {
distance,
dragging,
event
} = dragProps; // The event is persisted to prevent errors in components using this
// to check if a modifier key was held while dragging.
event.persist();
if (!distance) return;
event.stopPropagation();
/**
* Quick return if no longer dragging.
* This prevents unnecessary value calculations.
*/
if (!dragging) {
onDragEnd(dragProps);
dragEnd(dragProps);
return;
}
onDrag(dragProps);
drag(dragProps);
if (!isDragging) {
onDragStart(dragProps);
dragStart(dragProps);
}
}, {
threshold: dragThreshold,
enabled: isDragEnabled
});
const dragProps = isDragEnabled ? dragGestureProps() : {};
/*
* Works around the odd UA (e.g. Firefox) that does not focus inputs of
* type=number when their spinner arrows are pressed.
*/
let handleOnMouseDown;
if (type === 'number') {
handleOnMouseDown = event => {
var _props$onMouseDown;
(_props$onMouseDown = props.onMouseDown) === null || _props$onMouseDown === void 0 ? void 0 : _props$onMouseDown.call(props, event);
if (event.target !== event.target.ownerDocument.activeElement) {
event.target.focus();
}
};
}
return Object(external_wp_element_["createElement"])(input_control_styles_Input, Object(esm_extends["a" /* default */])({}, props, dragProps, {
className: "components-input-control__input",
disabled: disabled,
dragCursor: dragCursor,
isDragging: isDragging,
id: id,
onBlur: handleOnBlur,
onChange: handleOnChange,
onFocus: handleOnFocus,
onKeyDown: handleOnKeyDown,
onMouseDown: handleOnMouseDown,
ref: ref,
size: size,
value: value,
type: type
}));
}
const ForwardedComponent = Object(external_wp_element_["forwardRef"])(InputField);
/* harmony default export */ var input_field = (ForwardedComponent);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/input-control/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function input_control_useUniqueId(idProp) {
const instanceId = Object(external_wp_compose_["useInstanceId"])(InputControl);
const id = `inspector-input-control-${instanceId}`;
return idProp || id;
}
function InputControl({
__unstableStateReducer: stateReducer = state => state,
__unstableInputWidth,
className,
disabled = false,
hideLabelFromVision = false,
id: idProp,
isPressEnterToChange = false,
label,
labelPosition = 'top',
onChange = external_lodash_["noop"],
onValidate = external_lodash_["noop"],
onKeyDown = external_lodash_["noop"],
prefix,
size = 'default',
suffix,
value,
...props
}, ref) {
const [isFocused, setIsFocused] = Object(external_wp_element_["useState"])(false);
const id = input_control_useUniqueId(idProp);
const classes = classnames_default()('components-input-control', className);
return Object(external_wp_element_["createElement"])(input_base, {
__unstableInputWidth: __unstableInputWidth,
className: classes,
disabled: disabled,
gap: 3,
hideLabelFromVision: hideLabelFromVision,
id: id,
isFocused: isFocused,
justify: "left",
label: label,
labelPosition: labelPosition,
prefix: prefix,
size: size,
suffix: suffix
}, Object(external_wp_element_["createElement"])(input_field, Object(esm_extends["a" /* default */])({}, props, {
className: "components-input-control__input",
disabled: disabled,
id: id,
isFocused: isFocused,
isPressEnterToChange: isPressEnterToChange,
onChange: onChange,
onKeyDown: onKeyDown,
onValidate: onValidate,
ref: ref,
setIsFocused: setIsFocused,
size: size,
stateReducer: stateReducer,
value: value
})));
}
const input_control_ForwardedComponent = Object(external_wp_element_["forwardRef"])(InputControl);
/* harmony default export */ var input_control = (input_control_ForwardedComponent);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/number-control/styles/number-control-styles.js
function number_control_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
/**
* External dependencies
*/
/**
* Internal dependencies
*/
var number_control_styles_ref = true ? {
name: "1b9wwt5",
styles: "&::-webkit-outer-spin-button,&::-webkit-inner-spin-button{-webkit-appearance:none !important;margin:0 !important;}"
} : undefined;
const htmlArrowStyles = ({
hideHTMLArrows
}) => {
if (!hideHTMLArrows) return ``;
return number_control_styles_ref;
};
const number_control_styles_Input = /*#__PURE__*/styled_base_browser_esm(input_control, {
target: "ep48uk90",
label: "Input"
})(htmlArrowStyles, ";" + ( true ? "" : undefined));
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/utils/math.js
/**
* External dependencies
*/
/**
* Parses and retrieves a number value.
*
* @param {unknown} value The incoming value.
*
* @return {number} The parsed number value.
*/
function getNumber(value) {
const number = Number(value);
return isNaN(number) ? 0 : number;
}
/**
* Safely adds 2 values.
*
* @param {Array} args Values to add together.
*
* @return {number} The sum of values.
*/
function add(...args) {
return args.reduce(
/** @type {(sum:number, arg: number|string) => number} */
(sum, arg) => sum + getNumber(arg), 0);
}
/**
* Safely subtracts 2 values.
*
* @param {Array} args Values to subtract together.
*
* @return {number} The difference of the values.
*/
function subtract(...args) {
return args.reduce(
/** @type {(diff:number, arg: number|string, index:number) => number} */
(diff, arg, index) => {
const value = getNumber(arg);
return index === 0 ? value : diff - value;
}, 0);
}
/**
* Determines the decimal position of a number value.
*
* @param {number} value The number to evaluate.
*
* @return {number} The number of decimal places.
*/
function getPrecision(value) {
const split = (value + '').split('.');
return split[1] !== undefined ? split[1].length : 0;
}
/**
* Clamps a value based on a min/max range with rounding
*
* @param {number} value The value.
* @param {number} min The minimum range.
* @param {number} max The maximum range.
* @param {number} step A multiplier for the value.
*
* @return {number} The rounded and clamped value.
*/
function roundClamp(value = 0, min = Infinity, max = Infinity, step = 1) {
const baseValue = getNumber(value);
const stepValue = getNumber(step);
const precision = getPrecision(step);
const rounded = Math.round(baseValue / stepValue) * stepValue;
const clampedValue = Object(external_lodash_["clamp"])(rounded, min, max);
return precision ? getNumber(clampedValue.toFixed(precision)) : clampedValue;
}
/**
* Clamps a value based on a min/max range with rounding.
* Returns a string.
*
* @param {Parameters} args Arguments for roundClamp().
* @return {string} The rounded and clamped value.
*/
function roundClampString(...args) {
return roundClamp(...args).toString();
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/utils/hooks/use-jump-step.js
/**
* WordPress dependencies
*/
/**
* A custom hook that calculates a step value (used by elements like input
* [type="number"]). This value can be modified based on whether the Shift
* key is being held down.
*
* For example, a shiftStep of 10, and a step of 1...
* Starting from 10, the next incremented value will be 11.
*
* Holding down shift...
* Starting from 10, the next incremented value will be 20.
*
* @param {Object} props Properties for the hook.
* @param {boolean} [props.isShiftStepEnabled=true] Determines if jumping values with shift is enabled
* @param {number} [props.shiftStep=10] Multiplier to jump by, when holding shift key.
* @param {number} [props.step=1] Multiplier to jump by, when not-holding shift key.
*
* @return {number} The jump step value.
*/
function useJumpStep({
isShiftStepEnabled = true,
shiftStep = 10,
step = 1
}) {
const [isShiftKey, setIsShiftKey] = Object(external_wp_element_["useState"])(false);
Object(external_wp_element_["useEffect"])(() => {
/** @type {(event: KeyboardEvent)=>void} */
const handleShiftKeyToggle = event => {
setIsShiftKey(event.shiftKey);
};
window.addEventListener('keydown', handleShiftKeyToggle);
window.addEventListener('keyup', handleShiftKeyToggle);
return () => {
window.removeEventListener('keydown', handleShiftKeyToggle);
window.removeEventListener('keyup', handleShiftKeyToggle);
};
}, []);
const isEnabled = isShiftStepEnabled && isShiftKey;
return isEnabled ? shiftStep * step : step;
}
/* harmony default export */ var use_jump_step = (useJumpStep);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/number-control/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function NumberControl({
__unstableStateReducer: stateReducer = state => state,
className,
dragDirection = 'n',
hideHTMLArrows = false,
isDragEnabled = true,
isShiftStepEnabled = true,
label,
max = Infinity,
min = -Infinity,
shiftStep = 10,
step = 1,
type: typeProp = 'number',
value: valueProp,
...props
}, ref) {
const baseValue = roundClamp(0, min, max, step);
const jumpStep = use_jump_step({
step,
shiftStep,
isShiftStepEnabled
});
const autoComplete = typeProp === 'number' ? 'off' : null;
const classes = classnames_default()('components-number-control', className);
/**
* "Middleware" function that intercepts updates from InputControl.
* This allows us to tap into actions to transform the (next) state for
* InputControl.
*
* @param {Object} state State from InputControl
* @param {Object} action Action triggering state change
* @return {Object} The updated state to apply to InputControl
*/
const numberControlStateReducer = (state, action) => {
const {
type,
payload
} = action;
const event = payload === null || payload === void 0 ? void 0 : payload.event;
const currentValue = state.value;
/**
* Handles custom UP and DOWN Keyboard events
*/
if (type === inputControlActionTypes.PRESS_UP || type === inputControlActionTypes.PRESS_DOWN) {
const enableShift = event.shiftKey && isShiftStepEnabled;
const incrementalValue = enableShift ? parseFloat(shiftStep) * parseFloat(step) : parseFloat(step);
let nextValue = isValueEmpty(currentValue) ? baseValue : currentValue;
if (event !== null && event !== void 0 && event.preventDefault) {
event.preventDefault();
}
if (type === inputControlActionTypes.PRESS_UP) {
nextValue = add(nextValue, incrementalValue);
}
if (type === inputControlActionTypes.PRESS_DOWN) {
nextValue = subtract(nextValue, incrementalValue);
}
nextValue = roundClamp(nextValue, min, max, incrementalValue);
state.value = nextValue;
}
/**
* Handles drag to update events
*/
if (type === inputControlActionTypes.DRAG && isDragEnabled) {
const {
delta,
shiftKey
} = payload;
const [x, y] = delta;
const modifier = shiftKey ? parseFloat(shiftStep) * parseFloat(step) : parseFloat(step);
let directionModifier;
let directionBaseValue;
switch (dragDirection) {
case 'n':
directionBaseValue = y;
directionModifier = -1;
break;
case 'e':
directionBaseValue = x;
directionModifier = Object(external_wp_i18n_["isRTL"])() ? -1 : 1;
break;
case 's':
directionBaseValue = y;
directionModifier = 1;
break;
case 'w':
directionBaseValue = x;
directionModifier = Object(external_wp_i18n_["isRTL"])() ? 1 : -1;
break;
}
const distance = directionBaseValue * modifier * directionModifier;
let nextValue;
if (distance !== 0) {
nextValue = roundClamp(add(currentValue, distance), min, max, modifier);
state.value = nextValue;
}
}
/**
* Handles commit (ENTER key press or on blur if isPressEnterToChange)
*/
if (type === inputControlActionTypes.PRESS_ENTER || type === inputControlActionTypes.COMMIT) {
state.value = roundClamp(currentValue, min, max);
}
return state;
};
return Object(external_wp_element_["createElement"])(number_control_styles_Input, Object(esm_extends["a" /* default */])({
autoComplete: autoComplete,
inputMode: "numeric"
}, props, {
className: classes,
dragDirection: dragDirection,
hideHTMLArrows: hideHTMLArrows,
isDragEnabled: isDragEnabled,
label: label,
max: max,
min: min,
ref: ref,
step: jumpStep,
type: typeProp,
value: valueProp,
__unstableStateReducer: composeStateReducers(numberControlStateReducer, stateReducer)
}));
}
/* harmony default export */ var number_control = (Object(external_wp_element_["forwardRef"])(NumberControl));
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/angle-picker-control/styles/angle-picker-control-styles.js
function angle_picker_control_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
/**
* Internal dependencies
*/
const CIRCLE_SIZE = 30;
const angle_picker_control_styles_Root = /*#__PURE__*/styled_base_browser_esm(flex_component, {
target: "e65ony40",
label: "Root"
})( true ? {
name: "tn9ygg",
styles: "max-width:200px;"
} : undefined);
const CircleRoot = styled_base_browser_esm("div", {
target: "e65ony41",
label: "CircleRoot"
})("border-radius:50%;border:1px solid ", COLORS.ui.borderLight, ";box-sizing:border-box;cursor:grab;height:", CIRCLE_SIZE, "px;overflow:hidden;width:", CIRCLE_SIZE, "px;" + ( true ? "" : undefined));
const CircleIndicatorWrapper = styled_base_browser_esm("div", {
target: "e65ony42",
label: "CircleIndicatorWrapper"
})( true ? {
name: "11t5m37",
styles: "box-sizing:border-box;position:relative;width:100%;height:100%;"
} : undefined);
const CircleIndicator = styled_base_browser_esm("div", {
target: "e65ony43",
label: "CircleIndicator"
})("background:", COLORS.ui.border, ";border-radius:50%;border:3px solid ", COLORS.ui.border, ";bottom:0;box-sizing:border-box;display:block;height:1px;left:0;margin:auto;position:absolute;right:0;top:-", CIRCLE_SIZE / 2, "px;width:1px;" + ( true ? "" : undefined));
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/angle-picker-control/angle-circle.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function AngleCircle({
value,
onChange,
...props
}) {
const angleCircleRef = Object(external_wp_element_["useRef"])();
const angleCircleCenter = Object(external_wp_element_["useRef"])();
const previousCursorValue = Object(external_wp_element_["useRef"])();
const setAngleCircleCenter = () => {
const rect = angleCircleRef.current.getBoundingClientRect();
angleCircleCenter.current = {
x: rect.x + rect.width / 2,
y: rect.y + rect.height / 2
};
};
const changeAngleToPosition = event => {
const {
x: centerX,
y: centerY
} = angleCircleCenter.current;
const {
ownerDocument
} = angleCircleRef.current; // Prevent (drag) mouse events from selecting and accidentally
// triggering actions from other elements.
event.preventDefault(); // Ensure the input isn't focused as preventDefault would leave it
ownerDocument.activeElement.blur();
onChange(getAngle(centerX, centerY, event.clientX, event.clientY));
};
const {
startDrag,
isDragging
} = Object(external_wp_compose_["__experimentalUseDragging"])({
onDragStart: event => {
setAngleCircleCenter();
changeAngleToPosition(event);
},
onDragMove: changeAngleToPosition,
onDragEnd: changeAngleToPosition
});
Object(external_wp_element_["useEffect"])(() => {
if (isDragging) {
if (previousCursorValue.current === undefined) {
previousCursorValue.current = document.body.style.cursor;
}
document.body.style.cursor = 'grabbing';
} else {
document.body.style.cursor = previousCursorValue.current || null;
previousCursorValue.current = undefined;
}
}, [isDragging]);
return (
/* eslint-disable jsx-a11y/no-static-element-interactions */
Object(external_wp_element_["createElement"])(CircleRoot, Object(esm_extends["a" /* default */])({
ref: angleCircleRef,
onMouseDown: startDrag,
className: "components-angle-picker-control__angle-circle",
style: isDragging ? {
cursor: 'grabbing'
} : undefined
}, props), Object(external_wp_element_["createElement"])(CircleIndicatorWrapper, {
style: value ? {
transform: `rotate(${value}deg)`
} : undefined,
className: "components-angle-picker-control__angle-circle-indicator-wrapper"
}, Object(external_wp_element_["createElement"])(CircleIndicator, {
className: "components-angle-picker-control__angle-circle-indicator"
})))
/* eslint-enable jsx-a11y/no-static-element-interactions */
);
}
function getAngle(centerX, centerY, pointX, pointY) {
const y = pointY - centerY;
const x = pointX - centerX;
const angleInRadians = Math.atan2(y, x);
const angleInDeg = Math.round(angleInRadians * (180 / Math.PI)) + 90;
if (angleInDeg < 0) {
return 360 + angleInDeg;
}
return angleInDeg;
}
/* harmony default export */ var angle_circle = (AngleCircle);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/angle-picker-control/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function AnglePickerControl({
className,
hideLabelFromVision,
id: idProp,
label = Object(external_wp_i18n_["__"])('Angle'),
onChange,
value,
...props
}) {
const instanceId = Object(external_wp_compose_["useInstanceId"])(AnglePickerControl, 'components-angle-picker-control__input');
const id = idProp || instanceId;
const handleOnNumberChange = unprocessedValue => {
const inputValue = unprocessedValue !== '' ? parseInt(unprocessedValue, 10) : 0;
onChange(inputValue);
};
const classes = classnames_default()('components-angle-picker-control', className);
return Object(external_wp_element_["createElement"])(base_control, Object(esm_extends["a" /* default */])({
className: classes,
hideLabelFromVision: hideLabelFromVision,
id: id,
label: label
}, props), Object(external_wp_element_["createElement"])(angle_picker_control_styles_Root, null, Object(external_wp_element_["createElement"])(flex_block_component, null, Object(external_wp_element_["createElement"])(number_control, {
className: "components-angle-picker-control__input-field",
id: id,
max: 360,
min: 0,
onChange: handleOnNumberChange,
step: "1",
value: value
})), Object(external_wp_element_["createElement"])(flex_item_component, null, Object(external_wp_element_["createElement"])(angle_circle, {
"aria-hidden": "true",
value: value,
onChange: onChange
}))));
}
// EXTERNAL MODULE: external ["wp","richText"]
var external_wp_richText_ = __webpack_require__("qRz9");
// EXTERNAL MODULE: external ["wp","a11y"]
var external_wp_a11y_ = __webpack_require__("gdqT");
// EXTERNAL MODULE: ./node_modules/@wordpress/components/build-module/button/index.js
var build_module_button = __webpack_require__("kA6J");
// EXTERNAL MODULE: ./node_modules/@wordpress/components/build-module/popover/index.js + 1 modules
var build_module_popover = __webpack_require__("oXO/");
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/autocomplete/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* A raw completer option.
*
* @typedef {*} CompleterOption
*/
/**
* @callback FnGetOptions
*
* @return {(CompleterOption[]|Promise.)} The completer options or a promise for them.
*/
/**
* @callback FnGetOptionKeywords
* @param {CompleterOption} option a completer option.
*
* @return {string[]} list of key words to search.
*/
/**
* @callback FnIsOptionDisabled
* @param {CompleterOption} option a completer option.
*
* @return {string[]} whether or not the given option is disabled.
*/
/**
* @callback FnGetOptionLabel
* @param {CompleterOption} option a completer option.
*
* @return {(string|Array.<(string|WPElement)>)} list of react components to render.
*/
/**
* @callback FnAllowContext
* @param {string} before the string before the auto complete trigger and query.
* @param {string} after the string after the autocomplete trigger and query.
*
* @return {boolean} true if the completer can handle.
*/
/**
* @typedef {Object} OptionCompletion
* @property {'insert-at-caret'|'replace'} action the intended placement of the completion.
* @property {OptionCompletionValue} value the completion value.
*/
/**
* A completion value.
*
* @typedef {(string|WPElement|Object)} OptionCompletionValue
*/
/**
* @callback FnGetOptionCompletion
* @param {CompleterOption} value the value of the completer option.
* @param {string} query the text value of the autocomplete query.
*
* @return {(OptionCompletion|OptionCompletionValue)} the completion for the given option. If an
* OptionCompletionValue is returned, the
* completion action defaults to `insert-at-caret`.
*/
/**
* @typedef {Object} WPCompleter
* @property {string} name a way to identify a completer, useful for selective overriding.
* @property {?string} className A class to apply to the popup menu.
* @property {string} triggerPrefix the prefix that will display the menu.
* @property {(CompleterOption[]|FnGetOptions)} options the completer options or a function to get them.
* @property {?FnGetOptionKeywords} getOptionKeywords get the keywords for a given option.
* @property {?FnIsOptionDisabled} isOptionDisabled get whether or not the given option is disabled.
* @property {FnGetOptionLabel} getOptionLabel get the label for a given option.
* @property {?FnAllowContext} allowContext filter the context under which the autocomplete activates.
* @property {FnGetOptionCompletion} getOptionCompletion get the completion associated with a given option.
*/
function filterOptions(search, options = [], maxResults = 10) {
const filtered = [];
for (let i = 0; i < options.length; i++) {
const option = options[i]; // Merge label into keywords
let {
keywords = []
} = option;
if ('string' === typeof option.label) {
keywords = [...keywords, option.label];
}
const isMatch = keywords.some(keyword => search.test(Object(external_lodash_["deburr"])(keyword)));
if (!isMatch) {
continue;
}
filtered.push(option); // Abort early if max reached
if (filtered.length === maxResults) {
break;
}
}
return filtered;
}
const getAutoCompleterUI = autocompleter => {
const useItems = autocompleter.useItems ? autocompleter.useItems : filterValue => {
const [items, setItems] = Object(external_wp_element_["useState"])([]);
/*
* We support both synchronous and asynchronous retrieval of completer options
* but internally treat all as async so we maintain a single, consistent code path.
*
* Because networks can be slow, and the internet is wonderfully unpredictable,
* we don't want two promises updating the state at once. This ensures that only
* the most recent promise will act on `optionsData`. This doesn't use the state
* because `setState` is batched, and so there's no guarantee that setting
* `activePromise` in the state would result in it actually being in `this.state`
* before the promise resolves and we check to see if this is the active promise or not.
*/
Object(external_wp_element_["useLayoutEffect"])(() => {
const {
options,
isDebounced
} = autocompleter;
const loadOptions = Object(external_lodash_["debounce"])(() => {
const promise = Promise.resolve(typeof options === 'function' ? options(filterValue) : options).then(optionsData => {
if (promise.canceled) {
return;
}
const keyedOptions = optionsData.map((optionData, optionIndex) => ({
key: `${autocompleter.name}-${optionIndex}`,
value: optionData,
label: autocompleter.getOptionLabel(optionData),
keywords: autocompleter.getOptionKeywords ? autocompleter.getOptionKeywords(optionData) : [],
isDisabled: autocompleter.isOptionDisabled ? autocompleter.isOptionDisabled(optionData) : false
})); // create a regular expression to filter the options
const search = new RegExp('(?:\\b|\\s|^)' + Object(external_lodash_["escapeRegExp"])(filterValue), 'i');
setItems(filterOptions(search, keyedOptions));
});
return promise;
}, isDebounced ? 250 : 0);
const promise = loadOptions();
return () => {
loadOptions.cancel();
if (promise) {
promise.canceled = true;
}
};
}, [filterValue]);
return [items];
};
function AutocompleterUI({
filterValue,
instanceId,
listBoxId,
className,
selectedIndex,
onChangeOptions,
onSelect,
onReset,
value,
contentRef
}) {
const [items] = useItems(filterValue);
const anchorRef = Object(external_wp_richText_["useAnchorRef"])({
ref: contentRef,
value
});
Object(external_wp_element_["useLayoutEffect"])(() => {
onChangeOptions(items);
}, [items]);
if (!items.length > 0) {
return null;
}
return Object(external_wp_element_["createElement"])(build_module_popover["a" /* default */], {
focusOnMount: false,
onClose: onReset,
position: "top right",
className: "components-autocomplete__popover",
anchorRef: anchorRef
}, Object(external_wp_element_["createElement"])("div", {
id: listBoxId,
role: "listbox",
className: "components-autocomplete__results"
}, Object(external_lodash_["map"])(items, (option, index) => Object(external_wp_element_["createElement"])(build_module_button["a" /* default */], {
key: option.key,
id: `components-autocomplete-item-${instanceId}-${option.key}`,
role: "option",
"aria-selected": index === selectedIndex,
disabled: option.isDisabled,
className: classnames_default()('components-autocomplete__result', className, {
'is-selected': index === selectedIndex
}),
onClick: () => onSelect(option)
}, option.label))));
}
return AutocompleterUI;
};
function useAutocomplete({
record,
onChange,
onReplace,
completers,
contentRef
}) {
const debouncedSpeak = Object(external_wp_compose_["useDebounce"])(external_wp_a11y_["speak"], 500);
const instanceId = Object(external_wp_compose_["useInstanceId"])(useAutocomplete);
const [selectedIndex, setSelectedIndex] = Object(external_wp_element_["useState"])(0);
const [filteredOptions, setFilteredOptions] = Object(external_wp_element_["useState"])([]);
const [filterValue, setFilterValue] = Object(external_wp_element_["useState"])('');
const [autocompleter, setAutocompleter] = Object(external_wp_element_["useState"])(null);
const [AutocompleterUI, setAutocompleterUI] = Object(external_wp_element_["useState"])(null);
const [backspacing, setBackspacing] = Object(external_wp_element_["useState"])(false);
function insertCompletion(replacement) {
const end = record.start;
const start = end - autocompleter.triggerPrefix.length - filterValue.length;
const toInsert = Object(external_wp_richText_["create"])({
html: Object(external_wp_element_["renderToString"])(replacement)
});
onChange(Object(external_wp_richText_["insert"])(record, toInsert, start, end));
}
function select(option) {
const {
getOptionCompletion
} = autocompleter || {};
if (option.isDisabled) {
return;
}
if (getOptionCompletion) {
const completion = getOptionCompletion(option.value, filterValue);
const {
action,
value
} = undefined === completion.action || undefined === completion.value ? {
action: 'insert-at-caret',
value: completion
} : completion;
if ('replace' === action) {
onReplace([value]);
} else if ('insert-at-caret' === action) {
insertCompletion(value);
}
} // Reset autocomplete state after insertion rather than before
// so insertion events don't cause the completion menu to redisplay.
reset();
}
function reset() {
setSelectedIndex(0);
setFilteredOptions([]);
setFilterValue('');
setAutocompleter(null);
setAutocompleterUI(null);
}
function announce(options) {
if (!debouncedSpeak) {
return;
}
if (!!options.length) {
debouncedSpeak(Object(external_wp_i18n_["sprintf"])(
/* translators: %d: number of results. */
Object(external_wp_i18n_["_n"])('%d result found, use up and down arrow keys to navigate.', '%d results found, use up and down arrow keys to navigate.', options.length), options.length), 'assertive');
} else {
debouncedSpeak(Object(external_wp_i18n_["__"])('No results.'), 'assertive');
}
}
/**
* Load options for an autocompleter.
*
* @param {Array} options
*/
function onChangeOptions(options) {
setSelectedIndex(options.length === filteredOptions.length ? selectedIndex : 0);
setFilteredOptions(options);
announce(options);
}
function handleKeyDown(event) {
setBackspacing(event.keyCode === external_wp_keycodes_["BACKSPACE"]);
if (!autocompleter) {
return;
}
if (filteredOptions.length === 0) {
return;
}
switch (event.keyCode) {
case external_wp_keycodes_["UP"]:
setSelectedIndex((selectedIndex === 0 ? filteredOptions.length : selectedIndex) - 1);
break;
case external_wp_keycodes_["DOWN"]:
setSelectedIndex((selectedIndex + 1) % filteredOptions.length);
break;
case external_wp_keycodes_["ESCAPE"]:
setAutocompleter(null);
setAutocompleterUI(null);
break;
case external_wp_keycodes_["ENTER"]:
select(filteredOptions[selectedIndex]);
break;
case external_wp_keycodes_["LEFT"]:
case external_wp_keycodes_["RIGHT"]:
reset();
return;
default:
return;
} // Any handled keycode should prevent original behavior. This relies on
// the early return in the default case.
event.preventDefault();
event.stopPropagation();
}
let textContent;
if (Object(external_wp_richText_["isCollapsed"])(record)) {
textContent = Object(external_wp_richText_["getTextContent"])(Object(external_wp_richText_["slice"])(record, 0));
}
Object(external_wp_element_["useEffect"])(() => {
if (!textContent) {
return;
}
const text = Object(external_lodash_["deburr"])(textContent);
const textAfterSelection = Object(external_wp_richText_["getTextContent"])(Object(external_wp_richText_["slice"])(record, undefined, Object(external_wp_richText_["getTextContent"])(record).length));
const completer = Object(external_lodash_["find"])(completers, ({
triggerPrefix,
allowContext
}) => {
const index = text.lastIndexOf(triggerPrefix);
if (index === -1) {
return false;
}
const textWithoutTrigger = text.slice(index + triggerPrefix.length);
const tooDistantFromTrigger = textWithoutTrigger.length > 50; // 50 chars seems to be a good limit.
// This is a final barrier to prevent the effect from completing with
// an extremely long string, which causes the editor to slow-down
// significantly. This could happen, for example, if `matchingWhileBackspacing`
// is true and one of the "words" end up being too long. If that's the case,
// it will be caught by this guard.
if (tooDistantFromTrigger) return false;
const mismatch = filteredOptions.length === 0;
const wordsFromTrigger = textWithoutTrigger.split(/\s/); // We need to allow the effect to run when not backspacing and if there
// was a mismatch. i.e when typing a trigger + the match string or when
// clicking in an existing trigger word on the page. We do that if we
// detect that we have one word from trigger in the current textual context.
//
// Ex.: "Some text @a" <-- "@a" will be detected as the trigger word and
// allow the effect to run. It will run until there's a mismatch.
const hasOneTriggerWord = wordsFromTrigger.length === 1; // This is used to allow the effect to run when backspacing and if
// "touching" a word that "belongs" to a trigger. We consider a "trigger
// word" any word up to the limit of 3 from the trigger character.
// Anything beyond that is ignored if there's a mismatch. This allows
// us to "escape" a mismatch when backspacing, but still imposing some
// sane limits.
//
// Ex: "Some text @marcelo sekkkk" <--- "kkkk" caused a mismatch, but
// if the user presses backspace here, it will show the completion popup again.
const matchingWhileBackspacing = backspacing && textWithoutTrigger.split(/\s/).length <= 3;
if (mismatch && !(matchingWhileBackspacing || hasOneTriggerWord)) {
return false;
}
if (allowContext && !allowContext(text.slice(0, index), textAfterSelection)) {
return false;
}
if (/^\s/.test(textWithoutTrigger) || /\s\s+$/.test(textWithoutTrigger)) {
return false;
}
return /[\u0000-\uFFFF]*$/.test(textWithoutTrigger);
});
if (!completer) {
reset();
return;
}
const safeTrigger = Object(external_lodash_["escapeRegExp"])(completer.triggerPrefix);
const match = text.slice(text.lastIndexOf(completer.triggerPrefix)).match(new RegExp(`${safeTrigger}([\u0000-\uFFFF]*)$`));
const query = match && match[1];
setAutocompleter(completer);
setAutocompleterUI(() => completer !== autocompleter ? getAutoCompleterUI(completer) : AutocompleterUI);
setFilterValue(query);
}, [textContent]);
const {
key: selectedKey = ''
} = filteredOptions[selectedIndex] || {};
const {
className
} = autocompleter || {};
const isExpanded = !!autocompleter && filteredOptions.length > 0;
const listBoxId = isExpanded ? `components-autocomplete-listbox-${instanceId}` : null;
const activeId = isExpanded ? `components-autocomplete-item-${instanceId}-${selectedKey}` : null;
return {
listBoxId,
activeId,
onKeyDown: handleKeyDown,
popover: AutocompleterUI && Object(external_wp_element_["createElement"])(AutocompleterUI, {
className: className,
filterValue: filterValue,
instanceId: instanceId,
listBoxId: listBoxId,
selectedIndex: selectedIndex,
onChangeOptions: onChangeOptions,
onSelect: select,
value: record,
contentRef: contentRef
})
};
}
function useAutocompleteProps(options) {
const ref = Object(external_wp_element_["useRef"])();
const onKeyDownRef = Object(external_wp_element_["useRef"])();
const {
popover,
listBoxId,
activeId,
onKeyDown
} = useAutocomplete({ ...options,
contentRef: ref
});
onKeyDownRef.current = onKeyDown;
return {
ref: Object(external_wp_compose_["useMergeRefs"])([ref, Object(external_wp_compose_["useRefEffect"])(element => {
function _onKeyDown(event) {
onKeyDownRef.current(event);
}
element.addEventListener('keydown', _onKeyDown);
return () => {
element.removeEventListener('keydown', _onKeyDown);
};
}, [])]),
children: popover,
'aria-autocomplete': listBoxId ? 'list' : undefined,
'aria-owns': listBoxId,
'aria-activedescendant': activeId
};
}
function Autocomplete({
children,
isSelected,
...options
}) {
const {
popover,
...props
} = useAutocomplete(options);
return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, children(props), isSelected && popover);
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/unit-control/styles/unit-control-styles.js
function unit_control_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
/**
* External dependencies
*/
/**
* Internal dependencies
*/
const unit_control_styles_Root = styled_base_browser_esm("div", {
target: "e1agakv00",
label: "Root"
})( true ? {
name: "1bt0omd",
styles: "box-sizing:border-box;position:relative;"
} : undefined);
const paddingStyles = ({
disableUnits
}) => {
const value = disableUnits ? 3 : 24;
return /*#__PURE__*/css_browser_esm(rtl_rtl({
paddingRight: value
})(), ";" + ( true ? "" : undefined));
};
var unit_control_styles_ref = true ? {
name: "1y65o8",
styles: "&::-webkit-outer-spin-button,&::-webkit-inner-spin-button{-webkit-appearance:none;margin:0;}"
} : undefined;
const arrowStyles = ({
disableUnits
}) => {
if (disableUnits) return '';
return unit_control_styles_ref;
}; // TODO: Resolve need to use &&& to increase specificity
// https://github.com/WordPress/gutenberg/issues/18483
const ValueInput = /*#__PURE__*/styled_base_browser_esm(number_control, {
target: "e1agakv01",
label: "ValueInput"
})("&&&{input{appearance:none;-moz-appearance:textfield;display:block;width:100%;", arrowStyles, ";", paddingStyles, ";}}" + ( true ? "" : undefined));
const unitSizeStyles = ({
size
}) => {
const sizes = {
default: {
height: 28,
lineHeight: '24px',
minHeight: 28,
top: 1
},
small: {
height: 22,
lineHeight: '18px',
minHeight: 22,
top: 1
}
};
return /*#__PURE__*/css_browser_esm(sizes[size], true ? "" : undefined);
};
const baseUnitLabelStyles = props => {
return /*#__PURE__*/css_browser_esm("appearance:none;background:transparent;border-radius:2px;border:none;box-sizing:border-box;color:", COLORS.darkGray[500], ";display:block;font-size:8px;line-height:1;letter-spacing:-0.5px;outline:none;padding:2px 1px;position:absolute;text-align-last:center;text-transform:uppercase;width:20px;", rtl_rtl({
borderTopLeftRadius: 0,
borderBottomLeftRadius: 0
})(), " ", rtl_rtl({
right: 0
})(), " ", unitSizeStyles(props), true ? "" : undefined);
};
const UnitLabel = styled_base_browser_esm("div", {
target: "e1agakv02",
label: "UnitLabel"
})("&&&{pointer-events:none;", baseUnitLabelStyles, ";}" + ( true ? "" : undefined));
const UnitSelect = styled_base_browser_esm("select", {
target: "e1agakv03",
label: "UnitSelect"
})("&&&{", baseUnitLabelStyles, ";cursor:pointer;border:1px solid transparent;&:hover{background-color:", COLORS.lightGray[300], ";}&:focus{border-color:", COLORS.ui.borderFocus, ";outline:2px solid transparent;outline-offset:0;}&:disabled{cursor:initial;&:hover{background-color:transparent;}}}" + ( true ? "" : undefined));
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/unit-control/utils.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
const isWeb = external_wp_element_["Platform"].OS === 'web';
/**
* An array of all available CSS length units.
*/
const ALL_CSS_UNITS = [{
value: 'px',
label: isWeb ? 'px' : Object(external_wp_i18n_["__"])('Pixels (px)'),
default: '',
a11yLabel: Object(external_wp_i18n_["__"])('Pixels (px)')
}, {
value: '%',
label: isWeb ? '%' : Object(external_wp_i18n_["__"])('Percentage (%)'),
default: '',
a11yLabel: Object(external_wp_i18n_["__"])('Percent (%)')
}, {
value: 'em',
label: isWeb ? 'em' : Object(external_wp_i18n_["__"])('Relative to parent font size (em)'),
default: '',
a11yLabel: Object(external_wp_i18n_["__"])('Relative to parent font size (em)')
}, {
value: 'rem',
label: isWeb ? 'rem' : Object(external_wp_i18n_["__"])('Relative to root font size (rem)'),
default: '',
a11yLabel: Object(external_wp_i18n_["__"])('Relative to root font size (rem)')
}, {
value: 'vw',
label: isWeb ? 'vw' : Object(external_wp_i18n_["__"])('Viewport width (vw)'),
default: '',
a11yLabel: Object(external_wp_i18n_["__"])('Viewport width (vw)')
}, {
value: 'vh',
label: isWeb ? 'vh' : Object(external_wp_i18n_["__"])('Viewport height (vh)'),
default: '',
a11yLabel: Object(external_wp_i18n_["__"])('Viewport height (vh)')
}, {
value: 'vmin',
label: isWeb ? 'vmin' : Object(external_wp_i18n_["__"])('Viewport smallest dimension (vmin)'),
default: '',
a11yLabel: Object(external_wp_i18n_["__"])('Viewport smallest dimension (vmin)')
}, {
value: 'vmax',
label: isWeb ? 'vmax' : Object(external_wp_i18n_["__"])('Viewport largest dimension (vmax)'),
default: '',
a11yLabel: Object(external_wp_i18n_["__"])('Viewport largest dimension (vmax)')
}, {
value: 'ch',
label: isWeb ? 'ch' : Object(external_wp_i18n_["__"])('Width of the zero (0) character (ch)'),
default: '',
a11yLabel: Object(external_wp_i18n_["__"])('Width of the zero (0) character (ch)')
}, {
value: 'ex',
label: isWeb ? 'ex' : Object(external_wp_i18n_["__"])('x-height of the font (ex)'),
default: '',
a11yLabel: Object(external_wp_i18n_["__"])('x-height of the font (ex)')
}, {
value: 'cm',
label: isWeb ? 'cm' : Object(external_wp_i18n_["__"])('Centimeters (cm)'),
default: '',
a11yLabel: Object(external_wp_i18n_["__"])('Centimeters (cm)')
}, {
value: 'mm',
label: isWeb ? 'mm' : Object(external_wp_i18n_["__"])('Millimeters (mm)'),
default: '',
a11yLabel: Object(external_wp_i18n_["__"])('Millimeters (mm)')
}, {
value: 'in',
label: isWeb ? 'in' : Object(external_wp_i18n_["__"])('Inches (in)'),
default: '',
a11yLabel: Object(external_wp_i18n_["__"])('Inches (in)')
}, {
value: 'pc',
label: isWeb ? 'pc' : Object(external_wp_i18n_["__"])('Picas (pc)'),
default: '',
a11yLabel: Object(external_wp_i18n_["__"])('Picas (pc)')
}, {
value: 'pt',
label: isWeb ? 'pt' : Object(external_wp_i18n_["__"])('Points (pt)'),
default: '',
a11yLabel: Object(external_wp_i18n_["__"])('Points (pt)')
}];
/**
* Units of measurements. `a11yLabel` is used by screenreaders.
*/
const CSS_UNITS = [{
value: 'px',
label: 'px',
default: 0,
a11yLabel: Object(external_wp_i18n_["__"])('pixels')
}, {
value: '%',
label: '%',
default: 10,
a11yLabel: Object(external_wp_i18n_["__"])('percent')
}, {
value: 'em',
label: 'em',
default: 0,
a11yLabel: Object(external_wp_i18n_["_x"])('ems', 'Relative to parent font size (em)')
}, {
value: 'rem',
label: 'rem',
default: 0,
a11yLabel: Object(external_wp_i18n_["_x"])('rems', 'Relative to root font size (rem)')
}, {
value: 'vw',
label: 'vw',
default: 10,
a11yLabel: Object(external_wp_i18n_["__"])('viewport widths')
}, {
value: 'vh',
label: 'vh',
default: 10,
a11yLabel: Object(external_wp_i18n_["__"])('viewport heights')
}];
const DEFAULT_UNIT = CSS_UNITS[0];
/**
* Handles legacy value + unit handling.
* This component use to manage both incoming value and units separately.
*
* Moving forward, ideally the value should be a string that contains both
* the value and unit, example: '10px'
*
* @param {number|string} value Value
* @param {string} unit Unit value
* @param {Array