From 291ddebb26c4eec1856b4e9994dad6b90bfd9279 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niilo=20Kein=C3=A4nen?= Date: Wed, 21 Aug 2024 14:14:39 +0300 Subject: [PATCH] Updates --- main.bundle.js | 2 +- resources/zoomBandChart/cyberspace-selector.png | Bin 0 -> 1073 bytes resources/zoomBandChart/darkgold-selector.png | Bin 0 -> 1064 bytes resources/zoomBandChart/light-selector.png | Bin 0 -> 1145 bytes resources/zoomBandChart/lightnature-selector.png | Bin 0 -> 1139 bytes resources/zoomBandChart/turquoise-selector.png | Bin 0 -> 1036 bytes vendors~main.bundle.js | 2 +- 7 files changed, 2 insertions(+), 2 deletions(-) create mode 100644 resources/zoomBandChart/cyberspace-selector.png create mode 100644 resources/zoomBandChart/darkgold-selector.png create mode 100644 resources/zoomBandChart/light-selector.png create mode 100644 resources/zoomBandChart/lightnature-selector.png create mode 100644 resources/zoomBandChart/turquoise-selector.png diff --git a/main.bundle.js b/main.bundle.js index 5215c50..5af2c85 100644 --- a/main.bundle.js +++ b/main.bundle.js @@ -1 +1 @@ -!function(Q){function F(F){for(var B,n,e=F[0],l=F[1],r=F[2],I=0,g=[];I 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n};\r\nObject.defineProperty(exports, "__esModule", { value: true });\r\nexports.setupSourceLabels = exports.loadAudioFile = exports.sourceAudioFiles = exports.SrcOption = void 0;\r\n/**\r\n * Available source options\r\n */\r\nvar SrcOption;\r\n(function (SrcOption) {\r\n SrcOption["mic"] = "mic";\r\n SrcOption["file"] = "file";\r\n SrcOption["truck"] = "truck";\r\n SrcOption["f500_1000_1000"] = "f500_1000_1000";\r\n SrcOption["symbhony_no_5"] = "symbhony_no_5";\r\n})(SrcOption = exports.SrcOption || (exports.SrcOption = {}));\r\n/**\r\n * Labels for different source options\r\n */\r\nvar srcLabels = {\r\n truck: \'Truck Driving\',\r\n mic: \'Microphone\',\r\n file: \'Load Audio File from URL\',\r\n f500_1000_1000: \'500Hz, 1kHz and 10kHz signals\',\r\n symbhony_no_5: \'Symphony no. 5 in Cm, Op. 67 - IV. Allegro\',\r\n};\r\n/**\r\n * Default audio source files\r\n */\r\nexports.sourceAudioFiles = {\r\n truck: \'Truck_driving_by-Jason_Baker-2112866529.wav\',\r\n symbhony_no_5: \'Symphony no. 5 in Cm, Op. 67 - IV. Allegro.mp3\',\r\n f500_1000_1000: \'500_1000_10000.wav\',\r\n};\r\n/**\r\n * Cache of loaded audio files\r\n */\r\nvar loadedFiles = {};\r\n/**\r\n * Load audio file from url\r\n * @param url URL of the audio file\r\n * @param audioCtx AudioContext\r\n */\r\nvar loadAudioFile = function (url, audioCtx) { return __awaiter(void 0, void 0, void 0, function () {\r\n var request, buffer, audioBuffer;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n // if the file is already cached\r\n if (loadedFiles[url]) {\r\n return [2 /*return*/, loadedFiles[url]];\r\n }\r\n return [4 /*yield*/, fetch(url)];\r\n case 1:\r\n request = _a.sent();\r\n return [4 /*yield*/, request.arrayBuffer()];\r\n case 2:\r\n buffer = _a.sent();\r\n return [4 /*yield*/, audioCtx.decodeAudioData(buffer)];\r\n case 3:\r\n audioBuffer = _a.sent();\r\n loadedFiles[url] = audioBuffer;\r\n return [2 /*return*/, audioBuffer];\r\n }\r\n });\r\n}); };\r\nexports.loadAudioFile = loadAudioFile;\r\n/**\r\n * Create the options for different audio sources\r\n */\r\nvar setupSourceLabels = function () {\r\n var selector = document.getElementById(\'src-selector\');\r\n Object.keys(srcLabels).forEach(function (key) {\r\n var option = document.createElement(\'option\');\r\n option.value = key;\r\n option.text = srcLabels[key];\r\n if (key === SrcOption.truck)\r\n option.selected = true;\r\n selector.appendChild(option);\r\n });\r\n};\r\nexports.setupSourceLabels = setupSourceLabels;\r\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9zcmMvYXVkaW9Tb3VyY2VzLnRzPzc2OGUiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7O0FBQUE7O0dBRUc7QUFDSCxJQUFZLFNBTVg7QUFORCxXQUFZLFNBQVM7SUFDakIsd0JBQVc7SUFDWCwwQkFBYTtJQUNiLDRCQUFlO0lBQ2YsOENBQWlDO0lBQ2pDLDRDQUErQjtBQUNuQyxDQUFDLEVBTlcsU0FBUyxHQUFULGlCQUFTLEtBQVQsaUJBQVMsUUFNcEI7QUFFRDs7R0FFRztBQUNILElBQU0sU0FBUyxHQUFnRDtJQUMzRCxLQUFLLEVBQUUsZUFBZTtJQUN0QixHQUFHLEVBQUUsWUFBWTtJQUNqQixJQUFJLEVBQUUsMEJBQTBCO0lBQ2hDLGNBQWMsRUFBRSwrQkFBK0I7SUFDL0MsYUFBYSxFQUFFLDRDQUE0QztDQUM5RDtBQUVEOztHQUVHO0FBQ1Usd0JBQWdCLEdBQUc7SUFDNUIsS0FBSyxFQUFFLDZDQUE2QztJQUNwRCxhQUFhLEVBQUUsZ0RBQWdEO0lBQy9ELGNBQWMsRUFBRSxvQkFBb0I7Q0FDdkM7QUFFRDs7R0FFRztBQUNILElBQU0sV0FBVyxHQUFtQyxFQUFFO0FBRXREOzs7O0dBSUc7QUFDSSxJQUFNLGF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XHJcbn1cclxuXHJcbi8qKlxyXG4gKiBDcmVhdGUgdGhlIG9wdGlvbnMgZm9yIGRpZmZlcmVudCBhdWRpbyBzb3VyY2VzXHJcbiAqL1xyXG5leHBvcnQgY29uc3Qgc2V0dXBTb3VyY2VMYWJlbHMgPSAoKSA9PiB7XHJcbiAgICBjb25zdCBzZWxlY3RvciA9IGRvY3VtZW50LmdldEVsZW1lbnRCeUlkKCdzcmMtc2VsZWN0b3InKVxyXG4gICAgT2JqZWN0LmtleXMoc3JjTGFiZWxzKS5mb3JFYWNoKChrZXkpID0+IHtcclxuICAgICAgICBjb25zdCBvcHRpb24gPSBkb2N1bWVudC5jcmVhdGVFbGVtZW50KCdvcHRpb24nKVxyXG4gICAgICAgIG9wdGlvbi52YWx1ZSA9IGtleVxyXG4gICAgICAgIG9wdGlvbi50ZXh0ID0gc3JjTGFiZWxzW2tleV1cclxuICAgICAgICBpZiAoa2V5ID09PSBTcmNPcHRpb24udHJ1Y2spIG9wdGlvbi5zZWxlY3RlZCA9IHRydWVcclxuICAgICAgICBzZWxlY3Rvci5hcHBlbmRDaGlsZChvcHRpb24pXHJcbiAgICB9KVxyXG59XHJcbiJdLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///2\n')},,,function(module,exports,__webpack_require__){"use strict";eval("\r\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n};\r\nvar __generator = (this && this.__generator) || function (thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n};\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\n__webpack_require__(6);\r\nvar audioSources_1 = __webpack_require__(2);\r\nvar controls_1 = __webpack_require__(9);\r\nvar audioVisualizer_1 = __webpack_require__(10);\r\n// hide link when in iframe\r\nfunction inIframe() {\r\n try {\r\n return window.self !== window.top;\r\n }\r\n catch (e) {\r\n return true;\r\n }\r\n}\r\nif (inIframe()) {\r\n document.getElementById('github-link').style.display = 'none';\r\n}\r\n/**\r\n * Current Audio source\r\n */\r\nvar src = audioSources_1.SrcOption.mic;\r\n// setup the source selector\r\n(0, audioSources_1.setupSourceLabels)();\r\n// create a new instance of the AudioVisualizer class, this handles all of the actual visualization work\r\nvar audioVisualizer = new audioVisualizer_1.AudioVisualizer();\r\n// attach the play and pause buttons to the audioVisualizer play and pause methods\r\n(0, controls_1.setupPlayPause)(audioVisualizer.play.bind(audioVisualizer), audioVisualizer.pause.bind(audioVisualizer));\r\nvar srcSelector = document.getElementById('src-selector');\r\nvar audioFileUrlPlay = document.getElementById('load-url');\r\nvar audioFileUrl = document.getElementById('audio-file');\r\n/**\r\n * Audio file from url play\r\n */\r\naudioFileUrlPlay.addEventListener('click', function () { return __awaiter(void 0, void 0, void 0, function () {\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0: return [4 /*yield*/, listenToFileURL(audioFileUrl.value)];\r\n case 1:\r\n _a.sent();\r\n return [4 /*yield*/, audioVisualizer.play()];\r\n case 2:\r\n _a.sent();\r\n return [2 /*return*/];\r\n }\r\n });\r\n}); });\r\n/**\r\n * Update the current visualizer source\r\n */\r\nvar updateSource = function () { return __awaiter(void 0, void 0, void 0, function () {\r\n var selectedOptionElement, ai, _a;\r\n return __generator(this, function (_b) {\r\n switch (_b.label) {\r\n case 0:\r\n selectedOptionElement = srcSelector[srcSelector.selectedIndex];\r\n src = selectedOptionElement.value;\r\n if (src === audioSources_1.SrcOption.file) {\r\n document.getElementById('audio-input').style.display = 'flex';\r\n }\r\n else {\r\n ai = document.getElementById('audio-input');\r\n ai.style.display = 'none';\r\n ai.value = '';\r\n }\r\n return [4 /*yield*/, audioVisualizer.pause()];\r\n case 1:\r\n _b.sent();\r\n _a = src;\r\n switch (_a) {\r\n case audioSources_1.SrcOption.mic: return [3 /*break*/, 2];\r\n case audioSources_1.SrcOption.file: return [3 /*break*/, 5];\r\n case audioSources_1.SrcOption.truck: return [3 /*break*/, 6];\r\n case audioSources_1.SrcOption.f500_1000_1000: return [3 /*break*/, 9];\r\n case audioSources_1.SrcOption.symbhony_no_5: return [3 /*break*/, 12];\r\n }\r\n return [3 /*break*/, 15];\r\n case 2: return [4 /*yield*/, listenMic()];\r\n case 3:\r\n _b.sent();\r\n return [4 /*yield*/, audioVisualizer.play()];\r\n case 4:\r\n _b.sent();\r\n return [3 /*break*/, 15];\r\n case 5:\r\n audioVisualizer.setSource(undefined);\r\n return [3 /*break*/, 15];\r\n case 6: return [4 /*yield*/, listenToFileURL(audioSources_1.sourceAudioFiles.truck)];\r\n case 7:\r\n _b.sent();\r\n return [4 /*yield*/, audioVisualizer.play()];\r\n case 8:\r\n _b.sent();\r\n return [3 /*break*/, 15];\r\n case 9: return [4 /*yield*/, listenToFileURL(audioSources_1.sourceAudioFiles.f500_1000_1000)];\r\n case 10:\r\n _b.sent();\r\n return [4 /*yield*/, audioVisualizer.play()];\r\n case 11:\r\n _b.sent();\r\n return [3 /*break*/, 15];\r\n case 12: return [4 /*yield*/, listenToFileURL(audioSources_1.sourceAudioFiles.symbhony_no_5)];\r\n case 13:\r\n _b.sent();\r\n return [4 /*yield*/, audioVisualizer.play()];\r\n case 14:\r\n _b.sent();\r\n return [3 /*break*/, 15];\r\n case 15: return [2 /*return*/];\r\n }\r\n });\r\n}); };\r\nsrcSelector.addEventListener('change', updateSource);\r\nupdateSource();\r\nvar listenElement = document.getElementById('listen');\r\n/**\r\n * Mute/unmute audio output based on the selection state\r\n */\r\nvar updateListenState = function () {\r\n if (listenElement.checked) {\r\n audioVisualizer.setGain(1);\r\n }\r\n else {\r\n audioVisualizer.setGain(0);\r\n }\r\n};\r\nlistenElement.addEventListener('change', updateListenState);\r\n/**\r\n * Listen to microphone\r\n */\r\nfunction listenMic() {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var src;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0: return [4 /*yield*/, audioVisualizer.createMicSource()];\r\n case 1:\r\n src = _a.sent();\r\n audioVisualizer.setSource(src);\r\n return [2 /*return*/];\r\n }\r\n });\r\n });\r\n}\r\n/**\r\n * Listen to a file from a url\r\n * @param url URL of the file\r\n */\r\nfunction listenToFileURL(url) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var src;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0: return [4 /*yield*/, audioVisualizer.createUrlSource(url)];\r\n case 1:\r\n src = _a.sent();\r\n audioVisualizer.setSource(src);\r\n return [2 /*return*/];\r\n }\r\n });\r\n });\r\n}\r\n// hide the play button if it's not needed\r\naudioVisualizer.getContext().addEventListener('statechange', function () {\r\n if (!resumeElement.hidden && audioVisualizer.getState() !== 'suspended') {\r\n resumeElement.hidden = true;\r\n }\r\n});\r\n// handle cases where the audio context was created in suspended state\r\nvar resumeElement = document.getElementById('resume');\r\nresumeElement.addEventListener('click', function () {\r\n audioVisualizer.play();\r\n});\r\nif (audioVisualizer.getState() === 'suspended') {\r\n resumeElement.hidden = false;\r\n}\r\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9zcmMvYXBwLnRzPzA2NmUiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7QUFBQSx1QkFBMEI7QUFDMUIsNENBQStFO0FBQy9FLHdDQUEyQztBQUMzQyxnREFBbUQ7QUFFbkQsMkJBQTJCO0FBQzNCLFNBQVMsUUFBUTtJQUNiLElBQUk7UUFDQSxPQUFPLE1BQU0sQ0FBQyxJQUFJLEtBQUssTUFBTSxDQUFDLEdBQUc7S0FDcEM7SUFBQyxPQUFPLENBQUMsRUFBRTtRQUNSLE9BQU8sSUFBSTtLQUNkO0FBQ0wsQ0FBQztBQUNELElBQUksUUFBUSxFQUFFLEVBQUU7SUFDWixRQUFRLENBQUMsY0FBYyxDQUFDLGF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ICAgICAgYWkuc3R5bGUuZGlzcGxheSA9ICdub25lJ1xyXG4gICAgICAgIGFpLnZhbHVlID0gJydcclxuICAgIH1cclxuICAgIGF3YWl0IGF1ZGlvVmlzdWFsaXplci5wYXVzZSgpXHJcbiAgICBzd2l0Y2ggKHNyYykge1xyXG4gICAgICAgIGNhc2UgU3JjT3B0aW9uLm1pYzpcclxuICAgICAgICAgICAgYXdhaXQgbGlzdGVuTWljKClcclxuICAgICAgICAgICAgYXdhaXQgYXVkaW9WaXN1YWxpemVyLnBsYXkoKVxyXG4gICAgICAgICAgICBicmVha1xyXG4gICAgICAgIGNhc2UgU3JjT3B0aW9uLmZpbGU6XHJcbiAgICAgICAgICAgIGF1ZGlvVmlzdWFsaXplci5zZXRTb3VyY2UodW5kZWZpbmVkKVxyXG4gICAgICAgICAgICBicmVha1xyXG4gICAgICAgIGNhc2UgU3JjT3B0aW9uLnRydWNrOlxyXG4gICAgICAgICAgICBhd2FpdCBsaXN0ZW5Ub0ZpbGVVUkwoc291cmNlQXVkaW9GaWxlcy50cnVjaylcclxuICAgICAgICAgICAgYXdhaXQgYXVkaW9WaXN1YWxpemVyLnBsYXkoKVxyXG4gICAgICAgICAgICBicmVha1xyXG4gICAgICAgIGNhc2UgU3JjT3B0aW9uLmY1MDBfMTAwMF8xMDAwOlxyXG4gICAgICAgICAgICBhd2FpdCBsaXN0ZW5Ub0ZpbGVVUkwoc291cmNlQXVkaW9GaWxlcy5mNTAwXzEwMDBfMTAwMClcclxuICAgICAgICAgICAgYXdhaXQgYXVkaW9WaXN1YWxpemVyLnBsYXkoKVxyXG4gICAgICAgICAgICBicmVha1xyXG4gICAgICAgIGNhc2UgU3JjT3B0aW9uLnN5bWJob255X25vXzU6XHJcbiAgICAgICAgICAgIGF3YWl0IGxpc3RlblRvRmlsZVVSTChzb3VyY2VBdWRpb0ZpbGVzLnN5bWJob255X25vXzUpXHJcbiAgICAgICAgICAgIGF3YWl0IGF1ZGlvVmlzdWFsaXplci5wbGF5K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jdGlvbiBsaXN0ZW5Ub0ZpbGVVUkwodXJsKTogUHJvbWlzZTx2b2lkPiB7XHJcbiAgICBjb25zdCBzcmMgPSBhd2FpdCBhdWRpb1Zpc3VhbGl6ZXIuY3JlYXRlVXJsU291cmNlKHVybClcclxuICAgIGF1ZGlvVmlzdWFsaXplci5zZXRTb3VyY2Uoc3JjKVxyXG59XHJcblxyXG4vLyBoaWRlIHRoZSBwbGF5IGJ1dHRvbiBpZiBpdCdzIG5vdCBuZWVkZWRcclxuYXVkaW9WaXN1YWxpemVyLmdldENvbnRleHQoKS5hZGRFdmVudExpc3RlbmVyKCdzdGF0ZWNoYW5nZScsICgpID0+IHtcclxuICAgIGlmICghcmVzdW1lRWxlbWVudC5oaWRkZW4gJiYgYXVkaW9WaXN1YWxpemVyLmdldFN0YXRlKCkgIT09ICdzdXNwZW5kZWQnKSB7XHJcbiAgICAgICAgcmVzdW1lRWxlbWVudC5oaWRkZW4gPSB0cnVlXHJcbiAgICB9XHJcbn0pXHJcblxyXG4vLyBoYW5kbGUgY2FzZXMgd2hlcmUgdGhlIGF1ZGlvIGNvbnRleHQgd2FzIGNyZWF0ZWQgaW4gc3VzcGVuZGVkIHN0YXRlXHJcbmNvbnN0IHJlc3VtZUVsZW1lbnQgPSBkb2N1bWVudC5nZXRFbGVtZW50QnlJZCgncmVzdW1lJylcclxucmVzdW1lRWxlbWVudC5hZGRFdmVudExpc3RlbmVyKCdjbGljaycsICgpID0+IHtcclxuICAgIGF1ZGlvVmlzdWFsaXplci5wbGF5KClcclxufSlcclxuaWYgKGF1ZGlvVmlzdWFsaXplci5nZXRTdGF0ZSgpID09PSAnc3VzcGVuZGVkJykge1xyXG4gICAgcmVzdW1lRWxlbWVudC5oaWRkZW4gPSBmYWxzZVxyXG59XHJcbiJdLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///5\n")},function(module,exports,__webpack_require__){eval("var api = __webpack_require__(7);\n var content = __webpack_require__(8);\n\n content = content.__esModule ? content.default : content;\n\n if (typeof content === 'string') {\n content = [[module.i, content, '']];\n }\n\nvar options = {};\n\noptions.insert = \"head\";\noptions.singleton = false;\n\nvar update = api(content, options);\n\n\n\nmodule.exports = content.locals || {};//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9zcmMvc3R5bGVzL21haW4uY3NzP2U4MGEiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsVUFBVSxtQkFBTyxDQUFDLENBQTJFO0FBQzdGLDBCQUEwQixtQkFBTyxDQUFDLENBQXdEOztBQUUxRjs7QUFFQTtBQUNBLDBCQUEwQixRQUFTO0FBQ25DOztBQUVBOztBQUVBO0FBQ0E7O0FBRUE7Ozs7QUFJQSIsImZpbGUiOiI2LmpzIiwic291cmNlc0NvbnRlbnQiOlsidmFyIGFwaSA9IHJlcXVpcmUoXCIhLi4vLi4vbm9kZV9tb2R1bGVzL3N0eWxlLWxvYWRlci9kaXN0L3J1bnRpbWUvaW5qZWN0U3R5bGVzSW50b1N0eWxlVGFnLmpzXCIpO1xuICAgICAgICAgICAgdmFyIGNvbnRlbnQgPSByZXF1aXJlKFwiISEuLi8uLi9ub2RlX21vZHVsZXMvY3NzLWxvYWRlci9kaXN0L2Nqcy5qcyEuL21haW4uY3NzXCIpO1xuXG4gICAgICAgICAgICBjb250ZW50ID0gY29udGVudC5fX2VzTW9kdWxlID8gY29udGVudC5kZWZhdWx0IDogY29udGVudDtcblxuICAgICAgICAgICAgaWYgKHR5cGVvZiBjb250ZW50ID09PSAnc3RyaW5nJykge1xuICAgICAgICAgICAgICBjb250ZW50ID0gW1ttb2R1bGUuaWQsIGNvbnRlbnQsICcnXV07XG4gICAgICAgICAgICB9XG5cbnZhciBvcHRpb25zID0ge307XG5cbm9wdGlvbnMuaW5zZXJ0ID0gXCJoZWFkXCI7XG5vcHRpb25zLnNpbmdsZXRvbiA9IGZhbHNlO1xuXG52YXIgdXBkYXRlID0gYXBpKGNvbnRlbnQsIG9wdGlvbnMpO1xuXG5cblxubW9kdWxlLmV4cG9ydHMgPSBjb250ZW50LmxvY2FscyB8fCB7fTsiXSwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///6\n")},,function(module,__webpack_exports__,__webpack_require__){"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(3);\n/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0__);\n// Imports\n\nvar ___CSS_LOADER_EXPORT___ = _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0___default()(true);\n// Module\n___CSS_LOADER_EXPORT___.push([module.i, "html,\\r\\nbody {\\r\\n margin: 0;\\r\\n height: 100%;\\r\\n overflow: hidden;\\r\\n background-color: #1c3450;\\r\\n}\\r\\n\\r\\n.container {\\r\\n height: 100%;\\r\\n width: 100%;\\r\\n display: flex;\\r\\n flex-direction: column;\\r\\n}\\r\\n\\r\\n.container #chart {\\r\\n flex: 1 1 auto;\\r\\n display: flex;\\r\\n height: 100%;\\r\\n width: 100%;\\r\\n}\\r\\n\\r\\n.container #chart canvas {\\r\\n height: auto !important;\\r\\n}\\r\\n\\r\\n#resume {\\r\\n position: fixed;\\r\\n top: 0;\\r\\n left: 0;\\r\\n right: 0;\\r\\n bottom: 0;\\r\\n z-index: 1;\\r\\n cursor: pointer;\\r\\n}\\r\\n\\r\\n#resume img {\\r\\n width: 100%;\\r\\n height: 100%;\\r\\n}\\r\\n\\r\\n#play-pause {\\r\\n height: 33px;\\r\\n width: 40px;\\r\\n}\\r\\n\\r\\n#github-link {\\r\\n position: fixed;\\r\\n display: block;\\r\\n top: 0;\\r\\n right: 0;\\r\\n margin-left: auto;\\r\\n z-index: 2;\\r\\n}\\r\\n\\r\\n#github-link img {\\r\\n display: block;\\r\\n margin: 10px 10px 10px auto;\\r\\n}\\r\\n\\r\\n@media screen and (max-width: 770px) {\\r\\n #github-link {\\r\\n top: unset;\\r\\n bottom: 0;\\r\\n }\\r\\n}\\r\\n\\r\\n#controls {\\r\\n z-index: 1;\\r\\n display: flex;\\r\\n}\\r\\n\\r\\n#controls label {\\r\\n color: #e4e4e4;\\r\\n align-self: center;\\r\\n}\\r\\n\\r\\n#controls input {\\r\\n align-self: center;\\r\\n}\\r\\n\\r\\n.audio-input * {\\r\\n align-self: center;\\r\\n}\\r\\n\\r\\n.error {\\r\\n z-index: 2;\\r\\n position: fixed;\\r\\n top: 50%;\\r\\n font-size: larger;\\r\\n background-color: #0009;\\r\\n color: white;\\r\\n left: 0;\\r\\n right: 0;\\r\\n}\\r\\n", "",{"version":3,"sources":["webpack://src/styles/main.css"],"names":[],"mappings":"AAAA;;IAEI,SAAS;IACT,YAAY;IACZ,gBAAgB;IAChB,yBAAyB;AAC7B;;AAEA;IACI,YAAY;IACZ,WAAW;IACX,aAAa;IACb,sBAAsB;AAC1B;;AAEA;IACI,cAAc;IACd,aAAa;IACb,YAAY;IACZ,WAAW;AACf;;AAEA;IACI,uBAAuB;AAC3B;;AAEA;IACI,eAAe;IACf,MAAM;IACN,OAAO;IACP,QAAQ;IACR,SAAS;IACT,UAAU;IACV,eAAe;AACnB;;AAEA;IACI,WAAW;IACX,YAAY;AAChB;;AAEA;IACI,YAAY;IACZ,WAAW;AACf;;AAEA;IACI,eAAe;IACf,cAAc;IACd,MAAM;IACN,QAAQ;IACR,iBAAiB;IACjB,UAAU;AACd;;AAEA;IACI,cAAc;IACd,2BAA2B;AAC/B;;AAEA;IACI;QACI,UAAU;QACV,SAAS;IACb;AACJ;;AAEA;IACI,UAAU;IACV,aAAa;AACjB;;AAEA;IACI,cAAc;IACd,kBAAkB;AACtB;;AAEA;IACI,kBAAkB;AACtB;;AAEA;IACI,kBAAkB;AACtB;;AAEA;IACI,UAAU;IACV,eAAe;IACf,QAAQ;IACR,iBAAiB;IACjB,uBAAuB;IACvB,YAAY;IACZ,OAAO;IACP,QAAQ;AACZ","sourcesContent":["html,\\r\\nbody {\\r\\n margin: 0;\\r\\n height: 100%;\\r\\n overflow: hidden;\\r\\n background-color: #1c3450;\\r\\n}\\r\\n\\r\\n.container {\\r\\n height: 100%;\\r\\n width: 100%;\\r\\n display: flex;\\r\\n flex-direction: column;\\r\\n}\\r\\n\\r\\n.container #chart {\\r\\n flex: 1 1 auto;\\r\\n display: flex;\\r\\n height: 100%;\\r\\n width: 100%;\\r\\n}\\r\\n\\r\\n.container #chart canvas {\\r\\n height: auto !important;\\r\\n}\\r\\n\\r\\n#resume {\\r\\n position: fixed;\\r\\n top: 0;\\r\\n left: 0;\\r\\n right: 0;\\r\\n bottom: 0;\\r\\n z-index: 1;\\r\\n cursor: pointer;\\r\\n}\\r\\n\\r\\n#resume img {\\r\\n width: 100%;\\r\\n height: 100%;\\r\\n}\\r\\n\\r\\n#play-pause {\\r\\n height: 33px;\\r\\n width: 40px;\\r\\n}\\r\\n\\r\\n#github-link {\\r\\n position: fixed;\\r\\n display: block;\\r\\n top: 0;\\r\\n right: 0;\\r\\n margin-left: auto;\\r\\n z-index: 2;\\r\\n}\\r\\n\\r\\n#github-link img {\\r\\n display: block;\\r\\n margin: 10px 10px 10px auto;\\r\\n}\\r\\n\\r\\n@media screen and (max-width: 770px) {\\r\\n #github-link {\\r\\n top: unset;\\r\\n bottom: 0;\\r\\n }\\r\\n}\\r\\n\\r\\n#controls {\\r\\n z-index: 1;\\r\\n display: flex;\\r\\n}\\r\\n\\r\\n#controls label {\\r\\n color: #e4e4e4;\\r\\n align-self: center;\\r\\n}\\r\\n\\r\\n#controls input {\\r\\n align-self: center;\\r\\n}\\r\\n\\r\\n.audio-input * {\\r\\n align-self: center;\\r\\n}\\r\\n\\r\\n.error {\\r\\n z-index: 2;\\r\\n position: fixed;\\r\\n top: 50%;\\r\\n font-size: larger;\\r\\n background-color: #0009;\\r\\n color: white;\\r\\n left: 0;\\r\\n right: 0;\\r\\n}\\r\\n"],"sourceRoot":""}]);\n// Exports\n/* harmony default export */ __webpack_exports__["default"] = (___CSS_LOADER_EXPORT___);\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9zcmMvc3R5bGVzL21haW4uY3NzPzU2MDciXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7QUFBQTtBQUFBO0FBQUE7QUFDNEY7QUFDNUYsOEJBQThCLG1GQUEyQjtBQUN6RDtBQUNBLDhCQUE4QixRQUFTLGtCQUFrQixrQkFBa0IscUJBQXFCLHlCQUF5QixrQ0FBa0MsS0FBSyxvQkFBb0IscUJBQXFCLG9CQUFvQixzQkFBc0IsK0JBQStCLEtBQUssMkJBQTJCLHVCQUF1QixzQkFBc0IscUJBQXFCLG9CQUFvQixLQUFLLGtDQUFrQyxnQ0FBZ0MsS0FBSyxpQkFBaUIsd0JBQXdCLGVBQWUsZ0JBQWdCLGlCQUFpQixrQkFBa0IsbUJBQW1CLHdCQUF3QixLQUFLLHFCQUFxQixvQkFBb0IscUJBQXFCLEtBQUsscUJBQXFCLHFCQUFxQixvQkFBb0IsS0FBSyxzQkFBc0Isd0JBQXdCLHVCQUF1QixlQUFlLGlCQUFpQiwwQkFBMEIsbUJBQW1CLEtBQUssMEJBQTBCLHVCQUF1QixvQ0FBb0MsS0FBSyw4Q0FBOEMsc0JBQXNCLHVCQUF1QixzQkFBc0IsU0FBUyxLQUFLLG1CQUFtQixtQkFBbUIsc0JBQXNCLEtBQUsseUJBQXlCLHVCQUF1QiwyQkFBMkIsS0FBSyx5QkFBeUIsMkJBQTJCLEtBQUssd0JBQXdCLDJCQUEyQixLQUFLLGdCQUFnQixtQkFBbUIsd0JBQXdC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BtYXJnaW46IDEwcHggMTBweCAxMHB4IGF1dG87XFxyXFxufVxcclxcblxcclxcbkBtZWRpYSBzY3JlZW4gYW5kIChtYXgtd2lkdGg6IDc3MHB4KSB7XFxyXFxuICAgICNnaXRodWItbGluayB7XFxyXFxuICAgICAgICB0b3A6IHVuc2V0O1xcclxcbiAgICAgICAgYm90dG9tOiAwO1xcclxcbiAgICB9XFxyXFxufVxcclxcblxcclxcbiNjb250cm9scyB7XFxyXFxuICAgIHotaW5kZXg6IDE7XFxyXFxuICAgIGRpc3BsYXk6IGZsZXg7XFxyXFxufVxcclxcblxcclxcbiNjb250cm9scyBsYWJlbCB7XFxyXFxuICAgIGNvbG9yOiAjZTRlNGU0O1xcclxcbiAgICBhbGlnbi1zZWxmOiBjZW50ZXI7XFxyXFxufVxcclxcblxcclxcbiNjb250cm9scyBpbnB1dCB7XFxyXFxuICAgIGFsaWduLXNlbGY6IGNlbnRlcjtcXHJcXG59XFxyXFxuXFxyXFxuLmF1ZGlvLWlucHV0ICoge1xcclxcbiAgICBhbGlnbi1zZWxmOiBjZW50ZXI7XFxyXFxufVxcclxcblxcclxcbi5lcnJvciB7XFxyXFxuICAgIHotaW5kZXg6IDI7XFxyXFxuICAgIHBvc2l0aW9uOiBmaXhlZDtcXHJcXG4gICAgdG9wOiA1MCU7XFxyXFxuICAgIGZvbnQtc2l6ZTogbGFyZ2VyO1xcclxcbiAgICBiYWNrZ3JvdW5kLWNvbG9yOiAjMDAwOTtcXHJcXG4gICAgY29sb3I6IHdoaXRlO1xcclxcbiAgICBsZWZ0OiAwO1xcclxcbiAgICByaWdodDogMDtcXHJcXG59XFxyXFxuXCJdLFwic291cmNlUm9vdFwiOlwiXCJ9XSk7XG4vLyBFeHBvcnRzXG5leHBvcnQgZGVmYXVsdCBfX19DU1NfTE9BREVSX0VYUE9SVF9fXztcbiJdLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///8\n')},function(module,exports,__webpack_require__){"use strict";eval('\r\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n};\r\nvar __generator = (this && this.__generator) || function (thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError("Generator is already executing.");\r\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n};\r\nObject.defineProperty(exports, "__esModule", { value: true });\r\nexports.setupPlayPause = void 0;\r\n/**\r\n * Setup play and pause event listeners\r\n * @param onPlay Function to run when \'Play\' button is pressed\r\n * @param onPause Function to run when \'Pause\' button is pressed\r\n */\r\nvar setupPlayPause = function (onPlay, onPause) {\r\n var play = document.getElementById(\'play\');\r\n play.addEventListener(\'click\', function () { return __awaiter(void 0, void 0, void 0, function () {\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0: return [4 /*yield*/, onPlay()];\r\n case 1:\r\n _a.sent();\r\n play.hidden = true;\r\n pause.hidden = false;\r\n return [2 /*return*/];\r\n }\r\n });\r\n }); });\r\n var pause = document.getElementById(\'pause\');\r\n pause.addEventListener(\'click\', function () { return __awaiter(void 0, void 0, void 0, function () {\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0: return [4 /*yield*/, onPause()];\r\n case 1:\r\n _a.sent();\r\n pause.hidden = true;\r\n play.hidden = false;\r\n return [2 /*return*/];\r\n }\r\n });\r\n }); });\r\n};\r\nexports.setupPlayPause = setupPlayPause;\r\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9zcmMvY29udHJvbHMudHM/ZGMwYyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7QUFBQTs7OztHQUlHO0FBQ0ksSUFBTSxjQUFjLEdBQUcsVUFBQyxNQUFNLEVBQUUsT0FBTztJQUMxQyxJQUFNLElBQUksR0FBRyxRQUFRLENBQUMsY0FBYyxDQUFDLE1BQU0sQ0FBQztJQUM1QyxJQUFJ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WVcclxuICAgICAgICBwYXVzZS5oaWRkZW4gPSBmYWxzZVxyXG4gICAgfSlcclxuXHJcbiAgICBjb25zdCBwYXVzZSA9IGRvY3VtZW50LmdldEVsZW1lbnRCeUlkKCdwYXVzZScpXHJcbiAgICBwYXVzZS5hZGRFdmVudExpc3RlbmVyKCdjbGljaycsIGFzeW5jICgpID0+IHtcclxuICAgICAgICBhd2FpdCBvblBhdXNlKClcclxuICAgICAgICBwYXVzZS5oaWRkZW4gPSB0cnVlXHJcbiAgICAgICAgcGxheS5oaWRkZW4gPSBmYWxzZVxyXG4gICAgfSlcclxufVxyXG4iXSwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///9\n')},function(module,exports,__webpack_require__){"use strict";eval("\r\nvar __assign = (this && this.__assign) || function () {\r\n __assign = Object.assign || function(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\r\n t[p] = s[p];\r\n }\r\n return t;\r\n };\r\n return __assign.apply(this, arguments);\r\n};\r\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n};\r\nvar __generator = (this && this.__generator) || function (thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n};\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nexports.AudioVisualizer = void 0;\r\nvar audioSources_1 = __webpack_require__(2);\r\nvar lcjs_1 = __webpack_require__(11);\r\nvar utils_1 = __webpack_require__(13);\r\n// // Use theme if provided\r\nvar urlParams = new URLSearchParams(window.location.search);\r\nvar theme = lcjs_1.Themes[urlParams.get('theme')] || lcjs_1.Themes.darkGold;\r\nif (!theme.isDark) {\r\n document.body.style.backgroundColor = '#fff';\r\n document.querySelector('label').style.color = '#000';\r\n}\r\n/**\r\n * Update points in a given array with new values\r\n * @param arr Array of points to update\r\n * @param buf Input data buffer\r\n * @param xScaler Scaler for the X-values\r\n * @param yScaler Scaler for the Y-values\r\n */\r\nfunction updatePoints(arr, buf, xScaler, yScaler) {\r\n if (xScaler === void 0) { xScaler = utils_1.noScaler; }\r\n if (yScaler === void 0) { yScaler = utils_1.noScaler; }\r\n for (var i = 0; i < arr.length; i += 1) {\r\n var p = arr[i];\r\n p.y = yScaler(buf[i]);\r\n p.x = xScaler(i);\r\n }\r\n}\r\n/**\r\n * Convert ArrayBuffer to a Point array\r\n * @param buf Buffer to convert to point array\r\n * @param xScaler Scaler for the X-values\r\n * @param yScaler Scaler for the Y-values\r\n */\r\nfunction ArrayBufferToPointArray(buf, xScaler, yScaler) {\r\n if (xScaler === void 0) { xScaler = utils_1.noScaler; }\r\n if (yScaler === void 0) { yScaler = utils_1.noScaler; }\r\n return Array.from(buf).map(function (p, i) { return ({ x: xScaler(i), y: yScaler(p) }); });\r\n}\r\n/**\r\n * Audio Visualizer\r\n *\r\n * Visualizes given Audio source\r\n */\r\nvar AudioVisualizer = /** @class */ (function () {\r\n function AudioVisualizer() {\r\n var _this = this;\r\n /**\r\n * The 'time' of the last waveform data input point\r\n */\r\n this._lastTime = 0;\r\n this._spectrogramDataCount = 512;\r\n this._waveformHistoryLength = 25;\r\n var AudioContext = window.AudioContext || window.webkitAudioContext;\r\n // setup the audio context\r\n try {\r\n this._audioCtx = new AudioContext();\r\n }\r\n catch (e) {\r\n // AudioContext is not supported.\r\n document.getElementById('ie-error').hidden = false;\r\n throw e;\r\n }\r\n this._audioCtx.createScriptProcessor = this._audioCtx.createScriptProcessor || this._audioCtx.createJavaScriptNode;\r\n this._audioNodes = {\r\n analyzer: this._audioCtx.createAnalyser(),\r\n // the script processor node is deprecated node so it will be removed in future\r\n // it has been replaced with audio worklet but those have really bad browser support currently\r\n processor: this._audioCtx.createScriptProcessor(2048, 1, 1),\r\n gain: this._audioCtx.createGain(),\r\n };\r\n // mute audio output by default\r\n this._audioNodes.gain.gain.setValueAtTime(0, this._audioCtx.currentTime);\r\n var spectrogramHistoryLength = this._spectrogramDataCount * (this._audioNodes.analyzer.fftSize / this._audioCtx.sampleRate);\r\n var mScaler = (0, utils_1.multiplierScaler)(this._audioCtx.sampleRate / this._audioNodes.analyzer.fftSize);\r\n var dScaler = (0, utils_1.dbScaler)(this._audioNodes.analyzer);\r\n // setup audio processor\r\n this._audioNodes.processor.onaudioprocess = function (ev) {\r\n // update data from analyzer\r\n _this._audioNodes.analyzer.getByteTimeDomainData(_this._data.timeDomain);\r\n _this._audioNodes.analyzer.getByteFrequencyData(_this._data.frequency);\r\n // update frequency points\r\n updatePoints(_this._points.frequency, _this._data.frequency, mScaler, dScaler);\r\n // update history and max history data\r\n for (var i = 0; i < _this._data.history.length; i++) {\r\n _this._data.history[i] = Math.max(Math.max(_this._data.frequency[i], _this._data.history[i] - 25 / 1000), 0);\r\n _this._data.maxHistory[i] = Math.max(Math.max(_this._data.frequency[i], _this._data.maxHistory[i]), 0);\r\n }\r\n // update frequency history points\r\n updatePoints(_this._points.history, _this._data.history, mScaler, dScaler);\r\n // update frequency max history points\r\n updatePoints(_this._points.maxHistory, _this._data.maxHistory, mScaler, dScaler);\r\n // update time domain points\r\n updatePoints(_this._points.timeDomain, _this._data.timeDomain, utils_1.noScaler, utils_1.freqScaler);\r\n // update time domain data\r\n _this._series.timeDomain.clear();\r\n _this._series.timeDomain.add(_this._points.timeDomain);\r\n // // add waveform data to the waveform series\r\n var waveData = ArrayBufferToPointArray(_this._data.timeDomain, (0, utils_1.offSetScaler)(_this._lastTime), utils_1.freqScaler);\r\n _this._series.waveform.add(waveData);\r\n _this._lastTime += waveData.length;\r\n var freqData = Array.from(_this._data.frequency);\r\n // this._series.spectrogram.addColumn(1, 'value', [freqData])\r\n _this._series.spectrogram.addIntensityValues([freqData]);\r\n _this.update();\r\n // output the audio\r\n ev.outputBuffer.copyToChannel(ev.inputBuffer.getChannelData(0), 0);\r\n };\r\n // setup node graph\r\n this._audioNodes.analyzer.connect(this._audioNodes.processor);\r\n this._audioNodes.processor.connect(this._audioNodes.gain);\r\n this._audioNodes.gain.connect(this._audioCtx.destination);\r\n // setup buffers\r\n var fBinCount = this._audioNodes.analyzer.frequencyBinCount;\r\n this._data = {\r\n timeDomain: new Uint8Array(this._audioNodes.analyzer.fftSize),\r\n frequency: new Uint8Array(fBinCount),\r\n history: new Uint8Array(fBinCount),\r\n maxHistory: new Uint8Array(fBinCount),\r\n };\r\n // setup point arrays\r\n var mapXAxisToSampleRate = function (_, i) { return ({ x: (_this._audioCtx.sampleRate / _this._audioNodes.analyzer.fftSize) * i, y: 0 }); };\r\n this._points = {\r\n timeDomain: Array.from(Array(this._data.timeDomain.length)).map(function (_, i) { return ({ x: i, y: 0 }); }),\r\n frequency: Array.from(Array(fBinCount)).map(mapXAxisToSampleRate),\r\n history: Array.from(Array(fBinCount)).map(mapXAxisToSampleRate),\r\n maxHistory: Array.from(Array(fBinCount)).map(mapXAxisToSampleRate),\r\n };\r\n // setup dashboard\r\n this._setupDashboard();\r\n var maxFreq = (this._audioCtx.sampleRate / this._audioNodes.analyzer.fftSize) * this._audioNodes.analyzer.frequencyBinCount;\r\n // setup charts\r\n this._charts = {\r\n timeDomain: this._setupChart({ columnIndex: 0, columnSpan: 2, rowIndex: 0, rowSpan: 1 }, 'Time Domain', 'Sample', 'Amplitude', [-1, 1]),\r\n waveformHistory: this._setupChart({ columnIndex: 0, columnSpan: 2, rowIndex: 1, rowSpan: 1 }, 'Waveform history', 'Time (s)', 'Amplitude', [-1, 1]),\r\n spectrum: this._setupChart({ columnIndex: 0, columnSpan: 1, rowIndex: 2, rowSpan: 1 }, 'Spectrum', 'Frequency (Hz)', 'dB', [0, 256]),\r\n spectrogram: this._setupChart({ columnIndex: 1, columnSpan: 1, rowIndex: 2, rowSpan: 1 }, 'Spectrogram', 's', 'Frequency (Hz)', [0, maxFreq / 2]),\r\n };\r\n this._charts.waveformHistory\r\n .getDefaultAxisX()\r\n .setScrollStrategy(lcjs_1.AxisScrollStrategies.progressive)\r\n .setInterval({ start: 0, end: this._audioCtx.sampleRate * this._waveformHistoryLength, stopAxisAfter: false });\r\n this._charts.waveformHistory\r\n .getDefaultAxisY()\r\n .setMouseInteractions(false)\r\n .setChartInteractionZoomByDrag(false)\r\n .setChartInteractionFitByDrag(false)\r\n .setChartInteractionZoomByWheel(false);\r\n this._charts.timeDomain.getDefaultAxisX().setInterval({ start: 0, end: this._audioNodes.analyzer.fftSize, stopAxisAfter: false });\r\n this._charts.spectrum.getDefaultAxisX().setInterval({\r\n start: 0,\r\n end: (this._audioCtx.sampleRate / this._audioNodes.analyzer.fftSize) * this._audioNodes.analyzer.frequencyBinCount,\r\n stopAxisAfter: false,\r\n });\r\n this._charts.spectrum\r\n .getDefaultAxisY()\r\n .setInterval({ start: this._audioNodes.analyzer.minDecibels, end: this._audioNodes.analyzer.maxDecibels, stopAxisAfter: false });\r\n // frequency chart is twice as large as the other charts\r\n this._db.setRowHeight(2, 2);\r\n this._charts.timeDomain.setMouseInteractions(false);\r\n this._charts.timeDomain.getDefaultAxisX().setMouseInteractions(false);\r\n this._charts.timeDomain.getDefaultAxisY().setMouseInteractions(false);\r\n // replace the default axis tick strategy formatter formatValue function\r\n this._charts.waveformHistory.getDefaultAxisX().setTickStrategy('Numeric', function (style) {\r\n return style.setFormattingFunction(function (value, range) {\r\n return (value / _this._audioCtx.sampleRate).toFixed(2);\r\n });\r\n });\r\n this._charts.spectrogram\r\n .getDefaultAxisX()\r\n .setTickStrategy(lcjs_1.AxisTickStrategies.Time)\r\n // // Set interval for the spectrogram\r\n .setInterval({\r\n start: 0,\r\n end: (this._waveformHistoryLength * this._audioCtx.sampleRate) /\r\n (this._audioCtx.sampleRate / this._audioNodes.analyzer.frequencyBinCount),\r\n stopAxisAfter: false,\r\n })\r\n .setScrollStrategy(lcjs_1.AxisScrollStrategies.progressive);\r\n // create series\r\n this._series = {\r\n timeDomain: this._setupSeries(this._charts.timeDomain, 'Time Domain', false),\r\n waveform: this._setupSeries(this._charts.waveformHistory, 'Waveform History', true),\r\n amplitude: this._setupSeries(this._charts.spectrum, 'Amplitude', false),\r\n history: this._setupSeries(this._charts.spectrum, 'Amplitude Decay', false),\r\n maxAmplitude: this._setupSeries(this._charts.spectrum, 'Amplitude Max', false),\r\n spectrogram: this._setupHeatmapSeries(this._charts.spectrogram, this._spectrogramDataCount, fBinCount / 2, maxFreq / 2, 'Spectrogram'),\r\n };\r\n // setup time-domain series\r\n this._series.timeDomain.setCursorEnabled(false);\r\n // setup waveform series\r\n this._series.waveform\r\n .setDataCleaning({\r\n minDataPointCount: this._audioCtx.sampleRate * this._waveformHistoryLength * 2,\r\n })\r\n // .setMaxPointCount(this._audioCtx.sampleRate * this._waveformHistoryLength * 2)\r\n .setCursorInterpolationEnabled(false)\r\n .setCursorResultTableFormatter(function (tableBuilder, series, x, y) {\r\n return tableBuilder\r\n .addRow(series.getName())\r\n .addRow('Time', series.axisX.formatValue(x), 's')\r\n .addRow('Amplitude', series.axisY.formatValue(y));\r\n });\r\n // setup frequency series\r\n this._series.amplitude.setCursorEnabled(false);\r\n // setup max frequency series\r\n this._series.maxAmplitude.setCursorEnabled(false);\r\n // setup frequency decay series\r\n this._series.history.setCursorEnabled(false);\r\n // history reset button\r\n this._charts.spectrum\r\n .addUIElement(lcjs_1.UIElementBuilders.ButtonBox)\r\n .setText('Reset Spectrum Max')\r\n .setOrigin(lcjs_1.UIOrigins.LeftTop)\r\n .setPosition({ x: 0.2, y: 100 })\r\n .onMouseClick(function () {\r\n for (var i = 0; i < _this._data.maxHistory.byteLength; i++) {\r\n _this._data.maxHistory[i] = 0;\r\n }\r\n // refresh the displayed data\r\n _this._series.maxAmplitude.clear();\r\n _this._series.maxAmplitude.add(ArrayBufferToPointArray(_this._data.maxHistory));\r\n });\r\n this._series.spectrogram.axisX\r\n .setTitle('Time (s)')\r\n .setTitleFont(function (f) { return f.setSize(13); })\r\n .setTitleMargin(-5)\r\n .setTickStrategy(lcjs_1.AxisTickStrategies.Time, function (tickStrategy) {\r\n return tickStrategy.setMajorTickStyle(function (tickStyle) {\r\n return tickStyle\r\n .setTickPadding(0)\r\n .setLabelPadding(-5)\r\n .setLabelFont(function (f) { return f.setSize(12); });\r\n });\r\n });\r\n }\r\n /**\r\n * Create and setup the dashboard\r\n */\r\n AudioVisualizer.prototype._setupDashboard = function () {\r\n this._db = (0, lcjs_1.lightningChart)({ warnings: false, resourcesBaseUrl: \"\".concat(window.location.origin).concat(window.location.pathname, \"resources\") })\r\n .Dashboard({\r\n container: 'chart',\r\n numberOfColumns: 2,\r\n numberOfRows: 3,\r\n theme: theme,\r\n })\r\n .setSplitterStyle(lcjs_1.emptyLine)\r\n .setBackgroundStrokeStyle(lcjs_1.emptyLine);\r\n };\r\n /**\r\n * Create and setup a new chart on the dashboard\r\n * @param options Dashboard options\r\n * @param title Chart title\r\n * @param xAxisTitle X-Axis title\r\n * @param yAxisTitle Y-Axis title\r\n * @param yInterval Y-Axis interval\r\n */\r\n AudioVisualizer.prototype._setupChart = function (options, title, xAxisTitle, yAxisTitle, yInterval) {\r\n var chart = this._db\r\n .createChartXY(__assign({}, options))\r\n .setTitle(title)\r\n .setPadding({ top: 2, left: 1, right: 6, bottom: 2 })\r\n .setTitleMargin({ top: 2 });\r\n chart\r\n .getDefaultAxisX()\r\n .setTitle(xAxisTitle)\r\n .setTitleFont(function (f) { return f.setSize(13); })\r\n .setTitleMargin(-5)\r\n .setTickStrategy(lcjs_1.AxisTickStrategies.Numeric, function (tickStrategy) {\r\n return tickStrategy.setMajorTickStyle(function (tickStyle) {\r\n return tickStyle\r\n .setTickPadding(0)\r\n .setLabelPadding(-5)\r\n .setLabelFont(function (f) { return f.setSize(12); });\r\n });\r\n })\r\n .setAnimationZoom(undefined);\r\n chart\r\n .getDefaultAxisY()\r\n .setScrollStrategy(undefined)\r\n .setInterval({ start: yInterval[0], end: yInterval[1], stopAxisAfter: false })\r\n .setTitle(yAxisTitle)\r\n .setTitleFont(function (f) { return f.setSize(13); })\r\n .setTitleMargin(0)\r\n .setTickStrategy(lcjs_1.AxisTickStrategies.Numeric, function (tickStrategy) {\r\n return tickStrategy.setMajorTickStyle(function (tickStyle) { return tickStyle.setLabelFont(function (f) { return f.setSize(12); }); });\r\n })\r\n .setAnimationZoom(undefined);\r\n return chart;\r\n };\r\n /**\r\n * Create and setup a new series on a chart\r\n * @param chart Chart to which the series should be added to\r\n * @param name Name of the series\r\n * @param color Color of the series line\r\n */\r\n AudioVisualizer.prototype._setupSeries = function (chart, name, useDataPattern) {\r\n if (useDataPattern === void 0) { useDataPattern = true; }\r\n var series = chart\r\n .addLineSeries({\r\n dataPattern: useDataPattern\r\n ? {\r\n pattern: 'ProgressiveX',\r\n regularProgressiveStep: true,\r\n allowDataGrouping: true,\r\n }\r\n : undefined,\r\n })\r\n .setName(name)\r\n .setCursorInterpolationEnabled(false);\r\n return series;\r\n };\r\n /**\r\n * Create and setup a new series on a chart\r\n * @param chart Chart to which the series should be added to\r\n * @param name Name of the series\r\n */\r\n AudioVisualizer.prototype._setupHeatmapSeries = function (chart, columnLength, columnCount, yMax, name) {\r\n var palette = new lcjs_1.LUT({\r\n steps: (0, lcjs_1.regularColorSteps)(0, 255, theme.examples.spectrogramColorPalette),\r\n interpolate: true,\r\n });\r\n var series = chart\r\n .addHeatmapScrollingGridSeries({\r\n resolution: columnCount,\r\n scrollDimension: 'columns',\r\n start: { x: 0, y: 0 },\r\n step: { x: this._audioCtx.sampleRate / this._audioNodes.analyzer.frequencyBinCount, y: yMax / columnCount },\r\n })\r\n .setFillStyle(new lcjs_1.PalettedFill({ lut: palette }))\r\n .setName(name)\r\n .setCursorEnabled(false)\r\n .setDataCleaning({\r\n minDataPointCount: (this._audioCtx.sampleRate / this._audioNodes.analyzer.frequencyBinCount) * this._waveformHistoryLength,\r\n })\r\n .setWireframeStyle(lcjs_1.emptyLine);\r\n return series;\r\n };\r\n /**\r\n * Update series that require manual refresh\r\n */\r\n AudioVisualizer.prototype.update = function () {\r\n this._series.amplitude.clear();\r\n this._series.amplitude.add(this._points.frequency);\r\n this._series.history.clear();\r\n this._series.history.add(this._points.history);\r\n this._series.maxAmplitude.clear();\r\n this._series.maxAmplitude.add(this._points.maxHistory);\r\n };\r\n /**\r\n * Play audio\r\n */\r\n AudioVisualizer.prototype.play = function () {\r\n return this._audioCtx.resume();\r\n };\r\n /**\r\n * Pause audio\r\n */\r\n AudioVisualizer.prototype.pause = function () {\r\n return this._audioCtx.suspend();\r\n };\r\n /**\r\n * Set gain\r\n * @param gain Gain value\r\n */\r\n AudioVisualizer.prototype.setGain = function (gain) {\r\n this._audioNodes.gain.gain.setValueAtTime(gain, this._audioCtx.currentTime);\r\n };\r\n /**\r\n * Set audio visualizer source\r\n * @param source Source\r\n */\r\n AudioVisualizer.prototype.setSource = function (source) {\r\n if (this._source) {\r\n this._source.disconnect(this._audioNodes.analyzer);\r\n }\r\n this._source = source;\r\n if (this._source)\r\n this._source.connect(this._audioNodes.analyzer);\r\n };\r\n /**\r\n * Get the audio context of the visualizer\r\n */\r\n AudioVisualizer.prototype.getContext = function () {\r\n return this._audioCtx;\r\n };\r\n /**\r\n * Get the audio context state\r\n */\r\n AudioVisualizer.prototype.getState = function () {\r\n return this._audioCtx.state;\r\n };\r\n /**\r\n * Create audio source from a url\r\n * @param url Url of the audio source\r\n */\r\n AudioVisualizer.prototype.createUrlSource = function (url) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var buff, buffSrc;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0: return [4 /*yield*/, (0, audioSources_1.loadAudioFile)(url, this._audioCtx)];\r\n case 1:\r\n buff = _a.sent();\r\n buffSrc = this._audioCtx.createBufferSource();\r\n buffSrc.buffer = buff;\r\n buffSrc.start(0);\r\n buffSrc.loop = true;\r\n return [2 /*return*/, buffSrc];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Create microphone audio source\r\n */\r\n AudioVisualizer.prototype.createMicSource = function () {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var stream;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0: return [4 /*yield*/, navigator.mediaDevices.getUserMedia({ audio: true })];\r\n case 1:\r\n stream = _a.sent();\r\n return [2 /*return*/, this._audioCtx.createMediaStreamSource(stream)];\r\n }\r\n });\r\n });\r\n };\r\n return AudioVisualizer;\r\n}());\r\nexports.AudioVisualizer = AudioVisualizer;\r\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9zcmMvYXVkaW9WaXN1YWxpemVyLnRzPzYzMGIiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7QUFBQSw0Q0FBOEM7QUFDOUMscUNBc0JzQjtBQUN0QixzQ0FBZ0c7QUFFaEcsMkJBQTJCO0FBQzNCLElBQU0sU0FBUyxHQUFHLElBQUksZUFBZSxDQUFDLE1BQU0sQ0FBQyxRQUFRLENBQUMsTUFBTSxDQUFDO0FBQzdELElBQUksS0FBSyxHQUFHLGFBQU0sQ0FBQyxTQUFTLENBQUMsR0FBRyxDQUFDLE9BQU8sQ0FBaUIsQ0FBQyxJQUFJLGFBQU0sQ0FBQyxRQUFRO0FBQzdFLElBQUksQ0FBQyxLQUFLLENBQUMsTUFBTSxFQUFFO0lBQ2YsUUFBUSxDQUFDLElBQUksQ0FBQyxLQUFLLENBQUMsZUFBZSxHQUFHLE1BQU07SUFDNUMsUUFBUSxDQUFDLGFBQWEsQ0FBQyxPQUFPLENBQUMsQ0FBQyxLQUFLLENBQUMsS0FBSyxHQUFHLE1BQU07Q0FDdkQ7QUFFRDs7Ozs7O0dBTUc7QUFDSCxTQUFTLFlBQVksQ0FBQyxHQUFhLEVBQUUsR0FBZSxFQUFFLE9BQTBCLEVBQUUsT0FBMEI7SUFBdEQsb0NBQWtCLGdCQUFRO0lBQUUsb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hpcy5fYXVkaW9DdHguc2FtcGxlUmF0ZSAvIHRoaXMuX2F1ZGlvTm9kZXMuYW5hbHl6ZXIuZmZ0U2l6ZSkgKiB0aGlzLl9hdWRpb05vZGVzLmFuYWx5emVyLmZyZXF1ZW5jeUJpbkNvdW50XHJcblxyXG4gICAgICAgIC8vIHNldHVwIGNoYXJ0c1xyXG4gICAgICAgIHRoaXMuX2NoYXJ0cyA9IHtcclxuICAgICAgICAgICAgdGltZURvbWFpbjogdGhpcy5fc2V0dXBDaGFydChcclxuICAgICAgICAgICAgICAgIHsgY29sdW1uSW5kZXg6IDAsIGNvbHVtblNwYW46IDIsIHJvd0luZGV4OiAwLCByb3dTcGFuOiAxIH0sXHJcbiAgICAgICAgICAgICAgICAnVGltZSBEb21haW4nLFxyXG4gICAgICAgICAgICAgICAgJ1NhbXBsZScsXHJcbiAgICAgICAgICAgICAgICAnQW1wbGl0dWRlJyxcclxuICAgICAgICAgICAgICAgIFstMSwgMV0sXHJcbiAgICAgICAgICAgICksXHJcbiAgICAgICAgICAgIHdhdmVmb3JtSGlzdG9yeTogdGhpcy5fc2V0dXBDaGFydChcclxuICAgICAgICAgICAgICAgIHsgY29sdW1uSW5kZXg6IDAsIGNvbHVtblNwYW46IDIsIHJvd0luZGV4OiAxLCByb3dTcGFuOiAxIH0sXHJcbiAgICAgICAgICAgICAgICAnV2F2ZWZvcm0gaGlzdG9yeScsXHJcbiAgICAgICAgICAgICAgICAnVGltZSAocyknLFxyXG4gICAgICAgICAgICAgICAgJ0FtcGxpdHVkZScsXHJcbiAgICAgICAgICAgICAgICBbLTEsIDFdLFxyXG4gICAgICAgICAgICApLFxyXG4gICAgICAgICAgICBzcGVjdHJ1bTogdGhpcy5fc2V0dXBDaGFydChcclxuICAgICAgICAgICAgICAgIHsgY29sdW1uSW5kZXg6IDAsIGNvbHVtblNwYW46IDEsIHJvd0luZGV4OiAyLCByb3dTcGFuOiAxIH0sXHJcbiAgICAgICAgICAgICAgICAnU3BlY3RydW0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9yaWdpbihVSU9yaWdpbnMuTGVmdFRvcClcclxuICAgICAgICAgICAgLnNldFBvc2l0aW9uKHsgeDogMC4yLCB5OiAxMDAgfSlcclxuICAgICAgICAgICAgLm9uTW91c2VDbGljaygoKSA9PiB7XHJcbiAgICAgICAgICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IHRoaXMuX2RhdGEubWF4SGlzdG9yeS5ieXRlTGVuZ3RoOyBpKyspIHtcclxuICAgICAgICAgICAgICAgICAgICB0aGlzLl9kYXRhLm1heEhpc3RvcnlbaV0gPSAwXHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAvLyByZWZyZXNoIHRoZSBkaXNwbGF5ZWQgZGF0YVxyXG4gICAgICAgICAgICAgICAgdGhpcy5fc2VyaWVzLm1heEFtcGxpdHVkZS5jbGVhcigpXHJcbiAgICAgICAgICAgICAgICB0aGlzLl9zZXJpZXMubWF4QW1wbGl0dWRlLmFkZChBcnJheUJ1ZmZlclRvUG9pbnRBcnJheSh0aGlzLl9kYXRhLm1heEhpc3RvcnkpKVxyXG4gICAgICAgICAgICB9KVxyXG5cclxuICAgICAgICB0aGlzLl9zZXJpZXMuc3BlY3Ryb2dyYW0uYXhpc1hcclxuICAgICAgICAgICAgLnNldFRpdGxlKCdUaW1lIChzKScpXHJcbiAgICAgICAgICAgIC5zZXRUaXRsZUZvbnQoKGYpID0+IGYuc2V0U2l6ZSgxMykpXHJcbiAgICAgICAgICAgIC5zZXRUaXRsZU1hcmdpbigtNSlcclxuICAgICAgICAgICAgLnNldFRpY2tTdHJhdGVneShBeGlzVGlja1N0cmF0ZWdpZXMuVGltZSwgKHRpY2tTdHJhdGVneSkgPT5cclxuICAgICAgICAgICAgICAgIHRpY2tTdHJhdGVneS5zZXRNYWpvclRpY2tTdHlsZSgodGlja1N0eWxlKSA9PlxyXG4gICAgICAgICAgICAgICAgICAgIHRpY2tTdHlsZVxyXG4gICAgICAgICAgICAgICAgICAgICAgICAuc2V0VGlja1BhZGRpbmcoMClcclxuICAgICAgICAgICAgICAgICAgICAgICAgLnNldExhYmVsUGFkZGluZygtNSlcclxuICAgICAgICAgICAgICAgICAgICAgICAgLnNldExhYmVsRm9udCgoZikgPT4gZi5zZXRTaXplKDEyKSksXHJcbiAgICAgICAgICAgICAgICApLFxyXG4gICAgICAgICAgICApXHJcbiAgICB9XHJcblxyXG4gICAgLyoqXHJcbiAgICAgKiBDcmVhdGUgYW5kIHNldHVwIHRoZSBkYXNoYm9hcmRcclxuICAgICAqL1xyXG4gICAgcHJpdmF0ZSBfc2V0dXBEYXNoYm9hcmQoKSB7XHJcbiAgICAgICAgdGhpcy5fZGIgPSBsaWdodG5pbmdDaGFydCh7IHdhcm5pbmdzOiBmYWxzZSwgcmVzb3VyY2VzQmFzZVVybDogYCR7d2luZG93LmxvY2F0aW9uLm9yaWdpbn0ke3dpbmRvdy5sb2NhdGlvbi5wYXRobmFtZX1yZXNvdXJjZXNgIH0pXHJcbiAgICAgICAgICAgIC5EYXNoYm9hcmQoe1xyXG4gICAgICAgICAgICAgICAgY29udGFpbmVyOiAnY2hhcnQnLFxyXG4gICAgICAgICAgICAgICAgbnVtYmVyT2ZDb2x1bW5zOiAyLFxyXG4gICAgICAgICAgICAgICAgbnVtYmVyT2ZSb3dzOiAzLFxyXG4gICAgICAgICAgICAgICAgdGhlbWUsXHJcbiAgICAgICAgICAgIH0pXHJcbiAgICAgICAgICAgIC5zZXRTcGxpdHRlclN0eWxlKGVtcHR5TGluZSlcclxuICAgICAgICAgICAgLnNldEJhY2tncm91bmRTdHJva2VTdHlsZShlbXB0eUxpbmUpXHJcbiAgICB9XHJcblxyXG4gICAgLyoqXHJcbiAgICAgKiBDcmVhdGUgYW5kIHNldHVwIGEgbmV3IGNoYXJ0IG9uIHRoZSBkYXNoYm9hcmRcclxuICAgICAqIEBwYXJhbSBvcHRpb25zIERhc2hib2FyZCBvcHRpb25zXHJcbiAgICAgKiBAcGFyYW0gdGl0bGUgQ2hhcnQgdGl0bGVcclxuICAgICAqIEBwYXJhbSB4QXhpc1RpdGxlIFgtQXhpcyB0aXRsZVxyXG4gICAgICogQHBhcmFtIHlBeGlzVGl0bGUgWS1BeGlzIHRpdGxlXHJcbiAgICAgKiBAcGFyYW0geUludGVydmFsIFktQXhpcyBpbnRlcnZhbFxyXG4gICAgICovXHJcbiAgICBwcml2YXRlIF9zZXR1cENoYXJ0KFxyXG4gICAgICAgIG9wdGlvbnM6IENoYXJ0T3B0aW9uczxQb2ludE1hcmtlciwgVUlCYWNrZ3JvdW5kPixcclxuICAgICAgICB0aXRsZTogc3RyaW5nLFxyXG4gICAgICAgIHhBeGlzVGl0bGU6IHN0cmluZyxcclxuICAgICAgICB5QXhpc1RpdGxlOiBzdHJpbmcsXHJcbiAgICAgICAgeUludGVydmFsOiBbbnVtYmVyLCBudW1iZXJdLFxyXG4gICAgKTogQ2hhcnRYWSB7XHJcbiAgICAgICAgY29uc3QgY2hhcnQgPSB0aGlzLl9kYlxyXG4gICAgICAgICAgICAuY3JlYXRlQ2hhcnRYWSh7XHJcbiAgICAgICAgICAgICAgICAuLi5vcHRpb25zLFxyXG4gICAgICAgICAgICB9KVxyXG4gICAgICAgICAgICAuc2V0VGl0bGUodGl0bGUpXHJcbiAgICAgICAgICAgIC5zZXRQYWRkaW5nKHsgdG9wOiAyLCBsZWZ0OiAxLCByaWdodDogNiwgYm90dG9tOiAyIH0pXHJcbiAgICAgICAgICAgIC5zZXRUaXRsZU1hcmdpbih7IHRvcDogMiB9KVxyXG4gICAgICAgIGNoYXJ0XHJcbiAgICAgICAgICAgIC5nZXREZWZhdWx0QXhpc1goKVxyXG4gICAgICAgICAgICAuc2V0VGl0bGUoeEF4aXNUaXRsZSlcclxuICAgICAgICAgICAgLnNldFRpdGxlRm9udCgoZikgPT4gZi5zZXRTaXplKDEzKSlcclxuICAgICAgICAgICAgLnNldFRpdGxlTWFyZ2luKC01KVxyXG4gICAgICAgICAgICAuc2V0VGlja1N0cmF0ZWd5KEF4aXNUaWNrU3RyYXRlZ2llcy5OdW1lcmljLCAodGlja1N0cmF0ZWd5OiBOdW1lcmljVGlja1N0cmF0ZWd5KSA9PlxyXG4gICAgICAgICAgICAgICAgdGlja1N0cmF0ZWd5LnNldE1ham9yVGlja1N0eWxlKCh0aWNrU3R5bGUpID0+XHJcbiAgICAgICAgICAgICAgICAgICAgdGlja1N0eWxlXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIC5zZXRUaWNrUGFkZGluZygwKVxyXG4gICAgICAgICAgICAgICAgICAgICAgICAuc2V0TGFiZWxQYWRkaW5nKC01KVxyXG4gICAgICAgICAgICAgICAgICAgICAgICAuc2V0TGFiZWxGb250KChmKSA9PiBmLnNldFNpemUoMTIpKSxcclxuICAgICAgICAgICAgICAgICksXHJcbiAgICAgICAgICAgIClcclxuICAgICAgICAgICAgLnNldEFuaW1hdGlvblpvb20odW5kZWZpbmVkKVxyXG5cclxuICAgICAgICBjaGFydFxyXG4gICAgICAgICAgICAuZ2V0RGVmYXVsdEF4aXNZKClcclxuICAgICAgICAgICAgLnNldFNjcm9sbFN0cmF0ZWd5KHVuZGVmaW5lZClcclxuICAgICAgICAgICAgLnNldEludGVydmFsKHsgc3RhcnQ6IHlJbnRlcnZhbFswXSwgZW5kOiB5SW50ZXJ2YWxbMV0sIHN0b3BBeGlzQWZ0ZXI6IGZhbHNlIH0pXHJcbiAgICAgICAgICAgIC5zZXRUaXRsZSh5QXhpc1RpdGxlKVxyXG4gICAgICAgICAgICAuc2V0VGl0bGVGb250KChmKSA9PiBmLnNldFNpemUoMTMpKVxyXG4gICAgICAgICAgICAuc2V0VGl0bGVNYXJnaW4oMClcclxuICAgICAgICAgICAgLnNldFRpY2tTdHJhdGVneShBeGlzVGlja1N0cmF0ZWdpZXMuTnVtZXJpYywgKHRpY2tTdHJhdGVneTogTnVtZXJpY1RpY2tTdHJhdGVneSkgPT5cclxuICAgICAgICAgICAgICAgIHRpY2tTdHJhdGVneS5zZXRNYWpvclRpY2tTdHlsZSgodGlja1N0eWxlKSA9PiB0aWNrU3R5bGUuc2V0TGFiZWxGb250KChmKSA9PiBmLnNldFNpemUoMTIpKSksXHJcbiAgICAgICAgICAgIClcclxuICAgICAgICAgICAgLnNldEFuaW1hdGlvblpvb20odW5kZWZpbmVkKVxyXG4gICAgICAgIHJldHVybiBjaGFydFxyXG4gICAgfVxyXG5cclxuICAgIC8qKlxyXG4gICAgICogQ3JlYXRlIGFuZCBzZXR1cCBhIG5ldyBzZXJpZXMgb24gYSBjaGFydFxyXG4gICAgICogQHBhcmFtIGNoYXJ0IENoYXJ0IHRvIHdoaWNoIHRoZSBzZXJpZXMgc2hvdWxkIGJlIGFkZGVkIHRvXHJcbiAgICAgKiBAcGFyYW0gbmFtZSBOYW1lIG9mIHRoZSBzZXJpZXNcclxuICAgICAqIEBwYXJhbSBjb2xvciBDb2xvciBvZiB0aGUgc2VyaWVzIGxpbmVcclxuICAgICAqL1xyXG4gICAgcHJpdmF0ZSBfc2V0dXBTZXJpZXMoY2hhcnQ6IENoYXJ0WFksIG5hbWU6IHN0cmluZywgdXNlRGF0YVBhdHRlcm46IGJvb2xlYW4gPSB0cnVlKTogTGluZVNlcmllcyB7XHJcbiAgICAgICAgY29uc3Qgc2VyaWVzID0gY2hhcnRcclxuICAgICAgICAgICAgLmFkZExpbmVTZXJpZXMoe1xyXG4gICAgICAgICAgICAgICAgZGF0YVBhdHRlcm46IHVzZURhdGFQYXR0ZXJuXHJcbiAgICAgICAgICAgICAgICAgICAgPyB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgcGF0dGVybjogJ1Byb2dyZXNzaXZlWCcsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgcmVndWxhclByb2dyZXNzaXZlU3RlcDogdHJ1ZSxcclxuICAgICAgICAgICAgICAgICAgICAgICAgICBhbGxvd0RhdGFHcm91cGluZzogdHJ1ZSxcclxuICAgICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICA6IH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blxyXG4gICAgICAgIGNvbnN0IGJ1ZmZTcmMgPSB0aGlzLl9hdWRpb0N0eC5jcmVhdGVCdWZmZXJTb3VyY2UoKVxyXG4gICAgICAgIGJ1ZmZTcmMuYnVmZmVyID0gYnVmZlxyXG4gICAgICAgIGJ1ZmZTcmMuc3RhcnQoMClcclxuICAgICAgICBidWZmU3JjLmxvb3AgPSB0cnVlXHJcbiAgICAgICAgcmV0dXJuIGJ1ZmZTcmNcclxuICAgIH1cclxuXHJcbiAgICAvKipcclxuICAgICAqIENyZWF0ZSBtaWNyb3Bob25lIGF1ZGlvIHNvdXJjZVxyXG4gICAgICovXHJcbiAgICBwdWJsaWMgYXN5bmMgY3JlYXRlTWljU291cmNlKCk6IFByb21pc2U8QXVkaW9Ob2RlPiB7XHJcbiAgICAgICAgY29uc3Qgc3RyZWFtID0gYXdhaXQgbmF2aWdhdG9yLm1lZGlhRGV2aWNlcy5nZXRVc2VyTWVkaWEoeyBhdWRpbzogdHJ1ZSB9KVxyXG4gICAgICAgIHJldHVybiB0aGlzLl9hdWRpb0N0eC5jcmVhdGVNZWRpYVN0cmVhbVNvdXJjZShzdHJlYW0pXHJcbiAgICB9XHJcbn1cclxuIl0sInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///10\n")},,,function(module,exports,__webpack_require__){"use strict";eval('\r\nObject.defineProperty(exports, "__esModule", { value: true });\r\nexports.multiplierScaler = exports.offSetScaler = exports.noScaler = exports.freqScaler = exports.dbScaler = exports.scaleToRange = void 0;\r\n/**\r\n * Scale value from one scale to another\r\n * @param val Value to scale\r\n * @param origRange Range of the original scale\r\n * @param newRange New scale\r\n */\r\nvar scaleToRange = function (val, origRange, newRange) {\r\n return (val - origRange[0]) * (newRange[1] - newRange[0]) / (origRange[1] - origRange[0]) + newRange[0];\r\n};\r\nexports.scaleToRange = scaleToRange;\r\n/**\r\n * Scaler that scales to from 0, 256 to a decibel range specified by analyzer node\r\n * @param analyzer Analyzer node of which the db scale should be used\r\n */\r\nvar dbScaler = function (analyzer) { return function (n) { return (0, exports.scaleToRange)(n, [0, 256], [analyzer.minDecibels, analyzer.maxDecibels]); }; };\r\nexports.dbScaler = dbScaler;\r\n/**\r\n * Scaler that scales from 0-256 to -1,1\r\n * @param n\r\n */\r\nvar freqScaler = function (n) { return (0, exports.scaleToRange)(n, [0, 256], [-1, 1]); };\r\nexports.freqScaler = freqScaler;\r\n/**\r\n * Scaler with no scaling\r\n * @param n\r\n */\r\nvar noScaler = function (n) { return n; };\r\nexports.noScaler = noScaler;\r\n/**\r\n * Scaler that scales by offset\r\n * @param offset Offset\r\n */\r\nvar offSetScaler = function (offset) { return function (n) { return n + offset; }; };\r\nexports.offSetScaler = offSetScaler;\r\n/**\r\n * Scaler that scales by multiplier\r\n * @param multiplier Multiplier of the scaler\r\n */\r\nvar multiplierScaler = function (multiplier) { return function (n) { return n * multiplier; }; };\r\nexports.multiplierScaler = multiplierScaler;\r\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9zcmMvdXRpbHMudHM/N2RkYSJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFFQTs7Ozs7R0FLRztBQUNJLElBQU0sWUFBWSxHQUFHLFVBQUMsR0FBVyxFQUFFLFNBQTJCLEVBQUUsUUFBMEI7SUFDN0YsUUFBQyxHQUFHLEdBQUcsU0FBUyxDQUFDLENBQUMsQ0FBQyxDQUFDLEdBQUcsQ0FBQyxRQUFRLENBQUMsQ0FBQyxDQUFDLEdBQUcsUUFBUSxDQUFDLENBQUMsQ0FBQyxDQUFDLEdBQUcsQ0FBQyxTQUFTLENBQUMsQ0FBQyxDQUFDLEdBQUcsU0FBUyxDQUFDLENBQUMsQ0FBQyxDQUFDLEdBQUcsUUFBUSxDQUFDLENBQUMsQ0FBQztBQUFoRyxDQUFnRztBQUR2RixvQkFBWSxnQkFDMkU7QUF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Xhwb3J0IGNvbnN0IGZyZXFTY2FsZXI6IFNjYWxlciA9IChuOiBudW1iZXIpOiBudW1iZXIgPT4gc2NhbGVUb1JhbmdlKG4sIFswLCAyNTZdLCBbLTEsIDFdKVxyXG5cclxuLyoqXHJcbiAqIFNjYWxlciB3aXRoIG5vIHNjYWxpbmdcclxuICogQHBhcmFtIG4gXHJcbiAqL1xyXG5leHBvcnQgY29uc3Qgbm9TY2FsZXI6IFNjYWxlciA9IChuKSA9PiBuXHJcblxyXG4vKipcclxuICogU2NhbGVyIHRoYXQgc2NhbGVzIGJ5IG9mZnNldFxyXG4gKiBAcGFyYW0gb2Zmc2V0IE9mZnNldFxyXG4gKi9cclxuZXhwb3J0IGNvbnN0IG9mZlNldFNjYWxlciA9IChvZmZzZXQ6IG51bWJlcik6IFNjYWxlciA9PiAobikgPT4gbiArIG9mZnNldFxyXG5cclxuLyoqXHJcbiAqIFNjYWxlciB0aGF0IHNjYWxlcyBieSBtdWx0aXBsaWVyXHJcbiAqIEBwYXJhbSBtdWx0aXBsaWVyIE11bHRpcGxpZXIgb2YgdGhlIHNjYWxlclxyXG4gKi9cclxuZXhwb3J0IGNvbnN0IG11bHRpcGxpZXJTY2FsZXIgPSAobXVsdGlwbGllcik6IFNjYWxlciA9PiAobikgPT4gbiAqIG11bHRpcGxpZXJcclxuIl0sInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///13\n')}]); \ No newline at end of file +!function(Q){function F(F){for(var B,s,e=F[0],r=F[1],l=F[2],I=0,g=[];I 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n};\r\nObject.defineProperty(exports, "__esModule", { value: true });\r\nexports.setupSourceLabels = exports.loadAudioFile = exports.sourceAudioFiles = exports.SrcOption = void 0;\r\n/**\r\n * Available source options\r\n */\r\nvar SrcOption;\r\n(function (SrcOption) {\r\n SrcOption["mic"] = "mic";\r\n SrcOption["file"] = "file";\r\n SrcOption["truck"] = "truck";\r\n SrcOption["f500_1000_1000"] = "f500_1000_1000";\r\n SrcOption["symbhony_no_5"] = "symbhony_no_5";\r\n})(SrcOption = exports.SrcOption || (exports.SrcOption = {}));\r\n/**\r\n * Labels for different source options\r\n */\r\nvar srcLabels = {\r\n truck: \'Truck Driving\',\r\n mic: \'Microphone\',\r\n file: \'Load Audio File from URL\',\r\n f500_1000_1000: \'500Hz, 1kHz and 10kHz signals\',\r\n symbhony_no_5: \'Symphony no. 5 in Cm, Op. 67 - IV. Allegro\',\r\n};\r\n/**\r\n * Default audio source files\r\n */\r\nexports.sourceAudioFiles = {\r\n truck: \'Truck_driving_by-Jason_Baker-2112866529.wav\',\r\n symbhony_no_5: \'Symphony no. 5 in Cm, Op. 67 - IV. Allegro.mp3\',\r\n f500_1000_1000: \'500_1000_10000.wav\',\r\n};\r\n/**\r\n * Cache of loaded audio files\r\n */\r\nvar loadedFiles = {};\r\n/**\r\n * Load audio file from url\r\n * @param url URL of the audio file\r\n * @param audioCtx AudioContext\r\n */\r\nvar loadAudioFile = function (url, audioCtx) { return __awaiter(void 0, void 0, void 0, function () {\r\n var request, buffer, audioBuffer;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n // if the file is already cached\r\n if (loadedFiles[url]) {\r\n return [2 /*return*/, loadedFiles[url]];\r\n }\r\n return [4 /*yield*/, fetch(url)];\r\n case 1:\r\n request = _a.sent();\r\n return [4 /*yield*/, request.arrayBuffer()];\r\n case 2:\r\n buffer = _a.sent();\r\n return [4 /*yield*/, audioCtx.decodeAudioData(buffer)];\r\n case 3:\r\n audioBuffer = _a.sent();\r\n loadedFiles[url] = audioBuffer;\r\n return [2 /*return*/, audioBuffer];\r\n }\r\n });\r\n}); };\r\nexports.loadAudioFile = loadAudioFile;\r\n/**\r\n * Create the options for different audio sources\r\n */\r\nvar setupSourceLabels = function () {\r\n var selector = document.getElementById(\'src-selector\');\r\n Object.keys(srcLabels).forEach(function (key) {\r\n var option = document.createElement(\'option\');\r\n option.value = key;\r\n option.text = srcLabels[key];\r\n if (key === SrcOption.truck)\r\n option.selected = true;\r\n selector.appendChild(option);\r\n });\r\n};\r\nexports.setupSourceLabels = setupSourceLabels;\r\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9zcmMvYXVkaW9Tb3VyY2VzLnRzPzc2OGUiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7O0FBQUE7O0dBRUc7QUFDSCxJQUFZLFNBTVg7QUFORCxXQUFZLFNBQVM7SUFDakIsd0JBQVc7SUFDWCwwQkFBYTtJQUNiLDRCQUFlO0lBQ2YsOENBQWlDO0lBQ2pDLDRDQUErQjtBQUNuQyxDQUFDLEVBTlcsU0FBUyxHQUFULGlCQUFTLEtBQVQsaUJBQVMsUUFNcEI7QUFFRDs7R0FFRztBQUNILElBQU0sU0FBUyxHQUFnRDtJQUMzRCxLQUFLLEVBQUUsZUFBZTtJQUN0QixHQUFHLEVBQUUsWUFBWTtJQUNqQixJQUFJLEVBQUUsMEJBQTBCO0lBQ2hDLGNBQWMsRUFBRSwrQkFBK0I7SUFDL0MsYUFBYSxFQUFFLDRDQUE0QztDQUM5RDtBQUVEOztHQUVHO0FBQ1Usd0JBQWdCLEdB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CdWZmZXIoKVxyXG4gICAgY29uc3QgYXVkaW9CdWZmZXIgPSBhd2FpdCBhdWRpb0N0eC5kZWNvZGVBdWRpb0RhdGEoYnVmZmVyKVxyXG5cclxuICAgIGxvYWRlZEZpbGVzW3VybF0gPSBhdWRpb0J1ZmZlclxyXG4gICAgcmV0dXJuIGF1ZGlvQnVmZmVyXHJcbn1cclxuXHJcbi8qKlxyXG4gKiBDcmVhdGUgdGhlIG9wdGlvbnMgZm9yIGRpZmZlcmVudCBhdWRpbyBzb3VyY2VzXHJcbiAqL1xyXG5leHBvcnQgY29uc3Qgc2V0dXBTb3VyY2VMYWJlbHMgPSAoKSA9PiB7XHJcbiAgICBjb25zdCBzZWxlY3RvciA9IGRvY3VtZW50LmdldEVsZW1lbnRCeUlkKCdzcmMtc2VsZWN0b3InKVxyXG4gICAgT2JqZWN0LmtleXMoc3JjTGFiZWxzKS5mb3JFYWNoKChrZXkpID0+IHtcclxuICAgICAgICBjb25zdCBvcHRpb24gPSBkb2N1bWVudC5jcmVhdGVFbGVtZW50KCdvcHRpb24nKVxyXG4gICAgICAgIG9wdGlvbi52YWx1ZSA9IGtleVxyXG4gICAgICAgIG9wdGlvbi50ZXh0ID0gc3JjTGFiZWxzW2tleV1cclxuICAgICAgICBpZiAoa2V5ID09PSBTcmNPcHRpb24udHJ1Y2spIG9wdGlvbi5zZWxlY3RlZCA9IHRydWVcclxuICAgICAgICBzZWxlY3Rvci5hcHBlbmRDaGlsZChvcHRpb24pXHJcbiAgICB9KVxyXG59XHJcbiJdLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///3\n')},,function(module,exports,__webpack_require__){"use strict";eval("\r\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n};\r\nvar __generator = (this && this.__generator) || function (thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n};\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\n__webpack_require__(6);\r\nvar audioSources_1 = __webpack_require__(3);\r\nvar controls_1 = __webpack_require__(9);\r\nvar audioVisualizer_1 = __webpack_require__(10);\r\n// hide link when in iframe\r\nfunction inIframe() {\r\n try {\r\n return window.self !== window.top;\r\n }\r\n catch (e) {\r\n return true;\r\n }\r\n}\r\nif (inIframe()) {\r\n document.getElementById('github-link').style.display = 'none';\r\n}\r\n/**\r\n * Current Audio source\r\n */\r\nvar src = audioSources_1.SrcOption.mic;\r\n// setup the source selector\r\n(0, audioSources_1.setupSourceLabels)();\r\n// create a new instance of the AudioVisualizer class, this handles all of the actual visualization work\r\nvar audioVisualizer = new audioVisualizer_1.AudioVisualizer();\r\n// attach the play and pause buttons to the audioVisualizer play and pause methods\r\n(0, controls_1.setupPlayPause)(audioVisualizer.play.bind(audioVisualizer), audioVisualizer.pause.bind(audioVisualizer));\r\nvar srcSelector = document.getElementById('src-selector');\r\nvar audioFileUrlPlay = document.getElementById('load-url');\r\nvar audioFileUrl = document.getElementById('audio-file');\r\n/**\r\n * Audio file from url play\r\n */\r\naudioFileUrlPlay.addEventListener('click', function () { return __awaiter(void 0, void 0, void 0, function () {\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0: return [4 /*yield*/, listenToFileURL(audioFileUrl.value)];\r\n case 1:\r\n _a.sent();\r\n return [4 /*yield*/, audioVisualizer.play()];\r\n case 2:\r\n _a.sent();\r\n return [2 /*return*/];\r\n }\r\n });\r\n}); });\r\n/**\r\n * Update the current visualizer source\r\n */\r\nvar updateSource = function () { return __awaiter(void 0, void 0, void 0, function () {\r\n var selectedOptionElement, ai, _a;\r\n return __generator(this, function (_b) {\r\n switch (_b.label) {\r\n case 0:\r\n selectedOptionElement = srcSelector[srcSelector.selectedIndex];\r\n src = selectedOptionElement.value;\r\n if (src === audioSources_1.SrcOption.file) {\r\n document.getElementById('audio-input').style.display = 'flex';\r\n }\r\n else {\r\n ai = document.getElementById('audio-input');\r\n ai.style.display = 'none';\r\n ai.value = '';\r\n }\r\n return [4 /*yield*/, audioVisualizer.pause()];\r\n case 1:\r\n _b.sent();\r\n _a = src;\r\n switch (_a) {\r\n case audioSources_1.SrcOption.mic: return [3 /*break*/, 2];\r\n case audioSources_1.SrcOption.file: return [3 /*break*/, 5];\r\n case audioSources_1.SrcOption.truck: return [3 /*break*/, 6];\r\n case audioSources_1.SrcOption.f500_1000_1000: return [3 /*break*/, 9];\r\n case audioSources_1.SrcOption.symbhony_no_5: return [3 /*break*/, 12];\r\n }\r\n return [3 /*break*/, 15];\r\n case 2: return [4 /*yield*/, listenMic()];\r\n case 3:\r\n _b.sent();\r\n return [4 /*yield*/, audioVisualizer.play()];\r\n case 4:\r\n _b.sent();\r\n return [3 /*break*/, 15];\r\n case 5:\r\n audioVisualizer.setSource(undefined);\r\n return [3 /*break*/, 15];\r\n case 6: return [4 /*yield*/, listenToFileURL(audioSources_1.sourceAudioFiles.truck)];\r\n case 7:\r\n _b.sent();\r\n return [4 /*yield*/, audioVisualizer.play()];\r\n case 8:\r\n _b.sent();\r\n return [3 /*break*/, 15];\r\n case 9: return [4 /*yield*/, listenToFileURL(audioSources_1.sourceAudioFiles.f500_1000_1000)];\r\n case 10:\r\n _b.sent();\r\n return [4 /*yield*/, audioVisualizer.play()];\r\n case 11:\r\n _b.sent();\r\n return [3 /*break*/, 15];\r\n case 12: return [4 /*yield*/, listenToFileURL(audioSources_1.sourceAudioFiles.symbhony_no_5)];\r\n case 13:\r\n _b.sent();\r\n return [4 /*yield*/, audioVisualizer.play()];\r\n case 14:\r\n _b.sent();\r\n return [3 /*break*/, 15];\r\n case 15: return [2 /*return*/];\r\n }\r\n });\r\n}); };\r\nsrcSelector.addEventListener('change', updateSource);\r\nupdateSource();\r\nvar listenElement = document.getElementById('listen');\r\n/**\r\n * Mute/unmute audio output based on the selection state\r\n */\r\nvar updateListenState = function () {\r\n if (listenElement.checked) {\r\n audioVisualizer.setGain(1);\r\n }\r\n else {\r\n audioVisualizer.setGain(0);\r\n }\r\n};\r\nlistenElement.addEventListener('change', updateListenState);\r\n/**\r\n * Listen to microphone\r\n */\r\nfunction listenMic() {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var src;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0: return [4 /*yield*/, audioVisualizer.createMicSource()];\r\n case 1:\r\n src = _a.sent();\r\n audioVisualizer.setSource(src);\r\n return [2 /*return*/];\r\n }\r\n });\r\n });\r\n}\r\n/**\r\n * Listen to a file from a url\r\n * @param url URL of the file\r\n */\r\nfunction listenToFileURL(url) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var src;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0: return [4 /*yield*/, audioVisualizer.createUrlSource(url)];\r\n case 1:\r\n src = _a.sent();\r\n audioVisualizer.setSource(src);\r\n return [2 /*return*/];\r\n }\r\n });\r\n });\r\n}\r\n// hide the play button if it's not needed\r\naudioVisualizer.getContext().addEventListener('statechange', function () {\r\n if (!resumeElement.hidden && audioVisualizer.getState() !== 'suspended') {\r\n resumeElement.hidden = true;\r\n }\r\n});\r\n// handle cases where the audio context was created in suspended state\r\nvar resumeElement = document.getElementById('resume');\r\nresumeElement.addEventListener('click', function () {\r\n audioVisualizer.play();\r\n});\r\nif (audioVisualizer.getState() === 'suspended') {\r\n resumeElement.hidden = false;\r\n}\r\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9zcmMvYXBwLnRzPzA2NmUiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7QUFBQSx1QkFBMEI7QUFDMUIsNENBQStFO0FBQy9FLHdDQUEyQztBQUMzQyxnREFBbUQ7QUFFbkQsMkJBQTJCO0FBQzNCLFNBQVMsUUFBUTtJQUNiLElBQUk7UUFDQSxPQUFPLE1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SAnc3VzcGVuZGVkJykge1xyXG4gICAgcmVzdW1lRWxlbWVudC5oaWRkZW4gPSBmYWxzZVxyXG59XHJcbiJdLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///5\n")},function(module,exports,__webpack_require__){eval("var api = __webpack_require__(7);\n var content = __webpack_require__(8);\n\n content = content.__esModule ? content.default : content;\n\n if (typeof content === 'string') {\n content = [[module.i, content, '']];\n }\n\nvar options = {};\n\noptions.insert = \"head\";\noptions.singleton = false;\n\nvar update = api(content, options);\n\n\n\nmodule.exports = content.locals || {};//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9zcmMvc3R5bGVzL21haW4uY3NzP2U4MGEiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsVUFBVSxtQkFBTyxDQUFDLENBQTJFO0FBQzdGLDBCQUEwQixtQkFBTyxDQUFDLENBQXdEOztBQUUxRjs7QUFFQTtBQUNBLDBCQUEwQixRQUFTO0FBQ25DOztBQUVBOztBQUVBO0FBQ0E7O0FBRUE7Ozs7QUFJQSIsImZpbGUiOiI2LmpzIiwic291cmNlc0NvbnRlbnQiOlsidmFyIGFwaSA9IHJlcXVpcmUoXCIhLi4vLi4vbm9kZV9tb2R1bGVzL3N0eWxlLWxvYWRlci9kaXN0L3J1bnRpbWUvaW5qZWN0U3R5bGVzSW50b1N0eWxlVGFnLmpzXCIpO1xuICAgICAgICAgICAgdmFyIGNvbnRlbnQgPSByZXF1aXJlKFwiISEuLi8uLi9ub2RlX21vZHVsZXMvY3NzLWxvYWRlci9kaXN0L2Nqcy5qcyEuL21haW4uY3NzXCIpO1xuXG4gICAgICAgICAgICBjb250ZW50ID0gY29udGVudC5fX2VzTW9kdWxlID8gY29udGVudC5kZWZhdWx0IDogY29udGVudDtcblxuICAgICAgICAgICAgaWYgKHR5cGVvZiBjb250ZW50ID09PSAnc3RyaW5nJykge1xuICAgICAgICAgICAgICBjb250ZW50ID0gW1ttb2R1bGUuaWQsIGNvbnRlbnQsICcnXV07XG4gICAgICAgICAgICB9XG5cbnZhciBvcHRpb25zID0ge307XG5cbm9wdGlvbnMuaW5zZXJ0ID0gXCJoZWFkXCI7XG5vcHRpb25zLnNpbmdsZXRvbiA9IGZhbHNlO1xuXG52YXIgdXBkYXRlID0gYXBpKGNvbnRlbnQsIG9wdGlvbnMpO1xuXG5cblxubW9kdWxlLmV4cG9ydHMgPSBjb250ZW50LmxvY2FscyB8fCB7fTsiXSwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///6\n")},,function(module,__webpack_exports__,__webpack_require__){"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(4);\n/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0__);\n// Imports\n\nvar ___CSS_LOADER_EXPORT___ = _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0___default()(true);\n// Module\n___CSS_LOADER_EXPORT___.push([module.i, "html,\\r\\nbody {\\r\\n margin: 0;\\r\\n height: 100%;\\r\\n overflow: hidden;\\r\\n background-color: #1c3450;\\r\\n}\\r\\n\\r\\n.container {\\r\\n height: 100%;\\r\\n width: 100%;\\r\\n display: flex;\\r\\n flex-direction: column;\\r\\n}\\r\\n\\r\\n.container #chart {\\r\\n flex: 1 1 auto;\\r\\n display: flex;\\r\\n height: 100%;\\r\\n width: 100%;\\r\\n}\\r\\n\\r\\n.container #chart canvas {\\r\\n height: auto !important;\\r\\n}\\r\\n\\r\\n#resume {\\r\\n position: fixed;\\r\\n top: 0;\\r\\n left: 0;\\r\\n right: 0;\\r\\n bottom: 0;\\r\\n z-index: 1;\\r\\n cursor: pointer;\\r\\n}\\r\\n\\r\\n#resume img {\\r\\n width: 100%;\\r\\n height: 100%;\\r\\n}\\r\\n\\r\\n#play-pause {\\r\\n height: 33px;\\r\\n width: 40px;\\r\\n}\\r\\n\\r\\n#github-link {\\r\\n position: fixed;\\r\\n display: block;\\r\\n top: 0;\\r\\n right: 0;\\r\\n margin-left: auto;\\r\\n z-index: 2;\\r\\n}\\r\\n\\r\\n#github-link img {\\r\\n display: block;\\r\\n margin: 10px 10px 10px auto;\\r\\n}\\r\\n\\r\\n@media screen and (max-width: 770px) {\\r\\n #github-link {\\r\\n top: unset;\\r\\n bottom: 0;\\r\\n }\\r\\n}\\r\\n\\r\\n#controls {\\r\\n z-index: 1;\\r\\n display: flex;\\r\\n}\\r\\n\\r\\n#controls label {\\r\\n color: #e4e4e4;\\r\\n align-self: center;\\r\\n}\\r\\n\\r\\n#controls input {\\r\\n align-self: center;\\r\\n}\\r\\n\\r\\n.audio-input * {\\r\\n align-self: center;\\r\\n}\\r\\n\\r\\n.error {\\r\\n z-index: 2;\\r\\n position: fixed;\\r\\n top: 50%;\\r\\n font-size: larger;\\r\\n background-color: #0009;\\r\\n color: white;\\r\\n left: 0;\\r\\n right: 0;\\r\\n}\\r\\n", "",{"version":3,"sources":["webpack://src/styles/main.css"],"names":[],"mappings":"AAAA;;IAEI,SAAS;IACT,YAAY;IACZ,gBAAgB;IAChB,yBAAyB;AAC7B;;AAEA;IACI,YAAY;IACZ,WAAW;IACX,aAAa;IACb,sBAAsB;AAC1B;;AAEA;IACI,cAAc;IACd,aAAa;IACb,YAAY;IACZ,WAAW;AACf;;AAEA;IACI,uBAAuB;AAC3B;;AAEA;IACI,eAAe;IACf,MAAM;IACN,OAAO;IACP,QAAQ;IACR,SAAS;IACT,UAAU;IACV,eAAe;AACnB;;AAEA;IACI,WAAW;IACX,YAAY;AAChB;;AAEA;IACI,YAAY;IACZ,WAAW;AACf;;AAEA;IACI,eAAe;IACf,cAAc;IACd,MAAM;IACN,QAAQ;IACR,iBAAiB;IACjB,UAAU;AACd;;AAEA;IACI,cAAc;IACd,2BAA2B;AAC/B;;AAEA;IACI;QACI,UAAU;QACV,SAAS;IACb;AACJ;;AAEA;IACI,UAAU;IACV,aAAa;AACjB;;AAEA;IACI,cAAc;IACd,kBAAkB;AACtB;;AAEA;IACI,kBAAkB;AACtB;;AAEA;IACI,kBAAkB;AACtB;;AAEA;IACI,UAAU;IACV,eAAe;IACf,QAAQ;IACR,iBAAiB;IACjB,uBAAuB;IACvB,YAAY;IACZ,OAAO;IACP,QAAQ;AACZ","sourcesContent":["html,\\r\\nbody {\\r\\n margin: 0;\\r\\n height: 100%;\\r\\n overflow: hidden;\\r\\n background-color: #1c3450;\\r\\n}\\r\\n\\r\\n.container {\\r\\n height: 100%;\\r\\n width: 100%;\\r\\n display: flex;\\r\\n flex-direction: column;\\r\\n}\\r\\n\\r\\n.container #chart {\\r\\n flex: 1 1 auto;\\r\\n display: flex;\\r\\n height: 100%;\\r\\n width: 100%;\\r\\n}\\r\\n\\r\\n.container #chart canvas {\\r\\n height: auto !important;\\r\\n}\\r\\n\\r\\n#resume {\\r\\n position: fixed;\\r\\n top: 0;\\r\\n left: 0;\\r\\n right: 0;\\r\\n bottom: 0;\\r\\n z-index: 1;\\r\\n cursor: pointer;\\r\\n}\\r\\n\\r\\n#resume img {\\r\\n width: 100%;\\r\\n height: 100%;\\r\\n}\\r\\n\\r\\n#play-pause {\\r\\n height: 33px;\\r\\n width: 40px;\\r\\n}\\r\\n\\r\\n#github-link {\\r\\n position: fixed;\\r\\n display: block;\\r\\n top: 0;\\r\\n right: 0;\\r\\n margin-left: auto;\\r\\n z-index: 2;\\r\\n}\\r\\n\\r\\n#github-link img {\\r\\n display: block;\\r\\n margin: 10px 10px 10px auto;\\r\\n}\\r\\n\\r\\n@media screen and (max-width: 770px) {\\r\\n #github-link {\\r\\n top: unset;\\r\\n bottom: 0;\\r\\n }\\r\\n}\\r\\n\\r\\n#controls {\\r\\n z-index: 1;\\r\\n display: flex;\\r\\n}\\r\\n\\r\\n#controls label {\\r\\n color: #e4e4e4;\\r\\n align-self: center;\\r\\n}\\r\\n\\r\\n#controls input {\\r\\n align-self: center;\\r\\n}\\r\\n\\r\\n.audio-input * {\\r\\n align-self: center;\\r\\n}\\r\\n\\r\\n.error {\\r\\n z-index: 2;\\r\\n position: fixed;\\r\\n top: 50%;\\r\\n font-size: larger;\\r\\n background-color: #0009;\\r\\n color: white;\\r\\n left: 0;\\r\\n right: 0;\\r\\n}\\r\\n"],"sourceRoot":""}]);\n// Exports\n/* harmony default export */ __webpack_exports__["default"] = (___CSS_LOADER_EXPORT___);\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9zcmMvc3R5bGVzL21haW4uY3NzPzU2MDciXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7QUFBQTtBQUFBO0FBQUE7QUFDNEY7QUFDNUYsOEJBQThCLG1GQUEyQjtBQUN6RDtBQUNBLDhCQUE4QixRQUFTLGtCQUFrQixrQkFBa0IscUJBQXFCLHlCQUF5QixrQ0FBa0MsS0FBSyxvQkFBb0IscUJBQXFCLG9CQUFvQixzQkFBc0IsK0JBQStCLEtBQUssMkJBQTJCLHVCQUF1QixzQkFBc0IscUJBQXFCLG9CQUFvQixLQUFLLGtDQUFrQyxnQ0FBZ0MsS0FBSyxpQkFBaUIsd0JBQXdCLGVBQWUsZ0JBQWdCLGlCQUFpQixrQkFBa0IsbUJBQW1CLHdCQUF3QixLQUFLLHFCQUFxQixvQkFBb0IscUJBQXFCLEtBQUsscUJBQXFCLHFCQUFxQixvQkFBb0IsS0FBSyxzQkFBc0Isd0JBQXdCLHVCQUF1QixlQUFlLGlCQUFpQiwwQkFBMEIsbUJBQW1CLEtBQUssMEJBQTBCLHVCQUF1QixvQ0FBb0MsS0FBSyw4Q0FBOEM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yXFxuXCJdLFwic291cmNlUm9vdFwiOlwiXCJ9XSk7XG4vLyBFeHBvcnRzXG5leHBvcnQgZGVmYXVsdCBfX19DU1NfTE9BREVSX0VYUE9SVF9fXztcbiJdLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///8\n')},function(module,exports,__webpack_require__){"use strict";eval('\r\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n};\r\nvar __generator = (this && this.__generator) || function (thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError("Generator is already executing.");\r\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n};\r\nObject.defineProperty(exports, "__esModule", { value: true });\r\nexports.setupPlayPause = void 0;\r\n/**\r\n * Setup play and pause event listeners\r\n * @param onPlay Function to run when \'Play\' button is pressed\r\n * @param onPause Function to run when \'Pause\' button is pressed\r\n */\r\nvar setupPlayPause = function (onPlay, onPause) {\r\n var play = document.getElementById(\'play\');\r\n play.addEventListener(\'click\', function () { return __awaiter(void 0, void 0, void 0, function () {\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0: return [4 /*yield*/, onPlay()];\r\n case 1:\r\n _a.sent();\r\n play.hidden = true;\r\n pause.hidden = false;\r\n return [2 /*return*/];\r\n }\r\n });\r\n }); });\r\n var pause = document.getElementById(\'pause\');\r\n pause.addEventListener(\'click\', function () { return __awaiter(void 0, void 0, void 0, function () {\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0: return [4 /*yield*/, onPause()];\r\n case 1:\r\n _a.sent();\r\n pause.hidden = true;\r\n play.hidden = false;\r\n return [2 /*return*/];\r\n }\r\n });\r\n }); });\r\n};\r\nexports.setupPlayPause = setupPlayPause;\r\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9zcmMvY29udHJvbHMudHM/ZGMwYyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7Ozs7Ozs7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gY29uc3QgcGxheSA9IGRvY3VtZW50LmdldEVsZW1lbnRCeUlkKCdwbGF5JylcclxuICAgIHBsYXkuYWRkRXZlbnRMaXN0ZW5lcignY2xpY2snLCBhc3luYyAoKSA9PiB7XHJcbiAgICAgICAgYXdhaXQgb25QbGF5KClcclxuICAgICAgICBwbGF5LmhpZGRlbiA9IHRydWVcclxuICAgICAgICBwYXVzZS5oaWRkZW4gPSBmYWxzZVxyXG4gICAgfSlcclxuXHJcbiAgICBjb25zdCBwYXVzZSA9IGRvY3VtZW50LmdldEVsZW1lbnRCeUlkKCdwYXVzZScpXHJcbiAgICBwYXVzZS5hZGRFdmVudExpc3RlbmVyKCdjbGljaycsIGFzeW5jICgpID0+IHtcclxuICAgICAgICBhd2FpdCBvblBhdXNlKClcclxuICAgICAgICBwYXVzZS5oaWRkZW4gPSB0cnVlXHJcbiAgICAgICAgcGxheS5oaWRkZW4gPSBmYWxzZVxyXG4gICAgfSlcclxufVxyXG4iXSwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///9\n')},function(module,exports,__webpack_require__){"use strict";eval("\r\nvar __assign = (this && this.__assign) || function () {\r\n __assign = Object.assign || function(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\r\n t[p] = s[p];\r\n }\r\n return t;\r\n };\r\n return __assign.apply(this, arguments);\r\n};\r\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n};\r\nvar __generator = (this && this.__generator) || function (thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n};\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nexports.AudioVisualizer = void 0;\r\nvar audioSources_1 = __webpack_require__(3);\r\nvar lcjs_1 = __webpack_require__(11);\r\nvar utils_1 = __webpack_require__(13);\r\n// // Use theme if provided\r\nvar urlParams = new URLSearchParams(window.location.search);\r\nvar theme = lcjs_1.Themes[urlParams.get('theme')] || lcjs_1.Themes.darkGold;\r\nif (!theme.isDark) {\r\n document.body.style.backgroundColor = '#fff';\r\n document.querySelector('label').style.color = '#000';\r\n}\r\n/**\r\n * Update points in a given array with new values\r\n * @param arr Array of points to update\r\n * @param buf Input data buffer\r\n * @param xScaler Scaler for the X-values\r\n * @param yScaler Scaler for the Y-values\r\n */\r\nfunction updatePoints(arr, buf, xScaler, yScaler) {\r\n if (xScaler === void 0) { xScaler = utils_1.noScaler; }\r\n if (yScaler === void 0) { yScaler = utils_1.noScaler; }\r\n for (var i = 0; i < arr.length; i += 1) {\r\n var p = arr[i];\r\n p.y = yScaler(buf[i]);\r\n p.x = xScaler(i);\r\n }\r\n}\r\n/**\r\n * Convert ArrayBuffer to a Point array\r\n * @param buf Buffer to convert to point array\r\n * @param xScaler Scaler for the X-values\r\n * @param yScaler Scaler for the Y-values\r\n */\r\nfunction ArrayBufferToPointArray(buf, xScaler, yScaler) {\r\n if (xScaler === void 0) { xScaler = utils_1.noScaler; }\r\n if (yScaler === void 0) { yScaler = utils_1.noScaler; }\r\n return Array.from(buf).map(function (p, i) { return ({ x: xScaler(i), y: yScaler(p) }); });\r\n}\r\n/**\r\n * Audio Visualizer\r\n *\r\n * Visualizes given Audio source\r\n */\r\nvar AudioVisualizer = /** @class */ (function () {\r\n function AudioVisualizer() {\r\n var _this = this;\r\n this._spectrogramDataCount = 512;\r\n this._waveformHistoryLength = 25;\r\n var AudioContext = window.AudioContext || window.webkitAudioContext;\r\n // setup the audio context\r\n try {\r\n this._audioCtx = new AudioContext();\r\n }\r\n catch (e) {\r\n // AudioContext is not supported.\r\n document.getElementById('ie-error').hidden = false;\r\n throw e;\r\n }\r\n this._audioCtx.createScriptProcessor = this._audioCtx.createScriptProcessor || this._audioCtx.createJavaScriptNode;\r\n this._audioNodes = {\r\n analyzer: this._audioCtx.createAnalyser(),\r\n // the script processor node is deprecated node so it will be removed in future\r\n // it has been replaced with audio worklet but those have really bad browser support currently\r\n processor: this._audioCtx.createScriptProcessor(2048, 1, 1),\r\n gain: this._audioCtx.createGain(),\r\n };\r\n // mute audio output by default\r\n this._audioNodes.gain.gain.setValueAtTime(0, this._audioCtx.currentTime);\r\n var spectrogramHistoryLength = this._spectrogramDataCount * (this._audioNodes.analyzer.fftSize / this._audioCtx.sampleRate);\r\n var mScaler = (0, utils_1.multiplierScaler)(this._audioCtx.sampleRate / this._audioNodes.analyzer.fftSize);\r\n var dScaler = (0, utils_1.dbScaler)(this._audioNodes.analyzer);\r\n // setup audio processor\r\n var tStart = undefined;\r\n this._audioNodes.processor.onaudioprocess = function (ev) {\r\n // update data from analyzer\r\n _this._audioNodes.analyzer.getByteTimeDomainData(_this._data.timeDomain);\r\n _this._audioNodes.analyzer.getByteFrequencyData(_this._data.frequency);\r\n // update frequency points\r\n updatePoints(_this._points.frequency, _this._data.frequency, mScaler, dScaler);\r\n // update history and max history data\r\n for (var i = 0; i < _this._data.history.length; i++) {\r\n _this._data.history[i] = Math.max(Math.max(_this._data.frequency[i], _this._data.history[i] - 25 / 1000), 0);\r\n _this._data.maxHistory[i] = Math.max(Math.max(_this._data.frequency[i], _this._data.maxHistory[i]), 0);\r\n }\r\n // update frequency history points\r\n updatePoints(_this._points.history, _this._data.history, mScaler, dScaler);\r\n // update frequency max history points\r\n updatePoints(_this._points.maxHistory, _this._data.maxHistory, mScaler, dScaler);\r\n // update time domain points\r\n updatePoints(_this._points.timeDomain, _this._data.timeDomain, utils_1.noScaler, utils_1.freqScaler);\r\n // update time domain data\r\n _this._series.timeDomain.clear();\r\n _this._series.timeDomain.add(_this._points.timeDomain);\r\n if (tStart === undefined) {\r\n tStart = performance.now();\r\n }\r\n var tNow = performance.now() - tStart;\r\n // add waveform data to the waveform series\r\n var waveData = Array.from(_this._data.timeDomain).map(utils_1.freqScaler);\r\n _this._series.waveform.appendSamples({\r\n yValues: waveData,\r\n start: tNow,\r\n step: 1000 / _this._audioCtx.sampleRate,\r\n });\r\n var freqData = Array.from(_this._data.frequency);\r\n var iSpectrogram = Math.floor(tNow / _this._series.spectrogram.getStep().x);\r\n _this._series.spectrogram.invalidateIntensityValues({ iSample: iSpectrogram, values: [freqData] });\r\n _this.update();\r\n // output the audio\r\n ev.outputBuffer.copyToChannel(ev.inputBuffer.getChannelData(0), 0);\r\n };\r\n // setup node graph\r\n this._audioNodes.analyzer.connect(this._audioNodes.processor);\r\n this._audioNodes.processor.connect(this._audioNodes.gain);\r\n this._audioNodes.gain.connect(this._audioCtx.destination);\r\n // setup buffers\r\n var fBinCount = this._audioNodes.analyzer.frequencyBinCount;\r\n this._data = {\r\n timeDomain: new Uint8Array(this._audioNodes.analyzer.fftSize),\r\n frequency: new Uint8Array(fBinCount),\r\n history: new Uint8Array(fBinCount),\r\n maxHistory: new Uint8Array(fBinCount),\r\n };\r\n // setup point arrays\r\n var mapXAxisToSampleRate = function (_, i) { return ({ x: (_this._audioCtx.sampleRate / _this._audioNodes.analyzer.fftSize) * i, y: 0 }); };\r\n this._points = {\r\n timeDomain: Array.from(Array(this._data.timeDomain.length)).map(function (_, i) { return ({ x: i, y: 0 }); }),\r\n frequency: Array.from(Array(fBinCount)).map(mapXAxisToSampleRate),\r\n history: Array.from(Array(fBinCount)).map(mapXAxisToSampleRate),\r\n maxHistory: Array.from(Array(fBinCount)).map(mapXAxisToSampleRate),\r\n };\r\n // setup dashboard\r\n this._setupDashboard();\r\n var maxFreq = (this._audioCtx.sampleRate / this._audioNodes.analyzer.fftSize) * this._audioNodes.analyzer.frequencyBinCount;\r\n // setup charts\r\n this._charts = {\r\n timeDomain: this._setupChart({ columnIndex: 0, columnSpan: 2, rowIndex: 0, rowSpan: 1 }, 'Time Domain', 'Sample', 'Amplitude', [-1, 1]),\r\n waveformHistory: this._setupChart({ columnIndex: 0, columnSpan: 2, rowIndex: 1, rowSpan: 1 }, 'Waveform history', 'Time (s)', 'Amplitude', [-1, 1]),\r\n spectrum: this._setupChart({ columnIndex: 0, columnSpan: 1, rowIndex: 2, rowSpan: 1 }, 'Spectrum', 'Frequency (Hz)', 'dB', [0, 256]),\r\n spectrogram: this._setupChart({ columnIndex: 1, columnSpan: 1, rowIndex: 2, rowSpan: 1 }, 'Spectrogram', 's', 'Frequency (Hz)', [0, maxFreq / 2]),\r\n };\r\n this._charts.waveformHistory\r\n .getDefaultAxisX()\r\n .setScrollStrategy(lcjs_1.AxisScrollStrategies.progressive)\r\n .setInterval({ start: 0, end: 15000, stopAxisAfter: false })\r\n .setTickStrategy(lcjs_1.AxisTickStrategies.Time);\r\n this._charts.waveformHistory\r\n .getDefaultAxisY()\r\n .setMouseInteractions(false)\r\n .setChartInteractionZoomByDrag(false)\r\n .setChartInteractionFitByDrag(false)\r\n .setChartInteractionZoomByWheel(false);\r\n this._charts.timeDomain.getDefaultAxisX().setInterval({ start: 0, end: this._audioNodes.analyzer.fftSize, stopAxisAfter: false });\r\n this._charts.spectrum.getDefaultAxisX().setInterval({\r\n start: 0,\r\n end: (this._audioCtx.sampleRate / this._audioNodes.analyzer.fftSize) * this._audioNodes.analyzer.frequencyBinCount,\r\n stopAxisAfter: false,\r\n });\r\n this._charts.spectrum\r\n .setCursor(function (cursor) { return cursor.setTickMarkerYVisible(false); })\r\n .getDefaultAxisY()\r\n .setInterval({ start: this._audioNodes.analyzer.minDecibels, end: this._audioNodes.analyzer.maxDecibels, stopAxisAfter: false });\r\n // frequency chart is twice as large as the other charts\r\n this._db.setRowHeight(2, 2);\r\n this._charts.timeDomain.setMouseInteractions(false);\r\n this._charts.timeDomain.getDefaultAxisX().setMouseInteractions(false);\r\n this._charts.timeDomain.getDefaultAxisY().setMouseInteractions(false);\r\n this._charts.spectrogram\r\n .getDefaultAxisX()\r\n .setTickStrategy(lcjs_1.AxisTickStrategies.Time)\r\n .setInterval({\r\n start: 0,\r\n end: (this._waveformHistoryLength * this._audioCtx.sampleRate) /\r\n (this._audioCtx.sampleRate / this._audioNodes.analyzer.frequencyBinCount),\r\n stopAxisAfter: false,\r\n })\r\n .setScrollStrategy(lcjs_1.AxisScrollStrategies.progressive);\r\n // create series\r\n this._series = {\r\n timeDomain: this._setupSeries(this._charts.timeDomain, 'Time Domain'),\r\n waveform: this._setupSeries(this._charts.waveformHistory, 'Waveform History'),\r\n amplitude: this._setupSeries(this._charts.spectrum, 'Amplitude'),\r\n history: this._setupSeries(this._charts.spectrum, 'Amplitude Decay'),\r\n maxAmplitude: this._setupSeries(this._charts.spectrum, 'Amplitude Max'),\r\n spectrogram: this._setupHeatmapSeries(this._charts.spectrogram, this._spectrogramDataCount, fBinCount / 2, maxFreq / 2, 'Spectrogram'),\r\n };\r\n // setup waveform series\r\n this._series.waveform.setStrokeStyle(function (stroke) { return stroke.setThickness(-1); });\r\n // history reset button\r\n this._charts.spectrum\r\n .addUIElement(lcjs_1.UIElementBuilders.ButtonBox)\r\n .setText('Reset Spectrum Max')\r\n .setOrigin(lcjs_1.UIOrigins.LeftTop)\r\n .setPosition({ x: 0.2, y: 100 })\r\n .onMouseClick(function () {\r\n for (var i = 0; i < _this._data.maxHistory.byteLength; i++) {\r\n _this._data.maxHistory[i] = 0;\r\n }\r\n // refresh the displayed data\r\n _this._series.maxAmplitude.clear();\r\n _this._series.maxAmplitude.add(ArrayBufferToPointArray(_this._data.maxHistory));\r\n });\r\n this._series.spectrogram.axisX.setTitle('Time (s)').setTitleFont(function (f) { return f.setSize(13); });\r\n }\r\n /**\r\n * Create and setup the dashboard\r\n */\r\n AudioVisualizer.prototype._setupDashboard = function () {\r\n this._db = (0, lcjs_1.lightningChart)({\r\n warnings: false,\r\n resourcesBaseUrl: \"\".concat(window.location.origin).concat(window.location.pathname, \"resources\"),\r\n })\r\n .Dashboard({\r\n container: 'chart',\r\n numberOfColumns: 2,\r\n numberOfRows: 3,\r\n theme: theme,\r\n })\r\n .setSplitterStyle(lcjs_1.emptyLine)\r\n .setBackgroundStrokeStyle(lcjs_1.emptyLine);\r\n };\r\n /**\r\n * Create and setup a new chart on the dashboard\r\n * @param options Dashboard options\r\n * @param title Chart title\r\n * @param xAxisTitle X-Axis title\r\n * @param yAxisTitle Y-Axis title\r\n * @param yInterval Y-Axis interval\r\n */\r\n AudioVisualizer.prototype._setupChart = function (options, title, xAxisTitle, yAxisTitle, yInterval) {\r\n var chart = this._db\r\n .createChartXY(__assign({}, options))\r\n .setTitle(title)\r\n .setTitleFont(function (font) { return font.setSize(12); })\r\n .setPadding({ top: 2, bottom: 2, left: 2, right: 30 })\r\n .setCursorMode('show-all-interpolated');\r\n chart\r\n .getDefaultAxisX()\r\n .setTitle(xAxisTitle)\r\n .setTitleFont(function (f) { return f.setSize(12); })\r\n .setAnimationZoom(undefined);\r\n chart\r\n .getDefaultAxisY()\r\n .setScrollStrategy(undefined)\r\n .setInterval({ start: yInterval[0], end: yInterval[1], stopAxisAfter: false })\r\n .setTitle(yAxisTitle)\r\n .setTitleFont(function (f) { return f.setSize(12); })\r\n .setAnimationZoom(undefined);\r\n return chart;\r\n };\r\n /**\r\n * Create and setup a new series on a chart\r\n * @param chart Chart to which the series should be added to\r\n * @param name Name of the series\r\n * @param color Color of the series line\r\n */\r\n AudioVisualizer.prototype._setupSeries = function (chart, name, useDataPattern) {\r\n if (useDataPattern === void 0) { useDataPattern = true; }\r\n var series = chart\r\n .addPointLineAreaSeries({\r\n dataPattern: useDataPattern ? 'ProgressiveX' : null,\r\n })\r\n .setAreaFillStyle(lcjs_1.emptyFill)\r\n .setPointFillStyle(lcjs_1.emptyFill)\r\n .setMaxSampleCount({ mode: 'auto' })\r\n .setName(name);\r\n return series;\r\n };\r\n /**\r\n * Create and setup a new series on a chart\r\n * @param chart Chart to which the series should be added to\r\n * @param name Name of the series\r\n */\r\n AudioVisualizer.prototype._setupHeatmapSeries = function (chart, columnLength, columnCount, yMax, name) {\r\n var palette = new lcjs_1.LUT({\r\n steps: (0, lcjs_1.regularColorSteps)(0, 255, theme.examples.spectrogramColorPalette),\r\n interpolate: true,\r\n });\r\n var series = chart\r\n .addHeatmapScrollingGridSeries({\r\n resolution: columnCount,\r\n scrollDimension: 'columns',\r\n })\r\n .setStart({ x: 0, y: 0 })\r\n .setStep({ x: this._audioCtx.sampleRate / this._audioNodes.analyzer.frequencyBinCount, y: yMax / columnCount })\r\n .setFillStyle(new lcjs_1.PalettedFill({ lut: palette }))\r\n .setName(name)\r\n .setDataCleaning({\r\n minDataPointCount: (this._audioCtx.sampleRate / this._audioNodes.analyzer.frequencyBinCount) * this._waveformHistoryLength,\r\n })\r\n .setWireframeStyle(lcjs_1.emptyLine);\r\n return series;\r\n };\r\n /**\r\n * Update series that require manual refresh\r\n */\r\n AudioVisualizer.prototype.update = function () {\r\n this._series.amplitude.clear();\r\n this._series.amplitude.add(this._points.frequency);\r\n this._series.history.clear();\r\n this._series.history.add(this._points.history);\r\n this._series.maxAmplitude.clear();\r\n this._series.maxAmplitude.add(this._points.maxHistory);\r\n };\r\n /**\r\n * Play audio\r\n */\r\n AudioVisualizer.prototype.play = function () {\r\n return this._audioCtx.resume();\r\n };\r\n /**\r\n * Pause audio\r\n */\r\n AudioVisualizer.prototype.pause = function () {\r\n return this._audioCtx.suspend();\r\n };\r\n /**\r\n * Set gain\r\n * @param gain Gain value\r\n */\r\n AudioVisualizer.prototype.setGain = function (gain) {\r\n this._audioNodes.gain.gain.setValueAtTime(gain, this._audioCtx.currentTime);\r\n };\r\n /**\r\n * Set audio visualizer source\r\n * @param source Source\r\n */\r\n AudioVisualizer.prototype.setSource = function (source) {\r\n if (this._source) {\r\n this._source.disconnect(this._audioNodes.analyzer);\r\n }\r\n this._source = source;\r\n if (this._source)\r\n this._source.connect(this._audioNodes.analyzer);\r\n };\r\n /**\r\n * Get the audio context of the visualizer\r\n */\r\n AudioVisualizer.prototype.getContext = function () {\r\n return this._audioCtx;\r\n };\r\n /**\r\n * Get the audio context state\r\n */\r\n AudioVisualizer.prototype.getState = function () {\r\n return this._audioCtx.state;\r\n };\r\n /**\r\n * Create audio source from a url\r\n * @param url Url of the audio source\r\n */\r\n AudioVisualizer.prototype.createUrlSource = function (url) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var buff, buffSrc;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0: return [4 /*yield*/, (0, audioSources_1.loadAudioFile)(url, this._audioCtx)];\r\n case 1:\r\n buff = _a.sent();\r\n buffSrc = this._audioCtx.createBufferSource();\r\n buffSrc.buffer = buff;\r\n buffSrc.start(0);\r\n buffSrc.loop = true;\r\n return [2 /*return*/, buffSrc];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Create microphone audio source\r\n */\r\n AudioVisualizer.prototype.createMicSource = function () {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var stream;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0: return [4 /*yield*/, navigator.mediaDevices.getUserMedia({ audio: true })];\r\n case 1:\r\n stream = _a.sent();\r\n return [2 /*return*/, this._audioCtx.createMediaStreamSource(stream)];\r\n }\r\n });\r\n });\r\n };\r\n return AudioVisualizer;\r\n}());\r\nexports.AudioVisualizer = AudioVisualizer;\r\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9zcmMvYXVkaW9WaXN1YWxpemVyLnRzPzYzMGIiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7QUFBQSw0Q0FBOEM7QUFDOUMscUNBd0I2QjtBQUM3QixzQ0FBZ0c7QUFFaEcsMkJBQTJCO0FBQzNCLElBQU0sU0FBUyxHQUFHLElBQUksZUFBZSxDQUFDLE1BQU0sQ0FBQyxRQUFRLENBQUMsTUFBTSxDQUFDO0FBQzdELElBQUksS0FBSyxHQUFHLGFBQU0sQ0FBQyxTQUFTLENBQUMsR0FBRyxDQUFDLE9BQU8sQ0FBaUIsQ0FBQyxJ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F1ZGlvIGdyYXBoXHJcbiAgICAgKi9cclxuICAgIHByaXZhdGUgX2F1ZGlvTm9kZXM6IHtcclxuICAgICAgICBhbmFseXplcjogQW5hbHlzZXJOb2RlXHJcbiAgICAgICAgcHJvY2Vzc29yOiBTY3JpcHRQcm9jZXNzb3JOb2RlXHJcbiAgICAgICAgZ2FpbjogR2Fpbk5vZGVcclxuICAgIH1cclxuICAgIC8qKlxyXG4gICAgICogQ3VycmVudCBhdWRpbyBzb3VyY2VcclxuICAgICAqL1xyXG4gICAgcHJpdmF0ZSBfc291cmNlOiBBdWRpb05vZGUgfCB1bmRlZmluZWRcclxuXHJcbiAgICAvKipcclxuICAgICAqIERhdGEgYnVmZmVyc1xyXG4gICAgICovXHJcbiAgICBwcml2YXRlIF9kYXRhOiB7XHJcbiAgICAgICAgdGltZURvbWFpbjogVWludDhBcnJheVxyXG4gICAgICAgIGZyZXF1ZW5jeTogVWludDhBcnJheVxyXG4gICAgICAgIGhpc3Rvcnk6IFVpbnQ4QXJyYXlcclxuICAgICAgICBtYXhIaXN0b3J5OiBVaW50OEFycmF5XHJcbiAgICB9XHJcblxyXG4gICAgLyoqXHJcbiAgICAgKiBQb2ludCBidWZmZXJzXHJcbiAgICAgKi9cclxuICAgIHByaXZhdGUgX3BvaW50czoge1xyXG4gICAgICAgIHRpbWVEb21haW46IFBvaW50W11cclxuICAgICAgICBmcmVxdWVuY3k6IFBvaW50W11cclxuICAgICAgICBoaXN0b3J5OiBQb2ludFtdXHJcbiAgICAgICAgbWF4SGlzdG9yeTogUG9pbnRbXVxyXG4gICAgfVxyXG5cclxuICAgIC8qKlxyXG4gICAgICogQmFzZSBkYXNoYm9hcmQsIGhvc3RzIGFsbCBjaGFydHNcclxuICAgICAqL1xyXG4gICAgcHJpdmF0ZSBfZGI6IERhc2hib2FyZFxyXG5cclxuICAgIC8qKlxyXG4gICAgICogQWxsIGRpZmZlcmVudCBjaGFydHNcclxuICAgICAqL1xyXG4gICAgcHJpdmF0ZSBf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GVSYXRlIC8gdGhpcy5fYXVkaW9Ob2Rlcy5hbmFseXplci5mZnRTaXplKSAqIHRoaXMuX2F1ZGlvTm9kZXMuYW5hbHl6ZXIuZnJlcXVlbmN5QmluQ291bnRcclxuXHJcbiAgICAgICAgLy8gc2V0dXAgY2hhcnRzXHJcbiAgICAgICAgdGhpcy5fY2hhcnRzID0ge1xyXG4gICAgICAgICAgICB0aW1lRG9tYWluOiB0aGlzLl9zZXR1cENoYXJ0KFxyXG4gICAgICAgICAgICAgICAgeyBjb2x1bW5JbmRleDogMCwgY29sdW1uU3BhbjogMiwgcm93SW5kZXg6IDAsIHJvd1NwYW46IDEgfSxcclxuICAgICAgICAgICAgICAgICdUaW1lIERvbWFpbicsXHJcbiAgICAgICAgICAgICAgICAnU2FtcGxlJyxcclxuICAgICAgICAgICAgICAgICdBbXBsaXR1ZGUnLFxyXG4gICAgICAgICAgICAgICAgWy0xLCAxXSxcclxuICAgICAgICAgICAgKSxcclxuICAgICAgICAgICAgd2F2ZWZvcm1IaXN0b3J5OiB0aGlzLl9zZXR1cENoYXJ0KFxyXG4gICAgICAgICAgICAgICAgeyBjb2x1bW5JbmRleDogMCwgY29sdW1uU3BhbjogMiwgcm93SW5kZXg6IDEsIHJvd1NwYW46IDEgfSxcclxuICAgICAgICAgICAgICAgICdXYXZlZm9ybSBoaXN0b3J5JyxcclxuICAgICAgICAgICAgICAgICdUaW1lIChzKScsXHJcbiAgICAgICAgICAgICAgICAnQW1wbGl0dWRlJyxcclxuICAgICAgICAgICAgICAgIFstMSwgMV0sXHJcbiAgICAgICAgICAgICksXHJcbiAgICAgICAgICAgIHNwZWN0cnVtOiB0aGlzLl9zZXR1cENoYXJ0KFxyXG4gICAgICAgICAgICAgICAgeyBjb2x1bW5JbmRleDogMCwgY29sdW1uU3BhbjogMSwgcm93SW5kZXg6IDIsIHJvd1NwYW46IDEgfSxcclxuICAgICAgICAgICAgICAgICdTcGVjdHJ1bScsXHJcbiAgICAgICAgICAgICAgICAnRnJlcXVlbmN5IChIeiknLFxyXG4gICAgICAgICAgICAgICAgJ2RCJyxcclxuICAgICAgICAgICAgICAgIFswLCAyNTZdLFxyXG4gICAgICAgICAgICApLFxyXG4gICAgICAgICAgICBzcGVjdHJvZ3JhbTogdGhpcy5fc2V0dXBDaGFydChcclxuICAgICAgICAgICAgICAgIHsgY29sdW1uSW5kZXg6IDEsIGNvbHVtblNwYW46IDEsIHJvd0luZGV4OiAyLCByb3dTcGFuOiAxIH0sXHJcbiAgICAgICAgICAgICAgICAnU3BlY3Ryb2dyYW0nLFxyXG4gICAgICAgICAgICAgICAgJ3MnLFxyXG4gICAgICAgICAgICAgICAgJ0ZyZXF1ZW5jeSAoSHopJyxcclxuICAgICAgICAgICAgICAgIFswLCBtYXhGcmVxIC8gMl0sXHJcbiAgICAgICAgICAgICksXHJcbiAgICAgICAgfVxyXG4gICAgICAgIHRoaXMuX2NoYXJ0cy53YXZlZm9ybUhpc3RvcnlcclxuICAgICAgICAgICAgLmdldERlZmF1bHRBeGlzWCgpXHJcbiAgICAgICAgICAgIC5zZXRTY3JvbGxTdHJhdGVneShBeGlzU2Nyb2xsU3RyYXRlZ2llcy5wcm9ncmVzc2l2ZSlcclxuICAgICAgICAgICAgLnNldEludGVydmFsKHsgc3RhcnQ6IDAsIGVuZDogMTVfMDAwLCBzdG9wQXhpc0FmdGVyOiBmYWxzZSB9KVxyXG4gICAgICAgICAgICAuc2V0VGlja1N0cmF0ZWd5KEF4aXNUaWNrU3RyYXRlZ2llcy5UaW1lKVxyXG5cclxuICAgICAgICB0aGlzLl9jaGFydHMud2F2ZWZvcm1IaXN0b3J5XHJcbiAgICAgICAgICAgIC5nZXREZWZhdWx0QXhpc1koKVxyXG4gICAgICAgICAgICAuc2V0TW91c2VJbnRlcmFjdGlvbnMoZmFsc2UpXHJcbiAgICAgICAgICAgIC5zZXRDaGFydEludGVyYWN0aW9uWm9vbUJ5RHJhZyhmYWxzZSlcclxuICAgICAgICAgICAgLnNldENoYXJ0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GJ1ZmZTcmMgPSB0aGlzLl9hdWRpb0N0eC5jcmVhdGVCdWZmZXJTb3VyY2UoKVxyXG4gICAgICAgIGJ1ZmZTcmMuYnVmZmVyID0gYnVmZlxyXG4gICAgICAgIGJ1ZmZTcmMuc3RhcnQoMClcclxuICAgICAgICBidWZmU3JjLmxvb3AgPSB0cnVlXHJcbiAgICAgICAgcmV0dXJuIGJ1ZmZTcmNcclxuICAgIH1cclxuXHJcbiAgICAvKipcclxuICAgICAqIENyZWF0ZSBtaWNyb3Bob25lIGF1ZGlvIHNvdXJjZVxyXG4gICAgICovXHJcbiAgICBwdWJsaWMgYXN5bmMgY3JlYXRlTWljU291cmNlKCk6IFByb21pc2U8QXVkaW9Ob2RlPiB7XHJcbiAgICAgICAgY29uc3Qgc3RyZWFtID0gYXdhaXQgbmF2aWdhdG9yLm1lZGlhRGV2aWNlcy5nZXRVc2VyTWVkaWEoeyBhdWRpbzogdHJ1ZSB9KVxyXG4gICAgICAgIHJldHVybiB0aGlzLl9hdWRpb0N0eC5jcmVhdGVNZWRpYVN0cmVhbVNvdXJjZShzdHJlYW0pXHJcbiAgICB9XHJcbn1cclxuIl0sInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///10\n")},,,function(module,exports,__webpack_require__){"use strict";eval('\r\nObject.defineProperty(exports, "__esModule", { value: true });\r\nexports.multiplierScaler = exports.offSetScaler = exports.noScaler = exports.freqScaler = exports.dbScaler = exports.scaleToRange = void 0;\r\n/**\r\n * Scale value from one scale to another\r\n * @param val Value to scale\r\n * @param origRange Range of the original scale\r\n * @param newRange New scale\r\n */\r\nvar scaleToRange = function (val, origRange, newRange) {\r\n return (val - origRange[0]) * (newRange[1] - newRange[0]) / (origRange[1] - origRange[0]) + newRange[0];\r\n};\r\nexports.scaleToRange = scaleToRange;\r\n/**\r\n * Scaler that scales to from 0, 256 to a decibel range specified by analyzer node\r\n * @param analyzer Analyzer node of which the db scale should be used\r\n */\r\nvar dbScaler = function (analyzer) { return function (n) { return (0, exports.scaleToRange)(n, [0, 256], [analyzer.minDecibels, analyzer.maxDecibels]); }; };\r\nexports.dbScaler = dbScaler;\r\n/**\r\n * Scaler that scales from 0-256 to -1,1\r\n * @param n\r\n */\r\nvar freqScaler = function (n) { return (0, exports.scaleToRange)(n, [0, 256], [-1, 1]); };\r\nexports.freqScaler = freqScaler;\r\n/**\r\n * Scaler with no scaling\r\n * @param n\r\n */\r\nvar noScaler = function (n) { return n; };\r\nexports.noScaler = noScaler;\r\n/**\r\n * Scaler that scales by offset\r\n * @param offset Offset\r\n */\r\nvar offSetScaler = function (offset) { return function (n) { return n + offset; }; };\r\nexports.offSetScaler = offSetScaler;\r\n/**\r\n * Scaler that scales by multiplier\r\n * @param multiplier Multiplier of the scaler\r\n */\r\nvar multiplierScaler = function (multiplier) { return function (n) { return n * multiplier; }; };\r\nexports.multiplierScaler = multiplierScaler;\r\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9zcmMvdXRpbHMudHM/N2RkYSJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFFQTs7Ozs7R0FLRztBQUNJLElBQU0sWUFBWSxHQUFHLFVBQUMsR0FBVyxFQUFFLFNBQTJCLEVBQUUsUUFBMEI7SUFDN0YsUUFBQyxHQUFHLEdBQUcsU0FBUyxDQUFDLENBQUMsQ0FBQyxDQUFDLEdBQUcsQ0FBQyxRQUFRLENBQUMsQ0FBQyxDQUFDLEdBQUcsUUFBUSxDQUFDLENBQUMsQ0FBQyxDQUFDLEdBQUcsQ0FBQyxTQUFTLENBQUMsQ0FBQyxDQUFDLEdBQUcsU0FBUyxDQUFDLENBQUMsQ0FBQyxDQUFDLEdBQUcsUUFBUSxDQUFDLENBQUMsQ0FBQztBQUFoRyxDQUFnRztBQUR2RixvQkFBWSxnQkFDMkU7QUFFcEc7OztHQUdHO0FBQ0ksS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TY2FsZXI6IFNjYWxlciA9IChuOiBudW1iZXIpOiBudW1iZXIgPT4gc2NhbGVUb1JhbmdlKG4sIFswLCAyNTZdLCBbLTEsIDFdKVxyXG5cclxuLyoqXHJcbiAqIFNjYWxlciB3aXRoIG5vIHNjYWxpbmdcclxuICogQHBhcmFtIG4gXHJcbiAqL1xyXG5leHBvcnQgY29uc3Qgbm9TY2FsZXI6IFNjYWxlciA9IChuKSA9PiBuXHJcblxyXG4vKipcclxuICogU2NhbGVyIHRoYXQgc2NhbGVzIGJ5IG9mZnNldFxyXG4gKiBAcGFyYW0gb2Zmc2V0IE9mZnNldFxyXG4gKi9cclxuZXhwb3J0IGNvbnN0IG9mZlNldFNjYWxlciA9IChvZmZzZXQ6IG51bWJlcik6IFNjYWxlciA9PiAobikgPT4gbiArIG9mZnNldFxyXG5cclxuLyoqXHJcbiAqIFNjYWxlciB0aGF0IHNjYWxlcyBieSBtdWx0aXBsaWVyXHJcbiAqIEBwYXJhbSBtdWx0aXBsaWVyIE11bHRpcGxpZXIgb2YgdGhlIHNjYWxlclxyXG4gKi9cclxuZXhwb3J0IGNvbnN0IG11bHRpcGxpZXJTY2FsZXIgPSAobXVsdGlwbGllcik6IFNjYWxlciA9PiAobikgPT4gbiAqIG11bHRpcGxpZXJcclxuIl0sInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///13\n')}]); \ No newline at end of file diff --git a/resources/zoomBandChart/cyberspace-selector.png b/resources/zoomBandChart/cyberspace-selector.png new file mode 100644 index 0000000000000000000000000000000000000000..b0f450fcc1c13f7a6224e2c415e565e9ce39e6f6 GIT binary patch literal 1073 zcmV-11kU@3P)~Y$`6v2g#?ulT8bqVQ9*sE$hMcJ_7YP_dzhPMzS`~lr@7Oe)!k;-urCfA z?sLv>&bjx_Iad^h=@Fga*qdwBqT_EMHja|7LpKAU;)%UE}+V34S4mML|S+z+)Ax{Vg5MyW}GSrt|ceK0qc>0aI3OWco16?e7P>ubE^O4}!~JjTec3 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>>> 0 is shorthand for ToUint32\n if ('' + uint32Index !== index || uint32Index === 4294967295) {\n return NaN;\n }\n index = uint32Index;\n }\n return index < 0 ? ensureSize(iter) + index : index;\n}\n\nfunction returnTrue() {\n return true;\n}\n\nfunction wholeSlice(begin, end, size) {\n return (\n ((begin === 0 && !isNeg(begin)) ||\n (size !== undefined && begin <= -size)) &&\n (end === undefined || (size !== undefined && end >= size))\n );\n}\n\nfunction resolveBegin(begin, size) {\n return resolveIndex(begin, size, 0);\n}\n\nfunction resolveEnd(end, size) {\n return resolveIndex(end, size, size);\n}\n\nfunction resolveIndex(index, size, defaultIndex) {\n // Sanitize indices using this shorthand for ToInt32(argument)\n // http://www.ecma-international.org/ecma-262/6.0/#sec-toint32\n return index === undefined\n ? defaultIndex\n : isNeg(index)\n ? size === Infinity\n ? size\n : Math.max(0, size + index) | 0\n : size === undefined || size === index\n ? index\n : Math.min(size, index) | 0;\n}\n\nfunction isNeg(value) {\n // Account for -0 which is negative, but not less than 0.\n return value < 0 || (value === 0 && 1 / value === -Infinity);\n}\n\nvar IS_COLLECTION_SYMBOL = '@@__IMMUTABLE_ITERABLE__@@';\n\nfunction isCollection(maybeCollection) {\n return Boolean(maybeCollection && maybeCollection[IS_COLLECTION_SYMBOL]);\n}\n\nvar IS_KEYED_SYMBOL = '@@__IMMUTABLE_KEYED__@@';\n\nfunction isKeyed(maybeKeyed) {\n return Boolean(maybeKeyed && maybeKeyed[IS_KEYED_SYMBOL]);\n}\n\nvar IS_INDEXED_SYMBOL = '@@__IMMUTABLE_INDEXED__@@';\n\nfunction isIndexed(maybeIndexed) {\n return Boolean(maybeIndexed && maybeIndexed[IS_INDEXED_SYMBOL]);\n}\n\nfunction isAssociative(maybeAssociative) {\n return isKeyed(maybeAssociative) || isIndexed(maybeAssociative);\n}\n\nvar Collection = function Collection(value) {\n return isCollection(value) ? value : Seq(value);\n};\n\nvar KeyedCollection = /*@__PURE__*/(function (Collection) {\n function KeyedCollection(value) {\n return isKeyed(value) ? value : KeyedSeq(value);\n }\n\n if ( Collection ) KeyedCollection.__proto__ = Collection;\n KeyedCollection.prototype = Object.create( Collection && Collection.prototype );\n KeyedCollection.prototype.constructor = KeyedCollection;\n\n return KeyedCollection;\n}(Collection));\n\nvar IndexedCollection = /*@__PURE__*/(function (Collection) {\n function IndexedCollection(value) {\n return isIndexed(value) ? value : IndexedSeq(value);\n }\n\n if ( Collection ) IndexedCollection.__proto__ = Collection;\n IndexedCollection.prototype = Object.create( Collection && Collection.prototype );\n IndexedCollection.prototype.constructor = IndexedCollection;\n\n return IndexedCollection;\n}(Collection));\n\nvar SetCollection = /*@__PURE__*/(function (Collection) {\n function SetCollection(value) {\n return isCollection(value) && !isAssociative(value) ? value : SetSeq(value);\n }\n\n if ( Collection ) SetCollection.__proto__ = Collection;\n SetCollection.prototype = Object.create( Collection && Collection.prototype );\n SetCollection.prototype.constructor = SetCollection;\n\n return SetCollection;\n}(Collection));\n\nCollection.Keyed = KeyedCollection;\nCollection.Indexed = IndexedCollection;\nCollection.Set = SetCollection;\n\nvar IS_SEQ_SYMBOL = '@@__IMMUTABLE_SEQ__@@';\n\nfunction isSeq(maybeSeq) {\n return Boolean(maybeSeq && maybeSeq[IS_SEQ_SYMBOL]);\n}\n\nvar IS_RECORD_SYMBOL = '@@__IMMUTABLE_RECORD__@@';\n\nfunction isRecord(maybeRecord) {\n return Boolean(maybeRecord && maybeRecord[IS_RECORD_SYMBOL]);\n}\n\nfunction isImmutable(maybeImmutable) {\n return isCollection(maybeImmutable) || isRecord(maybeImmutable);\n}\n\nvar IS_ORDERED_SYMBOL = '@@__IMMUTABLE_ORDERED__@@';\n\nfunction isOrdered(maybeOrdered) {\n return Boolean(maybeOrdered && maybeOrdered[IS_ORDERED_SYMBOL]);\n}\n\nvar ITERATE_KEYS = 0;\nvar ITERATE_VALUES = 1;\nvar ITERATE_ENTRIES = 2;\n\nvar REAL_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;\nvar FAUX_ITERATOR_SYMBOL = '@@iterator';\n\nvar ITERATOR_SYMBOL = REAL_ITERATOR_SYMBOL || FAUX_ITERATOR_SYMBOL;\n\nvar Iterator = function Iterator(next) {\n this.next = next;\n};\n\nIterator.prototype.toString = function toString () {\n return '[Iterator]';\n};\n\nIterator.KEYS = ITERATE_KEYS;\nIterator.VALUES = ITERATE_VALUES;\nIterator.ENTRIES = ITERATE_ENTRIES;\n\nIterator.prototype.inspect = Iterator.prototype.toSource = function () {\n return this.toString();\n};\nIterator.prototype[ITERATOR_SYMBOL] = function () {\n return this;\n};\n\nfunction iteratorValue(type, k, v, iteratorResult) {\n var value = type === 0 ? k : type === 1 ? v : [k, v];\n iteratorResult\n ? (iteratorResult.value = value)\n : (iteratorResult = {\n value: value,\n done: false,\n });\n return iteratorResult;\n}\n\nfunction iteratorDone() {\n return { value: undefined, done: true };\n}\n\nfunction hasIterator(maybeIterable) {\n if (Array.isArray(maybeIterable)) {\n // IE11 trick as it does not support `Symbol.iterator`\n return true;\n }\n\n return !!getIteratorFn(maybeIterable);\n}\n\nfunction isIterator(maybeIterator) {\n return maybeIterator && typeof maybeIterator.next === 'function';\n}\n\nfunction getIterator(iterable) {\n var iteratorFn = getIteratorFn(iterable);\n return iteratorFn && iteratorFn.call(iterable);\n}\n\nfunction getIteratorFn(iterable) {\n var iteratorFn =\n iterable &&\n ((REAL_ITERATOR_SYMBOL && iterable[REAL_ITERATOR_SYMBOL]) ||\n iterable[FAUX_ITERATOR_SYMBOL]);\n if (typeof iteratorFn === 'function') {\n return iteratorFn;\n }\n}\n\nfunction isEntriesIterable(maybeIterable) {\n var iteratorFn = getIteratorFn(maybeIterable);\n return iteratorFn && iteratorFn === maybeIterable.entries;\n}\n\nfunction isKeysIterable(maybeIterable) {\n var iteratorFn = getIteratorFn(maybeIterable);\n return iteratorFn && iteratorFn === maybeIterable.keys;\n}\n\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\n\nfunction isArrayLike(value) {\n if (Array.isArray(value) || typeof value === 'string') {\n return true;\n }\n\n return (\n value &&\n typeof value === 'object' &&\n Number.isInteger(value.length) &&\n value.length >= 0 &&\n (value.length === 0\n ? // Only {length: 0} is considered Array-like.\n Object.keys(value).length === 1\n : // An object is only Array-like if it has a property where the last value\n // in the array-like may be found (which could be undefined).\n value.hasOwnProperty(value.length - 1))\n );\n}\n\nvar Seq = /*@__PURE__*/(function (Collection) {\n function Seq(value) {\n return value === null || value === undefined\n ? emptySequence()\n : isImmutable(value)\n ? value.toSeq()\n : seqFromValue(value);\n }\n\n if ( Collection ) Seq.__proto__ = Collection;\n Seq.prototype = Object.create( Collection && Collection.prototype );\n Seq.prototype.constructor = Seq;\n\n Seq.prototype.toSeq = function toSeq () {\n return this;\n };\n\n Seq.prototype.toString = function toString () {\n return this.__toString('Seq {', '}');\n };\n\n Seq.prototype.cacheResult = function cacheResult () {\n if (!this._cache && this.__iterateUncached) {\n this._cache = this.entrySeq().toArray();\n this.size = this._cache.length;\n }\n return this;\n };\n\n // abstract __iterateUncached(fn, reverse)\n\n Seq.prototype.__iterate = function __iterate (fn, reverse) {\n var cache = this._cache;\n if (cache) {\n var size = cache.length;\n var i = 0;\n while (i !== size) {\n var entry = cache[reverse ? size - ++i : i++];\n if (fn(entry[1], entry[0], this) === false) {\n break;\n }\n }\n return i;\n }\n return this.__iterateUncached(fn, reverse);\n };\n\n // abstract __iteratorUncached(type, reverse)\n\n Seq.prototype.__iterator = function __iterator (type, reverse) {\n var cache = this._cache;\n if (cache) {\n var size = cache.length;\n var i = 0;\n return new Iterator(function () {\n if (i === size) {\n return iteratorDone();\n }\n var entry = cache[reverse ? size - ++i : i++];\n return iteratorValue(type, entry[0], entry[1]);\n });\n }\n return this.__iteratorUncached(type, reverse);\n };\n\n return Seq;\n}(Collection));\n\nvar KeyedSeq = /*@__PURE__*/(function (Seq) {\n function KeyedSeq(value) {\n return value === null || value === undefined\n ? emptySequence().toKeyedSeq()\n : isCollection(value)\n ? isKeyed(value)\n ? value.toSeq()\n : value.fromEntrySeq()\n : isRecord(value)\n ? value.toSeq()\n : keyedSeqFromValue(value);\n }\n\n if ( Seq ) KeyedSeq.__proto__ = Seq;\n KeyedSeq.prototype = Object.create( Seq && Seq.prototype );\n KeyedSeq.prototype.constructor = KeyedSeq;\n\n KeyedSeq.prototype.toKeyedSeq = function toKeyedSeq () {\n return this;\n };\n\n return KeyedSeq;\n}(Seq));\n\nvar IndexedSeq = /*@__PURE__*/(function (Seq) {\n function IndexedSeq(value) {\n return value === null || value === undefined\n ? emptySequence()\n : isCollection(value)\n ? isKeyed(value)\n ? value.entrySeq()\n : value.toIndexedSeq()\n : isRecord(value)\n ? value.toSeq().entrySeq()\n : indexedSeqFromValue(value);\n }\n\n if ( Seq ) IndexedSeq.__proto__ = Seq;\n IndexedSeq.prototype = Object.create( Seq && Seq.prototype );\n IndexedSeq.prototype.constructor = IndexedSeq;\n\n IndexedSeq.of = function of (/*...values*/) {\n return IndexedSeq(arguments);\n };\n\n IndexedSeq.prototype.toIndexedSeq = function toIndexedSeq () {\n return this;\n };\n\n IndexedSeq.prototype.toString = function toString () {\n return this.__toString('Seq [', ']');\n };\n\n return IndexedSeq;\n}(Seq));\n\nvar SetSeq = /*@__PURE__*/(function (Seq) {\n function SetSeq(value) {\n return (\n isCollection(value) && !isAssociative(value) ? value : IndexedSeq(value)\n ).toSetSeq();\n }\n\n if ( Seq ) SetSeq.__proto__ = Seq;\n SetSeq.prototype = Object.create( Seq && Seq.prototype );\n SetSeq.prototype.constructor = SetSeq;\n\n SetSeq.of = function of (/*...values*/) {\n return SetSeq(arguments);\n };\n\n SetSeq.prototype.toSetSeq = function toSetSeq () {\n return this;\n };\n\n return SetSeq;\n}(Seq));\n\nSeq.isSeq = isSeq;\nSeq.Keyed = KeyedSeq;\nSeq.Set = SetSeq;\nSeq.Indexed = IndexedSeq;\n\nSeq.prototype[IS_SEQ_SYMBOL] = true;\n\n// #pragma Root Sequences\n\nvar ArraySeq = /*@__PURE__*/(function (IndexedSeq) {\n function ArraySeq(array) {\n this._array = array;\n this.size = array.length;\n }\n\n if ( IndexedSeq ) ArraySeq.__proto__ = IndexedSeq;\n ArraySeq.prototype = Object.create( IndexedSeq && IndexedSeq.prototype );\n ArraySeq.prototype.constructor = ArraySeq;\n\n ArraySeq.prototype.get = function get (index, notSetValue) {\n return this.has(index) ? this._array[wrapIndex(this, index)] : notSetValue;\n };\n\n ArraySeq.prototype.__iterate = function __iterate (fn, reverse) {\n var array = this._array;\n var size = array.length;\n var i = 0;\n while (i !== size) {\n var ii = reverse ? size - ++i : i++;\n if (fn(array[ii], ii, this) === false) {\n break;\n }\n }\n return i;\n };\n\n ArraySeq.prototype.__iterator = function __iterator (type, reverse) {\n var array = this._array;\n var size = array.length;\n var i = 0;\n return new Iterator(function () {\n if (i === size) {\n return iteratorDone();\n }\n var ii = reverse ? size - ++i : i++;\n return iteratorValue(type, ii, array[ii]);\n });\n };\n\n return ArraySeq;\n}(IndexedSeq));\n\nvar ObjectSeq = /*@__PURE__*/(function (KeyedSeq) {\n function ObjectSeq(object) {\n var keys = Object.keys(object);\n this._object = object;\n this._keys = keys;\n this.size = keys.length;\n }\n\n if ( KeyedSeq ) ObjectSeq.__proto__ = KeyedSeq;\n ObjectSeq.prototype = Object.create( KeyedSeq && KeyedSeq.prototype );\n ObjectSeq.prototype.constructor = ObjectSeq;\n\n ObjectSeq.prototype.get = function get (key, notSetValue) {\n if (notSetValue !== undefined && !this.has(key)) {\n return notSetValue;\n }\n return this._object[key];\n };\n\n ObjectSeq.prototype.has = function has (key) {\n return hasOwnProperty.call(this._object, key);\n };\n\n ObjectSeq.prototype.__iterate = function __iterate (fn, reverse) {\n var object = this._object;\n var keys = this._keys;\n var size = keys.length;\n var i = 0;\n while (i !== size) {\n var key = keys[reverse ? size - ++i : i++];\n if (fn(object[key], key, this) === false) {\n break;\n }\n }\n return i;\n };\n\n ObjectSeq.prototype.__iterator = function __iterator (type, reverse) {\n var object = this._object;\n var keys = this._keys;\n var size = keys.length;\n var i = 0;\n return new Iterator(function () {\n if (i === size) {\n return iteratorDone();\n }\n var key = keys[reverse ? size - ++i : i++];\n return iteratorValue(type, key, object[key]);\n });\n };\n\n return ObjectSeq;\n}(KeyedSeq));\nObjectSeq.prototype[IS_ORDERED_SYMBOL] = true;\n\nvar CollectionSeq = /*@__PURE__*/(function (IndexedSeq) {\n function CollectionSeq(collection) {\n this._collection = collection;\n this.size = collection.length || collection.size;\n }\n\n if ( IndexedSeq ) CollectionSeq.__proto__ = IndexedSeq;\n CollectionSeq.prototype = Object.create( IndexedSeq && IndexedSeq.prototype );\n CollectionSeq.prototype.constructor = CollectionSeq;\n\n CollectionSeq.prototype.__iterateUncached = function __iterateUncached (fn, reverse) {\n if (reverse) {\n return this.cacheResult().__iterate(fn, reverse);\n }\n var collection = this._collection;\n var iterator = getIterator(collection);\n var iterations = 0;\n if (isIterator(iterator)) {\n var step;\n while (!(step = iterator.next()).done) {\n if (fn(step.value, iterations++, this) === false) {\n break;\n }\n }\n }\n return iterations;\n };\n\n CollectionSeq.prototype.__iteratorUncached = function __iteratorUncached (type, reverse) {\n if (reverse) {\n return this.cacheResult().__iterator(type, reverse);\n }\n var collection = this._collection;\n var iterator = getIterator(collection);\n if (!isIterator(iterator)) {\n return new Iterator(iteratorDone);\n }\n var iterations = 0;\n return new Iterator(function () {\n var step = iterator.next();\n return step.done ? step : iteratorValue(type, iterations++, step.value);\n });\n };\n\n return CollectionSeq;\n}(IndexedSeq));\n\n// # pragma Helper functions\n\nvar EMPTY_SEQ;\n\nfunction emptySequence() {\n return EMPTY_SEQ || (EMPTY_SEQ = new ArraySeq([]));\n}\n\nfunction keyedSeqFromValue(value) {\n var seq = maybeIndexedSeqFromValue(value);\n if (seq) {\n return seq.fromEntrySeq();\n }\n if (typeof value === 'object') {\n return new ObjectSeq(value);\n }\n throw new TypeError(\n 'Expected Array or collection object of [k, v] entries, or keyed object: ' +\n value\n );\n}\n\nfunction indexedSeqFromValue(value) {\n var seq = maybeIndexedSeqFromValue(value);\n if (seq) {\n return seq;\n }\n throw new TypeError(\n 'Expected Array or collection object of values: ' + value\n );\n}\n\nfunction seqFromValue(value) {\n var seq = maybeIndexedSeqFromValue(value);\n if (seq) {\n return isEntriesIterable(value)\n ? seq.fromEntrySeq()\n : isKeysIterable(value)\n ? seq.toSetSeq()\n : seq;\n }\n if (typeof value === 'object') {\n return new ObjectSeq(value);\n }\n throw new TypeError(\n 'Expected Array or collection object of values, or keyed object: ' + value\n );\n}\n\nfunction maybeIndexedSeqFromValue(value) {\n return isArrayLike(value)\n ? new ArraySeq(value)\n : hasIterator(value)\n ? new CollectionSeq(value)\n : undefined;\n}\n\nvar IS_MAP_SYMBOL = '@@__IMMUTABLE_MAP__@@';\n\nfunction isMap(maybeMap) {\n return Boolean(maybeMap && maybeMap[IS_MAP_SYMBOL]);\n}\n\nfunction isOrderedMap(maybeOrderedMap) {\n return isMap(maybeOrderedMap) && isOrdered(maybeOrderedMap);\n}\n\nfunction isValueObject(maybeValue) {\n return Boolean(\n maybeValue &&\n typeof maybeValue.equals === 'function' &&\n typeof maybeValue.hashCode === 'function'\n );\n}\n\n/**\n * An extension of the \"same-value\" algorithm as [described for use by ES6 Map\n * and Set](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map#Key_equality)\n *\n * NaN is considered the same as NaN, however -0 and 0 are considered the same\n * value, which is different from the algorithm described by\n * [`Object.is`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is).\n *\n * This is extended further to allow Objects to describe the values they\n * represent, by way of `valueOf` or `equals` (and `hashCode`).\n *\n * Note: because of this extension, the key equality of Immutable.Map and the\n * value equality of Immutable.Set will differ from ES6 Map and Set.\n *\n * ### Defining custom values\n *\n * The easiest way to describe the value an object represents is by implementing\n * `valueOf`. For example, `Date` represents a value by returning a unix\n * timestamp for `valueOf`:\n *\n * var date1 = new Date(1234567890000); // Fri Feb 13 2009 ...\n * var date2 = new Date(1234567890000);\n * date1.valueOf(); // 1234567890000\n * assert( date1 !== date2 );\n * assert( Immutable.is( date1, date2 ) );\n *\n * Note: overriding `valueOf` may have other implications if you use this object\n * where JavaScript expects a primitive, such as implicit string coercion.\n *\n * For more complex types, especially collections, implementing `valueOf` may\n * not be performant. An alternative is to implement `equals` and `hashCode`.\n *\n * `equals` takes another object, presumably of similar type, and returns true\n * if it is equal. Equality is symmetrical, so the same result should be\n * returned if this and the argument are flipped.\n *\n * assert( a.equals(b) === b.equals(a) );\n *\n * `hashCode` returns a 32bit integer number representing the object which will\n * be used to determine how to store the value object in a Map or Set. You must\n * provide both or neither methods, one must not exist without the other.\n *\n * Also, an important relationship between these methods must be upheld: if two\n * values are equal, they *must* return the same hashCode. If the values are not\n * equal, they might have the same hashCode; this is called a hash collision,\n * and while undesirable for performance reasons, it is acceptable.\n *\n * if (a.equals(b)) {\n * assert( a.hashCode() === b.hashCode() );\n * }\n *\n * All Immutable collections are Value Objects: they implement `equals()`\n * and `hashCode()`.\n */\nfunction is(valueA, valueB) {\n if (valueA === valueB || (valueA !== valueA && valueB !== valueB)) {\n return true;\n }\n if (!valueA || !valueB) {\n return false;\n }\n if (\n typeof valueA.valueOf === 'function' &&\n typeof valueB.valueOf === 'function'\n ) {\n valueA = valueA.valueOf();\n valueB = valueB.valueOf();\n if (valueA === valueB || (valueA !== valueA && valueB !== valueB)) {\n return true;\n }\n if (!valueA || !valueB) {\n return false;\n }\n }\n return !!(\n isValueObject(valueA) &&\n isValueObject(valueB) &&\n valueA.equals(valueB)\n );\n}\n\nvar imul =\n typeof Math.imul === 'function' && Math.imul(0xffffffff, 2) === -2\n ? Math.imul\n : function imul(a, b) {\n a |= 0; // int\n b |= 0; // int\n var c = a & 0xffff;\n var d = b & 0xffff;\n // Shift by 0 fixes the sign on the high part.\n return (c * d + ((((a >>> 16) * d + c * (b >>> 16)) << 16) >>> 0)) | 0; // int\n };\n\n// v8 has an optimization for storing 31-bit signed numbers.\n// Values which have either 00 or 11 as the high order bits qualify.\n// This function drops the highest order bit in a signed number, maintaining\n// the sign bit.\nfunction smi(i32) {\n return ((i32 >>> 1) & 0x40000000) | (i32 & 0xbfffffff);\n}\n\nvar defaultValueOf = Object.prototype.valueOf;\n\nfunction hash(o) {\n if (o == null) {\n return hashNullish(o);\n }\n\n if (typeof o.hashCode === 'function') {\n // Drop any high bits from accidentally long hash codes.\n return smi(o.hashCode(o));\n }\n\n var v = valueOf(o);\n\n if (v == null) {\n return hashNullish(v);\n }\n\n switch (typeof v) {\n case 'boolean':\n // The hash values for built-in constants are a 1 value for each 5-byte\n // shift region expect for the first, which encodes the value. This\n // reduces the odds of a hash collision for these common values.\n return v ? 0x42108421 : 0x42108420;\n case 'number':\n return hashNumber(v);\n case 'string':\n return v.length > STRING_HASH_CACHE_MIN_STRLEN\n ? cachedHashString(v)\n : hashString(v);\n case 'object':\n case 'function':\n return hashJSObj(v);\n case 'symbol':\n return hashSymbol(v);\n default:\n if (typeof v.toString === 'function') {\n return hashString(v.toString());\n }\n throw new Error('Value type ' + typeof v + ' cannot be hashed.');\n }\n}\n\nfunction hashNullish(nullish) {\n return nullish === null ? 0x42108422 : /* undefined */ 0x42108423;\n}\n\n// Compress arbitrarily large numbers into smi hashes.\nfunction hashNumber(n) {\n if (n !== n || n === Infinity) {\n return 0;\n }\n var hash = n | 0;\n if (hash !== n) {\n hash ^= n * 0xffffffff;\n }\n while (n > 0xffffffff) {\n n /= 0xffffffff;\n hash ^= n;\n }\n return smi(hash);\n}\n\nfunction cachedHashString(string) {\n var hashed = stringHashCache[string];\n if (hashed === undefined) {\n hashed = hashString(string);\n if (STRING_HASH_CACHE_SIZE === STRING_HASH_CACHE_MAX_SIZE) {\n STRING_HASH_CACHE_SIZE = 0;\n stringHashCache = {};\n }\n STRING_HASH_CACHE_SIZE++;\n stringHashCache[string] = hashed;\n }\n return hashed;\n}\n\n// http://jsperf.com/hashing-strings\nfunction hashString(string) {\n // This is the hash from JVM\n // The hash code for a string is computed as\n // s[0] * 31 ^ (n - 1) + s[1] * 31 ^ (n - 2) + ... + s[n - 1],\n // where s[i] is the ith character of the string and n is the length of\n // the string. We \"mod\" the result to make it between 0 (inclusive) and 2^31\n // (exclusive) by dropping high bits.\n var hashed = 0;\n for (var ii = 0; ii < string.length; ii++) {\n hashed = (31 * hashed + string.charCodeAt(ii)) | 0;\n }\n return smi(hashed);\n}\n\nfunction hashSymbol(sym) {\n var hashed = symbolMap[sym];\n if (hashed !== undefined) {\n return hashed;\n }\n\n hashed = nextHash();\n\n symbolMap[sym] = hashed;\n\n return hashed;\n}\n\nfunction hashJSObj(obj) {\n var hashed;\n if (usingWeakMap) {\n hashed = weakMap.get(obj);\n if (hashed !== undefined) {\n return hashed;\n }\n }\n\n hashed = obj[UID_HASH_KEY];\n if (hashed !== undefined) {\n return hashed;\n }\n\n if (!canDefineProperty) {\n hashed = obj.propertyIsEnumerable && obj.propertyIsEnumerable[UID_HASH_KEY];\n if (hashed !== undefined) {\n return hashed;\n }\n\n hashed = getIENodeHash(obj);\n if (hashed !== undefined) {\n return hashed;\n }\n }\n\n hashed = nextHash();\n\n if (usingWeakMap) {\n weakMap.set(obj, hashed);\n } else if (isExtensible !== undefined && isExtensible(obj) === false) {\n throw new Error('Non-extensible objects are not allowed as keys.');\n } else if (canDefineProperty) {\n Object.defineProperty(obj, UID_HASH_KEY, {\n enumerable: false,\n configurable: false,\n writable: false,\n value: hashed,\n });\n } else if (\n obj.propertyIsEnumerable !== undefined &&\n obj.propertyIsEnumerable === obj.constructor.prototype.propertyIsEnumerable\n ) {\n // Since we can't define a non-enumerable property on the object\n // we'll hijack one of the less-used non-enumerable properties to\n // save our hash on it. Since this is a function it will not show up in\n // `JSON.stringify` which is what we want.\n obj.propertyIsEnumerable = function () {\n return this.constructor.prototype.propertyIsEnumerable.apply(\n this,\n arguments\n );\n };\n obj.propertyIsEnumerable[UID_HASH_KEY] = hashed;\n } else if (obj.nodeType !== undefined) {\n // At this point we couldn't get the IE `uniqueID` to use as a hash\n // and we couldn't use a non-enumerable property to exploit the\n // dontEnum bug so we simply add the `UID_HASH_KEY` on the node\n // itself.\n obj[UID_HASH_KEY] = hashed;\n } else {\n throw new Error('Unable to set a non-enumerable property on object.');\n }\n\n return hashed;\n}\n\n// Get references to ES5 object methods.\nvar isExtensible = Object.isExtensible;\n\n// True if Object.defineProperty works as expected. IE8 fails this test.\nvar canDefineProperty = (function () {\n try {\n Object.defineProperty({}, '@', {});\n return true;\n } catch (e) {\n return false;\n }\n})();\n\n// IE has a `uniqueID` property on DOM nodes. We can construct the hash from it\n// and avoid memory leaks from the IE cloneNode bug.\nfunction getIENodeHash(node) {\n if (node && node.nodeType > 0) {\n switch (node.nodeType) {\n case 1: // Element\n return node.uniqueID;\n case 9: // Document\n return node.documentElement && node.documentElement.uniqueID;\n }\n }\n}\n\nfunction valueOf(obj) {\n return obj.valueOf !== defaultValueOf && typeof obj.valueOf === 'function'\n ? obj.valueOf(obj)\n : obj;\n}\n\nfunction nextHash() {\n var nextHash = ++_objHashUID;\n if (_objHashUID & 0x40000000) {\n _objHashUID = 0;\n }\n return nextHash;\n}\n\n// If possible, use a WeakMap.\nvar usingWeakMap = typeof WeakMap === 'function';\nvar weakMap;\nif (usingWeakMap) {\n weakMap = new WeakMap();\n}\n\nvar symbolMap = Object.create(null);\n\nvar _objHashUID = 0;\n\nvar UID_HASH_KEY = '__immutablehash__';\nif (typeof Symbol === 'function') {\n UID_HASH_KEY = Symbol(UID_HASH_KEY);\n}\n\nvar STRING_HASH_CACHE_MIN_STRLEN = 16;\nvar STRING_HASH_CACHE_MAX_SIZE = 255;\nvar STRING_HASH_CACHE_SIZE = 0;\nvar stringHashCache = {};\n\nvar ToKeyedSequence = /*@__PURE__*/(function (KeyedSeq) {\n function ToKeyedSequence(indexed, useKeys) {\n this._iter = indexed;\n this._useKeys = useKeys;\n this.size = indexed.size;\n }\n\n if ( KeyedSeq ) ToKeyedSequence.__proto__ = KeyedSeq;\n ToKeyedSequence.prototype = Object.create( KeyedSeq && KeyedSeq.prototype );\n ToKeyedSequence.prototype.constructor = ToKeyedSequence;\n\n ToKeyedSequence.prototype.get = function get (key, notSetValue) {\n return this._iter.get(key, notSetValue);\n };\n\n ToKeyedSequence.prototype.has = function has (key) {\n return this._iter.has(key);\n };\n\n ToKeyedSequence.prototype.valueSeq = function valueSeq () {\n return this._iter.valueSeq();\n };\n\n ToKeyedSequence.prototype.reverse = function reverse () {\n var this$1$1 = this;\n\n var reversedSequence = reverseFactory(this, true);\n if (!this._useKeys) {\n reversedSequence.valueSeq = function () { return this$1$1._iter.toSeq().reverse(); };\n }\n return reversedSequence;\n };\n\n ToKeyedSequence.prototype.map = function map (mapper, context) {\n var this$1$1 = this;\n\n var mappedSequence = mapFactory(this, mapper, context);\n if (!this._useKeys) {\n mappedSequence.valueSeq = function () { return this$1$1._iter.toSeq().map(mapper, context); };\n }\n return mappedSequence;\n };\n\n ToKeyedSequence.prototype.__iterate = function __iterate (fn, reverse) {\n var this$1$1 = this;\n\n return this._iter.__iterate(function (v, k) { return fn(v, k, this$1$1); }, reverse);\n };\n\n ToKeyedSequence.prototype.__iterator = function __iterator (type, reverse) {\n return this._iter.__iterator(type, reverse);\n };\n\n return ToKeyedSequence;\n}(KeyedSeq));\nToKeyedSequence.prototype[IS_ORDERED_SYMBOL] = true;\n\nvar ToIndexedSequence = /*@__PURE__*/(function (IndexedSeq) {\n function ToIndexedSequence(iter) {\n this._iter = iter;\n this.size = iter.size;\n }\n\n if ( IndexedSeq ) ToIndexedSequence.__proto__ = IndexedSeq;\n ToIndexedSequence.prototype = Object.create( IndexedSeq && IndexedSeq.prototype );\n ToIndexedSequence.prototype.constructor = ToIndexedSequence;\n\n ToIndexedSequence.prototype.includes = function includes (value) {\n return this._iter.includes(value);\n };\n\n ToIndexedSequence.prototype.__iterate = function __iterate (fn, reverse) {\n var this$1$1 = this;\n\n var i = 0;\n reverse && ensureSize(this);\n return this._iter.__iterate(\n function (v) { return fn(v, reverse ? this$1$1.size - ++i : i++, this$1$1); },\n reverse\n );\n };\n\n ToIndexedSequence.prototype.__iterator = function __iterator (type, reverse) {\n var this$1$1 = this;\n\n var iterator = this._iter.__iterator(ITERATE_VALUES, reverse);\n var i = 0;\n reverse && ensureSize(this);\n return new Iterator(function () {\n var step = iterator.next();\n return step.done\n ? step\n : iteratorValue(\n type,\n reverse ? this$1$1.size - ++i : i++,\n step.value,\n step\n );\n });\n };\n\n return ToIndexedSequence;\n}(IndexedSeq));\n\nvar ToSetSequence = /*@__PURE__*/(function (SetSeq) {\n function ToSetSequence(iter) {\n this._iter = iter;\n this.size = iter.size;\n }\n\n if ( SetSeq ) ToSetSequence.__proto__ = SetSeq;\n ToSetSequence.prototype = Object.create( SetSeq && SetSeq.prototype );\n ToSetSequence.prototype.constructor = ToSetSequence;\n\n ToSetSequence.prototype.has = function has (key) {\n return this._iter.includes(key);\n };\n\n ToSetSequence.prototype.__iterate = function __iterate (fn, reverse) {\n var this$1$1 = this;\n\n return this._iter.__iterate(function (v) { return fn(v, v, this$1$1); }, reverse);\n };\n\n ToSetSequence.prototype.__iterator = function __iterator (type, reverse) {\n var iterator = this._iter.__iterator(ITERATE_VALUES, reverse);\n return new Iterator(function () {\n var step = iterator.next();\n return step.done\n ? step\n : iteratorValue(type, step.value, step.value, step);\n });\n };\n\n return ToSetSequence;\n}(SetSeq));\n\nvar FromEntriesSequence = /*@__PURE__*/(function (KeyedSeq) {\n function FromEntriesSequence(entries) {\n this._iter = entries;\n this.size = entries.size;\n }\n\n if ( KeyedSeq ) FromEntriesSequence.__proto__ = KeyedSeq;\n FromEntriesSequence.prototype = Object.create( KeyedSeq && KeyedSeq.prototype );\n FromEntriesSequence.prototype.constructor = FromEntriesSequence;\n\n FromEntriesSequence.prototype.entrySeq = function entrySeq () {\n return this._iter.toSeq();\n };\n\n FromEntriesSequence.prototype.__iterate = function __iterate (fn, reverse) {\n var this$1$1 = this;\n\n return this._iter.__iterate(function (entry) {\n // Check if entry exists first so array access doesn't throw for holes\n // in the parent iteration.\n if (entry) {\n validateEntry(entry);\n var indexedCollection = isCollection(entry);\n return fn(\n indexedCollection ? entry.get(1) : entry[1],\n indexedCollection ? entry.get(0) : entry[0],\n this$1$1\n );\n }\n }, reverse);\n };\n\n FromEntriesSequence.prototype.__iterator = function __iterator (type, reverse) {\n var iterator = this._iter.__iterator(ITERATE_VALUES, reverse);\n return new Iterator(function () {\n while (true) {\n var step = iterator.next();\n if (step.done) {\n return step;\n }\n var entry = step.value;\n // Check if entry exists first so array access doesn't throw for holes\n // in the parent iteration.\n if (entry) {\n validateEntry(entry);\n var indexedCollection = isCollection(entry);\n return iteratorValue(\n type,\n indexedCollection ? entry.get(0) : entry[0],\n indexedCollection ? entry.get(1) : entry[1],\n step\n );\n }\n }\n });\n };\n\n return FromEntriesSequence;\n}(KeyedSeq));\n\nToIndexedSequence.prototype.cacheResult =\n ToKeyedSequence.prototype.cacheResult =\n ToSetSequence.prototype.cacheResult =\n FromEntriesSequence.prototype.cacheResult =\n cacheResultThrough;\n\nfunction flipFactory(collection) {\n var flipSequence = makeSequence(collection);\n flipSequence._iter = collection;\n flipSequence.size = collection.size;\n flipSequence.flip = function () { return collection; };\n flipSequence.reverse = function () {\n var reversedSequence = collection.reverse.apply(this); // super.reverse()\n reversedSequence.flip = function () { return collection.reverse(); };\n return reversedSequence;\n };\n flipSequence.has = function (key) { return collection.includes(key); };\n flipSequence.includes = function (key) { return collection.has(key); };\n flipSequence.cacheResult = cacheResultThrough;\n flipSequence.__iterateUncached = function (fn, reverse) {\n var this$1$1 = this;\n\n return collection.__iterate(function (v, k) { return fn(k, v, this$1$1) !== false; }, reverse);\n };\n flipSequence.__iteratorUncached = function (type, reverse) {\n if (type === ITERATE_ENTRIES) {\n var iterator = collection.__iterator(type, reverse);\n return new Iterator(function () {\n var step = iterator.next();\n if (!step.done) {\n var k = step.value[0];\n step.value[0] = step.value[1];\n step.value[1] = k;\n }\n return step;\n });\n }\n return collection.__iterator(\n type === ITERATE_VALUES ? ITERATE_KEYS : ITERATE_VALUES,\n reverse\n );\n };\n return flipSequence;\n}\n\nfunction mapFactory(collection, mapper, context) {\n var mappedSequence = makeSequence(collection);\n mappedSequence.size = collection.size;\n mappedSequence.has = function (key) { return collection.has(key); };\n mappedSequence.get = function (key, notSetValue) {\n var v = collection.get(key, NOT_SET);\n return v === NOT_SET\n ? notSetValue\n : mapper.call(context, v, key, collection);\n };\n mappedSequence.__iterateUncached = function (fn, reverse) {\n var this$1$1 = this;\n\n return collection.__iterate(\n function (v, k, c) { return fn(mapper.call(context, v, k, c), k, this$1$1) !== false; },\n reverse\n );\n };\n mappedSequence.__iteratorUncached = function (type, reverse) {\n var iterator = collection.__iterator(ITERATE_ENTRIES, reverse);\n return new Iterator(function () {\n var step = iterator.next();\n if (step.done) {\n return step;\n }\n var entry = step.value;\n var key = entry[0];\n return iteratorValue(\n type,\n key,\n mapper.call(context, entry[1], key, collection),\n step\n );\n });\n };\n return mappedSequence;\n}\n\nfunction reverseFactory(collection, useKeys) {\n var this$1$1 = this;\n\n var reversedSequence = makeSequence(collection);\n reversedSequence._iter = collection;\n reversedSequence.size = collection.size;\n reversedSequence.reverse = function () { return collection; };\n if (collection.flip) {\n reversedSequence.flip = function () {\n var flipSequence = flipFactory(collection);\n flipSequence.reverse = function () { return collection.flip(); };\n return flipSequence;\n };\n }\n reversedSequence.get = function (key, notSetValue) { return collection.get(useKeys ? key : -1 - key, notSetValue); };\n reversedSequence.has = function (key) { return collection.has(useKeys ? key : -1 - key); };\n reversedSequence.includes = function (value) { return collection.includes(value); };\n reversedSequence.cacheResult = cacheResultThrough;\n reversedSequence.__iterate = function (fn, reverse) {\n var this$1$1 = this;\n\n var i = 0;\n reverse && ensureSize(collection);\n return collection.__iterate(\n function (v, k) { return fn(v, useKeys ? k : reverse ? this$1$1.size - ++i : i++, this$1$1); },\n !reverse\n );\n };\n reversedSequence.__iterator = function (type, reverse) {\n var i = 0;\n reverse && ensureSize(collection);\n var iterator = collection.__iterator(ITERATE_ENTRIES, !reverse);\n return new Iterator(function () {\n var step = iterator.next();\n if (step.done) {\n return step;\n }\n var entry = step.value;\n return iteratorValue(\n type,\n useKeys ? entry[0] : reverse ? this$1$1.size - ++i : i++,\n entry[1],\n step\n );\n });\n };\n return reversedSequence;\n}\n\nfunction filterFactory(collection, predicate, context, useKeys) {\n var filterSequence = makeSequence(collection);\n if (useKeys) {\n filterSequence.has = function (key) {\n var v = collection.get(key, NOT_SET);\n return v !== NOT_SET && !!predicate.call(context, v, key, collection);\n };\n filterSequence.get = function (key, notSetValue) {\n var v = collection.get(key, NOT_SET);\n return v !== NOT_SET && predicate.call(context, v, key, collection)\n ? v\n : notSetValue;\n };\n }\n filterSequence.__iterateUncached = function (fn, reverse) {\n var this$1$1 = this;\n\n var iterations = 0;\n collection.__iterate(function (v, k, c) {\n if (predicate.call(context, v, k, c)) {\n iterations++;\n return fn(v, useKeys ? k : iterations - 1, this$1$1);\n }\n }, reverse);\n return iterations;\n };\n filterSequence.__iteratorUncached = function (type, reverse) {\n var iterator = collection.__iterator(ITERATE_ENTRIES, reverse);\n var iterations = 0;\n return new Iterator(function () {\n while (true) {\n var step = iterator.next();\n if (step.done) {\n return step;\n }\n var entry = step.value;\n var key = entry[0];\n var value = entry[1];\n if (predicate.call(context, value, key, collection)) {\n return iteratorValue(type, useKeys ? key : iterations++, value, step);\n }\n }\n });\n };\n return filterSequence;\n}\n\nfunction countByFactory(collection, grouper, context) {\n var groups = Map().asMutable();\n collection.__iterate(function (v, k) {\n groups.update(grouper.call(context, v, k, collection), 0, function (a) { return a + 1; });\n });\n return groups.asImmutable();\n}\n\nfunction groupByFactory(collection, grouper, context) {\n var isKeyedIter = isKeyed(collection);\n var groups = (isOrdered(collection) ? OrderedMap() : Map()).asMutable();\n collection.__iterate(function (v, k) {\n groups.update(\n grouper.call(context, v, k, collection),\n function (a) { return ((a = a || []), a.push(isKeyedIter ? [k, v] : v), a); }\n );\n });\n var coerce = collectionClass(collection);\n return groups.map(function (arr) { return reify(collection, coerce(arr)); }).asImmutable();\n}\n\nfunction sliceFactory(collection, begin, end, useKeys) {\n var originalSize = collection.size;\n\n if (wholeSlice(begin, end, originalSize)) {\n return collection;\n }\n\n var resolvedBegin = resolveBegin(begin, originalSize);\n var resolvedEnd = resolveEnd(end, originalSize);\n\n // begin or end will be NaN if they were provided as negative numbers and\n // this collection's size is unknown. In that case, cache first so there is\n // a known size and these do not resolve to NaN.\n if (resolvedBegin !== resolvedBegin || resolvedEnd !== resolvedEnd) {\n return sliceFactory(collection.toSeq().cacheResult(), begin, end, useKeys);\n }\n\n // Note: resolvedEnd is undefined when the original sequence's length is\n // unknown and this slice did not supply an end and should contain all\n // elements after resolvedBegin.\n // In that case, resolvedSize will be NaN and sliceSize will remain undefined.\n var resolvedSize = resolvedEnd - resolvedBegin;\n var sliceSize;\n if (resolvedSize === resolvedSize) {\n sliceSize = resolvedSize < 0 ? 0 : resolvedSize;\n }\n\n var sliceSeq = makeSequence(collection);\n\n // If collection.size is undefined, the size of the realized sliceSeq is\n // unknown at this point unless the number of items to slice is 0\n sliceSeq.size =\n sliceSize === 0 ? sliceSize : (collection.size && sliceSize) || undefined;\n\n if (!useKeys && isSeq(collection) && sliceSize >= 0) {\n sliceSeq.get = function (index, notSetValue) {\n index = wrapIndex(this, index);\n return index >= 0 && index < sliceSize\n ? collection.get(index + resolvedBegin, notSetValue)\n : notSetValue;\n };\n }\n\n sliceSeq.__iterateUncached = function (fn, reverse) {\n var this$1$1 = this;\n\n if (sliceSize === 0) {\n return 0;\n }\n if (reverse) {\n return this.cacheResult().__iterate(fn, reverse);\n }\n var skipped = 0;\n var isSkipping = true;\n var iterations = 0;\n collection.__iterate(function (v, k) {\n if (!(isSkipping && (isSkipping = skipped++ < resolvedBegin))) {\n iterations++;\n return (\n fn(v, useKeys ? k : iterations - 1, this$1$1) !== false &&\n iterations !== sliceSize\n );\n }\n });\n return iterations;\n };\n\n sliceSeq.__iteratorUncached = function (type, reverse) {\n if (sliceSize !== 0 && reverse) {\n return this.cacheResult().__iterator(type, reverse);\n }\n // Don't bother instantiating parent iterator if taking 0.\n if (sliceSize === 0) {\n return new Iterator(iteratorDone);\n }\n var iterator = collection.__iterator(type, reverse);\n var skipped = 0;\n var iterations = 0;\n return new Iterator(function () {\n while (skipped++ < resolvedBegin) {\n iterator.next();\n }\n if (++iterations > sliceSize) {\n return iteratorDone();\n }\n var step = iterator.next();\n if (useKeys || type === ITERATE_VALUES || step.done) {\n return step;\n }\n if (type === ITERATE_KEYS) {\n return iteratorValue(type, iterations - 1, undefined, step);\n }\n return iteratorValue(type, iterations - 1, step.value[1], step);\n });\n };\n\n return sliceSeq;\n}\n\nfunction takeWhileFactory(collection, predicate, context) {\n var takeSequence = makeSequence(collection);\n takeSequence.__iterateUncached = function (fn, reverse) {\n var this$1$1 = this;\n\n if (reverse) {\n return this.cacheResult().__iterate(fn, reverse);\n }\n var iterations = 0;\n collection.__iterate(\n function (v, k, c) { return predicate.call(context, v, k, c) && ++iterations && fn(v, k, this$1$1); }\n );\n return iterations;\n };\n takeSequence.__iteratorUncached = function (type, reverse) {\n var this$1$1 = this;\n\n if (reverse) {\n return this.cacheResult().__iterator(type, reverse);\n }\n var iterator = collection.__iterator(ITERATE_ENTRIES, reverse);\n var iterating = true;\n return new Iterator(function () {\n if (!iterating) {\n return iteratorDone();\n }\n var step = iterator.next();\n if (step.done) {\n return step;\n }\n var entry = step.value;\n var k = entry[0];\n var v = entry[1];\n if (!predicate.call(context, v, k, this$1$1)) {\n iterating = false;\n return iteratorDone();\n }\n return type === ITERATE_ENTRIES ? step : iteratorValue(type, k, v, step);\n });\n };\n return takeSequence;\n}\n\nfunction skipWhileFactory(collection, predicate, context, useKeys) {\n var skipSequence = makeSequence(collection);\n skipSequence.__iterateUncached = function (fn, reverse) {\n var this$1$1 = this;\n\n if (reverse) {\n return this.cacheResult().__iterate(fn, reverse);\n }\n var isSkipping = true;\n var iterations = 0;\n collection.__iterate(function (v, k, c) {\n if (!(isSkipping && (isSkipping = predicate.call(context, v, k, c)))) {\n iterations++;\n return fn(v, useKeys ? k : iterations - 1, this$1$1);\n }\n });\n return iterations;\n };\n skipSequence.__iteratorUncached = function (type, reverse) {\n var this$1$1 = this;\n\n if (reverse) {\n return this.cacheResult().__iterator(type, reverse);\n }\n var iterator = collection.__iterator(ITERATE_ENTRIES, reverse);\n var skipping = true;\n var iterations = 0;\n return new Iterator(function () {\n var step;\n var k;\n var v;\n do {\n step = iterator.next();\n if (step.done) {\n if (useKeys || type === ITERATE_VALUES) {\n return step;\n }\n if (type === ITERATE_KEYS) {\n return iteratorValue(type, iterations++, undefined, step);\n }\n return iteratorValue(type, iterations++, step.value[1], step);\n }\n var entry = step.value;\n k = entry[0];\n v = entry[1];\n skipping && (skipping = predicate.call(context, v, k, this$1$1));\n } while (skipping);\n return type === ITERATE_ENTRIES ? step : iteratorValue(type, k, v, step);\n });\n };\n return skipSequence;\n}\n\nfunction concatFactory(collection, values) {\n var isKeyedCollection = isKeyed(collection);\n var iters = [collection]\n .concat(values)\n .map(function (v) {\n if (!isCollection(v)) {\n v = isKeyedCollection\n ? keyedSeqFromValue(v)\n : indexedSeqFromValue(Array.isArray(v) ? v : [v]);\n } else if (isKeyedCollection) {\n v = KeyedCollection(v);\n }\n return v;\n })\n .filter(function (v) { return v.size !== 0; });\n\n if (iters.length === 0) {\n return collection;\n }\n\n if (iters.length === 1) {\n var singleton = iters[0];\n if (\n singleton === collection ||\n (isKeyedCollection && isKeyed(singleton)) ||\n (isIndexed(collection) && isIndexed(singleton))\n ) {\n return singleton;\n }\n }\n\n var concatSeq = new ArraySeq(iters);\n if (isKeyedCollection) {\n concatSeq = concatSeq.toKeyedSeq();\n } else if (!isIndexed(collection)) {\n concatSeq = concatSeq.toSetSeq();\n }\n concatSeq = concatSeq.flatten(true);\n concatSeq.size = iters.reduce(function (sum, seq) {\n if (sum !== undefined) {\n var size = seq.size;\n if (size !== undefined) {\n return sum + size;\n }\n }\n }, 0);\n return concatSeq;\n}\n\nfunction flattenFactory(collection, depth, useKeys) {\n var flatSequence = makeSequence(collection);\n flatSequence.__iterateUncached = function (fn, reverse) {\n if (reverse) {\n return this.cacheResult().__iterate(fn, reverse);\n }\n var iterations = 0;\n var stopped = false;\n function flatDeep(iter, currentDepth) {\n iter.__iterate(function (v, k) {\n if ((!depth || currentDepth < depth) && isCollection(v)) {\n flatDeep(v, currentDepth + 1);\n } else {\n iterations++;\n if (fn(v, useKeys ? k : iterations - 1, flatSequence) === false) {\n stopped = true;\n }\n }\n return !stopped;\n }, reverse);\n }\n flatDeep(collection, 0);\n return iterations;\n };\n flatSequence.__iteratorUncached = function (type, reverse) {\n if (reverse) {\n return this.cacheResult().__iterator(type, reverse);\n }\n var iterator = collection.__iterator(type, reverse);\n var stack = [];\n var iterations = 0;\n return new Iterator(function () {\n while (iterator) {\n var step = iterator.next();\n if (step.done !== false) {\n iterator = stack.pop();\n continue;\n }\n var v = step.value;\n if (type === ITERATE_ENTRIES) {\n v = v[1];\n }\n if ((!depth || stack.length < depth) && isCollection(v)) {\n stack.push(iterator);\n iterator = v.__iterator(type, reverse);\n } else {\n return useKeys ? step : iteratorValue(type, iterations++, v, step);\n }\n }\n return iteratorDone();\n });\n };\n return flatSequence;\n}\n\nfunction flatMapFactory(collection, mapper, context) {\n var coerce = collectionClass(collection);\n return collection\n .toSeq()\n .map(function (v, k) { return coerce(mapper.call(context, v, k, collection)); })\n .flatten(true);\n}\n\nfunction interposeFactory(collection, separator) {\n var interposedSequence = makeSequence(collection);\n interposedSequence.size = collection.size && collection.size * 2 - 1;\n interposedSequence.__iterateUncached = function (fn, reverse) {\n var this$1$1 = this;\n\n var iterations = 0;\n collection.__iterate(\n function (v) { return (!iterations || fn(separator, iterations++, this$1$1) !== false) &&\n fn(v, iterations++, this$1$1) !== false; },\n reverse\n );\n return iterations;\n };\n interposedSequence.__iteratorUncached = function (type, reverse) {\n var iterator = collection.__iterator(ITERATE_VALUES, reverse);\n var iterations = 0;\n var step;\n return new Iterator(function () {\n if (!step || iterations % 2) {\n step = iterator.next();\n if (step.done) {\n return step;\n }\n }\n return iterations % 2\n ? iteratorValue(type, iterations++, separator)\n : iteratorValue(type, iterations++, step.value, step);\n });\n };\n return interposedSequence;\n}\n\nfunction sortFactory(collection, comparator, mapper) {\n if (!comparator) {\n comparator = defaultComparator;\n }\n var isKeyedCollection = isKeyed(collection);\n var index = 0;\n var entries = collection\n .toSeq()\n .map(function (v, k) { return [k, v, index++, mapper ? mapper(v, k, collection) : v]; })\n .valueSeq()\n .toArray();\n entries\n .sort(function (a, b) { return comparator(a[3], b[3]) || a[2] - b[2]; })\n .forEach(\n isKeyedCollection\n ? function (v, i) {\n entries[i].length = 2;\n }\n : function (v, i) {\n entries[i] = v[1];\n }\n );\n return isKeyedCollection\n ? KeyedSeq(entries)\n : isIndexed(collection)\n ? IndexedSeq(entries)\n : SetSeq(entries);\n}\n\nfunction maxFactory(collection, comparator, mapper) {\n if (!comparator) {\n comparator = defaultComparator;\n }\n if (mapper) {\n var entry = collection\n .toSeq()\n .map(function (v, k) { return [v, mapper(v, k, collection)]; })\n .reduce(function (a, b) { return (maxCompare(comparator, a[1], b[1]) ? b : a); });\n return entry && entry[0];\n }\n return collection.reduce(function (a, b) { return (maxCompare(comparator, a, b) ? b : a); });\n}\n\nfunction maxCompare(comparator, a, b) {\n var comp = comparator(b, a);\n // b is considered the new max if the comparator declares them equal, but\n // they are not equal and b is in fact a nullish value.\n return (\n (comp === 0 && b !== a && (b === undefined || b === null || b !== b)) ||\n comp > 0\n );\n}\n\nfunction zipWithFactory(keyIter, zipper, iters, zipAll) {\n var zipSequence = makeSequence(keyIter);\n var sizes = new ArraySeq(iters).map(function (i) { return i.size; });\n zipSequence.size = zipAll ? sizes.max() : sizes.min();\n // Note: this a generic base implementation of __iterate in terms of\n // __iterator which may be more generically useful in the future.\n zipSequence.__iterate = function (fn, reverse) {\n /* generic:\n var iterator = this.__iterator(ITERATE_ENTRIES, reverse);\n var step;\n var iterations = 0;\n while (!(step = iterator.next()).done) {\n iterations++;\n if (fn(step.value[1], step.value[0], this) === false) {\n break;\n }\n }\n return iterations;\n */\n // indexed:\n var iterator = this.__iterator(ITERATE_VALUES, reverse);\n var step;\n var iterations = 0;\n while (!(step = iterator.next()).done) {\n if (fn(step.value, iterations++, this) === false) {\n break;\n }\n }\n return iterations;\n };\n zipSequence.__iteratorUncached = function (type, reverse) {\n var iterators = iters.map(\n function (i) { return ((i = Collection(i)), getIterator(reverse ? i.reverse() : i)); }\n );\n var iterations = 0;\n var isDone = false;\n return new Iterator(function () {\n var steps;\n if (!isDone) {\n steps = iterators.map(function (i) { return i.next(); });\n isDone = zipAll ? steps.every(function (s) { return s.done; }) : steps.some(function (s) { return s.done; });\n }\n if (isDone) {\n return iteratorDone();\n }\n return iteratorValue(\n type,\n iterations++,\n zipper.apply(\n null,\n steps.map(function (s) { return s.value; })\n )\n );\n });\n };\n return zipSequence;\n}\n\n// #pragma Helper Functions\n\nfunction reify(iter, seq) {\n return iter === seq ? iter : isSeq(iter) ? seq : iter.constructor(seq);\n}\n\nfunction validateEntry(entry) {\n if (entry !== Object(entry)) {\n throw new TypeError('Expected [K, V] tuple: ' + entry);\n }\n}\n\nfunction collectionClass(collection) {\n return isKeyed(collection)\n ? KeyedCollection\n : isIndexed(collection)\n ? IndexedCollection\n : SetCollection;\n}\n\nfunction makeSequence(collection) {\n return Object.create(\n (isKeyed(collection)\n ? KeyedSeq\n : isIndexed(collection)\n ? IndexedSeq\n : SetSeq\n ).prototype\n );\n}\n\nfunction cacheResultThrough() {\n if (this._iter.cacheResult) {\n this._iter.cacheResult();\n this.size = this._iter.size;\n return this;\n }\n return Seq.prototype.cacheResult.call(this);\n}\n\nfunction defaultComparator(a, b) {\n if (a === undefined && b === undefined) {\n return 0;\n }\n\n if (a === undefined) {\n return 1;\n }\n\n if (b === undefined) {\n return -1;\n }\n\n return a > b ? 1 : a < b ? -1 : 0;\n}\n\nfunction arrCopy(arr, offset) {\n offset = offset || 0;\n var len = Math.max(0, arr.length - offset);\n var newArr = new Array(len);\n for (var ii = 0; ii < len; ii++) {\n newArr[ii] = arr[ii + offset];\n }\n return newArr;\n}\n\nfunction invariant(condition, error) {\n if (!condition) { throw new Error(error); }\n}\n\nfunction assertNotInfinite(size) {\n invariant(\n size !== Infinity,\n 'Cannot perform this action with an infinite size.'\n );\n}\n\nfunction coerceKeyPath(keyPath) {\n if (isArrayLike(keyPath) && typeof keyPath !== 'string') {\n return keyPath;\n }\n if (isOrdered(keyPath)) {\n return keyPath.toArray();\n }\n throw new TypeError(\n 'Invalid keyPath: expected Ordered Collection or Array: ' + keyPath\n );\n}\n\nvar toString = Object.prototype.toString;\n\nfunction isPlainObject(value) {\n // The base prototype's toString deals with Argument objects and native namespaces like Math\n if (\n !value ||\n typeof value !== 'object' ||\n toString.call(value) !== '[object Object]'\n ) {\n return false;\n }\n\n var proto = Object.getPrototypeOf(value);\n if (proto === null) {\n return true;\n }\n\n // Iteratively going up the prototype chain is needed for cross-realm environments (differing contexts, iframes, etc)\n var parentProto = proto;\n var nextProto = Object.getPrototypeOf(proto);\n while (nextProto !== null) {\n parentProto = nextProto;\n nextProto = Object.getPrototypeOf(parentProto);\n }\n return parentProto === proto;\n}\n\n/**\n * Returns true if the value is a potentially-persistent data structure, either\n * provided by Immutable.js or a plain Array or Object.\n */\nfunction isDataStructure(value) {\n return (\n typeof value === 'object' &&\n (isImmutable(value) || Array.isArray(value) || isPlainObject(value))\n );\n}\n\nfunction quoteString(value) {\n try {\n return typeof value === 'string' ? JSON.stringify(value) : String(value);\n } catch (_ignoreError) {\n return JSON.stringify(value);\n }\n}\n\nfunction has(collection, key) {\n return isImmutable(collection)\n ? collection.has(key)\n : isDataStructure(collection) && hasOwnProperty.call(collection, key);\n}\n\nfunction get(collection, key, notSetValue) {\n return isImmutable(collection)\n ? collection.get(key, notSetValue)\n : !has(collection, key)\n ? notSetValue\n : typeof collection.get === 'function'\n ? collection.get(key)\n : collection[key];\n}\n\nfunction shallowCopy(from) {\n if (Array.isArray(from)) {\n return arrCopy(from);\n }\n var to = {};\n for (var key in from) {\n if (hasOwnProperty.call(from, key)) {\n to[key] = from[key];\n }\n }\n return to;\n}\n\nfunction remove(collection, key) {\n if (!isDataStructure(collection)) {\n throw new TypeError(\n 'Cannot update non-data-structure value: ' + collection\n );\n }\n if (isImmutable(collection)) {\n if (!collection.remove) {\n throw new TypeError(\n 'Cannot update immutable value without .remove() method: ' + collection\n );\n }\n return collection.remove(key);\n }\n if (!hasOwnProperty.call(collection, key)) {\n return collection;\n }\n var collectionCopy = shallowCopy(collection);\n if (Array.isArray(collectionCopy)) {\n collectionCopy.splice(key, 1);\n } else {\n delete collectionCopy[key];\n }\n return collectionCopy;\n}\n\nfunction set(collection, key, value) {\n if (!isDataStructure(collection)) {\n throw new TypeError(\n 'Cannot update non-data-structure value: ' + collection\n );\n }\n if (isImmutable(collection)) {\n if (!collection.set) {\n throw new TypeError(\n 'Cannot update immutable value without .set() method: ' + collection\n );\n }\n return collection.set(key, value);\n }\n if (hasOwnProperty.call(collection, key) && value === collection[key]) {\n return collection;\n }\n var collectionCopy = shallowCopy(collection);\n collectionCopy[key] = value;\n return collectionCopy;\n}\n\nfunction updateIn$1(collection, keyPath, notSetValue, updater) {\n if (!updater) {\n updater = notSetValue;\n notSetValue = undefined;\n }\n var updatedValue = updateInDeeply(\n isImmutable(collection),\n collection,\n coerceKeyPath(keyPath),\n 0,\n notSetValue,\n updater\n );\n return updatedValue === NOT_SET ? notSetValue : updatedValue;\n}\n\nfunction updateInDeeply(\n inImmutable,\n existing,\n keyPath,\n i,\n notSetValue,\n updater\n) {\n var wasNotSet = existing === NOT_SET;\n if (i === keyPath.length) {\n var existingValue = wasNotSet ? notSetValue : existing;\n var newValue = updater(existingValue);\n return newValue === existingValue ? existing : newValue;\n }\n if (!wasNotSet && !isDataStructure(existing)) {\n throw new TypeError(\n 'Cannot update within non-data-structure value in path [' +\n keyPath.slice(0, i).map(quoteString) +\n ']: ' +\n existing\n );\n }\n var key = keyPath[i];\n var nextExisting = wasNotSet ? NOT_SET : get(existing, key, NOT_SET);\n var nextUpdated = updateInDeeply(\n nextExisting === NOT_SET ? inImmutable : isImmutable(nextExisting),\n nextExisting,\n keyPath,\n i + 1,\n notSetValue,\n updater\n );\n return nextUpdated === nextExisting\n ? existing\n : nextUpdated === NOT_SET\n ? remove(existing, key)\n : set(\n wasNotSet ? (inImmutable ? emptyMap() : {}) : existing,\n key,\n nextUpdated\n );\n}\n\nfunction setIn$1(collection, keyPath, value) {\n return updateIn$1(collection, keyPath, NOT_SET, function () { return value; });\n}\n\nfunction setIn(keyPath, v) {\n return setIn$1(this, keyPath, v);\n}\n\nfunction removeIn(collection, keyPath) {\n return updateIn$1(collection, keyPath, function () { return NOT_SET; });\n}\n\nfunction deleteIn(keyPath) {\n return removeIn(this, keyPath);\n}\n\nfunction update$1(collection, key, notSetValue, updater) {\n return updateIn$1(collection, [key], notSetValue, updater);\n}\n\nfunction update(key, notSetValue, updater) {\n return arguments.length === 1\n ? key(this)\n : update$1(this, key, notSetValue, updater);\n}\n\nfunction updateIn(keyPath, notSetValue, updater) {\n return updateIn$1(this, keyPath, notSetValue, updater);\n}\n\nfunction merge$1() {\n var iters = [], len = arguments.length;\n while ( len-- ) iters[ len ] = arguments[ len ];\n\n return mergeIntoKeyedWith(this, iters);\n}\n\nfunction mergeWith$1(merger) {\n var iters = [], len = arguments.length - 1;\n while ( len-- > 0 ) iters[ len ] = arguments[ len + 1 ];\n\n if (typeof merger !== 'function') {\n throw new TypeError('Invalid merger function: ' + merger);\n }\n return mergeIntoKeyedWith(this, iters, merger);\n}\n\nfunction mergeIntoKeyedWith(collection, collections, merger) {\n var iters = [];\n for (var ii = 0; ii < collections.length; ii++) {\n var collection$1 = KeyedCollection(collections[ii]);\n if (collection$1.size !== 0) {\n iters.push(collection$1);\n }\n }\n if (iters.length === 0) {\n return collection;\n }\n if (\n collection.toSeq().size === 0 &&\n !collection.__ownerID &&\n iters.length === 1\n ) {\n return collection.constructor(iters[0]);\n }\n return collection.withMutations(function (collection) {\n var mergeIntoCollection = merger\n ? function (value, key) {\n update$1(collection, key, NOT_SET, function (oldVal) { return oldVal === NOT_SET ? value : merger(oldVal, value, key); }\n );\n }\n : function (value, key) {\n collection.set(key, value);\n };\n for (var ii = 0; ii < iters.length; ii++) {\n iters[ii].forEach(mergeIntoCollection);\n }\n });\n}\n\nfunction merge(collection) {\n var sources = [], len = arguments.length - 1;\n while ( len-- > 0 ) sources[ len ] = arguments[ len + 1 ];\n\n return mergeWithSources(collection, sources);\n}\n\nfunction mergeWith(merger, collection) {\n var sources = [], len = arguments.length - 2;\n while ( len-- > 0 ) sources[ len ] = arguments[ len + 2 ];\n\n return mergeWithSources(collection, sources, merger);\n}\n\nfunction mergeDeep$1(collection) {\n var sources = [], len = arguments.length - 1;\n while ( len-- > 0 ) sources[ len ] = arguments[ len + 1 ];\n\n return mergeDeepWithSources(collection, sources);\n}\n\nfunction mergeDeepWith$1(merger, collection) {\n var sources = [], len = arguments.length - 2;\n while ( len-- > 0 ) sources[ len ] = arguments[ len + 2 ];\n\n return mergeDeepWithSources(collection, sources, merger);\n}\n\nfunction mergeDeepWithSources(collection, sources, merger) {\n return mergeWithSources(collection, sources, deepMergerWith(merger));\n}\n\nfunction mergeWithSources(collection, sources, merger) {\n if (!isDataStructure(collection)) {\n throw new TypeError(\n 'Cannot merge into non-data-structure value: ' + collection\n );\n }\n if (isImmutable(collection)) {\n return typeof merger === 'function' && collection.mergeWith\n ? collection.mergeWith.apply(collection, [ merger ].concat( sources ))\n : collection.merge\n ? collection.merge.apply(collection, sources)\n : collection.concat.apply(collection, sources);\n }\n var isArray = Array.isArray(collection);\n var merged = collection;\n var Collection = isArray ? IndexedCollection : KeyedCollection;\n var mergeItem = isArray\n ? function (value) {\n // Copy on write\n if (merged === collection) {\n merged = shallowCopy(merged);\n }\n merged.push(value);\n }\n : function (value, key) {\n var hasVal = hasOwnProperty.call(merged, key);\n var nextVal =\n hasVal && merger ? merger(merged[key], value, key) : value;\n if (!hasVal || nextVal !== merged[key]) {\n // Copy on write\n if (merged === collection) {\n merged = shallowCopy(merged);\n }\n merged[key] = nextVal;\n }\n };\n for (var i = 0; i < sources.length; i++) {\n Collection(sources[i]).forEach(mergeItem);\n }\n return merged;\n}\n\nfunction deepMergerWith(merger) {\n function deepMerger(oldValue, newValue, key) {\n return isDataStructure(oldValue) &&\n isDataStructure(newValue) &&\n areMergeable(oldValue, newValue)\n ? mergeWithSources(oldValue, [newValue], deepMerger)\n : merger\n ? merger(oldValue, newValue, key)\n : newValue;\n }\n return deepMerger;\n}\n\n/**\n * It's unclear what the desired behavior is for merging two collections that\n * fall into separate categories between keyed, indexed, or set-like, so we only\n * consider them mergeable if they fall into the same category.\n */\nfunction areMergeable(oldDataStructure, newDataStructure) {\n var oldSeq = Seq(oldDataStructure);\n var newSeq = Seq(newDataStructure);\n // This logic assumes that a sequence can only fall into one of the three\n // categories mentioned above (since there's no `isSetLike()` method).\n return (\n isIndexed(oldSeq) === isIndexed(newSeq) &&\n isKeyed(oldSeq) === isKeyed(newSeq)\n );\n}\n\nfunction mergeDeep() {\n var iters = [], len = arguments.length;\n while ( len-- ) iters[ len ] = arguments[ len ];\n\n return mergeDeepWithSources(this, iters);\n}\n\nfunction mergeDeepWith(merger) {\n var iters = [], len = arguments.length - 1;\n while ( len-- > 0 ) iters[ len ] = arguments[ len + 1 ];\n\n return mergeDeepWithSources(this, iters, merger);\n}\n\nfunction mergeIn(keyPath) {\n var iters = [], len = arguments.length - 1;\n while ( len-- > 0 ) iters[ len ] = arguments[ len + 1 ];\n\n return updateIn$1(this, keyPath, emptyMap(), function (m) { return mergeWithSources(m, iters); });\n}\n\nfunction mergeDeepIn(keyPath) {\n var iters = [], len = arguments.length - 1;\n while ( len-- > 0 ) iters[ len ] = arguments[ len + 1 ];\n\n return updateIn$1(this, keyPath, emptyMap(), function (m) { return mergeDeepWithSources(m, iters); }\n );\n}\n\nfunction withMutations(fn) {\n var mutable = this.asMutable();\n fn(mutable);\n return mutable.wasAltered() ? mutable.__ensureOwner(this.__ownerID) : this;\n}\n\nfunction asMutable() {\n return this.__ownerID ? this : this.__ensureOwner(new OwnerID());\n}\n\nfunction asImmutable() {\n return this.__ensureOwner();\n}\n\nfunction wasAltered() {\n return this.__altered;\n}\n\nvar Map = /*@__PURE__*/(function (KeyedCollection) {\n function Map(value) {\n return value === null || value === undefined\n ? emptyMap()\n : isMap(value) && !isOrdered(value)\n ? value\n : emptyMap().withMutations(function (map) {\n var iter = KeyedCollection(value);\n assertNotInfinite(iter.size);\n iter.forEach(function (v, k) { return map.set(k, v); });\n });\n }\n\n if ( KeyedCollection ) Map.__proto__ = KeyedCollection;\n Map.prototype = Object.create( KeyedCollection && KeyedCollection.prototype );\n Map.prototype.constructor = Map;\n\n Map.of = function of () {\n var keyValues = [], len = arguments.length;\n while ( len-- ) keyValues[ len ] = arguments[ len ];\n\n return emptyMap().withMutations(function (map) {\n for (var i = 0; i < keyValues.length; i += 2) {\n if (i + 1 >= keyValues.length) {\n throw new Error('Missing value for key: ' + keyValues[i]);\n }\n map.set(keyValues[i], keyValues[i + 1]);\n }\n });\n };\n\n Map.prototype.toString = function toString () {\n return this.__toString('Map {', '}');\n };\n\n // @pragma Access\n\n Map.prototype.get = function get (k, notSetValue) {\n return this._root\n ? this._root.get(0, undefined, k, notSetValue)\n : notSetValue;\n };\n\n // @pragma Modification\n\n Map.prototype.set = function set (k, v) {\n return updateMap(this, k, v);\n };\n\n Map.prototype.remove = function remove (k) {\n return updateMap(this, k, NOT_SET);\n };\n\n Map.prototype.deleteAll = function deleteAll (keys) {\n var collection = Collection(keys);\n\n if (collection.size === 0) {\n return this;\n }\n\n return this.withMutations(function (map) {\n collection.forEach(function (key) { return map.remove(key); });\n });\n };\n\n Map.prototype.clear = function clear () {\n if (this.size === 0) {\n return this;\n }\n if (this.__ownerID) {\n this.size = 0;\n this._root = null;\n this.__hash = undefined;\n this.__altered = true;\n return this;\n }\n return emptyMap();\n };\n\n // @pragma Composition\n\n Map.prototype.sort = function sort (comparator) {\n // Late binding\n return OrderedMap(sortFactory(this, comparator));\n };\n\n Map.prototype.sortBy = function sortBy (mapper, comparator) {\n // Late binding\n return OrderedMap(sortFactory(this, comparator, mapper));\n };\n\n Map.prototype.map = function map (mapper, context) {\n var this$1$1 = this;\n\n return this.withMutations(function (map) {\n map.forEach(function (value, key) {\n map.set(key, mapper.call(context, value, key, this$1$1));\n });\n });\n };\n\n // @pragma Mutability\n\n Map.prototype.__iterator = function __iterator (type, reverse) {\n return new MapIterator(this, type, reverse);\n };\n\n Map.prototype.__iterate = function __iterate (fn, reverse) {\n var this$1$1 = this;\n\n var iterations = 0;\n this._root &&\n this._root.iterate(function (entry) {\n iterations++;\n return fn(entry[1], entry[0], this$1$1);\n }, reverse);\n return iterations;\n };\n\n Map.prototype.__ensureOwner = function __ensureOwner (ownerID) {\n if (ownerID === this.__ownerID) {\n return this;\n }\n if (!ownerID) {\n if (this.size === 0) {\n return emptyMap();\n }\n this.__ownerID = ownerID;\n this.__altered = false;\n return this;\n }\n return makeMap(this.size, this._root, ownerID, this.__hash);\n };\n\n return Map;\n}(KeyedCollection));\n\nMap.isMap = isMap;\n\nvar MapPrototype = Map.prototype;\nMapPrototype[IS_MAP_SYMBOL] = true;\nMapPrototype[DELETE] = MapPrototype.remove;\nMapPrototype.removeAll = MapPrototype.deleteAll;\nMapPrototype.setIn = setIn;\nMapPrototype.removeIn = MapPrototype.deleteIn = deleteIn;\nMapPrototype.update = update;\nMapPrototype.updateIn = updateIn;\nMapPrototype.merge = MapPrototype.concat = merge$1;\nMapPrototype.mergeWith = mergeWith$1;\nMapPrototype.mergeDeep = mergeDeep;\nMapPrototype.mergeDeepWith = mergeDeepWith;\nMapPrototype.mergeIn = mergeIn;\nMapPrototype.mergeDeepIn = mergeDeepIn;\nMapPrototype.withMutations = withMutations;\nMapPrototype.wasAltered = wasAltered;\nMapPrototype.asImmutable = asImmutable;\nMapPrototype['@@transducer/init'] = MapPrototype.asMutable = asMutable;\nMapPrototype['@@transducer/step'] = function (result, arr) {\n return result.set(arr[0], arr[1]);\n};\nMapPrototype['@@transducer/result'] = function (obj) {\n return obj.asImmutable();\n};\n\n// #pragma Trie Nodes\n\nvar ArrayMapNode = function ArrayMapNode(ownerID, entries) {\n this.ownerID = ownerID;\n this.entries = entries;\n};\n\nArrayMapNode.prototype.get = function get (shift, keyHash, key, notSetValue) {\n var entries = this.entries;\n for (var ii = 0, len = entries.length; ii < len; ii++) {\n if (is(key, entries[ii][0])) {\n return entries[ii][1];\n }\n }\n return notSetValue;\n};\n\nArrayMapNode.prototype.update = function update (ownerID, shift, keyHash, key, value, didChangeSize, didAlter) {\n var removed = value === NOT_SET;\n\n var entries = this.entries;\n var idx = 0;\n var len = entries.length;\n for (; idx < len; idx++) {\n if (is(key, entries[idx][0])) {\n break;\n }\n }\n var exists = idx < len;\n\n if (exists ? entries[idx][1] === value : removed) {\n return this;\n }\n\n SetRef(didAlter);\n (removed || !exists) && SetRef(didChangeSize);\n\n if (removed && entries.length === 1) {\n return; // undefined\n }\n\n if (!exists && !removed && entries.length >= MAX_ARRAY_MAP_SIZE) {\n return createNodes(ownerID, entries, key, value);\n }\n\n var isEditable = ownerID && ownerID === this.ownerID;\n var newEntries = isEditable ? entries : arrCopy(entries);\n\n if (exists) {\n if (removed) {\n idx === len - 1\n ? newEntries.pop()\n : (newEntries[idx] = newEntries.pop());\n } else {\n newEntries[idx] = [key, value];\n }\n } else {\n newEntries.push([key, value]);\n }\n\n if (isEditable) {\n this.entries = newEntries;\n return this;\n }\n\n return new ArrayMapNode(ownerID, newEntries);\n};\n\nvar BitmapIndexedNode = function BitmapIndexedNode(ownerID, bitmap, nodes) {\n this.ownerID = ownerID;\n this.bitmap = bitmap;\n this.nodes = nodes;\n};\n\nBitmapIndexedNode.prototype.get = function get (shift, keyHash, key, notSetValue) {\n if (keyHash === undefined) {\n keyHash = hash(key);\n }\n var bit = 1 << ((shift === 0 ? keyHash : keyHash >>> shift) & MASK);\n var bitmap = this.bitmap;\n return (bitmap & bit) === 0\n ? notSetValue\n : this.nodes[popCount(bitmap & (bit - 1))].get(\n shift + SHIFT,\n keyHash,\n key,\n notSetValue\n );\n};\n\nBitmapIndexedNode.prototype.update = function update (ownerID, shift, keyHash, key, value, didChangeSize, didAlter) {\n if (keyHash === undefined) {\n keyHash = hash(key);\n }\n var keyHashFrag = (shift === 0 ? keyHash : keyHash >>> shift) & MASK;\n var bit = 1 << keyHashFrag;\n var bitmap = this.bitmap;\n var exists = (bitmap & bit) !== 0;\n\n if (!exists && value === NOT_SET) {\n return this;\n }\n\n var idx = popCount(bitmap & (bit - 1));\n var nodes = this.nodes;\n var node = exists ? nodes[idx] : undefined;\n var newNode = updateNode(\n node,\n ownerID,\n shift + SHIFT,\n keyHash,\n key,\n value,\n didChangeSize,\n didAlter\n );\n\n if (newNode === node) {\n return this;\n }\n\n if (!exists && newNode && nodes.length >= MAX_BITMAP_INDEXED_SIZE) {\n return expandNodes(ownerID, nodes, bitmap, keyHashFrag, newNode);\n }\n\n if (\n exists &&\n !newNode &&\n nodes.length === 2 &&\n isLeafNode(nodes[idx ^ 1])\n ) {\n return nodes[idx ^ 1];\n }\n\n if (exists && newNode && nodes.length === 1 && isLeafNode(newNode)) {\n return newNode;\n }\n\n var isEditable = ownerID && ownerID === this.ownerID;\n var newBitmap = exists ? (newNode ? bitmap : bitmap ^ bit) : bitmap | bit;\n var newNodes = exists\n ? newNode\n ? setAt(nodes, idx, newNode, isEditable)\n : spliceOut(nodes, idx, isEditable)\n : spliceIn(nodes, idx, newNode, isEditable);\n\n if (isEditable) {\n this.bitmap = newBitmap;\n this.nodes = newNodes;\n return this;\n }\n\n return new BitmapIndexedNode(ownerID, newBitmap, newNodes);\n};\n\nvar HashArrayMapNode = function HashArrayMapNode(ownerID, count, nodes) {\n this.ownerID = ownerID;\n this.count = count;\n this.nodes = nodes;\n};\n\nHashArrayMapNode.prototype.get = function get (shift, keyHash, key, notSetValue) {\n if (keyHash === undefined) {\n keyHash = hash(key);\n }\n var idx = (shift === 0 ? keyHash : keyHash >>> shift) & MASK;\n var node = this.nodes[idx];\n return node\n ? node.get(shift + SHIFT, keyHash, key, notSetValue)\n : notSetValue;\n};\n\nHashArrayMapNode.prototype.update = function update (ownerID, shift, keyHash, key, value, didChangeSize, didAlter) {\n if (keyHash === undefined) {\n keyHash = hash(key);\n }\n var idx = (shift === 0 ? keyHash : keyHash >>> shift) & MASK;\n var removed = value === NOT_SET;\n var nodes = this.nodes;\n var node = nodes[idx];\n\n if (removed && !node) {\n return this;\n }\n\n var newNode = updateNode(\n node,\n ownerID,\n shift + SHIFT,\n keyHash,\n key,\n value,\n didChangeSize,\n didAlter\n );\n if (newNode === node) {\n return this;\n }\n\n var newCount = this.count;\n if (!node) {\n newCount++;\n } else if (!newNode) {\n newCount--;\n if (newCount < MIN_HASH_ARRAY_MAP_SIZE) {\n return packNodes(ownerID, nodes, newCount, idx);\n }\n }\n\n var isEditable = ownerID && ownerID === this.ownerID;\n var newNodes = setAt(nodes, idx, newNode, isEditable);\n\n if (isEditable) {\n this.count = newCount;\n this.nodes = newNodes;\n return this;\n }\n\n return new HashArrayMapNode(ownerID, newCount, newNodes);\n};\n\nvar HashCollisionNode = function HashCollisionNode(ownerID, keyHash, entries) {\n this.ownerID = ownerID;\n this.keyHash = keyHash;\n this.entries = entries;\n};\n\nHashCollisionNode.prototype.get = function get (shift, keyHash, key, notSetValue) {\n var entries = this.entries;\n for (var ii = 0, len = entries.length; ii < len; ii++) {\n if (is(key, entries[ii][0])) {\n return entries[ii][1];\n }\n }\n return notSetValue;\n};\n\nHashCollisionNode.prototype.update = function update (ownerID, shift, keyHash, key, value, didChangeSize, didAlter) {\n if (keyHash === undefined) {\n keyHash = hash(key);\n }\n\n var removed = value === NOT_SET;\n\n if (keyHash !== this.keyHash) {\n if (removed) {\n return this;\n }\n SetRef(didAlter);\n SetRef(didChangeSize);\n return mergeIntoNode(this, ownerID, shift, keyHash, [key, value]);\n }\n\n var entries = this.entries;\n var idx = 0;\n var len = entries.length;\n for (; idx < len; idx++) {\n if (is(key, entries[idx][0])) {\n break;\n }\n }\n var exists = idx < len;\n\n if (exists ? entries[idx][1] === value : removed) {\n return this;\n }\n\n SetRef(didAlter);\n (removed || !exists) && SetRef(didChangeSize);\n\n if (removed && len === 2) {\n return new ValueNode(ownerID, this.keyHash, entries[idx ^ 1]);\n }\n\n var isEditable = ownerID && ownerID === this.ownerID;\n var newEntries = isEditable ? entries : arrCopy(entries);\n\n if (exists) {\n if (removed) {\n idx === len - 1\n ? newEntries.pop()\n : (newEntries[idx] = newEntries.pop());\n } else {\n newEntries[idx] = [key, value];\n }\n } else {\n newEntries.push([key, value]);\n }\n\n if (isEditable) {\n this.entries = newEntries;\n return this;\n }\n\n return new HashCollisionNode(ownerID, this.keyHash, newEntries);\n};\n\nvar ValueNode = function ValueNode(ownerID, keyHash, entry) {\n this.ownerID = ownerID;\n this.keyHash = keyHash;\n this.entry = entry;\n};\n\nValueNode.prototype.get = function get (shift, keyHash, key, notSetValue) {\n return is(key, this.entry[0]) ? this.entry[1] : notSetValue;\n};\n\nValueNode.prototype.update = function update (ownerID, shift, keyHash, key, value, didChangeSize, didAlter) {\n var removed = value === NOT_SET;\n var keyMatch = is(key, this.entry[0]);\n if (keyMatch ? value === this.entry[1] : removed) {\n return this;\n }\n\n SetRef(didAlter);\n\n if (removed) {\n SetRef(didChangeSize);\n return; // undefined\n }\n\n if (keyMatch) {\n if (ownerID && ownerID === this.ownerID) {\n this.entry[1] = value;\n return this;\n }\n return new ValueNode(ownerID, this.keyHash, [key, value]);\n }\n\n SetRef(didChangeSize);\n return mergeIntoNode(this, ownerID, shift, hash(key), [key, value]);\n};\n\n// #pragma Iterators\n\nArrayMapNode.prototype.iterate = HashCollisionNode.prototype.iterate =\n function (fn, reverse) {\n var entries = this.entries;\n for (var ii = 0, maxIndex = entries.length - 1; ii <= maxIndex; ii++) {\n if (fn(entries[reverse ? maxIndex - ii : ii]) === false) {\n return false;\n }\n }\n };\n\nBitmapIndexedNode.prototype.iterate = HashArrayMapNode.prototype.iterate =\n function (fn, reverse) {\n var nodes = this.nodes;\n for (var ii = 0, maxIndex = nodes.length - 1; ii <= maxIndex; ii++) {\n var node = nodes[reverse ? maxIndex - ii : ii];\n if (node && node.iterate(fn, reverse) === false) {\n return false;\n }\n }\n };\n\n// eslint-disable-next-line no-unused-vars\nValueNode.prototype.iterate = function (fn, reverse) {\n return fn(this.entry);\n};\n\nvar MapIterator = /*@__PURE__*/(function (Iterator) {\n function MapIterator(map, type, reverse) {\n this._type = type;\n this._reverse = reverse;\n this._stack = map._root && mapIteratorFrame(map._root);\n }\n\n if ( Iterator ) MapIterator.__proto__ = Iterator;\n MapIterator.prototype = Object.create( Iterator && Iterator.prototype );\n MapIterator.prototype.constructor = MapIterator;\n\n MapIterator.prototype.next = function next () {\n var type = this._type;\n var stack = this._stack;\n while (stack) {\n var node = stack.node;\n var index = stack.index++;\n var maxIndex = (void 0);\n if (node.entry) {\n if (index === 0) {\n return mapIteratorValue(type, node.entry);\n }\n } else if (node.entries) {\n maxIndex = node.entries.length - 1;\n if (index <= maxIndex) {\n return mapIteratorValue(\n type,\n node.entries[this._reverse ? maxIndex - index : index]\n );\n }\n } else {\n maxIndex = node.nodes.length - 1;\n if (index <= maxIndex) {\n var subNode = node.nodes[this._reverse ? maxIndex - index : index];\n if (subNode) {\n if (subNode.entry) {\n return mapIteratorValue(type, subNode.entry);\n }\n stack = this._stack = mapIteratorFrame(subNode, stack);\n }\n continue;\n }\n }\n stack = this._stack = this._stack.__prev;\n }\n return iteratorDone();\n };\n\n return MapIterator;\n}(Iterator));\n\nfunction mapIteratorValue(type, entry) {\n return iteratorValue(type, entry[0], entry[1]);\n}\n\nfunction mapIteratorFrame(node, prev) {\n return {\n node: node,\n index: 0,\n __prev: prev,\n };\n}\n\nfunction makeMap(size, root, ownerID, hash) {\n var map = Object.create(MapPrototype);\n map.size = size;\n map._root = root;\n map.__ownerID = ownerID;\n map.__hash = hash;\n map.__altered = false;\n return map;\n}\n\nvar EMPTY_MAP;\nfunction emptyMap() {\n return EMPTY_MAP || (EMPTY_MAP = makeMap(0));\n}\n\nfunction updateMap(map, k, v) {\n var newRoot;\n var newSize;\n if (!map._root) {\n if (v === NOT_SET) {\n return map;\n }\n newSize = 1;\n newRoot = new ArrayMapNode(map.__ownerID, [[k, v]]);\n } else {\n var didChangeSize = MakeRef();\n var didAlter = MakeRef();\n newRoot = updateNode(\n map._root,\n map.__ownerID,\n 0,\n undefined,\n k,\n v,\n didChangeSize,\n didAlter\n );\n if (!didAlter.value) {\n return map;\n }\n newSize = map.size + (didChangeSize.value ? (v === NOT_SET ? -1 : 1) : 0);\n }\n if (map.__ownerID) {\n map.size = newSize;\n map._root = newRoot;\n map.__hash = undefined;\n map.__altered = true;\n return map;\n }\n return newRoot ? makeMap(newSize, newRoot) : emptyMap();\n}\n\nfunction updateNode(\n node,\n ownerID,\n shift,\n keyHash,\n key,\n value,\n didChangeSize,\n didAlter\n) {\n if (!node) {\n if (value === NOT_SET) {\n return node;\n }\n SetRef(didAlter);\n SetRef(didChangeSize);\n return new ValueNode(ownerID, keyHash, [key, value]);\n }\n return node.update(\n ownerID,\n shift,\n keyHash,\n key,\n value,\n didChangeSize,\n didAlter\n );\n}\n\nfunction isLeafNode(node) {\n return (\n node.constructor === ValueNode || node.constructor === HashCollisionNode\n );\n}\n\nfunction mergeIntoNode(node, ownerID, shift, keyHash, entry) {\n if (node.keyHash === keyHash) {\n return new HashCollisionNode(ownerID, keyHash, [node.entry, entry]);\n }\n\n var idx1 = (shift === 0 ? node.keyHash : node.keyHash >>> shift) & MASK;\n var idx2 = (shift === 0 ? keyHash : keyHash >>> shift) & MASK;\n\n var newNode;\n var nodes =\n idx1 === idx2\n ? [mergeIntoNode(node, ownerID, shift + SHIFT, keyHash, entry)]\n : ((newNode = new ValueNode(ownerID, keyHash, entry)),\n idx1 < idx2 ? [node, newNode] : [newNode, node]);\n\n return new BitmapIndexedNode(ownerID, (1 << idx1) | (1 << idx2), nodes);\n}\n\nfunction createNodes(ownerID, entries, key, value) {\n if (!ownerID) {\n ownerID = new OwnerID();\n }\n var node = new ValueNode(ownerID, hash(key), [key, value]);\n for (var ii = 0; ii < entries.length; ii++) {\n var entry = entries[ii];\n node = node.update(ownerID, 0, undefined, entry[0], entry[1]);\n }\n return node;\n}\n\nfunction packNodes(ownerID, nodes, count, excluding) {\n var bitmap = 0;\n var packedII = 0;\n var packedNodes = new Array(count);\n for (var ii = 0, bit = 1, len = nodes.length; ii < len; ii++, bit <<= 1) {\n var node = nodes[ii];\n if (node !== undefined && ii !== excluding) {\n bitmap |= bit;\n packedNodes[packedII++] = node;\n }\n }\n return new BitmapIndexedNode(ownerID, bitmap, packedNodes);\n}\n\nfunction expandNodes(ownerID, nodes, bitmap, including, node) {\n var count = 0;\n var expandedNodes = new Array(SIZE);\n for (var ii = 0; bitmap !== 0; ii++, bitmap >>>= 1) {\n expandedNodes[ii] = bitmap & 1 ? nodes[count++] : undefined;\n }\n expandedNodes[including] = node;\n return new HashArrayMapNode(ownerID, count + 1, expandedNodes);\n}\n\nfunction popCount(x) {\n x -= (x >> 1) & 0x55555555;\n x = (x & 0x33333333) + ((x >> 2) & 0x33333333);\n x = (x + (x >> 4)) & 0x0f0f0f0f;\n x += x >> 8;\n x += x >> 16;\n return x & 0x7f;\n}\n\nfunction setAt(array, idx, val, canEdit) {\n var newArray = canEdit ? array : arrCopy(array);\n newArray[idx] = val;\n return newArray;\n}\n\nfunction spliceIn(array, idx, val, canEdit) {\n var newLen = array.length + 1;\n if (canEdit && idx + 1 === newLen) {\n array[idx] = val;\n return array;\n }\n var newArray = new Array(newLen);\n var after = 0;\n for (var ii = 0; ii < newLen; ii++) {\n if (ii === idx) {\n newArray[ii] = val;\n after = -1;\n } else {\n newArray[ii] = array[ii + after];\n }\n }\n return newArray;\n}\n\nfunction spliceOut(array, idx, canEdit) {\n var newLen = array.length - 1;\n if (canEdit && idx === newLen) {\n array.pop();\n return array;\n }\n var newArray = new Array(newLen);\n var after = 0;\n for (var ii = 0; ii < newLen; ii++) {\n if (ii === idx) {\n after = 1;\n }\n newArray[ii] = array[ii + after];\n }\n return newArray;\n}\n\nvar MAX_ARRAY_MAP_SIZE = SIZE / 4;\nvar MAX_BITMAP_INDEXED_SIZE = SIZE / 2;\nvar MIN_HASH_ARRAY_MAP_SIZE = SIZE / 4;\n\nvar IS_LIST_SYMBOL = '@@__IMMUTABLE_LIST__@@';\n\nfunction isList(maybeList) {\n return Boolean(maybeList && maybeList[IS_LIST_SYMBOL]);\n}\n\nvar List = /*@__PURE__*/(function (IndexedCollection) {\n function List(value) {\n var empty = emptyList();\n if (value === null || value === undefined) {\n return empty;\n }\n if (isList(value)) {\n return value;\n }\n var iter = IndexedCollection(value);\n var size = iter.size;\n if (size === 0) {\n return empty;\n }\n assertNotInfinite(size);\n if (size > 0 && size < SIZE) {\n return makeList(0, size, SHIFT, null, new VNode(iter.toArray()));\n }\n return empty.withMutations(function (list) {\n list.setSize(size);\n iter.forEach(function (v, i) { return list.set(i, v); });\n });\n }\n\n if ( IndexedCollection ) List.__proto__ = IndexedCollection;\n List.prototype = Object.create( IndexedCollection && IndexedCollection.prototype );\n List.prototype.constructor = List;\n\n List.of = function of (/*...values*/) {\n return this(arguments);\n };\n\n List.prototype.toString = function toString () {\n return this.__toString('List [', ']');\n };\n\n // @pragma Access\n\n List.prototype.get = function get (index, notSetValue) {\n index = wrapIndex(this, index);\n if (index >= 0 && index < this.size) {\n index += this._origin;\n var node = listNodeFor(this, index);\n return node && node.array[index & MASK];\n }\n return notSetValue;\n };\n\n // @pragma Modification\n\n List.prototype.set = function set (index, value) {\n return updateList(this, index, value);\n };\n\n List.prototype.remove = function remove (index) {\n return !this.has(index)\n ? this\n : index === 0\n ? this.shift()\n : index === this.size - 1\n ? this.pop()\n : this.splice(index, 1);\n };\n\n List.prototype.insert = function insert (index, value) {\n return this.splice(index, 0, value);\n };\n\n List.prototype.clear = function clear () {\n if (this.size === 0) {\n return this;\n }\n if (this.__ownerID) {\n this.size = this._origin = this._capacity = 0;\n this._level = SHIFT;\n this._root = this._tail = this.__hash = undefined;\n this.__altered = true;\n return this;\n }\n return emptyList();\n };\n\n List.prototype.push = function push (/*...values*/) {\n var values = arguments;\n var oldSize = this.size;\n return this.withMutations(function (list) {\n setListBounds(list, 0, oldSize + values.length);\n for (var ii = 0; ii < values.length; ii++) {\n list.set(oldSize + ii, values[ii]);\n }\n });\n };\n\n List.prototype.pop = function pop () {\n return setListBounds(this, 0, -1);\n };\n\n List.prototype.unshift = function unshift (/*...values*/) {\n var values = arguments;\n return this.withMutations(function (list) {\n setListBounds(list, -values.length);\n for (var ii = 0; ii < values.length; ii++) {\n list.set(ii, values[ii]);\n }\n });\n };\n\n List.prototype.shift = function shift () {\n return setListBounds(this, 1);\n };\n\n // @pragma Composition\n\n List.prototype.concat = function concat (/*...collections*/) {\n var arguments$1 = arguments;\n\n var seqs = [];\n for (var i = 0; i < arguments.length; i++) {\n var argument = arguments$1[i];\n var seq = IndexedCollection(\n typeof argument !== 'string' && hasIterator(argument)\n ? argument\n : [argument]\n );\n if (seq.size !== 0) {\n seqs.push(seq);\n }\n }\n if (seqs.length === 0) {\n return this;\n }\n if (this.size === 0 && !this.__ownerID && seqs.length === 1) {\n return this.constructor(seqs[0]);\n }\n return this.withMutations(function (list) {\n seqs.forEach(function (seq) { return seq.forEach(function (value) { return list.push(value); }); });\n });\n };\n\n List.prototype.setSize = function setSize (size) {\n return setListBounds(this, 0, size);\n };\n\n List.prototype.map = function map (mapper, context) {\n var this$1$1 = this;\n\n return this.withMutations(function (list) {\n for (var i = 0; i < this$1$1.size; i++) {\n list.set(i, mapper.call(context, list.get(i), i, this$1$1));\n }\n });\n };\n\n // @pragma Iteration\n\n List.prototype.slice = function slice (begin, end) {\n var size = this.size;\n if (wholeSlice(begin, end, size)) {\n return this;\n }\n return setListBounds(\n this,\n resolveBegin(begin, size),\n resolveEnd(end, size)\n );\n };\n\n List.prototype.__iterator = function __iterator (type, reverse) {\n var index = reverse ? this.size : 0;\n var values = iterateList(this, reverse);\n return new Iterator(function () {\n var value = values();\n return value === DONE\n ? iteratorDone()\n : iteratorValue(type, reverse ? --index : index++, value);\n });\n };\n\n List.prototype.__iterate = function __iterate (fn, reverse) {\n var index = reverse ? this.size : 0;\n var values = iterateList(this, reverse);\n var value;\n while ((value = values()) !== DONE) {\n if (fn(value, reverse ? --index : index++, this) === false) {\n break;\n }\n }\n return index;\n };\n\n List.prototype.__ensureOwner = function __ensureOwner (ownerID) {\n if (ownerID === this.__ownerID) {\n return this;\n }\n if (!ownerID) {\n if (this.size === 0) {\n return emptyList();\n }\n this.__ownerID = ownerID;\n this.__altered = false;\n return this;\n }\n return makeList(\n this._origin,\n this._capacity,\n this._level,\n this._root,\n this._tail,\n ownerID,\n this.__hash\n );\n };\n\n return List;\n}(IndexedCollection));\n\nList.isList = isList;\n\nvar ListPrototype = List.prototype;\nListPrototype[IS_LIST_SYMBOL] = true;\nListPrototype[DELETE] = ListPrototype.remove;\nListPrototype.merge = ListPrototype.concat;\nListPrototype.setIn = setIn;\nListPrototype.deleteIn = ListPrototype.removeIn = deleteIn;\nListPrototype.update = update;\nListPrototype.updateIn = updateIn;\nListPrototype.mergeIn = mergeIn;\nListPrototype.mergeDeepIn = mergeDeepIn;\nListPrototype.withMutations = withMutations;\nListPrototype.wasAltered = wasAltered;\nListPrototype.asImmutable = asImmutable;\nListPrototype['@@transducer/init'] = ListPrototype.asMutable = asMutable;\nListPrototype['@@transducer/step'] = function (result, arr) {\n return result.push(arr);\n};\nListPrototype['@@transducer/result'] = function (obj) {\n return obj.asImmutable();\n};\n\nvar VNode = function VNode(array, ownerID) {\n this.array = array;\n this.ownerID = ownerID;\n};\n\n// TODO: seems like these methods are very similar\n\nVNode.prototype.removeBefore = function removeBefore (ownerID, level, index) {\n if (index === level ? 1 << level : this.array.length === 0) {\n return this;\n }\n var originIndex = (index >>> level) & MASK;\n if (originIndex >= this.array.length) {\n return new VNode([], ownerID);\n }\n var removingFirst = originIndex === 0;\n var newChild;\n if (level > 0) {\n var oldChild = this.array[originIndex];\n newChild =\n oldChild && oldChild.removeBefore(ownerID, level - SHIFT, index);\n if (newChild === oldChild && removingFirst) {\n return this;\n }\n }\n if (removingFirst && !newChild) {\n return this;\n }\n var editable = editableVNode(this, ownerID);\n if (!removingFirst) {\n for (var ii = 0; ii < originIndex; ii++) {\n editable.array[ii] = undefined;\n }\n }\n if (newChild) {\n editable.array[originIndex] = newChild;\n }\n return editable;\n};\n\nVNode.prototype.removeAfter = function removeAfter (ownerID, level, index) {\n if (index === (level ? 1 << level : 0) || this.array.length === 0) {\n return this;\n }\n var sizeIndex = ((index - 1) >>> level) & MASK;\n if (sizeIndex >= this.array.length) {\n return this;\n }\n\n var newChild;\n if (level > 0) {\n var oldChild = this.array[sizeIndex];\n newChild =\n oldChild && oldChild.removeAfter(ownerID, level - SHIFT, index);\n if (newChild === oldChild && sizeIndex === this.array.length - 1) {\n return this;\n }\n }\n\n var editable = editableVNode(this, ownerID);\n editable.array.splice(sizeIndex + 1);\n if (newChild) {\n editable.array[sizeIndex] = newChild;\n }\n return editable;\n};\n\nvar DONE = {};\n\nfunction iterateList(list, reverse) {\n var left = list._origin;\n var right = list._capacity;\n var tailPos = getTailOffset(right);\n var tail = list._tail;\n\n return iterateNodeOrLeaf(list._root, list._level, 0);\n\n function iterateNodeOrLeaf(node, level, offset) {\n return level === 0\n ? iterateLeaf(node, offset)\n : iterateNode(node, level, offset);\n }\n\n function iterateLeaf(node, offset) {\n var array = offset === tailPos ? tail && tail.array : node && node.array;\n var from = offset > left ? 0 : left - offset;\n var to = right - offset;\n if (to > SIZE) {\n to = SIZE;\n }\n return function () {\n if (from === to) {\n return DONE;\n }\n var idx = reverse ? --to : from++;\n return array && array[idx];\n };\n }\n\n function iterateNode(node, level, offset) {\n var values;\n var array = node && node.array;\n var from = offset > left ? 0 : (left - offset) >> level;\n var to = ((right - offset) >> level) + 1;\n if (to > SIZE) {\n to = SIZE;\n }\n return function () {\n while (true) {\n if (values) {\n var value = values();\n if (value !== DONE) {\n return value;\n }\n values = null;\n }\n if (from === to) {\n return DONE;\n }\n var idx = reverse ? --to : from++;\n values = iterateNodeOrLeaf(\n array && array[idx],\n level - SHIFT,\n offset + (idx << level)\n );\n }\n };\n }\n}\n\nfunction makeList(origin, capacity, level, root, tail, ownerID, hash) {\n var list = Object.create(ListPrototype);\n list.size = capacity - origin;\n list._origin = origin;\n list._capacity = capacity;\n list._level = level;\n list._root = root;\n list._tail = tail;\n list.__ownerID = ownerID;\n list.__hash = hash;\n list.__altered = false;\n return list;\n}\n\nvar EMPTY_LIST;\nfunction emptyList() {\n return EMPTY_LIST || (EMPTY_LIST = makeList(0, 0, SHIFT));\n}\n\nfunction updateList(list, index, value) {\n index = wrapIndex(list, index);\n\n if (index !== index) {\n return list;\n }\n\n if (index >= list.size || index < 0) {\n return list.withMutations(function (list) {\n index < 0\n ? setListBounds(list, index).set(0, value)\n : setListBounds(list, 0, index + 1).set(index, value);\n });\n }\n\n index += list._origin;\n\n var newTail = list._tail;\n var newRoot = list._root;\n var didAlter = MakeRef();\n if (index >= getTailOffset(list._capacity)) {\n newTail = updateVNode(newTail, list.__ownerID, 0, index, value, didAlter);\n } else {\n newRoot = updateVNode(\n newRoot,\n list.__ownerID,\n list._level,\n index,\n value,\n didAlter\n );\n }\n\n if (!didAlter.value) {\n return list;\n }\n\n if (list.__ownerID) {\n list._root = newRoot;\n list._tail = newTail;\n list.__hash = undefined;\n list.__altered = true;\n return list;\n }\n return makeList(list._origin, list._capacity, list._level, newRoot, newTail);\n}\n\nfunction updateVNode(node, ownerID, level, index, value, didAlter) {\n var idx = (index >>> level) & MASK;\n var nodeHas = node && idx < node.array.length;\n if (!nodeHas && value === undefined) {\n return node;\n }\n\n var newNode;\n\n if (level > 0) {\n var lowerNode = node && node.array[idx];\n var newLowerNode = updateVNode(\n lowerNode,\n ownerID,\n level - SHIFT,\n index,\n value,\n didAlter\n );\n if (newLowerNode === lowerNode) {\n return node;\n }\n newNode = editableVNode(node, ownerID);\n newNode.array[idx] = newLowerNode;\n return newNode;\n }\n\n if (nodeHas && node.array[idx] === value) {\n return node;\n }\n\n if (didAlter) {\n SetRef(didAlter);\n }\n\n newNode = editableVNode(node, ownerID);\n if (value === undefined && idx === newNode.array.length - 1) {\n newNode.array.pop();\n } else {\n newNode.array[idx] = value;\n }\n return newNode;\n}\n\nfunction editableVNode(node, ownerID) {\n if (ownerID && node && ownerID === node.ownerID) {\n return node;\n }\n return new VNode(node ? node.array.slice() : [], ownerID);\n}\n\nfunction listNodeFor(list, rawIndex) {\n if (rawIndex >= getTailOffset(list._capacity)) {\n return list._tail;\n }\n if (rawIndex < 1 << (list._level + SHIFT)) {\n var node = list._root;\n var level = list._level;\n while (node && level > 0) {\n node = node.array[(rawIndex >>> level) & MASK];\n level -= SHIFT;\n }\n return node;\n }\n}\n\nfunction setListBounds(list, begin, end) {\n // Sanitize begin & end using this shorthand for ToInt32(argument)\n // http://www.ecma-international.org/ecma-262/6.0/#sec-toint32\n if (begin !== undefined) {\n begin |= 0;\n }\n if (end !== undefined) {\n end |= 0;\n }\n var owner = list.__ownerID || new OwnerID();\n var oldOrigin = list._origin;\n var oldCapacity = list._capacity;\n var newOrigin = oldOrigin + begin;\n var newCapacity =\n end === undefined\n ? oldCapacity\n : end < 0\n ? oldCapacity + end\n : oldOrigin + end;\n if (newOrigin === oldOrigin && newCapacity === oldCapacity) {\n return list;\n }\n\n // If it's going to end after it starts, it's empty.\n if (newOrigin >= newCapacity) {\n return list.clear();\n }\n\n var newLevel = list._level;\n var newRoot = list._root;\n\n // New origin might need creating a higher root.\n var offsetShift = 0;\n while (newOrigin + offsetShift < 0) {\n newRoot = new VNode(\n newRoot && newRoot.array.length ? [undefined, newRoot] : [],\n owner\n );\n newLevel += SHIFT;\n offsetShift += 1 << newLevel;\n }\n if (offsetShift) {\n newOrigin += offsetShift;\n oldOrigin += offsetShift;\n newCapacity += offsetShift;\n oldCapacity += offsetShift;\n }\n\n var oldTailOffset = getTailOffset(oldCapacity);\n var newTailOffset = getTailOffset(newCapacity);\n\n // New size might need creating a higher root.\n while (newTailOffset >= 1 << (newLevel + SHIFT)) {\n newRoot = new VNode(\n newRoot && newRoot.array.length ? [newRoot] : [],\n owner\n );\n newLevel += SHIFT;\n }\n\n // Locate or create the new tail.\n var oldTail = list._tail;\n var newTail =\n newTailOffset < oldTailOffset\n ? listNodeFor(list, newCapacity - 1)\n : newTailOffset > oldTailOffset\n ? new VNode([], owner)\n : oldTail;\n\n // Merge Tail into tree.\n if (\n oldTail &&\n newTailOffset > oldTailOffset &&\n newOrigin < oldCapacity &&\n oldTail.array.length\n ) {\n newRoot = editableVNode(newRoot, owner);\n var node = newRoot;\n for (var level = newLevel; level > SHIFT; level -= SHIFT) {\n var idx = (oldTailOffset >>> level) & MASK;\n node = node.array[idx] = editableVNode(node.array[idx], owner);\n }\n node.array[(oldTailOffset >>> SHIFT) & MASK] = oldTail;\n }\n\n // If the size has been reduced, there's a chance the tail needs to be trimmed.\n if (newCapacity < oldCapacity) {\n newTail = newTail && newTail.removeAfter(owner, 0, newCapacity);\n }\n\n // If the new origin is within the tail, then we do not need a root.\n if (newOrigin >= newTailOffset) {\n newOrigin -= newTailOffset;\n newCapacity -= newTailOffset;\n newLevel = SHIFT;\n newRoot = null;\n newTail = newTail && newTail.removeBefore(owner, 0, newOrigin);\n\n // Otherwise, if the root has been trimmed, garbage collect.\n } else if (newOrigin > oldOrigin || newTailOffset < oldTailOffset) {\n offsetShift = 0;\n\n // Identify the new top root node of the subtree of the old root.\n while (newRoot) {\n var beginIndex = (newOrigin >>> newLevel) & MASK;\n if ((beginIndex !== newTailOffset >>> newLevel) & MASK) {\n break;\n }\n if (beginIndex) {\n offsetShift += (1 << newLevel) * beginIndex;\n }\n newLevel -= SHIFT;\n newRoot = newRoot.array[beginIndex];\n }\n\n // Trim the new sides of the new root.\n if (newRoot && newOrigin > oldOrigin) {\n newRoot = newRoot.removeBefore(owner, newLevel, newOrigin - offsetShift);\n }\n if (newRoot && newTailOffset < oldTailOffset) {\n newRoot = newRoot.removeAfter(\n owner,\n newLevel,\n newTailOffset - offsetShift\n );\n }\n if (offsetShift) {\n newOrigin -= offsetShift;\n newCapacity -= offsetShift;\n }\n }\n\n if (list.__ownerID) {\n list.size = newCapacity - newOrigin;\n list._origin = newOrigin;\n list._capacity = newCapacity;\n list._level = newLevel;\n list._root = newRoot;\n list._tail = newTail;\n list.__hash = undefined;\n list.__altered = true;\n return list;\n }\n return makeList(newOrigin, newCapacity, newLevel, newRoot, newTail);\n}\n\nfunction getTailOffset(size) {\n return size < SIZE ? 0 : ((size - 1) >>> SHIFT) << SHIFT;\n}\n\nvar OrderedMap = /*@__PURE__*/(function (Map) {\n function OrderedMap(value) {\n return value === null || value === undefined\n ? emptyOrderedMap()\n : isOrderedMap(value)\n ? value\n : emptyOrderedMap().withMutations(function (map) {\n var iter = KeyedCollection(value);\n assertNotInfinite(iter.size);\n iter.forEach(function (v, k) { return map.set(k, v); });\n });\n }\n\n if ( Map ) OrderedMap.__proto__ = Map;\n OrderedMap.prototype = Object.create( Map && Map.prototype );\n OrderedMap.prototype.constructor = OrderedMap;\n\n OrderedMap.of = function of (/*...values*/) {\n return this(arguments);\n };\n\n OrderedMap.prototype.toString = function toString () {\n return this.__toString('OrderedMap {', '}');\n };\n\n // @pragma Access\n\n OrderedMap.prototype.get = function get (k, notSetValue) {\n var index = this._map.get(k);\n return index !== undefined ? this._list.get(index)[1] : notSetValue;\n };\n\n // @pragma Modification\n\n OrderedMap.prototype.clear = function clear () {\n if (this.size === 0) {\n return this;\n }\n if (this.__ownerID) {\n this.size = 0;\n this._map.clear();\n this._list.clear();\n this.__altered = true;\n return this;\n }\n return emptyOrderedMap();\n };\n\n OrderedMap.prototype.set = function set (k, v) {\n return updateOrderedMap(this, k, v);\n };\n\n OrderedMap.prototype.remove = function remove (k) {\n return updateOrderedMap(this, k, NOT_SET);\n };\n\n OrderedMap.prototype.__iterate = function __iterate (fn, reverse) {\n var this$1$1 = this;\n\n return this._list.__iterate(\n function (entry) { return entry && fn(entry[1], entry[0], this$1$1); },\n reverse\n );\n };\n\n OrderedMap.prototype.__iterator = function __iterator (type, reverse) {\n return this._list.fromEntrySeq().__iterator(type, reverse);\n };\n\n OrderedMap.prototype.__ensureOwner = function __ensureOwner (ownerID) {\n if (ownerID === this.__ownerID) {\n return this;\n }\n var newMap = this._map.__ensureOwner(ownerID);\n var newList = this._list.__ensureOwner(ownerID);\n if (!ownerID) {\n if (this.size === 0) {\n return emptyOrderedMap();\n }\n this.__ownerID = ownerID;\n this.__altered = false;\n this._map = newMap;\n this._list = newList;\n return this;\n }\n return makeOrderedMap(newMap, newList, ownerID, this.__hash);\n };\n\n return OrderedMap;\n}(Map));\n\nOrderedMap.isOrderedMap = isOrderedMap;\n\nOrderedMap.prototype[IS_ORDERED_SYMBOL] = true;\nOrderedMap.prototype[DELETE] = OrderedMap.prototype.remove;\n\nfunction makeOrderedMap(map, list, ownerID, hash) {\n var omap = Object.create(OrderedMap.prototype);\n omap.size = map ? map.size : 0;\n omap._map = map;\n omap._list = list;\n omap.__ownerID = ownerID;\n omap.__hash = hash;\n omap.__altered = false;\n return omap;\n}\n\nvar EMPTY_ORDERED_MAP;\nfunction emptyOrderedMap() {\n return (\n EMPTY_ORDERED_MAP ||\n (EMPTY_ORDERED_MAP = makeOrderedMap(emptyMap(), emptyList()))\n );\n}\n\nfunction updateOrderedMap(omap, k, v) {\n var map = omap._map;\n var list = omap._list;\n var i = map.get(k);\n var has = i !== undefined;\n var newMap;\n var newList;\n if (v === NOT_SET) {\n // removed\n if (!has) {\n return omap;\n }\n if (list.size >= SIZE && list.size >= map.size * 2) {\n newList = list.filter(function (entry, idx) { return entry !== undefined && i !== idx; });\n newMap = newList\n .toKeyedSeq()\n .map(function (entry) { return entry[0]; })\n .flip()\n .toMap();\n if (omap.__ownerID) {\n newMap.__ownerID = newList.__ownerID = omap.__ownerID;\n }\n } else {\n newMap = map.remove(k);\n newList = i === list.size - 1 ? list.pop() : list.set(i, undefined);\n }\n } else if (has) {\n if (v === list.get(i)[1]) {\n return omap;\n }\n newMap = map;\n newList = list.set(i, [k, v]);\n } else {\n newMap = map.set(k, list.size);\n newList = list.set(list.size, [k, v]);\n }\n if (omap.__ownerID) {\n omap.size = newMap.size;\n omap._map = newMap;\n omap._list = newList;\n omap.__hash = undefined;\n omap.__altered = true;\n return omap;\n }\n return makeOrderedMap(newMap, newList);\n}\n\nvar IS_STACK_SYMBOL = '@@__IMMUTABLE_STACK__@@';\n\nfunction isStack(maybeStack) {\n return Boolean(maybeStack && maybeStack[IS_STACK_SYMBOL]);\n}\n\nvar Stack = /*@__PURE__*/(function (IndexedCollection) {\n function Stack(value) {\n return value === null || value === undefined\n ? emptyStack()\n : isStack(value)\n ? value\n : emptyStack().pushAll(value);\n }\n\n if ( IndexedCollection ) Stack.__proto__ = IndexedCollection;\n Stack.prototype = Object.create( IndexedCollection && IndexedCollection.prototype );\n Stack.prototype.constructor = Stack;\n\n Stack.of = function of (/*...values*/) {\n return this(arguments);\n };\n\n Stack.prototype.toString = function toString () {\n return this.__toString('Stack [', ']');\n };\n\n // @pragma Access\n\n Stack.prototype.get = function get (index, notSetValue) {\n var head = this._head;\n index = wrapIndex(this, index);\n while (head && index--) {\n head = head.next;\n }\n return head ? head.value : notSetValue;\n };\n\n Stack.prototype.peek = function peek () {\n return this._head && this._head.value;\n };\n\n // @pragma Modification\n\n Stack.prototype.push = function push (/*...values*/) {\n var arguments$1 = arguments;\n\n if (arguments.length === 0) {\n return this;\n }\n var newSize = this.size + arguments.length;\n var head = this._head;\n for (var ii = arguments.length - 1; ii >= 0; ii--) {\n head = {\n value: arguments$1[ii],\n next: head,\n };\n }\n if (this.__ownerID) {\n this.size = newSize;\n this._head = head;\n this.__hash = undefined;\n this.__altered = true;\n return this;\n }\n return makeStack(newSize, head);\n };\n\n Stack.prototype.pushAll = function pushAll (iter) {\n iter = IndexedCollection(iter);\n if (iter.size === 0) {\n return this;\n }\n if (this.size === 0 && isStack(iter)) {\n return iter;\n }\n assertNotInfinite(iter.size);\n var newSize = this.size;\n var head = this._head;\n iter.__iterate(function (value) {\n newSize++;\n head = {\n value: value,\n next: head,\n };\n }, /* reverse */ true);\n if (this.__ownerID) {\n this.size = newSize;\n this._head = head;\n this.__hash = undefined;\n this.__altered = true;\n return this;\n }\n return makeStack(newSize, head);\n };\n\n Stack.prototype.pop = function pop () {\n return this.slice(1);\n };\n\n Stack.prototype.clear = function clear () {\n if (this.size === 0) {\n return this;\n }\n if (this.__ownerID) {\n this.size = 0;\n this._head = undefined;\n this.__hash = undefined;\n this.__altered = true;\n return this;\n }\n return emptyStack();\n };\n\n Stack.prototype.slice = function slice (begin, end) {\n if (wholeSlice(begin, end, this.size)) {\n return this;\n }\n var resolvedBegin = resolveBegin(begin, this.size);\n var resolvedEnd = resolveEnd(end, this.size);\n if (resolvedEnd !== this.size) {\n // super.slice(begin, end);\n return IndexedCollection.prototype.slice.call(this, begin, end);\n }\n var newSize = this.size - resolvedBegin;\n var head = this._head;\n while (resolvedBegin--) {\n head = head.next;\n }\n if (this.__ownerID) {\n this.size = newSize;\n this._head = head;\n this.__hash = undefined;\n this.__altered = true;\n return this;\n }\n return makeStack(newSize, head);\n };\n\n // @pragma Mutability\n\n Stack.prototype.__ensureOwner = function __ensureOwner (ownerID) {\n if (ownerID === this.__ownerID) {\n return this;\n }\n if (!ownerID) {\n if (this.size === 0) {\n return emptyStack();\n }\n this.__ownerID = ownerID;\n this.__altered = false;\n return this;\n }\n return makeStack(this.size, this._head, ownerID, this.__hash);\n };\n\n // @pragma Iteration\n\n Stack.prototype.__iterate = function __iterate (fn, reverse) {\n var this$1$1 = this;\n\n if (reverse) {\n return new ArraySeq(this.toArray()).__iterate(\n function (v, k) { return fn(v, k, this$1$1); },\n reverse\n );\n }\n var iterations = 0;\n var node = this._head;\n while (node) {\n if (fn(node.value, iterations++, this) === false) {\n break;\n }\n node = node.next;\n }\n return iterations;\n };\n\n Stack.prototype.__iterator = function __iterator (type, reverse) {\n if (reverse) {\n return new ArraySeq(this.toArray()).__iterator(type, reverse);\n }\n var iterations = 0;\n var node = this._head;\n return new Iterator(function () {\n if (node) {\n var value = node.value;\n node = node.next;\n return iteratorValue(type, iterations++, value);\n }\n return iteratorDone();\n });\n };\n\n return Stack;\n}(IndexedCollection));\n\nStack.isStack = isStack;\n\nvar StackPrototype = Stack.prototype;\nStackPrototype[IS_STACK_SYMBOL] = true;\nStackPrototype.shift = StackPrototype.pop;\nStackPrototype.unshift = StackPrototype.push;\nStackPrototype.unshiftAll = StackPrototype.pushAll;\nStackPrototype.withMutations = withMutations;\nStackPrototype.wasAltered = wasAltered;\nStackPrototype.asImmutable = asImmutable;\nStackPrototype['@@transducer/init'] = StackPrototype.asMutable = asMutable;\nStackPrototype['@@transducer/step'] = function (result, arr) {\n return result.unshift(arr);\n};\nStackPrototype['@@transducer/result'] = function (obj) {\n return obj.asImmutable();\n};\n\nfunction makeStack(size, head, ownerID, hash) {\n var map = Object.create(StackPrototype);\n map.size = size;\n map._head = head;\n map.__ownerID = ownerID;\n map.__hash = hash;\n map.__altered = false;\n return map;\n}\n\nvar EMPTY_STACK;\nfunction emptyStack() {\n return EMPTY_STACK || (EMPTY_STACK = makeStack(0));\n}\n\nvar IS_SET_SYMBOL = '@@__IMMUTABLE_SET__@@';\n\nfunction isSet(maybeSet) {\n return Boolean(maybeSet && maybeSet[IS_SET_SYMBOL]);\n}\n\nfunction isOrderedSet(maybeOrderedSet) {\n return isSet(maybeOrderedSet) && isOrdered(maybeOrderedSet);\n}\n\nfunction deepEqual(a, b) {\n if (a === b) {\n return true;\n }\n\n if (\n !isCollection(b) ||\n (a.size !== undefined && b.size !== undefined && a.size !== b.size) ||\n (a.__hash !== undefined &&\n b.__hash !== undefined &&\n a.__hash !== b.__hash) ||\n isKeyed(a) !== isKeyed(b) ||\n isIndexed(a) !== isIndexed(b) ||\n isOrdered(a) !== isOrdered(b)\n ) {\n return false;\n }\n\n if (a.size === 0 && b.size === 0) {\n return true;\n }\n\n var notAssociative = !isAssociative(a);\n\n if (isOrdered(a)) {\n var entries = a.entries();\n return (\n b.every(function (v, k) {\n var entry = entries.next().value;\n return entry && is(entry[1], v) && (notAssociative || is(entry[0], k));\n }) && entries.next().done\n );\n }\n\n var flipped = false;\n\n if (a.size === undefined) {\n if (b.size === undefined) {\n if (typeof a.cacheResult === 'function') {\n a.cacheResult();\n }\n } else {\n flipped = true;\n var _ = a;\n a = b;\n b = _;\n }\n }\n\n var allEqual = true;\n var bSize = b.__iterate(function (v, k) {\n if (\n notAssociative\n ? !a.has(v)\n : flipped\n ? !is(v, a.get(k, NOT_SET))\n : !is(a.get(k, NOT_SET), v)\n ) {\n allEqual = false;\n return false;\n }\n });\n\n return allEqual && a.size === bSize;\n}\n\nfunction mixin(ctor, methods) {\n var keyCopier = function (key) {\n ctor.prototype[key] = methods[key];\n };\n Object.keys(methods).forEach(keyCopier);\n Object.getOwnPropertySymbols &&\n Object.getOwnPropertySymbols(methods).forEach(keyCopier);\n return ctor;\n}\n\nfunction toJS(value) {\n if (!value || typeof value !== 'object') {\n return value;\n }\n if (!isCollection(value)) {\n if (!isDataStructure(value)) {\n return value;\n }\n value = Seq(value);\n }\n if (isKeyed(value)) {\n var result$1 = {};\n value.__iterate(function (v, k) {\n result$1[k] = toJS(v);\n });\n return result$1;\n }\n var result = [];\n value.__iterate(function (v) {\n result.push(toJS(v));\n });\n return result;\n}\n\nvar Set = /*@__PURE__*/(function (SetCollection) {\n function Set(value) {\n return value === null || value === undefined\n ? emptySet()\n : isSet(value) && !isOrdered(value)\n ? value\n : emptySet().withMutations(function (set) {\n var iter = SetCollection(value);\n assertNotInfinite(iter.size);\n iter.forEach(function (v) { return set.add(v); });\n });\n }\n\n if ( SetCollection ) Set.__proto__ = SetCollection;\n Set.prototype = Object.create( SetCollection && SetCollection.prototype );\n Set.prototype.constructor = Set;\n\n Set.of = function of (/*...values*/) {\n return this(arguments);\n };\n\n Set.fromKeys = function fromKeys (value) {\n return this(KeyedCollection(value).keySeq());\n };\n\n Set.intersect = function intersect (sets) {\n sets = Collection(sets).toArray();\n return sets.length\n ? SetPrototype.intersect.apply(Set(sets.pop()), sets)\n : emptySet();\n };\n\n Set.union = function union (sets) {\n sets = Collection(sets).toArray();\n return sets.length\n ? SetPrototype.union.apply(Set(sets.pop()), sets)\n : emptySet();\n };\n\n Set.prototype.toString = function toString () {\n return this.__toString('Set {', '}');\n };\n\n // @pragma Access\n\n Set.prototype.has = function has (value) {\n return this._map.has(value);\n };\n\n // @pragma Modification\n\n Set.prototype.add = function add (value) {\n return updateSet(this, this._map.set(value, value));\n };\n\n Set.prototype.remove = function remove (value) {\n return updateSet(this, this._map.remove(value));\n };\n\n Set.prototype.clear = function clear () {\n return updateSet(this, this._map.clear());\n };\n\n // @pragma Composition\n\n Set.prototype.map = function map (mapper, context) {\n var this$1$1 = this;\n\n // keep track if the set is altered by the map function\n var didChanges = false;\n\n var newMap = updateSet(\n this,\n this._map.mapEntries(function (ref) {\n var v = ref[1];\n\n var mapped = mapper.call(context, v, v, this$1$1);\n\n if (mapped !== v) {\n didChanges = true;\n }\n\n return [mapped, mapped];\n }, context)\n );\n\n return didChanges ? newMap : this;\n };\n\n Set.prototype.union = function union () {\n var iters = [], len = arguments.length;\n while ( len-- ) iters[ len ] = arguments[ len ];\n\n iters = iters.filter(function (x) { return x.size !== 0; });\n if (iters.length === 0) {\n return this;\n }\n if (this.size === 0 && !this.__ownerID && iters.length === 1) {\n return this.constructor(iters[0]);\n }\n return this.withMutations(function (set) {\n for (var ii = 0; ii < iters.length; ii++) {\n SetCollection(iters[ii]).forEach(function (value) { return set.add(value); });\n }\n });\n };\n\n Set.prototype.intersect = function intersect () {\n var iters = [], len = arguments.length;\n while ( len-- ) iters[ len ] = arguments[ len ];\n\n if (iters.length === 0) {\n return this;\n }\n iters = iters.map(function (iter) { return SetCollection(iter); });\n var toRemove = [];\n this.forEach(function (value) {\n if (!iters.every(function (iter) { return iter.includes(value); })) {\n toRemove.push(value);\n }\n });\n return this.withMutations(function (set) {\n toRemove.forEach(function (value) {\n set.remove(value);\n });\n });\n };\n\n Set.prototype.subtract = function subtract () {\n var iters = [], len = arguments.length;\n while ( len-- ) iters[ len ] = arguments[ len ];\n\n if (iters.length === 0) {\n return this;\n }\n iters = iters.map(function (iter) { return SetCollection(iter); });\n var toRemove = [];\n this.forEach(function (value) {\n if (iters.some(function (iter) { return iter.includes(value); })) {\n toRemove.push(value);\n }\n });\n return this.withMutations(function (set) {\n toRemove.forEach(function (value) {\n set.remove(value);\n });\n });\n };\n\n Set.prototype.sort = function sort (comparator) {\n // Late binding\n return OrderedSet(sortFactory(this, comparator));\n };\n\n Set.prototype.sortBy = function sortBy (mapper, comparator) {\n // Late binding\n return OrderedSet(sortFactory(this, comparator, mapper));\n };\n\n Set.prototype.wasAltered = function wasAltered () {\n return this._map.wasAltered();\n };\n\n Set.prototype.__iterate = function __iterate (fn, reverse) {\n var this$1$1 = this;\n\n return this._map.__iterate(function (k) { return fn(k, k, this$1$1); }, reverse);\n };\n\n Set.prototype.__iterator = function __iterator (type, reverse) {\n return this._map.__iterator(type, reverse);\n };\n\n Set.prototype.__ensureOwner = function __ensureOwner (ownerID) {\n if (ownerID === this.__ownerID) {\n return this;\n }\n var newMap = this._map.__ensureOwner(ownerID);\n if (!ownerID) {\n if (this.size === 0) {\n return this.__empty();\n }\n this.__ownerID = ownerID;\n this._map = newMap;\n return this;\n }\n return this.__make(newMap, ownerID);\n };\n\n return Set;\n}(SetCollection));\n\nSet.isSet = isSet;\n\nvar SetPrototype = Set.prototype;\nSetPrototype[IS_SET_SYMBOL] = true;\nSetPrototype[DELETE] = SetPrototype.remove;\nSetPrototype.merge = SetPrototype.concat = SetPrototype.union;\nSetPrototype.withMutations = withMutations;\nSetPrototype.asImmutable = asImmutable;\nSetPrototype['@@transducer/init'] = SetPrototype.asMutable = asMutable;\nSetPrototype['@@transducer/step'] = function (result, arr) {\n return result.add(arr);\n};\nSetPrototype['@@transducer/result'] = function (obj) {\n return obj.asImmutable();\n};\n\nSetPrototype.__empty = emptySet;\nSetPrototype.__make = makeSet;\n\nfunction updateSet(set, newMap) {\n if (set.__ownerID) {\n set.size = newMap.size;\n set._map = newMap;\n return set;\n }\n return newMap === set._map\n ? set\n : newMap.size === 0\n ? set.__empty()\n : set.__make(newMap);\n}\n\nfunction makeSet(map, ownerID) {\n var set = Object.create(SetPrototype);\n set.size = map ? map.size : 0;\n set._map = map;\n set.__ownerID = ownerID;\n return set;\n}\n\nvar EMPTY_SET;\nfunction emptySet() {\n return EMPTY_SET || (EMPTY_SET = makeSet(emptyMap()));\n}\n\n/**\n * Returns a lazy seq of nums from start (inclusive) to end\n * (exclusive), by step, where start defaults to 0, step to 1, and end to\n * infinity. When start is equal to end, returns empty list.\n */\nvar Range = /*@__PURE__*/(function (IndexedSeq) {\n function Range(start, end, step) {\n if (!(this instanceof Range)) {\n return new Range(start, end, step);\n }\n invariant(step !== 0, 'Cannot step a Range by 0');\n start = start || 0;\n if (end === undefined) {\n end = Infinity;\n }\n step = step === undefined ? 1 : Math.abs(step);\n if (end < start) {\n step = -step;\n }\n this._start = start;\n this._end = end;\n this._step = step;\n this.size = Math.max(0, Math.ceil((end - start) / step - 1) + 1);\n if (this.size === 0) {\n if (EMPTY_RANGE) {\n return EMPTY_RANGE;\n }\n EMPTY_RANGE = this;\n }\n }\n\n if ( IndexedSeq ) Range.__proto__ = IndexedSeq;\n Range.prototype = Object.create( IndexedSeq && IndexedSeq.prototype );\n Range.prototype.constructor = Range;\n\n Range.prototype.toString = function toString () {\n if (this.size === 0) {\n return 'Range []';\n }\n return (\n 'Range [ ' +\n this._start +\n '...' +\n this._end +\n (this._step !== 1 ? ' by ' + this._step : '') +\n ' ]'\n );\n };\n\n Range.prototype.get = function get (index, notSetValue) {\n return this.has(index)\n ? this._start + wrapIndex(this, index) * this._step\n : notSetValue;\n };\n\n Range.prototype.includes = function includes (searchValue) {\n var possibleIndex = (searchValue - this._start) / this._step;\n return (\n possibleIndex >= 0 &&\n possibleIndex < this.size &&\n possibleIndex === Math.floor(possibleIndex)\n );\n };\n\n Range.prototype.slice = function slice (begin, end) {\n if (wholeSlice(begin, end, this.size)) {\n return this;\n }\n begin = resolveBegin(begin, this.size);\n end = resolveEnd(end, this.size);\n if (end <= begin) {\n return new Range(0, 0);\n }\n return new Range(\n this.get(begin, this._end),\n this.get(end, this._end),\n this._step\n );\n };\n\n Range.prototype.indexOf = function indexOf (searchValue) {\n var offsetValue = searchValue - this._start;\n if (offsetValue % this._step === 0) {\n var index = offsetValue / this._step;\n if (index >= 0 && index < this.size) {\n return index;\n }\n }\n return -1;\n };\n\n Range.prototype.lastIndexOf = function lastIndexOf (searchValue) {\n return this.indexOf(searchValue);\n };\n\n Range.prototype.__iterate = function __iterate (fn, reverse) {\n var size = this.size;\n var step = this._step;\n var value = reverse ? this._start + (size - 1) * step : this._start;\n var i = 0;\n while (i !== size) {\n if (fn(value, reverse ? size - ++i : i++, this) === false) {\n break;\n }\n value += reverse ? -step : step;\n }\n return i;\n };\n\n Range.prototype.__iterator = function __iterator (type, reverse) {\n var size = this.size;\n var step = this._step;\n var value = reverse ? this._start + (size - 1) * step : this._start;\n var i = 0;\n return new Iterator(function () {\n if (i === size) {\n return iteratorDone();\n }\n var v = value;\n value += reverse ? -step : step;\n return iteratorValue(type, reverse ? size - ++i : i++, v);\n });\n };\n\n Range.prototype.equals = function equals (other) {\n return other instanceof Range\n ? this._start === other._start &&\n this._end === other._end &&\n this._step === other._step\n : deepEqual(this, other);\n };\n\n return Range;\n}(IndexedSeq));\n\nvar EMPTY_RANGE;\n\nfunction getIn$1(collection, searchKeyPath, notSetValue) {\n var keyPath = coerceKeyPath(searchKeyPath);\n var i = 0;\n while (i !== keyPath.length) {\n collection = get(collection, keyPath[i++], NOT_SET);\n if (collection === NOT_SET) {\n return notSetValue;\n }\n }\n return collection;\n}\n\nfunction getIn(searchKeyPath, notSetValue) {\n return getIn$1(this, searchKeyPath, notSetValue);\n}\n\nfunction hasIn$1(collection, keyPath) {\n return getIn$1(collection, keyPath, NOT_SET) !== NOT_SET;\n}\n\nfunction hasIn(searchKeyPath) {\n return hasIn$1(this, searchKeyPath);\n}\n\nfunction toObject() {\n assertNotInfinite(this.size);\n var object = {};\n this.__iterate(function (v, k) {\n object[k] = v;\n });\n return object;\n}\n\n// Note: all of these methods are deprecated.\nCollection.isIterable = isCollection;\nCollection.isKeyed = isKeyed;\nCollection.isIndexed = isIndexed;\nCollection.isAssociative = isAssociative;\nCollection.isOrdered = isOrdered;\n\nCollection.Iterator = Iterator;\n\nmixin(Collection, {\n // ### Conversion to other types\n\n toArray: function toArray() {\n assertNotInfinite(this.size);\n var array = new Array(this.size || 0);\n var useTuples = isKeyed(this);\n var i = 0;\n this.__iterate(function (v, k) {\n // Keyed collections produce an array of tuples.\n array[i++] = useTuples ? [k, v] : v;\n });\n return array;\n },\n\n toIndexedSeq: function toIndexedSeq() {\n return new ToIndexedSequence(this);\n },\n\n toJS: function toJS$1() {\n return toJS(this);\n },\n\n toKeyedSeq: function toKeyedSeq() {\n return new ToKeyedSequence(this, true);\n },\n\n toMap: function toMap() {\n // Use Late Binding here to solve the circular dependency.\n return Map(this.toKeyedSeq());\n },\n\n toObject: toObject,\n\n toOrderedMap: function toOrderedMap() {\n // Use Late Binding here to solve the circular dependency.\n return OrderedMap(this.toKeyedSeq());\n },\n\n toOrderedSet: function toOrderedSet() {\n // Use Late Binding here to solve the circular dependency.\n return OrderedSet(isKeyed(this) ? this.valueSeq() : this);\n },\n\n toSet: function toSet() {\n // Use Late Binding here to solve the circular dependency.\n return Set(isKeyed(this) ? this.valueSeq() : this);\n },\n\n toSetSeq: function toSetSeq() {\n return new ToSetSequence(this);\n },\n\n toSeq: function toSeq() {\n return isIndexed(this)\n ? this.toIndexedSeq()\n : isKeyed(this)\n ? this.toKeyedSeq()\n : this.toSetSeq();\n },\n\n toStack: function toStack() {\n // Use Late Binding here to solve the circular dependency.\n return Stack(isKeyed(this) ? this.valueSeq() : this);\n },\n\n toList: function toList() {\n // Use Late Binding here to solve the circular dependency.\n return List(isKeyed(this) ? this.valueSeq() : this);\n },\n\n // ### Common JavaScript methods and properties\n\n toString: function toString() {\n return '[Collection]';\n },\n\n __toString: function __toString(head, tail) {\n if (this.size === 0) {\n return head + tail;\n }\n return (\n head +\n ' ' +\n this.toSeq().map(this.__toStringMapper).join(', ') +\n ' ' +\n tail\n );\n },\n\n // ### ES6 Collection methods (ES6 Array and Map)\n\n concat: function concat() {\n var values = [], len = arguments.length;\n while ( len-- ) values[ len ] = arguments[ len ];\n\n return reify(this, concatFactory(this, values));\n },\n\n includes: function includes(searchValue) {\n return this.some(function (value) { return is(value, searchValue); });\n },\n\n entries: function entries() {\n return this.__iterator(ITERATE_ENTRIES);\n },\n\n every: function every(predicate, context) {\n assertNotInfinite(this.size);\n var returnValue = true;\n this.__iterate(function (v, k, c) {\n if (!predicate.call(context, v, k, c)) {\n returnValue = false;\n return false;\n }\n });\n return returnValue;\n },\n\n filter: function filter(predicate, context) {\n return reify(this, filterFactory(this, predicate, context, true));\n },\n\n find: function find(predicate, context, notSetValue) {\n var entry = this.findEntry(predicate, context);\n return entry ? entry[1] : notSetValue;\n },\n\n forEach: function forEach(sideEffect, context) {\n assertNotInfinite(this.size);\n return this.__iterate(context ? sideEffect.bind(context) : sideEffect);\n },\n\n join: function join(separator) {\n assertNotInfinite(this.size);\n separator = separator !== undefined ? '' + separator : ',';\n var joined = '';\n var isFirst = true;\n this.__iterate(function (v) {\n isFirst ? (isFirst = false) : (joined += separator);\n joined += v !== null && v !== undefined ? v.toString() : '';\n });\n return joined;\n },\n\n keys: function keys() {\n return this.__iterator(ITERATE_KEYS);\n },\n\n map: function map(mapper, context) {\n return reify(this, mapFactory(this, mapper, context));\n },\n\n reduce: function reduce$1(reducer, initialReduction, context) {\n return reduce(\n this,\n reducer,\n initialReduction,\n context,\n arguments.length < 2,\n false\n );\n },\n\n reduceRight: function reduceRight(reducer, initialReduction, context) {\n return reduce(\n this,\n reducer,\n initialReduction,\n context,\n arguments.length < 2,\n true\n );\n },\n\n reverse: function reverse() {\n return reify(this, reverseFactory(this, true));\n },\n\n slice: function slice(begin, end) {\n return reify(this, sliceFactory(this, begin, end, true));\n },\n\n some: function some(predicate, context) {\n return !this.every(not(predicate), context);\n },\n\n sort: function sort(comparator) {\n return reify(this, sortFactory(this, comparator));\n },\n\n values: function values() {\n return this.__iterator(ITERATE_VALUES);\n },\n\n // ### More sequential methods\n\n butLast: function butLast() {\n return this.slice(0, -1);\n },\n\n isEmpty: function isEmpty() {\n return this.size !== undefined ? this.size === 0 : !this.some(function () { return true; });\n },\n\n count: function count(predicate, context) {\n return ensureSize(\n predicate ? this.toSeq().filter(predicate, context) : this\n );\n },\n\n countBy: function countBy(grouper, context) {\n return countByFactory(this, grouper, context);\n },\n\n equals: function equals(other) {\n return deepEqual(this, other);\n },\n\n entrySeq: function entrySeq() {\n var collection = this;\n if (collection._cache) {\n // We cache as an entries array, so we can just return the cache!\n return new ArraySeq(collection._cache);\n }\n var entriesSequence = collection.toSeq().map(entryMapper).toIndexedSeq();\n entriesSequence.fromEntrySeq = function () { return collection.toSeq(); };\n return entriesSequence;\n },\n\n filterNot: function filterNot(predicate, context) {\n return this.filter(not(predicate), context);\n },\n\n findEntry: function findEntry(predicate, context, notSetValue) {\n var found = notSetValue;\n this.__iterate(function (v, k, c) {\n if (predicate.call(context, v, k, c)) {\n found = [k, v];\n return false;\n }\n });\n return found;\n },\n\n findKey: function findKey(predicate, context) {\n var entry = this.findEntry(predicate, context);\n return entry && entry[0];\n },\n\n findLast: function findLast(predicate, context, notSetValue) {\n return this.toKeyedSeq().reverse().find(predicate, context, notSetValue);\n },\n\n findLastEntry: function findLastEntry(predicate, context, notSetValue) {\n return this.toKeyedSeq()\n .reverse()\n .findEntry(predicate, context, notSetValue);\n },\n\n findLastKey: function findLastKey(predicate, context) {\n return this.toKeyedSeq().reverse().findKey(predicate, context);\n },\n\n first: function first(notSetValue) {\n return this.find(returnTrue, null, notSetValue);\n },\n\n flatMap: function flatMap(mapper, context) {\n return reify(this, flatMapFactory(this, mapper, context));\n },\n\n flatten: function flatten(depth) {\n return reify(this, flattenFactory(this, depth, true));\n },\n\n fromEntrySeq: function fromEntrySeq() {\n return new FromEntriesSequence(this);\n },\n\n get: function get(searchKey, notSetValue) {\n return this.find(function (_, key) { return is(key, searchKey); }, undefined, notSetValue);\n },\n\n getIn: getIn,\n\n groupBy: function groupBy(grouper, context) {\n return groupByFactory(this, grouper, context);\n },\n\n has: function has(searchKey) {\n return this.get(searchKey, NOT_SET) !== NOT_SET;\n },\n\n hasIn: hasIn,\n\n isSubset: function isSubset(iter) {\n iter = typeof iter.includes === 'function' ? iter : Collection(iter);\n return this.every(function (value) { return iter.includes(value); });\n },\n\n isSuperset: function isSuperset(iter) {\n iter = typeof iter.isSubset === 'function' ? iter : Collection(iter);\n return iter.isSubset(this);\n },\n\n keyOf: function keyOf(searchValue) {\n return this.findKey(function (value) { return is(value, searchValue); });\n },\n\n keySeq: function keySeq() {\n return this.toSeq().map(keyMapper).toIndexedSeq();\n },\n\n last: function last(notSetValue) {\n return this.toSeq().reverse().first(notSetValue);\n },\n\n lastKeyOf: function lastKeyOf(searchValue) {\n return this.toKeyedSeq().reverse().keyOf(searchValue);\n },\n\n max: function max(comparator) {\n return maxFactory(this, comparator);\n },\n\n maxBy: function maxBy(mapper, comparator) {\n return maxFactory(this, comparator, mapper);\n },\n\n min: function min(comparator) {\n return maxFactory(\n this,\n comparator ? neg(comparator) : defaultNegComparator\n );\n },\n\n minBy: function minBy(mapper, comparator) {\n return maxFactory(\n this,\n comparator ? neg(comparator) : defaultNegComparator,\n mapper\n );\n },\n\n rest: function rest() {\n return this.slice(1);\n },\n\n skip: function skip(amount) {\n return amount === 0 ? this : this.slice(Math.max(0, amount));\n },\n\n skipLast: function skipLast(amount) {\n return amount === 0 ? this : this.slice(0, -Math.max(0, amount));\n },\n\n skipWhile: function skipWhile(predicate, context) {\n return reify(this, skipWhileFactory(this, predicate, context, true));\n },\n\n skipUntil: function skipUntil(predicate, context) {\n return this.skipWhile(not(predicate), context);\n },\n\n sortBy: function sortBy(mapper, comparator) {\n return reify(this, sortFactory(this, comparator, mapper));\n },\n\n take: function take(amount) {\n return this.slice(0, Math.max(0, amount));\n },\n\n takeLast: function takeLast(amount) {\n return this.slice(-Math.max(0, amount));\n },\n\n takeWhile: function takeWhile(predicate, context) {\n return reify(this, takeWhileFactory(this, predicate, context));\n },\n\n takeUntil: function takeUntil(predicate, context) {\n return this.takeWhile(not(predicate), context);\n },\n\n update: function update(fn) {\n return fn(this);\n },\n\n valueSeq: function valueSeq() {\n return this.toIndexedSeq();\n },\n\n // ### Hashable Object\n\n hashCode: function hashCode() {\n return this.__hash || (this.__hash = hashCollection(this));\n },\n\n // ### Internal\n\n // abstract __iterate(fn, reverse)\n\n // abstract __iterator(type, reverse)\n});\n\nvar CollectionPrototype = Collection.prototype;\nCollectionPrototype[IS_COLLECTION_SYMBOL] = true;\nCollectionPrototype[ITERATOR_SYMBOL] = CollectionPrototype.values;\nCollectionPrototype.toJSON = CollectionPrototype.toArray;\nCollectionPrototype.__toStringMapper = quoteString;\nCollectionPrototype.inspect = CollectionPrototype.toSource = function () {\n return this.toString();\n};\nCollectionPrototype.chain = CollectionPrototype.flatMap;\nCollectionPrototype.contains = CollectionPrototype.includes;\n\nmixin(KeyedCollection, {\n // ### More sequential methods\n\n flip: function flip() {\n return reify(this, flipFactory(this));\n },\n\n mapEntries: function mapEntries(mapper, context) {\n var this$1$1 = this;\n\n var iterations = 0;\n return reify(\n this,\n this.toSeq()\n .map(function (v, k) { return mapper.call(context, [k, v], iterations++, this$1$1); })\n .fromEntrySeq()\n );\n },\n\n mapKeys: function mapKeys(mapper, context) {\n var this$1$1 = this;\n\n return reify(\n this,\n this.toSeq()\n .flip()\n .map(function (k, v) { return mapper.call(context, k, v, this$1$1); })\n .flip()\n );\n },\n});\n\nvar KeyedCollectionPrototype = KeyedCollection.prototype;\nKeyedCollectionPrototype[IS_KEYED_SYMBOL] = true;\nKeyedCollectionPrototype[ITERATOR_SYMBOL] = CollectionPrototype.entries;\nKeyedCollectionPrototype.toJSON = toObject;\nKeyedCollectionPrototype.__toStringMapper = function (v, k) { return quoteString(k) + ': ' + quoteString(v); };\n\nmixin(IndexedCollection, {\n // ### Conversion to other types\n\n toKeyedSeq: function toKeyedSeq() {\n return new ToKeyedSequence(this, false);\n },\n\n // ### ES6 Collection methods (ES6 Array and Map)\n\n filter: function filter(predicate, context) {\n return reify(this, filterFactory(this, predicate, context, false));\n },\n\n findIndex: function findIndex(predicate, context) {\n var entry = this.findEntry(predicate, context);\n return entry ? entry[0] : -1;\n },\n\n indexOf: function indexOf(searchValue) {\n var key = this.keyOf(searchValue);\n return key === undefined ? -1 : key;\n },\n\n lastIndexOf: function lastIndexOf(searchValue) {\n var key = this.lastKeyOf(searchValue);\n return key === undefined ? -1 : key;\n },\n\n reverse: function reverse() {\n return reify(this, reverseFactory(this, false));\n },\n\n slice: function slice(begin, end) {\n return reify(this, sliceFactory(this, begin, end, false));\n },\n\n splice: function splice(index, removeNum /*, ...values*/) {\n var numArgs = arguments.length;\n removeNum = Math.max(removeNum || 0, 0);\n if (numArgs === 0 || (numArgs === 2 && !removeNum)) {\n return this;\n }\n // If index is negative, it should resolve relative to the size of the\n // collection. However size may be expensive to compute if not cached, so\n // only call count() if the number is in fact negative.\n index = resolveBegin(index, index < 0 ? this.count() : this.size);\n var spliced = this.slice(0, index);\n return reify(\n this,\n numArgs === 1\n ? spliced\n : spliced.concat(arrCopy(arguments, 2), this.slice(index + removeNum))\n );\n },\n\n // ### More collection methods\n\n findLastIndex: function findLastIndex(predicate, context) {\n var entry = this.findLastEntry(predicate, context);\n return entry ? entry[0] : -1;\n },\n\n first: function first(notSetValue) {\n return this.get(0, notSetValue);\n },\n\n flatten: function flatten(depth) {\n return reify(this, flattenFactory(this, depth, false));\n },\n\n get: function get(index, notSetValue) {\n index = wrapIndex(this, index);\n return index < 0 ||\n this.size === Infinity ||\n (this.size !== undefined && index > this.size)\n ? notSetValue\n : this.find(function (_, key) { return key === index; }, undefined, notSetValue);\n },\n\n has: function has(index) {\n index = wrapIndex(this, index);\n return (\n index >= 0 &&\n (this.size !== undefined\n ? this.size === Infinity || index < this.size\n : this.indexOf(index) !== -1)\n );\n },\n\n interpose: function interpose(separator) {\n return reify(this, interposeFactory(this, separator));\n },\n\n interleave: function interleave(/*...collections*/) {\n var collections = [this].concat(arrCopy(arguments));\n var zipped = zipWithFactory(this.toSeq(), IndexedSeq.of, collections);\n var interleaved = zipped.flatten(true);\n if (zipped.size) {\n interleaved.size = zipped.size * collections.length;\n }\n return reify(this, interleaved);\n },\n\n keySeq: function keySeq() {\n return Range(0, this.size);\n },\n\n last: function last(notSetValue) {\n return this.get(-1, notSetValue);\n },\n\n skipWhile: function skipWhile(predicate, context) {\n return reify(this, skipWhileFactory(this, predicate, context, false));\n },\n\n zip: function zip(/*, ...collections */) {\n var collections = [this].concat(arrCopy(arguments));\n return reify(this, zipWithFactory(this, defaultZipper, collections));\n },\n\n zipAll: function zipAll(/*, ...collections */) {\n var collections = [this].concat(arrCopy(arguments));\n return reify(this, zipWithFactory(this, defaultZipper, collections, true));\n },\n\n zipWith: function zipWith(zipper /*, ...collections */) {\n var collections = arrCopy(arguments);\n collections[0] = this;\n return reify(this, zipWithFactory(this, zipper, collections));\n },\n});\n\nvar IndexedCollectionPrototype = IndexedCollection.prototype;\nIndexedCollectionPrototype[IS_INDEXED_SYMBOL] = true;\nIndexedCollectionPrototype[IS_ORDERED_SYMBOL] = true;\n\nmixin(SetCollection, {\n // ### ES6 Collection methods (ES6 Array and Map)\n\n get: function get(value, notSetValue) {\n return this.has(value) ? value : notSetValue;\n },\n\n includes: function includes(value) {\n return this.has(value);\n },\n\n // ### More sequential methods\n\n keySeq: function keySeq() {\n return this.valueSeq();\n },\n});\n\nvar SetCollectionPrototype = SetCollection.prototype;\nSetCollectionPrototype.has = CollectionPrototype.includes;\nSetCollectionPrototype.contains = SetCollectionPrototype.includes;\nSetCollectionPrototype.keys = SetCollectionPrototype.values;\n\n// Mixin subclasses\n\nmixin(KeyedSeq, KeyedCollectionPrototype);\nmixin(IndexedSeq, IndexedCollectionPrototype);\nmixin(SetSeq, SetCollectionPrototype);\n\n// #pragma Helper functions\n\nfunction reduce(collection, reducer, reduction, context, useFirst, reverse) {\n assertNotInfinite(collection.size);\n collection.__iterate(function (v, k, c) {\n if (useFirst) {\n useFirst = false;\n reduction = v;\n } else {\n reduction = reducer.call(context, reduction, v, k, c);\n }\n }, reverse);\n return reduction;\n}\n\nfunction keyMapper(v, k) {\n return k;\n}\n\nfunction entryMapper(v, k) {\n return [k, v];\n}\n\nfunction not(predicate) {\n return function () {\n return !predicate.apply(this, arguments);\n };\n}\n\nfunction neg(predicate) {\n return function () {\n return -predicate.apply(this, arguments);\n };\n}\n\nfunction defaultZipper() {\n return arrCopy(arguments);\n}\n\nfunction defaultNegComparator(a, b) {\n return a < b ? 1 : a > b ? -1 : 0;\n}\n\nfunction hashCollection(collection) {\n if (collection.size === Infinity) {\n return 0;\n }\n var ordered = isOrdered(collection);\n var keyed = isKeyed(collection);\n var h = ordered ? 1 : 0;\n var size = collection.__iterate(\n keyed\n ? ordered\n ? function (v, k) {\n h = (31 * h + hashMerge(hash(v), hash(k))) | 0;\n }\n : function (v, k) {\n h = (h + hashMerge(hash(v), hash(k))) | 0;\n }\n : ordered\n ? function (v) {\n h = (31 * h + hash(v)) | 0;\n }\n : function (v) {\n h = (h + hash(v)) | 0;\n }\n );\n return murmurHashOfSize(size, h);\n}\n\nfunction murmurHashOfSize(size, h) {\n h = imul(h, 0xcc9e2d51);\n h = imul((h << 15) | (h >>> -15), 0x1b873593);\n h = imul((h << 13) | (h >>> -13), 5);\n h = ((h + 0xe6546b64) | 0) ^ size;\n h = imul(h ^ (h >>> 16), 0x85ebca6b);\n h = imul(h ^ (h >>> 13), 0xc2b2ae35);\n h = smi(h ^ (h >>> 16));\n return h;\n}\n\nfunction hashMerge(a, b) {\n return (a ^ (b + 0x9e3779b9 + (a << 6) + (a >> 2))) | 0; // int\n}\n\nvar OrderedSet = /*@__PURE__*/(function (Set) {\n function OrderedSet(value) {\n return value === null || value === undefined\n ? emptyOrderedSet()\n : isOrderedSet(value)\n ? value\n : emptyOrderedSet().withMutations(function (set) {\n var iter = SetCollection(value);\n assertNotInfinite(iter.size);\n iter.forEach(function (v) { return set.add(v); });\n });\n }\n\n if ( Set ) OrderedSet.__proto__ = Set;\n OrderedSet.prototype = Object.create( Set && Set.prototype );\n OrderedSet.prototype.constructor = OrderedSet;\n\n OrderedSet.of = function of (/*...values*/) {\n return this(arguments);\n };\n\n OrderedSet.fromKeys = function fromKeys (value) {\n return this(KeyedCollection(value).keySeq());\n };\n\n OrderedSet.prototype.toString = function toString () {\n return this.__toString('OrderedSet {', '}');\n };\n\n return OrderedSet;\n}(Set));\n\nOrderedSet.isOrderedSet = isOrderedSet;\n\nvar OrderedSetPrototype = OrderedSet.prototype;\nOrderedSetPrototype[IS_ORDERED_SYMBOL] = true;\nOrderedSetPrototype.zip = IndexedCollectionPrototype.zip;\nOrderedSetPrototype.zipWith = IndexedCollectionPrototype.zipWith;\nOrderedSetPrototype.zipAll = IndexedCollectionPrototype.zipAll;\n\nOrderedSetPrototype.__empty = emptyOrderedSet;\nOrderedSetPrototype.__make = makeOrderedSet;\n\nfunction makeOrderedSet(map, ownerID) {\n var set = Object.create(OrderedSetPrototype);\n set.size = map ? map.size : 0;\n set._map = map;\n set.__ownerID = ownerID;\n return set;\n}\n\nvar EMPTY_ORDERED_SET;\nfunction emptyOrderedSet() {\n return (\n EMPTY_ORDERED_SET || (EMPTY_ORDERED_SET = makeOrderedSet(emptyOrderedMap()))\n );\n}\n\nfunction throwOnInvalidDefaultValues(defaultValues) {\n if (isRecord(defaultValues)) {\n throw new Error(\n 'Can not call `Record` with an immutable Record as default values. Use a plain javascript object instead.'\n );\n }\n\n if (isImmutable(defaultValues)) {\n throw new Error(\n 'Can not call `Record` with an immutable Collection as default values. Use a plain javascript object instead.'\n );\n }\n\n if (defaultValues === null || typeof defaultValues !== 'object') {\n throw new Error(\n 'Can not call `Record` with a non-object as default values. Use a plain javascript object instead.'\n );\n }\n}\n\nvar Record = function Record(defaultValues, name) {\n var hasInitialized;\n\n throwOnInvalidDefaultValues(defaultValues);\n\n var RecordType = function Record(values) {\n var this$1$1 = this;\n\n if (values instanceof RecordType) {\n return values;\n }\n if (!(this instanceof RecordType)) {\n return new RecordType(values);\n }\n if (!hasInitialized) {\n hasInitialized = true;\n var keys = Object.keys(defaultValues);\n var indices = (RecordTypePrototype._indices = {});\n // Deprecated: left to attempt not to break any external code which\n // relies on a ._name property existing on record instances.\n // Use Record.getDescriptiveName() instead\n RecordTypePrototype._name = name;\n RecordTypePrototype._keys = keys;\n RecordTypePrototype._defaultValues = defaultValues;\n for (var i = 0; i < keys.length; i++) {\n var propName = keys[i];\n indices[propName] = i;\n if (RecordTypePrototype[propName]) {\n /* eslint-disable no-console */\n typeof console === 'object' &&\n console.warn &&\n console.warn(\n 'Cannot define ' +\n recordName(this) +\n ' with property \"' +\n propName +\n '\" since that property name is part of the Record API.'\n );\n /* eslint-enable no-console */\n } else {\n setProp(RecordTypePrototype, propName);\n }\n }\n }\n this.__ownerID = undefined;\n this._values = List().withMutations(function (l) {\n l.setSize(this$1$1._keys.length);\n KeyedCollection(values).forEach(function (v, k) {\n l.set(this$1$1._indices[k], v === this$1$1._defaultValues[k] ? undefined : v);\n });\n });\n return this;\n };\n\n var RecordTypePrototype = (RecordType.prototype =\n Object.create(RecordPrototype));\n RecordTypePrototype.constructor = RecordType;\n\n if (name) {\n RecordType.displayName = name;\n }\n\n return RecordType;\n};\n\nRecord.prototype.toString = function toString () {\n var str = recordName(this) + ' { ';\n var keys = this._keys;\n var k;\n for (var i = 0, l = keys.length; i !== l; i++) {\n k = keys[i];\n str += (i ? ', ' : '') + k + ': ' + quoteString(this.get(k));\n }\n return str + ' }';\n};\n\nRecord.prototype.equals = function equals (other) {\n return (\n this === other || (other && recordSeq(this).equals(recordSeq(other)))\n );\n};\n\nRecord.prototype.hashCode = function hashCode () {\n return recordSeq(this).hashCode();\n};\n\n// @pragma Access\n\nRecord.prototype.has = function has (k) {\n return this._indices.hasOwnProperty(k);\n};\n\nRecord.prototype.get = function get (k, notSetValue) {\n if (!this.has(k)) {\n return notSetValue;\n }\n var index = this._indices[k];\n var value = this._values.get(index);\n return value === undefined ? this._defaultValues[k] : value;\n};\n\n// @pragma Modification\n\nRecord.prototype.set = function set (k, v) {\n if (this.has(k)) {\n var newValues = this._values.set(\n this._indices[k],\n v === this._defaultValues[k] ? undefined : v\n );\n if (newValues !== this._values && !this.__ownerID) {\n return makeRecord(this, newValues);\n }\n }\n return this;\n};\n\nRecord.prototype.remove = function remove (k) {\n return this.set(k);\n};\n\nRecord.prototype.clear = function clear () {\n var newValues = this._values.clear().setSize(this._keys.length);\n\n return this.__ownerID ? this : makeRecord(this, newValues);\n};\n\nRecord.prototype.wasAltered = function wasAltered () {\n return this._values.wasAltered();\n};\n\nRecord.prototype.toSeq = function toSeq () {\n return recordSeq(this);\n};\n\nRecord.prototype.toJS = function toJS$1 () {\n return toJS(this);\n};\n\nRecord.prototype.entries = function entries () {\n return this.__iterator(ITERATE_ENTRIES);\n};\n\nRecord.prototype.__iterator = function __iterator (type, reverse) {\n return recordSeq(this).__iterator(type, reverse);\n};\n\nRecord.prototype.__iterate = function __iterate (fn, reverse) {\n return recordSeq(this).__iterate(fn, reverse);\n};\n\nRecord.prototype.__ensureOwner = function __ensureOwner (ownerID) {\n if (ownerID === this.__ownerID) {\n return this;\n }\n var newValues = this._values.__ensureOwner(ownerID);\n if (!ownerID) {\n this.__ownerID = ownerID;\n this._values = newValues;\n return this;\n }\n return makeRecord(this, newValues, ownerID);\n};\n\nRecord.isRecord = isRecord;\nRecord.getDescriptiveName = recordName;\nvar RecordPrototype = Record.prototype;\nRecordPrototype[IS_RECORD_SYMBOL] = true;\nRecordPrototype[DELETE] = RecordPrototype.remove;\nRecordPrototype.deleteIn = RecordPrototype.removeIn = deleteIn;\nRecordPrototype.getIn = getIn;\nRecordPrototype.hasIn = CollectionPrototype.hasIn;\nRecordPrototype.merge = merge$1;\nRecordPrototype.mergeWith = mergeWith$1;\nRecordPrototype.mergeIn = mergeIn;\nRecordPrototype.mergeDeep = mergeDeep;\nRecordPrototype.mergeDeepWith = mergeDeepWith;\nRecordPrototype.mergeDeepIn = mergeDeepIn;\nRecordPrototype.setIn = setIn;\nRecordPrototype.update = update;\nRecordPrototype.updateIn = updateIn;\nRecordPrototype.withMutations = withMutations;\nRecordPrototype.asMutable = asMutable;\nRecordPrototype.asImmutable = asImmutable;\nRecordPrototype[ITERATOR_SYMBOL] = RecordPrototype.entries;\nRecordPrototype.toJSON = RecordPrototype.toObject =\n CollectionPrototype.toObject;\nRecordPrototype.inspect = RecordPrototype.toSource = function () {\n return this.toString();\n};\n\nfunction makeRecord(likeRecord, values, ownerID) {\n var record = Object.create(Object.getPrototypeOf(likeRecord));\n record._values = values;\n record.__ownerID = ownerID;\n return record;\n}\n\nfunction recordName(record) {\n return record.constructor.displayName || record.constructor.name || 'Record';\n}\n\nfunction recordSeq(record) {\n return keyedSeqFromValue(record._keys.map(function (k) { return [k, record.get(k)]; }));\n}\n\nfunction setProp(prototype, name) {\n try {\n Object.defineProperty(prototype, name, {\n get: function () {\n return this.get(name);\n },\n set: function (value) {\n invariant(this.__ownerID, 'Cannot set on an immutable record.');\n this.set(name, value);\n },\n });\n } catch (error) {\n // Object.defineProperty failed. Probably IE8.\n }\n}\n\n/**\n * Returns a lazy Seq of `value` repeated `times` times. When `times` is\n * undefined, returns an infinite sequence of `value`.\n */\nvar Repeat = /*@__PURE__*/(function (IndexedSeq) {\n function Repeat(value, times) {\n if (!(this instanceof Repeat)) {\n return new Repeat(value, times);\n }\n this._value = value;\n this.size = times === undefined ? Infinity : Math.max(0, times);\n if (this.size === 0) {\n if (EMPTY_REPEAT) {\n return EMPTY_REPEAT;\n }\n EMPTY_REPEAT = this;\n }\n }\n\n if ( IndexedSeq ) Repeat.__proto__ = IndexedSeq;\n Repeat.prototype = Object.create( IndexedSeq && IndexedSeq.prototype );\n Repeat.prototype.constructor = Repeat;\n\n Repeat.prototype.toString = function toString () {\n if (this.size === 0) {\n return 'Repeat []';\n }\n return 'Repeat [ ' + this._value + ' ' + this.size + ' times ]';\n };\n\n Repeat.prototype.get = function get (index, notSetValue) {\n return this.has(index) ? this._value : notSetValue;\n };\n\n Repeat.prototype.includes = function includes (searchValue) {\n return is(this._value, searchValue);\n };\n\n Repeat.prototype.slice = function slice (begin, end) {\n var size = this.size;\n return wholeSlice(begin, end, size)\n ? this\n : new Repeat(\n this._value,\n resolveEnd(end, size) - resolveBegin(begin, size)\n );\n };\n\n Repeat.prototype.reverse = function reverse () {\n return this;\n };\n\n Repeat.prototype.indexOf = function indexOf (searchValue) {\n if (is(this._value, searchValue)) {\n return 0;\n }\n return -1;\n };\n\n Repeat.prototype.lastIndexOf = function lastIndexOf (searchValue) {\n if (is(this._value, searchValue)) {\n return this.size;\n }\n return -1;\n };\n\n Repeat.prototype.__iterate = function __iterate (fn, reverse) {\n var size = this.size;\n var i = 0;\n while (i !== size) {\n if (fn(this._value, reverse ? size - ++i : i++, this) === false) {\n break;\n }\n }\n return i;\n };\n\n Repeat.prototype.__iterator = function __iterator (type, reverse) {\n var this$1$1 = this;\n\n var size = this.size;\n var i = 0;\n return new Iterator(function () { return i === size\n ? iteratorDone()\n : iteratorValue(type, reverse ? size - ++i : i++, this$1$1._value); }\n );\n };\n\n Repeat.prototype.equals = function equals (other) {\n return other instanceof Repeat\n ? is(this._value, other._value)\n : deepEqual(other);\n };\n\n return Repeat;\n}(IndexedSeq));\n\nvar EMPTY_REPEAT;\n\nfunction fromJS(value, converter) {\n return fromJSWith(\n [],\n converter || defaultConverter,\n value,\n '',\n converter && converter.length > 2 ? [] : undefined,\n { '': value }\n );\n}\n\nfunction fromJSWith(stack, converter, value, key, keyPath, parentValue) {\n if (\n typeof value !== 'string' &&\n !isImmutable(value) &&\n (isArrayLike(value) || hasIterator(value) || isPlainObject(value))\n ) {\n if (~stack.indexOf(value)) {\n throw new TypeError('Cannot convert circular structure to Immutable');\n }\n stack.push(value);\n keyPath && key !== '' && keyPath.push(key);\n var converted = converter.call(\n parentValue,\n key,\n Seq(value).map(function (v, k) { return fromJSWith(stack, converter, v, k, keyPath, value); }\n ),\n keyPath && keyPath.slice()\n );\n stack.pop();\n keyPath && keyPath.pop();\n return converted;\n }\n return value;\n}\n\nfunction defaultConverter(k, v) {\n // Effectively the opposite of \"Collection.toSeq()\"\n return isIndexed(v) ? v.toList() : isKeyed(v) ? v.toMap() : v.toSet();\n}\n\nvar version = \"4.0.0\";\n\nvar Immutable = {\n version: version,\n\n Collection: Collection,\n // Note: Iterable is deprecated\n Iterable: Collection,\n\n Seq: Seq,\n Map: Map,\n OrderedMap: OrderedMap,\n List: List,\n Stack: Stack,\n Set: Set,\n OrderedSet: OrderedSet,\n\n Record: Record,\n Range: Range,\n Repeat: Repeat,\n\n is: is,\n fromJS: fromJS,\n hash: hash,\n\n isImmutable: isImmutable,\n isCollection: isCollection,\n isKeyed: isKeyed,\n isIndexed: isIndexed,\n isAssociative: isAssociative,\n isOrdered: isOrdered,\n isValueObject: isValueObject,\n isPlainObject: isPlainObject,\n isSeq: isSeq,\n isList: isList,\n isMap: isMap,\n isOrderedMap: isOrderedMap,\n isStack: isStack,\n isSet: isSet,\n isOrderedSet: isOrderedSet,\n isRecord: isRecord,\n\n get: get,\n getIn: getIn$1,\n has: has,\n hasIn: hasIn$1,\n merge: merge,\n mergeDeep: mergeDeep$1,\n mergeWith: mergeWith,\n mergeDeepWith: mergeDeepWith$1,\n remove: remove,\n removeIn: removeIn,\n set: set,\n setIn: setIn$1,\n update: update$1,\n updateIn: updateIn$1,\n};\n\n// Note: Iterable is deprecated\nvar Iterable = Collection;\n\n/* unused harmony default export */ var _unused_webpack_default_export = (Immutable);\n\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvaW1tdXRhYmxlL2Rpc3QvaW1tdXRhYmxlLmVzLmpzPzMyOWIiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQSxjQUFjO0FBQ2Q7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBLFVBQVU7QUFDVjs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQSxrQ0FBa0M7QUFD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Byb3BOYW1lXSkge1xuICAgICAgICAgIC8qIGVzbGludC1kaXNhYmxlIG5vLWNvbnNvbGUgKi9cbiAgICAgICAgICB0eXBlb2YgY29uc29sZSA9PT0gJ29iamVjdCcgJiZcbiAgICAgICAgICAgIGNvbnNvbGUud2FybiAmJlxuICAgICAgICAgICAgY29uc29sZS53YXJuKFxuICAgICAgICAgICAgICAnQ2Fubm90IGRlZmluZSAnICtcbiAgICAgICAgICAgICAgICByZWNvcmROYW1lKHRoaXMpICtcbiAgICAgICAgICAgICAgICAnIHdpdGggcHJvcGVydHkgXCInICtcbiAgICAgICAgICAgICAgICBwcm9wTmFtZSArXG4gICAgICAgICAgICAgICAgJ1wiIHNpbmNlIHRoYXQgcHJvcGVydHkgbmFtZSBpcyBwYXJ0IG9mIHRoZSBSZWNvcmQgQVBJLidcbiAgICAgICAgICAgICk7XG4gICAgICAgICAgLyogZXNsaW50LWVuYWJsZSBuby1jb25zb2xlICovXG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgc2V0UHJvcChSZWNvcmRUeXBlUHJvdG90eXBlLCBwcm9wTmFtZSk7XG4gICAgICAgIH1cbiAgICAgIH1cbiAgICB9XG4gICAgdGhpcy5fX293bmVySUQgPSB1bmRlZmluZWQ7XG4gICAgdGhpcy5fdmFsdWVzID0gTGlzdCgpLndpdGhNdXRhdGlvbnMoZnVuY3Rpb24gKGwpIHtcbiAgICAgIGwuc2V0U2l6ZSh0aGlzJDEkMS5fa2V5cy5sZW5ndGgpO1xuICAgICAgS2V5ZWRDb2xsZWN0aW9uKHZhbHVlcykuZm9yRWFjaChmdW5jdGlvbiAodiwgaykge1xuICAgICAgICBsLnNldCh0aGlzJDEkMS5faW5kaWNlc1trXSwgdiA9PT0gdGhpcyQxJDEuX2RlZmF1bHRWYWx1ZXNba10gPyB1bmRlZmluZWQgOiB2KTtcbiAgICAgIH0pO1xuICAgIH0pO1xuICAgIHJldHVybiB0aGlzO1xuICB9O1xuXG4gIHZhciBSZWNvc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GVyZWRNYXAsIGlzT3JkZXJlZFNldCwgaXNQbGFpbk9iamVjdCwgaXNSZWNvcmQsIGlzU2VxLCBpc1NldCwgaXNTdGFjaywgaXNWYWx1ZU9iamVjdCwgbWVyZ2UsIG1lcmdlRGVlcCQxIGFzIG1lcmdlRGVlcCwgbWVyZ2VEZWVwV2l0aCQxIGFzIG1lcmdlRGVlcFdpdGgsIG1lcmdlV2l0aCwgcmVtb3ZlLCByZW1vdmVJbiwgc2V0LCBzZXRJbiQxIGFzIHNldEluLCB1cGRhdGUkMSBhcyB1cGRhdGUsIHVwZGF0ZUluJDEgYXMgdXBkYXRlSW4sIHZlcnNpb24gfTtcbiJdLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///0\n")},function(module,__webpack_exports__,__webpack_require__){"use strict";eval('/* unused harmony export EventError */\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Eventer; });\n/* unused harmony export Token */\n/******************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nfunction __extends(d, b) {\r\n if (typeof b !== "function" && b !== null)\r\n throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nfunction __values(o) {\r\n var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === "number") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");\r\n}\r\n\r\nfunction __read(o, n) {\r\n var m = typeof Symbol === "function" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i["return"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nfunction __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\n\n/**\r\n * Eventer error message, adds \'EventError:\' prefix to error message\r\n */\r\nvar EventError = /** @class */ (function (_super) {\r\n __extends(EventError, _super);\r\n function EventError(m) {\r\n var _this = this;\r\n var errorMessage = "EventError: " + m + "}";\r\n _this = _super.call(this, errorMessage) || this;\r\n // Stupid workaround for a smooth support of ES5\r\n Object.setPrototypeOf(_this, EventError.prototype);\r\n return _this;\r\n }\r\n return EventError;\r\n}(Error));\r\n/**\r\n * @param ownerIndex Index of Eventer\r\n * @param id Index of current subscription\r\n * @return Unique Token\r\n */\r\nvar Token = function (ownerIndex, id) { return ({\r\n token: ownerIndex + "-" + id,\r\n ownerIndex: ownerIndex,\r\n id: id\r\n}); };\r\n// Every eventer has to have unique id across an app\r\nvar lastId = 0;\r\n/**\r\n * Creates Error for non-existing event listener.\r\n * The Error message is used in multiple occasions.\r\n * @param token Token of non-existing event\r\n * @param id Eventer id\r\n */\r\nvar notExistReport = function (token, id) {\r\n return new EventError("Event listener with " + token.token + " id does not exist at Eventer with " + id + " id.");\r\n};\r\n/**\r\n * Pub/Sub for internal event scheduling.\r\n * All functions are for protected usage.\r\n * Sub class can use them for implementation of event dispaching.\r\n * @property id Unique Eventer id\r\n */\r\nvar Eventer = /** @class */ (function () {\r\n /**\r\n *\r\n */\r\n function Eventer() {\r\n /**\r\n * Unique id\r\n */\r\n this.id = ++lastId;\r\n /**\r\n * Index of last issued token\r\n */\r\n this.lastEventIndex = 0;\r\n /**\r\n * Collection of topics\r\n */\r\n this.topics = new Map();\r\n }\r\n /**\r\n * Register subscription on the topic with provided listener\r\n * @param topic Topic name\r\n * @param listener Event listener\r\n * @param oldToken Old token, if it has to be reused\r\n */\r\n Eventer.prototype.on = function (topic, listener, oldToken) {\r\n var listeners = this.topics.get(topic);\r\n // use old token or create unique one\r\n var token = oldToken ? oldToken : Token(this.id, ++this.lastEventIndex);\r\n if (listeners)\r\n //add listener to the topic\r\n listeners.set(token, listener);\r\n else\r\n //create new topic with the listener\r\n this.topics.set(topic, new Map([[token, listener]]));\r\n return token;\r\n };\r\n /**\r\n * Check if listener with provided token exists\r\n * @param token Token of desired listener\r\n * @param topic Topic which has to contain the listener\r\n * @return Error with message or Listener\r\n */\r\n Eventer.prototype.has = function (token, topic) {\r\n var e_1, _a;\r\n //if topic is specified\r\n if (topic) {\r\n // request all listeners subscribed to the topic\r\n var listeners = this.topics.get(topic);\r\n if (listeners) {\r\n // request listener with the token\r\n var listener = listeners.get(token);\r\n if (listener)\r\n // return the listener if it is defined\r\n return listener;\r\n else\r\n // return error if it is not defined\r\n return notExistReport(token, this.id);\r\n }\r\n else\r\n // return error if topic is empty\r\n return new EventError("Eventer with " + token.ownerIndex + " does not have " + topic + ".");\r\n }\r\n else {\r\n try {\r\n //iterate over all topics\r\n for (var _b = __values(this.topics), _c = _b.next(); !_c.done; _c = _b.next()) {\r\n var _d = __read(_c.value, 2), _ = _d[0], listeners = _d[1];\r\n //check if it has listener with desired token\r\n var listener = listeners.get(token);\r\n if (listener)\r\n //return the listener\r\n return listener;\r\n }\r\n }\r\n catch (e_1_1) { e_1 = { error: e_1_1 }; }\r\n finally {\r\n try {\r\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\r\n }\r\n finally { if (e_1) throw e_1.error; }\r\n }\r\n // return an error with none of topics contains listeners with desired token.\r\n return notExistReport(token, this.id);\r\n }\r\n };\r\n /**\r\n * Remove listener with provided token\r\n * @param token Token of the listener\r\n * @param topic Topic which has to contain the listener\r\n * @return True if the listener is successfully removed and false if it is not found\r\n */\r\n Eventer.prototype.off = function (token, topic) {\r\n var e_2, _a;\r\n //if topic is specified\r\n if (topic) {\r\n // request all listeners subscribed to the topic\r\n var listeners = this.topics.get(topic);\r\n if (listeners)\r\n // check listener with the token existance\r\n if (listeners.delete(token))\r\n return true;\r\n // return false with the topic does not contain listener with specified token\r\n return false;\r\n }\r\n else {\r\n try {\r\n //itarate over all topics\r\n for (var _b = __values(this.topics), _c = _b.next(); !_c.done; _c = _b.next()) {\r\n var _d = __read(_c.value, 2), _ = _d[0], listeners = _d[1];\r\n // check listener with the token existance\r\n if (listeners.delete(token))\r\n return true;\r\n }\r\n }\r\n catch (e_2_1) { e_2 = { error: e_2_1 }; }\r\n finally {\r\n try {\r\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\r\n }\r\n finally { if (e_2) throw e_2.error; }\r\n }\r\n // return false with all topics do not contain listener with specified token\r\n return false;\r\n }\r\n };\r\n /**\r\n * Remove all topics with all listeners\r\n */\r\n Eventer.prototype.allOff = function () {\r\n this.topics.clear();\r\n return this;\r\n };\r\n /**\r\n * Remove topic with all listeners\r\n * @param topic Topic name\r\n * @return True if the topic is successfully removed and false if it is not found\r\n */\r\n Eventer.prototype.topicOff = function (topic) {\r\n return this.topics.delete(topic);\r\n };\r\n /**\r\n * Emit event and call subscribed listeners\r\n * @param topic Topic name\r\n * @param args Array of arguments\r\n * @return Number of listeners called\r\n */\r\n Eventer.prototype.emit = function (topic) {\r\n var args = [];\r\n for (var _i = 1; _i < arguments.length; _i++) {\r\n args[_i - 1] = arguments[_i];\r\n }\r\n // request all listeners subscribed to the topic\r\n var listeners = this.topics.get(topic);\r\n var numberOfListeners = 0;\r\n // if listerens exist\r\n if (listeners) {\r\n // copy listeners to prevent triggering\r\n var copiedListeners = new Map(listeners);\r\n // iterate over\r\n copiedListeners.forEach(function (listener) {\r\n // call listener\r\n listener.apply(void 0, __spread(args));\r\n numberOfListeners++;\r\n });\r\n }\r\n return numberOfListeners;\r\n };\r\n /**\r\n * Get All listeners at the topic\r\n * @param topic Topic name\r\n */\r\n Eventer.prototype.listeners = function (topic) {\r\n var listeners = this.topics.get(topic);\r\n if (listeners)\r\n return listeners;\r\n else\r\n return new Map();\r\n };\r\n return Eventer;\r\n}());\n\n\n//# sourceMappingURL=eventer.es.js.map\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvQGFyY3Rpb24vZXZlbnRlci9kaXN0L2V2ZW50ZXIuZXMuanM/YmExOSJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTtBQUFBO0FBQUE7QUFBQTtBQUNBOztBQUVBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQSxVQUFVLGdCQUFnQix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pO1xyXG4gICAgfVxyXG4gICAgY2F0Y2ggKGVycm9yKSB7IGUgPSB7IGVycm9yOiBlcnJvciB9OyB9XHJcbiAgICBmaW5hbGx5IHtcclxuICAgICAgICB0cnkge1xyXG4gICAgICAgICAgICBpZiAociAmJiAhci5kb25lICYmIChtID0gaVtcInJldHVyblwiXSkpIG0uY2FsbChpKTtcclxuICAgICAgICB9XHJcbiAgICAgICAgZmluYWxseSB7IGlmIChlKSB0aHJvdyBlLmVycm9yOyB9XHJcbiAgICB9XHJcbiAgICByZXR1cm4gYXI7XHJcbn1cclxuXHJcbi8qKiBAZGVwcmVjYXRlZCAqL1xyXG5mdW5jdGlvbiBfX3NwcmVhZCgpIHtcclxuICAgIGZvciAodmFyIGFyID0gW10sIGkgPSAwOyBpIDwgYXJndW1lbnRzLmxlbmd0aDsgaSsrKVxyXG4gICAgICAgIGFyID0gYXIuY29uY2F0KF9fcmVhZChhcmd1bWVudHNbaV0pKTtcclxuICAgIHJldHVybiBhcjtcclxufVxuXG4vKipcclxuICogRXZlbnRlciBlcnJvciBtZXNzYWdlLCBhZGRzICdFdmVudEVycm9yOicgcHJlZml4IHRvIGVycm9yIG1lc3NhZ2VcclxuICovXHJcbnZhciBFdmVudEVycm9yID0gLyoqIEBjbGFzcyAqLyAoZnVuY3Rpb24gKF9zdXBlcikge1xyXG4gICAgX19leHRlbmRzKEV2ZW50RXJyb3IsIF9zdXBlcik7XHJcbiAgICBmdW5jdGlvbiBFdmVudEVycm9yKG0pIHtcclxuICAgICAgICB2YXIgX3RoaXMgPSB0aGlzO1xyXG4gICAgICAgIHZhciBlcnJvck1lc3NhZ2UgPSBcIkV2ZW50RXJyb3I6IFwiICsgbSArIFwifVwiO1xyXG4gICAgICAgIF90aGlzID0gX3N1cGVyLmNhbGwodGhpcywgZXJyb3JNZXNzYWdlKSB8fCB0aGlzO1xyXG4gICAgICAgIC8vIFN0dXBpZCB3b3JrYXJvdW5kIGZvciBhIHNtb290aCBzdXBwb3J0IG9mI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3NhZ2Ugb3IgTGlzdGVuZXJcclxuICAgICAqL1xyXG4gICAgRXZlbnRlci5wcm90b3R5cGUuaGFzID0gZnVuY3Rpb24gKHRva2VuLCB0b3BpYykge1xyXG4gICAgICAgIHZhciBlXzEsIF9hO1xyXG4gICAgICAgIC8vaWYgdG9waWMgaXMgc3BlY2lmaWVkXHJcbiAgICAgICAgaWYgKHRvcGljKSB7XHJcbiAgICAgICAgICAgIC8vIHJlcXVlc3QgYWxsIGxpc3RlbmVycyBzdWJzY3JpYmVkIHRvIHRoZSB0b3BpY1xyXG4gICAgICAgICAgICB2YXIgbGlzdGVuZXJzID0gdGhpcy50b3BpY3MuZ2V0KHRvcGljKTtcclxuICAgICAgICAgICAgaWYgKGxpc3RlbmVycykge1xyXG4gICAgICAgICAgICAgICAgLy8gcmVxdWVzdCBsaXN0ZW5lciB3aXRoIHRoZSB0b2tlblxyXG4gICAgICAgICAgICAgICAgdmFyIGxpc3RlbmVyID0gbGlzdGVuZXJzLmdldCh0b2tlbik7XHJcbiAgICAgICAgICAgICAgICBpZiAobGlzdGVuZXIpXHJcbiAgICAgICAgICAgICAgICAgICAgLy8gcmV0dXJuIHRoZSBsaXN0ZW5lciBpZiBpdCBpcyBkZWZpbmVkXHJcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGxpc3RlbmVyO1xyXG4gICAgICAgICAgICAgICAgZWxzZVxyXG4gICAgICAgICAgICAgICAgICAgIC8vIHJldHVybiBlcnJvciBpZiBpdCBpcyBub3QgZGVmaW5lZFxyXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBub3RFeGlzdFJlcG9ydCh0b2tlbiwgdGhpcy5pZCk7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgZWxzZVxyXG4gICAgICAgICAgICAgICAgLy8gcmV0dXJuIGVycm9yIGlmIHRvcGljIGlzIGVtcHR5XHJcbiAgICAgICAgICAgICAgICByZXR1cm4gbmV3IEV2ZW50RXJyb3IoXCJFdmVudGVyIHdpdGggXCIgKyB0b2tlbi5vd25lckluZGV4ICsgXCIgZG9lcyBub3QgaGF2ZSBcIiArIHRvcGljICsgXCIuXCIpO1xyXG4gICAgICAgIH1cclxuICAgICAgICBlbHNlIHtcclxuICAgICAgICAgICAgdHJ5IHtcclxuICAgICAgICAgICAgICAgIC8vaXRlcmF0ZSBvdmVyIGFsbCB0b3BpY3NcclxuICAgICAgICAgICAgICAgIGZvciAodmFyIF9iID0gX192YWx1ZXModGhpcy50b3BpY3MpLCBfYyA9IF9iLm5leHQoKTsgIV9jLmRvbmU7IF9jID0gX2IubmV4dCgpKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgdmFyIF9kID0gX19yZWFkKF9jLnZhbHVlLCAyKSwgXyA9IF9kWzBdLCBsaXN0ZW5lcnMgPSBfZFsxXTtcclxuICAgICAgICAgICAgICAgICAgICAvL2NoZWNrIGlmIGl0IGhhcyBsaXN0ZW5lciB3aXRoIGRlc2lyZWQgdG9rZW5cclxuICAgICAgICAgICAgICAgICAgICB2YXIgbGlzdGVuZXIgPSBsaXN0ZW5lcnMuZ2V0KHRva2VuKTtcclxuICAgICAgICAgICAgICAgICAgICBpZiAobGlzdGVuZXIpXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIC8vcmV0dXJuIHRoZSBsaXN0ZW5lclxyXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbGlzdGVuZXI7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgY2F0Y2ggKGVfMV8xKSB7IGVfMSA9IHsgZXJyb3I6IGVfMV8xIH07IH1cclxuICAgICAgICAgICAgZmluYWxseSB7XHJcbiAgICAgICAgICAgICAgICB0cnkge1xyXG4gICAgICAgICAgICAgICAgICAgIGlmIChfYyAmJiAhX2MuZG9uZSAmJiAoX2EgPSBfYi5yZXR1cm4pKSBfYS5jYWxsKF9iKTtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAg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l0aCB0aGUgdG9rZW4gZXhpc3RhbmNlXHJcbiAgICAgICAgICAgICAgICBpZiAobGlzdGVuZXJzLmRlbGV0ZSh0b2tlbikpXHJcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7XHJcbiAgICAgICAgICAgIC8vIHJldHVybiBmYWxzZSB3aXRoIHRoZSB0b3BpYyBkb2VzIG5vdCBjb250YWluIGxpc3RlbmVyIHdpdGggc3BlY2lmaWVkIHRva2VuXHJcbiAgICAgICAgICAgIHJldHVybiBmYWxzZTtcclxuICAgICAgICB9XHJcbiAgICAgICAgZWxzZSB7XHJcbiAgICAgICAgICAgIHRyeSB7XHJcbiAgICAgICAgICAgICAgICAvL2l0YXJhdGUgb3ZlciBhbGwgdG9waWNzXHJcbiAgICAgICAgICAgICAgICBmb3IgKHZhciBfYiA9IF9fdmFsdWVzKHRoaXMudG9waWNzKSwgX2MgPSBfYi5uZXh0KCk7ICFfYy5kb25lOyBfYyA9IF9iLm5leHQoKSkge1xyXG4gICAgICAgICAgICAgICAgICAgIHZhciBfZCA9IF9fcmVhZChfYy52YWx1ZSwgMiksIF8gPSBfZFswXSwgbGlzdGVuZXJzID0gX2RbMV07XHJcbiAgICAgICAgICAgICAgICAgICAgLy8gY2hlY2sgbGlzdGVuZXIgd2l0aCB0aGUgdG9rZW4gZXhpc3RhbmNlXHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKGxpc3RlbmVycy5kZWxldGUodG9rZW4pKVxyXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBjYXRjaCAoZV8yXzEpIHsgZV8yID0geyBlcnJvcjogZV8yXzEgfTsgfVxyXG4gICAgICAgICAgICBmaW5hbGx5IHtcclxuICAgICAgICAgICAgICAgIHRyeSB7XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKF9jICYmICFfYy5kb25lICYmIChfYSA9I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yT2ZMaXN0ZW5lcnMrKztcclxuICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgfVxyXG4gICAgICAgIHJldHVybiBudW1iZXJPZkxpc3RlbmVycztcclxuICAgIH07XHJcbiAgICAvKipcclxuICAgICAqIEdldCBBbGwgbGlzdGVuZXJzIGF0IHRoZSB0b3BpY1xyXG4gICAgICogQHBhcmFtIHRvcGljIFRvcGljIG5hbWVcclxuICAgICAqL1xyXG4gICAgRXZlbnRlci5wcm90b3R5cGUubGlzdGVuZXJzID0gZnVuY3Rpb24gKHRvcGljKSB7XHJcbiAgICAgICAgdmFyIGxpc3RlbmVycyA9IHRoaXMudG9waWNzLmdldCh0b3BpYyk7XHJcbiAgICAgICAgaWYgKGxpc3RlbmVycylcclxuICAgICAgICAgICAgcmV0dXJuIGxpc3RlbmVycztcclxuICAgICAgICBlbHNlXHJcbiAgICAgICAgICAgIHJldHVybiBuZXcgTWFwKCk7XHJcbiAgICB9O1xyXG4gICAgcmV0dXJuIEV2ZW50ZXI7XHJcbn0oKSk7XG5cbmV4cG9ydCB7IEV2ZW50RXJyb3IsIEV2ZW50ZXIsIFRva2VuIH07XG4vLyMgc291cmNlTWFwcGluZ1VSTD1ldmVudGVyLmVzLmpzLm1hcFxuIl0sInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///1\n')},,function(module,exports,__webpack_require__){"use strict";eval('\n\n/*\n MIT License http://www.opensource.org/licenses/mit-license.php\n Author Tobias Koppers @sokra\n*/\n// css base code, injected by the css-loader\n// eslint-disable-next-line func-names\nmodule.exports = function (useSourceMap) {\n var list = []; // return the list of modules as css string\n\n list.toString = function toString() {\n return this.map(function (item) {\n var content = cssWithMappingToString(item, useSourceMap);\n\n if (item[2]) {\n return "@media ".concat(item[2], " {").concat(content, "}");\n }\n\n return content;\n }).join(\'\');\n }; // import a list of modules into the list\n // eslint-disable-next-line func-names\n\n\n list.i = function (modules, mediaQuery, dedupe) {\n if (typeof modules === \'string\') {\n // eslint-disable-next-line no-param-reassign\n modules = [[null, modules, \'\']];\n }\n\n var alreadyImportedModules = {};\n\n if (dedupe) {\n for (var i = 0; i < this.length; i++) {\n // eslint-disable-next-line prefer-destructuring\n var id = this[i][0];\n\n if (id != null) {\n alreadyImportedModules[id] = true;\n }\n }\n }\n\n for (var _i = 0; _i < modules.length; _i++) {\n var item = [].concat(modules[_i]);\n\n if (dedupe && alreadyImportedModules[item[0]]) {\n // eslint-disable-next-line no-continue\n continue;\n }\n\n if (mediaQuery) {\n if (!item[2]) {\n item[2] = mediaQuery;\n } else {\n item[2] = "".concat(mediaQuery, " and ").concat(item[2]);\n }\n }\n\n list.push(item);\n }\n };\n\n return list;\n};\n\nfunction cssWithMappingToString(item, useSourceMap) {\n var content = item[1] || \'\'; // eslint-disable-next-line prefer-destructuring\n\n var cssMapping = item[3];\n\n if (!cssMapping) {\n return content;\n }\n\n if (useSourceMap && typeof btoa === \'function\') {\n var sourceMapping = toComment(cssMapping);\n var sourceURLs = cssMapping.sources.map(function (source) {\n return "/*# sourceURL=".concat(cssMapping.sourceRoot || \'\').concat(source, " */");\n });\n return [content].concat(sourceURLs).concat([sourceMapping]).join(\'\\n\');\n }\n\n return [content].join(\'\\n\');\n} // Adapted from convert-source-map (MIT)\n\n\nfunction toComment(sourceMap) {\n // eslint-disable-next-line no-undef\n var base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));\n var data = "sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(base64);\n return "/*# ".concat(data, " */");\n}//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY3NzLWxvYWRlci9kaXN0L3J1bnRpbWUvYXBpLmpzPzI0ZmIiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQWE7O0FBRWI7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7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dmdW5jdGlvbicpIHtcbiAgICB2YXIgc291cmNlTWFwcGluZyA9IHRvQ29tbWVudChjc3NNYXBwaW5nKTtcbiAgICB2YXIgc291cmNlVVJMcyA9IGNzc01hcHBpbmcuc291cmNlcy5tYXAoZnVuY3Rpb24gKHNvdXJjZSkge1xuICAgICAgcmV0dXJuIFwiLyojIHNvdXJjZVVSTD1cIi5jb25jYXQoY3NzTWFwcGluZy5zb3VyY2VSb290IHx8ICcnKS5jb25jYXQoc291cmNlLCBcIiAqL1wiKTtcbiAgICB9KTtcbiAgICByZXR1cm4gW2NvbnRlbnRdLmNvbmNhdChzb3VyY2VVUkxzKS5jb25jYXQoW3NvdXJjZU1hcHBpbmddKS5qb2luKCdcXG4nKTtcbiAgfVxuXG4gIHJldHVybiBbY29udGVudF0uam9pbignXFxuJyk7XG59IC8vIEFkYXB0ZWQgZnJvbSBjb252ZXJ0LXNvdXJjZS1tYXAgKE1JVClcblxuXG5mdW5jdGlvbiB0b0NvbW1lbnQoc291cmNlTWFwKSB7XG4gIC8vIGVzbGludC1kaXNhYmxlLW5leHQtbGluZSBuby11bmRlZlxuICB2YXIgYmFzZTY0ID0gYnRvYSh1bmVzY2FwZShlbmNvZGVVUklDb21wb25lbnQoSlNPTi5zdHJpbmdpZnkoc291cmNlTWFwKSkpKTtcbiAgdmFyIGRhdGEgPSBcInNvdXJjZU1hcHBpbmdVUkw9ZGF0YTphcHBsaWNhdGlvbi9qc29uO2NoYXJzZXQ9dXRmLTg7YmFzZTY0LFwiLmNvbmNhdChiYXNlNjQpO1xuICByZXR1cm4gXCIvKiMgXCIuY29uY2F0KGRhdGEsIFwiICovXCIpO1xufSJdLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///3\n')},function(module,exports,__webpack_require__){"use strict";eval("\n\nmodule.exports = earcut;\nmodule.exports.default = earcut;\n\nfunction earcut(data, holeIndices, dim) {\n\n dim = dim || 2;\n\n var hasHoles = holeIndices && holeIndices.length,\n outerLen = hasHoles ? holeIndices[0] * dim : data.length,\n outerNode = linkedList(data, 0, outerLen, dim, true),\n triangles = [];\n\n if (!outerNode || outerNode.next === outerNode.prev) return triangles;\n\n var minX, minY, maxX, maxY, x, y, invSize;\n\n if (hasHoles) outerNode = eliminateHoles(data, holeIndices, outerNode, dim);\n\n // if the shape is not too simple, we'll use z-order curve hash later; calculate polygon bbox\n if (data.length > 80 * dim) {\n minX = maxX = data[0];\n minY = maxY = data[1];\n\n for (var i = dim; i < outerLen; i += dim) {\n x = data[i];\n y = data[i + 1];\n if (x < minX) minX = x;\n if (y < minY) minY = y;\n if (x > maxX) maxX = x;\n if (y > maxY) maxY = y;\n }\n\n // minX, minY and invSize are later used to transform coords into integers for z-order calculation\n invSize = Math.max(maxX - minX, maxY - minY);\n invSize = invSize !== 0 ? 1 / invSize : 0;\n }\n\n earcutLinked(outerNode, triangles, dim, minX, minY, invSize);\n\n return triangles;\n}\n\n// create a circular doubly linked list from polygon points in the specified winding order\nfunction linkedList(data, start, end, dim, clockwise) {\n var i, last;\n\n if (clockwise === (signedArea(data, start, end, dim) > 0)) {\n for (i = start; i < end; i += dim) last = insertNode(i, data[i], data[i + 1], last);\n } else {\n for (i = end - dim; i >= start; i -= dim) last = insertNode(i, data[i], data[i + 1], last);\n }\n\n if (last && equals(last, last.next)) {\n removeNode(last);\n last = last.next;\n }\n\n return last;\n}\n\n// eliminate colinear or duplicate points\nfunction filterPoints(start, end) {\n if (!start) return start;\n if (!end) end = start;\n\n var p = start,\n again;\n do {\n again = false;\n\n if (!p.steiner && (equals(p, p.next) || area(p.prev, p, p.next) === 0)) {\n removeNode(p);\n p = end = p.prev;\n if (p === p.next) break;\n again = true;\n\n } else {\n p = p.next;\n }\n } while (again || p !== end);\n\n return end;\n}\n\n// main ear slicing loop which triangulates a polygon (given as a linked list)\nfunction earcutLinked(ear, triangles, dim, minX, minY, invSize, pass) {\n if (!ear) return;\n\n // interlink polygon nodes in z-order\n if (!pass && invSize) indexCurve(ear, minX, minY, invSize);\n\n var stop = ear,\n prev, next;\n\n // iterate through ears, slicing them one by one\n while (ear.prev !== ear.next) {\n prev = ear.prev;\n next = ear.next;\n\n if (invSize ? isEarHashed(ear, minX, minY, invSize) : isEar(ear)) {\n // cut off the triangle\n triangles.push(prev.i / dim);\n triangles.push(ear.i / dim);\n triangles.push(next.i / dim);\n\n removeNode(ear);\n\n // skipping the next vertex leads to less sliver triangles\n ear = next.next;\n stop = next.next;\n\n continue;\n }\n\n ear = next;\n\n // if we looped through the whole remaining polygon and can't find any more ears\n if (ear === stop) {\n // try filtering points and slicing again\n if (!pass) {\n earcutLinked(filterPoints(ear), triangles, dim, minX, minY, invSize, 1);\n\n // if this didn't work, try curing all small self-intersections locally\n } else if (pass === 1) {\n ear = cureLocalIntersections(filterPoints(ear), triangles, dim);\n earcutLinked(ear, triangles, dim, minX, minY, invSize, 2);\n\n // as a last resort, try splitting the remaining polygon into two\n } else if (pass === 2) {\n splitEarcut(ear, triangles, dim, minX, minY, invSize);\n }\n\n break;\n }\n }\n}\n\n// check whether a polygon node forms a valid ear with adjacent nodes\nfunction isEar(ear) {\n var a = ear.prev,\n b = ear,\n c = ear.next;\n\n if (area(a, b, c) >= 0) return false; // reflex, can't be an ear\n\n // now make sure we don't have other points inside the potential ear\n var p = ear.next.next;\n\n while (p !== ear.prev) {\n if (pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) &&\n area(p.prev, p, p.next) >= 0) return false;\n p = p.next;\n }\n\n return true;\n}\n\nfunction isEarHashed(ear, minX, minY, invSize) {\n var a = ear.prev,\n b = ear,\n c = ear.next;\n\n if (area(a, b, c) >= 0) return false; // reflex, can't be an ear\n\n // triangle bbox; min & max are calculated like this for speed\n var minTX = a.x < b.x ? (a.x < c.x ? a.x : c.x) : (b.x < c.x ? b.x : c.x),\n minTY = a.y < b.y ? (a.y < c.y ? a.y : c.y) : (b.y < c.y ? b.y : c.y),\n maxTX = a.x > b.x ? (a.x > c.x ? a.x : c.x) : (b.x > c.x ? b.x : c.x),\n maxTY = a.y > b.y ? (a.y > c.y ? a.y : c.y) : (b.y > c.y ? b.y : c.y);\n\n // z-order range for the current triangle bbox;\n var minZ = zOrder(minTX, minTY, minX, minY, invSize),\n maxZ = zOrder(maxTX, maxTY, minX, minY, invSize);\n\n var p = ear.prevZ,\n n = ear.nextZ;\n\n // look for points inside the triangle in both directions\n while (p && p.z >= minZ && n && n.z <= maxZ) {\n if (p !== ear.prev && p !== ear.next &&\n pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) &&\n area(p.prev, p, p.next) >= 0) return false;\n p = p.prevZ;\n\n if (n !== ear.prev && n !== ear.next &&\n pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, n.x, n.y) &&\n area(n.prev, n, n.next) >= 0) return false;\n n = n.nextZ;\n }\n\n // look for remaining points in decreasing z-order\n while (p && p.z >= minZ) {\n if (p !== ear.prev && p !== ear.next &&\n pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) &&\n area(p.prev, p, p.next) >= 0) return false;\n p = p.prevZ;\n }\n\n // look for remaining points in increasing z-order\n while (n && n.z <= maxZ) {\n if (n !== ear.prev && n !== ear.next &&\n pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, n.x, n.y) &&\n area(n.prev, n, n.next) >= 0) return false;\n n = n.nextZ;\n }\n\n return true;\n}\n\n// go through all polygon nodes and cure small local self-intersections\nfunction cureLocalIntersections(start, triangles, dim) {\n var p = start;\n do {\n var a = p.prev,\n b = p.next.next;\n\n if (!equals(a, b) && intersects(a, p, p.next, b) && locallyInside(a, b) && locallyInside(b, a)) {\n\n triangles.push(a.i / dim);\n triangles.push(p.i / dim);\n triangles.push(b.i / dim);\n\n // remove two nodes involved\n removeNode(p);\n removeNode(p.next);\n\n p = start = b;\n }\n p = p.next;\n } while (p !== start);\n\n return filterPoints(p);\n}\n\n// try splitting polygon into two and triangulate them independently\nfunction splitEarcut(start, triangles, dim, minX, minY, invSize) {\n // look for a valid diagonal that divides the polygon into two\n var a = start;\n do {\n var b = a.next.next;\n while (b !== a.prev) {\n if (a.i !== b.i && isValidDiagonal(a, b)) {\n // split the polygon in two by the diagonal\n var c = splitPolygon(a, b);\n\n // filter colinear points around the cuts\n a = filterPoints(a, a.next);\n c = filterPoints(c, c.next);\n\n // run earcut on each half\n earcutLinked(a, triangles, dim, minX, minY, invSize);\n earcutLinked(c, triangles, dim, minX, minY, invSize);\n return;\n }\n b = b.next;\n }\n a = a.next;\n } while (a !== start);\n}\n\n// link every hole into the outer loop, producing a single-ring polygon without holes\nfunction eliminateHoles(data, holeIndices, outerNode, dim) {\n var queue = [],\n i, len, start, end, list;\n\n for (i = 0, len = holeIndices.length; i < len; i++) {\n start = holeIndices[i] * dim;\n end = i < len - 1 ? holeIndices[i + 1] * dim : data.length;\n list = linkedList(data, start, end, dim, false);\n if (list === list.next) list.steiner = true;\n queue.push(getLeftmost(list));\n }\n\n queue.sort(compareX);\n\n // process holes from left to right\n for (i = 0; i < queue.length; i++) {\n outerNode = eliminateHole(queue[i], outerNode);\n outerNode = filterPoints(outerNode, outerNode.next);\n }\n\n return outerNode;\n}\n\nfunction compareX(a, b) {\n return a.x - b.x;\n}\n\n// find a bridge between vertices that connects hole with an outer ring and and link it\nfunction eliminateHole(hole, outerNode) {\n var bridge = findHoleBridge(hole, outerNode);\n if (!bridge) {\n return outerNode;\n }\n\n var bridgeReverse = splitPolygon(bridge, hole);\n\n // filter collinear points around the cuts\n var filteredBridge = filterPoints(bridge, bridge.next);\n filterPoints(bridgeReverse, bridgeReverse.next);\n\n // Check if input node was removed by the filtering\n return outerNode === bridge ? filteredBridge : outerNode;\n}\n\n// David Eberly's algorithm for finding a bridge between hole and outer polygon\nfunction findHoleBridge(hole, outerNode) {\n var p = outerNode,\n hx = hole.x,\n hy = hole.y,\n qx = -Infinity,\n m;\n\n // find a segment intersected by a ray from the hole's leftmost point to the left;\n // segment's endpoint with lesser x will be potential connection point\n do {\n if (hy <= p.y && hy >= p.next.y && p.next.y !== p.y) {\n var x = p.x + (hy - p.y) * (p.next.x - p.x) / (p.next.y - p.y);\n if (x <= hx && x > qx) {\n qx = x;\n if (x === hx) {\n if (hy === p.y) return p;\n if (hy === p.next.y) return p.next;\n }\n m = p.x < p.next.x ? p : p.next;\n }\n }\n p = p.next;\n } while (p !== outerNode);\n\n if (!m) return null;\n\n if (hx === qx) return m; // hole touches outer segment; pick leftmost endpoint\n\n // look for points inside the triangle of hole point, segment intersection and endpoint;\n // if there are no points found, we have a valid connection;\n // otherwise choose the point of the minimum angle with the ray as connection point\n\n var stop = m,\n mx = m.x,\n my = m.y,\n tanMin = Infinity,\n tan;\n\n p = m;\n\n do {\n if (hx >= p.x && p.x >= mx && hx !== p.x &&\n pointInTriangle(hy < my ? hx : qx, hy, mx, my, hy < my ? qx : hx, hy, p.x, p.y)) {\n\n tan = Math.abs(hy - p.y) / (hx - p.x); // tangential\n\n if (locallyInside(p, hole) &&\n (tan < tanMin || (tan === tanMin && (p.x > m.x || (p.x === m.x && sectorContainsSector(m, p)))))) {\n m = p;\n tanMin = tan;\n }\n }\n\n p = p.next;\n } while (p !== stop);\n\n return m;\n}\n\n// whether sector in vertex m contains sector in vertex p in the same coordinates\nfunction sectorContainsSector(m, p) {\n return area(m.prev, m, p.prev) < 0 && area(p.next, m, m.next) < 0;\n}\n\n// interlink polygon nodes in z-order\nfunction indexCurve(start, minX, minY, invSize) {\n var p = start;\n do {\n if (p.z === null) p.z = zOrder(p.x, p.y, minX, minY, invSize);\n p.prevZ = p.prev;\n p.nextZ = p.next;\n p = p.next;\n } while (p !== start);\n\n p.prevZ.nextZ = null;\n p.prevZ = null;\n\n sortLinked(p);\n}\n\n// Simon Tatham's linked list merge sort algorithm\n// http://www.chiark.greenend.org.uk/~sgtatham/algorithms/listsort.html\nfunction sortLinked(list) {\n var i, p, q, e, tail, numMerges, pSize, qSize,\n inSize = 1;\n\n do {\n p = list;\n list = null;\n tail = null;\n numMerges = 0;\n\n while (p) {\n numMerges++;\n q = p;\n pSize = 0;\n for (i = 0; i < inSize; i++) {\n pSize++;\n q = q.nextZ;\n if (!q) break;\n }\n qSize = inSize;\n\n while (pSize > 0 || (qSize > 0 && q)) {\n\n if (pSize !== 0 && (qSize === 0 || !q || p.z <= q.z)) {\n e = p;\n p = p.nextZ;\n pSize--;\n } else {\n e = q;\n q = q.nextZ;\n qSize--;\n }\n\n if (tail) tail.nextZ = e;\n else list = e;\n\n e.prevZ = tail;\n tail = e;\n }\n\n p = q;\n }\n\n tail.nextZ = null;\n inSize *= 2;\n\n } while (numMerges > 1);\n\n return list;\n}\n\n// z-order of a point given coords and inverse of the longer side of data bbox\nfunction zOrder(x, y, minX, minY, invSize) {\n // coords are transformed into non-negative 15-bit integer range\n x = 32767 * (x - minX) * invSize;\n y = 32767 * (y - minY) * invSize;\n\n x = (x | (x << 8)) & 0x00FF00FF;\n x = (x | (x << 4)) & 0x0F0F0F0F;\n x = (x | (x << 2)) & 0x33333333;\n x = (x | (x << 1)) & 0x55555555;\n\n y = (y | (y << 8)) & 0x00FF00FF;\n y = (y | (y << 4)) & 0x0F0F0F0F;\n y = (y | (y << 2)) & 0x33333333;\n y = (y | (y << 1)) & 0x55555555;\n\n return x | (y << 1);\n}\n\n// find the leftmost node of a polygon ring\nfunction getLeftmost(start) {\n var p = start,\n leftmost = start;\n do {\n if (p.x < leftmost.x || (p.x === leftmost.x && p.y < leftmost.y)) leftmost = p;\n p = p.next;\n } while (p !== start);\n\n return leftmost;\n}\n\n// check if a point lies within a convex triangle\nfunction pointInTriangle(ax, ay, bx, by, cx, cy, px, py) {\n return (cx - px) * (ay - py) - (ax - px) * (cy - py) >= 0 &&\n (ax - px) * (by - py) - (bx - px) * (ay - py) >= 0 &&\n (bx - px) * (cy - py) - (cx - px) * (by - py) >= 0;\n}\n\n// check if a diagonal between two polygon nodes is valid (lies in polygon interior)\nfunction isValidDiagonal(a, b) {\n return a.next.i !== b.i && a.prev.i !== b.i && !intersectsPolygon(a, b) && // dones't intersect other edges\n (locallyInside(a, b) && locallyInside(b, a) && middleInside(a, b) && // locally visible\n (area(a.prev, a, b.prev) || area(a, b.prev, b)) || // does not create opposite-facing sectors\n equals(a, b) && area(a.prev, a, a.next) > 0 && area(b.prev, b, b.next) > 0); // special zero-length case\n}\n\n// signed area of a triangle\nfunction area(p, q, r) {\n return (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y);\n}\n\n// check if two points are equal\nfunction equals(p1, p2) {\n return p1.x === p2.x && p1.y === p2.y;\n}\n\n// check if two segments intersect\nfunction intersects(p1, q1, p2, q2) {\n var o1 = sign(area(p1, q1, p2));\n var o2 = sign(area(p1, q1, q2));\n var o3 = sign(area(p2, q2, p1));\n var o4 = sign(area(p2, q2, q1));\n\n if (o1 !== o2 && o3 !== o4) return true; // general case\n\n if (o1 === 0 && onSegment(p1, p2, q1)) return true; // p1, q1 and p2 are collinear and p2 lies on p1q1\n if (o2 === 0 && onSegment(p1, q2, q1)) return true; // p1, q1 and q2 are collinear and q2 lies on p1q1\n if (o3 === 0 && onSegment(p2, p1, q2)) return true; // p2, q2 and p1 are collinear and p1 lies on p2q2\n if (o4 === 0 && onSegment(p2, q1, q2)) return true; // p2, q2 and q1 are collinear and q1 lies on p2q2\n\n return false;\n}\n\n// for collinear points p, q, r, check if point q lies on segment pr\nfunction onSegment(p, q, r) {\n return q.x <= Math.max(p.x, r.x) && q.x >= Math.min(p.x, r.x) && q.y <= Math.max(p.y, r.y) && q.y >= Math.min(p.y, r.y);\n}\n\nfunction sign(num) {\n return num > 0 ? 1 : num < 0 ? -1 : 0;\n}\n\n// check if a polygon diagonal intersects any polygon segments\nfunction intersectsPolygon(a, b) {\n var p = a;\n do {\n if (p.i !== a.i && p.next.i !== a.i && p.i !== b.i && p.next.i !== b.i &&\n intersects(p, p.next, a, b)) return true;\n p = p.next;\n } while (p !== a);\n\n return false;\n}\n\n// check if a polygon diagonal is locally inside the polygon\nfunction locallyInside(a, b) {\n return area(a.prev, a, a.next) < 0 ?\n area(a, b, a.next) >= 0 && area(a, a.prev, b) >= 0 :\n area(a, b, a.prev) < 0 || area(a, a.next, b) < 0;\n}\n\n// check if the middle point of a polygon diagonal is inside the polygon\nfunction middleInside(a, b) {\n var p = a,\n inside = false,\n px = (a.x + b.x) / 2,\n py = (a.y + b.y) / 2;\n do {\n if (((p.y > py) !== (p.next.y > py)) && p.next.y !== p.y &&\n (px < (p.next.x - p.x) * (py - p.y) / (p.next.y - p.y) + p.x))\n inside = !inside;\n p = p.next;\n } while (p !== a);\n\n return inside;\n}\n\n// link two polygon vertices with a bridge; if the vertices belong to the same ring, it splits polygon into two;\n// if one belongs to the outer ring and another to a hole, it merges it into a single ring\nfunction splitPolygon(a, b) {\n var a2 = new Node(a.i, a.x, a.y),\n b2 = new Node(b.i, b.x, b.y),\n an = a.next,\n bp = b.prev;\n\n a.next = b;\n b.prev = a;\n\n a2.next = an;\n an.prev = a2;\n\n b2.next = a2;\n a2.prev = b2;\n\n bp.next = b2;\n b2.prev = bp;\n\n return b2;\n}\n\n// create a node and optionally link it with previous one (in a circular doubly linked list)\nfunction insertNode(i, x, y, last) {\n var p = new Node(i, x, y);\n\n if (!last) {\n p.prev = p;\n p.next = p;\n\n } else {\n p.next = last.next;\n p.prev = last;\n last.next.prev = p;\n last.next = p;\n }\n return p;\n}\n\nfunction removeNode(p) {\n p.next.prev = p.prev;\n p.prev.next = p.next;\n\n if (p.prevZ) p.prevZ.nextZ = p.nextZ;\n if (p.nextZ) p.nextZ.prevZ = p.prevZ;\n}\n\nfunction Node(i, x, y) {\n // vertex index in coordinates array\n this.i = i;\n\n // vertex coordinates\n this.x = x;\n this.y = y;\n\n // previous and next vertex nodes in a polygon ring\n this.prev = null;\n this.next = null;\n\n // z-order curve value\n this.z = null;\n\n // previous and next nodes in z-order\n this.prevZ = null;\n this.nextZ = null;\n\n // indicates whether this is a steiner point\n this.steiner = false;\n}\n\n// return a percentage difference between the polygon area and its triangulation area;\n// used to verify correctness of triangulation\nearcut.deviation = function (data, holeIndices, dim, triangles) {\n var hasHoles = holeIndices && holeIndices.length;\n var outerLen = hasHoles ? holeIndices[0] * dim : data.length;\n\n var polygonArea = Math.abs(signedArea(data, 0, outerLen, dim));\n if (hasHoles) {\n for (var i = 0, len = holeIndices.length; i < len; i++) {\n var start = holeIndices[i] * dim;\n var end = i < len - 1 ? holeIndices[i + 1] * dim : data.length;\n polygonArea -= Math.abs(signedArea(data, start, end, dim));\n }\n }\n\n var trianglesArea = 0;\n for (i = 0; i < triangles.length; i += 3) {\n var a = triangles[i] * dim;\n var b = triangles[i + 1] * dim;\n var c = triangles[i + 2] * dim;\n trianglesArea += Math.abs(\n (data[a] - data[c]) * (data[b + 1] - data[a + 1]) -\n (data[a] - data[b]) * (data[c + 1] - data[a + 1]));\n }\n\n return polygonArea === 0 && trianglesArea === 0 ? 0 :\n Math.abs((trianglesArea - polygonArea) / polygonArea);\n};\n\nfunction signedArea(data, start, end, dim) {\n var sum = 0;\n for (var i = start, j = end - dim; i < end; i += dim) {\n sum += (data[j] - data[i]) * (data[i + 1] + data[j + 1]);\n j = i;\n }\n return sum;\n}\n\n// turn a polygon in a multi-dimensional array form (e.g. as in GeoJSON) into a form Earcut accepts\nearcut.flatten = function (data) {\n var dim = data[0][0].length,\n result = {vertices: [], holes: [], dimensions: dim},\n holeIndex = 0;\n\n for (var i = 0; i < data.length; i++) {\n for (var j = 0; j < data[i].length; j++) {\n for (var d = 0; d < dim; d++) result.vertices.push(data[i][j][d]);\n }\n if (i > 0) {\n holeIndex += data[i - 1].length;\n result.holes.push(holeIndex);\n }\n }\n return result;\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvZWFyY3V0L3NyYy9lYXJjdXQuanM/NTY2NCJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBYT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AgICAgIHAgPSBwLm5leHQ7XG4gICAgfVxuXG4gICAgcmV0dXJuIHRydWU7XG59XG5cbmZ1bmN0aW9uIGlzRWFySGFzaGVkKGVhciwgbWluWCwgbWluWSwgaW52U2l6ZSkge1xuICAgIHZhciBhID0gZWFyLnByZXYsXG4gICAgICAgIGIgPSBlYXIsXG4gICAgICAgIGMgPSBlYXIubmV4dDtcblxuICAgIGlmIChhcmVhKGEsIGIsIGMpID49IDApIHJldHVybiBmYWxzZTsgLy8gcmVmbGV4LCBjYW4ndCBiZSBhbiBlYXJcblxuICAgIC8vIHRyaWFuZ2xlIGJib3g7IG1pbiAmIG1heCBhcmUgY2FsY3VsYXRlZCBsaWtlIHRoaXMgZm9yIHNwZWVkXG4gICAgdmFyIG1pblRYID0gYS54IDwgYi54ID8gKGEueCA8IGMueCA/IGEueCA6IGMueCkgOiAoYi54IDwgYy54ID8gYi54IDogYy54KSxcbiAgICAgICAgbWluVFkgPSBhLnkgPCBiLnkgPyAoYS55IDwgYy55ID8gYS55IDogYy55KSA6IChiLnkgPCBjLnkgPyBiLnkgOiBjLnkpLFxuICAgICAgICBtYXhUWCA9IGEueCA+IGIueCA/IChhLnggPiBjLnggPyBhLnggOiBjLngpIDogKGIueCA+IGMueCA/IGIueCA6IGMueCksXG4gICAgICAgIG1heFRZID0gYS55ID4gYi55ID8gKGEueSA+IGMueSA/IGEueSA6IGMueSkgOiAoYi55ID4gYy55ID8gYi55IDogYy55KTtcblxuICAgIC8vIHotb3JkZXIgcmFuZ2UgZm9yIHRoZSBjdXJyZW50IHRyaWFuZ2xlIGJib3g7XG4gICAgdmFyIG1pblogPSB6T3JkZXIobWluVFgsIG1pblRZLCBtaW5YLCBtaW5ZLCBpbnZTaXplKSxcbiAgICAgICAgbWF4WiA9IHpPcmRlcihtYXhUWCwgbWF4VFksIG1pblgsIG1pblksIGludlNpemUpO1xuXG4gICAgdmFyIHAgPSBlYXIucHJldlosXG4gICAgICAgIG4gPSBlYXIubmV4dFo7XG5cbiAgICAvLyBsb29rIGZvciBwb2ludHMgaW5zaWRlIHRoZSB0cmlhbmdsZSBpbiBib3RoIGRpcmVjdGlvbnNcbiAgICB3aGlsZSAocCAmJiBwLnogPj0gbWluWiAmJiBuICYmIG4ueiA8PSBtYXhaKSB7XG4gICAgICAgIGlmIChwICE9PSBlYXIucHJldiAmJiBwICE9PSBlYXIubmV4dCAmJlxuICAgICAgICAgICAgcG9pbnRJblRyaWFuZ2xlKGEueCwgYS55LCBiLngsIGIueSwgYy54LCBjLnksIHAueCwgcC55KSAmJlxuICAgICAgICAgICAgYXJlYShwLnByZXYsIHAsIHAubmV4dCkgPj0gMCkgcmV0dXJuIGZhbHNlO1xuICAgICAgICBwID0gcC5wcmV2WjtcblxuICAgICAgICBpZiAobiAhPT0gZWFyLnByZXYgJiYgbiAhPT0gZWFyLm5leHQgJiZcbiAgICAgICAgICAgIHBvaW50SW5UcmlhbmdsZShhLngsIGEueSwgYi54LCBiLnksIGMueCwgYy55LCBuLngsIG4ueSkgJiZcbiAgICAgICAgICAgIGFyZWEobi5wcmV2LCBuLCBuLm5leHQpID49IDApIHJldHVybiBmYWxzZTtcbiAgICAgICAgbiA9IG4ubmV4dFo7XG4gICAgfVxuXG4gICAgLy8gbG9vayBmb3IgcmVtYWluaW5nIHBvaW50cyBpbiBkZWNyZWFzaW5nIHotb3JkZXJcbiAgICB3aGlsZSAocCAmJiBwLnogPj0gbWluWikge1xuICAgICAgICBpZiAocCAhPT0gZWFyLnByZXYgJiYgcCAhPT0gZWFyLm5leHQgJiZcbiAgICAgICAgICAgIHBvaW50SW5UcmlhbmdsZShhLngsIGEueSwgYi54LCBiLnksIGMueCwgYy55LCBwLngsIHAueSkgJiZcbiAgICAgICAgICAgIGFyZWEocC5wcmV2LCBwLCBwLm5leHQpID49IDApIHJldHVybiBmYWxzZTtcbiAgICAgICAgcCA9IHAucHJldlo7XG4gICAgfVxuXG4gICAgLy8gbG9vayBmb3IgcmVtYWluaW5nIHBvaW50cyBpb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0ZXJOb2RlO1xufVxuXG4vLyBEYXZpZCBFYmVybHkncyBhbGdvcml0aG0gZm9yIGZpbmRpbmcgYSBicmlkZ2UgYmV0d2VlbiBob2xlIGFuZCBvdXRlciBwb2x5Z29uXG5mdW5jdGlvbiBmaW5kSG9sZUJyaWRnZShob2xlLCBvdXRlck5vZGUpIHtcbiAgICB2YXIgcCA9IG91dGVyTm9kZSxcbiAgICAgICAgaHggPSBob2xlLngsXG4gICAgICAgIGh5ID0gaG9sZS55LFxuICAgICAgICBxeCA9IC1JbmZpbml0eSxcbiAgICAgICAgbTtcblxuICAgIC8vIGZpbmQgYSBzZWdtZW50IGludGVyc2VjdGVkIGJ5IGEgcmF5IGZyb20gdGhlIGhvbGUncyBsZWZ0bW9zdCBwb2ludCB0byB0aGUgbGVmdDtcbiAgICAvLyBzZWdtZW50J3MgZW5kcG9pbnQgd2l0aCBsZXNzZXIgeCB3aWxsIGJlIHBvdGVudGlhbCBjb25uZWN0aW9uIHBvaW50XG4gICAgZG8ge1xuICAgICAgICBpZiAoaHkgPD0gcC55ICYmIGh5ID49IHAubmV4dC55ICYmIHAubmV4dC55ICE9PSBwLnkpIHtcbiAgICAgICAgICAgIHZhciB4ID0gcC54ICsgKGh5IC0gcC55KSAqIChwLm5leHQueCAtIHAueCkgLyAocC5uZXh0LnkgLSBwLnkpO1xuICAgICAgICAgICAgaWYgKHggPD0gaHggJiYgeCA+IHF4KSB7XG4gICAgICAgICAgICAgICAgcXggPSB4O1xuICAgICAgICAgICAgICAgIGlmICh4ID09PSBoeCkge1xuICAgICAgICAgICAgICAgICAgICBpZiAoaHkgPT09IHAueSkgcmV0dXJuIHA7XG4gICAgICAgICAgICAgICAgICAgIGlmIChoeSA9PT0gcC5uZXh0LnkpIHJldHVybiBwLm5leHQ7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIG0gPSBwLnggPCBwLm5leHQueCA/IHAgOiBwLm5leHQ7XG4gICAgICAgICAgICB9XG4gICAgICAgI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Rhbk1pbiB8fCAodGFuID09PSB0YW5NaW4gJiYgKHAueCA+IG0ueCB8fCAocC54ID09PSBtLnggJiYgc2VjdG9yQ29udGFpbnNTZWN0b3IobSwgcCkpKSkpKSB7XG4gICAgICAgICAgICAgICAgbSA9IHA7XG4gICAgICAgICAgICAgICAgdGFuTWluID0gdGFuO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgcCA9IHAubmV4dDtcbiAgICB9IHdoaWxlIChwICE9PSBzdG9wKTtcblxuICAgIHJldHVybiBtO1xufVxuXG4vLyB3aGV0aGVyIHNlY3RvciBpbiB2ZXJ0ZXggbSBjb250YWlucyBzZWN0b3IgaW4gdmVydGV4IHAgaW4gdGhlIHNhbWUgY29vcmRpbmF0ZXNcbmZ1bmN0aW9uIHNlY3RvckNvbnRhaW5zU2VjdG9yKG0sIHApIHtcbiAgICByZXR1cm4gYXJlYShtLnByZXYsIG0sIHAucHJldikgPCAwICYmIGFyZWEocC5uZXh0LCBtLCBtLm5leHQpIDwgMDtcbn1cblxuLy8gaW50ZXJsaW5rIHBvbHlnb24gbm9kZXMgaW4gei1vcmRlclxuZnVuY3Rpb24gaW5kZXhDdXJ2ZShzdGFydCwgbWluWCwgbWluWSwgaW52U2l6ZSkge1xuICAgIHZhciBwID0gc3RhcnQ7XG4gICAgZG8ge1xuICAgICAgICBpZiAocC56ID09PSBudWxsKSBwLnogPSB6T3JkZXIocC54LCBwLnksIG1pblgsIG1pblksIGludlNpemUpO1xuICAgICAgICBwLnByZXZaID0gcC5wcmV2O1xuICAgICAgICBwLm5leHRaID0gcC5uZXh0O1xuICAgICAgICBwID0gcC5uZXh0O1xuICAgIH0gd2hpbGUgKHAgIT09IHN0YXJ0KTtcblxuICAgIHAucHJldloubmV4dFogPSBudWxsO1xuICAgIHAucHJldlogPSBudWxsO1xuXG4gICAgc29ydExpbmtlZChwKTtcbn1cblxuLy8gU2ltb24gVGF0aGFtJ3MgbGlua2VkIGxpc3QgbWVyZ2Ugc29ydCBhbGdvcml0aG1cbi8vIGh0dHA6Ly93d3cuY2hpYXJrLmdyZWVuZW5kLm9yZy51ay9+c2d0YXRoYW0vYWxnb3JpdGhtcy9saXN0c29ydC5odG1sXG5mdW5jdGlvbiBzb3J0TGlua2VkKGxpc3QpIHtcbiAgICB2YXIgaSwgcCwgcSwgZSwgdGFpbCwgbnVtTWVyZ2VzLCBwU2l6ZSwgcVNpemUsXG4gICAgICAgIGluU2l6ZSA9IDE7XG5cbiAgICBkbyB7XG4gICAgICAgIHAgPSBsaXN0O1xuICAgICAgICBsaXN0ID0gbnVsbDtcbiAgICAgICAgdGFpbCA9IG51bGw7XG4gICAgICAgIG51bU1lcmdlcyA9IDA7XG5cbiAgICAgICAgd2hpbGUgKHApIHtcbiAgICAgICAgICAgIG51bU1lcmdlcysrO1xuICAgICAgICAgICAgcSA9IHA7XG4gICAgICAgICAgICBwU2l6ZSA9IDA7XG4gICAgICAgICAgICBmb3IgKGkgPSAwOyBpIDwgaW5TaXplOyBpKyspIHtcbiAgICAgICAgICAgICAgICBwU2l6ZSsrO1xuICAgICAgICAgICAgICAgIHEgPSBxLm5leHRaO1xuICAgICAgICAgICAgICAgIGlmICghcSkgYnJlYWs7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBxU2l6ZSA9IGluU2l6ZTtcblxuICAgICAgICAgICAgd2hpbGUgKHBTaXplID4gMCB8fCAocVNpemUgPiAwICYmIHEpKSB7XG5cbiAgICAgICAgICAgICAgICBpZiAocFNpemUgIT09IDAgJiYgKHFTaXplID09PSAwIHx8ICFxIHx8IHAueiA8PSBxLnopKSB7XG4gICAgICAgICAgICAgICAgICAgIGUgPSBwO1xuICAgICAgICAgICAgICAgICAgICBwID0gcC5uZXh0WjtcbiAgICAgICAgICAgICAgICAgICAgcFNpemUtLTtcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICBlID0gcTtcbiAgICAgICAgICAgICAgICAgICAgcSA9IHEubmV4d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hdGFbaiArIDFdKTtcbiAgICAgICAgaiA9IGk7XG4gICAgfVxuICAgIHJldHVybiBzdW07XG59XG5cbi8vIHR1cm4gYSBwb2x5Z29uIGluIGEgbXVsdGktZGltZW5zaW9uYWwgYXJyYXkgZm9ybSAoZS5nLiBhcyBpbiBHZW9KU09OKSBpbnRvIGEgZm9ybSBFYXJjdXQgYWNjZXB0c1xuZWFyY3V0LmZsYXR0ZW4gPSBmdW5jdGlvbiAoZGF0YSkge1xuICAgIHZhciBkaW0gPSBkYXRhWzBdWzBdLmxlbmd0aCxcbiAgICAgICAgcmVzdWx0ID0ge3ZlcnRpY2VzOiBbXSwgaG9sZXM6IFtdLCBkaW1lbnNpb25zOiBkaW19LFxuICAgICAgICBob2xlSW5kZXggPSAwO1xuXG4gICAgZm9yICh2YXIgaSA9IDA7IGkgPCBkYXRhLmxlbmd0aDsgaSsrKSB7XG4gICAgICAgIGZvciAodmFyIGogPSAwOyBqIDwgZGF0YVtpXS5sZW5ndGg7IGorKykge1xuICAgICAgICAgICAgZm9yICh2YXIgZCA9IDA7IGQgPCBkaW07IGQrKykgcmVzdWx0LnZlcnRpY2VzLnB1c2goZGF0YVtpXVtqXVtkXSk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKGkgPiAwKSB7XG4gICAgICAgICAgICBob2xlSW5kZXggKz0gZGF0YVtpIC0gMV0ubGVuZ3RoO1xuICAgICAgICAgICAgcmVzdWx0LmhvbGVzLnB1c2goaG9sZUluZGV4KTtcbiAgICAgICAgfVxuICAgIH1cbiAgICByZXR1cm4gcmVzdWx0O1xufTtcbiJdLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///4\n")},,,function(module,exports,__webpack_require__){"use strict";eval("\n\nvar isOldIE = function isOldIE() {\n var memo;\n return function memorize() {\n if (typeof memo === 'undefined') {\n // Test for IE <= 9 as proposed by Browserhacks\n // @see http://browserhacks.com/#hack-e71d8692f65334173fee715c222cb805\n // Tests for existence of standard globals is to allow style-loader\n // to operate correctly into non-standard environments\n // @see https://github.com/webpack-contrib/style-loader/issues/177\n memo = Boolean(window && document && document.all && !window.atob);\n }\n\n return memo;\n };\n}();\n\nvar getTarget = function getTarget() {\n var memo = {};\n return function memorize(target) {\n if (typeof memo[target] === 'undefined') {\n var styleTarget = document.querySelector(target); // Special case to return head of iframe instead of iframe itself\n\n if (window.HTMLIFrameElement && styleTarget instanceof window.HTMLIFrameElement) {\n try {\n // This will throw an exception if access to iframe is blocked\n // due to cross-origin restrictions\n styleTarget = styleTarget.contentDocument.head;\n } catch (e) {\n // istanbul ignore next\n styleTarget = null;\n }\n }\n\n memo[target] = styleTarget;\n }\n\n return memo[target];\n };\n}();\n\nvar stylesInDom = [];\n\nfunction getIndexByIdentifier(identifier) {\n var result = -1;\n\n for (var i = 0; i < stylesInDom.length; i++) {\n if (stylesInDom[i].identifier === identifier) {\n result = i;\n break;\n }\n }\n\n return result;\n}\n\nfunction modulesToDom(list, options) {\n var idCountMap = {};\n var identifiers = [];\n\n for (var i = 0; i < list.length; i++) {\n var item = list[i];\n var id = options.base ? item[0] + options.base : item[0];\n var count = idCountMap[id] || 0;\n var identifier = \"\".concat(id, \" \").concat(count);\n idCountMap[id] = count + 1;\n var index = getIndexByIdentifier(identifier);\n var obj = {\n css: item[1],\n media: item[2],\n sourceMap: item[3]\n };\n\n if (index !== -1) {\n stylesInDom[index].references++;\n stylesInDom[index].updater(obj);\n } else {\n stylesInDom.push({\n identifier: identifier,\n updater: addStyle(obj, options),\n references: 1\n });\n }\n\n identifiers.push(identifier);\n }\n\n return identifiers;\n}\n\nfunction insertStyleElement(options) {\n var style = document.createElement('style');\n var attributes = options.attributes || {};\n\n if (typeof attributes.nonce === 'undefined') {\n var nonce = true ? __webpack_require__.nc : undefined;\n\n if (nonce) {\n attributes.nonce = nonce;\n }\n }\n\n Object.keys(attributes).forEach(function (key) {\n style.setAttribute(key, attributes[key]);\n });\n\n if (typeof options.insert === 'function') {\n options.insert(style);\n } else {\n var target = getTarget(options.insert || 'head');\n\n if (!target) {\n throw new Error(\"Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.\");\n }\n\n target.appendChild(style);\n }\n\n return style;\n}\n\nfunction removeStyleElement(style) {\n // istanbul ignore if\n if (style.parentNode === null) {\n return false;\n }\n\n style.parentNode.removeChild(style);\n}\n/* istanbul ignore next */\n\n\nvar replaceText = function replaceText() {\n var textStore = [];\n return function replace(index, replacement) {\n textStore[index] = replacement;\n return textStore.filter(Boolean).join('\\n');\n };\n}();\n\nfunction applyToSingletonTag(style, index, remove, obj) {\n var css = remove ? '' : obj.media ? \"@media \".concat(obj.media, \" {\").concat(obj.css, \"}\") : obj.css; // For old IE\n\n /* istanbul ignore if */\n\n if (style.styleSheet) {\n style.styleSheet.cssText = replaceText(index, css);\n } else {\n var cssNode = document.createTextNode(css);\n var childNodes = style.childNodes;\n\n if (childNodes[index]) {\n style.removeChild(childNodes[index]);\n }\n\n if (childNodes.length) {\n style.insertBefore(cssNode, childNodes[index]);\n } else {\n style.appendChild(cssNode);\n }\n }\n}\n\nfunction applyToTag(style, options, obj) {\n var css = obj.css;\n var media = obj.media;\n var sourceMap = obj.sourceMap;\n\n if (media) {\n style.setAttribute('media', media);\n } else {\n style.removeAttribute('media');\n }\n\n if (sourceMap && btoa) {\n css += \"\\n/*# sourceMappingURL=data:application/json;base64,\".concat(btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))), \" */\");\n } // For old IE\n\n /* istanbul ignore if */\n\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n while (style.firstChild) {\n style.removeChild(style.firstChild);\n }\n\n style.appendChild(document.createTextNode(css));\n }\n}\n\nvar singleton = null;\nvar singletonCounter = 0;\n\nfunction addStyle(obj, options) {\n var style;\n var update;\n var remove;\n\n if (options.singleton) {\n var styleIndex = singletonCounter++;\n style = singleton || (singleton = insertStyleElement(options));\n update = applyToSingletonTag.bind(null, style, styleIndex, false);\n remove = applyToSingletonTag.bind(null, style, styleIndex, true);\n } else {\n style = insertStyleElement(options);\n update = applyToTag.bind(null, style, options);\n\n remove = function remove() {\n removeStyleElement(style);\n };\n }\n\n update(obj);\n return function updateStyle(newObj) {\n if (newObj) {\n if (newObj.css === obj.css && newObj.media === obj.media && newObj.sourceMap === obj.sourceMap) {\n return;\n }\n\n update(obj = newObj);\n } else {\n remove();\n }\n };\n}\n\nmodule.exports = function (list, options) {\n options = options || {}; // Force single-tag solution on IE6-9, which has a hard limit on the # of