UNPKG

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