UNPKG

161 kBJavaScriptView Raw
1import ReactFiberReconciler from 'react-reconciler';
2
3var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
4
5function createCommonjsModule(fn, module) {
6 return module = { exports: {} }, fn(module, module.exports), module.exports;
7}
8
9/*
10object-assign
11(c) Sindre Sorhus
12@license MIT
13*/
14/* eslint-disable no-unused-vars */
15var getOwnPropertySymbols = Object.getOwnPropertySymbols;
16var hasOwnProperty = Object.prototype.hasOwnProperty;
17var propIsEnumerable = Object.prototype.propertyIsEnumerable;
18
19function toObject(val) {
20 if (val === null || val === undefined) {
21 throw new TypeError('Object.assign cannot be called with null or undefined');
22 }
23
24 return Object(val);
25}
26
27function shouldUseNative() {
28 try {
29 if (!Object.assign) {
30 return false;
31 }
32
33 // Detect buggy property enumeration order in older V8 versions.
34
35 // https://bugs.chromium.org/p/v8/issues/detail?id=4118
36 var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
37 test1[5] = 'de';
38 if (Object.getOwnPropertyNames(test1)[0] === '5') {
39 return false;
40 }
41
42 // https://bugs.chromium.org/p/v8/issues/detail?id=3056
43 var test2 = {};
44 for (var i = 0; i < 10; i++) {
45 test2['_' + String.fromCharCode(i)] = i;
46 }
47 var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
48 return test2[n];
49 });
50 if (order2.join('') !== '0123456789') {
51 return false;
52 }
53
54 // https://bugs.chromium.org/p/v8/issues/detail?id=3056
55 var test3 = {};
56 'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
57 test3[letter] = letter;
58 });
59 if (Object.keys(Object.assign({}, test3)).join('') !==
60 'abcdefghijklmnopqrst') {
61 return false;
62 }
63
64 return true;
65 } catch (err) {
66 // We don't expect any of the above to throw, but better to be safe.
67 return false;
68 }
69}
70
71var objectAssign = shouldUseNative() ? Object.assign : function (target, source) {
72 var from;
73 var to = toObject(target);
74 var symbols;
75
76 for (var s = 1; s < arguments.length; s++) {
77 from = Object(arguments[s]);
78
79 for (var key in from) {
80 if (hasOwnProperty.call(from, key)) {
81 to[key] = from[key];
82 }
83 }
84
85 if (getOwnPropertySymbols) {
86 symbols = getOwnPropertySymbols(from);
87 for (var i = 0; i < symbols.length; i++) {
88 if (propIsEnumerable.call(from, symbols[i])) {
89 to[symbols[i]] = from[symbols[i]];
90 }
91 }
92 }
93 }
94
95 return to;
96};
97
98var react_production_min = createCommonjsModule(function (module, exports) {
99var n=60103,p=60106;exports.Fragment=60107;exports.StrictMode=60108;exports.Profiler=60114;var q=60109,r=60110,t=60112;exports.Suspense=60113;var u=60115,v=60116;
100if("function"===typeof Symbol&&Symbol.for){var w=Symbol.for;n=w("react.element");p=w("react.portal");exports.Fragment=w("react.fragment");exports.StrictMode=w("react.strict_mode");exports.Profiler=w("react.profiler");q=w("react.provider");r=w("react.context");t=w("react.forward_ref");exports.Suspense=w("react.suspense");u=w("react.memo");v=w("react.lazy");}var x="function"===typeof Symbol&&Symbol.iterator;
101function y(a){if(null===a||"object"!==typeof a)return null;a=x&&a[x]||a["@@iterator"];return "function"===typeof a?a:null}function z(a){for(var b="https://reactjs.org/docs/error-decoder.html?invariant="+a,c=1;c<arguments.length;c++)b+="&args[]="+encodeURIComponent(arguments[c]);return "Minified React error #"+a+"; visit "+b+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}
102var A={isMounted:function(){return !1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},B={};function C(a,b,c){this.props=a;this.context=b;this.refs=B;this.updater=c||A;}C.prototype.isReactComponent={};C.prototype.setState=function(a,b){if("object"!==typeof a&&"function"!==typeof a&&null!=a)throw Error(z(85));this.updater.enqueueSetState(this,a,b,"setState");};C.prototype.forceUpdate=function(a){this.updater.enqueueForceUpdate(this,a,"forceUpdate");};
103function D(){}D.prototype=C.prototype;function E(a,b,c){this.props=a;this.context=b;this.refs=B;this.updater=c||A;}var F=E.prototype=new D;F.constructor=E;objectAssign(F,C.prototype);F.isPureReactComponent=!0;var G={current:null},H=Object.prototype.hasOwnProperty,I={key:!0,ref:!0,__self:!0,__source:!0};
104function J(a,b,c){var e,d={},k=null,h=null;if(null!=b)for(e in void 0!==b.ref&&(h=b.ref),void 0!==b.key&&(k=""+b.key),b)H.call(b,e)&&!I.hasOwnProperty(e)&&(d[e]=b[e]);var g=arguments.length-2;if(1===g)d.children=c;else if(1<g){for(var f=Array(g),m=0;m<g;m++)f[m]=arguments[m+2];d.children=f;}if(a&&a.defaultProps)for(e in g=a.defaultProps,g)void 0===d[e]&&(d[e]=g[e]);return {$$typeof:n,type:a,key:k,ref:h,props:d,_owner:G.current}}
105function K(a,b){return {$$typeof:n,type:a.type,key:b,ref:a.ref,props:a.props,_owner:a._owner}}function L(a){return "object"===typeof a&&null!==a&&a.$$typeof===n}function escape(a){var b={"=":"=0",":":"=2"};return "$"+a.replace(/[=:]/g,function(a){return b[a]})}var M=/\/+/g;function N(a,b){return "object"===typeof a&&null!==a&&null!=a.key?escape(""+a.key):b.toString(36)}
106function O(a,b,c,e,d){var k=typeof a;if("undefined"===k||"boolean"===k)a=null;var h=!1;if(null===a)h=!0;else switch(k){case "string":case "number":h=!0;break;case "object":switch(a.$$typeof){case n:case p:h=!0;}}if(h)return h=a,d=d(h),a=""===e?"."+N(h,0):e,Array.isArray(d)?(c="",null!=a&&(c=a.replace(M,"$&/")+"/"),O(d,b,c,"",function(a){return a})):null!=d&&(L(d)&&(d=K(d,c+(!d.key||h&&h.key===d.key?"":(""+d.key).replace(M,"$&/")+"/")+a)),b.push(d)),1;h=0;e=""===e?".":e+":";if(Array.isArray(a))for(var g=
1070;g<a.length;g++){k=a[g];var f=e+N(k,g);h+=O(k,b,c,f,d);}else if(f=y(a),"function"===typeof f)for(a=f.call(a),g=0;!(k=a.next()).done;)k=k.value,f=e+N(k,g++),h+=O(k,b,c,f,d);else if("object"===k)throw b=""+a,Error(z(31,"[object Object]"===b?"object with keys {"+Object.keys(a).join(", ")+"}":b));return h}function P(a,b,c){if(null==a)return a;var e=[],d=0;O(a,e,"","",function(a){return b.call(c,a,d++)});return e}
108function Q(a){if(-1===a._status){var b=a._result;b=b();a._status=0;a._result=b;b.then(function(b){0===a._status&&(b=b.default,a._status=1,a._result=b);},function(b){0===a._status&&(a._status=2,a._result=b);});}if(1===a._status)return a._result;throw a._result;}var R={current:null};function S(){var a=R.current;if(null===a)throw Error(z(321));return a}var T={ReactCurrentDispatcher:R,ReactCurrentBatchConfig:{transition:0},ReactCurrentOwner:G,IsSomeRendererActing:{current:!1},assign:objectAssign};
109exports.Children={map:P,forEach:function(a,b,c){P(a,function(){b.apply(this,arguments);},c);},count:function(a){var b=0;P(a,function(){b++;});return b},toArray:function(a){return P(a,function(a){return a})||[]},only:function(a){if(!L(a))throw Error(z(143));return a}};exports.Component=C;exports.PureComponent=E;exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=T;
110exports.cloneElement=function(a,b,c){if(null===a||void 0===a)throw Error(z(267,a));var e=objectAssign({},a.props),d=a.key,k=a.ref,h=a._owner;if(null!=b){void 0!==b.ref&&(k=b.ref,h=G.current);void 0!==b.key&&(d=""+b.key);if(a.type&&a.type.defaultProps)var g=a.type.defaultProps;for(f in b)H.call(b,f)&&!I.hasOwnProperty(f)&&(e[f]=void 0===b[f]&&void 0!==g?g[f]:b[f]);}var f=arguments.length-2;if(1===f)e.children=c;else if(1<f){g=Array(f);for(var m=0;m<f;m++)g[m]=arguments[m+2];e.children=g;}return {$$typeof:n,type:a.type,
111key:d,ref:k,props:e,_owner:h}};exports.createContext=function(a,b){void 0===b&&(b=null);a={$$typeof:r,_calculateChangedBits:b,_currentValue:a,_currentValue2:a,_threadCount:0,Provider:null,Consumer:null};a.Provider={$$typeof:q,_context:a};return a.Consumer=a};exports.createElement=J;exports.createFactory=function(a){var b=J.bind(null,a);b.type=a;return b};exports.createRef=function(){return {current:null}};exports.forwardRef=function(a){return {$$typeof:t,render:a}};exports.isValidElement=L;
112exports.lazy=function(a){return {$$typeof:v,_payload:{_status:-1,_result:a},_init:Q}};exports.memo=function(a,b){return {$$typeof:u,type:a,compare:void 0===b?null:b}};exports.useCallback=function(a,b){return S().useCallback(a,b)};exports.useContext=function(a,b){return S().useContext(a,b)};exports.useDebugValue=function(){};exports.useEffect=function(a,b){return S().useEffect(a,b)};exports.useImperativeHandle=function(a,b,c){return S().useImperativeHandle(a,b,c)};
113exports.useLayoutEffect=function(a,b){return S().useLayoutEffect(a,b)};exports.useMemo=function(a,b){return S().useMemo(a,b)};exports.useReducer=function(a,b,c){return S().useReducer(a,b,c)};exports.useRef=function(a){return S().useRef(a)};exports.useState=function(a){return S().useState(a)};exports.version="17.0.1";
114});
115react_production_min.Fragment;
116react_production_min.StrictMode;
117react_production_min.Profiler;
118react_production_min.Suspense;
119react_production_min.Children;
120react_production_min.Component;
121react_production_min.PureComponent;
122react_production_min.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
123react_production_min.cloneElement;
124react_production_min.createContext;
125react_production_min.createElement;
126react_production_min.createFactory;
127react_production_min.createRef;
128react_production_min.forwardRef;
129react_production_min.isValidElement;
130react_production_min.lazy;
131react_production_min.memo;
132react_production_min.useCallback;
133react_production_min.useContext;
134react_production_min.useDebugValue;
135react_production_min.useEffect;
136react_production_min.useImperativeHandle;
137react_production_min.useLayoutEffect;
138react_production_min.useMemo;
139react_production_min.useReducer;
140react_production_min.useRef;
141react_production_min.useState;
142react_production_min.version;
143
144var react_development = createCommonjsModule(function (module, exports) {
145
146if (process.env.NODE_ENV !== "production") {
147 (function() {
148
149var _assign = objectAssign;
150
151// TODO: this is special because it gets imported during build.
152var ReactVersion = '17.0.1';
153
154// ATTENTION
155// When adding new symbols to this file,
156// Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'
157// The Symbol used to tag the ReactElement-like types. If there is no native Symbol
158// nor polyfill, then a plain number is used for performance.
159var REACT_ELEMENT_TYPE = 0xeac7;
160var REACT_PORTAL_TYPE = 0xeaca;
161exports.Fragment = 0xeacb;
162exports.StrictMode = 0xeacc;
163exports.Profiler = 0xead2;
164var REACT_PROVIDER_TYPE = 0xeacd;
165var REACT_CONTEXT_TYPE = 0xeace;
166var REACT_FORWARD_REF_TYPE = 0xead0;
167exports.Suspense = 0xead1;
168var REACT_SUSPENSE_LIST_TYPE = 0xead8;
169var REACT_MEMO_TYPE = 0xead3;
170var REACT_LAZY_TYPE = 0xead4;
171var REACT_BLOCK_TYPE = 0xead9;
172var REACT_SERVER_BLOCK_TYPE = 0xeada;
173var REACT_FUNDAMENTAL_TYPE = 0xead5;
174var REACT_DEBUG_TRACING_MODE_TYPE = 0xeae1;
175var REACT_LEGACY_HIDDEN_TYPE = 0xeae3;
176
177if (typeof Symbol === 'function' && Symbol.for) {
178 var symbolFor = Symbol.for;
179 REACT_ELEMENT_TYPE = symbolFor('react.element');
180 REACT_PORTAL_TYPE = symbolFor('react.portal');
181 exports.Fragment = symbolFor('react.fragment');
182 exports.StrictMode = symbolFor('react.strict_mode');
183 exports.Profiler = symbolFor('react.profiler');
184 REACT_PROVIDER_TYPE = symbolFor('react.provider');
185 REACT_CONTEXT_TYPE = symbolFor('react.context');
186 REACT_FORWARD_REF_TYPE = symbolFor('react.forward_ref');
187 exports.Suspense = symbolFor('react.suspense');
188 REACT_SUSPENSE_LIST_TYPE = symbolFor('react.suspense_list');
189 REACT_MEMO_TYPE = symbolFor('react.memo');
190 REACT_LAZY_TYPE = symbolFor('react.lazy');
191 REACT_BLOCK_TYPE = symbolFor('react.block');
192 REACT_SERVER_BLOCK_TYPE = symbolFor('react.server.block');
193 REACT_FUNDAMENTAL_TYPE = symbolFor('react.fundamental');
194 symbolFor('react.scope');
195 symbolFor('react.opaque.id');
196 REACT_DEBUG_TRACING_MODE_TYPE = symbolFor('react.debug_trace_mode');
197 symbolFor('react.offscreen');
198 REACT_LEGACY_HIDDEN_TYPE = symbolFor('react.legacy_hidden');
199}
200
201var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
202var FAUX_ITERATOR_SYMBOL = '@@iterator';
203function getIteratorFn(maybeIterable) {
204 if (maybeIterable === null || typeof maybeIterable !== 'object') {
205 return null;
206 }
207
208 var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
209
210 if (typeof maybeIterator === 'function') {
211 return maybeIterator;
212 }
213
214 return null;
215}
216
217/**
218 * Keeps track of the current dispatcher.
219 */
220var ReactCurrentDispatcher = {
221 /**
222 * @internal
223 * @type {ReactComponent}
224 */
225 current: null
226};
227
228/**
229 * Keeps track of the current batch's configuration such as how long an update
230 * should suspend for if it needs to.
231 */
232var ReactCurrentBatchConfig = {
233 transition: 0
234};
235
236/**
237 * Keeps track of the current owner.
238 *
239 * The current owner is the component who should own any components that are
240 * currently being constructed.
241 */
242var ReactCurrentOwner = {
243 /**
244 * @internal
245 * @type {ReactComponent}
246 */
247 current: null
248};
249
250var ReactDebugCurrentFrame = {};
251var currentExtraStackFrame = null;
252function setExtraStackFrame(stack) {
253 {
254 currentExtraStackFrame = stack;
255 }
256}
257
258{
259 ReactDebugCurrentFrame.setExtraStackFrame = function (stack) {
260 {
261 currentExtraStackFrame = stack;
262 }
263 }; // Stack implementation injected by the current renderer.
264
265
266 ReactDebugCurrentFrame.getCurrentStack = null;
267
268 ReactDebugCurrentFrame.getStackAddendum = function () {
269 var stack = ''; // Add an extra top frame while an element is being validated
270
271 if (currentExtraStackFrame) {
272 stack += currentExtraStackFrame;
273 } // Delegate to the injected renderer-specific implementation
274
275
276 var impl = ReactDebugCurrentFrame.getCurrentStack;
277
278 if (impl) {
279 stack += impl() || '';
280 }
281
282 return stack;
283 };
284}
285
286/**
287 * Used by act() to track whether you're inside an act() scope.
288 */
289var IsSomeRendererActing = {
290 current: false
291};
292
293var ReactSharedInternals = {
294 ReactCurrentDispatcher: ReactCurrentDispatcher,
295 ReactCurrentBatchConfig: ReactCurrentBatchConfig,
296 ReactCurrentOwner: ReactCurrentOwner,
297 IsSomeRendererActing: IsSomeRendererActing,
298 // Used by renderers to avoid bundling object-assign twice in UMD bundles:
299 assign: _assign
300};
301
302{
303 ReactSharedInternals.ReactDebugCurrentFrame = ReactDebugCurrentFrame;
304}
305
306// by calls to these methods by a Babel plugin.
307//
308// In PROD (or in packages without access to React internals),
309// they are left as they are instead.
310
311function warn(format) {
312 {
313 for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
314 args[_key - 1] = arguments[_key];
315 }
316
317 printWarning('warn', format, args);
318 }
319}
320function error(format) {
321 {
322 for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
323 args[_key2 - 1] = arguments[_key2];
324 }
325
326 printWarning('error', format, args);
327 }
328}
329
330function printWarning(level, format, args) {
331 // When changing this logic, you might want to also
332 // update consoleWithStackDev.www.js as well.
333 {
334 var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
335 var stack = ReactDebugCurrentFrame.getStackAddendum();
336
337 if (stack !== '') {
338 format += '%s';
339 args = args.concat([stack]);
340 }
341
342 var argsWithFormat = args.map(function (item) {
343 return '' + item;
344 }); // Careful: RN currently depends on this prefix
345
346 argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
347 // breaks IE9: https://github.com/facebook/react/issues/13610
348 // eslint-disable-next-line react-internal/no-production-logging
349
350 Function.prototype.apply.call(console[level], console, argsWithFormat);
351 }
352}
353
354var didWarnStateUpdateForUnmountedComponent = {};
355
356function warnNoop(publicInstance, callerName) {
357 {
358 var _constructor = publicInstance.constructor;
359 var componentName = _constructor && (_constructor.displayName || _constructor.name) || 'ReactClass';
360 var warningKey = componentName + "." + callerName;
361
362 if (didWarnStateUpdateForUnmountedComponent[warningKey]) {
363 return;
364 }
365
366 error("Can't call %s on a component that is not yet mounted. " + 'This is a no-op, but it might indicate a bug in your application. ' + 'Instead, assign to `this.state` directly or define a `state = {};` ' + 'class property with the desired state in the %s component.', callerName, componentName);
367
368 didWarnStateUpdateForUnmountedComponent[warningKey] = true;
369 }
370}
371/**
372 * This is the abstract API for an update queue.
373 */
374
375
376var ReactNoopUpdateQueue = {
377 /**
378 * Checks whether or not this composite component is mounted.
379 * @param {ReactClass} publicInstance The instance we want to test.
380 * @return {boolean} True if mounted, false otherwise.
381 * @protected
382 * @final
383 */
384 isMounted: function (publicInstance) {
385 return false;
386 },
387
388 /**
389 * Forces an update. This should only be invoked when it is known with
390 * certainty that we are **not** in a DOM transaction.
391 *
392 * You may want to call this when you know that some deeper aspect of the
393 * component's state has changed but `setState` was not called.
394 *
395 * This will not invoke `shouldComponentUpdate`, but it will invoke
396 * `componentWillUpdate` and `componentDidUpdate`.
397 *
398 * @param {ReactClass} publicInstance The instance that should rerender.
399 * @param {?function} callback Called after component is updated.
400 * @param {?string} callerName name of the calling function in the public API.
401 * @internal
402 */
403 enqueueForceUpdate: function (publicInstance, callback, callerName) {
404 warnNoop(publicInstance, 'forceUpdate');
405 },
406
407 /**
408 * Replaces all of the state. Always use this or `setState` to mutate state.
409 * You should treat `this.state` as immutable.
410 *
411 * There is no guarantee that `this.state` will be immediately updated, so
412 * accessing `this.state` after calling this method may return the old value.
413 *
414 * @param {ReactClass} publicInstance The instance that should rerender.
415 * @param {object} completeState Next state.
416 * @param {?function} callback Called after component is updated.
417 * @param {?string} callerName name of the calling function in the public API.
418 * @internal
419 */
420 enqueueReplaceState: function (publicInstance, completeState, callback, callerName) {
421 warnNoop(publicInstance, 'replaceState');
422 },
423
424 /**
425 * Sets a subset of the state. This only exists because _pendingState is
426 * internal. This provides a merging strategy that is not available to deep
427 * properties which is confusing. TODO: Expose pendingState or don't use it
428 * during the merge.
429 *
430 * @param {ReactClass} publicInstance The instance that should rerender.
431 * @param {object} partialState Next partial state to be merged with state.
432 * @param {?function} callback Called after component is updated.
433 * @param {?string} Name of the calling function in the public API.
434 * @internal
435 */
436 enqueueSetState: function (publicInstance, partialState, callback, callerName) {
437 warnNoop(publicInstance, 'setState');
438 }
439};
440
441var emptyObject = {};
442
443{
444 Object.freeze(emptyObject);
445}
446/**
447 * Base class helpers for the updating state of a component.
448 */
449
450
451function Component(props, context, updater) {
452 this.props = props;
453 this.context = context; // If a component has string refs, we will assign a different object later.
454
455 this.refs = emptyObject; // We initialize the default updater but the real one gets injected by the
456 // renderer.
457
458 this.updater = updater || ReactNoopUpdateQueue;
459}
460
461Component.prototype.isReactComponent = {};
462/**
463 * Sets a subset of the state. Always use this to mutate
464 * state. You should treat `this.state` as immutable.
465 *
466 * There is no guarantee that `this.state` will be immediately updated, so
467 * accessing `this.state` after calling this method may return the old value.
468 *
469 * There is no guarantee that calls to `setState` will run synchronously,
470 * as they may eventually be batched together. You can provide an optional
471 * callback that will be executed when the call to setState is actually
472 * completed.
473 *
474 * When a function is provided to setState, it will be called at some point in
475 * the future (not synchronously). It will be called with the up to date
476 * component arguments (state, props, context). These values can be different
477 * from this.* because your function may be called after receiveProps but before
478 * shouldComponentUpdate, and this new state, props, and context will not yet be
479 * assigned to this.
480 *
481 * @param {object|function} partialState Next partial state or function to
482 * produce next partial state to be merged with current state.
483 * @param {?function} callback Called after state is updated.
484 * @final
485 * @protected
486 */
487
488Component.prototype.setState = function (partialState, callback) {
489 if (!(typeof partialState === 'object' || typeof partialState === 'function' || partialState == null)) {
490 {
491 throw Error( "setState(...): takes an object of state variables to update or a function which returns an object of state variables." );
492 }
493 }
494
495 this.updater.enqueueSetState(this, partialState, callback, 'setState');
496};
497/**
498 * Forces an update. This should only be invoked when it is known with
499 * certainty that we are **not** in a DOM transaction.
500 *
501 * You may want to call this when you know that some deeper aspect of the
502 * component's state has changed but `setState` was not called.
503 *
504 * This will not invoke `shouldComponentUpdate`, but it will invoke
505 * `componentWillUpdate` and `componentDidUpdate`.
506 *
507 * @param {?function} callback Called after update is complete.
508 * @final
509 * @protected
510 */
511
512
513Component.prototype.forceUpdate = function (callback) {
514 this.updater.enqueueForceUpdate(this, callback, 'forceUpdate');
515};
516/**
517 * Deprecated APIs. These APIs used to exist on classic React classes but since
518 * we would like to deprecate them, we're not going to move them over to this
519 * modern base class. Instead, we define a getter that warns if it's accessed.
520 */
521
522
523{
524 var deprecatedAPIs = {
525 isMounted: ['isMounted', 'Instead, make sure to clean up subscriptions and pending requests in ' + 'componentWillUnmount to prevent memory leaks.'],
526 replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).']
527 };
528
529 var defineDeprecationWarning = function (methodName, info) {
530 Object.defineProperty(Component.prototype, methodName, {
531 get: function () {
532 warn('%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]);
533
534 return undefined;
535 }
536 });
537 };
538
539 for (var fnName in deprecatedAPIs) {
540 if (deprecatedAPIs.hasOwnProperty(fnName)) {
541 defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
542 }
543 }
544}
545
546function ComponentDummy() {}
547
548ComponentDummy.prototype = Component.prototype;
549/**
550 * Convenience component with default shallow equality check for sCU.
551 */
552
553function PureComponent(props, context, updater) {
554 this.props = props;
555 this.context = context; // If a component has string refs, we will assign a different object later.
556
557 this.refs = emptyObject;
558 this.updater = updater || ReactNoopUpdateQueue;
559}
560
561var pureComponentPrototype = PureComponent.prototype = new ComponentDummy();
562pureComponentPrototype.constructor = PureComponent; // Avoid an extra prototype jump for these methods.
563
564_assign(pureComponentPrototype, Component.prototype);
565
566pureComponentPrototype.isPureReactComponent = true;
567
568// an immutable object with a single mutable value
569function createRef() {
570 var refObject = {
571 current: null
572 };
573
574 {
575 Object.seal(refObject);
576 }
577
578 return refObject;
579}
580
581function getWrappedName(outerType, innerType, wrapperName) {
582 var functionName = innerType.displayName || innerType.name || '';
583 return outerType.displayName || (functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName);
584}
585
586function getContextName(type) {
587 return type.displayName || 'Context';
588}
589
590function getComponentName(type) {
591 if (type == null) {
592 // Host root, text node or just invalid type.
593 return null;
594 }
595
596 {
597 if (typeof type.tag === 'number') {
598 error('Received an unexpected object in getComponentName(). ' + 'This is likely a bug in React. Please file an issue.');
599 }
600 }
601
602 if (typeof type === 'function') {
603 return type.displayName || type.name || null;
604 }
605
606 if (typeof type === 'string') {
607 return type;
608 }
609
610 switch (type) {
611 case exports.Fragment:
612 return 'Fragment';
613
614 case REACT_PORTAL_TYPE:
615 return 'Portal';
616
617 case exports.Profiler:
618 return 'Profiler';
619
620 case exports.StrictMode:
621 return 'StrictMode';
622
623 case exports.Suspense:
624 return 'Suspense';
625
626 case REACT_SUSPENSE_LIST_TYPE:
627 return 'SuspenseList';
628 }
629
630 if (typeof type === 'object') {
631 switch (type.$$typeof) {
632 case REACT_CONTEXT_TYPE:
633 var context = type;
634 return getContextName(context) + '.Consumer';
635
636 case REACT_PROVIDER_TYPE:
637 var provider = type;
638 return getContextName(provider._context) + '.Provider';
639
640 case REACT_FORWARD_REF_TYPE:
641 return getWrappedName(type, type.render, 'ForwardRef');
642
643 case REACT_MEMO_TYPE:
644 return getComponentName(type.type);
645
646 case REACT_BLOCK_TYPE:
647 return getComponentName(type._render);
648
649 case REACT_LAZY_TYPE:
650 {
651 var lazyComponent = type;
652 var payload = lazyComponent._payload;
653 var init = lazyComponent._init;
654
655 try {
656 return getComponentName(init(payload));
657 } catch (x) {
658 return null;
659 }
660 }
661 }
662 }
663
664 return null;
665}
666
667var hasOwnProperty = Object.prototype.hasOwnProperty;
668var RESERVED_PROPS = {
669 key: true,
670 ref: true,
671 __self: true,
672 __source: true
673};
674var specialPropKeyWarningShown, specialPropRefWarningShown, didWarnAboutStringRefs;
675
676{
677 didWarnAboutStringRefs = {};
678}
679
680function hasValidRef(config) {
681 {
682 if (hasOwnProperty.call(config, 'ref')) {
683 var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;
684
685 if (getter && getter.isReactWarning) {
686 return false;
687 }
688 }
689 }
690
691 return config.ref !== undefined;
692}
693
694function hasValidKey(config) {
695 {
696 if (hasOwnProperty.call(config, 'key')) {
697 var getter = Object.getOwnPropertyDescriptor(config, 'key').get;
698
699 if (getter && getter.isReactWarning) {
700 return false;
701 }
702 }
703 }
704
705 return config.key !== undefined;
706}
707
708function defineKeyPropWarningGetter(props, displayName) {
709 var warnAboutAccessingKey = function () {
710 {
711 if (!specialPropKeyWarningShown) {
712 specialPropKeyWarningShown = true;
713
714 error('%s: `key` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://reactjs.org/link/special-props)', displayName);
715 }
716 }
717 };
718
719 warnAboutAccessingKey.isReactWarning = true;
720 Object.defineProperty(props, 'key', {
721 get: warnAboutAccessingKey,
722 configurable: true
723 });
724}
725
726function defineRefPropWarningGetter(props, displayName) {
727 var warnAboutAccessingRef = function () {
728 {
729 if (!specialPropRefWarningShown) {
730 specialPropRefWarningShown = true;
731
732 error('%s: `ref` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://reactjs.org/link/special-props)', displayName);
733 }
734 }
735 };
736
737 warnAboutAccessingRef.isReactWarning = true;
738 Object.defineProperty(props, 'ref', {
739 get: warnAboutAccessingRef,
740 configurable: true
741 });
742}
743
744function warnIfStringRefCannotBeAutoConverted(config) {
745 {
746 if (typeof config.ref === 'string' && ReactCurrentOwner.current && config.__self && ReactCurrentOwner.current.stateNode !== config.__self) {
747 var componentName = getComponentName(ReactCurrentOwner.current.type);
748
749 if (!didWarnAboutStringRefs[componentName]) {
750 error('Component "%s" contains the string ref "%s". ' + 'Support for string refs will be removed in a future major release. ' + 'This case cannot be automatically converted to an arrow function. ' + 'We ask you to manually fix this case by using useRef() or createRef() instead. ' + 'Learn more about using refs safely here: ' + 'https://reactjs.org/link/strict-mode-string-ref', componentName, config.ref);
751
752 didWarnAboutStringRefs[componentName] = true;
753 }
754 }
755 }
756}
757/**
758 * Factory method to create a new React element. This no longer adheres to
759 * the class pattern, so do not use new to call it. Also, instanceof check
760 * will not work. Instead test $$typeof field against Symbol.for('react.element') to check
761 * if something is a React Element.
762 *
763 * @param {*} type
764 * @param {*} props
765 * @param {*} key
766 * @param {string|object} ref
767 * @param {*} owner
768 * @param {*} self A *temporary* helper to detect places where `this` is
769 * different from the `owner` when React.createElement is called, so that we
770 * can warn. We want to get rid of owner and replace string `ref`s with arrow
771 * functions, and as long as `this` and owner are the same, there will be no
772 * change in behavior.
773 * @param {*} source An annotation object (added by a transpiler or otherwise)
774 * indicating filename, line number, and/or other information.
775 * @internal
776 */
777
778
779var ReactElement = function (type, key, ref, self, source, owner, props) {
780 var element = {
781 // This tag allows us to uniquely identify this as a React Element
782 $$typeof: REACT_ELEMENT_TYPE,
783 // Built-in properties that belong on the element
784 type: type,
785 key: key,
786 ref: ref,
787 props: props,
788 // Record the component responsible for creating this element.
789 _owner: owner
790 };
791
792 {
793 // The validation flag is currently mutative. We put it on
794 // an external backing store so that we can freeze the whole object.
795 // This can be replaced with a WeakMap once they are implemented in
796 // commonly used development environments.
797 element._store = {}; // To make comparing ReactElements easier for testing purposes, we make
798 // the validation flag non-enumerable (where possible, which should
799 // include every environment we run tests in), so the test framework
800 // ignores it.
801
802 Object.defineProperty(element._store, 'validated', {
803 configurable: false,
804 enumerable: false,
805 writable: true,
806 value: false
807 }); // self and source are DEV only properties.
808
809 Object.defineProperty(element, '_self', {
810 configurable: false,
811 enumerable: false,
812 writable: false,
813 value: self
814 }); // Two elements created in two different places should be considered
815 // equal for testing purposes and therefore we hide it from enumeration.
816
817 Object.defineProperty(element, '_source', {
818 configurable: false,
819 enumerable: false,
820 writable: false,
821 value: source
822 });
823
824 if (Object.freeze) {
825 Object.freeze(element.props);
826 Object.freeze(element);
827 }
828 }
829
830 return element;
831};
832/**
833 * Create and return a new ReactElement of the given type.
834 * See https://reactjs.org/docs/react-api.html#createelement
835 */
836
837function createElement(type, config, children) {
838 var propName; // Reserved names are extracted
839
840 var props = {};
841 var key = null;
842 var ref = null;
843 var self = null;
844 var source = null;
845
846 if (config != null) {
847 if (hasValidRef(config)) {
848 ref = config.ref;
849
850 {
851 warnIfStringRefCannotBeAutoConverted(config);
852 }
853 }
854
855 if (hasValidKey(config)) {
856 key = '' + config.key;
857 }
858
859 self = config.__self === undefined ? null : config.__self;
860 source = config.__source === undefined ? null : config.__source; // Remaining properties are added to a new props object
861
862 for (propName in config) {
863 if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
864 props[propName] = config[propName];
865 }
866 }
867 } // Children can be more than one argument, and those are transferred onto
868 // the newly allocated props object.
869
870
871 var childrenLength = arguments.length - 2;
872
873 if (childrenLength === 1) {
874 props.children = children;
875 } else if (childrenLength > 1) {
876 var childArray = Array(childrenLength);
877
878 for (var i = 0; i < childrenLength; i++) {
879 childArray[i] = arguments[i + 2];
880 }
881
882 {
883 if (Object.freeze) {
884 Object.freeze(childArray);
885 }
886 }
887
888 props.children = childArray;
889 } // Resolve default props
890
891
892 if (type && type.defaultProps) {
893 var defaultProps = type.defaultProps;
894
895 for (propName in defaultProps) {
896 if (props[propName] === undefined) {
897 props[propName] = defaultProps[propName];
898 }
899 }
900 }
901
902 {
903 if (key || ref) {
904 var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
905
906 if (key) {
907 defineKeyPropWarningGetter(props, displayName);
908 }
909
910 if (ref) {
911 defineRefPropWarningGetter(props, displayName);
912 }
913 }
914 }
915
916 return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
917}
918function cloneAndReplaceKey(oldElement, newKey) {
919 var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props);
920 return newElement;
921}
922/**
923 * Clone and return a new ReactElement using element as the starting point.
924 * See https://reactjs.org/docs/react-api.html#cloneelement
925 */
926
927function cloneElement(element, config, children) {
928 if (!!(element === null || element === undefined)) {
929 {
930 throw Error( "React.cloneElement(...): The argument must be a React element, but you passed " + element + "." );
931 }
932 }
933
934 var propName; // Original props are copied
935
936 var props = _assign({}, element.props); // Reserved names are extracted
937
938
939 var key = element.key;
940 var ref = element.ref; // Self is preserved since the owner is preserved.
941
942 var self = element._self; // Source is preserved since cloneElement is unlikely to be targeted by a
943 // transpiler, and the original source is probably a better indicator of the
944 // true owner.
945
946 var source = element._source; // Owner will be preserved, unless ref is overridden
947
948 var owner = element._owner;
949
950 if (config != null) {
951 if (hasValidRef(config)) {
952 // Silently steal the ref from the parent.
953 ref = config.ref;
954 owner = ReactCurrentOwner.current;
955 }
956
957 if (hasValidKey(config)) {
958 key = '' + config.key;
959 } // Remaining properties override existing props
960
961
962 var defaultProps;
963
964 if (element.type && element.type.defaultProps) {
965 defaultProps = element.type.defaultProps;
966 }
967
968 for (propName in config) {
969 if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
970 if (config[propName] === undefined && defaultProps !== undefined) {
971 // Resolve default props
972 props[propName] = defaultProps[propName];
973 } else {
974 props[propName] = config[propName];
975 }
976 }
977 }
978 } // Children can be more than one argument, and those are transferred onto
979 // the newly allocated props object.
980
981
982 var childrenLength = arguments.length - 2;
983
984 if (childrenLength === 1) {
985 props.children = children;
986 } else if (childrenLength > 1) {
987 var childArray = Array(childrenLength);
988
989 for (var i = 0; i < childrenLength; i++) {
990 childArray[i] = arguments[i + 2];
991 }
992
993 props.children = childArray;
994 }
995
996 return ReactElement(element.type, key, ref, self, source, owner, props);
997}
998/**
999 * Verifies the object is a ReactElement.
1000 * See https://reactjs.org/docs/react-api.html#isvalidelement
1001 * @param {?object} object
1002 * @return {boolean} True if `object` is a ReactElement.
1003 * @final
1004 */
1005
1006function isValidElement(object) {
1007 return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
1008}
1009
1010var SEPARATOR = '.';
1011var SUBSEPARATOR = ':';
1012/**
1013 * Escape and wrap key so it is safe to use as a reactid
1014 *
1015 * @param {string} key to be escaped.
1016 * @return {string} the escaped key.
1017 */
1018
1019function escape(key) {
1020 var escapeRegex = /[=:]/g;
1021 var escaperLookup = {
1022 '=': '=0',
1023 ':': '=2'
1024 };
1025 var escapedString = key.replace(escapeRegex, function (match) {
1026 return escaperLookup[match];
1027 });
1028 return '$' + escapedString;
1029}
1030/**
1031 * TODO: Test that a single child and an array with one item have the same key
1032 * pattern.
1033 */
1034
1035
1036var didWarnAboutMaps = false;
1037var userProvidedKeyEscapeRegex = /\/+/g;
1038
1039function escapeUserProvidedKey(text) {
1040 return text.replace(userProvidedKeyEscapeRegex, '$&/');
1041}
1042/**
1043 * Generate a key string that identifies a element within a set.
1044 *
1045 * @param {*} element A element that could contain a manual key.
1046 * @param {number} index Index that is used if a manual key is not provided.
1047 * @return {string}
1048 */
1049
1050
1051function getElementKey(element, index) {
1052 // Do some typechecking here since we call this blindly. We want to ensure
1053 // that we don't block potential future ES APIs.
1054 if (typeof element === 'object' && element !== null && element.key != null) {
1055 // Explicit key
1056 return escape('' + element.key);
1057 } // Implicit key determined by the index in the set
1058
1059
1060 return index.toString(36);
1061}
1062
1063function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) {
1064 var type = typeof children;
1065
1066 if (type === 'undefined' || type === 'boolean') {
1067 // All of the above are perceived as null.
1068 children = null;
1069 }
1070
1071 var invokeCallback = false;
1072
1073 if (children === null) {
1074 invokeCallback = true;
1075 } else {
1076 switch (type) {
1077 case 'string':
1078 case 'number':
1079 invokeCallback = true;
1080 break;
1081
1082 case 'object':
1083 switch (children.$$typeof) {
1084 case REACT_ELEMENT_TYPE:
1085 case REACT_PORTAL_TYPE:
1086 invokeCallback = true;
1087 }
1088
1089 }
1090 }
1091
1092 if (invokeCallback) {
1093 var _child = children;
1094 var mappedChild = callback(_child); // If it's the only child, treat the name as if it was wrapped in an array
1095 // so that it's consistent if the number of children grows:
1096
1097 var childKey = nameSoFar === '' ? SEPARATOR + getElementKey(_child, 0) : nameSoFar;
1098
1099 if (Array.isArray(mappedChild)) {
1100 var escapedChildKey = '';
1101
1102 if (childKey != null) {
1103 escapedChildKey = escapeUserProvidedKey(childKey) + '/';
1104 }
1105
1106 mapIntoArray(mappedChild, array, escapedChildKey, '', function (c) {
1107 return c;
1108 });
1109 } else if (mappedChild != null) {
1110 if (isValidElement(mappedChild)) {
1111 mappedChild = cloneAndReplaceKey(mappedChild, // Keep both the (mapped) and old keys if they differ, just as
1112 // traverseAllChildren used to do for objects as children
1113 escapedPrefix + ( // $FlowFixMe Flow incorrectly thinks React.Portal doesn't have a key
1114 mappedChild.key && (!_child || _child.key !== mappedChild.key) ? // $FlowFixMe Flow incorrectly thinks existing element's key can be a number
1115 escapeUserProvidedKey('' + mappedChild.key) + '/' : '') + childKey);
1116 }
1117
1118 array.push(mappedChild);
1119 }
1120
1121 return 1;
1122 }
1123
1124 var child;
1125 var nextName;
1126 var subtreeCount = 0; // Count of children found in the current subtree.
1127
1128 var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR;
1129
1130 if (Array.isArray(children)) {
1131 for (var i = 0; i < children.length; i++) {
1132 child = children[i];
1133 nextName = nextNamePrefix + getElementKey(child, i);
1134 subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback);
1135 }
1136 } else {
1137 var iteratorFn = getIteratorFn(children);
1138
1139 if (typeof iteratorFn === 'function') {
1140 var iterableChildren = children;
1141
1142 {
1143 // Warn about using Maps as children
1144 if (iteratorFn === iterableChildren.entries) {
1145 if (!didWarnAboutMaps) {
1146 warn('Using Maps as children is not supported. ' + 'Use an array of keyed ReactElements instead.');
1147 }
1148
1149 didWarnAboutMaps = true;
1150 }
1151 }
1152
1153 var iterator = iteratorFn.call(iterableChildren);
1154 var step;
1155 var ii = 0;
1156
1157 while (!(step = iterator.next()).done) {
1158 child = step.value;
1159 nextName = nextNamePrefix + getElementKey(child, ii++);
1160 subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback);
1161 }
1162 } else if (type === 'object') {
1163 var childrenString = '' + children;
1164
1165 {
1166 {
1167 throw Error( "Objects are not valid as a React child (found: " + (childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString) + "). If you meant to render a collection of children, use an array instead." );
1168 }
1169 }
1170 }
1171 }
1172
1173 return subtreeCount;
1174}
1175
1176/**
1177 * Maps children that are typically specified as `props.children`.
1178 *
1179 * See https://reactjs.org/docs/react-api.html#reactchildrenmap
1180 *
1181 * The provided mapFunction(child, index) will be called for each
1182 * leaf child.
1183 *
1184 * @param {?*} children Children tree container.
1185 * @param {function(*, int)} func The map function.
1186 * @param {*} context Context for mapFunction.
1187 * @return {object} Object containing the ordered map of results.
1188 */
1189function mapChildren(children, func, context) {
1190 if (children == null) {
1191 return children;
1192 }
1193
1194 var result = [];
1195 var count = 0;
1196 mapIntoArray(children, result, '', '', function (child) {
1197 return func.call(context, child, count++);
1198 });
1199 return result;
1200}
1201/**
1202 * Count the number of children that are typically specified as
1203 * `props.children`.
1204 *
1205 * See https://reactjs.org/docs/react-api.html#reactchildrencount
1206 *
1207 * @param {?*} children Children tree container.
1208 * @return {number} The number of children.
1209 */
1210
1211
1212function countChildren(children) {
1213 var n = 0;
1214 mapChildren(children, function () {
1215 n++; // Don't return anything
1216 });
1217 return n;
1218}
1219
1220/**
1221 * Iterates through children that are typically specified as `props.children`.
1222 *
1223 * See https://reactjs.org/docs/react-api.html#reactchildrenforeach
1224 *
1225 * The provided forEachFunc(child, index) will be called for each
1226 * leaf child.
1227 *
1228 * @param {?*} children Children tree container.
1229 * @param {function(*, int)} forEachFunc
1230 * @param {*} forEachContext Context for forEachContext.
1231 */
1232function forEachChildren(children, forEachFunc, forEachContext) {
1233 mapChildren(children, function () {
1234 forEachFunc.apply(this, arguments); // Don't return anything.
1235 }, forEachContext);
1236}
1237/**
1238 * Flatten a children object (typically specified as `props.children`) and
1239 * return an array with appropriately re-keyed children.
1240 *
1241 * See https://reactjs.org/docs/react-api.html#reactchildrentoarray
1242 */
1243
1244
1245function toArray(children) {
1246 return mapChildren(children, function (child) {
1247 return child;
1248 }) || [];
1249}
1250/**
1251 * Returns the first child in a collection of children and verifies that there
1252 * is only one child in the collection.
1253 *
1254 * See https://reactjs.org/docs/react-api.html#reactchildrenonly
1255 *
1256 * The current implementation of this function assumes that a single child gets
1257 * passed without a wrapper, but the purpose of this helper function is to
1258 * abstract away the particular structure of children.
1259 *
1260 * @param {?object} children Child collection structure.
1261 * @return {ReactElement} The first and only `ReactElement` contained in the
1262 * structure.
1263 */
1264
1265
1266function onlyChild(children) {
1267 if (!isValidElement(children)) {
1268 {
1269 throw Error( "React.Children.only expected to receive a single React element child." );
1270 }
1271 }
1272
1273 return children;
1274}
1275
1276function createContext(defaultValue, calculateChangedBits) {
1277 if (calculateChangedBits === undefined) {
1278 calculateChangedBits = null;
1279 } else {
1280 {
1281 if (calculateChangedBits !== null && typeof calculateChangedBits !== 'function') {
1282 error('createContext: Expected the optional second argument to be a ' + 'function. Instead received: %s', calculateChangedBits);
1283 }
1284 }
1285 }
1286
1287 var context = {
1288 $$typeof: REACT_CONTEXT_TYPE,
1289 _calculateChangedBits: calculateChangedBits,
1290 // As a workaround to support multiple concurrent renderers, we categorize
1291 // some renderers as primary and others as secondary. We only expect
1292 // there to be two concurrent renderers at most: React Native (primary) and
1293 // Fabric (secondary); React DOM (primary) and React ART (secondary).
1294 // Secondary renderers store their context values on separate fields.
1295 _currentValue: defaultValue,
1296 _currentValue2: defaultValue,
1297 // Used to track how many concurrent renderers this context currently
1298 // supports within in a single renderer. Such as parallel server rendering.
1299 _threadCount: 0,
1300 // These are circular
1301 Provider: null,
1302 Consumer: null
1303 };
1304 context.Provider = {
1305 $$typeof: REACT_PROVIDER_TYPE,
1306 _context: context
1307 };
1308 var hasWarnedAboutUsingNestedContextConsumers = false;
1309 var hasWarnedAboutUsingConsumerProvider = false;
1310 var hasWarnedAboutDisplayNameOnConsumer = false;
1311
1312 {
1313 // A separate object, but proxies back to the original context object for
1314 // backwards compatibility. It has a different $$typeof, so we can properly
1315 // warn for the incorrect usage of Context as a Consumer.
1316 var Consumer = {
1317 $$typeof: REACT_CONTEXT_TYPE,
1318 _context: context,
1319 _calculateChangedBits: context._calculateChangedBits
1320 }; // $FlowFixMe: Flow complains about not setting a value, which is intentional here
1321
1322 Object.defineProperties(Consumer, {
1323 Provider: {
1324 get: function () {
1325 if (!hasWarnedAboutUsingConsumerProvider) {
1326 hasWarnedAboutUsingConsumerProvider = true;
1327
1328 error('Rendering <Context.Consumer.Provider> is not supported and will be removed in ' + 'a future major release. Did you mean to render <Context.Provider> instead?');
1329 }
1330
1331 return context.Provider;
1332 },
1333 set: function (_Provider) {
1334 context.Provider = _Provider;
1335 }
1336 },
1337 _currentValue: {
1338 get: function () {
1339 return context._currentValue;
1340 },
1341 set: function (_currentValue) {
1342 context._currentValue = _currentValue;
1343 }
1344 },
1345 _currentValue2: {
1346 get: function () {
1347 return context._currentValue2;
1348 },
1349 set: function (_currentValue2) {
1350 context._currentValue2 = _currentValue2;
1351 }
1352 },
1353 _threadCount: {
1354 get: function () {
1355 return context._threadCount;
1356 },
1357 set: function (_threadCount) {
1358 context._threadCount = _threadCount;
1359 }
1360 },
1361 Consumer: {
1362 get: function () {
1363 if (!hasWarnedAboutUsingNestedContextConsumers) {
1364 hasWarnedAboutUsingNestedContextConsumers = true;
1365
1366 error('Rendering <Context.Consumer.Consumer> is not supported and will be removed in ' + 'a future major release. Did you mean to render <Context.Consumer> instead?');
1367 }
1368
1369 return context.Consumer;
1370 }
1371 },
1372 displayName: {
1373 get: function () {
1374 return context.displayName;
1375 },
1376 set: function (displayName) {
1377 if (!hasWarnedAboutDisplayNameOnConsumer) {
1378 warn('Setting `displayName` on Context.Consumer has no effect. ' + "You should set it directly on the context with Context.displayName = '%s'.", displayName);
1379
1380 hasWarnedAboutDisplayNameOnConsumer = true;
1381 }
1382 }
1383 }
1384 }); // $FlowFixMe: Flow complains about missing properties because it doesn't understand defineProperty
1385
1386 context.Consumer = Consumer;
1387 }
1388
1389 {
1390 context._currentRenderer = null;
1391 context._currentRenderer2 = null;
1392 }
1393
1394 return context;
1395}
1396
1397var Uninitialized = -1;
1398var Pending = 0;
1399var Resolved = 1;
1400var Rejected = 2;
1401
1402function lazyInitializer(payload) {
1403 if (payload._status === Uninitialized) {
1404 var ctor = payload._result;
1405 var thenable = ctor(); // Transition to the next state.
1406
1407 var pending = payload;
1408 pending._status = Pending;
1409 pending._result = thenable;
1410 thenable.then(function (moduleObject) {
1411 if (payload._status === Pending) {
1412 var defaultExport = moduleObject.default;
1413
1414 {
1415 if (defaultExport === undefined) {
1416 error('lazy: Expected the result of a dynamic import() call. ' + 'Instead received: %s\n\nYour code should look like: \n ' + // Break up imports to avoid accidentally parsing them as dependencies.
1417 'const MyComponent = lazy(() => imp' + "ort('./MyComponent'))", moduleObject);
1418 }
1419 } // Transition to the next state.
1420
1421
1422 var resolved = payload;
1423 resolved._status = Resolved;
1424 resolved._result = defaultExport;
1425 }
1426 }, function (error) {
1427 if (payload._status === Pending) {
1428 // Transition to the next state.
1429 var rejected = payload;
1430 rejected._status = Rejected;
1431 rejected._result = error;
1432 }
1433 });
1434 }
1435
1436 if (payload._status === Resolved) {
1437 return payload._result;
1438 } else {
1439 throw payload._result;
1440 }
1441}
1442
1443function lazy(ctor) {
1444 var payload = {
1445 // We use these fields to store the result.
1446 _status: -1,
1447 _result: ctor
1448 };
1449 var lazyType = {
1450 $$typeof: REACT_LAZY_TYPE,
1451 _payload: payload,
1452 _init: lazyInitializer
1453 };
1454
1455 {
1456 // In production, this would just set it on the object.
1457 var defaultProps;
1458 var propTypes; // $FlowFixMe
1459
1460 Object.defineProperties(lazyType, {
1461 defaultProps: {
1462 configurable: true,
1463 get: function () {
1464 return defaultProps;
1465 },
1466 set: function (newDefaultProps) {
1467 error('React.lazy(...): It is not supported to assign `defaultProps` to ' + 'a lazy component import. Either specify them where the component ' + 'is defined, or create a wrapping component around it.');
1468
1469 defaultProps = newDefaultProps; // Match production behavior more closely:
1470 // $FlowFixMe
1471
1472 Object.defineProperty(lazyType, 'defaultProps', {
1473 enumerable: true
1474 });
1475 }
1476 },
1477 propTypes: {
1478 configurable: true,
1479 get: function () {
1480 return propTypes;
1481 },
1482 set: function (newPropTypes) {
1483 error('React.lazy(...): It is not supported to assign `propTypes` to ' + 'a lazy component import. Either specify them where the component ' + 'is defined, or create a wrapping component around it.');
1484
1485 propTypes = newPropTypes; // Match production behavior more closely:
1486 // $FlowFixMe
1487
1488 Object.defineProperty(lazyType, 'propTypes', {
1489 enumerable: true
1490 });
1491 }
1492 }
1493 });
1494 }
1495
1496 return lazyType;
1497}
1498
1499function forwardRef(render) {
1500 {
1501 if (render != null && render.$$typeof === REACT_MEMO_TYPE) {
1502 error('forwardRef requires a render function but received a `memo` ' + 'component. Instead of forwardRef(memo(...)), use ' + 'memo(forwardRef(...)).');
1503 } else if (typeof render !== 'function') {
1504 error('forwardRef requires a render function but was given %s.', render === null ? 'null' : typeof render);
1505 } else {
1506 if (render.length !== 0 && render.length !== 2) {
1507 error('forwardRef render functions accept exactly two parameters: props and ref. %s', render.length === 1 ? 'Did you forget to use the ref parameter?' : 'Any additional parameter will be undefined.');
1508 }
1509 }
1510
1511 if (render != null) {
1512 if (render.defaultProps != null || render.propTypes != null) {
1513 error('forwardRef render functions do not support propTypes or defaultProps. ' + 'Did you accidentally pass a React component?');
1514 }
1515 }
1516 }
1517
1518 var elementType = {
1519 $$typeof: REACT_FORWARD_REF_TYPE,
1520 render: render
1521 };
1522
1523 {
1524 var ownName;
1525 Object.defineProperty(elementType, 'displayName', {
1526 enumerable: false,
1527 configurable: true,
1528 get: function () {
1529 return ownName;
1530 },
1531 set: function (name) {
1532 ownName = name;
1533
1534 if (render.displayName == null) {
1535 render.displayName = name;
1536 }
1537 }
1538 });
1539 }
1540
1541 return elementType;
1542}
1543
1544// Filter certain DOM attributes (e.g. src, href) if their values are empty strings.
1545
1546var enableScopeAPI = false; // Experimental Create Event Handle API.
1547
1548function isValidElementType(type) {
1549 if (typeof type === 'string' || typeof type === 'function') {
1550 return true;
1551 } // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).
1552
1553
1554 if (type === exports.Fragment || type === exports.Profiler || type === REACT_DEBUG_TRACING_MODE_TYPE || type === exports.StrictMode || type === exports.Suspense || type === REACT_SUSPENSE_LIST_TYPE || type === REACT_LEGACY_HIDDEN_TYPE || enableScopeAPI ) {
1555 return true;
1556 }
1557
1558 if (typeof type === 'object' && type !== null) {
1559 if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_BLOCK_TYPE || type[0] === REACT_SERVER_BLOCK_TYPE) {
1560 return true;
1561 }
1562 }
1563
1564 return false;
1565}
1566
1567function memo(type, compare) {
1568 {
1569 if (!isValidElementType(type)) {
1570 error('memo: The first argument must be a component. Instead ' + 'received: %s', type === null ? 'null' : typeof type);
1571 }
1572 }
1573
1574 var elementType = {
1575 $$typeof: REACT_MEMO_TYPE,
1576 type: type,
1577 compare: compare === undefined ? null : compare
1578 };
1579
1580 {
1581 var ownName;
1582 Object.defineProperty(elementType, 'displayName', {
1583 enumerable: false,
1584 configurable: true,
1585 get: function () {
1586 return ownName;
1587 },
1588 set: function (name) {
1589 ownName = name;
1590
1591 if (type.displayName == null) {
1592 type.displayName = name;
1593 }
1594 }
1595 });
1596 }
1597
1598 return elementType;
1599}
1600
1601function resolveDispatcher() {
1602 var dispatcher = ReactCurrentDispatcher.current;
1603
1604 if (!(dispatcher !== null)) {
1605 {
1606 throw Error( "Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem." );
1607 }
1608 }
1609
1610 return dispatcher;
1611}
1612
1613function useContext(Context, unstable_observedBits) {
1614 var dispatcher = resolveDispatcher();
1615
1616 {
1617 if (unstable_observedBits !== undefined) {
1618 error('useContext() second argument is reserved for future ' + 'use in React. Passing it is not supported. ' + 'You passed: %s.%s', unstable_observedBits, typeof unstable_observedBits === 'number' && Array.isArray(arguments[2]) ? '\n\nDid you call array.map(useContext)? ' + 'Calling Hooks inside a loop is not supported. ' + 'Learn more at https://reactjs.org/link/rules-of-hooks' : '');
1619 } // TODO: add a more generic warning for invalid values.
1620
1621
1622 if (Context._context !== undefined) {
1623 var realContext = Context._context; // Don't deduplicate because this legitimately causes bugs
1624 // and nobody should be using this in existing code.
1625
1626 if (realContext.Consumer === Context) {
1627 error('Calling useContext(Context.Consumer) is not supported, may cause bugs, and will be ' + 'removed in a future major release. Did you mean to call useContext(Context) instead?');
1628 } else if (realContext.Provider === Context) {
1629 error('Calling useContext(Context.Provider) is not supported. ' + 'Did you mean to call useContext(Context) instead?');
1630 }
1631 }
1632 }
1633
1634 return dispatcher.useContext(Context, unstable_observedBits);
1635}
1636function useState(initialState) {
1637 var dispatcher = resolveDispatcher();
1638 return dispatcher.useState(initialState);
1639}
1640function useReducer(reducer, initialArg, init) {
1641 var dispatcher = resolveDispatcher();
1642 return dispatcher.useReducer(reducer, initialArg, init);
1643}
1644function useRef(initialValue) {
1645 var dispatcher = resolveDispatcher();
1646 return dispatcher.useRef(initialValue);
1647}
1648function useEffect(create, deps) {
1649 var dispatcher = resolveDispatcher();
1650 return dispatcher.useEffect(create, deps);
1651}
1652function useLayoutEffect(create, deps) {
1653 var dispatcher = resolveDispatcher();
1654 return dispatcher.useLayoutEffect(create, deps);
1655}
1656function useCallback(callback, deps) {
1657 var dispatcher = resolveDispatcher();
1658 return dispatcher.useCallback(callback, deps);
1659}
1660function useMemo(create, deps) {
1661 var dispatcher = resolveDispatcher();
1662 return dispatcher.useMemo(create, deps);
1663}
1664function useImperativeHandle(ref, create, deps) {
1665 var dispatcher = resolveDispatcher();
1666 return dispatcher.useImperativeHandle(ref, create, deps);
1667}
1668function useDebugValue(value, formatterFn) {
1669 {
1670 var dispatcher = resolveDispatcher();
1671 return dispatcher.useDebugValue(value, formatterFn);
1672 }
1673}
1674
1675// Helpers to patch console.logs to avoid logging during side-effect free
1676// replaying on render function. This currently only patches the object
1677// lazily which won't cover if the log function was extracted eagerly.
1678// We could also eagerly patch the method.
1679var disabledDepth = 0;
1680var prevLog;
1681var prevInfo;
1682var prevWarn;
1683var prevError;
1684var prevGroup;
1685var prevGroupCollapsed;
1686var prevGroupEnd;
1687
1688function disabledLog() {}
1689
1690disabledLog.__reactDisabledLog = true;
1691function disableLogs() {
1692 {
1693 if (disabledDepth === 0) {
1694 /* eslint-disable react-internal/no-production-logging */
1695 prevLog = console.log;
1696 prevInfo = console.info;
1697 prevWarn = console.warn;
1698 prevError = console.error;
1699 prevGroup = console.group;
1700 prevGroupCollapsed = console.groupCollapsed;
1701 prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099
1702
1703 var props = {
1704 configurable: true,
1705 enumerable: true,
1706 value: disabledLog,
1707 writable: true
1708 }; // $FlowFixMe Flow thinks console is immutable.
1709
1710 Object.defineProperties(console, {
1711 info: props,
1712 log: props,
1713 warn: props,
1714 error: props,
1715 group: props,
1716 groupCollapsed: props,
1717 groupEnd: props
1718 });
1719 /* eslint-enable react-internal/no-production-logging */
1720 }
1721
1722 disabledDepth++;
1723 }
1724}
1725function reenableLogs() {
1726 {
1727 disabledDepth--;
1728
1729 if (disabledDepth === 0) {
1730 /* eslint-disable react-internal/no-production-logging */
1731 var props = {
1732 configurable: true,
1733 enumerable: true,
1734 writable: true
1735 }; // $FlowFixMe Flow thinks console is immutable.
1736
1737 Object.defineProperties(console, {
1738 log: _assign({}, props, {
1739 value: prevLog
1740 }),
1741 info: _assign({}, props, {
1742 value: prevInfo
1743 }),
1744 warn: _assign({}, props, {
1745 value: prevWarn
1746 }),
1747 error: _assign({}, props, {
1748 value: prevError
1749 }),
1750 group: _assign({}, props, {
1751 value: prevGroup
1752 }),
1753 groupCollapsed: _assign({}, props, {
1754 value: prevGroupCollapsed
1755 }),
1756 groupEnd: _assign({}, props, {
1757 value: prevGroupEnd
1758 })
1759 });
1760 /* eslint-enable react-internal/no-production-logging */
1761 }
1762
1763 if (disabledDepth < 0) {
1764 error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.');
1765 }
1766 }
1767}
1768
1769var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher;
1770var prefix;
1771function describeBuiltInComponentFrame(name, source, ownerFn) {
1772 {
1773 if (prefix === undefined) {
1774 // Extract the VM specific prefix used by each line.
1775 try {
1776 throw Error();
1777 } catch (x) {
1778 var match = x.stack.trim().match(/\n( *(at )?)/);
1779 prefix = match && match[1] || '';
1780 }
1781 } // We use the prefix to ensure our stacks line up with native stack frames.
1782
1783
1784 return '\n' + prefix + name;
1785 }
1786}
1787var reentry = false;
1788var componentFrameCache;
1789
1790{
1791 var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map;
1792 componentFrameCache = new PossiblyWeakMap();
1793}
1794
1795function describeNativeComponentFrame(fn, construct) {
1796 // If something asked for a stack inside a fake render, it should get ignored.
1797 if (!fn || reentry) {
1798 return '';
1799 }
1800
1801 {
1802 var frame = componentFrameCache.get(fn);
1803
1804 if (frame !== undefined) {
1805 return frame;
1806 }
1807 }
1808
1809 var control;
1810 reentry = true;
1811 var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe It does accept undefined.
1812
1813 Error.prepareStackTrace = undefined;
1814 var previousDispatcher;
1815
1816 {
1817 previousDispatcher = ReactCurrentDispatcher$1.current; // Set the dispatcher in DEV because this might be call in the render function
1818 // for warnings.
1819
1820 ReactCurrentDispatcher$1.current = null;
1821 disableLogs();
1822 }
1823
1824 try {
1825 // This should throw.
1826 if (construct) {
1827 // Something should be setting the props in the constructor.
1828 var Fake = function () {
1829 throw Error();
1830 }; // $FlowFixMe
1831
1832
1833 Object.defineProperty(Fake.prototype, 'props', {
1834 set: function () {
1835 // We use a throwing setter instead of frozen or non-writable props
1836 // because that won't throw in a non-strict mode function.
1837 throw Error();
1838 }
1839 });
1840
1841 if (typeof Reflect === 'object' && Reflect.construct) {
1842 // We construct a different control for this case to include any extra
1843 // frames added by the construct call.
1844 try {
1845 Reflect.construct(Fake, []);
1846 } catch (x) {
1847 control = x;
1848 }
1849
1850 Reflect.construct(fn, [], Fake);
1851 } else {
1852 try {
1853 Fake.call();
1854 } catch (x) {
1855 control = x;
1856 }
1857
1858 fn.call(Fake.prototype);
1859 }
1860 } else {
1861 try {
1862 throw Error();
1863 } catch (x) {
1864 control = x;
1865 }
1866
1867 fn();
1868 }
1869 } catch (sample) {
1870 // This is inlined manually because closure doesn't do it for us.
1871 if (sample && control && typeof sample.stack === 'string') {
1872 // This extracts the first frame from the sample that isn't also in the control.
1873 // Skipping one frame that we assume is the frame that calls the two.
1874 var sampleLines = sample.stack.split('\n');
1875 var controlLines = control.stack.split('\n');
1876 var s = sampleLines.length - 1;
1877 var c = controlLines.length - 1;
1878
1879 while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) {
1880 // We expect at least one stack frame to be shared.
1881 // Typically this will be the root most one. However, stack frames may be
1882 // cut off due to maximum stack limits. In this case, one maybe cut off
1883 // earlier than the other. We assume that the sample is longer or the same
1884 // and there for cut off earlier. So we should find the root most frame in
1885 // the sample somewhere in the control.
1886 c--;
1887 }
1888
1889 for (; s >= 1 && c >= 0; s--, c--) {
1890 // Next we find the first one that isn't the same which should be the
1891 // frame that called our sample function and the control.
1892 if (sampleLines[s] !== controlLines[c]) {
1893 // In V8, the first line is describing the message but other VMs don't.
1894 // If we're about to return the first line, and the control is also on the same
1895 // line, that's a pretty good indicator that our sample threw at same line as
1896 // the control. I.e. before we entered the sample frame. So we ignore this result.
1897 // This can happen if you passed a class to function component, or non-function.
1898 if (s !== 1 || c !== 1) {
1899 do {
1900 s--;
1901 c--; // We may still have similar intermediate frames from the construct call.
1902 // The next one that isn't the same should be our match though.
1903
1904 if (c < 0 || sampleLines[s] !== controlLines[c]) {
1905 // V8 adds a "new" prefix for native classes. Let's remove it to make it prettier.
1906 var _frame = '\n' + sampleLines[s].replace(' at new ', ' at ');
1907
1908 {
1909 if (typeof fn === 'function') {
1910 componentFrameCache.set(fn, _frame);
1911 }
1912 } // Return the line we found.
1913
1914
1915 return _frame;
1916 }
1917 } while (s >= 1 && c >= 0);
1918 }
1919
1920 break;
1921 }
1922 }
1923 }
1924 } finally {
1925 reentry = false;
1926
1927 {
1928 ReactCurrentDispatcher$1.current = previousDispatcher;
1929 reenableLogs();
1930 }
1931
1932 Error.prepareStackTrace = previousPrepareStackTrace;
1933 } // Fallback to just using the name if we couldn't make it throw.
1934
1935
1936 var name = fn ? fn.displayName || fn.name : '';
1937 var syntheticFrame = name ? describeBuiltInComponentFrame(name) : '';
1938
1939 {
1940 if (typeof fn === 'function') {
1941 componentFrameCache.set(fn, syntheticFrame);
1942 }
1943 }
1944
1945 return syntheticFrame;
1946}
1947function describeFunctionComponentFrame(fn, source, ownerFn) {
1948 {
1949 return describeNativeComponentFrame(fn, false);
1950 }
1951}
1952
1953function shouldConstruct(Component) {
1954 var prototype = Component.prototype;
1955 return !!(prototype && prototype.isReactComponent);
1956}
1957
1958function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) {
1959
1960 if (type == null) {
1961 return '';
1962 }
1963
1964 if (typeof type === 'function') {
1965 {
1966 return describeNativeComponentFrame(type, shouldConstruct(type));
1967 }
1968 }
1969
1970 if (typeof type === 'string') {
1971 return describeBuiltInComponentFrame(type);
1972 }
1973
1974 switch (type) {
1975 case exports.Suspense:
1976 return describeBuiltInComponentFrame('Suspense');
1977
1978 case REACT_SUSPENSE_LIST_TYPE:
1979 return describeBuiltInComponentFrame('SuspenseList');
1980 }
1981
1982 if (typeof type === 'object') {
1983 switch (type.$$typeof) {
1984 case REACT_FORWARD_REF_TYPE:
1985 return describeFunctionComponentFrame(type.render);
1986
1987 case REACT_MEMO_TYPE:
1988 // Memo may contain any component type so we recursively resolve it.
1989 return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn);
1990
1991 case REACT_BLOCK_TYPE:
1992 return describeFunctionComponentFrame(type._render);
1993
1994 case REACT_LAZY_TYPE:
1995 {
1996 var lazyComponent = type;
1997 var payload = lazyComponent._payload;
1998 var init = lazyComponent._init;
1999
2000 try {
2001 // Lazy may contain any component type so we recursively resolve it.
2002 return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn);
2003 } catch (x) {}
2004 }
2005 }
2006 }
2007
2008 return '';
2009}
2010
2011var loggedTypeFailures = {};
2012var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
2013
2014function setCurrentlyValidatingElement(element) {
2015 {
2016 if (element) {
2017 var owner = element._owner;
2018 var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
2019 ReactDebugCurrentFrame$1.setExtraStackFrame(stack);
2020 } else {
2021 ReactDebugCurrentFrame$1.setExtraStackFrame(null);
2022 }
2023 }
2024}
2025
2026function checkPropTypes(typeSpecs, values, location, componentName, element) {
2027 {
2028 // $FlowFixMe This is okay but Flow doesn't know it.
2029 var has = Function.call.bind(Object.prototype.hasOwnProperty);
2030
2031 for (var typeSpecName in typeSpecs) {
2032 if (has(typeSpecs, typeSpecName)) {
2033 var error$1 = void 0; // Prop type validation may throw. In case they do, we don't want to
2034 // fail the render phase where it didn't fail before. So we log it.
2035 // After these have been cleaned up, we'll let them throw.
2036
2037 try {
2038 // This is intentionally an invariant that gets caught. It's the same
2039 // behavior as without this statement except with a better message.
2040 if (typeof typeSpecs[typeSpecName] !== 'function') {
2041 var err = Error((componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' + 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' + 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.');
2042 err.name = 'Invariant Violation';
2043 throw err;
2044 }
2045
2046 error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED');
2047 } catch (ex) {
2048 error$1 = ex;
2049 }
2050
2051 if (error$1 && !(error$1 instanceof Error)) {
2052 setCurrentlyValidatingElement(element);
2053
2054 error('%s: type specification of %s' + ' `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', location, typeSpecName, typeof error$1);
2055
2056 setCurrentlyValidatingElement(null);
2057 }
2058
2059 if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {
2060 // Only monitor this failure once because there tends to be a lot of the
2061 // same error.
2062 loggedTypeFailures[error$1.message] = true;
2063 setCurrentlyValidatingElement(element);
2064
2065 error('Failed %s type: %s', location, error$1.message);
2066
2067 setCurrentlyValidatingElement(null);
2068 }
2069 }
2070 }
2071 }
2072}
2073
2074function setCurrentlyValidatingElement$1(element) {
2075 {
2076 if (element) {
2077 var owner = element._owner;
2078 var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
2079 setExtraStackFrame(stack);
2080 } else {
2081 setExtraStackFrame(null);
2082 }
2083 }
2084}
2085
2086var propTypesMisspellWarningShown;
2087
2088{
2089 propTypesMisspellWarningShown = false;
2090}
2091
2092function getDeclarationErrorAddendum() {
2093 if (ReactCurrentOwner.current) {
2094 var name = getComponentName(ReactCurrentOwner.current.type);
2095
2096 if (name) {
2097 return '\n\nCheck the render method of `' + name + '`.';
2098 }
2099 }
2100
2101 return '';
2102}
2103
2104function getSourceInfoErrorAddendum(source) {
2105 if (source !== undefined) {
2106 var fileName = source.fileName.replace(/^.*[\\\/]/, '');
2107 var lineNumber = source.lineNumber;
2108 return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.';
2109 }
2110
2111 return '';
2112}
2113
2114function getSourceInfoErrorAddendumForProps(elementProps) {
2115 if (elementProps !== null && elementProps !== undefined) {
2116 return getSourceInfoErrorAddendum(elementProps.__source);
2117 }
2118
2119 return '';
2120}
2121/**
2122 * Warn if there's no key explicitly set on dynamic arrays of children or
2123 * object keys are not valid. This allows us to keep track of children between
2124 * updates.
2125 */
2126
2127
2128var ownerHasKeyUseWarning = {};
2129
2130function getCurrentComponentErrorInfo(parentType) {
2131 var info = getDeclarationErrorAddendum();
2132
2133 if (!info) {
2134 var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;
2135
2136 if (parentName) {
2137 info = "\n\nCheck the top-level render call using <" + parentName + ">.";
2138 }
2139 }
2140
2141 return info;
2142}
2143/**
2144 * Warn if the element doesn't have an explicit key assigned to it.
2145 * This element is in an array. The array could grow and shrink or be
2146 * reordered. All children that haven't already been validated are required to
2147 * have a "key" property assigned to it. Error statuses are cached so a warning
2148 * will only be shown once.
2149 *
2150 * @internal
2151 * @param {ReactElement} element Element that requires a key.
2152 * @param {*} parentType element's parent's type.
2153 */
2154
2155
2156function validateExplicitKey(element, parentType) {
2157 if (!element._store || element._store.validated || element.key != null) {
2158 return;
2159 }
2160
2161 element._store.validated = true;
2162 var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
2163
2164 if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
2165 return;
2166 }
2167
2168 ownerHasKeyUseWarning[currentComponentErrorInfo] = true; // Usually the current owner is the offender, but if it accepts children as a
2169 // property, it may be the creator of the child that's responsible for
2170 // assigning it a key.
2171
2172 var childOwner = '';
2173
2174 if (element && element._owner && element._owner !== ReactCurrentOwner.current) {
2175 // Give the component that originally created this child.
2176 childOwner = " It was passed a child from " + getComponentName(element._owner.type) + ".";
2177 }
2178
2179 {
2180 setCurrentlyValidatingElement$1(element);
2181
2182 error('Each child in a list should have a unique "key" prop.' + '%s%s See https://reactjs.org/link/warning-keys for more information.', currentComponentErrorInfo, childOwner);
2183
2184 setCurrentlyValidatingElement$1(null);
2185 }
2186}
2187/**
2188 * Ensure that every element either is passed in a static location, in an
2189 * array with an explicit keys property defined, or in an object literal
2190 * with valid key property.
2191 *
2192 * @internal
2193 * @param {ReactNode} node Statically passed child of any type.
2194 * @param {*} parentType node's parent's type.
2195 */
2196
2197
2198function validateChildKeys(node, parentType) {
2199 if (typeof node !== 'object') {
2200 return;
2201 }
2202
2203 if (Array.isArray(node)) {
2204 for (var i = 0; i < node.length; i++) {
2205 var child = node[i];
2206
2207 if (isValidElement(child)) {
2208 validateExplicitKey(child, parentType);
2209 }
2210 }
2211 } else if (isValidElement(node)) {
2212 // This element was passed in a valid location.
2213 if (node._store) {
2214 node._store.validated = true;
2215 }
2216 } else if (node) {
2217 var iteratorFn = getIteratorFn(node);
2218
2219 if (typeof iteratorFn === 'function') {
2220 // Entry iterators used to provide implicit keys,
2221 // but now we print a separate warning for them later.
2222 if (iteratorFn !== node.entries) {
2223 var iterator = iteratorFn.call(node);
2224 var step;
2225
2226 while (!(step = iterator.next()).done) {
2227 if (isValidElement(step.value)) {
2228 validateExplicitKey(step.value, parentType);
2229 }
2230 }
2231 }
2232 }
2233 }
2234}
2235/**
2236 * Given an element, validate that its props follow the propTypes definition,
2237 * provided by the type.
2238 *
2239 * @param {ReactElement} element
2240 */
2241
2242
2243function validatePropTypes(element) {
2244 {
2245 var type = element.type;
2246
2247 if (type === null || type === undefined || typeof type === 'string') {
2248 return;
2249 }
2250
2251 var propTypes;
2252
2253 if (typeof type === 'function') {
2254 propTypes = type.propTypes;
2255 } else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here.
2256 // Inner props are checked in the reconciler.
2257 type.$$typeof === REACT_MEMO_TYPE)) {
2258 propTypes = type.propTypes;
2259 } else {
2260 return;
2261 }
2262
2263 if (propTypes) {
2264 // Intentionally inside to avoid triggering lazy initializers:
2265 var name = getComponentName(type);
2266 checkPropTypes(propTypes, element.props, 'prop', name, element);
2267 } else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {
2268 propTypesMisspellWarningShown = true; // Intentionally inside to avoid triggering lazy initializers:
2269
2270 var _name = getComponentName(type);
2271
2272 error('Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', _name || 'Unknown');
2273 }
2274
2275 if (typeof type.getDefaultProps === 'function' && !type.getDefaultProps.isReactClassApproved) {
2276 error('getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.');
2277 }
2278 }
2279}
2280/**
2281 * Given a fragment, validate that it can only be provided with fragment props
2282 * @param {ReactElement} fragment
2283 */
2284
2285
2286function validateFragmentProps(fragment) {
2287 {
2288 var keys = Object.keys(fragment.props);
2289
2290 for (var i = 0; i < keys.length; i++) {
2291 var key = keys[i];
2292
2293 if (key !== 'children' && key !== 'key') {
2294 setCurrentlyValidatingElement$1(fragment);
2295
2296 error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);
2297
2298 setCurrentlyValidatingElement$1(null);
2299 break;
2300 }
2301 }
2302
2303 if (fragment.ref !== null) {
2304 setCurrentlyValidatingElement$1(fragment);
2305
2306 error('Invalid attribute `ref` supplied to `React.Fragment`.');
2307
2308 setCurrentlyValidatingElement$1(null);
2309 }
2310 }
2311}
2312function createElementWithValidation(type, props, children) {
2313 var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to
2314 // succeed and there will likely be errors in render.
2315
2316 if (!validType) {
2317 var info = '';
2318
2319 if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
2320 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.";
2321 }
2322
2323 var sourceInfo = getSourceInfoErrorAddendumForProps(props);
2324
2325 if (sourceInfo) {
2326 info += sourceInfo;
2327 } else {
2328 info += getDeclarationErrorAddendum();
2329 }
2330
2331 var typeString;
2332
2333 if (type === null) {
2334 typeString = 'null';
2335 } else if (Array.isArray(type)) {
2336 typeString = 'array';
2337 } else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {
2338 typeString = "<" + (getComponentName(type.type) || 'Unknown') + " />";
2339 info = ' Did you accidentally export a JSX literal instead of a component?';
2340 } else {
2341 typeString = typeof type;
2342 }
2343
2344 {
2345 error('React.createElement: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', typeString, info);
2346 }
2347 }
2348
2349 var element = createElement.apply(this, arguments); // The result can be nullish if a mock or a custom function is used.
2350 // TODO: Drop this when these are no longer allowed as the type argument.
2351
2352 if (element == null) {
2353 return element;
2354 } // Skip key warning if the type isn't valid since our key validation logic
2355 // doesn't expect a non-string/function type and can throw confusing errors.
2356 // We don't want exception behavior to differ between dev and prod.
2357 // (Rendering will throw with a helpful message and as soon as the type is
2358 // fixed, the key warnings will appear.)
2359
2360
2361 if (validType) {
2362 for (var i = 2; i < arguments.length; i++) {
2363 validateChildKeys(arguments[i], type);
2364 }
2365 }
2366
2367 if (type === exports.Fragment) {
2368 validateFragmentProps(element);
2369 } else {
2370 validatePropTypes(element);
2371 }
2372
2373 return element;
2374}
2375var didWarnAboutDeprecatedCreateFactory = false;
2376function createFactoryWithValidation(type) {
2377 var validatedFactory = createElementWithValidation.bind(null, type);
2378 validatedFactory.type = type;
2379
2380 {
2381 if (!didWarnAboutDeprecatedCreateFactory) {
2382 didWarnAboutDeprecatedCreateFactory = true;
2383
2384 warn('React.createFactory() is deprecated and will be removed in ' + 'a future major release. Consider using JSX ' + 'or use React.createElement() directly instead.');
2385 } // Legacy hook: remove it
2386
2387
2388 Object.defineProperty(validatedFactory, 'type', {
2389 enumerable: false,
2390 get: function () {
2391 warn('Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.');
2392
2393 Object.defineProperty(this, 'type', {
2394 value: type
2395 });
2396 return type;
2397 }
2398 });
2399 }
2400
2401 return validatedFactory;
2402}
2403function cloneElementWithValidation(element, props, children) {
2404 var newElement = cloneElement.apply(this, arguments);
2405
2406 for (var i = 2; i < arguments.length; i++) {
2407 validateChildKeys(arguments[i], newElement.type);
2408 }
2409
2410 validatePropTypes(newElement);
2411 return newElement;
2412}
2413
2414{
2415
2416 try {
2417 var frozenObject = Object.freeze({});
2418 /* eslint-disable no-new */
2419
2420 new Map([[frozenObject, null]]);
2421 new Set([frozenObject]);
2422 /* eslint-enable no-new */
2423 } catch (e) {
2424 }
2425}
2426
2427var createElement$1 = createElementWithValidation ;
2428var cloneElement$1 = cloneElementWithValidation ;
2429var createFactory = createFactoryWithValidation ;
2430var Children = {
2431 map: mapChildren,
2432 forEach: forEachChildren,
2433 count: countChildren,
2434 toArray: toArray,
2435 only: onlyChild
2436};
2437
2438exports.Children = Children;
2439exports.Component = Component;
2440exports.PureComponent = PureComponent;
2441exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactSharedInternals;
2442exports.cloneElement = cloneElement$1;
2443exports.createContext = createContext;
2444exports.createElement = createElement$1;
2445exports.createFactory = createFactory;
2446exports.createRef = createRef;
2447exports.forwardRef = forwardRef;
2448exports.isValidElement = isValidElement;
2449exports.lazy = lazy;
2450exports.memo = memo;
2451exports.useCallback = useCallback;
2452exports.useContext = useContext;
2453exports.useDebugValue = useDebugValue;
2454exports.useEffect = useEffect;
2455exports.useImperativeHandle = useImperativeHandle;
2456exports.useLayoutEffect = useLayoutEffect;
2457exports.useMemo = useMemo;
2458exports.useReducer = useReducer;
2459exports.useRef = useRef;
2460exports.useState = useState;
2461exports.version = ReactVersion;
2462 })();
2463}
2464});
2465react_development.Fragment;
2466react_development.StrictMode;
2467react_development.Profiler;
2468react_development.Suspense;
2469react_development.Children;
2470react_development.Component;
2471react_development.PureComponent;
2472react_development.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
2473react_development.cloneElement;
2474react_development.createContext;
2475react_development.createElement;
2476react_development.createFactory;
2477react_development.createRef;
2478react_development.forwardRef;
2479react_development.isValidElement;
2480react_development.lazy;
2481react_development.memo;
2482react_development.useCallback;
2483react_development.useContext;
2484react_development.useDebugValue;
2485react_development.useEffect;
2486react_development.useImperativeHandle;
2487react_development.useLayoutEffect;
2488react_development.useMemo;
2489react_development.useReducer;
2490react_development.useRef;
2491react_development.useState;
2492react_development.version;
2493
2494var react = createCommonjsModule(function (module) {
2495
2496if (process.env.NODE_ENV === 'production') {
2497 module.exports = react_production_min;
2498} else {
2499 module.exports = react_development;
2500}
2501});
2502
2503/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
2504var devtools = {
2505 version: react.version
2506};
2507
2508try {
2509 require.resolve('react-devtools-core');
2510
2511 const defineProperty = Object.defineProperty;
2512 defineProperty(commonjsGlobal, 'WebSocket', {
2513 value: require('ws')
2514 });
2515 defineProperty(commonjsGlobal, 'window', {
2516 value: commonjsGlobal
2517 });
2518
2519 const {
2520 connectToDevTools
2521 } = require('react-devtools-core');
2522
2523 connectToDevTools({
2524 isAppActive() {
2525 // Don't steal the DevTools from currently active app.
2526 return true;
2527 },
2528
2529 host: 'localhost',
2530 port: 8097,
2531 resolveRNStyle: null // TODO maybe: require('flattenStyle')
2532
2533 });
2534} catch (err) {// no devtools installed...
2535}
2536
2537function _defineProperty(obj, key, value) {
2538 if (key in obj) {
2539 Object.defineProperty(obj, key, {
2540 value: value,
2541 enumerable: true,
2542 configurable: true,
2543 writable: true
2544 });
2545 } else {
2546 obj[key] = value;
2547 }
2548
2549 return obj;
2550}
2551
2552function ownKeys(object, enumerableOnly) {
2553 var keys = Object.keys(object);
2554
2555 if (Object.getOwnPropertySymbols) {
2556 var symbols = Object.getOwnPropertySymbols(object);
2557 if (enumerableOnly) symbols = symbols.filter(function (sym) {
2558 return Object.getOwnPropertyDescriptor(object, sym).enumerable;
2559 });
2560 keys.push.apply(keys, symbols);
2561 }
2562
2563 return keys;
2564}
2565
2566function _objectSpread2(target) {
2567 for (var i = 1; i < arguments.length; i++) {
2568 var source = arguments[i] != null ? arguments[i] : {};
2569
2570 if (i % 2) {
2571 ownKeys(Object(source), true).forEach(function (key) {
2572 _defineProperty(target, key, source[key]);
2573 });
2574 } else if (Object.getOwnPropertyDescriptors) {
2575 Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
2576 } else {
2577 ownKeys(Object(source)).forEach(function (key) {
2578 Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
2579 });
2580 }
2581 }
2582
2583 return target;
2584}
2585
2586function _objectWithoutPropertiesLoose(source, excluded) {
2587 if (source == null) return {};
2588 var target = {};
2589 var sourceKeys = Object.keys(source);
2590 var key, i;
2591
2592 for (i = 0; i < sourceKeys.length; i++) {
2593 key = sourceKeys[i];
2594 if (excluded.indexOf(key) >= 0) continue;
2595 target[key] = source[key];
2596 }
2597
2598 return target;
2599}
2600
2601function _objectWithoutProperties(source, excluded) {
2602 if (source == null) return {};
2603
2604 var target = _objectWithoutPropertiesLoose(source, excluded);
2605
2606 var key, i;
2607
2608 if (Object.getOwnPropertySymbols) {
2609 var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
2610
2611 for (i = 0; i < sourceSymbolKeys.length; i++) {
2612 key = sourceSymbolKeys[i];
2613 if (excluded.indexOf(key) >= 0) continue;
2614 if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
2615 target[key] = source[key];
2616 }
2617 }
2618
2619 return target;
2620}
2621
2622const startCase = string => string.replace(/(?:^\w|[A-Z]|\b\w|\s+)/g, function (match) {
2623 return +match === 0 ? '' : match.toUpperCase();
2624}).replace(/[^A-Za-z0-9 ]+/, '');
2625
2626const eventName = event => `on${startCase(event)}`;
2627
2628const eventListener = (node, event, ...args) => {
2629 if (node._updating) return;
2630 const handler = node.props[eventName(event)];
2631 /*
2632 if (blacklist.indexOf(event) === -1) {
2633 if (handler) {
2634 console.log(event, ': ', startCase(event).replace(/ /g, ''));
2635 }
2636 }
2637 */
2638
2639 if (typeof handler === 'function') {
2640 if (event === 'focus' || event === 'blur') {
2641 args[0] = node;
2642 }
2643
2644 handler(...args);
2645 }
2646};
2647
2648/**
2649 * Removes all key-value entries from the list cache.
2650 *
2651 * @private
2652 * @name clear
2653 * @memberOf ListCache
2654 */
2655function listCacheClear() {
2656 this.__data__ = [];
2657 this.size = 0;
2658}
2659
2660var _listCacheClear = listCacheClear;
2661
2662/**
2663 * Performs a
2664 * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
2665 * comparison between two values to determine if they are equivalent.
2666 *
2667 * @static
2668 * @memberOf _
2669 * @since 4.0.0
2670 * @category Lang
2671 * @param {*} value The value to compare.
2672 * @param {*} other The other value to compare.
2673 * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
2674 * @example
2675 *
2676 * var object = { 'a': 1 };
2677 * var other = { 'a': 1 };
2678 *
2679 * _.eq(object, object);
2680 * // => true
2681 *
2682 * _.eq(object, other);
2683 * // => false
2684 *
2685 * _.eq('a', 'a');
2686 * // => true
2687 *
2688 * _.eq('a', Object('a'));
2689 * // => false
2690 *
2691 * _.eq(NaN, NaN);
2692 * // => true
2693 */
2694function eq(value, other) {
2695 return value === other || (value !== value && other !== other);
2696}
2697
2698var eq_1 = eq;
2699
2700/**
2701 * Gets the index at which the `key` is found in `array` of key-value pairs.
2702 *
2703 * @private
2704 * @param {Array} array The array to inspect.
2705 * @param {*} key The key to search for.
2706 * @returns {number} Returns the index of the matched value, else `-1`.
2707 */
2708function assocIndexOf(array, key) {
2709 var length = array.length;
2710 while (length--) {
2711 if (eq_1(array[length][0], key)) {
2712 return length;
2713 }
2714 }
2715 return -1;
2716}
2717
2718var _assocIndexOf = assocIndexOf;
2719
2720/** Used for built-in method references. */
2721var arrayProto = Array.prototype;
2722
2723/** Built-in value references. */
2724var splice = arrayProto.splice;
2725
2726/**
2727 * Removes `key` and its value from the list cache.
2728 *
2729 * @private
2730 * @name delete
2731 * @memberOf ListCache
2732 * @param {string} key The key of the value to remove.
2733 * @returns {boolean} Returns `true` if the entry was removed, else `false`.
2734 */
2735function listCacheDelete(key) {
2736 var data = this.__data__,
2737 index = _assocIndexOf(data, key);
2738
2739 if (index < 0) {
2740 return false;
2741 }
2742 var lastIndex = data.length - 1;
2743 if (index == lastIndex) {
2744 data.pop();
2745 } else {
2746 splice.call(data, index, 1);
2747 }
2748 --this.size;
2749 return true;
2750}
2751
2752var _listCacheDelete = listCacheDelete;
2753
2754/**
2755 * Gets the list cache value for `key`.
2756 *
2757 * @private
2758 * @name get
2759 * @memberOf ListCache
2760 * @param {string} key The key of the value to get.
2761 * @returns {*} Returns the entry value.
2762 */
2763function listCacheGet(key) {
2764 var data = this.__data__,
2765 index = _assocIndexOf(data, key);
2766
2767 return index < 0 ? undefined : data[index][1];
2768}
2769
2770var _listCacheGet = listCacheGet;
2771
2772/**
2773 * Checks if a list cache value for `key` exists.
2774 *
2775 * @private
2776 * @name has
2777 * @memberOf ListCache
2778 * @param {string} key The key of the entry to check.
2779 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
2780 */
2781function listCacheHas(key) {
2782 return _assocIndexOf(this.__data__, key) > -1;
2783}
2784
2785var _listCacheHas = listCacheHas;
2786
2787/**
2788 * Sets the list cache `key` to `value`.
2789 *
2790 * @private
2791 * @name set
2792 * @memberOf ListCache
2793 * @param {string} key The key of the value to set.
2794 * @param {*} value The value to set.
2795 * @returns {Object} Returns the list cache instance.
2796 */
2797function listCacheSet(key, value) {
2798 var data = this.__data__,
2799 index = _assocIndexOf(data, key);
2800
2801 if (index < 0) {
2802 ++this.size;
2803 data.push([key, value]);
2804 } else {
2805 data[index][1] = value;
2806 }
2807 return this;
2808}
2809
2810var _listCacheSet = listCacheSet;
2811
2812/**
2813 * Creates an list cache object.
2814 *
2815 * @private
2816 * @constructor
2817 * @param {Array} [entries] The key-value pairs to cache.
2818 */
2819function ListCache(entries) {
2820 var index = -1,
2821 length = entries == null ? 0 : entries.length;
2822
2823 this.clear();
2824 while (++index < length) {
2825 var entry = entries[index];
2826 this.set(entry[0], entry[1]);
2827 }
2828}
2829
2830// Add methods to `ListCache`.
2831ListCache.prototype.clear = _listCacheClear;
2832ListCache.prototype['delete'] = _listCacheDelete;
2833ListCache.prototype.get = _listCacheGet;
2834ListCache.prototype.has = _listCacheHas;
2835ListCache.prototype.set = _listCacheSet;
2836
2837var _ListCache = ListCache;
2838
2839/**
2840 * Removes all key-value entries from the stack.
2841 *
2842 * @private
2843 * @name clear
2844 * @memberOf Stack
2845 */
2846function stackClear() {
2847 this.__data__ = new _ListCache;
2848 this.size = 0;
2849}
2850
2851var _stackClear = stackClear;
2852
2853/**
2854 * Removes `key` and its value from the stack.
2855 *
2856 * @private
2857 * @name delete
2858 * @memberOf Stack
2859 * @param {string} key The key of the value to remove.
2860 * @returns {boolean} Returns `true` if the entry was removed, else `false`.
2861 */
2862function stackDelete(key) {
2863 var data = this.__data__,
2864 result = data['delete'](key);
2865
2866 this.size = data.size;
2867 return result;
2868}
2869
2870var _stackDelete = stackDelete;
2871
2872/**
2873 * Gets the stack value for `key`.
2874 *
2875 * @private
2876 * @name get
2877 * @memberOf Stack
2878 * @param {string} key The key of the value to get.
2879 * @returns {*} Returns the entry value.
2880 */
2881function stackGet(key) {
2882 return this.__data__.get(key);
2883}
2884
2885var _stackGet = stackGet;
2886
2887/**
2888 * Checks if a stack value for `key` exists.
2889 *
2890 * @private
2891 * @name has
2892 * @memberOf Stack
2893 * @param {string} key The key of the entry to check.
2894 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
2895 */
2896function stackHas(key) {
2897 return this.__data__.has(key);
2898}
2899
2900var _stackHas = stackHas;
2901
2902/** Detect free variable `global` from Node.js. */
2903var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
2904
2905var _freeGlobal = freeGlobal;
2906
2907/** Detect free variable `self`. */
2908var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
2909
2910/** Used as a reference to the global object. */
2911var root = _freeGlobal || freeSelf || Function('return this')();
2912
2913var _root = root;
2914
2915/** Built-in value references. */
2916var Symbol$1 = _root.Symbol;
2917
2918var _Symbol = Symbol$1;
2919
2920/** Used for built-in method references. */
2921var objectProto = Object.prototype;
2922
2923/** Used to check objects for own properties. */
2924var hasOwnProperty$1 = objectProto.hasOwnProperty;
2925
2926/**
2927 * Used to resolve the
2928 * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
2929 * of values.
2930 */
2931var nativeObjectToString = objectProto.toString;
2932
2933/** Built-in value references. */
2934var symToStringTag = _Symbol ? _Symbol.toStringTag : undefined;
2935
2936/**
2937 * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
2938 *
2939 * @private
2940 * @param {*} value The value to query.
2941 * @returns {string} Returns the raw `toStringTag`.
2942 */
2943function getRawTag(value) {
2944 var isOwn = hasOwnProperty$1.call(value, symToStringTag),
2945 tag = value[symToStringTag];
2946
2947 try {
2948 value[symToStringTag] = undefined;
2949 var unmasked = true;
2950 } catch (e) {}
2951
2952 var result = nativeObjectToString.call(value);
2953 if (unmasked) {
2954 if (isOwn) {
2955 value[symToStringTag] = tag;
2956 } else {
2957 delete value[symToStringTag];
2958 }
2959 }
2960 return result;
2961}
2962
2963var _getRawTag = getRawTag;
2964
2965/** Used for built-in method references. */
2966var objectProto$1 = Object.prototype;
2967
2968/**
2969 * Used to resolve the
2970 * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
2971 * of values.
2972 */
2973var nativeObjectToString$1 = objectProto$1.toString;
2974
2975/**
2976 * Converts `value` to a string using `Object.prototype.toString`.
2977 *
2978 * @private
2979 * @param {*} value The value to convert.
2980 * @returns {string} Returns the converted string.
2981 */
2982function objectToString(value) {
2983 return nativeObjectToString$1.call(value);
2984}
2985
2986var _objectToString = objectToString;
2987
2988/** `Object#toString` result references. */
2989var nullTag = '[object Null]',
2990 undefinedTag = '[object Undefined]';
2991
2992/** Built-in value references. */
2993var symToStringTag$1 = _Symbol ? _Symbol.toStringTag : undefined;
2994
2995/**
2996 * The base implementation of `getTag` without fallbacks for buggy environments.
2997 *
2998 * @private
2999 * @param {*} value The value to query.
3000 * @returns {string} Returns the `toStringTag`.
3001 */
3002function baseGetTag(value) {
3003 if (value == null) {
3004 return value === undefined ? undefinedTag : nullTag;
3005 }
3006 return (symToStringTag$1 && symToStringTag$1 in Object(value))
3007 ? _getRawTag(value)
3008 : _objectToString(value);
3009}
3010
3011var _baseGetTag = baseGetTag;
3012
3013/**
3014 * Checks if `value` is the
3015 * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
3016 * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
3017 *
3018 * @static
3019 * @memberOf _
3020 * @since 0.1.0
3021 * @category Lang
3022 * @param {*} value The value to check.
3023 * @returns {boolean} Returns `true` if `value` is an object, else `false`.
3024 * @example
3025 *
3026 * _.isObject({});
3027 * // => true
3028 *
3029 * _.isObject([1, 2, 3]);
3030 * // => true
3031 *
3032 * _.isObject(_.noop);
3033 * // => true
3034 *
3035 * _.isObject(null);
3036 * // => false
3037 */
3038function isObject(value) {
3039 var type = typeof value;
3040 return value != null && (type == 'object' || type == 'function');
3041}
3042
3043var isObject_1 = isObject;
3044
3045/** `Object#toString` result references. */
3046var asyncTag = '[object AsyncFunction]',
3047 funcTag = '[object Function]',
3048 genTag = '[object GeneratorFunction]',
3049 proxyTag = '[object Proxy]';
3050
3051/**
3052 * Checks if `value` is classified as a `Function` object.
3053 *
3054 * @static
3055 * @memberOf _
3056 * @since 0.1.0
3057 * @category Lang
3058 * @param {*} value The value to check.
3059 * @returns {boolean} Returns `true` if `value` is a function, else `false`.
3060 * @example
3061 *
3062 * _.isFunction(_);
3063 * // => true
3064 *
3065 * _.isFunction(/abc/);
3066 * // => false
3067 */
3068function isFunction(value) {
3069 if (!isObject_1(value)) {
3070 return false;
3071 }
3072 // The use of `Object#toString` avoids issues with the `typeof` operator
3073 // in Safari 9 which returns 'object' for typed arrays and other constructors.
3074 var tag = _baseGetTag(value);
3075 return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
3076}
3077
3078var isFunction_1 = isFunction;
3079
3080/** Used to detect overreaching core-js shims. */
3081var coreJsData = _root['__core-js_shared__'];
3082
3083var _coreJsData = coreJsData;
3084
3085/** Used to detect methods masquerading as native. */
3086var maskSrcKey = (function() {
3087 var uid = /[^.]+$/.exec(_coreJsData && _coreJsData.keys && _coreJsData.keys.IE_PROTO || '');
3088 return uid ? ('Symbol(src)_1.' + uid) : '';
3089}());
3090
3091/**
3092 * Checks if `func` has its source masked.
3093 *
3094 * @private
3095 * @param {Function} func The function to check.
3096 * @returns {boolean} Returns `true` if `func` is masked, else `false`.
3097 */
3098function isMasked(func) {
3099 return !!maskSrcKey && (maskSrcKey in func);
3100}
3101
3102var _isMasked = isMasked;
3103
3104/** Used for built-in method references. */
3105var funcProto = Function.prototype;
3106
3107/** Used to resolve the decompiled source of functions. */
3108var funcToString = funcProto.toString;
3109
3110/**
3111 * Converts `func` to its source code.
3112 *
3113 * @private
3114 * @param {Function} func The function to convert.
3115 * @returns {string} Returns the source code.
3116 */
3117function toSource(func) {
3118 if (func != null) {
3119 try {
3120 return funcToString.call(func);
3121 } catch (e) {}
3122 try {
3123 return (func + '');
3124 } catch (e) {}
3125 }
3126 return '';
3127}
3128
3129var _toSource = toSource;
3130
3131/**
3132 * Used to match `RegExp`
3133 * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
3134 */
3135var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
3136
3137/** Used to detect host constructors (Safari). */
3138var reIsHostCtor = /^\[object .+?Constructor\]$/;
3139
3140/** Used for built-in method references. */
3141var funcProto$1 = Function.prototype,
3142 objectProto$2 = Object.prototype;
3143
3144/** Used to resolve the decompiled source of functions. */
3145var funcToString$1 = funcProto$1.toString;
3146
3147/** Used to check objects for own properties. */
3148var hasOwnProperty$2 = objectProto$2.hasOwnProperty;
3149
3150/** Used to detect if a method is native. */
3151var reIsNative = RegExp('^' +
3152 funcToString$1.call(hasOwnProperty$2).replace(reRegExpChar, '\\$&')
3153 .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
3154);
3155
3156/**
3157 * The base implementation of `_.isNative` without bad shim checks.
3158 *
3159 * @private
3160 * @param {*} value The value to check.
3161 * @returns {boolean} Returns `true` if `value` is a native function,
3162 * else `false`.
3163 */
3164function baseIsNative(value) {
3165 if (!isObject_1(value) || _isMasked(value)) {
3166 return false;
3167 }
3168 var pattern = isFunction_1(value) ? reIsNative : reIsHostCtor;
3169 return pattern.test(_toSource(value));
3170}
3171
3172var _baseIsNative = baseIsNative;
3173
3174/**
3175 * Gets the value at `key` of `object`.
3176 *
3177 * @private
3178 * @param {Object} [object] The object to query.
3179 * @param {string} key The key of the property to get.
3180 * @returns {*} Returns the property value.
3181 */
3182function getValue(object, key) {
3183 return object == null ? undefined : object[key];
3184}
3185
3186var _getValue = getValue;
3187
3188/**
3189 * Gets the native function at `key` of `object`.
3190 *
3191 * @private
3192 * @param {Object} object The object to query.
3193 * @param {string} key The key of the method to get.
3194 * @returns {*} Returns the function if it's native, else `undefined`.
3195 */
3196function getNative(object, key) {
3197 var value = _getValue(object, key);
3198 return _baseIsNative(value) ? value : undefined;
3199}
3200
3201var _getNative = getNative;
3202
3203/* Built-in method references that are verified to be native. */
3204var Map$1 = _getNative(_root, 'Map');
3205
3206var _Map = Map$1;
3207
3208/* Built-in method references that are verified to be native. */
3209var nativeCreate = _getNative(Object, 'create');
3210
3211var _nativeCreate = nativeCreate;
3212
3213/**
3214 * Removes all key-value entries from the hash.
3215 *
3216 * @private
3217 * @name clear
3218 * @memberOf Hash
3219 */
3220function hashClear() {
3221 this.__data__ = _nativeCreate ? _nativeCreate(null) : {};
3222 this.size = 0;
3223}
3224
3225var _hashClear = hashClear;
3226
3227/**
3228 * Removes `key` and its value from the hash.
3229 *
3230 * @private
3231 * @name delete
3232 * @memberOf Hash
3233 * @param {Object} hash The hash to modify.
3234 * @param {string} key The key of the value to remove.
3235 * @returns {boolean} Returns `true` if the entry was removed, else `false`.
3236 */
3237function hashDelete(key) {
3238 var result = this.has(key) && delete this.__data__[key];
3239 this.size -= result ? 1 : 0;
3240 return result;
3241}
3242
3243var _hashDelete = hashDelete;
3244
3245/** Used to stand-in for `undefined` hash values. */
3246var HASH_UNDEFINED = '__lodash_hash_undefined__';
3247
3248/** Used for built-in method references. */
3249var objectProto$3 = Object.prototype;
3250
3251/** Used to check objects for own properties. */
3252var hasOwnProperty$3 = objectProto$3.hasOwnProperty;
3253
3254/**
3255 * Gets the hash value for `key`.
3256 *
3257 * @private
3258 * @name get
3259 * @memberOf Hash
3260 * @param {string} key The key of the value to get.
3261 * @returns {*} Returns the entry value.
3262 */
3263function hashGet(key) {
3264 var data = this.__data__;
3265 if (_nativeCreate) {
3266 var result = data[key];
3267 return result === HASH_UNDEFINED ? undefined : result;
3268 }
3269 return hasOwnProperty$3.call(data, key) ? data[key] : undefined;
3270}
3271
3272var _hashGet = hashGet;
3273
3274/** Used for built-in method references. */
3275var objectProto$4 = Object.prototype;
3276
3277/** Used to check objects for own properties. */
3278var hasOwnProperty$4 = objectProto$4.hasOwnProperty;
3279
3280/**
3281 * Checks if a hash value for `key` exists.
3282 *
3283 * @private
3284 * @name has
3285 * @memberOf Hash
3286 * @param {string} key The key of the entry to check.
3287 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
3288 */
3289function hashHas(key) {
3290 var data = this.__data__;
3291 return _nativeCreate ? (data[key] !== undefined) : hasOwnProperty$4.call(data, key);
3292}
3293
3294var _hashHas = hashHas;
3295
3296/** Used to stand-in for `undefined` hash values. */
3297var HASH_UNDEFINED$1 = '__lodash_hash_undefined__';
3298
3299/**
3300 * Sets the hash `key` to `value`.
3301 *
3302 * @private
3303 * @name set
3304 * @memberOf Hash
3305 * @param {string} key The key of the value to set.
3306 * @param {*} value The value to set.
3307 * @returns {Object} Returns the hash instance.
3308 */
3309function hashSet(key, value) {
3310 var data = this.__data__;
3311 this.size += this.has(key) ? 0 : 1;
3312 data[key] = (_nativeCreate && value === undefined) ? HASH_UNDEFINED$1 : value;
3313 return this;
3314}
3315
3316var _hashSet = hashSet;
3317
3318/**
3319 * Creates a hash object.
3320 *
3321 * @private
3322 * @constructor
3323 * @param {Array} [entries] The key-value pairs to cache.
3324 */
3325function Hash(entries) {
3326 var index = -1,
3327 length = entries == null ? 0 : entries.length;
3328
3329 this.clear();
3330 while (++index < length) {
3331 var entry = entries[index];
3332 this.set(entry[0], entry[1]);
3333 }
3334}
3335
3336// Add methods to `Hash`.
3337Hash.prototype.clear = _hashClear;
3338Hash.prototype['delete'] = _hashDelete;
3339Hash.prototype.get = _hashGet;
3340Hash.prototype.has = _hashHas;
3341Hash.prototype.set = _hashSet;
3342
3343var _Hash = Hash;
3344
3345/**
3346 * Removes all key-value entries from the map.
3347 *
3348 * @private
3349 * @name clear
3350 * @memberOf MapCache
3351 */
3352function mapCacheClear() {
3353 this.size = 0;
3354 this.__data__ = {
3355 'hash': new _Hash,
3356 'map': new (_Map || _ListCache),
3357 'string': new _Hash
3358 };
3359}
3360
3361var _mapCacheClear = mapCacheClear;
3362
3363/**
3364 * Checks if `value` is suitable for use as unique object key.
3365 *
3366 * @private
3367 * @param {*} value The value to check.
3368 * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
3369 */
3370function isKeyable(value) {
3371 var type = typeof value;
3372 return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
3373 ? (value !== '__proto__')
3374 : (value === null);
3375}
3376
3377var _isKeyable = isKeyable;
3378
3379/**
3380 * Gets the data for `map`.
3381 *
3382 * @private
3383 * @param {Object} map The map to query.
3384 * @param {string} key The reference key.
3385 * @returns {*} Returns the map data.
3386 */
3387function getMapData(map, key) {
3388 var data = map.__data__;
3389 return _isKeyable(key)
3390 ? data[typeof key == 'string' ? 'string' : 'hash']
3391 : data.map;
3392}
3393
3394var _getMapData = getMapData;
3395
3396/**
3397 * Removes `key` and its value from the map.
3398 *
3399 * @private
3400 * @name delete
3401 * @memberOf MapCache
3402 * @param {string} key The key of the value to remove.
3403 * @returns {boolean} Returns `true` if the entry was removed, else `false`.
3404 */
3405function mapCacheDelete(key) {
3406 var result = _getMapData(this, key)['delete'](key);
3407 this.size -= result ? 1 : 0;
3408 return result;
3409}
3410
3411var _mapCacheDelete = mapCacheDelete;
3412
3413/**
3414 * Gets the map value for `key`.
3415 *
3416 * @private
3417 * @name get
3418 * @memberOf MapCache
3419 * @param {string} key The key of the value to get.
3420 * @returns {*} Returns the entry value.
3421 */
3422function mapCacheGet(key) {
3423 return _getMapData(this, key).get(key);
3424}
3425
3426var _mapCacheGet = mapCacheGet;
3427
3428/**
3429 * Checks if a map value for `key` exists.
3430 *
3431 * @private
3432 * @name has
3433 * @memberOf MapCache
3434 * @param {string} key The key of the entry to check.
3435 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
3436 */
3437function mapCacheHas(key) {
3438 return _getMapData(this, key).has(key);
3439}
3440
3441var _mapCacheHas = mapCacheHas;
3442
3443/**
3444 * Sets the map `key` to `value`.
3445 *
3446 * @private
3447 * @name set
3448 * @memberOf MapCache
3449 * @param {string} key The key of the value to set.
3450 * @param {*} value The value to set.
3451 * @returns {Object} Returns the map cache instance.
3452 */
3453function mapCacheSet(key, value) {
3454 var data = _getMapData(this, key),
3455 size = data.size;
3456
3457 data.set(key, value);
3458 this.size += data.size == size ? 0 : 1;
3459 return this;
3460}
3461
3462var _mapCacheSet = mapCacheSet;
3463
3464/**
3465 * Creates a map cache object to store key-value pairs.
3466 *
3467 * @private
3468 * @constructor
3469 * @param {Array} [entries] The key-value pairs to cache.
3470 */
3471function MapCache(entries) {
3472 var index = -1,
3473 length = entries == null ? 0 : entries.length;
3474
3475 this.clear();
3476 while (++index < length) {
3477 var entry = entries[index];
3478 this.set(entry[0], entry[1]);
3479 }
3480}
3481
3482// Add methods to `MapCache`.
3483MapCache.prototype.clear = _mapCacheClear;
3484MapCache.prototype['delete'] = _mapCacheDelete;
3485MapCache.prototype.get = _mapCacheGet;
3486MapCache.prototype.has = _mapCacheHas;
3487MapCache.prototype.set = _mapCacheSet;
3488
3489var _MapCache = MapCache;
3490
3491/** Used as the size to enable large array optimizations. */
3492var LARGE_ARRAY_SIZE = 200;
3493
3494/**
3495 * Sets the stack `key` to `value`.
3496 *
3497 * @private
3498 * @name set
3499 * @memberOf Stack
3500 * @param {string} key The key of the value to set.
3501 * @param {*} value The value to set.
3502 * @returns {Object} Returns the stack cache instance.
3503 */
3504function stackSet(key, value) {
3505 var data = this.__data__;
3506 if (data instanceof _ListCache) {
3507 var pairs = data.__data__;
3508 if (!_Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
3509 pairs.push([key, value]);
3510 this.size = ++data.size;
3511 return this;
3512 }
3513 data = this.__data__ = new _MapCache(pairs);
3514 }
3515 data.set(key, value);
3516 this.size = data.size;
3517 return this;
3518}
3519
3520var _stackSet = stackSet;
3521
3522/**
3523 * Creates a stack cache object to store key-value pairs.
3524 *
3525 * @private
3526 * @constructor
3527 * @param {Array} [entries] The key-value pairs to cache.
3528 */
3529function Stack(entries) {
3530 var data = this.__data__ = new _ListCache(entries);
3531 this.size = data.size;
3532}
3533
3534// Add methods to `Stack`.
3535Stack.prototype.clear = _stackClear;
3536Stack.prototype['delete'] = _stackDelete;
3537Stack.prototype.get = _stackGet;
3538Stack.prototype.has = _stackHas;
3539Stack.prototype.set = _stackSet;
3540
3541var _Stack = Stack;
3542
3543var defineProperty = (function() {
3544 try {
3545 var func = _getNative(Object, 'defineProperty');
3546 func({}, '', {});
3547 return func;
3548 } catch (e) {}
3549}());
3550
3551var _defineProperty$1 = defineProperty;
3552
3553/**
3554 * The base implementation of `assignValue` and `assignMergeValue` without
3555 * value checks.
3556 *
3557 * @private
3558 * @param {Object} object The object to modify.
3559 * @param {string} key The key of the property to assign.
3560 * @param {*} value The value to assign.
3561 */
3562function baseAssignValue(object, key, value) {
3563 if (key == '__proto__' && _defineProperty$1) {
3564 _defineProperty$1(object, key, {
3565 'configurable': true,
3566 'enumerable': true,
3567 'value': value,
3568 'writable': true
3569 });
3570 } else {
3571 object[key] = value;
3572 }
3573}
3574
3575var _baseAssignValue = baseAssignValue;
3576
3577/**
3578 * This function is like `assignValue` except that it doesn't assign
3579 * `undefined` values.
3580 *
3581 * @private
3582 * @param {Object} object The object to modify.
3583 * @param {string} key The key of the property to assign.
3584 * @param {*} value The value to assign.
3585 */
3586function assignMergeValue(object, key, value) {
3587 if ((value !== undefined && !eq_1(object[key], value)) ||
3588 (value === undefined && !(key in object))) {
3589 _baseAssignValue(object, key, value);
3590 }
3591}
3592
3593var _assignMergeValue = assignMergeValue;
3594
3595/**
3596 * Creates a base function for methods like `_.forIn` and `_.forOwn`.
3597 *
3598 * @private
3599 * @param {boolean} [fromRight] Specify iterating from right to left.
3600 * @returns {Function} Returns the new base function.
3601 */
3602function createBaseFor(fromRight) {
3603 return function(object, iteratee, keysFunc) {
3604 var index = -1,
3605 iterable = Object(object),
3606 props = keysFunc(object),
3607 length = props.length;
3608
3609 while (length--) {
3610 var key = props[fromRight ? length : ++index];
3611 if (iteratee(iterable[key], key, iterable) === false) {
3612 break;
3613 }
3614 }
3615 return object;
3616 };
3617}
3618
3619var _createBaseFor = createBaseFor;
3620
3621/**
3622 * The base implementation of `baseForOwn` which iterates over `object`
3623 * properties returned by `keysFunc` and invokes `iteratee` for each property.
3624 * Iteratee functions may exit iteration early by explicitly returning `false`.
3625 *
3626 * @private
3627 * @param {Object} object The object to iterate over.
3628 * @param {Function} iteratee The function invoked per iteration.
3629 * @param {Function} keysFunc The function to get the keys of `object`.
3630 * @returns {Object} Returns `object`.
3631 */
3632var baseFor = _createBaseFor();
3633
3634var _baseFor = baseFor;
3635
3636var _cloneBuffer = createCommonjsModule(function (module, exports) {
3637/** Detect free variable `exports`. */
3638var freeExports = exports && !exports.nodeType && exports;
3639
3640/** Detect free variable `module`. */
3641var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
3642
3643/** Detect the popular CommonJS extension `module.exports`. */
3644var moduleExports = freeModule && freeModule.exports === freeExports;
3645
3646/** Built-in value references. */
3647var Buffer = moduleExports ? _root.Buffer : undefined,
3648 allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined;
3649
3650/**
3651 * Creates a clone of `buffer`.
3652 *
3653 * @private
3654 * @param {Buffer} buffer The buffer to clone.
3655 * @param {boolean} [isDeep] Specify a deep clone.
3656 * @returns {Buffer} Returns the cloned buffer.
3657 */
3658function cloneBuffer(buffer, isDeep) {
3659 if (isDeep) {
3660 return buffer.slice();
3661 }
3662 var length = buffer.length,
3663 result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
3664
3665 buffer.copy(result);
3666 return result;
3667}
3668
3669module.exports = cloneBuffer;
3670});
3671
3672/** Built-in value references. */
3673var Uint8Array = _root.Uint8Array;
3674
3675var _Uint8Array = Uint8Array;
3676
3677/**
3678 * Creates a clone of `arrayBuffer`.
3679 *
3680 * @private
3681 * @param {ArrayBuffer} arrayBuffer The array buffer to clone.
3682 * @returns {ArrayBuffer} Returns the cloned array buffer.
3683 */
3684function cloneArrayBuffer(arrayBuffer) {
3685 var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
3686 new _Uint8Array(result).set(new _Uint8Array(arrayBuffer));
3687 return result;
3688}
3689
3690var _cloneArrayBuffer = cloneArrayBuffer;
3691
3692/**
3693 * Creates a clone of `typedArray`.
3694 *
3695 * @private
3696 * @param {Object} typedArray The typed array to clone.
3697 * @param {boolean} [isDeep] Specify a deep clone.
3698 * @returns {Object} Returns the cloned typed array.
3699 */
3700function cloneTypedArray(typedArray, isDeep) {
3701 var buffer = isDeep ? _cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
3702 return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
3703}
3704
3705var _cloneTypedArray = cloneTypedArray;
3706
3707/**
3708 * Copies the values of `source` to `array`.
3709 *
3710 * @private
3711 * @param {Array} source The array to copy values from.
3712 * @param {Array} [array=[]] The array to copy values to.
3713 * @returns {Array} Returns `array`.
3714 */
3715function copyArray(source, array) {
3716 var index = -1,
3717 length = source.length;
3718
3719 array || (array = Array(length));
3720 while (++index < length) {
3721 array[index] = source[index];
3722 }
3723 return array;
3724}
3725
3726var _copyArray = copyArray;
3727
3728/** Built-in value references. */
3729var objectCreate = Object.create;
3730
3731/**
3732 * The base implementation of `_.create` without support for assigning
3733 * properties to the created object.
3734 *
3735 * @private
3736 * @param {Object} proto The object to inherit from.
3737 * @returns {Object} Returns the new object.
3738 */
3739var baseCreate = (function() {
3740 function object() {}
3741 return function(proto) {
3742 if (!isObject_1(proto)) {
3743 return {};
3744 }
3745 if (objectCreate) {
3746 return objectCreate(proto);
3747 }
3748 object.prototype = proto;
3749 var result = new object;
3750 object.prototype = undefined;
3751 return result;
3752 };
3753}());
3754
3755var _baseCreate = baseCreate;
3756
3757/**
3758 * Creates a unary function that invokes `func` with its argument transformed.
3759 *
3760 * @private
3761 * @param {Function} func The function to wrap.
3762 * @param {Function} transform The argument transform.
3763 * @returns {Function} Returns the new function.
3764 */
3765function overArg(func, transform) {
3766 return function(arg) {
3767 return func(transform(arg));
3768 };
3769}
3770
3771var _overArg = overArg;
3772
3773/** Built-in value references. */
3774var getPrototype = _overArg(Object.getPrototypeOf, Object);
3775
3776var _getPrototype = getPrototype;
3777
3778/** Used for built-in method references. */
3779var objectProto$5 = Object.prototype;
3780
3781/**
3782 * Checks if `value` is likely a prototype object.
3783 *
3784 * @private
3785 * @param {*} value The value to check.
3786 * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
3787 */
3788function isPrototype(value) {
3789 var Ctor = value && value.constructor,
3790 proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto$5;
3791
3792 return value === proto;
3793}
3794
3795var _isPrototype = isPrototype;
3796
3797/**
3798 * Initializes an object clone.
3799 *
3800 * @private
3801 * @param {Object} object The object to clone.
3802 * @returns {Object} Returns the initialized clone.
3803 */
3804function initCloneObject(object) {
3805 return (typeof object.constructor == 'function' && !_isPrototype(object))
3806 ? _baseCreate(_getPrototype(object))
3807 : {};
3808}
3809
3810var _initCloneObject = initCloneObject;
3811
3812/**
3813 * Checks if `value` is object-like. A value is object-like if it's not `null`
3814 * and has a `typeof` result of "object".
3815 *
3816 * @static
3817 * @memberOf _
3818 * @since 4.0.0
3819 * @category Lang
3820 * @param {*} value The value to check.
3821 * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
3822 * @example
3823 *
3824 * _.isObjectLike({});
3825 * // => true
3826 *
3827 * _.isObjectLike([1, 2, 3]);
3828 * // => true
3829 *
3830 * _.isObjectLike(_.noop);
3831 * // => false
3832 *
3833 * _.isObjectLike(null);
3834 * // => false
3835 */
3836function isObjectLike(value) {
3837 return value != null && typeof value == 'object';
3838}
3839
3840var isObjectLike_1 = isObjectLike;
3841
3842/** `Object#toString` result references. */
3843var argsTag = '[object Arguments]';
3844
3845/**
3846 * The base implementation of `_.isArguments`.
3847 *
3848 * @private
3849 * @param {*} value The value to check.
3850 * @returns {boolean} Returns `true` if `value` is an `arguments` object,
3851 */
3852function baseIsArguments(value) {
3853 return isObjectLike_1(value) && _baseGetTag(value) == argsTag;
3854}
3855
3856var _baseIsArguments = baseIsArguments;
3857
3858/** Used for built-in method references. */
3859var objectProto$6 = Object.prototype;
3860
3861/** Used to check objects for own properties. */
3862var hasOwnProperty$5 = objectProto$6.hasOwnProperty;
3863
3864/** Built-in value references. */
3865var propertyIsEnumerable = objectProto$6.propertyIsEnumerable;
3866
3867/**
3868 * Checks if `value` is likely an `arguments` object.
3869 *
3870 * @static
3871 * @memberOf _
3872 * @since 0.1.0
3873 * @category Lang
3874 * @param {*} value The value to check.
3875 * @returns {boolean} Returns `true` if `value` is an `arguments` object,
3876 * else `false`.
3877 * @example
3878 *
3879 * _.isArguments(function() { return arguments; }());
3880 * // => true
3881 *
3882 * _.isArguments([1, 2, 3]);
3883 * // => false
3884 */
3885var isArguments = _baseIsArguments(function() { return arguments; }()) ? _baseIsArguments : function(value) {
3886 return isObjectLike_1(value) && hasOwnProperty$5.call(value, 'callee') &&
3887 !propertyIsEnumerable.call(value, 'callee');
3888};
3889
3890var isArguments_1 = isArguments;
3891
3892/**
3893 * Checks if `value` is classified as an `Array` object.
3894 *
3895 * @static
3896 * @memberOf _
3897 * @since 0.1.0
3898 * @category Lang
3899 * @param {*} value The value to check.
3900 * @returns {boolean} Returns `true` if `value` is an array, else `false`.
3901 * @example
3902 *
3903 * _.isArray([1, 2, 3]);
3904 * // => true
3905 *
3906 * _.isArray(document.body.children);
3907 * // => false
3908 *
3909 * _.isArray('abc');
3910 * // => false
3911 *
3912 * _.isArray(_.noop);
3913 * // => false
3914 */
3915var isArray = Array.isArray;
3916
3917var isArray_1 = isArray;
3918
3919/** Used as references for various `Number` constants. */
3920var MAX_SAFE_INTEGER = 9007199254740991;
3921
3922/**
3923 * Checks if `value` is a valid array-like length.
3924 *
3925 * **Note:** This method is loosely based on
3926 * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
3927 *
3928 * @static
3929 * @memberOf _
3930 * @since 4.0.0
3931 * @category Lang
3932 * @param {*} value The value to check.
3933 * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
3934 * @example
3935 *
3936 * _.isLength(3);
3937 * // => true
3938 *
3939 * _.isLength(Number.MIN_VALUE);
3940 * // => false
3941 *
3942 * _.isLength(Infinity);
3943 * // => false
3944 *
3945 * _.isLength('3');
3946 * // => false
3947 */
3948function isLength(value) {
3949 return typeof value == 'number' &&
3950 value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
3951}
3952
3953var isLength_1 = isLength;
3954
3955/**
3956 * Checks if `value` is array-like. A value is considered array-like if it's
3957 * not a function and has a `value.length` that's an integer greater than or
3958 * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
3959 *
3960 * @static
3961 * @memberOf _
3962 * @since 4.0.0
3963 * @category Lang
3964 * @param {*} value The value to check.
3965 * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
3966 * @example
3967 *
3968 * _.isArrayLike([1, 2, 3]);
3969 * // => true
3970 *
3971 * _.isArrayLike(document.body.children);
3972 * // => true
3973 *
3974 * _.isArrayLike('abc');
3975 * // => true
3976 *
3977 * _.isArrayLike(_.noop);
3978 * // => false
3979 */
3980function isArrayLike(value) {
3981 return value != null && isLength_1(value.length) && !isFunction_1(value);
3982}
3983
3984var isArrayLike_1 = isArrayLike;
3985
3986/**
3987 * This method is like `_.isArrayLike` except that it also checks if `value`
3988 * is an object.
3989 *
3990 * @static
3991 * @memberOf _
3992 * @since 4.0.0
3993 * @category Lang
3994 * @param {*} value The value to check.
3995 * @returns {boolean} Returns `true` if `value` is an array-like object,
3996 * else `false`.
3997 * @example
3998 *
3999 * _.isArrayLikeObject([1, 2, 3]);
4000 * // => true
4001 *
4002 * _.isArrayLikeObject(document.body.children);
4003 * // => true
4004 *
4005 * _.isArrayLikeObject('abc');
4006 * // => false
4007 *
4008 * _.isArrayLikeObject(_.noop);
4009 * // => false
4010 */
4011function isArrayLikeObject(value) {
4012 return isObjectLike_1(value) && isArrayLike_1(value);
4013}
4014
4015var isArrayLikeObject_1 = isArrayLikeObject;
4016
4017/**
4018 * This method returns `false`.
4019 *
4020 * @static
4021 * @memberOf _
4022 * @since 4.13.0
4023 * @category Util
4024 * @returns {boolean} Returns `false`.
4025 * @example
4026 *
4027 * _.times(2, _.stubFalse);
4028 * // => [false, false]
4029 */
4030function stubFalse() {
4031 return false;
4032}
4033
4034var stubFalse_1 = stubFalse;
4035
4036var isBuffer_1 = createCommonjsModule(function (module, exports) {
4037/** Detect free variable `exports`. */
4038var freeExports = exports && !exports.nodeType && exports;
4039
4040/** Detect free variable `module`. */
4041var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
4042
4043/** Detect the popular CommonJS extension `module.exports`. */
4044var moduleExports = freeModule && freeModule.exports === freeExports;
4045
4046/** Built-in value references. */
4047var Buffer = moduleExports ? _root.Buffer : undefined;
4048
4049/* Built-in method references for those with the same name as other `lodash` methods. */
4050var nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined;
4051
4052/**
4053 * Checks if `value` is a buffer.
4054 *
4055 * @static
4056 * @memberOf _
4057 * @since 4.3.0
4058 * @category Lang
4059 * @param {*} value The value to check.
4060 * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
4061 * @example
4062 *
4063 * _.isBuffer(new Buffer(2));
4064 * // => true
4065 *
4066 * _.isBuffer(new Uint8Array(2));
4067 * // => false
4068 */
4069var isBuffer = nativeIsBuffer || stubFalse_1;
4070
4071module.exports = isBuffer;
4072});
4073
4074/** `Object#toString` result references. */
4075var objectTag = '[object Object]';
4076
4077/** Used for built-in method references. */
4078var funcProto$2 = Function.prototype,
4079 objectProto$7 = Object.prototype;
4080
4081/** Used to resolve the decompiled source of functions. */
4082var funcToString$2 = funcProto$2.toString;
4083
4084/** Used to check objects for own properties. */
4085var hasOwnProperty$6 = objectProto$7.hasOwnProperty;
4086
4087/** Used to infer the `Object` constructor. */
4088var objectCtorString = funcToString$2.call(Object);
4089
4090/**
4091 * Checks if `value` is a plain object, that is, an object created by the
4092 * `Object` constructor or one with a `[[Prototype]]` of `null`.
4093 *
4094 * @static
4095 * @memberOf _
4096 * @since 0.8.0
4097 * @category Lang
4098 * @param {*} value The value to check.
4099 * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
4100 * @example
4101 *
4102 * function Foo() {
4103 * this.a = 1;
4104 * }
4105 *
4106 * _.isPlainObject(new Foo);
4107 * // => false
4108 *
4109 * _.isPlainObject([1, 2, 3]);
4110 * // => false
4111 *
4112 * _.isPlainObject({ 'x': 0, 'y': 0 });
4113 * // => true
4114 *
4115 * _.isPlainObject(Object.create(null));
4116 * // => true
4117 */
4118function isPlainObject(value) {
4119 if (!isObjectLike_1(value) || _baseGetTag(value) != objectTag) {
4120 return false;
4121 }
4122 var proto = _getPrototype(value);
4123 if (proto === null) {
4124 return true;
4125 }
4126 var Ctor = hasOwnProperty$6.call(proto, 'constructor') && proto.constructor;
4127 return typeof Ctor == 'function' && Ctor instanceof Ctor &&
4128 funcToString$2.call(Ctor) == objectCtorString;
4129}
4130
4131var isPlainObject_1 = isPlainObject;
4132
4133/** `Object#toString` result references. */
4134var argsTag$1 = '[object Arguments]',
4135 arrayTag = '[object Array]',
4136 boolTag = '[object Boolean]',
4137 dateTag = '[object Date]',
4138 errorTag = '[object Error]',
4139 funcTag$1 = '[object Function]',
4140 mapTag = '[object Map]',
4141 numberTag = '[object Number]',
4142 objectTag$1 = '[object Object]',
4143 regexpTag = '[object RegExp]',
4144 setTag = '[object Set]',
4145 stringTag = '[object String]',
4146 weakMapTag = '[object WeakMap]';
4147
4148var arrayBufferTag = '[object ArrayBuffer]',
4149 dataViewTag = '[object DataView]',
4150 float32Tag = '[object Float32Array]',
4151 float64Tag = '[object Float64Array]',
4152 int8Tag = '[object Int8Array]',
4153 int16Tag = '[object Int16Array]',
4154 int32Tag = '[object Int32Array]',
4155 uint8Tag = '[object Uint8Array]',
4156 uint8ClampedTag = '[object Uint8ClampedArray]',
4157 uint16Tag = '[object Uint16Array]',
4158 uint32Tag = '[object Uint32Array]';
4159
4160/** Used to identify `toStringTag` values of typed arrays. */
4161var typedArrayTags = {};
4162typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
4163typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
4164typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
4165typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
4166typedArrayTags[uint32Tag] = true;
4167typedArrayTags[argsTag$1] = typedArrayTags[arrayTag] =
4168typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
4169typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
4170typedArrayTags[errorTag] = typedArrayTags[funcTag$1] =
4171typedArrayTags[mapTag] = typedArrayTags[numberTag] =
4172typedArrayTags[objectTag$1] = typedArrayTags[regexpTag] =
4173typedArrayTags[setTag] = typedArrayTags[stringTag] =
4174typedArrayTags[weakMapTag] = false;
4175
4176/**
4177 * The base implementation of `_.isTypedArray` without Node.js optimizations.
4178 *
4179 * @private
4180 * @param {*} value The value to check.
4181 * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
4182 */
4183function baseIsTypedArray(value) {
4184 return isObjectLike_1(value) &&
4185 isLength_1(value.length) && !!typedArrayTags[_baseGetTag(value)];
4186}
4187
4188var _baseIsTypedArray = baseIsTypedArray;
4189
4190/**
4191 * The base implementation of `_.unary` without support for storing metadata.
4192 *
4193 * @private
4194 * @param {Function} func The function to cap arguments for.
4195 * @returns {Function} Returns the new capped function.
4196 */
4197function baseUnary(func) {
4198 return function(value) {
4199 return func(value);
4200 };
4201}
4202
4203var _baseUnary = baseUnary;
4204
4205var _nodeUtil = createCommonjsModule(function (module, exports) {
4206/** Detect free variable `exports`. */
4207var freeExports = exports && !exports.nodeType && exports;
4208
4209/** Detect free variable `module`. */
4210var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
4211
4212/** Detect the popular CommonJS extension `module.exports`. */
4213var moduleExports = freeModule && freeModule.exports === freeExports;
4214
4215/** Detect free variable `process` from Node.js. */
4216var freeProcess = moduleExports && _freeGlobal.process;
4217
4218/** Used to access faster Node.js helpers. */
4219var nodeUtil = (function() {
4220 try {
4221 // Use `util.types` for Node.js 10+.
4222 var types = freeModule && freeModule.require && freeModule.require('util').types;
4223
4224 if (types) {
4225 return types;
4226 }
4227
4228 // Legacy `process.binding('util')` for Node.js < 10.
4229 return freeProcess && freeProcess.binding && freeProcess.binding('util');
4230 } catch (e) {}
4231}());
4232
4233module.exports = nodeUtil;
4234});
4235
4236/* Node.js helper references. */
4237var nodeIsTypedArray = _nodeUtil && _nodeUtil.isTypedArray;
4238
4239/**
4240 * Checks if `value` is classified as a typed array.
4241 *
4242 * @static
4243 * @memberOf _
4244 * @since 3.0.0
4245 * @category Lang
4246 * @param {*} value The value to check.
4247 * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
4248 * @example
4249 *
4250 * _.isTypedArray(new Uint8Array);
4251 * // => true
4252 *
4253 * _.isTypedArray([]);
4254 * // => false
4255 */
4256var isTypedArray = nodeIsTypedArray ? _baseUnary(nodeIsTypedArray) : _baseIsTypedArray;
4257
4258var isTypedArray_1 = isTypedArray;
4259
4260/**
4261 * Gets the value at `key`, unless `key` is "__proto__" or "constructor".
4262 *
4263 * @private
4264 * @param {Object} object The object to query.
4265 * @param {string} key The key of the property to get.
4266 * @returns {*} Returns the property value.
4267 */
4268function safeGet(object, key) {
4269 if (key === 'constructor' && typeof object[key] === 'function') {
4270 return;
4271 }
4272
4273 if (key == '__proto__') {
4274 return;
4275 }
4276
4277 return object[key];
4278}
4279
4280var _safeGet = safeGet;
4281
4282/** Used for built-in method references. */
4283var objectProto$8 = Object.prototype;
4284
4285/** Used to check objects for own properties. */
4286var hasOwnProperty$7 = objectProto$8.hasOwnProperty;
4287
4288/**
4289 * Assigns `value` to `key` of `object` if the existing value is not equivalent
4290 * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
4291 * for equality comparisons.
4292 *
4293 * @private
4294 * @param {Object} object The object to modify.
4295 * @param {string} key The key of the property to assign.
4296 * @param {*} value The value to assign.
4297 */
4298function assignValue(object, key, value) {
4299 var objValue = object[key];
4300 if (!(hasOwnProperty$7.call(object, key) && eq_1(objValue, value)) ||
4301 (value === undefined && !(key in object))) {
4302 _baseAssignValue(object, key, value);
4303 }
4304}
4305
4306var _assignValue = assignValue;
4307
4308/**
4309 * Copies properties of `source` to `object`.
4310 *
4311 * @private
4312 * @param {Object} source The object to copy properties from.
4313 * @param {Array} props The property identifiers to copy.
4314 * @param {Object} [object={}] The object to copy properties to.
4315 * @param {Function} [customizer] The function to customize copied values.
4316 * @returns {Object} Returns `object`.
4317 */
4318function copyObject(source, props, object, customizer) {
4319 var isNew = !object;
4320 object || (object = {});
4321
4322 var index = -1,
4323 length = props.length;
4324
4325 while (++index < length) {
4326 var key = props[index];
4327
4328 var newValue = customizer
4329 ? customizer(object[key], source[key], key, object, source)
4330 : undefined;
4331
4332 if (newValue === undefined) {
4333 newValue = source[key];
4334 }
4335 if (isNew) {
4336 _baseAssignValue(object, key, newValue);
4337 } else {
4338 _assignValue(object, key, newValue);
4339 }
4340 }
4341 return object;
4342}
4343
4344var _copyObject = copyObject;
4345
4346/**
4347 * The base implementation of `_.times` without support for iteratee shorthands
4348 * or max array length checks.
4349 *
4350 * @private
4351 * @param {number} n The number of times to invoke `iteratee`.
4352 * @param {Function} iteratee The function invoked per iteration.
4353 * @returns {Array} Returns the array of results.
4354 */
4355function baseTimes(n, iteratee) {
4356 var index = -1,
4357 result = Array(n);
4358
4359 while (++index < n) {
4360 result[index] = iteratee(index);
4361 }
4362 return result;
4363}
4364
4365var _baseTimes = baseTimes;
4366
4367/** Used as references for various `Number` constants. */
4368var MAX_SAFE_INTEGER$1 = 9007199254740991;
4369
4370/** Used to detect unsigned integer values. */
4371var reIsUint = /^(?:0|[1-9]\d*)$/;
4372
4373/**
4374 * Checks if `value` is a valid array-like index.
4375 *
4376 * @private
4377 * @param {*} value The value to check.
4378 * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
4379 * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
4380 */
4381function isIndex(value, length) {
4382 var type = typeof value;
4383 length = length == null ? MAX_SAFE_INTEGER$1 : length;
4384
4385 return !!length &&
4386 (type == 'number' ||
4387 (type != 'symbol' && reIsUint.test(value))) &&
4388 (value > -1 && value % 1 == 0 && value < length);
4389}
4390
4391var _isIndex = isIndex;
4392
4393/** Used for built-in method references. */
4394var objectProto$9 = Object.prototype;
4395
4396/** Used to check objects for own properties. */
4397var hasOwnProperty$8 = objectProto$9.hasOwnProperty;
4398
4399/**
4400 * Creates an array of the enumerable property names of the array-like `value`.
4401 *
4402 * @private
4403 * @param {*} value The value to query.
4404 * @param {boolean} inherited Specify returning inherited property names.
4405 * @returns {Array} Returns the array of property names.
4406 */
4407function arrayLikeKeys(value, inherited) {
4408 var isArr = isArray_1(value),
4409 isArg = !isArr && isArguments_1(value),
4410 isBuff = !isArr && !isArg && isBuffer_1(value),
4411 isType = !isArr && !isArg && !isBuff && isTypedArray_1(value),
4412 skipIndexes = isArr || isArg || isBuff || isType,
4413 result = skipIndexes ? _baseTimes(value.length, String) : [],
4414 length = result.length;
4415
4416 for (var key in value) {
4417 if ((inherited || hasOwnProperty$8.call(value, key)) &&
4418 !(skipIndexes && (
4419 // Safari 9 has enumerable `arguments.length` in strict mode.
4420 key == 'length' ||
4421 // Node.js 0.10 has enumerable non-index properties on buffers.
4422 (isBuff && (key == 'offset' || key == 'parent')) ||
4423 // PhantomJS 2 has enumerable non-index properties on typed arrays.
4424 (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
4425 // Skip index properties.
4426 _isIndex(key, length)
4427 ))) {
4428 result.push(key);
4429 }
4430 }
4431 return result;
4432}
4433
4434var _arrayLikeKeys = arrayLikeKeys;
4435
4436/**
4437 * This function is like
4438 * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
4439 * except that it includes inherited enumerable properties.
4440 *
4441 * @private
4442 * @param {Object} object The object to query.
4443 * @returns {Array} Returns the array of property names.
4444 */
4445function nativeKeysIn(object) {
4446 var result = [];
4447 if (object != null) {
4448 for (var key in Object(object)) {
4449 result.push(key);
4450 }
4451 }
4452 return result;
4453}
4454
4455var _nativeKeysIn = nativeKeysIn;
4456
4457/** Used for built-in method references. */
4458var objectProto$a = Object.prototype;
4459
4460/** Used to check objects for own properties. */
4461var hasOwnProperty$9 = objectProto$a.hasOwnProperty;
4462
4463/**
4464 * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
4465 *
4466 * @private
4467 * @param {Object} object The object to query.
4468 * @returns {Array} Returns the array of property names.
4469 */
4470function baseKeysIn(object) {
4471 if (!isObject_1(object)) {
4472 return _nativeKeysIn(object);
4473 }
4474 var isProto = _isPrototype(object),
4475 result = [];
4476
4477 for (var key in object) {
4478 if (!(key == 'constructor' && (isProto || !hasOwnProperty$9.call(object, key)))) {
4479 result.push(key);
4480 }
4481 }
4482 return result;
4483}
4484
4485var _baseKeysIn = baseKeysIn;
4486
4487/**
4488 * Creates an array of the own and inherited enumerable property names of `object`.
4489 *
4490 * **Note:** Non-object values are coerced to objects.
4491 *
4492 * @static
4493 * @memberOf _
4494 * @since 3.0.0
4495 * @category Object
4496 * @param {Object} object The object to query.
4497 * @returns {Array} Returns the array of property names.
4498 * @example
4499 *
4500 * function Foo() {
4501 * this.a = 1;
4502 * this.b = 2;
4503 * }
4504 *
4505 * Foo.prototype.c = 3;
4506 *
4507 * _.keysIn(new Foo);
4508 * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
4509 */
4510function keysIn(object) {
4511 return isArrayLike_1(object) ? _arrayLikeKeys(object, true) : _baseKeysIn(object);
4512}
4513
4514var keysIn_1 = keysIn;
4515
4516/**
4517 * Converts `value` to a plain object flattening inherited enumerable string
4518 * keyed properties of `value` to own properties of the plain object.
4519 *
4520 * @static
4521 * @memberOf _
4522 * @since 3.0.0
4523 * @category Lang
4524 * @param {*} value The value to convert.
4525 * @returns {Object} Returns the converted plain object.
4526 * @example
4527 *
4528 * function Foo() {
4529 * this.b = 2;
4530 * }
4531 *
4532 * Foo.prototype.c = 3;
4533 *
4534 * _.assign({ 'a': 1 }, new Foo);
4535 * // => { 'a': 1, 'b': 2 }
4536 *
4537 * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
4538 * // => { 'a': 1, 'b': 2, 'c': 3 }
4539 */
4540function toPlainObject(value) {
4541 return _copyObject(value, keysIn_1(value));
4542}
4543
4544var toPlainObject_1 = toPlainObject;
4545
4546/**
4547 * A specialized version of `baseMerge` for arrays and objects which performs
4548 * deep merges and tracks traversed objects enabling objects with circular
4549 * references to be merged.
4550 *
4551 * @private
4552 * @param {Object} object The destination object.
4553 * @param {Object} source The source object.
4554 * @param {string} key The key of the value to merge.
4555 * @param {number} srcIndex The index of `source`.
4556 * @param {Function} mergeFunc The function to merge values.
4557 * @param {Function} [customizer] The function to customize assigned values.
4558 * @param {Object} [stack] Tracks traversed source values and their merged
4559 * counterparts.
4560 */
4561function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
4562 var objValue = _safeGet(object, key),
4563 srcValue = _safeGet(source, key),
4564 stacked = stack.get(srcValue);
4565
4566 if (stacked) {
4567 _assignMergeValue(object, key, stacked);
4568 return;
4569 }
4570 var newValue = customizer
4571 ? customizer(objValue, srcValue, (key + ''), object, source, stack)
4572 : undefined;
4573
4574 var isCommon = newValue === undefined;
4575
4576 if (isCommon) {
4577 var isArr = isArray_1(srcValue),
4578 isBuff = !isArr && isBuffer_1(srcValue),
4579 isTyped = !isArr && !isBuff && isTypedArray_1(srcValue);
4580
4581 newValue = srcValue;
4582 if (isArr || isBuff || isTyped) {
4583 if (isArray_1(objValue)) {
4584 newValue = objValue;
4585 }
4586 else if (isArrayLikeObject_1(objValue)) {
4587 newValue = _copyArray(objValue);
4588 }
4589 else if (isBuff) {
4590 isCommon = false;
4591 newValue = _cloneBuffer(srcValue, true);
4592 }
4593 else if (isTyped) {
4594 isCommon = false;
4595 newValue = _cloneTypedArray(srcValue, true);
4596 }
4597 else {
4598 newValue = [];
4599 }
4600 }
4601 else if (isPlainObject_1(srcValue) || isArguments_1(srcValue)) {
4602 newValue = objValue;
4603 if (isArguments_1(objValue)) {
4604 newValue = toPlainObject_1(objValue);
4605 }
4606 else if (!isObject_1(objValue) || isFunction_1(objValue)) {
4607 newValue = _initCloneObject(srcValue);
4608 }
4609 }
4610 else {
4611 isCommon = false;
4612 }
4613 }
4614 if (isCommon) {
4615 // Recursively merge objects and arrays (susceptible to call stack limits).
4616 stack.set(srcValue, newValue);
4617 mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
4618 stack['delete'](srcValue);
4619 }
4620 _assignMergeValue(object, key, newValue);
4621}
4622
4623var _baseMergeDeep = baseMergeDeep;
4624
4625/**
4626 * The base implementation of `_.merge` without support for multiple sources.
4627 *
4628 * @private
4629 * @param {Object} object The destination object.
4630 * @param {Object} source The source object.
4631 * @param {number} srcIndex The index of `source`.
4632 * @param {Function} [customizer] The function to customize merged values.
4633 * @param {Object} [stack] Tracks traversed source values and their merged
4634 * counterparts.
4635 */
4636function baseMerge(object, source, srcIndex, customizer, stack) {
4637 if (object === source) {
4638 return;
4639 }
4640 _baseFor(source, function(srcValue, key) {
4641 stack || (stack = new _Stack);
4642 if (isObject_1(srcValue)) {
4643 _baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
4644 }
4645 else {
4646 var newValue = customizer
4647 ? customizer(_safeGet(object, key), srcValue, (key + ''), object, source, stack)
4648 : undefined;
4649
4650 if (newValue === undefined) {
4651 newValue = srcValue;
4652 }
4653 _assignMergeValue(object, key, newValue);
4654 }
4655 }, keysIn_1);
4656}
4657
4658var _baseMerge = baseMerge;
4659
4660/**
4661 * This method returns the first argument it receives.
4662 *
4663 * @static
4664 * @since 0.1.0
4665 * @memberOf _
4666 * @category Util
4667 * @param {*} value Any value.
4668 * @returns {*} Returns `value`.
4669 * @example
4670 *
4671 * var object = { 'a': 1 };
4672 *
4673 * console.log(_.identity(object) === object);
4674 * // => true
4675 */
4676function identity(value) {
4677 return value;
4678}
4679
4680var identity_1 = identity;
4681
4682/**
4683 * A faster alternative to `Function#apply`, this function invokes `func`
4684 * with the `this` binding of `thisArg` and the arguments of `args`.
4685 *
4686 * @private
4687 * @param {Function} func The function to invoke.
4688 * @param {*} thisArg The `this` binding of `func`.
4689 * @param {Array} args The arguments to invoke `func` with.
4690 * @returns {*} Returns the result of `func`.
4691 */
4692function apply(func, thisArg, args) {
4693 switch (args.length) {
4694 case 0: return func.call(thisArg);
4695 case 1: return func.call(thisArg, args[0]);
4696 case 2: return func.call(thisArg, args[0], args[1]);
4697 case 3: return func.call(thisArg, args[0], args[1], args[2]);
4698 }
4699 return func.apply(thisArg, args);
4700}
4701
4702var _apply = apply;
4703
4704/* Built-in method references for those with the same name as other `lodash` methods. */
4705var nativeMax = Math.max;
4706
4707/**
4708 * A specialized version of `baseRest` which transforms the rest array.
4709 *
4710 * @private
4711 * @param {Function} func The function to apply a rest parameter to.
4712 * @param {number} [start=func.length-1] The start position of the rest parameter.
4713 * @param {Function} transform The rest array transform.
4714 * @returns {Function} Returns the new function.
4715 */
4716function overRest(func, start, transform) {
4717 start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
4718 return function() {
4719 var args = arguments,
4720 index = -1,
4721 length = nativeMax(args.length - start, 0),
4722 array = Array(length);
4723
4724 while (++index < length) {
4725 array[index] = args[start + index];
4726 }
4727 index = -1;
4728 var otherArgs = Array(start + 1);
4729 while (++index < start) {
4730 otherArgs[index] = args[index];
4731 }
4732 otherArgs[start] = transform(array);
4733 return _apply(func, this, otherArgs);
4734 };
4735}
4736
4737var _overRest = overRest;
4738
4739/**
4740 * Creates a function that returns `value`.
4741 *
4742 * @static
4743 * @memberOf _
4744 * @since 2.4.0
4745 * @category Util
4746 * @param {*} value The value to return from the new function.
4747 * @returns {Function} Returns the new constant function.
4748 * @example
4749 *
4750 * var objects = _.times(2, _.constant({ 'a': 1 }));
4751 *
4752 * console.log(objects);
4753 * // => [{ 'a': 1 }, { 'a': 1 }]
4754 *
4755 * console.log(objects[0] === objects[1]);
4756 * // => true
4757 */
4758function constant(value) {
4759 return function() {
4760 return value;
4761 };
4762}
4763
4764var constant_1 = constant;
4765
4766/**
4767 * The base implementation of `setToString` without support for hot loop shorting.
4768 *
4769 * @private
4770 * @param {Function} func The function to modify.
4771 * @param {Function} string The `toString` result.
4772 * @returns {Function} Returns `func`.
4773 */
4774var baseSetToString = !_defineProperty$1 ? identity_1 : function(func, string) {
4775 return _defineProperty$1(func, 'toString', {
4776 'configurable': true,
4777 'enumerable': false,
4778 'value': constant_1(string),
4779 'writable': true
4780 });
4781};
4782
4783var _baseSetToString = baseSetToString;
4784
4785/** Used to detect hot functions by number of calls within a span of milliseconds. */
4786var HOT_COUNT = 800,
4787 HOT_SPAN = 16;
4788
4789/* Built-in method references for those with the same name as other `lodash` methods. */
4790var nativeNow = Date.now;
4791
4792/**
4793 * Creates a function that'll short out and invoke `identity` instead
4794 * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
4795 * milliseconds.
4796 *
4797 * @private
4798 * @param {Function} func The function to restrict.
4799 * @returns {Function} Returns the new shortable function.
4800 */
4801function shortOut(func) {
4802 var count = 0,
4803 lastCalled = 0;
4804
4805 return function() {
4806 var stamp = nativeNow(),
4807 remaining = HOT_SPAN - (stamp - lastCalled);
4808
4809 lastCalled = stamp;
4810 if (remaining > 0) {
4811 if (++count >= HOT_COUNT) {
4812 return arguments[0];
4813 }
4814 } else {
4815 count = 0;
4816 }
4817 return func.apply(undefined, arguments);
4818 };
4819}
4820
4821var _shortOut = shortOut;
4822
4823/**
4824 * Sets the `toString` method of `func` to return `string`.
4825 *
4826 * @private
4827 * @param {Function} func The function to modify.
4828 * @param {Function} string The `toString` result.
4829 * @returns {Function} Returns `func`.
4830 */
4831var setToString = _shortOut(_baseSetToString);
4832
4833var _setToString = setToString;
4834
4835/**
4836 * The base implementation of `_.rest` which doesn't validate or coerce arguments.
4837 *
4838 * @private
4839 * @param {Function} func The function to apply a rest parameter to.
4840 * @param {number} [start=func.length-1] The start position of the rest parameter.
4841 * @returns {Function} Returns the new function.
4842 */
4843function baseRest(func, start) {
4844 return _setToString(_overRest(func, start, identity_1), func + '');
4845}
4846
4847var _baseRest = baseRest;
4848
4849/**
4850 * Checks if the given arguments are from an iteratee call.
4851 *
4852 * @private
4853 * @param {*} value The potential iteratee value argument.
4854 * @param {*} index The potential iteratee index or key argument.
4855 * @param {*} object The potential iteratee object argument.
4856 * @returns {boolean} Returns `true` if the arguments are from an iteratee call,
4857 * else `false`.
4858 */
4859function isIterateeCall(value, index, object) {
4860 if (!isObject_1(object)) {
4861 return false;
4862 }
4863 var type = typeof index;
4864 if (type == 'number'
4865 ? (isArrayLike_1(object) && _isIndex(index, object.length))
4866 : (type == 'string' && index in object)
4867 ) {
4868 return eq_1(object[index], value);
4869 }
4870 return false;
4871}
4872
4873var _isIterateeCall = isIterateeCall;
4874
4875/**
4876 * Creates a function like `_.assign`.
4877 *
4878 * @private
4879 * @param {Function} assigner The function to assign values.
4880 * @returns {Function} Returns the new assigner function.
4881 */
4882function createAssigner(assigner) {
4883 return _baseRest(function(object, sources) {
4884 var index = -1,
4885 length = sources.length,
4886 customizer = length > 1 ? sources[length - 1] : undefined,
4887 guard = length > 2 ? sources[2] : undefined;
4888
4889 customizer = (assigner.length > 3 && typeof customizer == 'function')
4890 ? (length--, customizer)
4891 : undefined;
4892
4893 if (guard && _isIterateeCall(sources[0], sources[1], guard)) {
4894 customizer = length < 3 ? undefined : customizer;
4895 length = 1;
4896 }
4897 object = Object(object);
4898 while (++index < length) {
4899 var source = sources[index];
4900 if (source) {
4901 assigner(object, source, index, customizer);
4902 }
4903 }
4904 return object;
4905 });
4906}
4907
4908var _createAssigner = createAssigner;
4909
4910/**
4911 * This method is like `_.assign` except that it recursively merges own and
4912 * inherited enumerable string keyed properties of source objects into the
4913 * destination object. Source properties that resolve to `undefined` are
4914 * skipped if a destination value exists. Array and plain object properties
4915 * are merged recursively. Other objects and value types are overridden by
4916 * assignment. Source objects are applied from left to right. Subsequent
4917 * sources overwrite property assignments of previous sources.
4918 *
4919 * **Note:** This method mutates `object`.
4920 *
4921 * @static
4922 * @memberOf _
4923 * @since 0.5.0
4924 * @category Object
4925 * @param {Object} object The destination object.
4926 * @param {...Object} [sources] The source objects.
4927 * @returns {Object} Returns `object`.
4928 * @example
4929 *
4930 * var object = {
4931 * 'a': [{ 'b': 2 }, { 'd': 4 }]
4932 * };
4933 *
4934 * var other = {
4935 * 'a': [{ 'c': 3 }, { 'e': 5 }]
4936 * };
4937 *
4938 * _.merge(object, other);
4939 * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }
4940 */
4941var merge = _createAssigner(function(object, source, srcIndex) {
4942 _baseMerge(object, source, srcIndex);
4943});
4944
4945var merge_1 = merge;
4946
4947/**
4948 * React Blessed Update Schemes
4949 * =============================
4950 *
4951 * Applying updates to blessed nodes correctly.
4952 */
4953const RAW_ATTRIBUTES = new Set([// Alignment, Orientation & Presentation
4954'align', 'valign', 'orientation', 'shrink', 'padding', 'tags', 'shadow', // Font-related
4955'font', 'fontBold', 'fch', 'ch', 'bold', 'underline', // Flags
4956'clickable', 'input', 'keyable', 'hidden', 'visible', 'scrollable', 'draggable', 'interactive', // Position
4957'left', 'right', 'top', 'bottom', 'aleft', 'aright', 'atop', 'abottom', // Size
4958'width', 'height', // Checkbox
4959'checked', // Misc
4960'name']);
4961/**
4962 * Updates the given blessed node.
4963 *
4964 * @param {BlessedNode} node - Node to update.
4965 * @param {object} options - Props of the component without children.
4966 */
4967
4968function update(node, options) {
4969 // TODO: enforce some kind of shallow equality?
4970 // TODO: handle position
4971 const selectQue = [];
4972
4973 for (let key in options) {
4974 let value = options[key];
4975 if (key === 'selected' && node.select) selectQue.push({
4976 node,
4977 value: typeof value === 'string' ? +value : value
4978 }); // Setting label
4979 else if (key === 'label') node.setLabel(value); // Removing hoverText
4980 else if (key === 'hoverText' && !value) node.removeHover(); // Setting hoverText
4981 else if (key === 'hoverText' && value) node.setHover(value); // Setting content
4982 else if (key === 'content') node.setContent(value); // Updating style
4983 else if (key === 'style') node.style = merge_1({}, node.style, value); // Updating items
4984 else if (key === 'items') node.setItems(value); // Border edge case
4985 else if (key === 'border') node.border = merge_1({}, node.border, value); // Textarea value
4986 else if (key === 'value' && node.setValue) node.setValue(value); // Progress bar
4987 else if (key === 'filled' && node.filled !== value) node.setProgress(value); // Table / ListTable rows / data
4988 else if ((key === 'rows' || key === 'data') && node.setData) node.setData(value);else if (key === 'focused' && value && !node[key]) node.focus(); // Raw attributes
4989 else if (RAW_ATTRIBUTES.has(key)) node[key] = value;
4990 }
4991
4992 selectQue.forEach(({
4993 node,
4994 value
4995 }) => node.select(value));
4996}
4997
4998const emptyArray = [];
4999/**
5000 * Solves the given props by applying classes.
5001 *
5002 * @param {object} props - The component's props.
5003 * @return {object} - The solved props.
5004 */
5005
5006function solveClass(props) {
5007 let {
5008 class: classes
5009 } = props,
5010 rest = _objectWithoutProperties(props, ["class"]);
5011
5012 const args = [{}];
5013 if (classes) args.push.apply(args, emptyArray.concat(classes));
5014 args.push(rest);
5015 return merge_1.apply(null, args);
5016}
5017
5018/**
5019 * Gets the timestamp of the number of milliseconds that have elapsed since
5020 * the Unix epoch (1 January 1970 00:00:00 UTC).
5021 *
5022 * @static
5023 * @memberOf _
5024 * @since 2.4.0
5025 * @category Date
5026 * @returns {number} Returns the timestamp.
5027 * @example
5028 *
5029 * _.defer(function(stamp) {
5030 * console.log(_.now() - stamp);
5031 * }, _.now());
5032 * // => Logs the number of milliseconds it took for the deferred invocation.
5033 */
5034var now = function() {
5035 return _root.Date.now();
5036};
5037
5038var now_1 = now;
5039
5040/** `Object#toString` result references. */
5041var symbolTag = '[object Symbol]';
5042
5043/**
5044 * Checks if `value` is classified as a `Symbol` primitive or object.
5045 *
5046 * @static
5047 * @memberOf _
5048 * @since 4.0.0
5049 * @category Lang
5050 * @param {*} value The value to check.
5051 * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
5052 * @example
5053 *
5054 * _.isSymbol(Symbol.iterator);
5055 * // => true
5056 *
5057 * _.isSymbol('abc');
5058 * // => false
5059 */
5060function isSymbol(value) {
5061 return typeof value == 'symbol' ||
5062 (isObjectLike_1(value) && _baseGetTag(value) == symbolTag);
5063}
5064
5065var isSymbol_1 = isSymbol;
5066
5067/** Used as references for various `Number` constants. */
5068var NAN = 0 / 0;
5069
5070/** Used to match leading and trailing whitespace. */
5071var reTrim = /^\s+|\s+$/g;
5072
5073/** Used to detect bad signed hexadecimal string values. */
5074var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
5075
5076/** Used to detect binary string values. */
5077var reIsBinary = /^0b[01]+$/i;
5078
5079/** Used to detect octal string values. */
5080var reIsOctal = /^0o[0-7]+$/i;
5081
5082/** Built-in method references without a dependency on `root`. */
5083var freeParseInt = parseInt;
5084
5085/**
5086 * Converts `value` to a number.
5087 *
5088 * @static
5089 * @memberOf _
5090 * @since 4.0.0
5091 * @category Lang
5092 * @param {*} value The value to process.
5093 * @returns {number} Returns the number.
5094 * @example
5095 *
5096 * _.toNumber(3.2);
5097 * // => 3.2
5098 *
5099 * _.toNumber(Number.MIN_VALUE);
5100 * // => 5e-324
5101 *
5102 * _.toNumber(Infinity);
5103 * // => Infinity
5104 *
5105 * _.toNumber('3.2');
5106 * // => 3.2
5107 */
5108function toNumber(value) {
5109 if (typeof value == 'number') {
5110 return value;
5111 }
5112 if (isSymbol_1(value)) {
5113 return NAN;
5114 }
5115 if (isObject_1(value)) {
5116 var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
5117 value = isObject_1(other) ? (other + '') : other;
5118 }
5119 if (typeof value != 'string') {
5120 return value === 0 ? value : +value;
5121 }
5122 value = value.replace(reTrim, '');
5123 var isBinary = reIsBinary.test(value);
5124 return (isBinary || reIsOctal.test(value))
5125 ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
5126 : (reIsBadHex.test(value) ? NAN : +value);
5127}
5128
5129var toNumber_1 = toNumber;
5130
5131/** Error message constants. */
5132var FUNC_ERROR_TEXT = 'Expected a function';
5133
5134/* Built-in method references for those with the same name as other `lodash` methods. */
5135var nativeMax$1 = Math.max,
5136 nativeMin = Math.min;
5137
5138/**
5139 * Creates a debounced function that delays invoking `func` until after `wait`
5140 * milliseconds have elapsed since the last time the debounced function was
5141 * invoked. The debounced function comes with a `cancel` method to cancel
5142 * delayed `func` invocations and a `flush` method to immediately invoke them.
5143 * Provide `options` to indicate whether `func` should be invoked on the
5144 * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
5145 * with the last arguments provided to the debounced function. Subsequent
5146 * calls to the debounced function return the result of the last `func`
5147 * invocation.
5148 *
5149 * **Note:** If `leading` and `trailing` options are `true`, `func` is
5150 * invoked on the trailing edge of the timeout only if the debounced function
5151 * is invoked more than once during the `wait` timeout.
5152 *
5153 * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
5154 * until to the next tick, similar to `setTimeout` with a timeout of `0`.
5155 *
5156 * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
5157 * for details over the differences between `_.debounce` and `_.throttle`.
5158 *
5159 * @static
5160 * @memberOf _
5161 * @since 0.1.0
5162 * @category Function
5163 * @param {Function} func The function to debounce.
5164 * @param {number} [wait=0] The number of milliseconds to delay.
5165 * @param {Object} [options={}] The options object.
5166 * @param {boolean} [options.leading=false]
5167 * Specify invoking on the leading edge of the timeout.
5168 * @param {number} [options.maxWait]
5169 * The maximum time `func` is allowed to be delayed before it's invoked.
5170 * @param {boolean} [options.trailing=true]
5171 * Specify invoking on the trailing edge of the timeout.
5172 * @returns {Function} Returns the new debounced function.
5173 * @example
5174 *
5175 * // Avoid costly calculations while the window size is in flux.
5176 * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
5177 *
5178 * // Invoke `sendMail` when clicked, debouncing subsequent calls.
5179 * jQuery(element).on('click', _.debounce(sendMail, 300, {
5180 * 'leading': true,
5181 * 'trailing': false
5182 * }));
5183 *
5184 * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
5185 * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
5186 * var source = new EventSource('/stream');
5187 * jQuery(source).on('message', debounced);
5188 *
5189 * // Cancel the trailing debounced invocation.
5190 * jQuery(window).on('popstate', debounced.cancel);
5191 */
5192function debounce(func, wait, options) {
5193 var lastArgs,
5194 lastThis,
5195 maxWait,
5196 result,
5197 timerId,
5198 lastCallTime,
5199 lastInvokeTime = 0,
5200 leading = false,
5201 maxing = false,
5202 trailing = true;
5203
5204 if (typeof func != 'function') {
5205 throw new TypeError(FUNC_ERROR_TEXT);
5206 }
5207 wait = toNumber_1(wait) || 0;
5208 if (isObject_1(options)) {
5209 leading = !!options.leading;
5210 maxing = 'maxWait' in options;
5211 maxWait = maxing ? nativeMax$1(toNumber_1(options.maxWait) || 0, wait) : maxWait;
5212 trailing = 'trailing' in options ? !!options.trailing : trailing;
5213 }
5214
5215 function invokeFunc(time) {
5216 var args = lastArgs,
5217 thisArg = lastThis;
5218
5219 lastArgs = lastThis = undefined;
5220 lastInvokeTime = time;
5221 result = func.apply(thisArg, args);
5222 return result;
5223 }
5224
5225 function leadingEdge(time) {
5226 // Reset any `maxWait` timer.
5227 lastInvokeTime = time;
5228 // Start the timer for the trailing edge.
5229 timerId = setTimeout(timerExpired, wait);
5230 // Invoke the leading edge.
5231 return leading ? invokeFunc(time) : result;
5232 }
5233
5234 function remainingWait(time) {
5235 var timeSinceLastCall = time - lastCallTime,
5236 timeSinceLastInvoke = time - lastInvokeTime,
5237 timeWaiting = wait - timeSinceLastCall;
5238
5239 return maxing
5240 ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)
5241 : timeWaiting;
5242 }
5243
5244 function shouldInvoke(time) {
5245 var timeSinceLastCall = time - lastCallTime,
5246 timeSinceLastInvoke = time - lastInvokeTime;
5247
5248 // Either this is the first call, activity has stopped and we're at the
5249 // trailing edge, the system time has gone backwards and we're treating
5250 // it as the trailing edge, or we've hit the `maxWait` limit.
5251 return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
5252 (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
5253 }
5254
5255 function timerExpired() {
5256 var time = now_1();
5257 if (shouldInvoke(time)) {
5258 return trailingEdge(time);
5259 }
5260 // Restart the timer.
5261 timerId = setTimeout(timerExpired, remainingWait(time));
5262 }
5263
5264 function trailingEdge(time) {
5265 timerId = undefined;
5266
5267 // Only invoke if we have `lastArgs` which means `func` has been
5268 // debounced at least once.
5269 if (trailing && lastArgs) {
5270 return invokeFunc(time);
5271 }
5272 lastArgs = lastThis = undefined;
5273 return result;
5274 }
5275
5276 function cancel() {
5277 if (timerId !== undefined) {
5278 clearTimeout(timerId);
5279 }
5280 lastInvokeTime = 0;
5281 lastArgs = lastCallTime = lastThis = timerId = undefined;
5282 }
5283
5284 function flush() {
5285 return timerId === undefined ? result : trailingEdge(now_1());
5286 }
5287
5288 function debounced() {
5289 var time = now_1(),
5290 isInvoking = shouldInvoke(time);
5291
5292 lastArgs = arguments;
5293 lastThis = this;
5294 lastCallTime = time;
5295
5296 if (isInvoking) {
5297 if (timerId === undefined) {
5298 return leadingEdge(lastCallTime);
5299 }
5300 if (maxing) {
5301 // Handle invocations in a tight loop.
5302 clearTimeout(timerId);
5303 timerId = setTimeout(timerExpired, wait);
5304 return invokeFunc(lastCallTime);
5305 }
5306 }
5307 if (timerId === undefined) {
5308 timerId = setTimeout(timerExpired, wait);
5309 }
5310 return result;
5311 }
5312 debounced.cancel = cancel;
5313 debounced.flush = flush;
5314 return debounced;
5315}
5316
5317var debounce_1 = debounce;
5318
5319const emptyObject = {};
5320
5321const createBlessedRenderer = function (blessed) {
5322 let screenRef = null;
5323 const BlessedReconciler = ReactFiberReconciler({
5324 supportsMutation: true,
5325 supportsPersistence: false,
5326
5327 getRootHostContext(rootContainerInstance) {
5328 return emptyObject;
5329 },
5330
5331 getChildHostContext(parentHostContext, type) {
5332 return emptyObject;
5333 },
5334
5335 getPublicInstance(instance) {
5336 return instance;
5337 },
5338
5339 createInstance(type, props, rootContainerInstance, hostContext, internalInstanceHandle) {
5340 const _solveClass = solveClass(props),
5341 appliedProps = _objectWithoutProperties(_solveClass, ["children"]);
5342
5343 const blessedTypePrefix = 'blessed-';
5344
5345 if (type.startsWith(blessedTypePrefix)) {
5346 type = type.slice(blessedTypePrefix.length);
5347 }
5348
5349 const instance = blessed[type](_objectSpread2(_objectSpread2({}, appliedProps), {}, {
5350 screen: screenRef
5351 }));
5352 instance.props = props;
5353
5354 instance._eventListener = (...args) => eventListener(instance, ...args);
5355
5356 instance.on('event', instance._eventListener);
5357 return instance;
5358 },
5359
5360 appendInitialChild(parentInstance, child) {
5361 parentInstance.append(child);
5362 },
5363
5364 finalizeInitialChildren(instance, type, props, rootContainerInstance) {
5365 const _solveClass2 = solveClass(props),
5366 appliedProps = _objectWithoutProperties(_solveClass2, ["children"]);
5367
5368 update(instance, appliedProps);
5369 instance.props = props;
5370 return false;
5371 },
5372
5373 prepareUpdate(instance, type, oldProps, newProps, rootContainerInstance, hostContext) {
5374 return solveClass(newProps);
5375 },
5376
5377 shouldSetTextContent(props) {
5378 return false;
5379 },
5380
5381 now: Date.now,
5382
5383 createTextInstance(text, rootContainerInstance, hostContext, internalInstanceHandle) {
5384 return blessed.text({
5385 content: text,
5386 screen: screenRef
5387 });
5388 },
5389
5390 prepareForCommit() {
5391 // noop but must return `null` to avoid issues related to node removal
5392 return null;
5393 },
5394
5395 resetAfterCommit() {// noop
5396 },
5397
5398 commitMount(instance, type, newProps, internalInstanceHandle) {
5399 throw new Error('commitMount not implemented. Please post a reproducible use case that calls this method at https://github.com/Yomguithereal/react-blessed/issues/new');
5400 },
5401
5402 commitUpdate(instance, updatePayload, type, oldProps, newProps, internalInstanceHandle) {
5403 instance._updating = true;
5404 update(instance, updatePayload); // update event handler pointers
5405
5406 instance.props = newProps;
5407 instance._updating = false;
5408 instance.screen.debouncedRender();
5409 },
5410
5411 commitTextUpdate(textInstance, oldText, newText) {
5412 textInstance.setContent(newText);
5413 textInstance.screen.debouncedRender();
5414 },
5415
5416 appendChild(parentInstance, child) {
5417 parentInstance.append(child);
5418 },
5419
5420 appendChildToContainer(parentInstance, child) {
5421 parentInstance.append(child);
5422 },
5423
5424 insertBefore(parentInstance, child, beforeChild) {
5425 // pretty sure everything is absolutely positioned so insertBefore ~= append
5426 parentInstance.append(child);
5427 },
5428
5429 insertInContainerBefore(parentInstance, child, beforeChild) {
5430 // pretty sure everything is absolutely positioned so insertBefore ~= append
5431 parentInstance.append(child);
5432 },
5433
5434 removeChild(parentInstance, child) {
5435 parentInstance.remove(child);
5436 child.off('event', child._eventListener);
5437 child.forDescendants(function (el) {
5438 el.off('event', child._eventListener);
5439 });
5440 child.destroy();
5441 },
5442
5443 removeChildFromContainer(parentInstance, child) {
5444 parentInstance.remove(child);
5445 child.off('event', child._eventListener);
5446 child.forDescendants(function (el) {
5447 el.off('event', child._eventListener);
5448 });
5449 child.destroy();
5450 },
5451
5452 resetTextContent(instance) {
5453 instance.setContent('');
5454 },
5455
5456 clearContainer(container) {
5457 container.render();
5458 }
5459
5460 });
5461 BlessedReconciler.injectIntoDevTools(devtools);
5462 const roots = new Map();
5463 return function render(element, screen, callback) {
5464 screenRef = screen;
5465 let root = roots.get(screen);
5466
5467 if (!root) {
5468 root = BlessedReconciler.createContainer(screen);
5469 roots.set(screen, root);
5470 }
5471
5472 screen.once('destroy', () => {
5473 console.log('screen was destroyed!');
5474 }); // render at most every 16ms. Should sync this with the screen refresh rate
5475 // probably if possible
5476
5477 screen.debouncedRender = debounce_1(() => screen.render(), 16);
5478 BlessedReconciler.updateContainer(element, root, null, callback);
5479 screen.debouncedRender();
5480 return BlessedReconciler.getPublicRootInstance(root);
5481 };
5482};
5483
5484module.exports = {
5485 render: function render(element, screen, callback) {
5486 const blessed = require('blessed');
5487
5488 const renderer = createBlessedRenderer(blessed);
5489 return renderer(element, screen, callback);
5490 },
5491 createBlessedRenderer: createBlessedRenderer
5492};
5493//# sourceMappingURL=index.es.js.map