Initial commit: Crypto trader application

This commit is contained in:
2025-12-25 20:20:40 -05:00
commit 07a04c1bb8
47895 changed files with 2042266 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
var defaultGenerator = function defaultGenerator(componentName) {
return componentName;
};
var createClassNameGenerator = function createClassNameGenerator() {
var _generate = defaultGenerator;
return {
configure: function configure(generator) {
_generate = generator;
},
generate: function generate(componentName) {
return _generate(componentName);
},
reset: function reset() {
_generate = defaultGenerator;
}
};
};
var ClassNameGenerator = createClassNameGenerator();
export default ClassNameGenerator;

View File

@@ -0,0 +1 @@
export { default } from './ClassNameGenerator';

View File

@@ -0,0 +1,14 @@
export default function HTMLElementType(props, propName, componentName, location, propFullName) {
if (process.env.NODE_ENV === 'production') {
return null;
}
var propValue = props[propName];
var safePropName = propFullName || propName;
if (propValue == null) {
return null;
}
if (propValue && propValue.nodeType !== 1) {
return new Error("Invalid ".concat(location, " `").concat(safePropName, "` supplied to `").concat(componentName, "`. ") + "Expected an HTMLElement.");
}
return null;
}

View File

@@ -0,0 +1 @@
export { default } from './HTMLElementType';

View File

@@ -0,0 +1,25 @@
import _extends from "@babel/runtime/helpers/esm/extends";
import isHostComponent from '../isHostComponent';
/**
* Type of the ownerState based on the type of an element it applies to.
* This resolves to the provided OwnerState for React components and `undefined` for host components.
* Falls back to `OwnerState | undefined` when the exact type can't be determined in development time.
*/
/**
* Appends the ownerState object to the props, merging with the existing one if necessary.
*
* @param elementType Type of the element that owns the `existingProps`. If the element is a DOM node or undefined, `ownerState` is not applied.
* @param otherProps Props of the element.
* @param ownerState
*/
function appendOwnerState(elementType, otherProps, ownerState) {
if (elementType === undefined || isHostComponent(elementType)) {
return otherProps;
}
return _extends({}, otherProps, {
ownerState: _extends({}, otherProps.ownerState, ownerState)
});
}
export default appendOwnerState;

View File

@@ -0,0 +1 @@
export { default } from './appendOwnerState';

View File

@@ -0,0 +1,11 @@
import _formatMuiErrorMessage from "@mui/utils/formatMuiErrorMessage";
// It should to be noted that this function isn't equivalent to `text-transform: capitalize`.
//
// A strict capitalization should uppercase the first letter of each word in the sentence.
// We only handle the first word.
export default function capitalize(string) {
if (typeof string !== 'string') {
throw new Error(process.env.NODE_ENV !== "production" ? "MUI: `capitalize(string)` expects a string argument." : _formatMuiErrorMessage(7));
}
return string.charAt(0).toUpperCase() + string.slice(1);
}

View File

@@ -0,0 +1 @@
export { default } from './capitalize';

View File

@@ -0,0 +1,10 @@
export default function chainPropTypes(propType1, propType2) {
if (process.env.NODE_ENV === 'production') {
return function () {
return null;
};
}
return function validate() {
return propType1.apply(void 0, arguments) || propType2.apply(void 0, arguments);
};
}

View File

@@ -0,0 +1 @@
export { default } from './chainPropTypes';

View File

@@ -0,0 +1,6 @@
function clamp(val) {
var min = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Number.MIN_SAFE_INTEGER;
var max = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : Number.MAX_SAFE_INTEGER;
return Math.max(min, Math.min(val, max));
}
export default clamp;

View File

@@ -0,0 +1 @@
export { default } from './clamp';

View File

@@ -0,0 +1,22 @@
export default function composeClasses(slots, getUtilityClass) {
var classes = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined;
var output = {};
Object.keys(slots).forEach(
// `Object.keys(slots)` can't be wider than `T` because we infer `T` from `slots`.
// @ts-expect-error https://github.com/microsoft/TypeScript/pull/12253#issuecomment-263132208
function (slot) {
output[slot] = slots[slot].reduce(function (acc, key) {
if (key) {
var utilityClass = getUtilityClass(key);
if (utilityClass !== '') {
acc.push(utilityClass);
}
if (classes && classes[key]) {
acc.push(classes[key]);
}
}
return acc;
}, []).join(' ');
});
return output;
}

View File

@@ -0,0 +1 @@
export { default } from './composeClasses';

View File

@@ -0,0 +1,23 @@
/**
* Safe chained function.
*
* Will only create a new function if needed,
* otherwise will pass back existing functions or null.
*/
export default function createChainedFunction() {
for (var _len = arguments.length, funcs = new Array(_len), _key = 0; _key < _len; _key++) {
funcs[_key] = arguments[_key];
}
return funcs.reduce(function (acc, func) {
if (func == null) {
return acc;
}
return function chainedFunction() {
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
args[_key2] = arguments[_key2];
}
acc.apply(this, args);
func.apply(this, args);
};
}, function () {});
}

View File

@@ -0,0 +1 @@
export { default } from './createChainedFunction';

View File

@@ -0,0 +1,22 @@
// Corresponds to 10 frames at 60 Hz.
// A few bytes payload overhead when lodash/debounce is ~3 kB and debounce ~300 B.
export default function debounce(func) {
var wait = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 166;
var timeout;
function debounced() {
var _this = this;
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
var later = function later() {
// @ts-ignore
func.apply(_this, args);
};
clearTimeout(timeout);
timeout = setTimeout(later, wait);
}
debounced.clear = function () {
clearTimeout(timeout);
};
return debounced;
}

View File

@@ -0,0 +1,2 @@
export { default } from './debounce';
export * from './debounce';

View File

@@ -0,0 +1,45 @@
import _extends from "@babel/runtime/helpers/esm/extends";
import _typeof from "@babel/runtime/helpers/esm/typeof";
import * as React from 'react';
// https://github.com/sindresorhus/is-plain-obj/blob/main/index.js
export function isPlainObject(item) {
if (_typeof(item) !== 'object' || item === null) {
return false;
}
var prototype = Object.getPrototypeOf(item);
return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in item) && !(Symbol.iterator in item);
}
function deepClone(source) {
if ( /*#__PURE__*/React.isValidElement(source) || !isPlainObject(source)) {
return source;
}
var output = {};
Object.keys(source).forEach(function (key) {
output[key] = deepClone(source[key]);
});
return output;
}
export default function deepmerge(target, source) {
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
clone: true
};
var output = options.clone ? _extends({}, target) : target;
if (isPlainObject(target) && isPlainObject(source)) {
Object.keys(source).forEach(function (key) {
if ( /*#__PURE__*/React.isValidElement(source[key])) {
output[key] = source[key];
} else if (isPlainObject(source[key]) &&
// Avoid prototype pollution
Object.prototype.hasOwnProperty.call(target, key) && isPlainObject(target[key])) {
// Since `output` is a clone of `target` and we have narrowed `target` in this block we can cast to the same type.
output[key] = deepmerge(target[key], source[key], options);
} else if (options.clone) {
output[key] = isPlainObject(source[key]) ? deepClone(source[key]) : source[key];
} else {
output[key] = source[key];
}
});
}
return output;
}

View File

@@ -0,0 +1,2 @@
export { default } from './deepmerge';
export * from './deepmerge';

View File

@@ -0,0 +1,15 @@
export default function deprecatedPropType(validator, reason) {
if (process.env.NODE_ENV === 'production') {
return function () {
return null;
};
}
return function (props, propName, componentName, location, propFullName) {
var componentNameSafe = componentName || '<<anonymous>>';
var propFullNameSafe = propFullName || propName;
if (typeof props[propName] !== 'undefined') {
return new Error("The ".concat(location, " `").concat(propFullNameSafe, "` of ") + "`".concat(componentNameSafe, "` is deprecated. ").concat(reason));
}
return null;
};
}

View File

@@ -0,0 +1 @@
export { default } from './deprecatedPropType';

View File

@@ -0,0 +1,41 @@
import PropTypes from 'prop-types';
import chainPropTypes from '../chainPropTypes';
function isClassComponent(elementType) {
// elementType.prototype?.isReactComponent
var _elementType$prototyp = elementType.prototype,
prototype = _elementType$prototyp === void 0 ? {} : _elementType$prototyp;
return Boolean(prototype.isReactComponent);
}
function acceptingRef(props, propName, componentName, location, propFullName) {
var element = props[propName];
var safePropName = propFullName || propName;
if (element == null ||
// When server-side rendering React doesn't warn either.
// This is not an accurate check for SSR.
// This is only in place for Emotion compat.
// TODO: Revisit once https://github.com/facebook/react/issues/20047 is resolved.
typeof window === 'undefined') {
return null;
}
var warningHint;
var elementType = element.type;
/**
* Blacklisting instead of whitelisting
*
* Blacklisting will miss some components, such as React.Fragment. Those will at least
* trigger a warning in React.
* We can't whitelist because there is no safe way to detect React.forwardRef
* or class components. "Safe" means there's no public API.
*
*/
if (typeof elementType === 'function' && !isClassComponent(elementType)) {
warningHint = 'Did you accidentally use a plain function component for an element instead?';
}
if (warningHint !== undefined) {
return new Error("Invalid ".concat(location, " `").concat(safePropName, "` supplied to `").concat(componentName, "`. ") + "Expected an element that can hold a ref. ".concat(warningHint, " ") + 'For more information see https://mui.com/r/caveat-with-refs-guide');
}
return null;
}
var elementAcceptingRef = chainPropTypes(PropTypes.element, acceptingRef);
elementAcceptingRef.isRequired = chainPropTypes(PropTypes.element.isRequired, acceptingRef);
export default elementAcceptingRef;

View File

@@ -0,0 +1 @@
export { default } from './elementAcceptingRef';

View File

@@ -0,0 +1,39 @@
import PropTypes from 'prop-types';
import chainPropTypes from '../chainPropTypes';
function isClassComponent(elementType) {
// elementType.prototype?.isReactComponent
var _elementType$prototyp = elementType.prototype,
prototype = _elementType$prototyp === void 0 ? {} : _elementType$prototyp;
return Boolean(prototype.isReactComponent);
}
function elementTypeAcceptingRef(props, propName, componentName, location, propFullName) {
var propValue = props[propName];
var safePropName = propFullName || propName;
if (propValue == null ||
// When server-side rendering React doesn't warn either.
// This is not an accurate check for SSR.
// This is only in place for emotion compat.
// TODO: Revisit once https://github.com/facebook/react/issues/20047 is resolved.
typeof window === 'undefined') {
return null;
}
var warningHint;
/**
* Blacklisting instead of whitelisting
*
* Blacklisting will miss some components, such as React.Fragment. Those will at least
* trigger a warning in React.
* We can't whitelist because there is no safe way to detect React.forwardRef
* or class components. "Safe" means there's no public API.
*
*/
if (typeof propValue === 'function' && !isClassComponent(propValue)) {
warningHint = 'Did you accidentally provide a plain function component instead?';
}
if (warningHint !== undefined) {
return new Error("Invalid ".concat(location, " `").concat(safePropName, "` supplied to `").concat(componentName, "`. ") + "Expected an element type that can hold a ref. ".concat(warningHint, " ") + 'For more information see https://mui.com/r/caveat-with-refs-guide');
}
return null;
}
export default chainPropTypes(PropTypes.elementType, elementTypeAcceptingRef);

View File

@@ -0,0 +1 @@
export { default } from './elementTypeAcceptingRef';

View File

@@ -0,0 +1,23 @@
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
import _extends from "@babel/runtime/helpers/esm/extends";
// This module is based on https://github.com/airbnb/prop-types-exact repository.
// However, in order to reduce the number of dependencies and to remove some extra safe checks
// the module was forked.
var specialProperty = "exact-prop: \u200B";
export default function exactProp(propTypes) {
if (process.env.NODE_ENV === 'production') {
return propTypes;
}
return _extends({}, propTypes, _defineProperty({}, specialProperty, function (props) {
var unsupportedProps = Object.keys(props).filter(function (prop) {
return !propTypes.hasOwnProperty(prop);
});
if (unsupportedProps.length > 0) {
return new Error("The following props are not supported: ".concat(unsupportedProps.map(function (prop) {
return "`".concat(prop, "`");
}).join(', '), ". Please remove them."));
}
return null;
}));
}

View File

@@ -0,0 +1 @@
export { default } from './exactProp';

View File

@@ -0,0 +1,21 @@
/**
* Extracts event handlers from a given object.
* A prop is considered an event handler if it is a function and its name starts with `on`.
*
* @param object An object to extract event handlers from.
* @param excludeKeys An array of keys to exclude from the returned object.
*/
function extractEventHandlers(object) {
var excludeKeys = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
if (object === undefined) {
return {};
}
var result = {};
Object.keys(object).filter(function (prop) {
return prop.match(/^on[A-Z]/) && typeof object[prop] === 'function' && !excludeKeys.includes(prop);
}).forEach(function (prop) {
result[prop] = object[prop];
});
return result;
}
export default extractEventHandlers;

View File

@@ -0,0 +1 @@
export { default } from './extractEventHandlers';

View File

@@ -0,0 +1,19 @@
/**
* WARNING: Don't import this directly.
* Use `MuiError` from `@mui/internal-babel-macros/MuiError.macro` instead.
* @param {number} code
*/
export default function formatMuiErrorMessage(code) {
// Apply babel-plugin-transform-template-literals in loose mode
// loose mode is safe if we're concatenating primitives
// see https://babeljs.io/docs/en/babel-plugin-transform-template-literals#loose
/* eslint-disable prefer-template */
var url = 'https://mui.com/production-error/?code=' + code;
for (var i = 1; i < arguments.length; i += 1) {
// rest params over-transpile for this case
// eslint-disable-next-line prefer-rest-params
url += '&args[]=' + encodeURIComponent(arguments[i]);
}
return 'Minified MUI error #' + code + '; visit ' + url + ' for the full message.';
/* eslint-enable prefer-template */
}

View File

@@ -0,0 +1 @@
export { default } from './formatMuiErrorMessage';

View File

@@ -0,0 +1,23 @@
import ClassNameGenerator from '../ClassNameGenerator';
export var globalStateClasses = {
active: 'active',
checked: 'checked',
completed: 'completed',
disabled: 'disabled',
error: 'error',
expanded: 'expanded',
focused: 'focused',
focusVisible: 'focusVisible',
open: 'open',
readOnly: 'readOnly',
required: 'required',
selected: 'selected'
};
export default function generateUtilityClass(componentName, slot) {
var globalStatePrefix = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'Mui';
var globalStateClass = globalStateClasses[slot];
return globalStateClass ? "".concat(globalStatePrefix, "-").concat(globalStateClass) : "".concat(ClassNameGenerator.generate(componentName), "-").concat(slot);
}
export function isGlobalState(slot) {
return globalStateClasses[slot] !== undefined;
}

View File

@@ -0,0 +1,2 @@
export { default } from './generateUtilityClass';
export * from './generateUtilityClass';

View File

@@ -0,0 +1,9 @@
import generateUtilityClass from '../generateUtilityClass';
export default function generateUtilityClasses(componentName, slots) {
var globalStatePrefix = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'Mui';
var result = {};
slots.forEach(function (slot) {
result[slot] = generateUtilityClass(componentName, slot, globalStatePrefix);
});
return result;
}

View File

@@ -0,0 +1 @@
export { default } from './generateUtilityClasses';

View File

@@ -0,0 +1,49 @@
import _typeof from "@babel/runtime/helpers/esm/typeof";
import { ForwardRef, Memo } from 'react-is';
// Simplified polyfill for IE11 support
// https://github.com/JamesMGreene/Function.name/blob/58b314d4a983110c3682f1228f845d39ccca1817/Function.name.js#L3
var fnNameMatchRegex = /^\s*function(?:\s|\s*\/\*.*\*\/\s*)+([^(\s/]*)\s*/;
export function getFunctionName(fn) {
var match = "".concat(fn).match(fnNameMatchRegex);
var name = match && match[1];
return name || '';
}
function getFunctionComponentName(Component) {
var fallback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
return Component.displayName || Component.name || getFunctionName(Component) || fallback;
}
function getWrappedName(outerType, innerType, wrapperName) {
var functionName = getFunctionComponentName(innerType);
return outerType.displayName || (functionName !== '' ? "".concat(wrapperName, "(").concat(functionName, ")") : wrapperName);
}
/**
* cherry-pick from
* https://github.com/facebook/react/blob/769b1f270e1251d9dbdce0fcbd9e92e502d059b8/packages/shared/getComponentName.js
* originally forked from recompose/getDisplayName with added IE11 support
*/
export default function getDisplayName(Component) {
if (Component == null) {
return undefined;
}
if (typeof Component === 'string') {
return Component;
}
if (typeof Component === 'function') {
return getFunctionComponentName(Component, 'Component');
}
// TypeScript can't have components as objects but they exist in the form of `memo` or `Suspense`
if (_typeof(Component) === 'object') {
switch (Component.$$typeof) {
case ForwardRef:
return getWrappedName(Component, Component.render, 'ForwardRef');
case Memo:
return getWrappedName(Component, Component.type, 'memo');
default:
return undefined;
}
}
return undefined;
}

View File

@@ -0,0 +1,2 @@
export { default } from './getDisplayName';
export * from './getDisplayName';

View File

@@ -0,0 +1,19 @@
import * as React from 'react';
/**
* Returns the ref of a React element handling differences between React 19 and older versions.
* It will throw runtime error if the element is not a valid React element.
*
* @param element React.ReactElement
* @returns React.Ref<any> | null
*/
export default function getReactElementRef(element) {
// 'ref' is passed as prop in React 19, whereas 'ref' is directly attached to children in older versions
if (parseInt(React.version, 10) >= 19) {
var _element$props;
return (element == null || (_element$props = element.props) == null ? void 0 : _element$props.ref) || null;
}
// @ts-expect-error element.ref is not included in the ReactElement type
// https://github.com/DefinitelyTyped/DefinitelyTyped/discussions/70189
return (element == null ? void 0 : element.ref) || null;
}

View File

@@ -0,0 +1 @@
export { default } from './getReactElementRef';

View File

@@ -0,0 +1,7 @@
// A change of the browser zoom change the scrollbar size.
// Credit https://github.com/twbs/bootstrap/blob/488fd8afc535ca3a6ad4dc581f5e89217b6a36ac/js/src/util/scrollbar.js#L14-L18
export default function getScrollbarSize(doc) {
// https://developer.mozilla.org/en-US/docs/Web/API/Window/innerWidth#usage_notes
var documentWidth = doc.documentElement.clientWidth;
return Math.abs(window.innerWidth - documentWidth);
}

View File

@@ -0,0 +1 @@
export { default } from './getScrollbarSize';

View File

@@ -0,0 +1,13 @@
import * as React from 'react';
/**
* Gets only the valid children of a component,
* and ignores any nullish or falsy child.
*
* @param children the children
*/
export default function getValidReactChildren(children) {
return React.Children.toArray(children).filter(function (child) {
return /*#__PURE__*/React.isValidElement(child);
});
}

View File

@@ -0,0 +1 @@
export { default } from './getValidReactChildren';

56
frontend/node_modules/@mui/utils/legacy/index.js generated vendored Normal file
View File

@@ -0,0 +1,56 @@
/**
* @mui/utils v5.17.1
*
* @license MIT
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
export { default as chainPropTypes } from './chainPropTypes';
export { default as deepmerge } from './deepmerge';
export { isPlainObject } from './deepmerge';
export { default as elementAcceptingRef } from './elementAcceptingRef';
export { default as elementTypeAcceptingRef } from './elementTypeAcceptingRef';
export { default as exactProp } from './exactProp';
export { default as formatMuiErrorMessage } from './formatMuiErrorMessage';
export { default as getDisplayName } from './getDisplayName';
export { default as HTMLElementType } from './HTMLElementType';
export { default as ponyfillGlobal } from './ponyfillGlobal';
export { default as refType } from './refType';
export { default as unstable_capitalize } from './capitalize';
export { default as unstable_createChainedFunction } from './createChainedFunction';
export { default as unstable_debounce } from './debounce';
export { default as unstable_deprecatedPropType } from './deprecatedPropType';
export { default as unstable_isMuiElement } from './isMuiElement';
export { default as unstable_ownerDocument } from './ownerDocument';
export { default as unstable_ownerWindow } from './ownerWindow';
export { default as unstable_requirePropFactory } from './requirePropFactory';
export { default as unstable_setRef } from './setRef';
export { default as unstable_useEnhancedEffect } from './useEnhancedEffect';
export { default as unstable_useId } from './useId';
export { default as unstable_unsupportedProp } from './unsupportedProp';
export { default as unstable_useControlled } from './useControlled';
export { default as unstable_useEventCallback } from './useEventCallback';
export { default as unstable_useForkRef } from './useForkRef';
export { default as unstable_useLazyRef } from './useLazyRef';
export { default as unstable_useTimeout, Timeout as unstable_Timeout } from './useTimeout';
export { default as unstable_useOnMount } from './useOnMount';
export { default as unstable_useIsFocusVisible } from './useIsFocusVisible';
export { default as unstable_getScrollbarSize } from './getScrollbarSize';
export { detectScrollType as unstable_detectScrollType, getNormalizedScrollLeft as unstable_getNormalizedScrollLeft } from './scrollLeft';
export { default as usePreviousProps } from './usePreviousProps';
export { default as getValidReactChildren } from './getValidReactChildren';
export { default as visuallyHidden } from './visuallyHidden';
export { default as integerPropType } from './integerPropType';
export { default as internal_resolveProps } from './resolveProps';
export { default as unstable_composeClasses } from './composeClasses';
export { default as unstable_generateUtilityClass } from './generateUtilityClass';
export { isGlobalState as unstable_isGlobalState } from './generateUtilityClass';
export * from './generateUtilityClass';
export { default as unstable_generateUtilityClasses } from './generateUtilityClasses';
export { default as unstable_ClassNameGenerator } from './ClassNameGenerator';
export { default as clamp } from './clamp';
export { default as unstable_useSlotProps } from './useSlotProps';
export { default as unstable_resolveComponentProps } from './resolveComponentProps';
export { default as unstable_extractEventHandlers } from './extractEventHandlers';
export { default as unstable_getReactElementRef } from './getReactElementRef';
export * from './types';

View File

@@ -0,0 +1,2 @@
export { default } from './integerPropType';
export * from './integerPropType';

View File

@@ -0,0 +1,55 @@
import _typeof from "@babel/runtime/helpers/esm/typeof";
export function getTypeByValue(value) {
var valueType = _typeof(value);
switch (valueType) {
case 'number':
if (Number.isNaN(value)) {
return 'NaN';
}
if (!Number.isFinite(value)) {
return 'Infinity';
}
if (value !== Math.floor(value)) {
return 'float';
}
return 'number';
case 'object':
if (value === null) {
return 'null';
}
return value.constructor.name;
default:
return valueType;
}
}
// IE 11 support
function ponyfillIsInteger(x) {
// eslint-disable-next-line no-restricted-globals
return typeof x === 'number' && isFinite(x) && Math.floor(x) === x;
}
var isInteger = Number.isInteger || ponyfillIsInteger;
function requiredInteger(props, propName, componentName, location) {
var propValue = props[propName];
if (propValue == null || !isInteger(propValue)) {
var propType = getTypeByValue(propValue);
return new RangeError("Invalid ".concat(location, " `").concat(propName, "` of type `").concat(propType, "` supplied to `").concat(componentName, "`, expected `integer`."));
}
return null;
}
function validator(props, propName) {
var propValue = props[propName];
if (propValue === undefined) {
return null;
}
for (var _len = arguments.length, other = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
other[_key - 2] = arguments[_key];
}
return requiredInteger.apply(void 0, [props, propName].concat(other));
}
function validatorNoop() {
return null;
}
validator.isRequired = requiredInteger;
validatorNoop.isRequired = validatorNoop;
export default process.env.NODE_ENV === 'production' ? validatorNoop : validator;

View File

@@ -0,0 +1 @@
export { default } from './isHostComponent';

View File

@@ -0,0 +1,7 @@
/**
* Determines if a given element is a DOM element name (i.e. not a React component).
*/
function isHostComponent(element) {
return typeof element === 'string';
}
export default isHostComponent;

View File

@@ -0,0 +1 @@
export { default } from './isMuiElement';

View File

@@ -0,0 +1,8 @@
import * as React from 'react';
export default function isMuiElement(element, muiNames) {
var _muiName, _element$type;
return /*#__PURE__*/React.isValidElement(element) && muiNames.indexOf( // For server components `muiName` is avaialble in element.type._payload.value.muiName
// relevant info - https://github.com/facebook/react/blob/2807d781a08db8e9873687fccc25c0f12b4fb3d4/packages/react/src/ReactLazy.js#L45
// eslint-disable-next-line no-underscore-dangle
(_muiName = element.type.muiName) != null ? _muiName : (_element$type = element.type) == null || (_element$type = _element$type._payload) == null || (_element$type = _element$type.value) == null ? void 0 : _element$type.muiName) !== -1;
}

View File

@@ -0,0 +1 @@
export { default } from './mergeSlotProps';

View File

@@ -0,0 +1,68 @@
import _extends from "@babel/runtime/helpers/esm/extends";
import clsx from 'clsx';
import extractEventHandlers from '../extractEventHandlers';
import omitEventHandlers from '../omitEventHandlers';
/**
* Merges the slot component internal props (usually coming from a hook)
* with the externally provided ones.
*
* The merge order is (the latter overrides the former):
* 1. The internal props (specified as a getter function to work with get*Props hook result)
* 2. Additional props (specified internally on a Base UI component)
* 3. External props specified on the owner component. These should only be used on a root slot.
* 4. External props specified in the `slotProps.*` prop.
* 5. The `className` prop - combined from all the above.
* @param parameters
* @returns
*/
function mergeSlotProps(parameters) {
var getSlotProps = parameters.getSlotProps,
additionalProps = parameters.additionalProps,
externalSlotProps = parameters.externalSlotProps,
externalForwardedProps = parameters.externalForwardedProps,
className = parameters.className;
if (!getSlotProps) {
// The simpler case - getSlotProps is not defined, so no internal event handlers are defined,
// so we can simply merge all the props without having to worry about extracting event handlers.
var _joinedClasses = clsx(additionalProps == null ? void 0 : additionalProps.className, className, externalForwardedProps == null ? void 0 : externalForwardedProps.className, externalSlotProps == null ? void 0 : externalSlotProps.className);
var _mergedStyle = _extends({}, additionalProps == null ? void 0 : additionalProps.style, externalForwardedProps == null ? void 0 : externalForwardedProps.style, externalSlotProps == null ? void 0 : externalSlotProps.style);
var _props = _extends({}, additionalProps, externalForwardedProps, externalSlotProps);
if (_joinedClasses.length > 0) {
_props.className = _joinedClasses;
}
if (Object.keys(_mergedStyle).length > 0) {
_props.style = _mergedStyle;
}
return {
props: _props,
internalRef: undefined
};
}
// In this case, getSlotProps is responsible for calling the external event handlers.
// We don't need to include them in the merged props because of this.
var eventHandlers = extractEventHandlers(_extends({}, externalForwardedProps, externalSlotProps));
var componentsPropsWithoutEventHandlers = omitEventHandlers(externalSlotProps);
var otherPropsWithoutEventHandlers = omitEventHandlers(externalForwardedProps);
var internalSlotProps = getSlotProps(eventHandlers);
// The order of classes is important here.
// Emotion (that we use in libraries consuming Base UI) depends on this order
// to properly override style. It requires the most important classes to be last
// (see https://github.com/mui/material-ui/pull/33205) for the related discussion.
var joinedClasses = clsx(internalSlotProps == null ? void 0 : internalSlotProps.className, additionalProps == null ? void 0 : additionalProps.className, className, externalForwardedProps == null ? void 0 : externalForwardedProps.className, externalSlotProps == null ? void 0 : externalSlotProps.className);
var mergedStyle = _extends({}, internalSlotProps == null ? void 0 : internalSlotProps.style, additionalProps == null ? void 0 : additionalProps.style, externalForwardedProps == null ? void 0 : externalForwardedProps.style, externalSlotProps == null ? void 0 : externalSlotProps.style);
var props = _extends({}, internalSlotProps, additionalProps, otherPropsWithoutEventHandlers, componentsPropsWithoutEventHandlers);
if (joinedClasses.length > 0) {
props.className = joinedClasses;
}
if (Object.keys(mergedStyle).length > 0) {
props.style = mergedStyle;
}
return {
props: props,
internalRef: internalSlotProps.ref
};
}
export default mergeSlotProps;

View File

@@ -0,0 +1 @@
export { default } from './omitEventHandlers';

View File

@@ -0,0 +1,20 @@
/**
* Removes event handlers from the given object.
* A field is considered an event handler if it is a function with a name beginning with `on`.
*
* @param object Object to remove event handlers from.
* @returns Object with event handlers removed.
*/
function omitEventHandlers(object) {
if (object === undefined) {
return {};
}
var result = {};
Object.keys(object).filter(function (prop) {
return !(prop.match(/^on[A-Z]/) && typeof object[prop] === 'function');
}).forEach(function (prop) {
result[prop] = object[prop];
});
return result;
}
export default omitEventHandlers;

View File

@@ -0,0 +1 @@
export { default } from './ownerDocument';

View File

@@ -0,0 +1,3 @@
export default function ownerDocument(node) {
return node && node.ownerDocument || document;
}

View File

@@ -0,0 +1 @@
export { default } from './ownerWindow';

View File

@@ -0,0 +1,5 @@
import ownerDocument from '../ownerDocument';
export default function ownerWindow(node) {
var doc = ownerDocument(node);
return doc.defaultView || window;
}

View File

@@ -0,0 +1 @@
export { default } from './ponyfillGlobal';

View File

@@ -0,0 +1,3 @@
/* eslint-disable */
// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
export default typeof window != 'undefined' && window.Math == Math ? window : typeof self != 'undefined' && self.Math == Math ? self : Function('return this')();

View File

@@ -0,0 +1 @@
export { default } from './refType';

View File

@@ -0,0 +1,3 @@
import PropTypes from 'prop-types';
var refType = PropTypes.oneOfType([PropTypes.func, PropTypes.object]);
export default refType;

View File

@@ -0,0 +1 @@
export { default } from './requirePropFactory';

View File

@@ -0,0 +1,31 @@
import _extends from "@babel/runtime/helpers/esm/extends";
export default function requirePropFactory(componentNameInError, Component) {
if (process.env.NODE_ENV === 'production') {
return function () {
return null;
};
}
// eslint-disable-next-line react/forbid-foreign-prop-types
var prevPropTypes = Component ? _extends({}, Component.propTypes) : null;
var requireProp = function requireProp(requiredProp) {
return function (props, propName, componentName, location, propFullName) {
var propFullNameSafe = propFullName || propName;
var defaultTypeChecker = prevPropTypes == null ? void 0 : prevPropTypes[propFullNameSafe];
if (defaultTypeChecker) {
for (var _len = arguments.length, args = new Array(_len > 5 ? _len - 5 : 0), _key = 5; _key < _len; _key++) {
args[_key - 5] = arguments[_key];
}
var typeCheckerResult = defaultTypeChecker.apply(void 0, [props, propName, componentName, location, propFullName].concat(args));
if (typeCheckerResult) {
return typeCheckerResult;
}
}
if (typeof props[propName] !== 'undefined' && !props[requiredProp]) {
return new Error("The prop `".concat(propFullNameSafe, "` of ") + "`".concat(componentNameInError, "` can only be used together with the `").concat(requiredProp, "` prop."));
}
return null;
};
};
return requireProp;
}

View File

@@ -0,0 +1 @@
export { default } from './resolveComponentProps';

View File

@@ -0,0 +1,11 @@
/**
* If `componentProps` is a function, calls it with the provided `ownerState`.
* Otherwise, just returns `componentProps`.
*/
function resolveComponentProps(componentProps, ownerState, slotState) {
if (typeof componentProps === 'function') {
return componentProps(ownerState, slotState);
}
return componentProps;
}
export default resolveComponentProps;

View File

@@ -0,0 +1 @@
export { default } from './resolveProps';

View File

@@ -0,0 +1,34 @@
import _extends from "@babel/runtime/helpers/esm/extends";
/**
* Add keys, values of `defaultProps` that does not exist in `props`
* @param {object} defaultProps
* @param {object} props
* @returns {object} resolved props
*/
export default function resolveProps(defaultProps, props) {
var output = _extends({}, props);
Object.keys(defaultProps).forEach(function (propName) {
if (propName.toString().match(/^(components|slots)$/)) {
output[propName] = _extends({}, defaultProps[propName], output[propName]);
} else if (propName.toString().match(/^(componentsProps|slotProps)$/)) {
var defaultSlotProps = defaultProps[propName] || {};
var slotProps = props[propName];
output[propName] = {};
if (!slotProps || !Object.keys(slotProps)) {
// Reduce the iteration if the slot props is empty
output[propName] = defaultSlotProps;
} else if (!defaultSlotProps || !Object.keys(defaultSlotProps)) {
// Reduce the iteration if the default slot props is empty
output[propName] = slotProps;
} else {
output[propName] = _extends({}, slotProps);
Object.keys(defaultSlotProps).forEach(function (slotPropName) {
output[propName][slotPropName] = resolveProps(defaultSlotProps[slotPropName], slotProps[slotPropName]);
});
}
} else if (output[propName] === undefined) {
output[propName] = defaultProps[propName];
}
});
return output;
}

View File

@@ -0,0 +1 @@
export * from './scrollLeft';

View File

@@ -0,0 +1,70 @@
// Source from https://github.com/alitaheri/normalize-scroll-left
var cachedType;
/**
* Based on the jquery plugin https://github.com/othree/jquery.rtl-scroll-type
*
* Types of scrollLeft, assuming scrollWidth=100 and direction is rtl.
*
* Type | <- Most Left | Most Right -> | Initial
* ---------------- | ------------ | ------------- | -------
* default | 0 | 100 | 100
* negative (spec*) | -100 | 0 | 0
* reverse | 100 | 0 | 0
*
* Edge 85: default
* Safari 14: negative
* Chrome 85: negative
* Firefox 81: negative
* IE11: reverse
*
* spec* https://drafts.csswg.org/cssom-view/#dom-window-scroll
*/
export function detectScrollType() {
if (cachedType) {
return cachedType;
}
var dummy = document.createElement('div');
var container = document.createElement('div');
container.style.width = '10px';
container.style.height = '1px';
dummy.appendChild(container);
dummy.dir = 'rtl';
dummy.style.fontSize = '14px';
dummy.style.width = '4px';
dummy.style.height = '1px';
dummy.style.position = 'absolute';
dummy.style.top = '-1000px';
dummy.style.overflow = 'scroll';
document.body.appendChild(dummy);
cachedType = 'reverse';
if (dummy.scrollLeft > 0) {
cachedType = 'default';
} else {
dummy.scrollLeft = 1;
if (dummy.scrollLeft === 0) {
cachedType = 'negative';
}
}
document.body.removeChild(dummy);
return cachedType;
}
// Based on https://stackoverflow.com/a/24394376
export function getNormalizedScrollLeft(element, direction) {
var scrollLeft = element.scrollLeft;
// Perform the calculations only when direction is rtl to avoid messing up the ltr behavior
if (direction !== 'rtl') {
return scrollLeft;
}
var type = detectScrollType();
switch (type) {
case 'negative':
return element.scrollWidth - element.clientWidth + scrollLeft;
case 'reverse':
return element.scrollWidth - element.clientWidth - scrollLeft;
default:
return scrollLeft;
}
}

View File

@@ -0,0 +1 @@
export { default } from './setRef';

View File

@@ -0,0 +1,20 @@
/**
* TODO v5: consider making it private
*
* passes {value} to {ref}
*
* WARNING: Be sure to only call this inside a callback that is passed as a ref.
* Otherwise, make sure to cleanup the previous {ref} if it changes. See
* https://github.com/mui/material-ui/issues/13539
*
* Useful if you want to expose the ref of an inner component to the public API
* while still using it inside the component.
* @param ref A ref callback or ref object. If anything falsy, this is a no-op.
*/
export default function setRef(ref, value) {
if (typeof ref === 'function') {
ref(value);
} else if (ref) {
ref.current = value;
}
}

1
frontend/node_modules/@mui/utils/legacy/types.js generated vendored Normal file
View File

@@ -0,0 +1 @@
export {};

View File

@@ -0,0 +1 @@
export { default } from './unsupportedProp';

View File

@@ -0,0 +1,10 @@
export default function unsupportedProp(props, propName, componentName, location, propFullName) {
if (process.env.NODE_ENV === 'production') {
return null;
}
var propFullNameSafe = propFullName || propName;
if (typeof props[propName] !== 'undefined') {
return new Error("The prop `".concat(propFullNameSafe, "` is not supported. Please remove it."));
}
return null;
}

View File

@@ -0,0 +1 @@
export { default } from './useControlled';

View File

@@ -0,0 +1,38 @@
'use client';
/* eslint-disable react-hooks/rules-of-hooks, react-hooks/exhaustive-deps */
import * as React from 'react';
export default function useControlled(_ref) {
var controlled = _ref.controlled,
defaultProp = _ref.default,
name = _ref.name,
_ref$state = _ref.state,
state = _ref$state === void 0 ? 'value' : _ref$state;
// isControlled is ignored in the hook dependency lists as it should never change.
var _React$useRef = React.useRef(controlled !== undefined),
isControlled = _React$useRef.current;
var _React$useState = React.useState(defaultProp),
valueState = _React$useState[0],
setValue = _React$useState[1];
var value = isControlled ? controlled : valueState;
if (process.env.NODE_ENV !== 'production') {
React.useEffect(function () {
if (isControlled !== (controlled !== undefined)) {
console.error(["MUI: A component is changing the ".concat(isControlled ? '' : 'un', "controlled ").concat(state, " state of ").concat(name, " to be ").concat(isControlled ? 'un' : '', "controlled."), 'Elements should not switch from uncontrolled to controlled (or vice versa).', "Decide between using a controlled or uncontrolled ".concat(name, " ") + 'element for the lifetime of the component.', "The nature of the state is determined during the first render. It's considered controlled if the value is not `undefined`.", 'More info: https://fb.me/react-controlled-components'].join('\n'));
}
}, [state, name, controlled]);
var _React$useRef2 = React.useRef(defaultProp),
defaultValue = _React$useRef2.current;
React.useEffect(function () {
if (!isControlled && !Object.is(defaultValue, defaultProp)) {
console.error(["MUI: A component is changing the default ".concat(state, " state of an uncontrolled ").concat(name, " after being initialized. ") + "To suppress this warning opt to use a controlled ".concat(name, ".")].join('\n'));
}
}, [JSON.stringify(defaultProp)]);
}
var setValueIfUncontrolled = React.useCallback(function (newValue) {
if (!isControlled) {
setValue(newValue);
}
}, []);
return [value, setValueIfUncontrolled];
}

View File

@@ -0,0 +1 @@
export { default } from './useEnhancedEffect';

View File

@@ -0,0 +1,13 @@
'use client';
import * as React from 'react';
/**
* A version of `React.useLayoutEffect` that does not show a warning when server-side rendering.
* This is useful for effects that are only needed for client-side rendering but not for SSR.
*
* Before you use this hook, make sure to read https://gist.github.com/gaearon/e7d97cdf38a2907924ea12e4ebdf3c85
* and confirm it doesn't apply to your use-case.
*/
var useEnhancedEffect = typeof window !== 'undefined' ? React.useLayoutEffect : React.useEffect;
export default useEnhancedEffect;

View File

@@ -0,0 +1 @@
export { default } from './useEventCallback';

View File

@@ -0,0 +1,23 @@
'use client';
import * as React from 'react';
import useEnhancedEffect from '../useEnhancedEffect';
/**
* Inspired by https://github.com/facebook/react/issues/14099#issuecomment-440013892
* See RFC in https://github.com/reactjs/rfcs/pull/220
*/
function useEventCallback(fn) {
var ref = React.useRef(fn);
useEnhancedEffect(function () {
ref.current = fn;
});
return React.useRef(function () {
return (
// @ts-expect-error hide `this`
(0, ref.current).apply(void 0, arguments)
);
}).current;
}
export default useEventCallback;

View File

@@ -0,0 +1 @@
export { default } from './useForkRef';

View File

@@ -0,0 +1,27 @@
'use client';
import * as React from 'react';
import setRef from '../setRef';
export default function useForkRef() {
for (var _len = arguments.length, refs = new Array(_len), _key = 0; _key < _len; _key++) {
refs[_key] = arguments[_key];
}
/**
* This will create a new function if the refs passed to this hook change and are all defined.
* This means react will call the old forkRef with `null` and the new forkRef
* with the ref. Cleanup naturally emerges from this behavior.
*/
return React.useMemo(function () {
if (refs.every(function (ref) {
return ref == null;
})) {
return null;
}
return function (instance) {
refs.forEach(function (ref) {
setRef(ref, instance);
});
};
// eslint-disable-next-line react-hooks/exhaustive-deps
}, refs);
}

View File

@@ -0,0 +1 @@
export { default } from './useId';

38
frontend/node_modules/@mui/utils/legacy/useId/useId.js generated vendored Normal file
View File

@@ -0,0 +1,38 @@
'use client';
import * as React from 'react';
var globalId = 0;
function useGlobalId(idOverride) {
var _React$useState = React.useState(idOverride),
defaultId = _React$useState[0],
setDefaultId = _React$useState[1];
var id = idOverride || defaultId;
React.useEffect(function () {
if (defaultId == null) {
// Fallback to this default id when possible.
// Use the incrementing value for client-side rendering only.
// We can't use it server-side.
// If you want to use random values please consider the Birthday Problem: https://en.wikipedia.org/wiki/Birthday_problem
globalId += 1;
setDefaultId("mui-".concat(globalId));
}
}, [defaultId]);
return id;
}
// downstream bundlers may remove unnecessary concatenation, but won't remove toString call -- Workaround for https://github.com/webpack/webpack/issues/14814
var maybeReactUseId = React['useId'.toString()];
/**
*
* @example <div id={useId()} />
* @param idOverride
* @returns {string}
*/
export default function useId(idOverride) {
if (maybeReactUseId !== undefined) {
var reactId = maybeReactUseId();
return idOverride != null ? idOverride : reactId;
}
// eslint-disable-next-line react-hooks/rules-of-hooks -- `React.useId` is invariant at runtime.
return useGlobalId(idOverride);
}

View File

@@ -0,0 +1,2 @@
export { default } from './useIsFocusVisible';
export * from './useIsFocusVisible';

View File

@@ -0,0 +1,160 @@
'use client';
// based on https://github.com/WICG/focus-visible/blob/v4.1.5/src/focus-visible.js
import * as React from 'react';
import { Timeout } from '../useTimeout/useTimeout';
var hadKeyboardEvent = true;
var hadFocusVisibleRecently = false;
var hadFocusVisibleRecentlyTimeout = new Timeout();
var inputTypesWhitelist = {
text: true,
search: true,
url: true,
tel: true,
email: true,
password: true,
number: true,
date: true,
month: true,
week: true,
time: true,
datetime: true,
'datetime-local': true
};
/**
* Computes whether the given element should automatically trigger the
* `focus-visible` class being added, i.e. whether it should always match
* `:focus-visible` when focused.
* @param {Element} node
* @returns {boolean}
*/
function focusTriggersKeyboardModality(node) {
var _ref = node,
type = _ref.type,
tagName = _ref.tagName;
if (tagName === 'INPUT' && inputTypesWhitelist[type] && !node.readOnly) {
return true;
}
if (tagName === 'TEXTAREA' && !node.readOnly) {
return true;
}
if (node.isContentEditable) {
return true;
}
return false;
}
/**
* Keep track of our keyboard modality state with `hadKeyboardEvent`.
* If the most recent user interaction was via the keyboard;
* and the key press did not include a meta, alt/option, or control key;
* then the modality is keyboard. Otherwise, the modality is not keyboard.
* @param {KeyboardEvent} event
*/
function handleKeyDown(event) {
if (event.metaKey || event.altKey || event.ctrlKey) {
return;
}
hadKeyboardEvent = true;
}
/**
* If at any point a user clicks with a pointing device, ensure that we change
* the modality away from keyboard.
* This avoids the situation where a user presses a key on an already focused
* element, and then clicks on a different element, focusing it with a
* pointing device, while we still think we're in keyboard modality.
*/
function handlePointerDown() {
hadKeyboardEvent = false;
}
function handleVisibilityChange() {
if (this.visibilityState === 'hidden') {
// If the tab becomes active again, the browser will handle calling focus
// on the element (Safari actually calls it twice).
// If this tab change caused a blur on an element with focus-visible,
// re-apply the class when the user switches back to the tab.
if (hadFocusVisibleRecently) {
hadKeyboardEvent = true;
}
}
}
function prepare(doc) {
doc.addEventListener('keydown', handleKeyDown, true);
doc.addEventListener('mousedown', handlePointerDown, true);
doc.addEventListener('pointerdown', handlePointerDown, true);
doc.addEventListener('touchstart', handlePointerDown, true);
doc.addEventListener('visibilitychange', handleVisibilityChange, true);
}
export function teardown(doc) {
doc.removeEventListener('keydown', handleKeyDown, true);
doc.removeEventListener('mousedown', handlePointerDown, true);
doc.removeEventListener('pointerdown', handlePointerDown, true);
doc.removeEventListener('touchstart', handlePointerDown, true);
doc.removeEventListener('visibilitychange', handleVisibilityChange, true);
}
function isFocusVisible(event) {
var target = event.target;
try {
return target.matches(':focus-visible');
} catch (error) {
// Browsers not implementing :focus-visible will throw a SyntaxError.
// We use our own heuristic for those browsers.
// Rethrow might be better if it's not the expected error but do we really
// want to crash if focus-visible malfunctioned?
}
// No need for validFocusTarget check. The user does that by attaching it to
// focusable events only.
return hadKeyboardEvent || focusTriggersKeyboardModality(target);
}
export default function useIsFocusVisible() {
var ref = React.useCallback(function (node) {
if (node != null) {
prepare(node.ownerDocument);
}
}, []);
var isFocusVisibleRef = React.useRef(false);
/**
* Should be called if a blur event is fired
*/
function handleBlurVisible() {
// checking against potential state variable does not suffice if we focus and blur synchronously.
// React wouldn't have time to trigger a re-render so `focusVisible` would be stale.
// Ideally we would adjust `isFocusVisible(event)` to look at `relatedTarget` for blur events.
// This doesn't work in IE11 due to https://github.com/facebook/react/issues/3751
// TODO: check again if React releases their internal changes to focus event handling (https://github.com/facebook/react/pull/19186).
if (isFocusVisibleRef.current) {
// To detect a tab/window switch, we look for a blur event followed
// rapidly by a visibility change.
// If we don't see a visibility change within 100ms, it's probably a
// regular focus change.
hadFocusVisibleRecently = true;
hadFocusVisibleRecentlyTimeout.start(100, function () {
hadFocusVisibleRecently = false;
});
isFocusVisibleRef.current = false;
return true;
}
return false;
}
/**
* Should be called if a blur event is fired
*/
function handleFocusVisible(event) {
if (isFocusVisible(event)) {
isFocusVisibleRef.current = true;
return true;
}
return false;
}
return {
isFocusVisibleRef: isFocusVisibleRef,
onFocus: handleFocusVisible,
onBlur: handleBlurVisible,
ref: ref
};
}

View File

@@ -0,0 +1 @@
export { default } from './useLazyRef';

View File

@@ -0,0 +1,19 @@
'use client';
import * as React from 'react';
var UNINITIALIZED = {};
/**
* A React.useRef() that is initialized lazily with a function. Note that it accepts an optional
* initialization argument, so the initialization function doesn't need to be an inline closure.
*
* @usage
* const ref = useLazyRef(sortColumns, columns)
*/
export default function useLazyRef(init, initArg) {
var ref = React.useRef(UNINITIALIZED);
if (ref.current === UNINITIALIZED) {
ref.current = init(initArg);
}
return ref;
}

View File

@@ -0,0 +1 @@
export { default } from './useLocalStorageState';

View File

@@ -0,0 +1,121 @@
'use client';
import * as React from 'react';
// storage events only work across tabs, we'll use an event emitter to announce within the current tab
var currentTabChangeListeners = new Map();
function onCurrentTabStorageChange(key, handler) {
var listeners = currentTabChangeListeners.get(key);
if (!listeners) {
listeners = new Set();
currentTabChangeListeners.set(key, listeners);
}
listeners.add(handler);
}
function offCurrentTabStorageChange(key, handler) {
var listeners = currentTabChangeListeners.get(key);
if (!listeners) {
return;
}
listeners.delete(handler);
if (listeners.size === 0) {
currentTabChangeListeners.delete(key);
}
}
function emitCurrentTabStorageChange(key) {
var listeners = currentTabChangeListeners.get(key);
if (listeners) {
listeners.forEach(function (listener) {
return listener();
});
}
}
function subscribe(area, key, callbark) {
if (!key) {
return function () {};
}
var storageHandler = function storageHandler(event) {
if (event.storageArea === area && event.key === key) {
callbark();
}
};
window.addEventListener('storage', storageHandler);
onCurrentTabStorageChange(key, callbark);
return function () {
window.removeEventListener('storage', storageHandler);
offCurrentTabStorageChange(key, callbark);
};
}
function getSnapshot(area, key) {
if (!key) {
return null;
}
try {
return area.getItem(key);
} catch (_unused) {
// ignore
// See https://developer.mozilla.org/en-US/docs/Web/API/Web_Storage_API/Using_the_Web_Storage_API#feature-detecting_localstorage
return null;
}
}
function setValue(area, key, value) {
if (!key) {
return;
}
try {
if (value === null) {
area.removeItem(key);
} else {
area.setItem(key, String(value));
}
} catch (_unused2) {
// ignore
// See https://developer.mozilla.org/en-US/docs/Web/API/Web_Storage_API/Using_the_Web_Storage_API#feature-detecting_localstorage
return;
}
emitCurrentTabStorageChange(key);
}
var serverValue = [null, function () {}];
function useLocalStorageStateServer() {
return serverValue;
}
/**
* Sync state to local storage so that it persists through a page refresh. Usage is
* similar to useState except we pass in a storage key so that we can default
* to that value on page load instead of the specified initial value.
*
* Since the storage API isn't available in server-rendering environments, we
* return null during SSR and hydration.
*/
function useLocalStorageStateBrowser(key) {
var initializer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
var _React$useState = React.useState(initializer),
initialValue = _React$useState[0];
var area = window.localStorage;
var subscribeKey = React.useCallback(function (callbark) {
return subscribe(area, key, callbark);
}, [area, key]);
var getKeySnapshot = React.useCallback(function () {
var _getSnapshot;
return (_getSnapshot = getSnapshot(area, key)) != null ? _getSnapshot : initialValue;
}, [area, initialValue, key]);
// Start with null for the hydration, and then switch to the actual value.
var getKeyServerSnapshot = function getKeyServerSnapshot() {
return null;
};
var storedValue = React.useSyncExternalStore(subscribeKey, getKeySnapshot, getKeyServerSnapshot);
var setStoredValue = React.useCallback(function (value) {
var valueToStore = value instanceof Function ? value(storedValue) : value;
setValue(area, key, valueToStore);
}, [area, key, storedValue]);
var _React$useState2 = React.useState(initialValue),
nonStoredValue = _React$useState2[0],
setNonStoredValue = _React$useState2[1];
if (!key) {
return [nonStoredValue, setNonStoredValue];
}
return [storedValue, setStoredValue];
}
export default typeof window === 'undefined' ? useLocalStorageStateServer : useLocalStorageStateBrowser;

View File

@@ -0,0 +1 @@
export { default } from './useOnMount';

View File

@@ -0,0 +1,13 @@
'use client';
import * as React from 'react';
var EMPTY = [];
/**
* A React.useEffect equivalent that runs once, when the component is mounted.
*/
export default function useOnMount(fn) {
/* eslint-disable react-hooks/exhaustive-deps */
React.useEffect(fn, EMPTY);
/* eslint-enable react-hooks/exhaustive-deps */
}

View File

@@ -0,0 +1 @@
export { default } from './usePreviousProps';

View File

@@ -0,0 +1,11 @@
'use client';
import * as React from 'react';
var usePreviousProps = function usePreviousProps(value) {
var ref = React.useRef({});
React.useEffect(function () {
ref.current = value;
});
return ref.current;
};
export default usePreviousProps;

View File

@@ -0,0 +1 @@
export { default } from './useSlotProps';

View File

@@ -0,0 +1,37 @@
'use client';
import _extends from "@babel/runtime/helpers/esm/extends";
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
import useForkRef from '../useForkRef';
import appendOwnerState from '../appendOwnerState';
import mergeSlotProps from '../mergeSlotProps';
import resolveComponentProps from '../resolveComponentProps';
/**
* @ignore - do not document.
* Builds the props to be passed into the slot of an unstyled component.
* It merges the internal props of the component with the ones supplied by the user, allowing to customize the behavior.
* If the slot component is not a host component, it also merges in the `ownerState`.
*
* @param parameters.getSlotProps - A function that returns the props to be passed to the slot component.
*/
function useSlotProps(parameters) {
var _parameters$additiona;
var elementType = parameters.elementType,
externalSlotProps = parameters.externalSlotProps,
ownerState = parameters.ownerState,
_parameters$skipResol = parameters.skipResolvingSlotProps,
skipResolvingSlotProps = _parameters$skipResol === void 0 ? false : _parameters$skipResol,
rest = _objectWithoutProperties(parameters, ["elementType", "externalSlotProps", "ownerState", "skipResolvingSlotProps"]);
var resolvedComponentsProps = skipResolvingSlotProps ? {} : resolveComponentProps(externalSlotProps, ownerState);
var _mergeSlotProps = mergeSlotProps(_extends({}, rest, {
externalSlotProps: resolvedComponentsProps
})),
mergedProps = _mergeSlotProps.props,
internalRef = _mergeSlotProps.internalRef;
var ref = useForkRef(internalRef, resolvedComponentsProps == null ? void 0 : resolvedComponentsProps.ref, (_parameters$additiona = parameters.additionalProps) == null ? void 0 : _parameters$additiona.ref);
var props = appendOwnerState(elementType, _extends({}, mergedProps, {
ref: ref
}), ownerState);
return props;
}
export default useSlotProps;

View File

@@ -0,0 +1,2 @@
export { default } from './useTimeout';
export { Timeout } from './useTimeout';

View File

@@ -0,0 +1,48 @@
'use client';
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
import _createClass from "@babel/runtime/helpers/esm/createClass";
import useLazyRef from '../useLazyRef/useLazyRef';
import useOnMount from '../useOnMount/useOnMount';
export var Timeout = /*#__PURE__*/function () {
function Timeout() {
var _this = this;
_classCallCheck(this, Timeout);
this.currentId = null;
this.clear = function () {
if (_this.currentId !== null) {
clearTimeout(_this.currentId);
_this.currentId = null;
}
};
this.disposeEffect = function () {
return _this.clear;
};
}
_createClass(Timeout, [{
key: "start",
value:
/**
* Executes `fn` after `delay`, clearing any previously scheduled call.
*/
function start(delay, fn) {
var _this2 = this;
this.clear();
this.currentId = setTimeout(function () {
_this2.currentId = null;
fn();
}, delay);
}
}], [{
key: "create",
value: function create() {
return new Timeout();
}
}]);
return Timeout;
}();
export default function useTimeout() {
var timeout = useLazyRef(Timeout.create).current;
useOnMount(timeout.disposeEffect);
return timeout;
}

Some files were not shown because too many files have changed in this diff Show More