react-dom 19.0.0-rc.0 → 19.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.
@@ -8,631 +8,417 @@
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
- if (
17
- typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&
18
- typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart ===
19
- 'function'
20
- ) {
21
- __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
22
- }
23
- var React = require('react');
24
-
25
- var ReactSharedInternals = React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
26
-
27
- // -----------------------------------------------------------------------------
28
- // React DOM Chopping Block
29
- //
30
- // Similar to main Chopping Block but only flags related to React DOM. These are
31
- // grouped because we will likely batch all of them into a single major release.
32
- // -----------------------------------------------------------------------------
33
- // Disable support for comment nodes as React DOM containers. Already disabled
34
- // in open source, but www codebase still relies on it. Need to remove.
35
-
36
- var disableCommentsAsDOMContainers = true;
37
-
38
- function error(format) {
39
- {
40
- {
41
- for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
42
- args[_key2 - 1] = arguments[_key2];
43
- }
44
-
45
- printWarning('error', format, args);
11
+ "use strict";
12
+ "production" !== process.env.NODE_ENV &&
13
+ (function () {
14
+ function noop() {}
15
+ function testStringCoercion(value) {
16
+ return "" + value;
46
17
  }
47
- }
48
- } // eslint-disable-next-line react-internal/no-production-logging
49
-
50
- function printWarning(level, format, args) {
51
- // When changing this logic, you might want to also
52
- // update consoleWithStackDev.www.js as well.
53
- {
54
- var isErrorLogger = format === '%s\n\n%s\n' || format === '%o\n\n%s\n\n%s\n';
55
-
56
- if (ReactSharedInternals.getCurrentStack) {
57
- // We only add the current stack to the console when createTask is not supported.
58
- // Since createTask requires DevTools to be open to work, this means that stacks
59
- // can be lost while DevTools isn't open but we can't detect this.
60
- var stack = ReactSharedInternals.getCurrentStack();
61
-
62
- if (stack !== '') {
63
- format += '%s';
64
- args = args.concat([stack]);
18
+ function createPortal$1(children, containerInfo, implementation) {
19
+ var key =
20
+ 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : null;
21
+ try {
22
+ testStringCoercion(key);
23
+ var JSCompiler_inline_result = !1;
24
+ } catch (e) {
25
+ JSCompiler_inline_result = !0;
65
26
  }
27
+ JSCompiler_inline_result &&
28
+ (console.error(
29
+ "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
30
+ ("function" === typeof Symbol &&
31
+ Symbol.toStringTag &&
32
+ key[Symbol.toStringTag]) ||
33
+ key.constructor.name ||
34
+ "Object"
35
+ ),
36
+ testStringCoercion(key));
37
+ return {
38
+ $$typeof: REACT_PORTAL_TYPE,
39
+ key: null == key ? null : "" + key,
40
+ children: children,
41
+ containerInfo: containerInfo,
42
+ implementation: implementation
43
+ };
66
44
  }
67
-
68
- if (isErrorLogger) {
69
- // Don't prefix our default logging formatting in ReactFiberErrorLoggger.
70
- // Don't toString the arguments.
71
- args.unshift(format);
72
- } else {
73
- // TODO: Remove this prefix and stop toStringing in the wrapper and
74
- // instead do it at each callsite as needed.
75
- // Careful: RN currently depends on this prefix
76
- // eslint-disable-next-line react-internal/safe-string-coercion
77
- args = args.map(function (item) {
78
- return String(item);
79
- });
80
- args.unshift('Warning: ' + format);
81
- } // We intentionally don't use spread (or .apply) directly because it
82
- // breaks IE9: https://github.com/facebook/react/issues/13610
83
- // eslint-disable-next-line react-internal/no-production-logging
84
-
85
-
86
- Function.prototype.apply.call(console[level], console, args);
87
- }
88
- }
89
-
90
- var NoLane =
91
- /* */
92
- 0;
93
- var SyncLane =
94
- /* */
95
- 2;
96
-
97
- var NoEventPriority = NoLane;
98
- var DiscreteEventPriority = SyncLane;
99
-
100
- function noop() {}
101
-
102
- function requestFormReset$1(element) {
103
- throw new Error('Invalid form element. requestFormReset must be passed a form that was ' + 'rendered by React.');
104
- }
105
-
106
- var DefaultDispatcher = {
107
- f
108
- /* flushSyncWork */
109
- : noop,
110
- r
111
- /* requestFormReset */
112
- : requestFormReset$1,
113
- D
114
- /* prefetchDNS */
115
- : noop,
116
- C
117
- /* preconnect */
118
- : noop,
119
- L
120
- /* preload */
121
- : noop,
122
- m
123
- /* preloadModule */
124
- : noop,
125
- X
126
- /* preinitScript */
127
- : noop,
128
- S
129
- /* preinitStyle */
130
- : noop,
131
- M
132
- /* preinitModuleScript */
133
- : noop
134
- };
135
- var Internals = {
136
- d
137
- /* ReactDOMCurrentDispatcher */
138
- : DefaultDispatcher,
139
- p
140
- /* currentUpdatePriority */
141
- : NoEventPriority,
142
- findDOMNode: null
143
- };
144
-
145
- var ReactVersion = '19.0.0';
146
-
147
- /**
148
- * HTML nodeType values that represent the type of the node
149
- */
150
- var ELEMENT_NODE = 1;
151
- var DOCUMENT_NODE = 9;
152
- var DOCUMENT_FRAGMENT_NODE = 11;
153
-
154
- function isValidContainer(node) {
155
- return !!(node && (node.nodeType === ELEMENT_NODE || node.nodeType === DOCUMENT_NODE || node.nodeType === DOCUMENT_FRAGMENT_NODE || !disableCommentsAsDOMContainers ));
156
- } // TODO: Remove this function which also includes comment nodes.
157
-
158
- var REACT_PORTAL_TYPE = Symbol.for('react.portal');
159
-
160
- /*
161
- * The `'' + value` pattern (used in perf-sensitive code) throws for Symbol
162
- * and Temporal.* types. See https://github.com/facebook/react/pull/22064.
163
- *
164
- * The functions in this module will throw an easier-to-understand,
165
- * easier-to-debug exception with a clear errors message message explaining the
166
- * problem. (Instead of a confusing exception thrown inside the implementation
167
- * of the `value` object).
168
- */
169
- // $FlowFixMe[incompatible-return] only called in DEV, so void return is not possible.
170
- function typeName(value) {
171
- {
172
- // toStringTag is needed for namespaced types like Temporal.Instant
173
- var hasToStringTag = typeof Symbol === 'function' && Symbol.toStringTag;
174
- var type = hasToStringTag && value[Symbol.toStringTag] || value.constructor.name || 'Object'; // $FlowFixMe[incompatible-return]
175
-
176
- return type;
177
- }
178
- } // $FlowFixMe[incompatible-return] only called in DEV, so void return is not possible.
179
-
180
-
181
- function willCoercionThrow(value) {
182
- {
183
- try {
184
- testStringCoercion(value);
185
- return false;
186
- } catch (e) {
187
- return true;
45
+ function getCrossOriginStringAs(as, input) {
46
+ if ("font" === as) return "";
47
+ if ("string" === typeof input)
48
+ return "use-credentials" === input ? input : "";
188
49
  }
189
- }
190
- }
191
-
192
- function testStringCoercion(value) {
193
- // If you ended up here by following an exception call stack, here's what's
194
- // happened: you supplied an object or symbol value to React (as a prop, key,
195
- // DOM attribute, CSS property, string ref, etc.) and when React tried to
196
- // coerce it to a string using `'' + value`, an exception was thrown.
197
- //
198
- // The most common types that will cause this exception are `Symbol` instances
199
- // and Temporal objects like `Temporal.Instant`. But any object that has a
200
- // `valueOf` or `[Symbol.toPrimitive]` method that throws will also cause this
201
- // exception. (Library authors do this to prevent users from using built-in
202
- // numeric operators like `+` or comparison operators like `>=` because custom
203
- // methods are needed to perform accurate arithmetic or comparison.)
204
- //
205
- // To fix the problem, coerce this object or symbol value to a string before
206
- // passing it to React. The most reliable way is usually `String(value)`.
207
- //
208
- // To find which value is throwing, check the browser or debugger console.
209
- // Before this exception was thrown, there should be `console.error` output
210
- // that shows the type (Symbol, Temporal.PlainDate, etc.) that caused the
211
- // problem and how that type was used: key, atrribute, input value prop, etc.
212
- // In most cases, this console output also shows the component and its
213
- // ancestor components where the exception happened.
214
- //
215
- // eslint-disable-next-line react-internal/safe-string-coercion
216
- return '' + value;
217
- }
218
- function checkKeyStringCoercion(value) {
219
- {
220
- if (willCoercionThrow(value)) {
221
- error('The provided key is an unsupported type %s.' + ' This value must be coerced to a string before using it here.', typeName(value));
222
-
223
- return testStringCoercion(value); // throw (to help callers find troubleshooting comments)
50
+ function getValueDescriptorExpectingObjectForWarning(thing) {
51
+ return null === thing
52
+ ? "`null`"
53
+ : void 0 === thing
54
+ ? "`undefined`"
55
+ : "" === thing
56
+ ? "an empty string"
57
+ : 'something with type "' + typeof thing + '"';
224
58
  }
225
- }
226
- }
227
-
228
- function createPortal$1(children, containerInfo, // TODO: figure out the API for cross-renderer implementation.
229
- implementation) {
230
- var key = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
231
-
232
- {
233
- checkKeyStringCoercion(key);
234
- }
235
-
236
- return {
237
- // This tag allow us to uniquely identify this as a React Portal
238
- $$typeof: REACT_PORTAL_TYPE,
239
- key: key == null ? null : '' + key,
240
- children: children,
241
- containerInfo: containerInfo,
242
- implementation: implementation
243
- };
244
- }
245
-
246
- function flushSyncImpl(fn) {
247
- var previousTransition = ReactSharedInternals.T;
248
- var previousUpdatePriority = Internals.p;
249
- /* ReactDOMCurrentUpdatePriority */
250
-
251
- try {
252
- ReactSharedInternals.T = null;
253
- Internals.p
254
- /* ReactDOMCurrentUpdatePriority */
255
- = DiscreteEventPriority;
256
-
257
- if (fn) {
258
- return fn();
259
- } else {
260
- return undefined;
59
+ function getValueDescriptorExpectingEnumForWarning(thing) {
60
+ return null === thing
61
+ ? "`null`"
62
+ : void 0 === thing
63
+ ? "`undefined`"
64
+ : "" === thing
65
+ ? "an empty string"
66
+ : "string" === typeof thing
67
+ ? JSON.stringify(thing)
68
+ : "number" === typeof thing
69
+ ? "`" + thing + "`"
70
+ : 'something with type "' + typeof thing + '"';
261
71
  }
262
- } finally {
263
- ReactSharedInternals.T = previousTransition;
264
- Internals.p
265
- /* ReactDOMCurrentUpdatePriority */
266
- = previousUpdatePriority;
267
- var wasInRender = Internals.d
268
- /* ReactDOMCurrentDispatcher */
269
- .f();
270
- /* flushSyncWork */
271
-
272
- {
273
- if (wasInRender) {
274
- error('flushSync was called from inside a lifecycle method. React cannot ' + 'flush when React is already rendering. Consider moving this call to ' + 'a scheduler task or micro task.');
275
- }
72
+ function resolveDispatcher() {
73
+ var dispatcher = ReactSharedInternals.H;
74
+ null === dispatcher &&
75
+ console.error(
76
+ "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://react.dev/link/invalid-hook-call for tips about how to debug and fix this problem."
77
+ );
78
+ return dispatcher;
276
79
  }
277
- }
278
- }
279
-
280
- var flushSync = flushSyncImpl ;
281
-
282
- function getCrossOriginString(input) {
283
- if (typeof input === 'string') {
284
- return input === 'use-credentials' ? input : '';
285
- }
286
-
287
- return undefined;
288
- }
289
- function getCrossOriginStringAs(as, input) {
290
- if (as === 'font') {
291
- return '';
292
- }
293
-
294
- if (typeof input === 'string') {
295
- return input === 'use-credentials' ? input : '';
296
- }
297
-
298
- return undefined;
299
- }
300
-
301
- function prefetchDNS(href) {
302
- {
303
- if (typeof href !== 'string' || !href) {
304
- error('ReactDOM.prefetchDNS(): Expected the `href` argument (first) to be a non-empty string but encountered %s instead.', getValueDescriptorExpectingObjectForWarning(href));
305
- } else if (arguments.length > 1) {
306
- var options = arguments[1];
307
-
308
- if (typeof options === 'object' && options.hasOwnProperty('crossOrigin')) {
309
- error('ReactDOM.prefetchDNS(): Expected only one argument, `href`, but encountered %s as a second argument instead. This argument is reserved for future options and is currently disallowed. It looks like the you are attempting to set a crossOrigin property for this DNS lookup hint. Browsers do not perform DNS queries using CORS and setting this attribute on the resource hint has no effect. Try calling ReactDOM.prefetchDNS() with just a single string argument, `href`.', getValueDescriptorExpectingEnumForWarning(options));
310
- } else {
311
- error('ReactDOM.prefetchDNS(): Expected only one argument, `href`, but encountered %s as a second argument instead. This argument is reserved for future options and is currently disallowed. Try calling ReactDOM.prefetchDNS() with just a single string argument, `href`.', getValueDescriptorExpectingEnumForWarning(options));
80
+ "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
81
+ "function" ===
82
+ typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart &&
83
+ __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
84
+ var React = require("react"),
85
+ Internals = {
86
+ d: {
87
+ f: noop,
88
+ r: function () {
89
+ throw Error(
90
+ "Invalid form element. requestFormReset must be passed a form that was rendered by React."
91
+ );
92
+ },
93
+ D: noop,
94
+ C: noop,
95
+ L: noop,
96
+ m: noop,
97
+ X: noop,
98
+ S: noop,
99
+ M: noop
100
+ },
101
+ p: 0,
102
+ findDOMNode: null
103
+ },
104
+ REACT_PORTAL_TYPE = Symbol.for("react.portal"),
105
+ ReactSharedInternals =
106
+ React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
107
+ ("function" === typeof Map &&
108
+ null != Map.prototype &&
109
+ "function" === typeof Map.prototype.forEach &&
110
+ "function" === typeof Set &&
111
+ null != Set.prototype &&
112
+ "function" === typeof Set.prototype.clear &&
113
+ "function" === typeof Set.prototype.forEach) ||
114
+ console.error(
115
+ "React depends on Map and Set built-in types. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills"
116
+ );
117
+ exports.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE =
118
+ Internals;
119
+ exports.createPortal = function (children, container) {
120
+ var key =
121
+ 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : null;
122
+ if (
123
+ !container ||
124
+ (1 !== container.nodeType &&
125
+ 9 !== container.nodeType &&
126
+ 11 !== container.nodeType)
127
+ )
128
+ throw Error("Target container is not a DOM element.");
129
+ return createPortal$1(children, container, null, key);
130
+ };
131
+ exports.flushSync = function (fn) {
132
+ var previousTransition = ReactSharedInternals.T,
133
+ previousUpdatePriority = Internals.p;
134
+ try {
135
+ if (((ReactSharedInternals.T = null), (Internals.p = 2), fn))
136
+ return fn();
137
+ } finally {
138
+ (ReactSharedInternals.T = previousTransition),
139
+ (Internals.p = previousUpdatePriority),
140
+ Internals.d.f() &&
141
+ console.error(
142
+ "flushSync was called from inside a lifecycle method. React cannot flush when React is already rendering. Consider moving this call to a scheduler task or micro task."
143
+ );
312
144
  }
313
- }
314
- }
315
-
316
- if (typeof href === 'string') {
317
- Internals.d
318
- /* ReactDOMCurrentDispatcher */
319
- .D(
320
- /* prefetchDNS */
321
- href);
322
- } // We don't error because preconnect needs to be resilient to being called in a variety of scopes
323
- // and the runtime may not be capable of responding. The function is optimistic and not critical
324
- // so we favor silent bailout over warning or erroring.
325
-
326
- }
327
- function preconnect(href, options) {
328
- {
329
- if (typeof href !== 'string' || !href) {
330
- error('ReactDOM.preconnect(): Expected the `href` argument (first) to be a non-empty string but encountered %s instead.', getValueDescriptorExpectingObjectForWarning(href));
331
- } else if (options != null && typeof options !== 'object') {
332
- error('ReactDOM.preconnect(): Expected the `options` argument (second) to be an object but encountered %s instead. The only supported option at this time is `crossOrigin` which accepts a string.', getValueDescriptorExpectingEnumForWarning(options));
333
- } else if (options != null && typeof options.crossOrigin !== 'string') {
334
- error('ReactDOM.preconnect(): Expected the `crossOrigin` option (second argument) to be a string but encountered %s instead. Try removing this option or passing a string value instead.', getValueDescriptorExpectingObjectForWarning(options.crossOrigin));
335
- }
336
- }
337
-
338
- if (typeof href === 'string') {
339
- var crossOrigin = options ? getCrossOriginString(options.crossOrigin) : null;
340
- Internals.d
341
- /* ReactDOMCurrentDispatcher */
342
- .C(
343
- /* preconnect */
344
- href, crossOrigin);
345
- } // We don't error because preconnect needs to be resilient to being called in a variety of scopes
346
- // and the runtime may not be capable of responding. The function is optimistic and not critical
347
- // so we favor silent bailout over warning or erroring.
348
-
349
- }
350
- function preload(href, options) {
351
- {
352
- var encountered = '';
353
-
354
- if (typeof href !== 'string' || !href) {
355
- encountered += " The `href` argument encountered was " + getValueDescriptorExpectingObjectForWarning(href) + ".";
356
- }
357
-
358
- if (options == null || typeof options !== 'object') {
359
- encountered += " The `options` argument encountered was " + getValueDescriptorExpectingObjectForWarning(options) + ".";
360
- } else if (typeof options.as !== 'string' || !options.as) {
361
- encountered += " The `as` option encountered was " + getValueDescriptorExpectingObjectForWarning(options.as) + ".";
362
- }
363
-
364
- if (encountered) {
365
- error('ReactDOM.preload(): Expected two arguments, a non-empty `href` string and an `options` object with an `as` property valid for a `<link rel="preload" as="..." />` tag.%s', encountered);
366
- }
367
- }
368
-
369
- if (typeof href === 'string' && // We check existence because we cannot enforce this function is actually called with the stated type
370
- typeof options === 'object' && options !== null && typeof options.as === 'string') {
371
- var as = options.as;
372
- var crossOrigin = getCrossOriginStringAs(as, options.crossOrigin);
373
- Internals.d
374
- /* ReactDOMCurrentDispatcher */
375
- .L(
376
- /* preload */
377
- href, as, {
378
- crossOrigin: crossOrigin,
379
- integrity: typeof options.integrity === 'string' ? options.integrity : undefined,
380
- nonce: typeof options.nonce === 'string' ? options.nonce : undefined,
381
- type: typeof options.type === 'string' ? options.type : undefined,
382
- fetchPriority: typeof options.fetchPriority === 'string' ? options.fetchPriority : undefined,
383
- referrerPolicy: typeof options.referrerPolicy === 'string' ? options.referrerPolicy : undefined,
384
- imageSrcSet: typeof options.imageSrcSet === 'string' ? options.imageSrcSet : undefined,
385
- imageSizes: typeof options.imageSizes === 'string' ? options.imageSizes : undefined,
386
- media: typeof options.media === 'string' ? options.media : undefined
387
- });
388
- } // We don't error because preload needs to be resilient to being called in a variety of scopes
389
- // and the runtime may not be capable of responding. The function is optimistic and not critical
390
- // so we favor silent bailout over warning or erroring.
391
-
392
- }
393
- function preloadModule(href, options) {
394
- {
395
- var encountered = '';
396
-
397
- if (typeof href !== 'string' || !href) {
398
- encountered += " The `href` argument encountered was " + getValueDescriptorExpectingObjectForWarning(href) + ".";
399
- }
400
-
401
- if (options !== undefined && typeof options !== 'object') {
402
- encountered += " The `options` argument encountered was " + getValueDescriptorExpectingObjectForWarning(options) + ".";
403
- } else if (options && 'as' in options && typeof options.as !== 'string') {
404
- encountered += " The `as` option encountered was " + getValueDescriptorExpectingObjectForWarning(options.as) + ".";
405
- }
406
-
407
- if (encountered) {
408
- error('ReactDOM.preloadModule(): Expected two arguments, a non-empty `href` string and, optionally, an `options` object with an `as` property valid for a `<link rel="modulepreload" as="..." />` tag.%s', encountered);
409
- }
410
- }
411
-
412
- if (typeof href === 'string') {
413
- if (options) {
414
- var crossOrigin = getCrossOriginStringAs(options.as, options.crossOrigin);
415
- Internals.d
416
- /* ReactDOMCurrentDispatcher */
417
- .m(
418
- /* preloadModule */
419
- href, {
420
- as: typeof options.as === 'string' && options.as !== 'script' ? options.as : undefined,
421
- crossOrigin: crossOrigin,
422
- integrity: typeof options.integrity === 'string' ? options.integrity : undefined
423
- });
424
- } else {
425
- Internals.d
426
- /* ReactDOMCurrentDispatcher */
427
- .m(
428
- /* preloadModule */
429
- href);
430
- }
431
- } // We don't error because preload needs to be resilient to being called in a variety of scopes
432
- // and the runtime may not be capable of responding. The function is optimistic and not critical
433
- // so we favor silent bailout over warning or erroring.
434
-
435
- }
436
- function preinit(href, options) {
437
- {
438
- if (typeof href !== 'string' || !href) {
439
- error('ReactDOM.preinit(): Expected the `href` argument (first) to be a non-empty string but encountered %s instead.', getValueDescriptorExpectingObjectForWarning(href));
440
- } else if (options == null || typeof options !== 'object') {
441
- error('ReactDOM.preinit(): Expected the `options` argument (second) to be an object with an `as` property describing the type of resource to be preinitialized but encountered %s instead.', getValueDescriptorExpectingEnumForWarning(options));
442
- } else if (options.as !== 'style' && options.as !== 'script') {
443
- error('ReactDOM.preinit(): Expected the `as` property in the `options` argument (second) to contain a valid value describing the type of resource to be preinitialized but encountered %s instead. Valid values for `as` are "style" and "script".', getValueDescriptorExpectingEnumForWarning(options.as));
444
- }
445
- }
446
-
447
- if (typeof href === 'string' && options && typeof options.as === 'string') {
448
- var as = options.as;
449
- var crossOrigin = getCrossOriginStringAs(as, options.crossOrigin);
450
- var integrity = typeof options.integrity === 'string' ? options.integrity : undefined;
451
- var fetchPriority = typeof options.fetchPriority === 'string' ? options.fetchPriority : undefined;
452
-
453
- if (as === 'style') {
454
- Internals.d
455
- /* ReactDOMCurrentDispatcher */
456
- .S(
457
- /* preinitStyle */
458
- href, typeof options.precedence === 'string' ? options.precedence : undefined, {
459
- crossOrigin: crossOrigin,
460
- integrity: integrity,
461
- fetchPriority: fetchPriority
462
- });
463
- } else if (as === 'script') {
464
- Internals.d
465
- /* ReactDOMCurrentDispatcher */
466
- .X(
467
- /* preinitScript */
468
- href, {
469
- crossOrigin: crossOrigin,
470
- integrity: integrity,
471
- fetchPriority: fetchPriority,
472
- nonce: typeof options.nonce === 'string' ? options.nonce : undefined
473
- });
474
- }
475
- } // We don't error because preinit needs to be resilient to being called in a variety of scopes
476
- // and the runtime may not be capable of responding. The function is optimistic and not critical
477
- // so we favor silent bailout over warning or erroring.
478
-
479
- }
480
- function preinitModule(href, options) {
481
- {
482
- var encountered = '';
483
-
484
- if (typeof href !== 'string' || !href) {
485
- encountered += " The `href` argument encountered was " + getValueDescriptorExpectingObjectForWarning(href) + ".";
486
- }
487
-
488
- if (options !== undefined && typeof options !== 'object') {
489
- encountered += " The `options` argument encountered was " + getValueDescriptorExpectingObjectForWarning(options) + ".";
490
- } else if (options && 'as' in options && options.as !== 'script') {
491
- encountered += " The `as` option encountered was " + getValueDescriptorExpectingEnumForWarning(options.as) + ".";
492
- }
493
-
494
- if (encountered) {
495
- error('ReactDOM.preinitModule(): Expected up to two arguments, a non-empty `href` string and, optionally, an `options` object with a valid `as` property.%s', encountered);
496
- } else {
497
- var as = options && typeof options.as === 'string' ? options.as : 'script';
498
-
499
- switch (as) {
500
- case 'script':
501
- {
502
- break;
503
- }
504
- // We have an invalid as type and need to warn
505
-
506
- default:
507
- {
508
- var typeOfAs = getValueDescriptorExpectingEnumForWarning(as);
509
-
510
- error('ReactDOM.preinitModule(): Currently the only supported "as" type for this function is "script"' + ' but received "%s" instead. This warning was generated for `href` "%s". In the future other' + ' module types will be supported, aligning with the import-attributes proposal. Learn more here:' + ' (https://github.com/tc39/proposal-import-attributes)', typeOfAs, href);
511
- }
145
+ };
146
+ exports.preconnect = function (href, options) {
147
+ "string" === typeof href && href
148
+ ? null != options && "object" !== typeof options
149
+ ? console.error(
150
+ "ReactDOM.preconnect(): Expected the `options` argument (second) to be an object but encountered %s instead. The only supported option at this time is `crossOrigin` which accepts a string.",
151
+ getValueDescriptorExpectingEnumForWarning(options)
152
+ )
153
+ : null != options &&
154
+ "string" !== typeof options.crossOrigin &&
155
+ console.error(
156
+ "ReactDOM.preconnect(): Expected the `crossOrigin` option (second argument) to be a string but encountered %s instead. Try removing this option or passing a string value instead.",
157
+ getValueDescriptorExpectingObjectForWarning(options.crossOrigin)
158
+ )
159
+ : console.error(
160
+ "ReactDOM.preconnect(): Expected the `href` argument (first) to be a non-empty string but encountered %s instead.",
161
+ getValueDescriptorExpectingObjectForWarning(href)
162
+ );
163
+ "string" === typeof href &&
164
+ (options
165
+ ? ((options = options.crossOrigin),
166
+ (options =
167
+ "string" === typeof options
168
+ ? "use-credentials" === options
169
+ ? options
170
+ : ""
171
+ : void 0))
172
+ : (options = null),
173
+ Internals.d.C(href, options));
174
+ };
175
+ exports.prefetchDNS = function (href) {
176
+ if ("string" !== typeof href || !href)
177
+ console.error(
178
+ "ReactDOM.prefetchDNS(): Expected the `href` argument (first) to be a non-empty string but encountered %s instead.",
179
+ getValueDescriptorExpectingObjectForWarning(href)
180
+ );
181
+ else if (1 < arguments.length) {
182
+ var options = arguments[1];
183
+ "object" === typeof options && options.hasOwnProperty("crossOrigin")
184
+ ? console.error(
185
+ "ReactDOM.prefetchDNS(): Expected only one argument, `href`, but encountered %s as a second argument instead. This argument is reserved for future options and is currently disallowed. It looks like the you are attempting to set a crossOrigin property for this DNS lookup hint. Browsers do not perform DNS queries using CORS and setting this attribute on the resource hint has no effect. Try calling ReactDOM.prefetchDNS() with just a single string argument, `href`.",
186
+ getValueDescriptorExpectingEnumForWarning(options)
187
+ )
188
+ : console.error(
189
+ "ReactDOM.prefetchDNS(): Expected only one argument, `href`, but encountered %s as a second argument instead. This argument is reserved for future options and is currently disallowed. Try calling ReactDOM.prefetchDNS() with just a single string argument, `href`.",
190
+ getValueDescriptorExpectingEnumForWarning(options)
191
+ );
512
192
  }
513
- }
514
- }
515
-
516
- if (typeof href === 'string') {
517
- if (typeof options === 'object' && options !== null) {
518
- if (options.as == null || options.as === 'script') {
519
- var crossOrigin = getCrossOriginStringAs(options.as, options.crossOrigin);
520
- Internals.d
521
- /* ReactDOMCurrentDispatcher */
522
- .M(
523
- /* preinitModuleScript */
524
- href, {
193
+ "string" === typeof href && Internals.d.D(href);
194
+ };
195
+ exports.preinit = function (href, options) {
196
+ "string" === typeof href && href
197
+ ? null == options || "object" !== typeof options
198
+ ? console.error(
199
+ "ReactDOM.preinit(): Expected the `options` argument (second) to be an object with an `as` property describing the type of resource to be preinitialized but encountered %s instead.",
200
+ getValueDescriptorExpectingEnumForWarning(options)
201
+ )
202
+ : "style" !== options.as &&
203
+ "script" !== options.as &&
204
+ console.error(
205
+ 'ReactDOM.preinit(): Expected the `as` property in the `options` argument (second) to contain a valid value describing the type of resource to be preinitialized but encountered %s instead. Valid values for `as` are "style" and "script".',
206
+ getValueDescriptorExpectingEnumForWarning(options.as)
207
+ )
208
+ : console.error(
209
+ "ReactDOM.preinit(): Expected the `href` argument (first) to be a non-empty string but encountered %s instead.",
210
+ getValueDescriptorExpectingObjectForWarning(href)
211
+ );
212
+ if (
213
+ "string" === typeof href &&
214
+ options &&
215
+ "string" === typeof options.as
216
+ ) {
217
+ var as = options.as,
218
+ crossOrigin = getCrossOriginStringAs(as, options.crossOrigin),
219
+ integrity =
220
+ "string" === typeof options.integrity ? options.integrity : void 0,
221
+ fetchPriority =
222
+ "string" === typeof options.fetchPriority
223
+ ? options.fetchPriority
224
+ : void 0;
225
+ "style" === as
226
+ ? Internals.d.S(
227
+ href,
228
+ "string" === typeof options.precedence
229
+ ? options.precedence
230
+ : void 0,
231
+ {
232
+ crossOrigin: crossOrigin,
233
+ integrity: integrity,
234
+ fetchPriority: fetchPriority
235
+ }
236
+ )
237
+ : "script" === as &&
238
+ Internals.d.X(href, {
239
+ crossOrigin: crossOrigin,
240
+ integrity: integrity,
241
+ fetchPriority: fetchPriority,
242
+ nonce: "string" === typeof options.nonce ? options.nonce : void 0
243
+ });
244
+ }
245
+ };
246
+ exports.preinitModule = function (href, options) {
247
+ var encountered = "";
248
+ ("string" === typeof href && href) ||
249
+ (encountered +=
250
+ " The `href` argument encountered was " +
251
+ getValueDescriptorExpectingObjectForWarning(href) +
252
+ ".");
253
+ void 0 !== options && "object" !== typeof options
254
+ ? (encountered +=
255
+ " The `options` argument encountered was " +
256
+ getValueDescriptorExpectingObjectForWarning(options) +
257
+ ".")
258
+ : options &&
259
+ "as" in options &&
260
+ "script" !== options.as &&
261
+ (encountered +=
262
+ " The `as` option encountered was " +
263
+ getValueDescriptorExpectingEnumForWarning(options.as) +
264
+ ".");
265
+ if (encountered)
266
+ console.error(
267
+ "ReactDOM.preinitModule(): Expected up to two arguments, a non-empty `href` string and, optionally, an `options` object with a valid `as` property.%s",
268
+ encountered
269
+ );
270
+ else
271
+ switch (
272
+ ((encountered =
273
+ options && "string" === typeof options.as ? options.as : "script"),
274
+ encountered)
275
+ ) {
276
+ case "script":
277
+ break;
278
+ default:
279
+ (encountered =
280
+ getValueDescriptorExpectingEnumForWarning(encountered)),
281
+ console.error(
282
+ 'ReactDOM.preinitModule(): Currently the only supported "as" type for this function is "script" but received "%s" instead. This warning was generated for `href` "%s". In the future other module types will be supported, aligning with the import-attributes proposal. Learn more here: (https://github.com/tc39/proposal-import-attributes)',
283
+ encountered,
284
+ href
285
+ );
286
+ }
287
+ if ("string" === typeof href)
288
+ if ("object" === typeof options && null !== options) {
289
+ if (null == options.as || "script" === options.as)
290
+ (encountered = getCrossOriginStringAs(
291
+ options.as,
292
+ options.crossOrigin
293
+ )),
294
+ Internals.d.M(href, {
295
+ crossOrigin: encountered,
296
+ integrity:
297
+ "string" === typeof options.integrity
298
+ ? options.integrity
299
+ : void 0,
300
+ nonce:
301
+ "string" === typeof options.nonce ? options.nonce : void 0
302
+ });
303
+ } else null == options && Internals.d.M(href);
304
+ };
305
+ exports.preload = function (href, options) {
306
+ var encountered = "";
307
+ ("string" === typeof href && href) ||
308
+ (encountered +=
309
+ " The `href` argument encountered was " +
310
+ getValueDescriptorExpectingObjectForWarning(href) +
311
+ ".");
312
+ null == options || "object" !== typeof options
313
+ ? (encountered +=
314
+ " The `options` argument encountered was " +
315
+ getValueDescriptorExpectingObjectForWarning(options) +
316
+ ".")
317
+ : ("string" === typeof options.as && options.as) ||
318
+ (encountered +=
319
+ " The `as` option encountered was " +
320
+ getValueDescriptorExpectingObjectForWarning(options.as) +
321
+ ".");
322
+ encountered &&
323
+ console.error(
324
+ 'ReactDOM.preload(): Expected two arguments, a non-empty `href` string and an `options` object with an `as` property valid for a `<link rel="preload" as="..." />` tag.%s',
325
+ encountered
326
+ );
327
+ if (
328
+ "string" === typeof href &&
329
+ "object" === typeof options &&
330
+ null !== options &&
331
+ "string" === typeof options.as
332
+ ) {
333
+ encountered = options.as;
334
+ var crossOrigin = getCrossOriginStringAs(
335
+ encountered,
336
+ options.crossOrigin
337
+ );
338
+ Internals.d.L(href, encountered, {
525
339
  crossOrigin: crossOrigin,
526
- integrity: typeof options.integrity === 'string' ? options.integrity : undefined,
527
- nonce: typeof options.nonce === 'string' ? options.nonce : undefined
340
+ integrity:
341
+ "string" === typeof options.integrity ? options.integrity : void 0,
342
+ nonce: "string" === typeof options.nonce ? options.nonce : void 0,
343
+ type: "string" === typeof options.type ? options.type : void 0,
344
+ fetchPriority:
345
+ "string" === typeof options.fetchPriority
346
+ ? options.fetchPriority
347
+ : void 0,
348
+ referrerPolicy:
349
+ "string" === typeof options.referrerPolicy
350
+ ? options.referrerPolicy
351
+ : void 0,
352
+ imageSrcSet:
353
+ "string" === typeof options.imageSrcSet
354
+ ? options.imageSrcSet
355
+ : void 0,
356
+ imageSizes:
357
+ "string" === typeof options.imageSizes
358
+ ? options.imageSizes
359
+ : void 0,
360
+ media: "string" === typeof options.media ? options.media : void 0
528
361
  });
529
362
  }
530
- } else if (options == null) {
531
- Internals.d
532
- /* ReactDOMCurrentDispatcher */
533
- .M(
534
- /* preinitModuleScript */
535
- href);
536
- }
537
- } // We don't error because preinit needs to be resilient to being called in a variety of scopes
538
- // and the runtime may not be capable of responding. The function is optimistic and not critical
539
- // so we favor silent bailout over warning or erroring.
540
-
541
- }
542
-
543
- function getValueDescriptorExpectingObjectForWarning(thing) {
544
- return thing === null ? '`null`' : thing === undefined ? '`undefined`' : thing === '' ? 'an empty string' : "something with type \"" + typeof thing + "\"";
545
- }
546
-
547
- function getValueDescriptorExpectingEnumForWarning(thing) {
548
- return thing === null ? '`null`' : thing === undefined ? '`undefined`' : thing === '' ? 'an empty string' : typeof thing === 'string' ? JSON.stringify(thing) : typeof thing === 'number' ? '`' + thing + '`' : "something with type \"" + typeof thing + "\"";
549
- }
550
-
551
- function resolveDispatcher() {
552
- // Copied from react/src/ReactHooks.js. It's the same thing but in a
553
- // different package.
554
- var dispatcher = ReactSharedInternals.H;
555
-
556
- {
557
- if (dispatcher === null) {
558
- 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:\n' + '1. You might have mismatching versions of React and the renderer (such as React DOM)\n' + '2. You might be breaking the Rules of Hooks\n' + '3. You might have more than one copy of React in the same app\n' + 'See https://react.dev/link/invalid-hook-call for tips about how to debug and fix this problem.');
559
- }
560
- } // Will result in a null access error if accessed outside render phase. We
561
- // intentionally don't throw our own error because this is in a hot path.
562
- // Also helps ensure this is inlined.
563
-
564
-
565
- return dispatcher;
566
- }
567
-
568
- function useFormStatus() {
569
- {
570
- var dispatcher = resolveDispatcher(); // $FlowFixMe[not-a-function] We know this exists because of the feature check above.
571
-
572
- return dispatcher.useHostTransitionStatus();
573
- }
574
- }
575
- function useFormState(action, initialState, permalink) {
576
- {
577
- var dispatcher = resolveDispatcher(); // $FlowFixMe[not-a-function] This is unstable, thus optional
578
-
579
- return dispatcher.useFormState(action, initialState, permalink);
580
- }
581
- }
582
- function requestFormReset(form) {
583
- Internals.d
584
- /* ReactDOMCurrentDispatcher */
585
- .r(
586
- /* requestFormReset */
587
- form);
588
- }
589
-
590
- {
591
- if (typeof Map !== 'function' || // $FlowFixMe[prop-missing] Flow incorrectly thinks Map has no prototype
592
- Map.prototype == null || typeof Map.prototype.forEach !== 'function' || typeof Set !== 'function' || // $FlowFixMe[prop-missing] Flow incorrectly thinks Set has no prototype
593
- Set.prototype == null || typeof Set.prototype.clear !== 'function' || typeof Set.prototype.forEach !== 'function') {
594
- error('React depends on Map and Set built-in types. Make sure that you load a ' + 'polyfill in older browsers. https://reactjs.org/link/react-polyfills');
595
- }
596
- }
597
-
598
- function batchedUpdates(fn, a) {
599
- // batchedUpdates is now just a passthrough noop
600
- return fn(a);
601
- }
602
-
603
- function createPortal(children, container) {
604
- var key = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
605
-
606
- if (!isValidContainer(container)) {
607
- throw new Error('Target container is not a DOM element.');
608
- } // TODO: pass ReactDOM portal implementation as third argument
609
- // $FlowFixMe[incompatible-return] The Flow type is opaque but there's no way to actually create it.
610
-
611
-
612
- return createPortal$1(children, container, null, key);
613
- }
614
-
615
- exports.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE = Internals;
616
- exports.createPortal = createPortal;
617
- exports.flushSync = flushSync;
618
- exports.preconnect = preconnect;
619
- exports.prefetchDNS = prefetchDNS;
620
- exports.preinit = preinit;
621
- exports.preinitModule = preinitModule;
622
- exports.preload = preload;
623
- exports.preloadModule = preloadModule;
624
- exports.requestFormReset = requestFormReset;
625
- exports.unstable_batchedUpdates = batchedUpdates;
626
- exports.useFormState = useFormState;
627
- exports.useFormStatus = useFormStatus;
628
- exports.version = ReactVersion;
629
- if (
630
- typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&
631
- typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop ===
632
- 'function'
633
- ) {
634
- __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
635
- }
636
-
363
+ };
364
+ exports.preloadModule = function (href, options) {
365
+ var encountered = "";
366
+ ("string" === typeof href && href) ||
367
+ (encountered +=
368
+ " The `href` argument encountered was " +
369
+ getValueDescriptorExpectingObjectForWarning(href) +
370
+ ".");
371
+ void 0 !== options && "object" !== typeof options
372
+ ? (encountered +=
373
+ " The `options` argument encountered was " +
374
+ getValueDescriptorExpectingObjectForWarning(options) +
375
+ ".")
376
+ : options &&
377
+ "as" in options &&
378
+ "string" !== typeof options.as &&
379
+ (encountered +=
380
+ " The `as` option encountered was " +
381
+ getValueDescriptorExpectingObjectForWarning(options.as) +
382
+ ".");
383
+ encountered &&
384
+ console.error(
385
+ 'ReactDOM.preloadModule(): Expected two arguments, a non-empty `href` string and, optionally, an `options` object with an `as` property valid for a `<link rel="modulepreload" as="..." />` tag.%s',
386
+ encountered
387
+ );
388
+ "string" === typeof href &&
389
+ (options
390
+ ? ((encountered = getCrossOriginStringAs(
391
+ options.as,
392
+ options.crossOrigin
393
+ )),
394
+ Internals.d.m(href, {
395
+ as:
396
+ "string" === typeof options.as && "script" !== options.as
397
+ ? options.as
398
+ : void 0,
399
+ crossOrigin: encountered,
400
+ integrity:
401
+ "string" === typeof options.integrity
402
+ ? options.integrity
403
+ : void 0
404
+ }))
405
+ : Internals.d.m(href));
406
+ };
407
+ exports.requestFormReset = function (form) {
408
+ Internals.d.r(form);
409
+ };
410
+ exports.unstable_batchedUpdates = function (fn, a) {
411
+ return fn(a);
412
+ };
413
+ exports.useFormState = function (action, initialState, permalink) {
414
+ return resolveDispatcher().useFormState(action, initialState, permalink);
415
+ };
416
+ exports.useFormStatus = function () {
417
+ return resolveDispatcher().useHostTransitionStatus();
418
+ };
419
+ exports.version = "19.0.0";
420
+ "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
421
+ "function" ===
422
+ typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
423
+ __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
637
424
  })();
638
- }