UNPKG

victory-canvas

Version:
1,323 lines (1,092 loc) 288 kB
(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["VictoryCanvas"] = factory(require("react")); else root["VictoryCanvas"] = factory(root["React"]); })(self, function(__WEBPACK_EXTERNAL_MODULE_react__) { return /******/ (function() { // webpackBootstrap /******/ var __webpack_modules__ = ({ /***/ "./canvas-bar.tsx": /*!************************!*\ !*** ./canvas-bar.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 */ "CanvasBar": function() { return /* binding */ CanvasBar; } /* 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_bar__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! victory-bar */ "../../victory-bar/es/bar-helper-methods.js"); /* harmony import */ var victory_bar__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! victory-bar */ "../../victory-bar/es/path-helper-methods.js"); /* harmony import */ var _hooks_use_canvas_context__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./hooks/use-canvas-context */ "./hooks/use-canvas-context.ts"); const evaluateProps = props => { /** * Potential evaluated props of following must be evaluated in this order: * 1) `style` * 2) `barWidth` * 3) `cornerRadius` */ const style = (0,victory_bar__WEBPACK_IMPORTED_MODULE_1__.getStyle)(props.style, props); const barWidth = (0,victory_bar__WEBPACK_IMPORTED_MODULE_1__.getBarWidth)(props.barWidth, Object.assign({}, props, { style })); const cornerRadius = (0,victory_bar__WEBPACK_IMPORTED_MODULE_1__.getCornerRadius)(props.cornerRadius, Object.assign({}, props, { style, barWidth })); const modifiedProps = Object.assign({}, props, { style, barWidth, cornerRadius }); return modifiedProps; }; const usePreviousValue = value => { const ref = react__WEBPACK_IMPORTED_MODULE_0___default().useRef(); react__WEBPACK_IMPORTED_MODULE_0___default().useEffect(() => { ref.current = value; }); return ref.current; }; const CanvasBar = props => { const { canvasRef } = (0,_hooks_use_canvas_context__WEBPACK_IMPORTED_MODULE_2__.useCanvasContext)(); const modifiedProps = evaluateProps(props); const { polar, style, barWidth, cornerRadius, origin } = modifiedProps; const path2d = react__WEBPACK_IMPORTED_MODULE_0___default().useMemo(() => { const p = polar ? (0,victory_bar__WEBPACK_IMPORTED_MODULE_3__.getPolarBarPath)(modifiedProps, cornerRadius) : (0,victory_bar__WEBPACK_IMPORTED_MODULE_3__.getBarPath)(modifiedProps, barWidth, cornerRadius); return new Path2D(p); }, [polar, barWidth, cornerRadius, modifiedProps]); const previousPath = usePreviousValue(path2d); const draw = react__WEBPACK_IMPORTED_MODULE_0___default().useCallback((ctx, path) => { ctx.fillStyle = style.fill; ctx.strokeStyle = style.stroke; ctx.globalAlpha = style.fillOpacity; ctx.lineWidth = style.strokeWidth; if (polar) { ctx.translate(origin?.x || 0, origin?.y || 0); } ctx.fill(path); ctx.setTransform(1, 0, 0, 1, 0, 0); }, [style, origin, polar]); // This will clear the previous bar without clearing the entire canvas const clearPreviousPath = react__WEBPACK_IMPORTED_MODULE_0___default().useCallback(ctx => { if (previousPath) { ctx.save(); // This ensures that the entire shape is erased const strokeWidth = style.strokeWidth || 0; ctx.lineWidth = strokeWidth + 2; ctx.globalCompositeOperation = "destination-out"; draw(ctx, previousPath); ctx.stroke(previousPath); ctx.restore(); } }, [draw, previousPath, style]); react__WEBPACK_IMPORTED_MODULE_0___default().useEffect(() => { const ctx = canvasRef.current?.getContext("2d"); if (!ctx) return; clearPreviousPath(ctx); draw(ctx, path2d); }, [canvasRef, draw, polar, barWidth, cornerRadius, modifiedProps, path2d, clearPreviousPath]); return null; }; /***/ }), /***/ "./canvas-curve.tsx": /*!**************************!*\ !*** ./canvas-curve.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 */ "CanvasCurve": function() { return /* binding */ CanvasCurve; } /* 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_2__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-util/line-helpers.js"); /* harmony import */ var _hooks_use_canvas_context__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./hooks/use-canvas-context */ "./hooks/use-canvas-context.ts"); const CanvasCurve = props => { const { canvasRef, clear, clip } = (0,_hooks_use_canvas_context__WEBPACK_IMPORTED_MODULE_1__.useCanvasContext)(); const { style, data } = props; const { stroke, strokeWidth } = style; const draw = react__WEBPACK_IMPORTED_MODULE_0___default().useCallback(ctx => { const line = victory_core__WEBPACK_IMPORTED_MODULE_2__.getLineFunction(props); ctx.strokeStyle = stroke; ctx.lineWidth = strokeWidth; line.context(ctx)(data); ctx.stroke(); }, [data, props, stroke, strokeWidth]); react__WEBPACK_IMPORTED_MODULE_0___default().useEffect(() => { const ctx = canvasRef.current?.getContext("2d"); if (!ctx) return; clear(ctx); draw(ctx); clip(ctx); }, [canvasRef, draw, clear, clip]); return null; }; /***/ }), /***/ "./canvas-group.tsx": /*!**************************!*\ !*** ./canvas-group.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 */ "CanvasGroup": function() { return /* binding */ CanvasGroup; } /* 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 _hooks_use_canvas_context__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./hooks/use-canvas-context */ "./hooks/use-canvas-context.ts"); const CanvasGroup = props => { const canvasRef = react__WEBPACK_IMPORTED_MODULE_0___default().useRef(null); const { children, width = 0, height = 0, clipWidth, padding } = props; const clear = react__WEBPACK_IMPORTED_MODULE_0___default().useCallback(ctx => { return ctx.clearRect(0, 0, width, height); }, [width, height]); // This needs to be called in the child component to ensure it is called after the // shape is drawn const clip = react__WEBPACK_IMPORTED_MODULE_0___default().useCallback(ctx => { const paddingRight = typeof padding === "number" ? padding : padding?.right || 0; const paddingLeft = typeof padding === "number" ? padding : padding?.left || 0; const maxClipWidth = width - paddingRight - paddingLeft; ctx.clearRect(width - paddingRight, 0, clipWidth ? (maxClipWidth - clipWidth) * -1 : 0, height); }, [width, height, padding, clipWidth]); return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_hooks_use_canvas_context__WEBPACK_IMPORTED_MODULE_1__.CanvasContext.Provider, { value: { canvasRef, clear, clip } }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("foreignObject", { width: width, height: height, x: 0, y: 0 }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("canvas", { width: width, height: height, ref: canvasRef })), children); }; CanvasGroup.role = "container"; /***/ }), /***/ "./canvas-point.tsx": /*!**************************!*\ !*** ./canvas-point.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 */ "CanvasPoint": function() { return /* binding */ CanvasPoint; } /* 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-util/point-path-helpers.js"); /* harmony import */ var victory_core__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! victory-core */ "../../victory-core/es/victory-util/helpers.js"); /* harmony import */ var _hooks_use_canvas_context__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./hooks/use-canvas-context */ "./hooks/use-canvas-context.ts"); const getPath = props => { const { x, y, size, symbol } = props; if (props.getPath) { return props.getPath(x, y, size); } const pathFunctions = { circle: victory_core__WEBPACK_IMPORTED_MODULE_1__.circle, square: victory_core__WEBPACK_IMPORTED_MODULE_1__.square, diamond: victory_core__WEBPACK_IMPORTED_MODULE_1__.diamond, triangleDown: victory_core__WEBPACK_IMPORTED_MODULE_1__.triangleDown, triangleUp: victory_core__WEBPACK_IMPORTED_MODULE_1__.triangleUp, plus: victory_core__WEBPACK_IMPORTED_MODULE_1__.plus, minus: victory_core__WEBPACK_IMPORTED_MODULE_1__.minus, star: victory_core__WEBPACK_IMPORTED_MODULE_1__.star, cross: victory_core__WEBPACK_IMPORTED_MODULE_1__.cross }; const symbolFunction = typeof pathFunctions[symbol] === "function" ? pathFunctions[symbol] : pathFunctions.circle; return symbolFunction(x, y, size); }; const evaluateProps = props => { /** * Potential evaluated props are: * `size` * `style` * `symbol` */ const size = victory_core__WEBPACK_IMPORTED_MODULE_2__.evaluateProp(props.size, props); const style = victory_core__WEBPACK_IMPORTED_MODULE_2__.evaluateStyle(props.style, props); const symbol = victory_core__WEBPACK_IMPORTED_MODULE_2__.evaluateProp(props.symbol, props); return Object.assign({}, props, { size, style, symbol }); }; const CanvasPoint = props => { const { canvasRef } = (0,_hooks_use_canvas_context__WEBPACK_IMPORTED_MODULE_3__.useCanvasContext)(); const modifiedProps = evaluateProps(props); const draw = react__WEBPACK_IMPORTED_MODULE_0___default().useCallback(ctx => { const { style } = modifiedProps; const path = getPath(modifiedProps); ctx.fillStyle = style.fill; const path2d = new Path2D(path); ctx.fill(path2d); }, [modifiedProps]); react__WEBPACK_IMPORTED_MODULE_0___default().useEffect(() => { const ctx = canvasRef.current?.getContext("2d"); if (!ctx) return; draw(ctx); // eslint-disable-next-line react-hooks/exhaustive-deps }, []); return null; }; /***/ }), /***/ "./hooks/use-canvas-context.ts": /*!*************************************!*\ !*** ./hooks/use-canvas-context.ts ***! \*************************************/ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "CanvasContext": function() { return /* binding */ CanvasContext; }, /* harmony export */ "useCanvasContext": function() { return /* binding */ useCanvasContext; } /* 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__); const CanvasContext = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createContext(undefined); const useCanvasContext = () => { const context = react__WEBPACK_IMPORTED_MODULE_0___default().useContext(CanvasContext); if (!context) { throw new Error(`This component must be wrapped in a CanvasContext.Provider component. Try setting groupComponent={<CanvasGroup />} in your chart component.`); } return context; }; /***/ }), /***/ "../../../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/_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/_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/_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/_basePick.js": /*!***********************************************************************************!*\ !*** ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_basePick.js ***! \***********************************************************************************/ /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var basePickBy = __webpack_require__(/*! ./_basePickBy */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_basePickBy.js"), hasIn = __webpack_require__(/*! ./hasIn */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/hasIn.js"); /** * The base implementation of `_.pick` without support for individual * property identifiers. * * @private * @param {Object} object The source object. * @param {string[]} paths The property paths to pick. * @returns {Object} Returns the new object. */ function basePick(object, paths) { return basePickBy(object, paths, function(value, path) { return hasIn(object, path); }); } module.exports = basePick; /***/ }), /***/ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_basePickBy.js": /*!*************************************************************************************!*\ !*** ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_basePickBy.js ***! \*************************************************************************************/ /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var baseGet = __webpack_require__(/*! ./_baseGet */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseGet.js"), baseSet = __webpack_require__(/*! ./_baseSet */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseSet.js"), castPath = __webpack_require__(/*! ./_castPath */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_castPath.js"); /** * The base implementation of `_.pickBy` without support for iteratee shorthands. * * @private * @param {Object} object The source object. * @param {string[]} paths The property paths to pick. * @param {Function} predicate The function invoked per property. * @returns {Object} Returns the new object. */ function basePickBy(object, paths, predicate) { var index = -1, length = paths.length, result = {}; while (++index < length) { var path = paths[index], value = baseGet(object, path); if (predicate(value, path)) { baseSet(result, castPath(path, object), value); } } return result; } module.exports = basePickBy; /***/ }), /***/ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseProperty.js": /*!***************************************************************************************!*\ !*** ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseProperty.js ***! \***************************************************************************************/ /***/ (function(module) { /** * The base implementation of `_.property` without support for deep paths. * * @private * @param {string} key The key of the property to get. * @returns {Function} Returns the new accessor function. */ function baseProperty(key) { return function(object) { return object == null ? undefined : object[key]; }; } module.exports = baseProperty; /***/ }), /***/ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_basePropertyDeep.js": /*!*******************************************************************************************!*\ !*** ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_basePropertyDeep.js ***! \*******************************************************************************************/ /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var baseGet = __webpack_require__(/*! ./_baseGet */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseGet.js"); /** * A specialized version of `baseProperty` which supports deep paths. * * @private * @param {Array|string} path The path of the property to get. * @returns {Function} Returns the new accessor function. */ function basePropertyDeep(path) { return function(object) { return baseGet(object, path); }; } module.exports = basePropertyDeep; /***/ }), /***/ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseRest.js": /*!***********************************************************************************!*\ !*** ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseRest.js ***! \***********************************************************************************/ /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var identity = __webpack_require__(/*! ./identity */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/identity.js"), overRest = __webpack_require__(/*! ./_overRest */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_overRest.js"), setToString = __webpack_require__(/*! ./_setToString */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_setToString.js"); /** * The base implementation of `_.rest` which doesn't validate or coerce arguments. * * @private * @param {Function} func The function to apply a rest parameter to. * @param {number} [start=func.length-1] The start position of the rest parameter. * @returns {Function} Returns the new function. */ function baseRest(func, start) { return setToString(overRest(func, start, identity), func + ''); } module.exports = baseRest; /***/ }), /***/ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseSet.js": /*!**********************************************************************************!*\ !*** ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseSet.js ***! \**********************************************************************************/ /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var assignValue = __webpack_require__(/*! ./_assignValue */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_assignValue.js"), castPath = __webpack_require__(/*! ./_castPath */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_castPath.js"), isIndex = __webpack_require__(/*! ./_isIndex */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_isIndex.js"), isObject = __webpack_require__(/*! ./isObject */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isObject.js"), toKey = __webpack_require__(/*! ./_toKey */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_toKey.js"); /** * The base implementation of `_.set`. * * @private * @param {Object} object The object to modify. * @param {Array|string} path The path of the property to set. * @param {*} value The value to set. * @param {Function} [customizer] The function to customize path creation. * @returns {Object} Returns `object`. */ function baseSet(object, path, value, customizer) { if (!isObject(object)) { return object; } path = castPath(path, object); var index = -1, length = path.length, lastIndex = length - 1, nested = object; while (nested != null && ++index < length) { var key = toKey(path[index]), newValue = value; if (key === '__proto__' || key === 'constructor' || key === 'prototype') { return object; } if (index != lastIndex) { var objValue = nested[key]; newValue = customizer ? customizer(objValue, key, nested) : undefined; if (newValue === undefined) { newValue = isObject(objValue) ? objValue : (isIndex(path[index + 1]) ? [] : {}); } } assignValue(nested, key, newValue); nested = nested[key]; } return object; } module.exports = baseSet; /***/ }), /***/ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseToString.js": /*!***************************************************************************************!*\ !*** ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseToString.js ***! \***************************************************************************************/ /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var Symbol = __webpack_require__(/*! ./_Symbol */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_Symbol.js"), arrayMap = __webpack_require__(/*! ./_arrayMap */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_arrayMap.js"), isArray = __webpack_require__(/*! ./isArray */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isArray.js"), isSymbol = __webpack_require__(/*! ./isSymbol */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isSymbol.js"); /** Used as references for various `Number` constants. */ var INFINITY = 1 / 0; /** Used to convert symbols to primitives and strings. */ var symbolProto = Symbol ? Symbol.prototype : undefined, symbolToString = symbolProto ? symbolProto.toString : undefined; /** * The base implementation of `_.toString` which doesn't convert nullish * values to empty strings. * * @private * @param {*} value The value to process. * @returns {string} Returns the string. */ function baseToString(value) { // Exit early for strings to avoid a performance hit in some environments. if (typeof value == 'string') { return value; } if (isArray(value)) { // Recursively convert values (susceptible to call stack limits). return arrayMap(value, baseToString) + ''; } if (isSymbol(value)) { return symbolToString ? symbolToString.call(value) : ''; } var result = (value + ''); return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; } module.exports = baseToString; /***/ }), /***/ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_castPath.js": /*!***********************************************************************************!*\ !*** ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_castPath.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"), isKey = __webpack_require__(/*! ./_isKey */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_isKey.js"), stringToPath = __webpack_require__(/*! ./_stringToPath */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_stringToPath.js"), toString = __webpack_require__(/*! ./toString */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/toString.js"); /** * Casts `value` to a path array if it's not one. * * @private * @param {*} value The value to inspect. * @param {Object} [object] The object to query keys on. * @returns {Array} Returns the cast property path array. */ function castPath(value, object) { if (isArray(value)) { return value; } return isKey(value, object) ? [value] : stringToPath(toString(value)); } module.exports = castPath; /***/ }), /***/ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_defineProperty.js": /*!*****************************************************************************************!*\ !*** ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_defineProperty.js ***! \*****************************************************************************************/ /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var getNative = __webpack_require__(/*! ./_getNative */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_getNative.js"); var defineProperty = (function() { try { var func = getNative(Object, 'defineProperty'); func({}, '', {}); return func; } catch (e) {} }()); module.exports = defineProperty; /***/ }), /***/ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_flatRest.js": /*!***********************************************************************************!*\ !*** ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_flatRest.js ***! \***********************************************************************************/ /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var flatten = __webpack_require__(/*! ./flatten */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/flatten.js"), overRest = __webpack_require__(/*! ./_overRest */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_overRest.js"), setToString = __webpack_require__(/*! ./_setToString */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_setToString.js"); /** * A specialized version of `baseRest` which flattens the rest array. * * @private * @param {Function} func The function to apply a rest parameter to. * @returns {Function} Returns the new function. */ function flatRest(func) { return setToString(overRest(func, undefined, flatten), func + ''); } module.exports = flatRest; /***/ }), /***/ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_freeGlobal.js": /*!*************************************************************************************!*\ !*** ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_freeGlobal.js ***! \*************************************************************************************/ /***/ (function(module, __unused_webpack_exports, __webpack_require__) { /** Detect free variable `global` from Node.js. */ var freeGlobal = typeof __webpack_require__.g == 'object' && __webpack_require__.g && __webpack_require__.g.Object === Object && __webpack_require__.g; module.exports = freeGlobal; /***/ }), /***/ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_getNative.js": /*!************************************************************************************!*\ !*** ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_getNative.js ***! \************************************************************************************/ /***/ (function(module) { /** * Gets the value at `key` of `object`. * * @private * @param {Object} [object] The object to query. * @param {string} key The key of the property to get. * @returns {*} Returns the property value. */ function getValue(object, key) { return object == null ? undefined : object[key]; } module.exports = getValue; /***/ }), /***/ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_getPrototype.js": /*!***************************************************************************************!*\ !*** ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_getPrototype.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 value references. */ var getPrototype = overArg(Object.getPrototypeOf, Object); module.exports = getPrototype; /***/ }), /***/ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_hasPath.js": /*!**********************************************************************************!*\ !*** ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_hasPath.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"), isArguments = __webpack_require__(/*! ./isArguments */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isArguments.js"), isArray = __webpack_require__(/*! ./isArray */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isArray.js"), isIndex = __webpack_require__(/*! ./_isIndex */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_isIndex.js"), isLength = __webpack_require__(/*! ./isLength */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isLength.js"), toKey = __webpack_require__(/*! ./_toKey */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_toKey.js"); /** * Checks if `path` exists on `object`. * * @private * @param {Object} object The object to query. * @param {Array|string} path The path to check. * @param {Function} hasFunc The function to check properties. * @returns {boolean} Returns `true` if `path` exists, else `false`. */ function hasPath(object, path, hasFunc) { path = castPath(path, object); var index = -1, length = path.length, result = false; while (++index < length) { var key = toKey(path[index]); if (!(result = object != null && hasFunc(object, key))) { break; } object = object[key]; } if (result || ++index != length) { return result; } length = object == null ? 0 : object.length; return !!length && isLength(length) && isIndex(key, length) && (isArray(object) || isArguments(object)); } module.exports = hasPath; /***/ }), /***/ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_isFlattenable.js": /*!****************************************************************************************!*\ !*** ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_isFlattenable.js ***! \****************************************************************************************/ /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var Symbol = __webpack_require__(/*! ./_Symbol */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_Symbol.js"), isArguments = __webpack_require__(/*! ./isArguments */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isArguments.js"), isArray = __webpack_require__(/*! ./isArray */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isArray.js"); /** Built-in value references. */ var spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined; /** * Checks if `value` is a flattenable `arguments` object or array. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is flattenable, else `false`. */ function isFlattenable(value) { return isArray(value) || isArguments(value) || !!(spreadableSymbol && value && value[spreadableSymbol]); } module.exports = isFlattenable; /***/ }), /***/ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_isIndex.js": /*!**********************************************************************************!*\ !*** ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_isIndex.js ***! \**********************************************************************************/ /***/ (function(module) { /** Used as references for various `Number` constants. */ var MAX_SAFE_INTEGER = 9007199254740991; /** Used to detect unsigned integer values. */ var reIsUint = /^(?:0|[1-9]\d*)$/; /** * Checks if `value` is a valid array-like index. * * @private * @param {*} value The value to check. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. */ function isIndex(value, length) { var type = typeof value; length = length == null ? MAX_SAFE_INTEGER : length; return !!length && (type == 'number' || (type != 'symbol' && reIsUint.test(value))) && (value > -1 && value % 1 == 0 && value < length); } module.exports = isIndex; /***/ }), /***/ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_isIterateeCall.js": /*!*****************************************************************************************!*\ !*** ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_isIterateeCall.js ***! \*****************************************************************************************/ /***/ (function(module) { /** * This method returns `false`. * * @static * @memberOf _ * @since 4.13.0 * @category Util * @returns {boolean} Returns `false`. * @example * * _.times(2, _.stubFalse); * // => [false, false] */ function stubFalse() { return false; } module.exports = stubFalse; /***/ }), /***/ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_isKey.js": /*!********************************************************************************!*\ !*** ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_isKey.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"), isSymbol = __webpack_require__(/*! ./isSymbol */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isSymbol.js"); /** Used to match property names within property paths. */ var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, reIsPlainProp = /^\w*$/; /** * Checks if `value` is a property name and not a property path. * * @private * @param {*} value The value to check. * @param {Object} [object] The object to query keys on. * @returns {boolean} Returns `true` if `value` is a property name, else `false`. */ function isKey(value, object) { if (isArray(value)) { return false; } var type = typeof value; if (type == 'number' || type == 'symbol' || type == 'boolean' || value == null || isSymbol(value)) { return true; } return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || (object != null && value in Object(object)); } module.exports = isKey; /***/ }), /***/ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_memoizeCapped.js": /*!****************************************************************************************!*\ !*** ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_memoizeCapped.js ***! \****************************************************************************************/ /***/ (function(module) { /** * This method returns the first argument it receives. * * @static * @since 0.1.0 * @memberOf _ * @category Util * @param {*} value Any value. * @returns {*} Returns `value`. * @example * * var object = { 'a': 1 }; * * console.log(_.identity(object) === object); * // => true */ function identity(value) { return value; } module.exports = identity; /***/ }), /***/ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_overArg.js": /*!**********************************************************************************!*\ !*** ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_overArg.js ***! \**********************************************************************************/ /***/ (function(module) { /** * Creates a unary function that invokes `func` with its argument transformed. * * @private * @param {Function} func The function to wrap. * @param {Function} transform The argument transform. * @returns {Function} Returns the new function. */ function overArg(func, transform) { return function(arg) { return func(transform(arg)); }; } module.exports = overArg; /***/ }), /***/ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_overRest.js": /*!***********************************************************************************!*\ !*** ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_overRest.js ***! \***********************************************************************************/ /***/ (function(module, __unused_webpack_exports, __webpack_require__) { var apply = __webpack_require__(/*! ./_apply */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_apply.js"); /* Built-in method references for those with the same name as other `lodash` methods. */ var nativeMax = Math.max; /** * A specialized version of `baseRest` which transforms the rest array. * * @private * @param {Function} func The function to apply a rest parameter to. * @param {number} [start=func.length-1] The start position of the rest parameter. * @param {Function} transform The rest array transform. * @returns {Function} Returns the new function. */ function overRest(func, start, transform) { start = nativeMax(start === undefined ? (func.length - 1) : start, 0); return function() { var args = arguments, index = -1, length = nativeMax(args.length - start, 0), array = Array(length); while (++index < length) { array[index] = args[start + index]; } index = -1; var otherArgs = Array(start + 1); while (++index < start) { otherArgs[index] = args[index]; } otherArgs[start] = transform(array); return apply(func, this, otherArgs); }; } module.exports = overRest; /***/ }), /***/ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_root.js": /*!*******************************************************************************!*\ !*** ../../../node_modules/.pnpm/lodas