Projekt

Obecné

Profil

Stáhnout (59.2 KB) Statistiky
| Větev: | Revize:
1
/** @license React v16.13.1
2
 * react.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 checkPropTypes = require('prop-types/checkPropTypes');
20

    
21
var ReactVersion = '16.13.1';
22

    
23
// The Symbol used to tag the ReactElement-like types. If there is no native Symbol
24
// nor polyfill, then a plain number is used for performance.
25
var hasSymbol = typeof Symbol === 'function' && Symbol.for;
26
var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
27
var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
28
var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
29
var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
30
var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
31
var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
32
var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary
33
var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
34
var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
35
var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
36
var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8;
37
var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
38
var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
39
var REACT_BLOCK_TYPE = hasSymbol ? Symbol.for('react.block') : 0xead9;
40
var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5;
41
var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6;
42
var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7;
43
var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
44
var FAUX_ITERATOR_SYMBOL = '@@iterator';
45
function getIteratorFn(maybeIterable) {
46
  if (maybeIterable === null || typeof maybeIterable !== 'object') {
47
    return null;
48
  }
49

    
50
  var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
51

    
52
  if (typeof maybeIterator === 'function') {
53
    return maybeIterator;
54
  }
55

    
56
  return null;
57
}
58

    
59
/**
60
 * Keeps track of the current dispatcher.
61
 */
62
var ReactCurrentDispatcher = {
63
  /**
64
   * @internal
65
   * @type {ReactComponent}
66
   */
67
  current: null
68
};
69

    
70
/**
71
 * Keeps track of the current batch's configuration such as how long an update
72
 * should suspend for if it needs to.
73
 */
74
var ReactCurrentBatchConfig = {
75
  suspense: null
76
};
77

    
78
/**
79
 * Keeps track of the current owner.
80
 *
81
 * The current owner is the component who should own any components that are
82
 * currently being constructed.
83
 */
84
var ReactCurrentOwner = {
85
  /**
86
   * @internal
87
   * @type {ReactComponent}
88
   */
89
  current: null
90
};
91

    
92
var BEFORE_SLASH_RE = /^(.*)[\\\/]/;
93
function describeComponentFrame (name, source, ownerName) {
94
  var sourceInfo = '';
95

    
96
  if (source) {
97
    var path = source.fileName;
98
    var fileName = path.replace(BEFORE_SLASH_RE, '');
99

    
100
    {
101
      // In DEV, include code for a common special case:
102
      // prefer "folder/index.js" instead of just "index.js".
103
      if (/^index\./.test(fileName)) {
104
        var match = path.match(BEFORE_SLASH_RE);
105

    
106
        if (match) {
107
          var pathBeforeSlash = match[1];
108

    
109
          if (pathBeforeSlash) {
110
            var folderName = pathBeforeSlash.replace(BEFORE_SLASH_RE, '');
111
            fileName = folderName + '/' + fileName;
112
          }
113
        }
114
      }
115
    }
116

    
117
    sourceInfo = ' (at ' + fileName + ':' + source.lineNumber + ')';
118
  } else if (ownerName) {
119
    sourceInfo = ' (created by ' + ownerName + ')';
120
  }
121

    
122
  return '\n    in ' + (name || 'Unknown') + sourceInfo;
123
}
124

    
125
var Resolved = 1;
126
function refineResolvedLazyComponent(lazyComponent) {
127
  return lazyComponent._status === Resolved ? lazyComponent._result : null;
128
}
129

    
130
function getWrappedName(outerType, innerType, wrapperName) {
131
  var functionName = innerType.displayName || innerType.name || '';
132
  return outerType.displayName || (functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName);
133
}
134

    
135
function getComponentName(type) {
136
  if (type == null) {
137
    // Host root, text node or just invalid type.
138
    return null;
139
  }
140

    
141
  {
142
    if (typeof type.tag === 'number') {
143
      error('Received an unexpected object in getComponentName(). ' + 'This is likely a bug in React. Please file an issue.');
144
    }
145
  }
146

    
147
  if (typeof type === 'function') {
148
    return type.displayName || type.name || null;
149
  }
150

    
151
  if (typeof type === 'string') {
152
    return type;
153
  }
154

    
155
  switch (type) {
156
    case REACT_FRAGMENT_TYPE:
157
      return 'Fragment';
158

    
159
    case REACT_PORTAL_TYPE:
160
      return 'Portal';
161

    
162
    case REACT_PROFILER_TYPE:
163
      return "Profiler";
164

    
165
    case REACT_STRICT_MODE_TYPE:
166
      return 'StrictMode';
167

    
168
    case REACT_SUSPENSE_TYPE:
169
      return 'Suspense';
170

    
171
    case REACT_SUSPENSE_LIST_TYPE:
172
      return 'SuspenseList';
173
  }
174

    
175
  if (typeof type === 'object') {
176
    switch (type.$$typeof) {
177
      case REACT_CONTEXT_TYPE:
178
        return 'Context.Consumer';
179

    
180
      case REACT_PROVIDER_TYPE:
181
        return 'Context.Provider';
182

    
183
      case REACT_FORWARD_REF_TYPE:
184
        return getWrappedName(type, type.render, 'ForwardRef');
185

    
186
      case REACT_MEMO_TYPE:
187
        return getComponentName(type.type);
188

    
189
      case REACT_BLOCK_TYPE:
190
        return getComponentName(type.render);
191

    
192
      case REACT_LAZY_TYPE:
193
        {
194
          var thenable = type;
195
          var resolvedThenable = refineResolvedLazyComponent(thenable);
196

    
197
          if (resolvedThenable) {
198
            return getComponentName(resolvedThenable);
199
          }
200

    
201
          break;
202
        }
203
    }
204
  }
205

    
206
  return null;
207
}
208

    
209
var ReactDebugCurrentFrame = {};
210
var currentlyValidatingElement = null;
211
function setCurrentlyValidatingElement(element) {
212
  {
213
    currentlyValidatingElement = element;
214
  }
215
}
216

    
217
{
218
  // Stack implementation injected by the current renderer.
219
  ReactDebugCurrentFrame.getCurrentStack = null;
220

    
221
  ReactDebugCurrentFrame.getStackAddendum = function () {
222
    var stack = ''; // Add an extra top frame while an element is being validated
223

    
224
    if (currentlyValidatingElement) {
225
      var name = getComponentName(currentlyValidatingElement.type);
226
      var owner = currentlyValidatingElement._owner;
227
      stack += describeComponentFrame(name, currentlyValidatingElement._source, owner && getComponentName(owner.type));
228
    } // Delegate to the injected renderer-specific implementation
229

    
230

    
231
    var impl = ReactDebugCurrentFrame.getCurrentStack;
232

    
233
    if (impl) {
234
      stack += impl() || '';
235
    }
236

    
237
    return stack;
238
  };
239
}
240

    
241
/**
242
 * Used by act() to track whether you're inside an act() scope.
243
 */
244
var IsSomeRendererActing = {
245
  current: false
246
};
247

    
248
var ReactSharedInternals = {
249
  ReactCurrentDispatcher: ReactCurrentDispatcher,
250
  ReactCurrentBatchConfig: ReactCurrentBatchConfig,
251
  ReactCurrentOwner: ReactCurrentOwner,
252
  IsSomeRendererActing: IsSomeRendererActing,
253
  // Used by renderers to avoid bundling object-assign twice in UMD bundles:
254
  assign: _assign
255
};
256

    
257
{
258
  _assign(ReactSharedInternals, {
259
    // These should not be included in production.
260
    ReactDebugCurrentFrame: ReactDebugCurrentFrame,
261
    // Shim for React DOM 16.0.0 which still destructured (but not used) this.
262
    // TODO: remove in React 17.0.
263
    ReactComponentTreeHook: {}
264
  });
265
}
266

    
267
// by calls to these methods by a Babel plugin.
268
//
269
// In PROD (or in packages without access to React internals),
270
// they are left as they are instead.
271

    
272
function warn(format) {
273
  {
274
    for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
275
      args[_key - 1] = arguments[_key];
276
    }
277

    
278
    printWarning('warn', format, args);
279
  }
280
}
281
function error(format) {
282
  {
283
    for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
284
      args[_key2 - 1] = arguments[_key2];
285
    }
286

    
287
    printWarning('error', format, args);
288
  }
289
}
290

    
291
function printWarning(level, format, args) {
292
  // When changing this logic, you might want to also
293
  // update consoleWithStackDev.www.js as well.
294
  {
295
    var hasExistingStack = args.length > 0 && typeof args[args.length - 1] === 'string' && args[args.length - 1].indexOf('\n    in') === 0;
296

    
297
    if (!hasExistingStack) {
298
      var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
299
      var stack = ReactDebugCurrentFrame.getStackAddendum();
300

    
301
      if (stack !== '') {
302
        format += '%s';
303
        args = args.concat([stack]);
304
      }
305
    }
306

    
307
    var argsWithFormat = args.map(function (item) {
308
      return '' + item;
309
    }); // Careful: RN currently depends on this prefix
310

    
311
    argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
312
    // breaks IE9: https://github.com/facebook/react/issues/13610
313
    // eslint-disable-next-line react-internal/no-production-logging
314

    
315
    Function.prototype.apply.call(console[level], console, argsWithFormat);
316

    
317
    try {
318
      // --- Welcome to debugging React ---
319
      // This error was thrown as a convenience so that you can use this stack
320
      // to find the callsite that caused this warning to fire.
321
      var argIndex = 0;
322
      var message = 'Warning: ' + format.replace(/%s/g, function () {
323
        return args[argIndex++];
324
      });
325
      throw new Error(message);
326
    } catch (x) {}
327
  }
328
}
329

    
330
var didWarnStateUpdateForUnmountedComponent = {};
331

    
332
function warnNoop(publicInstance, callerName) {
333
  {
334
    var _constructor = publicInstance.constructor;
335
    var componentName = _constructor && (_constructor.displayName || _constructor.name) || 'ReactClass';
336
    var warningKey = componentName + "." + callerName;
337

    
338
    if (didWarnStateUpdateForUnmountedComponent[warningKey]) {
339
      return;
340
    }
341

    
342
    error("Can't call %s on a component that is not yet mounted. " + 'This is a no-op, but it might indicate a bug in your application. ' + 'Instead, assign to `this.state` directly or define a `state = {};` ' + 'class property with the desired state in the %s component.', callerName, componentName);
343

    
344
    didWarnStateUpdateForUnmountedComponent[warningKey] = true;
345
  }
346
}
347
/**
348
 * This is the abstract API for an update queue.
349
 */
350

    
351

    
352
var ReactNoopUpdateQueue = {
353
  /**
354
   * Checks whether or not this composite component is mounted.
355
   * @param {ReactClass} publicInstance The instance we want to test.
356
   * @return {boolean} True if mounted, false otherwise.
357
   * @protected
358
   * @final
359
   */
360
  isMounted: function (publicInstance) {
361
    return false;
362
  },
363

    
364
  /**
365
   * Forces an update. This should only be invoked when it is known with
366
   * certainty that we are **not** in a DOM transaction.
367
   *
368
   * You may want to call this when you know that some deeper aspect of the
369
   * component's state has changed but `setState` was not called.
370
   *
371
   * This will not invoke `shouldComponentUpdate`, but it will invoke
372
   * `componentWillUpdate` and `componentDidUpdate`.
373
   *
374
   * @param {ReactClass} publicInstance The instance that should rerender.
375
   * @param {?function} callback Called after component is updated.
376
   * @param {?string} callerName name of the calling function in the public API.
377
   * @internal
378
   */
379
  enqueueForceUpdate: function (publicInstance, callback, callerName) {
380
    warnNoop(publicInstance, 'forceUpdate');
381
  },
382

    
383
  /**
384
   * Replaces all of the state. Always use this or `setState` to mutate state.
385
   * You should treat `this.state` as immutable.
386
   *
387
   * There is no guarantee that `this.state` will be immediately updated, so
388
   * accessing `this.state` after calling this method may return the old value.
389
   *
390
   * @param {ReactClass} publicInstance The instance that should rerender.
391
   * @param {object} completeState Next state.
392
   * @param {?function} callback Called after component is updated.
393
   * @param {?string} callerName name of the calling function in the public API.
394
   * @internal
395
   */
396
  enqueueReplaceState: function (publicInstance, completeState, callback, callerName) {
397
    warnNoop(publicInstance, 'replaceState');
398
  },
399

    
400
  /**
401
   * Sets a subset of the state. This only exists because _pendingState is
402
   * internal. This provides a merging strategy that is not available to deep
403
   * properties which is confusing. TODO: Expose pendingState or don't use it
404
   * during the merge.
405
   *
406
   * @param {ReactClass} publicInstance The instance that should rerender.
407
   * @param {object} partialState Next partial state to be merged with state.
408
   * @param {?function} callback Called after component is updated.
409
   * @param {?string} Name of the calling function in the public API.
410
   * @internal
411
   */
412
  enqueueSetState: function (publicInstance, partialState, callback, callerName) {
413
    warnNoop(publicInstance, 'setState');
414
  }
415
};
416

    
417
var emptyObject = {};
418

    
419
{
420
  Object.freeze(emptyObject);
421
}
422
/**
423
 * Base class helpers for the updating state of a component.
424
 */
425

    
426

    
427
function Component(props, context, updater) {
428
  this.props = props;
429
  this.context = context; // If a component has string refs, we will assign a different object later.
430

    
431
  this.refs = emptyObject; // We initialize the default updater but the real one gets injected by the
432
  // renderer.
433

    
434
  this.updater = updater || ReactNoopUpdateQueue;
435
}
436

    
437
Component.prototype.isReactComponent = {};
438
/**
439
 * Sets a subset of the state. Always use this to mutate
440
 * state. You should treat `this.state` as immutable.
441
 *
442
 * There is no guarantee that `this.state` will be immediately updated, so
443
 * accessing `this.state` after calling this method may return the old value.
444
 *
445
 * There is no guarantee that calls to `setState` will run synchronously,
446
 * as they may eventually be batched together.  You can provide an optional
447
 * callback that will be executed when the call to setState is actually
448
 * completed.
449
 *
450
 * When a function is provided to setState, it will be called at some point in
451
 * the future (not synchronously). It will be called with the up to date
452
 * component arguments (state, props, context). These values can be different
453
 * from this.* because your function may be called after receiveProps but before
454
 * shouldComponentUpdate, and this new state, props, and context will not yet be
455
 * assigned to this.
456
 *
457
 * @param {object|function} partialState Next partial state or function to
458
 *        produce next partial state to be merged with current state.
459
 * @param {?function} callback Called after state is updated.
460
 * @final
461
 * @protected
462
 */
463

    
464
Component.prototype.setState = function (partialState, callback) {
465
  if (!(typeof partialState === 'object' || typeof partialState === 'function' || partialState == null)) {
466
    {
467
      throw Error( "setState(...): takes an object of state variables to update or a function which returns an object of state variables." );
468
    }
469
  }
470

    
471
  this.updater.enqueueSetState(this, partialState, callback, 'setState');
472
};
473
/**
474
 * Forces an update. This should only be invoked when it is known with
475
 * certainty that we are **not** in a DOM transaction.
476
 *
477
 * You may want to call this when you know that some deeper aspect of the
478
 * component's state has changed but `setState` was not called.
479
 *
480
 * This will not invoke `shouldComponentUpdate`, but it will invoke
481
 * `componentWillUpdate` and `componentDidUpdate`.
482
 *
483
 * @param {?function} callback Called after update is complete.
484
 * @final
485
 * @protected
486
 */
487

    
488

    
489
Component.prototype.forceUpdate = function (callback) {
490
  this.updater.enqueueForceUpdate(this, callback, 'forceUpdate');
491
};
492
/**
493
 * Deprecated APIs. These APIs used to exist on classic React classes but since
494
 * we would like to deprecate them, we're not going to move them over to this
495
 * modern base class. Instead, we define a getter that warns if it's accessed.
496
 */
497

    
498

    
499
{
500
  var deprecatedAPIs = {
501
    isMounted: ['isMounted', 'Instead, make sure to clean up subscriptions and pending requests in ' + 'componentWillUnmount to prevent memory leaks.'],
502
    replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).']
503
  };
504

    
505
  var defineDeprecationWarning = function (methodName, info) {
506
    Object.defineProperty(Component.prototype, methodName, {
507
      get: function () {
508
        warn('%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]);
509

    
510
        return undefined;
511
      }
512
    });
513
  };
514

    
515
  for (var fnName in deprecatedAPIs) {
516
    if (deprecatedAPIs.hasOwnProperty(fnName)) {
517
      defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
518
    }
519
  }
520
}
521

    
522
function ComponentDummy() {}
523

    
524
ComponentDummy.prototype = Component.prototype;
525
/**
526
 * Convenience component with default shallow equality check for sCU.
527
 */
528

    
529
function PureComponent(props, context, updater) {
530
  this.props = props;
531
  this.context = context; // If a component has string refs, we will assign a different object later.
532

    
533
  this.refs = emptyObject;
534
  this.updater = updater || ReactNoopUpdateQueue;
535
}
536

    
537
var pureComponentPrototype = PureComponent.prototype = new ComponentDummy();
538
pureComponentPrototype.constructor = PureComponent; // Avoid an extra prototype jump for these methods.
539

    
540
_assign(pureComponentPrototype, Component.prototype);
541

    
542
pureComponentPrototype.isPureReactComponent = true;
543

    
544
// an immutable object with a single mutable value
545
function createRef() {
546
  var refObject = {
547
    current: null
548
  };
549

    
550
  {
551
    Object.seal(refObject);
552
  }
553

    
554
  return refObject;
555
}
556

    
557
var hasOwnProperty = Object.prototype.hasOwnProperty;
558
var RESERVED_PROPS = {
559
  key: true,
560
  ref: true,
561
  __self: true,
562
  __source: true
563
};
564
var specialPropKeyWarningShown, specialPropRefWarningShown, didWarnAboutStringRefs;
565

    
566
{
567
  didWarnAboutStringRefs = {};
568
}
569

    
570
function hasValidRef(config) {
571
  {
572
    if (hasOwnProperty.call(config, 'ref')) {
573
      var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;
574

    
575
      if (getter && getter.isReactWarning) {
576
        return false;
577
      }
578
    }
579
  }
580

    
581
  return config.ref !== undefined;
582
}
583

    
584
function hasValidKey(config) {
585
  {
586
    if (hasOwnProperty.call(config, 'key')) {
587
      var getter = Object.getOwnPropertyDescriptor(config, 'key').get;
588

    
589
      if (getter && getter.isReactWarning) {
590
        return false;
591
      }
592
    }
593
  }
594

    
595
  return config.key !== undefined;
596
}
597

    
598
function defineKeyPropWarningGetter(props, displayName) {
599
  var warnAboutAccessingKey = function () {
600
    {
601
      if (!specialPropKeyWarningShown) {
602
        specialPropKeyWarningShown = true;
603

    
604
        error('%s: `key` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://fb.me/react-special-props)', displayName);
605
      }
606
    }
607
  };
608

    
609
  warnAboutAccessingKey.isReactWarning = true;
610
  Object.defineProperty(props, 'key', {
611
    get: warnAboutAccessingKey,
612
    configurable: true
613
  });
614
}
615

    
616
function defineRefPropWarningGetter(props, displayName) {
617
  var warnAboutAccessingRef = function () {
618
    {
619
      if (!specialPropRefWarningShown) {
620
        specialPropRefWarningShown = true;
621

    
622
        error('%s: `ref` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://fb.me/react-special-props)', displayName);
623
      }
624
    }
625
  };
626

    
627
  warnAboutAccessingRef.isReactWarning = true;
628
  Object.defineProperty(props, 'ref', {
629
    get: warnAboutAccessingRef,
630
    configurable: true
631
  });
632
}
633

    
634
function warnIfStringRefCannotBeAutoConverted(config) {
635
  {
636
    if (typeof config.ref === 'string' && ReactCurrentOwner.current && config.__self && ReactCurrentOwner.current.stateNode !== config.__self) {
637
      var componentName = getComponentName(ReactCurrentOwner.current.type);
638

    
639
      if (!didWarnAboutStringRefs[componentName]) {
640
        error('Component "%s" contains the string ref "%s". ' + 'Support for string refs will be removed in a future major release. ' + 'This case cannot be automatically converted to an arrow function. ' + 'We ask you to manually fix this case by using useRef() or createRef() instead. ' + 'Learn more about using refs safely here: ' + 'https://fb.me/react-strict-mode-string-ref', getComponentName(ReactCurrentOwner.current.type), config.ref);
641

    
642
        didWarnAboutStringRefs[componentName] = true;
643
      }
644
    }
645
  }
646
}
647
/**
648
 * Factory method to create a new React element. This no longer adheres to
649
 * the class pattern, so do not use new to call it. Also, instanceof check
650
 * will not work. Instead test $$typeof field against Symbol.for('react.element') to check
651
 * if something is a React Element.
652
 *
653
 * @param {*} type
654
 * @param {*} props
655
 * @param {*} key
656
 * @param {string|object} ref
657
 * @param {*} owner
658
 * @param {*} self A *temporary* helper to detect places where `this` is
659
 * different from the `owner` when React.createElement is called, so that we
660
 * can warn. We want to get rid of owner and replace string `ref`s with arrow
661
 * functions, and as long as `this` and owner are the same, there will be no
662
 * change in behavior.
663
 * @param {*} source An annotation object (added by a transpiler or otherwise)
664
 * indicating filename, line number, and/or other information.
665
 * @internal
666
 */
667

    
668

    
669
var ReactElement = function (type, key, ref, self, source, owner, props) {
670
  var element = {
671
    // This tag allows us to uniquely identify this as a React Element
672
    $$typeof: REACT_ELEMENT_TYPE,
673
    // Built-in properties that belong on the element
674
    type: type,
675
    key: key,
676
    ref: ref,
677
    props: props,
678
    // Record the component responsible for creating this element.
679
    _owner: owner
680
  };
681

    
682
  {
683
    // The validation flag is currently mutative. We put it on
684
    // an external backing store so that we can freeze the whole object.
685
    // This can be replaced with a WeakMap once they are implemented in
686
    // commonly used development environments.
687
    element._store = {}; // To make comparing ReactElements easier for testing purposes, we make
688
    // the validation flag non-enumerable (where possible, which should
689
    // include every environment we run tests in), so the test framework
690
    // ignores it.
691

    
692
    Object.defineProperty(element._store, 'validated', {
693
      configurable: false,
694
      enumerable: false,
695
      writable: true,
696
      value: false
697
    }); // self and source are DEV only properties.
698

    
699
    Object.defineProperty(element, '_self', {
700
      configurable: false,
701
      enumerable: false,
702
      writable: false,
703
      value: self
704
    }); // Two elements created in two different places should be considered
705
    // equal for testing purposes and therefore we hide it from enumeration.
706

    
707
    Object.defineProperty(element, '_source', {
708
      configurable: false,
709
      enumerable: false,
710
      writable: false,
711
      value: source
712
    });
713

    
714
    if (Object.freeze) {
715
      Object.freeze(element.props);
716
      Object.freeze(element);
717
    }
718
  }
719

    
720
  return element;
721
};
722
/**
723
 * Create and return a new ReactElement of the given type.
724
 * See https://reactjs.org/docs/react-api.html#createelement
725
 */
726

    
727
function createElement(type, config, children) {
728
  var propName; // Reserved names are extracted
729

    
730
  var props = {};
731
  var key = null;
732
  var ref = null;
733
  var self = null;
734
  var source = null;
735

    
736
  if (config != null) {
737
    if (hasValidRef(config)) {
738
      ref = config.ref;
739

    
740
      {
741
        warnIfStringRefCannotBeAutoConverted(config);
742
      }
743
    }
744

    
745
    if (hasValidKey(config)) {
746
      key = '' + config.key;
747
    }
748

    
749
    self = config.__self === undefined ? null : config.__self;
750
    source = config.__source === undefined ? null : config.__source; // Remaining properties are added to a new props object
751

    
752
    for (propName in config) {
753
      if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
754
        props[propName] = config[propName];
755
      }
756
    }
757
  } // Children can be more than one argument, and those are transferred onto
758
  // the newly allocated props object.
759

    
760

    
761
  var childrenLength = arguments.length - 2;
762

    
763
  if (childrenLength === 1) {
764
    props.children = children;
765
  } else if (childrenLength > 1) {
766
    var childArray = Array(childrenLength);
767

    
768
    for (var i = 0; i < childrenLength; i++) {
769
      childArray[i] = arguments[i + 2];
770
    }
771

    
772
    {
773
      if (Object.freeze) {
774
        Object.freeze(childArray);
775
      }
776
    }
777

    
778
    props.children = childArray;
779
  } // Resolve default props
780

    
781

    
782
  if (type && type.defaultProps) {
783
    var defaultProps = type.defaultProps;
784

    
785
    for (propName in defaultProps) {
786
      if (props[propName] === undefined) {
787
        props[propName] = defaultProps[propName];
788
      }
789
    }
790
  }
791

    
792
  {
793
    if (key || ref) {
794
      var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
795

    
796
      if (key) {
797
        defineKeyPropWarningGetter(props, displayName);
798
      }
799

    
800
      if (ref) {
801
        defineRefPropWarningGetter(props, displayName);
802
      }
803
    }
804
  }
805

    
806
  return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
807
}
808
function cloneAndReplaceKey(oldElement, newKey) {
809
  var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props);
810
  return newElement;
811
}
812
/**
813
 * Clone and return a new ReactElement using element as the starting point.
814
 * See https://reactjs.org/docs/react-api.html#cloneelement
815
 */
816

    
817
function cloneElement(element, config, children) {
818
  if (!!(element === null || element === undefined)) {
819
    {
820
      throw Error( "React.cloneElement(...): The argument must be a React element, but you passed " + element + "." );
821
    }
822
  }
823

    
824
  var propName; // Original props are copied
825

    
826
  var props = _assign({}, element.props); // Reserved names are extracted
827

    
828

    
829
  var key = element.key;
830
  var ref = element.ref; // Self is preserved since the owner is preserved.
831

    
832
  var self = element._self; // Source is preserved since cloneElement is unlikely to be targeted by a
833
  // transpiler, and the original source is probably a better indicator of the
834
  // true owner.
835

    
836
  var source = element._source; // Owner will be preserved, unless ref is overridden
837

    
838
  var owner = element._owner;
839

    
840
  if (config != null) {
841
    if (hasValidRef(config)) {
842
      // Silently steal the ref from the parent.
843
      ref = config.ref;
844
      owner = ReactCurrentOwner.current;
845
    }
846

    
847
    if (hasValidKey(config)) {
848
      key = '' + config.key;
849
    } // Remaining properties override existing props
850

    
851

    
852
    var defaultProps;
853

    
854
    if (element.type && element.type.defaultProps) {
855
      defaultProps = element.type.defaultProps;
856
    }
857

    
858
    for (propName in config) {
859
      if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
860
        if (config[propName] === undefined && defaultProps !== undefined) {
861
          // Resolve default props
862
          props[propName] = defaultProps[propName];
863
        } else {
864
          props[propName] = config[propName];
865
        }
866
      }
867
    }
868
  } // Children can be more than one argument, and those are transferred onto
869
  // the newly allocated props object.
870

    
871

    
872
  var childrenLength = arguments.length - 2;
873

    
874
  if (childrenLength === 1) {
875
    props.children = children;
876
  } else if (childrenLength > 1) {
877
    var childArray = Array(childrenLength);
878

    
879
    for (var i = 0; i < childrenLength; i++) {
880
      childArray[i] = arguments[i + 2];
881
    }
882

    
883
    props.children = childArray;
884
  }
885

    
886
  return ReactElement(element.type, key, ref, self, source, owner, props);
887
}
888
/**
889
 * Verifies the object is a ReactElement.
890
 * See https://reactjs.org/docs/react-api.html#isvalidelement
891
 * @param {?object} object
892
 * @return {boolean} True if `object` is a ReactElement.
893
 * @final
894
 */
895

    
896
function isValidElement(object) {
897
  return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
898
}
899

    
900
var SEPARATOR = '.';
901
var SUBSEPARATOR = ':';
902
/**
903
 * Escape and wrap key so it is safe to use as a reactid
904
 *
905
 * @param {string} key to be escaped.
906
 * @return {string} the escaped key.
907
 */
908

    
909
function escape(key) {
910
  var escapeRegex = /[=:]/g;
911
  var escaperLookup = {
912
    '=': '=0',
913
    ':': '=2'
914
  };
915
  var escapedString = ('' + key).replace(escapeRegex, function (match) {
916
    return escaperLookup[match];
917
  });
918
  return '$' + escapedString;
919
}
920
/**
921
 * TODO: Test that a single child and an array with one item have the same key
922
 * pattern.
923
 */
924

    
925

    
926
var didWarnAboutMaps = false;
927
var userProvidedKeyEscapeRegex = /\/+/g;
928

    
929
function escapeUserProvidedKey(text) {
930
  return ('' + text).replace(userProvidedKeyEscapeRegex, '$&/');
931
}
932

    
933
var POOL_SIZE = 10;
934
var traverseContextPool = [];
935

    
936
function getPooledTraverseContext(mapResult, keyPrefix, mapFunction, mapContext) {
937
  if (traverseContextPool.length) {
938
    var traverseContext = traverseContextPool.pop();
939
    traverseContext.result = mapResult;
940
    traverseContext.keyPrefix = keyPrefix;
941
    traverseContext.func = mapFunction;
942
    traverseContext.context = mapContext;
943
    traverseContext.count = 0;
944
    return traverseContext;
945
  } else {
946
    return {
947
      result: mapResult,
948
      keyPrefix: keyPrefix,
949
      func: mapFunction,
950
      context: mapContext,
951
      count: 0
952
    };
953
  }
954
}
955

    
956
function releaseTraverseContext(traverseContext) {
957
  traverseContext.result = null;
958
  traverseContext.keyPrefix = null;
959
  traverseContext.func = null;
960
  traverseContext.context = null;
961
  traverseContext.count = 0;
962

    
963
  if (traverseContextPool.length < POOL_SIZE) {
964
    traverseContextPool.push(traverseContext);
965
  }
966
}
967
/**
968
 * @param {?*} children Children tree container.
969
 * @param {!string} nameSoFar Name of the key path so far.
970
 * @param {!function} callback Callback to invoke with each child found.
971
 * @param {?*} traverseContext Used to pass information throughout the traversal
972
 * process.
973
 * @return {!number} The number of children in this subtree.
974
 */
975

    
976

    
977
function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext) {
978
  var type = typeof children;
979

    
980
  if (type === 'undefined' || type === 'boolean') {
981
    // All of the above are perceived as null.
982
    children = null;
983
  }
984

    
985
  var invokeCallback = false;
986

    
987
  if (children === null) {
988
    invokeCallback = true;
989
  } else {
990
    switch (type) {
991
      case 'string':
992
      case 'number':
993
        invokeCallback = true;
994
        break;
995

    
996
      case 'object':
997
        switch (children.$$typeof) {
998
          case REACT_ELEMENT_TYPE:
999
          case REACT_PORTAL_TYPE:
1000
            invokeCallback = true;
1001
        }
1002

    
1003
    }
1004
  }
1005

    
1006
  if (invokeCallback) {
1007
    callback(traverseContext, children, // If it's the only child, treat the name as if it was wrapped in an array
1008
    // so that it's consistent if the number of children grows.
1009
    nameSoFar === '' ? SEPARATOR + getComponentKey(children, 0) : nameSoFar);
1010
    return 1;
1011
  }
1012

    
1013
  var child;
1014
  var nextName;
1015
  var subtreeCount = 0; // Count of children found in the current subtree.
1016

    
1017
  var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR;
1018

    
1019
  if (Array.isArray(children)) {
1020
    for (var i = 0; i < children.length; i++) {
1021
      child = children[i];
1022
      nextName = nextNamePrefix + getComponentKey(child, i);
1023
      subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
1024
    }
1025
  } else {
1026
    var iteratorFn = getIteratorFn(children);
1027

    
1028
    if (typeof iteratorFn === 'function') {
1029

    
1030
      {
1031
        // Warn about using Maps as children
1032
        if (iteratorFn === children.entries) {
1033
          if (!didWarnAboutMaps) {
1034
            warn('Using Maps as children is deprecated and will be removed in ' + 'a future major release. Consider converting children to ' + 'an array of keyed ReactElements instead.');
1035
          }
1036

    
1037
          didWarnAboutMaps = true;
1038
        }
1039
      }
1040

    
1041
      var iterator = iteratorFn.call(children);
1042
      var step;
1043
      var ii = 0;
1044

    
1045
      while (!(step = iterator.next()).done) {
1046
        child = step.value;
1047
        nextName = nextNamePrefix + getComponentKey(child, ii++);
1048
        subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
1049
      }
1050
    } else if (type === 'object') {
1051
      var addendum = '';
1052

    
1053
      {
1054
        addendum = ' If you meant to render a collection of children, use an array ' + 'instead.' + ReactDebugCurrentFrame.getStackAddendum();
1055
      }
1056

    
1057
      var childrenString = '' + children;
1058

    
1059
      {
1060
        {
1061
          throw Error( "Objects are not valid as a React child (found: " + (childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString) + ")." + addendum );
1062
        }
1063
      }
1064
    }
1065
  }
1066

    
1067
  return subtreeCount;
1068
}
1069
/**
1070
 * Traverses children that are typically specified as `props.children`, but
1071
 * might also be specified through attributes:
1072
 *
1073
 * - `traverseAllChildren(this.props.children, ...)`
1074
 * - `traverseAllChildren(this.props.leftPanelChildren, ...)`
1075
 *
1076
 * The `traverseContext` is an optional argument that is passed through the
1077
 * entire traversal. It can be used to store accumulations or anything else that
1078
 * the callback might find relevant.
1079
 *
1080
 * @param {?*} children Children tree object.
1081
 * @param {!function} callback To invoke upon traversing each child.
1082
 * @param {?*} traverseContext Context for traversal.
1083
 * @return {!number} The number of children in this subtree.
1084
 */
1085

    
1086

    
1087
function traverseAllChildren(children, callback, traverseContext) {
1088
  if (children == null) {
1089
    return 0;
1090
  }
1091

    
1092
  return traverseAllChildrenImpl(children, '', callback, traverseContext);
1093
}
1094
/**
1095
 * Generate a key string that identifies a component within a set.
1096
 *
1097
 * @param {*} component A component that could contain a manual key.
1098
 * @param {number} index Index that is used if a manual key is not provided.
1099
 * @return {string}
1100
 */
1101

    
1102

    
1103
function getComponentKey(component, index) {
1104
  // Do some typechecking here since we call this blindly. We want to ensure
1105
  // that we don't block potential future ES APIs.
1106
  if (typeof component === 'object' && component !== null && component.key != null) {
1107
    // Explicit key
1108
    return escape(component.key);
1109
  } // Implicit key determined by the index in the set
1110

    
1111

    
1112
  return index.toString(36);
1113
}
1114

    
1115
function forEachSingleChild(bookKeeping, child, name) {
1116
  var func = bookKeeping.func,
1117
      context = bookKeeping.context;
1118
  func.call(context, child, bookKeeping.count++);
1119
}
1120
/**
1121
 * Iterates through children that are typically specified as `props.children`.
1122
 *
1123
 * See https://reactjs.org/docs/react-api.html#reactchildrenforeach
1124
 *
1125
 * The provided forEachFunc(child, index) will be called for each
1126
 * leaf child.
1127
 *
1128
 * @param {?*} children Children tree container.
1129
 * @param {function(*, int)} forEachFunc
1130
 * @param {*} forEachContext Context for forEachContext.
1131
 */
1132

    
1133

    
1134
function forEachChildren(children, forEachFunc, forEachContext) {
1135
  if (children == null) {
1136
    return children;
1137
  }
1138

    
1139
  var traverseContext = getPooledTraverseContext(null, null, forEachFunc, forEachContext);
1140
  traverseAllChildren(children, forEachSingleChild, traverseContext);
1141
  releaseTraverseContext(traverseContext);
1142
}
1143

    
1144
function mapSingleChildIntoContext(bookKeeping, child, childKey) {
1145
  var result = bookKeeping.result,
1146
      keyPrefix = bookKeeping.keyPrefix,
1147
      func = bookKeeping.func,
1148
      context = bookKeeping.context;
1149
  var mappedChild = func.call(context, child, bookKeeping.count++);
1150

    
1151
  if (Array.isArray(mappedChild)) {
1152
    mapIntoWithKeyPrefixInternal(mappedChild, result, childKey, function (c) {
1153
      return c;
1154
    });
1155
  } else if (mappedChild != null) {
1156
    if (isValidElement(mappedChild)) {
1157
      mappedChild = cloneAndReplaceKey(mappedChild, // Keep both the (mapped) and old keys if they differ, just as
1158
      // traverseAllChildren used to do for objects as children
1159
      keyPrefix + (mappedChild.key && (!child || child.key !== mappedChild.key) ? escapeUserProvidedKey(mappedChild.key) + '/' : '') + childKey);
1160
    }
1161

    
1162
    result.push(mappedChild);
1163
  }
1164
}
1165

    
1166
function mapIntoWithKeyPrefixInternal(children, array, prefix, func, context) {
1167
  var escapedPrefix = '';
1168

    
1169
  if (prefix != null) {
1170
    escapedPrefix = escapeUserProvidedKey(prefix) + '/';
1171
  }
1172

    
1173
  var traverseContext = getPooledTraverseContext(array, escapedPrefix, func, context);
1174
  traverseAllChildren(children, mapSingleChildIntoContext, traverseContext);
1175
  releaseTraverseContext(traverseContext);
1176
}
1177
/**
1178
 * Maps children that are typically specified as `props.children`.
1179
 *
1180
 * See https://reactjs.org/docs/react-api.html#reactchildrenmap
1181
 *
1182
 * The provided mapFunction(child, key, index) will be called for each
1183
 * leaf child.
1184
 *
1185
 * @param {?*} children Children tree container.
1186
 * @param {function(*, int)} func The map function.
1187
 * @param {*} context Context for mapFunction.
1188
 * @return {object} Object containing the ordered map of results.
1189
 */
1190

    
1191

    
1192
function mapChildren(children, func, context) {
1193
  if (children == null) {
1194
    return children;
1195
  }
1196

    
1197
  var result = [];
1198
  mapIntoWithKeyPrefixInternal(children, result, null, func, context);
1199
  return result;
1200
}
1201
/**
1202
 * Count the number of children that are typically specified as
1203
 * `props.children`.
1204
 *
1205
 * See https://reactjs.org/docs/react-api.html#reactchildrencount
1206
 *
1207
 * @param {?*} children Children tree container.
1208
 * @return {number} The number of children.
1209
 */
1210

    
1211

    
1212
function countChildren(children) {
1213
  return traverseAllChildren(children, function () {
1214
    return null;
1215
  }, null);
1216
}
1217
/**
1218
 * Flatten a children object (typically specified as `props.children`) and
1219
 * return an array with appropriately re-keyed children.
1220
 *
1221
 * See https://reactjs.org/docs/react-api.html#reactchildrentoarray
1222
 */
1223

    
1224

    
1225
function toArray(children) {
1226
  var result = [];
1227
  mapIntoWithKeyPrefixInternal(children, result, null, function (child) {
1228
    return child;
1229
  });
1230
  return result;
1231
}
1232
/**
1233
 * Returns the first child in a collection of children and verifies that there
1234
 * is only one child in the collection.
1235
 *
1236
 * See https://reactjs.org/docs/react-api.html#reactchildrenonly
1237
 *
1238
 * The current implementation of this function assumes that a single child gets
1239
 * passed without a wrapper, but the purpose of this helper function is to
1240
 * abstract away the particular structure of children.
1241
 *
1242
 * @param {?object} children Child collection structure.
1243
 * @return {ReactElement} The first and only `ReactElement` contained in the
1244
 * structure.
1245
 */
1246

    
1247

    
1248
function onlyChild(children) {
1249
  if (!isValidElement(children)) {
1250
    {
1251
      throw Error( "React.Children.only expected to receive a single React element child." );
1252
    }
1253
  }
1254

    
1255
  return children;
1256
}
1257

    
1258
function createContext(defaultValue, calculateChangedBits) {
1259
  if (calculateChangedBits === undefined) {
1260
    calculateChangedBits = null;
1261
  } else {
1262
    {
1263
      if (calculateChangedBits !== null && typeof calculateChangedBits !== 'function') {
1264
        error('createContext: Expected the optional second argument to be a ' + 'function. Instead received: %s', calculateChangedBits);
1265
      }
1266
    }
1267
  }
1268

    
1269
  var context = {
1270
    $$typeof: REACT_CONTEXT_TYPE,
1271
    _calculateChangedBits: calculateChangedBits,
1272
    // As a workaround to support multiple concurrent renderers, we categorize
1273
    // some renderers as primary and others as secondary. We only expect
1274
    // there to be two concurrent renderers at most: React Native (primary) and
1275
    // Fabric (secondary); React DOM (primary) and React ART (secondary).
1276
    // Secondary renderers store their context values on separate fields.
1277
    _currentValue: defaultValue,
1278
    _currentValue2: defaultValue,
1279
    // Used to track how many concurrent renderers this context currently
1280
    // supports within in a single renderer. Such as parallel server rendering.
1281
    _threadCount: 0,
1282
    // These are circular
1283
    Provider: null,
1284
    Consumer: null
1285
  };
1286
  context.Provider = {
1287
    $$typeof: REACT_PROVIDER_TYPE,
1288
    _context: context
1289
  };
1290
  var hasWarnedAboutUsingNestedContextConsumers = false;
1291
  var hasWarnedAboutUsingConsumerProvider = false;
1292

    
1293
  {
1294
    // A separate object, but proxies back to the original context object for
1295
    // backwards compatibility. It has a different $$typeof, so we can properly
1296
    // warn for the incorrect usage of Context as a Consumer.
1297
    var Consumer = {
1298
      $$typeof: REACT_CONTEXT_TYPE,
1299
      _context: context,
1300
      _calculateChangedBits: context._calculateChangedBits
1301
    }; // $FlowFixMe: Flow complains about not setting a value, which is intentional here
1302

    
1303
    Object.defineProperties(Consumer, {
1304
      Provider: {
1305
        get: function () {
1306
          if (!hasWarnedAboutUsingConsumerProvider) {
1307
            hasWarnedAboutUsingConsumerProvider = true;
1308

    
1309
            error('Rendering <Context.Consumer.Provider> is not supported and will be removed in ' + 'a future major release. Did you mean to render <Context.Provider> instead?');
1310
          }
1311

    
1312
          return context.Provider;
1313
        },
1314
        set: function (_Provider) {
1315
          context.Provider = _Provider;
1316
        }
1317
      },
1318
      _currentValue: {
1319
        get: function () {
1320
          return context._currentValue;
1321
        },
1322
        set: function (_currentValue) {
1323
          context._currentValue = _currentValue;
1324
        }
1325
      },
1326
      _currentValue2: {
1327
        get: function () {
1328
          return context._currentValue2;
1329
        },
1330
        set: function (_currentValue2) {
1331
          context._currentValue2 = _currentValue2;
1332
        }
1333
      },
1334
      _threadCount: {
1335
        get: function () {
1336
          return context._threadCount;
1337
        },
1338
        set: function (_threadCount) {
1339
          context._threadCount = _threadCount;
1340
        }
1341
      },
1342
      Consumer: {
1343
        get: function () {
1344
          if (!hasWarnedAboutUsingNestedContextConsumers) {
1345
            hasWarnedAboutUsingNestedContextConsumers = true;
1346

    
1347
            error('Rendering <Context.Consumer.Consumer> is not supported and will be removed in ' + 'a future major release. Did you mean to render <Context.Consumer> instead?');
1348
          }
1349

    
1350
          return context.Consumer;
1351
        }
1352
      }
1353
    }); // $FlowFixMe: Flow complains about missing properties because it doesn't understand defineProperty
1354

    
1355
    context.Consumer = Consumer;
1356
  }
1357

    
1358
  {
1359
    context._currentRenderer = null;
1360
    context._currentRenderer2 = null;
1361
  }
1362

    
1363
  return context;
1364
}
1365

    
1366
function lazy(ctor) {
1367
  var lazyType = {
1368
    $$typeof: REACT_LAZY_TYPE,
1369
    _ctor: ctor,
1370
    // React uses these fields to store the result.
1371
    _status: -1,
1372
    _result: null
1373
  };
1374

    
1375
  {
1376
    // In production, this would just set it on the object.
1377
    var defaultProps;
1378
    var propTypes;
1379
    Object.defineProperties(lazyType, {
1380
      defaultProps: {
1381
        configurable: true,
1382
        get: function () {
1383
          return defaultProps;
1384
        },
1385
        set: function (newDefaultProps) {
1386
          error('React.lazy(...): It is not supported to assign `defaultProps` to ' + 'a lazy component import. Either specify them where the component ' + 'is defined, or create a wrapping component around it.');
1387

    
1388
          defaultProps = newDefaultProps; // Match production behavior more closely:
1389

    
1390
          Object.defineProperty(lazyType, 'defaultProps', {
1391
            enumerable: true
1392
          });
1393
        }
1394
      },
1395
      propTypes: {
1396
        configurable: true,
1397
        get: function () {
1398
          return propTypes;
1399
        },
1400
        set: function (newPropTypes) {
1401
          error('React.lazy(...): It is not supported to assign `propTypes` to ' + 'a lazy component import. Either specify them where the component ' + 'is defined, or create a wrapping component around it.');
1402

    
1403
          propTypes = newPropTypes; // Match production behavior more closely:
1404

    
1405
          Object.defineProperty(lazyType, 'propTypes', {
1406
            enumerable: true
1407
          });
1408
        }
1409
      }
1410
    });
1411
  }
1412

    
1413
  return lazyType;
1414
}
1415

    
1416
function forwardRef(render) {
1417
  {
1418
    if (render != null && render.$$typeof === REACT_MEMO_TYPE) {
1419
      error('forwardRef requires a render function but received a `memo` ' + 'component. Instead of forwardRef(memo(...)), use ' + 'memo(forwardRef(...)).');
1420
    } else if (typeof render !== 'function') {
1421
      error('forwardRef requires a render function but was given %s.', render === null ? 'null' : typeof render);
1422
    } else {
1423
      if (render.length !== 0 && render.length !== 2) {
1424
        error('forwardRef render functions accept exactly two parameters: props and ref. %s', render.length === 1 ? 'Did you forget to use the ref parameter?' : 'Any additional parameter will be undefined.');
1425
      }
1426
    }
1427

    
1428
    if (render != null) {
1429
      if (render.defaultProps != null || render.propTypes != null) {
1430
        error('forwardRef render functions do not support propTypes or defaultProps. ' + 'Did you accidentally pass a React component?');
1431
      }
1432
    }
1433
  }
1434

    
1435
  return {
1436
    $$typeof: REACT_FORWARD_REF_TYPE,
1437
    render: render
1438
  };
1439
}
1440

    
1441
function isValidElementType(type) {
1442
  return typeof type === 'string' || typeof type === 'function' || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
1443
  type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE || type.$$typeof === REACT_BLOCK_TYPE);
1444
}
1445

    
1446
function memo(type, compare) {
1447
  {
1448
    if (!isValidElementType(type)) {
1449
      error('memo: The first argument must be a component. Instead ' + 'received: %s', type === null ? 'null' : typeof type);
1450
    }
1451
  }
1452

    
1453
  return {
1454
    $$typeof: REACT_MEMO_TYPE,
1455
    type: type,
1456
    compare: compare === undefined ? null : compare
1457
  };
1458
}
1459

    
1460
function resolveDispatcher() {
1461
  var dispatcher = ReactCurrentDispatcher.current;
1462

    
1463
  if (!(dispatcher !== null)) {
1464
    {
1465
      throw Error( "Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://fb.me/react-invalid-hook-call for tips about how to debug and fix this problem." );
1466
    }
1467
  }
1468

    
1469
  return dispatcher;
1470
}
1471

    
1472
function useContext(Context, unstable_observedBits) {
1473
  var dispatcher = resolveDispatcher();
1474

    
1475
  {
1476
    if (unstable_observedBits !== undefined) {
1477
      error('useContext() second argument is reserved for future ' + 'use in React. Passing it is not supported. ' + 'You passed: %s.%s', unstable_observedBits, typeof unstable_observedBits === 'number' && Array.isArray(arguments[2]) ? '\n\nDid you call array.map(useContext)? ' + 'Calling Hooks inside a loop is not supported. ' + 'Learn more at https://fb.me/rules-of-hooks' : '');
1478
    } // TODO: add a more generic warning for invalid values.
1479

    
1480

    
1481
    if (Context._context !== undefined) {
1482
      var realContext = Context._context; // Don't deduplicate because this legitimately causes bugs
1483
      // and nobody should be using this in existing code.
1484

    
1485
      if (realContext.Consumer === Context) {
1486
        error('Calling useContext(Context.Consumer) is not supported, may cause bugs, and will be ' + 'removed in a future major release. Did you mean to call useContext(Context) instead?');
1487
      } else if (realContext.Provider === Context) {
1488
        error('Calling useContext(Context.Provider) is not supported. ' + 'Did you mean to call useContext(Context) instead?');
1489
      }
1490
    }
1491
  }
1492

    
1493
  return dispatcher.useContext(Context, unstable_observedBits);
1494
}
1495
function useState(initialState) {
1496
  var dispatcher = resolveDispatcher();
1497
  return dispatcher.useState(initialState);
1498
}
1499
function useReducer(reducer, initialArg, init) {
1500
  var dispatcher = resolveDispatcher();
1501
  return dispatcher.useReducer(reducer, initialArg, init);
1502
}
1503
function useRef(initialValue) {
1504
  var dispatcher = resolveDispatcher();
1505
  return dispatcher.useRef(initialValue);
1506
}
1507
function useEffect(create, deps) {
1508
  var dispatcher = resolveDispatcher();
1509
  return dispatcher.useEffect(create, deps);
1510
}
1511
function useLayoutEffect(create, deps) {
1512
  var dispatcher = resolveDispatcher();
1513
  return dispatcher.useLayoutEffect(create, deps);
1514
}
1515
function useCallback(callback, deps) {
1516
  var dispatcher = resolveDispatcher();
1517
  return dispatcher.useCallback(callback, deps);
1518
}
1519
function useMemo(create, deps) {
1520
  var dispatcher = resolveDispatcher();
1521
  return dispatcher.useMemo(create, deps);
1522
}
1523
function useImperativeHandle(ref, create, deps) {
1524
  var dispatcher = resolveDispatcher();
1525
  return dispatcher.useImperativeHandle(ref, create, deps);
1526
}
1527
function useDebugValue(value, formatterFn) {
1528
  {
1529
    var dispatcher = resolveDispatcher();
1530
    return dispatcher.useDebugValue(value, formatterFn);
1531
  }
1532
}
1533

    
1534
var propTypesMisspellWarningShown;
1535

    
1536
{
1537
  propTypesMisspellWarningShown = false;
1538
}
1539

    
1540
function getDeclarationErrorAddendum() {
1541
  if (ReactCurrentOwner.current) {
1542
    var name = getComponentName(ReactCurrentOwner.current.type);
1543

    
1544
    if (name) {
1545
      return '\n\nCheck the render method of `' + name + '`.';
1546
    }
1547
  }
1548

    
1549
  return '';
1550
}
1551

    
1552
function getSourceInfoErrorAddendum(source) {
1553
  if (source !== undefined) {
1554
    var fileName = source.fileName.replace(/^.*[\\\/]/, '');
1555
    var lineNumber = source.lineNumber;
1556
    return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.';
1557
  }
1558

    
1559
  return '';
1560
}
1561

    
1562
function getSourceInfoErrorAddendumForProps(elementProps) {
1563
  if (elementProps !== null && elementProps !== undefined) {
1564
    return getSourceInfoErrorAddendum(elementProps.__source);
1565
  }
1566

    
1567
  return '';
1568
}
1569
/**
1570
 * Warn if there's no key explicitly set on dynamic arrays of children or
1571
 * object keys are not valid. This allows us to keep track of children between
1572
 * updates.
1573
 */
1574

    
1575

    
1576
var ownerHasKeyUseWarning = {};
1577

    
1578
function getCurrentComponentErrorInfo(parentType) {
1579
  var info = getDeclarationErrorAddendum();
1580

    
1581
  if (!info) {
1582
    var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;
1583

    
1584
    if (parentName) {
1585
      info = "\n\nCheck the top-level render call using <" + parentName + ">.";
1586
    }
1587
  }
1588

    
1589
  return info;
1590
}
1591
/**
1592
 * Warn if the element doesn't have an explicit key assigned to it.
1593
 * This element is in an array. The array could grow and shrink or be
1594
 * reordered. All children that haven't already been validated are required to
1595
 * have a "key" property assigned to it. Error statuses are cached so a warning
1596
 * will only be shown once.
1597
 *
1598
 * @internal
1599
 * @param {ReactElement} element Element that requires a key.
1600
 * @param {*} parentType element's parent's type.
1601
 */
1602

    
1603

    
1604
function validateExplicitKey(element, parentType) {
1605
  if (!element._store || element._store.validated || element.key != null) {
1606
    return;
1607
  }
1608

    
1609
  element._store.validated = true;
1610
  var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
1611

    
1612
  if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
1613
    return;
1614
  }
1615

    
1616
  ownerHasKeyUseWarning[currentComponentErrorInfo] = true; // Usually the current owner is the offender, but if it accepts children as a
1617
  // property, it may be the creator of the child that's responsible for
1618
  // assigning it a key.
1619

    
1620
  var childOwner = '';
1621

    
1622
  if (element && element._owner && element._owner !== ReactCurrentOwner.current) {
1623
    // Give the component that originally created this child.
1624
    childOwner = " It was passed a child from " + getComponentName(element._owner.type) + ".";
1625
  }
1626

    
1627
  setCurrentlyValidatingElement(element);
1628

    
1629
  {
1630
    error('Each child in a list should have a unique "key" prop.' + '%s%s See https://fb.me/react-warning-keys for more information.', currentComponentErrorInfo, childOwner);
1631
  }
1632

    
1633
  setCurrentlyValidatingElement(null);
1634
}
1635
/**
1636
 * Ensure that every element either is passed in a static location, in an
1637
 * array with an explicit keys property defined, or in an object literal
1638
 * with valid key property.
1639
 *
1640
 * @internal
1641
 * @param {ReactNode} node Statically passed child of any type.
1642
 * @param {*} parentType node's parent's type.
1643
 */
1644

    
1645

    
1646
function validateChildKeys(node, parentType) {
1647
  if (typeof node !== 'object') {
1648
    return;
1649
  }
1650

    
1651
  if (Array.isArray(node)) {
1652
    for (var i = 0; i < node.length; i++) {
1653
      var child = node[i];
1654

    
1655
      if (isValidElement(child)) {
1656
        validateExplicitKey(child, parentType);
1657
      }
1658
    }
1659
  } else if (isValidElement(node)) {
1660
    // This element was passed in a valid location.
1661
    if (node._store) {
1662
      node._store.validated = true;
1663
    }
1664
  } else if (node) {
1665
    var iteratorFn = getIteratorFn(node);
1666

    
1667
    if (typeof iteratorFn === 'function') {
1668
      // Entry iterators used to provide implicit keys,
1669
      // but now we print a separate warning for them later.
1670
      if (iteratorFn !== node.entries) {
1671
        var iterator = iteratorFn.call(node);
1672
        var step;
1673

    
1674
        while (!(step = iterator.next()).done) {
1675
          if (isValidElement(step.value)) {
1676
            validateExplicitKey(step.value, parentType);
1677
          }
1678
        }
1679
      }
1680
    }
1681
  }
1682
}
1683
/**
1684
 * Given an element, validate that its props follow the propTypes definition,
1685
 * provided by the type.
1686
 *
1687
 * @param {ReactElement} element
1688
 */
1689

    
1690

    
1691
function validatePropTypes(element) {
1692
  {
1693
    var type = element.type;
1694

    
1695
    if (type === null || type === undefined || typeof type === 'string') {
1696
      return;
1697
    }
1698

    
1699
    var name = getComponentName(type);
1700
    var propTypes;
1701

    
1702
    if (typeof type === 'function') {
1703
      propTypes = type.propTypes;
1704
    } else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here.
1705
    // Inner props are checked in the reconciler.
1706
    type.$$typeof === REACT_MEMO_TYPE)) {
1707
      propTypes = type.propTypes;
1708
    } else {
1709
      return;
1710
    }
1711

    
1712
    if (propTypes) {
1713
      setCurrentlyValidatingElement(element);
1714
      checkPropTypes(propTypes, element.props, 'prop', name, ReactDebugCurrentFrame.getStackAddendum);
1715
      setCurrentlyValidatingElement(null);
1716
    } else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {
1717
      propTypesMisspellWarningShown = true;
1718

    
1719
      error('Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', name || 'Unknown');
1720
    }
1721

    
1722
    if (typeof type.getDefaultProps === 'function' && !type.getDefaultProps.isReactClassApproved) {
1723
      error('getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.');
1724
    }
1725
  }
1726
}
1727
/**
1728
 * Given a fragment, validate that it can only be provided with fragment props
1729
 * @param {ReactElement} fragment
1730
 */
1731

    
1732

    
1733
function validateFragmentProps(fragment) {
1734
  {
1735
    setCurrentlyValidatingElement(fragment);
1736
    var keys = Object.keys(fragment.props);
1737

    
1738
    for (var i = 0; i < keys.length; i++) {
1739
      var key = keys[i];
1740

    
1741
      if (key !== 'children' && key !== 'key') {
1742
        error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);
1743

    
1744
        break;
1745
      }
1746
    }
1747

    
1748
    if (fragment.ref !== null) {
1749
      error('Invalid attribute `ref` supplied to `React.Fragment`.');
1750
    }
1751

    
1752
    setCurrentlyValidatingElement(null);
1753
  }
1754
}
1755
function createElementWithValidation(type, props, children) {
1756
  var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to
1757
  // succeed and there will likely be errors in render.
1758

    
1759
  if (!validType) {
1760
    var info = '';
1761

    
1762
    if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
1763
      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.";
1764
    }
1765

    
1766
    var sourceInfo = getSourceInfoErrorAddendumForProps(props);
1767

    
1768
    if (sourceInfo) {
1769
      info += sourceInfo;
1770
    } else {
1771
      info += getDeclarationErrorAddendum();
1772
    }
1773

    
1774
    var typeString;
1775

    
1776
    if (type === null) {
1777
      typeString = 'null';
1778
    } else if (Array.isArray(type)) {
1779
      typeString = 'array';
1780
    } else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {
1781
      typeString = "<" + (getComponentName(type.type) || 'Unknown') + " />";
1782
      info = ' Did you accidentally export a JSX literal instead of a component?';
1783
    } else {
1784
      typeString = typeof type;
1785
    }
1786

    
1787
    {
1788
      error('React.createElement: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', typeString, info);
1789
    }
1790
  }
1791

    
1792
  var element = createElement.apply(this, arguments); // The result can be nullish if a mock or a custom function is used.
1793
  // TODO: Drop this when these are no longer allowed as the type argument.
1794

    
1795
  if (element == null) {
1796
    return element;
1797
  } // Skip key warning if the type isn't valid since our key validation logic
1798
  // doesn't expect a non-string/function type and can throw confusing errors.
1799
  // We don't want exception behavior to differ between dev and prod.
1800
  // (Rendering will throw with a helpful message and as soon as the type is
1801
  // fixed, the key warnings will appear.)
1802

    
1803

    
1804
  if (validType) {
1805
    for (var i = 2; i < arguments.length; i++) {
1806
      validateChildKeys(arguments[i], type);
1807
    }
1808
  }
1809

    
1810
  if (type === REACT_FRAGMENT_TYPE) {
1811
    validateFragmentProps(element);
1812
  } else {
1813
    validatePropTypes(element);
1814
  }
1815

    
1816
  return element;
1817
}
1818
var didWarnAboutDeprecatedCreateFactory = false;
1819
function createFactoryWithValidation(type) {
1820
  var validatedFactory = createElementWithValidation.bind(null, type);
1821
  validatedFactory.type = type;
1822

    
1823
  {
1824
    if (!didWarnAboutDeprecatedCreateFactory) {
1825
      didWarnAboutDeprecatedCreateFactory = true;
1826

    
1827
      warn('React.createFactory() is deprecated and will be removed in ' + 'a future major release. Consider using JSX ' + 'or use React.createElement() directly instead.');
1828
    } // Legacy hook: remove it
1829

    
1830

    
1831
    Object.defineProperty(validatedFactory, 'type', {
1832
      enumerable: false,
1833
      get: function () {
1834
        warn('Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.');
1835

    
1836
        Object.defineProperty(this, 'type', {
1837
          value: type
1838
        });
1839
        return type;
1840
      }
1841
    });
1842
  }
1843

    
1844
  return validatedFactory;
1845
}
1846
function cloneElementWithValidation(element, props, children) {
1847
  var newElement = cloneElement.apply(this, arguments);
1848

    
1849
  for (var i = 2; i < arguments.length; i++) {
1850
    validateChildKeys(arguments[i], newElement.type);
1851
  }
1852

    
1853
  validatePropTypes(newElement);
1854
  return newElement;
1855
}
1856

    
1857
{
1858

    
1859
  try {
1860
    var frozenObject = Object.freeze({});
1861
    var testMap = new Map([[frozenObject, null]]);
1862
    var testSet = new Set([frozenObject]); // This is necessary for Rollup to not consider these unused.
1863
    // https://github.com/rollup/rollup/issues/1771
1864
    // TODO: we can remove these if Rollup fixes the bug.
1865

    
1866
    testMap.set(0, 0);
1867
    testSet.add(0);
1868
  } catch (e) {
1869
  }
1870
}
1871

    
1872
var createElement$1 =  createElementWithValidation ;
1873
var cloneElement$1 =  cloneElementWithValidation ;
1874
var createFactory =  createFactoryWithValidation ;
1875
var Children = {
1876
  map: mapChildren,
1877
  forEach: forEachChildren,
1878
  count: countChildren,
1879
  toArray: toArray,
1880
  only: onlyChild
1881
};
1882

    
1883
exports.Children = Children;
1884
exports.Component = Component;
1885
exports.Fragment = REACT_FRAGMENT_TYPE;
1886
exports.Profiler = REACT_PROFILER_TYPE;
1887
exports.PureComponent = PureComponent;
1888
exports.StrictMode = REACT_STRICT_MODE_TYPE;
1889
exports.Suspense = REACT_SUSPENSE_TYPE;
1890
exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactSharedInternals;
1891
exports.cloneElement = cloneElement$1;
1892
exports.createContext = createContext;
1893
exports.createElement = createElement$1;
1894
exports.createFactory = createFactory;
1895
exports.createRef = createRef;
1896
exports.forwardRef = forwardRef;
1897
exports.isValidElement = isValidElement;
1898
exports.lazy = lazy;
1899
exports.memo = memo;
1900
exports.useCallback = useCallback;
1901
exports.useContext = useContext;
1902
exports.useDebugValue = useDebugValue;
1903
exports.useEffect = useEffect;
1904
exports.useImperativeHandle = useImperativeHandle;
1905
exports.useLayoutEffect = useLayoutEffect;
1906
exports.useMemo = useMemo;
1907
exports.useReducer = useReducer;
1908
exports.useRef = useRef;
1909
exports.useState = useState;
1910
exports.version = ReactVersion;
1911
  })();
1912
}
(1-1/2)