@seamly/web-ui 25.1.0 → 25.2.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/dist/lib/index.debug.js +239 -95
- package/build/dist/lib/index.debug.js.map +1 -1
- package/build/dist/lib/index.debug.min.js +1 -1
- package/build/dist/lib/index.debug.min.js.LICENSE.txt +2 -2
- package/build/dist/lib/index.debug.min.js.map +1 -1
- package/build/dist/lib/index.js +828 -691
- package/build/dist/lib/index.js.map +1 -1
- package/build/dist/lib/index.min.js +1 -1
- package/build/dist/lib/index.min.js.LICENSE.txt +2 -2
- package/build/dist/lib/index.min.js.map +1 -1
- package/build/dist/lib/style-guide.js +1300 -41
- package/build/dist/lib/style-guide.js.map +1 -1
- package/build/dist/lib/style-guide.min.js +1 -1
- package/build/dist/lib/style-guide.min.js.map +1 -1
- package/build/dist/lib/styles.css +1 -1
- package/package.json +16 -16
- package/src/javascripts/core/domains/store/slice.ts +1 -0
- package/src/javascripts/core/domains/store/store.types.ts +1 -0
- package/src/javascripts/core/ui/components/conversation/conversation.tsx +5 -2
- package/src/javascripts/core/ui/components/conversation/loader.tsx +12 -2
- package/src/javascripts/core/ui/components/entry/text-entry/index.tsx +2 -2
- package/src/javascripts/core/ui/components/entry/upload/index.tsx +2 -2
- package/src/javascripts/core/ui/components/view/window-view/window-open-button.tsx +20 -5
- package/src/javascripts/core/ui/components/warnings/prompt.tsx +2 -2
- package/src/javascripts/core/ui/hooks/focus-helper-hooks.ts +11 -2
- package/src/javascripts/core/ui/hooks/seamly-hooks.ts +2 -1
- package/src/javascripts/core/ui/hooks/seamly-state-hooks.ts +4 -1
- package/src/stylesheets/5-components/_conversation.scss +6 -2
|
@@ -2094,10 +2094,10 @@ var SHARED = '__core-js_shared__';
|
|
|
2094
2094
|
var store = module.exports = globalThis[SHARED] || defineGlobalProperty(SHARED, {});
|
|
2095
2095
|
|
|
2096
2096
|
(store.versions || (store.versions = [])).push({
|
|
2097
|
-
version: '3.
|
|
2097
|
+
version: '3.46.0',
|
|
2098
2098
|
mode: IS_PURE ? 'pure' : 'global',
|
|
2099
|
-
copyright: '© 2014-2025 Denis Pushkarev (zloirock.ru)',
|
|
2100
|
-
license: 'https://github.com/zloirock/core-js/blob/v3.
|
|
2099
|
+
copyright: '© 2014-2025 Denis Pushkarev (zloirock.ru), 2025 CoreJS Company (core-js.io)',
|
|
2100
|
+
license: 'https://github.com/zloirock/core-js/blob/v3.46.0/LICENSE',
|
|
2101
2101
|
source: 'https://github.com/zloirock/core-js'
|
|
2102
2102
|
});
|
|
2103
2103
|
|
|
@@ -5500,6 +5500,1246 @@ const StyleGuideLinks = ({
|
|
|
5500
5500
|
/* harmony default export */ const links = (StyleGuideLinks);
|
|
5501
5501
|
// EXTERNAL MODULE: ./node_modules/core-js/modules/esnext.iterator.for-each.js
|
|
5502
5502
|
var esnext_iterator_for_each = __webpack_require__(3949);
|
|
5503
|
+
;// ./node_modules/immer/dist/immer.mjs
|
|
5504
|
+
// src/utils/env.ts
|
|
5505
|
+
var NOTHING = Symbol.for("immer-nothing");
|
|
5506
|
+
var DRAFTABLE = Symbol.for("immer-draftable");
|
|
5507
|
+
var DRAFT_STATE = Symbol.for("immer-state");
|
|
5508
|
+
|
|
5509
|
+
// src/utils/errors.ts
|
|
5510
|
+
var errors = false ? 0 : [];
|
|
5511
|
+
function die(error, ...args) {
|
|
5512
|
+
if (false) // removed by dead control flow
|
|
5513
|
+
{}
|
|
5514
|
+
throw new Error(
|
|
5515
|
+
`[Immer] minified error nr: ${error}. Full error at: https://bit.ly/3cXEKWf`
|
|
5516
|
+
);
|
|
5517
|
+
}
|
|
5518
|
+
|
|
5519
|
+
// src/utils/common.ts
|
|
5520
|
+
var getPrototypeOf = Object.getPrototypeOf;
|
|
5521
|
+
function immer_isDraft(value) {
|
|
5522
|
+
return !!value && !!value[DRAFT_STATE];
|
|
5523
|
+
}
|
|
5524
|
+
function immer_isDraftable(value) {
|
|
5525
|
+
if (!value)
|
|
5526
|
+
return false;
|
|
5527
|
+
return immer_isPlainObject(value) || Array.isArray(value) || !!value[DRAFTABLE] || !!value.constructor?.[DRAFTABLE] || isMap(value) || isSet(value);
|
|
5528
|
+
}
|
|
5529
|
+
var objectCtorString = Object.prototype.constructor.toString();
|
|
5530
|
+
var cachedCtorStrings = /* @__PURE__ */ new WeakMap();
|
|
5531
|
+
function immer_isPlainObject(value) {
|
|
5532
|
+
if (!value || typeof value !== "object")
|
|
5533
|
+
return false;
|
|
5534
|
+
const proto = Object.getPrototypeOf(value);
|
|
5535
|
+
if (proto === null || proto === Object.prototype)
|
|
5536
|
+
return true;
|
|
5537
|
+
const Ctor = Object.hasOwnProperty.call(proto, "constructor") && proto.constructor;
|
|
5538
|
+
if (Ctor === Object)
|
|
5539
|
+
return true;
|
|
5540
|
+
if (typeof Ctor !== "function")
|
|
5541
|
+
return false;
|
|
5542
|
+
let ctorString = cachedCtorStrings.get(Ctor);
|
|
5543
|
+
if (ctorString === void 0) {
|
|
5544
|
+
ctorString = Function.toString.call(Ctor);
|
|
5545
|
+
cachedCtorStrings.set(Ctor, ctorString);
|
|
5546
|
+
}
|
|
5547
|
+
return ctorString === objectCtorString;
|
|
5548
|
+
}
|
|
5549
|
+
function original(value) {
|
|
5550
|
+
if (!immer_isDraft(value))
|
|
5551
|
+
die(15, value);
|
|
5552
|
+
return value[DRAFT_STATE].base_;
|
|
5553
|
+
}
|
|
5554
|
+
function each(obj, iter, strict = true) {
|
|
5555
|
+
if (getArchtype(obj) === 0 /* Object */) {
|
|
5556
|
+
const keys = strict ? Reflect.ownKeys(obj) : Object.keys(obj);
|
|
5557
|
+
keys.forEach((key) => {
|
|
5558
|
+
iter(key, obj[key], obj);
|
|
5559
|
+
});
|
|
5560
|
+
} else {
|
|
5561
|
+
obj.forEach((entry, index) => iter(index, entry, obj));
|
|
5562
|
+
}
|
|
5563
|
+
}
|
|
5564
|
+
function getArchtype(thing) {
|
|
5565
|
+
const state = thing[DRAFT_STATE];
|
|
5566
|
+
return state ? state.type_ : Array.isArray(thing) ? 1 /* Array */ : isMap(thing) ? 2 /* Map */ : isSet(thing) ? 3 /* Set */ : 0 /* Object */;
|
|
5567
|
+
}
|
|
5568
|
+
function has(thing, prop) {
|
|
5569
|
+
return getArchtype(thing) === 2 /* Map */ ? thing.has(prop) : Object.prototype.hasOwnProperty.call(thing, prop);
|
|
5570
|
+
}
|
|
5571
|
+
function get(thing, prop) {
|
|
5572
|
+
return getArchtype(thing) === 2 /* Map */ ? thing.get(prop) : thing[prop];
|
|
5573
|
+
}
|
|
5574
|
+
function set(thing, propOrOldValue, value) {
|
|
5575
|
+
const t = getArchtype(thing);
|
|
5576
|
+
if (t === 2 /* Map */)
|
|
5577
|
+
thing.set(propOrOldValue, value);
|
|
5578
|
+
else if (t === 3 /* Set */) {
|
|
5579
|
+
thing.add(value);
|
|
5580
|
+
} else
|
|
5581
|
+
thing[propOrOldValue] = value;
|
|
5582
|
+
}
|
|
5583
|
+
function is(x, y) {
|
|
5584
|
+
if (x === y) {
|
|
5585
|
+
return x !== 0 || 1 / x === 1 / y;
|
|
5586
|
+
} else {
|
|
5587
|
+
return x !== x && y !== y;
|
|
5588
|
+
}
|
|
5589
|
+
}
|
|
5590
|
+
function isMap(target) {
|
|
5591
|
+
return target instanceof Map;
|
|
5592
|
+
}
|
|
5593
|
+
function isSet(target) {
|
|
5594
|
+
return target instanceof Set;
|
|
5595
|
+
}
|
|
5596
|
+
function latest(state) {
|
|
5597
|
+
return state.copy_ || state.base_;
|
|
5598
|
+
}
|
|
5599
|
+
function shallowCopy(base, strict) {
|
|
5600
|
+
if (isMap(base)) {
|
|
5601
|
+
return new Map(base);
|
|
5602
|
+
}
|
|
5603
|
+
if (isSet(base)) {
|
|
5604
|
+
return new Set(base);
|
|
5605
|
+
}
|
|
5606
|
+
if (Array.isArray(base))
|
|
5607
|
+
return Array.prototype.slice.call(base);
|
|
5608
|
+
const isPlain = immer_isPlainObject(base);
|
|
5609
|
+
if (strict === true || strict === "class_only" && !isPlain) {
|
|
5610
|
+
const descriptors = Object.getOwnPropertyDescriptors(base);
|
|
5611
|
+
delete descriptors[DRAFT_STATE];
|
|
5612
|
+
let keys = Reflect.ownKeys(descriptors);
|
|
5613
|
+
for (let i = 0; i < keys.length; i++) {
|
|
5614
|
+
const key = keys[i];
|
|
5615
|
+
const desc = descriptors[key];
|
|
5616
|
+
if (desc.writable === false) {
|
|
5617
|
+
desc.writable = true;
|
|
5618
|
+
desc.configurable = true;
|
|
5619
|
+
}
|
|
5620
|
+
if (desc.get || desc.set)
|
|
5621
|
+
descriptors[key] = {
|
|
5622
|
+
configurable: true,
|
|
5623
|
+
writable: true,
|
|
5624
|
+
// could live with !!desc.set as well here...
|
|
5625
|
+
enumerable: desc.enumerable,
|
|
5626
|
+
value: base[key]
|
|
5627
|
+
};
|
|
5628
|
+
}
|
|
5629
|
+
return Object.create(getPrototypeOf(base), descriptors);
|
|
5630
|
+
} else {
|
|
5631
|
+
const proto = getPrototypeOf(base);
|
|
5632
|
+
if (proto !== null && isPlain) {
|
|
5633
|
+
return { ...base };
|
|
5634
|
+
}
|
|
5635
|
+
const obj = Object.create(proto);
|
|
5636
|
+
return Object.assign(obj, base);
|
|
5637
|
+
}
|
|
5638
|
+
}
|
|
5639
|
+
function freeze(obj, deep = false) {
|
|
5640
|
+
if (isFrozen(obj) || immer_isDraft(obj) || !immer_isDraftable(obj))
|
|
5641
|
+
return obj;
|
|
5642
|
+
if (getArchtype(obj) > 1) {
|
|
5643
|
+
Object.defineProperties(obj, {
|
|
5644
|
+
set: dontMutateMethodOverride,
|
|
5645
|
+
add: dontMutateMethodOverride,
|
|
5646
|
+
clear: dontMutateMethodOverride,
|
|
5647
|
+
delete: dontMutateMethodOverride
|
|
5648
|
+
});
|
|
5649
|
+
}
|
|
5650
|
+
Object.freeze(obj);
|
|
5651
|
+
if (deep)
|
|
5652
|
+
Object.values(obj).forEach((value) => freeze(value, true));
|
|
5653
|
+
return obj;
|
|
5654
|
+
}
|
|
5655
|
+
function dontMutateFrozenCollections() {
|
|
5656
|
+
die(2);
|
|
5657
|
+
}
|
|
5658
|
+
var dontMutateMethodOverride = {
|
|
5659
|
+
value: dontMutateFrozenCollections
|
|
5660
|
+
};
|
|
5661
|
+
function isFrozen(obj) {
|
|
5662
|
+
if (obj === null || typeof obj !== "object")
|
|
5663
|
+
return true;
|
|
5664
|
+
return Object.isFrozen(obj);
|
|
5665
|
+
}
|
|
5666
|
+
|
|
5667
|
+
// src/utils/plugins.ts
|
|
5668
|
+
var plugins = {};
|
|
5669
|
+
function getPlugin(pluginKey) {
|
|
5670
|
+
const plugin = plugins[pluginKey];
|
|
5671
|
+
if (!plugin) {
|
|
5672
|
+
die(0, pluginKey);
|
|
5673
|
+
}
|
|
5674
|
+
return plugin;
|
|
5675
|
+
}
|
|
5676
|
+
function loadPlugin(pluginKey, implementation) {
|
|
5677
|
+
if (!plugins[pluginKey])
|
|
5678
|
+
plugins[pluginKey] = implementation;
|
|
5679
|
+
}
|
|
5680
|
+
|
|
5681
|
+
// src/core/scope.ts
|
|
5682
|
+
var currentScope;
|
|
5683
|
+
function getCurrentScope() {
|
|
5684
|
+
return currentScope;
|
|
5685
|
+
}
|
|
5686
|
+
function createScope(parent_, immer_) {
|
|
5687
|
+
return {
|
|
5688
|
+
drafts_: [],
|
|
5689
|
+
parent_,
|
|
5690
|
+
immer_,
|
|
5691
|
+
// Whenever the modified draft contains a draft from another scope, we
|
|
5692
|
+
// need to prevent auto-freezing so the unowned draft can be finalized.
|
|
5693
|
+
canAutoFreeze_: true,
|
|
5694
|
+
unfinalizedDrafts_: 0
|
|
5695
|
+
};
|
|
5696
|
+
}
|
|
5697
|
+
function usePatchesInScope(scope, patchListener) {
|
|
5698
|
+
if (patchListener) {
|
|
5699
|
+
getPlugin("Patches");
|
|
5700
|
+
scope.patches_ = [];
|
|
5701
|
+
scope.inversePatches_ = [];
|
|
5702
|
+
scope.patchListener_ = patchListener;
|
|
5703
|
+
}
|
|
5704
|
+
}
|
|
5705
|
+
function revokeScope(scope) {
|
|
5706
|
+
leaveScope(scope);
|
|
5707
|
+
scope.drafts_.forEach(revokeDraft);
|
|
5708
|
+
scope.drafts_ = null;
|
|
5709
|
+
}
|
|
5710
|
+
function leaveScope(scope) {
|
|
5711
|
+
if (scope === currentScope) {
|
|
5712
|
+
currentScope = scope.parent_;
|
|
5713
|
+
}
|
|
5714
|
+
}
|
|
5715
|
+
function enterScope(immer2) {
|
|
5716
|
+
return currentScope = createScope(currentScope, immer2);
|
|
5717
|
+
}
|
|
5718
|
+
function revokeDraft(draft) {
|
|
5719
|
+
const state = draft[DRAFT_STATE];
|
|
5720
|
+
if (state.type_ === 0 /* Object */ || state.type_ === 1 /* Array */)
|
|
5721
|
+
state.revoke_();
|
|
5722
|
+
else
|
|
5723
|
+
state.revoked_ = true;
|
|
5724
|
+
}
|
|
5725
|
+
|
|
5726
|
+
// src/core/finalize.ts
|
|
5727
|
+
function processResult(result, scope) {
|
|
5728
|
+
scope.unfinalizedDrafts_ = scope.drafts_.length;
|
|
5729
|
+
const baseDraft = scope.drafts_[0];
|
|
5730
|
+
const isReplaced = result !== void 0 && result !== baseDraft;
|
|
5731
|
+
if (isReplaced) {
|
|
5732
|
+
if (baseDraft[DRAFT_STATE].modified_) {
|
|
5733
|
+
revokeScope(scope);
|
|
5734
|
+
die(4);
|
|
5735
|
+
}
|
|
5736
|
+
if (immer_isDraftable(result)) {
|
|
5737
|
+
result = finalize(scope, result);
|
|
5738
|
+
if (!scope.parent_)
|
|
5739
|
+
maybeFreeze(scope, result);
|
|
5740
|
+
}
|
|
5741
|
+
if (scope.patches_) {
|
|
5742
|
+
getPlugin("Patches").generateReplacementPatches_(
|
|
5743
|
+
baseDraft[DRAFT_STATE].base_,
|
|
5744
|
+
result,
|
|
5745
|
+
scope.patches_,
|
|
5746
|
+
scope.inversePatches_
|
|
5747
|
+
);
|
|
5748
|
+
}
|
|
5749
|
+
} else {
|
|
5750
|
+
result = finalize(scope, baseDraft, []);
|
|
5751
|
+
}
|
|
5752
|
+
revokeScope(scope);
|
|
5753
|
+
if (scope.patches_) {
|
|
5754
|
+
scope.patchListener_(scope.patches_, scope.inversePatches_);
|
|
5755
|
+
}
|
|
5756
|
+
return result !== NOTHING ? result : void 0;
|
|
5757
|
+
}
|
|
5758
|
+
function finalize(rootScope, value, path) {
|
|
5759
|
+
if (isFrozen(value))
|
|
5760
|
+
return value;
|
|
5761
|
+
const useStrictIteration = rootScope.immer_.shouldUseStrictIteration();
|
|
5762
|
+
const state = value[DRAFT_STATE];
|
|
5763
|
+
if (!state) {
|
|
5764
|
+
each(
|
|
5765
|
+
value,
|
|
5766
|
+
(key, childValue) => finalizeProperty(rootScope, state, value, key, childValue, path),
|
|
5767
|
+
useStrictIteration
|
|
5768
|
+
);
|
|
5769
|
+
return value;
|
|
5770
|
+
}
|
|
5771
|
+
if (state.scope_ !== rootScope)
|
|
5772
|
+
return value;
|
|
5773
|
+
if (!state.modified_) {
|
|
5774
|
+
maybeFreeze(rootScope, state.base_, true);
|
|
5775
|
+
return state.base_;
|
|
5776
|
+
}
|
|
5777
|
+
if (!state.finalized_) {
|
|
5778
|
+
state.finalized_ = true;
|
|
5779
|
+
state.scope_.unfinalizedDrafts_--;
|
|
5780
|
+
const result = state.copy_;
|
|
5781
|
+
let resultEach = result;
|
|
5782
|
+
let isSet2 = false;
|
|
5783
|
+
if (state.type_ === 3 /* Set */) {
|
|
5784
|
+
resultEach = new Set(result);
|
|
5785
|
+
result.clear();
|
|
5786
|
+
isSet2 = true;
|
|
5787
|
+
}
|
|
5788
|
+
each(
|
|
5789
|
+
resultEach,
|
|
5790
|
+
(key, childValue) => finalizeProperty(
|
|
5791
|
+
rootScope,
|
|
5792
|
+
state,
|
|
5793
|
+
result,
|
|
5794
|
+
key,
|
|
5795
|
+
childValue,
|
|
5796
|
+
path,
|
|
5797
|
+
isSet2
|
|
5798
|
+
),
|
|
5799
|
+
useStrictIteration
|
|
5800
|
+
);
|
|
5801
|
+
maybeFreeze(rootScope, result, false);
|
|
5802
|
+
if (path && rootScope.patches_) {
|
|
5803
|
+
getPlugin("Patches").generatePatches_(
|
|
5804
|
+
state,
|
|
5805
|
+
path,
|
|
5806
|
+
rootScope.patches_,
|
|
5807
|
+
rootScope.inversePatches_
|
|
5808
|
+
);
|
|
5809
|
+
}
|
|
5810
|
+
}
|
|
5811
|
+
return state.copy_;
|
|
5812
|
+
}
|
|
5813
|
+
function finalizeProperty(rootScope, parentState, targetObject, prop, childValue, rootPath, targetIsSet) {
|
|
5814
|
+
if (childValue == null) {
|
|
5815
|
+
return;
|
|
5816
|
+
}
|
|
5817
|
+
if (typeof childValue !== "object" && !targetIsSet) {
|
|
5818
|
+
return;
|
|
5819
|
+
}
|
|
5820
|
+
const childIsFrozen = isFrozen(childValue);
|
|
5821
|
+
if (childIsFrozen && !targetIsSet) {
|
|
5822
|
+
return;
|
|
5823
|
+
}
|
|
5824
|
+
if (false)
|
|
5825
|
+
// removed by dead control flow
|
|
5826
|
+
{}
|
|
5827
|
+
if (immer_isDraft(childValue)) {
|
|
5828
|
+
const path = rootPath && parentState && parentState.type_ !== 3 /* Set */ && // Set objects are atomic since they have no keys.
|
|
5829
|
+
!has(parentState.assigned_, prop) ? rootPath.concat(prop) : void 0;
|
|
5830
|
+
const res = finalize(rootScope, childValue, path);
|
|
5831
|
+
set(targetObject, prop, res);
|
|
5832
|
+
if (immer_isDraft(res)) {
|
|
5833
|
+
rootScope.canAutoFreeze_ = false;
|
|
5834
|
+
} else
|
|
5835
|
+
return;
|
|
5836
|
+
} else if (targetIsSet) {
|
|
5837
|
+
targetObject.add(childValue);
|
|
5838
|
+
}
|
|
5839
|
+
if (immer_isDraftable(childValue) && !childIsFrozen) {
|
|
5840
|
+
if (!rootScope.immer_.autoFreeze_ && rootScope.unfinalizedDrafts_ < 1) {
|
|
5841
|
+
return;
|
|
5842
|
+
}
|
|
5843
|
+
if (parentState && parentState.base_ && parentState.base_[prop] === childValue && childIsFrozen) {
|
|
5844
|
+
return;
|
|
5845
|
+
}
|
|
5846
|
+
finalize(rootScope, childValue);
|
|
5847
|
+
if ((!parentState || !parentState.scope_.parent_) && typeof prop !== "symbol" && (isMap(targetObject) ? targetObject.has(prop) : Object.prototype.propertyIsEnumerable.call(targetObject, prop)))
|
|
5848
|
+
maybeFreeze(rootScope, childValue);
|
|
5849
|
+
}
|
|
5850
|
+
}
|
|
5851
|
+
function maybeFreeze(scope, value, deep = false) {
|
|
5852
|
+
if (!scope.parent_ && scope.immer_.autoFreeze_ && scope.canAutoFreeze_) {
|
|
5853
|
+
freeze(value, deep);
|
|
5854
|
+
}
|
|
5855
|
+
}
|
|
5856
|
+
|
|
5857
|
+
// src/core/proxy.ts
|
|
5858
|
+
function createProxyProxy(base, parent) {
|
|
5859
|
+
const isArray = Array.isArray(base);
|
|
5860
|
+
const state = {
|
|
5861
|
+
type_: isArray ? 1 /* Array */ : 0 /* Object */,
|
|
5862
|
+
// Track which produce call this is associated with.
|
|
5863
|
+
scope_: parent ? parent.scope_ : getCurrentScope(),
|
|
5864
|
+
// True for both shallow and deep changes.
|
|
5865
|
+
modified_: false,
|
|
5866
|
+
// Used during finalization.
|
|
5867
|
+
finalized_: false,
|
|
5868
|
+
// Track which properties have been assigned (true) or deleted (false).
|
|
5869
|
+
assigned_: {},
|
|
5870
|
+
// The parent draft state.
|
|
5871
|
+
parent_: parent,
|
|
5872
|
+
// The base state.
|
|
5873
|
+
base_: base,
|
|
5874
|
+
// The base proxy.
|
|
5875
|
+
draft_: null,
|
|
5876
|
+
// set below
|
|
5877
|
+
// The base copy with any updated values.
|
|
5878
|
+
copy_: null,
|
|
5879
|
+
// Called by the `produce` function.
|
|
5880
|
+
revoke_: null,
|
|
5881
|
+
isManual_: false
|
|
5882
|
+
};
|
|
5883
|
+
let target = state;
|
|
5884
|
+
let traps = objectTraps;
|
|
5885
|
+
if (isArray) {
|
|
5886
|
+
target = [state];
|
|
5887
|
+
traps = arrayTraps;
|
|
5888
|
+
}
|
|
5889
|
+
const { revoke, proxy } = Proxy.revocable(target, traps);
|
|
5890
|
+
state.draft_ = proxy;
|
|
5891
|
+
state.revoke_ = revoke;
|
|
5892
|
+
return proxy;
|
|
5893
|
+
}
|
|
5894
|
+
var objectTraps = {
|
|
5895
|
+
get(state, prop) {
|
|
5896
|
+
if (prop === DRAFT_STATE)
|
|
5897
|
+
return state;
|
|
5898
|
+
const source = latest(state);
|
|
5899
|
+
if (!has(source, prop)) {
|
|
5900
|
+
return readPropFromProto(state, source, prop);
|
|
5901
|
+
}
|
|
5902
|
+
const value = source[prop];
|
|
5903
|
+
if (state.finalized_ || !immer_isDraftable(value)) {
|
|
5904
|
+
return value;
|
|
5905
|
+
}
|
|
5906
|
+
if (value === peek(state.base_, prop)) {
|
|
5907
|
+
prepareCopy(state);
|
|
5908
|
+
return state.copy_[prop] = createProxy(value, state);
|
|
5909
|
+
}
|
|
5910
|
+
return value;
|
|
5911
|
+
},
|
|
5912
|
+
has(state, prop) {
|
|
5913
|
+
return prop in latest(state);
|
|
5914
|
+
},
|
|
5915
|
+
ownKeys(state) {
|
|
5916
|
+
return Reflect.ownKeys(latest(state));
|
|
5917
|
+
},
|
|
5918
|
+
set(state, prop, value) {
|
|
5919
|
+
const desc = getDescriptorFromProto(latest(state), prop);
|
|
5920
|
+
if (desc?.set) {
|
|
5921
|
+
desc.set.call(state.draft_, value);
|
|
5922
|
+
return true;
|
|
5923
|
+
}
|
|
5924
|
+
if (!state.modified_) {
|
|
5925
|
+
const current2 = peek(latest(state), prop);
|
|
5926
|
+
const currentState = current2?.[DRAFT_STATE];
|
|
5927
|
+
if (currentState && currentState.base_ === value) {
|
|
5928
|
+
state.copy_[prop] = value;
|
|
5929
|
+
state.assigned_[prop] = false;
|
|
5930
|
+
return true;
|
|
5931
|
+
}
|
|
5932
|
+
if (is(value, current2) && (value !== void 0 || has(state.base_, prop)))
|
|
5933
|
+
return true;
|
|
5934
|
+
prepareCopy(state);
|
|
5935
|
+
markChanged(state);
|
|
5936
|
+
}
|
|
5937
|
+
if (state.copy_[prop] === value && // special case: handle new props with value 'undefined'
|
|
5938
|
+
(value !== void 0 || prop in state.copy_) || // special case: NaN
|
|
5939
|
+
Number.isNaN(value) && Number.isNaN(state.copy_[prop]))
|
|
5940
|
+
return true;
|
|
5941
|
+
state.copy_[prop] = value;
|
|
5942
|
+
state.assigned_[prop] = true;
|
|
5943
|
+
return true;
|
|
5944
|
+
},
|
|
5945
|
+
deleteProperty(state, prop) {
|
|
5946
|
+
if (peek(state.base_, prop) !== void 0 || prop in state.base_) {
|
|
5947
|
+
state.assigned_[prop] = false;
|
|
5948
|
+
prepareCopy(state);
|
|
5949
|
+
markChanged(state);
|
|
5950
|
+
} else {
|
|
5951
|
+
delete state.assigned_[prop];
|
|
5952
|
+
}
|
|
5953
|
+
if (state.copy_) {
|
|
5954
|
+
delete state.copy_[prop];
|
|
5955
|
+
}
|
|
5956
|
+
return true;
|
|
5957
|
+
},
|
|
5958
|
+
// Note: We never coerce `desc.value` into an Immer draft, because we can't make
|
|
5959
|
+
// the same guarantee in ES5 mode.
|
|
5960
|
+
getOwnPropertyDescriptor(state, prop) {
|
|
5961
|
+
const owner = latest(state);
|
|
5962
|
+
const desc = Reflect.getOwnPropertyDescriptor(owner, prop);
|
|
5963
|
+
if (!desc)
|
|
5964
|
+
return desc;
|
|
5965
|
+
return {
|
|
5966
|
+
writable: true,
|
|
5967
|
+
configurable: state.type_ !== 1 /* Array */ || prop !== "length",
|
|
5968
|
+
enumerable: desc.enumerable,
|
|
5969
|
+
value: owner[prop]
|
|
5970
|
+
};
|
|
5971
|
+
},
|
|
5972
|
+
defineProperty() {
|
|
5973
|
+
die(11);
|
|
5974
|
+
},
|
|
5975
|
+
getPrototypeOf(state) {
|
|
5976
|
+
return getPrototypeOf(state.base_);
|
|
5977
|
+
},
|
|
5978
|
+
setPrototypeOf() {
|
|
5979
|
+
die(12);
|
|
5980
|
+
}
|
|
5981
|
+
};
|
|
5982
|
+
var arrayTraps = {};
|
|
5983
|
+
each(objectTraps, (key, fn) => {
|
|
5984
|
+
arrayTraps[key] = function() {
|
|
5985
|
+
arguments[0] = arguments[0][0];
|
|
5986
|
+
return fn.apply(this, arguments);
|
|
5987
|
+
};
|
|
5988
|
+
});
|
|
5989
|
+
arrayTraps.deleteProperty = function(state, prop) {
|
|
5990
|
+
if (false)
|
|
5991
|
+
// removed by dead control flow
|
|
5992
|
+
{}
|
|
5993
|
+
return arrayTraps.set.call(this, state, prop, void 0);
|
|
5994
|
+
};
|
|
5995
|
+
arrayTraps.set = function(state, prop, value) {
|
|
5996
|
+
if (false)
|
|
5997
|
+
// removed by dead control flow
|
|
5998
|
+
{}
|
|
5999
|
+
return objectTraps.set.call(this, state[0], prop, value, state[0]);
|
|
6000
|
+
};
|
|
6001
|
+
function peek(draft, prop) {
|
|
6002
|
+
const state = draft[DRAFT_STATE];
|
|
6003
|
+
const source = state ? latest(state) : draft;
|
|
6004
|
+
return source[prop];
|
|
6005
|
+
}
|
|
6006
|
+
function readPropFromProto(state, source, prop) {
|
|
6007
|
+
const desc = getDescriptorFromProto(source, prop);
|
|
6008
|
+
return desc ? `value` in desc ? desc.value : (
|
|
6009
|
+
// This is a very special case, if the prop is a getter defined by the
|
|
6010
|
+
// prototype, we should invoke it with the draft as context!
|
|
6011
|
+
desc.get?.call(state.draft_)
|
|
6012
|
+
) : void 0;
|
|
6013
|
+
}
|
|
6014
|
+
function getDescriptorFromProto(source, prop) {
|
|
6015
|
+
if (!(prop in source))
|
|
6016
|
+
return void 0;
|
|
6017
|
+
let proto = getPrototypeOf(source);
|
|
6018
|
+
while (proto) {
|
|
6019
|
+
const desc = Object.getOwnPropertyDescriptor(proto, prop);
|
|
6020
|
+
if (desc)
|
|
6021
|
+
return desc;
|
|
6022
|
+
proto = getPrototypeOf(proto);
|
|
6023
|
+
}
|
|
6024
|
+
return void 0;
|
|
6025
|
+
}
|
|
6026
|
+
function markChanged(state) {
|
|
6027
|
+
if (!state.modified_) {
|
|
6028
|
+
state.modified_ = true;
|
|
6029
|
+
if (state.parent_) {
|
|
6030
|
+
markChanged(state.parent_);
|
|
6031
|
+
}
|
|
6032
|
+
}
|
|
6033
|
+
}
|
|
6034
|
+
function prepareCopy(state) {
|
|
6035
|
+
if (!state.copy_) {
|
|
6036
|
+
state.copy_ = shallowCopy(
|
|
6037
|
+
state.base_,
|
|
6038
|
+
state.scope_.immer_.useStrictShallowCopy_
|
|
6039
|
+
);
|
|
6040
|
+
}
|
|
6041
|
+
}
|
|
6042
|
+
|
|
6043
|
+
// src/core/immerClass.ts
|
|
6044
|
+
var Immer2 = class {
|
|
6045
|
+
constructor(config) {
|
|
6046
|
+
this.autoFreeze_ = true;
|
|
6047
|
+
this.useStrictShallowCopy_ = false;
|
|
6048
|
+
this.useStrictIteration_ = true;
|
|
6049
|
+
/**
|
|
6050
|
+
* The `produce` function takes a value and a "recipe function" (whose
|
|
6051
|
+
* return value often depends on the base state). The recipe function is
|
|
6052
|
+
* free to mutate its first argument however it wants. All mutations are
|
|
6053
|
+
* only ever applied to a __copy__ of the base state.
|
|
6054
|
+
*
|
|
6055
|
+
* Pass only a function to create a "curried producer" which relieves you
|
|
6056
|
+
* from passing the recipe function every time.
|
|
6057
|
+
*
|
|
6058
|
+
* Only plain objects and arrays are made mutable. All other objects are
|
|
6059
|
+
* considered uncopyable.
|
|
6060
|
+
*
|
|
6061
|
+
* Note: This function is __bound__ to its `Immer` instance.
|
|
6062
|
+
*
|
|
6063
|
+
* @param {any} base - the initial state
|
|
6064
|
+
* @param {Function} recipe - function that receives a proxy of the base state as first argument and which can be freely modified
|
|
6065
|
+
* @param {Function} patchListener - optional function that will be called with all the patches produced here
|
|
6066
|
+
* @returns {any} a new state, or the initial state if nothing was modified
|
|
6067
|
+
*/
|
|
6068
|
+
this.produce = (base, recipe, patchListener) => {
|
|
6069
|
+
if (typeof base === "function" && typeof recipe !== "function") {
|
|
6070
|
+
const defaultBase = recipe;
|
|
6071
|
+
recipe = base;
|
|
6072
|
+
const self = this;
|
|
6073
|
+
return function curriedProduce(base2 = defaultBase, ...args) {
|
|
6074
|
+
return self.produce(base2, (draft) => recipe.call(this, draft, ...args));
|
|
6075
|
+
};
|
|
6076
|
+
}
|
|
6077
|
+
if (typeof recipe !== "function")
|
|
6078
|
+
die(6);
|
|
6079
|
+
if (patchListener !== void 0 && typeof patchListener !== "function")
|
|
6080
|
+
die(7);
|
|
6081
|
+
let result;
|
|
6082
|
+
if (immer_isDraftable(base)) {
|
|
6083
|
+
const scope = enterScope(this);
|
|
6084
|
+
const proxy = createProxy(base, void 0);
|
|
6085
|
+
let hasError = true;
|
|
6086
|
+
try {
|
|
6087
|
+
result = recipe(proxy);
|
|
6088
|
+
hasError = false;
|
|
6089
|
+
} finally {
|
|
6090
|
+
if (hasError)
|
|
6091
|
+
revokeScope(scope);
|
|
6092
|
+
else
|
|
6093
|
+
leaveScope(scope);
|
|
6094
|
+
}
|
|
6095
|
+
usePatchesInScope(scope, patchListener);
|
|
6096
|
+
return processResult(result, scope);
|
|
6097
|
+
} else if (!base || typeof base !== "object") {
|
|
6098
|
+
result = recipe(base);
|
|
6099
|
+
if (result === void 0)
|
|
6100
|
+
result = base;
|
|
6101
|
+
if (result === NOTHING)
|
|
6102
|
+
result = void 0;
|
|
6103
|
+
if (this.autoFreeze_)
|
|
6104
|
+
freeze(result, true);
|
|
6105
|
+
if (patchListener) {
|
|
6106
|
+
const p = [];
|
|
6107
|
+
const ip = [];
|
|
6108
|
+
getPlugin("Patches").generateReplacementPatches_(base, result, p, ip);
|
|
6109
|
+
patchListener(p, ip);
|
|
6110
|
+
}
|
|
6111
|
+
return result;
|
|
6112
|
+
} else
|
|
6113
|
+
die(1, base);
|
|
6114
|
+
};
|
|
6115
|
+
this.produceWithPatches = (base, recipe) => {
|
|
6116
|
+
if (typeof base === "function") {
|
|
6117
|
+
return (state, ...args) => this.produceWithPatches(state, (draft) => base(draft, ...args));
|
|
6118
|
+
}
|
|
6119
|
+
let patches, inversePatches;
|
|
6120
|
+
const result = this.produce(base, recipe, (p, ip) => {
|
|
6121
|
+
patches = p;
|
|
6122
|
+
inversePatches = ip;
|
|
6123
|
+
});
|
|
6124
|
+
return [result, patches, inversePatches];
|
|
6125
|
+
};
|
|
6126
|
+
if (typeof config?.autoFreeze === "boolean")
|
|
6127
|
+
this.setAutoFreeze(config.autoFreeze);
|
|
6128
|
+
if (typeof config?.useStrictShallowCopy === "boolean")
|
|
6129
|
+
this.setUseStrictShallowCopy(config.useStrictShallowCopy);
|
|
6130
|
+
if (typeof config?.useStrictIteration === "boolean")
|
|
6131
|
+
this.setUseStrictIteration(config.useStrictIteration);
|
|
6132
|
+
}
|
|
6133
|
+
createDraft(base) {
|
|
6134
|
+
if (!immer_isDraftable(base))
|
|
6135
|
+
die(8);
|
|
6136
|
+
if (immer_isDraft(base))
|
|
6137
|
+
base = immer_current(base);
|
|
6138
|
+
const scope = enterScope(this);
|
|
6139
|
+
const proxy = createProxy(base, void 0);
|
|
6140
|
+
proxy[DRAFT_STATE].isManual_ = true;
|
|
6141
|
+
leaveScope(scope);
|
|
6142
|
+
return proxy;
|
|
6143
|
+
}
|
|
6144
|
+
finishDraft(draft, patchListener) {
|
|
6145
|
+
const state = draft && draft[DRAFT_STATE];
|
|
6146
|
+
if (!state || !state.isManual_)
|
|
6147
|
+
die(9);
|
|
6148
|
+
const { scope_: scope } = state;
|
|
6149
|
+
usePatchesInScope(scope, patchListener);
|
|
6150
|
+
return processResult(void 0, scope);
|
|
6151
|
+
}
|
|
6152
|
+
/**
|
|
6153
|
+
* Pass true to automatically freeze all copies created by Immer.
|
|
6154
|
+
*
|
|
6155
|
+
* By default, auto-freezing is enabled.
|
|
6156
|
+
*/
|
|
6157
|
+
setAutoFreeze(value) {
|
|
6158
|
+
this.autoFreeze_ = value;
|
|
6159
|
+
}
|
|
6160
|
+
/**
|
|
6161
|
+
* Pass true to enable strict shallow copy.
|
|
6162
|
+
*
|
|
6163
|
+
* By default, immer does not copy the object descriptors such as getter, setter and non-enumrable properties.
|
|
6164
|
+
*/
|
|
6165
|
+
setUseStrictShallowCopy(value) {
|
|
6166
|
+
this.useStrictShallowCopy_ = value;
|
|
6167
|
+
}
|
|
6168
|
+
/**
|
|
6169
|
+
* Pass false to use faster iteration that skips non-enumerable properties
|
|
6170
|
+
* but still handles symbols for compatibility.
|
|
6171
|
+
*
|
|
6172
|
+
* By default, strict iteration is enabled (includes all own properties).
|
|
6173
|
+
*/
|
|
6174
|
+
setUseStrictIteration(value) {
|
|
6175
|
+
this.useStrictIteration_ = value;
|
|
6176
|
+
}
|
|
6177
|
+
shouldUseStrictIteration() {
|
|
6178
|
+
return this.useStrictIteration_;
|
|
6179
|
+
}
|
|
6180
|
+
applyPatches(base, patches) {
|
|
6181
|
+
let i;
|
|
6182
|
+
for (i = patches.length - 1; i >= 0; i--) {
|
|
6183
|
+
const patch = patches[i];
|
|
6184
|
+
if (patch.path.length === 0 && patch.op === "replace") {
|
|
6185
|
+
base = patch.value;
|
|
6186
|
+
break;
|
|
6187
|
+
}
|
|
6188
|
+
}
|
|
6189
|
+
if (i > -1) {
|
|
6190
|
+
patches = patches.slice(i + 1);
|
|
6191
|
+
}
|
|
6192
|
+
const applyPatchesImpl = getPlugin("Patches").applyPatches_;
|
|
6193
|
+
if (immer_isDraft(base)) {
|
|
6194
|
+
return applyPatchesImpl(base, patches);
|
|
6195
|
+
}
|
|
6196
|
+
return this.produce(
|
|
6197
|
+
base,
|
|
6198
|
+
(draft) => applyPatchesImpl(draft, patches)
|
|
6199
|
+
);
|
|
6200
|
+
}
|
|
6201
|
+
};
|
|
6202
|
+
function createProxy(value, parent) {
|
|
6203
|
+
const draft = isMap(value) ? getPlugin("MapSet").proxyMap_(value, parent) : isSet(value) ? getPlugin("MapSet").proxySet_(value, parent) : createProxyProxy(value, parent);
|
|
6204
|
+
const scope = parent ? parent.scope_ : getCurrentScope();
|
|
6205
|
+
scope.drafts_.push(draft);
|
|
6206
|
+
return draft;
|
|
6207
|
+
}
|
|
6208
|
+
|
|
6209
|
+
// src/core/current.ts
|
|
6210
|
+
function immer_current(value) {
|
|
6211
|
+
if (!immer_isDraft(value))
|
|
6212
|
+
die(10, value);
|
|
6213
|
+
return currentImpl(value);
|
|
6214
|
+
}
|
|
6215
|
+
function currentImpl(value) {
|
|
6216
|
+
if (!immer_isDraftable(value) || isFrozen(value))
|
|
6217
|
+
return value;
|
|
6218
|
+
const state = value[DRAFT_STATE];
|
|
6219
|
+
let copy;
|
|
6220
|
+
let strict = true;
|
|
6221
|
+
if (state) {
|
|
6222
|
+
if (!state.modified_)
|
|
6223
|
+
return state.base_;
|
|
6224
|
+
state.finalized_ = true;
|
|
6225
|
+
copy = shallowCopy(value, state.scope_.immer_.useStrictShallowCopy_);
|
|
6226
|
+
strict = state.scope_.immer_.shouldUseStrictIteration();
|
|
6227
|
+
} else {
|
|
6228
|
+
copy = shallowCopy(value, true);
|
|
6229
|
+
}
|
|
6230
|
+
each(
|
|
6231
|
+
copy,
|
|
6232
|
+
(key, childValue) => {
|
|
6233
|
+
set(copy, key, currentImpl(childValue));
|
|
6234
|
+
},
|
|
6235
|
+
strict
|
|
6236
|
+
);
|
|
6237
|
+
if (state) {
|
|
6238
|
+
state.finalized_ = false;
|
|
6239
|
+
}
|
|
6240
|
+
return copy;
|
|
6241
|
+
}
|
|
6242
|
+
|
|
6243
|
+
// src/plugins/patches.ts
|
|
6244
|
+
function enablePatches() {
|
|
6245
|
+
const errorOffset = 16;
|
|
6246
|
+
if (false) // removed by dead control flow
|
|
6247
|
+
{}
|
|
6248
|
+
const REPLACE = "replace";
|
|
6249
|
+
const ADD = "add";
|
|
6250
|
+
const REMOVE = "remove";
|
|
6251
|
+
function generatePatches_(state, basePath, patches, inversePatches) {
|
|
6252
|
+
switch (state.type_) {
|
|
6253
|
+
case 0 /* Object */:
|
|
6254
|
+
case 2 /* Map */:
|
|
6255
|
+
return generatePatchesFromAssigned(
|
|
6256
|
+
state,
|
|
6257
|
+
basePath,
|
|
6258
|
+
patches,
|
|
6259
|
+
inversePatches
|
|
6260
|
+
);
|
|
6261
|
+
case 1 /* Array */:
|
|
6262
|
+
return generateArrayPatches(state, basePath, patches, inversePatches);
|
|
6263
|
+
case 3 /* Set */:
|
|
6264
|
+
return generateSetPatches(
|
|
6265
|
+
state,
|
|
6266
|
+
basePath,
|
|
6267
|
+
patches,
|
|
6268
|
+
inversePatches
|
|
6269
|
+
);
|
|
6270
|
+
}
|
|
6271
|
+
}
|
|
6272
|
+
function generateArrayPatches(state, basePath, patches, inversePatches) {
|
|
6273
|
+
let { base_, assigned_ } = state;
|
|
6274
|
+
let copy_ = state.copy_;
|
|
6275
|
+
if (copy_.length < base_.length) {
|
|
6276
|
+
;
|
|
6277
|
+
[base_, copy_] = [copy_, base_];
|
|
6278
|
+
[patches, inversePatches] = [inversePatches, patches];
|
|
6279
|
+
}
|
|
6280
|
+
for (let i = 0; i < base_.length; i++) {
|
|
6281
|
+
if (assigned_[i] && copy_[i] !== base_[i]) {
|
|
6282
|
+
const path = basePath.concat([i]);
|
|
6283
|
+
patches.push({
|
|
6284
|
+
op: REPLACE,
|
|
6285
|
+
path,
|
|
6286
|
+
// Need to maybe clone it, as it can in fact be the original value
|
|
6287
|
+
// due to the base/copy inversion at the start of this function
|
|
6288
|
+
value: clonePatchValueIfNeeded(copy_[i])
|
|
6289
|
+
});
|
|
6290
|
+
inversePatches.push({
|
|
6291
|
+
op: REPLACE,
|
|
6292
|
+
path,
|
|
6293
|
+
value: clonePatchValueIfNeeded(base_[i])
|
|
6294
|
+
});
|
|
6295
|
+
}
|
|
6296
|
+
}
|
|
6297
|
+
for (let i = base_.length; i < copy_.length; i++) {
|
|
6298
|
+
const path = basePath.concat([i]);
|
|
6299
|
+
patches.push({
|
|
6300
|
+
op: ADD,
|
|
6301
|
+
path,
|
|
6302
|
+
// Need to maybe clone it, as it can in fact be the original value
|
|
6303
|
+
// due to the base/copy inversion at the start of this function
|
|
6304
|
+
value: clonePatchValueIfNeeded(copy_[i])
|
|
6305
|
+
});
|
|
6306
|
+
}
|
|
6307
|
+
for (let i = copy_.length - 1; base_.length <= i; --i) {
|
|
6308
|
+
const path = basePath.concat([i]);
|
|
6309
|
+
inversePatches.push({
|
|
6310
|
+
op: REMOVE,
|
|
6311
|
+
path
|
|
6312
|
+
});
|
|
6313
|
+
}
|
|
6314
|
+
}
|
|
6315
|
+
function generatePatchesFromAssigned(state, basePath, patches, inversePatches) {
|
|
6316
|
+
const { base_, copy_ } = state;
|
|
6317
|
+
each(state.assigned_, (key, assignedValue) => {
|
|
6318
|
+
const origValue = get(base_, key);
|
|
6319
|
+
const value = get(copy_, key);
|
|
6320
|
+
const op = !assignedValue ? REMOVE : has(base_, key) ? REPLACE : ADD;
|
|
6321
|
+
if (origValue === value && op === REPLACE)
|
|
6322
|
+
return;
|
|
6323
|
+
const path = basePath.concat(key);
|
|
6324
|
+
patches.push(op === REMOVE ? { op, path } : { op, path, value });
|
|
6325
|
+
inversePatches.push(
|
|
6326
|
+
op === ADD ? { op: REMOVE, path } : op === REMOVE ? { op: ADD, path, value: clonePatchValueIfNeeded(origValue) } : { op: REPLACE, path, value: clonePatchValueIfNeeded(origValue) }
|
|
6327
|
+
);
|
|
6328
|
+
});
|
|
6329
|
+
}
|
|
6330
|
+
function generateSetPatches(state, basePath, patches, inversePatches) {
|
|
6331
|
+
let { base_, copy_ } = state;
|
|
6332
|
+
let i = 0;
|
|
6333
|
+
base_.forEach((value) => {
|
|
6334
|
+
if (!copy_.has(value)) {
|
|
6335
|
+
const path = basePath.concat([i]);
|
|
6336
|
+
patches.push({
|
|
6337
|
+
op: REMOVE,
|
|
6338
|
+
path,
|
|
6339
|
+
value
|
|
6340
|
+
});
|
|
6341
|
+
inversePatches.unshift({
|
|
6342
|
+
op: ADD,
|
|
6343
|
+
path,
|
|
6344
|
+
value
|
|
6345
|
+
});
|
|
6346
|
+
}
|
|
6347
|
+
i++;
|
|
6348
|
+
});
|
|
6349
|
+
i = 0;
|
|
6350
|
+
copy_.forEach((value) => {
|
|
6351
|
+
if (!base_.has(value)) {
|
|
6352
|
+
const path = basePath.concat([i]);
|
|
6353
|
+
patches.push({
|
|
6354
|
+
op: ADD,
|
|
6355
|
+
path,
|
|
6356
|
+
value
|
|
6357
|
+
});
|
|
6358
|
+
inversePatches.unshift({
|
|
6359
|
+
op: REMOVE,
|
|
6360
|
+
path,
|
|
6361
|
+
value
|
|
6362
|
+
});
|
|
6363
|
+
}
|
|
6364
|
+
i++;
|
|
6365
|
+
});
|
|
6366
|
+
}
|
|
6367
|
+
function generateReplacementPatches_(baseValue, replacement, patches, inversePatches) {
|
|
6368
|
+
patches.push({
|
|
6369
|
+
op: REPLACE,
|
|
6370
|
+
path: [],
|
|
6371
|
+
value: replacement === NOTHING ? void 0 : replacement
|
|
6372
|
+
});
|
|
6373
|
+
inversePatches.push({
|
|
6374
|
+
op: REPLACE,
|
|
6375
|
+
path: [],
|
|
6376
|
+
value: baseValue
|
|
6377
|
+
});
|
|
6378
|
+
}
|
|
6379
|
+
function applyPatches_(draft, patches) {
|
|
6380
|
+
patches.forEach((patch) => {
|
|
6381
|
+
const { path, op } = patch;
|
|
6382
|
+
let base = draft;
|
|
6383
|
+
for (let i = 0; i < path.length - 1; i++) {
|
|
6384
|
+
const parentType = getArchtype(base);
|
|
6385
|
+
let p = path[i];
|
|
6386
|
+
if (typeof p !== "string" && typeof p !== "number") {
|
|
6387
|
+
p = "" + p;
|
|
6388
|
+
}
|
|
6389
|
+
if ((parentType === 0 /* Object */ || parentType === 1 /* Array */) && (p === "__proto__" || p === "constructor"))
|
|
6390
|
+
die(errorOffset + 3);
|
|
6391
|
+
if (typeof base === "function" && p === "prototype")
|
|
6392
|
+
die(errorOffset + 3);
|
|
6393
|
+
base = get(base, p);
|
|
6394
|
+
if (typeof base !== "object")
|
|
6395
|
+
die(errorOffset + 2, path.join("/"));
|
|
6396
|
+
}
|
|
6397
|
+
const type = getArchtype(base);
|
|
6398
|
+
const value = deepClonePatchValue(patch.value);
|
|
6399
|
+
const key = path[path.length - 1];
|
|
6400
|
+
switch (op) {
|
|
6401
|
+
case REPLACE:
|
|
6402
|
+
switch (type) {
|
|
6403
|
+
case 2 /* Map */:
|
|
6404
|
+
return base.set(key, value);
|
|
6405
|
+
case 3 /* Set */:
|
|
6406
|
+
die(errorOffset);
|
|
6407
|
+
default:
|
|
6408
|
+
return base[key] = value;
|
|
6409
|
+
}
|
|
6410
|
+
case ADD:
|
|
6411
|
+
switch (type) {
|
|
6412
|
+
case 1 /* Array */:
|
|
6413
|
+
return key === "-" ? base.push(value) : base.splice(key, 0, value);
|
|
6414
|
+
case 2 /* Map */:
|
|
6415
|
+
return base.set(key, value);
|
|
6416
|
+
case 3 /* Set */:
|
|
6417
|
+
return base.add(value);
|
|
6418
|
+
default:
|
|
6419
|
+
return base[key] = value;
|
|
6420
|
+
}
|
|
6421
|
+
case REMOVE:
|
|
6422
|
+
switch (type) {
|
|
6423
|
+
case 1 /* Array */:
|
|
6424
|
+
return base.splice(key, 1);
|
|
6425
|
+
case 2 /* Map */:
|
|
6426
|
+
return base.delete(key);
|
|
6427
|
+
case 3 /* Set */:
|
|
6428
|
+
return base.delete(patch.value);
|
|
6429
|
+
default:
|
|
6430
|
+
return delete base[key];
|
|
6431
|
+
}
|
|
6432
|
+
default:
|
|
6433
|
+
die(errorOffset + 1, op);
|
|
6434
|
+
}
|
|
6435
|
+
});
|
|
6436
|
+
return draft;
|
|
6437
|
+
}
|
|
6438
|
+
function deepClonePatchValue(obj) {
|
|
6439
|
+
if (!immer_isDraftable(obj))
|
|
6440
|
+
return obj;
|
|
6441
|
+
if (Array.isArray(obj))
|
|
6442
|
+
return obj.map(deepClonePatchValue);
|
|
6443
|
+
if (isMap(obj))
|
|
6444
|
+
return new Map(
|
|
6445
|
+
Array.from(obj.entries()).map(([k, v]) => [k, deepClonePatchValue(v)])
|
|
6446
|
+
);
|
|
6447
|
+
if (isSet(obj))
|
|
6448
|
+
return new Set(Array.from(obj).map(deepClonePatchValue));
|
|
6449
|
+
const cloned = Object.create(getPrototypeOf(obj));
|
|
6450
|
+
for (const key in obj)
|
|
6451
|
+
cloned[key] = deepClonePatchValue(obj[key]);
|
|
6452
|
+
if (has(obj, DRAFTABLE))
|
|
6453
|
+
cloned[DRAFTABLE] = obj[DRAFTABLE];
|
|
6454
|
+
return cloned;
|
|
6455
|
+
}
|
|
6456
|
+
function clonePatchValueIfNeeded(obj) {
|
|
6457
|
+
if (immer_isDraft(obj)) {
|
|
6458
|
+
return deepClonePatchValue(obj);
|
|
6459
|
+
} else
|
|
6460
|
+
return obj;
|
|
6461
|
+
}
|
|
6462
|
+
loadPlugin("Patches", {
|
|
6463
|
+
applyPatches_,
|
|
6464
|
+
generatePatches_,
|
|
6465
|
+
generateReplacementPatches_
|
|
6466
|
+
});
|
|
6467
|
+
}
|
|
6468
|
+
|
|
6469
|
+
// src/plugins/mapset.ts
|
|
6470
|
+
function enableMapSet() {
|
|
6471
|
+
class DraftMap extends Map {
|
|
6472
|
+
constructor(target, parent) {
|
|
6473
|
+
super();
|
|
6474
|
+
this[DRAFT_STATE] = {
|
|
6475
|
+
type_: 2 /* Map */,
|
|
6476
|
+
parent_: parent,
|
|
6477
|
+
scope_: parent ? parent.scope_ : getCurrentScope(),
|
|
6478
|
+
modified_: false,
|
|
6479
|
+
finalized_: false,
|
|
6480
|
+
copy_: void 0,
|
|
6481
|
+
assigned_: void 0,
|
|
6482
|
+
base_: target,
|
|
6483
|
+
draft_: this,
|
|
6484
|
+
isManual_: false,
|
|
6485
|
+
revoked_: false
|
|
6486
|
+
};
|
|
6487
|
+
}
|
|
6488
|
+
get size() {
|
|
6489
|
+
return latest(this[DRAFT_STATE]).size;
|
|
6490
|
+
}
|
|
6491
|
+
has(key) {
|
|
6492
|
+
return latest(this[DRAFT_STATE]).has(key);
|
|
6493
|
+
}
|
|
6494
|
+
set(key, value) {
|
|
6495
|
+
const state = this[DRAFT_STATE];
|
|
6496
|
+
assertUnrevoked(state);
|
|
6497
|
+
if (!latest(state).has(key) || latest(state).get(key) !== value) {
|
|
6498
|
+
prepareMapCopy(state);
|
|
6499
|
+
markChanged(state);
|
|
6500
|
+
state.assigned_.set(key, true);
|
|
6501
|
+
state.copy_.set(key, value);
|
|
6502
|
+
state.assigned_.set(key, true);
|
|
6503
|
+
}
|
|
6504
|
+
return this;
|
|
6505
|
+
}
|
|
6506
|
+
delete(key) {
|
|
6507
|
+
if (!this.has(key)) {
|
|
6508
|
+
return false;
|
|
6509
|
+
}
|
|
6510
|
+
const state = this[DRAFT_STATE];
|
|
6511
|
+
assertUnrevoked(state);
|
|
6512
|
+
prepareMapCopy(state);
|
|
6513
|
+
markChanged(state);
|
|
6514
|
+
if (state.base_.has(key)) {
|
|
6515
|
+
state.assigned_.set(key, false);
|
|
6516
|
+
} else {
|
|
6517
|
+
state.assigned_.delete(key);
|
|
6518
|
+
}
|
|
6519
|
+
state.copy_.delete(key);
|
|
6520
|
+
return true;
|
|
6521
|
+
}
|
|
6522
|
+
clear() {
|
|
6523
|
+
const state = this[DRAFT_STATE];
|
|
6524
|
+
assertUnrevoked(state);
|
|
6525
|
+
if (latest(state).size) {
|
|
6526
|
+
prepareMapCopy(state);
|
|
6527
|
+
markChanged(state);
|
|
6528
|
+
state.assigned_ = /* @__PURE__ */ new Map();
|
|
6529
|
+
each(state.base_, (key) => {
|
|
6530
|
+
state.assigned_.set(key, false);
|
|
6531
|
+
});
|
|
6532
|
+
state.copy_.clear();
|
|
6533
|
+
}
|
|
6534
|
+
}
|
|
6535
|
+
forEach(cb, thisArg) {
|
|
6536
|
+
const state = this[DRAFT_STATE];
|
|
6537
|
+
latest(state).forEach((_value, key, _map) => {
|
|
6538
|
+
cb.call(thisArg, this.get(key), key, this);
|
|
6539
|
+
});
|
|
6540
|
+
}
|
|
6541
|
+
get(key) {
|
|
6542
|
+
const state = this[DRAFT_STATE];
|
|
6543
|
+
assertUnrevoked(state);
|
|
6544
|
+
const value = latest(state).get(key);
|
|
6545
|
+
if (state.finalized_ || !immer_isDraftable(value)) {
|
|
6546
|
+
return value;
|
|
6547
|
+
}
|
|
6548
|
+
if (value !== state.base_.get(key)) {
|
|
6549
|
+
return value;
|
|
6550
|
+
}
|
|
6551
|
+
const draft = createProxy(value, state);
|
|
6552
|
+
prepareMapCopy(state);
|
|
6553
|
+
state.copy_.set(key, draft);
|
|
6554
|
+
return draft;
|
|
6555
|
+
}
|
|
6556
|
+
keys() {
|
|
6557
|
+
return latest(this[DRAFT_STATE]).keys();
|
|
6558
|
+
}
|
|
6559
|
+
values() {
|
|
6560
|
+
const iterator = this.keys();
|
|
6561
|
+
return {
|
|
6562
|
+
[Symbol.iterator]: () => this.values(),
|
|
6563
|
+
next: () => {
|
|
6564
|
+
const r = iterator.next();
|
|
6565
|
+
if (r.done)
|
|
6566
|
+
return r;
|
|
6567
|
+
const value = this.get(r.value);
|
|
6568
|
+
return {
|
|
6569
|
+
done: false,
|
|
6570
|
+
value
|
|
6571
|
+
};
|
|
6572
|
+
}
|
|
6573
|
+
};
|
|
6574
|
+
}
|
|
6575
|
+
entries() {
|
|
6576
|
+
const iterator = this.keys();
|
|
6577
|
+
return {
|
|
6578
|
+
[Symbol.iterator]: () => this.entries(),
|
|
6579
|
+
next: () => {
|
|
6580
|
+
const r = iterator.next();
|
|
6581
|
+
if (r.done)
|
|
6582
|
+
return r;
|
|
6583
|
+
const value = this.get(r.value);
|
|
6584
|
+
return {
|
|
6585
|
+
done: false,
|
|
6586
|
+
value: [r.value, value]
|
|
6587
|
+
};
|
|
6588
|
+
}
|
|
6589
|
+
};
|
|
6590
|
+
}
|
|
6591
|
+
[(DRAFT_STATE, Symbol.iterator)]() {
|
|
6592
|
+
return this.entries();
|
|
6593
|
+
}
|
|
6594
|
+
}
|
|
6595
|
+
function proxyMap_(target, parent) {
|
|
6596
|
+
return new DraftMap(target, parent);
|
|
6597
|
+
}
|
|
6598
|
+
function prepareMapCopy(state) {
|
|
6599
|
+
if (!state.copy_) {
|
|
6600
|
+
state.assigned_ = /* @__PURE__ */ new Map();
|
|
6601
|
+
state.copy_ = new Map(state.base_);
|
|
6602
|
+
}
|
|
6603
|
+
}
|
|
6604
|
+
class DraftSet extends Set {
|
|
6605
|
+
constructor(target, parent) {
|
|
6606
|
+
super();
|
|
6607
|
+
this[DRAFT_STATE] = {
|
|
6608
|
+
type_: 3 /* Set */,
|
|
6609
|
+
parent_: parent,
|
|
6610
|
+
scope_: parent ? parent.scope_ : getCurrentScope(),
|
|
6611
|
+
modified_: false,
|
|
6612
|
+
finalized_: false,
|
|
6613
|
+
copy_: void 0,
|
|
6614
|
+
base_: target,
|
|
6615
|
+
draft_: this,
|
|
6616
|
+
drafts_: /* @__PURE__ */ new Map(),
|
|
6617
|
+
revoked_: false,
|
|
6618
|
+
isManual_: false
|
|
6619
|
+
};
|
|
6620
|
+
}
|
|
6621
|
+
get size() {
|
|
6622
|
+
return latest(this[DRAFT_STATE]).size;
|
|
6623
|
+
}
|
|
6624
|
+
has(value) {
|
|
6625
|
+
const state = this[DRAFT_STATE];
|
|
6626
|
+
assertUnrevoked(state);
|
|
6627
|
+
if (!state.copy_) {
|
|
6628
|
+
return state.base_.has(value);
|
|
6629
|
+
}
|
|
6630
|
+
if (state.copy_.has(value))
|
|
6631
|
+
return true;
|
|
6632
|
+
if (state.drafts_.has(value) && state.copy_.has(state.drafts_.get(value)))
|
|
6633
|
+
return true;
|
|
6634
|
+
return false;
|
|
6635
|
+
}
|
|
6636
|
+
add(value) {
|
|
6637
|
+
const state = this[DRAFT_STATE];
|
|
6638
|
+
assertUnrevoked(state);
|
|
6639
|
+
if (!this.has(value)) {
|
|
6640
|
+
prepareSetCopy(state);
|
|
6641
|
+
markChanged(state);
|
|
6642
|
+
state.copy_.add(value);
|
|
6643
|
+
}
|
|
6644
|
+
return this;
|
|
6645
|
+
}
|
|
6646
|
+
delete(value) {
|
|
6647
|
+
if (!this.has(value)) {
|
|
6648
|
+
return false;
|
|
6649
|
+
}
|
|
6650
|
+
const state = this[DRAFT_STATE];
|
|
6651
|
+
assertUnrevoked(state);
|
|
6652
|
+
prepareSetCopy(state);
|
|
6653
|
+
markChanged(state);
|
|
6654
|
+
return state.copy_.delete(value) || (state.drafts_.has(value) ? state.copy_.delete(state.drafts_.get(value)) : (
|
|
6655
|
+
/* istanbul ignore next */
|
|
6656
|
+
false
|
|
6657
|
+
));
|
|
6658
|
+
}
|
|
6659
|
+
clear() {
|
|
6660
|
+
const state = this[DRAFT_STATE];
|
|
6661
|
+
assertUnrevoked(state);
|
|
6662
|
+
if (latest(state).size) {
|
|
6663
|
+
prepareSetCopy(state);
|
|
6664
|
+
markChanged(state);
|
|
6665
|
+
state.copy_.clear();
|
|
6666
|
+
}
|
|
6667
|
+
}
|
|
6668
|
+
values() {
|
|
6669
|
+
const state = this[DRAFT_STATE];
|
|
6670
|
+
assertUnrevoked(state);
|
|
6671
|
+
prepareSetCopy(state);
|
|
6672
|
+
return state.copy_.values();
|
|
6673
|
+
}
|
|
6674
|
+
entries() {
|
|
6675
|
+
const state = this[DRAFT_STATE];
|
|
6676
|
+
assertUnrevoked(state);
|
|
6677
|
+
prepareSetCopy(state);
|
|
6678
|
+
return state.copy_.entries();
|
|
6679
|
+
}
|
|
6680
|
+
keys() {
|
|
6681
|
+
return this.values();
|
|
6682
|
+
}
|
|
6683
|
+
[(DRAFT_STATE, Symbol.iterator)]() {
|
|
6684
|
+
return this.values();
|
|
6685
|
+
}
|
|
6686
|
+
forEach(cb, thisArg) {
|
|
6687
|
+
const iterator = this.values();
|
|
6688
|
+
let result = iterator.next();
|
|
6689
|
+
while (!result.done) {
|
|
6690
|
+
cb.call(thisArg, result.value, result.value, this);
|
|
6691
|
+
result = iterator.next();
|
|
6692
|
+
}
|
|
6693
|
+
}
|
|
6694
|
+
}
|
|
6695
|
+
function proxySet_(target, parent) {
|
|
6696
|
+
return new DraftSet(target, parent);
|
|
6697
|
+
}
|
|
6698
|
+
function prepareSetCopy(state) {
|
|
6699
|
+
if (!state.copy_) {
|
|
6700
|
+
state.copy_ = /* @__PURE__ */ new Set();
|
|
6701
|
+
state.base_.forEach((value) => {
|
|
6702
|
+
if (immer_isDraftable(value)) {
|
|
6703
|
+
const draft = createProxy(value, state);
|
|
6704
|
+
state.drafts_.set(value, draft);
|
|
6705
|
+
state.copy_.add(draft);
|
|
6706
|
+
} else {
|
|
6707
|
+
state.copy_.add(value);
|
|
6708
|
+
}
|
|
6709
|
+
});
|
|
6710
|
+
}
|
|
6711
|
+
}
|
|
6712
|
+
function assertUnrevoked(state) {
|
|
6713
|
+
if (state.revoked_)
|
|
6714
|
+
die(3, JSON.stringify(latest(state)));
|
|
6715
|
+
}
|
|
6716
|
+
loadPlugin("MapSet", { proxyMap_, proxySet_ });
|
|
6717
|
+
}
|
|
6718
|
+
|
|
6719
|
+
// src/immer.ts
|
|
6720
|
+
var immer = new Immer2();
|
|
6721
|
+
var immer_produce = immer.produce;
|
|
6722
|
+
var produceWithPatches = /* @__PURE__ */ (/* unused pure expression or super */ null && (immer.produceWithPatches.bind(
|
|
6723
|
+
immer
|
|
6724
|
+
)));
|
|
6725
|
+
var setAutoFreeze = /* @__PURE__ */ (/* unused pure expression or super */ null && (immer.setAutoFreeze.bind(immer)));
|
|
6726
|
+
var setUseStrictShallowCopy = /* @__PURE__ */ (/* unused pure expression or super */ null && (immer.setUseStrictShallowCopy.bind(
|
|
6727
|
+
immer
|
|
6728
|
+
)));
|
|
6729
|
+
var setUseStrictIteration = /* @__PURE__ */ immer.setUseStrictIteration.bind(
|
|
6730
|
+
immer
|
|
6731
|
+
);
|
|
6732
|
+
var applyPatches = /* @__PURE__ */ (/* unused pure expression or super */ null && (immer.applyPatches.bind(immer)));
|
|
6733
|
+
var createDraft = /* @__PURE__ */ (/* unused pure expression or super */ null && (immer.createDraft.bind(immer)));
|
|
6734
|
+
var finishDraft = /* @__PURE__ */ (/* unused pure expression or super */ null && (immer.finishDraft.bind(immer)));
|
|
6735
|
+
function castDraft(value) {
|
|
6736
|
+
return value;
|
|
6737
|
+
}
|
|
6738
|
+
function castImmutable(value) {
|
|
6739
|
+
return value;
|
|
6740
|
+
}
|
|
6741
|
+
|
|
6742
|
+
//# sourceMappingURL=immer.mjs.map
|
|
5503
6743
|
;// ./node_modules/redux/dist/redux.mjs
|
|
5504
6744
|
// src/utils/formatProdErrorMessage.ts
|
|
5505
6745
|
function formatProdErrorMessage(code) {
|
|
@@ -5843,7 +7083,7 @@ function bindActionCreators(actionCreators, dispatch) {
|
|
|
5843
7083
|
}
|
|
5844
7084
|
|
|
5845
7085
|
// src/compose.ts
|
|
5846
|
-
function
|
|
7086
|
+
function redux_compose(...funcs) {
|
|
5847
7087
|
if (funcs.length === 0) {
|
|
5848
7088
|
return (arg) => arg;
|
|
5849
7089
|
}
|
|
@@ -5865,7 +7105,7 @@ function applyMiddleware(...middlewares) {
|
|
|
5865
7105
|
dispatch: (action, ...args) => dispatch(action, ...args)
|
|
5866
7106
|
};
|
|
5867
7107
|
const chain = middlewares.map((middleware) => middleware(middlewareAPI));
|
|
5868
|
-
dispatch =
|
|
7108
|
+
dispatch = redux_compose(...chain)(store.dispatch);
|
|
5869
7109
|
return {
|
|
5870
7110
|
...store,
|
|
5871
7111
|
dispatch
|
|
@@ -5899,10 +7139,16 @@ var withExtraArgument = createThunkMiddleware;
|
|
|
5899
7139
|
|
|
5900
7140
|
|
|
5901
7141
|
|
|
7142
|
+
// src/immerImports.ts
|
|
7143
|
+
|
|
7144
|
+
|
|
7145
|
+
// src/index.ts
|
|
5902
7146
|
|
|
5903
|
-
// src/createDraftSafeSelector.ts
|
|
5904
7147
|
|
|
7148
|
+
// src/reselectImports.ts
|
|
5905
7149
|
|
|
7150
|
+
|
|
7151
|
+
// src/createDraftSafeSelector.ts
|
|
5906
7152
|
var createDraftSafeSelectorCreator = (...args) => {
|
|
5907
7153
|
const createSelector2 = createSelectorCreator(...args);
|
|
5908
7154
|
const createDraftSafeSelector2 = Object.assign((...args2) => {
|
|
@@ -5917,15 +7163,14 @@ var createDraftSafeSelectorCreator = (...args) => {
|
|
|
5917
7163
|
};
|
|
5918
7164
|
var createDraftSafeSelector = /* @__PURE__ */ (/* unused pure expression or super */ null && (createDraftSafeSelectorCreator(weakMapMemoize)));
|
|
5919
7165
|
|
|
5920
|
-
// src/
|
|
7166
|
+
// src/reduxImports.ts
|
|
5921
7167
|
|
|
5922
7168
|
|
|
5923
7169
|
// src/devtoolsExtension.ts
|
|
5924
|
-
|
|
5925
7170
|
var composeWithDevTools = typeof window !== "undefined" && window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ ? window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ : function() {
|
|
5926
7171
|
if (arguments.length === 0) return void 0;
|
|
5927
|
-
if (typeof arguments[0] === "object") return
|
|
5928
|
-
return
|
|
7172
|
+
if (typeof arguments[0] === "object") return redux_compose;
|
|
7173
|
+
return redux_compose.apply(null, arguments);
|
|
5929
7174
|
};
|
|
5930
7175
|
var devToolsEnhancer = typeof window !== "undefined" && window.__REDUX_DEVTOOLS_EXTENSION__ ? window.__REDUX_DEVTOOLS_EXTENSION__ : function() {
|
|
5931
7176
|
return function(noop3) {
|
|
@@ -5936,9 +7181,6 @@ var devToolsEnhancer = typeof window !== "undefined" && window.__REDUX_DEVTOOLS_
|
|
|
5936
7181
|
// src/getDefaultMiddleware.ts
|
|
5937
7182
|
|
|
5938
7183
|
|
|
5939
|
-
// src/createAction.ts
|
|
5940
|
-
|
|
5941
|
-
|
|
5942
7184
|
// src/tsHelpers.ts
|
|
5943
7185
|
var hasMatchFunction = (v) => {
|
|
5944
7186
|
return v && typeof v.match === "function";
|
|
@@ -6002,7 +7244,6 @@ function createActionCreatorInvariantMiddleware(options = {}) {
|
|
|
6002
7244
|
}
|
|
6003
7245
|
|
|
6004
7246
|
// src/utils.ts
|
|
6005
|
-
|
|
6006
7247
|
function getTimeMeasureUtils(maxDelay, fnName) {
|
|
6007
7248
|
let elapsed = 0;
|
|
6008
7249
|
return {
|
|
@@ -6043,7 +7284,7 @@ var Tuple = class _Tuple extends Array {
|
|
|
6043
7284
|
}
|
|
6044
7285
|
};
|
|
6045
7286
|
function freezeDraftable(val) {
|
|
6046
|
-
return isDraftable(val) ?
|
|
7287
|
+
return isDraftable(val) ? produce(val, () => {
|
|
6047
7288
|
}) : val;
|
|
6048
7289
|
}
|
|
6049
7290
|
function getOrInsertComputed(map, key, compute) {
|
|
@@ -6132,7 +7373,6 @@ function createImmutableStateInvariantMiddleware(options = {}) {
|
|
|
6132
7373
|
}
|
|
6133
7374
|
|
|
6134
7375
|
// src/serializableStateInvariantMiddleware.ts
|
|
6135
|
-
|
|
6136
7376
|
function isPlain(val) {
|
|
6137
7377
|
const type = typeof val;
|
|
6138
7378
|
return val == null || type === "string" || type === "boolean" || type === "number" || Array.isArray(val) || isPlainObject(val);
|
|
@@ -6328,7 +7568,7 @@ function configureStore(options) {
|
|
|
6328
7568
|
{}
|
|
6329
7569
|
if (false) // removed by dead control flow
|
|
6330
7570
|
{}
|
|
6331
|
-
let finalCompose =
|
|
7571
|
+
let finalCompose = redux_compose;
|
|
6332
7572
|
if (devTools) {
|
|
6333
7573
|
finalCompose = composeWithDevTools({
|
|
6334
7574
|
// Enable capture of stack traces for dispatched Redux actions
|
|
@@ -6351,9 +7591,6 @@ function configureStore(options) {
|
|
|
6351
7591
|
return createStore(rootReducer, preloadedState, composedEnhancer);
|
|
6352
7592
|
}
|
|
6353
7593
|
|
|
6354
|
-
// src/createReducer.ts
|
|
6355
|
-
|
|
6356
|
-
|
|
6357
7594
|
// src/mapBuilders.ts
|
|
6358
7595
|
function executeReducerBuilderCallback(builderCallback) {
|
|
6359
7596
|
const actionsMap = {};
|
|
@@ -6406,6 +7643,7 @@ function executeReducerBuilderCallback(builderCallback) {
|
|
|
6406
7643
|
}
|
|
6407
7644
|
|
|
6408
7645
|
// src/createReducer.ts
|
|
7646
|
+
setUseStrictIteration(false);
|
|
6409
7647
|
function isStateFunction(x) {
|
|
6410
7648
|
return typeof x === "function";
|
|
6411
7649
|
}
|
|
@@ -6431,14 +7669,14 @@ function createReducer(initialState, mapOrBuilderCallback) {
|
|
|
6431
7669
|
}
|
|
6432
7670
|
return caseReducers.reduce((previousState, caseReducer) => {
|
|
6433
7671
|
if (caseReducer) {
|
|
6434
|
-
if (
|
|
7672
|
+
if (isDraft(previousState)) {
|
|
6435
7673
|
const draft = previousState;
|
|
6436
7674
|
const result = caseReducer(draft, action);
|
|
6437
7675
|
if (result === void 0) {
|
|
6438
7676
|
return previousState;
|
|
6439
7677
|
}
|
|
6440
7678
|
return result;
|
|
6441
|
-
} else if (!
|
|
7679
|
+
} else if (!isDraftable(previousState)) {
|
|
6442
7680
|
const result = caseReducer(previousState, action);
|
|
6443
7681
|
if (result === void 0) {
|
|
6444
7682
|
if (previousState === null) {
|
|
@@ -6448,7 +7686,7 @@ function createReducer(initialState, mapOrBuilderCallback) {
|
|
|
6448
7686
|
}
|
|
6449
7687
|
return result;
|
|
6450
7688
|
} else {
|
|
6451
|
-
return
|
|
7689
|
+
return produce(previousState, (draft) => {
|
|
6452
7690
|
return caseReducer(draft, action);
|
|
6453
7691
|
});
|
|
6454
7692
|
}
|
|
@@ -7070,8 +8308,7 @@ function createSelectorsFactory() {
|
|
|
7070
8308
|
}
|
|
7071
8309
|
|
|
7072
8310
|
// src/entities/state_adapter.ts
|
|
7073
|
-
|
|
7074
|
-
var isDraftTyped = (/* unused pure expression or super */ null && (isDraft3));
|
|
8311
|
+
var isDraftTyped = (/* unused pure expression or super */ null && (isDraft));
|
|
7075
8312
|
function createSingleArgumentStateOperator(mutator) {
|
|
7076
8313
|
const operator = createStateOperator((_, state) => mutator(state));
|
|
7077
8314
|
return function operation(state) {
|
|
@@ -7094,12 +8331,11 @@ function createStateOperator(mutator) {
|
|
|
7094
8331
|
runMutator(state);
|
|
7095
8332
|
return state;
|
|
7096
8333
|
}
|
|
7097
|
-
return
|
|
8334
|
+
return produce(state, runMutator);
|
|
7098
8335
|
};
|
|
7099
8336
|
}
|
|
7100
8337
|
|
|
7101
8338
|
// src/entities/utils.ts
|
|
7102
|
-
|
|
7103
8339
|
function selectIdValue(entity, selectId) {
|
|
7104
8340
|
const key = selectId(entity);
|
|
7105
8341
|
if (false) // removed by dead control flow
|
|
@@ -7113,7 +8349,7 @@ function ensureEntitiesArray(entities) {
|
|
|
7113
8349
|
return entities;
|
|
7114
8350
|
}
|
|
7115
8351
|
function getCurrent(value) {
|
|
7116
|
-
return
|
|
8352
|
+
return isDraft(value) ? current(value) : value;
|
|
7117
8353
|
}
|
|
7118
8354
|
function splitAddedUpdatedEntities(newEntities, selectId, state) {
|
|
7119
8355
|
newEntities = ensureEntitiesArray(newEntities);
|
|
@@ -7295,7 +8531,13 @@ function createSortedStateAdapter(selectId, comparer) {
|
|
|
7295
8531
|
function addManyMutably(newEntities, state, existingIds) {
|
|
7296
8532
|
newEntities = ensureEntitiesArray(newEntities);
|
|
7297
8533
|
const existingKeys = new Set(existingIds ?? getCurrent(state.ids));
|
|
7298
|
-
const
|
|
8534
|
+
const addedKeys = /* @__PURE__ */ new Set();
|
|
8535
|
+
const models = newEntities.filter((model) => {
|
|
8536
|
+
const modelId = selectIdValue(model, selectId);
|
|
8537
|
+
const notAdded = !addedKeys.has(modelId);
|
|
8538
|
+
if (notAdded) addedKeys.add(modelId);
|
|
8539
|
+
return !existingKeys.has(modelId) && notAdded;
|
|
8540
|
+
});
|
|
7299
8541
|
if (models.length !== 0) {
|
|
7300
8542
|
mergeFunction(state, models);
|
|
7301
8543
|
}
|
|
@@ -7304,11 +8546,15 @@ function createSortedStateAdapter(selectId, comparer) {
|
|
|
7304
8546
|
return setManyMutably([entity], state);
|
|
7305
8547
|
}
|
|
7306
8548
|
function setManyMutably(newEntities, state) {
|
|
8549
|
+
let deduplicatedEntities = {};
|
|
7307
8550
|
newEntities = ensureEntitiesArray(newEntities);
|
|
7308
8551
|
if (newEntities.length !== 0) {
|
|
7309
8552
|
for (const item of newEntities) {
|
|
7310
|
-
|
|
8553
|
+
const entityId = selectId(item);
|
|
8554
|
+
deduplicatedEntities[entityId] = item;
|
|
8555
|
+
delete state.entities[entityId];
|
|
7311
8556
|
}
|
|
8557
|
+
newEntities = ensureEntitiesArray(deduplicatedEntities);
|
|
7312
8558
|
mergeFunction(state, newEntities);
|
|
7313
8559
|
}
|
|
7314
8560
|
}
|
|
@@ -7438,9 +8684,6 @@ function createEntityAdapter(options = {}) {
|
|
|
7438
8684
|
};
|
|
7439
8685
|
}
|
|
7440
8686
|
|
|
7441
|
-
// src/listenerMiddleware/index.ts
|
|
7442
|
-
|
|
7443
|
-
|
|
7444
8687
|
// src/listenerMiddleware/exceptions.ts
|
|
7445
8688
|
var task = "task";
|
|
7446
8689
|
var listener = "listener";
|
|
@@ -7677,9 +8920,11 @@ var cancelActiveListeners = (entry) => {
|
|
|
7677
8920
|
abortControllerWithReason(controller, listenerCancelled);
|
|
7678
8921
|
});
|
|
7679
8922
|
};
|
|
7680
|
-
var createClearListenerMiddleware = (listenerMap) => {
|
|
8923
|
+
var createClearListenerMiddleware = (listenerMap, executingListeners) => {
|
|
7681
8924
|
return () => {
|
|
7682
|
-
|
|
8925
|
+
for (const listener2 of executingListeners.keys()) {
|
|
8926
|
+
cancelActiveListeners(listener2);
|
|
8927
|
+
}
|
|
7683
8928
|
listenerMap.clear();
|
|
7684
8929
|
};
|
|
7685
8930
|
};
|
|
@@ -7704,6 +8949,19 @@ var defaultErrorHandler = (...args) => {
|
|
|
7704
8949
|
};
|
|
7705
8950
|
var createListenerMiddleware = (middlewareOptions = {}) => {
|
|
7706
8951
|
const listenerMap = /* @__PURE__ */ new Map();
|
|
8952
|
+
const executingListeners = /* @__PURE__ */ new Map();
|
|
8953
|
+
const trackExecutingListener = (entry) => {
|
|
8954
|
+
const count = executingListeners.get(entry) ?? 0;
|
|
8955
|
+
executingListeners.set(entry, count + 1);
|
|
8956
|
+
};
|
|
8957
|
+
const untrackExecutingListener = (entry) => {
|
|
8958
|
+
const count = executingListeners.get(entry) ?? 1;
|
|
8959
|
+
if (count === 1) {
|
|
8960
|
+
executingListeners.delete(entry);
|
|
8961
|
+
} else {
|
|
8962
|
+
executingListeners.set(entry, count - 1);
|
|
8963
|
+
}
|
|
8964
|
+
};
|
|
7707
8965
|
const {
|
|
7708
8966
|
extra,
|
|
7709
8967
|
onError = defaultErrorHandler
|
|
@@ -7745,6 +9003,7 @@ var createListenerMiddleware = (middlewareOptions = {}) => {
|
|
|
7745
9003
|
const autoJoinPromises = [];
|
|
7746
9004
|
try {
|
|
7747
9005
|
entry.pending.add(internalTaskController);
|
|
9006
|
+
trackExecutingListener(entry);
|
|
7748
9007
|
await Promise.resolve(entry.effect(
|
|
7749
9008
|
action,
|
|
7750
9009
|
// Use assign() rather than ... to avoid extra helper functions added to bundle
|
|
@@ -7787,12 +9046,13 @@ var createListenerMiddleware = (middlewareOptions = {}) => {
|
|
|
7787
9046
|
} finally {
|
|
7788
9047
|
await Promise.all(autoJoinPromises);
|
|
7789
9048
|
abortControllerWithReason(internalTaskController, listenerCompleted);
|
|
9049
|
+
untrackExecutingListener(entry);
|
|
7790
9050
|
entry.pending.delete(internalTaskController);
|
|
7791
9051
|
}
|
|
7792
9052
|
};
|
|
7793
|
-
const clearListenerMiddleware = createClearListenerMiddleware(listenerMap);
|
|
9053
|
+
const clearListenerMiddleware = createClearListenerMiddleware(listenerMap, executingListeners);
|
|
7794
9054
|
const middleware = (api) => (next) => (action) => {
|
|
7795
|
-
if (!
|
|
9055
|
+
if (!isAction(action)) {
|
|
7796
9056
|
return next(action);
|
|
7797
9057
|
}
|
|
7798
9058
|
if (addListener.match(action)) {
|
|
@@ -7848,7 +9108,6 @@ var createListenerMiddleware = (middlewareOptions = {}) => {
|
|
|
7848
9108
|
};
|
|
7849
9109
|
|
|
7850
9110
|
// src/dynamicMiddleware/index.ts
|
|
7851
|
-
|
|
7852
9111
|
var createMiddlewareEntry = (middleware) => ({
|
|
7853
9112
|
middleware,
|
|
7854
9113
|
applied: /* @__PURE__ */ new Map()
|
|
@@ -7874,7 +9133,7 @@ var createDynamicMiddleware = () => {
|
|
|
7874
9133
|
});
|
|
7875
9134
|
const getFinalMiddleware = (api) => {
|
|
7876
9135
|
const appliedMiddleware = Array.from(middlewareMap.values()).map((entry) => getOrInsertComputed(entry.applied, api, entry.middleware));
|
|
7877
|
-
return
|
|
9136
|
+
return compose(...appliedMiddleware);
|
|
7878
9137
|
};
|
|
7879
9138
|
const isWithMiddleware = isAllOf(withMiddleware, matchInstance(instanceId));
|
|
7880
9139
|
const middleware = (api) => (next) => (action) => {
|
|
@@ -7921,7 +9180,7 @@ var createStateProxy = (state, reducerMap, initialStateCache) => getOrInsertComp
|
|
|
7921
9180
|
return result;
|
|
7922
9181
|
}
|
|
7923
9182
|
}));
|
|
7924
|
-
var
|
|
9183
|
+
var redux_toolkit_modern_original = (state) => {
|
|
7925
9184
|
if (!isStateProxy(state)) {
|
|
7926
9185
|
throw new Error( true ? redux_toolkit_modern_formatProdErrorMessage(25) : 0);
|
|
7927
9186
|
}
|
|
@@ -7961,7 +9220,7 @@ function combineSlices(...slices) {
|
|
|
7961
9220
|
return selectorFn(createStateProxy(selectState ? selectState(state, ...args) : state, reducerMap, initialStateCache), ...args);
|
|
7962
9221
|
};
|
|
7963
9222
|
}, {
|
|
7964
|
-
original
|
|
9223
|
+
original: redux_toolkit_modern_original
|
|
7965
9224
|
});
|
|
7966
9225
|
return Object.assign(combinedReducer, {
|
|
7967
9226
|
inject,
|