Passed
Push — master ( 445067...6ce435 )
by Johan
02:18
created

node_modules/react-dom/cjs/react-dom-server.node.development.js   F

Complexity

Total Complexity 441
Complexity/F 5.88

Size

Lines of Code 4400
Function Count 75

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 441
eloc 3141
mnd 366
bc 366
fnc 75
dl 0
loc 4400
rs 0.8
bpm 4.88
cpm 5.88
noi 0
c 0
b 0
f 0

How to fix   Complexity   

Complexity

Complex classes like node_modules/react-dom/cjs/react-dom-server.node.development.js often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes.

Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.

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