UNPKG

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