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