UNPKG

98.9 kBJavaScriptView Raw
1(function (global, factory) {
2 typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('styled-components'), require('lodash'), require('rxjs')) :
3 typeof define === 'function' && define.amd ? define(['exports', 'react', 'styled-components', 'lodash', 'rxjs'], factory) :
4 (global = global || self, factory(global.WenerUi = {}, global.React, global.styled, global._, global.Rx));
5}(this, (function (exports, React, styled, lodash, rxjs) { 'use strict';
6
7 var React__default = 'default' in React ? React['default'] : React;
8 styled = styled && Object.prototype.hasOwnProperty.call(styled, 'default') ? styled['default'] : styled;
9
10 function _typeof(obj) {
11 "@babel/helpers - typeof";
12
13 if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
14 _typeof = function (obj) {
15 return typeof obj;
16 };
17 } else {
18 _typeof = function (obj) {
19 return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
20 };
21 }
22
23 return _typeof(obj);
24 }
25
26 function _defineProperty(obj, key, value) {
27 if (key in obj) {
28 Object.defineProperty(obj, key, {
29 value: value,
30 enumerable: true,
31 configurable: true,
32 writable: true
33 });
34 } else {
35 obj[key] = value;
36 }
37
38 return obj;
39 }
40
41 function ownKeys(object, enumerableOnly) {
42 var keys = Object.keys(object);
43
44 if (Object.getOwnPropertySymbols) {
45 var symbols = Object.getOwnPropertySymbols(object);
46 if (enumerableOnly) symbols = symbols.filter(function (sym) {
47 return Object.getOwnPropertyDescriptor(object, sym).enumerable;
48 });
49 keys.push.apply(keys, symbols);
50 }
51
52 return keys;
53 }
54
55 function _objectSpread2(target) {
56 for (var i = 1; i < arguments.length; i++) {
57 var source = arguments[i] != null ? arguments[i] : {};
58
59 if (i % 2) {
60 ownKeys(Object(source), true).forEach(function (key) {
61 _defineProperty(target, key, source[key]);
62 });
63 } else if (Object.getOwnPropertyDescriptors) {
64 Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
65 } else {
66 ownKeys(Object(source)).forEach(function (key) {
67 Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
68 });
69 }
70 }
71
72 return target;
73 }
74
75 function _taggedTemplateLiteral(strings, raw) {
76 if (!raw) {
77 raw = strings.slice(0);
78 }
79
80 return Object.freeze(Object.defineProperties(strings, {
81 raw: {
82 value: Object.freeze(raw)
83 }
84 }));
85 }
86
87 function _slicedToArray(arr, i) {
88 return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
89 }
90
91 function _arrayWithHoles(arr) {
92 if (Array.isArray(arr)) return arr;
93 }
94
95 function _iterableToArrayLimit(arr, i) {
96 if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return;
97 var _arr = [];
98 var _n = true;
99 var _d = false;
100 var _e = undefined;
101
102 try {
103 for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
104 _arr.push(_s.value);
105
106 if (i && _arr.length === i) break;
107 }
108 } catch (err) {
109 _d = true;
110 _e = err;
111 } finally {
112 try {
113 if (!_n && _i["return"] != null) _i["return"]();
114 } finally {
115 if (_d) throw _e;
116 }
117 }
118
119 return _arr;
120 }
121
122 function _unsupportedIterableToArray(o, minLen) {
123 if (!o) return;
124 if (typeof o === "string") return _arrayLikeToArray(o, minLen);
125 var n = Object.prototype.toString.call(o).slice(8, -1);
126 if (n === "Object" && o.constructor) n = o.constructor.name;
127 if (n === "Map" || n === "Set") return Array.from(o);
128 if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
129 }
130
131 function _arrayLikeToArray(arr, len) {
132 if (len == null || len > arr.length) len = arr.length;
133
134 for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
135
136 return arr2;
137 }
138
139 function _nonIterableRest() {
140 throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
141 }
142
143 function _templateObject5() {
144 var data = _taggedTemplateLiteral(["\n .leo {\n position: absolute;\n display: flex;\n justify-content: center;\n align-items: center;\n border-radius: 50%;\n }\n\n .blue-orbit {\n width: 165px;\n height: 165px;\n border: 1px solid #91daffa5;\n -webkit-animation: spin3D 3s linear 0.2s infinite;\n }\n\n .green-orbit {\n width: 120px;\n height: 120px;\n border: 1px solid #91ffbfa5;\n -webkit-animation: spin3D 2s linear 0s infinite;\n }\n\n .red-orbit {\n width: 90px;\n height: 90px;\n border: 1px solid #ffca91a5;\n -webkit-animation: spin3D 1s linear 0s infinite;\n }\n\n .white-orbit {\n width: 60px;\n height: 60px;\n border: 2px solid #ffffff;\n -webkit-animation: spin3D 10s linear 0s infinite;\n }\n\n .w1 {\n transform: rotate3D(1, 1, 1, 90deg);\n }\n\n .w2 {\n transform: rotate3D(1, 2, 0.5, 90deg);\n }\n\n .w3 {\n transform: rotate3D(0.5, 1, 2, 90deg);\n }\n\n @keyframes spin {\n from {\n transform: rotate(0);\n }\n to {\n transform: rotate(359deg);\n }\n }\n\n @keyframes spin3D {\n from {\n transform: rotate3d(0.5, 0.5, 0.5, 360deg);\n }\n to {\n transform: rotate3d(0deg);\n }\n }\n"]);
145
146 _templateObject5 = function _templateObject5() {
147 return data;
148 };
149
150 return data;
151 }
152
153 function _templateObject4() {
154 var data = _taggedTemplateLiteral(["\n .solar-system {\n width: 250px;\n height: 250px;\n display: flex;\n justify-content: center;\n align-items: center;\n }\n\n .orbit {\n position: relative;\n display: flex;\n justify-content: center;\n align-items: center;\n border: 1px solid #ffffffa5;\n border-radius: 50%;\n }\n\n .earth-orbit {\n width: 165px;\n height: 165px;\n animation: spin 12s linear 0s infinite;\n }\n\n .venus-orbit {\n width: 120px;\n height: 120px;\n animation: spin 7.4s linear 0s infinite;\n }\n\n .mercury-orbit {\n width: 90px;\n height: 90px;\n animation: spin 3s linear 0s infinite;\n }\n\n .planet {\n position: absolute;\n top: -5px;\n width: 10px;\n height: 10px;\n border-radius: 50%;\n background-color: #3ff9dc;\n }\n\n .sun {\n width: 35px;\n height: 35px;\n border-radius: 50%;\n background-color: #ffab91;\n }\n"]);
155
156 _templateObject4 = function _templateObject4() {
157 return data;
158 };
159
160 return data;
161 }
162
163 function _templateObject3() {
164 var data = _taggedTemplateLiteral(["\n .pulse-container {\n width: 120px;\n display: flex;\n justify-content: space-between;\n align-items: center;\n }\n\n .pulse-bubble {\n width: 20px;\n height: 20px;\n border-radius: 50%;\n background-color: #3ff9dc;\n }\n\n .pulse-bubble-1 {\n animation: pulse 0.4s ease 0s infinite alternate;\n }\n .pulse-bubble-2 {\n animation: pulse 0.4s ease 0.2s infinite alternate;\n }\n .pulse-bubble-3 {\n animation: pulse 0.4s ease 0.4s infinite alternate;\n }\n @keyframes pulse {\n from {\n opacity: 1;\n transform: scale(1);\n }\n to {\n opacity: 0.25;\n transform: scale(0.75);\n }\n }\n"]);
165
166 _templateObject3 = function _templateObject3() {
167 return data;
168 };
169
170 return data;
171 }
172
173 function _templateObject2() {
174 var data = _taggedTemplateLiteral(["\n .circle-border {\n width: 150px;\n height: 150px;\n padding: 3px;\n display: flex;\n justify-content: center;\n align-items: center;\n border-radius: 50%;\n background: rgb(63, 249, 220);\n background: linear-gradient(0deg, rgba(63, 249, 220, 0.1) 33%, rgba(63, 249, 220, 1) 100%);\n animation: spin 0.8s linear 0s infinite;\n }\n\n .circle-core {\n width: 100%;\n height: 100%;\n background-color: #37474f;\n border-radius: 50%;\n }\n\n @keyframes spin {\n from {\n transform: rotate(0);\n }\n to {\n transform: rotate(359deg);\n }\n }\n"]);
175
176 _templateObject2 = function _templateObject2() {
177 return data;
178 };
179
180 return data;
181 }
182
183 function _templateObject() {
184 var data = _taggedTemplateLiteral(["\n width: 300px;\n height: 300px;\n display: flex;\n justify-content: center;\n align-items: center;\n background-color: transparent;\n"]);
185
186 _templateObject = function _templateObject() {
187 return data;
188 };
189
190 return data;
191 }
192
193 var SpinnerBox = styled.div(_templateObject());
194 var GradientSpinnerBox = styled(SpinnerBox)(_templateObject2());
195 var PulseBubbleBox = styled(SpinnerBox)(_templateObject3());
196 var GradientSpinner = function GradientSpinner() {
197 return /*#__PURE__*/React__default.createElement(GradientSpinnerBox, null, /*#__PURE__*/React__default.createElement("div", {
198 className: "circle-border"
199 }, /*#__PURE__*/React__default.createElement("div", {
200 className: "circle-core"
201 })));
202 };
203 var PulseBubble = function PulseBubble() {
204 return /*#__PURE__*/React__default.createElement(PulseBubbleBox, null, /*#__PURE__*/React__default.createElement("div", {
205 className: "pulse-container"
206 }, /*#__PURE__*/React__default.createElement("div", {
207 className: "pulse-bubble pulse-bubble-1"
208 }), /*#__PURE__*/React__default.createElement("div", {
209 className: "pulse-bubble pulse-bubble-2"
210 }), /*#__PURE__*/React__default.createElement("div", {
211 className: "pulse-bubble pulse-bubble-3"
212 })));
213 };
214 var SolarSystemBox = styled(SpinnerBox)(_templateObject4());
215 var SolarSystemSpinner = function SolarSystemSpinner() {
216 return /*#__PURE__*/React__default.createElement(SolarSystemBox, null, /*#__PURE__*/React__default.createElement("div", {
217 className: "solar-system"
218 }, /*#__PURE__*/React__default.createElement("div", {
219 className: "earth-orbit orbit"
220 }, /*#__PURE__*/React__default.createElement("div", {
221 className: "planet earth"
222 }), /*#__PURE__*/React__default.createElement("div", {
223 className: "venus-orbit orbit"
224 }, /*#__PURE__*/React__default.createElement("div", {
225 className: "planet venus"
226 }), /*#__PURE__*/React__default.createElement("div", {
227 className: "mercury-orbit orbit"
228 }, /*#__PURE__*/React__default.createElement("div", {
229 className: "planet mercury"
230 }), /*#__PURE__*/React__default.createElement("div", {
231 className: "sun"
232 }))))));
233 };
234 var PlanetRotatingBox = styled(SpinnerBox)(_templateObject5());
235 var PlantRotating = function PlantRotating() {
236 return /*#__PURE__*/React__default.createElement(PlanetRotatingBox, null, /*#__PURE__*/React__default.createElement("div", {
237 className: "blue-orbit leo"
238 }), /*#__PURE__*/React__default.createElement("div", {
239 className: "green-orbit leo"
240 }), /*#__PURE__*/React__default.createElement("div", {
241 className: "red-orbit leo"
242 }), /*#__PURE__*/React__default.createElement("div", {
243 className: "white-orbit w1 leo"
244 }), /*#__PURE__*/React__default.createElement("div", {
245 className: "white-orbit w2 leo"
246 }), /*#__PURE__*/React__default.createElement("div", {
247 className: "white-orbit w3 leo"
248 }));
249 };
250
251 function _templateObject$1() {
252 var data = _taggedTemplateLiteral(["\n position: absolute;\n width: 35px;\n height: 35px;\n left: 50%;\n top: 50%;\n & > div {\n position: absolute;\n width: 2px;\n height: 8px;\n background-color: #25363f;\n opacity: 0.05;\n animation: fadeit 0.8s linear infinite;\n }\n\n ", "\n\n @keyframes fadeit {\n 0% {\n opacity: 1;\n }\n 100% {\n opacity: 0;\n }\n }\n"]);
253
254 _templateObject$1 = function _templateObject() {
255 return data;
256 };
257
258 return data;
259 }
260
261 var BarsSpinnerBox = styled.div(_templateObject$1(), function (_ref) {
262 var bars = _ref.bars;
263 return Array(bars).fill(null).map(function (_, i) {
264 return "\n & > div:nth-child(".concat(i + 1, ") {\n transform: rotate(").concat((360 / bars * i).toFixed(2), "deg) translate(0, -12px);\n animation-delay:").concat((0.8 / bars * (i + 1)).toFixed(2), "s;\n }\n ");
265 });
266 });
267 var BarsSpinner = function BarsSpinner(_ref2) {
268 var _ref2$bars = _ref2.bars,
269 bars = _ref2$bars === void 0 ? 16 : _ref2$bars;
270 return /*#__PURE__*/React__default.createElement(BarsSpinnerBox, {
271 bars: bars
272 }, Array(bars).fill(null).map(function (_, i) {
273 return /*#__PURE__*/React__default.createElement("div", {
274 key: i
275 });
276 }));
277 };
278
279 function _extends() {
280 _extends = Object.assign || function (target) {
281 for (var i = 1; i < arguments.length; i++) {
282 var source = arguments[i];
283
284 for (var key in source) {
285 if (Object.prototype.hasOwnProperty.call(source, key)) {
286 target[key] = source[key];
287 }
288 }
289 }
290
291 return target;
292 };
293
294 return _extends.apply(this, arguments);
295 }
296
297 function _assertThisInitialized(self) {
298 if (self === void 0) {
299 throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
300 }
301
302 return self;
303 }
304
305 function _inheritsLoose(subClass, superClass) {
306 subClass.prototype = Object.create(superClass.prototype);
307 subClass.prototype.constructor = subClass;
308 subClass.__proto__ = superClass;
309 }
310
311 function _getPrototypeOf(o) {
312 _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
313 return o.__proto__ || Object.getPrototypeOf(o);
314 };
315 return _getPrototypeOf(o);
316 }
317
318 function _setPrototypeOf(o, p) {
319 _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
320 o.__proto__ = p;
321 return o;
322 };
323
324 return _setPrototypeOf(o, p);
325 }
326
327 function _isNativeFunction(fn) {
328 return Function.toString.call(fn).indexOf("[native code]") !== -1;
329 }
330
331 function _isNativeReflectConstruct() {
332 if (typeof Reflect === "undefined" || !Reflect.construct) return false;
333 if (Reflect.construct.sham) return false;
334 if (typeof Proxy === "function") return true;
335
336 try {
337 Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
338 return true;
339 } catch (e) {
340 return false;
341 }
342 }
343
344 function _construct(Parent, args, Class) {
345 if (_isNativeReflectConstruct()) {
346 _construct = Reflect.construct;
347 } else {
348 _construct = function _construct(Parent, args, Class) {
349 var a = [null];
350 a.push.apply(a, args);
351 var Constructor = Function.bind.apply(Parent, a);
352 var instance = new Constructor();
353 if (Class) _setPrototypeOf(instance, Class.prototype);
354 return instance;
355 };
356 }
357
358 return _construct.apply(null, arguments);
359 }
360
361 function _wrapNativeSuper(Class) {
362 var _cache = typeof Map === "function" ? new Map() : undefined;
363
364 _wrapNativeSuper = function _wrapNativeSuper(Class) {
365 if (Class === null || !_isNativeFunction(Class)) return Class;
366
367 if (typeof Class !== "function") {
368 throw new TypeError("Super expression must either be null or a function");
369 }
370
371 if (typeof _cache !== "undefined") {
372 if (_cache.has(Class)) return _cache.get(Class);
373
374 _cache.set(Class, Wrapper);
375 }
376
377 function Wrapper() {
378 return _construct(Class, arguments, _getPrototypeOf(this).constructor);
379 }
380
381 Wrapper.prototype = Object.create(Class.prototype, {
382 constructor: {
383 value: Wrapper,
384 enumerable: false,
385 writable: true,
386 configurable: true
387 }
388 });
389 return _setPrototypeOf(Wrapper, Class);
390 };
391
392 return _wrapNativeSuper(Class);
393 }
394
395 /**
396 * Parse errors.md and turn it into a simple hash of code: message
397 * @private
398 */
399
400 var ERRORS = {
401 "1": "Passed invalid arguments to hsl, please pass multiple numbers e.g. hsl(360, 0.75, 0.4) or an object e.g. rgb({ hue: 255, saturation: 0.4, lightness: 0.75 }).\n\n",
402 "2": "Passed invalid arguments to hsla, please pass multiple numbers e.g. hsla(360, 0.75, 0.4, 0.7) or an object e.g. rgb({ hue: 255, saturation: 0.4, lightness: 0.75, alpha: 0.7 }).\n\n",
403 "3": "Passed an incorrect argument to a color function, please pass a string representation of a color.\n\n",
404 "4": "Couldn't generate valid rgb string from %s, it returned %s.\n\n",
405 "5": "Couldn't parse the color string. Please provide the color as a string in hex, rgb, rgba, hsl or hsla notation.\n\n",
406 "6": "Passed invalid arguments to rgb, please pass multiple numbers e.g. rgb(255, 205, 100) or an object e.g. rgb({ red: 255, green: 205, blue: 100 }).\n\n",
407 "7": "Passed invalid arguments to rgba, please pass multiple numbers e.g. rgb(255, 205, 100, 0.75) or an object e.g. rgb({ red: 255, green: 205, blue: 100, alpha: 0.75 }).\n\n",
408 "8": "Passed invalid argument to toColorString, please pass a RgbColor, RgbaColor, HslColor or HslaColor object.\n\n",
409 "9": "Please provide a number of steps to the modularScale helper.\n\n",
410 "10": "Please pass a number or one of the predefined scales to the modularScale helper as the ratio.\n\n",
411 "11": "Invalid value passed as base to modularScale, expected number or em string but got \"%s\"\n\n",
412 "12": "Expected a string ending in \"px\" or a number passed as the first argument to %s(), got \"%s\" instead.\n\n",
413 "13": "Expected a string ending in \"px\" or a number passed as the second argument to %s(), got \"%s\" instead.\n\n",
414 "14": "Passed invalid pixel value (\"%s\") to %s(), please pass a value like \"12px\" or 12.\n\n",
415 "15": "Passed invalid base value (\"%s\") to %s(), please pass a value like \"12px\" or 12.\n\n",
416 "16": "You must provide a template to this method.\n\n",
417 "17": "You passed an unsupported selector state to this method.\n\n",
418 "18": "minScreen and maxScreen must be provided as stringified numbers with the same units.\n\n",
419 "19": "fromSize and toSize must be provided as stringified numbers with the same units.\n\n",
420 "20": "expects either an array of objects or a single object with the properties prop, fromSize, and toSize.\n\n",
421 "21": "expects the objects in the first argument array to have the properties `prop`, `fromSize`, and `toSize`.\n\n",
422 "22": "expects the first argument object to have the properties `prop`, `fromSize`, and `toSize`.\n\n",
423 "23": "fontFace expects a name of a font-family.\n\n",
424 "24": "fontFace expects either the path to the font file(s) or a name of a local copy.\n\n",
425 "25": "fontFace expects localFonts to be an array.\n\n",
426 "26": "fontFace expects fileFormats to be an array.\n\n",
427 "27": "radialGradient requries at least 2 color-stops to properly render.\n\n",
428 "28": "Please supply a filename to retinaImage() as the first argument.\n\n",
429 "29": "Passed invalid argument to triangle, please pass correct pointingDirection e.g. 'right'.\n\n",
430 "30": "Passed an invalid value to `height` or `width`. Please provide a pixel based unit.\n\n",
431 "31": "The animation shorthand only takes 8 arguments. See the specification for more information: http://mdn.io/animation\n\n",
432 "32": "To pass multiple animations please supply them in arrays, e.g. animation(['rotate', '2s'], ['move', '1s'])\nTo pass a single animation please supply them in simple values, e.g. animation('rotate', '2s')\n\n",
433 "33": "The animation shorthand arrays can only have 8 elements. See the specification for more information: http://mdn.io/animation\n\n",
434 "34": "borderRadius expects a radius value as a string or number as the second argument.\n\n",
435 "35": "borderRadius expects one of \"top\", \"bottom\", \"left\" or \"right\" as the first argument.\n\n",
436 "36": "Property must be a string value.\n\n",
437 "37": "Syntax Error at %s.\n\n",
438 "38": "Formula contains a function that needs parentheses at %s.\n\n",
439 "39": "Formula is missing closing parenthesis at %s.\n\n",
440 "40": "Formula has too many closing parentheses at %s.\n\n",
441 "41": "All values in a formula must have the same unit or be unitless.\n\n",
442 "42": "Please provide a number of steps to the modularScale helper.\n\n",
443 "43": "Please pass a number or one of the predefined scales to the modularScale helper as the ratio.\n\n",
444 "44": "Invalid value passed as base to modularScale, expected number or em/rem string but got %s.\n\n",
445 "45": "Passed invalid argument to hslToColorString, please pass a HslColor or HslaColor object.\n\n",
446 "46": "Passed invalid argument to rgbToColorString, please pass a RgbColor or RgbaColor object.\n\n",
447 "47": "minScreen and maxScreen must be provided as stringified numbers with the same units.\n\n",
448 "48": "fromSize and toSize must be provided as stringified numbers with the same units.\n\n",
449 "49": "Expects either an array of objects or a single object with the properties prop, fromSize, and toSize.\n\n",
450 "50": "Expects the objects in the first argument array to have the properties prop, fromSize, and toSize.\n\n",
451 "51": "Expects the first argument object to have the properties prop, fromSize, and toSize.\n\n",
452 "52": "fontFace expects either the path to the font file(s) or a name of a local copy.\n\n",
453 "53": "fontFace expects localFonts to be an array.\n\n",
454 "54": "fontFace expects fileFormats to be an array.\n\n",
455 "55": "fontFace expects a name of a font-family.\n\n",
456 "56": "linearGradient requries at least 2 color-stops to properly render.\n\n",
457 "57": "radialGradient requries at least 2 color-stops to properly render.\n\n",
458 "58": "Please supply a filename to retinaImage() as the first argument.\n\n",
459 "59": "Passed invalid argument to triangle, please pass correct pointingDirection e.g. 'right'.\n\n",
460 "60": "Passed an invalid value to `height` or `width`. Please provide a pixel based unit.\n\n",
461 "61": "Property must be a string value.\n\n",
462 "62": "borderRadius expects a radius value as a string or number as the second argument.\n\n",
463 "63": "borderRadius expects one of \"top\", \"bottom\", \"left\" or \"right\" as the first argument.\n\n",
464 "64": "The animation shorthand only takes 8 arguments. See the specification for more information: http://mdn.io/animation.\n\n",
465 "65": "To pass multiple animations please supply them in arrays, e.g. animation(['rotate', '2s'], ['move', '1s'])\\nTo pass a single animation please supply them in simple values, e.g. animation('rotate', '2s').\n\n",
466 "66": "The animation shorthand arrays can only have 8 elements. See the specification for more information: http://mdn.io/animation.\n\n",
467 "67": "You must provide a template to this method.\n\n",
468 "68": "You passed an unsupported selector state to this method.\n\n",
469 "69": "Expected a string ending in \"px\" or a number passed as the first argument to %s(), got %s instead.\n\n",
470 "70": "Expected a string ending in \"px\" or a number passed as the second argument to %s(), got %s instead.\n\n",
471 "71": "Passed invalid pixel value %s to %s(), please pass a value like \"12px\" or 12.\n\n",
472 "72": "Passed invalid base value %s to %s(), please pass a value like \"12px\" or 12.\n\n",
473 "73": "Please provide a valid CSS variable.\n\n",
474 "74": "CSS variable not found.\n"
475 };
476 /**
477 * super basic version of sprintf
478 * @private
479 */
480
481 function format() {
482 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
483 args[_key] = arguments[_key];
484 }
485
486 var a = args[0];
487 var b = [];
488 var c;
489
490 for (c = 1; c < args.length; c += 1) {
491 b.push(args[c]);
492 }
493
494 b.forEach(function (d) {
495 a = a.replace(/%[a-z]/, d);
496 });
497 return a;
498 }
499 /**
500 * Create an error file out of errors.md for development and a simple web link to the full errors
501 * in production mode.
502 * @private
503 */
504
505
506 var PolishedError = /*#__PURE__*/function (_Error) {
507 _inheritsLoose(PolishedError, _Error);
508
509 function PolishedError(code) {
510 var _this;
511
512 if (process.env.NODE_ENV === 'production') {
513 _this = _Error.call(this, "An error occurred. See https://github.com/styled-components/polished/blob/master/src/internalHelpers/errors.md#" + code + " for more information.") || this;
514 } else {
515 for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
516 args[_key2 - 1] = arguments[_key2];
517 }
518
519 _this = _Error.call(this, format.apply(void 0, [ERRORS[code]].concat(args))) || this;
520 }
521
522 return _assertThisInitialized(_this);
523 }
524
525 return PolishedError;
526 }( /*#__PURE__*/_wrapNativeSuper(Error));
527
528 function colorToInt(color) {
529 return Math.round(color * 255);
530 }
531
532 function convertToInt(red, green, blue) {
533 return colorToInt(red) + "," + colorToInt(green) + "," + colorToInt(blue);
534 }
535
536 function hslToRgb(hue, saturation, lightness, convert) {
537 if (convert === void 0) {
538 convert = convertToInt;
539 }
540
541 if (saturation === 0) {
542 // achromatic
543 return convert(lightness, lightness, lightness);
544 } // formulae from https://en.wikipedia.org/wiki/HSL_and_HSV
545
546
547 var huePrime = (hue % 360 + 360) % 360 / 60;
548 var chroma = (1 - Math.abs(2 * lightness - 1)) * saturation;
549 var secondComponent = chroma * (1 - Math.abs(huePrime % 2 - 1));
550 var red = 0;
551 var green = 0;
552 var blue = 0;
553
554 if (huePrime >= 0 && huePrime < 1) {
555 red = chroma;
556 green = secondComponent;
557 } else if (huePrime >= 1 && huePrime < 2) {
558 red = secondComponent;
559 green = chroma;
560 } else if (huePrime >= 2 && huePrime < 3) {
561 green = chroma;
562 blue = secondComponent;
563 } else if (huePrime >= 3 && huePrime < 4) {
564 green = secondComponent;
565 blue = chroma;
566 } else if (huePrime >= 4 && huePrime < 5) {
567 red = secondComponent;
568 blue = chroma;
569 } else if (huePrime >= 5 && huePrime < 6) {
570 red = chroma;
571 blue = secondComponent;
572 }
573
574 var lightnessModification = lightness - chroma / 2;
575 var finalRed = red + lightnessModification;
576 var finalGreen = green + lightnessModification;
577 var finalBlue = blue + lightnessModification;
578 return convert(finalRed, finalGreen, finalBlue);
579 }
580
581 var namedColorMap = {
582 aliceblue: 'f0f8ff',
583 antiquewhite: 'faebd7',
584 aqua: '00ffff',
585 aquamarine: '7fffd4',
586 azure: 'f0ffff',
587 beige: 'f5f5dc',
588 bisque: 'ffe4c4',
589 black: '000',
590 blanchedalmond: 'ffebcd',
591 blue: '0000ff',
592 blueviolet: '8a2be2',
593 brown: 'a52a2a',
594 burlywood: 'deb887',
595 cadetblue: '5f9ea0',
596 chartreuse: '7fff00',
597 chocolate: 'd2691e',
598 coral: 'ff7f50',
599 cornflowerblue: '6495ed',
600 cornsilk: 'fff8dc',
601 crimson: 'dc143c',
602 cyan: '00ffff',
603 darkblue: '00008b',
604 darkcyan: '008b8b',
605 darkgoldenrod: 'b8860b',
606 darkgray: 'a9a9a9',
607 darkgreen: '006400',
608 darkgrey: 'a9a9a9',
609 darkkhaki: 'bdb76b',
610 darkmagenta: '8b008b',
611 darkolivegreen: '556b2f',
612 darkorange: 'ff8c00',
613 darkorchid: '9932cc',
614 darkred: '8b0000',
615 darksalmon: 'e9967a',
616 darkseagreen: '8fbc8f',
617 darkslateblue: '483d8b',
618 darkslategray: '2f4f4f',
619 darkslategrey: '2f4f4f',
620 darkturquoise: '00ced1',
621 darkviolet: '9400d3',
622 deeppink: 'ff1493',
623 deepskyblue: '00bfff',
624 dimgray: '696969',
625 dimgrey: '696969',
626 dodgerblue: '1e90ff',
627 firebrick: 'b22222',
628 floralwhite: 'fffaf0',
629 forestgreen: '228b22',
630 fuchsia: 'ff00ff',
631 gainsboro: 'dcdcdc',
632 ghostwhite: 'f8f8ff',
633 gold: 'ffd700',
634 goldenrod: 'daa520',
635 gray: '808080',
636 green: '008000',
637 greenyellow: 'adff2f',
638 grey: '808080',
639 honeydew: 'f0fff0',
640 hotpink: 'ff69b4',
641 indianred: 'cd5c5c',
642 indigo: '4b0082',
643 ivory: 'fffff0',
644 khaki: 'f0e68c',
645 lavender: 'e6e6fa',
646 lavenderblush: 'fff0f5',
647 lawngreen: '7cfc00',
648 lemonchiffon: 'fffacd',
649 lightblue: 'add8e6',
650 lightcoral: 'f08080',
651 lightcyan: 'e0ffff',
652 lightgoldenrodyellow: 'fafad2',
653 lightgray: 'd3d3d3',
654 lightgreen: '90ee90',
655 lightgrey: 'd3d3d3',
656 lightpink: 'ffb6c1',
657 lightsalmon: 'ffa07a',
658 lightseagreen: '20b2aa',
659 lightskyblue: '87cefa',
660 lightslategray: '789',
661 lightslategrey: '789',
662 lightsteelblue: 'b0c4de',
663 lightyellow: 'ffffe0',
664 lime: '0f0',
665 limegreen: '32cd32',
666 linen: 'faf0e6',
667 magenta: 'f0f',
668 maroon: '800000',
669 mediumaquamarine: '66cdaa',
670 mediumblue: '0000cd',
671 mediumorchid: 'ba55d3',
672 mediumpurple: '9370db',
673 mediumseagreen: '3cb371',
674 mediumslateblue: '7b68ee',
675 mediumspringgreen: '00fa9a',
676 mediumturquoise: '48d1cc',
677 mediumvioletred: 'c71585',
678 midnightblue: '191970',
679 mintcream: 'f5fffa',
680 mistyrose: 'ffe4e1',
681 moccasin: 'ffe4b5',
682 navajowhite: 'ffdead',
683 navy: '000080',
684 oldlace: 'fdf5e6',
685 olive: '808000',
686 olivedrab: '6b8e23',
687 orange: 'ffa500',
688 orangered: 'ff4500',
689 orchid: 'da70d6',
690 palegoldenrod: 'eee8aa',
691 palegreen: '98fb98',
692 paleturquoise: 'afeeee',
693 palevioletred: 'db7093',
694 papayawhip: 'ffefd5',
695 peachpuff: 'ffdab9',
696 peru: 'cd853f',
697 pink: 'ffc0cb',
698 plum: 'dda0dd',
699 powderblue: 'b0e0e6',
700 purple: '800080',
701 rebeccapurple: '639',
702 red: 'f00',
703 rosybrown: 'bc8f8f',
704 royalblue: '4169e1',
705 saddlebrown: '8b4513',
706 salmon: 'fa8072',
707 sandybrown: 'f4a460',
708 seagreen: '2e8b57',
709 seashell: 'fff5ee',
710 sienna: 'a0522d',
711 silver: 'c0c0c0',
712 skyblue: '87ceeb',
713 slateblue: '6a5acd',
714 slategray: '708090',
715 slategrey: '708090',
716 snow: 'fffafa',
717 springgreen: '00ff7f',
718 steelblue: '4682b4',
719 tan: 'd2b48c',
720 teal: '008080',
721 thistle: 'd8bfd8',
722 tomato: 'ff6347',
723 turquoise: '40e0d0',
724 violet: 'ee82ee',
725 wheat: 'f5deb3',
726 white: 'fff',
727 whitesmoke: 'f5f5f5',
728 yellow: 'ff0',
729 yellowgreen: '9acd32'
730 };
731 /**
732 * Checks if a string is a CSS named color and returns its equivalent hex value, otherwise returns the original color.
733 * @private
734 */
735
736 function nameToHex(color) {
737 if (typeof color !== 'string') return color;
738 var normalizedColorName = color.toLowerCase();
739 return namedColorMap[normalizedColorName] ? "#" + namedColorMap[normalizedColorName] : color;
740 }
741
742 var hexRegex = /^#[a-fA-F0-9]{6}$/;
743 var hexRgbaRegex = /^#[a-fA-F0-9]{8}$/;
744 var reducedHexRegex = /^#[a-fA-F0-9]{3}$/;
745 var reducedRgbaHexRegex = /^#[a-fA-F0-9]{4}$/;
746 var rgbRegex = /^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/i;
747 var rgbaRegex = /^rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*([-+]?[0-9]*[.]?[0-9]+)\s*\)$/i;
748 var hslRegex = /^hsl\(\s*(\d{0,3}[.]?[0-9]+)\s*,\s*(\d{1,3}[.]?[0-9]?)%\s*,\s*(\d{1,3}[.]?[0-9]?)%\s*\)$/i;
749 var hslaRegex = /^hsla\(\s*(\d{0,3}[.]?[0-9]+)\s*,\s*(\d{1,3}[.]?[0-9]?)%\s*,\s*(\d{1,3}[.]?[0-9]?)%\s*,\s*([-+]?[0-9]*[.]?[0-9]+)\s*\)$/i;
750 /**
751 * Returns an RgbColor or RgbaColor object. This utility function is only useful
752 * if want to extract a color component. With the color util `toColorString` you
753 * can convert a RgbColor or RgbaColor object back to a string.
754 *
755 * @example
756 * // Assigns `{ red: 255, green: 0, blue: 0 }` to color1
757 * const color1 = parseToRgb('rgb(255, 0, 0)');
758 * // Assigns `{ red: 92, green: 102, blue: 112, alpha: 0.75 }` to color2
759 * const color2 = parseToRgb('hsla(210, 10%, 40%, 0.75)');
760 */
761
762 function parseToRgb(color) {
763 if (typeof color !== 'string') {
764 throw new PolishedError(3);
765 }
766
767 var normalizedColor = nameToHex(color);
768
769 if (normalizedColor.match(hexRegex)) {
770 return {
771 red: parseInt("" + normalizedColor[1] + normalizedColor[2], 16),
772 green: parseInt("" + normalizedColor[3] + normalizedColor[4], 16),
773 blue: parseInt("" + normalizedColor[5] + normalizedColor[6], 16)
774 };
775 }
776
777 if (normalizedColor.match(hexRgbaRegex)) {
778 var alpha = parseFloat((parseInt("" + normalizedColor[7] + normalizedColor[8], 16) / 255).toFixed(2));
779 return {
780 red: parseInt("" + normalizedColor[1] + normalizedColor[2], 16),
781 green: parseInt("" + normalizedColor[3] + normalizedColor[4], 16),
782 blue: parseInt("" + normalizedColor[5] + normalizedColor[6], 16),
783 alpha: alpha
784 };
785 }
786
787 if (normalizedColor.match(reducedHexRegex)) {
788 return {
789 red: parseInt("" + normalizedColor[1] + normalizedColor[1], 16),
790 green: parseInt("" + normalizedColor[2] + normalizedColor[2], 16),
791 blue: parseInt("" + normalizedColor[3] + normalizedColor[3], 16)
792 };
793 }
794
795 if (normalizedColor.match(reducedRgbaHexRegex)) {
796 var _alpha = parseFloat((parseInt("" + normalizedColor[4] + normalizedColor[4], 16) / 255).toFixed(2));
797
798 return {
799 red: parseInt("" + normalizedColor[1] + normalizedColor[1], 16),
800 green: parseInt("" + normalizedColor[2] + normalizedColor[2], 16),
801 blue: parseInt("" + normalizedColor[3] + normalizedColor[3], 16),
802 alpha: _alpha
803 };
804 }
805
806 var rgbMatched = rgbRegex.exec(normalizedColor);
807
808 if (rgbMatched) {
809 return {
810 red: parseInt("" + rgbMatched[1], 10),
811 green: parseInt("" + rgbMatched[2], 10),
812 blue: parseInt("" + rgbMatched[3], 10)
813 };
814 }
815
816 var rgbaMatched = rgbaRegex.exec(normalizedColor);
817
818 if (rgbaMatched) {
819 return {
820 red: parseInt("" + rgbaMatched[1], 10),
821 green: parseInt("" + rgbaMatched[2], 10),
822 blue: parseInt("" + rgbaMatched[3], 10),
823 alpha: parseFloat("" + rgbaMatched[4])
824 };
825 }
826
827 var hslMatched = hslRegex.exec(normalizedColor);
828
829 if (hslMatched) {
830 var hue = parseInt("" + hslMatched[1], 10);
831 var saturation = parseInt("" + hslMatched[2], 10) / 100;
832 var lightness = parseInt("" + hslMatched[3], 10) / 100;
833 var rgbColorString = "rgb(" + hslToRgb(hue, saturation, lightness) + ")";
834 var hslRgbMatched = rgbRegex.exec(rgbColorString);
835
836 if (!hslRgbMatched) {
837 throw new PolishedError(4, normalizedColor, rgbColorString);
838 }
839
840 return {
841 red: parseInt("" + hslRgbMatched[1], 10),
842 green: parseInt("" + hslRgbMatched[2], 10),
843 blue: parseInt("" + hslRgbMatched[3], 10)
844 };
845 }
846
847 var hslaMatched = hslaRegex.exec(normalizedColor);
848
849 if (hslaMatched) {
850 var _hue = parseInt("" + hslaMatched[1], 10);
851
852 var _saturation = parseInt("" + hslaMatched[2], 10) / 100;
853
854 var _lightness = parseInt("" + hslaMatched[3], 10) / 100;
855
856 var _rgbColorString = "rgb(" + hslToRgb(_hue, _saturation, _lightness) + ")";
857
858 var _hslRgbMatched = rgbRegex.exec(_rgbColorString);
859
860 if (!_hslRgbMatched) {
861 throw new PolishedError(4, normalizedColor, _rgbColorString);
862 }
863
864 return {
865 red: parseInt("" + _hslRgbMatched[1], 10),
866 green: parseInt("" + _hslRgbMatched[2], 10),
867 blue: parseInt("" + _hslRgbMatched[3], 10),
868 alpha: parseFloat("" + hslaMatched[4])
869 };
870 }
871
872 throw new PolishedError(5);
873 }
874
875 function rgbToHsl(color) {
876 // make sure rgb are contained in a set of [0, 255]
877 var red = color.red / 255;
878 var green = color.green / 255;
879 var blue = color.blue / 255;
880 var max = Math.max(red, green, blue);
881 var min = Math.min(red, green, blue);
882 var lightness = (max + min) / 2;
883
884 if (max === min) {
885 // achromatic
886 if (color.alpha !== undefined) {
887 return {
888 hue: 0,
889 saturation: 0,
890 lightness: lightness,
891 alpha: color.alpha
892 };
893 } else {
894 return {
895 hue: 0,
896 saturation: 0,
897 lightness: lightness
898 };
899 }
900 }
901
902 var hue;
903 var delta = max - min;
904 var saturation = lightness > 0.5 ? delta / (2 - max - min) : delta / (max + min);
905
906 switch (max) {
907 case red:
908 hue = (green - blue) / delta + (green < blue ? 6 : 0);
909 break;
910
911 case green:
912 hue = (blue - red) / delta + 2;
913 break;
914
915 default:
916 // blue case
917 hue = (red - green) / delta + 4;
918 break;
919 }
920
921 hue *= 60;
922
923 if (color.alpha !== undefined) {
924 return {
925 hue: hue,
926 saturation: saturation,
927 lightness: lightness,
928 alpha: color.alpha
929 };
930 }
931
932 return {
933 hue: hue,
934 saturation: saturation,
935 lightness: lightness
936 };
937 }
938 /**
939 * Returns an HslColor or HslaColor object. This utility function is only useful
940 * if want to extract a color component. With the color util `toColorString` you
941 * can convert a HslColor or HslaColor object back to a string.
942 *
943 * @example
944 * // Assigns `{ hue: 0, saturation: 1, lightness: 0.5 }` to color1
945 * const color1 = parseToHsl('rgb(255, 0, 0)');
946 * // Assigns `{ hue: 128, saturation: 1, lightness: 0.5, alpha: 0.75 }` to color2
947 * const color2 = parseToHsl('hsla(128, 100%, 50%, 0.75)');
948 */
949
950
951 function parseToHsl(color) {
952 // Note: At a later stage we can optimize this function as right now a hsl
953 // color would be parsed converted to rgb values and converted back to hsl.
954 return rgbToHsl(parseToRgb(color));
955 }
956 /**
957 * Reduces hex values if possible e.g. #ff8866 to #f86
958 * @private
959 */
960
961
962 var reduceHexValue = function reduceHexValue(value) {
963 if (value.length === 7 && value[1] === value[2] && value[3] === value[4] && value[5] === value[6]) {
964 return "#" + value[1] + value[3] + value[5];
965 }
966
967 return value;
968 };
969
970 function numberToHex(value) {
971 var hex = value.toString(16);
972 return hex.length === 1 ? "0" + hex : hex;
973 }
974
975 function colorToHex(color) {
976 return numberToHex(Math.round(color * 255));
977 }
978
979 function convertToHex(red, green, blue) {
980 return reduceHexValue("#" + colorToHex(red) + colorToHex(green) + colorToHex(blue));
981 }
982
983 function hslToHex(hue, saturation, lightness) {
984 return hslToRgb(hue, saturation, lightness, convertToHex);
985 }
986 /**
987 * Returns a string value for the color. The returned result is the smallest possible hex notation.
988 *
989 * @example
990 * // Styles as object usage
991 * const styles = {
992 * background: hsl(359, 0.75, 0.4),
993 * background: hsl({ hue: 360, saturation: 0.75, lightness: 0.4 }),
994 * }
995 *
996 * // styled-components usage
997 * const div = styled.div`
998 * background: ${hsl(359, 0.75, 0.4)};
999 * background: ${hsl({ hue: 360, saturation: 0.75, lightness: 0.4 })};
1000 * `
1001 *
1002 * // CSS in JS Output
1003 *
1004 * element {
1005 * background: "#b3191c";
1006 * background: "#b3191c";
1007 * }
1008 */
1009
1010
1011 function hsl(value, saturation, lightness) {
1012 if (typeof value === 'number' && typeof saturation === 'number' && typeof lightness === 'number') {
1013 return hslToHex(value, saturation, lightness);
1014 } else if (_typeof(value) === 'object' && saturation === undefined && lightness === undefined) {
1015 return hslToHex(value.hue, value.saturation, value.lightness);
1016 }
1017
1018 throw new PolishedError(1);
1019 }
1020 /**
1021 * Returns a string value for the color. The returned result is the smallest possible rgba or hex notation.
1022 *
1023 * @example
1024 * // Styles as object usage
1025 * const styles = {
1026 * background: hsla(359, 0.75, 0.4, 0.7),
1027 * background: hsla({ hue: 360, saturation: 0.75, lightness: 0.4, alpha: 0,7 }),
1028 * background: hsla(359, 0.75, 0.4, 1),
1029 * }
1030 *
1031 * // styled-components usage
1032 * const div = styled.div`
1033 * background: ${hsla(359, 0.75, 0.4, 0.7)};
1034 * background: ${hsla({ hue: 360, saturation: 0.75, lightness: 0.4, alpha: 0,7 })};
1035 * background: ${hsla(359, 0.75, 0.4, 1)};
1036 * `
1037 *
1038 * // CSS in JS Output
1039 *
1040 * element {
1041 * background: "rgba(179,25,28,0.7)";
1042 * background: "rgba(179,25,28,0.7)";
1043 * background: "#b3191c";
1044 * }
1045 */
1046
1047
1048 function hsla(value, saturation, lightness, alpha) {
1049 if (typeof value === 'number' && typeof saturation === 'number' && typeof lightness === 'number' && typeof alpha === 'number') {
1050 return alpha >= 1 ? hslToHex(value, saturation, lightness) : "rgba(" + hslToRgb(value, saturation, lightness) + "," + alpha + ")";
1051 } else if (_typeof(value) === 'object' && saturation === undefined && lightness === undefined && alpha === undefined) {
1052 return value.alpha >= 1 ? hslToHex(value.hue, value.saturation, value.lightness) : "rgba(" + hslToRgb(value.hue, value.saturation, value.lightness) + "," + value.alpha + ")";
1053 }
1054
1055 throw new PolishedError(2);
1056 }
1057 /**
1058 * Returns a string value for the color. The returned result is the smallest possible hex notation.
1059 *
1060 * @example
1061 * // Styles as object usage
1062 * const styles = {
1063 * background: rgb(255, 205, 100),
1064 * background: rgb({ red: 255, green: 205, blue: 100 }),
1065 * }
1066 *
1067 * // styled-components usage
1068 * const div = styled.div`
1069 * background: ${rgb(255, 205, 100)};
1070 * background: ${rgb({ red: 255, green: 205, blue: 100 })};
1071 * `
1072 *
1073 * // CSS in JS Output
1074 *
1075 * element {
1076 * background: "#ffcd64";
1077 * background: "#ffcd64";
1078 * }
1079 */
1080
1081
1082 function rgb(value, green, blue) {
1083 if (typeof value === 'number' && typeof green === 'number' && typeof blue === 'number') {
1084 return reduceHexValue("#" + numberToHex(value) + numberToHex(green) + numberToHex(blue));
1085 } else if (_typeof(value) === 'object' && green === undefined && blue === undefined) {
1086 return reduceHexValue("#" + numberToHex(value.red) + numberToHex(value.green) + numberToHex(value.blue));
1087 }
1088
1089 throw new PolishedError(6);
1090 }
1091 /**
1092 * Returns a string value for the color. The returned result is the smallest possible rgba or hex notation.
1093 *
1094 * Can also be used to fade a color by passing a hex value or named CSS color along with an alpha value.
1095 *
1096 * @example
1097 * // Styles as object usage
1098 * const styles = {
1099 * background: rgba(255, 205, 100, 0.7),
1100 * background: rgba({ red: 255, green: 205, blue: 100, alpha: 0.7 }),
1101 * background: rgba(255, 205, 100, 1),
1102 * background: rgba('#ffffff', 0.4),
1103 * background: rgba('black', 0.7),
1104 * }
1105 *
1106 * // styled-components usage
1107 * const div = styled.div`
1108 * background: ${rgba(255, 205, 100, 0.7)};
1109 * background: ${rgba({ red: 255, green: 205, blue: 100, alpha: 0.7 })};
1110 * background: ${rgba(255, 205, 100, 1)};
1111 * background: ${rgba('#ffffff', 0.4)};
1112 * background: ${rgba('black', 0.7)};
1113 * `
1114 *
1115 * // CSS in JS Output
1116 *
1117 * element {
1118 * background: "rgba(255,205,100,0.7)";
1119 * background: "rgba(255,205,100,0.7)";
1120 * background: "#ffcd64";
1121 * background: "rgba(255,255,255,0.4)";
1122 * background: "rgba(0,0,0,0.7)";
1123 * }
1124 */
1125
1126
1127 function rgba(firstValue, secondValue, thirdValue, fourthValue) {
1128 if (typeof firstValue === 'string' && typeof secondValue === 'number') {
1129 var rgbValue = parseToRgb(firstValue);
1130 return "rgba(" + rgbValue.red + "," + rgbValue.green + "," + rgbValue.blue + "," + secondValue + ")";
1131 } else if (typeof firstValue === 'number' && typeof secondValue === 'number' && typeof thirdValue === 'number' && typeof fourthValue === 'number') {
1132 return fourthValue >= 1 ? rgb(firstValue, secondValue, thirdValue) : "rgba(" + firstValue + "," + secondValue + "," + thirdValue + "," + fourthValue + ")";
1133 } else if (_typeof(firstValue) === 'object' && secondValue === undefined && thirdValue === undefined && fourthValue === undefined) {
1134 return firstValue.alpha >= 1 ? rgb(firstValue.red, firstValue.green, firstValue.blue) : "rgba(" + firstValue.red + "," + firstValue.green + "," + firstValue.blue + "," + firstValue.alpha + ")";
1135 }
1136
1137 throw new PolishedError(7);
1138 }
1139
1140 var isRgb = function isRgb(color) {
1141 return typeof color.red === 'number' && typeof color.green === 'number' && typeof color.blue === 'number' && (typeof color.alpha !== 'number' || typeof color.alpha === 'undefined');
1142 };
1143
1144 var isRgba = function isRgba(color) {
1145 return typeof color.red === 'number' && typeof color.green === 'number' && typeof color.blue === 'number' && typeof color.alpha === 'number';
1146 };
1147
1148 var isHsl = function isHsl(color) {
1149 return typeof color.hue === 'number' && typeof color.saturation === 'number' && typeof color.lightness === 'number' && (typeof color.alpha !== 'number' || typeof color.alpha === 'undefined');
1150 };
1151
1152 var isHsla = function isHsla(color) {
1153 return typeof color.hue === 'number' && typeof color.saturation === 'number' && typeof color.lightness === 'number' && typeof color.alpha === 'number';
1154 };
1155 /**
1156 * Converts a RgbColor, RgbaColor, HslColor or HslaColor object to a color string.
1157 * This util is useful in case you only know on runtime which color object is
1158 * used. Otherwise we recommend to rely on `rgb`, `rgba`, `hsl` or `hsla`.
1159 *
1160 * @example
1161 * // Styles as object usage
1162 * const styles = {
1163 * background: toColorString({ red: 255, green: 205, blue: 100 }),
1164 * background: toColorString({ red: 255, green: 205, blue: 100, alpha: 0.72 }),
1165 * background: toColorString({ hue: 240, saturation: 1, lightness: 0.5 }),
1166 * background: toColorString({ hue: 360, saturation: 0.75, lightness: 0.4, alpha: 0.72 }),
1167 * }
1168 *
1169 * // styled-components usage
1170 * const div = styled.div`
1171 * background: ${toColorString({ red: 255, green: 205, blue: 100 })};
1172 * background: ${toColorString({ red: 255, green: 205, blue: 100, alpha: 0.72 })};
1173 * background: ${toColorString({ hue: 240, saturation: 1, lightness: 0.5 })};
1174 * background: ${toColorString({ hue: 360, saturation: 0.75, lightness: 0.4, alpha: 0.72 })};
1175 * `
1176 *
1177 * // CSS in JS Output
1178 * element {
1179 * background: "#ffcd64";
1180 * background: "rgba(255,205,100,0.72)";
1181 * background: "#00f";
1182 * background: "rgba(179,25,25,0.72)";
1183 * }
1184 */
1185
1186
1187 function toColorString(color) {
1188 if (_typeof(color) !== 'object') throw new PolishedError(8);
1189 if (isRgba(color)) return rgba(color);
1190 if (isRgb(color)) return rgb(color);
1191 if (isHsla(color)) return hsla(color);
1192 if (isHsl(color)) return hsl(color);
1193 throw new PolishedError(8);
1194 } // Type definitions taken from https://github.com/gcanti/flow-static-land/blob/master/src/Fun.js
1195 // eslint-disable-next-line no-unused-vars
1196 // eslint-disable-next-line no-unused-vars
1197 // eslint-disable-next-line no-redeclare
1198
1199
1200 function curried(f, length, acc) {
1201 return function fn() {
1202 // eslint-disable-next-line prefer-rest-params
1203 var combined = acc.concat(Array.prototype.slice.call(arguments));
1204 return combined.length >= length ? f.apply(this, combined) : curried(f, length, combined);
1205 };
1206 } // eslint-disable-next-line no-redeclare
1207
1208
1209 function curry(f) {
1210 // eslint-disable-line no-redeclare
1211 return curried(f, f.length, []);
1212 }
1213
1214 function guard(lowerBoundary, upperBoundary, value) {
1215 return Math.max(lowerBoundary, Math.min(upperBoundary, value));
1216 }
1217 /**
1218 * Returns a string value for the darkened color.
1219 *
1220 * @example
1221 * // Styles as object usage
1222 * const styles = {
1223 * background: darken(0.2, '#FFCD64'),
1224 * background: darken('0.2', 'rgba(255,205,100,0.7)'),
1225 * }
1226 *
1227 * // styled-components usage
1228 * const div = styled.div`
1229 * background: ${darken(0.2, '#FFCD64')};
1230 * background: ${darken('0.2', 'rgba(255,205,100,0.7)')};
1231 * `
1232 *
1233 * // CSS in JS Output
1234 *
1235 * element {
1236 * background: "#ffbd31";
1237 * background: "rgba(255,189,49,0.7)";
1238 * }
1239 */
1240
1241
1242 function darken(amount, color) {
1243 if (color === 'transparent') return color;
1244 var hslColor = parseToHsl(color);
1245 return toColorString(_extends({}, hslColor, {
1246 lightness: guard(0, 1, hslColor.lightness - parseFloat(amount))
1247 }));
1248 } // prettier-ignore
1249
1250
1251 var curriedDarken = /*#__PURE__*/curry
1252 /* ::<number | string, string, string> */
1253 (darken);
1254
1255 function _templateObject$2() {
1256 var data = _taggedTemplateLiteral(["\n --size: ", ";\n\n .container {\n ", ";\n transform-style: preserve-3d;\n perspective: 2000px;\n transform: rotateX(-30deg) rotateY(-45deg);\n\n *,\n *:before,\n *:after {\n box-sizing: border-box;\n }\n }\n\n .holder {\n ", ";\n transform-style: preserve-3d;\n transform: translate3d(0em, var(--size), calc(var(--size) * 0.5));\n &:nth-child(3) {\n transform: rotateY(-90deg) rotateX(90deg) translate3d(0, var(--size), calc(var(--size) * 0.5));\n }\n &:first-child {\n transform: rotateZ(-90deg) rotateX(-90deg) translate3d(0, var(--size), calc(var(--size) * 0.5));\n }\n }\n\n ", "\n\n .info {\n ", ";\n padding-top: 180px;\n\n .title {\n font-size: 20px;\n font-weight: 400;\n text-align: center;\n color: #212121;\n }\n\n .detail {\n font-size: 14px;\n font-weight: 200;\n text-align: center;\n }\n }\n\n .box {\n ", ";\n transform-style: preserve-3d;\n animation: ani-box 6s infinite;\n width: var(--size);\n height: var(--size);\n //opacity: .9;\n &:before,\n &:after {\n position: absolute;\n width: 100%;\n height: 100%;\n content: '';\n }\n &:before {\n left: 100%;\n bottom: 0;\n transform: rotateY(90deg);\n transform-origin: 0 50%;\n }\n &:after {\n left: 0;\n bottom: 100%;\n transform: rotateX(90deg);\n transform-origin: 0 100%;\n }\n }\n\n @keyframes ani-box {\n 8.33% {\n transform: translate3d(-50%, -50%, 0) scaleZ(2);\n }\n 16.7% {\n transform: translate3d(-50%, -50%, calc(-1 * var(--size))) scaleZ(1);\n }\n 25% {\n transform: translate3d(-50%, -100%, calc(-1 * var(--size))) scaleY(2);\n }\n 33.3% {\n transform: translate3d(-50%, -150%, calc(-1 * var(--size))) scaleY(1);\n }\n 41.7% {\n transform: translate3d(-100%, -150%, calc(-1 * var(--size))) scaleX(2);\n }\n 50% {\n transform: translate3d(-150%, -150%, calc(-1 * var(--size))) scaleX(1);\n }\n 58.3% {\n transform: translate3d(-150%, -150%, 0) scaleZ(2);\n }\n 66.7% {\n transform: translate3d(-150%, -150%, 0) scaleZ(1);\n }\n 75% {\n transform: translate3d(-150%, -100%, 0) scaleY(2);\n }\n 83.3% {\n transform: translate3d(-150%, -50%, 0) scaleY(1);\n }\n 91.7% {\n transform: translate3d(-100%, -50%, 0) scaleX(2);\n }\n 100% {\n transform: translate3d(-50%, -50%, 0) scaleX(1);\n }\n }\n"]);
1257
1258 _templateObject$2 = function _templateObject() {
1259 return data;
1260 };
1261
1262 return data;
1263 }
1264
1265 var cbox = function cbox(props) {
1266 return "\nposition: absolute;\ntop: 50%;\nleft: 50%;\ntransform: translate(-50%, -50%);\n";
1267 };
1268
1269 var BoxShuffleContainer = styled.div(_templateObject$2(), function (props) {
1270 return props['size'] || '3em';
1271 }, cbox, cbox, function (props) {
1272 return (props.colors || ['#1FBCD3', '#CBE2B4', '#F6B6CA']).map(function (color, i) {
1273 return "\n .holder:nth-child(".concat(i + 1, "){\n .box{\n background-color: ").concat(color, ";\n &:before{\n background-color: ").concat(curriedDarken(0.2, color), ";\n }\n &:after{\n background-color: ").concat(curriedDarken(0.1, color), ";\n }\n }\n }\n }\n");
1274 });
1275 }, cbox, cbox);
1276 var BoxShuffle = function BoxShuffle(props) {
1277 var title = props.title,
1278 detail = props.detail;
1279 return /*#__PURE__*/React__default.createElement(BoxShuffleContainer, null, /*#__PURE__*/React__default.createElement("div", {
1280 className: "container"
1281 }, /*#__PURE__*/React__default.createElement("div", {
1282 className: "holder"
1283 }, /*#__PURE__*/React__default.createElement("div", {
1284 className: "box"
1285 })), /*#__PURE__*/React__default.createElement("div", {
1286 className: "holder"
1287 }, /*#__PURE__*/React__default.createElement("div", {
1288 className: "box"
1289 })), /*#__PURE__*/React__default.createElement("div", {
1290 className: "holder"
1291 }, /*#__PURE__*/React__default.createElement("div", {
1292 className: "box"
1293 }))), /*#__PURE__*/React__default.createElement("div", {
1294 className: "info"
1295 }, /*#__PURE__*/React__default.createElement("div", {
1296 className: "title"
1297 }, title), /*#__PURE__*/React__default.createElement("div", {
1298 className: "detail"
1299 }, detail)));
1300 };
1301
1302 function _templateObject$3() {
1303 var data = _taggedTemplateLiteral(["\n width: 200px;\n height: 200px;\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n margin: auto;\n filter: url('#gooey-loader-filter');\n animation: rotate-move 2s ease-in-out infinite;\n\n .dot {\n width: 70px;\n height: 70px;\n border-radius: 50%;\n background-color: #000;\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n margin: auto;\n }\n\n .dot-3 {\n background-color: #f74d75;\n animation: dot-3-move 2s ease infinite, index 6s ease infinite;\n }\n\n .dot-2 {\n background-color: #10beae;\n animation: dot-2-move 2s ease infinite, index 6s -4s ease infinite;\n }\n\n .dot-1 {\n background-color: #ffe386;\n animation: dot-1-move 2s ease infinite, index 6s -2s ease infinite;\n }\n\n @keyframes dot-3-move {\n 20% {\n transform: scale(1);\n }\n 45% {\n transform: translateY(-18px) scale(0.45);\n }\n 60% {\n transform: translateY(-90px) scale(0.45);\n }\n 80% {\n transform: translateY(-90px) scale(0.45);\n }\n 100% {\n transform: translateY(0px) scale(1);\n }\n }\n\n @keyframes dot-2-move {\n 20% {\n transform: scale(1);\n }\n 45% {\n transform: translate(-16px, 12px) scale(0.45);\n }\n 60% {\n transform: translate(-80px, 60px) scale(0.45);\n }\n 80% {\n transform: translate(-80px, 60px) scale(0.45);\n }\n 100% {\n transform: translateY(0px) scale(1);\n }\n }\n\n @keyframes dot-1-move {\n 20% {\n transform: scale(1);\n }\n 45% {\n transform: translate(16px, 12px) scale(0.45);\n }\n 60% {\n transform: translate(80px, 60px) scale(0.45);\n }\n 80% {\n transform: translate(80px, 60px) scale(0.45);\n }\n 100% {\n transform: translateY(0px) scale(1);\n }\n }\n\n @keyframes rotate-move {\n 55% {\n transform: translate(-50%, -50%) rotate(0deg);\n }\n 80% {\n transform: translate(-50%, -50%) rotate(360deg);\n }\n 100% {\n transform: translate(-50%, -50%) rotate(360deg);\n }\n }\n\n @keyframes index {\n 0%,\n 100% {\n z-index: 3;\n }\n 33.3% {\n z-index: 2;\n }\n 66.6% {\n z-index: 1;\n }\n }\n"]);
1304
1305 _templateObject$3 = function _templateObject() {
1306 return data;
1307 };
1308
1309 return data;
1310 }
1311 var GooeyLoaderContainer = styled.div(_templateObject$3());
1312
1313 function loadSvgFilter() {
1314 if (typeof window === 'undefined') {
1315 return;
1316 }
1317
1318 if (document.querySelector('#GooeyLoaderSvgFilter')) {
1319 return;
1320 }
1321
1322 var el = document.createElement('div');
1323 el.id = 'GooeyLoaderSvgFilter';
1324 el.innerHTML = "\n<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\">\n <defs>\n <filter id=\"gooey-loader-filter\">\n <feGaussianBlur in=\"SourceGraphic\" stdDeviation=\"10\" result=\"blur\" />\n <feColorMatrix in=\"blur\" mode=\"matrix\" values=\"1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 21 -7\"/>\n </filter>\n </defs>\n</svg>\n";
1325 document.body.appendChild(el);
1326 }
1327 /**
1328 * GooeyLoader
1329 *
1330 * @see https://codepen.io/Izumenko/pen/MpWyXK
1331 */
1332
1333
1334 var GooeyLoader = function GooeyLoader() {
1335 loadSvgFilter();
1336 return /*#__PURE__*/React__default.createElement(GooeyLoaderContainer, null, /*#__PURE__*/React__default.createElement("div", {
1337 className: "dot dot-1"
1338 }), /*#__PURE__*/React__default.createElement("div", {
1339 className: "dot dot-2"
1340 }), /*#__PURE__*/React__default.createElement("div", {
1341 className: "dot dot-3"
1342 }));
1343 };
1344
1345 function useAsyncEffect(effect, deps) {
1346 var ref = React.useRef();
1347 React.useEffect(function () {
1348 effect({
1349 setCloser: function setCloser(v) {
1350 return ref.current = v;
1351 }
1352 }).then(function (v) {
1353 return typeof v === 'function' ? ref.current = v : null;
1354 })["catch"](function (e) {
1355 console.trace("useAsyncEffect error", deps, e);
1356 });
1357 return function () {
1358 var _ref$current;
1359
1360 return (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.call(ref);
1361 };
1362 }, deps);
1363 }
1364
1365 /**
1366 * create only once
1367 *
1368 * @see https://reactjs.org/docs/hooks-faq.html#how-to-create-expensive-objects-lazily
1369 * @see https://github.com/Andarist/use-constant/blob/master/src/index.ts
1370 */
1371 function useConstant(fn) {
1372 var ref = React__default.useRef();
1373
1374 if (!ref.current) {
1375 ref.current = {
1376 v: fn()
1377 };
1378 }
1379
1380 return ref.current.v;
1381 }
1382
1383 function useDebounceEffect(cb, deps, wait) {
1384 var bounce = React.useMemo(function () {
1385 return lodash.debounce(function () {
1386 cb === null || cb === void 0 ? void 0 : cb();
1387 }, wait);
1388 }, [cb, wait]);
1389 React.useEffect(function () {
1390 bounce();
1391 return function () {
1392 return bounce.cancel();
1393 };
1394 }, deps);
1395 }
1396
1397 function useForceRender() {
1398 // const [, set] = useState();
1399 // return () => set({});
1400 var _useReducer = React.useReducer(function (s) {
1401 return s + 1;
1402 }, 0),
1403 _useReducer2 = _slicedToArray(_useReducer, 2),
1404 forceRender = _useReducer2[1];
1405
1406 return forceRender;
1407 }
1408
1409 function useInterval(handler, interval) {
1410 var ref = React.useRef(); // const [count, setCount] = useState(0);
1411 // useEffect(handler, [count]);
1412
1413 React.useEffect(function () {
1414 // ref.current = setInterval(() => setCount(v => v + 1), interval);
1415 ref.current = setInterval(handler, interval);
1416 return function () {
1417 return clearInterval(ref.current);
1418 };
1419 }, [interval]);
1420 }
1421
1422 /**
1423 * 配合 nextjs 可以实现只有客户端才渲染的组件
1424 * @see https://github.com/zeit/next.js/blob/canary/examples/progressive-render/pages/index.js
1425 */
1426
1427 function useMounted() {
1428 var _useState = React.useState(false),
1429 _useState2 = _slicedToArray(_useState, 2),
1430 mounted = _useState2[0],
1431 setMounted = _useState2[1];
1432
1433 React.useEffect(function () {
1434 return setMounted(true);
1435 }, []);
1436 return mounted;
1437 }
1438
1439 function useOnlineEffect() {
1440 var _window, _window$navigator;
1441
1442 var _useState = React.useState((_window = window) === null || _window === void 0 ? void 0 : (_window$navigator = _window.navigator) === null || _window$navigator === void 0 ? void 0 : _window$navigator.onLine),
1443 _useState2 = _slicedToArray(_useState, 2),
1444 online = _useState2[0],
1445 setOnline = _useState2[1];
1446
1447 React.useEffect(function () {
1448 var handler = function handler(e) {
1449 return setOnline(e.type === 'online');
1450 };
1451
1452 window.addEventListener('online', handler);
1453 window.addEventListener('offline', handler);
1454 return function () {
1455 window.removeEventListener('online', handler);
1456 window.removeEventListener('offline', handler);
1457 };
1458 }, []);
1459 return online;
1460 }
1461
1462 var NamedThemeContext = /*#__PURE__*/React__default.createContext(new rxjs.BehaviorSubject(null));
1463 function NamedThemeProvider(_ref) {
1464 var children = _ref.children,
1465 initialTheme = _ref.initialTheme;
1466 var state = useConstant(function () {
1467 return new rxjs.BehaviorSubject(typeof initialTheme === 'function' ? initialTheme() : initialTheme);
1468 });
1469 React.useEffect(function () {
1470 return function () {
1471 return state.complete();
1472 };
1473 }, []);
1474 return /*#__PURE__*/React__default.createElement(NamedThemeContext.Provider, {
1475 value: state
1476 }, children);
1477 }
1478 function useNamedTheme() {
1479 var state = React.useContext(NamedThemeContext);
1480
1481 var _useState = React.useState(state.value),
1482 _useState2 = _slicedToArray(_useState, 2),
1483 theme = _useState2[0],
1484 setTheme = _useState2[1];
1485
1486 React.useEffect(function () {
1487 var subscribe = state.subscribe(setTheme);
1488 return subscribe.unsubscribe.bind(subscribe);
1489 }, [state]);
1490 return [theme, function (v) {
1491 return state.next(v);
1492 }];
1493 }
1494
1495 function useEffectOnce(effect) {
1496 React__default.useEffect(effect, []);
1497 }
1498
1499 function isPromise(v) {
1500 return v && v.then && v["catch"];
1501 }
1502
1503 function usePromiseEffect(v) {
1504 var _React$useState = React__default.useState(function () {
1505 if (isPromise(v)) {
1506 return {
1507 loading: true
1508 };
1509 }
1510
1511 return {
1512 loading: false,
1513 data: v
1514 };
1515 }),
1516 _React$useState2 = _slicedToArray(_React$useState, 2),
1517 state = _React$useState2[0],
1518 setState = _React$useState2[1];
1519
1520 React__default.useEffect(function () {
1521 if (isPromise(v)) {
1522 setState(function (state) {
1523 return _objectSpread2(_objectSpread2({}, state), {}, {
1524 loading: true,
1525 error: undefined
1526 });
1527 });
1528 v.then(function (data) {
1529 return setState({
1530 loading: false,
1531 data: data
1532 });
1533 })["catch"](function (error) {
1534 return setState({
1535 loading: false,
1536 error: error
1537 });
1538 });
1539 } else {
1540 // prevent useless state change
1541 setState(function (state) {
1542 if (state.data === v) {
1543 return state;
1544 }
1545
1546 return {
1547 loading: false,
1548 data: v
1549 };
1550 });
1551 }
1552 }, [v]);
1553 return state;
1554 }
1555
1556 function useFetchEffect(fetcher, deps) {
1557 var _React$useState = React__default.useState(function () {
1558 try {
1559 return fetcher();
1560 } catch (error) {
1561 return Promise.reject(error);
1562 }
1563 }),
1564 _React$useState2 = _slicedToArray(_React$useState, 2),
1565 result = _React$useState2[0],
1566 setResult = _React$useState2[1];
1567
1568 var initial = React__default.useRef(true);
1569 React__default.useEffect(function () {
1570 if (initial.current) {
1571 initial.current = false;
1572 return;
1573 }
1574
1575 try {
1576 setResult(fetcher());
1577 } catch (error) {
1578 setResult(Promise.reject(error));
1579 }
1580 }, deps);
1581 return usePromiseEffect(result);
1582 }
1583
1584 /*! *****************************************************************************
1585 Copyright (c) Microsoft Corporation.
1586
1587 Permission to use, copy, modify, and/or distribute this software for any
1588 purpose with or without fee is hereby granted.
1589
1590 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
1591 REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
1592 AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
1593 INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
1594 LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
1595 OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
1596 PERFORMANCE OF THIS SOFTWARE.
1597 ***************************************************************************** */
1598
1599 /* global Reflect, Promise */
1600 var _extendStatics = function extendStatics(d, b) {
1601 _extendStatics = Object.setPrototypeOf || {
1602 __proto__: []
1603 } instanceof Array && function (d, b) {
1604 d.__proto__ = b;
1605 } || function (d, b) {
1606 for (var p in b) {
1607 if (b.hasOwnProperty(p)) d[p] = b[p];
1608 }
1609 };
1610
1611 return _extendStatics(d, b);
1612 };
1613
1614 function __extends(d, b) {
1615 _extendStatics(d, b);
1616
1617 function __() {
1618 this.constructor = d;
1619 }
1620
1621 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
1622 }
1623
1624 /** PURE_IMPORTS_START PURE_IMPORTS_END */
1625 function isFunction(x) {
1626 return typeof x === 'function';
1627 }
1628
1629 /** PURE_IMPORTS_START PURE_IMPORTS_END */
1630 var _enable_super_gross_mode_that_will_cause_bad_things = false;
1631 var config = {
1632 Promise: undefined,
1633
1634 set useDeprecatedSynchronousErrorHandling(value) {
1635 if (value) {
1636 var error = /*@__PURE__*/new Error();
1637 /*@__PURE__*/
1638
1639 console.warn('DEPRECATED! RxJS was set to use deprecated synchronous error handling behavior by code at: \n' + error.stack);
1640 }
1641
1642 _enable_super_gross_mode_that_will_cause_bad_things = value;
1643 },
1644
1645 get useDeprecatedSynchronousErrorHandling() {
1646 return _enable_super_gross_mode_that_will_cause_bad_things;
1647 }
1648
1649 };
1650
1651 /** PURE_IMPORTS_START PURE_IMPORTS_END */
1652 function hostReportError(err) {
1653 setTimeout(function () {
1654 throw err;
1655 }, 0);
1656 }
1657
1658 /** PURE_IMPORTS_START _config,_util_hostReportError PURE_IMPORTS_END */
1659 var empty = {
1660 closed: true,
1661 next: function next(value) {},
1662 error: function error(err) {
1663 if (config.useDeprecatedSynchronousErrorHandling) {
1664 throw err;
1665 } else {
1666 hostReportError(err);
1667 }
1668 },
1669 complete: function complete() {}
1670 };
1671
1672 /** PURE_IMPORTS_START PURE_IMPORTS_END */
1673 var isArray = /*@__PURE__*/function () {
1674 return Array.isArray || function (x) {
1675 return x && typeof x.length === 'number';
1676 };
1677 }();
1678
1679 /** PURE_IMPORTS_START PURE_IMPORTS_END */
1680 function isObject(x) {
1681 return x !== null && _typeof(x) === 'object';
1682 }
1683
1684 /** PURE_IMPORTS_START PURE_IMPORTS_END */
1685 var UnsubscriptionErrorImpl = /*@__PURE__*/function () {
1686 function UnsubscriptionErrorImpl(errors) {
1687 Error.call(this);
1688 this.message = errors ? errors.length + " errors occurred during unsubscription:\n" + errors.map(function (err, i) {
1689 return i + 1 + ") " + err.toString();
1690 }).join('\n ') : '';
1691 this.name = 'UnsubscriptionError';
1692 this.errors = errors;
1693 return this;
1694 }
1695
1696 UnsubscriptionErrorImpl.prototype = /*@__PURE__*/Object.create(Error.prototype);
1697 return UnsubscriptionErrorImpl;
1698 }();
1699
1700 var UnsubscriptionError = UnsubscriptionErrorImpl;
1701
1702 var Subscription = /*@__PURE__*/function () {
1703 function Subscription(unsubscribe) {
1704 this.closed = false;
1705 this._parentOrParents = null;
1706 this._subscriptions = null;
1707
1708 if (unsubscribe) {
1709 this._unsubscribe = unsubscribe;
1710 }
1711 }
1712
1713 Subscription.prototype.unsubscribe = function () {
1714 var errors;
1715
1716 if (this.closed) {
1717 return;
1718 }
1719
1720 var _a = this,
1721 _parentOrParents = _a._parentOrParents,
1722 _unsubscribe = _a._unsubscribe,
1723 _subscriptions = _a._subscriptions;
1724
1725 this.closed = true;
1726 this._parentOrParents = null;
1727 this._subscriptions = null;
1728
1729 if (_parentOrParents instanceof Subscription) {
1730 _parentOrParents.remove(this);
1731 } else if (_parentOrParents !== null) {
1732 for (var index = 0; index < _parentOrParents.length; ++index) {
1733 var parent_1 = _parentOrParents[index];
1734 parent_1.remove(this);
1735 }
1736 }
1737
1738 if (isFunction(_unsubscribe)) {
1739 try {
1740 _unsubscribe.call(this);
1741 } catch (e) {
1742 errors = e instanceof UnsubscriptionError ? flattenUnsubscriptionErrors(e.errors) : [e];
1743 }
1744 }
1745
1746 if (isArray(_subscriptions)) {
1747 var index = -1;
1748 var len = _subscriptions.length;
1749
1750 while (++index < len) {
1751 var sub = _subscriptions[index];
1752
1753 if (isObject(sub)) {
1754 try {
1755 sub.unsubscribe();
1756 } catch (e) {
1757 errors = errors || [];
1758
1759 if (e instanceof UnsubscriptionError) {
1760 errors = errors.concat(flattenUnsubscriptionErrors(e.errors));
1761 } else {
1762 errors.push(e);
1763 }
1764 }
1765 }
1766 }
1767 }
1768
1769 if (errors) {
1770 throw new UnsubscriptionError(errors);
1771 }
1772 };
1773
1774 Subscription.prototype.add = function (teardown) {
1775 var subscription = teardown;
1776
1777 if (!teardown) {
1778 return Subscription.EMPTY;
1779 }
1780
1781 switch (_typeof(teardown)) {
1782 case 'function':
1783 subscription = new Subscription(teardown);
1784
1785 case 'object':
1786 if (subscription === this || subscription.closed || typeof subscription.unsubscribe !== 'function') {
1787 return subscription;
1788 } else if (this.closed) {
1789 subscription.unsubscribe();
1790 return subscription;
1791 } else if (!(subscription instanceof Subscription)) {
1792 var tmp = subscription;
1793 subscription = new Subscription();
1794 subscription._subscriptions = [tmp];
1795 }
1796
1797 break;
1798
1799 default:
1800 {
1801 throw new Error('unrecognized teardown ' + teardown + ' added to Subscription.');
1802 }
1803 }
1804
1805 var _parentOrParents = subscription._parentOrParents;
1806
1807 if (_parentOrParents === null) {
1808 subscription._parentOrParents = this;
1809 } else if (_parentOrParents instanceof Subscription) {
1810 if (_parentOrParents === this) {
1811 return subscription;
1812 }
1813
1814 subscription._parentOrParents = [_parentOrParents, this];
1815 } else if (_parentOrParents.indexOf(this) === -1) {
1816 _parentOrParents.push(this);
1817 } else {
1818 return subscription;
1819 }
1820
1821 var subscriptions = this._subscriptions;
1822
1823 if (subscriptions === null) {
1824 this._subscriptions = [subscription];
1825 } else {
1826 subscriptions.push(subscription);
1827 }
1828
1829 return subscription;
1830 };
1831
1832 Subscription.prototype.remove = function (subscription) {
1833 var subscriptions = this._subscriptions;
1834
1835 if (subscriptions) {
1836 var subscriptionIndex = subscriptions.indexOf(subscription);
1837
1838 if (subscriptionIndex !== -1) {
1839 subscriptions.splice(subscriptionIndex, 1);
1840 }
1841 }
1842 };
1843
1844 Subscription.EMPTY = function (empty) {
1845 empty.closed = true;
1846 return empty;
1847 }(new Subscription());
1848
1849 return Subscription;
1850 }();
1851
1852 function flattenUnsubscriptionErrors(errors) {
1853 return errors.reduce(function (errs, err) {
1854 return errs.concat(err instanceof UnsubscriptionError ? err.errors : err);
1855 }, []);
1856 }
1857
1858 /** PURE_IMPORTS_START PURE_IMPORTS_END */
1859 var rxSubscriber = /*@__PURE__*/function () {
1860 return typeof Symbol === 'function' ? /*@__PURE__*/Symbol('rxSubscriber') : '@@rxSubscriber_' + /*@__PURE__*/Math.random();
1861 }();
1862
1863 var Subscriber = /*@__PURE__*/function (_super) {
1864 __extends(Subscriber, _super);
1865
1866 function Subscriber(destinationOrNext, error, complete) {
1867 var _this = _super.call(this) || this;
1868
1869 _this.syncErrorValue = null;
1870 _this.syncErrorThrown = false;
1871 _this.syncErrorThrowable = false;
1872 _this.isStopped = false;
1873
1874 switch (arguments.length) {
1875 case 0:
1876 _this.destination = empty;
1877 break;
1878
1879 case 1:
1880 if (!destinationOrNext) {
1881 _this.destination = empty;
1882 break;
1883 }
1884
1885 if (_typeof(destinationOrNext) === 'object') {
1886 if (destinationOrNext instanceof Subscriber) {
1887 _this.syncErrorThrowable = destinationOrNext.syncErrorThrowable;
1888 _this.destination = destinationOrNext;
1889 destinationOrNext.add(_this);
1890 } else {
1891 _this.syncErrorThrowable = true;
1892 _this.destination = new SafeSubscriber(_this, destinationOrNext);
1893 }
1894
1895 break;
1896 }
1897
1898 default:
1899 _this.syncErrorThrowable = true;
1900 _this.destination = new SafeSubscriber(_this, destinationOrNext, error, complete);
1901 break;
1902 }
1903
1904 return _this;
1905 }
1906
1907 Subscriber.prototype[rxSubscriber] = function () {
1908 return this;
1909 };
1910
1911 Subscriber.create = function (next, error, complete) {
1912 var subscriber = new Subscriber(next, error, complete);
1913 subscriber.syncErrorThrowable = false;
1914 return subscriber;
1915 };
1916
1917 Subscriber.prototype.next = function (value) {
1918 if (!this.isStopped) {
1919 this._next(value);
1920 }
1921 };
1922
1923 Subscriber.prototype.error = function (err) {
1924 if (!this.isStopped) {
1925 this.isStopped = true;
1926
1927 this._error(err);
1928 }
1929 };
1930
1931 Subscriber.prototype.complete = function () {
1932 if (!this.isStopped) {
1933 this.isStopped = true;
1934
1935 this._complete();
1936 }
1937 };
1938
1939 Subscriber.prototype.unsubscribe = function () {
1940 if (this.closed) {
1941 return;
1942 }
1943
1944 this.isStopped = true;
1945
1946 _super.prototype.unsubscribe.call(this);
1947 };
1948
1949 Subscriber.prototype._next = function (value) {
1950 this.destination.next(value);
1951 };
1952
1953 Subscriber.prototype._error = function (err) {
1954 this.destination.error(err);
1955 this.unsubscribe();
1956 };
1957
1958 Subscriber.prototype._complete = function () {
1959 this.destination.complete();
1960 this.unsubscribe();
1961 };
1962
1963 Subscriber.prototype._unsubscribeAndRecycle = function () {
1964 var _parentOrParents = this._parentOrParents;
1965 this._parentOrParents = null;
1966 this.unsubscribe();
1967 this.closed = false;
1968 this.isStopped = false;
1969 this._parentOrParents = _parentOrParents;
1970 return this;
1971 };
1972
1973 return Subscriber;
1974 }(Subscription);
1975
1976 var SafeSubscriber = /*@__PURE__*/function (_super) {
1977 __extends(SafeSubscriber, _super);
1978
1979 function SafeSubscriber(_parentSubscriber, observerOrNext, error, complete) {
1980 var _this = _super.call(this) || this;
1981
1982 _this._parentSubscriber = _parentSubscriber;
1983 var next;
1984 var context = _this;
1985
1986 if (isFunction(observerOrNext)) {
1987 next = observerOrNext;
1988 } else if (observerOrNext) {
1989 next = observerOrNext.next;
1990 error = observerOrNext.error;
1991 complete = observerOrNext.complete;
1992
1993 if (observerOrNext !== empty) {
1994 context = Object.create(observerOrNext);
1995
1996 if (isFunction(context.unsubscribe)) {
1997 _this.add(context.unsubscribe.bind(context));
1998 }
1999
2000 context.unsubscribe = _this.unsubscribe.bind(_this);
2001 }
2002 }
2003
2004 _this._context = context;
2005 _this._next = next;
2006 _this._error = error;
2007 _this._complete = complete;
2008 return _this;
2009 }
2010
2011 SafeSubscriber.prototype.next = function (value) {
2012 if (!this.isStopped && this._next) {
2013 var _parentSubscriber = this._parentSubscriber;
2014
2015 if (!config.useDeprecatedSynchronousErrorHandling || !_parentSubscriber.syncErrorThrowable) {
2016 this.__tryOrUnsub(this._next, value);
2017 } else if (this.__tryOrSetError(_parentSubscriber, this._next, value)) {
2018 this.unsubscribe();
2019 }
2020 }
2021 };
2022
2023 SafeSubscriber.prototype.error = function (err) {
2024 if (!this.isStopped) {
2025 var _parentSubscriber = this._parentSubscriber;
2026 var useDeprecatedSynchronousErrorHandling = config.useDeprecatedSynchronousErrorHandling;
2027
2028 if (this._error) {
2029 if (!useDeprecatedSynchronousErrorHandling || !_parentSubscriber.syncErrorThrowable) {
2030 this.__tryOrUnsub(this._error, err);
2031
2032 this.unsubscribe();
2033 } else {
2034 this.__tryOrSetError(_parentSubscriber, this._error, err);
2035
2036 this.unsubscribe();
2037 }
2038 } else if (!_parentSubscriber.syncErrorThrowable) {
2039 this.unsubscribe();
2040
2041 if (useDeprecatedSynchronousErrorHandling) {
2042 throw err;
2043 }
2044
2045 hostReportError(err);
2046 } else {
2047 if (useDeprecatedSynchronousErrorHandling) {
2048 _parentSubscriber.syncErrorValue = err;
2049 _parentSubscriber.syncErrorThrown = true;
2050 } else {
2051 hostReportError(err);
2052 }
2053
2054 this.unsubscribe();
2055 }
2056 }
2057 };
2058
2059 SafeSubscriber.prototype.complete = function () {
2060 var _this = this;
2061
2062 if (!this.isStopped) {
2063 var _parentSubscriber = this._parentSubscriber;
2064
2065 if (this._complete) {
2066 var wrappedComplete = function wrappedComplete() {
2067 return _this._complete.call(_this._context);
2068 };
2069
2070 if (!config.useDeprecatedSynchronousErrorHandling || !_parentSubscriber.syncErrorThrowable) {
2071 this.__tryOrUnsub(wrappedComplete);
2072
2073 this.unsubscribe();
2074 } else {
2075 this.__tryOrSetError(_parentSubscriber, wrappedComplete);
2076
2077 this.unsubscribe();
2078 }
2079 } else {
2080 this.unsubscribe();
2081 }
2082 }
2083 };
2084
2085 SafeSubscriber.prototype.__tryOrUnsub = function (fn, value) {
2086 try {
2087 fn.call(this._context, value);
2088 } catch (err) {
2089 this.unsubscribe();
2090
2091 if (config.useDeprecatedSynchronousErrorHandling) {
2092 throw err;
2093 } else {
2094 hostReportError(err);
2095 }
2096 }
2097 };
2098
2099 SafeSubscriber.prototype.__tryOrSetError = function (parent, fn, value) {
2100 if (!config.useDeprecatedSynchronousErrorHandling) {
2101 throw new Error('bad call');
2102 }
2103
2104 try {
2105 fn.call(this._context, value);
2106 } catch (err) {
2107 if (config.useDeprecatedSynchronousErrorHandling) {
2108 parent.syncErrorValue = err;
2109 parent.syncErrorThrown = true;
2110 return true;
2111 } else {
2112 hostReportError(err);
2113 return true;
2114 }
2115 }
2116
2117 return false;
2118 };
2119
2120 SafeSubscriber.prototype._unsubscribe = function () {
2121 var _parentSubscriber = this._parentSubscriber;
2122 this._context = null;
2123 this._parentSubscriber = null;
2124
2125 _parentSubscriber.unsubscribe();
2126 };
2127
2128 return SafeSubscriber;
2129 }(Subscriber);
2130
2131 /** PURE_IMPORTS_START tslib,_Subscriber PURE_IMPORTS_END */
2132 function skip(count) {
2133 return function (source) {
2134 return source.lift(new SkipOperator(count));
2135 };
2136 }
2137
2138 var SkipOperator = /*@__PURE__*/function () {
2139 function SkipOperator(total) {
2140 this.total = total;
2141 }
2142
2143 SkipOperator.prototype.call = function (subscriber, source) {
2144 return source.subscribe(new SkipSubscriber(subscriber, this.total));
2145 };
2146
2147 return SkipOperator;
2148 }();
2149
2150 var SkipSubscriber = /*@__PURE__*/function (_super) {
2151 __extends(SkipSubscriber, _super);
2152
2153 function SkipSubscriber(destination, total) {
2154 var _this = _super.call(this, destination) || this;
2155
2156 _this.total = total;
2157 _this.count = 0;
2158 return _this;
2159 }
2160
2161 SkipSubscriber.prototype._next = function (x) {
2162 if (++this.count > this.total) {
2163 this.destination.next(x);
2164 }
2165 };
2166
2167 return SkipSubscriber;
2168 }(Subscriber);
2169
2170 function n(n) {
2171 for (var t = arguments.length, r = Array(t > 1 ? t - 1 : 0), e = 1; e < t; e++) {
2172 r[e - 1] = arguments[e];
2173 }
2174
2175 if ("production" !== process.env.NODE_ENV) {
2176 var i = L[n],
2177 o = i ? "function" == typeof i ? i.apply(null, r) : i : "unknown error nr: " + n;
2178 throw Error("[Immer] " + o);
2179 }
2180
2181 throw Error("[Immer] minified error nr: " + n + (r.length ? " " + r.join(",") : "") + ". Find the full error at: https://bit.ly/3cXEKWf");
2182 }
2183
2184 function t(n) {
2185 return !!n && !!n[G];
2186 }
2187
2188 function r(n) {
2189 return !!n && (function (n) {
2190 if (!n || "object" != _typeof(n)) return !1;
2191 var t = Object.getPrototypeOf(n);
2192 return !t || t === Object.prototype;
2193 }(n) || Array.isArray(n) || !!n[B] || !!n.constructor[B] || c(n) || s(n));
2194 }
2195
2196 function i(n, t, r) {
2197 void 0 === r && (r = !1), 0 === o(n) ? (r ? Object.keys : Q)(n).forEach(function (r) {
2198 return t(r, n[r], n);
2199 }) : n.forEach(function (r, e) {
2200 return t(e, r, n);
2201 });
2202 }
2203
2204 function o(n) {
2205 var t = n[G];
2206 return t ? t.i > 3 ? t.i - 4 : t.i : Array.isArray(n) ? 1 : c(n) ? 2 : s(n) ? 3 : 0;
2207 }
2208
2209 function u(n, t) {
2210 return 2 === o(n) ? n.has(t) : Object.prototype.hasOwnProperty.call(n, t);
2211 }
2212
2213 function a(n, t) {
2214 return 2 === o(n) ? n.get(t) : n[t];
2215 }
2216
2217 function f(n, t) {
2218 return n === t ? 0 !== n || 1 / n == 1 / t : n != n && t != t;
2219 }
2220
2221 function c(n) {
2222 return U && n instanceof Map;
2223 }
2224
2225 function s(n) {
2226 return W && n instanceof Set;
2227 }
2228
2229 function v(n) {
2230 return n.o || n.t;
2231 }
2232
2233 function p(t, r) {
2234 if (void 0 === r && (r = !1), Array.isArray(t)) return t.slice();
2235 var e = Object.create(Object.getPrototypeOf(t));
2236 return i(t, function (i) {
2237 if (i !== G) {
2238 var o = Object.getOwnPropertyDescriptor(t, i),
2239 u = o.value;
2240 o.get && (r || n(1), u = o.get.call(t)), o.enumerable ? e[i] = u : Object.defineProperty(e, i, {
2241 value: u,
2242 writable: !0,
2243 configurable: !0
2244 });
2245 }
2246 }), e;
2247 }
2248
2249 function d(n, e) {
2250 t(n) || h(n) || !r(n) || (o(n) > 1 && (n.set = n.add = n.clear = n["delete"] = l), Object.freeze(n), e && i(n, function (n, t) {
2251 return d(t, !0);
2252 }, !0));
2253 }
2254
2255 function l() {
2256 n(2);
2257 }
2258
2259 function h(n) {
2260 return null == n || "object" != _typeof(n) || Object.isFrozen(n);
2261 }
2262
2263 function y(t) {
2264 var r = V[t];
2265 return r || n("production" !== process.env.NODE_ENV ? 18 : 19, t), r;
2266 }
2267
2268 function m() {
2269 return "production" === process.env.NODE_ENV || K || n(0), K;
2270 }
2271
2272 function _(n, t) {
2273 t && (y("Patches"), n.u = [], n.s = [], n.v = t);
2274 }
2275
2276 function j(n) {
2277 O(n), n.p.forEach(w), n.p = null;
2278 }
2279
2280 function O(n) {
2281 n === K && (K = n.l);
2282 }
2283
2284 function g(n) {
2285 return K = {
2286 p: [],
2287 l: K,
2288 h: n,
2289 m: !0,
2290 _: 0
2291 };
2292 }
2293
2294 function w(n) {
2295 var t = n[G];
2296 0 === t.i || 1 === t.i ? t.j() : t.O = !0;
2297 }
2298
2299 function S(t, e) {
2300 e._ = e.p.length;
2301 var i = e.p[0],
2302 o = void 0 !== t && t !== i;
2303 return e.h.g || y("ES5").S(e, t, o), o ? (i[G].P && (j(e), n(4)), r(t) && (t = P(e, t), e.l || A(e, t)), e.u && y("Patches").M(i[G], t, e.u, e.s)) : t = P(e, i, []), j(e), e.u && e.v(e.u, e.s), t !== q ? t : void 0;
2304 }
2305
2306 function P(n, t, r) {
2307 if (h(t)) return t;
2308 var e = t[G];
2309 if (!e) return i(t, function (i, o) {
2310 return M(n, e, t, i, o, r);
2311 }, !0), t;
2312 if (e.A !== n) return t;
2313 if (!e.P) return A(n, e.t, !0), e.t;
2314
2315 if (!e.I) {
2316 e.I = !0, e.A._--;
2317 var o = 4 === e.i || 5 === e.i ? e.o = p(e.k, !0) : e.o;
2318 i(o, function (t, i) {
2319 return M(n, e, o, t, i, r);
2320 }), A(n, o, !1), r && n.u && y("Patches").R(e, r, n.u, n.s);
2321 }
2322
2323 return e.o;
2324 }
2325
2326 function M(e, i, c, s, v, p) {
2327 if ("production" !== process.env.NODE_ENV && v === c && n(5), t(v)) {
2328 var d = P(e, v, p && i && 3 !== i.i && !u(i.D, s) ? p.concat(s) : void 0);
2329 if (h = s, y = d, 2 === (b = o(l = c)) ? l.set(h, y) : 3 === b ? (l["delete"](h), l.add(y)) : l[h] = y, !t(d)) return;
2330 e.m = !1;
2331 }
2332
2333 var l, h, y, b;
2334
2335 if ((!i || !f(v, a(i.t, s))) && r(v)) {
2336 if (!e.h.N && e._ < 1) return;
2337 P(e, v), i && i.A.l || A(e, v);
2338 }
2339 }
2340
2341 function A(n, t, r) {
2342 void 0 === r && (r = !1), n.h.N && n.m && d(t, r);
2343 }
2344
2345 function x(n, t) {
2346 var r = n[G],
2347 e = Reflect.getOwnPropertyDescriptor(r ? v(r) : n, t);
2348 return e && e.value;
2349 }
2350
2351 function z(n) {
2352 if (!n.P) {
2353 if (n.P = !0, 0 === n.i || 1 === n.i) {
2354 var t = n.o = p(n.t);
2355 i(n.p, function (n, r) {
2356 t[n] = r;
2357 }), n.p = void 0;
2358 }
2359
2360 n.l && z(n.l);
2361 }
2362 }
2363
2364 function I(n) {
2365 n.o || (n.o = p(n.t));
2366 }
2367
2368 function E(n, t, r) {
2369 var e = c(t) ? y("MapSet").T(t, r) : s(t) ? y("MapSet").F(t, r) : n.g ? function (n, t) {
2370 var r = Array.isArray(n),
2371 e = {
2372 i: r ? 1 : 0,
2373 A: t ? t.A : m(),
2374 P: !1,
2375 I: !1,
2376 D: {},
2377 l: t,
2378 t: n,
2379 k: null,
2380 p: {},
2381 o: null,
2382 j: null,
2383 C: !1
2384 },
2385 i = e,
2386 o = Y;
2387 r && (i = [e], o = Z);
2388 var u = Proxy.revocable(i, o),
2389 a = u.revoke,
2390 f = u.proxy;
2391 return e.k = f, e.j = a, f;
2392 }(t, r) : y("ES5").J(t, r);
2393 return (r ? r.A : m()).p.push(e), e;
2394 }
2395
2396 var J,
2397 K,
2398 $ = "undefined" != typeof Symbol && "symbol" == _typeof(Symbol("x")),
2399 U = "undefined" != typeof Map,
2400 W = "undefined" != typeof Set,
2401 X = "undefined" != typeof Proxy && void 0 !== Proxy.revocable && "undefined" != typeof Reflect,
2402 q = $ ? Symbol("immer-nothing") : ((J = {})["immer-nothing"] = !0, J),
2403 B = $ ? Symbol("immer-draftable") : "__$immer_draftable",
2404 G = $ ? Symbol("immer-state") : "__$immer_state",
2405 L = {
2406 0: "Illegal state",
2407 1: "Immer drafts cannot have computed properties",
2408 2: "This object has been frozen and should not be mutated",
2409 3: function _(n) {
2410 return "Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? " + n;
2411 },
2412 4: "An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.",
2413 5: "Immer forbids circular references",
2414 6: "The first or second argument to `produce` must be a function",
2415 7: "The third argument to `produce` must be a function or undefined",
2416 8: "First argument to `createDraft` must be a plain object, an array, or an immerable object",
2417 9: "First argument to `finishDraft` must be a draft returned by `createDraft`",
2418 10: "The given draft is already finalized",
2419 11: "Object.defineProperty() cannot be used on an Immer draft",
2420 12: "Object.setPrototypeOf() cannot be used on an Immer draft",
2421 13: "Immer only supports deleting array indices",
2422 14: "Immer only supports setting array indices and the 'length' property",
2423 15: function _(n) {
2424 return "Cannot apply patch, path doesn't resolve: " + n;
2425 },
2426 16: 'Sets cannot have "replace" patches.',
2427 17: function _(n) {
2428 return "Unsupported patch operation: " + n;
2429 },
2430 18: function _(n) {
2431 return "The plugin for '" + n + "' has not been loaded into Immer. To enable the plugin, import and call `enable" + n + "()` when initializing your application.";
2432 },
2433 19: function _(n) {
2434 return "plugin not loaded: " + n;
2435 },
2436 20: "Cannot use proxies if Proxy, Proxy.revocable or Reflect are not available"
2437 },
2438 Q = "undefined" != typeof Reflect && Reflect.ownKeys ? Reflect.ownKeys : void 0 !== Object.getOwnPropertySymbols ? function (n) {
2439 return Object.getOwnPropertyNames(n).concat(Object.getOwnPropertySymbols(n));
2440 } : Object.getOwnPropertyNames,
2441 V = {},
2442 Y = {
2443 get: function get(n, t) {
2444 if (t === G) return n;
2445 var e = n.p;
2446 if (!n.P && u(e, t)) return e[t];
2447 var i = v(n)[t];
2448 if (n.I || !r(i)) return i;
2449
2450 if (n.P) {
2451 if (i !== x(n.t, t)) return i;
2452 e = n.o;
2453 }
2454
2455 return e[t] = E(n.A.h, i, n);
2456 },
2457 has: function has(n, t) {
2458 return t in v(n);
2459 },
2460 ownKeys: function ownKeys(n) {
2461 return Reflect.ownKeys(v(n));
2462 },
2463 set: function set(n, t, r) {
2464 if (!n.P) {
2465 var e = x(n.t, t);
2466 if (r ? f(e, r) || r === n.p[t] : f(e, r) && t in n.t) return !0;
2467 I(n), z(n);
2468 }
2469
2470 return n.D[t] = !0, n.o[t] = r, !0;
2471 },
2472 deleteProperty: function deleteProperty(n, t) {
2473 return void 0 !== x(n.t, t) || t in n.t ? (n.D[t] = !1, I(n), z(n)) : n.D[t] && delete n.D[t], n.o && delete n.o[t], !0;
2474 },
2475 getOwnPropertyDescriptor: function getOwnPropertyDescriptor(n, t) {
2476 var r = v(n),
2477 e = Reflect.getOwnPropertyDescriptor(r, t);
2478 return e && (e.writable = !0, e.configurable = 1 !== n.i || "length" !== t), e;
2479 },
2480 defineProperty: function defineProperty() {
2481 n(11);
2482 },
2483 getPrototypeOf: function getPrototypeOf(n) {
2484 return Object.getPrototypeOf(n.t);
2485 },
2486 setPrototypeOf: function setPrototypeOf() {
2487 n(12);
2488 }
2489 },
2490 Z = {};
2491
2492 i(Y, function (n, t) {
2493 Z[n] = function () {
2494 return arguments[0] = arguments[0][0], t.apply(this, arguments);
2495 };
2496 }), Z.deleteProperty = function (t, r) {
2497 return "production" !== process.env.NODE_ENV && isNaN(parseInt(r)) && n(13), Y.deleteProperty.call(this, t[0], r);
2498 }, Z.set = function (t, r, e) {
2499 return "production" !== process.env.NODE_ENV && "length" !== r && isNaN(parseInt(r)) && n(14), Y.set.call(this, t[0], r, e, t[0]);
2500 };
2501
2502 var nn = function () {
2503 function e(n) {
2504 this.g = X, this.N = "production" !== process.env.NODE_ENV, "boolean" == typeof (null == n ? void 0 : n.useProxies) && this.setUseProxies(n.useProxies), "boolean" == typeof (null == n ? void 0 : n.autoFreeze) && this.setAutoFreeze(n.autoFreeze), this.produce = this.produce.bind(this), this.produceWithPatches = this.produceWithPatches.bind(this);
2505 }
2506
2507 var i = e.prototype;
2508 return i.produce = function (t, e, i) {
2509 if ("function" == typeof t && "function" != typeof e) {
2510 var o = e;
2511 e = t;
2512 var u = this;
2513 return function (n) {
2514 var t = this;
2515 void 0 === n && (n = o);
2516
2517 for (var r = arguments.length, i = Array(r > 1 ? r - 1 : 0), a = 1; a < r; a++) {
2518 i[a - 1] = arguments[a];
2519 }
2520
2521 return u.produce(n, function (n) {
2522 var r;
2523 return (r = e).call.apply(r, [t, n].concat(i));
2524 });
2525 };
2526 }
2527
2528 var a;
2529
2530 if ("function" != typeof e && n(6), void 0 !== i && "function" != typeof i && n(7), r(t)) {
2531 var f = g(this),
2532 c = E(this, t, void 0),
2533 s = !0;
2534
2535 try {
2536 a = e(c), s = !1;
2537 } finally {
2538 s ? j(f) : O(f);
2539 }
2540
2541 return "undefined" != typeof Promise && a instanceof Promise ? a.then(function (n) {
2542 return _(f, i), S(n, f);
2543 }, function (n) {
2544 throw j(f), n;
2545 }) : (_(f, i), S(a, f));
2546 }
2547
2548 if ((a = e(t)) !== q) return void 0 === a && (a = t), this.N && d(a, !0), a;
2549 }, i.produceWithPatches = function (n, t) {
2550 var r,
2551 e,
2552 i = this;
2553 return "function" == typeof n ? function (t) {
2554 for (var r = arguments.length, e = Array(r > 1 ? r - 1 : 0), o = 1; o < r; o++) {
2555 e[o - 1] = arguments[o];
2556 }
2557
2558 return i.produceWithPatches(t, function (t) {
2559 return n.apply(void 0, [t].concat(e));
2560 });
2561 } : [this.produce(n, t, function (n, t) {
2562 r = n, e = t;
2563 }), r, e];
2564 }, i.createDraft = function (t) {
2565 r(t) || n(8);
2566 var e = g(this),
2567 i = E(this, t, void 0);
2568 return i[G].C = !0, O(e), i;
2569 }, i.finishDraft = function (t, r) {
2570 var e = t && t[G];
2571 "production" !== process.env.NODE_ENV && (e && e.C || n(9), e.I && n(10));
2572 var i = e.A;
2573 return _(i, r), S(void 0, i);
2574 }, i.setAutoFreeze = function (n) {
2575 this.N = n;
2576 }, i.setUseProxies = function (t) {
2577 X || n(20), this.g = t;
2578 }, i.applyPatches = function (n, r) {
2579 var e;
2580
2581 for (e = r.length - 1; e >= 0; e--) {
2582 var i = r[e];
2583
2584 if (0 === i.path.length && "replace" === i.op) {
2585 n = i.value;
2586 break;
2587 }
2588 }
2589
2590 var o = y("Patches").U;
2591 return t(n) ? o(n, r) : this.produce(n, function (n) {
2592 return o(n, r.slice(e + 1));
2593 });
2594 }, e;
2595 }(),
2596 tn = new nn(),
2597 rn = tn.produce,
2598 en = tn.produceWithPatches.bind(tn),
2599 on = tn.setAutoFreeze.bind(tn),
2600 un = tn.setUseProxies.bind(tn),
2601 an = tn.applyPatches.bind(tn),
2602 fn = tn.createDraft.bind(tn),
2603 cn = tn.finishDraft.bind(tn);
2604
2605 var EMPTY = Symbol();
2606 function createSubscriptionContainer(useHook) {
2607 var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
2608 isEqual: function isEqual(a, b) {
2609 return a === b;
2610 }
2611 },
2612 isEqual = _ref.isEqual;
2613
2614 var Context = /*#__PURE__*/React__default.createContext(EMPTY);
2615
2616 function Provider(props) {
2617 var subject = useConstant(function () {
2618 var initialState = props.initialState; // type fixing
2619
2620 return new rxjs.BehaviorSubject(typeof initialState === 'function' ? initialState() : initialState);
2621 });
2622 var container = useConstant(function () {
2623 var setStateReal = function setStateReal(state) {
2624 var next;
2625
2626 if (typeof state === 'function') {
2627 next = state(subject.getValue());
2628 } else {
2629 next = state;
2630 }
2631
2632 subject.next(next);
2633 }; // handle change state when subscribe
2634
2635
2636 var changing = false;
2637
2638 var setState = function setState(state) {
2639 if (changing) {
2640 setTimeout(function () {
2641 return setState(state);
2642 }, 0);
2643 return;
2644 }
2645
2646 changing = true;
2647
2648 try {
2649 setStateReal(state);
2650 } finally {
2651 changing = false;
2652 }
2653 };
2654
2655 var options = {
2656 getState: function getState() {
2657 return subject.getValue();
2658 },
2659 setState: setState,
2660 updateState: function updateState(fn) {
2661 // todo produced is immutable
2662 setState(rn(function (v) {
2663 fn(v); // ensure return void
2664 }));
2665 },
2666 subscribe: function subscribe(cb) {
2667 var subscription = subject.subscribe(cb);
2668 return subscription.unsubscribe.bind(subscription);
2669 }
2670 };
2671 return useHook(options);
2672 });
2673 return /*#__PURE__*/React__default.createElement(Context.Provider, {
2674 value: {
2675 container: container,
2676 subject: subject
2677 }
2678 }, props.children);
2679 }
2680
2681 function useContainer() {
2682 var context = React__default.useContext(Context);
2683
2684 if (context === EMPTY) {
2685 throw new Error('Component must be wrapped with <SubscriptionContainer.Provider>');
2686 }
2687
2688 return context.container;
2689 }
2690
2691 function useSelector(selector) {
2692 var eq = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : isEqual;
2693 var context = React__default.useContext(Context);
2694
2695 if (context === EMPTY) {
2696 throw new Error('Component must be wrapped with <SubscriptionContainer.Provider>');
2697 }
2698
2699 var subject = context.subject;
2700
2701 var _React$useState = React__default.useState(function () {
2702 return selector(subject.getValue());
2703 }),
2704 _React$useState2 = _slicedToArray(_React$useState, 2),
2705 state = _React$useState2[0],
2706 setState = _React$useState2[1];
2707
2708 React.useEffect(function () {
2709 var subscription = subject.pipe(skip(1)).subscribe(function (s) {
2710 setState(function (old) {
2711 var next = selector(s);
2712
2713 if (eq(old, next)) {
2714 return old;
2715 }
2716
2717 return next;
2718 });
2719 });
2720 return function () {
2721 return subscription.unsubscribe();
2722 };
2723 }, []);
2724 return state;
2725 }
2726
2727 function useState() {
2728 return useSelector(function (v) {
2729 return v;
2730 });
2731 }
2732
2733 function useWhenValueChange(selector, cb) {
2734 var eq = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : isEqual;
2735 var context = React__default.useContext(Context);
2736
2737 if (context === EMPTY) {
2738 throw new Error('Component must be wrapped with <SubscriptionContainer.Provider>');
2739 }
2740
2741 var subject = context.subject;
2742 var ref = React__default.useRef();
2743 React.useEffect(function () {
2744 ref.current = selector(subject.getValue());
2745 var subscription = subject.subscribe(function (s) {
2746 var old = ref.current;
2747 var next = selector(s);
2748
2749 if (!eq(old, next)) {
2750 cb(next);
2751 ref.current = next;
2752 }
2753 });
2754 return function () {
2755 return subscription.unsubscribe();
2756 };
2757 }, []);
2758 }
2759
2760 return {
2761 Provider: Provider,
2762 useContainer: useContainer,
2763 useSelector: useSelector,
2764 useState: useState,
2765 useWhenValueChange: useWhenValueChange
2766 };
2767 }
2768
2769 /// https://github.com/jamiebuilds/unstated-next/blob/master/src/unstated-next.tsx
2770 var EMPTY$1 = Symbol();
2771 function createContainer(useHook) {
2772 var Context = /*#__PURE__*/React__default.createContext(EMPTY$1);
2773
2774 function Provider(props) {
2775 var value = useHook(props.initialState);
2776 return /*#__PURE__*/React__default.createElement(Context.Provider, {
2777 value: value
2778 }, props.children);
2779 }
2780
2781 function useContainer() {
2782 var value = React__default.useContext(Context);
2783
2784 if (value === EMPTY$1) {
2785 throw new Error('Component must be wrapped with <Container.Provider>');
2786 }
2787
2788 return value;
2789 }
2790
2791 return {
2792 Provider: Provider,
2793 useContainer: useContainer
2794 };
2795 }
2796 function useContainer(container) {
2797 return container.useContainer();
2798 }
2799
2800 function withProps(WrappedComponent, extra) {
2801 return function (props) {
2802 return /*#__PURE__*/React__default.createElement(WrappedComponent, Object.assign({}, props, extra));
2803 };
2804 }
2805
2806 exports.BarsSpinner = BarsSpinner;
2807 exports.BoxShuffle = BoxShuffle;
2808 exports.GooeyLoader = GooeyLoader;
2809 exports.GradientSpinner = GradientSpinner;
2810 exports.NamedThemeProvider = NamedThemeProvider;
2811 exports.PlanetRotatingBox = PlanetRotatingBox;
2812 exports.PlantRotating = PlantRotating;
2813 exports.PulseBubble = PulseBubble;
2814 exports.SolarSystemSpinner = SolarSystemSpinner;
2815 exports.createContainer = createContainer;
2816 exports.createSubscriptionContainer = createSubscriptionContainer;
2817 exports.useAsyncEffect = useAsyncEffect;
2818 exports.useConstant = useConstant;
2819 exports.useContainer = useContainer;
2820 exports.useDebounceEffect = useDebounceEffect;
2821 exports.useEffectOnce = useEffectOnce;
2822 exports.useFetchEffect = useFetchEffect;
2823 exports.useForceRender = useForceRender;
2824 exports.useInterval = useInterval;
2825 exports.useMounted = useMounted;
2826 exports.useNamedTheme = useNamedTheme;
2827 exports.useOnlineEffect = useOnlineEffect;
2828 exports.usePromiseEffect = usePromiseEffect;
2829 exports.withProps = withProps;
2830
2831 Object.defineProperty(exports, '__esModule', { value: true });
2832
2833})));
2834//# sourceMappingURL=wener-ui.umd.js.map