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