@fctc/widget-logic 1.6.0 → 1.6.2
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/dist/config.d.mts +6 -0
- package/dist/config.d.ts +6 -0
- package/dist/config.js +21380 -0
- package/dist/config.mjs +21376 -0
- package/dist/constants.d.mts +1 -0
- package/dist/constants.d.ts +1 -0
- package/dist/constants.js +205 -0
- package/dist/constants.mjs +166 -0
- package/dist/environment.d.mts +1 -0
- package/dist/environment.d.ts +1 -0
- package/dist/environment.js +24078 -0
- package/dist/environment.mjs +24071 -0
- package/dist/hooks.d.mts +970 -0
- package/dist/hooks.d.ts +970 -0
- package/dist/hooks.js +28158 -0
- package/dist/hooks.mjs +28073 -0
- package/dist/icons.d.mts +11 -0
- package/dist/icons.d.ts +11 -0
- package/dist/icons.js +139 -0
- package/dist/icons.mjs +110 -0
- package/dist/index.d.mts +18 -4
- package/dist/index.d.ts +18 -4
- package/dist/index.js +35803 -238
- package/dist/index.mjs +35559 -217
- package/dist/provider.d.mts +1 -0
- package/dist/provider.d.ts +1 -0
- package/dist/provider.js +24974 -0
- package/dist/provider.mjs +24968 -0
- package/dist/services.d.mts +1 -0
- package/dist/services.d.ts +1 -0
- package/dist/services.js +25660 -0
- package/dist/services.mjs +25648 -0
- package/dist/store.d.mts +1 -0
- package/dist/store.d.ts +1 -0
- package/dist/store.js +3169 -0
- package/dist/store.mjs +3083 -0
- package/dist/types.d.mts +31 -0
- package/dist/types.d.ts +31 -0
- package/dist/types.js +18 -0
- package/dist/types.mjs +0 -0
- package/dist/utils.d.mts +38 -0
- package/dist/utils.d.ts +38 -0
- package/dist/utils.js +7225 -0
- package/dist/utils.mjs +7176 -0
- package/dist/widget.d.mts +299 -0
- package/dist/widget.d.ts +299 -0
- package/dist/widget.js +32278 -0
- package/dist/widget.mjs +32256 -0
- package/package.json +93 -52
- package/dist/action.d.mts +0 -68
- package/dist/action.d.ts +0 -68
- package/dist/action.js +0 -152
- package/dist/action.mjs +0 -122
- package/dist/common.d.mts +0 -13
- package/dist/common.d.ts +0 -13
- package/dist/common.js +0 -60
- package/dist/common.mjs +0 -33
- package/dist/form.d.mts +0 -42
- package/dist/form.d.ts +0 -42
- package/dist/form.js +0 -116
- package/dist/form.mjs +0 -87
- package/dist/table.d.mts +0 -22
- package/dist/table.d.ts +0 -22
- package/dist/table.js +0 -118
- package/dist/table.mjs +0 -91
package/dist/store.js
ADDED
|
@@ -0,0 +1,3169 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
9
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
10
|
+
};
|
|
11
|
+
var __export = (target, all) => {
|
|
12
|
+
for (var name in all)
|
|
13
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
14
|
+
};
|
|
15
|
+
var __copyProps = (to, from, except, desc) => {
|
|
16
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
17
|
+
for (let key of __getOwnPropNames(from))
|
|
18
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
19
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
20
|
+
}
|
|
21
|
+
return to;
|
|
22
|
+
};
|
|
23
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
24
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
25
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
26
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
27
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
28
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
29
|
+
mod
|
|
30
|
+
));
|
|
31
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
32
|
+
|
|
33
|
+
// ../interface-logic/node_modules/use-sync-external-store/cjs/use-sync-external-store-with-selector.production.js
|
|
34
|
+
var require_use_sync_external_store_with_selector_production = __commonJS({
|
|
35
|
+
"../interface-logic/node_modules/use-sync-external-store/cjs/use-sync-external-store-with-selector.production.js"(exports2) {
|
|
36
|
+
"use strict";
|
|
37
|
+
var React2 = require("react");
|
|
38
|
+
function is2(x, y) {
|
|
39
|
+
return x === y && (0 !== x || 1 / x === 1 / y) || x !== x && y !== y;
|
|
40
|
+
}
|
|
41
|
+
var objectIs = "function" === typeof Object.is ? Object.is : is2;
|
|
42
|
+
var useSyncExternalStore2 = React2.useSyncExternalStore;
|
|
43
|
+
var useRef2 = React2.useRef;
|
|
44
|
+
var useEffect2 = React2.useEffect;
|
|
45
|
+
var useMemo2 = React2.useMemo;
|
|
46
|
+
var useDebugValue2 = React2.useDebugValue;
|
|
47
|
+
exports2.useSyncExternalStoreWithSelector = function(subscribe, getSnapshot, getServerSnapshot, selector, isEqual) {
|
|
48
|
+
var instRef = useRef2(null);
|
|
49
|
+
if (null === instRef.current) {
|
|
50
|
+
var inst = { hasValue: false, value: null };
|
|
51
|
+
instRef.current = inst;
|
|
52
|
+
} else inst = instRef.current;
|
|
53
|
+
instRef = useMemo2(
|
|
54
|
+
function() {
|
|
55
|
+
function memoizedSelector(nextSnapshot) {
|
|
56
|
+
if (!hasMemo) {
|
|
57
|
+
hasMemo = true;
|
|
58
|
+
memoizedSnapshot = nextSnapshot;
|
|
59
|
+
nextSnapshot = selector(nextSnapshot);
|
|
60
|
+
if (void 0 !== isEqual && inst.hasValue) {
|
|
61
|
+
var currentSelection = inst.value;
|
|
62
|
+
if (isEqual(currentSelection, nextSnapshot))
|
|
63
|
+
return memoizedSelection = currentSelection;
|
|
64
|
+
}
|
|
65
|
+
return memoizedSelection = nextSnapshot;
|
|
66
|
+
}
|
|
67
|
+
currentSelection = memoizedSelection;
|
|
68
|
+
if (objectIs(memoizedSnapshot, nextSnapshot)) return currentSelection;
|
|
69
|
+
var nextSelection = selector(nextSnapshot);
|
|
70
|
+
if (void 0 !== isEqual && isEqual(currentSelection, nextSelection))
|
|
71
|
+
return memoizedSnapshot = nextSnapshot, currentSelection;
|
|
72
|
+
memoizedSnapshot = nextSnapshot;
|
|
73
|
+
return memoizedSelection = nextSelection;
|
|
74
|
+
}
|
|
75
|
+
var hasMemo = false, memoizedSnapshot, memoizedSelection, maybeGetServerSnapshot = void 0 === getServerSnapshot ? null : getServerSnapshot;
|
|
76
|
+
return [
|
|
77
|
+
function() {
|
|
78
|
+
return memoizedSelector(getSnapshot());
|
|
79
|
+
},
|
|
80
|
+
null === maybeGetServerSnapshot ? void 0 : function() {
|
|
81
|
+
return memoizedSelector(maybeGetServerSnapshot());
|
|
82
|
+
}
|
|
83
|
+
];
|
|
84
|
+
},
|
|
85
|
+
[getSnapshot, getServerSnapshot, selector, isEqual]
|
|
86
|
+
);
|
|
87
|
+
var value = useSyncExternalStore2(subscribe, instRef[0], instRef[1]);
|
|
88
|
+
useEffect2(
|
|
89
|
+
function() {
|
|
90
|
+
inst.hasValue = true;
|
|
91
|
+
inst.value = value;
|
|
92
|
+
},
|
|
93
|
+
[value]
|
|
94
|
+
);
|
|
95
|
+
useDebugValue2(value);
|
|
96
|
+
return value;
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
// ../interface-logic/node_modules/use-sync-external-store/cjs/use-sync-external-store-with-selector.development.js
|
|
102
|
+
var require_use_sync_external_store_with_selector_development = __commonJS({
|
|
103
|
+
"../interface-logic/node_modules/use-sync-external-store/cjs/use-sync-external-store-with-selector.development.js"(exports2) {
|
|
104
|
+
"use strict";
|
|
105
|
+
"production" !== process.env.NODE_ENV && function() {
|
|
106
|
+
function is2(x, y) {
|
|
107
|
+
return x === y && (0 !== x || 1 / x === 1 / y) || x !== x && y !== y;
|
|
108
|
+
}
|
|
109
|
+
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
|
|
110
|
+
var React2 = require("react"), objectIs = "function" === typeof Object.is ? Object.is : is2, useSyncExternalStore2 = React2.useSyncExternalStore, useRef2 = React2.useRef, useEffect2 = React2.useEffect, useMemo2 = React2.useMemo, useDebugValue2 = React2.useDebugValue;
|
|
111
|
+
exports2.useSyncExternalStoreWithSelector = function(subscribe, getSnapshot, getServerSnapshot, selector, isEqual) {
|
|
112
|
+
var instRef = useRef2(null);
|
|
113
|
+
if (null === instRef.current) {
|
|
114
|
+
var inst = { hasValue: false, value: null };
|
|
115
|
+
instRef.current = inst;
|
|
116
|
+
} else inst = instRef.current;
|
|
117
|
+
instRef = useMemo2(
|
|
118
|
+
function() {
|
|
119
|
+
function memoizedSelector(nextSnapshot) {
|
|
120
|
+
if (!hasMemo) {
|
|
121
|
+
hasMemo = true;
|
|
122
|
+
memoizedSnapshot = nextSnapshot;
|
|
123
|
+
nextSnapshot = selector(nextSnapshot);
|
|
124
|
+
if (void 0 !== isEqual && inst.hasValue) {
|
|
125
|
+
var currentSelection = inst.value;
|
|
126
|
+
if (isEqual(currentSelection, nextSnapshot))
|
|
127
|
+
return memoizedSelection = currentSelection;
|
|
128
|
+
}
|
|
129
|
+
return memoizedSelection = nextSnapshot;
|
|
130
|
+
}
|
|
131
|
+
currentSelection = memoizedSelection;
|
|
132
|
+
if (objectIs(memoizedSnapshot, nextSnapshot))
|
|
133
|
+
return currentSelection;
|
|
134
|
+
var nextSelection = selector(nextSnapshot);
|
|
135
|
+
if (void 0 !== isEqual && isEqual(currentSelection, nextSelection))
|
|
136
|
+
return memoizedSnapshot = nextSnapshot, currentSelection;
|
|
137
|
+
memoizedSnapshot = nextSnapshot;
|
|
138
|
+
return memoizedSelection = nextSelection;
|
|
139
|
+
}
|
|
140
|
+
var hasMemo = false, memoizedSnapshot, memoizedSelection, maybeGetServerSnapshot = void 0 === getServerSnapshot ? null : getServerSnapshot;
|
|
141
|
+
return [
|
|
142
|
+
function() {
|
|
143
|
+
return memoizedSelector(getSnapshot());
|
|
144
|
+
},
|
|
145
|
+
null === maybeGetServerSnapshot ? void 0 : function() {
|
|
146
|
+
return memoizedSelector(maybeGetServerSnapshot());
|
|
147
|
+
}
|
|
148
|
+
];
|
|
149
|
+
},
|
|
150
|
+
[getSnapshot, getServerSnapshot, selector, isEqual]
|
|
151
|
+
);
|
|
152
|
+
var value = useSyncExternalStore2(subscribe, instRef[0], instRef[1]);
|
|
153
|
+
useEffect2(
|
|
154
|
+
function() {
|
|
155
|
+
inst.hasValue = true;
|
|
156
|
+
inst.value = value;
|
|
157
|
+
},
|
|
158
|
+
[value]
|
|
159
|
+
);
|
|
160
|
+
useDebugValue2(value);
|
|
161
|
+
return value;
|
|
162
|
+
};
|
|
163
|
+
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
|
|
164
|
+
}();
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
// ../interface-logic/node_modules/use-sync-external-store/with-selector.js
|
|
169
|
+
var require_with_selector = __commonJS({
|
|
170
|
+
"../interface-logic/node_modules/use-sync-external-store/with-selector.js"(exports2, module2) {
|
|
171
|
+
"use strict";
|
|
172
|
+
if (process.env.NODE_ENV === "production") {
|
|
173
|
+
module2.exports = require_use_sync_external_store_with_selector_production();
|
|
174
|
+
} else {
|
|
175
|
+
module2.exports = require_use_sync_external_store_with_selector_development();
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
// src/store.ts
|
|
181
|
+
var store_exports = {};
|
|
182
|
+
__export(store_exports, {
|
|
183
|
+
breadcrumbsSlice: () => breadcrumbsSlice,
|
|
184
|
+
clearSearchMap: () => clearSearchMap,
|
|
185
|
+
envSlice: () => envSlice,
|
|
186
|
+
envStore: () => envStore,
|
|
187
|
+
excelSlice: () => excelSlice,
|
|
188
|
+
formSlice: () => formSlice,
|
|
189
|
+
headerSlice: () => headerSlice,
|
|
190
|
+
listSlice: () => listSlice,
|
|
191
|
+
loginSlice: () => loginSlice,
|
|
192
|
+
navbarSlice: () => navbarSlice,
|
|
193
|
+
profileSlice: () => profileSlice,
|
|
194
|
+
removeKeyFromSearchMap: () => removeKeyFromSearchMap,
|
|
195
|
+
searchSlice: () => searchSlice,
|
|
196
|
+
selectBreadCrumbs: () => selectBreadCrumbs,
|
|
197
|
+
selectEnv: () => selectEnv,
|
|
198
|
+
selectExcel: () => selectExcel,
|
|
199
|
+
selectForm: () => selectForm,
|
|
200
|
+
selectHeader: () => selectHeader,
|
|
201
|
+
selectList: () => selectList,
|
|
202
|
+
selectLogin: () => selectLogin,
|
|
203
|
+
selectNavbar: () => selectNavbar,
|
|
204
|
+
selectProfile: () => selectProfile,
|
|
205
|
+
selectSearch: () => selectSearch,
|
|
206
|
+
selectSearchMap: () => selectSearchMap,
|
|
207
|
+
setAllowCompanies: () => setAllowCompanies,
|
|
208
|
+
setAllowedCompanyIds: () => setAllowedCompanyIds,
|
|
209
|
+
setBreadCrumbs: () => setBreadCrumbs,
|
|
210
|
+
setCompanies: () => setCompanies,
|
|
211
|
+
setConfig: () => setConfig,
|
|
212
|
+
setDataParse: () => setDataParse,
|
|
213
|
+
setDataUser: () => setDataUser,
|
|
214
|
+
setDb: () => setDb,
|
|
215
|
+
setDefaultCompany: () => setDefaultCompany,
|
|
216
|
+
setDomainTable: () => setDomainTable,
|
|
217
|
+
setEnv: () => setEnv,
|
|
218
|
+
setEnvFile: () => setEnvFile,
|
|
219
|
+
setErrorData: () => setErrorData,
|
|
220
|
+
setFieldTranslate: () => setFieldTranslate,
|
|
221
|
+
setFields: () => setFields,
|
|
222
|
+
setFilterBy: () => setFilterBy,
|
|
223
|
+
setFirstDomain: () => setFirstDomain,
|
|
224
|
+
setForgotPasswordUrl: () => setForgotPasswordUrl,
|
|
225
|
+
setFormSubmitComponent: () => setFormSubmitComponent,
|
|
226
|
+
setGroupBy: () => setGroupBy,
|
|
227
|
+
setGroupByDomain: () => setGroupByDomain,
|
|
228
|
+
setHeader: () => setHeader,
|
|
229
|
+
setHoveredIndexSearchList: () => setHoveredIndexSearchList,
|
|
230
|
+
setIdFile: () => setIdFile,
|
|
231
|
+
setIndexRowTableModal: () => setIndexRowTableModal,
|
|
232
|
+
setIsFileLoaded: () => setIsFileLoaded,
|
|
233
|
+
setIsShowModalTranslate: () => setIsShowModalTranslate,
|
|
234
|
+
setIsShowingModalDetail: () => setIsShowingModalDetail,
|
|
235
|
+
setIsUpdateTableModal: () => setIsUpdateTableModal,
|
|
236
|
+
setLang: () => setLang,
|
|
237
|
+
setListSubject: () => setListSubject,
|
|
238
|
+
setLoadingImport: () => setLoadingImport,
|
|
239
|
+
setMenuFocus: () => setMenuFocus,
|
|
240
|
+
setMenuFocusAction: () => setMenuFocusAction,
|
|
241
|
+
setMenuList: () => setMenuList,
|
|
242
|
+
setNavbarWidth: () => setNavbarWidth,
|
|
243
|
+
setOrder: () => setOrder,
|
|
244
|
+
setPage: () => setPage,
|
|
245
|
+
setPageLimit: () => setPageLimit,
|
|
246
|
+
setProfile: () => setProfile,
|
|
247
|
+
setRedirectTo: () => setRedirectTo,
|
|
248
|
+
setSearchBy: () => setSearchBy,
|
|
249
|
+
setSearchMap: () => setSearchMap,
|
|
250
|
+
setSearchString: () => setSearchString,
|
|
251
|
+
setSelectedFile: () => setSelectedFile,
|
|
252
|
+
setSelectedRadioKey: () => setSelectedRadioKey,
|
|
253
|
+
setSelectedRowKeys: () => setSelectedRowKeys,
|
|
254
|
+
setSelectedTags: () => setSelectedTags,
|
|
255
|
+
setTransferDetail: () => setTransferDetail,
|
|
256
|
+
setUid: () => setUid,
|
|
257
|
+
setUser: () => setUser,
|
|
258
|
+
setViewDataStore: () => setViewDataStore,
|
|
259
|
+
updateSearchMap: () => updateSearchMap,
|
|
260
|
+
useAppDispatch: () => useAppDispatch,
|
|
261
|
+
useAppSelector: () => useAppSelector
|
|
262
|
+
});
|
|
263
|
+
module.exports = __toCommonJS(store_exports);
|
|
264
|
+
|
|
265
|
+
// ../interface-logic/node_modules/react-redux/dist/react-redux.mjs
|
|
266
|
+
var React = __toESM(require("react"), 1);
|
|
267
|
+
var import_with_selector = __toESM(require_with_selector(), 1);
|
|
268
|
+
var REACT_FORWARD_REF_TYPE = /* @__PURE__ */ Symbol.for("react.forward_ref");
|
|
269
|
+
var REACT_MEMO_TYPE = /* @__PURE__ */ Symbol.for("react.memo");
|
|
270
|
+
var ForwardRef = REACT_FORWARD_REF_TYPE;
|
|
271
|
+
var Memo = REACT_MEMO_TYPE;
|
|
272
|
+
var FORWARD_REF_STATICS = {
|
|
273
|
+
$$typeof: true,
|
|
274
|
+
render: true,
|
|
275
|
+
defaultProps: true,
|
|
276
|
+
displayName: true,
|
|
277
|
+
propTypes: true
|
|
278
|
+
};
|
|
279
|
+
var MEMO_STATICS = {
|
|
280
|
+
$$typeof: true,
|
|
281
|
+
compare: true,
|
|
282
|
+
defaultProps: true,
|
|
283
|
+
displayName: true,
|
|
284
|
+
propTypes: true,
|
|
285
|
+
type: true
|
|
286
|
+
};
|
|
287
|
+
var TYPE_STATICS = {
|
|
288
|
+
[ForwardRef]: FORWARD_REF_STATICS,
|
|
289
|
+
[Memo]: MEMO_STATICS
|
|
290
|
+
};
|
|
291
|
+
var objectPrototype = Object.prototype;
|
|
292
|
+
var ContextKey = /* @__PURE__ */ Symbol.for(`react-redux-context`);
|
|
293
|
+
var gT = typeof globalThis !== "undefined" ? globalThis : (
|
|
294
|
+
/* fall back to a per-module scope (pre-8.1 behaviour) if `globalThis` is not available */
|
|
295
|
+
{}
|
|
296
|
+
);
|
|
297
|
+
function getContext() {
|
|
298
|
+
if (!React.createContext) return {};
|
|
299
|
+
const contextMap = gT[ContextKey] ??= /* @__PURE__ */ new Map();
|
|
300
|
+
let realContext = contextMap.get(React.createContext);
|
|
301
|
+
if (!realContext) {
|
|
302
|
+
realContext = React.createContext(
|
|
303
|
+
null
|
|
304
|
+
);
|
|
305
|
+
if (process.env.NODE_ENV !== "production") {
|
|
306
|
+
realContext.displayName = "ReactRedux";
|
|
307
|
+
}
|
|
308
|
+
contextMap.set(React.createContext, realContext);
|
|
309
|
+
}
|
|
310
|
+
return realContext;
|
|
311
|
+
}
|
|
312
|
+
var ReactReduxContext = /* @__PURE__ */ getContext();
|
|
313
|
+
function createReduxContextHook(context = ReactReduxContext) {
|
|
314
|
+
return function useReduxContext2() {
|
|
315
|
+
const contextValue = React.useContext(context);
|
|
316
|
+
if (process.env.NODE_ENV !== "production" && !contextValue) {
|
|
317
|
+
throw new Error(
|
|
318
|
+
"could not find react-redux context value; please ensure the component is wrapped in a <Provider>"
|
|
319
|
+
);
|
|
320
|
+
}
|
|
321
|
+
return contextValue;
|
|
322
|
+
};
|
|
323
|
+
}
|
|
324
|
+
var useReduxContext = /* @__PURE__ */ createReduxContextHook();
|
|
325
|
+
function createStoreHook(context = ReactReduxContext) {
|
|
326
|
+
const useReduxContext2 = context === ReactReduxContext ? useReduxContext : (
|
|
327
|
+
// @ts-ignore
|
|
328
|
+
createReduxContextHook(context)
|
|
329
|
+
);
|
|
330
|
+
const useStore2 = () => {
|
|
331
|
+
const { store } = useReduxContext2();
|
|
332
|
+
return store;
|
|
333
|
+
};
|
|
334
|
+
Object.assign(useStore2, {
|
|
335
|
+
withTypes: () => useStore2
|
|
336
|
+
});
|
|
337
|
+
return useStore2;
|
|
338
|
+
}
|
|
339
|
+
var useStore = /* @__PURE__ */ createStoreHook();
|
|
340
|
+
function createDispatchHook(context = ReactReduxContext) {
|
|
341
|
+
const useStore2 = context === ReactReduxContext ? useStore : createStoreHook(context);
|
|
342
|
+
const useDispatch2 = () => {
|
|
343
|
+
const store = useStore2();
|
|
344
|
+
return store.dispatch;
|
|
345
|
+
};
|
|
346
|
+
Object.assign(useDispatch2, {
|
|
347
|
+
withTypes: () => useDispatch2
|
|
348
|
+
});
|
|
349
|
+
return useDispatch2;
|
|
350
|
+
}
|
|
351
|
+
var useDispatch = /* @__PURE__ */ createDispatchHook();
|
|
352
|
+
var refEquality = (a, b) => a === b;
|
|
353
|
+
function createSelectorHook(context = ReactReduxContext) {
|
|
354
|
+
const useReduxContext2 = context === ReactReduxContext ? useReduxContext : createReduxContextHook(context);
|
|
355
|
+
const useSelector2 = (selector, equalityFnOrOptions = {}) => {
|
|
356
|
+
const { equalityFn = refEquality } = typeof equalityFnOrOptions === "function" ? { equalityFn: equalityFnOrOptions } : equalityFnOrOptions;
|
|
357
|
+
if (process.env.NODE_ENV !== "production") {
|
|
358
|
+
if (!selector) {
|
|
359
|
+
throw new Error(`You must pass a selector to useSelector`);
|
|
360
|
+
}
|
|
361
|
+
if (typeof selector !== "function") {
|
|
362
|
+
throw new Error(`You must pass a function as a selector to useSelector`);
|
|
363
|
+
}
|
|
364
|
+
if (typeof equalityFn !== "function") {
|
|
365
|
+
throw new Error(
|
|
366
|
+
`You must pass a function as an equality function to useSelector`
|
|
367
|
+
);
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
const reduxContext = useReduxContext2();
|
|
371
|
+
const { store, subscription, getServerState } = reduxContext;
|
|
372
|
+
const firstRun = React.useRef(true);
|
|
373
|
+
const wrappedSelector = React.useCallback(
|
|
374
|
+
{
|
|
375
|
+
[selector.name](state) {
|
|
376
|
+
const selected = selector(state);
|
|
377
|
+
if (process.env.NODE_ENV !== "production") {
|
|
378
|
+
const { devModeChecks = {} } = typeof equalityFnOrOptions === "function" ? {} : equalityFnOrOptions;
|
|
379
|
+
const { identityFunctionCheck, stabilityCheck } = reduxContext;
|
|
380
|
+
const {
|
|
381
|
+
identityFunctionCheck: finalIdentityFunctionCheck,
|
|
382
|
+
stabilityCheck: finalStabilityCheck
|
|
383
|
+
} = {
|
|
384
|
+
stabilityCheck,
|
|
385
|
+
identityFunctionCheck,
|
|
386
|
+
...devModeChecks
|
|
387
|
+
};
|
|
388
|
+
if (finalStabilityCheck === "always" || finalStabilityCheck === "once" && firstRun.current) {
|
|
389
|
+
const toCompare = selector(state);
|
|
390
|
+
if (!equalityFn(selected, toCompare)) {
|
|
391
|
+
let stack = void 0;
|
|
392
|
+
try {
|
|
393
|
+
throw new Error();
|
|
394
|
+
} catch (e) {
|
|
395
|
+
;
|
|
396
|
+
({ stack } = e);
|
|
397
|
+
}
|
|
398
|
+
console.warn(
|
|
399
|
+
"Selector " + (selector.name || "unknown") + " returned a different result when called with the same parameters. This can lead to unnecessary rerenders.\nSelectors that return a new reference (such as an object or an array) should be memoized: https://redux.js.org/usage/deriving-data-selectors#optimizing-selectors-with-memoization",
|
|
400
|
+
{
|
|
401
|
+
state,
|
|
402
|
+
selected,
|
|
403
|
+
selected2: toCompare,
|
|
404
|
+
stack
|
|
405
|
+
}
|
|
406
|
+
);
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
if (finalIdentityFunctionCheck === "always" || finalIdentityFunctionCheck === "once" && firstRun.current) {
|
|
410
|
+
if (selected === state) {
|
|
411
|
+
let stack = void 0;
|
|
412
|
+
try {
|
|
413
|
+
throw new Error();
|
|
414
|
+
} catch (e) {
|
|
415
|
+
;
|
|
416
|
+
({ stack } = e);
|
|
417
|
+
}
|
|
418
|
+
console.warn(
|
|
419
|
+
"Selector " + (selector.name || "unknown") + " returned the root state when called. This can lead to unnecessary rerenders.\nSelectors that return the entire state are almost certainly a mistake, as they will cause a rerender whenever *anything* in state changes.",
|
|
420
|
+
{ stack }
|
|
421
|
+
);
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
if (firstRun.current) firstRun.current = false;
|
|
425
|
+
}
|
|
426
|
+
return selected;
|
|
427
|
+
}
|
|
428
|
+
}[selector.name],
|
|
429
|
+
[selector]
|
|
430
|
+
);
|
|
431
|
+
const selectedState = (0, import_with_selector.useSyncExternalStoreWithSelector)(
|
|
432
|
+
subscription.addNestedSub,
|
|
433
|
+
store.getState,
|
|
434
|
+
getServerState || store.getState,
|
|
435
|
+
wrappedSelector,
|
|
436
|
+
equalityFn
|
|
437
|
+
);
|
|
438
|
+
React.useDebugValue(selectedState);
|
|
439
|
+
return selectedState;
|
|
440
|
+
};
|
|
441
|
+
Object.assign(useSelector2, {
|
|
442
|
+
withTypes: () => useSelector2
|
|
443
|
+
});
|
|
444
|
+
return useSelector2;
|
|
445
|
+
}
|
|
446
|
+
var useSelector = /* @__PURE__ */ createSelectorHook();
|
|
447
|
+
|
|
448
|
+
// ../interface-logic/node_modules/redux/dist/redux.mjs
|
|
449
|
+
function formatProdErrorMessage(code) {
|
|
450
|
+
return `Minified Redux error #${code}; visit https://redux.js.org/Errors?code=${code} for the full message or use the non-minified dev environment for full errors. `;
|
|
451
|
+
}
|
|
452
|
+
var $$observable = /* @__PURE__ */ (() => typeof Symbol === "function" && Symbol.observable || "@@observable")();
|
|
453
|
+
var symbol_observable_default = $$observable;
|
|
454
|
+
var randomString = () => Math.random().toString(36).substring(7).split("").join(".");
|
|
455
|
+
var ActionTypes = {
|
|
456
|
+
INIT: `@@redux/INIT${/* @__PURE__ */ randomString()}`,
|
|
457
|
+
REPLACE: `@@redux/REPLACE${/* @__PURE__ */ randomString()}`,
|
|
458
|
+
PROBE_UNKNOWN_ACTION: () => `@@redux/PROBE_UNKNOWN_ACTION${randomString()}`
|
|
459
|
+
};
|
|
460
|
+
var actionTypes_default = ActionTypes;
|
|
461
|
+
function isPlainObject(obj) {
|
|
462
|
+
if (typeof obj !== "object" || obj === null)
|
|
463
|
+
return false;
|
|
464
|
+
let proto = obj;
|
|
465
|
+
while (Object.getPrototypeOf(proto) !== null) {
|
|
466
|
+
proto = Object.getPrototypeOf(proto);
|
|
467
|
+
}
|
|
468
|
+
return Object.getPrototypeOf(obj) === proto || Object.getPrototypeOf(obj) === null;
|
|
469
|
+
}
|
|
470
|
+
function miniKindOf(val) {
|
|
471
|
+
if (val === void 0)
|
|
472
|
+
return "undefined";
|
|
473
|
+
if (val === null)
|
|
474
|
+
return "null";
|
|
475
|
+
const type = typeof val;
|
|
476
|
+
switch (type) {
|
|
477
|
+
case "boolean":
|
|
478
|
+
case "string":
|
|
479
|
+
case "number":
|
|
480
|
+
case "symbol":
|
|
481
|
+
case "function": {
|
|
482
|
+
return type;
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
if (Array.isArray(val))
|
|
486
|
+
return "array";
|
|
487
|
+
if (isDate(val))
|
|
488
|
+
return "date";
|
|
489
|
+
if (isError(val))
|
|
490
|
+
return "error";
|
|
491
|
+
const constructorName = ctorName(val);
|
|
492
|
+
switch (constructorName) {
|
|
493
|
+
case "Symbol":
|
|
494
|
+
case "Promise":
|
|
495
|
+
case "WeakMap":
|
|
496
|
+
case "WeakSet":
|
|
497
|
+
case "Map":
|
|
498
|
+
case "Set":
|
|
499
|
+
return constructorName;
|
|
500
|
+
}
|
|
501
|
+
return Object.prototype.toString.call(val).slice(8, -1).toLowerCase().replace(/\s/g, "");
|
|
502
|
+
}
|
|
503
|
+
function ctorName(val) {
|
|
504
|
+
return typeof val.constructor === "function" ? val.constructor.name : null;
|
|
505
|
+
}
|
|
506
|
+
function isError(val) {
|
|
507
|
+
return val instanceof Error || typeof val.message === "string" && val.constructor && typeof val.constructor.stackTraceLimit === "number";
|
|
508
|
+
}
|
|
509
|
+
function isDate(val) {
|
|
510
|
+
if (val instanceof Date)
|
|
511
|
+
return true;
|
|
512
|
+
return typeof val.toDateString === "function" && typeof val.getDate === "function" && typeof val.setDate === "function";
|
|
513
|
+
}
|
|
514
|
+
function kindOf(val) {
|
|
515
|
+
let typeOfVal = typeof val;
|
|
516
|
+
if (process.env.NODE_ENV !== "production") {
|
|
517
|
+
typeOfVal = miniKindOf(val);
|
|
518
|
+
}
|
|
519
|
+
return typeOfVal;
|
|
520
|
+
}
|
|
521
|
+
function createStore(reducer, preloadedState, enhancer) {
|
|
522
|
+
if (typeof reducer !== "function") {
|
|
523
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(2) : `Expected the root reducer to be a function. Instead, received: '${kindOf(reducer)}'`);
|
|
524
|
+
}
|
|
525
|
+
if (typeof preloadedState === "function" && typeof enhancer === "function" || typeof enhancer === "function" && typeof arguments[3] === "function") {
|
|
526
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(0) : "It looks like you are passing several store enhancers to createStore(). This is not supported. Instead, compose them together to a single function. See https://redux.js.org/tutorials/fundamentals/part-4-store#creating-a-store-with-enhancers for an example.");
|
|
527
|
+
}
|
|
528
|
+
if (typeof preloadedState === "function" && typeof enhancer === "undefined") {
|
|
529
|
+
enhancer = preloadedState;
|
|
530
|
+
preloadedState = void 0;
|
|
531
|
+
}
|
|
532
|
+
if (typeof enhancer !== "undefined") {
|
|
533
|
+
if (typeof enhancer !== "function") {
|
|
534
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(1) : `Expected the enhancer to be a function. Instead, received: '${kindOf(enhancer)}'`);
|
|
535
|
+
}
|
|
536
|
+
return enhancer(createStore)(reducer, preloadedState);
|
|
537
|
+
}
|
|
538
|
+
let currentReducer = reducer;
|
|
539
|
+
let currentState = preloadedState;
|
|
540
|
+
let currentListeners = /* @__PURE__ */ new Map();
|
|
541
|
+
let nextListeners = currentListeners;
|
|
542
|
+
let listenerIdCounter = 0;
|
|
543
|
+
let isDispatching = false;
|
|
544
|
+
function ensureCanMutateNextListeners() {
|
|
545
|
+
if (nextListeners === currentListeners) {
|
|
546
|
+
nextListeners = /* @__PURE__ */ new Map();
|
|
547
|
+
currentListeners.forEach((listener2, key) => {
|
|
548
|
+
nextListeners.set(key, listener2);
|
|
549
|
+
});
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
function getState() {
|
|
553
|
+
if (isDispatching) {
|
|
554
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(3) : "You may not call store.getState() while the reducer is executing. The reducer has already received the state as an argument. Pass it down from the top reducer instead of reading it from the store.");
|
|
555
|
+
}
|
|
556
|
+
return currentState;
|
|
557
|
+
}
|
|
558
|
+
function subscribe(listener2) {
|
|
559
|
+
if (typeof listener2 !== "function") {
|
|
560
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(4) : `Expected the listener to be a function. Instead, received: '${kindOf(listener2)}'`);
|
|
561
|
+
}
|
|
562
|
+
if (isDispatching) {
|
|
563
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(5) : "You may not call store.subscribe() while the reducer is executing. If you would like to be notified after the store has been updated, subscribe from a component and invoke store.getState() in the callback to access the latest state. See https://redux.js.org/api/store#subscribelistener for more details.");
|
|
564
|
+
}
|
|
565
|
+
let isSubscribed = true;
|
|
566
|
+
ensureCanMutateNextListeners();
|
|
567
|
+
const listenerId = listenerIdCounter++;
|
|
568
|
+
nextListeners.set(listenerId, listener2);
|
|
569
|
+
return function unsubscribe() {
|
|
570
|
+
if (!isSubscribed) {
|
|
571
|
+
return;
|
|
572
|
+
}
|
|
573
|
+
if (isDispatching) {
|
|
574
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(6) : "You may not unsubscribe from a store listener while the reducer is executing. See https://redux.js.org/api/store#subscribelistener for more details.");
|
|
575
|
+
}
|
|
576
|
+
isSubscribed = false;
|
|
577
|
+
ensureCanMutateNextListeners();
|
|
578
|
+
nextListeners.delete(listenerId);
|
|
579
|
+
currentListeners = null;
|
|
580
|
+
};
|
|
581
|
+
}
|
|
582
|
+
function dispatch(action) {
|
|
583
|
+
if (!isPlainObject(action)) {
|
|
584
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(7) : `Actions must be plain objects. Instead, the actual type was: '${kindOf(action)}'. You may need to add middleware to your store setup to handle dispatching other values, such as 'redux-thunk' to handle dispatching functions. See https://redux.js.org/tutorials/fundamentals/part-4-store#middleware and https://redux.js.org/tutorials/fundamentals/part-6-async-logic#using-the-redux-thunk-middleware for examples.`);
|
|
585
|
+
}
|
|
586
|
+
if (typeof action.type === "undefined") {
|
|
587
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(8) : 'Actions may not have an undefined "type" property. You may have misspelled an action type string constant.');
|
|
588
|
+
}
|
|
589
|
+
if (typeof action.type !== "string") {
|
|
590
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(17) : `Action "type" property must be a string. Instead, the actual type was: '${kindOf(action.type)}'. Value was: '${action.type}' (stringified)`);
|
|
591
|
+
}
|
|
592
|
+
if (isDispatching) {
|
|
593
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(9) : "Reducers may not dispatch actions.");
|
|
594
|
+
}
|
|
595
|
+
try {
|
|
596
|
+
isDispatching = true;
|
|
597
|
+
currentState = currentReducer(currentState, action);
|
|
598
|
+
} finally {
|
|
599
|
+
isDispatching = false;
|
|
600
|
+
}
|
|
601
|
+
const listeners = currentListeners = nextListeners;
|
|
602
|
+
listeners.forEach((listener2) => {
|
|
603
|
+
listener2();
|
|
604
|
+
});
|
|
605
|
+
return action;
|
|
606
|
+
}
|
|
607
|
+
function replaceReducer(nextReducer) {
|
|
608
|
+
if (typeof nextReducer !== "function") {
|
|
609
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(10) : `Expected the nextReducer to be a function. Instead, received: '${kindOf(nextReducer)}`);
|
|
610
|
+
}
|
|
611
|
+
currentReducer = nextReducer;
|
|
612
|
+
dispatch({
|
|
613
|
+
type: actionTypes_default.REPLACE
|
|
614
|
+
});
|
|
615
|
+
}
|
|
616
|
+
function observable() {
|
|
617
|
+
const outerSubscribe = subscribe;
|
|
618
|
+
return {
|
|
619
|
+
/**
|
|
620
|
+
* The minimal observable subscription method.
|
|
621
|
+
* @param observer Any object that can be used as an observer.
|
|
622
|
+
* The observer object should have a `next` method.
|
|
623
|
+
* @returns An object with an `unsubscribe` method that can
|
|
624
|
+
* be used to unsubscribe the observable from the store, and prevent further
|
|
625
|
+
* emission of values from the observable.
|
|
626
|
+
*/
|
|
627
|
+
subscribe(observer) {
|
|
628
|
+
if (typeof observer !== "object" || observer === null) {
|
|
629
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(11) : `Expected the observer to be an object. Instead, received: '${kindOf(observer)}'`);
|
|
630
|
+
}
|
|
631
|
+
function observeState() {
|
|
632
|
+
const observerAsObserver = observer;
|
|
633
|
+
if (observerAsObserver.next) {
|
|
634
|
+
observerAsObserver.next(getState());
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
observeState();
|
|
638
|
+
const unsubscribe = outerSubscribe(observeState);
|
|
639
|
+
return {
|
|
640
|
+
unsubscribe
|
|
641
|
+
};
|
|
642
|
+
},
|
|
643
|
+
[symbol_observable_default]() {
|
|
644
|
+
return this;
|
|
645
|
+
}
|
|
646
|
+
};
|
|
647
|
+
}
|
|
648
|
+
dispatch({
|
|
649
|
+
type: actionTypes_default.INIT
|
|
650
|
+
});
|
|
651
|
+
const store = {
|
|
652
|
+
dispatch,
|
|
653
|
+
subscribe,
|
|
654
|
+
getState,
|
|
655
|
+
replaceReducer,
|
|
656
|
+
[symbol_observable_default]: observable
|
|
657
|
+
};
|
|
658
|
+
return store;
|
|
659
|
+
}
|
|
660
|
+
function warning(message) {
|
|
661
|
+
if (typeof console !== "undefined" && typeof console.error === "function") {
|
|
662
|
+
console.error(message);
|
|
663
|
+
}
|
|
664
|
+
try {
|
|
665
|
+
throw new Error(message);
|
|
666
|
+
} catch (e) {
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
function getUnexpectedStateShapeWarningMessage(inputState, reducers, action, unexpectedKeyCache) {
|
|
670
|
+
const reducerKeys = Object.keys(reducers);
|
|
671
|
+
const argumentName = action && action.type === actionTypes_default.INIT ? "preloadedState argument passed to createStore" : "previous state received by the reducer";
|
|
672
|
+
if (reducerKeys.length === 0) {
|
|
673
|
+
return "Store does not have a valid reducer. Make sure the argument passed to combineReducers is an object whose values are reducers.";
|
|
674
|
+
}
|
|
675
|
+
if (!isPlainObject(inputState)) {
|
|
676
|
+
return `The ${argumentName} has unexpected type of "${kindOf(inputState)}". Expected argument to be an object with the following keys: "${reducerKeys.join('", "')}"`;
|
|
677
|
+
}
|
|
678
|
+
const unexpectedKeys = Object.keys(inputState).filter((key) => !reducers.hasOwnProperty(key) && !unexpectedKeyCache[key]);
|
|
679
|
+
unexpectedKeys.forEach((key) => {
|
|
680
|
+
unexpectedKeyCache[key] = true;
|
|
681
|
+
});
|
|
682
|
+
if (action && action.type === actionTypes_default.REPLACE)
|
|
683
|
+
return;
|
|
684
|
+
if (unexpectedKeys.length > 0) {
|
|
685
|
+
return `Unexpected ${unexpectedKeys.length > 1 ? "keys" : "key"} "${unexpectedKeys.join('", "')}" found in ${argumentName}. Expected to find one of the known reducer keys instead: "${reducerKeys.join('", "')}". Unexpected keys will be ignored.`;
|
|
686
|
+
}
|
|
687
|
+
}
|
|
688
|
+
function assertReducerShape(reducers) {
|
|
689
|
+
Object.keys(reducers).forEach((key) => {
|
|
690
|
+
const reducer = reducers[key];
|
|
691
|
+
const initialState10 = reducer(void 0, {
|
|
692
|
+
type: actionTypes_default.INIT
|
|
693
|
+
});
|
|
694
|
+
if (typeof initialState10 === "undefined") {
|
|
695
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(12) : `The slice reducer for key "${key}" returned undefined during initialization. If the state passed to the reducer is undefined, you must explicitly return the initial state. The initial state may not be undefined. If you don't want to set a value for this reducer, you can use null instead of undefined.`);
|
|
696
|
+
}
|
|
697
|
+
if (typeof reducer(void 0, {
|
|
698
|
+
type: actionTypes_default.PROBE_UNKNOWN_ACTION()
|
|
699
|
+
}) === "undefined") {
|
|
700
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(13) : `The slice reducer for key "${key}" returned undefined when probed with a random type. Don't try to handle '${actionTypes_default.INIT}' or other actions in "redux/*" namespace. They are considered private. Instead, you must return the current state for any unknown actions, unless it is undefined, in which case you must return the initial state, regardless of the action type. The initial state may not be undefined, but can be null.`);
|
|
701
|
+
}
|
|
702
|
+
});
|
|
703
|
+
}
|
|
704
|
+
function combineReducers(reducers) {
|
|
705
|
+
const reducerKeys = Object.keys(reducers);
|
|
706
|
+
const finalReducers = {};
|
|
707
|
+
for (let i = 0; i < reducerKeys.length; i++) {
|
|
708
|
+
const key = reducerKeys[i];
|
|
709
|
+
if (process.env.NODE_ENV !== "production") {
|
|
710
|
+
if (typeof reducers[key] === "undefined") {
|
|
711
|
+
warning(`No reducer provided for key "${key}"`);
|
|
712
|
+
}
|
|
713
|
+
}
|
|
714
|
+
if (typeof reducers[key] === "function") {
|
|
715
|
+
finalReducers[key] = reducers[key];
|
|
716
|
+
}
|
|
717
|
+
}
|
|
718
|
+
const finalReducerKeys = Object.keys(finalReducers);
|
|
719
|
+
let unexpectedKeyCache;
|
|
720
|
+
if (process.env.NODE_ENV !== "production") {
|
|
721
|
+
unexpectedKeyCache = {};
|
|
722
|
+
}
|
|
723
|
+
let shapeAssertionError;
|
|
724
|
+
try {
|
|
725
|
+
assertReducerShape(finalReducers);
|
|
726
|
+
} catch (e) {
|
|
727
|
+
shapeAssertionError = e;
|
|
728
|
+
}
|
|
729
|
+
return function combination(state = {}, action) {
|
|
730
|
+
if (shapeAssertionError) {
|
|
731
|
+
throw shapeAssertionError;
|
|
732
|
+
}
|
|
733
|
+
if (process.env.NODE_ENV !== "production") {
|
|
734
|
+
const warningMessage = getUnexpectedStateShapeWarningMessage(state, finalReducers, action, unexpectedKeyCache);
|
|
735
|
+
if (warningMessage) {
|
|
736
|
+
warning(warningMessage);
|
|
737
|
+
}
|
|
738
|
+
}
|
|
739
|
+
let hasChanged = false;
|
|
740
|
+
const nextState = {};
|
|
741
|
+
for (let i = 0; i < finalReducerKeys.length; i++) {
|
|
742
|
+
const key = finalReducerKeys[i];
|
|
743
|
+
const reducer = finalReducers[key];
|
|
744
|
+
const previousStateForKey = state[key];
|
|
745
|
+
const nextStateForKey = reducer(previousStateForKey, action);
|
|
746
|
+
if (typeof nextStateForKey === "undefined") {
|
|
747
|
+
const actionType = action && action.type;
|
|
748
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(14) : `When called with an action of type ${actionType ? `"${String(actionType)}"` : "(unknown type)"}, the slice reducer for key "${key}" returned undefined. To ignore an action, you must explicitly return the previous state. If you want this reducer to hold no value, you can return null instead of undefined.`);
|
|
749
|
+
}
|
|
750
|
+
nextState[key] = nextStateForKey;
|
|
751
|
+
hasChanged = hasChanged || nextStateForKey !== previousStateForKey;
|
|
752
|
+
}
|
|
753
|
+
hasChanged = hasChanged || finalReducerKeys.length !== Object.keys(state).length;
|
|
754
|
+
return hasChanged ? nextState : state;
|
|
755
|
+
};
|
|
756
|
+
}
|
|
757
|
+
function compose(...funcs) {
|
|
758
|
+
if (funcs.length === 0) {
|
|
759
|
+
return (arg) => arg;
|
|
760
|
+
}
|
|
761
|
+
if (funcs.length === 1) {
|
|
762
|
+
return funcs[0];
|
|
763
|
+
}
|
|
764
|
+
return funcs.reduce((a, b) => (...args) => a(b(...args)));
|
|
765
|
+
}
|
|
766
|
+
function applyMiddleware(...middlewares) {
|
|
767
|
+
return (createStore2) => (reducer, preloadedState) => {
|
|
768
|
+
const store = createStore2(reducer, preloadedState);
|
|
769
|
+
let dispatch = () => {
|
|
770
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(15) : "Dispatching while constructing your middleware is not allowed. Other middleware would not be applied to this dispatch.");
|
|
771
|
+
};
|
|
772
|
+
const middlewareAPI = {
|
|
773
|
+
getState: store.getState,
|
|
774
|
+
dispatch: (action, ...args) => dispatch(action, ...args)
|
|
775
|
+
};
|
|
776
|
+
const chain = middlewares.map((middleware) => middleware(middlewareAPI));
|
|
777
|
+
dispatch = compose(...chain)(store.dispatch);
|
|
778
|
+
return {
|
|
779
|
+
...store,
|
|
780
|
+
dispatch
|
|
781
|
+
};
|
|
782
|
+
};
|
|
783
|
+
}
|
|
784
|
+
function isAction(action) {
|
|
785
|
+
return isPlainObject(action) && "type" in action && typeof action.type === "string";
|
|
786
|
+
}
|
|
787
|
+
|
|
788
|
+
// ../interface-logic/node_modules/immer/dist/immer.mjs
|
|
789
|
+
var NOTHING = Symbol.for("immer-nothing");
|
|
790
|
+
var DRAFTABLE = Symbol.for("immer-draftable");
|
|
791
|
+
var DRAFT_STATE = Symbol.for("immer-state");
|
|
792
|
+
var errors = process.env.NODE_ENV !== "production" ? [
|
|
793
|
+
// All error codes, starting by 0:
|
|
794
|
+
function(plugin) {
|
|
795
|
+
return `The plugin for '${plugin}' has not been loaded into Immer. To enable the plugin, import and call \`enable${plugin}()\` when initializing your application.`;
|
|
796
|
+
},
|
|
797
|
+
function(thing) {
|
|
798
|
+
return `produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${thing}'`;
|
|
799
|
+
},
|
|
800
|
+
"This object has been frozen and should not be mutated",
|
|
801
|
+
function(data) {
|
|
802
|
+
return "Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? " + data;
|
|
803
|
+
},
|
|
804
|
+
"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.",
|
|
805
|
+
"Immer forbids circular references",
|
|
806
|
+
"The first or second argument to `produce` must be a function",
|
|
807
|
+
"The third argument to `produce` must be a function or undefined",
|
|
808
|
+
"First argument to `createDraft` must be a plain object, an array, or an immerable object",
|
|
809
|
+
"First argument to `finishDraft` must be a draft returned by `createDraft`",
|
|
810
|
+
function(thing) {
|
|
811
|
+
return `'current' expects a draft, got: ${thing}`;
|
|
812
|
+
},
|
|
813
|
+
"Object.defineProperty() cannot be used on an Immer draft",
|
|
814
|
+
"Object.setPrototypeOf() cannot be used on an Immer draft",
|
|
815
|
+
"Immer only supports deleting array indices",
|
|
816
|
+
"Immer only supports setting array indices and the 'length' property",
|
|
817
|
+
function(thing) {
|
|
818
|
+
return `'original' expects a draft, got: ${thing}`;
|
|
819
|
+
}
|
|
820
|
+
// Note: if more errors are added, the errorOffset in Patches.ts should be increased
|
|
821
|
+
// See Patches.ts for additional errors
|
|
822
|
+
] : [];
|
|
823
|
+
function die(error, ...args) {
|
|
824
|
+
if (process.env.NODE_ENV !== "production") {
|
|
825
|
+
const e = errors[error];
|
|
826
|
+
const msg = typeof e === "function" ? e.apply(null, args) : e;
|
|
827
|
+
throw new Error(`[Immer] ${msg}`);
|
|
828
|
+
}
|
|
829
|
+
throw new Error(
|
|
830
|
+
`[Immer] minified error nr: ${error}. Full error at: https://bit.ly/3cXEKWf`
|
|
831
|
+
);
|
|
832
|
+
}
|
|
833
|
+
var getPrototypeOf = Object.getPrototypeOf;
|
|
834
|
+
function isDraft(value) {
|
|
835
|
+
return !!value && !!value[DRAFT_STATE];
|
|
836
|
+
}
|
|
837
|
+
function isDraftable(value) {
|
|
838
|
+
if (!value)
|
|
839
|
+
return false;
|
|
840
|
+
return isPlainObject2(value) || Array.isArray(value) || !!value[DRAFTABLE] || !!value.constructor?.[DRAFTABLE] || isMap(value) || isSet(value);
|
|
841
|
+
}
|
|
842
|
+
var objectCtorString = Object.prototype.constructor.toString();
|
|
843
|
+
function isPlainObject2(value) {
|
|
844
|
+
if (!value || typeof value !== "object")
|
|
845
|
+
return false;
|
|
846
|
+
const proto = getPrototypeOf(value);
|
|
847
|
+
if (proto === null) {
|
|
848
|
+
return true;
|
|
849
|
+
}
|
|
850
|
+
const Ctor = Object.hasOwnProperty.call(proto, "constructor") && proto.constructor;
|
|
851
|
+
if (Ctor === Object)
|
|
852
|
+
return true;
|
|
853
|
+
return typeof Ctor == "function" && Function.toString.call(Ctor) === objectCtorString;
|
|
854
|
+
}
|
|
855
|
+
function each(obj, iter) {
|
|
856
|
+
if (getArchtype(obj) === 0) {
|
|
857
|
+
Reflect.ownKeys(obj).forEach((key) => {
|
|
858
|
+
iter(key, obj[key], obj);
|
|
859
|
+
});
|
|
860
|
+
} else {
|
|
861
|
+
obj.forEach((entry, index) => iter(index, entry, obj));
|
|
862
|
+
}
|
|
863
|
+
}
|
|
864
|
+
function getArchtype(thing) {
|
|
865
|
+
const state = thing[DRAFT_STATE];
|
|
866
|
+
return state ? state.type_ : Array.isArray(thing) ? 1 : isMap(thing) ? 2 : isSet(thing) ? 3 : 0;
|
|
867
|
+
}
|
|
868
|
+
function has(thing, prop) {
|
|
869
|
+
return getArchtype(thing) === 2 ? thing.has(prop) : Object.prototype.hasOwnProperty.call(thing, prop);
|
|
870
|
+
}
|
|
871
|
+
function set(thing, propOrOldValue, value) {
|
|
872
|
+
const t = getArchtype(thing);
|
|
873
|
+
if (t === 2)
|
|
874
|
+
thing.set(propOrOldValue, value);
|
|
875
|
+
else if (t === 3) {
|
|
876
|
+
thing.add(value);
|
|
877
|
+
} else
|
|
878
|
+
thing[propOrOldValue] = value;
|
|
879
|
+
}
|
|
880
|
+
function is(x, y) {
|
|
881
|
+
if (x === y) {
|
|
882
|
+
return x !== 0 || 1 / x === 1 / y;
|
|
883
|
+
} else {
|
|
884
|
+
return x !== x && y !== y;
|
|
885
|
+
}
|
|
886
|
+
}
|
|
887
|
+
function isMap(target) {
|
|
888
|
+
return target instanceof Map;
|
|
889
|
+
}
|
|
890
|
+
function isSet(target) {
|
|
891
|
+
return target instanceof Set;
|
|
892
|
+
}
|
|
893
|
+
function latest(state) {
|
|
894
|
+
return state.copy_ || state.base_;
|
|
895
|
+
}
|
|
896
|
+
function shallowCopy(base, strict) {
|
|
897
|
+
if (isMap(base)) {
|
|
898
|
+
return new Map(base);
|
|
899
|
+
}
|
|
900
|
+
if (isSet(base)) {
|
|
901
|
+
return new Set(base);
|
|
902
|
+
}
|
|
903
|
+
if (Array.isArray(base))
|
|
904
|
+
return Array.prototype.slice.call(base);
|
|
905
|
+
const isPlain2 = isPlainObject2(base);
|
|
906
|
+
if (strict === true || strict === "class_only" && !isPlain2) {
|
|
907
|
+
const descriptors = Object.getOwnPropertyDescriptors(base);
|
|
908
|
+
delete descriptors[DRAFT_STATE];
|
|
909
|
+
let keys = Reflect.ownKeys(descriptors);
|
|
910
|
+
for (let i = 0; i < keys.length; i++) {
|
|
911
|
+
const key = keys[i];
|
|
912
|
+
const desc = descriptors[key];
|
|
913
|
+
if (desc.writable === false) {
|
|
914
|
+
desc.writable = true;
|
|
915
|
+
desc.configurable = true;
|
|
916
|
+
}
|
|
917
|
+
if (desc.get || desc.set)
|
|
918
|
+
descriptors[key] = {
|
|
919
|
+
configurable: true,
|
|
920
|
+
writable: true,
|
|
921
|
+
// could live with !!desc.set as well here...
|
|
922
|
+
enumerable: desc.enumerable,
|
|
923
|
+
value: base[key]
|
|
924
|
+
};
|
|
925
|
+
}
|
|
926
|
+
return Object.create(getPrototypeOf(base), descriptors);
|
|
927
|
+
} else {
|
|
928
|
+
const proto = getPrototypeOf(base);
|
|
929
|
+
if (proto !== null && isPlain2) {
|
|
930
|
+
return { ...base };
|
|
931
|
+
}
|
|
932
|
+
const obj = Object.create(proto);
|
|
933
|
+
return Object.assign(obj, base);
|
|
934
|
+
}
|
|
935
|
+
}
|
|
936
|
+
function freeze(obj, deep = false) {
|
|
937
|
+
if (isFrozen(obj) || isDraft(obj) || !isDraftable(obj))
|
|
938
|
+
return obj;
|
|
939
|
+
if (getArchtype(obj) > 1) {
|
|
940
|
+
obj.set = obj.add = obj.clear = obj.delete = dontMutateFrozenCollections;
|
|
941
|
+
}
|
|
942
|
+
Object.freeze(obj);
|
|
943
|
+
if (deep)
|
|
944
|
+
Object.entries(obj).forEach(([key, value]) => freeze(value, true));
|
|
945
|
+
return obj;
|
|
946
|
+
}
|
|
947
|
+
function dontMutateFrozenCollections() {
|
|
948
|
+
die(2);
|
|
949
|
+
}
|
|
950
|
+
function isFrozen(obj) {
|
|
951
|
+
return Object.isFrozen(obj);
|
|
952
|
+
}
|
|
953
|
+
var plugins = {};
|
|
954
|
+
function getPlugin(pluginKey) {
|
|
955
|
+
const plugin = plugins[pluginKey];
|
|
956
|
+
if (!plugin) {
|
|
957
|
+
die(0, pluginKey);
|
|
958
|
+
}
|
|
959
|
+
return plugin;
|
|
960
|
+
}
|
|
961
|
+
var currentScope;
|
|
962
|
+
function getCurrentScope() {
|
|
963
|
+
return currentScope;
|
|
964
|
+
}
|
|
965
|
+
function createScope(parent_, immer_) {
|
|
966
|
+
return {
|
|
967
|
+
drafts_: [],
|
|
968
|
+
parent_,
|
|
969
|
+
immer_,
|
|
970
|
+
// Whenever the modified draft contains a draft from another scope, we
|
|
971
|
+
// need to prevent auto-freezing so the unowned draft can be finalized.
|
|
972
|
+
canAutoFreeze_: true,
|
|
973
|
+
unfinalizedDrafts_: 0
|
|
974
|
+
};
|
|
975
|
+
}
|
|
976
|
+
function usePatchesInScope(scope, patchListener) {
|
|
977
|
+
if (patchListener) {
|
|
978
|
+
getPlugin("Patches");
|
|
979
|
+
scope.patches_ = [];
|
|
980
|
+
scope.inversePatches_ = [];
|
|
981
|
+
scope.patchListener_ = patchListener;
|
|
982
|
+
}
|
|
983
|
+
}
|
|
984
|
+
function revokeScope(scope) {
|
|
985
|
+
leaveScope(scope);
|
|
986
|
+
scope.drafts_.forEach(revokeDraft);
|
|
987
|
+
scope.drafts_ = null;
|
|
988
|
+
}
|
|
989
|
+
function leaveScope(scope) {
|
|
990
|
+
if (scope === currentScope) {
|
|
991
|
+
currentScope = scope.parent_;
|
|
992
|
+
}
|
|
993
|
+
}
|
|
994
|
+
function enterScope(immer2) {
|
|
995
|
+
return currentScope = createScope(currentScope, immer2);
|
|
996
|
+
}
|
|
997
|
+
function revokeDraft(draft) {
|
|
998
|
+
const state = draft[DRAFT_STATE];
|
|
999
|
+
if (state.type_ === 0 || state.type_ === 1)
|
|
1000
|
+
state.revoke_();
|
|
1001
|
+
else
|
|
1002
|
+
state.revoked_ = true;
|
|
1003
|
+
}
|
|
1004
|
+
function processResult(result, scope) {
|
|
1005
|
+
scope.unfinalizedDrafts_ = scope.drafts_.length;
|
|
1006
|
+
const baseDraft = scope.drafts_[0];
|
|
1007
|
+
const isReplaced = result !== void 0 && result !== baseDraft;
|
|
1008
|
+
if (isReplaced) {
|
|
1009
|
+
if (baseDraft[DRAFT_STATE].modified_) {
|
|
1010
|
+
revokeScope(scope);
|
|
1011
|
+
die(4);
|
|
1012
|
+
}
|
|
1013
|
+
if (isDraftable(result)) {
|
|
1014
|
+
result = finalize(scope, result);
|
|
1015
|
+
if (!scope.parent_)
|
|
1016
|
+
maybeFreeze(scope, result);
|
|
1017
|
+
}
|
|
1018
|
+
if (scope.patches_) {
|
|
1019
|
+
getPlugin("Patches").generateReplacementPatches_(
|
|
1020
|
+
baseDraft[DRAFT_STATE].base_,
|
|
1021
|
+
result,
|
|
1022
|
+
scope.patches_,
|
|
1023
|
+
scope.inversePatches_
|
|
1024
|
+
);
|
|
1025
|
+
}
|
|
1026
|
+
} else {
|
|
1027
|
+
result = finalize(scope, baseDraft, []);
|
|
1028
|
+
}
|
|
1029
|
+
revokeScope(scope);
|
|
1030
|
+
if (scope.patches_) {
|
|
1031
|
+
scope.patchListener_(scope.patches_, scope.inversePatches_);
|
|
1032
|
+
}
|
|
1033
|
+
return result !== NOTHING ? result : void 0;
|
|
1034
|
+
}
|
|
1035
|
+
function finalize(rootScope, value, path) {
|
|
1036
|
+
if (isFrozen(value))
|
|
1037
|
+
return value;
|
|
1038
|
+
const state = value[DRAFT_STATE];
|
|
1039
|
+
if (!state) {
|
|
1040
|
+
each(
|
|
1041
|
+
value,
|
|
1042
|
+
(key, childValue) => finalizeProperty(rootScope, state, value, key, childValue, path)
|
|
1043
|
+
);
|
|
1044
|
+
return value;
|
|
1045
|
+
}
|
|
1046
|
+
if (state.scope_ !== rootScope)
|
|
1047
|
+
return value;
|
|
1048
|
+
if (!state.modified_) {
|
|
1049
|
+
maybeFreeze(rootScope, state.base_, true);
|
|
1050
|
+
return state.base_;
|
|
1051
|
+
}
|
|
1052
|
+
if (!state.finalized_) {
|
|
1053
|
+
state.finalized_ = true;
|
|
1054
|
+
state.scope_.unfinalizedDrafts_--;
|
|
1055
|
+
const result = state.copy_;
|
|
1056
|
+
let resultEach = result;
|
|
1057
|
+
let isSet2 = false;
|
|
1058
|
+
if (state.type_ === 3) {
|
|
1059
|
+
resultEach = new Set(result);
|
|
1060
|
+
result.clear();
|
|
1061
|
+
isSet2 = true;
|
|
1062
|
+
}
|
|
1063
|
+
each(
|
|
1064
|
+
resultEach,
|
|
1065
|
+
(key, childValue) => finalizeProperty(rootScope, state, result, key, childValue, path, isSet2)
|
|
1066
|
+
);
|
|
1067
|
+
maybeFreeze(rootScope, result, false);
|
|
1068
|
+
if (path && rootScope.patches_) {
|
|
1069
|
+
getPlugin("Patches").generatePatches_(
|
|
1070
|
+
state,
|
|
1071
|
+
path,
|
|
1072
|
+
rootScope.patches_,
|
|
1073
|
+
rootScope.inversePatches_
|
|
1074
|
+
);
|
|
1075
|
+
}
|
|
1076
|
+
}
|
|
1077
|
+
return state.copy_;
|
|
1078
|
+
}
|
|
1079
|
+
function finalizeProperty(rootScope, parentState, targetObject, prop, childValue, rootPath, targetIsSet) {
|
|
1080
|
+
if (process.env.NODE_ENV !== "production" && childValue === targetObject)
|
|
1081
|
+
die(5);
|
|
1082
|
+
if (isDraft(childValue)) {
|
|
1083
|
+
const path = rootPath && parentState && parentState.type_ !== 3 && // Set objects are atomic since they have no keys.
|
|
1084
|
+
!has(parentState.assigned_, prop) ? rootPath.concat(prop) : void 0;
|
|
1085
|
+
const res = finalize(rootScope, childValue, path);
|
|
1086
|
+
set(targetObject, prop, res);
|
|
1087
|
+
if (isDraft(res)) {
|
|
1088
|
+
rootScope.canAutoFreeze_ = false;
|
|
1089
|
+
} else
|
|
1090
|
+
return;
|
|
1091
|
+
} else if (targetIsSet) {
|
|
1092
|
+
targetObject.add(childValue);
|
|
1093
|
+
}
|
|
1094
|
+
if (isDraftable(childValue) && !isFrozen(childValue)) {
|
|
1095
|
+
if (!rootScope.immer_.autoFreeze_ && rootScope.unfinalizedDrafts_ < 1) {
|
|
1096
|
+
return;
|
|
1097
|
+
}
|
|
1098
|
+
finalize(rootScope, childValue);
|
|
1099
|
+
if ((!parentState || !parentState.scope_.parent_) && typeof prop !== "symbol" && Object.prototype.propertyIsEnumerable.call(targetObject, prop))
|
|
1100
|
+
maybeFreeze(rootScope, childValue);
|
|
1101
|
+
}
|
|
1102
|
+
}
|
|
1103
|
+
function maybeFreeze(scope, value, deep = false) {
|
|
1104
|
+
if (!scope.parent_ && scope.immer_.autoFreeze_ && scope.canAutoFreeze_) {
|
|
1105
|
+
freeze(value, deep);
|
|
1106
|
+
}
|
|
1107
|
+
}
|
|
1108
|
+
function createProxyProxy(base, parent) {
|
|
1109
|
+
const isArray = Array.isArray(base);
|
|
1110
|
+
const state = {
|
|
1111
|
+
type_: isArray ? 1 : 0,
|
|
1112
|
+
// Track which produce call this is associated with.
|
|
1113
|
+
scope_: parent ? parent.scope_ : getCurrentScope(),
|
|
1114
|
+
// True for both shallow and deep changes.
|
|
1115
|
+
modified_: false,
|
|
1116
|
+
// Used during finalization.
|
|
1117
|
+
finalized_: false,
|
|
1118
|
+
// Track which properties have been assigned (true) or deleted (false).
|
|
1119
|
+
assigned_: {},
|
|
1120
|
+
// The parent draft state.
|
|
1121
|
+
parent_: parent,
|
|
1122
|
+
// The base state.
|
|
1123
|
+
base_: base,
|
|
1124
|
+
// The base proxy.
|
|
1125
|
+
draft_: null,
|
|
1126
|
+
// set below
|
|
1127
|
+
// The base copy with any updated values.
|
|
1128
|
+
copy_: null,
|
|
1129
|
+
// Called by the `produce` function.
|
|
1130
|
+
revoke_: null,
|
|
1131
|
+
isManual_: false
|
|
1132
|
+
};
|
|
1133
|
+
let target = state;
|
|
1134
|
+
let traps = objectTraps;
|
|
1135
|
+
if (isArray) {
|
|
1136
|
+
target = [state];
|
|
1137
|
+
traps = arrayTraps;
|
|
1138
|
+
}
|
|
1139
|
+
const { revoke, proxy } = Proxy.revocable(target, traps);
|
|
1140
|
+
state.draft_ = proxy;
|
|
1141
|
+
state.revoke_ = revoke;
|
|
1142
|
+
return proxy;
|
|
1143
|
+
}
|
|
1144
|
+
var objectTraps = {
|
|
1145
|
+
get(state, prop) {
|
|
1146
|
+
if (prop === DRAFT_STATE)
|
|
1147
|
+
return state;
|
|
1148
|
+
const source = latest(state);
|
|
1149
|
+
if (!has(source, prop)) {
|
|
1150
|
+
return readPropFromProto(state, source, prop);
|
|
1151
|
+
}
|
|
1152
|
+
const value = source[prop];
|
|
1153
|
+
if (state.finalized_ || !isDraftable(value)) {
|
|
1154
|
+
return value;
|
|
1155
|
+
}
|
|
1156
|
+
if (value === peek(state.base_, prop)) {
|
|
1157
|
+
prepareCopy(state);
|
|
1158
|
+
return state.copy_[prop] = createProxy(value, state);
|
|
1159
|
+
}
|
|
1160
|
+
return value;
|
|
1161
|
+
},
|
|
1162
|
+
has(state, prop) {
|
|
1163
|
+
return prop in latest(state);
|
|
1164
|
+
},
|
|
1165
|
+
ownKeys(state) {
|
|
1166
|
+
return Reflect.ownKeys(latest(state));
|
|
1167
|
+
},
|
|
1168
|
+
set(state, prop, value) {
|
|
1169
|
+
const desc = getDescriptorFromProto(latest(state), prop);
|
|
1170
|
+
if (desc?.set) {
|
|
1171
|
+
desc.set.call(state.draft_, value);
|
|
1172
|
+
return true;
|
|
1173
|
+
}
|
|
1174
|
+
if (!state.modified_) {
|
|
1175
|
+
const current2 = peek(latest(state), prop);
|
|
1176
|
+
const currentState = current2?.[DRAFT_STATE];
|
|
1177
|
+
if (currentState && currentState.base_ === value) {
|
|
1178
|
+
state.copy_[prop] = value;
|
|
1179
|
+
state.assigned_[prop] = false;
|
|
1180
|
+
return true;
|
|
1181
|
+
}
|
|
1182
|
+
if (is(value, current2) && (value !== void 0 || has(state.base_, prop)))
|
|
1183
|
+
return true;
|
|
1184
|
+
prepareCopy(state);
|
|
1185
|
+
markChanged(state);
|
|
1186
|
+
}
|
|
1187
|
+
if (state.copy_[prop] === value && // special case: handle new props with value 'undefined'
|
|
1188
|
+
(value !== void 0 || prop in state.copy_) || // special case: NaN
|
|
1189
|
+
Number.isNaN(value) && Number.isNaN(state.copy_[prop]))
|
|
1190
|
+
return true;
|
|
1191
|
+
state.copy_[prop] = value;
|
|
1192
|
+
state.assigned_[prop] = true;
|
|
1193
|
+
return true;
|
|
1194
|
+
},
|
|
1195
|
+
deleteProperty(state, prop) {
|
|
1196
|
+
if (peek(state.base_, prop) !== void 0 || prop in state.base_) {
|
|
1197
|
+
state.assigned_[prop] = false;
|
|
1198
|
+
prepareCopy(state);
|
|
1199
|
+
markChanged(state);
|
|
1200
|
+
} else {
|
|
1201
|
+
delete state.assigned_[prop];
|
|
1202
|
+
}
|
|
1203
|
+
if (state.copy_) {
|
|
1204
|
+
delete state.copy_[prop];
|
|
1205
|
+
}
|
|
1206
|
+
return true;
|
|
1207
|
+
},
|
|
1208
|
+
// Note: We never coerce `desc.value` into an Immer draft, because we can't make
|
|
1209
|
+
// the same guarantee in ES5 mode.
|
|
1210
|
+
getOwnPropertyDescriptor(state, prop) {
|
|
1211
|
+
const owner = latest(state);
|
|
1212
|
+
const desc = Reflect.getOwnPropertyDescriptor(owner, prop);
|
|
1213
|
+
if (!desc)
|
|
1214
|
+
return desc;
|
|
1215
|
+
return {
|
|
1216
|
+
writable: true,
|
|
1217
|
+
configurable: state.type_ !== 1 || prop !== "length",
|
|
1218
|
+
enumerable: desc.enumerable,
|
|
1219
|
+
value: owner[prop]
|
|
1220
|
+
};
|
|
1221
|
+
},
|
|
1222
|
+
defineProperty() {
|
|
1223
|
+
die(11);
|
|
1224
|
+
},
|
|
1225
|
+
getPrototypeOf(state) {
|
|
1226
|
+
return getPrototypeOf(state.base_);
|
|
1227
|
+
},
|
|
1228
|
+
setPrototypeOf() {
|
|
1229
|
+
die(12);
|
|
1230
|
+
}
|
|
1231
|
+
};
|
|
1232
|
+
var arrayTraps = {};
|
|
1233
|
+
each(objectTraps, (key, fn) => {
|
|
1234
|
+
arrayTraps[key] = function() {
|
|
1235
|
+
arguments[0] = arguments[0][0];
|
|
1236
|
+
return fn.apply(this, arguments);
|
|
1237
|
+
};
|
|
1238
|
+
});
|
|
1239
|
+
arrayTraps.deleteProperty = function(state, prop) {
|
|
1240
|
+
if (process.env.NODE_ENV !== "production" && isNaN(parseInt(prop)))
|
|
1241
|
+
die(13);
|
|
1242
|
+
return arrayTraps.set.call(this, state, prop, void 0);
|
|
1243
|
+
};
|
|
1244
|
+
arrayTraps.set = function(state, prop, value) {
|
|
1245
|
+
if (process.env.NODE_ENV !== "production" && prop !== "length" && isNaN(parseInt(prop)))
|
|
1246
|
+
die(14);
|
|
1247
|
+
return objectTraps.set.call(this, state[0], prop, value, state[0]);
|
|
1248
|
+
};
|
|
1249
|
+
function peek(draft, prop) {
|
|
1250
|
+
const state = draft[DRAFT_STATE];
|
|
1251
|
+
const source = state ? latest(state) : draft;
|
|
1252
|
+
return source[prop];
|
|
1253
|
+
}
|
|
1254
|
+
function readPropFromProto(state, source, prop) {
|
|
1255
|
+
const desc = getDescriptorFromProto(source, prop);
|
|
1256
|
+
return desc ? `value` in desc ? desc.value : (
|
|
1257
|
+
// This is a very special case, if the prop is a getter defined by the
|
|
1258
|
+
// prototype, we should invoke it with the draft as context!
|
|
1259
|
+
desc.get?.call(state.draft_)
|
|
1260
|
+
) : void 0;
|
|
1261
|
+
}
|
|
1262
|
+
function getDescriptorFromProto(source, prop) {
|
|
1263
|
+
if (!(prop in source))
|
|
1264
|
+
return void 0;
|
|
1265
|
+
let proto = getPrototypeOf(source);
|
|
1266
|
+
while (proto) {
|
|
1267
|
+
const desc = Object.getOwnPropertyDescriptor(proto, prop);
|
|
1268
|
+
if (desc)
|
|
1269
|
+
return desc;
|
|
1270
|
+
proto = getPrototypeOf(proto);
|
|
1271
|
+
}
|
|
1272
|
+
return void 0;
|
|
1273
|
+
}
|
|
1274
|
+
function markChanged(state) {
|
|
1275
|
+
if (!state.modified_) {
|
|
1276
|
+
state.modified_ = true;
|
|
1277
|
+
if (state.parent_) {
|
|
1278
|
+
markChanged(state.parent_);
|
|
1279
|
+
}
|
|
1280
|
+
}
|
|
1281
|
+
}
|
|
1282
|
+
function prepareCopy(state) {
|
|
1283
|
+
if (!state.copy_) {
|
|
1284
|
+
state.copy_ = shallowCopy(
|
|
1285
|
+
state.base_,
|
|
1286
|
+
state.scope_.immer_.useStrictShallowCopy_
|
|
1287
|
+
);
|
|
1288
|
+
}
|
|
1289
|
+
}
|
|
1290
|
+
var Immer2 = class {
|
|
1291
|
+
constructor(config) {
|
|
1292
|
+
this.autoFreeze_ = true;
|
|
1293
|
+
this.useStrictShallowCopy_ = false;
|
|
1294
|
+
this.produce = (base, recipe, patchListener) => {
|
|
1295
|
+
if (typeof base === "function" && typeof recipe !== "function") {
|
|
1296
|
+
const defaultBase = recipe;
|
|
1297
|
+
recipe = base;
|
|
1298
|
+
const self = this;
|
|
1299
|
+
return function curriedProduce(base2 = defaultBase, ...args) {
|
|
1300
|
+
return self.produce(base2, (draft) => recipe.call(this, draft, ...args));
|
|
1301
|
+
};
|
|
1302
|
+
}
|
|
1303
|
+
if (typeof recipe !== "function")
|
|
1304
|
+
die(6);
|
|
1305
|
+
if (patchListener !== void 0 && typeof patchListener !== "function")
|
|
1306
|
+
die(7);
|
|
1307
|
+
let result;
|
|
1308
|
+
if (isDraftable(base)) {
|
|
1309
|
+
const scope = enterScope(this);
|
|
1310
|
+
const proxy = createProxy(base, void 0);
|
|
1311
|
+
let hasError = true;
|
|
1312
|
+
try {
|
|
1313
|
+
result = recipe(proxy);
|
|
1314
|
+
hasError = false;
|
|
1315
|
+
} finally {
|
|
1316
|
+
if (hasError)
|
|
1317
|
+
revokeScope(scope);
|
|
1318
|
+
else
|
|
1319
|
+
leaveScope(scope);
|
|
1320
|
+
}
|
|
1321
|
+
usePatchesInScope(scope, patchListener);
|
|
1322
|
+
return processResult(result, scope);
|
|
1323
|
+
} else if (!base || typeof base !== "object") {
|
|
1324
|
+
result = recipe(base);
|
|
1325
|
+
if (result === void 0)
|
|
1326
|
+
result = base;
|
|
1327
|
+
if (result === NOTHING)
|
|
1328
|
+
result = void 0;
|
|
1329
|
+
if (this.autoFreeze_)
|
|
1330
|
+
freeze(result, true);
|
|
1331
|
+
if (patchListener) {
|
|
1332
|
+
const p = [];
|
|
1333
|
+
const ip = [];
|
|
1334
|
+
getPlugin("Patches").generateReplacementPatches_(base, result, p, ip);
|
|
1335
|
+
patchListener(p, ip);
|
|
1336
|
+
}
|
|
1337
|
+
return result;
|
|
1338
|
+
} else
|
|
1339
|
+
die(1, base);
|
|
1340
|
+
};
|
|
1341
|
+
this.produceWithPatches = (base, recipe) => {
|
|
1342
|
+
if (typeof base === "function") {
|
|
1343
|
+
return (state, ...args) => this.produceWithPatches(state, (draft) => base(draft, ...args));
|
|
1344
|
+
}
|
|
1345
|
+
let patches, inversePatches;
|
|
1346
|
+
const result = this.produce(base, recipe, (p, ip) => {
|
|
1347
|
+
patches = p;
|
|
1348
|
+
inversePatches = ip;
|
|
1349
|
+
});
|
|
1350
|
+
return [result, patches, inversePatches];
|
|
1351
|
+
};
|
|
1352
|
+
if (typeof config?.autoFreeze === "boolean")
|
|
1353
|
+
this.setAutoFreeze(config.autoFreeze);
|
|
1354
|
+
if (typeof config?.useStrictShallowCopy === "boolean")
|
|
1355
|
+
this.setUseStrictShallowCopy(config.useStrictShallowCopy);
|
|
1356
|
+
}
|
|
1357
|
+
createDraft(base) {
|
|
1358
|
+
if (!isDraftable(base))
|
|
1359
|
+
die(8);
|
|
1360
|
+
if (isDraft(base))
|
|
1361
|
+
base = current(base);
|
|
1362
|
+
const scope = enterScope(this);
|
|
1363
|
+
const proxy = createProxy(base, void 0);
|
|
1364
|
+
proxy[DRAFT_STATE].isManual_ = true;
|
|
1365
|
+
leaveScope(scope);
|
|
1366
|
+
return proxy;
|
|
1367
|
+
}
|
|
1368
|
+
finishDraft(draft, patchListener) {
|
|
1369
|
+
const state = draft && draft[DRAFT_STATE];
|
|
1370
|
+
if (!state || !state.isManual_)
|
|
1371
|
+
die(9);
|
|
1372
|
+
const { scope_: scope } = state;
|
|
1373
|
+
usePatchesInScope(scope, patchListener);
|
|
1374
|
+
return processResult(void 0, scope);
|
|
1375
|
+
}
|
|
1376
|
+
/**
|
|
1377
|
+
* Pass true to automatically freeze all copies created by Immer.
|
|
1378
|
+
*
|
|
1379
|
+
* By default, auto-freezing is enabled.
|
|
1380
|
+
*/
|
|
1381
|
+
setAutoFreeze(value) {
|
|
1382
|
+
this.autoFreeze_ = value;
|
|
1383
|
+
}
|
|
1384
|
+
/**
|
|
1385
|
+
* Pass true to enable strict shallow copy.
|
|
1386
|
+
*
|
|
1387
|
+
* By default, immer does not copy the object descriptors such as getter, setter and non-enumrable properties.
|
|
1388
|
+
*/
|
|
1389
|
+
setUseStrictShallowCopy(value) {
|
|
1390
|
+
this.useStrictShallowCopy_ = value;
|
|
1391
|
+
}
|
|
1392
|
+
applyPatches(base, patches) {
|
|
1393
|
+
let i;
|
|
1394
|
+
for (i = patches.length - 1; i >= 0; i--) {
|
|
1395
|
+
const patch = patches[i];
|
|
1396
|
+
if (patch.path.length === 0 && patch.op === "replace") {
|
|
1397
|
+
base = patch.value;
|
|
1398
|
+
break;
|
|
1399
|
+
}
|
|
1400
|
+
}
|
|
1401
|
+
if (i > -1) {
|
|
1402
|
+
patches = patches.slice(i + 1);
|
|
1403
|
+
}
|
|
1404
|
+
const applyPatchesImpl = getPlugin("Patches").applyPatches_;
|
|
1405
|
+
if (isDraft(base)) {
|
|
1406
|
+
return applyPatchesImpl(base, patches);
|
|
1407
|
+
}
|
|
1408
|
+
return this.produce(
|
|
1409
|
+
base,
|
|
1410
|
+
(draft) => applyPatchesImpl(draft, patches)
|
|
1411
|
+
);
|
|
1412
|
+
}
|
|
1413
|
+
};
|
|
1414
|
+
function createProxy(value, parent) {
|
|
1415
|
+
const draft = isMap(value) ? getPlugin("MapSet").proxyMap_(value, parent) : isSet(value) ? getPlugin("MapSet").proxySet_(value, parent) : createProxyProxy(value, parent);
|
|
1416
|
+
const scope = parent ? parent.scope_ : getCurrentScope();
|
|
1417
|
+
scope.drafts_.push(draft);
|
|
1418
|
+
return draft;
|
|
1419
|
+
}
|
|
1420
|
+
function current(value) {
|
|
1421
|
+
if (!isDraft(value))
|
|
1422
|
+
die(10, value);
|
|
1423
|
+
return currentImpl(value);
|
|
1424
|
+
}
|
|
1425
|
+
function currentImpl(value) {
|
|
1426
|
+
if (!isDraftable(value) || isFrozen(value))
|
|
1427
|
+
return value;
|
|
1428
|
+
const state = value[DRAFT_STATE];
|
|
1429
|
+
let copy;
|
|
1430
|
+
if (state) {
|
|
1431
|
+
if (!state.modified_)
|
|
1432
|
+
return state.base_;
|
|
1433
|
+
state.finalized_ = true;
|
|
1434
|
+
copy = shallowCopy(value, state.scope_.immer_.useStrictShallowCopy_);
|
|
1435
|
+
} else {
|
|
1436
|
+
copy = shallowCopy(value, true);
|
|
1437
|
+
}
|
|
1438
|
+
each(copy, (key, childValue) => {
|
|
1439
|
+
set(copy, key, currentImpl(childValue));
|
|
1440
|
+
});
|
|
1441
|
+
if (state) {
|
|
1442
|
+
state.finalized_ = false;
|
|
1443
|
+
}
|
|
1444
|
+
return copy;
|
|
1445
|
+
}
|
|
1446
|
+
var immer = new Immer2();
|
|
1447
|
+
var produce = immer.produce;
|
|
1448
|
+
var produceWithPatches = immer.produceWithPatches.bind(
|
|
1449
|
+
immer
|
|
1450
|
+
);
|
|
1451
|
+
var setAutoFreeze = immer.setAutoFreeze.bind(immer);
|
|
1452
|
+
var setUseStrictShallowCopy = immer.setUseStrictShallowCopy.bind(immer);
|
|
1453
|
+
var applyPatches = immer.applyPatches.bind(immer);
|
|
1454
|
+
var createDraft = immer.createDraft.bind(immer);
|
|
1455
|
+
var finishDraft = immer.finishDraft.bind(immer);
|
|
1456
|
+
|
|
1457
|
+
// ../interface-logic/node_modules/redux-thunk/dist/redux-thunk.mjs
|
|
1458
|
+
function createThunkMiddleware(extraArgument) {
|
|
1459
|
+
const middleware = ({ dispatch, getState }) => (next) => (action) => {
|
|
1460
|
+
if (typeof action === "function") {
|
|
1461
|
+
return action(dispatch, getState, extraArgument);
|
|
1462
|
+
}
|
|
1463
|
+
return next(action);
|
|
1464
|
+
};
|
|
1465
|
+
return middleware;
|
|
1466
|
+
}
|
|
1467
|
+
var thunk = createThunkMiddleware();
|
|
1468
|
+
var withExtraArgument = createThunkMiddleware;
|
|
1469
|
+
|
|
1470
|
+
// ../interface-logic/node_modules/@reduxjs/toolkit/dist/redux-toolkit.modern.mjs
|
|
1471
|
+
var composeWithDevTools = typeof window !== "undefined" && window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ ? window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ : function() {
|
|
1472
|
+
if (arguments.length === 0) return void 0;
|
|
1473
|
+
if (typeof arguments[0] === "object") return compose;
|
|
1474
|
+
return compose.apply(null, arguments);
|
|
1475
|
+
};
|
|
1476
|
+
var devToolsEnhancer = typeof window !== "undefined" && window.__REDUX_DEVTOOLS_EXTENSION__ ? window.__REDUX_DEVTOOLS_EXTENSION__ : function() {
|
|
1477
|
+
return function(noop3) {
|
|
1478
|
+
return noop3;
|
|
1479
|
+
};
|
|
1480
|
+
};
|
|
1481
|
+
var hasMatchFunction = (v) => {
|
|
1482
|
+
return v && typeof v.match === "function";
|
|
1483
|
+
};
|
|
1484
|
+
function createAction(type, prepareAction) {
|
|
1485
|
+
function actionCreator(...args) {
|
|
1486
|
+
if (prepareAction) {
|
|
1487
|
+
let prepared = prepareAction(...args);
|
|
1488
|
+
if (!prepared) {
|
|
1489
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage2(0) : "prepareAction did not return an object");
|
|
1490
|
+
}
|
|
1491
|
+
return {
|
|
1492
|
+
type,
|
|
1493
|
+
payload: prepared.payload,
|
|
1494
|
+
..."meta" in prepared && {
|
|
1495
|
+
meta: prepared.meta
|
|
1496
|
+
},
|
|
1497
|
+
..."error" in prepared && {
|
|
1498
|
+
error: prepared.error
|
|
1499
|
+
}
|
|
1500
|
+
};
|
|
1501
|
+
}
|
|
1502
|
+
return {
|
|
1503
|
+
type,
|
|
1504
|
+
payload: args[0]
|
|
1505
|
+
};
|
|
1506
|
+
}
|
|
1507
|
+
actionCreator.toString = () => `${type}`;
|
|
1508
|
+
actionCreator.type = type;
|
|
1509
|
+
actionCreator.match = (action) => isAction(action) && action.type === type;
|
|
1510
|
+
return actionCreator;
|
|
1511
|
+
}
|
|
1512
|
+
function isActionCreator(action) {
|
|
1513
|
+
return typeof action === "function" && "type" in action && // hasMatchFunction only wants Matchers but I don't see the point in rewriting it
|
|
1514
|
+
hasMatchFunction(action);
|
|
1515
|
+
}
|
|
1516
|
+
function getMessage(type) {
|
|
1517
|
+
const splitType = type ? `${type}`.split("/") : [];
|
|
1518
|
+
const actionName = splitType[splitType.length - 1] || "actionCreator";
|
|
1519
|
+
return `Detected an action creator with type "${type || "unknown"}" being dispatched.
|
|
1520
|
+
Make sure you're calling the action creator before dispatching, i.e. \`dispatch(${actionName}())\` instead of \`dispatch(${actionName})\`. This is necessary even if the action has no payload.`;
|
|
1521
|
+
}
|
|
1522
|
+
function createActionCreatorInvariantMiddleware(options = {}) {
|
|
1523
|
+
if (process.env.NODE_ENV === "production") {
|
|
1524
|
+
return () => (next) => (action) => next(action);
|
|
1525
|
+
}
|
|
1526
|
+
const {
|
|
1527
|
+
isActionCreator: isActionCreator2 = isActionCreator
|
|
1528
|
+
} = options;
|
|
1529
|
+
return () => (next) => (action) => {
|
|
1530
|
+
if (isActionCreator2(action)) {
|
|
1531
|
+
console.warn(getMessage(action.type));
|
|
1532
|
+
}
|
|
1533
|
+
return next(action);
|
|
1534
|
+
};
|
|
1535
|
+
}
|
|
1536
|
+
function getTimeMeasureUtils(maxDelay, fnName) {
|
|
1537
|
+
let elapsed = 0;
|
|
1538
|
+
return {
|
|
1539
|
+
measureTime(fn) {
|
|
1540
|
+
const started = Date.now();
|
|
1541
|
+
try {
|
|
1542
|
+
return fn();
|
|
1543
|
+
} finally {
|
|
1544
|
+
const finished = Date.now();
|
|
1545
|
+
elapsed += finished - started;
|
|
1546
|
+
}
|
|
1547
|
+
},
|
|
1548
|
+
warnIfExceeded() {
|
|
1549
|
+
if (elapsed > maxDelay) {
|
|
1550
|
+
console.warn(`${fnName} took ${elapsed}ms, which is more than the warning threshold of ${maxDelay}ms.
|
|
1551
|
+
If your state or actions are very large, you may want to disable the middleware as it might cause too much of a slowdown in development mode. See https://redux-toolkit.js.org/api/getDefaultMiddleware for instructions.
|
|
1552
|
+
It is disabled in production builds, so you don't need to worry about that.`);
|
|
1553
|
+
}
|
|
1554
|
+
}
|
|
1555
|
+
};
|
|
1556
|
+
}
|
|
1557
|
+
var Tuple = class _Tuple extends Array {
|
|
1558
|
+
constructor(...items) {
|
|
1559
|
+
super(...items);
|
|
1560
|
+
Object.setPrototypeOf(this, _Tuple.prototype);
|
|
1561
|
+
}
|
|
1562
|
+
static get [Symbol.species]() {
|
|
1563
|
+
return _Tuple;
|
|
1564
|
+
}
|
|
1565
|
+
concat(...arr) {
|
|
1566
|
+
return super.concat.apply(this, arr);
|
|
1567
|
+
}
|
|
1568
|
+
prepend(...arr) {
|
|
1569
|
+
if (arr.length === 1 && Array.isArray(arr[0])) {
|
|
1570
|
+
return new _Tuple(...arr[0].concat(this));
|
|
1571
|
+
}
|
|
1572
|
+
return new _Tuple(...arr.concat(this));
|
|
1573
|
+
}
|
|
1574
|
+
};
|
|
1575
|
+
function freezeDraftable(val) {
|
|
1576
|
+
return isDraftable(val) ? produce(val, () => {
|
|
1577
|
+
}) : val;
|
|
1578
|
+
}
|
|
1579
|
+
function getOrInsertComputed(map, key, compute) {
|
|
1580
|
+
if (map.has(key)) return map.get(key);
|
|
1581
|
+
return map.set(key, compute(key)).get(key);
|
|
1582
|
+
}
|
|
1583
|
+
function isImmutableDefault(value) {
|
|
1584
|
+
return typeof value !== "object" || value == null || Object.isFrozen(value);
|
|
1585
|
+
}
|
|
1586
|
+
function trackForMutations(isImmutable, ignorePaths, obj) {
|
|
1587
|
+
const trackedProperties = trackProperties(isImmutable, ignorePaths, obj);
|
|
1588
|
+
return {
|
|
1589
|
+
detectMutations() {
|
|
1590
|
+
return detectMutations(isImmutable, ignorePaths, trackedProperties, obj);
|
|
1591
|
+
}
|
|
1592
|
+
};
|
|
1593
|
+
}
|
|
1594
|
+
function trackProperties(isImmutable, ignorePaths = [], obj, path = "", checkedObjects = /* @__PURE__ */ new Set()) {
|
|
1595
|
+
const tracked = {
|
|
1596
|
+
value: obj
|
|
1597
|
+
};
|
|
1598
|
+
if (!isImmutable(obj) && !checkedObjects.has(obj)) {
|
|
1599
|
+
checkedObjects.add(obj);
|
|
1600
|
+
tracked.children = {};
|
|
1601
|
+
for (const key in obj) {
|
|
1602
|
+
const childPath = path ? path + "." + key : key;
|
|
1603
|
+
if (ignorePaths.length && ignorePaths.indexOf(childPath) !== -1) {
|
|
1604
|
+
continue;
|
|
1605
|
+
}
|
|
1606
|
+
tracked.children[key] = trackProperties(isImmutable, ignorePaths, obj[key], childPath);
|
|
1607
|
+
}
|
|
1608
|
+
}
|
|
1609
|
+
return tracked;
|
|
1610
|
+
}
|
|
1611
|
+
function detectMutations(isImmutable, ignoredPaths = [], trackedProperty, obj, sameParentRef = false, path = "") {
|
|
1612
|
+
const prevObj = trackedProperty ? trackedProperty.value : void 0;
|
|
1613
|
+
const sameRef = prevObj === obj;
|
|
1614
|
+
if (sameParentRef && !sameRef && !Number.isNaN(obj)) {
|
|
1615
|
+
return {
|
|
1616
|
+
wasMutated: true,
|
|
1617
|
+
path
|
|
1618
|
+
};
|
|
1619
|
+
}
|
|
1620
|
+
if (isImmutable(prevObj) || isImmutable(obj)) {
|
|
1621
|
+
return {
|
|
1622
|
+
wasMutated: false
|
|
1623
|
+
};
|
|
1624
|
+
}
|
|
1625
|
+
const keysToDetect = {};
|
|
1626
|
+
for (let key in trackedProperty.children) {
|
|
1627
|
+
keysToDetect[key] = true;
|
|
1628
|
+
}
|
|
1629
|
+
for (let key in obj) {
|
|
1630
|
+
keysToDetect[key] = true;
|
|
1631
|
+
}
|
|
1632
|
+
const hasIgnoredPaths = ignoredPaths.length > 0;
|
|
1633
|
+
for (let key in keysToDetect) {
|
|
1634
|
+
const nestedPath = path ? path + "." + key : key;
|
|
1635
|
+
if (hasIgnoredPaths) {
|
|
1636
|
+
const hasMatches = ignoredPaths.some((ignored) => {
|
|
1637
|
+
if (ignored instanceof RegExp) {
|
|
1638
|
+
return ignored.test(nestedPath);
|
|
1639
|
+
}
|
|
1640
|
+
return nestedPath === ignored;
|
|
1641
|
+
});
|
|
1642
|
+
if (hasMatches) {
|
|
1643
|
+
continue;
|
|
1644
|
+
}
|
|
1645
|
+
}
|
|
1646
|
+
const result = detectMutations(isImmutable, ignoredPaths, trackedProperty.children[key], obj[key], sameRef, nestedPath);
|
|
1647
|
+
if (result.wasMutated) {
|
|
1648
|
+
return result;
|
|
1649
|
+
}
|
|
1650
|
+
}
|
|
1651
|
+
return {
|
|
1652
|
+
wasMutated: false
|
|
1653
|
+
};
|
|
1654
|
+
}
|
|
1655
|
+
function createImmutableStateInvariantMiddleware(options = {}) {
|
|
1656
|
+
if (process.env.NODE_ENV === "production") {
|
|
1657
|
+
return () => (next) => (action) => next(action);
|
|
1658
|
+
} else {
|
|
1659
|
+
let stringify2 = function(obj, serializer, indent, decycler) {
|
|
1660
|
+
return JSON.stringify(obj, getSerialize2(serializer, decycler), indent);
|
|
1661
|
+
}, getSerialize2 = function(serializer, decycler) {
|
|
1662
|
+
let stack = [], keys = [];
|
|
1663
|
+
if (!decycler) decycler = function(_, value) {
|
|
1664
|
+
if (stack[0] === value) return "[Circular ~]";
|
|
1665
|
+
return "[Circular ~." + keys.slice(0, stack.indexOf(value)).join(".") + "]";
|
|
1666
|
+
};
|
|
1667
|
+
return function(key, value) {
|
|
1668
|
+
if (stack.length > 0) {
|
|
1669
|
+
var thisPos = stack.indexOf(this);
|
|
1670
|
+
~thisPos ? stack.splice(thisPos + 1) : stack.push(this);
|
|
1671
|
+
~thisPos ? keys.splice(thisPos, Infinity, key) : keys.push(key);
|
|
1672
|
+
if (~stack.indexOf(value)) value = decycler.call(this, key, value);
|
|
1673
|
+
} else stack.push(value);
|
|
1674
|
+
return serializer == null ? value : serializer.call(this, key, value);
|
|
1675
|
+
};
|
|
1676
|
+
};
|
|
1677
|
+
var stringify = stringify2, getSerialize = getSerialize2;
|
|
1678
|
+
let {
|
|
1679
|
+
isImmutable = isImmutableDefault,
|
|
1680
|
+
ignoredPaths,
|
|
1681
|
+
warnAfter = 32
|
|
1682
|
+
} = options;
|
|
1683
|
+
const track = trackForMutations.bind(null, isImmutable, ignoredPaths);
|
|
1684
|
+
return ({
|
|
1685
|
+
getState
|
|
1686
|
+
}) => {
|
|
1687
|
+
let state = getState();
|
|
1688
|
+
let tracker = track(state);
|
|
1689
|
+
let result;
|
|
1690
|
+
return (next) => (action) => {
|
|
1691
|
+
const measureUtils = getTimeMeasureUtils(warnAfter, "ImmutableStateInvariantMiddleware");
|
|
1692
|
+
measureUtils.measureTime(() => {
|
|
1693
|
+
state = getState();
|
|
1694
|
+
result = tracker.detectMutations();
|
|
1695
|
+
tracker = track(state);
|
|
1696
|
+
if (result.wasMutated) {
|
|
1697
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage2(19) : `A state mutation was detected between dispatches, in the path '${result.path || ""}'. This may cause incorrect behavior. (https://redux.js.org/style-guide/style-guide#do-not-mutate-state)`);
|
|
1698
|
+
}
|
|
1699
|
+
});
|
|
1700
|
+
const dispatchedAction = next(action);
|
|
1701
|
+
measureUtils.measureTime(() => {
|
|
1702
|
+
state = getState();
|
|
1703
|
+
result = tracker.detectMutations();
|
|
1704
|
+
tracker = track(state);
|
|
1705
|
+
if (result.wasMutated) {
|
|
1706
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage2(20) : `A state mutation was detected inside a dispatch, in the path: ${result.path || ""}. Take a look at the reducer(s) handling the action ${stringify2(action)}. (https://redux.js.org/style-guide/style-guide#do-not-mutate-state)`);
|
|
1707
|
+
}
|
|
1708
|
+
});
|
|
1709
|
+
measureUtils.warnIfExceeded();
|
|
1710
|
+
return dispatchedAction;
|
|
1711
|
+
};
|
|
1712
|
+
};
|
|
1713
|
+
}
|
|
1714
|
+
}
|
|
1715
|
+
function isPlain(val) {
|
|
1716
|
+
const type = typeof val;
|
|
1717
|
+
return val == null || type === "string" || type === "boolean" || type === "number" || Array.isArray(val) || isPlainObject(val);
|
|
1718
|
+
}
|
|
1719
|
+
function findNonSerializableValue(value, path = "", isSerializable = isPlain, getEntries, ignoredPaths = [], cache) {
|
|
1720
|
+
let foundNestedSerializable;
|
|
1721
|
+
if (!isSerializable(value)) {
|
|
1722
|
+
return {
|
|
1723
|
+
keyPath: path || "<root>",
|
|
1724
|
+
value
|
|
1725
|
+
};
|
|
1726
|
+
}
|
|
1727
|
+
if (typeof value !== "object" || value === null) {
|
|
1728
|
+
return false;
|
|
1729
|
+
}
|
|
1730
|
+
if (cache?.has(value)) return false;
|
|
1731
|
+
const entries = getEntries != null ? getEntries(value) : Object.entries(value);
|
|
1732
|
+
const hasIgnoredPaths = ignoredPaths.length > 0;
|
|
1733
|
+
for (const [key, nestedValue] of entries) {
|
|
1734
|
+
const nestedPath = path ? path + "." + key : key;
|
|
1735
|
+
if (hasIgnoredPaths) {
|
|
1736
|
+
const hasMatches = ignoredPaths.some((ignored) => {
|
|
1737
|
+
if (ignored instanceof RegExp) {
|
|
1738
|
+
return ignored.test(nestedPath);
|
|
1739
|
+
}
|
|
1740
|
+
return nestedPath === ignored;
|
|
1741
|
+
});
|
|
1742
|
+
if (hasMatches) {
|
|
1743
|
+
continue;
|
|
1744
|
+
}
|
|
1745
|
+
}
|
|
1746
|
+
if (!isSerializable(nestedValue)) {
|
|
1747
|
+
return {
|
|
1748
|
+
keyPath: nestedPath,
|
|
1749
|
+
value: nestedValue
|
|
1750
|
+
};
|
|
1751
|
+
}
|
|
1752
|
+
if (typeof nestedValue === "object") {
|
|
1753
|
+
foundNestedSerializable = findNonSerializableValue(nestedValue, nestedPath, isSerializable, getEntries, ignoredPaths, cache);
|
|
1754
|
+
if (foundNestedSerializable) {
|
|
1755
|
+
return foundNestedSerializable;
|
|
1756
|
+
}
|
|
1757
|
+
}
|
|
1758
|
+
}
|
|
1759
|
+
if (cache && isNestedFrozen(value)) cache.add(value);
|
|
1760
|
+
return false;
|
|
1761
|
+
}
|
|
1762
|
+
function isNestedFrozen(value) {
|
|
1763
|
+
if (!Object.isFrozen(value)) return false;
|
|
1764
|
+
for (const nestedValue of Object.values(value)) {
|
|
1765
|
+
if (typeof nestedValue !== "object" || nestedValue === null) continue;
|
|
1766
|
+
if (!isNestedFrozen(nestedValue)) return false;
|
|
1767
|
+
}
|
|
1768
|
+
return true;
|
|
1769
|
+
}
|
|
1770
|
+
function createSerializableStateInvariantMiddleware(options = {}) {
|
|
1771
|
+
if (process.env.NODE_ENV === "production") {
|
|
1772
|
+
return () => (next) => (action) => next(action);
|
|
1773
|
+
} else {
|
|
1774
|
+
const {
|
|
1775
|
+
isSerializable = isPlain,
|
|
1776
|
+
getEntries,
|
|
1777
|
+
ignoredActions = [],
|
|
1778
|
+
ignoredActionPaths = ["meta.arg", "meta.baseQueryMeta"],
|
|
1779
|
+
ignoredPaths = [],
|
|
1780
|
+
warnAfter = 32,
|
|
1781
|
+
ignoreState = false,
|
|
1782
|
+
ignoreActions = false,
|
|
1783
|
+
disableCache = false
|
|
1784
|
+
} = options;
|
|
1785
|
+
const cache = !disableCache && WeakSet ? /* @__PURE__ */ new WeakSet() : void 0;
|
|
1786
|
+
return (storeAPI) => (next) => (action) => {
|
|
1787
|
+
if (!isAction(action)) {
|
|
1788
|
+
return next(action);
|
|
1789
|
+
}
|
|
1790
|
+
const result = next(action);
|
|
1791
|
+
const measureUtils = getTimeMeasureUtils(warnAfter, "SerializableStateInvariantMiddleware");
|
|
1792
|
+
if (!ignoreActions && !(ignoredActions.length && ignoredActions.indexOf(action.type) !== -1)) {
|
|
1793
|
+
measureUtils.measureTime(() => {
|
|
1794
|
+
const foundActionNonSerializableValue = findNonSerializableValue(action, "", isSerializable, getEntries, ignoredActionPaths, cache);
|
|
1795
|
+
if (foundActionNonSerializableValue) {
|
|
1796
|
+
const {
|
|
1797
|
+
keyPath,
|
|
1798
|
+
value
|
|
1799
|
+
} = foundActionNonSerializableValue;
|
|
1800
|
+
console.error(`A non-serializable value was detected in an action, in the path: \`${keyPath}\`. Value:`, value, "\nTake a look at the logic that dispatched this action: ", action, "\n(See https://redux.js.org/faq/actions#why-should-type-be-a-string-or-at-least-serializable-why-should-my-action-types-be-constants)", "\n(To allow non-serializable values see: https://redux-toolkit.js.org/usage/usage-guide#working-with-non-serializable-data)");
|
|
1801
|
+
}
|
|
1802
|
+
});
|
|
1803
|
+
}
|
|
1804
|
+
if (!ignoreState) {
|
|
1805
|
+
measureUtils.measureTime(() => {
|
|
1806
|
+
const state = storeAPI.getState();
|
|
1807
|
+
const foundStateNonSerializableValue = findNonSerializableValue(state, "", isSerializable, getEntries, ignoredPaths, cache);
|
|
1808
|
+
if (foundStateNonSerializableValue) {
|
|
1809
|
+
const {
|
|
1810
|
+
keyPath,
|
|
1811
|
+
value
|
|
1812
|
+
} = foundStateNonSerializableValue;
|
|
1813
|
+
console.error(`A non-serializable value was detected in the state, in the path: \`${keyPath}\`. Value:`, value, `
|
|
1814
|
+
Take a look at the reducer(s) handling this action type: ${action.type}.
|
|
1815
|
+
(See https://redux.js.org/faq/organizing-state#can-i-put-functions-promises-or-other-non-serializable-items-in-my-store-state)`);
|
|
1816
|
+
}
|
|
1817
|
+
});
|
|
1818
|
+
measureUtils.warnIfExceeded();
|
|
1819
|
+
}
|
|
1820
|
+
return result;
|
|
1821
|
+
};
|
|
1822
|
+
}
|
|
1823
|
+
}
|
|
1824
|
+
function isBoolean(x) {
|
|
1825
|
+
return typeof x === "boolean";
|
|
1826
|
+
}
|
|
1827
|
+
var buildGetDefaultMiddleware = () => function getDefaultMiddleware(options) {
|
|
1828
|
+
const {
|
|
1829
|
+
thunk: thunk2 = true,
|
|
1830
|
+
immutableCheck = true,
|
|
1831
|
+
serializableCheck = true,
|
|
1832
|
+
actionCreatorCheck = true
|
|
1833
|
+
} = options ?? {};
|
|
1834
|
+
let middlewareArray = new Tuple();
|
|
1835
|
+
if (thunk2) {
|
|
1836
|
+
if (isBoolean(thunk2)) {
|
|
1837
|
+
middlewareArray.push(thunk);
|
|
1838
|
+
} else {
|
|
1839
|
+
middlewareArray.push(withExtraArgument(thunk2.extraArgument));
|
|
1840
|
+
}
|
|
1841
|
+
}
|
|
1842
|
+
if (process.env.NODE_ENV !== "production") {
|
|
1843
|
+
if (immutableCheck) {
|
|
1844
|
+
let immutableOptions = {};
|
|
1845
|
+
if (!isBoolean(immutableCheck)) {
|
|
1846
|
+
immutableOptions = immutableCheck;
|
|
1847
|
+
}
|
|
1848
|
+
middlewareArray.unshift(createImmutableStateInvariantMiddleware(immutableOptions));
|
|
1849
|
+
}
|
|
1850
|
+
if (serializableCheck) {
|
|
1851
|
+
let serializableOptions = {};
|
|
1852
|
+
if (!isBoolean(serializableCheck)) {
|
|
1853
|
+
serializableOptions = serializableCheck;
|
|
1854
|
+
}
|
|
1855
|
+
middlewareArray.push(createSerializableStateInvariantMiddleware(serializableOptions));
|
|
1856
|
+
}
|
|
1857
|
+
if (actionCreatorCheck) {
|
|
1858
|
+
let actionCreatorOptions = {};
|
|
1859
|
+
if (!isBoolean(actionCreatorCheck)) {
|
|
1860
|
+
actionCreatorOptions = actionCreatorCheck;
|
|
1861
|
+
}
|
|
1862
|
+
middlewareArray.unshift(createActionCreatorInvariantMiddleware(actionCreatorOptions));
|
|
1863
|
+
}
|
|
1864
|
+
}
|
|
1865
|
+
return middlewareArray;
|
|
1866
|
+
};
|
|
1867
|
+
var SHOULD_AUTOBATCH = "RTK_autoBatch";
|
|
1868
|
+
var createQueueWithTimer = (timeout) => {
|
|
1869
|
+
return (notify) => {
|
|
1870
|
+
setTimeout(notify, timeout);
|
|
1871
|
+
};
|
|
1872
|
+
};
|
|
1873
|
+
var autoBatchEnhancer = (options = {
|
|
1874
|
+
type: "raf"
|
|
1875
|
+
}) => (next) => (...args) => {
|
|
1876
|
+
const store = next(...args);
|
|
1877
|
+
let notifying = true;
|
|
1878
|
+
let shouldNotifyAtEndOfTick = false;
|
|
1879
|
+
let notificationQueued = false;
|
|
1880
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
1881
|
+
const queueCallback = options.type === "tick" ? queueMicrotask : options.type === "raf" ? (
|
|
1882
|
+
// requestAnimationFrame won't exist in SSR environments. Fall back to a vague approximation just to keep from erroring.
|
|
1883
|
+
typeof window !== "undefined" && window.requestAnimationFrame ? window.requestAnimationFrame : createQueueWithTimer(10)
|
|
1884
|
+
) : options.type === "callback" ? options.queueNotification : createQueueWithTimer(options.timeout);
|
|
1885
|
+
const notifyListeners = () => {
|
|
1886
|
+
notificationQueued = false;
|
|
1887
|
+
if (shouldNotifyAtEndOfTick) {
|
|
1888
|
+
shouldNotifyAtEndOfTick = false;
|
|
1889
|
+
listeners.forEach((l) => l());
|
|
1890
|
+
}
|
|
1891
|
+
};
|
|
1892
|
+
return Object.assign({}, store, {
|
|
1893
|
+
// Override the base `store.subscribe` method to keep original listeners
|
|
1894
|
+
// from running if we're delaying notifications
|
|
1895
|
+
subscribe(listener2) {
|
|
1896
|
+
const wrappedListener = () => notifying && listener2();
|
|
1897
|
+
const unsubscribe = store.subscribe(wrappedListener);
|
|
1898
|
+
listeners.add(listener2);
|
|
1899
|
+
return () => {
|
|
1900
|
+
unsubscribe();
|
|
1901
|
+
listeners.delete(listener2);
|
|
1902
|
+
};
|
|
1903
|
+
},
|
|
1904
|
+
// Override the base `store.dispatch` method so that we can check actions
|
|
1905
|
+
// for the `shouldAutoBatch` flag and determine if batching is active
|
|
1906
|
+
dispatch(action) {
|
|
1907
|
+
try {
|
|
1908
|
+
notifying = !action?.meta?.[SHOULD_AUTOBATCH];
|
|
1909
|
+
shouldNotifyAtEndOfTick = !notifying;
|
|
1910
|
+
if (shouldNotifyAtEndOfTick) {
|
|
1911
|
+
if (!notificationQueued) {
|
|
1912
|
+
notificationQueued = true;
|
|
1913
|
+
queueCallback(notifyListeners);
|
|
1914
|
+
}
|
|
1915
|
+
}
|
|
1916
|
+
return store.dispatch(action);
|
|
1917
|
+
} finally {
|
|
1918
|
+
notifying = true;
|
|
1919
|
+
}
|
|
1920
|
+
}
|
|
1921
|
+
});
|
|
1922
|
+
};
|
|
1923
|
+
var buildGetDefaultEnhancers = (middlewareEnhancer) => function getDefaultEnhancers(options) {
|
|
1924
|
+
const {
|
|
1925
|
+
autoBatch = true
|
|
1926
|
+
} = options ?? {};
|
|
1927
|
+
let enhancerArray = new Tuple(middlewareEnhancer);
|
|
1928
|
+
if (autoBatch) {
|
|
1929
|
+
enhancerArray.push(autoBatchEnhancer(typeof autoBatch === "object" ? autoBatch : void 0));
|
|
1930
|
+
}
|
|
1931
|
+
return enhancerArray;
|
|
1932
|
+
};
|
|
1933
|
+
function configureStore(options) {
|
|
1934
|
+
const getDefaultMiddleware = buildGetDefaultMiddleware();
|
|
1935
|
+
const {
|
|
1936
|
+
reducer = void 0,
|
|
1937
|
+
middleware,
|
|
1938
|
+
devTools = true,
|
|
1939
|
+
duplicateMiddlewareCheck = true,
|
|
1940
|
+
preloadedState = void 0,
|
|
1941
|
+
enhancers = void 0
|
|
1942
|
+
} = options || {};
|
|
1943
|
+
let rootReducer2;
|
|
1944
|
+
if (typeof reducer === "function") {
|
|
1945
|
+
rootReducer2 = reducer;
|
|
1946
|
+
} else if (isPlainObject(reducer)) {
|
|
1947
|
+
rootReducer2 = combineReducers(reducer);
|
|
1948
|
+
} else {
|
|
1949
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage2(1) : "`reducer` is a required argument, and must be a function or an object of functions that can be passed to combineReducers");
|
|
1950
|
+
}
|
|
1951
|
+
if (process.env.NODE_ENV !== "production" && middleware && typeof middleware !== "function") {
|
|
1952
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage2(2) : "`middleware` field must be a callback");
|
|
1953
|
+
}
|
|
1954
|
+
let finalMiddleware;
|
|
1955
|
+
if (typeof middleware === "function") {
|
|
1956
|
+
finalMiddleware = middleware(getDefaultMiddleware);
|
|
1957
|
+
if (process.env.NODE_ENV !== "production" && !Array.isArray(finalMiddleware)) {
|
|
1958
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage2(3) : "when using a middleware builder function, an array of middleware must be returned");
|
|
1959
|
+
}
|
|
1960
|
+
} else {
|
|
1961
|
+
finalMiddleware = getDefaultMiddleware();
|
|
1962
|
+
}
|
|
1963
|
+
if (process.env.NODE_ENV !== "production" && finalMiddleware.some((item) => typeof item !== "function")) {
|
|
1964
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage2(4) : "each middleware provided to configureStore must be a function");
|
|
1965
|
+
}
|
|
1966
|
+
if (process.env.NODE_ENV !== "production" && duplicateMiddlewareCheck) {
|
|
1967
|
+
let middlewareReferences = /* @__PURE__ */ new Set();
|
|
1968
|
+
finalMiddleware.forEach((middleware2) => {
|
|
1969
|
+
if (middlewareReferences.has(middleware2)) {
|
|
1970
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage2(42) : "Duplicate middleware references found when creating the store. Ensure that each middleware is only included once.");
|
|
1971
|
+
}
|
|
1972
|
+
middlewareReferences.add(middleware2);
|
|
1973
|
+
});
|
|
1974
|
+
}
|
|
1975
|
+
let finalCompose = compose;
|
|
1976
|
+
if (devTools) {
|
|
1977
|
+
finalCompose = composeWithDevTools({
|
|
1978
|
+
// Enable capture of stack traces for dispatched Redux actions
|
|
1979
|
+
trace: process.env.NODE_ENV !== "production",
|
|
1980
|
+
...typeof devTools === "object" && devTools
|
|
1981
|
+
});
|
|
1982
|
+
}
|
|
1983
|
+
const middlewareEnhancer = applyMiddleware(...finalMiddleware);
|
|
1984
|
+
const getDefaultEnhancers = buildGetDefaultEnhancers(middlewareEnhancer);
|
|
1985
|
+
if (process.env.NODE_ENV !== "production" && enhancers && typeof enhancers !== "function") {
|
|
1986
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage2(5) : "`enhancers` field must be a callback");
|
|
1987
|
+
}
|
|
1988
|
+
let storeEnhancers = typeof enhancers === "function" ? enhancers(getDefaultEnhancers) : getDefaultEnhancers();
|
|
1989
|
+
if (process.env.NODE_ENV !== "production" && !Array.isArray(storeEnhancers)) {
|
|
1990
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage2(6) : "`enhancers` callback must return an array");
|
|
1991
|
+
}
|
|
1992
|
+
if (process.env.NODE_ENV !== "production" && storeEnhancers.some((item) => typeof item !== "function")) {
|
|
1993
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage2(7) : "each enhancer provided to configureStore must be a function");
|
|
1994
|
+
}
|
|
1995
|
+
if (process.env.NODE_ENV !== "production" && finalMiddleware.length && !storeEnhancers.includes(middlewareEnhancer)) {
|
|
1996
|
+
console.error("middlewares were provided, but middleware enhancer was not included in final enhancers - make sure to call `getDefaultEnhancers`");
|
|
1997
|
+
}
|
|
1998
|
+
const composedEnhancer = finalCompose(...storeEnhancers);
|
|
1999
|
+
return createStore(rootReducer2, preloadedState, composedEnhancer);
|
|
2000
|
+
}
|
|
2001
|
+
function executeReducerBuilderCallback(builderCallback) {
|
|
2002
|
+
const actionsMap = {};
|
|
2003
|
+
const actionMatchers = [];
|
|
2004
|
+
let defaultCaseReducer;
|
|
2005
|
+
const builder = {
|
|
2006
|
+
addCase(typeOrActionCreator, reducer) {
|
|
2007
|
+
if (process.env.NODE_ENV !== "production") {
|
|
2008
|
+
if (actionMatchers.length > 0) {
|
|
2009
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage2(26) : "`builder.addCase` should only be called before calling `builder.addMatcher`");
|
|
2010
|
+
}
|
|
2011
|
+
if (defaultCaseReducer) {
|
|
2012
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage2(27) : "`builder.addCase` should only be called before calling `builder.addDefaultCase`");
|
|
2013
|
+
}
|
|
2014
|
+
}
|
|
2015
|
+
const type = typeof typeOrActionCreator === "string" ? typeOrActionCreator : typeOrActionCreator.type;
|
|
2016
|
+
if (!type) {
|
|
2017
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage2(28) : "`builder.addCase` cannot be called with an empty action type");
|
|
2018
|
+
}
|
|
2019
|
+
if (type in actionsMap) {
|
|
2020
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage2(29) : `\`builder.addCase\` cannot be called with two reducers for the same action type '${type}'`);
|
|
2021
|
+
}
|
|
2022
|
+
actionsMap[type] = reducer;
|
|
2023
|
+
return builder;
|
|
2024
|
+
},
|
|
2025
|
+
addMatcher(matcher, reducer) {
|
|
2026
|
+
if (process.env.NODE_ENV !== "production") {
|
|
2027
|
+
if (defaultCaseReducer) {
|
|
2028
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage2(30) : "`builder.addMatcher` should only be called before calling `builder.addDefaultCase`");
|
|
2029
|
+
}
|
|
2030
|
+
}
|
|
2031
|
+
actionMatchers.push({
|
|
2032
|
+
matcher,
|
|
2033
|
+
reducer
|
|
2034
|
+
});
|
|
2035
|
+
return builder;
|
|
2036
|
+
},
|
|
2037
|
+
addDefaultCase(reducer) {
|
|
2038
|
+
if (process.env.NODE_ENV !== "production") {
|
|
2039
|
+
if (defaultCaseReducer) {
|
|
2040
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage2(31) : "`builder.addDefaultCase` can only be called once");
|
|
2041
|
+
}
|
|
2042
|
+
}
|
|
2043
|
+
defaultCaseReducer = reducer;
|
|
2044
|
+
return builder;
|
|
2045
|
+
}
|
|
2046
|
+
};
|
|
2047
|
+
builderCallback(builder);
|
|
2048
|
+
return [actionsMap, actionMatchers, defaultCaseReducer];
|
|
2049
|
+
}
|
|
2050
|
+
function isStateFunction(x) {
|
|
2051
|
+
return typeof x === "function";
|
|
2052
|
+
}
|
|
2053
|
+
function createReducer(initialState10, mapOrBuilderCallback) {
|
|
2054
|
+
if (process.env.NODE_ENV !== "production") {
|
|
2055
|
+
if (typeof mapOrBuilderCallback === "object") {
|
|
2056
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage2(8) : "The object notation for `createReducer` has been removed. Please use the 'builder callback' notation instead: https://redux-toolkit.js.org/api/createReducer");
|
|
2057
|
+
}
|
|
2058
|
+
}
|
|
2059
|
+
let [actionsMap, finalActionMatchers, finalDefaultCaseReducer] = executeReducerBuilderCallback(mapOrBuilderCallback);
|
|
2060
|
+
let getInitialState;
|
|
2061
|
+
if (isStateFunction(initialState10)) {
|
|
2062
|
+
getInitialState = () => freezeDraftable(initialState10());
|
|
2063
|
+
} else {
|
|
2064
|
+
const frozenInitialState = freezeDraftable(initialState10);
|
|
2065
|
+
getInitialState = () => frozenInitialState;
|
|
2066
|
+
}
|
|
2067
|
+
function reducer(state = getInitialState(), action) {
|
|
2068
|
+
let caseReducers = [actionsMap[action.type], ...finalActionMatchers.filter(({
|
|
2069
|
+
matcher
|
|
2070
|
+
}) => matcher(action)).map(({
|
|
2071
|
+
reducer: reducer2
|
|
2072
|
+
}) => reducer2)];
|
|
2073
|
+
if (caseReducers.filter((cr) => !!cr).length === 0) {
|
|
2074
|
+
caseReducers = [finalDefaultCaseReducer];
|
|
2075
|
+
}
|
|
2076
|
+
return caseReducers.reduce((previousState, caseReducer) => {
|
|
2077
|
+
if (caseReducer) {
|
|
2078
|
+
if (isDraft(previousState)) {
|
|
2079
|
+
const draft = previousState;
|
|
2080
|
+
const result = caseReducer(draft, action);
|
|
2081
|
+
if (result === void 0) {
|
|
2082
|
+
return previousState;
|
|
2083
|
+
}
|
|
2084
|
+
return result;
|
|
2085
|
+
} else if (!isDraftable(previousState)) {
|
|
2086
|
+
const result = caseReducer(previousState, action);
|
|
2087
|
+
if (result === void 0) {
|
|
2088
|
+
if (previousState === null) {
|
|
2089
|
+
return previousState;
|
|
2090
|
+
}
|
|
2091
|
+
throw Error("A case reducer on a non-draftable value must not return undefined");
|
|
2092
|
+
}
|
|
2093
|
+
return result;
|
|
2094
|
+
} else {
|
|
2095
|
+
return produce(previousState, (draft) => {
|
|
2096
|
+
return caseReducer(draft, action);
|
|
2097
|
+
});
|
|
2098
|
+
}
|
|
2099
|
+
}
|
|
2100
|
+
return previousState;
|
|
2101
|
+
}, state);
|
|
2102
|
+
}
|
|
2103
|
+
reducer.getInitialState = getInitialState;
|
|
2104
|
+
return reducer;
|
|
2105
|
+
}
|
|
2106
|
+
var matches = (matcher, action) => {
|
|
2107
|
+
if (hasMatchFunction(matcher)) {
|
|
2108
|
+
return matcher.match(action);
|
|
2109
|
+
} else {
|
|
2110
|
+
return matcher(action);
|
|
2111
|
+
}
|
|
2112
|
+
};
|
|
2113
|
+
function isAnyOf(...matchers) {
|
|
2114
|
+
return (action) => {
|
|
2115
|
+
return matchers.some((matcher) => matches(matcher, action));
|
|
2116
|
+
};
|
|
2117
|
+
}
|
|
2118
|
+
var urlAlphabet = "ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW";
|
|
2119
|
+
var nanoid = (size = 21) => {
|
|
2120
|
+
let id = "";
|
|
2121
|
+
let i = size;
|
|
2122
|
+
while (i--) {
|
|
2123
|
+
id += urlAlphabet[Math.random() * 64 | 0];
|
|
2124
|
+
}
|
|
2125
|
+
return id;
|
|
2126
|
+
};
|
|
2127
|
+
var commonProperties = ["name", "message", "stack", "code"];
|
|
2128
|
+
var RejectWithValue = class {
|
|
2129
|
+
constructor(payload, meta) {
|
|
2130
|
+
this.payload = payload;
|
|
2131
|
+
this.meta = meta;
|
|
2132
|
+
}
|
|
2133
|
+
/*
|
|
2134
|
+
type-only property to distinguish between RejectWithValue and FulfillWithMeta
|
|
2135
|
+
does not exist at runtime
|
|
2136
|
+
*/
|
|
2137
|
+
_type;
|
|
2138
|
+
};
|
|
2139
|
+
var FulfillWithMeta = class {
|
|
2140
|
+
constructor(payload, meta) {
|
|
2141
|
+
this.payload = payload;
|
|
2142
|
+
this.meta = meta;
|
|
2143
|
+
}
|
|
2144
|
+
/*
|
|
2145
|
+
type-only property to distinguish between RejectWithValue and FulfillWithMeta
|
|
2146
|
+
does not exist at runtime
|
|
2147
|
+
*/
|
|
2148
|
+
_type;
|
|
2149
|
+
};
|
|
2150
|
+
var miniSerializeError = (value) => {
|
|
2151
|
+
if (typeof value === "object" && value !== null) {
|
|
2152
|
+
const simpleError = {};
|
|
2153
|
+
for (const property of commonProperties) {
|
|
2154
|
+
if (typeof value[property] === "string") {
|
|
2155
|
+
simpleError[property] = value[property];
|
|
2156
|
+
}
|
|
2157
|
+
}
|
|
2158
|
+
return simpleError;
|
|
2159
|
+
}
|
|
2160
|
+
return {
|
|
2161
|
+
message: String(value)
|
|
2162
|
+
};
|
|
2163
|
+
};
|
|
2164
|
+
var externalAbortMessage = "External signal was aborted";
|
|
2165
|
+
var createAsyncThunk = /* @__PURE__ */ (() => {
|
|
2166
|
+
function createAsyncThunk2(typePrefix, payloadCreator, options) {
|
|
2167
|
+
const fulfilled = createAction(typePrefix + "/fulfilled", (payload, requestId, arg, meta) => ({
|
|
2168
|
+
payload,
|
|
2169
|
+
meta: {
|
|
2170
|
+
...meta || {},
|
|
2171
|
+
arg,
|
|
2172
|
+
requestId,
|
|
2173
|
+
requestStatus: "fulfilled"
|
|
2174
|
+
}
|
|
2175
|
+
}));
|
|
2176
|
+
const pending = createAction(typePrefix + "/pending", (requestId, arg, meta) => ({
|
|
2177
|
+
payload: void 0,
|
|
2178
|
+
meta: {
|
|
2179
|
+
...meta || {},
|
|
2180
|
+
arg,
|
|
2181
|
+
requestId,
|
|
2182
|
+
requestStatus: "pending"
|
|
2183
|
+
}
|
|
2184
|
+
}));
|
|
2185
|
+
const rejected = createAction(typePrefix + "/rejected", (error, requestId, arg, payload, meta) => ({
|
|
2186
|
+
payload,
|
|
2187
|
+
error: (options && options.serializeError || miniSerializeError)(error || "Rejected"),
|
|
2188
|
+
meta: {
|
|
2189
|
+
...meta || {},
|
|
2190
|
+
arg,
|
|
2191
|
+
requestId,
|
|
2192
|
+
rejectedWithValue: !!payload,
|
|
2193
|
+
requestStatus: "rejected",
|
|
2194
|
+
aborted: error?.name === "AbortError",
|
|
2195
|
+
condition: error?.name === "ConditionError"
|
|
2196
|
+
}
|
|
2197
|
+
}));
|
|
2198
|
+
function actionCreator(arg, {
|
|
2199
|
+
signal
|
|
2200
|
+
} = {}) {
|
|
2201
|
+
return (dispatch, getState, extra) => {
|
|
2202
|
+
const requestId = options?.idGenerator ? options.idGenerator(arg) : nanoid();
|
|
2203
|
+
const abortController = new AbortController();
|
|
2204
|
+
let abortHandler;
|
|
2205
|
+
let abortReason;
|
|
2206
|
+
function abort(reason) {
|
|
2207
|
+
abortReason = reason;
|
|
2208
|
+
abortController.abort();
|
|
2209
|
+
}
|
|
2210
|
+
if (signal) {
|
|
2211
|
+
if (signal.aborted) {
|
|
2212
|
+
abort(externalAbortMessage);
|
|
2213
|
+
} else {
|
|
2214
|
+
signal.addEventListener("abort", () => abort(externalAbortMessage), {
|
|
2215
|
+
once: true
|
|
2216
|
+
});
|
|
2217
|
+
}
|
|
2218
|
+
}
|
|
2219
|
+
const promise = async function() {
|
|
2220
|
+
let finalAction;
|
|
2221
|
+
try {
|
|
2222
|
+
let conditionResult = options?.condition?.(arg, {
|
|
2223
|
+
getState,
|
|
2224
|
+
extra
|
|
2225
|
+
});
|
|
2226
|
+
if (isThenable(conditionResult)) {
|
|
2227
|
+
conditionResult = await conditionResult;
|
|
2228
|
+
}
|
|
2229
|
+
if (conditionResult === false || abortController.signal.aborted) {
|
|
2230
|
+
throw {
|
|
2231
|
+
name: "ConditionError",
|
|
2232
|
+
message: "Aborted due to condition callback returning false."
|
|
2233
|
+
};
|
|
2234
|
+
}
|
|
2235
|
+
const abortedPromise = new Promise((_, reject) => {
|
|
2236
|
+
abortHandler = () => {
|
|
2237
|
+
reject({
|
|
2238
|
+
name: "AbortError",
|
|
2239
|
+
message: abortReason || "Aborted"
|
|
2240
|
+
});
|
|
2241
|
+
};
|
|
2242
|
+
abortController.signal.addEventListener("abort", abortHandler);
|
|
2243
|
+
});
|
|
2244
|
+
dispatch(pending(requestId, arg, options?.getPendingMeta?.({
|
|
2245
|
+
requestId,
|
|
2246
|
+
arg
|
|
2247
|
+
}, {
|
|
2248
|
+
getState,
|
|
2249
|
+
extra
|
|
2250
|
+
})));
|
|
2251
|
+
finalAction = await Promise.race([abortedPromise, Promise.resolve(payloadCreator(arg, {
|
|
2252
|
+
dispatch,
|
|
2253
|
+
getState,
|
|
2254
|
+
extra,
|
|
2255
|
+
requestId,
|
|
2256
|
+
signal: abortController.signal,
|
|
2257
|
+
abort,
|
|
2258
|
+
rejectWithValue: (value, meta) => {
|
|
2259
|
+
return new RejectWithValue(value, meta);
|
|
2260
|
+
},
|
|
2261
|
+
fulfillWithValue: (value, meta) => {
|
|
2262
|
+
return new FulfillWithMeta(value, meta);
|
|
2263
|
+
}
|
|
2264
|
+
})).then((result) => {
|
|
2265
|
+
if (result instanceof RejectWithValue) {
|
|
2266
|
+
throw result;
|
|
2267
|
+
}
|
|
2268
|
+
if (result instanceof FulfillWithMeta) {
|
|
2269
|
+
return fulfilled(result.payload, requestId, arg, result.meta);
|
|
2270
|
+
}
|
|
2271
|
+
return fulfilled(result, requestId, arg);
|
|
2272
|
+
})]);
|
|
2273
|
+
} catch (err) {
|
|
2274
|
+
finalAction = err instanceof RejectWithValue ? rejected(null, requestId, arg, err.payload, err.meta) : rejected(err, requestId, arg);
|
|
2275
|
+
} finally {
|
|
2276
|
+
if (abortHandler) {
|
|
2277
|
+
abortController.signal.removeEventListener("abort", abortHandler);
|
|
2278
|
+
}
|
|
2279
|
+
}
|
|
2280
|
+
const skipDispatch = options && !options.dispatchConditionRejection && rejected.match(finalAction) && finalAction.meta.condition;
|
|
2281
|
+
if (!skipDispatch) {
|
|
2282
|
+
dispatch(finalAction);
|
|
2283
|
+
}
|
|
2284
|
+
return finalAction;
|
|
2285
|
+
}();
|
|
2286
|
+
return Object.assign(promise, {
|
|
2287
|
+
abort,
|
|
2288
|
+
requestId,
|
|
2289
|
+
arg,
|
|
2290
|
+
unwrap() {
|
|
2291
|
+
return promise.then(unwrapResult);
|
|
2292
|
+
}
|
|
2293
|
+
});
|
|
2294
|
+
};
|
|
2295
|
+
}
|
|
2296
|
+
return Object.assign(actionCreator, {
|
|
2297
|
+
pending,
|
|
2298
|
+
rejected,
|
|
2299
|
+
fulfilled,
|
|
2300
|
+
settled: isAnyOf(rejected, fulfilled),
|
|
2301
|
+
typePrefix
|
|
2302
|
+
});
|
|
2303
|
+
}
|
|
2304
|
+
createAsyncThunk2.withTypes = () => createAsyncThunk2;
|
|
2305
|
+
return createAsyncThunk2;
|
|
2306
|
+
})();
|
|
2307
|
+
function unwrapResult(action) {
|
|
2308
|
+
if (action.meta && action.meta.rejectedWithValue) {
|
|
2309
|
+
throw action.payload;
|
|
2310
|
+
}
|
|
2311
|
+
if (action.error) {
|
|
2312
|
+
throw action.error;
|
|
2313
|
+
}
|
|
2314
|
+
return action.payload;
|
|
2315
|
+
}
|
|
2316
|
+
function isThenable(value) {
|
|
2317
|
+
return value !== null && typeof value === "object" && typeof value.then === "function";
|
|
2318
|
+
}
|
|
2319
|
+
var asyncThunkSymbol = /* @__PURE__ */ Symbol.for("rtk-slice-createasyncthunk");
|
|
2320
|
+
var asyncThunkCreator = {
|
|
2321
|
+
[asyncThunkSymbol]: createAsyncThunk
|
|
2322
|
+
};
|
|
2323
|
+
function getType(slice, actionKey) {
|
|
2324
|
+
return `${slice}/${actionKey}`;
|
|
2325
|
+
}
|
|
2326
|
+
function buildCreateSlice({
|
|
2327
|
+
creators
|
|
2328
|
+
} = {}) {
|
|
2329
|
+
const cAT = creators?.asyncThunk?.[asyncThunkSymbol];
|
|
2330
|
+
return function createSlice2(options) {
|
|
2331
|
+
const {
|
|
2332
|
+
name,
|
|
2333
|
+
reducerPath = name
|
|
2334
|
+
} = options;
|
|
2335
|
+
if (!name) {
|
|
2336
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage2(11) : "`name` is a required option for createSlice");
|
|
2337
|
+
}
|
|
2338
|
+
if (typeof process !== "undefined" && process.env.NODE_ENV === "development") {
|
|
2339
|
+
if (options.initialState === void 0) {
|
|
2340
|
+
console.error("You must provide an `initialState` value that is not `undefined`. You may have misspelled `initialState`");
|
|
2341
|
+
}
|
|
2342
|
+
}
|
|
2343
|
+
const reducers = (typeof options.reducers === "function" ? options.reducers(buildReducerCreators()) : options.reducers) || {};
|
|
2344
|
+
const reducerNames = Object.keys(reducers);
|
|
2345
|
+
const context = {
|
|
2346
|
+
sliceCaseReducersByName: {},
|
|
2347
|
+
sliceCaseReducersByType: {},
|
|
2348
|
+
actionCreators: {},
|
|
2349
|
+
sliceMatchers: []
|
|
2350
|
+
};
|
|
2351
|
+
const contextMethods = {
|
|
2352
|
+
addCase(typeOrActionCreator, reducer2) {
|
|
2353
|
+
const type = typeof typeOrActionCreator === "string" ? typeOrActionCreator : typeOrActionCreator.type;
|
|
2354
|
+
if (!type) {
|
|
2355
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage2(12) : "`context.addCase` cannot be called with an empty action type");
|
|
2356
|
+
}
|
|
2357
|
+
if (type in context.sliceCaseReducersByType) {
|
|
2358
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage2(13) : "`context.addCase` cannot be called with two reducers for the same action type: " + type);
|
|
2359
|
+
}
|
|
2360
|
+
context.sliceCaseReducersByType[type] = reducer2;
|
|
2361
|
+
return contextMethods;
|
|
2362
|
+
},
|
|
2363
|
+
addMatcher(matcher, reducer2) {
|
|
2364
|
+
context.sliceMatchers.push({
|
|
2365
|
+
matcher,
|
|
2366
|
+
reducer: reducer2
|
|
2367
|
+
});
|
|
2368
|
+
return contextMethods;
|
|
2369
|
+
},
|
|
2370
|
+
exposeAction(name2, actionCreator) {
|
|
2371
|
+
context.actionCreators[name2] = actionCreator;
|
|
2372
|
+
return contextMethods;
|
|
2373
|
+
},
|
|
2374
|
+
exposeCaseReducer(name2, reducer2) {
|
|
2375
|
+
context.sliceCaseReducersByName[name2] = reducer2;
|
|
2376
|
+
return contextMethods;
|
|
2377
|
+
}
|
|
2378
|
+
};
|
|
2379
|
+
reducerNames.forEach((reducerName) => {
|
|
2380
|
+
const reducerDefinition = reducers[reducerName];
|
|
2381
|
+
const reducerDetails = {
|
|
2382
|
+
reducerName,
|
|
2383
|
+
type: getType(name, reducerName),
|
|
2384
|
+
createNotation: typeof options.reducers === "function"
|
|
2385
|
+
};
|
|
2386
|
+
if (isAsyncThunkSliceReducerDefinition(reducerDefinition)) {
|
|
2387
|
+
handleThunkCaseReducerDefinition(reducerDetails, reducerDefinition, contextMethods, cAT);
|
|
2388
|
+
} else {
|
|
2389
|
+
handleNormalReducerDefinition(reducerDetails, reducerDefinition, contextMethods);
|
|
2390
|
+
}
|
|
2391
|
+
});
|
|
2392
|
+
function buildReducer() {
|
|
2393
|
+
if (process.env.NODE_ENV !== "production") {
|
|
2394
|
+
if (typeof options.extraReducers === "object") {
|
|
2395
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage2(14) : "The object notation for `createSlice.extraReducers` has been removed. Please use the 'builder callback' notation instead: https://redux-toolkit.js.org/api/createSlice");
|
|
2396
|
+
}
|
|
2397
|
+
}
|
|
2398
|
+
const [extraReducers = {}, actionMatchers = [], defaultCaseReducer = void 0] = typeof options.extraReducers === "function" ? executeReducerBuilderCallback(options.extraReducers) : [options.extraReducers];
|
|
2399
|
+
const finalCaseReducers = {
|
|
2400
|
+
...extraReducers,
|
|
2401
|
+
...context.sliceCaseReducersByType
|
|
2402
|
+
};
|
|
2403
|
+
return createReducer(options.initialState, (builder) => {
|
|
2404
|
+
for (let key in finalCaseReducers) {
|
|
2405
|
+
builder.addCase(key, finalCaseReducers[key]);
|
|
2406
|
+
}
|
|
2407
|
+
for (let sM of context.sliceMatchers) {
|
|
2408
|
+
builder.addMatcher(sM.matcher, sM.reducer);
|
|
2409
|
+
}
|
|
2410
|
+
for (let m of actionMatchers) {
|
|
2411
|
+
builder.addMatcher(m.matcher, m.reducer);
|
|
2412
|
+
}
|
|
2413
|
+
if (defaultCaseReducer) {
|
|
2414
|
+
builder.addDefaultCase(defaultCaseReducer);
|
|
2415
|
+
}
|
|
2416
|
+
});
|
|
2417
|
+
}
|
|
2418
|
+
const selectSelf = (state) => state;
|
|
2419
|
+
const injectedSelectorCache = /* @__PURE__ */ new Map();
|
|
2420
|
+
const injectedStateCache = /* @__PURE__ */ new WeakMap();
|
|
2421
|
+
let _reducer;
|
|
2422
|
+
function reducer(state, action) {
|
|
2423
|
+
if (!_reducer) _reducer = buildReducer();
|
|
2424
|
+
return _reducer(state, action);
|
|
2425
|
+
}
|
|
2426
|
+
function getInitialState() {
|
|
2427
|
+
if (!_reducer) _reducer = buildReducer();
|
|
2428
|
+
return _reducer.getInitialState();
|
|
2429
|
+
}
|
|
2430
|
+
function makeSelectorProps(reducerPath2, injected = false) {
|
|
2431
|
+
function selectSlice(state) {
|
|
2432
|
+
let sliceState = state[reducerPath2];
|
|
2433
|
+
if (typeof sliceState === "undefined") {
|
|
2434
|
+
if (injected) {
|
|
2435
|
+
sliceState = getOrInsertComputed(injectedStateCache, selectSlice, getInitialState);
|
|
2436
|
+
} else if (process.env.NODE_ENV !== "production") {
|
|
2437
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage2(15) : "selectSlice returned undefined for an uninjected slice reducer");
|
|
2438
|
+
}
|
|
2439
|
+
}
|
|
2440
|
+
return sliceState;
|
|
2441
|
+
}
|
|
2442
|
+
function getSelectors(selectState = selectSelf) {
|
|
2443
|
+
const selectorCache = getOrInsertComputed(injectedSelectorCache, injected, () => /* @__PURE__ */ new WeakMap());
|
|
2444
|
+
return getOrInsertComputed(selectorCache, selectState, () => {
|
|
2445
|
+
const map = {};
|
|
2446
|
+
for (const [name2, selector] of Object.entries(options.selectors ?? {})) {
|
|
2447
|
+
map[name2] = wrapSelector(selector, selectState, () => getOrInsertComputed(injectedStateCache, selectState, getInitialState), injected);
|
|
2448
|
+
}
|
|
2449
|
+
return map;
|
|
2450
|
+
});
|
|
2451
|
+
}
|
|
2452
|
+
return {
|
|
2453
|
+
reducerPath: reducerPath2,
|
|
2454
|
+
getSelectors,
|
|
2455
|
+
get selectors() {
|
|
2456
|
+
return getSelectors(selectSlice);
|
|
2457
|
+
},
|
|
2458
|
+
selectSlice
|
|
2459
|
+
};
|
|
2460
|
+
}
|
|
2461
|
+
const slice = {
|
|
2462
|
+
name,
|
|
2463
|
+
reducer,
|
|
2464
|
+
actions: context.actionCreators,
|
|
2465
|
+
caseReducers: context.sliceCaseReducersByName,
|
|
2466
|
+
getInitialState,
|
|
2467
|
+
...makeSelectorProps(reducerPath),
|
|
2468
|
+
injectInto(injectable, {
|
|
2469
|
+
reducerPath: pathOpt,
|
|
2470
|
+
...config
|
|
2471
|
+
} = {}) {
|
|
2472
|
+
const newReducerPath = pathOpt ?? reducerPath;
|
|
2473
|
+
injectable.inject({
|
|
2474
|
+
reducerPath: newReducerPath,
|
|
2475
|
+
reducer
|
|
2476
|
+
}, config);
|
|
2477
|
+
return {
|
|
2478
|
+
...slice,
|
|
2479
|
+
...makeSelectorProps(newReducerPath, true)
|
|
2480
|
+
};
|
|
2481
|
+
}
|
|
2482
|
+
};
|
|
2483
|
+
return slice;
|
|
2484
|
+
};
|
|
2485
|
+
}
|
|
2486
|
+
function wrapSelector(selector, selectState, getInitialState, injected) {
|
|
2487
|
+
function wrapper(rootState, ...args) {
|
|
2488
|
+
let sliceState = selectState(rootState);
|
|
2489
|
+
if (typeof sliceState === "undefined") {
|
|
2490
|
+
if (injected) {
|
|
2491
|
+
sliceState = getInitialState();
|
|
2492
|
+
} else if (process.env.NODE_ENV !== "production") {
|
|
2493
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage2(16) : "selectState returned undefined for an uninjected slice reducer");
|
|
2494
|
+
}
|
|
2495
|
+
}
|
|
2496
|
+
return selector(sliceState, ...args);
|
|
2497
|
+
}
|
|
2498
|
+
wrapper.unwrapped = selector;
|
|
2499
|
+
return wrapper;
|
|
2500
|
+
}
|
|
2501
|
+
var createSlice = /* @__PURE__ */ buildCreateSlice();
|
|
2502
|
+
function buildReducerCreators() {
|
|
2503
|
+
function asyncThunk(payloadCreator, config) {
|
|
2504
|
+
return {
|
|
2505
|
+
_reducerDefinitionType: "asyncThunk",
|
|
2506
|
+
payloadCreator,
|
|
2507
|
+
...config
|
|
2508
|
+
};
|
|
2509
|
+
}
|
|
2510
|
+
asyncThunk.withTypes = () => asyncThunk;
|
|
2511
|
+
return {
|
|
2512
|
+
reducer(caseReducer) {
|
|
2513
|
+
return Object.assign({
|
|
2514
|
+
// hack so the wrapping function has the same name as the original
|
|
2515
|
+
// we need to create a wrapper so the `reducerDefinitionType` is not assigned to the original
|
|
2516
|
+
[caseReducer.name](...args) {
|
|
2517
|
+
return caseReducer(...args);
|
|
2518
|
+
}
|
|
2519
|
+
}[caseReducer.name], {
|
|
2520
|
+
_reducerDefinitionType: "reducer"
|
|
2521
|
+
/* reducer */
|
|
2522
|
+
});
|
|
2523
|
+
},
|
|
2524
|
+
preparedReducer(prepare, reducer) {
|
|
2525
|
+
return {
|
|
2526
|
+
_reducerDefinitionType: "reducerWithPrepare",
|
|
2527
|
+
prepare,
|
|
2528
|
+
reducer
|
|
2529
|
+
};
|
|
2530
|
+
},
|
|
2531
|
+
asyncThunk
|
|
2532
|
+
};
|
|
2533
|
+
}
|
|
2534
|
+
function handleNormalReducerDefinition({
|
|
2535
|
+
type,
|
|
2536
|
+
reducerName,
|
|
2537
|
+
createNotation
|
|
2538
|
+
}, maybeReducerWithPrepare, context) {
|
|
2539
|
+
let caseReducer;
|
|
2540
|
+
let prepareCallback;
|
|
2541
|
+
if ("reducer" in maybeReducerWithPrepare) {
|
|
2542
|
+
if (createNotation && !isCaseReducerWithPrepareDefinition(maybeReducerWithPrepare)) {
|
|
2543
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage2(17) : "Please use the `create.preparedReducer` notation for prepared action creators with the `create` notation.");
|
|
2544
|
+
}
|
|
2545
|
+
caseReducer = maybeReducerWithPrepare.reducer;
|
|
2546
|
+
prepareCallback = maybeReducerWithPrepare.prepare;
|
|
2547
|
+
} else {
|
|
2548
|
+
caseReducer = maybeReducerWithPrepare;
|
|
2549
|
+
}
|
|
2550
|
+
context.addCase(type, caseReducer).exposeCaseReducer(reducerName, caseReducer).exposeAction(reducerName, prepareCallback ? createAction(type, prepareCallback) : createAction(type));
|
|
2551
|
+
}
|
|
2552
|
+
function isAsyncThunkSliceReducerDefinition(reducerDefinition) {
|
|
2553
|
+
return reducerDefinition._reducerDefinitionType === "asyncThunk";
|
|
2554
|
+
}
|
|
2555
|
+
function isCaseReducerWithPrepareDefinition(reducerDefinition) {
|
|
2556
|
+
return reducerDefinition._reducerDefinitionType === "reducerWithPrepare";
|
|
2557
|
+
}
|
|
2558
|
+
function handleThunkCaseReducerDefinition({
|
|
2559
|
+
type,
|
|
2560
|
+
reducerName
|
|
2561
|
+
}, reducerDefinition, context, cAT) {
|
|
2562
|
+
if (!cAT) {
|
|
2563
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage2(18) : "Cannot use `create.asyncThunk` in the built-in `createSlice`. Use `buildCreateSlice({ creators: { asyncThunk: asyncThunkCreator } })` to create a customised version of `createSlice`.");
|
|
2564
|
+
}
|
|
2565
|
+
const {
|
|
2566
|
+
payloadCreator,
|
|
2567
|
+
fulfilled,
|
|
2568
|
+
pending,
|
|
2569
|
+
rejected,
|
|
2570
|
+
settled,
|
|
2571
|
+
options
|
|
2572
|
+
} = reducerDefinition;
|
|
2573
|
+
const thunk2 = cAT(type, payloadCreator, options);
|
|
2574
|
+
context.exposeAction(reducerName, thunk2);
|
|
2575
|
+
if (fulfilled) {
|
|
2576
|
+
context.addCase(thunk2.fulfilled, fulfilled);
|
|
2577
|
+
}
|
|
2578
|
+
if (pending) {
|
|
2579
|
+
context.addCase(thunk2.pending, pending);
|
|
2580
|
+
}
|
|
2581
|
+
if (rejected) {
|
|
2582
|
+
context.addCase(thunk2.rejected, rejected);
|
|
2583
|
+
}
|
|
2584
|
+
if (settled) {
|
|
2585
|
+
context.addMatcher(thunk2.settled, settled);
|
|
2586
|
+
}
|
|
2587
|
+
context.exposeCaseReducer(reducerName, {
|
|
2588
|
+
fulfilled: fulfilled || noop,
|
|
2589
|
+
pending: pending || noop,
|
|
2590
|
+
rejected: rejected || noop,
|
|
2591
|
+
settled: settled || noop
|
|
2592
|
+
});
|
|
2593
|
+
}
|
|
2594
|
+
function noop() {
|
|
2595
|
+
}
|
|
2596
|
+
var listener = "listener";
|
|
2597
|
+
var completed = "completed";
|
|
2598
|
+
var cancelled = "cancelled";
|
|
2599
|
+
var taskCancelled = `task-${cancelled}`;
|
|
2600
|
+
var taskCompleted = `task-${completed}`;
|
|
2601
|
+
var listenerCancelled = `${listener}-${cancelled}`;
|
|
2602
|
+
var listenerCompleted = `${listener}-${completed}`;
|
|
2603
|
+
var {
|
|
2604
|
+
assign
|
|
2605
|
+
} = Object;
|
|
2606
|
+
var alm = "listenerMiddleware";
|
|
2607
|
+
var addListener = /* @__PURE__ */ assign(/* @__PURE__ */ createAction(`${alm}/add`), {
|
|
2608
|
+
withTypes: () => addListener
|
|
2609
|
+
});
|
|
2610
|
+
var clearAllListeners = /* @__PURE__ */ createAction(`${alm}/removeAll`);
|
|
2611
|
+
var removeListener = /* @__PURE__ */ assign(/* @__PURE__ */ createAction(`${alm}/remove`), {
|
|
2612
|
+
withTypes: () => removeListener
|
|
2613
|
+
});
|
|
2614
|
+
var ORIGINAL_STATE = Symbol.for("rtk-state-proxy-original");
|
|
2615
|
+
function formatProdErrorMessage2(code) {
|
|
2616
|
+
return `Minified Redux Toolkit error #${code}; visit https://redux-toolkit.js.org/Errors?code=${code} for the full message or use the non-minified dev environment for full errors. `;
|
|
2617
|
+
}
|
|
2618
|
+
|
|
2619
|
+
// ../interface-logic/src/store/reducers/breadcrums-slice/index.ts
|
|
2620
|
+
var initialState = {
|
|
2621
|
+
breadCrumbs: []
|
|
2622
|
+
};
|
|
2623
|
+
var breadcrumbsSlice = createSlice({
|
|
2624
|
+
name: "breadcrumbs",
|
|
2625
|
+
initialState,
|
|
2626
|
+
reducers: {
|
|
2627
|
+
setBreadCrumbs: (state, action) => {
|
|
2628
|
+
state.breadCrumbs = [...state.breadCrumbs, action.payload];
|
|
2629
|
+
}
|
|
2630
|
+
}
|
|
2631
|
+
});
|
|
2632
|
+
var { setBreadCrumbs } = breadcrumbsSlice.actions;
|
|
2633
|
+
var selectBreadCrumbs = (state) => state.breadcrumbs;
|
|
2634
|
+
var breadcrums_slice_default = breadcrumbsSlice.reducer;
|
|
2635
|
+
|
|
2636
|
+
// ../interface-logic/src/store/reducers/env-slice/index.ts
|
|
2637
|
+
var initialState2 = {
|
|
2638
|
+
baseUrl: "",
|
|
2639
|
+
companies: [],
|
|
2640
|
+
user: {},
|
|
2641
|
+
db: "",
|
|
2642
|
+
refreshTokenEndpoint: "",
|
|
2643
|
+
config: null,
|
|
2644
|
+
envFile: null,
|
|
2645
|
+
requests: null,
|
|
2646
|
+
defaultCompany: {
|
|
2647
|
+
id: null,
|
|
2648
|
+
logo: "",
|
|
2649
|
+
secondary_color: "",
|
|
2650
|
+
primary_color: ""
|
|
2651
|
+
},
|
|
2652
|
+
context: {
|
|
2653
|
+
uid: null,
|
|
2654
|
+
allowed_company_ids: [],
|
|
2655
|
+
lang: "vi_VN",
|
|
2656
|
+
tz: "Asia/Saigon"
|
|
2657
|
+
}
|
|
2658
|
+
};
|
|
2659
|
+
var envSlice = createSlice({
|
|
2660
|
+
name: "env",
|
|
2661
|
+
initialState: initialState2,
|
|
2662
|
+
reducers: {
|
|
2663
|
+
setEnv: (state, action) => {
|
|
2664
|
+
Object.assign(state, action.payload);
|
|
2665
|
+
},
|
|
2666
|
+
setUid: (state, action) => {
|
|
2667
|
+
state.context.uid = action.payload;
|
|
2668
|
+
},
|
|
2669
|
+
setAllowCompanies: (state, action) => {
|
|
2670
|
+
state.context.allowed_company_ids = action.payload;
|
|
2671
|
+
},
|
|
2672
|
+
setCompanies: (state, action) => {
|
|
2673
|
+
state.companies = action.payload;
|
|
2674
|
+
},
|
|
2675
|
+
setDefaultCompany: (state, action) => {
|
|
2676
|
+
state.defaultCompany = action.payload;
|
|
2677
|
+
},
|
|
2678
|
+
setLang: (state, action) => {
|
|
2679
|
+
state.context.lang = action.payload;
|
|
2680
|
+
},
|
|
2681
|
+
setUser: (state, action) => {
|
|
2682
|
+
state.user = action.payload;
|
|
2683
|
+
},
|
|
2684
|
+
setConfig: (state, action) => {
|
|
2685
|
+
state.config = action.payload;
|
|
2686
|
+
},
|
|
2687
|
+
setEnvFile: (state, action) => {
|
|
2688
|
+
state.envFile = action.payload;
|
|
2689
|
+
}
|
|
2690
|
+
}
|
|
2691
|
+
});
|
|
2692
|
+
var {
|
|
2693
|
+
setEnv,
|
|
2694
|
+
setUid,
|
|
2695
|
+
setLang,
|
|
2696
|
+
setAllowCompanies,
|
|
2697
|
+
setCompanies,
|
|
2698
|
+
setDefaultCompany,
|
|
2699
|
+
setUser,
|
|
2700
|
+
setConfig,
|
|
2701
|
+
setEnvFile
|
|
2702
|
+
} = envSlice.actions;
|
|
2703
|
+
var selectEnv = (state) => state.env;
|
|
2704
|
+
var env_slice_default = envSlice.reducer;
|
|
2705
|
+
|
|
2706
|
+
// ../interface-logic/src/store/reducers/excel-slice/index.ts
|
|
2707
|
+
var initialState3 = {
|
|
2708
|
+
dataParse: null,
|
|
2709
|
+
idFile: null,
|
|
2710
|
+
isFileLoaded: false,
|
|
2711
|
+
loadingImport: false,
|
|
2712
|
+
selectedFile: null,
|
|
2713
|
+
errorData: null
|
|
2714
|
+
};
|
|
2715
|
+
var excelSlice = createSlice({
|
|
2716
|
+
name: "excel",
|
|
2717
|
+
initialState: initialState3,
|
|
2718
|
+
reducers: {
|
|
2719
|
+
setDataParse: (state, action) => {
|
|
2720
|
+
state.dataParse = action.payload;
|
|
2721
|
+
},
|
|
2722
|
+
setIdFile: (state, action) => {
|
|
2723
|
+
state.idFile = action.payload;
|
|
2724
|
+
},
|
|
2725
|
+
setIsFileLoaded: (state, action) => {
|
|
2726
|
+
state.isFileLoaded = action.payload;
|
|
2727
|
+
},
|
|
2728
|
+
setLoadingImport: (state, action) => {
|
|
2729
|
+
state.loadingImport = action.payload;
|
|
2730
|
+
},
|
|
2731
|
+
setSelectedFile: (state, action) => {
|
|
2732
|
+
state.selectedFile = action.payload;
|
|
2733
|
+
},
|
|
2734
|
+
setErrorData: (state, action) => {
|
|
2735
|
+
state.errorData = action.payload;
|
|
2736
|
+
}
|
|
2737
|
+
}
|
|
2738
|
+
});
|
|
2739
|
+
var {
|
|
2740
|
+
setDataParse,
|
|
2741
|
+
setIdFile,
|
|
2742
|
+
setIsFileLoaded,
|
|
2743
|
+
setLoadingImport,
|
|
2744
|
+
setSelectedFile,
|
|
2745
|
+
setErrorData
|
|
2746
|
+
} = excelSlice.actions;
|
|
2747
|
+
var selectExcel = (state) => state.excel;
|
|
2748
|
+
var excel_slice_default = excelSlice.reducer;
|
|
2749
|
+
|
|
2750
|
+
// ../interface-logic/src/store/reducers/form-slice/index.ts
|
|
2751
|
+
var initialState4 = {
|
|
2752
|
+
viewDataStore: {},
|
|
2753
|
+
isShowingModalDetail: false,
|
|
2754
|
+
isShowModalTranslate: false,
|
|
2755
|
+
formSubmitComponent: {},
|
|
2756
|
+
fieldTranslation: null,
|
|
2757
|
+
listSubject: {},
|
|
2758
|
+
dataUser: {}
|
|
2759
|
+
};
|
|
2760
|
+
var formSlice = createSlice({
|
|
2761
|
+
name: "form",
|
|
2762
|
+
initialState: initialState4,
|
|
2763
|
+
reducers: {
|
|
2764
|
+
setViewDataStore: (state, action) => {
|
|
2765
|
+
state.viewDataStore = action.payload;
|
|
2766
|
+
},
|
|
2767
|
+
setIsShowingModalDetail: (state, action) => {
|
|
2768
|
+
state.isShowingModalDetail = action.payload;
|
|
2769
|
+
},
|
|
2770
|
+
setIsShowModalTranslate: (state, action) => {
|
|
2771
|
+
state.isShowModalTranslate = action.payload;
|
|
2772
|
+
},
|
|
2773
|
+
setFormSubmitComponent: (state, action) => {
|
|
2774
|
+
state.formSubmitComponent[action.payload.key] = action.payload.component;
|
|
2775
|
+
},
|
|
2776
|
+
setFieldTranslate: (state, action) => {
|
|
2777
|
+
state.fieldTranslation = action.payload;
|
|
2778
|
+
},
|
|
2779
|
+
setListSubject: (state, action) => {
|
|
2780
|
+
state.listSubject = action.payload;
|
|
2781
|
+
},
|
|
2782
|
+
setDataUser: (state, action) => {
|
|
2783
|
+
state.dataUser = action.payload;
|
|
2784
|
+
}
|
|
2785
|
+
}
|
|
2786
|
+
});
|
|
2787
|
+
var {
|
|
2788
|
+
setViewDataStore,
|
|
2789
|
+
setIsShowingModalDetail,
|
|
2790
|
+
setIsShowModalTranslate,
|
|
2791
|
+
setFormSubmitComponent,
|
|
2792
|
+
setFieldTranslate,
|
|
2793
|
+
setListSubject,
|
|
2794
|
+
setDataUser
|
|
2795
|
+
} = formSlice.actions;
|
|
2796
|
+
var selectForm = (state) => state.form;
|
|
2797
|
+
var form_slice_default = formSlice.reducer;
|
|
2798
|
+
|
|
2799
|
+
// ../interface-logic/src/store/reducers/header-slice/index.ts
|
|
2800
|
+
var headerSlice = createSlice({
|
|
2801
|
+
name: "header",
|
|
2802
|
+
initialState: {
|
|
2803
|
+
value: { allowedCompanyIds: [] }
|
|
2804
|
+
},
|
|
2805
|
+
reducers: {
|
|
2806
|
+
setHeader: (state, action) => {
|
|
2807
|
+
state.value = { ...state.value, ...action.payload };
|
|
2808
|
+
},
|
|
2809
|
+
setAllowedCompanyIds: (state, action) => {
|
|
2810
|
+
state.value.allowedCompanyIds = action.payload;
|
|
2811
|
+
}
|
|
2812
|
+
}
|
|
2813
|
+
});
|
|
2814
|
+
var { setAllowedCompanyIds, setHeader } = headerSlice.actions;
|
|
2815
|
+
var selectHeader = (state) => state.header;
|
|
2816
|
+
var header_slice_default = headerSlice.reducer;
|
|
2817
|
+
|
|
2818
|
+
// ../interface-logic/src/store/reducers/list-slice/index.ts
|
|
2819
|
+
var initialState5 = {
|
|
2820
|
+
pageLimit: 10,
|
|
2821
|
+
fields: {},
|
|
2822
|
+
order: "",
|
|
2823
|
+
selectedRowKeys: [],
|
|
2824
|
+
selectedRadioKey: 0,
|
|
2825
|
+
indexRowTableModal: -2,
|
|
2826
|
+
isUpdateTableModal: false,
|
|
2827
|
+
footerGroupTable: {},
|
|
2828
|
+
transferDetail: null,
|
|
2829
|
+
page: 0,
|
|
2830
|
+
domainTable: []
|
|
2831
|
+
};
|
|
2832
|
+
var listSlice = createSlice({
|
|
2833
|
+
name: "list",
|
|
2834
|
+
initialState: initialState5,
|
|
2835
|
+
reducers: {
|
|
2836
|
+
setPageLimit: (state, action) => {
|
|
2837
|
+
state.pageLimit = action.payload;
|
|
2838
|
+
},
|
|
2839
|
+
setFields: (state, action) => {
|
|
2840
|
+
state.fields = action.payload;
|
|
2841
|
+
},
|
|
2842
|
+
setOrder: (state, action) => {
|
|
2843
|
+
state.order = action.payload;
|
|
2844
|
+
},
|
|
2845
|
+
setSelectedRowKeys: (state, action) => {
|
|
2846
|
+
state.selectedRowKeys = action.payload;
|
|
2847
|
+
},
|
|
2848
|
+
setSelectedRadioKey: (state, action) => {
|
|
2849
|
+
state.selectedRadioKey = action.payload;
|
|
2850
|
+
},
|
|
2851
|
+
setIndexRowTableModal: (state, action) => {
|
|
2852
|
+
state.indexRowTableModal = action.payload;
|
|
2853
|
+
},
|
|
2854
|
+
setTransferDetail: (state, action) => {
|
|
2855
|
+
state.transferDetail = action.payload;
|
|
2856
|
+
},
|
|
2857
|
+
setIsUpdateTableModal: (state, action) => {
|
|
2858
|
+
state.isUpdateTableModal = action.payload;
|
|
2859
|
+
},
|
|
2860
|
+
setPage: (state, action) => {
|
|
2861
|
+
state.page = action.payload;
|
|
2862
|
+
},
|
|
2863
|
+
setDomainTable: (state, action) => {
|
|
2864
|
+
state.domainTable = action.payload;
|
|
2865
|
+
}
|
|
2866
|
+
}
|
|
2867
|
+
});
|
|
2868
|
+
var {
|
|
2869
|
+
setPageLimit,
|
|
2870
|
+
setFields,
|
|
2871
|
+
setOrder,
|
|
2872
|
+
setSelectedRowKeys,
|
|
2873
|
+
setIndexRowTableModal,
|
|
2874
|
+
setIsUpdateTableModal,
|
|
2875
|
+
setPage,
|
|
2876
|
+
setSelectedRadioKey,
|
|
2877
|
+
setTransferDetail,
|
|
2878
|
+
setDomainTable
|
|
2879
|
+
} = listSlice.actions;
|
|
2880
|
+
var selectList = (state) => state.list;
|
|
2881
|
+
var list_slice_default = listSlice.reducer;
|
|
2882
|
+
|
|
2883
|
+
// ../interface-logic/src/store/reducers/login-slice/index.ts
|
|
2884
|
+
var initialState6 = {
|
|
2885
|
+
db: "",
|
|
2886
|
+
redirectTo: "/",
|
|
2887
|
+
forgotPasswordUrl: "/"
|
|
2888
|
+
};
|
|
2889
|
+
var loginSlice = createSlice({
|
|
2890
|
+
name: "login",
|
|
2891
|
+
initialState: initialState6,
|
|
2892
|
+
reducers: {
|
|
2893
|
+
setDb: (state, action) => {
|
|
2894
|
+
state.db = action.payload;
|
|
2895
|
+
},
|
|
2896
|
+
setRedirectTo: (state, action) => {
|
|
2897
|
+
state.redirectTo = action.payload;
|
|
2898
|
+
},
|
|
2899
|
+
setForgotPasswordUrl: (state, action) => {
|
|
2900
|
+
state.forgotPasswordUrl = action.payload;
|
|
2901
|
+
}
|
|
2902
|
+
}
|
|
2903
|
+
});
|
|
2904
|
+
var { setDb, setRedirectTo, setForgotPasswordUrl } = loginSlice.actions;
|
|
2905
|
+
var selectLogin = (state) => state.login;
|
|
2906
|
+
var login_slice_default = loginSlice.reducer;
|
|
2907
|
+
|
|
2908
|
+
// ../interface-logic/src/store/reducers/navbar-slice/index.ts
|
|
2909
|
+
var initialState7 = {
|
|
2910
|
+
menuFocus: {},
|
|
2911
|
+
menuAction: {},
|
|
2912
|
+
navbarWidth: 250,
|
|
2913
|
+
menuList: []
|
|
2914
|
+
};
|
|
2915
|
+
var navbarSlice = createSlice({
|
|
2916
|
+
name: "navbar",
|
|
2917
|
+
initialState: initialState7,
|
|
2918
|
+
reducers: {
|
|
2919
|
+
setMenuFocus: (state, action) => {
|
|
2920
|
+
state.menuFocus = action.payload;
|
|
2921
|
+
},
|
|
2922
|
+
setMenuFocusAction: (state, action) => {
|
|
2923
|
+
state.menuAction = action.payload;
|
|
2924
|
+
},
|
|
2925
|
+
setNavbarWidth: (state, action) => {
|
|
2926
|
+
state.navbarWidth = action.payload;
|
|
2927
|
+
},
|
|
2928
|
+
setMenuList: (state, action) => {
|
|
2929
|
+
state.menuList = action.payload;
|
|
2930
|
+
}
|
|
2931
|
+
}
|
|
2932
|
+
});
|
|
2933
|
+
var { setMenuFocus, setMenuFocusAction, setNavbarWidth, setMenuList } = navbarSlice.actions;
|
|
2934
|
+
var selectNavbar = (state) => state.navbar;
|
|
2935
|
+
var navbar_slice_default = navbarSlice.reducer;
|
|
2936
|
+
|
|
2937
|
+
// ../interface-logic/src/store/reducers/profile-slice/index.ts
|
|
2938
|
+
var initialState8 = {
|
|
2939
|
+
profile: {}
|
|
2940
|
+
};
|
|
2941
|
+
var profileSlice = createSlice({
|
|
2942
|
+
name: "profile",
|
|
2943
|
+
initialState: initialState8,
|
|
2944
|
+
reducers: {
|
|
2945
|
+
setProfile: (state, action) => {
|
|
2946
|
+
state.profile = action.payload;
|
|
2947
|
+
}
|
|
2948
|
+
}
|
|
2949
|
+
});
|
|
2950
|
+
var { setProfile } = profileSlice.actions;
|
|
2951
|
+
var selectProfile = (state) => state.profile;
|
|
2952
|
+
var profile_slice_default = profileSlice.reducer;
|
|
2953
|
+
|
|
2954
|
+
// ../interface-logic/src/store/reducers/search-slice/index.ts
|
|
2955
|
+
var initialState9 = {
|
|
2956
|
+
groupByDomain: null,
|
|
2957
|
+
searchBy: [],
|
|
2958
|
+
searchString: "",
|
|
2959
|
+
hoveredIndexSearchList: null,
|
|
2960
|
+
selectedTags: [],
|
|
2961
|
+
firstDomain: null,
|
|
2962
|
+
searchMap: {},
|
|
2963
|
+
filterBy: [],
|
|
2964
|
+
groupBy: []
|
|
2965
|
+
};
|
|
2966
|
+
var searchSlice = createSlice({
|
|
2967
|
+
name: "search",
|
|
2968
|
+
initialState: initialState9,
|
|
2969
|
+
reducers: {
|
|
2970
|
+
setGroupByDomain: (state, action) => {
|
|
2971
|
+
state.groupByDomain = action.payload;
|
|
2972
|
+
},
|
|
2973
|
+
setSearchBy: (state, action) => {
|
|
2974
|
+
state.searchBy = action.payload;
|
|
2975
|
+
},
|
|
2976
|
+
setSearchString: (state, action) => {
|
|
2977
|
+
state.searchString = action.payload;
|
|
2978
|
+
},
|
|
2979
|
+
setHoveredIndexSearchList: (state, action) => {
|
|
2980
|
+
state.hoveredIndexSearchList = action.payload;
|
|
2981
|
+
},
|
|
2982
|
+
setSelectedTags: (state, action) => {
|
|
2983
|
+
state.selectedTags = action.payload;
|
|
2984
|
+
},
|
|
2985
|
+
setFirstDomain: (state, action) => {
|
|
2986
|
+
state.firstDomain = action.payload;
|
|
2987
|
+
},
|
|
2988
|
+
setFilterBy: (state, action) => {
|
|
2989
|
+
state.filterBy = action.payload;
|
|
2990
|
+
},
|
|
2991
|
+
setGroupBy: (state, action) => {
|
|
2992
|
+
state.groupBy = action.payload;
|
|
2993
|
+
},
|
|
2994
|
+
setSearchMap: (state, action) => {
|
|
2995
|
+
state.searchMap = action.payload;
|
|
2996
|
+
},
|
|
2997
|
+
updateSearchMap: (state, action) => {
|
|
2998
|
+
if (!state.searchMap[action.payload.key]) {
|
|
2999
|
+
state.searchMap[action.payload.key] = [];
|
|
3000
|
+
}
|
|
3001
|
+
state.searchMap[action.payload.key].push(action.payload.value);
|
|
3002
|
+
},
|
|
3003
|
+
removeKeyFromSearchMap: (state, action) => {
|
|
3004
|
+
const { key, item } = action.payload;
|
|
3005
|
+
const values = state.searchMap[key];
|
|
3006
|
+
if (!values) return;
|
|
3007
|
+
if (item) {
|
|
3008
|
+
const filtered = values.filter((value) => value.name !== item.name);
|
|
3009
|
+
if (filtered.length > 0) {
|
|
3010
|
+
state.searchMap[key] = filtered;
|
|
3011
|
+
} else {
|
|
3012
|
+
delete state.searchMap[key];
|
|
3013
|
+
}
|
|
3014
|
+
} else {
|
|
3015
|
+
delete state.searchMap[key];
|
|
3016
|
+
}
|
|
3017
|
+
},
|
|
3018
|
+
clearSearchMap: (state) => {
|
|
3019
|
+
state.searchMap = {};
|
|
3020
|
+
}
|
|
3021
|
+
}
|
|
3022
|
+
});
|
|
3023
|
+
var {
|
|
3024
|
+
setGroupByDomain,
|
|
3025
|
+
setSelectedTags,
|
|
3026
|
+
setSearchString,
|
|
3027
|
+
setHoveredIndexSearchList,
|
|
3028
|
+
setFirstDomain,
|
|
3029
|
+
setSearchBy,
|
|
3030
|
+
setFilterBy,
|
|
3031
|
+
setSearchMap,
|
|
3032
|
+
updateSearchMap,
|
|
3033
|
+
removeKeyFromSearchMap,
|
|
3034
|
+
setGroupBy,
|
|
3035
|
+
clearSearchMap
|
|
3036
|
+
} = searchSlice.actions;
|
|
3037
|
+
var selectSearch = (state) => state.search;
|
|
3038
|
+
var selectSearchMap = (state) => state.search.searchMap;
|
|
3039
|
+
var search_slice_default = searchSlice.reducer;
|
|
3040
|
+
|
|
3041
|
+
// ../interface-logic/src/store/store.ts
|
|
3042
|
+
var rootReducer = combineReducers({
|
|
3043
|
+
env: env_slice_default,
|
|
3044
|
+
header: header_slice_default,
|
|
3045
|
+
navbar: navbar_slice_default,
|
|
3046
|
+
list: list_slice_default,
|
|
3047
|
+
search: search_slice_default,
|
|
3048
|
+
form: form_slice_default,
|
|
3049
|
+
breadcrumbs: breadcrums_slice_default,
|
|
3050
|
+
login: login_slice_default,
|
|
3051
|
+
excel: excel_slice_default,
|
|
3052
|
+
profile: profile_slice_default
|
|
3053
|
+
});
|
|
3054
|
+
var envStore = configureStore({
|
|
3055
|
+
reducer: rootReducer,
|
|
3056
|
+
middleware: (getDefaultMiddleware) => getDefaultMiddleware({
|
|
3057
|
+
serializableCheck: false
|
|
3058
|
+
})
|
|
3059
|
+
});
|
|
3060
|
+
|
|
3061
|
+
// ../interface-logic/src/store/index.ts
|
|
3062
|
+
var useAppDispatch = useDispatch;
|
|
3063
|
+
var useAppSelector = useSelector;
|
|
3064
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
3065
|
+
0 && (module.exports = {
|
|
3066
|
+
breadcrumbsSlice,
|
|
3067
|
+
clearSearchMap,
|
|
3068
|
+
envSlice,
|
|
3069
|
+
envStore,
|
|
3070
|
+
excelSlice,
|
|
3071
|
+
formSlice,
|
|
3072
|
+
headerSlice,
|
|
3073
|
+
listSlice,
|
|
3074
|
+
loginSlice,
|
|
3075
|
+
navbarSlice,
|
|
3076
|
+
profileSlice,
|
|
3077
|
+
removeKeyFromSearchMap,
|
|
3078
|
+
searchSlice,
|
|
3079
|
+
selectBreadCrumbs,
|
|
3080
|
+
selectEnv,
|
|
3081
|
+
selectExcel,
|
|
3082
|
+
selectForm,
|
|
3083
|
+
selectHeader,
|
|
3084
|
+
selectList,
|
|
3085
|
+
selectLogin,
|
|
3086
|
+
selectNavbar,
|
|
3087
|
+
selectProfile,
|
|
3088
|
+
selectSearch,
|
|
3089
|
+
selectSearchMap,
|
|
3090
|
+
setAllowCompanies,
|
|
3091
|
+
setAllowedCompanyIds,
|
|
3092
|
+
setBreadCrumbs,
|
|
3093
|
+
setCompanies,
|
|
3094
|
+
setConfig,
|
|
3095
|
+
setDataParse,
|
|
3096
|
+
setDataUser,
|
|
3097
|
+
setDb,
|
|
3098
|
+
setDefaultCompany,
|
|
3099
|
+
setDomainTable,
|
|
3100
|
+
setEnv,
|
|
3101
|
+
setEnvFile,
|
|
3102
|
+
setErrorData,
|
|
3103
|
+
setFieldTranslate,
|
|
3104
|
+
setFields,
|
|
3105
|
+
setFilterBy,
|
|
3106
|
+
setFirstDomain,
|
|
3107
|
+
setForgotPasswordUrl,
|
|
3108
|
+
setFormSubmitComponent,
|
|
3109
|
+
setGroupBy,
|
|
3110
|
+
setGroupByDomain,
|
|
3111
|
+
setHeader,
|
|
3112
|
+
setHoveredIndexSearchList,
|
|
3113
|
+
setIdFile,
|
|
3114
|
+
setIndexRowTableModal,
|
|
3115
|
+
setIsFileLoaded,
|
|
3116
|
+
setIsShowModalTranslate,
|
|
3117
|
+
setIsShowingModalDetail,
|
|
3118
|
+
setIsUpdateTableModal,
|
|
3119
|
+
setLang,
|
|
3120
|
+
setListSubject,
|
|
3121
|
+
setLoadingImport,
|
|
3122
|
+
setMenuFocus,
|
|
3123
|
+
setMenuFocusAction,
|
|
3124
|
+
setMenuList,
|
|
3125
|
+
setNavbarWidth,
|
|
3126
|
+
setOrder,
|
|
3127
|
+
setPage,
|
|
3128
|
+
setPageLimit,
|
|
3129
|
+
setProfile,
|
|
3130
|
+
setRedirectTo,
|
|
3131
|
+
setSearchBy,
|
|
3132
|
+
setSearchMap,
|
|
3133
|
+
setSearchString,
|
|
3134
|
+
setSelectedFile,
|
|
3135
|
+
setSelectedRadioKey,
|
|
3136
|
+
setSelectedRowKeys,
|
|
3137
|
+
setSelectedTags,
|
|
3138
|
+
setTransferDetail,
|
|
3139
|
+
setUid,
|
|
3140
|
+
setUser,
|
|
3141
|
+
setViewDataStore,
|
|
3142
|
+
updateSearchMap,
|
|
3143
|
+
useAppDispatch,
|
|
3144
|
+
useAppSelector
|
|
3145
|
+
});
|
|
3146
|
+
/*! Bundled license information:
|
|
3147
|
+
|
|
3148
|
+
use-sync-external-store/cjs/use-sync-external-store-with-selector.production.js:
|
|
3149
|
+
(**
|
|
3150
|
+
* @license React
|
|
3151
|
+
* use-sync-external-store-with-selector.production.js
|
|
3152
|
+
*
|
|
3153
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3154
|
+
*
|
|
3155
|
+
* This source code is licensed under the MIT license found in the
|
|
3156
|
+
* LICENSE file in the root directory of this source tree.
|
|
3157
|
+
*)
|
|
3158
|
+
|
|
3159
|
+
use-sync-external-store/cjs/use-sync-external-store-with-selector.development.js:
|
|
3160
|
+
(**
|
|
3161
|
+
* @license React
|
|
3162
|
+
* use-sync-external-store-with-selector.development.js
|
|
3163
|
+
*
|
|
3164
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3165
|
+
*
|
|
3166
|
+
* This source code is licensed under the MIT license found in the
|
|
3167
|
+
* LICENSE file in the root directory of this source tree.
|
|
3168
|
+
*)
|
|
3169
|
+
*/
|