miolo 0.3.2 → 0.3.5

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 (31) hide show
  1. package/dist/cli/miolo.cli.iife.bundle.js +1 -1
  2. package/dist/cli/miolo.cli.iife.bundle.min.js +1 -1
  3. package/dist/cli/miolo.cli.iife.js +1 -1
  4. package/dist/cli/miolo.cli.iife.min.js +1 -1
  5. package/dist/cli/miolo.cli.min.mjs +1 -1
  6. package/dist/cli/miolo.cli.mjs +1 -1
  7. package/dist/cli/miolo.cli.umd.bundle.js +1 -1
  8. package/dist/cli/miolo.cli.umd.bundle.min.js +1 -1
  9. package/dist/cli/miolo.cli.umd.js +1 -1
  10. package/dist/cli/miolo.cli.umd.min.js +1 -1
  11. package/dist/cli-react/miolo.cli-react.iife.bundle.js +1670 -1677
  12. package/dist/cli-react/miolo.cli-react.iife.bundle.js.map +1 -1
  13. package/dist/cli-react/miolo.cli-react.iife.bundle.min.js +42 -49
  14. package/dist/cli-react/miolo.cli-react.iife.js +22 -11
  15. package/dist/cli-react/miolo.cli-react.iife.js.map +1 -1
  16. package/dist/cli-react/miolo.cli-react.iife.min.js +2 -2
  17. package/dist/cli-react/miolo.cli-react.min.mjs +2 -2
  18. package/dist/cli-react/miolo.cli-react.mjs +23 -9
  19. package/dist/cli-react/miolo.cli-react.mjs.map +1 -1
  20. package/dist/cli-react/miolo.cli-react.umd.bundle.js +1669 -1676
  21. package/dist/cli-react/miolo.cli-react.umd.bundle.js.map +1 -1
  22. package/dist/cli-react/miolo.cli-react.umd.bundle.min.js +42 -49
  23. package/dist/cli-react/miolo.cli-react.umd.js +24 -13
  24. package/dist/cli-react/miolo.cli-react.umd.js.map +1 -1
  25. package/dist/cli-react/miolo.cli-react.umd.min.js +2 -2
  26. package/dist/server/miolo.server.cjs +216 -265
  27. package/dist/server/miolo.server.min.mjs +2 -2
  28. package/dist/server/miolo.server.mjs +169 -227
  29. package/dist/server/miolo.server.mjs.map +1 -1
  30. package/dist/server/miolo.server.node.mjs +217 -265
  31. package/package.json +8 -9
@@ -1,5 +1,5 @@
1
1
  /**
2
- * miolo v0.3.2
2
+ * miolo v0.3.5
3
3
  *
4
4
  * Copyright (c) Donato Lorenzo <donato@afialapis.com>
5
5
  *
@@ -9,1683 +9,1676 @@
9
9
  * @license MIT
10
10
  */
11
11
  (function (global, factory) {
12
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
13
- typeof define === 'function' && define.amd ? define(['exports'], factory) :
14
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.miolo = {}));
12
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
13
+ typeof define === 'function' && define.amd ? define(['exports'], factory) :
14
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.miolo = {}));
15
15
  })(this, (function (exports) { 'use strict';
16
16
 
17
- function _mergeNamespaces(n, m) {
18
- m.forEach(function (e) {
19
- e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function (k) {
20
- if (k !== 'default' && !(k in n)) {
21
- var d = Object.getOwnPropertyDescriptor(e, k);
22
- Object.defineProperty(n, k, d.get ? d : {
23
- enumerable: true,
24
- get: function () { return e[k]; }
25
- });
26
- }
27
- });
28
- });
29
- return Object.freeze(n);
30
- }
31
-
32
- function getDefaultExportFromCjs (x) {
33
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
34
- }
35
-
36
- var reactExports = {};
37
- var react = {
38
- get exports(){ return reactExports; },
39
- set exports(v){ reactExports = v; },
40
- };
41
-
42
- var react_production_min = {};
43
-
44
- /*
45
- object-assign
46
- (c) Sindre Sorhus
47
- @license MIT
48
- */
49
- /* eslint-disable no-unused-vars */
50
- var getOwnPropertySymbols = Object.getOwnPropertySymbols;
51
- var hasOwnProperty = Object.prototype.hasOwnProperty;
52
- var propIsEnumerable = Object.prototype.propertyIsEnumerable;
53
-
54
- function toObject(val) {
55
- if (val === null || val === undefined) {
56
- throw new TypeError('Object.assign cannot be called with null or undefined');
57
- }
58
-
59
- return Object(val);
60
- }
61
-
62
- function shouldUseNative() {
63
- try {
64
- if (!Object.assign) {
65
- return false;
66
- }
67
-
68
- // Detect buggy property enumeration order in older V8 versions.
69
-
70
- // https://bugs.chromium.org/p/v8/issues/detail?id=4118
71
- var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
72
- test1[5] = 'de';
73
- if (Object.getOwnPropertyNames(test1)[0] === '5') {
74
- return false;
75
- }
76
-
77
- // https://bugs.chromium.org/p/v8/issues/detail?id=3056
78
- var test2 = {};
79
- for (var i = 0; i < 10; i++) {
80
- test2['_' + String.fromCharCode(i)] = i;
81
- }
82
- var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
83
- return test2[n];
84
- });
85
- if (order2.join('') !== '0123456789') {
86
- return false;
87
- }
88
-
89
- // https://bugs.chromium.org/p/v8/issues/detail?id=3056
90
- var test3 = {};
91
- 'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
92
- test3[letter] = letter;
93
- });
94
- if (Object.keys(Object.assign({}, test3)).join('') !==
95
- 'abcdefghijklmnopqrst') {
96
- return false;
97
- }
98
-
99
- return true;
100
- } catch (err) {
101
- // We don't expect any of the above to throw, but better to be safe.
102
- return false;
103
- }
104
- }
105
-
106
- var objectAssign = shouldUseNative() ? Object.assign : function (target, source) {
107
- var from;
108
- var to = toObject(target);
109
- var symbols;
110
-
111
- for (var s = 1; s < arguments.length; s++) {
112
- from = Object(arguments[s]);
113
-
114
- for (var key in from) {
115
- if (hasOwnProperty.call(from, key)) {
116
- to[key] = from[key];
117
- }
118
- }
119
-
120
- if (getOwnPropertySymbols) {
121
- symbols = getOwnPropertySymbols(from);
122
- for (var i = 0; i < symbols.length; i++) {
123
- if (propIsEnumerable.call(from, symbols[i])) {
124
- to[symbols[i]] = from[symbols[i]];
125
- }
126
- }
127
- }
128
- }
129
-
130
- return to;
131
- };
132
-
133
- /** @license React v17.0.2
134
- * react.production.min.js
135
- *
136
- * Copyright (c) Facebook, Inc. and its affiliates.
137
- *
138
- * This source code is licensed under the MIT license found in the
139
- * LICENSE file in the root directory of this source tree.
140
- */
141
- var l=objectAssign,n=60103,p=60106;react_production_min.Fragment=60107;react_production_min.StrictMode=60108;react_production_min.Profiler=60114;var q=60109,r=60110,t=60112;react_production_min.Suspense=60113;var u=60115,v=60116;
142
- if("function"===typeof Symbol&&Symbol.for){var w=Symbol.for;n=w("react.element");p=w("react.portal");react_production_min.Fragment=w("react.fragment");react_production_min.StrictMode=w("react.strict_mode");react_production_min.Profiler=w("react.profiler");q=w("react.provider");r=w("react.context");t=w("react.forward_ref");react_production_min.Suspense=w("react.suspense");u=w("react.memo");v=w("react.lazy");}var x="function"===typeof Symbol&&Symbol.iterator;
143
- 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."}
144
- 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");};
145
- 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;l(F,C.prototype);F.isPureReactComponent=!0;var G={current:null},H=Object.prototype.hasOwnProperty,I={key:!0,ref:!0,__self:!0,__source:!0};
146
- 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}}
147
- 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)}
148
- 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=
149
- 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}
150
- 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:l};
151
- react_production_min.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}};react_production_min.Component=C;react_production_min.PureComponent=E;react_production_min.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=T;
152
- react_production_min.cloneElement=function(a,b,c){if(null===a||void 0===a)throw Error(z(267,a));var e=l({},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,
153
- key:d,ref:k,props:e,_owner:h}};react_production_min.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};react_production_min.createElement=J;react_production_min.createFactory=function(a){var b=J.bind(null,a);b.type=a;return b};react_production_min.createRef=function(){return {current:null}};react_production_min.forwardRef=function(a){return {$$typeof:t,render:a}};react_production_min.isValidElement=L;
154
- react_production_min.lazy=function(a){return {$$typeof:v,_payload:{_status:-1,_result:a},_init:Q}};react_production_min.memo=function(a,b){return {$$typeof:u,type:a,compare:void 0===b?null:b}};react_production_min.useCallback=function(a,b){return S().useCallback(a,b)};react_production_min.useContext=function(a,b){return S().useContext(a,b)};react_production_min.useDebugValue=function(){};react_production_min.useEffect=function(a,b){return S().useEffect(a,b)};react_production_min.useImperativeHandle=function(a,b,c){return S().useImperativeHandle(a,b,c)};
155
- react_production_min.useLayoutEffect=function(a,b){return S().useLayoutEffect(a,b)};react_production_min.useMemo=function(a,b){return S().useMemo(a,b)};react_production_min.useReducer=function(a,b,c){return S().useReducer(a,b,c)};react_production_min.useRef=function(a){return S().useRef(a)};react_production_min.useState=function(a){return S().useState(a)};react_production_min.version="17.0.2";
156
-
157
- (function (module) {
158
-
159
- {
160
- module.exports = react_production_min;
161
- }
162
- } (react));
163
-
164
- var React = /*@__PURE__*/getDefaultExportFromCjs(reactExports);
165
-
166
- var React$1 = /*#__PURE__*/_mergeNamespaces({
167
- __proto__: null,
168
- default: React
169
- }, [reactExports]);
170
-
171
- var Context = /*#__PURE__*/React.createContext();
172
-
173
- function _regeneratorRuntime() {
174
- _regeneratorRuntime = function () {
175
- return exports;
176
- };
177
- var exports = {},
178
- Op = Object.prototype,
179
- hasOwn = Op.hasOwnProperty,
180
- defineProperty = Object.defineProperty || function (obj, key, desc) {
181
- obj[key] = desc.value;
182
- },
183
- $Symbol = "function" == typeof Symbol ? Symbol : {},
184
- iteratorSymbol = $Symbol.iterator || "@@iterator",
185
- asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
186
- toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
187
- function define(obj, key, value) {
188
- return Object.defineProperty(obj, key, {
189
- value: value,
190
- enumerable: !0,
191
- configurable: !0,
192
- writable: !0
193
- }), obj[key];
194
- }
195
- try {
196
- define({}, "");
197
- } catch (err) {
198
- define = function (obj, key, value) {
199
- return obj[key] = value;
200
- };
201
- }
202
- function wrap(innerFn, outerFn, self, tryLocsList) {
203
- var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
204
- generator = Object.create(protoGenerator.prototype),
205
- context = new Context(tryLocsList || []);
206
- return defineProperty(generator, "_invoke", {
207
- value: makeInvokeMethod(innerFn, self, context)
208
- }), generator;
209
- }
210
- function tryCatch(fn, obj, arg) {
211
- try {
212
- return {
213
- type: "normal",
214
- arg: fn.call(obj, arg)
215
- };
216
- } catch (err) {
217
- return {
218
- type: "throw",
219
- arg: err
220
- };
221
- }
222
- }
223
- exports.wrap = wrap;
224
- var ContinueSentinel = {};
225
- function Generator() {}
226
- function GeneratorFunction() {}
227
- function GeneratorFunctionPrototype() {}
228
- var IteratorPrototype = {};
229
- define(IteratorPrototype, iteratorSymbol, function () {
230
- return this;
231
- });
232
- var getProto = Object.getPrototypeOf,
233
- NativeIteratorPrototype = getProto && getProto(getProto(values([])));
234
- NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
235
- var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
236
- function defineIteratorMethods(prototype) {
237
- ["next", "throw", "return"].forEach(function (method) {
238
- define(prototype, method, function (arg) {
239
- return this._invoke(method, arg);
240
- });
241
- });
242
- }
243
- function AsyncIterator(generator, PromiseImpl) {
244
- function invoke(method, arg, resolve, reject) {
245
- var record = tryCatch(generator[method], generator, arg);
246
- if ("throw" !== record.type) {
247
- var result = record.arg,
248
- value = result.value;
249
- return value && "object" == typeof value && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
250
- invoke("next", value, resolve, reject);
251
- }, function (err) {
252
- invoke("throw", err, resolve, reject);
253
- }) : PromiseImpl.resolve(value).then(function (unwrapped) {
254
- result.value = unwrapped, resolve(result);
255
- }, function (error) {
256
- return invoke("throw", error, resolve, reject);
257
- });
258
- }
259
- reject(record.arg);
260
- }
261
- var previousPromise;
262
- defineProperty(this, "_invoke", {
263
- value: function (method, arg) {
264
- function callInvokeWithMethodAndArg() {
265
- return new PromiseImpl(function (resolve, reject) {
266
- invoke(method, arg, resolve, reject);
267
- });
268
- }
269
- return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
270
- }
271
- });
272
- }
273
- function makeInvokeMethod(innerFn, self, context) {
274
- var state = "suspendedStart";
275
- return function (method, arg) {
276
- if ("executing" === state) throw new Error("Generator is already running");
277
- if ("completed" === state) {
278
- if ("throw" === method) throw arg;
279
- return doneResult();
280
- }
281
- for (context.method = method, context.arg = arg;;) {
282
- var delegate = context.delegate;
283
- if (delegate) {
284
- var delegateResult = maybeInvokeDelegate(delegate, context);
285
- if (delegateResult) {
286
- if (delegateResult === ContinueSentinel) continue;
287
- return delegateResult;
288
- }
289
- }
290
- if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
291
- if ("suspendedStart" === state) throw state = "completed", context.arg;
292
- context.dispatchException(context.arg);
293
- } else "return" === context.method && context.abrupt("return", context.arg);
294
- state = "executing";
295
- var record = tryCatch(innerFn, self, context);
296
- if ("normal" === record.type) {
297
- if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
298
- return {
299
- value: record.arg,
300
- done: context.done
301
- };
302
- }
303
- "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
304
- }
305
- };
306
- }
307
- function maybeInvokeDelegate(delegate, context) {
308
- var methodName = context.method,
309
- method = delegate.iterator[methodName];
310
- if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel;
311
- var record = tryCatch(method, delegate.iterator, context.arg);
312
- if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
313
- var info = record.arg;
314
- return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel);
315
- }
316
- function pushTryEntry(locs) {
317
- var entry = {
318
- tryLoc: locs[0]
319
- };
320
- 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
321
- }
322
- function resetTryEntry(entry) {
323
- var record = entry.completion || {};
324
- record.type = "normal", delete record.arg, entry.completion = record;
325
- }
326
- function Context(tryLocsList) {
327
- this.tryEntries = [{
328
- tryLoc: "root"
329
- }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
330
- }
331
- function values(iterable) {
332
- if (iterable) {
333
- var iteratorMethod = iterable[iteratorSymbol];
334
- if (iteratorMethod) return iteratorMethod.call(iterable);
335
- if ("function" == typeof iterable.next) return iterable;
336
- if (!isNaN(iterable.length)) {
337
- var i = -1,
338
- next = function next() {
339
- for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
340
- return next.value = undefined, next.done = !0, next;
341
- };
342
- return next.next = next;
343
- }
344
- }
345
- return {
346
- next: doneResult
347
- };
348
- }
349
- function doneResult() {
350
- return {
351
- value: undefined,
352
- done: !0
353
- };
354
- }
355
- return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", {
356
- value: GeneratorFunctionPrototype,
357
- configurable: !0
358
- }), defineProperty(GeneratorFunctionPrototype, "constructor", {
359
- value: GeneratorFunction,
360
- configurable: !0
361
- }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
362
- var ctor = "function" == typeof genFun && genFun.constructor;
363
- return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
364
- }, exports.mark = function (genFun) {
365
- return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun;
366
- }, exports.awrap = function (arg) {
367
- return {
368
- __await: arg
369
- };
370
- }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
371
- return this;
372
- }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
373
- void 0 === PromiseImpl && (PromiseImpl = Promise);
374
- var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
375
- return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
376
- return result.done ? result.value : iter.next();
377
- });
378
- }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () {
379
- return this;
380
- }), define(Gp, "toString", function () {
381
- return "[object Generator]";
382
- }), exports.keys = function (val) {
383
- var object = Object(val),
384
- keys = [];
385
- for (var key in object) keys.push(key);
386
- return keys.reverse(), function next() {
387
- for (; keys.length;) {
388
- var key = keys.pop();
389
- if (key in object) return next.value = key, next.done = !1, next;
390
- }
391
- return next.done = !0, next;
392
- };
393
- }, exports.values = values, Context.prototype = {
394
- constructor: Context,
395
- reset: function (skipTempReset) {
396
- if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
397
- },
398
- stop: function () {
399
- this.done = !0;
400
- var rootRecord = this.tryEntries[0].completion;
401
- if ("throw" === rootRecord.type) throw rootRecord.arg;
402
- return this.rval;
403
- },
404
- dispatchException: function (exception) {
405
- if (this.done) throw exception;
406
- var context = this;
407
- function handle(loc, caught) {
408
- return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
409
- }
410
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
411
- var entry = this.tryEntries[i],
412
- record = entry.completion;
413
- if ("root" === entry.tryLoc) return handle("end");
414
- if (entry.tryLoc <= this.prev) {
415
- var hasCatch = hasOwn.call(entry, "catchLoc"),
416
- hasFinally = hasOwn.call(entry, "finallyLoc");
417
- if (hasCatch && hasFinally) {
418
- if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
419
- if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
420
- } else if (hasCatch) {
421
- if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
422
- } else {
423
- if (!hasFinally) throw new Error("try statement without catch or finally");
424
- if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
425
- }
426
- }
427
- }
428
- },
429
- abrupt: function (type, arg) {
430
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
431
- var entry = this.tryEntries[i];
432
- if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
433
- var finallyEntry = entry;
434
- break;
435
- }
436
- }
437
- finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
438
- var record = finallyEntry ? finallyEntry.completion : {};
439
- return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
440
- },
441
- complete: function (record, afterLoc) {
442
- if ("throw" === record.type) throw record.arg;
443
- return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel;
444
- },
445
- finish: function (finallyLoc) {
446
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
447
- var entry = this.tryEntries[i];
448
- if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
449
- }
450
- },
451
- catch: function (tryLoc) {
452
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
453
- var entry = this.tryEntries[i];
454
- if (entry.tryLoc === tryLoc) {
455
- var record = entry.completion;
456
- if ("throw" === record.type) {
457
- var thrown = record.arg;
458
- resetTryEntry(entry);
459
- }
460
- return thrown;
461
- }
462
- }
463
- throw new Error("illegal catch attempt");
464
- },
465
- delegateYield: function (iterable, resultName, nextLoc) {
466
- return this.delegate = {
467
- iterator: values(iterable),
468
- resultName: resultName,
469
- nextLoc: nextLoc
470
- }, "next" === this.method && (this.arg = undefined), ContinueSentinel;
471
- }
472
- }, exports;
473
- }
474
- function asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, key, arg) {
475
- try {
476
- var info = gen[key](arg);
477
- var value = info.value;
478
- } catch (error) {
479
- reject(error);
480
- return;
481
- }
482
- if (info.done) {
483
- resolve(value);
484
- } else {
485
- Promise.resolve(value).then(_next, _throw);
486
- }
487
- }
488
- function _asyncToGenerator$1(fn) {
489
- return function () {
490
- var self = this,
491
- args = arguments;
492
- return new Promise(function (resolve, reject) {
493
- var gen = fn.apply(self, args);
494
- function _next(value) {
495
- asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, "next", value);
496
- }
497
- function _throw(err) {
498
- asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, "throw", err);
499
- }
500
- _next(undefined);
501
- });
502
- };
503
- }
504
- function _extends$1() {
505
- _extends$1 = Object.assign ? Object.assign.bind() : function (target) {
506
- for (var i = 1; i < arguments.length; i++) {
507
- var source = arguments[i];
508
- for (var key in source) {
509
- if (Object.prototype.hasOwnProperty.call(source, key)) {
510
- target[key] = source[key];
511
- }
512
- }
513
- }
514
- return target;
515
- };
516
- return _extends$1.apply(this, arguments);
517
- }
518
-
519
- /* eslint react/display-name:0 */
520
- var withContext = function withContext(BaseComponent) {
521
- return function (props) {
522
- var _useContext = reactExports.useContext(Context),
523
- context = _useContext.context,
524
- setContext = _useContext.setContext;
525
- return /*#__PURE__*/React.createElement(BaseComponent, _extends$1({}, props, {
526
- context: context,
527
- setContext: setContext
528
- }));
529
- };
530
- };
531
-
532
- /**
533
- * calustra v0.9.0
534
- *
535
- * Copyright (c) Donato Lorenzo <donato@afialapis.com>
536
- *
537
- * This source code is licensed under the MIT license found in the
538
- * LICENSE.md file in the root directory of this source tree.
539
- *
540
- * @license MIT
541
- */
542
- function ownKeys(object, enumerableOnly) {
543
- var keys = Object.keys(object);
544
- if (Object.getOwnPropertySymbols) {
545
- var symbols = Object.getOwnPropertySymbols(object);
546
- enumerableOnly && (symbols = symbols.filter(function (sym) {
547
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
548
- })), keys.push.apply(keys, symbols);
549
- }
550
- return keys;
551
- }
552
- function _objectSpread2(target) {
553
- for (var i = 1; i < arguments.length; i++) {
554
- var source = null != arguments[i] ? arguments[i] : {};
555
- i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
556
- _defineProperty(target, key, source[key]);
557
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
558
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
559
- });
560
- }
561
- return target;
562
- }
563
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
564
- try {
565
- var info = gen[key](arg);
566
- var value = info.value;
567
- } catch (error) {
568
- reject(error);
569
- return;
570
- }
571
- if (info.done) {
572
- resolve(value);
573
- } else {
574
- Promise.resolve(value).then(_next, _throw);
575
- }
576
- }
577
- function _asyncToGenerator(fn) {
578
- return function () {
579
- var self = this,
580
- args = arguments;
581
- return new Promise(function (resolve, reject) {
582
- var gen = fn.apply(self, args);
583
- function _next(value) {
584
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
585
- }
586
- function _throw(err) {
587
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
588
- }
589
- _next(undefined);
590
- });
591
- };
592
- }
593
- function _defineProperty(obj, key, value) {
594
- key = _toPropertyKey(key);
595
- if (key in obj) {
596
- Object.defineProperty(obj, key, {
597
- value: value,
598
- enumerable: true,
599
- configurable: true,
600
- writable: true
601
- });
602
- } else {
603
- obj[key] = value;
604
- }
605
- return obj;
606
- }
607
- function _toPrimitive(input, hint) {
608
- if (typeof input !== "object" || input === null) return input;
609
- var prim = input[Symbol.toPrimitive];
610
- if (prim !== undefined) {
611
- var res = prim.call(input, hint || "default");
612
- if (typeof res !== "object") return res;
613
- throw new TypeError("@@toPrimitive must return a primitive value.");
614
- }
615
- return (hint === "string" ? String : Number)(input);
616
- }
617
- function _toPropertyKey(arg) {
618
- var key = _toPrimitive(arg, "string");
619
- return typeof key === "symbol" ? key : String(key);
620
- }
621
-
622
- /**
623
- * Transform an JSON object to a query string
624
- */
625
- function json_to_query_string(params) {
626
- return '?' + Object.keys(params).map(k => {
627
- var name = encodeURIComponent(k);
628
- if (Array.isArray(params[k])) {
629
- return params[k].map(val => "".concat(name, "[]=").concat(encodeURIComponent(val))).join('&');
630
- }
631
- return "".concat(name, "=").concat(encodeURIComponent(params[k]));
632
- }).join('&');
633
- }
634
- function trim_left(str, what) {
635
- return str.replace(new RegExp("^".concat(what || '\\s', "+")), '');
636
- }
637
- function omit_nil(obj) {
638
- if (typeof obj !== 'object') return obj;
639
- return Object.keys(obj).reduce((acc, v) => {
640
- if (obj[v] !== undefined) acc[v] = obj[v];
641
- return acc;
642
- }, {});
643
- }
644
-
645
- //function _is_browser() {
646
- // try {
647
- // return process.env.BROWSER==true
648
- // } catch(_) {
649
- // return false
650
- // }
651
- //}
652
-
653
- /**
654
- * Prepend host of API server
655
- */
656
- function _url_make(path) {
657
- if (path.indexOf('http') == 0) {
658
- return path;
659
- //} else if (_is_browser()) {
660
- // return '/' + trim_left(path, '/')
661
- //} else {
662
- // return `https://${location.host}/` + trim_left(path, '/')
663
- //}
664
- } else {
665
- return '/' + trim_left(path, '/');
666
- }
667
- }
668
-
669
- /**
670
- * Decide what to do with the response
671
- */
672
- function _response_handle(response) {
673
- if (response.redirected) {
674
- if (typeof window == 'object') {
675
- window.location.replace(response.url);
676
- }
677
- return Promise.resolve(response);
678
- }
679
- if (response.headers.get('content-type').indexOf('json') >= 0) {
680
- return response.json().then(res => {
681
- return {
682
- data: res,
683
- status: response.status
684
- };
685
- });
686
- }
687
- return response.text().then(text => {
688
- return {
689
- data: text,
690
- status: response.status
691
- };
692
- });
693
- }
694
-
695
- /**
696
- * Build and execute remote request
697
- */
698
- function calustra_fetch(method, url, params, isMultiForm, auth) {
699
- var requestURL = _url_make(url) + (method === 'GET' && params ? json_to_query_string(params) : '');
700
- var request = {
701
- method,
702
- mode: 'cors',
703
- credentials: 'include',
704
- headers: {
705
- 'content-type': 'application/json'
706
- }
707
- };
708
- if (auth) {
709
- request.headers['Authorization'] = 'Basic ' + Buffer.from(auth.username + ":" + auth.password).toString('base64');
710
- }
711
- if (method === 'POST') {
712
- if (isMultiForm) {
713
- var formData = new FormData();
714
- for (var name in params) {
715
- formData.append(name, params[name]);
716
- }
717
- request.body = formData;
718
- } else {
719
- request.body = JSON.stringify(params || {}, (k, v) => v === undefined ? null : v);
720
- }
721
- }
722
- return fetch(requestURL, request).then(_response_handle);
723
- }
724
-
725
- class Fetcher {
726
- constructor() {
727
- _defineProperty(this, "log_error", (msg, e) => {
728
- console.error(msg);
729
- console.error(e);
730
- });
731
- }
732
- get(url, params) {
733
- var _this = this;
734
- return _asyncToGenerator(function* () {
735
- /* eslint no-unused-vars:0 */
736
- try {
737
- var resp = yield calustra_fetch('GET', url, omit_nil(params));
738
- return resp;
739
- } catch (e) {
740
- _this.log_error("Error on GET ".concat(url), e);
741
- return {
742
- data: undefined,
743
- status: -1
744
- };
745
- }
746
- })();
747
- }
748
- post(url, data) {
749
- var _this2 = this;
750
- return _asyncToGenerator(function* () {
751
- try {
752
- var resp = yield calustra_fetch('POST', url, data, false);
753
- return resp;
754
- } catch (e) {
755
- _this2.log_error("Error on POST ".concat(url), e);
756
- return {
757
- data: undefined,
758
- status: -1
759
- };
760
- }
761
- })();
762
- }
763
- read(url, params) {
764
- var _this3 = this;
765
- return _asyncToGenerator(function* () {
766
- var result = yield _this3.get("".concat(url, "/read"), params);
767
- return result.data;
768
- })();
769
- }
770
- key_list(url, params) {
771
- var _this4 = this;
772
- return _asyncToGenerator(function* () {
773
- var result = yield _this4.get("".concat(url, "/key_list"), params);
774
- return result.data;
775
- })();
776
- }
777
- name_list(url, params) {
778
- var _this5 = this;
779
- return _asyncToGenerator(function* () {
780
- var result = yield _this5.key_list(url, params);
781
- return Object.values(result);
782
- })();
783
- }
784
- find(url, id) {
785
- var _this6 = this;
786
- return _asyncToGenerator(function* () {
787
- var result = yield _this6.get("".concat(url, "/find"), {
788
- id: id
789
- });
790
- return result.data;
791
- })();
792
- }
793
- distinct(url, field, params) {
794
- var _this7 = this;
795
- return _asyncToGenerator(function* () {
796
- var nparams = _objectSpread2(_objectSpread2({}, params), {}, {
797
- distinct_field: field
798
- });
799
- var result = yield _this7.get("".concat(url, "/distinct"), nparams);
800
- return result.data;
801
- })();
802
- }
803
- upsave(url, data) {
804
- var _this8 = this;
805
- return _asyncToGenerator(function* () {
806
- var result;
807
- if (data.id == undefined) {
808
- delete data.id;
809
- result = yield _this8.post("".concat(url, "/save"), data);
810
- } else {
811
- result = yield _this8.post("".concat(url, "/update"), data);
812
- }
813
- return result.data;
814
- })();
815
- }
816
- remove(url, id) {
817
- var _this9 = this;
818
- return _asyncToGenerator(function* () {
819
- var data = {
820
- id: id
821
- };
822
- var result = yield _this9.post("".concat(url, "/delete"), data);
823
- return result.data;
824
- })();
825
- }
826
- }
827
- Fetcher.keyList = Fetcher.key_list;
828
- Fetcher.nameList = Fetcher.name_list;
829
-
830
- var useFetcher = function useFetcher() {
831
- var fetcher = reactExports.useRef(new Fetcher());
832
- return fetcher.current;
833
- };
834
-
835
- /**
836
- * @remix-run/router v1.5.0
837
- *
838
- * Copyright (c) Remix Software Inc.
839
- *
840
- * This source code is licensed under the MIT license found in the
841
- * LICENSE.md file in the root directory of this source tree.
842
- *
843
- * @license MIT
844
- */
845
- function _extends() {
846
- _extends = Object.assign ? Object.assign.bind() : function (target) {
847
- for (var i = 1; i < arguments.length; i++) {
848
- var source = arguments[i];
849
-
850
- for (var key in source) {
851
- if (Object.prototype.hasOwnProperty.call(source, key)) {
852
- target[key] = source[key];
853
- }
854
- }
855
- }
856
-
857
- return target;
858
- };
859
- return _extends.apply(this, arguments);
860
- }
861
-
862
- ////////////////////////////////////////////////////////////////////////////////
863
- //#region Types and Constants
864
- ////////////////////////////////////////////////////////////////////////////////
865
-
866
- /**
867
- * Actions represent the type of change to a location value.
868
- */
869
- var Action;
870
-
871
- (function (Action) {
872
- /**
873
- * A POP indicates a change to an arbitrary index in the history stack, such
874
- * as a back or forward navigation. It does not describe the direction of the
875
- * navigation, only that the current index changed.
876
- *
877
- * Note: This is the default action for newly created history objects.
878
- */
879
- Action["Pop"] = "POP";
880
- /**
881
- * A PUSH indicates a new entry being added to the history stack, such as when
882
- * a link is clicked and a new page loads. When this happens, all subsequent
883
- * entries in the stack are lost.
884
- */
885
-
886
- Action["Push"] = "PUSH";
887
- /**
888
- * A REPLACE indicates the entry at the current index in the history stack
889
- * being replaced by a new one.
890
- */
891
-
892
- Action["Replace"] = "REPLACE";
893
- })(Action || (Action = {}));
894
-
895
- const PopStateEventType = "popstate";
896
- /**
897
- * Browser history stores the location in regular URLs. This is the standard for
898
- * most web apps, but it requires some configuration on the server to ensure you
899
- * serve the same app at multiple URLs.
900
- *
901
- * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#createbrowserhistory
902
- */
903
-
904
- function createBrowserHistory(options) {
905
- if (options === void 0) {
906
- options = {};
907
- }
908
-
909
- function createBrowserLocation(window, globalHistory) {
910
- let {
911
- pathname,
912
- search,
913
- hash
914
- } = window.location;
915
- return createLocation("", {
916
- pathname,
917
- search,
918
- hash
919
- }, // state defaults to `null` because `window.history.state` does
920
- globalHistory.state && globalHistory.state.usr || null, globalHistory.state && globalHistory.state.key || "default");
921
- }
922
-
923
- function createBrowserHref(window, to) {
924
- return typeof to === "string" ? to : createPath(to);
925
- }
926
-
927
- return getUrlBasedHistory(createBrowserLocation, createBrowserHref, null, options);
928
- }
929
- function invariant(value, message) {
930
- if (value === false || value === null || typeof value === "undefined") {
931
- throw new Error(message);
932
- }
933
- }
934
-
935
- function createKey() {
936
- return Math.random().toString(36).substr(2, 8);
937
- }
938
- /**
939
- * For browser-based histories, we combine the state and key into an object
940
- */
941
-
942
-
943
- function getHistoryState(location, index) {
944
- return {
945
- usr: location.state,
946
- key: location.key,
947
- idx: index
948
- };
949
- }
950
- /**
951
- * Creates a Location object with a unique key from the given Path
952
- */
953
-
954
-
955
- function createLocation(current, to, state, key) {
956
- if (state === void 0) {
957
- state = null;
958
- }
959
-
960
- let location = _extends({
961
- pathname: typeof current === "string" ? current : current.pathname,
962
- search: "",
963
- hash: ""
964
- }, typeof to === "string" ? parsePath(to) : to, {
965
- state,
966
- // TODO: This could be cleaned up. push/replace should probably just take
967
- // full Locations now and avoid the need to run through this flow at all
968
- // But that's a pretty big refactor to the current test suite so going to
969
- // keep as is for the time being and just let any incoming keys take precedence
970
- key: to && to.key || key || createKey()
971
- });
972
-
973
- return location;
974
- }
975
- /**
976
- * Creates a string URL path from the given pathname, search, and hash components.
977
- */
978
-
979
- function createPath(_ref) {
980
- let {
981
- pathname = "/",
982
- search = "",
983
- hash = ""
984
- } = _ref;
985
- if (search && search !== "?") pathname += search.charAt(0) === "?" ? search : "?" + search;
986
- if (hash && hash !== "#") pathname += hash.charAt(0) === "#" ? hash : "#" + hash;
987
- return pathname;
988
- }
989
- /**
990
- * Parses a string URL path into its separate pathname, search, and hash components.
991
- */
992
-
993
- function parsePath(path) {
994
- let parsedPath = {};
995
-
996
- if (path) {
997
- let hashIndex = path.indexOf("#");
998
-
999
- if (hashIndex >= 0) {
1000
- parsedPath.hash = path.substr(hashIndex);
1001
- path = path.substr(0, hashIndex);
1002
- }
1003
-
1004
- let searchIndex = path.indexOf("?");
1005
-
1006
- if (searchIndex >= 0) {
1007
- parsedPath.search = path.substr(searchIndex);
1008
- path = path.substr(0, searchIndex);
1009
- }
1010
-
1011
- if (path) {
1012
- parsedPath.pathname = path;
1013
- }
1014
- }
1015
-
1016
- return parsedPath;
1017
- }
1018
-
1019
- function getUrlBasedHistory(getLocation, createHref, validateLocation, options) {
1020
- if (options === void 0) {
1021
- options = {};
1022
- }
1023
-
1024
- let {
1025
- window = document.defaultView,
1026
- v5Compat = false
1027
- } = options;
1028
- let globalHistory = window.history;
1029
- let action = Action.Pop;
1030
- let listener = null;
1031
- let index = getIndex(); // Index should only be null when we initialize. If not, it's because the
1032
- // user called history.pushState or history.replaceState directly, in which
1033
- // case we should log a warning as it will result in bugs.
1034
-
1035
- if (index == null) {
1036
- index = 0;
1037
- globalHistory.replaceState(_extends({}, globalHistory.state, {
1038
- idx: index
1039
- }), "");
1040
- }
1041
-
1042
- function getIndex() {
1043
- let state = globalHistory.state || {
1044
- idx: null
1045
- };
1046
- return state.idx;
1047
- }
1048
-
1049
- function handlePop() {
1050
- action = Action.Pop;
1051
- let nextIndex = getIndex();
1052
- let delta = nextIndex == null ? null : nextIndex - index;
1053
- index = nextIndex;
1054
-
1055
- if (listener) {
1056
- listener({
1057
- action,
1058
- location: history.location,
1059
- delta
1060
- });
1061
- }
1062
- }
1063
-
1064
- function push(to, state) {
1065
- action = Action.Push;
1066
- let location = createLocation(history.location, to, state);
1067
- if (validateLocation) validateLocation(location, to);
1068
- index = getIndex() + 1;
1069
- let historyState = getHistoryState(location, index);
1070
- let url = history.createHref(location); // try...catch because iOS limits us to 100 pushState calls :/
1071
-
1072
- try {
1073
- globalHistory.pushState(historyState, "", url);
1074
- } catch (error) {
1075
- // They are going to lose state here, but there is no real
1076
- // way to warn them about it since the page will refresh...
1077
- window.location.assign(url);
1078
- }
1079
-
1080
- if (v5Compat && listener) {
1081
- listener({
1082
- action,
1083
- location: history.location,
1084
- delta: 1
1085
- });
1086
- }
1087
- }
1088
-
1089
- function replace(to, state) {
1090
- action = Action.Replace;
1091
- let location = createLocation(history.location, to, state);
1092
- if (validateLocation) validateLocation(location, to);
1093
- index = getIndex();
1094
- let historyState = getHistoryState(location, index);
1095
- let url = history.createHref(location);
1096
- globalHistory.replaceState(historyState, "", url);
1097
-
1098
- if (v5Compat && listener) {
1099
- listener({
1100
- action,
1101
- location: history.location,
1102
- delta: 0
1103
- });
1104
- }
1105
- }
1106
-
1107
- function createURL(to) {
1108
- // window.location.origin is "null" (the literal string value) in Firefox
1109
- // under certain conditions, notably when serving from a local HTML file
1110
- // See https://bugzilla.mozilla.org/show_bug.cgi?id=878297
1111
- let base = window.location.origin !== "null" ? window.location.origin : window.location.href;
1112
- let href = typeof to === "string" ? to : createPath(to);
1113
- invariant(base, "No window.location.(origin|href) available to create URL for href: " + href);
1114
- return new URL(href, base);
1115
- }
1116
-
1117
- let history = {
1118
- get action() {
1119
- return action;
1120
- },
1121
-
1122
- get location() {
1123
- return getLocation(window, globalHistory);
1124
- },
1125
-
1126
- listen(fn) {
1127
- if (listener) {
1128
- throw new Error("A history only accepts one active listener");
1129
- }
1130
-
1131
- window.addEventListener(PopStateEventType, handlePop);
1132
- listener = fn;
1133
- return () => {
1134
- window.removeEventListener(PopStateEventType, handlePop);
1135
- listener = null;
1136
- };
1137
- },
1138
-
1139
- createHref(to) {
1140
- return createHref(window, to);
1141
- },
1142
-
1143
- createURL,
1144
-
1145
- encodeLocation(to) {
1146
- // Encode a Location the same way window.location would
1147
- let url = createURL(to);
1148
- return {
1149
- pathname: url.pathname,
1150
- search: url.search,
1151
- hash: url.hash
1152
- };
1153
- },
1154
-
1155
- push,
1156
- replace,
1157
-
1158
- go(n) {
1159
- return globalHistory.go(n);
1160
- }
1161
-
1162
- };
1163
- return history;
1164
- } //#endregion
1165
-
1166
- var ResultType;
1167
-
1168
- (function (ResultType) {
1169
- ResultType["data"] = "data";
1170
- ResultType["deferred"] = "deferred";
1171
- ResultType["redirect"] = "redirect";
1172
- ResultType["error"] = "error";
1173
- })(ResultType || (ResultType = {}));
1174
- /**
1175
- * @private
1176
- */
1177
-
1178
-
1179
- function stripBasename(pathname, basename) {
1180
- if (basename === "/") return pathname;
1181
-
1182
- if (!pathname.toLowerCase().startsWith(basename.toLowerCase())) {
1183
- return null;
1184
- } // We want to leave trailing slash behavior in the user's control, so if they
1185
- // specify a basename with a trailing slash, we should support it
1186
-
1187
-
1188
- let startIndex = basename.endsWith("/") ? basename.length - 1 : basename.length;
1189
- let nextChar = pathname.charAt(startIndex);
1190
-
1191
- if (nextChar && nextChar !== "/") {
1192
- // pathname does not start with basename/
1193
- return null;
1194
- }
1195
-
1196
- return pathname.slice(startIndex) || "/";
1197
- }
1198
-
1199
- /**
1200
- * React Router v6.10.0
1201
- *
1202
- * Copyright (c) Remix Software Inc.
1203
- *
1204
- * This source code is licensed under the MIT license found in the
1205
- * LICENSE.md file in the root directory of this source tree.
1206
- *
1207
- * @license MIT
1208
- */
1209
-
1210
- /**
1211
- * Copyright (c) Facebook, Inc. and its affiliates.
1212
- *
1213
- * This source code is licensed under the MIT license found in the
1214
- * LICENSE file in the root directory of this source tree.
1215
- */
1216
- /**
1217
- * inlined Object.is polyfill to avoid requiring consumers ship their own
1218
- * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
1219
- */
1220
-
1221
- function isPolyfill(x, y) {
1222
- return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y // eslint-disable-line no-self-compare
1223
- ;
1224
- }
1225
-
1226
- const is = typeof Object.is === "function" ? Object.is : isPolyfill; // Intentionally not using named imports because Rollup uses dynamic
1227
- // dispatch for CommonJS interop named imports.
1228
-
1229
- const {
1230
- useState,
1231
- useEffect,
1232
- useLayoutEffect,
1233
- useDebugValue
1234
- } = React$1;
1235
- // because of a very particular set of implementation details and assumptions
1236
- // -- change any one of them and it will break. The most important assumption
1237
- // is that updates are always synchronous, because concurrent rendering is
1238
- // only available in versions of React that also have a built-in
1239
- // useSyncExternalStore API. And we only use this shim when the built-in API
1240
- // does not exist.
1241
- //
1242
- // Do not assume that the clever hacks used by this hook also work in general.
1243
- // The point of this shim is to replace the need for hacks by other libraries.
1244
-
1245
- function useSyncExternalStore$2(subscribe, getSnapshot, // Note: The shim does not use getServerSnapshot, because pre-18 versions of
1246
- // React do not expose a way to check if we're hydrating. So users of the shim
1247
- // will need to track that themselves and return the correct value
1248
- // from `getSnapshot`.
1249
- getServerSnapshot) {
1250
- // breaks the rules of React, and only works here because of specific
1251
- // implementation details, most importantly that updates are
1252
- // always synchronous.
1253
-
1254
-
1255
- const value = getSnapshot();
1256
- // re-render whenever the subscribed state changes by updating an some
1257
- // arbitrary useState hook. Then, during render, we call getSnapshot to read
1258
- // the current value.
1259
- //
1260
- // Because we don't actually use the state returned by the useState hook, we
1261
- // can save a bit of memory by storing other stuff in that slot.
1262
- //
1263
- // To implement the early bailout, we need to track some things on a mutable
1264
- // object. Usually, we would put that in a useRef hook, but we can stash it in
1265
- // our useState hook instead.
1266
- //
1267
- // To force a re-render, we call forceUpdate({inst}). That works because the
1268
- // new object always fails an equality check.
1269
-
1270
-
1271
- const [{
1272
- inst
1273
- }, forceUpdate] = useState({
1274
- inst: {
1275
- value,
1276
- getSnapshot
1277
- }
1278
- }); // Track the latest getSnapshot function with a ref. This needs to be updated
1279
- // in the layout phase so we can access it during the tearing check that
1280
- // happens on subscribe.
1281
-
1282
- useLayoutEffect(() => {
1283
- inst.value = value;
1284
- inst.getSnapshot = getSnapshot; // Whenever getSnapshot or subscribe changes, we need to check in the
1285
- // commit phase if there was an interleaved mutation. In concurrent mode
1286
- // this can happen all the time, but even in synchronous mode, an earlier
1287
- // effect may have mutated the store.
1288
-
1289
- if (checkIfSnapshotChanged(inst)) {
1290
- // Force a re-render.
1291
- forceUpdate({
1292
- inst
1293
- });
1294
- } // eslint-disable-next-line react-hooks/exhaustive-deps
1295
-
1296
- }, [subscribe, value, getSnapshot]);
1297
- useEffect(() => {
1298
- // Check for changes right before subscribing. Subsequent changes will be
1299
- // detected in the subscription handler.
1300
- if (checkIfSnapshotChanged(inst)) {
1301
- // Force a re-render.
1302
- forceUpdate({
1303
- inst
1304
- });
1305
- }
1306
-
1307
- const handleStoreChange = () => {
1308
- // TODO: Because there is no cross-renderer API for batching updates, it's
1309
- // up to the consumer of this library to wrap their subscription event
1310
- // with unstable_batchedUpdates. Should we try to detect when this isn't
1311
- // the case and print a warning in development?
1312
- // The store changed. Check if the snapshot changed since the last time we
1313
- // read from the store.
1314
- if (checkIfSnapshotChanged(inst)) {
1315
- // Force a re-render.
1316
- forceUpdate({
1317
- inst
1318
- });
1319
- }
1320
- }; // Subscribe to the store and return a clean-up function.
1321
-
1322
-
1323
- return subscribe(handleStoreChange); // eslint-disable-next-line react-hooks/exhaustive-deps
1324
- }, [subscribe]);
1325
- useDebugValue(value);
1326
- return value;
1327
- }
1328
-
1329
- function checkIfSnapshotChanged(inst) {
1330
- const latestGetSnapshot = inst.getSnapshot;
1331
- const prevValue = inst.value;
1332
-
1333
- try {
1334
- const nextValue = latestGetSnapshot();
1335
- return !is(prevValue, nextValue);
1336
- } catch (error) {
1337
- return true;
1338
- }
1339
- }
1340
-
1341
- /**
1342
- * Copyright (c) Facebook, Inc. and its affiliates.
1343
- *
1344
- * This source code is licensed under the MIT license found in the
1345
- * LICENSE file in the root directory of this source tree.
1346
- *
1347
- * @flow
1348
- */
1349
- function useSyncExternalStore$1(subscribe, getSnapshot, getServerSnapshot) {
1350
- // Note: The shim does not use getServerSnapshot, because pre-18 versions of
1351
- // React do not expose a way to check if we're hydrating. So users of the shim
1352
- // will need to track that themselves and return the correct value
1353
- // from `getSnapshot`.
1354
- return getSnapshot();
1355
- }
1356
-
1357
- /**
1358
- * Inlined into the react-router repo since use-sync-external-store does not
1359
- * provide a UMD-compatible package, so we need this to be able to distribute
1360
- * UMD react-router bundles
1361
- */
1362
- const canUseDOM = !!(typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined");
1363
- const isServerEnvironment = !canUseDOM;
1364
- const shim = isServerEnvironment ? useSyncExternalStore$1 : useSyncExternalStore$2;
1365
- "useSyncExternalStore" in React$1 ? (module => module.useSyncExternalStore)(React$1) : shim;
1366
-
1367
- const NavigationContext = /*#__PURE__*/reactExports.createContext(null);
1368
-
1369
- const LocationContext = /*#__PURE__*/reactExports.createContext(null);
1370
- /**
1371
- * Returns true if this component is a descendant of a <Router>.
1372
- *
1373
- * @see https://reactrouter.com/hooks/use-in-router-context
1374
- */
1375
-
1376
- function useInRouterContext() {
1377
- return reactExports.useContext(LocationContext) != null;
1378
- }
1379
- var DataRouterHook$1;
1380
-
1381
- (function (DataRouterHook) {
1382
- DataRouterHook["UseBlocker"] = "useBlocker";
1383
- DataRouterHook["UseRevalidator"] = "useRevalidator";
1384
- })(DataRouterHook$1 || (DataRouterHook$1 = {}));
1385
-
1386
- var DataRouterStateHook$1;
1387
-
1388
- (function (DataRouterStateHook) {
1389
- DataRouterStateHook["UseBlocker"] = "useBlocker";
1390
- DataRouterStateHook["UseLoaderData"] = "useLoaderData";
1391
- DataRouterStateHook["UseActionData"] = "useActionData";
1392
- DataRouterStateHook["UseRouteError"] = "useRouteError";
1393
- DataRouterStateHook["UseNavigation"] = "useNavigation";
1394
- DataRouterStateHook["UseRouteLoaderData"] = "useRouteLoaderData";
1395
- DataRouterStateHook["UseMatches"] = "useMatches";
1396
- DataRouterStateHook["UseRevalidator"] = "useRevalidator";
1397
- })(DataRouterStateHook$1 || (DataRouterStateHook$1 = {}));
1398
-
1399
- /**
1400
- * Provides location context for the rest of the app.
1401
- *
1402
- * Note: You usually won't render a <Router> directly. Instead, you'll render a
1403
- * router that is more specific to your environment such as a <BrowserRouter>
1404
- * in web browsers or a <StaticRouter> for server rendering.
1405
- *
1406
- * @see https://reactrouter.com/router-components/router
1407
- */
1408
- function Router(_ref4) {
1409
- let {
1410
- basename: basenameProp = "/",
1411
- children = null,
1412
- location: locationProp,
1413
- navigationType = Action.Pop,
1414
- navigator,
1415
- static: staticProp = false
1416
- } = _ref4;
1417
- !!useInRouterContext() ? invariant(false) : void 0; // Preserve trailing slashes on basename, so we can let the user control
1418
- // the enforcement of trailing slashes throughout the app
1419
-
1420
- let basename = basenameProp.replace(/^\/*/, "/");
1421
- let navigationContext = reactExports.useMemo(() => ({
1422
- basename,
1423
- navigator,
1424
- static: staticProp
1425
- }), [basename, navigator, staticProp]);
1426
-
1427
- if (typeof locationProp === "string") {
1428
- locationProp = parsePath(locationProp);
1429
- }
1430
-
1431
- let {
1432
- pathname = "/",
1433
- search = "",
1434
- hash = "",
1435
- state = null,
1436
- key = "default"
1437
- } = locationProp;
1438
- let locationContext = reactExports.useMemo(() => {
1439
- let trailingPathname = stripBasename(pathname, basename);
1440
-
1441
- if (trailingPathname == null) {
1442
- return null;
1443
- }
1444
-
1445
- return {
1446
- location: {
1447
- pathname: trailingPathname,
1448
- search,
1449
- hash,
1450
- state,
1451
- key
1452
- },
1453
- navigationType
1454
- };
1455
- }, [basename, pathname, search, hash, state, key, navigationType]);
1456
-
1457
- if (locationContext == null) {
1458
- return null;
1459
- }
1460
-
1461
- return /*#__PURE__*/reactExports.createElement(NavigationContext.Provider, {
1462
- value: navigationContext
1463
- }, /*#__PURE__*/reactExports.createElement(LocationContext.Provider, {
1464
- children: children,
1465
- value: locationContext
1466
- }));
1467
- }
1468
- var AwaitRenderStatus;
1469
-
1470
- (function (AwaitRenderStatus) {
1471
- AwaitRenderStatus[AwaitRenderStatus["pending"] = 0] = "pending";
1472
- AwaitRenderStatus[AwaitRenderStatus["success"] = 1] = "success";
1473
- AwaitRenderStatus[AwaitRenderStatus["error"] = 2] = "error";
1474
- })(AwaitRenderStatus || (AwaitRenderStatus = {}));
1475
-
1476
- new Promise(() => {});
1477
-
1478
- /**
1479
- * React Router DOM v6.10.0
1480
- *
1481
- * Copyright (c) Remix Software Inc.
1482
- *
1483
- * This source code is licensed under the MIT license found in the
1484
- * LICENSE.md file in the root directory of this source tree.
1485
- *
1486
- * @license MIT
1487
- */
1488
- /**
1489
- * A `<Router>` for use in web browsers. Provides the cleanest URLs.
1490
- */
1491
-
1492
-
1493
- function BrowserRouter(_ref) {
1494
- let {
1495
- basename,
1496
- children,
1497
- window
1498
- } = _ref;
1499
- let historyRef = reactExports.useRef();
1500
-
1501
- if (historyRef.current == null) {
1502
- historyRef.current = createBrowserHistory({
1503
- window,
1504
- v5Compat: true
1505
- });
1506
- }
1507
-
1508
- let history = historyRef.current;
1509
- let [state, setState] = reactExports.useState({
1510
- action: history.action,
1511
- location: history.location
1512
- });
1513
- reactExports.useLayoutEffect(() => history.listen(setState), [history]);
1514
- return /*#__PURE__*/reactExports.createElement(Router, {
1515
- basename: basename,
1516
- children: children,
1517
- location: state.location,
1518
- navigationType: state.action,
1519
- navigator: history
1520
- });
1521
- }
1522
- ////////////////////////////////////////////////////////////////////////////////
1523
- //#region Hooks
1524
- ////////////////////////////////////////////////////////////////////////////////
1525
-
1526
-
1527
- var DataRouterHook;
1528
-
1529
- (function (DataRouterHook) {
1530
- DataRouterHook["UseScrollRestoration"] = "useScrollRestoration";
1531
- DataRouterHook["UseSubmitImpl"] = "useSubmitImpl";
1532
- DataRouterHook["UseFetcher"] = "useFetcher";
1533
- })(DataRouterHook || (DataRouterHook = {}));
1534
-
1535
- var DataRouterStateHook;
1536
-
1537
- (function (DataRouterStateHook) {
1538
- DataRouterStateHook["UseFetchers"] = "useFetchers";
1539
- DataRouterStateHook["UseScrollRestoration"] = "useScrollRestoration";
1540
- })(DataRouterStateHook || (DataRouterStateHook = {}));
1541
-
1542
- var AppContext = function AppContext(_ref) {
1543
- var context = _ref.context,
1544
- children = _ref.children;
1545
- var _useState = reactExports.useState(context),
1546
- innerContext = _useState[0],
1547
- setInnerContext = _useState[1];
1548
- reactExports.useEffect(function () {
1549
- setInnerContext(context);
1550
- }, [context]);
1551
- return /*#__PURE__*/React.createElement(Context.Provider, {
1552
- value: {
1553
- context: innerContext,
1554
- setContext: setInnerContext
1555
- }
1556
- }, children);
1557
- };
1558
-
1559
- var _DEF_CATCHER_URL = '/sys/jserror';
1560
- function mioloCatcher(catcher_url) {
1561
- window.onerror = function (msg, file, line, col, error) {
1562
- try {
1563
- var params = {
1564
- 'error': {
1565
- msg: msg,
1566
- file: file,
1567
- line: line,
1568
- col: col,
1569
- error: error
1570
- },
1571
- 'path': window.location.pathname,
1572
- 'agent': 'UserAgent' + navigator.userAgent
1573
- };
1574
- var body = JSON.stringify(params || {}, function (k, v) {
1575
- return v === undefined ? null : v;
1576
- });
1577
- var request = {
1578
- method: 'POST',
1579
- mode: 'cors',
1580
- credentials: 'include',
1581
- headers: {
1582
- 'content-type': 'application/json'
1583
- },
1584
- body: body
1585
- };
1586
- fetch(catcher_url || _DEF_CATCHER_URL, request);
1587
- } catch (e) {
1588
- console.error(e);
1589
- }
1590
- };
1591
- }
1592
-
1593
- var AppBrowser = function AppBrowser(_ref) {
1594
- var children = _ref.children;
1595
- mioloCatcher();
1596
- return /*#__PURE__*/React.createElement(BrowserRouter, null, /*#__PURE__*/React.createElement(AppContext, {
1597
- context: window.__CONTEXT || {}
1598
- }, children));
1599
- };
1600
-
1601
- var _getDataFromWindow = function _getDataFromWindow(name) {
1602
- try {
1603
- if (window != undefined) {
1604
- var ssr_data = window.__CONTEXT.ssr_data;
1605
- if (ssr_data != undefined) {
1606
- if (ssr_data[name] != undefined) {
1607
- return ssr_data[name];
1608
- }
1609
- }
1610
- }
1611
- } catch (e) {}
1612
- return undefined;
1613
- };
1614
- var getSsrDataFromContext = function getSsrDataFromContext(context, name) {
1615
- var data = undefined;
1616
- if ((context == null ? void 0 : context.ssr_data) != undefined && (context == null ? void 0 : context.ssr_data[name]) != undefined) {
1617
- data = context.ssr_data[name];
1618
- } else {
1619
- var wdata = _getDataFromWindow(name);
1620
- if (wdata != undefined) {
1621
- data = wdata;
1622
- }
1623
- }
1624
- return data;
1625
- };
1626
-
1627
- var useSsrData = function useSsrData(context, name, defval) {
1628
- var ssrDataFromContext = getSsrDataFromContext(context, name);
1629
- var _useState = reactExports.useState(ssrDataFromContext != undefined ? ssrDataFromContext : defval),
1630
- ssrData = _useState[0],
1631
- setSsrData = _useState[1];
1632
- return [ssrData, setSsrData];
1633
- };
1634
-
1635
- var useSsrDataOrReload = function useSsrDataOrReload(context, name, defval, loader) {
1636
- var ssrDataFromContext = getSsrDataFromContext(context, name);
1637
- var _useState = reactExports.useState(ssrDataFromContext != undefined ? ssrDataFromContext : defval),
1638
- ssrData = _useState[0],
1639
- setSsrData = _useState[1];
1640
- var _useState2 = reactExports.useState(ssrDataFromContext == undefined),
1641
- needToRefresh = _useState2[0],
1642
- setNeedToRefresh = _useState2[1];
1643
- var refreshSsrData = reactExports.useCallback(function () {
1644
- function fetchData() {
1645
- return _fetchData.apply(this, arguments);
1646
- }
1647
- function _fetchData() {
1648
- _fetchData = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
1649
- var nSsrData;
1650
- return _regeneratorRuntime().wrap(function _callee$(_context) {
1651
- while (1) switch (_context.prev = _context.next) {
1652
- case 0:
1653
- if (!(loader != undefined)) {
1654
- _context.next = 5;
1655
- break;
1656
- }
1657
- _context.next = 3;
1658
- return loader();
1659
- case 3:
1660
- nSsrData = _context.sent;
1661
- setSsrData(nSsrData);
1662
- case 5:
1663
- case "end":
1664
- return _context.stop();
1665
- }
1666
- }, _callee);
1667
- }));
1668
- return _fetchData.apply(this, arguments);
1669
- }
1670
- fetchData();
1671
- }, [loader]);
1672
- reactExports.useEffect(function () {
1673
- try {
1674
- if (needToRefresh) {
1675
- setNeedToRefresh(false);
1676
- refreshSsrData();
1677
- }
1678
- } catch (e) {}
1679
- }, [needToRefresh, refreshSsrData]);
1680
- return [ssrData, setSsrData, refreshSsrData];
1681
- };
1682
-
1683
- exports.AppBrowser = AppBrowser;
1684
- exports.Context = Context;
1685
- exports.useFetcher = useFetcher;
1686
- exports.useSsrData = useSsrData;
1687
- exports.useSsrDataOrReload = useSsrDataOrReload;
1688
- exports.withContext = withContext;
17
+ function _mergeNamespaces(n, m) {
18
+ m.forEach(function (e) {
19
+ e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function (k) {
20
+ if (k !== 'default' && !(k in n)) {
21
+ var d = Object.getOwnPropertyDescriptor(e, k);
22
+ Object.defineProperty(n, k, d.get ? d : {
23
+ enumerable: true,
24
+ get: function () { return e[k]; }
25
+ });
26
+ }
27
+ });
28
+ });
29
+ return Object.freeze(n);
30
+ }
31
+
32
+ function _regeneratorRuntime() {
33
+ _regeneratorRuntime = function () {
34
+ return exports;
35
+ };
36
+ var exports = {},
37
+ Op = Object.prototype,
38
+ hasOwn = Op.hasOwnProperty,
39
+ defineProperty = Object.defineProperty || function (obj, key, desc) {
40
+ obj[key] = desc.value;
41
+ },
42
+ $Symbol = "function" == typeof Symbol ? Symbol : {},
43
+ iteratorSymbol = $Symbol.iterator || "@@iterator",
44
+ asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
45
+ toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
46
+ function define(obj, key, value) {
47
+ return Object.defineProperty(obj, key, {
48
+ value: value,
49
+ enumerable: !0,
50
+ configurable: !0,
51
+ writable: !0
52
+ }), obj[key];
53
+ }
54
+ try {
55
+ define({}, "");
56
+ } catch (err) {
57
+ define = function (obj, key, value) {
58
+ return obj[key] = value;
59
+ };
60
+ }
61
+ function wrap(innerFn, outerFn, self, tryLocsList) {
62
+ var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
63
+ generator = Object.create(protoGenerator.prototype),
64
+ context = new Context(tryLocsList || []);
65
+ return defineProperty(generator, "_invoke", {
66
+ value: makeInvokeMethod(innerFn, self, context)
67
+ }), generator;
68
+ }
69
+ function tryCatch(fn, obj, arg) {
70
+ try {
71
+ return {
72
+ type: "normal",
73
+ arg: fn.call(obj, arg)
74
+ };
75
+ } catch (err) {
76
+ return {
77
+ type: "throw",
78
+ arg: err
79
+ };
80
+ }
81
+ }
82
+ exports.wrap = wrap;
83
+ var ContinueSentinel = {};
84
+ function Generator() {}
85
+ function GeneratorFunction() {}
86
+ function GeneratorFunctionPrototype() {}
87
+ var IteratorPrototype = {};
88
+ define(IteratorPrototype, iteratorSymbol, function () {
89
+ return this;
90
+ });
91
+ var getProto = Object.getPrototypeOf,
92
+ NativeIteratorPrototype = getProto && getProto(getProto(values([])));
93
+ NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
94
+ var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
95
+ function defineIteratorMethods(prototype) {
96
+ ["next", "throw", "return"].forEach(function (method) {
97
+ define(prototype, method, function (arg) {
98
+ return this._invoke(method, arg);
99
+ });
100
+ });
101
+ }
102
+ function AsyncIterator(generator, PromiseImpl) {
103
+ function invoke(method, arg, resolve, reject) {
104
+ var record = tryCatch(generator[method], generator, arg);
105
+ if ("throw" !== record.type) {
106
+ var result = record.arg,
107
+ value = result.value;
108
+ return value && "object" == typeof value && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
109
+ invoke("next", value, resolve, reject);
110
+ }, function (err) {
111
+ invoke("throw", err, resolve, reject);
112
+ }) : PromiseImpl.resolve(value).then(function (unwrapped) {
113
+ result.value = unwrapped, resolve(result);
114
+ }, function (error) {
115
+ return invoke("throw", error, resolve, reject);
116
+ });
117
+ }
118
+ reject(record.arg);
119
+ }
120
+ var previousPromise;
121
+ defineProperty(this, "_invoke", {
122
+ value: function (method, arg) {
123
+ function callInvokeWithMethodAndArg() {
124
+ return new PromiseImpl(function (resolve, reject) {
125
+ invoke(method, arg, resolve, reject);
126
+ });
127
+ }
128
+ return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
129
+ }
130
+ });
131
+ }
132
+ function makeInvokeMethod(innerFn, self, context) {
133
+ var state = "suspendedStart";
134
+ return function (method, arg) {
135
+ if ("executing" === state) throw new Error("Generator is already running");
136
+ if ("completed" === state) {
137
+ if ("throw" === method) throw arg;
138
+ return doneResult();
139
+ }
140
+ for (context.method = method, context.arg = arg;;) {
141
+ var delegate = context.delegate;
142
+ if (delegate) {
143
+ var delegateResult = maybeInvokeDelegate(delegate, context);
144
+ if (delegateResult) {
145
+ if (delegateResult === ContinueSentinel) continue;
146
+ return delegateResult;
147
+ }
148
+ }
149
+ if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
150
+ if ("suspendedStart" === state) throw state = "completed", context.arg;
151
+ context.dispatchException(context.arg);
152
+ } else "return" === context.method && context.abrupt("return", context.arg);
153
+ state = "executing";
154
+ var record = tryCatch(innerFn, self, context);
155
+ if ("normal" === record.type) {
156
+ if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
157
+ return {
158
+ value: record.arg,
159
+ done: context.done
160
+ };
161
+ }
162
+ "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
163
+ }
164
+ };
165
+ }
166
+ function maybeInvokeDelegate(delegate, context) {
167
+ var methodName = context.method,
168
+ method = delegate.iterator[methodName];
169
+ if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel;
170
+ var record = tryCatch(method, delegate.iterator, context.arg);
171
+ if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
172
+ var info = record.arg;
173
+ return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel);
174
+ }
175
+ function pushTryEntry(locs) {
176
+ var entry = {
177
+ tryLoc: locs[0]
178
+ };
179
+ 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
180
+ }
181
+ function resetTryEntry(entry) {
182
+ var record = entry.completion || {};
183
+ record.type = "normal", delete record.arg, entry.completion = record;
184
+ }
185
+ function Context(tryLocsList) {
186
+ this.tryEntries = [{
187
+ tryLoc: "root"
188
+ }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
189
+ }
190
+ function values(iterable) {
191
+ if (iterable) {
192
+ var iteratorMethod = iterable[iteratorSymbol];
193
+ if (iteratorMethod) return iteratorMethod.call(iterable);
194
+ if ("function" == typeof iterable.next) return iterable;
195
+ if (!isNaN(iterable.length)) {
196
+ var i = -1,
197
+ next = function next() {
198
+ for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
199
+ return next.value = undefined, next.done = !0, next;
200
+ };
201
+ return next.next = next;
202
+ }
203
+ }
204
+ return {
205
+ next: doneResult
206
+ };
207
+ }
208
+ function doneResult() {
209
+ return {
210
+ value: undefined,
211
+ done: !0
212
+ };
213
+ }
214
+ return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", {
215
+ value: GeneratorFunctionPrototype,
216
+ configurable: !0
217
+ }), defineProperty(GeneratorFunctionPrototype, "constructor", {
218
+ value: GeneratorFunction,
219
+ configurable: !0
220
+ }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
221
+ var ctor = "function" == typeof genFun && genFun.constructor;
222
+ return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
223
+ }, exports.mark = function (genFun) {
224
+ return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun;
225
+ }, exports.awrap = function (arg) {
226
+ return {
227
+ __await: arg
228
+ };
229
+ }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
230
+ return this;
231
+ }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
232
+ void 0 === PromiseImpl && (PromiseImpl = Promise);
233
+ var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
234
+ return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
235
+ return result.done ? result.value : iter.next();
236
+ });
237
+ }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () {
238
+ return this;
239
+ }), define(Gp, "toString", function () {
240
+ return "[object Generator]";
241
+ }), exports.keys = function (val) {
242
+ var object = Object(val),
243
+ keys = [];
244
+ for (var key in object) keys.push(key);
245
+ return keys.reverse(), function next() {
246
+ for (; keys.length;) {
247
+ var key = keys.pop();
248
+ if (key in object) return next.value = key, next.done = !1, next;
249
+ }
250
+ return next.done = !0, next;
251
+ };
252
+ }, exports.values = values, Context.prototype = {
253
+ constructor: Context,
254
+ reset: function (skipTempReset) {
255
+ if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
256
+ },
257
+ stop: function () {
258
+ this.done = !0;
259
+ var rootRecord = this.tryEntries[0].completion;
260
+ if ("throw" === rootRecord.type) throw rootRecord.arg;
261
+ return this.rval;
262
+ },
263
+ dispatchException: function (exception) {
264
+ if (this.done) throw exception;
265
+ var context = this;
266
+ function handle(loc, caught) {
267
+ return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
268
+ }
269
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
270
+ var entry = this.tryEntries[i],
271
+ record = entry.completion;
272
+ if ("root" === entry.tryLoc) return handle("end");
273
+ if (entry.tryLoc <= this.prev) {
274
+ var hasCatch = hasOwn.call(entry, "catchLoc"),
275
+ hasFinally = hasOwn.call(entry, "finallyLoc");
276
+ if (hasCatch && hasFinally) {
277
+ if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
278
+ if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
279
+ } else if (hasCatch) {
280
+ if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
281
+ } else {
282
+ if (!hasFinally) throw new Error("try statement without catch or finally");
283
+ if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
284
+ }
285
+ }
286
+ }
287
+ },
288
+ abrupt: function (type, arg) {
289
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
290
+ var entry = this.tryEntries[i];
291
+ if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
292
+ var finallyEntry = entry;
293
+ break;
294
+ }
295
+ }
296
+ finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
297
+ var record = finallyEntry ? finallyEntry.completion : {};
298
+ return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
299
+ },
300
+ complete: function (record, afterLoc) {
301
+ if ("throw" === record.type) throw record.arg;
302
+ return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel;
303
+ },
304
+ finish: function (finallyLoc) {
305
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
306
+ var entry = this.tryEntries[i];
307
+ if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
308
+ }
309
+ },
310
+ catch: function (tryLoc) {
311
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
312
+ var entry = this.tryEntries[i];
313
+ if (entry.tryLoc === tryLoc) {
314
+ var record = entry.completion;
315
+ if ("throw" === record.type) {
316
+ var thrown = record.arg;
317
+ resetTryEntry(entry);
318
+ }
319
+ return thrown;
320
+ }
321
+ }
322
+ throw new Error("illegal catch attempt");
323
+ },
324
+ delegateYield: function (iterable, resultName, nextLoc) {
325
+ return this.delegate = {
326
+ iterator: values(iterable),
327
+ resultName: resultName,
328
+ nextLoc: nextLoc
329
+ }, "next" === this.method && (this.arg = undefined), ContinueSentinel;
330
+ }
331
+ }, exports;
332
+ }
333
+ function asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, key, arg) {
334
+ try {
335
+ var info = gen[key](arg);
336
+ var value = info.value;
337
+ } catch (error) {
338
+ reject(error);
339
+ return;
340
+ }
341
+ if (info.done) {
342
+ resolve(value);
343
+ } else {
344
+ Promise.resolve(value).then(_next, _throw);
345
+ }
346
+ }
347
+ function _asyncToGenerator$1(fn) {
348
+ return function () {
349
+ var self = this,
350
+ args = arguments;
351
+ return new Promise(function (resolve, reject) {
352
+ var gen = fn.apply(self, args);
353
+ function _next(value) {
354
+ asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, "next", value);
355
+ }
356
+ function _throw(err) {
357
+ asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, "throw", err);
358
+ }
359
+ _next(undefined);
360
+ });
361
+ };
362
+ }
363
+ function _extends$1() {
364
+ _extends$1 = Object.assign ? Object.assign.bind() : function (target) {
365
+ for (var i = 1; i < arguments.length; i++) {
366
+ var source = arguments[i];
367
+ for (var key in source) {
368
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
369
+ target[key] = source[key];
370
+ }
371
+ }
372
+ }
373
+ return target;
374
+ };
375
+ return _extends$1.apply(this, arguments);
376
+ }
377
+
378
+ function getDefaultExportFromCjs (x) {
379
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
380
+ }
381
+
382
+ var react = {exports: {}};
383
+
384
+ var react_production_min = {};
385
+
386
+ /**
387
+ * @license React
388
+ * react.production.min.js
389
+ *
390
+ * Copyright (c) Facebook, Inc. and its affiliates.
391
+ *
392
+ * This source code is licensed under the MIT license found in the
393
+ * LICENSE file in the root directory of this source tree.
394
+ */
395
+ var l=Symbol.for("react.element"),n=Symbol.for("react.portal"),p=Symbol.for("react.fragment"),q=Symbol.for("react.strict_mode"),r=Symbol.for("react.profiler"),t=Symbol.for("react.provider"),u=Symbol.for("react.context"),v=Symbol.for("react.forward_ref"),w=Symbol.for("react.suspense"),x=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),z=Symbol.iterator;function A(a){if(null===a||"object"!==typeof a)return null;a=z&&a[z]||a["@@iterator"];return "function"===typeof a?a:null}
396
+ var B={isMounted:function(){return !1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,D={};function E(a,b,e){this.props=a;this.context=b;this.refs=D;this.updater=e||B;}E.prototype.isReactComponent={};
397
+ E.prototype.setState=function(a,b){if("object"!==typeof a&&"function"!==typeof a&&null!=a)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,a,b,"setState");};E.prototype.forceUpdate=function(a){this.updater.enqueueForceUpdate(this,a,"forceUpdate");};function F(){}F.prototype=E.prototype;function G(a,b,e){this.props=a;this.context=b;this.refs=D;this.updater=e||B;}var H=G.prototype=new F;
398
+ H.constructor=G;C(H,E.prototype);H.isPureReactComponent=!0;var I=Array.isArray,J=Object.prototype.hasOwnProperty,K={current:null},L={key:!0,ref:!0,__self:!0,__source:!0};
399
+ function M(a,b,e){var d,c={},k=null,h=null;if(null!=b)for(d in void 0!==b.ref&&(h=b.ref),void 0!==b.key&&(k=""+b.key),b)J.call(b,d)&&!L.hasOwnProperty(d)&&(c[d]=b[d]);var g=arguments.length-2;if(1===g)c.children=e;else if(1<g){for(var f=Array(g),m=0;m<g;m++)f[m]=arguments[m+2];c.children=f;}if(a&&a.defaultProps)for(d in g=a.defaultProps,g)void 0===c[d]&&(c[d]=g[d]);return {$$typeof:l,type:a,key:k,ref:h,props:c,_owner:K.current}}
400
+ function N(a,b){return {$$typeof:l,type:a.type,key:b,ref:a.ref,props:a.props,_owner:a._owner}}function O(a){return "object"===typeof a&&null!==a&&a.$$typeof===l}function escape(a){var b={"=":"=0",":":"=2"};return "$"+a.replace(/[=:]/g,function(a){return b[a]})}var P=/\/+/g;function Q(a,b){return "object"===typeof a&&null!==a&&null!=a.key?escape(""+a.key):b.toString(36)}
401
+ function R(a,b,e,d,c){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 l:case n:h=!0;}}if(h)return h=a,c=c(h),a=""===d?"."+Q(h,0):d,I(c)?(e="",null!=a&&(e=a.replace(P,"$&/")+"/"),R(c,b,e,"",function(a){return a})):null!=c&&(O(c)&&(c=N(c,e+(!c.key||h&&h.key===c.key?"":(""+c.key).replace(P,"$&/")+"/")+a)),b.push(c)),1;h=0;d=""===d?".":d+":";if(I(a))for(var g=0;g<a.length;g++){k=
402
+ a[g];var f=d+Q(k,g);h+=R(k,b,e,f,c);}else if(f=A(a),"function"===typeof f)for(a=f.call(a),g=0;!(k=a.next()).done;)k=k.value,f=d+Q(k,g++),h+=R(k,b,e,f,c);else if("object"===k)throw b=String(a),Error("Objects are not valid as a React child (found: "+("[object Object]"===b?"object with keys {"+Object.keys(a).join(", ")+"}":b)+"). If you meant to render a collection of children, use an array instead.");return h}
403
+ function S(a,b,e){if(null==a)return a;var d=[],c=0;R(a,d,"","",function(a){return b.call(e,a,c++)});return d}function T(a){if(-1===a._status){var b=a._result;b=b();b.then(function(b){if(0===a._status||-1===a._status)a._status=1,a._result=b;},function(b){if(0===a._status||-1===a._status)a._status=2,a._result=b;});-1===a._status&&(a._status=0,a._result=b);}if(1===a._status)return a._result.default;throw a._result;}
404
+ var U={current:null},V={transition:null},W={ReactCurrentDispatcher:U,ReactCurrentBatchConfig:V,ReactCurrentOwner:K};react_production_min.Children={map:S,forEach:function(a,b,e){S(a,function(){b.apply(this,arguments);},e);},count:function(a){var b=0;S(a,function(){b++;});return b},toArray:function(a){return S(a,function(a){return a})||[]},only:function(a){if(!O(a))throw Error("React.Children.only expected to receive a single React element child.");return a}};react_production_min.Component=E;react_production_min.Fragment=p;
405
+ react_production_min.Profiler=r;react_production_min.PureComponent=G;react_production_min.StrictMode=q;react_production_min.Suspense=w;react_production_min.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=W;
406
+ react_production_min.cloneElement=function(a,b,e){if(null===a||void 0===a)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+a+".");var d=C({},a.props),c=a.key,k=a.ref,h=a._owner;if(null!=b){void 0!==b.ref&&(k=b.ref,h=K.current);void 0!==b.key&&(c=""+b.key);if(a.type&&a.type.defaultProps)var g=a.type.defaultProps;for(f in b)J.call(b,f)&&!L.hasOwnProperty(f)&&(d[f]=void 0===b[f]&&void 0!==g?g[f]:b[f]);}var f=arguments.length-2;if(1===f)d.children=e;else if(1<f){g=Array(f);
407
+ for(var m=0;m<f;m++)g[m]=arguments[m+2];d.children=g;}return {$$typeof:l,type:a.type,key:c,ref:k,props:d,_owner:h}};react_production_min.createContext=function(a){a={$$typeof:u,_currentValue:a,_currentValue2:a,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null};a.Provider={$$typeof:t,_context:a};return a.Consumer=a};react_production_min.createElement=M;react_production_min.createFactory=function(a){var b=M.bind(null,a);b.type=a;return b};react_production_min.createRef=function(){return {current:null}};
408
+ react_production_min.forwardRef=function(a){return {$$typeof:v,render:a}};react_production_min.isValidElement=O;react_production_min.lazy=function(a){return {$$typeof:y,_payload:{_status:-1,_result:a},_init:T}};react_production_min.memo=function(a,b){return {$$typeof:x,type:a,compare:void 0===b?null:b}};react_production_min.startTransition=function(a){var b=V.transition;V.transition={};try{a();}finally{V.transition=b;}};react_production_min.unstable_act=function(){throw Error("act(...) is not supported in production builds of React.");};
409
+ react_production_min.useCallback=function(a,b){return U.current.useCallback(a,b)};react_production_min.useContext=function(a){return U.current.useContext(a)};react_production_min.useDebugValue=function(){};react_production_min.useDeferredValue=function(a){return U.current.useDeferredValue(a)};react_production_min.useEffect=function(a,b){return U.current.useEffect(a,b)};react_production_min.useId=function(){return U.current.useId()};react_production_min.useImperativeHandle=function(a,b,e){return U.current.useImperativeHandle(a,b,e)};
410
+ react_production_min.useInsertionEffect=function(a,b){return U.current.useInsertionEffect(a,b)};react_production_min.useLayoutEffect=function(a,b){return U.current.useLayoutEffect(a,b)};react_production_min.useMemo=function(a,b){return U.current.useMemo(a,b)};react_production_min.useReducer=function(a,b,e){return U.current.useReducer(a,b,e)};react_production_min.useRef=function(a){return U.current.useRef(a)};react_production_min.useState=function(a){return U.current.useState(a)};react_production_min.useSyncExternalStore=function(a,b,e){return U.current.useSyncExternalStore(a,b,e)};
411
+ react_production_min.useTransition=function(){return U.current.useTransition()};react_production_min.version="18.2.0";
412
+
413
+ {
414
+ react.exports = react_production_min;
415
+ }
416
+
417
+ var reactExports = react.exports;
418
+ var React = /*@__PURE__*/getDefaultExportFromCjs(reactExports);
419
+
420
+ var React$1 = /*#__PURE__*/_mergeNamespaces({
421
+ __proto__: null,
422
+ default: React
423
+ }, [reactExports]);
424
+
425
+ var Context = /*#__PURE__*/React.createContext();
426
+
427
+ /* eslint react/display-name:0 */
428
+ var withContext = function withContext(BaseComponent) {
429
+ return function (props) {
430
+ var _useContext = reactExports.useContext(Context),
431
+ context = _useContext.context,
432
+ setContext = _useContext.setContext;
433
+ return /*#__PURE__*/React.createElement(BaseComponent, _extends$1({}, props, {
434
+ context: context,
435
+ setContext: setContext
436
+ }));
437
+ };
438
+ };
439
+
440
+ /**
441
+ * @remix-run/router v1.5.0
442
+ *
443
+ * Copyright (c) Remix Software Inc.
444
+ *
445
+ * This source code is licensed under the MIT license found in the
446
+ * LICENSE.md file in the root directory of this source tree.
447
+ *
448
+ * @license MIT
449
+ */
450
+ function _extends() {
451
+ _extends = Object.assign ? Object.assign.bind() : function (target) {
452
+ for (var i = 1; i < arguments.length; i++) {
453
+ var source = arguments[i];
454
+
455
+ for (var key in source) {
456
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
457
+ target[key] = source[key];
458
+ }
459
+ }
460
+ }
461
+
462
+ return target;
463
+ };
464
+ return _extends.apply(this, arguments);
465
+ }
466
+
467
+ ////////////////////////////////////////////////////////////////////////////////
468
+ //#region Types and Constants
469
+ ////////////////////////////////////////////////////////////////////////////////
470
+
471
+ /**
472
+ * Actions represent the type of change to a location value.
473
+ */
474
+ var Action;
475
+
476
+ (function (Action) {
477
+ /**
478
+ * A POP indicates a change to an arbitrary index in the history stack, such
479
+ * as a back or forward navigation. It does not describe the direction of the
480
+ * navigation, only that the current index changed.
481
+ *
482
+ * Note: This is the default action for newly created history objects.
483
+ */
484
+ Action["Pop"] = "POP";
485
+ /**
486
+ * A PUSH indicates a new entry being added to the history stack, such as when
487
+ * a link is clicked and a new page loads. When this happens, all subsequent
488
+ * entries in the stack are lost.
489
+ */
490
+
491
+ Action["Push"] = "PUSH";
492
+ /**
493
+ * A REPLACE indicates the entry at the current index in the history stack
494
+ * being replaced by a new one.
495
+ */
496
+
497
+ Action["Replace"] = "REPLACE";
498
+ })(Action || (Action = {}));
499
+
500
+ const PopStateEventType = "popstate";
501
+ /**
502
+ * Browser history stores the location in regular URLs. This is the standard for
503
+ * most web apps, but it requires some configuration on the server to ensure you
504
+ * serve the same app at multiple URLs.
505
+ *
506
+ * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#createbrowserhistory
507
+ */
508
+
509
+ function createBrowserHistory(options) {
510
+ if (options === void 0) {
511
+ options = {};
512
+ }
513
+
514
+ function createBrowserLocation(window, globalHistory) {
515
+ let {
516
+ pathname,
517
+ search,
518
+ hash
519
+ } = window.location;
520
+ return createLocation("", {
521
+ pathname,
522
+ search,
523
+ hash
524
+ }, // state defaults to `null` because `window.history.state` does
525
+ globalHistory.state && globalHistory.state.usr || null, globalHistory.state && globalHistory.state.key || "default");
526
+ }
527
+
528
+ function createBrowserHref(window, to) {
529
+ return typeof to === "string" ? to : createPath(to);
530
+ }
531
+
532
+ return getUrlBasedHistory(createBrowserLocation, createBrowserHref, null, options);
533
+ }
534
+ function invariant(value, message) {
535
+ if (value === false || value === null || typeof value === "undefined") {
536
+ throw new Error(message);
537
+ }
538
+ }
539
+
540
+ function createKey() {
541
+ return Math.random().toString(36).substr(2, 8);
542
+ }
543
+ /**
544
+ * For browser-based histories, we combine the state and key into an object
545
+ */
546
+
547
+
548
+ function getHistoryState(location, index) {
549
+ return {
550
+ usr: location.state,
551
+ key: location.key,
552
+ idx: index
553
+ };
554
+ }
555
+ /**
556
+ * Creates a Location object with a unique key from the given Path
557
+ */
558
+
559
+
560
+ function createLocation(current, to, state, key) {
561
+ if (state === void 0) {
562
+ state = null;
563
+ }
564
+
565
+ let location = _extends({
566
+ pathname: typeof current === "string" ? current : current.pathname,
567
+ search: "",
568
+ hash: ""
569
+ }, typeof to === "string" ? parsePath(to) : to, {
570
+ state,
571
+ // TODO: This could be cleaned up. push/replace should probably just take
572
+ // full Locations now and avoid the need to run through this flow at all
573
+ // But that's a pretty big refactor to the current test suite so going to
574
+ // keep as is for the time being and just let any incoming keys take precedence
575
+ key: to && to.key || key || createKey()
576
+ });
577
+
578
+ return location;
579
+ }
580
+ /**
581
+ * Creates a string URL path from the given pathname, search, and hash components.
582
+ */
583
+
584
+ function createPath(_ref) {
585
+ let {
586
+ pathname = "/",
587
+ search = "",
588
+ hash = ""
589
+ } = _ref;
590
+ if (search && search !== "?") pathname += search.charAt(0) === "?" ? search : "?" + search;
591
+ if (hash && hash !== "#") pathname += hash.charAt(0) === "#" ? hash : "#" + hash;
592
+ return pathname;
593
+ }
594
+ /**
595
+ * Parses a string URL path into its separate pathname, search, and hash components.
596
+ */
597
+
598
+ function parsePath(path) {
599
+ let parsedPath = {};
600
+
601
+ if (path) {
602
+ let hashIndex = path.indexOf("#");
603
+
604
+ if (hashIndex >= 0) {
605
+ parsedPath.hash = path.substr(hashIndex);
606
+ path = path.substr(0, hashIndex);
607
+ }
608
+
609
+ let searchIndex = path.indexOf("?");
610
+
611
+ if (searchIndex >= 0) {
612
+ parsedPath.search = path.substr(searchIndex);
613
+ path = path.substr(0, searchIndex);
614
+ }
615
+
616
+ if (path) {
617
+ parsedPath.pathname = path;
618
+ }
619
+ }
620
+
621
+ return parsedPath;
622
+ }
623
+
624
+ function getUrlBasedHistory(getLocation, createHref, validateLocation, options) {
625
+ if (options === void 0) {
626
+ options = {};
627
+ }
628
+
629
+ let {
630
+ window = document.defaultView,
631
+ v5Compat = false
632
+ } = options;
633
+ let globalHistory = window.history;
634
+ let action = Action.Pop;
635
+ let listener = null;
636
+ let index = getIndex(); // Index should only be null when we initialize. If not, it's because the
637
+ // user called history.pushState or history.replaceState directly, in which
638
+ // case we should log a warning as it will result in bugs.
639
+
640
+ if (index == null) {
641
+ index = 0;
642
+ globalHistory.replaceState(_extends({}, globalHistory.state, {
643
+ idx: index
644
+ }), "");
645
+ }
646
+
647
+ function getIndex() {
648
+ let state = globalHistory.state || {
649
+ idx: null
650
+ };
651
+ return state.idx;
652
+ }
653
+
654
+ function handlePop() {
655
+ action = Action.Pop;
656
+ let nextIndex = getIndex();
657
+ let delta = nextIndex == null ? null : nextIndex - index;
658
+ index = nextIndex;
659
+
660
+ if (listener) {
661
+ listener({
662
+ action,
663
+ location: history.location,
664
+ delta
665
+ });
666
+ }
667
+ }
668
+
669
+ function push(to, state) {
670
+ action = Action.Push;
671
+ let location = createLocation(history.location, to, state);
672
+ if (validateLocation) validateLocation(location, to);
673
+ index = getIndex() + 1;
674
+ let historyState = getHistoryState(location, index);
675
+ let url = history.createHref(location); // try...catch because iOS limits us to 100 pushState calls :/
676
+
677
+ try {
678
+ globalHistory.pushState(historyState, "", url);
679
+ } catch (error) {
680
+ // They are going to lose state here, but there is no real
681
+ // way to warn them about it since the page will refresh...
682
+ window.location.assign(url);
683
+ }
684
+
685
+ if (v5Compat && listener) {
686
+ listener({
687
+ action,
688
+ location: history.location,
689
+ delta: 1
690
+ });
691
+ }
692
+ }
693
+
694
+ function replace(to, state) {
695
+ action = Action.Replace;
696
+ let location = createLocation(history.location, to, state);
697
+ if (validateLocation) validateLocation(location, to);
698
+ index = getIndex();
699
+ let historyState = getHistoryState(location, index);
700
+ let url = history.createHref(location);
701
+ globalHistory.replaceState(historyState, "", url);
702
+
703
+ if (v5Compat && listener) {
704
+ listener({
705
+ action,
706
+ location: history.location,
707
+ delta: 0
708
+ });
709
+ }
710
+ }
711
+
712
+ function createURL(to) {
713
+ // window.location.origin is "null" (the literal string value) in Firefox
714
+ // under certain conditions, notably when serving from a local HTML file
715
+ // See https://bugzilla.mozilla.org/show_bug.cgi?id=878297
716
+ let base = window.location.origin !== "null" ? window.location.origin : window.location.href;
717
+ let href = typeof to === "string" ? to : createPath(to);
718
+ invariant(base, "No window.location.(origin|href) available to create URL for href: " + href);
719
+ return new URL(href, base);
720
+ }
721
+
722
+ let history = {
723
+ get action() {
724
+ return action;
725
+ },
726
+
727
+ get location() {
728
+ return getLocation(window, globalHistory);
729
+ },
730
+
731
+ listen(fn) {
732
+ if (listener) {
733
+ throw new Error("A history only accepts one active listener");
734
+ }
735
+
736
+ window.addEventListener(PopStateEventType, handlePop);
737
+ listener = fn;
738
+ return () => {
739
+ window.removeEventListener(PopStateEventType, handlePop);
740
+ listener = null;
741
+ };
742
+ },
743
+
744
+ createHref(to) {
745
+ return createHref(window, to);
746
+ },
747
+
748
+ createURL,
749
+
750
+ encodeLocation(to) {
751
+ // Encode a Location the same way window.location would
752
+ let url = createURL(to);
753
+ return {
754
+ pathname: url.pathname,
755
+ search: url.search,
756
+ hash: url.hash
757
+ };
758
+ },
759
+
760
+ push,
761
+ replace,
762
+
763
+ go(n) {
764
+ return globalHistory.go(n);
765
+ }
766
+
767
+ };
768
+ return history;
769
+ } //#endregion
770
+
771
+ var ResultType;
772
+
773
+ (function (ResultType) {
774
+ ResultType["data"] = "data";
775
+ ResultType["deferred"] = "deferred";
776
+ ResultType["redirect"] = "redirect";
777
+ ResultType["error"] = "error";
778
+ })(ResultType || (ResultType = {}));
779
+ /**
780
+ * @private
781
+ */
782
+
783
+
784
+ function stripBasename(pathname, basename) {
785
+ if (basename === "/") return pathname;
786
+
787
+ if (!pathname.toLowerCase().startsWith(basename.toLowerCase())) {
788
+ return null;
789
+ } // We want to leave trailing slash behavior in the user's control, so if they
790
+ // specify a basename with a trailing slash, we should support it
791
+
792
+
793
+ let startIndex = basename.endsWith("/") ? basename.length - 1 : basename.length;
794
+ let nextChar = pathname.charAt(startIndex);
795
+
796
+ if (nextChar && nextChar !== "/") {
797
+ // pathname does not start with basename/
798
+ return null;
799
+ }
800
+
801
+ return pathname.slice(startIndex) || "/";
802
+ }
803
+
804
+ /**
805
+ * React Router v6.10.0
806
+ *
807
+ * Copyright (c) Remix Software Inc.
808
+ *
809
+ * This source code is licensed under the MIT license found in the
810
+ * LICENSE.md file in the root directory of this source tree.
811
+ *
812
+ * @license MIT
813
+ */
814
+
815
+ /**
816
+ * Copyright (c) Facebook, Inc. and its affiliates.
817
+ *
818
+ * This source code is licensed under the MIT license found in the
819
+ * LICENSE file in the root directory of this source tree.
820
+ */
821
+ /**
822
+ * inlined Object.is polyfill to avoid requiring consumers ship their own
823
+ * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
824
+ */
825
+
826
+ function isPolyfill(x, y) {
827
+ return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y // eslint-disable-line no-self-compare
828
+ ;
829
+ }
830
+
831
+ const is = typeof Object.is === "function" ? Object.is : isPolyfill; // Intentionally not using named imports because Rollup uses dynamic
832
+ // dispatch for CommonJS interop named imports.
833
+
834
+ const {
835
+ useState,
836
+ useEffect,
837
+ useLayoutEffect,
838
+ useDebugValue
839
+ } = React$1;
840
+ // because of a very particular set of implementation details and assumptions
841
+ // -- change any one of them and it will break. The most important assumption
842
+ // is that updates are always synchronous, because concurrent rendering is
843
+ // only available in versions of React that also have a built-in
844
+ // useSyncExternalStore API. And we only use this shim when the built-in API
845
+ // does not exist.
846
+ //
847
+ // Do not assume that the clever hacks used by this hook also work in general.
848
+ // The point of this shim is to replace the need for hacks by other libraries.
849
+
850
+ function useSyncExternalStore$2(subscribe, getSnapshot, // Note: The shim does not use getServerSnapshot, because pre-18 versions of
851
+ // React do not expose a way to check if we're hydrating. So users of the shim
852
+ // will need to track that themselves and return the correct value
853
+ // from `getSnapshot`.
854
+ getServerSnapshot) {
855
+ // breaks the rules of React, and only works here because of specific
856
+ // implementation details, most importantly that updates are
857
+ // always synchronous.
858
+
859
+
860
+ const value = getSnapshot();
861
+ // re-render whenever the subscribed state changes by updating an some
862
+ // arbitrary useState hook. Then, during render, we call getSnapshot to read
863
+ // the current value.
864
+ //
865
+ // Because we don't actually use the state returned by the useState hook, we
866
+ // can save a bit of memory by storing other stuff in that slot.
867
+ //
868
+ // To implement the early bailout, we need to track some things on a mutable
869
+ // object. Usually, we would put that in a useRef hook, but we can stash it in
870
+ // our useState hook instead.
871
+ //
872
+ // To force a re-render, we call forceUpdate({inst}). That works because the
873
+ // new object always fails an equality check.
874
+
875
+
876
+ const [{
877
+ inst
878
+ }, forceUpdate] = useState({
879
+ inst: {
880
+ value,
881
+ getSnapshot
882
+ }
883
+ }); // Track the latest getSnapshot function with a ref. This needs to be updated
884
+ // in the layout phase so we can access it during the tearing check that
885
+ // happens on subscribe.
886
+
887
+ useLayoutEffect(() => {
888
+ inst.value = value;
889
+ inst.getSnapshot = getSnapshot; // Whenever getSnapshot or subscribe changes, we need to check in the
890
+ // commit phase if there was an interleaved mutation. In concurrent mode
891
+ // this can happen all the time, but even in synchronous mode, an earlier
892
+ // effect may have mutated the store.
893
+
894
+ if (checkIfSnapshotChanged(inst)) {
895
+ // Force a re-render.
896
+ forceUpdate({
897
+ inst
898
+ });
899
+ } // eslint-disable-next-line react-hooks/exhaustive-deps
900
+
901
+ }, [subscribe, value, getSnapshot]);
902
+ useEffect(() => {
903
+ // Check for changes right before subscribing. Subsequent changes will be
904
+ // detected in the subscription handler.
905
+ if (checkIfSnapshotChanged(inst)) {
906
+ // Force a re-render.
907
+ forceUpdate({
908
+ inst
909
+ });
910
+ }
911
+
912
+ const handleStoreChange = () => {
913
+ // TODO: Because there is no cross-renderer API for batching updates, it's
914
+ // up to the consumer of this library to wrap their subscription event
915
+ // with unstable_batchedUpdates. Should we try to detect when this isn't
916
+ // the case and print a warning in development?
917
+ // The store changed. Check if the snapshot changed since the last time we
918
+ // read from the store.
919
+ if (checkIfSnapshotChanged(inst)) {
920
+ // Force a re-render.
921
+ forceUpdate({
922
+ inst
923
+ });
924
+ }
925
+ }; // Subscribe to the store and return a clean-up function.
926
+
927
+
928
+ return subscribe(handleStoreChange); // eslint-disable-next-line react-hooks/exhaustive-deps
929
+ }, [subscribe]);
930
+ useDebugValue(value);
931
+ return value;
932
+ }
933
+
934
+ function checkIfSnapshotChanged(inst) {
935
+ const latestGetSnapshot = inst.getSnapshot;
936
+ const prevValue = inst.value;
937
+
938
+ try {
939
+ const nextValue = latestGetSnapshot();
940
+ return !is(prevValue, nextValue);
941
+ } catch (error) {
942
+ return true;
943
+ }
944
+ }
945
+
946
+ /**
947
+ * Copyright (c) Facebook, Inc. and its affiliates.
948
+ *
949
+ * This source code is licensed under the MIT license found in the
950
+ * LICENSE file in the root directory of this source tree.
951
+ *
952
+ * @flow
953
+ */
954
+ function useSyncExternalStore$1(subscribe, getSnapshot, getServerSnapshot) {
955
+ // Note: The shim does not use getServerSnapshot, because pre-18 versions of
956
+ // React do not expose a way to check if we're hydrating. So users of the shim
957
+ // will need to track that themselves and return the correct value
958
+ // from `getSnapshot`.
959
+ return getSnapshot();
960
+ }
961
+
962
+ /**
963
+ * Inlined into the react-router repo since use-sync-external-store does not
964
+ * provide a UMD-compatible package, so we need this to be able to distribute
965
+ * UMD react-router bundles
966
+ */
967
+ const canUseDOM = !!(typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined");
968
+ const isServerEnvironment = !canUseDOM;
969
+ const shim = isServerEnvironment ? useSyncExternalStore$1 : useSyncExternalStore$2;
970
+ "useSyncExternalStore" in React$1 ? (module => module.useSyncExternalStore)(React$1) : shim;
971
+
972
+ const NavigationContext = /*#__PURE__*/reactExports.createContext(null);
973
+
974
+ const LocationContext = /*#__PURE__*/reactExports.createContext(null);
975
+ /**
976
+ * Returns true if this component is a descendant of a <Router>.
977
+ *
978
+ * @see https://reactrouter.com/hooks/use-in-router-context
979
+ */
980
+
981
+ function useInRouterContext() {
982
+ return reactExports.useContext(LocationContext) != null;
983
+ }
984
+ var DataRouterHook$1;
985
+
986
+ (function (DataRouterHook) {
987
+ DataRouterHook["UseBlocker"] = "useBlocker";
988
+ DataRouterHook["UseRevalidator"] = "useRevalidator";
989
+ })(DataRouterHook$1 || (DataRouterHook$1 = {}));
990
+
991
+ var DataRouterStateHook$1;
992
+
993
+ (function (DataRouterStateHook) {
994
+ DataRouterStateHook["UseBlocker"] = "useBlocker";
995
+ DataRouterStateHook["UseLoaderData"] = "useLoaderData";
996
+ DataRouterStateHook["UseActionData"] = "useActionData";
997
+ DataRouterStateHook["UseRouteError"] = "useRouteError";
998
+ DataRouterStateHook["UseNavigation"] = "useNavigation";
999
+ DataRouterStateHook["UseRouteLoaderData"] = "useRouteLoaderData";
1000
+ DataRouterStateHook["UseMatches"] = "useMatches";
1001
+ DataRouterStateHook["UseRevalidator"] = "useRevalidator";
1002
+ })(DataRouterStateHook$1 || (DataRouterStateHook$1 = {}));
1003
+
1004
+ /**
1005
+ * Provides location context for the rest of the app.
1006
+ *
1007
+ * Note: You usually won't render a <Router> directly. Instead, you'll render a
1008
+ * router that is more specific to your environment such as a <BrowserRouter>
1009
+ * in web browsers or a <StaticRouter> for server rendering.
1010
+ *
1011
+ * @see https://reactrouter.com/router-components/router
1012
+ */
1013
+ function Router(_ref4) {
1014
+ let {
1015
+ basename: basenameProp = "/",
1016
+ children = null,
1017
+ location: locationProp,
1018
+ navigationType = Action.Pop,
1019
+ navigator,
1020
+ static: staticProp = false
1021
+ } = _ref4;
1022
+ !!useInRouterContext() ? invariant(false) : void 0; // Preserve trailing slashes on basename, so we can let the user control
1023
+ // the enforcement of trailing slashes throughout the app
1024
+
1025
+ let basename = basenameProp.replace(/^\/*/, "/");
1026
+ let navigationContext = reactExports.useMemo(() => ({
1027
+ basename,
1028
+ navigator,
1029
+ static: staticProp
1030
+ }), [basename, navigator, staticProp]);
1031
+
1032
+ if (typeof locationProp === "string") {
1033
+ locationProp = parsePath(locationProp);
1034
+ }
1035
+
1036
+ let {
1037
+ pathname = "/",
1038
+ search = "",
1039
+ hash = "",
1040
+ state = null,
1041
+ key = "default"
1042
+ } = locationProp;
1043
+ let locationContext = reactExports.useMemo(() => {
1044
+ let trailingPathname = stripBasename(pathname, basename);
1045
+
1046
+ if (trailingPathname == null) {
1047
+ return null;
1048
+ }
1049
+
1050
+ return {
1051
+ location: {
1052
+ pathname: trailingPathname,
1053
+ search,
1054
+ hash,
1055
+ state,
1056
+ key
1057
+ },
1058
+ navigationType
1059
+ };
1060
+ }, [basename, pathname, search, hash, state, key, navigationType]);
1061
+
1062
+ if (locationContext == null) {
1063
+ return null;
1064
+ }
1065
+
1066
+ return /*#__PURE__*/reactExports.createElement(NavigationContext.Provider, {
1067
+ value: navigationContext
1068
+ }, /*#__PURE__*/reactExports.createElement(LocationContext.Provider, {
1069
+ children: children,
1070
+ value: locationContext
1071
+ }));
1072
+ }
1073
+ var AwaitRenderStatus;
1074
+
1075
+ (function (AwaitRenderStatus) {
1076
+ AwaitRenderStatus[AwaitRenderStatus["pending"] = 0] = "pending";
1077
+ AwaitRenderStatus[AwaitRenderStatus["success"] = 1] = "success";
1078
+ AwaitRenderStatus[AwaitRenderStatus["error"] = 2] = "error";
1079
+ })(AwaitRenderStatus || (AwaitRenderStatus = {}));
1080
+
1081
+ new Promise(() => {});
1082
+
1083
+ /**
1084
+ * React Router DOM v6.10.0
1085
+ *
1086
+ * Copyright (c) Remix Software Inc.
1087
+ *
1088
+ * This source code is licensed under the MIT license found in the
1089
+ * LICENSE.md file in the root directory of this source tree.
1090
+ *
1091
+ * @license MIT
1092
+ */
1093
+ /**
1094
+ * A `<Router>` for use in web browsers. Provides the cleanest URLs.
1095
+ */
1096
+
1097
+
1098
+ function BrowserRouter(_ref) {
1099
+ let {
1100
+ basename,
1101
+ children,
1102
+ window
1103
+ } = _ref;
1104
+ let historyRef = reactExports.useRef();
1105
+
1106
+ if (historyRef.current == null) {
1107
+ historyRef.current = createBrowserHistory({
1108
+ window,
1109
+ v5Compat: true
1110
+ });
1111
+ }
1112
+
1113
+ let history = historyRef.current;
1114
+ let [state, setState] = reactExports.useState({
1115
+ action: history.action,
1116
+ location: history.location
1117
+ });
1118
+ reactExports.useLayoutEffect(() => history.listen(setState), [history]);
1119
+ return /*#__PURE__*/reactExports.createElement(Router, {
1120
+ basename: basename,
1121
+ children: children,
1122
+ location: state.location,
1123
+ navigationType: state.action,
1124
+ navigator: history
1125
+ });
1126
+ }
1127
+ ////////////////////////////////////////////////////////////////////////////////
1128
+ //#region Hooks
1129
+ ////////////////////////////////////////////////////////////////////////////////
1130
+
1131
+
1132
+ var DataRouterHook;
1133
+
1134
+ (function (DataRouterHook) {
1135
+ DataRouterHook["UseScrollRestoration"] = "useScrollRestoration";
1136
+ DataRouterHook["UseSubmitImpl"] = "useSubmitImpl";
1137
+ DataRouterHook["UseFetcher"] = "useFetcher";
1138
+ })(DataRouterHook || (DataRouterHook = {}));
1139
+
1140
+ var DataRouterStateHook;
1141
+
1142
+ (function (DataRouterStateHook) {
1143
+ DataRouterStateHook["UseFetchers"] = "useFetchers";
1144
+ DataRouterStateHook["UseScrollRestoration"] = "useScrollRestoration";
1145
+ })(DataRouterStateHook || (DataRouterStateHook = {}));
1146
+
1147
+ var AppContext = function AppContext(_ref) {
1148
+ var context = _ref.context,
1149
+ children = _ref.children;
1150
+ var _useState = reactExports.useState(context),
1151
+ innerContext = _useState[0],
1152
+ setInnerContext = _useState[1];
1153
+ reactExports.useEffect(function () {
1154
+ setInnerContext(context);
1155
+ }, [context]);
1156
+ return /*#__PURE__*/React.createElement(Context.Provider, {
1157
+ value: {
1158
+ context: innerContext,
1159
+ setContext: setInnerContext
1160
+ }
1161
+ }, children);
1162
+ };
1163
+
1164
+ var _DEF_CATCHER_URL = '/sys/jserror';
1165
+ function mioloCatcher(catcher_url) {
1166
+ window.onerror = function (msg, file, line, col, error) {
1167
+ try {
1168
+ var params = {
1169
+ 'error': {
1170
+ msg: msg,
1171
+ file: file,
1172
+ line: line,
1173
+ col: col,
1174
+ error: error
1175
+ },
1176
+ 'path': window.location.pathname,
1177
+ 'agent': 'UserAgent' + navigator.userAgent
1178
+ };
1179
+ var body = JSON.stringify(params || {}, function (k, v) {
1180
+ return v === undefined ? null : v;
1181
+ });
1182
+ var request = {
1183
+ method: 'POST',
1184
+ mode: 'cors',
1185
+ credentials: 'include',
1186
+ headers: {
1187
+ 'content-type': 'application/json'
1188
+ },
1189
+ body: body
1190
+ };
1191
+ fetch(catcher_url || _DEF_CATCHER_URL, request);
1192
+ } catch (e) {
1193
+ console.error(e);
1194
+ }
1195
+ };
1196
+ }
1197
+
1198
+ var AppBrowser = function AppBrowser(_ref) {
1199
+ var children = _ref.children;
1200
+ mioloCatcher();
1201
+ return /*#__PURE__*/React.createElement(BrowserRouter, null, /*#__PURE__*/React.createElement(AppContext, {
1202
+ context: window.__CONTEXT || {}
1203
+ }, children));
1204
+ };
1205
+
1206
+ /**
1207
+ * A <Router> that may not navigate to any other location. This is useful
1208
+ * on the server where there is no stateful UI.
1209
+ */
1210
+ function StaticRouter({
1211
+ basename,
1212
+ children,
1213
+ location: locationProp = "/"
1214
+ }) {
1215
+ if (typeof locationProp === "string") {
1216
+ locationProp = parsePath(locationProp);
1217
+ }
1218
+
1219
+ let action = Action.Pop;
1220
+ let location = {
1221
+ pathname: locationProp.pathname || "/",
1222
+ search: locationProp.search || "",
1223
+ hash: locationProp.hash || "",
1224
+ state: locationProp.state || null,
1225
+ key: locationProp.key || "default"
1226
+ };
1227
+ let staticNavigator = getStatelessNavigator();
1228
+ return /*#__PURE__*/reactExports.createElement(Router, {
1229
+ basename: basename,
1230
+ children: children,
1231
+ location: location,
1232
+ navigationType: action,
1233
+ navigator: staticNavigator,
1234
+ static: true
1235
+ });
1236
+ }
1237
+
1238
+ function getStatelessNavigator() {
1239
+ return {
1240
+ createHref,
1241
+ encodeLocation,
1242
+
1243
+ push(to) {
1244
+ throw new Error(`You cannot use navigator.push() on the server because it is a stateless ` + `environment. This error was probably triggered when you did a ` + `\`navigate(${JSON.stringify(to)})\` somewhere in your app.`);
1245
+ },
1246
+
1247
+ replace(to) {
1248
+ throw new Error(`You cannot use navigator.replace() on the server because it is a stateless ` + `environment. This error was probably triggered when you did a ` + `\`navigate(${JSON.stringify(to)}, { replace: true })\` somewhere ` + `in your app.`);
1249
+ },
1250
+
1251
+ go(delta) {
1252
+ throw new Error(`You cannot use navigator.go() on the server because it is a stateless ` + `environment. This error was probably triggered when you did a ` + `\`navigate(${delta})\` somewhere in your app.`);
1253
+ },
1254
+
1255
+ back() {
1256
+ throw new Error(`You cannot use navigator.back() on the server because it is a stateless ` + `environment.`);
1257
+ },
1258
+
1259
+ forward() {
1260
+ throw new Error(`You cannot use navigator.forward() on the server because it is a stateless ` + `environment.`);
1261
+ }
1262
+
1263
+ };
1264
+ }
1265
+
1266
+ function createHref(to) {
1267
+ return typeof to === "string" ? to : createPath(to);
1268
+ }
1269
+
1270
+ function encodeLocation(to) {
1271
+ // Locations should already be encoded on the server, so just return as-is
1272
+ let path = typeof to === "string" ? parsePath(to) : to;
1273
+ return {
1274
+ pathname: path.pathname || "",
1275
+ search: path.search || "",
1276
+ hash: path.hash || ""
1277
+ };
1278
+ } // This utility is based on https://github.com/zertosh/htmlescape
1279
+
1280
+ var AppServer = function AppServer(_ref) {
1281
+ var url = _ref.url,
1282
+ context = _ref.context,
1283
+ children = _ref.children;
1284
+ return /*#__PURE__*/React.createElement(StaticRouter, {
1285
+ location: url
1286
+ }, /*#__PURE__*/React.createElement(AppContext, {
1287
+ context: context || {}
1288
+ }, children));
1289
+ };
1290
+
1291
+ /**
1292
+ * calustra v0.9.0
1293
+ *
1294
+ * Copyright (c) Donato Lorenzo <donato@afialapis.com>
1295
+ *
1296
+ * This source code is licensed under the MIT license found in the
1297
+ * LICENSE.md file in the root directory of this source tree.
1298
+ *
1299
+ * @license MIT
1300
+ */
1301
+ function ownKeys(object, enumerableOnly) {
1302
+ var keys = Object.keys(object);
1303
+ if (Object.getOwnPropertySymbols) {
1304
+ var symbols = Object.getOwnPropertySymbols(object);
1305
+ enumerableOnly && (symbols = symbols.filter(function (sym) {
1306
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
1307
+ })), keys.push.apply(keys, symbols);
1308
+ }
1309
+ return keys;
1310
+ }
1311
+ function _objectSpread2(target) {
1312
+ for (var i = 1; i < arguments.length; i++) {
1313
+ var source = null != arguments[i] ? arguments[i] : {};
1314
+ i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
1315
+ _defineProperty(target, key, source[key]);
1316
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
1317
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
1318
+ });
1319
+ }
1320
+ return target;
1321
+ }
1322
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
1323
+ try {
1324
+ var info = gen[key](arg);
1325
+ var value = info.value;
1326
+ } catch (error) {
1327
+ reject(error);
1328
+ return;
1329
+ }
1330
+ if (info.done) {
1331
+ resolve(value);
1332
+ } else {
1333
+ Promise.resolve(value).then(_next, _throw);
1334
+ }
1335
+ }
1336
+ function _asyncToGenerator(fn) {
1337
+ return function () {
1338
+ var self = this,
1339
+ args = arguments;
1340
+ return new Promise(function (resolve, reject) {
1341
+ var gen = fn.apply(self, args);
1342
+ function _next(value) {
1343
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
1344
+ }
1345
+ function _throw(err) {
1346
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
1347
+ }
1348
+ _next(undefined);
1349
+ });
1350
+ };
1351
+ }
1352
+ function _defineProperty(obj, key, value) {
1353
+ key = _toPropertyKey(key);
1354
+ if (key in obj) {
1355
+ Object.defineProperty(obj, key, {
1356
+ value: value,
1357
+ enumerable: true,
1358
+ configurable: true,
1359
+ writable: true
1360
+ });
1361
+ } else {
1362
+ obj[key] = value;
1363
+ }
1364
+ return obj;
1365
+ }
1366
+ function _toPrimitive(input, hint) {
1367
+ if (typeof input !== "object" || input === null) return input;
1368
+ var prim = input[Symbol.toPrimitive];
1369
+ if (prim !== undefined) {
1370
+ var res = prim.call(input, hint || "default");
1371
+ if (typeof res !== "object") return res;
1372
+ throw new TypeError("@@toPrimitive must return a primitive value.");
1373
+ }
1374
+ return (hint === "string" ? String : Number)(input);
1375
+ }
1376
+ function _toPropertyKey(arg) {
1377
+ var key = _toPrimitive(arg, "string");
1378
+ return typeof key === "symbol" ? key : String(key);
1379
+ }
1380
+
1381
+ /**
1382
+ * Transform an JSON object to a query string
1383
+ */
1384
+ function json_to_query_string(params) {
1385
+ return '?' + Object.keys(params).map(k => {
1386
+ var name = encodeURIComponent(k);
1387
+ if (Array.isArray(params[k])) {
1388
+ return params[k].map(val => "".concat(name, "[]=").concat(encodeURIComponent(val))).join('&');
1389
+ }
1390
+ return "".concat(name, "=").concat(encodeURIComponent(params[k]));
1391
+ }).join('&');
1392
+ }
1393
+ function trim_left(str, what) {
1394
+ return str.replace(new RegExp("^".concat(what || '\\s', "+")), '');
1395
+ }
1396
+ function omit_nil(obj) {
1397
+ if (typeof obj !== 'object') return obj;
1398
+ return Object.keys(obj).reduce((acc, v) => {
1399
+ if (obj[v] !== undefined) acc[v] = obj[v];
1400
+ return acc;
1401
+ }, {});
1402
+ }
1403
+
1404
+ //function _is_browser() {
1405
+ // try {
1406
+ // return process.env.BROWSER==true
1407
+ // } catch(_) {
1408
+ // return false
1409
+ // }
1410
+ //}
1411
+
1412
+ /**
1413
+ * Prepend host of API server
1414
+ */
1415
+ function _url_make(path) {
1416
+ if (path.indexOf('http') == 0) {
1417
+ return path;
1418
+ //} else if (_is_browser()) {
1419
+ // return '/' + trim_left(path, '/')
1420
+ //} else {
1421
+ // return `https://${location.host}/` + trim_left(path, '/')
1422
+ //}
1423
+ } else {
1424
+ return '/' + trim_left(path, '/');
1425
+ }
1426
+ }
1427
+
1428
+ /**
1429
+ * Decide what to do with the response
1430
+ */
1431
+ function _response_handle(response) {
1432
+ if (response.redirected) {
1433
+ if (typeof window == 'object') {
1434
+ window.location.replace(response.url);
1435
+ }
1436
+ return Promise.resolve(response);
1437
+ }
1438
+ if (response.headers.get('content-type').indexOf('json') >= 0) {
1439
+ return response.json().then(res => {
1440
+ return {
1441
+ data: res,
1442
+ status: response.status
1443
+ };
1444
+ });
1445
+ }
1446
+ return response.text().then(text => {
1447
+ return {
1448
+ data: text,
1449
+ status: response.status
1450
+ };
1451
+ });
1452
+ }
1453
+
1454
+ /**
1455
+ * Build and execute remote request
1456
+ */
1457
+ function calustra_fetch(method, url, params, isMultiForm, auth) {
1458
+ var requestURL = _url_make(url) + (method === 'GET' && params ? json_to_query_string(params) : '');
1459
+ var request = {
1460
+ method,
1461
+ mode: 'cors',
1462
+ credentials: 'include',
1463
+ headers: {
1464
+ 'content-type': 'application/json'
1465
+ }
1466
+ };
1467
+ if (auth) {
1468
+ request.headers['Authorization'] = 'Basic ' + Buffer.from(auth.username + ":" + auth.password).toString('base64');
1469
+ }
1470
+ if (method === 'POST') {
1471
+ if (isMultiForm) {
1472
+ var formData = new FormData();
1473
+ for (var name in params) {
1474
+ formData.append(name, params[name]);
1475
+ }
1476
+ request.body = formData;
1477
+ } else {
1478
+ request.body = JSON.stringify(params || {}, (k, v) => v === undefined ? null : v);
1479
+ }
1480
+ }
1481
+ return fetch(requestURL, request).then(_response_handle);
1482
+ }
1483
+
1484
+ class Fetcher {
1485
+ constructor() {
1486
+ _defineProperty(this, "log_error", (msg, e) => {
1487
+ console.error(msg);
1488
+ console.error(e);
1489
+ });
1490
+ }
1491
+ get(url, params) {
1492
+ var _this = this;
1493
+ return _asyncToGenerator(function* () {
1494
+ /* eslint no-unused-vars:0 */
1495
+ try {
1496
+ var resp = yield calustra_fetch('GET', url, omit_nil(params));
1497
+ return resp;
1498
+ } catch (e) {
1499
+ _this.log_error("Error on GET ".concat(url), e);
1500
+ return {
1501
+ data: undefined,
1502
+ status: -1
1503
+ };
1504
+ }
1505
+ })();
1506
+ }
1507
+ post(url, data) {
1508
+ var _this2 = this;
1509
+ return _asyncToGenerator(function* () {
1510
+ try {
1511
+ var resp = yield calustra_fetch('POST', url, data, false);
1512
+ return resp;
1513
+ } catch (e) {
1514
+ _this2.log_error("Error on POST ".concat(url), e);
1515
+ return {
1516
+ data: undefined,
1517
+ status: -1
1518
+ };
1519
+ }
1520
+ })();
1521
+ }
1522
+ read(url, params) {
1523
+ var _this3 = this;
1524
+ return _asyncToGenerator(function* () {
1525
+ var result = yield _this3.get("".concat(url, "/read"), params);
1526
+ return result.data;
1527
+ })();
1528
+ }
1529
+ key_list(url, params) {
1530
+ var _this4 = this;
1531
+ return _asyncToGenerator(function* () {
1532
+ var result = yield _this4.get("".concat(url, "/key_list"), params);
1533
+ return result.data;
1534
+ })();
1535
+ }
1536
+ name_list(url, params) {
1537
+ var _this5 = this;
1538
+ return _asyncToGenerator(function* () {
1539
+ var result = yield _this5.key_list(url, params);
1540
+ return Object.values(result);
1541
+ })();
1542
+ }
1543
+ find(url, id) {
1544
+ var _this6 = this;
1545
+ return _asyncToGenerator(function* () {
1546
+ var result = yield _this6.get("".concat(url, "/find"), {
1547
+ id: id
1548
+ });
1549
+ return result.data;
1550
+ })();
1551
+ }
1552
+ distinct(url, field, params) {
1553
+ var _this7 = this;
1554
+ return _asyncToGenerator(function* () {
1555
+ var nparams = _objectSpread2(_objectSpread2({}, params), {}, {
1556
+ distinct_field: field
1557
+ });
1558
+ var result = yield _this7.get("".concat(url, "/distinct"), nparams);
1559
+ return result.data;
1560
+ })();
1561
+ }
1562
+ upsave(url, data) {
1563
+ var _this8 = this;
1564
+ return _asyncToGenerator(function* () {
1565
+ var result;
1566
+ if (data.id == undefined) {
1567
+ delete data.id;
1568
+ result = yield _this8.post("".concat(url, "/save"), data);
1569
+ } else {
1570
+ result = yield _this8.post("".concat(url, "/update"), data);
1571
+ }
1572
+ return result.data;
1573
+ })();
1574
+ }
1575
+ remove(url, id) {
1576
+ var _this9 = this;
1577
+ return _asyncToGenerator(function* () {
1578
+ var data = {
1579
+ id: id
1580
+ };
1581
+ var result = yield _this9.post("".concat(url, "/delete"), data);
1582
+ return result.data;
1583
+ })();
1584
+ }
1585
+ }
1586
+ Fetcher.keyList = Fetcher.key_list;
1587
+ Fetcher.nameList = Fetcher.name_list;
1588
+
1589
+ var useFetcher = function useFetcher() {
1590
+ var fetcher = reactExports.useRef(new Fetcher());
1591
+ return fetcher.current;
1592
+ };
1593
+
1594
+ var _getDataFromWindow = function _getDataFromWindow(name) {
1595
+ try {
1596
+ if (window != undefined) {
1597
+ var ssr_data = window.__CONTEXT.ssr_data;
1598
+ if (ssr_data != undefined) {
1599
+ if (ssr_data[name] != undefined) {
1600
+ return ssr_data[name];
1601
+ }
1602
+ }
1603
+ }
1604
+ } catch (e) {}
1605
+ return undefined;
1606
+ };
1607
+ var getSsrDataFromContext = function getSsrDataFromContext(context, name) {
1608
+ var data = undefined;
1609
+ if ((context == null ? void 0 : context.ssr_data) != undefined && (context == null ? void 0 : context.ssr_data[name]) != undefined) {
1610
+ data = context.ssr_data[name];
1611
+ } else {
1612
+ var wdata = _getDataFromWindow(name);
1613
+ if (wdata != undefined) {
1614
+ data = wdata;
1615
+ }
1616
+ }
1617
+ return data;
1618
+ };
1619
+
1620
+ var useSsrData = function useSsrData(context, name, defval) {
1621
+ var ssrDataFromContext = getSsrDataFromContext(context, name);
1622
+ var _useState = reactExports.useState(ssrDataFromContext != undefined ? ssrDataFromContext : defval),
1623
+ ssrData = _useState[0],
1624
+ setSsrData = _useState[1];
1625
+ return [ssrData, setSsrData];
1626
+ };
1627
+
1628
+ var useSsrDataOrReload = function useSsrDataOrReload(context, name, defval, loader) {
1629
+ var ssrDataFromContext = getSsrDataFromContext(context, name);
1630
+ var _useState = reactExports.useState(ssrDataFromContext != undefined ? ssrDataFromContext : defval),
1631
+ ssrData = _useState[0],
1632
+ setSsrData = _useState[1];
1633
+ var _useState2 = reactExports.useState(ssrDataFromContext == undefined),
1634
+ needToRefresh = _useState2[0],
1635
+ setNeedToRefresh = _useState2[1];
1636
+ var refreshSsrData = reactExports.useCallback(function () {
1637
+ function fetchData() {
1638
+ return _fetchData.apply(this, arguments);
1639
+ }
1640
+ function _fetchData() {
1641
+ _fetchData = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
1642
+ var nSsrData;
1643
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
1644
+ while (1) switch (_context.prev = _context.next) {
1645
+ case 0:
1646
+ if (!(loader != undefined)) {
1647
+ _context.next = 5;
1648
+ break;
1649
+ }
1650
+ _context.next = 3;
1651
+ return loader();
1652
+ case 3:
1653
+ nSsrData = _context.sent;
1654
+ setSsrData(nSsrData);
1655
+ case 5:
1656
+ case "end":
1657
+ return _context.stop();
1658
+ }
1659
+ }, _callee);
1660
+ }));
1661
+ return _fetchData.apply(this, arguments);
1662
+ }
1663
+ fetchData();
1664
+ }, [loader]);
1665
+ reactExports.useEffect(function () {
1666
+ try {
1667
+ if (needToRefresh) {
1668
+ setNeedToRefresh(false);
1669
+ refreshSsrData();
1670
+ }
1671
+ } catch (e) {}
1672
+ }, [needToRefresh, refreshSsrData]);
1673
+ return [ssrData, setSsrData, refreshSsrData];
1674
+ };
1675
+
1676
+ exports.AppBrowser = AppBrowser;
1677
+ exports.AppServer = AppServer;
1678
+ exports.useFetcher = useFetcher;
1679
+ exports.useSsrData = useSsrData;
1680
+ exports.useSsrDataOrReload = useSsrDataOrReload;
1681
+ exports.withContext = withContext;
1689
1682
 
1690
1683
  }));
1691
1684
  //# sourceMappingURL=miolo.cli-react.umd.bundle.js.map