UNPKG

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