1 | var WaveformPlaylist;
|
2 | (() => {
|
3 | var __webpack_modules__ = ({
|
4 |
|
5 | 6824:
|
6 | ((module) => {
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 |
|
31 |
|
32 |
|
33 |
|
34 |
|
35 |
|
36 |
|
37 |
|
38 |
|
39 | module.exports = (function split(undef) {
|
40 |
|
41 | var nativeSplit = String.prototype.split,
|
42 | compliantExecNpcg = /()??/.exec("")[1] === undef,
|
43 |
|
44 | self;
|
45 |
|
46 | self = function(str, separator, limit) {
|
47 |
|
48 | if (Object.prototype.toString.call(separator) !== "[object RegExp]") {
|
49 | return nativeSplit.call(str, separator, limit);
|
50 | }
|
51 | var output = [],
|
52 | flags = (separator.ignoreCase ? "i" : "") + (separator.multiline ? "m" : "") + (separator.extended ? "x" : "") +
|
53 | (separator.sticky ? "y" : ""),
|
54 |
|
55 | lastLastIndex = 0,
|
56 |
|
57 | separator = new RegExp(separator.source, flags + "g"),
|
58 | separator2, match, lastIndex, lastLength;
|
59 | str += "";
|
60 | if (!compliantExecNpcg) {
|
61 |
|
62 | separator2 = new RegExp("^" + separator.source + "$(?!\\s)", flags);
|
63 | }
|
64 | |
65 |
|
66 |
|
67 |
|
68 |
|
69 |
|
70 |
|
71 | limit = limit === undef ? -1 >>> 0 :
|
72 | limit >>> 0;
|
73 | while (match = separator.exec(str)) {
|
74 |
|
75 | lastIndex = match.index + match[0].length;
|
76 | if (lastIndex > lastLastIndex) {
|
77 | output.push(str.slice(lastLastIndex, match.index));
|
78 |
|
79 |
|
80 | if (!compliantExecNpcg && match.length > 1) {
|
81 | match[0].replace(separator2, function() {
|
82 | for (var i = 1; i < arguments.length - 2; i++) {
|
83 | if (arguments[i] === undef) {
|
84 | match[i] = undef;
|
85 | }
|
86 | }
|
87 | });
|
88 | }
|
89 | if (match.length > 1 && match.index < str.length) {
|
90 | Array.prototype.push.apply(output, match.slice(1));
|
91 | }
|
92 | lastLength = match[0].length;
|
93 | lastLastIndex = lastIndex;
|
94 | if (output.length >= limit) {
|
95 | break;
|
96 | }
|
97 | }
|
98 | if (separator.lastIndex === match.index) {
|
99 | separator.lastIndex++;
|
100 | }
|
101 | }
|
102 | if (lastLastIndex === str.length) {
|
103 | if (lastLength || !separator.test("")) {
|
104 | output.push("");
|
105 | }
|
106 | } else {
|
107 | output.push(str.slice(lastLastIndex));
|
108 | }
|
109 | return output.length > limit ? output.slice(0, limit) : output;
|
110 | };
|
111 |
|
112 | return self;
|
113 | })();
|
114 |
|
115 |
|
116 | }),
|
117 |
|
118 | 1804:
|
119 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
120 |
|
121 | "use strict";
|
122 |
|
123 |
|
124 | var isValue = __webpack_require__(5618)
|
125 | , isPlainFunction = __webpack_require__(7205)
|
126 | , assign = __webpack_require__(7191)
|
127 | , normalizeOpts = __webpack_require__(5516)
|
128 | , contains = __webpack_require__(9981);
|
129 |
|
130 | var d = (module.exports = function (dscr, value/*, options*/) {
|
131 | var c, e, w, options, desc;
|
132 | if (arguments.length < 2 || typeof dscr !== "string") {
|
133 | options = value;
|
134 | value = dscr;
|
135 | dscr = null;
|
136 | } else {
|
137 | options = arguments[2];
|
138 | }
|
139 | if (isValue(dscr)) {
|
140 | c = contains.call(dscr, "c");
|
141 | e = contains.call(dscr, "e");
|
142 | w = contains.call(dscr, "w");
|
143 | } else {
|
144 | c = w = true;
|
145 | e = false;
|
146 | }
|
147 |
|
148 | desc = { value: value, configurable: c, enumerable: e, writable: w };
|
149 | return !options ? desc : assign(normalizeOpts(options), desc);
|
150 | });
|
151 |
|
152 | d.gs = function (dscr, get, set/*, options*/) {
|
153 | var c, e, options, desc;
|
154 | if (typeof dscr !== "string") {
|
155 | options = set;
|
156 | set = get;
|
157 | get = dscr;
|
158 | dscr = null;
|
159 | } else {
|
160 | options = arguments[3];
|
161 | }
|
162 | if (!isValue(get)) {
|
163 | get = undefined;
|
164 | } else if (!isPlainFunction(get)) {
|
165 | options = get;
|
166 | get = set = undefined;
|
167 | } else if (!isValue(set)) {
|
168 | set = undefined;
|
169 | } else if (!isPlainFunction(set)) {
|
170 | options = set;
|
171 | set = undefined;
|
172 | }
|
173 | if (isValue(dscr)) {
|
174 | c = contains.call(dscr, "c");
|
175 | e = contains.call(dscr, "e");
|
176 | } else {
|
177 | c = true;
|
178 | e = false;
|
179 | }
|
180 |
|
181 | desc = { get: get, set: set, configurable: c, enumerable: e };
|
182 | return !options ? desc : assign(normalizeOpts(options), desc);
|
183 | };
|
184 |
|
185 |
|
186 | /***/ }),
|
187 |
|
188 | /***/ 430:
|
189 | /***/ ((module) => {
|
190 |
|
191 | "use strict";
|
192 |
|
193 |
|
194 |
|
195 | module.exports = function () {};
|
196 |
|
197 |
|
198 | }),
|
199 |
|
200 | 7191:
|
201 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
202 |
|
203 | "use strict";
|
204 |
|
205 |
|
206 | module.exports = __webpack_require__(6560)() ? Object.assign : __webpack_require__(7346);
|
207 |
|
208 |
|
209 | }),
|
210 |
|
211 | 6560:
|
212 | ((module) => {
|
213 |
|
214 | "use strict";
|
215 |
|
216 |
|
217 | module.exports = function () {
|
218 | var assign = Object.assign, obj;
|
219 | if (typeof assign !== "function") return false;
|
220 | obj = { foo: "raz" };
|
221 | assign(obj, { bar: "dwa" }, { trzy: "trzy" });
|
222 | return obj.foo + obj.bar + obj.trzy === "razdwatrzy";
|
223 | };
|
224 |
|
225 |
|
226 | }),
|
227 |
|
228 | 7346:
|
229 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
230 |
|
231 | "use strict";
|
232 |
|
233 |
|
234 | var keys = __webpack_require__(5103)
|
235 | , value = __webpack_require__(2745)
|
236 | , max = Math.max;
|
237 |
|
238 | module.exports = function (dest, src/*, …srcn*/) {
|
239 | var error, i, length = max(arguments.length, 2), assign;
|
240 | dest = Object(value(dest));
|
241 | assign = function (key) {
|
242 | try {
|
243 | dest[key] = src[key];
|
244 | } catch (e) {
|
245 | if (!error) error = e;
|
246 | }
|
247 | };
|
248 | for (i = 1; i < length; ++i) {
|
249 | src = arguments[i];
|
250 | keys(src).forEach(assign);
|
251 | }
|
252 | if (error !== undefined) throw error;
|
253 | return dest;
|
254 | };
|
255 |
|
256 |
|
257 | }),
|
258 |
|
259 | 6914:
|
260 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
261 |
|
262 | "use strict";
|
263 |
|
264 |
|
265 | var _undefined = __webpack_require__(430)();
|
266 |
|
267 | module.exports = function (val) { return val !== _undefined && val !== null; };
|
268 |
|
269 |
|
270 | }),
|
271 |
|
272 | 5103:
|
273 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
274 |
|
275 | "use strict";
|
276 |
|
277 |
|
278 | module.exports = __webpack_require__(7446)() ? Object.keys : __webpack_require__(6137);
|
279 |
|
280 |
|
281 | }),
|
282 |
|
283 | 7446:
|
284 | ((module) => {
|
285 |
|
286 | "use strict";
|
287 |
|
288 |
|
289 | module.exports = function () {
|
290 | try {
|
291 | Object.keys("primitive");
|
292 | return true;
|
293 | } catch (e) {
|
294 | return false;
|
295 | }
|
296 | };
|
297 |
|
298 |
|
299 | }),
|
300 |
|
301 | 6137:
|
302 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
303 |
|
304 | "use strict";
|
305 |
|
306 |
|
307 | var isValue = __webpack_require__(6914);
|
308 |
|
309 | var keys = Object.keys;
|
310 |
|
311 | module.exports = function (object) { return keys(isValue(object) ? Object(object) : object); };
|
312 |
|
313 |
|
314 | }),
|
315 |
|
316 | 5516:
|
317 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
318 |
|
319 | "use strict";
|
320 |
|
321 |
|
322 | var isValue = __webpack_require__(6914);
|
323 |
|
324 | var forEach = Array.prototype.forEach, create = Object.create;
|
325 |
|
326 | var process = function (src, obj) {
|
327 | var key;
|
328 | for (key in src) obj[key] = src[key];
|
329 | };
|
330 |
|
331 |
|
332 | module.exports = function (opts1/*, …options*/) {
|
333 | var result = create(null);
|
334 | forEach.call(arguments, function (options) {
|
335 | if (!isValue(options)) return;
|
336 | process(Object(options), result);
|
337 | });
|
338 | return result;
|
339 | };
|
340 |
|
341 |
|
342 | }),
|
343 |
|
344 | 1290:
|
345 | ((module) => {
|
346 |
|
347 | "use strict";
|
348 |
|
349 |
|
350 | module.exports = function (fn) {
|
351 | if (typeof fn !== "function") throw new TypeError(fn + " is not a function");
|
352 | return fn;
|
353 | };
|
354 |
|
355 |
|
356 | }),
|
357 |
|
358 | 2745:
|
359 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
360 |
|
361 | "use strict";
|
362 |
|
363 |
|
364 | var isValue = __webpack_require__(6914);
|
365 |
|
366 | module.exports = function (value) {
|
367 | if (!isValue(value)) throw new TypeError("Cannot use null or undefined");
|
368 | return value;
|
369 | };
|
370 |
|
371 |
|
372 | }),
|
373 |
|
374 | 9981:
|
375 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
376 |
|
377 | "use strict";
|
378 |
|
379 |
|
380 | module.exports = __webpack_require__(3591)() ? String.prototype.contains : __webpack_require__(6042);
|
381 |
|
382 |
|
383 | }),
|
384 |
|
385 | 3591:
|
386 | ((module) => {
|
387 |
|
388 | "use strict";
|
389 |
|
390 |
|
391 | var str = "razdwatrzy";
|
392 |
|
393 | module.exports = function () {
|
394 | if (typeof str.contains !== "function") return false;
|
395 | return str.contains("dwa") === true && str.contains("foo") === false;
|
396 | };
|
397 |
|
398 |
|
399 | }),
|
400 |
|
401 | 6042:
|
402 | ((module) => {
|
403 |
|
404 | "use strict";
|
405 |
|
406 |
|
407 | var indexOf = String.prototype.indexOf;
|
408 |
|
409 | module.exports = function (searchString/*, position*/) {
|
410 | return indexOf.call(this, searchString, arguments[1]) > -1;
|
411 | };
|
412 |
|
413 |
|
414 | }),
|
415 |
|
416 | 8832:
|
417 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
418 |
|
419 | "use strict";
|
420 |
|
421 |
|
422 | var OneVersionConstraint = __webpack_require__(4167);
|
423 |
|
424 | var MY_VERSION = '7';
|
425 | OneVersionConstraint('ev-store', MY_VERSION);
|
426 |
|
427 | var hashKey = '__EV_STORE_KEY@' + MY_VERSION;
|
428 |
|
429 | module.exports = EvStore;
|
430 |
|
431 | function EvStore(elem) {
|
432 | var hash = elem[hashKey];
|
433 |
|
434 | if (!hash) {
|
435 | hash = elem[hashKey] = {};
|
436 | }
|
437 |
|
438 | return hash;
|
439 | }
|
440 |
|
441 |
|
442 | }),
|
443 |
|
444 | 8370:
|
445 | ((module, exports, __webpack_require__) => {
|
446 |
|
447 | "use strict";
|
448 |
|
449 |
|
450 | var d = __webpack_require__(1804)
|
451 | , callable = __webpack_require__(1290)
|
452 |
|
453 | , apply = Function.prototype.apply, call = Function.prototype.call
|
454 | , create = Object.create, defineProperty = Object.defineProperty
|
455 | , defineProperties = Object.defineProperties
|
456 | , hasOwnProperty = Object.prototype.hasOwnProperty
|
457 | , descriptor = { configurable: true, enumerable: false, writable: true }
|
458 |
|
459 | , on, once, off, emit, methods, descriptors, base;
|
460 |
|
461 | on = function (type, listener) {
|
462 | var data;
|
463 |
|
464 | callable(listener);
|
465 |
|
466 | if (!hasOwnProperty.call(this, '__ee__')) {
|
467 | data = descriptor.value = create(null);
|
468 | defineProperty(this, '__ee__', descriptor);
|
469 | descriptor.value = null;
|
470 | } else {
|
471 | data = this.__ee__;
|
472 | }
|
473 | if (!data[type]) data[type] = listener;
|
474 | else if (typeof data[type] === 'object') data[type].push(listener);
|
475 | else data[type] = [data[type], listener];
|
476 |
|
477 | return this;
|
478 | };
|
479 |
|
480 | once = function (type, listener) {
|
481 | var once, self;
|
482 |
|
483 | callable(listener);
|
484 | self = this;
|
485 | on.call(this, type, once = function () {
|
486 | off.call(self, type, once);
|
487 | apply.call(listener, this, arguments);
|
488 | });
|
489 |
|
490 | once.__eeOnceListener__ = listener;
|
491 | return this;
|
492 | };
|
493 |
|
494 | off = function (type, listener) {
|
495 | var data, listeners, candidate, i;
|
496 |
|
497 | callable(listener);
|
498 |
|
499 | if (!hasOwnProperty.call(this, '__ee__')) return this;
|
500 | data = this.__ee__;
|
501 | if (!data[type]) return this;
|
502 | listeners = data[type];
|
503 |
|
504 | if (typeof listeners === 'object') {
|
505 | for (i = 0; (candidate = listeners[i]); ++i) {
|
506 | if ((candidate === listener) ||
|
507 | (candidate.__eeOnceListener__ === listener)) {
|
508 | if (listeners.length === 2) data[type] = listeners[i ? 0 : 1];
|
509 | else listeners.splice(i, 1);
|
510 | }
|
511 | }
|
512 | } else {
|
513 | if ((listeners === listener) ||
|
514 | (listeners.__eeOnceListener__ === listener)) {
|
515 | delete data[type];
|
516 | }
|
517 | }
|
518 |
|
519 | return this;
|
520 | };
|
521 |
|
522 | emit = function (type) {
|
523 | var i, l, listener, listeners, args;
|
524 |
|
525 | if (!hasOwnProperty.call(this, '__ee__')) return;
|
526 | listeners = this.__ee__[type];
|
527 | if (!listeners) return;
|
528 |
|
529 | if (typeof listeners === 'object') {
|
530 | l = arguments.length;
|
531 | args = new Array(l - 1);
|
532 | for (i = 1; i < l; ++i) args[i - 1] = arguments[i];
|
533 |
|
534 | listeners = listeners.slice();
|
535 | for (i = 0; (listener = listeners[i]); ++i) {
|
536 | apply.call(listener, this, args);
|
537 | }
|
538 | } else {
|
539 | switch (arguments.length) {
|
540 | case 1:
|
541 | call.call(listeners, this);
|
542 | break;
|
543 | case 2:
|
544 | call.call(listeners, this, arguments[1]);
|
545 | break;
|
546 | case 3:
|
547 | call.call(listeners, this, arguments[1], arguments[2]);
|
548 | break;
|
549 | default:
|
550 | l = arguments.length;
|
551 | args = new Array(l - 1);
|
552 | for (i = 1; i < l; ++i) {
|
553 | args[i - 1] = arguments[i];
|
554 | }
|
555 | apply.call(listeners, this, args);
|
556 | }
|
557 | }
|
558 | };
|
559 |
|
560 | methods = {
|
561 | on: on,
|
562 | once: once,
|
563 | off: off,
|
564 | emit: emit
|
565 | };
|
566 |
|
567 | descriptors = {
|
568 | on: d(on),
|
569 | once: d(once),
|
570 | off: d(off),
|
571 | emit: d(emit)
|
572 | };
|
573 |
|
574 | base = defineProperties({}, descriptors);
|
575 |
|
576 | module.exports = exports = function (o) {
|
577 | return (o == null) ? create(base) : defineProperties(Object(o), descriptors);
|
578 | };
|
579 | exports.methods = methods;
|
580 |
|
581 |
|
582 | }),
|
583 |
|
584 | 6226:
|
585 | ((__unused_webpack_module, exports) => {
|
586 |
|
587 | "use strict";
|
588 |
|
589 |
|
590 | Object.defineProperty(exports, "__esModule", ({
|
591 | value: true
|
592 | }));
|
593 | exports.linear = linear;
|
594 | exports.exponential = exponential;
|
595 | exports.sCurve = sCurve;
|
596 | exports.logarithmic = logarithmic;
|
597 | function linear(length, rotation) {
|
598 | var curve = new Float32Array(length),
|
599 | i,
|
600 | x,
|
601 | scale = length - 1;
|
602 |
|
603 | for (i = 0; i < length; i++) {
|
604 | x = i / scale;
|
605 |
|
606 | if (rotation > 0) {
|
607 | curve[i] = x;
|
608 | } else {
|
609 | curve[i] = 1 - x;
|
610 | }
|
611 | }
|
612 |
|
613 | return curve;
|
614 | }
|
615 |
|
616 | function exponential(length, rotation) {
|
617 | var curve = new Float32Array(length),
|
618 | i,
|
619 | x,
|
620 | scale = length - 1,
|
621 | index;
|
622 |
|
623 | for (i = 0; i < length; i++) {
|
624 | x = i / scale;
|
625 | index = rotation > 0 ? i : length - 1 - i;
|
626 |
|
627 | curve[index] = Math.exp(2 * x - 1) / Math.exp(1);
|
628 | }
|
629 |
|
630 | return curve;
|
631 | }
|
632 |
|
633 |
|
634 | function sCurve(length, rotation) {
|
635 | var curve = new Float32Array(length),
|
636 | i,
|
637 | phase = rotation > 0 ? Math.PI / 2 : -(Math.PI / 2);
|
638 |
|
639 | for (i = 0; i < length; ++i) {
|
640 | curve[i] = Math.sin(Math.PI * i / length - phase) / 2 + 0.5;
|
641 | }
|
642 | return curve;
|
643 | }
|
644 |
|
645 |
|
646 | function logarithmic(length, base, rotation) {
|
647 | var curve = new Float32Array(length),
|
648 | index,
|
649 | x = 0,
|
650 | i;
|
651 |
|
652 | for (i = 0; i < length; i++) {
|
653 |
|
654 | index = rotation > 0 ? i : length - 1 - i;
|
655 |
|
656 | x = i / length;
|
657 | curve[index] = Math.log(1 + base * x) / Math.log(1 + base);
|
658 | }
|
659 |
|
660 | return curve;
|
661 | }
|
662 |
|
663 |
|
664 | }),
|
665 |
|
666 | 1114:
|
667 | ((__unused_webpack_module, exports, __webpack_require__) => {
|
668 |
|
669 | "use strict";
|
670 | var __webpack_unused_export__;
|
671 |
|
672 |
|
673 | __webpack_unused_export__ = ({
|
674 | value: true
|
675 | });
|
676 | exports.h7 = exports.Y1 = exports.Hp = exports.Jl = exports.t$ = exports._h = undefined;
|
677 | exports.L7 = createFadeIn;
|
678 | exports.Mt = createFadeOut;
|
679 |
|
680 | var _fadeCurves = __webpack_require__(6226);
|
681 |
|
682 | var SCURVE = exports._h = "sCurve";
|
683 | var LINEAR = exports.t$ = "linear";
|
684 | var EXPONENTIAL = exports.Jl = "exponential";
|
685 | var LOGARITHMIC = exports.Hp = "logarithmic";
|
686 |
|
687 | var FADEIN = exports.Y1 = "FadeIn";
|
688 | var FADEOUT = exports.h7 = "FadeOut";
|
689 |
|
690 | function sCurveFadeIn(start, duration) {
|
691 | var curve = (0, _fadeCurves.sCurve)(10000, 1);
|
692 | this.setValueCurveAtTime(curve, start, duration);
|
693 | }
|
694 |
|
695 | function sCurveFadeOut(start, duration) {
|
696 | var curve = (0, _fadeCurves.sCurve)(10000, -1);
|
697 | this.setValueCurveAtTime(curve, start, duration);
|
698 | }
|
699 |
|
700 | function linearFadeIn(start, duration) {
|
701 | this.linearRampToValueAtTime(0, start);
|
702 | this.linearRampToValueAtTime(1, start + duration);
|
703 | }
|
704 |
|
705 | function linearFadeOut(start, duration) {
|
706 | this.linearRampToValueAtTime(1, start);
|
707 | this.linearRampToValueAtTime(0, start + duration);
|
708 | }
|
709 |
|
710 | function exponentialFadeIn(start, duration) {
|
711 | this.exponentialRampToValueAtTime(0.01, start);
|
712 | this.exponentialRampToValueAtTime(1, start + duration);
|
713 | }
|
714 |
|
715 | function exponentialFadeOut(start, duration) {
|
716 | this.exponentialRampToValueAtTime(1, start);
|
717 | this.exponentialRampToValueAtTime(0.01, start + duration);
|
718 | }
|
719 |
|
720 | function logarithmicFadeIn(start, duration) {
|
721 | var curve = (0, _fadeCurves.logarithmic)(10000, 10, 1);
|
722 | this.setValueCurveAtTime(curve, start, duration);
|
723 | }
|
724 |
|
725 | function logarithmicFadeOut(start, duration) {
|
726 | var curve = (0, _fadeCurves.logarithmic)(10000, 10, -1);
|
727 | this.setValueCurveAtTime(curve, start, duration);
|
728 | }
|
729 |
|
730 | function createFadeIn(gain, shape, start, duration) {
|
731 | switch (shape) {
|
732 | case SCURVE:
|
733 | sCurveFadeIn.call(gain, start, duration);
|
734 | break;
|
735 | case LINEAR:
|
736 | linearFadeIn.call(gain, start, duration);
|
737 | break;
|
738 | case EXPONENTIAL:
|
739 | exponentialFadeIn.call(gain, start, duration);
|
740 | break;
|
741 | case LOGARITHMIC:
|
742 | logarithmicFadeIn.call(gain, start, duration);
|
743 | break;
|
744 | default:
|
745 | throw new Error("Unsupported Fade type");
|
746 | }
|
747 | }
|
748 |
|
749 | function createFadeOut(gain, shape, start, duration) {
|
750 | switch (shape) {
|
751 | case SCURVE:
|
752 | sCurveFadeOut.call(gain, start, duration);
|
753 | break;
|
754 | case LINEAR:
|
755 | linearFadeOut.call(gain, start, duration);
|
756 | break;
|
757 | case EXPONENTIAL:
|
758 | exponentialFadeOut.call(gain, start, duration);
|
759 | break;
|
760 | case LOGARITHMIC:
|
761 | logarithmicFadeOut.call(gain, start, duration);
|
762 | break;
|
763 | default:
|
764 | throw new Error("Unsupported Fade type");
|
765 | }
|
766 | }
|
767 |
|
768 |
|
769 | }),
|
770 |
|
771 | 9144:
|
772 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
773 |
|
774 | var topLevel = typeof __webpack_require__.g !== 'undefined' ? __webpack_require__.g :
|
775 | typeof window !== 'undefined' ? window : {}
|
776 | var minDoc = __webpack_require__(5893);
|
777 |
|
778 | var doccy;
|
779 |
|
780 | if (typeof document !== 'undefined') {
|
781 | doccy = document;
|
782 | } else {
|
783 | doccy = topLevel['__GLOBAL_DOCUMENT_CACHE@4'];
|
784 |
|
785 | if (!doccy) {
|
786 | doccy = topLevel['__GLOBAL_DOCUMENT_CACHE@4'] = minDoc;
|
787 | }
|
788 | }
|
789 |
|
790 | module.exports = doccy;
|
791 |
|
792 |
|
793 | }),
|
794 |
|
795 | 8070:
|
796 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
797 |
|
798 | "use strict";
|
799 |
|
800 |
|
801 |
|
802 |
|
803 | var root = typeof window !== 'undefined' ?
|
804 | window : typeof __webpack_require__.g !== 'undefined' ?
|
805 | __webpack_require__.g : {};
|
806 |
|
807 | module.exports = Individual;
|
808 |
|
809 | function Individual(key, value) {
|
810 | if (key in root) {
|
811 | return root[key];
|
812 | }
|
813 |
|
814 | root[key] = value;
|
815 |
|
816 | return value;
|
817 | }
|
818 |
|
819 |
|
820 | }),
|
821 |
|
822 | 4167:
|
823 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
824 |
|
825 | "use strict";
|
826 |
|
827 |
|
828 | var Individual = __webpack_require__(8070);
|
829 |
|
830 | module.exports = OneVersion;
|
831 |
|
832 | function OneVersion(moduleName, version, defaultValue) {
|
833 | var key = '__INDIVIDUAL_ONE_VERSION_' + moduleName;
|
834 | var enforceKey = key + '_ENFORCE_SINGLETON';
|
835 |
|
836 | var versionValue = Individual(enforceKey, version);
|
837 |
|
838 | if (versionValue !== version) {
|
839 | throw new Error('Can only have one copy of ' +
|
840 | moduleName + '.\n' +
|
841 | 'You already have version ' + versionValue +
|
842 | ' installed.\n' +
|
843 | 'This means you cannot install version ' + version);
|
844 | }
|
845 |
|
846 | return Individual(key, defaultValue);
|
847 | }
|
848 |
|
849 |
|
850 | }),
|
851 |
|
852 | 849:
|
853 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
854 |
|
855 | var WORKER_ENABLED = !!(__webpack_require__.g === __webpack_require__.g.window && __webpack_require__.g.URL && __webpack_require__.g.Blob && __webpack_require__.g.Worker);
|
856 |
|
857 | function InlineWorker(func, self) {
|
858 | var _this = this;
|
859 | var functionBody;
|
860 |
|
861 | self = self || {};
|
862 |
|
863 | if (WORKER_ENABLED) {
|
864 | functionBody = func.toString().trim().match(
|
865 | /^function\s*\w*\s*\([\w\s,]*\)\s*{([\w\W]*?)}$/
|
866 | )[1];
|
867 |
|
868 | return new __webpack_require__.g.Worker(__webpack_require__.g.URL.createObjectURL(
|
869 | new __webpack_require__.g.Blob([ functionBody ], { type: "text/javascript" })
|
870 | ));
|
871 | }
|
872 |
|
873 | function postMessage(data) {
|
874 | setTimeout(function() {
|
875 | _this.onmessage({ data: data });
|
876 | }, 0);
|
877 | }
|
878 |
|
879 | this.self = self;
|
880 | this.self.postMessage = postMessage;
|
881 |
|
882 | setTimeout(func.bind(self, self), 0);
|
883 | }
|
884 |
|
885 | InlineWorker.prototype.postMessage = function postMessage(data) {
|
886 | var _this = this;
|
887 |
|
888 | setTimeout(function() {
|
889 | _this.self.onmessage({ data: data });
|
890 | }, 0);
|
891 | };
|
892 |
|
893 | module.exports = InlineWorker;
|
894 |
|
895 |
|
896 | }),
|
897 |
|
898 | 6240:
|
899 | ((module) => {
|
900 |
|
901 | "use strict";
|
902 |
|
903 |
|
904 | module.exports = function isObject(x) {
|
905 | return typeof x === "object" && x !== null;
|
906 | };
|
907 |
|
908 |
|
909 | }),
|
910 |
|
911 | 1730:
|
912 | ((module) => {
|
913 |
|
914 |
|
915 |
|
916 |
|
917 |
|
918 |
|
919 |
|
920 |
|
921 |
|
922 |
|
923 |
|
924 | var MAX_SAFE_INTEGER = 9007199254740991;
|
925 |
|
926 |
|
927 | var argsTag = '[object Arguments]',
|
928 | funcTag = '[object Function]',
|
929 | genTag = '[object GeneratorFunction]';
|
930 |
|
931 |
|
932 | var reIsUint = /^(?:0|[1-9]\d*)$/;
|
933 |
|
934 |
|
935 |
|
936 |
|
937 |
|
938 |
|
939 |
|
940 |
|
941 |
|
942 |
|
943 |
|
944 | function apply(func, thisArg, args) {
|
945 | switch (args.length) {
|
946 | case 0: return func.call(thisArg);
|
947 | case 1: return func.call(thisArg, args[0]);
|
948 | case 2: return func.call(thisArg, args[0], args[1]);
|
949 | case 3: return func.call(thisArg, args[0], args[1], args[2]);
|
950 | }
|
951 | return func.apply(thisArg, args);
|
952 | }
|
953 |
|
954 |
|
955 |
|
956 |
|
957 |
|
958 |
|
959 |
|
960 |
|
961 |
|
962 |
|
963 | function baseTimes(n, iteratee) {
|
964 | var index = -1,
|
965 | result = Array(n);
|
966 |
|
967 | while (++index < n) {
|
968 | result[index] = iteratee(index);
|
969 | }
|
970 | return result;
|
971 | }
|
972 |
|
973 |
|
974 |
|
975 |
|
976 |
|
977 |
|
978 |
|
979 |
|
980 |
|
981 | function overArg(func, transform) {
|
982 | return function(arg) {
|
983 | return func(transform(arg));
|
984 | };
|
985 | }
|
986 |
|
987 |
|
988 | var objectProto = Object.prototype;
|
989 |
|
990 |
|
991 | var hasOwnProperty = objectProto.hasOwnProperty;
|
992 |
|
993 |
|
994 |
|
995 |
|
996 |
|
997 |
|
998 | var objectToString = objectProto.toString;
|
999 |
|
1000 |
|
1001 | var propertyIsEnumerable = objectProto.propertyIsEnumerable;
|
1002 |
|
1003 |
|
1004 | var nativeKeys = overArg(Object.keys, Object),
|
1005 | nativeMax = Math.max;
|
1006 |
|
1007 |
|
1008 | var nonEnumShadows = !propertyIsEnumerable.call({ 'valueOf': 1 }, 'valueOf');
|
1009 |
|
1010 |
|
1011 |
|
1012 |
|
1013 |
|
1014 |
|
1015 |
|
1016 |
|
1017 |
|
1018 | function arrayLikeKeys(value, inherited) {
|
1019 |
|
1020 |
|
1021 | var result = (isArray(value) || isArguments(value))
|
1022 | ? baseTimes(value.length, String)
|
1023 | : [];
|
1024 |
|
1025 | var length = result.length,
|
1026 | skipIndexes = !!length;
|
1027 |
|
1028 | for (var key in value) {
|
1029 | if ((inherited || hasOwnProperty.call(value, key)) &&
|
1030 | !(skipIndexes && (key == 'length' || isIndex(key, length)))) {
|
1031 | result.push(key);
|
1032 | }
|
1033 | }
|
1034 | return result;
|
1035 | }
|
1036 |
|
1037 |
|
1038 |
|
1039 |
|
1040 |
|
1041 |
|
1042 |
|
1043 |
|
1044 |
|
1045 |
|
1046 |
|
1047 | function assignValue(object, key, value) {
|
1048 | var objValue = object[key];
|
1049 | if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
|
1050 | (value === undefined && !(key in object))) {
|
1051 | object[key] = value;
|
1052 | }
|
1053 | }
|
1054 |
|
1055 |
|
1056 |
|
1057 |
|
1058 |
|
1059 |
|
1060 |
|
1061 |
|
1062 | function baseKeys(object) {
|
1063 | if (!isPrototype(object)) {
|
1064 | return nativeKeys(object);
|
1065 | }
|
1066 | var result = [];
|
1067 | for (var key in Object(object)) {
|
1068 | if (hasOwnProperty.call(object, key) && key != 'constructor') {
|
1069 | result.push(key);
|
1070 | }
|
1071 | }
|
1072 | return result;
|
1073 | }
|
1074 |
|
1075 |
|
1076 |
|
1077 |
|
1078 |
|
1079 |
|
1080 |
|
1081 |
|
1082 |
|
1083 | function baseRest(func, start) {
|
1084 | start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
|
1085 | return function() {
|
1086 | var args = arguments,
|
1087 | index = -1,
|
1088 | length = nativeMax(args.length - start, 0),
|
1089 | array = Array(length);
|
1090 |
|
1091 | while (++index < length) {
|
1092 | array[index] = args[start + index];
|
1093 | }
|
1094 | index = -1;
|
1095 | var otherArgs = Array(start + 1);
|
1096 | while (++index < start) {
|
1097 | otherArgs[index] = args[index];
|
1098 | }
|
1099 | otherArgs[start] = array;
|
1100 | return apply(func, this, otherArgs);
|
1101 | };
|
1102 | }
|
1103 |
|
1104 |
|
1105 |
|
1106 |
|
1107 |
|
1108 |
|
1109 |
|
1110 |
|
1111 |
|
1112 |
|
1113 |
|
1114 | function copyObject(source, props, object, customizer) {
|
1115 | object || (object = {});
|
1116 |
|
1117 | var index = -1,
|
1118 | length = props.length;
|
1119 |
|
1120 | while (++index < length) {
|
1121 | var key = props[index];
|
1122 |
|
1123 | var newValue = customizer
|
1124 | ? customizer(object[key], source[key], key, object, source)
|
1125 | : undefined;
|
1126 |
|
1127 | assignValue(object, key, newValue === undefined ? source[key] : newValue);
|
1128 | }
|
1129 | return object;
|
1130 | }
|
1131 |
|
1132 |
|
1133 |
|
1134 |
|
1135 |
|
1136 |
|
1137 |
|
1138 |
|
1139 | function createAssigner(assigner) {
|
1140 | return baseRest(function(object, sources) {
|
1141 | var index = -1,
|
1142 | length = sources.length,
|
1143 | customizer = length > 1 ? sources[length - 1] : undefined,
|
1144 | guard = length > 2 ? sources[2] : undefined;
|
1145 |
|
1146 | customizer = (assigner.length > 3 && typeof customizer == 'function')
|
1147 | ? (length--, customizer)
|
1148 | : undefined;
|
1149 |
|
1150 | if (guard && isIterateeCall(sources[0], sources[1], guard)) {
|
1151 | customizer = length < 3 ? undefined : customizer;
|
1152 | length = 1;
|
1153 | }
|
1154 | object = Object(object);
|
1155 | while (++index < length) {
|
1156 | var source = sources[index];
|
1157 | if (source) {
|
1158 | assigner(object, source, index, customizer);
|
1159 | }
|
1160 | }
|
1161 | return object;
|
1162 | });
|
1163 | }
|
1164 |
|
1165 |
|
1166 |
|
1167 |
|
1168 |
|
1169 |
|
1170 |
|
1171 |
|
1172 |
|
1173 | function isIndex(value, length) {
|
1174 | length = length == null ? MAX_SAFE_INTEGER : length;
|
1175 | return !!length &&
|
1176 | (typeof value == 'number' || reIsUint.test(value)) &&
|
1177 | (value > -1 && value % 1 == 0 && value < length);
|
1178 | }
|
1179 |
|
1180 |
|
1181 |
|
1182 |
|
1183 |
|
1184 |
|
1185 |
|
1186 |
|
1187 |
|
1188 |
|
1189 |
|
1190 | function isIterateeCall(value, index, object) {
|
1191 | if (!isObject(object)) {
|
1192 | return false;
|
1193 | }
|
1194 | var type = typeof index;
|
1195 | if (type == 'number'
|
1196 | ? (isArrayLike(object) && isIndex(index, object.length))
|
1197 | : (type == 'string' && index in object)
|
1198 | ) {
|
1199 | return eq(object[index], value);
|
1200 | }
|
1201 | return false;
|
1202 | }
|
1203 |
|
1204 |
|
1205 |
|
1206 |
|
1207 |
|
1208 |
|
1209 |
|
1210 |
|
1211 | function isPrototype(value) {
|
1212 | var Ctor = value && value.constructor,
|
1213 | proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
|
1214 |
|
1215 | return value === proto;
|
1216 | }
|
1217 |
|
1218 |
|
1219 |
|
1220 |
|
1221 |
|
1222 |
|
1223 |
|
1224 |
|
1225 |
|
1226 |
|
1227 |
|
1228 |
|
1229 |
|
1230 |
|
1231 |
|
1232 |
|
1233 |
|
1234 |
|
1235 |
|
1236 |
|
1237 |
|
1238 |
|
1239 |
|
1240 |
|
1241 |
|
1242 |
|
1243 |
|
1244 |
|
1245 |
|
1246 |
|
1247 |
|
1248 |
|
1249 |
|
1250 | function eq(value, other) {
|
1251 | return value === other || (value !== value && other !== other);
|
1252 | }
|
1253 |
|
1254 |
|
1255 |
|
1256 |
|
1257 |
|
1258 |
|
1259 |
|
1260 |
|
1261 |
|
1262 |
|
1263 |
|
1264 |
|
1265 |
|
1266 |
|
1267 |
|
1268 |
|
1269 |
|
1270 |
|
1271 |
|
1272 | function isArguments(value) {
|
1273 |
|
1274 | return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') &&
|
1275 | (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag);
|
1276 | }
|
1277 |
|
1278 |
|
1279 |
|
1280 |
|
1281 |
|
1282 |
|
1283 |
|
1284 |
|
1285 |
|
1286 |
|
1287 |
|
1288 |
|
1289 |
|
1290 |
|
1291 |
|
1292 |
|
1293 |
|
1294 |
|
1295 |
|
1296 |
|
1297 |
|
1298 |
|
1299 |
|
1300 |
|
1301 | var isArray = Array.isArray;
|
1302 |
|
1303 |
|
1304 |
|
1305 |
|
1306 |
|
1307 |
|
1308 |
|
1309 |
|
1310 |
|
1311 |
|
1312 |
|
1313 |
|
1314 |
|
1315 |
|
1316 |
|
1317 |
|
1318 |
|
1319 |
|
1320 |
|
1321 |
|
1322 |
|
1323 |
|
1324 |
|
1325 |
|
1326 |
|
1327 |
|
1328 | function isArrayLike(value) {
|
1329 | return value != null && isLength(value.length) && !isFunction(value);
|
1330 | }
|
1331 |
|
1332 |
|
1333 |
|
1334 |
|
1335 |
|
1336 |
|
1337 |
|
1338 |
|
1339 |
|
1340 |
|
1341 |
|
1342 |
|
1343 |
|
1344 |
|
1345 |
|
1346 |
|
1347 |
|
1348 |
|
1349 |
|
1350 |
|
1351 |
|
1352 |
|
1353 |
|
1354 |
|
1355 |
|
1356 |
|
1357 | function isArrayLikeObject(value) {
|
1358 | return isObjectLike(value) && isArrayLike(value);
|
1359 | }
|
1360 |
|
1361 |
|
1362 |
|
1363 |
|
1364 |
|
1365 |
|
1366 |
|
1367 |
|
1368 |
|
1369 |
|
1370 |
|
1371 |
|
1372 |
|
1373 |
|
1374 |
|
1375 |
|
1376 |
|
1377 |
|
1378 | function isFunction(value) {
|
1379 |
|
1380 |
|
1381 | var tag = isObject(value) ? objectToString.call(value) : '';
|
1382 | return tag == funcTag || tag == genTag;
|
1383 | }
|
1384 |
|
1385 |
|
1386 |
|
1387 |
|
1388 |
|
1389 |
|
1390 |
|
1391 |
|
1392 |
|
1393 |
|
1394 |
|
1395 |
|
1396 |
|
1397 |
|
1398 |
|
1399 |
|
1400 |
|
1401 |
|
1402 |
|
1403 |
|
1404 |
|
1405 |
|
1406 |
|
1407 |
|
1408 |
|
1409 |
|
1410 |
|
1411 | function isLength(value) {
|
1412 | return typeof value == 'number' &&
|
1413 | value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
|
1414 | }
|
1415 |
|
1416 |
|
1417 |
|
1418 |
|
1419 |
|
1420 |
|
1421 |
|
1422 |
|
1423 |
|
1424 |
|
1425 |
|
1426 |
|
1427 |
|
1428 |
|
1429 |
|
1430 |
|
1431 |
|
1432 |
|
1433 |
|
1434 |
|
1435 |
|
1436 |
|
1437 |
|
1438 |
|
1439 |
|
1440 |
|
1441 | function isObject(value) {
|
1442 | var type = typeof value;
|
1443 | return !!value && (type == 'object' || type == 'function');
|
1444 | }
|
1445 |
|
1446 |
|
1447 |
|
1448 |
|
1449 |
|
1450 |
|
1451 |
|
1452 |
|
1453 |
|
1454 |
|
1455 |
|
1456 |
|
1457 |
|
1458 |
|
1459 |
|
1460 |
|
1461 |
|
1462 |
|
1463 |
|
1464 |
|
1465 |
|
1466 |
|
1467 |
|
1468 |
|
1469 |
|
1470 | function isObjectLike(value) {
|
1471 | return !!value && typeof value == 'object';
|
1472 | }
|
1473 |
|
1474 |
|
1475 |
|
1476 |
|
1477 |
|
1478 |
|
1479 |
|
1480 |
|
1481 |
|
1482 |
|
1483 |
|
1484 |
|
1485 |
|
1486 |
|
1487 |
|
1488 |
|
1489 |
|
1490 |
|
1491 |
|
1492 |
|
1493 |
|
1494 |
|
1495 |
|
1496 |
|
1497 |
|
1498 |
|
1499 |
|
1500 |
|
1501 |
|
1502 |
|
1503 |
|
1504 |
|
1505 |
|
1506 | var assign = createAssigner(function(object, source) {
|
1507 | if (nonEnumShadows || isPrototype(source) || isArrayLike(source)) {
|
1508 | copyObject(source, keys(source), object);
|
1509 | return;
|
1510 | }
|
1511 | for (var key in source) {
|
1512 | if (hasOwnProperty.call(source, key)) {
|
1513 | assignValue(object, key, source[key]);
|
1514 | }
|
1515 | }
|
1516 | });
|
1517 |
|
1518 |
|
1519 |
|
1520 |
|
1521 |
|
1522 |
|
1523 |
|
1524 |
|
1525 |
|
1526 |
|
1527 |
|
1528 |
|
1529 |
|
1530 |
|
1531 |
|
1532 |
|
1533 |
|
1534 |
|
1535 |
|
1536 |
|
1537 |
|
1538 |
|
1539 |
|
1540 |
|
1541 |
|
1542 |
|
1543 |
|
1544 |
|
1545 |
|
1546 | function keys(object) {
|
1547 | return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
|
1548 | }
|
1549 |
|
1550 | module.exports = assign;
|
1551 |
|
1552 |
|
1553 | }),
|
1554 |
|
1555 | 2098:
|
1556 | ((module, exports, __webpack_require__) => {
|
1557 |
|
1558 | module = __webpack_require__.nmd(module);
|
1559 |
|
1560 |
|
1561 |
|
1562 |
|
1563 |
|
1564 |
|
1565 |
|
1566 |
|
1567 |
|
1568 |
|
1569 | var LARGE_ARRAY_SIZE = 200;
|
1570 |
|
1571 |
|
1572 | var HASH_UNDEFINED = '__lodash_hash_undefined__';
|
1573 |
|
1574 |
|
1575 | var HOT_COUNT = 800,
|
1576 | HOT_SPAN = 16;
|
1577 |
|
1578 |
|
1579 | var MAX_SAFE_INTEGER = 9007199254740991;
|
1580 |
|
1581 |
|
1582 | var argsTag = '[object Arguments]',
|
1583 | arrayTag = '[object Array]',
|
1584 | asyncTag = '[object AsyncFunction]',
|
1585 | boolTag = '[object Boolean]',
|
1586 | dateTag = '[object Date]',
|
1587 | errorTag = '[object Error]',
|
1588 | funcTag = '[object Function]',
|
1589 | genTag = '[object GeneratorFunction]',
|
1590 | mapTag = '[object Map]',
|
1591 | numberTag = '[object Number]',
|
1592 | nullTag = '[object Null]',
|
1593 | objectTag = '[object Object]',
|
1594 | proxyTag = '[object Proxy]',
|
1595 | regexpTag = '[object RegExp]',
|
1596 | setTag = '[object Set]',
|
1597 | stringTag = '[object String]',
|
1598 | undefinedTag = '[object Undefined]',
|
1599 | weakMapTag = '[object WeakMap]';
|
1600 |
|
1601 | var arrayBufferTag = '[object ArrayBuffer]',
|
1602 | dataViewTag = '[object DataView]',
|
1603 | float32Tag = '[object Float32Array]',
|
1604 | float64Tag = '[object Float64Array]',
|
1605 | int8Tag = '[object Int8Array]',
|
1606 | int16Tag = '[object Int16Array]',
|
1607 | int32Tag = '[object Int32Array]',
|
1608 | uint8Tag = '[object Uint8Array]',
|
1609 | uint8ClampedTag = '[object Uint8ClampedArray]',
|
1610 | uint16Tag = '[object Uint16Array]',
|
1611 | uint32Tag = '[object Uint32Array]';
|
1612 |
|
1613 |
|
1614 |
|
1615 |
|
1616 |
|
1617 | var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
|
1618 |
|
1619 |
|
1620 | var reIsHostCtor = /^\[object .+?Constructor\]$/;
|
1621 |
|
1622 |
|
1623 | var reIsUint = /^(?:0|[1-9]\d*)$/;
|
1624 |
|
1625 |
|
1626 | var typedArrayTags = {};
|
1627 | typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
|
1628 | typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
|
1629 | typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
|
1630 | typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
|
1631 | typedArrayTags[uint32Tag] = true;
|
1632 | typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
|
1633 | typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
|
1634 | typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
|
1635 | typedArrayTags[errorTag] = typedArrayTags[funcTag] =
|
1636 | typedArrayTags[mapTag] = typedArrayTags[numberTag] =
|
1637 | typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
|
1638 | typedArrayTags[setTag] = typedArrayTags[stringTag] =
|
1639 | typedArrayTags[weakMapTag] = false;
|
1640 |
|
1641 |
|
1642 | var freeGlobal = typeof __webpack_require__.g == 'object' && __webpack_require__.g && __webpack_require__.g.Object === Object && __webpack_require__.g;
|
1643 |
|
1644 |
|
1645 | var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
|
1646 |
|
1647 |
|
1648 | var root = freeGlobal || freeSelf || Function('return this')();
|
1649 |
|
1650 |
|
1651 | var freeExports = true && exports && !exports.nodeType && exports;
|
1652 |
|
1653 |
|
1654 | var freeModule = freeExports && "object" == 'object' && module && !module.nodeType && module;
|
1655 |
|
1656 |
|
1657 | var moduleExports = freeModule && freeModule.exports === freeExports;
|
1658 |
|
1659 |
|
1660 | var freeProcess = moduleExports && freeGlobal.process;
|
1661 |
|
1662 |
|
1663 | var nodeUtil = (function() {
|
1664 | try {
|
1665 |
|
1666 | var types = freeModule && freeModule.require && freeModule.require('util').types;
|
1667 |
|
1668 | if (types) {
|
1669 | return types;
|
1670 | }
|
1671 |
|
1672 |
|
1673 | return freeProcess && freeProcess.binding && freeProcess.binding('util');
|
1674 | } catch (e) {}
|
1675 | }());
|
1676 |
|
1677 |
|
1678 | var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
|
1679 |
|
1680 |
|
1681 |
|
1682 |
|
1683 |
|
1684 |
|
1685 |
|
1686 |
|
1687 |
|
1688 |
|
1689 |
|
1690 | function apply(func, thisArg, args) {
|
1691 | switch (args.length) {
|
1692 | case 0: return func.call(thisArg);
|
1693 | case 1: return func.call(thisArg, args[0]);
|
1694 | case 2: return func.call(thisArg, args[0], args[1]);
|
1695 | case 3: return func.call(thisArg, args[0], args[1], args[2]);
|
1696 | }
|
1697 | return func.apply(thisArg, args);
|
1698 | }
|
1699 |
|
1700 |
|
1701 |
|
1702 |
|
1703 |
|
1704 |
|
1705 |
|
1706 |
|
1707 |
|
1708 |
|
1709 | function baseTimes(n, iteratee) {
|
1710 | var index = -1,
|
1711 | result = Array(n);
|
1712 |
|
1713 | while (++index < n) {
|
1714 | result[index] = iteratee(index);
|
1715 | }
|
1716 | return result;
|
1717 | }
|
1718 |
|
1719 |
|
1720 |
|
1721 |
|
1722 |
|
1723 |
|
1724 |
|
1725 |
|
1726 | function baseUnary(func) {
|
1727 | return function(value) {
|
1728 | return func(value);
|
1729 | };
|
1730 | }
|
1731 |
|
1732 |
|
1733 |
|
1734 |
|
1735 |
|
1736 |
|
1737 |
|
1738 |
|
1739 |
|
1740 | function getValue(object, key) {
|
1741 | return object == null ? undefined : object[key];
|
1742 | }
|
1743 |
|
1744 |
|
1745 |
|
1746 |
|
1747 |
|
1748 |
|
1749 |
|
1750 |
|
1751 |
|
1752 | function overArg(func, transform) {
|
1753 | return function(arg) {
|
1754 | return func(transform(arg));
|
1755 | };
|
1756 | }
|
1757 |
|
1758 |
|
1759 | var arrayProto = Array.prototype,
|
1760 | funcProto = Function.prototype,
|
1761 | objectProto = Object.prototype;
|
1762 |
|
1763 |
|
1764 | var coreJsData = root['__core-js_shared__'];
|
1765 |
|
1766 |
|
1767 | var funcToString = funcProto.toString;
|
1768 |
|
1769 |
|
1770 | var hasOwnProperty = objectProto.hasOwnProperty;
|
1771 |
|
1772 |
|
1773 | var maskSrcKey = (function() {
|
1774 | var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
|
1775 | return uid ? ('Symbol(src)_1.' + uid) : '';
|
1776 | }());
|
1777 |
|
1778 |
|
1779 |
|
1780 |
|
1781 |
|
1782 |
|
1783 | var nativeObjectToString = objectProto.toString;
|
1784 |
|
1785 |
|
1786 | var objectCtorString = funcToString.call(Object);
|
1787 |
|
1788 |
|
1789 | var reIsNative = RegExp('^' +
|
1790 | funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
|
1791 | .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
|
1792 | );
|
1793 |
|
1794 |
|
1795 | var Buffer = moduleExports ? root.Buffer : undefined,
|
1796 | Symbol = root.Symbol,
|
1797 | Uint8Array = root.Uint8Array,
|
1798 | allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined,
|
1799 | getPrototype = overArg(Object.getPrototypeOf, Object),
|
1800 | objectCreate = Object.create,
|
1801 | propertyIsEnumerable = objectProto.propertyIsEnumerable,
|
1802 | splice = arrayProto.splice,
|
1803 | symToStringTag = Symbol ? Symbol.toStringTag : undefined;
|
1804 |
|
1805 | var defineProperty = (function() {
|
1806 | try {
|
1807 | var func = getNative(Object, 'defineProperty');
|
1808 | func({}, '', {});
|
1809 | return func;
|
1810 | } catch (e) {}
|
1811 | }());
|
1812 |
|
1813 |
|
1814 | var nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
|
1815 | nativeMax = Math.max,
|
1816 | nativeNow = Date.now;
|
1817 |
|
1818 |
|
1819 | var Map = getNative(root, 'Map'),
|
1820 | nativeCreate = getNative(Object, 'create');
|
1821 |
|
1822 |
|
1823 |
|
1824 |
|
1825 |
|
1826 |
|
1827 |
|
1828 |
|
1829 |
|
1830 | var baseCreate = (function() {
|
1831 | function object() {}
|
1832 | return function(proto) {
|
1833 | if (!isObject(proto)) {
|
1834 | return {};
|
1835 | }
|
1836 | if (objectCreate) {
|
1837 | return objectCreate(proto);
|
1838 | }
|
1839 | object.prototype = proto;
|
1840 | var result = new object;
|
1841 | object.prototype = undefined;
|
1842 | return result;
|
1843 | };
|
1844 | }());
|
1845 |
|
1846 |
|
1847 |
|
1848 |
|
1849 |
|
1850 |
|
1851 |
|
1852 |
|
1853 | function Hash(entries) {
|
1854 | var index = -1,
|
1855 | length = entries == null ? 0 : entries.length;
|
1856 |
|
1857 | this.clear();
|
1858 | while (++index < length) {
|
1859 | var entry = entries[index];
|
1860 | this.set(entry[0], entry[1]);
|
1861 | }
|
1862 | }
|
1863 |
|
1864 |
|
1865 |
|
1866 |
|
1867 |
|
1868 |
|
1869 |
|
1870 |
|
1871 | function hashClear() {
|
1872 | this.__data__ = nativeCreate ? nativeCreate(null) : {};
|
1873 | this.size = 0;
|
1874 | }
|
1875 |
|
1876 |
|
1877 |
|
1878 |
|
1879 |
|
1880 |
|
1881 |
|
1882 |
|
1883 |
|
1884 |
|
1885 |
|
1886 | function hashDelete(key) {
|
1887 | var result = this.has(key) && delete this.__data__[key];
|
1888 | this.size -= result ? 1 : 0;
|
1889 | return result;
|
1890 | }
|
1891 |
|
1892 |
|
1893 |
|
1894 |
|
1895 |
|
1896 |
|
1897 |
|
1898 |
|
1899 |
|
1900 |
|
1901 | function hashGet(key) {
|
1902 | var data = this.__data__;
|
1903 | if (nativeCreate) {
|
1904 | var result = data[key];
|
1905 | return result === HASH_UNDEFINED ? undefined : result;
|
1906 | }
|
1907 | return hasOwnProperty.call(data, key) ? data[key] : undefined;
|
1908 | }
|
1909 |
|
1910 |
|
1911 |
|
1912 |
|
1913 |
|
1914 |
|
1915 |
|
1916 |
|
1917 |
|
1918 |
|
1919 | function hashHas(key) {
|
1920 | var data = this.__data__;
|
1921 | return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
|
1922 | }
|
1923 |
|
1924 |
|
1925 |
|
1926 |
|
1927 |
|
1928 |
|
1929 |
|
1930 |
|
1931 |
|
1932 |
|
1933 |
|
1934 | function hashSet(key, value) {
|
1935 | var data = this.__data__;
|
1936 | this.size += this.has(key) ? 0 : 1;
|
1937 | data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
|
1938 | return this;
|
1939 | }
|
1940 |
|
1941 |
|
1942 | Hash.prototype.clear = hashClear;
|
1943 | Hash.prototype['delete'] = hashDelete;
|
1944 | Hash.prototype.get = hashGet;
|
1945 | Hash.prototype.has = hashHas;
|
1946 | Hash.prototype.set = hashSet;
|
1947 |
|
1948 |
|
1949 |
|
1950 |
|
1951 |
|
1952 |
|
1953 |
|
1954 |
|
1955 | function ListCache(entries) {
|
1956 | var index = -1,
|
1957 | length = entries == null ? 0 : entries.length;
|
1958 |
|
1959 | this.clear();
|
1960 | while (++index < length) {
|
1961 | var entry = entries[index];
|
1962 | this.set(entry[0], entry[1]);
|
1963 | }
|
1964 | }
|
1965 |
|
1966 |
|
1967 |
|
1968 |
|
1969 |
|
1970 |
|
1971 |
|
1972 |
|
1973 | function listCacheClear() {
|
1974 | this.__data__ = [];
|
1975 | this.size = 0;
|
1976 | }
|
1977 |
|
1978 |
|
1979 |
|
1980 |
|
1981 |
|
1982 |
|
1983 |
|
1984 |
|
1985 |
|
1986 |
|
1987 | function listCacheDelete(key) {
|
1988 | var data = this.__data__,
|
1989 | index = assocIndexOf(data, key);
|
1990 |
|
1991 | if (index < 0) {
|
1992 | return false;
|
1993 | }
|
1994 | var lastIndex = data.length - 1;
|
1995 | if (index == lastIndex) {
|
1996 | data.pop();
|
1997 | } else {
|
1998 | splice.call(data, index, 1);
|
1999 | }
|
2000 | --this.size;
|
2001 | return true;
|
2002 | }
|
2003 |
|
2004 |
|
2005 |
|
2006 |
|
2007 |
|
2008 |
|
2009 |
|
2010 |
|
2011 |
|
2012 |
|
2013 | function listCacheGet(key) {
|
2014 | var data = this.__data__,
|
2015 | index = assocIndexOf(data, key);
|
2016 |
|
2017 | return index < 0 ? undefined : data[index][1];
|
2018 | }
|
2019 |
|
2020 |
|
2021 |
|
2022 |
|
2023 |
|
2024 |
|
2025 |
|
2026 |
|
2027 |
|
2028 |
|
2029 | function listCacheHas(key) {
|
2030 | return assocIndexOf(this.__data__, key) > -1;
|
2031 | }
|
2032 |
|
2033 |
|
2034 |
|
2035 |
|
2036 |
|
2037 |
|
2038 |
|
2039 |
|
2040 |
|
2041 |
|
2042 |
|
2043 | function listCacheSet(key, value) {
|
2044 | var data = this.__data__,
|
2045 | index = assocIndexOf(data, key);
|
2046 |
|
2047 | if (index < 0) {
|
2048 | ++this.size;
|
2049 | data.push([key, value]);
|
2050 | } else {
|
2051 | data[index][1] = value;
|
2052 | }
|
2053 | return this;
|
2054 | }
|
2055 |
|
2056 |
|
2057 | ListCache.prototype.clear = listCacheClear;
|
2058 | ListCache.prototype['delete'] = listCacheDelete;
|
2059 | ListCache.prototype.get = listCacheGet;
|
2060 | ListCache.prototype.has = listCacheHas;
|
2061 | ListCache.prototype.set = listCacheSet;
|
2062 |
|
2063 |
|
2064 |
|
2065 |
|
2066 |
|
2067 |
|
2068 |
|
2069 |
|
2070 | function MapCache(entries) {
|
2071 | var index = -1,
|
2072 | length = entries == null ? 0 : entries.length;
|
2073 |
|
2074 | this.clear();
|
2075 | while (++index < length) {
|
2076 | var entry = entries[index];
|
2077 | this.set(entry[0], entry[1]);
|
2078 | }
|
2079 | }
|
2080 |
|
2081 |
|
2082 |
|
2083 |
|
2084 |
|
2085 |
|
2086 |
|
2087 |
|
2088 | function mapCacheClear() {
|
2089 | this.size = 0;
|
2090 | this.__data__ = {
|
2091 | 'hash': new Hash,
|
2092 | 'map': new (Map || ListCache),
|
2093 | 'string': new Hash
|
2094 | };
|
2095 | }
|
2096 |
|
2097 |
|
2098 |
|
2099 |
|
2100 |
|
2101 |
|
2102 |
|
2103 |
|
2104 |
|
2105 |
|
2106 | function mapCacheDelete(key) {
|
2107 | var result = getMapData(this, key)['delete'](key);
|
2108 | this.size -= result ? 1 : 0;
|
2109 | return result;
|
2110 | }
|
2111 |
|
2112 |
|
2113 |
|
2114 |
|
2115 |
|
2116 |
|
2117 |
|
2118 |
|
2119 |
|
2120 |
|
2121 | function mapCacheGet(key) {
|
2122 | return getMapData(this, key).get(key);
|
2123 | }
|
2124 |
|
2125 |
|
2126 |
|
2127 |
|
2128 |
|
2129 |
|
2130 |
|
2131 |
|
2132 |
|
2133 |
|
2134 | function mapCacheHas(key) {
|
2135 | return getMapData(this, key).has(key);
|
2136 | }
|
2137 |
|
2138 |
|
2139 |
|
2140 |
|
2141 |
|
2142 |
|
2143 |
|
2144 |
|
2145 |
|
2146 |
|
2147 |
|
2148 | function mapCacheSet(key, value) {
|
2149 | var data = getMapData(this, key),
|
2150 | size = data.size;
|
2151 |
|
2152 | data.set(key, value);
|
2153 | this.size += data.size == size ? 0 : 1;
|
2154 | return this;
|
2155 | }
|
2156 |
|
2157 |
|
2158 | MapCache.prototype.clear = mapCacheClear;
|
2159 | MapCache.prototype['delete'] = mapCacheDelete;
|
2160 | MapCache.prototype.get = mapCacheGet;
|
2161 | MapCache.prototype.has = mapCacheHas;
|
2162 | MapCache.prototype.set = mapCacheSet;
|
2163 |
|
2164 |
|
2165 |
|
2166 |
|
2167 |
|
2168 |
|
2169 |
|
2170 |
|
2171 | function Stack(entries) {
|
2172 | var data = this.__data__ = new ListCache(entries);
|
2173 | this.size = data.size;
|
2174 | }
|
2175 |
|
2176 |
|
2177 |
|
2178 |
|
2179 |
|
2180 |
|
2181 |
|
2182 |
|
2183 | function stackClear() {
|
2184 | this.__data__ = new ListCache;
|
2185 | this.size = 0;
|
2186 | }
|
2187 |
|
2188 |
|
2189 |
|
2190 |
|
2191 |
|
2192 |
|
2193 |
|
2194 |
|
2195 |
|
2196 |
|
2197 | function stackDelete(key) {
|
2198 | var data = this.__data__,
|
2199 | result = data['delete'](key);
|
2200 |
|
2201 | this.size = data.size;
|
2202 | return result;
|
2203 | }
|
2204 |
|
2205 |
|
2206 |
|
2207 |
|
2208 |
|
2209 |
|
2210 |
|
2211 |
|
2212 |
|
2213 |
|
2214 | function stackGet(key) {
|
2215 | return this.__data__.get(key);
|
2216 | }
|
2217 |
|
2218 |
|
2219 |
|
2220 |
|
2221 |
|
2222 |
|
2223 |
|
2224 |
|
2225 |
|
2226 |
|
2227 | function stackHas(key) {
|
2228 | return this.__data__.has(key);
|
2229 | }
|
2230 |
|
2231 |
|
2232 |
|
2233 |
|
2234 |
|
2235 |
|
2236 |
|
2237 |
|
2238 |
|
2239 |
|
2240 |
|
2241 | function stackSet(key, value) {
|
2242 | var data = this.__data__;
|
2243 | if (data instanceof ListCache) {
|
2244 | var pairs = data.__data__;
|
2245 | if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
|
2246 | pairs.push([key, value]);
|
2247 | this.size = ++data.size;
|
2248 | return this;
|
2249 | }
|
2250 | data = this.__data__ = new MapCache(pairs);
|
2251 | }
|
2252 | data.set(key, value);
|
2253 | this.size = data.size;
|
2254 | return this;
|
2255 | }
|
2256 |
|
2257 |
|
2258 | Stack.prototype.clear = stackClear;
|
2259 | Stack.prototype['delete'] = stackDelete;
|
2260 | Stack.prototype.get = stackGet;
|
2261 | Stack.prototype.has = stackHas;
|
2262 | Stack.prototype.set = stackSet;
|
2263 |
|
2264 |
|
2265 |
|
2266 |
|
2267 |
|
2268 |
|
2269 |
|
2270 |
|
2271 |
|
2272 | function arrayLikeKeys(value, inherited) {
|
2273 | var isArr = isArray(value),
|
2274 | isArg = !isArr && isArguments(value),
|
2275 | isBuff = !isArr && !isArg && isBuffer(value),
|
2276 | isType = !isArr && !isArg && !isBuff && isTypedArray(value),
|
2277 | skipIndexes = isArr || isArg || isBuff || isType,
|
2278 | result = skipIndexes ? baseTimes(value.length, String) : [],
|
2279 | length = result.length;
|
2280 |
|
2281 | for (var key in value) {
|
2282 | if ((inherited || hasOwnProperty.call(value, key)) &&
|
2283 | !(skipIndexes && (
|
2284 |
|
2285 | key == 'length' ||
|
2286 |
|
2287 | (isBuff && (key == 'offset' || key == 'parent')) ||
|
2288 |
|
2289 | (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
|
2290 |
|
2291 | isIndex(key, length)
|
2292 | ))) {
|
2293 | result.push(key);
|
2294 | }
|
2295 | }
|
2296 | return result;
|
2297 | }
|
2298 |
|
2299 |
|
2300 |
|
2301 |
|
2302 |
|
2303 |
|
2304 |
|
2305 |
|
2306 |
|
2307 |
|
2308 | function assignMergeValue(object, key, value) {
|
2309 | if ((value !== undefined && !eq(object[key], value)) ||
|
2310 | (value === undefined && !(key in object))) {
|
2311 | baseAssignValue(object, key, value);
|
2312 | }
|
2313 | }
|
2314 |
|
2315 |
|
2316 |
|
2317 |
|
2318 |
|
2319 |
|
2320 |
|
2321 |
|
2322 |
|
2323 |
|
2324 |
|
2325 | function assignValue(object, key, value) {
|
2326 | var objValue = object[key];
|
2327 | if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
|
2328 | (value === undefined && !(key in object))) {
|
2329 | baseAssignValue(object, key, value);
|
2330 | }
|
2331 | }
|
2332 |
|
2333 |
|
2334 |
|
2335 |
|
2336 |
|
2337 |
|
2338 |
|
2339 |
|
2340 |
|
2341 | function assocIndexOf(array, key) {
|
2342 | var length = array.length;
|
2343 | while (length--) {
|
2344 | if (eq(array[length][0], key)) {
|
2345 | return length;
|
2346 | }
|
2347 | }
|
2348 | return -1;
|
2349 | }
|
2350 |
|
2351 |
|
2352 |
|
2353 |
|
2354 |
|
2355 |
|
2356 |
|
2357 |
|
2358 |
|
2359 |
|
2360 | function baseAssignValue(object, key, value) {
|
2361 | if (key == '__proto__' && defineProperty) {
|
2362 | defineProperty(object, key, {
|
2363 | 'configurable': true,
|
2364 | 'enumerable': true,
|
2365 | 'value': value,
|
2366 | 'writable': true
|
2367 | });
|
2368 | } else {
|
2369 | object[key] = value;
|
2370 | }
|
2371 | }
|
2372 |
|
2373 |
|
2374 |
|
2375 |
|
2376 |
|
2377 |
|
2378 |
|
2379 |
|
2380 |
|
2381 |
|
2382 |
|
2383 |
|
2384 | var baseFor = createBaseFor();
|
2385 |
|
2386 |
|
2387 |
|
2388 |
|
2389 |
|
2390 |
|
2391 |
|
2392 |
|
2393 | function baseGetTag(value) {
|
2394 | if (value == null) {
|
2395 | return value === undefined ? undefinedTag : nullTag;
|
2396 | }
|
2397 | return (symToStringTag && symToStringTag in Object(value))
|
2398 | ? getRawTag(value)
|
2399 | : objectToString(value);
|
2400 | }
|
2401 |
|
2402 |
|
2403 |
|
2404 |
|
2405 |
|
2406 |
|
2407 |
|
2408 |
|
2409 | function baseIsArguments(value) {
|
2410 | return isObjectLike(value) && baseGetTag(value) == argsTag;
|
2411 | }
|
2412 |
|
2413 |
|
2414 |
|
2415 |
|
2416 |
|
2417 |
|
2418 |
|
2419 |
|
2420 |
|
2421 | function baseIsNative(value) {
|
2422 | if (!isObject(value) || isMasked(value)) {
|
2423 | return false;
|
2424 | }
|
2425 | var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
|
2426 | return pattern.test(toSource(value));
|
2427 | }
|
2428 |
|
2429 |
|
2430 |
|
2431 |
|
2432 |
|
2433 |
|
2434 |
|
2435 |
|
2436 | function baseIsTypedArray(value) {
|
2437 | return isObjectLike(value) &&
|
2438 | isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
|
2439 | }
|
2440 |
|
2441 |
|
2442 |
|
2443 |
|
2444 |
|
2445 |
|
2446 |
|
2447 |
|
2448 | function baseKeysIn(object) {
|
2449 | if (!isObject(object)) {
|
2450 | return nativeKeysIn(object);
|
2451 | }
|
2452 | var isProto = isPrototype(object),
|
2453 | result = [];
|
2454 |
|
2455 | for (var key in object) {
|
2456 | if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
|
2457 | result.push(key);
|
2458 | }
|
2459 | }
|
2460 | return result;
|
2461 | }
|
2462 |
|
2463 |
|
2464 |
|
2465 |
|
2466 |
|
2467 |
|
2468 |
|
2469 |
|
2470 |
|
2471 |
|
2472 |
|
2473 |
|
2474 | function baseMerge(object, source, srcIndex, customizer, stack) {
|
2475 | if (object === source) {
|
2476 | return;
|
2477 | }
|
2478 | baseFor(source, function(srcValue, key) {
|
2479 | stack || (stack = new Stack);
|
2480 | if (isObject(srcValue)) {
|
2481 | baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
|
2482 | }
|
2483 | else {
|
2484 | var newValue = customizer
|
2485 | ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack)
|
2486 | : undefined;
|
2487 |
|
2488 | if (newValue === undefined) {
|
2489 | newValue = srcValue;
|
2490 | }
|
2491 | assignMergeValue(object, key, newValue);
|
2492 | }
|
2493 | }, keysIn);
|
2494 | }
|
2495 |
|
2496 |
|
2497 |
|
2498 |
|
2499 |
|
2500 |
|
2501 |
|
2502 |
|
2503 |
|
2504 |
|
2505 |
|
2506 |
|
2507 |
|
2508 |
|
2509 |
|
2510 |
|
2511 | function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
|
2512 | var objValue = safeGet(object, key),
|
2513 | srcValue = safeGet(source, key),
|
2514 | stacked = stack.get(srcValue);
|
2515 |
|
2516 | if (stacked) {
|
2517 | assignMergeValue(object, key, stacked);
|
2518 | return;
|
2519 | }
|
2520 | var newValue = customizer
|
2521 | ? customizer(objValue, srcValue, (key + ''), object, source, stack)
|
2522 | : undefined;
|
2523 |
|
2524 | var isCommon = newValue === undefined;
|
2525 |
|
2526 | if (isCommon) {
|
2527 | var isArr = isArray(srcValue),
|
2528 | isBuff = !isArr && isBuffer(srcValue),
|
2529 | isTyped = !isArr && !isBuff && isTypedArray(srcValue);
|
2530 |
|
2531 | newValue = srcValue;
|
2532 | if (isArr || isBuff || isTyped) {
|
2533 | if (isArray(objValue)) {
|
2534 | newValue = objValue;
|
2535 | }
|
2536 | else if (isArrayLikeObject(objValue)) {
|
2537 | newValue = copyArray(objValue);
|
2538 | }
|
2539 | else if (isBuff) {
|
2540 | isCommon = false;
|
2541 | newValue = cloneBuffer(srcValue, true);
|
2542 | }
|
2543 | else if (isTyped) {
|
2544 | isCommon = false;
|
2545 | newValue = cloneTypedArray(srcValue, true);
|
2546 | }
|
2547 | else {
|
2548 | newValue = [];
|
2549 | }
|
2550 | }
|
2551 | else if (isPlainObject(srcValue) || isArguments(srcValue)) {
|
2552 | newValue = objValue;
|
2553 | if (isArguments(objValue)) {
|
2554 | newValue = toPlainObject(objValue);
|
2555 | }
|
2556 | else if (!isObject(objValue) || isFunction(objValue)) {
|
2557 | newValue = initCloneObject(srcValue);
|
2558 | }
|
2559 | }
|
2560 | else {
|
2561 | isCommon = false;
|
2562 | }
|
2563 | }
|
2564 | if (isCommon) {
|
2565 |
|
2566 | stack.set(srcValue, newValue);
|
2567 | mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
|
2568 | stack['delete'](srcValue);
|
2569 | }
|
2570 | assignMergeValue(object, key, newValue);
|
2571 | }
|
2572 |
|
2573 |
|
2574 |
|
2575 |
|
2576 |
|
2577 |
|
2578 |
|
2579 |
|
2580 |
|
2581 | function baseRest(func, start) {
|
2582 | return setToString(overRest(func, start, identity), func + '');
|
2583 | }
|
2584 |
|
2585 |
|
2586 |
|
2587 |
|
2588 |
|
2589 |
|
2590 |
|
2591 |
|
2592 |
|
2593 | var baseSetToString = !defineProperty ? identity : function(func, string) {
|
2594 | return defineProperty(func, 'toString', {
|
2595 | 'configurable': true,
|
2596 | 'enumerable': false,
|
2597 | 'value': constant(string),
|
2598 | 'writable': true
|
2599 | });
|
2600 | };
|
2601 |
|
2602 |
|
2603 |
|
2604 |
|
2605 |
|
2606 |
|
2607 |
|
2608 |
|
2609 |
|
2610 | function cloneBuffer(buffer, isDeep) {
|
2611 | if (isDeep) {
|
2612 | return buffer.slice();
|
2613 | }
|
2614 | var length = buffer.length,
|
2615 | result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
|
2616 |
|
2617 | buffer.copy(result);
|
2618 | return result;
|
2619 | }
|
2620 |
|
2621 |
|
2622 |
|
2623 |
|
2624 |
|
2625 |
|
2626 |
|
2627 |
|
2628 | function cloneArrayBuffer(arrayBuffer) {
|
2629 | var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
|
2630 | new Uint8Array(result).set(new Uint8Array(arrayBuffer));
|
2631 | return result;
|
2632 | }
|
2633 |
|
2634 |
|
2635 |
|
2636 |
|
2637 |
|
2638 |
|
2639 |
|
2640 |
|
2641 |
|
2642 | function cloneTypedArray(typedArray, isDeep) {
|
2643 | var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
|
2644 | return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
|
2645 | }
|
2646 |
|
2647 |
|
2648 |
|
2649 |
|
2650 |
|
2651 |
|
2652 |
|
2653 |
|
2654 |
|
2655 | function copyArray(source, array) {
|
2656 | var index = -1,
|
2657 | length = source.length;
|
2658 |
|
2659 | array || (array = Array(length));
|
2660 | while (++index < length) {
|
2661 | array[index] = source[index];
|
2662 | }
|
2663 | return array;
|
2664 | }
|
2665 |
|
2666 |
|
2667 |
|
2668 |
|
2669 |
|
2670 |
|
2671 |
|
2672 |
|
2673 |
|
2674 |
|
2675 |
|
2676 | function copyObject(source, props, object, customizer) {
|
2677 | var isNew = !object;
|
2678 | object || (object = {});
|
2679 |
|
2680 | var index = -1,
|
2681 | length = props.length;
|
2682 |
|
2683 | while (++index < length) {
|
2684 | var key = props[index];
|
2685 |
|
2686 | var newValue = customizer
|
2687 | ? customizer(object[key], source[key], key, object, source)
|
2688 | : undefined;
|
2689 |
|
2690 | if (newValue === undefined) {
|
2691 | newValue = source[key];
|
2692 | }
|
2693 | if (isNew) {
|
2694 | baseAssignValue(object, key, newValue);
|
2695 | } else {
|
2696 | assignValue(object, key, newValue);
|
2697 | }
|
2698 | }
|
2699 | return object;
|
2700 | }
|
2701 |
|
2702 |
|
2703 |
|
2704 |
|
2705 |
|
2706 |
|
2707 |
|
2708 |
|
2709 | function createAssigner(assigner) {
|
2710 | return baseRest(function(object, sources) {
|
2711 | var index = -1,
|
2712 | length = sources.length,
|
2713 | customizer = length > 1 ? sources[length - 1] : undefined,
|
2714 | guard = length > 2 ? sources[2] : undefined;
|
2715 |
|
2716 | customizer = (assigner.length > 3 && typeof customizer == 'function')
|
2717 | ? (length--, customizer)
|
2718 | : undefined;
|
2719 |
|
2720 | if (guard && isIterateeCall(sources[0], sources[1], guard)) {
|
2721 | customizer = length < 3 ? undefined : customizer;
|
2722 | length = 1;
|
2723 | }
|
2724 | object = Object(object);
|
2725 | while (++index < length) {
|
2726 | var source = sources[index];
|
2727 | if (source) {
|
2728 | assigner(object, source, index, customizer);
|
2729 | }
|
2730 | }
|
2731 | return object;
|
2732 | });
|
2733 | }
|
2734 |
|
2735 |
|
2736 |
|
2737 |
|
2738 |
|
2739 |
|
2740 |
|
2741 |
|
2742 | function createBaseFor(fromRight) {
|
2743 | return function(object, iteratee, keysFunc) {
|
2744 | var index = -1,
|
2745 | iterable = Object(object),
|
2746 | props = keysFunc(object),
|
2747 | length = props.length;
|
2748 |
|
2749 | while (length--) {
|
2750 | var key = props[fromRight ? length : ++index];
|
2751 | if (iteratee(iterable[key], key, iterable) === false) {
|
2752 | break;
|
2753 | }
|
2754 | }
|
2755 | return object;
|
2756 | };
|
2757 | }
|
2758 |
|
2759 |
|
2760 |
|
2761 |
|
2762 |
|
2763 |
|
2764 |
|
2765 |
|
2766 |
|
2767 |
|
2768 |
|
2769 |
|
2770 |
|
2771 |
|
2772 |
|
2773 | function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
|
2774 | if (isObject(objValue) && isObject(srcValue)) {
|
2775 |
|
2776 | stack.set(srcValue, objValue);
|
2777 | baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack);
|
2778 | stack['delete'](srcValue);
|
2779 | }
|
2780 | return objValue;
|
2781 | }
|
2782 |
|
2783 |
|
2784 |
|
2785 |
|
2786 |
|
2787 |
|
2788 |
|
2789 |
|
2790 |
|
2791 | function getMapData(map, key) {
|
2792 | var data = map.__data__;
|
2793 | return isKeyable(key)
|
2794 | ? data[typeof key == 'string' ? 'string' : 'hash']
|
2795 | : data.map;
|
2796 | }
|
2797 |
|
2798 |
|
2799 |
|
2800 |
|
2801 |
|
2802 |
|
2803 |
|
2804 |
|
2805 |
|
2806 | function getNative(object, key) {
|
2807 | var value = getValue(object, key);
|
2808 | return baseIsNative(value) ? value : undefined;
|
2809 | }
|
2810 |
|
2811 |
|
2812 |
|
2813 |
|
2814 |
|
2815 |
|
2816 |
|
2817 |
|
2818 | function getRawTag(value) {
|
2819 | var isOwn = hasOwnProperty.call(value, symToStringTag),
|
2820 | tag = value[symToStringTag];
|
2821 |
|
2822 | try {
|
2823 | value[symToStringTag] = undefined;
|
2824 | var unmasked = true;
|
2825 | } catch (e) {}
|
2826 |
|
2827 | var result = nativeObjectToString.call(value);
|
2828 | if (unmasked) {
|
2829 | if (isOwn) {
|
2830 | value[symToStringTag] = tag;
|
2831 | } else {
|
2832 | delete value[symToStringTag];
|
2833 | }
|
2834 | }
|
2835 | return result;
|
2836 | }
|
2837 |
|
2838 |
|
2839 |
|
2840 |
|
2841 |
|
2842 |
|
2843 |
|
2844 |
|
2845 | function initCloneObject(object) {
|
2846 | return (typeof object.constructor == 'function' && !isPrototype(object))
|
2847 | ? baseCreate(getPrototype(object))
|
2848 | : {};
|
2849 | }
|
2850 |
|
2851 |
|
2852 |
|
2853 |
|
2854 |
|
2855 |
|
2856 |
|
2857 |
|
2858 |
|
2859 | function isIndex(value, length) {
|
2860 | var type = typeof value;
|
2861 | length = length == null ? MAX_SAFE_INTEGER : length;
|
2862 |
|
2863 | return !!length &&
|
2864 | (type == 'number' ||
|
2865 | (type != 'symbol' && reIsUint.test(value))) &&
|
2866 | (value > -1 && value % 1 == 0 && value < length);
|
2867 | }
|
2868 |
|
2869 |
|
2870 |
|
2871 |
|
2872 |
|
2873 |
|
2874 |
|
2875 |
|
2876 |
|
2877 |
|
2878 |
|
2879 | function isIterateeCall(value, index, object) {
|
2880 | if (!isObject(object)) {
|
2881 | return false;
|
2882 | }
|
2883 | var type = typeof index;
|
2884 | if (type == 'number'
|
2885 | ? (isArrayLike(object) && isIndex(index, object.length))
|
2886 | : (type == 'string' && index in object)
|
2887 | ) {
|
2888 | return eq(object[index], value);
|
2889 | }
|
2890 | return false;
|
2891 | }
|
2892 |
|
2893 |
|
2894 |
|
2895 |
|
2896 |
|
2897 |
|
2898 |
|
2899 |
|
2900 | function isKeyable(value) {
|
2901 | var type = typeof value;
|
2902 | return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
|
2903 | ? (value !== '__proto__')
|
2904 | : (value === null);
|
2905 | }
|
2906 |
|
2907 |
|
2908 |
|
2909 |
|
2910 |
|
2911 |
|
2912 |
|
2913 |
|
2914 | function isMasked(func) {
|
2915 | return !!maskSrcKey && (maskSrcKey in func);
|
2916 | }
|
2917 |
|
2918 |
|
2919 |
|
2920 |
|
2921 |
|
2922 |
|
2923 |
|
2924 |
|
2925 | function isPrototype(value) {
|
2926 | var Ctor = value && value.constructor,
|
2927 | proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
|
2928 |
|
2929 | return value === proto;
|
2930 | }
|
2931 |
|
2932 |
|
2933 |
|
2934 |
|
2935 |
|
2936 |
|
2937 |
|
2938 |
|
2939 |
|
2940 |
|
2941 | function nativeKeysIn(object) {
|
2942 | var result = [];
|
2943 | if (object != null) {
|
2944 | for (var key in Object(object)) {
|
2945 | result.push(key);
|
2946 | }
|
2947 | }
|
2948 | return result;
|
2949 | }
|
2950 |
|
2951 |
|
2952 |
|
2953 |
|
2954 |
|
2955 |
|
2956 |
|
2957 |
|
2958 | function objectToString(value) {
|
2959 | return nativeObjectToString.call(value);
|
2960 | }
|
2961 |
|
2962 |
|
2963 |
|
2964 |
|
2965 |
|
2966 |
|
2967 |
|
2968 |
|
2969 |
|
2970 |
|
2971 | function overRest(func, start, transform) {
|
2972 | start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
|
2973 | return function() {
|
2974 | var args = arguments,
|
2975 | index = -1,
|
2976 | length = nativeMax(args.length - start, 0),
|
2977 | array = Array(length);
|
2978 |
|
2979 | while (++index < length) {
|
2980 | array[index] = args[start + index];
|
2981 | }
|
2982 | index = -1;
|
2983 | var otherArgs = Array(start + 1);
|
2984 | while (++index < start) {
|
2985 | otherArgs[index] = args[index];
|
2986 | }
|
2987 | otherArgs[start] = transform(array);
|
2988 | return apply(func, this, otherArgs);
|
2989 | };
|
2990 | }
|
2991 |
|
2992 |
|
2993 |
|
2994 |
|
2995 |
|
2996 |
|
2997 |
|
2998 |
|
2999 |
|
3000 | function safeGet(object, key) {
|
3001 | if (key === 'constructor' && typeof object[key] === 'function') {
|
3002 | return;
|
3003 | }
|
3004 |
|
3005 | if (key == '__proto__') {
|
3006 | return;
|
3007 | }
|
3008 |
|
3009 | return object[key];
|
3010 | }
|
3011 |
|
3012 |
|
3013 |
|
3014 |
|
3015 |
|
3016 |
|
3017 |
|
3018 |
|
3019 |
|
3020 | var setToString = shortOut(baseSetToString);
|
3021 |
|
3022 |
|
3023 |
|
3024 |
|
3025 |
|
3026 |
|
3027 |
|
3028 |
|
3029 |
|
3030 |
|
3031 | function shortOut(func) {
|
3032 | var count = 0,
|
3033 | lastCalled = 0;
|
3034 |
|
3035 | return function() {
|
3036 | var stamp = nativeNow(),
|
3037 | remaining = HOT_SPAN - (stamp - lastCalled);
|
3038 |
|
3039 | lastCalled = stamp;
|
3040 | if (remaining > 0) {
|
3041 | if (++count >= HOT_COUNT) {
|
3042 | return arguments[0];
|
3043 | }
|
3044 | } else {
|
3045 | count = 0;
|
3046 | }
|
3047 | return func.apply(undefined, arguments);
|
3048 | };
|
3049 | }
|
3050 |
|
3051 |
|
3052 |
|
3053 |
|
3054 |
|
3055 |
|
3056 |
|
3057 |
|
3058 | function toSource(func) {
|
3059 | if (func != null) {
|
3060 | try {
|
3061 | return funcToString.call(func);
|
3062 | } catch (e) {}
|
3063 | try {
|
3064 | return (func + '');
|
3065 | } catch (e) {}
|
3066 | }
|
3067 | return '';
|
3068 | }
|
3069 |
|
3070 |
|
3071 |
|
3072 |
|
3073 |
|
3074 |
|
3075 |
|
3076 |
|
3077 |
|
3078 |
|
3079 |
|
3080 |
|
3081 |
|
3082 |
|
3083 |
|
3084 |
|
3085 |
|
3086 |
|
3087 |
|
3088 |
|
3089 |
|
3090 |
|
3091 |
|
3092 |
|
3093 |
|
3094 |
|
3095 |
|
3096 |
|
3097 |
|
3098 |
|
3099 |
|
3100 |
|
3101 |
|
3102 | function eq(value, other) {
|
3103 | return value === other || (value !== value && other !== other);
|
3104 | }
|
3105 |
|
3106 |
|
3107 |
|
3108 |
|
3109 |
|
3110 |
|
3111 |
|
3112 |
|
3113 |
|
3114 |
|
3115 |
|
3116 |
|
3117 |
|
3118 |
|
3119 |
|
3120 |
|
3121 |
|
3122 |
|
3123 |
|
3124 | var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
|
3125 | return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
|
3126 | !propertyIsEnumerable.call(value, 'callee');
|
3127 | };
|
3128 |
|
3129 |
|
3130 |
|
3131 |
|
3132 |
|
3133 |
|
3134 |
|
3135 |
|
3136 |
|
3137 |
|
3138 |
|
3139 |
|
3140 |
|
3141 |
|
3142 |
|
3143 |
|
3144 |
|
3145 |
|
3146 |
|
3147 |
|
3148 |
|
3149 |
|
3150 |
|
3151 |
|
3152 | var isArray = Array.isArray;
|
3153 |
|
3154 |
|
3155 |
|
3156 |
|
3157 |
|
3158 |
|
3159 |
|
3160 |
|
3161 |
|
3162 |
|
3163 |
|
3164 |
|
3165 |
|
3166 |
|
3167 |
|
3168 |
|
3169 |
|
3170 |
|
3171 |
|
3172 |
|
3173 |
|
3174 |
|
3175 |
|
3176 |
|
3177 |
|
3178 |
|
3179 | function isArrayLike(value) {
|
3180 | return value != null && isLength(value.length) && !isFunction(value);
|
3181 | }
|
3182 |
|
3183 |
|
3184 |
|
3185 |
|
3186 |
|
3187 |
|
3188 |
|
3189 |
|
3190 |
|
3191 |
|
3192 |
|
3193 |
|
3194 |
|
3195 |
|
3196 |
|
3197 |
|
3198 |
|
3199 |
|
3200 |
|
3201 |
|
3202 |
|
3203 |
|
3204 |
|
3205 |
|
3206 |
|
3207 |
|
3208 | function isArrayLikeObject(value) {
|
3209 | return isObjectLike(value) && isArrayLike(value);
|
3210 | }
|
3211 |
|
3212 |
|
3213 |
|
3214 |
|
3215 |
|
3216 |
|
3217 |
|
3218 |
|
3219 |
|
3220 |
|
3221 |
|
3222 |
|
3223 |
|
3224 |
|
3225 |
|
3226 |
|
3227 |
|
3228 |
|
3229 | var isBuffer = nativeIsBuffer || stubFalse;
|
3230 |
|
3231 |
|
3232 |
|
3233 |
|
3234 |
|
3235 |
|
3236 |
|
3237 |
|
3238 |
|
3239 |
|
3240 |
|
3241 |
|
3242 |
|
3243 |
|
3244 |
|
3245 |
|
3246 |
|
3247 |
|
3248 | function isFunction(value) {
|
3249 | if (!isObject(value)) {
|
3250 | return false;
|
3251 | }
|
3252 |
|
3253 |
|
3254 | var tag = baseGetTag(value);
|
3255 | return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
|
3256 | }
|
3257 |
|
3258 |
|
3259 |
|
3260 |
|
3261 |
|
3262 |
|
3263 |
|
3264 |
|
3265 |
|
3266 |
|
3267 |
|
3268 |
|
3269 |
|
3270 |
|
3271 |
|
3272 |
|
3273 |
|
3274 |
|
3275 |
|
3276 |
|
3277 |
|
3278 |
|
3279 |
|
3280 |
|
3281 |
|
3282 |
|
3283 |
|
3284 | function isLength(value) {
|
3285 | return typeof value == 'number' &&
|
3286 | value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
|
3287 | }
|
3288 |
|
3289 |
|
3290 |
|
3291 |
|
3292 |
|
3293 |
|
3294 |
|
3295 |
|
3296 |
|
3297 |
|
3298 |
|
3299 |
|
3300 |
|
3301 |
|
3302 |
|
3303 |
|
3304 |
|
3305 |
|
3306 |
|
3307 |
|
3308 |
|
3309 |
|
3310 |
|
3311 |
|
3312 |
|
3313 |
|
3314 | function isObject(value) {
|
3315 | var type = typeof value;
|
3316 | return value != null && (type == 'object' || type == 'function');
|
3317 | }
|
3318 |
|
3319 |
|
3320 |
|
3321 |
|
3322 |
|
3323 |
|
3324 |
|
3325 |
|
3326 |
|
3327 |
|
3328 |
|
3329 |
|
3330 |
|
3331 |
|
3332 |
|
3333 |
|
3334 |
|
3335 |
|
3336 |
|
3337 |
|
3338 |
|
3339 |
|
3340 |
|
3341 |
|
3342 |
|
3343 | function isObjectLike(value) {
|
3344 | return value != null && typeof value == 'object';
|
3345 | }
|
3346 |
|
3347 |
|
3348 |
|
3349 |
|
3350 |
|
3351 |
|
3352 |
|
3353 |
|
3354 |
|
3355 |
|
3356 |
|
3357 |
|
3358 |
|
3359 |
|
3360 |
|
3361 |
|
3362 |
|
3363 |
|
3364 |
|
3365 |
|
3366 |
|
3367 |
|
3368 |
|
3369 |
|
3370 |
|
3371 |
|
3372 |
|
3373 |
|
3374 |
|
3375 | function isPlainObject(value) {
|
3376 | if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
|
3377 | return false;
|
3378 | }
|
3379 | var proto = getPrototype(value);
|
3380 | if (proto === null) {
|
3381 | return true;
|
3382 | }
|
3383 | var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
|
3384 | return typeof Ctor == 'function' && Ctor instanceof Ctor &&
|
3385 | funcToString.call(Ctor) == objectCtorString;
|
3386 | }
|
3387 |
|
3388 |
|
3389 |
|
3390 |
|
3391 |
|
3392 |
|
3393 |
|
3394 |
|
3395 |
|
3396 |
|
3397 |
|
3398 |
|
3399 |
|
3400 |
|
3401 |
|
3402 |
|
3403 |
|
3404 |
|
3405 | var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
|
3406 |
|
3407 |
|
3408 |
|
3409 |
|
3410 |
|
3411 |
|
3412 |
|
3413 |
|
3414 |
|
3415 |
|
3416 |
|
3417 |
|
3418 |
|
3419 |
|
3420 |
|
3421 |
|
3422 |
|
3423 |
|
3424 |
|
3425 |
|
3426 |
|
3427 |
|
3428 |
|
3429 |
|
3430 |
|
3431 | function toPlainObject(value) {
|
3432 | return copyObject(value, keysIn(value));
|
3433 | }
|
3434 |
|
3435 |
|
3436 |
|
3437 |
|
3438 |
|
3439 |
|
3440 |
|
3441 |
|
3442 |
|
3443 |
|
3444 |
|
3445 |
|
3446 |
|
3447 |
|
3448 |
|
3449 |
|
3450 |
|
3451 |
|
3452 |
|
3453 |
|
3454 | var defaultsDeep = baseRest(function(args) {
|
3455 | args.push(undefined, customDefaultsMerge);
|
3456 | return apply(mergeWith, undefined, args);
|
3457 | });
|
3458 |
|
3459 |
|
3460 |
|
3461 |
|
3462 |
|
3463 |
|
3464 |
|
3465 |
|
3466 |
|
3467 |
|
3468 |
|
3469 |
|
3470 |
|
3471 |
|
3472 |
|
3473 |
|
3474 |
|
3475 |
|
3476 |
|
3477 |
|
3478 |
|
3479 |
|
3480 |
|
3481 |
|
3482 | function keysIn(object) {
|
3483 | return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
|
3484 | }
|
3485 |
|
3486 |
|
3487 |
|
3488 |
|
3489 |
|
3490 |
|
3491 |
|
3492 |
|
3493 |
|
3494 |
|
3495 |
|
3496 |
|
3497 |
|
3498 |
|
3499 |
|
3500 |
|
3501 |
|
3502 |
|
3503 |
|
3504 |
|
3505 |
|
3506 |
|
3507 |
|
3508 |
|
3509 |
|
3510 |
|
3511 |
|
3512 |
|
3513 |
|
3514 |
|
3515 |
|
3516 |
|
3517 | var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
|
3518 | baseMerge(object, source, srcIndex, customizer);
|
3519 | });
|
3520 |
|
3521 |
|
3522 |
|
3523 |
|
3524 |
|
3525 |
|
3526 |
|
3527 |
|
3528 |
|
3529 |
|
3530 |
|
3531 |
|
3532 |
|
3533 |
|
3534 |
|
3535 |
|
3536 |
|
3537 |
|
3538 |
|
3539 |
|
3540 | function constant(value) {
|
3541 | return function() {
|
3542 | return value;
|
3543 | };
|
3544 | }
|
3545 |
|
3546 |
|
3547 |
|
3548 |
|
3549 |
|
3550 |
|
3551 |
|
3552 |
|
3553 |
|
3554 |
|
3555 |
|
3556 |
|
3557 |
|
3558 |
|
3559 |
|
3560 |
|
3561 |
|
3562 | function identity(value) {
|
3563 | return value;
|
3564 | }
|
3565 |
|
3566 |
|
3567 |
|
3568 |
|
3569 |
|
3570 |
|
3571 |
|
3572 |
|
3573 |
|
3574 |
|
3575 |
|
3576 |
|
3577 |
|
3578 |
|
3579 | function stubFalse() {
|
3580 | return false;
|
3581 | }
|
3582 |
|
3583 | module.exports = defaultsDeep;
|
3584 |
|
3585 |
|
3586 | }),
|
3587 |
|
3588 | 3520:
|
3589 | ((module) => {
|
3590 |
|
3591 |
|
3592 |
|
3593 |
|
3594 |
|
3595 |
|
3596 |
|
3597 |
|
3598 |
|
3599 |
|
3600 |
|
3601 | var MAX_SAFE_INTEGER = 9007199254740991;
|
3602 |
|
3603 |
|
3604 | var argsTag = '[object Arguments]',
|
3605 | funcTag = '[object Function]',
|
3606 | genTag = '[object GeneratorFunction]';
|
3607 |
|
3608 |
|
3609 | var reIsUint = /^(?:0|[1-9]\d*)$/;
|
3610 |
|
3611 |
|
3612 |
|
3613 |
|
3614 |
|
3615 |
|
3616 |
|
3617 |
|
3618 |
|
3619 |
|
3620 | function baseTimes(n, iteratee) {
|
3621 | var index = -1,
|
3622 | result = Array(n);
|
3623 |
|
3624 | while (++index < n) {
|
3625 | result[index] = iteratee(index);
|
3626 | }
|
3627 | return result;
|
3628 | }
|
3629 |
|
3630 |
|
3631 |
|
3632 |
|
3633 |
|
3634 |
|
3635 |
|
3636 |
|
3637 |
|
3638 | function overArg(func, transform) {
|
3639 | return function(arg) {
|
3640 | return func(transform(arg));
|
3641 | };
|
3642 | }
|
3643 |
|
3644 |
|
3645 | var objectProto = Object.prototype;
|
3646 |
|
3647 |
|
3648 | var hasOwnProperty = objectProto.hasOwnProperty;
|
3649 |
|
3650 |
|
3651 |
|
3652 |
|
3653 |
|
3654 |
|
3655 | var objectToString = objectProto.toString;
|
3656 |
|
3657 |
|
3658 | var propertyIsEnumerable = objectProto.propertyIsEnumerable;
|
3659 |
|
3660 |
|
3661 | var nativeKeys = overArg(Object.keys, Object);
|
3662 |
|
3663 |
|
3664 |
|
3665 |
|
3666 |
|
3667 |
|
3668 |
|
3669 |
|
3670 |
|
3671 | function arrayLikeKeys(value, inherited) {
|
3672 |
|
3673 |
|
3674 | var result = (isArray(value) || isArguments(value))
|
3675 | ? baseTimes(value.length, String)
|
3676 | : [];
|
3677 |
|
3678 | var length = result.length,
|
3679 | skipIndexes = !!length;
|
3680 |
|
3681 | for (var key in value) {
|
3682 | if ((inherited || hasOwnProperty.call(value, key)) &&
|
3683 | !(skipIndexes && (key == 'length' || isIndex(key, length)))) {
|
3684 | result.push(key);
|
3685 | }
|
3686 | }
|
3687 | return result;
|
3688 | }
|
3689 |
|
3690 |
|
3691 |
|
3692 |
|
3693 |
|
3694 |
|
3695 |
|
3696 |
|
3697 |
|
3698 |
|
3699 |
|
3700 |
|
3701 | var baseFor = createBaseFor();
|
3702 |
|
3703 |
|
3704 |
|
3705 |
|
3706 |
|
3707 |
|
3708 |
|
3709 |
|
3710 |
|
3711 | function baseForOwn(object, iteratee) {
|
3712 | return object && baseFor(object, iteratee, keys);
|
3713 | }
|
3714 |
|
3715 |
|
3716 |
|
3717 |
|
3718 |
|
3719 |
|
3720 |
|
3721 |
|
3722 | function baseKeys(object) {
|
3723 | if (!isPrototype(object)) {
|
3724 | return nativeKeys(object);
|
3725 | }
|
3726 | var result = [];
|
3727 | for (var key in Object(object)) {
|
3728 | if (hasOwnProperty.call(object, key) && key != 'constructor') {
|
3729 | result.push(key);
|
3730 | }
|
3731 | }
|
3732 | return result;
|
3733 | }
|
3734 |
|
3735 |
|
3736 |
|
3737 |
|
3738 |
|
3739 |
|
3740 |
|
3741 |
|
3742 | function createBaseFor(fromRight) {
|
3743 | return function(object, iteratee, keysFunc) {
|
3744 | var index = -1,
|
3745 | iterable = Object(object),
|
3746 | props = keysFunc(object),
|
3747 | length = props.length;
|
3748 |
|
3749 | while (length--) {
|
3750 | var key = props[fromRight ? length : ++index];
|
3751 | if (iteratee(iterable[key], key, iterable) === false) {
|
3752 | break;
|
3753 | }
|
3754 | }
|
3755 | return object;
|
3756 | };
|
3757 | }
|
3758 |
|
3759 |
|
3760 |
|
3761 |
|
3762 |
|
3763 |
|
3764 |
|
3765 |
|
3766 |
|
3767 | function isIndex(value, length) {
|
3768 | length = length == null ? MAX_SAFE_INTEGER : length;
|
3769 | return !!length &&
|
3770 | (typeof value == 'number' || reIsUint.test(value)) &&
|
3771 | (value > -1 && value % 1 == 0 && value < length);
|
3772 | }
|
3773 |
|
3774 |
|
3775 |
|
3776 |
|
3777 |
|
3778 |
|
3779 |
|
3780 |
|
3781 | function isPrototype(value) {
|
3782 | var Ctor = value && value.constructor,
|
3783 | proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
|
3784 |
|
3785 | return value === proto;
|
3786 | }
|
3787 |
|
3788 |
|
3789 |
|
3790 |
|
3791 |
|
3792 |
|
3793 |
|
3794 |
|
3795 |
|
3796 |
|
3797 |
|
3798 |
|
3799 |
|
3800 |
|
3801 |
|
3802 |
|
3803 |
|
3804 |
|
3805 |
|
3806 | function isArguments(value) {
|
3807 |
|
3808 | return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') &&
|
3809 | (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag);
|
3810 | }
|
3811 |
|
3812 |
|
3813 |
|
3814 |
|
3815 |
|
3816 |
|
3817 |
|
3818 |
|
3819 |
|
3820 |
|
3821 |
|
3822 |
|
3823 |
|
3824 |
|
3825 |
|
3826 |
|
3827 |
|
3828 |
|
3829 |
|
3830 |
|
3831 |
|
3832 |
|
3833 |
|
3834 |
|
3835 | var isArray = Array.isArray;
|
3836 |
|
3837 |
|
3838 |
|
3839 |
|
3840 |
|
3841 |
|
3842 |
|
3843 |
|
3844 |
|
3845 |
|
3846 |
|
3847 |
|
3848 |
|
3849 |
|
3850 |
|
3851 |
|
3852 |
|
3853 |
|
3854 |
|
3855 |
|
3856 |
|
3857 |
|
3858 |
|
3859 |
|
3860 |
|
3861 |
|
3862 | function isArrayLike(value) {
|
3863 | return value != null && isLength(value.length) && !isFunction(value);
|
3864 | }
|
3865 |
|
3866 |
|
3867 |
|
3868 |
|
3869 |
|
3870 |
|
3871 |
|
3872 |
|
3873 |
|
3874 |
|
3875 |
|
3876 |
|
3877 |
|
3878 |
|
3879 |
|
3880 |
|
3881 |
|
3882 |
|
3883 |
|
3884 |
|
3885 |
|
3886 |
|
3887 |
|
3888 |
|
3889 |
|
3890 |
|
3891 | function isArrayLikeObject(value) {
|
3892 | return isObjectLike(value) && isArrayLike(value);
|
3893 | }
|
3894 |
|
3895 |
|
3896 |
|
3897 |
|
3898 |
|
3899 |
|
3900 |
|
3901 |
|
3902 |
|
3903 |
|
3904 |
|
3905 |
|
3906 |
|
3907 |
|
3908 |
|
3909 |
|
3910 |
|
3911 |
|
3912 | function isFunction(value) {
|
3913 |
|
3914 |
|
3915 | var tag = isObject(value) ? objectToString.call(value) : '';
|
3916 | return tag == funcTag || tag == genTag;
|
3917 | }
|
3918 |
|
3919 |
|
3920 |
|
3921 |
|
3922 |
|
3923 |
|
3924 |
|
3925 |
|
3926 |
|
3927 |
|
3928 |
|
3929 |
|
3930 |
|
3931 |
|
3932 |
|
3933 |
|
3934 |
|
3935 |
|
3936 |
|
3937 |
|
3938 |
|
3939 |
|
3940 |
|
3941 |
|
3942 |
|
3943 |
|
3944 |
|
3945 | function isLength(value) {
|
3946 | return typeof value == 'number' &&
|
3947 | value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
|
3948 | }
|
3949 |
|
3950 |
|
3951 |
|
3952 |
|
3953 |
|
3954 |
|
3955 |
|
3956 |
|
3957 |
|
3958 |
|
3959 |
|
3960 |
|
3961 |
|
3962 |
|
3963 |
|
3964 |
|
3965 |
|
3966 |
|
3967 |
|
3968 |
|
3969 |
|
3970 |
|
3971 |
|
3972 |
|
3973 |
|
3974 |
|
3975 | function isObject(value) {
|
3976 | var type = typeof value;
|
3977 | return !!value && (type == 'object' || type == 'function');
|
3978 | }
|
3979 |
|
3980 |
|
3981 |
|
3982 |
|
3983 |
|
3984 |
|
3985 |
|
3986 |
|
3987 |
|
3988 |
|
3989 |
|
3990 |
|
3991 |
|
3992 |
|
3993 |
|
3994 |
|
3995 |
|
3996 |
|
3997 |
|
3998 |
|
3999 |
|
4000 |
|
4001 |
|
4002 |
|
4003 |
|
4004 | function isObjectLike(value) {
|
4005 | return !!value && typeof value == 'object';
|
4006 | }
|
4007 |
|
4008 |
|
4009 |
|
4010 |
|
4011 |
|
4012 |
|
4013 |
|
4014 |
|
4015 |
|
4016 |
|
4017 |
|
4018 |
|
4019 |
|
4020 |
|
4021 |
|
4022 |
|
4023 |
|
4024 |
|
4025 |
|
4026 |
|
4027 |
|
4028 |
|
4029 |
|
4030 |
|
4031 |
|
4032 |
|
4033 |
|
4034 |
|
4035 |
|
4036 | function forOwn(object, iteratee) {
|
4037 | return object && baseForOwn(object, typeof iteratee == 'function' ? iteratee : identity);
|
4038 | }
|
4039 |
|
4040 |
|
4041 |
|
4042 |
|
4043 |
|
4044 |
|
4045 |
|
4046 |
|
4047 |
|
4048 |
|
4049 |
|
4050 |
|
4051 |
|
4052 |
|
4053 |
|
4054 |
|
4055 |
|
4056 |
|
4057 |
|
4058 |
|
4059 |
|
4060 |
|
4061 |
|
4062 |
|
4063 |
|
4064 |
|
4065 |
|
4066 |
|
4067 |
|
4068 | function keys(object) {
|
4069 | return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
|
4070 | }
|
4071 |
|
4072 |
|
4073 |
|
4074 |
|
4075 |
|
4076 |
|
4077 |
|
4078 |
|
4079 |
|
4080 |
|
4081 |
|
4082 |
|
4083 |
|
4084 |
|
4085 |
|
4086 |
|
4087 |
|
4088 | function identity(value) {
|
4089 | return value;
|
4090 | }
|
4091 |
|
4092 | module.exports = forOwn;
|
4093 |
|
4094 |
|
4095 | }),
|
4096 |
|
4097 | 372:
|
4098 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
4099 |
|
4100 | "use strict";
|
4101 |
|
4102 |
|
4103 | var isPrototype = __webpack_require__(6060);
|
4104 |
|
4105 | module.exports = function (value) {
|
4106 | if (typeof value !== "function") return false;
|
4107 |
|
4108 | if (!hasOwnProperty.call(value, "length")) return false;
|
4109 |
|
4110 | try {
|
4111 | if (typeof value.length !== "number") return false;
|
4112 | if (typeof value.call !== "function") return false;
|
4113 | if (typeof value.apply !== "function") return false;
|
4114 | } catch (error) {
|
4115 | return false;
|
4116 | }
|
4117 |
|
4118 | return !isPrototype(value);
|
4119 | };
|
4120 |
|
4121 |
|
4122 | }),
|
4123 |
|
4124 | 3940:
|
4125 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
4126 |
|
4127 | "use strict";
|
4128 |
|
4129 |
|
4130 | var isValue = __webpack_require__(5618);
|
4131 |
|
4132 |
|
4133 | var possibleTypes = { "object": true, "function": true, "undefined": true };
|
4134 |
|
4135 | module.exports = function (value) {
|
4136 | if (!isValue(value)) return false;
|
4137 | return hasOwnProperty.call(possibleTypes, typeof value);
|
4138 | };
|
4139 |
|
4140 |
|
4141 | }),
|
4142 |
|
4143 | 7205:
|
4144 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
4145 |
|
4146 | "use strict";
|
4147 |
|
4148 |
|
4149 | var isFunction = __webpack_require__(372);
|
4150 |
|
4151 | var classRe = /^\s*class[\s{/}]/, functionToString = Function.prototype.toString;
|
4152 |
|
4153 | module.exports = function (value) {
|
4154 | if (!isFunction(value)) return false;
|
4155 | if (classRe.test(functionToString.call(value))) return false;
|
4156 | return true;
|
4157 | };
|
4158 |
|
4159 |
|
4160 | }),
|
4161 |
|
4162 | 6060:
|
4163 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
4164 |
|
4165 | "use strict";
|
4166 |
|
4167 |
|
4168 | var isObject = __webpack_require__(3940);
|
4169 |
|
4170 | module.exports = function (value) {
|
4171 | if (!isObject(value)) return false;
|
4172 | try {
|
4173 | if (!value.constructor) return false;
|
4174 | return value.constructor.prototype === value;
|
4175 | } catch (error) {
|
4176 | return false;
|
4177 | }
|
4178 | };
|
4179 |
|
4180 |
|
4181 | }),
|
4182 |
|
4183 | 5618:
|
4184 | ((module) => {
|
4185 |
|
4186 | "use strict";
|
4187 |
|
4188 |
|
4189 |
|
4190 | var _undefined = void 0;
|
4191 |
|
4192 | module.exports = function (value) { return value !== _undefined && value !== null; };
|
4193 |
|
4194 |
|
4195 | }),
|
4196 |
|
4197 | 4935:
|
4198 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
4199 |
|
4200 | var createElement = __webpack_require__(3513)
|
4201 |
|
4202 | module.exports = createElement
|
4203 |
|
4204 |
|
4205 | }),
|
4206 |
|
4207 | 7921:
|
4208 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
4209 |
|
4210 | var diff = __webpack_require__(3072)
|
4211 |
|
4212 | module.exports = diff
|
4213 |
|
4214 |
|
4215 | }),
|
4216 |
|
4217 | 347:
|
4218 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
4219 |
|
4220 | var h = __webpack_require__(8744)
|
4221 |
|
4222 | module.exports = h
|
4223 |
|
4224 |
|
4225 | }),
|
4226 |
|
4227 | 9720:
|
4228 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
4229 |
|
4230 | var patch = __webpack_require__(6943)
|
4231 |
|
4232 | module.exports = patch
|
4233 |
|
4234 |
|
4235 | }),
|
4236 |
|
4237 | 6672:
|
4238 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
4239 |
|
4240 | var isObject = __webpack_require__(6240)
|
4241 | var isHook = __webpack_require__(7265)
|
4242 |
|
4243 | module.exports = applyProperties
|
4244 |
|
4245 | function applyProperties(node, props, previous) {
|
4246 | for (var propName in props) {
|
4247 | var propValue = props[propName]
|
4248 |
|
4249 | if (propValue === undefined) {
|
4250 | removeProperty(node, propName, propValue, previous);
|
4251 | } else if (isHook(propValue)) {
|
4252 | removeProperty(node, propName, propValue, previous)
|
4253 | if (propValue.hook) {
|
4254 | propValue.hook(node,
|
4255 | propName,
|
4256 | previous ? previous[propName] : undefined)
|
4257 | }
|
4258 | } else {
|
4259 | if (isObject(propValue)) {
|
4260 | patchObject(node, props, previous, propName, propValue);
|
4261 | } else {
|
4262 | node[propName] = propValue
|
4263 | }
|
4264 | }
|
4265 | }
|
4266 | }
|
4267 |
|
4268 | function removeProperty(node, propName, propValue, previous) {
|
4269 | if (previous) {
|
4270 | var previousValue = previous[propName]
|
4271 |
|
4272 | if (!isHook(previousValue)) {
|
4273 | if (propName === "attributes") {
|
4274 | for (var attrName in previousValue) {
|
4275 | node.removeAttribute(attrName)
|
4276 | }
|
4277 | } else if (propName === "style") {
|
4278 | for (var i in previousValue) {
|
4279 | node.style[i] = ""
|
4280 | }
|
4281 | } else if (typeof previousValue === "string") {
|
4282 | node[propName] = ""
|
4283 | } else {
|
4284 | node[propName] = null
|
4285 | }
|
4286 | } else if (previousValue.unhook) {
|
4287 | previousValue.unhook(node, propName, propValue)
|
4288 | }
|
4289 | }
|
4290 | }
|
4291 |
|
4292 | function patchObject(node, props, previous, propName, propValue) {
|
4293 | var previousValue = previous ? previous[propName] : undefined
|
4294 |
|
4295 |
|
4296 | if (propName === "attributes") {
|
4297 | for (var attrName in propValue) {
|
4298 | var attrValue = propValue[attrName]
|
4299 |
|
4300 | if (attrValue === undefined) {
|
4301 | node.removeAttribute(attrName)
|
4302 | } else {
|
4303 | node.setAttribute(attrName, attrValue)
|
4304 | }
|
4305 | }
|
4306 |
|
4307 | return
|
4308 | }
|
4309 |
|
4310 | if(previousValue && isObject(previousValue) &&
|
4311 | getPrototype(previousValue) !== getPrototype(propValue)) {
|
4312 | node[propName] = propValue
|
4313 | return
|
4314 | }
|
4315 |
|
4316 | if (!isObject(node[propName])) {
|
4317 | node[propName] = {}
|
4318 | }
|
4319 |
|
4320 | var replacer = propName === "style" ? "" : undefined
|
4321 |
|
4322 | for (var k in propValue) {
|
4323 | var value = propValue[k]
|
4324 | node[propName][k] = (value === undefined) ? replacer : value
|
4325 | }
|
4326 | }
|
4327 |
|
4328 | function getPrototype(value) {
|
4329 | if (Object.getPrototypeOf) {
|
4330 | return Object.getPrototypeOf(value)
|
4331 | } else if (value.__proto__) {
|
4332 | return value.__proto__
|
4333 | } else if (value.constructor) {
|
4334 | return value.constructor.prototype
|
4335 | }
|
4336 | }
|
4337 |
|
4338 |
|
4339 | }),
|
4340 |
|
4341 | 3513:
|
4342 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
4343 |
|
4344 | var document = __webpack_require__(9144)
|
4345 |
|
4346 | var applyProperties = __webpack_require__(6672)
|
4347 |
|
4348 | var isVNode = __webpack_require__(5170)
|
4349 | var isVText = __webpack_require__(6221)
|
4350 | var isWidget = __webpack_require__(4097)
|
4351 | var handleThunk = __webpack_require__(6078)
|
4352 |
|
4353 | module.exports = createElement
|
4354 |
|
4355 | function createElement(vnode, opts) {
|
4356 | var doc = opts ? opts.document || document : document
|
4357 | var warn = opts ? opts.warn : null
|
4358 |
|
4359 | vnode = handleThunk(vnode).a
|
4360 |
|
4361 | if (isWidget(vnode)) {
|
4362 | return vnode.init()
|
4363 | } else if (isVText(vnode)) {
|
4364 | return doc.createTextNode(vnode.text)
|
4365 | } else if (!isVNode(vnode)) {
|
4366 | if (warn) {
|
4367 | warn("Item is not a valid virtual dom node", vnode)
|
4368 | }
|
4369 | return null
|
4370 | }
|
4371 |
|
4372 | var node = (vnode.namespace === null) ?
|
4373 | doc.createElement(vnode.tagName) :
|
4374 | doc.createElementNS(vnode.namespace, vnode.tagName)
|
4375 |
|
4376 | var props = vnode.properties
|
4377 | applyProperties(node, props)
|
4378 |
|
4379 | var children = vnode.children
|
4380 |
|
4381 | for (var i = 0; i < children.length; i++) {
|
4382 | var childNode = createElement(children[i], opts)
|
4383 | if (childNode) {
|
4384 | node.appendChild(childNode)
|
4385 | }
|
4386 | }
|
4387 |
|
4388 | return node
|
4389 | }
|
4390 |
|
4391 |
|
4392 | }),
|
4393 |
|
4394 | 8992:
|
4395 | ((module) => {
|
4396 |
|
4397 |
|
4398 |
|
4399 |
|
4400 |
|
4401 |
|
4402 |
|
4403 | var noChild = {}
|
4404 |
|
4405 | module.exports = domIndex
|
4406 |
|
4407 | function domIndex(rootNode, tree, indices, nodes) {
|
4408 | if (!indices || indices.length === 0) {
|
4409 | return {}
|
4410 | } else {
|
4411 | indices.sort(ascending)
|
4412 | return recurse(rootNode, tree, indices, nodes, 0)
|
4413 | }
|
4414 | }
|
4415 |
|
4416 | function recurse(rootNode, tree, indices, nodes, rootIndex) {
|
4417 | nodes = nodes || {}
|
4418 |
|
4419 |
|
4420 | if (rootNode) {
|
4421 | if (indexInRange(indices, rootIndex, rootIndex)) {
|
4422 | nodes[rootIndex] = rootNode
|
4423 | }
|
4424 |
|
4425 | var vChildren = tree.children
|
4426 |
|
4427 | if (vChildren) {
|
4428 |
|
4429 | var childNodes = rootNode.childNodes
|
4430 |
|
4431 | for (var i = 0; i < tree.children.length; i++) {
|
4432 | rootIndex += 1
|
4433 |
|
4434 | var vChild = vChildren[i] || noChild
|
4435 | var nextIndex = rootIndex + (vChild.count || 0)
|
4436 |
|
4437 |
|
4438 | if (indexInRange(indices, rootIndex, nextIndex)) {
|
4439 | recurse(childNodes[i], vChild, indices, nodes, rootIndex)
|
4440 | }
|
4441 |
|
4442 | rootIndex = nextIndex
|
4443 | }
|
4444 | }
|
4445 | }
|
4446 |
|
4447 | return nodes
|
4448 | }
|
4449 |
|
4450 |
|
4451 | function indexInRange(indices, left, right) {
|
4452 | if (indices.length === 0) {
|
4453 | return false
|
4454 | }
|
4455 |
|
4456 | var minIndex = 0
|
4457 | var maxIndex = indices.length - 1
|
4458 | var currentIndex
|
4459 | var currentItem
|
4460 |
|
4461 | while (minIndex <= maxIndex) {
|
4462 | currentIndex = ((maxIndex + minIndex) / 2) >> 0
|
4463 | currentItem = indices[currentIndex]
|
4464 |
|
4465 | if (minIndex === maxIndex) {
|
4466 | return currentItem >= left && currentItem <= right
|
4467 | } else if (currentItem < left) {
|
4468 | minIndex = currentIndex + 1
|
4469 | } else if (currentItem > right) {
|
4470 | maxIndex = currentIndex - 1
|
4471 | } else {
|
4472 | return true
|
4473 | }
|
4474 | }
|
4475 |
|
4476 | return false;
|
4477 | }
|
4478 |
|
4479 | function ascending(a, b) {
|
4480 | return a > b ? 1 : -1
|
4481 | }
|
4482 |
|
4483 |
|
4484 | }),
|
4485 |
|
4486 | 9120:
|
4487 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
4488 |
|
4489 | var applyProperties = __webpack_require__(6672)
|
4490 |
|
4491 | var isWidget = __webpack_require__(4097)
|
4492 | var VPatch = __webpack_require__(8057)
|
4493 |
|
4494 | var updateWidget = __webpack_require__(6670)
|
4495 |
|
4496 | module.exports = applyPatch
|
4497 |
|
4498 | function applyPatch(vpatch, domNode, renderOptions) {
|
4499 | var type = vpatch.type
|
4500 | var vNode = vpatch.vNode
|
4501 | var patch = vpatch.patch
|
4502 |
|
4503 | switch (type) {
|
4504 | case VPatch.REMOVE:
|
4505 | return removeNode(domNode, vNode)
|
4506 | case VPatch.INSERT:
|
4507 | return insertNode(domNode, patch, renderOptions)
|
4508 | case VPatch.VTEXT:
|
4509 | return stringPatch(domNode, vNode, patch, renderOptions)
|
4510 | case VPatch.WIDGET:
|
4511 | return widgetPatch(domNode, vNode, patch, renderOptions)
|
4512 | case VPatch.VNODE:
|
4513 | return vNodePatch(domNode, vNode, patch, renderOptions)
|
4514 | case VPatch.ORDER:
|
4515 | reorderChildren(domNode, patch)
|
4516 | return domNode
|
4517 | case VPatch.PROPS:
|
4518 | applyProperties(domNode, patch, vNode.properties)
|
4519 | return domNode
|
4520 | case VPatch.THUNK:
|
4521 | return replaceRoot(domNode,
|
4522 | renderOptions.patch(domNode, patch, renderOptions))
|
4523 | default:
|
4524 | return domNode
|
4525 | }
|
4526 | }
|
4527 |
|
4528 | function removeNode(domNode, vNode) {
|
4529 | var parentNode = domNode.parentNode
|
4530 |
|
4531 | if (parentNode) {
|
4532 | parentNode.removeChild(domNode)
|
4533 | }
|
4534 |
|
4535 | destroyWidget(domNode, vNode);
|
4536 |
|
4537 | return null
|
4538 | }
|
4539 |
|
4540 | function insertNode(parentNode, vNode, renderOptions) {
|
4541 | var newNode = renderOptions.render(vNode, renderOptions)
|
4542 |
|
4543 | if (parentNode) {
|
4544 | parentNode.appendChild(newNode)
|
4545 | }
|
4546 |
|
4547 | return parentNode
|
4548 | }
|
4549 |
|
4550 | function stringPatch(domNode, leftVNode, vText, renderOptions) {
|
4551 | var newNode
|
4552 |
|
4553 | if (domNode.nodeType === 3) {
|
4554 | domNode.replaceData(0, domNode.length, vText.text)
|
4555 | newNode = domNode
|
4556 | } else {
|
4557 | var parentNode = domNode.parentNode
|
4558 | newNode = renderOptions.render(vText, renderOptions)
|
4559 |
|
4560 | if (parentNode && newNode !== domNode) {
|
4561 | parentNode.replaceChild(newNode, domNode)
|
4562 | }
|
4563 | }
|
4564 |
|
4565 | return newNode
|
4566 | }
|
4567 |
|
4568 | function widgetPatch(domNode, leftVNode, widget, renderOptions) {
|
4569 | var updating = updateWidget(leftVNode, widget)
|
4570 | var newNode
|
4571 |
|
4572 | if (updating) {
|
4573 | newNode = widget.update(leftVNode, domNode) || domNode
|
4574 | } else {
|
4575 | newNode = renderOptions.render(widget, renderOptions)
|
4576 | }
|
4577 |
|
4578 | var parentNode = domNode.parentNode
|
4579 |
|
4580 | if (parentNode && newNode !== domNode) {
|
4581 | parentNode.replaceChild(newNode, domNode)
|
4582 | }
|
4583 |
|
4584 | if (!updating) {
|
4585 | destroyWidget(domNode, leftVNode)
|
4586 | }
|
4587 |
|
4588 | return newNode
|
4589 | }
|
4590 |
|
4591 | function vNodePatch(domNode, leftVNode, vNode, renderOptions) {
|
4592 | var parentNode = domNode.parentNode
|
4593 | var newNode = renderOptions.render(vNode, renderOptions)
|
4594 |
|
4595 | if (parentNode && newNode !== domNode) {
|
4596 | parentNode.replaceChild(newNode, domNode)
|
4597 | }
|
4598 |
|
4599 | return newNode
|
4600 | }
|
4601 |
|
4602 | function destroyWidget(domNode, w) {
|
4603 | if (typeof w.destroy === "function" && isWidget(w)) {
|
4604 | w.destroy(domNode)
|
4605 | }
|
4606 | }
|
4607 |
|
4608 | function reorderChildren(domNode, moves) {
|
4609 | var childNodes = domNode.childNodes
|
4610 | var keyMap = {}
|
4611 | var node
|
4612 | var remove
|
4613 | var insert
|
4614 |
|
4615 | for (var i = 0; i < moves.removes.length; i++) {
|
4616 | remove = moves.removes[i]
|
4617 | node = childNodes[remove.from]
|
4618 | if (remove.key) {
|
4619 | keyMap[remove.key] = node
|
4620 | }
|
4621 | domNode.removeChild(node)
|
4622 | }
|
4623 |
|
4624 | var length = childNodes.length
|
4625 | for (var j = 0; j < moves.inserts.length; j++) {
|
4626 | insert = moves.inserts[j]
|
4627 | node = keyMap[insert.key]
|
4628 |
|
4629 | domNode.insertBefore(node, insert.to >= length++ ? null : childNodes[insert.to])
|
4630 | }
|
4631 | }
|
4632 |
|
4633 | function replaceRoot(oldRoot, newRoot) {
|
4634 | if (oldRoot && newRoot && oldRoot !== newRoot && oldRoot.parentNode) {
|
4635 | oldRoot.parentNode.replaceChild(newRoot, oldRoot)
|
4636 | }
|
4637 |
|
4638 | return newRoot;
|
4639 | }
|
4640 |
|
4641 |
|
4642 | }),
|
4643 |
|
4644 | 6943:
|
4645 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
4646 |
|
4647 | var document = __webpack_require__(9144)
|
4648 | var isArray = __webpack_require__(7362)
|
4649 |
|
4650 | var render = __webpack_require__(3513)
|
4651 | var domIndex = __webpack_require__(8992)
|
4652 | var patchOp = __webpack_require__(9120)
|
4653 | module.exports = patch
|
4654 |
|
4655 | function patch(rootNode, patches, renderOptions) {
|
4656 | renderOptions = renderOptions || {}
|
4657 | renderOptions.patch = renderOptions.patch && renderOptions.patch !== patch
|
4658 | ? renderOptions.patch
|
4659 | : patchRecursive
|
4660 | renderOptions.render = renderOptions.render || render
|
4661 |
|
4662 | return renderOptions.patch(rootNode, patches, renderOptions)
|
4663 | }
|
4664 |
|
4665 | function patchRecursive(rootNode, patches, renderOptions) {
|
4666 | var indices = patchIndices(patches)
|
4667 |
|
4668 | if (indices.length === 0) {
|
4669 | return rootNode
|
4670 | }
|
4671 |
|
4672 | var index = domIndex(rootNode, patches.a, indices)
|
4673 | var ownerDocument = rootNode.ownerDocument
|
4674 |
|
4675 | if (!renderOptions.document && ownerDocument !== document) {
|
4676 | renderOptions.document = ownerDocument
|
4677 | }
|
4678 |
|
4679 | for (var i = 0; i < indices.length; i++) {
|
4680 | var nodeIndex = indices[i]
|
4681 | rootNode = applyPatch(rootNode,
|
4682 | index[nodeIndex],
|
4683 | patches[nodeIndex],
|
4684 | renderOptions)
|
4685 | }
|
4686 |
|
4687 | return rootNode
|
4688 | }
|
4689 |
|
4690 | function applyPatch(rootNode, domNode, patchList, renderOptions) {
|
4691 | if (!domNode) {
|
4692 | return rootNode
|
4693 | }
|
4694 |
|
4695 | var newNode
|
4696 |
|
4697 | if (isArray(patchList)) {
|
4698 | for (var i = 0; i < patchList.length; i++) {
|
4699 | newNode = patchOp(patchList[i], domNode, renderOptions)
|
4700 |
|
4701 | if (domNode === rootNode) {
|
4702 | rootNode = newNode
|
4703 | }
|
4704 | }
|
4705 | } else {
|
4706 | newNode = patchOp(patchList, domNode, renderOptions)
|
4707 |
|
4708 | if (domNode === rootNode) {
|
4709 | rootNode = newNode
|
4710 | }
|
4711 | }
|
4712 |
|
4713 | return rootNode
|
4714 | }
|
4715 |
|
4716 | function patchIndices(patches) {
|
4717 | var indices = []
|
4718 |
|
4719 | for (var key in patches) {
|
4720 | if (key !== "a") {
|
4721 | indices.push(Number(key))
|
4722 | }
|
4723 | }
|
4724 |
|
4725 | return indices
|
4726 | }
|
4727 |
|
4728 |
|
4729 | }),
|
4730 |
|
4731 | 6670:
|
4732 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
4733 |
|
4734 | var isWidget = __webpack_require__(4097)
|
4735 |
|
4736 | module.exports = updateWidget
|
4737 |
|
4738 | function updateWidget(a, b) {
|
4739 | if (isWidget(a) && isWidget(b)) {
|
4740 | if ("name" in a && "name" in b) {
|
4741 | return a.id === b.id
|
4742 | } else {
|
4743 | return a.init === b.init
|
4744 | }
|
4745 | }
|
4746 |
|
4747 | return false
|
4748 | }
|
4749 |
|
4750 |
|
4751 | }),
|
4752 |
|
4753 | 6505:
|
4754 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
4755 |
|
4756 | "use strict";
|
4757 |
|
4758 |
|
4759 | var EvStore = __webpack_require__(8832);
|
4760 |
|
4761 | module.exports = EvHook;
|
4762 |
|
4763 | function EvHook(value) {
|
4764 | if (!(this instanceof EvHook)) {
|
4765 | return new EvHook(value);
|
4766 | }
|
4767 |
|
4768 | this.value = value;
|
4769 | }
|
4770 |
|
4771 | EvHook.prototype.hook = function (node, propertyName) {
|
4772 | var es = EvStore(node);
|
4773 | var propName = propertyName.substr(3);
|
4774 |
|
4775 | es[propName] = this.value;
|
4776 | };
|
4777 |
|
4778 | EvHook.prototype.unhook = function(node, propertyName) {
|
4779 | var es = EvStore(node);
|
4780 | var propName = propertyName.substr(3);
|
4781 |
|
4782 | es[propName] = undefined;
|
4783 | };
|
4784 |
|
4785 |
|
4786 | }),
|
4787 |
|
4788 | 7199:
|
4789 | ((module) => {
|
4790 |
|
4791 | "use strict";
|
4792 |
|
4793 |
|
4794 | module.exports = SoftSetHook;
|
4795 |
|
4796 | function SoftSetHook(value) {
|
4797 | if (!(this instanceof SoftSetHook)) {
|
4798 | return new SoftSetHook(value);
|
4799 | }
|
4800 |
|
4801 | this.value = value;
|
4802 | }
|
4803 |
|
4804 | SoftSetHook.prototype.hook = function (node, propertyName) {
|
4805 | if (node[propertyName] !== this.value) {
|
4806 | node[propertyName] = this.value;
|
4807 | }
|
4808 | };
|
4809 |
|
4810 |
|
4811 | }),
|
4812 |
|
4813 | 8744:
|
4814 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
4815 |
|
4816 | "use strict";
|
4817 |
|
4818 |
|
4819 | var isArray = __webpack_require__(7362);
|
4820 |
|
4821 | var VNode = __webpack_require__(4282);
|
4822 | var VText = __webpack_require__(4268);
|
4823 | var isVNode = __webpack_require__(5170);
|
4824 | var isVText = __webpack_require__(6221);
|
4825 | var isWidget = __webpack_require__(4097);
|
4826 | var isHook = __webpack_require__(7265);
|
4827 | var isVThunk = __webpack_require__(6741);
|
4828 |
|
4829 | var parseTag = __webpack_require__(1948);
|
4830 | var softSetHook = __webpack_require__(7199);
|
4831 | var evHook = __webpack_require__(6505);
|
4832 |
|
4833 | module.exports = h;
|
4834 |
|
4835 | function h(tagName, properties, children) {
|
4836 | var childNodes = [];
|
4837 | var tag, props, key, namespace;
|
4838 |
|
4839 | if (!children && isChildren(properties)) {
|
4840 | children = properties;
|
4841 | props = {};
|
4842 | }
|
4843 |
|
4844 | props = props || properties || {};
|
4845 | tag = parseTag(tagName, props);
|
4846 |
|
4847 |
|
4848 | if (props.hasOwnProperty('key')) {
|
4849 | key = props.key;
|
4850 | props.key = undefined;
|
4851 | }
|
4852 |
|
4853 |
|
4854 | if (props.hasOwnProperty('namespace')) {
|
4855 | namespace = props.namespace;
|
4856 | props.namespace = undefined;
|
4857 | }
|
4858 |
|
4859 |
|
4860 | if (tag === 'INPUT' &&
|
4861 | !namespace &&
|
4862 | props.hasOwnProperty('value') &&
|
4863 | props.value !== undefined &&
|
4864 | !isHook(props.value)
|
4865 | ) {
|
4866 | props.value = softSetHook(props.value);
|
4867 | }
|
4868 |
|
4869 | transformProperties(props);
|
4870 |
|
4871 | if (children !== undefined && children !== null) {
|
4872 | addChild(children, childNodes, tag, props);
|
4873 | }
|
4874 |
|
4875 |
|
4876 | return new VNode(tag, props, childNodes, key, namespace);
|
4877 | }
|
4878 |
|
4879 | function addChild(c, childNodes, tag, props) {
|
4880 | if (typeof c === 'string') {
|
4881 | childNodes.push(new VText(c));
|
4882 | } else if (typeof c === 'number') {
|
4883 | childNodes.push(new VText(String(c)));
|
4884 | } else if (isChild(c)) {
|
4885 | childNodes.push(c);
|
4886 | } else if (isArray(c)) {
|
4887 | for (var i = 0; i < c.length; i++) {
|
4888 | addChild(c[i], childNodes, tag, props);
|
4889 | }
|
4890 | } else if (c === null || c === undefined) {
|
4891 | return;
|
4892 | } else {
|
4893 | throw UnexpectedVirtualElement({
|
4894 | foreignObject: c,
|
4895 | parentVnode: {
|
4896 | tagName: tag,
|
4897 | properties: props
|
4898 | }
|
4899 | });
|
4900 | }
|
4901 | }
|
4902 |
|
4903 | function transformProperties(props) {
|
4904 | for (var propName in props) {
|
4905 | if (props.hasOwnProperty(propName)) {
|
4906 | var value = props[propName];
|
4907 |
|
4908 | if (isHook(value)) {
|
4909 | continue;
|
4910 | }
|
4911 |
|
4912 | if (propName.substr(0, 3) === 'ev-') {
|
4913 |
|
4914 | props[propName] = evHook(value);
|
4915 | }
|
4916 | }
|
4917 | }
|
4918 | }
|
4919 |
|
4920 | function isChild(x) {
|
4921 | return isVNode(x) || isVText(x) || isWidget(x) || isVThunk(x);
|
4922 | }
|
4923 |
|
4924 | function isChildren(x) {
|
4925 | return typeof x === 'string' || isArray(x) || isChild(x);
|
4926 | }
|
4927 |
|
4928 | function UnexpectedVirtualElement(data) {
|
4929 | var err = new Error();
|
4930 |
|
4931 | err.type = 'virtual-hyperscript.unexpected.virtual-element';
|
4932 | err.message = 'Unexpected virtual child passed to h().\n' +
|
4933 | 'Expected a VNode / Vthunk / VWidget / string but:\n' +
|
4934 | 'got:\n' +
|
4935 | errorString(data.foreignObject) +
|
4936 | '.\n' +
|
4937 | 'The parent vnode is:\n' +
|
4938 | errorString(data.parentVnode)
|
4939 | '\n' +
|
4940 | 'Suggested fix: change your `h(..., [ ... ])` callsite.';
|
4941 | err.foreignObject = data.foreignObject;
|
4942 | err.parentVnode = data.parentVnode;
|
4943 |
|
4944 | return err;
|
4945 | }
|
4946 |
|
4947 | function errorString(obj) {
|
4948 | try {
|
4949 | return JSON.stringify(obj, null, ' ');
|
4950 | } catch (e) {
|
4951 | return String(obj);
|
4952 | }
|
4953 | }
|
4954 |
|
4955 |
|
4956 | }),
|
4957 |
|
4958 | 1948:
|
4959 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
4960 |
|
4961 | "use strict";
|
4962 |
|
4963 |
|
4964 | var split = __webpack_require__(6824);
|
4965 |
|
4966 | var classIdSplit = /([\.#]?[a-zA-Z0-9\u007F-\uFFFF_:-]+)/;
|
4967 | var notClassId = /^\.|#/;
|
4968 |
|
4969 | module.exports = parseTag;
|
4970 |
|
4971 | function parseTag(tag, props) {
|
4972 | if (!tag) {
|
4973 | return 'DIV';
|
4974 | }
|
4975 |
|
4976 | var noId = !(props.hasOwnProperty('id'));
|
4977 |
|
4978 | var tagParts = split(tag, classIdSplit);
|
4979 | var tagName = null;
|
4980 |
|
4981 | if (notClassId.test(tagParts[1])) {
|
4982 | tagName = 'DIV';
|
4983 | }
|
4984 |
|
4985 | var classes, part, type, i;
|
4986 |
|
4987 | for (i = 0; i < tagParts.length; i++) {
|
4988 | part = tagParts[i];
|
4989 |
|
4990 | if (!part) {
|
4991 | continue;
|
4992 | }
|
4993 |
|
4994 | type = part.charAt(0);
|
4995 |
|
4996 | if (!tagName) {
|
4997 | tagName = part;
|
4998 | } else if (type === '.') {
|
4999 | classes = classes || [];
|
5000 | classes.push(part.substring(1, part.length));
|
5001 | } else if (type === '#' && noId) {
|
5002 | props.id = part.substring(1, part.length);
|
5003 | }
|
5004 | }
|
5005 |
|
5006 | if (classes) {
|
5007 | if (props.className) {
|
5008 | classes.push(props.className);
|
5009 | }
|
5010 |
|
5011 | props.className = classes.join(' ');
|
5012 | }
|
5013 |
|
5014 | return props.namespace ? tagName : tagName.toUpperCase();
|
5015 | }
|
5016 |
|
5017 |
|
5018 | }),
|
5019 |
|
5020 | 6078:
|
5021 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
5022 |
|
5023 | var isVNode = __webpack_require__(5170)
|
5024 | var isVText = __webpack_require__(6221)
|
5025 | var isWidget = __webpack_require__(4097)
|
5026 | var isThunk = __webpack_require__(6741)
|
5027 |
|
5028 | module.exports = handleThunk
|
5029 |
|
5030 | function handleThunk(a, b) {
|
5031 | var renderedA = a
|
5032 | var renderedB = b
|
5033 |
|
5034 | if (isThunk(b)) {
|
5035 | renderedB = renderThunk(b, a)
|
5036 | }
|
5037 |
|
5038 | if (isThunk(a)) {
|
5039 | renderedA = renderThunk(a, null)
|
5040 | }
|
5041 |
|
5042 | return {
|
5043 | a: renderedA,
|
5044 | b: renderedB
|
5045 | }
|
5046 | }
|
5047 |
|
5048 | function renderThunk(thunk, previous) {
|
5049 | var renderedThunk = thunk.vnode
|
5050 |
|
5051 | if (!renderedThunk) {
|
5052 | renderedThunk = thunk.vnode = thunk.render(previous)
|
5053 | }
|
5054 |
|
5055 | if (!(isVNode(renderedThunk) ||
|
5056 | isVText(renderedThunk) ||
|
5057 | isWidget(renderedThunk))) {
|
5058 | throw new Error("thunk did not return a valid node");
|
5059 | }
|
5060 |
|
5061 | return renderedThunk
|
5062 | }
|
5063 |
|
5064 |
|
5065 | }),
|
5066 |
|
5067 | 6741:
|
5068 | ((module) => {
|
5069 |
|
5070 | module.exports = isThunk
|
5071 |
|
5072 | function isThunk(t) {
|
5073 | return t && t.type === "Thunk"
|
5074 | }
|
5075 |
|
5076 |
|
5077 | }),
|
5078 |
|
5079 | 7265:
|
5080 | ((module) => {
|
5081 |
|
5082 | module.exports = isHook
|
5083 |
|
5084 | function isHook(hook) {
|
5085 | return hook &&
|
5086 | (typeof hook.hook === "function" && !hook.hasOwnProperty("hook") ||
|
5087 | typeof hook.unhook === "function" && !hook.hasOwnProperty("unhook"))
|
5088 | }
|
5089 |
|
5090 |
|
5091 | }),
|
5092 |
|
5093 | 5170:
|
5094 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
5095 |
|
5096 | var version = __webpack_require__(9962)
|
5097 |
|
5098 | module.exports = isVirtualNode
|
5099 |
|
5100 | function isVirtualNode(x) {
|
5101 | return x && x.type === "VirtualNode" && x.version === version
|
5102 | }
|
5103 |
|
5104 |
|
5105 | }),
|
5106 |
|
5107 | 6221:
|
5108 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
5109 |
|
5110 | var version = __webpack_require__(9962)
|
5111 |
|
5112 | module.exports = isVirtualText
|
5113 |
|
5114 | function isVirtualText(x) {
|
5115 | return x && x.type === "VirtualText" && x.version === version
|
5116 | }
|
5117 |
|
5118 |
|
5119 | }),
|
5120 |
|
5121 | 4097:
|
5122 | ((module) => {
|
5123 |
|
5124 | module.exports = isWidget
|
5125 |
|
5126 | function isWidget(w) {
|
5127 | return w && w.type === "Widget"
|
5128 | }
|
5129 |
|
5130 |
|
5131 | }),
|
5132 |
|
5133 | 9962:
|
5134 | ((module) => {
|
5135 |
|
5136 | module.exports = "2"
|
5137 |
|
5138 |
|
5139 | }),
|
5140 |
|
5141 | 4282:
|
5142 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
5143 |
|
5144 | var version = __webpack_require__(9962)
|
5145 | var isVNode = __webpack_require__(5170)
|
5146 | var isWidget = __webpack_require__(4097)
|
5147 | var isThunk = __webpack_require__(6741)
|
5148 | var isVHook = __webpack_require__(7265)
|
5149 |
|
5150 | module.exports = VirtualNode
|
5151 |
|
5152 | var noProperties = {}
|
5153 | var noChildren = []
|
5154 |
|
5155 | function VirtualNode(tagName, properties, children, key, namespace) {
|
5156 | this.tagName = tagName
|
5157 | this.properties = properties || noProperties
|
5158 | this.children = children || noChildren
|
5159 | this.key = key != null ? String(key) : undefined
|
5160 | this.namespace = (typeof namespace === "string") ? namespace : null
|
5161 |
|
5162 | var count = (children && children.length) || 0
|
5163 | var descendants = 0
|
5164 | var hasWidgets = false
|
5165 | var hasThunks = false
|
5166 | var descendantHooks = false
|
5167 | var hooks
|
5168 |
|
5169 | for (var propName in properties) {
|
5170 | if (properties.hasOwnProperty(propName)) {
|
5171 | var property = properties[propName]
|
5172 | if (isVHook(property) && property.unhook) {
|
5173 | if (!hooks) {
|
5174 | hooks = {}
|
5175 | }
|
5176 |
|
5177 | hooks[propName] = property
|
5178 | }
|
5179 | }
|
5180 | }
|
5181 |
|
5182 | for (var i = 0; i < count; i++) {
|
5183 | var child = children[i]
|
5184 | if (isVNode(child)) {
|
5185 | descendants += child.count || 0
|
5186 |
|
5187 | if (!hasWidgets && child.hasWidgets) {
|
5188 | hasWidgets = true
|
5189 | }
|
5190 |
|
5191 | if (!hasThunks && child.hasThunks) {
|
5192 | hasThunks = true
|
5193 | }
|
5194 |
|
5195 | if (!descendantHooks && (child.hooks || child.descendantHooks)) {
|
5196 | descendantHooks = true
|
5197 | }
|
5198 | } else if (!hasWidgets && isWidget(child)) {
|
5199 | if (typeof child.destroy === "function") {
|
5200 | hasWidgets = true
|
5201 | }
|
5202 | } else if (!hasThunks && isThunk(child)) {
|
5203 | hasThunks = true;
|
5204 | }
|
5205 | }
|
5206 |
|
5207 | this.count = count + descendants
|
5208 | this.hasWidgets = hasWidgets
|
5209 | this.hasThunks = hasThunks
|
5210 | this.hooks = hooks
|
5211 | this.descendantHooks = descendantHooks
|
5212 | }
|
5213 |
|
5214 | VirtualNode.prototype.version = version
|
5215 | VirtualNode.prototype.type = "VirtualNode"
|
5216 |
|
5217 |
|
5218 | }),
|
5219 |
|
5220 | 8057:
|
5221 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
5222 |
|
5223 | var version = __webpack_require__(9962)
|
5224 |
|
5225 | VirtualPatch.NONE = 0
|
5226 | VirtualPatch.VTEXT = 1
|
5227 | VirtualPatch.VNODE = 2
|
5228 | VirtualPatch.WIDGET = 3
|
5229 | VirtualPatch.PROPS = 4
|
5230 | VirtualPatch.ORDER = 5
|
5231 | VirtualPatch.INSERT = 6
|
5232 | VirtualPatch.REMOVE = 7
|
5233 | VirtualPatch.THUNK = 8
|
5234 |
|
5235 | module.exports = VirtualPatch
|
5236 |
|
5237 | function VirtualPatch(type, vNode, patch) {
|
5238 | this.type = Number(type)
|
5239 | this.vNode = vNode
|
5240 | this.patch = patch
|
5241 | }
|
5242 |
|
5243 | VirtualPatch.prototype.version = version
|
5244 | VirtualPatch.prototype.type = "VirtualPatch"
|
5245 |
|
5246 |
|
5247 | }),
|
5248 |
|
5249 | 4268:
|
5250 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
5251 |
|
5252 | var version = __webpack_require__(9962)
|
5253 |
|
5254 | module.exports = VirtualText
|
5255 |
|
5256 | function VirtualText(text) {
|
5257 | this.text = String(text)
|
5258 | }
|
5259 |
|
5260 | VirtualText.prototype.version = version
|
5261 | VirtualText.prototype.type = "VirtualText"
|
5262 |
|
5263 |
|
5264 | }),
|
5265 |
|
5266 | 9973:
|
5267 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
5268 |
|
5269 | var isObject = __webpack_require__(6240)
|
5270 | var isHook = __webpack_require__(7265)
|
5271 |
|
5272 | module.exports = diffProps
|
5273 |
|
5274 | function diffProps(a, b) {
|
5275 | var diff
|
5276 |
|
5277 | for (var aKey in a) {
|
5278 | if (!(aKey in b)) {
|
5279 | diff = diff || {}
|
5280 | diff[aKey] = undefined
|
5281 | }
|
5282 |
|
5283 | var aValue = a[aKey]
|
5284 | var bValue = b[aKey]
|
5285 |
|
5286 | if (aValue === bValue) {
|
5287 | continue
|
5288 | } else if (isObject(aValue) && isObject(bValue)) {
|
5289 | if (getPrototype(bValue) !== getPrototype(aValue)) {
|
5290 | diff = diff || {}
|
5291 | diff[aKey] = bValue
|
5292 | } else if (isHook(bValue)) {
|
5293 | diff = diff || {}
|
5294 | diff[aKey] = bValue
|
5295 | } else {
|
5296 | var objectDiff = diffProps(aValue, bValue)
|
5297 | if (objectDiff) {
|
5298 | diff = diff || {}
|
5299 | diff[aKey] = objectDiff
|
5300 | }
|
5301 | }
|
5302 | } else {
|
5303 | diff = diff || {}
|
5304 | diff[aKey] = bValue
|
5305 | }
|
5306 | }
|
5307 |
|
5308 | for (var bKey in b) {
|
5309 | if (!(bKey in a)) {
|
5310 | diff = diff || {}
|
5311 | diff[bKey] = b[bKey]
|
5312 | }
|
5313 | }
|
5314 |
|
5315 | return diff
|
5316 | }
|
5317 |
|
5318 | function getPrototype(value) {
|
5319 | if (Object.getPrototypeOf) {
|
5320 | return Object.getPrototypeOf(value)
|
5321 | } else if (value.__proto__) {
|
5322 | return value.__proto__
|
5323 | } else if (value.constructor) {
|
5324 | return value.constructor.prototype
|
5325 | }
|
5326 | }
|
5327 |
|
5328 |
|
5329 | }),
|
5330 |
|
5331 | 3072:
|
5332 | ((module, __unused_webpack_exports, __webpack_require__) => {
|
5333 |
|
5334 | var isArray = __webpack_require__(7362)
|
5335 |
|
5336 | var VPatch = __webpack_require__(8057)
|
5337 | var isVNode = __webpack_require__(5170)
|
5338 | var isVText = __webpack_require__(6221)
|
5339 | var isWidget = __webpack_require__(4097)
|
5340 | var isThunk = __webpack_require__(6741)
|
5341 | var handleThunk = __webpack_require__(6078)
|
5342 |
|
5343 | var diffProps = __webpack_require__(9973)
|
5344 |
|
5345 | module.exports = diff
|
5346 |
|
5347 | function diff(a, b) {
|
5348 | var patch = { a: a }
|
5349 | walk(a, b, patch, 0)
|
5350 | return patch
|
5351 | }
|
5352 |
|
5353 | function walk(a, b, patch, index) {
|
5354 | if (a === b) {
|
5355 | return
|
5356 | }
|
5357 |
|
5358 | var apply = patch[index]
|
5359 | var applyClear = false
|
5360 |
|
5361 | if (isThunk(a) || isThunk(b)) {
|
5362 | thunks(a, b, patch, index)
|
5363 | } else if (b == null) {
|
5364 |
|
5365 |
|
5366 |
|
5367 |
|
5368 | if (!isWidget(a)) {
|
5369 | clearState(a, patch, index)
|
5370 | apply = patch[index]
|
5371 | }
|
5372 |
|
5373 | apply = appendPatch(apply, new VPatch(VPatch.REMOVE, a, b))
|
5374 | } else if (isVNode(b)) {
|
5375 | if (isVNode(a)) {
|
5376 | if (a.tagName === b.tagName &&
|
5377 | a.namespace === b.namespace &&
|
5378 | a.key === b.key) {
|
5379 | var propsPatch = diffProps(a.properties, b.properties)
|
5380 | if (propsPatch) {
|
5381 | apply = appendPatch(apply,
|
5382 | new VPatch(VPatch.PROPS, a, propsPatch))
|
5383 | }
|
5384 | apply = diffChildren(a, b, patch, apply, index)
|
5385 | } else {
|
5386 | apply = appendPatch(apply, new VPatch(VPatch.VNODE, a, b))
|
5387 | applyClear = true
|
5388 | }
|
5389 | } else {
|
5390 | apply = appendPatch(apply, new VPatch(VPatch.VNODE, a, b))
|
5391 | applyClear = true
|
5392 | }
|
5393 | } else if (isVText(b)) {
|
5394 | if (!isVText(a)) {
|
5395 | apply = appendPatch(apply, new VPatch(VPatch.VTEXT, a, b))
|
5396 | applyClear = true
|
5397 | } else if (a.text !== b.text) {
|
5398 | apply = appendPatch(apply, new VPatch(VPatch.VTEXT, a, b))
|
5399 | }
|
5400 | } else if (isWidget(b)) {
|
5401 | if (!isWidget(a)) {
|
5402 | applyClear = true
|
5403 | }
|
5404 |
|
5405 | apply = appendPatch(apply, new VPatch(VPatch.WIDGET, a, b))
|
5406 | }
|
5407 |
|
5408 | if (apply) {
|
5409 | patch[index] = apply
|
5410 | }
|
5411 |
|
5412 | if (applyClear) {
|
5413 | clearState(a, patch, index)
|
5414 | }
|
5415 | }
|
5416 |
|
5417 | function diffChildren(a, b, patch, apply, index) {
|
5418 | var aChildren = a.children
|
5419 | var orderedSet = reorder(aChildren, b.children)
|
5420 | var bChildren = orderedSet.children
|
5421 |
|
5422 | var aLen = aChildren.length
|
5423 | var bLen = bChildren.length
|
5424 | var len = aLen > bLen ? aLen : bLen
|
5425 |
|
5426 | for (var i = 0; i < len; i++) {
|
5427 | var leftNode = aChildren[i]
|
5428 | var rightNode = bChildren[i]
|
5429 | index += 1
|
5430 |
|
5431 | if (!leftNode) {
|
5432 | if (rightNode) {
|
5433 |
|
5434 | apply = appendPatch(apply,
|
5435 | new VPatch(VPatch.INSERT, null, rightNode))
|
5436 | }
|
5437 | } else {
|
5438 | walk(leftNode, rightNode, patch, index)
|
5439 | }
|
5440 |
|
5441 | if (isVNode(leftNode) && leftNode.count) {
|
5442 | index += leftNode.count
|
5443 | }
|
5444 | }
|
5445 |
|
5446 | if (orderedSet.moves) {
|
5447 |
|
5448 | apply = appendPatch(apply, new VPatch(
|
5449 | VPatch.ORDER,
|
5450 | a,
|
5451 | orderedSet.moves
|
5452 | ))
|
5453 | }
|
5454 |
|
5455 | return apply
|
5456 | }
|
5457 |
|
5458 | function clearState(vNode, patch, index) {
|
5459 |
|
5460 | unhook(vNode, patch, index)
|
5461 | destroyWidgets(vNode, patch, index)
|
5462 | }
|
5463 |
|
5464 |
|
5465 |
|
5466 | function destroyWidgets(vNode, patch, index) {
|
5467 | if (isWidget(vNode)) {
|
5468 | if (typeof vNode.destroy === "function") {
|
5469 | patch[index] = appendPatch(
|
5470 | patch[index],
|
5471 | new VPatch(VPatch.REMOVE, vNode, null)
|
5472 | )
|
5473 | }
|
5474 | } else if (isVNode(vNode) && (vNode.hasWidgets || vNode.hasThunks)) {
|
5475 | var children = vNode.children
|
5476 | var len = children.length
|
5477 | for (var i = 0; i < len; i++) {
|
5478 | var child = children[i]
|
5479 | index += 1
|
5480 |
|
5481 | destroyWidgets(child, patch, index)
|
5482 |
|
5483 | if (isVNode(child) && child.count) {
|
5484 | index += child.count
|
5485 | }
|
5486 | }
|
5487 | } else if (isThunk(vNode)) {
|
5488 | thunks(vNode, null, patch, index)
|
5489 | }
|
5490 | }
|
5491 |
|
5492 |
|
5493 | function thunks(a, b, patch, index) {
|
5494 | var nodes = handleThunk(a, b)
|
5495 | var thunkPatch = diff(nodes.a, nodes.b)
|
5496 | if (hasPatches(thunkPatch)) {
|
5497 | patch[index] = new VPatch(VPatch.THUNK, null, thunkPatch)
|
5498 | }
|
5499 | }
|
5500 |
|
5501 | function hasPatches(patch) {
|
5502 | for (var index in patch) {
|
5503 | if (index !== "a") {
|
5504 | return true
|
5505 | }
|
5506 | }
|
5507 |
|
5508 | return false
|
5509 | }
|
5510 |
|
5511 |
|
5512 | function unhook(vNode, patch, index) {
|
5513 | if (isVNode(vNode)) {
|
5514 | if (vNode.hooks) {
|
5515 | patch[index] = appendPatch(
|
5516 | patch[index],
|
5517 | new VPatch(
|
5518 | VPatch.PROPS,
|
5519 | vNode,
|
5520 | undefinedKeys(vNode.hooks)
|
5521 | )
|
5522 | )
|
5523 | }
|
5524 |
|
5525 | if (vNode.descendantHooks || vNode.hasThunks) {
|
5526 | var children = vNode.children
|
5527 | var len = children.length
|
5528 | for (var i = 0; i < len; i++) {
|
5529 | var child = children[i]
|
5530 | index += 1
|
5531 |
|
5532 | unhook(child, patch, index)
|
5533 |
|
5534 | if (isVNode(child) && child.count) {
|
5535 | index += child.count
|
5536 | }
|
5537 | }
|
5538 | }
|
5539 | } else if (isThunk(vNode)) {
|
5540 | thunks(vNode, null, patch, index)
|
5541 | }
|
5542 | }
|
5543 |
|
5544 | function undefinedKeys(obj) {
|
5545 | var result = {}
|
5546 |
|
5547 | for (var key in obj) {
|
5548 | result[key] = undefined
|
5549 | }
|
5550 |
|
5551 | return result
|
5552 | }
|
5553 |
|
5554 |
|
5555 | function reorder(aChildren, bChildren) {
|
5556 |
|
5557 | var bChildIndex = keyIndex(bChildren)
|
5558 | var bKeys = bChildIndex.keys
|
5559 | var bFree = bChildIndex.free
|
5560 |
|
5561 | if (bFree.length === bChildren.length) {
|
5562 | return {
|
5563 | children: bChildren,
|
5564 | moves: null
|
5565 | }
|
5566 | }
|
5567 |
|
5568 |
|
5569 | var aChildIndex = keyIndex(aChildren)
|
5570 | var aKeys = aChildIndex.keys
|
5571 | var aFree = aChildIndex.free
|
5572 |
|
5573 | if (aFree.length === aChildren.length) {
|
5574 | return {
|
5575 | children: bChildren,
|
5576 | moves: null
|
5577 | }
|
5578 | }
|
5579 |
|
5580 |
|
5581 | var newChildren = []
|
5582 |
|
5583 | var freeIndex = 0
|
5584 | var freeCount = bFree.length
|
5585 | var deletedItems = 0
|
5586 |
|
5587 |
|
5588 |
|
5589 | for (var i = 0 ; i < aChildren.length; i++) {
|
5590 | var aItem = aChildren[i]
|
5591 | var itemIndex
|
5592 |
|
5593 | if (aItem.key) {
|
5594 | if (bKeys.hasOwnProperty(aItem.key)) {
|
5595 |
|
5596 | itemIndex = bKeys[aItem.key]
|
5597 | newChildren.push(bChildren[itemIndex])
|
5598 |
|
5599 | } else {
|
5600 |
|
5601 | itemIndex = i - deletedItems++
|
5602 | newChildren.push(null)
|
5603 | }
|
5604 | } else {
|
5605 |
|
5606 | if (freeIndex < freeCount) {
|
5607 | itemIndex = bFree[freeIndex++]
|
5608 | newChildren.push(bChildren[itemIndex])
|
5609 | } else {
|
5610 |
|
5611 |
|
5612 |
|
5613 | itemIndex = i - deletedItems++
|
5614 | newChildren.push(null)
|
5615 | }
|
5616 | }
|
5617 | }
|
5618 |
|
5619 | var lastFreeIndex = freeIndex >= bFree.length ?
|
5620 | bChildren.length :
|
5621 | bFree[freeIndex]
|
5622 |
|
5623 |
|
5624 |
|
5625 | for (var j = 0; j < bChildren.length; j++) {
|
5626 | var newItem = bChildren[j]
|
5627 |
|
5628 | if (newItem.key) {
|
5629 | if (!aKeys.hasOwnProperty(newItem.key)) {
|
5630 |
|
5631 |
|
5632 |
|
5633 | newChildren.push(newItem)
|
5634 | }
|
5635 | } else if (j >= lastFreeIndex) {
|
5636 |
|
5637 | newChildren.push(newItem)
|
5638 | }
|
5639 | }
|
5640 |
|
5641 | var simulate = newChildren.slice()
|
5642 | var simulateIndex = 0
|
5643 | var removes = []
|
5644 | var inserts = []
|
5645 | var simulateItem
|
5646 |
|
5647 | for (var k = 0; k < bChildren.length;) {
|
5648 | var wantedItem = bChildren[k]
|
5649 | simulateItem = simulate[simulateIndex]
|
5650 |
|
5651 |
|
5652 | while (simulateItem === null && simulate.length) {
|
5653 | removes.push(remove(simulate, simulateIndex, null))
|
5654 | simulateItem = simulate[simulateIndex]
|
5655 | }
|
5656 |
|
5657 | if (!simulateItem || simulateItem.key !== wantedItem.key) {
|
5658 |
|
5659 | if (wantedItem.key) {
|
5660 | if (simulateItem && simulateItem.key) {
|
5661 |
|
5662 | if (bKeys[simulateItem.key] !== k + 1) {
|
5663 | removes.push(remove(simulate, simulateIndex, simulateItem.key))
|
5664 | simulateItem = simulate[simulateIndex]
|
5665 |
|
5666 | if (!simulateItem || simulateItem.key !== wantedItem.key) {
|
5667 | inserts.push({key: wantedItem.key, to: k})
|
5668 | }
|
5669 |
|
5670 | else {
|
5671 | simulateIndex++
|
5672 | }
|
5673 | }
|
5674 | else {
|
5675 | inserts.push({key: wantedItem.key, to: k})
|
5676 | }
|
5677 | }
|
5678 | else {
|
5679 | inserts.push({key: wantedItem.key, to: k})
|
5680 | }
|
5681 | k++
|
5682 | }
|
5683 |
|
5684 | else if (simulateItem && simulateItem.key) {
|
5685 | removes.push(remove(simulate, simulateIndex, simulateItem.key))
|
5686 | }
|
5687 | }
|
5688 | else {
|
5689 | simulateIndex++
|
5690 | k++
|
5691 | }
|
5692 | }
|
5693 |
|
5694 |
|
5695 | while(simulateIndex < simulate.length) {
|
5696 | simulateItem = simulate[simulateIndex]
|
5697 | removes.push(remove(simulate, simulateIndex, simulateItem && simulateItem.key))
|
5698 | }
|
5699 |
|
5700 |
|
5701 |
|
5702 | if (removes.length === deletedItems && !inserts.length) {
|
5703 | return {
|
5704 | children: newChildren,
|
5705 | moves: null
|
5706 | }
|
5707 | }
|
5708 |
|
5709 | return {
|
5710 | children: newChildren,
|
5711 | moves: {
|
5712 | removes: removes,
|
5713 | inserts: inserts
|
5714 | }
|
5715 | }
|
5716 | }
|
5717 |
|
5718 | function remove(arr, index, key) {
|
5719 | arr.splice(index, 1)
|
5720 |
|
5721 | return {
|
5722 | from: index,
|
5723 | key: key
|
5724 | }
|
5725 | }
|
5726 |
|
5727 | function keyIndex(children) {
|
5728 | var keys = {}
|
5729 | var free = []
|
5730 | var length = children.length
|
5731 |
|
5732 | for (var i = 0; i < length; i++) {
|
5733 | var child = children[i]
|
5734 |
|
5735 | if (child.key) {
|
5736 | keys[child.key] = i
|
5737 | } else {
|
5738 | free.push(i)
|
5739 | }
|
5740 | }
|
5741 |
|
5742 | return {
|
5743 | keys: keys,
|
5744 | free: free
|
5745 | }
|
5746 | }
|
5747 |
|
5748 | function appendPatch(apply, patch) {
|
5749 | if (apply) {
|
5750 | if (isArray(apply)) {
|
5751 | apply.push(patch)
|
5752 | } else {
|
5753 | apply = [apply, patch]
|
5754 | }
|
5755 |
|
5756 | return apply
|
5757 | } else {
|
5758 | return patch
|
5759 | }
|
5760 | }
|
5761 |
|
5762 |
|
5763 | }),
|
5764 |
|
5765 | 4991:
|
5766 | ((module) => {
|
5767 |
|
5768 | "use strict";
|
5769 |
|
5770 |
|
5771 |
|
5772 |
|
5773 |
|
5774 | function findMinMax(array) {
|
5775 | var min = Infinity;
|
5776 | var max = -Infinity;
|
5777 | var i = 0;
|
5778 | var len = array.length;
|
5779 | var curr;
|
5780 |
|
5781 | for (; i < len; i++) {
|
5782 | curr = array[i];
|
5783 | if (min > curr) {
|
5784 | min = curr;
|
5785 | }
|
5786 | if (max < curr) {
|
5787 | max = curr;
|
5788 | }
|
5789 | }
|
5790 |
|
5791 | return {
|
5792 | min: min,
|
5793 | max: max
|
5794 | };
|
5795 | }
|
5796 |
|
5797 |
|
5798 |
|
5799 |
|
5800 |
|
5801 | function convert(n, bits) {
|
5802 | var max = Math.pow(2, bits - 1);
|
5803 | var v = n < 0 ? n * max : n * (max - 1);
|
5804 | return Math.max(-max, Math.min(max - 1, v));
|
5805 | }
|
5806 |
|
5807 |
|
5808 |
|
5809 |
|
5810 |
|
5811 | function extractPeaks(channel, samplesPerPixel, bits) {
|
5812 | var i;
|
5813 | var chanLength = channel.length;
|
5814 | var numPeaks = Math.ceil(chanLength / samplesPerPixel);
|
5815 | var start;
|
5816 | var end;
|
5817 | var segment;
|
5818 | var max;
|
5819 | var min;
|
5820 | var extrema;
|
5821 |
|
5822 |
|
5823 | var peaks = makeTypedArray(bits, numPeaks * 2);
|
5824 |
|
5825 | for (i = 0; i < numPeaks; i++) {
|
5826 | start = i * samplesPerPixel;
|
5827 | end =
|
5828 | (i + 1) * samplesPerPixel > chanLength
|
5829 | ? chanLength
|
5830 | : (i + 1) * samplesPerPixel;
|
5831 |
|
5832 | segment = channel.subarray(start, end);
|
5833 | extrema = findMinMax(segment);
|
5834 | min = convert(extrema.min, bits);
|
5835 | max = convert(extrema.max, bits);
|
5836 |
|
5837 | peaks[i * 2] = min;
|
5838 | peaks[i * 2 + 1] = max;
|
5839 | }
|
5840 |
|
5841 | return peaks;
|
5842 | }
|
5843 |
|
5844 | function makeTypedArray(bits, length) {
|
5845 | return new (new Function(`return Int${bits}Array`)())(length);
|
5846 | }
|
5847 |
|
5848 | function makeMono(channelPeaks, bits) {
|
5849 | var numChan = channelPeaks.length;
|
5850 | var weight = 1 / numChan;
|
5851 | var numPeaks = channelPeaks[0].length / 2;
|
5852 | var c = 0;
|
5853 | var i = 0;
|
5854 | var min;
|
5855 | var max;
|
5856 | var peaks = makeTypedArray(bits, numPeaks * 2);
|
5857 |
|
5858 | for (i = 0; i < numPeaks; i++) {
|
5859 | min = 0;
|
5860 | max = 0;
|
5861 |
|
5862 | for (c = 0; c < numChan; c++) {
|
5863 | min += weight * channelPeaks[c][i * 2];
|
5864 | max += weight * channelPeaks[c][i * 2 + 1];
|
5865 | }
|
5866 |
|
5867 | peaks[i * 2] = min;
|
5868 | peaks[i * 2 + 1] = max;
|
5869 | }
|
5870 |
|
5871 |
|
5872 | return [peaks];
|
5873 | }
|
5874 |
|
5875 | function defaultNumber(value, defaultNumber) {
|
5876 | if (typeof value === "number") {
|
5877 | return value;
|
5878 | } else {
|
5879 | return defaultNumber;
|
5880 | }
|
5881 | }
|
5882 |
|
5883 |
|
5884 |
|
5885 |
|
5886 |
|
5887 |
|
5888 |
|
5889 |
|
5890 |
|
5891 | module.exports = function (
|
5892 | source,
|
5893 | samplesPerPixel,
|
5894 | isMono,
|
5895 | cueIn,
|
5896 | cueOut,
|
5897 | bits
|
5898 | ) {
|
5899 | samplesPerPixel = defaultNumber(samplesPerPixel, 1000);
|
5900 | bits = defaultNumber(bits, 16);
|
5901 |
|
5902 | if (isMono === null || isMono === undefined) {
|
5903 | isMono = true;
|
5904 | }
|
5905 |
|
5906 | if ([8, 16, 32].indexOf(bits) < 0) {
|
5907 | throw new Error("Invalid number of bits specified for peaks.");
|
5908 | }
|
5909 |
|
5910 | var numChan = source.numberOfChannels;
|
5911 | var peaks = [];
|
5912 | var c;
|
5913 | var numPeaks;
|
5914 | var channel;
|
5915 | var slice;
|
5916 |
|
5917 | cueIn = defaultNumber(cueIn, 0);
|
5918 | cueOut = defaultNumber(cueOut, source.length);
|
5919 |
|
5920 | if (typeof source.subarray === "undefined") {
|
5921 | for (c = 0; c < numChan; c++) {
|
5922 | channel = source.getChannelData(c);
|
5923 | slice = channel.subarray(cueIn, cueOut);
|
5924 | peaks.push(extractPeaks(slice, samplesPerPixel, bits));
|
5925 | }
|
5926 | } else {
|
5927 | peaks.push(
|
5928 | extractPeaks(source.subarray(cueIn, cueOut), samplesPerPixel, bits)
|
5929 | );
|
5930 | }
|
5931 |
|
5932 | if (isMono && peaks.length > 1) {
|
5933 | peaks = makeMono(peaks, bits);
|
5934 | }
|
5935 |
|
5936 | numPeaks = peaks[0].length / 2;
|
5937 |
|
5938 | return {
|
5939 | length: numPeaks,
|
5940 | data: peaks,
|
5941 | bits: bits
|
5942 | };
|
5943 | };
|
5944 |
|
5945 |
|
5946 | }),
|
5947 |
|
5948 | 7362:
|
5949 | ((module) => {
|
5950 |
|
5951 | var nativeIsArray = Array.isArray
|
5952 | var toString = Object.prototype.toString
|
5953 |
|
5954 | module.exports = nativeIsArray || isArray
|
5955 |
|
5956 | function isArray(obj) {
|
5957 | return toString.call(obj) === "[object Array]"
|
5958 | }
|
5959 |
|
5960 |
|
5961 | }),
|
5962 |
|
5963 | 5893:
|
5964 | (() => {
|
5965 |
|
5966 |
|
5967 |
|
5968 | })
|
5969 |
|
5970 | });
|
5971 |
|
5972 |
|
5973 | var __webpack_module_cache__ = {};
|
5974 |
|
5975 |
|
5976 | function __webpack_require__(moduleId) {
|
5977 |
|
5978 | var cachedModule = __webpack_module_cache__[moduleId];
|
5979 | if (cachedModule !== undefined) {
|
5980 | return cachedModule.exports;
|
5981 | }
|
5982 |
|
5983 | var module = __webpack_module_cache__[moduleId] = {
|
5984 | id: moduleId,
|
5985 | loaded: false,
|
5986 | exports: {}
|
5987 | };
|
5988 |
|
5989 |
|
5990 | __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
5991 |
|
5992 |
|
5993 | module.loaded = true;
|
5994 |
|
5995 |
|
5996 | return module.exports;
|
5997 | }
|
5998 |
|
5999 |
|
6000 |
|
6001 | (() => {
|
6002 |
|
6003 | __webpack_require__.n = (module) => {
|
6004 | var getter = module && module.__esModule ?
|
6005 | () => (module['default']) :
|
6006 | () => (module);
|
6007 | __webpack_require__.d(getter, { a: getter });
|
6008 | return getter;
|
6009 | };
|
6010 | })();
|
6011 |
|
6012 |
|
6013 | (() => {
|
6014 |
|
6015 | __webpack_require__.d = (exports, definition) => {
|
6016 | for(var key in definition) {
|
6017 | if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
|
6018 | Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
|
6019 | }
|
6020 | }
|
6021 | };
|
6022 | })();
|
6023 |
|
6024 |
|
6025 | (() => {
|
6026 | __webpack_require__.g = (function() {
|
6027 | if (typeof globalThis === 'object') return globalThis;
|
6028 | try {
|
6029 | return this || new Function('return this')();
|
6030 | } catch (e) {
|
6031 | if (typeof window === 'object') return window;
|
6032 | }
|
6033 | })();
|
6034 | })();
|
6035 |
|
6036 |
|
6037 | (() => {
|
6038 | __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
|
6039 | })();
|
6040 |
|
6041 |
|
6042 | (() => {
|
6043 |
|
6044 | __webpack_require__.r = (exports) => {
|
6045 | if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
6046 | Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
6047 | }
|
6048 | Object.defineProperty(exports, '__esModule', { value: true });
|
6049 | };
|
6050 | })();
|
6051 |
|
6052 |
|
6053 | (() => {
|
6054 | __webpack_require__.nmd = (module) => {
|
6055 | module.paths = [];
|
6056 | if (!module.children) module.children = [];
|
6057 | return module;
|
6058 | };
|
6059 | })();
|
6060 |
|
6061 |
|
6062 | var __webpack_exports__ = {};
|
6063 |
|
6064 | (() => {
|
6065 | "use strict";
|
6066 |
|
6067 | __webpack_require__.r(__webpack_exports__);
|
6068 |
|
6069 |
|
6070 | __webpack_require__.d(__webpack_exports__, {
|
6071 | "default": () => ( app),
|
6072 | "init": () => ( init)
|
6073 | });
|
6074 |
|
6075 |
|
6076 | var lodash_defaultsdeep = __webpack_require__(2098);
|
6077 | var lodash_defaultsdeep_default = __webpack_require__.n(lodash_defaultsdeep);
|
6078 |
|
6079 | var create_element = __webpack_require__(4935);
|
6080 | var create_element_default = __webpack_require__.n(create_element);
|
6081 |
|
6082 | var event_emitter = __webpack_require__(8370);
|
6083 | var event_emitter_default = __webpack_require__.n(event_emitter);
|
6084 |
|
6085 | var h = __webpack_require__(347);
|
6086 | var h_default = __webpack_require__.n(h);
|
6087 |
|
6088 | var diff = __webpack_require__(7921);
|
6089 | var diff_default = __webpack_require__.n(diff);
|
6090 |
|
6091 | var patch = __webpack_require__(9720);
|
6092 | var patch_default = __webpack_require__.n(patch);
|
6093 |
|
6094 | var inline_worker = __webpack_require__(849);
|
6095 | var inline_worker_default = __webpack_require__.n(inline_worker);
|
6096 | ;
|
6097 | function samplesToSeconds(samples, sampleRate) {
|
6098 | return samples / sampleRate;
|
6099 | }
|
6100 |
|
6101 | function secondsToSamples(seconds, sampleRate) {
|
6102 | return Math.ceil(seconds * sampleRate);
|
6103 | }
|
6104 |
|
6105 | function samplesToPixels(samples, resolution) {
|
6106 | return Math.floor(samples / resolution);
|
6107 | }
|
6108 |
|
6109 | function pixelsToSamples(pixels, resolution) {
|
6110 | return Math.floor(pixels * resolution);
|
6111 | }
|
6112 |
|
6113 | function pixelsToSeconds(pixels, resolution, sampleRate) {
|
6114 | return (pixels * resolution) / sampleRate;
|
6115 | }
|
6116 |
|
6117 | function secondsToPixels(seconds, resolution, sampleRate) {
|
6118 | return Math.ceil((seconds * sampleRate) / resolution);
|
6119 | }
|
6120 |
|
6121 | ;
|
6122 |
|
6123 |
|
6124 | const STATE_UNINITIALIZED = 0;
|
6125 | const STATE_LOADING = 1;
|
6126 | const STATE_DECODING = 2;
|
6127 | const STATE_FINISHED = 3;
|
6128 |
|
6129 | const Loader = (class {
|
6130 | constructor(src, audioContext, ee = event_emitter_default()()) {
|
6131 | this.src = src;
|
6132 | this.ac = audioContext;
|
6133 | this.audioRequestState = STATE_UNINITIALIZED;
|
6134 | this.ee = ee;
|
6135 | }
|
6136 |
|
6137 | setStateChange(state) {
|
6138 | this.audioRequestState = state;
|
6139 | this.ee.emit("audiorequeststatechange", this.audioRequestState, this.src);
|
6140 | }
|
6141 |
|
6142 | fileProgress(e) {
|
6143 | let percentComplete = 0;
|
6144 |
|
6145 | if (this.audioRequestState === STATE_UNINITIALIZED) {
|
6146 | this.setStateChange(STATE_LOADING);
|
6147 | }
|
6148 |
|
6149 | if (e.lengthComputable) {
|
6150 | percentComplete = (e.loaded / e.total) * 100;
|
6151 | }
|
6152 |
|
6153 | this.ee.emit("loadprogress", percentComplete, this.src);
|
6154 | }
|
6155 |
|
6156 | fileLoad(e) {
|
6157 | const audioData = e.target.response || e.target.result;
|
6158 |
|
6159 | this.setStateChange(STATE_DECODING);
|
6160 |
|
6161 | return new Promise((resolve, reject) => {
|
6162 | this.ac.decodeAudioData(
|
6163 | audioData,
|
6164 | (audioBuffer) => {
|
6165 | this.audioBuffer = audioBuffer;
|
6166 | this.setStateChange(STATE_FINISHED);
|
6167 |
|
6168 | resolve(audioBuffer);
|
6169 | },
|
6170 | (err) => {
|
6171 | if (err === null) {
|
6172 |
|
6173 | reject(Error("MediaDecodeAudioDataUnknownContentType"));
|
6174 | } else {
|
6175 | reject(err);
|
6176 | }
|
6177 | }
|
6178 | );
|
6179 | });
|
6180 | }
|
6181 | });
|
6182 |
|
6183 | ;
|
6184 |
|
6185 |
|
6186 | const BlobLoader = (class extends Loader {
|
6187 | |
6188 |
|
6189 |
|
6190 | load() {
|
6191 | return new Promise((resolve, reject) => {
|
6192 | if (
|
6193 | this.src.type.match(/audio.*/) ||
|
6194 |
|
6195 | this.src.type.match(/video\/ogg/)
|
6196 | ) {
|
6197 | const fr = new FileReader();
|
6198 |
|
6199 | fr.readAsArrayBuffer(this.src);
|
6200 |
|
6201 | fr.addEventListener("progress", (e) => {
|
6202 | super.fileProgress(e);
|
6203 | });
|
6204 |
|
6205 | fr.addEventListener("load", (e) => {
|
6206 | const decoderPromise = super.fileLoad(e);
|
6207 |
|
6208 | decoderPromise
|
6209 | .then((audioBuffer) => {
|
6210 | resolve(audioBuffer);
|
6211 | })
|
6212 | .catch(reject);
|
6213 | });
|
6214 |
|
6215 | fr.addEventListener("error", reject);
|
6216 | } else {
|
6217 | reject(Error(`Unsupported file type ${this.src.type}`));
|
6218 | }
|
6219 | });
|
6220 | }
|
6221 | });
|
6222 |
|
6223 | ;
|
6224 |
|
6225 |
|
6226 | class IdentityLoader extends Loader {
|
6227 | load() {
|
6228 | return Promise.resolve(this.src);
|
6229 | }
|
6230 | }
|
6231 |
|
6232 | ;
|
6233 |
|
6234 |
|
6235 | const XHRLoader = (class extends Loader {
|
6236 | |
6237 |
|
6238 |
|
6239 | load() {
|
6240 | return new Promise((resolve, reject) => {
|
6241 | const xhr = new XMLHttpRequest();
|
6242 |
|
6243 | xhr.open("GET", this.src, true);
|
6244 | xhr.responseType = "arraybuffer";
|
6245 | xhr.send();
|
6246 |
|
6247 | xhr.addEventListener("progress", (e) => {
|
6248 | super.fileProgress(e);
|
6249 | });
|
6250 |
|
6251 | xhr.addEventListener("load", (e) => {
|
6252 | const decoderPromise = super.fileLoad(e);
|
6253 |
|
6254 | decoderPromise
|
6255 | .then((audioBuffer) => {
|
6256 | resolve(audioBuffer);
|
6257 | })
|
6258 | .catch(reject);
|
6259 | });
|
6260 |
|
6261 | xhr.addEventListener("error", () => {
|
6262 | reject(Error(`Track ${this.src} failed to load`));
|
6263 | });
|
6264 | });
|
6265 | }
|
6266 | });
|
6267 |
|
6268 | ;
|
6269 |
|
6270 |
|
6271 |
|
6272 |
|
6273 | const LoaderFactory = (class {
|
6274 | static createLoader(src, audioContext, ee) {
|
6275 | if (src instanceof Blob) {
|
6276 | return new BlobLoader(src, audioContext, ee);
|
6277 | } else if (src instanceof AudioBuffer) {
|
6278 | return new IdentityLoader(src, audioContext, ee);
|
6279 | } else if (typeof src === "string") {
|
6280 | return new XHRLoader(src, audioContext, ee);
|
6281 | }
|
6282 |
|
6283 | throw new Error("Unsupported src type");
|
6284 | }
|
6285 | });
|
6286 |
|
6287 | ;
|
6288 |
|
6289 |
|
6290 |
|
6291 |
|
6292 |
|
6293 | const ScrollHook = (class {
|
6294 | constructor(playlist) {
|
6295 | this.playlist = playlist;
|
6296 | }
|
6297 |
|
6298 | hook(node) {
|
6299 | const playlist = this.playlist;
|
6300 | if (!playlist.isScrolling) {
|
6301 | const el = node;
|
6302 |
|
6303 | if (playlist.isAutomaticScroll) {
|
6304 | const rect = node.getBoundingClientRect();
|
6305 | const controlWidth = playlist.controls.show
|
6306 | ? playlist.controls.width
|
6307 | : 0;
|
6308 | const width = pixelsToSeconds(
|
6309 | rect.width - controlWidth,
|
6310 | playlist.samplesPerPixel,
|
6311 | playlist.sampleRate
|
6312 | );
|
6313 |
|
6314 | const timePoint = playlist.isPlaying()
|
6315 | ? playlist.playbackSeconds
|
6316 | : playlist.getTimeSelection().start;
|
6317 |
|
6318 | if (
|
6319 | timePoint < playlist.scrollLeft ||
|
6320 | timePoint >= playlist.scrollLeft + width
|
6321 | ) {
|
6322 | playlist.scrollLeft = Math.min(timePoint, playlist.duration - width);
|
6323 | }
|
6324 | }
|
6325 |
|
6326 | const left = secondsToPixels(
|
6327 | playlist.scrollLeft,
|
6328 | playlist.samplesPerPixel,
|
6329 | playlist.sampleRate
|
6330 | );
|
6331 |
|
6332 | el.scrollLeft = left;
|
6333 | }
|
6334 | }
|
6335 | });
|
6336 |
|
6337 | ;
|
6338 |
|
6339 |
|
6340 |
|
6341 | const TimeScaleHook = (class {
|
6342 | constructor(tickInfo, offset, samplesPerPixel, duration, colors) {
|
6343 | this.tickInfo = tickInfo;
|
6344 | this.offset = offset;
|
6345 | this.samplesPerPixel = samplesPerPixel;
|
6346 | this.duration = duration;
|
6347 | this.colors = colors;
|
6348 | }
|
6349 |
|
6350 | hook(canvas, prop, prev) {
|
6351 |
|
6352 | if (
|
6353 | prev !== undefined &&
|
6354 | prev.offset === this.offset &&
|
6355 | prev.duration === this.duration &&
|
6356 | prev.samplesPerPixel === this.samplesPerPixel
|
6357 | ) {
|
6358 | return;
|
6359 | }
|
6360 |
|
6361 | const width = canvas.width;
|
6362 | const height = canvas.height;
|
6363 | const ctx = canvas.getContext("2d");
|
6364 |
|
6365 | ctx.clearRect(0, 0, width, height);
|
6366 | ctx.fillStyle = this.colors.timeColor;
|
6367 |
|
6368 | Object.keys(this.tickInfo).forEach((x) => {
|
6369 | const scaleHeight = this.tickInfo[x];
|
6370 | const scaleY = height - scaleHeight;
|
6371 | ctx.fillRect(x, scaleY, 1, scaleHeight);
|
6372 | });
|
6373 | }
|
6374 | });
|
6375 |
|
6376 | ;
|
6377 |
|
6378 |
|
6379 |
|
6380 |
|
6381 |
|
6382 | class TimeScale {
|
6383 | constructor(
|
6384 | duration,
|
6385 | offset,
|
6386 | samplesPerPixel,
|
6387 | sampleRate,
|
6388 | marginLeft = 0,
|
6389 | colors
|
6390 | ) {
|
6391 | this.duration = duration;
|
6392 | this.offset = offset;
|
6393 | this.samplesPerPixel = samplesPerPixel;
|
6394 | this.sampleRate = sampleRate;
|
6395 | this.marginLeft = marginLeft;
|
6396 | this.colors = colors;
|
6397 |
|
6398 | this.timeinfo = {
|
6399 | 20000: {
|
6400 | marker: 30000,
|
6401 | bigStep: 10000,
|
6402 | smallStep: 5000,
|
6403 | secondStep: 5,
|
6404 | },
|
6405 | 12000: {
|
6406 | marker: 15000,
|
6407 | bigStep: 5000,
|
6408 | smallStep: 1000,
|
6409 | secondStep: 1,
|
6410 | },
|
6411 | 10000: {
|
6412 | marker: 10000,
|
6413 | bigStep: 5000,
|
6414 | smallStep: 1000,
|
6415 | secondStep: 1,
|
6416 | },
|
6417 | 5000: {
|
6418 | marker: 5000,
|
6419 | bigStep: 1000,
|
6420 | smallStep: 500,
|
6421 | secondStep: 1 / 2,
|
6422 | },
|
6423 | 2500: {
|
6424 | marker: 2000,
|
6425 | bigStep: 1000,
|
6426 | smallStep: 500,
|
6427 | secondStep: 1 / 2,
|
6428 | },
|
6429 | 1500: {
|
6430 | marker: 2000,
|
6431 | bigStep: 1000,
|
6432 | smallStep: 200,
|
6433 | secondStep: 1 / 5,
|
6434 | },
|
6435 | 700: {
|
6436 | marker: 1000,
|
6437 | bigStep: 500,
|
6438 | smallStep: 100,
|
6439 | secondStep: 1 / 10,
|
6440 | },
|
6441 | };
|
6442 | }
|
6443 |
|
6444 | getScaleInfo(resolution) {
|
6445 | let keys = Object.keys(this.timeinfo).map((item) => parseInt(item, 10));
|
6446 |
|
6447 |
|
6448 | keys = keys.sort((a, b) => a - b);
|
6449 |
|
6450 | for (let i = 0; i < keys.length; i += 1) {
|
6451 | if (resolution <= keys[i]) {
|
6452 | return this.timeinfo[keys[i]];
|
6453 | }
|
6454 | }
|
6455 |
|
6456 | return this.timeinfo[keys[0]];
|
6457 | }
|
6458 |
|
6459 | |
6460 |
|
6461 |
|
6462 | static formatTime(milliseconds) {
|
6463 | const seconds = milliseconds / 1000;
|
6464 | let s = seconds % 60;
|
6465 | const m = (seconds - s) / 60;
|
6466 |
|
6467 | if (s < 10) {
|
6468 | s = `0${s}`;
|
6469 | }
|
6470 |
|
6471 | return `${m}:${s}`;
|
6472 | }
|
6473 |
|
6474 | render() {
|
6475 | const widthX = secondsToPixels(
|
6476 | this.duration,
|
6477 | this.samplesPerPixel,
|
6478 | this.sampleRate
|
6479 | );
|
6480 | const pixPerSec = this.sampleRate / this.samplesPerPixel;
|
6481 | const pixOffset = secondsToPixels(
|
6482 | this.offset,
|
6483 | this.samplesPerPixel,
|
6484 | this.sampleRate
|
6485 | );
|
6486 | const scaleInfo = this.getScaleInfo(this.samplesPerPixel);
|
6487 | const canvasInfo = {};
|
6488 | const timeMarkers = [];
|
6489 | const end = widthX + pixOffset;
|
6490 | let counter = 0;
|
6491 |
|
6492 | for (let i = 0; i < end; i += pixPerSec * scaleInfo.secondStep) {
|
6493 | const pixIndex = Math.floor(i);
|
6494 | const pix = pixIndex - pixOffset;
|
6495 |
|
6496 | if (pixIndex >= pixOffset) {
|
6497 |
|
6498 | if (scaleInfo.marker && counter % scaleInfo.marker === 0) {
|
6499 | timeMarkers.push(
|
6500 | h_default()(
|
6501 | "div.time",
|
6502 | {
|
6503 | attributes: {
|
6504 | style: `position: absolute; left: ${pix}px;`,
|
6505 | },
|
6506 | },
|
6507 | [TimeScale.formatTime(counter)]
|
6508 | )
|
6509 | );
|
6510 |
|
6511 | canvasInfo[pix] = 10;
|
6512 | } else if (scaleInfo.bigStep && counter % scaleInfo.bigStep === 0) {
|
6513 | canvasInfo[pix] = 5;
|
6514 | } else if (scaleInfo.smallStep && counter % scaleInfo.smallStep === 0) {
|
6515 | canvasInfo[pix] = 2;
|
6516 | }
|
6517 | }
|
6518 |
|
6519 | counter += 1000 * scaleInfo.secondStep;
|
6520 | }
|
6521 |
|
6522 | return h_default()(
|
6523 | "div.playlist-time-scale",
|
6524 | {
|
6525 | attributes: {
|
6526 | style: `position: relative; left: 0; right: 0; margin-left: ${this.marginLeft}px;`,
|
6527 | },
|
6528 | },
|
6529 | [
|
6530 | timeMarkers,
|
6531 | h_default()("canvas", {
|
6532 | attributes: {
|
6533 | width: widthX,
|
6534 | height: 30,
|
6535 | style: "position: absolute; left: 0; right: 0; top: 0; bottom: 0;",
|
6536 | },
|
6537 | hook: new TimeScaleHook(
|
6538 | canvasInfo,
|
6539 | this.offset,
|
6540 | this.samplesPerPixel,
|
6541 | this.duration,
|
6542 | this.colors
|
6543 | ),
|
6544 | }),
|
6545 | ]
|
6546 | );
|
6547 | }
|
6548 | }
|
6549 |
|
6550 | const src_TimeScale = (TimeScale);
|
6551 |
|
6552 |
|
6553 | var lodash_assign = __webpack_require__(1730);
|
6554 | var lodash_assign_default = __webpack_require__.n(lodash_assign);
|
6555 |
|
6556 | var lodash_forown = __webpack_require__(3520);
|
6557 | var lodash_forown_default = __webpack_require__.n(lodash_forown);
|
6558 | ;
|
6559 |
|
6560 |
|
6561 |
|
6562 | var getRandomValues;
|
6563 | var rnds8 = new Uint8Array(16);
|
6564 | function rng() {
|
6565 |
|
6566 | if (!getRandomValues) {
|
6567 |
|
6568 |
|
6569 | getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || typeof msCrypto !== 'undefined' && typeof msCrypto.getRandomValues === 'function' && msCrypto.getRandomValues.bind(msCrypto);
|
6570 |
|
6571 | if (!getRandomValues) {
|
6572 | throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
|
6573 | }
|
6574 | }
|
6575 |
|
6576 | return getRandomValues(rnds8);
|
6577 | }
|
6578 | ;
|
6579 | const regex = (/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i);
|
6580 | ;
|
6581 |
|
6582 |
|
6583 | function validate(uuid) {
|
6584 | return typeof uuid === 'string' && regex.test(uuid);
|
6585 | }
|
6586 |
|
6587 | const esm_browser_validate = (validate);
|
6588 | ;
|
6589 |
|
6590 |
|
6591 |
|
6592 |
|
6593 |
|
6594 |
|
6595 | var byteToHex = [];
|
6596 |
|
6597 | for (var i = 0; i < 256; ++i) {
|
6598 | byteToHex.push((i + 0x100).toString(16).substr(1));
|
6599 | }
|
6600 |
|
6601 | function stringify(arr) {
|
6602 | var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
6603 |
|
6604 |
|
6605 | var uuid = (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase();
|
6606 |
|
6607 |
|
6608 |
|
6609 |
|
6610 |
|
6611 | if (!esm_browser_validate(uuid)) {
|
6612 | throw TypeError('Stringified UUID is invalid');
|
6613 | }
|
6614 |
|
6615 | return uuid;
|
6616 | }
|
6617 |
|
6618 | const esm_browser_stringify = (stringify);
|
6619 | ;
|
6620 |
|
6621 |
|
6622 |
|
6623 | function v4(options, buf, offset) {
|
6624 | options = options || {};
|
6625 | var rnds = options.random || (options.rng || rng)();
|
6626 |
|
6627 | rnds[6] = rnds[6] & 0x0f | 0x40;
|
6628 | rnds[8] = rnds[8] & 0x3f | 0x80;
|
6629 |
|
6630 | if (buf) {
|
6631 | offset = offset || 0;
|
6632 |
|
6633 | for (var i = 0; i < 16; ++i) {
|
6634 | buf[offset + i] = rnds[i];
|
6635 | }
|
6636 |
|
6637 | return buf;
|
6638 | }
|
6639 |
|
6640 | return esm_browser_stringify(rnds);
|
6641 | }
|
6642 |
|
6643 | const esm_browser_v4 = (v4);
|
6644 |
|
6645 | var webaudio_peaks = __webpack_require__(4991);
|
6646 | var webaudio_peaks_default = __webpack_require__.n(webaudio_peaks);
|
6647 |
|
6648 | var fade_maker = __webpack_require__(1114);
|
6649 | ;
|
6650 |
|
6651 |
|
6652 | const CursorState = (class {
|
6653 | constructor(track) {
|
6654 | this.track = track;
|
6655 | }
|
6656 |
|
6657 | setup(samplesPerPixel, sampleRate) {
|
6658 | this.samplesPerPixel = samplesPerPixel;
|
6659 | this.sampleRate = sampleRate;
|
6660 | }
|
6661 |
|
6662 | click(e) {
|
6663 | e.preventDefault();
|
6664 |
|
6665 | const startX = e.offsetX;
|
6666 | const startTime = pixelsToSeconds(
|
6667 | startX,
|
6668 | this.samplesPerPixel,
|
6669 | this.sampleRate
|
6670 | );
|
6671 |
|
6672 | this.track.ee.emit("select", startTime, startTime, this.track);
|
6673 | }
|
6674 |
|
6675 | static getClass() {
|
6676 | return ".state-cursor";
|
6677 | }
|
6678 |
|
6679 | static getEvents() {
|
6680 | return ["click"];
|
6681 | }
|
6682 | });
|
6683 |
|
6684 | ;
|
6685 |
|
6686 |
|
6687 | const SelectState = (class {
|
6688 | constructor(track) {
|
6689 | this.track = track;
|
6690 | this.active = false;
|
6691 | }
|
6692 |
|
6693 | setup(samplesPerPixel, sampleRate) {
|
6694 | this.samplesPerPixel = samplesPerPixel;
|
6695 | this.sampleRate = sampleRate;
|
6696 | }
|
6697 |
|
6698 | emitSelection(x) {
|
6699 | const minX = Math.min(x, this.startX);
|
6700 | const maxX = Math.max(x, this.startX);
|
6701 | const startTime = pixelsToSeconds(
|
6702 | minX,
|
6703 | this.samplesPerPixel,
|
6704 | this.sampleRate
|
6705 | );
|
6706 | const endTime = pixelsToSeconds(
|
6707 | maxX,
|
6708 | this.samplesPerPixel,
|
6709 | this.sampleRate
|
6710 | );
|
6711 |
|
6712 | this.track.ee.emit("select", startTime, endTime, this.track);
|
6713 | }
|
6714 |
|
6715 | complete(x) {
|
6716 | this.emitSelection(x);
|
6717 | this.active = false;
|
6718 | }
|
6719 |
|
6720 | mousedown(e) {
|
6721 | e.preventDefault();
|
6722 | this.active = true;
|
6723 |
|
6724 | this.startX = e.offsetX;
|
6725 | const startTime = pixelsToSeconds(
|
6726 | this.startX,
|
6727 | this.samplesPerPixel,
|
6728 | this.sampleRate
|
6729 | );
|
6730 |
|
6731 | this.track.ee.emit("select", startTime, startTime, this.track);
|
6732 | }
|
6733 |
|
6734 | mousemove(e) {
|
6735 | if (this.active) {
|
6736 | e.preventDefault();
|
6737 | this.emitSelection(e.offsetX);
|
6738 | }
|
6739 | }
|
6740 |
|
6741 | mouseup(e) {
|
6742 | if (this.active) {
|
6743 | e.preventDefault();
|
6744 | this.complete(e.offsetX);
|
6745 | }
|
6746 | }
|
6747 |
|
6748 | mouseleave(e) {
|
6749 | if (this.active) {
|
6750 | e.preventDefault();
|
6751 | this.complete(e.offsetX);
|
6752 | }
|
6753 | }
|
6754 |
|
6755 | static getClass() {
|
6756 | return ".state-select";
|
6757 | }
|
6758 |
|
6759 | static getEvents() {
|
6760 | return ["mousedown", "mousemove", "mouseup", "mouseleave"];
|
6761 | }
|
6762 | });
|
6763 |
|
6764 | ;
|
6765 |
|
6766 |
|
6767 | const ShiftState = (class {
|
6768 | constructor(track) {
|
6769 | this.track = track;
|
6770 | this.active = false;
|
6771 | }
|
6772 |
|
6773 | setup(samplesPerPixel, sampleRate) {
|
6774 | this.samplesPerPixel = samplesPerPixel;
|
6775 | this.sampleRate = sampleRate;
|
6776 | }
|
6777 |
|
6778 | emitShift(x) {
|
6779 | const deltaX = x - this.prevX;
|
6780 | const deltaTime = pixelsToSeconds(
|
6781 | deltaX,
|
6782 | this.samplesPerPixel,
|
6783 | this.sampleRate
|
6784 | );
|
6785 | this.prevX = x;
|
6786 | this.track.ee.emit("shift", deltaTime, this.track);
|
6787 | }
|
6788 |
|
6789 | complete(x) {
|
6790 | this.emitShift(x);
|
6791 | this.active = false;
|
6792 | }
|
6793 |
|
6794 | mousedown(e) {
|
6795 | e.preventDefault();
|
6796 |
|
6797 | this.active = true;
|
6798 | this.el = e.target;
|
6799 | this.prevX = e.offsetX;
|
6800 | }
|
6801 |
|
6802 | mousemove(e) {
|
6803 | if (this.active) {
|
6804 | e.preventDefault();
|
6805 | this.emitShift(e.offsetX);
|
6806 | }
|
6807 | }
|
6808 |
|
6809 | mouseup(e) {
|
6810 | if (this.active) {
|
6811 | e.preventDefault();
|
6812 | this.complete(e.offsetX);
|
6813 | }
|
6814 | }
|
6815 |
|
6816 | mouseleave(e) {
|
6817 | if (this.active) {
|
6818 | e.preventDefault();
|
6819 | this.complete(e.offsetX);
|
6820 | }
|
6821 | }
|
6822 |
|
6823 | static getClass() {
|
6824 | return ".state-shift";
|
6825 | }
|
6826 |
|
6827 | static getEvents() {
|
6828 | return ["mousedown", "mousemove", "mouseup", "mouseleave"];
|
6829 | }
|
6830 | });
|
6831 |
|
6832 | ;
|
6833 |
|
6834 |
|
6835 | const FadeInState = (class {
|
6836 | constructor(track) {
|
6837 | this.track = track;
|
6838 | }
|
6839 |
|
6840 | setup(samplesPerPixel, sampleRate) {
|
6841 | this.samplesPerPixel = samplesPerPixel;
|
6842 | this.sampleRate = sampleRate;
|
6843 | }
|
6844 |
|
6845 | click(e) {
|
6846 | const startX = e.offsetX;
|
6847 | const time = pixelsToSeconds(startX, this.samplesPerPixel, this.sampleRate);
|
6848 |
|
6849 | if (time > this.track.getStartTime() && time < this.track.getEndTime()) {
|
6850 | this.track.ee.emit(
|
6851 | "fadein",
|
6852 | time - this.track.getStartTime(),
|
6853 | this.track
|
6854 | );
|
6855 | }
|
6856 | }
|
6857 |
|
6858 | static getClass() {
|
6859 | return ".state-fadein";
|
6860 | }
|
6861 |
|
6862 | static getEvents() {
|
6863 | return ["click"];
|
6864 | }
|
6865 | });
|
6866 |
|
6867 | ;
|
6868 |
|
6869 |
|
6870 | const FadeOutState = (class {
|
6871 | constructor(track) {
|
6872 | this.track = track;
|
6873 | }
|
6874 |
|
6875 | setup(samplesPerPixel, sampleRate) {
|
6876 | this.samplesPerPixel = samplesPerPixel;
|
6877 | this.sampleRate = sampleRate;
|
6878 | }
|
6879 |
|
6880 | click(e) {
|
6881 | const startX = e.offsetX;
|
6882 | const time = pixelsToSeconds(startX, this.samplesPerPixel, this.sampleRate);
|
6883 |
|
6884 | if (time > this.track.getStartTime() && time < this.track.getEndTime()) {
|
6885 | this.track.ee.emit("fadeout", this.track.getEndTime() - time, this.track);
|
6886 | }
|
6887 | }
|
6888 |
|
6889 | static getClass() {
|
6890 | return ".state-fadeout";
|
6891 | }
|
6892 |
|
6893 | static getEvents() {
|
6894 | return ["click"];
|
6895 | }
|
6896 | });
|
6897 |
|
6898 | ;
|
6899 |
|
6900 |
|
6901 |
|
6902 |
|
6903 |
|
6904 |
|
6905 | const states = ({
|
6906 | cursor: CursorState,
|
6907 | select: SelectState,
|
6908 | shift: ShiftState,
|
6909 | fadein: FadeInState,
|
6910 | fadeout: FadeOutState,
|
6911 | });
|
6912 |
|
6913 | ;
|
6914 |
|
6915 |
|
6916 |
|
6917 | class CanvasHook {
|
6918 | constructor(peaks, offset, bits, color, scale, height, barWidth, barGap) {
|
6919 | this.peaks = peaks;
|
6920 |
|
6921 | this.offset = offset;
|
6922 | this.color = color;
|
6923 | this.bits = bits;
|
6924 | this.scale = scale;
|
6925 | this.height = height;
|
6926 | this.barWidth = barWidth;
|
6927 | this.barGap = barGap;
|
6928 | }
|
6929 |
|
6930 | static drawFrame(cc, h2, x, minPeak, maxPeak, width, gap) {
|
6931 | const min = Math.abs(minPeak * h2);
|
6932 | const max = Math.abs(maxPeak * h2);
|
6933 |
|
6934 |
|
6935 | cc.fillRect(x, 0, width, h2 - max);
|
6936 |
|
6937 | cc.fillRect(x, h2 + min, width, h2 - min);
|
6938 |
|
6939 | if (gap !== 0) {
|
6940 | cc.fillRect(x + width, 0, gap, h2 * 2);
|
6941 | }
|
6942 | }
|
6943 |
|
6944 | hook(canvas, prop, prev) {
|
6945 |
|
6946 | if (
|
6947 | prev !== undefined &&
|
6948 | prev.peaks === this.peaks &&
|
6949 | prev.scale === this.scale &&
|
6950 | prev.height === this.height
|
6951 | ) {
|
6952 | return;
|
6953 | }
|
6954 |
|
6955 | const scale = this.scale;
|
6956 | const len = canvas.width / scale;
|
6957 | const cc = canvas.getContext("2d");
|
6958 | const h2 = canvas.height / scale / 2;
|
6959 | const maxValue = 2 ** (this.bits - 1);
|
6960 | const width = this.barWidth;
|
6961 | const gap = this.barGap;
|
6962 | const barStart = width + gap;
|
6963 |
|
6964 | cc.clearRect(0, 0, canvas.width, canvas.height);
|
6965 |
|
6966 | cc.save();
|
6967 | cc.fillStyle = this.color;
|
6968 | cc.scale(scale, scale);
|
6969 |
|
6970 | for (let pixel = 0; pixel < len; pixel += barStart) {
|
6971 | const minPeak = this.peaks[(pixel + this.offset) * 2] / maxValue;
|
6972 | const maxPeak = this.peaks[(pixel + this.offset) * 2 + 1] / maxValue;
|
6973 | CanvasHook.drawFrame(cc, h2, pixel, minPeak, maxPeak, width, gap);
|
6974 | }
|
6975 |
|
6976 | cc.restore();
|
6977 | }
|
6978 | }
|
6979 |
|
6980 | const render_CanvasHook = (CanvasHook);
|
6981 |
|
6982 |
|
6983 | var fade_curves = __webpack_require__(6226);
|
6984 | ;
|
6985 |
|
6986 |
|
6987 |
|
6988 |
|
6989 |
|
6990 |
|
6991 | class FadeCanvasHook {
|
6992 | constructor(type, shape, duration, samplesPerPixel) {
|
6993 | this.type = type;
|
6994 | this.shape = shape;
|
6995 | this.duration = duration;
|
6996 | this.samplesPerPixel = samplesPerPixel;
|
6997 | }
|
6998 |
|
6999 | static createCurve(shape, type, width) {
|
7000 | let reflection;
|
7001 | let curve;
|
7002 |
|
7003 | switch (type) {
|
7004 | case fade_maker.Y1: {
|
7005 | reflection = 1;
|
7006 | break;
|
7007 | }
|
7008 | case fade_maker.h7: {
|
7009 | reflection = -1;
|
7010 | break;
|
7011 | }
|
7012 | default: {
|
7013 | throw new Error("Unsupported fade type.");
|
7014 | }
|
7015 | }
|
7016 |
|
7017 | switch (shape) {
|
7018 | case fade_maker._h: {
|
7019 | curve = (0,fade_curves.sCurve)(width, reflection);
|
7020 | break;
|
7021 | }
|
7022 | case fade_maker.t$: {
|
7023 | curve = (0,fade_curves.linear)(width, reflection);
|
7024 | break;
|
7025 | }
|
7026 | case fade_maker.Jl: {
|
7027 | curve = (0,fade_curves.exponential)(width, reflection);
|
7028 | break;
|
7029 | }
|
7030 | case fade_maker.Hp: {
|
7031 | curve = (0,fade_curves.logarithmic)(width, 10, reflection);
|
7032 | break;
|
7033 | }
|
7034 | default: {
|
7035 | throw new Error("Unsupported fade shape");
|
7036 | }
|
7037 | }
|
7038 |
|
7039 | return curve;
|
7040 | }
|
7041 |
|
7042 | hook(canvas, prop, prev) {
|
7043 |
|
7044 | if (
|
7045 | prev !== undefined &&
|
7046 | prev.shape === this.shape &&
|
7047 | prev.type === this.type &&
|
7048 | prev.duration === this.duration &&
|
7049 | prev.samplesPerPixel === this.samplesPerPixel
|
7050 | ) {
|
7051 | return;
|
7052 | }
|
7053 |
|
7054 | const ctx = canvas.getContext("2d");
|
7055 | const width = canvas.width;
|
7056 | const height = canvas.height;
|
7057 | const curve = FadeCanvasHook.createCurve(this.shape, this.type, width);
|
7058 | const len = curve.length;
|
7059 | let y = height - curve[0] * height;
|
7060 |
|
7061 | ctx.clearRect(0, 0, canvas.width, canvas.height);
|
7062 | ctx.save();
|
7063 |
|
7064 | ctx.strokeStyle = "black";
|
7065 | ctx.beginPath();
|
7066 | ctx.moveTo(0, y);
|
7067 |
|
7068 | for (let i = 1; i < len; i += 1) {
|
7069 | y = height - curve[i] * height;
|
7070 | ctx.lineTo(i, y);
|
7071 | }
|
7072 | ctx.stroke();
|
7073 | ctx.restore();
|
7074 | }
|
7075 | }
|
7076 |
|
7077 | const render_FadeCanvasHook = (FadeCanvasHook);
|
7078 |
|
7079 | ;
|
7080 |
|
7081 |
|
7082 |
|
7083 |
|
7084 | const VolumeSliderHook = (class {
|
7085 | constructor(gain) {
|
7086 | this.gain = gain;
|
7087 | }
|
7088 |
|
7089 | hook(volumeInput) {
|
7090 | volumeInput.value = this.gain * 100;
|
7091 | volumeInput.title = `${Math.round(this.gain * 100)}% volume`;
|
7092 | }
|
7093 | });
|
7094 |
|
7095 | ;
|
7096 |
|
7097 |
|
7098 |
|
7099 |
|
7100 | const StereoPanSliderHook = (class {
|
7101 | constructor(stereoPan) {
|
7102 | this.stereoPan = stereoPan;
|
7103 | }
|
7104 |
|
7105 | hook(stereoPanInput) {
|
7106 | stereoPanInput.value = this.stereoPan * 100;
|
7107 |
|
7108 | let panOrientation;
|
7109 | if (this.stereoPan === 0) {
|
7110 | panOrientation = "Center";
|
7111 | } else if (this.stereoPan < 0) {
|
7112 | panOrientation = "Left";
|
7113 | } else {
|
7114 | panOrientation = "Right";
|
7115 | }
|
7116 | const percentage = `${Math.abs(Math.round(this.stereoPan * 100))}% `;
|
7117 | stereoPanInput.title = `Pan: ${
|
7118 | this.stereoPan !== 0 ? percentage : ""
|
7119 | }${panOrientation}`;
|
7120 | }
|
7121 | });
|
7122 |
|
7123 | ;
|
7124 |
|
7125 |
|
7126 |
|
7127 |
|
7128 |
|
7129 |
|
7130 |
|
7131 |
|
7132 |
|
7133 |
|
7134 |
|
7135 |
|
7136 |
|
7137 |
|
7138 |
|
7139 |
|
7140 |
|
7141 | const MAX_CANVAS_WIDTH = 1000;
|
7142 |
|
7143 | const Track = (class {
|
7144 | constructor() {
|
7145 | this.name = "Untitled";
|
7146 | this.customClass = undefined;
|
7147 | this.waveOutlineColor = undefined;
|
7148 | this.gain = 1;
|
7149 | this.fades = {};
|
7150 | this.peakData = {
|
7151 | type: "WebAudio",
|
7152 | mono: false,
|
7153 | };
|
7154 |
|
7155 | this.cueIn = 0;
|
7156 | this.cueOut = 0;
|
7157 | this.duration = 0;
|
7158 | this.startTime = 0;
|
7159 | this.endTime = 0;
|
7160 | this.stereoPan = 0;
|
7161 | }
|
7162 |
|
7163 | setEventEmitter(ee) {
|
7164 | this.ee = ee;
|
7165 | }
|
7166 |
|
7167 | setName(name) {
|
7168 | this.name = name;
|
7169 | }
|
7170 |
|
7171 | setCustomClass(className) {
|
7172 | this.customClass = className;
|
7173 | }
|
7174 |
|
7175 | setWaveOutlineColor(color) {
|
7176 | this.waveOutlineColor = color;
|
7177 | }
|
7178 |
|
7179 | setCues(cueIn, cueOut) {
|
7180 | if (cueOut < cueIn) {
|
7181 | throw new Error("cue out cannot be less than cue in");
|
7182 | }
|
7183 |
|
7184 | this.cueIn = cueIn;
|
7185 | this.cueOut = cueOut;
|
7186 | this.duration = this.cueOut - this.cueIn;
|
7187 | this.endTime = this.startTime + this.duration;
|
7188 | }
|
7189 |
|
7190 | |
7191 |
|
7192 |
|
7193 | trim(start, end) {
|
7194 | const trackStart = this.getStartTime();
|
7195 | const trackEnd = this.getEndTime();
|
7196 | const offset = this.cueIn - trackStart;
|
7197 |
|
7198 | if (
|
7199 | (trackStart <= start && trackEnd >= start) ||
|
7200 | (trackStart <= end && trackEnd >= end)
|
7201 | ) {
|
7202 | const cueIn = start < trackStart ? trackStart : start;
|
7203 | const cueOut = end > trackEnd ? trackEnd : end;
|
7204 |
|
7205 | this.setCues(cueIn + offset, cueOut + offset);
|
7206 | if (start > trackStart) {
|
7207 | this.setStartTime(start);
|
7208 | }
|
7209 | }
|
7210 | }
|
7211 |
|
7212 | setStartTime(start) {
|
7213 | this.startTime = start;
|
7214 | this.endTime = start + this.duration;
|
7215 | }
|
7216 |
|
7217 | setPlayout(playout) {
|
7218 | this.playout = playout;
|
7219 | }
|
7220 |
|
7221 | setOfflinePlayout(playout) {
|
7222 | this.offlinePlayout = playout;
|
7223 | }
|
7224 |
|
7225 | setEnabledStates(enabledStates = {}) {
|
7226 | const defaultStatesEnabled = {
|
7227 | cursor: true,
|
7228 | fadein: true,
|
7229 | fadeout: true,
|
7230 | select: true,
|
7231 | shift: true,
|
7232 | };
|
7233 |
|
7234 | this.enabledStates = lodash_assign_default()({}, defaultStatesEnabled, enabledStates);
|
7235 | }
|
7236 |
|
7237 | setFadeIn(duration, shape = "logarithmic") {
|
7238 | if (duration > this.duration) {
|
7239 | throw new Error("Invalid Fade In");
|
7240 | }
|
7241 |
|
7242 | const fade = {
|
7243 | shape,
|
7244 | start: 0,
|
7245 | end: duration,
|
7246 | };
|
7247 |
|
7248 | if (this.fadeIn) {
|
7249 | this.removeFade(this.fadeIn);
|
7250 | this.fadeIn = undefined;
|
7251 | }
|
7252 |
|
7253 | this.fadeIn = this.saveFade(fade_maker.Y1, fade.shape, fade.start, fade.end);
|
7254 | }
|
7255 |
|
7256 | setFadeOut(duration, shape = "logarithmic") {
|
7257 | if (duration > this.duration) {
|
7258 | throw new Error("Invalid Fade Out");
|
7259 | }
|
7260 |
|
7261 | const fade = {
|
7262 | shape,
|
7263 | start: this.duration - duration,
|
7264 | end: this.duration,
|
7265 | };
|
7266 |
|
7267 | if (this.fadeOut) {
|
7268 | this.removeFade(this.fadeOut);
|
7269 | this.fadeOut = undefined;
|
7270 | }
|
7271 |
|
7272 | this.fadeOut = this.saveFade(fade_maker.h7, fade.shape, fade.start, fade.end);
|
7273 | }
|
7274 |
|
7275 | saveFade(type, shape, start, end) {
|
7276 | const id = esm_browser_v4();
|
7277 |
|
7278 | this.fades[id] = {
|
7279 | type,
|
7280 | shape,
|
7281 | start,
|
7282 | end,
|
7283 | };
|
7284 |
|
7285 | return id;
|
7286 | }
|
7287 |
|
7288 | removeFade(id) {
|
7289 | delete this.fades[id];
|
7290 | }
|
7291 |
|
7292 | setBuffer(buffer) {
|
7293 | this.buffer = buffer;
|
7294 | }
|
7295 |
|
7296 | setPeakData(data) {
|
7297 | this.peakData = data;
|
7298 | }
|
7299 |
|
7300 | calculatePeaks(samplesPerPixel, sampleRate) {
|
7301 | const cueIn = secondsToSamples(this.cueIn, sampleRate);
|
7302 | const cueOut = secondsToSamples(this.cueOut, sampleRate);
|
7303 |
|
7304 | this.setPeaks(
|
7305 | webaudio_peaks_default()(
|
7306 | this.buffer,
|
7307 | samplesPerPixel,
|
7308 | this.peakData.mono,
|
7309 | cueIn,
|
7310 | cueOut
|
7311 | )
|
7312 | );
|
7313 | }
|
7314 |
|
7315 | setPeaks(peaks) {
|
7316 | this.peaks = peaks;
|
7317 | }
|
7318 |
|
7319 | setState(state) {
|
7320 | this.state = state;
|
7321 |
|
7322 | if (this.state && this.enabledStates[this.state]) {
|
7323 | const StateClass = states[this.state];
|
7324 | this.stateObj = new StateClass(this);
|
7325 | } else {
|
7326 | this.stateObj = undefined;
|
7327 | }
|
7328 | }
|
7329 |
|
7330 | getStartTime() {
|
7331 | return this.startTime;
|
7332 | }
|
7333 |
|
7334 | getEndTime() {
|
7335 | return this.endTime;
|
7336 | }
|
7337 |
|
7338 | getDuration() {
|
7339 | return this.duration;
|
7340 | }
|
7341 |
|
7342 | isPlaying() {
|
7343 | return this.playout.isPlaying();
|
7344 | }
|
7345 |
|
7346 | setShouldPlay(bool) {
|
7347 | this.playout.setShouldPlay(bool);
|
7348 | }
|
7349 |
|
7350 | setGainLevel(level) {
|
7351 | this.gain = level;
|
7352 | this.playout.setVolumeGainLevel(level);
|
7353 | }
|
7354 |
|
7355 | setMasterGainLevel(level) {
|
7356 | this.playout.setMasterGainLevel(level);
|
7357 | }
|
7358 |
|
7359 | setStereoPanValue(value) {
|
7360 | this.stereoPan = value;
|
7361 | this.playout.setStereoPanValue(value);
|
7362 | }
|
7363 |
|
7364 | |
7365 |
|
7366 |
|
7367 |
|
7368 |
|
7369 |
|
7370 |
|
7371 | schedulePlay(now, startTime, endTime, config) {
|
7372 | let start;
|
7373 | let duration;
|
7374 | let when = now;
|
7375 | let segment = endTime ? endTime - startTime : undefined;
|
7376 |
|
7377 | const defaultOptions = {
|
7378 | shouldPlay: true,
|
7379 | masterGain: 1,
|
7380 | isOffline: false,
|
7381 | };
|
7382 |
|
7383 | const options = lodash_assign_default()({}, defaultOptions, config);
|
7384 | const playoutSystem = options.isOffline
|
7385 | ? this.offlinePlayout
|
7386 | : this.playout;
|
7387 |
|
7388 |
|
7389 |
|
7390 | if (
|
7391 | this.endTime <= startTime ||
|
7392 | (segment && startTime + segment < this.startTime)
|
7393 | ) {
|
7394 |
|
7395 | return Promise.resolve();
|
7396 | }
|
7397 |
|
7398 |
|
7399 |
|
7400 |
|
7401 | if (this.startTime >= startTime) {
|
7402 | start = 0;
|
7403 |
|
7404 | when += this.startTime - startTime;
|
7405 |
|
7406 | if (endTime) {
|
7407 | segment -= this.startTime - startTime;
|
7408 | duration = Math.min(segment, this.duration);
|
7409 | } else {
|
7410 | duration = this.duration;
|
7411 | }
|
7412 | } else {
|
7413 | start = startTime - this.startTime;
|
7414 |
|
7415 | if (endTime) {
|
7416 | duration = Math.min(segment, this.duration - start);
|
7417 | } else {
|
7418 | duration = this.duration - start;
|
7419 | }
|
7420 | }
|
7421 |
|
7422 | start += this.cueIn;
|
7423 | const relPos = startTime - this.startTime;
|
7424 | const sourcePromise = playoutSystem.setUpSource();
|
7425 |
|
7426 |
|
7427 |
|
7428 | lodash_forown_default()(this.fades, (fade) => {
|
7429 | let fadeStart;
|
7430 | let fadeDuration;
|
7431 |
|
7432 |
|
7433 | if (relPos < fade.end) {
|
7434 | if (relPos <= fade.start) {
|
7435 | fadeStart = now + (fade.start - relPos);
|
7436 | fadeDuration = fade.end - fade.start;
|
7437 | } else if (relPos > fade.start && relPos < fade.end) {
|
7438 | fadeStart = now - (relPos - fade.start);
|
7439 | fadeDuration = fade.end - fade.start;
|
7440 | }
|
7441 |
|
7442 | switch (fade.type) {
|
7443 | case fade_maker.Y1: {
|
7444 | playoutSystem.applyFadeIn(fadeStart, fadeDuration, fade.shape);
|
7445 | break;
|
7446 | }
|
7447 | case fade_maker.h7: {
|
7448 | playoutSystem.applyFadeOut(fadeStart, fadeDuration, fade.shape);
|
7449 | break;
|
7450 | }
|
7451 | default: {
|
7452 | throw new Error("Invalid fade type saved on track.");
|
7453 | }
|
7454 | }
|
7455 | }
|
7456 | });
|
7457 |
|
7458 | playoutSystem.setVolumeGainLevel(this.gain);
|
7459 | playoutSystem.setShouldPlay(options.shouldPlay);
|
7460 | playoutSystem.setMasterGainLevel(options.masterGain);
|
7461 | playoutSystem.setStereoPanValue(this.stereoPan);
|
7462 | playoutSystem.play(when, start, duration);
|
7463 |
|
7464 | return sourcePromise;
|
7465 | }
|
7466 |
|
7467 | scheduleStop(when = 0) {
|
7468 | this.playout.stop(when);
|
7469 | }
|
7470 |
|
7471 | renderOverlay(data) {
|
7472 | const channelPixels = secondsToPixels(
|
7473 | data.playlistLength,
|
7474 | data.resolution,
|
7475 | data.sampleRate
|
7476 | );
|
7477 |
|
7478 | const config = {
|
7479 | attributes: {
|
7480 | style: `position: absolute; top: 0; right: 0; bottom: 0; left: 0; width: ${channelPixels}px; z-index: 9;`,
|
7481 | },
|
7482 | };
|
7483 |
|
7484 | let overlayClass = "";
|
7485 |
|
7486 | if (this.stateObj) {
|
7487 | this.stateObj.setup(data.resolution, data.sampleRate);
|
7488 | const StateClass = states[this.state];
|
7489 | const events = StateClass.getEvents();
|
7490 |
|
7491 | events.forEach((event) => {
|
7492 | config[`on${event}`] = this.stateObj[event].bind(this.stateObj);
|
7493 | });
|
7494 |
|
7495 | overlayClass = StateClass.getClass();
|
7496 | }
|
7497 |
|
7498 | return h_default()(`div.playlist-overlay${overlayClass}`, config);
|
7499 | }
|
7500 |
|
7501 | renderControls(data) {
|
7502 | const muteClass = data.muted ? ".active" : "";
|
7503 | const soloClass = data.soloed ? ".active" : "";
|
7504 | const isCollapsed = data.collapsed;
|
7505 | const numChan = this.peaks.data.length;
|
7506 | const widgets = data.controls.widgets;
|
7507 |
|
7508 | const removeTrack = h_default()(
|
7509 | "button.btn.btn-danger.btn-xs.track-remove",
|
7510 | {
|
7511 | attributes: {
|
7512 | type: "button",
|
7513 | title: "Remove track",
|
7514 | },
|
7515 | onclick: () => {
|
7516 | this.ee.emit("removeTrack", this);
|
7517 | },
|
7518 | },
|
7519 | [h_default()("i.fas.fa-times")]
|
7520 | );
|
7521 |
|
7522 | const trackName = h_default()("span", [this.name]);
|
7523 |
|
7524 | const collapseTrack = h_default()(
|
7525 | "button.btn.btn-info.btn-xs.track-collapse",
|
7526 | {
|
7527 | attributes: {
|
7528 | type: "button",
|
7529 | title: isCollapsed ? "Expand track" : "Collapse track",
|
7530 | },
|
7531 | onclick: () => {
|
7532 | this.ee.emit("changeTrackView", this, {
|
7533 | collapsed: !isCollapsed,
|
7534 | });
|
7535 | },
|
7536 | },
|
7537 | [h_default()(`i.fas.${isCollapsed ? "fa-caret-down" : "fa-caret-up"}`)]
|
7538 | );
|
7539 |
|
7540 | const headerChildren = [];
|
7541 |
|
7542 | if (widgets.remove) {
|
7543 | headerChildren.push(removeTrack);
|
7544 | }
|
7545 | headerChildren.push(trackName);
|
7546 | if (widgets.collapse) {
|
7547 | headerChildren.push(collapseTrack);
|
7548 | }
|
7549 |
|
7550 | const controls = [h_default()("div.track-header", headerChildren)];
|
7551 |
|
7552 | if (!isCollapsed) {
|
7553 | if (widgets.muteOrSolo) {
|
7554 | controls.push(
|
7555 | h_default()("div.btn-group", [
|
7556 | h_default()(
|
7557 | `button.btn.btn-outline-dark.btn-xs.btn-mute${muteClass}`,
|
7558 | {
|
7559 | attributes: {
|
7560 | type: "button",
|
7561 | },
|
7562 | onclick: () => {
|
7563 | this.ee.emit("mute", this);
|
7564 | },
|
7565 | },
|
7566 | ["Mute"]
|
7567 | ),
|
7568 | h_default()(
|
7569 | `button.btn.btn-outline-dark.btn-xs.btn-solo${soloClass}`,
|
7570 | {
|
7571 | onclick: () => {
|
7572 | this.ee.emit("solo", this);
|
7573 | },
|
7574 | },
|
7575 | ["Solo"]
|
7576 | ),
|
7577 | ])
|
7578 | );
|
7579 | }
|
7580 |
|
7581 | if (widgets.volume) {
|
7582 | controls.push(
|
7583 | h_default()("label.volume", [
|
7584 | h_default()("input.volume-slider", {
|
7585 | attributes: {
|
7586 | "aria-label": "Track volume control",
|
7587 | type: "range",
|
7588 | min: 0,
|
7589 | max: 100,
|
7590 | value: 100,
|
7591 | },
|
7592 | hook: new VolumeSliderHook(this.gain),
|
7593 | oninput: (e) => {
|
7594 | this.ee.emit("volumechange", e.target.value, this);
|
7595 | },
|
7596 | }),
|
7597 | ])
|
7598 | );
|
7599 | }
|
7600 |
|
7601 | if (widgets.stereoPan) {
|
7602 | controls.push(
|
7603 | h_default()("label.stereopan", [
|
7604 | h_default()("input.stereopan-slider", {
|
7605 | attributes: {
|
7606 | "aria-label": "Track stereo pan control",
|
7607 | type: "range",
|
7608 | min: -100,
|
7609 | max: 100,
|
7610 | value: 100,
|
7611 | },
|
7612 | hook: new StereoPanSliderHook(this.stereoPan),
|
7613 | oninput: (e) => {
|
7614 | this.ee.emit("stereopan", e.target.value / 100, this);
|
7615 | },
|
7616 | }),
|
7617 | ])
|
7618 | );
|
7619 | }
|
7620 | }
|
7621 |
|
7622 | return h_default()(
|
7623 | "div.controls",
|
7624 | {
|
7625 | attributes: {
|
7626 | style: `height: ${numChan * data.height}px; width: ${
|
7627 | data.controls.width
|
7628 | }px; position: absolute; left: 0; z-index: 10;`,
|
7629 | },
|
7630 | },
|
7631 | controls
|
7632 | );
|
7633 | }
|
7634 |
|
7635 | render(data) {
|
7636 | const width = this.peaks.length;
|
7637 | const playbackX = secondsToPixels(
|
7638 | data.playbackSeconds,
|
7639 | data.resolution,
|
7640 | data.sampleRate
|
7641 | );
|
7642 | const startX = secondsToPixels(
|
7643 | this.startTime,
|
7644 | data.resolution,
|
7645 | data.sampleRate
|
7646 | );
|
7647 | const endX = secondsToPixels(
|
7648 | this.endTime,
|
7649 | data.resolution,
|
7650 | data.sampleRate
|
7651 | );
|
7652 | let progressWidth = 0;
|
7653 | const numChan = this.peaks.data.length;
|
7654 | const scale = Math.floor(window.devicePixelRatio);
|
7655 |
|
7656 | if (playbackX > 0 && playbackX > startX) {
|
7657 | if (playbackX < endX) {
|
7658 | progressWidth = playbackX - startX;
|
7659 | } else {
|
7660 | progressWidth = width;
|
7661 | }
|
7662 | }
|
7663 |
|
7664 | const waveformChildren = [
|
7665 | h_default()("div.cursor", {
|
7666 | attributes: {
|
7667 | style: `position: absolute; width: 1px; margin: 0; padding: 0; top: 0; left: ${playbackX}px; bottom: 0; z-index: 5;`,
|
7668 | },
|
7669 | }),
|
7670 | ];
|
7671 |
|
7672 | const channels = Object.keys(this.peaks.data).map((channelNum) => {
|
7673 | const channelChildren = [
|
7674 | h_default()("div.channel-progress", {
|
7675 | attributes: {
|
7676 | style: `position: absolute; width: ${progressWidth}px; height: ${data.height}px; z-index: 2;`,
|
7677 | },
|
7678 | }),
|
7679 | ];
|
7680 | let offset = 0;
|
7681 | let totalWidth = width;
|
7682 | const peaks = this.peaks.data[channelNum];
|
7683 |
|
7684 | while (totalWidth > 0) {
|
7685 | const currentWidth = Math.min(totalWidth, MAX_CANVAS_WIDTH);
|
7686 | const canvasColor = this.waveOutlineColor
|
7687 | ? this.waveOutlineColor
|
7688 | : data.colors.waveOutlineColor;
|
7689 |
|
7690 | channelChildren.push(
|
7691 | h_default()("canvas", {
|
7692 | attributes: {
|
7693 | width: currentWidth * scale,
|
7694 | height: data.height * scale,
|
7695 | style: `float: left; position: relative; margin: 0; padding: 0; z-index: 3; width: ${currentWidth}px; height: ${data.height}px;`,
|
7696 | },
|
7697 | hook: new render_CanvasHook(
|
7698 | peaks,
|
7699 | offset,
|
7700 | this.peaks.bits,
|
7701 | canvasColor,
|
7702 | scale,
|
7703 | data.height,
|
7704 | data.barWidth,
|
7705 | data.barGap
|
7706 | ),
|
7707 | })
|
7708 | );
|
7709 |
|
7710 | totalWidth -= currentWidth;
|
7711 | offset += MAX_CANVAS_WIDTH;
|
7712 | }
|
7713 |
|
7714 |
|
7715 | if (this.fadeIn) {
|
7716 | const fadeIn = this.fades[this.fadeIn];
|
7717 | const fadeWidth = secondsToPixels(
|
7718 | fadeIn.end - fadeIn.start,
|
7719 | data.resolution,
|
7720 | data.sampleRate
|
7721 | );
|
7722 |
|
7723 | channelChildren.push(
|
7724 | h_default()(
|
7725 | "div.wp-fade.wp-fadein",
|
7726 | {
|
7727 | attributes: {
|
7728 | style: `position: absolute; height: ${data.height}px; width: ${fadeWidth}px; top: 0; left: 0; z-index: 4;`,
|
7729 | },
|
7730 | },
|
7731 | [
|
7732 | h_default()("canvas", {
|
7733 | attributes: {
|
7734 | width: fadeWidth,
|
7735 | height: data.height,
|
7736 | },
|
7737 | hook: new render_FadeCanvasHook(
|
7738 | fadeIn.type,
|
7739 | fadeIn.shape,
|
7740 | fadeIn.end - fadeIn.start,
|
7741 | data.resolution
|
7742 | ),
|
7743 | }),
|
7744 | ]
|
7745 | )
|
7746 | );
|
7747 | }
|
7748 |
|
7749 | if (this.fadeOut) {
|
7750 | const fadeOut = this.fades[this.fadeOut];
|
7751 | const fadeWidth = secondsToPixels(
|
7752 | fadeOut.end - fadeOut.start,
|
7753 | data.resolution,
|
7754 | data.sampleRate
|
7755 | );
|
7756 |
|
7757 | channelChildren.push(
|
7758 | h_default()(
|
7759 | "div.wp-fade.wp-fadeout",
|
7760 | {
|
7761 | attributes: {
|
7762 | style: `position: absolute; height: ${data.height}px; width: ${fadeWidth}px; top: 0; right: 0; z-index: 4;`,
|
7763 | },
|
7764 | },
|
7765 | [
|
7766 | h_default()("canvas", {
|
7767 | attributes: {
|
7768 | width: fadeWidth,
|
7769 | height: data.height,
|
7770 | },
|
7771 | hook: new render_FadeCanvasHook(
|
7772 | fadeOut.type,
|
7773 | fadeOut.shape,
|
7774 | fadeOut.end - fadeOut.start,
|
7775 | data.resolution
|
7776 | ),
|
7777 | }),
|
7778 | ]
|
7779 | )
|
7780 | );
|
7781 | }
|
7782 |
|
7783 | return h_default()(
|
7784 | `div.channel.channel-${channelNum}`,
|
7785 | {
|
7786 | attributes: {
|
7787 | style: `height: ${data.height}px; width: ${width}px; top: ${
|
7788 | channelNum * data.height
|
7789 | }px; left: ${startX}px; position: absolute; margin: 0; padding: 0; z-index: 1;`,
|
7790 | },
|
7791 | },
|
7792 | channelChildren
|
7793 | );
|
7794 | });
|
7795 |
|
7796 | waveformChildren.push(channels);
|
7797 | waveformChildren.push(this.renderOverlay(data));
|
7798 |
|
7799 |
|
7800 | if (data.isActive === true) {
|
7801 | const cStartX = secondsToPixels(
|
7802 | data.timeSelection.start,
|
7803 | data.resolution,
|
7804 | data.sampleRate
|
7805 | );
|
7806 | const cEndX = secondsToPixels(
|
7807 | data.timeSelection.end,
|
7808 | data.resolution,
|
7809 | data.sampleRate
|
7810 | );
|
7811 | const cWidth = cEndX - cStartX + 1;
|
7812 | const cClassName = cWidth > 1 ? ".segment" : ".point";
|
7813 |
|
7814 | waveformChildren.push(
|
7815 | h_default()(`div.selection${cClassName}`, {
|
7816 | attributes: {
|
7817 | style: `position: absolute; width: ${cWidth}px; bottom: 0; top: 0; left: ${cStartX}px; z-index: 4;`,
|
7818 | },
|
7819 | })
|
7820 | );
|
7821 | }
|
7822 |
|
7823 | const waveform = h_default()(
|
7824 | "div.waveform",
|
7825 | {
|
7826 | attributes: {
|
7827 | style: `height: ${numChan * data.height}px; position: relative;`,
|
7828 | },
|
7829 | },
|
7830 | waveformChildren
|
7831 | );
|
7832 |
|
7833 | const channelChildren = [];
|
7834 | let channelMargin = 0;
|
7835 |
|
7836 | if (data.controls.show) {
|
7837 | channelChildren.push(this.renderControls(data));
|
7838 | channelMargin = data.controls.width;
|
7839 | }
|
7840 |
|
7841 | channelChildren.push(waveform);
|
7842 |
|
7843 | const audibleClass = data.shouldPlay ? "" : ".silent";
|
7844 | const customClass =
|
7845 | this.customClass === undefined ? "" : `.${this.customClass}`;
|
7846 |
|
7847 | return h_default()(
|
7848 | `div.channel-wrapper${audibleClass}${customClass}`,
|
7849 | {
|
7850 | attributes: {
|
7851 | style: `margin-left: ${channelMargin}px; height: ${
|
7852 | data.height * numChan
|
7853 | }px;`,
|
7854 | },
|
7855 | },
|
7856 | channelChildren
|
7857 | );
|
7858 | }
|
7859 |
|
7860 | getTrackDetails() {
|
7861 | const info = {
|
7862 | src: this.src,
|
7863 | start: this.startTime,
|
7864 | end: this.endTime,
|
7865 | name: this.name,
|
7866 | customClass: this.customClass,
|
7867 | cuein: this.cueIn,
|
7868 | cueout: this.cueOut,
|
7869 | stereoPan: this.stereoPan,
|
7870 | gain: this.gain,
|
7871 | };
|
7872 |
|
7873 | if (this.fadeIn) {
|
7874 | const fadeIn = this.fades[this.fadeIn];
|
7875 |
|
7876 | info.fadeIn = {
|
7877 | shape: fadeIn.shape,
|
7878 | duration: fadeIn.end - fadeIn.start,
|
7879 | };
|
7880 | }
|
7881 |
|
7882 | if (this.fadeOut) {
|
7883 | const fadeOut = this.fades[this.fadeOut];
|
7884 |
|
7885 | info.fadeOut = {
|
7886 | shape: fadeOut.shape,
|
7887 | duration: fadeOut.end - fadeOut.start,
|
7888 | };
|
7889 | }
|
7890 |
|
7891 | return info;
|
7892 | }
|
7893 | });
|
7894 |
|
7895 | ;
|
7896 |
|
7897 |
|
7898 | const Playout = (class {
|
7899 | constructor(ac, buffer) {
|
7900 | this.ac = ac;
|
7901 | this.gain = 1;
|
7902 | this.buffer = buffer;
|
7903 | this.destination = this.ac.destination;
|
7904 | this.ac.createStereoPanner = ac.createStereoPanner || ac.createPanner;
|
7905 | }
|
7906 |
|
7907 | applyFade(type, start, duration, shape = "logarithmic") {
|
7908 | if (type === fade_maker.Y1) {
|
7909 | (0,fade_maker.L7)(this.fadeGain.gain, shape, start, duration);
|
7910 | } else if (type === fade_maker.h7) {
|
7911 | (0,fade_maker.Mt)(this.fadeGain.gain, shape, start, duration);
|
7912 | } else {
|
7913 | throw new Error("Unsupported fade type");
|
7914 | }
|
7915 | }
|
7916 |
|
7917 | applyFadeIn(start, duration, shape = "logarithmic") {
|
7918 | this.applyFade(fade_maker.Y1, start, duration, shape);
|
7919 | }
|
7920 |
|
7921 | applyFadeOut(start, duration, shape = "logarithmic") {
|
7922 | this.applyFade(fade_maker.h7, start, duration, shape);
|
7923 | }
|
7924 |
|
7925 | isPlaying() {
|
7926 | return this.source !== undefined;
|
7927 | }
|
7928 |
|
7929 | getDuration() {
|
7930 | return this.buffer.duration;
|
7931 | }
|
7932 |
|
7933 | setAudioContext(ac) {
|
7934 | this.ac = ac;
|
7935 | this.ac.createStereoPanner = ac.createStereoPanner || ac.createPanner;
|
7936 | this.destination = this.ac.destination;
|
7937 | }
|
7938 |
|
7939 | setUpSource() {
|
7940 | this.source = this.ac.createBufferSource();
|
7941 | this.source.buffer = this.buffer;
|
7942 |
|
7943 | const sourcePromise = new Promise((resolve) => {
|
7944 |
|
7945 | this.source.onended = () => {
|
7946 | this.source.disconnect();
|
7947 | this.fadeGain.disconnect();
|
7948 | this.volumeGain.disconnect();
|
7949 | this.shouldPlayGain.disconnect();
|
7950 | this.panner.disconnect();
|
7951 | this.masterGain.disconnect();
|
7952 |
|
7953 | this.source = undefined;
|
7954 | this.fadeGain = undefined;
|
7955 | this.volumeGain = undefined;
|
7956 | this.shouldPlayGain = undefined;
|
7957 | this.panner = undefined;
|
7958 | this.masterGain = undefined;
|
7959 |
|
7960 | resolve();
|
7961 | };
|
7962 | });
|
7963 |
|
7964 | this.fadeGain = this.ac.createGain();
|
7965 |
|
7966 | this.volumeGain = this.ac.createGain();
|
7967 |
|
7968 | this.shouldPlayGain = this.ac.createGain();
|
7969 | this.masterGain = this.ac.createGain();
|
7970 |
|
7971 | this.panner = this.ac.createStereoPanner();
|
7972 |
|
7973 | this.source.connect(this.fadeGain);
|
7974 | this.fadeGain.connect(this.volumeGain);
|
7975 | this.volumeGain.connect(this.shouldPlayGain);
|
7976 | this.shouldPlayGain.connect(this.masterGain);
|
7977 | this.masterGain.connect(this.panner);
|
7978 | this.panner.connect(this.destination);
|
7979 |
|
7980 | return sourcePromise;
|
7981 | }
|
7982 |
|
7983 | setVolumeGainLevel(level) {
|
7984 | if (this.volumeGain) {
|
7985 | this.volumeGain.gain.value = level;
|
7986 | }
|
7987 | }
|
7988 |
|
7989 | setShouldPlay(bool) {
|
7990 | if (this.shouldPlayGain) {
|
7991 | this.shouldPlayGain.gain.value = bool ? 1 : 0;
|
7992 | }
|
7993 | }
|
7994 |
|
7995 | setMasterGainLevel(level) {
|
7996 | if (this.masterGain) {
|
7997 | this.masterGain.gain.value = level;
|
7998 | }
|
7999 | }
|
8000 |
|
8001 | setStereoPanValue(value) {
|
8002 | const pan = value === undefined ? 0 : value;
|
8003 |
|
8004 | if (this.panner) {
|
8005 | if (this.panner.pan !== undefined) {
|
8006 | this.panner.pan.value = pan;
|
8007 | } else {
|
8008 | this.panner.panningModel = "equalpower";
|
8009 | this.panner.setPosition(pan, 0, 1 - Math.abs(pan));
|
8010 | }
|
8011 | }
|
8012 | }
|
8013 |
|
8014 | |
8015 |
|
8016 |
|
8017 |
|
8018 |
|
8019 |
|
8020 | play(when, start, duration) {
|
8021 | this.source.start(when, start, duration);
|
8022 | }
|
8023 |
|
8024 | stop(when = 0) {
|
8025 | if (this.source) {
|
8026 | this.source.stop(when);
|
8027 | }
|
8028 | }
|
8029 | });
|
8030 |
|
8031 | ;
|
8032 |
|
8033 |
|
8034 |
|
8035 |
|
8036 |
|
8037 |
|
8038 |
|
8039 |
|
8040 |
|
8041 |
|
8042 |
|
8043 |
|
8044 |
|
8045 |
|
8046 | function aeneas(aeneas) {
|
8047 | const annotation = {
|
8048 | id: aeneas.id || esm_browser_v4(),
|
8049 | start: Number(aeneas.begin) || 0,
|
8050 | end: Number(aeneas.end) || 0,
|
8051 | lines: aeneas.lines || [""],
|
8052 | lang: aeneas.language || "en",
|
8053 | };
|
8054 |
|
8055 | return annotation;
|
8056 | }
|
8057 |
|
8058 | ;
|
8059 |
|
8060 |
|
8061 |
|
8062 |
|
8063 |
|
8064 |
|
8065 |
|
8066 |
|
8067 |
|
8068 |
|
8069 |
|
8070 |
|
8071 | function output_aeneas(annotation) {
|
8072 | return {
|
8073 | begin: String(annotation.start.toFixed(3)),
|
8074 | end: String(annotation.end.toFixed(3)),
|
8075 | id: String(annotation.id),
|
8076 | language: annotation.lang,
|
8077 | lines: annotation.lines,
|
8078 | };
|
8079 | }
|
8080 |
|
8081 | ;
|
8082 |
|
8083 |
|
8084 | const DragInteraction = (class {
|
8085 | constructor(playlist, data = {}) {
|
8086 | this.playlist = playlist;
|
8087 | this.data = data;
|
8088 | this.active = false;
|
8089 |
|
8090 | this.ondragover = (e) => {
|
8091 | if (this.active) {
|
8092 | e.preventDefault();
|
8093 | this.emitDrag(e.clientX);
|
8094 | }
|
8095 | };
|
8096 | }
|
8097 |
|
8098 | emitDrag(x) {
|
8099 | const deltaX = x - this.prevX;
|
8100 |
|
8101 |
|
8102 | if (deltaX) {
|
8103 | const deltaTime = pixelsToSeconds(
|
8104 | deltaX,
|
8105 | this.playlist.samplesPerPixel,
|
8106 | this.playlist.sampleRate
|
8107 | );
|
8108 | this.prevX = x;
|
8109 | this.playlist.ee.emit("dragged", deltaTime, this.data);
|
8110 | }
|
8111 | }
|
8112 |
|
8113 | complete() {
|
8114 | this.active = false;
|
8115 | document.removeEventListener("dragover", this.ondragover);
|
8116 | }
|
8117 |
|
8118 | dragstart(e) {
|
8119 | const ev = e;
|
8120 | this.active = true;
|
8121 | this.prevX = e.clientX;
|
8122 |
|
8123 | ev.dataTransfer.dropEffect = "move";
|
8124 | ev.dataTransfer.effectAllowed = "move";
|
8125 | ev.dataTransfer.setData("text/plain", "");
|
8126 | document.addEventListener("dragover", this.ondragover);
|
8127 | }
|
8128 |
|
8129 | dragend(e) {
|
8130 | if (this.active) {
|
8131 | e.preventDefault();
|
8132 | this.complete();
|
8133 | }
|
8134 | }
|
8135 |
|
8136 | static getClass() {
|
8137 | return ".shift";
|
8138 | }
|
8139 |
|
8140 | static getEvents() {
|
8141 | return ["dragstart", "dragend"];
|
8142 | }
|
8143 | });
|
8144 |
|
8145 | ;
|
8146 |
|
8147 |
|
8148 |
|
8149 | const Hook = function ScrollTopHook() {};
|
8150 | Hook.prototype.hook = function hook(node) {
|
8151 | const el = node.querySelector(".current");
|
8152 | if (el) {
|
8153 | const box = node.getBoundingClientRect();
|
8154 | const row = el.getBoundingClientRect();
|
8155 | const diff = row.top - box.top;
|
8156 | const list = node;
|
8157 | list.scrollTop += diff;
|
8158 | }
|
8159 | };
|
8160 |
|
8161 | const ScrollTopHook = (Hook);
|
8162 |
|
8163 | ;
|
8164 | function timeformat(format) {
|
8165 | function clockFormat(seconds, decimals) {
|
8166 | const hours = parseInt(seconds / 3600, 10) % 24;
|
8167 | const minutes = parseInt(seconds / 60, 10) % 60;
|
8168 | const secs = (seconds % 60).toFixed(decimals);
|
8169 |
|
8170 | const sHours = hours < 10 ? `0${hours}` : hours;
|
8171 | const sMinutes = minutes < 10 ? `0${minutes}` : minutes;
|
8172 | const sSeconds = secs < 10 ? `0${secs}` : secs;
|
8173 |
|
8174 | return `${sHours}:${sMinutes}:${sSeconds}`;
|
8175 | }
|
8176 |
|
8177 | const formats = {
|
8178 | seconds(seconds) {
|
8179 | return seconds.toFixed(0);
|
8180 | },
|
8181 | thousandths(seconds) {
|
8182 | return seconds.toFixed(3);
|
8183 | },
|
8184 | "hh:mm:ss": function hhmmss(seconds) {
|
8185 | return clockFormat(seconds, 0);
|
8186 | },
|
8187 | "hh:mm:ss.u": function hhmmssu(seconds) {
|
8188 | return clockFormat(seconds, 1);
|
8189 | },
|
8190 | "hh:mm:ss.uu": function hhmmssuu(seconds) {
|
8191 | return clockFormat(seconds, 2);
|
8192 | },
|
8193 | "hh:mm:ss.uuu": function hhmmssuuu(seconds) {
|
8194 | return clockFormat(seconds, 3);
|
8195 | },
|
8196 | };
|
8197 |
|
8198 | return formats[format];
|
8199 | }
|
8200 |
|
8201 | ;
|
8202 |
|
8203 |
|
8204 |
|
8205 |
|
8206 |
|
8207 |
|
8208 |
|
8209 |
|
8210 |
|
8211 | class AnnotationList {
|
8212 | constructor(
|
8213 | playlist,
|
8214 | annotations,
|
8215 | controls = [],
|
8216 | editable = false,
|
8217 | linkEndpoints = false,
|
8218 | isContinuousPlay = false,
|
8219 | marginLeft = 0
|
8220 | ) {
|
8221 | this.playlist = playlist;
|
8222 | this.marginLeft = marginLeft;
|
8223 | this.resizeHandlers = [];
|
8224 | this.editable = editable;
|
8225 | this.annotations = annotations.map((a) =>
|
8226 |
|
8227 | aeneas(a)
|
8228 | );
|
8229 | this.setupInteractions();
|
8230 |
|
8231 | this.controls = controls;
|
8232 | this.setupEE(playlist.ee);
|
8233 |
|
8234 |
|
8235 | this.playlist.isContinuousPlay = isContinuousPlay;
|
8236 | this.playlist.linkEndpoints = linkEndpoints;
|
8237 | this.length = this.annotations.length;
|
8238 | }
|
8239 |
|
8240 | setupInteractions() {
|
8241 | this.annotations.forEach((a, i) => {
|
8242 | const leftShift = new DragInteraction(this.playlist, {
|
8243 | direction: "left",
|
8244 | index: i,
|
8245 | });
|
8246 | const rightShift = new DragInteraction(this.playlist, {
|
8247 | direction: "right",
|
8248 | index: i,
|
8249 | });
|
8250 |
|
8251 | this.resizeHandlers.push(leftShift);
|
8252 | this.resizeHandlers.push(rightShift);
|
8253 | });
|
8254 | }
|
8255 |
|
8256 | setupEE(ee) {
|
8257 | ee.on("dragged", (deltaTime, data) => {
|
8258 | const annotationIndex = data.index;
|
8259 | const annotations = this.annotations;
|
8260 | const note = annotations[annotationIndex];
|
8261 |
|
8262 |
|
8263 | if (data.direction === "left") {
|
8264 | const originalVal = note.start;
|
8265 | note.start += deltaTime;
|
8266 |
|
8267 | if (note.start < 0) {
|
8268 | note.start = 0;
|
8269 | }
|
8270 |
|
8271 | if (
|
8272 | annotationIndex &&
|
8273 | annotations[annotationIndex - 1].end > note.start
|
8274 | ) {
|
8275 | annotations[annotationIndex - 1].end = note.start;
|
8276 | }
|
8277 |
|
8278 | if (
|
8279 | this.playlist.linkEndpoints &&
|
8280 | annotationIndex &&
|
8281 | annotations[annotationIndex - 1].end === originalVal
|
8282 | ) {
|
8283 | annotations[annotationIndex - 1].end = note.start;
|
8284 | }
|
8285 | } else {
|
8286 |
|
8287 | const originalVal = note.end;
|
8288 | note.end += deltaTime;
|
8289 |
|
8290 | if (note.end > this.playlist.duration) {
|
8291 | note.end = this.playlist.duration;
|
8292 | }
|
8293 |
|
8294 | if (
|
8295 | annotationIndex < annotations.length - 1 &&
|
8296 | annotations[annotationIndex + 1].start < note.end
|
8297 | ) {
|
8298 | annotations[annotationIndex + 1].start = note.end;
|
8299 | }
|
8300 |
|
8301 | if (
|
8302 | this.playlist.linkEndpoints &&
|
8303 | annotationIndex < annotations.length - 1 &&
|
8304 | annotations[annotationIndex + 1].start === originalVal
|
8305 | ) {
|
8306 | annotations[annotationIndex + 1].start = note.end;
|
8307 | }
|
8308 | }
|
8309 |
|
8310 | this.playlist.drawRequest();
|
8311 | });
|
8312 |
|
8313 | ee.on("continuousplay", (val) => {
|
8314 | this.playlist.isContinuousPlay = val;
|
8315 | });
|
8316 |
|
8317 | ee.on("linkendpoints", (val) => {
|
8318 | this.playlist.linkEndpoints = val;
|
8319 | });
|
8320 |
|
8321 | ee.on("annotationsrequest", () => {
|
8322 | this.export();
|
8323 | });
|
8324 |
|
8325 | return ee;
|
8326 | }
|
8327 |
|
8328 | export() {
|
8329 | const output = this.annotations.map((a) => output_aeneas(a));
|
8330 | const dataStr = `data:text/json;charset=utf-8,${encodeURIComponent(
|
8331 | JSON.stringify(output)
|
8332 | )}`;
|
8333 | const a = document.createElement("a");
|
8334 |
|
8335 | document.body.appendChild(a);
|
8336 | a.href = dataStr;
|
8337 | a.download = "annotations.json";
|
8338 | a.click();
|
8339 | document.body.removeChild(a);
|
8340 | }
|
8341 |
|
8342 | renderResizeLeft(i) {
|
8343 | const events = DragInteraction.getEvents();
|
8344 | const config = {
|
8345 | attributes: {
|
8346 | style:
|
8347 | "position: absolute; height: 30px; width: 10px; top: 0; left: -2px",
|
8348 | draggable: true,
|
8349 | },
|
8350 | };
|
8351 | const handler = this.resizeHandlers[i * 2];
|
8352 |
|
8353 | events.forEach((event) => {
|
8354 | config[`on${event}`] = handler[event].bind(handler);
|
8355 | });
|
8356 |
|
8357 | return h_default()("div.resize-handle.resize-w", config);
|
8358 | }
|
8359 |
|
8360 | renderResizeRight(i) {
|
8361 | const events = DragInteraction.getEvents();
|
8362 | const config = {
|
8363 | attributes: {
|
8364 | style:
|
8365 | "position: absolute; height: 30px; width: 10px; top: 0; right: -2px",
|
8366 | draggable: true,
|
8367 | },
|
8368 | };
|
8369 | const handler = this.resizeHandlers[i * 2 + 1];
|
8370 |
|
8371 | events.forEach((event) => {
|
8372 | config[`on${event}`] = handler[event].bind(handler);
|
8373 | });
|
8374 |
|
8375 | return h_default()("div.resize-handle.resize-e", config);
|
8376 | }
|
8377 |
|
8378 | renderControls(note, i) {
|
8379 |
|
8380 | const that = this;
|
8381 | return this.controls.map((ctrl) =>
|
8382 | h_default()(`i.${ctrl.class}`, {
|
8383 | attributes: {
|
8384 | title: ctrl.title,
|
8385 | },
|
8386 | onclick: () => {
|
8387 | ctrl.action(note, i, that.annotations, {
|
8388 | linkEndpoints: that.playlist.linkEndpoints,
|
8389 | });
|
8390 | this.setupInteractions();
|
8391 | that.playlist.drawRequest();
|
8392 | },
|
8393 | })
|
8394 | );
|
8395 | }
|
8396 |
|
8397 | render() {
|
8398 | const boxes = h_default()(
|
8399 | "div.annotations-boxes",
|
8400 | {
|
8401 | attributes: {
|
8402 | style: `height: 30px; position: relative; margin-left: ${this.marginLeft}px;`,
|
8403 | },
|
8404 | },
|
8405 | this.annotations.map((note, i) => {
|
8406 | const samplesPerPixel = this.playlist.samplesPerPixel;
|
8407 | const sampleRate = this.playlist.sampleRate;
|
8408 | const pixPerSec = sampleRate / samplesPerPixel;
|
8409 | const pixOffset = secondsToPixels(
|
8410 | this.playlist.scrollLeft,
|
8411 | samplesPerPixel,
|
8412 | sampleRate
|
8413 | );
|
8414 | const left = Math.floor(note.start * pixPerSec - pixOffset);
|
8415 | const width = Math.ceil(note.end * pixPerSec - note.start * pixPerSec);
|
8416 |
|
8417 | return h_default()(
|
8418 | "div.annotation-box",
|
8419 | {
|
8420 | attributes: {
|
8421 | style: `position: absolute; height: 30px; width: ${width}px; left: ${left}px`,
|
8422 | "data-id": note.id,
|
8423 | },
|
8424 | },
|
8425 | [
|
8426 | this.renderResizeLeft(i),
|
8427 | h_default()(
|
8428 | "span.id",
|
8429 | {
|
8430 | onclick: () => {
|
8431 | const start = this.annotations[i].start;
|
8432 | const end = this.annotations[i].end;
|
8433 |
|
8434 | if (this.playlist.isContinuousPlay) {
|
8435 | this.playlist.seek(start, start);
|
8436 | this.playlist.ee.emit("play", start);
|
8437 | } else {
|
8438 | this.playlist.seek(start, end);
|
8439 | this.playlist.ee.emit("play", start, end);
|
8440 | }
|
8441 | },
|
8442 | },
|
8443 | [note.id]
|
8444 | ),
|
8445 | this.renderResizeRight(i),
|
8446 | ]
|
8447 | );
|
8448 | })
|
8449 | );
|
8450 |
|
8451 | const boxesWrapper = h_default()(
|
8452 | "div.annotations-boxes-wrapper",
|
8453 | {
|
8454 | attributes: {
|
8455 | style: "overflow: hidden;",
|
8456 | },
|
8457 | },
|
8458 | [boxes]
|
8459 | );
|
8460 |
|
8461 | const text = h_default()(
|
8462 | "div.annotations-text",
|
8463 | {
|
8464 | hook: new ScrollTopHook(),
|
8465 | },
|
8466 | this.annotations.map((note, i) => {
|
8467 | const format = timeformat(this.playlist.durationFormat);
|
8468 | const start = format(note.start);
|
8469 | const end = format(note.end);
|
8470 |
|
8471 | let segmentClass = "";
|
8472 | if (
|
8473 | this.playlist.isPlaying() &&
|
8474 | this.playlist.playbackSeconds >= note.start &&
|
8475 | this.playlist.playbackSeconds <= note.end
|
8476 | ) {
|
8477 | segmentClass = ".current";
|
8478 | }
|
8479 |
|
8480 | const editableConfig = {
|
8481 | attributes: {
|
8482 | contenteditable: true,
|
8483 | },
|
8484 | oninput: (e) => {
|
8485 |
|
8486 |
|
8487 | note.lines = [e.target.innerText];
|
8488 | },
|
8489 | onkeypress: (e) => {
|
8490 | if (e.which === 13 || e.keyCode === 13) {
|
8491 | e.target.blur();
|
8492 | e.preventDefault();
|
8493 | }
|
8494 | },
|
8495 | };
|
8496 |
|
8497 | const linesConfig = this.editable ? editableConfig : {};
|
8498 |
|
8499 | return h_default()(`div.annotation${segmentClass}`, [
|
8500 | h_default()("span.annotation-id", [note.id]),
|
8501 | h_default()("span.annotation-start", [start]),
|
8502 | h_default()("span.annotation-end", [end]),
|
8503 | h_default()("span.annotation-lines", linesConfig, [note.lines]),
|
8504 | h_default()("span.annotation-actions", this.renderControls(note, i)),
|
8505 | ]);
|
8506 | })
|
8507 | );
|
8508 |
|
8509 | return h_default()("div.annotations", [boxesWrapper, text]);
|
8510 | }
|
8511 | }
|
8512 |
|
8513 | const annotation_AnnotationList = (AnnotationList);
|
8514 |
|
8515 | ;
|
8516 | function recorderWorker() {
|
8517 |
|
8518 |
|
8519 | |
8520 |
|
8521 |
|
8522 | function findMinMax(array) {
|
8523 | let min = Infinity;
|
8524 | let max = -Infinity;
|
8525 | let curr;
|
8526 |
|
8527 | for (let i = 0; i < array.length; i += 1) {
|
8528 | curr = array[i];
|
8529 | if (min > curr) {
|
8530 | min = curr;
|
8531 | }
|
8532 | if (max < curr) {
|
8533 | max = curr;
|
8534 | }
|
8535 | }
|
8536 |
|
8537 | return {
|
8538 | min,
|
8539 | max,
|
8540 | };
|
8541 | }
|
8542 |
|
8543 | |
8544 |
|
8545 |
|
8546 |
|
8547 | function convert(n, bits) {
|
8548 | const max = 2 ** (bits - 1);
|
8549 | const v = n < 0 ? n * max : n * max - 1;
|
8550 | return Math.max(-max, Math.min(max - 1, v));
|
8551 | }
|
8552 |
|
8553 | |
8554 |
|
8555 |
|
8556 |
|
8557 | function extractPeaks(channel, samplesPerPixel, bits) {
|
8558 | const chanLength = channel.length;
|
8559 | const numPeaks = Math.ceil(chanLength / samplesPerPixel);
|
8560 | let start;
|
8561 | let end;
|
8562 | let segment;
|
8563 | let max;
|
8564 | let min;
|
8565 | let extrema;
|
8566 |
|
8567 |
|
8568 | const peaks = new self[`Int${bits}Array`](numPeaks * 2);
|
8569 |
|
8570 | for (let i = 0; i < numPeaks; i += 1) {
|
8571 | start = i * samplesPerPixel;
|
8572 | end =
|
8573 | (i + 1) * samplesPerPixel > chanLength
|
8574 | ? chanLength
|
8575 | : (i + 1) * samplesPerPixel;
|
8576 |
|
8577 | segment = channel.subarray(start, end);
|
8578 | extrema = findMinMax(segment);
|
8579 | min = convert(extrema.min, bits);
|
8580 | max = convert(extrema.max, bits);
|
8581 |
|
8582 | peaks[i * 2] = min;
|
8583 | peaks[i * 2 + 1] = max;
|
8584 | }
|
8585 |
|
8586 | return peaks;
|
8587 | }
|
8588 |
|
8589 | |
8590 |
|
8591 |
|
8592 |
|
8593 |
|
8594 |
|
8595 | function audioPeaks(source, samplesPerPixel = 10000, bits = 8) {
|
8596 | if ([8, 16, 32].indexOf(bits) < 0) {
|
8597 | throw new Error("Invalid number of bits specified for peaks.");
|
8598 | }
|
8599 |
|
8600 | const peaks = [];
|
8601 | const start = 0;
|
8602 | const end = source.length;
|
8603 | peaks.push(
|
8604 | extractPeaks(source.subarray(start, end), samplesPerPixel, bits)
|
8605 | );
|
8606 |
|
8607 | const length = peaks[0].length / 2;
|
8608 |
|
8609 | return {
|
8610 | bits,
|
8611 | length,
|
8612 | data: peaks,
|
8613 | };
|
8614 | }
|
8615 |
|
8616 | onmessage = function onmessage(e) {
|
8617 | const peaks = audioPeaks(e.data.samples, e.data.samplesPerPixel);
|
8618 |
|
8619 | postMessage(peaks);
|
8620 | };
|
8621 | }
|
8622 |
|
8623 | ;
|
8624 | function exportWavWorker() {
|
8625 | let recLength = 0;
|
8626 | let recBuffersL = [];
|
8627 | let recBuffersR = [];
|
8628 | let sampleRate;
|
8629 |
|
8630 | function init(config) {
|
8631 | sampleRate = config.sampleRate;
|
8632 | }
|
8633 |
|
8634 | function record(inputBuffer) {
|
8635 | recBuffersL.push(inputBuffer[0]);
|
8636 | recBuffersR.push(inputBuffer[1]);
|
8637 | recLength += inputBuffer[0].length;
|
8638 | }
|
8639 |
|
8640 | function writeString(view, offset, string) {
|
8641 | for (let i = 0; i < string.length; i += 1) {
|
8642 | view.setUint8(offset + i, string.charCodeAt(i));
|
8643 | }
|
8644 | }
|
8645 |
|
8646 | function floatTo16BitPCM(output, offset, input) {
|
8647 | let writeOffset = offset;
|
8648 | for (let i = 0; i < input.length; i += 1, writeOffset += 2) {
|
8649 | const s = Math.max(-1, Math.min(1, input[i]));
|
8650 | output.setInt16(writeOffset, s < 0 ? s * 0x8000 : s * 0x7fff, true);
|
8651 | }
|
8652 | }
|
8653 |
|
8654 | function encodeWAV(samples, mono = false) {
|
8655 | const buffer = new ArrayBuffer(44 + samples.length * 2);
|
8656 | const view = new DataView(buffer);
|
8657 |
|
8658 |
|
8659 | writeString(view, 0, "RIFF");
|
8660 |
|
8661 | view.setUint32(4, 32 + samples.length * 2, true);
|
8662 |
|
8663 | writeString(view, 8, "WAVE");
|
8664 |
|
8665 | writeString(view, 12, "fmt ");
|
8666 |
|
8667 | view.setUint32(16, 16, true);
|
8668 |
|
8669 | view.setUint16(20, 1, true);
|
8670 |
|
8671 | view.setUint16(22, mono ? 1 : 2, true);
|
8672 |
|
8673 | view.setUint32(24, sampleRate, true);
|
8674 |
|
8675 | view.setUint32(28, sampleRate * 4, true);
|
8676 |
|
8677 | view.setUint16(32, 4, true);
|
8678 |
|
8679 | view.setUint16(34, 16, true);
|
8680 |
|
8681 | writeString(view, 36, "data");
|
8682 |
|
8683 | view.setUint32(40, samples.length * 2, true);
|
8684 |
|
8685 | floatTo16BitPCM(view, 44, samples);
|
8686 |
|
8687 | return view;
|
8688 | }
|
8689 |
|
8690 | function mergeBuffers(recBuffers, length) {
|
8691 | const result = new Float32Array(length);
|
8692 | let offset = 0;
|
8693 |
|
8694 | for (let i = 0; i < recBuffers.length; i += 1) {
|
8695 | result.set(recBuffers[i], offset);
|
8696 | offset += recBuffers[i].length;
|
8697 | }
|
8698 | return result;
|
8699 | }
|
8700 |
|
8701 | function interleave(inputL, inputR) {
|
8702 | const length = inputL.length + inputR.length;
|
8703 | const result = new Float32Array(length);
|
8704 |
|
8705 | let index = 0;
|
8706 | let inputIndex = 0;
|
8707 |
|
8708 | while (index < length) {
|
8709 | result[(index += 1)] = inputL[inputIndex];
|
8710 | result[(index += 1)] = inputR[inputIndex];
|
8711 | inputIndex += 1;
|
8712 | }
|
8713 |
|
8714 | return result;
|
8715 | }
|
8716 |
|
8717 | function exportWAV(type) {
|
8718 | const bufferL = mergeBuffers(recBuffersL, recLength);
|
8719 | const bufferR = mergeBuffers(recBuffersR, recLength);
|
8720 | const interleaved = interleave(bufferL, bufferR);
|
8721 | const dataview = encodeWAV(interleaved);
|
8722 | const audioBlob = new Blob([dataview], { type });
|
8723 |
|
8724 | postMessage(audioBlob);
|
8725 | }
|
8726 |
|
8727 | function clear() {
|
8728 | recLength = 0;
|
8729 | recBuffersL = [];
|
8730 | recBuffersR = [];
|
8731 | }
|
8732 |
|
8733 | onmessage = function onmessage(e) {
|
8734 | switch (e.data.command) {
|
8735 | case "init": {
|
8736 | init(e.data.config);
|
8737 | break;
|
8738 | }
|
8739 | case "record": {
|
8740 | record(e.data.buffer);
|
8741 | break;
|
8742 | }
|
8743 | case "exportWAV": {
|
8744 | exportWAV(e.data.type);
|
8745 | break;
|
8746 | }
|
8747 | case "clear": {
|
8748 | clear();
|
8749 | break;
|
8750 | }
|
8751 | default: {
|
8752 | throw new Error("Unknown export worker command");
|
8753 | }
|
8754 | }
|
8755 | };
|
8756 | }
|
8757 |
|
8758 | ;
|
8759 |
|
8760 |
|
8761 |
|
8762 |
|
8763 |
|
8764 |
|
8765 |
|
8766 |
|
8767 |
|
8768 |
|
8769 |
|
8770 |
|
8771 |
|
8772 |
|
8773 |
|
8774 |
|
8775 |
|
8776 |
|
8777 | const Playlist = (class {
|
8778 | constructor() {
|
8779 | this.tracks = [];
|
8780 | this.soloedTracks = [];
|
8781 | this.mutedTracks = [];
|
8782 | this.collapsedTracks = [];
|
8783 | this.playoutPromises = [];
|
8784 |
|
8785 | this.cursor = 0;
|
8786 | this.playbackSeconds = 0;
|
8787 | this.duration = 0;
|
8788 | this.scrollLeft = 0;
|
8789 | this.scrollTimer = undefined;
|
8790 | this.showTimescale = false;
|
8791 |
|
8792 | this.isScrolling = false;
|
8793 |
|
8794 | this.fadeType = "logarithmic";
|
8795 | this.masterGain = 1;
|
8796 | this.annotations = [];
|
8797 | this.durationFormat = "hh:mm:ss.uuu";
|
8798 | this.isAutomaticScroll = false;
|
8799 | this.resetDrawTimer = undefined;
|
8800 | }
|
8801 |
|
8802 |
|
8803 | initExporter() {
|
8804 | this.exportWorker = new (inline_worker_default())(exportWavWorker);
|
8805 | }
|
8806 |
|
8807 |
|
8808 | initRecorder(stream) {
|
8809 | this.mediaRecorder = new MediaRecorder(stream);
|
8810 |
|
8811 | this.mediaRecorder.onstart = () => {
|
8812 | const track = new Track();
|
8813 | track.setName("Recording");
|
8814 | track.setEnabledStates();
|
8815 | track.setEventEmitter(this.ee);
|
8816 |
|
8817 | this.recordingTrack = track;
|
8818 | this.tracks.push(track);
|
8819 |
|
8820 | this.chunks = [];
|
8821 | this.working = false;
|
8822 | };
|
8823 |
|
8824 | this.mediaRecorder.ondataavailable = (e) => {
|
8825 | this.chunks.push(e.data);
|
8826 |
|
8827 |
|
8828 | if (!this.working) {
|
8829 | const recording = new Blob(this.chunks, {
|
8830 | type: "audio/ogg; codecs=opus",
|
8831 | });
|
8832 | const loader = LoaderFactory.createLoader(recording, this.ac);
|
8833 | loader
|
8834 | .load()
|
8835 | .then((audioBuffer) => {
|
8836 |
|
8837 | this.recorderWorker.postMessage({
|
8838 | samples: audioBuffer.getChannelData(0),
|
8839 | samplesPerPixel: this.samplesPerPixel,
|
8840 | });
|
8841 | this.recordingTrack.setCues(0, audioBuffer.duration);
|
8842 | this.recordingTrack.setBuffer(audioBuffer);
|
8843 | this.recordingTrack.setPlayout(new Playout(this.ac, audioBuffer));
|
8844 | this.adjustDuration();
|
8845 | })
|
8846 | .catch(() => {
|
8847 | this.working = false;
|
8848 | });
|
8849 | this.working = true;
|
8850 | }
|
8851 | };
|
8852 |
|
8853 | this.mediaRecorder.onstop = () => {
|
8854 | this.chunks = [];
|
8855 | this.working = false;
|
8856 | };
|
8857 |
|
8858 | this.recorderWorker = new (inline_worker_default())(recorderWorker);
|
8859 |
|
8860 | this.recorderWorker.onmessage = (e) => {
|
8861 | this.recordingTrack.setPeaks(e.data);
|
8862 | this.working = false;
|
8863 | this.drawRequest();
|
8864 | };
|
8865 | }
|
8866 |
|
8867 | setShowTimeScale(show) {
|
8868 | this.showTimescale = show;
|
8869 | }
|
8870 |
|
8871 | setMono(mono) {
|
8872 | this.mono = mono;
|
8873 | }
|
8874 |
|
8875 | setExclSolo(exclSolo) {
|
8876 | this.exclSolo = exclSolo;
|
8877 | }
|
8878 |
|
8879 | setSeekStyle(style) {
|
8880 | this.seekStyle = style;
|
8881 | }
|
8882 |
|
8883 | getSeekStyle() {
|
8884 | return this.seekStyle;
|
8885 | }
|
8886 |
|
8887 | setSampleRate(sampleRate) {
|
8888 | this.sampleRate = sampleRate;
|
8889 | }
|
8890 |
|
8891 | setSamplesPerPixel(samplesPerPixel) {
|
8892 | this.samplesPerPixel = samplesPerPixel;
|
8893 | }
|
8894 |
|
8895 | setAudioContext(ac) {
|
8896 | this.ac = ac;
|
8897 | }
|
8898 |
|
8899 | setControlOptions(controlOptions) {
|
8900 | this.controls = controlOptions;
|
8901 | }
|
8902 |
|
8903 | setWaveHeight(height) {
|
8904 | this.waveHeight = height;
|
8905 | }
|
8906 |
|
8907 | setCollapsedWaveHeight(height) {
|
8908 | this.collapsedWaveHeight = height;
|
8909 | }
|
8910 |
|
8911 | setColors(colors) {
|
8912 | this.colors = colors;
|
8913 | }
|
8914 |
|
8915 | setBarWidth(width) {
|
8916 | this.barWidth = width;
|
8917 | }
|
8918 |
|
8919 | setBarGap(width) {
|
8920 | this.barGap = width;
|
8921 | }
|
8922 |
|
8923 | setAnnotations(config) {
|
8924 | const controlWidth = this.controls.show ? this.controls.width : 0;
|
8925 | this.annotationList = new annotation_AnnotationList(
|
8926 | this,
|
8927 | config.annotations,
|
8928 | config.controls,
|
8929 | config.editable,
|
8930 | config.linkEndpoints,
|
8931 | config.isContinuousPlay,
|
8932 | controlWidth
|
8933 | );
|
8934 | }
|
8935 |
|
8936 | setEventEmitter(ee) {
|
8937 | this.ee = ee;
|
8938 | }
|
8939 |
|
8940 | getEventEmitter() {
|
8941 | return this.ee;
|
8942 | }
|
8943 |
|
8944 | setUpEventEmitter() {
|
8945 | const ee = this.ee;
|
8946 |
|
8947 | ee.on("automaticscroll", (val) => {
|
8948 | this.isAutomaticScroll = val;
|
8949 | });
|
8950 |
|
8951 | ee.on("durationformat", (format) => {
|
8952 | this.durationFormat = format;
|
8953 | this.drawRequest();
|
8954 | });
|
8955 |
|
8956 | ee.on("select", (start, end, track) => {
|
8957 | if (this.isPlaying()) {
|
8958 | this.lastSeeked = start;
|
8959 | this.pausedAt = undefined;
|
8960 | this.restartPlayFrom(start);
|
8961 | } else {
|
8962 |
|
8963 | this.seek(start, end, track);
|
8964 | this.ee.emit("timeupdate", start);
|
8965 | this.drawRequest();
|
8966 | }
|
8967 | });
|
8968 |
|
8969 | ee.on("startaudiorendering", (type) => {
|
8970 | this.startOfflineRender(type);
|
8971 | });
|
8972 |
|
8973 | ee.on("statechange", (state) => {
|
8974 | this.setState(state);
|
8975 | this.drawRequest();
|
8976 | });
|
8977 |
|
8978 | ee.on("shift", (deltaTime, track) => {
|
8979 | track.setStartTime(track.getStartTime() + deltaTime);
|
8980 | this.adjustDuration();
|
8981 | this.drawRequest();
|
8982 | });
|
8983 |
|
8984 | ee.on("record", () => {
|
8985 | this.record();
|
8986 | });
|
8987 |
|
8988 | ee.on("play", (start, end) => {
|
8989 | this.play(start, end);
|
8990 | });
|
8991 |
|
8992 | ee.on("pause", () => {
|
8993 | this.pause();
|
8994 | });
|
8995 |
|
8996 | ee.on("stop", () => {
|
8997 | this.stop();
|
8998 | });
|
8999 |
|
9000 | ee.on("rewind", () => {
|
9001 | this.rewind();
|
9002 | });
|
9003 |
|
9004 | ee.on("fastforward", () => {
|
9005 | this.fastForward();
|
9006 | });
|
9007 |
|
9008 | ee.on("clear", () => {
|
9009 | this.clear().then(() => {
|
9010 | this.drawRequest();
|
9011 | });
|
9012 | });
|
9013 |
|
9014 | ee.on("solo", (track) => {
|
9015 | this.soloTrack(track);
|
9016 | this.adjustTrackPlayout();
|
9017 | this.drawRequest();
|
9018 | });
|
9019 |
|
9020 | ee.on("mute", (track) => {
|
9021 | this.muteTrack(track);
|
9022 | this.adjustTrackPlayout();
|
9023 | this.drawRequest();
|
9024 | });
|
9025 |
|
9026 | ee.on("removeTrack", (track) => {
|
9027 | this.removeTrack(track);
|
9028 | this.adjustTrackPlayout();
|
9029 | this.drawRequest();
|
9030 | });
|
9031 |
|
9032 | ee.on("changeTrackView", (track, opts) => {
|
9033 | this.collapseTrack(track, opts);
|
9034 | this.drawRequest();
|
9035 | });
|
9036 |
|
9037 | ee.on("volumechange", (volume, track) => {
|
9038 | track.setGainLevel(volume / 100);
|
9039 | this.drawRequest();
|
9040 | });
|
9041 |
|
9042 | ee.on("mastervolumechange", (volume) => {
|
9043 | this.masterGain = volume / 100;
|
9044 | this.tracks.forEach((track) => {
|
9045 | track.setMasterGainLevel(this.masterGain);
|
9046 | });
|
9047 | });
|
9048 |
|
9049 | ee.on("fadein", (duration, track) => {
|
9050 | track.setFadeIn(duration, this.fadeType);
|
9051 | this.drawRequest();
|
9052 | });
|
9053 |
|
9054 | ee.on("fadeout", (duration, track) => {
|
9055 | track.setFadeOut(duration, this.fadeType);
|
9056 | this.drawRequest();
|
9057 | });
|
9058 |
|
9059 | ee.on("stereopan", (panvalue, track) => {
|
9060 | track.setStereoPanValue(panvalue);
|
9061 | this.drawRequest();
|
9062 | });
|
9063 |
|
9064 | ee.on("fadetype", (type) => {
|
9065 | this.fadeType = type;
|
9066 | });
|
9067 |
|
9068 | ee.on("newtrack", (file) => {
|
9069 | this.load([
|
9070 | {
|
9071 | src: file,
|
9072 | name: file.name,
|
9073 | },
|
9074 | ]);
|
9075 | });
|
9076 |
|
9077 | ee.on("trim", () => {
|
9078 | const track = this.getActiveTrack();
|
9079 | const timeSelection = this.getTimeSelection();
|
9080 |
|
9081 | track.trim(timeSelection.start, timeSelection.end);
|
9082 | track.calculatePeaks(this.samplesPerPixel, this.sampleRate);
|
9083 |
|
9084 | this.setTimeSelection(0, 0);
|
9085 | this.drawRequest();
|
9086 | });
|
9087 |
|
9088 | ee.on("zoomin", () => {
|
9089 | const zoomIndex = Math.max(0, this.zoomIndex - 1);
|
9090 | const zoom = this.zoomLevels[zoomIndex];
|
9091 |
|
9092 | if (zoom !== this.samplesPerPixel) {
|
9093 | this.setZoom(zoom);
|
9094 | this.drawRequest();
|
9095 | }
|
9096 | });
|
9097 |
|
9098 | ee.on("zoomout", () => {
|
9099 | const zoomIndex = Math.min(
|
9100 | this.zoomLevels.length - 1,
|
9101 | this.zoomIndex + 1
|
9102 | );
|
9103 | const zoom = this.zoomLevels[zoomIndex];
|
9104 |
|
9105 | if (zoom !== this.samplesPerPixel) {
|
9106 | this.setZoom(zoom);
|
9107 | this.drawRequest();
|
9108 | }
|
9109 | });
|
9110 |
|
9111 | ee.on("scroll", () => {
|
9112 | this.isScrolling = true;
|
9113 | this.drawRequest();
|
9114 | clearTimeout(this.scrollTimer);
|
9115 | this.scrollTimer = setTimeout(() => {
|
9116 | this.isScrolling = false;
|
9117 | }, 200);
|
9118 | });
|
9119 | }
|
9120 |
|
9121 | load(trackList) {
|
9122 | const loadPromises = trackList.map((trackInfo) => {
|
9123 | const loader = LoaderFactory.createLoader(
|
9124 | trackInfo.src,
|
9125 | this.ac,
|
9126 | this.ee
|
9127 | );
|
9128 | return loader.load();
|
9129 | });
|
9130 |
|
9131 | return Promise.all(loadPromises)
|
9132 | .then((audioBuffers) => {
|
9133 | this.ee.emit("audiosourcesloaded");
|
9134 |
|
9135 | const tracks = audioBuffers.map((audioBuffer, index) => {
|
9136 | const info = trackList[index];
|
9137 | const name = info.name || "Untitled";
|
9138 | const start = info.start || 0;
|
9139 | const states = info.states || {};
|
9140 | const fadeIn = info.fadeIn;
|
9141 | const fadeOut = info.fadeOut;
|
9142 | const cueIn = info.cuein || 0;
|
9143 | const cueOut = info.cueout || audioBuffer.duration;
|
9144 | const gain = info.gain || 1;
|
9145 | const muted = info.muted || false;
|
9146 | const soloed = info.soloed || false;
|
9147 | const selection = info.selected;
|
9148 | const peaks = info.peaks || { type: "WebAudio", mono: this.mono };
|
9149 | const customClass = info.customClass || undefined;
|
9150 | const waveOutlineColor = info.waveOutlineColor || undefined;
|
9151 | const stereoPan = info.stereoPan || 0;
|
9152 |
|
9153 |
|
9154 | const playout = new Playout(this.ac, audioBuffer);
|
9155 |
|
9156 | const track = new Track();
|
9157 | track.src = info.src;
|
9158 | track.setBuffer(audioBuffer);
|
9159 | track.setName(name);
|
9160 | track.setEventEmitter(this.ee);
|
9161 | track.setEnabledStates(states);
|
9162 | track.setCues(cueIn, cueOut);
|
9163 | track.setCustomClass(customClass);
|
9164 | track.setWaveOutlineColor(waveOutlineColor);
|
9165 |
|
9166 | if (fadeIn !== undefined) {
|
9167 | track.setFadeIn(fadeIn.duration, fadeIn.shape);
|
9168 | }
|
9169 |
|
9170 | if (fadeOut !== undefined) {
|
9171 | track.setFadeOut(fadeOut.duration, fadeOut.shape);
|
9172 | }
|
9173 |
|
9174 | if (selection !== undefined) {
|
9175 | this.setActiveTrack(track);
|
9176 | this.setTimeSelection(selection.start, selection.end);
|
9177 | }
|
9178 |
|
9179 | if (peaks !== undefined) {
|
9180 | track.setPeakData(peaks);
|
9181 | }
|
9182 |
|
9183 | track.setState(this.getState());
|
9184 | track.setStartTime(start);
|
9185 | track.setPlayout(playout);
|
9186 |
|
9187 | track.setGainLevel(gain);
|
9188 | track.setStereoPanValue(stereoPan);
|
9189 |
|
9190 | if (muted) {
|
9191 | this.muteTrack(track);
|
9192 | }
|
9193 |
|
9194 | if (soloed) {
|
9195 | this.soloTrack(track);
|
9196 | }
|
9197 |
|
9198 |
|
9199 | track.calculatePeaks(this.samplesPerPixel, this.sampleRate);
|
9200 |
|
9201 | return track;
|
9202 | });
|
9203 |
|
9204 | this.tracks = this.tracks.concat(tracks);
|
9205 | this.adjustDuration();
|
9206 | this.draw(this.render());
|
9207 |
|
9208 | this.ee.emit("audiosourcesrendered");
|
9209 | })
|
9210 | .catch((e) => {
|
9211 | this.ee.emit("audiosourceserror", e);
|
9212 | });
|
9213 | }
|
9214 |
|
9215 | |
9216 |
|
9217 |
|
9218 | setActiveTrack(track) {
|
9219 | this.activeTrack = track;
|
9220 | }
|
9221 |
|
9222 | getActiveTrack() {
|
9223 | return this.activeTrack;
|
9224 | }
|
9225 |
|
9226 | isSegmentSelection() {
|
9227 | return this.timeSelection.start !== this.timeSelection.end;
|
9228 | }
|
9229 |
|
9230 | |
9231 |
|
9232 |
|
9233 | setTimeSelection(start = 0, end) {
|
9234 | this.timeSelection = {
|
9235 | start,
|
9236 | end: end === undefined ? start : end,
|
9237 | };
|
9238 |
|
9239 | this.cursor = start;
|
9240 | }
|
9241 |
|
9242 | startOfflineRender(type) {
|
9243 | if (this.isRendering) {
|
9244 | return;
|
9245 | }
|
9246 |
|
9247 | this.isRendering = true;
|
9248 | this.offlineAudioContext = new OfflineAudioContext(
|
9249 | 2,
|
9250 | 44100 * this.duration,
|
9251 | 44100
|
9252 | );
|
9253 |
|
9254 | const currentTime = this.offlineAudioContext.currentTime;
|
9255 |
|
9256 | this.tracks.forEach((track) => {
|
9257 | track.setOfflinePlayout(
|
9258 | new Playout(this.offlineAudioContext, track.buffer)
|
9259 | );
|
9260 | track.schedulePlay(currentTime, 0, 0, {
|
9261 | shouldPlay: this.shouldTrackPlay(track),
|
9262 | masterGain: 1,
|
9263 | isOffline: true,
|
9264 | });
|
9265 | });
|
9266 |
|
9267 | |
9268 |
|
9269 |
|
9270 | this.offlineAudioContext
|
9271 | .startRendering()
|
9272 | .then((audioBuffer) => {
|
9273 | if (type === "buffer") {
|
9274 | this.ee.emit("audiorenderingfinished", type, audioBuffer);
|
9275 | this.isRendering = false;
|
9276 | return;
|
9277 | }
|
9278 |
|
9279 | if (type === "wav") {
|
9280 | this.exportWorker.postMessage({
|
9281 | command: "init",
|
9282 | config: {
|
9283 | sampleRate: 44100,
|
9284 | },
|
9285 | });
|
9286 |
|
9287 |
|
9288 | this.exportWorker.onmessage = (e) => {
|
9289 | this.ee.emit("audiorenderingfinished", type, e.data);
|
9290 | this.isRendering = false;
|
9291 |
|
9292 |
|
9293 | this.exportWorker.postMessage({
|
9294 | command: "clear",
|
9295 | });
|
9296 | };
|
9297 |
|
9298 |
|
9299 | this.exportWorker.postMessage({
|
9300 | command: "record",
|
9301 | buffer: [
|
9302 | audioBuffer.getChannelData(0),
|
9303 | audioBuffer.getChannelData(1),
|
9304 | ],
|
9305 | });
|
9306 |
|
9307 |
|
9308 | this.exportWorker.postMessage({
|
9309 | command: "exportWAV",
|
9310 | type: "audio/wav",
|
9311 | });
|
9312 | }
|
9313 | })
|
9314 | .catch((e) => {
|
9315 | throw e;
|
9316 | });
|
9317 | }
|
9318 |
|
9319 | getTimeSelection() {
|
9320 | return this.timeSelection;
|
9321 | }
|
9322 |
|
9323 | setState(state) {
|
9324 | this.state = state;
|
9325 |
|
9326 | this.tracks.forEach((track) => {
|
9327 | track.setState(state);
|
9328 | });
|
9329 | }
|
9330 |
|
9331 | getState() {
|
9332 | return this.state;
|
9333 | }
|
9334 |
|
9335 | setZoomIndex(index) {
|
9336 | this.zoomIndex = index;
|
9337 | }
|
9338 |
|
9339 | setZoomLevels(levels) {
|
9340 | this.zoomLevels = levels;
|
9341 | }
|
9342 |
|
9343 | setZoom(zoom) {
|
9344 | this.samplesPerPixel = zoom;
|
9345 | this.zoomIndex = this.zoomLevels.indexOf(zoom);
|
9346 | this.tracks.forEach((track) => {
|
9347 | track.calculatePeaks(zoom, this.sampleRate);
|
9348 | });
|
9349 | }
|
9350 |
|
9351 | muteTrack(track) {
|
9352 | const index = this.mutedTracks.indexOf(track);
|
9353 |
|
9354 | if (index > -1) {
|
9355 | this.mutedTracks.splice(index, 1);
|
9356 | } else {
|
9357 | this.mutedTracks.push(track);
|
9358 | }
|
9359 | }
|
9360 |
|
9361 | soloTrack(track) {
|
9362 | const index = this.soloedTracks.indexOf(track);
|
9363 |
|
9364 | if (index > -1) {
|
9365 | this.soloedTracks.splice(index, 1);
|
9366 | } else if (this.exclSolo) {
|
9367 | this.soloedTracks = [track];
|
9368 | } else {
|
9369 | this.soloedTracks.push(track);
|
9370 | }
|
9371 | }
|
9372 |
|
9373 | collapseTrack(track, opts) {
|
9374 | if (opts.collapsed) {
|
9375 | this.collapsedTracks.push(track);
|
9376 | } else {
|
9377 | const index = this.collapsedTracks.indexOf(track);
|
9378 |
|
9379 | if (index > -1) {
|
9380 | this.collapsedTracks.splice(index, 1);
|
9381 | }
|
9382 | }
|
9383 | }
|
9384 |
|
9385 | removeTrack(track) {
|
9386 | if (track.isPlaying()) {
|
9387 | track.scheduleStop();
|
9388 | }
|
9389 |
|
9390 | const trackLists = [
|
9391 | this.mutedTracks,
|
9392 | this.soloedTracks,
|
9393 | this.collapsedTracks,
|
9394 | this.tracks,
|
9395 | ];
|
9396 | trackLists.forEach((list) => {
|
9397 | const index = list.indexOf(track);
|
9398 | if (index > -1) {
|
9399 | list.splice(index, 1);
|
9400 | }
|
9401 | });
|
9402 | }
|
9403 |
|
9404 | adjustTrackPlayout() {
|
9405 | this.tracks.forEach((track) => {
|
9406 | track.setShouldPlay(this.shouldTrackPlay(track));
|
9407 | });
|
9408 | }
|
9409 |
|
9410 | adjustDuration() {
|
9411 | this.duration = this.tracks.reduce(
|
9412 | (duration, track) => Math.max(duration, track.getEndTime()),
|
9413 | 0
|
9414 | );
|
9415 | }
|
9416 |
|
9417 | shouldTrackPlay(track) {
|
9418 | let shouldPlay;
|
9419 |
|
9420 | if (this.soloedTracks.length > 0) {
|
9421 | shouldPlay = false;
|
9422 | if (this.soloedTracks.indexOf(track) > -1) {
|
9423 | shouldPlay = true;
|
9424 | }
|
9425 | } else {
|
9426 |
|
9427 | shouldPlay = true;
|
9428 | if (this.mutedTracks.indexOf(track) > -1) {
|
9429 | shouldPlay = false;
|
9430 | }
|
9431 | }
|
9432 |
|
9433 | return shouldPlay;
|
9434 | }
|
9435 |
|
9436 | isPlaying() {
|
9437 | return this.tracks.reduce(
|
9438 | (isPlaying, track) => isPlaying || track.isPlaying(),
|
9439 | false
|
9440 | );
|
9441 | }
|
9442 |
|
9443 | |
9444 |
|
9445 |
|
9446 | getCurrentTime() {
|
9447 | const cursorPos = this.lastSeeked || this.pausedAt || this.cursor;
|
9448 |
|
9449 | return cursorPos + this.getElapsedTime();
|
9450 | }
|
9451 |
|
9452 | getElapsedTime() {
|
9453 | return this.ac.currentTime - this.lastPlay;
|
9454 | }
|
9455 |
|
9456 | setMasterGain(gain) {
|
9457 | this.ee.emit("mastervolumechange", gain);
|
9458 | }
|
9459 |
|
9460 | restartPlayFrom(start, end) {
|
9461 | this.stopAnimation();
|
9462 |
|
9463 | this.tracks.forEach((editor) => {
|
9464 | editor.scheduleStop();
|
9465 | });
|
9466 |
|
9467 | return Promise.all(this.playoutPromises).then(
|
9468 | this.play.bind(this, start, end)
|
9469 | );
|
9470 | }
|
9471 |
|
9472 | play(startTime, endTime) {
|
9473 | clearTimeout(this.resetDrawTimer);
|
9474 |
|
9475 | const currentTime = this.ac.currentTime;
|
9476 | const selected = this.getTimeSelection();
|
9477 | const playoutPromises = [];
|
9478 |
|
9479 | const start = startTime || this.pausedAt || this.cursor;
|
9480 | let end = endTime;
|
9481 |
|
9482 | if (!end && selected.end !== selected.start && selected.end > start) {
|
9483 | end = selected.end;
|
9484 | }
|
9485 |
|
9486 | if (this.isPlaying()) {
|
9487 | return this.restartPlayFrom(start, end);
|
9488 | }
|
9489 |
|
9490 | this.tracks.forEach((track) => {
|
9491 | track.setState("cursor");
|
9492 | playoutPromises.push(
|
9493 | track.schedulePlay(currentTime, start, end, {
|
9494 | shouldPlay: this.shouldTrackPlay(track),
|
9495 | masterGain: this.masterGain,
|
9496 | })
|
9497 | );
|
9498 | });
|
9499 |
|
9500 | this.lastPlay = currentTime;
|
9501 |
|
9502 | this.playoutPromises = playoutPromises;
|
9503 | this.startAnimation(start);
|
9504 |
|
9505 | return Promise.all(this.playoutPromises);
|
9506 | }
|
9507 |
|
9508 | pause() {
|
9509 | if (!this.isPlaying()) {
|
9510 | return Promise.all(this.playoutPromises);
|
9511 | }
|
9512 |
|
9513 | this.pausedAt = this.getCurrentTime();
|
9514 | return this.playbackReset();
|
9515 | }
|
9516 |
|
9517 | stop() {
|
9518 | if (this.mediaRecorder && this.mediaRecorder.state === "recording") {
|
9519 | this.mediaRecorder.stop();
|
9520 | }
|
9521 |
|
9522 | this.pausedAt = undefined;
|
9523 | this.playbackSeconds = 0;
|
9524 | return this.playbackReset();
|
9525 | }
|
9526 |
|
9527 | playbackReset() {
|
9528 | this.lastSeeked = undefined;
|
9529 | this.stopAnimation();
|
9530 |
|
9531 | this.tracks.forEach((track) => {
|
9532 | track.scheduleStop();
|
9533 | track.setState(this.getState());
|
9534 | });
|
9535 |
|
9536 | this.drawRequest();
|
9537 | return Promise.all(this.playoutPromises);
|
9538 | }
|
9539 |
|
9540 | rewind() {
|
9541 | return this.stop().then(() => {
|
9542 | this.scrollLeft = 0;
|
9543 | this.ee.emit("select", 0, 0);
|
9544 | });
|
9545 | }
|
9546 |
|
9547 | fastForward() {
|
9548 | return this.stop().then(() => {
|
9549 | if (this.viewDuration < this.duration) {
|
9550 | this.scrollLeft = this.duration - this.viewDuration;
|
9551 | } else {
|
9552 | this.scrollLeft = 0;
|
9553 | }
|
9554 |
|
9555 | this.ee.emit("select", this.duration, this.duration);
|
9556 | });
|
9557 | }
|
9558 |
|
9559 | clear() {
|
9560 | return this.stop().then(() => {
|
9561 | this.tracks = [];
|
9562 | this.soloedTracks = [];
|
9563 | this.mutedTracks = [];
|
9564 | this.playoutPromises = [];
|
9565 |
|
9566 | this.cursor = 0;
|
9567 | this.playbackSeconds = 0;
|
9568 | this.duration = 0;
|
9569 | this.scrollLeft = 0;
|
9570 |
|
9571 | this.seek(0, 0, undefined);
|
9572 | });
|
9573 | }
|
9574 |
|
9575 | record() {
|
9576 | const playoutPromises = [];
|
9577 | this.mediaRecorder.start(300);
|
9578 |
|
9579 | this.tracks.forEach((track) => {
|
9580 | track.setState("none");
|
9581 | playoutPromises.push(
|
9582 | track.schedulePlay(this.ac.currentTime, 0, undefined, {
|
9583 | shouldPlay: this.shouldTrackPlay(track),
|
9584 | })
|
9585 | );
|
9586 | });
|
9587 |
|
9588 | this.playoutPromises = playoutPromises;
|
9589 | }
|
9590 |
|
9591 | startAnimation(startTime) {
|
9592 | this.lastDraw = this.ac.currentTime;
|
9593 | this.animationRequest = window.requestAnimationFrame(() => {
|
9594 | this.updateEditor(startTime);
|
9595 | });
|
9596 | }
|
9597 |
|
9598 | stopAnimation() {
|
9599 | window.cancelAnimationFrame(this.animationRequest);
|
9600 | this.lastDraw = undefined;
|
9601 | }
|
9602 |
|
9603 | seek(start, end, track) {
|
9604 | if (this.isPlaying()) {
|
9605 | this.lastSeeked = start;
|
9606 | this.pausedAt = undefined;
|
9607 | this.restartPlayFrom(start);
|
9608 | } else {
|
9609 |
|
9610 | this.setActiveTrack(track || this.tracks[0]);
|
9611 | this.pausedAt = start;
|
9612 | this.setTimeSelection(start, end);
|
9613 | if (this.getSeekStyle() === "fill") {
|
9614 | this.playbackSeconds = start;
|
9615 | }
|
9616 | }
|
9617 | }
|
9618 |
|
9619 | |
9620 |
|
9621 |
|
9622 |
|
9623 | updateEditor(cursor) {
|
9624 | const currentTime = this.ac.currentTime;
|
9625 | const selection = this.getTimeSelection();
|
9626 | const cursorPos = cursor || this.cursor;
|
9627 | const elapsed = currentTime - this.lastDraw;
|
9628 |
|
9629 | if (this.isPlaying()) {
|
9630 | const playbackSeconds = cursorPos + elapsed;
|
9631 | this.ee.emit("timeupdate", playbackSeconds);
|
9632 | this.animationRequest = window.requestAnimationFrame(() => {
|
9633 | this.updateEditor(playbackSeconds);
|
9634 | });
|
9635 |
|
9636 | this.playbackSeconds = playbackSeconds;
|
9637 | this.draw(this.render());
|
9638 | this.lastDraw = currentTime;
|
9639 | } else {
|
9640 | if (
|
9641 | cursorPos + elapsed >=
|
9642 | (this.isSegmentSelection() ? selection.end : this.duration)
|
9643 | ) {
|
9644 | this.ee.emit("finished");
|
9645 | }
|
9646 |
|
9647 | this.stopAnimation();
|
9648 |
|
9649 | this.resetDrawTimer = setTimeout(() => {
|
9650 | this.pausedAt = undefined;
|
9651 | this.lastSeeked = undefined;
|
9652 | this.setState(this.getState());
|
9653 |
|
9654 | this.playbackSeconds = 0;
|
9655 | this.draw(this.render());
|
9656 | }, 0);
|
9657 | }
|
9658 | }
|
9659 |
|
9660 | drawRequest() {
|
9661 | window.requestAnimationFrame(() => {
|
9662 | this.draw(this.render());
|
9663 | });
|
9664 | }
|
9665 |
|
9666 | draw(newTree) {
|
9667 | const patches = diff_default()(this.tree, newTree);
|
9668 | this.rootNode = patch_default()(this.rootNode, patches);
|
9669 | this.tree = newTree;
|
9670 |
|
9671 |
|
9672 | this.viewDuration = pixelsToSeconds(
|
9673 | this.rootNode.clientWidth - this.controls.width,
|
9674 | this.samplesPerPixel,
|
9675 | this.sampleRate
|
9676 | );
|
9677 | }
|
9678 |
|
9679 | getTrackRenderData(data = {}) {
|
9680 | const defaults = {
|
9681 | height: this.waveHeight,
|
9682 | resolution: this.samplesPerPixel,
|
9683 | sampleRate: this.sampleRate,
|
9684 | controls: this.controls,
|
9685 | isActive: false,
|
9686 | timeSelection: this.getTimeSelection(),
|
9687 | playlistLength: this.duration,
|
9688 | playbackSeconds: this.playbackSeconds,
|
9689 | colors: this.colors,
|
9690 | barWidth: this.barWidth,
|
9691 | barGap: this.barGap,
|
9692 | };
|
9693 |
|
9694 | return lodash_defaultsdeep_default()({}, data, defaults);
|
9695 | }
|
9696 |
|
9697 | isActiveTrack(track) {
|
9698 | const activeTrack = this.getActiveTrack();
|
9699 |
|
9700 | if (this.isSegmentSelection()) {
|
9701 | return activeTrack === track;
|
9702 | }
|
9703 |
|
9704 | return true;
|
9705 | }
|
9706 |
|
9707 | renderAnnotations() {
|
9708 | return this.annotationList.render();
|
9709 | }
|
9710 |
|
9711 | renderTimeScale() {
|
9712 | const controlWidth = this.controls.show ? this.controls.width : 0;
|
9713 | const timeScale = new src_TimeScale(
|
9714 | this.duration,
|
9715 | this.scrollLeft,
|
9716 | this.samplesPerPixel,
|
9717 | this.sampleRate,
|
9718 | controlWidth,
|
9719 | this.colors
|
9720 | );
|
9721 |
|
9722 | return timeScale.render();
|
9723 | }
|
9724 |
|
9725 | renderTrackSection() {
|
9726 | const trackElements = this.tracks.map((track) => {
|
9727 | const collapsed = this.collapsedTracks.indexOf(track) > -1;
|
9728 | return track.render(
|
9729 | this.getTrackRenderData({
|
9730 | isActive: this.isActiveTrack(track),
|
9731 | shouldPlay: this.shouldTrackPlay(track),
|
9732 | soloed: this.soloedTracks.indexOf(track) > -1,
|
9733 | muted: this.mutedTracks.indexOf(track) > -1,
|
9734 | collapsed,
|
9735 | height: collapsed ? this.collapsedWaveHeight : this.waveHeight,
|
9736 | barGap: this.barGap,
|
9737 | barWidth: this.barWidth,
|
9738 | })
|
9739 | );
|
9740 | });
|
9741 |
|
9742 | return h_default()(
|
9743 | "div.playlist-tracks",
|
9744 | {
|
9745 | attributes: {
|
9746 | style: "overflow: auto;",
|
9747 | },
|
9748 | onscroll: (e) => {
|
9749 | this.scrollLeft = pixelsToSeconds(
|
9750 | e.target.scrollLeft,
|
9751 | this.samplesPerPixel,
|
9752 | this.sampleRate
|
9753 | );
|
9754 |
|
9755 | this.ee.emit("scroll");
|
9756 | },
|
9757 | hook: new ScrollHook(this),
|
9758 | },
|
9759 | trackElements
|
9760 | );
|
9761 | }
|
9762 |
|
9763 | render() {
|
9764 | const containerChildren = [];
|
9765 |
|
9766 | if (this.showTimescale) {
|
9767 | containerChildren.push(this.renderTimeScale());
|
9768 | }
|
9769 |
|
9770 | containerChildren.push(this.renderTrackSection());
|
9771 |
|
9772 | if (this.annotationList.length) {
|
9773 | containerChildren.push(this.renderAnnotations());
|
9774 | }
|
9775 |
|
9776 | return h_default()(
|
9777 | "div.playlist",
|
9778 | {
|
9779 | attributes: {
|
9780 | style: "overflow: hidden; position: relative;",
|
9781 | },
|
9782 | },
|
9783 | containerChildren
|
9784 | );
|
9785 | }
|
9786 |
|
9787 | getInfo() {
|
9788 | const info = [];
|
9789 |
|
9790 | this.tracks.forEach((track) => {
|
9791 | info.push(track.getTrackDetails());
|
9792 | });
|
9793 |
|
9794 | return info;
|
9795 | }
|
9796 | });
|
9797 |
|
9798 | ;
|
9799 |
|
9800 |
|
9801 |
|
9802 |
|
9803 |
|
9804 | function init(options = {}, ee = event_emitter_default()()) {
|
9805 | if (options.container === undefined) {
|
9806 | throw new Error("DOM element container must be given.");
|
9807 | }
|
9808 |
|
9809 | window.OfflineAudioContext =
|
9810 | window.OfflineAudioContext || window.webkitOfflineAudioContext;
|
9811 | window.AudioContext = window.AudioContext || window.webkitAudioContext;
|
9812 |
|
9813 | const audioContext = new window.AudioContext();
|
9814 |
|
9815 | const defaults = {
|
9816 | ac: audioContext,
|
9817 | sampleRate: audioContext.sampleRate,
|
9818 | samplesPerPixel: 4096,
|
9819 | mono: true,
|
9820 | fadeType: "logarithmic",
|
9821 | exclSolo: false,
|
9822 | timescale: false,
|
9823 | controls: {
|
9824 | show: false,
|
9825 | width: 150,
|
9826 | widgets: {
|
9827 | muteOrSolo: true,
|
9828 | volume: true,
|
9829 | stereoPan: true,
|
9830 | collapse: true,
|
9831 | remove: true,
|
9832 | },
|
9833 | },
|
9834 | colors: {
|
9835 | waveOutlineColor: "white",
|
9836 | timeColor: "grey",
|
9837 | fadeColor: "black",
|
9838 | },
|
9839 | seekStyle: "line",
|
9840 | waveHeight: 128,
|
9841 | collapsedWaveHeight: 30,
|
9842 | barWidth: 1,
|
9843 | barGap: 0,
|
9844 | state: "cursor",
|
9845 | zoomLevels: [512, 1024, 2048, 4096],
|
9846 | annotationList: {
|
9847 | annotations: [],
|
9848 | controls: [],
|
9849 | editable: false,
|
9850 | linkEndpoints: false,
|
9851 | isContinuousPlay: false,
|
9852 | },
|
9853 | isAutomaticScroll: false,
|
9854 | };
|
9855 |
|
9856 | const config = lodash_defaultsdeep_default()({}, options, defaults);
|
9857 | const zoomIndex = config.zoomLevels.indexOf(config.samplesPerPixel);
|
9858 |
|
9859 | if (zoomIndex === -1) {
|
9860 | throw new Error(
|
9861 | "initial samplesPerPixel must be included in array zoomLevels"
|
9862 | );
|
9863 | }
|
9864 |
|
9865 | const playlist = new Playlist();
|
9866 | playlist.setSampleRate(config.sampleRate);
|
9867 | playlist.setSamplesPerPixel(config.samplesPerPixel);
|
9868 | playlist.setAudioContext(config.ac);
|
9869 | playlist.setEventEmitter(ee);
|
9870 | playlist.setUpEventEmitter();
|
9871 | playlist.setTimeSelection(0, 0);
|
9872 | playlist.setState(config.state);
|
9873 | playlist.setControlOptions(config.controls);
|
9874 | playlist.setWaveHeight(config.waveHeight);
|
9875 | playlist.setCollapsedWaveHeight(config.collapsedWaveHeight);
|
9876 | playlist.setColors(config.colors);
|
9877 | playlist.setZoomLevels(config.zoomLevels);
|
9878 | playlist.setZoomIndex(zoomIndex);
|
9879 | playlist.setMono(config.mono);
|
9880 | playlist.setExclSolo(config.exclSolo);
|
9881 | playlist.setShowTimeScale(config.timescale);
|
9882 | playlist.setSeekStyle(config.seekStyle);
|
9883 | playlist.setAnnotations(config.annotationList);
|
9884 | playlist.setBarGap(config.barGap);
|
9885 | playlist.setBarWidth(config.barWidth);
|
9886 | playlist.isAutomaticScroll = config.isAutomaticScroll;
|
9887 | playlist.isContinuousPlay = config.isContinuousPlay;
|
9888 | playlist.linkedEndpoints = config.linkedEndpoints;
|
9889 |
|
9890 |
|
9891 |
|
9892 | const tree = playlist.render();
|
9893 | const rootNode = create_element_default()(tree);
|
9894 |
|
9895 | config.container.appendChild(rootNode);
|
9896 | playlist.tree = tree;
|
9897 | playlist.rootNode = rootNode;
|
9898 |
|
9899 | return playlist;
|
9900 | }
|
9901 |
|
9902 | function app(options = {}, ee = event_emitter_default()()) {
|
9903 | return init(options, ee);
|
9904 | }
|
9905 |
|
9906 | })();
|
9907 |
|
9908 | WaveformPlaylist = __webpack_exports__;
|
9909 | })()
|
9910 | ; |
\ | No newline at end of file |