UNPKG

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