victory-selection-container
Version:
Interactive Selection Component for Victory
1,301 lines (1,116 loc) • 478 kB
JavaScript
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory(require("react"));
else if(typeof define === 'function' && define.amd)
define(["react"], factory);
else if(typeof exports === 'object')
exports["VictorySelectionContainer"] = factory(require("react"));
else
root["VictorySelectionContainer"] = factory(root["React"]);
})(self, function(__WEBPACK_EXTERNAL_MODULE_react__) {
return /******/ (function() { // webpackBootstrap
/******/ var __webpack_modules__ = ({
/***/ "./selection-helpers.tsx":
/*!*******************************!*\
!*** ./selection-helpers.tsx ***!
\*******************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "SelectionHelpers": function() { return /* binding */ SelectionHelpers; }
/* harmony export */ });
/* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-util/data.js");
/* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-util/helpers.js");
/* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-util/selection.js");
/* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lodash/defaults */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/defaults.js");
/* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_defaults__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var lodash_throttle__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lodash/throttle */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/throttle.js");
/* harmony import */ var lodash_throttle__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash_throttle__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_2__);
const ON_MOUSE_MOVE_THROTTLE_MS = 16;
class SelectionHelpersClass {
getDimension(props) {
const {
horizontal,
selectionDimension
} = props;
if (!horizontal || !selectionDimension) {
return selectionDimension;
}
return selectionDimension === "x" ? "y" : "x";
}
getDatasets(props) {
if (props.data) {
return [{
data: props.data
}];
}
const getData = childProps => {
const data = victory_core__WEBPACK_IMPORTED_MODULE_3__.getData(childProps);
return Array.isArray(data) && data.length > 0 ? data : undefined;
};
const iteratee = (child, childName, parent) => {
const blacklist = props.selectionBlacklist || [];
let childElement;
if (!victory_core__WEBPACK_IMPORTED_MODULE_3__.isDataComponent(child) || blacklist.includes(childName)) {
return null;
} else if (child.type && victory_core__WEBPACK_IMPORTED_MODULE_4__.isFunction(child.type.getData)) {
childElement = parent ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default().cloneElement(child, parent.props) : child;
const childData = childElement.props && childElement.type.getData(childElement.props);
return childData ? {
childName,
data: childData
} : null;
}
const childData = getData(childElement.props);
return childData ? {
childName,
data: childData
} : null;
};
return victory_core__WEBPACK_IMPORTED_MODULE_4__.reduceChildren(react__WEBPACK_IMPORTED_MODULE_2___default().Children.toArray(props.children), iteratee, props);
}
filterDatasets(props, datasets) {
const filtered = datasets.reduce((memo, dataset) => {
const selectedData = this.getSelectedData(props, dataset.data);
return selectedData ? memo.concat({
childName: dataset.childName,
eventKey: selectedData.eventKey,
data: selectedData.data
}) : memo;
}, []);
return filtered.length ? filtered : null;
}
getSelectedData(props, dataset) {
const {
x1,
y1,
x2,
y2
} = props;
const withinBounds = d => {
const scaledPoint = victory_core__WEBPACK_IMPORTED_MODULE_4__.scalePoint(props, d);
return scaledPoint.x >= Math.min(x1, x2) && scaledPoint.x <= Math.max(x1, x2) && scaledPoint.y >= Math.min(y1, y2) && scaledPoint.y <= Math.max(y1, y2);
};
const eventKey = [];
const data = [];
let count = 0;
for (let index = 0, len = dataset.length; index < len; index++) {
const datum = dataset[index];
if (withinBounds(datum)) {
data[count] = datum;
eventKey[count] = datum.eventKey === undefined ? index : datum.eventKey;
count++;
}
}
return count > 0 ? {
eventKey,
data
} : null;
}
onMouseDown = (evt, targetProps) => {
evt.preventDefault();
const {
activateSelectedData,
allowSelection,
polar,
selectedData
} = targetProps;
if (!allowSelection) {
return {};
}
const dimension = this.getDimension(targetProps);
const parentSVG = targetProps.parentSVG || victory_core__WEBPACK_IMPORTED_MODULE_5__.getParentSVG(evt);
const {
x,
y
} = victory_core__WEBPACK_IMPORTED_MODULE_5__.getSVGEventCoordinates(evt, parentSVG);
const x1 = polar || dimension !== "y" ? x : victory_core__WEBPACK_IMPORTED_MODULE_5__.getDomainCoordinates(targetProps).x[0];
const y1 = polar || dimension !== "x" ? y : victory_core__WEBPACK_IMPORTED_MODULE_5__.getDomainCoordinates(targetProps).y[0];
const x2 = polar || dimension !== "y" ? x : victory_core__WEBPACK_IMPORTED_MODULE_5__.getDomainCoordinates(targetProps).x[1];
const y2 = polar || dimension !== "x" ? y : victory_core__WEBPACK_IMPORTED_MODULE_5__.getDomainCoordinates(targetProps).y[1];
const mutatedProps = {
x1,
y1,
select: true,
x2,
y2,
parentSVG
};
if (selectedData && victory_core__WEBPACK_IMPORTED_MODULE_4__.isFunction(targetProps.onSelectionCleared)) {
targetProps.onSelectionCleared(lodash_defaults__WEBPACK_IMPORTED_MODULE_0___default()({}, mutatedProps, targetProps));
}
const parentMutation = [{
target: "parent",
mutation: () => mutatedProps
}];
const dataMutation = selectedData && activateSelectedData ? selectedData.map(d => {
return {
childName: d.childName,
eventKey: d.eventKey,
target: "data",
mutation: () => null
};
}) : [];
return parentMutation.concat(...dataMutation);
};
handleMouseMove = (evt, targetProps) => {
const {
allowSelection,
select,
polar
} = targetProps;
const dimension = this.getDimension(targetProps);
if (!allowSelection || !select) {
return null;
}
const parentSVG = targetProps.parentSVG || victory_core__WEBPACK_IMPORTED_MODULE_5__.getParentSVG(evt);
const {
x,
y
} = victory_core__WEBPACK_IMPORTED_MODULE_5__.getSVGEventCoordinates(evt, parentSVG);
const x2 = polar || dimension !== "y" ? x : victory_core__WEBPACK_IMPORTED_MODULE_5__.getDomainCoordinates(targetProps).x[1];
const y2 = polar || dimension !== "x" ? y : victory_core__WEBPACK_IMPORTED_MODULE_5__.getDomainCoordinates(targetProps).y[1];
return {
target: "parent",
mutation: () => {
return {
x2,
y2,
parentSVG
};
}
};
};
onMouseMove = lodash_throttle__WEBPACK_IMPORTED_MODULE_1___default()(this.handleMouseMove, ON_MOUSE_MOVE_THROTTLE_MS, {
leading: true,
trailing: false
});
onMouseUp = (evt, targetProps) => {
const {
activateSelectedData,
allowSelection,
x2,
y2
} = targetProps;
if (!allowSelection) {
return null;
}
if (!x2 || !y2) {
return [{
target: "parent",
mutation: () => {
return {
select: false,
x1: null,
x2: null,
y1: null,
y2: null
};
}
}];
}
const datasets = this.getDatasets(targetProps);
const bounds = victory_core__WEBPACK_IMPORTED_MODULE_5__.getBounds(targetProps);
const selectedData = this.filterDatasets(targetProps, datasets);
const mutatedProps = {
selectedData,
datasets,
select: false,
x1: null,
x2: null,
y1: null,
y2: null
};
const callbackMutation = selectedData && victory_core__WEBPACK_IMPORTED_MODULE_4__.isFunction(targetProps.onSelection) ? targetProps.onSelection(selectedData, bounds, lodash_defaults__WEBPACK_IMPORTED_MODULE_0___default()({}, mutatedProps, targetProps)) : {};
const parentMutation = [{
target: "parent",
mutation: () => mutatedProps
}];
const dataMutation = selectedData && activateSelectedData ? selectedData.map(d => {
return {
childName: d.childName,
eventKey: d.eventKey,
target: "data",
mutation: () => {
return Object.assign({
active: true
}, callbackMutation);
}
};
}) : [];
return parentMutation.concat(dataMutation);
};
}
const SelectionHelpers = new SelectionHelpersClass();
/***/ }),
/***/ "./victory-selection-container.tsx":
/*!*****************************************!*\
!*** ./victory-selection-container.tsx ***!
\*****************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "VICTORY_SELECTION_CONTAINER_DEFAULT_PROPS": function() { return /* binding */ VICTORY_SELECTION_CONTAINER_DEFAULT_PROPS; },
/* harmony export */ "VictorySelectionContainer": function() { return /* binding */ VictorySelectionContainer; },
/* harmony export */ "useVictorySelectionContainer": function() { return /* binding */ useVictorySelectionContainer; }
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-primitives/rect.js");
/* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-container/victory-container.js");
/* harmony import */ var _selection_helpers__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./selection-helpers */ "./selection-helpers.tsx");
const VICTORY_SELECTION_CONTAINER_DEFAULT_PROPS = {
activateSelectedData: true,
allowSelection: true,
selectionComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(victory_core__WEBPACK_IMPORTED_MODULE_1__.Rect, null),
selectionStyle: {
stroke: "transparent",
fill: "black",
fillOpacity: 0.1
}
};
const useVictorySelectionContainer = initialProps => {
const props = {
...VICTORY_SELECTION_CONTAINER_DEFAULT_PROPS,
...initialProps
};
const {
x1,
x2,
y1,
y2,
selectionStyle,
selectionComponent,
children,
name
} = props;
const width = Math.abs(x2 - x1) || 1;
const height = Math.abs(y2 - y1) || 1;
const x = Math.min(x1, x2);
const y = Math.min(y1, y2);
const shouldRenderRect = y1 && y2 && x1 && x2;
return {
props,
children: [children, shouldRenderRect && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().cloneElement(selectionComponent, {
key: `${name}-selection`,
x,
y,
width,
height,
style: selectionStyle
})]
};
};
const VictorySelectionContainer = initialProps => {
const {
props,
children
} = useVictorySelectionContainer(initialProps);
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(victory_core__WEBPACK_IMPORTED_MODULE_2__.VictoryContainer, props, children);
};
VictorySelectionContainer.role = "container";
VictorySelectionContainer.defaultEvents = initialProps => {
const props = {
...VICTORY_SELECTION_CONTAINER_DEFAULT_PROPS,
...initialProps
};
const createEventHandler = (handler, disabled) =>
// eslint-disable-next-line max-params
(event, targetProps, eventKey, context) => disabled || props.disable ? {} : handler(event, {
...props,
...targetProps
}, eventKey, context);
return [{
target: "parent",
eventHandlers: {
onMouseDown: createEventHandler(_selection_helpers__WEBPACK_IMPORTED_MODULE_3__.SelectionHelpers.onMouseDown),
onTouchStart: createEventHandler(_selection_helpers__WEBPACK_IMPORTED_MODULE_3__.SelectionHelpers.onMouseDown),
onMouseMove: createEventHandler(_selection_helpers__WEBPACK_IMPORTED_MODULE_3__.SelectionHelpers.onMouseMove),
onTouchMove: createEventHandler(_selection_helpers__WEBPACK_IMPORTED_MODULE_3__.SelectionHelpers.onMouseMove),
onMouseUp: createEventHandler(_selection_helpers__WEBPACK_IMPORTED_MODULE_3__.SelectionHelpers.onMouseUp),
onTouchEnd: createEventHandler(_selection_helpers__WEBPACK_IMPORTED_MODULE_3__.SelectionHelpers.onMouseUp)
}
}];
};
/***/ }),
/***/ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_SetCache.js":
/*!***********************************************************************************!*\
!*** ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_SetCache.js ***!
\***********************************************************************************/
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
var isArray = __webpack_require__(/*! ./isArray */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isArray.js");
/**
* Casts `value` as an array if it's not one.
*
* @static
* @memberOf _
* @since 4.4.0
* @category Lang
* @param {*} value The value to inspect.
* @returns {Array} Returns the cast array.
* @example
*
* _.castArray(1);
* // => [1]
*
* _.castArray({ 'a': 1 });
* // => [{ 'a': 1 }]
*
* _.castArray('abc');
* // => ['abc']
*
* _.castArray(null);
* // => [null]
*
* _.castArray(undefined);
* // => [undefined]
*
* _.castArray();
* // => []
*
* var array = [1, 2, 3];
* console.log(_.castArray(array) === array);
* // => true
*/
function castArray() {
if (!arguments.length) {
return [];
}
var value = arguments[0];
return isArray(value) ? value : [value];
}
module.exports = castArray;
/***/ }),
/***/ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_Stack.js":
/*!********************************************************************************!*\
!*** ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_Stack.js ***!
\********************************************************************************/
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
var listCacheClear = __webpack_require__(/*! ./_listCacheClear */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_listCacheClear.js"),
listCacheDelete = __webpack_require__(/*! ./_listCacheDelete */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_listCacheDelete.js"),
listCacheGet = __webpack_require__(/*! ./_listCacheGet */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_listCacheGet.js"),
listCacheHas = __webpack_require__(/*! ./_listCacheHas */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_listCacheHas.js"),
listCacheSet = __webpack_require__(/*! ./_listCacheSet */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_listCacheSet.js");
/**
* Creates an list cache object.
*
* @private
* @constructor
* @param {Array} [entries] The key-value pairs to cache.
*/
function ListCache(entries) {
var index = -1,
length = entries == null ? 0 : entries.length;
this.clear();
while (++index < length) {
var entry = entries[index];
this.set(entry[0], entry[1]);
}
}
// Add methods to `ListCache`.
ListCache.prototype.clear = listCacheClear;
ListCache.prototype['delete'] = listCacheDelete;
ListCache.prototype.get = listCacheGet;
ListCache.prototype.has = listCacheHas;
ListCache.prototype.set = listCacheSet;
module.exports = ListCache;
/***/ }),
/***/ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_Symbol.js":
/*!*********************************************************************************!*\
!*** ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_Symbol.js ***!
\*********************************************************************************/
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
var root = __webpack_require__(/*! ./_root */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_root.js");
/** Built-in value references. */
var Symbol = root.Symbol;
module.exports = Symbol;
/***/ }),
/***/ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_apply.js":
/*!********************************************************************************!*\
!*** ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_apply.js ***!
\********************************************************************************/
/***/ (function(module) {
/**
* A faster alternative to `Function#apply`, this function invokes `func`
* with the `this` binding of `thisArg` and the arguments of `args`.
*
* @private
* @param {Function} func The function to invoke.
* @param {*} thisArg The `this` binding of `func`.
* @param {Array} args The arguments to invoke `func` with.
* @returns {*} Returns the result of `func`.
*/
function apply(func, thisArg, args) {
switch (args.length) {
case 0: return func.call(thisArg);
case 1: return func.call(thisArg, args[0]);
case 2: return func.call(thisArg, args[0], args[1]);
case 3: return func.call(thisArg, args[0], args[1], args[2]);
}
return func.apply(thisArg, args);
}
module.exports = apply;
/***/ }),
/***/ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_arrayIncludes.js":
/*!****************************************************************************************!*\
!*** ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_arrayIncludes.js ***!
\****************************************************************************************/
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
var baseIndexOf = __webpack_require__(/*! ./_baseIndexOf */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseIndexOf.js");
/**
* A specialized version of `_.includes` for arrays without support for
* specifying an index to search from.
*
* @private
* @param {Array} [array] The array to inspect.
* @param {*} target The value to search for.
* @returns {boolean} Returns `true` if `target` is found, else `false`.
*/
function arrayIncludes(array, value) {
var length = array == null ? 0 : array.length;
return !!length && baseIndexOf(array, value, 0) > -1;
}
module.exports = arrayIncludes;
/***/ }),
/***/ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_arrayIncludesWith.js":
/*!********************************************************************************************!*\
!*** ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_arrayIncludesWith.js ***!
\********************************************************************************************/
/***/ (function(module) {
/**
* This function is like `arrayIncludes` except that it accepts a comparator.
*
* @private
* @param {Array} [array] The array to inspect.
* @param {*} target The value to search for.
* @param {Function} comparator The comparator invoked per element.
* @returns {boolean} Returns `true` if `target` is found, else `false`.
*/
function arrayIncludesWith(array, value, comparator) {
var index = -1,
length = array == null ? 0 : array.length;
while (++index < length) {
if (comparator(value, array[index])) {
return true;
}
}
return false;
}
module.exports = arrayIncludesWith;
/***/ }),
/***/ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_arrayMap.js":
/*!***********************************************************************************!*\
!*** ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_arrayMap.js ***!
\***********************************************************************************/
/***/ (function(module) {
/**
* A specialized version of `_.map` for arrays without support for iteratee
* shorthands.
*
* @private
* @param {Array} [array] The array to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @returns {Array} Returns the new mapped array.
*/
function arrayMap(array, iteratee) {
var index = -1,
length = array == null ? 0 : array.length,
result = Array(length);
while (++index < length) {
result[index] = iteratee(array[index], index, array);
}
return result;
}
module.exports = arrayMap;
/***/ }),
/***/ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_arrayPush.js":
/*!************************************************************************************!*\
!*** ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_arrayPush.js ***!
\************************************************************************************/
/***/ (function(module) {
/**
* Appends the elements of `values` to `array`.
*
* @private
* @param {Array} array The array to modify.
* @param {Array} values The values to append.
* @returns {Array} Returns `array`.
*/
function arrayPush(array, values) {
var index = -1,
length = values.length,
offset = array.length;
while (++index < length) {
array[offset + index] = values[index];
}
return array;
}
module.exports = arrayPush;
/***/ }),
/***/ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_arraySome.js":
/*!************************************************************************************!*\
!*** ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_arraySome.js ***!
\************************************************************************************/
/***/ (function(module) {
/**
* A specialized version of `_.some` for arrays without support for iteratee
* shorthands.
*
* @private
* @param {Array} [array] The array to iterate over.
* @param {Function} predicate The function invoked per iteration.
* @returns {boolean} Returns `true` if any element passes the predicate check,
* else `false`.
*/
function arraySome(array, predicate) {
var index = -1,
length = array == null ? 0 : array.length;
while (++index < length) {
if (predicate(array[index], index, array)) {
return true;
}
}
return false;
}
module.exports = arraySome;
/***/ }),
/***/ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_assignValue.js":
/*!**************************************************************************************!*\
!*** ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_assignValue.js ***!
\**************************************************************************************/
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
var baseAssignValue = __webpack_require__(/*! ./_baseAssignValue */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseAssignValue.js"),
eq = __webpack_require__(/*! ./eq */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/eq.js");
/** Used for built-in method references. */
var objectProto = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;
/**
* Assigns `value` to `key` of `object` if the existing value is not equivalent
* using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
* for equality comparisons.
*
* @private
* @param {Object} object The object to modify.
* @param {string} key The key of the property to assign.
* @param {*} value The value to assign.
*/
function assignValue(object, key, value) {
var objValue = object[key];
if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
(value === undefined && !(key in object))) {
baseAssignValue(object, key, value);
}
}
module.exports = assignValue;
/***/ }),
/***/ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_assocIndexOf.js":
/*!***************************************************************************************!*\
!*** ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_assocIndexOf.js ***!
\***************************************************************************************/
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
var eq = __webpack_require__(/*! ./eq */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/eq.js");
/**
* Gets the index at which the `key` is found in `array` of key-value pairs.
*
* @private
* @param {Array} array The array to inspect.
* @param {*} key The key to search for.
* @returns {number} Returns the index of the matched value, else `-1`.
*/
function assocIndexOf(array, key) {
var length = array.length;
while (length--) {
if (eq(array[length][0], key)) {
return length;
}
}
return -1;
}
module.exports = assocIndexOf;
/***/ }),
/***/ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseAssignValue.js":
/*!******************************************************************************************!*\
!*** ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseAssignValue.js ***!
\******************************************************************************************/
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
var defineProperty = __webpack_require__(/*! ./_defineProperty */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_defineProperty.js");
/**
* The base implementation of `assignValue` and `assignMergeValue` without
* value checks.
*
* @private
* @param {Object} object The object to modify.
* @param {string} key The key of the property to assign.
* @param {*} value The value to assign.
*/
function baseAssignValue(object, key, value) {
if (key == '__proto__' && defineProperty) {
defineProperty(object, key, {
'configurable': true,
'enumerable': true,
'value': value,
'writable': true
});
} else {
object[key] = value;
}
}
module.exports = baseAssignValue;
/***/ }),
/***/ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseFlatten.js":
/*!**************************************************************************************!*\
!*** ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseFlatten.js ***!
\**************************************************************************************/
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
var arrayPush = __webpack_require__(/*! ./_arrayPush */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_arrayPush.js"),
isFlattenable = __webpack_require__(/*! ./_isFlattenable */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_isFlattenable.js");
/**
* The base implementation of `_.flatten` with support for restricting flattening.
*
* @private
* @param {Array} array The array to flatten.
* @param {number} depth The maximum recursion depth.
* @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
* @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
* @param {Array} [result=[]] The initial result value.
* @returns {Array} Returns the new flattened array.
*/
function baseFlatten(array, depth, predicate, isStrict, result) {
var index = -1,
length = array.length;
predicate || (predicate = isFlattenable);
result || (result = []);
while (++index < length) {
var value = array[index];
if (depth > 0 && predicate(value)) {
if (depth > 1) {
// Recursively flatten arrays (susceptible to call stack limits).
baseFlatten(value, depth - 1, predicate, isStrict, result);
} else {
arrayPush(result, value);
}
} else if (!isStrict) {
result[result.length] = value;
}
}
return result;
}
module.exports = baseFlatten;
/***/ }),
/***/ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseGet.js":
/*!**********************************************************************************!*\
!*** ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseGet.js ***!
\**********************************************************************************/
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
var castPath = __webpack_require__(/*! ./_castPath */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_castPath.js"),
toKey = __webpack_require__(/*! ./_toKey */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_toKey.js");
/**
* The base implementation of `_.get` without support for default values.
*
* @private
* @param {Object} object The object to query.
* @param {Array|string} path The path of the property to get.
* @returns {*} Returns the resolved value.
*/
function baseGet(object, path) {
path = castPath(path, object);
var index = 0,
length = path.length;
while (object != null && index < length) {
object = object[toKey(path[index++])];
}
return (index && index == length) ? object : undefined;
}
module.exports = baseGet;
/***/ }),
/***/ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseGetTag.js":
/*!*************************************************************************************!*\
!*** ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseGetTag.js ***!
\*************************************************************************************/
/***/ (function(module) {
/** 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;
/***/ }),
/***/ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseHasIn.js":
/*!************************************************************************************!*\
!*** ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseHasIn.js ***!
\************************************************************************************/
/***/ (function(module) {
/**
* The base implementation of `_.hasIn` without support for deep paths.
*
* @private
* @param {Object} [object] The object to query.
* @param {Array|string} key The key to check.
* @returns {boolean} Returns `true` if `key` exists, else `false`.
*/
function baseHasIn(object, key) {
return object != null && key in Object(object);
}
module.exports = baseHasIn;
/***/ }),
/***/ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseIndexOf.js":
/*!**************************************************************************************!*\
!*** ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseIndexOf.js ***!
\**************************************************************************************/
/***/ (function(module) {
/**
* A specialized version of `_.indexOf` which performs strict equality
* comparisons of values, i.e. `===`.
*
* @private
* @param {Array} array The array to inspect.
* @param {*} value The value to search for.
* @param {number} fromIndex The index to search from.
* @returns {number} Returns the index of the matched value, else `-1`.
*/
function strictIndexOf(array, value, fromIndex) {
var index = fromIndex - 1,
length = array.length;
while (++index < length) {
if (array[index] === value) {
return index;
}
}
return -1;
}
module.exports = strictIndexOf;
/***/ }),
/***/ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseIsEqual.js":
/*!**************************************************************************************!*\
!*** ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseIsEqual.js ***!
\**************************************************************************************/
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
var baseIsEqualDeep = __webpack_require__(/*! ./_baseIsEqualDeep */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseIsEqualDeep.js"),
isObjectLike = __webpack_require__(/*! ./isObjectLike */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isObjectLike.js");
/**
* The base implementation of `_.isEqual` which supports partial comparisons
* and tracks traversed objects.
*
* @private
* @param {*} value The value to compare.
* @param {*} other The other value to compare.
* @param {boolean} bitmask The bitmask flags.
* 1 - Unordered comparison
* 2 - Partial comparison
* @param {Function} [customizer] The function to customize comparisons.
* @param {Object} [stack] Tracks traversed `value` and `other` objects.
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
*/
function baseIsEqual(value, other, bitmask, customizer, stack) {
if (value === other) {
return true;
}
if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
return value !== value && other !== other;
}
return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
}
module.exports = baseIsEqual;
/***/ }),
/***/ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseIsEqualDeep.js":
/*!******************************************************************************************!*\
!*** ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseIsEqualDeep.js ***!
\******************************************************************************************/
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
var Stack = __webpack_require__(/*! ./_Stack */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_Stack.js"),
equalArrays = __webpack_require__(/*! ./_equalArrays */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_equalArrays.js"),
equalByTag = __webpack_require__(/*! ./_equalByTag */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_equalByTag.js"),
equalObjects = __webpack_require__(/*! ./_equalObjects */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_equalObjects.js"),
getTag = __webpack_require__(/*! ./_getTag */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_getTag.js"),
isArray = __webpack_require__(/*! ./isArray */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isArray.js"),
isBuffer = __webpack_require__(/*! ./isBuffer */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isBuffer.js"),
isTypedArray = __webpack_require__(/*! ./isTypedArray */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isTypedArray.js");
/** Used to compose bitmasks for value comparisons. */
var COMPARE_PARTIAL_FLAG = 1;
/** `Object#toString` result references. */
var argsTag = '[object Arguments]',
arrayTag = '[object Array]',
objectTag = '[object Object]';
/** Used for built-in method references. */
var objectProto = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;
/**
* A specialized version of `baseIsEqual` for arrays and objects which performs
* deep comparisons and tracks traversed objects enabling objects with circular
* references to be compared.
*
* @private
* @param {Object} object The object to compare.
* @param {Object} other The other object to compare.
* @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
* @param {Function} customizer The function to customize comparisons.
* @param {Function} equalFunc The function to determine equivalents of values.
* @param {Object} [stack] Tracks traversed `object` and `other` objects.
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
*/
function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
var objIsArr = isArray(object),
othIsArr = isArray(other),
objTag = objIsArr ? arrayTag : getTag(object),
othTag = othIsArr ? arrayTag : getTag(other);
objTag = objTag == argsTag ? objectTag : objTag;
othTag = othTag == argsTag ? objectTag : othTag;
var objIsObj = objTag == objectTag,
othIsObj = othTag == objectTag,
isSameTag = objTag == othTag;
if (isSameTag && isBuffer(object)) {
if (!isBuffer(other)) {
return false;
}
objIsArr = true;
objIsObj = false;
}
if (isSameTag && !objIsObj) {
stack || (stack = new Stack);
return (objIsArr || isTypedArray(object))
? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
: equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
}
if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
if (objIsWrapped || othIsWrapped) {
var objUnwrapped = objIsWrapped ? object.value() : object,
othUnwrapped = othIsWrapped ? other.value() : other;
stack || (stack = new Stack);
return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
}
}
if (!isSameTag) {
return false;
}
stack || (stack = new Stack);
return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
}
module.exports = baseIsEqualDeep;
/***/ }),
/***/ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseIsMatch.js":
/*!**************************************************************************************!*\
!*** ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseIsMatch.js ***!
\**************************************************************************************/
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
var Stack = __webpack_require__(/*! ./_Stack */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_Stack.js"),
baseIsEqual = __webpack_require__(/*! ./_baseIsEqual */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseIsEqual.js");
/** Used to compose bitmasks for value comparisons. */
var COMPARE_PARTIAL_FLAG = 1,
COMPARE_UNORDERED_FLAG = 2;
/**
* The base implementation of `_.isMatch` without support for iteratee shorthands.
*
* @private
* @param {Object} object The object to inspect.
* @param {Object} source The object of property values to match.
* @param {Array} matchData The property names, values, and compare flags to match.
* @param {Function} [customizer] The function to customize comparisons.
* @returns {boolean} Returns `true` if `object` is a match, else `false`.
*/
function baseIsMatch(object, source, matchData, customizer) {
var index = matchData.length,
length = index,
noCustomizer = !customizer;
if (object == null) {
return !length;
}
object = Object(object);
while (index--) {
var data = matchData[index];
if ((noCustomizer && data[2])
? data[1] !== object[data[0]]
: !(data[0] in object)
) {
return false;
}
}
while (++index < length) {
data = matchData[index];
var key = data[0],
objValue = object[key],
srcValue = data[1];
if (noCustomizer && data[2]) {
if (objValue === undefined && !(key in object)) {
return false;
}
} else {
var stack = new Stack;
if (customizer) {
var result = customizer(objValue, srcValue, key, object, source, stack);
}
if (!(result === undefined
? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack)
: result
)) {
return false;
}
}
}
return true;
}
module.exports = baseIsMatch;
/***/ }),
/***/ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseIteratee.js":
/*!***************************************************************************************!*\
!*** ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseIteratee.js ***!
\***************************************************************************************/
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
var baseMatches = __webpack_require__(/*! ./_baseMatches */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseMatches.js"),
baseMatchesProperty = __webpack_require__(/*! ./_baseMatchesProperty */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseMatchesProperty.js"),
identity = __webpack_require__(/*! ./identity */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/identity.js"),
isArray = __webpack_require__(/*! ./isArray */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isArray.js"),
property = __webpack_require__(/*! ./property */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/property.js");
/**
* The base implementation of `_.iteratee`.
*
* @private
* @param {*} [value=_.identity] The value to convert to an iteratee.
* @returns {Function} Returns the iteratee.
*/
function baseIteratee(value) {
// Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
// See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
if (typeof value == 'function') {
return value;
}
if (value == null) {
return identity;
}
if (typeof value == 'object') {
return isArray(value)
? baseMatchesProperty(value[0], value[1])
: baseMatches(value);
}
return property(value);
}
module.exports = baseIteratee;
/***/ }),
/***/ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseKeys.js":
/*!***********************************************************************************!*\
!*** ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseKeys.js ***!
\***********************************************************************************/
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
var overArg = __webpack_require__(/*! ./_overArg */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_overArg.js");
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeKeys = overArg(Object.keys, Object);
module.exports = nativeKeys;
/***/ }),
/***/ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseMap.js":
/*!**********************************************************************************!*\
!*** ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseMap.js ***!
\**********************************************************************************/
/***/ (function(module) {
/**
* A specialized version of `_.map` for arrays without support for iteratee
* shorthands.
*
* @private
* @param {Array} [array] The array to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @returns {Array} Returns the new mapped array.
*/
function arrayMap(array, iteratee) {
var index = -1,
length = array == null ? 0 : array.length,
result = Array(length);
while (++index < length) {
result[index] = iteratee(array[index], index, array);
}
return result;
}
module.exports = arrayMap;
/***/ }),
/***/ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseMatches.js":
/*!**************************************************************************************!*\
!*** ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseMatches.js ***!
\**************************************************************************************/
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
var baseIsMatch = __webpack_require__(/*! ./_baseIsMatch */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseIsMatch.js"),
getMatchData = __webpack_require__(/*! ./_getMatchData */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_getMatchData.js"),
matchesStrictComparable = __webpack_require__(/*! ./_matchesStrictComparable */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_matchesStrictComparable.js");
/**
* The base implementation of `_.matches` which doesn't clone `source`.
*
* @private
* @param {Object} source The object of property values to match.
* @returns {Function} Returns the new spec function.
*/
function baseMatches(source) {
var matchData = getMatchData(source);
if (matchData.length == 1 && matchData[0][2]) {
return matchesStrictComparable(matchData[0][0], matchData[0][1]);
}
return function(object) {
return object === source || baseIsMatch(object, source, matchData);
};
}
module.exports = baseMatches;
/***/ }),
/***/ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseMatchesProperty.js":
/*!**********************************************************************************************!*\
!*** ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseMatchesProperty.js ***!
\**********************************************************************************************/
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
var baseIsEqual = __webpack_require__(/*! ./_baseIsEqual */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseIsEqual.js"),
get = __webpack_require__(/*! ./get */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/get.js"),
hasIn = __webpack_require__(/*! ./hasIn */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/hasIn.js"),
isKey = __webpack_require__(/*! ./_isKey */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_isKey.js"),
isStrictComparable = __webpack_require__(/*! ./_isStrictComparable */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_isStrictComparable.js"),
matchesStrictComparable = __webpack_require__(/*! ./_matchesStrictComparable */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_matchesStrictComparable.js"),
toKey = __webpack_require__(/*! ./_toKey */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_toKey.js");
/** Used to compose bitmasks for value comparisons. */
var COMPARE_PARTIAL_FLAG = 1,
COMPARE_UNORDERED_FLAG = 2;
/**
* The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
*
* @private
* @param {string} path The path of the property to get.
* @param {*} srcValue The value to match.
* @returns {Function} Returns the new spec function.
*/
function baseMatchesProperty(path, srcValue) {
if (isKey(path) && isStrictComparable(srcValue)) {
return matchesStrictComparable(toKey(path), srcValue);
}
return function(object) {
var objValue = get(object, path);
return (objValue === undefined && objValue === srcValue)
? hasIn(object, path)
: baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
};
}
module.exports = baseMatchesProperty;
/***/ }),
/***/ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseOrderBy.js":
/*!**************************************************************************************!*\
!*** ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseOrderBy.js ***!
\**************************************************************************************/
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
var arrayMap = __webpack_require__(/*! ./_arrayMap */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_arrayMap.js"),
baseGet = __webpack_require__(/*! ./_baseGet */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseGet.js"),
baseIteratee = __webpack_require__(/*! ./_baseIteratee */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseIteratee.js"),
baseMap = __webpack_require__(/*! ./_baseMap */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseMap.js"),
baseSortBy = __webpack_require__(/*! ./_baseSortBy */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseSortBy.js"),
baseUnary = __webpack_require__(/*! ./_baseUnary */ "../../../node_modules/.pnp