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