UNPKG

139 kBJavaScriptView Raw
1/** @license React v16.12.0
2 * react-dom-server.browser.development.js
3 *
4 * Copyright (c) Facebook, Inc. and its affiliates.
5 *
6 * This source code is licensed under the MIT license found in the
7 * LICENSE file in the root directory of this source tree.
8 */
9
10'use strict';
11
12
13
14if (process.env.NODE_ENV !== "production") {
15 (function() {
16'use strict';
17
18var _assign = require('object-assign');
19var React = require('react');
20var checkPropTypes = require('prop-types/checkPropTypes');
21
22// Do not require this module directly! Use normal `invariant` calls with
23// template literal strings. The messages will be replaced with error codes
24// during build.
25
26// TODO: this is special because it gets imported during build.
27
28var ReactVersion = '16.12.0';
29
30/**
31 * Use invariant() to assert state which your program assumes to be true.
32 *
33 * Provide sprintf-style format (only %s is supported) and arguments
34 * to provide information about what broke and what you were
35 * expecting.
36 *
37 * The invariant message will be stripped in production, but the invariant
38 * will remain to ensure logic does not differ in production.
39 */
40
41/**
42 * Similar to invariant but only logs a warning if the condition is not met.
43 * This can be used to log issues in development environments in critical
44 * paths. Removing the logging code for production environments will keep the
45 * same logic and follow the same code paths.
46 */
47var warningWithoutStack = function () {};
48
49{
50 warningWithoutStack = function (condition, format) {
51 for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
52 args[_key - 2] = arguments[_key];
53 }
54
55 if (format === undefined) {
56 throw new Error('`warningWithoutStack(condition, format, ...args)` requires a warning ' + 'message argument');
57 }
58
59 if (args.length > 8) {
60 // Check before the condition to catch violations early.
61 throw new Error('warningWithoutStack() currently supports at most 8 arguments.');
62 }
63
64 if (condition) {
65 return;
66 }
67
68 if (typeof console !== 'undefined') {
69 var argsWithFormat = args.map(function (item) {
70 return '' + item;
71 });
72 argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
73 // breaks IE9: https://github.com/facebook/react/issues/13610
74
75 Function.prototype.apply.call(console.error, console, argsWithFormat);
76 }
77
78 try {
79 // --- Welcome to debugging React ---
80 // This error was thrown as a convenience so that you can use this stack
81 // to find the callsite that caused this warning to fire.
82 var argIndex = 0;
83 var message = 'Warning: ' + format.replace(/%s/g, function () {
84 return args[argIndex++];
85 });
86 throw new Error(message);
87 } catch (x) {}
88 };
89}
90
91var warningWithoutStack$1 = warningWithoutStack;
92
93// The Symbol used to tag the ReactElement-like types. If there is no native Symbol
94// nor polyfill, then a plain number is used for performance.
95var hasSymbol = typeof Symbol === 'function' && Symbol.for;
96
97var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
98var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
99var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
100var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
101var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
102var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary
103// (unstable) APIs that have been removed. Can we remove the symbols?
104
105
106var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
107var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
108var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
109var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8;
110var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
111var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
112var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5;
113
114var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7;
115
116var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; // Prevent newer renderers from RTE when used with older react package versions.
117// Current owner and dispatcher used to share the same ref,
118// but PR #14548 split them out to better support the react-debug-tools package.
119
120if (!ReactSharedInternals.hasOwnProperty('ReactCurrentDispatcher')) {
121 ReactSharedInternals.ReactCurrentDispatcher = {
122 current: null
123 };
124}
125
126if (!ReactSharedInternals.hasOwnProperty('ReactCurrentBatchConfig')) {
127 ReactSharedInternals.ReactCurrentBatchConfig = {
128 suspense: null
129 };
130}
131
132/**
133 * Similar to invariant but only logs a warning if the condition is not met.
134 * This can be used to log issues in development environments in critical
135 * paths. Removing the logging code for production environments will keep the
136 * same logic and follow the same code paths.
137 */
138
139var warning = warningWithoutStack$1;
140
141{
142 warning = function (condition, format) {
143 if (condition) {
144 return;
145 }
146
147 var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
148 var stack = ReactDebugCurrentFrame.getStackAddendum(); // eslint-disable-next-line react-internal/warning-and-invariant-args
149
150 for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
151 args[_key - 2] = arguments[_key];
152 }
153
154 warningWithoutStack$1.apply(void 0, [false, format + '%s'].concat(args, [stack]));
155 };
156}
157
158var warning$1 = warning;
159
160var Uninitialized = -1;
161var Pending = 0;
162var Resolved = 1;
163var Rejected = 2;
164function refineResolvedLazyComponent(lazyComponent) {
165 return lazyComponent._status === Resolved ? lazyComponent._result : null;
166}
167function initializeLazyComponentType(lazyComponent) {
168 if (lazyComponent._status === Uninitialized) {
169 lazyComponent._status = Pending;
170 var ctor = lazyComponent._ctor;
171 var thenable = ctor();
172 lazyComponent._result = thenable;
173 thenable.then(function (moduleObject) {
174 if (lazyComponent._status === Pending) {
175 var defaultExport = moduleObject.default;
176
177 {
178 if (defaultExport === undefined) {
179 warning$1(false, 'lazy: Expected the result of a dynamic import() call. ' + 'Instead received: %s\n\nYour code should look like: \n ' + "const MyComponent = lazy(() => import('./MyComponent'))", moduleObject);
180 }
181 }
182
183 lazyComponent._status = Resolved;
184 lazyComponent._result = defaultExport;
185 }
186 }, function (error) {
187 if (lazyComponent._status === Pending) {
188 lazyComponent._status = Rejected;
189 lazyComponent._result = error;
190 }
191 });
192 }
193}
194
195function getWrappedName(outerType, innerType, wrapperName) {
196 var functionName = innerType.displayName || innerType.name || '';
197 return outerType.displayName || (functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName);
198}
199
200function getComponentName(type) {
201 if (type == null) {
202 // Host root, text node or just invalid type.
203 return null;
204 }
205
206 {
207 if (typeof type.tag === 'number') {
208 warningWithoutStack$1(false, 'Received an unexpected object in getComponentName(). ' + 'This is likely a bug in React. Please file an issue.');
209 }
210 }
211
212 if (typeof type === 'function') {
213 return type.displayName || type.name || null;
214 }
215
216 if (typeof type === 'string') {
217 return type;
218 }
219
220 switch (type) {
221 case REACT_FRAGMENT_TYPE:
222 return 'Fragment';
223
224 case REACT_PORTAL_TYPE:
225 return 'Portal';
226
227 case REACT_PROFILER_TYPE:
228 return "Profiler";
229
230 case REACT_STRICT_MODE_TYPE:
231 return 'StrictMode';
232
233 case REACT_SUSPENSE_TYPE:
234 return 'Suspense';
235
236 case REACT_SUSPENSE_LIST_TYPE:
237 return 'SuspenseList';
238 }
239
240 if (typeof type === 'object') {
241 switch (type.$$typeof) {
242 case REACT_CONTEXT_TYPE:
243 return 'Context.Consumer';
244
245 case REACT_PROVIDER_TYPE:
246 return 'Context.Provider';
247
248 case REACT_FORWARD_REF_TYPE:
249 return getWrappedName(type, type.render, 'ForwardRef');
250
251 case REACT_MEMO_TYPE:
252 return getComponentName(type.type);
253
254 case REACT_LAZY_TYPE:
255 {
256 var thenable = type;
257 var resolvedThenable = refineResolvedLazyComponent(thenable);
258
259 if (resolvedThenable) {
260 return getComponentName(resolvedThenable);
261 }
262
263 break;
264 }
265 }
266 }
267
268 return null;
269}
270
271/**
272 * Forked from fbjs/warning:
273 * https://github.com/facebook/fbjs/blob/e66ba20ad5be433eb54423f2b097d829324d9de6/packages/fbjs/src/__forks__/warning.js
274 *
275 * Only change is we use console.warn instead of console.error,
276 * and do nothing when 'console' is not supported.
277 * This really simplifies the code.
278 * ---
279 * Similar to invariant but only logs a warning if the condition is not met.
280 * This can be used to log issues in development environments in critical
281 * paths. Removing the logging code for production environments will keep the
282 * same logic and follow the same code paths.
283 */
284var lowPriorityWarningWithoutStack = function () {};
285
286{
287 var printWarning = function (format) {
288 for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
289 args[_key - 1] = arguments[_key];
290 }
291
292 var argIndex = 0;
293 var message = 'Warning: ' + format.replace(/%s/g, function () {
294 return args[argIndex++];
295 });
296
297 if (typeof console !== 'undefined') {
298 console.warn(message);
299 }
300
301 try {
302 // --- Welcome to debugging React ---
303 // This error was thrown as a convenience so that you can use this stack
304 // to find the callsite that caused this warning to fire.
305 throw new Error(message);
306 } catch (x) {}
307 };
308
309 lowPriorityWarningWithoutStack = function (condition, format) {
310 if (format === undefined) {
311 throw new Error('`lowPriorityWarningWithoutStack(condition, format, ...args)` requires a warning ' + 'message argument');
312 }
313
314 if (!condition) {
315 for (var _len2 = arguments.length, args = new Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
316 args[_key2 - 2] = arguments[_key2];
317 }
318
319 printWarning.apply(void 0, [format].concat(args));
320 }
321 };
322}
323
324var lowPriorityWarningWithoutStack$1 = lowPriorityWarningWithoutStack;
325
326var BEFORE_SLASH_RE = /^(.*)[\\\/]/;
327var describeComponentFrame = function (name, source, ownerName) {
328 var sourceInfo = '';
329
330 if (source) {
331 var path = source.fileName;
332 var fileName = path.replace(BEFORE_SLASH_RE, '');
333
334 {
335 // In DEV, include code for a common special case:
336 // prefer "folder/index.js" instead of just "index.js".
337 if (/^index\./.test(fileName)) {
338 var match = path.match(BEFORE_SLASH_RE);
339
340 if (match) {
341 var pathBeforeSlash = match[1];
342
343 if (pathBeforeSlash) {
344 var folderName = pathBeforeSlash.replace(BEFORE_SLASH_RE, '');
345 fileName = folderName + '/' + fileName;
346 }
347 }
348 }
349 }
350
351 sourceInfo = ' (at ' + fileName + ':' + source.lineNumber + ')';
352 } else if (ownerName) {
353 sourceInfo = ' (created by ' + ownerName + ')';
354 }
355
356 return '\n in ' + (name || 'Unknown') + sourceInfo;
357};
358
359// Helps identify side effects in render-phase lifecycle hooks and setState
360// reducers by double invoking them in Strict Mode.
361
362 // To preserve the "Pause on caught exceptions" behavior of the debugger, we
363// replay the begin phase of a failed component inside invokeGuardedCallback.
364
365 // Warn about deprecated, async-unsafe lifecycles; relates to RFC #6:
366
367var warnAboutDeprecatedLifecycles = true; // Gather advanced timing metrics for Profiler subtrees.
368
369 // Trace which interactions trigger each commit.
370
371 // SSR experiments
372
373var enableSuspenseServerRenderer = false;
374 // Only used in www builds.
375
376 // Only used in www builds.
377
378 // Disable javascript: URL strings in href for XSS protection.
379
380var disableJavaScriptURLs = false; // React Fire: prevent the value and checked attributes from syncing
381// with their related DOM properties
382
383 // These APIs will no longer be "unstable" in the upcoming 16.7 release,
384// Control this behavior with a flag to support 16.6 minor releases in the meanwhile.
385
386
387 // Experimental React Flare event system and event components support.
388
389var enableFlareAPI = false; // Experimental Host Component support.
390
391var enableFundamentalAPI = false; // Experimental Scope support.
392
393var enableScopeAPI = false; // New API for JSX transforms to target - https://github.com/reactjs/rfcs/pull/107
394
395 // We will enforce mocking scheduler with scheduler/unstable_mock at some point. (v17?)
396// Till then, we warn about the missing mock, but still fallback to a legacy mode compatible version
397
398 // For tests, we flush suspense fallbacks in an act scope;
399// *except* in some of our own tests, where we test incremental loading states.
400
401 // Add a callback property to suspense to notify which promises are currently
402// in the update queue. This allows reporting and tracing of what is causing
403// the user to see a loading state.
404// Also allows hydration callbacks to fire when a dehydrated boundary gets
405// hydrated or deleted.
406
407 // Part of the simplification of React.createElement so we can eventually move
408// from React.createElement to React.jsx
409// https://github.com/reactjs/rfcs/blob/createlement-rfc/text/0000-create-element-changes.md
410
411
412
413var disableLegacyContext = false;
414
415 // Flag to turn event.target and event.currentTarget in ReactNative from a reactTag to a component instance
416
417var ReactDebugCurrentFrame$1;
418var didWarnAboutInvalidateContextType;
419
420{
421 ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
422 didWarnAboutInvalidateContextType = new Set();
423}
424
425var emptyObject = {};
426
427{
428 Object.freeze(emptyObject);
429}
430
431function maskContext(type, context) {
432 var contextTypes = type.contextTypes;
433
434 if (!contextTypes) {
435 return emptyObject;
436 }
437
438 var maskedContext = {};
439
440 for (var contextName in contextTypes) {
441 maskedContext[contextName] = context[contextName];
442 }
443
444 return maskedContext;
445}
446
447function checkContextTypes(typeSpecs, values, location) {
448 {
449 checkPropTypes(typeSpecs, values, location, 'Component', ReactDebugCurrentFrame$1.getCurrentStack);
450 }
451}
452
453function validateContextBounds(context, threadID) {
454 // If we don't have enough slots in this context to store this threadID,
455 // fill it in without leaving any holes to ensure that the VM optimizes
456 // this as non-holey index properties.
457 // (Note: If `react` package is < 16.6, _threadCount is undefined.)
458 for (var i = context._threadCount | 0; i <= threadID; i++) {
459 // We assume that this is the same as the defaultValue which might not be
460 // true if we're rendering inside a secondary renderer but they are
461 // secondary because these use cases are very rare.
462 context[i] = context._currentValue2;
463 context._threadCount = i + 1;
464 }
465}
466function processContext(type, context, threadID, isClass) {
467 if (isClass) {
468 var contextType = type.contextType;
469
470 {
471 if ('contextType' in type) {
472 var isValid = // Allow null for conditional declaration
473 contextType === null || contextType !== undefined && contextType.$$typeof === REACT_CONTEXT_TYPE && contextType._context === undefined; // Not a <Context.Consumer>
474
475 if (!isValid && !didWarnAboutInvalidateContextType.has(type)) {
476 didWarnAboutInvalidateContextType.add(type);
477 var addendum = '';
478
479 if (contextType === undefined) {
480 addendum = ' However, it is set to undefined. ' + 'This can be caused by a typo or by mixing up named and default imports. ' + 'This can also happen due to a circular dependency, so ' + 'try moving the createContext() call to a separate file.';
481 } else if (typeof contextType !== 'object') {
482 addendum = ' However, it is set to a ' + typeof contextType + '.';
483 } else if (contextType.$$typeof === REACT_PROVIDER_TYPE) {
484 addendum = ' Did you accidentally pass the Context.Provider instead?';
485 } else if (contextType._context !== undefined) {
486 // <Context.Consumer>
487 addendum = ' Did you accidentally pass the Context.Consumer instead?';
488 } else {
489 addendum = ' However, it is set to an object with keys {' + Object.keys(contextType).join(', ') + '}.';
490 }
491
492 warningWithoutStack$1(false, '%s defines an invalid contextType. ' + 'contextType should point to the Context object returned by React.createContext().%s', getComponentName(type) || 'Component', addendum);
493 }
494 }
495 }
496
497 if (typeof contextType === 'object' && contextType !== null) {
498 validateContextBounds(contextType, threadID);
499 return contextType[threadID];
500 }
501
502 if (disableLegacyContext) {
503 {
504 if (type.contextTypes) {
505 warningWithoutStack$1(false, '%s uses the legacy contextTypes API which is no longer supported. ' + 'Use React.createContext() with static contextType instead.', getComponentName(type) || 'Unknown');
506 }
507 }
508
509 return emptyObject;
510 } else {
511 var maskedContext = maskContext(type, context);
512
513 {
514 if (type.contextTypes) {
515 checkContextTypes(type.contextTypes, maskedContext, 'context');
516 }
517 }
518
519 return maskedContext;
520 }
521 } else {
522 if (disableLegacyContext) {
523 {
524 if (type.contextTypes) {
525 warningWithoutStack$1(false, '%s uses the legacy contextTypes API which is no longer supported. ' + 'Use React.createContext() with React.useContext() instead.', getComponentName(type) || 'Unknown');
526 }
527 }
528
529 return undefined;
530 } else {
531 var _maskedContext = maskContext(type, context);
532
533 {
534 if (type.contextTypes) {
535 checkContextTypes(type.contextTypes, _maskedContext, 'context');
536 }
537 }
538
539 return _maskedContext;
540 }
541 }
542}
543
544// Allocates a new index for each request. Tries to stay as compact as possible so that these
545// indices can be used to reference a tightly packed array. As opposed to being used in a Map.
546// The first allocated index is 1.
547var nextAvailableThreadIDs = new Uint16Array(16);
548
549for (var i = 0; i < 15; i++) {
550 nextAvailableThreadIDs[i] = i + 1;
551}
552
553nextAvailableThreadIDs[15] = 0;
554
555function growThreadCountAndReturnNextAvailable() {
556 var oldArray = nextAvailableThreadIDs;
557 var oldSize = oldArray.length;
558 var newSize = oldSize * 2;
559
560 if (!(newSize <= 0x10000)) {
561 {
562 throw Error("Maximum number of concurrent React renderers exceeded. This can happen if you are not properly destroying the Readable provided by React. Ensure that you call .destroy() on it if you no longer want to read from it, and did not read to the end. If you use .pipe() this should be automatic.");
563 }
564 }
565
566 var newArray = new Uint16Array(newSize);
567 newArray.set(oldArray);
568 nextAvailableThreadIDs = newArray;
569 nextAvailableThreadIDs[0] = oldSize + 1;
570
571 for (var _i = oldSize; _i < newSize - 1; _i++) {
572 nextAvailableThreadIDs[_i] = _i + 1;
573 }
574
575 nextAvailableThreadIDs[newSize - 1] = 0;
576 return oldSize;
577}
578
579function allocThreadID() {
580 var nextID = nextAvailableThreadIDs[0];
581
582 if (nextID === 0) {
583 return growThreadCountAndReturnNextAvailable();
584 }
585
586 nextAvailableThreadIDs[0] = nextAvailableThreadIDs[nextID];
587 return nextID;
588}
589function freeThreadID(id) {
590 nextAvailableThreadIDs[id] = nextAvailableThreadIDs[0];
591 nextAvailableThreadIDs[0] = id;
592}
593
594// A reserved attribute.
595// It is handled by React separately and shouldn't be written to the DOM.
596var RESERVED = 0; // A simple string attribute.
597// Attributes that aren't in the whitelist are presumed to have this type.
598
599var STRING = 1; // A string attribute that accepts booleans in React. In HTML, these are called
600// "enumerated" attributes with "true" and "false" as possible values.
601// When true, it should be set to a "true" string.
602// When false, it should be set to a "false" string.
603
604var BOOLEANISH_STRING = 2; // A real boolean attribute.
605// When true, it should be present (set either to an empty string or its name).
606// When false, it should be omitted.
607
608var BOOLEAN = 3; // An attribute that can be used as a flag as well as with a value.
609// When true, it should be present (set either to an empty string or its name).
610// When false, it should be omitted.
611// For any other value, should be present with that value.
612
613var OVERLOADED_BOOLEAN = 4; // An attribute that must be numeric or parse as a numeric.
614// When falsy, it should be removed.
615
616var NUMERIC = 5; // An attribute that must be positive numeric or parse as a positive numeric.
617// When falsy, it should be removed.
618
619var POSITIVE_NUMERIC = 6;
620
621/* eslint-disable max-len */
622var ATTRIBUTE_NAME_START_CHAR = ":A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD";
623/* eslint-enable max-len */
624
625var ATTRIBUTE_NAME_CHAR = ATTRIBUTE_NAME_START_CHAR + "\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040";
626
627var ROOT_ATTRIBUTE_NAME = 'data-reactroot';
628var VALID_ATTRIBUTE_NAME_REGEX = new RegExp('^[' + ATTRIBUTE_NAME_START_CHAR + '][' + ATTRIBUTE_NAME_CHAR + ']*$');
629var hasOwnProperty$1 = Object.prototype.hasOwnProperty;
630var illegalAttributeNameCache = {};
631var validatedAttributeNameCache = {};
632function isAttributeNameSafe(attributeName) {
633 if (hasOwnProperty$1.call(validatedAttributeNameCache, attributeName)) {
634 return true;
635 }
636
637 if (hasOwnProperty$1.call(illegalAttributeNameCache, attributeName)) {
638 return false;
639 }
640
641 if (VALID_ATTRIBUTE_NAME_REGEX.test(attributeName)) {
642 validatedAttributeNameCache[attributeName] = true;
643 return true;
644 }
645
646 illegalAttributeNameCache[attributeName] = true;
647
648 {
649 warning$1(false, 'Invalid attribute name: `%s`', attributeName);
650 }
651
652 return false;
653}
654function shouldIgnoreAttribute(name, propertyInfo, isCustomComponentTag) {
655 if (propertyInfo !== null) {
656 return propertyInfo.type === RESERVED;
657 }
658
659 if (isCustomComponentTag) {
660 return false;
661 }
662
663 if (name.length > 2 && (name[0] === 'o' || name[0] === 'O') && (name[1] === 'n' || name[1] === 'N')) {
664 return true;
665 }
666
667 return false;
668}
669function shouldRemoveAttributeWithWarning(name, value, propertyInfo, isCustomComponentTag) {
670 if (propertyInfo !== null && propertyInfo.type === RESERVED) {
671 return false;
672 }
673
674 switch (typeof value) {
675 case 'function': // $FlowIssue symbol is perfectly valid here
676
677 case 'symbol':
678 // eslint-disable-line
679 return true;
680
681 case 'boolean':
682 {
683 if (isCustomComponentTag) {
684 return false;
685 }
686
687 if (propertyInfo !== null) {
688 return !propertyInfo.acceptsBooleans;
689 } else {
690 var prefix = name.toLowerCase().slice(0, 5);
691 return prefix !== 'data-' && prefix !== 'aria-';
692 }
693 }
694
695 default:
696 return false;
697 }
698}
699function shouldRemoveAttribute(name, value, propertyInfo, isCustomComponentTag) {
700 if (value === null || typeof value === 'undefined') {
701 return true;
702 }
703
704 if (shouldRemoveAttributeWithWarning(name, value, propertyInfo, isCustomComponentTag)) {
705 return true;
706 }
707
708 if (isCustomComponentTag) {
709 return false;
710 }
711
712 if (propertyInfo !== null) {
713 switch (propertyInfo.type) {
714 case BOOLEAN:
715 return !value;
716
717 case OVERLOADED_BOOLEAN:
718 return value === false;
719
720 case NUMERIC:
721 return isNaN(value);
722
723 case POSITIVE_NUMERIC:
724 return isNaN(value) || value < 1;
725 }
726 }
727
728 return false;
729}
730function getPropertyInfo(name) {
731 return properties.hasOwnProperty(name) ? properties[name] : null;
732}
733
734function PropertyInfoRecord(name, type, mustUseProperty, attributeName, attributeNamespace, sanitizeURL) {
735 this.acceptsBooleans = type === BOOLEANISH_STRING || type === BOOLEAN || type === OVERLOADED_BOOLEAN;
736 this.attributeName = attributeName;
737 this.attributeNamespace = attributeNamespace;
738 this.mustUseProperty = mustUseProperty;
739 this.propertyName = name;
740 this.type = type;
741 this.sanitizeURL = sanitizeURL;
742} // When adding attributes to this list, be sure to also add them to
743// the `possibleStandardNames` module to ensure casing and incorrect
744// name warnings.
745
746
747var properties = {}; // These props are reserved by React. They shouldn't be written to the DOM.
748
749['children', 'dangerouslySetInnerHTML', // TODO: This prevents the assignment of defaultValue to regular
750// elements (not just inputs). Now that ReactDOMInput assigns to the
751// defaultValue property -- do we need this?
752'defaultValue', 'defaultChecked', 'innerHTML', 'suppressContentEditableWarning', 'suppressHydrationWarning', 'style'].forEach(function (name) {
753 properties[name] = new PropertyInfoRecord(name, RESERVED, false, // mustUseProperty
754 name, // attributeName
755 null, // attributeNamespace
756 false);
757}); // A few React string attributes have a different name.
758// This is a mapping from React prop names to the attribute names.
759
760[['acceptCharset', 'accept-charset'], ['className', 'class'], ['htmlFor', 'for'], ['httpEquiv', 'http-equiv']].forEach(function (_ref) {
761 var name = _ref[0],
762 attributeName = _ref[1];
763 properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
764 attributeName, // attributeName
765 null, // attributeNamespace
766 false);
767}); // These are "enumerated" HTML attributes that accept "true" and "false".
768// In React, we let users pass `true` and `false` even though technically
769// these aren't boolean attributes (they are coerced to strings).
770
771['contentEditable', 'draggable', 'spellCheck', 'value'].forEach(function (name) {
772 properties[name] = new PropertyInfoRecord(name, BOOLEANISH_STRING, false, // mustUseProperty
773 name.toLowerCase(), // attributeName
774 null, // attributeNamespace
775 false);
776}); // These are "enumerated" SVG attributes that accept "true" and "false".
777// In React, we let users pass `true` and `false` even though technically
778// these aren't boolean attributes (they are coerced to strings).
779// Since these are SVG attributes, their attribute names are case-sensitive.
780
781['autoReverse', 'externalResourcesRequired', 'focusable', 'preserveAlpha'].forEach(function (name) {
782 properties[name] = new PropertyInfoRecord(name, BOOLEANISH_STRING, false, // mustUseProperty
783 name, // attributeName
784 null, // attributeNamespace
785 false);
786}); // These are HTML boolean attributes.
787
788['allowFullScreen', 'async', // Note: there is a special case that prevents it from being written to the DOM
789// on the client side because the browsers are inconsistent. Instead we call focus().
790'autoFocus', 'autoPlay', 'controls', 'default', 'defer', 'disabled', 'disablePictureInPicture', 'formNoValidate', 'hidden', 'loop', 'noModule', 'noValidate', 'open', 'playsInline', 'readOnly', 'required', 'reversed', 'scoped', 'seamless', // Microdata
791'itemScope'].forEach(function (name) {
792 properties[name] = new PropertyInfoRecord(name, BOOLEAN, false, // mustUseProperty
793 name.toLowerCase(), // attributeName
794 null, // attributeNamespace
795 false);
796}); // These are the few React props that we set as DOM properties
797// rather than attributes. These are all booleans.
798
799['checked', // Note: `option.selected` is not updated if `select.multiple` is
800// disabled with `removeAttribute`. We have special logic for handling this.
801'multiple', 'muted', 'selected'].forEach(function (name) {
802 properties[name] = new PropertyInfoRecord(name, BOOLEAN, true, // mustUseProperty
803 name, // attributeName
804 null, // attributeNamespace
805 false);
806}); // These are HTML attributes that are "overloaded booleans": they behave like
807// booleans, but can also accept a string value.
808
809['capture', 'download'].forEach(function (name) {
810 properties[name] = new PropertyInfoRecord(name, OVERLOADED_BOOLEAN, false, // mustUseProperty
811 name, // attributeName
812 null, // attributeNamespace
813 false);
814}); // These are HTML attributes that must be positive numbers.
815
816['cols', 'rows', 'size', 'span'].forEach(function (name) {
817 properties[name] = new PropertyInfoRecord(name, POSITIVE_NUMERIC, false, // mustUseProperty
818 name, // attributeName
819 null, // attributeNamespace
820 false);
821}); // These are HTML attributes that must be numbers.
822
823['rowSpan', 'start'].forEach(function (name) {
824 properties[name] = new PropertyInfoRecord(name, NUMERIC, false, // mustUseProperty
825 name.toLowerCase(), // attributeName
826 null, // attributeNamespace
827 false);
828});
829var CAMELIZE = /[\-\:]([a-z])/g;
830
831var capitalize = function (token) {
832 return token[1].toUpperCase();
833}; // This is a list of all SVG attributes that need special casing, namespacing,
834// or boolean value assignment. Regular attributes that just accept strings
835// and have the same names are omitted, just like in the HTML whitelist.
836// Some of these attributes can be hard to find. This list was created by
837// scrapping the MDN documentation.
838
839
840['accent-height', 'alignment-baseline', 'arabic-form', 'baseline-shift', 'cap-height', 'clip-path', 'clip-rule', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'dominant-baseline', 'enable-background', 'fill-opacity', 'fill-rule', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'glyph-name', 'glyph-orientation-horizontal', 'glyph-orientation-vertical', 'horiz-adv-x', 'horiz-origin-x', 'image-rendering', 'letter-spacing', 'lighting-color', 'marker-end', 'marker-mid', 'marker-start', 'overline-position', 'overline-thickness', 'paint-order', 'panose-1', 'pointer-events', 'rendering-intent', 'shape-rendering', 'stop-color', 'stop-opacity', 'strikethrough-position', 'strikethrough-thickness', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke-width', 'text-anchor', 'text-decoration', 'text-rendering', 'underline-position', 'underline-thickness', 'unicode-bidi', 'unicode-range', 'units-per-em', 'v-alphabetic', 'v-hanging', 'v-ideographic', 'v-mathematical', 'vector-effect', 'vert-adv-y', 'vert-origin-x', 'vert-origin-y', 'word-spacing', 'writing-mode', 'xmlns:xlink', 'x-height'].forEach(function (attributeName) {
841 var name = attributeName.replace(CAMELIZE, capitalize);
842 properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
843 attributeName, null, // attributeNamespace
844 false);
845}); // String SVG attributes with the xlink namespace.
846
847['xlink:actuate', 'xlink:arcrole', 'xlink:role', 'xlink:show', 'xlink:title', 'xlink:type'].forEach(function (attributeName) {
848 var name = attributeName.replace(CAMELIZE, capitalize);
849 properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
850 attributeName, 'http://www.w3.org/1999/xlink', false);
851}); // String SVG attributes with the xml namespace.
852
853['xml:base', 'xml:lang', 'xml:space'].forEach(function (attributeName) {
854 var name = attributeName.replace(CAMELIZE, capitalize);
855 properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
856 attributeName, 'http://www.w3.org/XML/1998/namespace', false);
857}); // These attribute exists both in HTML and SVG.
858// The attribute name is case-sensitive in SVG so we can't just use
859// the React name like we do for attributes that exist only in HTML.
860
861['tabIndex', 'crossOrigin'].forEach(function (attributeName) {
862 properties[attributeName] = new PropertyInfoRecord(attributeName, STRING, false, // mustUseProperty
863 attributeName.toLowerCase(), // attributeName
864 null, // attributeNamespace
865 false);
866}); // These attributes accept URLs. These must not allow javascript: URLS.
867// These will also need to accept Trusted Types object in the future.
868
869var xlinkHref = 'xlinkHref';
870properties[xlinkHref] = new PropertyInfoRecord('xlinkHref', STRING, false, // mustUseProperty
871'xlink:href', 'http://www.w3.org/1999/xlink', true);
872['src', 'href', 'action', 'formAction'].forEach(function (attributeName) {
873 properties[attributeName] = new PropertyInfoRecord(attributeName, STRING, false, // mustUseProperty
874 attributeName.toLowerCase(), // attributeName
875 null, // attributeNamespace
876 true);
877});
878
879var ReactDebugCurrentFrame$2 = null;
880
881{
882 ReactDebugCurrentFrame$2 = ReactSharedInternals.ReactDebugCurrentFrame;
883} // A javascript: URL can contain leading C0 control or \u0020 SPACE,
884// and any newline or tab are filtered out as if they're not part of the URL.
885// https://url.spec.whatwg.org/#url-parsing
886// Tab or newline are defined as \r\n\t:
887// https://infra.spec.whatwg.org/#ascii-tab-or-newline
888// A C0 control is a code point in the range \u0000 NULL to \u001F
889// INFORMATION SEPARATOR ONE, inclusive:
890// https://infra.spec.whatwg.org/#c0-control-or-space
891
892/* eslint-disable max-len */
893
894
895var isJavaScriptProtocol = /^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*\:/i;
896var didWarn = false;
897
898function sanitizeURL(url) {
899 if (disableJavaScriptURLs) {
900 if (!!isJavaScriptProtocol.test(url)) {
901 {
902 throw Error("React has blocked a javascript: URL as a security precaution." + (ReactDebugCurrentFrame$2.getStackAddendum()));
903 }
904 }
905 } else if (true && !didWarn && isJavaScriptProtocol.test(url)) {
906 didWarn = true;
907 warning$1(false, 'A future version of React will block javascript: URLs as a security precaution. ' + 'Use event handlers instead if you can. If you need to generate unsafe HTML try ' + 'using dangerouslySetInnerHTML instead. React was passed %s.', JSON.stringify(url));
908 }
909}
910
911// code copied and modified from escape-html
912
913/**
914 * Module variables.
915 * @private
916 */
917var matchHtmlRegExp = /["'&<>]/;
918/**
919 * Escapes special characters and HTML entities in a given html string.
920 *
921 * @param {string} string HTML string to escape for later insertion
922 * @return {string}
923 * @public
924 */
925
926function escapeHtml(string) {
927 var str = '' + string;
928 var match = matchHtmlRegExp.exec(str);
929
930 if (!match) {
931 return str;
932 }
933
934 var escape;
935 var html = '';
936 var index;
937 var lastIndex = 0;
938
939 for (index = match.index; index < str.length; index++) {
940 switch (str.charCodeAt(index)) {
941 case 34:
942 // "
943 escape = '&quot;';
944 break;
945
946 case 38:
947 // &
948 escape = '&amp;';
949 break;
950
951 case 39:
952 // '
953 escape = '&#x27;'; // modified from escape-html; used to be '&#39'
954
955 break;
956
957 case 60:
958 // <
959 escape = '&lt;';
960 break;
961
962 case 62:
963 // >
964 escape = '&gt;';
965 break;
966
967 default:
968 continue;
969 }
970
971 if (lastIndex !== index) {
972 html += str.substring(lastIndex, index);
973 }
974
975 lastIndex = index + 1;
976 html += escape;
977 }
978
979 return lastIndex !== index ? html + str.substring(lastIndex, index) : html;
980} // end code copied and modified from escape-html
981
982/**
983 * Escapes text to prevent scripting attacks.
984 *
985 * @param {*} text Text value to escape.
986 * @return {string} An escaped string.
987 */
988
989
990function escapeTextForBrowser(text) {
991 if (typeof text === 'boolean' || typeof text === 'number') {
992 // this shortcircuit helps perf for types that we know will never have
993 // special characters, especially given that this function is used often
994 // for numeric dom ids.
995 return '' + text;
996 }
997
998 return escapeHtml(text);
999}
1000
1001/**
1002 * Escapes attribute value to prevent scripting attacks.
1003 *
1004 * @param {*} value Value to escape.
1005 * @return {string} An escaped string.
1006 */
1007
1008function quoteAttributeValueForBrowser(value) {
1009 return '"' + escapeTextForBrowser(value) + '"';
1010}
1011
1012/**
1013 * Operations for dealing with DOM properties.
1014 */
1015
1016/**
1017 * Creates markup for the ID property.
1018 *
1019 * @param {string} id Unescaped ID.
1020 * @return {string} Markup string.
1021 */
1022
1023
1024function createMarkupForRoot() {
1025 return ROOT_ATTRIBUTE_NAME + '=""';
1026}
1027/**
1028 * Creates markup for a property.
1029 *
1030 * @param {string} name
1031 * @param {*} value
1032 * @return {?string} Markup string, or null if the property was invalid.
1033 */
1034
1035function createMarkupForProperty(name, value) {
1036 var propertyInfo = getPropertyInfo(name);
1037
1038 if (name !== 'style' && shouldIgnoreAttribute(name, propertyInfo, false)) {
1039 return '';
1040 }
1041
1042 if (shouldRemoveAttribute(name, value, propertyInfo, false)) {
1043 return '';
1044 }
1045
1046 if (propertyInfo !== null) {
1047 var attributeName = propertyInfo.attributeName;
1048 var type = propertyInfo.type;
1049
1050 if (type === BOOLEAN || type === OVERLOADED_BOOLEAN && value === true) {
1051 return attributeName + '=""';
1052 } else {
1053 if (propertyInfo.sanitizeURL) {
1054 value = '' + value;
1055 sanitizeURL(value);
1056 }
1057
1058 return attributeName + '=' + quoteAttributeValueForBrowser(value);
1059 }
1060 } else if (isAttributeNameSafe(name)) {
1061 return name + '=' + quoteAttributeValueForBrowser(value);
1062 }
1063
1064 return '';
1065}
1066/**
1067 * Creates markup for a custom property.
1068 *
1069 * @param {string} name
1070 * @param {*} value
1071 * @return {string} Markup string, or empty string if the property was invalid.
1072 */
1073
1074function createMarkupForCustomAttribute(name, value) {
1075 if (!isAttributeNameSafe(name) || value == null) {
1076 return '';
1077 }
1078
1079 return name + '=' + quoteAttributeValueForBrowser(value);
1080}
1081
1082/**
1083 * inlined Object.is polyfill to avoid requiring consumers ship their own
1084 * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
1085 */
1086function is(x, y) {
1087 return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y // eslint-disable-line no-self-compare
1088 ;
1089}
1090
1091var is$1 = typeof Object.is === 'function' ? Object.is : is;
1092
1093var currentlyRenderingComponent = null;
1094var firstWorkInProgressHook = null;
1095var workInProgressHook = null; // Whether the work-in-progress hook is a re-rendered hook
1096
1097var isReRender = false; // Whether an update was scheduled during the currently executing render pass.
1098
1099var didScheduleRenderPhaseUpdate = false; // Lazily created map of render-phase updates
1100
1101var renderPhaseUpdates = null; // Counter to prevent infinite loops.
1102
1103var numberOfReRenders = 0;
1104var RE_RENDER_LIMIT = 25;
1105var isInHookUserCodeInDev = false; // In DEV, this is the name of the currently executing primitive hook
1106
1107var currentHookNameInDev;
1108
1109function resolveCurrentlyRenderingComponent() {
1110 if (!(currentlyRenderingComponent !== null)) {
1111 {
1112 throw Error("Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://fb.me/react-invalid-hook-call for tips about how to debug and fix this problem.");
1113 }
1114 }
1115
1116 {
1117 !!isInHookUserCodeInDev ? warning$1(false, 'Do not call Hooks inside useEffect(...), useMemo(...), or other built-in Hooks. ' + 'You can only call Hooks at the top level of your React function. ' + 'For more information, see ' + 'https://fb.me/rules-of-hooks') : void 0;
1118 }
1119
1120 return currentlyRenderingComponent;
1121}
1122
1123function areHookInputsEqual(nextDeps, prevDeps) {
1124 if (prevDeps === null) {
1125 {
1126 warning$1(false, '%s received a final argument during this render, but not during ' + 'the previous render. Even though the final argument is optional, ' + 'its type cannot change between renders.', currentHookNameInDev);
1127 }
1128
1129 return false;
1130 }
1131
1132 {
1133 // Don't bother comparing lengths in prod because these arrays should be
1134 // passed inline.
1135 if (nextDeps.length !== prevDeps.length) {
1136 warning$1(false, 'The final argument passed to %s changed size between renders. The ' + 'order and size of this array must remain constant.\n\n' + 'Previous: %s\n' + 'Incoming: %s', currentHookNameInDev, "[" + nextDeps.join(', ') + "]", "[" + prevDeps.join(', ') + "]");
1137 }
1138 }
1139
1140 for (var i = 0; i < prevDeps.length && i < nextDeps.length; i++) {
1141 if (is$1(nextDeps[i], prevDeps[i])) {
1142 continue;
1143 }
1144
1145 return false;
1146 }
1147
1148 return true;
1149}
1150
1151function createHook() {
1152 if (numberOfReRenders > 0) {
1153 {
1154 {
1155 throw Error("Rendered more hooks than during the previous render");
1156 }
1157 }
1158 }
1159
1160 return {
1161 memoizedState: null,
1162 queue: null,
1163 next: null
1164 };
1165}
1166
1167function createWorkInProgressHook() {
1168 if (workInProgressHook === null) {
1169 // This is the first hook in the list
1170 if (firstWorkInProgressHook === null) {
1171 isReRender = false;
1172 firstWorkInProgressHook = workInProgressHook = createHook();
1173 } else {
1174 // There's already a work-in-progress. Reuse it.
1175 isReRender = true;
1176 workInProgressHook = firstWorkInProgressHook;
1177 }
1178 } else {
1179 if (workInProgressHook.next === null) {
1180 isReRender = false; // Append to the end of the list
1181
1182 workInProgressHook = workInProgressHook.next = createHook();
1183 } else {
1184 // There's already a work-in-progress. Reuse it.
1185 isReRender = true;
1186 workInProgressHook = workInProgressHook.next;
1187 }
1188 }
1189
1190 return workInProgressHook;
1191}
1192
1193function prepareToUseHooks(componentIdentity) {
1194 currentlyRenderingComponent = componentIdentity;
1195
1196 {
1197 isInHookUserCodeInDev = false;
1198 } // The following should have already been reset
1199 // didScheduleRenderPhaseUpdate = false;
1200 // firstWorkInProgressHook = null;
1201 // numberOfReRenders = 0;
1202 // renderPhaseUpdates = null;
1203 // workInProgressHook = null;
1204
1205}
1206function finishHooks(Component, props, children, refOrContext) {
1207 // This must be called after every function component to prevent hooks from
1208 // being used in classes.
1209 while (didScheduleRenderPhaseUpdate) {
1210 // Updates were scheduled during the render phase. They are stored in
1211 // the `renderPhaseUpdates` map. Call the component again, reusing the
1212 // work-in-progress hooks and applying the additional updates on top. Keep
1213 // restarting until no more updates are scheduled.
1214 didScheduleRenderPhaseUpdate = false;
1215 numberOfReRenders += 1; // Start over from the beginning of the list
1216
1217 workInProgressHook = null;
1218 children = Component(props, refOrContext);
1219 }
1220
1221 currentlyRenderingComponent = null;
1222 firstWorkInProgressHook = null;
1223 numberOfReRenders = 0;
1224 renderPhaseUpdates = null;
1225 workInProgressHook = null;
1226
1227 {
1228 isInHookUserCodeInDev = false;
1229 } // These were reset above
1230 // currentlyRenderingComponent = null;
1231 // didScheduleRenderPhaseUpdate = false;
1232 // firstWorkInProgressHook = null;
1233 // numberOfReRenders = 0;
1234 // renderPhaseUpdates = null;
1235 // workInProgressHook = null;
1236
1237
1238 return children;
1239}
1240
1241function readContext(context, observedBits) {
1242 var threadID = currentThreadID;
1243 validateContextBounds(context, threadID);
1244
1245 {
1246 !!isInHookUserCodeInDev ? warning$1(false, 'Context can only be read while React is rendering. ' + 'In classes, you can read it in the render method or getDerivedStateFromProps. ' + 'In function components, you can read it directly in the function body, but not ' + 'inside Hooks like useReducer() or useMemo().') : void 0;
1247 }
1248
1249 return context[threadID];
1250}
1251
1252function useContext(context, observedBits) {
1253 {
1254 currentHookNameInDev = 'useContext';
1255 }
1256
1257 resolveCurrentlyRenderingComponent();
1258 var threadID = currentThreadID;
1259 validateContextBounds(context, threadID);
1260 return context[threadID];
1261}
1262
1263function basicStateReducer(state, action) {
1264 return typeof action === 'function' ? action(state) : action;
1265}
1266
1267function useState(initialState) {
1268 {
1269 currentHookNameInDev = 'useState';
1270 }
1271
1272 return useReducer(basicStateReducer, // useReducer has a special case to support lazy useState initializers
1273 initialState);
1274}
1275function useReducer(reducer, initialArg, init) {
1276 {
1277 if (reducer !== basicStateReducer) {
1278 currentHookNameInDev = 'useReducer';
1279 }
1280 }
1281
1282 currentlyRenderingComponent = resolveCurrentlyRenderingComponent();
1283 workInProgressHook = createWorkInProgressHook();
1284
1285 if (isReRender) {
1286 // This is a re-render. Apply the new render phase updates to the previous
1287 // current hook.
1288 var queue = workInProgressHook.queue;
1289 var dispatch = queue.dispatch;
1290
1291 if (renderPhaseUpdates !== null) {
1292 // Render phase updates are stored in a map of queue -> linked list
1293 var firstRenderPhaseUpdate = renderPhaseUpdates.get(queue);
1294
1295 if (firstRenderPhaseUpdate !== undefined) {
1296 renderPhaseUpdates.delete(queue);
1297 var newState = workInProgressHook.memoizedState;
1298 var update = firstRenderPhaseUpdate;
1299
1300 do {
1301 // Process this render phase update. We don't have to check the
1302 // priority because it will always be the same as the current
1303 // render's.
1304 var action = update.action;
1305
1306 {
1307 isInHookUserCodeInDev = true;
1308 }
1309
1310 newState = reducer(newState, action);
1311
1312 {
1313 isInHookUserCodeInDev = false;
1314 }
1315
1316 update = update.next;
1317 } while (update !== null);
1318
1319 workInProgressHook.memoizedState = newState;
1320 return [newState, dispatch];
1321 }
1322 }
1323
1324 return [workInProgressHook.memoizedState, dispatch];
1325 } else {
1326 {
1327 isInHookUserCodeInDev = true;
1328 }
1329
1330 var initialState;
1331
1332 if (reducer === basicStateReducer) {
1333 // Special case for `useState`.
1334 initialState = typeof initialArg === 'function' ? initialArg() : initialArg;
1335 } else {
1336 initialState = init !== undefined ? init(initialArg) : initialArg;
1337 }
1338
1339 {
1340 isInHookUserCodeInDev = false;
1341 }
1342
1343 workInProgressHook.memoizedState = initialState;
1344
1345 var _queue = workInProgressHook.queue = {
1346 last: null,
1347 dispatch: null
1348 };
1349
1350 var _dispatch = _queue.dispatch = dispatchAction.bind(null, currentlyRenderingComponent, _queue);
1351
1352 return [workInProgressHook.memoizedState, _dispatch];
1353 }
1354}
1355
1356function useMemo(nextCreate, deps) {
1357 currentlyRenderingComponent = resolveCurrentlyRenderingComponent();
1358 workInProgressHook = createWorkInProgressHook();
1359 var nextDeps = deps === undefined ? null : deps;
1360
1361 if (workInProgressHook !== null) {
1362 var prevState = workInProgressHook.memoizedState;
1363
1364 if (prevState !== null) {
1365 if (nextDeps !== null) {
1366 var prevDeps = prevState[1];
1367
1368 if (areHookInputsEqual(nextDeps, prevDeps)) {
1369 return prevState[0];
1370 }
1371 }
1372 }
1373 }
1374
1375 {
1376 isInHookUserCodeInDev = true;
1377 }
1378
1379 var nextValue = nextCreate();
1380
1381 {
1382 isInHookUserCodeInDev = false;
1383 }
1384
1385 workInProgressHook.memoizedState = [nextValue, nextDeps];
1386 return nextValue;
1387}
1388
1389function useRef(initialValue) {
1390 currentlyRenderingComponent = resolveCurrentlyRenderingComponent();
1391 workInProgressHook = createWorkInProgressHook();
1392 var previousRef = workInProgressHook.memoizedState;
1393
1394 if (previousRef === null) {
1395 var ref = {
1396 current: initialValue
1397 };
1398
1399 {
1400 Object.seal(ref);
1401 }
1402
1403 workInProgressHook.memoizedState = ref;
1404 return ref;
1405 } else {
1406 return previousRef;
1407 }
1408}
1409
1410function useLayoutEffect(create, inputs) {
1411 {
1412 currentHookNameInDev = 'useLayoutEffect';
1413 }
1414
1415 warning$1(false, 'useLayoutEffect does nothing on the server, because its effect cannot ' + "be encoded into the server renderer's output format. This will lead " + 'to a mismatch between the initial, non-hydrated UI and the intended ' + 'UI. To avoid this, useLayoutEffect should only be used in ' + 'components that render exclusively on the client. ' + 'See https://fb.me/react-uselayouteffect-ssr for common fixes.');
1416}
1417
1418function dispatchAction(componentIdentity, queue, action) {
1419 if (!(numberOfReRenders < RE_RENDER_LIMIT)) {
1420 {
1421 throw Error("Too many re-renders. React limits the number of renders to prevent an infinite loop.");
1422 }
1423 }
1424
1425 if (componentIdentity === currentlyRenderingComponent) {
1426 // This is a render phase update. Stash it in a lazily-created map of
1427 // queue -> linked list of updates. After this render pass, we'll restart
1428 // and apply the stashed updates on top of the work-in-progress hook.
1429 didScheduleRenderPhaseUpdate = true;
1430 var update = {
1431 action: action,
1432 next: null
1433 };
1434
1435 if (renderPhaseUpdates === null) {
1436 renderPhaseUpdates = new Map();
1437 }
1438
1439 var firstRenderPhaseUpdate = renderPhaseUpdates.get(queue);
1440
1441 if (firstRenderPhaseUpdate === undefined) {
1442 renderPhaseUpdates.set(queue, update);
1443 } else {
1444 // Append the update to the end of the list.
1445 var lastRenderPhaseUpdate = firstRenderPhaseUpdate;
1446
1447 while (lastRenderPhaseUpdate.next !== null) {
1448 lastRenderPhaseUpdate = lastRenderPhaseUpdate.next;
1449 }
1450
1451 lastRenderPhaseUpdate.next = update;
1452 }
1453 } else {// This means an update has happened after the function component has
1454 // returned. On the server this is a no-op. In React Fiber, the update
1455 // would be scheduled for a future render.
1456 }
1457}
1458
1459function useCallback(callback, deps) {
1460 // Callbacks are passed as they are in the server environment.
1461 return callback;
1462}
1463
1464function useResponder(responder, props) {
1465 return {
1466 props: props,
1467 responder: responder
1468 };
1469}
1470
1471function useDeferredValue(value, config) {
1472 resolveCurrentlyRenderingComponent();
1473 return value;
1474}
1475
1476function useTransition(config) {
1477 resolveCurrentlyRenderingComponent();
1478
1479 var startTransition = function (callback) {
1480 callback();
1481 };
1482
1483 return [startTransition, false];
1484}
1485
1486function noop() {}
1487
1488var currentThreadID = 0;
1489function setCurrentThreadID(threadID) {
1490 currentThreadID = threadID;
1491}
1492var Dispatcher = {
1493 readContext: readContext,
1494 useContext: useContext,
1495 useMemo: useMemo,
1496 useReducer: useReducer,
1497 useRef: useRef,
1498 useState: useState,
1499 useLayoutEffect: useLayoutEffect,
1500 useCallback: useCallback,
1501 // useImperativeHandle is not run in the server environment
1502 useImperativeHandle: noop,
1503 // Effects are not run in the server environment.
1504 useEffect: noop,
1505 // Debugging effect
1506 useDebugValue: noop,
1507 useResponder: useResponder,
1508 useDeferredValue: useDeferredValue,
1509 useTransition: useTransition
1510};
1511
1512var HTML_NAMESPACE = 'http://www.w3.org/1999/xhtml';
1513var MATH_NAMESPACE = 'http://www.w3.org/1998/Math/MathML';
1514var SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
1515var Namespaces = {
1516 html: HTML_NAMESPACE,
1517 mathml: MATH_NAMESPACE,
1518 svg: SVG_NAMESPACE
1519}; // Assumes there is no parent namespace.
1520
1521function getIntrinsicNamespace(type) {
1522 switch (type) {
1523 case 'svg':
1524 return SVG_NAMESPACE;
1525
1526 case 'math':
1527 return MATH_NAMESPACE;
1528
1529 default:
1530 return HTML_NAMESPACE;
1531 }
1532}
1533function getChildNamespace(parentNamespace, type) {
1534 if (parentNamespace == null || parentNamespace === HTML_NAMESPACE) {
1535 // No (or default) parent namespace: potential entry point.
1536 return getIntrinsicNamespace(type);
1537 }
1538
1539 if (parentNamespace === SVG_NAMESPACE && type === 'foreignObject') {
1540 // We're leaving SVG.
1541 return HTML_NAMESPACE;
1542 } // By default, pass namespace below.
1543
1544
1545 return parentNamespace;
1546}
1547
1548var ReactDebugCurrentFrame$3 = null;
1549var ReactControlledValuePropTypes = {
1550 checkPropTypes: null
1551};
1552
1553{
1554 ReactDebugCurrentFrame$3 = ReactSharedInternals.ReactDebugCurrentFrame;
1555 var hasReadOnlyValue = {
1556 button: true,
1557 checkbox: true,
1558 image: true,
1559 hidden: true,
1560 radio: true,
1561 reset: true,
1562 submit: true
1563 };
1564 var propTypes = {
1565 value: function (props, propName, componentName) {
1566 if (hasReadOnlyValue[props.type] || props.onChange || props.readOnly || props.disabled || props[propName] == null || enableFlareAPI && props.listeners) {
1567 return null;
1568 }
1569
1570 return new Error('You provided a `value` prop to a form field without an ' + '`onChange` handler. This will render a read-only field. If ' + 'the field should be mutable use `defaultValue`. Otherwise, ' + 'set either `onChange` or `readOnly`.');
1571 },
1572 checked: function (props, propName, componentName) {
1573 if (props.onChange || props.readOnly || props.disabled || props[propName] == null || enableFlareAPI && props.listeners) {
1574 return null;
1575 }
1576
1577 return new Error('You provided a `checked` prop to a form field without an ' + '`onChange` handler. This will render a read-only field. If ' + 'the field should be mutable use `defaultChecked`. Otherwise, ' + 'set either `onChange` or `readOnly`.');
1578 }
1579 };
1580 /**
1581 * Provide a linked `value` attribute for controlled forms. You should not use
1582 * this outside of the ReactDOM controlled form components.
1583 */
1584
1585 ReactControlledValuePropTypes.checkPropTypes = function (tagName, props) {
1586 checkPropTypes(propTypes, props, 'prop', tagName, ReactDebugCurrentFrame$3.getStackAddendum);
1587 };
1588}
1589
1590// For HTML, certain tags should omit their close tag. We keep a whitelist for
1591// those special-case tags.
1592var omittedCloseTags = {
1593 area: true,
1594 base: true,
1595 br: true,
1596 col: true,
1597 embed: true,
1598 hr: true,
1599 img: true,
1600 input: true,
1601 keygen: true,
1602 link: true,
1603 meta: true,
1604 param: true,
1605 source: true,
1606 track: true,
1607 wbr: true // NOTE: menuitem's close tag should be omitted, but that causes problems.
1608
1609};
1610
1611// `omittedCloseTags` except that `menuitem` should still have its closing tag.
1612
1613var voidElementTags = _assign({
1614 menuitem: true
1615}, omittedCloseTags);
1616
1617// or add stack by default to invariants where possible.
1618
1619var HTML = '__html';
1620var ReactDebugCurrentFrame$4 = null;
1621
1622{
1623 ReactDebugCurrentFrame$4 = ReactSharedInternals.ReactDebugCurrentFrame;
1624}
1625
1626function assertValidProps(tag, props) {
1627 if (!props) {
1628 return;
1629 } // Note the use of `==` which checks for null or undefined.
1630
1631
1632 if (voidElementTags[tag]) {
1633 if (!(props.children == null && props.dangerouslySetInnerHTML == null)) {
1634 {
1635 throw Error(tag + " is a void element tag and must neither have `children` nor use `dangerouslySetInnerHTML`." + (ReactDebugCurrentFrame$4.getStackAddendum()));
1636 }
1637 }
1638 }
1639
1640 if (props.dangerouslySetInnerHTML != null) {
1641 if (!(props.children == null)) {
1642 {
1643 throw Error("Can only set one of `children` or `props.dangerouslySetInnerHTML`.");
1644 }
1645 }
1646
1647 if (!(typeof props.dangerouslySetInnerHTML === 'object' && HTML in props.dangerouslySetInnerHTML)) {
1648 {
1649 throw Error("`props.dangerouslySetInnerHTML` must be in the form `{__html: ...}`. Please visit https://fb.me/react-invariant-dangerously-set-inner-html for more information.");
1650 }
1651 }
1652 }
1653
1654 {
1655 !(props.suppressContentEditableWarning || !props.contentEditable || props.children == null) ? warning$1(false, 'A component is `contentEditable` and contains `children` managed by ' + 'React. It is now your responsibility to guarantee that none of ' + 'those nodes are unexpectedly modified or duplicated. This is ' + 'probably not intentional.') : void 0;
1656 }
1657
1658 if (!(props.style == null || typeof props.style === 'object')) {
1659 {
1660 throw Error("The `style` prop expects a mapping from style properties to values, not a string. For example, style={{marginRight: spacing + 'em'}} when using JSX." + (ReactDebugCurrentFrame$4.getStackAddendum()));
1661 }
1662 }
1663}
1664
1665/**
1666 * CSS properties which accept numbers but are not in units of "px".
1667 */
1668var isUnitlessNumber = {
1669 animationIterationCount: true,
1670 borderImageOutset: true,
1671 borderImageSlice: true,
1672 borderImageWidth: true,
1673 boxFlex: true,
1674 boxFlexGroup: true,
1675 boxOrdinalGroup: true,
1676 columnCount: true,
1677 columns: true,
1678 flex: true,
1679 flexGrow: true,
1680 flexPositive: true,
1681 flexShrink: true,
1682 flexNegative: true,
1683 flexOrder: true,
1684 gridArea: true,
1685 gridRow: true,
1686 gridRowEnd: true,
1687 gridRowSpan: true,
1688 gridRowStart: true,
1689 gridColumn: true,
1690 gridColumnEnd: true,
1691 gridColumnSpan: true,
1692 gridColumnStart: true,
1693 fontWeight: true,
1694 lineClamp: true,
1695 lineHeight: true,
1696 opacity: true,
1697 order: true,
1698 orphans: true,
1699 tabSize: true,
1700 widows: true,
1701 zIndex: true,
1702 zoom: true,
1703 // SVG-related properties
1704 fillOpacity: true,
1705 floodOpacity: true,
1706 stopOpacity: true,
1707 strokeDasharray: true,
1708 strokeDashoffset: true,
1709 strokeMiterlimit: true,
1710 strokeOpacity: true,
1711 strokeWidth: true
1712};
1713/**
1714 * @param {string} prefix vendor-specific prefix, eg: Webkit
1715 * @param {string} key style name, eg: transitionDuration
1716 * @return {string} style name prefixed with `prefix`, properly camelCased, eg:
1717 * WebkitTransitionDuration
1718 */
1719
1720function prefixKey(prefix, key) {
1721 return prefix + key.charAt(0).toUpperCase() + key.substring(1);
1722}
1723/**
1724 * Support style names that may come passed in prefixed by adding permutations
1725 * of vendor prefixes.
1726 */
1727
1728
1729var prefixes = ['Webkit', 'ms', 'Moz', 'O']; // Using Object.keys here, or else the vanilla for-in loop makes IE8 go into an
1730// infinite loop, because it iterates over the newly added props too.
1731
1732Object.keys(isUnitlessNumber).forEach(function (prop) {
1733 prefixes.forEach(function (prefix) {
1734 isUnitlessNumber[prefixKey(prefix, prop)] = isUnitlessNumber[prop];
1735 });
1736});
1737
1738/**
1739 * Convert a value into the proper css writable value. The style name `name`
1740 * should be logical (no hyphens), as specified
1741 * in `CSSProperty.isUnitlessNumber`.
1742 *
1743 * @param {string} name CSS property name such as `topMargin`.
1744 * @param {*} value CSS property value such as `10px`.
1745 * @return {string} Normalized style value with dimensions applied.
1746 */
1747
1748function dangerousStyleValue(name, value, isCustomProperty) {
1749 // Note that we've removed escapeTextForBrowser() calls here since the
1750 // whole string will be escaped when the attribute is injected into
1751 // the markup. If you provide unsafe user data here they can inject
1752 // arbitrary CSS which may be problematic (I couldn't repro this):
1753 // https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet
1754 // http://www.thespanner.co.uk/2007/11/26/ultimate-xss-css-injection/
1755 // This is not an XSS hole but instead a potential CSS injection issue
1756 // which has lead to a greater discussion about how we're going to
1757 // trust URLs moving forward. See #2115901
1758 var isEmpty = value == null || typeof value === 'boolean' || value === '';
1759
1760 if (isEmpty) {
1761 return '';
1762 }
1763
1764 if (!isCustomProperty && typeof value === 'number' && value !== 0 && !(isUnitlessNumber.hasOwnProperty(name) && isUnitlessNumber[name])) {
1765 return value + 'px'; // Presumes implicit 'px' suffix for unitless numbers
1766 }
1767
1768 return ('' + value).trim();
1769}
1770
1771var uppercasePattern = /([A-Z])/g;
1772var msPattern = /^ms-/;
1773/**
1774 * Hyphenates a camelcased CSS property name, for example:
1775 *
1776 * > hyphenateStyleName('backgroundColor')
1777 * < "background-color"
1778 * > hyphenateStyleName('MozTransition')
1779 * < "-moz-transition"
1780 * > hyphenateStyleName('msTransition')
1781 * < "-ms-transition"
1782 *
1783 * As Modernizr suggests (http://modernizr.com/docs/#prefixed), an `ms` prefix
1784 * is converted to `-ms-`.
1785 */
1786
1787function hyphenateStyleName(name) {
1788 return name.replace(uppercasePattern, '-$1').toLowerCase().replace(msPattern, '-ms-');
1789}
1790
1791function isCustomComponent(tagName, props) {
1792 if (tagName.indexOf('-') === -1) {
1793 return typeof props.is === 'string';
1794 }
1795
1796 switch (tagName) {
1797 // These are reserved SVG and MathML elements.
1798 // We don't mind this whitelist too much because we expect it to never grow.
1799 // The alternative is to track the namespace in a few places which is convoluted.
1800 // https://w3c.github.io/webcomponents/spec/custom/#custom-elements-core-concepts
1801 case 'annotation-xml':
1802 case 'color-profile':
1803 case 'font-face':
1804 case 'font-face-src':
1805 case 'font-face-uri':
1806 case 'font-face-format':
1807 case 'font-face-name':
1808 case 'missing-glyph':
1809 return false;
1810
1811 default:
1812 return true;
1813 }
1814}
1815
1816var warnValidStyle = function () {};
1817
1818{
1819 // 'msTransform' is correct, but the other prefixes should be capitalized
1820 var badVendoredStyleNamePattern = /^(?:webkit|moz|o)[A-Z]/;
1821 var msPattern$1 = /^-ms-/;
1822 var hyphenPattern = /-(.)/g; // style values shouldn't contain a semicolon
1823
1824 var badStyleValueWithSemicolonPattern = /;\s*$/;
1825 var warnedStyleNames = {};
1826 var warnedStyleValues = {};
1827 var warnedForNaNValue = false;
1828 var warnedForInfinityValue = false;
1829
1830 var camelize = function (string) {
1831 return string.replace(hyphenPattern, function (_, character) {
1832 return character.toUpperCase();
1833 });
1834 };
1835
1836 var warnHyphenatedStyleName = function (name) {
1837 if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
1838 return;
1839 }
1840
1841 warnedStyleNames[name] = true;
1842 warning$1(false, 'Unsupported style property %s. Did you mean %s?', name, // As Andi Smith suggests
1843 // (http://www.andismith.com/blog/2012/02/modernizr-prefixed/), an `-ms` prefix
1844 // is converted to lowercase `ms`.
1845 camelize(name.replace(msPattern$1, 'ms-')));
1846 };
1847
1848 var warnBadVendoredStyleName = function (name) {
1849 if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
1850 return;
1851 }
1852
1853 warnedStyleNames[name] = true;
1854 warning$1(false, 'Unsupported vendor-prefixed style property %s. Did you mean %s?', name, name.charAt(0).toUpperCase() + name.slice(1));
1855 };
1856
1857 var warnStyleValueWithSemicolon = function (name, value) {
1858 if (warnedStyleValues.hasOwnProperty(value) && warnedStyleValues[value]) {
1859 return;
1860 }
1861
1862 warnedStyleValues[value] = true;
1863 warning$1(false, "Style property values shouldn't contain a semicolon. " + 'Try "%s: %s" instead.', name, value.replace(badStyleValueWithSemicolonPattern, ''));
1864 };
1865
1866 var warnStyleValueIsNaN = function (name, value) {
1867 if (warnedForNaNValue) {
1868 return;
1869 }
1870
1871 warnedForNaNValue = true;
1872 warning$1(false, '`NaN` is an invalid value for the `%s` css style property.', name);
1873 };
1874
1875 var warnStyleValueIsInfinity = function (name, value) {
1876 if (warnedForInfinityValue) {
1877 return;
1878 }
1879
1880 warnedForInfinityValue = true;
1881 warning$1(false, '`Infinity` is an invalid value for the `%s` css style property.', name);
1882 };
1883
1884 warnValidStyle = function (name, value) {
1885 if (name.indexOf('-') > -1) {
1886 warnHyphenatedStyleName(name);
1887 } else if (badVendoredStyleNamePattern.test(name)) {
1888 warnBadVendoredStyleName(name);
1889 } else if (badStyleValueWithSemicolonPattern.test(value)) {
1890 warnStyleValueWithSemicolon(name, value);
1891 }
1892
1893 if (typeof value === 'number') {
1894 if (isNaN(value)) {
1895 warnStyleValueIsNaN(name, value);
1896 } else if (!isFinite(value)) {
1897 warnStyleValueIsInfinity(name, value);
1898 }
1899 }
1900 };
1901}
1902
1903var warnValidStyle$1 = warnValidStyle;
1904
1905var ariaProperties = {
1906 'aria-current': 0,
1907 // state
1908 'aria-details': 0,
1909 'aria-disabled': 0,
1910 // state
1911 'aria-hidden': 0,
1912 // state
1913 'aria-invalid': 0,
1914 // state
1915 'aria-keyshortcuts': 0,
1916 'aria-label': 0,
1917 'aria-roledescription': 0,
1918 // Widget Attributes
1919 'aria-autocomplete': 0,
1920 'aria-checked': 0,
1921 'aria-expanded': 0,
1922 'aria-haspopup': 0,
1923 'aria-level': 0,
1924 'aria-modal': 0,
1925 'aria-multiline': 0,
1926 'aria-multiselectable': 0,
1927 'aria-orientation': 0,
1928 'aria-placeholder': 0,
1929 'aria-pressed': 0,
1930 'aria-readonly': 0,
1931 'aria-required': 0,
1932 'aria-selected': 0,
1933 'aria-sort': 0,
1934 'aria-valuemax': 0,
1935 'aria-valuemin': 0,
1936 'aria-valuenow': 0,
1937 'aria-valuetext': 0,
1938 // Live Region Attributes
1939 'aria-atomic': 0,
1940 'aria-busy': 0,
1941 'aria-live': 0,
1942 'aria-relevant': 0,
1943 // Drag-and-Drop Attributes
1944 'aria-dropeffect': 0,
1945 'aria-grabbed': 0,
1946 // Relationship Attributes
1947 'aria-activedescendant': 0,
1948 'aria-colcount': 0,
1949 'aria-colindex': 0,
1950 'aria-colspan': 0,
1951 'aria-controls': 0,
1952 'aria-describedby': 0,
1953 'aria-errormessage': 0,
1954 'aria-flowto': 0,
1955 'aria-labelledby': 0,
1956 'aria-owns': 0,
1957 'aria-posinset': 0,
1958 'aria-rowcount': 0,
1959 'aria-rowindex': 0,
1960 'aria-rowspan': 0,
1961 'aria-setsize': 0
1962};
1963
1964var warnedProperties = {};
1965var rARIA = new RegExp('^(aria)-[' + ATTRIBUTE_NAME_CHAR + ']*$');
1966var rARIACamel = new RegExp('^(aria)[A-Z][' + ATTRIBUTE_NAME_CHAR + ']*$');
1967var hasOwnProperty$2 = Object.prototype.hasOwnProperty;
1968
1969function validateProperty(tagName, name) {
1970 if (hasOwnProperty$2.call(warnedProperties, name) && warnedProperties[name]) {
1971 return true;
1972 }
1973
1974 if (rARIACamel.test(name)) {
1975 var ariaName = 'aria-' + name.slice(4).toLowerCase();
1976 var correctName = ariaProperties.hasOwnProperty(ariaName) ? ariaName : null; // If this is an aria-* attribute, but is not listed in the known DOM
1977 // DOM properties, then it is an invalid aria-* attribute.
1978
1979 if (correctName == null) {
1980 warning$1(false, 'Invalid ARIA attribute `%s`. ARIA attributes follow the pattern aria-* and must be lowercase.', name);
1981 warnedProperties[name] = true;
1982 return true;
1983 } // aria-* attributes should be lowercase; suggest the lowercase version.
1984
1985
1986 if (name !== correctName) {
1987 warning$1(false, 'Invalid ARIA attribute `%s`. Did you mean `%s`?', name, correctName);
1988 warnedProperties[name] = true;
1989 return true;
1990 }
1991 }
1992
1993 if (rARIA.test(name)) {
1994 var lowerCasedName = name.toLowerCase();
1995 var standardName = ariaProperties.hasOwnProperty(lowerCasedName) ? lowerCasedName : null; // If this is an aria-* attribute, but is not listed in the known DOM
1996 // DOM properties, then it is an invalid aria-* attribute.
1997
1998 if (standardName == null) {
1999 warnedProperties[name] = true;
2000 return false;
2001 } // aria-* attributes should be lowercase; suggest the lowercase version.
2002
2003
2004 if (name !== standardName) {
2005 warning$1(false, 'Unknown ARIA attribute `%s`. Did you mean `%s`?', name, standardName);
2006 warnedProperties[name] = true;
2007 return true;
2008 }
2009 }
2010
2011 return true;
2012}
2013
2014function warnInvalidARIAProps(type, props) {
2015 var invalidProps = [];
2016
2017 for (var key in props) {
2018 var isValid = validateProperty(type, key);
2019
2020 if (!isValid) {
2021 invalidProps.push(key);
2022 }
2023 }
2024
2025 var unknownPropString = invalidProps.map(function (prop) {
2026 return '`' + prop + '`';
2027 }).join(', ');
2028
2029 if (invalidProps.length === 1) {
2030 warning$1(false, 'Invalid aria prop %s on <%s> tag. ' + 'For details, see https://fb.me/invalid-aria-prop', unknownPropString, type);
2031 } else if (invalidProps.length > 1) {
2032 warning$1(false, 'Invalid aria props %s on <%s> tag. ' + 'For details, see https://fb.me/invalid-aria-prop', unknownPropString, type);
2033 }
2034}
2035
2036function validateProperties(type, props) {
2037 if (isCustomComponent(type, props)) {
2038 return;
2039 }
2040
2041 warnInvalidARIAProps(type, props);
2042}
2043
2044var didWarnValueNull = false;
2045function validateProperties$1(type, props) {
2046 if (type !== 'input' && type !== 'textarea' && type !== 'select') {
2047 return;
2048 }
2049
2050 if (props != null && props.value === null && !didWarnValueNull) {
2051 didWarnValueNull = true;
2052
2053 if (type === 'select' && props.multiple) {
2054 warning$1(false, '`value` prop on `%s` should not be null. ' + 'Consider using an empty array when `multiple` is set to `true` ' + 'to clear the component or `undefined` for uncontrolled components.', type);
2055 } else {
2056 warning$1(false, '`value` prop on `%s` should not be null. ' + 'Consider using an empty string to clear the component or `undefined` ' + 'for uncontrolled components.', type);
2057 }
2058 }
2059}
2060
2061/**
2062 * Registers plugins so that they can extract and dispatch events.
2063 *
2064 * @see {EventPluginHub}
2065 */
2066
2067/**
2068 * Ordered list of injected plugins.
2069 */
2070
2071
2072
2073/**
2074 * Mapping from event name to dispatch config
2075 */
2076
2077
2078/**
2079 * Mapping from registration name to plugin module
2080 */
2081
2082var registrationNameModules = {};
2083/**
2084 * Mapping from registration name to event name
2085 */
2086
2087
2088/**
2089 * Mapping from lowercase registration names to the properly cased version,
2090 * used to warn in the case of missing event handlers. Available
2091 * only in true.
2092 * @type {Object}
2093 */
2094
2095var possibleRegistrationNames = {}; // Trust the developer to only use possibleRegistrationNames in true
2096
2097/**
2098 * Injects an ordering of plugins (by plugin name). This allows the ordering
2099 * to be decoupled from injection of the actual plugins so that ordering is
2100 * always deterministic regardless of packaging, on-the-fly injection, etc.
2101 *
2102 * @param {array} InjectedEventPluginOrder
2103 * @internal
2104 * @see {EventPluginHub.injection.injectEventPluginOrder}
2105 */
2106
2107
2108/**
2109 * Injects plugins to be used by `EventPluginHub`. The plugin names must be
2110 * in the ordering injected by `injectEventPluginOrder`.
2111 *
2112 * Plugins can be injected as part of page initialization or on-the-fly.
2113 *
2114 * @param {object} injectedNamesToPlugins Map from names to plugin modules.
2115 * @internal
2116 * @see {EventPluginHub.injection.injectEventPluginsByName}
2117 */
2118
2119// When adding attributes to the HTML or SVG whitelist, be sure to
2120// also add them to this module to ensure casing and incorrect name
2121// warnings.
2122var possibleStandardNames = {
2123 // HTML
2124 accept: 'accept',
2125 acceptcharset: 'acceptCharset',
2126 'accept-charset': 'acceptCharset',
2127 accesskey: 'accessKey',
2128 action: 'action',
2129 allowfullscreen: 'allowFullScreen',
2130 alt: 'alt',
2131 as: 'as',
2132 async: 'async',
2133 autocapitalize: 'autoCapitalize',
2134 autocomplete: 'autoComplete',
2135 autocorrect: 'autoCorrect',
2136 autofocus: 'autoFocus',
2137 autoplay: 'autoPlay',
2138 autosave: 'autoSave',
2139 capture: 'capture',
2140 cellpadding: 'cellPadding',
2141 cellspacing: 'cellSpacing',
2142 challenge: 'challenge',
2143 charset: 'charSet',
2144 checked: 'checked',
2145 children: 'children',
2146 cite: 'cite',
2147 class: 'className',
2148 classid: 'classID',
2149 classname: 'className',
2150 cols: 'cols',
2151 colspan: 'colSpan',
2152 content: 'content',
2153 contenteditable: 'contentEditable',
2154 contextmenu: 'contextMenu',
2155 controls: 'controls',
2156 controlslist: 'controlsList',
2157 coords: 'coords',
2158 crossorigin: 'crossOrigin',
2159 dangerouslysetinnerhtml: 'dangerouslySetInnerHTML',
2160 data: 'data',
2161 datetime: 'dateTime',
2162 default: 'default',
2163 defaultchecked: 'defaultChecked',
2164 defaultvalue: 'defaultValue',
2165 defer: 'defer',
2166 dir: 'dir',
2167 disabled: 'disabled',
2168 disablepictureinpicture: 'disablePictureInPicture',
2169 download: 'download',
2170 draggable: 'draggable',
2171 enctype: 'encType',
2172 for: 'htmlFor',
2173 form: 'form',
2174 formmethod: 'formMethod',
2175 formaction: 'formAction',
2176 formenctype: 'formEncType',
2177 formnovalidate: 'formNoValidate',
2178 formtarget: 'formTarget',
2179 frameborder: 'frameBorder',
2180 headers: 'headers',
2181 height: 'height',
2182 hidden: 'hidden',
2183 high: 'high',
2184 href: 'href',
2185 hreflang: 'hrefLang',
2186 htmlfor: 'htmlFor',
2187 httpequiv: 'httpEquiv',
2188 'http-equiv': 'httpEquiv',
2189 icon: 'icon',
2190 id: 'id',
2191 innerhtml: 'innerHTML',
2192 inputmode: 'inputMode',
2193 integrity: 'integrity',
2194 is: 'is',
2195 itemid: 'itemID',
2196 itemprop: 'itemProp',
2197 itemref: 'itemRef',
2198 itemscope: 'itemScope',
2199 itemtype: 'itemType',
2200 keyparams: 'keyParams',
2201 keytype: 'keyType',
2202 kind: 'kind',
2203 label: 'label',
2204 lang: 'lang',
2205 list: 'list',
2206 loop: 'loop',
2207 low: 'low',
2208 manifest: 'manifest',
2209 marginwidth: 'marginWidth',
2210 marginheight: 'marginHeight',
2211 max: 'max',
2212 maxlength: 'maxLength',
2213 media: 'media',
2214 mediagroup: 'mediaGroup',
2215 method: 'method',
2216 min: 'min',
2217 minlength: 'minLength',
2218 multiple: 'multiple',
2219 muted: 'muted',
2220 name: 'name',
2221 nomodule: 'noModule',
2222 nonce: 'nonce',
2223 novalidate: 'noValidate',
2224 open: 'open',
2225 optimum: 'optimum',
2226 pattern: 'pattern',
2227 placeholder: 'placeholder',
2228 playsinline: 'playsInline',
2229 poster: 'poster',
2230 preload: 'preload',
2231 profile: 'profile',
2232 radiogroup: 'radioGroup',
2233 readonly: 'readOnly',
2234 referrerpolicy: 'referrerPolicy',
2235 rel: 'rel',
2236 required: 'required',
2237 reversed: 'reversed',
2238 role: 'role',
2239 rows: 'rows',
2240 rowspan: 'rowSpan',
2241 sandbox: 'sandbox',
2242 scope: 'scope',
2243 scoped: 'scoped',
2244 scrolling: 'scrolling',
2245 seamless: 'seamless',
2246 selected: 'selected',
2247 shape: 'shape',
2248 size: 'size',
2249 sizes: 'sizes',
2250 span: 'span',
2251 spellcheck: 'spellCheck',
2252 src: 'src',
2253 srcdoc: 'srcDoc',
2254 srclang: 'srcLang',
2255 srcset: 'srcSet',
2256 start: 'start',
2257 step: 'step',
2258 style: 'style',
2259 summary: 'summary',
2260 tabindex: 'tabIndex',
2261 target: 'target',
2262 title: 'title',
2263 type: 'type',
2264 usemap: 'useMap',
2265 value: 'value',
2266 width: 'width',
2267 wmode: 'wmode',
2268 wrap: 'wrap',
2269 // SVG
2270 about: 'about',
2271 accentheight: 'accentHeight',
2272 'accent-height': 'accentHeight',
2273 accumulate: 'accumulate',
2274 additive: 'additive',
2275 alignmentbaseline: 'alignmentBaseline',
2276 'alignment-baseline': 'alignmentBaseline',
2277 allowreorder: 'allowReorder',
2278 alphabetic: 'alphabetic',
2279 amplitude: 'amplitude',
2280 arabicform: 'arabicForm',
2281 'arabic-form': 'arabicForm',
2282 ascent: 'ascent',
2283 attributename: 'attributeName',
2284 attributetype: 'attributeType',
2285 autoreverse: 'autoReverse',
2286 azimuth: 'azimuth',
2287 basefrequency: 'baseFrequency',
2288 baselineshift: 'baselineShift',
2289 'baseline-shift': 'baselineShift',
2290 baseprofile: 'baseProfile',
2291 bbox: 'bbox',
2292 begin: 'begin',
2293 bias: 'bias',
2294 by: 'by',
2295 calcmode: 'calcMode',
2296 capheight: 'capHeight',
2297 'cap-height': 'capHeight',
2298 clip: 'clip',
2299 clippath: 'clipPath',
2300 'clip-path': 'clipPath',
2301 clippathunits: 'clipPathUnits',
2302 cliprule: 'clipRule',
2303 'clip-rule': 'clipRule',
2304 color: 'color',
2305 colorinterpolation: 'colorInterpolation',
2306 'color-interpolation': 'colorInterpolation',
2307 colorinterpolationfilters: 'colorInterpolationFilters',
2308 'color-interpolation-filters': 'colorInterpolationFilters',
2309 colorprofile: 'colorProfile',
2310 'color-profile': 'colorProfile',
2311 colorrendering: 'colorRendering',
2312 'color-rendering': 'colorRendering',
2313 contentscripttype: 'contentScriptType',
2314 contentstyletype: 'contentStyleType',
2315 cursor: 'cursor',
2316 cx: 'cx',
2317 cy: 'cy',
2318 d: 'd',
2319 datatype: 'datatype',
2320 decelerate: 'decelerate',
2321 descent: 'descent',
2322 diffuseconstant: 'diffuseConstant',
2323 direction: 'direction',
2324 display: 'display',
2325 divisor: 'divisor',
2326 dominantbaseline: 'dominantBaseline',
2327 'dominant-baseline': 'dominantBaseline',
2328 dur: 'dur',
2329 dx: 'dx',
2330 dy: 'dy',
2331 edgemode: 'edgeMode',
2332 elevation: 'elevation',
2333 enablebackground: 'enableBackground',
2334 'enable-background': 'enableBackground',
2335 end: 'end',
2336 exponent: 'exponent',
2337 externalresourcesrequired: 'externalResourcesRequired',
2338 fill: 'fill',
2339 fillopacity: 'fillOpacity',
2340 'fill-opacity': 'fillOpacity',
2341 fillrule: 'fillRule',
2342 'fill-rule': 'fillRule',
2343 filter: 'filter',
2344 filterres: 'filterRes',
2345 filterunits: 'filterUnits',
2346 floodopacity: 'floodOpacity',
2347 'flood-opacity': 'floodOpacity',
2348 floodcolor: 'floodColor',
2349 'flood-color': 'floodColor',
2350 focusable: 'focusable',
2351 fontfamily: 'fontFamily',
2352 'font-family': 'fontFamily',
2353 fontsize: 'fontSize',
2354 'font-size': 'fontSize',
2355 fontsizeadjust: 'fontSizeAdjust',
2356 'font-size-adjust': 'fontSizeAdjust',
2357 fontstretch: 'fontStretch',
2358 'font-stretch': 'fontStretch',
2359 fontstyle: 'fontStyle',
2360 'font-style': 'fontStyle',
2361 fontvariant: 'fontVariant',
2362 'font-variant': 'fontVariant',
2363 fontweight: 'fontWeight',
2364 'font-weight': 'fontWeight',
2365 format: 'format',
2366 from: 'from',
2367 fx: 'fx',
2368 fy: 'fy',
2369 g1: 'g1',
2370 g2: 'g2',
2371 glyphname: 'glyphName',
2372 'glyph-name': 'glyphName',
2373 glyphorientationhorizontal: 'glyphOrientationHorizontal',
2374 'glyph-orientation-horizontal': 'glyphOrientationHorizontal',
2375 glyphorientationvertical: 'glyphOrientationVertical',
2376 'glyph-orientation-vertical': 'glyphOrientationVertical',
2377 glyphref: 'glyphRef',
2378 gradienttransform: 'gradientTransform',
2379 gradientunits: 'gradientUnits',
2380 hanging: 'hanging',
2381 horizadvx: 'horizAdvX',
2382 'horiz-adv-x': 'horizAdvX',
2383 horizoriginx: 'horizOriginX',
2384 'horiz-origin-x': 'horizOriginX',
2385 ideographic: 'ideographic',
2386 imagerendering: 'imageRendering',
2387 'image-rendering': 'imageRendering',
2388 in2: 'in2',
2389 in: 'in',
2390 inlist: 'inlist',
2391 intercept: 'intercept',
2392 k1: 'k1',
2393 k2: 'k2',
2394 k3: 'k3',
2395 k4: 'k4',
2396 k: 'k',
2397 kernelmatrix: 'kernelMatrix',
2398 kernelunitlength: 'kernelUnitLength',
2399 kerning: 'kerning',
2400 keypoints: 'keyPoints',
2401 keysplines: 'keySplines',
2402 keytimes: 'keyTimes',
2403 lengthadjust: 'lengthAdjust',
2404 letterspacing: 'letterSpacing',
2405 'letter-spacing': 'letterSpacing',
2406 lightingcolor: 'lightingColor',
2407 'lighting-color': 'lightingColor',
2408 limitingconeangle: 'limitingConeAngle',
2409 local: 'local',
2410 markerend: 'markerEnd',
2411 'marker-end': 'markerEnd',
2412 markerheight: 'markerHeight',
2413 markermid: 'markerMid',
2414 'marker-mid': 'markerMid',
2415 markerstart: 'markerStart',
2416 'marker-start': 'markerStart',
2417 markerunits: 'markerUnits',
2418 markerwidth: 'markerWidth',
2419 mask: 'mask',
2420 maskcontentunits: 'maskContentUnits',
2421 maskunits: 'maskUnits',
2422 mathematical: 'mathematical',
2423 mode: 'mode',
2424 numoctaves: 'numOctaves',
2425 offset: 'offset',
2426 opacity: 'opacity',
2427 operator: 'operator',
2428 order: 'order',
2429 orient: 'orient',
2430 orientation: 'orientation',
2431 origin: 'origin',
2432 overflow: 'overflow',
2433 overlineposition: 'overlinePosition',
2434 'overline-position': 'overlinePosition',
2435 overlinethickness: 'overlineThickness',
2436 'overline-thickness': 'overlineThickness',
2437 paintorder: 'paintOrder',
2438 'paint-order': 'paintOrder',
2439 panose1: 'panose1',
2440 'panose-1': 'panose1',
2441 pathlength: 'pathLength',
2442 patterncontentunits: 'patternContentUnits',
2443 patterntransform: 'patternTransform',
2444 patternunits: 'patternUnits',
2445 pointerevents: 'pointerEvents',
2446 'pointer-events': 'pointerEvents',
2447 points: 'points',
2448 pointsatx: 'pointsAtX',
2449 pointsaty: 'pointsAtY',
2450 pointsatz: 'pointsAtZ',
2451 prefix: 'prefix',
2452 preservealpha: 'preserveAlpha',
2453 preserveaspectratio: 'preserveAspectRatio',
2454 primitiveunits: 'primitiveUnits',
2455 property: 'property',
2456 r: 'r',
2457 radius: 'radius',
2458 refx: 'refX',
2459 refy: 'refY',
2460 renderingintent: 'renderingIntent',
2461 'rendering-intent': 'renderingIntent',
2462 repeatcount: 'repeatCount',
2463 repeatdur: 'repeatDur',
2464 requiredextensions: 'requiredExtensions',
2465 requiredfeatures: 'requiredFeatures',
2466 resource: 'resource',
2467 restart: 'restart',
2468 result: 'result',
2469 results: 'results',
2470 rotate: 'rotate',
2471 rx: 'rx',
2472 ry: 'ry',
2473 scale: 'scale',
2474 security: 'security',
2475 seed: 'seed',
2476 shaperendering: 'shapeRendering',
2477 'shape-rendering': 'shapeRendering',
2478 slope: 'slope',
2479 spacing: 'spacing',
2480 specularconstant: 'specularConstant',
2481 specularexponent: 'specularExponent',
2482 speed: 'speed',
2483 spreadmethod: 'spreadMethod',
2484 startoffset: 'startOffset',
2485 stddeviation: 'stdDeviation',
2486 stemh: 'stemh',
2487 stemv: 'stemv',
2488 stitchtiles: 'stitchTiles',
2489 stopcolor: 'stopColor',
2490 'stop-color': 'stopColor',
2491 stopopacity: 'stopOpacity',
2492 'stop-opacity': 'stopOpacity',
2493 strikethroughposition: 'strikethroughPosition',
2494 'strikethrough-position': 'strikethroughPosition',
2495 strikethroughthickness: 'strikethroughThickness',
2496 'strikethrough-thickness': 'strikethroughThickness',
2497 string: 'string',
2498 stroke: 'stroke',
2499 strokedasharray: 'strokeDasharray',
2500 'stroke-dasharray': 'strokeDasharray',
2501 strokedashoffset: 'strokeDashoffset',
2502 'stroke-dashoffset': 'strokeDashoffset',
2503 strokelinecap: 'strokeLinecap',
2504 'stroke-linecap': 'strokeLinecap',
2505 strokelinejoin: 'strokeLinejoin',
2506 'stroke-linejoin': 'strokeLinejoin',
2507 strokemiterlimit: 'strokeMiterlimit',
2508 'stroke-miterlimit': 'strokeMiterlimit',
2509 strokewidth: 'strokeWidth',
2510 'stroke-width': 'strokeWidth',
2511 strokeopacity: 'strokeOpacity',
2512 'stroke-opacity': 'strokeOpacity',
2513 suppresscontenteditablewarning: 'suppressContentEditableWarning',
2514 suppresshydrationwarning: 'suppressHydrationWarning',
2515 surfacescale: 'surfaceScale',
2516 systemlanguage: 'systemLanguage',
2517 tablevalues: 'tableValues',
2518 targetx: 'targetX',
2519 targety: 'targetY',
2520 textanchor: 'textAnchor',
2521 'text-anchor': 'textAnchor',
2522 textdecoration: 'textDecoration',
2523 'text-decoration': 'textDecoration',
2524 textlength: 'textLength',
2525 textrendering: 'textRendering',
2526 'text-rendering': 'textRendering',
2527 to: 'to',
2528 transform: 'transform',
2529 typeof: 'typeof',
2530 u1: 'u1',
2531 u2: 'u2',
2532 underlineposition: 'underlinePosition',
2533 'underline-position': 'underlinePosition',
2534 underlinethickness: 'underlineThickness',
2535 'underline-thickness': 'underlineThickness',
2536 unicode: 'unicode',
2537 unicodebidi: 'unicodeBidi',
2538 'unicode-bidi': 'unicodeBidi',
2539 unicoderange: 'unicodeRange',
2540 'unicode-range': 'unicodeRange',
2541 unitsperem: 'unitsPerEm',
2542 'units-per-em': 'unitsPerEm',
2543 unselectable: 'unselectable',
2544 valphabetic: 'vAlphabetic',
2545 'v-alphabetic': 'vAlphabetic',
2546 values: 'values',
2547 vectoreffect: 'vectorEffect',
2548 'vector-effect': 'vectorEffect',
2549 version: 'version',
2550 vertadvy: 'vertAdvY',
2551 'vert-adv-y': 'vertAdvY',
2552 vertoriginx: 'vertOriginX',
2553 'vert-origin-x': 'vertOriginX',
2554 vertoriginy: 'vertOriginY',
2555 'vert-origin-y': 'vertOriginY',
2556 vhanging: 'vHanging',
2557 'v-hanging': 'vHanging',
2558 videographic: 'vIdeographic',
2559 'v-ideographic': 'vIdeographic',
2560 viewbox: 'viewBox',
2561 viewtarget: 'viewTarget',
2562 visibility: 'visibility',
2563 vmathematical: 'vMathematical',
2564 'v-mathematical': 'vMathematical',
2565 vocab: 'vocab',
2566 widths: 'widths',
2567 wordspacing: 'wordSpacing',
2568 'word-spacing': 'wordSpacing',
2569 writingmode: 'writingMode',
2570 'writing-mode': 'writingMode',
2571 x1: 'x1',
2572 x2: 'x2',
2573 x: 'x',
2574 xchannelselector: 'xChannelSelector',
2575 xheight: 'xHeight',
2576 'x-height': 'xHeight',
2577 xlinkactuate: 'xlinkActuate',
2578 'xlink:actuate': 'xlinkActuate',
2579 xlinkarcrole: 'xlinkArcrole',
2580 'xlink:arcrole': 'xlinkArcrole',
2581 xlinkhref: 'xlinkHref',
2582 'xlink:href': 'xlinkHref',
2583 xlinkrole: 'xlinkRole',
2584 'xlink:role': 'xlinkRole',
2585 xlinkshow: 'xlinkShow',
2586 'xlink:show': 'xlinkShow',
2587 xlinktitle: 'xlinkTitle',
2588 'xlink:title': 'xlinkTitle',
2589 xlinktype: 'xlinkType',
2590 'xlink:type': 'xlinkType',
2591 xmlbase: 'xmlBase',
2592 'xml:base': 'xmlBase',
2593 xmllang: 'xmlLang',
2594 'xml:lang': 'xmlLang',
2595 xmlns: 'xmlns',
2596 'xml:space': 'xmlSpace',
2597 xmlnsxlink: 'xmlnsXlink',
2598 'xmlns:xlink': 'xmlnsXlink',
2599 xmlspace: 'xmlSpace',
2600 y1: 'y1',
2601 y2: 'y2',
2602 y: 'y',
2603 ychannelselector: 'yChannelSelector',
2604 z: 'z',
2605 zoomandpan: 'zoomAndPan'
2606};
2607
2608var validateProperty$1 = function () {};
2609
2610{
2611 var warnedProperties$1 = {};
2612 var _hasOwnProperty = Object.prototype.hasOwnProperty;
2613 var EVENT_NAME_REGEX = /^on./;
2614 var INVALID_EVENT_NAME_REGEX = /^on[^A-Z]/;
2615 var rARIA$1 = new RegExp('^(aria)-[' + ATTRIBUTE_NAME_CHAR + ']*$');
2616 var rARIACamel$1 = new RegExp('^(aria)[A-Z][' + ATTRIBUTE_NAME_CHAR + ']*$');
2617
2618 validateProperty$1 = function (tagName, name, value, canUseEventSystem) {
2619 if (_hasOwnProperty.call(warnedProperties$1, name) && warnedProperties$1[name]) {
2620 return true;
2621 }
2622
2623 var lowerCasedName = name.toLowerCase();
2624
2625 if (lowerCasedName === 'onfocusin' || lowerCasedName === 'onfocusout') {
2626 warning$1(false, 'React uses onFocus and onBlur instead of onFocusIn and onFocusOut. ' + 'All React events are normalized to bubble, so onFocusIn and onFocusOut ' + 'are not needed/supported by React.');
2627 warnedProperties$1[name] = true;
2628 return true;
2629 } // We can't rely on the event system being injected on the server.
2630
2631
2632 if (canUseEventSystem) {
2633 if (registrationNameModules.hasOwnProperty(name)) {
2634 return true;
2635 }
2636
2637 var registrationName = possibleRegistrationNames.hasOwnProperty(lowerCasedName) ? possibleRegistrationNames[lowerCasedName] : null;
2638
2639 if (registrationName != null) {
2640 warning$1(false, 'Invalid event handler property `%s`. Did you mean `%s`?', name, registrationName);
2641 warnedProperties$1[name] = true;
2642 return true;
2643 }
2644
2645 if (EVENT_NAME_REGEX.test(name)) {
2646 warning$1(false, 'Unknown event handler property `%s`. It will be ignored.', name);
2647 warnedProperties$1[name] = true;
2648 return true;
2649 }
2650 } else if (EVENT_NAME_REGEX.test(name)) {
2651 // If no event plugins have been injected, we are in a server environment.
2652 // So we can't tell if the event name is correct for sure, but we can filter
2653 // out known bad ones like `onclick`. We can't suggest a specific replacement though.
2654 if (INVALID_EVENT_NAME_REGEX.test(name)) {
2655 warning$1(false, 'Invalid event handler property `%s`. ' + 'React events use the camelCase naming convention, for example `onClick`.', name);
2656 }
2657
2658 warnedProperties$1[name] = true;
2659 return true;
2660 } // Let the ARIA attribute hook validate ARIA attributes
2661
2662
2663 if (rARIA$1.test(name) || rARIACamel$1.test(name)) {
2664 return true;
2665 }
2666
2667 if (lowerCasedName === 'innerhtml') {
2668 warning$1(false, 'Directly setting property `innerHTML` is not permitted. ' + 'For more information, lookup documentation on `dangerouslySetInnerHTML`.');
2669 warnedProperties$1[name] = true;
2670 return true;
2671 }
2672
2673 if (lowerCasedName === 'aria') {
2674 warning$1(false, 'The `aria` attribute is reserved for future use in React. ' + 'Pass individual `aria-` attributes instead.');
2675 warnedProperties$1[name] = true;
2676 return true;
2677 }
2678
2679 if (lowerCasedName === 'is' && value !== null && value !== undefined && typeof value !== 'string') {
2680 warning$1(false, 'Received a `%s` for a string attribute `is`. If this is expected, cast ' + 'the value to a string.', typeof value);
2681 warnedProperties$1[name] = true;
2682 return true;
2683 }
2684
2685 if (typeof value === 'number' && isNaN(value)) {
2686 warning$1(false, 'Received NaN for the `%s` attribute. If this is expected, cast ' + 'the value to a string.', name);
2687 warnedProperties$1[name] = true;
2688 return true;
2689 }
2690
2691 var propertyInfo = getPropertyInfo(name);
2692 var isReserved = propertyInfo !== null && propertyInfo.type === RESERVED; // Known attributes should match the casing specified in the property config.
2693
2694 if (possibleStandardNames.hasOwnProperty(lowerCasedName)) {
2695 var standardName = possibleStandardNames[lowerCasedName];
2696
2697 if (standardName !== name) {
2698 warning$1(false, 'Invalid DOM property `%s`. Did you mean `%s`?', name, standardName);
2699 warnedProperties$1[name] = true;
2700 return true;
2701 }
2702 } else if (!isReserved && name !== lowerCasedName) {
2703 // Unknown attributes should have lowercase casing since that's how they
2704 // will be cased anyway with server rendering.
2705 warning$1(false, 'React does not recognize the `%s` prop on a DOM element. If you ' + 'intentionally want it to appear in the DOM as a custom ' + 'attribute, spell it as lowercase `%s` instead. ' + 'If you accidentally passed it from a parent component, remove ' + 'it from the DOM element.', name, lowerCasedName);
2706 warnedProperties$1[name] = true;
2707 return true;
2708 }
2709
2710 if (typeof value === 'boolean' && shouldRemoveAttributeWithWarning(name, value, propertyInfo, false)) {
2711 if (value) {
2712 warning$1(false, 'Received `%s` for a non-boolean attribute `%s`.\n\n' + 'If you want to write it to the DOM, pass a string instead: ' + '%s="%s" or %s={value.toString()}.', value, name, name, value, name);
2713 } else {
2714 warning$1(false, 'Received `%s` for a non-boolean attribute `%s`.\n\n' + 'If you want to write it to the DOM, pass a string instead: ' + '%s="%s" or %s={value.toString()}.\n\n' + 'If you used to conditionally omit it with %s={condition && value}, ' + 'pass %s={condition ? value : undefined} instead.', value, name, name, value, name, name, name);
2715 }
2716
2717 warnedProperties$1[name] = true;
2718 return true;
2719 } // Now that we've validated casing, do not validate
2720 // data types for reserved props
2721
2722
2723 if (isReserved) {
2724 return true;
2725 } // Warn when a known attribute is a bad type
2726
2727
2728 if (shouldRemoveAttributeWithWarning(name, value, propertyInfo, false)) {
2729 warnedProperties$1[name] = true;
2730 return false;
2731 } // Warn when passing the strings 'false' or 'true' into a boolean prop
2732
2733
2734 if ((value === 'false' || value === 'true') && propertyInfo !== null && propertyInfo.type === BOOLEAN) {
2735 warning$1(false, 'Received the string `%s` for the boolean attribute `%s`. ' + '%s ' + 'Did you mean %s={%s}?', value, name, value === 'false' ? 'The browser will interpret it as a truthy value.' : 'Although this works, it will not work as expected if you pass the string "false".', name, value);
2736 warnedProperties$1[name] = true;
2737 return true;
2738 }
2739
2740 return true;
2741 };
2742}
2743
2744var warnUnknownProperties = function (type, props, canUseEventSystem) {
2745 var unknownProps = [];
2746
2747 for (var key in props) {
2748 var isValid = validateProperty$1(type, key, props[key], canUseEventSystem);
2749
2750 if (!isValid) {
2751 unknownProps.push(key);
2752 }
2753 }
2754
2755 var unknownPropString = unknownProps.map(function (prop) {
2756 return '`' + prop + '`';
2757 }).join(', ');
2758
2759 if (unknownProps.length === 1) {
2760 warning$1(false, 'Invalid value for prop %s on <%s> tag. Either remove it from the element, ' + 'or pass a string or number value to keep it in the DOM. ' + 'For details, see https://fb.me/react-attribute-behavior', unknownPropString, type);
2761 } else if (unknownProps.length > 1) {
2762 warning$1(false, 'Invalid values for props %s on <%s> tag. Either remove them from the element, ' + 'or pass a string or number value to keep them in the DOM. ' + 'For details, see https://fb.me/react-attribute-behavior', unknownPropString, type);
2763 }
2764};
2765
2766function validateProperties$2(type, props, canUseEventSystem) {
2767 if (isCustomComponent(type, props)) {
2768 return;
2769 }
2770
2771 warnUnknownProperties(type, props, canUseEventSystem);
2772}
2773
2774var toArray = React.Children.toArray; // This is only used in DEV.
2775// Each entry is `this.stack` from a currently executing renderer instance.
2776// (There may be more than one because ReactDOMServer is reentrant).
2777// Each stack is an array of frames which may contain nested stacks of elements.
2778
2779var currentDebugStacks = [];
2780var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;
2781var ReactDebugCurrentFrame;
2782var prevGetCurrentStackImpl = null;
2783
2784var getCurrentServerStackImpl = function () {
2785 return '';
2786};
2787
2788var describeStackFrame = function (element) {
2789 return '';
2790};
2791
2792var validatePropertiesInDevelopment = function (type, props) {};
2793
2794var pushCurrentDebugStack = function (stack) {};
2795
2796var pushElementToDebugStack = function (element) {};
2797
2798var popCurrentDebugStack = function () {};
2799
2800var hasWarnedAboutUsingContextAsConsumer = false;
2801
2802{
2803 ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
2804
2805 validatePropertiesInDevelopment = function (type, props) {
2806 validateProperties(type, props);
2807 validateProperties$1(type, props);
2808 validateProperties$2(type, props,
2809 /* canUseEventSystem */
2810 false);
2811 };
2812
2813 describeStackFrame = function (element) {
2814 var source = element._source;
2815 var type = element.type;
2816 var name = getComponentName(type);
2817 var ownerName = null;
2818 return describeComponentFrame(name, source, ownerName);
2819 };
2820
2821 pushCurrentDebugStack = function (stack) {
2822 currentDebugStacks.push(stack);
2823
2824 if (currentDebugStacks.length === 1) {
2825 // We are entering a server renderer.
2826 // Remember the previous (e.g. client) global stack implementation.
2827 prevGetCurrentStackImpl = ReactDebugCurrentFrame.getCurrentStack;
2828 ReactDebugCurrentFrame.getCurrentStack = getCurrentServerStackImpl;
2829 }
2830 };
2831
2832 pushElementToDebugStack = function (element) {
2833 // For the innermost executing ReactDOMServer call,
2834 var stack = currentDebugStacks[currentDebugStacks.length - 1]; // Take the innermost executing frame (e.g. <Foo>),
2835
2836 var frame = stack[stack.length - 1]; // and record that it has one more element associated with it.
2837
2838 frame.debugElementStack.push(element); // We only need this because we tail-optimize single-element
2839 // children and directly handle them in an inner loop instead of
2840 // creating separate frames for them.
2841 };
2842
2843 popCurrentDebugStack = function () {
2844 currentDebugStacks.pop();
2845
2846 if (currentDebugStacks.length === 0) {
2847 // We are exiting the server renderer.
2848 // Restore the previous (e.g. client) global stack implementation.
2849 ReactDebugCurrentFrame.getCurrentStack = prevGetCurrentStackImpl;
2850 prevGetCurrentStackImpl = null;
2851 }
2852 };
2853
2854 getCurrentServerStackImpl = function () {
2855 if (currentDebugStacks.length === 0) {
2856 // Nothing is currently rendering.
2857 return '';
2858 } // ReactDOMServer is reentrant so there may be multiple calls at the same time.
2859 // Take the frames from the innermost call which is the last in the array.
2860
2861
2862 var frames = currentDebugStacks[currentDebugStacks.length - 1];
2863 var stack = ''; // Go through every frame in the stack from the innermost one.
2864
2865 for (var i = frames.length - 1; i >= 0; i--) {
2866 var frame = frames[i]; // Every frame might have more than one debug element stack entry associated with it.
2867 // This is because single-child nesting doesn't create materialized frames.
2868 // Instead it would push them through `pushElementToDebugStack()`.
2869
2870 var debugElementStack = frame.debugElementStack;
2871
2872 for (var ii = debugElementStack.length - 1; ii >= 0; ii--) {
2873 stack += describeStackFrame(debugElementStack[ii]);
2874 }
2875 }
2876
2877 return stack;
2878 };
2879}
2880
2881var didWarnDefaultInputValue = false;
2882var didWarnDefaultChecked = false;
2883var didWarnDefaultSelectValue = false;
2884var didWarnDefaultTextareaValue = false;
2885var didWarnInvalidOptionChildren = false;
2886var didWarnAboutNoopUpdateForComponent = {};
2887var didWarnAboutBadClass = {};
2888var didWarnAboutModulePatternComponent = {};
2889var didWarnAboutDeprecatedWillMount = {};
2890var didWarnAboutUndefinedDerivedState = {};
2891var didWarnAboutUninitializedState = {};
2892var valuePropNames = ['value', 'defaultValue'];
2893var newlineEatingTags = {
2894 listing: true,
2895 pre: true,
2896 textarea: true
2897}; // We accept any tag to be rendered but since this gets injected into arbitrary
2898// HTML, we want to make sure that it's a safe tag.
2899// http://www.w3.org/TR/REC-xml/#NT-Name
2900
2901var VALID_TAG_REGEX = /^[a-zA-Z][a-zA-Z:_\.\-\d]*$/; // Simplified subset
2902
2903var validatedTagCache = {};
2904
2905function validateDangerousTag(tag) {
2906 if (!validatedTagCache.hasOwnProperty(tag)) {
2907 if (!VALID_TAG_REGEX.test(tag)) {
2908 {
2909 throw Error("Invalid tag: " + tag);
2910 }
2911 }
2912
2913 validatedTagCache[tag] = true;
2914 }
2915}
2916
2917var styleNameCache = {};
2918
2919var processStyleName = function (styleName) {
2920 if (styleNameCache.hasOwnProperty(styleName)) {
2921 return styleNameCache[styleName];
2922 }
2923
2924 var result = hyphenateStyleName(styleName);
2925 styleNameCache[styleName] = result;
2926 return result;
2927};
2928
2929function createMarkupForStyles(styles) {
2930 var serialized = '';
2931 var delimiter = '';
2932
2933 for (var styleName in styles) {
2934 if (!styles.hasOwnProperty(styleName)) {
2935 continue;
2936 }
2937
2938 var isCustomProperty = styleName.indexOf('--') === 0;
2939 var styleValue = styles[styleName];
2940
2941 {
2942 if (!isCustomProperty) {
2943 warnValidStyle$1(styleName, styleValue);
2944 }
2945 }
2946
2947 if (styleValue != null) {
2948 serialized += delimiter + (isCustomProperty ? styleName : processStyleName(styleName)) + ':';
2949 serialized += dangerousStyleValue(styleName, styleValue, isCustomProperty);
2950 delimiter = ';';
2951 }
2952 }
2953
2954 return serialized || null;
2955}
2956
2957function warnNoop(publicInstance, callerName) {
2958 {
2959 var _constructor = publicInstance.constructor;
2960 var componentName = _constructor && getComponentName(_constructor) || 'ReactClass';
2961 var warningKey = componentName + '.' + callerName;
2962
2963 if (didWarnAboutNoopUpdateForComponent[warningKey]) {
2964 return;
2965 }
2966
2967 warningWithoutStack$1(false, '%s(...): Can only update a mounting component. ' + 'This usually means you called %s() outside componentWillMount() on the server. ' + 'This is a no-op.\n\nPlease check the code for the %s component.', callerName, callerName, componentName);
2968 didWarnAboutNoopUpdateForComponent[warningKey] = true;
2969 }
2970}
2971
2972function shouldConstruct(Component) {
2973 return Component.prototype && Component.prototype.isReactComponent;
2974}
2975
2976function getNonChildrenInnerMarkup(props) {
2977 var innerHTML = props.dangerouslySetInnerHTML;
2978
2979 if (innerHTML != null) {
2980 if (innerHTML.__html != null) {
2981 return innerHTML.__html;
2982 }
2983 } else {
2984 var content = props.children;
2985
2986 if (typeof content === 'string' || typeof content === 'number') {
2987 return escapeTextForBrowser(content);
2988 }
2989 }
2990
2991 return null;
2992}
2993
2994function flattenTopLevelChildren(children) {
2995 if (!React.isValidElement(children)) {
2996 return toArray(children);
2997 }
2998
2999 var element = children;
3000
3001 if (element.type !== REACT_FRAGMENT_TYPE) {
3002 return [element];
3003 }
3004
3005 var fragmentChildren = element.props.children;
3006
3007 if (!React.isValidElement(fragmentChildren)) {
3008 return toArray(fragmentChildren);
3009 }
3010
3011 var fragmentChildElement = fragmentChildren;
3012 return [fragmentChildElement];
3013}
3014
3015function flattenOptionChildren(children) {
3016 if (children === undefined || children === null) {
3017 return children;
3018 }
3019
3020 var content = ''; // Flatten children and warn if they aren't strings or numbers;
3021 // invalid types are ignored.
3022
3023 React.Children.forEach(children, function (child) {
3024 if (child == null) {
3025 return;
3026 }
3027
3028 content += child;
3029
3030 {
3031 if (!didWarnInvalidOptionChildren && typeof child !== 'string' && typeof child !== 'number') {
3032 didWarnInvalidOptionChildren = true;
3033 warning$1(false, 'Only strings and numbers are supported as <option> children.');
3034 }
3035 }
3036 });
3037 return content;
3038}
3039
3040var hasOwnProperty = Object.prototype.hasOwnProperty;
3041var STYLE = 'style';
3042var RESERVED_PROPS = {
3043 children: null,
3044 dangerouslySetInnerHTML: null,
3045 suppressContentEditableWarning: null,
3046 suppressHydrationWarning: null
3047};
3048
3049function createOpenTagMarkup(tagVerbatim, tagLowercase, props, namespace, makeStaticMarkup, isRootElement) {
3050 var ret = '<' + tagVerbatim;
3051
3052 for (var propKey in props) {
3053 if (!hasOwnProperty.call(props, propKey)) {
3054 continue;
3055 }
3056
3057 if (enableFlareAPI && propKey === 'listeners') {
3058 continue;
3059 }
3060
3061 var propValue = props[propKey];
3062
3063 if (propValue == null) {
3064 continue;
3065 }
3066
3067 if (propKey === STYLE) {
3068 propValue = createMarkupForStyles(propValue);
3069 }
3070
3071 var markup = null;
3072
3073 if (isCustomComponent(tagLowercase, props)) {
3074 if (!RESERVED_PROPS.hasOwnProperty(propKey)) {
3075 markup = createMarkupForCustomAttribute(propKey, propValue);
3076 }
3077 } else {
3078 markup = createMarkupForProperty(propKey, propValue);
3079 }
3080
3081 if (markup) {
3082 ret += ' ' + markup;
3083 }
3084 } // For static pages, no need to put React ID and checksum. Saves lots of
3085 // bytes.
3086
3087
3088 if (makeStaticMarkup) {
3089 return ret;
3090 }
3091
3092 if (isRootElement) {
3093 ret += ' ' + createMarkupForRoot();
3094 }
3095
3096 return ret;
3097}
3098
3099function validateRenderResult(child, type) {
3100 if (child === undefined) {
3101 {
3102 {
3103 throw Error((getComponentName(type) || 'Component') + "(...): Nothing was returned from render. This usually means a return statement is missing. Or, to render nothing, return null.");
3104 }
3105 }
3106 }
3107}
3108
3109function resolve(child, context, threadID) {
3110 while (React.isValidElement(child)) {
3111 // Safe because we just checked it's an element.
3112 var element = child;
3113 var Component = element.type;
3114
3115 {
3116 pushElementToDebugStack(element);
3117 }
3118
3119 if (typeof Component !== 'function') {
3120 break;
3121 }
3122
3123 processChild(element, Component);
3124 } // Extra closure so queue and replace can be captured properly
3125
3126
3127 function processChild(element, Component) {
3128 var isClass = shouldConstruct(Component);
3129 var publicContext = processContext(Component, context, threadID, isClass);
3130 var queue = [];
3131 var replace = false;
3132 var updater = {
3133 isMounted: function (publicInstance) {
3134 return false;
3135 },
3136 enqueueForceUpdate: function (publicInstance) {
3137 if (queue === null) {
3138 warnNoop(publicInstance, 'forceUpdate');
3139 return null;
3140 }
3141 },
3142 enqueueReplaceState: function (publicInstance, completeState) {
3143 replace = true;
3144 queue = [completeState];
3145 },
3146 enqueueSetState: function (publicInstance, currentPartialState) {
3147 if (queue === null) {
3148 warnNoop(publicInstance, 'setState');
3149 return null;
3150 }
3151
3152 queue.push(currentPartialState);
3153 }
3154 };
3155 var inst;
3156
3157 if (isClass) {
3158 inst = new Component(element.props, publicContext, updater);
3159
3160 if (typeof Component.getDerivedStateFromProps === 'function') {
3161 {
3162 if (inst.state === null || inst.state === undefined) {
3163 var componentName = getComponentName(Component) || 'Unknown';
3164
3165 if (!didWarnAboutUninitializedState[componentName]) {
3166 warningWithoutStack$1(false, '`%s` uses `getDerivedStateFromProps` but its initial state is ' + '%s. This is not recommended. Instead, define the initial state by ' + 'assigning an object to `this.state` in the constructor of `%s`. ' + 'This ensures that `getDerivedStateFromProps` arguments have a consistent shape.', componentName, inst.state === null ? 'null' : 'undefined', componentName);
3167 didWarnAboutUninitializedState[componentName] = true;
3168 }
3169 }
3170 }
3171
3172 var partialState = Component.getDerivedStateFromProps.call(null, element.props, inst.state);
3173
3174 {
3175 if (partialState === undefined) {
3176 var _componentName = getComponentName(Component) || 'Unknown';
3177
3178 if (!didWarnAboutUndefinedDerivedState[_componentName]) {
3179 warningWithoutStack$1(false, '%s.getDerivedStateFromProps(): A valid state object (or null) must be returned. ' + 'You have returned undefined.', _componentName);
3180 didWarnAboutUndefinedDerivedState[_componentName] = true;
3181 }
3182 }
3183 }
3184
3185 if (partialState != null) {
3186 inst.state = _assign({}, inst.state, partialState);
3187 }
3188 }
3189 } else {
3190 {
3191 if (Component.prototype && typeof Component.prototype.render === 'function') {
3192 var _componentName2 = getComponentName(Component) || 'Unknown';
3193
3194 if (!didWarnAboutBadClass[_componentName2]) {
3195 warningWithoutStack$1(false, "The <%s /> component appears to have a render method, but doesn't extend React.Component. " + 'This is likely to cause errors. Change %s to extend React.Component instead.', _componentName2, _componentName2);
3196 didWarnAboutBadClass[_componentName2] = true;
3197 }
3198 }
3199 }
3200
3201 var componentIdentity = {};
3202 prepareToUseHooks(componentIdentity);
3203 inst = Component(element.props, publicContext, updater);
3204 inst = finishHooks(Component, element.props, inst, publicContext);
3205
3206 if (inst == null || inst.render == null) {
3207 child = inst;
3208 validateRenderResult(child, Component);
3209 return;
3210 }
3211
3212 {
3213 var _componentName3 = getComponentName(Component) || 'Unknown';
3214
3215 if (!didWarnAboutModulePatternComponent[_componentName3]) {
3216 warningWithoutStack$1(false, 'The <%s /> component appears to be a function component that returns a class instance. ' + 'Change %s to a class that extends React.Component instead. ' + "If you can't use a class try assigning the prototype on the function as a workaround. " + "`%s.prototype = React.Component.prototype`. Don't use an arrow function since it " + 'cannot be called with `new` by React.', _componentName3, _componentName3, _componentName3);
3217 didWarnAboutModulePatternComponent[_componentName3] = true;
3218 }
3219 }
3220 }
3221
3222 inst.props = element.props;
3223 inst.context = publicContext;
3224 inst.updater = updater;
3225 var initialState = inst.state;
3226
3227 if (initialState === undefined) {
3228 inst.state = initialState = null;
3229 }
3230
3231 if (typeof inst.UNSAFE_componentWillMount === 'function' || typeof inst.componentWillMount === 'function') {
3232 if (typeof inst.componentWillMount === 'function') {
3233 {
3234 if (warnAboutDeprecatedLifecycles && inst.componentWillMount.__suppressDeprecationWarning !== true) {
3235 var _componentName4 = getComponentName(Component) || 'Unknown';
3236
3237 if (!didWarnAboutDeprecatedWillMount[_componentName4]) {
3238 lowPriorityWarningWithoutStack$1(false, // keep this warning in sync with ReactStrictModeWarning.js
3239 'componentWillMount has been renamed, and is not recommended for use. ' + 'See https://fb.me/react-unsafe-component-lifecycles for details.\n\n' + '* Move code from componentWillMount to componentDidMount (preferred in most cases) ' + 'or the constructor.\n' + '\nPlease update the following components: %s', _componentName4);
3240 didWarnAboutDeprecatedWillMount[_componentName4] = true;
3241 }
3242 }
3243 } // In order to support react-lifecycles-compat polyfilled components,
3244 // Unsafe lifecycles should not be invoked for any component with the new gDSFP.
3245
3246
3247 if (typeof Component.getDerivedStateFromProps !== 'function') {
3248 inst.componentWillMount();
3249 }
3250 }
3251
3252 if (typeof inst.UNSAFE_componentWillMount === 'function' && typeof Component.getDerivedStateFromProps !== 'function') {
3253 // In order to support react-lifecycles-compat polyfilled components,
3254 // Unsafe lifecycles should not be invoked for any component with the new gDSFP.
3255 inst.UNSAFE_componentWillMount();
3256 }
3257
3258 if (queue.length) {
3259 var oldQueue = queue;
3260 var oldReplace = replace;
3261 queue = null;
3262 replace = false;
3263
3264 if (oldReplace && oldQueue.length === 1) {
3265 inst.state = oldQueue[0];
3266 } else {
3267 var nextState = oldReplace ? oldQueue[0] : inst.state;
3268 var dontMutate = true;
3269
3270 for (var i = oldReplace ? 1 : 0; i < oldQueue.length; i++) {
3271 var partial = oldQueue[i];
3272
3273 var _partialState = typeof partial === 'function' ? partial.call(inst, nextState, element.props, publicContext) : partial;
3274
3275 if (_partialState != null) {
3276 if (dontMutate) {
3277 dontMutate = false;
3278 nextState = _assign({}, nextState, _partialState);
3279 } else {
3280 _assign(nextState, _partialState);
3281 }
3282 }
3283 }
3284
3285 inst.state = nextState;
3286 }
3287 } else {
3288 queue = null;
3289 }
3290 }
3291
3292 child = inst.render();
3293
3294 {
3295 if (child === undefined && inst.render._isMockFunction) {
3296 // This is probably bad practice. Consider warning here and
3297 // deprecating this convenience.
3298 child = null;
3299 }
3300 }
3301
3302 validateRenderResult(child, Component);
3303 var childContext;
3304
3305 if (disableLegacyContext) {
3306 {
3307 var childContextTypes = Component.childContextTypes;
3308
3309 if (childContextTypes !== undefined) {
3310 warningWithoutStack$1(false, '%s uses the legacy childContextTypes API which is no longer supported. ' + 'Use React.createContext() instead.', getComponentName(Component) || 'Unknown');
3311 }
3312 }
3313 } else {
3314 if (typeof inst.getChildContext === 'function') {
3315 var _childContextTypes = Component.childContextTypes;
3316
3317 if (typeof _childContextTypes === 'object') {
3318 childContext = inst.getChildContext();
3319
3320 for (var contextKey in childContext) {
3321 if (!(contextKey in _childContextTypes)) {
3322 {
3323 throw Error((getComponentName(Component) || 'Unknown') + ".getChildContext(): key \"" + contextKey + "\" is not defined in childContextTypes.");
3324 }
3325 }
3326 }
3327 } else {
3328 warningWithoutStack$1(false, '%s.getChildContext(): childContextTypes must be defined in order to ' + 'use getChildContext().', getComponentName(Component) || 'Unknown');
3329 }
3330 }
3331
3332 if (childContext) {
3333 context = _assign({}, context, childContext);
3334 }
3335 }
3336 }
3337
3338 return {
3339 child: child,
3340 context: context
3341 };
3342}
3343
3344var ReactDOMServerRenderer =
3345/*#__PURE__*/
3346function () {
3347 // TODO: type this more strictly:
3348 // DEV-only
3349 function ReactDOMServerRenderer(children, makeStaticMarkup) {
3350 var flatChildren = flattenTopLevelChildren(children);
3351 var topFrame = {
3352 type: null,
3353 // Assume all trees start in the HTML namespace (not totally true, but
3354 // this is what we did historically)
3355 domNamespace: Namespaces.html,
3356 children: flatChildren,
3357 childIndex: 0,
3358 context: emptyObject,
3359 footer: ''
3360 };
3361
3362 {
3363 topFrame.debugElementStack = [];
3364 }
3365
3366 this.threadID = allocThreadID();
3367 this.stack = [topFrame];
3368 this.exhausted = false;
3369 this.currentSelectValue = null;
3370 this.previousWasTextNode = false;
3371 this.makeStaticMarkup = makeStaticMarkup;
3372 this.suspenseDepth = 0; // Context (new API)
3373
3374 this.contextIndex = -1;
3375 this.contextStack = [];
3376 this.contextValueStack = [];
3377
3378 {
3379 this.contextProviderStack = [];
3380 }
3381 }
3382
3383 var _proto = ReactDOMServerRenderer.prototype;
3384
3385 _proto.destroy = function destroy() {
3386 if (!this.exhausted) {
3387 this.exhausted = true;
3388 this.clearProviders();
3389 freeThreadID(this.threadID);
3390 }
3391 }
3392 /**
3393 * Note: We use just two stacks regardless of how many context providers you have.
3394 * Providers are always popped in the reverse order to how they were pushed
3395 * so we always know on the way down which provider you'll encounter next on the way up.
3396 * On the way down, we push the current provider, and its context value *before*
3397 * we mutated it, onto the stacks. Therefore, on the way up, we always know which
3398 * provider needs to be "restored" to which value.
3399 * https://github.com/facebook/react/pull/12985#issuecomment-396301248
3400 */
3401 ;
3402
3403 _proto.pushProvider = function pushProvider(provider) {
3404 var index = ++this.contextIndex;
3405 var context = provider.type._context;
3406 var threadID = this.threadID;
3407 validateContextBounds(context, threadID);
3408 var previousValue = context[threadID]; // Remember which value to restore this context to on our way up.
3409
3410 this.contextStack[index] = context;
3411 this.contextValueStack[index] = previousValue;
3412
3413 {
3414 // Only used for push/pop mismatch warnings.
3415 this.contextProviderStack[index] = provider;
3416 } // Mutate the current value.
3417
3418
3419 context[threadID] = provider.props.value;
3420 };
3421
3422 _proto.popProvider = function popProvider(provider) {
3423 var index = this.contextIndex;
3424
3425 {
3426 !(index > -1 && provider === this.contextProviderStack[index]) ? warningWithoutStack$1(false, 'Unexpected pop.') : void 0;
3427 }
3428
3429 var context = this.contextStack[index];
3430 var previousValue = this.contextValueStack[index]; // "Hide" these null assignments from Flow by using `any`
3431 // because conceptually they are deletions--as long as we
3432 // promise to never access values beyond `this.contextIndex`.
3433
3434 this.contextStack[index] = null;
3435 this.contextValueStack[index] = null;
3436
3437 {
3438 this.contextProviderStack[index] = null;
3439 }
3440
3441 this.contextIndex--; // Restore to the previous value we stored as we were walking down.
3442 // We've already verified that this context has been expanded to accommodate
3443 // this thread id, so we don't need to do it again.
3444
3445 context[this.threadID] = previousValue;
3446 };
3447
3448 _proto.clearProviders = function clearProviders() {
3449 // Restore any remaining providers on the stack to previous values
3450 for (var index = this.contextIndex; index >= 0; index--) {
3451 var context = this.contextStack[index];
3452 var previousValue = this.contextValueStack[index];
3453 context[this.threadID] = previousValue;
3454 }
3455 };
3456
3457 _proto.read = function read(bytes) {
3458 if (this.exhausted) {
3459 return null;
3460 }
3461
3462 var prevThreadID = currentThreadID;
3463 setCurrentThreadID(this.threadID);
3464 var prevDispatcher = ReactCurrentDispatcher.current;
3465 ReactCurrentDispatcher.current = Dispatcher;
3466
3467 try {
3468 // Markup generated within <Suspense> ends up buffered until we know
3469 // nothing in that boundary suspended
3470 var out = [''];
3471 var suspended = false;
3472
3473 while (out[0].length < bytes) {
3474 if (this.stack.length === 0) {
3475 this.exhausted = true;
3476 freeThreadID(this.threadID);
3477 break;
3478 }
3479
3480 var frame = this.stack[this.stack.length - 1];
3481
3482 if (suspended || frame.childIndex >= frame.children.length) {
3483 var footer = frame.footer;
3484
3485 if (footer !== '') {
3486 this.previousWasTextNode = false;
3487 }
3488
3489 this.stack.pop();
3490
3491 if (frame.type === 'select') {
3492 this.currentSelectValue = null;
3493 } else if (frame.type != null && frame.type.type != null && frame.type.type.$$typeof === REACT_PROVIDER_TYPE) {
3494 var provider = frame.type;
3495 this.popProvider(provider);
3496 } else if (frame.type === REACT_SUSPENSE_TYPE) {
3497 this.suspenseDepth--;
3498 var buffered = out.pop();
3499
3500 if (suspended) {
3501 suspended = false; // If rendering was suspended at this boundary, render the fallbackFrame
3502
3503 var fallbackFrame = frame.fallbackFrame;
3504
3505 if (!fallbackFrame) {
3506 {
3507 throw Error("ReactDOMServer did not find an internal fallback frame for Suspense. This is a bug in React. Please file an issue.");
3508 }
3509 }
3510
3511 this.stack.push(fallbackFrame);
3512 out[this.suspenseDepth] += '<!--$!-->'; // Skip flushing output since we're switching to the fallback
3513
3514 continue;
3515 } else {
3516 out[this.suspenseDepth] += buffered;
3517 }
3518 } // Flush output
3519
3520
3521 out[this.suspenseDepth] += footer;
3522 continue;
3523 }
3524
3525 var child = frame.children[frame.childIndex++];
3526 var outBuffer = '';
3527
3528 {
3529 pushCurrentDebugStack(this.stack); // We're starting work on this frame, so reset its inner stack.
3530
3531 frame.debugElementStack.length = 0;
3532 }
3533
3534 try {
3535 outBuffer += this.render(child, frame.context, frame.domNamespace);
3536 } catch (err) {
3537 if (err != null && typeof err.then === 'function') {
3538 if (enableSuspenseServerRenderer) {
3539 if (!(this.suspenseDepth > 0)) {
3540 {
3541 throw Error("A React component suspended while rendering, but no fallback UI was specified.\n\nAdd a <Suspense fallback=...> component higher in the tree to provide a loading indicator or placeholder to display.");
3542 }
3543 }
3544
3545 suspended = true;
3546 } else {
3547 {
3548 {
3549 throw Error("ReactDOMServer does not yet support Suspense.");
3550 }
3551 }
3552 }
3553 } else {
3554 throw err;
3555 }
3556 } finally {
3557 {
3558 popCurrentDebugStack();
3559 }
3560 }
3561
3562 if (out.length <= this.suspenseDepth) {
3563 out.push('');
3564 }
3565
3566 out[this.suspenseDepth] += outBuffer;
3567 }
3568
3569 return out[0];
3570 } finally {
3571 ReactCurrentDispatcher.current = prevDispatcher;
3572 setCurrentThreadID(prevThreadID);
3573 }
3574 };
3575
3576 _proto.render = function render(child, context, parentNamespace) {
3577 if (typeof child === 'string' || typeof child === 'number') {
3578 var text = '' + child;
3579
3580 if (text === '') {
3581 return '';
3582 }
3583
3584 if (this.makeStaticMarkup) {
3585 return escapeTextForBrowser(text);
3586 }
3587
3588 if (this.previousWasTextNode) {
3589 return '<!-- -->' + escapeTextForBrowser(text);
3590 }
3591
3592 this.previousWasTextNode = true;
3593 return escapeTextForBrowser(text);
3594 } else {
3595 var nextChild;
3596
3597 var _resolve = resolve(child, context, this.threadID);
3598
3599 nextChild = _resolve.child;
3600 context = _resolve.context;
3601
3602 if (nextChild === null || nextChild === false) {
3603 return '';
3604 } else if (!React.isValidElement(nextChild)) {
3605 if (nextChild != null && nextChild.$$typeof != null) {
3606 // Catch unexpected special types early.
3607 var $$typeof = nextChild.$$typeof;
3608
3609 if (!($$typeof !== REACT_PORTAL_TYPE)) {
3610 {
3611 throw Error("Portals are not currently supported by the server renderer. Render them conditionally so that they only appear on the client render.");
3612 }
3613 } // Catch-all to prevent an infinite loop if React.Children.toArray() supports some new type.
3614
3615
3616 {
3617 {
3618 throw Error("Unknown element-like object type: " + $$typeof.toString() + ". This is likely a bug in React. Please file an issue.");
3619 }
3620 }
3621 }
3622
3623 var nextChildren = toArray(nextChild);
3624 var frame = {
3625 type: null,
3626 domNamespace: parentNamespace,
3627 children: nextChildren,
3628 childIndex: 0,
3629 context: context,
3630 footer: ''
3631 };
3632
3633 {
3634 frame.debugElementStack = [];
3635 }
3636
3637 this.stack.push(frame);
3638 return '';
3639 } // Safe because we just checked it's an element.
3640
3641
3642 var nextElement = nextChild;
3643 var elementType = nextElement.type;
3644
3645 if (typeof elementType === 'string') {
3646 return this.renderDOM(nextElement, context, parentNamespace);
3647 }
3648
3649 switch (elementType) {
3650 case REACT_STRICT_MODE_TYPE:
3651 case REACT_CONCURRENT_MODE_TYPE:
3652 case REACT_PROFILER_TYPE:
3653 case REACT_SUSPENSE_LIST_TYPE:
3654 case REACT_FRAGMENT_TYPE:
3655 {
3656 var _nextChildren = toArray(nextChild.props.children);
3657
3658 var _frame = {
3659 type: null,
3660 domNamespace: parentNamespace,
3661 children: _nextChildren,
3662 childIndex: 0,
3663 context: context,
3664 footer: ''
3665 };
3666
3667 {
3668 _frame.debugElementStack = [];
3669 }
3670
3671 this.stack.push(_frame);
3672 return '';
3673 }
3674
3675 case REACT_SUSPENSE_TYPE:
3676 {
3677 if (enableSuspenseServerRenderer) {
3678 var fallback = nextChild.props.fallback;
3679
3680 if (fallback === undefined) {
3681 // If there is no fallback, then this just behaves as a fragment.
3682 var _nextChildren3 = toArray(nextChild.props.children);
3683
3684 var _frame3 = {
3685 type: null,
3686 domNamespace: parentNamespace,
3687 children: _nextChildren3,
3688 childIndex: 0,
3689 context: context,
3690 footer: ''
3691 };
3692
3693 {
3694 _frame3.debugElementStack = [];
3695 }
3696
3697 this.stack.push(_frame3);
3698 return '';
3699 }
3700
3701 var fallbackChildren = toArray(fallback);
3702
3703 var _nextChildren2 = toArray(nextChild.props.children);
3704
3705 var fallbackFrame = {
3706 type: null,
3707 domNamespace: parentNamespace,
3708 children: fallbackChildren,
3709 childIndex: 0,
3710 context: context,
3711 footer: '<!--/$-->'
3712 };
3713 var _frame2 = {
3714 fallbackFrame: fallbackFrame,
3715 type: REACT_SUSPENSE_TYPE,
3716 domNamespace: parentNamespace,
3717 children: _nextChildren2,
3718 childIndex: 0,
3719 context: context,
3720 footer: '<!--/$-->'
3721 };
3722
3723 {
3724 _frame2.debugElementStack = [];
3725 fallbackFrame.debugElementStack = [];
3726 }
3727
3728 this.stack.push(_frame2);
3729 this.suspenseDepth++;
3730 return '<!--$-->';
3731 } else {
3732 {
3733 {
3734 throw Error("ReactDOMServer does not yet support Suspense.");
3735 }
3736 }
3737 }
3738 }
3739 // eslint-disable-next-line-no-fallthrough
3740
3741 default:
3742 break;
3743 }
3744
3745 if (typeof elementType === 'object' && elementType !== null) {
3746 switch (elementType.$$typeof) {
3747 case REACT_FORWARD_REF_TYPE:
3748 {
3749 var element = nextChild;
3750
3751 var _nextChildren4;
3752
3753 var componentIdentity = {};
3754 prepareToUseHooks(componentIdentity);
3755 _nextChildren4 = elementType.render(element.props, element.ref);
3756 _nextChildren4 = finishHooks(elementType.render, element.props, _nextChildren4, element.ref);
3757 _nextChildren4 = toArray(_nextChildren4);
3758 var _frame4 = {
3759 type: null,
3760 domNamespace: parentNamespace,
3761 children: _nextChildren4,
3762 childIndex: 0,
3763 context: context,
3764 footer: ''
3765 };
3766
3767 {
3768 _frame4.debugElementStack = [];
3769 }
3770
3771 this.stack.push(_frame4);
3772 return '';
3773 }
3774
3775 case REACT_MEMO_TYPE:
3776 {
3777 var _element = nextChild;
3778 var _nextChildren5 = [React.createElement(elementType.type, _assign({
3779 ref: _element.ref
3780 }, _element.props))];
3781 var _frame5 = {
3782 type: null,
3783 domNamespace: parentNamespace,
3784 children: _nextChildren5,
3785 childIndex: 0,
3786 context: context,
3787 footer: ''
3788 };
3789
3790 {
3791 _frame5.debugElementStack = [];
3792 }
3793
3794 this.stack.push(_frame5);
3795 return '';
3796 }
3797
3798 case REACT_PROVIDER_TYPE:
3799 {
3800 var provider = nextChild;
3801 var nextProps = provider.props;
3802
3803 var _nextChildren6 = toArray(nextProps.children);
3804
3805 var _frame6 = {
3806 type: provider,
3807 domNamespace: parentNamespace,
3808 children: _nextChildren6,
3809 childIndex: 0,
3810 context: context,
3811 footer: ''
3812 };
3813
3814 {
3815 _frame6.debugElementStack = [];
3816 }
3817
3818 this.pushProvider(provider);
3819 this.stack.push(_frame6);
3820 return '';
3821 }
3822
3823 case REACT_CONTEXT_TYPE:
3824 {
3825 var reactContext = nextChild.type; // The logic below for Context differs depending on PROD or DEV mode. In
3826 // DEV mode, we create a separate object for Context.Consumer that acts
3827 // like a proxy to Context. This proxy object adds unnecessary code in PROD
3828 // so we use the old behaviour (Context.Consumer references Context) to
3829 // reduce size and overhead. The separate object references context via
3830 // a property called "_context", which also gives us the ability to check
3831 // in DEV mode if this property exists or not and warn if it does not.
3832
3833 {
3834 if (reactContext._context === undefined) {
3835 // This may be because it's a Context (rather than a Consumer).
3836 // Or it may be because it's older React where they're the same thing.
3837 // We only want to warn if we're sure it's a new React.
3838 if (reactContext !== reactContext.Consumer) {
3839 if (!hasWarnedAboutUsingContextAsConsumer) {
3840 hasWarnedAboutUsingContextAsConsumer = true;
3841 warning$1(false, 'Rendering <Context> directly is not supported and will be removed in ' + 'a future major release. Did you mean to render <Context.Consumer> instead?');
3842 }
3843 }
3844 } else {
3845 reactContext = reactContext._context;
3846 }
3847 }
3848
3849 var _nextProps = nextChild.props;
3850 var threadID = this.threadID;
3851 validateContextBounds(reactContext, threadID);
3852 var nextValue = reactContext[threadID];
3853
3854 var _nextChildren7 = toArray(_nextProps.children(nextValue));
3855
3856 var _frame7 = {
3857 type: nextChild,
3858 domNamespace: parentNamespace,
3859 children: _nextChildren7,
3860 childIndex: 0,
3861 context: context,
3862 footer: ''
3863 };
3864
3865 {
3866 _frame7.debugElementStack = [];
3867 }
3868
3869 this.stack.push(_frame7);
3870 return '';
3871 }
3872 // eslint-disable-next-line-no-fallthrough
3873
3874 case REACT_FUNDAMENTAL_TYPE:
3875 {
3876 if (enableFundamentalAPI) {
3877 var fundamentalImpl = elementType.impl;
3878 var open = fundamentalImpl.getServerSideString(null, nextElement.props);
3879 var getServerSideStringClose = fundamentalImpl.getServerSideStringClose;
3880 var close = getServerSideStringClose !== undefined ? getServerSideStringClose(null, nextElement.props) : '';
3881
3882 var _nextChildren8 = fundamentalImpl.reconcileChildren !== false ? toArray(nextChild.props.children) : [];
3883
3884 var _frame8 = {
3885 type: null,
3886 domNamespace: parentNamespace,
3887 children: _nextChildren8,
3888 childIndex: 0,
3889 context: context,
3890 footer: close
3891 };
3892
3893 {
3894 _frame8.debugElementStack = [];
3895 }
3896
3897 this.stack.push(_frame8);
3898 return open;
3899 }
3900
3901 {
3902 {
3903 throw Error("ReactDOMServer does not yet support the fundamental API.");
3904 }
3905 }
3906 }
3907 // eslint-disable-next-line-no-fallthrough
3908
3909 case REACT_LAZY_TYPE:
3910 {
3911 var _element2 = nextChild;
3912 var lazyComponent = nextChild.type; // Attempt to initialize lazy component regardless of whether the
3913 // suspense server-side renderer is enabled so synchronously
3914 // resolved constructors are supported.
3915
3916 initializeLazyComponentType(lazyComponent);
3917
3918 switch (lazyComponent._status) {
3919 case Resolved:
3920 {
3921 var _nextChildren9 = [React.createElement(lazyComponent._result, _assign({
3922 ref: _element2.ref
3923 }, _element2.props))];
3924 var _frame9 = {
3925 type: null,
3926 domNamespace: parentNamespace,
3927 children: _nextChildren9,
3928 childIndex: 0,
3929 context: context,
3930 footer: ''
3931 };
3932
3933 {
3934 _frame9.debugElementStack = [];
3935 }
3936
3937 this.stack.push(_frame9);
3938 return '';
3939 }
3940
3941 case Rejected:
3942 throw lazyComponent._result;
3943
3944 case Pending:
3945 default:
3946 {
3947 {
3948 throw Error("ReactDOMServer does not yet support lazy-loaded components.");
3949 }
3950 }
3951
3952 }
3953 }
3954 // eslint-disable-next-line-no-fallthrough
3955
3956 case REACT_SCOPE_TYPE:
3957 {
3958 if (enableScopeAPI) {
3959 var _nextChildren10 = toArray(nextChild.props.children);
3960
3961 var _frame10 = {
3962 type: null,
3963 domNamespace: parentNamespace,
3964 children: _nextChildren10,
3965 childIndex: 0,
3966 context: context,
3967 footer: ''
3968 };
3969
3970 {
3971 _frame10.debugElementStack = [];
3972 }
3973
3974 this.stack.push(_frame10);
3975 return '';
3976 }
3977
3978 {
3979 {
3980 throw Error("ReactDOMServer does not yet support scope components.");
3981 }
3982 }
3983 }
3984 }
3985 }
3986
3987 var info = '';
3988
3989 {
3990 var owner = nextElement._owner;
3991
3992 if (elementType === undefined || typeof elementType === 'object' && elementType !== null && Object.keys(elementType).length === 0) {
3993 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.';
3994 }
3995
3996 var ownerName = owner ? getComponentName(owner) : null;
3997
3998 if (ownerName) {
3999 info += '\n\nCheck the render method of `' + ownerName + '`.';
4000 }
4001 }
4002
4003 {
4004 {
4005 throw Error("Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: " + (elementType == null ? elementType : typeof elementType) + "." + info);
4006 }
4007 }
4008 }
4009 };
4010
4011 _proto.renderDOM = function renderDOM(element, context, parentNamespace) {
4012 var tag = element.type.toLowerCase();
4013 var namespace = parentNamespace;
4014
4015 if (parentNamespace === Namespaces.html) {
4016 namespace = getIntrinsicNamespace(tag);
4017 }
4018
4019 {
4020 if (namespace === Namespaces.html) {
4021 // Should this check be gated by parent namespace? Not sure we want to
4022 // allow <SVG> or <mATH>.
4023 !(tag === element.type) ? warning$1(false, '<%s /> is using incorrect casing. ' + 'Use PascalCase for React components, ' + 'or lowercase for HTML elements.', element.type) : void 0;
4024 }
4025 }
4026
4027 validateDangerousTag(tag);
4028 var props = element.props;
4029
4030 if (tag === 'input') {
4031 {
4032 ReactControlledValuePropTypes.checkPropTypes('input', props);
4033
4034 if (props.checked !== undefined && props.defaultChecked !== undefined && !didWarnDefaultChecked) {
4035 warning$1(false, '%s contains an input of type %s with both checked and defaultChecked props. ' + 'Input elements must be either controlled or uncontrolled ' + '(specify either the checked prop, or the defaultChecked prop, but not ' + 'both). Decide between using a controlled or uncontrolled input ' + 'element and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components', 'A component', props.type);
4036 didWarnDefaultChecked = true;
4037 }
4038
4039 if (props.value !== undefined && props.defaultValue !== undefined && !didWarnDefaultInputValue) {
4040 warning$1(false, '%s contains an input of type %s with both value and defaultValue props. ' + 'Input elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled input ' + 'element and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components', 'A component', props.type);
4041 didWarnDefaultInputValue = true;
4042 }
4043 }
4044
4045 props = _assign({
4046 type: undefined
4047 }, props, {
4048 defaultChecked: undefined,
4049 defaultValue: undefined,
4050 value: props.value != null ? props.value : props.defaultValue,
4051 checked: props.checked != null ? props.checked : props.defaultChecked
4052 });
4053 } else if (tag === 'textarea') {
4054 {
4055 ReactControlledValuePropTypes.checkPropTypes('textarea', props);
4056
4057 if (props.value !== undefined && props.defaultValue !== undefined && !didWarnDefaultTextareaValue) {
4058 warning$1(false, 'Textarea elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled textarea ' + 'and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components');
4059 didWarnDefaultTextareaValue = true;
4060 }
4061 }
4062
4063 var initialValue = props.value;
4064
4065 if (initialValue == null) {
4066 var defaultValue = props.defaultValue; // TODO (yungsters): Remove support for children content in <textarea>.
4067
4068 var textareaChildren = props.children;
4069
4070 if (textareaChildren != null) {
4071 {
4072 warning$1(false, 'Use the `defaultValue` or `value` props instead of setting ' + 'children on <textarea>.');
4073 }
4074
4075 if (!(defaultValue == null)) {
4076 {
4077 throw Error("If you supply `defaultValue` on a <textarea>, do not pass children.");
4078 }
4079 }
4080
4081 if (Array.isArray(textareaChildren)) {
4082 if (!(textareaChildren.length <= 1)) {
4083 {
4084 throw Error("<textarea> can only have at most one child.");
4085 }
4086 }
4087
4088 textareaChildren = textareaChildren[0];
4089 }
4090
4091 defaultValue = '' + textareaChildren;
4092 }
4093
4094 if (defaultValue == null) {
4095 defaultValue = '';
4096 }
4097
4098 initialValue = defaultValue;
4099 }
4100
4101 props = _assign({}, props, {
4102 value: undefined,
4103 children: '' + initialValue
4104 });
4105 } else if (tag === 'select') {
4106 {
4107 ReactControlledValuePropTypes.checkPropTypes('select', props);
4108
4109 for (var i = 0; i < valuePropNames.length; i++) {
4110 var propName = valuePropNames[i];
4111
4112 if (props[propName] == null) {
4113 continue;
4114 }
4115
4116 var isArray = Array.isArray(props[propName]);
4117
4118 if (props.multiple && !isArray) {
4119 warning$1(false, 'The `%s` prop supplied to <select> must be an array if ' + '`multiple` is true.', propName);
4120 } else if (!props.multiple && isArray) {
4121 warning$1(false, 'The `%s` prop supplied to <select> must be a scalar ' + 'value if `multiple` is false.', propName);
4122 }
4123 }
4124
4125 if (props.value !== undefined && props.defaultValue !== undefined && !didWarnDefaultSelectValue) {
4126 warning$1(false, 'Select elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled select ' + 'element and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components');
4127 didWarnDefaultSelectValue = true;
4128 }
4129 }
4130
4131 this.currentSelectValue = props.value != null ? props.value : props.defaultValue;
4132 props = _assign({}, props, {
4133 value: undefined
4134 });
4135 } else if (tag === 'option') {
4136 var selected = null;
4137 var selectValue = this.currentSelectValue;
4138 var optionChildren = flattenOptionChildren(props.children);
4139
4140 if (selectValue != null) {
4141 var value;
4142
4143 if (props.value != null) {
4144 value = props.value + '';
4145 } else {
4146 value = optionChildren;
4147 }
4148
4149 selected = false;
4150
4151 if (Array.isArray(selectValue)) {
4152 // multiple
4153 for (var j = 0; j < selectValue.length; j++) {
4154 if ('' + selectValue[j] === value) {
4155 selected = true;
4156 break;
4157 }
4158 }
4159 } else {
4160 selected = '' + selectValue === value;
4161 }
4162
4163 props = _assign({
4164 selected: undefined,
4165 children: undefined
4166 }, props, {
4167 selected: selected,
4168 children: optionChildren
4169 });
4170 }
4171 }
4172
4173 {
4174 validatePropertiesInDevelopment(tag, props);
4175 }
4176
4177 assertValidProps(tag, props);
4178 var out = createOpenTagMarkup(element.type, tag, props, namespace, this.makeStaticMarkup, this.stack.length === 1);
4179 var footer = '';
4180
4181 if (omittedCloseTags.hasOwnProperty(tag)) {
4182 out += '/>';
4183 } else {
4184 out += '>';
4185 footer = '</' + element.type + '>';
4186 }
4187
4188 var children;
4189 var innerMarkup = getNonChildrenInnerMarkup(props);
4190
4191 if (innerMarkup != null) {
4192 children = [];
4193
4194 if (newlineEatingTags[tag] && innerMarkup.charAt(0) === '\n') {
4195 // text/html ignores the first character in these tags if it's a newline
4196 // Prefer to break application/xml over text/html (for now) by adding
4197 // a newline specifically to get eaten by the parser. (Alternately for
4198 // textareas, replacing "^\n" with "\r\n" doesn't get eaten, and the first
4199 // \r is normalized out by HTMLTextAreaElement#value.)
4200 // See: <http://www.w3.org/TR/html-polyglot/#newlines-in-textarea-and-pre>
4201 // See: <http://www.w3.org/TR/html5/syntax.html#element-restrictions>
4202 // See: <http://www.w3.org/TR/html5/syntax.html#newlines>
4203 // See: Parsing of "textarea" "listing" and "pre" elements
4204 // from <http://www.w3.org/TR/html5/syntax.html#parsing-main-inbody>
4205 out += '\n';
4206 }
4207
4208 out += innerMarkup;
4209 } else {
4210 children = toArray(props.children);
4211 }
4212
4213 var frame = {
4214 domNamespace: getChildNamespace(parentNamespace, element.type),
4215 type: tag,
4216 children: children,
4217 childIndex: 0,
4218 context: context,
4219 footer: footer
4220 };
4221
4222 {
4223 frame.debugElementStack = [];
4224 }
4225
4226 this.stack.push(frame);
4227 this.previousWasTextNode = false;
4228 return out;
4229 };
4230
4231 return ReactDOMServerRenderer;
4232}();
4233
4234/**
4235 * Render a ReactElement to its initial HTML. This should only be used on the
4236 * server.
4237 * See https://reactjs.org/docs/react-dom-server.html#rendertostring
4238 */
4239
4240function renderToString(element) {
4241 var renderer = new ReactDOMServerRenderer(element, false);
4242
4243 try {
4244 var markup = renderer.read(Infinity);
4245 return markup;
4246 } finally {
4247 renderer.destroy();
4248 }
4249}
4250/**
4251 * Similar to renderToString, except this doesn't create extra DOM attributes
4252 * such as data-react-id that React uses internally.
4253 * See https://reactjs.org/docs/react-dom-server.html#rendertostaticmarkup
4254 */
4255
4256function renderToStaticMarkup(element) {
4257 var renderer = new ReactDOMServerRenderer(element, true);
4258
4259 try {
4260 var markup = renderer.read(Infinity);
4261 return markup;
4262 } finally {
4263 renderer.destroy();
4264 }
4265}
4266
4267function renderToNodeStream() {
4268 {
4269 {
4270 throw Error("ReactDOMServer.renderToNodeStream(): The streaming API is not available in the browser. Use ReactDOMServer.renderToString() instead.");
4271 }
4272 }
4273}
4274
4275function renderToStaticNodeStream() {
4276 {
4277 {
4278 throw Error("ReactDOMServer.renderToStaticNodeStream(): The streaming API is not available in the browser. Use ReactDOMServer.renderToStaticMarkup() instead.");
4279 }
4280 }
4281} // Note: when changing this, also consider https://github.com/facebook/react/issues/11526
4282
4283
4284var ReactDOMServerBrowser = {
4285 renderToString: renderToString,
4286 renderToStaticMarkup: renderToStaticMarkup,
4287 renderToNodeStream: renderToNodeStream,
4288 renderToStaticNodeStream: renderToStaticNodeStream,
4289 version: ReactVersion
4290};
4291
4292var ReactDOMServerBrowser$1 = Object.freeze({
4293 default: ReactDOMServerBrowser
4294});
4295
4296var ReactDOMServer = ( ReactDOMServerBrowser$1 && ReactDOMServerBrowser ) || ReactDOMServerBrowser$1;
4297
4298// TODO: decide on the top-level export form.
4299// This is hacky but makes it work with both Rollup and Jest
4300
4301
4302var server_browser = ReactDOMServer.default || ReactDOMServer;
4303
4304module.exports = server_browser;
4305 })();
4306}