@addsign/moje-agenda-shared-lib 2.0.42 → 2.0.44

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.
Files changed (32) hide show
  1. package/dist/Combination-B9IT4KW2.js +1162 -0
  2. package/dist/Combination-B9IT4KW2.js.map +1 -0
  3. package/dist/DataTableServer-BTH3lxJi.js +23012 -0
  4. package/dist/DataTableServer-BTH3lxJi.js.map +1 -0
  5. package/dist/DataTableServer-C_N4I0CU.js +23008 -0
  6. package/dist/DataTableServer-C_N4I0CU.js.map +1 -0
  7. package/dist/DataTableServer-D6wHH3q2.js +23062 -0
  8. package/dist/DataTableServer-D6wHH3q2.js.map +1 -0
  9. package/dist/DataTableServer-DfbNQxQu.js +23007 -0
  10. package/dist/DataTableServer-DfbNQxQu.js.map +1 -0
  11. package/dist/DataTableServer-vC-bfyeH.js +23062 -0
  12. package/dist/DataTableServer-vC-bfyeH.js.map +1 -0
  13. package/dist/Dialog-xljhzarH.js +424 -0
  14. package/dist/Dialog-xljhzarH.js.map +1 -0
  15. package/dist/components/datatable/DataTableBody.d.ts +3 -0
  16. package/dist/components/datatable/DataTableHeader.d.ts +3 -0
  17. package/dist/components/datatable/DataTableServer.js +13 -15
  18. package/dist/components/datatable/DataTableServer.js.map +1 -1
  19. package/dist/index-B8g-BAKV.js +64 -0
  20. package/dist/index-B8g-BAKV.js.map +1 -0
  21. package/dist/index-BXWe9Hgo.js +2203 -0
  22. package/dist/index-BXWe9Hgo.js.map +1 -0
  23. package/dist/index-DGUInIB2.js +18 -0
  24. package/dist/index-DGUInIB2.js.map +1 -0
  25. package/dist/index-T0re1j1b.js +2220 -0
  26. package/dist/index-T0re1j1b.js.map +1 -0
  27. package/dist/index-uV4rgVyx.js +234 -0
  28. package/dist/index-uV4rgVyx.js.map +1 -0
  29. package/dist/popover-Z8s3r67G.js +319 -0
  30. package/dist/popover-Z8s3r67G.js.map +1 -0
  31. package/lib/components/datatable/DataTableServer.tsx +9 -11
  32. package/package.json +1 -1
@@ -0,0 +1,2220 @@
1
+ import React__default, { useMemo, useRef, useReducer, useEffect, useCallback, forwardRef, useImperativeHandle, Fragment } from "react";
2
+ import { g as getDefaultExportFromCjs } from "./_commonjsHelpers-LQfde5yM.js";
3
+ import { _ as __awaiter, a as __generator, b as __spreadArray, c as __read } from "./Combination-B9IT4KW2.js";
4
+ var propTypes = { exports: {} };
5
+ var reactIs = { exports: {} };
6
+ var reactIs_production_min = {};
7
+ /** @license React v16.13.1
8
+ * react-is.production.min.js
9
+ *
10
+ * Copyright (c) Facebook, Inc. and its affiliates.
11
+ *
12
+ * This source code is licensed under the MIT license found in the
13
+ * LICENSE file in the root directory of this source tree.
14
+ */
15
+ var hasRequiredReactIs_production_min;
16
+ function requireReactIs_production_min() {
17
+ if (hasRequiredReactIs_production_min)
18
+ return reactIs_production_min;
19
+ hasRequiredReactIs_production_min = 1;
20
+ var b = "function" === typeof Symbol && Symbol.for, c = b ? Symbol.for("react.element") : 60103, d = b ? Symbol.for("react.portal") : 60106, e = b ? Symbol.for("react.fragment") : 60107, f = b ? Symbol.for("react.strict_mode") : 60108, g = b ? Symbol.for("react.profiler") : 60114, h = b ? Symbol.for("react.provider") : 60109, k = b ? Symbol.for("react.context") : 60110, l = b ? Symbol.for("react.async_mode") : 60111, m = b ? Symbol.for("react.concurrent_mode") : 60111, n = b ? Symbol.for("react.forward_ref") : 60112, p = b ? Symbol.for("react.suspense") : 60113, q = b ? Symbol.for("react.suspense_list") : 60120, r = b ? Symbol.for("react.memo") : 60115, t = b ? Symbol.for("react.lazy") : 60116, v = b ? Symbol.for("react.block") : 60121, w = b ? Symbol.for("react.fundamental") : 60117, x = b ? Symbol.for("react.responder") : 60118, y = b ? Symbol.for("react.scope") : 60119;
21
+ function z(a) {
22
+ if ("object" === typeof a && null !== a) {
23
+ var u = a.$$typeof;
24
+ switch (u) {
25
+ case c:
26
+ switch (a = a.type, a) {
27
+ case l:
28
+ case m:
29
+ case e:
30
+ case g:
31
+ case f:
32
+ case p:
33
+ return a;
34
+ default:
35
+ switch (a = a && a.$$typeof, a) {
36
+ case k:
37
+ case n:
38
+ case t:
39
+ case r:
40
+ case h:
41
+ return a;
42
+ default:
43
+ return u;
44
+ }
45
+ }
46
+ case d:
47
+ return u;
48
+ }
49
+ }
50
+ }
51
+ function A(a) {
52
+ return z(a) === m;
53
+ }
54
+ reactIs_production_min.AsyncMode = l;
55
+ reactIs_production_min.ConcurrentMode = m;
56
+ reactIs_production_min.ContextConsumer = k;
57
+ reactIs_production_min.ContextProvider = h;
58
+ reactIs_production_min.Element = c;
59
+ reactIs_production_min.ForwardRef = n;
60
+ reactIs_production_min.Fragment = e;
61
+ reactIs_production_min.Lazy = t;
62
+ reactIs_production_min.Memo = r;
63
+ reactIs_production_min.Portal = d;
64
+ reactIs_production_min.Profiler = g;
65
+ reactIs_production_min.StrictMode = f;
66
+ reactIs_production_min.Suspense = p;
67
+ reactIs_production_min.isAsyncMode = function(a) {
68
+ return A(a) || z(a) === l;
69
+ };
70
+ reactIs_production_min.isConcurrentMode = A;
71
+ reactIs_production_min.isContextConsumer = function(a) {
72
+ return z(a) === k;
73
+ };
74
+ reactIs_production_min.isContextProvider = function(a) {
75
+ return z(a) === h;
76
+ };
77
+ reactIs_production_min.isElement = function(a) {
78
+ return "object" === typeof a && null !== a && a.$$typeof === c;
79
+ };
80
+ reactIs_production_min.isForwardRef = function(a) {
81
+ return z(a) === n;
82
+ };
83
+ reactIs_production_min.isFragment = function(a) {
84
+ return z(a) === e;
85
+ };
86
+ reactIs_production_min.isLazy = function(a) {
87
+ return z(a) === t;
88
+ };
89
+ reactIs_production_min.isMemo = function(a) {
90
+ return z(a) === r;
91
+ };
92
+ reactIs_production_min.isPortal = function(a) {
93
+ return z(a) === d;
94
+ };
95
+ reactIs_production_min.isProfiler = function(a) {
96
+ return z(a) === g;
97
+ };
98
+ reactIs_production_min.isStrictMode = function(a) {
99
+ return z(a) === f;
100
+ };
101
+ reactIs_production_min.isSuspense = function(a) {
102
+ return z(a) === p;
103
+ };
104
+ reactIs_production_min.isValidElementType = function(a) {
105
+ return "string" === typeof a || "function" === typeof a || a === e || a === m || a === g || a === f || a === p || a === q || "object" === typeof a && null !== a && (a.$$typeof === t || a.$$typeof === r || a.$$typeof === h || a.$$typeof === k || a.$$typeof === n || a.$$typeof === w || a.$$typeof === x || a.$$typeof === y || a.$$typeof === v);
106
+ };
107
+ reactIs_production_min.typeOf = z;
108
+ return reactIs_production_min;
109
+ }
110
+ var reactIs_development = {};
111
+ /** @license React v16.13.1
112
+ * react-is.development.js
113
+ *
114
+ * Copyright (c) Facebook, Inc. and its affiliates.
115
+ *
116
+ * This source code is licensed under the MIT license found in the
117
+ * LICENSE file in the root directory of this source tree.
118
+ */
119
+ var hasRequiredReactIs_development;
120
+ function requireReactIs_development() {
121
+ if (hasRequiredReactIs_development)
122
+ return reactIs_development;
123
+ hasRequiredReactIs_development = 1;
124
+ if (process.env.NODE_ENV !== "production") {
125
+ (function() {
126
+ var hasSymbol = typeof Symbol === "function" && Symbol.for;
127
+ var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for("react.element") : 60103;
128
+ var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for("react.portal") : 60106;
129
+ var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for("react.fragment") : 60107;
130
+ var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for("react.strict_mode") : 60108;
131
+ var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for("react.profiler") : 60114;
132
+ var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for("react.provider") : 60109;
133
+ var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for("react.context") : 60110;
134
+ var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for("react.async_mode") : 60111;
135
+ var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for("react.concurrent_mode") : 60111;
136
+ var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for("react.forward_ref") : 60112;
137
+ var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for("react.suspense") : 60113;
138
+ var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for("react.suspense_list") : 60120;
139
+ var REACT_MEMO_TYPE = hasSymbol ? Symbol.for("react.memo") : 60115;
140
+ var REACT_LAZY_TYPE = hasSymbol ? Symbol.for("react.lazy") : 60116;
141
+ var REACT_BLOCK_TYPE = hasSymbol ? Symbol.for("react.block") : 60121;
142
+ var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for("react.fundamental") : 60117;
143
+ var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for("react.responder") : 60118;
144
+ var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for("react.scope") : 60119;
145
+ function isValidElementType(type) {
146
+ return typeof type === "string" || typeof type === "function" || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
147
+ type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || typeof type === "object" && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE || type.$$typeof === REACT_BLOCK_TYPE);
148
+ }
149
+ function typeOf(object) {
150
+ if (typeof object === "object" && object !== null) {
151
+ var $$typeof = object.$$typeof;
152
+ switch ($$typeof) {
153
+ case REACT_ELEMENT_TYPE:
154
+ var type = object.type;
155
+ switch (type) {
156
+ case REACT_ASYNC_MODE_TYPE:
157
+ case REACT_CONCURRENT_MODE_TYPE:
158
+ case REACT_FRAGMENT_TYPE:
159
+ case REACT_PROFILER_TYPE:
160
+ case REACT_STRICT_MODE_TYPE:
161
+ case REACT_SUSPENSE_TYPE:
162
+ return type;
163
+ default:
164
+ var $$typeofType = type && type.$$typeof;
165
+ switch ($$typeofType) {
166
+ case REACT_CONTEXT_TYPE:
167
+ case REACT_FORWARD_REF_TYPE:
168
+ case REACT_LAZY_TYPE:
169
+ case REACT_MEMO_TYPE:
170
+ case REACT_PROVIDER_TYPE:
171
+ return $$typeofType;
172
+ default:
173
+ return $$typeof;
174
+ }
175
+ }
176
+ case REACT_PORTAL_TYPE:
177
+ return $$typeof;
178
+ }
179
+ }
180
+ return void 0;
181
+ }
182
+ var AsyncMode = REACT_ASYNC_MODE_TYPE;
183
+ var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
184
+ var ContextConsumer = REACT_CONTEXT_TYPE;
185
+ var ContextProvider = REACT_PROVIDER_TYPE;
186
+ var Element = REACT_ELEMENT_TYPE;
187
+ var ForwardRef = REACT_FORWARD_REF_TYPE;
188
+ var Fragment2 = REACT_FRAGMENT_TYPE;
189
+ var Lazy = REACT_LAZY_TYPE;
190
+ var Memo = REACT_MEMO_TYPE;
191
+ var Portal = REACT_PORTAL_TYPE;
192
+ var Profiler = REACT_PROFILER_TYPE;
193
+ var StrictMode = REACT_STRICT_MODE_TYPE;
194
+ var Suspense = REACT_SUSPENSE_TYPE;
195
+ var hasWarnedAboutDeprecatedIsAsyncMode = false;
196
+ function isAsyncMode(object) {
197
+ {
198
+ if (!hasWarnedAboutDeprecatedIsAsyncMode) {
199
+ hasWarnedAboutDeprecatedIsAsyncMode = true;
200
+ console["warn"]("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.");
201
+ }
202
+ }
203
+ return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE;
204
+ }
205
+ function isConcurrentMode(object) {
206
+ return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;
207
+ }
208
+ function isContextConsumer(object) {
209
+ return typeOf(object) === REACT_CONTEXT_TYPE;
210
+ }
211
+ function isContextProvider(object) {
212
+ return typeOf(object) === REACT_PROVIDER_TYPE;
213
+ }
214
+ function isElement(object) {
215
+ return typeof object === "object" && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
216
+ }
217
+ function isForwardRef(object) {
218
+ return typeOf(object) === REACT_FORWARD_REF_TYPE;
219
+ }
220
+ function isFragment(object) {
221
+ return typeOf(object) === REACT_FRAGMENT_TYPE;
222
+ }
223
+ function isLazy(object) {
224
+ return typeOf(object) === REACT_LAZY_TYPE;
225
+ }
226
+ function isMemo(object) {
227
+ return typeOf(object) === REACT_MEMO_TYPE;
228
+ }
229
+ function isPortal(object) {
230
+ return typeOf(object) === REACT_PORTAL_TYPE;
231
+ }
232
+ function isProfiler(object) {
233
+ return typeOf(object) === REACT_PROFILER_TYPE;
234
+ }
235
+ function isStrictMode(object) {
236
+ return typeOf(object) === REACT_STRICT_MODE_TYPE;
237
+ }
238
+ function isSuspense(object) {
239
+ return typeOf(object) === REACT_SUSPENSE_TYPE;
240
+ }
241
+ reactIs_development.AsyncMode = AsyncMode;
242
+ reactIs_development.ConcurrentMode = ConcurrentMode;
243
+ reactIs_development.ContextConsumer = ContextConsumer;
244
+ reactIs_development.ContextProvider = ContextProvider;
245
+ reactIs_development.Element = Element;
246
+ reactIs_development.ForwardRef = ForwardRef;
247
+ reactIs_development.Fragment = Fragment2;
248
+ reactIs_development.Lazy = Lazy;
249
+ reactIs_development.Memo = Memo;
250
+ reactIs_development.Portal = Portal;
251
+ reactIs_development.Profiler = Profiler;
252
+ reactIs_development.StrictMode = StrictMode;
253
+ reactIs_development.Suspense = Suspense;
254
+ reactIs_development.isAsyncMode = isAsyncMode;
255
+ reactIs_development.isConcurrentMode = isConcurrentMode;
256
+ reactIs_development.isContextConsumer = isContextConsumer;
257
+ reactIs_development.isContextProvider = isContextProvider;
258
+ reactIs_development.isElement = isElement;
259
+ reactIs_development.isForwardRef = isForwardRef;
260
+ reactIs_development.isFragment = isFragment;
261
+ reactIs_development.isLazy = isLazy;
262
+ reactIs_development.isMemo = isMemo;
263
+ reactIs_development.isPortal = isPortal;
264
+ reactIs_development.isProfiler = isProfiler;
265
+ reactIs_development.isStrictMode = isStrictMode;
266
+ reactIs_development.isSuspense = isSuspense;
267
+ reactIs_development.isValidElementType = isValidElementType;
268
+ reactIs_development.typeOf = typeOf;
269
+ })();
270
+ }
271
+ return reactIs_development;
272
+ }
273
+ if (process.env.NODE_ENV === "production") {
274
+ reactIs.exports = requireReactIs_production_min();
275
+ } else {
276
+ reactIs.exports = requireReactIs_development();
277
+ }
278
+ var reactIsExports = reactIs.exports;
279
+ /*
280
+ object-assign
281
+ (c) Sindre Sorhus
282
+ @license MIT
283
+ */
284
+ var getOwnPropertySymbols = Object.getOwnPropertySymbols;
285
+ var hasOwnProperty = Object.prototype.hasOwnProperty;
286
+ var propIsEnumerable = Object.prototype.propertyIsEnumerable;
287
+ function toObject(val) {
288
+ if (val === null || val === void 0) {
289
+ throw new TypeError("Object.assign cannot be called with null or undefined");
290
+ }
291
+ return Object(val);
292
+ }
293
+ function shouldUseNative() {
294
+ try {
295
+ if (!Object.assign) {
296
+ return false;
297
+ }
298
+ var test1 = new String("abc");
299
+ test1[5] = "de";
300
+ if (Object.getOwnPropertyNames(test1)[0] === "5") {
301
+ return false;
302
+ }
303
+ var test2 = {};
304
+ for (var i = 0; i < 10; i++) {
305
+ test2["_" + String.fromCharCode(i)] = i;
306
+ }
307
+ var order2 = Object.getOwnPropertyNames(test2).map(function(n) {
308
+ return test2[n];
309
+ });
310
+ if (order2.join("") !== "0123456789") {
311
+ return false;
312
+ }
313
+ var test3 = {};
314
+ "abcdefghijklmnopqrst".split("").forEach(function(letter) {
315
+ test3[letter] = letter;
316
+ });
317
+ if (Object.keys(Object.assign({}, test3)).join("") !== "abcdefghijklmnopqrst") {
318
+ return false;
319
+ }
320
+ return true;
321
+ } catch (err) {
322
+ return false;
323
+ }
324
+ }
325
+ var objectAssign = shouldUseNative() ? Object.assign : function(target, source) {
326
+ var from;
327
+ var to = toObject(target);
328
+ var symbols;
329
+ for (var s = 1; s < arguments.length; s++) {
330
+ from = Object(arguments[s]);
331
+ for (var key in from) {
332
+ if (hasOwnProperty.call(from, key)) {
333
+ to[key] = from[key];
334
+ }
335
+ }
336
+ if (getOwnPropertySymbols) {
337
+ symbols = getOwnPropertySymbols(from);
338
+ for (var i = 0; i < symbols.length; i++) {
339
+ if (propIsEnumerable.call(from, symbols[i])) {
340
+ to[symbols[i]] = from[symbols[i]];
341
+ }
342
+ }
343
+ }
344
+ }
345
+ return to;
346
+ };
347
+ var ReactPropTypesSecret$2 = "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";
348
+ var ReactPropTypesSecret_1 = ReactPropTypesSecret$2;
349
+ var has$1 = Function.call.bind(Object.prototype.hasOwnProperty);
350
+ var printWarning = function() {
351
+ };
352
+ if (process.env.NODE_ENV !== "production") {
353
+ var ReactPropTypesSecret$1 = ReactPropTypesSecret_1;
354
+ var loggedTypeFailures = {};
355
+ var has = has$1;
356
+ printWarning = function(text) {
357
+ var message = "Warning: " + text;
358
+ if (typeof console !== "undefined") {
359
+ console.error(message);
360
+ }
361
+ try {
362
+ throw new Error(message);
363
+ } catch (x) {
364
+ }
365
+ };
366
+ }
367
+ function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
368
+ if (process.env.NODE_ENV !== "production") {
369
+ for (var typeSpecName in typeSpecs) {
370
+ if (has(typeSpecs, typeSpecName)) {
371
+ var error;
372
+ try {
373
+ if (typeof typeSpecs[typeSpecName] !== "function") {
374
+ var err = Error(
375
+ (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`."
376
+ );
377
+ err.name = "Invariant Violation";
378
+ throw err;
379
+ }
380
+ error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret$1);
381
+ } catch (ex) {
382
+ error = ex;
383
+ }
384
+ if (error && !(error instanceof Error)) {
385
+ printWarning(
386
+ (componentName || "React class") + ": type specification of " + location + " `" + typeSpecName + "` is invalid; the type checker function must return `null` or an `Error` but returned a " + typeof error + ". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."
387
+ );
388
+ }
389
+ if (error instanceof Error && !(error.message in loggedTypeFailures)) {
390
+ loggedTypeFailures[error.message] = true;
391
+ var stack = getStack ? getStack() : "";
392
+ printWarning(
393
+ "Failed " + location + " type: " + error.message + (stack != null ? stack : "")
394
+ );
395
+ }
396
+ }
397
+ }
398
+ }
399
+ }
400
+ checkPropTypes.resetWarningCache = function() {
401
+ if (process.env.NODE_ENV !== "production") {
402
+ loggedTypeFailures = {};
403
+ }
404
+ };
405
+ var checkPropTypes_1 = checkPropTypes;
406
+ var factoryWithTypeCheckers;
407
+ var hasRequiredFactoryWithTypeCheckers;
408
+ function requireFactoryWithTypeCheckers() {
409
+ if (hasRequiredFactoryWithTypeCheckers)
410
+ return factoryWithTypeCheckers;
411
+ hasRequiredFactoryWithTypeCheckers = 1;
412
+ var ReactIs = reactIsExports;
413
+ var assign = objectAssign;
414
+ var ReactPropTypesSecret2 = ReactPropTypesSecret_1;
415
+ var has = has$1;
416
+ var checkPropTypes2 = checkPropTypes_1;
417
+ var printWarning2 = function() {
418
+ };
419
+ if (process.env.NODE_ENV !== "production") {
420
+ printWarning2 = function(text) {
421
+ var message = "Warning: " + text;
422
+ if (typeof console !== "undefined") {
423
+ console.error(message);
424
+ }
425
+ try {
426
+ throw new Error(message);
427
+ } catch (x) {
428
+ }
429
+ };
430
+ }
431
+ function emptyFunctionThatReturnsNull() {
432
+ return null;
433
+ }
434
+ factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
435
+ var ITERATOR_SYMBOL = typeof Symbol === "function" && Symbol.iterator;
436
+ var FAUX_ITERATOR_SYMBOL = "@@iterator";
437
+ function getIteratorFn(maybeIterable) {
438
+ var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
439
+ if (typeof iteratorFn === "function") {
440
+ return iteratorFn;
441
+ }
442
+ }
443
+ var ANONYMOUS = "<<anonymous>>";
444
+ var ReactPropTypes = {
445
+ array: createPrimitiveTypeChecker("array"),
446
+ bigint: createPrimitiveTypeChecker("bigint"),
447
+ bool: createPrimitiveTypeChecker("boolean"),
448
+ func: createPrimitiveTypeChecker("function"),
449
+ number: createPrimitiveTypeChecker("number"),
450
+ object: createPrimitiveTypeChecker("object"),
451
+ string: createPrimitiveTypeChecker("string"),
452
+ symbol: createPrimitiveTypeChecker("symbol"),
453
+ any: createAnyTypeChecker(),
454
+ arrayOf: createArrayOfTypeChecker,
455
+ element: createElementTypeChecker(),
456
+ elementType: createElementTypeTypeChecker(),
457
+ instanceOf: createInstanceTypeChecker,
458
+ node: createNodeChecker(),
459
+ objectOf: createObjectOfTypeChecker,
460
+ oneOf: createEnumTypeChecker,
461
+ oneOfType: createUnionTypeChecker,
462
+ shape: createShapeTypeChecker,
463
+ exact: createStrictShapeTypeChecker
464
+ };
465
+ function is(x, y) {
466
+ if (x === y) {
467
+ return x !== 0 || 1 / x === 1 / y;
468
+ } else {
469
+ return x !== x && y !== y;
470
+ }
471
+ }
472
+ function PropTypeError(message, data) {
473
+ this.message = message;
474
+ this.data = data && typeof data === "object" ? data : {};
475
+ this.stack = "";
476
+ }
477
+ PropTypeError.prototype = Error.prototype;
478
+ function createChainableTypeChecker(validate) {
479
+ if (process.env.NODE_ENV !== "production") {
480
+ var manualPropTypeCallCache = {};
481
+ var manualPropTypeWarningCount = 0;
482
+ }
483
+ function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {
484
+ componentName = componentName || ANONYMOUS;
485
+ propFullName = propFullName || propName;
486
+ if (secret !== ReactPropTypesSecret2) {
487
+ if (throwOnDirectAccess) {
488
+ var err = new Error(
489
+ "Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types"
490
+ );
491
+ err.name = "Invariant Violation";
492
+ throw err;
493
+ } else if (process.env.NODE_ENV !== "production" && typeof console !== "undefined") {
494
+ var cacheKey = componentName + ":" + propName;
495
+ if (!manualPropTypeCallCache[cacheKey] && // Avoid spamming the console because they are often not actionable except for lib authors
496
+ manualPropTypeWarningCount < 3) {
497
+ printWarning2(
498
+ "You are manually calling a React.PropTypes validation function for the `" + propFullName + "` prop on `" + componentName + "`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."
499
+ );
500
+ manualPropTypeCallCache[cacheKey] = true;
501
+ manualPropTypeWarningCount++;
502
+ }
503
+ }
504
+ }
505
+ if (props[propName] == null) {
506
+ if (isRequired) {
507
+ if (props[propName] === null) {
508
+ return new PropTypeError("The " + location + " `" + propFullName + "` is marked as required " + ("in `" + componentName + "`, but its value is `null`."));
509
+ }
510
+ return new PropTypeError("The " + location + " `" + propFullName + "` is marked as required in " + ("`" + componentName + "`, but its value is `undefined`."));
511
+ }
512
+ return null;
513
+ } else {
514
+ return validate(props, propName, componentName, location, propFullName);
515
+ }
516
+ }
517
+ var chainedCheckType = checkType.bind(null, false);
518
+ chainedCheckType.isRequired = checkType.bind(null, true);
519
+ return chainedCheckType;
520
+ }
521
+ function createPrimitiveTypeChecker(expectedType) {
522
+ function validate(props, propName, componentName, location, propFullName, secret) {
523
+ var propValue = props[propName];
524
+ var propType = getPropType(propValue);
525
+ if (propType !== expectedType) {
526
+ var preciseType = getPreciseType(propValue);
527
+ return new PropTypeError(
528
+ "Invalid " + location + " `" + propFullName + "` of type " + ("`" + preciseType + "` supplied to `" + componentName + "`, expected ") + ("`" + expectedType + "`."),
529
+ { expectedType }
530
+ );
531
+ }
532
+ return null;
533
+ }
534
+ return createChainableTypeChecker(validate);
535
+ }
536
+ function createAnyTypeChecker() {
537
+ return createChainableTypeChecker(emptyFunctionThatReturnsNull);
538
+ }
539
+ function createArrayOfTypeChecker(typeChecker) {
540
+ function validate(props, propName, componentName, location, propFullName) {
541
+ if (typeof typeChecker !== "function") {
542
+ return new PropTypeError("Property `" + propFullName + "` of component `" + componentName + "` has invalid PropType notation inside arrayOf.");
543
+ }
544
+ var propValue = props[propName];
545
+ if (!Array.isArray(propValue)) {
546
+ var propType = getPropType(propValue);
547
+ return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type " + ("`" + propType + "` supplied to `" + componentName + "`, expected an array."));
548
+ }
549
+ for (var i = 0; i < propValue.length; i++) {
550
+ var error = typeChecker(propValue, i, componentName, location, propFullName + "[" + i + "]", ReactPropTypesSecret2);
551
+ if (error instanceof Error) {
552
+ return error;
553
+ }
554
+ }
555
+ return null;
556
+ }
557
+ return createChainableTypeChecker(validate);
558
+ }
559
+ function createElementTypeChecker() {
560
+ function validate(props, propName, componentName, location, propFullName) {
561
+ var propValue = props[propName];
562
+ if (!isValidElement(propValue)) {
563
+ var propType = getPropType(propValue);
564
+ return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type " + ("`" + propType + "` supplied to `" + componentName + "`, expected a single ReactElement."));
565
+ }
566
+ return null;
567
+ }
568
+ return createChainableTypeChecker(validate);
569
+ }
570
+ function createElementTypeTypeChecker() {
571
+ function validate(props, propName, componentName, location, propFullName) {
572
+ var propValue = props[propName];
573
+ if (!ReactIs.isValidElementType(propValue)) {
574
+ var propType = getPropType(propValue);
575
+ return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type " + ("`" + propType + "` supplied to `" + componentName + "`, expected a single ReactElement type."));
576
+ }
577
+ return null;
578
+ }
579
+ return createChainableTypeChecker(validate);
580
+ }
581
+ function createInstanceTypeChecker(expectedClass) {
582
+ function validate(props, propName, componentName, location, propFullName) {
583
+ if (!(props[propName] instanceof expectedClass)) {
584
+ var expectedClassName = expectedClass.name || ANONYMOUS;
585
+ var actualClassName = getClassName(props[propName]);
586
+ return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type " + ("`" + actualClassName + "` supplied to `" + componentName + "`, expected ") + ("instance of `" + expectedClassName + "`."));
587
+ }
588
+ return null;
589
+ }
590
+ return createChainableTypeChecker(validate);
591
+ }
592
+ function createEnumTypeChecker(expectedValues) {
593
+ if (!Array.isArray(expectedValues)) {
594
+ if (process.env.NODE_ENV !== "production") {
595
+ if (arguments.length > 1) {
596
+ printWarning2(
597
+ "Invalid arguments supplied to oneOf, expected an array, got " + arguments.length + " arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])."
598
+ );
599
+ } else {
600
+ printWarning2("Invalid argument supplied to oneOf, expected an array.");
601
+ }
602
+ }
603
+ return emptyFunctionThatReturnsNull;
604
+ }
605
+ function validate(props, propName, componentName, location, propFullName) {
606
+ var propValue = props[propName];
607
+ for (var i = 0; i < expectedValues.length; i++) {
608
+ if (is(propValue, expectedValues[i])) {
609
+ return null;
610
+ }
611
+ }
612
+ var valuesString = JSON.stringify(expectedValues, function replacer(key, value) {
613
+ var type = getPreciseType(value);
614
+ if (type === "symbol") {
615
+ return String(value);
616
+ }
617
+ return value;
618
+ });
619
+ return new PropTypeError("Invalid " + location + " `" + propFullName + "` of value `" + String(propValue) + "` " + ("supplied to `" + componentName + "`, expected one of " + valuesString + "."));
620
+ }
621
+ return createChainableTypeChecker(validate);
622
+ }
623
+ function createObjectOfTypeChecker(typeChecker) {
624
+ function validate(props, propName, componentName, location, propFullName) {
625
+ if (typeof typeChecker !== "function") {
626
+ return new PropTypeError("Property `" + propFullName + "` of component `" + componentName + "` has invalid PropType notation inside objectOf.");
627
+ }
628
+ var propValue = props[propName];
629
+ var propType = getPropType(propValue);
630
+ if (propType !== "object") {
631
+ return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type " + ("`" + propType + "` supplied to `" + componentName + "`, expected an object."));
632
+ }
633
+ for (var key in propValue) {
634
+ if (has(propValue, key)) {
635
+ var error = typeChecker(propValue, key, componentName, location, propFullName + "." + key, ReactPropTypesSecret2);
636
+ if (error instanceof Error) {
637
+ return error;
638
+ }
639
+ }
640
+ }
641
+ return null;
642
+ }
643
+ return createChainableTypeChecker(validate);
644
+ }
645
+ function createUnionTypeChecker(arrayOfTypeCheckers) {
646
+ if (!Array.isArray(arrayOfTypeCheckers)) {
647
+ process.env.NODE_ENV !== "production" ? printWarning2("Invalid argument supplied to oneOfType, expected an instance of array.") : void 0;
648
+ return emptyFunctionThatReturnsNull;
649
+ }
650
+ for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
651
+ var checker = arrayOfTypeCheckers[i];
652
+ if (typeof checker !== "function") {
653
+ printWarning2(
654
+ "Invalid argument supplied to oneOfType. Expected an array of check functions, but received " + getPostfixForTypeWarning(checker) + " at index " + i + "."
655
+ );
656
+ return emptyFunctionThatReturnsNull;
657
+ }
658
+ }
659
+ function validate(props, propName, componentName, location, propFullName) {
660
+ var expectedTypes = [];
661
+ for (var i2 = 0; i2 < arrayOfTypeCheckers.length; i2++) {
662
+ var checker2 = arrayOfTypeCheckers[i2];
663
+ var checkerResult = checker2(props, propName, componentName, location, propFullName, ReactPropTypesSecret2);
664
+ if (checkerResult == null) {
665
+ return null;
666
+ }
667
+ if (checkerResult.data && has(checkerResult.data, "expectedType")) {
668
+ expectedTypes.push(checkerResult.data.expectedType);
669
+ }
670
+ }
671
+ var expectedTypesMessage = expectedTypes.length > 0 ? ", expected one of type [" + expectedTypes.join(", ") + "]" : "";
672
+ return new PropTypeError("Invalid " + location + " `" + propFullName + "` supplied to " + ("`" + componentName + "`" + expectedTypesMessage + "."));
673
+ }
674
+ return createChainableTypeChecker(validate);
675
+ }
676
+ function createNodeChecker() {
677
+ function validate(props, propName, componentName, location, propFullName) {
678
+ if (!isNode(props[propName])) {
679
+ return new PropTypeError("Invalid " + location + " `" + propFullName + "` supplied to " + ("`" + componentName + "`, expected a ReactNode."));
680
+ }
681
+ return null;
682
+ }
683
+ return createChainableTypeChecker(validate);
684
+ }
685
+ function invalidValidatorError(componentName, location, propFullName, key, type) {
686
+ return new PropTypeError(
687
+ (componentName || "React class") + ": " + location + " type `" + propFullName + "." + key + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + type + "`."
688
+ );
689
+ }
690
+ function createShapeTypeChecker(shapeTypes) {
691
+ function validate(props, propName, componentName, location, propFullName) {
692
+ var propValue = props[propName];
693
+ var propType = getPropType(propValue);
694
+ if (propType !== "object") {
695
+ return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type `" + propType + "` " + ("supplied to `" + componentName + "`, expected `object`."));
696
+ }
697
+ for (var key in shapeTypes) {
698
+ var checker = shapeTypes[key];
699
+ if (typeof checker !== "function") {
700
+ return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
701
+ }
702
+ var error = checker(propValue, key, componentName, location, propFullName + "." + key, ReactPropTypesSecret2);
703
+ if (error) {
704
+ return error;
705
+ }
706
+ }
707
+ return null;
708
+ }
709
+ return createChainableTypeChecker(validate);
710
+ }
711
+ function createStrictShapeTypeChecker(shapeTypes) {
712
+ function validate(props, propName, componentName, location, propFullName) {
713
+ var propValue = props[propName];
714
+ var propType = getPropType(propValue);
715
+ if (propType !== "object") {
716
+ return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type `" + propType + "` " + ("supplied to `" + componentName + "`, expected `object`."));
717
+ }
718
+ var allKeys = assign({}, props[propName], shapeTypes);
719
+ for (var key in allKeys) {
720
+ var checker = shapeTypes[key];
721
+ if (has(shapeTypes, key) && typeof checker !== "function") {
722
+ return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
723
+ }
724
+ if (!checker) {
725
+ return new PropTypeError(
726
+ "Invalid " + location + " `" + propFullName + "` key `" + key + "` supplied to `" + componentName + "`.\nBad object: " + JSON.stringify(props[propName], null, " ") + "\nValid keys: " + JSON.stringify(Object.keys(shapeTypes), null, " ")
727
+ );
728
+ }
729
+ var error = checker(propValue, key, componentName, location, propFullName + "." + key, ReactPropTypesSecret2);
730
+ if (error) {
731
+ return error;
732
+ }
733
+ }
734
+ return null;
735
+ }
736
+ return createChainableTypeChecker(validate);
737
+ }
738
+ function isNode(propValue) {
739
+ switch (typeof propValue) {
740
+ case "number":
741
+ case "string":
742
+ case "undefined":
743
+ return true;
744
+ case "boolean":
745
+ return !propValue;
746
+ case "object":
747
+ if (Array.isArray(propValue)) {
748
+ return propValue.every(isNode);
749
+ }
750
+ if (propValue === null || isValidElement(propValue)) {
751
+ return true;
752
+ }
753
+ var iteratorFn = getIteratorFn(propValue);
754
+ if (iteratorFn) {
755
+ var iterator = iteratorFn.call(propValue);
756
+ var step;
757
+ if (iteratorFn !== propValue.entries) {
758
+ while (!(step = iterator.next()).done) {
759
+ if (!isNode(step.value)) {
760
+ return false;
761
+ }
762
+ }
763
+ } else {
764
+ while (!(step = iterator.next()).done) {
765
+ var entry = step.value;
766
+ if (entry) {
767
+ if (!isNode(entry[1])) {
768
+ return false;
769
+ }
770
+ }
771
+ }
772
+ }
773
+ } else {
774
+ return false;
775
+ }
776
+ return true;
777
+ default:
778
+ return false;
779
+ }
780
+ }
781
+ function isSymbol(propType, propValue) {
782
+ if (propType === "symbol") {
783
+ return true;
784
+ }
785
+ if (!propValue) {
786
+ return false;
787
+ }
788
+ if (propValue["@@toStringTag"] === "Symbol") {
789
+ return true;
790
+ }
791
+ if (typeof Symbol === "function" && propValue instanceof Symbol) {
792
+ return true;
793
+ }
794
+ return false;
795
+ }
796
+ function getPropType(propValue) {
797
+ var propType = typeof propValue;
798
+ if (Array.isArray(propValue)) {
799
+ return "array";
800
+ }
801
+ if (propValue instanceof RegExp) {
802
+ return "object";
803
+ }
804
+ if (isSymbol(propType, propValue)) {
805
+ return "symbol";
806
+ }
807
+ return propType;
808
+ }
809
+ function getPreciseType(propValue) {
810
+ if (typeof propValue === "undefined" || propValue === null) {
811
+ return "" + propValue;
812
+ }
813
+ var propType = getPropType(propValue);
814
+ if (propType === "object") {
815
+ if (propValue instanceof Date) {
816
+ return "date";
817
+ } else if (propValue instanceof RegExp) {
818
+ return "regexp";
819
+ }
820
+ }
821
+ return propType;
822
+ }
823
+ function getPostfixForTypeWarning(value) {
824
+ var type = getPreciseType(value);
825
+ switch (type) {
826
+ case "array":
827
+ case "object":
828
+ return "an " + type;
829
+ case "boolean":
830
+ case "date":
831
+ case "regexp":
832
+ return "a " + type;
833
+ default:
834
+ return type;
835
+ }
836
+ }
837
+ function getClassName(propValue) {
838
+ if (!propValue.constructor || !propValue.constructor.name) {
839
+ return ANONYMOUS;
840
+ }
841
+ return propValue.constructor.name;
842
+ }
843
+ ReactPropTypes.checkPropTypes = checkPropTypes2;
844
+ ReactPropTypes.resetWarningCache = checkPropTypes2.resetWarningCache;
845
+ ReactPropTypes.PropTypes = ReactPropTypes;
846
+ return ReactPropTypes;
847
+ };
848
+ return factoryWithTypeCheckers;
849
+ }
850
+ var ReactPropTypesSecret = ReactPropTypesSecret_1;
851
+ function emptyFunction() {
852
+ }
853
+ function emptyFunctionWithReset() {
854
+ }
855
+ emptyFunctionWithReset.resetWarningCache = emptyFunction;
856
+ var factoryWithThrowingShims = function() {
857
+ function shim(props, propName, componentName, location, propFullName, secret) {
858
+ if (secret === ReactPropTypesSecret) {
859
+ return;
860
+ }
861
+ var err = new Error(
862
+ "Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types"
863
+ );
864
+ err.name = "Invariant Violation";
865
+ throw err;
866
+ }
867
+ shim.isRequired = shim;
868
+ function getShim() {
869
+ return shim;
870
+ }
871
+ var ReactPropTypes = {
872
+ array: shim,
873
+ bigint: shim,
874
+ bool: shim,
875
+ func: shim,
876
+ number: shim,
877
+ object: shim,
878
+ string: shim,
879
+ symbol: shim,
880
+ any: shim,
881
+ arrayOf: getShim,
882
+ element: shim,
883
+ elementType: shim,
884
+ instanceOf: getShim,
885
+ node: shim,
886
+ objectOf: getShim,
887
+ oneOf: getShim,
888
+ oneOfType: getShim,
889
+ shape: getShim,
890
+ exact: getShim,
891
+ checkPropTypes: emptyFunctionWithReset,
892
+ resetWarningCache: emptyFunction
893
+ };
894
+ ReactPropTypes.PropTypes = ReactPropTypes;
895
+ return ReactPropTypes;
896
+ };
897
+ if (process.env.NODE_ENV !== "production") {
898
+ var ReactIs = reactIsExports;
899
+ var throwOnDirectAccess = true;
900
+ propTypes.exports = requireFactoryWithTypeCheckers()(ReactIs.isElement, throwOnDirectAccess);
901
+ } else {
902
+ propTypes.exports = factoryWithThrowingShims();
903
+ }
904
+ var propTypesExports = propTypes.exports;
905
+ const PropTypes = /* @__PURE__ */ getDefaultExportFromCjs(propTypesExports);
906
+ var COMMON_MIME_TYPES = /* @__PURE__ */ new Map([
907
+ // https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types
908
+ ["aac", "audio/aac"],
909
+ ["abw", "application/x-abiword"],
910
+ ["arc", "application/x-freearc"],
911
+ ["avif", "image/avif"],
912
+ ["avi", "video/x-msvideo"],
913
+ ["azw", "application/vnd.amazon.ebook"],
914
+ ["bin", "application/octet-stream"],
915
+ ["bmp", "image/bmp"],
916
+ ["bz", "application/x-bzip"],
917
+ ["bz2", "application/x-bzip2"],
918
+ ["cda", "application/x-cdf"],
919
+ ["csh", "application/x-csh"],
920
+ ["css", "text/css"],
921
+ ["csv", "text/csv"],
922
+ ["doc", "application/msword"],
923
+ ["docx", "application/vnd.openxmlformats-officedocument.wordprocessingml.document"],
924
+ ["eot", "application/vnd.ms-fontobject"],
925
+ ["epub", "application/epub+zip"],
926
+ ["gz", "application/gzip"],
927
+ ["gif", "image/gif"],
928
+ ["heic", "image/heic"],
929
+ ["heif", "image/heif"],
930
+ ["htm", "text/html"],
931
+ ["html", "text/html"],
932
+ ["ico", "image/vnd.microsoft.icon"],
933
+ ["ics", "text/calendar"],
934
+ ["jar", "application/java-archive"],
935
+ ["jpeg", "image/jpeg"],
936
+ ["jpg", "image/jpeg"],
937
+ ["js", "text/javascript"],
938
+ ["json", "application/json"],
939
+ ["jsonld", "application/ld+json"],
940
+ ["mid", "audio/midi"],
941
+ ["midi", "audio/midi"],
942
+ ["mjs", "text/javascript"],
943
+ ["mp3", "audio/mpeg"],
944
+ ["mp4", "video/mp4"],
945
+ ["mpeg", "video/mpeg"],
946
+ ["mpkg", "application/vnd.apple.installer+xml"],
947
+ ["odp", "application/vnd.oasis.opendocument.presentation"],
948
+ ["ods", "application/vnd.oasis.opendocument.spreadsheet"],
949
+ ["odt", "application/vnd.oasis.opendocument.text"],
950
+ ["oga", "audio/ogg"],
951
+ ["ogv", "video/ogg"],
952
+ ["ogx", "application/ogg"],
953
+ ["opus", "audio/opus"],
954
+ ["otf", "font/otf"],
955
+ ["png", "image/png"],
956
+ ["pdf", "application/pdf"],
957
+ ["php", "application/x-httpd-php"],
958
+ ["ppt", "application/vnd.ms-powerpoint"],
959
+ ["pptx", "application/vnd.openxmlformats-officedocument.presentationml.presentation"],
960
+ ["rar", "application/vnd.rar"],
961
+ ["rtf", "application/rtf"],
962
+ ["sh", "application/x-sh"],
963
+ ["svg", "image/svg+xml"],
964
+ ["swf", "application/x-shockwave-flash"],
965
+ ["tar", "application/x-tar"],
966
+ ["tif", "image/tiff"],
967
+ ["tiff", "image/tiff"],
968
+ ["ts", "video/mp2t"],
969
+ ["ttf", "font/ttf"],
970
+ ["txt", "text/plain"],
971
+ ["vsd", "application/vnd.visio"],
972
+ ["wav", "audio/wav"],
973
+ ["weba", "audio/webm"],
974
+ ["webm", "video/webm"],
975
+ ["webp", "image/webp"],
976
+ ["woff", "font/woff"],
977
+ ["woff2", "font/woff2"],
978
+ ["xhtml", "application/xhtml+xml"],
979
+ ["xls", "application/vnd.ms-excel"],
980
+ ["xlsx", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],
981
+ ["xml", "application/xml"],
982
+ ["xul", "application/vnd.mozilla.xul+xml"],
983
+ ["zip", "application/zip"],
984
+ ["7z", "application/x-7z-compressed"],
985
+ // Others
986
+ ["mkv", "video/x-matroska"],
987
+ ["mov", "video/quicktime"],
988
+ ["msg", "application/vnd.ms-outlook"]
989
+ ]);
990
+ function toFileWithPath(file, path) {
991
+ var f = withMimeType(file);
992
+ if (typeof f.path !== "string") {
993
+ var webkitRelativePath = file.webkitRelativePath;
994
+ Object.defineProperty(f, "path", {
995
+ value: typeof path === "string" ? path : typeof webkitRelativePath === "string" && webkitRelativePath.length > 0 ? webkitRelativePath : file.name,
996
+ writable: false,
997
+ configurable: false,
998
+ enumerable: true
999
+ });
1000
+ }
1001
+ return f;
1002
+ }
1003
+ function withMimeType(file) {
1004
+ var name = file.name;
1005
+ var hasExtension = name && name.lastIndexOf(".") !== -1;
1006
+ if (hasExtension && !file.type) {
1007
+ var ext = name.split(".").pop().toLowerCase();
1008
+ var type = COMMON_MIME_TYPES.get(ext);
1009
+ if (type) {
1010
+ Object.defineProperty(file, "type", {
1011
+ value: type,
1012
+ writable: false,
1013
+ configurable: false,
1014
+ enumerable: true
1015
+ });
1016
+ }
1017
+ }
1018
+ return file;
1019
+ }
1020
+ var FILES_TO_IGNORE = [
1021
+ // Thumbnail cache files for macOS and Windows
1022
+ ".DS_Store",
1023
+ "Thumbs.db"
1024
+ // Windows
1025
+ ];
1026
+ function fromEvent(evt) {
1027
+ return __awaiter(this, void 0, void 0, function() {
1028
+ return __generator(this, function(_a) {
1029
+ if (isObject(evt) && isDataTransfer(evt.dataTransfer)) {
1030
+ return [2, getDataTransferFiles(evt.dataTransfer, evt.type)];
1031
+ } else if (isChangeEvt(evt)) {
1032
+ return [2, getInputFiles(evt)];
1033
+ } else if (Array.isArray(evt) && evt.every(function(item) {
1034
+ return "getFile" in item && typeof item.getFile === "function";
1035
+ })) {
1036
+ return [2, getFsHandleFiles(evt)];
1037
+ }
1038
+ return [2, []];
1039
+ });
1040
+ });
1041
+ }
1042
+ function isDataTransfer(value) {
1043
+ return isObject(value);
1044
+ }
1045
+ function isChangeEvt(value) {
1046
+ return isObject(value) && isObject(value.target);
1047
+ }
1048
+ function isObject(v) {
1049
+ return typeof v === "object" && v !== null;
1050
+ }
1051
+ function getInputFiles(evt) {
1052
+ return fromList(evt.target.files).map(function(file) {
1053
+ return toFileWithPath(file);
1054
+ });
1055
+ }
1056
+ function getFsHandleFiles(handles) {
1057
+ return __awaiter(this, void 0, void 0, function() {
1058
+ var files;
1059
+ return __generator(this, function(_a) {
1060
+ switch (_a.label) {
1061
+ case 0:
1062
+ return [4, Promise.all(handles.map(function(h) {
1063
+ return h.getFile();
1064
+ }))];
1065
+ case 1:
1066
+ files = _a.sent();
1067
+ return [2, files.map(function(file) {
1068
+ return toFileWithPath(file);
1069
+ })];
1070
+ }
1071
+ });
1072
+ });
1073
+ }
1074
+ function getDataTransferFiles(dt, type) {
1075
+ return __awaiter(this, void 0, void 0, function() {
1076
+ var items, files;
1077
+ return __generator(this, function(_a) {
1078
+ switch (_a.label) {
1079
+ case 0:
1080
+ if (!dt.items)
1081
+ return [3, 2];
1082
+ items = fromList(dt.items).filter(function(item) {
1083
+ return item.kind === "file";
1084
+ });
1085
+ if (type !== "drop") {
1086
+ return [2, items];
1087
+ }
1088
+ return [4, Promise.all(items.map(toFilePromises))];
1089
+ case 1:
1090
+ files = _a.sent();
1091
+ return [2, noIgnoredFiles(flatten(files))];
1092
+ case 2:
1093
+ return [2, noIgnoredFiles(fromList(dt.files).map(function(file) {
1094
+ return toFileWithPath(file);
1095
+ }))];
1096
+ }
1097
+ });
1098
+ });
1099
+ }
1100
+ function noIgnoredFiles(files) {
1101
+ return files.filter(function(file) {
1102
+ return FILES_TO_IGNORE.indexOf(file.name) === -1;
1103
+ });
1104
+ }
1105
+ function fromList(items) {
1106
+ if (items === null) {
1107
+ return [];
1108
+ }
1109
+ var files = [];
1110
+ for (var i = 0; i < items.length; i++) {
1111
+ var file = items[i];
1112
+ files.push(file);
1113
+ }
1114
+ return files;
1115
+ }
1116
+ function toFilePromises(item) {
1117
+ if (typeof item.webkitGetAsEntry !== "function") {
1118
+ return fromDataTransferItem(item);
1119
+ }
1120
+ var entry = item.webkitGetAsEntry();
1121
+ if (entry && entry.isDirectory) {
1122
+ return fromDirEntry(entry);
1123
+ }
1124
+ return fromDataTransferItem(item);
1125
+ }
1126
+ function flatten(items) {
1127
+ return items.reduce(function(acc, files) {
1128
+ return __spreadArray(__spreadArray([], __read(acc), false), __read(Array.isArray(files) ? flatten(files) : [files]), false);
1129
+ }, []);
1130
+ }
1131
+ function fromDataTransferItem(item) {
1132
+ var file = item.getAsFile();
1133
+ if (!file) {
1134
+ return Promise.reject("".concat(item, " is not a File"));
1135
+ }
1136
+ var fwp = toFileWithPath(file);
1137
+ return Promise.resolve(fwp);
1138
+ }
1139
+ function fromEntry(entry) {
1140
+ return __awaiter(this, void 0, void 0, function() {
1141
+ return __generator(this, function(_a) {
1142
+ return [2, entry.isDirectory ? fromDirEntry(entry) : fromFileEntry(entry)];
1143
+ });
1144
+ });
1145
+ }
1146
+ function fromDirEntry(entry) {
1147
+ var reader = entry.createReader();
1148
+ return new Promise(function(resolve, reject) {
1149
+ var entries = [];
1150
+ function readEntries() {
1151
+ var _this = this;
1152
+ reader.readEntries(function(batch) {
1153
+ return __awaiter(_this, void 0, void 0, function() {
1154
+ var files, err_1, items;
1155
+ return __generator(this, function(_a) {
1156
+ switch (_a.label) {
1157
+ case 0:
1158
+ if (!!batch.length)
1159
+ return [3, 5];
1160
+ _a.label = 1;
1161
+ case 1:
1162
+ _a.trys.push([1, 3, , 4]);
1163
+ return [4, Promise.all(entries)];
1164
+ case 2:
1165
+ files = _a.sent();
1166
+ resolve(files);
1167
+ return [3, 4];
1168
+ case 3:
1169
+ err_1 = _a.sent();
1170
+ reject(err_1);
1171
+ return [3, 4];
1172
+ case 4:
1173
+ return [3, 6];
1174
+ case 5:
1175
+ items = Promise.all(batch.map(fromEntry));
1176
+ entries.push(items);
1177
+ readEntries();
1178
+ _a.label = 6;
1179
+ case 6:
1180
+ return [
1181
+ 2
1182
+ /*return*/
1183
+ ];
1184
+ }
1185
+ });
1186
+ });
1187
+ }, function(err) {
1188
+ reject(err);
1189
+ });
1190
+ }
1191
+ readEntries();
1192
+ });
1193
+ }
1194
+ function fromFileEntry(entry) {
1195
+ return __awaiter(this, void 0, void 0, function() {
1196
+ return __generator(this, function(_a) {
1197
+ return [2, new Promise(function(resolve, reject) {
1198
+ entry.file(function(file) {
1199
+ var fwp = toFileWithPath(file, entry.fullPath);
1200
+ resolve(fwp);
1201
+ }, function(err) {
1202
+ reject(err);
1203
+ });
1204
+ })];
1205
+ });
1206
+ });
1207
+ }
1208
+ var _default = function(file, acceptedFiles) {
1209
+ if (file && acceptedFiles) {
1210
+ var acceptedFilesArray = Array.isArray(acceptedFiles) ? acceptedFiles : acceptedFiles.split(",");
1211
+ var fileName = file.name || "";
1212
+ var mimeType = (file.type || "").toLowerCase();
1213
+ var baseMimeType = mimeType.replace(/\/.*$/, "");
1214
+ return acceptedFilesArray.some(function(type) {
1215
+ var validType = type.trim().toLowerCase();
1216
+ if (validType.charAt(0) === ".") {
1217
+ return fileName.toLowerCase().endsWith(validType);
1218
+ } else if (validType.endsWith("/*")) {
1219
+ return baseMimeType === validType.replace(/\/.*$/, "");
1220
+ }
1221
+ return mimeType === validType;
1222
+ });
1223
+ }
1224
+ return true;
1225
+ };
1226
+ function _toConsumableArray$1(arr) {
1227
+ return _arrayWithoutHoles$1(arr) || _iterableToArray$1(arr) || _unsupportedIterableToArray$1(arr) || _nonIterableSpread$1();
1228
+ }
1229
+ function _nonIterableSpread$1() {
1230
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1231
+ }
1232
+ function _iterableToArray$1(iter) {
1233
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null)
1234
+ return Array.from(iter);
1235
+ }
1236
+ function _arrayWithoutHoles$1(arr) {
1237
+ if (Array.isArray(arr))
1238
+ return _arrayLikeToArray$1(arr);
1239
+ }
1240
+ function ownKeys$1(object, enumerableOnly) {
1241
+ var keys = Object.keys(object);
1242
+ if (Object.getOwnPropertySymbols) {
1243
+ var symbols = Object.getOwnPropertySymbols(object);
1244
+ enumerableOnly && (symbols = symbols.filter(function(sym) {
1245
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
1246
+ })), keys.push.apply(keys, symbols);
1247
+ }
1248
+ return keys;
1249
+ }
1250
+ function _objectSpread$1(target) {
1251
+ for (var i = 1; i < arguments.length; i++) {
1252
+ var source = null != arguments[i] ? arguments[i] : {};
1253
+ i % 2 ? ownKeys$1(Object(source), true).forEach(function(key) {
1254
+ _defineProperty$1(target, key, source[key]);
1255
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$1(Object(source)).forEach(function(key) {
1256
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
1257
+ });
1258
+ }
1259
+ return target;
1260
+ }
1261
+ function _defineProperty$1(obj, key, value) {
1262
+ if (key in obj) {
1263
+ Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
1264
+ } else {
1265
+ obj[key] = value;
1266
+ }
1267
+ return obj;
1268
+ }
1269
+ function _slicedToArray$1(arr, i) {
1270
+ return _arrayWithHoles$1(arr) || _iterableToArrayLimit$1(arr, i) || _unsupportedIterableToArray$1(arr, i) || _nonIterableRest$1();
1271
+ }
1272
+ function _nonIterableRest$1() {
1273
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1274
+ }
1275
+ function _unsupportedIterableToArray$1(o, minLen) {
1276
+ if (!o)
1277
+ return;
1278
+ if (typeof o === "string")
1279
+ return _arrayLikeToArray$1(o, minLen);
1280
+ var n = Object.prototype.toString.call(o).slice(8, -1);
1281
+ if (n === "Object" && o.constructor)
1282
+ n = o.constructor.name;
1283
+ if (n === "Map" || n === "Set")
1284
+ return Array.from(o);
1285
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
1286
+ return _arrayLikeToArray$1(o, minLen);
1287
+ }
1288
+ function _arrayLikeToArray$1(arr, len) {
1289
+ if (len == null || len > arr.length)
1290
+ len = arr.length;
1291
+ for (var i = 0, arr2 = new Array(len); i < len; i++) {
1292
+ arr2[i] = arr[i];
1293
+ }
1294
+ return arr2;
1295
+ }
1296
+ function _iterableToArrayLimit$1(arr, i) {
1297
+ var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
1298
+ if (_i == null)
1299
+ return;
1300
+ var _arr = [];
1301
+ var _n = true;
1302
+ var _d = false;
1303
+ var _s, _e;
1304
+ try {
1305
+ for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
1306
+ _arr.push(_s.value);
1307
+ if (i && _arr.length === i)
1308
+ break;
1309
+ }
1310
+ } catch (err) {
1311
+ _d = true;
1312
+ _e = err;
1313
+ } finally {
1314
+ try {
1315
+ if (!_n && _i["return"] != null)
1316
+ _i["return"]();
1317
+ } finally {
1318
+ if (_d)
1319
+ throw _e;
1320
+ }
1321
+ }
1322
+ return _arr;
1323
+ }
1324
+ function _arrayWithHoles$1(arr) {
1325
+ if (Array.isArray(arr))
1326
+ return arr;
1327
+ }
1328
+ var FILE_INVALID_TYPE = "file-invalid-type";
1329
+ var FILE_TOO_LARGE = "file-too-large";
1330
+ var FILE_TOO_SMALL = "file-too-small";
1331
+ var TOO_MANY_FILES = "too-many-files";
1332
+ var getInvalidTypeRejectionErr = function getInvalidTypeRejectionErr2(accept) {
1333
+ accept = Array.isArray(accept) && accept.length === 1 ? accept[0] : accept;
1334
+ var messageSuffix = Array.isArray(accept) ? "one of ".concat(accept.join(", ")) : accept;
1335
+ return {
1336
+ code: FILE_INVALID_TYPE,
1337
+ message: "File type must be ".concat(messageSuffix)
1338
+ };
1339
+ };
1340
+ var getTooLargeRejectionErr = function getTooLargeRejectionErr2(maxSize) {
1341
+ return {
1342
+ code: FILE_TOO_LARGE,
1343
+ message: "File is larger than ".concat(maxSize, " ").concat(maxSize === 1 ? "byte" : "bytes")
1344
+ };
1345
+ };
1346
+ var getTooSmallRejectionErr = function getTooSmallRejectionErr2(minSize) {
1347
+ return {
1348
+ code: FILE_TOO_SMALL,
1349
+ message: "File is smaller than ".concat(minSize, " ").concat(minSize === 1 ? "byte" : "bytes")
1350
+ };
1351
+ };
1352
+ var TOO_MANY_FILES_REJECTION = {
1353
+ code: TOO_MANY_FILES,
1354
+ message: "Too many files"
1355
+ };
1356
+ function fileAccepted(file, accept) {
1357
+ var isAcceptable = file.type === "application/x-moz-file" || _default(file, accept);
1358
+ return [isAcceptable, isAcceptable ? null : getInvalidTypeRejectionErr(accept)];
1359
+ }
1360
+ function fileMatchSize(file, minSize, maxSize) {
1361
+ if (isDefined(file.size)) {
1362
+ if (isDefined(minSize) && isDefined(maxSize)) {
1363
+ if (file.size > maxSize)
1364
+ return [false, getTooLargeRejectionErr(maxSize)];
1365
+ if (file.size < minSize)
1366
+ return [false, getTooSmallRejectionErr(minSize)];
1367
+ } else if (isDefined(minSize) && file.size < minSize)
1368
+ return [false, getTooSmallRejectionErr(minSize)];
1369
+ else if (isDefined(maxSize) && file.size > maxSize)
1370
+ return [false, getTooLargeRejectionErr(maxSize)];
1371
+ }
1372
+ return [true, null];
1373
+ }
1374
+ function isDefined(value) {
1375
+ return value !== void 0 && value !== null;
1376
+ }
1377
+ function allFilesAccepted(_ref) {
1378
+ var files = _ref.files, accept = _ref.accept, minSize = _ref.minSize, maxSize = _ref.maxSize, multiple = _ref.multiple, maxFiles = _ref.maxFiles, validator = _ref.validator;
1379
+ if (!multiple && files.length > 1 || multiple && maxFiles >= 1 && files.length > maxFiles) {
1380
+ return false;
1381
+ }
1382
+ return files.every(function(file) {
1383
+ var _fileAccepted = fileAccepted(file, accept), _fileAccepted2 = _slicedToArray$1(_fileAccepted, 1), accepted = _fileAccepted2[0];
1384
+ var _fileMatchSize = fileMatchSize(file, minSize, maxSize), _fileMatchSize2 = _slicedToArray$1(_fileMatchSize, 1), sizeMatch = _fileMatchSize2[0];
1385
+ var customErrors = validator ? validator(file) : null;
1386
+ return accepted && sizeMatch && !customErrors;
1387
+ });
1388
+ }
1389
+ function isPropagationStopped(event) {
1390
+ if (typeof event.isPropagationStopped === "function") {
1391
+ return event.isPropagationStopped();
1392
+ } else if (typeof event.cancelBubble !== "undefined") {
1393
+ return event.cancelBubble;
1394
+ }
1395
+ return false;
1396
+ }
1397
+ function isEvtWithFiles(event) {
1398
+ if (!event.dataTransfer) {
1399
+ return !!event.target && !!event.target.files;
1400
+ }
1401
+ return Array.prototype.some.call(event.dataTransfer.types, function(type) {
1402
+ return type === "Files" || type === "application/x-moz-file";
1403
+ });
1404
+ }
1405
+ function onDocumentDragOver(event) {
1406
+ event.preventDefault();
1407
+ }
1408
+ function isIe(userAgent) {
1409
+ return userAgent.indexOf("MSIE") !== -1 || userAgent.indexOf("Trident/") !== -1;
1410
+ }
1411
+ function isEdge(userAgent) {
1412
+ return userAgent.indexOf("Edge/") !== -1;
1413
+ }
1414
+ function isIeOrEdge() {
1415
+ var userAgent = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : window.navigator.userAgent;
1416
+ return isIe(userAgent) || isEdge(userAgent);
1417
+ }
1418
+ function composeEventHandlers() {
1419
+ for (var _len = arguments.length, fns = new Array(_len), _key = 0; _key < _len; _key++) {
1420
+ fns[_key] = arguments[_key];
1421
+ }
1422
+ return function(event) {
1423
+ for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
1424
+ args[_key2 - 1] = arguments[_key2];
1425
+ }
1426
+ return fns.some(function(fn) {
1427
+ if (!isPropagationStopped(event) && fn) {
1428
+ fn.apply(void 0, [event].concat(args));
1429
+ }
1430
+ return isPropagationStopped(event);
1431
+ });
1432
+ };
1433
+ }
1434
+ function canUseFileSystemAccessAPI() {
1435
+ return "showOpenFilePicker" in window;
1436
+ }
1437
+ function pickerOptionsFromAccept(accept) {
1438
+ if (isDefined(accept)) {
1439
+ var acceptForPicker = Object.entries(accept).filter(function(_ref2) {
1440
+ var _ref3 = _slicedToArray$1(_ref2, 2), mimeType = _ref3[0], ext = _ref3[1];
1441
+ var ok = true;
1442
+ if (!isMIMEType(mimeType)) {
1443
+ console.warn('Skipped "'.concat(mimeType, '" because it is not a valid MIME type. Check https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types for a list of valid MIME types.'));
1444
+ ok = false;
1445
+ }
1446
+ if (!Array.isArray(ext) || !ext.every(isExt)) {
1447
+ console.warn('Skipped "'.concat(mimeType, '" because an invalid file extension was provided.'));
1448
+ ok = false;
1449
+ }
1450
+ return ok;
1451
+ }).reduce(function(agg, _ref4) {
1452
+ var _ref5 = _slicedToArray$1(_ref4, 2), mimeType = _ref5[0], ext = _ref5[1];
1453
+ return _objectSpread$1(_objectSpread$1({}, agg), {}, _defineProperty$1({}, mimeType, ext));
1454
+ }, {});
1455
+ return [{
1456
+ // description is required due to https://crbug.com/1264708
1457
+ description: "Files",
1458
+ accept: acceptForPicker
1459
+ }];
1460
+ }
1461
+ return accept;
1462
+ }
1463
+ function acceptPropAsAcceptAttr(accept) {
1464
+ if (isDefined(accept)) {
1465
+ return Object.entries(accept).reduce(function(a, _ref6) {
1466
+ var _ref7 = _slicedToArray$1(_ref6, 2), mimeType = _ref7[0], ext = _ref7[1];
1467
+ return [].concat(_toConsumableArray$1(a), [mimeType], _toConsumableArray$1(ext));
1468
+ }, []).filter(function(v) {
1469
+ return isMIMEType(v) || isExt(v);
1470
+ }).join(",");
1471
+ }
1472
+ return void 0;
1473
+ }
1474
+ function isAbort(v) {
1475
+ return v instanceof DOMException && (v.name === "AbortError" || v.code === v.ABORT_ERR);
1476
+ }
1477
+ function isSecurityError(v) {
1478
+ return v instanceof DOMException && (v.name === "SecurityError" || v.code === v.SECURITY_ERR);
1479
+ }
1480
+ function isMIMEType(v) {
1481
+ return v === "audio/*" || v === "video/*" || v === "image/*" || v === "text/*" || /\w+\/[-+.\w]+/g.test(v);
1482
+ }
1483
+ function isExt(v) {
1484
+ return /^.*\.[\w]+$/.test(v);
1485
+ }
1486
+ var _excluded = ["children"], _excluded2 = ["open"], _excluded3 = ["refKey", "role", "onKeyDown", "onFocus", "onBlur", "onClick", "onDragEnter", "onDragOver", "onDragLeave", "onDrop"], _excluded4 = ["refKey", "onChange", "onClick"];
1487
+ function _toConsumableArray(arr) {
1488
+ return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
1489
+ }
1490
+ function _nonIterableSpread() {
1491
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1492
+ }
1493
+ function _iterableToArray(iter) {
1494
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null)
1495
+ return Array.from(iter);
1496
+ }
1497
+ function _arrayWithoutHoles(arr) {
1498
+ if (Array.isArray(arr))
1499
+ return _arrayLikeToArray(arr);
1500
+ }
1501
+ function _slicedToArray(arr, i) {
1502
+ return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
1503
+ }
1504
+ function _nonIterableRest() {
1505
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1506
+ }
1507
+ function _unsupportedIterableToArray(o, minLen) {
1508
+ if (!o)
1509
+ return;
1510
+ if (typeof o === "string")
1511
+ return _arrayLikeToArray(o, minLen);
1512
+ var n = Object.prototype.toString.call(o).slice(8, -1);
1513
+ if (n === "Object" && o.constructor)
1514
+ n = o.constructor.name;
1515
+ if (n === "Map" || n === "Set")
1516
+ return Array.from(o);
1517
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
1518
+ return _arrayLikeToArray(o, minLen);
1519
+ }
1520
+ function _arrayLikeToArray(arr, len) {
1521
+ if (len == null || len > arr.length)
1522
+ len = arr.length;
1523
+ for (var i = 0, arr2 = new Array(len); i < len; i++) {
1524
+ arr2[i] = arr[i];
1525
+ }
1526
+ return arr2;
1527
+ }
1528
+ function _iterableToArrayLimit(arr, i) {
1529
+ var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
1530
+ if (_i == null)
1531
+ return;
1532
+ var _arr = [];
1533
+ var _n = true;
1534
+ var _d = false;
1535
+ var _s, _e;
1536
+ try {
1537
+ for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
1538
+ _arr.push(_s.value);
1539
+ if (i && _arr.length === i)
1540
+ break;
1541
+ }
1542
+ } catch (err) {
1543
+ _d = true;
1544
+ _e = err;
1545
+ } finally {
1546
+ try {
1547
+ if (!_n && _i["return"] != null)
1548
+ _i["return"]();
1549
+ } finally {
1550
+ if (_d)
1551
+ throw _e;
1552
+ }
1553
+ }
1554
+ return _arr;
1555
+ }
1556
+ function _arrayWithHoles(arr) {
1557
+ if (Array.isArray(arr))
1558
+ return arr;
1559
+ }
1560
+ function ownKeys(object, enumerableOnly) {
1561
+ var keys = Object.keys(object);
1562
+ if (Object.getOwnPropertySymbols) {
1563
+ var symbols = Object.getOwnPropertySymbols(object);
1564
+ enumerableOnly && (symbols = symbols.filter(function(sym) {
1565
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
1566
+ })), keys.push.apply(keys, symbols);
1567
+ }
1568
+ return keys;
1569
+ }
1570
+ function _objectSpread(target) {
1571
+ for (var i = 1; i < arguments.length; i++) {
1572
+ var source = null != arguments[i] ? arguments[i] : {};
1573
+ i % 2 ? ownKeys(Object(source), true).forEach(function(key) {
1574
+ _defineProperty(target, key, source[key]);
1575
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) {
1576
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
1577
+ });
1578
+ }
1579
+ return target;
1580
+ }
1581
+ function _defineProperty(obj, key, value) {
1582
+ if (key in obj) {
1583
+ Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
1584
+ } else {
1585
+ obj[key] = value;
1586
+ }
1587
+ return obj;
1588
+ }
1589
+ function _objectWithoutProperties(source, excluded) {
1590
+ if (source == null)
1591
+ return {};
1592
+ var target = _objectWithoutPropertiesLoose(source, excluded);
1593
+ var key, i;
1594
+ if (Object.getOwnPropertySymbols) {
1595
+ var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
1596
+ for (i = 0; i < sourceSymbolKeys.length; i++) {
1597
+ key = sourceSymbolKeys[i];
1598
+ if (excluded.indexOf(key) >= 0)
1599
+ continue;
1600
+ if (!Object.prototype.propertyIsEnumerable.call(source, key))
1601
+ continue;
1602
+ target[key] = source[key];
1603
+ }
1604
+ }
1605
+ return target;
1606
+ }
1607
+ function _objectWithoutPropertiesLoose(source, excluded) {
1608
+ if (source == null)
1609
+ return {};
1610
+ var target = {};
1611
+ var sourceKeys = Object.keys(source);
1612
+ var key, i;
1613
+ for (i = 0; i < sourceKeys.length; i++) {
1614
+ key = sourceKeys[i];
1615
+ if (excluded.indexOf(key) >= 0)
1616
+ continue;
1617
+ target[key] = source[key];
1618
+ }
1619
+ return target;
1620
+ }
1621
+ var Dropzone = /* @__PURE__ */ forwardRef(function(_ref, ref) {
1622
+ var children = _ref.children, params = _objectWithoutProperties(_ref, _excluded);
1623
+ var _useDropzone = useDropzone(params), open = _useDropzone.open, props = _objectWithoutProperties(_useDropzone, _excluded2);
1624
+ useImperativeHandle(ref, function() {
1625
+ return {
1626
+ open
1627
+ };
1628
+ }, [open]);
1629
+ return /* @__PURE__ */ React__default.createElement(Fragment, null, children(_objectSpread(_objectSpread({}, props), {}, {
1630
+ open
1631
+ })));
1632
+ });
1633
+ Dropzone.displayName = "Dropzone";
1634
+ var defaultProps = {
1635
+ disabled: false,
1636
+ getFilesFromEvent: fromEvent,
1637
+ maxSize: Infinity,
1638
+ minSize: 0,
1639
+ multiple: true,
1640
+ maxFiles: 0,
1641
+ preventDropOnDocument: true,
1642
+ noClick: false,
1643
+ noKeyboard: false,
1644
+ noDrag: false,
1645
+ noDragEventsBubbling: false,
1646
+ validator: null,
1647
+ useFsAccessApi: true,
1648
+ autoFocus: false
1649
+ };
1650
+ Dropzone.defaultProps = defaultProps;
1651
+ Dropzone.propTypes = {
1652
+ /**
1653
+ * Render function that exposes the dropzone state and prop getter fns
1654
+ *
1655
+ * @param {object} params
1656
+ * @param {Function} params.getRootProps Returns the props you should apply to the root drop container you render
1657
+ * @param {Function} params.getInputProps Returns the props you should apply to hidden file input you render
1658
+ * @param {Function} params.open Open the native file selection dialog
1659
+ * @param {boolean} params.isFocused Dropzone area is in focus
1660
+ * @param {boolean} params.isFileDialogActive File dialog is opened
1661
+ * @param {boolean} params.isDragActive Active drag is in progress
1662
+ * @param {boolean} params.isDragAccept Dragged files are accepted
1663
+ * @param {boolean} params.isDragReject Some dragged files are rejected
1664
+ * @param {File[]} params.acceptedFiles Accepted files
1665
+ * @param {FileRejection[]} params.fileRejections Rejected files and why they were rejected
1666
+ */
1667
+ children: PropTypes.func,
1668
+ /**
1669
+ * Set accepted file types.
1670
+ * Checkout https://developer.mozilla.org/en-US/docs/Web/API/window/showOpenFilePicker types option for more information.
1671
+ * Keep in mind that mime type determination is not reliable across platforms. CSV files,
1672
+ * for example, are reported as text/plain under macOS but as application/vnd.ms-excel under
1673
+ * Windows. In some cases there might not be a mime type set at all (https://github.com/react-dropzone/react-dropzone/issues/276).
1674
+ */
1675
+ accept: PropTypes.objectOf(PropTypes.arrayOf(PropTypes.string)),
1676
+ /**
1677
+ * Allow drag 'n' drop (or selection from the file dialog) of multiple files
1678
+ */
1679
+ multiple: PropTypes.bool,
1680
+ /**
1681
+ * If false, allow dropped items to take over the current browser window
1682
+ */
1683
+ preventDropOnDocument: PropTypes.bool,
1684
+ /**
1685
+ * If true, disables click to open the native file selection dialog
1686
+ */
1687
+ noClick: PropTypes.bool,
1688
+ /**
1689
+ * If true, disables SPACE/ENTER to open the native file selection dialog.
1690
+ * Note that it also stops tracking the focus state.
1691
+ */
1692
+ noKeyboard: PropTypes.bool,
1693
+ /**
1694
+ * If true, disables drag 'n' drop
1695
+ */
1696
+ noDrag: PropTypes.bool,
1697
+ /**
1698
+ * If true, stops drag event propagation to parents
1699
+ */
1700
+ noDragEventsBubbling: PropTypes.bool,
1701
+ /**
1702
+ * Minimum file size (in bytes)
1703
+ */
1704
+ minSize: PropTypes.number,
1705
+ /**
1706
+ * Maximum file size (in bytes)
1707
+ */
1708
+ maxSize: PropTypes.number,
1709
+ /**
1710
+ * Maximum accepted number of files
1711
+ * The default value is 0 which means there is no limitation to how many files are accepted.
1712
+ */
1713
+ maxFiles: PropTypes.number,
1714
+ /**
1715
+ * Enable/disable the dropzone
1716
+ */
1717
+ disabled: PropTypes.bool,
1718
+ /**
1719
+ * Use this to provide a custom file aggregator
1720
+ *
1721
+ * @param {(DragEvent|Event)} event A drag event or input change event (if files were selected via the file dialog)
1722
+ */
1723
+ getFilesFromEvent: PropTypes.func,
1724
+ /**
1725
+ * Cb for when closing the file dialog with no selection
1726
+ */
1727
+ onFileDialogCancel: PropTypes.func,
1728
+ /**
1729
+ * Cb for when opening the file dialog
1730
+ */
1731
+ onFileDialogOpen: PropTypes.func,
1732
+ /**
1733
+ * Set to true to use the https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API
1734
+ * to open the file picker instead of using an `<input type="file">` click event.
1735
+ */
1736
+ useFsAccessApi: PropTypes.bool,
1737
+ /**
1738
+ * Set to true to focus the root element on render
1739
+ */
1740
+ autoFocus: PropTypes.bool,
1741
+ /**
1742
+ * Cb for when the `dragenter` event occurs.
1743
+ *
1744
+ * @param {DragEvent} event
1745
+ */
1746
+ onDragEnter: PropTypes.func,
1747
+ /**
1748
+ * Cb for when the `dragleave` event occurs
1749
+ *
1750
+ * @param {DragEvent} event
1751
+ */
1752
+ onDragLeave: PropTypes.func,
1753
+ /**
1754
+ * Cb for when the `dragover` event occurs
1755
+ *
1756
+ * @param {DragEvent} event
1757
+ */
1758
+ onDragOver: PropTypes.func,
1759
+ /**
1760
+ * Cb for when the `drop` event occurs.
1761
+ * Note that this callback is invoked after the `getFilesFromEvent` callback is done.
1762
+ *
1763
+ * Files are accepted or rejected based on the `accept`, `multiple`, `minSize` and `maxSize` props.
1764
+ * `accept` must be a valid [MIME type](http://www.iana.org/assignments/media-types/media-types.xhtml) according to [input element specification](https://www.w3.org/wiki/HTML/Elements/input/file) or a valid file extension.
1765
+ * If `multiple` is set to false and additional files are dropped,
1766
+ * all files besides the first will be rejected.
1767
+ * Any file which does not have a size in the [`minSize`, `maxSize`] range, will be rejected as well.
1768
+ *
1769
+ * Note that the `onDrop` callback will always be invoked regardless if the dropped files were accepted or rejected.
1770
+ * If you'd like to react to a specific scenario, use the `onDropAccepted`/`onDropRejected` props.
1771
+ *
1772
+ * `onDrop` will provide you with an array of [File](https://developer.mozilla.org/en-US/docs/Web/API/File) objects which you can then process and send to a server.
1773
+ * For example, with [SuperAgent](https://github.com/visionmedia/superagent) as a http/ajax library:
1774
+ *
1775
+ * ```js
1776
+ * function onDrop(acceptedFiles) {
1777
+ * const req = request.post('/upload')
1778
+ * acceptedFiles.forEach(file => {
1779
+ * req.attach(file.name, file)
1780
+ * })
1781
+ * req.end(callback)
1782
+ * }
1783
+ * ```
1784
+ *
1785
+ * @param {File[]} acceptedFiles
1786
+ * @param {FileRejection[]} fileRejections
1787
+ * @param {(DragEvent|Event)} event A drag event or input change event (if files were selected via the file dialog)
1788
+ */
1789
+ onDrop: PropTypes.func,
1790
+ /**
1791
+ * Cb for when the `drop` event occurs.
1792
+ * Note that if no files are accepted, this callback is not invoked.
1793
+ *
1794
+ * @param {File[]} files
1795
+ * @param {(DragEvent|Event)} event
1796
+ */
1797
+ onDropAccepted: PropTypes.func,
1798
+ /**
1799
+ * Cb for when the `drop` event occurs.
1800
+ * Note that if no files are rejected, this callback is not invoked.
1801
+ *
1802
+ * @param {FileRejection[]} fileRejections
1803
+ * @param {(DragEvent|Event)} event
1804
+ */
1805
+ onDropRejected: PropTypes.func,
1806
+ /**
1807
+ * Cb for when there's some error from any of the promises.
1808
+ *
1809
+ * @param {Error} error
1810
+ */
1811
+ onError: PropTypes.func,
1812
+ /**
1813
+ * Custom validation function. It must return null if there's no errors.
1814
+ * @param {File} file
1815
+ * @returns {FileError|FileError[]|null}
1816
+ */
1817
+ validator: PropTypes.func
1818
+ };
1819
+ var initialState = {
1820
+ isFocused: false,
1821
+ isFileDialogActive: false,
1822
+ isDragActive: false,
1823
+ isDragAccept: false,
1824
+ isDragReject: false,
1825
+ acceptedFiles: [],
1826
+ fileRejections: []
1827
+ };
1828
+ function useDropzone() {
1829
+ var props = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
1830
+ var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props), accept = _defaultProps$props.accept, disabled = _defaultProps$props.disabled, getFilesFromEvent = _defaultProps$props.getFilesFromEvent, maxSize = _defaultProps$props.maxSize, minSize = _defaultProps$props.minSize, multiple = _defaultProps$props.multiple, maxFiles = _defaultProps$props.maxFiles, onDragEnter = _defaultProps$props.onDragEnter, onDragLeave = _defaultProps$props.onDragLeave, onDragOver = _defaultProps$props.onDragOver, onDrop = _defaultProps$props.onDrop, onDropAccepted = _defaultProps$props.onDropAccepted, onDropRejected = _defaultProps$props.onDropRejected, onFileDialogCancel = _defaultProps$props.onFileDialogCancel, onFileDialogOpen = _defaultProps$props.onFileDialogOpen, useFsAccessApi = _defaultProps$props.useFsAccessApi, autoFocus = _defaultProps$props.autoFocus, preventDropOnDocument = _defaultProps$props.preventDropOnDocument, noClick = _defaultProps$props.noClick, noKeyboard = _defaultProps$props.noKeyboard, noDrag = _defaultProps$props.noDrag, noDragEventsBubbling = _defaultProps$props.noDragEventsBubbling, onError = _defaultProps$props.onError, validator = _defaultProps$props.validator;
1831
+ var acceptAttr = useMemo(function() {
1832
+ return acceptPropAsAcceptAttr(accept);
1833
+ }, [accept]);
1834
+ var pickerTypes = useMemo(function() {
1835
+ return pickerOptionsFromAccept(accept);
1836
+ }, [accept]);
1837
+ var onFileDialogOpenCb = useMemo(function() {
1838
+ return typeof onFileDialogOpen === "function" ? onFileDialogOpen : noop;
1839
+ }, [onFileDialogOpen]);
1840
+ var onFileDialogCancelCb = useMemo(function() {
1841
+ return typeof onFileDialogCancel === "function" ? onFileDialogCancel : noop;
1842
+ }, [onFileDialogCancel]);
1843
+ var rootRef = useRef(null);
1844
+ var inputRef = useRef(null);
1845
+ var _useReducer = useReducer(reducer, initialState), _useReducer2 = _slicedToArray(_useReducer, 2), state = _useReducer2[0], dispatch = _useReducer2[1];
1846
+ var isFocused = state.isFocused, isFileDialogActive = state.isFileDialogActive;
1847
+ var fsAccessApiWorksRef = useRef(typeof window !== "undefined" && window.isSecureContext && useFsAccessApi && canUseFileSystemAccessAPI());
1848
+ var onWindowFocus = function onWindowFocus2() {
1849
+ if (!fsAccessApiWorksRef.current && isFileDialogActive) {
1850
+ setTimeout(function() {
1851
+ if (inputRef.current) {
1852
+ var files = inputRef.current.files;
1853
+ if (!files.length) {
1854
+ dispatch({
1855
+ type: "closeDialog"
1856
+ });
1857
+ onFileDialogCancelCb();
1858
+ }
1859
+ }
1860
+ }, 300);
1861
+ }
1862
+ };
1863
+ useEffect(function() {
1864
+ window.addEventListener("focus", onWindowFocus, false);
1865
+ return function() {
1866
+ window.removeEventListener("focus", onWindowFocus, false);
1867
+ };
1868
+ }, [inputRef, isFileDialogActive, onFileDialogCancelCb, fsAccessApiWorksRef]);
1869
+ var dragTargetsRef = useRef([]);
1870
+ var onDocumentDrop = function onDocumentDrop2(event) {
1871
+ if (rootRef.current && rootRef.current.contains(event.target)) {
1872
+ return;
1873
+ }
1874
+ event.preventDefault();
1875
+ dragTargetsRef.current = [];
1876
+ };
1877
+ useEffect(function() {
1878
+ if (preventDropOnDocument) {
1879
+ document.addEventListener("dragover", onDocumentDragOver, false);
1880
+ document.addEventListener("drop", onDocumentDrop, false);
1881
+ }
1882
+ return function() {
1883
+ if (preventDropOnDocument) {
1884
+ document.removeEventListener("dragover", onDocumentDragOver);
1885
+ document.removeEventListener("drop", onDocumentDrop);
1886
+ }
1887
+ };
1888
+ }, [rootRef, preventDropOnDocument]);
1889
+ useEffect(function() {
1890
+ if (!disabled && autoFocus && rootRef.current) {
1891
+ rootRef.current.focus();
1892
+ }
1893
+ return function() {
1894
+ };
1895
+ }, [rootRef, autoFocus, disabled]);
1896
+ var onErrCb = useCallback(function(e) {
1897
+ if (onError) {
1898
+ onError(e);
1899
+ } else {
1900
+ console.error(e);
1901
+ }
1902
+ }, [onError]);
1903
+ var onDragEnterCb = useCallback(function(event) {
1904
+ event.preventDefault();
1905
+ event.persist();
1906
+ stopPropagation(event);
1907
+ dragTargetsRef.current = [].concat(_toConsumableArray(dragTargetsRef.current), [event.target]);
1908
+ if (isEvtWithFiles(event)) {
1909
+ Promise.resolve(getFilesFromEvent(event)).then(function(files) {
1910
+ if (isPropagationStopped(event) && !noDragEventsBubbling) {
1911
+ return;
1912
+ }
1913
+ var fileCount = files.length;
1914
+ var isDragAccept = fileCount > 0 && allFilesAccepted({
1915
+ files,
1916
+ accept: acceptAttr,
1917
+ minSize,
1918
+ maxSize,
1919
+ multiple,
1920
+ maxFiles,
1921
+ validator
1922
+ });
1923
+ var isDragReject = fileCount > 0 && !isDragAccept;
1924
+ dispatch({
1925
+ isDragAccept,
1926
+ isDragReject,
1927
+ isDragActive: true,
1928
+ type: "setDraggedFiles"
1929
+ });
1930
+ if (onDragEnter) {
1931
+ onDragEnter(event);
1932
+ }
1933
+ }).catch(function(e) {
1934
+ return onErrCb(e);
1935
+ });
1936
+ }
1937
+ }, [getFilesFromEvent, onDragEnter, onErrCb, noDragEventsBubbling, acceptAttr, minSize, maxSize, multiple, maxFiles, validator]);
1938
+ var onDragOverCb = useCallback(function(event) {
1939
+ event.preventDefault();
1940
+ event.persist();
1941
+ stopPropagation(event);
1942
+ var hasFiles = isEvtWithFiles(event);
1943
+ if (hasFiles && event.dataTransfer) {
1944
+ try {
1945
+ event.dataTransfer.dropEffect = "copy";
1946
+ } catch (_unused) {
1947
+ }
1948
+ }
1949
+ if (hasFiles && onDragOver) {
1950
+ onDragOver(event);
1951
+ }
1952
+ return false;
1953
+ }, [onDragOver, noDragEventsBubbling]);
1954
+ var onDragLeaveCb = useCallback(function(event) {
1955
+ event.preventDefault();
1956
+ event.persist();
1957
+ stopPropagation(event);
1958
+ var targets = dragTargetsRef.current.filter(function(target) {
1959
+ return rootRef.current && rootRef.current.contains(target);
1960
+ });
1961
+ var targetIdx = targets.indexOf(event.target);
1962
+ if (targetIdx !== -1) {
1963
+ targets.splice(targetIdx, 1);
1964
+ }
1965
+ dragTargetsRef.current = targets;
1966
+ if (targets.length > 0) {
1967
+ return;
1968
+ }
1969
+ dispatch({
1970
+ type: "setDraggedFiles",
1971
+ isDragActive: false,
1972
+ isDragAccept: false,
1973
+ isDragReject: false
1974
+ });
1975
+ if (isEvtWithFiles(event) && onDragLeave) {
1976
+ onDragLeave(event);
1977
+ }
1978
+ }, [rootRef, onDragLeave, noDragEventsBubbling]);
1979
+ var setFiles = useCallback(function(files, event) {
1980
+ var acceptedFiles = [];
1981
+ var fileRejections = [];
1982
+ files.forEach(function(file) {
1983
+ var _fileAccepted = fileAccepted(file, acceptAttr), _fileAccepted2 = _slicedToArray(_fileAccepted, 2), accepted = _fileAccepted2[0], acceptError = _fileAccepted2[1];
1984
+ var _fileMatchSize = fileMatchSize(file, minSize, maxSize), _fileMatchSize2 = _slicedToArray(_fileMatchSize, 2), sizeMatch = _fileMatchSize2[0], sizeError = _fileMatchSize2[1];
1985
+ var customErrors = validator ? validator(file) : null;
1986
+ if (accepted && sizeMatch && !customErrors) {
1987
+ acceptedFiles.push(file);
1988
+ } else {
1989
+ var errors = [acceptError, sizeError];
1990
+ if (customErrors) {
1991
+ errors = errors.concat(customErrors);
1992
+ }
1993
+ fileRejections.push({
1994
+ file,
1995
+ errors: errors.filter(function(e) {
1996
+ return e;
1997
+ })
1998
+ });
1999
+ }
2000
+ });
2001
+ if (!multiple && acceptedFiles.length > 1 || multiple && maxFiles >= 1 && acceptedFiles.length > maxFiles) {
2002
+ acceptedFiles.forEach(function(file) {
2003
+ fileRejections.push({
2004
+ file,
2005
+ errors: [TOO_MANY_FILES_REJECTION]
2006
+ });
2007
+ });
2008
+ acceptedFiles.splice(0);
2009
+ }
2010
+ dispatch({
2011
+ acceptedFiles,
2012
+ fileRejections,
2013
+ type: "setFiles"
2014
+ });
2015
+ if (onDrop) {
2016
+ onDrop(acceptedFiles, fileRejections, event);
2017
+ }
2018
+ if (fileRejections.length > 0 && onDropRejected) {
2019
+ onDropRejected(fileRejections, event);
2020
+ }
2021
+ if (acceptedFiles.length > 0 && onDropAccepted) {
2022
+ onDropAccepted(acceptedFiles, event);
2023
+ }
2024
+ }, [dispatch, multiple, acceptAttr, minSize, maxSize, maxFiles, onDrop, onDropAccepted, onDropRejected, validator]);
2025
+ var onDropCb = useCallback(function(event) {
2026
+ event.preventDefault();
2027
+ event.persist();
2028
+ stopPropagation(event);
2029
+ dragTargetsRef.current = [];
2030
+ if (isEvtWithFiles(event)) {
2031
+ Promise.resolve(getFilesFromEvent(event)).then(function(files) {
2032
+ if (isPropagationStopped(event) && !noDragEventsBubbling) {
2033
+ return;
2034
+ }
2035
+ setFiles(files, event);
2036
+ }).catch(function(e) {
2037
+ return onErrCb(e);
2038
+ });
2039
+ }
2040
+ dispatch({
2041
+ type: "reset"
2042
+ });
2043
+ }, [getFilesFromEvent, setFiles, onErrCb, noDragEventsBubbling]);
2044
+ var openFileDialog = useCallback(function() {
2045
+ if (fsAccessApiWorksRef.current) {
2046
+ dispatch({
2047
+ type: "openDialog"
2048
+ });
2049
+ onFileDialogOpenCb();
2050
+ var opts = {
2051
+ multiple,
2052
+ types: pickerTypes
2053
+ };
2054
+ window.showOpenFilePicker(opts).then(function(handles) {
2055
+ return getFilesFromEvent(handles);
2056
+ }).then(function(files) {
2057
+ setFiles(files, null);
2058
+ dispatch({
2059
+ type: "closeDialog"
2060
+ });
2061
+ }).catch(function(e) {
2062
+ if (isAbort(e)) {
2063
+ onFileDialogCancelCb(e);
2064
+ dispatch({
2065
+ type: "closeDialog"
2066
+ });
2067
+ } else if (isSecurityError(e)) {
2068
+ fsAccessApiWorksRef.current = false;
2069
+ if (inputRef.current) {
2070
+ inputRef.current.value = null;
2071
+ inputRef.current.click();
2072
+ } else {
2073
+ onErrCb(new Error("Cannot open the file picker because the https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API is not supported and no <input> was provided."));
2074
+ }
2075
+ } else {
2076
+ onErrCb(e);
2077
+ }
2078
+ });
2079
+ return;
2080
+ }
2081
+ if (inputRef.current) {
2082
+ dispatch({
2083
+ type: "openDialog"
2084
+ });
2085
+ onFileDialogOpenCb();
2086
+ inputRef.current.value = null;
2087
+ inputRef.current.click();
2088
+ }
2089
+ }, [dispatch, onFileDialogOpenCb, onFileDialogCancelCb, useFsAccessApi, setFiles, onErrCb, pickerTypes, multiple]);
2090
+ var onKeyDownCb = useCallback(function(event) {
2091
+ if (!rootRef.current || !rootRef.current.isEqualNode(event.target)) {
2092
+ return;
2093
+ }
2094
+ if (event.key === " " || event.key === "Enter" || event.keyCode === 32 || event.keyCode === 13) {
2095
+ event.preventDefault();
2096
+ openFileDialog();
2097
+ }
2098
+ }, [rootRef, openFileDialog]);
2099
+ var onFocusCb = useCallback(function() {
2100
+ dispatch({
2101
+ type: "focus"
2102
+ });
2103
+ }, []);
2104
+ var onBlurCb = useCallback(function() {
2105
+ dispatch({
2106
+ type: "blur"
2107
+ });
2108
+ }, []);
2109
+ var onClickCb = useCallback(function() {
2110
+ if (noClick) {
2111
+ return;
2112
+ }
2113
+ if (isIeOrEdge()) {
2114
+ setTimeout(openFileDialog, 0);
2115
+ } else {
2116
+ openFileDialog();
2117
+ }
2118
+ }, [noClick, openFileDialog]);
2119
+ var composeHandler = function composeHandler2(fn) {
2120
+ return disabled ? null : fn;
2121
+ };
2122
+ var composeKeyboardHandler = function composeKeyboardHandler2(fn) {
2123
+ return noKeyboard ? null : composeHandler(fn);
2124
+ };
2125
+ var composeDragHandler = function composeDragHandler2(fn) {
2126
+ return noDrag ? null : composeHandler(fn);
2127
+ };
2128
+ var stopPropagation = function stopPropagation2(event) {
2129
+ if (noDragEventsBubbling) {
2130
+ event.stopPropagation();
2131
+ }
2132
+ };
2133
+ var getRootProps = useMemo(function() {
2134
+ return function() {
2135
+ var _ref2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, _ref2$refKey = _ref2.refKey, refKey = _ref2$refKey === void 0 ? "ref" : _ref2$refKey, role = _ref2.role, onKeyDown = _ref2.onKeyDown, onFocus = _ref2.onFocus, onBlur = _ref2.onBlur, onClick = _ref2.onClick, onDragEnter2 = _ref2.onDragEnter, onDragOver2 = _ref2.onDragOver, onDragLeave2 = _ref2.onDragLeave, onDrop2 = _ref2.onDrop, rest = _objectWithoutProperties(_ref2, _excluded3);
2136
+ return _objectSpread(_objectSpread(_defineProperty({
2137
+ onKeyDown: composeKeyboardHandler(composeEventHandlers(onKeyDown, onKeyDownCb)),
2138
+ onFocus: composeKeyboardHandler(composeEventHandlers(onFocus, onFocusCb)),
2139
+ onBlur: composeKeyboardHandler(composeEventHandlers(onBlur, onBlurCb)),
2140
+ onClick: composeHandler(composeEventHandlers(onClick, onClickCb)),
2141
+ onDragEnter: composeDragHandler(composeEventHandlers(onDragEnter2, onDragEnterCb)),
2142
+ onDragOver: composeDragHandler(composeEventHandlers(onDragOver2, onDragOverCb)),
2143
+ onDragLeave: composeDragHandler(composeEventHandlers(onDragLeave2, onDragLeaveCb)),
2144
+ onDrop: composeDragHandler(composeEventHandlers(onDrop2, onDropCb)),
2145
+ role: typeof role === "string" && role !== "" ? role : "presentation"
2146
+ }, refKey, rootRef), !disabled && !noKeyboard ? {
2147
+ tabIndex: 0
2148
+ } : {}), rest);
2149
+ };
2150
+ }, [rootRef, onKeyDownCb, onFocusCb, onBlurCb, onClickCb, onDragEnterCb, onDragOverCb, onDragLeaveCb, onDropCb, noKeyboard, noDrag, disabled]);
2151
+ var onInputElementClick = useCallback(function(event) {
2152
+ event.stopPropagation();
2153
+ }, []);
2154
+ var getInputProps = useMemo(function() {
2155
+ return function() {
2156
+ var _ref3 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, _ref3$refKey = _ref3.refKey, refKey = _ref3$refKey === void 0 ? "ref" : _ref3$refKey, onChange = _ref3.onChange, onClick = _ref3.onClick, rest = _objectWithoutProperties(_ref3, _excluded4);
2157
+ var inputProps = _defineProperty({
2158
+ accept: acceptAttr,
2159
+ multiple,
2160
+ type: "file",
2161
+ style: {
2162
+ display: "none"
2163
+ },
2164
+ onChange: composeHandler(composeEventHandlers(onChange, onDropCb)),
2165
+ onClick: composeHandler(composeEventHandlers(onClick, onInputElementClick)),
2166
+ tabIndex: -1
2167
+ }, refKey, inputRef);
2168
+ return _objectSpread(_objectSpread({}, inputProps), rest);
2169
+ };
2170
+ }, [inputRef, accept, multiple, onDropCb, disabled]);
2171
+ return _objectSpread(_objectSpread({}, state), {}, {
2172
+ isFocused: isFocused && !disabled,
2173
+ getRootProps,
2174
+ getInputProps,
2175
+ rootRef,
2176
+ inputRef,
2177
+ open: composeHandler(openFileDialog)
2178
+ });
2179
+ }
2180
+ function reducer(state, action) {
2181
+ switch (action.type) {
2182
+ case "focus":
2183
+ return _objectSpread(_objectSpread({}, state), {}, {
2184
+ isFocused: true
2185
+ });
2186
+ case "blur":
2187
+ return _objectSpread(_objectSpread({}, state), {}, {
2188
+ isFocused: false
2189
+ });
2190
+ case "openDialog":
2191
+ return _objectSpread(_objectSpread({}, initialState), {}, {
2192
+ isFileDialogActive: true
2193
+ });
2194
+ case "closeDialog":
2195
+ return _objectSpread(_objectSpread({}, state), {}, {
2196
+ isFileDialogActive: false
2197
+ });
2198
+ case "setDraggedFiles":
2199
+ return _objectSpread(_objectSpread({}, state), {}, {
2200
+ isDragActive: action.isDragActive,
2201
+ isDragAccept: action.isDragAccept,
2202
+ isDragReject: action.isDragReject
2203
+ });
2204
+ case "setFiles":
2205
+ return _objectSpread(_objectSpread({}, state), {}, {
2206
+ acceptedFiles: action.acceptedFiles,
2207
+ fileRejections: action.fileRejections
2208
+ });
2209
+ case "reset":
2210
+ return _objectSpread({}, initialState);
2211
+ default:
2212
+ return state;
2213
+ }
2214
+ }
2215
+ function noop() {
2216
+ }
2217
+ export {
2218
+ useDropzone as u
2219
+ };
2220
+ //# sourceMappingURL=index-T0re1j1b.js.map