@startlibs/utils 1.0.4 → 1.1.0
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.
- package/lib/ActionUtils.mjs +117 -0
- package/lib/ActionUtils.mjs.map +1 -0
- package/lib/FetchUtils.mjs +100 -0
- package/lib/FetchUtils.mjs.map +1 -0
- package/lib/createPressEvent.mjs +74 -0
- package/lib/createPressEvent.mjs.map +1 -0
- package/lib/fixMediaQuery.mjs +64 -0
- package/lib/fixMediaQuery.mjs.map +1 -0
- package/lib/formatDate.mjs +110 -0
- package/lib/formatDate.mjs.map +1 -0
- package/lib/formatUtils.mjs +64 -0
- package/lib/formatUtils.mjs.map +1 -0
- package/lib/getClosestOffsetScroll.mjs +15 -0
- package/lib/getClosestOffsetScroll.mjs.map +1 -0
- package/lib/hooks/useEventListener.mjs +27 -0
- package/lib/hooks/useEventListener.mjs.map +1 -0
- package/lib/index.cjs +1811 -0
- package/lib/index.cjs.map +1 -0
- package/lib/index.mjs +19 -0
- package/lib/index.mjs.map +1 -0
- package/lib/lodashUtils.mjs +131 -0
- package/lib/lodashUtils.mjs.map +1 -0
- package/lib/promiseUtils.mjs +92 -0
- package/lib/promiseUtils.mjs.map +1 -0
- package/lib/reactUtils.mjs +12 -0
- package/lib/reactUtils.mjs.map +1 -0
- package/lib/reduceUtils.mjs +14 -0
- package/lib/reduceUtils.mjs.map +1 -0
- package/lib/smoothScroll.mjs +59 -0
- package/lib/smoothScroll.mjs.map +1 -0
- package/lib/styled.mjs +234 -0
- package/lib/styled.mjs.map +1 -0
- package/lib/timeUtils.mjs +81 -0
- package/lib/timeUtils.mjs.map +1 -0
- package/lib/timerUtils.mjs +11 -0
- package/lib/timerUtils.mjs.map +1 -0
- package/lib/utils.mjs +386 -0
- package/lib/utils.mjs.map +1 -0
- package/lib/wrapLazy.mjs +132 -0
- package/lib/wrapLazy.mjs.map +1 -0
- package/package.json +44 -30
- package/src/ActionUtils.js +90 -0
- package/src/FetchUtils.js +87 -0
- package/src/createPressEvent.jsx +79 -0
- package/src/fixMediaQuery.js +71 -0
- package/src/formatDate.js +121 -0
- package/src/formatUtils.jsx +63 -0
- package/src/getClosestOffsetScroll.js +12 -0
- package/src/hooks/useEventListener.js +26 -0
- package/src/index.js +19 -0
- package/src/lodashUtils.jsx +110 -0
- package/src/promiseUtils.jsx +75 -0
- package/src/reactUtils.jsx +7 -0
- package/src/reduceUtils.jsx +6 -0
- package/src/smoothScroll.js +58 -0
- package/src/styled.js +177 -0
- package/src/timeUtils.jsx +57 -0
- package/src/timerUtils.jsx +10 -0
- package/src/utils.jsx +342 -0
- package/src/wrapLazy.jsx +122 -0
- package/.babelrc +0 -26
- package/lib/index.js +0 -2399
- package/rollup.config.js +0 -44
- package/yarn-error.log +0 -3643
package/lib/index.js
DELETED
|
@@ -1,2399 +0,0 @@
|
|
|
1
|
-
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
2
|
-
import _asyncToGenerator from '@babel/runtime/helpers/asyncToGenerator';
|
|
3
|
-
import _regeneratorRuntime from '@babel/runtime/regenerator';
|
|
4
|
-
import _awaitAsyncGenerator from '@babel/runtime/helpers/awaitAsyncGenerator';
|
|
5
|
-
import _wrapAsyncGenerator from '@babel/runtime/helpers/wrapAsyncGenerator';
|
|
6
|
-
import _times from 'lodash/fp/times';
|
|
7
|
-
import _identity from 'lodash/fp/identity';
|
|
8
|
-
import React, { useMemo, useEffect } from 'react';
|
|
9
|
-
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
10
|
-
import _objectSpread from '@babel/runtime/helpers/objectSpread';
|
|
11
|
-
import _isPlainObject from 'lodash/fp/isPlainObject';
|
|
12
|
-
import { callIfFunction as callIfFunction$1, scrollWidth as scrollWidth$1, _s as _s$1, normalizePress as normalizePress$1 } from '@startlibs/utils';
|
|
13
|
-
import _taggedTemplateLiteral from '@babel/runtime/helpers/taggedTemplateLiteral';
|
|
14
|
-
import _typeof from '@babel/runtime/helpers/typeof';
|
|
15
|
-
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
16
|
-
import _find from 'lodash/fp/find';
|
|
17
|
-
import _reverse from 'lodash/fp/reverse';
|
|
18
|
-
import _isEqual from 'lodash/fp/isEqual';
|
|
19
|
-
import _isFunction from 'lodash/fp/isFunction';
|
|
20
|
-
import _get from 'lodash/fp/get';
|
|
21
|
-
import _unset from 'lodash/fp/unset';
|
|
22
|
-
import { darken } from 'polished';
|
|
23
|
-
import styled, { css } from 'styled-components';
|
|
24
|
-
import createEmotion from 'create-emotion';
|
|
25
|
-
import _flow from 'lodash/fp/flow';
|
|
26
|
-
import _without from 'lodash/fp/without';
|
|
27
|
-
import _flatMap from 'lodash/fp/flatMap';
|
|
28
|
-
import _mapValues from 'lodash/fp/mapValues';
|
|
29
|
-
import _map from 'lodash/fp/map';
|
|
30
|
-
import _filter from 'lodash/fp/filter';
|
|
31
|
-
import _each from 'lodash/fp/each';
|
|
32
|
-
import _concat from 'lodash/fp/concat';
|
|
33
|
-
import _assign from 'lodash/fp/assign';
|
|
34
|
-
import _2 from 'lodash/fp/__';
|
|
35
|
-
import _set from 'lodash/fp/set';
|
|
36
|
-
import _update from 'lodash/fp/update';
|
|
37
|
-
import _toPath from 'lodash/fp/toPath';
|
|
38
|
-
import _pullAt from 'lodash/fp/pullAt';
|
|
39
|
-
import _curry from 'lodash/fp/curry';
|
|
40
|
-
import _last from 'lodash/fp/last';
|
|
41
|
-
import _fromPairs from 'lodash/fp/fromPairs';
|
|
42
|
-
import _isFinite from 'lodash/fp/isFinite';
|
|
43
|
-
import _isString from 'lodash/fp/isString';
|
|
44
|
-
import _isNumber from 'lodash/fp/isNumber';
|
|
45
|
-
import _padCharsEnd from 'lodash/fp/padCharsEnd';
|
|
46
|
-
|
|
47
|
-
var createPromiseResolverPair = function createPromiseResolverPair() {
|
|
48
|
-
var res, rej;
|
|
49
|
-
var promise = new Promise(function (res2, rej2) {
|
|
50
|
-
res = res2;
|
|
51
|
-
rej = rej2;
|
|
52
|
-
});
|
|
53
|
-
return [promise, [res, rej]];
|
|
54
|
-
};
|
|
55
|
-
var createSimplePromiseLock = function createSimplePromiseLock() {
|
|
56
|
-
var promiseQueue = Promise.resolve();
|
|
57
|
-
return function () {
|
|
58
|
-
var resolve = _identity;
|
|
59
|
-
var nextPromise = new Promise(function (res) {
|
|
60
|
-
resolve = res;
|
|
61
|
-
});
|
|
62
|
-
var prevPromise = promiseQueue;
|
|
63
|
-
promiseQueue = nextPromise;
|
|
64
|
-
return prevPromise.then(function () {
|
|
65
|
-
return resolve;
|
|
66
|
-
});
|
|
67
|
-
};
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
function createSinglePromiseQueue() {
|
|
71
|
-
return _createSinglePromiseQueue.apply(this, arguments);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
function _createSinglePromiseQueue() {
|
|
75
|
-
_createSinglePromiseQueue = _wrapAsyncGenerator(
|
|
76
|
-
/*#__PURE__*/
|
|
77
|
-
_regeneratorRuntime.mark(function _callee() {
|
|
78
|
-
var lastPromise, resolve;
|
|
79
|
-
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
80
|
-
while (1) {
|
|
81
|
-
switch (_context.prev = _context.next) {
|
|
82
|
-
case 0:
|
|
83
|
-
lastPromise = Promise.resolve();
|
|
84
|
-
/* eslint-disable no-await-in-loop */
|
|
85
|
-
|
|
86
|
-
case 1:
|
|
87
|
-
|
|
88
|
-
_context.next = 4;
|
|
89
|
-
return _awaitAsyncGenerator(lastPromise);
|
|
90
|
-
|
|
91
|
-
case 4:
|
|
92
|
-
resolve = _identity;
|
|
93
|
-
lastPromise = new Promise(function (res) {
|
|
94
|
-
resolve = res;
|
|
95
|
-
});
|
|
96
|
-
_context.next = 8;
|
|
97
|
-
return resolve;
|
|
98
|
-
|
|
99
|
-
case 8:
|
|
100
|
-
_context.next = 1;
|
|
101
|
-
break;
|
|
102
|
-
|
|
103
|
-
case 10:
|
|
104
|
-
case "end":
|
|
105
|
-
return _context.stop();
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
}, _callee, this);
|
|
109
|
-
}));
|
|
110
|
-
return _createSinglePromiseQueue.apply(this, arguments);
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
function createPromiseQueue() {
|
|
114
|
-
return _createPromiseQueue.apply(this, arguments);
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
function _createPromiseQueue() {
|
|
118
|
-
_createPromiseQueue = _wrapAsyncGenerator(
|
|
119
|
-
/*#__PURE__*/
|
|
120
|
-
_regeneratorRuntime.mark(function _callee3() {
|
|
121
|
-
var parallel,
|
|
122
|
-
queues,
|
|
123
|
-
promises,
|
|
124
|
-
locks,
|
|
125
|
-
getNextAvailableLock,
|
|
126
|
-
lock,
|
|
127
|
-
_args3 = arguments;
|
|
128
|
-
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
129
|
-
while (1) {
|
|
130
|
-
switch (_context3.prev = _context3.next) {
|
|
131
|
-
case 0:
|
|
132
|
-
parallel = _args3.length > 0 && _args3[0] !== undefined ? _args3[0] : 1;
|
|
133
|
-
queues = _times(createSinglePromiseQueue, parallel);
|
|
134
|
-
promises = queues.map(function (q) {
|
|
135
|
-
return q.next();
|
|
136
|
-
});
|
|
137
|
-
_context3.next = 5;
|
|
138
|
-
return _awaitAsyncGenerator(Promise.all(promises));
|
|
139
|
-
|
|
140
|
-
case 5:
|
|
141
|
-
locks = _context3.sent;
|
|
142
|
-
|
|
143
|
-
getNextAvailableLock =
|
|
144
|
-
/*#__PURE__*/
|
|
145
|
-
function () {
|
|
146
|
-
var _ref = _asyncToGenerator(
|
|
147
|
-
/*#__PURE__*/
|
|
148
|
-
_regeneratorRuntime.mark(function _callee2() {
|
|
149
|
-
var index, lock;
|
|
150
|
-
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
151
|
-
while (1) {
|
|
152
|
-
switch (_context2.prev = _context2.next) {
|
|
153
|
-
case 0:
|
|
154
|
-
index = locks.findIndex(Boolean);
|
|
155
|
-
|
|
156
|
-
if (!(index >= 0)) {
|
|
157
|
-
_context2.next = 6;
|
|
158
|
-
break;
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
lock = locks[index];
|
|
162
|
-
locks[index] = null;
|
|
163
|
-
promises[index] = queues[index].next().then(function (result) {
|
|
164
|
-
locks[index] = result;
|
|
165
|
-
});
|
|
166
|
-
return _context2.abrupt("return", [lock.value, locks.filter(Boolean).length]);
|
|
167
|
-
|
|
168
|
-
case 6:
|
|
169
|
-
_context2.next = 8;
|
|
170
|
-
return Promise.race(promises);
|
|
171
|
-
|
|
172
|
-
case 8:
|
|
173
|
-
return _context2.abrupt("return", getNextAvailableLock());
|
|
174
|
-
|
|
175
|
-
case 9:
|
|
176
|
-
case "end":
|
|
177
|
-
return _context2.stop();
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
}, _callee2, this);
|
|
181
|
-
}));
|
|
182
|
-
|
|
183
|
-
return function getNextAvailableLock() {
|
|
184
|
-
return _ref.apply(this, arguments);
|
|
185
|
-
};
|
|
186
|
-
}();
|
|
187
|
-
|
|
188
|
-
case 7:
|
|
189
|
-
|
|
190
|
-
_context3.next = 10;
|
|
191
|
-
return _awaitAsyncGenerator(getNextAvailableLock());
|
|
192
|
-
|
|
193
|
-
case 10:
|
|
194
|
-
lock = _context3.sent;
|
|
195
|
-
_context3.next = 13;
|
|
196
|
-
return lock;
|
|
197
|
-
|
|
198
|
-
case 13:
|
|
199
|
-
_context3.next = 7;
|
|
200
|
-
break;
|
|
201
|
-
|
|
202
|
-
case 15:
|
|
203
|
-
case "end":
|
|
204
|
-
return _context3.stop();
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
}, _callee3, this);
|
|
208
|
-
}));
|
|
209
|
-
return _createPromiseQueue.apply(this, arguments);
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
var promiseMapReduce = function promiseMapReduce(arr, callback) {
|
|
213
|
-
return arr.reduce(function (acc, item) {
|
|
214
|
-
return acc.then(function (seq) {
|
|
215
|
-
return callback(item).then(function (res) {
|
|
216
|
-
return _toConsumableArray(seq).concat([res]);
|
|
217
|
-
});
|
|
218
|
-
});
|
|
219
|
-
}, Promise.resolve([]));
|
|
220
|
-
};
|
|
221
|
-
var asyncDebounce = function asyncDebounce(fn) {
|
|
222
|
-
var delay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 200;
|
|
223
|
-
var timeout;
|
|
224
|
-
return function () {
|
|
225
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
226
|
-
args[_key] = arguments[_key];
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
clearTimeout(timeout);
|
|
230
|
-
return new Promise(function (res) {
|
|
231
|
-
timeout = setTimeout(function () {
|
|
232
|
-
return res(fn.apply(void 0, args));
|
|
233
|
-
}, delay);
|
|
234
|
-
});
|
|
235
|
-
};
|
|
236
|
-
};
|
|
237
|
-
|
|
238
|
-
var getClosestOffsetScroll = function getClosestOffsetScroll(node) {
|
|
239
|
-
if (!node) {
|
|
240
|
-
return document.body;
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
var overflowY = window.getComputedStyle(node).overflowY;
|
|
244
|
-
var isScrollable = overflowY !== 'visible' && overflowY !== 'hidden';
|
|
245
|
-
|
|
246
|
-
if (isScrollable && node.scrollHeight > node.clientHeight) {
|
|
247
|
-
return node;
|
|
248
|
-
} else {
|
|
249
|
-
return getClosestOffsetScroll(node.offsetParent);
|
|
250
|
-
}
|
|
251
|
-
};
|
|
252
|
-
|
|
253
|
-
// Get the top position of an element in the document
|
|
254
|
-
var getTop = function getTop(element, start) {
|
|
255
|
-
// return value of html.getBoundingClientRect().top ... IE : 0, other browsers : -pageYOffset
|
|
256
|
-
if (!element || element.nodeName === 'HTML') return -start;
|
|
257
|
-
return element.getBoundingClientRect().top + start;
|
|
258
|
-
}; // ease in out function thanks to:
|
|
259
|
-
// http://blog.greweb.fr/2012/02/bezier-curve-based-easing-functions-from-concept-to-implementation/
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
var easeInOutCubic = function easeInOutCubic(t) {
|
|
263
|
-
return t < .5 ? 4 * t * t * t : (t - 1) * (2 * t - 2) * (2 * t - 2) + 1;
|
|
264
|
-
}; // calculate the scroll position we should be in
|
|
265
|
-
// given the start and end point of the scroll
|
|
266
|
-
// the time elapsed from the beginning of the scroll
|
|
267
|
-
// and the total duration of the scroll (default 500ms)
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
var position = function position(start, end, elapsed, duration) {
|
|
271
|
-
if (elapsed > duration) return end;
|
|
272
|
-
return start + (end - start) * easeInOutCubic(elapsed / duration); // <-- you can change the easing funtion there
|
|
273
|
-
// return start + (end - start) * (elapsed / duration); // <-- this would give a linear scroll
|
|
274
|
-
}; // we use requestAnimationFrame to be called by the browser before every repaint
|
|
275
|
-
// if the first argument is an element then scroll to the top of this element
|
|
276
|
-
// if the first argument is numeric then scroll to this location
|
|
277
|
-
// if the callback exist, it is called when the scrolling is finished
|
|
278
|
-
// if context is set then scroll that element, else scroll window
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
var smoothScroll = function smoothScroll(el) {
|
|
282
|
-
var duration = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 500;
|
|
283
|
-
var callback = arguments.length > 2 ? arguments[2] : undefined;
|
|
284
|
-
var ctx = arguments.length > 3 ? arguments[3] : undefined;
|
|
285
|
-
var context = ctx || window;
|
|
286
|
-
var start = context.scrollTop || window.pageYOffset;
|
|
287
|
-
var offset = el instanceof HTMLElement ? 0 : el.offset || 0;
|
|
288
|
-
var end = offset + (typeof el === 'number' ? Math.round(el) : el instanceof HTMLElement ? getTop(el, start) : getTop(el.target, start));
|
|
289
|
-
var clock = Date.now();
|
|
290
|
-
|
|
291
|
-
var requestAnimationFrame = window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || function (fn) {
|
|
292
|
-
window.setTimeout(fn, 15);
|
|
293
|
-
};
|
|
294
|
-
|
|
295
|
-
var step = function step() {
|
|
296
|
-
var elapsed = Date.now() - clock;
|
|
297
|
-
|
|
298
|
-
if (context !== window) {
|
|
299
|
-
context.scrollTop = position(start, end, elapsed, duration);
|
|
300
|
-
} else {
|
|
301
|
-
window.scroll(window.pageXOffset, position(start, end, elapsed, duration));
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
if (elapsed > duration) {
|
|
305
|
-
if (typeof callback === 'function') {
|
|
306
|
-
callback(el);
|
|
307
|
-
}
|
|
308
|
-
} else {
|
|
309
|
-
requestAnimationFrame(step);
|
|
310
|
-
}
|
|
311
|
-
};
|
|
312
|
-
|
|
313
|
-
step();
|
|
314
|
-
};
|
|
315
|
-
|
|
316
|
-
var fixed = false;
|
|
317
|
-
var scrollWidth = function () {
|
|
318
|
-
if (!window.document) return 0;
|
|
319
|
-
var html = document.documentElement;
|
|
320
|
-
var oldOverflow = html.style.overflowY;
|
|
321
|
-
html.style.overflowY = 'scroll';
|
|
322
|
-
var width = window.innerWidth - html.clientWidth;
|
|
323
|
-
html.style.overflowY = oldOverflow;
|
|
324
|
-
return width;
|
|
325
|
-
}();
|
|
326
|
-
|
|
327
|
-
var fixMediaQueryFn = function fixMediaQueryFn() {
|
|
328
|
-
var fontSize = parseFloat(window.getComputedStyle(document.body).getPropertyValue('font-size'));
|
|
329
|
-
|
|
330
|
-
if (scrollWidth > 0) {
|
|
331
|
-
[].slice.call(document.styleSheets).filter(function (styleSheet) {
|
|
332
|
-
return isValidExternal(styleSheet) || isInline(styleSheet);
|
|
333
|
-
}).forEach(function (stylesheet) {
|
|
334
|
-
try {
|
|
335
|
-
[].slice.call(stylesheet.cssRules || stylesheet.media).filter(function (rule) {
|
|
336
|
-
return rule.constructor === window.CSSMediaRule;
|
|
337
|
-
}).forEach(function (rule) {
|
|
338
|
-
rule.media.mediaText = rule.media.mediaText.replace(/m(in|ax)-width:\s*(\d|\.)+(px|em)/gi, function (strA) {
|
|
339
|
-
if (strA.match('px')) {
|
|
340
|
-
return strA.replace(/\d+px/gi, function (strB) {
|
|
341
|
-
return parseInt(strB, 10) + scrollWidth + 'px';
|
|
342
|
-
});
|
|
343
|
-
} else {
|
|
344
|
-
return strA.replace(/\d.+?em/gi, function (strB) {
|
|
345
|
-
return (parseFloat(strB) * fontSize + scrollWidth) / fontSize + 'em';
|
|
346
|
-
});
|
|
347
|
-
}
|
|
348
|
-
});
|
|
349
|
-
});
|
|
350
|
-
} catch (e) {}
|
|
351
|
-
});
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
fixed = true;
|
|
355
|
-
|
|
356
|
-
function sameOrigin(url) {
|
|
357
|
-
var loc = window.location,
|
|
358
|
-
a = document.createElement('a');
|
|
359
|
-
a.href = url;
|
|
360
|
-
return a.hostname === loc.hostname && a.protocol === loc.protocol;
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
function isInline(stylesheet) {
|
|
364
|
-
try {
|
|
365
|
-
return stylesheet.ownerNode.constructor === HTMLStyleElement && stylesheet.ownerNode.getAttribute("data-styled") === null;
|
|
366
|
-
} catch (e) {
|
|
367
|
-
return stylesheet.ownerNode.constructor === HTMLStyleElement;
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
function isValidExternal(stylesheet) {
|
|
372
|
-
var _stylesheet$ownerNode;
|
|
373
|
-
|
|
374
|
-
return stylesheet.href && (sameOrigin(stylesheet.href) || ((_stylesheet$ownerNode = stylesheet.ownerNode) === null || _stylesheet$ownerNode === void 0 ? void 0 : _stylesheet$ownerNode.crossOrigin) === "anonymous");
|
|
375
|
-
}
|
|
376
|
-
};
|
|
377
|
-
|
|
378
|
-
function fixMediaQuery() {
|
|
379
|
-
if (fixed || !document || !document.readyState) return;
|
|
380
|
-
|
|
381
|
-
if (process.env.NODE_ENV === 'test') {
|
|
382
|
-
return;
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
if (document.readyState !== 'loading') {
|
|
386
|
-
fixMediaQueryFn();
|
|
387
|
-
} else {
|
|
388
|
-
document.addEventListener('DOMContentLoaded', fixMediaQueryFn);
|
|
389
|
-
}
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
var resolveFetch =
|
|
393
|
-
/*#__PURE__*/
|
|
394
|
-
function () {
|
|
395
|
-
var _ref = _asyncToGenerator(
|
|
396
|
-
/*#__PURE__*/
|
|
397
|
-
_regeneratorRuntime.mark(function _callee(url, fetchOptions) {
|
|
398
|
-
var response, text, json;
|
|
399
|
-
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
400
|
-
while (1) {
|
|
401
|
-
switch (_context.prev = _context.next) {
|
|
402
|
-
case 0:
|
|
403
|
-
_context.prev = 0;
|
|
404
|
-
_context.next = 3;
|
|
405
|
-
return fetch(url, _objectSpread({
|
|
406
|
-
credentials: 'same-origin'
|
|
407
|
-
}, fetchOptions));
|
|
408
|
-
|
|
409
|
-
case 3:
|
|
410
|
-
response = _context.sent;
|
|
411
|
-
_context.next = 6;
|
|
412
|
-
return response.text();
|
|
413
|
-
|
|
414
|
-
case 6:
|
|
415
|
-
text = _context.sent;
|
|
416
|
-
_context.prev = 7;
|
|
417
|
-
json = JSON.parse(text);
|
|
418
|
-
return _context.abrupt("return", [json, response]);
|
|
419
|
-
|
|
420
|
-
case 12:
|
|
421
|
-
_context.prev = 12;
|
|
422
|
-
_context.t0 = _context["catch"](7);
|
|
423
|
-
return _context.abrupt("return", [text, response]);
|
|
424
|
-
|
|
425
|
-
case 15:
|
|
426
|
-
_context.next = 20;
|
|
427
|
-
break;
|
|
428
|
-
|
|
429
|
-
case 17:
|
|
430
|
-
_context.prev = 17;
|
|
431
|
-
_context.t1 = _context["catch"](0);
|
|
432
|
-
return _context.abrupt("return", [_context.t1, false]);
|
|
433
|
-
|
|
434
|
-
case 20:
|
|
435
|
-
case "end":
|
|
436
|
-
return _context.stop();
|
|
437
|
-
}
|
|
438
|
-
}
|
|
439
|
-
}, _callee, this, [[0, 17], [7, 12]]);
|
|
440
|
-
}));
|
|
441
|
-
|
|
442
|
-
return function resolveFetch(_x, _x2) {
|
|
443
|
-
return _ref.apply(this, arguments);
|
|
444
|
-
};
|
|
445
|
-
}();
|
|
446
|
-
|
|
447
|
-
var innerFetcher =
|
|
448
|
-
/*#__PURE__*/
|
|
449
|
-
function () {
|
|
450
|
-
var _ref2 = _asyncToGenerator(
|
|
451
|
-
/*#__PURE__*/
|
|
452
|
-
_regeneratorRuntime.mark(function _callee2(url, fetchOptions) {
|
|
453
|
-
var _ref3, _ref4, data, response;
|
|
454
|
-
|
|
455
|
-
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
456
|
-
while (1) {
|
|
457
|
-
switch (_context2.prev = _context2.next) {
|
|
458
|
-
case 0:
|
|
459
|
-
_context2.next = 2;
|
|
460
|
-
return resolveFetch(url, fetchOptions);
|
|
461
|
-
|
|
462
|
-
case 2:
|
|
463
|
-
_ref3 = _context2.sent;
|
|
464
|
-
_ref4 = _slicedToArray(_ref3, 2);
|
|
465
|
-
data = _ref4[0];
|
|
466
|
-
response = _ref4[1];
|
|
467
|
-
|
|
468
|
-
if (!(!response || response.status >= 400)) {
|
|
469
|
-
_context2.next = 10;
|
|
470
|
-
break;
|
|
471
|
-
}
|
|
472
|
-
|
|
473
|
-
throw [data, response];
|
|
474
|
-
|
|
475
|
-
case 10:
|
|
476
|
-
return _context2.abrupt("return", [data, response]);
|
|
477
|
-
|
|
478
|
-
case 11:
|
|
479
|
-
case "end":
|
|
480
|
-
return _context2.stop();
|
|
481
|
-
}
|
|
482
|
-
}
|
|
483
|
-
}, _callee2, this);
|
|
484
|
-
}));
|
|
485
|
-
|
|
486
|
-
return function innerFetcher(_x3, _x4) {
|
|
487
|
-
return _ref2.apply(this, arguments);
|
|
488
|
-
};
|
|
489
|
-
}();
|
|
490
|
-
|
|
491
|
-
var queryStringToObj = function queryStringToObj() {
|
|
492
|
-
var str = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : window.location.search;
|
|
493
|
-
return Object.fromEntries(new URLSearchParams(str).entries());
|
|
494
|
-
};
|
|
495
|
-
var addQueryString = function addQueryString() {
|
|
496
|
-
var existingUrl = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
497
|
-
var obj = arguments.length > 1 ? arguments[1] : undefined;
|
|
498
|
-
|
|
499
|
-
var _existingUrl$split = existingUrl.split('?'),
|
|
500
|
-
_existingUrl$split2 = _slicedToArray(_existingUrl$split, 2),
|
|
501
|
-
onlyUrl = _existingUrl$split2[0],
|
|
502
|
-
otherQueryString = _existingUrl$split2[1];
|
|
503
|
-
|
|
504
|
-
var params = new URLSearchParams(otherQueryString);
|
|
505
|
-
|
|
506
|
-
for (var key in obj) {
|
|
507
|
-
var value = obj[key];
|
|
508
|
-
|
|
509
|
-
if (value === null) {
|
|
510
|
-
params.delete(key);
|
|
511
|
-
} else {
|
|
512
|
-
params.set(key, obj[key]);
|
|
513
|
-
}
|
|
514
|
-
}
|
|
515
|
-
|
|
516
|
-
var paramsStr = params.toString();
|
|
517
|
-
|
|
518
|
-
if (!paramsStr) {
|
|
519
|
-
return onlyUrl;
|
|
520
|
-
}
|
|
521
|
-
|
|
522
|
-
return onlyUrl + '?' + paramsStr;
|
|
523
|
-
};
|
|
524
|
-
|
|
525
|
-
var cleanNulls = function cleanNulls(str) {
|
|
526
|
-
return str.replace(/\0/g, '');
|
|
527
|
-
};
|
|
528
|
-
|
|
529
|
-
var postFetcherWithResponse =
|
|
530
|
-
/*#__PURE__*/
|
|
531
|
-
function () {
|
|
532
|
-
var _ref5 = _asyncToGenerator(
|
|
533
|
-
/*#__PURE__*/
|
|
534
|
-
_regeneratorRuntime.mark(function _callee3(url, jsonOrForm) {
|
|
535
|
-
var fetchOptions,
|
|
536
|
-
_args3 = arguments;
|
|
537
|
-
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
538
|
-
while (1) {
|
|
539
|
-
switch (_context3.prev = _context3.next) {
|
|
540
|
-
case 0:
|
|
541
|
-
fetchOptions = _args3.length > 2 && _args3[2] !== undefined ? _args3[2] : {};
|
|
542
|
-
return _context3.abrupt("return", innerFetcher(url, _objectSpread({
|
|
543
|
-
method: 'POST',
|
|
544
|
-
body: typeof jsonOrForm === 'string' ? jsonOrForm : !jsonOrForm || jsonOrForm.constructor === window.FormData || jsonOrForm.constructor === window.File ? jsonOrForm : cleanNulls(JSON.stringify(jsonOrForm))
|
|
545
|
-
}, fetchOptions, {
|
|
546
|
-
headers: _isPlainObject(fetchOptions.headers) || !fetchOptions.headers ? _objectSpread({}, jsonOrForm && (typeof jsonOrForm === 'string' || jsonOrForm.constructor === window.FormData) ? {} : {
|
|
547
|
-
'Content-Type': 'application/json; charset=UTF-8'
|
|
548
|
-
}, {
|
|
549
|
-
'X-Requested-With': 'XMLHttpRequest'
|
|
550
|
-
}, fetchOptions.headers) : fetchOptions.headers
|
|
551
|
-
})));
|
|
552
|
-
|
|
553
|
-
case 2:
|
|
554
|
-
case "end":
|
|
555
|
-
return _context3.stop();
|
|
556
|
-
}
|
|
557
|
-
}
|
|
558
|
-
}, _callee3, this);
|
|
559
|
-
}));
|
|
560
|
-
|
|
561
|
-
return function postFetcherWithResponse(_x5, _x6) {
|
|
562
|
-
return _ref5.apply(this, arguments);
|
|
563
|
-
};
|
|
564
|
-
}();
|
|
565
|
-
var getFetcherWithResponse =
|
|
566
|
-
/*#__PURE__*/
|
|
567
|
-
function () {
|
|
568
|
-
var _ref6 = _asyncToGenerator(
|
|
569
|
-
/*#__PURE__*/
|
|
570
|
-
_regeneratorRuntime.mark(function _callee4(url, jsonParams, fetchOptions) {
|
|
571
|
-
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
572
|
-
while (1) {
|
|
573
|
-
switch (_context4.prev = _context4.next) {
|
|
574
|
-
case 0:
|
|
575
|
-
return _context4.abrupt("return", innerFetcher(addQueryString(url, jsonParams), _objectSpread({
|
|
576
|
-
method: 'GET'
|
|
577
|
-
}, fetchOptions, {
|
|
578
|
-
headers: _objectSpread({
|
|
579
|
-
'X-Requested-With': 'XMLHttpRequest'
|
|
580
|
-
}, fetchOptions === null || fetchOptions === void 0 ? void 0 : fetchOptions.headers)
|
|
581
|
-
})));
|
|
582
|
-
|
|
583
|
-
case 1:
|
|
584
|
-
case "end":
|
|
585
|
-
return _context4.stop();
|
|
586
|
-
}
|
|
587
|
-
}
|
|
588
|
-
}, _callee4, this);
|
|
589
|
-
}));
|
|
590
|
-
|
|
591
|
-
return function getFetcherWithResponse(_x7, _x8, _x9) {
|
|
592
|
-
return _ref6.apply(this, arguments);
|
|
593
|
-
};
|
|
594
|
-
}();
|
|
595
|
-
var postFetcher =
|
|
596
|
-
/*#__PURE__*/
|
|
597
|
-
function () {
|
|
598
|
-
var _ref7 = _asyncToGenerator(
|
|
599
|
-
/*#__PURE__*/
|
|
600
|
-
_regeneratorRuntime.mark(function _callee5(url, json, options) {
|
|
601
|
-
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
602
|
-
while (1) {
|
|
603
|
-
switch (_context5.prev = _context5.next) {
|
|
604
|
-
case 0:
|
|
605
|
-
return _context5.abrupt("return", postFetcherWithResponse(url, json, options).then(function (_ref8) {
|
|
606
|
-
var _ref9 = _slicedToArray(_ref8, 1),
|
|
607
|
-
json = _ref9[0];
|
|
608
|
-
|
|
609
|
-
return json;
|
|
610
|
-
}));
|
|
611
|
-
|
|
612
|
-
case 1:
|
|
613
|
-
case "end":
|
|
614
|
-
return _context5.stop();
|
|
615
|
-
}
|
|
616
|
-
}
|
|
617
|
-
}, _callee5, this);
|
|
618
|
-
}));
|
|
619
|
-
|
|
620
|
-
return function postFetcher(_x10, _x11, _x12) {
|
|
621
|
-
return _ref7.apply(this, arguments);
|
|
622
|
-
};
|
|
623
|
-
}();
|
|
624
|
-
var getFetcher =
|
|
625
|
-
/*#__PURE__*/
|
|
626
|
-
function () {
|
|
627
|
-
var _ref10 = _asyncToGenerator(
|
|
628
|
-
/*#__PURE__*/
|
|
629
|
-
_regeneratorRuntime.mark(function _callee6(url, json, options) {
|
|
630
|
-
return _regeneratorRuntime.wrap(function _callee6$(_context6) {
|
|
631
|
-
while (1) {
|
|
632
|
-
switch (_context6.prev = _context6.next) {
|
|
633
|
-
case 0:
|
|
634
|
-
return _context6.abrupt("return", getFetcherWithResponse(url, json, options).then(function (_ref11) {
|
|
635
|
-
var _ref12 = _slicedToArray(_ref11, 1),
|
|
636
|
-
json = _ref12[0];
|
|
637
|
-
|
|
638
|
-
return json;
|
|
639
|
-
}));
|
|
640
|
-
|
|
641
|
-
case 1:
|
|
642
|
-
case "end":
|
|
643
|
-
return _context6.stop();
|
|
644
|
-
}
|
|
645
|
-
}
|
|
646
|
-
}, _callee6, this);
|
|
647
|
-
}));
|
|
648
|
-
|
|
649
|
-
return function getFetcher(_x13, _x14, _x15) {
|
|
650
|
-
return _ref10.apply(this, arguments);
|
|
651
|
-
};
|
|
652
|
-
}();
|
|
653
|
-
var formFetchWithResponse = function formFetchWithResponse(url, options) {
|
|
654
|
-
return function (values, meta) {
|
|
655
|
-
return postFetcherWithResponse(callIfFunction$1(url, meta, values), values, callIfFunction$1(options, meta, values));
|
|
656
|
-
};
|
|
657
|
-
};
|
|
658
|
-
var formFetch = function formFetch(url, options) {
|
|
659
|
-
return function (values, meta) {
|
|
660
|
-
return postFetcher(callIfFunction$1(url, meta, values), values, callIfFunction$1(options, meta, values));
|
|
661
|
-
};
|
|
662
|
-
};
|
|
663
|
-
|
|
664
|
-
function _templateObject() {
|
|
665
|
-
var data = _taggedTemplateLiteral(["\n ", ""]);
|
|
666
|
-
|
|
667
|
-
_templateObject = function _templateObject() {
|
|
668
|
-
return data;
|
|
669
|
-
};
|
|
670
|
-
|
|
671
|
-
return data;
|
|
672
|
-
}
|
|
673
|
-
var getColor = function getColor(propsOrColor, hover) {
|
|
674
|
-
if (propsOrColor === undefined) {
|
|
675
|
-
return function (_ref) {
|
|
676
|
-
var theme = _ref.theme;
|
|
677
|
-
return theme.colors.gray150;
|
|
678
|
-
};
|
|
679
|
-
}
|
|
680
|
-
|
|
681
|
-
if (typeof propsOrColor === 'string') {
|
|
682
|
-
return function (_ref2) {
|
|
683
|
-
var theme = _ref2.theme;
|
|
684
|
-
return theme.colors[propsOrColor] || propsOrColor;
|
|
685
|
-
};
|
|
686
|
-
}
|
|
687
|
-
|
|
688
|
-
var theme = propsOrColor.theme,
|
|
689
|
-
props = _objectWithoutProperties(propsOrColor, ["theme"]);
|
|
690
|
-
|
|
691
|
-
if (props.dark) {
|
|
692
|
-
return darken(0.1, getColor(_objectSpread({
|
|
693
|
-
theme: theme
|
|
694
|
-
}, _unset('dark', props))));
|
|
695
|
-
} else if (hover && props.hover) {
|
|
696
|
-
return getColor({
|
|
697
|
-
theme: theme,
|
|
698
|
-
color: props.hover
|
|
699
|
-
});
|
|
700
|
-
} else if (props.color) {
|
|
701
|
-
return theme.colors[props.color] || props.color;
|
|
702
|
-
} else if (props.highlight) {
|
|
703
|
-
return theme.colors.main;
|
|
704
|
-
} else if (props.alert) {
|
|
705
|
-
return theme.colors.alert;
|
|
706
|
-
} else if (props.success) {
|
|
707
|
-
return theme.colors.success;
|
|
708
|
-
} else {
|
|
709
|
-
return theme.colors.gray150;
|
|
710
|
-
}
|
|
711
|
-
};
|
|
712
|
-
var getMargin = function getMargin(enumeratedMargins) {
|
|
713
|
-
return function (props) {
|
|
714
|
-
return enumeratedMargins[props.margin] || props.margin || enumeratedMargins['default'] || 0;
|
|
715
|
-
};
|
|
716
|
-
};
|
|
717
|
-
/**
|
|
718
|
-
* Returns the value of `props[path]` or `defaultValue`
|
|
719
|
-
* @example
|
|
720
|
-
* const Button = styled.button`
|
|
721
|
-
* color: ${prop('color', 'red')};
|
|
722
|
-
* `
|
|
723
|
-
*/
|
|
724
|
-
|
|
725
|
-
var prop = function prop(path, defaultValue) {
|
|
726
|
-
return function () {
|
|
727
|
-
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
728
|
-
return _get(path.trim(), props) || defaultValue;
|
|
729
|
-
};
|
|
730
|
-
};
|
|
731
|
-
var customTheme = function customTheme(type) {
|
|
732
|
-
return function () {
|
|
733
|
-
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
734
|
-
return _get(["theme", "startlibs", type], props) || '';
|
|
735
|
-
};
|
|
736
|
-
};
|
|
737
|
-
/**
|
|
738
|
-
* Returns `pass` if prop is truthy. Otherwise returns `fail`
|
|
739
|
-
* @example
|
|
740
|
-
* // usage with styled-theme
|
|
741
|
-
* import styled from 'styled-components'
|
|
742
|
-
* import { ifProp } from 'styled-tools'
|
|
743
|
-
* import { palette } from 'styled-theme'
|
|
744
|
-
*
|
|
745
|
-
* const Button = styled.button`
|
|
746
|
-
* background-color: ${ifProp('transparent', 'transparent', palette(0))};
|
|
747
|
-
* color: ${ifProp(['transparent', 'accent'], palette('secondary', 0))};
|
|
748
|
-
* font-size: ${ifProp({ size: 'large' }, '20px', ifProp({ size: 'medium' }, '16px', '12px'))};
|
|
749
|
-
*`
|
|
750
|
-
*/
|
|
751
|
-
|
|
752
|
-
var ifProp = function ifProp(path, pass, fail) {
|
|
753
|
-
if (pass && !_isFunction(pass)) {
|
|
754
|
-
// old version
|
|
755
|
-
return function () {
|
|
756
|
-
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
757
|
-
var result = false;
|
|
758
|
-
|
|
759
|
-
if (Array.isArray(path)) {
|
|
760
|
-
result = path.every(function (p) {
|
|
761
|
-
return testSinglePath(props, p);
|
|
762
|
-
});
|
|
763
|
-
} else if (_typeof(path) === 'object') {
|
|
764
|
-
result = !Object.entries(path).find(function (_ref3) {
|
|
765
|
-
var _ref4 = _slicedToArray(_ref3, 2),
|
|
766
|
-
k = _ref4[0],
|
|
767
|
-
v = _ref4[1];
|
|
768
|
-
|
|
769
|
-
return props[k] !== v;
|
|
770
|
-
});
|
|
771
|
-
} else {
|
|
772
|
-
result = testSinglePath(props, path);
|
|
773
|
-
}
|
|
774
|
-
|
|
775
|
-
return result ? pass : fail;
|
|
776
|
-
};
|
|
777
|
-
} else {
|
|
778
|
-
return function () {
|
|
779
|
-
for (var _len = arguments.length, argsTrue = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
780
|
-
argsTrue[_key] = arguments[_key];
|
|
781
|
-
}
|
|
782
|
-
|
|
783
|
-
var check = pass || _identity;
|
|
784
|
-
|
|
785
|
-
var fn = function fn(props) {
|
|
786
|
-
return check(_get(path, props)) ? css.apply(void 0, argsTrue) : '';
|
|
787
|
-
};
|
|
788
|
-
|
|
789
|
-
fn.orElse = function () {
|
|
790
|
-
for (var _len2 = arguments.length, argsFalse = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
791
|
-
argsFalse[_key2] = arguments[_key2];
|
|
792
|
-
}
|
|
793
|
-
|
|
794
|
-
return function (props) {
|
|
795
|
-
return check(_get(path, props)) ? css.apply(void 0, argsTrue) : css.apply(void 0, argsFalse);
|
|
796
|
-
};
|
|
797
|
-
};
|
|
798
|
-
|
|
799
|
-
return fn;
|
|
800
|
-
};
|
|
801
|
-
}
|
|
802
|
-
};
|
|
803
|
-
var ifPropEquals = function ifPropEquals(path, str) {
|
|
804
|
-
return ifProp(path, _isEqual(str));
|
|
805
|
-
};
|
|
806
|
-
var ifNotProp = function ifNotProp(path) {
|
|
807
|
-
return ifProp(path, function (v) {
|
|
808
|
-
return !v;
|
|
809
|
-
});
|
|
810
|
-
};
|
|
811
|
-
|
|
812
|
-
var checkCustomScreenWidth = function checkCustomScreenWidth(sizeParis, customWidth) {
|
|
813
|
-
var currentWidth = callIfFunction$1(customWidth);
|
|
814
|
-
return !sizeParis.find(function (_ref5) {
|
|
815
|
-
var _ref6 = _slicedToArray(_ref5, 2),
|
|
816
|
-
size = _ref6[0],
|
|
817
|
-
type = _ref6[1];
|
|
818
|
-
|
|
819
|
-
if (type === "min-width") {
|
|
820
|
-
return currentWidth < size;
|
|
821
|
-
}
|
|
822
|
-
|
|
823
|
-
if (type === "max-width") {
|
|
824
|
-
return currentWidth > size;
|
|
825
|
-
}
|
|
826
|
-
});
|
|
827
|
-
};
|
|
828
|
-
|
|
829
|
-
var media = function media() {
|
|
830
|
-
for (var _len3 = arguments.length, sizePairs = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
831
|
-
sizePairs[_key3] = arguments[_key3];
|
|
832
|
-
}
|
|
833
|
-
|
|
834
|
-
return function () {
|
|
835
|
-
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
|
836
|
-
args[_key4] = arguments[_key4];
|
|
837
|
-
}
|
|
838
|
-
|
|
839
|
-
return css(["", ""], function (props) {
|
|
840
|
-
var _props$theme, _props$theme2;
|
|
841
|
-
|
|
842
|
-
return ((_props$theme = props.theme) === null || _props$theme === void 0 ? void 0 : _props$theme.overrideMediaWidth) ? checkCustomScreenWidth(sizePairs, (_props$theme2 = props.theme) === null || _props$theme2 === void 0 ? void 0 : _props$theme2.overrideMediaWidth) ? css.apply(void 0, args) : "" : css(["@media ", "{", "}"], sizePairs.map(function (_ref7) {
|
|
843
|
-
var _ref8 = _slicedToArray(_ref7, 2),
|
|
844
|
-
size = _ref8[0],
|
|
845
|
-
type = _ref8[1];
|
|
846
|
-
|
|
847
|
-
return "(".concat(type, ": ").concat(size + scrollWidth$1, "px)");
|
|
848
|
-
}).join(' and '), css.apply(void 0, args));
|
|
849
|
-
});
|
|
850
|
-
};
|
|
851
|
-
};
|
|
852
|
-
media.mobile = media([600, 'max-width']);
|
|
853
|
-
|
|
854
|
-
media.between = function (min, max) {
|
|
855
|
-
return media([min, 'min-width'], [max, 'max-width']);
|
|
856
|
-
};
|
|
857
|
-
|
|
858
|
-
media.max = function (n) {
|
|
859
|
-
return media([n, 'max-width']);
|
|
860
|
-
};
|
|
861
|
-
|
|
862
|
-
media.min = function (n) {
|
|
863
|
-
return media([n, 'min-width']);
|
|
864
|
-
};
|
|
865
|
-
|
|
866
|
-
media.desktop = media([601, 'min-width']);
|
|
867
|
-
var vheight = function vheight(strings, size) {
|
|
868
|
-
var propType = strings[0];
|
|
869
|
-
var calc = (strings[1] || "").replace(";", "").trim();
|
|
870
|
-
return "\n ".concat(propType, " ").concat(calc ? "calc(".concat(size, "vh ").concat(calc, ")") : "".concat(size, "vh"), ";\n ").concat(propType, " ").concat(calc ? "calc(calc(var(--vh, 1vh) * ".concat(size, ") ").concat(calc, ")") : "calc(var(--vh, 1vh) * ".concat(size, ")"), ";\n ");
|
|
871
|
-
};
|
|
872
|
-
|
|
873
|
-
function testSinglePath(props, path) {
|
|
874
|
-
if (typeof path === 'string') {
|
|
875
|
-
return !!_s$1.get(path, props);
|
|
876
|
-
} else if (typeof path === 'number') {
|
|
877
|
-
return !!props[path];
|
|
878
|
-
} else {
|
|
879
|
-
return false;
|
|
880
|
-
}
|
|
881
|
-
}
|
|
882
|
-
|
|
883
|
-
var getFrameOffset = function getFrameOffset(i, total) {
|
|
884
|
-
return Math.round(i * 100 / (total - 1));
|
|
885
|
-
};
|
|
886
|
-
|
|
887
|
-
var emotion = createEmotion({
|
|
888
|
-
nonce: typeof document !== 'undefined' && (document.querySelector('meta[property="csp-nonce"]') || {}).content || 'animation_nonce'
|
|
889
|
-
});
|
|
890
|
-
var oneWayAnimation = function oneWayAnimation() {
|
|
891
|
-
for (var _len5 = arguments.length, frames = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
|
|
892
|
-
frames[_key5] = arguments[_key5];
|
|
893
|
-
}
|
|
894
|
-
|
|
895
|
-
return emotion.keyframes(_templateObject(), frames.map(function (frame, i) {
|
|
896
|
-
return !frame ? '' : "".concat(getFrameOffset(i, frames.length), "% {\n ").concat(frame, "\n }");
|
|
897
|
-
}));
|
|
898
|
-
};
|
|
899
|
-
var twoWayAnimation = function twoWayAnimation() {
|
|
900
|
-
for (var _len6 = arguments.length, frames = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
|
|
901
|
-
frames[_key6] = arguments[_key6];
|
|
902
|
-
}
|
|
903
|
-
|
|
904
|
-
return [frames, _reverse(frames)].map(function (frames) {
|
|
905
|
-
return oneWayAnimation.apply(void 0, _toConsumableArray(frames));
|
|
906
|
-
});
|
|
907
|
-
};
|
|
908
|
-
var animationTiming = function animationTiming(props) {
|
|
909
|
-
return function () {
|
|
910
|
-
for (var _len7 = arguments.length, animations = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
|
|
911
|
-
animations[_key7] = arguments[_key7];
|
|
912
|
-
}
|
|
913
|
-
|
|
914
|
-
return animations.filter(function (_) {
|
|
915
|
-
return _;
|
|
916
|
-
}).map(function (_) {
|
|
917
|
-
return _ + ' ' + props;
|
|
918
|
-
}).join(',');
|
|
919
|
-
};
|
|
920
|
-
};
|
|
921
|
-
var identityTranslateFrames = oneWayAnimation('transform: translateY(0);', 'transform: translateY(0);');
|
|
922
|
-
var identityOpacityFrames = oneWayAnimation('opacity: 1;', 'opacity:1;');
|
|
923
|
-
var styledExtend = function styledExtend(_ref9) {
|
|
924
|
-
var target = _ref9.target,
|
|
925
|
-
componentStyle = _ref9.componentStyle;
|
|
926
|
-
return function () {
|
|
927
|
-
var wasStatic = !_find(_isFunction, componentStyle.rules);
|
|
928
|
-
|
|
929
|
-
for (var _len8 = arguments.length, template = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {
|
|
930
|
-
template[_key8] = arguments[_key8];
|
|
931
|
-
}
|
|
932
|
-
|
|
933
|
-
var v = styled(target).apply(void 0, template.concat(_toConsumableArray(wasStatic ? [] : [function () {
|
|
934
|
-
return "";
|
|
935
|
-
}])));
|
|
936
|
-
v.componentStyle.rules = _toConsumableArray(componentStyle.rules).concat(_toConsumableArray(v.componentStyle.rules));
|
|
937
|
-
return v;
|
|
938
|
-
};
|
|
939
|
-
};
|
|
940
|
-
var printerMedia = function printerMedia() {
|
|
941
|
-
for (var _len9 = arguments.length, args = new Array(_len9), _key9 = 0; _key9 < _len9; _key9++) {
|
|
942
|
-
args[_key9] = arguments[_key9];
|
|
943
|
-
}
|
|
944
|
-
|
|
945
|
-
return function (props) {
|
|
946
|
-
return props.theme.printMode ? css.apply(void 0, args) : css(["@media print{", "}"], css.apply(void 0, args));
|
|
947
|
-
};
|
|
948
|
-
};
|
|
949
|
-
var notPrinterMedia = function notPrinterMedia() {
|
|
950
|
-
for (var _len10 = arguments.length, args = new Array(_len10), _key10 = 0; _key10 < _len10; _key10++) {
|
|
951
|
-
args[_key10] = arguments[_key10];
|
|
952
|
-
}
|
|
953
|
-
|
|
954
|
-
return function (props) {
|
|
955
|
-
return props.theme.printMode ? '' : css(["@media screen{", "}"], css.apply(void 0, args));
|
|
956
|
-
};
|
|
957
|
-
};
|
|
958
|
-
|
|
959
|
-
var escapedValidParts = /(^|[^\\])(dd?|DD?|mm?|LL?|hh?|MM?|ss|SSS|yy(?:yy)?)/g;
|
|
960
|
-
var validParts = /(dd?|DD?|mm?|LL?|hh?|MM?|yy(?:yy)|yy|ss|SSS)$/;
|
|
961
|
-
var addZero = function addZero(v) {
|
|
962
|
-
return (v < 10 ? '0' : '') + v;
|
|
963
|
-
};
|
|
964
|
-
|
|
965
|
-
var getSet = function getSet(index, ttype) {
|
|
966
|
-
var plus = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
967
|
-
var format = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : function (v) {
|
|
968
|
-
return v;
|
|
969
|
-
};
|
|
970
|
-
var parse = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : function (v, defaultDate) {
|
|
971
|
-
return v === '0' ? '' : v;
|
|
972
|
-
};
|
|
973
|
-
return [function (date, _, noUTC) {
|
|
974
|
-
return format((typeof date === 'number' ? new Date(date) : date)['get' + (noUTC ? '' : 'UTC') + ttype]() + plus);
|
|
975
|
-
}, function (unformatedStr, date, _, failOnFormat, noUTC) {
|
|
976
|
-
var str = parse(unformatedStr, date, failOnFormat);
|
|
977
|
-
if (str === '' || isNaN(date.getTime())) return date;
|
|
978
|
-
if (str === '\0') return date.setTime(NaN);
|
|
979
|
-
var utcSTR = noUTC ? '' : 'UTC';
|
|
980
|
-
var v = parseInt(str, 10) - plus;
|
|
981
|
-
var prevDay = date['get' + utcSTR + 'Date']();
|
|
982
|
-
|
|
983
|
-
if (ttype !== 'Date') {
|
|
984
|
-
date['set' + utcSTR + 'Date'](1);
|
|
985
|
-
}
|
|
986
|
-
|
|
987
|
-
date['set' + utcSTR + ttype](v);
|
|
988
|
-
|
|
989
|
-
if (date['get' + utcSTR + ttype]() !== v) {
|
|
990
|
-
date['set' + utcSTR + ttype](NaN);
|
|
991
|
-
return date;
|
|
992
|
-
}
|
|
993
|
-
|
|
994
|
-
if (ttype !== 'Date') {
|
|
995
|
-
date['set' + utcSTR + 'Date'](prevDay);
|
|
996
|
-
|
|
997
|
-
if (date['get' + utcSTR + ttype]() !== v) {
|
|
998
|
-
date['set' + utcSTR + 'Date'](0);
|
|
999
|
-
return date;
|
|
1000
|
-
}
|
|
1001
|
-
}
|
|
1002
|
-
|
|
1003
|
-
return date;
|
|
1004
|
-
}, index];
|
|
1005
|
-
};
|
|
1006
|
-
|
|
1007
|
-
var getText = function getText(type, total) {
|
|
1008
|
-
var slice = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 99;
|
|
1009
|
-
return [function (date, messages, noUTC) {
|
|
1010
|
-
return messages(type.toLowerCase(), date['get' + (noUTC ? '' : 'UTC') + type]()).slice(0, slice);
|
|
1011
|
-
}];
|
|
1012
|
-
};
|
|
1013
|
-
|
|
1014
|
-
var yearParse = function yearParse(y, date, failOnFormat) {
|
|
1015
|
-
var formattedY = y.length === 2 && y !== '20' ? '20' + y : y.length === 4 ? y : '';
|
|
1016
|
-
|
|
1017
|
-
if (formattedY === '') {
|
|
1018
|
-
if (failOnFormat) {
|
|
1019
|
-
var found = date.getUTCFullYear().toString().indexOf(y);
|
|
1020
|
-
return found === 0 || found === 2 ? date.getUTCFullYear() : '\0';
|
|
1021
|
-
} else {
|
|
1022
|
-
return date.getUTCFullYear();
|
|
1023
|
-
}
|
|
1024
|
-
} else {
|
|
1025
|
-
return formattedY;
|
|
1026
|
-
}
|
|
1027
|
-
};
|
|
1028
|
-
|
|
1029
|
-
var val = {
|
|
1030
|
-
yyyy: getSet(0, 'FullYear', 0, function (v) {
|
|
1031
|
-
return v;
|
|
1032
|
-
}, yearParse),
|
|
1033
|
-
yy: getSet(0, 'FullYear', 0, function (v) {
|
|
1034
|
-
return (v + "").slice(2, 4);
|
|
1035
|
-
}, yearParse),
|
|
1036
|
-
M: getSet(1, 'Month', 1),
|
|
1037
|
-
MM: getSet(1, 'Month', 1, addZero),
|
|
1038
|
-
L: getText('Month', 12, 3),
|
|
1039
|
-
LL: getText('Month', 12),
|
|
1040
|
-
d: getSet(2, 'Date'),
|
|
1041
|
-
dd: getSet(2, 'Date', 0, addZero),
|
|
1042
|
-
D: getText('Day', 7, 3),
|
|
1043
|
-
DD: getText('Day', 7),
|
|
1044
|
-
m: getSet(4, 'Minutes'),
|
|
1045
|
-
mm: getSet(4, 'Minutes', 0, addZero),
|
|
1046
|
-
h: getSet(5, 'Hours'),
|
|
1047
|
-
hh: getSet(5, 'Hours', 0, addZero),
|
|
1048
|
-
ss: getSet(6, 'Seconds', 0, addZero),
|
|
1049
|
-
SSS: getSet(7, 'Milliseconds', 0, addZero)
|
|
1050
|
-
};
|
|
1051
|
-
function formatDateToPattern(format) {
|
|
1052
|
-
return format.replace(escapedValidParts, function (_, _1, _2) {
|
|
1053
|
-
return _1 + (_2 === 'yy' ? '##' : _2 === 'yyyy' ? '####' : '0#');
|
|
1054
|
-
});
|
|
1055
|
-
}
|
|
1056
|
-
function formatDate(date, format, messages, noUTC) {
|
|
1057
|
-
if (!date) return '';
|
|
1058
|
-
var separators = format.replace(escapedValidParts, '\0').split('\0');
|
|
1059
|
-
var parts = format.match(escapedValidParts);
|
|
1060
|
-
var formattedDate = parts.reduce(function (acc, part) {
|
|
1061
|
-
return acc.concat(separators.length ? [separators.shift()] : [], part.replace(validParts, ''), val[part.match(validParts)[0]][0](date, messages, noUTC));
|
|
1062
|
-
}, []);
|
|
1063
|
-
return formattedDate.join('').replace(/\\([dDmLhMy])/g, '$1');
|
|
1064
|
-
}
|
|
1065
|
-
|
|
1066
|
-
var now = function now() {
|
|
1067
|
-
return new Date();
|
|
1068
|
-
};
|
|
1069
|
-
|
|
1070
|
-
function parseDate(str, possibleDate, format, messages, failOnFormat, noUTC) {
|
|
1071
|
-
if (!str) return possibleDate;
|
|
1072
|
-
var separators = format.replace(escapedValidParts, '\0').split('\0');
|
|
1073
|
-
var parts = format.match(escapedValidParts);
|
|
1074
|
-
var mutations = [];
|
|
1075
|
-
parts.reduce(function (rest, part, i) {
|
|
1076
|
-
var separator = (separators.length ? separators.shift() : '') + part.replace(validParts, '');
|
|
1077
|
-
var current = rest.slice(separator.length);
|
|
1078
|
-
|
|
1079
|
-
if (current && separator === rest.slice(0, separator.length)) {
|
|
1080
|
-
var setType = part.match(validParts)[0];
|
|
1081
|
-
var nextSeparator = separators[0];
|
|
1082
|
-
var nextStrIndex = current.indexOf(nextSeparator + (parts[i + 1] || '').replace(validParts, ''));
|
|
1083
|
-
mutations[val[setType][2]] = [val[setType][1], nextStrIndex ? current.slice(0, nextStrIndex) : current];
|
|
1084
|
-
return current.slice(nextStrIndex);
|
|
1085
|
-
} else {
|
|
1086
|
-
return '';
|
|
1087
|
-
}
|
|
1088
|
-
}, str);
|
|
1089
|
-
var date = possibleDate && possibleDate.getTime() !== -1 ? new Date(possibleDate) : now();
|
|
1090
|
-
mutations.forEach(function (_ref) {
|
|
1091
|
-
var _ref2 = _slicedToArray(_ref, 2),
|
|
1092
|
-
setter = _ref2[0],
|
|
1093
|
-
text = _ref2[1];
|
|
1094
|
-
|
|
1095
|
-
return setter(text, date, messages, failOnFormat, noUTC);
|
|
1096
|
-
});
|
|
1097
|
-
return date;
|
|
1098
|
-
}
|
|
1099
|
-
|
|
1100
|
-
var moveElement = _curry(function (from, to, list) {
|
|
1101
|
-
var el = list[from];
|
|
1102
|
-
|
|
1103
|
-
var without = _pullAt(from, list);
|
|
1104
|
-
|
|
1105
|
-
without.splice(to, 0, el);
|
|
1106
|
-
return without;
|
|
1107
|
-
});
|
|
1108
|
-
|
|
1109
|
-
var unsetOrRemoveAt = _curry(function (path, value) {
|
|
1110
|
-
var pathArr = toPath(path);
|
|
1111
|
-
|
|
1112
|
-
var _pathArr$slice = pathArr.slice(-1),
|
|
1113
|
-
_pathArr$slice2 = _slicedToArray(_pathArr$slice, 1),
|
|
1114
|
-
lastKey = _pathArr$slice2[0];
|
|
1115
|
-
|
|
1116
|
-
return update(pathArr.slice(0, -1), function (v) {
|
|
1117
|
-
return Array.isArray(v) ? removeAt(lastKey, v) : unset(lastKey, v);
|
|
1118
|
-
}, value);
|
|
1119
|
-
});
|
|
1120
|
-
|
|
1121
|
-
var pathToString = function pathToString(path) {
|
|
1122
|
-
return toPath(path).join(".");
|
|
1123
|
-
};
|
|
1124
|
-
|
|
1125
|
-
var sanitizePath = function sanitizePath(path) {
|
|
1126
|
-
return Array.isArray(path) ? path.map(sanitizePath) : typeof path === 'number' ? path.toString() : path === undefined ? [] : path;
|
|
1127
|
-
};
|
|
1128
|
-
|
|
1129
|
-
var toPath = function toPath(path) {
|
|
1130
|
-
return _toPath(sanitizePath(path));
|
|
1131
|
-
};
|
|
1132
|
-
|
|
1133
|
-
var isEmptyPath = function isEmptyPath(path) {
|
|
1134
|
-
return path && !path.length;
|
|
1135
|
-
};
|
|
1136
|
-
|
|
1137
|
-
var update = _curry(function (path, updater, state) {
|
|
1138
|
-
var sanitizedPath = sanitizePath(path);
|
|
1139
|
-
|
|
1140
|
-
if (isEmptyPath(sanitizedPath)) {
|
|
1141
|
-
return updater(state);
|
|
1142
|
-
} else {
|
|
1143
|
-
return _update(sanitizedPath, updater, state);
|
|
1144
|
-
}
|
|
1145
|
-
});
|
|
1146
|
-
|
|
1147
|
-
var get = _curry(function (path, state) {
|
|
1148
|
-
var sanitizedPath = sanitizePath(path);
|
|
1149
|
-
|
|
1150
|
-
if (isEmptyPath(sanitizedPath)) {
|
|
1151
|
-
return state;
|
|
1152
|
-
} else {
|
|
1153
|
-
return _get(sanitizedPath, state);
|
|
1154
|
-
}
|
|
1155
|
-
});
|
|
1156
|
-
|
|
1157
|
-
var set = _curry(function (path, value, state) {
|
|
1158
|
-
var sanitizedPath = sanitizePath(path);
|
|
1159
|
-
|
|
1160
|
-
if (isEmptyPath(sanitizedPath)) {
|
|
1161
|
-
return value;
|
|
1162
|
-
} else {
|
|
1163
|
-
return _set(sanitizedPath, value, state);
|
|
1164
|
-
}
|
|
1165
|
-
});
|
|
1166
|
-
|
|
1167
|
-
var unset = _curry(function (path, state) {
|
|
1168
|
-
var sanitizedPath = sanitizePath(path);
|
|
1169
|
-
|
|
1170
|
-
if (isEmptyPath(sanitizedPath)) {
|
|
1171
|
-
return undefined;
|
|
1172
|
-
} else {
|
|
1173
|
-
return _unset(sanitizedPath, state);
|
|
1174
|
-
}
|
|
1175
|
-
});
|
|
1176
|
-
|
|
1177
|
-
var removeNAt = _curry(function (pos, n, value) {
|
|
1178
|
-
return _toConsumableArray(value.slice(0, Number(pos))).concat(_toConsumableArray(value.slice(Number(pos) + n)));
|
|
1179
|
-
});
|
|
1180
|
-
|
|
1181
|
-
var removeAt = removeNAt(_2, 1);
|
|
1182
|
-
|
|
1183
|
-
var when = _curry(function (cond, fn, value) {
|
|
1184
|
-
return callIfFunction$1(cond, value) ? fn(value) : value;
|
|
1185
|
-
});
|
|
1186
|
-
|
|
1187
|
-
var assign = _curry(function (a, b) {
|
|
1188
|
-
return _assign(b, a);
|
|
1189
|
-
});
|
|
1190
|
-
|
|
1191
|
-
var concat = _curry(function (a, b) {
|
|
1192
|
-
return _concat(b, a);
|
|
1193
|
-
});
|
|
1194
|
-
|
|
1195
|
-
var each = _each.convert({
|
|
1196
|
-
cap: false
|
|
1197
|
-
});
|
|
1198
|
-
|
|
1199
|
-
var find = _find.convert({
|
|
1200
|
-
cap: false
|
|
1201
|
-
});
|
|
1202
|
-
|
|
1203
|
-
var filter = _filter.convert({
|
|
1204
|
-
cap: false
|
|
1205
|
-
});
|
|
1206
|
-
|
|
1207
|
-
var map = _map.convert({
|
|
1208
|
-
cap: false
|
|
1209
|
-
});
|
|
1210
|
-
|
|
1211
|
-
var mapValues = _mapValues.convert({
|
|
1212
|
-
cap: false
|
|
1213
|
-
});
|
|
1214
|
-
|
|
1215
|
-
var flatMap = _flatMap.convert({
|
|
1216
|
-
cap: false
|
|
1217
|
-
});
|
|
1218
|
-
|
|
1219
|
-
var insertAt = _curry(function (pos, newElements, value) {
|
|
1220
|
-
return _toConsumableArray(value.slice(0, pos).concat(newElements)).concat(_toConsumableArray(value.slice(pos)));
|
|
1221
|
-
});
|
|
1222
|
-
|
|
1223
|
-
var select = _curry(function (selector, value) {
|
|
1224
|
-
return (_isFunction(selector) ? selector : selector ? _get(selector) : _identity)(value);
|
|
1225
|
-
});
|
|
1226
|
-
|
|
1227
|
-
var itemToggle = _curry(function (item, list) {
|
|
1228
|
-
return (list || []).indexOf(item) >= 0 ? _without([item], list) : _toConsumableArray(list || []).concat([item]);
|
|
1229
|
-
});
|
|
1230
|
-
|
|
1231
|
-
var _s = {
|
|
1232
|
-
moveElement: moveElement,
|
|
1233
|
-
unsetOrRemoveAt: unsetOrRemoveAt,
|
|
1234
|
-
pathToString: pathToString,
|
|
1235
|
-
toPath: toPath,
|
|
1236
|
-
update: update,
|
|
1237
|
-
get: get,
|
|
1238
|
-
set: set,
|
|
1239
|
-
select: select,
|
|
1240
|
-
unset: unset,
|
|
1241
|
-
removeNAt: removeNAt,
|
|
1242
|
-
removeAt: removeAt,
|
|
1243
|
-
itemToggle: itemToggle,
|
|
1244
|
-
when: when,
|
|
1245
|
-
assign: assign,
|
|
1246
|
-
concat: concat,
|
|
1247
|
-
each: each,
|
|
1248
|
-
find: find,
|
|
1249
|
-
filter: filter,
|
|
1250
|
-
map: map,
|
|
1251
|
-
flatMap: flatMap,
|
|
1252
|
-
mapValues: mapValues,
|
|
1253
|
-
insertAt: insertAt,
|
|
1254
|
-
flowEach: function flowEach() {
|
|
1255
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
1256
|
-
args[_key] = arguments[_key];
|
|
1257
|
-
}
|
|
1258
|
-
|
|
1259
|
-
return _flow.apply(void 0, _toConsumableArray(args.filter(Boolean)));
|
|
1260
|
-
}
|
|
1261
|
-
};
|
|
1262
|
-
|
|
1263
|
-
var isNotSelector = function isNotSelector(v) {
|
|
1264
|
-
return typeof v !== 'function' || v.length === 0;
|
|
1265
|
-
};
|
|
1266
|
-
|
|
1267
|
-
var toSelector = function toSelector(v) {
|
|
1268
|
-
return isNotSelector(v) ? function (s) {
|
|
1269
|
-
return _s$1.get(callIfFunction$1(v), s);
|
|
1270
|
-
} : v;
|
|
1271
|
-
};
|
|
1272
|
-
|
|
1273
|
-
var mergeSelectors = function mergeSelectors(prev, next) {
|
|
1274
|
-
return function (v) {
|
|
1275
|
-
return next(prev(v));
|
|
1276
|
-
};
|
|
1277
|
-
};
|
|
1278
|
-
|
|
1279
|
-
var concatSelectors = function concatSelectors() {
|
|
1280
|
-
for (var _len = arguments.length, paths = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
1281
|
-
paths[_key] = arguments[_key];
|
|
1282
|
-
}
|
|
1283
|
-
|
|
1284
|
-
return paths.reduce(function (_ref, path) {
|
|
1285
|
-
var _ref2 = _slicedToArray(_ref, 2),
|
|
1286
|
-
selector = _ref2[0],
|
|
1287
|
-
isSelector = _ref2[1];
|
|
1288
|
-
|
|
1289
|
-
return isNotSelector(path) && !isSelector ? [selector.concat(path), false] : [mergeSelectors(toSelector(selector), path), true];
|
|
1290
|
-
}, [[], false]);
|
|
1291
|
-
};
|
|
1292
|
-
var COMPLETE_ACTION = {};
|
|
1293
|
-
var REDUCE = {};
|
|
1294
|
-
var FETCH = {};
|
|
1295
|
-
var SKIP_FETCH = {};
|
|
1296
|
-
var SKIP_DISPATCH = {};
|
|
1297
|
-
var SKIPPED_ACTION = {};
|
|
1298
|
-
var selectPath = function selectPath(useState) {
|
|
1299
|
-
for (var _len2 = arguments.length, paths = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
1300
|
-
paths[_key2 - 1] = arguments[_key2];
|
|
1301
|
-
}
|
|
1302
|
-
|
|
1303
|
-
var _useMemo = useMemo(function () {
|
|
1304
|
-
return concatSelectors.apply(void 0, paths);
|
|
1305
|
-
}, paths),
|
|
1306
|
-
_useMemo2 = _slicedToArray(_useMemo, 1),
|
|
1307
|
-
selector = _useMemo2[0];
|
|
1308
|
-
|
|
1309
|
-
var _useState = useState(selector),
|
|
1310
|
-
_useState2 = _slicedToArray(_useState, 1),
|
|
1311
|
-
value = _useState2[0];
|
|
1312
|
-
|
|
1313
|
-
return value;
|
|
1314
|
-
};
|
|
1315
|
-
var Action = function Action(fnOrArray) {
|
|
1316
|
-
var prevArgs = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
1317
|
-
var isArray = Array.isArray(fnOrArray);
|
|
1318
|
-
|
|
1319
|
-
if (isArray) {
|
|
1320
|
-
// excessive paramaeters called on the action, used for options.
|
|
1321
|
-
var actionType = _last(prevArgs);
|
|
1322
|
-
|
|
1323
|
-
var _fnOrArray = _slicedToArray(fnOrArray, 3),
|
|
1324
|
-
fetcher = _fnOrArray[0],
|
|
1325
|
-
reducer = _fnOrArray[1],
|
|
1326
|
-
rollbacker = _fnOrArray[2];
|
|
1327
|
-
|
|
1328
|
-
if (actionType === REDUCE) {
|
|
1329
|
-
return reducer(null, prevArgs);
|
|
1330
|
-
} else if (actionType === FETCH) {
|
|
1331
|
-
return fetcher();
|
|
1332
|
-
} else {
|
|
1333
|
-
return _set('extra', fnOrArray.extra, [actionType === SKIP_FETCH ? function () {
|
|
1334
|
-
return Promise.resolve();
|
|
1335
|
-
} : fetcher, actionType === SKIP_DISPATCH ? undefined : reducer].concat(rollbacker || []));
|
|
1336
|
-
}
|
|
1337
|
-
} else {
|
|
1338
|
-
return prevArgs.length < fnOrArray.length ? function () {
|
|
1339
|
-
for (var _len3 = arguments.length, moreArgs = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
1340
|
-
moreArgs[_key3] = arguments[_key3];
|
|
1341
|
-
}
|
|
1342
|
-
|
|
1343
|
-
return Action(fnOrArray, _toConsumableArray(prevArgs).concat(moreArgs));
|
|
1344
|
-
} : Action(fnOrArray.apply(void 0, _toConsumableArray(prevArgs)), prevArgs);
|
|
1345
|
-
}
|
|
1346
|
-
};
|
|
1347
|
-
|
|
1348
|
-
var mapAction = function mapAction(get, dispatcher, firstRun) {
|
|
1349
|
-
return function (action) {
|
|
1350
|
-
if (Array.isArray(action)) {
|
|
1351
|
-
if (firstRun) {
|
|
1352
|
-
return function () {
|
|
1353
|
-
return mapAction(get, dispatcher)(action);
|
|
1354
|
-
};
|
|
1355
|
-
}
|
|
1356
|
-
|
|
1357
|
-
var _action = _slicedToArray(action, 3),
|
|
1358
|
-
fetcher = _action[0],
|
|
1359
|
-
reducer = _action[1],
|
|
1360
|
-
rollbacker = _action[2];
|
|
1361
|
-
|
|
1362
|
-
var _ref3 = action.extra || {},
|
|
1363
|
-
skip = _ref3.skip;
|
|
1364
|
-
|
|
1365
|
-
if (skip && skip(get())) {
|
|
1366
|
-
return Promise.resolve(SKIPPED_ACTION);
|
|
1367
|
-
}
|
|
1368
|
-
|
|
1369
|
-
var fetched = fetcher();
|
|
1370
|
-
|
|
1371
|
-
if (rollbacker) {
|
|
1372
|
-
dispatcher(function (prevState) {
|
|
1373
|
-
var nextState = reducer(null)(prevState);
|
|
1374
|
-
fetched.catch(function (response) {
|
|
1375
|
-
dispatcher(rollbacker(prevState, nextState, response));
|
|
1376
|
-
});
|
|
1377
|
-
return nextState;
|
|
1378
|
-
});
|
|
1379
|
-
}
|
|
1380
|
-
|
|
1381
|
-
if (reducer !== undefined) {
|
|
1382
|
-
fetched.then(function (response) {
|
|
1383
|
-
return dispatcher(reducer(response));
|
|
1384
|
-
});
|
|
1385
|
-
}
|
|
1386
|
-
|
|
1387
|
-
return fetched;
|
|
1388
|
-
} else {
|
|
1389
|
-
return function () {
|
|
1390
|
-
return mapAction(get, dispatcher)(action.apply(void 0, arguments));
|
|
1391
|
-
};
|
|
1392
|
-
}
|
|
1393
|
-
};
|
|
1394
|
-
};
|
|
1395
|
-
|
|
1396
|
-
var activateActions = function activateActions(get, dispatcher) {
|
|
1397
|
-
for (var _len4 = arguments.length, actions = new Array(_len4 > 2 ? _len4 - 2 : 0), _key4 = 2; _key4 < _len4; _key4++) {
|
|
1398
|
-
actions[_key4 - 2] = arguments[_key4];
|
|
1399
|
-
}
|
|
1400
|
-
|
|
1401
|
-
return actions.map(mapAction(get, dispatcher, true));
|
|
1402
|
-
};
|
|
1403
|
-
var SkipAction = function SkipAction(skip, action) {
|
|
1404
|
-
action.extra = _objectSpread({}, action.extra, {
|
|
1405
|
-
skip: skip
|
|
1406
|
-
});
|
|
1407
|
-
return action;
|
|
1408
|
-
};
|
|
1409
|
-
|
|
1410
|
-
var compareBest = function compareBest(compare) {
|
|
1411
|
-
return function (best, next) {
|
|
1412
|
-
return best ? compare(best, next) ? next : best : next;
|
|
1413
|
-
};
|
|
1414
|
-
};
|
|
1415
|
-
var toLowest = function toLowest() {
|
|
1416
|
-
var getValue = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _identity;
|
|
1417
|
-
return compareBest(function (best, next) {
|
|
1418
|
-
return getValue(next) < getValue(best);
|
|
1419
|
-
});
|
|
1420
|
-
};
|
|
1421
|
-
var toHighest = function toHighest() {
|
|
1422
|
-
var getValue = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _identity;
|
|
1423
|
-
return compareBest(function (best, next) {
|
|
1424
|
-
return getValue(next) > getValue(best);
|
|
1425
|
-
});
|
|
1426
|
-
};
|
|
1427
|
-
|
|
1428
|
-
var addExtraProp = function addExtraProp(element, extra) {
|
|
1429
|
-
var override = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
1430
|
-
return React.cloneElement(element, override ? _objectSpread({}, element.props, extra) : _objectSpread({}, extra, element.props), element.props.children);
|
|
1431
|
-
};
|
|
1432
|
-
|
|
1433
|
-
var useEventListener = function useEventListener(eventName, callback) {
|
|
1434
|
-
var deps = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
1435
|
-
useEffect(function () {
|
|
1436
|
-
window.addEventListener(eventName, callback);
|
|
1437
|
-
return function () {
|
|
1438
|
-
return window.removeEventListener(eventName, callback);
|
|
1439
|
-
};
|
|
1440
|
-
}, deps);
|
|
1441
|
-
};
|
|
1442
|
-
var useEventListenerIf = function useEventListenerIf(check, eventName, callback) {
|
|
1443
|
-
var deps = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
|
|
1444
|
-
useEffect(function () {
|
|
1445
|
-
if (!check()) return;
|
|
1446
|
-
window.addEventListener(eventName, callback);
|
|
1447
|
-
return function () {
|
|
1448
|
-
return window.removeEventListener(eventName, callback);
|
|
1449
|
-
};
|
|
1450
|
-
}, deps);
|
|
1451
|
-
};
|
|
1452
|
-
var useEventListenerFor = function useEventListenerFor(element, eventName, callback) {
|
|
1453
|
-
var deps = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
|
|
1454
|
-
useEffect(function () {
|
|
1455
|
-
element.addEventListener(eventName, callback);
|
|
1456
|
-
return function () {
|
|
1457
|
-
return element.removeEventListener(eventName, callback);
|
|
1458
|
-
};
|
|
1459
|
-
}, deps.concat(element));
|
|
1460
|
-
};
|
|
1461
|
-
|
|
1462
|
-
var formatPath = function formatPath() {
|
|
1463
|
-
for (var _len = arguments.length, paths = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
1464
|
-
paths[_key] = arguments[_key];
|
|
1465
|
-
}
|
|
1466
|
-
|
|
1467
|
-
return paths.map(function (path) {
|
|
1468
|
-
return Array.isArray(path) ? path.join('.') : path ? path.toString().replace(/\[/g, '.').replace(/^\./, '').replace(/]/g, '') : '';
|
|
1469
|
-
}).filter(function (_) {
|
|
1470
|
-
return _;
|
|
1471
|
-
}).join('.');
|
|
1472
|
-
};
|
|
1473
|
-
var identityFn = function identityFn() {
|
|
1474
|
-
var n = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
1475
|
-
return function () {
|
|
1476
|
-
for (var _len2 = arguments.length, e = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
1477
|
-
e[_key2] = arguments[_key2];
|
|
1478
|
-
}
|
|
1479
|
-
|
|
1480
|
-
return e[n];
|
|
1481
|
-
};
|
|
1482
|
-
};
|
|
1483
|
-
var will = function will(fn) {
|
|
1484
|
-
for (var _len3 = arguments.length, props = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
|
|
1485
|
-
props[_key3 - 1] = arguments[_key3];
|
|
1486
|
-
}
|
|
1487
|
-
|
|
1488
|
-
return function () {
|
|
1489
|
-
for (var _len4 = arguments.length, more = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
|
1490
|
-
more[_key4] = arguments[_key4];
|
|
1491
|
-
}
|
|
1492
|
-
|
|
1493
|
-
return fn.apply(void 0, props.concat(more));
|
|
1494
|
-
};
|
|
1495
|
-
};
|
|
1496
|
-
var lazyValue = function lazyValue(v) {
|
|
1497
|
-
return function () {
|
|
1498
|
-
return v;
|
|
1499
|
-
};
|
|
1500
|
-
};
|
|
1501
|
-
var callIfFunction = function callIfFunction(prop) {
|
|
1502
|
-
for (var _len5 = arguments.length, args = new Array(_len5 > 1 ? _len5 - 1 : 0), _key5 = 1; _key5 < _len5; _key5++) {
|
|
1503
|
-
args[_key5 - 1] = arguments[_key5];
|
|
1504
|
-
}
|
|
1505
|
-
|
|
1506
|
-
return typeof prop === "function" ? prop.apply(void 0, args) : prop;
|
|
1507
|
-
};
|
|
1508
|
-
var callIfFunctions = function callIfFunctions(prop) {
|
|
1509
|
-
for (var _len6 = arguments.length, args = new Array(_len6 > 1 ? _len6 - 1 : 0), _key6 = 1; _key6 < _len6; _key6++) {
|
|
1510
|
-
args[_key6 - 1] = arguments[_key6];
|
|
1511
|
-
}
|
|
1512
|
-
|
|
1513
|
-
return typeof prop === "function" ? prop.apply(void 0, _toConsumableArray(args.map(function (e) {
|
|
1514
|
-
return callIfFunction(e);
|
|
1515
|
-
}))) : prop;
|
|
1516
|
-
};
|
|
1517
|
-
var callMany = function callMany() {
|
|
1518
|
-
for (var _len7 = arguments.length, many = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
|
|
1519
|
-
many[_key7] = arguments[_key7];
|
|
1520
|
-
}
|
|
1521
|
-
|
|
1522
|
-
return function () {
|
|
1523
|
-
for (var _len8 = arguments.length, args = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {
|
|
1524
|
-
args[_key8] = arguments[_key8];
|
|
1525
|
-
}
|
|
1526
|
-
|
|
1527
|
-
return many.map(function (_) {
|
|
1528
|
-
return callIfFunction.apply(void 0, [_].concat(args));
|
|
1529
|
-
});
|
|
1530
|
-
};
|
|
1531
|
-
};
|
|
1532
|
-
var ifUndefined = function ifUndefined(v) {
|
|
1533
|
-
for (var _len9 = arguments.length, or = new Array(_len9 > 1 ? _len9 - 1 : 0), _key9 = 1; _key9 < _len9; _key9++) {
|
|
1534
|
-
or[_key9 - 1] = arguments[_key9];
|
|
1535
|
-
}
|
|
1536
|
-
|
|
1537
|
-
return v !== undefined ? v : or.length === 1 ? or[0] : ifUndefined.apply(void 0, [or[0]].concat(_toConsumableArray(or.slice(1))));
|
|
1538
|
-
};
|
|
1539
|
-
var using = function using() {
|
|
1540
|
-
for (var _len10 = arguments.length, v = new Array(_len10), _key10 = 0; _key10 < _len10; _key10++) {
|
|
1541
|
-
v[_key10] = arguments[_key10];
|
|
1542
|
-
}
|
|
1543
|
-
|
|
1544
|
-
return function (fn) {
|
|
1545
|
-
return fn.apply(void 0, _toConsumableArray(v.map(function (v) {
|
|
1546
|
-
return callIfFunction(v);
|
|
1547
|
-
})));
|
|
1548
|
-
};
|
|
1549
|
-
};
|
|
1550
|
-
var stopPropagation = function stopPropagation(cb) {
|
|
1551
|
-
return function (e) {
|
|
1552
|
-
e && e.stopPropagation && e.stopPropagation();
|
|
1553
|
-
callIfFunction(cb, e);
|
|
1554
|
-
};
|
|
1555
|
-
};
|
|
1556
|
-
var preventDefault = function preventDefault(cb) {
|
|
1557
|
-
return function (e) {
|
|
1558
|
-
e && e.preventDefault && e.preventDefault();
|
|
1559
|
-
callIfFunction(cb, e);
|
|
1560
|
-
};
|
|
1561
|
-
};
|
|
1562
|
-
var constrainEvent = function constrainEvent(cb) {
|
|
1563
|
-
return function (e) {
|
|
1564
|
-
e === null || e === void 0 ? void 0 : e.preventDefault();
|
|
1565
|
-
e.stopPropagation();
|
|
1566
|
-
callIfFunction(cb, e);
|
|
1567
|
-
};
|
|
1568
|
-
};
|
|
1569
|
-
var mapGetOrSet = function mapGetOrSet(map, key, value) {
|
|
1570
|
-
return (map.has(key) ? map : map.set(key, value)).get(key);
|
|
1571
|
-
};
|
|
1572
|
-
var intToHour = function intToHour(hour) {
|
|
1573
|
-
var autoFill = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
1574
|
-
if (hour === undefined || hour === null) return '';
|
|
1575
|
-
|
|
1576
|
-
if (hour === 0) {
|
|
1577
|
-
return "00:00";
|
|
1578
|
-
} //const [h,m] = ('000' + hour.toString().replace(":","")).slice(-4).replace(/(\d\d)(\d\d)/, '$1:$2').split(":")
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
var h = hour.toString().replace(":", "").slice(-4, -2);
|
|
1582
|
-
var m = hour.toString().replace(":", "").slice(-2);
|
|
1583
|
-
|
|
1584
|
-
if (callIfFunction(autoFill, hour)) {
|
|
1585
|
-
return ('000' + (h ? parseInt(h, 10) % 24 : '') + m).slice(-4).replace(/(\d\d)(\d\d)/, '$1:$2');
|
|
1586
|
-
}
|
|
1587
|
-
|
|
1588
|
-
if (h) return (parseInt(h, 10) > 23 ? h.slice(1) : h) + ':' + m;
|
|
1589
|
-
return m;
|
|
1590
|
-
};
|
|
1591
|
-
var formatHour = function formatHour() {
|
|
1592
|
-
var hour = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
|
|
1593
|
-
|
|
1594
|
-
if (!hour) {
|
|
1595
|
-
return "";
|
|
1596
|
-
}
|
|
1597
|
-
|
|
1598
|
-
var h = hour.toString().replace(":", "").slice(-4, -2);
|
|
1599
|
-
var m = hour.toString().replace(":", "").slice(-2);
|
|
1600
|
-
|
|
1601
|
-
if (!h && parseInt(m) < 24 && !_isFinite(hour)) {
|
|
1602
|
-
return m + ":00";
|
|
1603
|
-
} else if (h) {
|
|
1604
|
-
return (parseInt(h, 10) > 23 ? h.slice(1) : h) + ':' + m;
|
|
1605
|
-
}
|
|
1606
|
-
|
|
1607
|
-
return ('000' + hour.toString().replace(":", "")).slice(-4).replace(/(\d\d)(\d\d)/, '$1:$2');
|
|
1608
|
-
};
|
|
1609
|
-
var willRafThrottle = function willRafThrottle() {
|
|
1610
|
-
var ticking = false;
|
|
1611
|
-
return function (fn) {
|
|
1612
|
-
if (!ticking) {
|
|
1613
|
-
window.requestAnimationFrame(function () {
|
|
1614
|
-
fn();
|
|
1615
|
-
ticking = false;
|
|
1616
|
-
});
|
|
1617
|
-
ticking = true;
|
|
1618
|
-
}
|
|
1619
|
-
};
|
|
1620
|
-
};
|
|
1621
|
-
var rafThrottle = function rafThrottle(fn) {
|
|
1622
|
-
var throttle = willRafThrottle();
|
|
1623
|
-
return function () {
|
|
1624
|
-
throttle(fn);
|
|
1625
|
-
};
|
|
1626
|
-
};
|
|
1627
|
-
var intsToHour = function intsToHour(_ref) {
|
|
1628
|
-
var open = _ref.open,
|
|
1629
|
-
close = _ref.close;
|
|
1630
|
-
return intToHour(open) + ' - ' + intToHour(close);
|
|
1631
|
-
};
|
|
1632
|
-
function isSmallDevice() {
|
|
1633
|
-
var width = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 600;
|
|
1634
|
-
var smallDeviceQuery = window.matchMedia ? window.matchMedia("(max-width: ".concat(width + scrollWidth$1, "px)")) : {
|
|
1635
|
-
matches: false
|
|
1636
|
-
};
|
|
1637
|
-
return smallDeviceQuery.matches;
|
|
1638
|
-
}
|
|
1639
|
-
function isHighDensity() {
|
|
1640
|
-
return window.matchMedia && (window.matchMedia('only screen and (min-resolution: 124dpi), only screen and (min-resolution: 1.3dppx), only screen and (min-resolution: 48.8dpcm)').matches || window.matchMedia('only screen and (-webkit-min-device-pixel-ratio: 1.3), only screen and (-o-min-device-pixel-ratio: 2.6/2), only screen and (min--moz-device-pixel-ratio: 1.3), only screen and (min-device-pixel-ratio: 1.3)').matches) || window.devicePixelRatio && window.devicePixelRatio > 1.3;
|
|
1641
|
-
}
|
|
1642
|
-
function isRetina() {
|
|
1643
|
-
return (window.matchMedia && (window.matchMedia('only screen and (min-resolution: 192dpi), only screen and (min-resolution: 2dppx), only screen and (min-resolution: 75.6dpcm)').matches || window.matchMedia('only screen and (-webkit-min-device-pixel-ratio: 2), only screen and (-o-min-device-pixel-ratio: 2/1), only screen and (min--moz-device-pixel-ratio: 2), only screen and (min-device-pixel-ratio: 2)').matches) || window.devicePixelRatio && window.devicePixelRatio >= 2) && /(iPad|iPhone|iPod)/g.test(navigator.userAgent);
|
|
1644
|
-
}
|
|
1645
|
-
function isMobile() {
|
|
1646
|
-
if (typeof navigator === 'undefined') return false;
|
|
1647
|
-
var ua = navigator.userAgent;
|
|
1648
|
-
var isAndroid = /android/i.test(ua);
|
|
1649
|
-
var isiOS = /iphone|ipod|ipad/i.test(ua); // iPadOS 13+ reports "Macintosh" but has touch
|
|
1650
|
-
|
|
1651
|
-
var isIPadOS = navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1;
|
|
1652
|
-
return isAndroid || isiOS || isIPadOS;
|
|
1653
|
-
}
|
|
1654
|
-
function isAndroid() {
|
|
1655
|
-
if (navigator.userAgentData) {
|
|
1656
|
-
return navigator.userAgentData.platform === "Android";
|
|
1657
|
-
}
|
|
1658
|
-
|
|
1659
|
-
return /Android/i.test(navigator.userAgent);
|
|
1660
|
-
}
|
|
1661
|
-
var isPWA = function isPWA() {
|
|
1662
|
-
return window.matchMedia && window.matchMedia("(display-mode: standalone)").matches || !!window.hasWebviewBridge;
|
|
1663
|
-
};
|
|
1664
|
-
function isTouchDevice() {
|
|
1665
|
-
return window.document && 'ontouchstart' in window.document.documentElement;
|
|
1666
|
-
}
|
|
1667
|
-
var isIOS = function isIOS() {
|
|
1668
|
-
return /iPad|iPhone|iPod/.test(navigator.platform) || navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1;
|
|
1669
|
-
};
|
|
1670
|
-
var isIPad = function isIPad() {
|
|
1671
|
-
return navigator.userAgent.match(/iPad/i) != null;
|
|
1672
|
-
};
|
|
1673
|
-
var getNumberInputType2 = function getNumberInputType2() {
|
|
1674
|
-
var isIOS = /iPad|iPhone|iPod/.test(navigator.platform) || navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1;
|
|
1675
|
-
return isMobile() ? isIOS ? "tel" : "number" : "text";
|
|
1676
|
-
};
|
|
1677
|
-
var getNumberInputType = function getNumberInputType() {
|
|
1678
|
-
return "tel";
|
|
1679
|
-
};
|
|
1680
|
-
function addHttp(s, secure) {
|
|
1681
|
-
s = (s || '').trim();
|
|
1682
|
-
|
|
1683
|
-
if (s.indexOf('http://') === 0 || s.indexOf('https://') === 0) {
|
|
1684
|
-
return s;
|
|
1685
|
-
} else {
|
|
1686
|
-
return "http".concat(secure ? 's' : '', "://") + s;
|
|
1687
|
-
}
|
|
1688
|
-
}
|
|
1689
|
-
var protocols = "(^|\\s|\xA0)(https?://)?(www\\.)?";
|
|
1690
|
-
var subdomains = '([a-zA-Z0-9][a-zA-Z0-9-_]*[a-zA-Z0-9]?\\.)*';
|
|
1691
|
-
var domain = '(([a-zA-Z]{1})|([a-zA-Z]{1}[a-zA-Z]{1})|([a-zA-Z]{1}[0-9]{1})|([0-9]{1}[a-zA-Z]{1})|([a-zA-Z0-9][a-zA-Z0-9-_]{1,61}[a-zA-Z0-9]))\\.([a-zA-Z]{2,6}|[a-zA-Z0-9-]{2,30}\\.[a-zA-Z]{2,3})';
|
|
1692
|
-
var resource = "[\xA1-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEFa-zA-Z0-9-._~:/?#%[\\]@!$&'()*+,;=]*";
|
|
1693
|
-
var linkRegex = new RegExp(protocols + subdomains + domain + resource);
|
|
1694
|
-
function isUrl(url) {
|
|
1695
|
-
return linkRegex.test(addHttp(url));
|
|
1696
|
-
}
|
|
1697
|
-
function ellipsis() {
|
|
1698
|
-
var str = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
|
|
1699
|
-
var length = arguments.length > 1 ? arguments[1] : undefined;
|
|
1700
|
-
|
|
1701
|
-
if (str.length > length) {
|
|
1702
|
-
var words = str.slice(0, length).split(' ');
|
|
1703
|
-
if (str.split(' ').indexOf(words[words.length - 1]) < 0) words = words.slice(0, words.length - 1);
|
|
1704
|
-
return words.join(' ') + '...';
|
|
1705
|
-
} else return str;
|
|
1706
|
-
}
|
|
1707
|
-
function safeNewLineToBr(str, keepMany) {
|
|
1708
|
-
var result = (str || "").replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"');
|
|
1709
|
-
|
|
1710
|
-
if (keepMany === true) {
|
|
1711
|
-
return result.replace(/\n/g, '<br/>');
|
|
1712
|
-
}
|
|
1713
|
-
|
|
1714
|
-
return result.replace(/\n+/g, '<br/>');
|
|
1715
|
-
}
|
|
1716
|
-
|
|
1717
|
-
function padGroups(pattern, value) {
|
|
1718
|
-
return pattern.split('').reduce(function (_ref2, char, i) {
|
|
1719
|
-
var _ref3 = _slicedToArray(_ref2, 2),
|
|
1720
|
-
acc = _ref3[0],
|
|
1721
|
-
value = _ref3[1];
|
|
1722
|
-
|
|
1723
|
-
if (char === '0') {
|
|
1724
|
-
var shouldHave = pattern.slice(i).search(/[^0#?*]/);
|
|
1725
|
-
var has = value.slice(i).search(/\D/);
|
|
1726
|
-
|
|
1727
|
-
if (has > 0 && shouldHave > has) {
|
|
1728
|
-
return [acc.concat('0'), acc.join('') + '0' + value.slice(i)];
|
|
1729
|
-
} else {
|
|
1730
|
-
return [acc.concat(value[i]), value];
|
|
1731
|
-
}
|
|
1732
|
-
} else {
|
|
1733
|
-
return [acc.concat(value[i]), value];
|
|
1734
|
-
}
|
|
1735
|
-
}, [[], value])[0].join('');
|
|
1736
|
-
}
|
|
1737
|
-
|
|
1738
|
-
var digitsToPattern = function digitsToPattern(patternWithLimit, optValue) {
|
|
1739
|
-
var value = optValue || "";
|
|
1740
|
-
if (patternWithLimit[0] === '>' && Number(patternWithLimit.replace(/^>(\d*).*/g, "$1")) > value.length) return value;
|
|
1741
|
-
var pattern = patternWithLimit.replace(/^>\d+/, '');
|
|
1742
|
-
var digits = padGroups(pattern, value).replace(/\D/g, '');
|
|
1743
|
-
var totalRequired = pattern.split(/[0#]/).length - 1;
|
|
1744
|
-
var totalOptional = pattern.split(/[?*]/).length - 1;
|
|
1745
|
-
var available = digits.length - totalRequired;
|
|
1746
|
-
|
|
1747
|
-
if (available > 0 && totalOptional > 0) {
|
|
1748
|
-
var _i = 0;
|
|
1749
|
-
return digitsToPattern(pattern.replace(/\?/g, function () {
|
|
1750
|
-
return _i++ < available ? '#' : '';
|
|
1751
|
-
}).replace('*', new Array(Math.max(0, available - _i + 1)).join("#")), value);
|
|
1752
|
-
}
|
|
1753
|
-
|
|
1754
|
-
var i = 0;
|
|
1755
|
-
return pattern.replace(/^>\d*/, '').split('').reduce(function (acc, char) {
|
|
1756
|
-
if (!digits[Math.max(i - 1, 0)] || char === '?' || char === '*') return acc;
|
|
1757
|
-
|
|
1758
|
-
if (char === '#' || char === '0') {
|
|
1759
|
-
return acc + (digits[i++] || '');
|
|
1760
|
-
} else {
|
|
1761
|
-
return acc + char;
|
|
1762
|
-
}
|
|
1763
|
-
}, '');
|
|
1764
|
-
};
|
|
1765
|
-
var normalizeTouch = function normalizeTouch(fn, endFn) {
|
|
1766
|
-
return function (e) {
|
|
1767
|
-
var touch = e.touches[0];
|
|
1768
|
-
|
|
1769
|
-
if (e.touches.length > 1 && e.type !== 'touchend') {
|
|
1770
|
-
callIfFunction(endFn, e, touch);
|
|
1771
|
-
} else {
|
|
1772
|
-
callIfFunction(fn, e, touch);
|
|
1773
|
-
}
|
|
1774
|
-
};
|
|
1775
|
-
};
|
|
1776
|
-
var normalizeMouse = function normalizeMouse(fn, endFn) {
|
|
1777
|
-
return function (e) {
|
|
1778
|
-
if (e.buttons > 1 && e.type !== 'mouseup') {
|
|
1779
|
-
callIfFunction(endFn, e, e);
|
|
1780
|
-
} else {
|
|
1781
|
-
callIfFunction(fn, e, e);
|
|
1782
|
-
}
|
|
1783
|
-
};
|
|
1784
|
-
};
|
|
1785
|
-
var normalizePress = function normalizePress(fn, endFn) {
|
|
1786
|
-
return function (e) {
|
|
1787
|
-
if (e.touches) {
|
|
1788
|
-
normalizeTouch(fn, endFn)(e);
|
|
1789
|
-
} else {
|
|
1790
|
-
normalizeMouse(fn, endFn)(e);
|
|
1791
|
-
}
|
|
1792
|
-
};
|
|
1793
|
-
};
|
|
1794
|
-
var touchClick = function touchClick(cb) {
|
|
1795
|
-
var sensibility = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 5;
|
|
1796
|
-
return function (e) {
|
|
1797
|
-
var _e$touches;
|
|
1798
|
-
|
|
1799
|
-
if (((_e$touches = e.touches) === null || _e$touches === void 0 ? void 0 : _e$touches.length) !== 1) {
|
|
1800
|
-
return;
|
|
1801
|
-
}
|
|
1802
|
-
|
|
1803
|
-
var target = e.target;
|
|
1804
|
-
var originalX = e.touches[0].screenX;
|
|
1805
|
-
var originalY = e.touches[0].screenY;
|
|
1806
|
-
|
|
1807
|
-
var isInsideBounds = function isInsideBounds(touch) {
|
|
1808
|
-
return Math.sqrt(Math.pow(originalX - touch.screenX, 2) + Math.pow(originalY - touch.screenY, 2)) < sensibility;
|
|
1809
|
-
};
|
|
1810
|
-
|
|
1811
|
-
var checkBounds = function checkBounds(e) {
|
|
1812
|
-
if (e.touches.length !== 1) {
|
|
1813
|
-
return;
|
|
1814
|
-
}
|
|
1815
|
-
|
|
1816
|
-
if (!isInsideBounds(e.changedTouches[0])) {
|
|
1817
|
-
maybeClick();
|
|
1818
|
-
}
|
|
1819
|
-
};
|
|
1820
|
-
|
|
1821
|
-
var maybeClick = function maybeClick(e) {
|
|
1822
|
-
var _e$changedTouches;
|
|
1823
|
-
|
|
1824
|
-
target.removeEventListener('touchend', maybeClick);
|
|
1825
|
-
target.removeEventListener('touchmove', checkBounds);
|
|
1826
|
-
|
|
1827
|
-
if ((e === null || e === void 0 ? void 0 : (_e$changedTouches = e.changedTouches) === null || _e$changedTouches === void 0 ? void 0 : _e$changedTouches.length) !== 1) {
|
|
1828
|
-
return;
|
|
1829
|
-
}
|
|
1830
|
-
|
|
1831
|
-
if (isInsideBounds(e.changedTouches[0])) {
|
|
1832
|
-
e.preventDefault();
|
|
1833
|
-
cb(e);
|
|
1834
|
-
}
|
|
1835
|
-
};
|
|
1836
|
-
|
|
1837
|
-
target.addEventListener('touchend', maybeClick);
|
|
1838
|
-
target.addEventListener('touchmove', checkBounds);
|
|
1839
|
-
};
|
|
1840
|
-
};
|
|
1841
|
-
var isEmptyHtml = function isEmptyHtml() {
|
|
1842
|
-
var __html = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
|
|
1843
|
-
|
|
1844
|
-
var a = document.createElement('span');
|
|
1845
|
-
a.innerHTML = __html;
|
|
1846
|
-
return a.textContent.replace(/\s/g, '').length === 0;
|
|
1847
|
-
};
|
|
1848
|
-
var getScrollParent = function getScrollParent(node) {
|
|
1849
|
-
if (!node) {
|
|
1850
|
-
return window;
|
|
1851
|
-
}
|
|
1852
|
-
|
|
1853
|
-
var overflowY = window.getComputedStyle(node).overflowY;
|
|
1854
|
-
var isScrollable = overflowY !== 'visible' && overflowY !== 'hidden';
|
|
1855
|
-
|
|
1856
|
-
if (isScrollable && (node.scrollHeight > node.clientHeight || overflowY === 'scroll')) {
|
|
1857
|
-
return node;
|
|
1858
|
-
} else {
|
|
1859
|
-
return getScrollParent(node.offsetParent);
|
|
1860
|
-
}
|
|
1861
|
-
};
|
|
1862
|
-
var scrollIntoViewWithOffset = function scrollIntoViewWithOffset(el, offset) {
|
|
1863
|
-
var scrollOffset = getScrollParent(el);
|
|
1864
|
-
var scrollY = scrollOffset === window ? window.pageYOffset : scrollOffset.scrollTop;
|
|
1865
|
-
var elTop = el.getBoundingClientRect().top;
|
|
1866
|
-
var computedOffset = callIfFunction(offset, elTop > 0);
|
|
1867
|
-
var y = el.getBoundingClientRect().top + scrollY + computedOffset;
|
|
1868
|
-
scrollOffset.scrollTo({
|
|
1869
|
-
top: y,
|
|
1870
|
-
behavior: 'smooth'
|
|
1871
|
-
});
|
|
1872
|
-
};
|
|
1873
|
-
var isElementInView =
|
|
1874
|
-
/*#__PURE__*/
|
|
1875
|
-
function () {
|
|
1876
|
-
var _ref4 = _asyncToGenerator(
|
|
1877
|
-
/*#__PURE__*/
|
|
1878
|
-
_regeneratorRuntime.mark(function _callee(element) {
|
|
1879
|
-
var html, rect;
|
|
1880
|
-
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
1881
|
-
while (1) {
|
|
1882
|
-
switch (_context.prev = _context.next) {
|
|
1883
|
-
case 0:
|
|
1884
|
-
if (element) {
|
|
1885
|
-
_context.next = 2;
|
|
1886
|
-
break;
|
|
1887
|
-
}
|
|
1888
|
-
|
|
1889
|
-
return _context.abrupt("return", false);
|
|
1890
|
-
|
|
1891
|
-
case 2:
|
|
1892
|
-
if (!(1 !== element.nodeType)) {
|
|
1893
|
-
_context.next = 4;
|
|
1894
|
-
break;
|
|
1895
|
-
}
|
|
1896
|
-
|
|
1897
|
-
return _context.abrupt("return", false);
|
|
1898
|
-
|
|
1899
|
-
case 4:
|
|
1900
|
-
html = document.documentElement;
|
|
1901
|
-
rect = element.getBoundingClientRect();
|
|
1902
|
-
|
|
1903
|
-
if (!IntersectionObserver) {
|
|
1904
|
-
_context.next = 8;
|
|
1905
|
-
break;
|
|
1906
|
-
}
|
|
1907
|
-
|
|
1908
|
-
return _context.abrupt("return", new Promise(function (resolve) {
|
|
1909
|
-
var o = new IntersectionObserver(function (_ref5) {
|
|
1910
|
-
var _ref6 = _slicedToArray(_ref5, 1),
|
|
1911
|
-
entry = _ref6[0];
|
|
1912
|
-
|
|
1913
|
-
resolve(entry.intersectionRatio === 1);
|
|
1914
|
-
o.disconnect();
|
|
1915
|
-
});
|
|
1916
|
-
o.observe(element);
|
|
1917
|
-
}));
|
|
1918
|
-
|
|
1919
|
-
case 8:
|
|
1920
|
-
return _context.abrupt("return", !!rect && rect.bottom >= 0 && rect.right >= 0 && rect.left <= html.clientWidth && rect.top <= html.clientHeight);
|
|
1921
|
-
|
|
1922
|
-
case 9:
|
|
1923
|
-
case "end":
|
|
1924
|
-
return _context.stop();
|
|
1925
|
-
}
|
|
1926
|
-
}
|
|
1927
|
-
}, _callee, this);
|
|
1928
|
-
}));
|
|
1929
|
-
|
|
1930
|
-
return function isElementInView(_x) {
|
|
1931
|
-
return _ref4.apply(this, arguments);
|
|
1932
|
-
};
|
|
1933
|
-
}();
|
|
1934
|
-
var i = 0;
|
|
1935
|
-
var getUID = function getUID() {
|
|
1936
|
-
return Date.now().toString(36) + Math.random().toString(36).slice(2) + (i++).toString(36);
|
|
1937
|
-
};
|
|
1938
|
-
var getUrlParams = function getUrlParams() {
|
|
1939
|
-
return _fromPairs(Array.from(new URLSearchParams(location.search).entries()));
|
|
1940
|
-
};
|
|
1941
|
-
var isShallowEqualSameKeys = function isShallowEqualSameKeys(a, b) {
|
|
1942
|
-
for (var key in a) {
|
|
1943
|
-
if (a[key] !== b[key]) {
|
|
1944
|
-
return false;
|
|
1945
|
-
}
|
|
1946
|
-
}
|
|
1947
|
-
|
|
1948
|
-
return true;
|
|
1949
|
-
};
|
|
1950
|
-
var isShallowEqual = function isShallowEqual(a, b) {
|
|
1951
|
-
for (var key in a) {
|
|
1952
|
-
if (!(key in b) || a[key] !== b[key]) {
|
|
1953
|
-
return false;
|
|
1954
|
-
}
|
|
1955
|
-
}
|
|
1956
|
-
|
|
1957
|
-
for (var key in b) {
|
|
1958
|
-
if (!(key in a) || a[key] !== b[key]) {
|
|
1959
|
-
return false;
|
|
1960
|
-
}
|
|
1961
|
-
}
|
|
1962
|
-
|
|
1963
|
-
return true;
|
|
1964
|
-
};
|
|
1965
|
-
|
|
1966
|
-
var disableSelect = function disableSelect(e) {
|
|
1967
|
-
e.preventDefault();
|
|
1968
|
-
};
|
|
1969
|
-
|
|
1970
|
-
var createPressEvent = function createPressEvent(onStart) {
|
|
1971
|
-
return normalizePress$1(function (startEvent, info) {
|
|
1972
|
-
var onEnd = onStart(startEvent, info);
|
|
1973
|
-
var finish = normalizePress$1(function (e, info) {
|
|
1974
|
-
callIfFunction$1(onEnd, e, info);
|
|
1975
|
-
window.removeEventListener('selectstart', disableSelect);
|
|
1976
|
-
window.removeEventListener('touchend', finish);
|
|
1977
|
-
window.removeEventListener('mouseup', finish);
|
|
1978
|
-
});
|
|
1979
|
-
window.addEventListener('selectstart', disableSelect);
|
|
1980
|
-
|
|
1981
|
-
if (startEvent.touches) {
|
|
1982
|
-
window.addEventListener('touchend', finish);
|
|
1983
|
-
} else {
|
|
1984
|
-
window.addEventListener("mouseup", finish);
|
|
1985
|
-
}
|
|
1986
|
-
});
|
|
1987
|
-
};
|
|
1988
|
-
var createPressAndHoldEvent = function createPressAndHoldEvent(onStart, interval) {
|
|
1989
|
-
return createPressEvent(function (startEvent, info) {
|
|
1990
|
-
var _concat = [].concat(onStart(startEvent, info)),
|
|
1991
|
-
_concat2 = _slicedToArray(_concat, 2),
|
|
1992
|
-
onInterval = _concat2[0],
|
|
1993
|
-
onEnd = _concat2[1];
|
|
1994
|
-
|
|
1995
|
-
var i = 0;
|
|
1996
|
-
|
|
1997
|
-
if (interval) {
|
|
1998
|
-
var intervalId = setInterval(function () {
|
|
1999
|
-
onInterval(i++);
|
|
2000
|
-
}, interval);
|
|
2001
|
-
return normalizePress$1(function (e, info) {
|
|
2002
|
-
callIfFunction$1(onEnd, e, info);
|
|
2003
|
-
clearInterval(intervalId);
|
|
2004
|
-
});
|
|
2005
|
-
} else {
|
|
2006
|
-
var running = true;
|
|
2007
|
-
|
|
2008
|
-
var run = function run() {
|
|
2009
|
-
return window.requestAnimationFrame(function () {
|
|
2010
|
-
if (running) {
|
|
2011
|
-
onInterval(i++);
|
|
2012
|
-
run();
|
|
2013
|
-
}
|
|
2014
|
-
});
|
|
2015
|
-
};
|
|
2016
|
-
|
|
2017
|
-
run();
|
|
2018
|
-
return normalizePress$1(function (e, info) {
|
|
2019
|
-
callIfFunction$1(onEnd, e, info);
|
|
2020
|
-
running = false;
|
|
2021
|
-
});
|
|
2022
|
-
}
|
|
2023
|
-
});
|
|
2024
|
-
};
|
|
2025
|
-
var createPressAndMoveEvent = function createPressAndMoveEvent(onStart) {
|
|
2026
|
-
return createPressEvent(function (startEvent, info) {
|
|
2027
|
-
var _concat3 = [].concat(onStart(startEvent, info)),
|
|
2028
|
-
_concat4 = _slicedToArray(_concat3, 2),
|
|
2029
|
-
onMove = _concat4[0],
|
|
2030
|
-
onEnd = _concat4[1];
|
|
2031
|
-
|
|
2032
|
-
var finish = normalizePress$1(function (e, info) {
|
|
2033
|
-
callIfFunction$1(onEnd, e, info);
|
|
2034
|
-
window.removeEventListener('touchmove', move);
|
|
2035
|
-
window.removeEventListener('mousemove', move);
|
|
2036
|
-
});
|
|
2037
|
-
var move = normalizePress$1(onMove, finish);
|
|
2038
|
-
|
|
2039
|
-
if (startEvent.touches) {
|
|
2040
|
-
window.addEventListener('touchmove', move, {
|
|
2041
|
-
passive: false
|
|
2042
|
-
});
|
|
2043
|
-
} else {
|
|
2044
|
-
window.addEventListener("mousemove", move);
|
|
2045
|
-
}
|
|
2046
|
-
|
|
2047
|
-
return finish;
|
|
2048
|
-
});
|
|
2049
|
-
};
|
|
2050
|
-
|
|
2051
|
-
// a contract like this to integrate with React.
|
|
2052
|
-
// Real implementations can be significantly more complex.
|
|
2053
|
-
// Don't copy-paste this into your project!
|
|
2054
|
-
|
|
2055
|
-
var EMPTY_ARGS = [];
|
|
2056
|
-
var UNDEFINED_CURRENT_VALUE = {};
|
|
2057
|
-
|
|
2058
|
-
var innerWrapLazy = function innerWrapLazy(refreshCallback) {
|
|
2059
|
-
return function (maybePromise) {
|
|
2060
|
-
for (var _len = arguments.length, rootArgs = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
2061
|
-
rootArgs[_key - 1] = arguments[_key];
|
|
2062
|
-
}
|
|
2063
|
-
|
|
2064
|
-
var status;
|
|
2065
|
-
var awaitReadResolver;
|
|
2066
|
-
var checker = _isEqual;
|
|
2067
|
-
var lazyArgs = EMPTY_ARGS;
|
|
2068
|
-
|
|
2069
|
-
var _uid = Math.random().toString() + Date.now();
|
|
2070
|
-
|
|
2071
|
-
var result;
|
|
2072
|
-
var currentValue = UNDEFINED_CURRENT_VALUE;
|
|
2073
|
-
|
|
2074
|
-
var promisify = function promisify(maybePromise, resolveNow) {
|
|
2075
|
-
return (_isFunction(maybePromise) && !resolveNow ? new Promise(function (res) {
|
|
2076
|
-
return awaitReadResolver = res;
|
|
2077
|
-
}) : Promise.resolve()).then(function () {
|
|
2078
|
-
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
2079
|
-
args[_key2] = arguments[_key2];
|
|
2080
|
-
}
|
|
2081
|
-
|
|
2082
|
-
return callIfFunction$1.apply(void 0, [maybePromise].concat(rootArgs, _toConsumableArray(lazyArgs), args));
|
|
2083
|
-
});
|
|
2084
|
-
};
|
|
2085
|
-
|
|
2086
|
-
var onPromiseSuccess = function onPromiseSuccess(returnedPromise) {
|
|
2087
|
-
return function (r) {
|
|
2088
|
-
if (returnedPromise !== suspender) {
|
|
2089
|
-
return suspender;
|
|
2090
|
-
}
|
|
2091
|
-
|
|
2092
|
-
status = "success";
|
|
2093
|
-
currentValue = r;
|
|
2094
|
-
result = r;
|
|
2095
|
-
return r;
|
|
2096
|
-
};
|
|
2097
|
-
};
|
|
2098
|
-
|
|
2099
|
-
var onPromiseError = function onPromiseError(returnedPromise) {
|
|
2100
|
-
return function (e) {
|
|
2101
|
-
if (returnedPromise !== suspender) {
|
|
2102
|
-
return suspender;
|
|
2103
|
-
}
|
|
2104
|
-
|
|
2105
|
-
status = "error";
|
|
2106
|
-
result = e;
|
|
2107
|
-
return Promise.reject(e);
|
|
2108
|
-
};
|
|
2109
|
-
};
|
|
2110
|
-
|
|
2111
|
-
var suspend = function suspend(maybePromise) {
|
|
2112
|
-
status = "pending";
|
|
2113
|
-
awaitReadResolver = _identity;
|
|
2114
|
-
var returnedPromise = promisify(maybePromise);
|
|
2115
|
-
returnedPromise.then(onPromiseSuccess(returnedPromise), onPromiseError(returnedPromise));
|
|
2116
|
-
return returnedPromise;
|
|
2117
|
-
};
|
|
2118
|
-
|
|
2119
|
-
var suspender = suspend(maybePromise);
|
|
2120
|
-
return {
|
|
2121
|
-
read: function read() {
|
|
2122
|
-
awaitReadResolver();
|
|
2123
|
-
|
|
2124
|
-
if (status === "pending") {
|
|
2125
|
-
throw suspender;
|
|
2126
|
-
} else if (status === "error") {
|
|
2127
|
-
throw result;
|
|
2128
|
-
} else if (status === "success") {
|
|
2129
|
-
return currentValue;
|
|
2130
|
-
}
|
|
2131
|
-
},
|
|
2132
|
-
promise: function promise() {
|
|
2133
|
-
awaitReadResolver();
|
|
2134
|
-
return suspender;
|
|
2135
|
-
},
|
|
2136
|
-
refresh: function refresh(force) {
|
|
2137
|
-
if (status !== "pending" || force) {
|
|
2138
|
-
suspender = suspend(maybePromise);
|
|
2139
|
-
_uid = Math.random().toString() + Date.now();
|
|
2140
|
-
callIfFunction$1(refreshCallback, this);
|
|
2141
|
-
}
|
|
2142
|
-
|
|
2143
|
-
return this;
|
|
2144
|
-
},
|
|
2145
|
-
next: function next() {
|
|
2146
|
-
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
2147
|
-
args[_key3] = arguments[_key3];
|
|
2148
|
-
}
|
|
2149
|
-
|
|
2150
|
-
return wrapLazy.apply(void 0, [maybePromise].concat(rootArgs, args)).checkWith(checker);
|
|
2151
|
-
},
|
|
2152
|
-
use: function use() {
|
|
2153
|
-
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
|
2154
|
-
args[_key4] = arguments[_key4];
|
|
2155
|
-
}
|
|
2156
|
-
|
|
2157
|
-
if (!checker(args, lazyArgs)) {
|
|
2158
|
-
if (lazyArgs !== EMPTY_ARGS) {
|
|
2159
|
-
_uid = Math.random().toString() + Date.now();
|
|
2160
|
-
}
|
|
2161
|
-
|
|
2162
|
-
lazyArgs = args;
|
|
2163
|
-
suspender = suspend(maybePromise);
|
|
2164
|
-
}
|
|
2165
|
-
|
|
2166
|
-
return this;
|
|
2167
|
-
},
|
|
2168
|
-
_getCurrentValue: function _getCurrentValue() {
|
|
2169
|
-
return currentValue;
|
|
2170
|
-
},
|
|
2171
|
-
silentRefresh: function silentRefresh() {
|
|
2172
|
-
var currentSuspender = suspender;
|
|
2173
|
-
var suspended = promisify(maybePromise, true).then(function (v) {
|
|
2174
|
-
if (currentSuspender === suspender) {
|
|
2175
|
-
suspender = suspended;
|
|
2176
|
-
}
|
|
2177
|
-
|
|
2178
|
-
return v;
|
|
2179
|
-
});
|
|
2180
|
-
suspended.then(onPromiseSuccess(suspended), onPromiseError(suspended));
|
|
2181
|
-
_uid = Math.random().toString() + Date.now();
|
|
2182
|
-
callIfFunction$1(refreshCallback, this);
|
|
2183
|
-
return suspended;
|
|
2184
|
-
},
|
|
2185
|
-
and: function and(lazy) {},
|
|
2186
|
-
checkWith: function checkWith(isEqual) {
|
|
2187
|
-
checker = isEqual;
|
|
2188
|
-
return this;
|
|
2189
|
-
},
|
|
2190
|
-
localUpdate: function localUpdate(updater) {
|
|
2191
|
-
currentValue = callIfFunction$1(updater, currentValue);
|
|
2192
|
-
return this;
|
|
2193
|
-
},
|
|
2194
|
-
uid: function uid() {
|
|
2195
|
-
return _uid;
|
|
2196
|
-
}
|
|
2197
|
-
};
|
|
2198
|
-
};
|
|
2199
|
-
};
|
|
2200
|
-
var wrapLazy = innerWrapLazy();
|
|
2201
|
-
|
|
2202
|
-
var SECOND = 1000;
|
|
2203
|
-
var MINUTE = SECOND * 60;
|
|
2204
|
-
var HOUR = MINUTE * 60;
|
|
2205
|
-
var DAY = HOUR * 24;
|
|
2206
|
-
var WEEK = DAY * 7;
|
|
2207
|
-
var MONTH = DAY * 31;
|
|
2208
|
-
var YEAR = DAY * 366;
|
|
2209
|
-
var getStartOfDay = function getStartOfDay(d) {
|
|
2210
|
-
var utc = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
2211
|
-
var date = new Date(d);
|
|
2212
|
-
|
|
2213
|
-
if (utc) {
|
|
2214
|
-
date.setUTCHours(0, 0, 0, 0);
|
|
2215
|
-
} else {
|
|
2216
|
-
date.setHours(0, 0, 0, 0);
|
|
2217
|
-
}
|
|
2218
|
-
|
|
2219
|
-
return date;
|
|
2220
|
-
};
|
|
2221
|
-
var isSameDay = function isSameDay(a, b) {
|
|
2222
|
-
var utc = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
2223
|
-
return getStartOfDay(a, utc).getTime() === getStartOfDay(b, utc).getTime();
|
|
2224
|
-
};
|
|
2225
|
-
var intervalsIntersect = function intervalsIntersect(_ref, _ref2) {
|
|
2226
|
-
var _ref3 = _slicedToArray(_ref, 2),
|
|
2227
|
-
a1 = _ref3[0],
|
|
2228
|
-
a2 = _ref3[1];
|
|
2229
|
-
|
|
2230
|
-
var _ref4 = _slicedToArray(_ref2, 2),
|
|
2231
|
-
b1 = _ref4[0],
|
|
2232
|
-
b2 = _ref4[1];
|
|
2233
|
-
|
|
2234
|
-
return b2 >= a1 && b1 <= a2;
|
|
2235
|
-
};
|
|
2236
|
-
var intervalsIntersectExclusive = function intervalsIntersectExclusive(_ref5, _ref6) {
|
|
2237
|
-
var _ref7 = _slicedToArray(_ref5, 2),
|
|
2238
|
-
a1 = _ref7[0],
|
|
2239
|
-
a2 = _ref7[1];
|
|
2240
|
-
|
|
2241
|
-
var _ref8 = _slicedToArray(_ref6, 2),
|
|
2242
|
-
b1 = _ref8[0],
|
|
2243
|
-
b2 = _ref8[1];
|
|
2244
|
-
|
|
2245
|
-
return b2 > a1 && b1 < a2;
|
|
2246
|
-
};
|
|
2247
|
-
var intervalsIntersection = function intervalsIntersection(a, b) {
|
|
2248
|
-
if (!intervalsIntersect(a, b)) {
|
|
2249
|
-
return [];
|
|
2250
|
-
}
|
|
2251
|
-
|
|
2252
|
-
return [[Math.max(a[0], b[0]), Math.min(a[1], b[1])]];
|
|
2253
|
-
};
|
|
2254
|
-
var diffIntervals = function diffIntervals(_ref9, _ref10) {
|
|
2255
|
-
var _ref11 = _slicedToArray(_ref9, 2),
|
|
2256
|
-
a1 = _ref11[0],
|
|
2257
|
-
a2 = _ref11[1];
|
|
2258
|
-
|
|
2259
|
-
var _ref12 = _slicedToArray(_ref10, 2),
|
|
2260
|
-
b1 = _ref12[0],
|
|
2261
|
-
b2 = _ref12[1];
|
|
2262
|
-
|
|
2263
|
-
if (a1 >= b2 || // a after b
|
|
2264
|
-
b1 >= a2 // a before b
|
|
2265
|
-
) {
|
|
2266
|
-
return [[a1, a2]];
|
|
2267
|
-
} else if (a1 > b1 && a2 < b2) {
|
|
2268
|
-
// a inside b
|
|
2269
|
-
return [];
|
|
2270
|
-
}
|
|
2271
|
-
|
|
2272
|
-
if (b1 > a1 && b2 < a2) {
|
|
2273
|
-
// b inside a
|
|
2274
|
-
return [[a1, b1], [b2, a2]];
|
|
2275
|
-
}
|
|
2276
|
-
|
|
2277
|
-
if (b1 <= a1) {
|
|
2278
|
-
// b intersecting left of a
|
|
2279
|
-
return [[b2, a2]];
|
|
2280
|
-
} else {
|
|
2281
|
-
// b intersecting right of a
|
|
2282
|
-
return [[a1, b1]];
|
|
2283
|
-
}
|
|
2284
|
-
};
|
|
2285
|
-
var blockDiffIntervals = function blockDiffIntervals(a, b) {
|
|
2286
|
-
return intervalsIntersect(a, b) ? [] : [a];
|
|
2287
|
-
};
|
|
2288
|
-
var startBlockDiffIntervals = function startBlockDiffIntervals(a, b) {
|
|
2289
|
-
return intervalsIntersectExclusive(a, b) && a[0] >= b[0] ? [] : [a];
|
|
2290
|
-
};
|
|
2291
|
-
|
|
2292
|
-
var timerPromise = function timerPromise(time) {
|
|
2293
|
-
return new Promise(function (res) {
|
|
2294
|
-
return setTimeout(res, time);
|
|
2295
|
-
});
|
|
2296
|
-
};
|
|
2297
|
-
var cancelableTimer = function cancelableTimer(res, time) {
|
|
2298
|
-
var v = setTimeout(res, time);
|
|
2299
|
-
return function () {
|
|
2300
|
-
return clearTimeout(v);
|
|
2301
|
-
};
|
|
2302
|
-
};
|
|
2303
|
-
|
|
2304
|
-
var formatJoin = function formatJoin(arr) {
|
|
2305
|
-
var separator = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ', ';
|
|
2306
|
-
var lastSeparator = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ' e ';
|
|
2307
|
-
return [arr.slice(0, -1).join(separator), arr.slice(-1)].join(lastSeparator);
|
|
2308
|
-
};
|
|
2309
|
-
var formatJoinArr = function formatJoinArr(arr, separator, lastSeparator) {
|
|
2310
|
-
return arr.flatMap(function (v, i) {
|
|
2311
|
-
return i < arr.length - 2 ? [v, separator] : i < arr.length - 1 ? [v, lastSeparator] : [v];
|
|
2312
|
-
});
|
|
2313
|
-
};
|
|
2314
|
-
var removeAccents = function removeAccents(str) {
|
|
2315
|
-
return (str || "").normalize('NFD').replace(/(?:[\^`\xA8\xAF\xB4\xB7\xB8\u02B0-\u034E\u0350-\u0357\u035D-\u0362\u0374\u0375\u037A\u0384\u0385\u0483-\u0487\u0559\u0591-\u05A1\u05A3-\u05BD\u05BF\u05C1\u05C2\u05C4\u064B-\u0652\u0657\u0658\u06DF\u06E0\u06E5\u06E6\u06EA-\u06EC\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F5\u0818\u0819\u0898-\u089F\u08C9-\u08D2\u08E3-\u08FE\u093C\u094D\u0951-\u0954\u0971\u09BC\u09CD\u0A3C\u0A4D\u0ABC\u0ACD\u0AFD-\u0AFF\u0B3C\u0B4D\u0B55\u0BCD\u0C3C\u0C4D\u0CBC\u0CCD\u0D3B\u0D3C\u0D4D\u0DCA\u0E3A\u0E47-\u0E4C\u0E4E\u0EBA\u0EC8-\u0ECC\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F82-\u0F84\u0F86\u0F87\u0FC6\u1037\u1039\u103A\u1063\u1064\u1069-\u106D\u1087-\u108D\u108F\u109A\u109B\u135D-\u135F\u1714\u1715\u1734\u17C9-\u17D3\u17DD\u1939-\u193B\u1A60\u1A75-\u1A7C\u1A7F\u1AB0-\u1ABE\u1AC1-\u1ACB\u1B34\u1B44\u1B6B-\u1B73\u1BAA\u1BAB\u1BE6\u1BF2\u1BF3\u1C36\u1C37\u1C78-\u1C7D\u1CD0-\u1CE8\u1CED\u1CF4\u1CF7-\u1CF9\u1D2C-\u1D6A\u1DC4-\u1DCF\u1DF5-\u1DFF\u1FBD\u1FBF-\u1FC1\u1FCD-\u1FCF\u1FDD-\u1FDF\u1FED-\u1FEF\u1FFD\u1FFE\u2CEF-\u2CF1\u2E2F\u302A-\u302F\u3099-\u309C\u30FC\uA66F\uA67C\uA67D\uA67F\uA69C\uA69D\uA6F0\uA6F1\uA700-\uA721\uA788-\uA78A\uA7F8\uA7F9\uA806\uA82C\uA8C4\uA8E0-\uA8F1\uA92B-\uA92E\uA953\uA9B3\uA9C0\uA9E5\uAA7B-\uAA7D\uAABF-\uAAC2\uAAF6\uAB5B-\uAB5F\uAB69-\uAB6B\uABEC\uABED\uFB1E\uFE20-\uFE2F\uFF3E\uFF40\uFF70\uFF9E\uFF9F\uFFE3]|\uD800\uDEE0|\uD801[\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDE38-\uDE3A\uDE3F\uDEE5\uDEE6]|\uD803[\uDD22-\uDD27\uDD4E\uDD69-\uDD6D\uDEFD-\uDEFF\uDF46-\uDF50\uDF82-\uDF85]|\uD804[\uDC46\uDC70\uDCB9\uDCBA\uDD33\uDD34\uDD73\uDDC0\uDDCA-\uDDCC\uDE35\uDE36\uDEE9\uDEEA\uDF3B\uDF3C\uDF4D\uDF66-\uDF6C\uDF70-\uDF74\uDFCE-\uDFD0\uDFD2\uDFD3\uDFE1\uDFE2]|\uD805[\uDC42\uDC46\uDCC2\uDCC3\uDDBF\uDDC0\uDE3F\uDEB6\uDEB7\uDF2B]|\uD806[\uDC39\uDC3A\uDD3D\uDD3E\uDD43\uDDE0\uDE34\uDE47\uDE99]|\uD807[\uDC3F\uDD42\uDD44\uDD45\uDD97\uDF41\uDF42\uDF5A]|\uD80D[\uDC47-\uDC55]|\uD818\uDD2F|\uD81A[\uDEF0-\uDEF4\uDF30-\uDF36]|\uD81B[\uDD6B\uDD6C\uDF8F-\uDF9F\uDFF0\uDFF1]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD833[\uDF00-\uDF2D\uDF30-\uDF46]|\uD834[\uDD67-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD]|\uD838[\uDC30-\uDC6D\uDD30-\uDD36\uDEAE\uDEEC-\uDEEF]|\uD839[\uDDEE\uDDEF]|\uD83A[\uDCD0-\uDCD6\uDD44-\uDD46\uDD48-\uDD4A])/g, "");
|
|
2316
|
-
};
|
|
2317
|
-
var asciify = function asciify(str) {
|
|
2318
|
-
return removeAccents(str || "").replace(/[^\x00-\x7F]/g, "");
|
|
2319
|
-
};
|
|
2320
|
-
var normalizeText = function normalizeText(str) {
|
|
2321
|
-
return removeAccents(str).toLowerCase();
|
|
2322
|
-
};
|
|
2323
|
-
var normalizeTextUrl = function normalizeTextUrl(str) {
|
|
2324
|
-
return removeAccents(str).replace(/[\s.\u0022&/]/g, '-').replace(/-{2,}/g, '-').toLowerCase();
|
|
2325
|
-
};
|
|
2326
|
-
var willFormatDecimal = function willFormatDecimal() {
|
|
2327
|
-
var digits = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 2;
|
|
2328
|
-
|
|
2329
|
-
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
|
2330
|
-
max = _ref.max,
|
|
2331
|
-
min = _ref.min,
|
|
2332
|
-
padTo = _ref.padTo,
|
|
2333
|
-
zeroless = _ref.zeroless,
|
|
2334
|
-
clean = _ref.clean;
|
|
2335
|
-
|
|
2336
|
-
var splitRegex = new RegExp("(\\d+)(\\d{".concat(digits, "})"));
|
|
2337
|
-
var singleRegex = new RegExp("/^([^,]*,\\d{0,".concat(digits, ").*/"));
|
|
2338
|
-
|
|
2339
|
-
var pad = function pad(str) {
|
|
2340
|
-
return padTo ? str.indexOf(",") >= 0 ? _padCharsEnd("0", str.indexOf(",") + padTo + 1, str) : _padCharsEnd("0", str.length + 1 + padTo, str + ",") : str;
|
|
2341
|
-
};
|
|
2342
|
-
|
|
2343
|
-
var constrain = function constrain(val) {
|
|
2344
|
-
if (_isNumber(max) && parseFloat(val.replace(",", ".")) > max) return max.toString();
|
|
2345
|
-
if (_isNumber(min) && parseFloat(val.replace(",", ".")) < min) return min.toString();
|
|
2346
|
-
return val;
|
|
2347
|
-
};
|
|
2348
|
-
|
|
2349
|
-
var cleaned = function cleaned(val) {
|
|
2350
|
-
return clean ? val.replace(/,$/, '').replace(/^0*,/, '0,') || "0" : val;
|
|
2351
|
-
};
|
|
2352
|
-
|
|
2353
|
-
return function (v) {
|
|
2354
|
-
var skipZero = function skipZero(finalV) {
|
|
2355
|
-
return v !== '0' && zeroless && finalV === '0' ? '' : finalV.replace(/^0+([^,])/, '$1');
|
|
2356
|
-
};
|
|
2357
|
-
|
|
2358
|
-
var formatted = _flow(constrain, pad, skipZero, cleaned);
|
|
2359
|
-
|
|
2360
|
-
if (_isNumber(v)) {
|
|
2361
|
-
return formatted(v.toString().replace(".", ","));
|
|
2362
|
-
}
|
|
2363
|
-
|
|
2364
|
-
var fixComma = function fixComma(v) {
|
|
2365
|
-
return v.replace(/,/g, '').replace(splitRegex, "$1,$2");
|
|
2366
|
-
};
|
|
2367
|
-
|
|
2368
|
-
var format = function format() {
|
|
2369
|
-
var allowedChars = (v || "").replace(/[^\d,]/g, "");
|
|
2370
|
-
var commaIndex = allowedChars.indexOf(',');
|
|
2371
|
-
|
|
2372
|
-
if (commaIndex >= 0 && commaIndex < allowedChars.length - 1 - digits) {
|
|
2373
|
-
var alteredComma = fixComma(allowedChars);
|
|
2374
|
-
|
|
2375
|
-
if (_isNumber(max) && parseFloat(alteredComma.replace(",", ".")) > max) {
|
|
2376
|
-
return fixComma(allowedChars.slice(0, commaIndex + 1 + digits));
|
|
2377
|
-
}
|
|
2378
|
-
|
|
2379
|
-
return alteredComma;
|
|
2380
|
-
}
|
|
2381
|
-
|
|
2382
|
-
var simpleNumber = allowedChars.replace(singleRegex, "$1");
|
|
2383
|
-
|
|
2384
|
-
if (_isNumber(max) && parseInt(simpleNumber) > max) {
|
|
2385
|
-
return simpleNumber.slice(0, -1);
|
|
2386
|
-
}
|
|
2387
|
-
|
|
2388
|
-
return simpleNumber;
|
|
2389
|
-
};
|
|
2390
|
-
|
|
2391
|
-
var result = format();
|
|
2392
|
-
return formatted(result);
|
|
2393
|
-
};
|
|
2394
|
-
};
|
|
2395
|
-
var parseDecimalToNumber = function parseDecimalToNumber(v) {
|
|
2396
|
-
return _isString(v) ? Number(v.replace(/\./g, '').replace(',', ".")) : v || 0;
|
|
2397
|
-
};
|
|
2398
|
-
|
|
2399
|
-
export { Action, COMPLETE_ACTION, DAY, FETCH, HOUR, MINUTE, MONTH, REDUCE, SECOND, SKIPPED_ACTION, SKIP_DISPATCH, SKIP_FETCH, SkipAction, WEEK, YEAR, _s, activateActions, addExtraProp, addHttp, addQueryString, addZero, animationTiming, asciify, asyncDebounce, blockDiffIntervals, callIfFunction, callIfFunctions, callMany, cancelableTimer, compareBest, concatSelectors, constrainEvent, createPressAndHoldEvent, createPressAndMoveEvent, createPressEvent, createPromiseQueue, createPromiseResolverPair, createSimplePromiseLock, customTheme, diffIntervals, digitsToPattern, ellipsis, fixMediaQuery, formFetch, formFetchWithResponse, formatDate, formatDateToPattern, formatHour, formatJoin, formatJoinArr, formatPath, getClosestOffsetScroll, getColor, getFetcher, getFetcherWithResponse, getMargin, getNumberInputType, getNumberInputType2, getScrollParent, getStartOfDay, getUID, getUrlParams, identityFn, identityOpacityFrames, identityTranslateFrames, ifNotProp, ifProp, ifPropEquals, ifUndefined, intToHour, intervalsIntersect, intervalsIntersectExclusive, intervalsIntersection, intsToHour, isAndroid, isElementInView, isEmptyHtml, isHighDensity, isIOS, isIPad, isMobile, isPWA, isRetina, isSameDay, isShallowEqual, isShallowEqualSameKeys, isSmallDevice, isTouchDevice, isUrl, lazyValue, linkRegex, mapGetOrSet, media, normalizeMouse, normalizePress, normalizeText, normalizeTextUrl, normalizeTouch, notPrinterMedia, oneWayAnimation, parseDate, parseDecimalToNumber, postFetcher, postFetcherWithResponse, preventDefault, printerMedia, promiseMapReduce, prop, queryStringToObj, rafThrottle, removeAccents, safeNewLineToBr, scrollIntoViewWithOffset, scrollWidth, selectPath, smoothScroll, startBlockDiffIntervals, stopPropagation, styledExtend, timerPromise, toHighest, toLowest, touchClick, twoWayAnimation, useEventListener, useEventListenerFor, useEventListenerIf, using, vheight, will, willFormatDecimal, willRafThrottle, wrapLazy };
|