UNPKG

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