@innoways/utils 3.0.0

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.
@@ -0,0 +1,3949 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var _ = require('lodash');
6
+ var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
7
+ var _typeof = require('@babel/runtime/helpers/typeof');
8
+ var _asyncToGenerator = require('@babel/runtime/helpers/asyncToGenerator');
9
+ var _regeneratorRuntime = require('@babel/runtime/regenerator');
10
+ var _toConsumableArray = require('@babel/runtime/helpers/toConsumableArray');
11
+ var stringify = require('js-stringify');
12
+ var _defineProperty = require('@babel/runtime/helpers/defineProperty');
13
+
14
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
15
+
16
+ var ___default = /*#__PURE__*/_interopDefaultLegacy(_);
17
+ var _slicedToArray__default = /*#__PURE__*/_interopDefaultLegacy(_slicedToArray);
18
+ var _typeof__default = /*#__PURE__*/_interopDefaultLegacy(_typeof);
19
+ var _asyncToGenerator__default = /*#__PURE__*/_interopDefaultLegacy(_asyncToGenerator);
20
+ var _regeneratorRuntime__default = /*#__PURE__*/_interopDefaultLegacy(_regeneratorRuntime);
21
+ var _toConsumableArray__default = /*#__PURE__*/_interopDefaultLegacy(_toConsumableArray);
22
+ var stringify__default = /*#__PURE__*/_interopDefaultLegacy(stringify);
23
+ var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
24
+
25
+ function createCommonjsModule(fn, basedir, module) {
26
+ return module = {
27
+ path: basedir,
28
+ exports: {},
29
+ require: function (path, base) {
30
+ return commonjsRequire(path, (base === undefined || base === null) ? module.path : base);
31
+ }
32
+ }, fn(module, module.exports), module.exports;
33
+ }
34
+
35
+ function commonjsRequire () {
36
+ throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs');
37
+ }
38
+
39
+ /*
40
+ object-assign
41
+ (c) Sindre Sorhus
42
+ @license MIT
43
+ */
44
+ /* eslint-disable no-unused-vars */
45
+ var getOwnPropertySymbols = Object.getOwnPropertySymbols;
46
+ var hasOwnProperty = Object.prototype.hasOwnProperty;
47
+ var propIsEnumerable = Object.prototype.propertyIsEnumerable;
48
+
49
+ function toObject(val) {
50
+ if (val === null || val === undefined) {
51
+ throw new TypeError('Object.assign cannot be called with null or undefined');
52
+ }
53
+
54
+ return Object(val);
55
+ }
56
+
57
+ function shouldUseNative() {
58
+ try {
59
+ if (!Object.assign) {
60
+ return false;
61
+ }
62
+
63
+ // Detect buggy property enumeration order in older V8 versions.
64
+
65
+ // https://bugs.chromium.org/p/v8/issues/detail?id=4118
66
+ var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
67
+ test1[5] = 'de';
68
+ if (Object.getOwnPropertyNames(test1)[0] === '5') {
69
+ return false;
70
+ }
71
+
72
+ // https://bugs.chromium.org/p/v8/issues/detail?id=3056
73
+ var test2 = {};
74
+ for (var i = 0; i < 10; i++) {
75
+ test2['_' + String.fromCharCode(i)] = i;
76
+ }
77
+ var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
78
+ return test2[n];
79
+ });
80
+ if (order2.join('') !== '0123456789') {
81
+ return false;
82
+ }
83
+
84
+ // https://bugs.chromium.org/p/v8/issues/detail?id=3056
85
+ var test3 = {};
86
+ 'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
87
+ test3[letter] = letter;
88
+ });
89
+ if (Object.keys(Object.assign({}, test3)).join('') !==
90
+ 'abcdefghijklmnopqrst') {
91
+ return false;
92
+ }
93
+
94
+ return true;
95
+ } catch (err) {
96
+ // We don't expect any of the above to throw, but better to be safe.
97
+ return false;
98
+ }
99
+ }
100
+
101
+ var objectAssign = shouldUseNative() ? Object.assign : function (target, source) {
102
+ var from;
103
+ var to = toObject(target);
104
+ var symbols;
105
+
106
+ for (var s = 1; s < arguments.length; s++) {
107
+ from = Object(arguments[s]);
108
+
109
+ for (var key in from) {
110
+ if (hasOwnProperty.call(from, key)) {
111
+ to[key] = from[key];
112
+ }
113
+ }
114
+
115
+ if (getOwnPropertySymbols) {
116
+ symbols = getOwnPropertySymbols(from);
117
+ for (var i = 0; i < symbols.length; i++) {
118
+ if (propIsEnumerable.call(from, symbols[i])) {
119
+ to[symbols[i]] = from[symbols[i]];
120
+ }
121
+ }
122
+ }
123
+ }
124
+
125
+ return to;
126
+ };
127
+
128
+ var react_production_min = createCommonjsModule(function (module, exports) {
129
+ var n=60103,p=60106;exports.Fragment=60107;exports.StrictMode=60108;exports.Profiler=60114;var q=60109,r=60110,t=60112;exports.Suspense=60113;var u=60115,v=60116;
130
+ if("function"===typeof Symbol&&Symbol.for){var w=Symbol.for;n=w("react.element");p=w("react.portal");exports.Fragment=w("react.fragment");exports.StrictMode=w("react.strict_mode");exports.Profiler=w("react.profiler");q=w("react.provider");r=w("react.context");t=w("react.forward_ref");exports.Suspense=w("react.suspense");u=w("react.memo");v=w("react.lazy");}var x="function"===typeof Symbol&&Symbol.iterator;
131
+ function y(a){if(null===a||"object"!==typeof a)return null;a=x&&a[x]||a["@@iterator"];return "function"===typeof a?a:null}function z(a){for(var b="https://reactjs.org/docs/error-decoder.html?invariant="+a,c=1;c<arguments.length;c++)b+="&args[]="+encodeURIComponent(arguments[c]);return "Minified React error #"+a+"; visit "+b+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}
132
+ var A={isMounted:function(){return !1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},B={};function C(a,b,c){this.props=a;this.context=b;this.refs=B;this.updater=c||A;}C.prototype.isReactComponent={};C.prototype.setState=function(a,b){if("object"!==typeof a&&"function"!==typeof a&&null!=a)throw Error(z(85));this.updater.enqueueSetState(this,a,b,"setState");};C.prototype.forceUpdate=function(a){this.updater.enqueueForceUpdate(this,a,"forceUpdate");};
133
+ function D(){}D.prototype=C.prototype;function E(a,b,c){this.props=a;this.context=b;this.refs=B;this.updater=c||A;}var F=E.prototype=new D;F.constructor=E;objectAssign(F,C.prototype);F.isPureReactComponent=!0;var G={current:null},H=Object.prototype.hasOwnProperty,I={key:!0,ref:!0,__self:!0,__source:!0};
134
+ function J(a,b,c){var e,d={},k=null,h=null;if(null!=b)for(e in void 0!==b.ref&&(h=b.ref),void 0!==b.key&&(k=""+b.key),b)H.call(b,e)&&!I.hasOwnProperty(e)&&(d[e]=b[e]);var g=arguments.length-2;if(1===g)d.children=c;else if(1<g){for(var f=Array(g),m=0;m<g;m++)f[m]=arguments[m+2];d.children=f;}if(a&&a.defaultProps)for(e in g=a.defaultProps,g)void 0===d[e]&&(d[e]=g[e]);return {$$typeof:n,type:a,key:k,ref:h,props:d,_owner:G.current}}
135
+ function K(a,b){return {$$typeof:n,type:a.type,key:b,ref:a.ref,props:a.props,_owner:a._owner}}function L(a){return "object"===typeof a&&null!==a&&a.$$typeof===n}function escape(a){var b={"=":"=0",":":"=2"};return "$"+a.replace(/[=:]/g,function(a){return b[a]})}var M=/\/+/g;function N(a,b){return "object"===typeof a&&null!==a&&null!=a.key?escape(""+a.key):b.toString(36)}
136
+ function O(a,b,c,e,d){var k=typeof a;if("undefined"===k||"boolean"===k)a=null;var h=!1;if(null===a)h=!0;else switch(k){case "string":case "number":h=!0;break;case "object":switch(a.$$typeof){case n:case p:h=!0;}}if(h)return h=a,d=d(h),a=""===e?"."+N(h,0):e,Array.isArray(d)?(c="",null!=a&&(c=a.replace(M,"$&/")+"/"),O(d,b,c,"",function(a){return a})):null!=d&&(L(d)&&(d=K(d,c+(!d.key||h&&h.key===d.key?"":(""+d.key).replace(M,"$&/")+"/")+a)),b.push(d)),1;h=0;e=""===e?".":e+":";if(Array.isArray(a))for(var g=
137
+ 0;g<a.length;g++){k=a[g];var f=e+N(k,g);h+=O(k,b,c,f,d);}else if(f=y(a),"function"===typeof f)for(a=f.call(a),g=0;!(k=a.next()).done;)k=k.value,f=e+N(k,g++),h+=O(k,b,c,f,d);else if("object"===k)throw b=""+a,Error(z(31,"[object Object]"===b?"object with keys {"+Object.keys(a).join(", ")+"}":b));return h}function P(a,b,c){if(null==a)return a;var e=[],d=0;O(a,e,"","",function(a){return b.call(c,a,d++)});return e}
138
+ function Q(a){if(-1===a._status){var b=a._result;b=b();a._status=0;a._result=b;b.then(function(b){0===a._status&&(b=b.default,a._status=1,a._result=b);},function(b){0===a._status&&(a._status=2,a._result=b);});}if(1===a._status)return a._result;throw a._result;}var R={current:null};function S(){var a=R.current;if(null===a)throw Error(z(321));return a}var T={ReactCurrentDispatcher:R,ReactCurrentBatchConfig:{transition:0},ReactCurrentOwner:G,IsSomeRendererActing:{current:!1},assign:objectAssign};
139
+ exports.Children={map:P,forEach:function(a,b,c){P(a,function(){b.apply(this,arguments);},c);},count:function(a){var b=0;P(a,function(){b++;});return b},toArray:function(a){return P(a,function(a){return a})||[]},only:function(a){if(!L(a))throw Error(z(143));return a}};exports.Component=C;exports.PureComponent=E;exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=T;
140
+ exports.cloneElement=function(a,b,c){if(null===a||void 0===a)throw Error(z(267,a));var e=objectAssign({},a.props),d=a.key,k=a.ref,h=a._owner;if(null!=b){void 0!==b.ref&&(k=b.ref,h=G.current);void 0!==b.key&&(d=""+b.key);if(a.type&&a.type.defaultProps)var g=a.type.defaultProps;for(f in b)H.call(b,f)&&!I.hasOwnProperty(f)&&(e[f]=void 0===b[f]&&void 0!==g?g[f]:b[f]);}var f=arguments.length-2;if(1===f)e.children=c;else if(1<f){g=Array(f);for(var m=0;m<f;m++)g[m]=arguments[m+2];e.children=g;}return {$$typeof:n,type:a.type,
141
+ key:d,ref:k,props:e,_owner:h}};exports.createContext=function(a,b){void 0===b&&(b=null);a={$$typeof:r,_calculateChangedBits:b,_currentValue:a,_currentValue2:a,_threadCount:0,Provider:null,Consumer:null};a.Provider={$$typeof:q,_context:a};return a.Consumer=a};exports.createElement=J;exports.createFactory=function(a){var b=J.bind(null,a);b.type=a;return b};exports.createRef=function(){return {current:null}};exports.forwardRef=function(a){return {$$typeof:t,render:a}};exports.isValidElement=L;
142
+ exports.lazy=function(a){return {$$typeof:v,_payload:{_status:-1,_result:a},_init:Q}};exports.memo=function(a,b){return {$$typeof:u,type:a,compare:void 0===b?null:b}};exports.useCallback=function(a,b){return S().useCallback(a,b)};exports.useContext=function(a,b){return S().useContext(a,b)};exports.useDebugValue=function(){};exports.useEffect=function(a,b){return S().useEffect(a,b)};exports.useImperativeHandle=function(a,b,c){return S().useImperativeHandle(a,b,c)};
143
+ exports.useLayoutEffect=function(a,b){return S().useLayoutEffect(a,b)};exports.useMemo=function(a,b){return S().useMemo(a,b)};exports.useReducer=function(a,b,c){return S().useReducer(a,b,c)};exports.useRef=function(a){return S().useRef(a)};exports.useState=function(a){return S().useState(a)};exports.version="17.0.2";
144
+ });
145
+ react_production_min.Fragment;
146
+ react_production_min.StrictMode;
147
+ react_production_min.Profiler;
148
+ react_production_min.Suspense;
149
+ react_production_min.Children;
150
+ react_production_min.Component;
151
+ react_production_min.PureComponent;
152
+ react_production_min.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
153
+ react_production_min.cloneElement;
154
+ react_production_min.createContext;
155
+ react_production_min.createElement;
156
+ react_production_min.createFactory;
157
+ react_production_min.createRef;
158
+ react_production_min.forwardRef;
159
+ react_production_min.isValidElement;
160
+ react_production_min.lazy;
161
+ react_production_min.memo;
162
+ react_production_min.useCallback;
163
+ react_production_min.useContext;
164
+ react_production_min.useDebugValue;
165
+ react_production_min.useEffect;
166
+ react_production_min.useImperativeHandle;
167
+ react_production_min.useLayoutEffect;
168
+ react_production_min.useMemo;
169
+ react_production_min.useReducer;
170
+ react_production_min.useRef;
171
+ react_production_min.useState;
172
+ react_production_min.version;
173
+
174
+ var react_development = createCommonjsModule(function (module, exports) {
175
+
176
+ if (process.env.NODE_ENV !== "production") {
177
+ (function() {
178
+
179
+ var _assign = objectAssign;
180
+
181
+ // TODO: this is special because it gets imported during build.
182
+ var ReactVersion = '17.0.2';
183
+
184
+ // ATTENTION
185
+ // When adding new symbols to this file,
186
+ // Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'
187
+ // The Symbol used to tag the ReactElement-like types. If there is no native Symbol
188
+ // nor polyfill, then a plain number is used for performance.
189
+ var REACT_ELEMENT_TYPE = 0xeac7;
190
+ var REACT_PORTAL_TYPE = 0xeaca;
191
+ exports.Fragment = 0xeacb;
192
+ exports.StrictMode = 0xeacc;
193
+ exports.Profiler = 0xead2;
194
+ var REACT_PROVIDER_TYPE = 0xeacd;
195
+ var REACT_CONTEXT_TYPE = 0xeace;
196
+ var REACT_FORWARD_REF_TYPE = 0xead0;
197
+ exports.Suspense = 0xead1;
198
+ var REACT_SUSPENSE_LIST_TYPE = 0xead8;
199
+ var REACT_MEMO_TYPE = 0xead3;
200
+ var REACT_LAZY_TYPE = 0xead4;
201
+ var REACT_BLOCK_TYPE = 0xead9;
202
+ var REACT_SERVER_BLOCK_TYPE = 0xeada;
203
+ var REACT_FUNDAMENTAL_TYPE = 0xead5;
204
+ var REACT_DEBUG_TRACING_MODE_TYPE = 0xeae1;
205
+ var REACT_LEGACY_HIDDEN_TYPE = 0xeae3;
206
+
207
+ if (typeof Symbol === 'function' && Symbol.for) {
208
+ var symbolFor = Symbol.for;
209
+ REACT_ELEMENT_TYPE = symbolFor('react.element');
210
+ REACT_PORTAL_TYPE = symbolFor('react.portal');
211
+ exports.Fragment = symbolFor('react.fragment');
212
+ exports.StrictMode = symbolFor('react.strict_mode');
213
+ exports.Profiler = symbolFor('react.profiler');
214
+ REACT_PROVIDER_TYPE = symbolFor('react.provider');
215
+ REACT_CONTEXT_TYPE = symbolFor('react.context');
216
+ REACT_FORWARD_REF_TYPE = symbolFor('react.forward_ref');
217
+ exports.Suspense = symbolFor('react.suspense');
218
+ REACT_SUSPENSE_LIST_TYPE = symbolFor('react.suspense_list');
219
+ REACT_MEMO_TYPE = symbolFor('react.memo');
220
+ REACT_LAZY_TYPE = symbolFor('react.lazy');
221
+ REACT_BLOCK_TYPE = symbolFor('react.block');
222
+ REACT_SERVER_BLOCK_TYPE = symbolFor('react.server.block');
223
+ REACT_FUNDAMENTAL_TYPE = symbolFor('react.fundamental');
224
+ symbolFor('react.scope');
225
+ symbolFor('react.opaque.id');
226
+ REACT_DEBUG_TRACING_MODE_TYPE = symbolFor('react.debug_trace_mode');
227
+ symbolFor('react.offscreen');
228
+ REACT_LEGACY_HIDDEN_TYPE = symbolFor('react.legacy_hidden');
229
+ }
230
+
231
+ var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
232
+ var FAUX_ITERATOR_SYMBOL = '@@iterator';
233
+ function getIteratorFn(maybeIterable) {
234
+ if (maybeIterable === null || typeof maybeIterable !== 'object') {
235
+ return null;
236
+ }
237
+
238
+ var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
239
+
240
+ if (typeof maybeIterator === 'function') {
241
+ return maybeIterator;
242
+ }
243
+
244
+ return null;
245
+ }
246
+
247
+ /**
248
+ * Keeps track of the current dispatcher.
249
+ */
250
+ var ReactCurrentDispatcher = {
251
+ /**
252
+ * @internal
253
+ * @type {ReactComponent}
254
+ */
255
+ current: null
256
+ };
257
+
258
+ /**
259
+ * Keeps track of the current batch's configuration such as how long an update
260
+ * should suspend for if it needs to.
261
+ */
262
+ var ReactCurrentBatchConfig = {
263
+ transition: 0
264
+ };
265
+
266
+ /**
267
+ * Keeps track of the current owner.
268
+ *
269
+ * The current owner is the component who should own any components that are
270
+ * currently being constructed.
271
+ */
272
+ var ReactCurrentOwner = {
273
+ /**
274
+ * @internal
275
+ * @type {ReactComponent}
276
+ */
277
+ current: null
278
+ };
279
+
280
+ var ReactDebugCurrentFrame = {};
281
+ var currentExtraStackFrame = null;
282
+ function setExtraStackFrame(stack) {
283
+ {
284
+ currentExtraStackFrame = stack;
285
+ }
286
+ }
287
+
288
+ {
289
+ ReactDebugCurrentFrame.setExtraStackFrame = function (stack) {
290
+ {
291
+ currentExtraStackFrame = stack;
292
+ }
293
+ }; // Stack implementation injected by the current renderer.
294
+
295
+
296
+ ReactDebugCurrentFrame.getCurrentStack = null;
297
+
298
+ ReactDebugCurrentFrame.getStackAddendum = function () {
299
+ var stack = ''; // Add an extra top frame while an element is being validated
300
+
301
+ if (currentExtraStackFrame) {
302
+ stack += currentExtraStackFrame;
303
+ } // Delegate to the injected renderer-specific implementation
304
+
305
+
306
+ var impl = ReactDebugCurrentFrame.getCurrentStack;
307
+
308
+ if (impl) {
309
+ stack += impl() || '';
310
+ }
311
+
312
+ return stack;
313
+ };
314
+ }
315
+
316
+ /**
317
+ * Used by act() to track whether you're inside an act() scope.
318
+ */
319
+ var IsSomeRendererActing = {
320
+ current: false
321
+ };
322
+
323
+ var ReactSharedInternals = {
324
+ ReactCurrentDispatcher: ReactCurrentDispatcher,
325
+ ReactCurrentBatchConfig: ReactCurrentBatchConfig,
326
+ ReactCurrentOwner: ReactCurrentOwner,
327
+ IsSomeRendererActing: IsSomeRendererActing,
328
+ // Used by renderers to avoid bundling object-assign twice in UMD bundles:
329
+ assign: _assign
330
+ };
331
+
332
+ {
333
+ ReactSharedInternals.ReactDebugCurrentFrame = ReactDebugCurrentFrame;
334
+ }
335
+
336
+ // by calls to these methods by a Babel plugin.
337
+ //
338
+ // In PROD (or in packages without access to React internals),
339
+ // they are left as they are instead.
340
+
341
+ function warn(format) {
342
+ {
343
+ for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
344
+ args[_key - 1] = arguments[_key];
345
+ }
346
+
347
+ printWarning('warn', format, args);
348
+ }
349
+ }
350
+ function error(format) {
351
+ {
352
+ for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
353
+ args[_key2 - 1] = arguments[_key2];
354
+ }
355
+
356
+ printWarning('error', format, args);
357
+ }
358
+ }
359
+
360
+ function printWarning(level, format, args) {
361
+ // When changing this logic, you might want to also
362
+ // update consoleWithStackDev.www.js as well.
363
+ {
364
+ var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
365
+ var stack = ReactDebugCurrentFrame.getStackAddendum();
366
+
367
+ if (stack !== '') {
368
+ format += '%s';
369
+ args = args.concat([stack]);
370
+ }
371
+
372
+ var argsWithFormat = args.map(function (item) {
373
+ return '' + item;
374
+ }); // Careful: RN currently depends on this prefix
375
+
376
+ argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
377
+ // breaks IE9: https://github.com/facebook/react/issues/13610
378
+ // eslint-disable-next-line react-internal/no-production-logging
379
+
380
+ Function.prototype.apply.call(console[level], console, argsWithFormat);
381
+ }
382
+ }
383
+
384
+ var didWarnStateUpdateForUnmountedComponent = {};
385
+
386
+ function warnNoop(publicInstance, callerName) {
387
+ {
388
+ var _constructor = publicInstance.constructor;
389
+ var componentName = _constructor && (_constructor.displayName || _constructor.name) || 'ReactClass';
390
+ var warningKey = componentName + "." + callerName;
391
+
392
+ if (didWarnStateUpdateForUnmountedComponent[warningKey]) {
393
+ return;
394
+ }
395
+
396
+ error("Can't call %s on a component that is not yet mounted. " + 'This is a no-op, but it might indicate a bug in your application. ' + 'Instead, assign to `this.state` directly or define a `state = {};` ' + 'class property with the desired state in the %s component.', callerName, componentName);
397
+
398
+ didWarnStateUpdateForUnmountedComponent[warningKey] = true;
399
+ }
400
+ }
401
+ /**
402
+ * This is the abstract API for an update queue.
403
+ */
404
+
405
+
406
+ var ReactNoopUpdateQueue = {
407
+ /**
408
+ * Checks whether or not this composite component is mounted.
409
+ * @param {ReactClass} publicInstance The instance we want to test.
410
+ * @return {boolean} True if mounted, false otherwise.
411
+ * @protected
412
+ * @final
413
+ */
414
+ isMounted: function (publicInstance) {
415
+ return false;
416
+ },
417
+
418
+ /**
419
+ * Forces an update. This should only be invoked when it is known with
420
+ * certainty that we are **not** in a DOM transaction.
421
+ *
422
+ * You may want to call this when you know that some deeper aspect of the
423
+ * component's state has changed but `setState` was not called.
424
+ *
425
+ * This will not invoke `shouldComponentUpdate`, but it will invoke
426
+ * `componentWillUpdate` and `componentDidUpdate`.
427
+ *
428
+ * @param {ReactClass} publicInstance The instance that should rerender.
429
+ * @param {?function} callback Called after component is updated.
430
+ * @param {?string} callerName name of the calling function in the public API.
431
+ * @internal
432
+ */
433
+ enqueueForceUpdate: function (publicInstance, callback, callerName) {
434
+ warnNoop(publicInstance, 'forceUpdate');
435
+ },
436
+
437
+ /**
438
+ * Replaces all of the state. Always use this or `setState` to mutate state.
439
+ * You should treat `this.state` as immutable.
440
+ *
441
+ * There is no guarantee that `this.state` will be immediately updated, so
442
+ * accessing `this.state` after calling this method may return the old value.
443
+ *
444
+ * @param {ReactClass} publicInstance The instance that should rerender.
445
+ * @param {object} completeState Next state.
446
+ * @param {?function} callback Called after component is updated.
447
+ * @param {?string} callerName name of the calling function in the public API.
448
+ * @internal
449
+ */
450
+ enqueueReplaceState: function (publicInstance, completeState, callback, callerName) {
451
+ warnNoop(publicInstance, 'replaceState');
452
+ },
453
+
454
+ /**
455
+ * Sets a subset of the state. This only exists because _pendingState is
456
+ * internal. This provides a merging strategy that is not available to deep
457
+ * properties which is confusing. TODO: Expose pendingState or don't use it
458
+ * during the merge.
459
+ *
460
+ * @param {ReactClass} publicInstance The instance that should rerender.
461
+ * @param {object} partialState Next partial state to be merged with state.
462
+ * @param {?function} callback Called after component is updated.
463
+ * @param {?string} Name of the calling function in the public API.
464
+ * @internal
465
+ */
466
+ enqueueSetState: function (publicInstance, partialState, callback, callerName) {
467
+ warnNoop(publicInstance, 'setState');
468
+ }
469
+ };
470
+
471
+ var emptyObject = {};
472
+
473
+ {
474
+ Object.freeze(emptyObject);
475
+ }
476
+ /**
477
+ * Base class helpers for the updating state of a component.
478
+ */
479
+
480
+
481
+ function Component(props, context, updater) {
482
+ this.props = props;
483
+ this.context = context; // If a component has string refs, we will assign a different object later.
484
+
485
+ this.refs = emptyObject; // We initialize the default updater but the real one gets injected by the
486
+ // renderer.
487
+
488
+ this.updater = updater || ReactNoopUpdateQueue;
489
+ }
490
+
491
+ Component.prototype.isReactComponent = {};
492
+ /**
493
+ * Sets a subset of the state. Always use this to mutate
494
+ * state. You should treat `this.state` as immutable.
495
+ *
496
+ * There is no guarantee that `this.state` will be immediately updated, so
497
+ * accessing `this.state` after calling this method may return the old value.
498
+ *
499
+ * There is no guarantee that calls to `setState` will run synchronously,
500
+ * as they may eventually be batched together. You can provide an optional
501
+ * callback that will be executed when the call to setState is actually
502
+ * completed.
503
+ *
504
+ * When a function is provided to setState, it will be called at some point in
505
+ * the future (not synchronously). It will be called with the up to date
506
+ * component arguments (state, props, context). These values can be different
507
+ * from this.* because your function may be called after receiveProps but before
508
+ * shouldComponentUpdate, and this new state, props, and context will not yet be
509
+ * assigned to this.
510
+ *
511
+ * @param {object|function} partialState Next partial state or function to
512
+ * produce next partial state to be merged with current state.
513
+ * @param {?function} callback Called after state is updated.
514
+ * @final
515
+ * @protected
516
+ */
517
+
518
+ Component.prototype.setState = function (partialState, callback) {
519
+ if (!(typeof partialState === 'object' || typeof partialState === 'function' || partialState == null)) {
520
+ {
521
+ throw Error( "setState(...): takes an object of state variables to update or a function which returns an object of state variables." );
522
+ }
523
+ }
524
+
525
+ this.updater.enqueueSetState(this, partialState, callback, 'setState');
526
+ };
527
+ /**
528
+ * Forces an update. This should only be invoked when it is known with
529
+ * certainty that we are **not** in a DOM transaction.
530
+ *
531
+ * You may want to call this when you know that some deeper aspect of the
532
+ * component's state has changed but `setState` was not called.
533
+ *
534
+ * This will not invoke `shouldComponentUpdate`, but it will invoke
535
+ * `componentWillUpdate` and `componentDidUpdate`.
536
+ *
537
+ * @param {?function} callback Called after update is complete.
538
+ * @final
539
+ * @protected
540
+ */
541
+
542
+
543
+ Component.prototype.forceUpdate = function (callback) {
544
+ this.updater.enqueueForceUpdate(this, callback, 'forceUpdate');
545
+ };
546
+ /**
547
+ * Deprecated APIs. These APIs used to exist on classic React classes but since
548
+ * we would like to deprecate them, we're not going to move them over to this
549
+ * modern base class. Instead, we define a getter that warns if it's accessed.
550
+ */
551
+
552
+
553
+ {
554
+ var deprecatedAPIs = {
555
+ isMounted: ['isMounted', 'Instead, make sure to clean up subscriptions and pending requests in ' + 'componentWillUnmount to prevent memory leaks.'],
556
+ replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).']
557
+ };
558
+
559
+ var defineDeprecationWarning = function (methodName, info) {
560
+ Object.defineProperty(Component.prototype, methodName, {
561
+ get: function () {
562
+ warn('%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]);
563
+
564
+ return undefined;
565
+ }
566
+ });
567
+ };
568
+
569
+ for (var fnName in deprecatedAPIs) {
570
+ if (deprecatedAPIs.hasOwnProperty(fnName)) {
571
+ defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
572
+ }
573
+ }
574
+ }
575
+
576
+ function ComponentDummy() {}
577
+
578
+ ComponentDummy.prototype = Component.prototype;
579
+ /**
580
+ * Convenience component with default shallow equality check for sCU.
581
+ */
582
+
583
+ function PureComponent(props, context, updater) {
584
+ this.props = props;
585
+ this.context = context; // If a component has string refs, we will assign a different object later.
586
+
587
+ this.refs = emptyObject;
588
+ this.updater = updater || ReactNoopUpdateQueue;
589
+ }
590
+
591
+ var pureComponentPrototype = PureComponent.prototype = new ComponentDummy();
592
+ pureComponentPrototype.constructor = PureComponent; // Avoid an extra prototype jump for these methods.
593
+
594
+ _assign(pureComponentPrototype, Component.prototype);
595
+
596
+ pureComponentPrototype.isPureReactComponent = true;
597
+
598
+ // an immutable object with a single mutable value
599
+ function createRef() {
600
+ var refObject = {
601
+ current: null
602
+ };
603
+
604
+ {
605
+ Object.seal(refObject);
606
+ }
607
+
608
+ return refObject;
609
+ }
610
+
611
+ function getWrappedName(outerType, innerType, wrapperName) {
612
+ var functionName = innerType.displayName || innerType.name || '';
613
+ return outerType.displayName || (functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName);
614
+ }
615
+
616
+ function getContextName(type) {
617
+ return type.displayName || 'Context';
618
+ }
619
+
620
+ function getComponentName(type) {
621
+ if (type == null) {
622
+ // Host root, text node or just invalid type.
623
+ return null;
624
+ }
625
+
626
+ {
627
+ if (typeof type.tag === 'number') {
628
+ error('Received an unexpected object in getComponentName(). ' + 'This is likely a bug in React. Please file an issue.');
629
+ }
630
+ }
631
+
632
+ if (typeof type === 'function') {
633
+ return type.displayName || type.name || null;
634
+ }
635
+
636
+ if (typeof type === 'string') {
637
+ return type;
638
+ }
639
+
640
+ switch (type) {
641
+ case exports.Fragment:
642
+ return 'Fragment';
643
+
644
+ case REACT_PORTAL_TYPE:
645
+ return 'Portal';
646
+
647
+ case exports.Profiler:
648
+ return 'Profiler';
649
+
650
+ case exports.StrictMode:
651
+ return 'StrictMode';
652
+
653
+ case exports.Suspense:
654
+ return 'Suspense';
655
+
656
+ case REACT_SUSPENSE_LIST_TYPE:
657
+ return 'SuspenseList';
658
+ }
659
+
660
+ if (typeof type === 'object') {
661
+ switch (type.$$typeof) {
662
+ case REACT_CONTEXT_TYPE:
663
+ var context = type;
664
+ return getContextName(context) + '.Consumer';
665
+
666
+ case REACT_PROVIDER_TYPE:
667
+ var provider = type;
668
+ return getContextName(provider._context) + '.Provider';
669
+
670
+ case REACT_FORWARD_REF_TYPE:
671
+ return getWrappedName(type, type.render, 'ForwardRef');
672
+
673
+ case REACT_MEMO_TYPE:
674
+ return getComponentName(type.type);
675
+
676
+ case REACT_BLOCK_TYPE:
677
+ return getComponentName(type._render);
678
+
679
+ case REACT_LAZY_TYPE:
680
+ {
681
+ var lazyComponent = type;
682
+ var payload = lazyComponent._payload;
683
+ var init = lazyComponent._init;
684
+
685
+ try {
686
+ return getComponentName(init(payload));
687
+ } catch (x) {
688
+ return null;
689
+ }
690
+ }
691
+ }
692
+ }
693
+
694
+ return null;
695
+ }
696
+
697
+ var hasOwnProperty = Object.prototype.hasOwnProperty;
698
+ var RESERVED_PROPS = {
699
+ key: true,
700
+ ref: true,
701
+ __self: true,
702
+ __source: true
703
+ };
704
+ var specialPropKeyWarningShown, specialPropRefWarningShown, didWarnAboutStringRefs;
705
+
706
+ {
707
+ didWarnAboutStringRefs = {};
708
+ }
709
+
710
+ function hasValidRef(config) {
711
+ {
712
+ if (hasOwnProperty.call(config, 'ref')) {
713
+ var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;
714
+
715
+ if (getter && getter.isReactWarning) {
716
+ return false;
717
+ }
718
+ }
719
+ }
720
+
721
+ return config.ref !== undefined;
722
+ }
723
+
724
+ function hasValidKey(config) {
725
+ {
726
+ if (hasOwnProperty.call(config, 'key')) {
727
+ var getter = Object.getOwnPropertyDescriptor(config, 'key').get;
728
+
729
+ if (getter && getter.isReactWarning) {
730
+ return false;
731
+ }
732
+ }
733
+ }
734
+
735
+ return config.key !== undefined;
736
+ }
737
+
738
+ function defineKeyPropWarningGetter(props, displayName) {
739
+ var warnAboutAccessingKey = function () {
740
+ {
741
+ if (!specialPropKeyWarningShown) {
742
+ specialPropKeyWarningShown = true;
743
+
744
+ error('%s: `key` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://reactjs.org/link/special-props)', displayName);
745
+ }
746
+ }
747
+ };
748
+
749
+ warnAboutAccessingKey.isReactWarning = true;
750
+ Object.defineProperty(props, 'key', {
751
+ get: warnAboutAccessingKey,
752
+ configurable: true
753
+ });
754
+ }
755
+
756
+ function defineRefPropWarningGetter(props, displayName) {
757
+ var warnAboutAccessingRef = function () {
758
+ {
759
+ if (!specialPropRefWarningShown) {
760
+ specialPropRefWarningShown = true;
761
+
762
+ error('%s: `ref` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://reactjs.org/link/special-props)', displayName);
763
+ }
764
+ }
765
+ };
766
+
767
+ warnAboutAccessingRef.isReactWarning = true;
768
+ Object.defineProperty(props, 'ref', {
769
+ get: warnAboutAccessingRef,
770
+ configurable: true
771
+ });
772
+ }
773
+
774
+ function warnIfStringRefCannotBeAutoConverted(config) {
775
+ {
776
+ if (typeof config.ref === 'string' && ReactCurrentOwner.current && config.__self && ReactCurrentOwner.current.stateNode !== config.__self) {
777
+ var componentName = getComponentName(ReactCurrentOwner.current.type);
778
+
779
+ if (!didWarnAboutStringRefs[componentName]) {
780
+ error('Component "%s" contains the string ref "%s". ' + 'Support for string refs will be removed in a future major release. ' + 'This case cannot be automatically converted to an arrow function. ' + 'We ask you to manually fix this case by using useRef() or createRef() instead. ' + 'Learn more about using refs safely here: ' + 'https://reactjs.org/link/strict-mode-string-ref', componentName, config.ref);
781
+
782
+ didWarnAboutStringRefs[componentName] = true;
783
+ }
784
+ }
785
+ }
786
+ }
787
+ /**
788
+ * Factory method to create a new React element. This no longer adheres to
789
+ * the class pattern, so do not use new to call it. Also, instanceof check
790
+ * will not work. Instead test $$typeof field against Symbol.for('react.element') to check
791
+ * if something is a React Element.
792
+ *
793
+ * @param {*} type
794
+ * @param {*} props
795
+ * @param {*} key
796
+ * @param {string|object} ref
797
+ * @param {*} owner
798
+ * @param {*} self A *temporary* helper to detect places where `this` is
799
+ * different from the `owner` when React.createElement is called, so that we
800
+ * can warn. We want to get rid of owner and replace string `ref`s with arrow
801
+ * functions, and as long as `this` and owner are the same, there will be no
802
+ * change in behavior.
803
+ * @param {*} source An annotation object (added by a transpiler or otherwise)
804
+ * indicating filename, line number, and/or other information.
805
+ * @internal
806
+ */
807
+
808
+
809
+ var ReactElement = function (type, key, ref, self, source, owner, props) {
810
+ var element = {
811
+ // This tag allows us to uniquely identify this as a React Element
812
+ $$typeof: REACT_ELEMENT_TYPE,
813
+ // Built-in properties that belong on the element
814
+ type: type,
815
+ key: key,
816
+ ref: ref,
817
+ props: props,
818
+ // Record the component responsible for creating this element.
819
+ _owner: owner
820
+ };
821
+
822
+ {
823
+ // The validation flag is currently mutative. We put it on
824
+ // an external backing store so that we can freeze the whole object.
825
+ // This can be replaced with a WeakMap once they are implemented in
826
+ // commonly used development environments.
827
+ element._store = {}; // To make comparing ReactElements easier for testing purposes, we make
828
+ // the validation flag non-enumerable (where possible, which should
829
+ // include every environment we run tests in), so the test framework
830
+ // ignores it.
831
+
832
+ Object.defineProperty(element._store, 'validated', {
833
+ configurable: false,
834
+ enumerable: false,
835
+ writable: true,
836
+ value: false
837
+ }); // self and source are DEV only properties.
838
+
839
+ Object.defineProperty(element, '_self', {
840
+ configurable: false,
841
+ enumerable: false,
842
+ writable: false,
843
+ value: self
844
+ }); // Two elements created in two different places should be considered
845
+ // equal for testing purposes and therefore we hide it from enumeration.
846
+
847
+ Object.defineProperty(element, '_source', {
848
+ configurable: false,
849
+ enumerable: false,
850
+ writable: false,
851
+ value: source
852
+ });
853
+
854
+ if (Object.freeze) {
855
+ Object.freeze(element.props);
856
+ Object.freeze(element);
857
+ }
858
+ }
859
+
860
+ return element;
861
+ };
862
+ /**
863
+ * Create and return a new ReactElement of the given type.
864
+ * See https://reactjs.org/docs/react-api.html#createelement
865
+ */
866
+
867
+ function createElement(type, config, children) {
868
+ var propName; // Reserved names are extracted
869
+
870
+ var props = {};
871
+ var key = null;
872
+ var ref = null;
873
+ var self = null;
874
+ var source = null;
875
+
876
+ if (config != null) {
877
+ if (hasValidRef(config)) {
878
+ ref = config.ref;
879
+
880
+ {
881
+ warnIfStringRefCannotBeAutoConverted(config);
882
+ }
883
+ }
884
+
885
+ if (hasValidKey(config)) {
886
+ key = '' + config.key;
887
+ }
888
+
889
+ self = config.__self === undefined ? null : config.__self;
890
+ source = config.__source === undefined ? null : config.__source; // Remaining properties are added to a new props object
891
+
892
+ for (propName in config) {
893
+ if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
894
+ props[propName] = config[propName];
895
+ }
896
+ }
897
+ } // Children can be more than one argument, and those are transferred onto
898
+ // the newly allocated props object.
899
+
900
+
901
+ var childrenLength = arguments.length - 2;
902
+
903
+ if (childrenLength === 1) {
904
+ props.children = children;
905
+ } else if (childrenLength > 1) {
906
+ var childArray = Array(childrenLength);
907
+
908
+ for (var i = 0; i < childrenLength; i++) {
909
+ childArray[i] = arguments[i + 2];
910
+ }
911
+
912
+ {
913
+ if (Object.freeze) {
914
+ Object.freeze(childArray);
915
+ }
916
+ }
917
+
918
+ props.children = childArray;
919
+ } // Resolve default props
920
+
921
+
922
+ if (type && type.defaultProps) {
923
+ var defaultProps = type.defaultProps;
924
+
925
+ for (propName in defaultProps) {
926
+ if (props[propName] === undefined) {
927
+ props[propName] = defaultProps[propName];
928
+ }
929
+ }
930
+ }
931
+
932
+ {
933
+ if (key || ref) {
934
+ var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
935
+
936
+ if (key) {
937
+ defineKeyPropWarningGetter(props, displayName);
938
+ }
939
+
940
+ if (ref) {
941
+ defineRefPropWarningGetter(props, displayName);
942
+ }
943
+ }
944
+ }
945
+
946
+ return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
947
+ }
948
+ function cloneAndReplaceKey(oldElement, newKey) {
949
+ var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props);
950
+ return newElement;
951
+ }
952
+ /**
953
+ * Clone and return a new ReactElement using element as the starting point.
954
+ * See https://reactjs.org/docs/react-api.html#cloneelement
955
+ */
956
+
957
+ function cloneElement(element, config, children) {
958
+ if (!!(element === null || element === undefined)) {
959
+ {
960
+ throw Error( "React.cloneElement(...): The argument must be a React element, but you passed " + element + "." );
961
+ }
962
+ }
963
+
964
+ var propName; // Original props are copied
965
+
966
+ var props = _assign({}, element.props); // Reserved names are extracted
967
+
968
+
969
+ var key = element.key;
970
+ var ref = element.ref; // Self is preserved since the owner is preserved.
971
+
972
+ var self = element._self; // Source is preserved since cloneElement is unlikely to be targeted by a
973
+ // transpiler, and the original source is probably a better indicator of the
974
+ // true owner.
975
+
976
+ var source = element._source; // Owner will be preserved, unless ref is overridden
977
+
978
+ var owner = element._owner;
979
+
980
+ if (config != null) {
981
+ if (hasValidRef(config)) {
982
+ // Silently steal the ref from the parent.
983
+ ref = config.ref;
984
+ owner = ReactCurrentOwner.current;
985
+ }
986
+
987
+ if (hasValidKey(config)) {
988
+ key = '' + config.key;
989
+ } // Remaining properties override existing props
990
+
991
+
992
+ var defaultProps;
993
+
994
+ if (element.type && element.type.defaultProps) {
995
+ defaultProps = element.type.defaultProps;
996
+ }
997
+
998
+ for (propName in config) {
999
+ if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
1000
+ if (config[propName] === undefined && defaultProps !== undefined) {
1001
+ // Resolve default props
1002
+ props[propName] = defaultProps[propName];
1003
+ } else {
1004
+ props[propName] = config[propName];
1005
+ }
1006
+ }
1007
+ }
1008
+ } // Children can be more than one argument, and those are transferred onto
1009
+ // the newly allocated props object.
1010
+
1011
+
1012
+ var childrenLength = arguments.length - 2;
1013
+
1014
+ if (childrenLength === 1) {
1015
+ props.children = children;
1016
+ } else if (childrenLength > 1) {
1017
+ var childArray = Array(childrenLength);
1018
+
1019
+ for (var i = 0; i < childrenLength; i++) {
1020
+ childArray[i] = arguments[i + 2];
1021
+ }
1022
+
1023
+ props.children = childArray;
1024
+ }
1025
+
1026
+ return ReactElement(element.type, key, ref, self, source, owner, props);
1027
+ }
1028
+ /**
1029
+ * Verifies the object is a ReactElement.
1030
+ * See https://reactjs.org/docs/react-api.html#isvalidelement
1031
+ * @param {?object} object
1032
+ * @return {boolean} True if `object` is a ReactElement.
1033
+ * @final
1034
+ */
1035
+
1036
+ function isValidElement(object) {
1037
+ return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
1038
+ }
1039
+
1040
+ var SEPARATOR = '.';
1041
+ var SUBSEPARATOR = ':';
1042
+ /**
1043
+ * Escape and wrap key so it is safe to use as a reactid
1044
+ *
1045
+ * @param {string} key to be escaped.
1046
+ * @return {string} the escaped key.
1047
+ */
1048
+
1049
+ function escape(key) {
1050
+ var escapeRegex = /[=:]/g;
1051
+ var escaperLookup = {
1052
+ '=': '=0',
1053
+ ':': '=2'
1054
+ };
1055
+ var escapedString = key.replace(escapeRegex, function (match) {
1056
+ return escaperLookup[match];
1057
+ });
1058
+ return '$' + escapedString;
1059
+ }
1060
+ /**
1061
+ * TODO: Test that a single child and an array with one item have the same key
1062
+ * pattern.
1063
+ */
1064
+
1065
+
1066
+ var didWarnAboutMaps = false;
1067
+ var userProvidedKeyEscapeRegex = /\/+/g;
1068
+
1069
+ function escapeUserProvidedKey(text) {
1070
+ return text.replace(userProvidedKeyEscapeRegex, '$&/');
1071
+ }
1072
+ /**
1073
+ * Generate a key string that identifies a element within a set.
1074
+ *
1075
+ * @param {*} element A element that could contain a manual key.
1076
+ * @param {number} index Index that is used if a manual key is not provided.
1077
+ * @return {string}
1078
+ */
1079
+
1080
+
1081
+ function getElementKey(element, index) {
1082
+ // Do some typechecking here since we call this blindly. We want to ensure
1083
+ // that we don't block potential future ES APIs.
1084
+ if (typeof element === 'object' && element !== null && element.key != null) {
1085
+ // Explicit key
1086
+ return escape('' + element.key);
1087
+ } // Implicit key determined by the index in the set
1088
+
1089
+
1090
+ return index.toString(36);
1091
+ }
1092
+
1093
+ function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) {
1094
+ var type = typeof children;
1095
+
1096
+ if (type === 'undefined' || type === 'boolean') {
1097
+ // All of the above are perceived as null.
1098
+ children = null;
1099
+ }
1100
+
1101
+ var invokeCallback = false;
1102
+
1103
+ if (children === null) {
1104
+ invokeCallback = true;
1105
+ } else {
1106
+ switch (type) {
1107
+ case 'string':
1108
+ case 'number':
1109
+ invokeCallback = true;
1110
+ break;
1111
+
1112
+ case 'object':
1113
+ switch (children.$$typeof) {
1114
+ case REACT_ELEMENT_TYPE:
1115
+ case REACT_PORTAL_TYPE:
1116
+ invokeCallback = true;
1117
+ }
1118
+
1119
+ }
1120
+ }
1121
+
1122
+ if (invokeCallback) {
1123
+ var _child = children;
1124
+ var mappedChild = callback(_child); // If it's the only child, treat the name as if it was wrapped in an array
1125
+ // so that it's consistent if the number of children grows:
1126
+
1127
+ var childKey = nameSoFar === '' ? SEPARATOR + getElementKey(_child, 0) : nameSoFar;
1128
+
1129
+ if (Array.isArray(mappedChild)) {
1130
+ var escapedChildKey = '';
1131
+
1132
+ if (childKey != null) {
1133
+ escapedChildKey = escapeUserProvidedKey(childKey) + '/';
1134
+ }
1135
+
1136
+ mapIntoArray(mappedChild, array, escapedChildKey, '', function (c) {
1137
+ return c;
1138
+ });
1139
+ } else if (mappedChild != null) {
1140
+ if (isValidElement(mappedChild)) {
1141
+ mappedChild = cloneAndReplaceKey(mappedChild, // Keep both the (mapped) and old keys if they differ, just as
1142
+ // traverseAllChildren used to do for objects as children
1143
+ escapedPrefix + ( // $FlowFixMe Flow incorrectly thinks React.Portal doesn't have a key
1144
+ mappedChild.key && (!_child || _child.key !== mappedChild.key) ? // $FlowFixMe Flow incorrectly thinks existing element's key can be a number
1145
+ escapeUserProvidedKey('' + mappedChild.key) + '/' : '') + childKey);
1146
+ }
1147
+
1148
+ array.push(mappedChild);
1149
+ }
1150
+
1151
+ return 1;
1152
+ }
1153
+
1154
+ var child;
1155
+ var nextName;
1156
+ var subtreeCount = 0; // Count of children found in the current subtree.
1157
+
1158
+ var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR;
1159
+
1160
+ if (Array.isArray(children)) {
1161
+ for (var i = 0; i < children.length; i++) {
1162
+ child = children[i];
1163
+ nextName = nextNamePrefix + getElementKey(child, i);
1164
+ subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback);
1165
+ }
1166
+ } else {
1167
+ var iteratorFn = getIteratorFn(children);
1168
+
1169
+ if (typeof iteratorFn === 'function') {
1170
+ var iterableChildren = children;
1171
+
1172
+ {
1173
+ // Warn about using Maps as children
1174
+ if (iteratorFn === iterableChildren.entries) {
1175
+ if (!didWarnAboutMaps) {
1176
+ warn('Using Maps as children is not supported. ' + 'Use an array of keyed ReactElements instead.');
1177
+ }
1178
+
1179
+ didWarnAboutMaps = true;
1180
+ }
1181
+ }
1182
+
1183
+ var iterator = iteratorFn.call(iterableChildren);
1184
+ var step;
1185
+ var ii = 0;
1186
+
1187
+ while (!(step = iterator.next()).done) {
1188
+ child = step.value;
1189
+ nextName = nextNamePrefix + getElementKey(child, ii++);
1190
+ subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback);
1191
+ }
1192
+ } else if (type === 'object') {
1193
+ var childrenString = '' + children;
1194
+
1195
+ {
1196
+ {
1197
+ throw Error( "Objects are not valid as a React child (found: " + (childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString) + "). If you meant to render a collection of children, use an array instead." );
1198
+ }
1199
+ }
1200
+ }
1201
+ }
1202
+
1203
+ return subtreeCount;
1204
+ }
1205
+
1206
+ /**
1207
+ * Maps children that are typically specified as `props.children`.
1208
+ *
1209
+ * See https://reactjs.org/docs/react-api.html#reactchildrenmap
1210
+ *
1211
+ * The provided mapFunction(child, index) will be called for each
1212
+ * leaf child.
1213
+ *
1214
+ * @param {?*} children Children tree container.
1215
+ * @param {function(*, int)} func The map function.
1216
+ * @param {*} context Context for mapFunction.
1217
+ * @return {object} Object containing the ordered map of results.
1218
+ */
1219
+ function mapChildren(children, func, context) {
1220
+ if (children == null) {
1221
+ return children;
1222
+ }
1223
+
1224
+ var result = [];
1225
+ var count = 0;
1226
+ mapIntoArray(children, result, '', '', function (child) {
1227
+ return func.call(context, child, count++);
1228
+ });
1229
+ return result;
1230
+ }
1231
+ /**
1232
+ * Count the number of children that are typically specified as
1233
+ * `props.children`.
1234
+ *
1235
+ * See https://reactjs.org/docs/react-api.html#reactchildrencount
1236
+ *
1237
+ * @param {?*} children Children tree container.
1238
+ * @return {number} The number of children.
1239
+ */
1240
+
1241
+
1242
+ function countChildren(children) {
1243
+ var n = 0;
1244
+ mapChildren(children, function () {
1245
+ n++; // Don't return anything
1246
+ });
1247
+ return n;
1248
+ }
1249
+
1250
+ /**
1251
+ * Iterates through children that are typically specified as `props.children`.
1252
+ *
1253
+ * See https://reactjs.org/docs/react-api.html#reactchildrenforeach
1254
+ *
1255
+ * The provided forEachFunc(child, index) will be called for each
1256
+ * leaf child.
1257
+ *
1258
+ * @param {?*} children Children tree container.
1259
+ * @param {function(*, int)} forEachFunc
1260
+ * @param {*} forEachContext Context for forEachContext.
1261
+ */
1262
+ function forEachChildren(children, forEachFunc, forEachContext) {
1263
+ mapChildren(children, function () {
1264
+ forEachFunc.apply(this, arguments); // Don't return anything.
1265
+ }, forEachContext);
1266
+ }
1267
+ /**
1268
+ * Flatten a children object (typically specified as `props.children`) and
1269
+ * return an array with appropriately re-keyed children.
1270
+ *
1271
+ * See https://reactjs.org/docs/react-api.html#reactchildrentoarray
1272
+ */
1273
+
1274
+
1275
+ function toArray(children) {
1276
+ return mapChildren(children, function (child) {
1277
+ return child;
1278
+ }) || [];
1279
+ }
1280
+ /**
1281
+ * Returns the first child in a collection of children and verifies that there
1282
+ * is only one child in the collection.
1283
+ *
1284
+ * See https://reactjs.org/docs/react-api.html#reactchildrenonly
1285
+ *
1286
+ * The current implementation of this function assumes that a single child gets
1287
+ * passed without a wrapper, but the purpose of this helper function is to
1288
+ * abstract away the particular structure of children.
1289
+ *
1290
+ * @param {?object} children Child collection structure.
1291
+ * @return {ReactElement} The first and only `ReactElement` contained in the
1292
+ * structure.
1293
+ */
1294
+
1295
+
1296
+ function onlyChild(children) {
1297
+ if (!isValidElement(children)) {
1298
+ {
1299
+ throw Error( "React.Children.only expected to receive a single React element child." );
1300
+ }
1301
+ }
1302
+
1303
+ return children;
1304
+ }
1305
+
1306
+ function createContext(defaultValue, calculateChangedBits) {
1307
+ if (calculateChangedBits === undefined) {
1308
+ calculateChangedBits = null;
1309
+ } else {
1310
+ {
1311
+ if (calculateChangedBits !== null && typeof calculateChangedBits !== 'function') {
1312
+ error('createContext: Expected the optional second argument to be a ' + 'function. Instead received: %s', calculateChangedBits);
1313
+ }
1314
+ }
1315
+ }
1316
+
1317
+ var context = {
1318
+ $$typeof: REACT_CONTEXT_TYPE,
1319
+ _calculateChangedBits: calculateChangedBits,
1320
+ // As a workaround to support multiple concurrent renderers, we categorize
1321
+ // some renderers as primary and others as secondary. We only expect
1322
+ // there to be two concurrent renderers at most: React Native (primary) and
1323
+ // Fabric (secondary); React DOM (primary) and React ART (secondary).
1324
+ // Secondary renderers store their context values on separate fields.
1325
+ _currentValue: defaultValue,
1326
+ _currentValue2: defaultValue,
1327
+ // Used to track how many concurrent renderers this context currently
1328
+ // supports within in a single renderer. Such as parallel server rendering.
1329
+ _threadCount: 0,
1330
+ // These are circular
1331
+ Provider: null,
1332
+ Consumer: null
1333
+ };
1334
+ context.Provider = {
1335
+ $$typeof: REACT_PROVIDER_TYPE,
1336
+ _context: context
1337
+ };
1338
+ var hasWarnedAboutUsingNestedContextConsumers = false;
1339
+ var hasWarnedAboutUsingConsumerProvider = false;
1340
+ var hasWarnedAboutDisplayNameOnConsumer = false;
1341
+
1342
+ {
1343
+ // A separate object, but proxies back to the original context object for
1344
+ // backwards compatibility. It has a different $$typeof, so we can properly
1345
+ // warn for the incorrect usage of Context as a Consumer.
1346
+ var Consumer = {
1347
+ $$typeof: REACT_CONTEXT_TYPE,
1348
+ _context: context,
1349
+ _calculateChangedBits: context._calculateChangedBits
1350
+ }; // $FlowFixMe: Flow complains about not setting a value, which is intentional here
1351
+
1352
+ Object.defineProperties(Consumer, {
1353
+ Provider: {
1354
+ get: function () {
1355
+ if (!hasWarnedAboutUsingConsumerProvider) {
1356
+ hasWarnedAboutUsingConsumerProvider = true;
1357
+
1358
+ error('Rendering <Context.Consumer.Provider> is not supported and will be removed in ' + 'a future major release. Did you mean to render <Context.Provider> instead?');
1359
+ }
1360
+
1361
+ return context.Provider;
1362
+ },
1363
+ set: function (_Provider) {
1364
+ context.Provider = _Provider;
1365
+ }
1366
+ },
1367
+ _currentValue: {
1368
+ get: function () {
1369
+ return context._currentValue;
1370
+ },
1371
+ set: function (_currentValue) {
1372
+ context._currentValue = _currentValue;
1373
+ }
1374
+ },
1375
+ _currentValue2: {
1376
+ get: function () {
1377
+ return context._currentValue2;
1378
+ },
1379
+ set: function (_currentValue2) {
1380
+ context._currentValue2 = _currentValue2;
1381
+ }
1382
+ },
1383
+ _threadCount: {
1384
+ get: function () {
1385
+ return context._threadCount;
1386
+ },
1387
+ set: function (_threadCount) {
1388
+ context._threadCount = _threadCount;
1389
+ }
1390
+ },
1391
+ Consumer: {
1392
+ get: function () {
1393
+ if (!hasWarnedAboutUsingNestedContextConsumers) {
1394
+ hasWarnedAboutUsingNestedContextConsumers = true;
1395
+
1396
+ error('Rendering <Context.Consumer.Consumer> is not supported and will be removed in ' + 'a future major release. Did you mean to render <Context.Consumer> instead?');
1397
+ }
1398
+
1399
+ return context.Consumer;
1400
+ }
1401
+ },
1402
+ displayName: {
1403
+ get: function () {
1404
+ return context.displayName;
1405
+ },
1406
+ set: function (displayName) {
1407
+ if (!hasWarnedAboutDisplayNameOnConsumer) {
1408
+ warn('Setting `displayName` on Context.Consumer has no effect. ' + "You should set it directly on the context with Context.displayName = '%s'.", displayName);
1409
+
1410
+ hasWarnedAboutDisplayNameOnConsumer = true;
1411
+ }
1412
+ }
1413
+ }
1414
+ }); // $FlowFixMe: Flow complains about missing properties because it doesn't understand defineProperty
1415
+
1416
+ context.Consumer = Consumer;
1417
+ }
1418
+
1419
+ {
1420
+ context._currentRenderer = null;
1421
+ context._currentRenderer2 = null;
1422
+ }
1423
+
1424
+ return context;
1425
+ }
1426
+
1427
+ var Uninitialized = -1;
1428
+ var Pending = 0;
1429
+ var Resolved = 1;
1430
+ var Rejected = 2;
1431
+
1432
+ function lazyInitializer(payload) {
1433
+ if (payload._status === Uninitialized) {
1434
+ var ctor = payload._result;
1435
+ var thenable = ctor(); // Transition to the next state.
1436
+
1437
+ var pending = payload;
1438
+ pending._status = Pending;
1439
+ pending._result = thenable;
1440
+ thenable.then(function (moduleObject) {
1441
+ if (payload._status === Pending) {
1442
+ var defaultExport = moduleObject.default;
1443
+
1444
+ {
1445
+ if (defaultExport === undefined) {
1446
+ error('lazy: Expected the result of a dynamic import() call. ' + 'Instead received: %s\n\nYour code should look like: \n ' + // Break up imports to avoid accidentally parsing them as dependencies.
1447
+ 'const MyComponent = lazy(() => imp' + "ort('./MyComponent'))", moduleObject);
1448
+ }
1449
+ } // Transition to the next state.
1450
+
1451
+
1452
+ var resolved = payload;
1453
+ resolved._status = Resolved;
1454
+ resolved._result = defaultExport;
1455
+ }
1456
+ }, function (error) {
1457
+ if (payload._status === Pending) {
1458
+ // Transition to the next state.
1459
+ var rejected = payload;
1460
+ rejected._status = Rejected;
1461
+ rejected._result = error;
1462
+ }
1463
+ });
1464
+ }
1465
+
1466
+ if (payload._status === Resolved) {
1467
+ return payload._result;
1468
+ } else {
1469
+ throw payload._result;
1470
+ }
1471
+ }
1472
+
1473
+ function lazy(ctor) {
1474
+ var payload = {
1475
+ // We use these fields to store the result.
1476
+ _status: -1,
1477
+ _result: ctor
1478
+ };
1479
+ var lazyType = {
1480
+ $$typeof: REACT_LAZY_TYPE,
1481
+ _payload: payload,
1482
+ _init: lazyInitializer
1483
+ };
1484
+
1485
+ {
1486
+ // In production, this would just set it on the object.
1487
+ var defaultProps;
1488
+ var propTypes; // $FlowFixMe
1489
+
1490
+ Object.defineProperties(lazyType, {
1491
+ defaultProps: {
1492
+ configurable: true,
1493
+ get: function () {
1494
+ return defaultProps;
1495
+ },
1496
+ set: function (newDefaultProps) {
1497
+ error('React.lazy(...): It is not supported to assign `defaultProps` to ' + 'a lazy component import. Either specify them where the component ' + 'is defined, or create a wrapping component around it.');
1498
+
1499
+ defaultProps = newDefaultProps; // Match production behavior more closely:
1500
+ // $FlowFixMe
1501
+
1502
+ Object.defineProperty(lazyType, 'defaultProps', {
1503
+ enumerable: true
1504
+ });
1505
+ }
1506
+ },
1507
+ propTypes: {
1508
+ configurable: true,
1509
+ get: function () {
1510
+ return propTypes;
1511
+ },
1512
+ set: function (newPropTypes) {
1513
+ error('React.lazy(...): It is not supported to assign `propTypes` to ' + 'a lazy component import. Either specify them where the component ' + 'is defined, or create a wrapping component around it.');
1514
+
1515
+ propTypes = newPropTypes; // Match production behavior more closely:
1516
+ // $FlowFixMe
1517
+
1518
+ Object.defineProperty(lazyType, 'propTypes', {
1519
+ enumerable: true
1520
+ });
1521
+ }
1522
+ }
1523
+ });
1524
+ }
1525
+
1526
+ return lazyType;
1527
+ }
1528
+
1529
+ function forwardRef(render) {
1530
+ {
1531
+ if (render != null && render.$$typeof === REACT_MEMO_TYPE) {
1532
+ error('forwardRef requires a render function but received a `memo` ' + 'component. Instead of forwardRef(memo(...)), use ' + 'memo(forwardRef(...)).');
1533
+ } else if (typeof render !== 'function') {
1534
+ error('forwardRef requires a render function but was given %s.', render === null ? 'null' : typeof render);
1535
+ } else {
1536
+ if (render.length !== 0 && render.length !== 2) {
1537
+ error('forwardRef render functions accept exactly two parameters: props and ref. %s', render.length === 1 ? 'Did you forget to use the ref parameter?' : 'Any additional parameter will be undefined.');
1538
+ }
1539
+ }
1540
+
1541
+ if (render != null) {
1542
+ if (render.defaultProps != null || render.propTypes != null) {
1543
+ error('forwardRef render functions do not support propTypes or defaultProps. ' + 'Did you accidentally pass a React component?');
1544
+ }
1545
+ }
1546
+ }
1547
+
1548
+ var elementType = {
1549
+ $$typeof: REACT_FORWARD_REF_TYPE,
1550
+ render: render
1551
+ };
1552
+
1553
+ {
1554
+ var ownName;
1555
+ Object.defineProperty(elementType, 'displayName', {
1556
+ enumerable: false,
1557
+ configurable: true,
1558
+ get: function () {
1559
+ return ownName;
1560
+ },
1561
+ set: function (name) {
1562
+ ownName = name;
1563
+
1564
+ if (render.displayName == null) {
1565
+ render.displayName = name;
1566
+ }
1567
+ }
1568
+ });
1569
+ }
1570
+
1571
+ return elementType;
1572
+ }
1573
+
1574
+ // Filter certain DOM attributes (e.g. src, href) if their values are empty strings.
1575
+
1576
+ var enableScopeAPI = false; // Experimental Create Event Handle API.
1577
+
1578
+ function isValidElementType(type) {
1579
+ if (typeof type === 'string' || typeof type === 'function') {
1580
+ return true;
1581
+ } // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).
1582
+
1583
+
1584
+ if (type === exports.Fragment || type === exports.Profiler || type === REACT_DEBUG_TRACING_MODE_TYPE || type === exports.StrictMode || type === exports.Suspense || type === REACT_SUSPENSE_LIST_TYPE || type === REACT_LEGACY_HIDDEN_TYPE || enableScopeAPI ) {
1585
+ return true;
1586
+ }
1587
+
1588
+ if (typeof type === 'object' && type !== null) {
1589
+ if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_BLOCK_TYPE || type[0] === REACT_SERVER_BLOCK_TYPE) {
1590
+ return true;
1591
+ }
1592
+ }
1593
+
1594
+ return false;
1595
+ }
1596
+
1597
+ function memo(type, compare) {
1598
+ {
1599
+ if (!isValidElementType(type)) {
1600
+ error('memo: The first argument must be a component. Instead ' + 'received: %s', type === null ? 'null' : typeof type);
1601
+ }
1602
+ }
1603
+
1604
+ var elementType = {
1605
+ $$typeof: REACT_MEMO_TYPE,
1606
+ type: type,
1607
+ compare: compare === undefined ? null : compare
1608
+ };
1609
+
1610
+ {
1611
+ var ownName;
1612
+ Object.defineProperty(elementType, 'displayName', {
1613
+ enumerable: false,
1614
+ configurable: true,
1615
+ get: function () {
1616
+ return ownName;
1617
+ },
1618
+ set: function (name) {
1619
+ ownName = name;
1620
+
1621
+ if (type.displayName == null) {
1622
+ type.displayName = name;
1623
+ }
1624
+ }
1625
+ });
1626
+ }
1627
+
1628
+ return elementType;
1629
+ }
1630
+
1631
+ function resolveDispatcher() {
1632
+ var dispatcher = ReactCurrentDispatcher.current;
1633
+
1634
+ if (!(dispatcher !== null)) {
1635
+ {
1636
+ throw Error( "Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem." );
1637
+ }
1638
+ }
1639
+
1640
+ return dispatcher;
1641
+ }
1642
+
1643
+ function useContext(Context, unstable_observedBits) {
1644
+ var dispatcher = resolveDispatcher();
1645
+
1646
+ {
1647
+ if (unstable_observedBits !== undefined) {
1648
+ error('useContext() second argument is reserved for future ' + 'use in React. Passing it is not supported. ' + 'You passed: %s.%s', unstable_observedBits, typeof unstable_observedBits === 'number' && Array.isArray(arguments[2]) ? '\n\nDid you call array.map(useContext)? ' + 'Calling Hooks inside a loop is not supported. ' + 'Learn more at https://reactjs.org/link/rules-of-hooks' : '');
1649
+ } // TODO: add a more generic warning for invalid values.
1650
+
1651
+
1652
+ if (Context._context !== undefined) {
1653
+ var realContext = Context._context; // Don't deduplicate because this legitimately causes bugs
1654
+ // and nobody should be using this in existing code.
1655
+
1656
+ if (realContext.Consumer === Context) {
1657
+ error('Calling useContext(Context.Consumer) is not supported, may cause bugs, and will be ' + 'removed in a future major release. Did you mean to call useContext(Context) instead?');
1658
+ } else if (realContext.Provider === Context) {
1659
+ error('Calling useContext(Context.Provider) is not supported. ' + 'Did you mean to call useContext(Context) instead?');
1660
+ }
1661
+ }
1662
+ }
1663
+
1664
+ return dispatcher.useContext(Context, unstable_observedBits);
1665
+ }
1666
+ function useState(initialState) {
1667
+ var dispatcher = resolveDispatcher();
1668
+ return dispatcher.useState(initialState);
1669
+ }
1670
+ function useReducer(reducer, initialArg, init) {
1671
+ var dispatcher = resolveDispatcher();
1672
+ return dispatcher.useReducer(reducer, initialArg, init);
1673
+ }
1674
+ function useRef(initialValue) {
1675
+ var dispatcher = resolveDispatcher();
1676
+ return dispatcher.useRef(initialValue);
1677
+ }
1678
+ function useEffect(create, deps) {
1679
+ var dispatcher = resolveDispatcher();
1680
+ return dispatcher.useEffect(create, deps);
1681
+ }
1682
+ function useLayoutEffect(create, deps) {
1683
+ var dispatcher = resolveDispatcher();
1684
+ return dispatcher.useLayoutEffect(create, deps);
1685
+ }
1686
+ function useCallback(callback, deps) {
1687
+ var dispatcher = resolveDispatcher();
1688
+ return dispatcher.useCallback(callback, deps);
1689
+ }
1690
+ function useMemo(create, deps) {
1691
+ var dispatcher = resolveDispatcher();
1692
+ return dispatcher.useMemo(create, deps);
1693
+ }
1694
+ function useImperativeHandle(ref, create, deps) {
1695
+ var dispatcher = resolveDispatcher();
1696
+ return dispatcher.useImperativeHandle(ref, create, deps);
1697
+ }
1698
+ function useDebugValue(value, formatterFn) {
1699
+ {
1700
+ var dispatcher = resolveDispatcher();
1701
+ return dispatcher.useDebugValue(value, formatterFn);
1702
+ }
1703
+ }
1704
+
1705
+ // Helpers to patch console.logs to avoid logging during side-effect free
1706
+ // replaying on render function. This currently only patches the object
1707
+ // lazily which won't cover if the log function was extracted eagerly.
1708
+ // We could also eagerly patch the method.
1709
+ var disabledDepth = 0;
1710
+ var prevLog;
1711
+ var prevInfo;
1712
+ var prevWarn;
1713
+ var prevError;
1714
+ var prevGroup;
1715
+ var prevGroupCollapsed;
1716
+ var prevGroupEnd;
1717
+
1718
+ function disabledLog() {}
1719
+
1720
+ disabledLog.__reactDisabledLog = true;
1721
+ function disableLogs() {
1722
+ {
1723
+ if (disabledDepth === 0) {
1724
+ /* eslint-disable react-internal/no-production-logging */
1725
+ prevLog = console.log;
1726
+ prevInfo = console.info;
1727
+ prevWarn = console.warn;
1728
+ prevError = console.error;
1729
+ prevGroup = console.group;
1730
+ prevGroupCollapsed = console.groupCollapsed;
1731
+ prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099
1732
+
1733
+ var props = {
1734
+ configurable: true,
1735
+ enumerable: true,
1736
+ value: disabledLog,
1737
+ writable: true
1738
+ }; // $FlowFixMe Flow thinks console is immutable.
1739
+
1740
+ Object.defineProperties(console, {
1741
+ info: props,
1742
+ log: props,
1743
+ warn: props,
1744
+ error: props,
1745
+ group: props,
1746
+ groupCollapsed: props,
1747
+ groupEnd: props
1748
+ });
1749
+ /* eslint-enable react-internal/no-production-logging */
1750
+ }
1751
+
1752
+ disabledDepth++;
1753
+ }
1754
+ }
1755
+ function reenableLogs() {
1756
+ {
1757
+ disabledDepth--;
1758
+
1759
+ if (disabledDepth === 0) {
1760
+ /* eslint-disable react-internal/no-production-logging */
1761
+ var props = {
1762
+ configurable: true,
1763
+ enumerable: true,
1764
+ writable: true
1765
+ }; // $FlowFixMe Flow thinks console is immutable.
1766
+
1767
+ Object.defineProperties(console, {
1768
+ log: _assign({}, props, {
1769
+ value: prevLog
1770
+ }),
1771
+ info: _assign({}, props, {
1772
+ value: prevInfo
1773
+ }),
1774
+ warn: _assign({}, props, {
1775
+ value: prevWarn
1776
+ }),
1777
+ error: _assign({}, props, {
1778
+ value: prevError
1779
+ }),
1780
+ group: _assign({}, props, {
1781
+ value: prevGroup
1782
+ }),
1783
+ groupCollapsed: _assign({}, props, {
1784
+ value: prevGroupCollapsed
1785
+ }),
1786
+ groupEnd: _assign({}, props, {
1787
+ value: prevGroupEnd
1788
+ })
1789
+ });
1790
+ /* eslint-enable react-internal/no-production-logging */
1791
+ }
1792
+
1793
+ if (disabledDepth < 0) {
1794
+ error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.');
1795
+ }
1796
+ }
1797
+ }
1798
+
1799
+ var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher;
1800
+ var prefix;
1801
+ function describeBuiltInComponentFrame(name, source, ownerFn) {
1802
+ {
1803
+ if (prefix === undefined) {
1804
+ // Extract the VM specific prefix used by each line.
1805
+ try {
1806
+ throw Error();
1807
+ } catch (x) {
1808
+ var match = x.stack.trim().match(/\n( *(at )?)/);
1809
+ prefix = match && match[1] || '';
1810
+ }
1811
+ } // We use the prefix to ensure our stacks line up with native stack frames.
1812
+
1813
+
1814
+ return '\n' + prefix + name;
1815
+ }
1816
+ }
1817
+ var reentry = false;
1818
+ var componentFrameCache;
1819
+
1820
+ {
1821
+ var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map;
1822
+ componentFrameCache = new PossiblyWeakMap();
1823
+ }
1824
+
1825
+ function describeNativeComponentFrame(fn, construct) {
1826
+ // If something asked for a stack inside a fake render, it should get ignored.
1827
+ if (!fn || reentry) {
1828
+ return '';
1829
+ }
1830
+
1831
+ {
1832
+ var frame = componentFrameCache.get(fn);
1833
+
1834
+ if (frame !== undefined) {
1835
+ return frame;
1836
+ }
1837
+ }
1838
+
1839
+ var control;
1840
+ reentry = true;
1841
+ var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe It does accept undefined.
1842
+
1843
+ Error.prepareStackTrace = undefined;
1844
+ var previousDispatcher;
1845
+
1846
+ {
1847
+ previousDispatcher = ReactCurrentDispatcher$1.current; // Set the dispatcher in DEV because this might be call in the render function
1848
+ // for warnings.
1849
+
1850
+ ReactCurrentDispatcher$1.current = null;
1851
+ disableLogs();
1852
+ }
1853
+
1854
+ try {
1855
+ // This should throw.
1856
+ if (construct) {
1857
+ // Something should be setting the props in the constructor.
1858
+ var Fake = function () {
1859
+ throw Error();
1860
+ }; // $FlowFixMe
1861
+
1862
+
1863
+ Object.defineProperty(Fake.prototype, 'props', {
1864
+ set: function () {
1865
+ // We use a throwing setter instead of frozen or non-writable props
1866
+ // because that won't throw in a non-strict mode function.
1867
+ throw Error();
1868
+ }
1869
+ });
1870
+
1871
+ if (typeof Reflect === 'object' && Reflect.construct) {
1872
+ // We construct a different control for this case to include any extra
1873
+ // frames added by the construct call.
1874
+ try {
1875
+ Reflect.construct(Fake, []);
1876
+ } catch (x) {
1877
+ control = x;
1878
+ }
1879
+
1880
+ Reflect.construct(fn, [], Fake);
1881
+ } else {
1882
+ try {
1883
+ Fake.call();
1884
+ } catch (x) {
1885
+ control = x;
1886
+ }
1887
+
1888
+ fn.call(Fake.prototype);
1889
+ }
1890
+ } else {
1891
+ try {
1892
+ throw Error();
1893
+ } catch (x) {
1894
+ control = x;
1895
+ }
1896
+
1897
+ fn();
1898
+ }
1899
+ } catch (sample) {
1900
+ // This is inlined manually because closure doesn't do it for us.
1901
+ if (sample && control && typeof sample.stack === 'string') {
1902
+ // This extracts the first frame from the sample that isn't also in the control.
1903
+ // Skipping one frame that we assume is the frame that calls the two.
1904
+ var sampleLines = sample.stack.split('\n');
1905
+ var controlLines = control.stack.split('\n');
1906
+ var s = sampleLines.length - 1;
1907
+ var c = controlLines.length - 1;
1908
+
1909
+ while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) {
1910
+ // We expect at least one stack frame to be shared.
1911
+ // Typically this will be the root most one. However, stack frames may be
1912
+ // cut off due to maximum stack limits. In this case, one maybe cut off
1913
+ // earlier than the other. We assume that the sample is longer or the same
1914
+ // and there for cut off earlier. So we should find the root most frame in
1915
+ // the sample somewhere in the control.
1916
+ c--;
1917
+ }
1918
+
1919
+ for (; s >= 1 && c >= 0; s--, c--) {
1920
+ // Next we find the first one that isn't the same which should be the
1921
+ // frame that called our sample function and the control.
1922
+ if (sampleLines[s] !== controlLines[c]) {
1923
+ // In V8, the first line is describing the message but other VMs don't.
1924
+ // If we're about to return the first line, and the control is also on the same
1925
+ // line, that's a pretty good indicator that our sample threw at same line as
1926
+ // the control. I.e. before we entered the sample frame. So we ignore this result.
1927
+ // This can happen if you passed a class to function component, or non-function.
1928
+ if (s !== 1 || c !== 1) {
1929
+ do {
1930
+ s--;
1931
+ c--; // We may still have similar intermediate frames from the construct call.
1932
+ // The next one that isn't the same should be our match though.
1933
+
1934
+ if (c < 0 || sampleLines[s] !== controlLines[c]) {
1935
+ // V8 adds a "new" prefix for native classes. Let's remove it to make it prettier.
1936
+ var _frame = '\n' + sampleLines[s].replace(' at new ', ' at ');
1937
+
1938
+ {
1939
+ if (typeof fn === 'function') {
1940
+ componentFrameCache.set(fn, _frame);
1941
+ }
1942
+ } // Return the line we found.
1943
+
1944
+
1945
+ return _frame;
1946
+ }
1947
+ } while (s >= 1 && c >= 0);
1948
+ }
1949
+
1950
+ break;
1951
+ }
1952
+ }
1953
+ }
1954
+ } finally {
1955
+ reentry = false;
1956
+
1957
+ {
1958
+ ReactCurrentDispatcher$1.current = previousDispatcher;
1959
+ reenableLogs();
1960
+ }
1961
+
1962
+ Error.prepareStackTrace = previousPrepareStackTrace;
1963
+ } // Fallback to just using the name if we couldn't make it throw.
1964
+
1965
+
1966
+ var name = fn ? fn.displayName || fn.name : '';
1967
+ var syntheticFrame = name ? describeBuiltInComponentFrame(name) : '';
1968
+
1969
+ {
1970
+ if (typeof fn === 'function') {
1971
+ componentFrameCache.set(fn, syntheticFrame);
1972
+ }
1973
+ }
1974
+
1975
+ return syntheticFrame;
1976
+ }
1977
+ function describeFunctionComponentFrame(fn, source, ownerFn) {
1978
+ {
1979
+ return describeNativeComponentFrame(fn, false);
1980
+ }
1981
+ }
1982
+
1983
+ function shouldConstruct(Component) {
1984
+ var prototype = Component.prototype;
1985
+ return !!(prototype && prototype.isReactComponent);
1986
+ }
1987
+
1988
+ function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) {
1989
+
1990
+ if (type == null) {
1991
+ return '';
1992
+ }
1993
+
1994
+ if (typeof type === 'function') {
1995
+ {
1996
+ return describeNativeComponentFrame(type, shouldConstruct(type));
1997
+ }
1998
+ }
1999
+
2000
+ if (typeof type === 'string') {
2001
+ return describeBuiltInComponentFrame(type);
2002
+ }
2003
+
2004
+ switch (type) {
2005
+ case exports.Suspense:
2006
+ return describeBuiltInComponentFrame('Suspense');
2007
+
2008
+ case REACT_SUSPENSE_LIST_TYPE:
2009
+ return describeBuiltInComponentFrame('SuspenseList');
2010
+ }
2011
+
2012
+ if (typeof type === 'object') {
2013
+ switch (type.$$typeof) {
2014
+ case REACT_FORWARD_REF_TYPE:
2015
+ return describeFunctionComponentFrame(type.render);
2016
+
2017
+ case REACT_MEMO_TYPE:
2018
+ // Memo may contain any component type so we recursively resolve it.
2019
+ return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn);
2020
+
2021
+ case REACT_BLOCK_TYPE:
2022
+ return describeFunctionComponentFrame(type._render);
2023
+
2024
+ case REACT_LAZY_TYPE:
2025
+ {
2026
+ var lazyComponent = type;
2027
+ var payload = lazyComponent._payload;
2028
+ var init = lazyComponent._init;
2029
+
2030
+ try {
2031
+ // Lazy may contain any component type so we recursively resolve it.
2032
+ return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn);
2033
+ } catch (x) {}
2034
+ }
2035
+ }
2036
+ }
2037
+
2038
+ return '';
2039
+ }
2040
+
2041
+ var loggedTypeFailures = {};
2042
+ var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
2043
+
2044
+ function setCurrentlyValidatingElement(element) {
2045
+ {
2046
+ if (element) {
2047
+ var owner = element._owner;
2048
+ var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
2049
+ ReactDebugCurrentFrame$1.setExtraStackFrame(stack);
2050
+ } else {
2051
+ ReactDebugCurrentFrame$1.setExtraStackFrame(null);
2052
+ }
2053
+ }
2054
+ }
2055
+
2056
+ function checkPropTypes(typeSpecs, values, location, componentName, element) {
2057
+ {
2058
+ // $FlowFixMe This is okay but Flow doesn't know it.
2059
+ var has = Function.call.bind(Object.prototype.hasOwnProperty);
2060
+
2061
+ for (var typeSpecName in typeSpecs) {
2062
+ if (has(typeSpecs, typeSpecName)) {
2063
+ var error$1 = void 0; // Prop type validation may throw. In case they do, we don't want to
2064
+ // fail the render phase where it didn't fail before. So we log it.
2065
+ // After these have been cleaned up, we'll let them throw.
2066
+
2067
+ try {
2068
+ // This is intentionally an invariant that gets caught. It's the same
2069
+ // behavior as without this statement except with a better message.
2070
+ if (typeof typeSpecs[typeSpecName] !== 'function') {
2071
+ var err = Error((componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' + 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' + 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.');
2072
+ err.name = 'Invariant Violation';
2073
+ throw err;
2074
+ }
2075
+
2076
+ error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED');
2077
+ } catch (ex) {
2078
+ error$1 = ex;
2079
+ }
2080
+
2081
+ if (error$1 && !(error$1 instanceof Error)) {
2082
+ setCurrentlyValidatingElement(element);
2083
+
2084
+ error('%s: type specification of %s' + ' `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', location, typeSpecName, typeof error$1);
2085
+
2086
+ setCurrentlyValidatingElement(null);
2087
+ }
2088
+
2089
+ if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {
2090
+ // Only monitor this failure once because there tends to be a lot of the
2091
+ // same error.
2092
+ loggedTypeFailures[error$1.message] = true;
2093
+ setCurrentlyValidatingElement(element);
2094
+
2095
+ error('Failed %s type: %s', location, error$1.message);
2096
+
2097
+ setCurrentlyValidatingElement(null);
2098
+ }
2099
+ }
2100
+ }
2101
+ }
2102
+ }
2103
+
2104
+ function setCurrentlyValidatingElement$1(element) {
2105
+ {
2106
+ if (element) {
2107
+ var owner = element._owner;
2108
+ var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
2109
+ setExtraStackFrame(stack);
2110
+ } else {
2111
+ setExtraStackFrame(null);
2112
+ }
2113
+ }
2114
+ }
2115
+
2116
+ var propTypesMisspellWarningShown;
2117
+
2118
+ {
2119
+ propTypesMisspellWarningShown = false;
2120
+ }
2121
+
2122
+ function getDeclarationErrorAddendum() {
2123
+ if (ReactCurrentOwner.current) {
2124
+ var name = getComponentName(ReactCurrentOwner.current.type);
2125
+
2126
+ if (name) {
2127
+ return '\n\nCheck the render method of `' + name + '`.';
2128
+ }
2129
+ }
2130
+
2131
+ return '';
2132
+ }
2133
+
2134
+ function getSourceInfoErrorAddendum(source) {
2135
+ if (source !== undefined) {
2136
+ var fileName = source.fileName.replace(/^.*[\\\/]/, '');
2137
+ var lineNumber = source.lineNumber;
2138
+ return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.';
2139
+ }
2140
+
2141
+ return '';
2142
+ }
2143
+
2144
+ function getSourceInfoErrorAddendumForProps(elementProps) {
2145
+ if (elementProps !== null && elementProps !== undefined) {
2146
+ return getSourceInfoErrorAddendum(elementProps.__source);
2147
+ }
2148
+
2149
+ return '';
2150
+ }
2151
+ /**
2152
+ * Warn if there's no key explicitly set on dynamic arrays of children or
2153
+ * object keys are not valid. This allows us to keep track of children between
2154
+ * updates.
2155
+ */
2156
+
2157
+
2158
+ var ownerHasKeyUseWarning = {};
2159
+
2160
+ function getCurrentComponentErrorInfo(parentType) {
2161
+ var info = getDeclarationErrorAddendum();
2162
+
2163
+ if (!info) {
2164
+ var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;
2165
+
2166
+ if (parentName) {
2167
+ info = "\n\nCheck the top-level render call using <" + parentName + ">.";
2168
+ }
2169
+ }
2170
+
2171
+ return info;
2172
+ }
2173
+ /**
2174
+ * Warn if the element doesn't have an explicit key assigned to it.
2175
+ * This element is in an array. The array could grow and shrink or be
2176
+ * reordered. All children that haven't already been validated are required to
2177
+ * have a "key" property assigned to it. Error statuses are cached so a warning
2178
+ * will only be shown once.
2179
+ *
2180
+ * @internal
2181
+ * @param {ReactElement} element Element that requires a key.
2182
+ * @param {*} parentType element's parent's type.
2183
+ */
2184
+
2185
+
2186
+ function validateExplicitKey(element, parentType) {
2187
+ if (!element._store || element._store.validated || element.key != null) {
2188
+ return;
2189
+ }
2190
+
2191
+ element._store.validated = true;
2192
+ var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
2193
+
2194
+ if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
2195
+ return;
2196
+ }
2197
+
2198
+ ownerHasKeyUseWarning[currentComponentErrorInfo] = true; // Usually the current owner is the offender, but if it accepts children as a
2199
+ // property, it may be the creator of the child that's responsible for
2200
+ // assigning it a key.
2201
+
2202
+ var childOwner = '';
2203
+
2204
+ if (element && element._owner && element._owner !== ReactCurrentOwner.current) {
2205
+ // Give the component that originally created this child.
2206
+ childOwner = " It was passed a child from " + getComponentName(element._owner.type) + ".";
2207
+ }
2208
+
2209
+ {
2210
+ setCurrentlyValidatingElement$1(element);
2211
+
2212
+ error('Each child in a list should have a unique "key" prop.' + '%s%s See https://reactjs.org/link/warning-keys for more information.', currentComponentErrorInfo, childOwner);
2213
+
2214
+ setCurrentlyValidatingElement$1(null);
2215
+ }
2216
+ }
2217
+ /**
2218
+ * Ensure that every element either is passed in a static location, in an
2219
+ * array with an explicit keys property defined, or in an object literal
2220
+ * with valid key property.
2221
+ *
2222
+ * @internal
2223
+ * @param {ReactNode} node Statically passed child of any type.
2224
+ * @param {*} parentType node's parent's type.
2225
+ */
2226
+
2227
+
2228
+ function validateChildKeys(node, parentType) {
2229
+ if (typeof node !== 'object') {
2230
+ return;
2231
+ }
2232
+
2233
+ if (Array.isArray(node)) {
2234
+ for (var i = 0; i < node.length; i++) {
2235
+ var child = node[i];
2236
+
2237
+ if (isValidElement(child)) {
2238
+ validateExplicitKey(child, parentType);
2239
+ }
2240
+ }
2241
+ } else if (isValidElement(node)) {
2242
+ // This element was passed in a valid location.
2243
+ if (node._store) {
2244
+ node._store.validated = true;
2245
+ }
2246
+ } else if (node) {
2247
+ var iteratorFn = getIteratorFn(node);
2248
+
2249
+ if (typeof iteratorFn === 'function') {
2250
+ // Entry iterators used to provide implicit keys,
2251
+ // but now we print a separate warning for them later.
2252
+ if (iteratorFn !== node.entries) {
2253
+ var iterator = iteratorFn.call(node);
2254
+ var step;
2255
+
2256
+ while (!(step = iterator.next()).done) {
2257
+ if (isValidElement(step.value)) {
2258
+ validateExplicitKey(step.value, parentType);
2259
+ }
2260
+ }
2261
+ }
2262
+ }
2263
+ }
2264
+ }
2265
+ /**
2266
+ * Given an element, validate that its props follow the propTypes definition,
2267
+ * provided by the type.
2268
+ *
2269
+ * @param {ReactElement} element
2270
+ */
2271
+
2272
+
2273
+ function validatePropTypes(element) {
2274
+ {
2275
+ var type = element.type;
2276
+
2277
+ if (type === null || type === undefined || typeof type === 'string') {
2278
+ return;
2279
+ }
2280
+
2281
+ var propTypes;
2282
+
2283
+ if (typeof type === 'function') {
2284
+ propTypes = type.propTypes;
2285
+ } else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here.
2286
+ // Inner props are checked in the reconciler.
2287
+ type.$$typeof === REACT_MEMO_TYPE)) {
2288
+ propTypes = type.propTypes;
2289
+ } else {
2290
+ return;
2291
+ }
2292
+
2293
+ if (propTypes) {
2294
+ // Intentionally inside to avoid triggering lazy initializers:
2295
+ var name = getComponentName(type);
2296
+ checkPropTypes(propTypes, element.props, 'prop', name, element);
2297
+ } else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {
2298
+ propTypesMisspellWarningShown = true; // Intentionally inside to avoid triggering lazy initializers:
2299
+
2300
+ var _name = getComponentName(type);
2301
+
2302
+ error('Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', _name || 'Unknown');
2303
+ }
2304
+
2305
+ if (typeof type.getDefaultProps === 'function' && !type.getDefaultProps.isReactClassApproved) {
2306
+ error('getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.');
2307
+ }
2308
+ }
2309
+ }
2310
+ /**
2311
+ * Given a fragment, validate that it can only be provided with fragment props
2312
+ * @param {ReactElement} fragment
2313
+ */
2314
+
2315
+
2316
+ function validateFragmentProps(fragment) {
2317
+ {
2318
+ var keys = Object.keys(fragment.props);
2319
+
2320
+ for (var i = 0; i < keys.length; i++) {
2321
+ var key = keys[i];
2322
+
2323
+ if (key !== 'children' && key !== 'key') {
2324
+ setCurrentlyValidatingElement$1(fragment);
2325
+
2326
+ error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);
2327
+
2328
+ setCurrentlyValidatingElement$1(null);
2329
+ break;
2330
+ }
2331
+ }
2332
+
2333
+ if (fragment.ref !== null) {
2334
+ setCurrentlyValidatingElement$1(fragment);
2335
+
2336
+ error('Invalid attribute `ref` supplied to `React.Fragment`.');
2337
+
2338
+ setCurrentlyValidatingElement$1(null);
2339
+ }
2340
+ }
2341
+ }
2342
+ function createElementWithValidation(type, props, children) {
2343
+ var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to
2344
+ // succeed and there will likely be errors in render.
2345
+
2346
+ if (!validType) {
2347
+ var info = '';
2348
+
2349
+ if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
2350
+ info += ' You likely forgot to export your component from the file ' + "it's defined in, or you might have mixed up default and named imports.";
2351
+ }
2352
+
2353
+ var sourceInfo = getSourceInfoErrorAddendumForProps(props);
2354
+
2355
+ if (sourceInfo) {
2356
+ info += sourceInfo;
2357
+ } else {
2358
+ info += getDeclarationErrorAddendum();
2359
+ }
2360
+
2361
+ var typeString;
2362
+
2363
+ if (type === null) {
2364
+ typeString = 'null';
2365
+ } else if (Array.isArray(type)) {
2366
+ typeString = 'array';
2367
+ } else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {
2368
+ typeString = "<" + (getComponentName(type.type) || 'Unknown') + " />";
2369
+ info = ' Did you accidentally export a JSX literal instead of a component?';
2370
+ } else {
2371
+ typeString = typeof type;
2372
+ }
2373
+
2374
+ {
2375
+ error('React.createElement: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', typeString, info);
2376
+ }
2377
+ }
2378
+
2379
+ var element = createElement.apply(this, arguments); // The result can be nullish if a mock or a custom function is used.
2380
+ // TODO: Drop this when these are no longer allowed as the type argument.
2381
+
2382
+ if (element == null) {
2383
+ return element;
2384
+ } // Skip key warning if the type isn't valid since our key validation logic
2385
+ // doesn't expect a non-string/function type and can throw confusing errors.
2386
+ // We don't want exception behavior to differ between dev and prod.
2387
+ // (Rendering will throw with a helpful message and as soon as the type is
2388
+ // fixed, the key warnings will appear.)
2389
+
2390
+
2391
+ if (validType) {
2392
+ for (var i = 2; i < arguments.length; i++) {
2393
+ validateChildKeys(arguments[i], type);
2394
+ }
2395
+ }
2396
+
2397
+ if (type === exports.Fragment) {
2398
+ validateFragmentProps(element);
2399
+ } else {
2400
+ validatePropTypes(element);
2401
+ }
2402
+
2403
+ return element;
2404
+ }
2405
+ var didWarnAboutDeprecatedCreateFactory = false;
2406
+ function createFactoryWithValidation(type) {
2407
+ var validatedFactory = createElementWithValidation.bind(null, type);
2408
+ validatedFactory.type = type;
2409
+
2410
+ {
2411
+ if (!didWarnAboutDeprecatedCreateFactory) {
2412
+ didWarnAboutDeprecatedCreateFactory = true;
2413
+
2414
+ warn('React.createFactory() is deprecated and will be removed in ' + 'a future major release. Consider using JSX ' + 'or use React.createElement() directly instead.');
2415
+ } // Legacy hook: remove it
2416
+
2417
+
2418
+ Object.defineProperty(validatedFactory, 'type', {
2419
+ enumerable: false,
2420
+ get: function () {
2421
+ warn('Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.');
2422
+
2423
+ Object.defineProperty(this, 'type', {
2424
+ value: type
2425
+ });
2426
+ return type;
2427
+ }
2428
+ });
2429
+ }
2430
+
2431
+ return validatedFactory;
2432
+ }
2433
+ function cloneElementWithValidation(element, props, children) {
2434
+ var newElement = cloneElement.apply(this, arguments);
2435
+
2436
+ for (var i = 2; i < arguments.length; i++) {
2437
+ validateChildKeys(arguments[i], newElement.type);
2438
+ }
2439
+
2440
+ validatePropTypes(newElement);
2441
+ return newElement;
2442
+ }
2443
+
2444
+ {
2445
+
2446
+ try {
2447
+ var frozenObject = Object.freeze({});
2448
+ /* eslint-disable no-new */
2449
+
2450
+ new Map([[frozenObject, null]]);
2451
+ new Set([frozenObject]);
2452
+ /* eslint-enable no-new */
2453
+ } catch (e) {
2454
+ }
2455
+ }
2456
+
2457
+ var createElement$1 = createElementWithValidation ;
2458
+ var cloneElement$1 = cloneElementWithValidation ;
2459
+ var createFactory = createFactoryWithValidation ;
2460
+ var Children = {
2461
+ map: mapChildren,
2462
+ forEach: forEachChildren,
2463
+ count: countChildren,
2464
+ toArray: toArray,
2465
+ only: onlyChild
2466
+ };
2467
+
2468
+ exports.Children = Children;
2469
+ exports.Component = Component;
2470
+ exports.PureComponent = PureComponent;
2471
+ exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactSharedInternals;
2472
+ exports.cloneElement = cloneElement$1;
2473
+ exports.createContext = createContext;
2474
+ exports.createElement = createElement$1;
2475
+ exports.createFactory = createFactory;
2476
+ exports.createRef = createRef;
2477
+ exports.forwardRef = forwardRef;
2478
+ exports.isValidElement = isValidElement;
2479
+ exports.lazy = lazy;
2480
+ exports.memo = memo;
2481
+ exports.useCallback = useCallback;
2482
+ exports.useContext = useContext;
2483
+ exports.useDebugValue = useDebugValue;
2484
+ exports.useEffect = useEffect;
2485
+ exports.useImperativeHandle = useImperativeHandle;
2486
+ exports.useLayoutEffect = useLayoutEffect;
2487
+ exports.useMemo = useMemo;
2488
+ exports.useReducer = useReducer;
2489
+ exports.useRef = useRef;
2490
+ exports.useState = useState;
2491
+ exports.version = ReactVersion;
2492
+ })();
2493
+ }
2494
+ });
2495
+ react_development.Fragment;
2496
+ react_development.StrictMode;
2497
+ react_development.Profiler;
2498
+ react_development.Suspense;
2499
+ react_development.Children;
2500
+ react_development.Component;
2501
+ react_development.PureComponent;
2502
+ react_development.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
2503
+ react_development.cloneElement;
2504
+ react_development.createContext;
2505
+ react_development.createElement;
2506
+ react_development.createFactory;
2507
+ react_development.createRef;
2508
+ react_development.forwardRef;
2509
+ react_development.isValidElement;
2510
+ react_development.lazy;
2511
+ react_development.memo;
2512
+ react_development.useCallback;
2513
+ react_development.useContext;
2514
+ react_development.useDebugValue;
2515
+ react_development.useEffect;
2516
+ react_development.useImperativeHandle;
2517
+ react_development.useLayoutEffect;
2518
+ react_development.useMemo;
2519
+ react_development.useReducer;
2520
+ react_development.useRef;
2521
+ react_development.useState;
2522
+ react_development.version;
2523
+
2524
+ createCommonjsModule(function (module) {
2525
+
2526
+ if (process.env.NODE_ENV === 'production') {
2527
+ module.exports = react_production_min;
2528
+ } else {
2529
+ module.exports = react_development;
2530
+ }
2531
+ });
2532
+
2533
+ function _createForOfIteratorHelper$1(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$1(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
2534
+
2535
+ function _unsupportedIterableToArray$1(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$1(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$1(o, minLen); }
2536
+
2537
+ function _arrayLikeToArray$1(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
2538
+
2539
+ /**
2540
+ * 生成fieldkey的正则
2541
+ * 根据a.0.b 返回/a.(\d+|$container).b/正则
2542
+ * @param arr <Array> 需要生成正则的数组
2543
+ * @returns 返回正则
2544
+ */
2545
+ var generateReg = function generateReg(arr) {
2546
+ var regStr = arr.reduce(function (prev, cur, index, arr) {
2547
+ if (Number.isNaN(parseInt(cur))) {
2548
+ return "".concat(prev).concat(index !== 0 ? '\\.' : '').concat(arr[index].replace(/\$/g, '\\$'));
2549
+ } else {
2550
+ return "".concat(index !== 0 ? "".concat(prev, "\\.") : '', "(").concat(cur, "|\\$container)");
2551
+ }
2552
+ }, '');
2553
+ return new RegExp("^".concat(regStr, "$"), 'ig');
2554
+ };
2555
+ /**
2556
+ * 用于删除、切换数组排序的arraykey
2557
+ * @param arr
2558
+ * @returns
2559
+ */
2560
+
2561
+ var generateArrayKeyReg = function generateArrayKeyReg(arr) {
2562
+ var regStr = arr.reduce(function (prev, cur, index) {
2563
+ if (index === arr.length - 1) {
2564
+ return "".concat(prev, ")\\.(\\d)+");
2565
+ }
2566
+
2567
+ return "".concat(index !== 0 ? "".concat(prev, "\\.") : '').concat(cur);
2568
+ });
2569
+ return new RegExp("^(".concat(regStr, "(\\..+)+"), 'ig');
2570
+ };
2571
+ /**
2572
+ * 基本数据类型检测
2573
+ * @param {unknown} checkVar 待检测的变量
2574
+ * @returns {string} 基本数据类型:Object | Array | String | Number | Boolean | Null | Undefined
2575
+ */
2576
+
2577
+ function typeCheck(checkVar) {
2578
+ var typeClass = Object.prototype.toString.call(checkVar);
2579
+ return typeClass.split(' ')[1].split(']')[0];
2580
+ }
2581
+ /**
2582
+ * 判断变量是否为空
2583
+ * @param checkVar
2584
+ */
2585
+
2586
+ function isEmpty(checkVar) {
2587
+ var empty = false;
2588
+ var varType = typeCheck(checkVar);
2589
+
2590
+ switch (varType) {
2591
+ case 'Number':
2592
+ case 'Boolean':
2593
+ empty = false;
2594
+ break;
2595
+
2596
+ case 'Null':
2597
+ case 'Undefined':
2598
+ empty = true;
2599
+ break;
2600
+
2601
+ case 'Array':
2602
+ case 'String':
2603
+ empty = checkVar.length === 0;
2604
+ break;
2605
+
2606
+ default:
2607
+ {
2608
+ var keys = Object.keys(checkVar);
2609
+ empty = keys.length === 0;
2610
+ }
2611
+ }
2612
+
2613
+ return empty;
2614
+ }
2615
+ /**
2616
+ * 设置data.a.b.c = value
2617
+ * 若data没有a.b 则依次赋值空对象,最后再将a.b.c设为value
2618
+ * @param {string} keys a.b.c
2619
+ * @param {object} data data.a.b.c
2620
+ * @param {unknown} value data.a.b.c = value
2621
+ * @param {object} typeMap 确定a.0.b.1中的0和1的父级应该是对象还是数组形式
2622
+ * @param parentKey
2623
+ */
2624
+
2625
+ var setDeepProp = function setDeepProp(keys, data, value, typeMap, parentKey) {
2626
+ if (keys.length === 0) {
2627
+ return;
2628
+ } // 取出keys的第一个元素作为当前待填充的key
2629
+
2630
+
2631
+ var curKey = keys.shift(); // data是否有当前key
2632
+
2633
+ if (keys.length > 0) {
2634
+ var hasKey = Object.keys(data).includes(curKey);
2635
+
2636
+ if (!hasKey) {
2637
+ if (typeMap) {
2638
+ var typeKey = Object.keys(typeMap).find(function (item) {
2639
+ return generateReg(parentKey ? parentKey.concat(curKey) : [curKey]).test(item);
2640
+ }); // 根据typeMap判断当前是数组还是对象,兜底逻辑为对象
2641
+
2642
+ if (typeKey) {
2643
+ switch (typeMap[typeKey].type) {
2644
+ case 'array':
2645
+ data[curKey] = [];
2646
+ break;
2647
+
2648
+ case 'object':
2649
+ data[curKey] = {};
2650
+ break;
2651
+ }
2652
+ }
2653
+ } else {
2654
+ // typeMap未定义当前curKey时,默认认为是对象
2655
+ data[curKey] = {};
2656
+ }
2657
+ }
2658
+
2659
+ setDeepProp(keys, data[curKey], value, typeMap, (parentKey || []).concat(curKey));
2660
+ } else {
2661
+ data[curKey] = value;
2662
+ }
2663
+ };
2664
+ /**
2665
+ * 删除data.a.b.c
2666
+ * 若data没有a.b.c,则不进行任何操作
2667
+ * @param {string} keys [a,b,c]
2668
+ * @param {object} data 需要删除的对象
2669
+ */
2670
+
2671
+ var deleteDeepProp = function deleteDeepProp(keys, data) {
2672
+ if (keys.length === 0) return; // 当前key
2673
+
2674
+ var curKey = keys.shift(); // data是否有当前key
2675
+
2676
+ var hasKey = Object.keys(data).includes(curKey);
2677
+
2678
+ if (keys.length > 0) {
2679
+ if (!hasKey) {
2680
+ return;
2681
+ }
2682
+
2683
+ deleteDeepProp(keys, data[curKey]);
2684
+ } else {
2685
+ if (Array.isArray(data) && !Number.isNaN(parseInt(curKey))) {
2686
+ data.splice(parseInt(curKey), 1);
2687
+ } else {
2688
+ delete data[curKey];
2689
+ }
2690
+ }
2691
+ };
2692
+ /**
2693
+ * 判断对象是否有某一属性,如没有,则根据valueType为其创建
2694
+ * 并返回最后一个key的校验生成后的value
2695
+ * @param {Map} source 源对象
2696
+ * @param {'array' | 'object'} valueType 创建的类型
2697
+ * @param {array} keys 对象的key值,支持...以拓展深层对象的创建
2698
+ */
2699
+
2700
+ var judgeAndRegister = function judgeAndRegister(source, valueType) {
2701
+ var currSource = source;
2702
+
2703
+ for (var _len = arguments.length, keys = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
2704
+ keys[_key - 2] = arguments[_key];
2705
+ }
2706
+
2707
+ for (var _i = 0, _keys = keys; _i < _keys.length; _i++) {
2708
+ var key = _keys[_i];
2709
+
2710
+ if (!Object.hasOwnProperty.call(currSource, key)) {
2711
+ currSource[key] = valueType === 'array' ? [] : {};
2712
+ }
2713
+
2714
+ currSource = currSource[key];
2715
+ }
2716
+
2717
+ return currSource;
2718
+ };
2719
+ /**
2720
+ * 允许循环引用的深拷贝
2721
+ * @param target
2722
+ * @param map
2723
+ */
2724
+
2725
+ function deepClone(target) {
2726
+ var map = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new WeakMap();
2727
+ if (map.get(target) || target === null || target === undefined) return target; // 针对Date和RegExp等特殊引用类型,直接执行构造函数进行克隆
2728
+
2729
+ var constructor = target.constructor;
2730
+
2731
+ if (/^(Date|RegExp)/.test(constructor.name)) {
2732
+ return new constructor(target);
2733
+ }
2734
+
2735
+ if (_typeof__default["default"](target) === 'object') {
2736
+ // 标记当前target已被处理过,避免递归过程中出现循环引用导致栈溢出的文日
2737
+ map.set(target, true);
2738
+ var res = Array.isArray(target) ? [] : {};
2739
+
2740
+ for (var i in target) {
2741
+ if (Object.hasOwnProperty.call(target, i)) {
2742
+ res[i] = deepClone(target[i], map);
2743
+ }
2744
+ }
2745
+
2746
+ return res;
2747
+ } else {
2748
+ return target;
2749
+ }
2750
+ }
2751
+ /**
2752
+ * 该方法用于快速向check的shcmea中注入vcontol。方便过滤已经设置的表单
2753
+ * @param obj 待注入vontrol的uiSchema对象
2754
+ */
2755
+
2756
+ function injectVcontrol(obj) {
2757
+ for (var i in obj) {
2758
+ if (Object.prototype.hasOwnProperty.call(obj, i)) {
2759
+ switch (typeCheck(i)) {
2760
+ case 'Array':
2761
+ // 数组的vcontrol统一设置在顶层
2762
+ break;
2763
+
2764
+ case 'Object':
2765
+ injectVcontrol(obj[i]);
2766
+ break;
2767
+
2768
+ default:
2769
+ {
2770
+ // 只有设置了fieldKey的才需要设置vcontrol和vcontrolDefault
2771
+ var fieldKey = obj.fieldKey;
2772
+
2773
+ if (fieldKey) {
2774
+ setDeepProp(['ui', 'vcontrol'], obj, 'const {fieldKey,formData,get}=props;return formData.viewMode==="configured"?typeof get(fieldKey).data!==\'number\'? get(fieldKey).data:true:true');
2775
+ }
2776
+
2777
+ break;
2778
+ }
2779
+ }
2780
+ }
2781
+ }
2782
+ }
2783
+ /**
2784
+ * 解析url中?后的参数,返回参数Map
2785
+ * @param url
2786
+ */
2787
+
2788
+ function parseHrefParam(url) {
2789
+ url = url || window.location.href;
2790
+ var parseUrl = /(.*)\?(.*)/.exec(url);
2791
+ var res = {};
2792
+
2793
+ if (parseUrl && parseUrl[2]) {
2794
+ var paramsList = parseUrl[2].split('&');
2795
+
2796
+ var _iterator = _createForOfIteratorHelper$1(paramsList),
2797
+ _step;
2798
+
2799
+ try {
2800
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
2801
+ var str = _step.value;
2802
+ var split = str.split('=');
2803
+ res[split[0]] = split[1] !== undefined ? split[1] : true;
2804
+ }
2805
+ } catch (err) {
2806
+ _iterator.e(err);
2807
+ } finally {
2808
+ _iterator.f();
2809
+ }
2810
+ }
2811
+
2812
+ return res;
2813
+ }
2814
+ function randomString(length) {
2815
+ var str = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
2816
+ var result = '';
2817
+
2818
+ for (var i = length; i > 0; --i) {
2819
+ result += str[Math.floor(Math.random() * str.length)];
2820
+ }
2821
+
2822
+ return result;
2823
+ }
2824
+ /**
2825
+ * 将大于等于零的整数number转成中文汉字
2826
+ */
2827
+
2828
+ var numChar = ['零', '一', '二', '三', '四', '五', '六', '七', '八', '九'];
2829
+ var unitChar = ['', '十', '百', '千'];
2830
+ var millionUnitChar = ['', '万', '亿', '万亿', '亿亿']; // 已万为处理段,该方法处理万以内的数字转成中文
2831
+
2832
+ function range2Chinese(range) {
2833
+ var numUnitChar = '';
2834
+ var tempStr = '';
2835
+ var unit = 0;
2836
+ var isNeedZero = true;
2837
+
2838
+ while (range > 0) {
2839
+ var currentNum = range % 10;
2840
+
2841
+ if (currentNum === 0) {
2842
+ if (!isNeedZero) {
2843
+ isNeedZero = true;
2844
+ tempStr = numChar[currentNum] + tempStr;
2845
+ }
2846
+ } else {
2847
+ isNeedZero = false;
2848
+ numUnitChar = numChar[currentNum];
2849
+ numUnitChar += unitChar[unit];
2850
+ tempStr = numUnitChar + tempStr;
2851
+ }
2852
+
2853
+ unit++;
2854
+ range = Math.floor(range / 10);
2855
+ }
2856
+
2857
+ return tempStr;
2858
+ }
2859
+
2860
+ function number2Chinese(num) {
2861
+ var millionUnit = 0;
2862
+ var tempStr = '';
2863
+ var resStr = '';
2864
+ var isNeedZero = false;
2865
+
2866
+ if (num === 0) {
2867
+ return numChar[0];
2868
+ }
2869
+
2870
+ while (num > 0) {
2871
+ var range = num % 10000;
2872
+
2873
+ if (isNeedZero) {
2874
+ resStr = numChar[0] + resStr;
2875
+ }
2876
+
2877
+ tempStr = range2Chinese(range);
2878
+ tempStr += range !== 0 ? millionUnitChar[millionUnit] : millionUnitChar[0];
2879
+ resStr = tempStr + resStr;
2880
+ isNeedZero = range < 1000 && range > 0;
2881
+ num = Math.floor(num / 10000);
2882
+ millionUnit++;
2883
+ }
2884
+
2885
+ return resStr;
2886
+ } // TODO 更新Read more文档
2887
+
2888
+ function upgradeTips(oldApiName, newApiName) {
2889
+ console.warn("".concat(oldApiName, ": The current usage is about to discard after the next main version is upgraded, please use ").concat(newApiName, "! "));
2890
+ } // 转换数组
2891
+
2892
+ function toArray(param) {
2893
+ return Array.isArray(param) ? param : [param];
2894
+ } // 处理容器宽度
2895
+
2896
+ var handleMargin = function handleMargin(style) {
2897
+ var margin = style.margin,
2898
+ width = style.width;
2899
+ var marginRight = style.marginRight || '0px';
2900
+ var marginLeft = style.marginLeft || '0px';
2901
+
2902
+ if (width) {
2903
+ if (margin) {
2904
+ if (typeof margin === 'string') {
2905
+ var marginArr = margin.trim().split(' ');
2906
+
2907
+ if (marginArr.length === 1) {
2908
+ marginRight = margin;
2909
+ marginLeft = margin;
2910
+ }
2911
+
2912
+ if (marginArr.length === 2 || marginArr.length === 3) {
2913
+ marginRight = marginArr[1];
2914
+ marginLeft = marginArr[1];
2915
+ }
2916
+
2917
+ if (marginArr.length === 4) {
2918
+ marginRight = marginArr[1];
2919
+ marginLeft = marginArr[3];
2920
+ }
2921
+ }
2922
+ }
2923
+
2924
+ marginRight = marginRight === '0' ? '0px' : marginRight;
2925
+ marginLeft = marginLeft === '0' ? '0px' : marginLeft;
2926
+ style.width = "calc(".concat(style.width, " - ").concat(marginRight, " - ").concat(marginLeft, ")");
2927
+ }
2928
+ };
2929
+ /**
2930
+ * 根据uiSchema,获取当前schem相对的主题和组件类型
2931
+ * @param uiSchema
2932
+ * @returns
2933
+ */
2934
+
2935
+ var getThemeAndType = function getThemeAndType(uiSchema) {
2936
+ var type = uiSchema.type,
2937
+ theme = uiSchema.theme;
2938
+
2939
+ var _type$split = type.split('::'),
2940
+ _type$split2 = _slicedToArray__default["default"](_type$split, 2),
2941
+ newType = _type$split2[1]; // v0未区分容器和组件概念,需要做判断
2942
+
2943
+
2944
+ if (['root', 'object', 'array'].includes(newType || type)) {
2945
+ return newType || type;
2946
+ } else {
2947
+ return newType ? type : "".concat(theme, "::").concat(type);
2948
+ }
2949
+ };
2950
+ function isValidHttpUrl(string) {
2951
+ var url;
2952
+
2953
+ try {
2954
+ url = new URL(string);
2955
+ } catch (_) {
2956
+ return false;
2957
+ }
2958
+
2959
+ return url.protocol === 'http:' || url.protocol === 'https:';
2960
+ }
2961
+ function removeSpaceAndmakeStringCamelCase(string) {
2962
+ var regex = /\s+(\w)?/gi;
2963
+ var output = string.toLowerCase().replace(regex, function (match, letter) {
2964
+ return letter ? letter.toUpperCase() : '';
2965
+ });
2966
+ return output;
2967
+ }
2968
+
2969
+ /**
2970
+ * 将二进制流数据转成base64格式的数据
2971
+ *
2972
+ * @param file
2973
+ */
2974
+ function binaryData2Blob(file) {
2975
+ return new Promise(function (resolve, reject) {
2976
+ var reader = new FileReader();
2977
+ reader.readAsDataURL(file);
2978
+
2979
+ reader.onload = function () {
2980
+ resolve(this.result);
2981
+ };
2982
+
2983
+ reader.onerror = function (err) {
2984
+ reject(err);
2985
+ };
2986
+ });
2987
+ }
2988
+ /**
2989
+ * 将base64g格式的图片地址转成img图片对象
2990
+ *
2991
+ * @param {string} imgBase64Url
2992
+ */
2993
+
2994
+ function getImgEl(imgBase64Url) {
2995
+ return new Promise(function (resolve, reject) {
2996
+ var img = new Image();
2997
+
2998
+ img.onload = function () {
2999
+ resolve(img);
3000
+ };
3001
+
3002
+ img.onerror = function (err) {
3003
+ reject(err);
3004
+ };
3005
+
3006
+ img.src = imgBase64Url;
3007
+ });
3008
+ } // 尺寸限制
3009
+
3010
+ var isValidFileUploaded = function isValidFileUploaded(file) {
3011
+ var accept = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
3012
+
3013
+ if (accept) {
3014
+ var validExtensions = accept.split(',');
3015
+ var fileExtension = file.type.split('/')[1];
3016
+ var fileName = file.name.split('.');
3017
+ var fileNameExtension = '';
3018
+
3019
+ if (fileName.length) {
3020
+ fileNameExtension = fileName[fileName.length - 1];
3021
+ }
3022
+
3023
+ return validExtensions.includes(".".concat(fileExtension)) || validExtensions.includes(".".concat(fileNameExtension));
3024
+ }
3025
+
3026
+ return true;
3027
+ };
3028
+
3029
+ function checkImg(_x) {
3030
+ return _checkImg.apply(this, arguments);
3031
+ }
3032
+
3033
+ function _checkImg() {
3034
+ _checkImg = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee(_ref) {
3035
+ var file, dimension, size, accept, errMsg, isOk, errors, _ref2, width, height, minWidth, minHeight, maxWidth, maxHeight, widthDivisor, heightDivisor, widthHeightEqual, _ref3, max, min, imgBase64Url, _yield$getImgEl, naturalHeight, naturalWidth, count, _size, message;
3036
+
3037
+ return _regeneratorRuntime__default["default"].wrap(function _callee$(_context) {
3038
+ while (1) {
3039
+ switch (_context.prev = _context.next) {
3040
+ case 0:
3041
+ file = _ref.file, dimension = _ref.dimension, size = _ref.size, accept = _ref.accept, errMsg = _ref.errMsg;
3042
+ isOk = true;
3043
+ errors = [];
3044
+ _ref2 = dimension || {}, width = _ref2.width, height = _ref2.height, minWidth = _ref2.minWidth, minHeight = _ref2.minHeight, maxWidth = _ref2.maxWidth, maxHeight = _ref2.maxHeight, widthDivisor = _ref2.widthDivisor, heightDivisor = _ref2.heightDivisor, widthHeightEqual = _ref2.widthHeightEqual;
3045
+ _ref3 = size || {}, max = _ref3.max, min = _ref3.min; // 尺寸校验
3046
+
3047
+ _context.prev = 5;
3048
+ _context.next = 8;
3049
+ return binaryData2Blob(file);
3050
+
3051
+ case 8:
3052
+ imgBase64Url = _context.sent;
3053
+
3054
+ if (!imgBase64Url) {
3055
+ _context.next = 35;
3056
+ break;
3057
+ }
3058
+
3059
+ _context.next = 12;
3060
+ return getImgEl(imgBase64Url);
3061
+
3062
+ case 12:
3063
+ _yield$getImgEl = _context.sent;
3064
+ naturalHeight = _yield$getImgEl.naturalHeight;
3065
+ naturalWidth = _yield$getImgEl.naturalWidth;
3066
+ count = 0;
3067
+ width && count++;
3068
+ minWidth && count++;
3069
+ maxWidth && count++;
3070
+ widthDivisor && count++;
3071
+ height && count++;
3072
+ minHeight && count++;
3073
+ maxHeight && count++;
3074
+ heightDivisor && count++;
3075
+ widthHeightEqual && count++;
3076
+ if (width && width === naturalWidth) count--;
3077
+ if (minWidth && minWidth <= naturalWidth) count--;
3078
+ if (maxWidth && maxWidth >= naturalWidth) count--;
3079
+ if (widthDivisor && naturalWidth % widthDivisor === 0) count--;
3080
+ if (height && height === naturalHeight) count--;
3081
+ if (minHeight && minHeight <= naturalHeight) count--;
3082
+ if (maxHeight && maxHeight >= naturalHeight) count--;
3083
+ if (heightDivisor && naturalHeight % heightDivisor === 0) count--;
3084
+ if (widthHeightEqual === true && naturalHeight === naturalWidth) count--;
3085
+
3086
+ if (count !== 0) {
3087
+ errors.push((errMsg === null || errMsg === void 0 ? void 0 : errMsg.dimension) || '图片尺寸校验未通过');
3088
+ isOk = false;
3089
+ }
3090
+
3091
+ case 35:
3092
+ _context.next = 40;
3093
+ break;
3094
+
3095
+ case 37:
3096
+ _context.prev = 37;
3097
+ _context.t0 = _context["catch"](5);
3098
+ console.error(_context.t0);
3099
+
3100
+ case 40:
3101
+ // 大小校验
3102
+ if (min && min >= file.size) {
3103
+ errors.push((errMsg === null || errMsg === void 0 ? void 0 : errMsg.size) || '图片大小校验未通过');
3104
+ isOk = false;
3105
+ } else if (max && max * 1024 <= file.size) {
3106
+ _size = file.size;
3107
+ message = '';
3108
+
3109
+ if (max > 1024) {
3110
+ _size = max / 1024;
3111
+ message = "".concat(_size.toFixed(1), " mb");
3112
+ } else {
3113
+ message = "".concat(max, " kb");
3114
+ }
3115
+
3116
+ errors.push((errMsg === null || errMsg === void 0 ? void 0 : errMsg.size) || "File size exceeds limit, the file must be smaller than ".concat(message));
3117
+ isOk = false;
3118
+ }
3119
+
3120
+ if (!isValidFileUploaded(file, accept || '')) {
3121
+ errors.push((errMsg === null || errMsg === void 0 ? void 0 : errMsg.type) || 'File type is not supported');
3122
+ isOk = false;
3123
+ }
3124
+
3125
+ return _context.abrupt("return", {
3126
+ isOk: isOk,
3127
+ errors: errors
3128
+ });
3129
+
3130
+ case 43:
3131
+ case "end":
3132
+ return _context.stop();
3133
+ }
3134
+ }
3135
+ }, _callee, null, [[5, 37]]);
3136
+ }));
3137
+ return _checkImg.apply(this, arguments);
3138
+ }
3139
+
3140
+ /**
3141
+ * 递归解析
3142
+ */
3143
+ function initParse(_ref) {
3144
+ var unitedSchema = _ref.unitedSchema,
3145
+ parentType = _ref.parentType,
3146
+ idx = _ref.idx,
3147
+ parentUiSchema = _ref.parentUiSchema,
3148
+ parentDataSchema = _ref.parentDataSchema,
3149
+ customProps = _ref.customProps,
3150
+ typePath = _ref.typePath,
3151
+ _ref$parentTypePath = _ref.parentTypePath,
3152
+ parentTypePath = _ref$parentTypePath === void 0 ? '' : _ref$parentTypePath,
3153
+ index = _ref.index;
3154
+ // 当前uiSchema
3155
+ var curUiSchema = parentUiSchema; // 当前dataSchema
3156
+
3157
+ var curDataSchema = parentDataSchema; // 当前的typePath的key
3158
+
3159
+ var curTypePath = parentTypePath; // 非第一次调用initParse
3160
+
3161
+ if (idx) {
3162
+ var _typePath$parentTypeP, _typePath$parentTypeP2;
3163
+
3164
+ // 设置typePath
3165
+ curTypePath = parentTypePath ? "".concat(parentTypePath, ".").concat(idx) : idx;
3166
+ typePath[curTypePath] = {
3167
+ fatherKey: parentTypePath,
3168
+ title: unitedSchema.title || '',
3169
+ type: unitedSchema.type,
3170
+ unitedSchemaKey: "".concat((_typePath$parentTypeP = typePath[parentTypePath]) !== null && _typePath$parentTypeP !== void 0 && _typePath$parentTypeP.unitedSchemaKey ? "".concat((_typePath$parentTypeP2 = typePath[parentTypePath]) === null || _typePath$parentTypeP2 === void 0 ? void 0 : _typePath$parentTypeP2.unitedSchemaKey, ".") : '').concat(parentType == 'object' ? 'schema' : 'items').concat(index !== '$container' ? ".".concat(index) : '')
3171
+ };
3172
+ } else {
3173
+ // 设置根元素的typePath
3174
+ if (unitedSchema.fieldKey) {
3175
+ typePath[unitedSchema.fieldKey] = {
3176
+ type: unitedSchema.type,
3177
+ unitedSchemaKey: '',
3178
+ fatherKey: ''
3179
+ };
3180
+ } // 根元素type默认为object
3181
+
3182
+
3183
+ curDataSchema.type = 'object';
3184
+ } // ui:开头的
3185
+
3186
+
3187
+ var uiReg = /^ui:/; // 是否是uiSchema中的属性
3188
+
3189
+ var isUiProp = function isUiProp(key) {
3190
+ // 需要丢到uiSchema中的属性
3191
+ var uiSchemaKeys = ['footer', 'theme', 'containerStyle', 'formMode', 'ui'];
3192
+ return uiSchemaKeys.includes(key) || uiReg.test(key);
3193
+ };
3194
+
3195
+ Object.entries(unitedSchema).map(function (_ref2) {
3196
+ var _ref3 = _slicedToArray__default["default"](_ref2, 2),
3197
+ key = _ref3[0],
3198
+ value = _ref3[1];
3199
+
3200
+ // 设置uiSchema
3201
+ if (isUiProp(key)) {
3202
+ // 非第一次调用initParse
3203
+ if (idx) {
3204
+ var path = ['properties', idx];
3205
+ setDeepProp(path, parentUiSchema, {});
3206
+ curUiSchema = parentUiSchema.properties[idx]; // 设置order
3207
+
3208
+ var order = ___default["default"].get(parentUiSchema, 'order', []); // 避免重复fieldKey
3209
+
3210
+
3211
+ if (!order.includes(idx)) {
3212
+ order.push(idx);
3213
+ }
3214
+
3215
+ parentUiSchema.order = order;
3216
+ } // 设置ui:开头的ui属性,ui:{}优先级更高
3217
+
3218
+
3219
+ if (uiReg.test(key)) {
3220
+ curUiSchema[key.slice(3)] = ((unitedSchema === null || unitedSchema === void 0 ? void 0 : unitedSchema.ui) || {})[key.slice(3)] || value;
3221
+ } else if (key === 'ui') {
3222
+ // 设置ui:{}中的属性
3223
+ Object.entries(value).map(function (_ref4) {
3224
+ var _ref5 = _slicedToArray__default["default"](_ref4, 2),
3225
+ key = _ref5[0],
3226
+ value = _ref5[1];
3227
+
3228
+ curUiSchema[key] = value;
3229
+ });
3230
+ } else {
3231
+ curUiSchema[key] = value;
3232
+ }
3233
+ } else {
3234
+ // 设置dataSchema
3235
+ // 非第一次调用initParse
3236
+ if (idx) {
3237
+ switch (parentType) {
3238
+ case 'object':
3239
+ {
3240
+ var _path = ['properties', idx];
3241
+ setDeepProp(_path, parentDataSchema, ___default["default"].get(parentDataSchema, _path, {}));
3242
+ curDataSchema = parentDataSchema.properties[idx];
3243
+ break;
3244
+ }
3245
+
3246
+ case 'array':
3247
+ {
3248
+ var _path2 = ['items'];
3249
+ setDeepProp(['items'], parentDataSchema, ___default["default"].get(parentDataSchema, _path2, {}));
3250
+ curDataSchema = parentDataSchema.items;
3251
+ break;
3252
+ }
3253
+
3254
+ case 'tuple':
3255
+ {
3256
+ var _path3 = ['items', idx];
3257
+ setDeepProp(_path3, parentDataSchema, ___default["default"].get(parentDataSchema, _path3, {}), {
3258
+ items: {
3259
+ type: 'array'
3260
+ }
3261
+ });
3262
+ curDataSchema = parentDataSchema.items[Number(idx)];
3263
+ break;
3264
+ }
3265
+ }
3266
+ }
3267
+
3268
+ switch (key) {
3269
+ case 'requiredMsg':
3270
+ // 设置父级,只有对象才有
3271
+ if (parentType === 'object' && idx) {
3272
+ // 设置order
3273
+ var required = ___default["default"].get(parentDataSchema, 'required', []); // 避免重复fieldKey
3274
+
3275
+
3276
+ if (!required.includes(idx)) {
3277
+ required.push(idx);
3278
+ }
3279
+
3280
+ parentDataSchema.required = required;
3281
+ setDeepProp(['errorMessage', 'required', idx], parentDataSchema, value);
3282
+ }
3283
+
3284
+ break;
3285
+ // 错误信息配置
3286
+
3287
+ case 'errMsg':
3288
+ curDataSchema.errorMessage = value;
3289
+ break;
3290
+ // 以下字段 items、 schema、fieldKey 不设置到dataSchema中
3291
+
3292
+ case 'items':
3293
+ case 'schema':
3294
+ case 'fieldKey':
3295
+ break;
3296
+
3297
+ default:
3298
+ // 设置customProps
3299
+ if (/^\$:/.test(key)) {
3300
+ customProps.push(key);
3301
+ }
3302
+
3303
+ curDataSchema[key] = value;
3304
+ break;
3305
+ }
3306
+ }
3307
+ }); // 当前表单嵌套类型 'schema'为object|'items'为array
3308
+
3309
+ var type = 'object';
3310
+
3311
+ if (unitedSchema.items) {
3312
+ type = 'array';
3313
+ }
3314
+
3315
+ switch (type) {
3316
+ case 'object':
3317
+ {
3318
+ var _unitedSchema$schema;
3319
+
3320
+ // 处理通用逻辑
3321
+ // 对schema处理(子表单处理,递归)
3322
+ (_unitedSchema$schema = unitedSchema.schema) === null || _unitedSchema$schema === void 0 ? void 0 : _unitedSchema$schema.map(function (childUnitedSchema, i) {
3323
+ initParse({
3324
+ unitedSchema: childUnitedSchema,
3325
+ idx: childUnitedSchema.fieldKey,
3326
+ parentType: 'object',
3327
+ parentUiSchema: curUiSchema,
3328
+ parentDataSchema: curDataSchema,
3329
+ parentTypePath: curTypePath,
3330
+ customProps: customProps,
3331
+ typePath: typePath,
3332
+ index: i
3333
+ });
3334
+ });
3335
+ break;
3336
+ }
3337
+
3338
+ case 'array':
3339
+ {
3340
+ // 处理通用逻辑
3341
+ // 对items处理(子表单处理,递归)
3342
+ var item = unitedSchema.items;
3343
+
3344
+ var _type = typeCheck(item); // 普通数组
3345
+
3346
+
3347
+ if (_type === 'Object') {
3348
+ initParse({
3349
+ unitedSchema: item,
3350
+ idx: '$container',
3351
+ parentType: 'array',
3352
+ parentUiSchema: curUiSchema,
3353
+ parentDataSchema: curDataSchema,
3354
+ customProps: customProps,
3355
+ typePath: typePath,
3356
+ parentTypePath: curTypePath,
3357
+ index: '$container'
3358
+ });
3359
+ } else if (_type === 'Array') {
3360
+ // 元祖
3361
+ item === null || item === void 0 ? void 0 : item.map(function (childUnitedSchema, i) {
3362
+ initParse({
3363
+ unitedSchema: childUnitedSchema,
3364
+ idx: String(i),
3365
+ parentType: 'tuple',
3366
+ parentUiSchema: curUiSchema,
3367
+ parentDataSchema: curDataSchema,
3368
+ customProps: customProps,
3369
+ typePath: typePath,
3370
+ parentTypePath: curTypePath,
3371
+ index: i
3372
+ });
3373
+ });
3374
+ }
3375
+
3376
+ break;
3377
+ }
3378
+ }
3379
+ }
3380
+ /**
3381
+ * 解析联合Schema
3382
+ * @param unitedSchema
3383
+ */
3384
+
3385
+
3386
+ var parseUnitedSchema = function parseUnitedSchema(unitedSchema) {
3387
+ var dataSchema = {};
3388
+ var uiSchema = {}; // 用来存储每个表单项对应的type值,如果是嵌套格式,则解析为 { a: 'object', 'a.b': 'object', 'a.b.c': 'array' }
3389
+
3390
+ var typePath = {}; // $:的自定义属性,仅统计dataSchema的
3391
+
3392
+ var customProps = [];
3393
+ initParse({
3394
+ unitedSchema: unitedSchema,
3395
+ parentUiSchema: uiSchema,
3396
+ parentDataSchema: dataSchema,
3397
+ customProps: customProps,
3398
+ typePath: typePath
3399
+ });
3400
+ return {
3401
+ dataSchema: dataSchema,
3402
+ uiSchema: uiSchema,
3403
+ typePath: typePath,
3404
+ customProps: _toConsumableArray__default["default"](new Set(customProps))
3405
+ };
3406
+ };
3407
+
3408
+ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
3409
+
3410
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
3411
+
3412
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
3413
+ var needToHandledKeywords = ['required', 'errorMessage', 'items', 'schema', 'properties', 'order'];
3414
+ var needToSetToRootUi = ['theme'];
3415
+ /**
3416
+ * 值拷贝
3417
+ * @param targetObj
3418
+ * @param rawObj
3419
+ * @param dataType
3420
+ */
3421
+
3422
+ function valueClone(_ref) {
3423
+ var targetObj = _ref.targetObj,
3424
+ rawObj = _ref.rawObj,
3425
+ dataType = _ref.dataType,
3426
+ fromRoot = _ref.fromRoot;
3427
+
3428
+ for (var key in rawObj) {
3429
+ if (rawObj[key] === null || _typeof__default["default"](rawObj[key]) !== 'object') {
3430
+ if (fromRoot && key === 'theme') ; else {
3431
+ targetObj[key] = rawObj[key];
3432
+ }
3433
+ } else if (!needToHandledKeywords.includes(key) && !needToSetToRootUi.includes(key)) {
3434
+ // 非特殊字段可使用深拷贝,比如title, containerStyle
3435
+ targetObj[key] = deepClone(rawObj[key]);
3436
+ }
3437
+ }
3438
+
3439
+ if (dataType && Object.hasOwnProperty.call(rawObj, 'errorMessage')) {
3440
+ targetObj.errMsg = deepClone(rawObj.errorMessage);
3441
+
3442
+ if (targetObj.errMsg.required) {
3443
+ delete targetObj.errMsg.required;
3444
+
3445
+ if (Object.keys(targetObj.errMsg).length === 0) {
3446
+ delete targetObj.errMsg;
3447
+ }
3448
+ }
3449
+ }
3450
+ }
3451
+ /**
3452
+ * 递归合并
3453
+ * @param dataSchema
3454
+ * @param uiSchema
3455
+ * @param schema
3456
+ * @param fromRoot
3457
+ */
3458
+
3459
+
3460
+ function recursionCombine(_ref2) {
3461
+ var dataSchema = _ref2.dataSchema,
3462
+ uiSchema = _ref2.uiSchema,
3463
+ schema = _ref2.schema,
3464
+ fromRoot = _ref2.fromRoot,
3465
+ options = _ref2.options;
3466
+ // 先拷贝ui和data的值类型属性或非特殊对象类型属性,比如title, containerStyle
3467
+ valueClone({
3468
+ targetObj: schema,
3469
+ rawObj: dataSchema,
3470
+ dataType: dataSchema.type
3471
+ }); // uiSchema非空时进行拷贝
3472
+
3473
+ if (!isEmpty(uiSchema)) {
3474
+ // 填充ui属性,用于存放uiSchema
3475
+ if (!Object.hasOwnProperty.call(schema, 'ui')) {
3476
+ schema.ui = {};
3477
+ } // 如果是根路径的,需要处理特殊字段
3478
+
3479
+
3480
+ if (fromRoot) {
3481
+ needToSetToRootUi.forEach(function (key) {
3482
+ if (Object.hasOwnProperty.call(uiSchema, key)) {
3483
+ schema[key] = uiSchema[key];
3484
+ }
3485
+ });
3486
+ }
3487
+
3488
+ valueClone({
3489
+ targetObj: schema.ui,
3490
+ rawObj: uiSchema,
3491
+ fromRoot: fromRoot
3492
+ });
3493
+
3494
+ if (isEmpty(schema.ui)) {
3495
+ delete schema.ui;
3496
+ }
3497
+ } // 如果有order,则根据order填充联合schema
3498
+
3499
+
3500
+ if (Object.hasOwnProperty.call(uiSchema, 'order')) {
3501
+ // 子项需要填充到联合schema的哪个prop下
3502
+ // 当父节点类型为array时应为items,否则为schema
3503
+ var toSchemaProp = dataSchema.type === 'array' ? 'items' : 'schema'; // 因为子项的错误信息在dataSchema中,此处需要进行处理
3504
+
3505
+ var required = dataSchema.required,
3506
+ errorMessage = dataSchema.errorMessage,
3507
+ msgMap = {};
3508
+
3509
+ if (_typeof__default["default"](errorMessage) === 'object') {
3510
+ var requireMsg = errorMessage.required;
3511
+ var errMsg = errorMessage[toSchemaProp === 'items' ? 'items' : 'properties']; // 收集必填的错误提示
3512
+
3513
+ if (required) {
3514
+ var _iterator = _createForOfIteratorHelper(required),
3515
+ _step;
3516
+
3517
+ try {
3518
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
3519
+ var fk = _step.value;
3520
+ if (!msgMap[fk]) msgMap[fk] = {};
3521
+ msgMap[fk] = {
3522
+ requiredMsg: requireMsg[fk]
3523
+ };
3524
+ }
3525
+ } catch (err) {
3526
+ _iterator.e(err);
3527
+ } finally {
3528
+ _iterator.f();
3529
+ }
3530
+ } // 收集校验的错误提示
3531
+
3532
+
3533
+ if (errMsg) {
3534
+ for (var _fk in errMsg) {
3535
+ if (Object.hasOwnProperty.call(errMsg, _fk)) {
3536
+ if (!msgMap[_fk]) msgMap[_fk] = {};
3537
+ msgMap[_fk] = {
3538
+ // 注意errMsg[fk]可能为string或对象,因此需要深拷贝
3539
+ errMsg: deepClone(errMsg[_fk])
3540
+ };
3541
+ }
3542
+ }
3543
+ }
3544
+ } // 遍历order的fieldKey
3545
+
3546
+
3547
+ var _iterator2 = _createForOfIteratorHelper(uiSchema.order),
3548
+ _step2;
3549
+
3550
+ try {
3551
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
3552
+ var fieldKey = _step2.value;
3553
+ // 根据fieldKey获取子项的schema
3554
+ var subUiSchema = uiSchema.properties[fieldKey]; // 初始化子项的dataSchema
3555
+
3556
+ var subDataSchema = dataSchema; // 根据dataSchema(父节点)中的type字段判断在联合schema中,子项以什么形式存在
3557
+ // array需读取dataSchema的items,object需读取properties
3558
+
3559
+ if (fieldKey === '$container') {
3560
+ subDataSchema = subDataSchema.items;
3561
+ } else if (dataSchema.type === 'array') {
3562
+ subDataSchema = subDataSchema.items[fieldKey];
3563
+ } else {
3564
+ subDataSchema = subDataSchema.properties[fieldKey];
3565
+ } // 初始化待填充的表单项
3566
+
3567
+
3568
+ var fieldItem = {}; // 开始递归
3569
+
3570
+ recursionCombine({
3571
+ dataSchema: subDataSchema,
3572
+ uiSchema: subUiSchema,
3573
+ schema: fieldItem,
3574
+ options: options
3575
+ });
3576
+
3577
+ if (msgMap[fieldKey]) {
3578
+ Object.assign(fieldItem, msgMap[fieldKey]);
3579
+ } // 将递归完成的fieldItem填充到父组件的prop中
3580
+
3581
+
3582
+ if (toSchemaProp === 'items' && !Array.isArray(dataSchema === null || dataSchema === void 0 ? void 0 : dataSchema.items)) {
3583
+ // 对于元组类型,items应为 {}
3584
+ if (!Object.hasOwnProperty.call(schema, toSchemaProp)) {
3585
+ schema[toSchemaProp] = {};
3586
+ }
3587
+
3588
+ schema[toSchemaProp] = fieldItem;
3589
+ } else {
3590
+ // 其余类型应为数组
3591
+ if (!Object.hasOwnProperty.call(schema, toSchemaProp)) {
3592
+ schema[toSchemaProp] = [];
3593
+ }
3594
+
3595
+ if (toSchemaProp === 'schema') {
3596
+ // 对于容器类型的子项,需要填充fieldKey
3597
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
3598
+ // @ts-ignore
3599
+ if (Object.prototype.hasOwnProperty.call(subDataSchema, '$fieldKey') && options && options['$fieldKey']) {
3600
+ fieldKey = subDataSchema['$fieldKey'];
3601
+ delete fieldItem['$fieldKey'];
3602
+ }
3603
+
3604
+ fieldItem.fieldKey = fieldKey;
3605
+ }
3606
+
3607
+ schema[toSchemaProp].push(fieldItem);
3608
+ }
3609
+ }
3610
+ } catch (err) {
3611
+ _iterator2.e(err);
3612
+ } finally {
3613
+ _iterator2.f();
3614
+ }
3615
+ } else {
3616
+ // 如果没有order,但数据类型为array且dataSchema中有配置items的,将items拷贝至联合schema
3617
+ // fix: 时间选择器combine后属性丢失的问题
3618
+ if (dataSchema.type === 'array' && !isEmpty(dataSchema.items)) {
3619
+ schema.items = dataSchema.items;
3620
+ }
3621
+ }
3622
+ }
3623
+ /**
3624
+ * 融合dataSchema和uiSchema为联合Schema
3625
+ */
3626
+
3627
+
3628
+ function combine(dataSchema, uiSchema, options) {
3629
+ var unitedSchema = {};
3630
+ recursionCombine({
3631
+ dataSchema: dataSchema,
3632
+ uiSchema: uiSchema,
3633
+ schema: unitedSchema,
3634
+ fromRoot: true,
3635
+ options: options
3636
+ });
3637
+ return unitedSchema;
3638
+ }
3639
+
3640
+ var commonStr = 'const {get,set,merge,setDeepProp,changeKey}=props;';
3641
+
3642
+ var getFileKeyToString = function getFileKeyToString(fieldKey) {
3643
+ var _fieldKey$trim$split = fieldKey.trim().split(' '),
3644
+ _fieldKey$trim$split2 = _slicedToArray__default["default"](_fieldKey$trim$split, 3),
3645
+ newFieldKey = _fieldKey$trim$split2[0],
3646
+ type = _fieldKey$trim$split2[1],
3647
+ property = _fieldKey$trim$split2[2];
3648
+
3649
+ return property ? "get('".concat(newFieldKey, "').").concat(type, "?.").concat(property) : "get('".concat(newFieldKey, "').").concat(type);
3650
+ }; // TODO else实现
3651
+ // TODO effect subAction实现
3652
+
3653
+
3654
+ var parseControlFlow = function parseControlFlow(action, flowStr) {
3655
+ // if的条件语句
3656
+ var condintionStr = ''; // if判断成功,执行的语句
3657
+
3658
+ var effectStr = '';
3659
+ action.condintion.map(function (condintion, index, condintions) {
3660
+ if (!condintion.fieldKey1) return; // 是否取反
3661
+
3662
+ var non = condintion.operator.startsWith('-'); // 去掉 - 之后的字符(例子:前 -includes 后:includes)
3663
+
3664
+ var operator = non ? condintion.operator.slice(1) : condintion.operator;
3665
+
3666
+ if (['true', 'false'].includes(operator)) {
3667
+ operator = '===';
3668
+ } // 需要前面加.的操作符
3669
+
3670
+
3671
+ var isdotOperator = ['includes', 'in'].includes(operator); // change是特殊的判断
3672
+
3673
+ var operatorStr = operator === 'change' ? "('".concat(condintion.fieldKey1.trim().split(' ').shift(), "'===changeKey)") : "(".concat(getFileKeyToString(condintion.fieldKey1)).concat(isdotOperator ? '?.' : '').concat(operator).concat(['true', 'false'].includes(condintion.operator) ? condintion.operator : "".concat(stringify__default["default"](condintion.value2)), ")");
3674
+ condintionStr += "".concat(operatorStr).concat(condintion.logicOperator && index != condintions.length - 1 ? condintion.logicOperator : '');
3675
+ });
3676
+ action.effect.map(function (effect) {
3677
+ // 转换set类型并过滤空的fieldKey
3678
+ if (effect.type === 'set' && effect.fieldKey) {
3679
+ var _effect$fieldKey$trim = effect.fieldKey.trim().split(' '),
3680
+ _effect$fieldKey$trim2 = _slicedToArray__default["default"](_effect$fieldKey$trim, 3),
3681
+ fieldKey = _effect$fieldKey$trim2[0],
3682
+ subType = _effect$fieldKey$trim2[1],
3683
+ property = _effect$fieldKey$trim2[2];
3684
+
3685
+ effectStr += "set('".concat(fieldKey, "','").concat(subType, "',").concat(property ? "(oldValue)=>{\n ".concat(property == 'queryConfig.refreshId' ? 'let newRefreshId=oldValue?.queryConfig?.refreshId||0;newRefreshId++;' : '', "\n setDeepProp(").concat(stringify__default["default"](property.split('.')), ",oldValue,").concat(property === 'vcontrol' ? stringify__default["default"]("const {get}=props;return ".concat(effect.value ? condintionStr : "!(".concat(condintionStr, ")"))) : property == 'queryConfig.refreshId' ? 'newRefreshId' : stringify__default["default"](effect.value), ")\n }") : stringify__default["default"](effect.value)) + ');';
3686
+ }
3687
+ });
3688
+
3689
+ if (condintionStr) {
3690
+ flowStr += "if(".concat(condintionStr, "){").concat(effectStr, "};");
3691
+ }
3692
+
3693
+ return flowStr;
3694
+ };
3695
+
3696
+ var parseFlow = function parseFlow(flow) {
3697
+ var flowStr = ''; //TODO trigger.event支持其他类型后,需对一期默认的globalChange兼容
3698
+ // 解析flow.actions
3699
+
3700
+ flow.actions.map(function (action) {
3701
+ switch (action.type) {
3702
+ case 'controlFlow':
3703
+ flowStr += parseControlFlow(action, flowStr);
3704
+ break;
3705
+ }
3706
+ });
3707
+ return commonStr + flowStr;
3708
+ };
3709
+
3710
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
3711
+
3712
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
3713
+
3714
+ var request = /*#__PURE__*/function () {
3715
+ var _ref = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee(url, config) {
3716
+ var res, data;
3717
+ return _regeneratorRuntime__default["default"].wrap(function _callee$(_context) {
3718
+ while (1) {
3719
+ switch (_context.prev = _context.next) {
3720
+ case 0:
3721
+ if (window.fetch) {
3722
+ _context.next = 2;
3723
+ break;
3724
+ }
3725
+
3726
+ throw '浏览器版本过低';
3727
+
3728
+ case 2:
3729
+ _context.prev = 2;
3730
+ _context.next = 5;
3731
+ return fetch(url, config);
3732
+
3733
+ case 5:
3734
+ res = _context.sent;
3735
+
3736
+ if (!res.ok) {
3737
+ _context.next = 13;
3738
+ break;
3739
+ }
3740
+
3741
+ _context.next = 9;
3742
+ return res.json();
3743
+
3744
+ case 9:
3745
+ data = _context.sent;
3746
+ return _context.abrupt("return", data);
3747
+
3748
+ case 13:
3749
+ console.error('请求失败');
3750
+
3751
+ case 14:
3752
+ _context.next = 19;
3753
+ break;
3754
+
3755
+ case 16:
3756
+ _context.prev = 16;
3757
+ _context.t0 = _context["catch"](2);
3758
+ console.error(_context.t0);
3759
+
3760
+ case 19:
3761
+ case "end":
3762
+ return _context.stop();
3763
+ }
3764
+ }
3765
+ }, _callee, null, [[2, 16]]);
3766
+ }));
3767
+
3768
+ return function request(_x, _x2) {
3769
+ return _ref.apply(this, arguments);
3770
+ };
3771
+ }();
3772
+
3773
+ var get$1 = function get(_ref2) {
3774
+ var params = _ref2.params,
3775
+ url = _ref2.url;
3776
+
3777
+ var _URL = new URL(url),
3778
+ search = _URL.search,
3779
+ origin = _URL.origin,
3780
+ hash = _URL.hash,
3781
+ pathname = _URL.pathname;
3782
+
3783
+ var searchParams = new URLSearchParams(search);
3784
+ Object.entries(params).map(function (_ref3) {
3785
+ var _ref4 = _slicedToArray__default["default"](_ref3, 2),
3786
+ key = _ref4[0],
3787
+ value = _ref4[1];
3788
+
3789
+ searchParams.set(key, value);
3790
+ });
3791
+ var newSearchParams = searchParams.toString();
3792
+ return request("".concat(origin).concat(pathname).concat(newSearchParams ? "?".concat(newSearchParams) : '').concat(hash), {
3793
+ method: 'GET'
3794
+ });
3795
+ };
3796
+
3797
+ var post = function post(_ref5) {
3798
+ var params = _ref5.params,
3799
+ url = _ref5.url;
3800
+ return request(url, {
3801
+ method: 'POST',
3802
+ body: JSON.stringify(params)
3803
+ });
3804
+ };
3805
+
3806
+ var fetchFn = function fetchFn(_ref6) {
3807
+ var oldParams = _ref6.params,
3808
+ url = _ref6.url,
3809
+ method = _ref6.method;
3810
+ var params = {};
3811
+ oldParams.map(function (_ref7) {
3812
+ var key = _ref7.key,
3813
+ value = _ref7.value;
3814
+ params[key] = value;
3815
+ });
3816
+
3817
+ switch (method.toUpperCase()) {
3818
+ case 'GET':
3819
+ return get$1({
3820
+ params: params,
3821
+ url: url
3822
+ });
3823
+
3824
+ case 'POST':
3825
+ return post({
3826
+ params: params,
3827
+ url: url
3828
+ });
3829
+
3830
+ default:
3831
+ throw new Error('不支持改请求类型');
3832
+ }
3833
+ };
3834
+ var fetchFnJsonKey = /*#__PURE__*/function () {
3835
+ var _ref9 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee2(_ref8) {
3836
+ var _config$headers;
3837
+
3838
+ var config, _ref8$dataHandler, dataHandler, _ref8$dataSetter, dataSetter, auth, fetchConfig;
3839
+
3840
+ return _regeneratorRuntime__default["default"].wrap(function _callee2$(_context2) {
3841
+ while (1) {
3842
+ switch (_context2.prev = _context2.next) {
3843
+ case 0:
3844
+ config = _ref8.config, _ref8$dataHandler = _ref8.dataHandler, dataHandler = _ref8$dataHandler === void 0 ? null : _ref8$dataHandler, _ref8$dataSetter = _ref8.dataSetter, dataSetter = _ref8$dataSetter === void 0 ? null : _ref8$dataSetter;
3845
+ auth = (config === null || config === void 0 ? void 0 : (_config$headers = config.headers) === null || _config$headers === void 0 ? void 0 : _config$headers.Authorization) || '';
3846
+
3847
+ if (localStorage.getItem('jwtToken')) {
3848
+ auth = "Bearer ".concat(localStorage.getItem('jwtToken'));
3849
+ }
3850
+
3851
+ if (config !== null && config !== void 0 && config.token) {
3852
+ auth = "Bearer ".concat(config === null || config === void 0 ? void 0 : config.token);
3853
+ }
3854
+
3855
+ fetchConfig = {
3856
+ method: config.method,
3857
+ headers: _objectSpread(_objectSpread({}, config === null || config === void 0 ? void 0 : config.headers), {}, {
3858
+ Authorization: auth
3859
+ })
3860
+ };
3861
+
3862
+ if (config !== null && config !== void 0 && config.body) {
3863
+ fetchConfig.body = config.body;
3864
+ }
3865
+
3866
+ _context2.next = 8;
3867
+ return request(config.url, fetchConfig).then(function (res) {
3868
+ var data;
3869
+
3870
+ if (config.jsonkey) {
3871
+ var jsonKeyVals = config.jsonkey.split('.');
3872
+
3873
+ if (jsonKeyVals.length === 1) {
3874
+ data = res === null || res === void 0 ? void 0 : res[jsonKeyVals[0]];
3875
+ } else if (jsonKeyVals.length === 2) {
3876
+ var _res$jsonKeyVals$;
3877
+
3878
+ data = res === null || res === void 0 ? void 0 : (_res$jsonKeyVals$ = res[jsonKeyVals[0]]) === null || _res$jsonKeyVals$ === void 0 ? void 0 : _res$jsonKeyVals$[jsonKeyVals[1]];
3879
+ }
3880
+ } else {
3881
+ data = res;
3882
+ }
3883
+
3884
+ if (dataHandler) {
3885
+ dataHandler((data || []).map(function (item) {
3886
+ return {
3887
+ label: item[config.labelKey],
3888
+ value: item[config.valueKey]
3889
+ };
3890
+ }));
3891
+ }
3892
+
3893
+ if (dataSetter) {
3894
+ dataSetter(data);
3895
+ }
3896
+ })["catch"](function (error) {
3897
+ console.error('Error:', error);
3898
+ });
3899
+
3900
+ case 8:
3901
+ case "end":
3902
+ return _context2.stop();
3903
+ }
3904
+ }
3905
+ }, _callee2);
3906
+ }));
3907
+
3908
+ return function fetchFnJsonKey(_x3) {
3909
+ return _ref9.apply(this, arguments);
3910
+ };
3911
+ }();
3912
+
3913
+ /*
3914
+ * @Author: jiangxiaowei
3915
+ * @Date: 2020-05-30 15:05:24
3916
+ * @Last Modified by: jiangxiaowei
3917
+ * @Last Modified time: 2022-11-24 16:33:13
3918
+ */
3919
+ var isEqual = ___default["default"].isEqual;
3920
+ var get = ___default["default"].get;
3921
+
3922
+ exports.binaryData2Blob = binaryData2Blob;
3923
+ exports.checkImg = checkImg;
3924
+ exports.combine = combine;
3925
+ exports.deepClone = deepClone;
3926
+ exports.deleteDeepProp = deleteDeepProp;
3927
+ exports.fetchFn = fetchFn;
3928
+ exports.fetchFnJsonKey = fetchFnJsonKey;
3929
+ exports.generateArrayKeyReg = generateArrayKeyReg;
3930
+ exports.generateReg = generateReg;
3931
+ exports.get = get;
3932
+ exports.getImgEl = getImgEl;
3933
+ exports.getThemeAndType = getThemeAndType;
3934
+ exports.handleMargin = handleMargin;
3935
+ exports.injectVcontrol = injectVcontrol;
3936
+ exports.isEmpty = isEmpty;
3937
+ exports.isEqual = isEqual;
3938
+ exports.isValidHttpUrl = isValidHttpUrl;
3939
+ exports.judgeAndRegister = judgeAndRegister;
3940
+ exports.number2Chinese = number2Chinese;
3941
+ exports.parseFlow = parseFlow;
3942
+ exports.parseHrefParam = parseHrefParam;
3943
+ exports.parseUnitedSchema = parseUnitedSchema;
3944
+ exports.randomString = randomString;
3945
+ exports.removeSpaceAndmakeStringCamelCase = removeSpaceAndmakeStringCamelCase;
3946
+ exports.setDeepProp = setDeepProp;
3947
+ exports.toArray = toArray;
3948
+ exports.typeCheck = typeCheck;
3949
+ exports.upgradeTips = upgradeTips;