UNPKG

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