UNPKG

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