react 19.0.0-rc.0 → 19.0.0-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,1261 +8,653 @@
8
8
  * LICENSE file in the root directory of this source tree.
9
9
  */
10
10
 
11
- 'use strict';
12
-
13
- if (process.env.NODE_ENV !== "production") {
14
- (function() {
15
- 'use strict';
16
-
17
- var React = require('react');
18
-
19
- // -----------------------------------------------------------------------------
20
-
21
- var enableScopeAPI = false; // Experimental Create Event Handle API.
22
- var enableTransitionTracing = false; // No known bugs, but needs performance testing
23
-
24
- var enableLegacyHidden = false; // Enables unstable_avoidThisFallback feature in Fiber
25
- // as a normal prop instead of stripping it from the props object.
26
- // Passes `ref` as a normal prop instead of stripping it from the props object
27
- // during element creation.
28
-
29
- var enableRefAsProp = true;
30
-
31
- var enableRenderableContext = true; // Enables the `initialValue` option for `useDeferredValue`
32
- // stuff. Intended to enable React core members to more easily debug scheduling
33
- // issues in DEV builds.
34
-
35
- var enableDebugTracing = false;
36
-
37
- var REACT_ELEMENT_TYPE = Symbol.for('react.transitional.element') ;
38
- var REACT_PORTAL_TYPE = Symbol.for('react.portal');
39
- var REACT_FRAGMENT_TYPE = Symbol.for('react.fragment');
40
- var REACT_STRICT_MODE_TYPE = Symbol.for('react.strict_mode');
41
- var REACT_PROFILER_TYPE = Symbol.for('react.profiler');
42
- var REACT_PROVIDER_TYPE = Symbol.for('react.provider'); // TODO: Delete with enableRenderableContext
43
-
44
- var REACT_CONSUMER_TYPE = Symbol.for('react.consumer');
45
- var REACT_CONTEXT_TYPE = Symbol.for('react.context');
46
- var REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref');
47
- var REACT_SUSPENSE_TYPE = Symbol.for('react.suspense');
48
- var REACT_SUSPENSE_LIST_TYPE = Symbol.for('react.suspense_list');
49
- var REACT_MEMO_TYPE = Symbol.for('react.memo');
50
- var REACT_LAZY_TYPE = Symbol.for('react.lazy');
51
- var REACT_OFFSCREEN_TYPE = Symbol.for('react.offscreen');
52
- var MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
53
- var FAUX_ITERATOR_SYMBOL = '@@iterator';
54
- function getIteratorFn(maybeIterable) {
55
- if (maybeIterable === null || typeof maybeIterable !== 'object') {
56
- return null;
57
- }
58
-
59
- var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
60
-
61
- if (typeof maybeIterator === 'function') {
62
- return maybeIterator;
63
- }
64
-
65
- return null;
66
- }
67
-
68
- var ReactSharedInternals = React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
69
-
70
- function error(format) {
71
- {
72
- {
73
- for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
74
- args[_key2 - 1] = arguments[_key2];
11
+ "use strict";
12
+ "production" !== process.env.NODE_ENV &&
13
+ (function () {
14
+ function getComponentNameFromType(type) {
15
+ if (null == type) return null;
16
+ if ("function" === typeof type)
17
+ return type.$$typeof === REACT_CLIENT_REFERENCE$2
18
+ ? null
19
+ : type.displayName || type.name || null;
20
+ if ("string" === typeof type) return type;
21
+ switch (type) {
22
+ case REACT_FRAGMENT_TYPE:
23
+ return "Fragment";
24
+ case REACT_PORTAL_TYPE:
25
+ return "Portal";
26
+ case REACT_PROFILER_TYPE:
27
+ return "Profiler";
28
+ case REACT_STRICT_MODE_TYPE:
29
+ return "StrictMode";
30
+ case REACT_SUSPENSE_TYPE:
31
+ return "Suspense";
32
+ case REACT_SUSPENSE_LIST_TYPE:
33
+ return "SuspenseList";
75
34
  }
76
-
77
- printWarning('error', format, args);
78
- }
79
- }
80
- } // eslint-disable-next-line react-internal/no-production-logging
81
-
82
- function printWarning(level, format, args) {
83
- // When changing this logic, you might want to also
84
- // update consoleWithStackDev.www.js as well.
85
- {
86
- var isErrorLogger = format === '%s\n\n%s\n' || format === '%o\n\n%s\n\n%s\n';
87
-
88
- if (ReactSharedInternals.getCurrentStack) {
89
- // We only add the current stack to the console when createTask is not supported.
90
- // Since createTask requires DevTools to be open to work, this means that stacks
91
- // can be lost while DevTools isn't open but we can't detect this.
92
- var stack = ReactSharedInternals.getCurrentStack();
93
-
94
- if (stack !== '') {
95
- format += '%s';
96
- args = args.concat([stack]);
97
- }
98
- }
99
-
100
- if (isErrorLogger) {
101
- // Don't prefix our default logging formatting in ReactFiberErrorLoggger.
102
- // Don't toString the arguments.
103
- args.unshift(format);
104
- } else {
105
- // TODO: Remove this prefix and stop toStringing in the wrapper and
106
- // instead do it at each callsite as needed.
107
- // Careful: RN currently depends on this prefix
108
- // eslint-disable-next-line react-internal/safe-string-coercion
109
- args = args.map(function (item) {
110
- return String(item);
111
- });
112
- args.unshift('Warning: ' + format);
113
- } // We intentionally don't use spread (or .apply) directly because it
114
- // breaks IE9: https://github.com/facebook/react/issues/13610
115
- // eslint-disable-next-line react-internal/no-production-logging
116
-
117
-
118
- Function.prototype.apply.call(console[level], console, args);
119
- }
120
- }
121
-
122
- function getWrappedName(outerType, innerType, wrapperName) {
123
- var displayName = outerType.displayName;
124
-
125
- if (displayName) {
126
- return displayName;
127
- }
128
-
129
- var functionName = innerType.displayName || innerType.name || '';
130
- return functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName;
131
- } // Keep in sync with react-reconciler/getComponentNameFromFiber
132
-
133
-
134
- function getContextName(type) {
135
- return type.displayName || 'Context';
136
- }
137
-
138
- var REACT_CLIENT_REFERENCE$2 = Symbol.for('react.client.reference'); // Note that the reconciler package should generally prefer to use getComponentNameFromFiber() instead.
139
-
140
- function getComponentNameFromType(type) {
141
- if (type == null) {
142
- // Host root, text node or just invalid type.
143
- return null;
144
- }
145
-
146
- if (typeof type === 'function') {
147
- if (type.$$typeof === REACT_CLIENT_REFERENCE$2) {
148
- // TODO: Create a convention for naming client references with debug info.
149
- return null;
150
- }
151
-
152
- return type.displayName || type.name || null;
153
- }
154
-
155
- if (typeof type === 'string') {
156
- return type;
157
- }
158
-
159
- switch (type) {
160
- case REACT_FRAGMENT_TYPE:
161
- return 'Fragment';
162
-
163
- case REACT_PORTAL_TYPE:
164
- return 'Portal';
165
-
166
- case REACT_PROFILER_TYPE:
167
- return 'Profiler';
168
-
169
- case REACT_STRICT_MODE_TYPE:
170
- return 'StrictMode';
171
-
172
- case REACT_SUSPENSE_TYPE:
173
- return 'Suspense';
174
-
175
- case REACT_SUSPENSE_LIST_TYPE:
176
- return 'SuspenseList';
177
-
178
- }
179
-
180
- if (typeof type === 'object') {
181
- {
182
- if (typeof type.tag === 'number') {
183
- error('Received an unexpected object in getComponentNameFromType(). ' + 'This is likely a bug in React. Please file an issue.');
184
- }
185
- }
186
-
187
- switch (type.$$typeof) {
188
- case REACT_PROVIDER_TYPE:
189
- {
190
- return null;
191
- }
192
-
193
- case REACT_CONTEXT_TYPE:
194
- var context = type;
195
-
196
- {
197
- return getContextName(context) + '.Provider';
198
- }
199
-
200
- case REACT_CONSUMER_TYPE:
201
- {
202
- var consumer = type;
203
- return getContextName(consumer._context) + '.Consumer';
204
- }
205
-
206
- case REACT_FORWARD_REF_TYPE:
207
- return getWrappedName(type, type.render, 'ForwardRef');
208
-
209
- case REACT_MEMO_TYPE:
210
- var outerName = type.displayName || null;
211
-
212
- if (outerName !== null) {
213
- return outerName;
214
- }
215
-
216
- return getComponentNameFromType(type.type) || 'Memo';
217
-
218
- case REACT_LAZY_TYPE:
219
- {
220
- var lazyComponent = type;
221
- var payload = lazyComponent._payload;
222
- var init = lazyComponent._init;
223
-
224
- try {
225
- return getComponentNameFromType(init(payload));
226
- } catch (x) {
227
- return null;
228
- }
35
+ if ("object" === typeof type)
36
+ switch (
37
+ ("number" === typeof type.tag &&
38
+ console.error(
39
+ "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
40
+ ),
41
+ type.$$typeof)
42
+ ) {
43
+ case REACT_CONTEXT_TYPE:
44
+ return (type.displayName || "Context") + ".Provider";
45
+ case REACT_CONSUMER_TYPE:
46
+ return (type._context.displayName || "Context") + ".Consumer";
47
+ case REACT_FORWARD_REF_TYPE:
48
+ var innerType = type.render;
49
+ type = type.displayName;
50
+ type ||
51
+ ((type = innerType.displayName || innerType.name || ""),
52
+ (type = "" !== type ? "ForwardRef(" + type + ")" : "ForwardRef"));
53
+ return type;
54
+ case REACT_MEMO_TYPE:
55
+ return (
56
+ (innerType = type.displayName || null),
57
+ null !== innerType
58
+ ? innerType
59
+ : getComponentNameFromType(type.type) || "Memo"
60
+ );
61
+ case REACT_LAZY_TYPE:
62
+ innerType = type._payload;
63
+ type = type._init;
64
+ try {
65
+ return getComponentNameFromType(type(innerType));
66
+ } catch (x) {}
229
67
  }
68
+ return null;
230
69
  }
231
- }
232
-
233
- return null;
234
- }
235
-
236
- // $FlowFixMe[method-unbinding]
237
- var hasOwnProperty = Object.prototype.hasOwnProperty;
238
-
239
- var assign = Object.assign;
240
-
241
- /*
242
- * The `'' + value` pattern (used in perf-sensitive code) throws for Symbol
243
- * and Temporal.* types. See https://github.com/facebook/react/pull/22064.
244
- *
245
- * The functions in this module will throw an easier-to-understand,
246
- * easier-to-debug exception with a clear errors message message explaining the
247
- * problem. (Instead of a confusing exception thrown inside the implementation
248
- * of the `value` object).
249
- */
250
- // $FlowFixMe[incompatible-return] only called in DEV, so void return is not possible.
251
- function typeName(value) {
252
- {
253
- // toStringTag is needed for namespaced types like Temporal.Instant
254
- var hasToStringTag = typeof Symbol === 'function' && Symbol.toStringTag;
255
- var type = hasToStringTag && value[Symbol.toStringTag] || value.constructor.name || 'Object'; // $FlowFixMe[incompatible-return]
256
-
257
- return type;
258
- }
259
- } // $FlowFixMe[incompatible-return] only called in DEV, so void return is not possible.
260
-
261
-
262
- function willCoercionThrow(value) {
263
- {
264
- try {
265
- testStringCoercion(value);
266
- return false;
267
- } catch (e) {
268
- return true;
269
- }
270
- }
271
- }
272
-
273
- function testStringCoercion(value) {
274
- // If you ended up here by following an exception call stack, here's what's
275
- // happened: you supplied an object or symbol value to React (as a prop, key,
276
- // DOM attribute, CSS property, string ref, etc.) and when React tried to
277
- // coerce it to a string using `'' + value`, an exception was thrown.
278
- //
279
- // The most common types that will cause this exception are `Symbol` instances
280
- // and Temporal objects like `Temporal.Instant`. But any object that has a
281
- // `valueOf` or `[Symbol.toPrimitive]` method that throws will also cause this
282
- // exception. (Library authors do this to prevent users from using built-in
283
- // numeric operators like `+` or comparison operators like `>=` because custom
284
- // methods are needed to perform accurate arithmetic or comparison.)
285
- //
286
- // To fix the problem, coerce this object or symbol value to a string before
287
- // passing it to React. The most reliable way is usually `String(value)`.
288
- //
289
- // To find which value is throwing, check the browser or debugger console.
290
- // Before this exception was thrown, there should be `console.error` output
291
- // that shows the type (Symbol, Temporal.PlainDate, etc.) that caused the
292
- // problem and how that type was used: key, atrribute, input value prop, etc.
293
- // In most cases, this console output also shows the component and its
294
- // ancestor components where the exception happened.
295
- //
296
- // eslint-disable-next-line react-internal/safe-string-coercion
297
- return '' + value;
298
- }
299
- function checkKeyStringCoercion(value) {
300
- {
301
- if (willCoercionThrow(value)) {
302
- error('The provided key is an unsupported type %s.' + ' This value must be coerced to a string before using it here.', typeName(value));
303
-
304
- return testStringCoercion(value); // throw (to help callers find troubleshooting comments)
305
- }
306
- }
307
- }
308
-
309
- var REACT_CLIENT_REFERENCE$1 = Symbol.for('react.client.reference'); // This function is deprecated. Don't use. Only the renderer knows what a valid type is.
310
- // TODO: Delete this when enableOwnerStacks ships.
311
-
312
- function isValidElementType(type) {
313
- if (typeof type === 'string' || typeof type === 'function') {
314
- return true;
315
- } // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).
316
-
317
-
318
- if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableTransitionTracing ) {
319
- return true;
320
- }
321
-
322
- if (typeof type === 'object' && type !== null) {
323
- if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || !enableRenderableContext || type.$$typeof === REACT_CONSUMER_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || // This needs to include all possible module reference object
324
- // types supported by any Flight configuration anywhere since
325
- // we don't know which Flight build this will end up being used
326
- // with.
327
- type.$$typeof === REACT_CLIENT_REFERENCE$1 || type.getModuleId !== undefined) {
328
- return true;
329
- }
330
- }
331
-
332
- return false;
333
- }
334
-
335
- var isArrayImpl = Array.isArray; // eslint-disable-next-line no-redeclare
336
-
337
- function isArray(a) {
338
- return isArrayImpl(a);
339
- }
340
-
341
- // Helpers to patch console.logs to avoid logging during side-effect free
342
- // replaying on render function. This currently only patches the object
343
- // lazily which won't cover if the log function was extracted eagerly.
344
- // We could also eagerly patch the method.
345
- var disabledDepth = 0;
346
- var prevLog;
347
- var prevInfo;
348
- var prevWarn;
349
- var prevError;
350
- var prevGroup;
351
- var prevGroupCollapsed;
352
- var prevGroupEnd;
353
-
354
- function disabledLog() {}
355
-
356
- disabledLog.__reactDisabledLog = true;
357
- function disableLogs() {
358
- {
359
- if (disabledDepth === 0) {
360
- /* eslint-disable react-internal/no-production-logging */
361
- prevLog = console.log;
362
- prevInfo = console.info;
363
- prevWarn = console.warn;
364
- prevError = console.error;
365
- prevGroup = console.group;
366
- prevGroupCollapsed = console.groupCollapsed;
367
- prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099
368
-
369
- var props = {
370
- configurable: true,
371
- enumerable: true,
372
- value: disabledLog,
373
- writable: true
374
- }; // $FlowFixMe[cannot-write] Flow thinks console is immutable.
375
-
376
- Object.defineProperties(console, {
377
- info: props,
378
- log: props,
379
- warn: props,
380
- error: props,
381
- group: props,
382
- groupCollapsed: props,
383
- groupEnd: props
384
- });
385
- /* eslint-enable react-internal/no-production-logging */
386
- }
387
-
388
- disabledDepth++;
389
- }
390
- }
391
- function reenableLogs() {
392
- {
393
- disabledDepth--;
394
-
395
- if (disabledDepth === 0) {
396
- /* eslint-disable react-internal/no-production-logging */
397
- var props = {
398
- configurable: true,
399
- enumerable: true,
400
- writable: true
401
- }; // $FlowFixMe[cannot-write] Flow thinks console is immutable.
402
-
403
- Object.defineProperties(console, {
404
- log: assign({}, props, {
405
- value: prevLog
406
- }),
407
- info: assign({}, props, {
408
- value: prevInfo
409
- }),
410
- warn: assign({}, props, {
411
- value: prevWarn
412
- }),
413
- error: assign({}, props, {
414
- value: prevError
415
- }),
416
- group: assign({}, props, {
417
- value: prevGroup
418
- }),
419
- groupCollapsed: assign({}, props, {
420
- value: prevGroupCollapsed
421
- }),
422
- groupEnd: assign({}, props, {
423
- value: prevGroupEnd
424
- })
425
- });
426
- /* eslint-enable react-internal/no-production-logging */
427
- }
428
-
429
- if (disabledDepth < 0) {
430
- error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.');
70
+ function testStringCoercion(value) {
71
+ return "" + value;
431
72
  }
432
- }
433
- }
434
-
435
- var prefix;
436
- function describeBuiltInComponentFrame(name) {
437
- {
438
- if (prefix === undefined) {
439
- // Extract the VM specific prefix used by each line.
73
+ function checkKeyStringCoercion(value) {
440
74
  try {
441
- throw Error();
442
- } catch (x) {
443
- var match = x.stack.trim().match(/\n( *(at )?)/);
444
- prefix = match && match[1] || '';
75
+ testStringCoercion(value);
76
+ var JSCompiler_inline_result = !1;
77
+ } catch (e) {
78
+ JSCompiler_inline_result = !0;
445
79
  }
446
- } // We use the prefix to ensure our stacks line up with native stack frames.
447
-
448
-
449
- return '\n' + prefix + name;
450
- }
451
- }
452
- var reentry = false;
453
- var componentFrameCache;
454
-
455
- {
456
- var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map;
457
- componentFrameCache = new PossiblyWeakMap();
458
- }
459
- /**
460
- * Leverages native browser/VM stack frames to get proper details (e.g.
461
- * filename, line + col number) for a single component in a component stack. We
462
- * do this by:
463
- * (1) throwing and catching an error in the function - this will be our
464
- * control error.
465
- * (2) calling the component which will eventually throw an error that we'll
466
- * catch - this will be our sample error.
467
- * (3) diffing the control and sample error stacks to find the stack frame
468
- * which represents our component.
469
- */
470
-
471
-
472
- function describeNativeComponentFrame(fn, construct) {
473
- // If something asked for a stack inside a fake render, it should get ignored.
474
- if (!fn || reentry) {
475
- return '';
476
- }
477
-
478
- {
479
- var frame = componentFrameCache.get(fn);
480
-
481
- if (frame !== undefined) {
482
- return frame;
483
- }
484
- }
485
-
486
- reentry = true;
487
- var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe[incompatible-type] It does accept undefined.
488
-
489
- Error.prepareStackTrace = undefined;
490
- var previousDispatcher = null;
491
-
492
- {
493
- previousDispatcher = ReactSharedInternals.H; // Set the dispatcher in DEV because this might be call in the render function
494
- // for warnings.
495
-
496
- ReactSharedInternals.H = null;
497
- disableLogs();
498
- }
499
- /**
500
- * Finding a common stack frame between sample and control errors can be
501
- * tricky given the different types and levels of stack trace truncation from
502
- * different JS VMs. So instead we'll attempt to control what that common
503
- * frame should be through this object method:
504
- * Having both the sample and control errors be in the function under the
505
- * `DescribeNativeComponentFrameRoot` property, + setting the `name` and
506
- * `displayName` properties of the function ensures that a stack
507
- * frame exists that has the method name `DescribeNativeComponentFrameRoot` in
508
- * it for both control and sample stacks.
509
- */
510
-
511
-
512
- var RunInRootFrame = {
513
- DetermineComponentFrameRoot: function () {
514
- var control;
515
-
516
- try {
517
- // This should throw.
518
- if (construct) {
519
- // Something should be setting the props in the constructor.
520
- var Fake = function () {
521
- throw Error();
522
- }; // $FlowFixMe[prop-missing]
523
-
524
-
525
- Object.defineProperty(Fake.prototype, 'props', {
526
- set: function () {
527
- // We use a throwing setter instead of frozen or non-writable props
528
- // because that won't throw in a non-strict mode function.
529
- throw Error();
530
- }
531
- });
532
-
533
- if (typeof Reflect === 'object' && Reflect.construct) {
534
- // We construct a different control for this case to include any extra
535
- // frames added by the construct call.
536
- try {
537
- Reflect.construct(Fake, []);
538
- } catch (x) {
539
- control = x;
540
- }
541
-
542
- Reflect.construct(fn, [], Fake);
543
- } else {
544
- try {
545
- Fake.call();
546
- } catch (x) {
547
- control = x;
548
- } // $FlowFixMe[prop-missing] found when upgrading Flow
549
-
550
-
551
- fn.call(Fake.prototype);
552
- }
553
- } else {
554
- try {
555
- throw Error();
556
- } catch (x) {
557
- control = x;
558
- } // TODO(luna): This will currently only throw if the function component
559
- // tries to access React/ReactDOM/props. We should probably make this throw
560
- // in simple components too
561
-
562
-
563
- var maybePromise = fn(); // If the function component returns a promise, it's likely an async
564
- // component, which we don't yet support. Attach a noop catch handler to
565
- // silence the error.
566
- // TODO: Implement component stacks for async client components?
567
-
568
- if (maybePromise && typeof maybePromise.catch === 'function') {
569
- maybePromise.catch(function () {});
570
- }
571
- }
572
- } catch (sample) {
573
- // This is inlined manually because closure doesn't do it for us.
574
- if (sample && control && typeof sample.stack === 'string') {
575
- return [sample.stack, control.stack];
576
- }
80
+ if (JSCompiler_inline_result) {
81
+ JSCompiler_inline_result = console;
82
+ var JSCompiler_temp_const = JSCompiler_inline_result.error;
83
+ var JSCompiler_inline_result$jscomp$0 =
84
+ ("function" === typeof Symbol &&
85
+ Symbol.toStringTag &&
86
+ value[Symbol.toStringTag]) ||
87
+ value.constructor.name ||
88
+ "Object";
89
+ JSCompiler_temp_const.call(
90
+ JSCompiler_inline_result,
91
+ "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
92
+ JSCompiler_inline_result$jscomp$0
93
+ );
94
+ return testStringCoercion(value);
577
95
  }
578
-
579
- return [null, null];
580
96
  }
581
- }; // $FlowFixMe[prop-missing]
582
-
583
- RunInRootFrame.DetermineComponentFrameRoot.displayName = 'DetermineComponentFrameRoot';
584
- var namePropDescriptor = Object.getOwnPropertyDescriptor(RunInRootFrame.DetermineComponentFrameRoot, 'name'); // Before ES6, the `name` property was not configurable.
585
-
586
- if (namePropDescriptor && namePropDescriptor.configurable) {
587
- // V8 utilizes a function's `name` property when generating a stack trace.
588
- Object.defineProperty(RunInRootFrame.DetermineComponentFrameRoot, // Configurable properties can be updated even if its writable descriptor
589
- // is set to `false`.
590
- // $FlowFixMe[cannot-write]
591
- 'name', {
592
- value: 'DetermineComponentFrameRoot'
593
- });
594
- }
595
-
596
- try {
597
- var _RunInRootFrame$Deter = RunInRootFrame.DetermineComponentFrameRoot(),
598
- sampleStack = _RunInRootFrame$Deter[0],
599
- controlStack = _RunInRootFrame$Deter[1];
600
-
601
- if (sampleStack && controlStack) {
602
- // This extracts the first frame from the sample that isn't also in the control.
603
- // Skipping one frame that we assume is the frame that calls the two.
604
- var sampleLines = sampleStack.split('\n');
605
- var controlLines = controlStack.split('\n');
606
- var s = 0;
607
- var c = 0;
608
-
609
- while (s < sampleLines.length && !sampleLines[s].includes('DetermineComponentFrameRoot')) {
610
- s++;
97
+ function disabledLog() {}
98
+ function disableLogs() {
99
+ if (0 === disabledDepth) {
100
+ prevLog = console.log;
101
+ prevInfo = console.info;
102
+ prevWarn = console.warn;
103
+ prevError = console.error;
104
+ prevGroup = console.group;
105
+ prevGroupCollapsed = console.groupCollapsed;
106
+ prevGroupEnd = console.groupEnd;
107
+ var props = {
108
+ configurable: !0,
109
+ enumerable: !0,
110
+ value: disabledLog,
111
+ writable: !0
112
+ };
113
+ Object.defineProperties(console, {
114
+ info: props,
115
+ log: props,
116
+ warn: props,
117
+ error: props,
118
+ group: props,
119
+ groupCollapsed: props,
120
+ groupEnd: props
121
+ });
611
122
  }
612
-
613
- while (c < controlLines.length && !controlLines[c].includes('DetermineComponentFrameRoot')) {
614
- c++;
615
- } // We couldn't find our intentionally injected common root frame, attempt
616
- // to find another common root frame by search from the bottom of the
617
- // control stack...
618
-
619
-
620
- if (s === sampleLines.length || c === controlLines.length) {
621
- s = sampleLines.length - 1;
622
- c = controlLines.length - 1;
623
-
624
- while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) {
625
- // We expect at least one stack frame to be shared.
626
- // Typically this will be the root most one. However, stack frames may be
627
- // cut off due to maximum stack limits. In this case, one maybe cut off
628
- // earlier than the other. We assume that the sample is longer or the same
629
- // and there for cut off earlier. So we should find the root most frame in
630
- // the sample somewhere in the control.
631
- c--;
632
- }
123
+ disabledDepth++;
124
+ }
125
+ function reenableLogs() {
126
+ disabledDepth--;
127
+ if (0 === disabledDepth) {
128
+ var props = { configurable: !0, enumerable: !0, writable: !0 };
129
+ Object.defineProperties(console, {
130
+ log: assign({}, props, { value: prevLog }),
131
+ info: assign({}, props, { value: prevInfo }),
132
+ warn: assign({}, props, { value: prevWarn }),
133
+ error: assign({}, props, { value: prevError }),
134
+ group: assign({}, props, { value: prevGroup }),
135
+ groupCollapsed: assign({}, props, { value: prevGroupCollapsed }),
136
+ groupEnd: assign({}, props, { value: prevGroupEnd })
137
+ });
633
138
  }
634
-
635
- for (; s >= 1 && c >= 0; s--, c--) {
636
- // Next we find the first one that isn't the same which should be the
637
- // frame that called our sample function and the control.
638
- if (sampleLines[s] !== controlLines[c]) {
639
- // In V8, the first line is describing the message but other VMs don't.
640
- // If we're about to return the first line, and the control is also on the same
641
- // line, that's a pretty good indicator that our sample threw at same line as
642
- // the control. I.e. before we entered the sample frame. So we ignore this result.
643
- // This can happen if you passed a class to function component, or non-function.
644
- if (s !== 1 || c !== 1) {
645
- do {
646
- s--;
647
- c--; // We may still have similar intermediate frames from the construct call.
648
- // The next one that isn't the same should be our match though.
649
-
650
- if (c < 0 || sampleLines[s] !== controlLines[c]) {
651
- // V8 adds a "new" prefix for native classes. Let's remove it to make it prettier.
652
- var _frame = '\n' + sampleLines[s].replace(' at new ', ' at '); // If our component frame is labeled "<anonymous>"
653
- // but we have a user-provided "displayName"
654
- // splice it in to make the stack more readable.
655
-
656
-
657
- if (fn.displayName && _frame.includes('<anonymous>')) {
658
- _frame = _frame.replace('<anonymous>', fn.displayName);
659
- }
660
-
661
- if (true) {
662
- if (typeof fn === 'function') {
663
- componentFrameCache.set(fn, _frame);
139
+ 0 > disabledDepth &&
140
+ console.error(
141
+ "disabledDepth fell below zero. This is a bug in React. Please file an issue."
142
+ );
143
+ }
144
+ function describeBuiltInComponentFrame(name) {
145
+ if (void 0 === prefix)
146
+ try {
147
+ throw Error();
148
+ } catch (x) {
149
+ var match = x.stack.trim().match(/\n( *(at )?)/);
150
+ prefix = (match && match[1]) || "";
151
+ suffix =
152
+ -1 < x.stack.indexOf("\n at")
153
+ ? " (<anonymous>)"
154
+ : -1 < x.stack.indexOf("@")
155
+ ? "@unknown:0:0"
156
+ : "";
157
+ }
158
+ return "\n" + prefix + name + suffix;
159
+ }
160
+ function describeNativeComponentFrame(fn, construct) {
161
+ if (!fn || reentry) return "";
162
+ var frame = componentFrameCache.get(fn);
163
+ if (void 0 !== frame) return frame;
164
+ reentry = !0;
165
+ frame = Error.prepareStackTrace;
166
+ Error.prepareStackTrace = void 0;
167
+ var previousDispatcher = null;
168
+ previousDispatcher = ReactSharedInternals.H;
169
+ ReactSharedInternals.H = null;
170
+ disableLogs();
171
+ try {
172
+ var RunInRootFrame = {
173
+ DetermineComponentFrameRoot: function () {
174
+ try {
175
+ if (construct) {
176
+ var Fake = function () {
177
+ throw Error();
178
+ };
179
+ Object.defineProperty(Fake.prototype, "props", {
180
+ set: function () {
181
+ throw Error();
664
182
  }
665
- } // Return the line we found.
666
-
667
-
668
- return _frame;
183
+ });
184
+ if ("object" === typeof Reflect && Reflect.construct) {
185
+ try {
186
+ Reflect.construct(Fake, []);
187
+ } catch (x) {
188
+ var control = x;
189
+ }
190
+ Reflect.construct(fn, [], Fake);
191
+ } else {
192
+ try {
193
+ Fake.call();
194
+ } catch (x$0) {
195
+ control = x$0;
196
+ }
197
+ fn.call(Fake.prototype);
198
+ }
199
+ } else {
200
+ try {
201
+ throw Error();
202
+ } catch (x$1) {
203
+ control = x$1;
204
+ }
205
+ (Fake = fn()) &&
206
+ "function" === typeof Fake.catch &&
207
+ Fake.catch(function () {});
669
208
  }
670
- } while (s >= 1 && c >= 0);
209
+ } catch (sample) {
210
+ if (sample && control && "string" === typeof sample.stack)
211
+ return [sample.stack, control.stack];
212
+ }
213
+ return [null, null];
671
214
  }
672
-
673
- break;
215
+ };
216
+ RunInRootFrame.DetermineComponentFrameRoot.displayName =
217
+ "DetermineComponentFrameRoot";
218
+ var namePropDescriptor = Object.getOwnPropertyDescriptor(
219
+ RunInRootFrame.DetermineComponentFrameRoot,
220
+ "name"
221
+ );
222
+ namePropDescriptor &&
223
+ namePropDescriptor.configurable &&
224
+ Object.defineProperty(
225
+ RunInRootFrame.DetermineComponentFrameRoot,
226
+ "name",
227
+ { value: "DetermineComponentFrameRoot" }
228
+ );
229
+ var _RunInRootFrame$Deter =
230
+ RunInRootFrame.DetermineComponentFrameRoot(),
231
+ sampleStack = _RunInRootFrame$Deter[0],
232
+ controlStack = _RunInRootFrame$Deter[1];
233
+ if (sampleStack && controlStack) {
234
+ var sampleLines = sampleStack.split("\n"),
235
+ controlLines = controlStack.split("\n");
236
+ for (
237
+ _RunInRootFrame$Deter = namePropDescriptor = 0;
238
+ namePropDescriptor < sampleLines.length &&
239
+ !sampleLines[namePropDescriptor].includes(
240
+ "DetermineComponentFrameRoot"
241
+ );
242
+
243
+ )
244
+ namePropDescriptor++;
245
+ for (
246
+ ;
247
+ _RunInRootFrame$Deter < controlLines.length &&
248
+ !controlLines[_RunInRootFrame$Deter].includes(
249
+ "DetermineComponentFrameRoot"
250
+ );
251
+
252
+ )
253
+ _RunInRootFrame$Deter++;
254
+ if (
255
+ namePropDescriptor === sampleLines.length ||
256
+ _RunInRootFrame$Deter === controlLines.length
257
+ )
258
+ for (
259
+ namePropDescriptor = sampleLines.length - 1,
260
+ _RunInRootFrame$Deter = controlLines.length - 1;
261
+ 1 <= namePropDescriptor &&
262
+ 0 <= _RunInRootFrame$Deter &&
263
+ sampleLines[namePropDescriptor] !==
264
+ controlLines[_RunInRootFrame$Deter];
265
+
266
+ )
267
+ _RunInRootFrame$Deter--;
268
+ for (
269
+ ;
270
+ 1 <= namePropDescriptor && 0 <= _RunInRootFrame$Deter;
271
+ namePropDescriptor--, _RunInRootFrame$Deter--
272
+ )
273
+ if (
274
+ sampleLines[namePropDescriptor] !==
275
+ controlLines[_RunInRootFrame$Deter]
276
+ ) {
277
+ if (1 !== namePropDescriptor || 1 !== _RunInRootFrame$Deter) {
278
+ do
279
+ if (
280
+ (namePropDescriptor--,
281
+ _RunInRootFrame$Deter--,
282
+ 0 > _RunInRootFrame$Deter ||
283
+ sampleLines[namePropDescriptor] !==
284
+ controlLines[_RunInRootFrame$Deter])
285
+ ) {
286
+ var _frame =
287
+ "\n" +
288
+ sampleLines[namePropDescriptor].replace(
289
+ " at new ",
290
+ " at "
291
+ );
292
+ fn.displayName &&
293
+ _frame.includes("<anonymous>") &&
294
+ (_frame = _frame.replace("<anonymous>", fn.displayName));
295
+ "function" === typeof fn &&
296
+ componentFrameCache.set(fn, _frame);
297
+ return _frame;
298
+ }
299
+ while (1 <= namePropDescriptor && 0 <= _RunInRootFrame$Deter);
300
+ }
301
+ break;
302
+ }
674
303
  }
304
+ } finally {
305
+ (reentry = !1),
306
+ (ReactSharedInternals.H = previousDispatcher),
307
+ reenableLogs(),
308
+ (Error.prepareStackTrace = frame);
675
309
  }
676
- }
677
- } finally {
678
- reentry = false;
679
-
680
- {
681
- ReactSharedInternals.H = previousDispatcher;
682
- reenableLogs();
683
- }
684
-
685
- Error.prepareStackTrace = previousPrepareStackTrace;
686
- } // Fallback to just using the name if we couldn't make it throw.
687
-
688
-
689
- var name = fn ? fn.displayName || fn.name : '';
690
- var syntheticFrame = name ? describeBuiltInComponentFrame(name) : '';
691
-
692
- {
693
- if (typeof fn === 'function') {
694
- componentFrameCache.set(fn, syntheticFrame);
695
- }
696
- }
697
-
698
- return syntheticFrame;
699
- }
700
- function describeFunctionComponentFrame(fn) {
701
- {
702
- return describeNativeComponentFrame(fn, false);
703
- }
704
- }
705
-
706
- function shouldConstruct(Component) {
707
- var prototype = Component.prototype;
708
- return !!(prototype && prototype.isReactComponent);
709
- } // TODO: Delete this once the key warning no longer uses it. I.e. when enableOwnerStacks ship.
710
-
711
-
712
- function describeUnknownElementTypeFrameInDEV(type) {
713
-
714
- if (type == null) {
715
- return '';
716
- }
717
-
718
- if (typeof type === 'function') {
719
- {
720
- return describeNativeComponentFrame(type, shouldConstruct(type));
721
- }
722
- }
723
-
724
- if (typeof type === 'string') {
725
- return describeBuiltInComponentFrame(type);
726
- }
727
-
728
- switch (type) {
729
- case REACT_SUSPENSE_TYPE:
730
- return describeBuiltInComponentFrame('Suspense');
731
-
732
- case REACT_SUSPENSE_LIST_TYPE:
733
- return describeBuiltInComponentFrame('SuspenseList');
734
- }
735
-
736
- if (typeof type === 'object') {
737
- switch (type.$$typeof) {
738
- case REACT_FORWARD_REF_TYPE:
739
- return describeFunctionComponentFrame(type.render);
740
-
741
- case REACT_MEMO_TYPE:
742
- // Memo may contain any component type so we recursively resolve it.
743
- return describeUnknownElementTypeFrameInDEV(type.type);
744
-
745
- case REACT_LAZY_TYPE:
746
- {
747
- var lazyComponent = type;
748
- var payload = lazyComponent._payload;
749
- var init = lazyComponent._init;
750
-
751
- try {
752
- // Lazy may contain any component type so we recursively resolve it.
753
- return describeUnknownElementTypeFrameInDEV(init(payload));
754
- } catch (x) {}
310
+ sampleLines = (sampleLines = fn ? fn.displayName || fn.name : "")
311
+ ? describeBuiltInComponentFrame(sampleLines)
312
+ : "";
313
+ "function" === typeof fn && componentFrameCache.set(fn, sampleLines);
314
+ return sampleLines;
315
+ }
316
+ function describeUnknownElementTypeFrameInDEV(type) {
317
+ if (null == type) return "";
318
+ if ("function" === typeof type) {
319
+ var prototype = type.prototype;
320
+ return describeNativeComponentFrame(
321
+ type,
322
+ !(!prototype || !prototype.isReactComponent)
323
+ );
324
+ }
325
+ if ("string" === typeof type) return describeBuiltInComponentFrame(type);
326
+ switch (type) {
327
+ case REACT_SUSPENSE_TYPE:
328
+ return describeBuiltInComponentFrame("Suspense");
329
+ case REACT_SUSPENSE_LIST_TYPE:
330
+ return describeBuiltInComponentFrame("SuspenseList");
331
+ }
332
+ if ("object" === typeof type)
333
+ switch (type.$$typeof) {
334
+ case REACT_FORWARD_REF_TYPE:
335
+ return (type = describeNativeComponentFrame(type.render, !1)), type;
336
+ case REACT_MEMO_TYPE:
337
+ return describeUnknownElementTypeFrameInDEV(type.type);
338
+ case REACT_LAZY_TYPE:
339
+ prototype = type._payload;
340
+ type = type._init;
341
+ try {
342
+ return describeUnknownElementTypeFrameInDEV(type(prototype));
343
+ } catch (x) {}
755
344
  }
345
+ return "";
756
346
  }
757
- }
758
-
759
- return '';
760
- }
761
-
762
- var REACT_CLIENT_REFERENCE = Symbol.for('react.client.reference');
763
-
764
- function getOwner() {
765
- {
766
- var dispatcher = ReactSharedInternals.A;
767
-
768
- if (dispatcher === null) {
769
- return null;
347
+ function getOwner() {
348
+ var dispatcher = ReactSharedInternals.A;
349
+ return null === dispatcher ? null : dispatcher.getOwner();
770
350
  }
771
-
772
- return dispatcher.getOwner();
773
- }
774
- }
775
-
776
- var specialPropKeyWarningShown;
777
- var didWarnAboutElementRef;
778
-
779
- {
780
- didWarnAboutElementRef = {};
781
- }
782
-
783
- function hasValidRef(config) {
784
- {
785
- if (hasOwnProperty.call(config, 'ref')) {
786
- var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;
787
-
788
- if (getter && getter.isReactWarning) {
789
- return false;
351
+ function hasValidKey(config) {
352
+ if (hasOwnProperty.call(config, "key")) {
353
+ var getter = Object.getOwnPropertyDescriptor(config, "key").get;
354
+ if (getter && getter.isReactWarning) return !1;
790
355
  }
791
- }
792
- }
793
-
794
- return config.ref !== undefined;
795
- }
796
-
797
- function hasValidKey(config) {
798
- {
799
- if (hasOwnProperty.call(config, 'key')) {
800
- var getter = Object.getOwnPropertyDescriptor(config, 'key').get;
801
-
802
- if (getter && getter.isReactWarning) {
803
- return false;
356
+ return void 0 !== config.key;
357
+ }
358
+ function defineKeyPropWarningGetter(props, displayName) {
359
+ function warnAboutAccessingKey() {
360
+ specialPropKeyWarningShown ||
361
+ ((specialPropKeyWarningShown = !0),
362
+ console.error(
363
+ "%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://react.dev/link/special-props)",
364
+ displayName
365
+ ));
804
366
  }
367
+ warnAboutAccessingKey.isReactWarning = !0;
368
+ Object.defineProperty(props, "key", {
369
+ get: warnAboutAccessingKey,
370
+ configurable: !0
371
+ });
805
372
  }
806
- }
807
-
808
- return config.key !== undefined;
809
- }
810
-
811
- function defineKeyPropWarningGetter(props, displayName) {
812
- {
813
- var warnAboutAccessingKey = function () {
814
- if (!specialPropKeyWarningShown) {
815
- specialPropKeyWarningShown = true;
816
-
817
- 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://react.dev/link/special-props)', displayName);
818
- }
819
- };
820
-
821
- warnAboutAccessingKey.isReactWarning = true;
822
- Object.defineProperty(props, 'key', {
823
- get: warnAboutAccessingKey,
824
- configurable: true
825
- });
826
- }
827
- }
828
-
829
- function elementRefGetterWithDeprecationWarning() {
830
- {
831
- var componentName = getComponentNameFromType(this.type);
832
-
833
- if (!didWarnAboutElementRef[componentName]) {
834
- didWarnAboutElementRef[componentName] = true;
835
-
836
- error('Accessing element.ref was removed in React 19. ref is now a ' + 'regular prop. It will be removed from the JSX Element ' + 'type in a future release.');
837
- } // An undefined `element.ref` is coerced to `null` for
838
- // backwards compatibility.
839
-
840
-
841
- var refProp = this.props.ref;
842
- return refProp !== undefined ? refProp : null;
843
- }
844
- }
845
- /**
846
- * Factory method to create a new React element. This no longer adheres to
847
- * the class pattern, so do not use new to call it. Also, instanceof check
848
- * will not work. Instead test $$typeof field against Symbol.for('react.transitional.element') to check
849
- * if something is a React Element.
850
- *
851
- * @param {*} type
852
- * @param {*} props
853
- * @param {*} key
854
- * @param {string|object} ref
855
- * @param {*} owner
856
- * @param {*} self A *temporary* helper to detect places where `this` is
857
- * different from the `owner` when React.createElement is called, so that we
858
- * can warn. We want to get rid of owner and replace string `ref`s with arrow
859
- * functions, and as long as `this` and owner are the same, there will be no
860
- * change in behavior.
861
- * @param {*} source An annotation object (added by a transpiler or otherwise)
862
- * indicating filename, line number, and/or other information.
863
- * @internal
864
- */
865
-
866
-
867
- function ReactElement(type, key, _ref, self, source, owner, props, debugStack, debugTask) {
868
- var ref;
869
-
870
- {
871
- // When enableRefAsProp is on, ignore whatever was passed as the ref
872
- // argument and treat `props.ref` as the source of truth. The only thing we
873
- // use this for is `element.ref`, which will log a deprecation warning on
874
- // access. In the next release, we can remove `element.ref` as well as the
875
- // `ref` argument.
876
- var refProp = props.ref; // An undefined `element.ref` is coerced to `null` for
877
- // backwards compatibility.
878
-
879
- ref = refProp !== undefined ? refProp : null;
880
- }
881
-
882
- var element;
883
-
884
- {
885
- // In dev, make `ref` a non-enumerable property with a warning. It's non-
886
- // enumerable so that test matchers and serializers don't access it and
887
- // trigger the warning.
888
- //
889
- // `ref` will be removed from the element completely in a future release.
890
- element = {
891
- // This tag allows us to uniquely identify this as a React Element
892
- $$typeof: REACT_ELEMENT_TYPE,
893
- // Built-in properties that belong on the element
894
- type: type,
895
- key: key,
896
- props: props,
897
- // Record the component responsible for creating this element.
898
- _owner: owner
899
- };
900
-
901
- if (ref !== null) {
902
- Object.defineProperty(element, 'ref', {
903
- enumerable: false,
904
- get: elementRefGetterWithDeprecationWarning
373
+ function elementRefGetterWithDeprecationWarning() {
374
+ var componentName = getComponentNameFromType(this.type);
375
+ didWarnAboutElementRef[componentName] ||
376
+ ((didWarnAboutElementRef[componentName] = !0),
377
+ console.error(
378
+ "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
379
+ ));
380
+ componentName = this.props.ref;
381
+ return void 0 !== componentName ? componentName : null;
382
+ }
383
+ function ReactElement(type, key, self, source, owner, props) {
384
+ self = props.ref;
385
+ type = {
386
+ $$typeof: REACT_ELEMENT_TYPE,
387
+ type: type,
388
+ key: key,
389
+ props: props,
390
+ _owner: owner
391
+ };
392
+ null !== (void 0 !== self ? self : null)
393
+ ? Object.defineProperty(type, "ref", {
394
+ enumerable: !1,
395
+ get: elementRefGetterWithDeprecationWarning
396
+ })
397
+ : Object.defineProperty(type, "ref", { enumerable: !1, value: null });
398
+ type._store = {};
399
+ Object.defineProperty(type._store, "validated", {
400
+ configurable: !1,
401
+ enumerable: !1,
402
+ writable: !0,
403
+ value: 0
905
404
  });
906
- } else {
907
- // Don't warn on access if a ref is not given. This reduces false
908
- // positives in cases where a test serializer uses
909
- // getOwnPropertyDescriptors to compare objects, like Jest does, which is
910
- // a problem because it bypasses non-enumerability.
911
- //
912
- // So unfortunately this will trigger a false positive warning in Jest
913
- // when the diff is printed:
914
- //
915
- // expect(<div ref={ref} />).toEqual(<span ref={ref} />);
916
- //
917
- // A bit sketchy, but this is what we've done for the `props.key` and
918
- // `props.ref` accessors for years, which implies it will be good enough
919
- // for `element.ref`, too. Let's see if anyone complains.
920
- Object.defineProperty(element, 'ref', {
921
- enumerable: false,
405
+ Object.defineProperty(type, "_debugInfo", {
406
+ configurable: !1,
407
+ enumerable: !1,
408
+ writable: !0,
922
409
  value: null
923
410
  });
924
- }
925
- }
926
-
927
- {
928
- // The validation flag is currently mutative. We put it on
929
- // an external backing store so that we can freeze the whole object.
930
- // This can be replaced with a WeakMap once they are implemented in
931
- // commonly used development environments.
932
- element._store = {}; // To make comparing ReactElements easier for testing purposes, we make
933
- // the validation flag non-enumerable (where possible, which should
934
- // include every environment we run tests in), so the test framework
935
- // ignores it.
936
-
937
- Object.defineProperty(element._store, 'validated', {
938
- configurable: false,
939
- enumerable: false,
940
- writable: true,
941
- value: 0
942
- }); // debugInfo contains Server Component debug information.
943
-
944
- Object.defineProperty(element, '_debugInfo', {
945
- configurable: false,
946
- enumerable: false,
947
- writable: true,
948
- value: null
949
- });
950
-
951
- if (Object.freeze) {
952
- Object.freeze(element.props);
953
- Object.freeze(element);
954
- }
955
- }
956
-
957
- return element;
958
- }
959
- var didWarnAboutKeySpread = {};
960
- /**
961
- * https://github.com/reactjs/rfcs/pull/107
962
- * @param {*} type
963
- * @param {object} props
964
- * @param {string} key
965
- */
966
-
967
- function jsxDEV$1(type, config, maybeKey, isStaticChildren, source, self) {
968
- return jsxDEVImpl(type, config, maybeKey, isStaticChildren, source, self);
969
- }
970
-
971
- function jsxDEVImpl(type, config, maybeKey, isStaticChildren, source, self, debugStack, debugTask) {
972
- {
973
- if (!isValidElementType(type)) {
974
- // This is an invalid element type.
975
- //
976
- // We warn in this case but don't throw. We expect the element creation to
977
- // succeed and there will likely be errors in render.
978
- var info = '';
979
-
980
- if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
981
- 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.";
982
- }
983
-
984
- var typeString;
985
-
986
- if (type === null) {
987
- typeString = 'null';
988
- } else if (isArray(type)) {
989
- typeString = 'array';
990
- } else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {
991
- typeString = "<" + (getComponentNameFromType(type.type) || 'Unknown') + " />";
992
- info = ' Did you accidentally export a JSX literal instead of a component?';
411
+ Object.freeze && (Object.freeze(type.props), Object.freeze(type));
412
+ return type;
413
+ }
414
+ function jsxDEVImpl(
415
+ type,
416
+ config,
417
+ maybeKey,
418
+ isStaticChildren,
419
+ source,
420
+ self
421
+ ) {
422
+ if (
423
+ "string" === typeof type ||
424
+ "function" === typeof type ||
425
+ type === REACT_FRAGMENT_TYPE ||
426
+ type === REACT_PROFILER_TYPE ||
427
+ type === REACT_STRICT_MODE_TYPE ||
428
+ type === REACT_SUSPENSE_TYPE ||
429
+ type === REACT_SUSPENSE_LIST_TYPE ||
430
+ type === REACT_OFFSCREEN_TYPE ||
431
+ ("object" === typeof type &&
432
+ null !== type &&
433
+ (type.$$typeof === REACT_LAZY_TYPE ||
434
+ type.$$typeof === REACT_MEMO_TYPE ||
435
+ type.$$typeof === REACT_CONTEXT_TYPE ||
436
+ type.$$typeof === REACT_CONSUMER_TYPE ||
437
+ type.$$typeof === REACT_FORWARD_REF_TYPE ||
438
+ type.$$typeof === REACT_CLIENT_REFERENCE$1 ||
439
+ void 0 !== type.getModuleId))
440
+ ) {
441
+ var children = config.children;
442
+ if (void 0 !== children)
443
+ if (isStaticChildren)
444
+ if (isArrayImpl(children)) {
445
+ for (
446
+ isStaticChildren = 0;
447
+ isStaticChildren < children.length;
448
+ isStaticChildren++
449
+ )
450
+ validateChildKeys(children[isStaticChildren], type);
451
+ Object.freeze && Object.freeze(children);
452
+ } else
453
+ console.error(
454
+ "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
455
+ );
456
+ else validateChildKeys(children, type);
993
457
  } else {
994
- typeString = typeof type;
995
- }
996
-
997
- error('React.jsx: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', typeString, info);
998
- } else {
999
- // This is a valid element type.
1000
- // Skip key warning if the type isn't valid since our key validation logic
1001
- // doesn't expect a non-string/function type and can throw confusing
1002
- // errors. We don't want exception behavior to differ between dev and
1003
- // prod. (Rendering will throw with a helpful message and as soon as the
1004
- // type is fixed, the key warnings will appear.)
1005
- var children = config.children;
1006
-
1007
- if (children !== undefined) {
1008
- if (isStaticChildren) {
1009
- if (isArray(children)) {
1010
- for (var i = 0; i < children.length; i++) {
1011
- validateChildKeys(children[i], type);
1012
- }
1013
-
1014
- if (Object.freeze) {
1015
- Object.freeze(children);
1016
- }
1017
- } else {
1018
- error('React.jsx: Static children should always be an array. ' + 'You are likely explicitly calling React.jsxs or React.jsxDEV. ' + 'Use the Babel transform instead.');
1019
- }
1020
- } else {
1021
- validateChildKeys(children, type);
1022
- }
1023
- }
1024
- } // Warn about key spread regardless of whether the type is valid.
1025
-
1026
-
1027
- if (hasOwnProperty.call(config, 'key')) {
1028
- var componentName = getComponentNameFromType(type);
1029
- var keys = Object.keys(config).filter(function (k) {
1030
- return k !== 'key';
1031
- });
1032
- var beforeExample = keys.length > 0 ? '{key: someKey, ' + keys.join(': ..., ') + ': ...}' : '{key: someKey}';
1033
-
1034
- if (!didWarnAboutKeySpread[componentName + beforeExample]) {
1035
- var afterExample = keys.length > 0 ? '{' + keys.join(': ..., ') + ': ...}' : '{}';
1036
-
1037
- error('A props object containing a "key" prop is being spread into JSX:\n' + ' let props = %s;\n' + ' <%s {...props} />\n' + 'React keys must be passed directly to JSX without using spread:\n' + ' let props = %s;\n' + ' <%s key={someKey} {...props} />', beforeExample, componentName, afterExample, componentName);
1038
-
1039
- didWarnAboutKeySpread[componentName + beforeExample] = true;
1040
- }
1041
- }
1042
-
1043
- var key = null;
1044
- var ref = null; // Currently, key can be spread in as a prop. This causes a potential
1045
- // issue if key is also explicitly declared (ie. <div {...props} key="Hi" />
1046
- // or <div key="Hi" {...props} /> ). We want to deprecate key spread,
1047
- // but as an intermediary step, we will use jsxDEV for everything except
1048
- // <div {...props} key="Hi" />, because we aren't currently able to tell if
1049
- // key is explicitly declared to be undefined or not.
1050
-
1051
- if (maybeKey !== undefined) {
1052
- {
1053
- checkKeyStringCoercion(maybeKey);
1054
- }
1055
-
1056
- key = '' + maybeKey;
1057
- }
1058
-
1059
- if (hasValidKey(config)) {
1060
- {
1061
- checkKeyStringCoercion(config.key);
1062
- }
1063
-
1064
- key = '' + config.key;
1065
- }
1066
-
1067
- if (hasValidRef(config)) ;
1068
-
1069
- var props;
1070
-
1071
- if (!('key' in config)) {
1072
- // If key was not spread in, we can reuse the original props object. This
1073
- // only works for `jsx`, not `createElement`, because `jsx` is a compiler
1074
- // target and the compiler always passes a new object. For `createElement`,
1075
- // we can't assume a new object is passed every time because it can be
1076
- // called manually.
1077
- //
1078
- // Spreading key is a warning in dev. In a future release, we will not
1079
- // remove a spread key from the props object. (But we'll still warn.) We'll
1080
- // always pass the object straight through.
1081
- props = config;
1082
- } else {
1083
- // We need to remove reserved props (key, prop, ref). Create a fresh props
1084
- // object and copy over all the non-reserved props. We don't use `delete`
1085
- // because in V8 it will deopt the object to dictionary mode.
1086
- props = {};
1087
-
1088
- for (var propName in config) {
1089
- // Skip over reserved prop names
1090
- if (propName !== 'key' && (enableRefAsProp )) {
1091
- {
1092
- props[propName] = config[propName];
1093
- }
1094
- }
458
+ children = "";
459
+ if (
460
+ void 0 === type ||
461
+ ("object" === typeof type &&
462
+ null !== type &&
463
+ 0 === Object.keys(type).length)
464
+ )
465
+ children +=
466
+ " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.";
467
+ null === type
468
+ ? (isStaticChildren = "null")
469
+ : isArrayImpl(type)
470
+ ? (isStaticChildren = "array")
471
+ : void 0 !== type && type.$$typeof === REACT_ELEMENT_TYPE
472
+ ? ((isStaticChildren =
473
+ "<" +
474
+ (getComponentNameFromType(type.type) || "Unknown") +
475
+ " />"),
476
+ (children =
477
+ " Did you accidentally export a JSX literal instead of a component?"))
478
+ : (isStaticChildren = typeof type);
479
+ console.error(
480
+ "React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",
481
+ isStaticChildren,
482
+ children
483
+ );
1095
484
  }
1096
- }
1097
-
1098
- if (key || !enableRefAsProp ) {
1099
- var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
1100
-
1101
- if (key) {
1102
- defineKeyPropWarningGetter(props, displayName);
485
+ if (hasOwnProperty.call(config, "key")) {
486
+ children = getComponentNameFromType(type);
487
+ var keys = Object.keys(config).filter(function (k) {
488
+ return "key" !== k;
489
+ });
490
+ isStaticChildren =
491
+ 0 < keys.length
492
+ ? "{key: someKey, " + keys.join(": ..., ") + ": ...}"
493
+ : "{key: someKey}";
494
+ didWarnAboutKeySpread[children + isStaticChildren] ||
495
+ ((keys =
496
+ 0 < keys.length ? "{" + keys.join(": ..., ") + ": ...}" : "{}"),
497
+ console.error(
498
+ 'A props object containing a "key" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />',
499
+ isStaticChildren,
500
+ children,
501
+ keys,
502
+ children
503
+ ),
504
+ (didWarnAboutKeySpread[children + isStaticChildren] = !0));
1103
505
  }
1104
- }
1105
-
1106
- return ReactElement(type, key, ref, self, source, getOwner(), props);
1107
- }
1108
- }
1109
- /**
1110
- * Ensure that every element either is passed in a static location, in an
1111
- * array with an explicit keys property defined, or in an object literal
1112
- * with valid key property.
1113
- *
1114
- * @internal
1115
- * @param {ReactNode} node Statically passed child of any type.
1116
- * @param {*} parentType node's parent's type.
1117
- */
1118
-
1119
- function validateChildKeys(node, parentType) {
1120
- {
1121
- if (typeof node !== 'object' || !node) {
1122
- return;
1123
- }
1124
-
1125
- if (node.$$typeof === REACT_CLIENT_REFERENCE) ; else if (isArray(node)) {
1126
- for (var i = 0; i < node.length; i++) {
1127
- var child = node[i];
1128
-
1129
- if (isValidElement(child)) {
1130
- validateExplicitKey(child, parentType);
1131
- }
1132
- }
1133
- } else if (isValidElement(node)) {
1134
- // This element was passed in a valid location.
1135
- if (node._store) {
1136
- node._store.validated = 1;
1137
- }
1138
- } else {
1139
- var iteratorFn = getIteratorFn(node);
1140
-
1141
- if (typeof iteratorFn === 'function') {
1142
- // Entry iterators used to provide implicit keys,
1143
- // but now we print a separate warning for them later.
1144
- if (iteratorFn !== node.entries) {
1145
- var iterator = iteratorFn.call(node);
1146
-
1147
- if (iterator !== node) {
1148
- var step;
1149
-
1150
- while (!(step = iterator.next()).done) {
1151
- if (isValidElement(step.value)) {
1152
- validateExplicitKey(step.value, parentType);
1153
- }
1154
- }
506
+ children = null;
507
+ void 0 !== maybeKey &&
508
+ (checkKeyStringCoercion(maybeKey), (children = "" + maybeKey));
509
+ hasValidKey(config) &&
510
+ (checkKeyStringCoercion(config.key), (children = "" + config.key));
511
+ if ("key" in config) {
512
+ maybeKey = {};
513
+ for (var propName in config)
514
+ "key" !== propName && (maybeKey[propName] = config[propName]);
515
+ } else maybeKey = config;
516
+ children &&
517
+ defineKeyPropWarningGetter(
518
+ maybeKey,
519
+ "function" === typeof type
520
+ ? type.displayName || type.name || "Unknown"
521
+ : type
522
+ );
523
+ return ReactElement(type, children, self, source, getOwner(), maybeKey);
524
+ }
525
+ function validateChildKeys(node, parentType) {
526
+ if (
527
+ "object" === typeof node &&
528
+ node &&
529
+ node.$$typeof !== REACT_CLIENT_REFERENCE
530
+ )
531
+ if (isArrayImpl(node))
532
+ for (var i = 0; i < node.length; i++) {
533
+ var child = node[i];
534
+ isValidElement(child) && validateExplicitKey(child, parentType);
1155
535
  }
1156
- }
536
+ else if (isValidElement(node))
537
+ node._store && (node._store.validated = 1);
538
+ else if (
539
+ (null === node || "object" !== typeof node
540
+ ? (i = null)
541
+ : ((i =
542
+ (MAYBE_ITERATOR_SYMBOL && node[MAYBE_ITERATOR_SYMBOL]) ||
543
+ node["@@iterator"]),
544
+ (i = "function" === typeof i ? i : null)),
545
+ "function" === typeof i &&
546
+ i !== node.entries &&
547
+ ((i = i.call(node)), i !== node))
548
+ )
549
+ for (; !(node = i.next()).done; )
550
+ isValidElement(node.value) &&
551
+ validateExplicitKey(node.value, parentType);
552
+ }
553
+ function isValidElement(object) {
554
+ return (
555
+ "object" === typeof object &&
556
+ null !== object &&
557
+ object.$$typeof === REACT_ELEMENT_TYPE
558
+ );
559
+ }
560
+ function validateExplicitKey(element, parentType) {
561
+ if (
562
+ element._store &&
563
+ !element._store.validated &&
564
+ null == element.key &&
565
+ ((element._store.validated = 1),
566
+ (parentType = getCurrentComponentErrorInfo(parentType)),
567
+ !ownerHasKeyUseWarning[parentType])
568
+ ) {
569
+ ownerHasKeyUseWarning[parentType] = !0;
570
+ var childOwner = "";
571
+ element &&
572
+ null != element._owner &&
573
+ element._owner !== getOwner() &&
574
+ ((childOwner = null),
575
+ "number" === typeof element._owner.tag
576
+ ? (childOwner = getComponentNameFromType(element._owner.type))
577
+ : "string" === typeof element._owner.name &&
578
+ (childOwner = element._owner.name),
579
+ (childOwner = " It was passed a child from " + childOwner + "."));
580
+ var prevGetCurrentStack = ReactSharedInternals.getCurrentStack;
581
+ ReactSharedInternals.getCurrentStack = function () {
582
+ var stack = describeUnknownElementTypeFrameInDEV(element.type);
583
+ prevGetCurrentStack && (stack += prevGetCurrentStack() || "");
584
+ return stack;
585
+ };
586
+ console.error(
587
+ 'Each child in a list should have a unique "key" prop.%s%s See https://react.dev/link/warning-keys for more information.',
588
+ parentType,
589
+ childOwner
590
+ );
591
+ ReactSharedInternals.getCurrentStack = prevGetCurrentStack;
1157
592
  }
1158
593
  }
1159
- }
1160
- }
1161
- /**
1162
- * Verifies the object is a ReactElement.
1163
- * See https://reactjs.org/docs/react-api.html#isvalidelement
1164
- * @param {?object} object
1165
- * @return {boolean} True if `object` is a ReactElement.
1166
- * @final
1167
- */
1168
-
1169
-
1170
- function isValidElement(object) {
1171
- return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
1172
- }
1173
- var ownerHasKeyUseWarning = {};
1174
- /**
1175
- * Warn if the element doesn't have an explicit key assigned to it.
1176
- * This element is in an array. The array could grow and shrink or be
1177
- * reordered. All children that haven't already been validated are required to
1178
- * have a "key" property assigned to it. Error statuses are cached so a warning
1179
- * will only be shown once.
1180
- *
1181
- * @internal
1182
- * @param {ReactElement} element Element that requires a key.
1183
- * @param {*} parentType element's parent's type.
1184
- */
1185
-
1186
- function validateExplicitKey(element, parentType) {
1187
-
1188
- {
1189
- if (!element._store || element._store.validated || element.key != null) {
1190
- return;
1191
- }
1192
-
1193
- element._store.validated = 1;
1194
- var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
1195
-
1196
- if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
1197
- return;
1198
- }
1199
-
1200
- ownerHasKeyUseWarning[currentComponentErrorInfo] = true; // Usually the current owner is the offender, but if it accepts children as a
1201
- // property, it may be the creator of the child that's responsible for
1202
- // assigning it a key.
1203
-
1204
- var childOwner = '';
1205
-
1206
- if (element && element._owner != null && element._owner !== getOwner()) {
1207
- var ownerName = null;
1208
-
1209
- if (typeof element._owner.tag === 'number') {
1210
- ownerName = getComponentNameFromType(element._owner.type);
1211
- } else if (typeof element._owner.name === 'string') {
1212
- ownerName = element._owner.name;
1213
- } // Give the component that originally created this child.
1214
-
1215
-
1216
- childOwner = " It was passed a child from " + ownerName + ".";
1217
- }
1218
-
1219
- var prevGetCurrentStack = ReactSharedInternals.getCurrentStack;
1220
-
1221
- ReactSharedInternals.getCurrentStack = function () {
1222
-
1223
- var stack = describeUnknownElementTypeFrameInDEV(element.type); // Delegate to the injected renderer-specific implementation
1224
-
1225
- if (prevGetCurrentStack) {
1226
- stack += prevGetCurrentStack() || '';
1227
- }
1228
-
1229
- return stack;
594
+ function getCurrentComponentErrorInfo(parentType) {
595
+ var info = "",
596
+ owner = getOwner();
597
+ owner &&
598
+ (owner = getComponentNameFromType(owner.type)) &&
599
+ (info = "\n\nCheck the render method of `" + owner + "`.");
600
+ info ||
601
+ ((parentType = getComponentNameFromType(parentType)) &&
602
+ (info =
603
+ "\n\nCheck the top-level render call using <" + parentType + ">."));
604
+ return info;
605
+ }
606
+ var React = require("react"),
607
+ REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"),
608
+ REACT_PORTAL_TYPE = Symbol.for("react.portal"),
609
+ REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"),
610
+ REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"),
611
+ REACT_PROFILER_TYPE = Symbol.for("react.profiler");
612
+ Symbol.for("react.provider");
613
+ var REACT_CONSUMER_TYPE = Symbol.for("react.consumer"),
614
+ REACT_CONTEXT_TYPE = Symbol.for("react.context"),
615
+ REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"),
616
+ REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"),
617
+ REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"),
618
+ REACT_MEMO_TYPE = Symbol.for("react.memo"),
619
+ REACT_LAZY_TYPE = Symbol.for("react.lazy"),
620
+ REACT_OFFSCREEN_TYPE = Symbol.for("react.offscreen"),
621
+ MAYBE_ITERATOR_SYMBOL = Symbol.iterator,
622
+ REACT_CLIENT_REFERENCE$2 = Symbol.for("react.client.reference"),
623
+ ReactSharedInternals =
624
+ React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,
625
+ hasOwnProperty = Object.prototype.hasOwnProperty,
626
+ assign = Object.assign,
627
+ REACT_CLIENT_REFERENCE$1 = Symbol.for("react.client.reference"),
628
+ isArrayImpl = Array.isArray,
629
+ disabledDepth = 0,
630
+ prevLog,
631
+ prevInfo,
632
+ prevWarn,
633
+ prevError,
634
+ prevGroup,
635
+ prevGroupCollapsed,
636
+ prevGroupEnd;
637
+ disabledLog.__reactDisabledLog = !0;
638
+ var prefix,
639
+ suffix,
640
+ reentry = !1;
641
+ var componentFrameCache = new (
642
+ "function" === typeof WeakMap ? WeakMap : Map
643
+ )();
644
+ var REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"),
645
+ specialPropKeyWarningShown;
646
+ var didWarnAboutElementRef = {};
647
+ var didWarnAboutKeySpread = {},
648
+ ownerHasKeyUseWarning = {};
649
+ exports.Fragment = REACT_FRAGMENT_TYPE;
650
+ exports.jsxDEV = function (
651
+ type,
652
+ config,
653
+ maybeKey,
654
+ isStaticChildren,
655
+ source,
656
+ self
657
+ ) {
658
+ return jsxDEVImpl(type, config, maybeKey, isStaticChildren, source, self);
1230
659
  };
1231
-
1232
- error('Each child in a list should have a unique "key" prop.' + '%s%s See https://react.dev/link/warning-keys for more information.', currentComponentErrorInfo, childOwner);
1233
-
1234
- ReactSharedInternals.getCurrentStack = prevGetCurrentStack;
1235
- }
1236
- }
1237
-
1238
- function getCurrentComponentErrorInfo(parentType) {
1239
- {
1240
- var info = '';
1241
- var owner = getOwner();
1242
-
1243
- if (owner) {
1244
- var name = getComponentNameFromType(owner.type);
1245
-
1246
- if (name) {
1247
- info = '\n\nCheck the render method of `' + name + '`.';
1248
- }
1249
- }
1250
-
1251
- if (!info) {
1252
- var parentName = getComponentNameFromType(parentType);
1253
-
1254
- if (parentName) {
1255
- info = "\n\nCheck the top-level render call using <" + parentName + ">.";
1256
- }
1257
- }
1258
-
1259
- return info;
1260
- }
1261
- }
1262
-
1263
- var jsxDEV = jsxDEV$1 ;
1264
-
1265
- exports.Fragment = REACT_FRAGMENT_TYPE;
1266
- exports.jsxDEV = jsxDEV;
1267
660
  })();
1268
- }