wip:milestone 0 fixes
Some checks failed
CI/CD Pipeline / unit-tests (push) Failing after 1m16s
CI/CD Pipeline / integration-tests (push) Failing after 2m32s
CI/CD Pipeline / lint (push) Successful in 5m22s
CI/CD Pipeline / e2e-tests (push) Has been skipped
CI/CD Pipeline / build (push) Has been skipped

This commit is contained in:
2026-03-15 12:35:42 +02:00
parent 6708cf28a7
commit cffdf8af86
61266 changed files with 4511646 additions and 1938 deletions

View File

@@ -0,0 +1,91 @@
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
import _createClass from "@babel/runtime/helpers/esm/createClass";
// Used https://gist.github.com/mudge/5830382 as a starting point.
// See https://github.com/browserify/events/blob/master/events.js for
// the Node.js (https://nodejs.org/api/events.html) polyfill used by webpack.
export var EventManager = /*#__PURE__*/function () {
function EventManager() {
_classCallCheck(this, EventManager);
this.maxListeners = 20;
this.warnOnce = false;
this.events = {};
}
_createClass(EventManager, [{
key: "on",
value: function on(eventName, listener) {
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
var collection = this.events[eventName];
if (!collection) {
collection = {
highPriority: new Map(),
regular: new Map()
};
this.events[eventName] = collection;
}
if (options.isFirst) {
collection.highPriority.set(listener, true);
} else {
collection.regular.set(listener, true);
}
if (process.env.NODE_ENV !== 'production') {
var collectionSize = collection.highPriority.size + collection.regular.size;
if (collectionSize > this.maxListeners && !this.warnOnce) {
this.warnOnce = true;
console.warn(["Possible EventEmitter memory leak detected. ".concat(collectionSize, " ").concat(eventName, " listeners added.")].join('\n'));
}
}
}
}, {
key: "removeListener",
value: function removeListener(eventName, listener) {
if (this.events[eventName]) {
this.events[eventName].regular.delete(listener);
this.events[eventName].highPriority.delete(listener);
}
}
}, {
key: "removeAllListeners",
value: function removeAllListeners() {
this.events = {};
}
}, {
key: "emit",
value: function emit(eventName) {
var collection = this.events[eventName];
if (!collection) {
return;
}
var highPriorityListeners = Array.from(collection.highPriority.keys());
var regularListeners = Array.from(collection.regular.keys());
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
args[_key - 1] = arguments[_key];
}
for (var i = highPriorityListeners.length - 1; i >= 0; i -= 1) {
var listener = highPriorityListeners[i];
if (collection.highPriority.has(listener)) {
listener.apply(this, args);
}
}
for (var _i = 0; _i < regularListeners.length; _i += 1) {
var _listener = regularListeners[_i];
if (collection.regular.has(_listener)) {
_listener.apply(this, args);
}
}
}
}, {
key: "once",
value: function once(eventName, listener) {
// eslint-disable-next-line consistent-this
var that = this;
this.on(eventName, function oneTimeListener() {
that.removeListener(eventName, oneTimeListener);
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
args[_key2] = arguments[_key2];
}
listener.apply(that, args);
});
}
}]);
return EventManager;
}();

View File

@@ -0,0 +1,34 @@
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
import _createClass from "@babel/runtime/helpers/esm/createClass";
export var Store = /*#__PURE__*/function () {
function Store(_value) {
var _this = this;
_classCallCheck(this, Store);
this.value = void 0;
this.listeners = void 0;
this.subscribe = function (fn) {
_this.listeners.add(fn);
return function () {
_this.listeners.delete(fn);
};
};
this.getSnapshot = function () {
return _this.value;
};
this.update = function (value) {
_this.value = value;
_this.listeners.forEach(function (l) {
return l(value);
});
};
this.value = _value;
this.listeners = new Set();
}
_createClass(Store, null, [{
key: "create",
value: function create(value) {
return new Store(value);
}
}]);
return Store;
}();

View File

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

View File

@@ -0,0 +1,29 @@
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
import _createClass from "@babel/runtime/helpers/esm/createClass";
export var FinalizationRegistryBasedCleanupTracking = /*#__PURE__*/function () {
function FinalizationRegistryBasedCleanupTracking() {
_classCallCheck(this, FinalizationRegistryBasedCleanupTracking);
this.registry = new FinalizationRegistry(function (unsubscribe) {
if (typeof unsubscribe === 'function') {
unsubscribe();
}
});
}
_createClass(FinalizationRegistryBasedCleanupTracking, [{
key: "register",
value: function register(object, unsubscribe, unregisterToken) {
this.registry.register(object, unsubscribe, unregisterToken);
}
}, {
key: "unregister",
value: function unregister(unregisterToken) {
this.registry.unregister(unregisterToken);
}
// eslint-disable-next-line class-methods-use-this
}, {
key: "reset",
value: function reset() {}
}]);
return FinalizationRegistryBasedCleanupTracking;
}();

View File

@@ -0,0 +1,52 @@
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
import _createClass from "@babel/runtime/helpers/esm/createClass";
// If no effect ran after this amount of time, we assume that the render was not committed by React
var CLEANUP_TIMER_LOOP_MILLIS = 1000;
export var TimerBasedCleanupTracking = /*#__PURE__*/function () {
function TimerBasedCleanupTracking() {
var timeout = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : CLEANUP_TIMER_LOOP_MILLIS;
_classCallCheck(this, TimerBasedCleanupTracking);
this.timeouts = new Map();
this.cleanupTimeout = CLEANUP_TIMER_LOOP_MILLIS;
this.cleanupTimeout = timeout;
}
_createClass(TimerBasedCleanupTracking, [{
key: "register",
value: function register(object, unsubscribe, unregisterToken) {
var _this = this;
if (!this.timeouts) {
this.timeouts = new Map();
}
var timeout = setTimeout(function () {
if (typeof unsubscribe === 'function') {
unsubscribe();
}
_this.timeouts.delete(unregisterToken.cleanupToken);
}, this.cleanupTimeout);
this.timeouts.set(unregisterToken.cleanupToken, timeout);
}
}, {
key: "unregister",
value: function unregister(unregisterToken) {
var timeout = this.timeouts.get(unregisterToken.cleanupToken);
if (timeout) {
this.timeouts.delete(unregisterToken.cleanupToken);
clearTimeout(timeout);
}
}
}, {
key: "reset",
value: function reset() {
var _this2 = this;
if (this.timeouts) {
this.timeouts.forEach(function (value, key) {
_this2.unregister({
cleanupToken: key
});
});
this.timeouts = undefined;
}
}
}]);
return TimerBasedCleanupTracking;
}();

View File

@@ -0,0 +1,11 @@
export function createControllablePromise() {
var resolve;
var reject;
var promise = new Promise(function (_resolve, _reject) {
resolve = _resolve;
reject = _reject;
});
promise.resolve = resolve;
promise.reject = reject;
return promise;
}

View File

@@ -0,0 +1,120 @@
import { createSelector as reselectCreateSelector } from 'reselect';
import { buildWarning } from './warning';
var cacheContainer = {
cache: new WeakMap()
};
var missingInstanceIdWarning = buildWarning(['MUI: A selector was called without passing the instance ID, which may impact the performance of the grid.', 'To fix, call it with `apiRef`, e.g. `mySelector(apiRef)`, or pass the instance ID explicitly, e.g. `mySelector(state, apiRef.current.instanceId)`.']);
function checkIsAPIRef(value) {
return 'current' in value && 'instanceId' in value.current;
}
var DEFAULT_INSTANCE_ID = {
id: 'default'
};
export var createSelector = function createSelector(a, b, c, d, e, f) {
if ((arguments.length <= 6 ? 0 : arguments.length - 6) > 0) {
throw new Error('Unsupported number of selectors');
}
var selector;
if (a && b && c && d && e && f) {
selector = function selector(stateOrApiRef, instanceIdParam) {
var isAPIRef = checkIsAPIRef(stateOrApiRef);
var instanceId = instanceIdParam != null ? instanceIdParam : isAPIRef ? stateOrApiRef.current.instanceId : DEFAULT_INSTANCE_ID;
var state = isAPIRef ? stateOrApiRef.current.state : stateOrApiRef;
var va = a(state, instanceId);
var vb = b(state, instanceId);
var vc = c(state, instanceId);
var vd = d(state, instanceId);
var ve = e(state, instanceId);
return f(va, vb, vc, vd, ve);
};
} else if (a && b && c && d && e) {
selector = function selector(stateOrApiRef, instanceIdParam) {
var isAPIRef = checkIsAPIRef(stateOrApiRef);
var instanceId = instanceIdParam != null ? instanceIdParam : isAPIRef ? stateOrApiRef.current.instanceId : DEFAULT_INSTANCE_ID;
var state = isAPIRef ? stateOrApiRef.current.state : stateOrApiRef;
var va = a(state, instanceId);
var vb = b(state, instanceId);
var vc = c(state, instanceId);
var vd = d(state, instanceId);
return e(va, vb, vc, vd);
};
} else if (a && b && c && d) {
selector = function selector(stateOrApiRef, instanceIdParam) {
var isAPIRef = checkIsAPIRef(stateOrApiRef);
var instanceId = instanceIdParam != null ? instanceIdParam : isAPIRef ? stateOrApiRef.current.instanceId : DEFAULT_INSTANCE_ID;
var state = isAPIRef ? stateOrApiRef.current.state : stateOrApiRef;
var va = a(state, instanceId);
var vb = b(state, instanceId);
var vc = c(state, instanceId);
return d(va, vb, vc);
};
} else if (a && b && c) {
selector = function selector(stateOrApiRef, instanceIdParam) {
var isAPIRef = checkIsAPIRef(stateOrApiRef);
var instanceId = instanceIdParam != null ? instanceIdParam : isAPIRef ? stateOrApiRef.current.instanceId : DEFAULT_INSTANCE_ID;
var state = isAPIRef ? stateOrApiRef.current.state : stateOrApiRef;
var va = a(state, instanceId);
var vb = b(state, instanceId);
return c(va, vb);
};
} else if (a && b) {
selector = function selector(stateOrApiRef, instanceIdParam) {
var isAPIRef = checkIsAPIRef(stateOrApiRef);
var instanceId = instanceIdParam != null ? instanceIdParam : isAPIRef ? stateOrApiRef.current.instanceId : DEFAULT_INSTANCE_ID;
var state = isAPIRef ? stateOrApiRef.current.state : stateOrApiRef;
var va = a(state, instanceId);
return b(va);
};
} else {
throw new Error('Missing arguments');
}
// We use this property to detect if the selector was created with createSelector
// or it's only a simple function the receives the state and returns part of it.
selector.acceptsApiRef = true;
return selector;
};
export var createSelectorMemoized = function createSelectorMemoized() {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
var selector = function selector() {
var _cache$get, _cache$get3;
for (var _len2 = arguments.length, selectorArgs = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
selectorArgs[_key2] = arguments[_key2];
}
var stateOrApiRef = selectorArgs[0],
instanceId = selectorArgs[1];
var isAPIRef = checkIsAPIRef(stateOrApiRef);
var cacheKey = isAPIRef ? stateOrApiRef.current.instanceId : instanceId != null ? instanceId : DEFAULT_INSTANCE_ID;
var state = isAPIRef ? stateOrApiRef.current.state : stateOrApiRef;
if (process.env.NODE_ENV !== 'production') {
if (cacheKey.id === 'default') {
missingInstanceIdWarning();
}
}
var cache = cacheContainer.cache;
if (cache.get(cacheKey) && (_cache$get = cache.get(cacheKey)) != null && _cache$get.get(args)) {
var _cache$get2;
// We pass the cache key because the called selector might have as
// dependency another selector created with this `createSelector`.
return (_cache$get2 = cache.get(cacheKey)) == null ? void 0 : _cache$get2.get(args)(state, cacheKey);
}
var newSelector = reselectCreateSelector.apply(void 0, args);
if (!cache.get(cacheKey)) {
cache.set(cacheKey, new Map());
}
(_cache$get3 = cache.get(cacheKey)) == null || _cache$get3.set(args, newSelector);
return newSelector(state, cacheKey);
};
// We use this property to detect if the selector was created with createSelector
// or it's only a simple function the receives the state and returns part of it.
selector.acceptsApiRef = true;
return selector;
};
// eslint-disable-next-line @typescript-eslint/naming-convention
export var unstable_resetCreateSelectorCache = function unstable_resetCreateSelectorCache() {
cacheContainer.cache = new WeakMap();
};

View File

@@ -0,0 +1,13 @@
// Based on https://stackoverflow.com/a/59518678
var cachedSupportsPreventScroll;
export function doesSupportPreventScroll() {
if (cachedSupportsPreventScroll === undefined) {
document.createElement('div').focus({
get preventScroll() {
cachedSupportsPreventScroll = true;
return false;
}
});
}
return cachedSupportsPreventScroll;
}

View File

@@ -0,0 +1,63 @@
import { gridClasses } from '../constants/gridClasses';
export function isOverflown(element) {
return element.scrollHeight > element.clientHeight || element.scrollWidth > element.clientWidth;
}
export function findParentElementFromClassName(elem, className) {
return elem.closest(".".concat(className));
}
export function getRowEl(cell) {
if (!cell) {
return null;
}
return findParentElementFromClassName(cell, gridClasses.row);
}
// TODO remove
export function isGridCellRoot(elem) {
return elem != null && elem.classList.contains(gridClasses.cell);
}
export function isGridHeaderCellRoot(elem) {
return elem != null && elem.classList.contains(gridClasses.columnHeader);
}
function escapeOperandAttributeSelector(operand) {
return operand.replace(/["\\]/g, '\\$&');
}
export function getGridColumnHeaderElement(root, field) {
return root.querySelector("[role=\"columnheader\"][data-field=\"".concat(escapeOperandAttributeSelector(field), "\"]"));
}
function getGridRowElementSelector(id) {
return ".".concat(gridClasses.row, "[data-id=\"").concat(escapeOperandAttributeSelector(String(id)), "\"]");
}
export function getGridRowElement(root, id) {
return root.querySelector(getGridRowElementSelector(id));
}
export function getGridCellElement(root, _ref) {
var id = _ref.id,
field = _ref.field;
var rowSelector = getGridRowElementSelector(id);
var cellSelector = ".".concat(gridClasses.cell, "[data-field=\"").concat(escapeOperandAttributeSelector(field), "\"]");
var selector = "".concat(rowSelector, " ").concat(cellSelector);
return root.querySelector(selector);
}
// https://www.abeautifulsite.net/posts/finding-the-active-element-in-a-shadow-root/
export var getActiveElement = function getActiveElement() {
var root = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document;
var activeEl = root.activeElement;
if (!activeEl) {
return null;
}
if (activeEl.shadowRoot) {
return getActiveElement(activeEl.shadowRoot);
}
return activeEl;
};
export function isEventTargetInPortal(event) {
if (
// The target is not an element when triggered by a Select inside the cell
// See https://github.com/mui/material-ui/issues/10534
event.target.nodeType === 1 && !event.currentTarget.contains(event.target)) {
return true;
}
return false;
}

View File

@@ -0,0 +1,40 @@
/**
* I have hesitated to use https://github.com/eligrey/FileSaver.js.
* If we get bug reports that this project solves, we should consider using it.
*
* Related resources.
* https://blog.logrocket.com/programmatic-file-downloads-in-the-browser-9a5186298d5c/
* https://github.com/mbrn/filefy/blob/ec4ed0b7415d93be7158c23029f2ea1fa0b8e2d9/src/core/BaseBuilder.ts
* https://unpkg.com/browse/@progress/kendo-file-saver@1.0.7/dist/es/save-as.js
* https://github.com/ag-grid/ag-grid/blob/9565c219b6210aa85fa833c929d0728f9d163a91/community-modules/csv-export/src/csvExport/downloader.ts
*/
export function exportAs(blob) {
var extension = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'csv';
var filename = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : document.title || 'untitled';
var fullName = "".concat(filename, ".").concat(extension);
// Test download attribute first
// https://github.com/eligrey/FileSaver.js/issues/193
if ('download' in HTMLAnchorElement.prototype) {
// Create an object URL for the blob object
var url = URL.createObjectURL(blob);
// Create a new anchor element
var a = document.createElement('a');
a.href = url;
a.download = fullName;
// Programmatically trigger a click on the anchor element
// Useful if you want the download to happen automatically
// Without attaching the anchor element to the DOM
a.click();
// https://github.com/eligrey/FileSaver.js/issues/205
setTimeout(function () {
URL.revokeObjectURL(url);
});
return;
}
throw new Error('MUI: exportAs not supported');
}

View File

@@ -0,0 +1,5 @@
import * as React from 'react';
import { fastObjectShallowCompare } from './fastObjectShallowCompare';
export function fastMemo(component) {
return /*#__PURE__*/React.memo(component, fastObjectShallowCompare);
}

View File

@@ -0,0 +1,32 @@
var is = Object.is;
export function fastObjectShallowCompare(a, b) {
if (a === b) {
return true;
}
if (!(a instanceof Object) || !(b instanceof Object)) {
return false;
}
var aLength = 0;
var bLength = 0;
/* eslint-disable no-restricted-syntax */
/* eslint-disable guard-for-in */
for (var key in a) {
aLength += 1;
if (!is(a[key], b[key])) {
return false;
}
if (!(key in b)) {
return false;
}
}
/* eslint-disable-next-line @typescript-eslint/naming-convention, @typescript-eslint/no-unused-vars */
for (var _ in b) {
bLength += 1;
}
/* eslint-enable no-restricted-syntax */
/* eslint-enable guard-for-in */
return aLength === bLength;
}

View File

@@ -0,0 +1,15 @@
import _extends from "@babel/runtime/helpers/esm/extends";
export var getGridLocalization = function getGridLocalization(gridTranslations, coreTranslations) {
var _coreTranslations$com;
return {
components: {
MuiDataGrid: {
defaultProps: {
localeText: _extends({}, gridTranslations, {
MuiTablePagination: (coreTranslations == null || (_coreTranslations$com = coreTranslations.components) == null || (_coreTranslations$com = _coreTranslations$com.MuiTablePagination) == null ? void 0 : _coreTranslations$com.defaultProps) || {}
})
}
}
}
};
};

View File

@@ -0,0 +1,5 @@
export function getPublicApiRef(apiRef) {
return {
current: apiRef.current.getPublicApi()
};
}

View File

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

View File

@@ -0,0 +1,60 @@
export var isEscapeKey = function isEscapeKey(key) {
return key === 'Escape';
}; // TODO remove
export var isEnterKey = function isEnterKey(key) {
return key === 'Enter';
}; // TODO remove
export var isTabKey = function isTabKey(key) {
return key === 'Tab';
}; // TODO remove
export var isSpaceKey = function isSpaceKey(key) {
return key === ' ';
};
export var isArrowKeys = function isArrowKeys(key) {
return key.indexOf('Arrow') === 0;
};
export var isHomeOrEndKeys = function isHomeOrEndKeys(key) {
return key === 'Home' || key === 'End';
};
export var isPageKeys = function isPageKeys(key) {
return key.indexOf('Page') === 0;
};
export var isDeleteKeys = function isDeleteKeys(key) {
return key === 'Delete' || key === 'Backspace';
};
// Non printable keys have a name, e.g. "ArrowRight", see the whole list:
// https://developer.mozilla.org/en-US/docs/Web/API/UI_Events/Keyboard_event_key_values
// So event.key.length === 1 is often enough.
//
// However, we also need to ignore shortcuts, for example: select all:
// - Windows: Ctrl+A, event.ctrlKey is true
// - macOS: ⌘ Command+A, event.metaKey is true
export function isPrintableKey(event) {
return event.key.length === 1 && !event.ctrlKey && !event.metaKey;
}
export var GRID_MULTIPLE_SELECTION_KEYS = ['Meta', 'Control', 'Shift'];
export var GRID_CELL_EXIT_EDIT_MODE_KEYS = ['Enter', 'Escape', 'Tab'];
export var GRID_CELL_EDIT_COMMIT_KEYS = ['Enter', 'Tab'];
export var isMultipleKey = function isMultipleKey(key) {
return GRID_MULTIPLE_SELECTION_KEYS.indexOf(key) > -1;
};
export var isCellEnterEditModeKeys = function isCellEnterEditModeKeys(event) {
return isEnterKey(event.key) || isDeleteKeys(event.key) || isPrintableKey(event);
};
export var isCellExitEditModeKeys = function isCellExitEditModeKeys(key) {
return GRID_CELL_EXIT_EDIT_MODE_KEYS.indexOf(key) > -1;
};
export var isCellEditCommitKeys = function isCellEditCommitKeys(key) {
return GRID_CELL_EDIT_COMMIT_KEYS.indexOf(key) > -1;
};
export var isNavigationKey = function isNavigationKey(key) {
return isHomeOrEndKeys(key) || isArrowKeys(key) || isPageKeys(key) || isSpaceKey(key);
};
export var isKeyboardEvent = function isKeyboardEvent(event) {
return !!event.key;
};
export var isHideMenuKey = function isHideMenuKey(key) {
return isTabKey(key) || isEscapeKey(key);
};

View File

@@ -0,0 +1,180 @@
import _typeof from "@babel/runtime/helpers/esm/typeof";
export function isNumber(value) {
return typeof value === 'number' && !Number.isNaN(value);
}
export function isFunction(value) {
return typeof value === 'function';
}
export function isObject(value) {
return _typeof(value) === 'object' && value !== null;
}
export function localStorageAvailable() {
try {
// Incognito mode might reject access to the localStorage for security reasons.
// window isn't defined on Node.js
// https://stackoverflow.com/questions/16427636/check-if-localstorage-is-available
var key = '__some_random_key_you_are_not_going_to_use__';
window.localStorage.setItem(key, key);
window.localStorage.removeItem(key);
return true;
} catch (err) {
return false;
}
}
export function escapeRegExp(value) {
return value.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&');
}
/**
* Follows the CSS specification behavior for min and max
* If min > max, then the min have priority
*/
export var clamp = function clamp(value, min, max) {
return Math.max(min, Math.min(max, value));
};
/**
* Based on `fast-deep-equal`
*
* MIT License
*
* Copyright (c) 2017 Evgeny Poberezkin
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
* We only type the public interface to avoid dozens of `as` in the function.
*/
export function isDeepEqual(a, b) {
if (a === b) {
return true;
}
if (a && b && _typeof(a) === 'object' && _typeof(b) === 'object') {
if (a.constructor !== b.constructor) {
return false;
}
if (Array.isArray(a)) {
var _length = a.length;
if (_length !== b.length) {
return false;
}
for (var i = 0; i < _length; i += 1) {
if (!isDeepEqual(a[i], b[i])) {
return false;
}
}
return true;
}
if (a instanceof Map && b instanceof Map) {
if (a.size !== b.size) {
return false;
}
var entriesA = Array.from(a.entries());
for (var _i = 0; _i < entriesA.length; _i += 1) {
if (!b.has(entriesA[_i][0])) {
return false;
}
}
for (var _i2 = 0; _i2 < entriesA.length; _i2 += 1) {
var entryA = entriesA[_i2];
if (!isDeepEqual(entryA[1], b.get(entryA[0]))) {
return false;
}
}
return true;
}
if (a instanceof Set && b instanceof Set) {
if (a.size !== b.size) {
return false;
}
var entries = Array.from(a.entries());
for (var _i3 = 0; _i3 < entries.length; _i3 += 1) {
if (!b.has(entries[_i3][0])) {
return false;
}
}
return true;
}
if (ArrayBuffer.isView(a) && ArrayBuffer.isView(b)) {
var _length2 = a.length;
if (_length2 !== b.length) {
return false;
}
for (var _i4 = 0; _i4 < _length2; _i4 += 1) {
if (a[_i4] !== b[_i4]) {
return false;
}
}
return true;
}
if (a.constructor === RegExp) {
return a.source === b.source && a.flags === b.flags;
}
if (a.valueOf !== Object.prototype.valueOf) {
return a.valueOf() === b.valueOf();
}
if (a.toString !== Object.prototype.toString) {
return a.toString() === b.toString();
}
var keys = Object.keys(a);
var length = keys.length;
if (length !== Object.keys(b).length) {
return false;
}
for (var _i5 = 0; _i5 < length; _i5 += 1) {
if (!Object.prototype.hasOwnProperty.call(b, keys[_i5])) {
return false;
}
}
for (var _i6 = 0; _i6 < length; _i6 += 1) {
var key = keys[_i6];
if (!isDeepEqual(a[key], b[key])) {
return false;
}
}
return true;
}
// true if both NaN, false otherwise
// eslint-disable-next-line no-self-compare
return a !== a && b !== b;
}
// Pseudo random number. See https://stackoverflow.com/a/47593316
function mulberry32(a) {
return function () {
/* eslint-disable */
var t = a += 0x6d2b79f5;
t = Math.imul(t ^ t >>> 15, t | 1);
t ^= t + Math.imul(t ^ t >>> 7, t | 61);
return ((t ^ t >>> 14) >>> 0) / 4294967296;
/* eslint-enable */
};
}
export function randomNumberBetween(seed, min, max) {
var random = mulberry32(seed);
return function () {
return min + (max - min) * random();
};
}
export function deepClone(obj) {
if (typeof structuredClone === 'function') {
return structuredClone(obj);
}
return JSON.parse(JSON.stringify(obj));
}

View File

@@ -0,0 +1,25 @@
export var buildWarning = function buildWarning(message) {
var gravity = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'warning';
var alreadyWarned = false;
var cleanMessage = Array.isArray(message) ? message.join('\n') : message;
return function () {
if (!alreadyWarned) {
alreadyWarned = true;
if (gravity === 'error') {
console.error(cleanMessage);
} else {
console.warn(cleanMessage);
}
}
};
};
export var wrapWithWarningOnCall = function wrapWithWarningOnCall(method, message) {
if (process.env.NODE_ENV === 'production') {
return method;
}
var warning = buildWarning(message);
return function () {
warning();
return method.apply(void 0, arguments);
};
};