From 40bd16910143222068ce930523d94556dc7ac32d Mon Sep 17 00:00:00 2001 From: Patrick Jentsch Date: Thu, 9 Dec 2021 12:50:14 +0100 Subject: [PATCH] Some cleanup (css, html, js) --- app/static/images/server_activity.png | Bin 15805 -> 0 bytes app/static/js/{nopaque => }/App.js | 3 +- .../{nopaque => }/CorpusAnalysis/CQiClient.js | 0 .../CorpusAnalysis/CorpusAnalysisApp.js | 0 .../CorpusAnalysisConcordance.js | 0 .../CorpusAnalysis/CorpusAnalysisReader.js | 0 .../js/{nopaque => }/JobStatusNotifier.js | 0 .../RessourceDisplays/CorpusDisplay.js | 0 .../RessourceDisplays/JobDisplay.js | 0 .../RessourceDisplays/RessourceDisplay.js | 0 .../RessourceLists/CorpusFileList.js | 0 .../RessourceLists/CorpusList.js | 0 .../RessourceLists/JobInputList.js | 0 .../{nopaque => }/RessourceLists/JobList.js | 0 .../RessourceLists/JobResultList.js | 0 .../RessourceLists/QueryResultList.js | 0 .../RessourceLists/RessourceList.js | 0 .../{nopaque => }/RessourceLists/UserList.js | 0 app/static/js/{nopaque => }/UploadForm.js | 0 app/static/js/darkreader.js | 3894 ----------------- app/static/js/jsonpatch.min.js | 36 - app/static/js/list.min.js | 2 - app/static/js/list.min.js.map | 1 - app/static/js/materialize.min.js | 6 - .../modules/corpus_analysis/client/Client.js | 282 -- .../corpus_analysis/client/callbacks.js | 161 - .../corpus_analysis/client/listeners.js | 201 - .../modules/corpus_analysis/model/Results.js | 141 - .../corpus_analysis/view/ResultsView.js | 837 ---- .../modules/corpus_analysis/view/callbacks.js | 244 -- .../modules/corpus_analysis/view/listeners.js | 378 -- .../corpus_analysis/view/scrollToTop.js | 27 - .../modules/corpus_analysis/view/spinner.js | 19 - app/static/js/socket.io.min.js | 7 - app/static/js/socket.io.min.js.map | 1 - app/templates/_scripts.html.j2 | 54 +- app/templates/corpora/analyse_corpus.html.j2 | 10 +- app/templates/materialize/base.html.j2 | 6 +- app/templates/modals/analysis_init.html.j2 | 15 - app/templates/modals/context_modal.html.j2 | 75 - .../modals/export_query_results.html.j2 | 52 - app/templates/modals/query_builder.html.j2 | 18 - .../modals/show_corpus_files.html.j2 | 17 - app/templates/modals/show_metadata.html.j2 | 17 - .../modals/show_text_details.html.j2 | 10 - 45 files changed, 36 insertions(+), 6478 deletions(-) delete mode 100644 app/static/images/server_activity.png rename app/static/js/{nopaque => }/App.js (94%) rename app/static/js/{nopaque => }/CorpusAnalysis/CQiClient.js (100%) rename app/static/js/{nopaque => }/CorpusAnalysis/CorpusAnalysisApp.js (100%) rename app/static/js/{nopaque => }/CorpusAnalysis/CorpusAnalysisConcordance.js (100%) rename app/static/js/{nopaque => }/CorpusAnalysis/CorpusAnalysisReader.js (100%) rename app/static/js/{nopaque => }/JobStatusNotifier.js (100%) rename app/static/js/{nopaque => }/RessourceDisplays/CorpusDisplay.js (100%) rename app/static/js/{nopaque => }/RessourceDisplays/JobDisplay.js (100%) rename app/static/js/{nopaque => }/RessourceDisplays/RessourceDisplay.js (100%) rename app/static/js/{nopaque => }/RessourceLists/CorpusFileList.js (100%) rename app/static/js/{nopaque => }/RessourceLists/CorpusList.js (100%) rename app/static/js/{nopaque => }/RessourceLists/JobInputList.js (100%) rename app/static/js/{nopaque => }/RessourceLists/JobList.js (100%) rename app/static/js/{nopaque => }/RessourceLists/JobResultList.js (100%) rename app/static/js/{nopaque => }/RessourceLists/QueryResultList.js (100%) rename app/static/js/{nopaque => }/RessourceLists/RessourceList.js (100%) rename app/static/js/{nopaque => }/RessourceLists/UserList.js (100%) rename app/static/js/{nopaque => }/UploadForm.js (100%) delete mode 100644 app/static/js/darkreader.js delete mode 100644 app/static/js/jsonpatch.min.js delete mode 100644 app/static/js/list.min.js delete mode 100644 app/static/js/list.min.js.map delete mode 100644 app/static/js/materialize.min.js delete mode 100644 app/static/js/modules/corpus_analysis/client/Client.js delete mode 100644 app/static/js/modules/corpus_analysis/client/callbacks.js delete mode 100644 app/static/js/modules/corpus_analysis/client/listeners.js delete mode 100644 app/static/js/modules/corpus_analysis/model/Results.js delete mode 100644 app/static/js/modules/corpus_analysis/view/ResultsView.js delete mode 100644 app/static/js/modules/corpus_analysis/view/callbacks.js delete mode 100644 app/static/js/modules/corpus_analysis/view/listeners.js delete mode 100644 app/static/js/modules/corpus_analysis/view/scrollToTop.js delete mode 100644 app/static/js/modules/corpus_analysis/view/spinner.js delete mode 100644 app/static/js/socket.io.min.js delete mode 100644 app/static/js/socket.io.min.js.map delete mode 100644 app/templates/modals/analysis_init.html.j2 delete mode 100644 app/templates/modals/context_modal.html.j2 delete mode 100644 app/templates/modals/export_query_results.html.j2 delete mode 100644 app/templates/modals/query_builder.html.j2 delete mode 100644 app/templates/modals/show_corpus_files.html.j2 delete mode 100644 app/templates/modals/show_metadata.html.j2 delete mode 100644 app/templates/modals/show_text_details.html.j2 diff --git a/app/static/images/server_activity.png b/app/static/images/server_activity.png deleted file mode 100644 index e78dc914108b7c956abcb88e90b83ba5371e9645..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 15805 zcmV;uJwn2XP) zaB^>EX>4U6ba`-PAZ2)IW&i+q+O3;svSc@Mh5us}S^~UT4iY9pJJ9m=9aMFb-9ygA zjMR^Orp&znGV_=O%ANoD@9X}Hf31w{a%sJeT0Q^r$RkdE>HhQY^E3GTzQ2EVzR!hU zA9p{Wh&+_|nLdBk@8eX@!$W>jm6l7>!s-8Ng;W@cikm1f;7_PXM5jE)FXl4^Y@YT z*K6l~{`%YE{rv5>we$1)c=~lIoUh*()Zf2d@UD7h^+Pv zIqWdQ4d?w_VKKxUPi*{*amDl=>#4;N*9%J4SGchep6ya6R*R@59*#f965f5syWa|( zJMX|NW8h+ecl^Vb`>O~4ldqo_x>su(g6}`qig88dG{aEj^qp4`kZ`|iTHgA;FZZXs z@qY?zB7)^Db7z9n+vgHi!XLSnUYrxJD?U5_DUHzf_W~>t_bv>EjLyN=kV>e*w-{Rp ztYarWlaa@iqY;5nO5DL+Vv|xOI6dm#yr+ft+F0V}V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HmwNj6Fvx&XWeetm8gVgN$#5j zOYeXlj#hW*)+u}=Nm-)zPg5zC&C2BABJD>fw%}31m&rd9L<+k?m19R!g8fB2!>xm? z{#0y3_#pOL+I$SYJZyV&|CVO3AvJf@2%9-2+Y!Ez${OK%`$Y^~yP-te6+-*N15;qq zFq=Cy+Y`Q#sv6jNO8ER++fu)!nH>T5jP3BI$x8TonKuT;hKTH5-GuHXd{Yjlz?OIs1k>FZ8Xy8}W`=`b z&u-cL-BLwtb-J6Qgl|e6keVxQfVfn#;oMCt zy*xc#ATn5_PoFRpyxmp%D&cqFX>jV2SRqcz()Z4bL4FV#2qXK$r~xpfk7_?9e2JuF z!%tU4jPRvAkviMlyRvw>!N@={&u$dEtFvkwC437!87^IcjH}{?NWUr;&&n#{My2@K z-Zb0Z?jp~RPfs!M?A;T5dkSCo-o3=%JY3W@SHf2)I?n$C)gQ*FRycsl00000NkvXX Hu0mjfo@-!R diff --git a/app/static/js/nopaque/App.js b/app/static/js/App.js similarity index 94% rename from app/static/js/nopaque/App.js rename to app/static/js/App.js index 6e5477a8..3761be8c 100644 --- a/app/static/js/nopaque/App.js +++ b/app/static/js/App.js @@ -71,7 +71,8 @@ class App { usersPatchHandler(patch) { let listener; - this.data = jsonpatch.apply_patch(this.data, patch); + this.data = jsonpatch.applyPatch(this.data, patch).newDocument; + //this.data = jsonpatch.apply_patch(this.data, patch); for (listener of this.eventListeners['users.patch']) {listener(patch);} } } diff --git a/app/static/js/nopaque/CorpusAnalysis/CQiClient.js b/app/static/js/CorpusAnalysis/CQiClient.js similarity index 100% rename from app/static/js/nopaque/CorpusAnalysis/CQiClient.js rename to app/static/js/CorpusAnalysis/CQiClient.js diff --git a/app/static/js/nopaque/CorpusAnalysis/CorpusAnalysisApp.js b/app/static/js/CorpusAnalysis/CorpusAnalysisApp.js similarity index 100% rename from app/static/js/nopaque/CorpusAnalysis/CorpusAnalysisApp.js rename to app/static/js/CorpusAnalysis/CorpusAnalysisApp.js diff --git a/app/static/js/nopaque/CorpusAnalysis/CorpusAnalysisConcordance.js b/app/static/js/CorpusAnalysis/CorpusAnalysisConcordance.js similarity index 100% rename from app/static/js/nopaque/CorpusAnalysis/CorpusAnalysisConcordance.js rename to app/static/js/CorpusAnalysis/CorpusAnalysisConcordance.js diff --git a/app/static/js/nopaque/CorpusAnalysis/CorpusAnalysisReader.js b/app/static/js/CorpusAnalysis/CorpusAnalysisReader.js similarity index 100% rename from app/static/js/nopaque/CorpusAnalysis/CorpusAnalysisReader.js rename to app/static/js/CorpusAnalysis/CorpusAnalysisReader.js diff --git a/app/static/js/nopaque/JobStatusNotifier.js b/app/static/js/JobStatusNotifier.js similarity index 100% rename from app/static/js/nopaque/JobStatusNotifier.js rename to app/static/js/JobStatusNotifier.js diff --git a/app/static/js/nopaque/RessourceDisplays/CorpusDisplay.js b/app/static/js/RessourceDisplays/CorpusDisplay.js similarity index 100% rename from app/static/js/nopaque/RessourceDisplays/CorpusDisplay.js rename to app/static/js/RessourceDisplays/CorpusDisplay.js diff --git a/app/static/js/nopaque/RessourceDisplays/JobDisplay.js b/app/static/js/RessourceDisplays/JobDisplay.js similarity index 100% rename from app/static/js/nopaque/RessourceDisplays/JobDisplay.js rename to app/static/js/RessourceDisplays/JobDisplay.js diff --git a/app/static/js/nopaque/RessourceDisplays/RessourceDisplay.js b/app/static/js/RessourceDisplays/RessourceDisplay.js similarity index 100% rename from app/static/js/nopaque/RessourceDisplays/RessourceDisplay.js rename to app/static/js/RessourceDisplays/RessourceDisplay.js diff --git a/app/static/js/nopaque/RessourceLists/CorpusFileList.js b/app/static/js/RessourceLists/CorpusFileList.js similarity index 100% rename from app/static/js/nopaque/RessourceLists/CorpusFileList.js rename to app/static/js/RessourceLists/CorpusFileList.js diff --git a/app/static/js/nopaque/RessourceLists/CorpusList.js b/app/static/js/RessourceLists/CorpusList.js similarity index 100% rename from app/static/js/nopaque/RessourceLists/CorpusList.js rename to app/static/js/RessourceLists/CorpusList.js diff --git a/app/static/js/nopaque/RessourceLists/JobInputList.js b/app/static/js/RessourceLists/JobInputList.js similarity index 100% rename from app/static/js/nopaque/RessourceLists/JobInputList.js rename to app/static/js/RessourceLists/JobInputList.js diff --git a/app/static/js/nopaque/RessourceLists/JobList.js b/app/static/js/RessourceLists/JobList.js similarity index 100% rename from app/static/js/nopaque/RessourceLists/JobList.js rename to app/static/js/RessourceLists/JobList.js diff --git a/app/static/js/nopaque/RessourceLists/JobResultList.js b/app/static/js/RessourceLists/JobResultList.js similarity index 100% rename from app/static/js/nopaque/RessourceLists/JobResultList.js rename to app/static/js/RessourceLists/JobResultList.js diff --git a/app/static/js/nopaque/RessourceLists/QueryResultList.js b/app/static/js/RessourceLists/QueryResultList.js similarity index 100% rename from app/static/js/nopaque/RessourceLists/QueryResultList.js rename to app/static/js/RessourceLists/QueryResultList.js diff --git a/app/static/js/nopaque/RessourceLists/RessourceList.js b/app/static/js/RessourceLists/RessourceList.js similarity index 100% rename from app/static/js/nopaque/RessourceLists/RessourceList.js rename to app/static/js/RessourceLists/RessourceList.js diff --git a/app/static/js/nopaque/RessourceLists/UserList.js b/app/static/js/RessourceLists/UserList.js similarity index 100% rename from app/static/js/nopaque/RessourceLists/UserList.js rename to app/static/js/RessourceLists/UserList.js diff --git a/app/static/js/nopaque/UploadForm.js b/app/static/js/UploadForm.js similarity index 100% rename from app/static/js/nopaque/UploadForm.js rename to app/static/js/UploadForm.js diff --git a/app/static/js/darkreader.js b/app/static/js/darkreader.js deleted file mode 100644 index 6068f334..00000000 --- a/app/static/js/darkreader.js +++ /dev/null @@ -1,3894 +0,0 @@ -/** - * Dark Reader v4.9.21 - * https://darkreader.org/ - */ - -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : - typeof define === 'function' && define.amd ? define(['exports'], factory) : - (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.DarkReader = {})); -}(this, (function (exports) { 'use strict'; - - /*! ***************************************************************************** - Copyright (c) Microsoft Corporation. - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH - REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM - LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - PERFORMANCE OF THIS SOFTWARE. - ***************************************************************************** */ - - var __assign = function() { - __assign = Object.assign || function __assign(t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; - } - return t; - }; - return __assign.apply(this, arguments); - }; - - function __awaiter(thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - } - - function __generator(thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (_) try { - 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; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } - } - - function __values(o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) return m.call(o); - if (o && typeof o.length === "number") return { - next: function () { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; - } - }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); - } - - function __read(o, n) { - var m = typeof Symbol === "function" && o[Symbol.iterator]; - if (!m) return o; - var i = m.call(o), r, ar = [], e; - try { - while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); - } - catch (error) { e = { error: error }; } - finally { - try { - if (r && !r.done && (m = i["return"])) m.call(i); - } - finally { if (e) throw e.error; } - } - return ar; - } - - function __spread() { - for (var ar = [], i = 0; i < arguments.length; i++) - ar = ar.concat(__read(arguments[i])); - return ar; - } - - function isFirefox() { - return navigator.userAgent.includes('Firefox'); - } - function isWindows() { - if (typeof navigator === 'undefined') { - return null; - } - return navigator.platform.toLowerCase().startsWith('win'); - } - function isMacOS() { - if (typeof navigator === 'undefined') { - return null; - } - return navigator.platform.toLowerCase().startsWith('mac'); - } - function isDefinedSelectorSupported() { - try { - document.querySelector(':defined'); - return true; - } - catch (err) { - return false; - } - } - var IS_SHADOW_DOM_SUPPORTED = typeof ShadowRoot === 'function'; - function isCSSStyleSheetConstructorSupported() { - try { - new CSSStyleSheet(); - return true; - } - catch (err) { - return false; - } - } - - function getOKResponse(url, mimeType) { - return __awaiter(this, void 0, void 0, function () { - var response; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: return [4, fetch(url, { - cache: 'force-cache', - credentials: 'omit', - })]; - case 1: - response = _a.sent(); - if (isFirefox() && mimeType === 'text/css' && url.startsWith('moz-extension://') && url.endsWith('.css')) { - return [2, response]; - } - if (mimeType && !response.headers.get('Content-Type').startsWith(mimeType)) { - throw new Error("Mime type mismatch when loading " + url); - } - if (!response.ok) { - throw new Error("Unable to load " + url + " " + response.status + " " + response.statusText); - } - return [2, response]; - } - }); - }); - } - function loadAsDataURL(url, mimeType) { - return __awaiter(this, void 0, void 0, function () { - var response; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: return [4, getOKResponse(url, mimeType)]; - case 1: - response = _a.sent(); - return [4, readResponseAsDataURL(response)]; - case 2: return [2, _a.sent()]; - } - }); - }); - } - function readResponseAsDataURL(response) { - return __awaiter(this, void 0, void 0, function () { - var blob, dataURL; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: return [4, response.blob()]; - case 1: - blob = _a.sent(); - return [4, (new Promise(function (resolve) { - var reader = new FileReader(); - reader.onloadend = function () { return resolve(reader.result); }; - reader.readAsDataURL(blob); - }))]; - case 2: - dataURL = _a.sent(); - return [2, dataURL]; - } - }); - }); - } - - var throwCORSError = function (url) { return __awaiter(void 0, void 0, void 0, function () { - return __generator(this, function (_a) { - return [2, Promise.reject(new Error([ - 'Embedded Dark Reader cannot access a cross-origin resource', - url, - 'Overview your URLs and CORS policies or use', - '`DarkReader.setFetchMethod(fetch: (url) => Promise))`.', - 'See if using `DarkReader.setFetchMethod(window.fetch)`', - 'before `DarkReader.enable()` works.' - ].join(' ')))]; - }); - }); }; - var fetcher = throwCORSError; - function setFetchMethod(fetch) { - if (fetch) { - fetcher = fetch; - } - else { - fetcher = throwCORSError; - } - } - function callFetchMethod(url) { - return __awaiter(this, void 0, void 0, function () { - return __generator(this, function (_a) { - switch (_a.label) { - case 0: return [4, fetcher(url)]; - case 1: return [2, _a.sent()]; - } - }); - }); - } - - if (!window.chrome) { - window.chrome = {}; - } - if (!chrome.runtime) { - chrome.runtime = {}; - } - var messageListeners = new Set(); - function sendMessage() { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - return __awaiter(this, void 0, void 0, function () { - var id_1, _a, url, responseType, response, text_1, error_1; - return __generator(this, function (_b) { - switch (_b.label) { - case 0: - if (!(args[0] && args[0].type === 'fetch')) return [3, 8]; - id_1 = args[0].id; - _b.label = 1; - case 1: - _b.trys.push([1, 7, , 8]); - _a = args[0].data, url = _a.url, responseType = _a.responseType; - return [4, callFetchMethod(url)]; - case 2: - response = _b.sent(); - if (!(responseType === 'data-url')) return [3, 4]; - return [4, readResponseAsDataURL(response)]; - case 3: - text_1 = _b.sent(); - return [3, 6]; - case 4: return [4, response.text()]; - case 5: - text_1 = _b.sent(); - _b.label = 6; - case 6: - messageListeners.forEach(function (cb) { return cb({ type: 'fetch-response', data: text_1, error: null, id: id_1 }); }); - return [3, 8]; - case 7: - error_1 = _b.sent(); - console.error(error_1); - messageListeners.forEach(function (cb) { return cb({ type: 'fetch-response', data: null, error: error_1, id: id_1 }); }); - return [3, 8]; - case 8: return [2]; - } - }); - }); - } - function addMessageListener(callback) { - messageListeners.add(callback); - } - if (typeof chrome.runtime.sendMessage === 'function') { - var nativeSendMessage_1 = chrome.runtime.sendMessage; - chrome.runtime.sendMessage = function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - sendMessage.apply(void 0, __spread(args)); - nativeSendMessage_1.apply(chrome.runtime, args); - }; - } - else { - chrome.runtime.sendMessage = sendMessage; - } - if (!chrome.runtime.onMessage) { - chrome.runtime.onMessage = {}; - } - if (typeof chrome.runtime.onMessage.addListener === 'function') { - var nativeAddListener_1 = chrome.runtime.onMessage.addListener; - chrome.runtime.onMessage.addListener = function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - addMessageListener.apply(void 0, __spread(args)); - nativeAddListener_1.apply(chrome.runtime.onMessage, args); - }; - } - else { - chrome.runtime.onMessage.addListener = addMessageListener; - } - - var ThemeEngines = { - cssFilter: 'cssFilter', - svgFilter: 'svgFilter', - staticTheme: 'staticTheme', - dynamicTheme: 'dynamicTheme', - }; - - var DEFAULT_COLORS = { - darkScheme: { - background: '#181a1b', - text: '#e8e6e3', - }, - lightScheme: { - background: '#dcdad7', - text: '#181a1b', - }, - }; - var DEFAULT_THEME = { - mode: 1, - brightness: 100, - contrast: 100, - grayscale: 0, - sepia: 0, - useFont: false, - fontFamily: isMacOS() ? 'Helvetica Neue' : isWindows() ? 'Segoe UI' : 'Open Sans', - textStroke: 0, - engine: ThemeEngines.dynamicTheme, - stylesheet: '', - darkSchemeBackgroundColor: DEFAULT_COLORS.darkScheme.background, - darkSchemeTextColor: DEFAULT_COLORS.darkScheme.text, - lightSchemeBackgroundColor: DEFAULT_COLORS.lightScheme.background, - lightSchemeTextColor: DEFAULT_COLORS.lightScheme.text, - scrollbarColor: isMacOS() ? '' : 'auto', - selectionColor: 'auto', - styleSystemControls: true, - }; - - function isArrayLike(items) { - return items.length != null; - } - function forEach(items, iterator) { - var e_1, _a; - if (isArrayLike(items)) { - for (var i = 0, len = items.length; i < len; i++) { - iterator(items[i]); - } - } - else { - try { - for (var items_1 = __values(items), items_1_1 = items_1.next(); !items_1_1.done; items_1_1 = items_1.next()) { - var item = items_1_1.value; - iterator(item); - } - } - catch (e_1_1) { e_1 = { error: e_1_1 }; } - finally { - try { - if (items_1_1 && !items_1_1.done && (_a = items_1.return)) _a.call(items_1); - } - finally { if (e_1) throw e_1.error; } - } - } - } - function push(array, addition) { - forEach(addition, function (a) { return array.push(a); }); - } - function toArray(items) { - var results = []; - for (var i = 0, len = items.length; i < len; i++) { - results.push(items[i]); - } - return results; - } - - function fixBaseURL($url) { - var a = document.createElement('a'); - a.href = $url; - return a.href; - } - function parseURL($url, $base) { - if ($base === void 0) { $base = null; } - if ($base) { - $base = fixBaseURL($base); - return new URL($url, $base); - } - $url = fixBaseURL($url); - return new URL($url); - } - function getAbsoluteURL($base, $relative) { - if ($relative.match(/^data\:/)) { - return $relative; - } - var b = parseURL($base); - var a = parseURL($relative, b.href); - return a.href; - } - - function logInfo() { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - } - function logWarn() { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - } - - function iterateCSSRules(rules, iterate) { - forEach(rules, function (rule) { - if (rule instanceof CSSMediaRule) { - var media = Array.from(rule.media); - if (media.includes('screen') || media.includes('all') || !(media.includes('print') || media.includes('speech'))) { - iterateCSSRules(rule.cssRules, iterate); - } - } - else if (rule instanceof CSSStyleRule) { - iterate(rule); - } - else if (rule instanceof CSSImportRule) { - try { - iterateCSSRules(rule.styleSheet.cssRules, iterate); - } - catch (err) { - logWarn(err); - } - } - else if (rule instanceof CSSSupportsRule) { - if (CSS.supports(rule.conditionText)) { - iterateCSSRules(rule.cssRules, iterate); - } - } - else { - logWarn("CSSRule type not supported", rule); - } - }); - } - function iterateCSSDeclarations(style, iterate) { - forEach(style, function (property) { - var value = style.getPropertyValue(property).trim(); - if (!value) { - return; - } - iterate(property, value); - }); - } - function isCSSVariable(property) { - return property.startsWith('--') && !property.startsWith('--darkreader'); - } - function getCSSVariables(rules) { - var variables = new Map(); - rules && iterateCSSRules(rules, function (rule) { - rule.style && iterateCSSDeclarations(rule.style, function (property, value) { - if (isCSSVariable(property)) { - variables.set(property, value); - } - }); - }); - return variables; - } - function getElementCSSVariables(element) { - var variables = new Map(); - iterateCSSDeclarations(element.style, function (property, value) { - if (isCSSVariable(property)) { - variables.set(property, value); - } - }); - return variables; - } - var cssURLRegex = /url\((('.+?')|(".+?")|([^\)]*?))\)/g; - var cssImportRegex = /@import (url\()?(('.+?')|(".+?")|([^\)]*?))\)?;?/g; - function getCSSURLValue(cssURL) { - return cssURL.replace(/^url\((.*)\)$/, '$1').replace(/^"(.*)"$/, '$1').replace(/^'(.*)'$/, '$1'); - } - function getCSSBaseBath(url) { - var cssURL = parseURL(url); - return "" + cssURL.origin + cssURL.pathname.replace(/\?.*$/, '').replace(/(\/)([^\/]+)$/i, '$1'); - } - function replaceCSSRelativeURLsWithAbsolute($css, cssBasePath) { - return $css.replace(cssURLRegex, function (match) { - var pathValue = getCSSURLValue(match); - return "url(\"" + getAbsoluteURL(cssBasePath, pathValue) + "\")"; - }); - } - var cssCommentsRegex = /\/\*[\s\S]*?\*\//g; - function removeCSSComments($css) { - return $css.replace(cssCommentsRegex, ''); - } - var fontFaceRegex = /@font-face\s*{[^}]*}/g; - function replaceCSSFontFace($css) { - return $css.replace(fontFaceRegex, ''); - } - var varRegex = /var\((--[^\s,\(\)]+),?\s*([^\(\)]*(\([^\(\)]*\)[^\(\)]*)*\s*)\)/g; - function replaceCSSVariables(value, variables, stack) { - if (stack === void 0) { stack = new Set(); } - var missing = false; - var unresolvable = new Set(); - var result = value.replace(varRegex, function (match, name, fallback) { - if (stack.has(name)) { - logWarn("Circular reference to variable " + name); - if (fallback) { - return fallback; - } - missing = true; - return match; - } - if (variables.has(name)) { - var value_1 = variables.get(name); - if (value_1.match(varRegex)) { - unresolvable.add(name); - } - return value_1; - } - else if (fallback) { - return fallback; - } - else { - logWarn("Variable " + name + " not found"); - missing = true; - } - return match; - }); - if (missing) { - return result; - } - if (result.match(varRegex)) { - unresolvable.forEach(function (v) { return stack.add(v); }); - return replaceCSSVariables(result, variables, stack); - } - return result; - } - - function throttle(callback) { - var pending = false; - var frameId = null; - var lastArgs; - var throttled = (function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - lastArgs = args; - if (frameId) { - pending = true; - } - else { - callback.apply(void 0, __spread(lastArgs)); - frameId = requestAnimationFrame(function () { - frameId = null; - if (pending) { - callback.apply(void 0, __spread(lastArgs)); - pending = false; - } - }); - } - }); - var cancel = function () { - cancelAnimationFrame(frameId); - pending = false; - frameId = null; - }; - return Object.assign(throttled, { cancel: cancel }); - } - function createAsyncTasksQueue() { - var tasks = []; - var frameId = null; - function runTasks() { - var task; - while (task = tasks.shift()) { - task(); - } - frameId = null; - } - function add(task) { - tasks.push(task); - if (!frameId) { - frameId = requestAnimationFrame(runTasks); - } - } - function cancel() { - tasks.splice(0); - cancelAnimationFrame(frameId); - frameId = null; - } - return { add: add, cancel: cancel }; - } - - function getDuration(time) { - var duration = 0; - if (time.seconds) { - duration += time.seconds * 1000; - } - if (time.minutes) { - duration += time.minutes * 60 * 1000; - } - if (time.hours) { - duration += time.hours * 60 * 60 * 1000; - } - if (time.days) { - duration += time.days * 24 * 60 * 60 * 1000; - } - return duration; - } - - function removeNode(node) { - node && node.parentNode && node.parentNode.removeChild(node); - } - function watchForNodePosition(node, mode, onRestore) { - if (onRestore === void 0) { onRestore = Function.prototype; } - var MAX_ATTEMPTS_COUNT = 10; - var RETRY_TIMEOUT = getDuration({ seconds: 2 }); - var ATTEMPTS_INTERVAL = getDuration({ seconds: 10 }); - var prevSibling = node.previousSibling; - var parent = node.parentNode; - if (!parent) { - throw new Error('Unable to watch for node position: parent element not found'); - } - if (mode === 'prev-sibling' && !prevSibling) { - throw new Error('Unable to watch for node position: there is no previous sibling'); - } - var attempts = 0; - var start = null; - var timeoutId = null; - var restore = throttle(function () { - if (timeoutId) { - return; - } - attempts++; - var now = Date.now(); - if (start == null) { - start = now; - } - else if (attempts >= MAX_ATTEMPTS_COUNT) { - if (now - start < ATTEMPTS_INTERVAL) { - logWarn("Node position watcher paused: retry in " + RETRY_TIMEOUT + "ms", node, prevSibling); - timeoutId = setTimeout(function () { - start = null; - attempts = 0; - timeoutId = null; - restore(); - }, RETRY_TIMEOUT); - return; - } - start = now; - attempts = 1; - } - if (mode === 'parent') { - if (prevSibling && prevSibling.parentNode !== parent) { - logWarn('Unable to restore node position: sibling parent changed', node, prevSibling, parent); - stop(); - return; - } - } - if (mode === 'prev-sibling') { - if (prevSibling.parentNode == null) { - logWarn('Unable to restore node position: sibling was removed', node, prevSibling, parent); - stop(); - return; - } - if (prevSibling.parentNode !== parent) { - logWarn('Style was moved to another parent', node, prevSibling, parent); - updateParent(prevSibling.parentNode); - } - } - logWarn('Restoring node position', node, prevSibling, parent); - parent.insertBefore(node, prevSibling ? prevSibling.nextSibling : parent.firstChild); - observer.takeRecords(); - onRestore && onRestore(); - }); - var observer = new MutationObserver(function () { - if ((mode === 'parent' && node.parentNode !== parent) || - (mode === 'prev-sibling' && node.previousSibling !== prevSibling)) { - restore(); - } - }); - var run = function () { - observer.observe(parent, { childList: true }); - }; - var stop = function () { - clearTimeout(timeoutId); - observer.disconnect(); - restore.cancel(); - }; - var skip = function () { - observer.takeRecords(); - }; - var updateParent = function (parentNode) { - parent = parentNode; - stop(); - run(); - }; - run(); - return { run: run, stop: stop, skip: skip }; - } - function iterateShadowHosts(root, iterator) { - if (root == null) { - return; - } - var walker = document.createTreeWalker(root, NodeFilter.SHOW_ELEMENT, { - acceptNode: function (node) { - return node.shadowRoot == null ? NodeFilter.FILTER_SKIP : NodeFilter.FILTER_ACCEPT; - } - }); - for (var node = (root.shadowRoot ? walker.currentNode : walker.nextNode()); node != null; node = walker.nextNode()) { - iterator(node); - iterateShadowHosts(node.shadowRoot, iterator); - } - } - function isDOMReady() { - return document.readyState === 'complete' || document.readyState === 'interactive'; - } - var readyStateListeners = new Set(); - function addDOMReadyListener(listener) { - readyStateListeners.add(listener); - } - function removeDOMReadyListener(listener) { - readyStateListeners.delete(listener); - } - if (!isDOMReady()) { - var onReadyStateChange_1 = function () { - if (isDOMReady()) { - document.removeEventListener('readystatechange', onReadyStateChange_1); - readyStateListeners.forEach(function (listener) { return listener(); }); - readyStateListeners.clear(); - } - }; - document.addEventListener('readystatechange', onReadyStateChange_1); - } - var HUGE_MUTATIONS_COUNT = 1000; - function isHugeMutation(mutations) { - if (mutations.length > HUGE_MUTATIONS_COUNT) { - return true; - } - var addedNodesCount = 0; - for (var i = 0; i < mutations.length; i++) { - addedNodesCount += mutations[i].addedNodes.length; - if (addedNodesCount > HUGE_MUTATIONS_COUNT) { - return true; - } - } - return false; - } - function getElementsTreeOperations(mutations) { - var additions = new Set(); - var deletions = new Set(); - var moves = new Set(); - mutations.forEach(function (m) { - forEach(m.addedNodes, function (n) { - if (n instanceof Element && n.isConnected) { - additions.add(n); - } - }); - forEach(m.removedNodes, function (n) { - if (n instanceof Element) { - if (n.isConnected) { - moves.add(n); - } - else { - deletions.add(n); - } - } - }); - }); - moves.forEach(function (n) { return additions.delete(n); }); - var duplicateAdditions = []; - var duplicateDeletions = []; - additions.forEach(function (node) { - if (additions.has(node.parentElement)) { - duplicateAdditions.push(node); - } - }); - deletions.forEach(function (node) { - if (deletions.has(node.parentElement)) { - duplicateDeletions.push(node); - } - }); - duplicateAdditions.forEach(function (node) { return additions.delete(node); }); - duplicateDeletions.forEach(function (node) { return deletions.delete(node); }); - return { additions: additions, moves: moves, deletions: deletions }; - } - var optimizedTreeObservers = new Map(); - var optimizedTreeCallbacks = new WeakMap(); - function createOptimizedTreeObserver(root, callbacks) { - var observer; - var observerCallbacks; - var domReadyListener; - if (optimizedTreeObservers.has(root)) { - observer = optimizedTreeObservers.get(root); - observerCallbacks = optimizedTreeCallbacks.get(observer); - } - else { - var hadHugeMutationsBefore_1 = false; - var subscribedForReadyState_1 = false; - observer = new MutationObserver(function (mutations) { - if (isHugeMutation(mutations)) { - if (!hadHugeMutationsBefore_1 || isDOMReady()) { - observerCallbacks.forEach(function (_a) { - var onHugeMutations = _a.onHugeMutations; - return onHugeMutations(root); - }); - } - else { - if (!subscribedForReadyState_1) { - domReadyListener = function () { return observerCallbacks.forEach(function (_a) { - var onHugeMutations = _a.onHugeMutations; - return onHugeMutations(root); - }); }; - addDOMReadyListener(domReadyListener); - subscribedForReadyState_1 = true; - } - } - hadHugeMutationsBefore_1 = true; - } - else { - var elementsOperations_1 = getElementsTreeOperations(mutations); - observerCallbacks.forEach(function (_a) { - var onMinorMutations = _a.onMinorMutations; - return onMinorMutations(elementsOperations_1); - }); - } - }); - observer.observe(root, { childList: true, subtree: true }); - optimizedTreeObservers.set(root, observer); - observerCallbacks = new Set(); - optimizedTreeCallbacks.set(observer, observerCallbacks); - } - observerCallbacks.add(callbacks); - return { - disconnect: function () { - observerCallbacks.delete(callbacks); - if (domReadyListener) { - removeDOMReadyListener(domReadyListener); - } - if (observerCallbacks.size === 0) { - observer.disconnect(); - optimizedTreeCallbacks.delete(observer); - optimizedTreeObservers.delete(root); - } - }, - }; - } - - function hslToRGB(_a) { - var h = _a.h, s = _a.s, l = _a.l, _b = _a.a, a = _b === void 0 ? 1 : _b; - if (s === 0) { - var _c = __read([l, l, l].map(function (x) { return Math.round(x * 255); }), 3), r_1 = _c[0], b_1 = _c[1], g_1 = _c[2]; - return { r: r_1, g: g_1, b: b_1, a: a }; - } - var c = (1 - Math.abs(2 * l - 1)) * s; - var x = c * (1 - Math.abs((h / 60) % 2 - 1)); - var m = l - c / 2; - var _d = __read((h < 60 ? [c, x, 0] : - h < 120 ? [x, c, 0] : - h < 180 ? [0, c, x] : - h < 240 ? [0, x, c] : - h < 300 ? [x, 0, c] : - [c, 0, x]).map(function (n) { return Math.round((n + m) * 255); }), 3), r = _d[0], g = _d[1], b = _d[2]; - return { r: r, g: g, b: b, a: a }; - } - function rgbToHSL(_a) { - var r255 = _a.r, g255 = _a.g, b255 = _a.b, _b = _a.a, a = _b === void 0 ? 1 : _b; - var r = r255 / 255; - var g = g255 / 255; - var b = b255 / 255; - var max = Math.max(r, g, b); - var min = Math.min(r, g, b); - var c = max - min; - var l = (max + min) / 2; - if (c === 0) { - return { h: 0, s: 0, l: l, a: a }; - } - var h = (max === r ? (((g - b) / c) % 6) : - max === g ? ((b - r) / c + 2) : - ((r - g) / c + 4)) * 60; - if (h < 0) { - h += 360; - } - var s = c / (1 - Math.abs(2 * l - 1)); - return { h: h, s: s, l: l, a: a }; - } - function toFixed(n, digits) { - if (digits === void 0) { digits = 0; } - var fixed = n.toFixed(digits); - if (digits === 0) { - return fixed; - } - var dot = fixed.indexOf('.'); - if (dot >= 0) { - var zerosMatch = fixed.match(/0+$/); - if (zerosMatch) { - if (zerosMatch.index === dot + 1) { - return fixed.substring(0, dot); - } - return fixed.substring(0, zerosMatch.index); - } - } - return fixed; - } - function rgbToString(rgb) { - var r = rgb.r, g = rgb.g, b = rgb.b, a = rgb.a; - if (a != null && a < 1) { - return "rgba(" + toFixed(r) + ", " + toFixed(g) + ", " + toFixed(b) + ", " + toFixed(a, 2) + ")"; - } - return "rgb(" + toFixed(r) + ", " + toFixed(g) + ", " + toFixed(b) + ")"; - } - function rgbToHexString(_a) { - var r = _a.r, g = _a.g, b = _a.b, a = _a.a; - return "#" + (a != null && a < 1 ? [r, g, b, Math.round(a * 255)] : [r, g, b]).map(function (x) { - return "" + (x < 16 ? '0' : '') + x.toString(16); - }).join(''); - } - function hslToString(hsl) { - var h = hsl.h, s = hsl.s, l = hsl.l, a = hsl.a; - if (a != null && a < 1) { - return "hsla(" + toFixed(h) + ", " + toFixed(s * 100) + "%, " + toFixed(l * 100) + "%, " + toFixed(a, 2) + ")"; - } - return "hsl(" + toFixed(h) + ", " + toFixed(s * 100) + "%, " + toFixed(l * 100) + "%)"; - } - var rgbMatch = /^rgba?\([^\(\)]+\)$/; - var hslMatch = /^hsla?\([^\(\)]+\)$/; - var hexMatch = /^#[0-9a-f]+$/i; - function parse($color) { - var c = $color.trim().toLowerCase(); - if (c.match(rgbMatch)) { - return parseRGB(c); - } - if (c.match(hslMatch)) { - return parseHSL(c); - } - if (c.match(hexMatch)) { - return parseHex(c); - } - if (knownColors.has(c)) { - return getColorByName(c); - } - if (systemColors.has(c)) { - return getSystemColor(c); - } - if ($color === 'transparent') { - return { r: 0, g: 0, b: 0, a: 0 }; - } - throw new Error("Unable to parse " + $color); - } - function getNumbersFromString(str, splitter, range, units) { - var raw = str.split(splitter).filter(function (x) { return x; }); - var unitsList = Object.entries(units); - var numbers = raw.map(function (r) { return r.trim(); }).map(function (r, i) { - var n; - var unit = unitsList.find(function (_a) { - var _b = __read(_a, 1), u = _b[0]; - return r.endsWith(u); - }); - if (unit) { - n = parseFloat(r.substring(0, r.length - unit[0].length)) / unit[1] * range[i]; - } - else { - n = parseFloat(r); - } - if (range[i] > 1) { - return Math.round(n); - } - return n; - }); - return numbers; - } - var rgbSplitter = /rgba?|\(|\)|\/|,|\s/ig; - var rgbRange = [255, 255, 255, 1]; - var rgbUnits = { '%': 100 }; - function parseRGB($rgb) { - var _a = __read(getNumbersFromString($rgb, rgbSplitter, rgbRange, rgbUnits), 4), r = _a[0], g = _a[1], b = _a[2], _b = _a[3], a = _b === void 0 ? 1 : _b; - return { r: r, g: g, b: b, a: a }; - } - var hslSplitter = /hsla?|\(|\)|\/|,|\s/ig; - var hslRange = [360, 1, 1, 1]; - var hslUnits = { '%': 100, 'deg': 360, 'rad': 2 * Math.PI, 'turn': 1 }; - function parseHSL($hsl) { - var _a = __read(getNumbersFromString($hsl, hslSplitter, hslRange, hslUnits), 4), h = _a[0], s = _a[1], l = _a[2], _b = _a[3], a = _b === void 0 ? 1 : _b; - return hslToRGB({ h: h, s: s, l: l, a: a }); - } - function parseHex($hex) { - var h = $hex.substring(1); - switch (h.length) { - case 3: - case 4: { - var _a = __read([0, 1, 2].map(function (i) { return parseInt("" + h[i] + h[i], 16); }), 3), r = _a[0], g = _a[1], b = _a[2]; - var a = h.length === 3 ? 1 : (parseInt("" + h[3] + h[3], 16) / 255); - return { r: r, g: g, b: b, a: a }; - } - case 6: - case 8: { - var _b = __read([0, 2, 4].map(function (i) { return parseInt(h.substring(i, i + 2), 16); }), 3), r = _b[0], g = _b[1], b = _b[2]; - var a = h.length === 6 ? 1 : (parseInt(h.substring(6, 8), 16) / 255); - return { r: r, g: g, b: b, a: a }; - } - } - throw new Error("Unable to parse " + $hex); - } - function getColorByName($color) { - var n = knownColors.get($color); - return { - r: (n >> 16) & 255, - g: (n >> 8) & 255, - b: (n >> 0) & 255, - a: 1 - }; - } - function getSystemColor($color) { - var n = systemColors.get($color); - return { - r: (n >> 16) & 255, - g: (n >> 8) & 255, - b: (n >> 0) & 255, - a: 1 - }; - } - var knownColors = new Map(Object.entries({ - aliceblue: 0xf0f8ff, - antiquewhite: 0xfaebd7, - aqua: 0x00ffff, - aquamarine: 0x7fffd4, - azure: 0xf0ffff, - beige: 0xf5f5dc, - bisque: 0xffe4c4, - black: 0x000000, - blanchedalmond: 0xffebcd, - blue: 0x0000ff, - blueviolet: 0x8a2be2, - brown: 0xa52a2a, - burlywood: 0xdeb887, - cadetblue: 0x5f9ea0, - chartreuse: 0x7fff00, - chocolate: 0xd2691e, - coral: 0xff7f50, - cornflowerblue: 0x6495ed, - cornsilk: 0xfff8dc, - crimson: 0xdc143c, - cyan: 0x00ffff, - darkblue: 0x00008b, - darkcyan: 0x008b8b, - darkgoldenrod: 0xb8860b, - darkgray: 0xa9a9a9, - darkgrey: 0xa9a9a9, - darkgreen: 0x006400, - darkkhaki: 0xbdb76b, - darkmagenta: 0x8b008b, - darkolivegreen: 0x556b2f, - darkorange: 0xff8c00, - darkorchid: 0x9932cc, - darkred: 0x8b0000, - darksalmon: 0xe9967a, - darkseagreen: 0x8fbc8f, - darkslateblue: 0x483d8b, - darkslategray: 0x2f4f4f, - darkslategrey: 0x2f4f4f, - darkturquoise: 0x00ced1, - darkviolet: 0x9400d3, - deeppink: 0xff1493, - deepskyblue: 0x00bfff, - dimgray: 0x696969, - dimgrey: 0x696969, - dodgerblue: 0x1e90ff, - firebrick: 0xb22222, - floralwhite: 0xfffaf0, - forestgreen: 0x228b22, - fuchsia: 0xff00ff, - gainsboro: 0xdcdcdc, - ghostwhite: 0xf8f8ff, - gold: 0xffd700, - goldenrod: 0xdaa520, - gray: 0x808080, - grey: 0x808080, - green: 0x008000, - greenyellow: 0xadff2f, - honeydew: 0xf0fff0, - hotpink: 0xff69b4, - indianred: 0xcd5c5c, - indigo: 0x4b0082, - ivory: 0xfffff0, - khaki: 0xf0e68c, - lavender: 0xe6e6fa, - lavenderblush: 0xfff0f5, - lawngreen: 0x7cfc00, - lemonchiffon: 0xfffacd, - lightblue: 0xadd8e6, - lightcoral: 0xf08080, - lightcyan: 0xe0ffff, - lightgoldenrodyellow: 0xfafad2, - lightgray: 0xd3d3d3, - lightgrey: 0xd3d3d3, - lightgreen: 0x90ee90, - lightpink: 0xffb6c1, - lightsalmon: 0xffa07a, - lightseagreen: 0x20b2aa, - lightskyblue: 0x87cefa, - lightslategray: 0x778899, - lightslategrey: 0x778899, - lightsteelblue: 0xb0c4de, - lightyellow: 0xffffe0, - lime: 0x00ff00, - limegreen: 0x32cd32, - linen: 0xfaf0e6, - magenta: 0xff00ff, - maroon: 0x800000, - mediumaquamarine: 0x66cdaa, - mediumblue: 0x0000cd, - mediumorchid: 0xba55d3, - mediumpurple: 0x9370db, - mediumseagreen: 0x3cb371, - mediumslateblue: 0x7b68ee, - mediumspringgreen: 0x00fa9a, - mediumturquoise: 0x48d1cc, - mediumvioletred: 0xc71585, - midnightblue: 0x191970, - mintcream: 0xf5fffa, - mistyrose: 0xffe4e1, - moccasin: 0xffe4b5, - navajowhite: 0xffdead, - navy: 0x000080, - oldlace: 0xfdf5e6, - olive: 0x808000, - olivedrab: 0x6b8e23, - orange: 0xffa500, - orangered: 0xff4500, - orchid: 0xda70d6, - palegoldenrod: 0xeee8aa, - palegreen: 0x98fb98, - paleturquoise: 0xafeeee, - palevioletred: 0xdb7093, - papayawhip: 0xffefd5, - peachpuff: 0xffdab9, - peru: 0xcd853f, - pink: 0xffc0cb, - plum: 0xdda0dd, - powderblue: 0xb0e0e6, - purple: 0x800080, - rebeccapurple: 0x663399, - red: 0xff0000, - rosybrown: 0xbc8f8f, - royalblue: 0x4169e1, - saddlebrown: 0x8b4513, - salmon: 0xfa8072, - sandybrown: 0xf4a460, - seagreen: 0x2e8b57, - seashell: 0xfff5ee, - sienna: 0xa0522d, - silver: 0xc0c0c0, - skyblue: 0x87ceeb, - slateblue: 0x6a5acd, - slategray: 0x708090, - slategrey: 0x708090, - snow: 0xfffafa, - springgreen: 0x00ff7f, - steelblue: 0x4682b4, - tan: 0xd2b48c, - teal: 0x008080, - thistle: 0xd8bfd8, - tomato: 0xff6347, - turquoise: 0x40e0d0, - violet: 0xee82ee, - wheat: 0xf5deb3, - white: 0xffffff, - whitesmoke: 0xf5f5f5, - yellow: 0xffff00, - yellowgreen: 0x9acd32, - })); - var systemColors = new Map(Object.entries({ - ActiveBorder: 0x3b99fc, - ActiveCaption: 0x000000, - AppWorkspace: 0xaaaaaa, - Background: 0x6363ce, - ButtonFace: 0xffffff, - ButtonHighlight: 0xe9e9e9, - ButtonShadow: 0x9fa09f, - ButtonText: 0x000000, - CaptionText: 0x000000, - GrayText: 0x7f7f7f, - Highlight: 0xb2d7ff, - HighlightText: 0x000000, - InactiveBorder: 0xffffff, - InactiveCaption: 0xffffff, - InactiveCaptionText: 0x000000, - InfoBackground: 0xfbfcc5, - InfoText: 0x000000, - Menu: 0xf6f6f6, - MenuText: 0xffffff, - Scrollbar: 0xaaaaaa, - ThreeDDarkShadow: 0x000000, - ThreeDFace: 0xc0c0c0, - ThreeDHighlight: 0xffffff, - ThreeDLightShadow: 0xffffff, - ThreeDShadow: 0x000000, - Window: 0xececec, - WindowFrame: 0xaaaaaa, - WindowText: 0x000000, - '-webkit-focus-ring-color': 0xe59700 - }).map(function (_a) { - var _b = __read(_a, 2), key = _b[0], value = _b[1]; - return [key.toLowerCase(), value]; - })); - - function scale(x, inLow, inHigh, outLow, outHigh) { - return (x - inLow) * (outHigh - outLow) / (inHigh - inLow) + outLow; - } - function clamp(x, min, max) { - return Math.min(max, Math.max(min, x)); - } - function multiplyMatrices(m1, m2) { - var result = []; - for (var i = 0, len = m1.length; i < len; i++) { - result[i] = []; - for (var j = 0, len2 = m2[0].length; j < len2; j++) { - var sum = 0; - for (var k = 0, len3 = m1[0].length; k < len3; k++) { - sum += m1[i][k] * m2[k][j]; - } - result[i][j] = sum; - } - } - return result; - } - - function getMatches(regex, input, group) { - if (group === void 0) { group = 0; } - var matches = []; - var m; - while (m = regex.exec(input)) { - matches.push(m[group]); - } - return matches; - } - - function createFilterMatrix(config) { - var m = Matrix.identity(); - if (config.sepia !== 0) { - m = multiplyMatrices(m, Matrix.sepia(config.sepia / 100)); - } - if (config.grayscale !== 0) { - m = multiplyMatrices(m, Matrix.grayscale(config.grayscale / 100)); - } - if (config.contrast !== 100) { - m = multiplyMatrices(m, Matrix.contrast(config.contrast / 100)); - } - if (config.brightness !== 100) { - m = multiplyMatrices(m, Matrix.brightness(config.brightness / 100)); - } - if (config.mode === 1) { - m = multiplyMatrices(m, Matrix.invertNHue()); - } - return m; - } - function applyColorMatrix(_a, matrix) { - var _b = __read(_a, 3), r = _b[0], g = _b[1], b = _b[2]; - var rgb = [[r / 255], [g / 255], [b / 255], [1], [1]]; - var result = multiplyMatrices(matrix, rgb); - return [0, 1, 2].map(function (i) { return clamp(Math.round(result[i][0] * 255), 0, 255); }); - } - var Matrix = { - identity: function () { - return [ - [1, 0, 0, 0, 0], - [0, 1, 0, 0, 0], - [0, 0, 1, 0, 0], - [0, 0, 0, 1, 0], - [0, 0, 0, 0, 1] - ]; - }, - invertNHue: function () { - return [ - [0.333, -0.667, -0.667, 0, 1], - [-0.667, 0.333, -0.667, 0, 1], - [-0.667, -0.667, 0.333, 0, 1], - [0, 0, 0, 1, 0], - [0, 0, 0, 0, 1] - ]; - }, - brightness: function (v) { - return [ - [v, 0, 0, 0, 0], - [0, v, 0, 0, 0], - [0, 0, v, 0, 0], - [0, 0, 0, 1, 0], - [0, 0, 0, 0, 1] - ]; - }, - contrast: function (v) { - var t = (1 - v) / 2; - return [ - [v, 0, 0, 0, t], - [0, v, 0, 0, t], - [0, 0, v, 0, t], - [0, 0, 0, 1, 0], - [0, 0, 0, 0, 1] - ]; - }, - sepia: function (v) { - return [ - [(0.393 + 0.607 * (1 - v)), (0.769 - 0.769 * (1 - v)), (0.189 - 0.189 * (1 - v)), 0, 0], - [(0.349 - 0.349 * (1 - v)), (0.686 + 0.314 * (1 - v)), (0.168 - 0.168 * (1 - v)), 0, 0], - [(0.272 - 0.272 * (1 - v)), (0.534 - 0.534 * (1 - v)), (0.131 + 0.869 * (1 - v)), 0, 0], - [0, 0, 0, 1, 0], - [0, 0, 0, 0, 1] - ]; - }, - grayscale: function (v) { - return [ - [(0.2126 + 0.7874 * (1 - v)), (0.7152 - 0.7152 * (1 - v)), (0.0722 - 0.0722 * (1 - v)), 0, 0], - [(0.2126 - 0.2126 * (1 - v)), (0.7152 + 0.2848 * (1 - v)), (0.0722 - 0.0722 * (1 - v)), 0, 0], - [(0.2126 - 0.2126 * (1 - v)), (0.7152 - 0.7152 * (1 - v)), (0.0722 + 0.9278 * (1 - v)), 0, 0], - [0, 0, 0, 1, 0], - [0, 0, 0, 0, 1] - ]; - }, - }; - - function getBgPole(theme) { - var isDarkScheme = theme.mode === 1; - var prop = isDarkScheme ? 'darkSchemeBackgroundColor' : 'lightSchemeBackgroundColor'; - return theme[prop]; - } - function getFgPole(theme) { - var isDarkScheme = theme.mode === 1; - var prop = isDarkScheme ? 'darkSchemeTextColor' : 'lightSchemeTextColor'; - return theme[prop]; - } - var colorModificationCache = new Map(); - var colorParseCache = new Map(); - function parseToHSLWithCache(color) { - if (colorParseCache.has(color)) { - return colorParseCache.get(color); - } - var rgb = parse(color); - var hsl = rgbToHSL(rgb); - colorParseCache.set(color, hsl); - return hsl; - } - function clearColorModificationCache() { - colorModificationCache.clear(); - colorParseCache.clear(); - } - var rgbCacheKeys = ['r', 'g', 'b', 'a']; - var themeCacheKeys = ['mode', 'brightness', 'contrast', 'grayscale', 'sepia', 'darkSchemeBackgroundColor', 'darkSchemeTextColor', 'lightSchemeBackgroundColor', 'lightSchemeTextColor']; - function getCacheId(rgb, theme) { - return rgbCacheKeys.map(function (k) { return rgb[k]; }) - .concat(themeCacheKeys.map(function (k) { return theme[k]; })) - .join(';'); - } - function modifyColorWithCache(rgb, theme, modifyHSL, poleColor, anotherPoleColor) { - var fnCache; - if (colorModificationCache.has(modifyHSL)) { - fnCache = colorModificationCache.get(modifyHSL); - } - else { - fnCache = new Map(); - colorModificationCache.set(modifyHSL, fnCache); - } - var id = getCacheId(rgb, theme); - if (fnCache.has(id)) { - return fnCache.get(id); - } - var hsl = rgbToHSL(rgb); - var pole = poleColor == null ? null : parseToHSLWithCache(poleColor); - var anotherPole = anotherPoleColor == null ? null : parseToHSLWithCache(anotherPoleColor); - var modified = modifyHSL(hsl, pole, anotherPole); - var _a = hslToRGB(modified), r = _a.r, g = _a.g, b = _a.b, a = _a.a; - var matrix = createFilterMatrix(theme); - var _b = __read(applyColorMatrix([r, g, b], matrix), 3), rf = _b[0], gf = _b[1], bf = _b[2]; - var color = (a === 1 ? - rgbToHexString({ r: rf, g: gf, b: bf }) : - rgbToString({ r: rf, g: gf, b: bf, a: a })); - fnCache.set(id, color); - return color; - } - function noopHSL(hsl) { - return hsl; - } - function modifyColor(rgb, theme) { - return modifyColorWithCache(rgb, theme, noopHSL); - } - function modifyLightSchemeColor(rgb, theme) { - var poleBg = getBgPole(theme); - var poleFg = getFgPole(theme); - return modifyColorWithCache(rgb, theme, modifyLightModeHSL, poleFg, poleBg); - } - function modifyLightModeHSL(_a, poleFg, poleBg) { - var h = _a.h, s = _a.s, l = _a.l, a = _a.a; - var isDark = l < 0.5; - var isNeutral; - if (isDark) { - isNeutral = l < 0.2 || s < 0.12; - } - else { - var isBlue = h > 200 && h < 280; - isNeutral = s < 0.24 || (l > 0.8 && isBlue); - } - var hx = h; - var sx = l; - if (isNeutral) { - if (isDark) { - hx = poleFg.h; - sx = poleFg.s; - } - else { - hx = poleBg.h; - sx = poleBg.s; - } - } - var lx = scale(l, 0, 1, poleFg.l, poleBg.l); - return { h: hx, s: sx, l: lx, a: a }; - } - var MAX_BG_LIGHTNESS = 0.4; - function modifyBgHSL(_a, pole) { - var h = _a.h, s = _a.s, l = _a.l, a = _a.a; - var isDark = l < 0.5; - var isBlue = h > 200 && h < 280; - var isNeutral = s < 0.12 || (l > 0.8 && isBlue); - if (isDark) { - var lx_1 = scale(l, 0, 0.5, 0, MAX_BG_LIGHTNESS); - if (isNeutral) { - var hx_1 = pole.h; - var sx = pole.s; - return { h: hx_1, s: sx, l: lx_1, a: a }; - } - return { h: h, s: s, l: lx_1, a: a }; - } - var lx = scale(l, 0.5, 1, MAX_BG_LIGHTNESS, pole.l); - if (isNeutral) { - var hx_2 = pole.h; - var sx = pole.s; - return { h: hx_2, s: sx, l: lx, a: a }; - } - var hx = h; - var isYellow = h > 60 && h < 180; - if (isYellow) { - var isCloserToGreen = h > 120; - if (isCloserToGreen) { - hx = scale(h, 120, 180, 135, 180); - } - else { - hx = scale(h, 60, 120, 60, 105); - } - } - return { h: hx, s: s, l: lx, a: a }; - } - function modifyBackgroundColor(rgb, theme) { - if (theme.mode === 0) { - return modifyLightSchemeColor(rgb, theme); - } - var pole = getBgPole(theme); - return modifyColorWithCache(rgb, __assign(__assign({}, theme), { mode: 0 }), modifyBgHSL, pole); - } - var MIN_FG_LIGHTNESS = 0.55; - function modifyBlueFgHue(hue) { - return scale(hue, 205, 245, 205, 220); - } - function modifyFgHSL(_a, pole) { - var h = _a.h, s = _a.s, l = _a.l, a = _a.a; - var isLight = l > 0.5; - var isNeutral = l < 0.2 || s < 0.24; - var isBlue = !isNeutral && h > 205 && h < 245; - if (isLight) { - var lx_2 = scale(l, 0.5, 1, MIN_FG_LIGHTNESS, pole.l); - if (isNeutral) { - var hx_3 = pole.h; - var sx = pole.s; - return { h: hx_3, s: sx, l: lx_2, a: a }; - } - var hx_4 = h; - if (isBlue) { - hx_4 = modifyBlueFgHue(h); - } - return { h: hx_4, s: s, l: lx_2, a: a }; - } - if (isNeutral) { - var hx_5 = pole.h; - var sx = pole.s; - var lx_3 = scale(l, 0, 0.5, pole.l, MIN_FG_LIGHTNESS); - return { h: hx_5, s: sx, l: lx_3, a: a }; - } - var hx = h; - var lx = l; - if (isBlue) { - hx = modifyBlueFgHue(h); - lx = scale(l, 0, 0.5, pole.l, Math.min(1, MIN_FG_LIGHTNESS + 0.05)); - } - else { - lx = scale(l, 0, 0.5, pole.l, MIN_FG_LIGHTNESS); - } - return { h: hx, s: s, l: lx, a: a }; - } - function modifyForegroundColor(rgb, theme) { - if (theme.mode === 0) { - return modifyLightSchemeColor(rgb, theme); - } - var pole = getFgPole(theme); - return modifyColorWithCache(rgb, __assign(__assign({}, theme), { mode: 0 }), modifyFgHSL, pole); - } - function modifyBorderHSL(_a, poleFg, poleBg) { - var h = _a.h, s = _a.s, l = _a.l, a = _a.a; - var isDark = l < 0.5; - var isNeutral = l < 0.2 || s < 0.24; - var hx = h; - var sx = s; - if (isNeutral) { - if (isDark) { - hx = poleFg.h; - sx = poleFg.s; - } - else { - hx = poleBg.h; - sx = poleBg.s; - } - } - var lx = scale(l, 0, 1, 0.5, 0.2); - return { h: hx, s: sx, l: lx, a: a }; - } - function modifyBorderColor(rgb, theme) { - if (theme.mode === 0) { - return modifyLightSchemeColor(rgb, theme); - } - var poleFg = getFgPole(theme); - var poleBg = getBgPole(theme); - return modifyColorWithCache(rgb, __assign(__assign({}, theme), { mode: 0 }), modifyBorderHSL, poleFg, poleBg); - } - function modifyShadowColor(rgb, filter) { - return modifyBackgroundColor(rgb, filter); - } - function modifyGradientColor(rgb, filter) { - return modifyBackgroundColor(rgb, filter); - } - - function getURLHostOrProtocol($url) { - var url = new URL($url); - if (url.host) { - return url.host; - } - else { - return url.protocol; - } - } - - function createTextStyle(config) { - var lines = []; - lines.push('*:not(pre) {'); - if (config.useFont && config.fontFamily) { - lines.push(" font-family: " + config.fontFamily + " !important;"); - } - if (config.textStroke > 0) { - lines.push(" -webkit-text-stroke: " + config.textStroke + "px !important;"); - lines.push(" text-stroke: " + config.textStroke + "px !important;"); - } - lines.push('}'); - return lines.join('\n'); - } - - var FilterMode; - (function (FilterMode) { - FilterMode[FilterMode["light"] = 0] = "light"; - FilterMode[FilterMode["dark"] = 1] = "dark"; - })(FilterMode || (FilterMode = {})); - function getCSSFilterValue(config) { - var filters = []; - if (config.mode === FilterMode.dark) { - filters.push('invert(100%) hue-rotate(180deg)'); - } - if (config.brightness !== 100) { - filters.push("brightness(" + config.brightness + "%)"); - } - if (config.contrast !== 100) { - filters.push("contrast(" + config.contrast + "%)"); - } - if (config.grayscale !== 0) { - filters.push("grayscale(" + config.grayscale + "%)"); - } - if (config.sepia !== 0) { - filters.push("sepia(" + config.sepia + "%)"); - } - if (filters.length === 0) { - return null; - } - return filters.join(' '); - } - - function toSVGMatrix(matrix) { - return matrix.slice(0, 4).map(function (m) { return m.map(function (m) { return m.toFixed(3); }).join(' '); }).join(' '); - } - function getSVGFilterMatrixValue(config) { - return toSVGMatrix(createFilterMatrix(config)); - } - - var counter = 0; - var resolvers = new Map(); - var rejectors = new Map(); - function bgFetch(request) { - return new Promise(function (resolve, reject) { - var id = ++counter; - resolvers.set(id, resolve); - rejectors.set(id, reject); - chrome.runtime.sendMessage({ type: 'fetch', data: request, id: id }); - }); - } - chrome.runtime.onMessage.addListener(function (_a) { - var type = _a.type, data = _a.data, error = _a.error, id = _a.id; - if (type === 'fetch-response') { - var resolve = resolvers.get(id); - var reject = rejectors.get(id); - resolvers.delete(id); - rejectors.delete(id); - if (error) { - reject && reject(error); - } - else { - resolve && resolve(data); - } - } - }); - - function getImageDetails(url) { - return __awaiter(this, void 0, void 0, function () { - var dataURL, image, info; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - if (!url.startsWith('data:')) return [3, 1]; - dataURL = url; - return [3, 3]; - case 1: return [4, getImageDataURL(url)]; - case 2: - dataURL = _a.sent(); - _a.label = 3; - case 3: return [4, urlToImage(dataURL)]; - case 4: - image = _a.sent(); - info = analyzeImage(image); - return [2, __assign({ src: url, dataURL: dataURL, width: image.naturalWidth, height: image.naturalHeight }, info)]; - } - }); - }); - } - function getImageDataURL(url) { - return __awaiter(this, void 0, void 0, function () { - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - if (!(getURLHostOrProtocol(url) === (location.host || location.protocol))) return [3, 2]; - return [4, loadAsDataURL(url)]; - case 1: return [2, _a.sent()]; - case 2: return [4, bgFetch({ url: url, responseType: 'data-url' })]; - case 3: return [2, _a.sent()]; - } - }); - }); - } - function urlToImage(url) { - return __awaiter(this, void 0, void 0, function () { - return __generator(this, function (_a) { - return [2, new Promise(function (resolve, reject) { - var image = new Image(); - image.onload = function () { return resolve(image); }; - image.onerror = function () { return reject("Unable to load image " + url); }; - image.src = url; - })]; - }); - }); - } - var MAX_ANALIZE_PIXELS_COUNT = 32 * 32; - var canvas; - var context; - function createCanvas() { - var maxWidth = MAX_ANALIZE_PIXELS_COUNT; - var maxHeight = MAX_ANALIZE_PIXELS_COUNT; - canvas = document.createElement('canvas'); - canvas.width = maxWidth; - canvas.height = maxHeight; - context = canvas.getContext('2d'); - context.imageSmoothingEnabled = false; - } - function removeCanvas() { - canvas = null; - context = null; - } - function analyzeImage(image) { - if (!canvas) { - createCanvas(); - } - var naturalWidth = image.naturalWidth, naturalHeight = image.naturalHeight; - var naturalPixelsCount = naturalWidth * naturalHeight; - var k = Math.min(1, Math.sqrt(MAX_ANALIZE_PIXELS_COUNT / naturalPixelsCount)); - var width = Math.ceil(naturalWidth * k); - var height = Math.ceil(naturalHeight * k); - context.clearRect(0, 0, width, height); - context.drawImage(image, 0, 0, naturalWidth, naturalHeight, 0, 0, width, height); - var imageData = context.getImageData(0, 0, width, height); - var d = imageData.data; - var TRANSPARENT_ALPHA_THRESHOLD = 0.05; - var DARK_LIGHTNESS_THRESHOLD = 0.4; - var LIGHT_LIGHTNESS_THRESHOLD = 0.7; - var transparentPixelsCount = 0; - var darkPixelsCount = 0; - var lightPixelsCount = 0; - var i, x, y; - var r, g, b, a; - var l; - for (y = 0; y < height; y++) { - for (x = 0; x < width; x++) { - i = 4 * (y * width + x); - r = d[i + 0] / 255; - g = d[i + 1] / 255; - b = d[i + 2] / 255; - a = d[i + 3] / 255; - if (a < TRANSPARENT_ALPHA_THRESHOLD) { - transparentPixelsCount++; - } - else { - l = 0.2126 * r + 0.7152 * g + 0.0722 * b; - if (l < DARK_LIGHTNESS_THRESHOLD) { - darkPixelsCount++; - } - if (l > LIGHT_LIGHTNESS_THRESHOLD) { - lightPixelsCount++; - } - } - } - } - var totalPixelsCount = width * height; - var opaquePixelsCount = totalPixelsCount - transparentPixelsCount; - var DARK_IMAGE_THRESHOLD = 0.7; - var LIGHT_IMAGE_THRESHOLD = 0.7; - var TRANSPARENT_IMAGE_THRESHOLD = 0.1; - var LARGE_IMAGE_PIXELS_COUNT = 800 * 600; - return { - isDark: ((darkPixelsCount / opaquePixelsCount) >= DARK_IMAGE_THRESHOLD), - isLight: ((lightPixelsCount / opaquePixelsCount) >= LIGHT_IMAGE_THRESHOLD), - isTransparent: ((transparentPixelsCount / totalPixelsCount) >= TRANSPARENT_IMAGE_THRESHOLD), - isLarge: (naturalPixelsCount >= LARGE_IMAGE_PIXELS_COUNT), - }; - } - var objectURLs = new Set(); - function getFilteredImageDataURL(_a, filter) { - var dataURL = _a.dataURL, width = _a.width, height = _a.height; - var matrix = getSVGFilterMatrixValue(filter); - var svg = [ - "", - '', - '', - "", - '', - '', - "", - '', - ].join(''); - var bytes = new Uint8Array(svg.length); - for (var i = 0; i < svg.length; i++) { - bytes[i] = svg.charCodeAt(i); - } - var blob = new Blob([bytes], { type: 'image/svg+xml' }); - var objectURL = URL.createObjectURL(blob); - objectURLs.add(objectURL); - return objectURL; - } - function cleanImageProcessingCache() { - removeCanvas(); - objectURLs.forEach(function (u) { return URL.revokeObjectURL(u); }); - objectURLs.clear(); - } - - function getModifiableCSSDeclaration(property, value, rule, ignoreImageSelectors, isCancelled) { - var important = Boolean(rule && rule.style && rule.style.getPropertyPriority(property)); - var sourceValue = value; - if (property.startsWith('--')) { - return null; - } - else if ((property.indexOf('color') >= 0 && property !== '-webkit-print-color-adjust') || - property === 'fill' || - property === 'stroke') { - var modifier = getColorModifier(property, value); - if (modifier) { - return { property: property, value: modifier, important: important, sourceValue: sourceValue }; - } - } - else if (property === 'background-image' || property === 'list-style-image') { - var modifier = getBgImageModifier(value, rule, ignoreImageSelectors, isCancelled); - if (modifier) { - return { property: property, value: modifier, important: important, sourceValue: sourceValue }; - } - } - else if (property.indexOf('shadow') >= 0) { - var modifier = getShadowModifier(property, value); - if (modifier) { - return { property: property, value: modifier, important: important, sourceValue: sourceValue }; - } - } - return null; - } - function getModifiedUserAgentStyle(theme, isIFrame, styleSystemControls) { - var lines = []; - if (!isIFrame) { - lines.push('html {'); - lines.push(" background-color: " + modifyBackgroundColor({ r: 255, g: 255, b: 255 }, theme) + " !important;"); - lines.push('}'); - } - lines.push("" + (isIFrame ? '' : 'html, body, ') + (styleSystemControls ? 'input, textarea, select, button' : '') + " {"); - lines.push(" background-color: " + modifyBackgroundColor({ r: 255, g: 255, b: 255 }, theme) + ";"); - lines.push('}'); - lines.push("html, body, " + (styleSystemControls ? 'input, textarea, select, button' : '') + " {"); - lines.push(" border-color: " + modifyBorderColor({ r: 76, g: 76, b: 76 }, theme) + ";"); - lines.push(" color: " + modifyForegroundColor({ r: 0, g: 0, b: 0 }, theme) + ";"); - lines.push('}'); - lines.push('a {'); - lines.push(" color: " + modifyForegroundColor({ r: 0, g: 64, b: 255 }, theme) + ";"); - lines.push('}'); - lines.push('table {'); - lines.push(" border-color: " + modifyBorderColor({ r: 128, g: 128, b: 128 }, theme) + ";"); - lines.push('}'); - lines.push('::placeholder {'); - lines.push(" color: " + modifyForegroundColor({ r: 169, g: 169, b: 169 }, theme) + ";"); - lines.push('}'); - lines.push('input:-webkit-autofill,'); - lines.push('textarea:-webkit-autofill,'); - lines.push('select:-webkit-autofill {'); - lines.push(" background-color: " + modifyBackgroundColor({ r: 250, g: 255, b: 189 }, theme) + " !important;"); - lines.push(" color: " + modifyForegroundColor({ r: 0, g: 0, b: 0 }, theme) + " !important;"); - lines.push('}'); - if (theme.scrollbarColor) { - lines.push(getModifiedScrollbarStyle(theme)); - } - if (theme.selectionColor) { - lines.push(getModifiedSelectionStyle(theme)); - } - return lines.join('\n'); - } - function getSelectionColor(theme) { - var backgroundColorSelection; - var foregroundColorSelection; - if (theme.selectionColor === 'auto') { - backgroundColorSelection = modifyBackgroundColor({ r: 0, g: 96, b: 212 }, __assign(__assign({}, theme), { grayscale: 0 })); - foregroundColorSelection = modifyForegroundColor({ r: 255, g: 255, b: 255 }, __assign(__assign({}, theme), { grayscale: 0 })); - } - else { - var rgb = parse(theme.selectionColor); - var hsl = rgbToHSL(rgb); - backgroundColorSelection = theme.selectionColor; - if (hsl.l < 0.5) { - foregroundColorSelection = '#FFF'; - } - else { - foregroundColorSelection = '#000'; - } - } - return { backgroundColorSelection: backgroundColorSelection, foregroundColorSelection: foregroundColorSelection }; - } - function getModifiedSelectionStyle(theme) { - var lines = []; - var modifiedSelectionColor = getSelectionColor(theme); - var backgroundColorSelection = modifiedSelectionColor.backgroundColorSelection; - var foregroundColorSelection = modifiedSelectionColor.foregroundColorSelection; - ['::selection', '::-moz-selection'].forEach(function (selection) { - lines.push(selection + " {"); - lines.push(" background-color: " + backgroundColorSelection + " !important;"); - lines.push(" color: " + foregroundColorSelection + " !important;"); - lines.push('}'); - }); - return lines.join('\n'); - } - function getModifiedScrollbarStyle(theme) { - var lines = []; - var colorTrack; - var colorIcons; - var colorThumb; - var colorThumbHover; - var colorThumbActive; - var colorCorner; - if (theme.scrollbarColor === 'auto') { - colorTrack = modifyBackgroundColor({ r: 241, g: 241, b: 241 }, theme); - colorIcons = modifyForegroundColor({ r: 96, g: 96, b: 96 }, theme); - colorThumb = modifyBackgroundColor({ r: 176, g: 176, b: 176 }, theme); - colorThumbHover = modifyBackgroundColor({ r: 144, g: 144, b: 144 }, theme); - colorThumbActive = modifyBackgroundColor({ r: 96, g: 96, b: 96 }, theme); - colorCorner = modifyBackgroundColor({ r: 255, g: 255, b: 255 }, theme); - } - else { - var rgb = parse(theme.scrollbarColor); - var hsl_1 = rgbToHSL(rgb); - var isLight = hsl_1.l > 0.5; - var lighten = function (lighter) { return (__assign(__assign({}, hsl_1), { l: clamp(hsl_1.l + lighter, 0, 1) })); }; - var darken = function (darker) { return (__assign(__assign({}, hsl_1), { l: clamp(hsl_1.l - darker, 0, 1) })); }; - colorTrack = hslToString(darken(0.4)); - colorIcons = hslToString(isLight ? darken(0.4) : lighten(0.4)); - colorThumb = hslToString(hsl_1); - colorThumbHover = hslToString(lighten(0.1)); - colorThumbActive = hslToString(lighten(0.2)); - } - lines.push('::-webkit-scrollbar {'); - lines.push(" background-color: " + colorTrack + ";"); - lines.push(" color: " + colorIcons + ";"); - lines.push('}'); - lines.push('::-webkit-scrollbar-thumb {'); - lines.push(" background-color: " + colorThumb + ";"); - lines.push('}'); - lines.push('::-webkit-scrollbar-thumb:hover {'); - lines.push(" background-color: " + colorThumbHover + ";"); - lines.push('}'); - lines.push('::-webkit-scrollbar-thumb:active {'); - lines.push(" background-color: " + colorThumbActive + ";"); - lines.push('}'); - lines.push('::-webkit-scrollbar-corner {'); - lines.push(" background-color: " + colorCorner + ";"); - lines.push('}'); - lines.push('* {'); - lines.push(" scrollbar-color: " + colorTrack + " " + colorThumb + ";"); - lines.push('}'); - return lines.join('\n'); - } - function getModifiedFallbackStyle(filter, _a) { - var strict = _a.strict; - var lines = []; - lines.push("html, body, " + (strict ? 'body :not(iframe)' : 'body > :not(iframe)') + " {"); - lines.push(" background-color: " + modifyBackgroundColor({ r: 255, g: 255, b: 255 }, filter) + " !important;"); - lines.push(" border-color: " + modifyBorderColor({ r: 64, g: 64, b: 64 }, filter) + " !important;"); - lines.push(" color: " + modifyForegroundColor({ r: 0, g: 0, b: 0 }, filter) + " !important;"); - lines.push('}'); - return lines.join('\n'); - } - var unparsableColors = new Set([ - 'inherit', - 'transparent', - 'initial', - 'currentcolor', - 'none', - 'unset', - ]); - var colorParseCache$1 = new Map(); - function parseColorWithCache($color) { - $color = $color.trim(); - if (colorParseCache$1.has($color)) { - return colorParseCache$1.get($color); - } - var color = parse($color); - colorParseCache$1.set($color, color); - return color; - } - function tryParseColor($color) { - try { - return parseColorWithCache($color); - } - catch (err) { - return null; - } - } - function getColorModifier(prop, value) { - if (unparsableColors.has(value.toLowerCase())) { - return value; - } - try { - var rgb_1 = parseColorWithCache(value); - if (prop.indexOf('background') >= 0) { - return function (filter) { return modifyBackgroundColor(rgb_1, filter); }; - } - if (prop.indexOf('border') >= 0 || prop.indexOf('outline') >= 0) { - return function (filter) { return modifyBorderColor(rgb_1, filter); }; - } - return function (filter) { return modifyForegroundColor(rgb_1, filter); }; - } - catch (err) { - logWarn('Color parse error', err); - return null; - } - } - var gradientRegex = /[\-a-z]+gradient\(([^\(\)]*(\(([^\(\)]*(\(.*?\)))*[^\(\)]*\))){0,15}[^\(\)]*\)/g; - var imageDetailsCache = new Map(); - var awaitingForImageLoading = new Map(); - function shouldIgnoreImage(rule, selectors) { - if (!rule || selectors.length === 0) { - return false; - } - if (selectors.some(function (s) { return s === '*'; })) { - return true; - } - var ruleSelectors = rule.selectorText.split(/,\s*/g); - var _loop_1 = function (i) { - var ignoredSelector = selectors[i]; - if (ruleSelectors.some(function (s) { return s === ignoredSelector; })) { - return { value: true }; - } - }; - for (var i = 0; i < selectors.length; i++) { - var state_1 = _loop_1(i); - if (typeof state_1 === "object") - return state_1.value; - } - return false; - } - function getBgImageModifier(value, rule, ignoreImageSelectors, isCancelled) { - var _this = this; - try { - var gradients = getMatches(gradientRegex, value); - var urls = getMatches(cssURLRegex, value); - if (urls.length === 0 && gradients.length === 0) { - return value; - } - var getIndices = function (matches) { - var index = 0; - return matches.map(function (match) { - var valueIndex = value.indexOf(match, index); - index = valueIndex + match.length; - return { match: match, index: valueIndex }; - }); - }; - var matches_1 = getIndices(urls).map(function (i) { return (__assign({ type: 'url' }, i)); }) - .concat(getIndices(gradients).map(function (i) { return (__assign({ type: 'gradient' }, i)); })) - .sort(function (a, b) { return a.index - b.index; }); - var getGradientModifier_1 = function (gradient) { - var match = gradient.match(/^(.*-gradient)\((.*)\)$/); - var type = match[1]; - var content = match[2]; - var partsRegex = /([^\(\),]+(\([^\(\)]*(\([^\(\)]*\)*[^\(\)]*)?\))?[^\(\),]*),?/g; - var colorStopRegex = /^(from|color-stop|to)\(([^\(\)]*?,\s*)?(.*?)\)$/; - var parts = getMatches(partsRegex, content, 1).map(function (part) { - part = part.trim(); - var rgb = tryParseColor(part); - if (rgb) { - return function (filter) { return modifyGradientColor(rgb, filter); }; - } - var space = part.lastIndexOf(' '); - rgb = tryParseColor(part.substring(0, space)); - if (rgb) { - return function (filter) { return modifyGradientColor(rgb, filter) + " " + part.substring(space + 1); }; - } - var colorStopMatch = part.match(colorStopRegex); - if (colorStopMatch) { - rgb = tryParseColor(colorStopMatch[3]); - if (rgb) { - return function (filter) { return colorStopMatch[1] + "(" + (colorStopMatch[2] ? colorStopMatch[2] + ", " : '') + modifyGradientColor(rgb, filter) + ")"; }; - } - } - return function () { return part; }; - }); - return function (filter) { - return type + "(" + parts.map(function (modify) { return modify(filter); }).join(', ') + ")"; - }; - }; - var getURLModifier_1 = function (urlValue) { - var url = getCSSURLValue(urlValue); - if (rule.parentStyleSheet.href) { - var basePath = getCSSBaseBath(rule.parentStyleSheet.href); - url = getAbsoluteURL(basePath, url); - } - else if (rule.parentStyleSheet.ownerNode && rule.parentStyleSheet.ownerNode.baseURI) { - url = getAbsoluteURL(rule.parentStyleSheet.ownerNode.baseURI, url); - } - else { - url = getAbsoluteURL(location.origin, url); - } - var absoluteValue = "url(\"" + url + "\")"; - return function (filter) { return __awaiter(_this, void 0, void 0, function () { - var imageDetails, awaiters_1, err_1, bgImageValue; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - if (!imageDetailsCache.has(url)) return [3, 1]; - imageDetails = imageDetailsCache.get(url); - return [3, 7]; - case 1: - _a.trys.push([1, 6, , 7]); - if (shouldIgnoreImage(rule, ignoreImageSelectors)) { - return [2, null]; - } - if (!awaitingForImageLoading.has(url)) return [3, 3]; - awaiters_1 = awaitingForImageLoading.get(url); - return [4, new Promise(function (resolve) { return awaiters_1.push(resolve); })]; - case 2: - imageDetails = _a.sent(); - if (!imageDetails) { - return [2, null]; - } - return [3, 5]; - case 3: - awaitingForImageLoading.set(url, []); - return [4, getImageDetails(url)]; - case 4: - imageDetails = _a.sent(); - imageDetailsCache.set(url, imageDetails); - awaitingForImageLoading.get(url).forEach(function (resolve) { return resolve(imageDetails); }); - awaitingForImageLoading.delete(url); - _a.label = 5; - case 5: - if (isCancelled()) { - return [2, null]; - } - return [3, 7]; - case 6: - err_1 = _a.sent(); - logWarn(err_1); - if (awaitingForImageLoading.has(url)) { - awaitingForImageLoading.get(url).forEach(function (resolve) { return resolve(null); }); - awaitingForImageLoading.delete(url); - } - return [2, absoluteValue]; - case 7: - bgImageValue = getBgImageValue_1(imageDetails, filter) || absoluteValue; - return [2, bgImageValue]; - } - }); - }); }; - }; - var getBgImageValue_1 = function (imageDetails, filter) { - var isDark = imageDetails.isDark, isLight = imageDetails.isLight, isTransparent = imageDetails.isTransparent, isLarge = imageDetails.isLarge, width = imageDetails.width; - var result; - if (isDark && isTransparent && filter.mode === 1 && !isLarge && width > 2) { - logInfo("Inverting dark image " + imageDetails.src); - var inverted = getFilteredImageDataURL(imageDetails, __assign(__assign({}, filter), { sepia: clamp(filter.sepia + 10, 0, 100) })); - result = "url(\"" + inverted + "\")"; - } - else if (isLight && !isTransparent && filter.mode === 1) { - if (isLarge) { - result = 'none'; - } - else { - logInfo("Dimming light image " + imageDetails.src); - var dimmed = getFilteredImageDataURL(imageDetails, filter); - result = "url(\"" + dimmed + "\")"; - } - } - else if (filter.mode === 0 && isLight && !isLarge) { - logInfo("Applying filter to image " + imageDetails.src); - var filtered = getFilteredImageDataURL(imageDetails, __assign(__assign({}, filter), { brightness: clamp(filter.brightness - 10, 5, 200), sepia: clamp(filter.sepia + 10, 0, 100) })); - result = "url(\"" + filtered + "\")"; - } - else { - result = null; - } - return result; - }; - var modifiers_1 = []; - var index_1 = 0; - matches_1.forEach(function (_a, i) { - var match = _a.match, type = _a.type, matchStart = _a.index; - var prefixStart = index_1; - var matchEnd = matchStart + match.length; - index_1 = matchEnd; - modifiers_1.push(function () { return value.substring(prefixStart, matchStart); }); - modifiers_1.push(type === 'url' ? getURLModifier_1(match) : getGradientModifier_1(match)); - if (i === matches_1.length - 1) { - modifiers_1.push(function () { return value.substring(matchEnd); }); - } - }); - return function (filter) { - var results = modifiers_1.map(function (modify) { return modify(filter); }); - if (results.some(function (r) { return r instanceof Promise; })) { - return Promise.all(results) - .then(function (asyncResults) { - return asyncResults.join(''); - }); - } - return results.join(''); - }; - } - catch (err) { - logWarn("Unable to parse gradient " + value, err); - return null; - } - } - function getShadowModifier(prop, value) { - try { - var index_2 = 0; - var colorMatches_1 = getMatches(/(^|\s)([a-z]+\(.+?\)|#[0-9a-f]+|[a-z]+)(.*?(inset|outset)?($|,))/ig, value, 2); - var modifiers_2 = colorMatches_1.map(function (match, i) { - var prefixIndex = index_2; - var matchIndex = value.indexOf(match, index_2); - var matchEnd = matchIndex + match.length; - index_2 = matchEnd; - var rgb = tryParseColor(match); - if (!rgb) { - return function () { return value.substring(prefixIndex, matchEnd); }; - } - return function (filter) { return "" + value.substring(prefixIndex, matchIndex) + modifyShadowColor(rgb, filter) + (i === colorMatches_1.length - 1 ? value.substring(matchEnd) : ''); }; - }); - return function (filter) { return modifiers_2.map(function (modify) { return modify(filter); }).join(''); }; - } - catch (err) { - logWarn("Unable to parse shadow " + value, err); - return null; - } - } - function cleanModificationCache() { - colorParseCache$1.clear(); - clearColorModificationCache(); - imageDetailsCache.clear(); - cleanImageProcessingCache(); - awaitingForImageLoading.clear(); - } - - var overrides = { - 'background-color': { - customProp: '--darkreader-inline-bgcolor', - cssProp: 'background-color', - dataAttr: 'data-darkreader-inline-bgcolor', - store: new WeakSet(), - }, - 'background-image': { - customProp: '--darkreader-inline-bgimage', - cssProp: 'background-image', - dataAttr: 'data-darkreader-inline-bgimage', - store: new WeakSet(), - }, - 'border-color': { - customProp: '--darkreader-inline-border', - cssProp: 'border-color', - dataAttr: 'data-darkreader-inline-border', - store: new WeakSet(), - }, - 'border-bottom-color': { - customProp: '--darkreader-inline-border-bottom', - cssProp: 'border-bottom-color', - dataAttr: 'data-darkreader-inline-border-bottom', - store: new WeakSet(), - }, - 'border-left-color': { - customProp: '--darkreader-inline-border-left', - cssProp: 'border-left-color', - dataAttr: 'data-darkreader-inline-border-left', - store: new WeakSet(), - }, - 'border-right-color': { - customProp: '--darkreader-inline-border-right', - cssProp: 'border-right-color', - dataAttr: 'data-darkreader-inline-border-right', - store: new WeakSet(), - }, - 'border-top-color': { - customProp: '--darkreader-inline-border-top', - cssProp: 'border-top-color', - dataAttr: 'data-darkreader-inline-border-top', - store: new WeakSet(), - }, - 'box-shadow': { - customProp: '--darkreader-inline-boxshadow', - cssProp: 'box-shadow', - dataAttr: 'data-darkreader-inline-boxshadow', - store: new WeakSet(), - }, - 'color': { - customProp: '--darkreader-inline-color', - cssProp: 'color', - dataAttr: 'data-darkreader-inline-color', - store: new WeakSet(), - }, - 'fill': { - customProp: '--darkreader-inline-fill', - cssProp: 'fill', - dataAttr: 'data-darkreader-inline-fill', - store: new WeakSet(), - }, - 'stroke': { - customProp: '--darkreader-inline-stroke', - cssProp: 'stroke', - dataAttr: 'data-darkreader-inline-stroke', - store: new WeakSet(), - }, - 'outline-color': { - customProp: '--darkreader-inline-outline', - cssProp: 'outline-color', - dataAttr: 'data-darkreader-inline-outline', - store: new WeakSet(), - }, - }; - var overridesList = Object.values(overrides); - var INLINE_STYLE_ATTRS = ['style', 'fill', 'stroke', 'bgcolor', 'color']; - var INLINE_STYLE_SELECTOR = INLINE_STYLE_ATTRS.map(function (attr) { return "[" + attr + "]"; }).join(', '); - function getInlineOverrideStyle() { - return overridesList.map(function (_a) { - var dataAttr = _a.dataAttr, customProp = _a.customProp, cssProp = _a.cssProp; - return [ - "[" + dataAttr + "] {", - " " + cssProp + ": var(" + customProp + ") !important;", - '}', - ].join('\n'); - }).join('\n'); - } - function getInlineStyleElements(root) { - var results = []; - if (root instanceof Element && root.matches(INLINE_STYLE_SELECTOR)) { - results.push(root); - } - if (root instanceof Element || (IS_SHADOW_DOM_SUPPORTED && root instanceof ShadowRoot) || root instanceof Document) { - push(results, root.querySelectorAll(INLINE_STYLE_SELECTOR)); - } - return results; - } - var treeObservers = new Map(); - var attrObservers = new Map(); - function watchForInlineStyles(elementStyleDidChange, shadowRootDiscovered) { - deepWatchForInlineStyles(document, elementStyleDidChange, shadowRootDiscovered); - iterateShadowHosts(document.documentElement, function (host) { - deepWatchForInlineStyles(host.shadowRoot, elementStyleDidChange, shadowRootDiscovered); - }); - } - function deepWatchForInlineStyles(root, elementStyleDidChange, shadowRootDiscovered) { - if (treeObservers.has(root)) { - treeObservers.get(root).disconnect(); - attrObservers.get(root).disconnect(); - } - var discoveredNodes = new WeakSet(); - function discoverNodes(node) { - getInlineStyleElements(node).forEach(function (el) { - if (discoveredNodes.has(el)) { - return; - } - discoveredNodes.add(el); - elementStyleDidChange(el); - }); - iterateShadowHosts(node, function (n) { - if (discoveredNodes.has(node)) { - return; - } - discoveredNodes.add(node); - shadowRootDiscovered(n.shadowRoot); - deepWatchForInlineStyles(n.shadowRoot, elementStyleDidChange, shadowRootDiscovered); - }); - } - var treeObserver = createOptimizedTreeObserver(root, { - onMinorMutations: function (_a) { - var additions = _a.additions; - additions.forEach(function (added) { return discoverNodes(added); }); - }, - onHugeMutations: function () { - discoverNodes(root); - }, - }); - treeObservers.set(root, treeObserver); - var attrObserver = new MutationObserver(function (mutations) { - mutations.forEach(function (m) { - if (INLINE_STYLE_ATTRS.includes(m.attributeName)) { - elementStyleDidChange(m.target); - } - overridesList - .filter(function (_a) { - var store = _a.store, dataAttr = _a.dataAttr; - return store.has(m.target) && !m.target.hasAttribute(dataAttr); - }) - .forEach(function (_a) { - var dataAttr = _a.dataAttr; - return m.target.setAttribute(dataAttr, ''); - }); - }); - }); - attrObserver.observe(root, { - attributes: true, - attributeFilter: INLINE_STYLE_ATTRS.concat(overridesList.map(function (_a) { - var dataAttr = _a.dataAttr; - return dataAttr; - })), - subtree: true, - }); - attrObservers.set(root, attrObserver); - } - function stopWatchingForInlineStyles() { - treeObservers.forEach(function (o) { return o.disconnect(); }); - attrObservers.forEach(function (o) { return o.disconnect(); }); - treeObservers.clear(); - attrObservers.clear(); - } - var inlineStyleCache = new WeakMap(); - var filterProps = ['brightness', 'contrast', 'grayscale', 'sepia', 'mode']; - function getInlineStyleCacheKey(el, theme) { - return INLINE_STYLE_ATTRS - .map(function (attr) { return attr + "=\"" + el.getAttribute(attr) + "\""; }) - .concat(filterProps.map(function (prop) { return prop + "=\"" + theme[prop] + "\""; })) - .join(' '); - } - function shouldIgnoreInlineStyle(element, selectors) { - for (var i = 0, len = selectors.length; i < len; i++) { - var ingnoredSelector = selectors[i]; - if (element.matches(ingnoredSelector)) { - return true; - } - } - return false; - } - function overrideInlineStyle(element, theme, ignoreInlineSelectors, ignoreImageSelectors) { - var cacheKey = getInlineStyleCacheKey(element, theme); - if (cacheKey === inlineStyleCache.get(element)) { - return; - } - var unsetProps = new Set(Object.keys(overrides)); - function setCustomProp(targetCSSProp, modifierCSSProp, cssVal) { - var _a = overrides[targetCSSProp], customProp = _a.customProp, dataAttr = _a.dataAttr; - var mod = getModifiableCSSDeclaration(modifierCSSProp, cssVal, null, ignoreImageSelectors, null); - if (!mod) { - return; - } - var value = mod.value; - if (typeof value === 'function') { - value = value(theme); - } - element.style.setProperty(customProp, value); - if (!element.hasAttribute(dataAttr)) { - element.setAttribute(dataAttr, ''); - } - unsetProps.delete(targetCSSProp); - } - if (ignoreInlineSelectors.length > 0) { - if (shouldIgnoreInlineStyle(element, ignoreInlineSelectors)) { - unsetProps.forEach(function (cssProp) { - var _a = overrides[cssProp], store = _a.store, dataAttr = _a.dataAttr; - store.delete(element); - element.removeAttribute(dataAttr); - }); - return; - } - } - if (element.hasAttribute('bgcolor')) { - var value = element.getAttribute('bgcolor'); - if (value.match(/^[0-9a-f]{3}$/i) || value.match(/^[0-9a-f]{6}$/i)) { - value = "#" + value; - } - setCustomProp('background-color', 'background-color', value); - } - if (element.hasAttribute('color')) { - var value = element.getAttribute('color'); - if (value.match(/^[0-9a-f]{3}$/i) || value.match(/^[0-9a-f]{6}$/i)) { - value = "#" + value; - } - setCustomProp('color', 'color', value); - } - if (element.hasAttribute('fill') && element instanceof SVGElement) { - var SMALL_SVG_LIMIT = 32; - var value = element.getAttribute('fill'); - var isBg = false; - if (!(element instanceof SVGTextElement)) { - var _a = element.getBoundingClientRect(), width = _a.width, height = _a.height; - isBg = (width > SMALL_SVG_LIMIT || height > SMALL_SVG_LIMIT); - } - setCustomProp('fill', isBg ? 'background-color' : 'color', value); - } - if (element.hasAttribute('stroke')) { - var value = element.getAttribute('stroke'); - setCustomProp('stroke', element instanceof SVGLineElement || element instanceof SVGTextElement ? 'border-color' : 'color', value); - } - element.style && iterateCSSDeclarations(element.style, function (property, value) { - if (property === 'background-image' && value.indexOf('url') >= 0) { - return; - } - if (overrides.hasOwnProperty(property)) { - setCustomProp(property, property, value); - } - }); - if (element.style && element instanceof SVGTextElement && element.style.fill) { - setCustomProp('fill', 'color', element.style.getPropertyValue('fill')); - } - forEach(unsetProps, function (cssProp) { - var _a = overrides[cssProp], store = _a.store, dataAttr = _a.dataAttr; - store.delete(element); - element.removeAttribute(dataAttr); - }); - inlineStyleCache.set(element, getInlineStyleCacheKey(element, theme)); - } - - var metaThemeColorName = 'theme-color'; - var metaThemeColorSelector = "meta[name=\"" + metaThemeColorName + "\"]"; - var srcMetaThemeColor = null; - var observer = null; - function changeMetaThemeColor(meta, theme) { - srcMetaThemeColor = srcMetaThemeColor || meta.content; - try { - var color = parse(srcMetaThemeColor); - meta.content = modifyBackgroundColor(color, theme); - } - catch (err) { - logWarn(err); - } - } - function changeMetaThemeColorWhenAvailable(theme) { - var meta = document.querySelector(metaThemeColorSelector); - if (meta) { - changeMetaThemeColor(meta, theme); - } - else { - if (observer) { - observer.disconnect(); - } - observer = new MutationObserver(function (mutations) { - loop: for (var i = 0; i < mutations.length; i++) { - var addedNodes = mutations[i].addedNodes; - for (var j = 0; j < addedNodes.length; j++) { - var node = addedNodes[j]; - if (node instanceof HTMLMetaElement && node.name === metaThemeColorName) { - observer.disconnect(); - observer = null; - changeMetaThemeColor(node, theme); - break loop; - } - } - } - }); - observer.observe(document.head, { childList: true }); - } - } - function restoreMetaThemeColor() { - if (observer) { - observer.disconnect(); - observer = null; - } - var meta = document.querySelector(metaThemeColorSelector); - if (meta && srcMetaThemeColor) { - meta.content = srcMetaThemeColor; - } - } - - var themeCacheKeys$1 = [ - 'mode', - 'brightness', - 'contrast', - 'grayscale', - 'sepia', - 'darkSchemeBackgroundColor', - 'darkSchemeTextColor', - 'lightSchemeBackgroundColor', - 'lightSchemeTextColor', - ]; - function getThemeKey(theme) { - return themeCacheKeys$1.map(function (p) { return p + ":" + theme[p]; }).join(';'); - } - function getTempCSSStyleSheet() { - if (isCSSStyleSheetConstructorSupported()) { - return { sheet: new CSSStyleSheet(), remove: function () { return null; } }; - } - var style = document.createElement('style'); - style.classList.add('darkreader'); - style.classList.add('darkreader--temp'); - style.media = 'screen'; - (document.head || document).append(style); - return { sheet: style.sheet, remove: function () { return style.remove(); } }; - } - var asyncQueue = createAsyncTasksQueue(); - function createStyleSheetModifier() { - var renderId = 0; - var rulesTextCache = new Map(); - var rulesModCache = new Map(); - var prevFilterKey = null; - function modifySheet(options) { - var rules = options.sourceCSSRules; - var theme = options.theme, variables = options.variables, ignoreImageAnalysis = options.ignoreImageAnalysis, force = options.force, prepareSheet = options.prepareSheet, isAsyncCancelled = options.isAsyncCancelled; - var rulesChanged = (rulesModCache.size === 0); - var notFoundCacheKeys = new Set(rulesModCache.keys()); - var themeKey = getThemeKey(theme); - var themeChanged = (themeKey !== prevFilterKey); - var modRules = []; - iterateCSSRules(rules, function (rule) { - var cssText = rule.cssText; - var textDiffersFromPrev = false; - notFoundCacheKeys.delete(cssText); - if (!rulesTextCache.has(cssText)) { - rulesTextCache.set(cssText, cssText); - textDiffersFromPrev = true; - } - var vars; - var varsRule = null; - if (variables.size > 0 || cssText.includes('var(')) { - var cssTextWithVariables = replaceCSSVariables(cssText, variables); - if (rulesTextCache.get(cssText) !== cssTextWithVariables) { - rulesTextCache.set(cssText, cssTextWithVariables); - textDiffersFromPrev = true; - vars = getTempCSSStyleSheet(); - vars.sheet.insertRule(cssTextWithVariables); - varsRule = vars.sheet.cssRules[0]; - } - } - if (textDiffersFromPrev) { - rulesChanged = true; - } - else { - modRules.push(rulesModCache.get(cssText)); - return; - } - var modDecs = []; - var targetRule = varsRule || rule; - targetRule && targetRule.style && iterateCSSDeclarations(targetRule.style, function (property, value) { - var mod = getModifiableCSSDeclaration(property, value, rule, ignoreImageAnalysis, isAsyncCancelled); - if (mod) { - modDecs.push(mod); - } - }); - var modRule = null; - if (modDecs.length > 0) { - var parentRule = rule.parentRule; - modRule = { selector: rule.selectorText, declarations: modDecs, parentRule: parentRule }; - modRules.push(modRule); - } - rulesModCache.set(cssText, modRule); - vars && vars.remove(); - }); - notFoundCacheKeys.forEach(function (key) { - rulesTextCache.delete(key); - rulesModCache.delete(key); - }); - prevFilterKey = themeKey; - if (!force && !rulesChanged && !themeChanged) { - return; - } - renderId++; - function setRule(target, index, rule) { - var selector = rule.selector, declarations = rule.declarations; - target.insertRule(selector + " {}", index); - var style = target.cssRules.item(index).style; - declarations.forEach(function (_a) { - var property = _a.property, value = _a.value, important = _a.important, sourceValue = _a.sourceValue; - style.setProperty(property, value == null ? sourceValue : value, important ? 'important' : ''); - }); - } - var asyncDeclarations = new Map(); - var asyncDeclarationCounter = 0; - var rootReadyGroup = { rule: null, rules: [], isGroup: true }; - var groupRefs = new WeakMap(); - function getGroup(rule) { - if (rule == null) { - return rootReadyGroup; - } - if (groupRefs.has(rule)) { - return groupRefs.get(rule); - } - var group = { rule: rule, rules: [], isGroup: true }; - groupRefs.set(rule, group); - var parentGroup = getGroup(rule.parentRule); - parentGroup.rules.push(group); - return group; - } - modRules.filter(function (r) { return r; }).forEach(function (_a) { - var selector = _a.selector, declarations = _a.declarations, parentRule = _a.parentRule; - var group = getGroup(parentRule); - var readyStyleRule = { selector: selector, declarations: [], isGroup: false }; - var readyDeclarations = readyStyleRule.declarations; - group.rules.push(readyStyleRule); - declarations.forEach(function (_a) { - var property = _a.property, value = _a.value, important = _a.important, sourceValue = _a.sourceValue; - if (typeof value === 'function') { - var modified = value(theme); - if (modified instanceof Promise) { - var asyncKey_1 = asyncDeclarationCounter++; - var asyncDeclaration_1 = { property: property, value: null, important: important, asyncKey: asyncKey_1, sourceValue: sourceValue }; - readyDeclarations.push(asyncDeclaration_1); - var promise = modified; - var currentRenderId_1 = renderId; - promise.then(function (asyncValue) { - if (!asyncValue || isAsyncCancelled() || currentRenderId_1 !== renderId) { - return; - } - asyncDeclaration_1.value = asyncValue; - asyncQueue.add(function () { - if (isAsyncCancelled() || currentRenderId_1 !== renderId) { - return; - } - rebuildAsyncRule(asyncKey_1); - }); - }); - } - else { - readyDeclarations.push({ property: property, value: modified, important: important, sourceValue: sourceValue }); - } - } - else { - readyDeclarations.push({ property: property, value: value, important: important, sourceValue: sourceValue }); - } - }); - }); - var sheet = prepareSheet(); - function buildStyleSheet() { - function createTarget(group, parent) { - var rule = group.rule; - if (rule instanceof CSSMediaRule) { - var media = rule.media; - var index = parent.cssRules.length; - parent.insertRule("@media " + media + " {}", index); - return parent.cssRules[index]; - } - return parent; - } - function iterateReadyRules(group, target, styleIterator) { - group.rules.forEach(function (r) { - if (r.isGroup) { - var t = createTarget(r, target); - iterateReadyRules(r, t, styleIterator); - } - else { - styleIterator(r, target); - } - }); - } - iterateReadyRules(rootReadyGroup, sheet, function (rule, target) { - var index = target.cssRules.length; - rule.declarations - .filter(function (_a) { - var value = _a.value; - return value == null; - }) - .forEach(function (_a) { - var asyncKey = _a.asyncKey; - return asyncDeclarations.set(asyncKey, { rule: rule, target: target, index: index }); - }); - setRule(target, index, rule); - }); - } - function rebuildAsyncRule(key) { - var _a = asyncDeclarations.get(key), rule = _a.rule, target = _a.target, index = _a.index; - target.deleteRule(index); - setRule(target, index, rule); - asyncDeclarations.delete(key); - } - buildStyleSheet(); - } - return { modifySheet: modifySheet }; - } - - var STYLE_SELECTOR = 'style, link[rel*="stylesheet" i]:not([disabled])'; - function shouldManageStyle(element) { - return (((element instanceof HTMLStyleElement) || - (element instanceof SVGStyleElement) || - (element instanceof HTMLLinkElement && - element.rel && - element.rel.toLowerCase().includes('stylesheet') && - !element.disabled)) && - !element.classList.contains('darkreader') && - element.media !== 'print' && - !element.classList.contains('stylus')); - } - function getManageableStyles(node, results, deep) { - if (results === void 0) { results = []; } - if (deep === void 0) { deep = true; } - if (shouldManageStyle(node)) { - results.push(node); - } - else if (node instanceof Element || (IS_SHADOW_DOM_SUPPORTED && node instanceof ShadowRoot) || node === document) { - forEach(node.querySelectorAll(STYLE_SELECTOR), function (style) { return getManageableStyles(style, results, false); }); - if (deep) { - iterateShadowHosts(node, function (host) { return getManageableStyles(host.shadowRoot, results, false); }); - } - } - return results; - } - var syncStyleSet = new WeakSet(); - var corsStyleSet = new WeakSet(); - function manageStyle(element, _a) { - var update = _a.update, loadingStart = _a.loadingStart, loadingEnd = _a.loadingEnd; - var prevStyles = []; - var next = element; - while ((next = next.nextElementSibling) && next.matches('.darkreader')) { - prevStyles.push(next); - } - var corsCopy = prevStyles.find(function (el) { return el.matches('.darkreader--cors') && !corsStyleSet.has(el); }) || null; - var syncStyle = prevStyles.find(function (el) { return el.matches('.darkreader--sync') && !syncStyleSet.has(el); }) || null; - var corsCopyPositionWatcher = null; - var syncStylePositionWatcher = null; - var cancelAsyncOperations = false; - var sheetModifier = createStyleSheetModifier(); - var observer = new MutationObserver(function () { - update(); - }); - var observerOptions = { attributes: true, childList: true, characterData: true }; - function containsCSSImport() { - return element instanceof HTMLStyleElement && element.textContent.trim().match(cssImportRegex); - } - function getRulesSync() { - if (corsCopy) { - return corsCopy.sheet.cssRules; - } - if (containsCSSImport()) { - return null; - } - return safeGetSheetRules(); - } - function insertStyle() { - if (corsCopy) { - if (element.nextSibling !== corsCopy) { - element.parentNode.insertBefore(corsCopy, element.nextSibling); - } - if (corsCopy.nextSibling !== syncStyle) { - element.parentNode.insertBefore(syncStyle, corsCopy.nextSibling); - } - } - else if (element.nextSibling !== syncStyle) { - element.parentNode.insertBefore(syncStyle, element.nextSibling); - } - } - function createSyncStyle() { - syncStyle = element instanceof SVGStyleElement ? - document.createElementNS('http://www.w3.org/2000/svg', 'style') : - document.createElement('style'); - syncStyle.classList.add('darkreader'); - syncStyle.classList.add('darkreader--sync'); - syncStyle.media = 'screen'; - syncStyleSet.add(syncStyle); - } - var isLoadingRules = false; - var wasLoadingError = false; - function getRulesAsync() { - return __awaiter(this, void 0, void 0, function () { - var cssText, cssBasePath, _a, cssRules, accessError, err_1, fullCSSText, err_2; - var _b; - return __generator(this, function (_c) { - switch (_c.label) { - case 0: - if (!(element instanceof HTMLLinkElement)) return [3, 7]; - _a = __read(getRulesOrError(), 2), cssRules = _a[0], accessError = _a[1]; - if (accessError) { - logWarn(accessError); - } - if (!((cssRules && !accessError) || isStillLoadingError(accessError))) return [3, 5]; - _c.label = 1; - case 1: - _c.trys.push([1, 3, , 4]); - return [4, linkLoading(element)]; - case 2: - _c.sent(); - return [3, 4]; - case 3: - err_1 = _c.sent(); - logWarn(err_1); - wasLoadingError = true; - return [3, 4]; - case 4: - if (cancelAsyncOperations) { - return [2, null]; - } - _b = __read(getRulesOrError(), 2), cssRules = _b[0], accessError = _b[1]; - if (accessError) { - logWarn(accessError); - } - _c.label = 5; - case 5: - if (cssRules != null) { - return [2, cssRules]; - } - return [4, loadText(element.href)]; - case 6: - cssText = _c.sent(); - cssBasePath = getCSSBaseBath(element.href); - if (cancelAsyncOperations) { - return [2, null]; - } - return [3, 8]; - case 7: - if (containsCSSImport()) { - cssText = element.textContent.trim(); - cssBasePath = getCSSBaseBath(location.href); - } - else { - return [2, null]; - } - _c.label = 8; - case 8: - if (!cssText) return [3, 13]; - _c.label = 9; - case 9: - _c.trys.push([9, 11, , 12]); - return [4, replaceCSSImports(cssText, cssBasePath)]; - case 10: - fullCSSText = _c.sent(); - corsCopy = createCORSCopy(element, fullCSSText); - return [3, 12]; - case 11: - err_2 = _c.sent(); - logWarn(err_2); - return [3, 12]; - case 12: - if (corsCopy) { - corsCopyPositionWatcher = watchForNodePosition(corsCopy, 'prev-sibling'); - return [2, corsCopy.sheet.cssRules]; - } - _c.label = 13; - case 13: return [2, null]; - } - }); - }); - } - function details() { - var rules = getRulesSync(); - if (!rules) { - if (isLoadingRules || wasLoadingError) { - return null; - } - isLoadingRules = true; - loadingStart(); - getRulesAsync().then(function (results) { - isLoadingRules = false; - loadingEnd(); - if (results) { - update(); - } - }).catch(function (err) { - logWarn(err); - isLoadingRules = false; - loadingEnd(); - }); - return null; - } - var variables = getCSSVariables(rules); - return { variables: variables }; - } - var forceRenderStyle = false; - function render(theme, variables, ignoreImageAnalysis) { - var rules = getRulesSync(); - if (!rules) { - return; - } - cancelAsyncOperations = false; - function prepareOverridesSheet() { - if (!syncStyle) { - createSyncStyle(); - } - syncStylePositionWatcher && syncStylePositionWatcher.stop(); - insertStyle(); - if (syncStyle.sheet == null) { - syncStyle.textContent = ''; - } - var sheet = syncStyle.sheet; - for (var i = sheet.cssRules.length - 1; i >= 0; i--) { - sheet.deleteRule(i); - } - if (syncStylePositionWatcher) { - syncStylePositionWatcher.run(); - } - else { - syncStylePositionWatcher = watchForNodePosition(syncStyle, 'prev-sibling', function () { - forceRenderStyle = true; - buildOverrides(); - }); - } - return syncStyle.sheet; - } - function buildOverrides() { - var force = forceRenderStyle; - forceRenderStyle = false; - sheetModifier.modifySheet({ - prepareSheet: prepareOverridesSheet, - sourceCSSRules: rules, - theme: theme, - variables: variables, - ignoreImageAnalysis: ignoreImageAnalysis, - force: force, - isAsyncCancelled: function () { return cancelAsyncOperations; }, - }); - } - buildOverrides(); - } - function getRulesOrError() { - try { - if (element.sheet == null) { - return [null, null]; - } - return [element.sheet.cssRules, null]; - } - catch (err) { - return [null, err]; - } - } - function isStillLoadingError(error) { - return error && error.message && error.message.includes('loading'); - } - function safeGetSheetRules() { - var _a = __read(getRulesOrError(), 2), cssRules = _a[0], err = _a[1]; - if (err) { - logWarn(err); - return null; - } - return cssRules; - } - var rulesChangeKey = null; - var rulesCheckFrameId = null; - function updateRulesChangeKey() { - var rules = safeGetSheetRules(); - if (rules) { - rulesChangeKey = rules.length; - } - } - function didRulesKeyChange() { - var rules = safeGetSheetRules(); - return rules && rules.length !== rulesChangeKey; - } - function subscribeToSheetChanges() { - updateRulesChangeKey(); - unsubscribeFromSheetChanges(); - var checkForUpdate = function () { - if (didRulesKeyChange()) { - updateRulesChangeKey(); - update(); - } - rulesCheckFrameId = requestAnimationFrame(checkForUpdate); - }; - checkForUpdate(); - } - function unsubscribeFromSheetChanges() { - cancelAnimationFrame(rulesCheckFrameId); - } - function pause() { - observer.disconnect(); - cancelAsyncOperations = true; - corsCopyPositionWatcher && corsCopyPositionWatcher.stop(); - syncStylePositionWatcher && syncStylePositionWatcher.stop(); - unsubscribeFromSheetChanges(); - } - function destroy() { - pause(); - removeNode(corsCopy); - removeNode(syncStyle); - } - function watch() { - observer.observe(element, observerOptions); - if (element instanceof HTMLStyleElement) { - subscribeToSheetChanges(); - } - } - var maxMoveCount = 10; - var moveCount = 0; - function restore() { - if (!syncStyle) { - return; - } - moveCount++; - if (moveCount > maxMoveCount) { - logWarn('Style sheet was moved multiple times', element); - return; - } - logWarn('Restore style', syncStyle, element); - var shouldForceRender = syncStyle.sheet == null || syncStyle.sheet.cssRules.length > 0; - insertStyle(); - corsCopyPositionWatcher && corsCopyPositionWatcher.skip(); - syncStylePositionWatcher && syncStylePositionWatcher.skip(); - if (shouldForceRender) { - forceRenderStyle = true; - updateRulesChangeKey(); - update(); - } - } - return { - details: details, - render: render, - pause: pause, - destroy: destroy, - watch: watch, - restore: restore, - }; - } - function linkLoading(link) { - return new Promise(function (resolve, reject) { - var cleanUp = function () { - link.removeEventListener('load', onLoad); - link.removeEventListener('error', onError); - }; - var onLoad = function () { - cleanUp(); - resolve(); - }; - var onError = function () { - cleanUp(); - reject("Link loading failed " + link.href); - }; - link.addEventListener('load', onLoad); - link.addEventListener('error', onError); - }); - } - function getCSSImportURL(importDeclaration) { - return getCSSURLValue(importDeclaration.substring(8).replace(/;$/, '')); - } - function loadText(url) { - return __awaiter(this, void 0, void 0, function () { - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - if (!url.startsWith('data:')) return [3, 3]; - return [4, fetch(url)]; - case 1: return [4, (_a.sent()).text()]; - case 2: return [2, _a.sent()]; - case 3: return [4, bgFetch({ url: url, responseType: 'text', mimeType: 'text/css' })]; - case 4: return [2, _a.sent()]; - } - }); - }); - } - function replaceCSSImports(cssText, basePath, cache) { - if (cache === void 0) { cache = new Map(); } - return __awaiter(this, void 0, void 0, function () { - var importMatches, importMatches_1, importMatches_1_1, match, importURL, absoluteURL, importedCSS, err_3, e_1_1; - var e_1, _a; - return __generator(this, function (_b) { - switch (_b.label) { - case 0: - cssText = removeCSSComments(cssText); - cssText = replaceCSSFontFace(cssText); - cssText = replaceCSSRelativeURLsWithAbsolute(cssText, basePath); - importMatches = getMatches(cssImportRegex, cssText); - _b.label = 1; - case 1: - _b.trys.push([1, 10, 11, 12]); - importMatches_1 = __values(importMatches), importMatches_1_1 = importMatches_1.next(); - _b.label = 2; - case 2: - if (!!importMatches_1_1.done) return [3, 9]; - match = importMatches_1_1.value; - importURL = getCSSImportURL(match); - absoluteURL = getAbsoluteURL(basePath, importURL); - importedCSS = void 0; - if (!cache.has(absoluteURL)) return [3, 3]; - importedCSS = cache.get(absoluteURL); - return [3, 7]; - case 3: - _b.trys.push([3, 6, , 7]); - return [4, loadText(absoluteURL)]; - case 4: - importedCSS = _b.sent(); - cache.set(absoluteURL, importedCSS); - return [4, replaceCSSImports(importedCSS, getCSSBaseBath(absoluteURL), cache)]; - case 5: - importedCSS = _b.sent(); - return [3, 7]; - case 6: - err_3 = _b.sent(); - logWarn(err_3); - importedCSS = ''; - return [3, 7]; - case 7: - cssText = cssText.split(match).join(importedCSS); - _b.label = 8; - case 8: - importMatches_1_1 = importMatches_1.next(); - return [3, 2]; - case 9: return [3, 12]; - case 10: - e_1_1 = _b.sent(); - e_1 = { error: e_1_1 }; - return [3, 12]; - case 11: - try { - if (importMatches_1_1 && !importMatches_1_1.done && (_a = importMatches_1.return)) _a.call(importMatches_1); - } - finally { if (e_1) throw e_1.error; } - return [7]; - case 12: - cssText = cssText.trim(); - return [2, cssText]; - } - }); - }); - } - function createCORSCopy(srcElement, cssText) { - if (!cssText) { - return null; - } - var cors = document.createElement('style'); - cors.classList.add('darkreader'); - cors.classList.add('darkreader--cors'); - cors.media = 'screen'; - cors.textContent = cssText; - srcElement.parentNode.insertBefore(cors, srcElement.nextSibling); - cors.sheet.disabled = true; - corsStyleSet.add(cors); - return cors; - } - - var observers = []; - var observedRoots; - var undefinedGroups = new Map(); - var elementsDefinitionCallback; - function collectUndefinedElements(root) { - if (!isDefinedSelectorSupported()) { - return; - } - forEach(root.querySelectorAll(':not(:defined)'), function (el) { - var tag = el.tagName.toLowerCase(); - if (!undefinedGroups.has(tag)) { - undefinedGroups.set(tag, new Set()); - customElementsWhenDefined(tag).then(function () { - if (elementsDefinitionCallback) { - var elements = undefinedGroups.get(tag); - undefinedGroups.delete(tag); - elementsDefinitionCallback(Array.from(elements)); - } - }); - } - undefinedGroups.get(tag).add(el); - }); - } - function customElementsWhenDefined(tag) { - return new Promise(function (resolve) { - if (window.customElements && typeof window.customElements.whenDefined === 'function') { - customElements.whenDefined(tag).then(resolve); - } - else { - var checkIfDefined_1 = function () { - var elements = undefinedGroups.get(tag); - if (elements && elements.size > 0) { - if (elements.values().next().value.matches(':defined')) { - resolve(); - } - else { - requestAnimationFrame(checkIfDefined_1); - } - } - }; - requestAnimationFrame(checkIfDefined_1); - } - }); - } - function watchWhenCustomElementsDefined(callback) { - elementsDefinitionCallback = callback; - } - function unsubscribeFromDefineCustomElements() { - elementsDefinitionCallback = null; - undefinedGroups.clear(); - } - function watchForStyleChanges(currentStyles, update, shadowRootDiscovered) { - stopWatchingForStyleChanges(); - var prevStyles = new Set(currentStyles); - var prevStyleSiblings = new WeakMap(); - var nextStyleSiblings = new WeakMap(); - function saveStylePosition(style) { - prevStyleSiblings.set(style, style.previousElementSibling); - nextStyleSiblings.set(style, style.nextElementSibling); - } - function forgetStylePosition(style) { - prevStyleSiblings.delete(style); - nextStyleSiblings.delete(style); - } - function didStylePositionChange(style) { - return (style.previousElementSibling !== prevStyleSiblings.get(style) || - style.nextElementSibling !== nextStyleSiblings.get(style)); - } - currentStyles.forEach(saveStylePosition); - function handleStyleOperations(operations) { - var createdStyles = operations.createdStyles, removedStyles = operations.removedStyles, movedStyles = operations.movedStyles; - createdStyles.forEach(function (s) { return saveStylePosition(s); }); - movedStyles.forEach(function (s) { return saveStylePosition(s); }); - removedStyles.forEach(function (s) { return forgetStylePosition(s); }); - createdStyles.forEach(function (s) { return prevStyles.add(s); }); - removedStyles.forEach(function (s) { return prevStyles.delete(s); }); - if (createdStyles.size + removedStyles.size + movedStyles.size > 0) { - update({ - created: Array.from(createdStyles), - removed: Array.from(removedStyles), - moved: Array.from(movedStyles), - updated: [], - }); - } - } - function handleMinorTreeMutations(_a) { - var additions = _a.additions, moves = _a.moves, deletions = _a.deletions; - var createdStyles = new Set(); - var removedStyles = new Set(); - var movedStyles = new Set(); - additions.forEach(function (node) { return getManageableStyles(node).forEach(function (style) { return createdStyles.add(style); }); }); - deletions.forEach(function (node) { return getManageableStyles(node).forEach(function (style) { return removedStyles.add(style); }); }); - moves.forEach(function (node) { return getManageableStyles(node).forEach(function (style) { return movedStyles.add(style); }); }); - handleStyleOperations({ createdStyles: createdStyles, removedStyles: removedStyles, movedStyles: movedStyles }); - additions.forEach(function (n) { - iterateShadowHosts(n, subscribeForShadowRootChanges); - collectUndefinedElements(n); - }); - } - function handleHugeTreeMutations(root) { - var styles = new Set(getManageableStyles(root)); - var createdStyles = new Set(); - var removedStyles = new Set(); - var movedStyles = new Set(); - styles.forEach(function (s) { - if (!prevStyles.has(s)) { - createdStyles.add(s); - } - }); - prevStyles.forEach(function (s) { - if (!styles.has(s)) { - removedStyles.add(s); - } - }); - styles.forEach(function (s) { - if (!createdStyles.has(s) && !removedStyles.has(s) && didStylePositionChange(s)) { - movedStyles.add(s); - } - }); - handleStyleOperations({ createdStyles: createdStyles, removedStyles: removedStyles, movedStyles: movedStyles }); - iterateShadowHosts(root, subscribeForShadowRootChanges); - collectUndefinedElements(root); - } - function handleAttributeMutations(mutations) { - var updatedStyles = new Set(); - mutations.forEach(function (m) { - if (shouldManageStyle(m.target) && m.target.isConnected) { - updatedStyles.add(m.target); - } - }); - if (updatedStyles.size > 0) { - update({ - updated: Array.from(updatedStyles), - created: [], - removed: [], - moved: [], - }); - } - } - function observe(root) { - var treeObserver = createOptimizedTreeObserver(root, { - onMinorMutations: handleMinorTreeMutations, - onHugeMutations: handleHugeTreeMutations, - }); - var attrObserver = new MutationObserver(handleAttributeMutations); - attrObserver.observe(root, { attributes: true, attributeFilter: ['rel', 'disabled', 'media'], subtree: true }); - observers.push(treeObserver, attrObserver); - observedRoots.add(root); - } - function subscribeForShadowRootChanges(node) { - var shadowRoot = node.shadowRoot; - if (shadowRoot == null || observedRoots.has(shadowRoot)) { - return; - } - observe(shadowRoot); - shadowRootDiscovered(shadowRoot); - } - observe(document); - iterateShadowHosts(document.documentElement, subscribeForShadowRootChanges); - watchWhenCustomElementsDefined(function (hosts) { - var newStyles = []; - hosts.forEach(function (host) { return push(newStyles, getManageableStyles(host.shadowRoot)); }); - update({ created: newStyles, updated: [], removed: [], moved: [] }); - hosts.forEach(function (host) { - var shadowRoot = host.shadowRoot; - if (shadowRoot == null) { - return; - } - subscribeForShadowRootChanges(host); - iterateShadowHosts(shadowRoot, subscribeForShadowRootChanges); - collectUndefinedElements(shadowRoot); - }); - }); - collectUndefinedElements(document); - } - function resetObservers() { - observers.forEach(function (o) { return o.disconnect(); }); - observers.splice(0, observers.length); - observedRoots = new WeakSet(); - } - function stopWatchingForStyleChanges() { - resetObservers(); - unsubscribeFromDefineCustomElements(); - } - - function hexify(number) { - return ((number < 16 ? '0' : '') + number.toString(16)); - } - function generateUID() { - return Array.from(crypto.getRandomValues(new Uint8Array(16))).map(function (x) { return hexify(x); }).join(''); - } - - var adoptedStyleOverrides = new WeakMap(); - var overrideList = new WeakSet(); - function createAdoptedStyleSheetOverride(node) { - var cancelAsyncOperations = false; - function injectSheet(sheet, override) { - var newSheets = __spread(node.adoptedStyleSheets); - var sheetIndex = newSheets.indexOf(sheet); - var existingIndex = newSheets.indexOf(override); - if (sheetIndex === existingIndex - 1) { - return; - } - if (existingIndex >= 0) { - newSheets.splice(existingIndex, 1); - } - newSheets.splice(sheetIndex + 1, 0, override); - node.adoptedStyleSheets = newSheets; - } - function destroy() { - cancelAsyncOperations = true; - var newSheets = __spread(node.adoptedStyleSheets); - node.adoptedStyleSheets.forEach(function (adoptedStyleSheet) { - if (overrideList.has(adoptedStyleSheet)) { - var existingIndex = newSheets.indexOf(adoptedStyleSheet); - if (existingIndex >= 0) { - newSheets.splice(existingIndex, 1); - } - adoptedStyleOverrides.delete(adoptedStyleSheet); - overrideList.delete(adoptedStyleSheet); - } - }); - node.adoptedStyleSheets = newSheets; - } - function render(theme, globalVariables, ignoreImageAnalysis) { - node.adoptedStyleSheets.forEach(function (sheet) { - if (overrideList.has(sheet)) { - return; - } - var rules = sheet.rules; - var override = new CSSStyleSheet(); - function prepareOverridesSheet() { - for (var i = override.cssRules.length - 1; i >= 0; i--) { - override.deleteRule(i); - } - injectSheet(sheet, override); - adoptedStyleOverrides.set(sheet, override); - overrideList.add(override); - return override; - } - var variables = globalVariables; - getCSSVariables(sheet.cssRules).forEach(function (value, key) { return variables.set(key, value); }); - var sheetModifier = createStyleSheetModifier(); - sheetModifier.modifySheet({ - prepareSheet: prepareOverridesSheet, - sourceCSSRules: rules, - theme: theme, - variables: variables, - ignoreImageAnalysis: ignoreImageAnalysis, - force: false, - isAsyncCancelled: function () { return cancelAsyncOperations; }, - }); - }); - } - return { - render: render, - destroy: destroy - }; - } - - var variables = new Map(); - var INSTANCE_ID = generateUID(); - var styleManagers = new Map(); - var adoptedStyleManagers = []; - var filter = null; - var fixes = null; - var isIFrame = null; - function createOrUpdateStyle(className, root) { - if (root === void 0) { root = document.head || document; } - var style = root.querySelector("." + className); - if (!style) { - style = document.createElement('style'); - style.classList.add('darkreader'); - style.classList.add(className); - style.media = 'screen'; - } - return style; - } - var stylePositionWatchers = new Map(); - function setupStylePositionWatcher(node, alias) { - stylePositionWatchers.has(alias) && stylePositionWatchers.get(alias).stop(); - stylePositionWatchers.set(alias, watchForNodePosition(node, 'parent')); - } - function stopStylePositionWatchers() { - forEach(stylePositionWatchers.values(), function (watcher) { return watcher.stop(); }); - stylePositionWatchers.clear(); - } - function createStaticStyleOverrides() { - var fallbackStyle = createOrUpdateStyle('darkreader--fallback', document); - fallbackStyle.textContent = getModifiedFallbackStyle(filter, { strict: true }); - document.head.insertBefore(fallbackStyle, document.head.firstChild); - setupStylePositionWatcher(fallbackStyle, 'fallback'); - var userAgentStyle = createOrUpdateStyle('darkreader--user-agent'); - userAgentStyle.textContent = getModifiedUserAgentStyle(filter, isIFrame, filter.styleSystemControls); - document.head.insertBefore(userAgentStyle, fallbackStyle.nextSibling); - setupStylePositionWatcher(userAgentStyle, 'user-agent'); - var textStyle = createOrUpdateStyle('darkreader--text'); - if (filter.useFont || filter.textStroke > 0) { - textStyle.textContent = createTextStyle(filter); - } - else { - textStyle.textContent = ''; - } - document.head.insertBefore(textStyle, fallbackStyle.nextSibling); - setupStylePositionWatcher(textStyle, 'text'); - var invertStyle = createOrUpdateStyle('darkreader--invert'); - if (fixes && Array.isArray(fixes.invert) && fixes.invert.length > 0) { - invertStyle.textContent = [ - fixes.invert.join(', ') + " {", - " filter: " + getCSSFilterValue(__assign(__assign({}, filter), { contrast: filter.mode === 0 ? filter.contrast : clamp(filter.contrast - 10, 0, 100) })) + " !important;", - '}', - ].join('\n'); - } - else { - invertStyle.textContent = ''; - } - document.head.insertBefore(invertStyle, textStyle.nextSibling); - setupStylePositionWatcher(invertStyle, 'invert'); - var inlineStyle = createOrUpdateStyle('darkreader--inline'); - inlineStyle.textContent = getInlineOverrideStyle(); - document.head.insertBefore(inlineStyle, invertStyle.nextSibling); - setupStylePositionWatcher(inlineStyle, 'inline'); - var overrideStyle = createOrUpdateStyle('darkreader--override'); - overrideStyle.textContent = fixes && fixes.css ? replaceCSSTemplates(fixes.css) : ''; - document.head.appendChild(overrideStyle); - setupStylePositionWatcher(overrideStyle, 'override'); - var variableStyle = createOrUpdateStyle('darkreader--variables'); - var selectionColors = getSelectionColor(filter); - var darkSchemeBackgroundColor = filter.darkSchemeBackgroundColor, darkSchemeTextColor = filter.darkSchemeTextColor, lightSchemeBackgroundColor = filter.lightSchemeBackgroundColor, lightSchemeTextColor = filter.lightSchemeTextColor; - variableStyle.textContent = [ - ":root {", - " --darkreader-neutral-background: " + (filter.mode === 0 ? lightSchemeBackgroundColor : darkSchemeBackgroundColor) + ";", - " --darkreader-neutral-text: " + (filter.mode === 0 ? lightSchemeTextColor : darkSchemeTextColor) + ";", - " --darkreader-selection-background: " + selectionColors.backgroundColorSelection + ";", - " --darkreader-selection-text: " + selectionColors.foregroundColorSelection + ";", - "}" - ].join('\n'); - document.head.insertBefore(variableStyle, inlineStyle.nextSibling); - setupStylePositionWatcher(variableStyle, 'variables'); - } - var shadowRootsWithOverrides = new Set(); - function createShadowStaticStyleOverrides(root) { - var inlineStyle = createOrUpdateStyle('darkreader--inline', root); - inlineStyle.textContent = getInlineOverrideStyle(); - root.insertBefore(inlineStyle, root.firstChild); - var overrideStyle = createOrUpdateStyle('darkreader--override', root); - overrideStyle.textContent = fixes && fixes.css ? replaceCSSTemplates(fixes.css) : ''; - root.insertBefore(overrideStyle, inlineStyle.nextSibling); - shadowRootsWithOverrides.add(root); - } - function replaceCSSTemplates($cssText) { - return $cssText.replace(/\${(.+?)}/g, function (m0, $color) { - try { - var color = parseColorWithCache($color); - return modifyColor(color, filter); - } - catch (err) { - logWarn(err); - return $color; - } - }); - } - function cleanFallbackStyle() { - var fallback = document.querySelector('.darkreader--fallback'); - if (fallback) { - fallback.textContent = ''; - } - } - function getIgnoreImageAnalysisSelectors() { - return fixes && Array.isArray(fixes.ignoreImageAnalysis) ? fixes.ignoreImageAnalysis : []; - } - function createDynamicStyleOverrides() { - cancelRendering(); - updateVariables(getElementCSSVariables(document.documentElement)); - var allStyles = getManageableStyles(document); - var newManagers = allStyles - .filter(function (style) { return !styleManagers.has(style); }) - .map(function (style) { return createManager(style); }); - var newVariables = newManagers - .map(function (manager) { return manager.details(); }) - .filter(function (details) { return details && details.variables.size > 0; }) - .map(function (_a) { - var variables = _a.variables; - return variables; - }); - if (newVariables.length === 0) { - styleManagers.forEach(function (manager) { return manager.render(filter, variables, getIgnoreImageAnalysisSelectors()); }); - if (loadingStyles.size === 0) { - cleanFallbackStyle(); - } - } - else { - newVariables.forEach(function (variables) { return updateVariables(variables); }); - throttledRenderAllStyles(function () { - if (loadingStyles.size === 0) { - cleanFallbackStyle(); - } - }); - } - newManagers.forEach(function (manager) { return manager.watch(); }); - var inlineStyleElements = toArray(document.querySelectorAll(INLINE_STYLE_SELECTOR)); - iterateShadowHosts(document.documentElement, function (host) { - var elements = host.shadowRoot.querySelectorAll(INLINE_STYLE_SELECTOR); - if (elements.length > 0) { - createShadowStaticStyleOverrides(host.shadowRoot); - push(inlineStyleElements, elements); - } - }); - var ignoredInlineSelectors = fixes && Array.isArray(fixes.ignoreInlineStyle) ? fixes.ignoreInlineStyle : []; - inlineStyleElements.forEach(function (el) { return overrideInlineStyle(el, filter, getIgnoreImageAnalysisSelectors(), ignoredInlineSelectors); }); - handleAdoptedStyleSheets(document); - } - var loadingStylesCounter = 0; - var loadingStyles = new Set(); - function createManager(element) { - var loadingStyleId = ++loadingStylesCounter; - function loadingStart() { - if (!isDOMReady() || !didDocumentShowUp) { - loadingStyles.add(loadingStyleId); - var fallbackStyle = document.querySelector('.darkreader--fallback'); - if (!fallbackStyle.textContent) { - fallbackStyle.textContent = getModifiedFallbackStyle(filter, { strict: false }); - } - } - } - function loadingEnd() { - loadingStyles.delete(loadingStyleId); - if (loadingStyles.size === 0 && isDOMReady()) { - cleanFallbackStyle(); - } - } - function update() { - var details = manager.details(); - if (!details) { - return; - } - if (details.variables.size === 0) { - manager.render(filter, variables, getIgnoreImageAnalysisSelectors()); - } - else { - updateVariables(details.variables); - throttledRenderAllStyles(); - } - } - var manager = manageStyle(element, { update: update, loadingStart: loadingStart, loadingEnd: loadingEnd }); - styleManagers.set(element, manager); - return manager; - } - function updateVariables(newVars) { - if (newVars.size === 0) { - return; - } - newVars.forEach(function (value, key) { - variables.set(key, value); - }); - variables.forEach(function (value, key) { - variables.set(key, replaceCSSVariables(value, variables)); - }); - } - function removeManager(element) { - var manager = styleManagers.get(element); - if (manager) { - manager.destroy(); - styleManagers.delete(element); - } - } - var throttledRenderAllStyles = throttle(function (callback) { - styleManagers.forEach(function (manager) { return manager.render(filter, variables, getIgnoreImageAnalysisSelectors()); }); - adoptedStyleManagers.forEach(function (manager) { return manager.render(filter, variables, getIgnoreImageAnalysisSelectors()); }); - callback && callback(); - }); - var cancelRendering = function () { - throttledRenderAllStyles.cancel(); - }; - function onDOMReady() { - if (loadingStyles.size === 0) { - cleanFallbackStyle(); - } - } - var documentVisibilityListener = null; - var didDocumentShowUp = !document.hidden; - function watchForDocumentVisibility(callback) { - var alreadyWatching = Boolean(documentVisibilityListener); - documentVisibilityListener = function () { - if (!document.hidden) { - stopWatchingForDocumentVisibility(); - callback(); - didDocumentShowUp = true; - } - }; - if (!alreadyWatching) { - document.addEventListener('visibilitychange', documentVisibilityListener); - } - } - function stopWatchingForDocumentVisibility() { - document.removeEventListener('visibilitychange', documentVisibilityListener); - documentVisibilityListener = null; - } - function createThemeAndWatchForUpdates() { - createStaticStyleOverrides(); - function runDynamicStyle() { - createDynamicStyleOverrides(); - watchForUpdates(); - } - if (document.hidden) { - watchForDocumentVisibility(runDynamicStyle); - } - else { - runDynamicStyle(); - } - changeMetaThemeColorWhenAvailable(filter); - } - function handleAdoptedStyleSheets(node) { - if (Array.isArray(node.adoptedStyleSheets)) { - if (node.adoptedStyleSheets.length > 0) { - var newManger = createAdoptedStyleSheetOverride(node); - adoptedStyleManagers.push(newManger); - newManger.render(filter, variables, getIgnoreImageAnalysisSelectors()); - } - } - } - function watchForUpdates() { - var managedStyles = Array.from(styleManagers.keys()); - watchForStyleChanges(managedStyles, function (_a) { - var created = _a.created, updated = _a.updated, removed = _a.removed, moved = _a.moved; - var stylesToRemove = removed; - var stylesToManage = created.concat(updated).concat(moved) - .filter(function (style) { return !styleManagers.has(style); }); - var stylesToRestore = moved - .filter(function (style) { return styleManagers.has(style); }); - stylesToRemove.forEach(function (style) { return removeManager(style); }); - var newManagers = stylesToManage - .map(function (style) { return createManager(style); }); - var newVariables = newManagers - .map(function (manager) { return manager.details(); }) - .filter(function (details) { return details && details.variables.size > 0; }) - .map(function (_a) { - var variables = _a.variables; - return variables; - }); - if (newVariables.length === 0) { - newManagers.forEach(function (manager) { return manager.render(filter, variables, getIgnoreImageAnalysisSelectors()); }); - } - else { - newVariables.forEach(function (variables) { return updateVariables(variables); }); - throttledRenderAllStyles(); - } - newManagers.forEach(function (manager) { return manager.watch(); }); - stylesToRestore.forEach(function (style) { return styleManagers.get(style).restore(); }); - }, function (shadowRoot) { - createShadowStaticStyleOverrides(shadowRoot); - handleAdoptedStyleSheets(shadowRoot); - }); - var ignoredInlineSelectors = fixes && Array.isArray(fixes.ignoreInlineStyle) ? fixes.ignoreInlineStyle : []; - watchForInlineStyles(function (element) { - overrideInlineStyle(element, filter, ignoredInlineSelectors, getIgnoreImageAnalysisSelectors()); - if (element === document.documentElement) { - var rootVariables = getElementCSSVariables(document.documentElement); - if (rootVariables.size > 0) { - updateVariables(rootVariables); - throttledRenderAllStyles(); - } - } - }, function (root) { - var inlineStyleElements = root.querySelectorAll(INLINE_STYLE_SELECTOR); - if (inlineStyleElements.length > 0) { - createShadowStaticStyleOverrides(root); - forEach(inlineStyleElements, function (el) { return overrideInlineStyle(el, filter, getIgnoreImageAnalysisSelectors(), ignoredInlineSelectors); }); - } - }); - addDOMReadyListener(onDOMReady); - } - function stopWatchingForUpdates() { - styleManagers.forEach(function (manager) { return manager.pause(); }); - stopStylePositionWatchers(); - stopWatchingForStyleChanges(); - stopWatchingForInlineStyles(); - removeDOMReadyListener(onDOMReady); - } - function createDarkReaderInstanceMarker() { - var metaElement = document.createElement('meta'); - metaElement.name = 'darkreader'; - metaElement.content = INSTANCE_ID; - document.head.appendChild(metaElement); - } - function isAnotherDarkReaderInstanceActive() { - var meta = document.querySelector('meta[name="darkreader"]'); - if (meta) { - if (meta.content !== INSTANCE_ID) { - return true; - } - return false; - } - else { - createDarkReaderInstanceMarker(); - return false; - } - } - function createOrUpdateDynamicTheme(filterConfig, dynamicThemeFixes, iframe) { - filter = filterConfig; - fixes = dynamicThemeFixes; - isIFrame = iframe; - if (document.head) { - if (isAnotherDarkReaderInstanceActive()) { - return; - } - createThemeAndWatchForUpdates(); - } - else { - if (!isFirefox()) { - var fallbackStyle = createOrUpdateStyle('darkreader--fallback'); - document.documentElement.appendChild(fallbackStyle); - fallbackStyle.textContent = getModifiedFallbackStyle(filter, { strict: true }); - } - var headObserver_1 = new MutationObserver(function () { - if (document.head) { - headObserver_1.disconnect(); - if (isAnotherDarkReaderInstanceActive()) { - removeDynamicTheme(); - return; - } - createThemeAndWatchForUpdates(); - } - }); - headObserver_1.observe(document, { childList: true, subtree: true }); - } - } - function removeDynamicTheme() { - cleanDynamicThemeCache(); - removeNode(document.querySelector('.darkreader--fallback')); - if (document.head) { - restoreMetaThemeColor(); - removeNode(document.head.querySelector('.darkreader--user-agent')); - removeNode(document.head.querySelector('.darkreader--text')); - removeNode(document.head.querySelector('.darkreader--invert')); - removeNode(document.head.querySelector('.darkreader--inline')); - removeNode(document.head.querySelector('.darkreader--override')); - removeNode(document.head.querySelector('meta[name="darkreader"]')); - } - shadowRootsWithOverrides.forEach(function (root) { - removeNode(root.querySelector('.darkreader--inline')); - removeNode(root.querySelector('.darkreader--override')); - }); - shadowRootsWithOverrides.clear(); - forEach(styleManagers.keys(), function (el) { return removeManager(el); }); - forEach(document.querySelectorAll('.darkreader'), removeNode); - adoptedStyleManagers.forEach(function (manager) { - manager.destroy(); - }); - adoptedStyleManagers.splice(0); - } - function cleanDynamicThemeCache() { - stopWatchingForDocumentVisibility(); - cancelRendering(); - stopWatchingForUpdates(); - cleanModificationCache(); - } - - var isIFrame$1 = (function () { - try { - return window.self !== window.top; - } - catch (err) { - console.warn(err); - return true; - } - })(); - function enable(themeOptions, fixes) { - if (themeOptions === void 0) { themeOptions = {}; } - if (fixes === void 0) { fixes = null; } - var theme = __assign(__assign({}, DEFAULT_THEME), themeOptions); - if (theme.engine !== ThemeEngines.dynamicTheme) { - throw new Error('Theme engine is not supported.'); - } - createOrUpdateDynamicTheme(theme, fixes, isIFrame$1); - } - function disable() { - removeDynamicTheme(); - } - var darkScheme = matchMedia('(prefers-color-scheme: dark)'); - var store = { - themeOptions: null, - fixes: null, - }; - function handleColorScheme() { - if (darkScheme.matches) { - enable(store.themeOptions, store.fixes); - } - else { - disable(); - } - } - function auto(themeOptions, fixes) { - if (themeOptions === void 0) { themeOptions = {}; } - if (fixes === void 0) { fixes = null; } - if (themeOptions) { - store = { themeOptions: themeOptions, fixes: fixes }; - handleColorScheme(); - darkScheme.addListener(handleColorScheme); - } - else { - darkScheme.removeListener(handleColorScheme); - disable(); - } - } - var setFetchMethod$1 = setFetchMethod; - - exports.auto = auto; - exports.disable = disable; - exports.enable = enable; - exports.setFetchMethod = setFetchMethod$1; - - Object.defineProperty(exports, '__esModule', { value: true }); - -}))); diff --git a/app/static/js/jsonpatch.min.js b/app/static/js/jsonpatch.min.js deleted file mode 100644 index 6af589da..00000000 --- a/app/static/js/jsonpatch.min.js +++ /dev/null @@ -1,36 +0,0 @@ -/* @preserve - * JSONPatch.js - * - * A Dharmafly project written by Thomas Parslow - * and released with the kind permission of - * NetDev. - * - * Copyright 2011-2013 Thomas Parslow. All rights reserved. - * Permission is hereby granted,y free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. - * - * Implements the JSON Patch IETF RFC 6902 as specified at: - * - * http://tools.ietf.org/html/rfc6902 - * - * Also implements the JSON Pointer IETF RFC 6901 as specified at: - * - * http://tools.ietf.org/html/rfc6901 - * - */ -!function(root,factory){"object"==typeof exports?factory(module.exports):"function"==typeof define&&define.amd?define(["exports"],factory):(root.jsonpatch={},root.returnExports=factory(root.jsonpatch))}(this,function(exports){function InvalidPatch(message){Error.call(this,message),this.message=message}function PatchApplyError(message){Error.call(this,message),this.message=message}function clone(o){var cloned,key;if(isArray(o))return o.slice();if(null===o)return o;if("object"==typeof o){cloned={};for(key in o)Object.hasOwnProperty.call(o,key)&&(cloned[key]=o[key]);return cloned}return o}function deepEqual(a,b){var key;if(a===b)return!0;if(typeof a!=typeof b)return!1;if("object"!=typeof a)return!1;var aIsArray=isArray(a),bIsArray=isArray(b);if(aIsArray!==bIsArray)return!1;if(!aIsArray){for(key in a)if(Object.hasOwnProperty(a,key)&&(!Object.hasOwnProperty(b,key)||!deepEqual(a[key],b[key])))return!1;for(key in b)if(Object.hasOwnProperty(b,key)&&!Object.hasOwnProperty(a,key))return!1;return!0}if(a.length!=b.length)return!1;for(var i=0;inode.length)throw new PatchApplyError("Add operation must not attempt to create a sparse array!");node.splice(lastSegment,0,clone(value))}else node[lastSegment]=clone(value);return node},mutate)},JSONPointer.prototype.remove=function(doc,mutate){return 0===this.length?void 0:this._action(doc,function(node,lastSegment){if(!Object.hasOwnProperty.call(node,lastSegment))throw new PatchApplyError("Remove operation must point to an existing value!");return isArray(node)?node.splice(lastSegment,1):delete node[lastSegment],node},mutate)},JSONPointer.prototype.replace=function(doc,value,mutate){return 0===this.length?value:this._action(doc,function(node,lastSegment){if(!Object.hasOwnProperty.call(node,lastSegment))throw new PatchApplyError("Replace operation must point to an existing value!");return isArray(node)?node.splice(lastSegment,1,clone(value)):node[lastSegment]=clone(value),node},mutate)},JSONPointer.prototype.get=function(doc){var value;return 0===this.length?doc:(this._action(doc,function(node,lastSegment){return value=node[lastSegment],node},!0),value)},JSONPointer.prototype.subsetOf=function(otherPointer){if(this.length<=otherPointer.length)return!1;for(var i=0;i0?setTimeout((function(){e(r,n,s)}),1):(t.update(),n(s))}}},"./src/filter.js":function(t){t.exports=function(t){return t.handlers.filterStart=t.handlers.filterStart||[],t.handlers.filterComplete=t.handlers.filterComplete||[],function(e){if(t.trigger("filterStart"),t.i=1,t.reset.filter(),void 0===e)t.filtered=!1;else{t.filtered=!0;for(var r=t.items,n=0,s=r.length;nv.page,a=new g(t[s],void 0,n),v.items.push(a),r.push(a)}return v.update(),r}m(t.slice(0),e)}},this.show=function(t,e){return this.i=t,this.page=e,v.update(),v},this.remove=function(t,e,r){for(var n=0,s=0,i=v.items.length;s-1&&r.splice(n,1),v},this.trigger=function(t){for(var e=v.handlers[t].length;e--;)v.handlers[t][e](v);return v},this.reset={filter:function(){for(var t=v.items,e=t.length;e--;)t[e].filtered=!1;return v},search:function(){for(var t=v.items,e=t.length;e--;)t[e].found=!1;return v}},this.update=function(){var t=v.items,e=t.length;v.visibleItems=[],v.matchingItems=[],v.templater.clear();for(var r=0;r=v.i&&v.visibleItems.lengthe},innerWindow:function(t,e,r){return t>=e-r&&t<=e+r},dotted:function(t,e,r,n,s,i,a){return this.dottedLeft(t,e,r,n,s,i)||this.dottedRight(t,e,r,n,s,i,a)},dottedLeft:function(t,e,r,n,s,i){return e==r+1&&!this.innerWindow(e,s,i)&&!this.right(e,n)},dottedRight:function(t,e,r,n,s,i,a){return!t.items[a-1].values().dotted&&(e==n&&!this.innerWindow(e,s,i)&&!this.right(e,n))}};return function(e){var n=new i(t.listContainer.id,{listClass:e.paginationClass||"pagination",item:e.item||"
  • ",valueNames:["page","dotted"],searchClass:"pagination-search-that-is-not-supposed-to-exist",sortClass:"pagination-sort-that-is-not-supposed-to-exist"});s.bind(n.listContainer,"click",(function(e){var r=e.target||e.srcElement,n=t.utils.getAttribute(r,"data-page"),s=t.utils.getAttribute(r,"data-i");s&&t.show((s-1)*n+1,n)})),t.on("updated",(function(){r(n,e)})),r(n,e)}}},"./src/parse.js":function(t,e,r){t.exports=function(t){var e=r("./src/item.js")(t),n=function(r,n){for(var s=0,i=r.length;s0?setTimeout((function(){e(r,s)}),1):(t.update(),t.trigger("parseComplete"))};return t.handlers.parseComplete=t.handlers.parseComplete||[],function(){var e=function(t){for(var e=t.childNodes,r=[],n=0,s=e.length;n]/g.exec(t)){var e=document.createElement("tbody");return e.innerHTML=t,e.firstElementChild}if(-1!==t.indexOf("<")){var r=document.createElement("div");return r.innerHTML=t,r.firstElementChild}}},a=function(e,r,n){var s=void 0,i=function(e){for(var r=0,n=t.valueNames.length;r=1;)t.list.removeChild(t.list.firstChild)},function(){var r;if("function"!=typeof t.item){if(!(r="string"==typeof t.item?-1===t.item.indexOf("<")?document.getElementById(t.item):i(t.item):s()))throw new Error("The list needs to have at least one item on init otherwise you'll have to add a template.");r=n(r,t.valueNames),e=function(){return r.cloneNode(!0)}}else e=function(e){var r=t.item(e);return i(r)}}()};t.exports=function(t){return new e(t)}},"./src/utils/classes.js":function(t,e,r){var n=r("./src/utils/index-of.js"),s=/\s+/;Object.prototype.toString;function i(t){if(!t||!t.nodeType)throw new Error("A DOM element reference is required");this.el=t,this.list=t.classList}t.exports=function(t){return new i(t)},i.prototype.add=function(t){if(this.list)return this.list.add(t),this;var e=this.array();return~n(e,t)||e.push(t),this.el.className=e.join(" "),this},i.prototype.remove=function(t){if(this.list)return this.list.remove(t),this;var e=this.array(),r=n(e,t);return~r&&e.splice(r,1),this.el.className=e.join(" "),this},i.prototype.toggle=function(t,e){return this.list?(void 0!==e?e!==this.list.toggle(t,e)&&this.list.toggle(t):this.list.toggle(t),this):(void 0!==e?e?this.add(t):this.remove(t):this.has(t)?this.remove(t):this.add(t),this)},i.prototype.array=function(){var t=(this.el.getAttribute("class")||"").replace(/^\s+|\s+$/g,"").split(s);return""===t[0]&&t.shift(),t},i.prototype.has=i.prototype.contains=function(t){return this.list?this.list.contains(t):!!~n(this.array(),t)}},"./src/utils/events.js":function(t,e,r){var n=window.addEventListener?"addEventListener":"attachEvent",s=window.removeEventListener?"removeEventListener":"detachEvent",i="addEventListener"!==n?"on":"",a=r("./src/utils/to-array.js");e.bind=function(t,e,r,s){for(var o=0,l=(t=a(t)).length;o32)return!1;var a=n,o=function(){var t,r={};for(t=0;t=p;b--){var j=o[t.charAt(b-1)];if(C[b]=0===m?(C[b+1]<<1|1)&j:(C[b+1]<<1|1)&j|(v[b+1]|v[b])<<1|1|v[b+1],C[b]&d){var x=l(m,b-1);if(x<=u){if(u=x,!((c=b-1)>a))break;p=Math.max(1,2*a-c)}}}if(l(m+1,a)>u)break;v=C}return!(c<0)}},"./src/utils/get-attribute.js":function(t){t.exports=function(t,e){var r=t.getAttribute&&t.getAttribute(e)||null;if(!r)for(var n=t.attributes,s=n.length,i=0;i=48&&t<=57}function i(t,e){for(var i=(t+="").length,a=(e+="").length,o=0,l=0;o=i&&l=a?-1:l>=a&&o=i?1:i-a}i.caseInsensitive=i.i=function(t,e){return i((""+t).toLowerCase(),(""+e).toLowerCase())},Object.defineProperties(i,{alphabet:{get:function(){return e},set:function(t){r=[];var s=0;if(e=t)for(;s/,p=/^\w+$/;function v(t,e){e=e||o;var i=u.test(t)?e.getElementsByClassName(t.slice(1)):p.test(t)?e.getElementsByTagName(t):e.querySelectorAll(t);return i}function f(t){if(!i){var e=(i=o.implementation.createHTMLDocument(null)).createElement("base");e.href=o.location.href,i.head.appendChild(e)}return i.body.innerHTML=t,i.body.childNodes}function m(t){"loading"!==o.readyState?t():o.addEventListener("DOMContentLoaded",t)}function g(t,e){if(!t)return this;if(t.cash&&t!==a)return t;var i,n=t,s=0;if(d(t))n=l.test(t)?o.getElementById(t.slice(1)):c.test(t)?f(t):v(t,e);else if(h(t))return m(t),this;if(!n)return this;if(n.nodeType||n===a)this[0]=n,this.length=1;else for(i=this.length=n.length;ss.right-i||l+e.width>window.innerWidth-i)&&(n.right=!0),(ho-i||h+e.height>window.innerHeight-i)&&(n.bottom=!0),n},M.checkPossibleAlignments=function(t,e,i,n){var s={top:!0,right:!0,bottom:!0,left:!0,spaceOnTop:null,spaceOnRight:null,spaceOnBottom:null,spaceOnLeft:null},o="visible"===getComputedStyle(e).overflow,a=e.getBoundingClientRect(),r=Math.min(a.height,window.innerHeight),l=Math.min(a.width,window.innerWidth),h=t.getBoundingClientRect(),d=e.scrollLeft,u=e.scrollTop,c=i.left-d,p=i.top-u,v=i.top+h.height-u;return s.spaceOnRight=o?window.innerWidth-(h.left+i.width):l-(c+i.width),s.spaceOnRight<0&&(s.left=!1),s.spaceOnLeft=o?h.right-i.width:c-i.width+h.width,s.spaceOnLeft<0&&(s.right=!1),s.spaceOnBottom=o?window.innerHeight-(h.top+i.height+n):r-(p+i.height+n),s.spaceOnBottom<0&&(s.top=!1),s.spaceOnTop=o?h.bottom-(i.height+n):v-(i.height-n),s.spaceOnTop<0&&(s.bottom=!1),s},M.getOverflowParent=function(t){return null==t?null:t===document.body||"visible"!==getComputedStyle(t).overflow?t:M.getOverflowParent(t.parentElement)},M.getIdFromTrigger=function(t){var e=t.getAttribute("data-target");return e||(e=(e=t.getAttribute("href"))?e.slice(1):""),e},M.getDocumentScrollTop=function(){return window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0},M.getDocumentScrollLeft=function(){return window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0};var getTime=Date.now||function(){return(new Date).getTime()};M.throttle=function(i,n,s){var o=void 0,a=void 0,r=void 0,l=null,h=0;s||(s={});var d=function(){h=!1===s.leading?0:getTime(),l=null,r=i.apply(o,a),o=a=null};return function(){var t=getTime();h||!1!==s.leading||(h=t);var e=n-(t-h);return o=this,a=arguments,e<=0?(clearTimeout(l),l=null,h=t,r=i.apply(o,a),o=a=null):l||!1===s.trailing||(l=setTimeout(d,e)),r}};var $jscomp={scope:{}};$jscomp.defineProperty="function"==typeof Object.defineProperties?Object.defineProperty:function(t,e,i){if(i.get||i.set)throw new TypeError("ES3 does not support getters and setters.");t!=Array.prototype&&t!=Object.prototype&&(t[e]=i.value)},$jscomp.getGlobal=function(t){return"undefined"!=typeof window&&window===t?t:"undefined"!=typeof global&&null!=global?global:t},$jscomp.global=$jscomp.getGlobal(this),$jscomp.SYMBOL_PREFIX="jscomp_symbol_",$jscomp.initSymbol=function(){$jscomp.initSymbol=function(){},$jscomp.global.Symbol||($jscomp.global.Symbol=$jscomp.Symbol)},$jscomp.symbolCounter_=0,$jscomp.Symbol=function(t){return $jscomp.SYMBOL_PREFIX+(t||"")+$jscomp.symbolCounter_++},$jscomp.initSymbolIterator=function(){$jscomp.initSymbol();var t=$jscomp.global.Symbol.iterator;t||(t=$jscomp.global.Symbol.iterator=$jscomp.global.Symbol("iterator")),"function"!=typeof Array.prototype[t]&&$jscomp.defineProperty(Array.prototype,t,{configurable:!0,writable:!0,value:function(){return $jscomp.arrayIterator(this)}}),$jscomp.initSymbolIterator=function(){}},$jscomp.arrayIterator=function(t){var e=0;return $jscomp.iteratorPrototype(function(){return e=k.currentTime)for(var h=0;ht&&(s.duration=e.duration),s.children.push(e)}),s.seek(0),s.reset(),s.autoplay&&s.restart(),s},s},O.random=function(t,e){return Math.floor(Math.random()*(e-t+1))+t},O}(),function(r,l){"use strict";var e={accordion:!0,onOpenStart:void 0,onOpenEnd:void 0,onCloseStart:void 0,onCloseEnd:void 0,inDuration:300,outDuration:300},t=function(t){function s(t,e){_classCallCheck(this,s);var i=_possibleConstructorReturn(this,(s.__proto__||Object.getPrototypeOf(s)).call(this,s,t,e));(i.el.M_Collapsible=i).options=r.extend({},s.defaults,e),i.$headers=i.$el.children("li").children(".collapsible-header"),i.$headers.attr("tabindex",0),i._setupEventHandlers();var n=i.$el.children("li.active").children(".collapsible-body");return i.options.accordion?n.first().css("display","block"):n.css("display","block"),i}return _inherits(s,Component),_createClass(s,[{key:"destroy",value:function(){this._removeEventHandlers(),this.el.M_Collapsible=void 0}},{key:"_setupEventHandlers",value:function(){var e=this;this._handleCollapsibleClickBound=this._handleCollapsibleClick.bind(this),this._handleCollapsibleKeydownBound=this._handleCollapsibleKeydown.bind(this),this.el.addEventListener("click",this._handleCollapsibleClickBound),this.$headers.each(function(t){t.addEventListener("keydown",e._handleCollapsibleKeydownBound)})}},{key:"_removeEventHandlers",value:function(){var e=this;this.el.removeEventListener("click",this._handleCollapsibleClickBound),this.$headers.each(function(t){t.removeEventListener("keydown",e._handleCollapsibleKeydownBound)})}},{key:"_handleCollapsibleClick",value:function(t){var e=r(t.target).closest(".collapsible-header");if(t.target&&e.length){var i=e.closest(".collapsible");if(i[0]===this.el){var n=e.closest("li"),s=i.children("li"),o=n[0].classList.contains("active"),a=s.index(n);o?this.close(a):this.open(a)}}}},{key:"_handleCollapsibleKeydown",value:function(t){13===t.keyCode&&this._handleCollapsibleClickBound(t)}},{key:"_animateIn",value:function(t){var e=this,i=this.$el.children("li").eq(t);if(i.length){var n=i.children(".collapsible-body");l.remove(n[0]),n.css({display:"block",overflow:"hidden",height:0,paddingTop:"",paddingBottom:""});var s=n.css("padding-top"),o=n.css("padding-bottom"),a=n[0].scrollHeight;n.css({paddingTop:0,paddingBottom:0}),l({targets:n[0],height:a,paddingTop:s,paddingBottom:o,duration:this.options.inDuration,easing:"easeInOutCubic",complete:function(t){n.css({overflow:"",paddingTop:"",paddingBottom:"",height:""}),"function"==typeof e.options.onOpenEnd&&e.options.onOpenEnd.call(e,i[0])}})}}},{key:"_animateOut",value:function(t){var e=this,i=this.$el.children("li").eq(t);if(i.length){var n=i.children(".collapsible-body");l.remove(n[0]),n.css("overflow","hidden"),l({targets:n[0],height:0,paddingTop:0,paddingBottom:0,duration:this.options.outDuration,easing:"easeInOutCubic",complete:function(){n.css({height:"",overflow:"",padding:"",display:""}),"function"==typeof e.options.onCloseEnd&&e.options.onCloseEnd.call(e,i[0])}})}}},{key:"open",value:function(t){var i=this,e=this.$el.children("li").eq(t);if(e.length&&!e[0].classList.contains("active")){if("function"==typeof this.options.onOpenStart&&this.options.onOpenStart.call(this,e[0]),this.options.accordion){var n=this.$el.children("li");this.$el.children("li.active").each(function(t){var e=n.index(r(t));i.close(e)})}e[0].classList.add("active"),this._animateIn(t)}}},{key:"close",value:function(t){var e=this.$el.children("li").eq(t);e.length&&e[0].classList.contains("active")&&("function"==typeof this.options.onCloseStart&&this.options.onCloseStart.call(this,e[0]),e[0].classList.remove("active"),this._animateOut(t))}}],[{key:"init",value:function(t,e){return _get(s.__proto__||Object.getPrototypeOf(s),"init",this).call(this,this,t,e)}},{key:"getInstance",value:function(t){return(t.jquery?t[0]:t).M_Collapsible}},{key:"defaults",get:function(){return e}}]),s}();M.Collapsible=t,M.jQueryLoaded&&M.initializeJqueryWrapper(t,"collapsible","M_Collapsible")}(cash,M.anime),function(h,i){"use strict";var e={alignment:"left",autoFocus:!0,constrainWidth:!0,container:null,coverTrigger:!0,closeOnClick:!0,hover:!1,inDuration:150,outDuration:250,onOpenStart:null,onOpenEnd:null,onCloseStart:null,onCloseEnd:null,onItemClick:null},t=function(t){function n(t,e){_classCallCheck(this,n);var i=_possibleConstructorReturn(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,n,t,e));return i.el.M_Dropdown=i,n._dropdowns.push(i),i.id=M.getIdFromTrigger(t),i.dropdownEl=document.getElementById(i.id),i.$dropdownEl=h(i.dropdownEl),i.options=h.extend({},n.defaults,e),i.isOpen=!1,i.isScrollable=!1,i.isTouchMoving=!1,i.focusedIndex=-1,i.filterQuery=[],i.options.container?h(i.options.container).append(i.dropdownEl):i.$el.after(i.dropdownEl),i._makeDropdownFocusable(),i._resetFilterQueryBound=i._resetFilterQuery.bind(i),i._handleDocumentClickBound=i._handleDocumentClick.bind(i),i._handleDocumentTouchmoveBound=i._handleDocumentTouchmove.bind(i),i._handleDropdownClickBound=i._handleDropdownClick.bind(i),i._handleDropdownKeydownBound=i._handleDropdownKeydown.bind(i),i._handleTriggerKeydownBound=i._handleTriggerKeydown.bind(i),i._setupEventHandlers(),i}return _inherits(n,Component),_createClass(n,[{key:"destroy",value:function(){this._resetDropdownStyles(),this._removeEventHandlers(),n._dropdowns.splice(n._dropdowns.indexOf(this),1),this.el.M_Dropdown=void 0}},{key:"_setupEventHandlers",value:function(){this.el.addEventListener("keydown",this._handleTriggerKeydownBound),this.dropdownEl.addEventListener("click",this._handleDropdownClickBound),this.options.hover?(this._handleMouseEnterBound=this._handleMouseEnter.bind(this),this.el.addEventListener("mouseenter",this._handleMouseEnterBound),this._handleMouseLeaveBound=this._handleMouseLeave.bind(this),this.el.addEventListener("mouseleave",this._handleMouseLeaveBound),this.dropdownEl.addEventListener("mouseleave",this._handleMouseLeaveBound)):(this._handleClickBound=this._handleClick.bind(this),this.el.addEventListener("click",this._handleClickBound))}},{key:"_removeEventHandlers",value:function(){this.el.removeEventListener("keydown",this._handleTriggerKeydownBound),this.dropdownEl.removeEventListener("click",this._handleDropdownClickBound),this.options.hover?(this.el.removeEventListener("mouseenter",this._handleMouseEnterBound),this.el.removeEventListener("mouseleave",this._handleMouseLeaveBound),this.dropdownEl.removeEventListener("mouseleave",this._handleMouseLeaveBound)):this.el.removeEventListener("click",this._handleClickBound)}},{key:"_setupTemporaryEventHandlers",value:function(){document.body.addEventListener("click",this._handleDocumentClickBound,!0),document.body.addEventListener("touchend",this._handleDocumentClickBound),document.body.addEventListener("touchmove",this._handleDocumentTouchmoveBound),this.dropdownEl.addEventListener("keydown",this._handleDropdownKeydownBound)}},{key:"_removeTemporaryEventHandlers",value:function(){document.body.removeEventListener("click",this._handleDocumentClickBound,!0),document.body.removeEventListener("touchend",this._handleDocumentClickBound),document.body.removeEventListener("touchmove",this._handleDocumentTouchmoveBound),this.dropdownEl.removeEventListener("keydown",this._handleDropdownKeydownBound)}},{key:"_handleClick",value:function(t){t.preventDefault(),this.open()}},{key:"_handleMouseEnter",value:function(){this.open()}},{key:"_handleMouseLeave",value:function(t){var e=t.toElement||t.relatedTarget,i=!!h(e).closest(".dropdown-content").length,n=!1,s=h(e).closest(".dropdown-trigger");s.length&&s[0].M_Dropdown&&s[0].M_Dropdown.isOpen&&(n=!0),n||i||this.close()}},{key:"_handleDocumentClick",value:function(t){var e=this,i=h(t.target);this.options.closeOnClick&&i.closest(".dropdown-content").length&&!this.isTouchMoving?setTimeout(function(){e.close()},0):!i.closest(".dropdown-trigger").length&&i.closest(".dropdown-content").length||setTimeout(function(){e.close()},0),this.isTouchMoving=!1}},{key:"_handleTriggerKeydown",value:function(t){t.which!==M.keys.ARROW_DOWN&&t.which!==M.keys.ENTER||this.isOpen||(t.preventDefault(),this.open())}},{key:"_handleDocumentTouchmove",value:function(t){h(t.target).closest(".dropdown-content").length&&(this.isTouchMoving=!0)}},{key:"_handleDropdownClick",value:function(t){if("function"==typeof this.options.onItemClick){var e=h(t.target).closest("li")[0];this.options.onItemClick.call(this,e)}}},{key:"_handleDropdownKeydown",value:function(t){if(t.which===M.keys.TAB)t.preventDefault(),this.close();else if(t.which!==M.keys.ARROW_DOWN&&t.which!==M.keys.ARROW_UP||!this.isOpen)if(t.which===M.keys.ENTER&&this.isOpen){var e=this.dropdownEl.children[this.focusedIndex],i=h(e).find("a, button").first();i.length?i[0].click():e&&e.click()}else t.which===M.keys.ESC&&this.isOpen&&(t.preventDefault(),this.close());else{t.preventDefault();var n=t.which===M.keys.ARROW_DOWN?1:-1,s=this.focusedIndex,o=!1;do{if(s+=n,this.dropdownEl.children[s]&&-1!==this.dropdownEl.children[s].tabIndex){o=!0;break}}while(sl.spaceOnBottom?(h="bottom",i+=l.spaceOnTop,o-=l.spaceOnTop):i+=l.spaceOnBottom)),!l[d]){var u="left"===d?"right":"left";l[u]?d=u:l.spaceOnLeft>l.spaceOnRight?(d="right",n+=l.spaceOnLeft,s-=l.spaceOnLeft):(d="left",n+=l.spaceOnRight)}return"bottom"===h&&(o=o-e.height+(this.options.coverTrigger?t.height:0)),"right"===d&&(s=s-e.width+t.width),{x:s,y:o,verticalAlignment:h,horizontalAlignment:d,height:i,width:n}}},{key:"_animateIn",value:function(){var e=this;i.remove(this.dropdownEl),i({targets:this.dropdownEl,opacity:{value:[0,1],easing:"easeOutQuad"},scaleX:[.3,1],scaleY:[.3,1],duration:this.options.inDuration,easing:"easeOutQuint",complete:function(t){e.options.autoFocus&&e.dropdownEl.focus(),"function"==typeof e.options.onOpenEnd&&e.options.onOpenEnd.call(e,e.el)}})}},{key:"_animateOut",value:function(){var e=this;i.remove(this.dropdownEl),i({targets:this.dropdownEl,opacity:{value:0,easing:"easeOutQuint"},scaleX:.3,scaleY:.3,duration:this.options.outDuration,easing:"easeOutQuint",complete:function(t){e._resetDropdownStyles(),"function"==typeof e.options.onCloseEnd&&e.options.onCloseEnd.call(e,e.el)}})}},{key:"_placeDropdown",value:function(){var t=this.options.constrainWidth?this.el.getBoundingClientRect().width:this.dropdownEl.getBoundingClientRect().width;this.dropdownEl.style.width=t+"px";var e=this._getDropdownPosition();this.dropdownEl.style.left=e.x+"px",this.dropdownEl.style.top=e.y+"px",this.dropdownEl.style.height=e.height+"px",this.dropdownEl.style.width=e.width+"px",this.dropdownEl.style.transformOrigin=("left"===e.horizontalAlignment?"0":"100%")+" "+("top"===e.verticalAlignment?"0":"100%")}},{key:"open",value:function(){this.isOpen||(this.isOpen=!0,"function"==typeof this.options.onOpenStart&&this.options.onOpenStart.call(this,this.el),this._resetDropdownStyles(),this.dropdownEl.style.display="block",this._placeDropdown(),this._animateIn(),this._setupTemporaryEventHandlers())}},{key:"close",value:function(){this.isOpen&&(this.isOpen=!1,this.focusedIndex=-1,"function"==typeof this.options.onCloseStart&&this.options.onCloseStart.call(this,this.el),this._animateOut(),this._removeTemporaryEventHandlers(),this.options.autoFocus&&this.el.focus())}},{key:"recalculateDimensions",value:function(){this.isOpen&&(this.$dropdownEl.css({width:"",height:"",left:"",top:"","transform-origin":""}),this._placeDropdown())}}],[{key:"init",value:function(t,e){return _get(n.__proto__||Object.getPrototypeOf(n),"init",this).call(this,this,t,e)}},{key:"getInstance",value:function(t){return(t.jquery?t[0]:t).M_Dropdown}},{key:"defaults",get:function(){return e}}]),n}();t._dropdowns=[],M.Dropdown=t,M.jQueryLoaded&&M.initializeJqueryWrapper(t,"dropdown","M_Dropdown")}(cash,M.anime),function(s,i){"use strict";var e={opacity:.5,inDuration:250,outDuration:250,onOpenStart:null,onOpenEnd:null,onCloseStart:null,onCloseEnd:null,preventScrolling:!0,dismissible:!0,startingTop:"4%",endingTop:"10%"},t=function(t){function n(t,e){_classCallCheck(this,n);var i=_possibleConstructorReturn(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,n,t,e));return(i.el.M_Modal=i).options=s.extend({},n.defaults,e),i.isOpen=!1,i.id=i.$el.attr("id"),i._openingTrigger=void 0,i.$overlay=s(''),i.el.tabIndex=0,i._nthModalOpened=0,n._count++,i._setupEventHandlers(),i}return _inherits(n,Component),_createClass(n,[{key:"destroy",value:function(){n._count--,this._removeEventHandlers(),this.el.removeAttribute("style"),this.$overlay.remove(),this.el.M_Modal=void 0}},{key:"_setupEventHandlers",value:function(){this._handleOverlayClickBound=this._handleOverlayClick.bind(this),this._handleModalCloseClickBound=this._handleModalCloseClick.bind(this),1===n._count&&document.body.addEventListener("click",this._handleTriggerClick),this.$overlay[0].addEventListener("click",this._handleOverlayClickBound),this.el.addEventListener("click",this._handleModalCloseClickBound)}},{key:"_removeEventHandlers",value:function(){0===n._count&&document.body.removeEventListener("click",this._handleTriggerClick),this.$overlay[0].removeEventListener("click",this._handleOverlayClickBound),this.el.removeEventListener("click",this._handleModalCloseClickBound)}},{key:"_handleTriggerClick",value:function(t){var e=s(t.target).closest(".modal-trigger");if(e.length){var i=M.getIdFromTrigger(e[0]),n=document.getElementById(i).M_Modal;n&&n.open(e),t.preventDefault()}}},{key:"_handleOverlayClick",value:function(){this.options.dismissible&&this.close()}},{key:"_handleModalCloseClick",value:function(t){s(t.target).closest(".modal-close").length&&this.close()}},{key:"_handleKeydown",value:function(t){27===t.keyCode&&this.options.dismissible&&this.close()}},{key:"_handleFocus",value:function(t){this.el.contains(t.target)||this._nthModalOpened!==n._modalsOpen||this.el.focus()}},{key:"_animateIn",value:function(){var t=this;s.extend(this.el.style,{display:"block",opacity:0}),s.extend(this.$overlay[0].style,{display:"block",opacity:0}),i({targets:this.$overlay[0],opacity:this.options.opacity,duration:this.options.inDuration,easing:"easeOutQuad"});var e={targets:this.el,duration:this.options.inDuration,easing:"easeOutCubic",complete:function(){"function"==typeof t.options.onOpenEnd&&t.options.onOpenEnd.call(t,t.el,t._openingTrigger)}};this.el.classList.contains("bottom-sheet")?s.extend(e,{bottom:0,opacity:1}):s.extend(e,{top:[this.options.startingTop,this.options.endingTop],opacity:1,scaleX:[.8,1],scaleY:[.8,1]}),i(e)}},{key:"_animateOut",value:function(){var t=this;i({targets:this.$overlay[0],opacity:0,duration:this.options.outDuration,easing:"easeOutQuart"});var e={targets:this.el,duration:this.options.outDuration,easing:"easeOutCubic",complete:function(){t.el.style.display="none",t.$overlay.remove(),"function"==typeof t.options.onCloseEnd&&t.options.onCloseEnd.call(t,t.el)}};this.el.classList.contains("bottom-sheet")?s.extend(e,{bottom:"-100%",opacity:0}):s.extend(e,{top:[this.options.endingTop,this.options.startingTop],opacity:0,scaleX:.8,scaleY:.8}),i(e)}},{key:"open",value:function(t){if(!this.isOpen)return this.isOpen=!0,n._modalsOpen++,this._nthModalOpened=n._modalsOpen,this.$overlay[0].style.zIndex=1e3+2*n._modalsOpen,this.el.style.zIndex=1e3+2*n._modalsOpen+1,this._openingTrigger=t?t[0]:void 0,"function"==typeof this.options.onOpenStart&&this.options.onOpenStart.call(this,this.el,this._openingTrigger),this.options.preventScrolling&&(document.body.style.overflow="hidden"),this.el.classList.add("open"),this.el.insertAdjacentElement("afterend",this.$overlay[0]),this.options.dismissible&&(this._handleKeydownBound=this._handleKeydown.bind(this),this._handleFocusBound=this._handleFocus.bind(this),document.addEventListener("keydown",this._handleKeydownBound),document.addEventListener("focus",this._handleFocusBound,!0)),i.remove(this.el),i.remove(this.$overlay[0]),this._animateIn(),this.el.focus(),this}},{key:"close",value:function(){if(this.isOpen)return this.isOpen=!1,n._modalsOpen--,this._nthModalOpened=0,"function"==typeof this.options.onCloseStart&&this.options.onCloseStart.call(this,this.el),this.el.classList.remove("open"),0===n._modalsOpen&&(document.body.style.overflow=""),this.options.dismissible&&(document.removeEventListener("keydown",this._handleKeydownBound),document.removeEventListener("focus",this._handleFocusBound,!0)),i.remove(this.el),i.remove(this.$overlay[0]),this._animateOut(),this}}],[{key:"init",value:function(t,e){return _get(n.__proto__||Object.getPrototypeOf(n),"init",this).call(this,this,t,e)}},{key:"getInstance",value:function(t){return(t.jquery?t[0]:t).M_Modal}},{key:"defaults",get:function(){return e}}]),n}();t._modalsOpen=0,t._count=0,M.Modal=t,M.jQueryLoaded&&M.initializeJqueryWrapper(t,"modal","M_Modal")}(cash,M.anime),function(o,a){"use strict";var e={inDuration:275,outDuration:200,onOpenStart:null,onOpenEnd:null,onCloseStart:null,onCloseEnd:null},t=function(t){function n(t,e){_classCallCheck(this,n);var i=_possibleConstructorReturn(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,n,t,e));return(i.el.M_Materialbox=i).options=o.extend({},n.defaults,e),i.overlayActive=!1,i.doneAnimating=!0,i.placeholder=o("
    ").addClass("material-placeholder"),i.originalWidth=0,i.originalHeight=0,i.originInlineStyles=i.$el.attr("style"),i.caption=i.el.getAttribute("data-caption")||"",i.$el.before(i.placeholder),i.placeholder.append(i.$el),i._setupEventHandlers(),i}return _inherits(n,Component),_createClass(n,[{key:"destroy",value:function(){this._removeEventHandlers(),this.el.M_Materialbox=void 0,o(this.placeholder).after(this.el).remove(),this.$el.removeAttr("style")}},{key:"_setupEventHandlers",value:function(){this._handleMaterialboxClickBound=this._handleMaterialboxClick.bind(this),this.el.addEventListener("click",this._handleMaterialboxClickBound)}},{key:"_removeEventHandlers",value:function(){this.el.removeEventListener("click",this._handleMaterialboxClickBound)}},{key:"_handleMaterialboxClick",value:function(t){!1===this.doneAnimating||this.overlayActive&&this.doneAnimating?this.close():this.open()}},{key:"_handleWindowScroll",value:function(){this.overlayActive&&this.close()}},{key:"_handleWindowResize",value:function(){this.overlayActive&&this.close()}},{key:"_handleWindowEscape",value:function(t){27===t.keyCode&&this.doneAnimating&&this.overlayActive&&this.close()}},{key:"_makeAncestorsOverflowVisible",value:function(){this.ancestorsChanged=o();for(var t=this.placeholder[0].parentNode;null!==t&&!o(t).is(document);){var e=o(t);"visible"!==e.css("overflow")&&(e.css("overflow","visible"),void 0===this.ancestorsChanged?this.ancestorsChanged=e:this.ancestorsChanged=this.ancestorsChanged.add(e)),t=t.parentNode}}},{key:"_animateImageIn",value:function(){var t=this,e={targets:this.el,height:[this.originalHeight,this.newHeight],width:[this.originalWidth,this.newWidth],left:M.getDocumentScrollLeft()+this.windowWidth/2-this.placeholder.offset().left-this.newWidth/2,top:M.getDocumentScrollTop()+this.windowHeight/2-this.placeholder.offset().top-this.newHeight/2,duration:this.options.inDuration,easing:"easeOutQuad",complete:function(){t.doneAnimating=!0,"function"==typeof t.options.onOpenEnd&&t.options.onOpenEnd.call(t,t.el)}};this.maxWidth=this.$el.css("max-width"),this.maxHeight=this.$el.css("max-height"),"none"!==this.maxWidth&&(e.maxWidth=this.newWidth),"none"!==this.maxHeight&&(e.maxHeight=this.newHeight),a(e)}},{key:"_animateImageOut",value:function(){var t=this,e={targets:this.el,width:this.originalWidth,height:this.originalHeight,left:0,top:0,duration:this.options.outDuration,easing:"easeOutQuad",complete:function(){t.placeholder.css({height:"",width:"",position:"",top:"",left:""}),t.attrWidth&&t.$el.attr("width",t.attrWidth),t.attrHeight&&t.$el.attr("height",t.attrHeight),t.$el.removeAttr("style"),t.originInlineStyles&&t.$el.attr("style",t.originInlineStyles),t.$el.removeClass("active"),t.doneAnimating=!0,t.ancestorsChanged.length&&t.ancestorsChanged.css("overflow",""),"function"==typeof t.options.onCloseEnd&&t.options.onCloseEnd.call(t,t.el)}};a(e)}},{key:"_updateVars",value:function(){this.windowWidth=window.innerWidth,this.windowHeight=window.innerHeight,this.caption=this.el.getAttribute("data-caption")||""}},{key:"open",value:function(){var t=this;this._updateVars(),this.originalWidth=this.el.getBoundingClientRect().width,this.originalHeight=this.el.getBoundingClientRect().height,this.doneAnimating=!1,this.$el.addClass("active"),this.overlayActive=!0,"function"==typeof this.options.onOpenStart&&this.options.onOpenStart.call(this,this.el),this.placeholder.css({width:this.placeholder[0].getBoundingClientRect().width+"px",height:this.placeholder[0].getBoundingClientRect().height+"px",position:"relative",top:0,left:0}),this._makeAncestorsOverflowVisible(),this.$el.css({position:"absolute","z-index":1e3,"will-change":"left, top, width, height"}),this.attrWidth=this.$el.attr("width"),this.attrHeight=this.$el.attr("height"),this.attrWidth&&(this.$el.css("width",this.attrWidth+"px"),this.$el.removeAttr("width")),this.attrHeight&&(this.$el.css("width",this.attrHeight+"px"),this.$el.removeAttr("height")),this.$overlay=o('
    ').css({opacity:0}).one("click",function(){t.doneAnimating&&t.close()}),this.$el.before(this.$overlay);var e=this.$overlay[0].getBoundingClientRect();this.$overlay.css({width:this.windowWidth+"px",height:this.windowHeight+"px",left:-1*e.left+"px",top:-1*e.top+"px"}),a.remove(this.el),a.remove(this.$overlay[0]),a({targets:this.$overlay[0],opacity:1,duration:this.options.inDuration,easing:"easeOutQuad"}),""!==this.caption&&(this.$photocaption&&a.remove(this.$photoCaption[0]),this.$photoCaption=o('
    '),this.$photoCaption.text(this.caption),o("body").append(this.$photoCaption),this.$photoCaption.css({display:"inline"}),a({targets:this.$photoCaption[0],opacity:1,duration:this.options.inDuration,easing:"easeOutQuad"}));var i=0,n=this.originalWidth/this.windowWidth,s=this.originalHeight/this.windowHeight;this.newWidth=0,this.newHeight=0,si.options.responsiveThreshold,i.$img=i.$el.find("img").first(),i.$img.each(function(){this.complete&&s(this).trigger("load")}),i._updateParallax(),i._setupEventHandlers(),i._setupStyles(),n._parallaxes.push(i),i}return _inherits(n,Component),_createClass(n,[{key:"destroy",value:function(){n._parallaxes.splice(n._parallaxes.indexOf(this),1),this.$img[0].style.transform="",this._removeEventHandlers(),this.$el[0].M_Parallax=void 0}},{key:"_setupEventHandlers",value:function(){this._handleImageLoadBound=this._handleImageLoad.bind(this),this.$img[0].addEventListener("load",this._handleImageLoadBound),0===n._parallaxes.length&&(n._handleScrollThrottled=M.throttle(n._handleScroll,5),window.addEventListener("scroll",n._handleScrollThrottled),n._handleWindowResizeThrottled=M.throttle(n._handleWindowResize,5),window.addEventListener("resize",n._handleWindowResizeThrottled))}},{key:"_removeEventHandlers",value:function(){this.$img[0].removeEventListener("load",this._handleImageLoadBound),0===n._parallaxes.length&&(window.removeEventListener("scroll",n._handleScrollThrottled),window.removeEventListener("resize",n._handleWindowResizeThrottled))}},{key:"_setupStyles",value:function(){this.$img[0].style.opacity=1}},{key:"_handleImageLoad",value:function(){this._updateParallax()}},{key:"_updateParallax",value:function(){var t=0e.options.responsiveThreshold}}},{key:"defaults",get:function(){return e}}]),n}();t._parallaxes=[],M.Parallax=t,M.jQueryLoaded&&M.initializeJqueryWrapper(t,"parallax","M_Parallax")}(cash),function(a,s){"use strict";var e={duration:300,onShow:null,swipeable:!1,responsiveThreshold:1/0},t=function(t){function n(t,e){_classCallCheck(this,n);var i=_possibleConstructorReturn(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,n,t,e));return(i.el.M_Tabs=i).options=a.extend({},n.defaults,e),i.$tabLinks=i.$el.children("li.tab").children("a"),i.index=0,i._setupActiveTabLink(),i.options.swipeable?i._setupSwipeableTabs():i._setupNormalTabs(),i._setTabsAndTabWidth(),i._createIndicator(),i._setupEventHandlers(),i}return _inherits(n,Component),_createClass(n,[{key:"destroy",value:function(){this._removeEventHandlers(),this._indicator.parentNode.removeChild(this._indicator),this.options.swipeable?this._teardownSwipeableTabs():this._teardownNormalTabs(),this.$el[0].M_Tabs=void 0}},{key:"_setupEventHandlers",value:function(){this._handleWindowResizeBound=this._handleWindowResize.bind(this),window.addEventListener("resize",this._handleWindowResizeBound),this._handleTabClickBound=this._handleTabClick.bind(this),this.el.addEventListener("click",this._handleTabClickBound)}},{key:"_removeEventHandlers",value:function(){window.removeEventListener("resize",this._handleWindowResizeBound),this.el.removeEventListener("click",this._handleTabClickBound)}},{key:"_handleWindowResize",value:function(){this._setTabsAndTabWidth(),0!==this.tabWidth&&0!==this.tabsWidth&&(this._indicator.style.left=this._calcLeftPos(this.$activeTabLink)+"px",this._indicator.style.right=this._calcRightPos(this.$activeTabLink)+"px")}},{key:"_handleTabClick",value:function(t){var e=this,i=a(t.target).closest("li.tab"),n=a(t.target).closest("a");if(n.length&&n.parent().hasClass("tab"))if(i.hasClass("disabled"))t.preventDefault();else if(!n.attr("target")){this.$activeTabLink.removeClass("active");var s=this.$content;this.$activeTabLink=n,this.$content=a(M.escapeHash(n[0].hash)),this.$tabLinks=this.$el.children("li.tab").children("a"),this.$activeTabLink.addClass("active");var o=this.index;this.index=Math.max(this.$tabLinks.index(n),0),this.options.swipeable?this._tabsCarousel&&this._tabsCarousel.set(this.index,function(){"function"==typeof e.options.onShow&&e.options.onShow.call(e,e.$content[0])}):this.$content.length&&(this.$content[0].style.display="block",this.$content.addClass("active"),"function"==typeof this.options.onShow&&this.options.onShow.call(this,this.$content[0]),s.length&&!s.is(this.$content)&&(s[0].style.display="none",s.removeClass("active"))),this._setTabsAndTabWidth(),this._animateIndicator(o),t.preventDefault()}}},{key:"_createIndicator",value:function(){var t=this,e=document.createElement("li");e.classList.add("indicator"),this.el.appendChild(e),this._indicator=e,setTimeout(function(){t._indicator.style.left=t._calcLeftPos(t.$activeTabLink)+"px",t._indicator.style.right=t._calcRightPos(t.$activeTabLink)+"px"},0)}},{key:"_setupActiveTabLink",value:function(){this.$activeTabLink=a(this.$tabLinks.filter('[href="'+location.hash+'"]')),0===this.$activeTabLink.length&&(this.$activeTabLink=this.$el.children("li.tab").children("a.active").first()),0===this.$activeTabLink.length&&(this.$activeTabLink=this.$el.children("li.tab").children("a").first()),this.$tabLinks.removeClass("active"),this.$activeTabLink[0].classList.add("active"),this.index=Math.max(this.$tabLinks.index(this.$activeTabLink),0),this.$activeTabLink.length&&(this.$content=a(M.escapeHash(this.$activeTabLink[0].hash)),this.$content.addClass("active"))}},{key:"_setupSwipeableTabs",value:function(){var i=this;window.innerWidth>this.options.responsiveThreshold&&(this.options.swipeable=!1);var n=a();this.$tabLinks.each(function(t){var e=a(M.escapeHash(t.hash));e.addClass("carousel-item"),n=n.add(e)});var t=a('');n.first().before(t),t.append(n),n[0].style.display="";var e=this.$activeTabLink.closest(".tab").index();this._tabsCarousel=M.Carousel.init(t[0],{fullWidth:!0,noWrap:!0,onCycleTo:function(t){var e=i.index;i.index=a(t).index(),i.$activeTabLink.removeClass("active"),i.$activeTabLink=i.$tabLinks.eq(i.index),i.$activeTabLink.addClass("active"),i._animateIndicator(e),"function"==typeof i.options.onShow&&i.options.onShow.call(i,i.$content[0])}}),this._tabsCarousel.set(e)}},{key:"_teardownSwipeableTabs",value:function(){var t=this._tabsCarousel.$el;this._tabsCarousel.destroy(),t.after(t.children()),t.remove()}},{key:"_setupNormalTabs",value:function(){this.$tabLinks.not(this.$activeTabLink).each(function(t){if(t.hash){var e=a(M.escapeHash(t.hash));e.length&&(e[0].style.display="none")}})}},{key:"_teardownNormalTabs",value:function(){this.$tabLinks.each(function(t){if(t.hash){var e=a(M.escapeHash(t.hash));e.length&&(e[0].style.display="")}})}},{key:"_setTabsAndTabWidth",value:function(){this.tabsWidth=this.$el.width(),this.tabWidth=Math.max(this.tabsWidth,this.el.scrollWidth)/this.$tabLinks.length}},{key:"_calcRightPos",value:function(t){return Math.ceil(this.tabsWidth-t.position().left-t[0].getBoundingClientRect().width)}},{key:"_calcLeftPos",value:function(t){return Math.floor(t.position().left)}},{key:"updateTabIndicator",value:function(){this._setTabsAndTabWidth(),this._animateIndicator(this.index)}},{key:"_animateIndicator",value:function(t){var e=0,i=0;0<=this.index-t?e=90:i=90;var n={targets:this._indicator,left:{value:this._calcLeftPos(this.$activeTabLink),delay:e},right:{value:this._calcRightPos(this.$activeTabLink),delay:i},duration:this.options.duration,easing:"easeOutQuad"};s.remove(this._indicator),s(n)}},{key:"select",value:function(t){var e=this.$tabLinks.filter('[href="#'+t+'"]');e.length&&e.trigger("click")}}],[{key:"init",value:function(t,e){return _get(n.__proto__||Object.getPrototypeOf(n),"init",this).call(this,this,t,e)}},{key:"getInstance",value:function(t){return(t.jquery?t[0]:t).M_Tabs}},{key:"defaults",get:function(){return e}}]),n}();M.Tabs=t,M.jQueryLoaded&&M.initializeJqueryWrapper(t,"tabs","M_Tabs")}(cash,M.anime),function(d,e){"use strict";var i={exitDelay:200,enterDelay:0,html:null,margin:5,inDuration:250,outDuration:200,position:"bottom",transitionMovement:10},t=function(t){function n(t,e){_classCallCheck(this,n);var i=_possibleConstructorReturn(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,n,t,e));return(i.el.M_Tooltip=i).options=d.extend({},n.defaults,e),i.isOpen=!1,i.isHovered=!1,i.isFocused=!1,i._appendTooltipEl(),i._setupEventHandlers(),i}return _inherits(n,Component),_createClass(n,[{key:"destroy",value:function(){d(this.tooltipEl).remove(),this._removeEventHandlers(),this.el.M_Tooltip=void 0}},{key:"_appendTooltipEl",value:function(){var t=document.createElement("div");t.classList.add("material-tooltip"),this.tooltipEl=t;var e=document.createElement("div");e.classList.add("tooltip-content"),e.innerHTML=this.options.html,t.appendChild(e),document.body.appendChild(t)}},{key:"_updateTooltipContent",value:function(){this.tooltipEl.querySelector(".tooltip-content").innerHTML=this.options.html}},{key:"_setupEventHandlers",value:function(){this._handleMouseEnterBound=this._handleMouseEnter.bind(this),this._handleMouseLeaveBound=this._handleMouseLeave.bind(this),this._handleFocusBound=this._handleFocus.bind(this),this._handleBlurBound=this._handleBlur.bind(this),this.el.addEventListener("mouseenter",this._handleMouseEnterBound),this.el.addEventListener("mouseleave",this._handleMouseLeaveBound),this.el.addEventListener("focus",this._handleFocusBound,!0),this.el.addEventListener("blur",this._handleBlurBound,!0)}},{key:"_removeEventHandlers",value:function(){this.el.removeEventListener("mouseenter",this._handleMouseEnterBound),this.el.removeEventListener("mouseleave",this._handleMouseLeaveBound),this.el.removeEventListener("focus",this._handleFocusBound,!0),this.el.removeEventListener("blur",this._handleBlurBound,!0)}},{key:"open",value:function(t){this.isOpen||(t=void 0===t||void 0,this.isOpen=!0,this.options=d.extend({},this.options,this._getAttributeOptions()),this._updateTooltipContent(),this._setEnterDelayTimeout(t))}},{key:"close",value:function(){this.isOpen&&(this.isHovered=!1,this.isFocused=!1,this.isOpen=!1,this._setExitDelayTimeout())}},{key:"_setExitDelayTimeout",value:function(){var t=this;clearTimeout(this._exitDelayTimeout),this._exitDelayTimeout=setTimeout(function(){t.isHovered||t.isFocused||t._animateOut()},this.options.exitDelay)}},{key:"_setEnterDelayTimeout",value:function(t){var e=this;clearTimeout(this._enterDelayTimeout),this._enterDelayTimeout=setTimeout(function(){(e.isHovered||e.isFocused||t)&&e._animateIn()},this.options.enterDelay)}},{key:"_positionTooltip",value:function(){var t,e=this.el,i=this.tooltipEl,n=e.offsetHeight,s=e.offsetWidth,o=i.offsetHeight,a=i.offsetWidth,r=this.options.margin,l=void 0,h=void 0;this.xMovement=0,this.yMovement=0,l=e.getBoundingClientRect().top+M.getDocumentScrollTop(),h=e.getBoundingClientRect().left+M.getDocumentScrollLeft(),"top"===this.options.position?(l+=-o-r,h+=s/2-a/2,this.yMovement=-this.options.transitionMovement):"right"===this.options.position?(l+=n/2-o/2,h+=s+r,this.xMovement=this.options.transitionMovement):"left"===this.options.position?(l+=n/2-o/2,h+=-a-r,this.xMovement=-this.options.transitionMovement):(l+=n+r,h+=s/2-a/2,this.yMovement=this.options.transitionMovement),t=this._repositionWithinScreen(h,l,a,o),d(i).css({top:t.y+"px",left:t.x+"px"})}},{key:"_repositionWithinScreen",value:function(t,e,i,n){var s=M.getDocumentScrollLeft(),o=M.getDocumentScrollTop(),a=t-s,r=e-o,l={left:a,top:r,width:i,height:n},h=this.options.margin+this.options.transitionMovement,d=M.checkWithinContainer(document.body,l,h);return d.left?a=h:d.right&&(a-=a+i-window.innerWidth),d.top?r=h:d.bottom&&(r-=r+n-window.innerHeight),{x:a+s,y:r+o}}},{key:"_animateIn",value:function(){this._positionTooltip(),this.tooltipEl.style.visibility="visible",e.remove(this.tooltipEl),e({targets:this.tooltipEl,opacity:1,translateX:this.xMovement,translateY:this.yMovement,duration:this.options.inDuration,easing:"easeOutCubic"})}},{key:"_animateOut",value:function(){e.remove(this.tooltipEl),e({targets:this.tooltipEl,opacity:0,translateX:0,translateY:0,duration:this.options.outDuration,easing:"easeOutCubic"})}},{key:"_handleMouseEnter",value:function(){this.isHovered=!0,this.isFocused=!1,this.open(!1)}},{key:"_handleMouseLeave",value:function(){this.isHovered=!1,this.isFocused=!1,this.close()}},{key:"_handleFocus",value:function(){M.tabPressed&&(this.isFocused=!0,this.open(!1))}},{key:"_handleBlur",value:function(){this.isFocused=!1,this.close()}},{key:"_getAttributeOptions",value:function(){var t={},e=this.el.getAttribute("data-tooltip"),i=this.el.getAttribute("data-position");return e&&(t.html=e),i&&(t.position=i),t}}],[{key:"init",value:function(t,e){return _get(n.__proto__||Object.getPrototypeOf(n),"init",this).call(this,this,t,e)}},{key:"getInstance",value:function(t){return(t.jquery?t[0]:t).M_Tooltip}},{key:"defaults",get:function(){return i}}]),n}();M.Tooltip=t,M.jQueryLoaded&&M.initializeJqueryWrapper(t,"tooltip","M_Tooltip")}(cash,M.anime),function(i){"use strict";var t=t||{},e=document.querySelectorAll.bind(document);function m(t){var e="";for(var i in t)t.hasOwnProperty(i)&&(e+=i+":"+t[i]+";");return e}var g={duration:750,show:function(t,e){if(2===t.button)return!1;var i=e||this,n=document.createElement("div");n.className="waves-ripple",i.appendChild(n);var s,o,a,r,l,h,d,u=(h={top:0,left:0},d=(s=i)&&s.ownerDocument,o=d.documentElement,void 0!==s.getBoundingClientRect&&(h=s.getBoundingClientRect()),a=null!==(l=r=d)&&l===l.window?r:9===r.nodeType&&r.defaultView,{top:h.top+a.pageYOffset-o.clientTop,left:h.left+a.pageXOffset-o.clientLeft}),c=t.pageY-u.top,p=t.pageX-u.left,v="scale("+i.clientWidth/100*10+")";"touches"in t&&(c=t.touches[0].pageY-u.top,p=t.touches[0].pageX-u.left),n.setAttribute("data-hold",Date.now()),n.setAttribute("data-scale",v),n.setAttribute("data-x",p),n.setAttribute("data-y",c);var f={top:c+"px",left:p+"px"};n.className=n.className+" waves-notransition",n.setAttribute("style",m(f)),n.className=n.className.replace("waves-notransition",""),f["-webkit-transform"]=v,f["-moz-transform"]=v,f["-ms-transform"]=v,f["-o-transform"]=v,f.transform=v,f.opacity="1",f["-webkit-transition-duration"]=g.duration+"ms",f["-moz-transition-duration"]=g.duration+"ms",f["-o-transition-duration"]=g.duration+"ms",f["transition-duration"]=g.duration+"ms",f["-webkit-transition-timing-function"]="cubic-bezier(0.250, 0.460, 0.450, 0.940)",f["-moz-transition-timing-function"]="cubic-bezier(0.250, 0.460, 0.450, 0.940)",f["-o-transition-timing-function"]="cubic-bezier(0.250, 0.460, 0.450, 0.940)",f["transition-timing-function"]="cubic-bezier(0.250, 0.460, 0.450, 0.940)",n.setAttribute("style",m(f))},hide:function(t){l.touchup(t);var e=this,i=(e.clientWidth,null),n=e.getElementsByClassName("waves-ripple");if(!(0i||1"+o+""+a+""+r+""),i.length&&e.prepend(i)}},{key:"_resetCurrentElement",value:function(){this.activeIndex=-1,this.$active.removeClass("active")}},{key:"_resetAutocomplete",value:function(){h(this.container).empty(),this._resetCurrentElement(),this.oldVal=null,this.isOpen=!1,this._mousedown=!1}},{key:"selectOption",value:function(t){var e=t.text().trim();this.el.value=e,this.$el.trigger("change"),this._resetAutocomplete(),this.close(),"function"==typeof this.options.onAutocomplete&&this.options.onAutocomplete.call(this,e)}},{key:"_renderDropdown",value:function(t,i){var n=this;this._resetAutocomplete();var e=[];for(var s in t)if(t.hasOwnProperty(s)&&-1!==s.toLowerCase().indexOf(i)){if(this.count>=this.options.limit)break;var o={data:t[s],key:s};e.push(o),this.count++}if(this.options.sortFunction){e.sort(function(t,e){return n.options.sortFunction(t.key.toLowerCase(),e.key.toLowerCase(),i.toLowerCase())})}for(var a=0;a");r.data?l.append(''+r.key+""):l.append(""+r.key+""),h(this.container).append(l),this._highlight(i,l)}}},{key:"open",value:function(){var t=this.el.value.toLowerCase();this._resetAutocomplete(),t.length>=this.options.minLength&&(this.isOpen=!0,this._renderDropdown(this.options.data,t)),this.dropdown.isOpen?this.dropdown.recalculateDimensions():this.dropdown.open()}},{key:"close",value:function(){this.dropdown.close()}},{key:"updateData",value:function(t){var e=this.el.value.toLowerCase();this.options.data=t,this.isOpen&&this._renderDropdown(t,e)}}],[{key:"init",value:function(t,e){return _get(s.__proto__||Object.getPrototypeOf(s),"init",this).call(this,this,t,e)}},{key:"getInstance",value:function(t){return(t.jquery?t[0]:t).M_Autocomplete}},{key:"defaults",get:function(){return e}}]),s}();t._keydown=!1,M.Autocomplete=t,M.jQueryLoaded&&M.initializeJqueryWrapper(t,"autocomplete","M_Autocomplete")}(cash),function(d){M.updateTextFields=function(){d("input[type=text], input[type=password], input[type=email], input[type=url], input[type=tel], input[type=number], input[type=search], input[type=date], input[type=time], textarea").each(function(t,e){var i=d(this);0'),d("body").append(e));var i=t.css("font-family"),n=t.css("font-size"),s=t.css("line-height"),o=t.css("padding-top"),a=t.css("padding-right"),r=t.css("padding-bottom"),l=t.css("padding-left");n&&e.css("font-size",n),i&&e.css("font-family",i),s&&e.css("line-height",s),o&&e.css("padding-top",o),a&&e.css("padding-right",a),r&&e.css("padding-bottom",r),l&&e.css("padding-left",l),t.data("original-height")||t.data("original-height",t.height()),"off"===t.attr("wrap")&&e.css("overflow-wrap","normal").css("white-space","pre"),e.text(t[0].value+"\n");var h=e.html().replace(/\n/g,"
    ");e.html(h),0'),this.$slides.each(function(t,e){var i=s('
  • ');n.$indicators.append(i[0])}),this.$el.append(this.$indicators[0]),this.$indicators=this.$indicators.children("li.indicator-item"))}},{key:"_removeIndicators",value:function(){this.$el.find("ul.indicators").remove()}},{key:"set",value:function(t){var e=this;if(t>=this.$slides.length?t=0:t<0&&(t=this.$slides.length-1),this.activeIndex!=t){this.$active=this.$slides.eq(this.activeIndex);var i=this.$active.find(".caption");this.$active.removeClass("active"),o({targets:this.$active[0],opacity:0,duration:this.options.duration,easing:"easeOutQuad",complete:function(){e.$slides.not(".active").each(function(t){o({targets:t,opacity:0,translateX:0,translateY:0,duration:0,easing:"easeOutQuad"})})}}),this._animateCaptionIn(i[0],this.options.duration),this.options.indicators&&(this.$indicators.eq(this.activeIndex).removeClass("active"),this.$indicators.eq(t).addClass("active")),o({targets:this.$slides.eq(t)[0],opacity:1,duration:this.options.duration,easing:"easeOutQuad"}),o({targets:this.$slides.eq(t).find(".caption")[0],opacity:1,translateX:0,translateY:0,duration:this.options.duration,delay:this.options.duration,easing:"easeOutQuad"}),this.$slides.eq(t).addClass("active"),this.activeIndex=t,this.start()}}},{key:"pause",value:function(){clearInterval(this.interval)}},{key:"start",value:function(){clearInterval(this.interval),this.interval=setInterval(this._handleIntervalBound,this.options.duration+this.options.interval)}},{key:"next",value:function(){var t=this.activeIndex+1;t>=this.$slides.length?t=0:t<0&&(t=this.$slides.length-1),this.set(t)}},{key:"prev",value:function(){var t=this.activeIndex-1;t>=this.$slides.length?t=0:t<0&&(t=this.$slides.length-1),this.set(t)}}],[{key:"init",value:function(t,e){return _get(n.__proto__||Object.getPrototypeOf(n),"init",this).call(this,this,t,e)}},{key:"getInstance",value:function(t){return(t.jquery?t[0]:t).M_Slider}},{key:"defaults",get:function(){return e}}]),n}();M.Slider=t,M.jQueryLoaded&&M.initializeJqueryWrapper(t,"slider","M_Slider")}(cash,M.anime),function(n,s){n(document).on("click",".card",function(t){if(n(this).children(".card-reveal").length){var i=n(t.target).closest(".card");void 0===i.data("initialOverflow")&&i.data("initialOverflow",void 0===i.css("overflow")?"":i.css("overflow"));var e=n(this).find(".card-reveal");n(t.target).is(n(".card-reveal .card-title"))||n(t.target).is(n(".card-reveal .card-title i"))?s({targets:e[0],translateY:0,duration:225,easing:"easeInOutQuad",complete:function(t){var e=t.animatables[0].target;n(e).css({display:"none"}),i.css("overflow",i.data("initialOverflow"))}}):(n(t.target).is(n(".card .activator"))||n(t.target).is(n(".card .activator i")))&&(i.css("overflow","hidden"),e.css({display:"block"}),s({targets:e[0],translateY:"-100%",duration:300,easing:"easeInOutQuad"}))}})}(cash,M.anime),function(h){"use strict";var e={data:[],placeholder:"",secondaryPlaceholder:"",autocompleteOptions:{},limit:1/0,onChipAdd:null,onChipSelect:null,onChipDelete:null},t=function(t){function l(t,e){_classCallCheck(this,l);var i=_possibleConstructorReturn(this,(l.__proto__||Object.getPrototypeOf(l)).call(this,l,t,e));return(i.el.M_Chips=i).options=h.extend({},l.defaults,e),i.$el.addClass("chips input-field"),i.chipsData=[],i.$chips=h(),i._setupInput(),i.hasAutocomplete=0"),this.$el.append(this.$input)),this.$input.addClass("input")}},{key:"_setupLabel",value:function(){this.$label=this.$el.find("label"),this.$label.length&&this.$label.setAttribute("for",this.$input.attr("id"))}},{key:"_setPlaceholder",value:function(){void 0!==this.chipsData&&!this.chipsData.length&&this.options.placeholder?h(this.$input).prop("placeholder",this.options.placeholder):(void 0===this.chipsData||this.chipsData.length)&&this.options.secondaryPlaceholder&&h(this.$input).prop("placeholder",this.options.secondaryPlaceholder)}},{key:"_isValid",value:function(t){if(t.hasOwnProperty("tag")&&""!==t.tag){for(var e=!1,i=0;i=this.options.limit)){var e=this._renderChip(t);this.$chips.add(e),this.chipsData.push(t),h(this.$input).before(e),this._setPlaceholder(),"function"==typeof this.options.onChipAdd&&this.options.onChipAdd.call(this,this.$el,e)}}},{key:"deleteChip",value:function(t){var e=this.$chips.eq(t);this.$chips.eq(t).remove(),this.$chips=this.$chips.filter(function(t){return 0<=h(t).index()}),this.chipsData.splice(t,1),this._setPlaceholder(),"function"==typeof this.options.onChipDelete&&this.options.onChipDelete.call(this,this.$el,e[0])}},{key:"selectChip",value:function(t){var e=this.$chips.eq(t);(this._selectedChip=e)[0].focus(),"function"==typeof this.options.onChipSelect&&this.options.onChipSelect.call(this,this.$el,e[0])}}],[{key:"init",value:function(t,e){return _get(l.__proto__||Object.getPrototypeOf(l),"init",this).call(this,this,t,e)}},{key:"getInstance",value:function(t){return(t.jquery?t[0]:t).M_Chips}},{key:"_handleChipsKeydown",value:function(t){l._keydown=!0;var e=h(t.target).closest(".chips"),i=t.target&&e.length;if(!h(t.target).is("input, textarea")&&i){var n=e[0].M_Chips;if(8===t.keyCode||46===t.keyCode){t.preventDefault();var s=n.chipsData.length;if(n._selectedChip){var o=n._selectedChip.index();n.deleteChip(o),n._selectedChip=null,s=Math.max(o-1,0)}n.chipsData.length&&n.selectChip(s)}else if(37===t.keyCode){if(n._selectedChip){var a=n._selectedChip.index()-1;if(a<0)return;n.selectChip(a)}}else if(39===t.keyCode&&n._selectedChip){var r=n._selectedChip.index()+1;r>=n.chipsData.length?n.$input[0].focus():n.selectChip(r)}}}},{key:"_handleChipsKeyup",value:function(t){l._keydown=!1}},{key:"_handleChipsBlur",value:function(t){l._keydown||(h(t.target).closest(".chips")[0].M_Chips._selectedChip=null)}},{key:"defaults",get:function(){return e}}]),l}();t._keydown=!1,M.Chips=t,M.jQueryLoaded&&M.initializeJqueryWrapper(t,"chips","M_Chips"),h(document).ready(function(){h(document.body).on("click",".chip .close",function(){var t=h(this).closest(".chips");t.length&&t[0].M_Chips||h(this).closest(".chip").remove()})})}(cash),function(s){"use strict";var e={top:0,bottom:1/0,offset:0,onPositionChange:null},t=function(t){function n(t,e){_classCallCheck(this,n);var i=_possibleConstructorReturn(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,n,t,e));return(i.el.M_Pushpin=i).options=s.extend({},n.defaults,e),i.originalOffset=i.el.offsetTop,n._pushpins.push(i),i._setupEventHandlers(),i._updatePosition(),i}return _inherits(n,Component),_createClass(n,[{key:"destroy",value:function(){this.el.style.top=null,this._removePinClasses(),this._removeEventHandlers();var t=n._pushpins.indexOf(this);n._pushpins.splice(t,1)}},{key:"_setupEventHandlers",value:function(){document.addEventListener("scroll",n._updateElements)}},{key:"_removeEventHandlers",value:function(){document.removeEventListener("scroll",n._updateElements)}},{key:"_updatePosition",value:function(){var t=M.getDocumentScrollTop()+this.options.offset;this.options.top<=t&&this.options.bottom>=t&&!this.el.classList.contains("pinned")&&(this._removePinClasses(),this.el.style.top=this.options.offset+"px",this.el.classList.add("pinned"),"function"==typeof this.options.onPositionChange&&this.options.onPositionChange.call(this,"pinned")),tthis.options.bottom&&!this.el.classList.contains("pin-bottom")&&(this._removePinClasses(),this.el.classList.add("pin-bottom"),this.el.style.top=this.options.bottom-this.originalOffset+"px","function"==typeof this.options.onPositionChange&&this.options.onPositionChange.call(this,"pin-bottom"))}},{key:"_removePinClasses",value:function(){this.el.classList.remove("pin-top"),this.el.classList.remove("pinned"),this.el.classList.remove("pin-bottom")}}],[{key:"init",value:function(t,e){return _get(n.__proto__||Object.getPrototypeOf(n),"init",this).call(this,this,t,e)}},{key:"getInstance",value:function(t){return(t.jquery?t[0]:t).M_Pushpin}},{key:"_updateElements",value:function(){for(var t in n._pushpins){n._pushpins[t]._updatePosition()}}},{key:"defaults",get:function(){return e}}]),n}();t._pushpins=[],M.Pushpin=t,M.jQueryLoaded&&M.initializeJqueryWrapper(t,"pushpin","M_Pushpin")}(cash),function(r,s){"use strict";var e={direction:"top",hoverEnabled:!0,toolbarEnabled:!1};r.fn.reverse=[].reverse;var t=function(t){function n(t,e){_classCallCheck(this,n);var i=_possibleConstructorReturn(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,n,t,e));return(i.el.M_FloatingActionButton=i).options=r.extend({},n.defaults,e),i.isOpen=!1,i.$anchor=i.$el.children("a").first(),i.$menu=i.$el.children("ul").first(),i.$floatingBtns=i.$el.find("ul .btn-floating"),i.$floatingBtnsReverse=i.$el.find("ul .btn-floating").reverse(),i.offsetY=0,i.offsetX=0,i.$el.addClass("direction-"+i.options.direction),"top"===i.options.direction?i.offsetY=40:"right"===i.options.direction?i.offsetX=-40:"bottom"===i.options.direction?i.offsetY=-40:i.offsetX=40,i._setupEventHandlers(),i}return _inherits(n,Component),_createClass(n,[{key:"destroy",value:function(){this._removeEventHandlers(),this.el.M_FloatingActionButton=void 0}},{key:"_setupEventHandlers",value:function(){this._handleFABClickBound=this._handleFABClick.bind(this),this._handleOpenBound=this.open.bind(this),this._handleCloseBound=this.close.bind(this),this.options.hoverEnabled&&!this.options.toolbarEnabled?(this.el.addEventListener("mouseenter",this._handleOpenBound),this.el.addEventListener("mouseleave",this._handleCloseBound)):this.el.addEventListener("click",this._handleFABClickBound)}},{key:"_removeEventHandlers",value:function(){this.options.hoverEnabled&&!this.options.toolbarEnabled?(this.el.removeEventListener("mouseenter",this._handleOpenBound),this.el.removeEventListener("mouseleave",this._handleCloseBound)):this.el.removeEventListener("click",this._handleFABClickBound)}},{key:"_handleFABClick",value:function(){this.isOpen?this.close():this.open()}},{key:"_handleDocumentClick",value:function(t){r(t.target).closest(this.$menu).length||this.close()}},{key:"open",value:function(){this.isOpen||(this.options.toolbarEnabled?this._animateInToolbar():this._animateInFAB(),this.isOpen=!0)}},{key:"close",value:function(){this.isOpen&&(this.options.toolbarEnabled?(window.removeEventListener("scroll",this._handleCloseBound,!0),document.body.removeEventListener("click",this._handleDocumentClickBound,!0),this._animateOutToolbar()):this._animateOutFAB(),this.isOpen=!1)}},{key:"_animateInFAB",value:function(){var e=this;this.$el.addClass("active");var i=0;this.$floatingBtnsReverse.each(function(t){s({targets:t,opacity:1,scale:[.4,1],translateY:[e.offsetY,0],translateX:[e.offsetX,0],duration:275,delay:i,easing:"easeInOutQuad"}),i+=40})}},{key:"_animateOutFAB",value:function(){var e=this;this.$floatingBtnsReverse.each(function(t){s.remove(t),s({targets:t,opacity:0,scale:.4,translateY:e.offsetY,translateX:e.offsetX,duration:175,easing:"easeOutQuad",complete:function(){e.$el.removeClass("active")}})})}},{key:"_animateInToolbar",value:function(){var t,e=this,i=window.innerWidth,n=window.innerHeight,s=this.el.getBoundingClientRect(),o=r('
    '),a=this.$anchor.css("background-color");this.$anchor.append(o),this.offsetX=s.left-i/2+s.width/2,this.offsetY=n-s.bottom,t=i/o[0].clientWidth,this.btnBottom=s.bottom,this.btnLeft=s.left,this.btnWidth=s.width,this.$el.addClass("active"),this.$el.css({"text-align":"center",width:"100%",bottom:0,left:0,transform:"translateX("+this.offsetX+"px)",transition:"none"}),this.$anchor.css({transform:"translateY("+-this.offsetY+"px)",transition:"none"}),o.css({"background-color":a}),setTimeout(function(){e.$el.css({transform:"",transition:"transform .2s cubic-bezier(0.550, 0.085, 0.680, 0.530), background-color 0s linear .2s"}),e.$anchor.css({overflow:"visible",transform:"",transition:"transform .2s"}),setTimeout(function(){e.$el.css({overflow:"hidden","background-color":a}),o.css({transform:"scale("+t+")",transition:"transform .2s cubic-bezier(0.550, 0.055, 0.675, 0.190)"}),e.$menu.children("li").children("a").css({opacity:1}),e._handleDocumentClickBound=e._handleDocumentClick.bind(e),window.addEventListener("scroll",e._handleCloseBound,!0),document.body.addEventListener("click",e._handleDocumentClickBound,!0)},100)},0)}},{key:"_animateOutToolbar",value:function(){var t=this,e=window.innerWidth,i=window.innerHeight,n=this.$el.find(".fab-backdrop"),s=this.$anchor.css("background-color");this.offsetX=this.btnLeft-e/2+this.btnWidth/2,this.offsetY=i-this.btnBottom,this.$el.removeClass("active"),this.$el.css({"background-color":"transparent",transition:"none"}),this.$anchor.css({transition:"none"}),n.css({transform:"scale(0)","background-color":s}),this.$menu.children("li").children("a").css({opacity:""}),setTimeout(function(){n.remove(),t.$el.css({"text-align":"",width:"",bottom:"",left:"",overflow:"","background-color":"",transform:"translate3d("+-t.offsetX+"px,0,0)"}),t.$anchor.css({overflow:"",transform:"translate3d(0,"+t.offsetY+"px,0)"}),setTimeout(function(){t.$el.css({transform:"translate3d(0,0,0)",transition:"transform .2s"}),t.$anchor.css({transform:"translate3d(0,0,0)",transition:"transform .2s cubic-bezier(0.550, 0.055, 0.675, 0.190)"})},20)},200)}}],[{key:"init",value:function(t,e){return _get(n.__proto__||Object.getPrototypeOf(n),"init",this).call(this,this,t,e)}},{key:"getInstance",value:function(t){return(t.jquery?t[0]:t).M_FloatingActionButton}},{key:"defaults",get:function(){return e}}]),n}();M.FloatingActionButton=t,M.jQueryLoaded&&M.initializeJqueryWrapper(t,"floatingActionButton","M_FloatingActionButton")}(cash,M.anime),function(g){"use strict";var e={autoClose:!1,format:"mmm dd, yyyy",parse:null,defaultDate:null,setDefaultDate:!1,disableWeekends:!1,disableDayFn:null,firstDay:0,minDate:null,maxDate:null,yearRange:10,minYear:0,maxYear:9999,minMonth:void 0,maxMonth:void 0,startRange:null,endRange:null,isRTL:!1,showMonthAfterYear:!1,showDaysInNextAndPreviousMonths:!1,container:null,showClearBtn:!1,i18n:{cancel:"Cancel",clear:"Clear",done:"Ok",previousMonth:"‹",nextMonth:"›",months:["January","February","March","April","May","June","July","August","September","October","November","December"],monthsShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],weekdays:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],weekdaysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],weekdaysAbbrev:["S","M","T","W","T","F","S"]},events:[],onSelect:null,onOpen:null,onClose:null,onDraw:null},t=function(t){function B(t,e){_classCallCheck(this,B);var i=_possibleConstructorReturn(this,(B.__proto__||Object.getPrototypeOf(B)).call(this,B,t,e));(i.el.M_Datepicker=i).options=g.extend({},B.defaults,e),e&&e.hasOwnProperty("i18n")&&"object"==typeof e.i18n&&(i.options.i18n=g.extend({},B.defaults.i18n,e.i18n)),i.options.minDate&&i.options.minDate.setHours(0,0,0,0),i.options.maxDate&&i.options.maxDate.setHours(0,0,0,0),i.id=M.guid(),i._setupVariables(),i._insertHTMLIntoDOM(),i._setupModal(),i._setupEventHandlers(),i.options.defaultDate||(i.options.defaultDate=new Date(Date.parse(i.el.value)));var n=i.options.defaultDate;return B._isDate(n)?i.options.setDefaultDate?(i.setDate(n,!0),i.setInputValue()):i.gotoDate(n):i.gotoDate(new Date),i.isOpen=!1,i}return _inherits(B,Component),_createClass(B,[{key:"destroy",value:function(){this._removeEventHandlers(),this.modal.destroy(),g(this.modalEl).remove(),this.destroySelects(),this.el.M_Datepicker=void 0}},{key:"destroySelects",value:function(){var t=this.calendarEl.querySelector(".orig-select-year");t&&M.FormSelect.getInstance(t).destroy();var e=this.calendarEl.querySelector(".orig-select-month");e&&M.FormSelect.getInstance(e).destroy()}},{key:"_insertHTMLIntoDOM",value:function(){this.options.showClearBtn&&(g(this.clearBtn).css({visibility:""}),this.clearBtn.innerHTML=this.options.i18n.clear),this.doneBtn.innerHTML=this.options.i18n.done,this.cancelBtn.innerHTML=this.options.i18n.cancel,this.options.container?this.$modalEl.appendTo(this.options.container):this.$modalEl.insertBefore(this.el)}},{key:"_setupModal",value:function(){var t=this;this.modalEl.id="modal-"+this.id,this.modal=M.Modal.init(this.modalEl,{onCloseEnd:function(){t.isOpen=!1}})}},{key:"toString",value:function(t){var e=this;return t=t||this.options.format,B._isDate(this.date)?t.split(/(d{1,4}|m{1,4}|y{4}|yy|!.)/g).map(function(t){return e.formats[t]?e.formats[t]():t}).join(""):""}},{key:"setDate",value:function(t,e){if(!t)return this.date=null,this._renderDateDisplay(),this.draw();if("string"==typeof t&&(t=new Date(Date.parse(t))),B._isDate(t)){var i=this.options.minDate,n=this.options.maxDate;B._isDate(i)&&tn.maxDate||n.disableWeekends&&B._isWeekend(y)||n.disableDayFn&&n.disableDayFn(y),isEmpty:C,isStartRange:x,isEndRange:L,isInRange:T,showDaysInNextAndPreviousMonths:n.showDaysInNextAndPreviousMonths};l.push(this.renderDay($)),7==++_&&(r.push(this.renderRow(l,n.isRTL,m)),_=0,m=!(l=[]))}return this.renderTable(n,r,i)}},{key:"renderDay",value:function(t){var e=[],i="false";if(t.isEmpty){if(!t.showDaysInNextAndPreviousMonths)return'';e.push("is-outside-current-month"),e.push("is-selection-disabled")}return t.isDisabled&&e.push("is-disabled"),t.isToday&&e.push("is-today"),t.isSelected&&(e.push("is-selected"),i="true"),t.hasEvent&&e.push("has-event"),t.isInRange&&e.push("is-inrange"),t.isStartRange&&e.push("is-startrange"),t.isEndRange&&e.push("is-endrange"),'"}},{key:"renderRow",value:function(t,e,i){return''+(e?t.reverse():t).join("")+""}},{key:"renderTable",value:function(t,e,i){return'
    '+this.renderHead(t)+this.renderBody(e)+"
    "}},{key:"renderHead",value:function(t){var e=void 0,i=[];for(e=0;e<7;e++)i.push(''+this.renderDayName(t,e,!0)+"");return""+(t.isRTL?i.reverse():i).join("")+""}},{key:"renderBody",value:function(t){return""+t.join("")+""}},{key:"renderTitle",value:function(t,e,i,n,s,o){var a,r,l=void 0,h=void 0,d=void 0,u=this.options,c=i===u.minYear,p=i===u.maxYear,v='
    ',f=!0,m=!0;for(d=[],l=0;l<12;l++)d.push('");for(a='",g.isArray(u.yearRange)?(l=u.yearRange[0],h=u.yearRange[1]+1):(l=i-u.yearRange,h=1+i+u.yearRange),d=[];l=u.minYear&&d.push('");r='";v+='',v+='
    ',u.showMonthAfterYear?v+=r+a:v+=a+r,v+="
    ",c&&(0===n||u.minMonth>=n)&&(f=!1),p&&(11===n||u.maxMonth<=n)&&(m=!1);return(v+='')+"
    "}},{key:"draw",value:function(t){if(this.isOpen||t){var e,i=this.options,n=i.minYear,s=i.maxYear,o=i.minMonth,a=i.maxMonth,r="";this._y<=n&&(this._y=n,!isNaN(o)&&this._m=s&&(this._y=s,!isNaN(a)&&this._m>a&&(this._m=a)),e="datepicker-title-"+Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,2);for(var l=0;l<1;l++)this._renderDateDisplay(),r+=this.renderTitle(this,l,this.calendars[l].year,this.calendars[l].month,this.calendars[0].year,e)+this.render(this.calendars[l].year,this.calendars[l].month,e);this.destroySelects(),this.calendarEl.innerHTML=r;var h=this.calendarEl.querySelector(".orig-select-year"),d=this.calendarEl.querySelector(".orig-select-month");M.FormSelect.init(h,{classes:"select-year",dropdownOptions:{container:document.body,constrainWidth:!1}}),M.FormSelect.init(d,{classes:"select-month",dropdownOptions:{container:document.body,constrainWidth:!1}}),h.addEventListener("change",this._handleYearChange.bind(this)),d.addEventListener("change",this._handleMonthChange.bind(this)),"function"==typeof this.options.onDraw&&this.options.onDraw(this)}}},{key:"_setupEventHandlers",value:function(){this._handleInputKeydownBound=this._handleInputKeydown.bind(this),this._handleInputClickBound=this._handleInputClick.bind(this),this._handleInputChangeBound=this._handleInputChange.bind(this),this._handleCalendarClickBound=this._handleCalendarClick.bind(this),this._finishSelectionBound=this._finishSelection.bind(this),this._handleMonthChange=this._handleMonthChange.bind(this),this._closeBound=this.close.bind(this),this.el.addEventListener("click",this._handleInputClickBound),this.el.addEventListener("keydown",this._handleInputKeydownBound),this.el.addEventListener("change",this._handleInputChangeBound),this.calendarEl.addEventListener("click",this._handleCalendarClickBound),this.doneBtn.addEventListener("click",this._finishSelectionBound),this.cancelBtn.addEventListener("click",this._closeBound),this.options.showClearBtn&&(this._handleClearClickBound=this._handleClearClick.bind(this),this.clearBtn.addEventListener("click",this._handleClearClickBound))}},{key:"_setupVariables",value:function(){var e=this;this.$modalEl=g(B._template),this.modalEl=this.$modalEl[0],this.calendarEl=this.modalEl.querySelector(".datepicker-calendar"),this.yearTextEl=this.modalEl.querySelector(".year-text"),this.dateTextEl=this.modalEl.querySelector(".date-text"),this.options.showClearBtn&&(this.clearBtn=this.modalEl.querySelector(".datepicker-clear")),this.doneBtn=this.modalEl.querySelector(".datepicker-done"),this.cancelBtn=this.modalEl.querySelector(".datepicker-cancel"),this.formats={d:function(){return e.date.getDate()},dd:function(){var t=e.date.getDate();return(t<10?"0":"")+t},ddd:function(){return e.options.i18n.weekdaysShort[e.date.getDay()]},dddd:function(){return e.options.i18n.weekdays[e.date.getDay()]},m:function(){return e.date.getMonth()+1},mm:function(){var t=e.date.getMonth()+1;return(t<10?"0":"")+t},mmm:function(){return e.options.i18n.monthsShort[e.date.getMonth()]},mmmm:function(){return e.options.i18n.months[e.date.getMonth()]},yy:function(){return(""+e.date.getFullYear()).slice(2)},yyyy:function(){return e.date.getFullYear()}}}},{key:"_removeEventHandlers",value:function(){this.el.removeEventListener("click",this._handleInputClickBound),this.el.removeEventListener("keydown",this._handleInputKeydownBound),this.el.removeEventListener("change",this._handleInputChangeBound),this.calendarEl.removeEventListener("click",this._handleCalendarClickBound)}},{key:"_handleInputClick",value:function(){this.open()}},{key:"_handleInputKeydown",value:function(t){t.which===M.keys.ENTER&&(t.preventDefault(),this.open())}},{key:"_handleCalendarClick",value:function(t){if(this.isOpen){var e=g(t.target);e.hasClass("is-disabled")||(!e.hasClass("datepicker-day-button")||e.hasClass("is-empty")||e.parent().hasClass("is-disabled")?e.closest(".month-prev").length?this.prevMonth():e.closest(".month-next").length&&this.nextMonth():(this.setDate(new Date(t.target.getAttribute("data-year"),t.target.getAttribute("data-month"),t.target.getAttribute("data-day"))),this.options.autoClose&&this._finishSelection()))}}},{key:"_handleClearClick",value:function(){this.date=null,this.setInputValue(),this.close()}},{key:"_handleMonthChange",value:function(t){this.gotoMonth(t.target.value)}},{key:"_handleYearChange",value:function(t){this.gotoYear(t.target.value)}},{key:"gotoMonth",value:function(t){isNaN(t)||(this.calendars[0].month=parseInt(t,10),this.adjustCalendars())}},{key:"gotoYear",value:function(t){isNaN(t)||(this.calendars[0].year=parseInt(t,10),this.adjustCalendars())}},{key:"_handleInputChange",value:function(t){var e=void 0;t.firedBy!==this&&(e=this.options.parse?this.options.parse(this.el.value,this.options.format):new Date(Date.parse(this.el.value)),B._isDate(e)&&this.setDate(e))}},{key:"renderDayName",value:function(t,e,i){for(e+=t.firstDay;7<=e;)e-=7;return i?t.i18n.weekdaysAbbrev[e]:t.i18n.weekdays[e]}},{key:"_finishSelection",value:function(){this.setInputValue(),this.close()}},{key:"open",value:function(){if(!this.isOpen)return this.isOpen=!0,"function"==typeof this.options.onOpen&&this.options.onOpen.call(this),this.draw(),this.modal.open(),this}},{key:"close",value:function(){if(this.isOpen)return this.isOpen=!1,"function"==typeof this.options.onClose&&this.options.onClose.call(this),this.modal.close(),this}}],[{key:"init",value:function(t,e){return _get(B.__proto__||Object.getPrototypeOf(B),"init",this).call(this,this,t,e)}},{key:"_isDate",value:function(t){return/Date/.test(Object.prototype.toString.call(t))&&!isNaN(t.getTime())}},{key:"_isWeekend",value:function(t){var e=t.getDay();return 0===e||6===e}},{key:"_setToStartOfDay",value:function(t){B._isDate(t)&&t.setHours(0,0,0,0)}},{key:"_getDaysInMonth",value:function(t,e){return[31,B._isLeapYear(t)?29:28,31,30,31,30,31,31,30,31,30,31][e]}},{key:"_isLeapYear",value:function(t){return t%4==0&&t%100!=0||t%400==0}},{key:"_compareDates",value:function(t,e){return t.getTime()===e.getTime()}},{key:"_setToStartOfDay",value:function(t){B._isDate(t)&&t.setHours(0,0,0,0)}},{key:"getInstance",value:function(t){return(t.jquery?t[0]:t).M_Datepicker}},{key:"defaults",get:function(){return e}}]),B}();t._template=['"].join(""),M.Datepicker=t,M.jQueryLoaded&&M.initializeJqueryWrapper(t,"datepicker","M_Datepicker")}(cash),function(h){"use strict";var e={dialRadius:135,outerRadius:105,innerRadius:70,tickRadius:20,duration:350,container:null,defaultTime:"now",fromNow:0,showClearBtn:!1,i18n:{cancel:"Cancel",clear:"Clear",done:"Ok"},autoClose:!1,twelveHour:!0,vibrate:!0,onOpenStart:null,onOpenEnd:null,onCloseStart:null,onCloseEnd:null,onSelect:null},t=function(t){function f(t,e){_classCallCheck(this,f);var i=_possibleConstructorReturn(this,(f.__proto__||Object.getPrototypeOf(f)).call(this,f,t,e));return(i.el.M_Timepicker=i).options=h.extend({},f.defaults,e),i.id=M.guid(),i._insertHTMLIntoDOM(),i._setupModal(),i._setupVariables(),i._setupEventHandlers(),i._clockSetup(),i._pickerSetup(),i}return _inherits(f,Component),_createClass(f,[{key:"destroy",value:function(){this._removeEventHandlers(),this.modal.destroy(),h(this.modalEl).remove(),this.el.M_Timepicker=void 0}},{key:"_setupEventHandlers",value:function(){this._handleInputKeydownBound=this._handleInputKeydown.bind(this),this._handleInputClickBound=this._handleInputClick.bind(this),this._handleClockClickStartBound=this._handleClockClickStart.bind(this),this._handleDocumentClickMoveBound=this._handleDocumentClickMove.bind(this),this._handleDocumentClickEndBound=this._handleDocumentClickEnd.bind(this),this.el.addEventListener("click",this._handleInputClickBound),this.el.addEventListener("keydown",this._handleInputKeydownBound),this.plate.addEventListener("mousedown",this._handleClockClickStartBound),this.plate.addEventListener("touchstart",this._handleClockClickStartBound),h(this.spanHours).on("click",this.showView.bind(this,"hours")),h(this.spanMinutes).on("click",this.showView.bind(this,"minutes"))}},{key:"_removeEventHandlers",value:function(){this.el.removeEventListener("click",this._handleInputClickBound),this.el.removeEventListener("keydown",this._handleInputKeydownBound)}},{key:"_handleInputClick",value:function(){this.open()}},{key:"_handleInputKeydown",value:function(t){t.which===M.keys.ENTER&&(t.preventDefault(),this.open())}},{key:"_handleClockClickStart",value:function(t){t.preventDefault();var e=this.plate.getBoundingClientRect(),i=e.left,n=e.top;this.x0=i+this.options.dialRadius,this.y0=n+this.options.dialRadius,this.moved=!1;var s=f._Pos(t);this.dx=s.x-this.x0,this.dy=s.y-this.y0,this.setHand(this.dx,this.dy,!1),document.addEventListener("mousemove",this._handleDocumentClickMoveBound),document.addEventListener("touchmove",this._handleDocumentClickMoveBound),document.addEventListener("mouseup",this._handleDocumentClickEndBound),document.addEventListener("touchend",this._handleDocumentClickEndBound)}},{key:"_handleDocumentClickMove",value:function(t){t.preventDefault();var e=f._Pos(t),i=e.x-this.x0,n=e.y-this.y0;this.moved=!0,this.setHand(i,n,!1,!0)}},{key:"_handleDocumentClickEnd",value:function(t){var e=this;t.preventDefault(),document.removeEventListener("mouseup",this._handleDocumentClickEndBound),document.removeEventListener("touchend",this._handleDocumentClickEndBound);var i=f._Pos(t),n=i.x-this.x0,s=i.y-this.y0;this.moved&&n===this.dx&&s===this.dy&&this.setHand(n,s),"hours"===this.currentView?this.showView("minutes",this.options.duration/2):this.options.autoClose&&(h(this.minutesView).addClass("timepicker-dial-out"),setTimeout(function(){e.done()},this.options.duration/2)),"function"==typeof this.options.onSelect&&this.options.onSelect.call(this,this.hours,this.minutes),document.removeEventListener("mousemove",this._handleDocumentClickMoveBound),document.removeEventListener("touchmove",this._handleDocumentClickMoveBound)}},{key:"_insertHTMLIntoDOM",value:function(){this.$modalEl=h(f._template),this.modalEl=this.$modalEl[0],this.modalEl.id="modal-"+this.id;var t=document.querySelector(this.options.container);this.options.container&&t?this.$modalEl.appendTo(t):this.$modalEl.insertBefore(this.el)}},{key:"_setupModal",value:function(){var t=this;this.modal=M.Modal.init(this.modalEl,{onOpenStart:this.options.onOpenStart,onOpenEnd:this.options.onOpenEnd,onCloseStart:this.options.onCloseStart,onCloseEnd:function(){"function"==typeof t.options.onCloseEnd&&t.options.onCloseEnd.call(t),t.isOpen=!1}})}},{key:"_setupVariables",value:function(){this.currentView="hours",this.vibrate=navigator.vibrate?"vibrate":navigator.webkitVibrate?"webkitVibrate":null,this._canvas=this.modalEl.querySelector(".timepicker-canvas"),this.plate=this.modalEl.querySelector(".timepicker-plate"),this.hoursView=this.modalEl.querySelector(".timepicker-hours"),this.minutesView=this.modalEl.querySelector(".timepicker-minutes"),this.spanHours=this.modalEl.querySelector(".timepicker-span-hours"),this.spanMinutes=this.modalEl.querySelector(".timepicker-span-minutes"),this.spanAmPm=this.modalEl.querySelector(".timepicker-span-am-pm"),this.footer=this.modalEl.querySelector(".timepicker-footer"),this.amOrPm="PM"}},{key:"_pickerSetup",value:function(){var t=h('").appendTo(this.footer).on("click",this.clear.bind(this));this.options.showClearBtn&&t.css({visibility:""});var e=h('
    ');h('").appendTo(e).on("click",this.close.bind(this)),h('").appendTo(e).on("click",this.done.bind(this)),e.appendTo(this.footer)}},{key:"_clockSetup",value:function(){this.options.twelveHour&&(this.$amBtn=h('
    AM
    '),this.$pmBtn=h('
    PM
    '),this.$amBtn.on("click",this._handleAmPmClick.bind(this)).appendTo(this.spanAmPm),this.$pmBtn.on("click",this._handleAmPmClick.bind(this)).appendTo(this.spanAmPm)),this._buildHoursView(),this._buildMinutesView(),this._buildSVGClock()}},{key:"_buildSVGClock",value:function(){var t=this.options.dialRadius,e=this.options.tickRadius,i=2*t,n=f._createSVGEl("svg");n.setAttribute("class","timepicker-svg"),n.setAttribute("width",i),n.setAttribute("height",i);var s=f._createSVGEl("g");s.setAttribute("transform","translate("+t+","+t+")");var o=f._createSVGEl("circle");o.setAttribute("class","timepicker-canvas-bearing"),o.setAttribute("cx",0),o.setAttribute("cy",0),o.setAttribute("r",4);var a=f._createSVGEl("line");a.setAttribute("x1",0),a.setAttribute("y1",0);var r=f._createSVGEl("circle");r.setAttribute("class","timepicker-canvas-bg"),r.setAttribute("r",e),s.appendChild(a),s.appendChild(r),s.appendChild(o),n.appendChild(s),this._canvas.appendChild(n),this.hand=a,this.bg=r,this.bearing=o,this.g=s}},{key:"_buildHoursView",value:function(){var t=h('
    ');if(this.options.twelveHour)for(var e=1;e<13;e+=1){var i=t.clone(),n=e/6*Math.PI,s=this.options.outerRadius;i.css({left:this.options.dialRadius+Math.sin(n)*s-this.options.tickRadius+"px",top:this.options.dialRadius-Math.cos(n)*s-this.options.tickRadius+"px"}),i.html(0===e?"00":e),this.hoursView.appendChild(i[0])}else for(var o=0;o<24;o+=1){var a=t.clone(),r=o/6*Math.PI,l=0'),e=0;e<60;e+=5){var i=t.clone(),n=e/30*Math.PI;i.css({left:this.options.dialRadius+Math.sin(n)*this.options.outerRadius-this.options.tickRadius+"px",top:this.options.dialRadius-Math.cos(n)*this.options.outerRadius-this.options.tickRadius+"px"}),i.html(f._addLeadingZero(e)),this.minutesView.appendChild(i[0])}}},{key:"_handleAmPmClick",value:function(t){var e=h(t.target);this.amOrPm=e.hasClass("am-btn")?"AM":"PM",this._updateAmPmView()}},{key:"_updateAmPmView",value:function(){this.options.twelveHour&&(this.$amBtn.toggleClass("text-primary","AM"===this.amOrPm),this.$pmBtn.toggleClass("text-primary","PM"===this.amOrPm))}},{key:"_updateTimeFromInput",value:function(){var t=((this.el.value||this.options.defaultTime||"")+"").split(":");if(this.options.twelveHour&&void 0!==t[1]&&(0','",""].join(""),M.Timepicker=t,M.jQueryLoaded&&M.initializeJqueryWrapper(t,"timepicker","M_Timepicker")}(cash),function(s){"use strict";var e={},t=function(t){function n(t,e){_classCallCheck(this,n);var i=_possibleConstructorReturn(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,n,t,e));return(i.el.M_CharacterCounter=i).options=s.extend({},n.defaults,e),i.isInvalid=!1,i.isValidLength=!1,i._setupCounter(),i._setupEventHandlers(),i}return _inherits(n,Component),_createClass(n,[{key:"destroy",value:function(){this._removeEventHandlers(),this.el.CharacterCounter=void 0,this._removeCounter()}},{key:"_setupEventHandlers",value:function(){this._handleUpdateCounterBound=this.updateCounter.bind(this),this.el.addEventListener("focus",this._handleUpdateCounterBound,!0),this.el.addEventListener("input",this._handleUpdateCounterBound,!0)}},{key:"_removeEventHandlers",value:function(){this.el.removeEventListener("focus",this._handleUpdateCounterBound,!0),this.el.removeEventListener("input",this._handleUpdateCounterBound,!0)}},{key:"_setupCounter",value:function(){this.counterEl=document.createElement("span"),s(this.counterEl).addClass("character-counter").css({float:"right","font-size":"12px",height:1}),this.$el.parent().append(this.counterEl)}},{key:"_removeCounter",value:function(){s(this.counterEl).remove()}},{key:"updateCounter",value:function(){var t=+this.$el.attr("data-length"),e=this.el.value.length;this.isValidLength=e<=t;var i=e;t&&(i+="/"+t,this._validateInput()),s(this.counterEl).html(i)}},{key:"_validateInput",value:function(){this.isValidLength&&this.isInvalid?(this.isInvalid=!1,this.$el.removeClass("invalid")):this.isValidLength||this.isInvalid||(this.isInvalid=!0,this.$el.removeClass("valid"),this.$el.addClass("invalid"))}}],[{key:"init",value:function(t,e){return _get(n.__proto__||Object.getPrototypeOf(n),"init",this).call(this,this,t,e)}},{key:"getInstance",value:function(t){return(t.jquery?t[0]:t).M_CharacterCounter}},{key:"defaults",get:function(){return e}}]),n}();M.CharacterCounter=t,M.jQueryLoaded&&M.initializeJqueryWrapper(t,"characterCounter","M_CharacterCounter")}(cash),function(b){"use strict";var e={duration:200,dist:-100,shift:0,padding:0,numVisible:5,fullWidth:!1,indicators:!1,noWrap:!1,onCycleTo:null},t=function(t){function i(t,e){_classCallCheck(this,i);var n=_possibleConstructorReturn(this,(i.__proto__||Object.getPrototypeOf(i)).call(this,i,t,e));return(n.el.M_Carousel=n).options=b.extend({},i.defaults,e),n.hasMultipleSlides=1'),n.$el.find(".carousel-item").each(function(t,e){if(n.images.push(t),n.showIndicators){var i=b('
  • ');0===e&&i[0].classList.add("active"),n.$indicators.append(i)}}),n.showIndicators&&n.$el.append(n.$indicators),n.count=n.images.length,n.options.numVisible=Math.min(n.count,n.options.numVisible),n.xform="transform",["webkit","Moz","O","ms"].every(function(t){var e=t+"Transform";return void 0===document.body.style[e]||(n.xform=e,!1)}),n._setupEventHandlers(),n._scroll(n.offset),n}return _inherits(i,Component),_createClass(i,[{key:"destroy",value:function(){this._removeEventHandlers(),this.el.M_Carousel=void 0}},{key:"_setupEventHandlers",value:function(){var i=this;this._handleCarouselTapBound=this._handleCarouselTap.bind(this),this._handleCarouselDragBound=this._handleCarouselDrag.bind(this),this._handleCarouselReleaseBound=this._handleCarouselRelease.bind(this),this._handleCarouselClickBound=this._handleCarouselClick.bind(this),void 0!==window.ontouchstart&&(this.el.addEventListener("touchstart",this._handleCarouselTapBound),this.el.addEventListener("touchmove",this._handleCarouselDragBound),this.el.addEventListener("touchend",this._handleCarouselReleaseBound)),this.el.addEventListener("mousedown",this._handleCarouselTapBound),this.el.addEventListener("mousemove",this._handleCarouselDragBound),this.el.addEventListener("mouseup",this._handleCarouselReleaseBound),this.el.addEventListener("mouseleave",this._handleCarouselReleaseBound),this.el.addEventListener("click",this._handleCarouselClickBound),this.showIndicators&&this.$indicators&&(this._handleIndicatorClickBound=this._handleIndicatorClick.bind(this),this.$indicators.find(".indicator-item").each(function(t,e){t.addEventListener("click",i._handleIndicatorClickBound)}));var t=M.throttle(this._handleResize,200);this._handleThrottledResizeBound=t.bind(this),window.addEventListener("resize",this._handleThrottledResizeBound)}},{key:"_removeEventHandlers",value:function(){var i=this;void 0!==window.ontouchstart&&(this.el.removeEventListener("touchstart",this._handleCarouselTapBound),this.el.removeEventListener("touchmove",this._handleCarouselDragBound),this.el.removeEventListener("touchend",this._handleCarouselReleaseBound)),this.el.removeEventListener("mousedown",this._handleCarouselTapBound),this.el.removeEventListener("mousemove",this._handleCarouselDragBound),this.el.removeEventListener("mouseup",this._handleCarouselReleaseBound),this.el.removeEventListener("mouseleave",this._handleCarouselReleaseBound),this.el.removeEventListener("click",this._handleCarouselClickBound),this.showIndicators&&this.$indicators&&this.$indicators.find(".indicator-item").each(function(t,e){t.removeEventListener("click",i._handleIndicatorClickBound)}),window.removeEventListener("resize",this._handleThrottledResizeBound)}},{key:"_handleCarouselTap",value:function(t){"mousedown"===t.type&&b(t.target).is("img")&&t.preventDefault(),this.pressed=!0,this.dragged=!1,this.verticalDragged=!1,this.reference=this._xpos(t),this.referenceY=this._ypos(t),this.velocity=this.amplitude=0,this.frame=this.offset,this.timestamp=Date.now(),clearInterval(this.ticker),this.ticker=setInterval(this._trackBound,100)}},{key:"_handleCarouselDrag",value:function(t){var e=void 0,i=void 0,n=void 0;if(this.pressed)if(e=this._xpos(t),i=this._ypos(t),n=this.reference-e,Math.abs(this.referenceY-i)<30&&!this.verticalDragged)(2=this.dim*(this.count-1)?this.target=this.dim*(this.count-1):this.target<0&&(this.target=0)),this.amplitude=this.target-this.offset,this.timestamp=Date.now(),requestAnimationFrame(this._autoScrollBound),this.dragged&&(t.preventDefault(),t.stopPropagation()),!1}},{key:"_handleCarouselClick",value:function(t){if(this.dragged)return t.preventDefault(),t.stopPropagation(),!1;if(!this.options.fullWidth){var e=b(t.target).closest(".carousel-item").index();0!==this._wrap(this.center)-e&&(t.preventDefault(),t.stopPropagation()),this._cycleTo(e)}}},{key:"_handleIndicatorClick",value:function(t){t.stopPropagation();var e=b(t.target).closest(".indicator-item");e.length&&this._cycleTo(e.index())}},{key:"_handleResize",value:function(t){this.options.fullWidth?(this.itemWidth=this.$el.find(".carousel-item").first().innerWidth(),this.imageHeight=this.$el.find(".carousel-item.active").height(),this.dim=2*this.itemWidth+this.options.padding,this.offset=2*this.center*this.itemWidth,this.target=this.offset,this._setCarouselHeight(!0)):this._scroll()}},{key:"_setCarouselHeight",value:function(t){var i=this,e=this.$el.find(".carousel-item.active").length?this.$el.find(".carousel-item.active").first():this.$el.find(".carousel-item").first(),n=e.find("img").first();if(n.length)if(n[0].complete){var s=n.height();if(0=this.count?t%this.count:t<0?this._wrap(this.count+t%this.count):t}},{key:"_track",value:function(){var t,e,i,n;e=(t=Date.now())-this.timestamp,this.timestamp=t,i=this.offset-this.frame,this.frame=this.offset,n=1e3*i/(1+e),this.velocity=.8*n+.2*this.velocity}},{key:"_autoScroll",value:function(){var t=void 0,e=void 0;this.amplitude&&(t=Date.now()-this.timestamp,2<(e=this.amplitude*Math.exp(-t/this.options.duration))||e<-2?(this._scroll(this.target-e),requestAnimationFrame(this._autoScrollBound)):this._scroll(this.target))}},{key:"_scroll",value:function(t){var e=this;this.$el.hasClass("scrolling")||this.el.classList.add("scrolling"),null!=this.scrollingTimeout&&window.clearTimeout(this.scrollingTimeout),this.scrollingTimeout=window.setTimeout(function(){e.$el.removeClass("scrolling")},this.options.duration);var i,n,s,o,a=void 0,r=void 0,l=void 0,h=void 0,d=void 0,u=void 0,c=this.center,p=1/this.options.numVisible;if(this.offset="number"==typeof t?t:this.offset,this.center=Math.floor((this.offset+this.dim/2)/this.dim),o=-(s=(n=this.offset-this.center*this.dim)<0?1:-1)*n*2/this.dim,i=this.count>>1,this.options.fullWidth?(l="translateX(0)",u=1):(l="translateX("+(this.el.clientWidth-this.itemWidth)/2+"px) ",l+="translateY("+(this.el.clientHeight-this.itemHeight)/2+"px)",u=1-p*o),this.showIndicators){var v=this.center%this.count,f=this.$indicators.find(".indicator-item.active");f.index()!==v&&(f.removeClass("active"),this.$indicators.find(".indicator-item").eq(v)[0].classList.add("active"))}if(!this.noWrap||0<=this.center&&this.center=this.count||e<0){if(this.noWrap)return;e=this._wrap(e)}this._cycleTo(e)}},{key:"prev",value:function(t){(void 0===t||isNaN(t))&&(t=1);var e=this.center-t;if(e>=this.count||e<0){if(this.noWrap)return;e=this._wrap(e)}this._cycleTo(e)}},{key:"set",value:function(t,e){if((void 0===t||isNaN(t))&&(t=0),t>this.count||t<0){if(this.noWrap)return;t=this._wrap(t)}this._cycleTo(t,e)}}],[{key:"init",value:function(t,e){return _get(i.__proto__||Object.getPrototypeOf(i),"init",this).call(this,this,t,e)}},{key:"getInstance",value:function(t){return(t.jquery?t[0]:t).M_Carousel}},{key:"defaults",get:function(){return e}}]),i}();M.Carousel=t,M.jQueryLoaded&&M.initializeJqueryWrapper(t,"carousel","M_Carousel")}(cash),function(S){"use strict";var e={onOpen:void 0,onClose:void 0},t=function(t){function n(t,e){_classCallCheck(this,n);var i=_possibleConstructorReturn(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,n,t,e));return(i.el.M_TapTarget=i).options=S.extend({},n.defaults,e),i.isOpen=!1,i.$origin=S("#"+i.$el.attr("data-target")),i._setup(),i._calculatePositioning(),i._setupEventHandlers(),i}return _inherits(n,Component),_createClass(n,[{key:"destroy",value:function(){this._removeEventHandlers(),this.el.TapTarget=void 0}},{key:"_setupEventHandlers",value:function(){this._handleDocumentClickBound=this._handleDocumentClick.bind(this),this._handleTargetClickBound=this._handleTargetClick.bind(this),this._handleOriginClickBound=this._handleOriginClick.bind(this),this.el.addEventListener("click",this._handleTargetClickBound),this.originEl.addEventListener("click",this._handleOriginClickBound);var t=M.throttle(this._handleResize,200);this._handleThrottledResizeBound=t.bind(this),window.addEventListener("resize",this._handleThrottledResizeBound)}},{key:"_removeEventHandlers",value:function(){this.el.removeEventListener("click",this._handleTargetClickBound),this.originEl.removeEventListener("click",this._handleOriginClickBound),window.removeEventListener("resize",this._handleThrottledResizeBound)}},{key:"_handleTargetClick",value:function(t){this.open()}},{key:"_handleOriginClick",value:function(t){this.close()}},{key:"_handleResize",value:function(t){this._calculatePositioning()}},{key:"_handleDocumentClick",value:function(t){S(t.target).closest(".tap-target-wrapper").length||(this.close(),t.preventDefault(),t.stopPropagation())}},{key:"_setup",value:function(){this.wrapper=this.$el.parent()[0],this.waveEl=S(this.wrapper).find(".tap-target-wave")[0],this.originEl=S(this.wrapper).find(".tap-target-origin")[0],this.contentEl=this.$el.find(".tap-target-content")[0],S(this.wrapper).hasClass(".tap-target-wrapper")||(this.wrapper=document.createElement("div"),this.wrapper.classList.add("tap-target-wrapper"),this.$el.before(S(this.wrapper)),this.wrapper.append(this.el)),this.contentEl||(this.contentEl=document.createElement("div"),this.contentEl.classList.add("tap-target-content"),this.$el.append(this.contentEl)),this.waveEl||(this.waveEl=document.createElement("div"),this.waveEl.classList.add("tap-target-wave"),this.originEl||(this.originEl=this.$origin.clone(!0,!0),this.originEl.addClass("tap-target-origin"),this.originEl.removeAttr("id"),this.originEl.removeAttr("style"),this.originEl=this.originEl[0],this.waveEl.append(this.originEl)),this.wrapper.append(this.waveEl))}},{key:"_calculatePositioning",value:function(){var t="fixed"===this.$origin.css("position");if(!t)for(var e=this.$origin.parents(),i=0;i'+t.getAttribute("label")+"")[0]),i.each(function(t){var e=n._appendOptionWithIcon(n.$el,t,"optgroup-option");n._addOptionToValueDict(t,e)})}}),this.$el.after(this.dropdownOptions),this.input=document.createElement("input"),d(this.input).addClass("select-dropdown dropdown-trigger"),this.input.setAttribute("type","text"),this.input.setAttribute("readonly","true"),this.input.setAttribute("data-target",this.dropdownOptions.id),this.el.disabled&&d(this.input).prop("disabled","true"),this.$el.before(this.input),this._setValueToInput();var t=d('');if(this.$el.before(t[0]),!this.el.disabled){var e=d.extend({},this.options.dropdownOptions);e.onOpenEnd=function(t){var e=d(n.dropdownOptions).find(".selected").first();if(e.length&&(M.keyDown=!0,n.dropdown.focusedIndex=e.index(),n.dropdown._focusFocusedItem(),M.keyDown=!1,n.dropdown.isScrollable)){var i=e[0].getBoundingClientRect().top-n.dropdownOptions.getBoundingClientRect().top;i-=n.dropdownOptions.clientHeight/2,n.dropdownOptions.scrollTop=i}},this.isMultiple&&(e.closeOnClick=!1),this.dropdown=M.Dropdown.init(this.input,e)}this._setSelectedStates()}},{key:"_addOptionToValueDict",value:function(t,e){var i=Object.keys(this._valueDict).length,n=this.dropdownOptions.id+i,s={};e.id=n,s.el=t,s.optionEl=e,this._valueDict[n]=s}},{key:"_removeDropdown",value:function(){d(this.wrapper).find(".caret").remove(),d(this.input).remove(),d(this.dropdownOptions).remove(),d(this.wrapper).before(this.$el),d(this.wrapper).remove()}},{key:"_appendOptionWithIcon",value:function(t,e,i){var n=e.disabled?"disabled ":"",s="optgroup-option"===i?"optgroup-option ":"",o=this.isMultiple?'":e.innerHTML,a=d("
  • "),r=d("");r.html(o),a.addClass(n+" "+s),a.append(r);var l=e.getAttribute("data-icon");if(l){var h=d('');a.prepend(h)}return d(this.dropdownOptions).append(a[0]),a[0]}},{key:"_toggleEntryFromArray",value:function(t){var e=!this._keysSelected.hasOwnProperty(t),i=d(this._valueDict[t].optionEl);return e?this._keysSelected[t]=!0:delete this._keysSelected[t],i.toggleClass("selected",e),i.find('input[type="checkbox"]').prop("checked",e),i.prop("selected",e),e}},{key:"_setValueToInput",value:function(){var i=[];if(this.$el.find("option").each(function(t){if(d(t).prop("selected")){var e=d(t).text();i.push(e)}}),!i.length){var t=this.$el.find("option:disabled").eq(0);t.length&&""===t[0].value&&i.push(t.text())}this.input.value=i.join(", ")}},{key:"_setSelectedStates",value:function(){for(var t in this._keysSelected={},this._valueDict){var e=this._valueDict[t],i=d(e.el).prop("selected");d(e.optionEl).find('input[type="checkbox"]').prop("checked",i),i?(this._activateOption(d(this.dropdownOptions),d(e.optionEl)),this._keysSelected[t]=!0):d(e.optionEl).removeClass("selected")}}},{key:"_activateOption",value:function(t,e){e&&(this.isMultiple||t.find("li.selected").removeClass("selected"),d(e).addClass("selected"))}},{key:"getSelectedValues",value:function(){var t=[];for(var e in this._keysSelected)t.push(this._valueDict[e].el.value);return t}}],[{key:"init",value:function(t,e){return _get(n.__proto__||Object.getPrototypeOf(n),"init",this).call(this,this,t,e)}},{key:"getInstance",value:function(t){return(t.jquery?t[0]:t).M_FormSelect}},{key:"defaults",get:function(){return e}}]),n}();M.FormSelect=t,M.jQueryLoaded&&M.initializeJqueryWrapper(t,"formSelect","M_FormSelect")}(cash),function(s,e){"use strict";var i={},t=function(t){function n(t,e){_classCallCheck(this,n);var i=_possibleConstructorReturn(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,n,t,e));return(i.el.M_Range=i).options=s.extend({},n.defaults,e),i._mousedown=!1,i._setupThumb(),i._setupEventHandlers(),i}return _inherits(n,Component),_createClass(n,[{key:"destroy",value:function(){this._removeEventHandlers(),this._removeThumb(),this.el.M_Range=void 0}},{key:"_setupEventHandlers",value:function(){this._handleRangeChangeBound=this._handleRangeChange.bind(this),this._handleRangeMousedownTouchstartBound=this._handleRangeMousedownTouchstart.bind(this),this._handleRangeInputMousemoveTouchmoveBound=this._handleRangeInputMousemoveTouchmove.bind(this),this._handleRangeMouseupTouchendBound=this._handleRangeMouseupTouchend.bind(this),this._handleRangeBlurMouseoutTouchleaveBound=this._handleRangeBlurMouseoutTouchleave.bind(this),this.el.addEventListener("change",this._handleRangeChangeBound),this.el.addEventListener("mousedown",this._handleRangeMousedownTouchstartBound),this.el.addEventListener("touchstart",this._handleRangeMousedownTouchstartBound),this.el.addEventListener("input",this._handleRangeInputMousemoveTouchmoveBound),this.el.addEventListener("mousemove",this._handleRangeInputMousemoveTouchmoveBound),this.el.addEventListener("touchmove",this._handleRangeInputMousemoveTouchmoveBound),this.el.addEventListener("mouseup",this._handleRangeMouseupTouchendBound),this.el.addEventListener("touchend",this._handleRangeMouseupTouchendBound),this.el.addEventListener("blur",this._handleRangeBlurMouseoutTouchleaveBound),this.el.addEventListener("mouseout",this._handleRangeBlurMouseoutTouchleaveBound),this.el.addEventListener("touchleave",this._handleRangeBlurMouseoutTouchleaveBound)}},{key:"_removeEventHandlers",value:function(){this.el.removeEventListener("change",this._handleRangeChangeBound),this.el.removeEventListener("mousedown",this._handleRangeMousedownTouchstartBound),this.el.removeEventListener("touchstart",this._handleRangeMousedownTouchstartBound),this.el.removeEventListener("input",this._handleRangeInputMousemoveTouchmoveBound),this.el.removeEventListener("mousemove",this._handleRangeInputMousemoveTouchmoveBound),this.el.removeEventListener("touchmove",this._handleRangeInputMousemoveTouchmoveBound),this.el.removeEventListener("mouseup",this._handleRangeMouseupTouchendBound),this.el.removeEventListener("touchend",this._handleRangeMouseupTouchendBound),this.el.removeEventListener("blur",this._handleRangeBlurMouseoutTouchleaveBound),this.el.removeEventListener("mouseout",this._handleRangeBlurMouseoutTouchleaveBound),this.el.removeEventListener("touchleave",this._handleRangeBlurMouseoutTouchleaveBound)}},{key:"_handleRangeChange",value:function(){s(this.value).html(this.$el.val()),s(this.thumb).hasClass("active")||this._showRangeBubble();var t=this._calcRangeOffset();s(this.thumb).addClass("active").css("left",t+"px")}},{key:"_handleRangeMousedownTouchstart",value:function(t){if(s(this.value).html(this.$el.val()),this._mousedown=!0,this.$el.addClass("active"),s(this.thumb).hasClass("active")||this._showRangeBubble(),"input"!==t.type){var e=this._calcRangeOffset();s(this.thumb).addClass("active").css("left",e+"px")}}},{key:"_handleRangeInputMousemoveTouchmove",value:function(){if(this._mousedown){s(this.thumb).hasClass("active")||this._showRangeBubble();var t=this._calcRangeOffset();s(this.thumb).addClass("active").css("left",t+"px"),s(this.value).html(this.$el.val())}}},{key:"_handleRangeMouseupTouchend",value:function(){this._mousedown=!1,this.$el.removeClass("active")}},{key:"_handleRangeBlurMouseoutTouchleave",value:function(){if(!this._mousedown){var t=7+parseInt(this.$el.css("padding-left"))+"px";s(this.thumb).hasClass("active")&&(e.remove(this.thumb),e({targets:this.thumb,height:0,width:0,top:10,easing:"easeOutQuad",marginLeft:t,duration:100})),s(this.thumb).removeClass("active")}}},{key:"_setupThumb",value:function(){this.thumb=document.createElement("span"),this.value=document.createElement("span"),s(this.thumb).addClass("thumb"),s(this.value).addClass("value"),s(this.thumb).append(this.value),this.$el.after(this.thumb)}},{key:"_removeThumb",value:function(){s(this.thumb).remove()}},{key:"_showRangeBubble",value:function(){var t=-7+parseInt(s(this.thumb).parent().css("padding-left"))+"px";e.remove(this.thumb),e({targets:this.thumb,height:30,width:30,top:-30,marginLeft:t,duration:300,easing:"easeOutQuint"})}},{key:"_calcRangeOffset",value:function(){var t=this.$el.width()-15,e=parseFloat(this.$el.attr("max"))||100,i=parseFloat(this.$el.attr("min"))||0;return(parseFloat(this.$el.val())-i)/(e-i)*t}}],[{key:"init",value:function(t,e){return _get(n.__proto__||Object.getPrototypeOf(n),"init",this).call(this,this,t,e)}},{key:"getInstance",value:function(t){return(t.jquery?t[0]:t).M_Range}},{key:"defaults",get:function(){return i}}]),n}();M.Range=t,M.jQueryLoaded&&M.initializeJqueryWrapper(t,"range","M_Range"),t.init(s("input[type=range]"))}(cash,M.anime); \ No newline at end of file diff --git a/app/static/js/modules/corpus_analysis/client/Client.js b/app/static/js/modules/corpus_analysis/client/Client.js deleted file mode 100644 index 08c380ac..00000000 --- a/app/static/js/modules/corpus_analysis/client/Client.js +++ /dev/null @@ -1,282 +0,0 @@ -/** - * This class is used to create a Client object. - * The client handels the client server communication. - * It communicates with the server (e.g. connection or query) - * and recieves data from it, if dynamicMode is true. - * If dynamicMode is false, the client can also handle data that is already - * loaded and is not coming in, in chunks. - */ -class Client { - constructor({corpusId = null, - socket = null, - logging = true, - dynamicMode = true, - fullContext = null} = {}) { - this.corpusId = corpusId; - this.dynamicMode = dynamicMode; - this.logging = logging; - this.requestQueryProgress = 0; - this.socket = socket; - this.eventListeners = {}; - this.isBusy = false; - this.fullContext = fullContext; - /** - * Disables all console logging. - * This is global. So every other log message in every other Class or - * function used in conjunction with the client either logs or does not - * log depending on the logging flag. It is kind of hacky but not bad. - * Credits to https://gist.github.com/kmonsoor/0244fdb4ad79a4826371e58a1a5fa984 - */ - if (!logging) { - (() => { - let console = (window.console = window.console || {}); - [ - 'assert', 'clear', 'count', 'debug', 'dir', 'dirxml', - 'error', 'exception', 'group', 'groupCollapsed', 'groupEnd', - 'info', 'log', 'markTimeline', 'profile', 'profileEnd', 'table', - 'time', 'timeEnd', 'timeStamp', 'trace', 'warn' - ].forEach((method) => { - console[method] = () => {}; - }); - })(); - } - console.info("Client initialized:", this); - } - /** - * Registers one or more event listeners to the Client. Either socket or - * custom javascript events. Event listeners are class instances of - * ClientEventListener implemented further below. - */ - setSocketEventListeners(eventListeners) { - for (let eventListener of eventListeners) { - this.eventListeners[eventListener.type] = eventListener; - } - } - - /** - * Loads the event listeners that have been registered with the function - * above so that they will be triggered on their assigned - * type strings. Type strings double as the socket event event names or - * javascript custom event names. - */ - loadSocketEventListeners() { - for (let [type, listener] of Object.entries(this.eventListeners)) { - listener.listenerFunction(type, this); - } - } - - /** - * This functions emits the 'notify-view' custom javascript event. This - * triggers specific functions in the View depending on the caseIdentifier. - * The detail object can hold any type of data the View needs to know about - * to represent those to the user. - */ - notifyView(caseIdentifier, detailObject={}, notificationType='info', - raiseModalFeedback=true) { - detailObject.caseIdentifier = caseIdentifier; - detailObject.client = this; - detailObject.notificationType = notificationType; - detailObject.raiseModalFeedback = raiseModalFeedback; - const event = new CustomEvent('notify-view', { detail: detailObject }); - console[notificationType]('Client dispatching Notification with details:', - detailObject); - document.dispatchEvent(event); - } - - /** - * Connects to the corpus analysis session running on the server side for the - * specified corpus via socket.io. - */ - connect() { - console.info('corpus_analysis_init: Client connecting to session via', - 'socket.emit'); - this.socket.emit('corpus_analysis_init', this.corpusId); - } - - // Gets the meta data of the current corpus. - getMetaData() { - this.isBusy = true; - console.info('corpus_analysis_meta_data: Client getting meta data via', - 'socket.emit.'); - this.socket.emit('corpus_analysis_meta_data', this.corpusId); - } - - /** - * Emits query to the server via socket.io. Server will send the results - * back. - */ - query(queryStr) { - this.isBusy = true; - console.info('corpus_analysis_query: Client sending query via', - 'socket.emit for the query', queryStr); - this.socket.emit('corpus_analysis_query', queryStr); - } - - /** - * Requests results data either for, 'full-results', 'sub-results' or - * 'inspect-results' (resultsType). - * Gets full results for evere provided dataIndex (one match). - * Full results means with full context. So the Client has to request all - * matches from the server again! - **/ - getResultsData(resultsType, dataIndexes, results) { - let tmp_first_cpos = []; - let tmp_last_cpos = []; - let objectKey = ''; - if (resultsType === 'full-results') { - objectKey = 'fullResultsData'; - } else if (resultsType === 'sub-results') { - objectKey = 'subResultsData'; - } else if (resultsType === 'inspect-results') { - objectKey = 'inspectResultsData'; - } - // Delete old data before new data is coming in. - results[objectKey].init(); - for (let dataIndex of dataIndexes) { - tmp_first_cpos.push(results.data.matches[dataIndex].c[0]); - tmp_last_cpos.push(results.data.matches[dataIndex].c[1]); - } - this.socket.emit('corpus_analysis_get_match_with_full_context', - {type: resultsType, - data_indexes: dataIndexes, - first_cpos: tmp_first_cpos, - last_cpos: tmp_last_cpos,}); - } - - /** - * Gets results data either for, 'full-results' or 'sub-results' - * Gets results for every provided dataIndex (one match) without full - * context. Because no context is needed the results data is gathered locally - * from results.data and not from the server. - **/ - getResultsDataWithoutContext(resultsType, dataIndexes, results, resultsList) { - this.notifyView('results-data-recieving', {fullContext: false}); - let objectKey = ''; - if (resultsType === 'full-results') { - console.info('Saving full-results data without full context.'); - objectKey = 'fullResultsData'; - } else if (resultsType === 'sub-results') { - console.info('Saving sub-results data without full context.'); - objectKey = 'subResultsData'; - } - // Get matches from results.data. - let matches = []; - let cpos = []; - let match; - for (let index of dataIndexes) { - match = results.data.matches[index] - matches.push(match) - // Get cpos from match. - let {lc, c, rc} = resultsList.helperCreateCpos(results.data.cpos_ranges, - match); - cpos.push(...lc); - cpos.push(...c); - cpos.push(...rc); - } - // Get cpos_lookups from cposes. - let cpos_lookup = {}; - let textIds = new Set; - for (let single_cpos of cpos) { - textIds.add(results.data.cpos_lookup[single_cpos].text); - Object.assign(cpos_lookup, { [single_cpos]: results.data.cpos_lookup[single_cpos]}); - } - let text = {}; - let text_lookup = {}; - for (let id of textIds) { - text[id] = results.data.text_lookup[id]; - Object.assign(text_lookup, text); - } - /** - * Save the data from results.dat either in results.fullResultsData or - * results.subResultsData. - */ - results[objectKey].init(); - results[objectKey].matches.push(...matches); - results[objectKey].addData(cpos_lookup, "cpos_lookup"); - results[objectKey].addData(text_lookup, "text_lookup"); - results[objectKey].addData(results.metaData); - results[objectKey].query = results.data.query; - results[objectKey].corpus_type = resultsType; - results[objectKey].match_count = matches.length; - results[objectKey].cpos_ranges = results.data.cpos_ranges; - results[objectKey].fullContext = false; - if (objectKey === 'subResultsData') { - // Remove match_count from texts, because they are useless in sub results - for (let [key, value] of Object.entries(results[objectKey].text_lookup)) { - delete results[objectKey].text_lookup[key].match_count; - } - } - console.info('Results data without context has been saved.', results); - this.isBusy = false; - this.notifyView('results-data-recieved', {type: resultsType, - results: results, - fullContext: false}); - } - -} - - -/** - * This class is used to create an event listener listening for socket or - * javascript custom events. - * Input are an identifying type string, the listener function and callbacks - * which will be executed as part of the listener function. The identifying - * type string is also used as the socket event or custom javascript event name - * identifier. - */ -class ClientEventListener { - constructor(type, listenerFunction) { - this.listenerCallbacks = {}; - this.listenerFunction = listenerFunction; - this.type = type; - } - - // Registers callbacks to this ClientEventListener. - setCallbacks(listenerCallbacks) { - for (let listenerCallback of listenerCallbacks) { - this.listenerCallbacks[listenerCallback.type] = listenerCallback; - } - } - - /** Shorthand to execute all registered callbacks with same defaultArgs - * in insertion order. - * NOTE: - * Since ECMAScript 2015, objects do preserve creation order for - * string and Symbol keys. In JavaScript engines that comply with the - * ECMAScript 2015 spec, iterating over an object with only string keys will - * yield the keys in order of insertion. - * So all modern Browsers. - */ - executeCallbacks(defaultArgs) { - for (let [type, listenerCallback] of Object.entries(this.listenerCallbacks)) { - listenerCallback.callbackFunction(...defaultArgs, - ...listenerCallback.args); - } - } - // Executes a specific registered callback by provoding a type string. - executeCallback(defaultArgs, type) { - let listenerCallback = this.listenerCallbacks[type]; - let args = defaultArgs.concat(listenerCallback.args) ; - listenerCallback.callbackFunction(...args); - } -} - -/** - * This class is used to create an ListenerCallback which will be registered - * to an ClientEventListener so the listener can invoke the associated - * callback functions. - */ -class ListenerCallback { - constructor(type, callbackFunction, argsList) { - this.args = argsList; - this.callbackFunction = callbackFunction; - this.type = type; - } -} - -// Export Classes from this module. -export { - Client, - ClientEventListener, - ListenerCallback, -}; diff --git a/app/static/js/modules/corpus_analysis/client/callbacks.js b/app/static/js/modules/corpus_analysis/client/callbacks.js deleted file mode 100644 index e5f2e668..00000000 --- a/app/static/js/modules/corpus_analysis/client/callbacks.js +++ /dev/null @@ -1,161 +0,0 @@ -/** - * This callback is called on a socket.on "corpus_analysis_send_meta_data". - * Handels incoming corpus metadata - */ -function saveMetaData(...args) { - let [payload, client, results, rest] = args; - client.notifyView('meta-data-recieving'); - results.metaData.init(payload) - console.info('Metada saved:', results); - client.isBusy = false; - client.notifyView('meta-data-recieved'); -} - -/** - * This callback should be registered to the SocketEventListener 'recieveQueryStatus'. - * It just gets the incoming status data of the issued query - * and does some preperation work like hiding or showing elements and deleting - * the data from the last query. - */ -function prepareQueryData(...args) { - // deletes old data from query issued before this new query - let [payload, client, results, rest] = args; - // always initialize the results to delete data from the query issued before - results.init(); - results.data.match_count = payload.match_count; - client.requestQueryProgress = 0; - client.notifyView('query-data-prepareing', { results: results }); -} - -/** - * This callbacks saves the incoming query data chunks into the model results. - */ -function saveQueryData(...args) { - let [payload, client, results, rest] = args; - // Get data matches length before new chunk data is being inserted - let dataLength = results.data.matches.length; - if (client.dynamicMode) { - // Incorporating new chunk data into full results - results.data.matches.push(...payload.chunk.matches); - results.data.addData(payload.chunk.cpos_lookup, 'cpos_lookup'); - results.data.addData(payload.chunk.text_lookup, 'text_lookup'); - /** - * Increment match_counts per text in a global results varaible because - * they are coming in chunkwise. - */ - if (payload.chunk.text_lookup) { - for (let [text_key, value] of Object.entries(payload.chunk.text_lookup)) { - if (!(text_key in results.tmp_match_counts)) { - results.tmp_match_counts[text_key] = {match_count: 0}; - } - results.tmp_match_counts[text_key].match_count += payload.chunk.text_lookup[text_key].match_count; - } - } - results.data.cpos_ranges = payload.chunk.cpos_ranges; - let queryFormElement = document.querySelector('#query-form'); - results.data.getQueryStr(queryFormElement); - client.requestQueryProgress = payload.progress; - client.notifyView('query-data-recieving', - { results: results, - client: client, - dataLength: dataLength }); - console.info('Query data chunk saved', results.data); - if (client.requestQueryProgress === 100) { - client.isBusy = false; - // Update text_lookup with tmp_match_counts. - for (let [text_key, value] of Object.entries(results.tmp_match_counts)) { - results.data.text_lookup[text_key].match_count = results.tmp_match_counts[text_key].match_count; - } - client.notifyView('query-data-recieved'); - } - } else { - results.data.matches.push(...payload.matches); - results.data.addData(payload.cpos_lookup, 'cpos_lookup'); - results.data.addData(payload.text_lookup, 'text_lookup'); - results.data.cpos_ranges = payload.cpos_ranges; - let queryFormElement = document.querySelector('#query-form'); - results.data.getQueryStr(queryFormElement); - client.requestQueryProgress = 100; - client.notifyView('query-data-recieving', - { results: results, - client: client, - dataLength: dataLength }); - console.info('Query data chunk saved', results.data); - if (client.requestQueryProgress === 100) { - console.log(results.data); - client.notifyView('query-data-recieved'); - } - } -} - -/** - * This callback gets the results data for the export. Either requesting it - * whith full context from the server or gets it locally without full context - * from the already present results.data. Result data is identified with the - * dataIndexes. On index is one match. - */ -function getResultsData(...args) { - let [resultsType, dataIndexes, resultsList, client, results, rest] = args; - client.isBusy = true; - if (resultsList.exportFullInspectContext.checked - || resultsType === 'inspect-results') { - console.info('Get results with full context'); - client.getResultsData(resultsType, dataIndexes, results); - } else { - console.info('Get results without full context'); - client.getResultsDataWithoutContext(resultsType, dataIndexes, results, - resultsList); - } -} - -/** - * Handles incoming results which have been requested via getResultsData(). and - * saves the data accorindgly into the results object. - */ -function saveResultsData(...args) { - let [payload, type, client, results, rest] = args; - let objectKey = ''; - if (type === 'full-results') { - console.info('Saving full-results data.'); - objectKey = 'fullResultsData'; - } else if (type === 'sub-results') { - console.info('Saving sub-results data.'); - objectKey = 'subResultsData'; - } else if (type = 'inspect-results') { - objectKey = 'inspectResultsData'; - console.info('Saving inspect-results data'); - } - // Save incoming data. Data is incoming one match at a time. - results[objectKey].matches.push(...payload.matches); - results[objectKey].addData(payload.cpos_lookup, 'cpos_lookup'); - results[objectKey].addData(payload.text_lookup, 'text_lookup'); - results[objectKey].addData(results.metaData); - results[objectKey].query = results.data.query; - results[objectKey].corpus_type = type; - results[objectKey].match_count += 1; - results[objectKey].cpos_ranges = payload.cpos_ranges; - results[objectKey].fullContext = true; - console.info('Results data has been saved.', results); - // Notify view to update progress bar - client.notifyView('results-data-recieving', {type: type, - progress: payload.progress}) - if (payload.progress === 100) { - client.isBusy = false; - if (objectKey === 'fullResultsData') { - // Get match count per text from results.data only for fullResultsData - results[objectKey].text_lookup = results.data.text_lookup; - } - client.notifyView('results-data-recieved', {type: type, - results: results, - fullContext: true}); - } -} - -// export callbacks -export { - prepareQueryData, - saveMetaData, - saveQueryData, - getResultsData, - saveResultsData, -}; \ No newline at end of file diff --git a/app/static/js/modules/corpus_analysis/client/listeners.js b/app/static/js/modules/corpus_analysis/client/listeners.js deleted file mode 100644 index 6549462e..00000000 --- a/app/static/js/modules/corpus_analysis/client/listeners.js +++ /dev/null @@ -1,201 +0,0 @@ -/** - * This file contains the listener functions which can be assigned to the - * coprus_analysis client. So that the incoming data/status informations will - * be handled. There are several listeners listening for socket .io events. - * Further below one javascript custom event listener is specified. This - * listener listens for javascript custom events which are being dispatched by - * the View (resultsList). - */ - -// Listeners for socket io events - -/** - * Recieves a corpus analysis connected signal via socket.io. - */ -function recieveConnected(type, client) { - client.socket.on(type, (response) => { - /** - * Check if request for session was OK. - * If OK execute registered callbacks and notify View. - */ - if (response.code === 200) { - console.group('Connected!') - console.info('corpus_analysis_init: Client recieving connected codes', - 'codes via socket.on'); - console.info(`corpus_analysis_init: ${response.code} - ${response.msg}`); - console.info('corpus_analysis_init: Initialization succeeded'); - console.info(response); - client.notifyView('connected'); - console.groupEnd(); - // get meta data immediately - client.getMetaData(); - } else { - let errorText = `Error ${response.code} - ${response.msg}`; - console.group('Connection failed!'); - console.error(`corpus_analysis_init: ${errorText}`); - client.notifyView('client-failed', { msg: errorText }, 'error'); - console.groupEnd(); - } - }); -} - -/** - * Recieves meta data from the server via socket.io. - */ -function recieveMetaData(type, client) { - client.socket.on(type, (response) => { - /** - * Check if request for session was OK. - * If OK execute registered callbacks and notify View. - */ - if (response.code === 200) { - console.group('Client recieving meta data') - console.info('corpus_analysis_meta_data: Client recieving meta data', - 'via socket.on'); - console.info(`corpus_analysis_meta_data: ${response.code} - ${response.msg}`); - console.info(response); - // executing the registered callbacks - client.eventListeners[type].executeCallbacks([response.payload]); - console.groupEnd(); - } else { - let errorText = `Error ${response.payload.code} - ${response.payload.msg}`; - console.group('Failed to recieve meta data.'); - console.error('corpus_analysis_meta_data: Client failed to recieve', - 'meta data via socket.on'); - console.error(`corpus_analysis_meta_data: ${errorText}`); - client.notifyView('client-failed', { msg: errorText }, 'error'); - console.groupEnd(); - } - }); -} - -/** - * Recieves the query process status before any actual results are being - * transmitted. So it recieves error codes if a query failed or - * was invalid etc. - * Also prepares the result.jsList for the incoming data. - */ -function recieveQueryStatus(type, client) { - /** - * Check if request for session was OK. - * If OK execute registered callbacks and notify View. - */ - client.socket.on(type, (response) => { - if (response.code === 200) { - console.group('corpus_analysis_query: Client recieving query process', - 'status via socket.on'); - console.info(`corpus_analysis_query: ${response.code} - ${response.msg}`); - console.info(response); - // executing the registered callbacks - client.eventListeners[type].executeCallbacks([response.payload]); - console.groupEnd(); - } else { - let errorText = `Error ${response.payload.code} - ${response.payload.msg}`; - console.group('corpus_analysis_query: Client failed recieving', - 'query process status via socket.on'); - if (response.payload.code == 1281) { - errorText += ' - Invalid Query'; - console.error(`corpus_analysis_query: ${errorText}`); - client.notifyView('client-failed', { msg: errorText }, 'error', false); - } else { - console.error(`corpus_analysis_query: ${errorText}`); - client.notifyView('client-failed', { msg: errorText }, 'error'); - } - console.groupEnd(); - } - }); -} - -/** - * Recieves the query data from the request and handles it. - */ -function recieveQueryData(type, client) { - /** - * Check if request for session was OK. - * If OK execute registered callbacks and notify View. - */ - client.socket.on(type, (response) => { - if (response.code === 200) { - console.group('corpus_analysis_query_results: Recieveing query data') - console.info('Client recieving query data via socket.on'); - console.info('Recieved chunk', response); - /** - * Execute registered callbacks and notify View. - */ - client.eventListeners[type].executeCallbacks([response.payload]); - console.info('Added chunk data to results.data.'); - console.groupEnd(); - } else { - let errorText = `Error ${response.payload.code} - ${response.payload.msg}`; - console.group('corpus_analysis_query_results: Client failed recieving', - 'the results via socket.on'); - console.error(`corpus_analysis_query: ${errorText}`); - client.notifyView('client-failed', { msg: errorText }, 'error'); - console.groupEnd(); - } - }); -} - -/** - * Recieves the data requested by the create Results or sub results button - */ -function recieveResultsData(type, client) { - client.socket.on(type, (response) => { - /** - * Check if request for session was OK. - * If OK execute registered callbacks and notify View. - */ - if (response.code === 200) { - console.group('Client recieving results data') - console.info('corpus_analysis_get_match_with_full_context: Client recieving results data', - 'via socket.on'); - console.info(`corpus_analysis_get_match_with_full_context: ${response.code} - ${response.msg}`); - console.info(response); - // executing the registered callbacks - client.eventListeners[type].executeCallbacks([response.payload, - response.type]); - console.groupEnd(); - } else { - let errorText = `Error ${response.payload.code} - ${response.payload.msg}`; - console.group('Failed to recieve results data.'); - console.error('corpus_analysis_get_match_with_full_context: Client failed to recieve', - 'results data via socket.on'); - console.error(`corpus_analysis_get_match_with_full_context: ${errorText}`); - client.notifyView('client-failed', { msg: errorText }, 'error'); - console.groupEnd(); - } - }); -} - -/* - * This is the javascript custom event listener, listening for events - * dispatched by the View. - */ -function recieveViewNotification(type, client) { - document.addEventListener(type, (event) => { - let caseIdentifier = event.detail.caseIdentifier; - switch(caseIdentifier) { - case 'get-results': - console.info('Client getting full results for export.'); - // execute callback or functions - client.eventListeners[type].executeCallback([event.detail.resultsType, - event.detail.dataIndexes, - event.detail.resultsList], - caseIdentifier); - break - default: - console.error('Recieved unkown notification case identifier from View'); - // do something to not crash the analysis session? - } - }); -} - -// export listeners from this module -export { - recieveConnected, - recieveMetaData, - recieveQueryStatus, - recieveQueryData, - recieveViewNotification, - recieveResultsData, -}; \ No newline at end of file diff --git a/app/static/js/modules/corpus_analysis/model/Results.js b/app/static/js/modules/corpus_analysis/model/Results.js deleted file mode 100644 index e2abd66e..00000000 --- a/app/static/js/modules/corpus_analysis/model/Results.js +++ /dev/null @@ -1,141 +0,0 @@ -/** - * These classes are implementing the data store of the corpus_analysis - * package. If we follow the idea of the Model View Controller Pattern these - * classes combined in the Results class define the Model. - */ - -// Results class bundleing the different data objects. -class Results { - constructor() { - this.data = new Data(); - this.metaData = new MetaData(); - this.fullResultsData = new Data(); - this.subResultsData = new Data(); - this.inspectResultsData = new Data(); - console.info('Initialized the Results object.'); - } - - // Reset all the data objects in the results class and thus emptying them. - init() { - this.data.init(); - this.metaData.init(); - this.fullResultsData.init(); - this.subResultsData.init(); - this.inspectResultsData.init(); - // Temporarly save match counts per text - this.tmp_match_counts = {}; - } - -} - -/** - * Class that defines the actual data objects holding the results data - * requested by the client. Data can be the results of a query, full results - * data for the export, sub results data for the export or inspect results data. - * All kinds are structured the same way. - */ -class Data { - /** - * Sets empty object structure. Also usefull to delete old results. - * MatchCount default is 0. - */ - init(matchCount=0, type="results") { - // List of all c with lc and rc CPOS. - this.matches = []; - /** - * CPOS lookup object. CPOS are the key and value are infos about the CPOS - * like lemma, ner, pos, text ID etc. CPOS from the matches correspond to - * exactly one object in the cpos_lookup. - */ - this.cpos_lookup = {}; - /** - * Same like above but for text IDs. One CPOS object always has a text ID - * referencing on text object in the text_lookup. Text ID is the key. Values - * are author, publishing year etc. - */ - this.text_lookup = {}; - this.match_count = matchCount; - this.corpus_type = 'results'; - this.cpos_ranges = null; - this.query = ''; - } - - /** - * Function to add json data/object data to this data instance. - * If no key is specified the entire data will be assigned to this data - * instance. - */ - addData(jsonData, key=null) { - if (key !== null) { - Object.assign(this[key], jsonData); - } else if (key === null) { - Object.assign(this, jsonData) - } - } - - // Get query as a string from the form Element. - getQueryStr(queryFormElement) { - // gets query - let queryFormData; - let queryStr; - queryFormData = new FormData(queryFormElement); - queryStr = queryFormData.get('query-form-query'); - this['query'] = queryStr; - } - - // Function creates a unique and safe filename for the download. - createDownloadFilename(suffix) { - let today = new Date(); - let currentDate = `${today.getUTCFullYear()}` + - `-${(today.getUTCMonth() + 1)}` + - `-${today.getUTCDate()}`; - let currentTime = `${today.getUTCHours()}h` + - `${today.getUTCMinutes()}m` + - `${today.getUTCSeconds()}s`; - let safeFilename = this.query.replace(/[^a-z0-9_-]/gi, "_"); - let resultFilename = `UTC-${currentDate}_${currentTime}_${safeFilename}_${suffix}`; - return resultFilename - } - /** - * Function to download data as Blob created from string. - * Should be private but that is not yet a feature of javascript 08.04.2020 - */ - download(downloadElement, dataStr, filename, type, filenameSlug) { - filename += filenameSlug; - let file = new Blob([dataStr], {type: type}); - var url = URL.createObjectURL(file); - downloadElement.href = url; - downloadElement.download = filename; - } - - // Function to download the results as JSON. - downloadJSONRessource(resultFilename, downloadData, downloadElement) { - /** - * Stringify JSON object for json download. - * Use tabs to save some space. - */ - let dataStr = JSON.stringify(downloadData, undefined, "\t"); - // Start actual download - this.download(downloadElement, dataStr, resultFilename, "text/json", ".json") - } - -} - -/** - * Similar to the data class but just intended for meta data about the current - * corpus the client is working with. - */ -class MetaData { - // Sets empty object structure when no input is given. - // if json object like input is given class fields are created from this - init(json={}) { - Object.assign(this, json); - } -} - -// Export the classes -export { - Results, - Data, - MetaData -}; \ No newline at end of file diff --git a/app/static/js/modules/corpus_analysis/view/ResultsView.js b/app/static/js/modules/corpus_analysis/view/ResultsView.js deleted file mode 100644 index 45c5ee17..00000000 --- a/app/static/js/modules/corpus_analysis/view/ResultsView.js +++ /dev/null @@ -1,837 +0,0 @@ -/** - * This class implements a ViewEventListener that is listening for the - * specified - */ -class ViewEventListener { - constructor(type, listenerFunction, args=[]) { - this.listenerFunction = listenerFunction; - this.type = type; - this.args = args; - } -} - -/** - * This class is implements a View which handles the reprensentation of the - * data that has been fetched by the Client of the corpus_analysis. This view - * only handles how the data is shown to the user. View extends the list.js - * List class. - */ -class ResultsList extends List { - /** - * If no options are given when a new instance of this class is created - * the options below are used. - */ - static options = { - page: 30, - pagination: [{ - name: "paginationTop", - paginationClass: "paginationTop", - innerWindow: 8, - outerWindow: 1 - }, { - paginationClass: "paginationBottom", - innerWindow: 8, - outerWindow: 1 - }], - valueNames: ["titles", "lc", "c", "rc", {data: ["index"]}], - item: `` - }; - constructor(idOrElement, options) { - super(idOrElement, options); - /** - * All span tokens which are holding events if expert - * mode is on. Collected here to delete later on. - */ - this.eventTokens = {}; - /** - * All token elements which have added classes like chip and hoverable for - * expert view. Collected here to delete later on. - */ - this.currentExpertTokenElements = {}; - /** - * Holds True/false for check buttons used to add matches to sub-results. - * If checked, it is True. If unchecked, it is false. Buttons for this - * have the class add. The ittle round check buttons to add matches to sub - * results. Key is match index. Value is true or false as mentioned above. - */ - this.subResultsIndexes = {}; - // ViewEventListeners listening for client notifications. - this.notificationListeners = {}; - this.knownHTMLElements = new Set(); - } - /** - * Function to clear/reset some class field values. Usefull if a new query - * hase been issued by the user. - */ - resetFields() { - this.subResultsIndexes = {}; - } - - - /** - * Function that takes one or more query selector - * strings in an array as an input. The function then creates a - * class field in the ResultsList object with the query selector - * string as the key. The selector will be converted to a valid JavaScript - * Field name i. e. #html-id-string -> this.htmlIdString - * The value will be the identifed element or elements fetched with the - * querySelector respectively querySelectorAll method. - * If the query selector is passed as an Array of length 2, with the second - * element defining modal options, teh identified element will be initialized - * as a modal with the given options. - */ - getHTMLElements(arrayOfSelectors) { - for (let selector of arrayOfSelectors) { - // Check if identified Element should be initialized as a modal. - let modalInit = false; - let options; - if (Array.isArray(selector)) { - options = selector[1]; - selector = selector[0]; - modalInit = true; - } - // Check if the current selector has already been used. - if (this.knownHTMLElements.has(selector)) { - continue; - } else { - // Get element or elements. - let element; - let elements; - if (selector.startsWith('#')) { - element = document.querySelector(selector); - } else { - elements = document.querySelectorAll(selector); - elements = [...elements]; - } - // Create valid javascript instance field name. - let cleanKey = []; - selector = selector.replace(/_/g, '-'); - selector.match(/\w+/g).forEach((word) => { - let tmp = word[0].toUpperCase() + word.slice(1); - cleanKey.push(tmp); - }); - cleanKey[0] = cleanKey[0].toLowerCase(); - cleanKey = cleanKey.join(''); - this[cleanKey] = element ? element: elements; - // Initialize current element as modal if modalInit true. - if (modalInit) { - this[cleanKey] = M.Modal.init(this[cleanKey], options); - } - } - // Add current selector to knwonHTMLElements. - this.knownHTMLElements.add(selector); - } - } - - /** - * Register ViewEventListeners to the ResultsList. Which will listen for - * the specified event. - */ - setViewEventListeners(notificationListeners) { - for (let notificationListener of notificationListeners) { - this.notificationListeners[notificationListener.type] = notificationListener; - } - } - - /** - * Loads the ViewEventListeners so that hey will be listening to their - * assigned custom events. - */ - loadViewEventListeners() { - for (let [type, listener] of Object.entries(this.notificationListeners)) { - if (listener.args.length > 0) { - listener.listenerFunction(...listener.args); - } else { - listener.listenerFunction(type, this); - } - } - } - - /** - * This functions sends events to the Client to trigger specific functions to - * trigger new data requests from the server. - */ - notifyClient(caseIdentifier, detailObject={}) { - detailObject.caseIdentifier = caseIdentifier; - const event = new CustomEvent('notify-client', { detail: detailObject }); - console.info('Client dispatching Notification:', caseIdentifier); - document.dispatchEvent(event); - } - - /** - * Creates cpos either from ranges or not. - */ - helperCreateCpos(cpos_values) { - let lc, c, rc; - /** - * Python range like function from MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/from#Sequence_generator_(range) - */ - const range = (start, stop, step) => Array.from({ length: (stop - start) / step + 1}, (_, i) => start + (i * step)); - lc = cpos_values.lc ? range(cpos_values.lc[0], cpos_values.lc[1], 1) : []; - c = range(cpos_values.c[0], cpos_values.c[1], 1); - rc = cpos_values.rc ? range(cpos_values.rc[0], cpos_values.rc[1], 1) : []; - return {lc: lc, c: c, rc: rc}; - } - - // Get display options from display options form element. - static getDisplayOptions(htmlId) { - // gets display options parameters - let displayOptionsFormElement = document.getElementById(htmlId); - let displayOptionsFormData = new FormData(displayOptionsFormElement); - let displayOptionsData = - { - "resultsPerPage": displayOptionsFormData.get("display-options-form-results_per_page"), - "resultsContex": displayOptionsFormData.get("display-options-form-result_context"), - "expertMode": displayOptionsFormData.get("display-options-form-expert_mode") - }; - return displayOptionsData - } - /** - * Used in addToSubResults and inspect to toggle the design of the check - * buttons according to its checked unchecked status. - */ - helperActivateAddBtn(btn) { - btn.classList.remove("corpus-analysis-color.lighten"); - btn.classList.add("green"); - btn.textContent = "check"; - } - - /** - * Used in addToSubResults and inspect to toggle the design of the check - * buttons according to its checked unchecked status. - */ - helperDeactivateAddBtn(btn) { - btn.classList.remove("green"); - btn.classList.add("corpus-analysis-color.lighten"); - btn.textContent = "add"; - } - /** - * This function is invoked when the users adds or removes a match using the - * add-btn (+ button/or green checkmark) to/from sub-results. When the button - * is clicked the function checks if the current dataIndex ID is already - * saved in subResultsIndexes or not. If it is not the dataIndex will be used - * as a key in subResultsIndexes with the value true. If it is already added - * the entry with the key dataIndex will be deleted from subResultsIndexes. - * Visual feedback (green checkmark if a match has been added etc.) is also - * handled on the basis of the information stored in subResultsIndexes. - */ - addToSubResults(dataIndex, client, tableCall=true) { - let toShowArray; - dataIndex = parseInt(dataIndex); - if (!this.subResultsIndexes[dataIndex] - || this.subResultsIndexes[dataIndex] === undefined) { - // add button is activated because status is false or undefined - this.helperActivateAddBtn(event.target); - this.subResultsIndexes[dataIndex] = true; - toShowArray = Object.keys(this.subResultsIndexes).map(index => parseInt(index)); - // Add 1 because indexes are zero based. User sees 1 based numbering. - toShowArray = toShowArray.map(index => index + 1); - // Allways sort the shown indexes for the user if new match is added. - toShowArray = toShowArray.sort(function(a, b){return a-b}); - this.subResultsIndexesDisplay.textContent = toShowArray.join(', '); - M.textareaAutoResize(this.subResultsIndexesDisplay); - this.nrMarkedMatches.textContent = Object.keys(this.subResultsIndexes).length; - } else if (this.subResultsIndexes[dataIndex]) { - // add button is deactivated because status is true - this.helperDeactivateAddBtn(event.target); - delete this.subResultsIndexes[dataIndex]; - toShowArray = Object.keys(this.subResultsIndexes).map(index => parseInt(index)); - // Add 1 because indexes are zero based. User sees 1 based numbering. - toShowArray = toShowArray.map(index => index + 1); - // Allways sort the shown indexes for the user if new match is added. - toShowArray = toShowArray.sort(function(a, b){return a-b}); - this.subResultsIndexesDisplay.textContent = toShowArray.join(', '); - this.nrMarkedMatches.textContent = Object.keys(this.subResultsIndexes).length; - M.textareaAutoResize(this.subResultsIndexesDisplay); - } - // Toggles create button according to the number of ids in addToSubResultsIdsToShow - if (Object.keys(this.subResultsIndexes).length > 0 && !client.isBusy) { - this.subResultsCreate.classList.toggle('disabled', false); - } else if (Object.keys(this.subResultsIndexes).length === 0) { - this.subResultsCreate.classList.toggle('disabled', true); - } - /** - * After a match as been added or removed the export button will be - * hidden because the sub-results have been altered and have to be built - * again. Thus subResultsCreateElement has to be shown again. - */ - this.subResultsExport.classList.add("hide"); - this.subResultsCreate.classList.remove("hide"); - /** - * Also activate/deactivate buttons in the table/resultsList accordingly - * if button in inspect was activated/deactivated. - * This part only runs if tableCall is set to false when this function is - * called. - */ - if (!tableCall) { - this.getHTMLElements(['#query-results-table']); - let container = this.queryResultsTable.querySelector(`[data-index="${dataIndex}"]`); - let tableAddBtn = container.querySelector('.add-btn'); // gets the add button from the list view - if (this.subResultsIndexes[dataIndex]) { - this.helperActivateAddBtn(tableAddBtn); - } else { - this.helperDeactivateAddBtn(tableAddBtn); - } - } - } - - // Toggle inspect buttons depending on the Client status - toggleInspectButtons(client) { - if (!client.isBusy) { - this.activateInspectButtons(); - } else if (client.isBusy) { - this.deactivateInspectButtons(); - } - } - - // Helper function. Should be private if feature is available. - activateInspectButtons() { - let inspectBtnElements; - inspectBtnElements = document.querySelectorAll('.inspect'); - for (let inspectBtn of inspectBtnElements) { - inspectBtn.classList.toggle('disabled', false); - } - } - - // Helper function. Should be private if feature is available. - deactivateInspectButtons() { - let inspectBtnElements; - inspectBtnElements = document.querySelectorAll('.inspect'); - for (let inspectBtn of inspectBtnElements) { - inspectBtn.classList.toggle('disabled', true); - } - } - /** - * Function to inspect one match in more detail (Showing more context). - * If in dynamic mode the view notifies the client to requests the new - * context for the one match identified by the given dataIndex. - * If not in dynamic mode the the needed context will be gathered from the - * already present results in results.data. - */ - inspect(client, results, dataIndex, type) { - // initialize context modal - this.getHTMLElements([ - ['#context-modal', true], - '#context-results', - '#create-inspect-menu', - '#create-from-inspect', - ]); - // Clear fields from old data on every new inspect() call. - this.contextId = dataIndex[0]; - this.contextResults.innerHTML = ''; - // Open modal. - this.contextModal.open(); - this.contextResults.insertAdjacentHTML('afterbegin', ` -
    -
    -
    - `); - if (client.dynamicMode) { - // Notify Client to get results from server. - this.notifyClient('get-results', {resultsType: 'inspect-results', - dataIndexes: dataIndex, - resultsList: this}); - } else { - // Gather results data from already present data. - results.inspectResultsData.matches = [results.data.matches[dataIndex[0]]]; - results.inspectResultsData.cpos_ranges = results.data.cpos_ranges; - this.showMatchContext(results, client) - } - // Match nr for user to display derived from data_index. - let contextMatchNrElement = document.getElementById("context-match-nr"); - contextMatchNrElement.textContent = this.contextId + 1; - // Add the add button to add this match to sub results with onclick event. - let classes = `btn-floating btn waves-effect` + - ` waves-light corpus-analysis-color.lighten right` - let addToSubResultsIdsBtn = document.createElement("a"); - addToSubResultsIdsBtn.setAttribute("class", classes + ` add`); - addToSubResultsIdsBtn.innerHTML = 'add'; - addToSubResultsIdsBtn.onclick= () => { - this.addToSubResults(dataIndex[0], client, false) - }; - /** - * Checks if the match has or has not been added to sub results yet. - * Sets the color and status of the button accordingly. - */ - if (this.subResultsIndexes[dataIndex[0]]) { - this.helperActivateAddBtn(addToSubResultsIdsBtn.firstElementChild); - } else if (!this.subResultsIndexes[dataIndex[0]]) { - this.helperDeactivateAddBtn(addToSubResultsIdsBtn.firstElementChild); - } - this.createInspectMenu.innerHTML = ''; - this.createInspectMenu.appendChild(addToSubResultsIdsBtn); - // Hide create menu if not in dynamic mode. - if (!client.dynamicMode) { - this.createFromInspect.classList.add('hide'); - } - } - /** - * Create Element from HTML String. Helper function should be private. - * https://stackoverflow.com/questions/494143/creating-a-new-dom-element-from-an-html-string-using-built-in-dom-methods-or-pro/35385518#35385518 - */ - HTMLTStrToElement(htmlStr) { - let template = document.createElement("template"); - htmlStr = htmlStr.trim(); - template.innerHTML = htmlStr; - return template.content.firstChild; - } - /** - * Used either as a callback if the client has been notified to get new - * results with new full context. Or just directly invoced as a function - * with the according input data. - */ - showMatchContext(results, client) { - this.getHTMLElements([ - '#context-results', - '#inspect-display-options-form-expert_mode_inspect', - '#inspect-display-options-form-highlight_sentences', - '#context-sentences' - ]) - let uniqueS = new Set(); - let uniqueContextS = new Set(); - let {lc, c, rc} = this.helperCreateCpos(results.inspectResultsData.matches[0]); - // Create sentence strings as tokens. - let tokenHTMLArray = []; - let htmlTokenStr = ``; - let tokenHTMlElement; - let token; - for (let cpos of lc) { - if (client.dynamicMode) { - token = results.inspectResultsData.cpos_lookup[cpos]; - // If client is not in dynamic mode use cpos_lookup from results.data - } else { - token = results.data.cpos_lookup[cpos]; - } - uniqueS.add(token.s) - htmlTokenStr = `` + - `${token.word}` + - ``; - tokenHTMlElement = this.HTMLTStrToElement(htmlTokenStr) - tokenHTMLArray.push(tokenHTMlElement); - } - for (let cpos of c) { - if (client.dynamicMode) { - token = results.inspectResultsData.cpos_lookup[cpos]; - // If client is not in dynamic mode use cpos_lookup from results.data - } else { - token = results.data.cpos_lookup[cpos]; - } - uniqueContextS.add(token.s); - uniqueS.add(token.s); - htmlTokenStr = `` + - `${token.word}` + - ``; - tokenHTMlElement = this.HTMLTStrToElement(htmlTokenStr) - tokenHTMLArray.push(tokenHTMlElement); - } - results.inspectResultsData["context_s_ids"] = Array.from(uniqueContextS); - for (let cpos of rc) { - if (client.dynamicMode) { - token = results.inspectResultsData.cpos_lookup[cpos]; - // If client is not in dynamic mode use cpos_lookup from results.data - } else { - token = results.data.cpos_lookup[cpos]; - } - uniqueS.add(token.s) - htmlTokenStr = `` + - `${token.word}` + - ``; - tokenHTMlElement = this.HTMLTStrToElement(htmlTokenStr) - tokenHTMLArray.push(tokenHTMlElement); - } - // Remove loading indeterminate HTML before context is inserted. - this.contextResults.innerHTML = ''; - for (let sId of uniqueS) { - let htmlSentence = ``; - let sentenceElement = this.HTMLTStrToElement(htmlSentence); - for (let tokenElement of tokenHTMLArray) { - if (tokenElement.dataset.sid == sId) { - sentenceElement.appendChild(tokenElement); - sentenceElement.insertAdjacentHTML("beforeend", ` `); - } else { - continue; - } - } - this.contextResults.appendChild(sentenceElement); - } - // Add expert mode switch event for the modal to toggle expert mode. - this.inspectDisplayOptionsFormExpertModeInspect.onchange = (event) => { - if (event.target.checked) { - this.expertModeOn("context-results", results); - } else { - this.expertModeOff("context-results") - } - }; - // Add switch event to toggle Sentence highlighting. - this.inspectDisplayOptionsFormHighlightSentences.onchange = (event) => { - if (event.target.checked) { - this.higlightContextSentences(); - } else { - this.unhighlightContextSentences(); - } - }; - // Add range event to change nr of context sentences. - this.contextSentences.onchange = (event) => { - this.changeSentenceContext(event.target.value); - } - /** - * Checks on new modal opening if switches are checked - * if switches are checked functions are executed. - */ - if (this.inspectDisplayOptionsFormExpertModeInspect.checked) { - this.expertModeOn("context-results", results); - } - if (this.inspectDisplayOptionsFormHighlightSentences.checked) { - this.higlightContextSentences(); - } - /** - * Checks the value of the number of sentences to show on modal opening - * sets context sentences accordingly - */ - this.changeSentenceContext(this.contextSentences.value); - } - - // Splits context text into sentences based on spacy sentence split - higlightContextSentences() { - let sentences = document.getElementById("context-results").getElementsByClassName("sentence"); - for (let s of sentences) { - s.insertAdjacentHTML("beforeend", `

    `) - } - } - // Reverse operation of above function. - unhighlightContextSentences() { - let sentences = document.getElementById("context-results").getElementsByClassName("sentence"); - let br; - for (let s of sentences) { - br = s.lastChild; - br.remove(); - } - } - - // Changes how many context sentences in inspect view are shown. - changeSentenceContext(sValue, maxSValue=10) { - sValue = maxSValue - sValue; - // console.log(sValue); - let sentences = document.getElementById("context-results").getElementsByClassName("sentence"); - let array = Array.from(sentences); - let toHideArray; - let toShowArray; - if (sValue != 0) { - toHideArray = array.slice(0, sValue).concat(array.slice(-(sValue))); - toShowArray = array.slice(sValue, 9).concat(array.slice(9, -(sValue))) - } else { - toHideArray = []; - toShowArray = array; - } - for (let s of toHideArray) { - s.classList.add("hide"); - } - for (let s of toShowArray) { - s.classList.remove("hide"); - } - } - - // ###### Display options functions changing how results are being displayed ###### - - /** - * Event function that changes the shown hits per page. - * Just alters the resultsList.page property. - */ - changeHitsPerPage(client, results) { - this.page = this.displayOptionsFormResultsPerPage.value; - this.update(); - this.changeContext(); - this.toggleInspectButtons(client); - if (this.displayOptionsFormExpertMode.checked) { - this.expertModeOn('query-display', results); - } - } - /** - * Event function triggered on context select change also if pagination is - * clicked. - */ - changeContext() { - let newContextValue = this.displayOptionsFormResultContext.value; - let lc = document.querySelectorAll(".left-context"); - let rc = document.querySelectorAll(".right-context"); - for (let element of lc) { - let arrayLc = Array.from(element.childNodes); - for (let element of arrayLc.reverse().slice(newContextValue)) { - element.classList.add("hide"); - } - for (let element of arrayLc.slice(0, newContextValue)) { - element.classList.remove("hide"); - } - } - for (let element of rc) { - let arrayRc = Array.from(element.childNodes); - for (let element of arrayRc.slice(newContextValue)) { - element.classList.add("hide"); - } - for (let element of arrayRc.slice(0, newContextValue)) { - element.classList.remove("hide"); - } - } - } - - // ###### Expert view event functions ###### - - // Function to create a tooltip for the current hovered token. - tooltipEventCreate(event, results) { - let token = results.data.cpos_lookup[event.target.dataset.cpos]; - if (!token) { - token = results.inspectResultsData.cpos_lookup[event.target.dataset.cpos]; - } - this.currentTooltipElement = M.Tooltip.init(event.target, { - 'html': ` - - - - - - - - -
    Token informationSource information
    - Word: ${token.word}
    - Lemma: ${token.lemma}
    - POS: ${token.pos}
    - Simple POS: ${token.simple_pos}
    - NER: ${token.ner} -
    - Title: ${results.data.text_lookup[token.text].title} -
    - Author: ${results.data.text_lookup[token.text].author} -
    - Publishing year: ${results.data.text_lookup[token.text].publishing_year} -
    ` - } - ); - } - /** - * Function to destroy the current Tooltip for the current hovered tooltip - * on mouse leave - */ - tooltipEventDestroy(event) { - this.currentTooltipElement.destroy(); - } - - /** - * Turn the expert mode on for all tokens in the DOM element identified by - * its htmlID. - */ - expertModeOn(htmlId, results) { - if (!Array.isArray(this.currentExpertTokenElements[htmlId])) { - this.currentExpertTokenElements[htmlId] = []; - } - let container = document.getElementById(htmlId); - let tokens = container.querySelectorAll('span.token'); - this.currentExpertTokenElements[htmlId].push(...tokens); - this.eventTokens[htmlId] = []; - for (let tokenElement of this.currentExpertTokenElements[htmlId]) { - tokenElement.classList.add('chip', 'hoverable', 'expert-view'); - const eventCreate = (event, arg) => this.tooltipEventCreate(event, arg); - tokenElement.onmouseover = (event) => eventCreate(event, results); - tokenElement.onmouseout = (event) => this.tooltipEventDestroy(event); - this.eventTokens[htmlId].push(tokenElement); - } - } - - /** - * Turn the expert mode off for all tokens in the DOM element identified by - * its htmlID. - */ - expertModeOff(htmlId) { - if (!Array.isArray(this.currentExpertTokenElements[htmlId])) { - this.currentExpertTokenElements[htmlId] = []; - } - if (!Array.isArray(this.eventTokens[htmlId])) { - this.eventTokens[htmlId] = []; - } - for (let tokenElement of this.currentExpertTokenElements[htmlId]) { - tokenElement.classList.remove("chip", "hoverable", "expert-view"); - } - this.currentExpertTokenElements[htmlId] = []; - - for (let eventToken of this.eventTokens[htmlId]) { - eventToken.onmouseover = ''; - eventToken.onmouseout = ''; - } - this.eventTokens[htmlId] = []; - } - - createResultRowElement(item, chunk, client, imported=false) { - // Gather values from item. - let values = item.values(); - let {lc, c, rc} = this.helperCreateCpos(values) - // Get infos for full match row. - let matchRowElement = document.createElement("tr"); - matchRowElement.setAttribute("data-index", values.index) - let lcCellElement = document.createElement("td"); - lcCellElement.classList.add("left-context"); - matchRowElement.appendChild(lcCellElement); - for (let cpos of lc) { - let token = chunk.cpos_lookup[cpos]; - lcCellElement.insertAdjacentHTML("beforeend", - `${token.word} `); - } - - // Get infos for hit of match and set actions. - let textTitles = new Set(); - let aCellElement = document.createElement("td"); - aCellElement.classList.add("actions"); - let cCellElement = document.createElement("td"); - cCellElement.classList.add("match-hit"); - let textTitlesCellElement = document.createElement("td"); - textTitlesCellElement.classList.add("titles"); - let matchNrElement = document.createElement("td"); - matchNrElement.classList.add("match-nr"); - matchRowElement.appendChild(cCellElement); - matchRowElement.appendChild(aCellElement); - for (let cpos of c) { - let token = chunk.cpos_lookup[cpos]; - cCellElement.insertAdjacentHTML("beforeend", - `${token.word} `); - // Get text titles of every hit cpos token. - textTitles.add(chunk.text_lookup[token.text].title); - } - // Add some interaction buttons. - let css = `margin-right: 5px; margin-bottom: 5px;` - let classes = `btn-floating btn waves-effect` + - ` waves-light corpus-analysis-color.lighten` - // Add inspect button to trigger inspect view with more context. - let inspectBtn = document.createElement("a"); - inspectBtn.setAttribute("style", css); - inspectBtn.setAttribute("class", classes + ` disabled inspect` - ); - inspectBtn.innerHTML = 'search'; - // Add btn to be able add matches to sub-results. - let addToSubResultsBtn = document.createElement("a"); - addToSubResultsBtn.setAttribute("style", css); - addToSubResultsBtn.setAttribute("class", classes + ` add`); - addToSubResultsBtn.innerHTML = 'add'; - if (client.dynamicMode || client.fullContext) { - aCellElement.appendChild(inspectBtn); - } - if (client.dynamicMode) { - aCellElement.appendChild(addToSubResultsBtn); - } - // Add text titles at front as first td of one row. - textTitlesCellElement.textContent = [...textTitles].join(", "); - matchRowElement.insertAdjacentHTML("afterbegin", textTitlesCellElement.outerHTML); - matchNrElement.textContent = values.index + 1; - matchRowElement.insertAdjacentHTML("afterbegin", matchNrElement.outerHTML); - - // Get infos for right context of match - let rcCellElement = document.createElement("td"); - rcCellElement.classList.add("right-context"); - matchRowElement.appendChild(rcCellElement); - for (let cpos of rc) { - let token = chunk.cpos_lookup[cpos]; - rcCellElement.insertAdjacentHTML("beforeend", - `${token.word} `); - } - return matchRowElement - } - /** - * Creates the HTML table code for the metadata view in the corpus analysis - * interface - */ - createMetaDataForModal(metaDataObject) { - let html = `
    - - - - - - - - ` - for (let [outerKey, outerValue] of Object.entries(metaDataObject)) { - // Use more descriptive names. - if (outerKey === 'corpus_all_texts') { - let tmpName = 'All texts in this corpus'; - html += ` - ` - } else if (outerKey === 'text_lookup') { - let tmpName = 'Texts where the query resulted in matches' - html += ` - ` - } else { - html += ` - ` - } - if (outerKey === "corpus_all_texts" || outerKey === "text_lookup") { - html += `` - } else { - html += `` - } - html += `` - } - html += ` -
    Meta Data DescriptionValue
    ${tmpName.replace(/_/g, " ")} -
    ${tmpName.replace(/_/g, " ")} -
    ${outerKey.replace(/_/g, " ")} - -
      ` - for (let [innerKey, innerValue] of Object.entries(outerValue)) { - html += `` - } - html += `
    -
    ${outerValue}
    ` - return html - } - /** - * Creates the text details for the texts shown in the corpus analysis - * metadata modal table. - */ - createTextDetails(metaData) { - let metadataKey = event.target.dataset.metadataKey; - let textKey = event.target.dataset.textKey; - let textData = metaData[metadataKey][textKey]; - let bibliographicData = document.querySelector(`#bibliographic-data-${metadataKey}-${textKey}`); - bibliographicData.textContent = ''; - for (let [key, value] of Object.entries(textData)) { - bibliographicData.insertAdjacentHTML("afterbegin", - ` -
  • - ${key}: - ${value} -
  • - ` - ); - } - } -}; - -// Export classes. -export { - ViewEventListener, - ResultsList -}; diff --git a/app/static/js/modules/corpus_analysis/view/callbacks.js b/app/static/js/modules/corpus_analysis/view/callbacks.js deleted file mode 100644 index 610e1d5f..00000000 --- a/app/static/js/modules/corpus_analysis/view/callbacks.js +++ /dev/null @@ -1,244 +0,0 @@ -/** - * This file contains all the callbacks triggered by the notificationListener. - * Also general callbacks are defined which are doing some hiding/disabling and - * showing/enabling of common elements when data is being transmitted or not. - */ - -// Callback to disable some elements for the user when the client is busy. -function disableElementsGeneralCallback(resultsList, detail) { - if (detail.client.isBusy) { - resultsList.fullResultsCreate.classList.toggle('disabled', true); - resultsList.subResultsCreate.classList.toggle('disabled', true); - resultsList.toggleInspectButtons(detail.client); - } -} - -// Callback to enable some elements for the user when the client is not busy. -function enableElementsGeneralCallback(resultsList, detail) { - if (!detail.client.isBusy) { - resultsList.fullResultsCreate.classList.toggle('disabled', false); - if (Object.keys(resultsList.subResultsIndexes).length > 0) { - resultsList.subResultsCreate.classList.toggle('disabled', false); - } - resultsList.toggleInspectButtons(detail.client); - } -} - - /** - * Callback opening the loading modal when the client is connecting to the - * CQP server. - */ -function connectingCallback(resultsList, detail) { - resultsList.getHTMLElements(['#analysis-init-modal']); - resultsList.analysisInitModal = M.Modal.init(resultsList.analysisInitModal, - {dismissible: false}); - resultsList.analysisInitModal.open(); -} - -// Callback that closes the loading modal from above. -function connectedCallback(resultsList, detail) { - /** - * In the past this closed the init modal. But the init modal is now being - * closed when the meta data has also been recieved. See below. - */ -} - -// Callback that closes the loading modal from above. -function metaDataRecievedCallback(resultsList, detail) { - resultsList.analysisInitModal.close(); -} - -// Callback that shows the user some feedback if the client raised an error. -function clientFailedCallback(resultsList, detail) { - resultsList.getHTMLElements([ - '#analysis-init-progress', - '#analysis-init-error', - '#user-feedback', - ]); - if (detail.raiseModalFeedback) { - resultsList.analysisInitModal.open(); - resultsList.analysisInitProgress.classList.toggle('hide'); - resultsList.analysisInitError.classList.toggle('hide'); - resultsList.analysisInitError.textContent = detail.msg; - } else { - nopaque.appClient.flash(detail.msg, 'error') - } -} - -// Callback doing some preperation work if a query has been issued by the user. -function queryDataPreparingCallback(resultsList, detail) { - // remove all items from resultsList, like from the query issued before - resultsList.clear() - // get needed HTML Elements - let results = detail.results; - resultsList.getHTMLElements([ - '#interactions-menu', - '#recieved-match-count', - '#total-match-count', - '#text-lookup-titles', - '#text-lookup-count', - '#query-results-user-feedback', - '#query-progress-bar', - '#query-results-create', - '#sub-results-indexes-display', - '#nr-marked-matches', - ]); - // show or enable some things for the user - resultsList.interactionsMenu.classList.toggle('hide', false); - resultsList.queryResultsUserFeedback.classList.toggle('hide', false); - resultsList.queryProgressBar.classList.toggle('hide', false); - resultsList.showCorpusFiles.classList.toggle('disabled', true); - /** - * Set some initial values for the user feedback - * or reset values for new issued query - */ - resultsList.recievedMatchCount.textContent = 0; - resultsList.totalMatchCount.textContent = results.data.match_count; - resultsList.textLookupCount.textContent = 0; - resultsList.nrMarkedMatches.textContent = 0; - resultsList.subResultsIndexesDisplay.textContent = ''; - resultsList.resetFields(); -} - -/** - * Callback handling the incoming results of an issued query. It renders - * the incoming matches using the resultsList for the user. - */ -function queryDataRecievingCallback(resultsList, detail) { - // load the data into the resultsList and show them to the user - let results = detail.results; - let client = detail.client; - let start = detail.dataLength; - let resultItems = []; - for (let [index, match] of Object.entries(results.data.matches).slice(start)) { - resultItems.push({ ...match, ...{ 'index': parseInt(index) } }); - } - if (client.dynamicMode) { - resultsList.add(resultItems, (items) => { - for (let item of items) { - item.elm = resultsList.createResultRowElement(item, - results.data, - client); - } - }); - // update user feedback about query status - resultsList.recievedMatchCount.textContent = results.data.matches.length; - resultsList.queryProgressBar.firstElementChild.style.width = `${client.requestQueryProgress}%`; - resultsList.textLookupCount.textContent = `${Object.keys(results.data.text_lookup).length}`; - // updating table on finished item creation callback via createResultRowElement - resultsList.update(); - resultsList.changeHitsPerPage(client, results); - resultsList.changeContext(); - //activate expertMode of switch is checked - if (resultsList.displayOptionsFormExpertMode.checked) { - resultsList.expertModeOn('query-display', results); - } - } else if (!client.dynamicMode) { - resultsList.add(resultItems, (items) => { - for (let item of items) { - item.elm = resultsList.createResultRowElement(item, - results.data, - client, - true); - } - }); - // update user feedback about query status - resultsList.recievedMatchCount.textContent = results.data.matches.length; - resultsList.queryProgressBar.firstElementChild.style.width = `${client.requestQueryProgress}%`; - resultsList.textLookupCount.textContent = `${Object.keys(results.data.text_lookup).length}`; - // updating table on finished item creation callback via createResultRowElement - resultsList.update(); - resultsList.changeHitsPerPage(client, results); - resultsList.changeContext(); - } -} - -// Callback that is executed when all results from an issued query have been recieved -function queryDataRecievedCallback(resultsList, detail) { - // hide or disable some things for the user - resultsList.queryResultsUserFeedback.classList.toggle('hide', true); - resultsList.queryProgressBar.classList.toggle('hide', true); - // reset bar progress for next query - resultsList.queryProgressBar.firstElementChild.style.width = '0%'; - resultsList.showCorpusFiles.classList.toggle('disabled', false); -} - -/** - * Callback that is handling incoming results data. Results data is needed for - * the export and download of the data. - */ -function resultsDataRecievingCallback(resultsList, detail) { - resultsList.getHTMLElements([ - '#full-results-progress-bar', - '#sub-results-progress-bar', - ]); - // Disable the full context switch when results are being recieved. - resultsList.exportFullInspectContext.setAttribute('disabled', ''); - if (detail.type === 'full-results' && detail.progress) { - resultsList.fullResultsProgressBar.firstElementChild.style.width = `${detail.progress}%`; - resultsList.fullResultsProgressBar.classList.toggle('hide', false); - } else if (detail.type === 'sub-results' && detail.progress) { - resultsList.subResultsProgressBar.firstElementChild.style.width = `${detail.progress}%`; - resultsList.subResultsProgressBar.classList.toggle('hide', false); - } -} -/** - * Callback is executed when all results data has been recieved. - * Reactivates the resutls create buttons etc. - */ -function resultsDataRecievedCallback(resultsList, detail) { - // create strings for create buttons depending on type - const handleType = (keyPrefix, text) => { - // Enable the full context switch when results have been recieved - resultsList.exportFullInspectContext.removeAttribute('disabled', ''); - // hides the create element after results have been recieved and reset it - resultsList[`${keyPrefix}Create`].classList.toggle('hide'); - resultsList[`${keyPrefix}Create`].textContent = `Create ${text}`; - resultsList[`${keyPrefix}Create`].insertAdjacentHTML('beforeend', - `build`); - // show and highlight export button - resultsList[`${keyPrefix}Export`].classList.toggle('hide', false); - resultsList[`${keyPrefix}Export`].classList.toggle('pulse', true); - setTimeout(() => { - resultsList[`${keyPrefix}Export`].classList.toggle('pulse', false); - clearTimeout(); - }, 3000) - } - if (detail.type === 'full-results') { - handleType('fullResults', 'Results'); - if (detail.fullContext) { - resultsList.fullResultsProgressBar.firstElementChild.style.width = `0%`; - resultsList.fullResultsProgressBar.classList.toggle('hide', true); - } - } else if (detail.type ==='sub-results') { - handleType('subResults', 'Sub-Results'); - if (detail.fullContext) { - resultsList.subResultsProgressBar.firstElementChild.style.width = `0%`; - resultsList.subResultsProgressBar.classList.toggle('hide', true); - } - } else if (detail.type ==='inspect-results') { - if (Object.keys(resultsList.subResultsIndexes).length === 0) { - /** - * Prevent create sub results button from being activated if it is disabled - * and no matches have been marked by the user for sub results creation. - */ - resultsList.subResultsCreate.classList.toggle('disabled', true); - } - resultsList.showMatchContext(detail.results, detail.client); - } -} - -// export the callbacks -export { - connectingCallback, - connectedCallback, - metaDataRecievedCallback, - clientFailedCallback, - queryDataPreparingCallback, - queryDataRecievingCallback, - queryDataRecievedCallback, - resultsDataRecievingCallback, - resultsDataRecievedCallback, - disableElementsGeneralCallback, - enableElementsGeneralCallback, -}; diff --git a/app/static/js/modules/corpus_analysis/view/listeners.js b/app/static/js/modules/corpus_analysis/view/listeners.js deleted file mode 100644 index a7c6c675..00000000 --- a/app/static/js/modules/corpus_analysis/view/listeners.js +++ /dev/null @@ -1,378 +0,0 @@ -/** - * 1.) - * This file contains the listener function that will be assigned to the - * corpus_analysis ResultsView. The listener is listening for the notification - * event which is being dispatched by the corpus_analysis Client. The - * notification Event triggers the listener which will call different - * callback functions depending on the detail information of the notification - * event. - * 2.) - * This file also contains vanilla javascript Event listeners which are - * listening for button clicks etc. the user is doing for page interaction. - * They will be registered the same way as teh listeners above. - */ - -import { - connectingCallback, - connectedCallback, - metaDataRecievedCallback, - clientFailedCallback, - queryDataPreparingCallback, - queryDataRecievingCallback, - queryDataRecievedCallback, - resultsDataRecievingCallback, - resultsDataRecievedCallback, - disableElementsGeneralCallback, - enableElementsGeneralCallback, -} from './callbacks.js'; -// Import the script that implements a spinner animation for buttons. -import { - loadingSpinnerHTML, -} from './spinner.js'; - - -/** - * The Listener listening for the notification event 'notify-view' dispatched - * by the client and execeutes callbacks accordingly. - */ -function recieveClientNotification(eventType, resultsList) { - document.addEventListener(eventType, (event) => { - let caseIdentifier = event.detail.caseIdentifier; - switch (caseIdentifier) { - case 'client-failed': - console.error('View recieved notification:', caseIdentifier); - // execute callbacks - clientFailedCallback(resultsList, event.detail); - break; - case 'connecting': - console.info('View recieved notification:', caseIdentifier); - connectingCallback(resultsList, event.detail); - // execute callbacks - break; - case 'connected': - console.info('View recieved notification:', caseIdentifier); - connectedCallback(resultsList, event.detail); - break; - case 'meta-data-recieving': - console.info('View recieved notification:', caseIdentifier); - break; - case 'meta-data-recieved': - console.info('View recieved notification:', caseIdentifier); - // execute - metaDataRecievedCallback(resultsList, event.detail); - break; - case 'query-data-prepareing': - console.info('View recieved notification:', caseIdentifier); - // Hide all download buttons - resultsList.fullResultsExport.classList.toggle('hide', true); - resultsList.subResultsExport.classList.toggle('hide', true); - // Show all create buttons - resultsList.fullResultsCreate.classList.toggle('hide', false); - resultsList.subResultsCreate.classList.toggle('hide', false); - // execute callbacks - disableElementsGeneralCallback(resultsList, event.detail); - queryDataPreparingCallback(resultsList, event.detail); - break; - case 'query-data-recieving': - console.info('View recieved notification:', caseIdentifier); - // execute callbacks - queryDataRecievingCallback(resultsList, event.detail); - break; - case 'query-data-recieved': - console.info('View recieved notification:', caseIdentifier); - // execute callbacks - queryDataRecievedCallback(resultsList, event.detail); - enableElementsGeneralCallback(resultsList, event.detail); - // create sub-results is disabled per default until matches have been added - resultsList.subResultsCreate.classList.toggle('disabled', true); - break; - case 'results-data-recieving': - console.info('View recieved notification:', caseIdentifier); - // execute callbacks - disableElementsGeneralCallback(resultsList, event.detail); - resultsDataRecievingCallback(resultsList, event.detail); - break; - case 'results-data-recieved': - console.info('View recieved notification:', caseIdentifier); - // execute callbacks - console.info(event.detail); - resultsDataRecievedCallback(resultsList, event.detail); - enableElementsGeneralCallback(resultsList, event.detail); - break; - default: - console.error('Recieved unkown notification case identifier from Client'); - // do something to not crash the analysis session? - } - }); -} - -/** - * This are some vanilla javascript Event listeners which are listening - * for button clicks etc. the user is doing to interact with the page. - * They will be registered the same way as the listeners above. - */ - -/** - * The following listener handles what functions are called when the user - * does use the page navigation to navigate to a new page. - */ -function pageNavigation(resultsList, results, client) { - for (let element of resultsList.pagination) { - element.addEventListener("click", (event) => { - // Shows match context according to the user picked value on a new page. - resultsList.changeContext(); - // De- or activates expertMode on new page depending on switch value. - if (resultsList.displayOptionsFormExpertMode.checked) { - resultsList.expertModeOn('query-display', results); - } else { - resultsList.expertModeOff('query-display'); - } - // Activates inspect buttons on new page if client is not busy. - resultsList.toggleInspectButtons(client); - }); - } -} - -/** - * The following event Listener handles the expert mode switch for the list. - */ -function expertModeSwitch(resultsList, results) { - resultsList.displayOptionsFormExpertMode.onchange = (event) => { - if (event.target.checked) { - resultsList.expertModeOn('query-display', results); - } else { - resultsList.expertModeOff('query-display'); - } - }; -} - -/** - * The following event Listener handles the add-btn and the inspect-btn - * onclick events via bubbleing. - */ -function actionButtons(resultsList, results, client) { - resultsList.queryResultsTable.addEventListener('click', (event) => { - let dataIndex; - if (event.target.classList.contains('inspect-btn')) { - dataIndex = parseInt(event.target.closest('tr').dataset.index); - resultsList.inspect(client, results, [dataIndex], 'inspect'); - } else if (event.target.classList.contains('add-btn')) { - dataIndex = parseInt(event.target.closest('tr').dataset.index); - resultsList.addToSubResults(dataIndex, client); - } - }) -} - -/** - * Following event listeners handle the change of Context size per match and - * the number of matches shown per page. - */ -function displayOptions(resultsList, results, client) { - resultsList.displayOptionsFormResultsPerPage.onchange = (event) => { - resultsList.changeHitsPerPage(client, results); - }; - resultsList.displayOptionsFormResultContext.onchange = (event) => { - resultsList.changeContext(); - }; -} - -/** - * The following event listener handles the show metadata button and its - * functionality. - */ -function showMetaData(resultsList, results) { - resultsList.showMetaData.onclick = () => { - resultsList.metaDataModalContent.textContent = ''; - let table = resultsList.createMetaDataForModal(results.metaData); - resultsList.metaDataModalContent.insertAdjacentHTML('afterbegin', table); - resultsList.metaDataModal.open(); - let collapsibles = resultsList.metaDataModalContent.querySelectorAll(".text-metadata"); - for (let collapsible of collapsibles) { - collapsible.onclick = () => { - let elems = resultsList.metaDataModalContent.querySelectorAll('.collapsible'); - let instances = M.Collapsible.init(elems, {accordion: false}); - resultsList.createTextDetails(results.metaData); - } - } - }; -} - -/** - * The following event listener handles the button showing infos about matches - * and their corresponding corpus files - */ - -function showCorpusFiles(resultsList, results) { - resultsList.showCorpusFiles.onclick = () => { - resultsList.showCorpusFilesModalContent.innerHTML = ''; - let htmlString = ` -
    -
      - - - - - - - - - - ` - for (let [key, value] of Object.entries(results.data.text_lookup)) { - htmlString += ` - - - - - - ` - } - htmlString += ` - -
      TitleYearMatch count in this text
      ${value.title}${value.publishing_year}${value.match_count}
      -
        -
        - ` - resultsList.showCorpusFilesModalContent.insertAdjacentHTML('afterbegin', htmlString); - resultsList.showCorpusFilesModal.open(); - let options = { - page: 10, - pagination: [{ - name: "paginationTop", - paginationClass: "paginationTop", - innerWindow: 8, - outerWindow: 1 - }, { - paginationClass: "paginationBottom", - innerWindow: 8, - outerWindow: 1 - }], - valueNames: ["title", "year", "match-count"], - }; - let corpusFileTable = new List('corpus-file-table', options); - } -} - -/** - * Checks if resultsList.exportFullInspectContext switch is changed. - * If it has been changed reset all Download buttons. - */ -function exportFullContextSwitch(resultsList) { - resultsList.exportFullInspectContext.onchange = (event) => { - // Hide all download buttons. - resultsList.fullResultsExport.classList.toggle('hide', true); - resultsList.subResultsExport.classList.toggle('hide', true); - // Show result create buttons. - resultsList.fullResultsCreate.classList.toggle('hide', false); - resultsList.subResultsCreate.classList.toggle('hide', false); - } -} - -/** - * The following event listeners are handeling the data export. - * 1. Create full-results - * 2. Create sub-results - * 3. Download full-results - * 4. Download sub-results - * 5. Download single inspect-results - */ - -// 1. Add events for full-results create -function createFullResults(resultsList, results) { - resultsList.fullResultsCreate.onclick = (event) => { - resultsList.fullResultsCreate.querySelector('i').classList.toggle('hide'); - resultsList.fullResultsCreate.textContent = 'Creating...'; - resultsList.fullResultsCreate.insertAdjacentHTML('afterbegin', - loadingSpinnerHTML); - // .keys() is for a zero based array. I think... - let dataIndexes = [...Array(results.data.match_count).keys()]; - // Empty fullResultsData so that no previous data is used. - results.fullResultsData.init(); - resultsList.notifyClient('get-results', {resultsType: 'full-results', - dataIndexes: dataIndexes, - resultsList: resultsList,}); - } -} - -// 2. Add events for sub-results create -function createSubResults(resultsList, results) { - resultsList.subResultsCreate.onclick = (event) => { - let dataIndexes = []; - Object.keys(resultsList.subResultsIndexes).forEach((id) => { - dataIndexes.push(id); - }); - resultsList.subResultsCreate.querySelector('i').classList.toggle('hide'); - resultsList.subResultsCreate.textContent = 'Creating...'; - resultsList.subResultsCreate.insertAdjacentHTML('afterbegin', - loadingSpinnerHTML); - // Empty subResultsData so that no previous data is used. - results.subResultsData.init(); - resultsList.notifyClient('get-results', {resultsType: 'sub-results', - dataIndexes: dataIndexes, - resultsList: resultsList,}); - } -} -// 3. Open download modal when full results export button is pressed -function exportFullResults(resultsList, results) { - resultsList.fullResultsExport.onclick = (event) => { - resultsList.queryResultsDownloadModal.open(); - // add onclick to download JSON button and download the file - resultsList.downloadResultsJson.onclick = (event) => { - let suffix = 'full-results' - if (resultsList.exportFullInspectContext.checked) { - suffix += '_full-context'; - } - let filename = results.fullResultsData.createDownloadFilename(suffix); - results.fullResultsData.addData(results.metaData); - results.fullResultsData.downloadJSONRessource(filename, - results.fullResultsData, - resultsList.downloadResultsJson)}; - } -} -// 4. Open download modal when sub results export button is pressed -function exportSubResults(resultsList, results) { - resultsList.subResultsExport.onclick = (event) => { - resultsList.queryResultsDownloadModal.open(); - // add onclick to download JSON button and download the file - resultsList.downloadResultsJson.onclick = (event) => { - let suffix = 'sub-results' - if (resultsList.exportFullInspectContext.checked) { - suffix += '_full-context'; - } - let filename = results.subResultsData.createDownloadFilename(suffix); - results.subResultsData.addData(results.metaData); - results.subResultsData.downloadJSONRessource(filename, - results.subResultsData, - resultsList.downloadResultsJson)}; - } -} -// 5. Open download modal when inspect-results-export button is pressed -function exportSingleMatch(resultsList, results) { - resultsList.inspectResultsExport.onclick = (event) => { - resultsList.queryResultsDownloadModal.open(); - // add onclick to download JSON button and download the file - resultsList.downloadResultsJson.onclick = (event) => { - let filename = results.subResultsData.createDownloadFilename('inspect-results_full-context'); - results.subResultsData.addData(results.metaData); - results.subResultsData.downloadJSONRessource(filename, - results.inspectResultsData, - resultsList.downloadResultsJson)}; - } -} - -// export listeners -export { - recieveClientNotification, - pageNavigation, - expertModeSwitch, - actionButtons, - displayOptions, - showMetaData, - showCorpusFiles, - exportFullContextSwitch, - createFullResults, - createSubResults, - exportFullResults, - exportSubResults, - exportSingleMatch, -}; \ No newline at end of file diff --git a/app/static/js/modules/corpus_analysis/view/scrollToTop.js b/app/static/js/modules/corpus_analysis/view/scrollToTop.js deleted file mode 100644 index 835ab8a0..00000000 --- a/app/static/js/modules/corpus_analysis/view/scrollToTop.js +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Function to show a scroll to top button if the user has scrolled down - * 250 pixels from the with scrollToElementSelector specified Element. - */ -function scrollToTop(scrollToElementSelector, triggerElementSelector) { - let scrollToThis = document.querySelector(scrollToElementSelector); - let scrolltoTopTrigger = document.querySelector(triggerElementSelector); - window.addEventListener('scroll', (event) => { - if (pageYOffset > 250) { - scrolltoTopTrigger.classList.toggle('hide', false); - } else { - scrolltoTopTrigger.classList.toggle('hide', true); - } - }); - scrolltoTopTrigger.onclick = () => { - scrollToThis.scrollIntoView({ - behavior: 'smooth', - block: 'start', - inline: 'nearest' - }); - }; -} - -// Export function. -export { - scrollToTop -}; \ No newline at end of file diff --git a/app/static/js/modules/corpus_analysis/view/spinner.js b/app/static/js/modules/corpus_analysis/view/spinner.js deleted file mode 100644 index 5df37cfd..00000000 --- a/app/static/js/modules/corpus_analysis/view/spinner.js +++ /dev/null @@ -1,19 +0,0 @@ -// loading spinner animation HTML -const loadingSpinnerHTML = ` -
        -
        -
        -
        -
        -
        -
        -
        -
        -
        -
        -`; - -// Export const. -export { - loadingSpinnerHTML -}; diff --git a/app/static/js/socket.io.min.js b/app/static/js/socket.io.min.js deleted file mode 100644 index cec3c9ca..00000000 --- a/app/static/js/socket.io.min.js +++ /dev/null @@ -1,7 +0,0 @@ -/*! - * Socket.IO v3.0.4 - * (c) 2014-2020 Guillermo Rauch - * Released under the MIT License. - */ -!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.io=e():t.io=e()}("undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:Function("return this")(),(function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=18)}([function(t,e,n){function r(t){if(t)return function(t){for(var e in r.prototype)t[e]=r.prototype[e];return t}(t)}t.exports=r,r.prototype.on=r.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this},r.prototype.once=function(t,e){function n(){this.off(t,n),e.apply(this,arguments)}return n.fn=e,this.on(t,n),this},r.prototype.off=r.prototype.removeListener=r.prototype.removeAllListeners=r.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n,r=this._callbacks["$"+t];if(!r)return this;if(1==arguments.length)return delete this._callbacks["$"+t],this;for(var o=0;o=this._reconnectionAttempts)this.backoff.reset(),i(u(b.prototype),"emit",this).call(this,"reconnect_failed"),this._reconnecting=!1;else{var n=this.backoff.duration();this._reconnecting=!0;var r=setTimeout((function(){e.skipReconnect||(i(u(b.prototype),"emit",t).call(t,"reconnect_attempt",e.backoff.attempts),e.skipReconnect||e.open((function(n){n?(e._reconnecting=!1,e.reconnect(),i(u(b.prototype),"emit",t).call(t,"reconnect_error",n)):e.onreconnect()})))}),n);this.subs.push({destroy:function(){clearTimeout(r)}})}}},{key:"onreconnect",value:function(){var t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),i(u(b.prototype),"emit",this).call(this,"reconnect",t)}}])&&o(e.prototype,n),a&&o(e,a),b}(l);e.Manager=b},function(t,e,n){var r=n(9),o=n(23),i=n(27),s=n(28);e.polling=function(t){var e=!1,n=!1,s=!1!==t.jsonp;if("undefined"!=typeof location){var c="https:"===location.protocol,a=location.port;a||(a=c?443:80),e=t.hostname!==location.hostname||a!==t.port,n=t.secure!==c}if(t.xdomain=e,t.xscheme=n,"open"in new r(t)&&!t.forceJSONP)return new o(t);if(!s)throw new Error("JSONP disabled");return new i(t)},e.websocket=s},function(t,e,n){var r=n(22),o=n(2);t.exports=function(t){var e=t.xdomain,n=t.xscheme,i=t.enablesXDR;try{if("undefined"!=typeof XMLHttpRequest&&(!e||r))return new XMLHttpRequest}catch(t){}try{if("undefined"!=typeof XDomainRequest&&!n&&i)return new XDomainRequest}catch(t){}if(!e)try{return new(o[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")}catch(t){}}},function(t,e,n){function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){for(var n=0;n0);return e}function u(){var t=a(+new Date);return t!==r?(s=0,r=t):t+"."+a(s++)}for(;c<64;c++)i[o[c]]=c;u.encode=a,u.decode=function(t){var e=0;for(c=0;c1?e-1:0),r=1;r=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,c=!0,a=!1;return{s:function(){n=t[Symbol.iterator]()},n:function(){var t=n.next();return c=t.done,t},e:function(t){a=!0,s=t},f:function(){try{c||null==n.return||n.return()}finally{if(a)throw s}}}}function i(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n1?e-1:0),r=1;r1&&void 0!==arguments[1]?arguments[1]:{};return i(this,l),e=f.call(this),t&&"object"===o(t)&&(n=t,t=null),t?(t=y(t),n.hostname=t.host,n.secure="https"===t.protocol||"wss"===t.protocol,n.port=t.port,t.query&&(n.query=t.query)):n.host&&(n.hostname=y(n.host).host),e.secure=null!=n.secure?n.secure:"undefined"!=typeof location&&"https:"===location.protocol,n.hostname&&!n.port&&(n.port=e.secure?"443":"80"),e.hostname=n.hostname||("undefined"!=typeof location?location.hostname:"localhost"),e.port=n.port||("undefined"!=typeof location&&location.port?location.port:e.secure?443:80),e.transports=n.transports||["polling","websocket"],e.readyState="",e.writeBuffer=[],e.prevBufferLen=0,e.opts=r({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,jsonp:!0,timestampParam:"t",rememberUpgrade:!1,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{}},n),e.opts.path=e.opts.path.replace(/\/$/,"")+"/","string"==typeof e.opts.query&&(e.opts.query=d.decode(e.opts.query)),e.id=null,e.upgrades=null,e.pingInterval=null,e.pingTimeout=null,e.pingTimeoutTimer=null,e.open(),e}return e=l,(n=[{key:"createTransport",value:function(t){var e=function(t){var e={};for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);return e}(this.opts.query);e.EIO=h.protocol,e.transport=t,this.id&&(e.sid=this.id);var n=r({},this.opts.transportOptions[t],this.opts,{query:e,socket:this,hostname:this.hostname,secure:this.secure,port:this.port});return new p[t](n)}},{key:"open",value:function(){var t;if(this.opts.rememberUpgrade&&l.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket"))t="websocket";else{if(0===this.transports.length){var e=this;return void setTimeout((function(){e.emit("error","No transports available")}),0)}t=this.transports[0]}this.readyState="opening";try{t=this.createTransport(t)}catch(t){return this.transports.shift(),void this.open()}t.open(),this.setTransport(t)}},{key:"setTransport",value:function(t){var e=this;this.transport&&this.transport.removeAllListeners(),this.transport=t,t.on("drain",(function(){e.onDrain()})).on("packet",(function(t){e.onPacket(t)})).on("error",(function(t){e.onError(t)})).on("close",(function(){e.onClose("transport close")}))}},{key:"probe",value:function(t){var e=this.createTransport(t,{probe:1}),n=!1,r=this;function o(){if(r.onlyBinaryUpgrades){var t=!this.supportsBinary&&r.transport.supportsBinary;n=n||t}n||(e.send([{type:"ping",data:"probe"}]),e.once("packet",(function(t){if(!n)if("pong"===t.type&&"probe"===t.data){if(r.upgrading=!0,r.emit("upgrading",e),!e)return;l.priorWebsocketSuccess="websocket"===e.name,r.transport.pause((function(){n||"closed"!==r.readyState&&(f(),r.setTransport(e),e.send([{type:"upgrade"}]),r.emit("upgrade",e),e=null,r.upgrading=!1,r.flush())}))}else{var o=new Error("probe error");o.transport=e.name,r.emit("upgradeError",o)}})))}function i(){n||(n=!0,f(),e.close(),e=null)}function s(t){var n=new Error("probe error: "+t);n.transport=e.name,i(),r.emit("upgradeError",n)}function c(){s("transport closed")}function a(){s("socket closed")}function u(t){e&&t.name!==e.name&&i()}function f(){e.removeListener("open",o),e.removeListener("error",s),e.removeListener("close",c),r.removeListener("close",a),r.removeListener("upgrading",u)}l.priorWebsocketSuccess=!1,e.once("open",o),e.once("error",s),e.once("close",c),this.once("close",a),this.once("upgrading",u),e.open()}},{key:"onOpen",value:function(){if(this.readyState="open",l.priorWebsocketSuccess="websocket"===this.transport.name,this.emit("open"),this.flush(),"open"===this.readyState&&this.opts.upgrade&&this.transport.pause)for(var t=0,e=this.upgrades.length;t0&&void 0!==arguments[0]?arguments[0]:{};return o(t,{xd:this.xd,xs:this.xs},this.opts),new w(this.uri(),t)}},{key:"doWrite",value:function(t,e){var n=this.request({method:"POST",data:t}),r=this;n.on("success",e),n.on("error",(function(t){r.onError("xhr post error",t)}))}},{key:"doPoll",value:function(){var t=this.request(),e=this;t.on("data",(function(t){e.onData(t)})),t.on("error",(function(t){e.onError("xhr poll error",t)})),this.pollXhr=t}}]),n}(y),w=function(t){a(n,t);var e=f(n);function n(t,r){var o;return i(this,n),(o=e.call(this)).opts=r,o.method=r.method||"GET",o.uri=t,o.async=!1!==r.async,o.data=void 0!==r.data?r.data:null,o.create(),o}return c(n,[{key:"create",value:function(){var t=v(this.opts,"agent","enablesXDR","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized");t.xdomain=!!this.opts.xd,t.xscheme=!!this.opts.xs;var e=this.xhr=new h(t),r=this;try{e.open(this.method,this.uri,this.async);try{if(this.opts.extraHeaders)for(var o in e.setDisableHeaderCheck&&e.setDisableHeaderCheck(!0),this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(o)&&e.setRequestHeader(o,this.opts.extraHeaders[o])}catch(t){}if("POST"===this.method)try{e.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(t){}try{e.setRequestHeader("Accept","*/*")}catch(t){}"withCredentials"in e&&(e.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(e.timeout=this.opts.requestTimeout),this.hasXDR()?(e.onload=function(){r.onLoad()},e.onerror=function(){r.onError(e.responseText)}):e.onreadystatechange=function(){4===e.readyState&&(200===e.status||1223===e.status?r.onLoad():setTimeout((function(){r.onError("number"==typeof e.status?e.status:0)}),0))},e.send(this.data)}catch(t){return void setTimeout((function(){r.onError(t)}),0)}"undefined"!=typeof document&&(this.index=n.requestsCount++,n.requests[this.index]=this)}},{key:"onSuccess",value:function(){this.emit("success"),this.cleanup()}},{key:"onData",value:function(t){this.emit("data",t),this.onSuccess()}},{key:"onError",value:function(t){this.emit("error",t),this.cleanup(!0)}},{key:"cleanup",value:function(t){if(void 0!==this.xhr&&null!==this.xhr){if(this.hasXDR()?this.xhr.onload=this.xhr.onerror=m:this.xhr.onreadystatechange=m,t)try{this.xhr.abort()}catch(t){}"undefined"!=typeof document&&delete n.requests[this.index],this.xhr=null}}},{key:"onLoad",value:function(){var t=this.xhr.responseText;null!==t&&this.onData(t)}},{key:"hasXDR",value:function(){return"undefined"!=typeof XDomainRequest&&!this.xs&&this.enablesXDR}},{key:"abort",value:function(){this.cleanup()}}]),n}(d);if(w.requestsCount=0,w.requests={},"undefined"!=typeof document)if("function"==typeof attachEvent)attachEvent("onunload",_);else if("function"==typeof addEventListener){addEventListener("onpagehide"in b?"pagehide":"unload",_,!1)}function _(){for(var t in w.requests)w.requests.hasOwnProperty(t)&&w.requests[t].abort()}t.exports=k,t.exports.Request=w},function(t,e,n){var r=n(11).PACKET_TYPES,o="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===Object.prototype.toString.call(Blob),i="function"==typeof ArrayBuffer,s=function(t,e){var n=new FileReader;return n.onload=function(){var t=n.result.split(",")[1];e("b"+t)},n.readAsDataURL(t)};t.exports=function(t,e,n){var c,a=t.type,u=t.data;return o&&u instanceof Blob?e?n(u):s(u,n):i&&(u instanceof ArrayBuffer||(c=u,"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(c):c&&c.buffer instanceof ArrayBuffer))?e?n(u instanceof ArrayBuffer?u:u.buffer):s(new Blob([u]),n):n(r[a]+(u||""))}},function(t,e,n){var r,o=n(11),i=o.PACKET_TYPES_REVERSE,s=o.ERROR_PACKET;"function"==typeof ArrayBuffer&&(r=n(26));var c=function(t,e){if(r){var n=r.decode(t);return a(n,e)}return{base64:!0,data:t}},a=function(t,e){switch(e){case"blob":return t instanceof ArrayBuffer?new Blob([t]):t;case"arraybuffer":default:return t}};t.exports=function(t,e){if("string"!=typeof t)return{type:"message",data:a(t,e)};var n=t.charAt(0);return"b"===n?{type:"message",data:c(t.substring(1),e)}:i[n]?t.length>1?{type:i[n],data:t.substring(1)}:{type:i[n]}:s}},function(t,e){!function(){"use strict";for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n=new Uint8Array(256),r=0;r>2],i+=t[(3&r[n])<<4|r[n+1]>>4],i+=t[(15&r[n+1])<<2|r[n+2]>>6],i+=t[63&r[n+2]];return o%3==2?i=i.substring(0,i.length-1)+"=":o%3==1&&(i=i.substring(0,i.length-2)+"=="),i},e.decode=function(t){var e,r,o,i,s,c=.75*t.length,a=t.length,u=0;"="===t[t.length-1]&&(c--,"="===t[t.length-2]&&c--);var f=new ArrayBuffer(c),p=new Uint8Array(f);for(e=0;e>4,p[u++]=(15&o)<<4|i>>2,p[u++]=(3&i)<<6|63&s;return f}}()},function(t,e,n){function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e){for(var n=0;n';n=document.createElement(t)}catch(t){(n=document.createElement("iframe")).name=r.iframeId,n.src="javascript:0"}n.id=r.iframeId,r.form.appendChild(n),r.iframe=n}this.form.action=this.uri(),a(),t=t.replace(d,"\\\n"),this.area.value=t.replace(y,"\\n");try{this.form.submit()}catch(t){}this.iframe.attachEvent?this.iframe.onreadystatechange=function(){"complete"===r.iframe.readyState&&c()}:this.iframe.onload=c}},{key:"supportsBinary",get:function(){return!1}}])&&o(e.prototype,n),r&&o(e,r),l}(l);t.exports=b},function(t,e,n){function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e){for(var n=0;n0&&t.jitter<=1?t.jitter:0,this.attempts=0}t.exports=n,n.prototype.duration=function(){var t=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),n=Math.floor(e*this.jitter*t);t=0==(1&Math.floor(10*e))?t-n:t+n}return 0|Math.min(t,this.max)},n.prototype.reset=function(){this.attempts=0},n.prototype.setMin=function(t){this.ms=t},n.prototype.setMax=function(t){this.max=t},n.prototype.setJitter=function(t){this.jitter=t}}])})); -//# sourceMappingURL=socket.io.min.js.map \ No newline at end of file diff --git a/app/static/js/socket.io.min.js.map b/app/static/js/socket.io.min.js.map deleted file mode 100644 index 80c088a3..00000000 --- a/app/static/js/socket.io.min.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["webpack://io/webpack/universalModuleDefinition","webpack://io/webpack/bootstrap","webpack://io/./node_modules/component-emitter/index.js","webpack://io/./node_modules/engine.io-parser/lib/index.js","webpack://io/./node_modules/engine.io-client/lib/globalThis.browser.js","webpack://io/./node_modules/engine.io-client/lib/transport.js","webpack://io/./node_modules/parseqs/index.js","webpack://io/./node_modules/socket.io-parser/dist/index.js","webpack://io/./node_modules/parseuri/index.js","webpack://io/./build/manager.js","webpack://io/./node_modules/engine.io-client/lib/transports/index.js","webpack://io/./node_modules/engine.io-client/lib/xmlhttprequest.js","webpack://io/./node_modules/engine.io-client/lib/transports/polling.js","webpack://io/./node_modules/engine.io-parser/lib/commons.js","webpack://io/./node_modules/yeast/index.js","webpack://io/./node_modules/engine.io-client/lib/util.js","webpack://io/./build/socket.js","webpack://io/./node_modules/socket.io-parser/dist/is-binary.js","webpack://io/./build/on.js","webpack://io/./node_modules/component-bind/index.js","webpack://io/./build/index.js","webpack://io/./build/url.js","webpack://io/./node_modules/engine.io-client/lib/index.js","webpack://io/./node_modules/engine.io-client/lib/socket.js","webpack://io/./node_modules/has-cors/index.js","webpack://io/./node_modules/engine.io-client/lib/transports/polling-xhr.js","webpack://io/./node_modules/engine.io-parser/lib/encodePacket.browser.js","webpack://io/./node_modules/engine.io-parser/lib/decodePacket.browser.js","webpack://io/./node_modules/base64-arraybuffer/lib/base64-arraybuffer.js","webpack://io/./node_modules/engine.io-client/lib/transports/polling-jsonp.js","webpack://io/./node_modules/engine.io-client/lib/transports/websocket.js","webpack://io/./node_modules/engine.io-client/lib/transports/websocket-constructor.browser.js","webpack://io/./node_modules/socket.io-parser/dist/binary.js","webpack://io/./node_modules/backo2/index.js"],"names":["root","factory","exports","module","define","amd","self","window","global","Function","installedModules","__webpack_require__","moduleId","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","Emitter","obj","mixin","on","addEventListener","event","fn","this","_callbacks","push","once","off","apply","arguments","removeListener","removeAllListeners","removeEventListener","length","cb","callbacks","splice","emit","args","Array","len","slice","listeners","hasListeners","encodePacket","require","decodePacket","SEPARATOR","String","fromCharCode","protocol","encodePayload","packets","callback","encodedPackets","count","forEach","packet","encodedPacket","join","decodePayload","encodedPayload","binaryType","split","decodedPacket","type","parser","Transport","opts","query","readyState","socket","msg","desc","err","Error","description","doOpen","doClose","onClose","write","writable","data","onPacket","encode","str","encodeURIComponent","decode","qs","qry","pairs","pair","decodeURIComponent","Decoder","Encoder","PacketType","binary_1","is_binary_1","EVENT","ACK","hasBinary","encodeAsString","BINARY_EVENT","BINARY_ACK","encodeAsBinary","attachments","nsp","id","JSON","stringify","deconstruction","deconstructPacket","pack","buffers","unshift","decodeString","reconstructor","BinaryReconstructor","isBinary","base64","takeBinaryData","Number","charAt","undefined","start","buf","substring","next","payload","parse","e","tryParse","substr","isPayloadValid","finishedReconstruction","CONNECT","DISCONNECT","CONNECT_ERROR","isArray","reconPack","binData","reconstructPacket","re","parts","src","b","indexOf","replace","exec","uri","source","host","authority","ipv6uri","pathNames","path","names","queryKey","$0","$1","$2","Manager","eio","socket_1","on_1","Backoff","nsps","subs","reconnection","reconnectionAttempts","Infinity","reconnectionDelay","reconnectionDelayMax","randomizationFactor","backoff","min","max","jitter","timeout","_readyState","_parser","encoder","decoder","_autoConnect","autoConnect","open","v","_reconnection","_reconnectionAttempts","_a","_reconnectionDelay","setMin","_randomizationFactor","setJitter","_reconnectionDelayMax","setMax","_timeout","_reconnecting","attempts","reconnect","engine","skipReconnect","openSub","onopen","errorSub","cleanup","maybeReconnectOnOpen","destroy","timer","setTimeout","close","clearTimeout","add","Socket","keys","active","_close","options","subsLength","shift","reset","reason","delay","duration","onreconnect","attempt","XMLHttpRequest","XHR","JSONP","websocket","polling","xd","xs","jsonp","location","isSSL","port","hostname","secure","xdomain","xscheme","forceJSONP","hasCORS","globalThis","enablesXDR","XDomainRequest","concat","parseqs","yeast","Polling","poll","onPause","pause","total","doPoll","index","onOpen","doWrite","schema","timestampRequests","timestampParam","supportsBinary","sid","b64","PACKET_TYPES","PACKET_TYPES_REVERSE","ERROR_PACKET","prev","alphabet","map","seed","num","encoded","Math","floor","now","Date","decoded","pick","attr","reduce","acc","k","socket_io_parser_1","RESERVED_EVENTS","freeze","connect","connect_error","disconnect","disconnecting","newListener","io","ids","acks","receiveBuffer","sendBuffer","flags","connected","disconnected","auth","subEvents","ev","compress","pop","isTransportWritable","transport","discardPacket","_packet","onconnect","onevent","onack","ondisconnect","message","ack","emitEvent","_anyListeners","sent","emitBuffered","onclose","listener","withNativeArrayBuffer","ArrayBuffer","toString","withNativeBlob","Blob","withNativeFile","File","isView","buffer","toJSON","url_1","manager_1","lookup","cache","managers","parsed","url","sameNamespace","forceNew","multiplex","manager_2","parseuri","loc","test","href","transports","writeBuffer","prevBufferLen","agent","withCredentials","upgrade","rememberUpgrade","rejectUnauthorized","perMessageDeflate","threshold","transportOptions","upgrades","pingInterval","pingTimeout","pingTimeoutTimer","clone","EIO","priorWebsocketSuccess","createTransport","setTransport","onDrain","onError","probe","failed","onTransportOpen","onlyBinaryUpgrades","upgradeLosesBinary","send","upgrading","flush","freezeTransport","onerror","error","onTransportClose","onupgrade","to","onHandshake","resetPingTimeout","sendPacket","code","filterUpgrades","cleanupAndClose","waitForUpgrade","pingIntervalTimer","filteredUpgrades","j","empty","hasXHR2","responseType","forceBase64","Request","req","request","method","onData","pollXhr","async","xhr","extraHeaders","setDisableHeaderCheck","setRequestHeader","requestTimeout","hasXDR","onload","onLoad","responseText","onreadystatechange","status","document","requestsCount","requests","onSuccess","fromError","abort","attachEvent","unloadHandler","encodeBlobAsBase64","fileReader","FileReader","content","result","readAsDataURL","base64decoder","decodeBase64Packet","mapBinary","chars","Uint8Array","charCodeAt","arraybuffer","bytes","encoded1","encoded2","encoded3","encoded4","bufferLength","rNewline","rEscapedNewline","JSONPPolling","___eio","script","parentNode","removeChild","form","iframe","createElement","insertAt","getElementsByTagName","insertBefore","head","body","appendChild","navigator","userAgent","area","iframeId","className","style","position","top","left","target","setAttribute","complete","initIframe","html","action","submit","WebSocket","usingBrowserWebSocket","defaultBinaryType","isReactNative","product","toLowerCase","WS","check","protocols","headers","ws","addEventListeners","onmessage","Buffer","byteLength","MozWebSocket","packetData","_deconstructPacket","placeholder","_placeholder","newData","_reconstructPacket","ms","factor","pow","rand","random","deviation"],"mappings":";;;;;CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,GAAIH,GACe,iBAAZC,QACdA,QAAY,GAAID,IAEhBD,EAAS,GAAIC,IARf,CAU0B,oBAATK,KACAA,KACkB,oBAAXC,OACPA,OACkB,oBAAXC,OACPA,OAEAC,SAAS,cAATA,IAEP,WACV,O,YCnBE,IAAIC,EAAmB,GAGvB,SAASC,EAAoBC,GAG5B,GAAGF,EAAiBE,GACnB,OAAOF,EAAiBE,GAAUV,QAGnC,IAAIC,EAASO,EAAiBE,GAAY,CACzCC,EAAGD,EACHE,GAAG,EACHZ,QAAS,IAUV,OANAa,EAAQH,GAAUI,KAAKb,EAAOD,QAASC,EAAQA,EAAOD,QAASS,GAG/DR,EAAOW,GAAI,EAGJX,EAAOD,QA0Df,OArDAS,EAAoBM,EAAIF,EAGxBJ,EAAoBO,EAAIR,EAGxBC,EAAoBQ,EAAI,SAASjB,EAASkB,EAAMC,GAC3CV,EAAoBW,EAAEpB,EAASkB,IAClCG,OAAOC,eAAetB,EAASkB,EAAM,CAAEK,YAAY,EAAMC,IAAKL,KAKhEV,EAAo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AC9C,GAAI/K,KAAK0J,OAAQ,CACf,IAAIgU,EAAQhO,KAAKiO,SACbC,EAAYlO,KAAKC,MAAM+N,EAAO1d,KAAK0J,OAAS6T,GAChDA,EAAoC,IAAN,EAAxB7N,KAAKC,MAAa,GAAP+N,IAAwBH,EAAKK,EAAYL,EAAKK,EAEjE,OAAgC,EAAzBlO,KAAKlG,IAAI+T,EAAIvd,KAAKyJ,MAS3BX,EAAQzJ,UAAUgN,MAAQ,WACxBrM,KAAK+K,SAAW,GASlBjC,EAAQzJ,UAAUmL,OAAS,SAAShB,GAClCxJ,KAAKud,GAAK/T,GASZV,EAAQzJ,UAAUuL,OAAS,SAASnB,GAClCzJ,KAAKyJ,IAAMA,GASbX,EAAQzJ,UAAUqL,UAAY,SAAShB,GACrC1J,KAAK0J,OAASA","file":"socket.io.min.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"io\"] = factory();\n\telse\n\t\troot[\"io\"] = factory();\n})((() => {\n if (typeof self !== 'undefined') {\n return self;\n } else if (typeof window !== 'undefined') {\n return window;\n } else if (typeof global !== 'undefined') {\n return global;\n } else {\n return Function('return this')();\n }\n })(), function() {\nreturn "," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 18);\n","\r\n/**\r\n * Expose `Emitter`.\r\n */\r\n\r\nif (typeof module !== 'undefined') {\r\n module.exports = Emitter;\r\n}\r\n\r\n/**\r\n * Initialize a new `Emitter`.\r\n *\r\n * @api public\r\n */\r\n\r\nfunction Emitter(obj) {\r\n if (obj) return mixin(obj);\r\n};\r\n\r\n/**\r\n * Mixin the emitter properties.\r\n *\r\n * @param {Object} obj\r\n * @return {Object}\r\n * @api private\r\n */\r\n\r\nfunction mixin(obj) {\r\n for (var key in Emitter.prototype) {\r\n obj[key] = Emitter.prototype[key];\r\n }\r\n return obj;\r\n}\r\n\r\n/**\r\n * Listen on the given `event` with `fn`.\r\n *\r\n * @param {String} event\r\n * @param {Function} fn\r\n * @return {Emitter}\r\n * @api public\r\n */\r\n\r\nEmitter.prototype.on =\r\nEmitter.prototype.addEventListener = function(event, fn){\r\n this._callbacks = this._callbacks || {};\r\n (this._callbacks['$' + event] = this._callbacks['$' + event] || [])\r\n .push(fn);\r\n return this;\r\n};\r\n\r\n/**\r\n * Adds an `event` listener that will be invoked a single\r\n * time then automatically removed.\r\n *\r\n * @param {String} event\r\n * @param {Function} fn\r\n * @return {Emitter}\r\n * @api public\r\n */\r\n\r\nEmitter.prototype.once = function(event, fn){\r\n function on() {\r\n this.off(event, on);\r\n fn.apply(this, arguments);\r\n }\r\n\r\n on.fn = fn;\r\n this.on(event, on);\r\n return this;\r\n};\r\n\r\n/**\r\n * Remove the given callback for `event` or all\r\n * registered callbacks.\r\n *\r\n * @param {String} event\r\n * @param {Function} fn\r\n * @return {Emitter}\r\n * @api public\r\n */\r\n\r\nEmitter.prototype.off =\r\nEmitter.prototype.removeListener =\r\nEmitter.prototype.removeAllListeners =\r\nEmitter.prototype.removeEventListener = function(event, fn){\r\n this._callbacks = this._callbacks || {};\r\n\r\n // all\r\n if (0 == arguments.length) {\r\n this._callbacks = {};\r\n return this;\r\n }\r\n\r\n // specific event\r\n var callbacks = this._callbacks['$' + event];\r\n if (!callbacks) return this;\r\n\r\n // remove all handlers\r\n if (1 == arguments.length) {\r\n delete this._callbacks['$' + event];\r\n return this;\r\n }\r\n\r\n // remove specific handler\r\n var cb;\r\n for (var i = 0; i < callbacks.length; i++) {\r\n cb = callbacks[i];\r\n if (cb === fn || cb.fn === fn) {\r\n callbacks.splice(i, 1);\r\n break;\r\n }\r\n }\r\n\r\n // Remove event specific arrays for event types that no\r\n // one is subscribed for to avoid memory leak.\r\n if (callbacks.length === 0) {\r\n delete this._callbacks['$' + event];\r\n }\r\n\r\n return this;\r\n};\r\n\r\n/**\r\n * Emit `event` with the given args.\r\n *\r\n * @param {String} event\r\n * @param {Mixed} ...\r\n * @return {Emitter}\r\n */\r\n\r\nEmitter.prototype.emit = function(event){\r\n this._callbacks = this._callbacks || {};\r\n\r\n var args = new Array(arguments.length - 1)\r\n , callbacks = this._callbacks['$' + event];\r\n\r\n for (var i = 1; i < arguments.length; i++) {\r\n args[i - 1] = arguments[i];\r\n }\r\n\r\n if (callbacks) {\r\n callbacks = callbacks.slice(0);\r\n for (var i = 0, len = callbacks.length; i < len; ++i) {\r\n callbacks[i].apply(this, args);\r\n }\r\n }\r\n\r\n return this;\r\n};\r\n\r\n/**\r\n * Return array of callbacks for `event`.\r\n *\r\n * @param {String} event\r\n * @return {Array}\r\n * @api public\r\n */\r\n\r\nEmitter.prototype.listeners = function(event){\r\n this._callbacks = this._callbacks || {};\r\n return this._callbacks['$' + event] || [];\r\n};\r\n\r\n/**\r\n * Check if this emitter has `event` handlers.\r\n *\r\n * @param {String} event\r\n * @return {Boolean}\r\n * @api public\r\n */\r\n\r\nEmitter.prototype.hasListeners = function(event){\r\n return !! this.listeners(event).length;\r\n};\r\n","const encodePacket = require(\"./encodePacket\");\nconst decodePacket = require(\"./decodePacket\");\n\nconst SEPARATOR = String.fromCharCode(30); // see https://en.wikipedia.org/wiki/Delimiter#ASCII_delimited_text\n\nconst encodePayload = (packets, callback) => {\n // some packets may be added to the array while encoding, so the initial length must be saved\n const length = packets.length;\n const encodedPackets = new Array(length);\n let count = 0;\n\n packets.forEach((packet, i) => {\n // force base64 encoding for binary packets\n encodePacket(packet, false, encodedPacket => {\n encodedPackets[i] = encodedPacket;\n if (++count === length) {\n callback(encodedPackets.join(SEPARATOR));\n }\n });\n });\n};\n\nconst decodePayload = (encodedPayload, binaryType) => {\n const encodedPackets = encodedPayload.split(SEPARATOR);\n const packets = [];\n for (let i = 0; i < encodedPackets.length; i++) {\n const decodedPacket = decodePacket(encodedPackets[i], binaryType);\n packets.push(decodedPacket);\n if (decodedPacket.type === \"error\") {\n break;\n }\n }\n return packets;\n};\n\nmodule.exports = {\n protocol: 4,\n encodePacket,\n encodePayload,\n decodePacket,\n decodePayload\n};\n","module.exports = (() => {\n if (typeof self !== \"undefined\") {\n return self;\n } else if (typeof window !== \"undefined\") {\n return window;\n } else {\n return Function(\"return this\")();\n }\n})();\n","const parser = require(\"engine.io-parser\");\nconst Emitter = require(\"component-emitter\");\n\nclass Transport extends Emitter {\n /**\n * Transport abstract constructor.\n *\n * @param {Object} options.\n * @api private\n */\n constructor(opts) {\n super();\n\n this.opts = opts;\n this.query = opts.query;\n this.readyState = \"\";\n this.socket = opts.socket;\n }\n\n /**\n * Emits an error.\n *\n * @param {String} str\n * @return {Transport} for chaining\n * @api public\n */\n onError(msg, desc) {\n const err = new Error(msg);\n err.type = \"TransportError\";\n err.description = desc;\n this.emit(\"error\", err);\n return this;\n }\n\n /**\n * Opens the transport.\n *\n * @api public\n */\n open() {\n if (\"closed\" === this.readyState || \"\" === this.readyState) {\n this.readyState = \"opening\";\n this.doOpen();\n }\n\n return this;\n }\n\n /**\n * Closes the transport.\n *\n * @api private\n */\n close() {\n if (\"opening\" === this.readyState || \"open\" === this.readyState) {\n this.doClose();\n this.onClose();\n }\n\n return this;\n }\n\n /**\n * Sends multiple packets.\n *\n * @param {Array} packets\n * @api private\n */\n send(packets) {\n if (\"open\" === this.readyState) {\n this.write(packets);\n } else {\n throw new Error(\"Transport not open\");\n }\n }\n\n /**\n * Called upon open\n *\n * @api private\n */\n onOpen() {\n this.readyState = \"open\";\n this.writable = true;\n this.emit(\"open\");\n }\n\n /**\n * Called with data.\n *\n * @param {String} data\n * @api private\n */\n onData(data) {\n const packet = parser.decodePacket(data, this.socket.binaryType);\n this.onPacket(packet);\n }\n\n /**\n * Called with a decoded packet.\n */\n onPacket(packet) {\n this.emit(\"packet\", packet);\n }\n\n /**\n * Called upon close.\n *\n * @api private\n */\n onClose() {\n this.readyState = \"closed\";\n this.emit(\"close\");\n }\n}\n\nmodule.exports = Transport;\n","/**\n * Compiles a querystring\n * Returns string representation of the object\n *\n * @param {Object}\n * @api private\n */\n\nexports.encode = function (obj) {\n var str = '';\n\n for (var i in obj) {\n if (obj.hasOwnProperty(i)) {\n if (str.length) str += '&';\n str += encodeURIComponent(i) + '=' + encodeURIComponent(obj[i]);\n }\n }\n\n return str;\n};\n\n/**\n * Parses a simple querystring into an object\n *\n * @param {String} qs\n * @api private\n */\n\nexports.decode = function(qs){\n var qry = {};\n var pairs = qs.split('&');\n for (var i = 0, l = pairs.length; i < l; i++) {\n var pair = pairs[i].split('=');\n qry[decodeURIComponent(pair[0])] = decodeURIComponent(pair[1]);\n }\n return qry;\n};\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Decoder = exports.Encoder = exports.PacketType = exports.protocol = void 0;\nconst Emitter = require(\"component-emitter\");\nconst binary_1 = require(\"./binary\");\nconst is_binary_1 = require(\"./is-binary\");\n\n\n/**\n * Protocol version.\n *\n * @public\n */\nexports.protocol = 5;\nvar PacketType;\n(function (PacketType) {\n PacketType[PacketType[\"CONNECT\"] = 0] = \"CONNECT\";\n PacketType[PacketType[\"DISCONNECT\"] = 1] = \"DISCONNECT\";\n PacketType[PacketType[\"EVENT\"] = 2] = \"EVENT\";\n PacketType[PacketType[\"ACK\"] = 3] = \"ACK\";\n PacketType[PacketType[\"CONNECT_ERROR\"] = 4] = \"CONNECT_ERROR\";\n PacketType[PacketType[\"BINARY_EVENT\"] = 5] = \"BINARY_EVENT\";\n PacketType[PacketType[\"BINARY_ACK\"] = 6] = \"BINARY_ACK\";\n})(PacketType = exports.PacketType || (exports.PacketType = {}));\n/**\n * A socket.io Encoder instance\n */\nclass Encoder {\n /**\n * Encode a packet as a single string if non-binary, or as a\n * buffer sequence, depending on packet type.\n *\n * @param {Object} obj - packet object\n */\n encode(obj) {\n\n\n if (obj.type === PacketType.EVENT || obj.type === PacketType.ACK) {\n if (is_binary_1.hasBinary(obj)) {\n obj.type =\n obj.type === PacketType.EVENT\n ? PacketType.BINARY_EVENT\n : PacketType.BINARY_ACK;\n return this.encodeAsBinary(obj);\n }\n }\n return [this.encodeAsString(obj)];\n }\n /**\n * Encode packet as string.\n */\n encodeAsString(obj) {\n // first is type\n let str = \"\" + obj.type;\n // attachments if we have them\n if (obj.type === PacketType.BINARY_EVENT ||\n obj.type === PacketType.BINARY_ACK) {\n str += obj.attachments + \"-\";\n }\n // if we have a namespace other than `/`\n // we append it followed by a comma `,`\n if (obj.nsp && \"/\" !== obj.nsp) {\n str += obj.nsp + \",\";\n }\n // immediately followed by the id\n if (null != obj.id) {\n str += obj.id;\n }\n // json data\n if (null != obj.data) {\n str += JSON.stringify(obj.data);\n }\n\n\n return str;\n }\n /**\n * Encode packet as 'buffer sequence' by removing blobs, and\n * deconstructing packet into object with placeholders and\n * a list of buffers.\n */\n encodeAsBinary(obj) {\n const deconstruction = binary_1.deconstructPacket(obj);\n const pack = this.encodeAsString(deconstruction.packet);\n const buffers = deconstruction.buffers;\n buffers.unshift(pack); // add packet info to beginning of data list\n return buffers; // write all the buffers\n }\n}\nexports.Encoder = Encoder;\n/**\n * A socket.io Decoder instance\n *\n * @return {Object} decoder\n */\nclass Decoder extends Emitter {\n constructor() {\n super();\n }\n /**\n * Decodes an encoded packet string into packet JSON.\n *\n * @param {String} obj - encoded packet\n */\n add(obj) {\n let packet;\n if (typeof obj === \"string\") {\n packet = this.decodeString(obj);\n if (packet.type === PacketType.BINARY_EVENT ||\n packet.type === PacketType.BINARY_ACK) {\n // binary packet's json\n this.reconstructor = new BinaryReconstructor(packet);\n // no attachments, labeled binary but no binary data to follow\n if (packet.attachments === 0) {\n super.emit(\"decoded\", packet);\n }\n }\n else {\n // non-binary full packet\n super.emit(\"decoded\", packet);\n }\n }\n else if (is_binary_1.isBinary(obj) || obj.base64) {\n // raw binary data\n if (!this.reconstructor) {\n throw new Error(\"got binary data when not reconstructing a packet\");\n }\n else {\n packet = this.reconstructor.takeBinaryData(obj);\n if (packet) {\n // received final buffer\n this.reconstructor = null;\n super.emit(\"decoded\", packet);\n }\n }\n }\n else {\n throw new Error(\"Unknown type: \" + obj);\n }\n }\n /**\n * Decode a packet String (JSON data)\n *\n * @param {String} str\n * @return {Object} packet\n */\n decodeString(str) {\n let i = 0;\n // look up type\n const p = {\n type: Number(str.charAt(0)),\n };\n if (PacketType[p.type] === undefined) {\n throw new Error(\"unknown packet type \" + p.type);\n }\n // look up attachments if type binary\n if (p.type === PacketType.BINARY_EVENT ||\n p.type === PacketType.BINARY_ACK) {\n const start = i + 1;\n while (str.charAt(++i) !== \"-\" && i != str.length) { }\n const buf = str.substring(start, i);\n if (buf != Number(buf) || str.charAt(i) !== \"-\") {\n throw new Error(\"Illegal attachments\");\n }\n p.attachments = Number(buf);\n }\n // look up namespace (if any)\n if (\"/\" === str.charAt(i + 1)) {\n const start = i + 1;\n while (++i) {\n const c = str.charAt(i);\n if (\",\" === c)\n break;\n if (i === str.length)\n break;\n }\n p.nsp = str.substring(start, i);\n }\n else {\n p.nsp = \"/\";\n }\n // look up id\n const next = str.charAt(i + 1);\n if (\"\" !== next && Number(next) == next) {\n const start = i + 1;\n while (++i) {\n const c = str.charAt(i);\n if (null == c || Number(c) != c) {\n --i;\n break;\n }\n if (i === str.length)\n break;\n }\n p.id = Number(str.substring(start, i + 1));\n }\n // look up json data\n if (str.charAt(++i)) {\n const payload = tryParse(str.substr(i));\n if (Decoder.isPayloadValid(p.type, payload)) {\n p.data = payload;\n }\n else {\n throw new Error(\"invalid payload\");\n }\n }\n\n\n return p;\n }\n static isPayloadValid(type, payload) {\n switch (type) {\n case PacketType.CONNECT:\n return typeof payload === \"object\";\n case PacketType.DISCONNECT:\n return payload === undefined;\n case PacketType.CONNECT_ERROR:\n return typeof payload === \"string\" || typeof payload === \"object\";\n case PacketType.EVENT:\n case PacketType.BINARY_EVENT:\n return Array.isArray(payload) && typeof payload[0] === \"string\";\n case PacketType.ACK:\n case PacketType.BINARY_ACK:\n return Array.isArray(payload);\n }\n }\n /**\n * Deallocates a parser's resources\n */\n destroy() {\n if (this.reconstructor) {\n this.reconstructor.finishedReconstruction();\n }\n }\n}\nexports.Decoder = Decoder;\nfunction tryParse(str) {\n try {\n return JSON.parse(str);\n }\n catch (e) {\n return false;\n }\n}\n/**\n * A manager of a binary event's 'buffer sequence'. Should\n * be constructed whenever a packet of type BINARY_EVENT is\n * decoded.\n *\n * @param {Object} packet\n * @return {BinaryReconstructor} initialized reconstructor\n */\nclass BinaryReconstructor {\n constructor(packet) {\n this.packet = packet;\n this.buffers = [];\n this.reconPack = packet;\n }\n /**\n * Method to be called when binary data received from connection\n * after a BINARY_EVENT packet.\n *\n * @param {Buffer | ArrayBuffer} binData - the raw binary data received\n * @return {null | Object} returns null if more binary data is expected or\n * a reconstructed packet object if all buffers have been received.\n */\n takeBinaryData(binData) {\n this.buffers.push(binData);\n if (this.buffers.length === this.reconPack.attachments) {\n // done with buffer list\n const packet = binary_1.reconstructPacket(this.reconPack, this.buffers);\n this.finishedReconstruction();\n return packet;\n }\n return null;\n }\n /**\n * Cleans up binary packet reconstruction variables.\n */\n finishedReconstruction() {\n this.reconPack = null;\n this.buffers = [];\n }\n}\n","/**\n * Parses an URI\n *\n * @author Steven Levithan (MIT license)\n * @api private\n */\n\nvar re = /^(?:(?![^:@]+:[^:@\\/]*@)(http|https|ws|wss):\\/\\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\\/?#]*)(?::(\\d*))?)(((\\/(?:[^?#](?![^?#\\/]*\\.[^?#\\/.]+(?:[?#]|$)))*\\/?)?([^?#\\/]*))(?:\\?([^#]*))?(?:#(.*))?)/;\n\nvar parts = [\n 'source', 'protocol', 'authority', 'userInfo', 'user', 'password', 'host', 'port', 'relative', 'path', 'directory', 'file', 'query', 'anchor'\n];\n\nmodule.exports = function parseuri(str) {\n var src = str,\n b = str.indexOf('['),\n e = str.indexOf(']');\n\n if (b != -1 && e != -1) {\n str = str.substring(0, b) + str.substring(b, e).replace(/:/g, ';') + str.substring(e, str.length);\n }\n\n var m = re.exec(str || ''),\n uri = {},\n i = 14;\n\n while (i--) {\n uri[parts[i]] = m[i] || '';\n }\n\n if (b != -1 && e != -1) {\n uri.source = src;\n uri.host = uri.host.substring(1, uri.host.length - 1).replace(/;/g, ':');\n uri.authority = uri.authority.replace('[', '').replace(']', '').replace(/;/g, ':');\n uri.ipv6uri = true;\n }\n\n uri.pathNames = pathNames(uri, uri['path']);\n uri.queryKey = queryKey(uri, uri['query']);\n\n return uri;\n};\n\nfunction pathNames(obj, path) {\n var regx = /\\/{2,9}/g,\n names = path.replace(regx, \"/\").split(\"/\");\n\n if (path.substr(0, 1) == '/' || path.length === 0) {\n names.splice(0, 1);\n }\n if (path.substr(path.length - 1, 1) == '/') {\n names.splice(names.length - 1, 1);\n }\n\n return names;\n}\n\nfunction queryKey(uri, query) {\n var data = {};\n\n query.replace(/(?:^|&)([^&=]*)=?([^&]*)/g, function ($0, $1, $2) {\n if ($1) {\n data[$1] = $2;\n }\n });\n\n return data;\n}\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Manager = void 0;\nconst eio = require(\"engine.io-client\");\nconst socket_1 = require(\"./socket\");\nconst Emitter = require(\"component-emitter\");\nconst parser = require(\"socket.io-parser\");\nconst on_1 = require(\"./on\");\nconst bind = require(\"component-bind\");\nconst Backoff = require(\"backo2\");\n\n\nclass Manager extends Emitter {\n constructor(uri, opts) {\n super();\n this.nsps = {};\n this.subs = [];\n if (uri && \"object\" === typeof uri) {\n opts = uri;\n uri = undefined;\n }\n opts = opts || {};\n opts.path = opts.path || \"/socket.io\";\n this.opts = opts;\n this.reconnection(opts.reconnection !== false);\n this.reconnectionAttempts(opts.reconnectionAttempts || Infinity);\n this.reconnectionDelay(opts.reconnectionDelay || 1000);\n this.reconnectionDelayMax(opts.reconnectionDelayMax || 5000);\n this.randomizationFactor(opts.randomizationFactor || 0.5);\n this.backoff = new Backoff({\n min: this.reconnectionDelay(),\n max: this.reconnectionDelayMax(),\n jitter: this.randomizationFactor(),\n });\n this.timeout(null == opts.timeout ? 20000 : opts.timeout);\n this._readyState = \"closed\";\n this.uri = uri;\n const _parser = opts.parser || parser;\n this.encoder = new _parser.Encoder();\n this.decoder = new _parser.Decoder();\n this._autoConnect = opts.autoConnect !== false;\n if (this._autoConnect)\n this.open();\n }\n reconnection(v) {\n if (!arguments.length)\n return this._reconnection;\n this._reconnection = !!v;\n return this;\n }\n reconnectionAttempts(v) {\n if (v === undefined)\n return this._reconnectionAttempts;\n this._reconnectionAttempts = v;\n return this;\n }\n reconnectionDelay(v) {\n var _a;\n if (v === undefined)\n return this._reconnectionDelay;\n this._reconnectionDelay = v;\n (_a = this.backoff) === null || _a === void 0 ? void 0 : _a.setMin(v);\n return this;\n }\n randomizationFactor(v) {\n var _a;\n if (v === undefined)\n return this._randomizationFactor;\n this._randomizationFactor = v;\n (_a = this.backoff) === null || _a === void 0 ? void 0 : _a.setJitter(v);\n return this;\n }\n reconnectionDelayMax(v) {\n var _a;\n if (v === undefined)\n return this._reconnectionDelayMax;\n this._reconnectionDelayMax = v;\n (_a = this.backoff) === null || _a === void 0 ? void 0 : _a.setMax(v);\n return this;\n }\n timeout(v) {\n if (!arguments.length)\n return this._timeout;\n this._timeout = v;\n return this;\n }\n /**\n * Starts trying to reconnect if reconnection is enabled and we have not\n * started reconnecting yet\n *\n * @private\n */\n maybeReconnectOnOpen() {\n // Only try to reconnect if it's the first time we're connecting\n if (!this._reconnecting &&\n this._reconnection &&\n this.backoff.attempts === 0) {\n // keeps reconnection from firing twice for the same reconnection loop\n this.reconnect();\n }\n }\n /**\n * Sets the current transport `socket`.\n *\n * @param {Function} fn - optional, callback\n * @return self\n * @public\n */\n open(fn) {\n\n\n if (~this._readyState.indexOf(\"open\"))\n return this;\n\n\n this.engine = eio(this.uri, this.opts);\n const socket = this.engine;\n const self = this;\n this._readyState = \"opening\";\n this.skipReconnect = false;\n // emit `open`\n const openSub = on_1.on(socket, \"open\", function () {\n self.onopen();\n fn && fn();\n });\n // emit `error`\n const errorSub = on_1.on(socket, \"error\", (err) => {\n\n\n self.cleanup();\n self._readyState = \"closed\";\n super.emit(\"error\", err);\n if (fn) {\n fn(err);\n }\n else {\n // Only do this if there is no fn to handle the error\n self.maybeReconnectOnOpen();\n }\n });\n if (false !== this._timeout) {\n const timeout = this._timeout;\n\n\n if (timeout === 0) {\n openSub.destroy(); // prevents a race condition with the 'open' event\n }\n // set timer\n const timer = setTimeout(() => {\n\n\n openSub.destroy();\n socket.close();\n socket.emit(\"error\", new Error(\"timeout\"));\n }, timeout);\n this.subs.push({\n destroy: function () {\n clearTimeout(timer);\n },\n });\n }\n this.subs.push(openSub);\n this.subs.push(errorSub);\n return this;\n }\n /**\n * Alias for open()\n *\n * @return {Manager} self\n * @public\n */\n connect(fn) {\n return this.open(fn);\n }\n /**\n * Called upon transport open.\n *\n * @private\n */\n onopen() {\n\n\n // clear old subs\n this.cleanup();\n // mark as open\n this._readyState = \"open\";\n super.emit(\"open\");\n // add new subs\n const socket = this.engine;\n this.subs.push(on_1.on(socket, \"data\", bind(this, \"ondata\")), on_1.on(socket, \"ping\", bind(this, \"onping\")), on_1.on(socket, \"error\", bind(this, \"onerror\")), on_1.on(socket, \"close\", bind(this, \"onclose\")), on_1.on(this.decoder, \"decoded\", bind(this, \"ondecoded\")));\n }\n /**\n * Called upon a ping.\n *\n * @private\n */\n onping() {\n super.emit(\"ping\");\n }\n /**\n * Called with data.\n *\n * @private\n */\n ondata(data) {\n this.decoder.add(data);\n }\n /**\n * Called when parser fully decodes a packet.\n *\n * @private\n */\n ondecoded(packet) {\n super.emit(\"packet\", packet);\n }\n /**\n * Called upon socket error.\n *\n * @private\n */\n onerror(err) {\n\n\n super.emit(\"error\", err);\n }\n /**\n * Creates a new socket for the given `nsp`.\n *\n * @return {Socket}\n * @public\n */\n socket(nsp, opts) {\n let socket = this.nsps[nsp];\n if (!socket) {\n socket = new socket_1.Socket(this, nsp, opts);\n this.nsps[nsp] = socket;\n }\n return socket;\n }\n /**\n * Called upon a socket close.\n *\n * @param socket\n * @private\n */\n _destroy(socket) {\n const nsps = Object.keys(this.nsps);\n for (const nsp of nsps) {\n const socket = this.nsps[nsp];\n if (socket.active) {\n\n\n return;\n }\n }\n this._close();\n }\n /**\n * Writes a packet.\n *\n * @param packet\n * @private\n */\n _packet(packet) {\n\n\n if (packet.query && packet.type === 0)\n packet.nsp += \"?\" + packet.query;\n const encodedPackets = this.encoder.encode(packet);\n for (let i = 0; i < encodedPackets.length; i++) {\n this.engine.write(encodedPackets[i], packet.options);\n }\n }\n /**\n * Clean up transport subscriptions and packet buffer.\n *\n * @private\n */\n cleanup() {\n\n\n const subsLength = this.subs.length;\n for (let i = 0; i < subsLength; i++) {\n const sub = this.subs.shift();\n sub.destroy();\n }\n this.decoder.destroy();\n }\n /**\n * Close the current socket.\n *\n * @private\n */\n _close() {\n\n\n this.skipReconnect = true;\n this._reconnecting = false;\n if (\"opening\" === this._readyState) {\n // `onclose` will not fire because\n // an open event never happened\n this.cleanup();\n }\n this.backoff.reset();\n this._readyState = \"closed\";\n if (this.engine)\n this.engine.close();\n }\n /**\n * Alias for close()\n *\n * @private\n */\n disconnect() {\n return this._close();\n }\n /**\n * Called upon engine close.\n *\n * @private\n */\n onclose(reason) {\n\n\n this.cleanup();\n this.backoff.reset();\n this._readyState = \"closed\";\n super.emit(\"close\", reason);\n if (this._reconnection && !this.skipReconnect) {\n this.reconnect();\n }\n }\n /**\n * Attempt a reconnection.\n *\n * @private\n */\n reconnect() {\n if (this._reconnecting || this.skipReconnect)\n return this;\n const self = this;\n if (this.backoff.attempts >= this._reconnectionAttempts) {\n\n\n this.backoff.reset();\n super.emit(\"reconnect_failed\");\n this._reconnecting = false;\n }\n else {\n const delay = this.backoff.duration();\n\n\n this._reconnecting = true;\n const timer = setTimeout(() => {\n if (self.skipReconnect)\n return;\n\n\n super.emit(\"reconnect_attempt\", self.backoff.attempts);\n // check again for the case socket closed in above events\n if (self.skipReconnect)\n return;\n self.open((err) => {\n if (err) {\n\n\n self._reconnecting = false;\n self.reconnect();\n super.emit(\"reconnect_error\", err);\n }\n else {\n\n\n self.onreconnect();\n }\n });\n }, delay);\n this.subs.push({\n destroy: function () {\n clearTimeout(timer);\n },\n });\n }\n }\n /**\n * Called upon successful reconnect.\n *\n * @private\n */\n onreconnect() {\n const attempt = this.backoff.attempts;\n this._reconnecting = false;\n this.backoff.reset();\n super.emit(\"reconnect\", attempt);\n }\n}\nexports.Manager = Manager;\n","const XMLHttpRequest = require(\"xmlhttprequest-ssl\");\nconst XHR = require(\"./polling-xhr\");\nconst JSONP = require(\"./polling-jsonp\");\nconst websocket = require(\"./websocket\");\n\nexports.polling = polling;\nexports.websocket = websocket;\n\n/**\n * Polling transport polymorphic constructor.\n * Decides on xhr vs jsonp based on feature detection.\n *\n * @api private\n */\n\nfunction polling(opts) {\n let xhr;\n let xd = false;\n let xs = false;\n const jsonp = false !== opts.jsonp;\n\n if (typeof location !== \"undefined\") {\n const isSSL = \"https:\" === location.protocol;\n let port = location.port;\n\n // some user agents have empty `location.port`\n if (!port) {\n port = isSSL ? 443 : 80;\n }\n\n xd = opts.hostname !== location.hostname || port !== opts.port;\n xs = opts.secure !== isSSL;\n }\n\n opts.xdomain = xd;\n opts.xscheme = xs;\n xhr = new XMLHttpRequest(opts);\n\n if (\"open\" in xhr && !opts.forceJSONP) {\n return new XHR(opts);\n } else {\n if (!jsonp) throw new Error(\"JSONP disabled\");\n return new JSONP(opts);\n }\n}\n","// browser shim for xmlhttprequest module\n\nconst hasCORS = require(\"has-cors\");\nconst globalThis = require(\"./globalThis\");\n\nmodule.exports = function(opts) {\n const xdomain = opts.xdomain;\n\n // scheme must be same when usign XDomainRequest\n // http://blogs.msdn.com/b/ieinternals/archive/2010/05/13/xdomainrequest-restrictions-limitations-and-workarounds.aspx\n const xscheme = opts.xscheme;\n\n // XDomainRequest has a flow of not sending cookie, therefore it should be disabled as a default.\n // https://github.com/Automattic/engine.io-client/pull/217\n const enablesXDR = opts.enablesXDR;\n\n // XMLHttpRequest can be disabled on IE\n try {\n if (\"undefined\" !== typeof XMLHttpRequest && (!xdomain || hasCORS)) {\n return new XMLHttpRequest();\n }\n } catch (e) {}\n\n // Use XDomainRequest for IE8 if enablesXDR is true\n // because loading bar keeps flashing when using jsonp-polling\n // https://github.com/yujiosaka/socke.io-ie8-loading-example\n try {\n if (\"undefined\" !== typeof XDomainRequest && !xscheme && enablesXDR) {\n return new XDomainRequest();\n }\n } catch (e) {}\n\n if (!xdomain) {\n try {\n return new globalThis[[\"Active\"].concat(\"Object\").join(\"X\")](\n \"Microsoft.XMLHTTP\"\n );\n } catch (e) {}\n }\n};\n","const Transport = require(\"../transport\");\nconst parseqs = require(\"parseqs\");\nconst parser = require(\"engine.io-parser\");\nconst yeast = require(\"yeast\");\n\n\n\n\nclass Polling extends Transport {\n /**\n * Transport name.\n */\n get name() {\n return \"polling\";\n }\n\n /**\n * Opens the socket (triggers polling). We write a PING message to determine\n * when the transport is open.\n *\n * @api private\n */\n doOpen() {\n this.poll();\n }\n\n /**\n * Pauses polling.\n *\n * @param {Function} callback upon buffers are flushed and transport is paused\n * @api private\n */\n pause(onPause) {\n const self = this;\n\n this.readyState = \"pausing\";\n\n function pause() {\n\n\n self.readyState = \"paused\";\n onPause();\n }\n\n if (this.polling || !this.writable) {\n let total = 0;\n\n if (this.polling) {\n\n\n total++;\n this.once(\"pollComplete\", function() {\n\n\n --total || pause();\n });\n }\n\n if (!this.writable) {\n\n\n total++;\n this.once(\"drain\", function() {\n\n\n --total || pause();\n });\n }\n } else {\n pause();\n }\n }\n\n /**\n * Starts polling cycle.\n *\n * @api public\n */\n poll() {\n\n\n this.polling = true;\n this.doPoll();\n this.emit(\"poll\");\n }\n\n /**\n * Overloads onData to detect payloads.\n *\n * @api private\n */\n onData(data) {\n const self = this;\n\n\n const callback = function(packet, index, total) {\n // if its the first message we consider the transport open\n if (\"opening\" === self.readyState && packet.type === \"open\") {\n self.onOpen();\n }\n\n // if its a close packet, we close the ongoing requests\n if (\"close\" === packet.type) {\n self.onClose();\n return false;\n }\n\n // otherwise bypass onData and handle the message\n self.onPacket(packet);\n };\n\n // decode payload\n parser.decodePayload(data, this.socket.binaryType).forEach(callback);\n\n // if an event did not trigger closing\n if (\"closed\" !== this.readyState) {\n // if we got data we're not polling\n this.polling = false;\n this.emit(\"pollComplete\");\n\n if (\"open\" === this.readyState) {\n this.poll();\n } else {\n\n\n }\n }\n }\n\n /**\n * For polling, send a close packet.\n *\n * @api private\n */\n doClose() {\n const self = this;\n\n function close() {\n\n\n self.write([{ type: \"close\" }]);\n }\n\n if (\"open\" === this.readyState) {\n\n\n close();\n } else {\n // in case we're trying to close while\n // handshaking is in progress (GH-164)\n\n\n this.once(\"open\", close);\n }\n }\n\n /**\n * Writes a packets payload.\n *\n * @param {Array} data packets\n * @param {Function} drain callback\n * @api private\n */\n write(packets) {\n this.writable = false;\n\n parser.encodePayload(packets, data => {\n this.doWrite(data, () => {\n this.writable = true;\n this.emit(\"drain\");\n });\n });\n }\n\n /**\n * Generates uri for connection.\n *\n * @api private\n */\n uri() {\n let query = this.query || {};\n const schema = this.opts.secure ? \"https\" : \"http\";\n let port = \"\";\n\n // cache busting is forced\n if (false !== this.opts.timestampRequests) {\n query[this.opts.timestampParam] = yeast();\n }\n\n if (!this.supportsBinary && !query.sid) {\n query.b64 = 1;\n }\n\n query = parseqs.encode(query);\n\n // avoid port if default for schema\n if (\n this.opts.port &&\n ((\"https\" === schema && Number(this.opts.port) !== 443) ||\n (\"http\" === schema && Number(this.opts.port) !== 80))\n ) {\n port = \":\" + this.opts.port;\n }\n\n // prepend ? to query\n if (query.length) {\n query = \"?\" + query;\n }\n\n const ipv6 = this.opts.hostname.indexOf(\":\") !== -1;\n return (\n schema +\n \"://\" +\n (ipv6 ? \"[\" + this.opts.hostname + \"]\" : this.opts.hostname) +\n port +\n this.opts.path +\n query\n );\n }\n}\n\nmodule.exports = Polling;\n","const PACKET_TYPES = Object.create(null); // no Map = no polyfill\nPACKET_TYPES[\"open\"] = \"0\";\nPACKET_TYPES[\"close\"] = \"1\";\nPACKET_TYPES[\"ping\"] = \"2\";\nPACKET_TYPES[\"pong\"] = \"3\";\nPACKET_TYPES[\"message\"] = \"4\";\nPACKET_TYPES[\"upgrade\"] = \"5\";\nPACKET_TYPES[\"noop\"] = \"6\";\n\nconst PACKET_TYPES_REVERSE = Object.create(null);\nObject.keys(PACKET_TYPES).forEach(key => {\n PACKET_TYPES_REVERSE[PACKET_TYPES[key]] = key;\n});\n\nconst ERROR_PACKET = { type: \"error\", data: \"parser error\" };\n\nmodule.exports = {\n PACKET_TYPES,\n PACKET_TYPES_REVERSE,\n ERROR_PACKET\n};\n","'use strict';\n\nvar alphabet = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_'.split('')\n , length = 64\n , map = {}\n , seed = 0\n , i = 0\n , prev;\n\n/**\n * Return a string representing the specified number.\n *\n * @param {Number} num The number to convert.\n * @returns {String} The string representation of the number.\n * @api public\n */\nfunction encode(num) {\n var encoded = '';\n\n do {\n encoded = alphabet[num % length] + encoded;\n num = Math.floor(num / length);\n } while (num > 0);\n\n return encoded;\n}\n\n/**\n * Return the integer value specified by the given string.\n *\n * @param {String} str The string to convert.\n * @returns {Number} The integer value represented by the string.\n * @api public\n */\nfunction decode(str) {\n var decoded = 0;\n\n for (i = 0; i < str.length; i++) {\n decoded = decoded * length + map[str.charAt(i)];\n }\n\n return decoded;\n}\n\n/**\n * Yeast: A tiny growing id generator.\n *\n * @returns {String} A unique id.\n * @api public\n */\nfunction yeast() {\n var now = encode(+new Date());\n\n if (now !== prev) return seed = 0, prev = now;\n return now +'.'+ encode(seed++);\n}\n\n//\n// Map each character to its index.\n//\nfor (; i < length; i++) map[alphabet[i]] = i;\n\n//\n// Expose the `yeast`, `encode` and `decode` functions.\n//\nyeast.encode = encode;\nyeast.decode = decode;\nmodule.exports = yeast;\n","module.exports.pick = (obj, ...attr) => {\n return attr.reduce((acc, k) => {\n acc[k] = obj[k];\n return acc;\n }, {});\n};\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Socket = void 0;\nconst socket_io_parser_1 = require(\"socket.io-parser\");\nconst Emitter = require(\"component-emitter\");\nconst on_1 = require(\"./on\");\nconst bind = require(\"component-bind\");\n\n\n/**\n * Internal events.\n * These events can't be emitted by the user.\n */\nconst RESERVED_EVENTS = Object.freeze({\n connect: 1,\n connect_error: 1,\n disconnect: 1,\n disconnecting: 1,\n // EventEmitter reserved events: https://nodejs.org/api/events.html#events_event_newlistener\n newListener: 1,\n removeListener: 1,\n});\nclass Socket extends Emitter {\n /**\n * `Socket` constructor.\n *\n * @public\n */\n constructor(io, nsp, opts) {\n super();\n this.ids = 0;\n this.acks = {};\n this.receiveBuffer = [];\n this.sendBuffer = [];\n this.flags = {};\n this.io = io;\n this.nsp = nsp;\n this.ids = 0;\n this.acks = {};\n this.receiveBuffer = [];\n this.sendBuffer = [];\n this.connected = false;\n this.disconnected = true;\n this.flags = {};\n if (opts && opts.auth) {\n this.auth = opts.auth;\n }\n if (this.io._autoConnect)\n this.open();\n }\n /**\n * Subscribe to open, close and packet events\n *\n * @private\n */\n subEvents() {\n if (this.subs)\n return;\n const io = this.io;\n this.subs = [\n on_1.on(io, \"open\", bind(this, \"onopen\")),\n on_1.on(io, \"packet\", bind(this, \"onpacket\")),\n on_1.on(io, \"close\", bind(this, \"onclose\")),\n ];\n }\n /**\n * Whether the Socket will try to reconnect when its Manager connects or reconnects\n */\n get active() {\n return !!this.subs;\n }\n /**\n * \"Opens\" the socket.\n *\n * @public\n */\n connect() {\n if (this.connected)\n return this;\n this.subEvents();\n if (!this.io[\"_reconnecting\"])\n this.io.open(); // ensure open\n if (\"open\" === this.io._readyState)\n this.onopen();\n return this;\n }\n /**\n * Alias for connect()\n */\n open() {\n return this.connect();\n }\n /**\n * Sends a `message` event.\n *\n * @return self\n * @public\n */\n send(...args) {\n args.unshift(\"message\");\n this.emit.apply(this, args);\n return this;\n }\n /**\n * Override `emit`.\n * If the event is in `events`, it's emitted normally.\n *\n * @param ev - event name\n * @return self\n * @public\n */\n emit(ev, ...args) {\n if (RESERVED_EVENTS.hasOwnProperty(ev)) {\n throw new Error('\"' + ev + '\" is a reserved event name');\n }\n args.unshift(ev);\n const packet = {\n type: socket_io_parser_1.PacketType.EVENT,\n data: args,\n };\n packet.options = {};\n packet.options.compress = this.flags.compress !== false;\n // event ack callback\n if (\"function\" === typeof args[args.length - 1]) {\n\n\n this.acks[this.ids] = args.pop();\n packet.id = this.ids++;\n }\n const isTransportWritable = this.io.engine &&\n this.io.engine.transport &&\n this.io.engine.transport.writable;\n const discardPacket = this.flags.volatile && (!isTransportWritable || !this.connected);\n if (discardPacket) {\n\n\n }\n else if (this.connected) {\n this.packet(packet);\n }\n else {\n this.sendBuffer.push(packet);\n }\n this.flags = {};\n return this;\n }\n /**\n * Sends a packet.\n *\n * @param packet\n * @private\n */\n packet(packet) {\n packet.nsp = this.nsp;\n this.io._packet(packet);\n }\n /**\n * Called upon engine `open`.\n *\n * @private\n */\n onopen() {\n\n\n if (typeof this.auth == \"function\") {\n this.auth((data) => {\n this.packet({ type: socket_io_parser_1.PacketType.CONNECT, data });\n });\n }\n else {\n this.packet({ type: socket_io_parser_1.PacketType.CONNECT, data: this.auth });\n }\n }\n /**\n * Called upon engine `close`.\n *\n * @param reason\n * @private\n */\n onclose(reason) {\n\n\n this.connected = false;\n this.disconnected = true;\n delete this.id;\n super.emit(\"disconnect\", reason);\n }\n /**\n * Called with socket packet.\n *\n * @param packet\n * @private\n */\n onpacket(packet) {\n const sameNamespace = packet.nsp === this.nsp;\n if (!sameNamespace)\n return;\n switch (packet.type) {\n case socket_io_parser_1.PacketType.CONNECT:\n if (packet.data && packet.data.sid) {\n const id = packet.data.sid;\n this.onconnect(id);\n }\n else {\n super.emit(\"connect_error\", new Error(\"It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)\"));\n }\n break;\n case socket_io_parser_1.PacketType.EVENT:\n this.onevent(packet);\n break;\n case socket_io_parser_1.PacketType.BINARY_EVENT:\n this.onevent(packet);\n break;\n case socket_io_parser_1.PacketType.ACK:\n this.onack(packet);\n break;\n case socket_io_parser_1.PacketType.BINARY_ACK:\n this.onack(packet);\n break;\n case socket_io_parser_1.PacketType.DISCONNECT:\n this.ondisconnect();\n break;\n case socket_io_parser_1.PacketType.CONNECT_ERROR:\n const err = new Error(packet.data.message);\n // @ts-ignore\n err.data = packet.data.data;\n super.emit(\"connect_error\", err);\n break;\n }\n }\n /**\n * Called upon a server event.\n *\n * @param packet\n * @private\n */\n onevent(packet) {\n const args = packet.data || [];\n\n\n if (null != packet.id) {\n\n\n args.push(this.ack(packet.id));\n }\n if (this.connected) {\n this.emitEvent(args);\n }\n else {\n this.receiveBuffer.push(Object.freeze(args));\n }\n }\n emitEvent(args) {\n if (this._anyListeners && this._anyListeners.length) {\n const listeners = this._anyListeners.slice();\n for (const listener of listeners) {\n listener.apply(this, args);\n }\n }\n super.emit.apply(this, args);\n }\n /**\n * Produces an ack callback to emit with an event.\n *\n * @private\n */\n ack(id) {\n const self = this;\n let sent = false;\n return function (...args) {\n // prevent double callbacks\n if (sent)\n return;\n sent = true;\n\n\n self.packet({\n type: socket_io_parser_1.PacketType.ACK,\n id: id,\n data: args,\n });\n };\n }\n /**\n * Called upon a server acknowlegement.\n *\n * @param packet\n * @private\n */\n onack(packet) {\n const ack = this.acks[packet.id];\n if (\"function\" === typeof ack) {\n\n\n ack.apply(this, packet.data);\n delete this.acks[packet.id];\n }\n else {\n\n\n }\n }\n /**\n * Called upon server connect.\n *\n * @private\n */\n onconnect(id) {\n\n\n this.id = id;\n this.connected = true;\n this.disconnected = false;\n super.emit(\"connect\");\n this.emitBuffered();\n }\n /**\n * Emit buffered events (received and emitted).\n *\n * @private\n */\n emitBuffered() {\n this.receiveBuffer.forEach((args) => this.emitEvent(args));\n this.receiveBuffer = [];\n this.sendBuffer.forEach((packet) => this.packet(packet));\n this.sendBuffer = [];\n }\n /**\n * Called upon server disconnect.\n *\n * @private\n */\n ondisconnect() {\n\n\n this.destroy();\n this.onclose(\"io server disconnect\");\n }\n /**\n * Called upon forced client/server side disconnections,\n * this method ensures the manager stops tracking us and\n * that reconnections don't get triggered for this.\n *\n * @private\n */\n destroy() {\n if (this.subs) {\n // clean subscriptions to avoid reconnections\n for (let i = 0; i < this.subs.length; i++) {\n this.subs[i].destroy();\n }\n this.subs = null;\n }\n this.io[\"_destroy\"](this);\n }\n /**\n * Disconnects the socket manually.\n *\n * @return self\n * @public\n */\n disconnect() {\n if (this.connected) {\n\n\n this.packet({ type: socket_io_parser_1.PacketType.DISCONNECT });\n }\n // remove socket from pool\n this.destroy();\n if (this.connected) {\n // fire events\n this.onclose(\"io client disconnect\");\n }\n return this;\n }\n /**\n * Alias for disconnect()\n *\n * @return self\n * @public\n */\n close() {\n return this.disconnect();\n }\n /**\n * Sets the compress flag.\n *\n * @param compress - if `true`, compresses the sending data\n * @return self\n * @public\n */\n compress(compress) {\n this.flags.compress = compress;\n return this;\n }\n /**\n * Sets a modifier for a subsequent event emission that the event message will be dropped when this socket is not\n * ready to send messages.\n *\n * @returns self\n * @public\n */\n get volatile() {\n this.flags.volatile = true;\n return this;\n }\n /**\n * Adds a listener that will be fired when any event is emitted. The event name is passed as the first argument to the\n * callback.\n *\n * @param listener\n * @public\n */\n onAny(listener) {\n this._anyListeners = this._anyListeners || [];\n this._anyListeners.push(listener);\n return this;\n }\n /**\n * Adds a listener that will be fired when any event is emitted. The event name is passed as the first argument to the\n * callback. The listener is added to the beginning of the listeners array.\n *\n * @param listener\n * @public\n */\n prependAny(listener) {\n this._anyListeners = this._anyListeners || [];\n this._anyListeners.unshift(listener);\n return this;\n }\n /**\n * Removes the listener that will be fired when any event is emitted.\n *\n * @param listener\n * @public\n */\n offAny(listener) {\n if (!this._anyListeners) {\n return this;\n }\n if (listener) {\n const listeners = this._anyListeners;\n for (let i = 0; i < listeners.length; i++) {\n if (listener === listeners[i]) {\n listeners.splice(i, 1);\n return this;\n }\n }\n }\n else {\n this._anyListeners = [];\n }\n return this;\n }\n /**\n * Returns an array of listeners that are listening for any event that is specified. This array can be manipulated,\n * e.g. to remove listeners.\n *\n * @public\n */\n listenersAny() {\n return this._anyListeners || [];\n }\n}\nexports.Socket = Socket;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.hasBinary = exports.isBinary = void 0;\nconst withNativeArrayBuffer = typeof ArrayBuffer === \"function\";\nconst isView = (obj) => {\n return typeof ArrayBuffer.isView === \"function\"\n ? ArrayBuffer.isView(obj)\n : obj.buffer instanceof ArrayBuffer;\n};\nconst toString = Object.prototype.toString;\nconst withNativeBlob = typeof Blob === \"function\" ||\n (typeof Blob !== \"undefined\" &&\n toString.call(Blob) === \"[object BlobConstructor]\");\nconst withNativeFile = typeof File === \"function\" ||\n (typeof File !== \"undefined\" &&\n toString.call(File) === \"[object FileConstructor]\");\n/**\n * Returns true if obj is a Buffer, an ArrayBuffer, a Blob or a File.\n *\n * @private\n */\nfunction isBinary(obj) {\n return ((withNativeArrayBuffer && (obj instanceof ArrayBuffer || isView(obj))) ||\n (withNativeBlob && obj instanceof Blob) ||\n (withNativeFile && obj instanceof File));\n}\nexports.isBinary = isBinary;\nfunction hasBinary(obj, toJSON) {\n if (!obj || typeof obj !== \"object\") {\n return false;\n }\n if (Array.isArray(obj)) {\n for (let i = 0, l = obj.length; i < l; i++) {\n if (hasBinary(obj[i])) {\n return true;\n }\n }\n return false;\n }\n if (isBinary(obj)) {\n return true;\n }\n if (obj.toJSON &&\n typeof obj.toJSON === \"function\" &&\n arguments.length === 1) {\n return hasBinary(obj.toJSON(), true);\n }\n for (const key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key) && hasBinary(obj[key])) {\n return true;\n }\n }\n return false;\n}\nexports.hasBinary = hasBinary;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.on = void 0;\nfunction on(obj, ev, fn) {\n obj.on(ev, fn);\n return {\n destroy: function () {\n obj.off(ev, fn);\n },\n };\n}\nexports.on = on;\n","/**\n * Slice reference.\n */\n\nvar slice = [].slice;\n\n/**\n * Bind `obj` to `fn`.\n *\n * @param {Object} obj\n * @param {Function|String} fn or string\n * @return {Function}\n * @api public\n */\n\nmodule.exports = function(obj, fn){\n if ('string' == typeof fn) fn = obj[fn];\n if ('function' != typeof fn) throw new Error('bind() requires a function');\n var args = slice.call(arguments, 2);\n return function(){\n return fn.apply(obj, args.concat(slice.call(arguments)));\n }\n};\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Socket = exports.io = exports.Manager = exports.protocol = void 0;\nconst url_1 = require(\"./url\");\nconst manager_1 = require(\"./manager\");\nconst socket_1 = require(\"./socket\");\nObject.defineProperty(exports, \"Socket\", { enumerable: true, get: function () { return socket_1.Socket; } });\n\n\n/**\n * Module exports.\n */\nmodule.exports = exports = lookup;\n/**\n * Managers cache.\n */\nconst cache = (exports.managers = {});\nfunction lookup(uri, opts) {\n if (typeof uri === \"object\") {\n opts = uri;\n uri = undefined;\n }\n opts = opts || {};\n const parsed = url_1.url(uri);\n const source = parsed.source;\n const id = parsed.id;\n const path = parsed.path;\n const sameNamespace = cache[id] && path in cache[id][\"nsps\"];\n const newConnection = opts.forceNew ||\n opts[\"force new connection\"] ||\n false === opts.multiplex ||\n sameNamespace;\n let io;\n if (newConnection) {\n\n\n io = new manager_1.Manager(source, opts);\n }\n else {\n if (!cache[id]) {\n\n\n cache[id] = new manager_1.Manager(source, opts);\n }\n io = cache[id];\n }\n if (parsed.query && !opts.query) {\n opts.query = parsed.query;\n }\n return io.socket(parsed.path, opts);\n}\nexports.io = lookup;\n/**\n * Protocol version.\n *\n * @public\n */\nvar socket_io_parser_1 = require(\"socket.io-parser\");\nObject.defineProperty(exports, \"protocol\", { enumerable: true, get: function () { return socket_io_parser_1.protocol; } });\n/**\n * `connect`.\n *\n * @param {String} uri\n * @public\n */\nexports.connect = lookup;\n/**\n * Expose constructors for standalone build.\n *\n * @public\n */\nvar manager_2 = require(\"./manager\");\nObject.defineProperty(exports, \"Manager\", { enumerable: true, get: function () { return manager_2.Manager; } });\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.url = void 0;\nconst parseuri = require(\"parseuri\");\n\n\n/**\n * URL parser.\n *\n * @param uri - url\n * @param loc - An object meant to mimic window.location.\n * Defaults to window.location.\n * @public\n */\nfunction url(uri, loc) {\n let obj = uri;\n // default to window.location\n loc = loc || (typeof location !== \"undefined\" && location);\n if (null == uri)\n uri = loc.protocol + \"//\" + loc.host;\n // relative path support\n if (typeof uri === \"string\") {\n if (\"/\" === uri.charAt(0)) {\n if (\"/\" === uri.charAt(1)) {\n uri = loc.protocol + uri;\n }\n else {\n uri = loc.host + uri;\n }\n }\n if (!/^(https?|wss?):\\/\\//.test(uri)) {\n\n\n if (\"undefined\" !== typeof loc) {\n uri = loc.protocol + \"//\" + uri;\n }\n else {\n uri = \"https://\" + uri;\n }\n }\n // parse\n\n\n obj = parseuri(uri);\n }\n // make sure we treat `localhost:80` and `localhost` equally\n if (!obj.port) {\n if (/^(http|ws)$/.test(obj.protocol)) {\n obj.port = \"80\";\n }\n else if (/^(http|ws)s$/.test(obj.protocol)) {\n obj.port = \"443\";\n }\n }\n obj.path = obj.path || \"/\";\n const ipv6 = obj.host.indexOf(\":\") !== -1;\n const host = ipv6 ? \"[\" + obj.host + \"]\" : obj.host;\n // define unique id\n obj.id = obj.protocol + \"://\" + host + \":\" + obj.port;\n // define href\n obj.href =\n obj.protocol +\n \"://\" +\n host +\n (loc && loc.port === obj.port ? \"\" : \":\" + obj.port);\n return obj;\n}\nexports.url = url;\n","const Socket = require(\"./socket\");\n\nmodule.exports = (uri, opts) => new Socket(uri, opts);\n\n/**\n * Expose deps for legacy compatibility\n * and standalone browser access.\n */\n\nmodule.exports.Socket = Socket;\nmodule.exports.protocol = Socket.protocol; // this is an int\nmodule.exports.Transport = require(\"./transport\");\nmodule.exports.transports = require(\"./transports/index\");\nmodule.exports.parser = require(\"engine.io-parser\");\n","const transports = require(\"./transports/index\");\nconst Emitter = require(\"component-emitter\");\n\n\nconst parser = require(\"engine.io-parser\");\nconst parseuri = require(\"parseuri\");\nconst parseqs = require(\"parseqs\");\n\nclass Socket extends Emitter {\n /**\n * Socket constructor.\n *\n * @param {String|Object} uri or options\n * @param {Object} options\n * @api public\n */\n constructor(uri, opts = {}) {\n super();\n\n if (uri && \"object\" === typeof uri) {\n opts = uri;\n uri = null;\n }\n\n if (uri) {\n uri = parseuri(uri);\n opts.hostname = uri.host;\n opts.secure = uri.protocol === \"https\" || uri.protocol === \"wss\";\n opts.port = uri.port;\n if (uri.query) opts.query = uri.query;\n } else if (opts.host) {\n opts.hostname = parseuri(opts.host).host;\n }\n\n this.secure =\n null != opts.secure\n ? opts.secure\n : typeof location !== \"undefined\" && \"https:\" === location.protocol;\n\n if (opts.hostname && !opts.port) {\n // if no port is specified manually, use the protocol default\n opts.port = this.secure ? \"443\" : \"80\";\n }\n\n this.hostname =\n opts.hostname ||\n (typeof location !== \"undefined\" ? location.hostname : \"localhost\");\n this.port =\n opts.port ||\n (typeof location !== \"undefined\" && location.port\n ? location.port\n : this.secure\n ? 443\n : 80);\n\n this.transports = opts.transports || [\"polling\", \"websocket\"];\n this.readyState = \"\";\n this.writeBuffer = [];\n this.prevBufferLen = 0;\n\n this.opts = Object.assign(\n {\n path: \"/engine.io\",\n agent: false,\n withCredentials: false,\n upgrade: true,\n jsonp: true,\n timestampParam: \"t\",\n rememberUpgrade: false,\n rejectUnauthorized: true,\n perMessageDeflate: {\n threshold: 1024\n },\n transportOptions: {}\n },\n opts\n );\n\n this.opts.path = this.opts.path.replace(/\\/$/, \"\") + \"/\";\n\n if (typeof this.opts.query === \"string\") {\n this.opts.query = parseqs.decode(this.opts.query);\n }\n\n // set on handshake\n this.id = null;\n this.upgrades = null;\n this.pingInterval = null;\n this.pingTimeout = null;\n\n // set on heartbeat\n this.pingTimeoutTimer = null;\n\n this.open();\n }\n\n /**\n * Creates transport of the given type.\n *\n * @param {String} transport name\n * @return {Transport}\n * @api private\n */\n createTransport(name) {\n\n\n const query = clone(this.opts.query);\n\n // append engine.io protocol identifier\n query.EIO = parser.protocol;\n\n // transport name\n query.transport = name;\n\n // session id if we already have one\n if (this.id) query.sid = this.id;\n\n const opts = Object.assign(\n {},\n this.opts.transportOptions[name],\n this.opts,\n {\n query,\n socket: this,\n hostname: this.hostname,\n secure: this.secure,\n port: this.port\n }\n );\n\n\n\n\n return new transports[name](opts);\n }\n\n /**\n * Initializes transport to use and starts probe.\n *\n * @api private\n */\n open() {\n let transport;\n if (\n this.opts.rememberUpgrade &&\n Socket.priorWebsocketSuccess &&\n this.transports.indexOf(\"websocket\") !== -1\n ) {\n transport = \"websocket\";\n } else if (0 === this.transports.length) {\n // Emit error on next tick so it can be listened to\n const self = this;\n setTimeout(function() {\n self.emit(\"error\", \"No transports available\");\n }, 0);\n return;\n } else {\n transport = this.transports[0];\n }\n this.readyState = \"opening\";\n\n // Retry with the next transport if the transport is disabled (jsonp: false)\n try {\n transport = this.createTransport(transport);\n } catch (e) {\n\n\n this.transports.shift();\n this.open();\n return;\n }\n\n transport.open();\n this.setTransport(transport);\n }\n\n /**\n * Sets the current transport. Disables the existing one (if any).\n *\n * @api private\n */\n setTransport(transport) {\n\n\n const self = this;\n\n if (this.transport) {\n\n\n this.transport.removeAllListeners();\n }\n\n // set up transport\n this.transport = transport;\n\n // set up transport listeners\n transport\n .on(\"drain\", function() {\n self.onDrain();\n })\n .on(\"packet\", function(packet) {\n self.onPacket(packet);\n })\n .on(\"error\", function(e) {\n self.onError(e);\n })\n .on(\"close\", function() {\n self.onClose(\"transport close\");\n });\n }\n\n /**\n * Probes a transport.\n *\n * @param {String} transport name\n * @api private\n */\n probe(name) {\n\n\n let transport = this.createTransport(name, { probe: 1 });\n let failed = false;\n const self = this;\n\n Socket.priorWebsocketSuccess = false;\n\n function onTransportOpen() {\n if (self.onlyBinaryUpgrades) {\n const upgradeLosesBinary =\n !this.supportsBinary && self.transport.supportsBinary;\n failed = failed || upgradeLosesBinary;\n }\n if (failed) return;\n\n\n\n transport.send([{ type: \"ping\", data: \"probe\" }]);\n transport.once(\"packet\", function(msg) {\n if (failed) return;\n if (\"pong\" === msg.type && \"probe\" === msg.data) {\n\n\n self.upgrading = true;\n self.emit(\"upgrading\", transport);\n if (!transport) return;\n Socket.priorWebsocketSuccess = \"websocket\" === transport.name;\n\n\n\n self.transport.pause(function() {\n if (failed) return;\n if (\"closed\" === self.readyState) return;\n\n\n\n cleanup();\n\n self.setTransport(transport);\n transport.send([{ type: \"upgrade\" }]);\n self.emit(\"upgrade\", transport);\n transport = null;\n self.upgrading = false;\n self.flush();\n });\n } else {\n\n\n const err = new Error(\"probe error\");\n err.transport = transport.name;\n self.emit(\"upgradeError\", err);\n }\n });\n }\n\n function freezeTransport() {\n if (failed) return;\n\n // Any callback called by transport should be ignored since now\n failed = true;\n\n cleanup();\n\n transport.close();\n transport = null;\n }\n\n // Handle any error that happens while probing\n function onerror(err) {\n const error = new Error(\"probe error: \" + err);\n error.transport = transport.name;\n\n freezeTransport();\n\n\n\n\n self.emit(\"upgradeError\", error);\n }\n\n function onTransportClose() {\n onerror(\"transport closed\");\n }\n\n // When the socket is closed while we're probing\n function onclose() {\n onerror(\"socket closed\");\n }\n\n // When the socket is upgraded while we're probing\n function onupgrade(to) {\n if (transport && to.name !== transport.name) {\n\n\n freezeTransport();\n }\n }\n\n // Remove all listeners on the transport and on self\n function cleanup() {\n transport.removeListener(\"open\", onTransportOpen);\n transport.removeListener(\"error\", onerror);\n transport.removeListener(\"close\", onTransportClose);\n self.removeListener(\"close\", onclose);\n self.removeListener(\"upgrading\", onupgrade);\n }\n\n transport.once(\"open\", onTransportOpen);\n transport.once(\"error\", onerror);\n transport.once(\"close\", onTransportClose);\n\n this.once(\"close\", onclose);\n this.once(\"upgrading\", onupgrade);\n\n transport.open();\n }\n\n /**\n * Called when connection is deemed open.\n *\n * @api public\n */\n onOpen() {\n\n\n this.readyState = \"open\";\n Socket.priorWebsocketSuccess = \"websocket\" === this.transport.name;\n this.emit(\"open\");\n this.flush();\n\n // we check for `readyState` in case an `open`\n // listener already closed the socket\n if (\n \"open\" === this.readyState &&\n this.opts.upgrade &&\n this.transport.pause\n ) {\n\n\n let i = 0;\n const l = this.upgrades.length;\n for (; i < l; i++) {\n this.probe(this.upgrades[i]);\n }\n }\n }\n\n /**\n * Handles a packet.\n *\n * @api private\n */\n onPacket(packet) {\n if (\n \"opening\" === this.readyState ||\n \"open\" === this.readyState ||\n \"closing\" === this.readyState\n ) {\n\n\n\n this.emit(\"packet\", packet);\n\n // Socket is live - any packet counts\n this.emit(\"heartbeat\");\n\n switch (packet.type) {\n case \"open\":\n this.onHandshake(JSON.parse(packet.data));\n break;\n\n case \"ping\":\n this.resetPingTimeout();\n this.sendPacket(\"pong\");\n this.emit(\"pong\");\n break;\n\n case \"error\":\n const err = new Error(\"server error\");\n err.code = packet.data;\n this.onError(err);\n break;\n\n case \"message\":\n this.emit(\"data\", packet.data);\n this.emit(\"message\", packet.data);\n break;\n }\n } else {\n\n\n }\n }\n\n /**\n * Called upon handshake completion.\n *\n * @param {Object} handshake obj\n * @api private\n */\n onHandshake(data) {\n this.emit(\"handshake\", data);\n this.id = data.sid;\n this.transport.query.sid = data.sid;\n this.upgrades = this.filterUpgrades(data.upgrades);\n this.pingInterval = data.pingInterval;\n this.pingTimeout = data.pingTimeout;\n this.onOpen();\n // In case open handler closes socket\n if (\"closed\" === this.readyState) return;\n this.resetPingTimeout();\n }\n\n /**\n * Sets and resets ping timeout timer based on server pings.\n *\n * @api private\n */\n resetPingTimeout() {\n clearTimeout(this.pingTimeoutTimer);\n this.pingTimeoutTimer = setTimeout(() => {\n this.onClose(\"ping timeout\");\n }, this.pingInterval + this.pingTimeout);\n }\n\n /**\n * Called on `drain` event\n *\n * @api private\n */\n onDrain() {\n this.writeBuffer.splice(0, this.prevBufferLen);\n\n // setting prevBufferLen = 0 is very important\n // for example, when upgrading, upgrade packet is sent over,\n // and a nonzero prevBufferLen could cause problems on `drain`\n this.prevBufferLen = 0;\n\n if (0 === this.writeBuffer.length) {\n this.emit(\"drain\");\n } else {\n this.flush();\n }\n }\n\n /**\n * Flush write buffers.\n *\n * @api private\n */\n flush() {\n if (\n \"closed\" !== this.readyState &&\n this.transport.writable &&\n !this.upgrading &&\n this.writeBuffer.length\n ) {\n\n\n this.transport.send(this.writeBuffer);\n // keep track of current length of writeBuffer\n // splice writeBuffer and callbackBuffer on `drain`\n this.prevBufferLen = this.writeBuffer.length;\n this.emit(\"flush\");\n }\n }\n\n /**\n * Sends a message.\n *\n * @param {String} message.\n * @param {Function} callback function.\n * @param {Object} options.\n * @return {Socket} for chaining.\n * @api public\n */\n write(msg, options, fn) {\n this.sendPacket(\"message\", msg, options, fn);\n return this;\n }\n\n send(msg, options, fn) {\n this.sendPacket(\"message\", msg, options, fn);\n return this;\n }\n\n /**\n * Sends a packet.\n *\n * @param {String} packet type.\n * @param {String} data.\n * @param {Object} options.\n * @param {Function} callback function.\n * @api private\n */\n sendPacket(type, data, options, fn) {\n if (\"function\" === typeof data) {\n fn = data;\n data = undefined;\n }\n\n if (\"function\" === typeof options) {\n fn = options;\n options = null;\n }\n\n if (\"closing\" === this.readyState || \"closed\" === this.readyState) {\n return;\n }\n\n options = options || {};\n options.compress = false !== options.compress;\n\n const packet = {\n type: type,\n data: data,\n options: options\n };\n this.emit(\"packetCreate\", packet);\n this.writeBuffer.push(packet);\n if (fn) this.once(\"flush\", fn);\n this.flush();\n }\n\n /**\n * Closes the connection.\n *\n * @api private\n */\n close() {\n const self = this;\n\n if (\"opening\" === this.readyState || \"open\" === this.readyState) {\n this.readyState = \"closing\";\n\n if (this.writeBuffer.length) {\n this.once(\"drain\", function() {\n if (this.upgrading) {\n waitForUpgrade();\n } else {\n close();\n }\n });\n } else if (this.upgrading) {\n waitForUpgrade();\n } else {\n close();\n }\n }\n\n function close() {\n self.onClose(\"forced close\");\n\n\n self.transport.close();\n }\n\n function cleanupAndClose() {\n self.removeListener(\"upgrade\", cleanupAndClose);\n self.removeListener(\"upgradeError\", cleanupAndClose);\n close();\n }\n\n function waitForUpgrade() {\n // wait for upgrade to finish since we can't send packets while pausing a transport\n self.once(\"upgrade\", cleanupAndClose);\n self.once(\"upgradeError\", cleanupAndClose);\n }\n\n return this;\n }\n\n /**\n * Called upon transport error\n *\n * @api private\n */\n onError(err) {\n\n\n Socket.priorWebsocketSuccess = false;\n this.emit(\"error\", err);\n this.onClose(\"transport error\", err);\n }\n\n /**\n * Called upon transport close.\n *\n * @api private\n */\n onClose(reason, desc) {\n if (\n \"opening\" === this.readyState ||\n \"open\" === this.readyState ||\n \"closing\" === this.readyState\n ) {\n\n\n const self = this;\n\n // clear timers\n clearTimeout(this.pingIntervalTimer);\n clearTimeout(this.pingTimeoutTimer);\n\n // stop event from firing again for transport\n this.transport.removeAllListeners(\"close\");\n\n // ensure transport won't stay open\n this.transport.close();\n\n // ignore further transport communication\n this.transport.removeAllListeners();\n\n // set ready state\n this.readyState = \"closed\";\n\n // clear session id\n this.id = null;\n\n // emit close event\n this.emit(\"close\", reason, desc);\n\n // clean buffers after, so users can still\n // grab the buffers on `close` event\n self.writeBuffer = [];\n self.prevBufferLen = 0;\n }\n }\n\n /**\n * Filters upgrades, returning only those matching client transports.\n *\n * @param {Array} server upgrades\n * @api private\n *\n */\n filterUpgrades(upgrades) {\n const filteredUpgrades = [];\n let i = 0;\n const j = upgrades.length;\n for (; i < j; i++) {\n if (~this.transports.indexOf(upgrades[i]))\n filteredUpgrades.push(upgrades[i]);\n }\n return filteredUpgrades;\n }\n}\n\nSocket.priorWebsocketSuccess = false;\n\n/**\n * Protocol version.\n *\n * @api public\n */\n\nSocket.protocol = parser.protocol; // this is an int\n\nfunction clone(obj) {\n const o = {};\n for (let i in obj) {\n if (obj.hasOwnProperty(i)) {\n o[i] = obj[i];\n }\n }\n return o;\n}\n\nmodule.exports = Socket;\n","\n/**\n * Module exports.\n *\n * Logic borrowed from Modernizr:\n *\n * - https://github.com/Modernizr/Modernizr/blob/master/feature-detects/cors.js\n */\n\ntry {\n module.exports = typeof XMLHttpRequest !== 'undefined' &&\n 'withCredentials' in new XMLHttpRequest();\n} catch (err) {\n // if XMLHttp support is disabled in IE then it will throw\n // when trying to create\n module.exports = false;\n}\n","/* global attachEvent */\n\nconst XMLHttpRequest = require(\"xmlhttprequest-ssl\");\nconst Polling = require(\"./polling\");\nconst Emitter = require(\"component-emitter\");\nconst { pick } = require(\"../util\");\nconst globalThis = require(\"../globalThis\");\n\n\n\n\n/**\n * Empty function\n */\n\nfunction empty() {}\n\nconst hasXHR2 = (function() {\n const xhr = new XMLHttpRequest({ xdomain: false });\n return null != xhr.responseType;\n})();\n\nclass XHR extends Polling {\n /**\n * XHR Polling constructor.\n *\n * @param {Object} opts\n * @api public\n */\n constructor(opts) {\n super(opts);\n\n if (typeof location !== \"undefined\") {\n const isSSL = \"https:\" === location.protocol;\n let port = location.port;\n\n // some user agents have empty `location.port`\n if (!port) {\n port = isSSL ? 443 : 80;\n }\n\n this.xd =\n (typeof location !== \"undefined\" &&\n opts.hostname !== location.hostname) ||\n port !== opts.port;\n this.xs = opts.secure !== isSSL;\n }\n /**\n * XHR supports binary\n */\n const forceBase64 = opts && opts.forceBase64;\n this.supportsBinary = hasXHR2 && !forceBase64;\n }\n\n /**\n * Creates a request.\n *\n * @param {String} method\n * @api private\n */\n request(opts = {}) {\n Object.assign(opts, { xd: this.xd, xs: this.xs }, this.opts);\n return new Request(this.uri(), opts);\n }\n\n /**\n * Sends data.\n *\n * @param {String} data to send.\n * @param {Function} called upon flush.\n * @api private\n */\n doWrite(data, fn) {\n const req = this.request({\n method: \"POST\",\n data: data\n });\n const self = this;\n req.on(\"success\", fn);\n req.on(\"error\", function(err) {\n self.onError(\"xhr post error\", err);\n });\n }\n\n /**\n * Starts a poll cycle.\n *\n * @api private\n */\n doPoll() {\n\n\n const req = this.request();\n const self = this;\n req.on(\"data\", function(data) {\n self.onData(data);\n });\n req.on(\"error\", function(err) {\n self.onError(\"xhr poll error\", err);\n });\n this.pollXhr = req;\n }\n}\n\nclass Request extends Emitter {\n /**\n * Request constructor\n *\n * @param {Object} options\n * @api public\n */\n constructor(uri, opts) {\n super();\n this.opts = opts;\n\n this.method = opts.method || \"GET\";\n this.uri = uri;\n this.async = false !== opts.async;\n this.data = undefined !== opts.data ? opts.data : null;\n\n this.create();\n }\n\n /**\n * Creates the XHR object and sends the request.\n *\n * @api private\n */\n create() {\n const opts = pick(\n this.opts,\n \"agent\",\n \"enablesXDR\",\n \"pfx\",\n \"key\",\n \"passphrase\",\n \"cert\",\n \"ca\",\n \"ciphers\",\n \"rejectUnauthorized\"\n );\n opts.xdomain = !!this.opts.xd;\n opts.xscheme = !!this.opts.xs;\n\n const xhr = (this.xhr = new XMLHttpRequest(opts));\n const self = this;\n\n try {\n\n\n xhr.open(this.method, this.uri, this.async);\n try {\n if (this.opts.extraHeaders) {\n xhr.setDisableHeaderCheck && xhr.setDisableHeaderCheck(true);\n for (let i in this.opts.extraHeaders) {\n if (this.opts.extraHeaders.hasOwnProperty(i)) {\n xhr.setRequestHeader(i, this.opts.extraHeaders[i]);\n }\n }\n }\n } catch (e) {}\n\n if (\"POST\" === this.method) {\n try {\n xhr.setRequestHeader(\"Content-type\", \"text/plain;charset=UTF-8\");\n } catch (e) {}\n }\n\n try {\n xhr.setRequestHeader(\"Accept\", \"*/*\");\n } catch (e) {}\n\n // ie6 check\n if (\"withCredentials\" in xhr) {\n xhr.withCredentials = this.opts.withCredentials;\n }\n\n if (this.opts.requestTimeout) {\n xhr.timeout = this.opts.requestTimeout;\n }\n\n if (this.hasXDR()) {\n xhr.onload = function() {\n self.onLoad();\n };\n xhr.onerror = function() {\n self.onError(xhr.responseText);\n };\n } else {\n xhr.onreadystatechange = function() {\n if (4 !== xhr.readyState) return;\n if (200 === xhr.status || 1223 === xhr.status) {\n self.onLoad();\n } else {\n // make sure the `error` event handler that's user-set\n // does not throw in the same tick and gets caught here\n setTimeout(function() {\n self.onError(typeof xhr.status === \"number\" ? xhr.status : 0);\n }, 0);\n }\n };\n }\n\n\n\n xhr.send(this.data);\n } catch (e) {\n // Need to defer since .create() is called directly from the constructor\n // and thus the 'error' event can only be only bound *after* this exception\n // occurs. Therefore, also, we cannot throw here at all.\n setTimeout(function() {\n self.onError(e);\n }, 0);\n return;\n }\n\n if (typeof document !== \"undefined\") {\n this.index = Request.requestsCount++;\n Request.requests[this.index] = this;\n }\n }\n\n /**\n * Called upon successful response.\n *\n * @api private\n */\n onSuccess() {\n this.emit(\"success\");\n this.cleanup();\n }\n\n /**\n * Called if we have data.\n *\n * @api private\n */\n onData(data) {\n this.emit(\"data\", data);\n this.onSuccess();\n }\n\n /**\n * Called upon error.\n *\n * @api private\n */\n onError(err) {\n this.emit(\"error\", err);\n this.cleanup(true);\n }\n\n /**\n * Cleans up house.\n *\n * @api private\n */\n cleanup(fromError) {\n if (\"undefined\" === typeof this.xhr || null === this.xhr) {\n return;\n }\n // xmlhttprequest\n if (this.hasXDR()) {\n this.xhr.onload = this.xhr.onerror = empty;\n } else {\n this.xhr.onreadystatechange = empty;\n }\n\n if (fromError) {\n try {\n this.xhr.abort();\n } catch (e) {}\n }\n\n if (typeof document !== \"undefined\") {\n delete Request.requests[this.index];\n }\n\n this.xhr = null;\n }\n\n /**\n * Called upon load.\n *\n * @api private\n */\n onLoad() {\n const data = this.xhr.responseText;\n if (data !== null) {\n this.onData(data);\n }\n }\n\n /**\n * Check if it has XDomainRequest.\n *\n * @api private\n */\n hasXDR() {\n return typeof XDomainRequest !== \"undefined\" && !this.xs && this.enablesXDR;\n }\n\n /**\n * Aborts the request.\n *\n * @api public\n */\n abort() {\n this.cleanup();\n }\n}\n\n/**\n * Aborts pending requests when unloading the window. This is needed to prevent\n * memory leaks (e.g. when using IE) and to ensure that no spurious error is\n * emitted.\n */\n\nRequest.requestsCount = 0;\nRequest.requests = {};\n\nif (typeof document !== \"undefined\") {\n if (typeof attachEvent === \"function\") {\n attachEvent(\"onunload\", unloadHandler);\n } else if (typeof addEventListener === \"function\") {\n const terminationEvent = \"onpagehide\" in globalThis ? \"pagehide\" : \"unload\";\n addEventListener(terminationEvent, unloadHandler, false);\n }\n}\n\nfunction unloadHandler() {\n for (let i in Request.requests) {\n if (Request.requests.hasOwnProperty(i)) {\n Request.requests[i].abort();\n }\n }\n}\n\nmodule.exports = XHR;\nmodule.exports.Request = Request;\n","const { PACKET_TYPES } = require(\"./commons\");\n\nconst withNativeBlob =\n typeof Blob === \"function\" ||\n (typeof Blob !== \"undefined\" &&\n Object.prototype.toString.call(Blob) === \"[object BlobConstructor]\");\nconst withNativeArrayBuffer = typeof ArrayBuffer === \"function\";\n\n// ArrayBuffer.isView method is not defined in IE10\nconst isView = obj => {\n return typeof ArrayBuffer.isView === \"function\"\n ? ArrayBuffer.isView(obj)\n : obj && obj.buffer instanceof ArrayBuffer;\n};\n\nconst encodePacket = ({ type, data }, supportsBinary, callback) => {\n if (withNativeBlob && data instanceof Blob) {\n if (supportsBinary) {\n return callback(data);\n } else {\n return encodeBlobAsBase64(data, callback);\n }\n } else if (\n withNativeArrayBuffer &&\n (data instanceof ArrayBuffer || isView(data))\n ) {\n if (supportsBinary) {\n return callback(data instanceof ArrayBuffer ? data : data.buffer);\n } else {\n return encodeBlobAsBase64(new Blob([data]), callback);\n }\n }\n // plain string\n return callback(PACKET_TYPES[type] + (data || \"\"));\n};\n\nconst encodeBlobAsBase64 = (data, callback) => {\n const fileReader = new FileReader();\n fileReader.onload = function() {\n const content = fileReader.result.split(\",\")[1];\n callback(\"b\" + content);\n };\n return fileReader.readAsDataURL(data);\n};\n\nmodule.exports = encodePacket;\n","const { PACKET_TYPES_REVERSE, ERROR_PACKET } = require(\"./commons\");\n\nconst withNativeArrayBuffer = typeof ArrayBuffer === \"function\";\n\nlet base64decoder;\nif (withNativeArrayBuffer) {\n base64decoder = require(\"base64-arraybuffer\");\n}\n\nconst decodePacket = (encodedPacket, binaryType) => {\n if (typeof encodedPacket !== \"string\") {\n return {\n type: \"message\",\n data: mapBinary(encodedPacket, binaryType)\n };\n }\n const type = encodedPacket.charAt(0);\n if (type === \"b\") {\n return {\n type: \"message\",\n data: decodeBase64Packet(encodedPacket.substring(1), binaryType)\n };\n }\n const packetType = PACKET_TYPES_REVERSE[type];\n if (!packetType) {\n return ERROR_PACKET;\n }\n return encodedPacket.length > 1\n ? {\n type: PACKET_TYPES_REVERSE[type],\n data: encodedPacket.substring(1)\n }\n : {\n type: PACKET_TYPES_REVERSE[type]\n };\n};\n\nconst decodeBase64Packet = (data, binaryType) => {\n if (base64decoder) {\n const decoded = base64decoder.decode(data);\n return mapBinary(decoded, binaryType);\n } else {\n return { base64: true, data }; // fallback for old browsers\n }\n};\n\nconst mapBinary = (data, binaryType) => {\n switch (binaryType) {\n case \"blob\":\n return data instanceof ArrayBuffer ? new Blob([data]) : data;\n case \"arraybuffer\":\n default:\n return data; // assuming the data is already an ArrayBuffer\n }\n};\n\nmodule.exports = decodePacket;\n","/*\n * base64-arraybuffer\n * https://github.com/niklasvh/base64-arraybuffer\n *\n * Copyright (c) 2012 Niklas von Hertzen\n * Licensed under the MIT license.\n */\n(function(){\n \"use strict\";\n\n var chars = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\";\n\n // Use a lookup table to find the index.\n var lookup = new Uint8Array(256);\n for (var i = 0; i < chars.length; i++) {\n lookup[chars.charCodeAt(i)] = i;\n }\n\n exports.encode = function(arraybuffer) {\n var bytes = new Uint8Array(arraybuffer),\n i, len = bytes.length, base64 = \"\";\n\n for (i = 0; i < len; i+=3) {\n base64 += chars[bytes[i] >> 2];\n base64 += chars[((bytes[i] & 3) << 4) | (bytes[i + 1] >> 4)];\n base64 += chars[((bytes[i + 1] & 15) << 2) | (bytes[i + 2] >> 6)];\n base64 += chars[bytes[i + 2] & 63];\n }\n\n if ((len % 3) === 2) {\n base64 = base64.substring(0, base64.length - 1) + \"=\";\n } else if (len % 3 === 1) {\n base64 = base64.substring(0, base64.length - 2) + \"==\";\n }\n\n return base64;\n };\n\n exports.decode = function(base64) {\n var bufferLength = base64.length * 0.75,\n len = base64.length, i, p = 0,\n encoded1, encoded2, encoded3, encoded4;\n\n if (base64[base64.length - 1] === \"=\") {\n bufferLength--;\n if (base64[base64.length - 2] === \"=\") {\n bufferLength--;\n }\n }\n\n var arraybuffer = new ArrayBuffer(bufferLength),\n bytes = new Uint8Array(arraybuffer);\n\n for (i = 0; i < len; i+=4) {\n encoded1 = lookup[base64.charCodeAt(i)];\n encoded2 = lookup[base64.charCodeAt(i+1)];\n encoded3 = lookup[base64.charCodeAt(i+2)];\n encoded4 = lookup[base64.charCodeAt(i+3)];\n\n bytes[p++] = (encoded1 << 2) | (encoded2 >> 4);\n bytes[p++] = ((encoded2 & 15) << 4) | (encoded3 >> 2);\n bytes[p++] = ((encoded3 & 3) << 6) | (encoded4 & 63);\n }\n\n return arraybuffer;\n };\n})();\n","const Polling = require(\"./polling\");\nconst globalThis = require(\"../globalThis\");\n\nconst rNewline = /\\n/g;\nconst rEscapedNewline = /\\\\n/g;\n\n/**\n * Global JSONP callbacks.\n */\n\nlet callbacks;\n\n/**\n * Noop.\n */\n\nfunction empty() {}\n\nclass JSONPPolling extends Polling {\n /**\n * JSONP Polling constructor.\n *\n * @param {Object} opts.\n * @api public\n */\n constructor(opts) {\n super(opts);\n\n this.query = this.query || {};\n\n // define global callbacks array if not present\n // we do this here (lazily) to avoid unneeded global pollution\n if (!callbacks) {\n // we need to consider multiple engines in the same page\n callbacks = globalThis.___eio = globalThis.___eio || [];\n }\n\n // callback identifier\n this.index = callbacks.length;\n\n // add callback to jsonp global\n const self = this;\n callbacks.push(function(msg) {\n self.onData(msg);\n });\n\n // append to query string\n this.query.j = this.index;\n\n // prevent spurious errors from being emitted when the window is unloaded\n if (typeof addEventListener === \"function\") {\n addEventListener(\n \"beforeunload\",\n function() {\n if (self.script) self.script.onerror = empty;\n },\n false\n );\n }\n }\n\n /**\n * JSONP only supports binary as base64 encoded strings\n */\n get supportsBinary() {\n return false;\n }\n\n /**\n * Closes the socket.\n *\n * @api private\n */\n doClose() {\n if (this.script) {\n this.script.parentNode.removeChild(this.script);\n this.script = null;\n }\n\n if (this.form) {\n this.form.parentNode.removeChild(this.form);\n this.form = null;\n this.iframe = null;\n }\n\n super.doClose();\n }\n\n /**\n * Starts a poll cycle.\n *\n * @api private\n */\n doPoll() {\n const self = this;\n const script = document.createElement(\"script\");\n\n if (this.script) {\n this.script.parentNode.removeChild(this.script);\n this.script = null;\n }\n\n script.async = true;\n script.src = this.uri();\n script.onerror = function(e) {\n self.onError(\"jsonp poll error\", e);\n };\n\n const insertAt = document.getElementsByTagName(\"script\")[0];\n if (insertAt) {\n insertAt.parentNode.insertBefore(script, insertAt);\n } else {\n (document.head || document.body).appendChild(script);\n }\n this.script = script;\n\n const isUAgecko =\n \"undefined\" !== typeof navigator && /gecko/i.test(navigator.userAgent);\n\n if (isUAgecko) {\n setTimeout(function() {\n const iframe = document.createElement(\"iframe\");\n document.body.appendChild(iframe);\n document.body.removeChild(iframe);\n }, 100);\n }\n }\n\n /**\n * Writes with a hidden iframe.\n *\n * @param {String} data to send\n * @param {Function} called upon flush.\n * @api private\n */\n doWrite(data, fn) {\n const self = this;\n let iframe;\n\n if (!this.form) {\n const form = document.createElement(\"form\");\n const area = document.createElement(\"textarea\");\n const id = (this.iframeId = \"eio_iframe_\" + this.index);\n\n form.className = \"socketio\";\n form.style.position = \"absolute\";\n form.style.top = \"-1000px\";\n form.style.left = \"-1000px\";\n form.target = id;\n form.method = \"POST\";\n form.setAttribute(\"accept-charset\", \"utf-8\");\n area.name = \"d\";\n form.appendChild(area);\n document.body.appendChild(form);\n\n this.form = form;\n this.area = area;\n }\n\n this.form.action = this.uri();\n\n function complete() {\n initIframe();\n fn();\n }\n\n function initIframe() {\n if (self.iframe) {\n try {\n self.form.removeChild(self.iframe);\n } catch (e) {\n self.onError(\"jsonp polling iframe removal error\", e);\n }\n }\n\n try {\n // ie6 dynamic iframes with target=\"\" support (thanks Chris Lambacher)\n const html = '