}
*/
var OPERATOR_EVALUATORS = {
'>=': function _(breakpointValue, width) {
return width >= breakpointValue;
},
'<': function _(breakpointValue, width) {
return width < breakpointValue;
}
};
var ViewportMatchWidthContext = Object(external_wp_element_["createContext"])(null);
/**
* Returns true if the viewport matches the given query, or false otherwise.
*
* @param {WPBreakpoint} breakpoint Breakpoint size name.
* @param {WPViewportOperator} [operator=">="] Viewport operator.
*
* @example
*
* ```js
* useViewportMatch( 'huge', '<' );
* useViewportMatch( 'medium' );
* ```
*
* @return {boolean} Whether viewport matches query.
*/
var use_viewport_match_useViewportMatch = function useViewportMatch(breakpoint) {
var operator = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '>=';
var simulatedWidth = Object(external_wp_element_["useContext"])(ViewportMatchWidthContext);
var mediaQuery = !simulatedWidth && "(".concat(CONDITIONS[operator], ": ").concat(BREAKPOINTS[breakpoint], "px)");
var mediaQueryResult = useMediaQuery(mediaQuery);
if (simulatedWidth) {
return OPERATOR_EVALUATORS[operator](BREAKPOINTS[breakpoint], simulatedWidth);
}
return mediaQueryResult;
};
use_viewport_match_useViewportMatch.__experimentalWidthProvider = ViewportMatchWidthContext.Provider;
/* harmony default export */ var use_viewport_match = (use_viewport_match_useViewportMatch);
// EXTERNAL MODULE: ./node_modules/react-resize-aware/dist/index.js
var dist = __webpack_require__(151);
var dist_default = /*#__PURE__*/__webpack_require__.n(dist);
// CONCATENATED MODULE: ./node_modules/@wordpress/compose/build-module/hooks/use-resize-observer/index.js
/**
* External dependencies
*/
/**
* Hook which allows to listen the resize event of any target element when it changes sizes.
* _Note: `useResizeObserver` will report `null` until after first render_
*
* @return {Array} An array of {Element} `resizeListener` and {?Object} `sizes` with properties `width` and `height`
*
* @example
*
* ```js
* const App = () => {
* const [ resizeListener, sizes ] = useResizeObserver();
*
* return (
*
* { resizeListener }
* Your content here
*
* );
* };
* ```
*
*/
/* harmony default export */ var use_resize_observer = (dist_default.a);
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js + 2 modules
var toConsumableArray = __webpack_require__(15);
// EXTERNAL MODULE: external ["wp","priorityQueue"]
var external_wp_priorityQueue_ = __webpack_require__(152);
// CONCATENATED MODULE: ./node_modules/@wordpress/compose/build-module/hooks/use-async-list/index.js
/**
* WordPress dependencies
*/
/**
* Returns the first items from list that are present on state.
*
* @param {Array} list New array.
* @param {Array} state Current state.
* @return {Array} First items present iin state.
*/
function getFirstItemsPresentInState(list, state) {
var firstItems = [];
for (var i = 0; i < list.length; i++) {
var item = list[i];
if (!state.includes(item)) {
break;
}
firstItems.push(item);
}
return firstItems;
}
/**
* Reducer keeping track of a list of appended items.
*
* @param {Array} state Current state
* @param {Object} action Action
*
* @return {Array} update state.
*/
function listReducer(state, action) {
if (action.type === 'reset') {
return action.list;
}
if (action.type === 'append') {
return [].concat(Object(toConsumableArray["a" /* default */])(state), [action.item]);
}
return state;
}
/**
* React hook returns an array which items get asynchronously appended from a source array.
* This behavior is useful if we want to render a list of items asynchronously for performance reasons.
*
* @param {Array} list Source array.
* @return {Array} Async array.
*/
function useAsyncList(list) {
var _useReducer = Object(external_wp_element_["useReducer"])(listReducer, []),
_useReducer2 = Object(slicedToArray["a" /* default */])(_useReducer, 2),
current = _useReducer2[0],
dispatch = _useReducer2[1];
Object(external_wp_element_["useEffect"])(function () {
// On reset, we keep the first items that were previously rendered.
var firstItems = getFirstItemsPresentInState(list, current);
dispatch({
type: 'reset',
list: firstItems
});
var asyncQueue = Object(external_wp_priorityQueue_["createQueue"])();
var append = function append(index) {
return function () {
if (list.length <= index) {
return;
}
dispatch({
type: 'append',
item: list[index]
});
asyncQueue.add({}, append(index + 1));
};
};
asyncQueue.add({}, append(firstItems.length));
return function () {
return asyncQueue.reset();
};
}, [list]);
return current;
}
/* harmony default export */ var use_async_list = (useAsyncList);
// CONCATENATED MODULE: ./node_modules/@wordpress/compose/build-module/hooks/use-warn-on-change/index.js
/**
* Internal dependencies
*/
/**
* Hook that performs a shallow comparison between the preview value of an object
* and the new one, if there's a difference, it prints it to the console.
* this is useful in performance related work, to check why a component re-renders.
*
* @example
*
* ```jsx
* function MyComponent(props) {
* useWarnOnChange(props);
*
* return "Something";
* }
* ```
*
* @param {Object} object Object which changes to compare.
* @param {string} prefix Just a prefix to show when console logging.
*/
function useWarnOnChange(object) {
var prefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'Change detection';
var previousValues = usePrevious(object);
Object.entries(previousValues !== null && previousValues !== void 0 ? previousValues : []).forEach(function (_ref) {
var _ref2 = Object(slicedToArray["a" /* default */])(_ref, 2),
key = _ref2[0],
value = _ref2[1];
if (value !== object[key]) {
// eslint-disable-next-line no-console
console.warn("".concat(prefix, ": ").concat(key, " key changed:"), value, object[key]);
}
});
}
/* harmony default export */ var use_warn_on_change = (useWarnOnChange);
// EXTERNAL MODULE: ./node_modules/use-memo-one/dist/use-memo-one.esm.js
var use_memo_one_esm = __webpack_require__(125);
// CONCATENATED MODULE: ./node_modules/@wordpress/compose/build-module/hooks/use-debounce/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Debounces a function with Lodash's `debounce`. A new debounced function will
* be returned and any scheduled calls cancelled if any of the arguments change,
* including the function to debounce, so please wrap functions created on
* render in components in `useCallback`.
*
* @param {...any} args Arguments passed to Lodash's `debounce`.
*
* @return {Function} Debounced function.
*/
function useDebounce() {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
var debounced = Object(use_memo_one_esm["a" /* useMemoOne */])(function () {
return external_lodash_["debounce"].apply(void 0, args);
}, args);
Object(external_wp_element_["useEffect"])(function () {
return function () {
return debounced.cancel();
};
}, [debounced]);
return debounced;
}
// CONCATENATED MODULE: ./node_modules/@wordpress/compose/build-module/hooks/use-throttle/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Throttles a function with Lodash's `throttle`. A new throttled function will
* be returned and any scheduled calls cancelled if any of the arguments change,
* including the function to throttle, so please wrap functions created on
* render in components in `useCallback`.
*
* @param {...any} args Arguments passed to Lodash's `throttle`.
*
* @return {Function} Throttled function.
*/
function useThrottle() {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
var throttled = Object(use_memo_one_esm["a" /* useMemoOne */])(function () {
return external_lodash_["throttle"].apply(void 0, args);
}, args);
Object(external_wp_element_["useEffect"])(function () {
return function () {
return throttled.cancel();
};
}, [throttled]);
return throttled;
}
// CONCATENATED MODULE: ./node_modules/@wordpress/compose/build-module/hooks/use-ref-effect/index.js
/**
* WordPress dependencies
*/
/**
* Effect-like ref callback. Just like with `useEffect`, this allows you to
* return a cleanup function to be run if the ref changes or one of the
* dependencies changes. The ref is provided as an argument to the callback
* functions. The main difference between this and `useEffect` is that
* the `useEffect` callback is not called when the ref changes, but this is.
* Pass the returned ref callback as the component's ref and merge multiple refs
* with `useMergeRefs`.
*
* It's worth noting that if the dependencies array is empty, there's not
* strictly a need to clean up event handlers for example, because the node is
* to be removed. It *is* necessary if you add dependencies because the ref
* callback will be called multiple times for the same node.
*
* @param {Function} calllback Callback with ref as argument.
* @param {Array} dependencies Dependencies of the callback.
*
* @return {Function} Ref callback.
*/
function useRefEffect(calllback, dependencies) {
var cleanup = Object(external_wp_element_["useRef"])();
return Object(external_wp_element_["useCallback"])(function (node) {
if (node) {
cleanup.current = calllback(node);
} else if (cleanup.current) {
cleanup.current();
}
}, dependencies);
}
// CONCATENATED MODULE: ./node_modules/@wordpress/compose/build-module/index.js
// Utils
// Compose helper (aliased flowRight from Lodash)
// Higher-order components
// Hooks
/***/ }),
/***/ 5:
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _defineProperty; });
function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
/***/ }),
/***/ 52:
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _setPrototypeOf; });
function _setPrototypeOf(o, p) {
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
o.__proto__ = p;
return o;
};
return _setPrototypeOf(o, p);
}
/***/ }),
/***/ 63:
/***/ (function(module, exports) {
(function() { module.exports = window["wp"]["isShallowEqual"]; }());
/***/ }),
/***/ 71:
/***/ (function(module, exports, __webpack_require__) {
/**
* Memize options object.
*
* @typedef MemizeOptions
*
* @property {number} [maxSize] Maximum size of the cache.
*/
/**
* Internal cache entry.
*
* @typedef MemizeCacheNode
*
* @property {?MemizeCacheNode|undefined} [prev] Previous node.
* @property {?MemizeCacheNode|undefined} [next] Next node.
* @property {Array<*>} args Function arguments for cache
* entry.
* @property {*} val Function result.
*/
/**
* Properties of the enhanced function for controlling cache.
*
* @typedef MemizeMemoizedFunction
*
* @property {()=>void} clear Clear the cache.
*/
/**
* Accepts a function to be memoized, and returns a new memoized function, with
* optional options.
*
* @template {Function} F
*
* @param {F} fn Function to memoize.
* @param {MemizeOptions} [options] Options object.
*
* @return {F & MemizeMemoizedFunction} Memoized function.
*/
function memize( fn, options ) {
var size = 0;
/** @type {?MemizeCacheNode|undefined} */
var head;
/** @type {?MemizeCacheNode|undefined} */
var tail;
options = options || {};
function memoized( /* ...args */ ) {
var node = head,
len = arguments.length,
args, i;
searchCache: while ( node ) {
// Perform a shallow equality test to confirm that whether the node
// under test is a candidate for the arguments passed. Two arrays
// are shallowly equal if their length matches and each entry is
// strictly equal between the two sets. Avoid abstracting to a
// function which could incur an arguments leaking deoptimization.
// Check whether node arguments match arguments length
if ( node.args.length !== arguments.length ) {
node = node.next;
continue;
}
// Check whether node arguments match arguments values
for ( i = 0; i < len; i++ ) {
if ( node.args[ i ] !== arguments[ i ] ) {
node = node.next;
continue searchCache;
}
}
// At this point we can assume we've found a match
// Surface matched node to head if not already
if ( node !== head ) {
// As tail, shift to previous. Must only shift if not also
// head, since if both head and tail, there is no previous.
if ( node === tail ) {
tail = node.prev;
}
// Adjust siblings to point to each other. If node was tail,
// this also handles new tail's empty `next` assignment.
/** @type {MemizeCacheNode} */ ( node.prev ).next = node.next;
if ( node.next ) {
node.next.prev = node.prev;
}
node.next = head;
node.prev = null;
/** @type {MemizeCacheNode} */ ( head ).prev = node;
head = node;
}
// Return immediately
return node.val;
}
// No cached value found. Continue to insertion phase:
// Create a copy of arguments (avoid leaking deoptimization)
args = new Array( len );
for ( i = 0; i < len; i++ ) {
args[ i ] = arguments[ i ];
}
node = {
args: args,
// Generate the result from original function
val: fn.apply( null, args ),
};
// Don't need to check whether node is already head, since it would
// have been returned above already if it was
// Shift existing head down list
if ( head ) {
head.prev = node;
node.next = head;
} else {
// If no head, follows that there's no tail (at initial or reset)
tail = node;
}
// Trim tail if we're reached max size and are pending cache insertion
if ( size === /** @type {MemizeOptions} */ ( options ).maxSize ) {
tail = /** @type {MemizeCacheNode} */ ( tail ).prev;
/** @type {MemizeCacheNode} */ ( tail ).next = null;
} else {
size++;
}
head = node;
return node.val;
}
memoized.clear = function() {
head = null;
tail = null;
size = 0;
};
if ( false ) {}
// Ignore reason: There's not a clear solution to create an intersection of
// the function with additional properties, where the goal is to retain the
// function signature of the incoming argument and add control properties
// on the return value.
// @ts-ignore
return memoized;
}
module.exports = memize;
/***/ }),
/***/ 72:
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
function mergeRefs(refs) {
return function (value) {
refs.forEach(function (ref) {
if (typeof ref === "function") {
ref(value);
} else if (ref != null) {
ref.current = value;
}
});
};
}
/* harmony default export */ __webpack_exports__["a"] = (mergeRefs);
/***/ }),
/***/ 8:
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _extends; });
function _extends() {
_extends = Object.assign || function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
return _extends.apply(this, arguments);
}
/***/ })
/******/ });