UNPKG

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