react-split-pane 0.1.87 → 0.1.89

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -1,3 +1,4 @@
1
+ import React from 'react';
1
2
  import PropTypes from 'prop-types';
2
3
  import stylePropType from 'react-style-proptype';
3
4
  import { polyfill } from 'react-lifecycles-compat';
@@ -105,1928 +106,6 @@ function _possibleConstructorReturn(self, call) {
105
106
  return _assertThisInitialized(self);
106
107
  }
107
108
 
108
- function createCommonjsModule(fn, module) {
109
- return module = { exports: {} }, fn(module, module.exports), module.exports;
110
- }
111
-
112
- /*
113
- object-assign
114
- (c) Sindre Sorhus
115
- @license MIT
116
- */
117
- /* eslint-disable no-unused-vars */
118
- var getOwnPropertySymbols = Object.getOwnPropertySymbols;
119
- var hasOwnProperty = Object.prototype.hasOwnProperty;
120
- var propIsEnumerable = Object.prototype.propertyIsEnumerable;
121
-
122
- function toObject(val) {
123
- if (val === null || val === undefined) {
124
- throw new TypeError('Object.assign cannot be called with null or undefined');
125
- }
126
-
127
- return Object(val);
128
- }
129
-
130
- function shouldUseNative() {
131
- try {
132
- if (!Object.assign) {
133
- return false;
134
- }
135
-
136
- // Detect buggy property enumeration order in older V8 versions.
137
-
138
- // https://bugs.chromium.org/p/v8/issues/detail?id=4118
139
- var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
140
- test1[5] = 'de';
141
- if (Object.getOwnPropertyNames(test1)[0] === '5') {
142
- return false;
143
- }
144
-
145
- // https://bugs.chromium.org/p/v8/issues/detail?id=3056
146
- var test2 = {};
147
- for (var i = 0; i < 10; i++) {
148
- test2['_' + String.fromCharCode(i)] = i;
149
- }
150
- var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
151
- return test2[n];
152
- });
153
- if (order2.join('') !== '0123456789') {
154
- return false;
155
- }
156
-
157
- // https://bugs.chromium.org/p/v8/issues/detail?id=3056
158
- var test3 = {};
159
- 'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
160
- test3[letter] = letter;
161
- });
162
- if (Object.keys(Object.assign({}, test3)).join('') !==
163
- 'abcdefghijklmnopqrst') {
164
- return false;
165
- }
166
-
167
- return true;
168
- } catch (err) {
169
- // We don't expect any of the above to throw, but better to be safe.
170
- return false;
171
- }
172
- }
173
-
174
- var objectAssign = shouldUseNative() ? Object.assign : function (target, source) {
175
- var from;
176
- var to = toObject(target);
177
- var symbols;
178
-
179
- for (var s = 1; s < arguments.length; s++) {
180
- from = Object(arguments[s]);
181
-
182
- for (var key in from) {
183
- if (hasOwnProperty.call(from, key)) {
184
- to[key] = from[key];
185
- }
186
- }
187
-
188
- if (getOwnPropertySymbols) {
189
- symbols = getOwnPropertySymbols(from);
190
- for (var i = 0; i < symbols.length; i++) {
191
- if (propIsEnumerable.call(from, symbols[i])) {
192
- to[symbols[i]] = from[symbols[i]];
193
- }
194
- }
195
- }
196
- }
197
-
198
- return to;
199
- };
200
-
201
- var n="function"===typeof Symbol&&Symbol.for,p=n?Symbol.for("react.element"):60103,q=n?Symbol.for("react.portal"):60106,r=n?Symbol.for("react.fragment"):60107,t=n?Symbol.for("react.strict_mode"):60108,u=n?Symbol.for("react.profiler"):60114,v=n?Symbol.for("react.provider"):60109,w=n?Symbol.for("react.context"):60110,x=n?Symbol.for("react.concurrent_mode"):60111,y=n?Symbol.for("react.forward_ref"):60112,z=n?Symbol.for("react.suspense"):60113,A=n?Symbol.for("react.memo"):
202
- 60115,B=n?Symbol.for("react.lazy"):60116,C="function"===typeof Symbol&&Symbol.iterator;function aa(a,b,e,c,d,g,h,f){if(!a){a=void 0;if(void 0===b)a=Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var l=[e,c,d,g,h,f],m=0;a=Error(b.replace(/%s/g,function(){return l[m++]}));a.name="Invariant Violation";}a.framesToPop=1;throw a;}}
203
- function D(a){for(var b=arguments.length-1,e="https://reactjs.org/docs/error-decoder.html?invariant="+a,c=0;c<b;c++)e+="&args[]="+encodeURIComponent(arguments[c+1]);aa(!1,"Minified React error #"+a+"; visit %s for the full message or use the non-minified dev environment for full errors and additional helpful warnings. ",e);}var E={isMounted:function(){return !1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},F={};
204
- function G(a,b,e){this.props=a;this.context=b;this.refs=F;this.updater=e||E;}G.prototype.isReactComponent={};G.prototype.setState=function(a,b){"object"!==typeof a&&"function"!==typeof a&&null!=a?D("85"):void 0;this.updater.enqueueSetState(this,a,b,"setState");};G.prototype.forceUpdate=function(a){this.updater.enqueueForceUpdate(this,a,"forceUpdate");};function H(){}H.prototype=G.prototype;function I(a,b,e){this.props=a;this.context=b;this.refs=F;this.updater=e||E;}var J=I.prototype=new H;
205
- J.constructor=I;objectAssign(J,G.prototype);J.isPureReactComponent=!0;var K={current:null,currentDispatcher:null},L=Object.prototype.hasOwnProperty,M={key:!0,ref:!0,__self:!0,__source:!0};
206
- function N(a,b,e){var c=void 0,d={},g=null,h=null;if(null!=b)for(c in void 0!==b.ref&&(h=b.ref),void 0!==b.key&&(g=""+b.key),b)L.call(b,c)&&!M.hasOwnProperty(c)&&(d[c]=b[c]);var f=arguments.length-2;if(1===f)d.children=e;else if(1<f){for(var l=Array(f),m=0;m<f;m++)l[m]=arguments[m+2];d.children=l;}if(a&&a.defaultProps)for(c in f=a.defaultProps,f)void 0===d[c]&&(d[c]=f[c]);return {$$typeof:p,type:a,key:g,ref:h,props:d,_owner:K.current}}
207
- function ba(a,b){return {$$typeof:p,type:a.type,key:b,ref:a.ref,props:a.props,_owner:a._owner}}function O(a){return "object"===typeof a&&null!==a&&a.$$typeof===p}function escape(a){var b={"=":"=0",":":"=2"};return "$"+(""+a).replace(/[=:]/g,function(a){return b[a]})}var P=/\/+/g,Q=[];function R(a,b,e,c){if(Q.length){var d=Q.pop();d.result=a;d.keyPrefix=b;d.func=e;d.context=c;d.count=0;return d}return {result:a,keyPrefix:b,func:e,context:c,count:0}}
208
- function S(a){a.result=null;a.keyPrefix=null;a.func=null;a.context=null;a.count=0;10>Q.length&&Q.push(a);}
209
- function T(a,b,e,c){var d=typeof a;if("undefined"===d||"boolean"===d)a=null;var g=!1;if(null===a)g=!0;else switch(d){case "string":case "number":g=!0;break;case "object":switch(a.$$typeof){case p:case q:g=!0;}}if(g)return e(c,a,""===b?"."+U(a,0):b),1;g=0;b=""===b?".":b+":";if(Array.isArray(a))for(var h=0;h<a.length;h++){d=a[h];var f=b+U(d,h);g+=T(d,f,e,c);}else if(null===a||"object"!==typeof a?f=null:(f=C&&a[C]||a["@@iterator"],f="function"===typeof f?f:null),"function"===typeof f)for(a=f.call(a),h=
210
- 0;!(d=a.next()).done;)d=d.value,f=b+U(d,h++),g+=T(d,f,e,c);else"object"===d&&(e=""+a,D("31","[object Object]"===e?"object with keys {"+Object.keys(a).join(", ")+"}":e,""));return g}function V(a,b,e){return null==a?0:T(a,"",b,e)}function U(a,b){return "object"===typeof a&&null!==a&&null!=a.key?escape(a.key):b.toString(36)}function ca(a,b){a.func.call(a.context,b,a.count++);}
211
- function da(a,b,e){var c=a.result,d=a.keyPrefix;a=a.func.call(a.context,b,a.count++);Array.isArray(a)?W(a,c,e,function(a){return a}):null!=a&&(O(a)&&(a=ba(a,d+(!a.key||b&&b.key===a.key?"":(""+a.key).replace(P,"$&/")+"/")+e)),c.push(a));}function W(a,b,e,c,d){var g="";null!=e&&(g=(""+e).replace(P,"$&/")+"/");b=R(b,g,c,d);V(a,da,b);S(b);}
212
- var X={Children:{map:function(a,b,e){if(null==a)return a;var c=[];W(a,c,null,b,e);return c},forEach:function(a,b,e){if(null==a)return a;b=R(null,null,b,e);V(a,ca,b);S(b);},count:function(a){return V(a,function(){return null},null)},toArray:function(a){var b=[];W(a,b,null,function(a){return a});return b},only:function(a){O(a)?void 0:D("143");return a}},createRef:function(){return {current:null}},Component:G,PureComponent:I,createContext:function(a,b){void 0===b&&(b=null);a={$$typeof:w,_calculateChangedBits:b,
213
- _currentValue:a,_currentValue2:a,_threadCount:0,Provider:null,Consumer:null};a.Provider={$$typeof:v,_context:a};return a.Consumer=a},forwardRef:function(a){return {$$typeof:y,render:a}},lazy:function(a){return {$$typeof:B,_ctor:a,_status:-1,_result:null}},memo:function(a,b){return {$$typeof:A,type:a,compare:void 0===b?null:b}},Fragment:r,StrictMode:t,Suspense:z,createElement:N,cloneElement:function(a,b,e){null===a||void 0===a?D("267",a):void 0;var c=void 0,d=objectAssign({},a.props),g=a.key,h=a.ref,f=a._owner;
214
- if(null!=b){void 0!==b.ref&&(h=b.ref,f=K.current);void 0!==b.key&&(g=""+b.key);var l=void 0;a.type&&a.type.defaultProps&&(l=a.type.defaultProps);for(c in b)L.call(b,c)&&!M.hasOwnProperty(c)&&(d[c]=void 0===b[c]&&void 0!==l?l[c]:b[c]);}c=arguments.length-2;if(1===c)d.children=e;else if(1<c){l=Array(c);for(var m=0;m<c;m++)l[m]=arguments[m+2];d.children=l;}return {$$typeof:p,type:a.type,key:g,ref:h,props:d,_owner:f}},createFactory:function(a){var b=N.bind(null,a);b.type=a;return b},isValidElement:O,version:"16.6.3",
215
- __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:{ReactCurrentOwner:K,assign:objectAssign}};X.unstable_ConcurrentMode=x;X.unstable_Profiler=u;var Y={default:X},Z=Y&&X||Y;var react_production_min=Z.default||Z;
216
-
217
- /**
218
- * Copyright (c) 2013-present, Facebook, Inc.
219
- *
220
- * This source code is licensed under the MIT license found in the
221
- * LICENSE file in the root directory of this source tree.
222
- */
223
-
224
- var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
225
-
226
- var ReactPropTypesSecret_1 = ReactPropTypesSecret;
227
-
228
- var printWarning = function() {};
229
-
230
- if (process.env.NODE_ENV !== 'production') {
231
- var ReactPropTypesSecret$1 = ReactPropTypesSecret_1;
232
- var loggedTypeFailures = {};
233
-
234
- printWarning = function(text) {
235
- var message = 'Warning: ' + text;
236
- if (typeof console !== 'undefined') {
237
- console.error(message);
238
- }
239
- try {
240
- // --- Welcome to debugging React ---
241
- // This error was thrown as a convenience so that you can use this stack
242
- // to find the callsite that caused this warning to fire.
243
- throw new Error(message);
244
- } catch (x) {}
245
- };
246
- }
247
-
248
- /**
249
- * Assert that the values match with the type specs.
250
- * Error messages are memorized and will only be shown once.
251
- *
252
- * @param {object} typeSpecs Map of name to a ReactPropType
253
- * @param {object} values Runtime values that need to be type-checked
254
- * @param {string} location e.g. "prop", "context", "child context"
255
- * @param {string} componentName Name of the component for error messages.
256
- * @param {?Function} getStack Returns the component stack.
257
- * @private
258
- */
259
- function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
260
- if (process.env.NODE_ENV !== 'production') {
261
- for (var typeSpecName in typeSpecs) {
262
- if (typeSpecs.hasOwnProperty(typeSpecName)) {
263
- var error;
264
- // Prop type validation may throw. In case they do, we don't want to
265
- // fail the render phase where it didn't fail before. So we log it.
266
- // After these have been cleaned up, we'll let them throw.
267
- try {
268
- // This is intentionally an invariant that gets caught. It's the same
269
- // behavior as without this statement except with a better message.
270
- if (typeof typeSpecs[typeSpecName] !== 'function') {
271
- var err = Error(
272
- (componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' +
273
- 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.'
274
- );
275
- err.name = 'Invariant Violation';
276
- throw err;
277
- }
278
- error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret$1);
279
- } catch (ex) {
280
- error = ex;
281
- }
282
- if (error && !(error instanceof Error)) {
283
- printWarning(
284
- (componentName || 'React class') + ': type specification of ' +
285
- location + ' `' + typeSpecName + '` is invalid; the type checker ' +
286
- 'function must return `null` or an `Error` but returned a ' + typeof error + '. ' +
287
- 'You may have forgotten to pass an argument to the type checker ' +
288
- 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' +
289
- 'shape all require an argument).'
290
- );
291
-
292
- }
293
- if (error instanceof Error && !(error.message in loggedTypeFailures)) {
294
- // Only monitor this failure once because there tends to be a lot of the
295
- // same error.
296
- loggedTypeFailures[error.message] = true;
297
-
298
- var stack = getStack ? getStack() : '';
299
-
300
- printWarning(
301
- 'Failed ' + location + ' type: ' + error.message + (stack != null ? stack : '')
302
- );
303
- }
304
- }
305
- }
306
- }
307
- }
308
-
309
- var checkPropTypes_1 = checkPropTypes;
310
-
311
- var react_development = createCommonjsModule(function (module) {
312
-
313
-
314
-
315
- if (process.env.NODE_ENV !== "production") {
316
- (function() {
317
-
318
- var _assign = objectAssign;
319
- var checkPropTypes = checkPropTypes_1;
320
-
321
- // TODO: this is special because it gets imported during build.
322
-
323
- var ReactVersion = '16.6.3';
324
-
325
- // The Symbol used to tag the ReactElement-like types. If there is no native Symbol
326
- // nor polyfill, then a plain number is used for performance.
327
- var hasSymbol = typeof Symbol === 'function' && Symbol.for;
328
-
329
- var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
330
- var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
331
- var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
332
- var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
333
- var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
334
- var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
335
- var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace;
336
-
337
- var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
338
- var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
339
- var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
340
- var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
341
- var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
342
-
343
- var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
344
- var FAUX_ITERATOR_SYMBOL = '@@iterator';
345
-
346
- function getIteratorFn(maybeIterable) {
347
- if (maybeIterable === null || typeof maybeIterable !== 'object') {
348
- return null;
349
- }
350
- var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
351
- if (typeof maybeIterator === 'function') {
352
- return maybeIterator;
353
- }
354
- return null;
355
- }
356
-
357
- /**
358
- * Use invariant() to assert state which your program assumes to be true.
359
- *
360
- * Provide sprintf-style format (only %s is supported) and arguments
361
- * to provide information about what broke and what you were
362
- * expecting.
363
- *
364
- * The invariant message will be stripped in production, but the invariant
365
- * will remain to ensure logic does not differ in production.
366
- */
367
-
368
- var validateFormat = function () {};
369
-
370
- {
371
- validateFormat = function (format) {
372
- if (format === undefined) {
373
- throw new Error('invariant requires an error message argument');
374
- }
375
- };
376
- }
377
-
378
- function invariant(condition, format, a, b, c, d, e, f) {
379
- validateFormat(format);
380
-
381
- if (!condition) {
382
- var error = void 0;
383
- if (format === undefined) {
384
- error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
385
- } else {
386
- var args = [a, b, c, d, e, f];
387
- var argIndex = 0;
388
- error = new Error(format.replace(/%s/g, function () {
389
- return args[argIndex++];
390
- }));
391
- error.name = 'Invariant Violation';
392
- }
393
-
394
- error.framesToPop = 1; // we don't care about invariant's own frame
395
- throw error;
396
- }
397
- }
398
-
399
- // Relying on the `invariant()` implementation lets us
400
- // preserve the format and params in the www builds.
401
-
402
- /**
403
- * Forked from fbjs/warning:
404
- * https://github.com/facebook/fbjs/blob/e66ba20ad5be433eb54423f2b097d829324d9de6/packages/fbjs/src/__forks__/warning.js
405
- *
406
- * Only change is we use console.warn instead of console.error,
407
- * and do nothing when 'console' is not supported.
408
- * This really simplifies the code.
409
- * ---
410
- * Similar to invariant but only logs a warning if the condition is not met.
411
- * This can be used to log issues in development environments in critical
412
- * paths. Removing the logging code for production environments will keep the
413
- * same logic and follow the same code paths.
414
- */
415
-
416
- var lowPriorityWarning = function () {};
417
-
418
- {
419
- var printWarning = function (format) {
420
- for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
421
- args[_key - 1] = arguments[_key];
422
- }
423
-
424
- var argIndex = 0;
425
- var message = 'Warning: ' + format.replace(/%s/g, function () {
426
- return args[argIndex++];
427
- });
428
- if (typeof console !== 'undefined') {
429
- console.warn(message);
430
- }
431
- try {
432
- // --- Welcome to debugging React ---
433
- // This error was thrown as a convenience so that you can use this stack
434
- // to find the callsite that caused this warning to fire.
435
- throw new Error(message);
436
- } catch (x) {}
437
- };
438
-
439
- lowPriorityWarning = function (condition, format) {
440
- if (format === undefined) {
441
- throw new Error('`lowPriorityWarning(condition, format, ...args)` requires a warning ' + 'message argument');
442
- }
443
- if (!condition) {
444
- for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
445
- args[_key2 - 2] = arguments[_key2];
446
- }
447
-
448
- printWarning.apply(undefined, [format].concat(args));
449
- }
450
- };
451
- }
452
-
453
- var lowPriorityWarning$1 = lowPriorityWarning;
454
-
455
- /**
456
- * Similar to invariant but only logs a warning if the condition is not met.
457
- * This can be used to log issues in development environments in critical
458
- * paths. Removing the logging code for production environments will keep the
459
- * same logic and follow the same code paths.
460
- */
461
-
462
- var warningWithoutStack = function () {};
463
-
464
- {
465
- warningWithoutStack = function (condition, format) {
466
- for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
467
- args[_key - 2] = arguments[_key];
468
- }
469
-
470
- if (format === undefined) {
471
- throw new Error('`warningWithoutStack(condition, format, ...args)` requires a warning ' + 'message argument');
472
- }
473
- if (args.length > 8) {
474
- // Check before the condition to catch violations early.
475
- throw new Error('warningWithoutStack() currently supports at most 8 arguments.');
476
- }
477
- if (condition) {
478
- return;
479
- }
480
- if (typeof console !== 'undefined') {
481
- var argsWithFormat = args.map(function (item) {
482
- return '' + item;
483
- });
484
- argsWithFormat.unshift('Warning: ' + format);
485
-
486
- // We intentionally don't use spread (or .apply) directly because it
487
- // breaks IE9: https://github.com/facebook/react/issues/13610
488
- Function.prototype.apply.call(console.error, console, argsWithFormat);
489
- }
490
- try {
491
- // --- Welcome to debugging React ---
492
- // This error was thrown as a convenience so that you can use this stack
493
- // to find the callsite that caused this warning to fire.
494
- var argIndex = 0;
495
- var message = 'Warning: ' + format.replace(/%s/g, function () {
496
- return args[argIndex++];
497
- });
498
- throw new Error(message);
499
- } catch (x) {}
500
- };
501
- }
502
-
503
- var warningWithoutStack$1 = warningWithoutStack;
504
-
505
- var didWarnStateUpdateForUnmountedComponent = {};
506
-
507
- function warnNoop(publicInstance, callerName) {
508
- {
509
- var _constructor = publicInstance.constructor;
510
- var componentName = _constructor && (_constructor.displayName || _constructor.name) || 'ReactClass';
511
- var warningKey = componentName + '.' + callerName;
512
- if (didWarnStateUpdateForUnmountedComponent[warningKey]) {
513
- return;
514
- }
515
- warningWithoutStack$1(false, "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);
516
- didWarnStateUpdateForUnmountedComponent[warningKey] = true;
517
- }
518
- }
519
-
520
- /**
521
- * This is the abstract API for an update queue.
522
- */
523
- var ReactNoopUpdateQueue = {
524
- /**
525
- * Checks whether or not this composite component is mounted.
526
- * @param {ReactClass} publicInstance The instance we want to test.
527
- * @return {boolean} True if mounted, false otherwise.
528
- * @protected
529
- * @final
530
- */
531
- isMounted: function (publicInstance) {
532
- return false;
533
- },
534
-
535
- /**
536
- * Forces an update. This should only be invoked when it is known with
537
- * certainty that we are **not** in a DOM transaction.
538
- *
539
- * You may want to call this when you know that some deeper aspect of the
540
- * component's state has changed but `setState` was not called.
541
- *
542
- * This will not invoke `shouldComponentUpdate`, but it will invoke
543
- * `componentWillUpdate` and `componentDidUpdate`.
544
- *
545
- * @param {ReactClass} publicInstance The instance that should rerender.
546
- * @param {?function} callback Called after component is updated.
547
- * @param {?string} callerName name of the calling function in the public API.
548
- * @internal
549
- */
550
- enqueueForceUpdate: function (publicInstance, callback, callerName) {
551
- warnNoop(publicInstance, 'forceUpdate');
552
- },
553
-
554
- /**
555
- * Replaces all of the state. Always use this or `setState` to mutate state.
556
- * You should treat `this.state` as immutable.
557
- *
558
- * There is no guarantee that `this.state` will be immediately updated, so
559
- * accessing `this.state` after calling this method may return the old value.
560
- *
561
- * @param {ReactClass} publicInstance The instance that should rerender.
562
- * @param {object} completeState Next state.
563
- * @param {?function} callback Called after component is updated.
564
- * @param {?string} callerName name of the calling function in the public API.
565
- * @internal
566
- */
567
- enqueueReplaceState: function (publicInstance, completeState, callback, callerName) {
568
- warnNoop(publicInstance, 'replaceState');
569
- },
570
-
571
- /**
572
- * Sets a subset of the state. This only exists because _pendingState is
573
- * internal. This provides a merging strategy that is not available to deep
574
- * properties which is confusing. TODO: Expose pendingState or don't use it
575
- * during the merge.
576
- *
577
- * @param {ReactClass} publicInstance The instance that should rerender.
578
- * @param {object} partialState Next partial state to be merged with state.
579
- * @param {?function} callback Called after component is updated.
580
- * @param {?string} Name of the calling function in the public API.
581
- * @internal
582
- */
583
- enqueueSetState: function (publicInstance, partialState, callback, callerName) {
584
- warnNoop(publicInstance, 'setState');
585
- }
586
- };
587
-
588
- var emptyObject = {};
589
- {
590
- Object.freeze(emptyObject);
591
- }
592
-
593
- /**
594
- * Base class helpers for the updating state of a component.
595
- */
596
- function Component(props, context, updater) {
597
- this.props = props;
598
- this.context = context;
599
- // If a component has string refs, we will assign a different object later.
600
- this.refs = emptyObject;
601
- // We initialize the default updater but the real one gets injected by the
602
- // renderer.
603
- this.updater = updater || ReactNoopUpdateQueue;
604
- }
605
-
606
- Component.prototype.isReactComponent = {};
607
-
608
- /**
609
- * Sets a subset of the state. Always use this to mutate
610
- * state. You should treat `this.state` as immutable.
611
- *
612
- * There is no guarantee that `this.state` will be immediately updated, so
613
- * accessing `this.state` after calling this method may return the old value.
614
- *
615
- * There is no guarantee that calls to `setState` will run synchronously,
616
- * as they may eventually be batched together. You can provide an optional
617
- * callback that will be executed when the call to setState is actually
618
- * completed.
619
- *
620
- * When a function is provided to setState, it will be called at some point in
621
- * the future (not synchronously). It will be called with the up to date
622
- * component arguments (state, props, context). These values can be different
623
- * from this.* because your function may be called after receiveProps but before
624
- * shouldComponentUpdate, and this new state, props, and context will not yet be
625
- * assigned to this.
626
- *
627
- * @param {object|function} partialState Next partial state or function to
628
- * produce next partial state to be merged with current state.
629
- * @param {?function} callback Called after state is updated.
630
- * @final
631
- * @protected
632
- */
633
- Component.prototype.setState = function (partialState, callback) {
634
- !(typeof partialState === 'object' || typeof partialState === 'function' || partialState == null) ? invariant(false, 'setState(...): takes an object of state variables to update or a function which returns an object of state variables.') : void 0;
635
- this.updater.enqueueSetState(this, partialState, callback, 'setState');
636
- };
637
-
638
- /**
639
- * Forces an update. This should only be invoked when it is known with
640
- * certainty that we are **not** in a DOM transaction.
641
- *
642
- * You may want to call this when you know that some deeper aspect of the
643
- * component's state has changed but `setState` was not called.
644
- *
645
- * This will not invoke `shouldComponentUpdate`, but it will invoke
646
- * `componentWillUpdate` and `componentDidUpdate`.
647
- *
648
- * @param {?function} callback Called after update is complete.
649
- * @final
650
- * @protected
651
- */
652
- Component.prototype.forceUpdate = function (callback) {
653
- this.updater.enqueueForceUpdate(this, callback, 'forceUpdate');
654
- };
655
-
656
- /**
657
- * Deprecated APIs. These APIs used to exist on classic React classes but since
658
- * we would like to deprecate them, we're not going to move them over to this
659
- * modern base class. Instead, we define a getter that warns if it's accessed.
660
- */
661
- {
662
- var deprecatedAPIs = {
663
- isMounted: ['isMounted', 'Instead, make sure to clean up subscriptions and pending requests in ' + 'componentWillUnmount to prevent memory leaks.'],
664
- replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).']
665
- };
666
- var defineDeprecationWarning = function (methodName, info) {
667
- Object.defineProperty(Component.prototype, methodName, {
668
- get: function () {
669
- lowPriorityWarning$1(false, '%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]);
670
- return undefined;
671
- }
672
- });
673
- };
674
- for (var fnName in deprecatedAPIs) {
675
- if (deprecatedAPIs.hasOwnProperty(fnName)) {
676
- defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
677
- }
678
- }
679
- }
680
-
681
- function ComponentDummy() {}
682
- ComponentDummy.prototype = Component.prototype;
683
-
684
- /**
685
- * Convenience component with default shallow equality check for sCU.
686
- */
687
- function PureComponent(props, context, updater) {
688
- this.props = props;
689
- this.context = context;
690
- // If a component has string refs, we will assign a different object later.
691
- this.refs = emptyObject;
692
- this.updater = updater || ReactNoopUpdateQueue;
693
- }
694
-
695
- var pureComponentPrototype = PureComponent.prototype = new ComponentDummy();
696
- pureComponentPrototype.constructor = PureComponent;
697
- // Avoid an extra prototype jump for these methods.
698
- _assign(pureComponentPrototype, Component.prototype);
699
- pureComponentPrototype.isPureReactComponent = true;
700
-
701
- // an immutable object with a single mutable value
702
- function createRef() {
703
- var refObject = {
704
- current: null
705
- };
706
- {
707
- Object.seal(refObject);
708
- }
709
- return refObject;
710
- }
711
-
712
- /**
713
- * Keeps track of the current owner.
714
- *
715
- * The current owner is the component who should own any components that are
716
- * currently being constructed.
717
- */
718
- var ReactCurrentOwner = {
719
- /**
720
- * @internal
721
- * @type {ReactComponent}
722
- */
723
- current: null,
724
- currentDispatcher: null
725
- };
726
-
727
- var BEFORE_SLASH_RE = /^(.*)[\\\/]/;
728
-
729
- var describeComponentFrame = function (name, source, ownerName) {
730
- var sourceInfo = '';
731
- if (source) {
732
- var path = source.fileName;
733
- var fileName = path.replace(BEFORE_SLASH_RE, '');
734
- {
735
- // In DEV, include code for a common special case:
736
- // prefer "folder/index.js" instead of just "index.js".
737
- if (/^index\./.test(fileName)) {
738
- var match = path.match(BEFORE_SLASH_RE);
739
- if (match) {
740
- var pathBeforeSlash = match[1];
741
- if (pathBeforeSlash) {
742
- var folderName = pathBeforeSlash.replace(BEFORE_SLASH_RE, '');
743
- fileName = folderName + '/' + fileName;
744
- }
745
- }
746
- }
747
- }
748
- sourceInfo = ' (at ' + fileName + ':' + source.lineNumber + ')';
749
- } else if (ownerName) {
750
- sourceInfo = ' (created by ' + ownerName + ')';
751
- }
752
- return '\n in ' + (name || 'Unknown') + sourceInfo;
753
- };
754
-
755
- var Resolved = 1;
756
-
757
-
758
- function refineResolvedLazyComponent(lazyComponent) {
759
- return lazyComponent._status === Resolved ? lazyComponent._result : null;
760
- }
761
-
762
- function getWrappedName(outerType, innerType, wrapperName) {
763
- var functionName = innerType.displayName || innerType.name || '';
764
- return outerType.displayName || (functionName !== '' ? wrapperName + '(' + functionName + ')' : wrapperName);
765
- }
766
-
767
- function getComponentName(type) {
768
- if (type == null) {
769
- // Host root, text node or just invalid type.
770
- return null;
771
- }
772
- {
773
- if (typeof type.tag === 'number') {
774
- warningWithoutStack$1(false, 'Received an unexpected object in getComponentName(). ' + 'This is likely a bug in React. Please file an issue.');
775
- }
776
- }
777
- if (typeof type === 'function') {
778
- return type.displayName || type.name || null;
779
- }
780
- if (typeof type === 'string') {
781
- return type;
782
- }
783
- switch (type) {
784
- case REACT_CONCURRENT_MODE_TYPE:
785
- return 'ConcurrentMode';
786
- case REACT_FRAGMENT_TYPE:
787
- return 'Fragment';
788
- case REACT_PORTAL_TYPE:
789
- return 'Portal';
790
- case REACT_PROFILER_TYPE:
791
- return 'Profiler';
792
- case REACT_STRICT_MODE_TYPE:
793
- return 'StrictMode';
794
- case REACT_SUSPENSE_TYPE:
795
- return 'Suspense';
796
- }
797
- if (typeof type === 'object') {
798
- switch (type.$$typeof) {
799
- case REACT_CONTEXT_TYPE:
800
- return 'Context.Consumer';
801
- case REACT_PROVIDER_TYPE:
802
- return 'Context.Provider';
803
- case REACT_FORWARD_REF_TYPE:
804
- return getWrappedName(type, type.render, 'ForwardRef');
805
- case REACT_MEMO_TYPE:
806
- return getComponentName(type.type);
807
- case REACT_LAZY_TYPE:
808
- {
809
- var thenable = type;
810
- var resolvedThenable = refineResolvedLazyComponent(thenable);
811
- if (resolvedThenable) {
812
- return getComponentName(resolvedThenable);
813
- }
814
- }
815
- }
816
- }
817
- return null;
818
- }
819
-
820
- var ReactDebugCurrentFrame = {};
821
-
822
- var currentlyValidatingElement = null;
823
-
824
- function setCurrentlyValidatingElement(element) {
825
- {
826
- currentlyValidatingElement = element;
827
- }
828
- }
829
-
830
- {
831
- // Stack implementation injected by the current renderer.
832
- ReactDebugCurrentFrame.getCurrentStack = null;
833
-
834
- ReactDebugCurrentFrame.getStackAddendum = function () {
835
- var stack = '';
836
-
837
- // Add an extra top frame while an element is being validated
838
- if (currentlyValidatingElement) {
839
- var name = getComponentName(currentlyValidatingElement.type);
840
- var owner = currentlyValidatingElement._owner;
841
- stack += describeComponentFrame(name, currentlyValidatingElement._source, owner && getComponentName(owner.type));
842
- }
843
-
844
- // Delegate to the injected renderer-specific implementation
845
- var impl = ReactDebugCurrentFrame.getCurrentStack;
846
- if (impl) {
847
- stack += impl() || '';
848
- }
849
-
850
- return stack;
851
- };
852
- }
853
-
854
- var ReactSharedInternals = {
855
- ReactCurrentOwner: ReactCurrentOwner,
856
- // Used by renderers to avoid bundling object-assign twice in UMD bundles:
857
- assign: _assign
858
- };
859
-
860
- {
861
- _assign(ReactSharedInternals, {
862
- // These should not be included in production.
863
- ReactDebugCurrentFrame: ReactDebugCurrentFrame,
864
- // Shim for React DOM 16.0.0 which still destructured (but not used) this.
865
- // TODO: remove in React 17.0.
866
- ReactComponentTreeHook: {}
867
- });
868
- }
869
-
870
- /**
871
- * Similar to invariant but only logs a warning if the condition is not met.
872
- * This can be used to log issues in development environments in critical
873
- * paths. Removing the logging code for production environments will keep the
874
- * same logic and follow the same code paths.
875
- */
876
-
877
- var warning = warningWithoutStack$1;
878
-
879
- {
880
- warning = function (condition, format) {
881
- if (condition) {
882
- return;
883
- }
884
- var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
885
- var stack = ReactDebugCurrentFrame.getStackAddendum();
886
- // eslint-disable-next-line react-internal/warning-and-invariant-args
887
-
888
- for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
889
- args[_key - 2] = arguments[_key];
890
- }
891
-
892
- warningWithoutStack$1.apply(undefined, [false, format + '%s'].concat(args, [stack]));
893
- };
894
- }
895
-
896
- var warning$1 = warning;
897
-
898
- var hasOwnProperty = Object.prototype.hasOwnProperty;
899
-
900
- var RESERVED_PROPS = {
901
- key: true,
902
- ref: true,
903
- __self: true,
904
- __source: true
905
- };
906
-
907
- var specialPropKeyWarningShown = void 0;
908
- var specialPropRefWarningShown = void 0;
909
-
910
- function hasValidRef(config) {
911
- {
912
- if (hasOwnProperty.call(config, 'ref')) {
913
- var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;
914
- if (getter && getter.isReactWarning) {
915
- return false;
916
- }
917
- }
918
- }
919
- return config.ref !== undefined;
920
- }
921
-
922
- function hasValidKey(config) {
923
- {
924
- if (hasOwnProperty.call(config, 'key')) {
925
- var getter = Object.getOwnPropertyDescriptor(config, 'key').get;
926
- if (getter && getter.isReactWarning) {
927
- return false;
928
- }
929
- }
930
- }
931
- return config.key !== undefined;
932
- }
933
-
934
- function defineKeyPropWarningGetter(props, displayName) {
935
- var warnAboutAccessingKey = function () {
936
- if (!specialPropKeyWarningShown) {
937
- specialPropKeyWarningShown = true;
938
- warningWithoutStack$1(false, '%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);
939
- }
940
- };
941
- warnAboutAccessingKey.isReactWarning = true;
942
- Object.defineProperty(props, 'key', {
943
- get: warnAboutAccessingKey,
944
- configurable: true
945
- });
946
- }
947
-
948
- function defineRefPropWarningGetter(props, displayName) {
949
- var warnAboutAccessingRef = function () {
950
- if (!specialPropRefWarningShown) {
951
- specialPropRefWarningShown = true;
952
- warningWithoutStack$1(false, '%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);
953
- }
954
- };
955
- warnAboutAccessingRef.isReactWarning = true;
956
- Object.defineProperty(props, 'ref', {
957
- get: warnAboutAccessingRef,
958
- configurable: true
959
- });
960
- }
961
-
962
- /**
963
- * Factory method to create a new React element. This no longer adheres to
964
- * the class pattern, so do not use new to call it. Also, no instanceof check
965
- * will work. Instead test $$typeof field against Symbol.for('react.element') to check
966
- * if something is a React Element.
967
- *
968
- * @param {*} type
969
- * @param {*} key
970
- * @param {string|object} ref
971
- * @param {*} self A *temporary* helper to detect places where `this` is
972
- * different from the `owner` when React.createElement is called, so that we
973
- * can warn. We want to get rid of owner and replace string `ref`s with arrow
974
- * functions, and as long as `this` and owner are the same, there will be no
975
- * change in behavior.
976
- * @param {*} source An annotation object (added by a transpiler or otherwise)
977
- * indicating filename, line number, and/or other information.
978
- * @param {*} owner
979
- * @param {*} props
980
- * @internal
981
- */
982
- var ReactElement = function (type, key, ref, self, source, owner, props) {
983
- var element = {
984
- // This tag allows us to uniquely identify this as a React Element
985
- $$typeof: REACT_ELEMENT_TYPE,
986
-
987
- // Built-in properties that belong on the element
988
- type: type,
989
- key: key,
990
- ref: ref,
991
- props: props,
992
-
993
- // Record the component responsible for creating this element.
994
- _owner: owner
995
- };
996
-
997
- {
998
- // The validation flag is currently mutative. We put it on
999
- // an external backing store so that we can freeze the whole object.
1000
- // This can be replaced with a WeakMap once they are implemented in
1001
- // commonly used development environments.
1002
- element._store = {};
1003
-
1004
- // To make comparing ReactElements easier for testing purposes, we make
1005
- // the validation flag non-enumerable (where possible, which should
1006
- // include every environment we run tests in), so the test framework
1007
- // ignores it.
1008
- Object.defineProperty(element._store, 'validated', {
1009
- configurable: false,
1010
- enumerable: false,
1011
- writable: true,
1012
- value: false
1013
- });
1014
- // self and source are DEV only properties.
1015
- Object.defineProperty(element, '_self', {
1016
- configurable: false,
1017
- enumerable: false,
1018
- writable: false,
1019
- value: self
1020
- });
1021
- // Two elements created in two different places should be considered
1022
- // equal for testing purposes and therefore we hide it from enumeration.
1023
- Object.defineProperty(element, '_source', {
1024
- configurable: false,
1025
- enumerable: false,
1026
- writable: false,
1027
- value: source
1028
- });
1029
- if (Object.freeze) {
1030
- Object.freeze(element.props);
1031
- Object.freeze(element);
1032
- }
1033
- }
1034
-
1035
- return element;
1036
- };
1037
-
1038
- /**
1039
- * Create and return a new ReactElement of the given type.
1040
- * See https://reactjs.org/docs/react-api.html#createelement
1041
- */
1042
- function createElement(type, config, children) {
1043
- var propName = void 0;
1044
-
1045
- // Reserved names are extracted
1046
- var props = {};
1047
-
1048
- var key = null;
1049
- var ref = null;
1050
- var self = null;
1051
- var source = null;
1052
-
1053
- if (config != null) {
1054
- if (hasValidRef(config)) {
1055
- ref = config.ref;
1056
- }
1057
- if (hasValidKey(config)) {
1058
- key = '' + config.key;
1059
- }
1060
-
1061
- self = config.__self === undefined ? null : config.__self;
1062
- source = config.__source === undefined ? null : config.__source;
1063
- // Remaining properties are added to a new props object
1064
- for (propName in config) {
1065
- if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
1066
- props[propName] = config[propName];
1067
- }
1068
- }
1069
- }
1070
-
1071
- // Children can be more than one argument, and those are transferred onto
1072
- // the newly allocated props object.
1073
- var childrenLength = arguments.length - 2;
1074
- if (childrenLength === 1) {
1075
- props.children = children;
1076
- } else if (childrenLength > 1) {
1077
- var childArray = Array(childrenLength);
1078
- for (var i = 0; i < childrenLength; i++) {
1079
- childArray[i] = arguments[i + 2];
1080
- }
1081
- {
1082
- if (Object.freeze) {
1083
- Object.freeze(childArray);
1084
- }
1085
- }
1086
- props.children = childArray;
1087
- }
1088
-
1089
- // Resolve default props
1090
- if (type && type.defaultProps) {
1091
- var defaultProps = type.defaultProps;
1092
- for (propName in defaultProps) {
1093
- if (props[propName] === undefined) {
1094
- props[propName] = defaultProps[propName];
1095
- }
1096
- }
1097
- }
1098
- {
1099
- if (key || ref) {
1100
- var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
1101
- if (key) {
1102
- defineKeyPropWarningGetter(props, displayName);
1103
- }
1104
- if (ref) {
1105
- defineRefPropWarningGetter(props, displayName);
1106
- }
1107
- }
1108
- }
1109
- return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
1110
- }
1111
-
1112
- /**
1113
- * Return a function that produces ReactElements of a given type.
1114
- * See https://reactjs.org/docs/react-api.html#createfactory
1115
- */
1116
-
1117
-
1118
- function cloneAndReplaceKey(oldElement, newKey) {
1119
- var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props);
1120
-
1121
- return newElement;
1122
- }
1123
-
1124
- /**
1125
- * Clone and return a new ReactElement using element as the starting point.
1126
- * See https://reactjs.org/docs/react-api.html#cloneelement
1127
- */
1128
- function cloneElement(element, config, children) {
1129
- !!(element === null || element === undefined) ? invariant(false, 'React.cloneElement(...): The argument must be a React element, but you passed %s.', element) : void 0;
1130
-
1131
- var propName = void 0;
1132
-
1133
- // Original props are copied
1134
- var props = _assign({}, element.props);
1135
-
1136
- // Reserved names are extracted
1137
- var key = element.key;
1138
- var ref = element.ref;
1139
- // Self is preserved since the owner is preserved.
1140
- var self = element._self;
1141
- // Source is preserved since cloneElement is unlikely to be targeted by a
1142
- // transpiler, and the original source is probably a better indicator of the
1143
- // true owner.
1144
- var source = element._source;
1145
-
1146
- // Owner will be preserved, unless ref is overridden
1147
- var owner = element._owner;
1148
-
1149
- if (config != null) {
1150
- if (hasValidRef(config)) {
1151
- // Silently steal the ref from the parent.
1152
- ref = config.ref;
1153
- owner = ReactCurrentOwner.current;
1154
- }
1155
- if (hasValidKey(config)) {
1156
- key = '' + config.key;
1157
- }
1158
-
1159
- // Remaining properties override existing props
1160
- var defaultProps = void 0;
1161
- if (element.type && element.type.defaultProps) {
1162
- defaultProps = element.type.defaultProps;
1163
- }
1164
- for (propName in config) {
1165
- if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
1166
- if (config[propName] === undefined && defaultProps !== undefined) {
1167
- // Resolve default props
1168
- props[propName] = defaultProps[propName];
1169
- } else {
1170
- props[propName] = config[propName];
1171
- }
1172
- }
1173
- }
1174
- }
1175
-
1176
- // Children can be more than one argument, and those are transferred onto
1177
- // the newly allocated props object.
1178
- var childrenLength = arguments.length - 2;
1179
- if (childrenLength === 1) {
1180
- props.children = children;
1181
- } else if (childrenLength > 1) {
1182
- var childArray = Array(childrenLength);
1183
- for (var i = 0; i < childrenLength; i++) {
1184
- childArray[i] = arguments[i + 2];
1185
- }
1186
- props.children = childArray;
1187
- }
1188
-
1189
- return ReactElement(element.type, key, ref, self, source, owner, props);
1190
- }
1191
-
1192
- /**
1193
- * Verifies the object is a ReactElement.
1194
- * See https://reactjs.org/docs/react-api.html#isvalidelement
1195
- * @param {?object} object
1196
- * @return {boolean} True if `object` is a ReactElement.
1197
- * @final
1198
- */
1199
- function isValidElement(object) {
1200
- return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
1201
- }
1202
-
1203
- var SEPARATOR = '.';
1204
- var SUBSEPARATOR = ':';
1205
-
1206
- /**
1207
- * Escape and wrap key so it is safe to use as a reactid
1208
- *
1209
- * @param {string} key to be escaped.
1210
- * @return {string} the escaped key.
1211
- */
1212
- function escape(key) {
1213
- var escapeRegex = /[=:]/g;
1214
- var escaperLookup = {
1215
- '=': '=0',
1216
- ':': '=2'
1217
- };
1218
- var escapedString = ('' + key).replace(escapeRegex, function (match) {
1219
- return escaperLookup[match];
1220
- });
1221
-
1222
- return '$' + escapedString;
1223
- }
1224
-
1225
- /**
1226
- * TODO: Test that a single child and an array with one item have the same key
1227
- * pattern.
1228
- */
1229
-
1230
- var didWarnAboutMaps = false;
1231
-
1232
- var userProvidedKeyEscapeRegex = /\/+/g;
1233
- function escapeUserProvidedKey(text) {
1234
- return ('' + text).replace(userProvidedKeyEscapeRegex, '$&/');
1235
- }
1236
-
1237
- var POOL_SIZE = 10;
1238
- var traverseContextPool = [];
1239
- function getPooledTraverseContext(mapResult, keyPrefix, mapFunction, mapContext) {
1240
- if (traverseContextPool.length) {
1241
- var traverseContext = traverseContextPool.pop();
1242
- traverseContext.result = mapResult;
1243
- traverseContext.keyPrefix = keyPrefix;
1244
- traverseContext.func = mapFunction;
1245
- traverseContext.context = mapContext;
1246
- traverseContext.count = 0;
1247
- return traverseContext;
1248
- } else {
1249
- return {
1250
- result: mapResult,
1251
- keyPrefix: keyPrefix,
1252
- func: mapFunction,
1253
- context: mapContext,
1254
- count: 0
1255
- };
1256
- }
1257
- }
1258
-
1259
- function releaseTraverseContext(traverseContext) {
1260
- traverseContext.result = null;
1261
- traverseContext.keyPrefix = null;
1262
- traverseContext.func = null;
1263
- traverseContext.context = null;
1264
- traverseContext.count = 0;
1265
- if (traverseContextPool.length < POOL_SIZE) {
1266
- traverseContextPool.push(traverseContext);
1267
- }
1268
- }
1269
-
1270
- /**
1271
- * @param {?*} children Children tree container.
1272
- * @param {!string} nameSoFar Name of the key path so far.
1273
- * @param {!function} callback Callback to invoke with each child found.
1274
- * @param {?*} traverseContext Used to pass information throughout the traversal
1275
- * process.
1276
- * @return {!number} The number of children in this subtree.
1277
- */
1278
- function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext) {
1279
- var type = typeof children;
1280
-
1281
- if (type === 'undefined' || type === 'boolean') {
1282
- // All of the above are perceived as null.
1283
- children = null;
1284
- }
1285
-
1286
- var invokeCallback = false;
1287
-
1288
- if (children === null) {
1289
- invokeCallback = true;
1290
- } else {
1291
- switch (type) {
1292
- case 'string':
1293
- case 'number':
1294
- invokeCallback = true;
1295
- break;
1296
- case 'object':
1297
- switch (children.$$typeof) {
1298
- case REACT_ELEMENT_TYPE:
1299
- case REACT_PORTAL_TYPE:
1300
- invokeCallback = true;
1301
- }
1302
- }
1303
- }
1304
-
1305
- if (invokeCallback) {
1306
- callback(traverseContext, children,
1307
- // If it's the only child, treat the name as if it was wrapped in an array
1308
- // so that it's consistent if the number of children grows.
1309
- nameSoFar === '' ? SEPARATOR + getComponentKey(children, 0) : nameSoFar);
1310
- return 1;
1311
- }
1312
-
1313
- var child = void 0;
1314
- var nextName = void 0;
1315
- var subtreeCount = 0; // Count of children found in the current subtree.
1316
- var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR;
1317
-
1318
- if (Array.isArray(children)) {
1319
- for (var i = 0; i < children.length; i++) {
1320
- child = children[i];
1321
- nextName = nextNamePrefix + getComponentKey(child, i);
1322
- subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
1323
- }
1324
- } else {
1325
- var iteratorFn = getIteratorFn(children);
1326
- if (typeof iteratorFn === 'function') {
1327
- {
1328
- // Warn about using Maps as children
1329
- if (iteratorFn === children.entries) {
1330
- !didWarnAboutMaps ? warning$1(false, 'Using Maps as children is unsupported and will likely yield ' + 'unexpected results. Convert it to a sequence/iterable of keyed ' + 'ReactElements instead.') : void 0;
1331
- didWarnAboutMaps = true;
1332
- }
1333
- }
1334
-
1335
- var iterator = iteratorFn.call(children);
1336
- var step = void 0;
1337
- var ii = 0;
1338
- while (!(step = iterator.next()).done) {
1339
- child = step.value;
1340
- nextName = nextNamePrefix + getComponentKey(child, ii++);
1341
- subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
1342
- }
1343
- } else if (type === 'object') {
1344
- var addendum = '';
1345
- {
1346
- addendum = ' If you meant to render a collection of children, use an array ' + 'instead.' + ReactDebugCurrentFrame.getStackAddendum();
1347
- }
1348
- var childrenString = '' + children;
1349
- invariant(false, 'Objects are not valid as a React child (found: %s).%s', childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString, addendum);
1350
- }
1351
- }
1352
-
1353
- return subtreeCount;
1354
- }
1355
-
1356
- /**
1357
- * Traverses children that are typically specified as `props.children`, but
1358
- * might also be specified through attributes:
1359
- *
1360
- * - `traverseAllChildren(this.props.children, ...)`
1361
- * - `traverseAllChildren(this.props.leftPanelChildren, ...)`
1362
- *
1363
- * The `traverseContext` is an optional argument that is passed through the
1364
- * entire traversal. It can be used to store accumulations or anything else that
1365
- * the callback might find relevant.
1366
- *
1367
- * @param {?*} children Children tree object.
1368
- * @param {!function} callback To invoke upon traversing each child.
1369
- * @param {?*} traverseContext Context for traversal.
1370
- * @return {!number} The number of children in this subtree.
1371
- */
1372
- function traverseAllChildren(children, callback, traverseContext) {
1373
- if (children == null) {
1374
- return 0;
1375
- }
1376
-
1377
- return traverseAllChildrenImpl(children, '', callback, traverseContext);
1378
- }
1379
-
1380
- /**
1381
- * Generate a key string that identifies a component within a set.
1382
- *
1383
- * @param {*} component A component that could contain a manual key.
1384
- * @param {number} index Index that is used if a manual key is not provided.
1385
- * @return {string}
1386
- */
1387
- function getComponentKey(component, index) {
1388
- // Do some typechecking here since we call this blindly. We want to ensure
1389
- // that we don't block potential future ES APIs.
1390
- if (typeof component === 'object' && component !== null && component.key != null) {
1391
- // Explicit key
1392
- return escape(component.key);
1393
- }
1394
- // Implicit key determined by the index in the set
1395
- return index.toString(36);
1396
- }
1397
-
1398
- function forEachSingleChild(bookKeeping, child, name) {
1399
- var func = bookKeeping.func,
1400
- context = bookKeeping.context;
1401
-
1402
- func.call(context, child, bookKeeping.count++);
1403
- }
1404
-
1405
- /**
1406
- * Iterates through children that are typically specified as `props.children`.
1407
- *
1408
- * See https://reactjs.org/docs/react-api.html#reactchildrenforeach
1409
- *
1410
- * The provided forEachFunc(child, index) will be called for each
1411
- * leaf child.
1412
- *
1413
- * @param {?*} children Children tree container.
1414
- * @param {function(*, int)} forEachFunc
1415
- * @param {*} forEachContext Context for forEachContext.
1416
- */
1417
- function forEachChildren(children, forEachFunc, forEachContext) {
1418
- if (children == null) {
1419
- return children;
1420
- }
1421
- var traverseContext = getPooledTraverseContext(null, null, forEachFunc, forEachContext);
1422
- traverseAllChildren(children, forEachSingleChild, traverseContext);
1423
- releaseTraverseContext(traverseContext);
1424
- }
1425
-
1426
- function mapSingleChildIntoContext(bookKeeping, child, childKey) {
1427
- var result = bookKeeping.result,
1428
- keyPrefix = bookKeeping.keyPrefix,
1429
- func = bookKeeping.func,
1430
- context = bookKeeping.context;
1431
-
1432
-
1433
- var mappedChild = func.call(context, child, bookKeeping.count++);
1434
- if (Array.isArray(mappedChild)) {
1435
- mapIntoWithKeyPrefixInternal(mappedChild, result, childKey, function (c) {
1436
- return c;
1437
- });
1438
- } else if (mappedChild != null) {
1439
- if (isValidElement(mappedChild)) {
1440
- mappedChild = cloneAndReplaceKey(mappedChild,
1441
- // Keep both the (mapped) and old keys if they differ, just as
1442
- // traverseAllChildren used to do for objects as children
1443
- keyPrefix + (mappedChild.key && (!child || child.key !== mappedChild.key) ? escapeUserProvidedKey(mappedChild.key) + '/' : '') + childKey);
1444
- }
1445
- result.push(mappedChild);
1446
- }
1447
- }
1448
-
1449
- function mapIntoWithKeyPrefixInternal(children, array, prefix, func, context) {
1450
- var escapedPrefix = '';
1451
- if (prefix != null) {
1452
- escapedPrefix = escapeUserProvidedKey(prefix) + '/';
1453
- }
1454
- var traverseContext = getPooledTraverseContext(array, escapedPrefix, func, context);
1455
- traverseAllChildren(children, mapSingleChildIntoContext, traverseContext);
1456
- releaseTraverseContext(traverseContext);
1457
- }
1458
-
1459
- /**
1460
- * Maps children that are typically specified as `props.children`.
1461
- *
1462
- * See https://reactjs.org/docs/react-api.html#reactchildrenmap
1463
- *
1464
- * The provided mapFunction(child, key, index) will be called for each
1465
- * leaf child.
1466
- *
1467
- * @param {?*} children Children tree container.
1468
- * @param {function(*, int)} func The map function.
1469
- * @param {*} context Context for mapFunction.
1470
- * @return {object} Object containing the ordered map of results.
1471
- */
1472
- function mapChildren(children, func, context) {
1473
- if (children == null) {
1474
- return children;
1475
- }
1476
- var result = [];
1477
- mapIntoWithKeyPrefixInternal(children, result, null, func, context);
1478
- return result;
1479
- }
1480
-
1481
- /**
1482
- * Count the number of children that are typically specified as
1483
- * `props.children`.
1484
- *
1485
- * See https://reactjs.org/docs/react-api.html#reactchildrencount
1486
- *
1487
- * @param {?*} children Children tree container.
1488
- * @return {number} The number of children.
1489
- */
1490
- function countChildren(children) {
1491
- return traverseAllChildren(children, function () {
1492
- return null;
1493
- }, null);
1494
- }
1495
-
1496
- /**
1497
- * Flatten a children object (typically specified as `props.children`) and
1498
- * return an array with appropriately re-keyed children.
1499
- *
1500
- * See https://reactjs.org/docs/react-api.html#reactchildrentoarray
1501
- */
1502
- function toArray(children) {
1503
- var result = [];
1504
- mapIntoWithKeyPrefixInternal(children, result, null, function (child) {
1505
- return child;
1506
- });
1507
- return result;
1508
- }
1509
-
1510
- /**
1511
- * Returns the first child in a collection of children and verifies that there
1512
- * is only one child in the collection.
1513
- *
1514
- * See https://reactjs.org/docs/react-api.html#reactchildrenonly
1515
- *
1516
- * The current implementation of this function assumes that a single child gets
1517
- * passed without a wrapper, but the purpose of this helper function is to
1518
- * abstract away the particular structure of children.
1519
- *
1520
- * @param {?object} children Child collection structure.
1521
- * @return {ReactElement} The first and only `ReactElement` contained in the
1522
- * structure.
1523
- */
1524
- function onlyChild(children) {
1525
- !isValidElement(children) ? invariant(false, 'React.Children.only expected to receive a single React element child.') : void 0;
1526
- return children;
1527
- }
1528
-
1529
- function createContext(defaultValue, calculateChangedBits) {
1530
- if (calculateChangedBits === undefined) {
1531
- calculateChangedBits = null;
1532
- } else {
1533
- {
1534
- !(calculateChangedBits === null || typeof calculateChangedBits === 'function') ? warningWithoutStack$1(false, 'createContext: Expected the optional second argument to be a ' + 'function. Instead received: %s', calculateChangedBits) : void 0;
1535
- }
1536
- }
1537
-
1538
- var context = {
1539
- $$typeof: REACT_CONTEXT_TYPE,
1540
- _calculateChangedBits: calculateChangedBits,
1541
- // As a workaround to support multiple concurrent renderers, we categorize
1542
- // some renderers as primary and others as secondary. We only expect
1543
- // there to be two concurrent renderers at most: React Native (primary) and
1544
- // Fabric (secondary); React DOM (primary) and React ART (secondary).
1545
- // Secondary renderers store their context values on separate fields.
1546
- _currentValue: defaultValue,
1547
- _currentValue2: defaultValue,
1548
- // Used to track how many concurrent renderers this context currently
1549
- // supports within in a single renderer. Such as parallel server rendering.
1550
- _threadCount: 0,
1551
- // These are circular
1552
- Provider: null,
1553
- Consumer: null
1554
- };
1555
-
1556
- context.Provider = {
1557
- $$typeof: REACT_PROVIDER_TYPE,
1558
- _context: context
1559
- };
1560
-
1561
- var hasWarnedAboutUsingNestedContextConsumers = false;
1562
- var hasWarnedAboutUsingConsumerProvider = false;
1563
-
1564
- {
1565
- // A separate object, but proxies back to the original context object for
1566
- // backwards compatibility. It has a different $$typeof, so we can properly
1567
- // warn for the incorrect usage of Context as a Consumer.
1568
- var Consumer = {
1569
- $$typeof: REACT_CONTEXT_TYPE,
1570
- _context: context,
1571
- _calculateChangedBits: context._calculateChangedBits
1572
- };
1573
- // $FlowFixMe: Flow complains about not setting a value, which is intentional here
1574
- Object.defineProperties(Consumer, {
1575
- Provider: {
1576
- get: function () {
1577
- if (!hasWarnedAboutUsingConsumerProvider) {
1578
- hasWarnedAboutUsingConsumerProvider = true;
1579
- warning$1(false, 'Rendering <Context.Consumer.Provider> is not supported and will be removed in ' + 'a future major release. Did you mean to render <Context.Provider> instead?');
1580
- }
1581
- return context.Provider;
1582
- },
1583
- set: function (_Provider) {
1584
- context.Provider = _Provider;
1585
- }
1586
- },
1587
- _currentValue: {
1588
- get: function () {
1589
- return context._currentValue;
1590
- },
1591
- set: function (_currentValue) {
1592
- context._currentValue = _currentValue;
1593
- }
1594
- },
1595
- _currentValue2: {
1596
- get: function () {
1597
- return context._currentValue2;
1598
- },
1599
- set: function (_currentValue2) {
1600
- context._currentValue2 = _currentValue2;
1601
- }
1602
- },
1603
- _threadCount: {
1604
- get: function () {
1605
- return context._threadCount;
1606
- },
1607
- set: function (_threadCount) {
1608
- context._threadCount = _threadCount;
1609
- }
1610
- },
1611
- Consumer: {
1612
- get: function () {
1613
- if (!hasWarnedAboutUsingNestedContextConsumers) {
1614
- hasWarnedAboutUsingNestedContextConsumers = true;
1615
- warning$1(false, 'Rendering <Context.Consumer.Consumer> is not supported and will be removed in ' + 'a future major release. Did you mean to render <Context.Consumer> instead?');
1616
- }
1617
- return context.Consumer;
1618
- }
1619
- }
1620
- });
1621
- // $FlowFixMe: Flow complains about missing properties because it doesn't understand defineProperty
1622
- context.Consumer = Consumer;
1623
- }
1624
-
1625
- {
1626
- context._currentRenderer = null;
1627
- context._currentRenderer2 = null;
1628
- }
1629
-
1630
- return context;
1631
- }
1632
-
1633
- function lazy(ctor) {
1634
- return {
1635
- $$typeof: REACT_LAZY_TYPE,
1636
- _ctor: ctor,
1637
- // React uses these fields to store the result.
1638
- _status: -1,
1639
- _result: null
1640
- };
1641
- }
1642
-
1643
- function forwardRef(render) {
1644
- {
1645
- if (render != null && render.$$typeof === REACT_MEMO_TYPE) {
1646
- warningWithoutStack$1(false, 'forwardRef requires a render function but received a `memo` ' + 'component. Instead of forwardRef(memo(...)), use ' + 'memo(forwardRef(...)).');
1647
- } else if (typeof render !== 'function') {
1648
- warningWithoutStack$1(false, 'forwardRef requires a render function but was given %s.', render === null ? 'null' : typeof render);
1649
- } else {
1650
- !(
1651
- // Do not warn for 0 arguments because it could be due to usage of the 'arguments' object
1652
- render.length === 0 || render.length === 2) ? warningWithoutStack$1(false, '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.') : void 0;
1653
- }
1654
-
1655
- if (render != null) {
1656
- !(render.defaultProps == null && render.propTypes == null) ? warningWithoutStack$1(false, 'forwardRef render functions do not support propTypes or defaultProps. ' + 'Did you accidentally pass a React component?') : void 0;
1657
- }
1658
- }
1659
-
1660
- return {
1661
- $$typeof: REACT_FORWARD_REF_TYPE,
1662
- render: render
1663
- };
1664
- }
1665
-
1666
- function isValidElementType(type) {
1667
- return typeof type === 'string' || typeof type === 'function' ||
1668
- // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
1669
- type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_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);
1670
- }
1671
-
1672
- function memo(type, compare) {
1673
- {
1674
- if (!isValidElementType(type)) {
1675
- warningWithoutStack$1(false, 'memo: The first argument must be a component. Instead ' + 'received: %s', type === null ? 'null' : typeof type);
1676
- }
1677
- }
1678
- return {
1679
- $$typeof: REACT_MEMO_TYPE,
1680
- type: type,
1681
- compare: compare === undefined ? null : compare
1682
- };
1683
- }
1684
-
1685
- /**
1686
- * ReactElementValidator provides a wrapper around a element factory
1687
- * which validates the props passed to the element. This is intended to be
1688
- * used only in DEV and could be replaced by a static type checker for languages
1689
- * that support it.
1690
- */
1691
-
1692
- var propTypesMisspellWarningShown = void 0;
1693
-
1694
- {
1695
- propTypesMisspellWarningShown = false;
1696
- }
1697
-
1698
- function getDeclarationErrorAddendum() {
1699
- if (ReactCurrentOwner.current) {
1700
- var name = getComponentName(ReactCurrentOwner.current.type);
1701
- if (name) {
1702
- return '\n\nCheck the render method of `' + name + '`.';
1703
- }
1704
- }
1705
- return '';
1706
- }
1707
-
1708
- function getSourceInfoErrorAddendum(elementProps) {
1709
- if (elementProps !== null && elementProps !== undefined && elementProps.__source !== undefined) {
1710
- var source = elementProps.__source;
1711
- var fileName = source.fileName.replace(/^.*[\\\/]/, '');
1712
- var lineNumber = source.lineNumber;
1713
- return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.';
1714
- }
1715
- return '';
1716
- }
1717
-
1718
- /**
1719
- * Warn if there's no key explicitly set on dynamic arrays of children or
1720
- * object keys are not valid. This allows us to keep track of children between
1721
- * updates.
1722
- */
1723
- var ownerHasKeyUseWarning = {};
1724
-
1725
- function getCurrentComponentErrorInfo(parentType) {
1726
- var info = getDeclarationErrorAddendum();
1727
-
1728
- if (!info) {
1729
- var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;
1730
- if (parentName) {
1731
- info = '\n\nCheck the top-level render call using <' + parentName + '>.';
1732
- }
1733
- }
1734
- return info;
1735
- }
1736
-
1737
- /**
1738
- * Warn if the element doesn't have an explicit key assigned to it.
1739
- * This element is in an array. The array could grow and shrink or be
1740
- * reordered. All children that haven't already been validated are required to
1741
- * have a "key" property assigned to it. Error statuses are cached so a warning
1742
- * will only be shown once.
1743
- *
1744
- * @internal
1745
- * @param {ReactElement} element Element that requires a key.
1746
- * @param {*} parentType element's parent's type.
1747
- */
1748
- function validateExplicitKey(element, parentType) {
1749
- if (!element._store || element._store.validated || element.key != null) {
1750
- return;
1751
- }
1752
- element._store.validated = true;
1753
-
1754
- var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
1755
- if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
1756
- return;
1757
- }
1758
- ownerHasKeyUseWarning[currentComponentErrorInfo] = true;
1759
-
1760
- // Usually the current owner is the offender, but if it accepts children as a
1761
- // property, it may be the creator of the child that's responsible for
1762
- // assigning it a key.
1763
- var childOwner = '';
1764
- if (element && element._owner && element._owner !== ReactCurrentOwner.current) {
1765
- // Give the component that originally created this child.
1766
- childOwner = ' It was passed a child from ' + getComponentName(element._owner.type) + '.';
1767
- }
1768
-
1769
- setCurrentlyValidatingElement(element);
1770
- {
1771
- warning$1(false, 'Each child in an array or iterator should have a unique "key" prop.' + '%s%s See https://fb.me/react-warning-keys for more information.', currentComponentErrorInfo, childOwner);
1772
- }
1773
- setCurrentlyValidatingElement(null);
1774
- }
1775
-
1776
- /**
1777
- * Ensure that every element either is passed in a static location, in an
1778
- * array with an explicit keys property defined, or in an object literal
1779
- * with valid key property.
1780
- *
1781
- * @internal
1782
- * @param {ReactNode} node Statically passed child of any type.
1783
- * @param {*} parentType node's parent's type.
1784
- */
1785
- function validateChildKeys(node, parentType) {
1786
- if (typeof node !== 'object') {
1787
- return;
1788
- }
1789
- if (Array.isArray(node)) {
1790
- for (var i = 0; i < node.length; i++) {
1791
- var child = node[i];
1792
- if (isValidElement(child)) {
1793
- validateExplicitKey(child, parentType);
1794
- }
1795
- }
1796
- } else if (isValidElement(node)) {
1797
- // This element was passed in a valid location.
1798
- if (node._store) {
1799
- node._store.validated = true;
1800
- }
1801
- } else if (node) {
1802
- var iteratorFn = getIteratorFn(node);
1803
- if (typeof iteratorFn === 'function') {
1804
- // Entry iterators used to provide implicit keys,
1805
- // but now we print a separate warning for them later.
1806
- if (iteratorFn !== node.entries) {
1807
- var iterator = iteratorFn.call(node);
1808
- var step = void 0;
1809
- while (!(step = iterator.next()).done) {
1810
- if (isValidElement(step.value)) {
1811
- validateExplicitKey(step.value, parentType);
1812
- }
1813
- }
1814
- }
1815
- }
1816
- }
1817
- }
1818
-
1819
- /**
1820
- * Given an element, validate that its props follow the propTypes definition,
1821
- * provided by the type.
1822
- *
1823
- * @param {ReactElement} element
1824
- */
1825
- function validatePropTypes(element) {
1826
- var type = element.type;
1827
- var name = void 0,
1828
- propTypes = void 0;
1829
- if (typeof type === 'function') {
1830
- // Class or function component
1831
- name = type.displayName || type.name;
1832
- propTypes = type.propTypes;
1833
- } else if (typeof type === 'object' && type !== null && type.$$typeof === REACT_FORWARD_REF_TYPE) {
1834
- // ForwardRef
1835
- var functionName = type.render.displayName || type.render.name || '';
1836
- name = type.displayName || (functionName !== '' ? 'ForwardRef(' + functionName + ')' : 'ForwardRef');
1837
- propTypes = type.propTypes;
1838
- } else {
1839
- return;
1840
- }
1841
- if (propTypes) {
1842
- setCurrentlyValidatingElement(element);
1843
- checkPropTypes(propTypes, element.props, 'prop', name, ReactDebugCurrentFrame.getStackAddendum);
1844
- setCurrentlyValidatingElement(null);
1845
- } else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {
1846
- propTypesMisspellWarningShown = true;
1847
- warningWithoutStack$1(false, 'Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', name || 'Unknown');
1848
- }
1849
- if (typeof type.getDefaultProps === 'function') {
1850
- !type.getDefaultProps.isReactClassApproved ? warningWithoutStack$1(false, 'getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.') : void 0;
1851
- }
1852
- }
1853
-
1854
- /**
1855
- * Given a fragment, validate that it can only be provided with fragment props
1856
- * @param {ReactElement} fragment
1857
- */
1858
- function validateFragmentProps(fragment) {
1859
- setCurrentlyValidatingElement(fragment);
1860
-
1861
- var keys = Object.keys(fragment.props);
1862
- for (var i = 0; i < keys.length; i++) {
1863
- var key = keys[i];
1864
- if (key !== 'children' && key !== 'key') {
1865
- warning$1(false, 'Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);
1866
- break;
1867
- }
1868
- }
1869
-
1870
- if (fragment.ref !== null) {
1871
- warning$1(false, 'Invalid attribute `ref` supplied to `React.Fragment`.');
1872
- }
1873
-
1874
- setCurrentlyValidatingElement(null);
1875
- }
1876
-
1877
- function createElementWithValidation(type, props, children) {
1878
- var validType = isValidElementType(type);
1879
-
1880
- // We warn in this case but don't throw. We expect the element creation to
1881
- // succeed and there will likely be errors in render.
1882
- if (!validType) {
1883
- var info = '';
1884
- if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
1885
- 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.";
1886
- }
1887
-
1888
- var sourceInfo = getSourceInfoErrorAddendum(props);
1889
- if (sourceInfo) {
1890
- info += sourceInfo;
1891
- } else {
1892
- info += getDeclarationErrorAddendum();
1893
- }
1894
-
1895
- var typeString = void 0;
1896
- if (type === null) {
1897
- typeString = 'null';
1898
- } else if (Array.isArray(type)) {
1899
- typeString = 'array';
1900
- } else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {
1901
- typeString = '<' + (getComponentName(type.type) || 'Unknown') + ' />';
1902
- info = ' Did you accidentally export a JSX literal instead of a component?';
1903
- } else {
1904
- typeString = typeof type;
1905
- }
1906
-
1907
- warning$1(false, '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);
1908
- }
1909
-
1910
- var element = createElement.apply(this, arguments);
1911
-
1912
- // The result can be nullish if a mock or a custom function is used.
1913
- // TODO: Drop this when these are no longer allowed as the type argument.
1914
- if (element == null) {
1915
- return element;
1916
- }
1917
-
1918
- // Skip key warning if the type isn't valid since our key validation logic
1919
- // doesn't expect a non-string/function type and can throw confusing errors.
1920
- // We don't want exception behavior to differ between dev and prod.
1921
- // (Rendering will throw with a helpful message and as soon as the type is
1922
- // fixed, the key warnings will appear.)
1923
- if (validType) {
1924
- for (var i = 2; i < arguments.length; i++) {
1925
- validateChildKeys(arguments[i], type);
1926
- }
1927
- }
1928
-
1929
- if (type === REACT_FRAGMENT_TYPE) {
1930
- validateFragmentProps(element);
1931
- } else {
1932
- validatePropTypes(element);
1933
- }
1934
-
1935
- return element;
1936
- }
1937
-
1938
- function createFactoryWithValidation(type) {
1939
- var validatedFactory = createElementWithValidation.bind(null, type);
1940
- validatedFactory.type = type;
1941
- // Legacy hook: remove it
1942
- {
1943
- Object.defineProperty(validatedFactory, 'type', {
1944
- enumerable: false,
1945
- get: function () {
1946
- lowPriorityWarning$1(false, 'Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.');
1947
- Object.defineProperty(this, 'type', {
1948
- value: type
1949
- });
1950
- return type;
1951
- }
1952
- });
1953
- }
1954
-
1955
- return validatedFactory;
1956
- }
1957
-
1958
- function cloneElementWithValidation(element, props, children) {
1959
- var newElement = cloneElement.apply(this, arguments);
1960
- for (var i = 2; i < arguments.length; i++) {
1961
- validateChildKeys(arguments[i], newElement.type);
1962
- }
1963
- validatePropTypes(newElement);
1964
- return newElement;
1965
- }
1966
-
1967
- var React = {
1968
- Children: {
1969
- map: mapChildren,
1970
- forEach: forEachChildren,
1971
- count: countChildren,
1972
- toArray: toArray,
1973
- only: onlyChild
1974
- },
1975
-
1976
- createRef: createRef,
1977
- Component: Component,
1978
- PureComponent: PureComponent,
1979
-
1980
- createContext: createContext,
1981
- forwardRef: forwardRef,
1982
- lazy: lazy,
1983
- memo: memo,
1984
-
1985
- Fragment: REACT_FRAGMENT_TYPE,
1986
- StrictMode: REACT_STRICT_MODE_TYPE,
1987
- Suspense: REACT_SUSPENSE_TYPE,
1988
-
1989
- createElement: createElementWithValidation,
1990
- cloneElement: cloneElementWithValidation,
1991
- createFactory: createFactoryWithValidation,
1992
- isValidElement: isValidElement,
1993
-
1994
- version: ReactVersion,
1995
-
1996
- __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: ReactSharedInternals
1997
- };
1998
-
1999
- {
2000
- React.unstable_ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
2001
- React.unstable_Profiler = REACT_PROFILER_TYPE;
2002
- }
2003
-
2004
-
2005
-
2006
- var React$2 = Object.freeze({
2007
- default: React
2008
- });
2009
-
2010
- var React$3 = ( React$2 && React ) || React$2;
2011
-
2012
- // TODO: decide on the top-level export form.
2013
- // This is hacky but makes it work with both Rollup and Jest.
2014
- var react = React$3.default || React$3;
2015
-
2016
- module.exports = react;
2017
- })();
2018
- }
2019
- });
2020
-
2021
- var react = createCommonjsModule(function (module) {
2022
-
2023
- if (process.env.NODE_ENV === 'production') {
2024
- module.exports = react_production_min;
2025
- } else {
2026
- module.exports = react_development;
2027
- }
2028
- });
2029
-
2030
109
  var Pane =
2031
110
  /*#__PURE__*/
2032
111
  function (_React$PureComponent) {
@@ -2049,11 +128,11 @@ function (_React$PureComponent) {
2049
128
  size = _this$props.size,
2050
129
  eleRef = _this$props.eleRef;
2051
130
  var classes = ['Pane', split, className];
2052
- var style = Object.assign({}, styleProps || {}, {
131
+ var style = {
2053
132
  flex: 1,
2054
133
  position: 'relative',
2055
134
  outline: 'none'
2056
- });
135
+ };
2057
136
 
2058
137
  if (size !== undefined) {
2059
138
  if (split === 'vertical') {
@@ -2066,7 +145,8 @@ function (_React$PureComponent) {
2066
145
  style.flex = 'none';
2067
146
  }
2068
147
 
2069
- return react.createElement("div", {
148
+ style = Object.assign({}, style, styleProps || {});
149
+ return React.createElement("div", {
2070
150
  ref: eleRef,
2071
151
  className: classes.join(' '),
2072
152
  style: style
@@ -2075,7 +155,7 @@ function (_React$PureComponent) {
2075
155
  }]);
2076
156
 
2077
157
  return Pane;
2078
- }(react.PureComponent);
158
+ }(React.PureComponent);
2079
159
 
2080
160
  Pane.propTypes = {
2081
161
  className: PropTypes.string.isRequired,
@@ -2114,7 +194,7 @@ function (_React$Component) {
2114
194
  split = _this$props.split,
2115
195
  style = _this$props.style;
2116
196
  var classes = [resizerClassName, split, className];
2117
- return react.createElement("span", {
197
+ return React.createElement("span", {
2118
198
  role: "presentation",
2119
199
  className: classes.join(' '),
2120
200
  style: style,
@@ -2150,7 +230,7 @@ function (_React$Component) {
2150
230
  }]);
2151
231
 
2152
232
  return Resizer;
2153
- }(react.Component);
233
+ }(React.Component);
2154
234
 
2155
235
  Resizer.propTypes = {
2156
236
  className: PropTypes.string.isRequired,
@@ -2192,7 +272,7 @@ function getDefaultSize(defaultSize, minSize, maxSize, draggedSize) {
2192
272
  }
2193
273
 
2194
274
  function removeNullChildren(children) {
2195
- return react.Children.toArray(children).filter(function (c) {
275
+ return React.Children.toArray(children).filter(function (c) {
2196
276
  return c;
2197
277
  });
2198
278
  }
@@ -2463,13 +543,13 @@ function (_React$Component) {
2463
543
 
2464
544
  var pane1Classes = ['Pane1', paneClassName, pane1ClassName].join(' ');
2465
545
  var pane2Classes = ['Pane2', paneClassName, pane2ClassName].join(' ');
2466
- return react.createElement("div", {
546
+ return React.createElement("div", {
2467
547
  className: classes.join(' '),
2468
548
  ref: function ref(node) {
2469
549
  _this2.splitPane = node;
2470
550
  },
2471
551
  style: style
2472
- }, react.createElement(Pane, {
552
+ }, React.createElement(Pane, {
2473
553
  className: pane1Classes,
2474
554
  key: "pane1",
2475
555
  eleRef: function eleRef(node) {
@@ -2478,7 +558,7 @@ function (_React$Component) {
2478
558
  size: pane1Size,
2479
559
  split: split,
2480
560
  style: pane1Style
2481
- }, notNullChildren[0]), react.createElement(Resizer, {
561
+ }, notNullChildren[0]), React.createElement(Resizer, {
2482
562
  className: disabledClass,
2483
563
  onClick: onResizerClick,
2484
564
  onDoubleClick: onResizerDoubleClick,
@@ -2489,7 +569,7 @@ function (_React$Component) {
2489
569
  resizerClassName: resizerClassNamesIncludingDefault,
2490
570
  split: split,
2491
571
  style: resizerStyle || {}
2492
- }), react.createElement(Pane, {
572
+ }), React.createElement(Pane, {
2493
573
  className: pane2Classes,
2494
574
  key: "pane2",
2495
575
  eleRef: function eleRef(node) {
@@ -2532,7 +612,7 @@ function (_React$Component) {
2532
612
  }]);
2533
613
 
2534
614
  return SplitPane;
2535
- }(react.Component);
615
+ }(React.Component);
2536
616
 
2537
617
  SplitPane.propTypes = {
2538
618
  allowResize: PropTypes.bool,
@@ -2573,3 +653,4 @@ SplitPane.defaultProps = {
2573
653
  polyfill(SplitPane);
2574
654
 
2575
655
  export default SplitPane;
656
+ export { Pane };