@usecsv/react 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,3112 @@
1
+ /*!
2
+ * @usecsv/react v0.0.1
3
+ * (c) layercode
4
+ * Released under the MIT License.
5
+ */
6
+
7
+ (function (global, factory) {
8
+ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
9
+ typeof define === 'function' && define.amd ? define(factory) :
10
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global["@usecsv/react"] = factory());
11
+ })(this, (function () { 'use strict';
12
+
13
+ /*!
14
+ * @usecsv/js v0.0.11
15
+ * (c) layercode
16
+ * Released under the MIT License.
17
+ */
18
+
19
+ var containers = []; // will store container HTMLElement references
20
+ var styleElements = []; // will store {prepend: HTMLElement, append: HTMLElement}
21
+
22
+ var usage = 'insert-css: You need to provide a CSS string. Usage: insertCss(cssString[, options]).';
23
+
24
+ function insertCss(css, options) {
25
+ options = options || {};
26
+
27
+ if (css === undefined) {
28
+ throw new Error(usage);
29
+ }
30
+
31
+ var position = options.prepend === true ? 'prepend' : 'append';
32
+ var container = options.container !== undefined ? options.container : document.querySelector('head');
33
+ var containerId = containers.indexOf(container);
34
+
35
+ // first time we see this container, create the necessary entries
36
+ if (containerId === -1) {
37
+ containerId = containers.push(container) - 1;
38
+ styleElements[containerId] = {};
39
+ }
40
+
41
+ // try to get the correponding container + position styleElement, create it otherwise
42
+ var styleElement;
43
+
44
+ if (styleElements[containerId] !== undefined && styleElements[containerId][position] !== undefined) {
45
+ styleElement = styleElements[containerId][position];
46
+ } else {
47
+ styleElement = styleElements[containerId][position] = createStyleElement();
48
+
49
+ if (position === 'prepend') {
50
+ container.insertBefore(styleElement, container.childNodes[0]);
51
+ } else {
52
+ container.appendChild(styleElement);
53
+ }
54
+ }
55
+
56
+ // strip potential UTF-8 BOM if css was read from a file
57
+ if (css.charCodeAt(0) === 0xFEFF) { css = css.substr(1, css.length); }
58
+
59
+ // actually add the stylesheet
60
+ if (styleElement.styleSheet) {
61
+ styleElement.styleSheet.cssText += css;
62
+ } else {
63
+ styleElement.textContent += css;
64
+ }
65
+
66
+ return styleElement;
67
+ }
68
+ function createStyleElement() {
69
+ var styleElement = document.createElement('style');
70
+ styleElement.setAttribute('type', 'text/css');
71
+ return styleElement;
72
+ }
73
+
74
+ var insertCss_1 = insertCss;
75
+ var insertCss_2 = insertCss;
76
+ insertCss_1.insertCss = insertCss_2;
77
+
78
+ var MessageType;
79
+ (function (MessageType) {
80
+ MessageType["Call"] = "call";
81
+ MessageType["Reply"] = "reply";
82
+ MessageType["Syn"] = "syn";
83
+ MessageType["SynAck"] = "synAck";
84
+ MessageType["Ack"] = "ack";
85
+ })(MessageType || (MessageType = {}));
86
+ var Resolution;
87
+ (function (Resolution) {
88
+ Resolution["Fulfilled"] = "fulfilled";
89
+ Resolution["Rejected"] = "rejected";
90
+ })(Resolution || (Resolution = {}));
91
+ var ErrorCode;
92
+ (function (ErrorCode) {
93
+ ErrorCode["ConnectionDestroyed"] = "ConnectionDestroyed";
94
+ ErrorCode["ConnectionTimeout"] = "ConnectionTimeout";
95
+ ErrorCode["NoIframeSrc"] = "NoIframeSrc";
96
+ })(ErrorCode || (ErrorCode = {}));
97
+ var NativeErrorName;
98
+ (function (NativeErrorName) {
99
+ NativeErrorName["DataCloneError"] = "DataCloneError";
100
+ })(NativeErrorName || (NativeErrorName = {}));
101
+ var NativeEventType;
102
+ (function (NativeEventType) {
103
+ NativeEventType["Message"] = "message";
104
+ })(NativeEventType || (NativeEventType = {}));
105
+
106
+ var createDestructor = (localName, log) => {
107
+ const callbacks = [];
108
+ let destroyed = false;
109
+ return {
110
+ destroy(error) {
111
+ if (!destroyed) {
112
+ destroyed = true;
113
+ log(`${localName}: Destroying connection`);
114
+ callbacks.forEach((callback) => {
115
+ callback(error);
116
+ });
117
+ }
118
+ },
119
+ onDestroy(callback) {
120
+ destroyed ? callback() : callbacks.push(callback);
121
+ },
122
+ };
123
+ };
124
+
125
+ var createLogger = (debug) => {
126
+ /**
127
+ * Logs a message if debug is enabled.
128
+ */
129
+ return (...args) => {
130
+ if (debug) {
131
+ console.log('[Penpal]', ...args); // eslint-disable-line no-console
132
+ }
133
+ };
134
+ };
135
+
136
+ const DEFAULT_PORT_BY_PROTOCOL = {
137
+ 'http:': '80',
138
+ 'https:': '443',
139
+ };
140
+ const URL_REGEX = /^(https?:)?\/\/([^/:]+)?(:(\d+))?/;
141
+ const opaqueOriginSchemes = ['file:', 'data:'];
142
+ /**
143
+ * Converts a src value into an origin.
144
+ */
145
+ var getOriginFromSrc = (src) => {
146
+ if (src && opaqueOriginSchemes.find((scheme) => src.startsWith(scheme))) {
147
+ // The origin of the child document is an opaque origin and its
148
+ // serialization is "null"
149
+ // https://html.spec.whatwg.org/multipage/origin.html#origin
150
+ return 'null';
151
+ }
152
+ // Note that if src is undefined, then srcdoc is being used instead of src
153
+ // and we can follow this same logic below to get the origin of the parent,
154
+ // which is the origin that we will need to use.
155
+ const location = document.location;
156
+ const regexResult = URL_REGEX.exec(src);
157
+ let protocol;
158
+ let hostname;
159
+ let port;
160
+ if (regexResult) {
161
+ // It's an absolute URL. Use the parsed info.
162
+ // regexResult[1] will be undefined if the URL starts with //
163
+ protocol = regexResult[1] ? regexResult[1] : location.protocol;
164
+ hostname = regexResult[2];
165
+ port = regexResult[4];
166
+ }
167
+ else {
168
+ // It's a relative path. Use the current location's info.
169
+ protocol = location.protocol;
170
+ hostname = location.hostname;
171
+ port = location.port;
172
+ }
173
+ // If the port is the default for the protocol, we don't want to add it to the origin string
174
+ // or it won't match the message's event.origin.
175
+ const portSuffix = port && port !== DEFAULT_PORT_BY_PROTOCOL[protocol] ? `:${port}` : '';
176
+ return `${protocol}//${hostname}${portSuffix}`;
177
+ };
178
+
179
+ /**
180
+ * Converts an error object into a plain object.
181
+ */
182
+ const serializeError = ({ name, message, stack, }) => ({
183
+ name,
184
+ message,
185
+ stack,
186
+ });
187
+ /**
188
+ * Converts a plain object into an error object.
189
+ */
190
+ const deserializeError = (obj) => {
191
+ const deserializedError = new Error();
192
+ // @ts-ignore
193
+ Object.keys(obj).forEach((key) => (deserializedError[key] = obj[key]));
194
+ return deserializedError;
195
+ };
196
+
197
+ /**
198
+ * Listens for "call" messages coming from the remote, executes the corresponding method, and
199
+ * responds with the return value.
200
+ */
201
+ var connectCallReceiver = (info, methods, log) => {
202
+ const { localName, local, remote, originForSending, originForReceiving, } = info;
203
+ let destroyed = false;
204
+ const handleMessageEvent = (event) => {
205
+ if (event.source !== remote || event.data.penpal !== MessageType.Call) {
206
+ return;
207
+ }
208
+ if (event.origin !== originForReceiving) {
209
+ log(`${localName} received message from origin ${event.origin} which did not match expected origin ${originForReceiving}`);
210
+ return;
211
+ }
212
+ const callMessage = event.data;
213
+ const { methodName, args, id } = callMessage;
214
+ log(`${localName}: Received ${methodName}() call`);
215
+ const createPromiseHandler = (resolution) => {
216
+ return (returnValue) => {
217
+ log(`${localName}: Sending ${methodName}() reply`);
218
+ if (destroyed) {
219
+ // It's possible to throw an error here, but it would need to be thrown asynchronously
220
+ // and would only be catchable using window.onerror. This is because the consumer
221
+ // is merely returning a value from their method and not calling any function
222
+ // that they could wrap in a try-catch. Even if the consumer were to catch the error,
223
+ // the value of doing so is questionable. Instead, we'll just log a message.
224
+ log(`${localName}: Unable to send ${methodName}() reply due to destroyed connection`);
225
+ return;
226
+ }
227
+ const message = {
228
+ penpal: MessageType.Reply,
229
+ id,
230
+ resolution,
231
+ returnValue,
232
+ };
233
+ if (resolution === Resolution.Rejected &&
234
+ returnValue instanceof Error) {
235
+ message.returnValue = serializeError(returnValue);
236
+ message.returnValueIsError = true;
237
+ }
238
+ try {
239
+ remote.postMessage(message, originForSending);
240
+ }
241
+ catch (err) {
242
+ // If a consumer attempts to send an object that's not cloneable (e.g., window),
243
+ // we want to ensure the receiver's promise gets rejected.
244
+ if (err.name === NativeErrorName.DataCloneError) {
245
+ const errorReplyMessage = {
246
+ penpal: MessageType.Reply,
247
+ id,
248
+ resolution: Resolution.Rejected,
249
+ returnValue: serializeError(err),
250
+ returnValueIsError: true,
251
+ };
252
+ remote.postMessage(errorReplyMessage, originForSending);
253
+ }
254
+ throw err;
255
+ }
256
+ };
257
+ };
258
+ new Promise((resolve) => resolve(methods[methodName].apply(methods, args))).then(createPromiseHandler(Resolution.Fulfilled), createPromiseHandler(Resolution.Rejected));
259
+ };
260
+ local.addEventListener(NativeEventType.Message, handleMessageEvent);
261
+ return () => {
262
+ destroyed = true;
263
+ local.removeEventListener(NativeEventType.Message, handleMessageEvent);
264
+ };
265
+ };
266
+
267
+ let id = 0;
268
+ /**
269
+ * @return {number} A unique ID (not universally unique)
270
+ */
271
+ var generateId = () => ++id;
272
+
273
+ /**
274
+ * Augments an object with methods that match those defined by the remote. When these methods are
275
+ * called, a "call" message will be sent to the remote, the remote's corresponding method will be
276
+ * executed, and the method's return value will be returned via a message.
277
+ * @param {Object} callSender Sender object that should be augmented with methods.
278
+ * @param {Object} info Information about the local and remote windows.
279
+ * @param {Array} methodNames Names of methods available to be called on the remote.
280
+ * @param {Promise} destructionPromise A promise resolved when destroy() is called on the penpal
281
+ * connection.
282
+ * @returns {Object} The call sender object with methods that may be called.
283
+ */
284
+ var connectCallSender = (callSender, info, methodNames, destroyConnection, log) => {
285
+ const { localName, local, remote, originForSending, originForReceiving, } = info;
286
+ let destroyed = false;
287
+ log(`${localName}: Connecting call sender`);
288
+ const createMethodProxy = (methodName) => {
289
+ return (...args) => {
290
+ log(`${localName}: Sending ${methodName}() call`);
291
+ // This handles the case where the iframe has been removed from the DOM
292
+ // (and therefore its window closed), the consumer has not yet
293
+ // called destroy(), and the user calls a method exposed by
294
+ // the remote. We detect the iframe has been removed and force
295
+ // a destroy() immediately so that the consumer sees the error saying
296
+ // the connection has been destroyed. We wrap this check in a try catch
297
+ // because Edge throws an "Object expected" error when accessing
298
+ // contentWindow.closed on a contentWindow from an iframe that's been
299
+ // removed from the DOM.
300
+ let iframeRemoved;
301
+ try {
302
+ if (remote.closed) {
303
+ iframeRemoved = true;
304
+ }
305
+ }
306
+ catch (e) {
307
+ iframeRemoved = true;
308
+ }
309
+ if (iframeRemoved) {
310
+ destroyConnection();
311
+ }
312
+ if (destroyed) {
313
+ const error = new Error(`Unable to send ${methodName}() call due ` + `to destroyed connection`);
314
+ error.code = ErrorCode.ConnectionDestroyed;
315
+ throw error;
316
+ }
317
+ return new Promise((resolve, reject) => {
318
+ const id = generateId();
319
+ const handleMessageEvent = (event) => {
320
+ if (event.source !== remote ||
321
+ event.data.penpal !== MessageType.Reply ||
322
+ event.data.id !== id) {
323
+ return;
324
+ }
325
+ if (event.origin !== originForReceiving) {
326
+ log(`${localName} received message from origin ${event.origin} which did not match expected origin ${originForReceiving}`);
327
+ return;
328
+ }
329
+ const replyMessage = event.data;
330
+ log(`${localName}: Received ${methodName}() reply`);
331
+ local.removeEventListener(NativeEventType.Message, handleMessageEvent);
332
+ let returnValue = replyMessage.returnValue;
333
+ if (replyMessage.returnValueIsError) {
334
+ returnValue = deserializeError(returnValue);
335
+ }
336
+ (replyMessage.resolution === Resolution.Fulfilled ? resolve : reject)(returnValue);
337
+ };
338
+ local.addEventListener(NativeEventType.Message, handleMessageEvent);
339
+ const callMessage = {
340
+ penpal: MessageType.Call,
341
+ id,
342
+ methodName,
343
+ args,
344
+ };
345
+ remote.postMessage(callMessage, originForSending);
346
+ });
347
+ };
348
+ };
349
+ methodNames.reduce((api, methodName) => {
350
+ api[methodName] = createMethodProxy(methodName);
351
+ return api;
352
+ }, callSender);
353
+ return () => {
354
+ destroyed = true;
355
+ };
356
+ };
357
+
358
+ /**
359
+ * Handles an ACK handshake message.
360
+ */
361
+ var handleAckMessageFactory = (methods, childOrigin, originForSending, destructor, log) => {
362
+ const { destroy, onDestroy } = destructor;
363
+ let destroyCallReceiver;
364
+ let receiverMethodNames;
365
+ // We resolve the promise with the call sender. If the child reconnects
366
+ // (for example, after refreshing or navigating to another page that
367
+ // uses Penpal, we'll update the call sender with methods that match the
368
+ // latest provided by the child.
369
+ const callSender = {};
370
+ return (event) => {
371
+ if (event.origin !== childOrigin) {
372
+ log(`Parent: Handshake - Received ACK message from origin ${event.origin} which did not match expected origin ${childOrigin}`);
373
+ return;
374
+ }
375
+ log('Parent: Handshake - Received ACK');
376
+ const info = {
377
+ localName: 'Parent',
378
+ local: window,
379
+ remote: event.source,
380
+ originForSending: originForSending,
381
+ originForReceiving: childOrigin,
382
+ };
383
+ // If the child reconnected, we need to destroy the prior call receiver
384
+ // before setting up a new one.
385
+ if (destroyCallReceiver) {
386
+ destroyCallReceiver();
387
+ }
388
+ destroyCallReceiver = connectCallReceiver(info, methods, log);
389
+ onDestroy(destroyCallReceiver);
390
+ // If the child reconnected, we need to remove the methods from the
391
+ // previous call receiver off the sender.
392
+ if (receiverMethodNames) {
393
+ receiverMethodNames.forEach((receiverMethodName) => {
394
+ delete callSender[receiverMethodName];
395
+ });
396
+ }
397
+ receiverMethodNames = event.data.methodNames;
398
+ const destroyCallSender = connectCallSender(callSender, info, receiverMethodNames, destroy, log);
399
+ onDestroy(destroyCallSender);
400
+ return callSender;
401
+ };
402
+ };
403
+
404
+ /**
405
+ * Handles a SYN handshake message.
406
+ */
407
+ var handleSynMessageFactory = (log, methods, childOrigin, originForSending) => {
408
+ return (event) => {
409
+ if (event.origin !== childOrigin) {
410
+ log(`Parent: Handshake - Received SYN message from origin ${event.origin} which did not match expected origin ${childOrigin}`);
411
+ return;
412
+ }
413
+ log('Parent: Handshake - Received SYN, responding with SYN-ACK');
414
+ const synAckMessage = {
415
+ penpal: MessageType.SynAck,
416
+ methodNames: Object.keys(methods),
417
+ };
418
+ event.source.postMessage(synAckMessage, originForSending);
419
+ };
420
+ };
421
+
422
+ const CHECK_IFRAME_IN_DOC_INTERVAL = 60000;
423
+ /**
424
+ * Monitors for iframe removal and destroys connection if iframe
425
+ * is found to have been removed from DOM. This is to prevent memory
426
+ * leaks when the iframe is removed from the document and the consumer
427
+ * hasn't called destroy(). Without this, event listeners attached to
428
+ * the window would stick around and since the event handlers have a
429
+ * reference to the iframe in their closures, the iframe would stick
430
+ * around too.
431
+ */
432
+ var monitorIframeRemoval = (iframe, destructor) => {
433
+ const { destroy, onDestroy } = destructor;
434
+ const checkIframeInDocIntervalId = setInterval(() => {
435
+ if (!iframe.isConnected) {
436
+ clearInterval(checkIframeInDocIntervalId);
437
+ destroy();
438
+ }
439
+ }, CHECK_IFRAME_IN_DOC_INTERVAL);
440
+ onDestroy(() => {
441
+ clearInterval(checkIframeInDocIntervalId);
442
+ });
443
+ };
444
+
445
+ /**
446
+ * Starts a timeout and calls the callback with an error
447
+ * if the timeout completes before the stop function is called.
448
+ */
449
+ var startConnectionTimeout = (timeout, callback) => {
450
+ let timeoutId;
451
+ if (timeout !== undefined) {
452
+ timeoutId = window.setTimeout(() => {
453
+ const error = new Error(`Connection timed out after ${timeout}ms`);
454
+ error.code = ErrorCode.ConnectionTimeout;
455
+ callback(error);
456
+ }, timeout);
457
+ }
458
+ return () => {
459
+ clearTimeout(timeoutId);
460
+ };
461
+ };
462
+
463
+ var validateIframeHasSrcOrSrcDoc = (iframe) => {
464
+ if (!iframe.src && !iframe.srcdoc) {
465
+ const error = new Error('Iframe must have src or srcdoc property defined.');
466
+ error.code = ErrorCode.NoIframeSrc;
467
+ throw error;
468
+ }
469
+ };
470
+
471
+ /**
472
+ * Attempts to establish communication with an iframe.
473
+ */
474
+ var connectToChild = (options) => {
475
+ let { iframe, methods = {}, childOrigin, timeout, debug = false } = options;
476
+ const log = createLogger(debug);
477
+ const destructor = createDestructor('Parent', log);
478
+ const { onDestroy, destroy } = destructor;
479
+ if (!childOrigin) {
480
+ validateIframeHasSrcOrSrcDoc(iframe);
481
+ childOrigin = getOriginFromSrc(iframe.src);
482
+ }
483
+ // If event.origin is "null", the remote protocol is file: or data: and we
484
+ // must post messages with "*" as targetOrigin when sending messages.
485
+ // https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage#Using_window.postMessage_in_extensions
486
+ const originForSending = childOrigin === 'null' ? '*' : childOrigin;
487
+ const handleSynMessage = handleSynMessageFactory(log, methods, childOrigin, originForSending);
488
+ const handleAckMessage = handleAckMessageFactory(methods, childOrigin, originForSending, destructor, log);
489
+ const promise = new Promise((resolve, reject) => {
490
+ const stopConnectionTimeout = startConnectionTimeout(timeout, destroy);
491
+ const handleMessage = (event) => {
492
+ if (event.source !== iframe.contentWindow || !event.data) {
493
+ return;
494
+ }
495
+ if (event.data.penpal === MessageType.Syn) {
496
+ handleSynMessage(event);
497
+ return;
498
+ }
499
+ if (event.data.penpal === MessageType.Ack) {
500
+ const callSender = handleAckMessage(event);
501
+ if (callSender) {
502
+ stopConnectionTimeout();
503
+ resolve(callSender);
504
+ }
505
+ return;
506
+ }
507
+ };
508
+ window.addEventListener(NativeEventType.Message, handleMessage);
509
+ log('Parent: Awaiting handshake');
510
+ monitorIframeRemoval(iframe, destructor);
511
+ onDestroy((error) => {
512
+ window.removeEventListener(NativeEventType.Message, handleMessage);
513
+ if (error) {
514
+ reject(error);
515
+ }
516
+ });
517
+ });
518
+ return {
519
+ promise,
520
+ destroy() {
521
+ // Don't allow consumer to pass an error into destroy.
522
+ destroy();
523
+ },
524
+ };
525
+ };
526
+
527
+ /* eslint no-void: "off" */
528
+
529
+ // Loaded ready states
530
+ var loadedStates = ['interactive', 'complete'];
531
+
532
+ // Return Promise
533
+ var whenDomReady = function whenDomReady(cb, doc) {
534
+ return new Promise(function (resolve) {
535
+ // Allow doc to be passed in as the lone first param
536
+ if (cb && typeof cb !== 'function') {
537
+ doc = cb;
538
+ cb = null;
539
+ }
540
+
541
+ // Use global document if we don't have one
542
+ doc = doc || window.document;
543
+
544
+ // Handle DOM load
545
+ var done = function done() {
546
+ return resolve(void (cb && setTimeout(cb)));
547
+ };
548
+
549
+ // Resolve now if DOM has already loaded
550
+ // Otherwise wait for DOMContentLoaded
551
+ if (loadedStates.indexOf(doc.readyState) !== -1) {
552
+ done();
553
+ } else {
554
+ doc.addEventListener('DOMContentLoaded', done);
555
+ }
556
+ });
557
+ };
558
+
559
+ // Promise chain helper
560
+ whenDomReady.resume = function (doc) {
561
+ return function (val) {
562
+ return whenDomReady(doc).then(function () {
563
+ return val;
564
+ });
565
+ };
566
+ };
567
+
568
+ // eslint-disable-next-line dot-notation
569
+ var MOUNT_URL = {"MOUNT_URL":"https://app.usecsv.com/importer"}["MOUNT_URL"] ;
570
+ var insertIframe = function (id) {
571
+ var _a;
572
+ insertCss_2("\n .usecsv_container {\n position: fixed;\n top: 0;\n bottom: 0;\n right: 0;\n left: 0;\n z-index: 100000;\n }\n .usecsv_container iframe {\n width: 100%;\n height: 100%;\n position: absolute;\n border-width: 0;\n }\n .usecsv_container {\n overflow: hidden;\n overscroll-behavior-x: none;\n }\n");
573
+ document.body.insertAdjacentHTML("beforeend", "<div id=" + id + " class=\"usecsv_container loading\">\n</div>");
574
+ var iframe = document.createElement("iframe");
575
+ iframe.setAttribute("src", MOUNT_URL);
576
+ (_a = document.getElementById(id)) === null || _a === void 0 ? void 0 : _a.appendChild(iframe);
577
+ return iframe;
578
+ };
579
+ var useCsvPlugin = function (_a) {
580
+ var importerKey = _a.importerKey, user = _a.user, metadata = _a.metadata;
581
+ var id = "usecsv-" + Math.round(Math.random() * 100000000);
582
+ return whenDomReady().then(function () {
583
+ var iframe = insertIframe(id);
584
+ var iframeConnection = connectToChild({
585
+ iframe: iframe,
586
+ });
587
+ iframeConnection.promise.then(function (child) {
588
+ var _a;
589
+ (_a = document.getElementById(id)) === null || _a === void 0 ? void 0 : _a.classList.remove("loading");
590
+ // eslint-disable-next-line dot-notation
591
+ child["setParams"] && child["setParams"]({ importerKey: importerKey, user: user, metadata: metadata });
592
+ });
593
+ return iframeConnection;
594
+ });
595
+ };
596
+
597
+ function createCommonjsModule(fn, module) {
598
+ return module = { exports: {} }, fn(module, module.exports), module.exports;
599
+ }
600
+
601
+ /*
602
+ object-assign
603
+ (c) Sindre Sorhus
604
+ @license MIT
605
+ */
606
+ /* eslint-disable no-unused-vars */
607
+ var getOwnPropertySymbols = Object.getOwnPropertySymbols;
608
+ var hasOwnProperty = Object.prototype.hasOwnProperty;
609
+ var propIsEnumerable = Object.prototype.propertyIsEnumerable;
610
+
611
+ function toObject(val) {
612
+ if (val === null || val === undefined) {
613
+ throw new TypeError('Object.assign cannot be called with null or undefined');
614
+ }
615
+
616
+ return Object(val);
617
+ }
618
+
619
+ function shouldUseNative() {
620
+ try {
621
+ if (!Object.assign) {
622
+ return false;
623
+ }
624
+
625
+ // Detect buggy property enumeration order in older V8 versions.
626
+
627
+ // https://bugs.chromium.org/p/v8/issues/detail?id=4118
628
+ var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
629
+ test1[5] = 'de';
630
+ if (Object.getOwnPropertyNames(test1)[0] === '5') {
631
+ return false;
632
+ }
633
+
634
+ // https://bugs.chromium.org/p/v8/issues/detail?id=3056
635
+ var test2 = {};
636
+ for (var i = 0; i < 10; i++) {
637
+ test2['_' + String.fromCharCode(i)] = i;
638
+ }
639
+ var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
640
+ return test2[n];
641
+ });
642
+ if (order2.join('') !== '0123456789') {
643
+ return false;
644
+ }
645
+
646
+ // https://bugs.chromium.org/p/v8/issues/detail?id=3056
647
+ var test3 = {};
648
+ 'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
649
+ test3[letter] = letter;
650
+ });
651
+ if (Object.keys(Object.assign({}, test3)).join('') !==
652
+ 'abcdefghijklmnopqrst') {
653
+ return false;
654
+ }
655
+
656
+ return true;
657
+ } catch (err) {
658
+ // We don't expect any of the above to throw, but better to be safe.
659
+ return false;
660
+ }
661
+ }
662
+
663
+ var objectAssign = shouldUseNative() ? Object.assign : function (target, source) {
664
+ var from;
665
+ var to = toObject(target);
666
+ var symbols;
667
+
668
+ for (var s = 1; s < arguments.length; s++) {
669
+ from = Object(arguments[s]);
670
+
671
+ for (var key in from) {
672
+ if (hasOwnProperty.call(from, key)) {
673
+ to[key] = from[key];
674
+ }
675
+ }
676
+
677
+ if (getOwnPropertySymbols) {
678
+ symbols = getOwnPropertySymbols(from);
679
+ for (var i = 0; i < symbols.length; i++) {
680
+ if (propIsEnumerable.call(from, symbols[i])) {
681
+ to[symbols[i]] = from[symbols[i]];
682
+ }
683
+ }
684
+ }
685
+ }
686
+
687
+ return to;
688
+ };
689
+
690
+ var react_production_min = createCommonjsModule(function (module, exports) {
691
+ var 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;
692
+ if("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;
693
+ function 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."}
694
+ var 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");};
695
+ function 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};
696
+ function 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}}
697
+ function 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)}
698
+ function 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=
699
+ 0;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}
700
+ function 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};
701
+ exports.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;
702
+ exports.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,
703
+ key: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;
704
+ exports.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)};
705
+ exports.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.2";
706
+ });
707
+ react_production_min.Fragment;
708
+ react_production_min.StrictMode;
709
+ react_production_min.Profiler;
710
+ react_production_min.Suspense;
711
+ react_production_min.Children;
712
+ react_production_min.Component;
713
+ react_production_min.PureComponent;
714
+ react_production_min.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
715
+ react_production_min.cloneElement;
716
+ react_production_min.createContext;
717
+ react_production_min.createElement;
718
+ react_production_min.createFactory;
719
+ react_production_min.createRef;
720
+ react_production_min.forwardRef;
721
+ react_production_min.isValidElement;
722
+ react_production_min.lazy;
723
+ react_production_min.memo;
724
+ react_production_min.useCallback;
725
+ react_production_min.useContext;
726
+ react_production_min.useDebugValue;
727
+ react_production_min.useEffect;
728
+ react_production_min.useImperativeHandle;
729
+ react_production_min.useLayoutEffect;
730
+ react_production_min.useMemo;
731
+ react_production_min.useReducer;
732
+ react_production_min.useRef;
733
+ react_production_min.useState;
734
+ react_production_min.version;
735
+
736
+ var react_development = createCommonjsModule(function (module, exports) {
737
+
738
+ if (process.env.NODE_ENV !== "production") {
739
+ (function() {
740
+
741
+ var _assign = objectAssign;
742
+
743
+ // TODO: this is special because it gets imported during build.
744
+ var ReactVersion = '17.0.2';
745
+
746
+ // ATTENTION
747
+ // When adding new symbols to this file,
748
+ // Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'
749
+ // The Symbol used to tag the ReactElement-like types. If there is no native Symbol
750
+ // nor polyfill, then a plain number is used for performance.
751
+ var REACT_ELEMENT_TYPE = 0xeac7;
752
+ var REACT_PORTAL_TYPE = 0xeaca;
753
+ exports.Fragment = 0xeacb;
754
+ exports.StrictMode = 0xeacc;
755
+ exports.Profiler = 0xead2;
756
+ var REACT_PROVIDER_TYPE = 0xeacd;
757
+ var REACT_CONTEXT_TYPE = 0xeace;
758
+ var REACT_FORWARD_REF_TYPE = 0xead0;
759
+ exports.Suspense = 0xead1;
760
+ var REACT_SUSPENSE_LIST_TYPE = 0xead8;
761
+ var REACT_MEMO_TYPE = 0xead3;
762
+ var REACT_LAZY_TYPE = 0xead4;
763
+ var REACT_BLOCK_TYPE = 0xead9;
764
+ var REACT_SERVER_BLOCK_TYPE = 0xeada;
765
+ var REACT_FUNDAMENTAL_TYPE = 0xead5;
766
+ var REACT_DEBUG_TRACING_MODE_TYPE = 0xeae1;
767
+ var REACT_LEGACY_HIDDEN_TYPE = 0xeae3;
768
+
769
+ if (typeof Symbol === 'function' && Symbol.for) {
770
+ var symbolFor = Symbol.for;
771
+ REACT_ELEMENT_TYPE = symbolFor('react.element');
772
+ REACT_PORTAL_TYPE = symbolFor('react.portal');
773
+ exports.Fragment = symbolFor('react.fragment');
774
+ exports.StrictMode = symbolFor('react.strict_mode');
775
+ exports.Profiler = symbolFor('react.profiler');
776
+ REACT_PROVIDER_TYPE = symbolFor('react.provider');
777
+ REACT_CONTEXT_TYPE = symbolFor('react.context');
778
+ REACT_FORWARD_REF_TYPE = symbolFor('react.forward_ref');
779
+ exports.Suspense = symbolFor('react.suspense');
780
+ REACT_SUSPENSE_LIST_TYPE = symbolFor('react.suspense_list');
781
+ REACT_MEMO_TYPE = symbolFor('react.memo');
782
+ REACT_LAZY_TYPE = symbolFor('react.lazy');
783
+ REACT_BLOCK_TYPE = symbolFor('react.block');
784
+ REACT_SERVER_BLOCK_TYPE = symbolFor('react.server.block');
785
+ REACT_FUNDAMENTAL_TYPE = symbolFor('react.fundamental');
786
+ symbolFor('react.scope');
787
+ symbolFor('react.opaque.id');
788
+ REACT_DEBUG_TRACING_MODE_TYPE = symbolFor('react.debug_trace_mode');
789
+ symbolFor('react.offscreen');
790
+ REACT_LEGACY_HIDDEN_TYPE = symbolFor('react.legacy_hidden');
791
+ }
792
+
793
+ var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
794
+ var FAUX_ITERATOR_SYMBOL = '@@iterator';
795
+ function getIteratorFn(maybeIterable) {
796
+ if (maybeIterable === null || typeof maybeIterable !== 'object') {
797
+ return null;
798
+ }
799
+
800
+ var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
801
+
802
+ if (typeof maybeIterator === 'function') {
803
+ return maybeIterator;
804
+ }
805
+
806
+ return null;
807
+ }
808
+
809
+ /**
810
+ * Keeps track of the current dispatcher.
811
+ */
812
+ var ReactCurrentDispatcher = {
813
+ /**
814
+ * @internal
815
+ * @type {ReactComponent}
816
+ */
817
+ current: null
818
+ };
819
+
820
+ /**
821
+ * Keeps track of the current batch's configuration such as how long an update
822
+ * should suspend for if it needs to.
823
+ */
824
+ var ReactCurrentBatchConfig = {
825
+ transition: 0
826
+ };
827
+
828
+ /**
829
+ * Keeps track of the current owner.
830
+ *
831
+ * The current owner is the component who should own any components that are
832
+ * currently being constructed.
833
+ */
834
+ var ReactCurrentOwner = {
835
+ /**
836
+ * @internal
837
+ * @type {ReactComponent}
838
+ */
839
+ current: null
840
+ };
841
+
842
+ var ReactDebugCurrentFrame = {};
843
+ var currentExtraStackFrame = null;
844
+ function setExtraStackFrame(stack) {
845
+ {
846
+ currentExtraStackFrame = stack;
847
+ }
848
+ }
849
+
850
+ {
851
+ ReactDebugCurrentFrame.setExtraStackFrame = function (stack) {
852
+ {
853
+ currentExtraStackFrame = stack;
854
+ }
855
+ }; // Stack implementation injected by the current renderer.
856
+
857
+
858
+ ReactDebugCurrentFrame.getCurrentStack = null;
859
+
860
+ ReactDebugCurrentFrame.getStackAddendum = function () {
861
+ var stack = ''; // Add an extra top frame while an element is being validated
862
+
863
+ if (currentExtraStackFrame) {
864
+ stack += currentExtraStackFrame;
865
+ } // Delegate to the injected renderer-specific implementation
866
+
867
+
868
+ var impl = ReactDebugCurrentFrame.getCurrentStack;
869
+
870
+ if (impl) {
871
+ stack += impl() || '';
872
+ }
873
+
874
+ return stack;
875
+ };
876
+ }
877
+
878
+ /**
879
+ * Used by act() to track whether you're inside an act() scope.
880
+ */
881
+ var IsSomeRendererActing = {
882
+ current: false
883
+ };
884
+
885
+ var ReactSharedInternals = {
886
+ ReactCurrentDispatcher: ReactCurrentDispatcher,
887
+ ReactCurrentBatchConfig: ReactCurrentBatchConfig,
888
+ ReactCurrentOwner: ReactCurrentOwner,
889
+ IsSomeRendererActing: IsSomeRendererActing,
890
+ // Used by renderers to avoid bundling object-assign twice in UMD bundles:
891
+ assign: _assign
892
+ };
893
+
894
+ {
895
+ ReactSharedInternals.ReactDebugCurrentFrame = ReactDebugCurrentFrame;
896
+ }
897
+
898
+ // by calls to these methods by a Babel plugin.
899
+ //
900
+ // In PROD (or in packages without access to React internals),
901
+ // they are left as they are instead.
902
+
903
+ function warn(format) {
904
+ {
905
+ for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
906
+ args[_key - 1] = arguments[_key];
907
+ }
908
+
909
+ printWarning('warn', format, args);
910
+ }
911
+ }
912
+ function error(format) {
913
+ {
914
+ for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
915
+ args[_key2 - 1] = arguments[_key2];
916
+ }
917
+
918
+ printWarning('error', format, args);
919
+ }
920
+ }
921
+
922
+ function printWarning(level, format, args) {
923
+ // When changing this logic, you might want to also
924
+ // update consoleWithStackDev.www.js as well.
925
+ {
926
+ var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
927
+ var stack = ReactDebugCurrentFrame.getStackAddendum();
928
+
929
+ if (stack !== '') {
930
+ format += '%s';
931
+ args = args.concat([stack]);
932
+ }
933
+
934
+ var argsWithFormat = args.map(function (item) {
935
+ return '' + item;
936
+ }); // Careful: RN currently depends on this prefix
937
+
938
+ argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
939
+ // breaks IE9: https://github.com/facebook/react/issues/13610
940
+ // eslint-disable-next-line react-internal/no-production-logging
941
+
942
+ Function.prototype.apply.call(console[level], console, argsWithFormat);
943
+ }
944
+ }
945
+
946
+ var didWarnStateUpdateForUnmountedComponent = {};
947
+
948
+ function warnNoop(publicInstance, callerName) {
949
+ {
950
+ var _constructor = publicInstance.constructor;
951
+ var componentName = _constructor && (_constructor.displayName || _constructor.name) || 'ReactClass';
952
+ var warningKey = componentName + "." + callerName;
953
+
954
+ if (didWarnStateUpdateForUnmountedComponent[warningKey]) {
955
+ return;
956
+ }
957
+
958
+ 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);
959
+
960
+ didWarnStateUpdateForUnmountedComponent[warningKey] = true;
961
+ }
962
+ }
963
+ /**
964
+ * This is the abstract API for an update queue.
965
+ */
966
+
967
+
968
+ var ReactNoopUpdateQueue = {
969
+ /**
970
+ * Checks whether or not this composite component is mounted.
971
+ * @param {ReactClass} publicInstance The instance we want to test.
972
+ * @return {boolean} True if mounted, false otherwise.
973
+ * @protected
974
+ * @final
975
+ */
976
+ isMounted: function (publicInstance) {
977
+ return false;
978
+ },
979
+
980
+ /**
981
+ * Forces an update. This should only be invoked when it is known with
982
+ * certainty that we are **not** in a DOM transaction.
983
+ *
984
+ * You may want to call this when you know that some deeper aspect of the
985
+ * component's state has changed but `setState` was not called.
986
+ *
987
+ * This will not invoke `shouldComponentUpdate`, but it will invoke
988
+ * `componentWillUpdate` and `componentDidUpdate`.
989
+ *
990
+ * @param {ReactClass} publicInstance The instance that should rerender.
991
+ * @param {?function} callback Called after component is updated.
992
+ * @param {?string} callerName name of the calling function in the public API.
993
+ * @internal
994
+ */
995
+ enqueueForceUpdate: function (publicInstance, callback, callerName) {
996
+ warnNoop(publicInstance, 'forceUpdate');
997
+ },
998
+
999
+ /**
1000
+ * Replaces all of the state. Always use this or `setState` to mutate state.
1001
+ * You should treat `this.state` as immutable.
1002
+ *
1003
+ * There is no guarantee that `this.state` will be immediately updated, so
1004
+ * accessing `this.state` after calling this method may return the old value.
1005
+ *
1006
+ * @param {ReactClass} publicInstance The instance that should rerender.
1007
+ * @param {object} completeState Next state.
1008
+ * @param {?function} callback Called after component is updated.
1009
+ * @param {?string} callerName name of the calling function in the public API.
1010
+ * @internal
1011
+ */
1012
+ enqueueReplaceState: function (publicInstance, completeState, callback, callerName) {
1013
+ warnNoop(publicInstance, 'replaceState');
1014
+ },
1015
+
1016
+ /**
1017
+ * Sets a subset of the state. This only exists because _pendingState is
1018
+ * internal. This provides a merging strategy that is not available to deep
1019
+ * properties which is confusing. TODO: Expose pendingState or don't use it
1020
+ * during the merge.
1021
+ *
1022
+ * @param {ReactClass} publicInstance The instance that should rerender.
1023
+ * @param {object} partialState Next partial state to be merged with state.
1024
+ * @param {?function} callback Called after component is updated.
1025
+ * @param {?string} Name of the calling function in the public API.
1026
+ * @internal
1027
+ */
1028
+ enqueueSetState: function (publicInstance, partialState, callback, callerName) {
1029
+ warnNoop(publicInstance, 'setState');
1030
+ }
1031
+ };
1032
+
1033
+ var emptyObject = {};
1034
+
1035
+ {
1036
+ Object.freeze(emptyObject);
1037
+ }
1038
+ /**
1039
+ * Base class helpers for the updating state of a component.
1040
+ */
1041
+
1042
+
1043
+ function Component(props, context, updater) {
1044
+ this.props = props;
1045
+ this.context = context; // If a component has string refs, we will assign a different object later.
1046
+
1047
+ this.refs = emptyObject; // We initialize the default updater but the real one gets injected by the
1048
+ // renderer.
1049
+
1050
+ this.updater = updater || ReactNoopUpdateQueue;
1051
+ }
1052
+
1053
+ Component.prototype.isReactComponent = {};
1054
+ /**
1055
+ * Sets a subset of the state. Always use this to mutate
1056
+ * state. You should treat `this.state` as immutable.
1057
+ *
1058
+ * There is no guarantee that `this.state` will be immediately updated, so
1059
+ * accessing `this.state` after calling this method may return the old value.
1060
+ *
1061
+ * There is no guarantee that calls to `setState` will run synchronously,
1062
+ * as they may eventually be batched together. You can provide an optional
1063
+ * callback that will be executed when the call to setState is actually
1064
+ * completed.
1065
+ *
1066
+ * When a function is provided to setState, it will be called at some point in
1067
+ * the future (not synchronously). It will be called with the up to date
1068
+ * component arguments (state, props, context). These values can be different
1069
+ * from this.* because your function may be called after receiveProps but before
1070
+ * shouldComponentUpdate, and this new state, props, and context will not yet be
1071
+ * assigned to this.
1072
+ *
1073
+ * @param {object|function} partialState Next partial state or function to
1074
+ * produce next partial state to be merged with current state.
1075
+ * @param {?function} callback Called after state is updated.
1076
+ * @final
1077
+ * @protected
1078
+ */
1079
+
1080
+ Component.prototype.setState = function (partialState, callback) {
1081
+ if (!(typeof partialState === 'object' || typeof partialState === 'function' || partialState == null)) {
1082
+ {
1083
+ throw Error( "setState(...): takes an object of state variables to update or a function which returns an object of state variables." );
1084
+ }
1085
+ }
1086
+
1087
+ this.updater.enqueueSetState(this, partialState, callback, 'setState');
1088
+ };
1089
+ /**
1090
+ * Forces an update. This should only be invoked when it is known with
1091
+ * certainty that we are **not** in a DOM transaction.
1092
+ *
1093
+ * You may want to call this when you know that some deeper aspect of the
1094
+ * component's state has changed but `setState` was not called.
1095
+ *
1096
+ * This will not invoke `shouldComponentUpdate`, but it will invoke
1097
+ * `componentWillUpdate` and `componentDidUpdate`.
1098
+ *
1099
+ * @param {?function} callback Called after update is complete.
1100
+ * @final
1101
+ * @protected
1102
+ */
1103
+
1104
+
1105
+ Component.prototype.forceUpdate = function (callback) {
1106
+ this.updater.enqueueForceUpdate(this, callback, 'forceUpdate');
1107
+ };
1108
+ /**
1109
+ * Deprecated APIs. These APIs used to exist on classic React classes but since
1110
+ * we would like to deprecate them, we're not going to move them over to this
1111
+ * modern base class. Instead, we define a getter that warns if it's accessed.
1112
+ */
1113
+
1114
+
1115
+ {
1116
+ var deprecatedAPIs = {
1117
+ isMounted: ['isMounted', 'Instead, make sure to clean up subscriptions and pending requests in ' + 'componentWillUnmount to prevent memory leaks.'],
1118
+ replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).']
1119
+ };
1120
+
1121
+ var defineDeprecationWarning = function (methodName, info) {
1122
+ Object.defineProperty(Component.prototype, methodName, {
1123
+ get: function () {
1124
+ warn('%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]);
1125
+
1126
+ return undefined;
1127
+ }
1128
+ });
1129
+ };
1130
+
1131
+ for (var fnName in deprecatedAPIs) {
1132
+ if (deprecatedAPIs.hasOwnProperty(fnName)) {
1133
+ defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
1134
+ }
1135
+ }
1136
+ }
1137
+
1138
+ function ComponentDummy() {}
1139
+
1140
+ ComponentDummy.prototype = Component.prototype;
1141
+ /**
1142
+ * Convenience component with default shallow equality check for sCU.
1143
+ */
1144
+
1145
+ function PureComponent(props, context, updater) {
1146
+ this.props = props;
1147
+ this.context = context; // If a component has string refs, we will assign a different object later.
1148
+
1149
+ this.refs = emptyObject;
1150
+ this.updater = updater || ReactNoopUpdateQueue;
1151
+ }
1152
+
1153
+ var pureComponentPrototype = PureComponent.prototype = new ComponentDummy();
1154
+ pureComponentPrototype.constructor = PureComponent; // Avoid an extra prototype jump for these methods.
1155
+
1156
+ _assign(pureComponentPrototype, Component.prototype);
1157
+
1158
+ pureComponentPrototype.isPureReactComponent = true;
1159
+
1160
+ // an immutable object with a single mutable value
1161
+ function createRef() {
1162
+ var refObject = {
1163
+ current: null
1164
+ };
1165
+
1166
+ {
1167
+ Object.seal(refObject);
1168
+ }
1169
+
1170
+ return refObject;
1171
+ }
1172
+
1173
+ function getWrappedName(outerType, innerType, wrapperName) {
1174
+ var functionName = innerType.displayName || innerType.name || '';
1175
+ return outerType.displayName || (functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName);
1176
+ }
1177
+
1178
+ function getContextName(type) {
1179
+ return type.displayName || 'Context';
1180
+ }
1181
+
1182
+ function getComponentName(type) {
1183
+ if (type == null) {
1184
+ // Host root, text node or just invalid type.
1185
+ return null;
1186
+ }
1187
+
1188
+ {
1189
+ if (typeof type.tag === 'number') {
1190
+ error('Received an unexpected object in getComponentName(). ' + 'This is likely a bug in React. Please file an issue.');
1191
+ }
1192
+ }
1193
+
1194
+ if (typeof type === 'function') {
1195
+ return type.displayName || type.name || null;
1196
+ }
1197
+
1198
+ if (typeof type === 'string') {
1199
+ return type;
1200
+ }
1201
+
1202
+ switch (type) {
1203
+ case exports.Fragment:
1204
+ return 'Fragment';
1205
+
1206
+ case REACT_PORTAL_TYPE:
1207
+ return 'Portal';
1208
+
1209
+ case exports.Profiler:
1210
+ return 'Profiler';
1211
+
1212
+ case exports.StrictMode:
1213
+ return 'StrictMode';
1214
+
1215
+ case exports.Suspense:
1216
+ return 'Suspense';
1217
+
1218
+ case REACT_SUSPENSE_LIST_TYPE:
1219
+ return 'SuspenseList';
1220
+ }
1221
+
1222
+ if (typeof type === 'object') {
1223
+ switch (type.$$typeof) {
1224
+ case REACT_CONTEXT_TYPE:
1225
+ var context = type;
1226
+ return getContextName(context) + '.Consumer';
1227
+
1228
+ case REACT_PROVIDER_TYPE:
1229
+ var provider = type;
1230
+ return getContextName(provider._context) + '.Provider';
1231
+
1232
+ case REACT_FORWARD_REF_TYPE:
1233
+ return getWrappedName(type, type.render, 'ForwardRef');
1234
+
1235
+ case REACT_MEMO_TYPE:
1236
+ return getComponentName(type.type);
1237
+
1238
+ case REACT_BLOCK_TYPE:
1239
+ return getComponentName(type._render);
1240
+
1241
+ case REACT_LAZY_TYPE:
1242
+ {
1243
+ var lazyComponent = type;
1244
+ var payload = lazyComponent._payload;
1245
+ var init = lazyComponent._init;
1246
+
1247
+ try {
1248
+ return getComponentName(init(payload));
1249
+ } catch (x) {
1250
+ return null;
1251
+ }
1252
+ }
1253
+ }
1254
+ }
1255
+
1256
+ return null;
1257
+ }
1258
+
1259
+ var hasOwnProperty = Object.prototype.hasOwnProperty;
1260
+ var RESERVED_PROPS = {
1261
+ key: true,
1262
+ ref: true,
1263
+ __self: true,
1264
+ __source: true
1265
+ };
1266
+ var specialPropKeyWarningShown, specialPropRefWarningShown, didWarnAboutStringRefs;
1267
+
1268
+ {
1269
+ didWarnAboutStringRefs = {};
1270
+ }
1271
+
1272
+ function hasValidRef(config) {
1273
+ {
1274
+ if (hasOwnProperty.call(config, 'ref')) {
1275
+ var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;
1276
+
1277
+ if (getter && getter.isReactWarning) {
1278
+ return false;
1279
+ }
1280
+ }
1281
+ }
1282
+
1283
+ return config.ref !== undefined;
1284
+ }
1285
+
1286
+ function hasValidKey(config) {
1287
+ {
1288
+ if (hasOwnProperty.call(config, 'key')) {
1289
+ var getter = Object.getOwnPropertyDescriptor(config, 'key').get;
1290
+
1291
+ if (getter && getter.isReactWarning) {
1292
+ return false;
1293
+ }
1294
+ }
1295
+ }
1296
+
1297
+ return config.key !== undefined;
1298
+ }
1299
+
1300
+ function defineKeyPropWarningGetter(props, displayName) {
1301
+ var warnAboutAccessingKey = function () {
1302
+ {
1303
+ if (!specialPropKeyWarningShown) {
1304
+ specialPropKeyWarningShown = true;
1305
+
1306
+ 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);
1307
+ }
1308
+ }
1309
+ };
1310
+
1311
+ warnAboutAccessingKey.isReactWarning = true;
1312
+ Object.defineProperty(props, 'key', {
1313
+ get: warnAboutAccessingKey,
1314
+ configurable: true
1315
+ });
1316
+ }
1317
+
1318
+ function defineRefPropWarningGetter(props, displayName) {
1319
+ var warnAboutAccessingRef = function () {
1320
+ {
1321
+ if (!specialPropRefWarningShown) {
1322
+ specialPropRefWarningShown = true;
1323
+
1324
+ 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);
1325
+ }
1326
+ }
1327
+ };
1328
+
1329
+ warnAboutAccessingRef.isReactWarning = true;
1330
+ Object.defineProperty(props, 'ref', {
1331
+ get: warnAboutAccessingRef,
1332
+ configurable: true
1333
+ });
1334
+ }
1335
+
1336
+ function warnIfStringRefCannotBeAutoConverted(config) {
1337
+ {
1338
+ if (typeof config.ref === 'string' && ReactCurrentOwner.current && config.__self && ReactCurrentOwner.current.stateNode !== config.__self) {
1339
+ var componentName = getComponentName(ReactCurrentOwner.current.type);
1340
+
1341
+ if (!didWarnAboutStringRefs[componentName]) {
1342
+ 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);
1343
+
1344
+ didWarnAboutStringRefs[componentName] = true;
1345
+ }
1346
+ }
1347
+ }
1348
+ }
1349
+ /**
1350
+ * Factory method to create a new React element. This no longer adheres to
1351
+ * the class pattern, so do not use new to call it. Also, instanceof check
1352
+ * will not work. Instead test $$typeof field against Symbol.for('react.element') to check
1353
+ * if something is a React Element.
1354
+ *
1355
+ * @param {*} type
1356
+ * @param {*} props
1357
+ * @param {*} key
1358
+ * @param {string|object} ref
1359
+ * @param {*} owner
1360
+ * @param {*} self A *temporary* helper to detect places where `this` is
1361
+ * different from the `owner` when React.createElement is called, so that we
1362
+ * can warn. We want to get rid of owner and replace string `ref`s with arrow
1363
+ * functions, and as long as `this` and owner are the same, there will be no
1364
+ * change in behavior.
1365
+ * @param {*} source An annotation object (added by a transpiler or otherwise)
1366
+ * indicating filename, line number, and/or other information.
1367
+ * @internal
1368
+ */
1369
+
1370
+
1371
+ var ReactElement = function (type, key, ref, self, source, owner, props) {
1372
+ var element = {
1373
+ // This tag allows us to uniquely identify this as a React Element
1374
+ $$typeof: REACT_ELEMENT_TYPE,
1375
+ // Built-in properties that belong on the element
1376
+ type: type,
1377
+ key: key,
1378
+ ref: ref,
1379
+ props: props,
1380
+ // Record the component responsible for creating this element.
1381
+ _owner: owner
1382
+ };
1383
+
1384
+ {
1385
+ // The validation flag is currently mutative. We put it on
1386
+ // an external backing store so that we can freeze the whole object.
1387
+ // This can be replaced with a WeakMap once they are implemented in
1388
+ // commonly used development environments.
1389
+ element._store = {}; // To make comparing ReactElements easier for testing purposes, we make
1390
+ // the validation flag non-enumerable (where possible, which should
1391
+ // include every environment we run tests in), so the test framework
1392
+ // ignores it.
1393
+
1394
+ Object.defineProperty(element._store, 'validated', {
1395
+ configurable: false,
1396
+ enumerable: false,
1397
+ writable: true,
1398
+ value: false
1399
+ }); // self and source are DEV only properties.
1400
+
1401
+ Object.defineProperty(element, '_self', {
1402
+ configurable: false,
1403
+ enumerable: false,
1404
+ writable: false,
1405
+ value: self
1406
+ }); // Two elements created in two different places should be considered
1407
+ // equal for testing purposes and therefore we hide it from enumeration.
1408
+
1409
+ Object.defineProperty(element, '_source', {
1410
+ configurable: false,
1411
+ enumerable: false,
1412
+ writable: false,
1413
+ value: source
1414
+ });
1415
+
1416
+ if (Object.freeze) {
1417
+ Object.freeze(element.props);
1418
+ Object.freeze(element);
1419
+ }
1420
+ }
1421
+
1422
+ return element;
1423
+ };
1424
+ /**
1425
+ * Create and return a new ReactElement of the given type.
1426
+ * See https://reactjs.org/docs/react-api.html#createelement
1427
+ */
1428
+
1429
+ function createElement(type, config, children) {
1430
+ var propName; // Reserved names are extracted
1431
+
1432
+ var props = {};
1433
+ var key = null;
1434
+ var ref = null;
1435
+ var self = null;
1436
+ var source = null;
1437
+
1438
+ if (config != null) {
1439
+ if (hasValidRef(config)) {
1440
+ ref = config.ref;
1441
+
1442
+ {
1443
+ warnIfStringRefCannotBeAutoConverted(config);
1444
+ }
1445
+ }
1446
+
1447
+ if (hasValidKey(config)) {
1448
+ key = '' + config.key;
1449
+ }
1450
+
1451
+ self = config.__self === undefined ? null : config.__self;
1452
+ source = config.__source === undefined ? null : config.__source; // Remaining properties are added to a new props object
1453
+
1454
+ for (propName in config) {
1455
+ if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
1456
+ props[propName] = config[propName];
1457
+ }
1458
+ }
1459
+ } // Children can be more than one argument, and those are transferred onto
1460
+ // the newly allocated props object.
1461
+
1462
+
1463
+ var childrenLength = arguments.length - 2;
1464
+
1465
+ if (childrenLength === 1) {
1466
+ props.children = children;
1467
+ } else if (childrenLength > 1) {
1468
+ var childArray = Array(childrenLength);
1469
+
1470
+ for (var i = 0; i < childrenLength; i++) {
1471
+ childArray[i] = arguments[i + 2];
1472
+ }
1473
+
1474
+ {
1475
+ if (Object.freeze) {
1476
+ Object.freeze(childArray);
1477
+ }
1478
+ }
1479
+
1480
+ props.children = childArray;
1481
+ } // Resolve default props
1482
+
1483
+
1484
+ if (type && type.defaultProps) {
1485
+ var defaultProps = type.defaultProps;
1486
+
1487
+ for (propName in defaultProps) {
1488
+ if (props[propName] === undefined) {
1489
+ props[propName] = defaultProps[propName];
1490
+ }
1491
+ }
1492
+ }
1493
+
1494
+ {
1495
+ if (key || ref) {
1496
+ var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
1497
+
1498
+ if (key) {
1499
+ defineKeyPropWarningGetter(props, displayName);
1500
+ }
1501
+
1502
+ if (ref) {
1503
+ defineRefPropWarningGetter(props, displayName);
1504
+ }
1505
+ }
1506
+ }
1507
+
1508
+ return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
1509
+ }
1510
+ function cloneAndReplaceKey(oldElement, newKey) {
1511
+ var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props);
1512
+ return newElement;
1513
+ }
1514
+ /**
1515
+ * Clone and return a new ReactElement using element as the starting point.
1516
+ * See https://reactjs.org/docs/react-api.html#cloneelement
1517
+ */
1518
+
1519
+ function cloneElement(element, config, children) {
1520
+ if (!!(element === null || element === undefined)) {
1521
+ {
1522
+ throw Error( "React.cloneElement(...): The argument must be a React element, but you passed " + element + "." );
1523
+ }
1524
+ }
1525
+
1526
+ var propName; // Original props are copied
1527
+
1528
+ var props = _assign({}, element.props); // Reserved names are extracted
1529
+
1530
+
1531
+ var key = element.key;
1532
+ var ref = element.ref; // Self is preserved since the owner is preserved.
1533
+
1534
+ var self = element._self; // Source is preserved since cloneElement is unlikely to be targeted by a
1535
+ // transpiler, and the original source is probably a better indicator of the
1536
+ // true owner.
1537
+
1538
+ var source = element._source; // Owner will be preserved, unless ref is overridden
1539
+
1540
+ var owner = element._owner;
1541
+
1542
+ if (config != null) {
1543
+ if (hasValidRef(config)) {
1544
+ // Silently steal the ref from the parent.
1545
+ ref = config.ref;
1546
+ owner = ReactCurrentOwner.current;
1547
+ }
1548
+
1549
+ if (hasValidKey(config)) {
1550
+ key = '' + config.key;
1551
+ } // Remaining properties override existing props
1552
+
1553
+
1554
+ var defaultProps;
1555
+
1556
+ if (element.type && element.type.defaultProps) {
1557
+ defaultProps = element.type.defaultProps;
1558
+ }
1559
+
1560
+ for (propName in config) {
1561
+ if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
1562
+ if (config[propName] === undefined && defaultProps !== undefined) {
1563
+ // Resolve default props
1564
+ props[propName] = defaultProps[propName];
1565
+ } else {
1566
+ props[propName] = config[propName];
1567
+ }
1568
+ }
1569
+ }
1570
+ } // Children can be more than one argument, and those are transferred onto
1571
+ // the newly allocated props object.
1572
+
1573
+
1574
+ var childrenLength = arguments.length - 2;
1575
+
1576
+ if (childrenLength === 1) {
1577
+ props.children = children;
1578
+ } else if (childrenLength > 1) {
1579
+ var childArray = Array(childrenLength);
1580
+
1581
+ for (var i = 0; i < childrenLength; i++) {
1582
+ childArray[i] = arguments[i + 2];
1583
+ }
1584
+
1585
+ props.children = childArray;
1586
+ }
1587
+
1588
+ return ReactElement(element.type, key, ref, self, source, owner, props);
1589
+ }
1590
+ /**
1591
+ * Verifies the object is a ReactElement.
1592
+ * See https://reactjs.org/docs/react-api.html#isvalidelement
1593
+ * @param {?object} object
1594
+ * @return {boolean} True if `object` is a ReactElement.
1595
+ * @final
1596
+ */
1597
+
1598
+ function isValidElement(object) {
1599
+ return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
1600
+ }
1601
+
1602
+ var SEPARATOR = '.';
1603
+ var SUBSEPARATOR = ':';
1604
+ /**
1605
+ * Escape and wrap key so it is safe to use as a reactid
1606
+ *
1607
+ * @param {string} key to be escaped.
1608
+ * @return {string} the escaped key.
1609
+ */
1610
+
1611
+ function escape(key) {
1612
+ var escapeRegex = /[=:]/g;
1613
+ var escaperLookup = {
1614
+ '=': '=0',
1615
+ ':': '=2'
1616
+ };
1617
+ var escapedString = key.replace(escapeRegex, function (match) {
1618
+ return escaperLookup[match];
1619
+ });
1620
+ return '$' + escapedString;
1621
+ }
1622
+ /**
1623
+ * TODO: Test that a single child and an array with one item have the same key
1624
+ * pattern.
1625
+ */
1626
+
1627
+
1628
+ var didWarnAboutMaps = false;
1629
+ var userProvidedKeyEscapeRegex = /\/+/g;
1630
+
1631
+ function escapeUserProvidedKey(text) {
1632
+ return text.replace(userProvidedKeyEscapeRegex, '$&/');
1633
+ }
1634
+ /**
1635
+ * Generate a key string that identifies a element within a set.
1636
+ *
1637
+ * @param {*} element A element that could contain a manual key.
1638
+ * @param {number} index Index that is used if a manual key is not provided.
1639
+ * @return {string}
1640
+ */
1641
+
1642
+
1643
+ function getElementKey(element, index) {
1644
+ // Do some typechecking here since we call this blindly. We want to ensure
1645
+ // that we don't block potential future ES APIs.
1646
+ if (typeof element === 'object' && element !== null && element.key != null) {
1647
+ // Explicit key
1648
+ return escape('' + element.key);
1649
+ } // Implicit key determined by the index in the set
1650
+
1651
+
1652
+ return index.toString(36);
1653
+ }
1654
+
1655
+ function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) {
1656
+ var type = typeof children;
1657
+
1658
+ if (type === 'undefined' || type === 'boolean') {
1659
+ // All of the above are perceived as null.
1660
+ children = null;
1661
+ }
1662
+
1663
+ var invokeCallback = false;
1664
+
1665
+ if (children === null) {
1666
+ invokeCallback = true;
1667
+ } else {
1668
+ switch (type) {
1669
+ case 'string':
1670
+ case 'number':
1671
+ invokeCallback = true;
1672
+ break;
1673
+
1674
+ case 'object':
1675
+ switch (children.$$typeof) {
1676
+ case REACT_ELEMENT_TYPE:
1677
+ case REACT_PORTAL_TYPE:
1678
+ invokeCallback = true;
1679
+ }
1680
+
1681
+ }
1682
+ }
1683
+
1684
+ if (invokeCallback) {
1685
+ var _child = children;
1686
+ var mappedChild = callback(_child); // If it's the only child, treat the name as if it was wrapped in an array
1687
+ // so that it's consistent if the number of children grows:
1688
+
1689
+ var childKey = nameSoFar === '' ? SEPARATOR + getElementKey(_child, 0) : nameSoFar;
1690
+
1691
+ if (Array.isArray(mappedChild)) {
1692
+ var escapedChildKey = '';
1693
+
1694
+ if (childKey != null) {
1695
+ escapedChildKey = escapeUserProvidedKey(childKey) + '/';
1696
+ }
1697
+
1698
+ mapIntoArray(mappedChild, array, escapedChildKey, '', function (c) {
1699
+ return c;
1700
+ });
1701
+ } else if (mappedChild != null) {
1702
+ if (isValidElement(mappedChild)) {
1703
+ mappedChild = cloneAndReplaceKey(mappedChild, // Keep both the (mapped) and old keys if they differ, just as
1704
+ // traverseAllChildren used to do for objects as children
1705
+ escapedPrefix + ( // $FlowFixMe Flow incorrectly thinks React.Portal doesn't have a key
1706
+ mappedChild.key && (!_child || _child.key !== mappedChild.key) ? // $FlowFixMe Flow incorrectly thinks existing element's key can be a number
1707
+ escapeUserProvidedKey('' + mappedChild.key) + '/' : '') + childKey);
1708
+ }
1709
+
1710
+ array.push(mappedChild);
1711
+ }
1712
+
1713
+ return 1;
1714
+ }
1715
+
1716
+ var child;
1717
+ var nextName;
1718
+ var subtreeCount = 0; // Count of children found in the current subtree.
1719
+
1720
+ var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR;
1721
+
1722
+ if (Array.isArray(children)) {
1723
+ for (var i = 0; i < children.length; i++) {
1724
+ child = children[i];
1725
+ nextName = nextNamePrefix + getElementKey(child, i);
1726
+ subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback);
1727
+ }
1728
+ } else {
1729
+ var iteratorFn = getIteratorFn(children);
1730
+
1731
+ if (typeof iteratorFn === 'function') {
1732
+ var iterableChildren = children;
1733
+
1734
+ {
1735
+ // Warn about using Maps as children
1736
+ if (iteratorFn === iterableChildren.entries) {
1737
+ if (!didWarnAboutMaps) {
1738
+ warn('Using Maps as children is not supported. ' + 'Use an array of keyed ReactElements instead.');
1739
+ }
1740
+
1741
+ didWarnAboutMaps = true;
1742
+ }
1743
+ }
1744
+
1745
+ var iterator = iteratorFn.call(iterableChildren);
1746
+ var step;
1747
+ var ii = 0;
1748
+
1749
+ while (!(step = iterator.next()).done) {
1750
+ child = step.value;
1751
+ nextName = nextNamePrefix + getElementKey(child, ii++);
1752
+ subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback);
1753
+ }
1754
+ } else if (type === 'object') {
1755
+ var childrenString = '' + children;
1756
+
1757
+ {
1758
+ {
1759
+ 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." );
1760
+ }
1761
+ }
1762
+ }
1763
+ }
1764
+
1765
+ return subtreeCount;
1766
+ }
1767
+
1768
+ /**
1769
+ * Maps children that are typically specified as `props.children`.
1770
+ *
1771
+ * See https://reactjs.org/docs/react-api.html#reactchildrenmap
1772
+ *
1773
+ * The provided mapFunction(child, index) will be called for each
1774
+ * leaf child.
1775
+ *
1776
+ * @param {?*} children Children tree container.
1777
+ * @param {function(*, int)} func The map function.
1778
+ * @param {*} context Context for mapFunction.
1779
+ * @return {object} Object containing the ordered map of results.
1780
+ */
1781
+ function mapChildren(children, func, context) {
1782
+ if (children == null) {
1783
+ return children;
1784
+ }
1785
+
1786
+ var result = [];
1787
+ var count = 0;
1788
+ mapIntoArray(children, result, '', '', function (child) {
1789
+ return func.call(context, child, count++);
1790
+ });
1791
+ return result;
1792
+ }
1793
+ /**
1794
+ * Count the number of children that are typically specified as
1795
+ * `props.children`.
1796
+ *
1797
+ * See https://reactjs.org/docs/react-api.html#reactchildrencount
1798
+ *
1799
+ * @param {?*} children Children tree container.
1800
+ * @return {number} The number of children.
1801
+ */
1802
+
1803
+
1804
+ function countChildren(children) {
1805
+ var n = 0;
1806
+ mapChildren(children, function () {
1807
+ n++; // Don't return anything
1808
+ });
1809
+ return n;
1810
+ }
1811
+
1812
+ /**
1813
+ * Iterates through children that are typically specified as `props.children`.
1814
+ *
1815
+ * See https://reactjs.org/docs/react-api.html#reactchildrenforeach
1816
+ *
1817
+ * The provided forEachFunc(child, index) will be called for each
1818
+ * leaf child.
1819
+ *
1820
+ * @param {?*} children Children tree container.
1821
+ * @param {function(*, int)} forEachFunc
1822
+ * @param {*} forEachContext Context for forEachContext.
1823
+ */
1824
+ function forEachChildren(children, forEachFunc, forEachContext) {
1825
+ mapChildren(children, function () {
1826
+ forEachFunc.apply(this, arguments); // Don't return anything.
1827
+ }, forEachContext);
1828
+ }
1829
+ /**
1830
+ * Flatten a children object (typically specified as `props.children`) and
1831
+ * return an array with appropriately re-keyed children.
1832
+ *
1833
+ * See https://reactjs.org/docs/react-api.html#reactchildrentoarray
1834
+ */
1835
+
1836
+
1837
+ function toArray(children) {
1838
+ return mapChildren(children, function (child) {
1839
+ return child;
1840
+ }) || [];
1841
+ }
1842
+ /**
1843
+ * Returns the first child in a collection of children and verifies that there
1844
+ * is only one child in the collection.
1845
+ *
1846
+ * See https://reactjs.org/docs/react-api.html#reactchildrenonly
1847
+ *
1848
+ * The current implementation of this function assumes that a single child gets
1849
+ * passed without a wrapper, but the purpose of this helper function is to
1850
+ * abstract away the particular structure of children.
1851
+ *
1852
+ * @param {?object} children Child collection structure.
1853
+ * @return {ReactElement} The first and only `ReactElement` contained in the
1854
+ * structure.
1855
+ */
1856
+
1857
+
1858
+ function onlyChild(children) {
1859
+ if (!isValidElement(children)) {
1860
+ {
1861
+ throw Error( "React.Children.only expected to receive a single React element child." );
1862
+ }
1863
+ }
1864
+
1865
+ return children;
1866
+ }
1867
+
1868
+ function createContext(defaultValue, calculateChangedBits) {
1869
+ if (calculateChangedBits === undefined) {
1870
+ calculateChangedBits = null;
1871
+ } else {
1872
+ {
1873
+ if (calculateChangedBits !== null && typeof calculateChangedBits !== 'function') {
1874
+ error('createContext: Expected the optional second argument to be a ' + 'function. Instead received: %s', calculateChangedBits);
1875
+ }
1876
+ }
1877
+ }
1878
+
1879
+ var context = {
1880
+ $$typeof: REACT_CONTEXT_TYPE,
1881
+ _calculateChangedBits: calculateChangedBits,
1882
+ // As a workaround to support multiple concurrent renderers, we categorize
1883
+ // some renderers as primary and others as secondary. We only expect
1884
+ // there to be two concurrent renderers at most: React Native (primary) and
1885
+ // Fabric (secondary); React DOM (primary) and React ART (secondary).
1886
+ // Secondary renderers store their context values on separate fields.
1887
+ _currentValue: defaultValue,
1888
+ _currentValue2: defaultValue,
1889
+ // Used to track how many concurrent renderers this context currently
1890
+ // supports within in a single renderer. Such as parallel server rendering.
1891
+ _threadCount: 0,
1892
+ // These are circular
1893
+ Provider: null,
1894
+ Consumer: null
1895
+ };
1896
+ context.Provider = {
1897
+ $$typeof: REACT_PROVIDER_TYPE,
1898
+ _context: context
1899
+ };
1900
+ var hasWarnedAboutUsingNestedContextConsumers = false;
1901
+ var hasWarnedAboutUsingConsumerProvider = false;
1902
+ var hasWarnedAboutDisplayNameOnConsumer = false;
1903
+
1904
+ {
1905
+ // A separate object, but proxies back to the original context object for
1906
+ // backwards compatibility. It has a different $$typeof, so we can properly
1907
+ // warn for the incorrect usage of Context as a Consumer.
1908
+ var Consumer = {
1909
+ $$typeof: REACT_CONTEXT_TYPE,
1910
+ _context: context,
1911
+ _calculateChangedBits: context._calculateChangedBits
1912
+ }; // $FlowFixMe: Flow complains about not setting a value, which is intentional here
1913
+
1914
+ Object.defineProperties(Consumer, {
1915
+ Provider: {
1916
+ get: function () {
1917
+ if (!hasWarnedAboutUsingConsumerProvider) {
1918
+ hasWarnedAboutUsingConsumerProvider = true;
1919
+
1920
+ 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?');
1921
+ }
1922
+
1923
+ return context.Provider;
1924
+ },
1925
+ set: function (_Provider) {
1926
+ context.Provider = _Provider;
1927
+ }
1928
+ },
1929
+ _currentValue: {
1930
+ get: function () {
1931
+ return context._currentValue;
1932
+ },
1933
+ set: function (_currentValue) {
1934
+ context._currentValue = _currentValue;
1935
+ }
1936
+ },
1937
+ _currentValue2: {
1938
+ get: function () {
1939
+ return context._currentValue2;
1940
+ },
1941
+ set: function (_currentValue2) {
1942
+ context._currentValue2 = _currentValue2;
1943
+ }
1944
+ },
1945
+ _threadCount: {
1946
+ get: function () {
1947
+ return context._threadCount;
1948
+ },
1949
+ set: function (_threadCount) {
1950
+ context._threadCount = _threadCount;
1951
+ }
1952
+ },
1953
+ Consumer: {
1954
+ get: function () {
1955
+ if (!hasWarnedAboutUsingNestedContextConsumers) {
1956
+ hasWarnedAboutUsingNestedContextConsumers = true;
1957
+
1958
+ 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?');
1959
+ }
1960
+
1961
+ return context.Consumer;
1962
+ }
1963
+ },
1964
+ displayName: {
1965
+ get: function () {
1966
+ return context.displayName;
1967
+ },
1968
+ set: function (displayName) {
1969
+ if (!hasWarnedAboutDisplayNameOnConsumer) {
1970
+ warn('Setting `displayName` on Context.Consumer has no effect. ' + "You should set it directly on the context with Context.displayName = '%s'.", displayName);
1971
+
1972
+ hasWarnedAboutDisplayNameOnConsumer = true;
1973
+ }
1974
+ }
1975
+ }
1976
+ }); // $FlowFixMe: Flow complains about missing properties because it doesn't understand defineProperty
1977
+
1978
+ context.Consumer = Consumer;
1979
+ }
1980
+
1981
+ {
1982
+ context._currentRenderer = null;
1983
+ context._currentRenderer2 = null;
1984
+ }
1985
+
1986
+ return context;
1987
+ }
1988
+
1989
+ var Uninitialized = -1;
1990
+ var Pending = 0;
1991
+ var Resolved = 1;
1992
+ var Rejected = 2;
1993
+
1994
+ function lazyInitializer(payload) {
1995
+ if (payload._status === Uninitialized) {
1996
+ var ctor = payload._result;
1997
+ var thenable = ctor(); // Transition to the next state.
1998
+
1999
+ var pending = payload;
2000
+ pending._status = Pending;
2001
+ pending._result = thenable;
2002
+ thenable.then(function (moduleObject) {
2003
+ if (payload._status === Pending) {
2004
+ var defaultExport = moduleObject.default;
2005
+
2006
+ {
2007
+ if (defaultExport === undefined) {
2008
+ 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.
2009
+ 'const MyComponent = lazy(() => imp' + "ort('./MyComponent'))", moduleObject);
2010
+ }
2011
+ } // Transition to the next state.
2012
+
2013
+
2014
+ var resolved = payload;
2015
+ resolved._status = Resolved;
2016
+ resolved._result = defaultExport;
2017
+ }
2018
+ }, function (error) {
2019
+ if (payload._status === Pending) {
2020
+ // Transition to the next state.
2021
+ var rejected = payload;
2022
+ rejected._status = Rejected;
2023
+ rejected._result = error;
2024
+ }
2025
+ });
2026
+ }
2027
+
2028
+ if (payload._status === Resolved) {
2029
+ return payload._result;
2030
+ } else {
2031
+ throw payload._result;
2032
+ }
2033
+ }
2034
+
2035
+ function lazy(ctor) {
2036
+ var payload = {
2037
+ // We use these fields to store the result.
2038
+ _status: -1,
2039
+ _result: ctor
2040
+ };
2041
+ var lazyType = {
2042
+ $$typeof: REACT_LAZY_TYPE,
2043
+ _payload: payload,
2044
+ _init: lazyInitializer
2045
+ };
2046
+
2047
+ {
2048
+ // In production, this would just set it on the object.
2049
+ var defaultProps;
2050
+ var propTypes; // $FlowFixMe
2051
+
2052
+ Object.defineProperties(lazyType, {
2053
+ defaultProps: {
2054
+ configurable: true,
2055
+ get: function () {
2056
+ return defaultProps;
2057
+ },
2058
+ set: function (newDefaultProps) {
2059
+ 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.');
2060
+
2061
+ defaultProps = newDefaultProps; // Match production behavior more closely:
2062
+ // $FlowFixMe
2063
+
2064
+ Object.defineProperty(lazyType, 'defaultProps', {
2065
+ enumerable: true
2066
+ });
2067
+ }
2068
+ },
2069
+ propTypes: {
2070
+ configurable: true,
2071
+ get: function () {
2072
+ return propTypes;
2073
+ },
2074
+ set: function (newPropTypes) {
2075
+ 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.');
2076
+
2077
+ propTypes = newPropTypes; // Match production behavior more closely:
2078
+ // $FlowFixMe
2079
+
2080
+ Object.defineProperty(lazyType, 'propTypes', {
2081
+ enumerable: true
2082
+ });
2083
+ }
2084
+ }
2085
+ });
2086
+ }
2087
+
2088
+ return lazyType;
2089
+ }
2090
+
2091
+ function forwardRef(render) {
2092
+ {
2093
+ if (render != null && render.$$typeof === REACT_MEMO_TYPE) {
2094
+ error('forwardRef requires a render function but received a `memo` ' + 'component. Instead of forwardRef(memo(...)), use ' + 'memo(forwardRef(...)).');
2095
+ } else if (typeof render !== 'function') {
2096
+ error('forwardRef requires a render function but was given %s.', render === null ? 'null' : typeof render);
2097
+ } else {
2098
+ if (render.length !== 0 && render.length !== 2) {
2099
+ 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.');
2100
+ }
2101
+ }
2102
+
2103
+ if (render != null) {
2104
+ if (render.defaultProps != null || render.propTypes != null) {
2105
+ error('forwardRef render functions do not support propTypes or defaultProps. ' + 'Did you accidentally pass a React component?');
2106
+ }
2107
+ }
2108
+ }
2109
+
2110
+ var elementType = {
2111
+ $$typeof: REACT_FORWARD_REF_TYPE,
2112
+ render: render
2113
+ };
2114
+
2115
+ {
2116
+ var ownName;
2117
+ Object.defineProperty(elementType, 'displayName', {
2118
+ enumerable: false,
2119
+ configurable: true,
2120
+ get: function () {
2121
+ return ownName;
2122
+ },
2123
+ set: function (name) {
2124
+ ownName = name;
2125
+
2126
+ if (render.displayName == null) {
2127
+ render.displayName = name;
2128
+ }
2129
+ }
2130
+ });
2131
+ }
2132
+
2133
+ return elementType;
2134
+ }
2135
+
2136
+ // Filter certain DOM attributes (e.g. src, href) if their values are empty strings.
2137
+
2138
+ var enableScopeAPI = false; // Experimental Create Event Handle API.
2139
+
2140
+ function isValidElementType(type) {
2141
+ if (typeof type === 'string' || typeof type === 'function') {
2142
+ return true;
2143
+ } // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).
2144
+
2145
+
2146
+ 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 ) {
2147
+ return true;
2148
+ }
2149
+
2150
+ if (typeof type === 'object' && type !== null) {
2151
+ 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) {
2152
+ return true;
2153
+ }
2154
+ }
2155
+
2156
+ return false;
2157
+ }
2158
+
2159
+ function memo(type, compare) {
2160
+ {
2161
+ if (!isValidElementType(type)) {
2162
+ error('memo: The first argument must be a component. Instead ' + 'received: %s', type === null ? 'null' : typeof type);
2163
+ }
2164
+ }
2165
+
2166
+ var elementType = {
2167
+ $$typeof: REACT_MEMO_TYPE,
2168
+ type: type,
2169
+ compare: compare === undefined ? null : compare
2170
+ };
2171
+
2172
+ {
2173
+ var ownName;
2174
+ Object.defineProperty(elementType, 'displayName', {
2175
+ enumerable: false,
2176
+ configurable: true,
2177
+ get: function () {
2178
+ return ownName;
2179
+ },
2180
+ set: function (name) {
2181
+ ownName = name;
2182
+
2183
+ if (type.displayName == null) {
2184
+ type.displayName = name;
2185
+ }
2186
+ }
2187
+ });
2188
+ }
2189
+
2190
+ return elementType;
2191
+ }
2192
+
2193
+ function resolveDispatcher() {
2194
+ var dispatcher = ReactCurrentDispatcher.current;
2195
+
2196
+ if (!(dispatcher !== null)) {
2197
+ {
2198
+ 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." );
2199
+ }
2200
+ }
2201
+
2202
+ return dispatcher;
2203
+ }
2204
+
2205
+ function useContext(Context, unstable_observedBits) {
2206
+ var dispatcher = resolveDispatcher();
2207
+
2208
+ {
2209
+ if (unstable_observedBits !== undefined) {
2210
+ 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' : '');
2211
+ } // TODO: add a more generic warning for invalid values.
2212
+
2213
+
2214
+ if (Context._context !== undefined) {
2215
+ var realContext = Context._context; // Don't deduplicate because this legitimately causes bugs
2216
+ // and nobody should be using this in existing code.
2217
+
2218
+ if (realContext.Consumer === Context) {
2219
+ 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?');
2220
+ } else if (realContext.Provider === Context) {
2221
+ error('Calling useContext(Context.Provider) is not supported. ' + 'Did you mean to call useContext(Context) instead?');
2222
+ }
2223
+ }
2224
+ }
2225
+
2226
+ return dispatcher.useContext(Context, unstable_observedBits);
2227
+ }
2228
+ function useState(initialState) {
2229
+ var dispatcher = resolveDispatcher();
2230
+ return dispatcher.useState(initialState);
2231
+ }
2232
+ function useReducer(reducer, initialArg, init) {
2233
+ var dispatcher = resolveDispatcher();
2234
+ return dispatcher.useReducer(reducer, initialArg, init);
2235
+ }
2236
+ function useRef(initialValue) {
2237
+ var dispatcher = resolveDispatcher();
2238
+ return dispatcher.useRef(initialValue);
2239
+ }
2240
+ function useEffect(create, deps) {
2241
+ var dispatcher = resolveDispatcher();
2242
+ return dispatcher.useEffect(create, deps);
2243
+ }
2244
+ function useLayoutEffect(create, deps) {
2245
+ var dispatcher = resolveDispatcher();
2246
+ return dispatcher.useLayoutEffect(create, deps);
2247
+ }
2248
+ function useCallback(callback, deps) {
2249
+ var dispatcher = resolveDispatcher();
2250
+ return dispatcher.useCallback(callback, deps);
2251
+ }
2252
+ function useMemo(create, deps) {
2253
+ var dispatcher = resolveDispatcher();
2254
+ return dispatcher.useMemo(create, deps);
2255
+ }
2256
+ function useImperativeHandle(ref, create, deps) {
2257
+ var dispatcher = resolveDispatcher();
2258
+ return dispatcher.useImperativeHandle(ref, create, deps);
2259
+ }
2260
+ function useDebugValue(value, formatterFn) {
2261
+ {
2262
+ var dispatcher = resolveDispatcher();
2263
+ return dispatcher.useDebugValue(value, formatterFn);
2264
+ }
2265
+ }
2266
+
2267
+ // Helpers to patch console.logs to avoid logging during side-effect free
2268
+ // replaying on render function. This currently only patches the object
2269
+ // lazily which won't cover if the log function was extracted eagerly.
2270
+ // We could also eagerly patch the method.
2271
+ var disabledDepth = 0;
2272
+ var prevLog;
2273
+ var prevInfo;
2274
+ var prevWarn;
2275
+ var prevError;
2276
+ var prevGroup;
2277
+ var prevGroupCollapsed;
2278
+ var prevGroupEnd;
2279
+
2280
+ function disabledLog() {}
2281
+
2282
+ disabledLog.__reactDisabledLog = true;
2283
+ function disableLogs() {
2284
+ {
2285
+ if (disabledDepth === 0) {
2286
+ /* eslint-disable react-internal/no-production-logging */
2287
+ prevLog = console.log;
2288
+ prevInfo = console.info;
2289
+ prevWarn = console.warn;
2290
+ prevError = console.error;
2291
+ prevGroup = console.group;
2292
+ prevGroupCollapsed = console.groupCollapsed;
2293
+ prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099
2294
+
2295
+ var props = {
2296
+ configurable: true,
2297
+ enumerable: true,
2298
+ value: disabledLog,
2299
+ writable: true
2300
+ }; // $FlowFixMe Flow thinks console is immutable.
2301
+
2302
+ Object.defineProperties(console, {
2303
+ info: props,
2304
+ log: props,
2305
+ warn: props,
2306
+ error: props,
2307
+ group: props,
2308
+ groupCollapsed: props,
2309
+ groupEnd: props
2310
+ });
2311
+ /* eslint-enable react-internal/no-production-logging */
2312
+ }
2313
+
2314
+ disabledDepth++;
2315
+ }
2316
+ }
2317
+ function reenableLogs() {
2318
+ {
2319
+ disabledDepth--;
2320
+
2321
+ if (disabledDepth === 0) {
2322
+ /* eslint-disable react-internal/no-production-logging */
2323
+ var props = {
2324
+ configurable: true,
2325
+ enumerable: true,
2326
+ writable: true
2327
+ }; // $FlowFixMe Flow thinks console is immutable.
2328
+
2329
+ Object.defineProperties(console, {
2330
+ log: _assign({}, props, {
2331
+ value: prevLog
2332
+ }),
2333
+ info: _assign({}, props, {
2334
+ value: prevInfo
2335
+ }),
2336
+ warn: _assign({}, props, {
2337
+ value: prevWarn
2338
+ }),
2339
+ error: _assign({}, props, {
2340
+ value: prevError
2341
+ }),
2342
+ group: _assign({}, props, {
2343
+ value: prevGroup
2344
+ }),
2345
+ groupCollapsed: _assign({}, props, {
2346
+ value: prevGroupCollapsed
2347
+ }),
2348
+ groupEnd: _assign({}, props, {
2349
+ value: prevGroupEnd
2350
+ })
2351
+ });
2352
+ /* eslint-enable react-internal/no-production-logging */
2353
+ }
2354
+
2355
+ if (disabledDepth < 0) {
2356
+ error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.');
2357
+ }
2358
+ }
2359
+ }
2360
+
2361
+ var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher;
2362
+ var prefix;
2363
+ function describeBuiltInComponentFrame(name, source, ownerFn) {
2364
+ {
2365
+ if (prefix === undefined) {
2366
+ // Extract the VM specific prefix used by each line.
2367
+ try {
2368
+ throw Error();
2369
+ } catch (x) {
2370
+ var match = x.stack.trim().match(/\n( *(at )?)/);
2371
+ prefix = match && match[1] || '';
2372
+ }
2373
+ } // We use the prefix to ensure our stacks line up with native stack frames.
2374
+
2375
+
2376
+ return '\n' + prefix + name;
2377
+ }
2378
+ }
2379
+ var reentry = false;
2380
+ var componentFrameCache;
2381
+
2382
+ {
2383
+ var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map;
2384
+ componentFrameCache = new PossiblyWeakMap();
2385
+ }
2386
+
2387
+ function describeNativeComponentFrame(fn, construct) {
2388
+ // If something asked for a stack inside a fake render, it should get ignored.
2389
+ if (!fn || reentry) {
2390
+ return '';
2391
+ }
2392
+
2393
+ {
2394
+ var frame = componentFrameCache.get(fn);
2395
+
2396
+ if (frame !== undefined) {
2397
+ return frame;
2398
+ }
2399
+ }
2400
+
2401
+ var control;
2402
+ reentry = true;
2403
+ var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe It does accept undefined.
2404
+
2405
+ Error.prepareStackTrace = undefined;
2406
+ var previousDispatcher;
2407
+
2408
+ {
2409
+ previousDispatcher = ReactCurrentDispatcher$1.current; // Set the dispatcher in DEV because this might be call in the render function
2410
+ // for warnings.
2411
+
2412
+ ReactCurrentDispatcher$1.current = null;
2413
+ disableLogs();
2414
+ }
2415
+
2416
+ try {
2417
+ // This should throw.
2418
+ if (construct) {
2419
+ // Something should be setting the props in the constructor.
2420
+ var Fake = function () {
2421
+ throw Error();
2422
+ }; // $FlowFixMe
2423
+
2424
+
2425
+ Object.defineProperty(Fake.prototype, 'props', {
2426
+ set: function () {
2427
+ // We use a throwing setter instead of frozen or non-writable props
2428
+ // because that won't throw in a non-strict mode function.
2429
+ throw Error();
2430
+ }
2431
+ });
2432
+
2433
+ if (typeof Reflect === 'object' && Reflect.construct) {
2434
+ // We construct a different control for this case to include any extra
2435
+ // frames added by the construct call.
2436
+ try {
2437
+ Reflect.construct(Fake, []);
2438
+ } catch (x) {
2439
+ control = x;
2440
+ }
2441
+
2442
+ Reflect.construct(fn, [], Fake);
2443
+ } else {
2444
+ try {
2445
+ Fake.call();
2446
+ } catch (x) {
2447
+ control = x;
2448
+ }
2449
+
2450
+ fn.call(Fake.prototype);
2451
+ }
2452
+ } else {
2453
+ try {
2454
+ throw Error();
2455
+ } catch (x) {
2456
+ control = x;
2457
+ }
2458
+
2459
+ fn();
2460
+ }
2461
+ } catch (sample) {
2462
+ // This is inlined manually because closure doesn't do it for us.
2463
+ if (sample && control && typeof sample.stack === 'string') {
2464
+ // This extracts the first frame from the sample that isn't also in the control.
2465
+ // Skipping one frame that we assume is the frame that calls the two.
2466
+ var sampleLines = sample.stack.split('\n');
2467
+ var controlLines = control.stack.split('\n');
2468
+ var s = sampleLines.length - 1;
2469
+ var c = controlLines.length - 1;
2470
+
2471
+ while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) {
2472
+ // We expect at least one stack frame to be shared.
2473
+ // Typically this will be the root most one. However, stack frames may be
2474
+ // cut off due to maximum stack limits. In this case, one maybe cut off
2475
+ // earlier than the other. We assume that the sample is longer or the same
2476
+ // and there for cut off earlier. So we should find the root most frame in
2477
+ // the sample somewhere in the control.
2478
+ c--;
2479
+ }
2480
+
2481
+ for (; s >= 1 && c >= 0; s--, c--) {
2482
+ // Next we find the first one that isn't the same which should be the
2483
+ // frame that called our sample function and the control.
2484
+ if (sampleLines[s] !== controlLines[c]) {
2485
+ // In V8, the first line is describing the message but other VMs don't.
2486
+ // If we're about to return the first line, and the control is also on the same
2487
+ // line, that's a pretty good indicator that our sample threw at same line as
2488
+ // the control. I.e. before we entered the sample frame. So we ignore this result.
2489
+ // This can happen if you passed a class to function component, or non-function.
2490
+ if (s !== 1 || c !== 1) {
2491
+ do {
2492
+ s--;
2493
+ c--; // We may still have similar intermediate frames from the construct call.
2494
+ // The next one that isn't the same should be our match though.
2495
+
2496
+ if (c < 0 || sampleLines[s] !== controlLines[c]) {
2497
+ // V8 adds a "new" prefix for native classes. Let's remove it to make it prettier.
2498
+ var _frame = '\n' + sampleLines[s].replace(' at new ', ' at ');
2499
+
2500
+ {
2501
+ if (typeof fn === 'function') {
2502
+ componentFrameCache.set(fn, _frame);
2503
+ }
2504
+ } // Return the line we found.
2505
+
2506
+
2507
+ return _frame;
2508
+ }
2509
+ } while (s >= 1 && c >= 0);
2510
+ }
2511
+
2512
+ break;
2513
+ }
2514
+ }
2515
+ }
2516
+ } finally {
2517
+ reentry = false;
2518
+
2519
+ {
2520
+ ReactCurrentDispatcher$1.current = previousDispatcher;
2521
+ reenableLogs();
2522
+ }
2523
+
2524
+ Error.prepareStackTrace = previousPrepareStackTrace;
2525
+ } // Fallback to just using the name if we couldn't make it throw.
2526
+
2527
+
2528
+ var name = fn ? fn.displayName || fn.name : '';
2529
+ var syntheticFrame = name ? describeBuiltInComponentFrame(name) : '';
2530
+
2531
+ {
2532
+ if (typeof fn === 'function') {
2533
+ componentFrameCache.set(fn, syntheticFrame);
2534
+ }
2535
+ }
2536
+
2537
+ return syntheticFrame;
2538
+ }
2539
+ function describeFunctionComponentFrame(fn, source, ownerFn) {
2540
+ {
2541
+ return describeNativeComponentFrame(fn, false);
2542
+ }
2543
+ }
2544
+
2545
+ function shouldConstruct(Component) {
2546
+ var prototype = Component.prototype;
2547
+ return !!(prototype && prototype.isReactComponent);
2548
+ }
2549
+
2550
+ function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) {
2551
+
2552
+ if (type == null) {
2553
+ return '';
2554
+ }
2555
+
2556
+ if (typeof type === 'function') {
2557
+ {
2558
+ return describeNativeComponentFrame(type, shouldConstruct(type));
2559
+ }
2560
+ }
2561
+
2562
+ if (typeof type === 'string') {
2563
+ return describeBuiltInComponentFrame(type);
2564
+ }
2565
+
2566
+ switch (type) {
2567
+ case exports.Suspense:
2568
+ return describeBuiltInComponentFrame('Suspense');
2569
+
2570
+ case REACT_SUSPENSE_LIST_TYPE:
2571
+ return describeBuiltInComponentFrame('SuspenseList');
2572
+ }
2573
+
2574
+ if (typeof type === 'object') {
2575
+ switch (type.$$typeof) {
2576
+ case REACT_FORWARD_REF_TYPE:
2577
+ return describeFunctionComponentFrame(type.render);
2578
+
2579
+ case REACT_MEMO_TYPE:
2580
+ // Memo may contain any component type so we recursively resolve it.
2581
+ return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn);
2582
+
2583
+ case REACT_BLOCK_TYPE:
2584
+ return describeFunctionComponentFrame(type._render);
2585
+
2586
+ case REACT_LAZY_TYPE:
2587
+ {
2588
+ var lazyComponent = type;
2589
+ var payload = lazyComponent._payload;
2590
+ var init = lazyComponent._init;
2591
+
2592
+ try {
2593
+ // Lazy may contain any component type so we recursively resolve it.
2594
+ return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn);
2595
+ } catch (x) {}
2596
+ }
2597
+ }
2598
+ }
2599
+
2600
+ return '';
2601
+ }
2602
+
2603
+ var loggedTypeFailures = {};
2604
+ var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
2605
+
2606
+ function setCurrentlyValidatingElement(element) {
2607
+ {
2608
+ if (element) {
2609
+ var owner = element._owner;
2610
+ var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
2611
+ ReactDebugCurrentFrame$1.setExtraStackFrame(stack);
2612
+ } else {
2613
+ ReactDebugCurrentFrame$1.setExtraStackFrame(null);
2614
+ }
2615
+ }
2616
+ }
2617
+
2618
+ function checkPropTypes(typeSpecs, values, location, componentName, element) {
2619
+ {
2620
+ // $FlowFixMe This is okay but Flow doesn't know it.
2621
+ var has = Function.call.bind(Object.prototype.hasOwnProperty);
2622
+
2623
+ for (var typeSpecName in typeSpecs) {
2624
+ if (has(typeSpecs, typeSpecName)) {
2625
+ var error$1 = void 0; // Prop type validation may throw. In case they do, we don't want to
2626
+ // fail the render phase where it didn't fail before. So we log it.
2627
+ // After these have been cleaned up, we'll let them throw.
2628
+
2629
+ try {
2630
+ // This is intentionally an invariant that gets caught. It's the same
2631
+ // behavior as without this statement except with a better message.
2632
+ if (typeof typeSpecs[typeSpecName] !== 'function') {
2633
+ 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`.');
2634
+ err.name = 'Invariant Violation';
2635
+ throw err;
2636
+ }
2637
+
2638
+ error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED');
2639
+ } catch (ex) {
2640
+ error$1 = ex;
2641
+ }
2642
+
2643
+ if (error$1 && !(error$1 instanceof Error)) {
2644
+ setCurrentlyValidatingElement(element);
2645
+
2646
+ 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);
2647
+
2648
+ setCurrentlyValidatingElement(null);
2649
+ }
2650
+
2651
+ if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {
2652
+ // Only monitor this failure once because there tends to be a lot of the
2653
+ // same error.
2654
+ loggedTypeFailures[error$1.message] = true;
2655
+ setCurrentlyValidatingElement(element);
2656
+
2657
+ error('Failed %s type: %s', location, error$1.message);
2658
+
2659
+ setCurrentlyValidatingElement(null);
2660
+ }
2661
+ }
2662
+ }
2663
+ }
2664
+ }
2665
+
2666
+ function setCurrentlyValidatingElement$1(element) {
2667
+ {
2668
+ if (element) {
2669
+ var owner = element._owner;
2670
+ var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
2671
+ setExtraStackFrame(stack);
2672
+ } else {
2673
+ setExtraStackFrame(null);
2674
+ }
2675
+ }
2676
+ }
2677
+
2678
+ var propTypesMisspellWarningShown;
2679
+
2680
+ {
2681
+ propTypesMisspellWarningShown = false;
2682
+ }
2683
+
2684
+ function getDeclarationErrorAddendum() {
2685
+ if (ReactCurrentOwner.current) {
2686
+ var name = getComponentName(ReactCurrentOwner.current.type);
2687
+
2688
+ if (name) {
2689
+ return '\n\nCheck the render method of `' + name + '`.';
2690
+ }
2691
+ }
2692
+
2693
+ return '';
2694
+ }
2695
+
2696
+ function getSourceInfoErrorAddendum(source) {
2697
+ if (source !== undefined) {
2698
+ var fileName = source.fileName.replace(/^.*[\\\/]/, '');
2699
+ var lineNumber = source.lineNumber;
2700
+ return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.';
2701
+ }
2702
+
2703
+ return '';
2704
+ }
2705
+
2706
+ function getSourceInfoErrorAddendumForProps(elementProps) {
2707
+ if (elementProps !== null && elementProps !== undefined) {
2708
+ return getSourceInfoErrorAddendum(elementProps.__source);
2709
+ }
2710
+
2711
+ return '';
2712
+ }
2713
+ /**
2714
+ * Warn if there's no key explicitly set on dynamic arrays of children or
2715
+ * object keys are not valid. This allows us to keep track of children between
2716
+ * updates.
2717
+ */
2718
+
2719
+
2720
+ var ownerHasKeyUseWarning = {};
2721
+
2722
+ function getCurrentComponentErrorInfo(parentType) {
2723
+ var info = getDeclarationErrorAddendum();
2724
+
2725
+ if (!info) {
2726
+ var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;
2727
+
2728
+ if (parentName) {
2729
+ info = "\n\nCheck the top-level render call using <" + parentName + ">.";
2730
+ }
2731
+ }
2732
+
2733
+ return info;
2734
+ }
2735
+ /**
2736
+ * Warn if the element doesn't have an explicit key assigned to it.
2737
+ * This element is in an array. The array could grow and shrink or be
2738
+ * reordered. All children that haven't already been validated are required to
2739
+ * have a "key" property assigned to it. Error statuses are cached so a warning
2740
+ * will only be shown once.
2741
+ *
2742
+ * @internal
2743
+ * @param {ReactElement} element Element that requires a key.
2744
+ * @param {*} parentType element's parent's type.
2745
+ */
2746
+
2747
+
2748
+ function validateExplicitKey(element, parentType) {
2749
+ if (!element._store || element._store.validated || element.key != null) {
2750
+ return;
2751
+ }
2752
+
2753
+ element._store.validated = true;
2754
+ var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
2755
+
2756
+ if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
2757
+ return;
2758
+ }
2759
+
2760
+ ownerHasKeyUseWarning[currentComponentErrorInfo] = true; // Usually the current owner is the offender, but if it accepts children as a
2761
+ // property, it may be the creator of the child that's responsible for
2762
+ // assigning it a key.
2763
+
2764
+ var childOwner = '';
2765
+
2766
+ if (element && element._owner && element._owner !== ReactCurrentOwner.current) {
2767
+ // Give the component that originally created this child.
2768
+ childOwner = " It was passed a child from " + getComponentName(element._owner.type) + ".";
2769
+ }
2770
+
2771
+ {
2772
+ setCurrentlyValidatingElement$1(element);
2773
+
2774
+ 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);
2775
+
2776
+ setCurrentlyValidatingElement$1(null);
2777
+ }
2778
+ }
2779
+ /**
2780
+ * Ensure that every element either is passed in a static location, in an
2781
+ * array with an explicit keys property defined, or in an object literal
2782
+ * with valid key property.
2783
+ *
2784
+ * @internal
2785
+ * @param {ReactNode} node Statically passed child of any type.
2786
+ * @param {*} parentType node's parent's type.
2787
+ */
2788
+
2789
+
2790
+ function validateChildKeys(node, parentType) {
2791
+ if (typeof node !== 'object') {
2792
+ return;
2793
+ }
2794
+
2795
+ if (Array.isArray(node)) {
2796
+ for (var i = 0; i < node.length; i++) {
2797
+ var child = node[i];
2798
+
2799
+ if (isValidElement(child)) {
2800
+ validateExplicitKey(child, parentType);
2801
+ }
2802
+ }
2803
+ } else if (isValidElement(node)) {
2804
+ // This element was passed in a valid location.
2805
+ if (node._store) {
2806
+ node._store.validated = true;
2807
+ }
2808
+ } else if (node) {
2809
+ var iteratorFn = getIteratorFn(node);
2810
+
2811
+ if (typeof iteratorFn === 'function') {
2812
+ // Entry iterators used to provide implicit keys,
2813
+ // but now we print a separate warning for them later.
2814
+ if (iteratorFn !== node.entries) {
2815
+ var iterator = iteratorFn.call(node);
2816
+ var step;
2817
+
2818
+ while (!(step = iterator.next()).done) {
2819
+ if (isValidElement(step.value)) {
2820
+ validateExplicitKey(step.value, parentType);
2821
+ }
2822
+ }
2823
+ }
2824
+ }
2825
+ }
2826
+ }
2827
+ /**
2828
+ * Given an element, validate that its props follow the propTypes definition,
2829
+ * provided by the type.
2830
+ *
2831
+ * @param {ReactElement} element
2832
+ */
2833
+
2834
+
2835
+ function validatePropTypes(element) {
2836
+ {
2837
+ var type = element.type;
2838
+
2839
+ if (type === null || type === undefined || typeof type === 'string') {
2840
+ return;
2841
+ }
2842
+
2843
+ var propTypes;
2844
+
2845
+ if (typeof type === 'function') {
2846
+ propTypes = type.propTypes;
2847
+ } else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here.
2848
+ // Inner props are checked in the reconciler.
2849
+ type.$$typeof === REACT_MEMO_TYPE)) {
2850
+ propTypes = type.propTypes;
2851
+ } else {
2852
+ return;
2853
+ }
2854
+
2855
+ if (propTypes) {
2856
+ // Intentionally inside to avoid triggering lazy initializers:
2857
+ var name = getComponentName(type);
2858
+ checkPropTypes(propTypes, element.props, 'prop', name, element);
2859
+ } else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {
2860
+ propTypesMisspellWarningShown = true; // Intentionally inside to avoid triggering lazy initializers:
2861
+
2862
+ var _name = getComponentName(type);
2863
+
2864
+ error('Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', _name || 'Unknown');
2865
+ }
2866
+
2867
+ if (typeof type.getDefaultProps === 'function' && !type.getDefaultProps.isReactClassApproved) {
2868
+ error('getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.');
2869
+ }
2870
+ }
2871
+ }
2872
+ /**
2873
+ * Given a fragment, validate that it can only be provided with fragment props
2874
+ * @param {ReactElement} fragment
2875
+ */
2876
+
2877
+
2878
+ function validateFragmentProps(fragment) {
2879
+ {
2880
+ var keys = Object.keys(fragment.props);
2881
+
2882
+ for (var i = 0; i < keys.length; i++) {
2883
+ var key = keys[i];
2884
+
2885
+ if (key !== 'children' && key !== 'key') {
2886
+ setCurrentlyValidatingElement$1(fragment);
2887
+
2888
+ error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);
2889
+
2890
+ setCurrentlyValidatingElement$1(null);
2891
+ break;
2892
+ }
2893
+ }
2894
+
2895
+ if (fragment.ref !== null) {
2896
+ setCurrentlyValidatingElement$1(fragment);
2897
+
2898
+ error('Invalid attribute `ref` supplied to `React.Fragment`.');
2899
+
2900
+ setCurrentlyValidatingElement$1(null);
2901
+ }
2902
+ }
2903
+ }
2904
+ function createElementWithValidation(type, props, children) {
2905
+ var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to
2906
+ // succeed and there will likely be errors in render.
2907
+
2908
+ if (!validType) {
2909
+ var info = '';
2910
+
2911
+ if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
2912
+ 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.";
2913
+ }
2914
+
2915
+ var sourceInfo = getSourceInfoErrorAddendumForProps(props);
2916
+
2917
+ if (sourceInfo) {
2918
+ info += sourceInfo;
2919
+ } else {
2920
+ info += getDeclarationErrorAddendum();
2921
+ }
2922
+
2923
+ var typeString;
2924
+
2925
+ if (type === null) {
2926
+ typeString = 'null';
2927
+ } else if (Array.isArray(type)) {
2928
+ typeString = 'array';
2929
+ } else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {
2930
+ typeString = "<" + (getComponentName(type.type) || 'Unknown') + " />";
2931
+ info = ' Did you accidentally export a JSX literal instead of a component?';
2932
+ } else {
2933
+ typeString = typeof type;
2934
+ }
2935
+
2936
+ {
2937
+ 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);
2938
+ }
2939
+ }
2940
+
2941
+ var element = createElement.apply(this, arguments); // The result can be nullish if a mock or a custom function is used.
2942
+ // TODO: Drop this when these are no longer allowed as the type argument.
2943
+
2944
+ if (element == null) {
2945
+ return element;
2946
+ } // Skip key warning if the type isn't valid since our key validation logic
2947
+ // doesn't expect a non-string/function type and can throw confusing errors.
2948
+ // We don't want exception behavior to differ between dev and prod.
2949
+ // (Rendering will throw with a helpful message and as soon as the type is
2950
+ // fixed, the key warnings will appear.)
2951
+
2952
+
2953
+ if (validType) {
2954
+ for (var i = 2; i < arguments.length; i++) {
2955
+ validateChildKeys(arguments[i], type);
2956
+ }
2957
+ }
2958
+
2959
+ if (type === exports.Fragment) {
2960
+ validateFragmentProps(element);
2961
+ } else {
2962
+ validatePropTypes(element);
2963
+ }
2964
+
2965
+ return element;
2966
+ }
2967
+ var didWarnAboutDeprecatedCreateFactory = false;
2968
+ function createFactoryWithValidation(type) {
2969
+ var validatedFactory = createElementWithValidation.bind(null, type);
2970
+ validatedFactory.type = type;
2971
+
2972
+ {
2973
+ if (!didWarnAboutDeprecatedCreateFactory) {
2974
+ didWarnAboutDeprecatedCreateFactory = true;
2975
+
2976
+ warn('React.createFactory() is deprecated and will be removed in ' + 'a future major release. Consider using JSX ' + 'or use React.createElement() directly instead.');
2977
+ } // Legacy hook: remove it
2978
+
2979
+
2980
+ Object.defineProperty(validatedFactory, 'type', {
2981
+ enumerable: false,
2982
+ get: function () {
2983
+ warn('Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.');
2984
+
2985
+ Object.defineProperty(this, 'type', {
2986
+ value: type
2987
+ });
2988
+ return type;
2989
+ }
2990
+ });
2991
+ }
2992
+
2993
+ return validatedFactory;
2994
+ }
2995
+ function cloneElementWithValidation(element, props, children) {
2996
+ var newElement = cloneElement.apply(this, arguments);
2997
+
2998
+ for (var i = 2; i < arguments.length; i++) {
2999
+ validateChildKeys(arguments[i], newElement.type);
3000
+ }
3001
+
3002
+ validatePropTypes(newElement);
3003
+ return newElement;
3004
+ }
3005
+
3006
+ {
3007
+
3008
+ try {
3009
+ var frozenObject = Object.freeze({});
3010
+ /* eslint-disable no-new */
3011
+
3012
+ new Map([[frozenObject, null]]);
3013
+ new Set([frozenObject]);
3014
+ /* eslint-enable no-new */
3015
+ } catch (e) {
3016
+ }
3017
+ }
3018
+
3019
+ var createElement$1 = createElementWithValidation ;
3020
+ var cloneElement$1 = cloneElementWithValidation ;
3021
+ var createFactory = createFactoryWithValidation ;
3022
+ var Children = {
3023
+ map: mapChildren,
3024
+ forEach: forEachChildren,
3025
+ count: countChildren,
3026
+ toArray: toArray,
3027
+ only: onlyChild
3028
+ };
3029
+
3030
+ exports.Children = Children;
3031
+ exports.Component = Component;
3032
+ exports.PureComponent = PureComponent;
3033
+ exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactSharedInternals;
3034
+ exports.cloneElement = cloneElement$1;
3035
+ exports.createContext = createContext;
3036
+ exports.createElement = createElement$1;
3037
+ exports.createFactory = createFactory;
3038
+ exports.createRef = createRef;
3039
+ exports.forwardRef = forwardRef;
3040
+ exports.isValidElement = isValidElement;
3041
+ exports.lazy = lazy;
3042
+ exports.memo = memo;
3043
+ exports.useCallback = useCallback;
3044
+ exports.useContext = useContext;
3045
+ exports.useDebugValue = useDebugValue;
3046
+ exports.useEffect = useEffect;
3047
+ exports.useImperativeHandle = useImperativeHandle;
3048
+ exports.useLayoutEffect = useLayoutEffect;
3049
+ exports.useMemo = useMemo;
3050
+ exports.useReducer = useReducer;
3051
+ exports.useRef = useRef;
3052
+ exports.useState = useState;
3053
+ exports.version = ReactVersion;
3054
+ })();
3055
+ }
3056
+ });
3057
+ react_development.Fragment;
3058
+ react_development.StrictMode;
3059
+ react_development.Profiler;
3060
+ react_development.Suspense;
3061
+ react_development.Children;
3062
+ react_development.Component;
3063
+ react_development.PureComponent;
3064
+ react_development.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
3065
+ react_development.cloneElement;
3066
+ react_development.createContext;
3067
+ react_development.createElement;
3068
+ react_development.createFactory;
3069
+ react_development.createRef;
3070
+ react_development.forwardRef;
3071
+ react_development.isValidElement;
3072
+ react_development.lazy;
3073
+ react_development.memo;
3074
+ react_development.useCallback;
3075
+ react_development.useContext;
3076
+ react_development.useDebugValue;
3077
+ react_development.useEffect;
3078
+ react_development.useImperativeHandle;
3079
+ react_development.useLayoutEffect;
3080
+ react_development.useMemo;
3081
+ react_development.useReducer;
3082
+ react_development.useRef;
3083
+ react_development.useState;
3084
+ react_development.version;
3085
+
3086
+ var react = createCommonjsModule(function (module) {
3087
+
3088
+ if (process.env.NODE_ENV === 'production') {
3089
+ module.exports = react_production_min;
3090
+ } else {
3091
+ module.exports = react_development;
3092
+ }
3093
+ });
3094
+
3095
+ var UseCsvButton = function (_a) {
3096
+ var children = _a.children, importerKey = _a.importerKey, user = _a.user, metadata = _a.metadata, render = _a.render;
3097
+ return (react.createElement(react.Fragment, null, render ? (react.createElement(react.Fragment, null, render(function () { return useCsvPlugin({ importerKey: importerKey, user: user, metadata: metadata }); }))) : (react.createElement("button", { type: "button", id: "usecsv-button", style: {
3098
+ backgroundColor: "#FFF",
3099
+ color: "#000",
3100
+ border: "2px solid #000",
3101
+ borderRadius: "6px",
3102
+ padding: "10px 15px",
3103
+ textAlign: "center",
3104
+ fontSize: "16px",
3105
+ cursor: "pointer",
3106
+ }, onClick: function () { return useCsvPlugin({ importerKey: importerKey, user: user, metadata: metadata }); } }, children))));
3107
+ };
3108
+
3109
+ return UseCsvButton;
3110
+
3111
+ }));
3112
+ //# sourceMappingURL=index.umd.js.map