@mjhls/mjh-framework 1.0.204 → 1.0.205

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/README.md +1 -1
  2. package/dist/cjs/AD-e2479b7c.js +31 -0
  3. package/dist/cjs/DeckContent.js +430 -0
  4. package/dist/cjs/DeckQueue.js +366 -0
  5. package/dist/cjs/Dfp-d94f7f73.js +97 -0
  6. package/dist/cjs/GridContent.js +613 -0
  7. package/dist/cjs/GroupDeck.js +156 -0
  8. package/dist/cjs/IssueContentDeck.js +81 -0
  9. package/dist/cjs/IssueDeck.js +144 -0
  10. package/dist/cjs/MasterDeck.js +340 -0
  11. package/dist/cjs/Normal-7dd8c339.js +2374 -0
  12. package/dist/cjs/PublicationDeck.js +81 -0
  13. package/dist/cjs/QueueDeckExpanded.js +559 -0
  14. package/dist/cjs/TaxonomyCard-7b5b4298.js +1045 -0
  15. package/dist/cjs/TaxonomyCard.js +18 -0
  16. package/dist/cjs/TemplateNormal.js +29 -0
  17. package/dist/cjs/ThumbnailCard.js +58 -0
  18. package/dist/cjs/Ustream-0d3dd953.js +122 -0
  19. package/dist/cjs/Ustream.js +10 -0
  20. package/dist/cjs/VideoSeriesListing.js +248 -0
  21. package/dist/cjs/YoutubeGroup-f7707ceb.js +228 -0
  22. package/dist/cjs/YoutubeGroup.js +13 -0
  23. package/dist/cjs/_babelHelpers-f321c258.js +119 -0
  24. package/dist/cjs/_commonjsHelpers-3fc1f64e.js +20 -0
  25. package/dist/cjs/debounce-286eb3fb.js +279 -0
  26. package/dist/cjs/entities-3e0b4a16.js +506 -0
  27. package/dist/cjs/get-06aac51b.js +992 -0
  28. package/dist/cjs/index-0d0efcfa.js +610 -0
  29. package/dist/cjs/index-a4c53ff4.js +551 -0
  30. package/dist/cjs/index.es-2289df51.js +5028 -0
  31. package/dist/cjs/index.esm-340d3792.js +113 -0
  32. package/dist/cjs/index.js +12044 -0
  33. package/dist/cjs/isSymbol-311eb805.js +209 -0
  34. package/dist/cjs/main-58839f4e.js +858 -0
  35. package/dist/cjs/visibility-sensor-5c5a7302.js +2251 -0
  36. package/dist/esm/AD-1b2a3dd3.js +26 -0
  37. package/dist/esm/DeckContent.js +424 -0
  38. package/dist/esm/DeckQueue.js +360 -0
  39. package/dist/esm/Dfp-ab7941d3.js +92 -0
  40. package/dist/esm/GridContent.js +607 -0
  41. package/dist/esm/GroupDeck.js +151 -0
  42. package/dist/esm/IssueContentDeck.js +76 -0
  43. package/dist/esm/IssueDeck.js +139 -0
  44. package/dist/esm/MasterDeck.js +334 -0
  45. package/dist/esm/Normal-403c5666.js +2354 -0
  46. package/dist/esm/PublicationDeck.js +76 -0
  47. package/dist/esm/QueueDeckExpanded.js +553 -0
  48. package/dist/esm/TaxonomyCard-f9c93953.js +1039 -0
  49. package/dist/esm/TaxonomyCard.js +12 -0
  50. package/dist/esm/TemplateNormal.js +23 -0
  51. package/dist/esm/ThumbnailCard.js +53 -0
  52. package/dist/esm/Ustream-6bb45fe7.js +116 -0
  53. package/dist/esm/Ustream.js +4 -0
  54. package/dist/esm/VideoSeriesListing.js +242 -0
  55. package/dist/esm/YoutubeGroup-06df4923.js +222 -0
  56. package/dist/esm/YoutubeGroup.js +7 -0
  57. package/dist/esm/_babelHelpers-67c05996.js +111 -0
  58. package/dist/esm/_commonjsHelpers-ae1b5db5.js +15 -0
  59. package/dist/esm/debounce-a0242b4a.js +277 -0
  60. package/dist/esm/entities-e85d3a4a.js +503 -0
  61. package/dist/esm/get-b684ff61.js +990 -0
  62. package/dist/esm/index-3c1ee9ab.js +605 -0
  63. package/dist/esm/index-ca4ff5cb.js +548 -0
  64. package/dist/esm/index.es-f369b3e8.js +5022 -0
  65. package/dist/esm/index.esm-536609db.js +103 -0
  66. package/dist/esm/index.js +11991 -0
  67. package/dist/esm/isSymbol-c2b7d05a.js +203 -0
  68. package/dist/esm/main-dea495b7.js +851 -0
  69. package/dist/esm/visibility-sensor-3cfe6713.js +2243 -0
  70. package/package.json +8 -7
  71. package/dist/index.es.js +0 -30261
  72. package/dist/index.es.js.map +0 -1
  73. package/dist/index.js +0 -30320
  74. package/dist/index.js.map +0 -1
@@ -0,0 +1,222 @@
1
+ import React__default from 'react';
2
+ import { c as createCommonjsModule, a as commonjsGlobal } from './_commonjsHelpers-ae1b5db5.js';
3
+ import 'next/link';
4
+ import { L as LazyLoad } from './index-3c1ee9ab.js';
5
+
6
+ var getYoutubeId = createCommonjsModule(function (module, exports) {
7
+ (function (root, factory) {
8
+ {
9
+ module.exports = factory();
10
+ }
11
+ }(commonjsGlobal, function (exports) {
12
+
13
+ return function (url, opts) {
14
+ if (opts == undefined) {
15
+ opts = {fuzzy: true};
16
+ }
17
+
18
+ if (/youtu\.?be/.test(url)) {
19
+
20
+ // Look first for known patterns
21
+ var i;
22
+ var patterns = [
23
+ /youtu\.be\/([^#\&\?]{11})/, // youtu.be/<id>
24
+ /\?v=([^#\&\?]{11})/, // ?v=<id>
25
+ /\&v=([^#\&\?]{11})/, // &v=<id>
26
+ /embed\/([^#\&\?]{11})/, // embed/<id>
27
+ /\/v\/([^#\&\?]{11})/ // /v/<id>
28
+ ];
29
+
30
+ // If any pattern matches, return the ID
31
+ for (i = 0; i < patterns.length; ++i) {
32
+ if (patterns[i].test(url)) {
33
+ return patterns[i].exec(url)[1];
34
+ }
35
+ }
36
+
37
+ if (opts.fuzzy) {
38
+ // If that fails, break it apart by certain characters and look
39
+ // for the 11 character key
40
+ var tokens = url.split(/[\/\&\?=#\.\s]/g);
41
+ for (i = 0; i < tokens.length; ++i) {
42
+ if (/^[^#\&\?]{11}$/.test(tokens[i])) {
43
+ return tokens[i];
44
+ }
45
+ }
46
+ }
47
+ }
48
+
49
+ return null;
50
+ };
51
+
52
+ }));
53
+ });
54
+
55
+ /*
56
+ GROQ query -
57
+ accepts an array of title, URL
58
+ `http://img.youtube.com/vi/${getYouTubeId(vid.url)}/hqdefault.jpg`
59
+ */
60
+ var YoutubeGroup = function YoutubeGroup(props) {
61
+ // Props should be an array of objects containing Thumbnail, title, and URL
62
+ var get2 = props.get2 ? '/' + props.get2 + '/' : '/view/';
63
+
64
+ var variant = props.dark ? 'white' : '#383838';
65
+ function scrollSlider(e, direction) {
66
+ var slide = e.target.parentElement;
67
+ var scrollOffset = slide.scrollLeft;
68
+ var viewableWidth = slide.clientWidth > 700 ? 3 * (document.querySelector('.tile').scrollWidth + 8) : document.querySelector('.tile').scrollWidth + 8;
69
+ var scrollDirection = void 0;
70
+ if (direction === 'next') {
71
+ scrollDirection = scrollOffset + viewableWidth;
72
+ }
73
+ if (direction === 'prev') {
74
+ scrollDirection = scrollOffset - viewableWidth;
75
+ }
76
+ slide.scrollTo({
77
+ left: scrollDirection,
78
+ behavior: 'smooth'
79
+ });
80
+ }
81
+ function handleClick(url, vidIndex) {
82
+ props.setState(url, vidIndex);
83
+ }
84
+ var _props$current = props.current,
85
+ current = _props$current === undefined ? '' : _props$current;
86
+
87
+
88
+ return React__default.createElement(
89
+ 'div',
90
+ { id: 'vid-slider', className: 'col' },
91
+ React__default.createElement(
92
+ 'div',
93
+ { className: 'row' },
94
+ React__default.createElement(
95
+ 'div',
96
+ { onClick: function onClick(e) {
97
+ return scrollSlider(e, 'prev');
98
+ }, className: 'tile__slider-prev', style: { color: variant } },
99
+ React__default.createElement('i', { style: { border: 'solid ' + variant, borderWidth: '0 4px 4px 0' }, className: 'arrow left' })
100
+ ),
101
+ React__default.createElement(
102
+ 'div',
103
+ { onClick: function onClick(e) {
104
+ return scrollSlider(e, 'next');
105
+ }, className: 'tile__slider-next', style: { color: variant } },
106
+ React__default.createElement('i', { style: { border: 'solid ' + variant, borderWidth: '0 4px 4px 0' }, className: 'arrow right' })
107
+ ),
108
+ React__default.createElement(
109
+ 'div',
110
+ { className: 'row__inner' },
111
+ props.dataset && props.dataset.map(function (video, index) {
112
+ // If there is a current prop, means this will overlay a currently playing video
113
+ if (current !== '') {
114
+ var url = video.url;
115
+ var thumbnail = 'http://img.youtube.com/vi/' + getYoutubeId(video.url) + '/hqdefault.jpg';
116
+
117
+ return React__default.createElement(
118
+ 'div',
119
+ { key: index, className: 'tile' },
120
+ current && current === url ? React__default.createElement(
121
+ 'div',
122
+ { className: 'now-playing' },
123
+ 'Now Playing'
124
+ ) : '',
125
+ React__default.createElement(
126
+ 'a',
127
+ { onClick: function onClick() {
128
+ return handleClick(url, index + 1);
129
+ } },
130
+ React__default.createElement(
131
+ 'div',
132
+ { className: 'tile__media' },
133
+ React__default.createElement(
134
+ LazyLoad,
135
+ null,
136
+ React__default.createElement('img', { className: 'tile__img', src: thumbnail, alt: '' })
137
+ )
138
+ ),
139
+ React__default.createElement(
140
+ 'div',
141
+ { className: 'tile__details' },
142
+ React__default.createElement(
143
+ 'div',
144
+ { className: 'tile__title' },
145
+ React__default.createElement(
146
+ 'div',
147
+ { style: { color: variant }, className: 'tile__title_text' },
148
+ video.title
149
+ )
150
+ )
151
+ ),
152
+ React__default.createElement(
153
+ 'div',
154
+ { style: { color: variant }, className: 'tile__info' },
155
+ video.title
156
+ )
157
+ )
158
+ );
159
+ } else {
160
+ // slider by itself
161
+ var _url = '' + video.link;
162
+ var _thumbnail = 'http://img.youtube.com/vi/' + getYoutubeId(video.url) + '/hqdefault.jpg';
163
+ return React__default.createElement(
164
+ 'div',
165
+ { key: index, className: 'tile' },
166
+ React__default.createElement(
167
+ 'a',
168
+ { href: _url },
169
+ React__default.createElement(
170
+ 'div',
171
+ { className: 'tile__media' },
172
+ React__default.createElement(
173
+ LazyLoad,
174
+ null,
175
+ React__default.createElement('img', { className: 'tile__img', src: _thumbnail, alt: '' })
176
+ )
177
+ ),
178
+ React__default.createElement(
179
+ 'div',
180
+ { className: 'tile__details' },
181
+ React__default.createElement(
182
+ 'div',
183
+ { className: 'tile__title' },
184
+ React__default.createElement(
185
+ 'div',
186
+ { style: { color: variant }, className: 'tile__title_text' },
187
+ video.title
188
+ )
189
+ )
190
+ ),
191
+ React__default.createElement(
192
+ 'div',
193
+ { style: { color: variant }, className: 'tile__info' },
194
+ props.displayEpisodeNumber ? React__default.createElement(
195
+ 'span',
196
+ null,
197
+ React__default.createElement(
198
+ 'span',
199
+ { style: { fontWeight: 'bold' } },
200
+ 'Ep. ',
201
+ index + 1,
202
+ ':'
203
+ ),
204
+ ' ',
205
+ video.title
206
+ ) : video.title
207
+ )
208
+ )
209
+ );
210
+ }
211
+ })
212
+ )
213
+ ),
214
+ React__default.createElement(
215
+ 'style',
216
+ { jsx: 'true' },
217
+ '\n #vid-slider * {\n box-sizing: border-box;\n }\n #vid-slider {\n position: relative;\n }\n #vid-slider .now-playing {\n position: absolute;\n top: 0.5rem;\n left: 1rem;\n color: white;\n background: rgba(0, 0, 0, 0.75);\n }\n #vid-slider h1,\n #vid-slider p {\n text-align: center;\n width: 100%;\n max-width: 500px;\n margin: auto;\n }\n #vid-slider a:link,\n #vid-slider a:hover,\n #vid-slider a:active,\n #vid-slider a:visited {\n transition: color 150ms;\n color: #95a5a6;\n text-decoration: none;\n }\n #vid-slider a:hover {\n color: #7f8c8d;\n text-decoration: underline;\n }\n #vid-slider .contain {\n width: 100%;\n }\n #vid-slider .row {\n overflow: scroll;\n width: 100%;\n }\n #vid-slider .tile__info {\n white-space: normal !important;\n position: absolute;\n text-align: center;\n color: ' + (props.dark ? 'white' : '#383838') + ';\n opacity: 1;\n font-size: 1rem;\n transition: opacity 0.25s;\n }\n #vid-slider .row__inner {\n transition: 450ms -webkit-transform;\n transition: 450ms transform;\n transition: 450ms transform, 450ms -webkit-transform;\n font-size: 0;\n white-space: nowrap;\n margin: 55px 0;\n padding-bottom: 10px;\n padding-left: 0;\n }\n #vid-slider .tile {\n position: relative;\n display: inline-block;\n width: 250px;\n height: 140.625px;\n margin-right: 10px;\n font-size: 20px;\n cursor: pointer;\n transition: 450ms all;\n -webkit-transform-origin: center left;\n transform-origin: center left;\n }\n #vid-slider .tile__img {\n width: 250px;\n height: 140.625px;\n -o-object-fit: cover;\n object-fit: cover;\n }\n #vid-slider .tile__details {\n position: absolute;\n bottom: 0;\n left: 0;\n right: 0;\n top: 0;\n font-size: 10px;\n opacity: 0;\n background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0) 100%);\n transition: 450ms opacity;\n }\n #vid-slider .tile__details:after,\n #vid-slider .tile__details:before {\n content: \'\';\n position: absolute;\n top: 50%;\n left: 50%;\n display: #000;\n }\n #vid-slider .tile__details:after {\n margin-top: -25px;\n margin-left: -25px;\n width: 50px;\n height: 50px;\n border: 3px solid #ecf0f1;\n line-height: 50px;\n text-align: center;\n border-radius: 100%;\n background: rgba(0, 0, 0, 0.5);\n z-index: 1;\n }\n #vid-slider .tile__details:before {\n content: \'\u25B6\';\n left: 0;\n width: 100%;\n font-size: 30px;\n margin-left: 2px;\n margin-top: -23px;\n text-align: center;\n z-index: 2;\n color: white;\n }\n #vid-slider .tile:hover .tile__details {\n opacity: 1;\n }\n #vid-slider .tile__title {\n position: absolute;\n bottom: 0;\n padding: 10px;\n max-width: 250px;\n }\n #vid-slider .tile__title_text {\n position: relative;\n left: 0;\n white-space: normal;\n }\n #vid-slider .row__inner:hover {\n -webkit-transform: translate3d(-62.5px, 0, 0);\n transform: translate3d(-62.5px, 0, 0);\n }\n #vid-slider .row__inner:hover .tile {\n opacity: 0.3;\n }\n #vid-slider .row__inner:hover .tile:hover {\n -webkit-transform: scale(1.25);\n transform: scale(1.25);\n opacity: 1;\n }\n #vid-slider .tile:hover ~ .tile {\n -webkit-transform: translate3d(62px, 0, 0);\n transform: translate3d(62px, 0, 0);\n }\n #vid-slider .tile:hover .tile__info {\n opacity: 0;\n }\n #vid-slider .tile__slider-prev,\n #vid-slider .tile__slider-next {\n width: 30px;\n background: transparent;\n border: none;\n position: absolute;\n top: 50%;\n transform: translateY(-50%);\n z-index: 99;\n cursor: pointer;\n color: ' + (props.dark ? 'white' : 'black') + ';\n display: flex;\n justify-content: center;\n align-items: center;\n font-size: 2rem;\n }\n #vid-slider .tile__slider-prev {\n left: -3px;\n }\n #vid-slider .tile__slider-next {\n right: 0;\n }\n #vid-slider,\n #vid-slider .row {\n margin: 0;\n padding: 0 1.2rem;\n }\n #vid-slider .tile:last-child {\n margin-right: 2rem;\n }\n #vid-slider .row::-webkit-scrollbar-thumb {\n background-color: transparent !important;\n }\n #vid-slider i {\n border: solid ' + (props.dark ? 'white' : 'black') + ';\n border-width: 0 4px 4px 0;\n display: inline-block;\n padding: 4px;\n pointer-events: none;\n }\n\n #vid-slider .right {\n transform: rotate(-45deg);\n -webkit-transform: rotate(-45deg);\n }\n\n #vid-slider .left {\n transform: rotate(135deg);\n -webkit-transform: rotate(135deg);\n }\n '
218
+ )
219
+ );
220
+ };
221
+
222
+ export { YoutubeGroup as Y, getYoutubeId as g };
@@ -0,0 +1,7 @@
1
+ import 'react';
2
+ import './_commonjsHelpers-ae1b5db5.js';
3
+ import 'prop-types';
4
+ import 'next/link';
5
+ import 'react-dom';
6
+ import './index-3c1ee9ab.js';
7
+ export { Y as default } from './YoutubeGroup-06df4923.js';
@@ -0,0 +1,111 @@
1
+ var classCallCheck = function (instance, Constructor) {
2
+ if (!(instance instanceof Constructor)) {
3
+ throw new TypeError("Cannot call a class as a function");
4
+ }
5
+ };
6
+
7
+ var createClass = function () {
8
+ function defineProperties(target, props) {
9
+ for (var i = 0; i < props.length; i++) {
10
+ var descriptor = props[i];
11
+ descriptor.enumerable = descriptor.enumerable || false;
12
+ descriptor.configurable = true;
13
+ if ("value" in descriptor) descriptor.writable = true;
14
+ Object.defineProperty(target, descriptor.key, descriptor);
15
+ }
16
+ }
17
+
18
+ return function (Constructor, protoProps, staticProps) {
19
+ if (protoProps) defineProperties(Constructor.prototype, protoProps);
20
+ if (staticProps) defineProperties(Constructor, staticProps);
21
+ return Constructor;
22
+ };
23
+ }();
24
+
25
+ var _extends = Object.assign || function (target) {
26
+ for (var i = 1; i < arguments.length; i++) {
27
+ var source = arguments[i];
28
+
29
+ for (var key in source) {
30
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
31
+ target[key] = source[key];
32
+ }
33
+ }
34
+ }
35
+
36
+ return target;
37
+ };
38
+
39
+ var inherits = function (subClass, superClass) {
40
+ if (typeof superClass !== "function" && superClass !== null) {
41
+ throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
42
+ }
43
+
44
+ subClass.prototype = Object.create(superClass && superClass.prototype, {
45
+ constructor: {
46
+ value: subClass,
47
+ enumerable: false,
48
+ writable: true,
49
+ configurable: true
50
+ }
51
+ });
52
+ if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
53
+ };
54
+
55
+ var possibleConstructorReturn = function (self, call) {
56
+ if (!self) {
57
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
58
+ }
59
+
60
+ return call && (typeof call === "object" || typeof call === "function") ? call : self;
61
+ };
62
+
63
+ var slicedToArray = function () {
64
+ function sliceIterator(arr, i) {
65
+ var _arr = [];
66
+ var _n = true;
67
+ var _d = false;
68
+ var _e = undefined;
69
+
70
+ try {
71
+ for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
72
+ _arr.push(_s.value);
73
+
74
+ if (i && _arr.length === i) break;
75
+ }
76
+ } catch (err) {
77
+ _d = true;
78
+ _e = err;
79
+ } finally {
80
+ try {
81
+ if (!_n && _i["return"]) _i["return"]();
82
+ } finally {
83
+ if (_d) throw _e;
84
+ }
85
+ }
86
+
87
+ return _arr;
88
+ }
89
+
90
+ return function (arr, i) {
91
+ if (Array.isArray(arr)) {
92
+ return arr;
93
+ } else if (Symbol.iterator in Object(arr)) {
94
+ return sliceIterator(arr, i);
95
+ } else {
96
+ throw new TypeError("Invalid attempt to destructure non-iterable instance");
97
+ }
98
+ };
99
+ }();
100
+
101
+ var toConsumableArray = function (arr) {
102
+ if (Array.isArray(arr)) {
103
+ for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];
104
+
105
+ return arr2;
106
+ } else {
107
+ return Array.from(arr);
108
+ }
109
+ };
110
+
111
+ export { _extends as _, classCallCheck as a, createClass as c, inherits as i, possibleConstructorReturn as p, slicedToArray as s, toConsumableArray as t };
@@ -0,0 +1,15 @@
1
+ var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
2
+
3
+ function commonjsRequire () {
4
+ throw new Error('Dynamic requires are not currently supported by rollup-plugin-commonjs');
5
+ }
6
+
7
+ function unwrapExports (x) {
8
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
9
+ }
10
+
11
+ function createCommonjsModule(fn, module) {
12
+ return module = { exports: {} }, fn(module, module.exports), module.exports;
13
+ }
14
+
15
+ export { commonjsGlobal as a, commonjsRequire as b, createCommonjsModule as c, unwrapExports as u };
@@ -0,0 +1,277 @@
1
+ import { _ as _root, i as isSymbol_1, a as isObject_1 } from './isSymbol-c2b7d05a.js';
2
+
3
+ /**
4
+ * Gets the timestamp of the number of milliseconds that have elapsed since
5
+ * the Unix epoch (1 January 1970 00:00:00 UTC).
6
+ *
7
+ * @static
8
+ * @memberOf _
9
+ * @since 2.4.0
10
+ * @category Date
11
+ * @returns {number} Returns the timestamp.
12
+ * @example
13
+ *
14
+ * _.defer(function(stamp) {
15
+ * console.log(_.now() - stamp);
16
+ * }, _.now());
17
+ * // => Logs the number of milliseconds it took for the deferred invocation.
18
+ */
19
+ var now = function() {
20
+ return _root.Date.now();
21
+ };
22
+
23
+ var now_1 = now;
24
+
25
+ /** Used as references for various `Number` constants. */
26
+ var NAN = 0 / 0;
27
+
28
+ /** Used to match leading and trailing whitespace. */
29
+ var reTrim = /^\s+|\s+$/g;
30
+
31
+ /** Used to detect bad signed hexadecimal string values. */
32
+ var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
33
+
34
+ /** Used to detect binary string values. */
35
+ var reIsBinary = /^0b[01]+$/i;
36
+
37
+ /** Used to detect octal string values. */
38
+ var reIsOctal = /^0o[0-7]+$/i;
39
+
40
+ /** Built-in method references without a dependency on `root`. */
41
+ var freeParseInt = parseInt;
42
+
43
+ /**
44
+ * Converts `value` to a number.
45
+ *
46
+ * @static
47
+ * @memberOf _
48
+ * @since 4.0.0
49
+ * @category Lang
50
+ * @param {*} value The value to process.
51
+ * @returns {number} Returns the number.
52
+ * @example
53
+ *
54
+ * _.toNumber(3.2);
55
+ * // => 3.2
56
+ *
57
+ * _.toNumber(Number.MIN_VALUE);
58
+ * // => 5e-324
59
+ *
60
+ * _.toNumber(Infinity);
61
+ * // => Infinity
62
+ *
63
+ * _.toNumber('3.2');
64
+ * // => 3.2
65
+ */
66
+ function toNumber(value) {
67
+ if (typeof value == 'number') {
68
+ return value;
69
+ }
70
+ if (isSymbol_1(value)) {
71
+ return NAN;
72
+ }
73
+ if (isObject_1(value)) {
74
+ var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
75
+ value = isObject_1(other) ? (other + '') : other;
76
+ }
77
+ if (typeof value != 'string') {
78
+ return value === 0 ? value : +value;
79
+ }
80
+ value = value.replace(reTrim, '');
81
+ var isBinary = reIsBinary.test(value);
82
+ return (isBinary || reIsOctal.test(value))
83
+ ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
84
+ : (reIsBadHex.test(value) ? NAN : +value);
85
+ }
86
+
87
+ var toNumber_1 = toNumber;
88
+
89
+ /** Error message constants. */
90
+ var FUNC_ERROR_TEXT = 'Expected a function';
91
+
92
+ /* Built-in method references for those with the same name as other `lodash` methods. */
93
+ var nativeMax = Math.max,
94
+ nativeMin = Math.min;
95
+
96
+ /**
97
+ * Creates a debounced function that delays invoking `func` until after `wait`
98
+ * milliseconds have elapsed since the last time the debounced function was
99
+ * invoked. The debounced function comes with a `cancel` method to cancel
100
+ * delayed `func` invocations and a `flush` method to immediately invoke them.
101
+ * Provide `options` to indicate whether `func` should be invoked on the
102
+ * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
103
+ * with the last arguments provided to the debounced function. Subsequent
104
+ * calls to the debounced function return the result of the last `func`
105
+ * invocation.
106
+ *
107
+ * **Note:** If `leading` and `trailing` options are `true`, `func` is
108
+ * invoked on the trailing edge of the timeout only if the debounced function
109
+ * is invoked more than once during the `wait` timeout.
110
+ *
111
+ * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
112
+ * until to the next tick, similar to `setTimeout` with a timeout of `0`.
113
+ *
114
+ * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
115
+ * for details over the differences between `_.debounce` and `_.throttle`.
116
+ *
117
+ * @static
118
+ * @memberOf _
119
+ * @since 0.1.0
120
+ * @category Function
121
+ * @param {Function} func The function to debounce.
122
+ * @param {number} [wait=0] The number of milliseconds to delay.
123
+ * @param {Object} [options={}] The options object.
124
+ * @param {boolean} [options.leading=false]
125
+ * Specify invoking on the leading edge of the timeout.
126
+ * @param {number} [options.maxWait]
127
+ * The maximum time `func` is allowed to be delayed before it's invoked.
128
+ * @param {boolean} [options.trailing=true]
129
+ * Specify invoking on the trailing edge of the timeout.
130
+ * @returns {Function} Returns the new debounced function.
131
+ * @example
132
+ *
133
+ * // Avoid costly calculations while the window size is in flux.
134
+ * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
135
+ *
136
+ * // Invoke `sendMail` when clicked, debouncing subsequent calls.
137
+ * jQuery(element).on('click', _.debounce(sendMail, 300, {
138
+ * 'leading': true,
139
+ * 'trailing': false
140
+ * }));
141
+ *
142
+ * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
143
+ * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
144
+ * var source = new EventSource('/stream');
145
+ * jQuery(source).on('message', debounced);
146
+ *
147
+ * // Cancel the trailing debounced invocation.
148
+ * jQuery(window).on('popstate', debounced.cancel);
149
+ */
150
+ function debounce(func, wait, options) {
151
+ var lastArgs,
152
+ lastThis,
153
+ maxWait,
154
+ result,
155
+ timerId,
156
+ lastCallTime,
157
+ lastInvokeTime = 0,
158
+ leading = false,
159
+ maxing = false,
160
+ trailing = true;
161
+
162
+ if (typeof func != 'function') {
163
+ throw new TypeError(FUNC_ERROR_TEXT);
164
+ }
165
+ wait = toNumber_1(wait) || 0;
166
+ if (isObject_1(options)) {
167
+ leading = !!options.leading;
168
+ maxing = 'maxWait' in options;
169
+ maxWait = maxing ? nativeMax(toNumber_1(options.maxWait) || 0, wait) : maxWait;
170
+ trailing = 'trailing' in options ? !!options.trailing : trailing;
171
+ }
172
+
173
+ function invokeFunc(time) {
174
+ var args = lastArgs,
175
+ thisArg = lastThis;
176
+
177
+ lastArgs = lastThis = undefined;
178
+ lastInvokeTime = time;
179
+ result = func.apply(thisArg, args);
180
+ return result;
181
+ }
182
+
183
+ function leadingEdge(time) {
184
+ // Reset any `maxWait` timer.
185
+ lastInvokeTime = time;
186
+ // Start the timer for the trailing edge.
187
+ timerId = setTimeout(timerExpired, wait);
188
+ // Invoke the leading edge.
189
+ return leading ? invokeFunc(time) : result;
190
+ }
191
+
192
+ function remainingWait(time) {
193
+ var timeSinceLastCall = time - lastCallTime,
194
+ timeSinceLastInvoke = time - lastInvokeTime,
195
+ timeWaiting = wait - timeSinceLastCall;
196
+
197
+ return maxing
198
+ ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)
199
+ : timeWaiting;
200
+ }
201
+
202
+ function shouldInvoke(time) {
203
+ var timeSinceLastCall = time - lastCallTime,
204
+ timeSinceLastInvoke = time - lastInvokeTime;
205
+
206
+ // Either this is the first call, activity has stopped and we're at the
207
+ // trailing edge, the system time has gone backwards and we're treating
208
+ // it as the trailing edge, or we've hit the `maxWait` limit.
209
+ return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
210
+ (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
211
+ }
212
+
213
+ function timerExpired() {
214
+ var time = now_1();
215
+ if (shouldInvoke(time)) {
216
+ return trailingEdge(time);
217
+ }
218
+ // Restart the timer.
219
+ timerId = setTimeout(timerExpired, remainingWait(time));
220
+ }
221
+
222
+ function trailingEdge(time) {
223
+ timerId = undefined;
224
+
225
+ // Only invoke if we have `lastArgs` which means `func` has been
226
+ // debounced at least once.
227
+ if (trailing && lastArgs) {
228
+ return invokeFunc(time);
229
+ }
230
+ lastArgs = lastThis = undefined;
231
+ return result;
232
+ }
233
+
234
+ function cancel() {
235
+ if (timerId !== undefined) {
236
+ clearTimeout(timerId);
237
+ }
238
+ lastInvokeTime = 0;
239
+ lastArgs = lastCallTime = lastThis = timerId = undefined;
240
+ }
241
+
242
+ function flush() {
243
+ return timerId === undefined ? result : trailingEdge(now_1());
244
+ }
245
+
246
+ function debounced() {
247
+ var time = now_1(),
248
+ isInvoking = shouldInvoke(time);
249
+
250
+ lastArgs = arguments;
251
+ lastThis = this;
252
+ lastCallTime = time;
253
+
254
+ if (isInvoking) {
255
+ if (timerId === undefined) {
256
+ return leadingEdge(lastCallTime);
257
+ }
258
+ if (maxing) {
259
+ // Handle invocations in a tight loop.
260
+ clearTimeout(timerId);
261
+ timerId = setTimeout(timerExpired, wait);
262
+ return invokeFunc(lastCallTime);
263
+ }
264
+ }
265
+ if (timerId === undefined) {
266
+ timerId = setTimeout(timerExpired, wait);
267
+ }
268
+ return result;
269
+ }
270
+ debounced.cancel = cancel;
271
+ debounced.flush = flush;
272
+ return debounced;
273
+ }
274
+
275
+ var debounce_1 = debounce;
276
+
277
+ export { debounce_1 as d };