Greasy Fork is available in English.

RuqES - ruqqus.com

"Ruqqus Enhancement Suite" brings infinite scroll, expando button and more. Recommended to be used with Violentmonkey. For more details see https://ruqqus.com/post/ldx/what-is-ruqes

// ==UserScript==
// @name        RuqES - ruqqus.com
// @version     0.28.3
// @author      enefi
// @description "Ruqqus Enhancement Suite" brings infinite scroll, expando button and more. Recommended to be used with Violentmonkey. For more details see https://ruqqus.com/post/ldx/what-is-ruqes
// @supportURL  https://ruqqus.com/post/p04/bug-reports-and-other-issues
// @match       https://ruqqus.com/*
// @match       https://dev.ruqqus.com/*
// @match       https://linode.ruqqus.com/*
// @match       http://ruqqus.localhost:8000/*
// @namespace   enefi
// @grant       GM.xmlHttpRequest
// @grant       GM.info
// @grant       GM.getValue
// @grant       GM.setValue
// @require     https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.min.js
// @homepageURL https://ruqqus.com/post/ldx/what-is-ruqes
// @runAt       document-start
// ==/UserScript==

/******/ (function(modules) { // webpackBootstrap
/******/ 	// The module cache
/******/ 	var installedModules = {};
/******/
/******/ 	// The require function
/******/ 	function __webpack_require__(moduleId) {
/******/
/******/ 		// Check if module is in cache
/******/ 		if(installedModules[moduleId]) {
/******/ 			return installedModules[moduleId].exports;
/******/ 		}
/******/ 		// Create a new module (and put it into the cache)
/******/ 		var module = installedModules[moduleId] = {
/******/ 			i: moduleId,
/******/ 			l: false,
/******/ 			exports: {}
/******/ 		};
/******/
/******/ 		// Execute the module function
/******/ 		modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ 		// Flag the module as loaded
/******/ 		module.l = true;
/******/
/******/ 		// Return the exports of the module
/******/ 		return module.exports;
/******/ 	}
/******/
/******/
/******/ 	// expose the modules object (__webpack_modules__)
/******/ 	__webpack_require__.m = modules;
/******/
/******/ 	// expose the module cache
/******/ 	__webpack_require__.c = installedModules;
/******/
/******/ 	// define getter function for harmony exports
/******/ 	__webpack_require__.d = function(exports, name, getter) {
/******/ 		if(!__webpack_require__.o(exports, name)) {
/******/ 			Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ 		}
/******/ 	};
/******/
/******/ 	// define __esModule on exports
/******/ 	__webpack_require__.r = function(exports) {
/******/ 		if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ 			Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ 		}
/******/ 		Object.defineProperty(exports, '__esModule', { value: true });
/******/ 	};
/******/
/******/ 	// create a fake namespace object
/******/ 	// mode & 1: value is a module id, require it
/******/ 	// mode & 2: merge all properties of value into the ns
/******/ 	// mode & 4: return value when already ns object
/******/ 	// mode & 8|1: behave like require
/******/ 	__webpack_require__.t = function(value, mode) {
/******/ 		if(mode & 1) value = __webpack_require__(value);
/******/ 		if(mode & 8) return value;
/******/ 		if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ 		var ns = Object.create(null);
/******/ 		__webpack_require__.r(ns);
/******/ 		Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ 		if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ 		return ns;
/******/ 	};
/******/
/******/ 	// getDefaultExport function for compatibility with non-harmony modules
/******/ 	__webpack_require__.n = function(module) {
/******/ 		var getter = module && module.__esModule ?
/******/ 			function getDefault() { return module['default']; } :
/******/ 			function getModuleExports() { return module; };
/******/ 		__webpack_require__.d(getter, 'a', getter);
/******/ 		return getter;
/******/ 	};
/******/
/******/ 	// Object.prototype.hasOwnProperty.call
/******/ 	__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ 	// __webpack_public_path__
/******/ 	__webpack_require__.p = "";
/******/
/******/
/******/ 	// Load entry module and return exports
/******/ 	return __webpack_require__(__webpack_require__.s = 26);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var __assign = (this && this.__assign) || function () {
    __assign = Object.assign || function(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);
};
var __awaiter = (this && this.__awaiter) || function (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());
    });
};
var __generator = (this && this.__generator) || function (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 };
    }
};
var __read = (this && this.__read) || function (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;
};
var __spread = (this && this.__spread) || function () {
    for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
    return ar;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.encodeHtmlEntitiesDeeplyInStrings = exports.encodeHtmlEntities = exports.decodeHtmlEntitiesAggressively = exports.decodeHtmlEntities = exports.scrollIntoViewIfNeeded = exports.isElementInViewport = exports.getElSize = exports.tryParseJSON = exports.withTooltip = exports.getDomain = exports.getImageUrlFromPostThumbnail = exports.createMainMenuButtonForMobile = exports.createMainMenuButtonForDesktop = exports.genNavigateToRuqESUrl = exports.genJsAnchor = exports.genRuqESUrl = exports.isOnRuqESUrl = exports.getGuildImageOnGuildPage = exports.getCurrentSort = exports.getGuildNameFromPathname = exports.isOnGuildPage = exports.isOnPostEmbed = exports.isOnPostDetail = exports.isOnPathOrSubpageGen = exports.isOnExactPathGen = exports.removeLeadingSlash = exports.getCommentId = exports.getBlockedComments = exports.getValidComments = exports.isCommentBlocked = exports.isCommentDeletedByAuthor = exports.extractCommentInfo = exports.getCommentIdFromUrl = exports.parseIntOrNull = exports.extractPostInfo = exports.parseUpDownCounts = exports.genTextUpDownCounters = exports.showConfirmDialog = exports.lastIndex = exports.isValidCssColor = exports.isNumber = exports.isArray = exports.isObject = exports.isString = exports.setupVoting = exports.getWindowEl = exports.getRuqqusWindow = exports.dropWhileString = exports.preventDefaults = exports.xhrPJson = exports.xhrP = exports.xhr = exports.isDarkTheme = exports.createSmallCommentButton = exports.createTextLoader = exports.createReactionGif = exports.createReactionGifIco = exports.createRuqesMark = exports.createLoadingDots = exports.ofType = exports.setClass = exports.$i = exports.$c = exports.printError = exports.printLog = exports.debugLog = exports.enabledDebug = exports.isDebugEnabled = exports.scriptVersion = exports.scriptInfo = exports.logPrefix = void 0;
var ramda_1 = __webpack_require__(4);
var entities_1 = __webpack_require__(28);
var moment_1 = __importDefault(__webpack_require__(11));
var styles_1 = __webpack_require__(3);
var logo_svg_1 = __importDefault(__webpack_require__(8));
var react_ico_svg_1 = __importDefault(__webpack_require__(33));
var selectors_1 = __webpack_require__(5);
exports.logPrefix = '[RuqES]';
exports.scriptInfo = GM.info.script;
exports.scriptVersion = exports.scriptInfo.version;
var debugEnabled = false;
exports.isDebugEnabled = function () { return debugEnabled; };
exports.enabledDebug = function () { return debugEnabled = true; };
exports.debugLog = function () {
    var xs = [];
    for (var _i = 0; _i < arguments.length; _i++) {
        xs[_i] = arguments[_i];
    }
    return exports.isDebugEnabled() && console.log.apply(console, __spread([exports.logPrefix, '[D]'], xs));
};
exports.printLog = function () {
    var xs = [];
    for (var _i = 0; _i < arguments.length; _i++) {
        xs[_i] = arguments[_i];
    }
    return console.log.apply(console, __spread([exports.logPrefix], xs));
};
exports.printError = function () {
    var xs = [];
    for (var _i = 0; _i < arguments.length; _i++) {
        xs[_i] = arguments[_i];
    }
    return console.error.apply(console, __spread([exports.logPrefix], xs));
};
exports.$c = function (cls, parent) { return $("." + cls, parent); };
exports.$i = function (cls, parent) { return $("#" + cls, parent); };
exports.setClass = function (el, cls, value) {
    if (value) {
        el.addClass(cls);
    }
    else {
        el.removeClass(cls);
    }
    return el;
};
exports.ofType = function (x) { return x; };
exports.createLoadingDots = function (cls) {
    if (cls === void 0) { cls = ''; }
    var container = $('<span>').addClass(styles_1.loadingDotsCls).addClass(cls);
    ramda_1.range(0, 3).map(function () { return $('<i>.</i>'); }).forEach(function (x) { return container.append(x); });
    return container;
};
exports.createRuqesMark = function () { return $('<span>').html(logo_svg_1.default).addClass(styles_1.ruqesMarkCls); };
exports.createReactionGifIco = function () { return $('<span>').html(react_ico_svg_1.default).addClass(styles_1.reactionGifIcoCls); };
exports.createReactionGif = function (name, url) {
    return $('<img>').prop('src', url).data('gifName', name).addClass(styles_1.reactionGifCls).prop('loading', 'lazy').prop('title', name);
};
exports.createTextLoader = function (text, cls) {
    return $('<div>')
        .addClass(styles_1.textLoaderCls)
        .addClass(cls)
        .append(exports.createRuqesMark())
        .append($('<span>').text(text).css('margin-left', '0.33em'))
        .append(exports.createLoadingDots());
};
exports.createSmallCommentButton = function (text) {
    return $('<label>')
        .addClass('btn btn-secondary format d-inline-block m-0 ml-1')
        .append(exports.createRuqesMark().css('opacity', 0.5))
        .append($('<span>').text(text).addClass('font-weight-bolder text-uppercase'));
};
exports.isDarkTheme = function () { return __awaiter(void 0, void 0, void 0, function () {
    return __generator(this, function (_a) {
        return [2 /*return*/, new Promise(function (resolve, reject) {
                var check = function (attempts) {
                    var cssLinkEl = $('#css-link');
                    exports.debugLog('isDarkTheme iteration', { attempts: attempts, cssLinkEl: cssLinkEl });
                    if (attempts <= 0) {
                        exports.debugLog('isDarkTheme failed', { cssLinkEl: cssLinkEl });
                        reject('isDarkTheme: no more attempts');
                    }
                    if (!cssLinkEl.length) {
                        setTimeout(check, 100, attempts - 1);
                    }
                    else {
                        var cssLinkHref = cssLinkEl.prop('href');
                        var looksDark = cssLinkHref.includes('/main_dark.css') || cssLinkHref.includes('/dark/');
                        exports.debugLog('isDarkTheme success', { attempts: attempts, cssLinkEl: cssLinkEl, cssLinkHref: cssLinkHref, looksDark: looksDark });
                        resolve(looksDark);
                    }
                };
                check(50);
            })];
    });
}); };
exports.xhr = function (cfg) { return GM.xmlHttpRequest(cfg); };
exports.xhrP = function (cfg) {
    return new Promise(function (resolve, reject) {
        exports.xhr(__assign(__assign({}, cfg), { onload: function (response) {
                if (!response || !(response.status >= 200 && response.status <= 300)) {
                    reject(response);
                }
                else {
                    resolve(response);
                }
            },
            onerror: function (response) {
                reject(response);
            } }));
    });
};
exports.xhrPJson = function (cfg) {
    var newData = JSON.stringify(cfg.data);
    return exports.xhrP(__assign(__assign({}, cfg), { data: newData, headers: { 'content-type': 'application/json' } }));
};
exports.preventDefaults = function (evt) {
    evt.preventDefault();
    evt.stopPropagation();
};
exports.dropWhileString = function (pred, y) { return ramda_1.dropWhile(pred, y); };
exports.getRuqqusWindow = function () { return unsafeWindow; };
exports.getWindowEl = function () { return $(window); };
exports.setupVoting = function (el) {
    el.find('.upvote-button').each(function (_, rawEl) {
        rawEl.addEventListener('click', exports.getRuqqusWindow().upvote, false);
    });
    el.find('.downvote-button').each(function (_, rawEl) {
        rawEl.addEventListener('click', exports.getRuqqusWindow().downvote, false);
    });
};
exports.isString = function (x) { return typeof x === 'string'; };
exports.isObject = function (x) { return ramda_1.is(Object, x); };
exports.isArray = function (x) { return ramda_1.is(Array, x); };
exports.isNumber = function (x) { return ramda_1.is(Number, x); };
exports.isValidCssColor = function (x) {
    return /^\w+$|^#[a-f0-9]{3,6}$|^rgba?\(\d+,\s*\d+,\s*\d+(:?,\s*[0-9\.]+)?\)$/.test(x);
};
exports.lastIndex = function (xs) { return xs.length - 1; };
exports.showConfirmDialog = function (message) { return Promise.resolve(window.confirm(message)); };
exports.genTextUpDownCounters = function (upCount, downCount, upClasses, downClasses) {
    var upEl = $('<span>').text('+' + upCount).addClass(styles_1.upDownVotesAsTextUpCls).addClass(upClasses);
    var downEl = $('<span>').text('-' + downCount).addClass(styles_1.UpDownVotesAsTextDownCls).addClass(downClasses);
    return $('<div>').addClass('d-inline-block ml-1').addClass(styles_1.upDownVotesAsTextWrapperCls).append(' · ').append(upEl).append(' | ').append(downEl);
};
exports.parseUpDownCounts = function (x) {
    return (x || '0 | 0').split(/ \| /).map(function (x) { return Number.parseInt(x, 10); }).map(Math.abs);
}; // improve types?
var defaultTextThumbnail = '/assets/images/icons/default_thumb_text.png';
var defaultLinkThumbnail = '/assets/images/icons/default_thumb_link.png';
exports.extractPostInfo = function (el) {
    var _a, _b, _c;
    var dateEl = el.find('.card-block > .post-meta > span[data-toggle="tooltip"]').first();
    var upvoted = el.find('.arrow-up.active').length > 0;
    var downvoted = el.find('.arrow-down.active').length > 0;
    var postId = el.prop('id').replace(/^post-/, '');
    var dateRaw = dateEl.prop('title');
    var date = moment_1.default(dateRaw, '%DD %MMMM %YYYY at %HH:%mm:%ss').format();
    var guild = el.find('.post-meta a').filter(function (_, el) { return $(el).text().startsWith('+'); }).first().text().trim().replace(/^\+/, '');
    if (!guild) {
        guild = exports.$i('guild-name-reference').text();
    }
    var link = (_a = el.find('.card-header a').prop('href')) !== null && _a !== void 0 ? _a : null;
    if (link === 'javascript:void(0)')
        link = (_b = el.find('.card-header a').data('url')) !== null && _b !== void 0 ? _b : null;
    var thumbnail = el.find('.post-img').prop('src');
    if (!thumbnail) {
        thumbnail = link ? defaultLinkThumbnail : defaultTextThumbnail;
    }
    var url = el.find('.post-actions .fa-comment-dots').parent().prop('href');
    return {
        title: el.find('.post-title').text().trim(),
        author: el.find('.user-name').first().text(),
        guild: guild,
        id: postId,
        nsfw: el.find('.text-danger:contains(nsfw)').length > 0,
        score: (_c = Number.parseInt(el.find('.score').last().text())) !== null && _c !== void 0 ? _c : 0,
        vote: upvoted ? 'up' : downvoted ? 'down' : null,
        url: url,
        link: link,
        date: date,
        dateRaw: dateRaw,
        dateRelative: dateEl.text(),
        pinned: el.find('i.fa-thumbtack').length > 0,
        thumbnail: thumbnail,
        previewModal: el.find('.card-header a[data-toggle="modal"]').length > 0,
        textPost: link === url,
        expandable: el.find('.text-expand > .fa-expand-alt, .text-expand > .fa-compress-alt').length > 0,
        crosspost: el.closest('#crosspost-embed').length > 0
    };
};
exports.parseIntOrNull = function (x) {
    var p = parseInt(x);
    return isNaN(p) ? null : p;
};
exports.getCommentIdFromUrl = function (x) {
    var regex = /^.*\/\+.*\/(\w+)(?:(?:\?.*)?)$/;
    var res = (x || '').match(regex) || [];
    return res[1] || null;
};
exports.extractCommentInfo = function (el) {
    var _a;
    var link = el.find('.fa-link').parent().prop('href') || null;
    return {
        id: exports.getCommentIdFromUrl(link),
        author: el.find('.user-name ').text() || null,
        link: link,
        score: exports.parseIntOrNull(el.find('.points .score').first().text()),
        text: ((_a = el.find('.comment-text').html()) === null || _a === void 0 ? void 0 : _a.trim()) || null,
    };
};
exports.isCommentDeletedByAuthor = function (el) { var _a; return (_a = el.find('.user-info').text()) === null || _a === void 0 ? void 0 : _a.includes('[Deleted by author]'); };
exports.isCommentBlocked = function (el) { var _a; return (_a = el.find('.user-info').text()) === null || _a === void 0 ? void 0 : _a.includes('[This user has blocked you]'); };
// without deleted and blocked
exports.getValidComments = function () { return selectors_1.getComments().filter(function (_, rawEl) {
    var el = $(rawEl);
    return !exports.isCommentDeletedByAuthor(el) && !exports.isCommentBlocked(el);
}); };
exports.getBlockedComments = function () { return selectors_1.getComments().filter(function (_, rawEl) { return exports.isCommentBlocked($(rawEl)); }); };
exports.getCommentId = function (el) {
    var _a;
    var idFromIdAttr = (_a = (el.prop('id')).match(/comment-(\w+)/)) === null || _a === void 0 ? void 0 : _a[1];
    return idFromIdAttr !== null && idFromIdAttr !== void 0 ? idFromIdAttr : null;
};
exports.removeLeadingSlash = function (x) { return x.replace(/^\//, ''); };
exports.isOnExactPathGen = function (path) { return function () {
    var currentPath = window.location.pathname;
    return exports.removeLeadingSlash(path) === exports.removeLeadingSlash(currentPath);
}; };
exports.isOnPathOrSubpageGen = function (firstPathNamePart) { return function () {
    var currentPath = window.location.pathname;
    var paths = currentPath.split('/').filter(function (x) { return x !== ''; });
    return [paths[0], paths[1]].includes(exports.removeLeadingSlash(firstPathNamePart));
}; };
exports.isOnPostDetail = exports.isOnPathOrSubpageGen('post');
exports.isOnPostEmbed = exports.isOnPathOrSubpageGen('embed');
var guildInPathnameRegexGen = function () { return /^\/\+([\w]+)$/; };
exports.isOnGuildPage = function () { return guildInPathnameRegexGen().test(window.location.pathname); };
exports.getGuildNameFromPathname = function () { var _a; return ((_a = window.location.pathname.match(guildInPathnameRegexGen())) === null || _a === void 0 ? void 0 : _a[1]) || null; };
var config_1 = __webpack_require__(7);
exports.getCurrentSort = function () {
    var urlParams = new URLSearchParams(window.location.search);
    var sortValue = urlParams.get('sort');
    exports.debugLog('getCurrentSort', urlParams, sortValue);
    return config_1.isValidSort(sortValue) ? sortValue : null;
};
exports.getGuildImageOnGuildPage = function () { return selectors_1.getGuildActionsBar().find('.profile-pic-35').prop('src') || null; };
var hashPrefix = 'RuqES:';
exports.isOnRuqESUrl = function (path) {
    if (!exports.isOnExactPathGen('')) {
        return false;
    }
    var hash = window.location.hash;
    return hash === "#" + hashPrefix + path;
};
exports.genRuqESUrl = function (path) { return "/#" + hashPrefix + path; };
exports.genJsAnchor = function () { return $('<a>').prop('href', 'javascript:void(0)'); };
exports.genNavigateToRuqESUrl = function (path) { return function () {
    window.location.href = exports.genRuqESUrl(path);
    window.location.reload();
}; };
exports.createMainMenuButtonForDesktop = function (text, url, cb, iconClasses) {
    var icon = $('<i class="fa-width-rem text-left mr-3"></i>').addClass(iconClasses);
    return (url === null ? exports.genJsAnchor() : $('<a>'))
        .prop('class', 'dropdown-item')
        .text(text)
        .prepend(icon)
        .on('click', cb)
        .prop('href', url || undefined);
};
exports.createMainMenuButtonForMobile = function (text, url, cb, iconClasses) {
    var icon = $('<i class="fa-width-rem mr-3">').addClass(iconClasses);
    var link = (url === null ? exports.genJsAnchor() : $('<a>'))
        .addClass('nav-link')
        .append(icon)
        .append(text)
        .on('click', cb)
        .click(function () { return $('.navbar-toggler').click(); })
        .prop('href', url || undefined);
    return $('<li class="nav-item">').append(link);
};
exports.getImageUrlFromPostThumbnail = function (postEl) {
    var linkToImage = postEl.find('.post-img').parent();
    var href = linkToImage.attr('href');
    if (linkToImage.data('toggle') !== 'modal' || !href) {
        return null;
    }
    return href;
};
exports.getDomain = function (url) {
    var _a, _b;
    var regex = /^https?:\/\/([\w\-.]+)(?:\/.*)$/;
    if (!url) {
        return null;
    }
    return (_b = (_a = (url.match(regex))) === null || _a === void 0 ? void 0 : _a[1]) !== null && _b !== void 0 ? _b : null;
};
exports.withTooltip = function (text, html) { return function (position, size) {
    if (position === void 0) { position = 'bottom'; }
    if (size === void 0) { size = 'fit'; }
    return "<span role=\"tooltip\" aria-label=\"" + text + "\" data-microtip-position=\"" + position + "\" data-microtip-size=\"" + size + "\">" + html + "</span>";
}; };
exports.tryParseJSON = ramda_1.tryCatch(function (y) { return JSON.parse(y); }, function () { return null; });
exports.getElSize = function (x, inner) {
    if (inner === void 0) { inner = false; }
    var w = inner ? $(x).innerWidth() : $(x).width();
    var h = inner ? $(x).innerHeight() : $(x).height();
    if (w === undefined || h === undefined) {
        return null;
    }
    return [w, h];
};
exports.isElementInViewport = function (el) {
    if (!el || !el.length) {
        return false;
    }
    var rect = el[0].getBoundingClientRect();
    return (rect.top >= 0 &&
        rect.left >= 0 &&
        rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) &&
        rect.right <= (window.innerWidth || document.documentElement.clientWidth));
};
exports.scrollIntoViewIfNeeded = function (el) {
    var _a;
    if (!exports.isElementInViewport(el)) {
        (_a = el[0]) === null || _a === void 0 ? void 0 : _a.scrollIntoView();
    }
};
exports.decodeHtmlEntities = function (x) { return entities_1.decodeHTML(x); };
exports.decodeHtmlEntitiesAggressively = function (x) {
    var loop = function (a, n) {
        if (n > 10) {
            return a;
        } //
        else {
            var dec = exports.decodeHtmlEntities(a);
            return dec === a ? a : loop(dec, n + 1);
        }
    };
    return loop(x, 0);
};
exports.encodeHtmlEntities = function (x) { return entities_1.encodeHTML(x); };
exports.encodeHtmlEntitiesDeeplyInStrings = function (x) {
    if (exports.isArray(x) || exports.isObject(x)) {
        return ramda_1.map(exports.encodeHtmlEntitiesDeeplyInStrings, x);
    }
    if (exports.isString(x)) {
        return exports.encodeHtmlEntities(x);
    }
    return x;
};


/***/ }),
/* 1 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var __awaiter = (this && this.__awaiter) || function (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());
    });
};
var __generator = (this && this.__generator) || function (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 };
    }
};
var __read = (this && this.__read) || function (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;
};
var __spread = (this && this.__spread) || function () {
    for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
    return ar;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ExpandoButtonModule = void 0;
var ramda_1 = __webpack_require__(4);
var common_1 = __webpack_require__(0);
var styles_1 = __webpack_require__(3);
var selectors_1 = __webpack_require__(5);
var textOfPostProcessor_1 = __webpack_require__(39);
var modules_1 = __webpack_require__(9);
var RuqESModule_1 = __webpack_require__(6);
var domUtils_1 = __webpack_require__(10);
var TwitchClipEmbed_1 = __webpack_require__(40);
var RuqqusGuildEmbed_1 = __webpack_require__(41);
var LbryEmbed_1 = __webpack_require__(42);
var MetaEmbed_1 = __webpack_require__(43);
var SteamEmbed_1 = __webpack_require__(44);
var VideoEmbed_1 = __webpack_require__(45);
var StreamableEmbed_1 = __webpack_require__(46);
var TwitterEmbed_1 = __webpack_require__(47);
var IbbcoEmbed_1 = __webpack_require__(48);
var ImgFlipEmbed_1 = __webpack_require__(49);
var ImgurGifvEmbed_1 = __webpack_require__(50);
var GfycatVideoEmbed_1 = __webpack_require__(51);
var GifDeliveryNetworkEmbed_1 = __webpack_require__(52);
var RedGifsVideoEmbed_1 = __webpack_require__(53);
var BitChuteEmbed_1 = __webpack_require__(54);
var YouTubeEmbed_1 = __webpack_require__(55);
var ImgurGalleryEmbed_1 = __webpack_require__(56);
var DirectImageEmbed_1 = __webpack_require__(57);
var RuqqusPostEmbed_1 = __webpack_require__(20);
var ImgurAlbumEmbed_1 = __webpack_require__(58);
var ImgurBrokenEmbed_1 = __webpack_require__(59);
var OdyseeEmbed_1 = __webpack_require__(60);
var ParlerEmbed_1 = __webpack_require__(61);
var defaultMaxRecommendedImageSizeArgs = {
    contentXPercent: 0.999,
    contentYPercent: 0.66,
};
var ExpandoButtonModule = /** @class */ (function (_super) {
    __extends(ExpandoButtonModule, _super);
    function ExpandoButtonModule() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.createExpandoButton = function (cfg) {
            var el = common_1.genJsAnchor()
                .text(cfg.expandoButton.textClosed)
                .addClass(styles_1.expandoBtnCls)
                .addClass(styles_1.expandoBtnCls + "--style-" + cfg.expandoButton.style)
                .addClass('btn')
                .addClass('btn-secondary')
                .prop('role', 'button');
            if (cfg.expandoButton.hide) {
                el.hide();
            }
            return el;
        };
        _this.createBox = function (cfg) {
            var el = $('<div>').addClass(styles_1.expandBoxCls).addClass(styles_1.boxEmptyCls);
            if (cfg.expandoButton.closerEnabled) {
                var closerEl = $('<div>').addClass(styles_1.expandBoxCloserCls).click(function (evt) {
                    common_1.debugLog('createBox', 'closerEl', 'click', evt);
                    var postEl = $(evt.target).parent().parent();
                    var expandoBtn = postEl.find("." + styles_1.expandoBtnCls).first();
                    if (!expandoBtn.length) {
                        common_1.printError('Expando closer failed to locate the expando button.');
                        return;
                    }
                    common_1.debugLog({ postEl: postEl, expandoBtn: expandoBtn });
                    expandoBtn.click();
                    common_1.scrollIntoViewIfNeeded(postEl.prev());
                });
                el.append(closerEl);
            }
            return el;
        };
        _this.genButtonClickHandler = function (el, link, postUrl, cfg) {
            return function (evt) { return __awaiter(_this, void 0, void 0, function () {
                var box, boxOpened, btn, fromExpandDesktopImageCall, linkProcessorArgs_1, processed, unsupportedEl;
                var _this = this;
                return __generator(this, function (_a) {
                    switch (_a.label) {
                        case 0:
                            common_1.debugLog('genButtonClickHandler', { evt: evt, el: el, link: link, postUrl: postUrl, cfg: cfg });
                            evt.stopPropagation();
                            box = el.find("." + styles_1.expandBoxCls);
                            boxOpened = box.hasClass(styles_1.expandBoxOpenedCls);
                            btn = $(evt.target);
                            if (boxOpened) {
                                btn.text(cfg.expandoButton.textClosed);
                                box.removeClass(styles_1.expandBoxOpenedCls);
                                return [2 /*return*/];
                            }
                            btn.text(cfg.expandoButton.textOpened);
                            box.addClass(styles_1.expandBoxOpenedCls);
                            if (!box.hasClass(styles_1.boxEmptyCls)) return [3 /*break*/, 2];
                            box.removeClass(styles_1.boxEmptyCls);
                            if (!common_1.isOnPostDetail() && !common_1.isOnPostEmbed()) {
                                textOfPostProcessor_1.handleTextOfPost(postUrl, box, cfg);
                            }
                            fromExpandDesktopImageCall = ExpandoButtonModule.extractExpandDesktopImage(el);
                            linkProcessorArgs_1 = {
                                box: box,
                                cfg: cfg,
                                link: link,
                                postEl: el,
                                fromExpandDesktopImageCall: fromExpandDesktopImageCall,
                                postInfo: common_1.extractPostInfo(el),
                            };
                            return [4 /*yield*/, ExpandoButtonModule.embedProcessors.reduce(function (acc, x) { return __awaiter(_this, void 0, void 0, function () { var _a; return __generator(this, function (_b) {
                                    switch (_b.label) {
                                        case 0: return [4 /*yield*/, acc];
                                        case 1:
                                            _a = (_b.sent());
                                            if (_a) return [3 /*break*/, 3];
                                            return [4 /*yield*/, x.process(linkProcessorArgs_1)];
                                        case 2:
                                            _a = (_b.sent());
                                            _b.label = 3;
                                        case 3: return [2 /*return*/, _a];
                                    }
                                }); }); }, Promise.resolve(linkProcessorArgs_1.postInfo.textPost))];
                        case 1:
                            processed = _a.sent();
                            if (!processed) {
                                unsupportedEl = $('<div>')
                                    .append('Unsupported link type: ')
                                    .append($('<code>').html($('<a>').prop('href', link).text(link)))
                                    .append('.');
                                ExpandoButtonModule.insertWrappedElementIntoBox(box, unsupportedEl);
                            }
                            _a.label = 2;
                        case 2: return [2 /*return*/];
                    }
                });
            }); };
        };
        _this.processPostItem = function (cfg) { return function (_, domEl) {
            var el = $(domEl);
            var info = common_1.extractPostInfo(el);
            var link = info.link;
            if (!link) {
                return;
            }
            if (info.crosspost) {
                return;
            }
            el.append(_this.createBox(cfg));
            var btn = _this.createExpandoButton(cfg);
            btn.click(_this.genButtonClickHandler(el, link, info.url, cfg));
            var actions = selectors_1.getPostActionsList(el).filter(selectors_1.notCrosspost);
            if (cfg.expandoButton.alignRight) {
                actions.append(btn);
            }
            else {
                actions.prepend(btn);
            }
            if (cfg.expandoButton.clickOnPostToOpen) {
                el.find('.card-block .post-title a').click(function (evt) {
                    common_1.printLog('ExpandoButtonModule', 'clickOnPostToOpen', link, evt);
                    var titleEl = $(evt.target);
                    var selSuffix = cfg.expandoButton.hide ? '' : ':visible';
                    var currentExpandoButtonEl = titleEl.parent().parent().find("." + styles_1.expandoBtnCls + selSuffix);
                    if (currentExpandoButtonEl.length !== 1) {
                        currentExpandoButtonEl = titleEl.parent().parent().parent().parent().find("." + styles_1.expandoBtnCls + selSuffix);
                    }
                    evt.stopPropagation();
                    evt.preventDefault();
                    if (currentExpandoButtonEl.length !== 1) {
                        common_1.printError('Invalid number of expando buttons for clickOnPostToOpen handler.', currentExpandoButtonEl, titleEl);
                        return;
                    }
                    currentExpandoButtonEl.click();
                });
            }
            if (common_1.isOnPostDetail()) {
                var isUnsupportedVideoEmbed = [
                    BitChuteEmbed_1.bitChuteEmbed,
                    LbryEmbed_1.lbryEmbed,
                    TwitchClipEmbed_1.twitchClipEmbed,
                    StreamableEmbed_1.streamableEmbed,
                    VideoEmbed_1.videoEmbed,
                ].reduce(function (a, x) { return a || x.urlMatches(link); }, false);
                var openBecauseUnsupported = cfg.expandoButton.autoOpenOnDetailOnUnsupportedVideos && isUnsupportedVideoEmbed;
                var openFromAutoOpenAllOnDetail = cfg.expandoButton.autoOpenOnDetail;
                var dontOpenBecauseSupported = [
                    YouTubeEmbed_1.youTubeEmbed,
                    TwitterEmbed_1.twitterEmbed,
                ].map(function (x) { return x.urlMatches(link); }).some(ramda_1.identity);
                if ((openBecauseUnsupported || openFromAutoOpenAllOnDetail) && !dontOpenBecauseSupported) {
                    btn.trigger('click');
                }
            }
            else {
                if (cfg.expandoButton.autoOpen) {
                    btn.trigger('click');
                }
            }
        }; };
        return _this;
    }
    ExpandoButtonModule.extractExpandDesktopImage = function (el) {
        var handler = el.find('.post-img').attr('onclick');
        if (!handler || !common_1.isString(handler)) {
            return;
        }
        var matches = __spread(handler.matchAll(this.genExpandDesktopImageCallRegex()));
        var image = ramda_1.path([0, 1], matches);
        var link = ramda_1.path([0, 2], matches);
        if (!common_1.isString(image) || !common_1.isString(link)) {
            return;
        }
        return { image: image, link: link };
    };
    ExpandoButtonModule.prototype.setupStyles = function (cfg) {
        var styles = ("\n      ." + styles_1.boxPostTextCls + " { order: " + cfg.expandoButton.postTextOrder + "; }\n      ." + styles_1.boxEmbedCls + " { order: " + cfg.expandoButton.embedOrder + "; }\n      ." + styles_1.boxPostCommentsWithButtonCls + " { order: " + cfg.expandoButton.commentsOrder + "; }\n    ").trimEnd();
        domUtils_1.addStyle(styles, styles_1.expandoStylesCls);
    };
    ExpandoButtonModule.prototype.setup = function (args, cfg) {
        var _a;
        return __awaiter(this, void 0, void 0, function () {
            return __generator(this, function (_b) {
                if (!((_a = cfg === null || cfg === void 0 ? void 0 : cfg.expandoButton) === null || _a === void 0 ? void 0 : _a.enabled)) {
                    return [2 /*return*/];
                }
                if (!ramda_1.prop('silent', args || {})) {
                    common_1.debugLog('setupExpandoButton');
                }
                selectors_1.getPosts().filter(function (_, el) { return $(el).find("." + styles_1.expandoBtnCls).length === 0; }).each(this.processPostItem(cfg));
                if (!this.firstSetupRunFinished) {
                    this.setupStyles(cfg);
                }
                return [2 /*return*/];
            });
        });
    };
    ;
    ExpandoButtonModule.prototype.onContentChange = function (args, cfg) {
        return __awaiter(this, void 0, void 0, function () {
            return __generator(this, function (_a) {
                return [2 /*return*/, this.setup(args, cfg)];
            });
        });
    };
    ExpandoButtonModule.embedProcessors = [
        DirectImageEmbed_1.directImageEmbed,
        RuqqusPostEmbed_1.ruqqusPostEmbed,
        ImgurBrokenEmbed_1.imgurBrokenEmbed,
        ImgurAlbumEmbed_1.imgurAlbumEmbed,
        ImgurGalleryEmbed_1.imgurGalleryEmbed,
        YouTubeEmbed_1.youTubeEmbed,
        BitChuteEmbed_1.bitChuteEmbed,
        RedGifsVideoEmbed_1.redGifsVideoEmbed,
        GifDeliveryNetworkEmbed_1.gifDeliveryNetworkEmbed,
        GfycatVideoEmbed_1.gfycatVideoEmbed,
        ImgurGifvEmbed_1.imgurGifvEmbed,
        ImgFlipEmbed_1.imgFlipEmbed,
        IbbcoEmbed_1.ibbcoEmbed,
        TwitterEmbed_1.twitterEmbed,
        LbryEmbed_1.lbryEmbed,
        OdyseeEmbed_1.odyseeEmbed,
        RuqqusGuildEmbed_1.ruqqusGuildEmbed,
        TwitchClipEmbed_1.twitchClipEmbed,
        StreamableEmbed_1.streamableEmbed,
        SteamEmbed_1.steamEmbed,
        ParlerEmbed_1.parlerEmbed,
        VideoEmbed_1.videoEmbed,
        MetaEmbed_1.metaEmbed,
    ];
    ExpandoButtonModule.insertWrappedElementIntoBox = function (box, element, wrapperClass) {
        if (wrapperClass === void 0) { wrapperClass = styles_1.boxEmbedCls; }
        var wrapped = $('<div>').addClass(wrapperClass);
        var toAdd = common_1.isArray(element) ? element : [element];
        toAdd.forEach(function (x) { return wrapped.append(x); });
        ExpandoButtonModule.insertRawElementIntoBox(box, wrapped);
        modules_1.handleModulesAfterContentChange();
    };
    ExpandoButtonModule.insertRawElementIntoBox = function (box, element) {
        box.append(element);
    };
    ExpandoButtonModule.writeErrorToExpandButtonBox = function (box, errorText, retryCb) {
        if (retryCb === void 0) { retryCb = null; }
        var errorEl = $('<div>')
            .addClass(styles_1.errorTextCls)
            .append($('<span>').text(errorText));
        if (retryCb) {
            var retryButton = $('<button>')
                .text('Retry')
                .addClass('btn')
                .addClass('btn-primary')
                .addClass('ml-1')
                .click(function () {
                box.find("." + styles_1.errorTextCls).remove();
                retryCb();
            });
            errorEl.append(retryButton);
        }
        box.prepend(errorEl);
    };
    ExpandoButtonModule.setupResizing = function (el) {
        var finishSetup = function (firstRun) {
            common_1.debugLog('setupResizing', 'finishSetup');
            var elW = el.width();
            var elPW = el.parent().innerWidth();
            var initValue = elW / elPW * 100;
            common_1.debugLog('setupResizing', 'finishSetup', { initValue: initValue, elW: elW, elPW: elPW });
            if (!elW || !elPW) {
                if (firstRun) {
                    setTimeout(function () { return finishSetup(false); }, 10);
                }
                else {
                    common_1.printError('Failed to setup resizing for ', el.toArray());
                }
                return;
            }
            el.css({ maxWidth: 'none', maxHeight: 'none', width: initValue + "%" });
            el.addClass(styles_1.resizableDirectImageCls);
            el.parent().addClass(styles_1.resizableDirectImageWrapperCls);
            var state = {
                resizing: false,
                startPoint: null,
                startValue: initValue,
                value: initValue,
            };
            el.mousedown(function (e) {
                if (e.button !== 0) {
                    return;
                }
                state.resizing = true;
                state.startPoint = [e.clientX, e.clientY];
                state.startValue = state.value;
            });
            var doc = $(document);
            doc.mouseup(function (e) {
                state.resizing = false;
                state.startPoint = null;
            });
            doc.mousemove(function (e) {
                if (!state.resizing || !state.startPoint) {
                    return;
                }
                var nx = e.clientX;
                var ny = e.clientY;
                var _a = __read(state.startPoint, 2), ox = _a[0], oy = _a[1];
                var dx = nx - ox;
                var dy = ny - oy;
                var dist = dx + dy;
                state.value = ramda_1.clamp(5, 500, state.startValue + dist / 5);
                el.css({ width: state.value + "%" });
            });
        };
        common_1.debugLog('setupResizing', { naturalWidth: el.prop('naturalWidth'), complete: el.prop('complete') }, el);
        if (el.prop('complete') && el.prop('naturalWidth') !== 0) {
            finishSetup(true);
        }
        else {
            el.on('load', function () { return finishSetup(true); });
        }
    };
    ExpandoButtonModule.getMaxRecommendedImageSize = function (parent, args) {
        if (args === void 0) { args = {}; }
        var opts = ramda_1.merge(defaultMaxRecommendedImageSizeArgs)(args);
        if (!common_1.isNumber(opts.contentXPercent) || opts.contentXPercent < 0 || opts.contentXPercent > 1) {
            throw new Error("Invalid opts.contentXPercent = " + opts.contentXPercent);
        }
        if (!common_1.isNumber(opts.contentYPercent) || opts.contentYPercent < 0 || opts.contentYPercent > 1) {
            throw new Error("Invalid opts.contentYPercent = " + opts.contentYPercent);
        }
        var winSize = common_1.getElSize(common_1.getWindowEl());
        var parentSize = common_1.getElSize(parent);
        return [parentSize[0] * opts.contentXPercent, winSize[1] * opts.contentYPercent];
    };
    ExpandoButtonModule.genImageForBox = function (box, link, cfg, type) {
        var _a;
        var el = $('<img>').prop('src', link).prop('draggable', false).addClass(styles_1.boxImgCls).css({ maxWidth: '1px' });
        var maxSize = type === 'metaCard' ? { contentXPercent: 0.95 } : undefined;
        var recSize = ExpandoButtonModule.getMaxRecommendedImageSize(box, maxSize);
        common_1.debugLog('genImageForBox', box.width(), recSize, maxSize);
        el.css({
            maxWidth: recSize[0],
            maxHeight: recSize[1],
        });
        if ((_a = cfg === null || cfg === void 0 ? void 0 : cfg.expandoButton) === null || _a === void 0 ? void 0 : _a.resize) {
            setTimeout(function () { return ExpandoButtonModule.setupResizing(el); });
        }
        return el;
    };
    ExpandoButtonModule.insertImageIntoBox = function (box, link, cfg) {
        var el = ExpandoButtonModule.genImageForBox(box, link, cfg, 'expando');
        ExpandoButtonModule.insertWrappedElementIntoBox(box, el);
        return el;
    };
    ExpandoButtonModule.genExpandDesktopImageCallRegex = function () { return /expandDesktopImage\('(.*)','(.*)'\)/g; };
    return ExpandoButtonModule;
}(RuqESModule_1.RuqESModule));
exports.ExpandoButtonModule = ExpandoButtonModule;


/***/ }),
/* 2 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var __awaiter = (this && this.__awaiter) || function (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());
    });
};
var __generator = (this && this.__generator) || function (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 };
    }
};
var __read = (this && this.__read) || function (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;
};
var __spread = (this && this.__spread) || function () {
    for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
    return ar;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.EmbedProcessor = void 0;
var ramda_1 = __webpack_require__(4);
var ExpandoButtonModule_1 = __webpack_require__(1);
var common_1 = __webpack_require__(0);
var EmbedProcessor = /** @class */ (function () {
    function EmbedProcessor() {
    }
    EmbedProcessor.prototype.genRegex = function () { return null; };
    EmbedProcessor.prototype.urlMatches = function (link) {
        var regex = this.genRegex();
        if (regex === null) {
            throw new Error("Missing regex generator");
        }
        return regex.test(link);
    };
    EmbedProcessor.prototype.process = function (args) {
        return __awaiter(this, void 0, void 0, function () {
            return __generator(this, function (_a) {
                if (!this.urlMatches(args.link)) {
                    return [2 /*return*/, false];
                }
                else {
                    return [2 /*return*/, this.processMatchingLink(args)];
                }
                return [2 /*return*/];
            });
        });
    };
    EmbedProcessor.prototype.matchAllAndGetCapturedPart = function (link) {
        var matches = __spread(link.matchAll(this.genRegex()));
        var res = ramda_1.path([0, 1], matches) || ramda_1.path([0, 2], matches);
        return res !== null && res !== void 0 ? res : null;
    };
    EmbedProcessor.prototype.handleResponseError = function (box, err) {
        var clsName = this.constructor.name;
        ExpandoButtonModule_1.ExpandoButtonModule.writeErrorToExpandButtonBox(box, clsName + ": Server responded with error #" + err.status + ".");
        common_1.printError('[Embed]', clsName, err);
    };
    return EmbedProcessor;
}());
exports.EmbedProcessor = EmbedProcessor;


/***/ }),
/* 3 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.setupStyles = exports.themeDark = exports.themeLight = exports.postThumbnailModeCls = exports.postThumbnailModeProcessedCls = exports.postShowThumbnailOnHoverWrapperCls = exports.postShowThumbnailOnHoverImageCls = exports.postShowThumbnailOnHoverProcessedCls = exports.loadingAppCls = exports.saveCommentsContainerCls = exports.savePostsContainerCls = exports.saveTabButtonCommentsCls = exports.saveTabButtonPostsCls = exports.saveEmptySavesButtonPlaceholderCls = exports.saveGuildImageCls = exports.saveCommentProcessedCls = exports.savePostProcessedCls = exports.commentRevealBlockedProcessedCls = exports.postCategoryChangeDetectorCls = exports.commentReactionGifIcoProcessedCls = exports.reactionGifPopUpCls = exports.imageUploadInputCls = exports.postDownloadButtonProcessedCls = exports.postUpDownVotesAsTextProcessedCls = exports.upDownVotesAsTextWrapperCls = exports.UpDownVotesAsTextDownCls = exports.upDownVotesAsTextUpCls = exports.commentImageUploadProcessedCls = exports.commentCollapseByRegexProcessedCls = exports.commentPreviewAppliedCls = exports.commentPreviewCls = exports.commentUpDownVotesAsTextProcessedCls = exports.commentBiggerFoldButtonsCls = exports.advancedModuleCssId = exports.advancedModuleJavaScriptId = exports.postRulesAppliedCls = exports.closeButtonInImageDialogCls = exports.imageThumbnailTypeIconFACls = exports.imageThumbnailTypeIconOnMobileCls = exports.imageThumbnailTypeIconBackgroundCls = exports.imageThumbnailTypeIconCls = exports.resizableDirectImageCls = exports.resizableDirectImageWrapperCls = exports.disablePostActionsJumpingAboveBarOnHoverCls = exports.nonAggressiveCls = exports.improvedTableCls = exports.infiniteScrollCoolDownMarkerCls = exports.widthAutoCls = exports.blurThumbnailCls = exports.postPreviewButtonCls = exports.postPreviewCls = exports.uploadImageToImgbbButtonSmallCls = exports.uploadImageToImgbbButtonLoadingCls = exports.uploadImageToImgbbButtonHighlightedCls = exports.uploadImageToImgbbButtonCls = exports.loadTitleButtonLoadingCls = exports.loadTitleButtonCls = exports.btnDangerCls = exports.btnPrimaryCls = exports.hideScrollbarCls = exports.sidebarFavoritesEmptyNoticeCls = exports.sidebarFavoritesDeleteItemCls = exports.sidebarFavoritesDownItemCls = exports.sidebarFavoritesUpItemCls = exports.sidebarFavoritesEditItemCls = exports.sidebarFavoritesItemButtonCls = exports.sidebarFavoritesShowOnlyInEditingCls = exports.sidebarFavoritesEditingCls = exports.sidebarFavoritesGuildBtnCls = exports.sidebarFavoritesEditButtonCls = exports.sidebarSmallGuildImageCls = exports.sidebarFavoritesSmallImageCls = exports.sidebarFavoritesCls = exports.sidebarIndependentScrollCls = exports.sidebarClosedCls = exports.sidebarButtonIconCls = exports.sidebarButtonCls = exports.semiHiddenPostCls = exports.bigVoteArrowsOnMobileCls = exports.voteAnimHandlerAppliedCls = exports.voteAnimCls = exports.blurCls = exports.blurAnimatedCls = exports.formCls = exports.aboutRuqesLogoCls = exports.settingsAboutQrCls = exports.settingsPostRulesNumberCls = exports.settingsPostRuleBodyCls = exports.settingsPostRuleTemplateFormCls = exports.settingsPostRuleNewFormCls = exports.settingsPostRuleListItemNameCls = exports.settingsPostRuleListItemDisabledCls = exports.settingsPostRuleListItemCls = exports.settingsPostRulesTemplatesListEmptyCls = exports.settingsPostRulesTemplatesListCls = exports.settingsPostRulesListCls = exports.settingsExpandoOrdersCls = exports.settingsActiveTabButtonCls = exports.settingsMenuCls = exports.settingsExpandoButtonActionCharacterCls = exports.settingsLogoAnimCls = exports.settingsLogoCls = exports.settingsCaptionCls = exports.settingsModalVisibleCls = exports.settingsModalCls = exports.settingsBackdropCls = exports.creatorNameCls = exports.creatorMarkCls = exports.reactionGifIcoCls = exports.reactionGifCls = exports.ruqesMarkCls = exports.pageLoadingErrorCls = exports.errorTextCls = exports.textLoaderCls = exports.codeBlockCls = exports.loadingDotsDarkCls = exports.loadingDotsCls = exports.postLoadingCls = exports.pageLoadingCls = exports.boxPostCommentsWithButtonCls = exports.boxPostCommentsCls = exports.boxPostTextCls = exports.boxMetaEmbedUrlCls = exports.boxMetaEmbedCls = exports.boxEmbedCls = exports.boxGuildCls = exports.boxImgCls = exports.expandoStylesCls = exports.expandoBtnCls = exports.boxEmptyCls = exports.expandBoxOpenedCls = exports.expandBoxCloserCls = exports.expandBoxCls = exports.genClsName = exports.clsPrefix = void 0;
var microtip_css_1 = __importDefault(__webpack_require__(27));
var domUtils_1 = __webpack_require__(10);
var logo_svg_1 = __importDefault(__webpack_require__(8));
exports.clsPrefix = 'RuqES-by-enefi--';
exports.genClsName = function (x) { return exports.clsPrefix + x; };
exports.expandBoxCls = exports.genClsName('box');
exports.expandBoxCloserCls = exports.genClsName('box-closer');
exports.expandBoxOpenedCls = exports.genClsName('box-opened');
exports.boxEmptyCls = exports.genClsName('box-empty');
exports.expandoBtnCls = exports.genClsName('expando-button');
exports.expandoStylesCls = exports.genClsName('expando-styles');
exports.boxImgCls = exports.genClsName('box-img');
exports.boxGuildCls = exports.genClsName('box-guild');
exports.boxEmbedCls = exports.genClsName('box-embed');
exports.boxMetaEmbedCls = exports.genClsName('box-meta-embed');
exports.boxMetaEmbedUrlCls = exports.genClsName('box-meta-embed-url');
exports.boxPostTextCls = exports.genClsName('box-post-text');
exports.boxPostCommentsCls = exports.genClsName('box-post-comments');
exports.boxPostCommentsWithButtonCls = exports.genClsName('box-post-comments-with-button');
exports.pageLoadingCls = exports.genClsName('page-loader');
exports.postLoadingCls = exports.genClsName('post-loader');
exports.loadingDotsCls = exports.genClsName('loading-dots');
exports.loadingDotsDarkCls = exports.genClsName('loading-dots-dark');
exports.codeBlockCls = exports.genClsName('code-block');
exports.textLoaderCls = exports.genClsName('text-loader');
exports.errorTextCls = exports.genClsName('error-text');
exports.pageLoadingErrorCls = exports.genClsName('page-loading-error');
exports.ruqesMarkCls = exports.genClsName('ruqes-mark');
exports.reactionGifCls = exports.genClsName('reaction-gif');
exports.reactionGifIcoCls = exports.genClsName('reaction-gif-ico');
exports.creatorMarkCls = exports.genClsName('creator-mark');
exports.creatorNameCls = exports.genClsName('creator-name');
exports.settingsBackdropCls = exports.genClsName('settings-backdrop');
exports.settingsModalCls = exports.genClsName('settings-modal');
exports.settingsModalVisibleCls = exports.genClsName('settings-modal-shown');
exports.settingsCaptionCls = exports.genClsName('settings-caption');
exports.settingsLogoCls = exports.genClsName('settings-logo');
exports.settingsLogoAnimCls = exports.genClsName('settings-logo-anim');
exports.settingsExpandoButtonActionCharacterCls = exports.genClsName('settings-expando-action-char');
exports.settingsMenuCls = exports.genClsName('settings-menu');
exports.settingsActiveTabButtonCls = exports.genClsName('settings-active-tab-button');
exports.settingsExpandoOrdersCls = exports.genClsName('settings-expando-orders');
exports.settingsPostRulesListCls = exports.genClsName('settings-post-rules-list');
exports.settingsPostRulesTemplatesListCls = exports.genClsName('settings-post-rules-templates-list');
exports.settingsPostRulesTemplatesListEmptyCls = exports.genClsName('settings-post-rules-templates-list-empty');
exports.settingsPostRuleListItemCls = exports.genClsName('settings-post-rule-list-item');
exports.settingsPostRuleListItemDisabledCls = exports.genClsName('settings-post-rule-list-item-disabled');
exports.settingsPostRuleListItemNameCls = exports.genClsName('settings-post-rule-list-item-name');
exports.settingsPostRuleNewFormCls = exports.genClsName('settings-post-rule-new-form');
exports.settingsPostRuleTemplateFormCls = exports.genClsName('settings-post-rule-template-form');
exports.settingsPostRuleBodyCls = exports.genClsName('settings-post-rule-body');
exports.settingsPostRulesNumberCls = exports.genClsName('settings-post-rules-number');
exports.settingsAboutQrCls = exports.genClsName('settings-about-qr');
exports.aboutRuqesLogoCls = exports.genClsName('about-ruqes-logo');
exports.formCls = exports.genClsName('form');
exports.blurAnimatedCls = exports.genClsName('blur-anim');
exports.blurCls = exports.genClsName('blur');
exports.voteAnimCls = exports.genClsName('vote-anim');
exports.voteAnimHandlerAppliedCls = exports.genClsName('vote-anim-handler-applied');
exports.bigVoteArrowsOnMobileCls = exports.genClsName('big-vote-arrows-on-mobile');
exports.semiHiddenPostCls = exports.genClsName('semi-hidden-post');
exports.sidebarButtonCls = exports.genClsName('sidebar-button');
exports.sidebarButtonIconCls = exports.genClsName('sidebar-button-icon');
exports.sidebarClosedCls = exports.genClsName('sidebar-closed');
exports.sidebarIndependentScrollCls = exports.genClsName('sidebar-independent-scroll');
exports.sidebarFavoritesCls = exports.genClsName('sidebar-favorites');
exports.sidebarFavoritesSmallImageCls = exports.genClsName('sidebar-favorites-small-image');
exports.sidebarSmallGuildImageCls = exports.genClsName('sidebar-small-guild-image');
exports.sidebarFavoritesEditButtonCls = exports.genClsName('sidebar-favorites-edit-button');
exports.sidebarFavoritesGuildBtnCls = exports.genClsName('sidebar-favorites-guild-btn');
exports.sidebarFavoritesEditingCls = exports.genClsName('sidebar-favorites-editing');
exports.sidebarFavoritesShowOnlyInEditingCls = exports.genClsName('sidebar-favorites-show-only-in-editing');
exports.sidebarFavoritesItemButtonCls = exports.genClsName('sidebar-favorites-item-button');
exports.sidebarFavoritesEditItemCls = exports.genClsName('sidebar-favorites-edit-item');
exports.sidebarFavoritesUpItemCls = exports.genClsName('sidebar-favorites-up-item');
exports.sidebarFavoritesDownItemCls = exports.genClsName('sidebar-favorites-down-item');
exports.sidebarFavoritesDeleteItemCls = exports.genClsName('sidebar-favorites-delete-item');
exports.sidebarFavoritesEmptyNoticeCls = exports.genClsName('sidebar-favorites-empty-notice');
exports.hideScrollbarCls = exports.genClsName('hide-scrollbar');
exports.btnPrimaryCls = exports.genClsName('btn-primary');
exports.btnDangerCls = exports.genClsName('btn-danger');
exports.loadTitleButtonCls = exports.genClsName('post-load-title-button');
exports.loadTitleButtonLoadingCls = exports.genClsName('post-load-title-button-loading');
exports.uploadImageToImgbbButtonCls = exports.genClsName('post-upload-imgbb-button');
exports.uploadImageToImgbbButtonHighlightedCls = exports.genClsName('post-upload-imgbb-button-highlighted');
exports.uploadImageToImgbbButtonLoadingCls = exports.genClsName('post-upload-imgbb-button-loading');
exports.uploadImageToImgbbButtonSmallCls = exports.genClsName('post-upload-imgbb-button-small');
exports.postPreviewCls = exports.genClsName('post-preview');
exports.postPreviewButtonCls = exports.genClsName('post-preview-button');
exports.blurThumbnailCls = exports.genClsName('blur-thumbnail');
exports.widthAutoCls = exports.genClsName('width-auto');
exports.infiniteScrollCoolDownMarkerCls = exports.genClsName('inifinite-scroll-cooldown-marker');
exports.improvedTableCls = exports.genClsName('improved-table');
exports.nonAggressiveCls = exports.genClsName('non-aggressive');
exports.disablePostActionsJumpingAboveBarOnHoverCls = exports.genClsName('disable-post-actions-jumping-above-bar-on-hover');
exports.resizableDirectImageWrapperCls = exports.genClsName('resizable-direct-image-wrapper');
exports.resizableDirectImageCls = exports.genClsName('resizable-direct-image');
exports.imageThumbnailTypeIconCls = exports.genClsName('image-thumbnail-type-icon');
exports.imageThumbnailTypeIconBackgroundCls = exports.genClsName('image-thumbnail-type-icon-bg');
exports.imageThumbnailTypeIconOnMobileCls = exports.genClsName('image-thumbnail-type-icon-on-mobile');
exports.imageThumbnailTypeIconFACls = exports.genClsName('image-thumbnail-type-icon-fa');
exports.closeButtonInImageDialogCls = exports.genClsName('close-button-in-image-dialog');
exports.postRulesAppliedCls = exports.genClsName('post-rules-applied');
exports.advancedModuleJavaScriptId = exports.genClsName('advanced-module-java-script');
exports.advancedModuleCssId = exports.genClsName('advanced-module-css');
exports.commentBiggerFoldButtonsCls = exports.genClsName('comment-bigger-fold-buttons');
exports.commentUpDownVotesAsTextProcessedCls = exports.genClsName('comment-up-down-votes-as-text-processed');
exports.commentPreviewCls = exports.genClsName('comment-preview');
exports.commentPreviewAppliedCls = exports.genClsName('comment-preview-applied');
exports.commentCollapseByRegexProcessedCls = exports.genClsName('comment-collapse-by-regex-processed');
exports.commentImageUploadProcessedCls = exports.genClsName('comment-image-upload-processed');
exports.upDownVotesAsTextUpCls = exports.genClsName('up-down-votes-as-text-up');
exports.UpDownVotesAsTextDownCls = exports.genClsName('up-down-votes-as-text-down');
exports.upDownVotesAsTextWrapperCls = exports.genClsName('up-down-votes-as-text-wrapper');
exports.postUpDownVotesAsTextProcessedCls = exports.genClsName('post-up-down-votes-as-text-processed');
exports.postDownloadButtonProcessedCls = exports.genClsName('post-download-button-processed');
exports.imageUploadInputCls = exports.genClsName('image-upload-input');
exports.reactionGifPopUpCls = exports.genClsName('reaction-gif-popup');
exports.commentReactionGifIcoProcessedCls = exports.genClsName('comment-reaction-gif-ico-processed');
exports.postCategoryChangeDetectorCls = exports.genClsName('post-category-change-detector');
exports.commentRevealBlockedProcessedCls = exports.genClsName('comment-reveal-blocked-processed');
exports.savePostProcessedCls = exports.genClsName('save-post-processed');
exports.saveCommentProcessedCls = exports.genClsName('save-comment-processed');
exports.saveGuildImageCls = exports.genClsName('save-guild-image');
exports.saveEmptySavesButtonPlaceholderCls = exports.genClsName('save-empty-saves-button-placeholder');
exports.saveTabButtonPostsCls = exports.genClsName('save-tab-button-posts');
exports.saveTabButtonCommentsCls = exports.genClsName('save-tab-button-comments');
exports.savePostsContainerCls = exports.genClsName('save-posts-container');
exports.saveCommentsContainerCls = exports.genClsName('save-comments-container');
exports.loadingAppCls = exports.genClsName('loading-app');
exports.postShowThumbnailOnHoverProcessedCls = exports.genClsName('post-show-thumbnail-on-hover-processed');
exports.postShowThumbnailOnHoverImageCls = exports.genClsName('post-show-thumbnail-on-hover-image');
exports.postShowThumbnailOnHoverWrapperCls = exports.genClsName('post-show-thumbnail-on-hover-wrapper');
exports.postThumbnailModeProcessedCls = exports.genClsName('post-thumbnail-mode-processed');
exports.postThumbnailModeCls = exports.genClsName('post-thumbnail-mode');
exports.themeLight = exports.genClsName('theme-light');
exports.themeDark = exports.genClsName('theme-dark');
exports.setupStyles = function (isDarkTheme) {
    var primaryColor = 'rgba(128, 90, 213, 1)';
    var ruqesColor = '#800080';
    var ruqesDarkColor = '#400040';
    var ruqesLighterColor = '#C000C0';
    var ruqesLightColor = '#E070E0';
    var containerBorderColor = isDarkTheme ? '#303030' : '#E2E8F0';
    var containerBackgroundColor = isDarkTheme ? '#181818' : '#D2D8E0';
    var containerBackgroundColorSecondary = isDarkTheme ? '#232323' : '#c8ced6';
    var textColor = isDarkTheme ? 'white' : 'black';
    var revTextColor = isDarkTheme ? 'black' : 'white';
    var arrowVoteColor = isDarkTheme ? '#303030' : '#cbd5e0';
    var upvoteColor = '#805ad5';
    var downvoteColor = '#38b2ac';
    var anchorColorInDarkTheme = '#cfcfcf';
    var anchorColorInLightTheme = '#121213';
    var anchorColor = isDarkTheme ? anchorColorInDarkTheme : anchorColorInLightTheme;
    var commentCollapseColor = isDarkTheme ? '#aaa' : '#cbd5e0';
    var loadingTextShadowColor = '#555';
    domUtils_1.addStyle(microtip_css_1.default);
    domUtils_1.addStyle("\n." + exports.widthAutoCls + " { width: auto; }\n  \n." + exports.expandoBtnCls + " {\n  margin: -0.4em 1em -0.4em 0;\n  padding: 0;\n  display: flex;\n  align-items: center;\n  justify-content: center;\n}\n\n." + exports.expandoBtnCls + ":last-child {\n  margin: -0.4em 0 -0.4em 1em;\n}\n\n." + exports.expandoBtnCls + "--style-bigWide {\n  width: 3.25em;\n  height: 2.5em;\n}\n." + exports.expandoBtnCls + "--style-big {\n  width: 2.5em;\n  height: 2.5em;\n}\n." + exports.expandoBtnCls + "--style-medium {\n  width: 2em;\n  height: 2em;\n  font-size: 90%;\n}\n." + exports.expandoBtnCls + "--style-small {\n  width: 1.5em;\n  height: auto;\n  margin: -0.2em 0.5em 0 0;\n  border: 0;\n  background: none;\n}\n\n." + exports.expandBoxCls + " {\n  display: none;\n  margin-top: 0.5em;\n  padding-left: calc(10px + 0.6em);\n  padding-right: 0.6em;\n  word-break: break-word;\n  position: relative;\n}\n\n." + exports.expandBoxOpenedCls + " {\n  display: flex;\n  flex-direction: column;\n}\n\n." + exports.expandBoxCloserCls + " {\n  position: absolute;\n  top: 0;\n  bottom: 0;\n  left: 2px;\n  padding-right: 15px;\n  width: 2px;\n  cursor: pointer;\n}\n." + exports.expandBoxCloserCls + "::before {\n  position: absolute;\n  height: 100%;\n  content: \"\";\n  background-color: " + commentCollapseColor + ";\n  width: 3px;\n}\n." + exports.expandBoxCloserCls + ":hover::before {\n  background-color: " + primaryColor + ";\n}\n\nimg." + exports.boxImgCls + " {}\n\n.stretched-link::after { display: none; }\n\n." + exports.boxEmbedCls + " {}\n\n." + exports.boxPostTextCls + " {\n  padding: 5px;\n}\n\n." + exports.boxPostTextCls + " p:last-child {\n  margin-bottom: 0;\n}\n\n." + exports.boxPostCommentsCls + " {\n  padding: 5px 5px 5px 0;\n}\n\n." + exports.boxPostCommentsCls + " .comment:first-child {\n  margin-top: 0.5em;\n}\n." + exports.boxPostCommentsWithButtonCls + " {\n  padding: 5px 5px 5px 0;\n}\n\n." + exports.boxGuildCls + " {\n  background-color: " + containerBorderColor + ";\n  border-radius: 0.25rem;\n  font-size: 135%;\n  margin: 0.5em;\n  transition: background-color 0.1s, box-shadow 0.1s; \n}\n." + exports.boxGuildCls + ":hover {\n  background-color: " + containerBackgroundColorSecondary + ";\n  box-shadow: " + revTextColor + " inset 0px 0px 2px;\n}\n." + exports.boxGuildCls + " img {\n  border-radius: 50%;\n  width: 2.5em;\n}\n\n." + exports.boxMetaEmbedCls + " {\n  border: 1px solid " + containerBorderColor + ";\n  background: " + containerBackgroundColor + ";\n  border-radius: 0.5em;\n}\n." + exports.boxMetaEmbedUrlCls + " {\n  background: " + containerBorderColor + ";\n  margin: 0 -0.5em 0.25em -0.5em;\n  border-radius: 0.25em 0.25em 0 0;\n  padding: 2px 5px;\n  opacity: 0.5;\n  text-align: center;\n  position: absolute;\n  width: 100%;\n}\n\n@keyframes ruqesLoadingDots {\n  0% {\n    transform: translate(0, 0) scale(1);\n    color: " + primaryColor + "\n  }\n  25% {\n    transform: translate(0, -0.2em) scale(1.33);\n  }\n  50% {\n    transform: translate(0, 0) scale(1);\n  }\n  55% {\n  }\n  65% {\n    color: " + textColor + "\n  }\n}\n\n." + exports.loadingDotsCls + " i {\n  animation-name: ruqesLoadingDots;\n  animation-duration: 2s;\n  animation-delay: 0s;\n  animation-iteration-count: infinite;\n  animation-timing-function: ease-in-out;\n  display: inline-block;\n}\n\n." + exports.loadingDotsCls + " i:nth-child(2) { animation-delay: 0.2s; }\n." + exports.loadingDotsCls + " i:nth-child(3) { animation-delay: 0.4s; }\n\n@keyframes ruqesLoadingDotsDark {\n  0% {\n    transform: translate(0, 0) scale(1);\n    color: " + ruqesColor + ";\n  }\n  25% {\n    transform: translate(0, -0.2em) scale(1.33);\n  }\n  50% {\n    transform: translate(0, 0) scale(1);\n  }\n  55% {\n  }\n  65% {\n    color: " + ruqesDarkColor + ";\n  }\n}\n\n." + exports.loadingDotsDarkCls + " i {\n  animation-name: ruqesLoadingDotsDark;\n}\n\n." + exports.codeBlockCls + " {\n  border: 1px solid " + containerBorderColor + ";\n  padding: 1em;\n  font-size: 66%;\n  background-color: lightgray;\n}\n\n." + exports.textLoaderCls + " {\n  font-weight: bold;\n}\n\n." + exports.pageLoadingCls + " {\n  margin: 1em 0 3em 0;\n  text-align: center;\n}\n\n." + exports.errorTextCls + " {\n  font-weight: bold;\n  color: red;\n}\n\n." + exports.pageLoadingErrorCls + " {\n  text-align: left;\n}\n\n." + exports.ruqesMarkCls + " svg {\n  width: 1.2em;\n  height: 1.2em;\n}\n." + exports.reactionGifIcoCls + " svg {\n  width: 1.9em;\n  height: 1.5em;\n  margin-bottom: 1px\n}\n\n." + exports.reactionGifCls + " {\n  height: 60px;\n  width: 100px;\n  padding: 5px;\n  cursor: pointer;\n  user-select: none;\n  background-color: transparent;\n  transition: 100ms ease-in-out;\n}\n\n." + exports.reactionGifCls + ":hover{\n  background-color: " + containerBackgroundColorSecondary + ";\n}\n\n." + exports.reactionGifPopUpCls + " {\n  max-width: 400px;\n  position: absolute;\n  background-color: " + containerBorderColor + ";\n  border: 0.99px solid " + containerBackgroundColor + ";\n  border-radius: 5px;\n  display: flex;\n  flex-wrap: wrap;\n  z-index: 3;\n  box-sizing: content-box;\n  overflow: hidden;\n}\n\n." + exports.creatorMarkCls + " svg {\n  width: 1.2em;\n  height: 1.2em;\n}\n\n." + exports.creatorNameCls + " {\n  transition: color 0.2s;\n  color: " + (isDarkTheme ? '#bf40bf' : '#800080') + ";\n}\n." + exports.creatorNameCls + ":hover {\n  color: " + textColor + ";\n}\n\n." + exports.settingsBackdropCls + " {\n  position: fixed;\n  width: 100%;\n  height: 100%;\n  background-color: " + (containerBackgroundColor + "66") + ";\n  z-index: 10000;\n  top: 0;\n}\n\n." + exports.settingsModalCls + "::-webkit-scrollbar {\n    height: 5px;\n    width: 5px;\n    background: " + containerBorderColor + ";\n}\n." + exports.settingsModalCls + "::-webkit-scrollbar-thumb {\n    background: " + containerBackgroundColor + ";\n}\n." + exports.settingsModalCls + " {\n  position: fixed;\n  left: 50%;\n  top: 100px;\n  background-color: " + containerBorderColor + ";\n  border: 2px solid " + containerBackgroundColor + ";\n  border-radius: 5px;\n  padding: 0.5em 1em 0.8em 1em;\n  transform: translate(-50%, 0%) scale(0.8);\n  min-width: 550px;\n  max-width: 36em;\n  overflow-y: auto;\n  max-height: calc(100% - 110px);\n  opacity: 0;\n  transition: transform 0.2s, opacity 0.1s;\n  scrollbar-color: " + containerBackgroundColor + " " + containerBorderColor + ";\n  scrollbar-width: thin;\n  display: flex;\n  flex-direction: column;\n}\n." + exports.settingsModalVisibleCls + " {\n  transform: translate(-50%, 0%) scale(1);\n  opacity: 1;\n}\n@media (max-width: 575.98px) {\n  ." + exports.settingsModalCls + " {\n    width: 100%;\n    min-height: 100%;\n    min-width: auto;\n    max-width: 100%;\n    top: 0;\n  }\n  ." + exports.reactionGifPopUpCls + " {\n    left: 0 !important;\n  }\n}\n\n." + exports.formCls + " input[type=\"checkbox\"] {\n  width: auto;\n  height: auto;\n  display: inline-block;\n  margin-right: 0.3em;\n}\n\n." + exports.formCls + " input[type=\"radio\"] {\n  width: 1.2em;\n  height: auto;\n  display: inline-block;\n}\n\n." + exports.formCls + " label {\n  margin-bottom: 0;\n}\n\n." + exports.formCls + " .form-group {\n  margin-bottom: 0;\n  display: flex;\n  align-items: center;\n}\n\n." + exports.settingsMenuCls + " {\n  display: flex;\n  flex-wrap: wrap;\n  justify-content: center;\n}\n\n." + exports.settingsActiveTabButtonCls + " {\n  border-color: " + ruqesColor + " !important;\n}\n\n." + exports.settingsExpandoOrdersCls + " {\n}\n." + exports.settingsExpandoOrdersCls + " input {\n  width: 5em;\n}\n." + exports.settingsExpandoOrdersCls + " label {\n  width: 7em;\n}\n\n." + exports.settingsPostRuleListItemCls + " {}\n." + exports.settingsPostRuleListItemCls + ":nth-child(even) {\n  background-color: rgba(0, 0, 0, 0.1);\n}\n." + exports.settingsPostRuleListItemDisabledCls + " {\n  opacity: 0.5;\n}\n\n." + exports.settingsPostRuleListItemNameCls + " { \n  width: calc(100% - 8em);\n  cursor: pointer;\n}\n." + exports.settingsPostRuleListItemNameCls + ":hover {\n  text-decoration: underline;\n}\n\n." + exports.settingsPostRuleBodyCls + " {\n  min-height: 20em;\n}\n\n." + exports.settingsPostRulesTemplatesListCls + " {\n  display: grid;\n  grid-template-columns: repeat(2, 50%);\n}\n." + exports.settingsPostRulesTemplatesListEmptyCls + " {\n  grid-column: span 2;\n}\n\n." + exports.blurAnimatedCls + " {\n  filter: blur(0);\n  transition: filter 0.5s ease-in-out;\n}\n\n." + exports.blurCls + " {\n  filter: blur(2px);\n}\n\n." + exports.settingsCaptionCls + " {\n  text-shadow: " + (isDarkTheme ? 'black' : '#999') + " 1px 0.5px 0px;\n}\n\n." + exports.settingsLogoCls + " {\n  display: flex;\n}\n." + exports.settingsLogoCls + " svg {\n  width: 2em;\n  height: 2em;\n  margin-right: 0.2em;\n}\n\n@keyframes ruqesLogoEE {\n  0% {\n    transform: rotate3d(0, 1, 0, 0deg);\n    opacity: 1;\n    filter: hue-rotate(0deg);\n  }\n  2% { opacity: 0.9; }\n  7% { opacity: 0.2; }\n  20% { opacity: 1; }\n  50% { opacity: 1; }\n  51% { opacity: 0.5; }\n  55% { opacity: 1; }\n  79% {\n      filter: hue-rotate(0deg);\n  }\n  80% {\n      filter: hue-rotate(-44deg) brightness(4.0) saturate(0.6);\n  }\n  98% {\n      filter: hue-rotate(-44deg) brightness(4.0) saturate(0.6);\n  }\n  99% {\n      filter: hue-rotate(0deg);\n  }\n  100% {\n    transform: rotate3d(0, 1, 0, 360deg);\n    opacity: 1;\n  }\n}\n\n." + exports.settingsLogoAnimCls + "{\n  animation: 5s infinite linear ruqesLogoEE;\n}\n\n." + exports.settingsExpandoButtonActionCharacterCls + " input {\n  width: 4em;\n}\n." + exports.settingsExpandoButtonActionCharacterCls + " label {\n  width: 10em;\n}\n\n." + exports.settingsAboutQrCls + " {\n  display: flex;\n}\n\n." + exports.aboutRuqesLogoCls + " svg {\n  width: 10.0em;\n  height: 10.0em;\n}\n\n@keyframes ruqesVoteEffect {\n  0% {\n    transform: scale(1);\n    opacity: 0;\n  }\n  1% {\n    opacity: 0.8;\n  }\n  90% {\n    transform: scale(3);\n  }\n  100% {\n    transform: scale(3.1);\n    opacity: 0;\n  }\n}\n\n." + exports.voteAnimCls + " {\n  animation-name: ruqesVoteEffect;\n  animation-duration: 0.75s;\n  animation-delay: 0s;\n  animation-iteration-count: 1;\n  animation-timing-function: ease-in-out;\n  position: absolute !important;\n  left: 0%;\n  top: 20%;\n}\n." + exports.voteAnimCls + ".fa-arrow-alt-up {\n  color: " + upvoteColor + " !important;\n}\n." + exports.voteAnimCls + ".fa-arrow-alt-down {\n  color: " + downvoteColor + " !important;\n}\n\n." + exports.bigVoteArrowsOnMobileCls + " ." + exports.voteAnimCls + " {\n  top: 0%;\n}\n\n#frontpage .voting." + exports.bigVoteArrowsOnMobileCls + ",\n#search .voting." + exports.bigVoteArrowsOnMobileCls + ",\n#userpage .voting." + exports.bigVoteArrowsOnMobileCls + ",\n#guild .voting." + exports.bigVoteArrowsOnMobileCls + "\n{\n  margin-bottom: -1rem;\n  margin-top: -0.4rem;\n}\n\n." + exports.bigVoteArrowsOnMobileCls + " .arrow-up::before,\n." + exports.bigVoteArrowsOnMobileCls + " .arrow-down::before,\n." + exports.bigVoteArrowsOnMobileCls + " .arrow-up:hover::before,\n." + exports.bigVoteArrowsOnMobileCls + " .arrow-down:hover::before\n{\n  font-size: 1.5rem;\n}\n\n." + exports.semiHiddenPostCls + " {\n  opacity: 0.2;\n  transition: opacity 0.33s;\n  max-height: 1.5em;\n  background-color: " + containerBackgroundColor + ";\n  overflow: hidden;\n  padding-top: 0 !important;\n}\n." + exports.semiHiddenPostCls + ":hover {\n  opacity: 1;\n  max-height: none;\n}\n\n." + exports.sidebarButtonCls + " {\n  paddingTop: 0;\n  position: fixed;\n}\n\n." + exports.sidebarButtonCls + ".opened {\n  position: relative;\n}\n\n." + exports.sidebarButtonIconCls + "::before {\n    cursor: pointer;\n    font-size: 1rem;\n    color: #777;\n    font-family: \"Font Awesome 5 Pro\";\n    font-weight: 900;\n    content: \"\uF348\";\n}\n\n." + exports.sidebarButtonCls + ".opened ." + exports.sidebarButtonIconCls + "::before {\n    cursor: pointer;\n    font-size: 1rem;\n    color: #777;\n    font-family: \"Font Awesome 5 Pro\";\n    font-weight: 900;\n    content: \"\uF347\";\n}\n\n." + exports.sidebarClosedCls + " {\n    max-width: 3em;\n    padding: 0;\n}\n." + exports.sidebarClosedCls + " > :not(:first-child) {\n    display: none !important;\n}\n." + exports.sidebarClosedCls + " > ." + exports.sidebarIndependentScrollCls + " > :not(:first-child) {\n    display: none !important;\n}\n\n." + exports.sidebarIndependentScrollCls + " {\n  position: fixed;\n  overflow-y: auto;\n  overflow-x: hidden;\n  height: calc(100vh - 49px);\n  padding-right: 15px;\n}\n\n." + exports.hideScrollbarCls + " {\n  scrollbar-width: none;\n  -ms-overflow-style: none;\n}\n." + exports.hideScrollbarCls + "::-webkit-scrollbar {\n  width: 0px;\n}\n\n." + exports.sidebarFavoritesCls + " {\n}\n\n." + exports.sidebarFavoritesSmallImageCls + " .profile-pic, ." + exports.sidebarSmallGuildImageCls + " .profile-pic {\n  width: 20px;\n  height: 20px;\n}\n." + exports.sidebarSmallGuildImageCls + " .guild-recommendations-list .guild-recommendations-item {\n  margin-top: 0.5rem;\n}\n\n." + exports.sidebarFavoritesSmallImageCls + " ul.guild-recommendations-list li {\n  margin-top: 0.5rem;\n}\n\n." + exports.sidebarFavoritesEditButtonCls + " {\n  cursor: pointer;\n  margin-right: 0.4em;\n}\n.sidebar-section ." + exports.sidebarFavoritesEditButtonCls + " i {\n  font-size: 1rem;\n}\n\n." + exports.sidebarFavoritesEditingCls + " {}\n\n." + exports.sidebarFavoritesShowOnlyInEditingCls + " {\n  display: none;\n}\n." + exports.sidebarFavoritesEditingCls + " ." + exports.sidebarFavoritesShowOnlyInEditingCls + " {\n  display: inline;\n} \n\n." + exports.sidebarFavoritesEditingCls + " li:hover {\n  background-color: " + containerBackgroundColor + ";\n}\n\n." + exports.sidebarFavoritesItemButtonCls + " {\n  cursor: pointer;\n  margin-left: 0.25em;\n}\n." + exports.sidebarFavoritesItemButtonCls + ".disabled {\n  pointer-events: none;\n  cursor: default;\n}\n." + exports.sidebarFavoritesItemButtonCls + " i {\n  color: " + textColor + " !important;\n}\n." + exports.sidebarFavoritesItemButtonCls + ".disabled i {\n  color: " + containerBorderColor + " !important;\n}\n." + exports.sidebarFavoritesItemButtonCls + ":not(.disabled):hover i {\n  color: " + primaryColor + " !important;\n}\n\n." + exports.sidebarFavoritesEmptyNoticeCls + " {\n  background-color: " + containerBackgroundColor + ";\n  border-radius: 1em;\n}\n.sidebar-section ." + exports.sidebarFavoritesEmptyNoticeCls + " > i {\n  font-size: 200%;\n}\n\n." + exports.sidebarFavoritesGuildBtnCls + " {\n  position: absolute;\n  left: 0.25em;\n  bottom: 0.25em;\n  font-size: 125%;\n  color: " + textColor + ";\n  z-index: 0;\n  padding: 0 0.5em 0 0.25em;\n}\n." + exports.sidebarFavoritesGuildBtnCls + ":hover:before {\n  content: '';\n  width: 100%;\n  height: 100%;\n  position: absolute;\n  left: 0;\n  background-color: " + revTextColor + ";\n  opacity: 0.66;\n  z-index: -1;\n}\n\n." + exports.sidebarFavoritesGuildBtnCls + " i {\n  text-shadow: " + revTextColor + " 1px 0 0, " + revTextColor + " 0 1px 0, " + revTextColor + " -1px 0 0, " + revTextColor + " 0 -1px 0;\n}\n\n." + exports.sidebarFavoritesGuildBtnCls + " span {\n  display: none;\n}\n\n." + exports.sidebarFavoritesGuildBtnCls + ":hover {\n  text-decoration: none;\n}\n\n." + exports.sidebarFavoritesGuildBtnCls + ":hover span {\n  display: inline;\n}\n\n." + exports.btnPrimaryCls + " {\n    color: rgb(207, 207, 207) !important;\n    background-color: #6133c9;\n    border-color: #5c31bf;\n}\n\n." + exports.btnPrimaryCls + ":not(:disabled):not(.disabled):active, ." + exports.btnPrimaryCls + ":not(:disabled):not(.disabled).active, .show>." + exports.btnPrimaryCls + ".dropdown-toggle {\n    color: #fff !important;\n    background-color: #6133c9;\n    border-color: #5c31bf;\n}\n\n." + exports.btnDangerCls + " {\n    color: rgb(207, 207, 207) !important;\n    background-color: #e53e3e;\n    border-color: #e53e3e;\n}\n\n@keyframes ruqesSpinning {\n  0% {\n    transform: scale(1) rotate(0deg);\n  }\n  30% {\n    transform: scale(1.2) rotate(108deg);\n  }\n  60% {\n    transform: scale(0.8) rotate(216deg);\n  }\n  100% {\n    transform: scale(1) rotate(360deg);\n  }\n}\n\n." + exports.loadTitleButtonCls + " {\n  margin-top: -0.4em;\n}\n." + exports.loadTitleButtonCls + " svg {\n  width: 1.2em;\n  height: 1.2em;\n  margin-left: -0.3em;\n  margin-right: 0.2em;\n}\n." + exports.loadTitleButtonCls + "." + exports.loadTitleButtonLoadingCls + " svg {\n  animation: 1s infinite linear ruqesSpinning;\n}\n\n." + exports.uploadImageToImgbbButtonCls + " {\n  margin-top: -0.4em;\n  border: 1px dashed " + ruqesColor + ";\n}\n." + exports.uploadImageToImgbbButtonCls + " svg {\n  width: 1.2em;\n  height: 1.2em;\n  margin-left: -0.3em;\n  margin-right: 0.2em;\n}\n." + exports.uploadImageToImgbbButtonCls + "." + exports.uploadImageToImgbbButtonSmallCls + " svg {\n  width: 1.0em;\n  height: 1.0em;\n  margin-top: -0.2em;\n}\n." + exports.uploadImageToImgbbButtonCls + "." + exports.uploadImageToImgbbButtonLoadingCls + " svg {\n  animation: 1s infinite linear ruqesSpinning;\n}\n\n." + exports.loadTitleButtonCls + " ~ ." + exports.uploadImageToImgbbButtonCls + " {\n  margin-left: 0.5em;\n}\n\n." + exports.uploadImageToImgbbButtonHighlightedCls + " {\n  border-style: solid;\n}\n\n." + exports.blurThumbnailCls + " .post-img {\n  filter: blur(7px) saturate(0.3);\n} \n\n." + exports.infiniteScrollCoolDownMarkerCls + " {\n  font-size: 130%;\n  margin-left: 1em;\n}\n\n." + exports.improvedTableCls + " td, ." + exports.improvedTableCls + " th {\n  border: 1px solid " + containerBorderColor + ";\n  padding: 0.2em 0.5em;\n}\n." + exports.improvedTableCls + " th {\n  background-color: " + containerBackgroundColorSecondary + ";\n}\n\n." + exports.nonAggressiveCls + " {\n  opacity: 0.33;\n  transition: opacity 0.2s;\n}\n." + exports.nonAggressiveCls + ":hover {\n  opacity: 1;\n}\n\n." + exports.disablePostActionsJumpingAboveBarOnHoverCls + " .post-actions:hover,\n." + exports.disablePostActionsJumpingAboveBarOnHoverCls + " .post-actions:focus {\n    z-index: 3;\n}\n\n." + exports.resizableDirectImageCls + " {\n  cursor: nwse-resize;\n}\n\n." + exports.resizableDirectImageWrapperCls + " {\n  display: relative;\n  z-index: 3;\n}\n\n." + exports.imageThumbnailTypeIconCls + " {\n  position: absolute;\n  right: 1px;\n  top: 49px;\n  width: 20px;\n  height: 20px;\n  text-align: center;\n  border-radius: 5px;\n  pointer-events: none;\n  opacity: 0.9;\n  color: white;\n  text-shadow: black 1px 0 0, black 0 1px 0, black -1px 0 0, black 0 -1px 0;\n  z-index: 2; /* otherwise broken in FF */\n}\n." + exports.imageThumbnailTypeIconBackgroundCls + " {\n  background: #00000033;\n}\n." + exports.imageThumbnailTypeIconOnMobileCls + " {\n  right: 16px;\n  top: 46px;\n}\n." + exports.imageThumbnailTypeIconFACls + " {\n  color: white;\n}\n\n." + exports.postThumbnailModeCls + "-huge ." + exports.imageThumbnailTypeIconCls + " {\n  top: 240px;\n}\n." + exports.postThumbnailModeCls + "-large ." + exports.imageThumbnailTypeIconCls + " {\n  top: 84px;\n}\n." + exports.postThumbnailModeCls + "-small ." + exports.imageThumbnailTypeIconCls + " {\n  top: 15px;\n}\n." + exports.postThumbnailModeCls + "-icon ." + exports.imageThumbnailTypeIconCls + " {\n  top: 1px;\n}\n\n." + exports.postThumbnailModeCls + "-huge ." + exports.imageThumbnailTypeIconOnMobileCls + " {\n  top: 248px;\n}\n." + exports.postThumbnailModeCls + "-large ." + exports.imageThumbnailTypeIconOnMobileCls + " {\n  top: 90px;\n}\n." + exports.postThumbnailModeCls + "-small ." + exports.imageThumbnailTypeIconOnMobileCls + " {\n  top: 21px;\n}\n." + exports.postThumbnailModeCls + "-icon ." + exports.imageThumbnailTypeIconOnMobileCls + " {\n  top: 8px;\n}\n\n." + exports.postPreviewCls + " {\n  border: 1px solid " + containerBorderColor + ";\n  padding: 1em;\n  background-color: " + containerBackgroundColor + ";\n}\n." + exports.postPreviewButtonCls + " {\n  color: " + anchorColor + ";\n  text-decoration: none;\n}\n\n." + exports.commentPreviewCls + " {\n  position: relative;\n  border: 1px solid " + containerBorderColor + ";\n  padding: 0.5em;\n  background-color: " + containerBackgroundColor + ";\n  z-index: 0;\n}\n\n:not(.collapsed) > ." + exports.commentPreviewCls + " {\n  display: none;\n}\n\n." + exports.commentPreviewCls + ":after {\n  content: \"Comment preview\";\n  position: absolute;\n  width: 100%;\n  height: 100%;\n  top: 0;\n  left: 0;\n  padding: 0.5em;\n  background-image: url(\"data:image/svg+xml;base64," + btoa(logo_svg_1.default) + "\");\n  background-size: auto 75%;\n  background-repeat: no-repeat;\n  background-position: center;\n  opacity: 0.05;\n  overflow: hidden;\n  text-align: right;\n  z-index: -1;\n}\n\n@media (max-width: 767.98px) {\n  ." + exports.commentBiggerFoldButtonsCls + " .comment .comment-collapse::before {\n    font-size: 15px;\n  }\n  ." + exports.commentBiggerFoldButtonsCls + " .comment.collapsed .comment-collapse:hover::before {}\n}\n\n." + exports.commentUpDownVotesAsTextProcessedCls + " {}\n$.{upDownVotesAsTextWrapperCls} {}\n." + exports.upDownVotesAsTextUpCls + " {\n  color: " + upvoteColor + ";\n}\n." + exports.UpDownVotesAsTextDownCls + " {\n  color: " + downvoteColor + ";\n}\n." + exports.upDownVotesAsTextUpCls + ", ." + exports.UpDownVotesAsTextDownCls + " {}\n\n." + exports.saveEmptySavesButtonPlaceholderCls + " a {\n  color: " + textColor + ";\n}\n\n." + exports.saveCommentsContainerCls + " .comment:first-child {\n  margin-top: 0.66em;\n}\n\n." + exports.loadingAppCls + " {\n  position: fixed;\n  width: 100%;\n  height: 100%;\n  background: rgba(0, 0, 0, 0.5);\n  top: 0;\n  z-index: 2000;\n  display: flex;\n  align-items: center;\n  justify-content: center;\n  color: " + ruqesDarkColor + ";\n  font-size: 500%;\n  flex-direction: column;\n  user-select: none;\n}\n." + exports.loadingAppCls + " > * {\n  background: rgba(255, 255, 255, 0.66);\n  border-radius: 10px;\n}\n." + exports.loadingAppCls + " > div {\n  text-shadow: 1px 1px 0px " + loadingTextShadowColor + ", 2px 1px 0px " + loadingTextShadowColor + ", 3px 1px 0px " + loadingTextShadowColor + ";\n}\n." + exports.loadingAppCls + " a {\n  margin: 0.5em;\n  padding: 0 0.5em;\n  color: gray;\n  font-size: 40%;\n}\n." + exports.loadingAppCls + " a:hover {\n  text-decoration: none;\n}\n\n." + exports.postShowThumbnailOnHoverWrapperCls + " {\n  display: flex;\n  align-items: center;\n  justify-content: flex-start;\n  position: fixed;\n  top: 0;\n  bottom: 0;\n  right: 0;\n  z-index: 5000;\n  padding: 1em;\n  pointer-events: none;\n}\n\n." + exports.postShowThumbnailOnHoverImageCls + " {\n  max-width: 100%;\n  max-height: 100%;\n  border: 1px solid " + ruqesColor + ";\n  padding: 1px;\n  border-radius: 5px;\n  background-color: white;\n}\n\n." + exports.postThumbnailModeCls + "-huge .post-img {\n  width: 375px;\n  height: 262px;\n}\n." + exports.postThumbnailModeCls + "-large .post-img {\n  width: 150px;\n  height: 105px;\n}\n." + exports.postThumbnailModeCls + "-small .post-img {\n  width: 50px;\n  height: 35px;\n}\n." + exports.postThumbnailModeCls + "-icon .post-img {\n  width: 22px;\n  height: 21px;\n}\n." + exports.postThumbnailModeCls + "-hide {\n  display: none !important ;\n}\n");
    $('body').addClass(isDarkTheme ? exports.themeDark : exports.themeLight);
};


/***/ }),
/* 4 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);

// EXPORTS
__webpack_require__.d(__webpack_exports__, "F", function() { return /* reexport */ es_F; });
__webpack_require__.d(__webpack_exports__, "T", function() { return /* reexport */ es_T; });
__webpack_require__.d(__webpack_exports__, "__", function() { return /* reexport */ _; });
__webpack_require__.d(__webpack_exports__, "add", function() { return /* reexport */ es_add; });
__webpack_require__.d(__webpack_exports__, "addIndex", function() { return /* reexport */ es_addIndex; });
__webpack_require__.d(__webpack_exports__, "adjust", function() { return /* reexport */ es_adjust; });
__webpack_require__.d(__webpack_exports__, "all", function() { return /* reexport */ es_all; });
__webpack_require__.d(__webpack_exports__, "allPass", function() { return /* reexport */ es_allPass; });
__webpack_require__.d(__webpack_exports__, "always", function() { return /* reexport */ es_always; });
__webpack_require__.d(__webpack_exports__, "and", function() { return /* reexport */ es_and; });
__webpack_require__.d(__webpack_exports__, "any", function() { return /* reexport */ es_any; });
__webpack_require__.d(__webpack_exports__, "anyPass", function() { return /* reexport */ es_anyPass; });
__webpack_require__.d(__webpack_exports__, "ap", function() { return /* reexport */ es_ap; });
__webpack_require__.d(__webpack_exports__, "aperture", function() { return /* reexport */ es_aperture; });
__webpack_require__.d(__webpack_exports__, "append", function() { return /* reexport */ es_append; });
__webpack_require__.d(__webpack_exports__, "apply", function() { return /* reexport */ es_apply; });
__webpack_require__.d(__webpack_exports__, "applySpec", function() { return /* reexport */ es_applySpec; });
__webpack_require__.d(__webpack_exports__, "applyTo", function() { return /* reexport */ es_applyTo; });
__webpack_require__.d(__webpack_exports__, "ascend", function() { return /* reexport */ es_ascend; });
__webpack_require__.d(__webpack_exports__, "assoc", function() { return /* reexport */ es_assoc; });
__webpack_require__.d(__webpack_exports__, "assocPath", function() { return /* reexport */ es_assocPath; });
__webpack_require__.d(__webpack_exports__, "binary", function() { return /* reexport */ es_binary; });
__webpack_require__.d(__webpack_exports__, "bind", function() { return /* reexport */ es_bind; });
__webpack_require__.d(__webpack_exports__, "both", function() { return /* reexport */ es_both; });
__webpack_require__.d(__webpack_exports__, "call", function() { return /* reexport */ es_call; });
__webpack_require__.d(__webpack_exports__, "chain", function() { return /* reexport */ es_chain; });
__webpack_require__.d(__webpack_exports__, "clamp", function() { return /* reexport */ es_clamp; });
__webpack_require__.d(__webpack_exports__, "clone", function() { return /* reexport */ es_clone; });
__webpack_require__.d(__webpack_exports__, "comparator", function() { return /* reexport */ es_comparator; });
__webpack_require__.d(__webpack_exports__, "complement", function() { return /* reexport */ es_complement; });
__webpack_require__.d(__webpack_exports__, "compose", function() { return /* reexport */ compose; });
__webpack_require__.d(__webpack_exports__, "composeK", function() { return /* reexport */ composeK; });
__webpack_require__.d(__webpack_exports__, "composeP", function() { return /* reexport */ composeP; });
__webpack_require__.d(__webpack_exports__, "composeWith", function() { return /* reexport */ es_composeWith; });
__webpack_require__.d(__webpack_exports__, "concat", function() { return /* reexport */ es_concat; });
__webpack_require__.d(__webpack_exports__, "cond", function() { return /* reexport */ es_cond; });
__webpack_require__.d(__webpack_exports__, "construct", function() { return /* reexport */ es_construct; });
__webpack_require__.d(__webpack_exports__, "constructN", function() { return /* reexport */ es_constructN; });
__webpack_require__.d(__webpack_exports__, "contains", function() { return /* reexport */ es_contains; });
__webpack_require__.d(__webpack_exports__, "converge", function() { return /* reexport */ es_converge; });
__webpack_require__.d(__webpack_exports__, "countBy", function() { return /* reexport */ es_countBy; });
__webpack_require__.d(__webpack_exports__, "curry", function() { return /* reexport */ es_curry; });
__webpack_require__.d(__webpack_exports__, "curryN", function() { return /* reexport */ es_curryN; });
__webpack_require__.d(__webpack_exports__, "dec", function() { return /* reexport */ es_dec; });
__webpack_require__.d(__webpack_exports__, "defaultTo", function() { return /* reexport */ es_defaultTo; });
__webpack_require__.d(__webpack_exports__, "descend", function() { return /* reexport */ es_descend; });
__webpack_require__.d(__webpack_exports__, "difference", function() { return /* reexport */ es_difference; });
__webpack_require__.d(__webpack_exports__, "differenceWith", function() { return /* reexport */ es_differenceWith; });
__webpack_require__.d(__webpack_exports__, "dissoc", function() { return /* reexport */ es_dissoc; });
__webpack_require__.d(__webpack_exports__, "dissocPath", function() { return /* reexport */ es_dissocPath; });
__webpack_require__.d(__webpack_exports__, "divide", function() { return /* reexport */ es_divide; });
__webpack_require__.d(__webpack_exports__, "drop", function() { return /* reexport */ es_drop; });
__webpack_require__.d(__webpack_exports__, "dropLast", function() { return /* reexport */ es_dropLast; });
__webpack_require__.d(__webpack_exports__, "dropLastWhile", function() { return /* reexport */ es_dropLastWhile; });
__webpack_require__.d(__webpack_exports__, "dropRepeats", function() { return /* reexport */ es_dropRepeats; });
__webpack_require__.d(__webpack_exports__, "dropRepeatsWith", function() { return /* reexport */ es_dropRepeatsWith; });
__webpack_require__.d(__webpack_exports__, "dropWhile", function() { return /* reexport */ es_dropWhile; });
__webpack_require__.d(__webpack_exports__, "either", function() { return /* reexport */ es_either; });
__webpack_require__.d(__webpack_exports__, "empty", function() { return /* reexport */ es_empty; });
__webpack_require__.d(__webpack_exports__, "endsWith", function() { return /* reexport */ es_endsWith; });
__webpack_require__.d(__webpack_exports__, "eqBy", function() { return /* reexport */ es_eqBy; });
__webpack_require__.d(__webpack_exports__, "eqProps", function() { return /* reexport */ es_eqProps; });
__webpack_require__.d(__webpack_exports__, "equals", function() { return /* reexport */ es_equals; });
__webpack_require__.d(__webpack_exports__, "evolve", function() { return /* reexport */ es_evolve; });
__webpack_require__.d(__webpack_exports__, "filter", function() { return /* reexport */ es_filter; });
__webpack_require__.d(__webpack_exports__, "find", function() { return /* reexport */ es_find; });
__webpack_require__.d(__webpack_exports__, "findIndex", function() { return /* reexport */ es_findIndex; });
__webpack_require__.d(__webpack_exports__, "findLast", function() { return /* reexport */ es_findLast; });
__webpack_require__.d(__webpack_exports__, "findLastIndex", function() { return /* reexport */ es_findLastIndex; });
__webpack_require__.d(__webpack_exports__, "flatten", function() { return /* reexport */ es_flatten; });
__webpack_require__.d(__webpack_exports__, "flip", function() { return /* reexport */ es_flip; });
__webpack_require__.d(__webpack_exports__, "forEach", function() { return /* reexport */ es_forEach; });
__webpack_require__.d(__webpack_exports__, "forEachObjIndexed", function() { return /* reexport */ es_forEachObjIndexed; });
__webpack_require__.d(__webpack_exports__, "fromPairs", function() { return /* reexport */ es_fromPairs; });
__webpack_require__.d(__webpack_exports__, "groupBy", function() { return /* reexport */ es_groupBy; });
__webpack_require__.d(__webpack_exports__, "groupWith", function() { return /* reexport */ es_groupWith; });
__webpack_require__.d(__webpack_exports__, "gt", function() { return /* reexport */ es_gt; });
__webpack_require__.d(__webpack_exports__, "gte", function() { return /* reexport */ es_gte; });
__webpack_require__.d(__webpack_exports__, "has", function() { return /* reexport */ es_has; });
__webpack_require__.d(__webpack_exports__, "hasIn", function() { return /* reexport */ es_hasIn; });
__webpack_require__.d(__webpack_exports__, "hasPath", function() { return /* reexport */ es_hasPath; });
__webpack_require__.d(__webpack_exports__, "head", function() { return /* reexport */ es_head; });
__webpack_require__.d(__webpack_exports__, "identical", function() { return /* reexport */ es_identical; });
__webpack_require__.d(__webpack_exports__, "identity", function() { return /* reexport */ es_identity; });
__webpack_require__.d(__webpack_exports__, "ifElse", function() { return /* reexport */ es_ifElse; });
__webpack_require__.d(__webpack_exports__, "inc", function() { return /* reexport */ es_inc; });
__webpack_require__.d(__webpack_exports__, "includes", function() { return /* reexport */ es_includes; });
__webpack_require__.d(__webpack_exports__, "indexBy", function() { return /* reexport */ es_indexBy; });
__webpack_require__.d(__webpack_exports__, "indexOf", function() { return /* reexport */ es_indexOf; });
__webpack_require__.d(__webpack_exports__, "init", function() { return /* reexport */ es_init; });
__webpack_require__.d(__webpack_exports__, "innerJoin", function() { return /* reexport */ es_innerJoin; });
__webpack_require__.d(__webpack_exports__, "insert", function() { return /* reexport */ es_insert; });
__webpack_require__.d(__webpack_exports__, "insertAll", function() { return /* reexport */ es_insertAll; });
__webpack_require__.d(__webpack_exports__, "intersection", function() { return /* reexport */ es_intersection; });
__webpack_require__.d(__webpack_exports__, "intersperse", function() { return /* reexport */ es_intersperse; });
__webpack_require__.d(__webpack_exports__, "into", function() { return /* reexport */ es_into; });
__webpack_require__.d(__webpack_exports__, "invert", function() { return /* reexport */ es_invert; });
__webpack_require__.d(__webpack_exports__, "invertObj", function() { return /* reexport */ es_invertObj; });
__webpack_require__.d(__webpack_exports__, "invoker", function() { return /* reexport */ es_invoker; });
__webpack_require__.d(__webpack_exports__, "is", function() { return /* reexport */ es_is; });
__webpack_require__.d(__webpack_exports__, "isEmpty", function() { return /* reexport */ es_isEmpty; });
__webpack_require__.d(__webpack_exports__, "isNil", function() { return /* reexport */ es_isNil; });
__webpack_require__.d(__webpack_exports__, "join", function() { return /* reexport */ es_join; });
__webpack_require__.d(__webpack_exports__, "juxt", function() { return /* reexport */ es_juxt; });
__webpack_require__.d(__webpack_exports__, "keys", function() { return /* reexport */ es_keys; });
__webpack_require__.d(__webpack_exports__, "keysIn", function() { return /* reexport */ es_keysIn; });
__webpack_require__.d(__webpack_exports__, "last", function() { return /* reexport */ es_last; });
__webpack_require__.d(__webpack_exports__, "lastIndexOf", function() { return /* reexport */ es_lastIndexOf; });
__webpack_require__.d(__webpack_exports__, "length", function() { return /* reexport */ es_length; });
__webpack_require__.d(__webpack_exports__, "lens", function() { return /* reexport */ es_lens; });
__webpack_require__.d(__webpack_exports__, "lensIndex", function() { return /* reexport */ es_lensIndex; });
__webpack_require__.d(__webpack_exports__, "lensPath", function() { return /* reexport */ es_lensPath; });
__webpack_require__.d(__webpack_exports__, "lensProp", function() { return /* reexport */ es_lensProp; });
__webpack_require__.d(__webpack_exports__, "lift", function() { return /* reexport */ es_lift; });
__webpack_require__.d(__webpack_exports__, "liftN", function() { return /* reexport */ es_liftN; });
__webpack_require__.d(__webpack_exports__, "lt", function() { return /* reexport */ es_lt; });
__webpack_require__.d(__webpack_exports__, "lte", function() { return /* reexport */ es_lte; });
__webpack_require__.d(__webpack_exports__, "map", function() { return /* reexport */ es_map; });
__webpack_require__.d(__webpack_exports__, "mapAccum", function() { return /* reexport */ es_mapAccum; });
__webpack_require__.d(__webpack_exports__, "mapAccumRight", function() { return /* reexport */ es_mapAccumRight; });
__webpack_require__.d(__webpack_exports__, "mapObjIndexed", function() { return /* reexport */ es_mapObjIndexed; });
__webpack_require__.d(__webpack_exports__, "match", function() { return /* reexport */ es_match; });
__webpack_require__.d(__webpack_exports__, "mathMod", function() { return /* reexport */ es_mathMod; });
__webpack_require__.d(__webpack_exports__, "max", function() { return /* reexport */ es_max; });
__webpack_require__.d(__webpack_exports__, "maxBy", function() { return /* reexport */ es_maxBy; });
__webpack_require__.d(__webpack_exports__, "mean", function() { return /* reexport */ es_mean; });
__webpack_require__.d(__webpack_exports__, "median", function() { return /* reexport */ es_median; });
__webpack_require__.d(__webpack_exports__, "memoizeWith", function() { return /* reexport */ es_memoizeWith; });
__webpack_require__.d(__webpack_exports__, "merge", function() { return /* reexport */ es_merge; });
__webpack_require__.d(__webpack_exports__, "mergeAll", function() { return /* reexport */ es_mergeAll; });
__webpack_require__.d(__webpack_exports__, "mergeDeepLeft", function() { return /* reexport */ es_mergeDeepLeft; });
__webpack_require__.d(__webpack_exports__, "mergeDeepRight", function() { return /* reexport */ es_mergeDeepRight; });
__webpack_require__.d(__webpack_exports__, "mergeDeepWith", function() { return /* reexport */ es_mergeDeepWith; });
__webpack_require__.d(__webpack_exports__, "mergeDeepWithKey", function() { return /* reexport */ es_mergeDeepWithKey; });
__webpack_require__.d(__webpack_exports__, "mergeLeft", function() { return /* reexport */ es_mergeLeft; });
__webpack_require__.d(__webpack_exports__, "mergeRight", function() { return /* reexport */ es_mergeRight; });
__webpack_require__.d(__webpack_exports__, "mergeWith", function() { return /* reexport */ es_mergeWith; });
__webpack_require__.d(__webpack_exports__, "mergeWithKey", function() { return /* reexport */ es_mergeWithKey; });
__webpack_require__.d(__webpack_exports__, "min", function() { return /* reexport */ es_min; });
__webpack_require__.d(__webpack_exports__, "minBy", function() { return /* reexport */ es_minBy; });
__webpack_require__.d(__webpack_exports__, "modulo", function() { return /* reexport */ es_modulo; });
__webpack_require__.d(__webpack_exports__, "move", function() { return /* reexport */ es_move; });
__webpack_require__.d(__webpack_exports__, "multiply", function() { return /* reexport */ es_multiply; });
__webpack_require__.d(__webpack_exports__, "nAry", function() { return /* reexport */ es_nAry; });
__webpack_require__.d(__webpack_exports__, "negate", function() { return /* reexport */ es_negate; });
__webpack_require__.d(__webpack_exports__, "none", function() { return /* reexport */ es_none; });
__webpack_require__.d(__webpack_exports__, "not", function() { return /* reexport */ es_not; });
__webpack_require__.d(__webpack_exports__, "nth", function() { return /* reexport */ es_nth; });
__webpack_require__.d(__webpack_exports__, "nthArg", function() { return /* reexport */ es_nthArg; });
__webpack_require__.d(__webpack_exports__, "o", function() { return /* reexport */ es_o; });
__webpack_require__.d(__webpack_exports__, "objOf", function() { return /* reexport */ es_objOf; });
__webpack_require__.d(__webpack_exports__, "of", function() { return /* reexport */ es_of; });
__webpack_require__.d(__webpack_exports__, "omit", function() { return /* reexport */ es_omit; });
__webpack_require__.d(__webpack_exports__, "once", function() { return /* reexport */ es_once; });
__webpack_require__.d(__webpack_exports__, "or", function() { return /* reexport */ es_or; });
__webpack_require__.d(__webpack_exports__, "otherwise", function() { return /* reexport */ es_otherwise; });
__webpack_require__.d(__webpack_exports__, "over", function() { return /* reexport */ es_over; });
__webpack_require__.d(__webpack_exports__, "pair", function() { return /* reexport */ es_pair; });
__webpack_require__.d(__webpack_exports__, "partial", function() { return /* reexport */ es_partial; });
__webpack_require__.d(__webpack_exports__, "partialRight", function() { return /* reexport */ es_partialRight; });
__webpack_require__.d(__webpack_exports__, "partition", function() { return /* reexport */ es_partition; });
__webpack_require__.d(__webpack_exports__, "path", function() { return /* reexport */ es_path; });
__webpack_require__.d(__webpack_exports__, "paths", function() { return /* reexport */ es_paths; });
__webpack_require__.d(__webpack_exports__, "pathEq", function() { return /* reexport */ es_pathEq; });
__webpack_require__.d(__webpack_exports__, "pathOr", function() { return /* reexport */ es_pathOr; });
__webpack_require__.d(__webpack_exports__, "pathSatisfies", function() { return /* reexport */ es_pathSatisfies; });
__webpack_require__.d(__webpack_exports__, "pick", function() { return /* reexport */ es_pick; });
__webpack_require__.d(__webpack_exports__, "pickAll", function() { return /* reexport */ es_pickAll; });
__webpack_require__.d(__webpack_exports__, "pickBy", function() { return /* reexport */ es_pickBy; });
__webpack_require__.d(__webpack_exports__, "pipe", function() { return /* reexport */ pipe; });
__webpack_require__.d(__webpack_exports__, "pipeK", function() { return /* reexport */ pipeK; });
__webpack_require__.d(__webpack_exports__, "pipeP", function() { return /* reexport */ pipeP; });
__webpack_require__.d(__webpack_exports__, "pipeWith", function() { return /* reexport */ es_pipeWith; });
__webpack_require__.d(__webpack_exports__, "pluck", function() { return /* reexport */ es_pluck; });
__webpack_require__.d(__webpack_exports__, "prepend", function() { return /* reexport */ es_prepend; });
__webpack_require__.d(__webpack_exports__, "product", function() { return /* reexport */ es_product; });
__webpack_require__.d(__webpack_exports__, "project", function() { return /* reexport */ es_project; });
__webpack_require__.d(__webpack_exports__, "prop", function() { return /* reexport */ es_prop; });
__webpack_require__.d(__webpack_exports__, "propEq", function() { return /* reexport */ es_propEq; });
__webpack_require__.d(__webpack_exports__, "propIs", function() { return /* reexport */ es_propIs; });
__webpack_require__.d(__webpack_exports__, "propOr", function() { return /* reexport */ es_propOr; });
__webpack_require__.d(__webpack_exports__, "propSatisfies", function() { return /* reexport */ es_propSatisfies; });
__webpack_require__.d(__webpack_exports__, "props", function() { return /* reexport */ es_props; });
__webpack_require__.d(__webpack_exports__, "range", function() { return /* reexport */ es_range; });
__webpack_require__.d(__webpack_exports__, "reduce", function() { return /* reexport */ es_reduce; });
__webpack_require__.d(__webpack_exports__, "reduceBy", function() { return /* reexport */ es_reduceBy; });
__webpack_require__.d(__webpack_exports__, "reduceRight", function() { return /* reexport */ es_reduceRight; });
__webpack_require__.d(__webpack_exports__, "reduceWhile", function() { return /* reexport */ es_reduceWhile; });
__webpack_require__.d(__webpack_exports__, "reduced", function() { return /* reexport */ es_reduced; });
__webpack_require__.d(__webpack_exports__, "reject", function() { return /* reexport */ es_reject; });
__webpack_require__.d(__webpack_exports__, "remove", function() { return /* reexport */ es_remove; });
__webpack_require__.d(__webpack_exports__, "repeat", function() { return /* reexport */ es_repeat; });
__webpack_require__.d(__webpack_exports__, "replace", function() { return /* reexport */ es_replace; });
__webpack_require__.d(__webpack_exports__, "reverse", function() { return /* reexport */ es_reverse; });
__webpack_require__.d(__webpack_exports__, "scan", function() { return /* reexport */ es_scan; });
__webpack_require__.d(__webpack_exports__, "sequence", function() { return /* reexport */ es_sequence; });
__webpack_require__.d(__webpack_exports__, "set", function() { return /* reexport */ es_set; });
__webpack_require__.d(__webpack_exports__, "slice", function() { return /* reexport */ es_slice; });
__webpack_require__.d(__webpack_exports__, "sort", function() { return /* reexport */ es_sort; });
__webpack_require__.d(__webpack_exports__, "sortBy", function() { return /* reexport */ es_sortBy; });
__webpack_require__.d(__webpack_exports__, "sortWith", function() { return /* reexport */ es_sortWith; });
__webpack_require__.d(__webpack_exports__, "split", function() { return /* reexport */ es_split; });
__webpack_require__.d(__webpack_exports__, "splitAt", function() { return /* reexport */ es_splitAt; });
__webpack_require__.d(__webpack_exports__, "splitEvery", function() { return /* reexport */ es_splitEvery; });
__webpack_require__.d(__webpack_exports__, "splitWhen", function() { return /* reexport */ es_splitWhen; });
__webpack_require__.d(__webpack_exports__, "startsWith", function() { return /* reexport */ es_startsWith; });
__webpack_require__.d(__webpack_exports__, "subtract", function() { return /* reexport */ es_subtract; });
__webpack_require__.d(__webpack_exports__, "sum", function() { return /* reexport */ es_sum; });
__webpack_require__.d(__webpack_exports__, "symmetricDifference", function() { return /* reexport */ es_symmetricDifference; });
__webpack_require__.d(__webpack_exports__, "symmetricDifferenceWith", function() { return /* reexport */ es_symmetricDifferenceWith; });
__webpack_require__.d(__webpack_exports__, "tail", function() { return /* reexport */ es_tail; });
__webpack_require__.d(__webpack_exports__, "take", function() { return /* reexport */ es_take; });
__webpack_require__.d(__webpack_exports__, "takeLast", function() { return /* reexport */ es_takeLast; });
__webpack_require__.d(__webpack_exports__, "takeLastWhile", function() { return /* reexport */ es_takeLastWhile; });
__webpack_require__.d(__webpack_exports__, "takeWhile", function() { return /* reexport */ es_takeWhile; });
__webpack_require__.d(__webpack_exports__, "tap", function() { return /* reexport */ es_tap; });
__webpack_require__.d(__webpack_exports__, "test", function() { return /* reexport */ es_test; });
__webpack_require__.d(__webpack_exports__, "andThen", function() { return /* reexport */ es_andThen; });
__webpack_require__.d(__webpack_exports__, "times", function() { return /* reexport */ es_times; });
__webpack_require__.d(__webpack_exports__, "toLower", function() { return /* reexport */ es_toLower; });
__webpack_require__.d(__webpack_exports__, "toPairs", function() { return /* reexport */ es_toPairs; });
__webpack_require__.d(__webpack_exports__, "toPairsIn", function() { return /* reexport */ es_toPairsIn; });
__webpack_require__.d(__webpack_exports__, "toString", function() { return /* reexport */ es_toString; });
__webpack_require__.d(__webpack_exports__, "toUpper", function() { return /* reexport */ es_toUpper; });
__webpack_require__.d(__webpack_exports__, "transduce", function() { return /* reexport */ es_transduce; });
__webpack_require__.d(__webpack_exports__, "transpose", function() { return /* reexport */ es_transpose; });
__webpack_require__.d(__webpack_exports__, "traverse", function() { return /* reexport */ es_traverse; });
__webpack_require__.d(__webpack_exports__, "trim", function() { return /* reexport */ es_trim; });
__webpack_require__.d(__webpack_exports__, "tryCatch", function() { return /* reexport */ es_tryCatch; });
__webpack_require__.d(__webpack_exports__, "type", function() { return /* reexport */ es_type; });
__webpack_require__.d(__webpack_exports__, "unapply", function() { return /* reexport */ es_unapply; });
__webpack_require__.d(__webpack_exports__, "unary", function() { return /* reexport */ es_unary; });
__webpack_require__.d(__webpack_exports__, "uncurryN", function() { return /* reexport */ es_uncurryN; });
__webpack_require__.d(__webpack_exports__, "unfold", function() { return /* reexport */ es_unfold; });
__webpack_require__.d(__webpack_exports__, "union", function() { return /* reexport */ es_union; });
__webpack_require__.d(__webpack_exports__, "unionWith", function() { return /* reexport */ es_unionWith; });
__webpack_require__.d(__webpack_exports__, "uniq", function() { return /* reexport */ es_uniq; });
__webpack_require__.d(__webpack_exports__, "uniqBy", function() { return /* reexport */ es_uniqBy; });
__webpack_require__.d(__webpack_exports__, "uniqWith", function() { return /* reexport */ es_uniqWith; });
__webpack_require__.d(__webpack_exports__, "unless", function() { return /* reexport */ es_unless; });
__webpack_require__.d(__webpack_exports__, "unnest", function() { return /* reexport */ es_unnest; });
__webpack_require__.d(__webpack_exports__, "until", function() { return /* reexport */ es_until; });
__webpack_require__.d(__webpack_exports__, "update", function() { return /* reexport */ es_update; });
__webpack_require__.d(__webpack_exports__, "useWith", function() { return /* reexport */ es_useWith; });
__webpack_require__.d(__webpack_exports__, "values", function() { return /* reexport */ es_values; });
__webpack_require__.d(__webpack_exports__, "valuesIn", function() { return /* reexport */ es_valuesIn; });
__webpack_require__.d(__webpack_exports__, "view", function() { return /* reexport */ es_view; });
__webpack_require__.d(__webpack_exports__, "when", function() { return /* reexport */ es_when; });
__webpack_require__.d(__webpack_exports__, "where", function() { return /* reexport */ es_where; });
__webpack_require__.d(__webpack_exports__, "whereEq", function() { return /* reexport */ es_whereEq; });
__webpack_require__.d(__webpack_exports__, "without", function() { return /* reexport */ es_without; });
__webpack_require__.d(__webpack_exports__, "xor", function() { return /* reexport */ es_xor; });
__webpack_require__.d(__webpack_exports__, "xprod", function() { return /* reexport */ es_xprod; });
__webpack_require__.d(__webpack_exports__, "zip", function() { return /* reexport */ es_zip; });
__webpack_require__.d(__webpack_exports__, "zipObj", function() { return /* reexport */ es_zipObj; });
__webpack_require__.d(__webpack_exports__, "zipWith", function() { return /* reexport */ es_zipWith; });
__webpack_require__.d(__webpack_exports__, "thunkify", function() { return /* reexport */ es_thunkify; });

// CONCATENATED MODULE: ./node_modules/ramda/es/F.js
/**
 * A function that always returns `false`. Any passed in parameters are ignored.
 *
 * @func
 * @memberOf R
 * @since v0.9.0
 * @category Function
 * @sig * -> Boolean
 * @param {*}
 * @return {Boolean}
 * @see R.T
 * @example
 *
 *      R.F(); //=> false
 */
var F = function () {
  return false;
};

/* harmony default export */ var es_F = (F);
// CONCATENATED MODULE: ./node_modules/ramda/es/T.js
/**
 * A function that always returns `true`. Any passed in parameters are ignored.
 *
 * @func
 * @memberOf R
 * @since v0.9.0
 * @category Function
 * @sig * -> Boolean
 * @param {*}
 * @return {Boolean}
 * @see R.F
 * @example
 *
 *      R.T(); //=> true
 */
var T = function () {
  return true;
};

/* harmony default export */ var es_T = (T);
// CONCATENATED MODULE: ./node_modules/ramda/es/__.js
/**
 * A special placeholder value used to specify "gaps" within curried functions,
 * allowing partial application of any combination of arguments, regardless of
 * their positions.
 *
 * If `g` is a curried ternary function and `_` is `R.__`, the following are
 * equivalent:
 *
 *   - `g(1, 2, 3)`
 *   - `g(_, 2, 3)(1)`
 *   - `g(_, _, 3)(1)(2)`
 *   - `g(_, _, 3)(1, 2)`
 *   - `g(_, 2, _)(1, 3)`
 *   - `g(_, 2)(1)(3)`
 *   - `g(_, 2)(1, 3)`
 *   - `g(_, 2)(_, 3)(1)`
 *
 * @name __
 * @constant
 * @memberOf R
 * @since v0.6.0
 * @category Function
 * @example
 *
 *      const greet = R.replace('{name}', R.__, 'Hello, {name}!');
 *      greet('Alice'); //=> 'Hello, Alice!'
 */
/* harmony default export */ var _ = ({
  '@@functional/placeholder': true
});
// CONCATENATED MODULE: ./node_modules/ramda/es/internal/_isPlaceholder.js
function _isPlaceholder(a) {
  return a != null && typeof a === 'object' && a['@@functional/placeholder'] === true;
}
// CONCATENATED MODULE: ./node_modules/ramda/es/internal/_curry1.js

/**
 * Optimized internal one-arity curry function.
 *
 * @private
 * @category Function
 * @param {Function} fn The function to curry.
 * @return {Function} The curried function.
 */

function _curry1(fn) {
  return function f1(a) {
    if (arguments.length === 0 || _isPlaceholder(a)) {
      return f1;
    } else {
      return fn.apply(this, arguments);
    }
  };
}
// CONCATENATED MODULE: ./node_modules/ramda/es/internal/_curry2.js


/**
 * Optimized internal two-arity curry function.
 *
 * @private
 * @category Function
 * @param {Function} fn The function to curry.
 * @return {Function} The curried function.
 */

function _curry2(fn) {
  return function f2(a, b) {
    switch (arguments.length) {
      case 0:
        return f2;

      case 1:
        return _isPlaceholder(a) ? f2 : _curry1(function (_b) {
          return fn(a, _b);
        });

      default:
        return _isPlaceholder(a) && _isPlaceholder(b) ? f2 : _isPlaceholder(a) ? _curry1(function (_a) {
          return fn(_a, b);
        }) : _isPlaceholder(b) ? _curry1(function (_b) {
          return fn(a, _b);
        }) : fn(a, b);
    }
  };
}
// CONCATENATED MODULE: ./node_modules/ramda/es/add.js

/**
 * Adds two values.
 *
 * @func
 * @memberOf R
 * @since v0.1.0
 * @category Math
 * @sig Number -> Number -> Number
 * @param {Number} a
 * @param {Number} b
 * @return {Number}
 * @see R.subtract
 * @example
 *
 *      R.add(2, 3);       //=>  5
 *      R.add(7)(10);      //=> 17
 */

var add =
/*#__PURE__*/
_curry2(function add(a, b) {
  return Number(a) + Number(b);
});

/* harmony default export */ var es_add = (add);
// CONCATENATED MODULE: ./node_modules/ramda/es/internal/_concat.js
/**
 * Private `concat` function to merge two array-like objects.
 *
 * @private
 * @param {Array|Arguments} [set1=[]] An array-like object.
 * @param {Array|Arguments} [set2=[]] An array-like object.
 * @return {Array} A new, merged array.
 * @example
 *
 *      _concat([4, 5, 6], [1, 2, 3]); //=> [4, 5, 6, 1, 2, 3]
 */
function _concat(set1, set2) {
  set1 = set1 || [];
  set2 = set2 || [];
  var idx;
  var len1 = set1.length;
  var len2 = set2.length;
  var result = [];
  idx = 0;

  while (idx < len1) {
    result[result.length] = set1[idx];
    idx += 1;
  }

  idx = 0;

  while (idx < len2) {
    result[result.length] = set2[idx];
    idx += 1;
  }

  return result;
}
// CONCATENATED MODULE: ./node_modules/ramda/es/internal/_arity.js
function _arity(n, fn) {
  /* eslint-disable no-unused-vars */
  switch (n) {
    case 0:
      return function () {
        return fn.apply(this, arguments);
      };

    case 1:
      return function (a0) {
        return fn.apply(this, arguments);
      };

    case 2:
      return function (a0, a1) {
        return fn.apply(this, arguments);
      };

    case 3:
      return function (a0, a1, a2) {
        return fn.apply(this, arguments);
      };

    case 4:
      return function (a0, a1, a2, a3) {
        return fn.apply(this, arguments);
      };

    case 5:
      return function (a0, a1, a2, a3, a4) {
        return fn.apply(this, arguments);
      };

    case 6:
      return function (a0, a1, a2, a3, a4, a5) {
        return fn.apply(this, arguments);
      };

    case 7:
      return function (a0, a1, a2, a3, a4, a5, a6) {
        return fn.apply(this, arguments);
      };

    case 8:
      return function (a0, a1, a2, a3, a4, a5, a6, a7) {
        return fn.apply(this, arguments);
      };

    case 9:
      return function (a0, a1, a2, a3, a4, a5, a6, a7, a8) {
        return fn.apply(this, arguments);
      };

    case 10:
      return function (a0, a1, a2, a3, a4, a5, a6, a7, a8, a9) {
        return fn.apply(this, arguments);
      };

    default:
      throw new Error('First argument to _arity must be a non-negative integer no greater than ten');
  }
}
// CONCATENATED MODULE: ./node_modules/ramda/es/internal/_curryN.js


/**
 * Internal curryN function.
 *
 * @private
 * @category Function
 * @param {Number} length The arity of the curried function.
 * @param {Array} received An array of arguments received thus far.
 * @param {Function} fn The function to curry.
 * @return {Function} The curried function.
 */

function _curryN(length, received, fn) {
  return function () {
    var combined = [];
    var argsIdx = 0;
    var left = length;
    var combinedIdx = 0;

    while (combinedIdx < received.length || argsIdx < arguments.length) {
      var result;

      if (combinedIdx < received.length && (!_isPlaceholder(received[combinedIdx]) || argsIdx >= arguments.length)) {
        result = received[combinedIdx];
      } else {
        result = arguments[argsIdx];
        argsIdx += 1;
      }

      combined[combinedIdx] = result;

      if (!_isPlaceholder(result)) {
        left -= 1;
      }

      combinedIdx += 1;
    }

    return left <= 0 ? fn.apply(this, combined) : _arity(left, _curryN(length, combined, fn));
  };
}
// CONCATENATED MODULE: ./node_modules/ramda/es/curryN.js




/**
 * Returns a curried equivalent of the provided function, with the specified
 * arity. The curried function has two unusual capabilities. First, its
 * arguments needn't be provided one at a time. If `g` is `R.curryN(3, f)`, the
 * following are equivalent:
 *
 *   - `g(1)(2)(3)`
 *   - `g(1)(2, 3)`
 *   - `g(1, 2)(3)`
 *   - `g(1, 2, 3)`
 *
 * Secondly, the special placeholder value [`R.__`](#__) may be used to specify
 * "gaps", allowing partial application of any combination of arguments,
 * regardless of their positions. If `g` is as above and `_` is [`R.__`](#__),
 * the following are equivalent:
 *
 *   - `g(1, 2, 3)`
 *   - `g(_, 2, 3)(1)`
 *   - `g(_, _, 3)(1)(2)`
 *   - `g(_, _, 3)(1, 2)`
 *   - `g(_, 2)(1)(3)`
 *   - `g(_, 2)(1, 3)`
 *   - `g(_, 2)(_, 3)(1)`
 *
 * @func
 * @memberOf R
 * @since v0.5.0
 * @category Function
 * @sig Number -> (* -> a) -> (* -> a)
 * @param {Number} length The arity for the returned function.
 * @param {Function} fn The function to curry.
 * @return {Function} A new, curried function.
 * @see R.curry
 * @example
 *
 *      const sumArgs = (...args) => R.sum(args);
 *
 *      const curriedAddFourNumbers = R.curryN(4, sumArgs);
 *      const f = curriedAddFourNumbers(1, 2);
 *      const g = f(3);
 *      g(4); //=> 10
 */

var curryN_curryN =
/*#__PURE__*/
_curry2(function curryN(length, fn) {
  if (length === 1) {
    return _curry1(fn);
  }

  return _arity(length, _curryN(length, [], fn));
});

/* harmony default export */ var es_curryN = (curryN_curryN);
// CONCATENATED MODULE: ./node_modules/ramda/es/addIndex.js



/**
 * Creates a new list iteration function from an existing one by adding two new
 * parameters to its callback function: the current index, and the entire list.
 *
 * This would turn, for instance, [`R.map`](#map) function into one that
 * more closely resembles `Array.prototype.map`. Note that this will only work
 * for functions in which the iteration callback function is the first
 * parameter, and where the list is the last parameter. (This latter might be
 * unimportant if the list parameter is not used.)
 *
 * @func
 * @memberOf R
 * @since v0.15.0
 * @category Function
 * @category List
 * @sig ((a ... -> b) ... -> [a] -> *) -> ((a ..., Int, [a] -> b) ... -> [a] -> *)
 * @param {Function} fn A list iteration function that does not pass index or list to its callback
 * @return {Function} An altered list iteration function that passes (item, index, list) to its callback
 * @example
 *
 *      const mapIndexed = R.addIndex(R.map);
 *      mapIndexed((val, idx) => idx + '-' + val, ['f', 'o', 'o', 'b', 'a', 'r']);
 *      //=> ['0-f', '1-o', '2-o', '3-b', '4-a', '5-r']
 */

var addIndex_addIndex =
/*#__PURE__*/
_curry1(function addIndex(fn) {
  return es_curryN(fn.length, function () {
    var idx = 0;
    var origFn = arguments[0];
    var list = arguments[arguments.length - 1];
    var args = Array.prototype.slice.call(arguments, 0);

    args[0] = function () {
      var result = origFn.apply(this, _concat(arguments, [idx, list]));
      idx += 1;
      return result;
    };

    return fn.apply(this, args);
  });
});

/* harmony default export */ var es_addIndex = (addIndex_addIndex);
// CONCATENATED MODULE: ./node_modules/ramda/es/internal/_curry3.js



/**
 * Optimized internal three-arity curry function.
 *
 * @private
 * @category Function
 * @param {Function} fn The function to curry.
 * @return {Function} The curried function.
 */

function _curry3(fn) {
  return function f3(a, b, c) {
    switch (arguments.length) {
      case 0:
        return f3;

      case 1:
        return _isPlaceholder(a) ? f3 : _curry2(function (_b, _c) {
          return fn(a, _b, _c);
        });

      case 2:
        return _isPlaceholder(a) && _isPlaceholder(b) ? f3 : _isPlaceholder(a) ? _curry2(function (_a, _c) {
          return fn(_a, b, _c);
        }) : _isPlaceholder(b) ? _curry2(function (_b, _c) {
          return fn(a, _b, _c);
        }) : _curry1(function (_c) {
          return fn(a, b, _c);
        });

      default:
        return _isPlaceholder(a) && _isPlaceholder(b) && _isPlaceholder(c) ? f3 : _isPlaceholder(a) && _isPlaceholder(b) ? _curry2(function (_a, _b) {
          return fn(_a, _b, c);
        }) : _isPlaceholder(a) && _isPlaceholder(c) ? _curry2(function (_a, _c) {
          return fn(_a, b, _c);
        }) : _isPlaceholder(b) && _isPlaceholder(c) ? _curry2(function (_b, _c) {
          return fn(a, _b, _c);
        }) : _isPlaceholder(a) ? _curry1(function (_a) {
          return fn(_a, b, c);
        }) : _isPlaceholder(b) ? _curry1(function (_b) {
          return fn(a, _b, c);
        }) : _isPlaceholder(c) ? _curry1(function (_c) {
          return fn(a, b, _c);
        }) : fn(a, b, c);
    }
  };
}
// CONCATENATED MODULE: ./node_modules/ramda/es/adjust.js


/**
 * Applies a function to the value at the given index of an array, returning a
 * new copy of the array with the element at the given index replaced with the
 * result of the function application.
 *
 * @func
 * @memberOf R
 * @since v0.14.0
 * @category List
 * @sig Number -> (a -> a) -> [a] -> [a]
 * @param {Number} idx The index.
 * @param {Function} fn The function to apply.
 * @param {Array|Arguments} list An array-like object whose value
 *        at the supplied index will be replaced.
 * @return {Array} A copy of the supplied array-like object with
 *         the element at index `idx` replaced with the value
 *         returned by applying `fn` to the existing element.
 * @see R.update
 * @example
 *
 *      R.adjust(1, R.toUpper, ['a', 'b', 'c', 'd']);      //=> ['a', 'B', 'c', 'd']
 *      R.adjust(-1, R.toUpper, ['a', 'b', 'c', 'd']);     //=> ['a', 'b', 'c', 'D']
 * @symb R.adjust(-1, f, [a, b]) = [a, f(b)]
 * @symb R.adjust(0, f, [a, b]) = [f(a), b]
 */

var adjust_adjust =
/*#__PURE__*/
_curry3(function adjust(idx, fn, list) {
  if (idx >= list.length || idx < -list.length) {
    return list;
  }

  var start = idx < 0 ? list.length : 0;

  var _idx = start + idx;

  var _list = _concat(list);

  _list[_idx] = fn(list[_idx]);
  return _list;
});

/* harmony default export */ var es_adjust = (adjust_adjust);
// CONCATENATED MODULE: ./node_modules/ramda/es/internal/_isArray.js
/**
 * Tests whether or not an object is an array.
 *
 * @private
 * @param {*} val The object to test.
 * @return {Boolean} `true` if `val` is an array, `false` otherwise.
 * @example
 *
 *      _isArray([]); //=> true
 *      _isArray(null); //=> false
 *      _isArray({}); //=> false
 */
/* harmony default export */ var _isArray = (Array.isArray || function _isArray(val) {
  return val != null && val.length >= 0 && Object.prototype.toString.call(val) === '[object Array]';
});
// CONCATENATED MODULE: ./node_modules/ramda/es/internal/_isTransformer.js
function _isTransformer(obj) {
  return obj != null && typeof obj['@@transducer/step'] === 'function';
}
// CONCATENATED MODULE: ./node_modules/ramda/es/internal/_dispatchable.js


/**
 * Returns a function that dispatches with different strategies based on the
 * object in list position (last argument). If it is an array, executes [fn].
 * Otherwise, if it has a function with one of the given method names, it will
 * execute that function (functor case). Otherwise, if it is a transformer,
 * uses transducer [xf] to return a new transformer (transducer case).
 * Otherwise, it will default to executing [fn].
 *
 * @private
 * @param {Array} methodNames properties to check for a custom implementation
 * @param {Function} xf transducer to initialize if object is transformer
 * @param {Function} fn default ramda implementation
 * @return {Function} A function that dispatches on object in list position
 */

function _dispatchable(methodNames, xf, fn) {
  return function () {
    if (arguments.length === 0) {
      return fn();
    }

    var args = Array.prototype.slice.call(arguments, 0);
    var obj = args.pop();

    if (!_isArray(obj)) {
      var idx = 0;

      while (idx < methodNames.length) {
        if (typeof obj[methodNames[idx]] === 'function') {
          return obj[methodNames[idx]].apply(obj, args);
        }

        idx += 1;
      }

      if (_isTransformer(obj)) {
        var transducer = xf.apply(null, args);
        return transducer(obj);
      }
    }

    return fn.apply(this, arguments);
  };
}
// CONCATENATED MODULE: ./node_modules/ramda/es/internal/_reduced.js
function _reduced(x) {
  return x && x['@@transducer/reduced'] ? x : {
    '@@transducer/value': x,
    '@@transducer/reduced': true
  };
}
// CONCATENATED MODULE: ./node_modules/ramda/es/internal/_xfBase.js
/* harmony default export */ var _xfBase = ({
  init: function () {
    return this.xf['@@transducer/init']();
  },
  result: function (result) {
    return this.xf['@@transducer/result'](result);
  }
});
// CONCATENATED MODULE: ./node_modules/ramda/es/internal/_xall.js




var _xall_XAll =
/*#__PURE__*/
function () {
  function XAll(f, xf) {
    this.xf = xf;
    this.f = f;
    this.all = true;
  }

  XAll.prototype['@@transducer/init'] = _xfBase.init;

  XAll.prototype['@@transducer/result'] = function (result) {
    if (this.all) {
      result = this.xf['@@transducer/step'](result, true);
    }

    return this.xf['@@transducer/result'](result);
  };

  XAll.prototype['@@transducer/step'] = function (result, input) {
    if (!this.f(input)) {
      this.all = false;
      result = _reduced(this.xf['@@transducer/step'](result, false));
    }

    return result;
  };

  return XAll;
}();

var _xall =
/*#__PURE__*/
_curry2(function _xall(f, xf) {
  return new _xall_XAll(f, xf);
});

/* harmony default export */ var internal_xall = (_xall);
// CONCATENATED MODULE: ./node_modules/ramda/es/all.js



/**
 * Returns `true` if all elements of the list match the predicate, `false` if
 * there are any that don't.
 *
 * Dispatches to the `all` method of the second argument, if present.
 *
 * Acts as a transducer if a transformer is given in list position.
 *
 * @func
 * @memberOf R
 * @since v0.1.0
 * @category List
 * @sig (a -> Boolean) -> [a] -> Boolean
 * @param {Function} fn The predicate function.
 * @param {Array} list The array to consider.
 * @return {Boolean} `true` if the predicate is satisfied by every element, `false`
 *         otherwise.
 * @see R.any, R.none, R.transduce
 * @example
 *
 *      const equals3 = R.equals(3);
 *      R.all(equals3)([3, 3, 3, 3]); //=> true
 *      R.all(equals3)([3, 3, 1, 3]); //=> false
 */

var all_all =
/*#__PURE__*/
_curry2(
/*#__PURE__*/
_dispatchable(['all'], internal_xall, function all(fn, list) {
  var idx = 0;

  while (idx < list.length) {
    if (!fn(list[idx])) {
      return false;
    }

    idx += 1;
  }

  return true;
}));

/* harmony default export */ var es_all = (all_all);
// CONCATENATED MODULE: ./node_modules/ramda/es/max.js

/**
 * Returns the larger of its two arguments.
 *
 * @func
 * @memberOf R
 * @since v0.1.0
 * @category Relation
 * @sig Ord a => a -> a -> a
 * @param {*} a
 * @param {*} b
 * @return {*}
 * @see R.maxBy, R.min
 * @example
 *
 *      R.max(789, 123); //=> 789
 *      R.max('a', 'b'); //=> 'b'
 */

var max =
/*#__PURE__*/
_curry2(function max(a, b) {
  return b > a ? b : a;
});

/* harmony default export */ var es_max = (max);
// CONCATENATED MODULE: ./node_modules/ramda/es/internal/_map.js
function _map(fn, functor) {
  var idx = 0;
  var len = functor.length;
  var result = Array(len);

  while (idx < len) {
    result[idx] = fn(functor[idx]);
    idx += 1;
  }

  return result;
}
// CONCATENATED MODULE: ./node_modules/ramda/es/internal/_isString.js
function _isString(x) {
  return Object.prototype.toString.call(x) === '[object String]';
}
// CONCATENATED MODULE: ./node_modules/ramda/es/internal/_isArrayLike.js



/**
 * Tests whether or not an object is similar to an array.
 *
 * @private
 * @category Type
 * @category List
 * @sig * -> Boolean
 * @param {*} x The object to test.
 * @return {Boolean} `true` if `x` has a numeric length property and extreme indices defined; `false` otherwise.
 * @example
 *
 *      _isArrayLike([]); //=> true
 *      _isArrayLike(true); //=> false
 *      _isArrayLike({}); //=> false
 *      _isArrayLike({length: 10}); //=> false
 *      _isArrayLike({0: 'zero', 9: 'nine', length: 10}); //=> true
 */

var _isArrayLike =
/*#__PURE__*/
_curry1(function isArrayLike(x) {
  if (_isArray(x)) {
    return true;
  }

  if (!x) {
    return false;
  }

  if (typeof x !== 'object') {
    return false;
  }

  if (_isString(x)) {
    return false;
  }

  if (x.nodeType === 1) {
    return !!x.length;
  }

  if (x.length === 0) {
    return true;
  }

  if (x.length > 0) {
    return x.hasOwnProperty(0) && x.hasOwnProperty(x.length - 1);
  }

  return false;
});

/* harmony default export */ var internal_isArrayLike = (_isArrayLike);
// CONCATENATED MODULE: ./node_modules/ramda/es/internal/_xwrap.js
var XWrap =
/*#__PURE__*/
function () {
  function XWrap(fn) {
    this.f = fn;
  }

  XWrap.prototype['@@transducer/init'] = function () {
    throw new Error('init not implemented on XWrap');
  };

  XWrap.prototype['@@transducer/result'] = function (acc) {
    return acc;
  };

  XWrap.prototype['@@transducer/step'] = function (acc, x) {
    return this.f(acc, x);
  };

  return XWrap;
}();

function _xwrap(fn) {
  return new XWrap(fn);
}
// CONCATENATED MODULE: ./node_modules/ramda/es/bind.js


/**
 * Creates a function that is bound to a context.
 * Note: `R.bind` does not provide the additional argument-binding capabilities of
 * [Function.prototype.bind](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/bind).
 *
 * @func
 * @memberOf R
 * @since v0.6.0
 * @category Function
 * @category Object
 * @sig (* -> *) -> {*} -> (* -> *)
 * @param {Function} fn The function to bind to context
 * @param {Object} thisObj The context to bind `fn` to
 * @return {Function} A function that will execute in the context of `thisObj`.
 * @see R.partial
 * @example
 *
 *      const log = R.bind(console.log, console);
 *      R.pipe(R.assoc('a', 2), R.tap(log), R.assoc('a', 3))({a: 1}); //=> {a: 3}
 *      // logs {a: 2}
 * @symb R.bind(f, o)(a, b) = f.call(o, a, b)
 */

var bind_bind =
/*#__PURE__*/
_curry2(function bind(fn, thisObj) {
  return _arity(fn.length, function () {
    return fn.apply(thisObj, arguments);
  });
});

/* harmony default export */ var es_bind = (bind_bind);
// CONCATENATED MODULE: ./node_modules/ramda/es/internal/_reduce.js




function _arrayReduce(xf, acc, list) {
  var idx = 0;
  var len = list.length;

  while (idx < len) {
    acc = xf['@@transducer/step'](acc, list[idx]);

    if (acc && acc['@@transducer/reduced']) {
      acc = acc['@@transducer/value'];
      break;
    }

    idx += 1;
  }

  return xf['@@transducer/result'](acc);
}

function _iterableReduce(xf, acc, iter) {
  var step = iter.next();

  while (!step.done) {
    acc = xf['@@transducer/step'](acc, step.value);

    if (acc && acc['@@transducer/reduced']) {
      acc = acc['@@transducer/value'];
      break;
    }

    step = iter.next();
  }

  return xf['@@transducer/result'](acc);
}

function _methodReduce(xf, acc, obj, methodName) {
  return xf['@@transducer/result'](obj[methodName](es_bind(xf['@@transducer/step'], xf), acc));
}

var symIterator = typeof Symbol !== 'undefined' ? Symbol.iterator : '@@iterator';
function _reduce(fn, acc, list) {
  if (typeof fn === 'function') {
    fn = _xwrap(fn);
  }

  if (internal_isArrayLike(list)) {
    return _arrayReduce(fn, acc, list);
  }

  if (typeof list['fantasy-land/reduce'] === 'function') {
    return _methodReduce(fn, acc, list, 'fantasy-land/reduce');
  }

  if (list[symIterator] != null) {
    return _iterableReduce(fn, acc, list[symIterator]());
  }

  if (typeof list.next === 'function') {
    return _iterableReduce(fn, acc, list);
  }

  if (typeof list.reduce === 'function') {
    return _methodReduce(fn, acc, list, 'reduce');
  }

  throw new TypeError('reduce: list must be array or iterable');
}
// CONCATENATED MODULE: ./node_modules/ramda/es/internal/_xmap.js



var _xmap_XMap =
/*#__PURE__*/
function () {
  function XMap(f, xf) {
    this.xf = xf;
    this.f = f;
  }

  XMap.prototype['@@transducer/init'] = _xfBase.init;
  XMap.prototype['@@transducer/result'] = _xfBase.result;

  XMap.prototype['@@transducer/step'] = function (result, input) {
    return this.xf['@@transducer/step'](result, this.f(input));
  };

  return XMap;
}();

var _xmap =
/*#__PURE__*/
_curry2(function _xmap(f, xf) {
  return new _xmap_XMap(f, xf);
});

/* harmony default export */ var internal_xmap = (_xmap);
// CONCATENATED MODULE: ./node_modules/ramda/es/internal/_has.js
function _has(prop, obj) {
  return Object.prototype.hasOwnProperty.call(obj, prop);
}
// CONCATENATED MODULE: ./node_modules/ramda/es/internal/_isArguments.js

var _isArguments_toString = Object.prototype.toString;

var _isArguments_isArguments =
/*#__PURE__*/
function () {
  return _isArguments_toString.call(arguments) === '[object Arguments]' ? function _isArguments(x) {
    return _isArguments_toString.call(x) === '[object Arguments]';
  } : function _isArguments(x) {
    return _has('callee', x);
  };
}();

/* harmony default export */ var internal_isArguments = (_isArguments_isArguments);
// CONCATENATED MODULE: ./node_modules/ramda/es/keys.js


 // cover IE < 9 keys issues

var hasEnumBug = !
/*#__PURE__*/
{
  toString: null
}.propertyIsEnumerable('toString');
var nonEnumerableProps = ['constructor', 'valueOf', 'isPrototypeOf', 'toString', 'propertyIsEnumerable', 'hasOwnProperty', 'toLocaleString']; // Safari bug

var hasArgsEnumBug =
/*#__PURE__*/
function () {
  'use strict';

  return arguments.propertyIsEnumerable('length');
}();

var contains = function contains(list, item) {
  var idx = 0;

  while (idx < list.length) {
    if (list[idx] === item) {
      return true;
    }

    idx += 1;
  }

  return false;
};
/**
 * Returns a list containing the names of all the enumerable own properties of
 * the supplied object.
 * Note that the order of the output array is not guaranteed to be consistent
 * across different JS platforms.
 *
 * @func
 * @memberOf R
 * @since v0.1.0
 * @category Object
 * @sig {k: v} -> [k]
 * @param {Object} obj The object to extract properties from
 * @return {Array} An array of the object's own properties.
 * @see R.keysIn, R.values
 * @example
 *
 *      R.keys({a: 1, b: 2, c: 3}); //=> ['a', 'b', 'c']
 */


var keys_keys = typeof Object.keys === 'function' && !hasArgsEnumBug ?
/*#__PURE__*/
_curry1(function keys(obj) {
  return Object(obj) !== obj ? [] : Object.keys(obj);
}) :
/*#__PURE__*/
_curry1(function keys(obj) {
  if (Object(obj) !== obj) {
    return [];
  }

  var prop, nIdx;
  var ks = [];

  var checkArgsLength = hasArgsEnumBug && internal_isArguments(obj);

  for (prop in obj) {
    if (_has(prop, obj) && (!checkArgsLength || prop !== 'length')) {
      ks[ks.length] = prop;
    }
  }

  if (hasEnumBug) {
    nIdx = nonEnumerableProps.length - 1;

    while (nIdx >= 0) {
      prop = nonEnumerableProps[nIdx];

      if (_has(prop, obj) && !contains(ks, prop)) {
        ks[ks.length] = prop;
      }

      nIdx -= 1;
    }
  }

  return ks;
});
/* harmony default export */ var es_keys = (keys_keys);
// CONCATENATED MODULE: ./node_modules/ramda/es/map.js







/**
 * Takes a function and
 * a [functor](https://github.com/fantasyland/fantasy-land#functor),
 * applies the function to each of the functor's values, and returns
 * a functor of the same shape.
 *
 * Ramda provides suitable `map` implementations for `Array` and `Object`,
 * so this function may be applied to `[1, 2, 3]` or `{x: 1, y: 2, z: 3}`.
 *
 * Dispatches to the `map` method of the second argument, if present.
 *
 * Acts as a transducer if a transformer is given in list position.
 *
 * Also treats functions as functors and will compose them together.
 *
 * @func
 * @memberOf R
 * @since v0.1.0
 * @category List
 * @sig Functor f => (a -> b) -> f a -> f b
 * @param {Function} fn The function to be called on every element of the input `list`.
 * @param {Array} list The list to be iterated over.
 * @return {Array} The new list.
 * @see R.transduce, R.addIndex
 * @example
 *
 *      const double = x => x * 2;
 *
 *      R.map(double, [1, 2, 3]); //=> [2, 4, 6]
 *
 *      R.map(double, {x: 1, y: 2, z: 3}); //=> {x: 2, y: 4, z: 6}
 * @symb R.map(f, [a, b]) = [f(a), f(b)]
 * @symb R.map(f, { x: a, y: b }) = { x: f(a), y: f(b) }
 * @symb R.map(f, functor_o) = functor_o.map(f)
 */

var map_map =
/*#__PURE__*/
_curry2(
/*#__PURE__*/
_dispatchable(['fantasy-land/map', 'map'], internal_xmap, function map(fn, functor) {
  switch (Object.prototype.toString.call(functor)) {
    case '[object Function]':
      return es_curryN(functor.length, function () {
        return fn.call(this, functor.apply(this, arguments));
      });

    case '[object Object]':
      return _reduce(function (acc, key) {
        acc[key] = fn(functor[key]);
        return acc;
      }, {}, es_keys(functor));

    default:
      return _map(fn, functor);
  }
}));

/* harmony default export */ var es_map = (map_map);
// CONCATENATED MODULE: ./node_modules/ramda/es/internal/_isInteger.js
/**
 * Determine if the passed argument is an integer.
 *
 * @private
 * @param {*} n
 * @category Type
 * @return {Boolean}
 */
/* harmony default export */ var _isInteger = (Number.isInteger || function _isInteger(n) {
  return n << 0 === n;
});
// CONCATENATED MODULE: ./node_modules/ramda/es/nth.js


/**
 * Returns the nth element of the given list or string. If n is negative the
 * element at index length + n is returned.
 *
 * @func
 * @memberOf R
 * @since v0.1.0
 * @category List
 * @sig Number -> [a] -> a | Undefined
 * @sig Number -> String -> String
 * @param {Number} offset
 * @param {*} list
 * @return {*}
 * @example
 *
 *      const list = ['foo', 'bar', 'baz', 'quux'];
 *      R.nth(1, list); //=> 'bar'
 *      R.nth(-1, list); //=> 'quux'
 *      R.nth(-99, list); //=> undefined
 *
 *      R.nth(2, 'abc'); //=> 'c'
 *      R.nth(3, 'abc'); //=> ''
 * @symb R.nth(-1, [a, b, c]) = c
 * @symb R.nth(0, [a, b, c]) = a
 * @symb R.nth(1, [a, b, c]) = b
 */

var nth_nth =
/*#__PURE__*/
_curry2(function nth(offset, list) {
  var idx = offset < 0 ? list.length + offset : offset;
  return _isString(list) ? list.charAt(idx) : list[idx];
});

/* harmony default export */ var es_nth = (nth_nth);
// CONCATENATED MODULE: ./node_modules/ramda/es/paths.js



/**
 * Retrieves the values at given paths of an object.
 *
 * @func
 * @memberOf R
 * @since v0.27.0
 * @category Object
 * @typedefn Idx = [String | Int]
 * @sig [Idx] -> {a} -> [a | Undefined]
 * @param {Array} pathsArray The array of paths to be fetched.
 * @param {Object} obj The object to retrieve the nested properties from.
 * @return {Array} A list consisting of values at paths specified by "pathsArray".
 * @see R.path
 * @example
 *
 *      R.paths([['a', 'b'], ['p', 0, 'q']], {a: {b: 2}, p: [{q: 3}]}); //=> [2, 3]
 *      R.paths([['a', 'b'], ['p', 'r']], {a: {b: 2}, p: [{q: 3}]}); //=> [2, undefined]
 */

var paths_paths =
/*#__PURE__*/
_curry2(function paths(pathsArray, obj) {
  return pathsArray.map(function (paths) {
    var val = obj;
    var idx = 0;
    var p;

    while (idx < paths.length) {
      if (val == null) {
        return;
      }

      p = paths[idx];
      val = _isInteger(p) ? es_nth(p, val) : val[p];
      idx += 1;
    }

    return val;
  });
});

/* harmony default export */ var es_paths = (paths_paths);
// CONCATENATED MODULE: ./node_modules/ramda/es/path.js


/**
 * Retrieve the value at a given path.
 *
 * @func
 * @memberOf R
 * @since v0.2.0
 * @category Object
 * @typedefn Idx = String | Int
 * @sig [Idx] -> {a} -> a | Undefined
 * @param {Array} path The path to use.
 * @param {Object} obj The object to retrieve the nested property from.
 * @return {*} The data at `path`.
 * @see R.prop, R.nth
 * @example
 *
 *      R.path(['a', 'b'], {a: {b: 2}}); //=> 2
 *      R.path(['a', 'b'], {c: {b: 2}}); //=> undefined
 *      R.path(['a', 'b', 0], {a: {b: [1, 2, 3]}}); //=> 1
 *      R.path(['a', 'b', -2], {a: {b: [1, 2, 3]}}); //=> 2
 */

var path_path =
/*#__PURE__*/
_curry2(function path(pathAr, obj) {
  return es_paths([pathAr], obj)[0];
});

/* harmony default export */ var es_path = (path_path);
// CONCATENATED MODULE: ./node_modules/ramda/es/prop.js


/**
 * Returns a function that when supplied an object returns the indicated
 * property of that object, if it exists.
 *
 * @func
 * @memberOf R
 * @since v0.1.0
 * @category Object
 * @typedefn Idx = String | Int
 * @sig Idx -> {s: a} -> a | Undefined
 * @param {String|Number} p The property name or array index
 * @param {Object} obj The object to query
 * @return {*} The value at `obj.p`.
 * @see R.path, R.nth
 * @example
 *
 *      R.prop('x', {x: 100}); //=> 100
 *      R.prop('x', {}); //=> undefined
 *      R.prop(0, [100]); //=> 100
 *      R.compose(R.inc, R.prop('x'))({ x: 3 }) //=> 4
 */

var prop_prop =
/*#__PURE__*/
_curry2(function prop(p, obj) {
  return es_path([p], obj);
});

/* harmony default export */ var es_prop = (prop_prop);
// CONCATENATED MODULE: ./node_modules/ramda/es/pluck.js



/**
 * Returns a new list by plucking the same named property off all objects in
 * the list supplied.
 *
 * `pluck` will work on
 * any [functor](https://github.com/fantasyland/fantasy-land#functor) in
 * addition to arrays, as it is equivalent to `R.map(R.prop(k), f)`.
 *
 * @func
 * @memberOf R
 * @since v0.1.0
 * @category List
 * @sig Functor f => k -> f {k: v} -> f v
 * @param {Number|String} key The key name to pluck off of each object.
 * @param {Array} f The array or functor to consider.
 * @return {Array} The list of values for the given key.
 * @see R.props
 * @example
 *
 *      var getAges = R.pluck('age');
 *      getAges([{name: 'fred', age: 29}, {name: 'wilma', age: 27}]); //=> [29, 27]
 *
 *      R.pluck(0, [[1, 2], [3, 4]]);               //=> [1, 3]
 *      R.pluck('val', {a: {val: 3}, b: {val: 5}}); //=> {a: 3, b: 5}
 * @symb R.pluck('x', [{x: 1, y: 2}, {x: 3, y: 4}, {x: 5, y: 6}]) = [1, 3, 5]
 * @symb R.pluck(0, [[1, 2], [3, 4], [5, 6]]) = [1, 3, 5]
 */

var pluck_pluck =
/*#__PURE__*/
_curry2(function pluck(p, list) {
  return es_map(es_prop(p), list);
});

/* harmony default export */ var es_pluck = (pluck_pluck);
// CONCATENATED MODULE: ./node_modules/ramda/es/reduce.js


/**
 * Returns a single item by iterating through the list, successively calling
 * the iterator function and passing it an accumulator value and the current
 * value from the array, and then passing the result to the next call.
 *
 * The iterator function receives two values: *(acc, value)*. It may use
 * [`R.reduced`](#reduced) to shortcut the iteration.
 *
 * The arguments' order of [`reduceRight`](#reduceRight)'s iterator function
 * is *(value, acc)*.
 *
 * Note: `R.reduce` does not skip deleted or unassigned indices (sparse
 * arrays), unlike the native `Array.prototype.reduce` method. For more details
 * on this behavior, see:
 * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce#Description
 *
 * Dispatches to the `reduce` method of the third argument, if present. When
 * doing so, it is up to the user to handle the [`R.reduced`](#reduced)
 * shortcuting, as this is not implemented by `reduce`.
 *
 * @func
 * @memberOf R
 * @since v0.1.0
 * @category List
 * @sig ((a, b) -> a) -> a -> [b] -> a
 * @param {Function} fn The iterator function. Receives two values, the accumulator and the
 *        current element from the array.
 * @param {*} acc The accumulator value.
 * @param {Array} list The list to iterate over.
 * @return {*} The final, accumulated value.
 * @see R.reduced, R.addIndex, R.reduceRight
 * @example
 *
 *      R.reduce(R.subtract, 0, [1, 2, 3, 4]) // => ((((0 - 1) - 2) - 3) - 4) = -10
 *      //          -               -10
 *      //         / \              / \
 *      //        -   4           -6   4
 *      //       / \              / \
 *      //      -   3   ==>     -3   3
 *      //     / \              / \
 *      //    -   2           -1   2
 *      //   / \              / \
 *      //  0   1            0   1
 *
 * @symb R.reduce(f, a, [b, c, d]) = f(f(f(a, b), c), d)
 */

var reduce =
/*#__PURE__*/
_curry3(_reduce);

/* harmony default export */ var es_reduce = (reduce);
// CONCATENATED MODULE: ./node_modules/ramda/es/allPass.js





/**
 * Takes a list of predicates and returns a predicate that returns true for a
 * given list of arguments if every one of the provided predicates is satisfied
 * by those arguments.
 *
 * The function returned is a curried function whose arity matches that of the
 * highest-arity predicate.
 *
 * @func
 * @memberOf R
 * @since v0.9.0
 * @category Logic
 * @sig [(*... -> Boolean)] -> (*... -> Boolean)
 * @param {Array} predicates An array of predicates to check
 * @return {Function} The combined predicate
 * @see R.anyPass
 * @example
 *
 *      const isQueen = R.propEq('rank', 'Q');
 *      const isSpade = R.propEq('suit', '♠︎');
 *      const isQueenOfSpades = R.allPass([isQueen, isSpade]);
 *
 *      isQueenOfSpades({rank: 'Q', suit: '♣︎'}); //=> false
 *      isQueenOfSpades({rank: 'Q', suit: '♠︎'}); //=> true
 */

var allPass_allPass =
/*#__PURE__*/
_curry1(function allPass(preds) {
  return es_curryN(es_reduce(es_max, 0, es_pluck('length', preds)), function () {
    var idx = 0;
    var len = preds.length;

    while (idx < len) {
      if (!preds[idx].apply(this, arguments)) {
        return false;
      }

      idx += 1;
    }

    return true;
  });
});

/* harmony default export */ var es_allPass = (allPass_allPass);
// CONCATENATED MODULE: ./node_modules/ramda/es/always.js

/**
 * Returns a function that always returns the given value. Note that for
 * non-primitives the value returned is a reference to the original value.
 *
 * This function is known as `const`, `constant`, or `K` (for K combinator) in
 * other languages and libraries.
 *
 * @func
 * @memberOf R
 * @since v0.1.0
 * @category Function
 * @sig a -> (* -> a)
 * @param {*} val The value to wrap in a function
 * @return {Function} A Function :: * -> val.
 * @example
 *
 *      const t = R.always('Tee');
 *      t(); //=> 'Tee'
 */

var always =
/*#__PURE__*/
_curry1(function always(val) {
  return function () {
    return val;
  };
});

/* harmony default export */ var es_always = (always);
// CONCATENATED MODULE: ./node_modules/ramda/es/and.js

/**
 * Returns `true` if both arguments are `true`; `false` otherwise.
 *
 * @func
 * @memberOf R
 * @since v0.1.0
 * @category Logic
 * @sig a -> b -> a | b
 * @param {Any} a
 * @param {Any} b
 * @return {Any} the first argument if it is falsy, otherwise the second argument.
 * @see R.both, R.xor
 * @example
 *
 *      R.and(true, true); //=> true
 *      R.and(true, false); //=> false
 *      R.and(false, true); //=> false
 *      R.and(false, false); //=> false
 */

var and =
/*#__PURE__*/
_curry2(function and(a, b) {
  return a && b;
});

/* harmony default export */ var es_and = (and);
// CONCATENATED MODULE: ./node_modules/ramda/es/internal/_xany.js




var _xany_XAny =
/*#__PURE__*/
function () {
  function XAny(f, xf) {
    this.xf = xf;
    this.f = f;
    this.any = false;
  }

  XAny.prototype['@@transducer/init'] = _xfBase.init;

  XAny.prototype['@@transducer/result'] = function (result) {
    if (!this.any) {
      result = this.xf['@@transducer/step'](result, false);
    }

    return this.xf['@@transducer/result'](result);
  };

  XAny.prototype['@@transducer/step'] = function (result, input) {
    if (this.f(input)) {
      this.any = true;
      result = _reduced(this.xf['@@transducer/step'](result, true));
    }

    return result;
  };

  return XAny;
}();

var _xany =
/*#__PURE__*/
_curry2(function _xany(f, xf) {
  return new _xany_XAny(f, xf);
});

/* harmony default export */ var internal_xany = (_xany);
// CONCATENATED MODULE: ./node_modules/ramda/es/any.js



/**
 * Returns `true` if at least one of the elements of the list match the predicate,
 * `false` otherwise.
 *
 * Dispatches to the `any` method of the second argument, if present.
 *
 * Acts as a transducer if a transformer is given in list position.
 *
 * @func
 * @memberOf R
 * @since v0.1.0
 * @category List
 * @sig (a -> Boolean) -> [a] -> Boolean
 * @param {Function} fn The predicate function.
 * @param {Array} list The array to consider.
 * @return {Boolean} `true` if the predicate is satisfied by at least one element, `false`
 *         otherwise.
 * @see R.all, R.none, R.transduce
 * @example
 *
 *      const lessThan0 = R.flip(R.lt)(0);
 *      const lessThan2 = R.flip(R.lt)(2);
 *      R.any(lessThan0)([1, 2]); //=> false
 *      R.any(lessThan2)([1, 2]); //=> true
 */

var any =
/*#__PURE__*/
_curry2(
/*#__PURE__*/
_dispatchable(['any'], internal_xany, function any(fn, list) {
  var idx = 0;

  while (idx < list.length) {
    if (fn(list[idx])) {
      return true;
    }

    idx += 1;
  }

  return false;
}));

/* harmony default export */ var es_any = (any);
// CONCATENATED MODULE: ./node_modules/ramda/es/anyPass.js





/**
 * Takes a list of predicates and returns a predicate that returns true for a
 * given list of arguments if at least one of the provided predicates is
 * satisfied by those arguments.
 *
 * The function returned is a curried function whose arity matches that of the
 * highest-arity predicate.
 *
 * @func
 * @memberOf R
 * @since v0.9.0
 * @category Logic
 * @sig [(*... -> Boolean)] -> (*... -> Boolean)
 * @param {Array} predicates An array of predicates to check
 * @return {Function} The combined predicate
 * @see R.allPass
 * @example
 *
 *      const isClub = R.propEq('suit', '♣');
 *      const isSpade = R.propEq('suit', '♠');
 *      const isBlackCard = R.anyPass([isClub, isSpade]);
 *
 *      isBlackCard({rank: '10', suit: '♣'}); //=> true
 *      isBlackCard({rank: 'Q', suit: '♠'}); //=> true
 *      isBlackCard({rank: 'Q', suit: '♦'}); //=> false
 */

var anyPass_anyPass =
/*#__PURE__*/
_curry1(function anyPass(preds) {
  return es_curryN(es_reduce(es_max, 0, es_pluck('length', preds)), function () {
    var idx = 0;
    var len = preds.length;

    while (idx < len) {
      if (preds[idx].apply(this, arguments)) {
        return true;
      }

      idx += 1;
    }

    return false;
  });
});

/* harmony default export */ var es_anyPass = (anyPass_anyPass);
// CONCATENATED MODULE: ./node_modules/ramda/es/ap.js




/**
 * ap applies a list of functions to a list of values.
 *
 * Dispatches to the `ap` method of the second argument, if present. Also
 * treats curried functions as applicatives.
 *
 * @func
 * @memberOf R
 * @since v0.3.0
 * @category Function
 * @sig [a -> b] -> [a] -> [b]
 * @sig Apply f => f (a -> b) -> f a -> f b
 * @sig (r -> a -> b) -> (r -> a) -> (r -> b)
 * @param {*} applyF
 * @param {*} applyX
 * @return {*}
 * @example
 *
 *      R.ap([R.multiply(2), R.add(3)], [1,2,3]); //=> [2, 4, 6, 4, 5, 6]
 *      R.ap([R.concat('tasty '), R.toUpper], ['pizza', 'salad']); //=> ["tasty pizza", "tasty salad", "PIZZA", "SALAD"]
 *
 *      // R.ap can also be used as S combinator
 *      // when only two functions are passed
 *      R.ap(R.concat, R.toUpper)('Ramda') //=> 'RamdaRAMDA'
 * @symb R.ap([f, g], [a, b]) = [f(a), f(b), g(a), g(b)]
 */

var ap_ap =
/*#__PURE__*/
_curry2(function ap(applyF, applyX) {
  return typeof applyX['fantasy-land/ap'] === 'function' ? applyX['fantasy-land/ap'](applyF) : typeof applyF.ap === 'function' ? applyF.ap(applyX) : typeof applyF === 'function' ? function (x) {
    return applyF(x)(applyX(x));
  } : _reduce(function (acc, f) {
    return _concat(acc, es_map(f, applyX));
  }, [], applyF);
});

/* harmony default export */ var es_ap = (ap_ap);
// CONCATENATED MODULE: ./node_modules/ramda/es/internal/_aperture.js
function _aperture(n, list) {
  var idx = 0;
  var limit = list.length - (n - 1);
  var acc = new Array(limit >= 0 ? limit : 0);

  while (idx < limit) {
    acc[idx] = Array.prototype.slice.call(list, idx, idx + n);
    idx += 1;
  }

  return acc;
}
// CONCATENATED MODULE: ./node_modules/ramda/es/internal/_xaperture.js




var _xaperture_XAperture =
/*#__PURE__*/
function () {
  function XAperture(n, xf) {
    this.xf = xf;
    this.pos = 0;
    this.full = false;
    this.acc = new Array(n);
  }

  XAperture.prototype['@@transducer/init'] = _xfBase.init;

  XAperture.prototype['@@transducer/result'] = function (result) {
    this.acc = null;
    return this.xf['@@transducer/result'](result);
  };

  XAperture.prototype['@@transducer/step'] = function (result, input) {
    this.store(input);
    return this.full ? this.xf['@@transducer/step'](result, this.getCopy()) : result;
  };

  XAperture.prototype.store = function (input) {
    this.acc[this.pos] = input;
    this.pos += 1;

    if (this.pos === this.acc.length) {
      this.pos = 0;
      this.full = true;
    }
  };

  XAperture.prototype.getCopy = function () {
    return _concat(Array.prototype.slice.call(this.acc, this.pos), Array.prototype.slice.call(this.acc, 0, this.pos));
  };

  return XAperture;
}();

var _xaperture =
/*#__PURE__*/
_curry2(function _xaperture(n, xf) {
  return new _xaperture_XAperture(n, xf);
});

/* harmony default export */ var internal_xaperture = (_xaperture);
// CONCATENATED MODULE: ./node_modules/ramda/es/aperture.js




/**
 * Returns a new list, composed of n-tuples of consecutive elements. If `n` is
 * greater than the length of the list, an empty list is returned.
 *
 * Acts as a transducer if a transformer is given in list position.
 *
 * @func
 * @memberOf R
 * @since v0.12.0
 * @category List
 * @sig Number -> [a] -> [[a]]
 * @param {Number} n The size of the tuples to create
 * @param {Array} list The list to split into `n`-length tuples
 * @return {Array} The resulting list of `n`-length tuples
 * @see R.transduce
 * @example
 *
 *      R.aperture(2, [1, 2, 3, 4, 5]); //=> [[1, 2], [2, 3], [3, 4], [4, 5]]
 *      R.aperture(3, [1, 2, 3, 4, 5]); //=> [[1, 2, 3], [2, 3, 4], [3, 4, 5]]
 *      R.aperture(7, [1, 2, 3, 4, 5]); //=> []
 */

var aperture =
/*#__PURE__*/
_curry2(
/*#__PURE__*/
_dispatchable([], internal_xaperture, _aperture));

/* harmony default export */ var es_aperture = (aperture);
// CONCATENATED MODULE: ./node_modules/ramda/es/append.js


/**
 * Returns a new list containing the contents of the given list, followed by
 * the given element.
 *
 * @func
 * @memberOf R
 * @since v0.1.0
 * @category List
 * @sig a -> [a] -> [a]
 * @param {*} el The element to add to the end of the new list.
 * @param {Array} list The list of elements to add a new item to.
 *        list.
 * @return {Array} A new list containing the elements of the old list followed by `el`.
 * @see R.prepend
 * @example
 *
 *      R.append('tests', ['write', 'more']); //=> ['write', 'more', 'tests']
 *      R.append('tests', []); //=> ['tests']
 *      R.append(['tests'], ['write', 'more']); //=> ['write', 'more', ['tests']]
 */

var append_append =
/*#__PURE__*/
_curry2(function append(el, list) {
  return _concat(list, [el]);
});

/* harmony default export */ var es_append = (append_append);
// CONCATENATED MODULE: ./node_modules/ramda/es/apply.js

/**
 * Applies function `fn` to the argument list `args`. This is useful for
 * creating a fixed-arity function from a variadic function. `fn` should be a
 * bound function if context is significant.
 *
 * @func
 * @memberOf R
 * @since v0.7.0
 * @category Function
 * @sig (*... -> a) -> [*] -> a
 * @param {Function} fn The function which will be called with `args`
 * @param {Array} args The arguments to call `fn` with
 * @return {*} result The result, equivalent to `fn(...args)`
 * @see R.call, R.unapply
 * @example
 *
 *      const nums = [1, 2, 3, -99, 42, 6, 7];
 *      R.apply(Math.max, nums); //=> 42
 * @symb R.apply(f, [a, b, c]) = f(a, b, c)
 */

var apply =
/*#__PURE__*/
_curry2(function apply(fn, args) {
  return fn.apply(this, args);
});

/* harmony default export */ var es_apply = (apply);
// CONCATENATED MODULE: ./node_modules/ramda/es/values.js


/**
 * Returns a list of all the enumerable own properties of the supplied object.
 * Note that the order of the output array is not guaranteed across different
 * JS platforms.
 *
 * @func
 * @memberOf R
 * @since v0.1.0
 * @category Object
 * @sig {k: v} -> [v]
 * @param {Object} obj The object to extract values from
 * @return {Array} An array of the values of the object's own properties.
 * @see R.valuesIn, R.keys
 * @example
 *
 *      R.values({a: 1, b: 2, c: 3}); //=> [1, 2, 3]
 */

var values_values =
/*#__PURE__*/
_curry1(function values(obj) {
  var props = es_keys(obj);
  var len = props.length;
  var vals = [];
  var idx = 0;

  while (idx < len) {
    vals[idx] = obj[props[idx]];
    idx += 1;
  }

  return vals;
});

/* harmony default export */ var es_values = (values_values);
// CONCATENATED MODULE: ./node_modules/ramda/es/applySpec.js







 // Use custom mapValues function to avoid issues with specs that include a "map" key and R.map
// delegating calls to .map

function mapValues(fn, obj) {
  return es_keys(obj).reduce(function (acc, key) {
    acc[key] = fn(obj[key]);
    return acc;
  }, {});
}
/**
 * Given a spec object recursively mapping properties to functions, creates a
 * function producing an object of the same structure, by mapping each property
 * to the result of calling its associated function with the supplied arguments.
 *
 * @func
 * @memberOf R
 * @since v0.20.0
 * @category Function
 * @sig {k: ((a, b, ..., m) -> v)} -> ((a, b, ..., m) -> {k: v})
 * @param {Object} spec an object recursively mapping properties to functions for
 *        producing the values for these properties.
 * @return {Function} A function that returns an object of the same structure
 * as `spec', with each property set to the value returned by calling its
 * associated function with the supplied arguments.
 * @see R.converge, R.juxt
 * @example
 *
 *      const getMetrics = R.applySpec({
 *        sum: R.add,
 *        nested: { mul: R.multiply }
 *      });
 *      getMetrics(2, 4); // => { sum: 6, nested: { mul: 8 } }
 * @symb R.applySpec({ x: f, y: { z: g } })(a, b) = { x: f(a, b), y: { z: g(a, b) } }
 */


var applySpec_applySpec =
/*#__PURE__*/
_curry1(function applySpec(spec) {
  spec = mapValues(function (v) {
    return typeof v == 'function' ? v : applySpec(v);
  }, spec);
  return es_curryN(es_reduce(es_max, 0, es_pluck('length', es_values(spec))), function () {
    var args = arguments;
    return mapValues(function (f) {
      return es_apply(f, args);
    }, spec);
  });
});

/* harmony default export */ var es_applySpec = (applySpec_applySpec);
// CONCATENATED MODULE: ./node_modules/ramda/es/applyTo.js

/**
 * Takes a value and applies a function to it.
 *
 * This function is also known as the `thrush` combinator.
 *
 * @func
 * @memberOf R
 * @since v0.25.0
 * @category Function
 * @sig a -> (a -> b) -> b
 * @param {*} x The value
 * @param {Function} f The function to apply
 * @return {*} The result of applying `f` to `x`
 * @example
 *
 *      const t42 = R.applyTo(42);
 *      t42(R.identity); //=> 42
 *      t42(R.add(1)); //=> 43
 */

var applyTo =
/*#__PURE__*/
_curry2(function applyTo(x, f) {
  return f(x);
});

/* harmony default export */ var es_applyTo = (applyTo);
// CONCATENATED MODULE: ./node_modules/ramda/es/ascend.js

/**
 * Makes an ascending comparator function out of a function that returns a value
 * that can be compared with `<` and `>`.
 *
 * @func
 * @memberOf R
 * @since v0.23.0
 * @category Function
 * @sig Ord b => (a -> b) -> a -> a -> Number
 * @param {Function} fn A function of arity one that returns a value that can be compared
 * @param {*} a The first item to be compared.
 * @param {*} b The second item to be compared.
 * @return {Number} `-1` if fn(a) < fn(b), `1` if fn(b) < fn(a), otherwise `0`
 * @see R.descend
 * @example
 *
 *      const byAge = R.ascend(R.prop('age'));
 *      const people = [
 *        { name: 'Emma', age: 70 },
 *        { name: 'Peter', age: 78 },
 *        { name: 'Mikhail', age: 62 },
 *      ];
 *      const peopleByYoungestFirst = R.sort(byAge, people);
 *        //=> [{ name: 'Mikhail', age: 62 },{ name: 'Emma', age: 70 }, { name: 'Peter', age: 78 }]
 */

var ascend =
/*#__PURE__*/
_curry3(function ascend(fn, a, b) {
  var aa = fn(a);
  var bb = fn(b);
  return aa < bb ? -1 : aa > bb ? 1 : 0;
});

/* harmony default export */ var es_ascend = (ascend);
// CONCATENATED MODULE: ./node_modules/ramda/es/assoc.js

/**
 * Makes a shallow clone of an object, setting or overriding the specified
 * property with the given value. Note that this copies and flattens prototype
 * properties onto the new object as well. All non-primitive properties are
 * copied by reference.
 *
 * @func
 * @memberOf R
 * @since v0.8.0
 * @category Object
 * @sig String -> a -> {k: v} -> {k: v}
 * @param {String} prop The property name to set
 * @param {*} val The new value
 * @param {Object} obj The object to clone
 * @return {Object} A new object equivalent to the original except for the changed property.
 * @see R.dissoc, R.pick
 * @example
 *
 *      R.assoc('c', 3, {a: 1, b: 2}); //=> {a: 1, b: 2, c: 3}
 */

var assoc =
/*#__PURE__*/
_curry3(function assoc(prop, val, obj) {
  var result = {};

  for (var p in obj) {
    result[p] = obj[p];
  }

  result[prop] = val;
  return result;
});

/* harmony default export */ var es_assoc = (assoc);
// CONCATENATED MODULE: ./node_modules/ramda/es/isNil.js

/**
 * Checks if the input value is `null` or `undefined`.
 *
 * @func
 * @memberOf R
 * @since v0.9.0
 * @category Type
 * @sig * -> Boolean
 * @param {*} x The value to test.
 * @return {Boolean} `true` if `x` is `undefined` or `null`, otherwise `false`.
 * @example
 *
 *      R.isNil(null); //=> true
 *      R.isNil(undefined); //=> true
 *      R.isNil(0); //=> false
 *      R.isNil([]); //=> false
 */

var isNil =
/*#__PURE__*/
_curry1(function isNil(x) {
  return x == null;
});

/* harmony default export */ var es_isNil = (isNil);
// CONCATENATED MODULE: ./node_modules/ramda/es/assocPath.js






/**
 * Makes a shallow clone of an object, setting or overriding the nodes required
 * to create the given path, and placing the specific value at the tail end of
 * that path. Note that this copies and flattens prototype properties onto the
 * new object as well. All non-primitive properties are copied by reference.
 *
 * @func
 * @memberOf R
 * @since v0.8.0
 * @category Object
 * @typedefn Idx = String | Int
 * @sig [Idx] -> a -> {a} -> {a}
 * @param {Array} path the path to set
 * @param {*} val The new value
 * @param {Object} obj The object to clone
 * @return {Object} A new object equivalent to the original except along the specified path.
 * @see R.dissocPath
 * @example
 *
 *      R.assocPath(['a', 'b', 'c'], 42, {a: {b: {c: 0}}}); //=> {a: {b: {c: 42}}}
 *
 *      // Any missing or non-object keys in path will be overridden
 *      R.assocPath(['a', 'b', 'c'], 42, {a: 5}); //=> {a: {b: {c: 42}}}
 */

var assocPath_assocPath =
/*#__PURE__*/
_curry3(function assocPath(path, val, obj) {
  if (path.length === 0) {
    return val;
  }

  var idx = path[0];

  if (path.length > 1) {
    var nextObj = !es_isNil(obj) && _has(idx, obj) ? obj[idx] : _isInteger(path[1]) ? [] : {};
    val = assocPath(Array.prototype.slice.call(path, 1), val, nextObj);
  }

  if (_isInteger(idx) && _isArray(obj)) {
    var arr = [].concat(obj);
    arr[idx] = val;
    return arr;
  } else {
    return es_assoc(idx, val, obj);
  }
});

/* harmony default export */ var es_assocPath = (assocPath_assocPath);
// CONCATENATED MODULE: ./node_modules/ramda/es/nAry.js

/**
 * Wraps a function of any arity (including nullary) in a function that accepts
 * exactly `n` parameters. Any extraneous parameters will not be passed to the
 * supplied function.
 *
 * @func
 * @memberOf R
 * @since v0.1.0
 * @category Function
 * @sig Number -> (* -> a) -> (* -> a)
 * @param {Number} n The desired arity of the new function.
 * @param {Function} fn The function to wrap.
 * @return {Function} A new function wrapping `fn`. The new function is guaranteed to be of
 *         arity `n`.
 * @see R.binary, R.unary
 * @example
 *
 *      const takesTwoArgs = (a, b) => [a, b];
 *
 *      takesTwoArgs.length; //=> 2
 *      takesTwoArgs(1, 2); //=> [1, 2]
 *
 *      const takesOneArg = R.nAry(1, takesTwoArgs);
 *      takesOneArg.length; //=> 1
 *      // Only `n` arguments are passed to the wrapped function
 *      takesOneArg(1, 2); //=> [1, undefined]
 * @symb R.nAry(0, f)(a, b) = f()
 * @symb R.nAry(1, f)(a, b) = f(a)
 * @symb R.nAry(2, f)(a, b) = f(a, b)
 */

var nAry =
/*#__PURE__*/
_curry2(function nAry(n, fn) {
  switch (n) {
    case 0:
      return function () {
        return fn.call(this);
      };

    case 1:
      return function (a0) {
        return fn.call(this, a0);
      };

    case 2:
      return function (a0, a1) {
        return fn.call(this, a0, a1);
      };

    case 3:
      return function (a0, a1, a2) {
        return fn.call(this, a0, a1, a2);
      };

    case 4:
      return function (a0, a1, a2, a3) {
        return fn.call(this, a0, a1, a2, a3);
      };

    case 5:
      return function (a0, a1, a2, a3, a4) {
        return fn.call(this, a0, a1, a2, a3, a4);
      };

    case 6:
      return function (a0, a1, a2, a3, a4, a5) {
        return fn.call(this, a0, a1, a2, a3, a4, a5);
      };

    case 7:
      return function (a0, a1, a2, a3, a4, a5, a6) {
        return fn.call(this, a0, a1, a2, a3, a4, a5, a6);
      };

    case 8:
      return function (a0, a1, a2, a3, a4, a5, a6, a7) {
        return fn.call(this, a0, a1, a2, a3, a4, a5, a6, a7);
      };

    case 9:
      return function (a0, a1, a2, a3, a4, a5, a6, a7, a8) {
        return fn.call(this, a0, a1, a2, a3, a4, a5, a6, a7, a8);
      };

    case 10:
      return function (a0, a1, a2, a3, a4, a5, a6, a7, a8, a9) {
        return fn.call(this, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
      };

    default:
      throw new Error('First argument to nAry must be a non-negative integer no greater than ten');
  }
});

/* harmony default export */ var es_nAry = (nAry);
// CONCATENATED MODULE: ./node_modules/ramda/es/binary.js


/**
 * Wraps a function of any arity (including nullary) in a function that accepts
 * exactly 2 parameters. Any extraneous parameters will not be passed to the
 * supplied function.
 *
 * @func
 * @memberOf R
 * @since v0.2.0
 * @category Function
 * @sig (* -> c) -> (a, b -> c)
 * @param {Function} fn The function to wrap.
 * @return {Function} A new function wrapping `fn`. The new function is guaranteed to be of
 *         arity 2.
 * @see R.nAry, R.unary
 * @example
 *
 *      const takesThreeArgs = function(a, b, c) {
 *        return [a, b, c];
 *      };
 *      takesThreeArgs.length; //=> 3
 *      takesThreeArgs(1, 2, 3); //=> [1, 2, 3]
 *
 *      const takesTwoArgs = R.binary(takesThreeArgs);
 *      takesTwoArgs.length; //=> 2
 *      // Only 2 arguments are passed to the wrapped function
 *      takesTwoArgs(1, 2, 3); //=> [1, 2, undefined]
 * @symb R.binary(f)(a, b, c) = f(a, b)
 */

var binary_binary =
/*#__PURE__*/
_curry1(function binary(fn) {
  return es_nAry(2, fn);
});

/* harmony default export */ var es_binary = (binary_binary);
// CONCATENATED MODULE: ./node_modules/ramda/es/internal/_isFunction.js
function _isFunction(x) {
  var type = Object.prototype.toString.call(x);
  return type === '[object Function]' || type === '[object AsyncFunction]' || type === '[object GeneratorFunction]' || type === '[object AsyncGeneratorFunction]';
}
// CONCATENATED MODULE: ./node_modules/ramda/es/liftN.js





/**
 * "lifts" a function to be the specified arity, so that it may "map over" that
 * many lists, Functions or other objects that satisfy the [FantasyLand Apply spec](https://github.com/fantasyland/fantasy-land#apply).
 *
 * @func
 * @memberOf R
 * @since v0.7.0
 * @category Function
 * @sig Number -> (*... -> *) -> ([*]... -> [*])
 * @param {Function} fn The function to lift into higher context
 * @return {Function} The lifted function.
 * @see R.lift, R.ap
 * @example
 *
 *      const madd3 = R.liftN(3, (...args) => R.sum(args));
 *      madd3([1,2,3], [1,2,3], [1]); //=> [3, 4, 5, 4, 5, 6, 5, 6, 7]
 */

var liftN_liftN =
/*#__PURE__*/
_curry2(function liftN(arity, fn) {
  var lifted = es_curryN(arity, fn);
  return es_curryN(arity, function () {
    return _reduce(es_ap, es_map(lifted, arguments[0]), Array.prototype.slice.call(arguments, 1));
  });
});

/* harmony default export */ var es_liftN = (liftN_liftN);
// CONCATENATED MODULE: ./node_modules/ramda/es/lift.js


/**
 * "lifts" a function of arity > 1 so that it may "map over" a list, Function or other
 * object that satisfies the [FantasyLand Apply spec](https://github.com/fantasyland/fantasy-land#apply).
 *
 * @func
 * @memberOf R
 * @since v0.7.0
 * @category Function
 * @sig (*... -> *) -> ([*]... -> [*])
 * @param {Function} fn The function to lift into higher context
 * @return {Function} The lifted function.
 * @see R.liftN
 * @example
 *
 *      const madd3 = R.lift((a, b, c) => a + b + c);
 *
 *      madd3([1,2,3], [1,2,3], [1]); //=> [3, 4, 5, 4, 5, 6, 5, 6, 7]
 *
 *      const madd5 = R.lift((a, b, c, d, e) => a + b + c + d + e);
 *
 *      madd5([1,2], [3], [4, 5], [6], [7, 8]); //=> [21, 22, 22, 23, 22, 23, 23, 24]
 */

var lift_lift =
/*#__PURE__*/
_curry1(function lift(fn) {
  return es_liftN(fn.length, fn);
});

/* harmony default export */ var es_lift = (lift_lift);
// CONCATENATED MODULE: ./node_modules/ramda/es/both.js




/**
 * A function which calls the two provided functions and returns the `&&`
 * of the results.
 * It returns the result of the first function if it is false-y and the result
 * of the second function otherwise. Note that this is short-circuited,
 * meaning that the second function will not be invoked if the first returns a
 * false-y value.
 *
 * In addition to functions, `R.both` also accepts any fantasy-land compatible
 * applicative functor.
 *
 * @func
 * @memberOf R
 * @since v0.12.0
 * @category Logic
 * @sig (*... -> Boolean) -> (*... -> Boolean) -> (*... -> Boolean)
 * @param {Function} f A predicate
 * @param {Function} g Another predicate
 * @return {Function} a function that applies its arguments to `f` and `g` and `&&`s their outputs together.
 * @see R.and
 * @example
 *
 *      const gt10 = R.gt(R.__, 10)
 *      const lt20 = R.lt(R.__, 20)
 *      const f = R.both(gt10, lt20);
 *      f(15); //=> true
 *      f(30); //=> false
 *
 *      R.both(Maybe.Just(false), Maybe.Just(55)); // => Maybe.Just(false)
 *      R.both([false, false, 'a'], [11]); //=> [false, false, 11]
 */

var both_both =
/*#__PURE__*/
_curry2(function both(f, g) {
  return _isFunction(f) ? function _both() {
    return f.apply(this, arguments) && g.apply(this, arguments);
  } : es_lift(es_and)(f, g);
});

/* harmony default export */ var es_both = (both_both);
// CONCATENATED MODULE: ./node_modules/ramda/es/curry.js


/**
 * Returns a curried equivalent of the provided function. The curried function
 * has two unusual capabilities. First, its arguments needn't be provided one
 * at a time. If `f` is a ternary function and `g` is `R.curry(f)`, the
 * following are equivalent:
 *
 *   - `g(1)(2)(3)`
 *   - `g(1)(2, 3)`
 *   - `g(1, 2)(3)`
 *   - `g(1, 2, 3)`
 *
 * Secondly, the special placeholder value [`R.__`](#__) may be used to specify
 * "gaps", allowing partial application of any combination of arguments,
 * regardless of their positions. If `g` is as above and `_` is [`R.__`](#__),
 * the following are equivalent:
 *
 *   - `g(1, 2, 3)`
 *   - `g(_, 2, 3)(1)`
 *   - `g(_, _, 3)(1)(2)`
 *   - `g(_, _, 3)(1, 2)`
 *   - `g(_, 2)(1)(3)`
 *   - `g(_, 2)(1, 3)`
 *   - `g(_, 2)(_, 3)(1)`
 *
 * @func
 * @memberOf R
 * @since v0.1.0
 * @category Function
 * @sig (* -> a) -> (* -> a)
 * @param {Function} fn The function to curry.
 * @return {Function} A new, curried function.
 * @see R.curryN, R.partial
 * @example
 *
 *      const addFourNumbers = (a, b, c, d) => a + b + c + d;
 *
 *      const curriedAddFourNumbers = R.curry(addFourNumbers);
 *      const f = curriedAddFourNumbers(1, 2);
 *      const g = f(3);
 *      g(4); //=> 10
 */

var curry_curry =
/*#__PURE__*/
_curry1(function curry(fn) {
  return es_curryN(fn.length, fn);
});

/* harmony default export */ var es_curry = (curry_curry);
// CONCATENATED MODULE: ./node_modules/ramda/es/call.js

/**
 * Returns the result of calling its first argument with the remaining
 * arguments. This is occasionally useful as a converging function for
 * [`R.converge`](#converge): the first branch can produce a function while the
 * remaining branches produce values to be passed to that function as its
 * arguments.
 *
 * @func
 * @memberOf R
 * @since v0.9.0
 * @category Function
 * @sig (*... -> a),*... -> a
 * @param {Function} fn The function to apply to the remaining arguments.
 * @param {...*} args Any number of positional arguments.
 * @return {*}
 * @see R.apply
 * @example
 *
 *      R.call(R.add, 1, 2); //=> 3
 *
 *      const indentN = R.pipe(R.repeat(' '),
 *                           R.join(''),
 *                           R.replace(/^(?!$)/gm));
 *
 *      const format = R.converge(R.call, [
 *                                  R.pipe(R.prop('indent'), indentN),
 *                                  R.prop('value')
 *                              ]);
 *
 *      format({indent: 2, value: 'foo\nbar\nbaz\n'}); //=> '  foo\n  bar\n  baz\n'
 * @symb R.call(f, a, b) = f(a, b)
 */

var call =
/*#__PURE__*/
es_curry(function call(fn) {
  return fn.apply(this, Array.prototype.slice.call(arguments, 1));
});
/* harmony default export */ var es_call = (call);
// CONCATENATED MODULE: ./node_modules/ramda/es/internal/_makeFlat.js

/**
 * `_makeFlat` is a helper function that returns a one-level or fully recursive
 * function based on the flag passed in.
 *
 * @private
 */

function _makeFlat(recursive) {
  return function flatt(list) {
    var value, jlen, j;
    var result = [];
    var idx = 0;
    var ilen = list.length;

    while (idx < ilen) {
      if (internal_isArrayLike(list[idx])) {
        value = recursive ? flatt(list[idx]) : list[idx];
        j = 0;
        jlen = value.length;

        while (j < jlen) {
          result[result.length] = value[j];
          j += 1;
        }
      } else {
        result[result.length] = list[idx];
      }

      idx += 1;
    }

    return result;
  };
}
// CONCATENATED MODULE: ./node_modules/ramda/es/internal/_forceReduced.js
function _forceReduced(x) {
  return {
    '@@transducer/value': x,
    '@@transducer/reduced': true
  };
}
// CONCATENATED MODULE: ./node_modules/ramda/es/internal/_flatCat.js





var preservingReduced = function (xf) {
  return {
    '@@transducer/init': _xfBase.init,
    '@@transducer/result': function (result) {
      return xf['@@transducer/result'](result);
    },
    '@@transducer/step': function (result, input) {
      var ret = xf['@@transducer/step'](result, input);
      return ret['@@transducer/reduced'] ? _forceReduced(ret) : ret;
    }
  };
};

var _flatCat = function _xcat(xf) {
  var rxf = preservingReduced(xf);
  return {
    '@@transducer/init': _xfBase.init,
    '@@transducer/result': function (result) {
      return rxf['@@transducer/result'](result);
    },
    '@@transducer/step': function (result, input) {
      return !internal_isArrayLike(input) ? _reduce(rxf, result, [input]) : _reduce(rxf, result, input);
    }
  };
};

/* harmony default export */ var internal_flatCat = (_flatCat);
// CONCATENATED MODULE: ./node_modules/ramda/es/internal/_xchain.js




var _xchain_xchain =
/*#__PURE__*/
_curry2(function _xchain(f, xf) {
  return es_map(f, internal_flatCat(xf));
});

/* harmony default export */ var internal_xchain = (_xchain_xchain);
// CONCATENATED MODULE: ./node_modules/ramda/es/chain.js





/**
 * `chain` maps a function over a list and concatenates the results. `chain`
 * is also known as `flatMap` in some libraries.
 *
 * Dispatches to the `chain` method of the second argument, if present,
 * according to the [FantasyLand Chain spec](https://github.com/fantasyland/fantasy-land#chain).
 *
 * If second argument is a function, `chain(f, g)(x)` is equivalent to `f(g(x), x)`.
 *
 * Acts as a transducer if a transformer is given in list position.
 *
 * @func
 * @memberOf R
 * @since v0.3.0
 * @category List
 * @sig Chain m => (a -> m b) -> m a -> m b
 * @param {Function} fn The function to map with
 * @param {Array} list The list to map over
 * @return {Array} The result of flat-mapping `list` with `fn`
 * @example
 *
 *      const duplicate = n => [n, n];
 *      R.chain(duplicate, [1, 2, 3]); //=> [1, 1, 2, 2, 3, 3]
 *
 *      R.chain(R.append, R.head)([1, 2, 3]); //=> [1, 2, 3, 1]
 */

var chain_chain =
/*#__PURE__*/
_curry2(
/*#__PURE__*/
_dispatchable(['fantasy-land/chain', 'chain'], internal_xchain, function chain(fn, monad) {
  if (typeof monad === 'function') {
    return function (x) {
      return fn(monad(x))(x);
    };
  }

  return _makeFlat(false)(es_map(fn, monad));
}));

/* harmony default export */ var es_chain = (chain_chain);
// CONCATENATED MODULE: ./node_modules/ramda/es/clamp.js

/**
 * Restricts a number to be within a range.
 *
 * Also works for other ordered types such as Strings and Dates.
 *
 * @func
 * @memberOf R
 * @since v0.20.0
 * @category Relation
 * @sig Ord a => a -> a -> a -> a
 * @param {Number} minimum The lower limit of the clamp (inclusive)
 * @param {Number} maximum The upper limit of the clamp (inclusive)
 * @param {Number} value Value to be clamped
 * @return {Number} Returns `minimum` when `val < minimum`, `maximum` when `val > maximum`, returns `val` otherwise
 * @example
 *
 *      R.clamp(1, 10, -5) // => 1
 *      R.clamp(1, 10, 15) // => 10
 *      R.clamp(1, 10, 4)  // => 4
 */

var clamp =
/*#__PURE__*/
_curry3(function clamp(min, max, value) {
  if (min > max) {
    throw new Error('min must not be greater than max in clamp(min, max, value)');
  }

  return value < min ? min : value > max ? max : value;
});

/* harmony default export */ var es_clamp = (clamp);
// CONCATENATED MODULE: ./node_modules/ramda/es/internal/_cloneRegExp.js
function _cloneRegExp(pattern) {
  return new RegExp(pattern.source, (pattern.global ? 'g' : '') + (pattern.ignoreCase ? 'i' : '') + (pattern.multiline ? 'm' : '') + (pattern.sticky ? 'y' : '') + (pattern.unicode ? 'u' : ''));
}
// CONCATENATED MODULE: ./node_modules/ramda/es/type.js

/**
 * Gives a single-word string description of the (native) type of a value,
 * returning such answers as 'Object', 'Number', 'Array', or 'Null'. Does not
 * attempt to distinguish user Object types any further, reporting them all as
 * 'Object'.
 *
 * @func
 * @memberOf R
 * @since v0.8.0
 * @category Type
 * @sig (* -> {*}) -> String
 * @param {*} val The value to test
 * @return {String}
 * @example
 *
 *      R.type({}); //=> "Object"
 *      R.type(1); //=> "Number"
 *      R.type(false); //=> "Boolean"
 *      R.type('s'); //=> "String"
 *      R.type(null); //=> "Null"
 *      R.type([]); //=> "Array"
 *      R.type(/[A-z]/); //=> "RegExp"
 *      R.type(() => {}); //=> "Function"
 *      R.type(undefined); //=> "Undefined"
 */

var type_type =
/*#__PURE__*/
_curry1(function type(val) {
  return val === null ? 'Null' : val === undefined ? 'Undefined' : Object.prototype.toString.call(val).slice(8, -1);
});

/* harmony default export */ var es_type = (type_type);
// CONCATENATED MODULE: ./node_modules/ramda/es/internal/_clone.js


/**
 * Copies an object.
 *
 * @private
 * @param {*} value The value to be copied
 * @param {Array} refFrom Array containing the source references
 * @param {Array} refTo Array containing the copied source references
 * @param {Boolean} deep Whether or not to perform deep cloning.
 * @return {*} The copied value.
 */

function _clone(value, refFrom, refTo, deep) {
  var copy = function copy(copiedValue) {
    var len = refFrom.length;
    var idx = 0;

    while (idx < len) {
      if (value === refFrom[idx]) {
        return refTo[idx];
      }

      idx += 1;
    }

    refFrom[idx + 1] = value;
    refTo[idx + 1] = copiedValue;

    for (var key in value) {
      copiedValue[key] = deep ? _clone(value[key], refFrom, refTo, true) : value[key];
    }

    return copiedValue;
  };

  switch (es_type(value)) {
    case 'Object':
      return copy({});

    case 'Array':
      return copy([]);

    case 'Date':
      return new Date(value.valueOf());

    case 'RegExp':
      return _cloneRegExp(value);

    default:
      return value;
  }
}
// CONCATENATED MODULE: ./node_modules/ramda/es/clone.js


/**
 * Creates a deep copy of the value which may contain (nested) `Array`s and
 * `Object`s, `Number`s, `String`s, `Boolean`s and `Date`s. `Function`s are
 * assigned by reference rather than copied
 *
 * Dispatches to a `clone` method if present.
 *
 * @func
 * @memberOf R
 * @since v0.1.0
 * @category Object
 * @sig {*} -> {*}
 * @param {*} value The object or array to clone
 * @return {*} A deeply cloned copy of `val`
 * @example
 *
 *      const objects = [{}, {}, {}];
 *      const objectsClone = R.clone(objects);
 *      objects === objectsClone; //=> false
 *      objects[0] === objectsClone[0]; //=> false
 */

var clone_clone =
/*#__PURE__*/
_curry1(function clone(value) {
  return value != null && typeof value.clone === 'function' ? value.clone() : _clone(value, [], [], true);
});

/* harmony default export */ var es_clone = (clone_clone);
// CONCATENATED MODULE: ./node_modules/ramda/es/comparator.js

/**
 * Makes a comparator function out of a function that reports whether the first
 * element is less than the second.
 *
 * @func
 * @memberOf R
 * @since v0.1.0
 * @category Function
 * @sig ((a, b) -> Boolean) -> ((a, b) -> Number)
 * @param {Function} pred A predicate function of arity two which will return `true` if the first argument
 * is less than the second, `false` otherwise
 * @return {Function} A Function :: a -> b -> Int that returns `-1` if a < b, `1` if b < a, otherwise `0`
 * @example
 *
 *      const byAge = R.comparator((a, b) => a.age < b.age);
 *      const people = [
 *        { name: 'Emma', age: 70 },
 *        { name: 'Peter', age: 78 },
 *        { name: 'Mikhail', age: 62 },
 *      ];
 *      const peopleByIncreasingAge = R.sort(byAge, people);
 *        //=> [{ name: 'Mikhail', age: 62 },{ name: 'Emma', age: 70 }, { name: 'Peter', age: 78 }]
 */

var comparator =
/*#__PURE__*/
_curry1(function comparator(pred) {
  return function (a, b) {
    return pred(a, b) ? -1 : pred(b, a) ? 1 : 0;
  };
});

/* harmony default export */ var es_comparator = (comparator);
// CONCATENATED MODULE: ./node_modules/ramda/es/not.js

/**
 * A function that returns the `!` of its argument. It will return `true` when
 * passed false-y value, and `false` when passed a truth-y one.
 *
 * @func
 * @memberOf R
 * @since v0.1.0
 * @category Logic
 * @sig * -> Boolean
 * @param {*} a any value
 * @return {Boolean} the logical inverse of passed argument.
 * @see R.complement
 * @example
 *
 *      R.not(true); //=> false
 *      R.not(false); //=> true
 *      R.not(0); //=> true
 *      R.not(1); //=> false
 */

var not =
/*#__PURE__*/
_curry1(function not(a) {
  return !a;
});

/* harmony default export */ var es_not = (not);
// CONCATENATED MODULE: ./node_modules/ramda/es/complement.js


/**
 * Takes a function `f` and returns a function `g` such that if called with the same arguments
 * when `f` returns a "truthy" value, `g` returns `false` and when `f` returns a "falsy" value `g` returns `true`.
 *
 * `R.complement` may be applied to any functor
 *
 * @func
 * @memberOf R
 * @since v0.12.0
 * @category Logic
 * @sig (*... -> *) -> (*... -> Boolean)
 * @param {Function} f
 * @return {Function}
 * @see R.not
 * @example
 *
 *      const isNotNil = R.complement(R.isNil);
 *      isNil(null); //=> true
 *      isNotNil(null); //=> false
 *      isNil(7); //=> false
 *      isNotNil(7); //=> true
 */

var complement =
/*#__PURE__*/
es_lift(es_not);
/* harmony default export */ var es_complement = (complement);
// CONCATENATED MODULE: ./node_modules/ramda/es/internal/_pipe.js
function _pipe(f, g) {
  return function () {
    return g.call(this, f.apply(this, arguments));
  };
}
// CONCATENATED MODULE: ./node_modules/ramda/es/internal/_checkForMethod.js

/**
 * This checks whether a function has a [methodname] function. If it isn't an
 * array it will execute that function otherwise it will default to the ramda
 * implementation.
 *
 * @private
 * @param {Function} fn ramda implemtation
 * @param {String} methodname property to check for a custom implementation
 * @return {Object} Whatever the return value of the method is.
 */

function _checkForMethod(methodname, fn) {
  return function () {
    var length = arguments.length;

    if (length === 0) {
      return fn();
    }

    var obj = arguments[length - 1];
    return _isArray(obj) || typeof obj[methodname] !== 'function' ? fn.apply(this, arguments) : obj[methodname].apply(obj, Array.prototype.slice.call(arguments, 0, length - 1));
  };
}
// CONCATENATED MODULE: ./node_modules/ramda/es/slice.js


/**
 * Returns the elements of the given list or string (or object with a `slice`
 * method) from `fromIndex` (inclusive) to `toIndex` (exclusive).
 *
 * Dispatches to the `slice` method of the third argument, if present.
 *
 * @func
 * @memberOf R
 * @since v0.1.4
 * @category List
 * @sig Number -> Number -> [a] -> [a]
 * @sig Number -> Number -> String -> String
 * @param {Number} fromIndex The start index (inclusive).
 * @param {Number} toIndex The end index (exclusive).
 * @param {*} list
 * @return {*}
 * @example
 *
 *      R.slice(1, 3, ['a', 'b', 'c', 'd']);        //=> ['b', 'c']
 *      R.slice(1, Infinity, ['a', 'b', 'c', 'd']); //=> ['b', 'c', 'd']
 *      R.slice(0, -1, ['a', 'b', 'c', 'd']);       //=> ['a', 'b', 'c']
 *      R.slice(-3, -1, ['a', 'b', 'c', 'd']);      //=> ['b', 'c']
 *      R.slice(0, 3, 'ramda');                     //=> 'ram'
 */

var slice =
/*#__PURE__*/
_curry3(
/*#__PURE__*/
_checkForMethod('slice', function slice(fromIndex, toIndex, list) {
  return Array.prototype.slice.call(list, fromIndex, toIndex);
}));

/* harmony default export */ var es_slice = (slice);
// CONCATENATED MODULE: ./node_modules/ramda/es/tail.js



/**
 * Returns all but the first element of the given list or string (or object
 * with a `tail` method).
 *
 * Dispatches to the `slice` method of the first argument, if present.
 *
 * @func
 * @memberOf R
 * @since v0.1.0
 * @category List
 * @sig [a] -> [a]
 * @sig String -> String
 * @param {*} list
 * @return {*}
 * @see R.head, R.init, R.last
 * @example
 *
 *      R.tail([1, 2, 3]);  //=> [2, 3]
 *      R.tail([1, 2]);     //=> [2]
 *      R.tail([1]);        //=> []
 *      R.tail([]);         //=> []
 *
 *      R.tail('abc');  //=> 'bc'
 *      R.tail('ab');   //=> 'b'
 *      R.tail('a');    //=> ''
 *      R.tail('');     //=> ''
 */

var tail_tail =
/*#__PURE__*/
_curry1(
/*#__PURE__*/
_checkForMethod('tail',
/*#__PURE__*/
es_slice(1, Infinity)));

/* harmony default export */ var es_tail = (tail_tail);
// CONCATENATED MODULE: ./node_modules/ramda/es/pipe.js




/**
 * Performs left-to-right function composition. The first argument may have
 * any arity; the remaining arguments must be unary.
 *
 * In some libraries this function is named `sequence`.
 *
 * **Note:** The result of pipe is not automatically curried.
 *
 * @func
 * @memberOf R
 * @since v0.1.0
 * @category Function
 * @sig (((a, b, ..., n) -> o), (o -> p), ..., (x -> y), (y -> z)) -> ((a, b, ..., n) -> z)
 * @param {...Function} functions
 * @return {Function}
 * @see R.compose
 * @example
 *
 *      const f = R.pipe(Math.pow, R.negate, R.inc);
 *
 *      f(3, 4); // -(3^4) + 1
 * @symb R.pipe(f, g, h)(a, b) = h(g(f(a, b)))
 */

function pipe() {
  if (arguments.length === 0) {
    throw new Error('pipe requires at least one argument');
  }

  return _arity(arguments[0].length, es_reduce(_pipe, arguments[0], es_tail(arguments)));
}
// CONCATENATED MODULE: ./node_modules/ramda/es/reverse.js


/**
 * Returns a new list or string with the elements or characters in reverse
 * order.
 *
 * @func
 * @memberOf R
 * @since v0.1.0
 * @category List
 * @sig [a] -> [a]
 * @sig String -> String
 * @param {Array|String} list
 * @return {Array|String}
 * @example
 *
 *      R.reverse([1, 2, 3]);  //=> [3, 2, 1]
 *      R.reverse([1, 2]);     //=> [2, 1]
 *      R.reverse([1]);        //=> [1]
 *      R.reverse([]);         //=> []
 *
 *      R.reverse('abc');      //=> 'cba'
 *      R.reverse('ab');       //=> 'ba'
 *      R.reverse('a');        //=> 'a'
 *      R.reverse('');         //=> ''
 */

var reverse_reverse =
/*#__PURE__*/
_curry1(function reverse(list) {
  return _isString(list) ? list.split('').reverse().join('') : Array.prototype.slice.call(list, 0).reverse();
});

/* harmony default export */ var es_reverse = (reverse_reverse);
// CONCATENATED MODULE: ./node_modules/ramda/es/compose.js


/**
 * Performs right-to-left function composition. The last argument may have
 * any arity; the remaining arguments must be unary.
 *
 * **Note:** The result of compose is not automatically curried.
 *
 * @func
 * @memberOf R
 * @since v0.1.0
 * @category Function
 * @sig ((y -> z), (x -> y), ..., (o -> p), ((a, b, ..., n) -> o)) -> ((a, b, ..., n) -> z)
 * @param {...Function} ...functions The functions to compose
 * @return {Function}
 * @see R.pipe
 * @example
 *
 *      const classyGreeting = (firstName, lastName) => "The name's " + lastName + ", " + firstName + " " + lastName
 *      const yellGreeting = R.compose(R.toUpper, classyGreeting);
 *      yellGreeting('James', 'Bond'); //=> "THE NAME'S BOND, JAMES BOND"
 *
 *      R.compose(Math.abs, R.add(1), R.multiply(2))(-4) //=> 7
 *
 * @symb R.compose(f, g, h)(a, b) = f(g(h(a, b)))
 */

function compose() {
  if (arguments.length === 0) {
    throw new Error('compose requires at least one argument');
  }

  return pipe.apply(this, es_reverse(arguments));
}
// CONCATENATED MODULE: ./node_modules/ramda/es/composeK.js



/**
 * Returns the right-to-left Kleisli composition of the provided functions,
 * each of which must return a value of a type supported by [`chain`](#chain).
 *
 * `R.composeK(h, g, f)` is equivalent to `R.compose(R.chain(h), R.chain(g), f)`.
 *
 * @func
 * @memberOf R
 * @since v0.16.0
 * @category Function
 * @sig Chain m => ((y -> m z), (x -> m y), ..., (a -> m b)) -> (a -> m z)
 * @param {...Function} ...functions The functions to compose
 * @return {Function}
 * @see R.pipeK
 * @deprecated since v0.26.0
 * @example
 *
 *       //  get :: String -> Object -> Maybe *
 *       const get = R.curry((propName, obj) => Maybe(obj[propName]))
 *
 *       //  getStateCode :: Maybe String -> Maybe String
 *       const getStateCode = R.composeK(
 *         R.compose(Maybe.of, R.toUpper),
 *         get('state'),
 *         get('address'),
 *         get('user'),
 *       );
 *       getStateCode({"user":{"address":{"state":"ny"}}}); //=> Maybe.Just("NY")
 *       getStateCode({}); //=> Maybe.Nothing()
 * @symb R.composeK(f, g, h)(a) = R.chain(f, R.chain(g, h(a)))
 */

function composeK() {
  if (arguments.length === 0) {
    throw new Error('composeK requires at least one argument');
  }

  var init = Array.prototype.slice.call(arguments);
  var last = init.pop();
  return compose(compose.apply(this, es_map(es_chain, init)), last);
}
// CONCATENATED MODULE: ./node_modules/ramda/es/internal/_pipeP.js
function _pipeP(f, g) {
  return function () {
    var ctx = this;
    return f.apply(ctx, arguments).then(function (x) {
      return g.call(ctx, x);
    });
  };
}
// CONCATENATED MODULE: ./node_modules/ramda/es/pipeP.js




/**
 * Performs left-to-right composition of one or more Promise-returning
 * functions. The first argument may have any arity; the remaining arguments
 * must be unary.
 *
 * @func
 * @memberOf R
 * @since v0.10.0
 * @category Function
 * @sig ((a -> Promise b), (b -> Promise c), ..., (y -> Promise z)) -> (a -> Promise z)
 * @param {...Function} functions
 * @return {Function}
 * @see R.composeP
 * @deprecated since v0.26.0
 * @example
 *
 *      //  followersForUser :: String -> Promise [User]
 *      const followersForUser = R.pipeP(db.getUserById, db.getFollowers);
 */

function pipeP() {
  if (arguments.length === 0) {
    throw new Error('pipeP requires at least one argument');
  }

  return _arity(arguments[0].length, es_reduce(_pipeP, arguments[0], es_tail(arguments)));
}
// CONCATENATED MODULE: ./node_modules/ramda/es/composeP.js


/**
 * Performs right-to-left composition of one or more Promise-returning
 * functions. The last arguments may have any arity; the remaining
 * arguments must be unary.
 *
 * @func
 * @memberOf R
 * @since v0.10.0
 * @category Function
 * @sig ((y -> Promise z), (x -> Promise y), ..., (a -> Promise b)) -> (a -> Promise z)
 * @param {...Function} functions The functions to compose
 * @return {Function}
 * @see R.pipeP
 * @deprecated since v0.26.0
 * @example
 *
 *      const db = {
 *        users: {
 *          JOE: {
 *            name: 'Joe',
 *            followers: ['STEVE', 'SUZY']
 *          }
 *        }
 *      }
 *
 *      // We'll pretend to do a db lookup which returns a promise
 *      const lookupUser = (userId) => Promise.resolve(db.users[userId])
 *      const lookupFollowers = (user) => Promise.resolve(user.followers)
 *      lookupUser('JOE').then(lookupFollowers)
 *
 *      //  followersForUser :: String -> Promise [UserId]
 *      const followersForUser = R.composeP(lookupFollowers, lookupUser);
 *      followersForUser('JOE').then(followers => console.log('Followers:', followers))
 *      // Followers: ["STEVE","SUZY"]
 */

function composeP() {
  if (arguments.length === 0) {
    throw new Error('composeP requires at least one argument');
  }

  return pipeP.apply(this, es_reverse(arguments));
}
// CONCATENATED MODULE: ./node_modules/ramda/es/head.js

/**
 * Returns the first element of the given list or string. In some libraries
 * this function is named `first`.
 *
 * @func
 * @memberOf R
 * @since v0.1.0
 * @category List
 * @sig [a] -> a | Undefined
 * @sig String -> String
 * @param {Array|String} list
 * @return {*}
 * @see R.tail, R.init, R.last
 * @example
 *
 *      R.head(['fi', 'fo', 'fum']); //=> 'fi'
 *      R.head([]); //=> undefined
 *
 *      R.head('abc'); //=> 'a'
 *      R.head(''); //=> ''
 */

var head_head =
/*#__PURE__*/
es_nth(0);
/* harmony default export */ var es_head = (head_head);
// CONCATENATED MODULE: ./node_modules/ramda/es/internal/_identity.js
function _identity(x) {
  return x;
}
// CONCATENATED MODULE: ./node_modules/ramda/es/identity.js


/**
 * A function that does nothing but return the parameter supplied to it. Good
 * as a default or placeholder function.
 *
 * @func
 * @memberOf R
 * @since v0.1.0
 * @category Function
 * @sig a -> a
 * @param {*} x The value to return.
 * @return {*} The input value, `x`.
 * @example
 *
 *      R.identity(1); //=> 1
 *
 *      const obj = {};
 *      R.identity(obj) === obj; //=> true
 * @symb R.identity(a) = a
 */

var identity =
/*#__PURE__*/
_curry1(_identity);

/* harmony default export */ var es_identity = (identity);
// CONCATENATED MODULE: ./node_modules/ramda/es/pipeWith.js






/**
 * Performs left-to-right function composition using transforming function. The first argument may have
 * any arity; the remaining arguments must be unary.
 *
 * **Note:** The result of pipeWith is not automatically curried. Transforming function is not used on the
 * first argument.
 *
 * @func
 * @memberOf R
 * @since v0.26.0
 * @category Function
 * @sig ((* -> *), [((a, b, ..., n) -> o), (o -> p), ..., (x -> y), (y -> z)]) -> ((a, b, ..., n) -> z)
 * @param {...Function} functions
 * @return {Function}
 * @see R.composeWith, R.pipe
 * @example
 *
 *      const pipeWhileNotNil = R.pipeWith((f, res) => R.isNil(res) ? res : f(res));
 *      const f = pipeWhileNotNil([Math.pow, R.negate, R.inc])
 *
 *      f(3, 4); // -(3^4) + 1
 * @symb R.pipeWith(f)([g, h, i])(...args) = f(i, f(h, g(...args)))
 */

var pipeWith_pipeWith =
/*#__PURE__*/
_curry2(function pipeWith(xf, list) {
  if (list.length <= 0) {
    return es_identity;
  }

  var headList = es_head(list);
  var tailList = es_tail(list);
  return _arity(headList.length, function () {
    return _reduce(function (result, f) {
      return xf.call(this, f, result);
    }, headList.apply(this, arguments), tailList);
  });
});

/* harmony default export */ var es_pipeWith = (pipeWith_pipeWith);
// CONCATENATED MODULE: ./node_modules/ramda/es/composeWith.js



/**
 * Performs right-to-left function composition using transforming function. The last argument may have
 * any arity; the remaining arguments must be unary.
 *
 * **Note:** The result of compose is not automatically curried. Transforming function is not used on the
 * last argument.
 *
 * @func
 * @memberOf R
 * @since v0.26.0
 * @category Function
 * @sig ((* -> *), [(y -> z), (x -> y), ..., (o -> p), ((a, b, ..., n) -> o)]) -> ((a, b, ..., n) -> z)
 * @param {...Function} ...functions The functions to compose
 * @return {Function}
 * @see R.compose, R.pipeWith
 * @example
 *
 *      const composeWhileNotNil = R.composeWith((f, res) => R.isNil(res) ? res : f(res));
 *
 *      composeWhileNotNil([R.inc, R.prop('age')])({age: 1}) //=> 2
 *      composeWhileNotNil([R.inc, R.prop('age')])({}) //=> undefined
 *
 * @symb R.composeWith(f)([g, h, i])(...args) = f(g, f(h, i(...args)))
 */

var composeWith_composeWith =
/*#__PURE__*/
_curry2(function composeWith(xf, list) {
  return es_pipeWith.apply(this, [xf, es_reverse(list)]);
});

/* harmony default export */ var es_composeWith = (composeWith_composeWith);
// CONCATENATED MODULE: ./node_modules/ramda/es/internal/_arrayFromIterator.js
function _arrayFromIterator(iter) {
  var list = [];
  var next;

  while (!(next = iter.next()).done) {
    list.push(next.value);
  }

  return list;
}
// CONCATENATED MODULE: ./node_modules/ramda/es/internal/_includesWith.js
function _includesWith(pred, x, list) {
  var idx = 0;
  var len = list.length;

  while (idx < len) {
    if (pred(x, list[idx])) {
      return true;
    }

    idx += 1;
  }

  return false;
}
// CONCATENATED MODULE: ./node_modules/ramda/es/internal/_functionName.js
function _functionName(f) {
  // String(x => x) evaluates to "x => x", so the pattern may not match.
  var match = String(f).match(/^function (\w*)/);
  return match == null ? '' : match[1];
}
// CONCATENATED MODULE: ./node_modules/ramda/es/internal/_objectIs.js
// Based on https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
function _objectIs(a, b) {
  // SameValue algorithm
  if (a === b) {
    // Steps 1-5, 7-10
    // Steps 6.b-6.e: +0 != -0
    return a !== 0 || 1 / a === 1 / b;
  } else {
    // Step 6.a: NaN == NaN
    return a !== a && b !== b;
  }
}

/* harmony default export */ var internal_objectIs = (typeof Object.is === 'function' ? Object.is : _objectIs);
// CONCATENATED MODULE: ./node_modules/ramda/es/internal/_equals.js







/**
 * private _uniqContentEquals function.
 * That function is checking equality of 2 iterator contents with 2 assumptions
 * - iterators lengths are the same
 * - iterators values are unique
 *
 * false-positive result will be returned for comparision of, e.g.
 * - [1,2,3] and [1,2,3,4]
 * - [1,1,1] and [1,2,3]
 * */

function _uniqContentEquals(aIterator, bIterator, stackA, stackB) {
  var a = _arrayFromIterator(aIterator);

  var b = _arrayFromIterator(bIterator);

  function eq(_a, _b) {
    return _equals(_a, _b, stackA.slice(), stackB.slice());
  } // if *a* array contains any element that is not included in *b*


  return !_includesWith(function (b, aItem) {
    return !_includesWith(eq, aItem, b);
  }, b, a);
}

function _equals(a, b, stackA, stackB) {
  if (internal_objectIs(a, b)) {
    return true;
  }

  var typeA = es_type(a);

  if (typeA !== es_type(b)) {
    return false;
  }

  if (a == null || b == null) {
    return false;
  }

  if (typeof a['fantasy-land/equals'] === 'function' || typeof b['fantasy-land/equals'] === 'function') {
    return typeof a['fantasy-land/equals'] === 'function' && a['fantasy-land/equals'](b) && typeof b['fantasy-land/equals'] === 'function' && b['fantasy-land/equals'](a);
  }

  if (typeof a.equals === 'function' || typeof b.equals === 'function') {
    return typeof a.equals === 'function' && a.equals(b) && typeof b.equals === 'function' && b.equals(a);
  }

  switch (typeA) {
    case 'Arguments':
    case 'Array':
    case 'Object':
      if (typeof a.constructor === 'function' && _functionName(a.constructor) === 'Promise') {
        return a === b;
      }

      break;

    case 'Boolean':
    case 'Number':
    case 'String':
      if (!(typeof a === typeof b && internal_objectIs(a.valueOf(), b.valueOf()))) {
        return false;
      }

      break;

    case 'Date':
      if (!internal_objectIs(a.valueOf(), b.valueOf())) {
        return false;
      }

      break;

    case 'Error':
      return a.name === b.name && a.message === b.message;

    case 'RegExp':
      if (!(a.source === b.source && a.global === b.global && a.ignoreCase === b.ignoreCase && a.multiline === b.multiline && a.sticky === b.sticky && a.unicode === b.unicode)) {
        return false;
      }

      break;
  }

  var idx = stackA.length - 1;

  while (idx >= 0) {
    if (stackA[idx] === a) {
      return stackB[idx] === b;
    }

    idx -= 1;
  }

  switch (typeA) {
    case 'Map':
      if (a.size !== b.size) {
        return false;
      }

      return _uniqContentEquals(a.entries(), b.entries(), stackA.concat([a]), stackB.concat([b]));

    case 'Set':
      if (a.size !== b.size) {
        return false;
      }

      return _uniqContentEquals(a.values(), b.values(), stackA.concat([a]), stackB.concat([b]));

    case 'Arguments':
    case 'Array':
    case 'Object':
    case 'Boolean':
    case 'Number':
    case 'String':
    case 'Date':
    case 'Error':
    case 'RegExp':
    case 'Int8Array':
    case 'Uint8Array':
    case 'Uint8ClampedArray':
    case 'Int16Array':
    case 'Uint16Array':
    case 'Int32Array':
    case 'Uint32Array':
    case 'Float32Array':
    case 'Float64Array':
    case 'ArrayBuffer':
      break;

    default:
      // Values of other types are only equal if identical.
      return false;
  }

  var keysA = es_keys(a);

  if (keysA.length !== es_keys(b).length) {
    return false;
  }

  var extendedStackA = stackA.concat([a]);
  var extendedStackB = stackB.concat([b]);
  idx = keysA.length - 1;

  while (idx >= 0) {
    var key = keysA[idx];

    if (!(_has(key, b) && _equals(b[key], a[key], extendedStackA, extendedStackB))) {
      return false;
    }

    idx -= 1;
  }

  return true;
}
// CONCATENATED MODULE: ./node_modules/ramda/es/equals.js


/**
 * Returns `true` if its arguments are equivalent, `false` otherwise. Handles
 * cyclical data structures.
 *
 * Dispatches symmetrically to the `equals` methods of both arguments, if
 * present.
 *
 * @func
 * @memberOf R
 * @since v0.15.0
 * @category Relation
 * @sig a -> b -> Boolean
 * @param {*} a
 * @param {*} b
 * @return {Boolean}
 * @example
 *
 *      R.equals(1, 1); //=> true
 *      R.equals(1, '1'); //=> false
 *      R.equals([1, 2, 3], [1, 2, 3]); //=> true
 *
 *      const a = {}; a.v = a;
 *      const b = {}; b.v = b;
 *      R.equals(a, b); //=> true
 */

var equals_equals =
/*#__PURE__*/
_curry2(function equals(a, b) {
  return _equals(a, b, [], []);
});

/* harmony default export */ var es_equals = (equals_equals);
// CONCATENATED MODULE: ./node_modules/ramda/es/internal/_indexOf.js

function _indexOf(list, a, idx) {
  var inf, item; // Array.prototype.indexOf doesn't exist below IE9

  if (typeof list.indexOf === 'function') {
    switch (typeof a) {
      case 'number':
        if (a === 0) {
          // manually crawl the list to distinguish between +0 and -0
          inf = 1 / a;

          while (idx < list.length) {
            item = list[idx];

            if (item === 0 && 1 / item === inf) {
              return idx;
            }

            idx += 1;
          }

          return -1;
        } else if (a !== a) {
          // NaN
          while (idx < list.length) {
            item = list[idx];

            if (typeof item === 'number' && item !== item) {
              return idx;
            }

            idx += 1;
          }

          return -1;
        } // non-zero numbers can utilise Set


        return list.indexOf(a, idx);
      // all these types can utilise Set

      case 'string':
      case 'boolean':
      case 'function':
      case 'undefined':
        return list.indexOf(a, idx);

      case 'object':
        if (a === null) {
          // null can utilise Set
          return list.indexOf(a, idx);
        }

    }
  } // anything else not covered above, defer to R.equals


  while (idx < list.length) {
    if (es_equals(list[idx], a)) {
      return idx;
    }

    idx += 1;
  }

  return -1;
}
// CONCATENATED MODULE: ./node_modules/ramda/es/internal/_includes.js

function _includes(a, list) {
  return _indexOf(list, a, 0) >= 0;
}
// CONCATENATED MODULE: ./node_modules/ramda/es/internal/_quote.js
function _quote(s) {
  var escaped = s.replace(/\\/g, '\\\\').replace(/[\b]/g, '\\b') // \b matches word boundary; [\b] matches backspace
  .replace(/\f/g, '\\f').replace(/\n/g, '\\n').replace(/\r/g, '\\r').replace(/\t/g, '\\t').replace(/\v/g, '\\v').replace(/\0/g, '\\0');
  return '"' + escaped.replace(/"/g, '\\"') + '"';
}
// CONCATENATED MODULE: ./node_modules/ramda/es/internal/_toISOString.js
/**
 * Polyfill from <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString>.
 */
var pad = function pad(n) {
  return (n < 10 ? '0' : '') + n;
};

var _toISOString = typeof Date.prototype.toISOString === 'function' ? function _toISOString(d) {
  return d.toISOString();
} : function _toISOString(d) {
  return d.getUTCFullYear() + '-' + pad(d.getUTCMonth() + 1) + '-' + pad(d.getUTCDate()) + 'T' + pad(d.getUTCHours()) + ':' + pad(d.getUTCMinutes()) + ':' + pad(d.getUTCSeconds()) + '.' + (d.getUTCMilliseconds() / 1000).toFixed(3).slice(2, 5) + 'Z';
};

/* harmony default export */ var internal_toISOString = (_toISOString);
// CONCATENATED MODULE: ./node_modules/ramda/es/internal/_complement.js
function _complement(f) {
  return function () {
    return !f.apply(this, arguments);
  };
}
// CONCATENATED MODULE: ./node_modules/ramda/es/internal/_filter.js
function _filter(fn, list) {
  var idx = 0;
  var len = list.length;
  var result = [];

  while (idx < len) {
    if (fn(list[idx])) {
      result[result.length] = list[idx];
    }

    idx += 1;
  }

  return result;
}
// CONCATENATED MODULE: ./node_modules/ramda/es/internal/_isObject.js
function _isObject(x) {
  return Object.prototype.toString.call(x) === '[object Object]';
}
// CONCATENATED MODULE: ./node_modules/ramda/es/internal/_xfilter.js



var _xfilter_XFilter =
/*#__PURE__*/
function () {
  function XFilter(f, xf) {
    this.xf = xf;
    this.f = f;
  }

  XFilter.prototype['@@transducer/init'] = _xfBase.init;
  XFilter.prototype['@@transducer/result'] = _xfBase.result;

  XFilter.prototype['@@transducer/step'] = function (result, input) {
    return this.f(input) ? this.xf['@@transducer/step'](result, input) : result;
  };

  return XFilter;
}();

var _xfilter =
/*#__PURE__*/
_curry2(function _xfilter(f, xf) {
  return new _xfilter_XFilter(f, xf);
});

/* harmony default export */ var internal_xfilter = (_xfilter);
// CONCATENATED MODULE: ./node_modules/ramda/es/filter.js







/**
 * Takes a predicate and a `Filterable`, and returns a new filterable of the
 * same type containing the members of the given filterable which satisfy the
 * given predicate. Filterable objects include plain objects or any object
 * that has a filter method such as `Array`.
 *
 * Dispatches to the `filter` method of the second argument, if present.
 *
 * Acts as a transducer if a transformer is given in list position.
 *
 * @func
 * @memberOf R
 * @since v0.1.0
 * @category List
 * @sig Filterable f => (a -> Boolean) -> f a -> f a
 * @param {Function} pred
 * @param {Array} filterable
 * @return {Array} Filterable
 * @see R.reject, R.transduce, R.addIndex
 * @example
 *
 *      const isEven = n => n % 2 === 0;
 *
 *      R.filter(isEven, [1, 2, 3, 4]); //=> [2, 4]
 *
 *      R.filter(isEven, {a: 1, b: 2, c: 3, d: 4}); //=> {b: 2, d: 4}
 */

var filter =
/*#__PURE__*/
_curry2(
/*#__PURE__*/
_dispatchable(['filter'], internal_xfilter, function (pred, filterable) {
  return _isObject(filterable) ? _reduce(function (acc, key) {
    if (pred(filterable[key])) {
      acc[key] = filterable[key];
    }

    return acc;
  }, {}, es_keys(filterable)) : // else
  _filter(pred, filterable);
}));

/* harmony default export */ var es_filter = (filter);
// CONCATENATED MODULE: ./node_modules/ramda/es/reject.js



/**
 * The complement of [`filter`](#filter).
 *
 * Acts as a transducer if a transformer is given in list position. Filterable
 * objects include plain objects or any object that has a filter method such
 * as `Array`.
 *
 * @func
 * @memberOf R
 * @since v0.1.0
 * @category List
 * @sig Filterable f => (a -> Boolean) -> f a -> f a
 * @param {Function} pred
 * @param {Array} filterable
 * @return {Array}
 * @see R.filter, R.transduce, R.addIndex
 * @example
 *
 *      const isOdd = (n) => n % 2 === 1;
 *
 *      R.reject(isOdd, [1, 2, 3, 4]); //=> [2, 4]
 *
 *      R.reject(isOdd, {a: 1, b: 2, c: 3, d: 4}); //=> {b: 2, d: 4}
 */

var reject_reject =
/*#__PURE__*/
_curry2(function reject(pred, filterable) {
  return es_filter(_complement(pred), filterable);
});

/* harmony default export */ var es_reject = (reject_reject);
// CONCATENATED MODULE: ./node_modules/ramda/es/internal/_toString.js






function _toString(x, seen) {
  var recur = function recur(y) {
    var xs = seen.concat([x]);
    return _includes(y, xs) ? '<Circular>' : _toString(y, xs);
  }; //  mapPairs :: (Object, [String]) -> [String]


  var mapPairs = function (obj, keys) {
    return _map(function (k) {
      return _quote(k) + ': ' + recur(obj[k]);
    }, keys.slice().sort());
  };

  switch (Object.prototype.toString.call(x)) {
    case '[object Arguments]':
      return '(function() { return arguments; }(' + _map(recur, x).join(', ') + '))';

    case '[object Array]':
      return '[' + _map(recur, x).concat(mapPairs(x, es_reject(function (k) {
        return /^\d+$/.test(k);
      }, es_keys(x)))).join(', ') + ']';

    case '[object Boolean]':
      return typeof x === 'object' ? 'new Boolean(' + recur(x.valueOf()) + ')' : x.toString();

    case '[object Date]':
      return 'new Date(' + (isNaN(x.valueOf()) ? recur(NaN) : _quote(internal_toISOString(x))) + ')';

    case '[object Null]':
      return 'null';

    case '[object Number]':
      return typeof x === 'object' ? 'new Number(' + recur(x.valueOf()) + ')' : 1 / x === -Infinity ? '-0' : x.toString(10);

    case '[object String]':
      return typeof x === 'object' ? 'new String(' + recur(x.valueOf()) + ')' : _quote(x);

    case '[object Undefined]':
      return 'undefined';

    default:
      if (typeof x.toString === 'function') {
        var repr = x.toString();

        if (repr !== '[object Object]') {
          return repr;
        }
      }

      return '{' + mapPairs(x, es_keys(x)).join(', ') + '}';
  }
}
// CONCATENATED MODULE: ./node_modules/ramda/es/toString.js


/**
 * Returns the string representation of the given value. `eval`'ing the output
 * should result in a value equivalent to the input value. Many of the built-in
 * `toString` methods do not satisfy this requirement.
 *
 * If the given value is an `[object Object]` with a `toString` method other
 * than `Object.prototype.toString`, this method is invoked with no arguments
 * to produce the return value. This means user-defined constructor functions
 * can provide a suitable `toString` method. For example:
 *
 *     function Point(x, y) {
 *       this.x = x;
 *       this.y = y;
 *     }
 *
 *     Point.prototype.toString = function() {
 *       return 'new Point(' + this.x + ', ' + this.y + ')';
 *     };
 *
 *     R.toString(new Point(1, 2)); //=> 'new Point(1, 2)'
 *
 * @func
 * @memberOf R
 * @since v0.14.0
 * @category String
 * @sig * -> String
 * @param {*} val
 * @return {String}
 * @example
 *
 *      R.toString(42); //=> '42'
 *      R.toString('abc'); //=> '"abc"'
 *      R.toString([1, 2, 3]); //=> '[1, 2, 3]'
 *      R.toString({foo: 1, bar: 2, baz: 3}); //=> '{"bar": 2, "baz": 3, "foo": 1}'
 *      R.toString(new Date('2001-02-03T04:05:06Z')); //=> 'new Date("2001-02-03T04:05:06.000Z")'
 */

var toString_toString =
/*#__PURE__*/
_curry1(function toString(val) {
  return _toString(val, []);
});

/* harmony default export */ var es_toString = (toString_toString);
// CONCATENATED MODULE: ./node_modules/ramda/es/concat.js





/**
 * Returns the result of concatenating the given lists or strings.
 *
 * Note: `R.concat` expects both arguments to be of the same type,
 * unlike the native `Array.prototype.concat` method. It will throw
 * an error if you `concat` an Array with a non-Array value.
 *
 * Dispatches to the `concat` method of the first argument, if present.
 * Can also concatenate two members of a [fantasy-land
 * compatible semigroup](https://github.com/fantasyland/fantasy-land#semigroup).
 *
 * @func
 * @memberOf R
 * @since v0.1.0
 * @category List
 * @sig [a] -> [a] -> [a]
 * @sig String -> String -> String
 * @param {Array|String} firstList The first list
 * @param {Array|String} secondList The second list
 * @return {Array|String} A list consisting of the elements of `firstList` followed by the elements of
 * `secondList`.
 *
 * @example
 *
 *      R.concat('ABC', 'DEF'); // 'ABCDEF'
 *      R.concat([4, 5, 6], [1, 2, 3]); //=> [4, 5, 6, 1, 2, 3]
 *      R.concat([], []); //=> []
 */

var concat_concat =
/*#__PURE__*/
_curry2(function concat(a, b) {
  if (_isArray(a)) {
    if (_isArray(b)) {
      return a.concat(b);
    }

    throw new TypeError(es_toString(b) + ' is not an array');
  }

  if (_isString(a)) {
    if (_isString(b)) {
      return a + b;
    }

    throw new TypeError(es_toString(b) + ' is not a string');
  }

  if (a != null && _isFunction(a['fantasy-land/concat'])) {
    return a['fantasy-land/concat'](b);
  }

  if (a != null && _isFunction(a.concat)) {
    return a.concat(b);
  }

  throw new TypeError(es_toString(a) + ' does not have a method named "concat" or "fantasy-land/concat"');
});

/* harmony default export */ var es_concat = (concat_concat);
// CONCATENATED MODULE: ./node_modules/ramda/es/cond.js





/**
 * Returns a function, `fn`, which encapsulates `if/else, if/else, ...` logic.
 * `R.cond` takes a list of [predicate, transformer] pairs. All of the arguments
 * to `fn` are applied to each of the predicates in turn until one returns a
 * "truthy" value, at which point `fn` returns the result of applying its
 * arguments to the corresponding transformer. If none of the predicates
 * matches, `fn` returns undefined.
 *
 * @func
 * @memberOf R
 * @since v0.6.0
 * @category Logic
 * @sig [[(*... -> Boolean),(*... -> *)]] -> (*... -> *)
 * @param {Array} pairs A list of [predicate, transformer]
 * @return {Function}
 * @see R.ifElse, R.unless, R.when
 * @example
 *
 *      const fn = R.cond([
 *        [R.equals(0),   R.always('water freezes at 0°C')],
 *        [R.equals(100), R.always('water boils at 100°C')],
 *        [R.T,           temp => 'nothing special happens at ' + temp + '°C']
 *      ]);
 *      fn(0); //=> 'water freezes at 0°C'
 *      fn(50); //=> 'nothing special happens at 50°C'
 *      fn(100); //=> 'water boils at 100°C'
 */

var cond_cond =
/*#__PURE__*/
_curry1(function cond(pairs) {
  var arity = es_reduce(es_max, 0, es_map(function (pair) {
    return pair[0].length;
  }, pairs));
  return _arity(arity, function () {
    var idx = 0;

    while (idx < pairs.length) {
      if (pairs[idx][0].apply(this, arguments)) {
        return pairs[idx][1].apply(this, arguments);
      }

      idx += 1;
    }
  });
});

/* harmony default export */ var es_cond = (cond_cond);
// CONCATENATED MODULE: ./node_modules/ramda/es/constructN.js



/**
 * Wraps a constructor function inside a curried function that can be called
 * with the same arguments and returns the same type. The arity of the function
 * returned is specified to allow using variadic constructor functions.
 *
 * @func
 * @memberOf R
 * @since v0.4.0
 * @category Function
 * @sig Number -> (* -> {*}) -> (* -> {*})
 * @param {Number} n The arity of the constructor function.
 * @param {Function} Fn The constructor function to wrap.
 * @return {Function} A wrapped, curried constructor function.
 * @example
 *
 *      // Variadic Constructor function
 *      function Salad() {
 *        this.ingredients = arguments;
 *      }
 *
 *      Salad.prototype.recipe = function() {
 *        const instructions = R.map(ingredient => 'Add a dollop of ' + ingredient, this.ingredients);
 *        return R.join('\n', instructions);
 *      };
 *
 *      const ThreeLayerSalad = R.constructN(3, Salad);
 *
 *      // Notice we no longer need the 'new' keyword, and the constructor is curried for 3 arguments.
 *      const salad = ThreeLayerSalad('Mayonnaise')('Potato Chips')('Ketchup');
 *
 *      console.log(salad.recipe());
 *      // Add a dollop of Mayonnaise
 *      // Add a dollop of Potato Chips
 *      // Add a dollop of Ketchup
 */

var constructN_constructN =
/*#__PURE__*/
_curry2(function constructN(n, Fn) {
  if (n > 10) {
    throw new Error('Constructor with greater than ten arguments');
  }

  if (n === 0) {
    return function () {
      return new Fn();
    };
  }

  return es_curry(es_nAry(n, function ($0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
    switch (arguments.length) {
      case 1:
        return new Fn($0);

      case 2:
        return new Fn($0, $1);

      case 3:
        return new Fn($0, $1, $2);

      case 4:
        return new Fn($0, $1, $2, $3);

      case 5:
        return new Fn($0, $1, $2, $3, $4);

      case 6:
        return new Fn($0, $1, $2, $3, $4, $5);

      case 7:
        return new Fn($0, $1, $2, $3, $4, $5, $6);

      case 8:
        return new Fn($0, $1, $2, $3, $4, $5, $6, $7);

      case 9:
        return new Fn($0, $1, $2, $3, $4, $5, $6, $7, $8);

      case 10:
        return new Fn($0, $1, $2, $3, $4, $5, $6, $7, $8, $9);
    }
  }));
});

/* harmony default export */ var es_constructN = (constructN_constructN);
// CONCATENATED MODULE: ./node_modules/ramda/es/construct.js


/**
 * Wraps a constructor function inside a curried function that can be called
 * with the same arguments and returns the same type.
 *
 * @func
 * @memberOf R
 * @since v0.1.0
 * @category Function
 * @sig (* -> {*}) -> (* -> {*})
 * @param {Function} fn The constructor function to wrap.
 * @return {Function} A wrapped, curried constructor function.
 * @see R.invoker
 * @example
 *
 *      // Constructor function
 *      function Animal(kind) {
 *        this.kind = kind;
 *      };
 *      Animal.prototype.sighting = function() {
 *        return "It's a " + this.kind + "!";
 *      }
 *
 *      const AnimalConstructor = R.construct(Animal)
 *
 *      // Notice we no longer need the 'new' keyword:
 *      AnimalConstructor('Pig'); //=> {"kind": "Pig", "sighting": function (){...}};
 *
 *      const animalTypes = ["Lion", "Tiger", "Bear"];
 *      const animalSighting = R.invoker(0, 'sighting');
 *      const sightNewAnimal = R.compose(animalSighting, AnimalConstructor);
 *      R.map(sightNewAnimal, animalTypes); //=> ["It's a Lion!", "It's a Tiger!", "It's a Bear!"]
 */

var construct_construct =
/*#__PURE__*/
_curry1(function construct(Fn) {
  return es_constructN(Fn.length, Fn);
});

/* harmony default export */ var es_construct = (construct_construct);
// CONCATENATED MODULE: ./node_modules/ramda/es/contains.js


/**
 * Returns `true` if the specified value is equal, in [`R.equals`](#equals)
 * terms, to at least one element of the given list; `false` otherwise.
 * Works also with strings.
 *
 * @func
 * @memberOf R
 * @since v0.1.0
 * @category List
 * @sig a -> [a] -> Boolean
 * @param {Object} a The item to compare against.
 * @param {Array} list The array to consider.
 * @return {Boolean} `true` if an equivalent item is in the list, `false` otherwise.
 * @see R.includes
 * @deprecated since v0.26.0
 * @example
 *
 *      R.contains(3, [1, 2, 3]); //=> true
 *      R.contains(4, [1, 2, 3]); //=> false
 *      R.contains({ name: 'Fred' }, [{ name: 'Fred' }]); //=> true
 *      R.contains([42], [[42]]); //=> true
 *      R.contains('ba', 'banana'); //=>true
 */

var contains_contains =
/*#__PURE__*/
_curry2(_includes);

/* harmony default export */ var es_contains = (contains_contains);
// CONCATENATED MODULE: ./node_modules/ramda/es/converge.js






/**
 * Accepts a converging function and a list of branching functions and returns
 * a new function. The arity of the new function is the same as the arity of
 * the longest branching function. When invoked, this new function is applied
 * to some arguments, and each branching function is applied to those same
 * arguments. The results of each branching function are passed as arguments
 * to the converging function to produce the return value.
 *
 * @func
 * @memberOf R
 * @since v0.4.2
 * @category Function
 * @sig ((x1, x2, ...) -> z) -> [((a, b, ...) -> x1), ((a, b, ...) -> x2), ...] -> (a -> b -> ... -> z)
 * @param {Function} after A function. `after` will be invoked with the return values of
 *        `fn1` and `fn2` as its arguments.
 * @param {Array} functions A list of functions.
 * @return {Function} A new function.
 * @see R.useWith
 * @example
 *
 *      const average = R.converge(R.divide, [R.sum, R.length])
 *      average([1, 2, 3, 4, 5, 6, 7]) //=> 4
 *
 *      const strangeConcat = R.converge(R.concat, [R.toUpper, R.toLower])
 *      strangeConcat("Yodel") //=> "YODELyodel"
 *
 * @symb R.converge(f, [g, h])(a, b) = f(g(a, b), h(a, b))
 */

var converge_converge =
/*#__PURE__*/
_curry2(function converge(after, fns) {
  return es_curryN(es_reduce(es_max, 0, es_pluck('length', fns)), function () {
    var args = arguments;
    var context = this;
    return after.apply(context, _map(function (fn) {
      return fn.apply(context, args);
    }, fns));
  });
});

/* harmony default export */ var es_converge = (converge_converge);
// CONCATENATED MODULE: ./node_modules/ramda/es/internal/_xreduceBy.js




var _xreduceBy_XReduceBy =
/*#__PURE__*/
function () {
  function XReduceBy(valueFn, valueAcc, keyFn, xf) {
    this.valueFn = valueFn;
    this.valueAcc = valueAcc;
    this.keyFn = keyFn;
    this.xf = xf;
    this.inputs = {};
  }

  XReduceBy.prototype['@@transducer/init'] = _xfBase.init;

  XReduceBy.prototype['@@transducer/result'] = function (result) {
    var key;

    for (key in this.inputs) {
      if (_has(key, this.inputs)) {
        result = this.xf['@@transducer/step'](result, this.inputs[key]);

        if (result['@@transducer/reduced']) {
          result = result['@@transducer/value'];
          break;
        }
      }
    }

    this.inputs = null;
    return this.xf['@@transducer/result'](result);
  };

  XReduceBy.prototype['@@transducer/step'] = function (result, input) {
    var key = this.keyFn(input);
    this.inputs[key] = this.inputs[key] || [key, this.valueAcc];
    this.inputs[key][1] = this.valueFn(this.inputs[key][1], input);
    return result;
  };

  return XReduceBy;
}();

var _xreduceBy =
/*#__PURE__*/
_curryN(4, [], function _xreduceBy(valueFn, valueAcc, keyFn, xf) {
  return new _xreduceBy_XReduceBy(valueFn, valueAcc, keyFn, xf);
});

/* harmony default export */ var internal_xreduceBy = (_xreduceBy);
// CONCATENATED MODULE: ./node_modules/ramda/es/reduceBy.js






/**
 * Groups the elements of the list according to the result of calling
 * the String-returning function `keyFn` on each element and reduces the elements
 * of each group to a single value via the reducer function `valueFn`.
 *
 * This function is basically a more general [`groupBy`](#groupBy) function.
 *
 * Acts as a transducer if a transformer is given in list position.
 *
 * @func
 * @memberOf R
 * @since v0.20.0
 * @category List
 * @sig ((a, b) -> a) -> a -> (b -> String) -> [b] -> {String: a}
 * @param {Function} valueFn The function that reduces the elements of each group to a single
 *        value. Receives two values, accumulator for a particular group and the current element.
 * @param {*} acc The (initial) accumulator value for each group.
 * @param {Function} keyFn The function that maps the list's element into a key.
 * @param {Array} list The array to group.
 * @return {Object} An object with the output of `keyFn` for keys, mapped to the output of
 *         `valueFn` for elements which produced that key when passed to `keyFn`.
 * @see R.groupBy, R.reduce
 * @example
 *
 *      const groupNames = (acc, {name}) => acc.concat(name)
 *      const toGrade = ({score}) =>
 *        score < 65 ? 'F' :
 *        score < 70 ? 'D' :
 *        score < 80 ? 'C' :
 *        score < 90 ? 'B' : 'A'
 *
 *      var students = [
 *        {name: 'Abby', score: 83},
 *        {name: 'Bart', score: 62},
 *        {name: 'Curt', score: 88},
 *        {name: 'Dora', score: 92},
 *      ]
 *
 *      reduceBy(groupNames, [], toGrade, students)
 *      //=> {"A": ["Dora"], "B": ["Abby", "Curt"], "F": ["Bart"]}
 */

var reduceBy_reduceBy =
/*#__PURE__*/
_curryN(4, [],
/*#__PURE__*/
_dispatchable([], internal_xreduceBy, function reduceBy(valueFn, valueAcc, keyFn, list) {
  return _reduce(function (acc, elt) {
    var key = keyFn(elt);
    acc[key] = valueFn(_has(key, acc) ? acc[key] : _clone(valueAcc, [], [], false), elt);
    return acc;
  }, {}, list);
}));

/* harmony default export */ var es_reduceBy = (reduceBy_reduceBy);
// CONCATENATED MODULE: ./node_modules/ramda/es/countBy.js

/**
 * Counts the elements of a list according to how many match each value of a
 * key generated by the supplied function. Returns an object mapping the keys
 * produced by `fn` to the number of occurrences in the list. Note that all
 * keys are coerced to strings because of how JavaScript objects work.
 *
 * Acts as a transducer if a transformer is given in list position.
 *
 * @func
 * @memberOf R
 * @since v0.1.0
 * @category Relation
 * @sig (a -> String) -> [a] -> {*}
 * @param {Function} fn The function used to map values to keys.
 * @param {Array} list The list to count elements from.
 * @return {Object} An object mapping keys to number of occurrences in the list.
 * @example
 *
 *      const numbers = [1.0, 1.1, 1.2, 2.0, 3.0, 2.2];
 *      R.countBy(Math.floor)(numbers);    //=> {'1': 3, '2': 2, '3': 1}
 *
 *      const letters = ['a', 'b', 'A', 'a', 'B', 'c'];
 *      R.countBy(R.toLower)(letters);   //=> {'a': 3, 'b': 2, 'c': 1}
 */

var countBy =
/*#__PURE__*/
es_reduceBy(function (acc, elem) {
  return acc + 1;
}, 0);
/* harmony default export */ var es_countBy = (countBy);
// CONCATENATED MODULE: ./node_modules/ramda/es/dec.js

/**
 * Decrements its argument.
 *
 * @func
 * @memberOf R
 * @since v0.9.0
 * @category Math
 * @sig Number -> Number
 * @param {Number} n
 * @return {Number} n - 1
 * @see R.inc
 * @example
 *
 *      R.dec(42); //=> 41
 */

var dec =
/*#__PURE__*/
es_add(-1);
/* harmony default export */ var es_dec = (dec);
// CONCATENATED MODULE: ./node_modules/ramda/es/defaultTo.js

/**
 * Returns the second argument if it is not `null`, `undefined` or `NaN`;
 * otherwise the first argument is returned.
 *
 * @func
 * @memberOf R
 * @since v0.10.0
 * @category Logic
 * @sig a -> b -> a | b
 * @param {a} default The default value.
 * @param {b} val `val` will be returned instead of `default` unless `val` is `null`, `undefined` or `NaN`.
 * @return {*} The second value if it is not `null`, `undefined` or `NaN`, otherwise the default value
 * @example
 *
 *      const defaultTo42 = R.defaultTo(42);
 *
 *      defaultTo42(null);  //=> 42
 *      defaultTo42(undefined);  //=> 42
 *      defaultTo42(false);  //=> false
 *      defaultTo42('Ramda');  //=> 'Ramda'
 *      // parseInt('string') results in NaN
 *      defaultTo42(parseInt('string')); //=> 42
 */

var defaultTo =
/*#__PURE__*/
_curry2(function defaultTo(d, v) {
  return v == null || v !== v ? d : v;
});

/* harmony default export */ var es_defaultTo = (defaultTo);
// CONCATENATED MODULE: ./node_modules/ramda/es/descend.js

/**
 * Makes a descending comparator function out of a function that returns a value
 * that can be compared with `<` and `>`.
 *
 * @func
 * @memberOf R
 * @since v0.23.0
 * @category Function
 * @sig Ord b => (a -> b) -> a -> a -> Number
 * @param {Function} fn A function of arity one that returns a value that can be compared
 * @param {*} a The first item to be compared.
 * @param {*} b The second item to be compared.
 * @return {Number} `-1` if fn(a) > fn(b), `1` if fn(b) > fn(a), otherwise `0`
 * @see R.ascend
 * @example
 *
 *      const byAge = R.descend(R.prop('age'));
 *      const people = [
 *        { name: 'Emma', age: 70 },
 *        { name: 'Peter', age: 78 },
 *        { name: 'Mikhail', age: 62 },
 *      ];
 *      const peopleByOldestFirst = R.sort(byAge, people);
 *        //=> [{ name: 'Peter', age: 78 }, { name: 'Emma', age: 70 }, { name: 'Mikhail', age: 62 }]
 */

var descend =
/*#__PURE__*/
_curry3(function descend(fn, a, b) {
  var aa = fn(a);
  var bb = fn(b);
  return aa > bb ? -1 : aa < bb ? 1 : 0;
});

/* harmony default export */ var es_descend = (descend);
// CONCATENATED MODULE: ./node_modules/ramda/es/internal/_Set.js


var _Set =
/*#__PURE__*/
function () {
  function _Set() {
    /* globals Set */
    this._nativeSet = typeof Set === 'function' ? new Set() : null;
    this._items = {};
  }

  // until we figure out why jsdoc chokes on this
  // @param item The item to add to the Set
  // @returns {boolean} true if the item did not exist prior, otherwise false
  //
  _Set.prototype.add = function (item) {
    return !hasOrAdd(item, true, this);
  }; //
  // @param item The item to check for existence in the Set
  // @returns {boolean} true if the item exists in the Set, otherwise false
  //


  _Set.prototype.has = function (item) {
    return hasOrAdd(item, false, this);
  }; //
  // Combines the logic for checking whether an item is a member of the set and
  // for adding a new item to the set.
  //
  // @param item       The item to check or add to the Set instance.
  // @param shouldAdd  If true, the item will be added to the set if it doesn't
  //                   already exist.
  // @param set        The set instance to check or add to.
  // @return {boolean} true if the item already existed, otherwise false.
  //


  return _Set;
}();

function hasOrAdd(item, shouldAdd, set) {
  var type = typeof item;
  var prevSize, newSize;

  switch (type) {
    case 'string':
    case 'number':
      // distinguish between +0 and -0
      if (item === 0 && 1 / item === -Infinity) {
        if (set._items['-0']) {
          return true;
        } else {
          if (shouldAdd) {
            set._items['-0'] = true;
          }

          return false;
        }
      } // these types can all utilise the native Set


      if (set._nativeSet !== null) {
        if (shouldAdd) {
          prevSize = set._nativeSet.size;

          set._nativeSet.add(item);

          newSize = set._nativeSet.size;
          return newSize === prevSize;
        } else {
          return set._nativeSet.has(item);
        }
      } else {
        if (!(type in set._items)) {
          if (shouldAdd) {
            set._items[type] = {};
            set._items[type][item] = true;
          }

          return false;
        } else if (item in set._items[type]) {
          return true;
        } else {
          if (shouldAdd) {
            set._items[type][item] = true;
          }

          return false;
        }
      }

    case 'boolean':
      // set._items['boolean'] holds a two element array
      // representing [ falseExists, trueExists ]
      if (type in set._items) {
        var bIdx = item ? 1 : 0;

        if (set._items[type][bIdx]) {
          return true;
        } else {
          if (shouldAdd) {
            set._items[type][bIdx] = true;
          }

          return false;
        }
      } else {
        if (shouldAdd) {
          set._items[type] = item ? [false, true] : [true, false];
        }

        return false;
      }

    case 'function':
      // compare functions for reference equality
      if (set._nativeSet !== null) {
        if (shouldAdd) {
          prevSize = set._nativeSet.size;

          set._nativeSet.add(item);

          newSize = set._nativeSet.size;
          return newSize === prevSize;
        } else {
          return set._nativeSet.has(item);
        }
      } else {
        if (!(type in set._items)) {
          if (shouldAdd) {
            set._items[type] = [item];
          }

          return false;
        }

        if (!_includes(item, set._items[type])) {
          if (shouldAdd) {
            set._items[type].push(item);
          }

          return false;
        }

        return true;
      }

    case 'undefined':
      if (set._items[type]) {
        return true;
      } else {
        if (shouldAdd) {
          set._items[type] = true;
        }

        return false;
      }

    case 'object':
      if (item === null) {
        if (!set._items['null']) {
          if (shouldAdd) {
            set._items['null'] = true;
          }

          return false;
        }

        return true;
      }

    /* falls through */

    default:
      // reduce the search size of heterogeneous sets by creating buckets
      // for each type.
      type = Object.prototype.toString.call(item);

      if (!(type in set._items)) {
        if (shouldAdd) {
          set._items[type] = [item];
        }

        return false;
      } // scan through all previously applied items


      if (!_includes(item, set._items[type])) {
        if (shouldAdd) {
          set._items[type].push(item);
        }

        return false;
      }

      return true;
  }
} // A simple Set type that honours R.equals semantics


/* harmony default export */ var internal_Set = (_Set);
// CONCATENATED MODULE: ./node_modules/ramda/es/difference.js


/**
 * Finds the set (i.e. no duplicates) of all elements in the first list not
 * contained in the second list. Objects and Arrays are compared in terms of
 * value equality, not reference equality.
 *
 * @func
 * @memberOf R
 * @since v0.1.0
 * @category Relation
 * @sig [*] -> [*] -> [*]
 * @param {Array} list1 The first list.
 * @param {Array} list2 The second list.
 * @return {Array} The elements in `list1` that are not in `list2`.
 * @see R.differenceWith, R.symmetricDifference, R.symmetricDifferenceWith, R.without
 * @example
 *
 *      R.difference([1,2,3,4], [7,6,5,4,3]); //=> [1,2]
 *      R.difference([7,6,5,4,3], [1,2,3,4]); //=> [7,6,5]
 *      R.difference([{a: 1}, {b: 2}], [{a: 1}, {c: 3}]) //=> [{b: 2}]
 */

var difference_difference =
/*#__PURE__*/
_curry2(function difference(first, second) {
  var out = [];
  var idx = 0;
  var firstLen = first.length;
  var secondLen = second.length;
  var toFilterOut = new internal_Set();

  for (var i = 0; i < secondLen; i += 1) {
    toFilterOut.add(second[i]);
  }

  while (idx < firstLen) {
    if (toFilterOut.add(first[idx])) {
      out[out.length] = first[idx];
    }

    idx += 1;
  }

  return out;
});

/* harmony default export */ var es_difference = (difference_difference);
// CONCATENATED MODULE: ./node_modules/ramda/es/differenceWith.js


/**
 * Finds the set (i.e. no duplicates) of all elements in the first list not
 * contained in the second list. Duplication is determined according to the
 * value returned by applying the supplied predicate to two list elements.
 *
 * @func
 * @memberOf R
 * @since v0.1.0
 * @category Relation
 * @sig ((a, a) -> Boolean) -> [a] -> [a] -> [a]
 * @param {Function} pred A predicate used to test whether two items are equal.
 * @param {Array} list1 The first list.
 * @param {Array} list2 The second list.
 * @return {Array} The elements in `list1` that are not in `list2`.
 * @see R.difference, R.symmetricDifference, R.symmetricDifferenceWith
 * @example
 *
 *      const cmp = (x, y) => x.a === y.a;
 *      const l1 = [{a: 1}, {a: 2}, {a: 3}];
 *      const l2 = [{a: 3}, {a: 4}];
 *      R.differenceWith(cmp, l1, l2); //=> [{a: 1}, {a: 2}]
 */

var differenceWith_differenceWith =
/*#__PURE__*/
_curry3(function differenceWith(pred, first, second) {
  var out = [];
  var idx = 0;
  var firstLen = first.length;

  while (idx < firstLen) {
    if (!_includesWith(pred, first[idx], second) && !_includesWith(pred, first[idx], out)) {
      out.push(first[idx]);
    }

    idx += 1;
  }

  return out;
});

/* harmony default export */ var es_differenceWith = (differenceWith_differenceWith);
// CONCATENATED MODULE: ./node_modules/ramda/es/dissoc.js

/**
 * Returns a new object that does not contain a `prop` property.
 *
 * @func
 * @memberOf R
 * @since v0.10.0
 * @category Object
 * @sig String -> {k: v} -> {k: v}
 * @param {String} prop The name of the property to dissociate
 * @param {Object} obj The object to clone
 * @return {Object} A new object equivalent to the original but without the specified property
 * @see R.assoc, R.omit
 * @example
 *
 *      R.dissoc('b', {a: 1, b: 2, c: 3}); //=> {a: 1, c: 3}
 */

var dissoc =
/*#__PURE__*/
_curry2(function dissoc(prop, obj) {
  var result = {};

  for (var p in obj) {
    result[p] = obj[p];
  }

  delete result[prop];
  return result;
});

/* harmony default export */ var es_dissoc = (dissoc);
// CONCATENATED MODULE: ./node_modules/ramda/es/remove.js

/**
 * Removes the sub-list of `list` starting at index `start` and containing
 * `count` elements. _Note that this is not destructive_: it returns a copy of
 * the list with the changes.
 * <small>No lists have been harmed in the application of this function.</small>
 *
 * @func
 * @memberOf R
 * @since v0.2.2
 * @category List
 * @sig Number -> Number -> [a] -> [a]
 * @param {Number} start The position to start removing elements
 * @param {Number} count The number of elements to remove
 * @param {Array} list The list to remove from
 * @return {Array} A new Array with `count` elements from `start` removed.
 * @see R.without
 * @example
 *
 *      R.remove(2, 3, [1,2,3,4,5,6,7,8]); //=> [1,2,6,7,8]
 */

var remove =
/*#__PURE__*/
_curry3(function remove(start, count, list) {
  var result = Array.prototype.slice.call(list, 0);
  result.splice(start, count);
  return result;
});

/* harmony default export */ var es_remove = (remove);
// CONCATENATED MODULE: ./node_modules/ramda/es/update.js



/**
 * Returns a new copy of the array with the element at the provided index
 * replaced with the given value.
 *
 * @func
 * @memberOf R
 * @since v0.14.0
 * @category List
 * @sig Number -> a -> [a] -> [a]
 * @param {Number} idx The index to update.
 * @param {*} x The value to exist at the given index of the returned array.
 * @param {Array|Arguments} list The source array-like object to be updated.
 * @return {Array} A copy of `list` with the value at index `idx` replaced with `x`.
 * @see R.adjust
 * @example
 *
 *      R.update(1, '_', ['a', 'b', 'c']);      //=> ['a', '_', 'c']
 *      R.update(-1, '_', ['a', 'b', 'c']);     //=> ['a', 'b', '_']
 * @symb R.update(-1, a, [b, c]) = [b, a]
 * @symb R.update(0, a, [b, c]) = [a, c]
 * @symb R.update(1, a, [b, c]) = [b, a]
 */

var update_update =
/*#__PURE__*/
_curry3(function update(idx, x, list) {
  return es_adjust(idx, es_always(x), list);
});

/* harmony default export */ var es_update = (update_update);
// CONCATENATED MODULE: ./node_modules/ramda/es/dissocPath.js







/**
 * Makes a shallow clone of an object, omitting the property at the given path.
 * Note that this copies and flattens prototype properties onto the new object
 * as well. All non-primitive properties are copied by reference.
 *
 * @func
 * @memberOf R
 * @since v0.11.0
 * @category Object
 * @typedefn Idx = String | Int
 * @sig [Idx] -> {k: v} -> {k: v}
 * @param {Array} path The path to the value to omit
 * @param {Object} obj The object to clone
 * @return {Object} A new object without the property at path
 * @see R.assocPath
 * @example
 *
 *      R.dissocPath(['a', 'b', 'c'], {a: {b: {c: 42}}}); //=> {a: {b: {}}}
 */

var dissocPath_dissocPath =
/*#__PURE__*/
_curry2(function dissocPath(path, obj) {
  switch (path.length) {
    case 0:
      return obj;

    case 1:
      return _isInteger(path[0]) && _isArray(obj) ? es_remove(path[0], 1, obj) : es_dissoc(path[0], obj);

    default:
      var head = path[0];
      var tail = Array.prototype.slice.call(path, 1);

      if (obj[head] == null) {
        return obj;
      } else if (_isInteger(head) && _isArray(obj)) {
        return es_update(head, dissocPath(tail, obj[head]), obj);
      } else {
        return es_assoc(head, dissocPath(tail, obj[head]), obj);
      }

  }
});

/* harmony default export */ var es_dissocPath = (dissocPath_dissocPath);
// CONCATENATED MODULE: ./node_modules/ramda/es/divide.js

/**
 * Divides two numbers. Equivalent to `a / b`.
 *
 * @func
 * @memberOf R
 * @since v0.1.0
 * @category Math
 * @sig Number -> Number -> Number
 * @param {Number} a The first value.
 * @param {Number} b The second value.
 * @return {Number} The result of `a / b`.
 * @see R.multiply
 * @example
 *
 *      R.divide(71, 100); //=> 0.71
 *
 *      const half = R.divide(R.__, 2);
 *      half(42); //=> 21
 *
 *      const reciprocal = R.divide(1);
 *      reciprocal(4);   //=> 0.25
 */

var divide =
/*#__PURE__*/
_curry2(function divide(a, b) {
  return a / b;
});

/* harmony default export */ var es_divide = (divide);
// CONCATENATED MODULE: ./node_modules/ramda/es/internal/_xdrop.js



var _xdrop_XDrop =
/*#__PURE__*/
function () {
  function XDrop(n, xf) {
    this.xf = xf;
    this.n = n;
  }

  XDrop.prototype['@@transducer/init'] = _xfBase.init;
  XDrop.prototype['@@transducer/result'] = _xfBase.result;

  XDrop.prototype['@@transducer/step'] = function (result, input) {
    if (this.n > 0) {
      this.n -= 1;
      return result;
    }

    return this.xf['@@transducer/step'](result, input);
  };

  return XDrop;
}();

var _xdrop =
/*#__PURE__*/
_curry2(function _xdrop(n, xf) {
  return new _xdrop_XDrop(n, xf);
});

/* harmony default export */ var internal_xdrop = (_xdrop);
// CONCATENATED MODULE: ./node_modules/ramda/es/drop.js




/**
 * Returns all but the first `n` elements of the given list, string, or
 * transducer/transformer (or object with a `drop` method).
 *
 * Dispatches to the `drop` method of the second argument, if present.
 *
 * @func
 * @memberOf R
 * @since v0.1.0
 * @category List
 * @sig Number -> [a] -> [a]
 * @sig Number -> String -> String
 * @param {Number} n
 * @param {*} list
 * @return {*} A copy of list without the first `n` elements
 * @see R.take, R.transduce, R.dropLast, R.dropWhile
 * @example
 *
 *      R.drop(1, ['foo', 'bar', 'baz']); //=> ['bar', 'baz']
 *      R.drop(2, ['foo', 'bar', 'baz']); //=> ['baz']
 *      R.drop(3, ['foo', 'bar', 'baz']); //=> []
 *      R.drop(4, ['foo', 'bar', 'baz']); //=> []
 *      R.drop(3, 'ramda');               //=> 'da'
 */

var drop_drop =
/*#__PURE__*/
_curry2(
/*#__PURE__*/
_dispatchable(['drop'], internal_xdrop, function drop(n, xs) {
  return es_slice(Math.max(0, n), Infinity, xs);
}));

/* harmony default export */ var es_drop = (drop_drop);
// CONCATENATED MODULE: ./node_modules/ramda/es/internal/_xtake.js




var _xtake_XTake =
/*#__PURE__*/
function () {
  function XTake(n, xf) {
    this.xf = xf;
    this.n = n;
    this.i = 0;
  }

  XTake.prototype['@@transducer/init'] = _xfBase.init;
  XTake.prototype['@@transducer/result'] = _xfBase.result;

  XTake.prototype['@@transducer/step'] = function (result, input) {
    this.i += 1;
    var ret = this.n === 0 ? result : this.xf['@@transducer/step'](result, input);
    return this.n >= 0 && this.i >= this.n ? _reduced(ret) : ret;
  };

  return XTake;
}();

var _xtake =
/*#__PURE__*/
_curry2(function _xtake(n, xf) {
  return new _xtake_XTake(n, xf);
});

/* harmony default export */ var internal_xtake = (_xtake);
// CONCATENATED MODULE: ./node_modules/ramda/es/take.js




/**
 * Returns the first `n` elements of the given list, string, or
 * transducer/transformer (or object with a `take` method).
 *
 * Dispatches to the `take` method of the second argument, if present.
 *
 * @func
 * @memberOf R
 * @since v0.1.0
 * @category List
 * @sig Number -> [a] -> [a]
 * @sig Number -> String -> String
 * @param {Number} n
 * @param {*} list
 * @return {*}
 * @see R.drop
 * @example
 *
 *      R.take(1, ['foo', 'bar', 'baz']); //=> ['foo']
 *      R.take(2, ['foo', 'bar', 'baz']); //=> ['foo', 'bar']
 *      R.take(3, ['foo', 'bar', 'baz']); //=> ['foo', 'bar', 'baz']
 *      R.take(4, ['foo', 'bar', 'baz']); //=> ['foo', 'bar', 'baz']
 *      R.take(3, 'ramda');               //=> 'ram'
 *
 *      const personnel = [
 *        'Dave Brubeck',
 *        'Paul Desmond',
 *        'Eugene Wright',
 *        'Joe Morello',
 *        'Gerry Mulligan',
 *        'Bob Bates',
 *        'Joe Dodge',
 *        'Ron Crotty'
 *      ];
 *
 *      const takeFive = R.take(5);
 *      takeFive(personnel);
 *      //=> ['Dave Brubeck', 'Paul Desmond', 'Eugene Wright', 'Joe Morello', 'Gerry Mulligan']
 * @symb R.take(-1, [a, b]) = [a, b]
 * @symb R.take(0, [a, b]) = []
 * @symb R.take(1, [a, b]) = [a]
 * @symb R.take(2, [a, b]) = [a, b]
 */

var take_take =
/*#__PURE__*/
_curry2(
/*#__PURE__*/
_dispatchable(['take'], internal_xtake, function take(n, xs) {
  return es_slice(0, n < 0 ? Infinity : n, xs);
}));

/* harmony default export */ var es_take = (take_take);
// CONCATENATED MODULE: ./node_modules/ramda/es/internal/_dropLast.js

function dropLast(n, xs) {
  return es_take(n < xs.length ? xs.length - n : 0, xs);
}
// CONCATENATED MODULE: ./node_modules/ramda/es/internal/_xdropLast.js



var _xdropLast_XDropLast =
/*#__PURE__*/
function () {
  function XDropLast(n, xf) {
    this.xf = xf;
    this.pos = 0;
    this.full = false;
    this.acc = new Array(n);
  }

  XDropLast.prototype['@@transducer/init'] = _xfBase.init;

  XDropLast.prototype['@@transducer/result'] = function (result) {
    this.acc = null;
    return this.xf['@@transducer/result'](result);
  };

  XDropLast.prototype['@@transducer/step'] = function (result, input) {
    if (this.full) {
      result = this.xf['@@transducer/step'](result, this.acc[this.pos]);
    }

    this.store(input);
    return result;
  };

  XDropLast.prototype.store = function (input) {
    this.acc[this.pos] = input;
    this.pos += 1;

    if (this.pos === this.acc.length) {
      this.pos = 0;
      this.full = true;
    }
  };

  return XDropLast;
}();

var _xdropLast =
/*#__PURE__*/
_curry2(function _xdropLast(n, xf) {
  return new _xdropLast_XDropLast(n, xf);
});

/* harmony default export */ var internal_xdropLast = (_xdropLast);
// CONCATENATED MODULE: ./node_modules/ramda/es/dropLast.js




/**
 * Returns a list containing all but the last `n` elements of the given `list`.
 *
 * Acts as a transducer if a transformer is given in list position.
 *
 * @func
 * @memberOf R
 * @since v0.16.0
 * @category List
 * @sig Number -> [a] -> [a]
 * @sig Number -> String -> String
 * @param {Number} n The number of elements of `list` to skip.
 * @param {Array} list The list of elements to consider.
 * @return {Array} A copy of the list with only the first `list.length - n` elements
 * @see R.takeLast, R.drop, R.dropWhile, R.dropLastWhile
 * @example
 *
 *      R.dropLast(1, ['foo', 'bar', 'baz']); //=> ['foo', 'bar']
 *      R.dropLast(2, ['foo', 'bar', 'baz']); //=> ['foo']
 *      R.dropLast(3, ['foo', 'bar', 'baz']); //=> []
 *      R.dropLast(4, ['foo', 'bar', 'baz']); //=> []
 *      R.dropLast(3, 'ramda');               //=> 'ra'
 */

var dropLast_dropLast =
/*#__PURE__*/
_curry2(
/*#__PURE__*/
_dispatchable([], internal_xdropLast, dropLast));

/* harmony default export */ var es_dropLast = (dropLast_dropLast);
// CONCATENATED MODULE: ./node_modules/ramda/es/internal/_dropLastWhile.js

function dropLastWhile(pred, xs) {
  var idx = xs.length - 1;

  while (idx >= 0 && pred(xs[idx])) {
    idx -= 1;
  }

  return es_slice(0, idx + 1, xs);
}
// CONCATENATED MODULE: ./node_modules/ramda/es/internal/_xdropLastWhile.js




var _xdropLastWhile_XDropLastWhile =
/*#__PURE__*/
function () {
  function XDropLastWhile(fn, xf) {
    this.f = fn;
    this.retained = [];
    this.xf = xf;
  }

  XDropLastWhile.prototype['@@transducer/init'] = _xfBase.init;

  XDropLastWhile.prototype['@@transducer/result'] = function (result) {
    this.retained = null;
    return this.xf['@@transducer/result'](result);
  };

  XDropLastWhile.prototype['@@transducer/step'] = function (result, input) {
    return this.f(input) ? this.retain(result, input) : this.flush(result, input);
  };

  XDropLastWhile.prototype.flush = function (result, input) {
    result = _reduce(this.xf['@@transducer/step'], result, this.retained);
    this.retained = [];
    return this.xf['@@transducer/step'](result, input);
  };

  XDropLastWhile.prototype.retain = function (result, input) {
    this.retained.push(input);
    return result;
  };

  return XDropLastWhile;
}();

var _xdropLastWhile =
/*#__PURE__*/
_curry2(function _xdropLastWhile(fn, xf) {
  return new _xdropLastWhile_XDropLastWhile(fn, xf);
});

/* harmony default export */ var internal_xdropLastWhile = (_xdropLastWhile);
// CONCATENATED MODULE: ./node_modules/ramda/es/dropLastWhile.js




/**
 * Returns a new list excluding all the tailing elements of a given list which
 * satisfy the supplied predicate function. It passes each value from the right
 * to the supplied predicate function, skipping elements until the predicate
 * function returns a `falsy` value. The predicate function is applied to one argument:
 * *(value)*.
 *
 * Acts as a transducer if a transformer is given in list position.
 *
 * @func
 * @memberOf R
 * @since v0.16.0
 * @category List
 * @sig (a -> Boolean) -> [a] -> [a]
 * @sig (a -> Boolean) -> String -> String
 * @param {Function} predicate The function to be called on each element
 * @param {Array} xs The collection to iterate over.
 * @return {Array} A new array without any trailing elements that return `falsy` values from the `predicate`.
 * @see R.takeLastWhile, R.addIndex, R.drop, R.dropWhile
 * @example
 *
 *      const lteThree = x => x <= 3;
 *
 *      R.dropLastWhile(lteThree, [1, 2, 3, 4, 3, 2, 1]); //=> [1, 2, 3, 4]
 *
 *      R.dropLastWhile(x => x !== 'd' , 'Ramda'); //=> 'Ramd'
 */

var dropLastWhile_dropLastWhile =
/*#__PURE__*/
_curry2(
/*#__PURE__*/
_dispatchable([], internal_xdropLastWhile, dropLastWhile));

/* harmony default export */ var es_dropLastWhile = (dropLastWhile_dropLastWhile);
// CONCATENATED MODULE: ./node_modules/ramda/es/internal/_xdropRepeatsWith.js



var _xdropRepeatsWith_XDropRepeatsWith =
/*#__PURE__*/
function () {
  function XDropRepeatsWith(pred, xf) {
    this.xf = xf;
    this.pred = pred;
    this.lastValue = undefined;
    this.seenFirstValue = false;
  }

  XDropRepeatsWith.prototype['@@transducer/init'] = _xfBase.init;
  XDropRepeatsWith.prototype['@@transducer/result'] = _xfBase.result;

  XDropRepeatsWith.prototype['@@transducer/step'] = function (result, input) {
    var sameAsLast = false;

    if (!this.seenFirstValue) {
      this.seenFirstValue = true;
    } else if (this.pred(this.lastValue, input)) {
      sameAsLast = true;
    }

    this.lastValue = input;
    return sameAsLast ? result : this.xf['@@transducer/step'](result, input);
  };

  return XDropRepeatsWith;
}();

var _xdropRepeatsWith =
/*#__PURE__*/
_curry2(function _xdropRepeatsWith(pred, xf) {
  return new _xdropRepeatsWith_XDropRepeatsWith(pred, xf);
});

/* harmony default export */ var internal_xdropRepeatsWith = (_xdropRepeatsWith);
// CONCATENATED MODULE: ./node_modules/ramda/es/last.js

/**
 * Returns the last element of the given list or string.
 *
 * @func
 * @memberOf R
 * @since v0.1.4
 * @category List
 * @sig [a] -> a | Undefined
 * @sig String -> String
 * @param {*} list
 * @return {*}
 * @see R.init, R.head, R.tail
 * @example
 *
 *      R.last(['fi', 'fo', 'fum']); //=> 'fum'
 *      R.last([]); //=> undefined
 *
 *      R.last('abc'); //=> 'c'
 *      R.last(''); //=> ''
 */

var last_last =
/*#__PURE__*/
es_nth(-1);
/* harmony default export */ var es_last = (last_last);
// CONCATENATED MODULE: ./node_modules/ramda/es/dropRepeatsWith.js




/**
 * Returns a new list without any consecutively repeating elements. Equality is
 * determined by applying the supplied predicate to each pair of consecutive elements. The
 * first element in a series of equal elements will be preserved.
 *
 * Acts as a transducer if a transformer is given in list position.
 *
 * @func
 * @memberOf R
 * @since v0.14.0
 * @category List
 * @sig ((a, a) -> Boolean) -> [a] -> [a]
 * @param {Function} pred A predicate used to test whether two items are equal.
 * @param {Array} list The array to consider.
 * @return {Array} `list` without repeating elements.
 * @see R.transduce
 * @example
 *
 *      const l = [1, -1, 1, 3, 4, -4, -4, -5, 5, 3, 3];
 *      R.dropRepeatsWith(R.eqBy(Math.abs), l); //=> [1, 3, 4, -5, 3]
 */

var dropRepeatsWith_dropRepeatsWith =
/*#__PURE__*/
_curry2(
/*#__PURE__*/
_dispatchable([], internal_xdropRepeatsWith, function dropRepeatsWith(pred, list) {
  var result = [];
  var idx = 1;
  var len = list.length;

  if (len !== 0) {
    result[0] = list[0];

    while (idx < len) {
      if (!pred(es_last(result), list[idx])) {
        result[result.length] = list[idx];
      }

      idx += 1;
    }
  }

  return result;
}));

/* harmony default export */ var es_dropRepeatsWith = (dropRepeatsWith_dropRepeatsWith);
// CONCATENATED MODULE: ./node_modules/ramda/es/dropRepeats.js





/**
 * Returns a new list without any consecutively repeating elements.
 * [`R.equals`](#equals) is used to determine equality.
 *
 * Acts as a transducer if a transformer is given in list position.
 *
 * @func
 * @memberOf R
 * @since v0.14.0
 * @category List
 * @sig [a] -> [a]
 * @param {Array} list The array to consider.
 * @return {Array} `list` without repeating elements.
 * @see R.transduce
 * @example
 *
 *     R.dropRepeats([1, 1, 1, 2, 3, 4, 4, 2, 2]); //=> [1, 2, 3, 4, 2]
 */

var dropRepeats =
/*#__PURE__*/
_curry1(
/*#__PURE__*/
_dispatchable([],
/*#__PURE__*/
internal_xdropRepeatsWith(es_equals),
/*#__PURE__*/
es_dropRepeatsWith(es_equals)));

/* harmony default export */ var es_dropRepeats = (dropRepeats);
// CONCATENATED MODULE: ./node_modules/ramda/es/internal/_xdropWhile.js



var _xdropWhile_XDropWhile =
/*#__PURE__*/
function () {
  function XDropWhile(f, xf) {
    this.xf = xf;
    this.f = f;
  }

  XDropWhile.prototype['@@transducer/init'] = _xfBase.init;
  XDropWhile.prototype['@@transducer/result'] = _xfBase.result;

  XDropWhile.prototype['@@transducer/step'] = function (result, input) {
    if (this.f) {
      if (this.f(input)) {
        return result;
      }

      this.f = null;
    }

    return this.xf['@@transducer/step'](result, input);
  };

  return XDropWhile;
}();

var _xdropWhile =
/*#__PURE__*/
_curry2(function _xdropWhile(f, xf) {
  return new _xdropWhile_XDropWhile(f, xf);
});

/* harmony default export */ var internal_xdropWhile = (_xdropWhile);
// CONCATENATED MODULE: ./node_modules/ramda/es/dropWhile.js




/**
 * Returns a new list excluding the leading elements of a given list which
 * satisfy the supplied predicate function. It passes each value to the supplied
 * predicate function, skipping elements while the predicate function returns
 * `true`. The predicate function is applied to one argument: *(value)*.
 *
 * Dispatches to the `dropWhile` method of the second argument, if present.
 *
 * Acts as a transducer if a transformer is given in list position.
 *
 * @func
 * @memberOf R
 * @since v0.9.0
 * @category List
 * @sig (a -> Boolean) -> [a] -> [a]
 * @sig (a -> Boolean) -> String -> String
 * @param {Function} fn The function called per iteration.
 * @param {Array} xs The collection to iterate over.
 * @return {Array} A new array.
 * @see R.takeWhile, R.transduce, R.addIndex
 * @example
 *
 *      const lteTwo = x => x <= 2;
 *
 *      R.dropWhile(lteTwo, [1, 2, 3, 4, 3, 2, 1]); //=> [3, 4, 3, 2, 1]
 *
 *      R.dropWhile(x => x !== 'd' , 'Ramda'); //=> 'da'
 */

var dropWhile_dropWhile =
/*#__PURE__*/
_curry2(
/*#__PURE__*/
_dispatchable(['dropWhile'], internal_xdropWhile, function dropWhile(pred, xs) {
  var idx = 0;
  var len = xs.length;

  while (idx < len && pred(xs[idx])) {
    idx += 1;
  }

  return es_slice(idx, Infinity, xs);
}));

/* harmony default export */ var es_dropWhile = (dropWhile_dropWhile);
// CONCATENATED MODULE: ./node_modules/ramda/es/or.js

/**
 * Returns `true` if one or both of its arguments are `true`. Returns `false`
 * if both arguments are `false`.
 *
 * @func
 * @memberOf R
 * @since v0.1.0
 * @category Logic
 * @sig a -> b -> a | b
 * @param {Any} a
 * @param {Any} b
 * @return {Any} the first argument if truthy, otherwise the second argument.
 * @see R.either, R.xor
 * @example
 *
 *      R.or(true, true); //=> true
 *      R.or(true, false); //=> true
 *      R.or(false, true); //=> true
 *      R.or(false, false); //=> false
 */

var or =
/*#__PURE__*/
_curry2(function or(a, b) {
  return a || b;
});

/* harmony default export */ var es_or = (or);
// CONCATENATED MODULE: ./node_modules/ramda/es/either.js




/**
 * A function wrapping calls to the two functions in an `||` operation,
 * returning the result of the first function if it is truth-y and the result
 * of the second function otherwise. Note that this is short-circuited,
 * meaning that the second function will not be invoked if the first returns a
 * truth-y value.
 *
 * In addition to functions, `R.either` also accepts any fantasy-land compatible
 * applicative functor.
 *
 * @func
 * @memberOf R
 * @since v0.12.0
 * @category Logic
 * @sig (*... -> Boolean) -> (*... -> Boolean) -> (*... -> Boolean)
 * @param {Function} f a predicate
 * @param {Function} g another predicate
 * @return {Function} a function that applies its arguments to `f` and `g` and `||`s their outputs together.
 * @see R.or
 * @example
 *
 *      const gt10 = x => x > 10;
 *      const even = x => x % 2 === 0;
 *      const f = R.either(gt10, even);
 *      f(101); //=> true
 *      f(8); //=> true
 *
 *      R.either(Maybe.Just(false), Maybe.Just(55)); // => Maybe.Just(55)
 *      R.either([false, false, 'a'], [11]) // => [11, 11, "a"]
 */

var either_either =
/*#__PURE__*/
_curry2(function either(f, g) {
  return _isFunction(f) ? function _either() {
    return f.apply(this, arguments) || g.apply(this, arguments);
  } : es_lift(es_or)(f, g);
});

/* harmony default export */ var es_either = (either_either);
// CONCATENATED MODULE: ./node_modules/ramda/es/empty.js





/**
 * Returns the empty value of its argument's type. Ramda defines the empty
 * value of Array (`[]`), Object (`{}`), String (`''`), and Arguments. Other
 * types are supported if they define `<Type>.empty`,
 * `<Type>.prototype.empty` or implement the
 * [FantasyLand Monoid spec](https://github.com/fantasyland/fantasy-land#monoid).
 *
 * Dispatches to the `empty` method of the first argument, if present.
 *
 * @func
 * @memberOf R
 * @since v0.3.0
 * @category Function
 * @sig a -> a
 * @param {*} x
 * @return {*}
 * @example
 *
 *      R.empty(Just(42));      //=> Nothing()
 *      R.empty([1, 2, 3]);     //=> []
 *      R.empty('unicorns');    //=> ''
 *      R.empty({x: 1, y: 2});  //=> {}
 */

var empty_empty =
/*#__PURE__*/
_curry1(function empty(x) {
  return x != null && typeof x['fantasy-land/empty'] === 'function' ? x['fantasy-land/empty']() : x != null && x.constructor != null && typeof x.constructor['fantasy-land/empty'] === 'function' ? x.constructor['fantasy-land/empty']() : x != null && typeof x.empty === 'function' ? x.empty() : x != null && x.constructor != null && typeof x.constructor.empty === 'function' ? x.constructor.empty() : _isArray(x) ? [] : _isString(x) ? '' : _isObject(x) ? {} : internal_isArguments(x) ? function () {
    return arguments;
  }() : void 0 // else
  ;
});

/* harmony default export */ var es_empty = (empty_empty);
// CONCATENATED MODULE: ./node_modules/ramda/es/takeLast.js


/**
 * Returns a new list containing the last `n` elements of the given list.
 * If `n > list.length`, returns a list of `list.length` elements.
 *
 * @func
 * @memberOf R
 * @since v0.16.0
 * @category List
 * @sig Number -> [a] -> [a]
 * @sig Number -> String -> String
 * @param {Number} n The number of elements to return.
 * @param {Array} xs The collection to consider.
 * @return {Array}
 * @see R.dropLast
 * @example
 *
 *      R.takeLast(1, ['foo', 'bar', 'baz']); //=> ['baz']
 *      R.takeLast(2, ['foo', 'bar', 'baz']); //=> ['bar', 'baz']
 *      R.takeLast(3, ['foo', 'bar', 'baz']); //=> ['foo', 'bar', 'baz']
 *      R.takeLast(4, ['foo', 'bar', 'baz']); //=> ['foo', 'bar', 'baz']
 *      R.takeLast(3, 'ramda');               //=> 'mda'
 */

var takeLast_takeLast =
/*#__PURE__*/
_curry2(function takeLast(n, xs) {
  return es_drop(n >= 0 ? xs.length - n : 0, xs);
});

/* harmony default export */ var es_takeLast = (takeLast_takeLast);
// CONCATENATED MODULE: ./node_modules/ramda/es/endsWith.js



/**
 * Checks if a list ends with the provided sublist.
 *
 * Similarly, checks if a string ends with the provided substring.
 *
 * @func
 * @memberOf R
 * @since v0.24.0
 * @category List
 * @sig [a] -> [a] -> Boolean
 * @sig String -> String -> Boolean
 * @param {*} suffix
 * @param {*} list
 * @return {Boolean}
 * @see R.startsWith
 * @example
 *
 *      R.endsWith('c', 'abc')                //=> true
 *      R.endsWith('b', 'abc')                //=> false
 *      R.endsWith(['c'], ['a', 'b', 'c'])    //=> true
 *      R.endsWith(['b'], ['a', 'b', 'c'])    //=> false
 */

var endsWith =
/*#__PURE__*/
_curry2(function (suffix, list) {
  return es_equals(es_takeLast(suffix.length, list), suffix);
});

/* harmony default export */ var es_endsWith = (endsWith);
// CONCATENATED MODULE: ./node_modules/ramda/es/eqBy.js


/**
 * Takes a function and two values in its domain and returns `true` if the
 * values map to the same value in the codomain; `false` otherwise.
 *
 * @func
 * @memberOf R
 * @since v0.18.0
 * @category Relation
 * @sig (a -> b) -> a -> a -> Boolean
 * @param {Function} f
 * @param {*} x
 * @param {*} y
 * @return {Boolean}
 * @example
 *
 *      R.eqBy(Math.abs, 5, -5); //=> true
 */

var eqBy_eqBy =
/*#__PURE__*/
_curry3(function eqBy(f, x, y) {
  return es_equals(f(x), f(y));
});

/* harmony default export */ var es_eqBy = (eqBy_eqBy);
// CONCATENATED MODULE: ./node_modules/ramda/es/eqProps.js


/**
 * Reports whether two objects have the same value, in [`R.equals`](#equals)
 * terms, for the specified property. Useful as a curried predicate.
 *
 * @func
 * @memberOf R
 * @since v0.1.0
 * @category Object
 * @sig k -> {k: v} -> {k: v} -> Boolean
 * @param {String} prop The name of the property to compare
 * @param {Object} obj1
 * @param {Object} obj2
 * @return {Boolean}
 *
 * @example
 *
 *      const o1 = { a: 1, b: 2, c: 3, d: 4 };
 *      const o2 = { a: 10, b: 20, c: 3, d: 40 };
 *      R.eqProps('a', o1, o2); //=> false
 *      R.eqProps('c', o1, o2); //=> true
 */

var eqProps_eqProps =
/*#__PURE__*/
_curry3(function eqProps(prop, obj1, obj2) {
  return es_equals(obj1[prop], obj2[prop]);
});

/* harmony default export */ var es_eqProps = (eqProps_eqProps);
// CONCATENATED MODULE: ./node_modules/ramda/es/evolve.js

/**
 * Creates a new object by recursively evolving a shallow copy of `object`,
 * according to the `transformation` functions. All non-primitive properties
 * are copied by reference.
 *
 * A `transformation` function will not be invoked if its corresponding key
 * does not exist in the evolved object.
 *
 * @func
 * @memberOf R
 * @since v0.9.0
 * @category Object
 * @sig {k: (v -> v)} -> {k: v} -> {k: v}
 * @param {Object} transformations The object specifying transformation functions to apply
 *        to the object.
 * @param {Object} object The object to be transformed.
 * @return {Object} The transformed object.
 * @example
 *
 *      const tomato = {firstName: '  Tomato ', data: {elapsed: 100, remaining: 1400}, id:123};
 *      const transformations = {
 *        firstName: R.trim,
 *        lastName: R.trim, // Will not get invoked.
 *        data: {elapsed: R.add(1), remaining: R.add(-1)}
 *      };
 *      R.evolve(transformations, tomato); //=> {firstName: 'Tomato', data: {elapsed: 101, remaining: 1399}, id:123}
 */

var evolve =
/*#__PURE__*/
_curry2(function evolve(transformations, object) {
  var result = object instanceof Array ? [] : {};
  var transformation, key, type;

  for (key in object) {
    transformation = transformations[key];
    type = typeof transformation;
    result[key] = type === 'function' ? transformation(object[key]) : transformation && type === 'object' ? evolve(transformation, object[key]) : object[key];
  }

  return result;
});

/* harmony default export */ var es_evolve = (evolve);
// CONCATENATED MODULE: ./node_modules/ramda/es/internal/_xfind.js




var _xfind_XFind =
/*#__PURE__*/
function () {
  function XFind(f, xf) {
    this.xf = xf;
    this.f = f;
    this.found = false;
  }

  XFind.prototype['@@transducer/init'] = _xfBase.init;

  XFind.prototype['@@transducer/result'] = function (result) {
    if (!this.found) {
      result = this.xf['@@transducer/step'](result, void 0);
    }

    return this.xf['@@transducer/result'](result);
  };

  XFind.prototype['@@transducer/step'] = function (result, input) {
    if (this.f(input)) {
      this.found = true;
      result = _reduced(this.xf['@@transducer/step'](result, input));
    }

    return result;
  };

  return XFind;
}();

var _xfind =
/*#__PURE__*/
_curry2(function _xfind(f, xf) {
  return new _xfind_XFind(f, xf);
});

/* harmony default export */ var internal_xfind = (_xfind);
// CONCATENATED MODULE: ./node_modules/ramda/es/find.js



/**
 * Returns the first element of the list which matches the predicate, or
 * `undefined` if no element matches.
 *
 * Dispatches to the `find` method of the second argument, if present.
 *
 * Acts as a transducer if a transformer is given in list position.
 *
 * @func
 * @memberOf R
 * @since v0.1.0
 * @category List
 * @sig (a -> Boolean) -> [a] -> a | undefined
 * @param {Function} fn The predicate function used to determine if the element is the
 *        desired one.
 * @param {Array} list The array to consider.
 * @return {Object} The element found, or `undefined`.
 * @see R.transduce
 * @example
 *
 *      const xs = [{a: 1}, {a: 2}, {a: 3}];
 *      R.find(R.propEq('a', 2))(xs); //=> {a: 2}
 *      R.find(R.propEq('a', 4))(xs); //=> undefined
 */

var find =
/*#__PURE__*/
_curry2(
/*#__PURE__*/
_dispatchable(['find'], internal_xfind, function find(fn, list) {
  var idx = 0;
  var len = list.length;

  while (idx < len) {
    if (fn(list[idx])) {
      return list[idx];
    }

    idx += 1;
  }
}));

/* harmony default export */ var es_find = (find);
// CONCATENATED MODULE: ./node_modules/ramda/es/internal/_xfindIndex.js




var _xfindIndex_XFindIndex =
/*#__PURE__*/
function () {
  function XFindIndex(f, xf) {
    this.xf = xf;
    this.f = f;
    this.idx = -1;
    this.found = false;
  }

  XFindIndex.prototype['@@transducer/init'] = _xfBase.init;

  XFindIndex.prototype['@@transducer/result'] = function (result) {
    if (!this.found) {
      result = this.xf['@@transducer/step'](result, -1);
    }

    return this.xf['@@transducer/result'](result);
  };

  XFindIndex.prototype['@@transducer/step'] = function (result, input) {
    this.idx += 1;

    if (this.f(input)) {
      this.found = true;
      result = _reduced(this.xf['@@transducer/step'](result, this.idx));
    }

    return result;
  };

  return XFindIndex;
}();

var _xfindIndex =
/*#__PURE__*/
_curry2(function _xfindIndex(f, xf) {
  return new _xfindIndex_XFindIndex(f, xf);
});

/* harmony default export */ var internal_xfindIndex = (_xfindIndex);
// CONCATENATED MODULE: ./node_modules/ramda/es/findIndex.js



/**
 * Returns the index of the first element of the list which matches the
 * predicate, or `-1` if no element matches.
 *
 * Acts as a transducer if a transformer is given in list position.
 *
 * @func
 * @memberOf R
 * @since v0.1.1
 * @category List
 * @sig (a -> Boolean) -> [a] -> Number
 * @param {Function} fn The predicate function used to determine if the element is the
 * desired one.
 * @param {Array} list The array to consider.
 * @return {Number} The index of the element found, or `-1`.
 * @see R.transduce
 * @example
 *
 *      const xs = [{a: 1}, {a: 2}, {a: 3}];
 *      R.findIndex(R.propEq('a', 2))(xs); //=> 1
 *      R.findIndex(R.propEq('a', 4))(xs); //=> -1
 */

var findIndex =
/*#__PURE__*/
_curry2(
/*#__PURE__*/
_dispatchable([], internal_xfindIndex, function findIndex(fn, list) {
  var idx = 0;
  var len = list.length;

  while (idx < len) {
    if (fn(list[idx])) {
      return idx;
    }

    idx += 1;
  }

  return -1;
}));

/* harmony default export */ var es_findIndex = (findIndex);
// CONCATENATED MODULE: ./node_modules/ramda/es/internal/_xfindLast.js



var _xfindLast_XFindLast =
/*#__PURE__*/
function () {
  function XFindLast(f, xf) {
    this.xf = xf;
    this.f = f;
  }

  XFindLast.prototype['@@transducer/init'] = _xfBase.init;

  XFindLast.prototype['@@transducer/result'] = function (result) {
    return this.xf['@@transducer/result'](this.xf['@@transducer/step'](result, this.last));
  };

  XFindLast.prototype['@@transducer/step'] = function (result, input) {
    if (this.f(input)) {
      this.last = input;
    }

    return result;
  };

  return XFindLast;
}();

var _xfindLast =
/*#__PURE__*/
_curry2(function _xfindLast(f, xf) {
  return new _xfindLast_XFindLast(f, xf);
});

/* harmony default export */ var internal_xfindLast = (_xfindLast);
// CONCATENATED MODULE: ./node_modules/ramda/es/findLast.js



/**
 * Returns the last element of the list which matches the predicate, or
 * `undefined` if no element matches.
 *
 * Acts as a transducer if a transformer is given in list position.
 *
 * @func
 * @memberOf R
 * @since v0.1.1
 * @category List
 * @sig (a -> Boolean) -> [a] -> a | undefined
 * @param {Function} fn The predicate function used to determine if the element is the
 * desired one.
 * @param {Array} list The array to consider.
 * @return {Object} The element found, or `undefined`.
 * @see R.transduce
 * @example
 *
 *      const xs = [{a: 1, b: 0}, {a:1, b: 1}];
 *      R.findLast(R.propEq('a', 1))(xs); //=> {a: 1, b: 1}
 *      R.findLast(R.propEq('a', 4))(xs); //=> undefined
 */

var findLast =
/*#__PURE__*/
_curry2(
/*#__PURE__*/
_dispatchable([], internal_xfindLast, function findLast(fn, list) {
  var idx = list.length - 1;

  while (idx >= 0) {
    if (fn(list[idx])) {
      return list[idx];
    }

    idx -= 1;
  }
}));

/* harmony default export */ var es_findLast = (findLast);
// CONCATENATED MODULE: ./node_modules/ramda/es/internal/_xfindLastIndex.js



var _xfindLastIndex_XFindLastIndex =
/*#__PURE__*/
function () {
  function XFindLastIndex(f, xf) {
    this.xf = xf;
    this.f = f;
    this.idx = -1;
    this.lastIdx = -1;
  }

  XFindLastIndex.prototype['@@transducer/init'] = _xfBase.init;

  XFindLastIndex.prototype['@@transducer/result'] = function (result) {
    return this.xf['@@transducer/result'](this.xf['@@transducer/step'](result, this.lastIdx));
  };

  XFindLastIndex.prototype['@@transducer/step'] = function (result, input) {
    this.idx += 1;

    if (this.f(input)) {
      this.lastIdx = this.idx;
    }

    return result;
  };

  return XFindLastIndex;
}();

var _xfindLastIndex =
/*#__PURE__*/
_curry2(function _xfindLastIndex(f, xf) {
  return new _xfindLastIndex_XFindLastIndex(f, xf);
});

/* harmony default export */ var internal_xfindLastIndex = (_xfindLastIndex);
// CONCATENATED MODULE: ./node_modules/ramda/es/findLastIndex.js



/**
 * Returns the index of the last element of the list which matches the
 * predicate, or `-1` if no element matches.
 *
 * Acts as a transducer if a transformer is given in list position.
 *
 * @func
 * @memberOf R
 * @since v0.1.1
 * @category List
 * @sig (a -> Boolean) -> [a] -> Number
 * @param {Function} fn The predicate function used to determine if the element is the
 * desired one.
 * @param {Array} list The array to consider.
 * @return {Number} The index of the element found, or `-1`.
 * @see R.transduce
 * @example
 *
 *      const xs = [{a: 1, b: 0}, {a:1, b: 1}];
 *      R.findLastIndex(R.propEq('a', 1))(xs); //=> 1
 *      R.findLastIndex(R.propEq('a', 4))(xs); //=> -1
 */

var findLastIndex =
/*#__PURE__*/
_curry2(
/*#__PURE__*/
_dispatchable([], internal_xfindLastIndex, function findLastIndex(fn, list) {
  var idx = list.length - 1;

  while (idx >= 0) {
    if (fn(list[idx])) {
      return idx;
    }

    idx -= 1;
  }

  return -1;
}));

/* harmony default export */ var es_findLastIndex = (findLastIndex);
// CONCATENATED MODULE: ./node_modules/ramda/es/flatten.js


/**
 * Returns a new list by pulling every item out of it (and all its sub-arrays)
 * and putting them in a new array, depth-first.
 *
 * @func
 * @memberOf R
 * @since v0.1.0
 * @category List
 * @sig [a] -> [b]
 * @param {Array} list The array to consider.
 * @return {Array} The flattened list.
 * @see R.unnest
 * @example
 *
 *      R.flatten([1, 2, [3, 4], 5, [6, [7, 8, [9, [10, 11], 12]]]]);
 *      //=> [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
 */

var flatten =
/*#__PURE__*/
_curry1(
/*#__PURE__*/
_makeFlat(true));

/* harmony default export */ var es_flatten = (flatten);
// CONCATENATED MODULE: ./node_modules/ramda/es/flip.js


/**
 * Returns a new function much like the supplied one, except that the first two
 * arguments' order is reversed.
 *
 * @func
 * @memberOf R
 * @since v0.1.0
 * @category Function
 * @sig ((a, b, c, ...) -> z) -> (b -> a -> c -> ... -> z)
 * @param {Function} fn The function to invoke with its first two parameters reversed.
 * @return {*} The result of invoking `fn` with its first two parameters' order reversed.
 * @example
 *
 *      const mergeThree = (a, b, c) => [].concat(a, b, c);
 *
 *      mergeThree(1, 2, 3); //=> [1, 2, 3]
 *
 *      R.flip(mergeThree)(1, 2, 3); //=> [2, 1, 3]
 * @symb R.flip(f)(a, b, c) = f(b, a, c)
 */

var flip_flip =
/*#__PURE__*/
_curry1(function flip(fn) {
  return es_curryN(fn.length, function (a, b) {
    var args = Array.prototype.slice.call(arguments, 0);
    args[0] = b;
    args[1] = a;
    return fn.apply(this, args);
  });
});

/* harmony default export */ var es_flip = (flip_flip);
// CONCATENATED MODULE: ./node_modules/ramda/es/forEach.js


/**
 * Iterate over an input `list`, calling a provided function `fn` for each
 * element in the list.
 *
 * `fn` receives one argument: *(value)*.
 *
 * Note: `R.forEach` does not skip deleted or unassigned indices (sparse
 * arrays), unlike the native `Array.prototype.forEach` method. For more
 * details on this behavior, see:
 * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach#Description
 *
 * Also note that, unlike `Array.prototype.forEach`, Ramda's `forEach` returns
 * the original array. In some libraries this function is named `each`.
 *
 * Dispatches to the `forEach` method of the second argument, if present.
 *
 * @func
 * @memberOf R
 * @since v0.1.1
 * @category List
 * @sig (a -> *) -> [a] -> [a]
 * @param {Function} fn The function to invoke. Receives one argument, `value`.
 * @param {Array} list The list to iterate over.
 * @return {Array} The original list.
 * @see R.addIndex
 * @example
 *
 *      const printXPlusFive = x => console.log(x + 5);
 *      R.forEach(printXPlusFive, [1, 2, 3]); //=> [1, 2, 3]
 *      // logs 6
 *      // logs 7
 *      // logs 8
 * @symb R.forEach(f, [a, b, c]) = [a, b, c]
 */

var forEach =
/*#__PURE__*/
_curry2(
/*#__PURE__*/
_checkForMethod('forEach', function forEach(fn, list) {
  var len = list.length;
  var idx = 0;

  while (idx < len) {
    fn(list[idx]);
    idx += 1;
  }

  return list;
}));

/* harmony default export */ var es_forEach = (forEach);
// CONCATENATED MODULE: ./node_modules/ramda/es/forEachObjIndexed.js


/**
 * Iterate over an input `object`, calling a provided function `fn` for each
 * key and value in the object.
 *
 * `fn` receives three argument: *(value, key, obj)*.
 *
 * @func
 * @memberOf R
 * @since v0.23.0
 * @category Object
 * @sig ((a, String, StrMap a) -> Any) -> StrMap a -> StrMap a
 * @param {Function} fn The function to invoke. Receives three argument, `value`, `key`, `obj`.
 * @param {Object} obj The object to iterate over.
 * @return {Object} The original object.
 * @example
 *
 *      const printKeyConcatValue = (value, key) => console.log(key + ':' + value);
 *      R.forEachObjIndexed(printKeyConcatValue, {x: 1, y: 2}); //=> {x: 1, y: 2}
 *      // logs x:1
 *      // logs y:2
 * @symb R.forEachObjIndexed(f, {x: a, y: b}) = {x: a, y: b}
 */

var forEachObjIndexed_forEachObjIndexed =
/*#__PURE__*/
_curry2(function forEachObjIndexed(fn, obj) {
  var keyList = es_keys(obj);
  var idx = 0;

  while (idx < keyList.length) {
    var key = keyList[idx];
    fn(obj[key], key, obj);
    idx += 1;
  }

  return obj;
});

/* harmony default export */ var es_forEachObjIndexed = (forEachObjIndexed_forEachObjIndexed);
// CONCATENATED MODULE: ./node_modules/ramda/es/fromPairs.js

/**
 * Creates a new object from a list key-value pairs. If a key appears in
 * multiple pairs, the rightmost pair is included in the object.
 *
 * @func
 * @memberOf R
 * @since v0.3.0
 * @category List
 * @sig [[k,v]] -> {k: v}
 * @param {Array} pairs An array of two-element arrays that will be the keys and values of the output object.
 * @return {Object} The object made by pairing up `keys` and `values`.
 * @see R.toPairs, R.pair
 * @example
 *
 *      R.fromPairs([['a', 1], ['b', 2], ['c', 3]]); //=> {a: 1, b: 2, c: 3}
 */

var fromPairs =
/*#__PURE__*/
_curry1(function fromPairs(pairs) {
  var result = {};
  var idx = 0;

  while (idx < pairs.length) {
    result[pairs[idx][0]] = pairs[idx][1];
    idx += 1;
  }

  return result;
});

/* harmony default export */ var es_fromPairs = (fromPairs);
// CONCATENATED MODULE: ./node_modules/ramda/es/groupBy.js



/**
 * Splits a list into sub-lists stored in an object, based on the result of
 * calling a String-returning function on each element, and grouping the
 * results according to values returned.
 *
 * Dispatches to the `groupBy` method of the second argument, if present.
 *
 * Acts as a transducer if a transformer is given in list position.
 *
 * @func
 * @memberOf R
 * @since v0.1.0
 * @category List
 * @sig (a -> String) -> [a] -> {String: [a]}
 * @param {Function} fn Function :: a -> String
 * @param {Array} list The array to group
 * @return {Object} An object with the output of `fn` for keys, mapped to arrays of elements
 *         that produced that key when passed to `fn`.
 * @see R.reduceBy, R.transduce
 * @example
 *
 *      const byGrade = R.groupBy(function(student) {
 *        const score = student.score;
 *        return score < 65 ? 'F' :
 *               score < 70 ? 'D' :
 *               score < 80 ? 'C' :
 *               score < 90 ? 'B' : 'A';
 *      });
 *      const students = [{name: 'Abby', score: 84},
 *                      {name: 'Eddy', score: 58},
 *                      // ...
 *                      {name: 'Jack', score: 69}];
 *      byGrade(students);
 *      // {
 *      //   'A': [{name: 'Dianne', score: 99}],
 *      //   'B': [{name: 'Abby', score: 84}]
 *      //   // ...,
 *      //   'F': [{name: 'Eddy', score: 58}]
 *      // }
 */

var groupBy =
/*#__PURE__*/
_curry2(
/*#__PURE__*/
_checkForMethod('groupBy',
/*#__PURE__*/
es_reduceBy(function (acc, item) {
  if (acc == null) {
    acc = [];
  }

  acc.push(item);
  return acc;
}, null)));

/* harmony default export */ var es_groupBy = (groupBy);
// CONCATENATED MODULE: ./node_modules/ramda/es/groupWith.js

/**
 * Takes a list and returns a list of lists where each sublist's elements are
 * all satisfied pairwise comparison according to the provided function.
 * Only adjacent elements are passed to the comparison function.
 *
 * @func
 * @memberOf R
 * @since v0.21.0
 * @category List
 * @sig ((a, a) → Boolean) → [a] → [[a]]
 * @param {Function} fn Function for determining whether two given (adjacent)
 *        elements should be in the same group
 * @param {Array} list The array to group. Also accepts a string, which will be
 *        treated as a list of characters.
 * @return {List} A list that contains sublists of elements,
 *         whose concatenations are equal to the original list.
 * @example
 *
 * R.groupWith(R.equals, [0, 1, 1, 2, 3, 5, 8, 13, 21])
 * //=> [[0], [1, 1], [2], [3], [5], [8], [13], [21]]
 *
 * R.groupWith((a, b) => a + 1 === b, [0, 1, 1, 2, 3, 5, 8, 13, 21])
 * //=> [[0, 1], [1, 2, 3], [5], [8], [13], [21]]
 *
 * R.groupWith((a, b) => a % 2 === b % 2, [0, 1, 1, 2, 3, 5, 8, 13, 21])
 * //=> [[0], [1, 1], [2], [3, 5], [8], [13, 21]]
 *
 * R.groupWith(R.eqBy(isVowel), 'aestiou')
 * //=> ['ae', 'st', 'iou']
 */

var groupWith =
/*#__PURE__*/
_curry2(function (fn, list) {
  var res = [];
  var idx = 0;
  var len = list.length;

  while (idx < len) {
    var nextidx = idx + 1;

    while (nextidx < len && fn(list[nextidx - 1], list[nextidx])) {
      nextidx += 1;
    }

    res.push(list.slice(idx, nextidx));
    idx = nextidx;
  }

  return res;
});

/* harmony default export */ var es_groupWith = (groupWith);
// CONCATENATED MODULE: ./node_modules/ramda/es/gt.js

/**
 * Returns `true` if the first argument is greater than the second; `false`
 * otherwise.
 *
 * @func
 * @memberOf R
 * @since v0.1.0
 * @category Relation
 * @sig Ord a => a -> a -> Boolean
 * @param {*} a
 * @param {*} b
 * @return {Boolean}
 * @see R.lt
 * @example
 *
 *      R.gt(2, 1); //=> true
 *      R.gt(2, 2); //=> false
 *      R.gt(2, 3); //=> false
 *      R.gt('a', 'z'); //=> false
 *      R.gt('z', 'a'); //=> true
 */

var gt =
/*#__PURE__*/
_curry2(function gt(a, b) {
  return a > b;
});

/* harmony default export */ var es_gt = (gt);
// CONCATENATED MODULE: ./node_modules/ramda/es/gte.js

/**
 * Returns `true` if the first argument is greater than or equal to the second;
 * `false` otherwise.
 *
 * @func
 * @memberOf R
 * @since v0.1.0
 * @category Relation
 * @sig Ord a => a -> a -> Boolean
 * @param {Number} a
 * @param {Number} b
 * @return {Boolean}
 * @see R.lte
 * @example
 *
 *      R.gte(2, 1); //=> true
 *      R.gte(2, 2); //=> true
 *      R.gte(2, 3); //=> false
 *      R.gte('a', 'z'); //=> false
 *      R.gte('z', 'a'); //=> true
 */

var gte =
/*#__PURE__*/
_curry2(function gte(a, b) {
  return a >= b;
});

/* harmony default export */ var es_gte = (gte);
// CONCATENATED MODULE: ./node_modules/ramda/es/hasPath.js



/**
 * Returns whether or not a path exists in an object. Only the object's
 * own properties are checked.
 *
 * @func
 * @memberOf R
 * @since v0.26.0
 * @category Object
 * @typedefn Idx = String | Int
 * @sig [Idx] -> {a} -> Boolean
 * @param {Array} path The path to use.
 * @param {Object} obj The object to check the path in.
 * @return {Boolean} Whether the path exists.
 * @see R.has
 * @example
 *
 *      R.hasPath(['a', 'b'], {a: {b: 2}});         // => true
 *      R.hasPath(['a', 'b'], {a: {b: undefined}}); // => true
 *      R.hasPath(['a', 'b'], {a: {c: 2}});         // => false
 *      R.hasPath(['a', 'b'], {});                  // => false
 */

var hasPath_hasPath =
/*#__PURE__*/
_curry2(function hasPath(_path, obj) {
  if (_path.length === 0 || es_isNil(obj)) {
    return false;
  }

  var val = obj;
  var idx = 0;

  while (idx < _path.length) {
    if (!es_isNil(val) && _has(_path[idx], val)) {
      val = val[_path[idx]];
      idx += 1;
    } else {
      return false;
    }
  }

  return true;
});

/* harmony default export */ var es_hasPath = (hasPath_hasPath);
// CONCATENATED MODULE: ./node_modules/ramda/es/has.js


/**
 * Returns whether or not an object has an own property with the specified name
 *
 * @func
 * @memberOf R
 * @since v0.7.0
 * @category Object
 * @sig s -> {s: x} -> Boolean
 * @param {String} prop The name of the property to check for.
 * @param {Object} obj The object to query.
 * @return {Boolean} Whether the property exists.
 * @example
 *
 *      const hasName = R.has('name');
 *      hasName({name: 'alice'});   //=> true
 *      hasName({name: 'bob'});     //=> true
 *      hasName({});                //=> false
 *
 *      const point = {x: 0, y: 0};
 *      const pointHas = R.has(R.__, point);
 *      pointHas('x');  //=> true
 *      pointHas('y');  //=> true
 *      pointHas('z');  //=> false
 */

var has_has =
/*#__PURE__*/
_curry2(function has(prop, obj) {
  return es_hasPath([prop], obj);
});

/* harmony default export */ var es_has = (has_has);
// CONCATENATED MODULE: ./node_modules/ramda/es/hasIn.js

/**
 * Returns whether or not an object or its prototype chain has a property with
 * the specified name
 *
 * @func
 * @memberOf R
 * @since v0.7.0
 * @category Object
 * @sig s -> {s: x} -> Boolean
 * @param {String} prop The name of the property to check for.
 * @param {Object} obj The object to query.
 * @return {Boolean} Whether the property exists.
 * @example
 *
 *      function Rectangle(width, height) {
 *        this.width = width;
 *        this.height = height;
 *      }
 *      Rectangle.prototype.area = function() {
 *        return this.width * this.height;
 *      };
 *
 *      const square = new Rectangle(2, 2);
 *      R.hasIn('width', square);  //=> true
 *      R.hasIn('area', square);  //=> true
 */

var hasIn =
/*#__PURE__*/
_curry2(function hasIn(prop, obj) {
  return prop in obj;
});

/* harmony default export */ var es_hasIn = (hasIn);
// CONCATENATED MODULE: ./node_modules/ramda/es/identical.js


/**
 * Returns true if its arguments are identical, false otherwise. Values are
 * identical if they reference the same memory. `NaN` is identical to `NaN`;
 * `0` and `-0` are not identical.
 *
 * Note this is merely a curried version of ES6 `Object.is`.
 *
 * @func
 * @memberOf R
 * @since v0.15.0
 * @category Relation
 * @sig a -> a -> Boolean
 * @param {*} a
 * @param {*} b
 * @return {Boolean}
 * @example
 *
 *      const o = {};
 *      R.identical(o, o); //=> true
 *      R.identical(1, 1); //=> true
 *      R.identical(1, '1'); //=> false
 *      R.identical([], []); //=> false
 *      R.identical(0, -0); //=> false
 *      R.identical(NaN, NaN); //=> true
 */

var identical =
/*#__PURE__*/
_curry2(internal_objectIs);

/* harmony default export */ var es_identical = (identical);
// CONCATENATED MODULE: ./node_modules/ramda/es/ifElse.js


/**
 * Creates a function that will process either the `onTrue` or the `onFalse`
 * function depending upon the result of the `condition` predicate.
 *
 * @func
 * @memberOf R
 * @since v0.8.0
 * @category Logic
 * @sig (*... -> Boolean) -> (*... -> *) -> (*... -> *) -> (*... -> *)
 * @param {Function} condition A predicate function
 * @param {Function} onTrue A function to invoke when the `condition` evaluates to a truthy value.
 * @param {Function} onFalse A function to invoke when the `condition` evaluates to a falsy value.
 * @return {Function} A new function that will process either the `onTrue` or the `onFalse`
 *                    function depending upon the result of the `condition` predicate.
 * @see R.unless, R.when, R.cond
 * @example
 *
 *      const incCount = R.ifElse(
 *        R.has('count'),
 *        R.over(R.lensProp('count'), R.inc),
 *        R.assoc('count', 1)
 *      );
 *      incCount({});           //=> { count: 1 }
 *      incCount({ count: 1 }); //=> { count: 2 }
 */

var ifElse_ifElse =
/*#__PURE__*/
_curry3(function ifElse(condition, onTrue, onFalse) {
  return es_curryN(Math.max(condition.length, onTrue.length, onFalse.length), function _ifElse() {
    return condition.apply(this, arguments) ? onTrue.apply(this, arguments) : onFalse.apply(this, arguments);
  });
});

/* harmony default export */ var es_ifElse = (ifElse_ifElse);
// CONCATENATED MODULE: ./node_modules/ramda/es/inc.js

/**
 * Increments its argument.
 *
 * @func
 * @memberOf R
 * @since v0.9.0
 * @category Math
 * @sig Number -> Number
 * @param {Number} n
 * @return {Number} n + 1
 * @see R.dec
 * @example
 *
 *      R.inc(42); //=> 43
 */

var inc =
/*#__PURE__*/
es_add(1);
/* harmony default export */ var es_inc = (inc);
// CONCATENATED MODULE: ./node_modules/ramda/es/includes.js


/**
 * Returns `true` if the specified value is equal, in [`R.equals`](#equals)
 * terms, to at least one element of the given list; `false` otherwise.
 * Works also with strings.
 *
 * @func
 * @memberOf R
 * @since v0.26.0
 * @category List
 * @sig a -> [a] -> Boolean
 * @param {Object} a The item to compare against.
 * @param {Array} list The array to consider.
 * @return {Boolean} `true` if an equivalent item is in the list, `false` otherwise.
 * @see R.any
 * @example
 *
 *      R.includes(3, [1, 2, 3]); //=> true
 *      R.includes(4, [1, 2, 3]); //=> false
 *      R.includes({ name: 'Fred' }, [{ name: 'Fred' }]); //=> true
 *      R.includes([42], [[42]]); //=> true
 *      R.includes('ba', 'banana'); //=>true
 */

var includes =
/*#__PURE__*/
_curry2(_includes);

/* harmony default export */ var es_includes = (includes);
// CONCATENATED MODULE: ./node_modules/ramda/es/indexBy.js

/**
 * Given a function that generates a key, turns a list of objects into an
 * object indexing the objects by the given key. Note that if multiple
 * objects generate the same value for the indexing key only the last value
 * will be included in the generated object.
 *
 * Acts as a transducer if a transformer is given in list position.
 *
 * @func
 * @memberOf R
 * @since v0.19.0
 * @category List
 * @sig (a -> String) -> [{k: v}] -> {k: {k: v}}
 * @param {Function} fn Function :: a -> String
 * @param {Array} array The array of objects to index
 * @return {Object} An object indexing each array element by the given property.
 * @example
 *
 *      const list = [{id: 'xyz', title: 'A'}, {id: 'abc', title: 'B'}];
 *      R.indexBy(R.prop('id'), list);
 *      //=> {abc: {id: 'abc', title: 'B'}, xyz: {id: 'xyz', title: 'A'}}
 */

var indexBy =
/*#__PURE__*/
es_reduceBy(function (acc, elem) {
  return elem;
}, null);
/* harmony default export */ var es_indexBy = (indexBy);
// CONCATENATED MODULE: ./node_modules/ramda/es/indexOf.js



/**
 * Returns the position of the first occurrence of an item in an array, or -1
 * if the item is not included in the array. [`R.equals`](#equals) is used to
 * determine equality.
 *
 * @func
 * @memberOf R
 * @since v0.1.0
 * @category List
 * @sig a -> [a] -> Number
 * @param {*} target The item to find.
 * @param {Array} xs The array to search in.
 * @return {Number} the index of the target, or -1 if the target is not found.
 * @see R.lastIndexOf
 * @example
 *
 *      R.indexOf(3, [1,2,3,4]); //=> 2
 *      R.indexOf(10, [1,2,3,4]); //=> -1
 */

var indexOf_indexOf =
/*#__PURE__*/
_curry2(function indexOf(target, xs) {
  return typeof xs.indexOf === 'function' && !_isArray(xs) ? xs.indexOf(target) : _indexOf(xs, target, 0);
});

/* harmony default export */ var es_indexOf = (indexOf_indexOf);
// CONCATENATED MODULE: ./node_modules/ramda/es/init.js

/**
 * Returns all but the last element of the given list or string.
 *
 * @func
 * @memberOf R
 * @since v0.9.0
 * @category List
 * @sig [a] -> [a]
 * @sig String -> String
 * @param {*} list
 * @return {*}
 * @see R.last, R.head, R.tail
 * @example
 *
 *      R.init([1, 2, 3]);  //=> [1, 2]
 *      R.init([1, 2]);     //=> [1]
 *      R.init([1]);        //=> []
 *      R.init([]);         //=> []
 *
 *      R.init('abc');  //=> 'ab'
 *      R.init('ab');   //=> 'a'
 *      R.init('a');    //=> ''
 *      R.init('');     //=> ''
 */

var init_init =
/*#__PURE__*/
es_slice(0, -1);
/* harmony default export */ var es_init = (init_init);
// CONCATENATED MODULE: ./node_modules/ramda/es/innerJoin.js



/**
 * Takes a predicate `pred`, a list `xs`, and a list `ys`, and returns a list
 * `xs'` comprising each of the elements of `xs` which is equal to one or more
 * elements of `ys` according to `pred`.
 *
 * `pred` must be a binary function expecting an element from each list.
 *
 * `xs`, `ys`, and `xs'` are treated as sets, semantically, so ordering should
 * not be significant, but since `xs'` is ordered the implementation guarantees
 * that its values are in the same order as they appear in `xs`. Duplicates are
 * not removed, so `xs'` may contain duplicates if `xs` contains duplicates.
 *
 * @func
 * @memberOf R
 * @since v0.24.0
 * @category Relation
 * @sig ((a, b) -> Boolean) -> [a] -> [b] -> [a]
 * @param {Function} pred
 * @param {Array} xs
 * @param {Array} ys
 * @return {Array}
 * @see R.intersection
 * @example
 *
 *      R.innerJoin(
 *        (record, id) => record.id === id,
 *        [{id: 824, name: 'Richie Furay'},
 *         {id: 956, name: 'Dewey Martin'},
 *         {id: 313, name: 'Bruce Palmer'},
 *         {id: 456, name: 'Stephen Stills'},
 *         {id: 177, name: 'Neil Young'}],
 *        [177, 456, 999]
 *      );
 *      //=> [{id: 456, name: 'Stephen Stills'}, {id: 177, name: 'Neil Young'}]
 */

var innerJoin_innerJoin =
/*#__PURE__*/
_curry3(function innerJoin(pred, xs, ys) {
  return _filter(function (x) {
    return _includesWith(pred, x, ys);
  }, xs);
});

/* harmony default export */ var es_innerJoin = (innerJoin_innerJoin);
// CONCATENATED MODULE: ./node_modules/ramda/es/insert.js

/**
 * Inserts the supplied element into the list, at the specified `index`. _Note that

 * this is not destructive_: it returns a copy of the list with the changes.
 * <small>No lists have been harmed in the application of this function.</small>
 *
 * @func
 * @memberOf R
 * @since v0.2.2
 * @category List
 * @sig Number -> a -> [a] -> [a]
 * @param {Number} index The position to insert the element
 * @param {*} elt The element to insert into the Array
 * @param {Array} list The list to insert into
 * @return {Array} A new Array with `elt` inserted at `index`.
 * @example
 *
 *      R.insert(2, 'x', [1,2,3,4]); //=> [1,2,'x',3,4]
 */

var insert =
/*#__PURE__*/
_curry3(function insert(idx, elt, list) {
  idx = idx < list.length && idx >= 0 ? idx : list.length;
  var result = Array.prototype.slice.call(list, 0);
  result.splice(idx, 0, elt);
  return result;
});

/* harmony default export */ var es_insert = (insert);
// CONCATENATED MODULE: ./node_modules/ramda/es/insertAll.js

/**
 * Inserts the sub-list into the list, at the specified `index`. _Note that this is not
 * destructive_: it returns a copy of the list with the changes.
 * <small>No lists have been harmed in the application of this function.</small>
 *
 * @func
 * @memberOf R
 * @since v0.9.0
 * @category List
 * @sig Number -> [a] -> [a] -> [a]
 * @param {Number} index The position to insert the sub-list
 * @param {Array} elts The sub-list to insert into the Array
 * @param {Array} list The list to insert the sub-list into
 * @return {Array} A new Array with `elts` inserted starting at `index`.
 * @example
 *
 *      R.insertAll(2, ['x','y','z'], [1,2,3,4]); //=> [1,2,'x','y','z',3,4]
 */

var insertAll =
/*#__PURE__*/
_curry3(function insertAll(idx, elts, list) {
  idx = idx < list.length && idx >= 0 ? idx : list.length;
  return [].concat(Array.prototype.slice.call(list, 0, idx), elts, Array.prototype.slice.call(list, idx));
});

/* harmony default export */ var es_insertAll = (insertAll);
// CONCATENATED MODULE: ./node_modules/ramda/es/uniqBy.js


/**
 * Returns a new list containing only one copy of each element in the original
 * list, based upon the value returned by applying the supplied function to
 * each list element. Prefers the first item if the supplied function produces
 * the same value on two items. [`R.equals`](#equals) is used for comparison.
 *
 * @func
 * @memberOf R
 * @since v0.16.0
 * @category List
 * @sig (a -> b) -> [a] -> [a]
 * @param {Function} fn A function used to produce a value to use during comparisons.
 * @param {Array} list The array to consider.
 * @return {Array} The list of unique items.
 * @example
 *
 *      R.uniqBy(Math.abs, [-1, -5, 2, 10, 1, 2]); //=> [-1, -5, 2, 10]
 */

var uniqBy_uniqBy =
/*#__PURE__*/
_curry2(function uniqBy(fn, list) {
  var set = new internal_Set();
  var result = [];
  var idx = 0;
  var appliedItem, item;

  while (idx < list.length) {
    item = list[idx];
    appliedItem = fn(item);

    if (set.add(appliedItem)) {
      result.push(item);
    }

    idx += 1;
  }

  return result;
});

/* harmony default export */ var es_uniqBy = (uniqBy_uniqBy);
// CONCATENATED MODULE: ./node_modules/ramda/es/uniq.js


/**
 * Returns a new list containing only one copy of each element in the original
 * list. [`R.equals`](#equals) is used to determine equality.
 *
 * @func
 * @memberOf R
 * @since v0.1.0
 * @category List
 * @sig [a] -> [a]
 * @param {Array} list The array to consider.
 * @return {Array} The list of unique items.
 * @example
 *
 *      R.uniq([1, 1, 2, 1]); //=> [1, 2]
 *      R.uniq([1, '1']);     //=> [1, '1']
 *      R.uniq([[42], [42]]); //=> [[42]]
 */

var uniq =
/*#__PURE__*/
es_uniqBy(es_identity);
/* harmony default export */ var es_uniq = (uniq);
// CONCATENATED MODULE: ./node_modules/ramda/es/intersection.js





/**
 * Combines two lists into a set (i.e. no duplicates) composed of those
 * elements common to both lists.
 *
 * @func
 * @memberOf R
 * @since v0.1.0
 * @category Relation
 * @sig [*] -> [*] -> [*]
 * @param {Array} list1 The first list.
 * @param {Array} list2 The second list.
 * @return {Array} The list of elements found in both `list1` and `list2`.
 * @see R.innerJoin
 * @example
 *
 *      R.intersection([1,2,3,4], [7,6,5,4,3]); //=> [4, 3]
 */

var intersection_intersection =
/*#__PURE__*/
_curry2(function intersection(list1, list2) {
  var lookupList, filteredList;

  if (list1.length > list2.length) {
    lookupList = list1;
    filteredList = list2;
  } else {
    lookupList = list2;
    filteredList = list1;
  }

  return es_uniq(_filter(es_flip(_includes)(lookupList), filteredList));
});

/* harmony default export */ var es_intersection = (intersection_intersection);
// CONCATENATED MODULE: ./node_modules/ramda/es/intersperse.js


/**
 * Creates a new list with the separator interposed between elements.
 *
 * Dispatches to the `intersperse` method of the second argument, if present.
 *
 * @func
 * @memberOf R
 * @since v0.14.0
 * @category List
 * @sig a -> [a] -> [a]
 * @param {*} separator The element to add to the list.
 * @param {Array} list The list to be interposed.
 * @return {Array} The new list.
 * @example
 *
 *      R.intersperse('a', ['b', 'n', 'n', 's']); //=> ['b', 'a', 'n', 'a', 'n', 'a', 's']
 */

var intersperse =
/*#__PURE__*/
_curry2(
/*#__PURE__*/
_checkForMethod('intersperse', function intersperse(separator, list) {
  var out = [];
  var idx = 0;
  var length = list.length;

  while (idx < length) {
    if (idx === length - 1) {
      out.push(list[idx]);
    } else {
      out.push(list[idx], separator);
    }

    idx += 1;
  }

  return out;
}));

/* harmony default export */ var es_intersperse = (intersperse);
// CONCATENATED MODULE: ./node_modules/ramda/es/internal/_objectAssign.js
 // Based on https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Object/assign

function _objectAssign(target) {
  if (target == null) {
    throw new TypeError('Cannot convert undefined or null to object');
  }

  var output = Object(target);
  var idx = 1;
  var length = arguments.length;

  while (idx < length) {
    var source = arguments[idx];

    if (source != null) {
      for (var nextKey in source) {
        if (_has(nextKey, source)) {
          output[nextKey] = source[nextKey];
        }
      }
    }

    idx += 1;
  }

  return output;
}

/* harmony default export */ var internal_objectAssign = (typeof Object.assign === 'function' ? Object.assign : _objectAssign);
// CONCATENATED MODULE: ./node_modules/ramda/es/objOf.js

/**
 * Creates an object containing a single key:value pair.
 *
 * @func
 * @memberOf R
 * @since v0.18.0
 * @category Object
 * @sig String -> a -> {String:a}
 * @param {String} key
 * @param {*} val
 * @return {Object}
 * @see R.pair
 * @example
 *
 *      const matchPhrases = R.compose(
 *        R.objOf('must'),
 *        R.map(R.objOf('match_phrase'))
 *      );
 *      matchPhrases(['foo', 'bar', 'baz']); //=> {must: [{match_phrase: 'foo'}, {match_phrase: 'bar'}, {match_phrase: 'baz'}]}
 */

var objOf =
/*#__PURE__*/
_curry2(function objOf(key, val) {
  var obj = {};
  obj[key] = val;
  return obj;
});

/* harmony default export */ var es_objOf = (objOf);
// CONCATENATED MODULE: ./node_modules/ramda/es/internal/_stepCat.js





var _stepCatArray = {
  '@@transducer/init': Array,
  '@@transducer/step': function (xs, x) {
    xs.push(x);
    return xs;
  },
  '@@transducer/result': _identity
};
var _stepCatString = {
  '@@transducer/init': String,
  '@@transducer/step': function (a, b) {
    return a + b;
  },
  '@@transducer/result': _identity
};
var _stepCatObject = {
  '@@transducer/init': Object,
  '@@transducer/step': function (result, input) {
    return internal_objectAssign(result, internal_isArrayLike(input) ? es_objOf(input[0], input[1]) : input);
  },
  '@@transducer/result': _identity
};
function _stepCat(obj) {
  if (_isTransformer(obj)) {
    return obj;
  }

  if (internal_isArrayLike(obj)) {
    return _stepCatArray;
  }

  if (typeof obj === 'string') {
    return _stepCatString;
  }

  if (typeof obj === 'object') {
    return _stepCatObject;
  }

  throw new Error('Cannot create transformer for ' + obj);
}
// CONCATENATED MODULE: ./node_modules/ramda/es/into.js





/**
 * Transforms the items of the list with the transducer and appends the
 * transformed items to the accumulator using an appropriate iterator function
 * based on the accumulator type.
 *
 * The accumulator can be an array, string, object or a transformer. Iterated
 * items will be appended to arrays and concatenated to strings. Objects will
 * be merged directly or 2-item arrays will be merged as key, value pairs.
 *
 * The accumulator can also be a transformer object that provides a 2-arity
 * reducing iterator function, step, 0-arity initial value function, init, and
 * 1-arity result extraction function result. The step function is used as the
 * iterator function in reduce. The result function is used to convert the
 * final accumulator into the return type and in most cases is R.identity. The
 * init function is used to provide the initial accumulator.
 *
 * The iteration is performed with [`R.reduce`](#reduce) after initializing the
 * transducer.
 *
 * @func
 * @memberOf R
 * @since v0.12.0
 * @category List
 * @sig a -> (b -> b) -> [c] -> a
 * @param {*} acc The initial accumulator value.
 * @param {Function} xf The transducer function. Receives a transformer and returns a transformer.
 * @param {Array} list The list to iterate over.
 * @return {*} The final, accumulated value.
 * @see R.transduce
 * @example
 *
 *      const numbers = [1, 2, 3, 4];
 *      const transducer = R.compose(R.map(R.add(1)), R.take(2));
 *
 *      R.into([], transducer, numbers); //=> [2, 3]
 *
 *      const intoArray = R.into([]);
 *      intoArray(transducer, numbers); //=> [2, 3]
 */

var into_into =
/*#__PURE__*/
_curry3(function into(acc, xf, list) {
  return _isTransformer(acc) ? _reduce(xf(acc), acc['@@transducer/init'](), list) : _reduce(xf(_stepCat(acc)), _clone(acc, [], [], false), list);
});

/* harmony default export */ var es_into = (into_into);
// CONCATENATED MODULE: ./node_modules/ramda/es/invert.js



/**
 * Same as [`R.invertObj`](#invertObj), however this accounts for objects with
 * duplicate values by putting the values into an array.
 *
 * @func
 * @memberOf R
 * @since v0.9.0
 * @category Object
 * @sig {s: x} -> {x: [ s, ... ]}
 * @param {Object} obj The object or array to invert
 * @return {Object} out A new object with keys in an array.
 * @see R.invertObj
 * @example
 *
 *      const raceResultsByFirstName = {
 *        first: 'alice',
 *        second: 'jake',
 *        third: 'alice',
 *      };
 *      R.invert(raceResultsByFirstName);
 *      //=> { 'alice': ['first', 'third'], 'jake':['second'] }
 */

var invert_invert =
/*#__PURE__*/
_curry1(function invert(obj) {
  var props = es_keys(obj);
  var len = props.length;
  var idx = 0;
  var out = {};

  while (idx < len) {
    var key = props[idx];
    var val = obj[key];
    var list = _has(val, out) ? out[val] : out[val] = [];
    list[list.length] = key;
    idx += 1;
  }

  return out;
});

/* harmony default export */ var es_invert = (invert_invert);
// CONCATENATED MODULE: ./node_modules/ramda/es/invertObj.js


/**
 * Returns a new object with the keys of the given object as values, and the
 * values of the given object, which are coerced to strings, as keys. Note
 * that the last key found is preferred when handling the same value.
 *
 * @func
 * @memberOf R
 * @since v0.9.0
 * @category Object
 * @sig {s: x} -> {x: s}
 * @param {Object} obj The object or array to invert
 * @return {Object} out A new object
 * @see R.invert
 * @example
 *
 *      const raceResults = {
 *        first: 'alice',
 *        second: 'jake'
 *      };
 *      R.invertObj(raceResults);
 *      //=> { 'alice': 'first', 'jake':'second' }
 *
 *      // Alternatively:
 *      const raceResults = ['alice', 'jake'];
 *      R.invertObj(raceResults);
 *      //=> { 'alice': '0', 'jake':'1' }
 */

var invertObj_invertObj =
/*#__PURE__*/
_curry1(function invertObj(obj) {
  var props = es_keys(obj);
  var len = props.length;
  var idx = 0;
  var out = {};

  while (idx < len) {
    var key = props[idx];
    out[obj[key]] = key;
    idx += 1;
  }

  return out;
});

/* harmony default export */ var es_invertObj = (invertObj_invertObj);
// CONCATENATED MODULE: ./node_modules/ramda/es/invoker.js




/**
 * Turns a named method with a specified arity into a function that can be
 * called directly supplied with arguments and a target object.
 *
 * The returned function is curried and accepts `arity + 1` parameters where
 * the final parameter is the target object.
 *
 * @func
 * @memberOf R
 * @since v0.1.0
 * @category Function
 * @sig Number -> String -> (a -> b -> ... -> n -> Object -> *)
 * @param {Number} arity Number of arguments the returned function should take
 *        before the target object.
 * @param {String} method Name of any of the target object's methods to call.
 * @return {Function} A new curried function.
 * @see R.construct
 * @example
 *
 *      const sliceFrom = R.invoker(1, 'slice');
 *      sliceFrom(6, 'abcdefghijklm'); //=> 'ghijklm'
 *      const sliceFrom6 = R.invoker(2, 'slice')(6);
 *      sliceFrom6(8, 'abcdefghijklm'); //=> 'gh'
 *
 *      const dog = {
 *        speak: async () => 'Woof!'
 *      };
 *      const speak = R.invoker(0, 'speak');
 *      speak(dog).then(console.log) //~> 'Woof!'
 *
 * @symb R.invoker(0, 'method')(o) = o['method']()
 * @symb R.invoker(1, 'method')(a, o) = o['method'](a)
 * @symb R.invoker(2, 'method')(a, b, o) = o['method'](a, b)
 */

var invoker_invoker =
/*#__PURE__*/
_curry2(function invoker(arity, method) {
  return es_curryN(arity + 1, function () {
    var target = arguments[arity];

    if (target != null && _isFunction(target[method])) {
      return target[method].apply(target, Array.prototype.slice.call(arguments, 0, arity));
    }

    throw new TypeError(es_toString(target) + ' does not have a method named "' + method + '"');
  });
});

/* harmony default export */ var es_invoker = (invoker_invoker);
// CONCATENATED MODULE: ./node_modules/ramda/es/is.js

/**
 * See if an object (`val`) is an instance of the supplied constructor. This
 * function will check up the inheritance chain, if any.
 *
 * @func
 * @memberOf R
 * @since v0.3.0
 * @category Type
 * @sig (* -> {*}) -> a -> Boolean
 * @param {Object} ctor A constructor
 * @param {*} val The value to test
 * @return {Boolean}
 * @example
 *
 *      R.is(Object, {}); //=> true
 *      R.is(Number, 1); //=> true
 *      R.is(Object, 1); //=> false
 *      R.is(String, 's'); //=> true
 *      R.is(String, new String('')); //=> true
 *      R.is(Object, new String('')); //=> true
 *      R.is(Object, 's'); //=> false
 *      R.is(Number, {}); //=> false
 */

var is =
/*#__PURE__*/
_curry2(function is(Ctor, val) {
  return val != null && val.constructor === Ctor || val instanceof Ctor;
});

/* harmony default export */ var es_is = (is);
// CONCATENATED MODULE: ./node_modules/ramda/es/isEmpty.js



/**
 * Returns `true` if the given value is its type's empty value; `false`
 * otherwise.
 *
 * @func
 * @memberOf R
 * @since v0.1.0
 * @category Logic
 * @sig a -> Boolean
 * @param {*} x
 * @return {Boolean}
 * @see R.empty
 * @example
 *
 *      R.isEmpty([1, 2, 3]);   //=> false
 *      R.isEmpty([]);          //=> true
 *      R.isEmpty('');          //=> true
 *      R.isEmpty(null);        //=> false
 *      R.isEmpty({});          //=> true
 *      R.isEmpty({length: 0}); //=> false
 */

var isEmpty_isEmpty =
/*#__PURE__*/
_curry1(function isEmpty(x) {
  return x != null && es_equals(x, es_empty(x));
});

/* harmony default export */ var es_isEmpty = (isEmpty_isEmpty);
// CONCATENATED MODULE: ./node_modules/ramda/es/join.js

/**
 * Returns a string made by inserting the `separator` between each element and
 * concatenating all the elements into a single string.
 *
 * @func
 * @memberOf R
 * @since v0.1.0
 * @category List
 * @sig String -> [a] -> String
 * @param {Number|String} separator The string used to separate the elements.
 * @param {Array} xs The elements to join into a string.
 * @return {String} str The string made by concatenating `xs` with `separator`.
 * @see R.split
 * @example
 *
 *      const spacer = R.join(' ');
 *      spacer(['a', 2, 3.4]);   //=> 'a 2 3.4'
 *      R.join('|', [1, 2, 3]);    //=> '1|2|3'
 */

var join =
/*#__PURE__*/
es_invoker(1, 'join');
/* harmony default export */ var es_join = (join);
// CONCATENATED MODULE: ./node_modules/ramda/es/juxt.js


/**
 * juxt applies a list of functions to a list of values.
 *
 * @func
 * @memberOf R
 * @since v0.19.0
 * @category Function
 * @sig [(a, b, ..., m) -> n] -> ((a, b, ..., m) -> [n])
 * @param {Array} fns An array of functions
 * @return {Function} A function that returns a list of values after applying each of the original `fns` to its parameters.
 * @see R.applySpec
 * @example
 *
 *      const getRange = R.juxt([Math.min, Math.max]);
 *      getRange(3, 4, 9, -3); //=> [-3, 9]
 * @symb R.juxt([f, g, h])(a, b) = [f(a, b), g(a, b), h(a, b)]
 */

var juxt_juxt =
/*#__PURE__*/
_curry1(function juxt(fns) {
  return es_converge(function () {
    return Array.prototype.slice.call(arguments, 0);
  }, fns);
});

/* harmony default export */ var es_juxt = (juxt_juxt);
// CONCATENATED MODULE: ./node_modules/ramda/es/keysIn.js

/**
 * Returns a list containing the names of all the properties of the supplied
 * object, including prototype properties.
 * Note that the order of the output array is not guaranteed to be consistent
 * across different JS platforms.
 *
 * @func
 * @memberOf R
 * @since v0.2.0
 * @category Object
 * @sig {k: v} -> [k]
 * @param {Object} obj The object to extract properties from
 * @return {Array} An array of the object's own and prototype properties.
 * @see R.keys, R.valuesIn
 * @example
 *
 *      const F = function() { this.x = 'X'; };
 *      F.prototype.y = 'Y';
 *      const f = new F();
 *      R.keysIn(f); //=> ['x', 'y']
 */

var keysIn =
/*#__PURE__*/
_curry1(function keysIn(obj) {
  var prop;
  var ks = [];

  for (prop in obj) {
    ks[ks.length] = prop;
  }

  return ks;
});

/* harmony default export */ var es_keysIn = (keysIn);
// CONCATENATED MODULE: ./node_modules/ramda/es/lastIndexOf.js



/**
 * Returns the position of the last occurrence of an item in an array, or -1 if
 * the item is not included in the array. [`R.equals`](#equals) is used to
 * determine equality.
 *
 * @func
 * @memberOf R
 * @since v0.1.0
 * @category List
 * @sig a -> [a] -> Number
 * @param {*} target The item to find.
 * @param {Array} xs The array to search in.
 * @return {Number} the index of the target, or -1 if the target is not found.
 * @see R.indexOf
 * @example
 *
 *      R.lastIndexOf(3, [-1,3,3,0,1,2,3,4]); //=> 6
 *      R.lastIndexOf(10, [1,2,3,4]); //=> -1
 */

var lastIndexOf_lastIndexOf =
/*#__PURE__*/
_curry2(function lastIndexOf(target, xs) {
  if (typeof xs.lastIndexOf === 'function' && !_isArray(xs)) {
    return xs.lastIndexOf(target);
  } else {
    var idx = xs.length - 1;

    while (idx >= 0) {
      if (es_equals(xs[idx], target)) {
        return idx;
      }

      idx -= 1;
    }

    return -1;
  }
});

/* harmony default export */ var es_lastIndexOf = (lastIndexOf_lastIndexOf);
// CONCATENATED MODULE: ./node_modules/ramda/es/internal/_isNumber.js
function _isNumber(x) {
  return Object.prototype.toString.call(x) === '[object Number]';
}
// CONCATENATED MODULE: ./node_modules/ramda/es/length.js


/**
 * Returns the number of elements in the array by returning `list.length`.
 *
 * @func
 * @memberOf R
 * @since v0.3.0
 * @category List
 * @sig [a] -> Number
 * @param {Array} list The array to inspect.
 * @return {Number} The length of the array.
 * @example
 *
 *      R.length([]); //=> 0
 *      R.length([1, 2, 3]); //=> 3
 */

var length_length =
/*#__PURE__*/
_curry1(function length(list) {
  return list != null && _isNumber(list.length) ? list.length : NaN;
});

/* harmony default export */ var es_length = (length_length);
// CONCATENATED MODULE: ./node_modules/ramda/es/lens.js


/**
 * Returns a lens for the given getter and setter functions. The getter "gets"
 * the value of the focus; the setter "sets" the value of the focus. The setter
 * should not mutate the data structure.
 *
 * @func
 * @memberOf R
 * @since v0.8.0
 * @category Object
 * @typedefn Lens s a = Functor f => (a -> f a) -> s -> f s
 * @sig (s -> a) -> ((a, s) -> s) -> Lens s a
 * @param {Function} getter
 * @param {Function} setter
 * @return {Lens}
 * @see R.view, R.set, R.over, R.lensIndex, R.lensProp
 * @example
 *
 *      const xLens = R.lens(R.prop('x'), R.assoc('x'));
 *
 *      R.view(xLens, {x: 1, y: 2});            //=> 1
 *      R.set(xLens, 4, {x: 1, y: 2});          //=> {x: 4, y: 2}
 *      R.over(xLens, R.negate, {x: 1, y: 2});  //=> {x: -1, y: 2}
 */

var lens_lens =
/*#__PURE__*/
_curry2(function lens(getter, setter) {
  return function (toFunctorFn) {
    return function (target) {
      return es_map(function (focus) {
        return setter(focus, target);
      }, toFunctorFn(getter(target)));
    };
  };
});

/* harmony default export */ var es_lens = (lens_lens);
// CONCATENATED MODULE: ./node_modules/ramda/es/lensIndex.js




/**
 * Returns a lens whose focus is the specified index.
 *
 * @func
 * @memberOf R
 * @since v0.14.0
 * @category Object
 * @typedefn Lens s a = Functor f => (a -> f a) -> s -> f s
 * @sig Number -> Lens s a
 * @param {Number} n
 * @return {Lens}
 * @see R.view, R.set, R.over, R.nth
 * @example
 *
 *      const headLens = R.lensIndex(0);
 *
 *      R.view(headLens, ['a', 'b', 'c']);            //=> 'a'
 *      R.set(headLens, 'x', ['a', 'b', 'c']);        //=> ['x', 'b', 'c']
 *      R.over(headLens, R.toUpper, ['a', 'b', 'c']); //=> ['A', 'b', 'c']
 */

var lensIndex_lensIndex =
/*#__PURE__*/
_curry1(function lensIndex(n) {
  return es_lens(es_nth(n), es_update(n));
});

/* harmony default export */ var es_lensIndex = (lensIndex_lensIndex);
// CONCATENATED MODULE: ./node_modules/ramda/es/lensPath.js




/**
 * Returns a lens whose focus is the specified path.
 *
 * @func
 * @memberOf R
 * @since v0.19.0
 * @category Object
 * @typedefn Idx = String | Int
 * @typedefn Lens s a = Functor f => (a -> f a) -> s -> f s
 * @sig [Idx] -> Lens s a
 * @param {Array} path The path to use.
 * @return {Lens}
 * @see R.view, R.set, R.over
 * @example
 *
 *      const xHeadYLens = R.lensPath(['x', 0, 'y']);
 *
 *      R.view(xHeadYLens, {x: [{y: 2, z: 3}, {y: 4, z: 5}]});
 *      //=> 2
 *      R.set(xHeadYLens, 1, {x: [{y: 2, z: 3}, {y: 4, z: 5}]});
 *      //=> {x: [{y: 1, z: 3}, {y: 4, z: 5}]}
 *      R.over(xHeadYLens, R.negate, {x: [{y: 2, z: 3}, {y: 4, z: 5}]});
 *      //=> {x: [{y: -2, z: 3}, {y: 4, z: 5}]}
 */

var lensPath_lensPath =
/*#__PURE__*/
_curry1(function lensPath(p) {
  return es_lens(es_path(p), es_assocPath(p));
});

/* harmony default export */ var es_lensPath = (lensPath_lensPath);
// CONCATENATED MODULE: ./node_modules/ramda/es/lensProp.js




/**
 * Returns a lens whose focus is the specified property.
 *
 * @func
 * @memberOf R
 * @since v0.14.0
 * @category Object
 * @typedefn Lens s a = Functor f => (a -> f a) -> s -> f s
 * @sig String -> Lens s a
 * @param {String} k
 * @return {Lens}
 * @see R.view, R.set, R.over
 * @example
 *
 *      const xLens = R.lensProp('x');
 *
 *      R.view(xLens, {x: 1, y: 2});            //=> 1
 *      R.set(xLens, 4, {x: 1, y: 2});          //=> {x: 4, y: 2}
 *      R.over(xLens, R.negate, {x: 1, y: 2});  //=> {x: -1, y: 2}
 */

var lensProp_lensProp =
/*#__PURE__*/
_curry1(function lensProp(k) {
  return es_lens(es_prop(k), es_assoc(k));
});

/* harmony default export */ var es_lensProp = (lensProp_lensProp);
// CONCATENATED MODULE: ./node_modules/ramda/es/lt.js

/**
 * Returns `true` if the first argument is less than the second; `false`
 * otherwise.
 *
 * @func
 * @memberOf R
 * @since v0.1.0
 * @category Relation
 * @sig Ord a => a -> a -> Boolean
 * @param {*} a
 * @param {*} b
 * @return {Boolean}
 * @see R.gt
 * @example
 *
 *      R.lt(2, 1); //=> false
 *      R.lt(2, 2); //=> false
 *      R.lt(2, 3); //=> true
 *      R.lt('a', 'z'); //=> true
 *      R.lt('z', 'a'); //=> false
 */

var lt =
/*#__PURE__*/
_curry2(function lt(a, b) {
  return a < b;
});

/* harmony default export */ var es_lt = (lt);
// CONCATENATED MODULE: ./node_modules/ramda/es/lte.js

/**
 * Returns `true` if the first argument is less than or equal to the second;
 * `false` otherwise.
 *
 * @func
 * @memberOf R
 * @since v0.1.0
 * @category Relation
 * @sig Ord a => a -> a -> Boolean
 * @param {Number} a
 * @param {Number} b
 * @return {Boolean}
 * @see R.gte
 * @example
 *
 *      R.lte(2, 1); //=> false
 *      R.lte(2, 2); //=> true
 *      R.lte(2, 3); //=> true
 *      R.lte('a', 'z'); //=> true
 *      R.lte('z', 'a'); //=> false
 */

var lte =
/*#__PURE__*/
_curry2(function lte(a, b) {
  return a <= b;
});

/* harmony default export */ var es_lte = (lte);
// CONCATENATED MODULE: ./node_modules/ramda/es/mapAccum.js

/**
 * The `mapAccum` function behaves like a combination of map and reduce; it
 * applies a function to each element of a list, passing an accumulating
 * parameter from left to right, and returning a final value of this
 * accumulator together with the new list.
 *
 * The iterator function receives two arguments, *acc* and *value*, and should
 * return a tuple *[acc, value]*.
 *
 * @func
 * @memberOf R
 * @since v0.10.0
 * @category List
 * @sig ((acc, x) -> (acc, y)) -> acc -> [x] -> (acc, [y])
 * @param {Function} fn The function to be called on every element of the input `list`.
 * @param {*} acc The accumulator value.
 * @param {Array} list The list to iterate over.
 * @return {*} The final, accumulated value.
 * @see R.scan, R.addIndex, R.mapAccumRight
 * @example
 *
 *      const digits = ['1', '2', '3', '4'];
 *      const appender = (a, b) => [a + b, a + b];
 *
 *      R.mapAccum(appender, 0, digits); //=> ['01234', ['01', '012', '0123', '01234']]
 * @symb R.mapAccum(f, a, [b, c, d]) = [
 *   f(f(f(a, b)[0], c)[0], d)[0],
 *   [
 *     f(a, b)[1],
 *     f(f(a, b)[0], c)[1],
 *     f(f(f(a, b)[0], c)[0], d)[1]
 *   ]
 * ]
 */

var mapAccum =
/*#__PURE__*/
_curry3(function mapAccum(fn, acc, list) {
  var idx = 0;
  var len = list.length;
  var result = [];
  var tuple = [acc];

  while (idx < len) {
    tuple = fn(tuple[0], list[idx]);
    result[idx] = tuple[1];
    idx += 1;
  }

  return [tuple[0], result];
});

/* harmony default export */ var es_mapAccum = (mapAccum);
// CONCATENATED MODULE: ./node_modules/ramda/es/mapAccumRight.js

/**
 * The `mapAccumRight` function behaves like a combination of map and reduce; it
 * applies a function to each element of a list, passing an accumulating
 * parameter from right to left, and returning a final value of this
 * accumulator together with the new list.
 *
 * Similar to [`mapAccum`](#mapAccum), except moves through the input list from
 * the right to the left.
 *
 * The iterator function receives two arguments, *acc* and *value*, and should
 * return a tuple *[acc, value]*.
 *
 * @func
 * @memberOf R
 * @since v0.10.0
 * @category List
 * @sig ((acc, x) -> (acc, y)) -> acc -> [x] -> (acc, [y])
 * @param {Function} fn The function to be called on every element of the input `list`.
 * @param {*} acc The accumulator value.
 * @param {Array} list The list to iterate over.
 * @return {*} The final, accumulated value.
 * @see R.addIndex, R.mapAccum
 * @example
 *
 *      const digits = ['1', '2', '3', '4'];
 *      const appender = (a, b) => [b + a, b + a];
 *
 *      R.mapAccumRight(appender, 5, digits); //=> ['12345', ['12345', '2345', '345', '45']]
 * @symb R.mapAccumRight(f, a, [b, c, d]) = [
 *   f(f(f(a, d)[0], c)[0], b)[0],
 *   [
 *     f(a, d)[1],
 *     f(f(a, d)[0], c)[1],
 *     f(f(f(a, d)[0], c)[0], b)[1]
 *   ]
 * ]
 */

var mapAccumRight =
/*#__PURE__*/
_curry3(function mapAccumRight(fn, acc, list) {
  var idx = list.length - 1;
  var result = [];
  var tuple = [acc];

  while (idx >= 0) {
    tuple = fn(tuple[0], list[idx]);
    result[idx] = tuple[1];
    idx -= 1;
  }

  return [tuple[0], result];
});

/* harmony default export */ var es_mapAccumRight = (mapAccumRight);
// CONCATENATED MODULE: ./node_modules/ramda/es/mapObjIndexed.js



/**
 * An Object-specific version of [`map`](#map). The function is applied to three
 * arguments: *(value, key, obj)*. If only the value is significant, use
 * [`map`](#map) instead.
 *
 * @func
 * @memberOf R
 * @since v0.9.0
 * @category Object
 * @sig ((*, String, Object) -> *) -> Object -> Object
 * @param {Function} fn
 * @param {Object} obj
 * @return {Object}
 * @see R.map
 * @example
 *
 *      const xyz = { x: 1, y: 2, z: 3 };
 *      const prependKeyAndDouble = (num, key, obj) => key + (num * 2);
 *
 *      R.mapObjIndexed(prependKeyAndDouble, xyz); //=> { x: 'x2', y: 'y4', z: 'z6' }
 */

var mapObjIndexed_mapObjIndexed =
/*#__PURE__*/
_curry2(function mapObjIndexed(fn, obj) {
  return _reduce(function (acc, key) {
    acc[key] = fn(obj[key], key, obj);
    return acc;
  }, {}, es_keys(obj));
});

/* harmony default export */ var es_mapObjIndexed = (mapObjIndexed_mapObjIndexed);
// CONCATENATED MODULE: ./node_modules/ramda/es/match.js

/**
 * Tests a regular expression against a String. Note that this function will
 * return an empty array when there are no matches. This differs from
 * [`String.prototype.match`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/match)
 * which returns `null` when there are no matches.
 *
 * @func
 * @memberOf R
 * @since v0.1.0
 * @category String
 * @sig RegExp -> String -> [String | Undefined]
 * @param {RegExp} rx A regular expression.
 * @param {String} str The string to match against
 * @return {Array} The list of matches or empty array.
 * @see R.test
 * @example
 *
 *      R.match(/([a-z]a)/g, 'bananas'); //=> ['ba', 'na', 'na']
 *      R.match(/a/, 'b'); //=> []
 *      R.match(/a/, null); //=> TypeError: null does not have a method named "match"
 */

var match =
/*#__PURE__*/
_curry2(function match(rx, str) {
  return str.match(rx) || [];
});

/* harmony default export */ var es_match = (match);
// CONCATENATED MODULE: ./node_modules/ramda/es/mathMod.js


/**
 * `mathMod` behaves like the modulo operator should mathematically, unlike the
 * `%` operator (and by extension, [`R.modulo`](#modulo)). So while
 * `-17 % 5` is `-2`, `mathMod(-17, 5)` is `3`. `mathMod` requires Integer
 * arguments, and returns NaN when the modulus is zero or negative.
 *
 * @func
 * @memberOf R
 * @since v0.3.0
 * @category Math
 * @sig Number -> Number -> Number
 * @param {Number} m The dividend.
 * @param {Number} p the modulus.
 * @return {Number} The result of `b mod a`.
 * @see R.modulo
 * @example
 *
 *      R.mathMod(-17, 5);  //=> 3
 *      R.mathMod(17, 5);   //=> 2
 *      R.mathMod(17, -5);  //=> NaN
 *      R.mathMod(17, 0);   //=> NaN
 *      R.mathMod(17.2, 5); //=> NaN
 *      R.mathMod(17, 5.3); //=> NaN
 *
 *      const clock = R.mathMod(R.__, 12);
 *      clock(15); //=> 3
 *      clock(24); //=> 0
 *
 *      const seventeenMod = R.mathMod(17);
 *      seventeenMod(3);  //=> 2
 *      seventeenMod(4);  //=> 1
 *      seventeenMod(10); //=> 7
 */

var mathMod_mathMod =
/*#__PURE__*/
_curry2(function mathMod(m, p) {
  if (!_isInteger(m)) {
    return NaN;
  }

  if (!_isInteger(p) || p < 1) {
    return NaN;
  }

  return (m % p + p) % p;
});

/* harmony default export */ var es_mathMod = (mathMod_mathMod);
// CONCATENATED MODULE: ./node_modules/ramda/es/maxBy.js

/**
 * Takes a function and two values, and returns whichever value produces the
 * larger result when passed to the provided function.
 *
 * @func
 * @memberOf R
 * @since v0.8.0
 * @category Relation
 * @sig Ord b => (a -> b) -> a -> a -> a
 * @param {Function} f
 * @param {*} a
 * @param {*} b
 * @return {*}
 * @see R.max, R.minBy
 * @example
 *
 *      //  square :: Number -> Number
 *      const square = n => n * n;
 *
 *      R.maxBy(square, -3, 2); //=> -3
 *
 *      R.reduce(R.maxBy(square), 0, [3, -5, 4, 1, -2]); //=> -5
 *      R.reduce(R.maxBy(square), 0, []); //=> 0
 */

var maxBy =
/*#__PURE__*/
_curry3(function maxBy(f, a, b) {
  return f(b) > f(a) ? b : a;
});

/* harmony default export */ var es_maxBy = (maxBy);
// CONCATENATED MODULE: ./node_modules/ramda/es/sum.js


/**
 * Adds together all the elements of a list.
 *
 * @func
 * @memberOf R
 * @since v0.1.0
 * @category Math
 * @sig [Number] -> Number
 * @param {Array} list An array of numbers
 * @return {Number} The sum of all the numbers in the list.
 * @see R.reduce
 * @example
 *
 *      R.sum([2,4,6,8,100,1]); //=> 121
 */

var sum =
/*#__PURE__*/
es_reduce(es_add, 0);
/* harmony default export */ var es_sum = (sum);
// CONCATENATED MODULE: ./node_modules/ramda/es/mean.js


/**
 * Returns the mean of the given list of numbers.
 *
 * @func
 * @memberOf R
 * @since v0.14.0
 * @category Math
 * @sig [Number] -> Number
 * @param {Array} list
 * @return {Number}
 * @see R.median
 * @example
 *
 *      R.mean([2, 7, 9]); //=> 6
 *      R.mean([]); //=> NaN
 */

var mean_mean =
/*#__PURE__*/
_curry1(function mean(list) {
  return es_sum(list) / list.length;
});

/* harmony default export */ var es_mean = (mean_mean);
// CONCATENATED MODULE: ./node_modules/ramda/es/median.js


/**
 * Returns the median of the given list of numbers.
 *
 * @func
 * @memberOf R
 * @since v0.14.0
 * @category Math
 * @sig [Number] -> Number
 * @param {Array} list
 * @return {Number}
 * @see R.mean
 * @example
 *
 *      R.median([2, 9, 7]); //=> 7
 *      R.median([7, 2, 10, 9]); //=> 8
 *      R.median([]); //=> NaN
 */

var median_median =
/*#__PURE__*/
_curry1(function median(list) {
  var len = list.length;

  if (len === 0) {
    return NaN;
  }

  var width = 2 - len % 2;
  var idx = (len - width) / 2;
  return es_mean(Array.prototype.slice.call(list, 0).sort(function (a, b) {
    return a < b ? -1 : a > b ? 1 : 0;
  }).slice(idx, idx + width));
});

/* harmony default export */ var es_median = (median_median);
// CONCATENATED MODULE: ./node_modules/ramda/es/memoizeWith.js



/**
 * Creates a new function that, when invoked, caches the result of calling `fn`
 * for a given argument set and returns the result. Subsequent calls to the
 * memoized `fn` with the same argument set will not result in an additional
 * call to `fn`; instead, the cached result for that set of arguments will be
 * returned.
 *
 *
 * @func
 * @memberOf R
 * @since v0.24.0
 * @category Function
 * @sig (*... -> String) -> (*... -> a) -> (*... -> a)
 * @param {Function} fn The function to generate the cache key.
 * @param {Function} fn The function to memoize.
 * @return {Function} Memoized version of `fn`.
 * @example
 *
 *      let count = 0;
 *      const factorial = R.memoizeWith(R.identity, n => {
 *        count += 1;
 *        return R.product(R.range(1, n + 1));
 *      });
 *      factorial(5); //=> 120
 *      factorial(5); //=> 120
 *      factorial(5); //=> 120
 *      count; //=> 1
 */

var memoizeWith_memoizeWith =
/*#__PURE__*/
_curry2(function memoizeWith(mFn, fn) {
  var cache = {};
  return _arity(fn.length, function () {
    var key = mFn.apply(this, arguments);

    if (!_has(key, cache)) {
      cache[key] = fn.apply(this, arguments);
    }

    return cache[key];
  });
});

/* harmony default export */ var es_memoizeWith = (memoizeWith_memoizeWith);
// CONCATENATED MODULE: ./node_modules/ramda/es/merge.js


/**
 * Create a new object with the own properties of the first object merged with
 * the own properties of the second object. If a key exists in both objects,
 * the value from the second object will be used.
 *
 * @func
 * @memberOf R
 * @since v0.1.0
 * @category Object
 * @sig {k: v} -> {k: v} -> {k: v}
 * @param {Object} l
 * @param {Object} r
 * @return {Object}
 * @see R.mergeRight, R.mergeDeepRight, R.mergeWith, R.mergeWithKey
 * @deprecated since v0.26.0
 * @example
 *
 *      R.merge({ 'name': 'fred', 'age': 10 }, { 'age': 40 });
 *      //=> { 'name': 'fred', 'age': 40 }
 *
 *      const withDefaults = R.merge({x: 0, y: 0});
 *      withDefaults({y: 2}); //=> {x: 0, y: 2}
 * @symb R.merge(a, b) = {...a, ...b}
 */

var merge_merge =
/*#__PURE__*/
_curry2(function merge(l, r) {
  return internal_objectAssign({}, l, r);
});

/* harmony default export */ var es_merge = (merge_merge);
// CONCATENATED MODULE: ./node_modules/ramda/es/mergeAll.js


/**
 * Merges a list of objects together into one object.
 *
 * @func
 * @memberOf R
 * @since v0.10.0
 * @category List
 * @sig [{k: v}] -> {k: v}
 * @param {Array} list An array of objects
 * @return {Object} A merged object.
 * @see R.reduce
 * @example
 *
 *      R.mergeAll([{foo:1},{bar:2},{baz:3}]); //=> {foo:1,bar:2,baz:3}
 *      R.mergeAll([{foo:1},{foo:2},{bar:2}]); //=> {foo:2,bar:2}
 * @symb R.mergeAll([{ x: 1 }, { y: 2 }, { z: 3 }]) = { x: 1, y: 2, z: 3 }
 */

var mergeAll_mergeAll =
/*#__PURE__*/
_curry1(function mergeAll(list) {
  return internal_objectAssign.apply(null, [{}].concat(list));
});

/* harmony default export */ var es_mergeAll = (mergeAll_mergeAll);
// CONCATENATED MODULE: ./node_modules/ramda/es/mergeWithKey.js


/**
 * Creates a new object with the own properties of the two provided objects. If
 * a key exists in both objects, the provided function is applied to the key
 * and the values associated with the key in each object, with the result being
 * used as the value associated with the key in the returned object.
 *
 * @func
 * @memberOf R
 * @since v0.19.0
 * @category Object
 * @sig ((String, a, a) -> a) -> {a} -> {a} -> {a}
 * @param {Function} fn
 * @param {Object} l
 * @param {Object} r
 * @return {Object}
 * @see R.mergeDeepWithKey, R.merge, R.mergeWith
 * @example
 *
 *      let concatValues = (k, l, r) => k == 'values' ? R.concat(l, r) : r
 *      R.mergeWithKey(concatValues,
 *                     { a: true, thing: 'foo', values: [10, 20] },
 *                     { b: true, thing: 'bar', values: [15, 35] });
 *      //=> { a: true, b: true, thing: 'bar', values: [10, 20, 15, 35] }
 * @symb R.mergeWithKey(f, { x: 1, y: 2 }, { y: 5, z: 3 }) = { x: 1, y: f('y', 2, 5), z: 3 }
 */

var mergeWithKey_mergeWithKey =
/*#__PURE__*/
_curry3(function mergeWithKey(fn, l, r) {
  var result = {};
  var k;

  for (k in l) {
    if (_has(k, l)) {
      result[k] = _has(k, r) ? fn(k, l[k], r[k]) : l[k];
    }
  }

  for (k in r) {
    if (_has(k, r) && !_has(k, result)) {
      result[k] = r[k];
    }
  }

  return result;
});

/* harmony default export */ var es_mergeWithKey = (mergeWithKey_mergeWithKey);
// CONCATENATED MODULE: ./node_modules/ramda/es/mergeDeepWithKey.js



/**
 * Creates a new object with the own properties of the two provided objects.
 * If a key exists in both objects:
 * - and both associated values are also objects then the values will be
 *   recursively merged.
 * - otherwise the provided function is applied to the key and associated values
 *   using the resulting value as the new value associated with the key.
 * If a key only exists in one object, the value will be associated with the key
 * of the resulting object.
 *
 * @func
 * @memberOf R
 * @since v0.24.0
 * @category Object
 * @sig ((String, a, a) -> a) -> {a} -> {a} -> {a}
 * @param {Function} fn
 * @param {Object} lObj
 * @param {Object} rObj
 * @return {Object}
 * @see R.mergeWithKey, R.mergeDeepWith
 * @example
 *
 *      let concatValues = (k, l, r) => k == 'values' ? R.concat(l, r) : r
 *      R.mergeDeepWithKey(concatValues,
 *                         { a: true, c: { thing: 'foo', values: [10, 20] }},
 *                         { b: true, c: { thing: 'bar', values: [15, 35] }});
 *      //=> { a: true, b: true, c: { thing: 'bar', values: [10, 20, 15, 35] }}
 */

var mergeDeepWithKey_mergeDeepWithKey =
/*#__PURE__*/
_curry3(function mergeDeepWithKey(fn, lObj, rObj) {
  return es_mergeWithKey(function (k, lVal, rVal) {
    if (_isObject(lVal) && _isObject(rVal)) {
      return mergeDeepWithKey(fn, lVal, rVal);
    } else {
      return fn(k, lVal, rVal);
    }
  }, lObj, rObj);
});

/* harmony default export */ var es_mergeDeepWithKey = (mergeDeepWithKey_mergeDeepWithKey);
// CONCATENATED MODULE: ./node_modules/ramda/es/mergeDeepLeft.js


/**
 * Creates a new object with the own properties of the first object merged with
 * the own properties of the second object. If a key exists in both objects:
 * - and both values are objects, the two values will be recursively merged
 * - otherwise the value from the first object will be used.
 *
 * @func
 * @memberOf R
 * @since v0.24.0
 * @category Object
 * @sig {a} -> {a} -> {a}
 * @param {Object} lObj
 * @param {Object} rObj
 * @return {Object}
 * @see R.merge, R.mergeDeepRight, R.mergeDeepWith, R.mergeDeepWithKey
 * @example
 *
 *      R.mergeDeepLeft({ name: 'fred', age: 10, contact: { email: 'moo@example.com' }},
 *                      { age: 40, contact: { email: 'baa@example.com' }});
 *      //=> { name: 'fred', age: 10, contact: { email: 'moo@example.com' }}
 */

var mergeDeepLeft_mergeDeepLeft =
/*#__PURE__*/
_curry2(function mergeDeepLeft(lObj, rObj) {
  return es_mergeDeepWithKey(function (k, lVal, rVal) {
    return lVal;
  }, lObj, rObj);
});

/* harmony default export */ var es_mergeDeepLeft = (mergeDeepLeft_mergeDeepLeft);
// CONCATENATED MODULE: ./node_modules/ramda/es/mergeDeepRight.js


/**
 * Creates a new object with the own properties of the first object merged with
 * the own properties of the second object. If a key exists in both objects:
 * - and both values are objects, the two values will be recursively merged
 * - otherwise the value from the second object will be used.
 *
 * @func
 * @memberOf R
 * @since v0.24.0
 * @category Object
 * @sig {a} -> {a} -> {a}
 * @param {Object} lObj
 * @param {Object} rObj
 * @return {Object}
 * @see R.merge, R.mergeDeepLeft, R.mergeDeepWith, R.mergeDeepWithKey
 * @example
 *
 *      R.mergeDeepRight({ name: 'fred', age: 10, contact: { email: 'moo@example.com' }},
 *                       { age: 40, contact: { email: 'baa@example.com' }});
 *      //=> { name: 'fred', age: 40, contact: { email: 'baa@example.com' }}
 */

var mergeDeepRight_mergeDeepRight =
/*#__PURE__*/
_curry2(function mergeDeepRight(lObj, rObj) {
  return es_mergeDeepWithKey(function (k, lVal, rVal) {
    return rVal;
  }, lObj, rObj);
});

/* harmony default export */ var es_mergeDeepRight = (mergeDeepRight_mergeDeepRight);
// CONCATENATED MODULE: ./node_modules/ramda/es/mergeDeepWith.js


/**
 * Creates a new object with the own properties of the two provided objects.
 * If a key exists in both objects:
 * - and both associated values are also objects then the values will be
 *   recursively merged.
 * - otherwise the provided function is applied to associated values using the
 *   resulting value as the new value associated with the key.
 * If a key only exists in one object, the value will be associated with the key
 * of the resulting object.
 *
 * @func
 * @memberOf R
 * @since v0.24.0
 * @category Object
 * @sig ((a, a) -> a) -> {a} -> {a} -> {a}
 * @param {Function} fn
 * @param {Object} lObj
 * @param {Object} rObj
 * @return {Object}
 * @see R.mergeWith, R.mergeDeepWithKey
 * @example
 *
 *      R.mergeDeepWith(R.concat,
 *                      { a: true, c: { values: [10, 20] }},
 *                      { b: true, c: { values: [15, 35] }});
 *      //=> { a: true, b: true, c: { values: [10, 20, 15, 35] }}
 */

var mergeDeepWith_mergeDeepWith =
/*#__PURE__*/
_curry3(function mergeDeepWith(fn, lObj, rObj) {
  return es_mergeDeepWithKey(function (k, lVal, rVal) {
    return fn(lVal, rVal);
  }, lObj, rObj);
});

/* harmony default export */ var es_mergeDeepWith = (mergeDeepWith_mergeDeepWith);
// CONCATENATED MODULE: ./node_modules/ramda/es/mergeLeft.js


/**
 * Create a new object with the own properties of the first object merged with
 * the own properties of the second object. If a key exists in both objects,
 * the value from the first object will be used.
 *
 * @func
 * @memberOf R
 * @since v0.26.0
 * @category Object
 * @sig {k: v} -> {k: v} -> {k: v}
 * @param {Object} l
 * @param {Object} r
 * @return {Object}
 * @see R.mergeRight, R.mergeDeepLeft, R.mergeWith, R.mergeWithKey
 * @example
 *
 *      R.mergeLeft({ 'age': 40 }, { 'name': 'fred', 'age': 10 });
 *      //=> { 'name': 'fred', 'age': 40 }
 *
 *      const resetToDefault = R.mergeLeft({x: 0});
 *      resetToDefault({x: 5, y: 2}); //=> {x: 0, y: 2}
 * @symb R.mergeLeft(a, b) = {...b, ...a}
 */

var mergeLeft_mergeLeft =
/*#__PURE__*/
_curry2(function mergeLeft(l, r) {
  return internal_objectAssign({}, r, l);
});

/* harmony default export */ var es_mergeLeft = (mergeLeft_mergeLeft);
// CONCATENATED MODULE: ./node_modules/ramda/es/mergeRight.js


/**
 * Create a new object with the own properties of the first object merged with
 * the own properties of the second object. If a key exists in both objects,
 * the value from the second object will be used.
 *
 * @func
 * @memberOf R
 * @since v0.26.0
 * @category Object
 * @sig {k: v} -> {k: v} -> {k: v}
 * @param {Object} l
 * @param {Object} r
 * @return {Object}
 * @see R.mergeLeft, R.mergeDeepRight, R.mergeWith, R.mergeWithKey
 * @example
 *
 *      R.mergeRight({ 'name': 'fred', 'age': 10 }, { 'age': 40 });
 *      //=> { 'name': 'fred', 'age': 40 }
 *
 *      const withDefaults = R.mergeRight({x: 0, y: 0});
 *      withDefaults({y: 2}); //=> {x: 0, y: 2}
 * @symb R.mergeRight(a, b) = {...a, ...b}
 */

var mergeRight_mergeRight =
/*#__PURE__*/
_curry2(function mergeRight(l, r) {
  return internal_objectAssign({}, l, r);
});

/* harmony default export */ var es_mergeRight = (mergeRight_mergeRight);
// CONCATENATED MODULE: ./node_modules/ramda/es/mergeWith.js


/**
 * Creates a new object with the own properties of the two provided objects. If
 * a key exists in both objects, the provided function is applied to the values
 * associated with the key in each object, with the result being used as the
 * value associated with the key in the returned object.
 *
 * @func
 * @memberOf R
 * @since v0.19.0
 * @category Object
 * @sig ((a, a) -> a) -> {a} -> {a} -> {a}
 * @param {Function} fn
 * @param {Object} l
 * @param {Object} r
 * @return {Object}
 * @see R.mergeDeepWith, R.merge, R.mergeWithKey
 * @example
 *
 *      R.mergeWith(R.concat,
 *                  { a: true, values: [10, 20] },
 *                  { b: true, values: [15, 35] });
 *      //=> { a: true, b: true, values: [10, 20, 15, 35] }
 */

var mergeWith_mergeWith =
/*#__PURE__*/
_curry3(function mergeWith(fn, l, r) {
  return es_mergeWithKey(function (_, _l, _r) {
    return fn(_l, _r);
  }, l, r);
});

/* harmony default export */ var es_mergeWith = (mergeWith_mergeWith);
// CONCATENATED MODULE: ./node_modules/ramda/es/min.js

/**
 * Returns the smaller of its two arguments.
 *
 * @func
 * @memberOf R
 * @since v0.1.0
 * @category Relation
 * @sig Ord a => a -> a -> a
 * @param {*} a
 * @param {*} b
 * @return {*}
 * @see R.minBy, R.max
 * @example
 *
 *      R.min(789, 123); //=> 123
 *      R.min('a', 'b'); //=> 'a'
 */

var min =
/*#__PURE__*/
_curry2(function min(a, b) {
  return b < a ? b : a;
});

/* harmony default export */ var es_min = (min);
// CONCATENATED MODULE: ./node_modules/ramda/es/minBy.js

/**
 * Takes a function and two values, and returns whichever value produces the
 * smaller result when passed to the provided function.
 *
 * @func
 * @memberOf R
 * @since v0.8.0
 * @category Relation
 * @sig Ord b => (a -> b) -> a -> a -> a
 * @param {Function} f
 * @param {*} a
 * @param {*} b
 * @return {*}
 * @see R.min, R.maxBy
 * @example
 *
 *      //  square :: Number -> Number
 *      const square = n => n * n;
 *
 *      R.minBy(square, -3, 2); //=> 2
 *
 *      R.reduce(R.minBy(square), Infinity, [3, -5, 4, 1, -2]); //=> 1
 *      R.reduce(R.minBy(square), Infinity, []); //=> Infinity
 */

var minBy =
/*#__PURE__*/
_curry3(function minBy(f, a, b) {
  return f(b) < f(a) ? b : a;
});

/* harmony default export */ var es_minBy = (minBy);
// CONCATENATED MODULE: ./node_modules/ramda/es/modulo.js

/**
 * Divides the first parameter by the second and returns the remainder. Note
 * that this function preserves the JavaScript-style behavior for modulo. For
 * mathematical modulo see [`mathMod`](#mathMod).
 *
 * @func
 * @memberOf R
 * @since v0.1.1
 * @category Math
 * @sig Number -> Number -> Number
 * @param {Number} a The value to the divide.
 * @param {Number} b The pseudo-modulus
 * @return {Number} The result of `b % a`.
 * @see R.mathMod
 * @example
 *
 *      R.modulo(17, 3); //=> 2
 *      // JS behavior:
 *      R.modulo(-17, 3); //=> -2
 *      R.modulo(17, -3); //=> 2
 *
 *      const isOdd = R.modulo(R.__, 2);
 *      isOdd(42); //=> 0
 *      isOdd(21); //=> 1
 */

var modulo =
/*#__PURE__*/
_curry2(function modulo(a, b) {
  return a % b;
});

/* harmony default export */ var es_modulo = (modulo);
// CONCATENATED MODULE: ./node_modules/ramda/es/move.js

/**
 * Move an item, at index `from`, to index `to`, in a list of elements.
 * A new list will be created containing the new elements order.
 *
 * @func
 * @memberOf R
 * @since v0.27.0
 * @category List
 * @sig Number -> Number -> [a] -> [a]
 * @param {Number} from The source index
 * @param {Number} to The destination index
 * @param {Array} list The list which will serve to realise the move
 * @return {Array} The new list reordered
 * @example
 *
 *      R.move(0, 2, ['a', 'b', 'c', 'd', 'e', 'f']); //=> ['b', 'c', 'a', 'd', 'e', 'f']
 *      R.move(-1, 0, ['a', 'b', 'c', 'd', 'e', 'f']); //=> ['f', 'a', 'b', 'c', 'd', 'e'] list rotation
 */

var move =
/*#__PURE__*/
_curry3(function (from, to, list) {
  var length = list.length;
  var result = list.slice();
  var positiveFrom = from < 0 ? length + from : from;
  var positiveTo = to < 0 ? length + to : to;
  var item = result.splice(positiveFrom, 1);
  return positiveFrom < 0 || positiveFrom >= list.length || positiveTo < 0 || positiveTo >= list.length ? list : [].concat(result.slice(0, positiveTo)).concat(item).concat(result.slice(positiveTo, list.length));
});

/* harmony default export */ var es_move = (move);
// CONCATENATED MODULE: ./node_modules/ramda/es/multiply.js

/**
 * Multiplies two numbers. Equivalent to `a * b` but curried.
 *
 * @func
 * @memberOf R
 * @since v0.1.0
 * @category Math
 * @sig Number -> Number -> Number
 * @param {Number} a The first value.
 * @param {Number} b The second value.
 * @return {Number} The result of `a * b`.
 * @see R.divide
 * @example
 *
 *      const double = R.multiply(2);
 *      const triple = R.multiply(3);
 *      double(3);       //=>  6
 *      triple(4);       //=> 12
 *      R.multiply(2, 5);  //=> 10
 */

var multiply =
/*#__PURE__*/
_curry2(function multiply(a, b) {
  return a * b;
});

/* harmony default export */ var es_multiply = (multiply);
// CONCATENATED MODULE: ./node_modules/ramda/es/negate.js

/**
 * Negates its argument.
 *
 * @func
 * @memberOf R
 * @since v0.9.0
 * @category Math
 * @sig Number -> Number
 * @param {Number} n
 * @return {Number}
 * @example
 *
 *      R.negate(42); //=> -42
 */

var negate =
/*#__PURE__*/
_curry1(function negate(n) {
  return -n;
});

/* harmony default export */ var es_negate = (negate);
// CONCATENATED MODULE: ./node_modules/ramda/es/none.js



/**
 * Returns `true` if no elements of the list match the predicate, `false`
 * otherwise.
 *
 * Dispatches to the `all` method of the second argument, if present.
 *
 * Acts as a transducer if a transformer is given in list position.
 *
 * @func
 * @memberOf R
 * @since v0.12.0
 * @category List
 * @sig (a -> Boolean) -> [a] -> Boolean
 * @param {Function} fn The predicate function.
 * @param {Array} list The array to consider.
 * @return {Boolean} `true` if the predicate is not satisfied by every element, `false` otherwise.
 * @see R.all, R.any
 * @example
 *
 *      const isEven = n => n % 2 === 0;
 *      const isOdd = n => n % 2 === 1;
 *
 *      R.none(isEven, [1, 3, 5, 7, 9, 11]); //=> true
 *      R.none(isOdd, [1, 3, 5, 7, 8, 11]); //=> false
 */

var none_none =
/*#__PURE__*/
_curry2(function none(fn, input) {
  return es_all(_complement(fn), input);
});

/* harmony default export */ var es_none = (none_none);
// CONCATENATED MODULE: ./node_modules/ramda/es/nthArg.js



/**
 * Returns a function which returns its nth argument.
 *
 * @func
 * @memberOf R
 * @since v0.9.0
 * @category Function
 * @sig Number -> *... -> *
 * @param {Number} n
 * @return {Function}
 * @example
 *
 *      R.nthArg(1)('a', 'b', 'c'); //=> 'b'
 *      R.nthArg(-1)('a', 'b', 'c'); //=> 'c'
 * @symb R.nthArg(-1)(a, b, c) = c
 * @symb R.nthArg(0)(a, b, c) = a
 * @symb R.nthArg(1)(a, b, c) = b
 */

var nthArg_nthArg =
/*#__PURE__*/
_curry1(function nthArg(n) {
  var arity = n < 0 ? 1 : n + 1;
  return es_curryN(arity, function () {
    return es_nth(n, arguments);
  });
});

/* harmony default export */ var es_nthArg = (nthArg_nthArg);
// CONCATENATED MODULE: ./node_modules/ramda/es/o.js

/**
 * `o` is a curried composition function that returns a unary function.
 * Like [`compose`](#compose), `o` performs right-to-left function composition.
 * Unlike [`compose`](#compose), the rightmost function passed to `o` will be
 * invoked with only one argument. Also, unlike [`compose`](#compose), `o` is
 * limited to accepting only 2 unary functions. The name o was chosen because
 * of its similarity to the mathematical composition operator ∘.
 *
 * @func
 * @memberOf R
 * @since v0.24.0
 * @category Function
 * @sig (b -> c) -> (a -> b) -> a -> c
 * @param {Function} f
 * @param {Function} g
 * @return {Function}
 * @see R.compose, R.pipe
 * @example
 *
 *      const classyGreeting = name => "The name's " + name.last + ", " + name.first + " " + name.last
 *      const yellGreeting = R.o(R.toUpper, classyGreeting);
 *      yellGreeting({first: 'James', last: 'Bond'}); //=> "THE NAME'S BOND, JAMES BOND"
 *
 *      R.o(R.multiply(10), R.add(10))(-4) //=> 60
 *
 * @symb R.o(f, g, x) = f(g(x))
 */

var o =
/*#__PURE__*/
_curry3(function o(f, g, x) {
  return f(g(x));
});

/* harmony default export */ var es_o = (o);
// CONCATENATED MODULE: ./node_modules/ramda/es/internal/_of.js
function _of(x) {
  return [x];
}
// CONCATENATED MODULE: ./node_modules/ramda/es/of.js


/**
 * Returns a singleton array containing the value provided.
 *
 * Note this `of` is different from the ES6 `of`; See
 * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/of
 *
 * @func
 * @memberOf R
 * @since v0.3.0
 * @category Function
 * @sig a -> [a]
 * @param {*} x any value
 * @return {Array} An array wrapping `x`.
 * @example
 *
 *      R.of(null); //=> [null]
 *      R.of([42]); //=> [[42]]
 */

var of_of =
/*#__PURE__*/
_curry1(_of);

/* harmony default export */ var es_of = (of_of);
// CONCATENATED MODULE: ./node_modules/ramda/es/omit.js

/**
 * Returns a partial copy of an object omitting the keys specified.
 *
 * @func
 * @memberOf R
 * @since v0.1.0
 * @category Object
 * @sig [String] -> {String: *} -> {String: *}
 * @param {Array} names an array of String property names to omit from the new object
 * @param {Object} obj The object to copy from
 * @return {Object} A new object with properties from `names` not on it.
 * @see R.pick
 * @example
 *
 *      R.omit(['a', 'd'], {a: 1, b: 2, c: 3, d: 4}); //=> {b: 2, c: 3}
 */

var omit =
/*#__PURE__*/
_curry2(function omit(names, obj) {
  var result = {};
  var index = {};
  var idx = 0;
  var len = names.length;

  while (idx < len) {
    index[names[idx]] = 1;
    idx += 1;
  }

  for (var prop in obj) {
    if (!index.hasOwnProperty(prop)) {
      result[prop] = obj[prop];
    }
  }

  return result;
});

/* harmony default export */ var es_omit = (omit);
// CONCATENATED MODULE: ./node_modules/ramda/es/once.js


/**
 * Accepts a function `fn` and returns a function that guards invocation of
 * `fn` such that `fn` can only ever be called once, no matter how many times
 * the returned function is invoked. The first value calculated is returned in
 * subsequent invocations.
 *
 * @func
 * @memberOf R
 * @since v0.1.0
 * @category Function
 * @sig (a... -> b) -> (a... -> b)
 * @param {Function} fn The function to wrap in a call-only-once wrapper.
 * @return {Function} The wrapped function.
 * @example
 *
 *      const addOneOnce = R.once(x => x + 1);
 *      addOneOnce(10); //=> 11
 *      addOneOnce(addOneOnce(50)); //=> 11
 */

var once_once =
/*#__PURE__*/
_curry1(function once(fn) {
  var called = false;
  var result;
  return _arity(fn.length, function () {
    if (called) {
      return result;
    }

    called = true;
    result = fn.apply(this, arguments);
    return result;
  });
});

/* harmony default export */ var es_once = (once_once);
// CONCATENATED MODULE: ./node_modules/ramda/es/internal/_assertPromise.js


function _assertPromise(name, p) {
  if (p == null || !_isFunction(p.then)) {
    throw new TypeError('`' + name + '` expected a Promise, received ' + _toString(p, []));
  }
}
// CONCATENATED MODULE: ./node_modules/ramda/es/otherwise.js


/**
 * Returns the result of applying the onFailure function to the value inside
 * a failed promise. This is useful for handling rejected promises
 * inside function compositions.
 *
 * @func
 * @memberOf R
 * @since v0.26.0
 * @category Function
 * @sig (e -> b) -> (Promise e a) -> (Promise e b)
 * @sig (e -> (Promise f b)) -> (Promise e a) -> (Promise f b)
 * @param {Function} onFailure The function to apply. Can return a value or a promise of a value.
 * @param {Promise} p
 * @return {Promise} The result of calling `p.then(null, onFailure)`
 * @see R.then
 * @example
 *
 *      var failedFetch = (id) => Promise.reject('bad ID');
 *      var useDefault = () => ({ firstName: 'Bob', lastName: 'Loblaw' })
 *
 *      //recoverFromFailure :: String -> Promise ({firstName, lastName})
 *      var recoverFromFailure = R.pipe(
 *        failedFetch,
 *        R.otherwise(useDefault),
 *        R.then(R.pick(['firstName', 'lastName'])),
 *      );
 *      recoverFromFailure(12345).then(console.log)
 */

var otherwise_otherwise =
/*#__PURE__*/
_curry2(function otherwise(f, p) {
  _assertPromise('otherwise', p);

  return p.then(null, f);
});

/* harmony default export */ var es_otherwise = (otherwise_otherwise);
// CONCATENATED MODULE: ./node_modules/ramda/es/over.js
 // `Identity` is a functor that holds a single value, where `map` simply
// transforms the held value with the provided function.

var Identity = function (x) {
  return {
    value: x,
    map: function (f) {
      return Identity(f(x));
    }
  };
};
/**
 * Returns the result of "setting" the portion of the given data structure
 * focused by the given lens to the result of applying the given function to
 * the focused value.
 *
 * @func
 * @memberOf R
 * @since v0.16.0
 * @category Object
 * @typedefn Lens s a = Functor f => (a -> f a) -> s -> f s
 * @sig Lens s a -> (a -> a) -> s -> s
 * @param {Lens} lens
 * @param {*} v
 * @param {*} x
 * @return {*}
 * @see R.prop, R.lensIndex, R.lensProp
 * @example
 *
 *      const headLens = R.lensIndex(0);
 *
 *      R.over(headLens, R.toUpper, ['foo', 'bar', 'baz']); //=> ['FOO', 'bar', 'baz']
 */


var over =
/*#__PURE__*/
_curry3(function over(lens, f, x) {
  // The value returned by the getter function is first transformed with `f`,
  // then set as the value of an `Identity`. This is then mapped over with the
  // setter function of the lens.
  return lens(function (y) {
    return Identity(f(y));
  })(x).value;
});

/* harmony default export */ var es_over = (over);
// CONCATENATED MODULE: ./node_modules/ramda/es/pair.js

/**
 * Takes two arguments, `fst` and `snd`, and returns `[fst, snd]`.
 *
 * @func
 * @memberOf R
 * @since v0.18.0
 * @category List
 * @sig a -> b -> (a,b)
 * @param {*} fst
 * @param {*} snd
 * @return {Array}
 * @see R.objOf, R.of
 * @example
 *
 *      R.pair('foo', 'bar'); //=> ['foo', 'bar']
 */

var pair =
/*#__PURE__*/
_curry2(function pair(fst, snd) {
  return [fst, snd];
});

/* harmony default export */ var es_pair = (pair);
// CONCATENATED MODULE: ./node_modules/ramda/es/internal/_createPartialApplicator.js


function _createPartialApplicator(concat) {
  return _curry2(function (fn, args) {
    return _arity(Math.max(0, fn.length - args.length), function () {
      return fn.apply(this, concat(args, arguments));
    });
  });
}
// CONCATENATED MODULE: ./node_modules/ramda/es/partial.js


/**
 * Takes a function `f` and a list of arguments, and returns a function `g`.
 * When applied, `g` returns the result of applying `f` to the arguments
 * provided initially followed by the arguments provided to `g`.
 *
 * @func
 * @memberOf R
 * @since v0.10.0
 * @category Function
 * @sig ((a, b, c, ..., n) -> x) -> [a, b, c, ...] -> ((d, e, f, ..., n) -> x)
 * @param {Function} f
 * @param {Array} args
 * @return {Function}
 * @see R.partialRight, R.curry
 * @example
 *
 *      const multiply2 = (a, b) => a * b;
 *      const double = R.partial(multiply2, [2]);
 *      double(2); //=> 4
 *
 *      const greet = (salutation, title, firstName, lastName) =>
 *        salutation + ', ' + title + ' ' + firstName + ' ' + lastName + '!';
 *
 *      const sayHello = R.partial(greet, ['Hello']);
 *      const sayHelloToMs = R.partial(sayHello, ['Ms.']);
 *      sayHelloToMs('Jane', 'Jones'); //=> 'Hello, Ms. Jane Jones!'
 * @symb R.partial(f, [a, b])(c, d) = f(a, b, c, d)
 */

var partial =
/*#__PURE__*/
_createPartialApplicator(_concat);

/* harmony default export */ var es_partial = (partial);
// CONCATENATED MODULE: ./node_modules/ramda/es/partialRight.js



/**
 * Takes a function `f` and a list of arguments, and returns a function `g`.
 * When applied, `g` returns the result of applying `f` to the arguments
 * provided to `g` followed by the arguments provided initially.
 *
 * @func
 * @memberOf R
 * @since v0.10.0
 * @category Function
 * @sig ((a, b, c, ..., n) -> x) -> [d, e, f, ..., n] -> ((a, b, c, ...) -> x)
 * @param {Function} f
 * @param {Array} args
 * @return {Function}
 * @see R.partial
 * @example
 *
 *      const greet = (salutation, title, firstName, lastName) =>
 *        salutation + ', ' + title + ' ' + firstName + ' ' + lastName + '!';
 *
 *      const greetMsJaneJones = R.partialRight(greet, ['Ms.', 'Jane', 'Jones']);
 *
 *      greetMsJaneJones('Hello'); //=> 'Hello, Ms. Jane Jones!'
 * @symb R.partialRight(f, [a, b])(c, d) = f(c, d, a, b)
 */

var partialRight =
/*#__PURE__*/
_createPartialApplicator(
/*#__PURE__*/
es_flip(_concat));

/* harmony default export */ var es_partialRight = (partialRight);
// CONCATENATED MODULE: ./node_modules/ramda/es/partition.js



/**
 * Takes a predicate and a list or other `Filterable` object and returns the
 * pair of filterable objects of the same type of elements which do and do not
 * satisfy, the predicate, respectively. Filterable objects include plain objects or any object
 * that has a filter method such as `Array`.
 *
 * @func
 * @memberOf R
 * @since v0.1.4
 * @category List
 * @sig Filterable f => (a -> Boolean) -> f a -> [f a, f a]
 * @param {Function} pred A predicate to determine which side the element belongs to.
 * @param {Array} filterable the list (or other filterable) to partition.
 * @return {Array} An array, containing first the subset of elements that satisfy the
 *         predicate, and second the subset of elements that do not satisfy.
 * @see R.filter, R.reject
 * @example
 *
 *      R.partition(R.includes('s'), ['sss', 'ttt', 'foo', 'bars']);
 *      // => [ [ 'sss', 'bars' ],  [ 'ttt', 'foo' ] ]
 *
 *      R.partition(R.includes('s'), { a: 'sss', b: 'ttt', foo: 'bars' });
 *      // => [ { a: 'sss', foo: 'bars' }, { b: 'ttt' }  ]
 */

var partition =
/*#__PURE__*/
es_juxt([es_filter, es_reject]);
/* harmony default export */ var es_partition = (partition);
// CONCATENATED MODULE: ./node_modules/ramda/es/pathEq.js



/**
 * Determines whether a nested path on an object has a specific value, in
 * [`R.equals`](#equals) terms. Most likely used to filter a list.
 *
 * @func
 * @memberOf R
 * @since v0.7.0
 * @category Relation
 * @typedefn Idx = String | Int
 * @sig [Idx] -> a -> {a} -> Boolean
 * @param {Array} path The path of the nested property to use
 * @param {*} val The value to compare the nested property with
 * @param {Object} obj The object to check the nested property in
 * @return {Boolean} `true` if the value equals the nested object property,
 *         `false` otherwise.
 * @example
 *
 *      const user1 = { address: { zipCode: 90210 } };
 *      const user2 = { address: { zipCode: 55555 } };
 *      const user3 = { name: 'Bob' };
 *      const users = [ user1, user2, user3 ];
 *      const isFamous = R.pathEq(['address', 'zipCode'], 90210);
 *      R.filter(isFamous, users); //=> [ user1 ]
 */

var pathEq_pathEq =
/*#__PURE__*/
_curry3(function pathEq(_path, val, obj) {
  return es_equals(es_path(_path, obj), val);
});

/* harmony default export */ var es_pathEq = (pathEq_pathEq);
// CONCATENATED MODULE: ./node_modules/ramda/es/pathOr.js



/**
 * If the given, non-null object has a value at the given path, returns the
 * value at that path. Otherwise returns the provided default value.
 *
 * @func
 * @memberOf R
 * @since v0.18.0
 * @category Object
 * @typedefn Idx = String | Int
 * @sig a -> [Idx] -> {a} -> a
 * @param {*} d The default value.
 * @param {Array} p The path to use.
 * @param {Object} obj The object to retrieve the nested property from.
 * @return {*} The data at `path` of the supplied object or the default value.
 * @example
 *
 *      R.pathOr('N/A', ['a', 'b'], {a: {b: 2}}); //=> 2
 *      R.pathOr('N/A', ['a', 'b'], {c: {b: 2}}); //=> "N/A"
 */

var pathOr_pathOr =
/*#__PURE__*/
_curry3(function pathOr(d, p, obj) {
  return es_defaultTo(d, es_path(p, obj));
});

/* harmony default export */ var es_pathOr = (pathOr_pathOr);
// CONCATENATED MODULE: ./node_modules/ramda/es/pathSatisfies.js


/**
 * Returns `true` if the specified object property at given path satisfies the
 * given predicate; `false` otherwise.
 *
 * @func
 * @memberOf R
 * @since v0.19.0
 * @category Logic
 * @typedefn Idx = String | Int
 * @sig (a -> Boolean) -> [Idx] -> {a} -> Boolean
 * @param {Function} pred
 * @param {Array} propPath
 * @param {*} obj
 * @return {Boolean}
 * @see R.propSatisfies, R.path
 * @example
 *
 *      R.pathSatisfies(y => y > 0, ['x', 'y'], {x: {y: 2}}); //=> true
 *      R.pathSatisfies(R.is(Object), [], {x: {y: 2}}); //=> true
 */

var pathSatisfies_pathSatisfies =
/*#__PURE__*/
_curry3(function pathSatisfies(pred, propPath, obj) {
  return pred(es_path(propPath, obj));
});

/* harmony default export */ var es_pathSatisfies = (pathSatisfies_pathSatisfies);
// CONCATENATED MODULE: ./node_modules/ramda/es/pick.js

/**
 * Returns a partial copy of an object containing only the keys specified. If
 * the key does not exist, the property is ignored.
 *
 * @func
 * @memberOf R
 * @since v0.1.0
 * @category Object
 * @sig [k] -> {k: v} -> {k: v}
 * @param {Array} names an array of String property names to copy onto a new object
 * @param {Object} obj The object to copy from
 * @return {Object} A new object with only properties from `names` on it.
 * @see R.omit, R.props
 * @example
 *
 *      R.pick(['a', 'd'], {a: 1, b: 2, c: 3, d: 4}); //=> {a: 1, d: 4}
 *      R.pick(['a', 'e', 'f'], {a: 1, b: 2, c: 3, d: 4}); //=> {a: 1}
 */

var pick =
/*#__PURE__*/
_curry2(function pick(names, obj) {
  var result = {};
  var idx = 0;

  while (idx < names.length) {
    if (names[idx] in obj) {
      result[names[idx]] = obj[names[idx]];
    }

    idx += 1;
  }

  return result;
});

/* harmony default export */ var es_pick = (pick);
// CONCATENATED MODULE: ./node_modules/ramda/es/pickAll.js

/**
 * Similar to `pick` except that this one includes a `key: undefined` pair for
 * properties that don't exist.
 *
 * @func
 * @memberOf R
 * @since v0.1.0
 * @category Object
 * @sig [k] -> {k: v} -> {k: v}
 * @param {Array} names an array of String property names to copy onto a new object
 * @param {Object} obj The object to copy from
 * @return {Object} A new object with only properties from `names` on it.
 * @see R.pick
 * @example
 *
 *      R.pickAll(['a', 'd'], {a: 1, b: 2, c: 3, d: 4}); //=> {a: 1, d: 4}
 *      R.pickAll(['a', 'e', 'f'], {a: 1, b: 2, c: 3, d: 4}); //=> {a: 1, e: undefined, f: undefined}
 */

var pickAll =
/*#__PURE__*/
_curry2(function pickAll(names, obj) {
  var result = {};
  var idx = 0;
  var len = names.length;

  while (idx < len) {
    var name = names[idx];
    result[name] = obj[name];
    idx += 1;
  }

  return result;
});

/* harmony default export */ var es_pickAll = (pickAll);
// CONCATENATED MODULE: ./node_modules/ramda/es/pickBy.js

/**
 * Returns a partial copy of an object containing only the keys that satisfy
 * the supplied predicate.
 *
 * @func
 * @memberOf R
 * @since v0.8.0
 * @category Object
 * @sig ((v, k) -> Boolean) -> {k: v} -> {k: v}
 * @param {Function} pred A predicate to determine whether or not a key
 *        should be included on the output object.
 * @param {Object} obj The object to copy from
 * @return {Object} A new object with only properties that satisfy `pred`
 *         on it.
 * @see R.pick, R.filter
 * @example
 *
 *      const isUpperCase = (val, key) => key.toUpperCase() === key;
 *      R.pickBy(isUpperCase, {a: 1, b: 2, A: 3, B: 4}); //=> {A: 3, B: 4}
 */

var pickBy =
/*#__PURE__*/
_curry2(function pickBy(test, obj) {
  var result = {};

  for (var prop in obj) {
    if (test(obj[prop], prop, obj)) {
      result[prop] = obj[prop];
    }
  }

  return result;
});

/* harmony default export */ var es_pickBy = (pickBy);
// CONCATENATED MODULE: ./node_modules/ramda/es/pipeK.js


/**
 * Returns the left-to-right Kleisli composition of the provided functions,
 * each of which must return a value of a type supported by [`chain`](#chain).
 *
 * `R.pipeK(f, g, h)` is equivalent to `R.pipe(f, R.chain(g), R.chain(h))`.
 *
 * @func
 * @memberOf R
 * @since v0.16.0
 * @category Function
 * @sig Chain m => ((a -> m b), (b -> m c), ..., (y -> m z)) -> (a -> m z)
 * @param {...Function}
 * @return {Function}
 * @see R.composeK
 * @deprecated since v0.26.0
 * @example
 *
 *      //  parseJson :: String -> Maybe *
 *      //  get :: String -> Object -> Maybe *
 *
 *      //  getStateCode :: Maybe String -> Maybe String
 *      const getStateCode = R.pipeK(
 *        parseJson,
 *        get('user'),
 *        get('address'),
 *        get('state'),
 *        R.compose(Maybe.of, R.toUpper)
 *      );
 *
 *      getStateCode('{"user":{"address":{"state":"ny"}}}');
 *      //=> Just('NY')
 *      getStateCode('[Invalid JSON]');
 *      //=> Nothing()
 * @symb R.pipeK(f, g, h)(a) = R.chain(h, R.chain(g, f(a)))
 */

function pipeK() {
  if (arguments.length === 0) {
    throw new Error('pipeK requires at least one argument');
  }

  return composeK.apply(this, es_reverse(arguments));
}
// CONCATENATED MODULE: ./node_modules/ramda/es/prepend.js


/**
 * Returns a new list with the given element at the front, followed by the
 * contents of the list.
 *
 * @func
 * @memberOf R
 * @since v0.1.0
 * @category List
 * @sig a -> [a] -> [a]
 * @param {*} el The item to add to the head of the output list.
 * @param {Array} list The array to add to the tail of the output list.
 * @return {Array} A new array.
 * @see R.append
 * @example
 *
 *      R.prepend('fee', ['fi', 'fo', 'fum']); //=> ['fee', 'fi', 'fo', 'fum']
 */

var prepend_prepend =
/*#__PURE__*/
_curry2(function prepend(el, list) {
  return _concat([el], list);
});

/* harmony default export */ var es_prepend = (prepend_prepend);
// CONCATENATED MODULE: ./node_modules/ramda/es/product.js


/**
 * Multiplies together all the elements of a list.
 *
 * @func
 * @memberOf R
 * @since v0.1.0
 * @category Math
 * @sig [Number] -> Number
 * @param {Array} list An array of numbers
 * @return {Number} The product of all the numbers in the list.
 * @see R.reduce
 * @example
 *
 *      R.product([2,4,6,8,100,1]); //=> 38400
 */

var product =
/*#__PURE__*/
es_reduce(es_multiply, 1);
/* harmony default export */ var es_product = (product);
// CONCATENATED MODULE: ./node_modules/ramda/es/useWith.js


/**
 * Accepts a function `fn` and a list of transformer functions and returns a
 * new curried function. When the new function is invoked, it calls the
 * function `fn` with parameters consisting of the result of calling each
 * supplied handler on successive arguments to the new function.
 *
 * If more arguments are passed to the returned function than transformer
 * functions, those arguments are passed directly to `fn` as additional
 * parameters. If you expect additional arguments that don't need to be
 * transformed, although you can ignore them, it's best to pass an identity
 * function so that the new function reports the correct arity.
 *
 * @func
 * @memberOf R
 * @since v0.1.0
 * @category Function
 * @sig ((x1, x2, ...) -> z) -> [(a -> x1), (b -> x2), ...] -> (a -> b -> ... -> z)
 * @param {Function} fn The function to wrap.
 * @param {Array} transformers A list of transformer functions
 * @return {Function} The wrapped function.
 * @see R.converge
 * @example
 *
 *      R.useWith(Math.pow, [R.identity, R.identity])(3, 4); //=> 81
 *      R.useWith(Math.pow, [R.identity, R.identity])(3)(4); //=> 81
 *      R.useWith(Math.pow, [R.dec, R.inc])(3, 4); //=> 32
 *      R.useWith(Math.pow, [R.dec, R.inc])(3)(4); //=> 32
 * @symb R.useWith(f, [g, h])(a, b) = f(g(a), h(b))
 */

var useWith_useWith =
/*#__PURE__*/
_curry2(function useWith(fn, transformers) {
  return es_curryN(transformers.length, function () {
    var args = [];
    var idx = 0;

    while (idx < transformers.length) {
      args.push(transformers[idx].call(this, arguments[idx]));
      idx += 1;
    }

    return fn.apply(this, args.concat(Array.prototype.slice.call(arguments, transformers.length)));
  });
});

/* harmony default export */ var es_useWith = (useWith_useWith);
// CONCATENATED MODULE: ./node_modules/ramda/es/project.js




/**
 * Reasonable analog to SQL `select` statement.
 *
 * @func
 * @memberOf R
 * @since v0.1.0
 * @category Object
 * @category Relation
 * @sig [k] -> [{k: v}] -> [{k: v}]
 * @param {Array} props The property names to project
 * @param {Array} objs The objects to query
 * @return {Array} An array of objects with just the `props` properties.
 * @example
 *
 *      const abby = {name: 'Abby', age: 7, hair: 'blond', grade: 2};
 *      const fred = {name: 'Fred', age: 12, hair: 'brown', grade: 7};
 *      const kids = [abby, fred];
 *      R.project(['name', 'grade'], kids); //=> [{name: 'Abby', grade: 2}, {name: 'Fred', grade: 7}]
 */

var project =
/*#__PURE__*/
es_useWith(_map, [es_pickAll, es_identity]); // passing `identity` gives correct arity

/* harmony default export */ var es_project = (project);
// CONCATENATED MODULE: ./node_modules/ramda/es/propEq.js


/**
 * Returns `true` if the specified object property is equal, in
 * [`R.equals`](#equals) terms, to the given value; `false` otherwise.
 * You can test multiple properties with [`R.whereEq`](#whereEq).
 *
 * @func
 * @memberOf R
 * @since v0.1.0
 * @category Relation
 * @sig String -> a -> Object -> Boolean
 * @param {String} name
 * @param {*} val
 * @param {*} obj
 * @return {Boolean}
 * @see R.whereEq, R.propSatisfies, R.equals
 * @example
 *
 *      const abby = {name: 'Abby', age: 7, hair: 'blond'};
 *      const fred = {name: 'Fred', age: 12, hair: 'brown'};
 *      const rusty = {name: 'Rusty', age: 10, hair: 'brown'};
 *      const alois = {name: 'Alois', age: 15, disposition: 'surly'};
 *      const kids = [abby, fred, rusty, alois];
 *      const hasBrownHair = R.propEq('hair', 'brown');
 *      R.filter(hasBrownHair, kids); //=> [fred, rusty]
 */

var propEq_propEq =
/*#__PURE__*/
_curry3(function propEq(name, val, obj) {
  return es_equals(val, obj[name]);
});

/* harmony default export */ var es_propEq = (propEq_propEq);
// CONCATENATED MODULE: ./node_modules/ramda/es/propIs.js


/**
 * Returns `true` if the specified object property is of the given type;
 * `false` otherwise.
 *
 * @func
 * @memberOf R
 * @since v0.16.0
 * @category Type
 * @sig Type -> String -> Object -> Boolean
 * @param {Function} type
 * @param {String} name
 * @param {*} obj
 * @return {Boolean}
 * @see R.is, R.propSatisfies
 * @example
 *
 *      R.propIs(Number, 'x', {x: 1, y: 2});  //=> true
 *      R.propIs(Number, 'x', {x: 'foo'});    //=> false
 *      R.propIs(Number, 'x', {});            //=> false
 */

var propIs_propIs =
/*#__PURE__*/
_curry3(function propIs(type, name, obj) {
  return es_is(type, obj[name]);
});

/* harmony default export */ var es_propIs = (propIs_propIs);
// CONCATENATED MODULE: ./node_modules/ramda/es/propOr.js


/**
 * If the given, non-null object has an own property with the specified name,
 * returns the value of that property. Otherwise returns the provided default
 * value.
 *
 * @func
 * @memberOf R
 * @since v0.6.0
 * @category Object
 * @sig a -> String -> Object -> a
 * @param {*} val The default value.
 * @param {String} p The name of the property to return.
 * @param {Object} obj The object to query.
 * @return {*} The value of given property of the supplied object or the default value.
 * @example
 *
 *      const alice = {
 *        name: 'ALICE',
 *        age: 101
 *      };
 *      const favorite = R.prop('favoriteLibrary');
 *      const favoriteWithDefault = R.propOr('Ramda', 'favoriteLibrary');
 *
 *      favorite(alice);  //=> undefined
 *      favoriteWithDefault(alice);  //=> 'Ramda'
 */

var propOr_propOr =
/*#__PURE__*/
_curry3(function propOr(val, p, obj) {
  return es_pathOr(val, [p], obj);
});

/* harmony default export */ var es_propOr = (propOr_propOr);
// CONCATENATED MODULE: ./node_modules/ramda/es/propSatisfies.js

/**
 * Returns `true` if the specified object property satisfies the given
 * predicate; `false` otherwise. You can test multiple properties with
 * [`R.where`](#where).
 *
 * @func
 * @memberOf R
 * @since v0.16.0
 * @category Logic
 * @sig (a -> Boolean) -> String -> {String: a} -> Boolean
 * @param {Function} pred
 * @param {String} name
 * @param {*} obj
 * @return {Boolean}
 * @see R.where, R.propEq, R.propIs
 * @example
 *
 *      R.propSatisfies(x => x > 0, 'x', {x: 1, y: 2}); //=> true
 */

var propSatisfies =
/*#__PURE__*/
_curry3(function propSatisfies(pred, name, obj) {
  return pred(obj[name]);
});

/* harmony default export */ var es_propSatisfies = (propSatisfies);
// CONCATENATED MODULE: ./node_modules/ramda/es/props.js


/**
 * Acts as multiple `prop`: array of keys in, array of values out. Preserves
 * order.
 *
 * @func
 * @memberOf R
 * @since v0.1.0
 * @category Object
 * @sig [k] -> {k: v} -> [v]
 * @param {Array} ps The property names to fetch
 * @param {Object} obj The object to query
 * @return {Array} The corresponding values or partially applied function.
 * @example
 *
 *      R.props(['x', 'y'], {x: 1, y: 2}); //=> [1, 2]
 *      R.props(['c', 'a', 'b'], {b: 2, a: 1}); //=> [undefined, 1, 2]
 *
 *      const fullName = R.compose(R.join(' '), R.props(['first', 'last']));
 *      fullName({last: 'Bullet-Tooth', age: 33, first: 'Tony'}); //=> 'Tony Bullet-Tooth'
 */

var props_props =
/*#__PURE__*/
_curry2(function props(ps, obj) {
  return ps.map(function (p) {
    return es_path([p], obj);
  });
});

/* harmony default export */ var es_props = (props_props);
// CONCATENATED MODULE: ./node_modules/ramda/es/range.js


/**
 * Returns a list of numbers from `from` (inclusive) to `to` (exclusive).
 *
 * @func
 * @memberOf R
 * @since v0.1.0
 * @category List
 * @sig Number -> Number -> [Number]
 * @param {Number} from The first number in the list.
 * @param {Number} to One more than the last number in the list.
 * @return {Array} The list of numbers in the set `[a, b)`.
 * @example
 *
 *      R.range(1, 5);    //=> [1, 2, 3, 4]
 *      R.range(50, 53);  //=> [50, 51, 52]
 */

var range_range =
/*#__PURE__*/
_curry2(function range(from, to) {
  if (!(_isNumber(from) && _isNumber(to))) {
    throw new TypeError('Both arguments to range must be numbers');
  }

  var result = [];
  var n = from;

  while (n < to) {
    result.push(n);
    n += 1;
  }

  return result;
});

/* harmony default export */ var es_range = (range_range);
// CONCATENATED MODULE: ./node_modules/ramda/es/reduceRight.js

/**
 * Returns a single item by iterating through the list, successively calling
 * the iterator function and passing it an accumulator value and the current
 * value from the array, and then passing the result to the next call.
 *
 * Similar to [`reduce`](#reduce), except moves through the input list from the
 * right to the left.
 *
 * The iterator function receives two values: *(value, acc)*, while the arguments'
 * order of `reduce`'s iterator function is *(acc, value)*.
 *
 * Note: `R.reduceRight` does not skip deleted or unassigned indices (sparse
 * arrays), unlike the native `Array.prototype.reduceRight` method. For more details
 * on this behavior, see:
 * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduceRight#Description
 *
 * @func
 * @memberOf R
 * @since v0.1.0
 * @category List
 * @sig ((a, b) -> b) -> b -> [a] -> b
 * @param {Function} fn The iterator function. Receives two values, the current element from the array
 *        and the accumulator.
 * @param {*} acc The accumulator value.
 * @param {Array} list The list to iterate over.
 * @return {*} The final, accumulated value.
 * @see R.reduce, R.addIndex
 * @example
 *
 *      R.reduceRight(R.subtract, 0, [1, 2, 3, 4]) // => (1 - (2 - (3 - (4 - 0)))) = -2
 *      //    -               -2
 *      //   / \              / \
 *      //  1   -            1   3
 *      //     / \              / \
 *      //    2   -     ==>    2  -1
 *      //       / \              / \
 *      //      3   -            3   4
 *      //         / \              / \
 *      //        4   0            4   0
 *
 * @symb R.reduceRight(f, a, [b, c, d]) = f(b, f(c, f(d, a)))
 */

var reduceRight =
/*#__PURE__*/
_curry3(function reduceRight(fn, acc, list) {
  var idx = list.length - 1;

  while (idx >= 0) {
    acc = fn(list[idx], acc);
    idx -= 1;
  }

  return acc;
});

/* harmony default export */ var es_reduceRight = (reduceRight);
// CONCATENATED MODULE: ./node_modules/ramda/es/reduceWhile.js



/**
 * Like [`reduce`](#reduce), `reduceWhile` returns a single item by iterating
 * through the list, successively calling the iterator function. `reduceWhile`
 * also takes a predicate that is evaluated before each step. If the predicate
 * returns `false`, it "short-circuits" the iteration and returns the current
 * value of the accumulator.
 *
 * @func
 * @memberOf R
 * @since v0.22.0
 * @category List
 * @sig ((a, b) -> Boolean) -> ((a, b) -> a) -> a -> [b] -> a
 * @param {Function} pred The predicate. It is passed the accumulator and the
 *        current element.
 * @param {Function} fn The iterator function. Receives two values, the
 *        accumulator and the current element.
 * @param {*} a The accumulator value.
 * @param {Array} list The list to iterate over.
 * @return {*} The final, accumulated value.
 * @see R.reduce, R.reduced
 * @example
 *
 *      const isOdd = (acc, x) => x % 2 === 1;
 *      const xs = [1, 3, 5, 60, 777, 800];
 *      R.reduceWhile(isOdd, R.add, 0, xs); //=> 9
 *
 *      const ys = [2, 4, 6]
 *      R.reduceWhile(isOdd, R.add, 111, ys); //=> 111
 */

var reduceWhile =
/*#__PURE__*/
_curryN(4, [], function _reduceWhile(pred, fn, a, list) {
  return _reduce(function (acc, x) {
    return pred(acc, x) ? fn(acc, x) : _reduced(acc);
  }, a, list);
});

/* harmony default export */ var es_reduceWhile = (reduceWhile);
// CONCATENATED MODULE: ./node_modules/ramda/es/reduced.js


/**
 * Returns a value wrapped to indicate that it is the final value of the reduce
 * and transduce functions. The returned value should be considered a black
 * box: the internal structure is not guaranteed to be stable.
 *
 * Note: this optimization is only available to the below functions:
 * - [`reduce`](#reduce)
 * - [`reduceWhile`](#reduceWhile)
 * - [`transduce`](#transduce)
 *
 * @func
 * @memberOf R
 * @since v0.15.0
 * @category List
 * @sig a -> *
 * @param {*} x The final value of the reduce.
 * @return {*} The wrapped value.
 * @see R.reduce, R.reduceWhile, R.transduce
 * @example
 *
 *     R.reduce(
 *       (acc, item) => item > 3 ? R.reduced(acc) : acc.concat(item),
 *       [],
 *       [1, 2, 3, 4, 5]) // [1, 2, 3]
 */

var reduced =
/*#__PURE__*/
_curry1(_reduced);

/* harmony default export */ var es_reduced = (reduced);
// CONCATENATED MODULE: ./node_modules/ramda/es/times.js

/**
 * Calls an input function `n` times, returning an array containing the results
 * of those function calls.
 *
 * `fn` is passed one argument: The current value of `n`, which begins at `0`
 * and is gradually incremented to `n - 1`.
 *
 * @func
 * @memberOf R
 * @since v0.2.3
 * @category List
 * @sig (Number -> a) -> Number -> [a]
 * @param {Function} fn The function to invoke. Passed one argument, the current value of `n`.
 * @param {Number} n A value between `0` and `n - 1`. Increments after each function call.
 * @return {Array} An array containing the return values of all calls to `fn`.
 * @see R.repeat
 * @example
 *
 *      R.times(R.identity, 5); //=> [0, 1, 2, 3, 4]
 * @symb R.times(f, 0) = []
 * @symb R.times(f, 1) = [f(0)]
 * @symb R.times(f, 2) = [f(0), f(1)]
 */

var times =
/*#__PURE__*/
_curry2(function times(fn, n) {
  var len = Number(n);
  var idx = 0;
  var list;

  if (len < 0 || isNaN(len)) {
    throw new RangeError('n must be a non-negative number');
  }

  list = new Array(len);

  while (idx < len) {
    list[idx] = fn(idx);
    idx += 1;
  }

  return list;
});

/* harmony default export */ var es_times = (times);
// CONCATENATED MODULE: ./node_modules/ramda/es/repeat.js



/**
 * Returns a fixed list of size `n` containing a specified identical value.
 *
 * @func
 * @memberOf R
 * @since v0.1.1
 * @category List
 * @sig a -> n -> [a]
 * @param {*} value The value to repeat.
 * @param {Number} n The desired size of the output list.
 * @return {Array} A new array containing `n` `value`s.
 * @see R.times
 * @example
 *
 *      R.repeat('hi', 5); //=> ['hi', 'hi', 'hi', 'hi', 'hi']
 *
 *      const obj = {};
 *      const repeatedObjs = R.repeat(obj, 5); //=> [{}, {}, {}, {}, {}]
 *      repeatedObjs[0] === repeatedObjs[1]; //=> true
 * @symb R.repeat(a, 0) = []
 * @symb R.repeat(a, 1) = [a]
 * @symb R.repeat(a, 2) = [a, a]
 */

var repeat_repeat =
/*#__PURE__*/
_curry2(function repeat(value, n) {
  return es_times(es_always(value), n);
});

/* harmony default export */ var es_repeat = (repeat_repeat);
// CONCATENATED MODULE: ./node_modules/ramda/es/replace.js

/**
 * Replace a substring or regex match in a string with a replacement.
 *
 * The first two parameters correspond to the parameters of the
 * `String.prototype.replace()` function, so the second parameter can also be a
 * function.
 *
 * @func
 * @memberOf R
 * @since v0.7.0
 * @category String
 * @sig RegExp|String -> String -> String -> String
 * @param {RegExp|String} pattern A regular expression or a substring to match.
 * @param {String} replacement The string to replace the matches with.
 * @param {String} str The String to do the search and replacement in.
 * @return {String} The result.
 * @example
 *
 *      R.replace('foo', 'bar', 'foo foo foo'); //=> 'bar foo foo'
 *      R.replace(/foo/, 'bar', 'foo foo foo'); //=> 'bar foo foo'
 *
 *      // Use the "g" (global) flag to replace all occurrences:
 *      R.replace(/foo/g, 'bar', 'foo foo foo'); //=> 'bar bar bar'
 */

var replace =
/*#__PURE__*/
_curry3(function replace(regex, replacement, str) {
  return str.replace(regex, replacement);
});

/* harmony default export */ var es_replace = (replace);
// CONCATENATED MODULE: ./node_modules/ramda/es/scan.js

/**
 * Scan is similar to [`reduce`](#reduce), but returns a list of successively
 * reduced values from the left
 *
 * @func
 * @memberOf R
 * @since v0.10.0
 * @category List
 * @sig ((a, b) -> a) -> a -> [b] -> [a]
 * @param {Function} fn The iterator function. Receives two values, the accumulator and the
 *        current element from the array
 * @param {*} acc The accumulator value.
 * @param {Array} list The list to iterate over.
 * @return {Array} A list of all intermediately reduced values.
 * @see R.reduce, R.mapAccum
 * @example
 *
 *      const numbers = [1, 2, 3, 4];
 *      const factorials = R.scan(R.multiply, 1, numbers); //=> [1, 1, 2, 6, 24]
 * @symb R.scan(f, a, [b, c]) = [a, f(a, b), f(f(a, b), c)]
 */

var scan =
/*#__PURE__*/
_curry3(function scan(fn, acc, list) {
  var idx = 0;
  var len = list.length;
  var result = [acc];

  while (idx < len) {
    acc = fn(acc, list[idx]);
    result[idx + 1] = acc;
    idx += 1;
  }

  return result;
});

/* harmony default export */ var es_scan = (scan);
// CONCATENATED MODULE: ./node_modules/ramda/es/sequence.js





/**
 * Transforms a [Traversable](https://github.com/fantasyland/fantasy-land#traversable)
 * of [Applicative](https://github.com/fantasyland/fantasy-land#applicative) into an
 * Applicative of Traversable.
 *
 * Dispatches to the `sequence` method of the second argument, if present.
 *
 * @func
 * @memberOf R
 * @since v0.19.0
 * @category List
 * @sig (Applicative f, Traversable t) => (a -> f a) -> t (f a) -> f (t a)
 * @param {Function} of
 * @param {*} traversable
 * @return {*}
 * @see R.traverse
 * @example
 *
 *      R.sequence(Maybe.of, [Just(1), Just(2), Just(3)]);   //=> Just([1, 2, 3])
 *      R.sequence(Maybe.of, [Just(1), Just(2), Nothing()]); //=> Nothing()
 *
 *      R.sequence(R.of, Just([1, 2, 3])); //=> [Just(1), Just(2), Just(3)]
 *      R.sequence(R.of, Nothing());       //=> [Nothing()]
 */

var sequence_sequence =
/*#__PURE__*/
_curry2(function sequence(of, traversable) {
  return typeof traversable.sequence === 'function' ? traversable.sequence(of) : es_reduceRight(function (x, acc) {
    return es_ap(es_map(es_prepend, x), acc);
  }, of([]), traversable);
});

/* harmony default export */ var es_sequence = (sequence_sequence);
// CONCATENATED MODULE: ./node_modules/ramda/es/set.js



/**
 * Returns the result of "setting" the portion of the given data structure
 * focused by the given lens to the given value.
 *
 * @func
 * @memberOf R
 * @since v0.16.0
 * @category Object
 * @typedefn Lens s a = Functor f => (a -> f a) -> s -> f s
 * @sig Lens s a -> a -> s -> s
 * @param {Lens} lens
 * @param {*} v
 * @param {*} x
 * @return {*}
 * @see R.prop, R.lensIndex, R.lensProp
 * @example
 *
 *      const xLens = R.lensProp('x');
 *
 *      R.set(xLens, 4, {x: 1, y: 2});  //=> {x: 4, y: 2}
 *      R.set(xLens, 8, {x: 1, y: 2});  //=> {x: 8, y: 2}
 */

var set_set =
/*#__PURE__*/
_curry3(function set(lens, v, x) {
  return es_over(lens, es_always(v), x);
});

/* harmony default export */ var es_set = (set_set);
// CONCATENATED MODULE: ./node_modules/ramda/es/sort.js

/**
 * Returns a copy of the list, sorted according to the comparator function,
 * which should accept two values at a time and return a negative number if the
 * first value is smaller, a positive number if it's larger, and zero if they
 * are equal. Please note that this is a **copy** of the list. It does not
 * modify the original.
 *
 * @func
 * @memberOf R
 * @since v0.1.0
 * @category List
 * @sig ((a, a) -> Number) -> [a] -> [a]
 * @param {Function} comparator A sorting function :: a -> b -> Int
 * @param {Array} list The list to sort
 * @return {Array} a new array with its elements sorted by the comparator function.
 * @example
 *
 *      const diff = function(a, b) { return a - b; };
 *      R.sort(diff, [4,2,7,5]); //=> [2, 4, 5, 7]
 */

var sort =
/*#__PURE__*/
_curry2(function sort(comparator, list) {
  return Array.prototype.slice.call(list, 0).sort(comparator);
});

/* harmony default export */ var es_sort = (sort);
// CONCATENATED MODULE: ./node_modules/ramda/es/sortBy.js

/**
 * Sorts the list according to the supplied function.
 *
 * @func
 * @memberOf R
 * @since v0.1.0
 * @category Relation
 * @sig Ord b => (a -> b) -> [a] -> [a]
 * @param {Function} fn
 * @param {Array} list The list to sort.
 * @return {Array} A new list sorted by the keys generated by `fn`.
 * @example
 *
 *      const sortByFirstItem = R.sortBy(R.prop(0));
 *      const pairs = [[-1, 1], [-2, 2], [-3, 3]];
 *      sortByFirstItem(pairs); //=> [[-3, 3], [-2, 2], [-1, 1]]
 *
 *      const sortByNameCaseInsensitive = R.sortBy(R.compose(R.toLower, R.prop('name')));
 *      const alice = {
 *        name: 'ALICE',
 *        age: 101
 *      };
 *      const bob = {
 *        name: 'Bob',
 *        age: -10
 *      };
 *      const clara = {
 *        name: 'clara',
 *        age: 314.159
 *      };
 *      const people = [clara, bob, alice];
 *      sortByNameCaseInsensitive(people); //=> [alice, bob, clara]
 */

var sortBy =
/*#__PURE__*/
_curry2(function sortBy(fn, list) {
  return Array.prototype.slice.call(list, 0).sort(function (a, b) {
    var aa = fn(a);
    var bb = fn(b);
    return aa < bb ? -1 : aa > bb ? 1 : 0;
  });
});

/* harmony default export */ var es_sortBy = (sortBy);
// CONCATENATED MODULE: ./node_modules/ramda/es/sortWith.js

/**
 * Sorts a list according to a list of comparators.
 *
 * @func
 * @memberOf R
 * @since v0.23.0
 * @category Relation
 * @sig [(a, a) -> Number] -> [a] -> [a]
 * @param {Array} functions A list of comparator functions.
 * @param {Array} list The list to sort.
 * @return {Array} A new list sorted according to the comarator functions.
 * @example
 *
 *      const alice = {
 *        name: 'alice',
 *        age: 40
 *      };
 *      const bob = {
 *        name: 'bob',
 *        age: 30
 *      };
 *      const clara = {
 *        name: 'clara',
 *        age: 40
 *      };
 *      const people = [clara, bob, alice];
 *      const ageNameSort = R.sortWith([
 *        R.descend(R.prop('age')),
 *        R.ascend(R.prop('name'))
 *      ]);
 *      ageNameSort(people); //=> [alice, clara, bob]
 */

var sortWith =
/*#__PURE__*/
_curry2(function sortWith(fns, list) {
  return Array.prototype.slice.call(list, 0).sort(function (a, b) {
    var result = 0;
    var i = 0;

    while (result === 0 && i < fns.length) {
      result = fns[i](a, b);
      i += 1;
    }

    return result;
  });
});

/* harmony default export */ var es_sortWith = (sortWith);
// CONCATENATED MODULE: ./node_modules/ramda/es/split.js

/**
 * Splits a string into an array of strings based on the given
 * separator.
 *
 * @func
 * @memberOf R
 * @since v0.1.0
 * @category String
 * @sig (String | RegExp) -> String -> [String]
 * @param {String|RegExp} sep The pattern.
 * @param {String} str The string to separate into an array.
 * @return {Array} The array of strings from `str` separated by `sep`.
 * @see R.join
 * @example
 *
 *      const pathComponents = R.split('/');
 *      R.tail(pathComponents('/usr/local/bin/node')); //=> ['usr', 'local', 'bin', 'node']
 *
 *      R.split('.', 'a.b.c.xyz.d'); //=> ['a', 'b', 'c', 'xyz', 'd']
 */

var split =
/*#__PURE__*/
es_invoker(1, 'split');
/* harmony default export */ var es_split = (split);
// CONCATENATED MODULE: ./node_modules/ramda/es/splitAt.js



/**
 * Splits a given list or string at a given index.
 *
 * @func
 * @memberOf R
 * @since v0.19.0
 * @category List
 * @sig Number -> [a] -> [[a], [a]]
 * @sig Number -> String -> [String, String]
 * @param {Number} index The index where the array/string is split.
 * @param {Array|String} array The array/string to be split.
 * @return {Array}
 * @example
 *
 *      R.splitAt(1, [1, 2, 3]);          //=> [[1], [2, 3]]
 *      R.splitAt(5, 'hello world');      //=> ['hello', ' world']
 *      R.splitAt(-1, 'foobar');          //=> ['fooba', 'r']
 */

var splitAt_splitAt =
/*#__PURE__*/
_curry2(function splitAt(index, array) {
  return [es_slice(0, index, array), es_slice(index, es_length(array), array)];
});

/* harmony default export */ var es_splitAt = (splitAt_splitAt);
// CONCATENATED MODULE: ./node_modules/ramda/es/splitEvery.js


/**
 * Splits a collection into slices of the specified length.
 *
 * @func
 * @memberOf R
 * @since v0.16.0
 * @category List
 * @sig Number -> [a] -> [[a]]
 * @sig Number -> String -> [String]
 * @param {Number} n
 * @param {Array} list
 * @return {Array}
 * @example
 *
 *      R.splitEvery(3, [1, 2, 3, 4, 5, 6, 7]); //=> [[1, 2, 3], [4, 5, 6], [7]]
 *      R.splitEvery(3, 'foobarbaz'); //=> ['foo', 'bar', 'baz']
 */

var splitEvery_splitEvery =
/*#__PURE__*/
_curry2(function splitEvery(n, list) {
  if (n <= 0) {
    throw new Error('First argument to splitEvery must be a positive integer');
  }

  var result = [];
  var idx = 0;

  while (idx < list.length) {
    result.push(es_slice(idx, idx += n, list));
  }

  return result;
});

/* harmony default export */ var es_splitEvery = (splitEvery_splitEvery);
// CONCATENATED MODULE: ./node_modules/ramda/es/splitWhen.js

/**
 * Takes a list and a predicate and returns a pair of lists with the following properties:
 *
 *  - the result of concatenating the two output lists is equivalent to the input list;
 *  - none of the elements of the first output list satisfies the predicate; and
 *  - if the second output list is non-empty, its first element satisfies the predicate.
 *
 * @func
 * @memberOf R
 * @since v0.19.0
 * @category List
 * @sig (a -> Boolean) -> [a] -> [[a], [a]]
 * @param {Function} pred The predicate that determines where the array is split.
 * @param {Array} list The array to be split.
 * @return {Array}
 * @example
 *
 *      R.splitWhen(R.equals(2), [1, 2, 3, 1, 2, 3]);   //=> [[1], [2, 3, 1, 2, 3]]
 */

var splitWhen =
/*#__PURE__*/
_curry2(function splitWhen(pred, list) {
  var idx = 0;
  var len = list.length;
  var prefix = [];

  while (idx < len && !pred(list[idx])) {
    prefix.push(list[idx]);
    idx += 1;
  }

  return [prefix, Array.prototype.slice.call(list, idx)];
});

/* harmony default export */ var es_splitWhen = (splitWhen);
// CONCATENATED MODULE: ./node_modules/ramda/es/startsWith.js



/**
 * Checks if a list starts with the provided sublist.
 *
 * Similarly, checks if a string starts with the provided substring.
 *
 * @func
 * @memberOf R
 * @since v0.24.0
 * @category List
 * @sig [a] -> [a] -> Boolean
 * @sig String -> String -> Boolean
 * @param {*} prefix
 * @param {*} list
 * @return {Boolean}
 * @see R.endsWith
 * @example
 *
 *      R.startsWith('a', 'abc')                //=> true
 *      R.startsWith('b', 'abc')                //=> false
 *      R.startsWith(['a'], ['a', 'b', 'c'])    //=> true
 *      R.startsWith(['b'], ['a', 'b', 'c'])    //=> false
 */

var startsWith =
/*#__PURE__*/
_curry2(function (prefix, list) {
  return es_equals(es_take(prefix.length, list), prefix);
});

/* harmony default export */ var es_startsWith = (startsWith);
// CONCATENATED MODULE: ./node_modules/ramda/es/subtract.js

/**
 * Subtracts its second argument from its first argument.
 *
 * @func
 * @memberOf R
 * @since v0.1.0
 * @category Math
 * @sig Number -> Number -> Number
 * @param {Number} a The first value.
 * @param {Number} b The second value.
 * @return {Number} The result of `a - b`.
 * @see R.add
 * @example
 *
 *      R.subtract(10, 8); //=> 2
 *
 *      const minus5 = R.subtract(R.__, 5);
 *      minus5(17); //=> 12
 *
 *      const complementaryAngle = R.subtract(90);
 *      complementaryAngle(30); //=> 60
 *      complementaryAngle(72); //=> 18
 */

var subtract =
/*#__PURE__*/
_curry2(function subtract(a, b) {
  return Number(a) - Number(b);
});

/* harmony default export */ var es_subtract = (subtract);
// CONCATENATED MODULE: ./node_modules/ramda/es/symmetricDifference.js



/**
 * Finds the set (i.e. no duplicates) of all elements contained in the first or
 * second list, but not both.
 *
 * @func
 * @memberOf R
 * @since v0.19.0
 * @category Relation
 * @sig [*] -> [*] -> [*]
 * @param {Array} list1 The first list.
 * @param {Array} list2 The second list.
 * @return {Array} The elements in `list1` or `list2`, but not both.
 * @see R.symmetricDifferenceWith, R.difference, R.differenceWith
 * @example
 *
 *      R.symmetricDifference([1,2,3,4], [7,6,5,4,3]); //=> [1,2,7,6,5]
 *      R.symmetricDifference([7,6,5,4,3], [1,2,3,4]); //=> [7,6,5,1,2]
 */

var symmetricDifference_symmetricDifference =
/*#__PURE__*/
_curry2(function symmetricDifference(list1, list2) {
  return es_concat(es_difference(list1, list2), es_difference(list2, list1));
});

/* harmony default export */ var es_symmetricDifference = (symmetricDifference_symmetricDifference);
// CONCATENATED MODULE: ./node_modules/ramda/es/symmetricDifferenceWith.js



/**
 * Finds the set (i.e. no duplicates) of all elements contained in the first or
 * second list, but not both. Duplication is determined according to the value
 * returned by applying the supplied predicate to two list elements.
 *
 * @func
 * @memberOf R
 * @since v0.19.0
 * @category Relation
 * @sig ((a, a) -> Boolean) -> [a] -> [a] -> [a]
 * @param {Function} pred A predicate used to test whether two items are equal.
 * @param {Array} list1 The first list.
 * @param {Array} list2 The second list.
 * @return {Array} The elements in `list1` or `list2`, but not both.
 * @see R.symmetricDifference, R.difference, R.differenceWith
 * @example
 *
 *      const eqA = R.eqBy(R.prop('a'));
 *      const l1 = [{a: 1}, {a: 2}, {a: 3}, {a: 4}];
 *      const l2 = [{a: 3}, {a: 4}, {a: 5}, {a: 6}];
 *      R.symmetricDifferenceWith(eqA, l1, l2); //=> [{a: 1}, {a: 2}, {a: 5}, {a: 6}]
 */

var symmetricDifferenceWith_symmetricDifferenceWith =
/*#__PURE__*/
_curry3(function symmetricDifferenceWith(pred, list1, list2) {
  return es_concat(es_differenceWith(pred, list1, list2), es_differenceWith(pred, list2, list1));
});

/* harmony default export */ var es_symmetricDifferenceWith = (symmetricDifferenceWith_symmetricDifferenceWith);
// CONCATENATED MODULE: ./node_modules/ramda/es/takeLastWhile.js


/**
 * Returns a new list containing the last `n` elements of a given list, passing
 * each value to the supplied predicate function, and terminating when the
 * predicate function returns `false`. Excludes the element that caused the
 * predicate function to fail. The predicate function is passed one argument:
 * *(value)*.
 *
 * @func
 * @memberOf R
 * @since v0.16.0
 * @category List
 * @sig (a -> Boolean) -> [a] -> [a]
 * @sig (a -> Boolean) -> String -> String
 * @param {Function} fn The function called per iteration.
 * @param {Array} xs The collection to iterate over.
 * @return {Array} A new array.
 * @see R.dropLastWhile, R.addIndex
 * @example
 *
 *      const isNotOne = x => x !== 1;
 *
 *      R.takeLastWhile(isNotOne, [1, 2, 3, 4]); //=> [2, 3, 4]
 *
 *      R.takeLastWhile(x => x !== 'R' , 'Ramda'); //=> 'amda'
 */

var takeLastWhile_takeLastWhile =
/*#__PURE__*/
_curry2(function takeLastWhile(fn, xs) {
  var idx = xs.length - 1;

  while (idx >= 0 && fn(xs[idx])) {
    idx -= 1;
  }

  return es_slice(idx + 1, Infinity, xs);
});

/* harmony default export */ var es_takeLastWhile = (takeLastWhile_takeLastWhile);
// CONCATENATED MODULE: ./node_modules/ramda/es/internal/_xtakeWhile.js




var _xtakeWhile_XTakeWhile =
/*#__PURE__*/
function () {
  function XTakeWhile(f, xf) {
    this.xf = xf;
    this.f = f;
  }

  XTakeWhile.prototype['@@transducer/init'] = _xfBase.init;
  XTakeWhile.prototype['@@transducer/result'] = _xfBase.result;

  XTakeWhile.prototype['@@transducer/step'] = function (result, input) {
    return this.f(input) ? this.xf['@@transducer/step'](result, input) : _reduced(result);
  };

  return XTakeWhile;
}();

var _xtakeWhile =
/*#__PURE__*/
_curry2(function _xtakeWhile(f, xf) {
  return new _xtakeWhile_XTakeWhile(f, xf);
});

/* harmony default export */ var internal_xtakeWhile = (_xtakeWhile);
// CONCATENATED MODULE: ./node_modules/ramda/es/takeWhile.js




/**
 * Returns a new list containing the first `n` elements of a given list,
 * passing each value to the supplied predicate function, and terminating when
 * the predicate function returns `false`. Excludes the element that caused the
 * predicate function to fail. The predicate function is passed one argument:
 * *(value)*.
 *
 * Dispatches to the `takeWhile` method of the second argument, if present.
 *
 * Acts as a transducer if a transformer is given in list position.
 *
 * @func
 * @memberOf R
 * @since v0.1.0
 * @category List
 * @sig (a -> Boolean) -> [a] -> [a]
 * @sig (a -> Boolean) -> String -> String
 * @param {Function} fn The function called per iteration.
 * @param {Array} xs The collection to iterate over.
 * @return {Array} A new array.
 * @see R.dropWhile, R.transduce, R.addIndex
 * @example
 *
 *      const isNotFour = x => x !== 4;
 *
 *      R.takeWhile(isNotFour, [1, 2, 3, 4, 3, 2, 1]); //=> [1, 2, 3]
 *
 *      R.takeWhile(x => x !== 'd' , 'Ramda'); //=> 'Ram'
 */

var takeWhile_takeWhile =
/*#__PURE__*/
_curry2(
/*#__PURE__*/
_dispatchable(['takeWhile'], internal_xtakeWhile, function takeWhile(fn, xs) {
  var idx = 0;
  var len = xs.length;

  while (idx < len && fn(xs[idx])) {
    idx += 1;
  }

  return es_slice(0, idx, xs);
}));

/* harmony default export */ var es_takeWhile = (takeWhile_takeWhile);
// CONCATENATED MODULE: ./node_modules/ramda/es/internal/_xtap.js



var _xtap_XTap =
/*#__PURE__*/
function () {
  function XTap(f, xf) {
    this.xf = xf;
    this.f = f;
  }

  XTap.prototype['@@transducer/init'] = _xfBase.init;
  XTap.prototype['@@transducer/result'] = _xfBase.result;

  XTap.prototype['@@transducer/step'] = function (result, input) {
    this.f(input);
    return this.xf['@@transducer/step'](result, input);
  };

  return XTap;
}();

var _xtap =
/*#__PURE__*/
_curry2(function _xtap(f, xf) {
  return new _xtap_XTap(f, xf);
});

/* harmony default export */ var internal_xtap = (_xtap);
// CONCATENATED MODULE: ./node_modules/ramda/es/tap.js



/**
 * Runs the given function with the supplied object, then returns the object.
 *
 * Acts as a transducer if a transformer is given as second parameter.
 *
 * @func
 * @memberOf R
 * @since v0.1.0
 * @category Function
 * @sig (a -> *) -> a -> a
 * @param {Function} fn The function to call with `x`. The return value of `fn` will be thrown away.
 * @param {*} x
 * @return {*} `x`.
 * @example
 *
 *      const sayX = x => console.log('x is ' + x);
 *      R.tap(sayX, 100); //=> 100
 *      // logs 'x is 100'
 * @symb R.tap(f, a) = a
 */

var tap =
/*#__PURE__*/
_curry2(
/*#__PURE__*/
_dispatchable([], internal_xtap, function tap(fn, x) {
  fn(x);
  return x;
}));

/* harmony default export */ var es_tap = (tap);
// CONCATENATED MODULE: ./node_modules/ramda/es/internal/_isRegExp.js
function _isRegExp(x) {
  return Object.prototype.toString.call(x) === '[object RegExp]';
}
// CONCATENATED MODULE: ./node_modules/ramda/es/test.js




/**
 * Determines whether a given string matches a given regular expression.
 *
 * @func
 * @memberOf R
 * @since v0.12.0
 * @category String
 * @sig RegExp -> String -> Boolean
 * @param {RegExp} pattern
 * @param {String} str
 * @return {Boolean}
 * @see R.match
 * @example
 *
 *      R.test(/^x/, 'xyz'); //=> true
 *      R.test(/^y/, 'xyz'); //=> false
 */

var test_test =
/*#__PURE__*/
_curry2(function test(pattern, str) {
  if (!_isRegExp(pattern)) {
    throw new TypeError('‘test’ requires a value of type RegExp as its first argument; received ' + es_toString(pattern));
  }

  return _cloneRegExp(pattern).test(str);
});

/* harmony default export */ var es_test = (test_test);
// CONCATENATED MODULE: ./node_modules/ramda/es/andThen.js


/**
 * Returns the result of applying the onSuccess function to the value inside
 * a successfully resolved promise. This is useful for working with promises
 * inside function compositions.
 *
 * @func
 * @memberOf R
 * @since v0.27.0
 * @category Function
 * @sig (a -> b) -> (Promise e a) -> (Promise e b)
 * @sig (a -> (Promise e b)) -> (Promise e a) -> (Promise e b)
 * @param {Function} onSuccess The function to apply. Can return a value or a promise of a value.
 * @param {Promise} p
 * @return {Promise} The result of calling `p.then(onSuccess)`
 * @see R.otherwise
 * @example
 *
 *      var makeQuery = (email) => ({ query: { email }});
 *
 *      //getMemberName :: String -> Promise ({firstName, lastName})
 *      var getMemberName = R.pipe(
 *        makeQuery,
 *        fetchMember,
 *        R.andThen(R.pick(['firstName', 'lastName']))
 *      );
 */

var andThen_andThen =
/*#__PURE__*/
_curry2(function andThen(f, p) {
  _assertPromise('andThen', p);

  return p.then(f);
});

/* harmony default export */ var es_andThen = (andThen_andThen);
// CONCATENATED MODULE: ./node_modules/ramda/es/toLower.js

/**
 * The lower case version of a string.
 *
 * @func
 * @memberOf R
 * @since v0.9.0
 * @category String
 * @sig String -> String
 * @param {String} str The string to lower case.
 * @return {String} The lower case version of `str`.
 * @see R.toUpper
 * @example
 *
 *      R.toLower('XYZ'); //=> 'xyz'
 */

var toLower =
/*#__PURE__*/
es_invoker(0, 'toLowerCase');
/* harmony default export */ var es_toLower = (toLower);
// CONCATENATED MODULE: ./node_modules/ramda/es/toPairs.js


/**
 * Converts an object into an array of key, value arrays. Only the object's
 * own properties are used.
 * Note that the order of the output array is not guaranteed to be consistent
 * across different JS platforms.
 *
 * @func
 * @memberOf R
 * @since v0.4.0
 * @category Object
 * @sig {String: *} -> [[String,*]]
 * @param {Object} obj The object to extract from
 * @return {Array} An array of key, value arrays from the object's own properties.
 * @see R.fromPairs
 * @example
 *
 *      R.toPairs({a: 1, b: 2, c: 3}); //=> [['a', 1], ['b', 2], ['c', 3]]
 */

var toPairs_toPairs =
/*#__PURE__*/
_curry1(function toPairs(obj) {
  var pairs = [];

  for (var prop in obj) {
    if (_has(prop, obj)) {
      pairs[pairs.length] = [prop, obj[prop]];
    }
  }

  return pairs;
});

/* harmony default export */ var es_toPairs = (toPairs_toPairs);
// CONCATENATED MODULE: ./node_modules/ramda/es/toPairsIn.js

/**
 * Converts an object into an array of key, value arrays. The object's own
 * properties and prototype properties are used. Note that the order of the
 * output array is not guaranteed to be consistent across different JS
 * platforms.
 *
 * @func
 * @memberOf R
 * @since v0.4.0
 * @category Object
 * @sig {String: *} -> [[String,*]]
 * @param {Object} obj The object to extract from
 * @return {Array} An array of key, value arrays from the object's own
 *         and prototype properties.
 * @example
 *
 *      const F = function() { this.x = 'X'; };
 *      F.prototype.y = 'Y';
 *      const f = new F();
 *      R.toPairsIn(f); //=> [['x','X'], ['y','Y']]
 */

var toPairsIn =
/*#__PURE__*/
_curry1(function toPairsIn(obj) {
  var pairs = [];

  for (var prop in obj) {
    pairs[pairs.length] = [prop, obj[prop]];
  }

  return pairs;
});

/* harmony default export */ var es_toPairsIn = (toPairsIn);
// CONCATENATED MODULE: ./node_modules/ramda/es/toUpper.js

/**
 * The upper case version of a string.
 *
 * @func
 * @memberOf R
 * @since v0.9.0
 * @category String
 * @sig String -> String
 * @param {String} str The string to upper case.
 * @return {String} The upper case version of `str`.
 * @see R.toLower
 * @example
 *
 *      R.toUpper('abc'); //=> 'ABC'
 */

var toUpper =
/*#__PURE__*/
es_invoker(0, 'toUpperCase');
/* harmony default export */ var es_toUpper = (toUpper);
// CONCATENATED MODULE: ./node_modules/ramda/es/transduce.js



/**
 * Initializes a transducer using supplied iterator function. Returns a single
 * item by iterating through the list, successively calling the transformed
 * iterator function and passing it an accumulator value and the current value
 * from the array, and then passing the result to the next call.
 *
 * The iterator function receives two values: *(acc, value)*. It will be
 * wrapped as a transformer to initialize the transducer. A transformer can be
 * passed directly in place of an iterator function. In both cases, iteration
 * may be stopped early with the [`R.reduced`](#reduced) function.
 *
 * A transducer is a function that accepts a transformer and returns a
 * transformer and can be composed directly.
 *
 * A transformer is an an object that provides a 2-arity reducing iterator
 * function, step, 0-arity initial value function, init, and 1-arity result
 * extraction function, result. The step function is used as the iterator
 * function in reduce. The result function is used to convert the final
 * accumulator into the return type and in most cases is
 * [`R.identity`](#identity). The init function can be used to provide an
 * initial accumulator, but is ignored by transduce.
 *
 * The iteration is performed with [`R.reduce`](#reduce) after initializing the transducer.
 *
 * @func
 * @memberOf R
 * @since v0.12.0
 * @category List
 * @sig (c -> c) -> ((a, b) -> a) -> a -> [b] -> a
 * @param {Function} xf The transducer function. Receives a transformer and returns a transformer.
 * @param {Function} fn The iterator function. Receives two values, the accumulator and the
 *        current element from the array. Wrapped as transformer, if necessary, and used to
 *        initialize the transducer
 * @param {*} acc The initial accumulator value.
 * @param {Array} list The list to iterate over.
 * @return {*} The final, accumulated value.
 * @see R.reduce, R.reduced, R.into
 * @example
 *
 *      const numbers = [1, 2, 3, 4];
 *      const transducer = R.compose(R.map(R.add(1)), R.take(2));
 *      R.transduce(transducer, R.flip(R.append), [], numbers); //=> [2, 3]
 *
 *      const isOdd = (x) => x % 2 === 1;
 *      const firstOddTransducer = R.compose(R.filter(isOdd), R.take(1));
 *      R.transduce(firstOddTransducer, R.flip(R.append), [], R.range(0, 100)); //=> [1]
 */

var transduce_transduce =
/*#__PURE__*/
es_curryN(4, function transduce(xf, fn, acc, list) {
  return _reduce(xf(typeof fn === 'function' ? _xwrap(fn) : fn), acc, list);
});
/* harmony default export */ var es_transduce = (transduce_transduce);
// CONCATENATED MODULE: ./node_modules/ramda/es/transpose.js

/**
 * Transposes the rows and columns of a 2D list.
 * When passed a list of `n` lists of length `x`,
 * returns a list of `x` lists of length `n`.
 *
 *
 * @func
 * @memberOf R
 * @since v0.19.0
 * @category List
 * @sig [[a]] -> [[a]]
 * @param {Array} list A 2D list
 * @return {Array} A 2D list
 * @example
 *
 *      R.transpose([[1, 'a'], [2, 'b'], [3, 'c']]) //=> [[1, 2, 3], ['a', 'b', 'c']]
 *      R.transpose([[1, 2, 3], ['a', 'b', 'c']]) //=> [[1, 'a'], [2, 'b'], [3, 'c']]
 *
 *      // If some of the rows are shorter than the following rows, their elements are skipped:
 *      R.transpose([[10, 11], [20], [], [30, 31, 32]]) //=> [[10, 20, 30], [11, 31], [32]]
 * @symb R.transpose([[a], [b], [c]]) = [a, b, c]
 * @symb R.transpose([[a, b], [c, d]]) = [[a, c], [b, d]]
 * @symb R.transpose([[a, b], [c]]) = [[a, c], [b]]
 */

var transpose =
/*#__PURE__*/
_curry1(function transpose(outerlist) {
  var i = 0;
  var result = [];

  while (i < outerlist.length) {
    var innerlist = outerlist[i];
    var j = 0;

    while (j < innerlist.length) {
      if (typeof result[j] === 'undefined') {
        result[j] = [];
      }

      result[j].push(innerlist[j]);
      j += 1;
    }

    i += 1;
  }

  return result;
});

/* harmony default export */ var es_transpose = (transpose);
// CONCATENATED MODULE: ./node_modules/ramda/es/traverse.js



/**
 * Maps an [Applicative](https://github.com/fantasyland/fantasy-land#applicative)-returning
 * function over a [Traversable](https://github.com/fantasyland/fantasy-land#traversable),
 * then uses [`sequence`](#sequence) to transform the resulting Traversable of Applicative
 * into an Applicative of Traversable.
 *
 * Dispatches to the `traverse` method of the third argument, if present.
 *
 * @func
 * @memberOf R
 * @since v0.19.0
 * @category List
 * @sig (Applicative f, Traversable t) => (a -> f a) -> (a -> f b) -> t a -> f (t b)
 * @param {Function} of
 * @param {Function} f
 * @param {*} traversable
 * @return {*}
 * @see R.sequence
 * @example
 *
 *      // Returns `Maybe.Nothing` if the given divisor is `0`
 *      const safeDiv = n => d => d === 0 ? Maybe.Nothing() : Maybe.Just(n / d)
 *
 *      R.traverse(Maybe.of, safeDiv(10), [2, 4, 5]); //=> Maybe.Just([5, 2.5, 2])
 *      R.traverse(Maybe.of, safeDiv(10), [2, 0, 5]); //=> Maybe.Nothing
 */

var traverse_traverse =
/*#__PURE__*/
_curry3(function traverse(of, f, traversable) {
  return typeof traversable['fantasy-land/traverse'] === 'function' ? traversable['fantasy-land/traverse'](f, of) : es_sequence(of, es_map(f, traversable));
});

/* harmony default export */ var es_traverse = (traverse_traverse);
// CONCATENATED MODULE: ./node_modules/ramda/es/trim.js

var ws = '\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003' + '\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028' + '\u2029\uFEFF';
var zeroWidth = '\u200b';
var hasProtoTrim = typeof String.prototype.trim === 'function';
/**
 * Removes (strips) whitespace from both ends of the string.
 *
 * @func
 * @memberOf R
 * @since v0.6.0
 * @category String
 * @sig String -> String
 * @param {String} str The string to trim.
 * @return {String} Trimmed version of `str`.
 * @example
 *
 *      R.trim('   xyz  '); //=> 'xyz'
 *      R.map(R.trim, R.split(',', 'x, y, z')); //=> ['x', 'y', 'z']
 */

var trim = !hasProtoTrim ||
/*#__PURE__*/
ws.trim() || !
/*#__PURE__*/
zeroWidth.trim() ?
/*#__PURE__*/
_curry1(function trim(str) {
  var beginRx = new RegExp('^[' + ws + '][' + ws + ']*');
  var endRx = new RegExp('[' + ws + '][' + ws + ']*$');
  return str.replace(beginRx, '').replace(endRx, '');
}) :
/*#__PURE__*/
_curry1(function trim(str) {
  return str.trim();
});
/* harmony default export */ var es_trim = (trim);
// CONCATENATED MODULE: ./node_modules/ramda/es/tryCatch.js



/**
 * `tryCatch` takes two functions, a `tryer` and a `catcher`. The returned
 * function evaluates the `tryer`; if it does not throw, it simply returns the
 * result. If the `tryer` *does* throw, the returned function evaluates the
 * `catcher` function and returns its result. Note that for effective
 * composition with this function, both the `tryer` and `catcher` functions
 * must return the same type of results.
 *
 * @func
 * @memberOf R
 * @since v0.20.0
 * @category Function
 * @sig (...x -> a) -> ((e, ...x) -> a) -> (...x -> a)
 * @param {Function} tryer The function that may throw.
 * @param {Function} catcher The function that will be evaluated if `tryer` throws.
 * @return {Function} A new function that will catch exceptions and send then to the catcher.
 * @example
 *
 *      R.tryCatch(R.prop('x'), R.F)({x: true}); //=> true
 *      R.tryCatch(() => { throw 'foo'}, R.always('catched'))('bar') // => 'catched'
 *      R.tryCatch(R.times(R.identity), R.always([]))('s') // => []
 *      R.tryCatch(() => { throw 'this is not a valid value'}, (err, value)=>({error : err,  value }))('bar') // => {'error': 'this is not a valid value', 'value': 'bar'}
 */

var tryCatch =
/*#__PURE__*/
_curry2(function _tryCatch(tryer, catcher) {
  return _arity(tryer.length, function () {
    try {
      return tryer.apply(this, arguments);
    } catch (e) {
      return catcher.apply(this, _concat([e], arguments));
    }
  });
});

/* harmony default export */ var es_tryCatch = (tryCatch);
// CONCATENATED MODULE: ./node_modules/ramda/es/unapply.js

/**
 * Takes a function `fn`, which takes a single array argument, and returns a
 * function which:
 *
 *   - takes any number of positional arguments;
 *   - passes these arguments to `fn` as an array; and
 *   - returns the result.
 *
 * In other words, `R.unapply` derives a variadic function from a function which
 * takes an array. `R.unapply` is the inverse of [`R.apply`](#apply).
 *
 * @func
 * @memberOf R
 * @since v0.8.0
 * @category Function
 * @sig ([*...] -> a) -> (*... -> a)
 * @param {Function} fn
 * @return {Function}
 * @see R.apply
 * @example
 *
 *      R.unapply(JSON.stringify)(1, 2, 3); //=> '[1,2,3]'
 * @symb R.unapply(f)(a, b) = f([a, b])
 */

var unapply =
/*#__PURE__*/
_curry1(function unapply(fn) {
  return function () {
    return fn(Array.prototype.slice.call(arguments, 0));
  };
});

/* harmony default export */ var es_unapply = (unapply);
// CONCATENATED MODULE: ./node_modules/ramda/es/unary.js


/**
 * Wraps a function of any arity (including nullary) in a function that accepts
 * exactly 1 parameter. Any extraneous parameters will not be passed to the
 * supplied function.
 *
 * @func
 * @memberOf R
 * @since v0.2.0
 * @category Function
 * @sig (* -> b) -> (a -> b)
 * @param {Function} fn The function to wrap.
 * @return {Function} A new function wrapping `fn`. The new function is guaranteed to be of
 *         arity 1.
 * @see R.binary, R.nAry
 * @example
 *
 *      const takesTwoArgs = function(a, b) {
 *        return [a, b];
 *      };
 *      takesTwoArgs.length; //=> 2
 *      takesTwoArgs(1, 2); //=> [1, 2]
 *
 *      const takesOneArg = R.unary(takesTwoArgs);
 *      takesOneArg.length; //=> 1
 *      // Only 1 argument is passed to the wrapped function
 *      takesOneArg(1, 2); //=> [1, undefined]
 * @symb R.unary(f)(a, b, c) = f(a)
 */

var unary_unary =
/*#__PURE__*/
_curry1(function unary(fn) {
  return es_nAry(1, fn);
});

/* harmony default export */ var es_unary = (unary_unary);
// CONCATENATED MODULE: ./node_modules/ramda/es/uncurryN.js


/**
 * Returns a function of arity `n` from a (manually) curried function.
 *
 * @func
 * @memberOf R
 * @since v0.14.0
 * @category Function
 * @sig Number -> (a -> b) -> (a -> c)
 * @param {Number} length The arity for the returned function.
 * @param {Function} fn The function to uncurry.
 * @return {Function} A new function.
 * @see R.curry
 * @example
 *
 *      const addFour = a => b => c => d => a + b + c + d;
 *
 *      const uncurriedAddFour = R.uncurryN(4, addFour);
 *      uncurriedAddFour(1, 2, 3, 4); //=> 10
 */

var uncurryN_uncurryN =
/*#__PURE__*/
_curry2(function uncurryN(depth, fn) {
  return es_curryN(depth, function () {
    var currentDepth = 1;
    var value = fn;
    var idx = 0;
    var endIdx;

    while (currentDepth <= depth && typeof value === 'function') {
      endIdx = currentDepth === depth ? arguments.length : idx + value.length;
      value = value.apply(this, Array.prototype.slice.call(arguments, idx, endIdx));
      currentDepth += 1;
      idx = endIdx;
    }

    return value;
  });
});

/* harmony default export */ var es_uncurryN = (uncurryN_uncurryN);
// CONCATENATED MODULE: ./node_modules/ramda/es/unfold.js

/**
 * Builds a list from a seed value. Accepts an iterator function, which returns
 * either false to stop iteration or an array of length 2 containing the value
 * to add to the resulting list and the seed to be used in the next call to the
 * iterator function.
 *
 * The iterator function receives one argument: *(seed)*.
 *
 * @func
 * @memberOf R
 * @since v0.10.0
 * @category List
 * @sig (a -> [b]) -> * -> [b]
 * @param {Function} fn The iterator function. receives one argument, `seed`, and returns
 *        either false to quit iteration or an array of length two to proceed. The element
 *        at index 0 of this array will be added to the resulting array, and the element
 *        at index 1 will be passed to the next call to `fn`.
 * @param {*} seed The seed value.
 * @return {Array} The final list.
 * @example
 *
 *      const f = n => n > 50 ? false : [-n, n + 10];
 *      R.unfold(f, 10); //=> [-10, -20, -30, -40, -50]
 * @symb R.unfold(f, x) = [f(x)[0], f(f(x)[1])[0], f(f(f(x)[1])[1])[0], ...]
 */

var unfold =
/*#__PURE__*/
_curry2(function unfold(fn, seed) {
  var pair = fn(seed);
  var result = [];

  while (pair && pair.length) {
    result[result.length] = pair[0];
    pair = fn(pair[1]);
  }

  return result;
});

/* harmony default export */ var es_unfold = (unfold);
// CONCATENATED MODULE: ./node_modules/ramda/es/union.js




/**
 * Combines two lists into a set (i.e. no duplicates) composed of the elements
 * of each list.
 *
 * @func
 * @memberOf R
 * @since v0.1.0
 * @category Relation
 * @sig [*] -> [*] -> [*]
 * @param {Array} as The first list.
 * @param {Array} bs The second list.
 * @return {Array} The first and second lists concatenated, with
 *         duplicates removed.
 * @example
 *
 *      R.union([1, 2, 3], [2, 3, 4]); //=> [1, 2, 3, 4]
 */

var union =
/*#__PURE__*/
_curry2(
/*#__PURE__*/
compose(es_uniq, _concat));

/* harmony default export */ var es_union = (union);
// CONCATENATED MODULE: ./node_modules/ramda/es/uniqWith.js


/**
 * Returns a new list containing only one copy of each element in the original
 * list, based upon the value returned by applying the supplied predicate to
 * two list elements. Prefers the first item if two items compare equal based
 * on the predicate.
 *
 * @func
 * @memberOf R
 * @since v0.2.0
 * @category List
 * @sig ((a, a) -> Boolean) -> [a] -> [a]
 * @param {Function} pred A predicate used to test whether two items are equal.
 * @param {Array} list The array to consider.
 * @return {Array} The list of unique items.
 * @example
 *
 *      const strEq = R.eqBy(String);
 *      R.uniqWith(strEq)([1, '1', 2, 1]); //=> [1, 2]
 *      R.uniqWith(strEq)([{}, {}]);       //=> [{}]
 *      R.uniqWith(strEq)([1, '1', 1]);    //=> [1]
 *      R.uniqWith(strEq)(['1', 1, 1]);    //=> ['1']
 */

var uniqWith_uniqWith =
/*#__PURE__*/
_curry2(function uniqWith(pred, list) {
  var idx = 0;
  var len = list.length;
  var result = [];
  var item;

  while (idx < len) {
    item = list[idx];

    if (!_includesWith(pred, item, result)) {
      result[result.length] = item;
    }

    idx += 1;
  }

  return result;
});

/* harmony default export */ var es_uniqWith = (uniqWith_uniqWith);
// CONCATENATED MODULE: ./node_modules/ramda/es/unionWith.js



/**
 * Combines two lists into a set (i.e. no duplicates) composed of the elements
 * of each list. Duplication is determined according to the value returned by
 * applying the supplied predicate to two list elements.
 *
 * @func
 * @memberOf R
 * @since v0.1.0
 * @category Relation
 * @sig ((a, a) -> Boolean) -> [*] -> [*] -> [*]
 * @param {Function} pred A predicate used to test whether two items are equal.
 * @param {Array} list1 The first list.
 * @param {Array} list2 The second list.
 * @return {Array} The first and second lists concatenated, with
 *         duplicates removed.
 * @see R.union
 * @example
 *
 *      const l1 = [{a: 1}, {a: 2}];
 *      const l2 = [{a: 1}, {a: 4}];
 *      R.unionWith(R.eqBy(R.prop('a')), l1, l2); //=> [{a: 1}, {a: 2}, {a: 4}]
 */

var unionWith_unionWith =
/*#__PURE__*/
_curry3(function unionWith(pred, list1, list2) {
  return es_uniqWith(pred, _concat(list1, list2));
});

/* harmony default export */ var es_unionWith = (unionWith_unionWith);
// CONCATENATED MODULE: ./node_modules/ramda/es/unless.js

/**
 * Tests the final argument by passing it to the given predicate function. If
 * the predicate is not satisfied, the function will return the result of
 * calling the `whenFalseFn` function with the same argument. If the predicate
 * is satisfied, the argument is returned as is.
 *
 * @func
 * @memberOf R
 * @since v0.18.0
 * @category Logic
 * @sig (a -> Boolean) -> (a -> a) -> a -> a
 * @param {Function} pred        A predicate function
 * @param {Function} whenFalseFn A function to invoke when the `pred` evaluates
 *                               to a falsy value.
 * @param {*}        x           An object to test with the `pred` function and
 *                               pass to `whenFalseFn` if necessary.
 * @return {*} Either `x` or the result of applying `x` to `whenFalseFn`.
 * @see R.ifElse, R.when, R.cond
 * @example
 *
 *      let safeInc = R.unless(R.isNil, R.inc);
 *      safeInc(null); //=> null
 *      safeInc(1); //=> 2
 */

var unless =
/*#__PURE__*/
_curry3(function unless(pred, whenFalseFn, x) {
  return pred(x) ? x : whenFalseFn(x);
});

/* harmony default export */ var es_unless = (unless);
// CONCATENATED MODULE: ./node_modules/ramda/es/unnest.js


/**
 * Shorthand for `R.chain(R.identity)`, which removes one level of nesting from
 * any [Chain](https://github.com/fantasyland/fantasy-land#chain).
 *
 * @func
 * @memberOf R
 * @since v0.3.0
 * @category List
 * @sig Chain c => c (c a) -> c a
 * @param {*} list
 * @return {*}
 * @see R.flatten, R.chain
 * @example
 *
 *      R.unnest([1, [2], [[3]]]); //=> [1, 2, [3]]
 *      R.unnest([[1, 2], [3, 4], [5, 6]]); //=> [1, 2, 3, 4, 5, 6]
 */

var unnest =
/*#__PURE__*/
es_chain(_identity);
/* harmony default export */ var es_unnest = (unnest);
// CONCATENATED MODULE: ./node_modules/ramda/es/until.js

/**
 * Takes a predicate, a transformation function, and an initial value,
 * and returns a value of the same type as the initial value.
 * It does so by applying the transformation until the predicate is satisfied,
 * at which point it returns the satisfactory value.
 *
 * @func
 * @memberOf R
 * @since v0.20.0
 * @category Logic
 * @sig (a -> Boolean) -> (a -> a) -> a -> a
 * @param {Function} pred A predicate function
 * @param {Function} fn The iterator function
 * @param {*} init Initial value
 * @return {*} Final value that satisfies predicate
 * @example
 *
 *      R.until(R.gt(R.__, 100), R.multiply(2))(1) // => 128
 */

var until =
/*#__PURE__*/
_curry3(function until(pred, fn, init) {
  var val = init;

  while (!pred(val)) {
    val = fn(val);
  }

  return val;
});

/* harmony default export */ var es_until = (until);
// CONCATENATED MODULE: ./node_modules/ramda/es/valuesIn.js

/**
 * Returns a list of all the properties, including prototype properties, of the
 * supplied object.
 * Note that the order of the output array is not guaranteed to be consistent
 * across different JS platforms.
 *
 * @func
 * @memberOf R
 * @since v0.2.0
 * @category Object
 * @sig {k: v} -> [v]
 * @param {Object} obj The object to extract values from
 * @return {Array} An array of the values of the object's own and prototype properties.
 * @see R.values, R.keysIn
 * @example
 *
 *      const F = function() { this.x = 'X'; };
 *      F.prototype.y = 'Y';
 *      const f = new F();
 *      R.valuesIn(f); //=> ['X', 'Y']
 */

var valuesIn =
/*#__PURE__*/
_curry1(function valuesIn(obj) {
  var prop;
  var vs = [];

  for (prop in obj) {
    vs[vs.length] = obj[prop];
  }

  return vs;
});

/* harmony default export */ var es_valuesIn = (valuesIn);
// CONCATENATED MODULE: ./node_modules/ramda/es/view.js
 // `Const` is a functor that effectively ignores the function given to `map`.

var Const = function (x) {
  return {
    value: x,
    'fantasy-land/map': function () {
      return this;
    }
  };
};
/**
 * Returns a "view" of the given data structure, determined by the given lens.
 * The lens's focus determines which portion of the data structure is visible.
 *
 * @func
 * @memberOf R
 * @since v0.16.0
 * @category Object
 * @typedefn Lens s a = Functor f => (a -> f a) -> s -> f s
 * @sig Lens s a -> s -> a
 * @param {Lens} lens
 * @param {*} x
 * @return {*}
 * @see R.prop, R.lensIndex, R.lensProp
 * @example
 *
 *      const xLens = R.lensProp('x');
 *
 *      R.view(xLens, {x: 1, y: 2});  //=> 1
 *      R.view(xLens, {x: 4, y: 2});  //=> 4
 */


var view =
/*#__PURE__*/
_curry2(function view(lens, x) {
  // Using `Const` effectively ignores the setter function of the `lens`,
  // leaving the value returned by the getter function unmodified.
  return lens(Const)(x).value;
});

/* harmony default export */ var es_view = (view);
// CONCATENATED MODULE: ./node_modules/ramda/es/when.js

/**
 * Tests the final argument by passing it to the given predicate function. If
 * the predicate is satisfied, the function will return the result of calling
 * the `whenTrueFn` function with the same argument. If the predicate is not
 * satisfied, the argument is returned as is.
 *
 * @func
 * @memberOf R
 * @since v0.18.0
 * @category Logic
 * @sig (a -> Boolean) -> (a -> a) -> a -> a
 * @param {Function} pred       A predicate function
 * @param {Function} whenTrueFn A function to invoke when the `condition`
 *                              evaluates to a truthy value.
 * @param {*}        x          An object to test with the `pred` function and
 *                              pass to `whenTrueFn` if necessary.
 * @return {*} Either `x` or the result of applying `x` to `whenTrueFn`.
 * @see R.ifElse, R.unless, R.cond
 * @example
 *
 *      // truncate :: String -> String
 *      const truncate = R.when(
 *        R.propSatisfies(R.gt(R.__, 10), 'length'),
 *        R.pipe(R.take(10), R.append('…'), R.join(''))
 *      );
 *      truncate('12345');         //=> '12345'
 *      truncate('0123456789ABC'); //=> '0123456789…'
 */

var when =
/*#__PURE__*/
_curry3(function when(pred, whenTrueFn, x) {
  return pred(x) ? whenTrueFn(x) : x;
});

/* harmony default export */ var es_when = (when);
// CONCATENATED MODULE: ./node_modules/ramda/es/where.js


/**
 * Takes a spec object and a test object; returns true if the test satisfies
 * the spec. Each of the spec's own properties must be a predicate function.
 * Each predicate is applied to the value of the corresponding property of the
 * test object. `where` returns true if all the predicates return true, false
 * otherwise.
 *
 * `where` is well suited to declaratively expressing constraints for other
 * functions such as [`filter`](#filter) and [`find`](#find).
 *
 * @func
 * @memberOf R
 * @since v0.1.1
 * @category Object
 * @sig {String: (* -> Boolean)} -> {String: *} -> Boolean
 * @param {Object} spec
 * @param {Object} testObj
 * @return {Boolean}
 * @see R.propSatisfies, R.whereEq
 * @example
 *
 *      // pred :: Object -> Boolean
 *      const pred = R.where({
 *        a: R.equals('foo'),
 *        b: R.complement(R.equals('bar')),
 *        x: R.gt(R.__, 10),
 *        y: R.lt(R.__, 20)
 *      });
 *
 *      pred({a: 'foo', b: 'xxx', x: 11, y: 19}); //=> true
 *      pred({a: 'xxx', b: 'xxx', x: 11, y: 19}); //=> false
 *      pred({a: 'foo', b: 'bar', x: 11, y: 19}); //=> false
 *      pred({a: 'foo', b: 'xxx', x: 10, y: 19}); //=> false
 *      pred({a: 'foo', b: 'xxx', x: 11, y: 20}); //=> false
 */

var where_where =
/*#__PURE__*/
_curry2(function where(spec, testObj) {
  for (var prop in spec) {
    if (_has(prop, spec) && !spec[prop](testObj[prop])) {
      return false;
    }
  }

  return true;
});

/* harmony default export */ var es_where = (where_where);
// CONCATENATED MODULE: ./node_modules/ramda/es/whereEq.js




/**
 * Takes a spec object and a test object; returns true if the test satisfies
 * the spec, false otherwise. An object satisfies the spec if, for each of the
 * spec's own properties, accessing that property of the object gives the same
 * value (in [`R.equals`](#equals) terms) as accessing that property of the
 * spec.
 *
 * `whereEq` is a specialization of [`where`](#where).
 *
 * @func
 * @memberOf R
 * @since v0.14.0
 * @category Object
 * @sig {String: *} -> {String: *} -> Boolean
 * @param {Object} spec
 * @param {Object} testObj
 * @return {Boolean}
 * @see R.propEq, R.where
 * @example
 *
 *      // pred :: Object -> Boolean
 *      const pred = R.whereEq({a: 1, b: 2});
 *
 *      pred({a: 1});              //=> false
 *      pred({a: 1, b: 2});        //=> true
 *      pred({a: 1, b: 2, c: 3});  //=> true
 *      pred({a: 1, b: 1});        //=> false
 */

var whereEq_whereEq =
/*#__PURE__*/
_curry2(function whereEq(spec, testObj) {
  return es_where(es_map(es_equals, spec), testObj);
});

/* harmony default export */ var es_whereEq = (whereEq_whereEq);
// CONCATENATED MODULE: ./node_modules/ramda/es/without.js




/**
 * Returns a new list without values in the first argument.
 * [`R.equals`](#equals) is used to determine equality.
 *
 * Acts as a transducer if a transformer is given in list position.
 *
 * @func
 * @memberOf R
 * @since v0.19.0
 * @category List
 * @sig [a] -> [a] -> [a]
 * @param {Array} list1 The values to be removed from `list2`.
 * @param {Array} list2 The array to remove values from.
 * @return {Array} The new array without values in `list1`.
 * @see R.transduce, R.difference, R.remove
 * @example
 *
 *      R.without([1, 2], [1, 2, 1, 3, 4]); //=> [3, 4]
 */

var without =
/*#__PURE__*/
_curry2(function (xs, list) {
  return es_reject(es_flip(_includes)(xs), list);
});

/* harmony default export */ var es_without = (without);
// CONCATENATED MODULE: ./node_modules/ramda/es/xor.js

/**
 * Exclusive disjunction logical operation.
 * Returns `true` if one of the arguments is truthy and the other is falsy.
 * Otherwise, it returns `false`.
 *
 * @func
 * @memberOf R
 * @since v0.27.0
 * @category Logic
 * @sig a -> b -> Boolean
 * @param {Any} a
 * @param {Any} b
 * @return {Boolean} true if one of the arguments is truthy and the other is falsy
 * @see R.or, R.and
 * @example
 *
 *      R.xor(true, true); //=> false
 *      R.xor(true, false); //=> true
 *      R.xor(false, true); //=> true
 *      R.xor(false, false); //=> false
 */

var xor =
/*#__PURE__*/
_curry2(function xor(a, b) {
  return Boolean(!a ^ !b);
});

/* harmony default export */ var es_xor = (xor);
// CONCATENATED MODULE: ./node_modules/ramda/es/xprod.js

/**
 * Creates a new list out of the two supplied by creating each possible pair
 * from the lists.
 *
 * @func
 * @memberOf R
 * @since v0.1.0
 * @category List
 * @sig [a] -> [b] -> [[a,b]]
 * @param {Array} as The first list.
 * @param {Array} bs The second list.
 * @return {Array} The list made by combining each possible pair from
 *         `as` and `bs` into pairs (`[a, b]`).
 * @example
 *
 *      R.xprod([1, 2], ['a', 'b']); //=> [[1, 'a'], [1, 'b'], [2, 'a'], [2, 'b']]
 * @symb R.xprod([a, b], [c, d]) = [[a, c], [a, d], [b, c], [b, d]]
 */

var xprod =
/*#__PURE__*/
_curry2(function xprod(a, b) {
  // = xprodWith(prepend); (takes about 3 times as long...)
  var idx = 0;
  var ilen = a.length;
  var j;
  var jlen = b.length;
  var result = [];

  while (idx < ilen) {
    j = 0;

    while (j < jlen) {
      result[result.length] = [a[idx], b[j]];
      j += 1;
    }

    idx += 1;
  }

  return result;
});

/* harmony default export */ var es_xprod = (xprod);
// CONCATENATED MODULE: ./node_modules/ramda/es/zip.js

/**
 * Creates a new list out of the two supplied by pairing up equally-positioned
 * items from both lists. The returned list is truncated to the length of the
 * shorter of the two input lists.
 * Note: `zip` is equivalent to `zipWith(function(a, b) { return [a, b] })`.
 *
 * @func
 * @memberOf R
 * @since v0.1.0
 * @category List
 * @sig [a] -> [b] -> [[a,b]]
 * @param {Array} list1 The first array to consider.
 * @param {Array} list2 The second array to consider.
 * @return {Array} The list made by pairing up same-indexed elements of `list1` and `list2`.
 * @example
 *
 *      R.zip([1, 2, 3], ['a', 'b', 'c']); //=> [[1, 'a'], [2, 'b'], [3, 'c']]
 * @symb R.zip([a, b, c], [d, e, f]) = [[a, d], [b, e], [c, f]]
 */

var zip =
/*#__PURE__*/
_curry2(function zip(a, b) {
  var rv = [];
  var idx = 0;
  var len = Math.min(a.length, b.length);

  while (idx < len) {
    rv[idx] = [a[idx], b[idx]];
    idx += 1;
  }

  return rv;
});

/* harmony default export */ var es_zip = (zip);
// CONCATENATED MODULE: ./node_modules/ramda/es/zipObj.js

/**
 * Creates a new object out of a list of keys and a list of values.
 * Key/value pairing is truncated to the length of the shorter of the two lists.
 * Note: `zipObj` is equivalent to `pipe(zip, fromPairs)`.
 *
 * @func
 * @memberOf R
 * @since v0.3.0
 * @category List
 * @sig [String] -> [*] -> {String: *}
 * @param {Array} keys The array that will be properties on the output object.
 * @param {Array} values The list of values on the output object.
 * @return {Object} The object made by pairing up same-indexed elements of `keys` and `values`.
 * @example
 *
 *      R.zipObj(['a', 'b', 'c'], [1, 2, 3]); //=> {a: 1, b: 2, c: 3}
 */

var zipObj =
/*#__PURE__*/
_curry2(function zipObj(keys, values) {
  var idx = 0;
  var len = Math.min(keys.length, values.length);
  var out = {};

  while (idx < len) {
    out[keys[idx]] = values[idx];
    idx += 1;
  }

  return out;
});

/* harmony default export */ var es_zipObj = (zipObj);
// CONCATENATED MODULE: ./node_modules/ramda/es/zipWith.js

/**
 * Creates a new list out of the two supplied by applying the function to each
 * equally-positioned pair in the lists. The returned list is truncated to the
 * length of the shorter of the two input lists.
 *
 * @function
 * @memberOf R
 * @since v0.1.0
 * @category List
 * @sig ((a, b) -> c) -> [a] -> [b] -> [c]
 * @param {Function} fn The function used to combine the two elements into one value.
 * @param {Array} list1 The first array to consider.
 * @param {Array} list2 The second array to consider.
 * @return {Array} The list made by combining same-indexed elements of `list1` and `list2`
 *         using `fn`.
 * @example
 *
 *      const f = (x, y) => {
 *        // ...
 *      };
 *      R.zipWith(f, [1, 2, 3], ['a', 'b', 'c']);
 *      //=> [f(1, 'a'), f(2, 'b'), f(3, 'c')]
 * @symb R.zipWith(fn, [a, b, c], [d, e, f]) = [fn(a, d), fn(b, e), fn(c, f)]
 */

var zipWith =
/*#__PURE__*/
_curry3(function zipWith(fn, a, b) {
  var rv = [];
  var idx = 0;
  var len = Math.min(a.length, b.length);

  while (idx < len) {
    rv[idx] = fn(a[idx], b[idx]);
    idx += 1;
  }

  return rv;
});

/* harmony default export */ var es_zipWith = (zipWith);
// CONCATENATED MODULE: ./node_modules/ramda/es/thunkify.js


/**
 * Creates a thunk out of a function. A thunk delays a calculation until
 * its result is needed, providing lazy evaluation of arguments.
 *
 * @func
 * @memberOf R
 * @since v0.26.0
 * @category Function
 * @sig ((a, b, ..., j) -> k) -> (a, b, ..., j) -> (() -> k)
 * @param {Function} fn A function to wrap in a thunk
 * @return {Function} Expects arguments for `fn` and returns a new function
 *  that, when called, applies those arguments to `fn`.
 * @see R.partial, R.partialRight
 * @example
 *
 *      R.thunkify(R.identity)(42)(); //=> 42
 *      R.thunkify((a, b) => a + b)(25, 17)(); //=> 42
 */

var thunkify_thunkify =
/*#__PURE__*/
_curry1(function thunkify(fn) {
  return es_curryN(fn.length, function createThunk() {
    var fnArgs = arguments;
    return function invokeThunk() {
      return fn.apply(this, fnArgs);
    };
  });
});

/* harmony default export */ var es_thunkify = (thunkify_thunkify);
// CONCATENATED MODULE: ./node_modules/ramda/es/index.js


































































































































































































































































/***/ }),
/* 5 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.getCommentActionsList = exports.getGuildActionsBar = exports.getPostActionsListOnMobile = exports.getPostActionsListOnDesktop = exports.getPostActionsList = exports.getReplyTextArea = exports.isReplyToPost = exports.getReplyToPost = exports.getCommentReplyToPart = exports.getComments = exports.getPostListContainer = exports.getTopLevelContainersForBlurring = exports.getPostUrlInPostCreation = exports.getPostTitleInPostCreation = exports.getRightSidebarEl = exports.getMyGuildsInSidebarEl = exports.getLeftSidebarEl = exports.getPageLoadingMarker = exports.getNextPageLink = exports.getPagination = exports.getPosts = exports.notCrosspost = void 0;
var styles_1 = __webpack_require__(3);
var common_1 = __webpack_require__(0);
exports.notCrosspost = function (_, rawEl) { return $(rawEl).closest('#crosspost-embed').length === 0; };
exports.getPosts = function () {
    return $('#posts > .card, .posts > .card, #thread .card')
        .filter(function (_, rawEl) { return $(rawEl).closest('#GIFs').length === 0; })
        .filter(exports.notCrosspost);
};
exports.getPagination = function (from) { return $('ul.pagination', from).parent(); };
exports.getNextPageLink = function () { return exports.getPagination().find('a:contains(Next)'); };
exports.getPageLoadingMarker = function () { return common_1.$c(styles_1.pageLoadingCls); };
exports.getLeftSidebarEl = function () { return $('#sidebar-left'); };
exports.getMyGuildsInSidebarEl = function () { return exports.getLeftSidebarEl().find('a[href="/browse"]').closest('.mb-4'); };
exports.getRightSidebarEl = function () { return $('.sidebar:not(.sidebar-left)'); };
exports.getPostTitleInPostCreation = function () { return common_1.$i('post-title'); };
exports.getPostUrlInPostCreation = function () { return common_1.$i('post-URL'); };
exports.getTopLevelContainersForBlurring = function () { return $('#main-content-row, #submitform'); };
exports.getPostListContainer = function () { return common_1.$i('main-content-col'); };
exports.getComments = function () { return $('.comment-body .user-info').parent(); };
exports.getCommentReplyToPart = function (commentEl) {
    var _a;
    var replyEl = commentEl.next();
    if (!((_a = replyEl.prop('id')) === null || _a === void 0 ? void 0 : _a.startsWith('reply-to-'))) {
        return null;
    }
    return replyEl;
};
exports.getReplyToPost = function () {
    var r = $('.comments-count ~ .comment-write');
    return r.length ? r : null;
};
exports.isReplyToPost = function (el) { return el.hasClass('comment-write'); };
exports.getReplyTextArea = function (replyEl) { return replyEl.find('textarea[name=body]'); };
exports.getPostActionsList = function (from) { return $('.post-actions > ul', from); };
exports.getPostActionsListOnDesktop = function (from) {
    return exports.getPostActionsList(from).filter(function (_, rawEl) { return !$(rawEl).parent().parent().hasClass('d-md-none'); });
};
exports.getPostActionsListOnMobile = function (from) {
    return exports.getPostActionsList(from).filter(function (_, rawEl) { return $(rawEl).parent().parent().hasClass('d-md-none'); });
};
exports.getGuildActionsBar = function () { return $('#main-content-col .sticky.guild-border-top > .col > .d-flex'); };
exports.getCommentActionsList = function (from) { return $('.comment-actions > ul', from); };


/***/ }),
/* 6 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var __awaiter = (this && this.__awaiter) || function (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());
    });
};
var __generator = (this && this.__generator) || function (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 };
    }
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.RuqESModule = void 0;
var RuqESModule = /** @class */ (function () {
    function RuqESModule() {
        this.firstSetupRunFinished = false;
        this.somePostsFullyHiddenCb = null;
    }
    RuqESModule.prototype.onContentChange = function (args, cfg) {
        return __awaiter(this, void 0, void 0, function () {
            return __generator(this, function (_a) {
                return [2 /*return*/, Promise.resolve()];
            });
        });
    };
    RuqESModule.prototype.registerSomePostsFullyHiddenHandler = function (handler) {
        if (this.somePostsFullyHiddenCb) {
            throw new Error("somePostsFullyHidden handler already registered");
        }
        this.somePostsFullyHiddenCb = handler;
    };
    RuqESModule.prototype.onSomePostsFullyHidden = function (cfg) { };
    RuqESModule.prototype.markFirstSetupRunFinished = function () { this.firstSetupRunFinished = true; };
    return RuqESModule;
}());
exports.RuqESModule = RuqESModule;


/***/ }),
/* 7 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var __awaiter = (this && this.__awaiter) || function (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());
    });
};
var __generator = (this && this.__generator) || function (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 };
    }
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.writeConfig = exports.readConfig = exports.defaultConfig = exports.asDownloadButtonModeOrDefault = exports.isValidDownloadButtonMode = exports.downloadButtonModes = exports.thumbnailModeNames = exports.asThumbnailModeOrDefault = exports.defaultThumbnailMode = exports.isValidThumbnailMode = exports.thumbnailModeValues = exports.isValidSort = exports.sortValues = exports.asImageThumbnailIconTypeStyleOrDefault = exports.imageThumbnailIconTypeStyleNames = exports.imageThumbnailIconTypeStyles = exports.asExpandoButtonStyleOrDefault = exports.defaultExpandoButtonStyle = exports.expandoButtonStyleNames = exports.expandoButtonStyles = void 0;
var ramda_1 = __webpack_require__(4);
var common_1 = __webpack_require__(0);
var settingsConfigKey = 'config';
exports.expandoButtonStyles = ['bigWide', 'big', 'medium', 'small'];
exports.expandoButtonStyleNames = {
    small: 'Small (icon)',
    medium: 'Medium',
    big: 'Big',
    bigWide: 'Big - extra wide',
};
exports.defaultExpandoButtonStyle = 'big';
exports.asExpandoButtonStyleOrDefault = function (x) {
    return ramda_1.includes(x, exports.expandoButtonStyles) ? x : exports.defaultExpandoButtonStyle;
};
exports.imageThumbnailIconTypeStyles = ['emoji', 'fa'];
exports.imageThumbnailIconTypeStyleNames = {
    emoji: 'Emoji',
    fa: 'Font Awesome',
};
var defaultImageThumbnailIconTypeStyle = 'fa';
exports.asImageThumbnailIconTypeStyleOrDefault = function (x) {
    return ramda_1.includes(x, exports.imageThumbnailIconTypeStyles) ? x : defaultImageThumbnailIconTypeStyle;
};
exports.sortValues = ['hot', 'top', 'new', 'disputed', 'activity'];
exports.isValidSort = function (x) { return exports.sortValues.includes(x); };
exports.thumbnailModeValues = ['vanilla', 'small', 'icon', 'hide', 'large', 'huge'];
exports.isValidThumbnailMode = function (x) { return exports.thumbnailModeValues.includes(x); };
exports.defaultThumbnailMode = 'vanilla';
exports.asThumbnailModeOrDefault = function (x) {
    var y = String(x);
    return exports.isValidThumbnailMode(y) ? y : exports.defaultThumbnailMode;
};
exports.thumbnailModeNames = {
    vanilla: 'Vanilla (no change)',
    small: 'Small',
    icon: 'Icon',
    hide: 'Hide',
    large: 'Large',
    huge: 'Huge',
};
exports.downloadButtonModes = ['twoClick', 'downloadServer'];
exports.isValidDownloadButtonMode = function (x) { return exports.downloadButtonModes.includes(x); };
var defaultDownloadButtonMode = 'twoClick';
exports.asDownloadButtonModeOrDefault = function (x) {
    var y = String(x);
    return exports.isValidDownloadButtonMode(y) ? y : defaultDownloadButtonMode;
};
exports.defaultConfig = Object.freeze(common_1.ofType({
    scriptVersion: common_1.scriptVersion,
    debug: {
        enabled: false,
        autoOpenSettings: false,
        insertTestPostRule: false,
        dontHideAppLoadingOverlay: false,
    },
    expandoButton: {
        enabled: true,
        resize: true,
        style: exports.defaultExpandoButtonStyle,
        alignRight: false,
        textClosed: '+',
        textOpened: '-',
        showComments: true,
        autoExpandComments: false,
        hideToggleCommentsButton: false,
        postTextOrder: 1,
        embedOrder: 2,
        commentsOrder: 3,
        closerEnabled: true,
        clickOnPostToOpen: false,
        hide: false,
        autoOpenOnDetail: false,
        autoOpenOnDetailOnUnsupportedVideos: true,
        deferLoadingOfPost: false,
        autoOpen: false,
    },
    infiniteScroll: {
        enabled: true,
        loadEarlier: false,
    },
    voting: {
        bigVoteArrowsOnMobile: true,
        clickEffect: true,
    },
    post: {
        openInNewTab: false,
        hideAlreadyJoinedGuildsInDiscovery: true,
        improvedTableStyles: true,
        lessAggressivePatronBadges: false,
        disablePostActionsJumpingAboveBarOnHover: false,
        imageThumbnailIconType: true,
        imageThumbnailIconTypeStyle: defaultImageThumbnailIconTypeStyle,
        imageThumbnailIconTypeBackground: false,
        closeButtonInImageDialog: true,
        rulesEngineEnabled: false,
        rules: [],
        upDownVotesAsText: true,
        downloadButton: false,
        downloadButtonMode: 'twoClick',
        showThumbnailOnHover: false,
        thumbnailMode: 'vanilla',
    },
    createPost: {
        loadTitleButton: true,
        markdownPreview: true,
        openUrlButton: true,
    },
    comment: {
        ctrlEnterToSend: true,
        biggerFoldButtons: true,
        upDownVotesAsText: true,
        preview: true,
        autoCollapseCommentsRegex: '',
        hideTipButton: false,
        imageUpload: true,
        reactionGifs: true,
        revealBlocked: false,
    },
    sidebar: {
        rightButton: true,
        autoHideRight: false,
        autoHideRightButNotOnGuildPage: false,
        independentScroll: true,
        favoritesEnabled: true,
        favorites: [],
        favoritesSmallImages: false,
        smallGuildImages: false,
        savedContentLinkInFeeds: true,
        hideContentOfMyGuilds: false,
    },
    external: {
        imgbbKey: '',
        downloadServerAddress: 'http://localhost:4527',
    },
    advanced: {
        enabled: false,
        js: '',
        css: '',
    },
    save: {
        enabled: true,
        posts: [],
        commentSavingEnabled: true,
        postSavingEnabled: true,
        comments: [],
    },
    application: {
        disableLoadingOverlay: false,
    },
}));
var upgradeConfig = function (cfg) {
    return ramda_1.pipe(ramda_1.mergeDeepLeft(cfg), ramda_1.assoc('scriptVersion', common_1.scriptVersion))(exports.defaultConfig);
};
exports.readConfig = function (_a) {
    var forceUpgrade = (_a === void 0 ? {} : _a).forceUpgrade;
    return __awaiter(void 0, void 0, void 0, function () {
        var rawCfg, cfg, upgradedConfig;
        return __generator(this, function (_b) {
            switch (_b.label) {
                case 0: return [4 /*yield*/, GM.getValue(settingsConfigKey, exports.defaultConfig)];
                case 1:
                    rawCfg = _b.sent();
                    if (!(rawCfg.scriptVersion !== common_1.scriptVersion || forceUpgrade)) return [3 /*break*/, 3];
                    console.log("[RuqES] Upgrading config " + rawCfg.scriptVersion + " -> " + common_1.scriptVersion);
                    upgradedConfig = upgradeConfig(rawCfg);
                    cfg = upgradedConfig;
                    return [4 /*yield*/, exports.writeConfig(upgradedConfig)];
                case 2:
                    _b.sent();
                    return [3 /*break*/, 4];
                case 3:
                    cfg = rawCfg;
                    _b.label = 4;
                case 4:
                    common_1.debugLog('readConfig', cfg);
                    if (cfg.debug.enabled) {
                        common_1.enabledDebug();
                    }
                    return [2 /*return*/, cfg];
            }
        });
    });
};
exports.writeConfig = function (x) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
    switch (_a.label) {
        case 0: return [4 /*yield*/, GM.setValue(settingsConfigKey, x)];
        case 1: return [2 /*return*/, _a.sent()];
    }
}); }); }; // value can be an object, types are incorrect


/***/ }),
/* 8 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony default export */ __webpack_exports__["default"] = ("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n<svg\n        xmlns:dc=\"http://purl.org/dc/elements/1.1/\"\n        xmlns:cc=\"http://creativecommons.org/ns#\"\n        xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"\n        xmlns:svg=\"http://www.w3.org/2000/svg\"\n        xmlns=\"http://www.w3.org/2000/svg\"\n        xmlns:sodipodi=\"http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd\"\n        xmlns:inkscape=\"http://www.inkscape.org/namespaces/inkscape\"\n        inkscape:version=\"1.0 (4035a4fb49, 2020-05-01)\"\n        sodipodi:docname=\"ruqes_logo_exported.svg\"\n        id=\"svg869\"\n        version=\"1.1\"\n        viewBox=\"0 0 255.99998 255.99998\"\n        height=\"255.99998mm\"\n        width=\"255.99998mm\">\n    <defs\n            id=\"defs863\" />\n    <sodipodi:namedview\n            inkscape:window-maximized=\"1\"\n            inkscape:window-y=\"30\"\n            inkscape:window-x=\"1920\"\n            inkscape:window-height=\"2082\"\n            inkscape:window-width=\"3834\"\n            fit-margin-bottom=\"0\"\n            fit-margin-right=\"0\"\n            fit-margin-left=\"0\"\n            fit-margin-top=\"0\"\n            showgrid=\"false\"\n            inkscape:document-rotation=\"0\"\n            inkscape:current-layer=\"text853\"\n            inkscape:document-units=\"mm\"\n            inkscape:cy=\"336.90225\"\n            inkscape:cx=\"777.44097\"\n            inkscape:zoom=\"0.7\"\n            inkscape:pageshadow=\"2\"\n            inkscape:pageopacity=\"0.0\"\n            borderopacity=\"1.0\"\n            bordercolor=\"#666666\"\n            pagecolor=\"#ffffff\"\n            id=\"base\" />\n    <metadata\n            id=\"metadata866\">\n        <rdf:RDF>\n            <cc:Work\n                    rdf:about=\"\">\n                <dc:format>image/svg+xml</dc:format>\n                <dc:type\n                        rdf:resource=\"http://purl.org/dc/dcmitype/StillImage\" />\n                <dc:title></dc:title>\n            </cc:Work>\n        </rdf:RDF>\n    </metadata>\n    <g\n            transform=\"translate(349.49404,269.36309)\"\n            id=\"layer1\"\n            inkscape:groupmode=\"layer\"\n            inkscape:label=\"Layer 1\">\n        <path\n                d=\"m -279.08335,-269.36309 c -2.74077,35.24592 -32.03738,62.81064 -68.01032,62.81064 h -2.18901 c -0.1388,1.78488 -0.21136,3.58881 -0.21136,5.41052 v 95.16266 c 0,37.794655 30.42651,68.221161 68.22116,68.221161 h 119.55756 c 37.79464,0 68.221154,-30.426506 68.221154,-68.221161 v -95.16266 c 0,-37.79465 -30.426514,-68.22116 -68.221154,-68.22116 z\"\n                style=\"fill:#800080;fill-opacity:1;stroke:#800080;stroke-width:0;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke fill markers\"\n                id=\"rect855\" />\n        <g\n                style=\"font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:219.931px;line-height:100%;font-family:'Fira Sans';-inkscape-font-specification:'Fira Sans';font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:0px;word-spacing:0px;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;vector-effect:none;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.264583px;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1\"\n                id=\"text853\"\n                aria-label=\"r+\">\n            <path\n                    id=\"path1505\"\n                    style=\"font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:219.931px;font-family:CostaRica;-inkscape-font-specification:CostaRica;fill:#ffffff;stroke-width:0.264583px\"\n                    d=\"m -220.88911,-156.30975 v -27.49137 h -61.80061 c -11.21648,0 -20.67351,9.45703 -20.67351,20.67351 v 89.291985 h 41.34703 v -82.474125 z\" />\n            <path\n                    id=\"path1507\"\n                    style=\"font-size:142.955px;baseline-shift:super;fill:#ffffff;stroke-width:0.264583px\"\n                    d=\"m -184.2268,-233.28552 v 26.87554 h -26.87554 v 17.72642 h 26.87554 v 26.87554 h 17.72642 v -26.87554 h 26.87554 v -17.72642 h -26.87554 v -26.87554 z\" />\n        </g>\n        <circle\n                style=\"fill:#800080;stroke:none;stroke-width:0.342901;stroke-linejoin:round;paint-order:stroke fill markers\"\n                id=\"circle857\"\n                cx=\"-109.7934\"\n                cy=\"-29.662453\"\n                r=\"16.299351\" />\n    </g>\n</svg>\n");

/***/ }),
/* 9 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var __awaiter = (this && this.__awaiter) || function (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());
    });
};
var __generator = (this && this.__generator) || function (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 };
    }
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.handleModulesAfterContentChange = exports.handleFirstSetupOfModules = exports.registerClassModule = void 0;
var config_1 = __webpack_require__(7);
var common_1 = __webpack_require__(0);
var modules = [];
var somePostsWereFullyHidden = false;
exports.registerClassModule = function (cls) {
    cls.registerSomePostsFullyHiddenHandler(function () { return somePostsWereFullyHidden = true; });
    modules.push(cls);
};
var readConfigOrDefault = function () { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
    switch (_a.label) {
        case 0: return [4 /*yield*/, config_1.readConfig()];
        case 1: return [2 /*return*/, _a.sent()];
    }
}); }); };
exports.handleFirstSetupOfModules = function () { return __awaiter(void 0, void 0, void 0, function () {
    var cfg;
    return __generator(this, function (_a) {
        switch (_a.label) {
            case 0:
                common_1.debugLog('modules', 'handleFirstSetupOfModules');
                return [4 /*yield*/, readConfigOrDefault()];
            case 1:
                cfg = _a.sent();
                modules.forEach(function (m) {
                    m.setup({}, cfg);
                    m.markFirstSetupRunFinished();
                });
                return [2 /*return*/];
        }
    });
}); };
exports.handleModulesAfterContentChange = function () { return __awaiter(void 0, void 0, void 0, function () {
    var cfg;
    return __generator(this, function (_a) {
        switch (_a.label) {
            case 0:
                common_1.debugLog('modules', 'handleModulesAfterContentChange');
                return [4 /*yield*/, readConfigOrDefault()];
            case 1:
                cfg = _a.sent();
                modules.forEach(function (m) {
                    return m.onContentChange({ silent: true }, cfg);
                });
                if (!somePostsWereFullyHidden) return [3 /*break*/, 3];
                return [4 /*yield*/, handleOnSomePostsFullyHidden()];
            case 2:
                _a.sent();
                somePostsWereFullyHidden = false;
                _a.label = 3;
            case 3: return [2 /*return*/];
        }
    });
}); };
var handleOnSomePostsFullyHidden = function () { return __awaiter(void 0, void 0, void 0, function () {
    var cfg;
    return __generator(this, function (_a) {
        switch (_a.label) {
            case 0:
                common_1.debugLog('modules', 'handleOnSomePostsFullyHidden');
                return [4 /*yield*/, readConfigOrDefault()];
            case 1:
                cfg = _a.sent();
                modules.forEach(function (m) { return m.onSomePostsFullyHidden(cfg); });
                return [2 /*return*/];
        }
    });
}); };


/***/ }),
/* 10 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.addCustomScript = exports.addStyle = void 0;
exports.addStyle = function (style, id) {
    style = style instanceof Array ? style.join('\n') : style;
    var el = $('<style type="text/css">' + style + '</style>');
    if (id) {
        el.prop('id', id);
    }
    $('head').append(el);
};
exports.addCustomScript = function (script, id) {
    script = script instanceof Array ? script.join('\n') : script;
    var el = $('<script>' + script + '</script>');
    if (id) {
        el.prop('id', id);
    }
    $('body').append(el);
};


/***/ }),
/* 11 */
/***/ (function(module, exports, __webpack_require__) {

/* WEBPACK VAR INJECTION */(function(module) {var require;//! moment.js
//! version : 2.27.0
//! authors : Tim Wood, Iskren Chernev, Moment.js contributors
//! license : MIT
//! momentjs.com

;(function (global, factory) {
     true ? module.exports = factory() :
    undefined
}(this, (function () { 'use strict';

    var hookCallback;

    function hooks() {
        return hookCallback.apply(null, arguments);
    }

    // This is done to register the method called with moment()
    // without creating circular dependencies.
    function setHookCallback(callback) {
        hookCallback = callback;
    }

    function isArray(input) {
        return (
            input instanceof Array ||
            Object.prototype.toString.call(input) === '[object Array]'
        );
    }

    function isObject(input) {
        // IE8 will treat undefined and null as object if it wasn't for
        // input != null
        return (
            input != null &&
            Object.prototype.toString.call(input) === '[object Object]'
        );
    }

    function hasOwnProp(a, b) {
        return Object.prototype.hasOwnProperty.call(a, b);
    }

    function isObjectEmpty(obj) {
        if (Object.getOwnPropertyNames) {
            return Object.getOwnPropertyNames(obj).length === 0;
        } else {
            var k;
            for (k in obj) {
                if (hasOwnProp(obj, k)) {
                    return false;
                }
            }
            return true;
        }
    }

    function isUndefined(input) {
        return input === void 0;
    }

    function isNumber(input) {
        return (
            typeof input === 'number' ||
            Object.prototype.toString.call(input) === '[object Number]'
        );
    }

    function isDate(input) {
        return (
            input instanceof Date ||
            Object.prototype.toString.call(input) === '[object Date]'
        );
    }

    function map(arr, fn) {
        var res = [],
            i;
        for (i = 0; i < arr.length; ++i) {
            res.push(fn(arr[i], i));
        }
        return res;
    }

    function extend(a, b) {
        for (var i in b) {
            if (hasOwnProp(b, i)) {
                a[i] = b[i];
            }
        }

        if (hasOwnProp(b, 'toString')) {
            a.toString = b.toString;
        }

        if (hasOwnProp(b, 'valueOf')) {
            a.valueOf = b.valueOf;
        }

        return a;
    }

    function createUTC(input, format, locale, strict) {
        return createLocalOrUTC(input, format, locale, strict, true).utc();
    }

    function defaultParsingFlags() {
        // We need to deep clone this object.
        return {
            empty: false,
            unusedTokens: [],
            unusedInput: [],
            overflow: -2,
            charsLeftOver: 0,
            nullInput: false,
            invalidEra: null,
            invalidMonth: null,
            invalidFormat: false,
            userInvalidated: false,
            iso: false,
            parsedDateParts: [],
            era: null,
            meridiem: null,
            rfc2822: false,
            weekdayMismatch: false,
        };
    }

    function getParsingFlags(m) {
        if (m._pf == null) {
            m._pf = defaultParsingFlags();
        }
        return m._pf;
    }

    var some;
    if (Array.prototype.some) {
        some = Array.prototype.some;
    } else {
        some = function (fun) {
            var t = Object(this),
                len = t.length >>> 0,
                i;

            for (i = 0; i < len; i++) {
                if (i in t && fun.call(this, t[i], i, t)) {
                    return true;
                }
            }

            return false;
        };
    }

    function isValid(m) {
        if (m._isValid == null) {
            var flags = getParsingFlags(m),
                parsedParts = some.call(flags.parsedDateParts, function (i) {
                    return i != null;
                }),
                isNowValid =
                    !isNaN(m._d.getTime()) &&
                    flags.overflow < 0 &&
                    !flags.empty &&
                    !flags.invalidEra &&
                    !flags.invalidMonth &&
                    !flags.invalidWeekday &&
                    !flags.weekdayMismatch &&
                    !flags.nullInput &&
                    !flags.invalidFormat &&
                    !flags.userInvalidated &&
                    (!flags.meridiem || (flags.meridiem && parsedParts));

            if (m._strict) {
                isNowValid =
                    isNowValid &&
                    flags.charsLeftOver === 0 &&
                    flags.unusedTokens.length === 0 &&
                    flags.bigHour === undefined;
            }

            if (Object.isFrozen == null || !Object.isFrozen(m)) {
                m._isValid = isNowValid;
            } else {
                return isNowValid;
            }
        }
        return m._isValid;
    }

    function createInvalid(flags) {
        var m = createUTC(NaN);
        if (flags != null) {
            extend(getParsingFlags(m), flags);
        } else {
            getParsingFlags(m).userInvalidated = true;
        }

        return m;
    }

    // Plugins that add properties should also add the key here (null value),
    // so we can properly clone ourselves.
    var momentProperties = (hooks.momentProperties = []),
        updateInProgress = false;

    function copyConfig(to, from) {
        var i, prop, val;

        if (!isUndefined(from._isAMomentObject)) {
            to._isAMomentObject = from._isAMomentObject;
        }
        if (!isUndefined(from._i)) {
            to._i = from._i;
        }
        if (!isUndefined(from._f)) {
            to._f = from._f;
        }
        if (!isUndefined(from._l)) {
            to._l = from._l;
        }
        if (!isUndefined(from._strict)) {
            to._strict = from._strict;
        }
        if (!isUndefined(from._tzm)) {
            to._tzm = from._tzm;
        }
        if (!isUndefined(from._isUTC)) {
            to._isUTC = from._isUTC;
        }
        if (!isUndefined(from._offset)) {
            to._offset = from._offset;
        }
        if (!isUndefined(from._pf)) {
            to._pf = getParsingFlags(from);
        }
        if (!isUndefined(from._locale)) {
            to._locale = from._locale;
        }

        if (momentProperties.length > 0) {
            for (i = 0; i < momentProperties.length; i++) {
                prop = momentProperties[i];
                val = from[prop];
                if (!isUndefined(val)) {
                    to[prop] = val;
                }
            }
        }

        return to;
    }

    // Moment prototype object
    function Moment(config) {
        copyConfig(this, config);
        this._d = new Date(config._d != null ? config._d.getTime() : NaN);
        if (!this.isValid()) {
            this._d = new Date(NaN);
        }
        // Prevent infinite loop in case updateOffset creates new moment
        // objects.
        if (updateInProgress === false) {
            updateInProgress = true;
            hooks.updateOffset(this);
            updateInProgress = false;
        }
    }

    function isMoment(obj) {
        return (
            obj instanceof Moment || (obj != null && obj._isAMomentObject != null)
        );
    }

    function warn(msg) {
        if (
            hooks.suppressDeprecationWarnings === false &&
            typeof console !== 'undefined' &&
            console.warn
        ) {
            console.warn('Deprecation warning: ' + msg);
        }
    }

    function deprecate(msg, fn) {
        var firstTime = true;

        return extend(function () {
            if (hooks.deprecationHandler != null) {
                hooks.deprecationHandler(null, msg);
            }
            if (firstTime) {
                var args = [],
                    arg,
                    i,
                    key;
                for (i = 0; i < arguments.length; i++) {
                    arg = '';
                    if (typeof arguments[i] === 'object') {
                        arg += '\n[' + i + '] ';
                        for (key in arguments[0]) {
                            if (hasOwnProp(arguments[0], key)) {
                                arg += key + ': ' + arguments[0][key] + ', ';
                            }
                        }
                        arg = arg.slice(0, -2); // Remove trailing comma and space
                    } else {
                        arg = arguments[i];
                    }
                    args.push(arg);
                }
                warn(
                    msg +
                        '\nArguments: ' +
                        Array.prototype.slice.call(args).join('') +
                        '\n' +
                        new Error().stack
                );
                firstTime = false;
            }
            return fn.apply(this, arguments);
        }, fn);
    }

    var deprecations = {};

    function deprecateSimple(name, msg) {
        if (hooks.deprecationHandler != null) {
            hooks.deprecationHandler(name, msg);
        }
        if (!deprecations[name]) {
            warn(msg);
            deprecations[name] = true;
        }
    }

    hooks.suppressDeprecationWarnings = false;
    hooks.deprecationHandler = null;

    function isFunction(input) {
        return (
            (typeof Function !== 'undefined' && input instanceof Function) ||
            Object.prototype.toString.call(input) === '[object Function]'
        );
    }

    function set(config) {
        var prop, i;
        for (i in config) {
            if (hasOwnProp(config, i)) {
                prop = config[i];
                if (isFunction(prop)) {
                    this[i] = prop;
                } else {
                    this['_' + i] = prop;
                }
            }
        }
        this._config = config;
        // Lenient ordinal parsing accepts just a number in addition to
        // number + (possibly) stuff coming from _dayOfMonthOrdinalParse.
        // TODO: Remove "ordinalParse" fallback in next major release.
        this._dayOfMonthOrdinalParseLenient = new RegExp(
            (this._dayOfMonthOrdinalParse.source || this._ordinalParse.source) +
                '|' +
                /\d{1,2}/.source
        );
    }

    function mergeConfigs(parentConfig, childConfig) {
        var res = extend({}, parentConfig),
            prop;
        for (prop in childConfig) {
            if (hasOwnProp(childConfig, prop)) {
                if (isObject(parentConfig[prop]) && isObject(childConfig[prop])) {
                    res[prop] = {};
                    extend(res[prop], parentConfig[prop]);
                    extend(res[prop], childConfig[prop]);
                } else if (childConfig[prop] != null) {
                    res[prop] = childConfig[prop];
                } else {
                    delete res[prop];
                }
            }
        }
        for (prop in parentConfig) {
            if (
                hasOwnProp(parentConfig, prop) &&
                !hasOwnProp(childConfig, prop) &&
                isObject(parentConfig[prop])
            ) {
                // make sure changes to properties don't modify parent config
                res[prop] = extend({}, res[prop]);
            }
        }
        return res;
    }

    function Locale(config) {
        if (config != null) {
            this.set(config);
        }
    }

    var keys;

    if (Object.keys) {
        keys = Object.keys;
    } else {
        keys = function (obj) {
            var i,
                res = [];
            for (i in obj) {
                if (hasOwnProp(obj, i)) {
                    res.push(i);
                }
            }
            return res;
        };
    }

    var defaultCalendar = {
        sameDay: '[Today at] LT',
        nextDay: '[Tomorrow at] LT',
        nextWeek: 'dddd [at] LT',
        lastDay: '[Yesterday at] LT',
        lastWeek: '[Last] dddd [at] LT',
        sameElse: 'L',
    };

    function calendar(key, mom, now) {
        var output = this._calendar[key] || this._calendar['sameElse'];
        return isFunction(output) ? output.call(mom, now) : output;
    }

    function zeroFill(number, targetLength, forceSign) {
        var absNumber = '' + Math.abs(number),
            zerosToFill = targetLength - absNumber.length,
            sign = number >= 0;
        return (
            (sign ? (forceSign ? '+' : '') : '-') +
            Math.pow(10, Math.max(0, zerosToFill)).toString().substr(1) +
            absNumber
        );
    }

    var formattingTokens = /(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,
        localFormattingTokens = /(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,
        formatFunctions = {},
        formatTokenFunctions = {};

    // token:    'M'
    // padded:   ['MM', 2]
    // ordinal:  'Mo'
    // callback: function () { this.month() + 1 }
    function addFormatToken(token, padded, ordinal, callback) {
        var func = callback;
        if (typeof callback === 'string') {
            func = function () {
                return this[callback]();
            };
        }
        if (token) {
            formatTokenFunctions[token] = func;
        }
        if (padded) {
            formatTokenFunctions[padded[0]] = function () {
                return zeroFill(func.apply(this, arguments), padded[1], padded[2]);
            };
        }
        if (ordinal) {
            formatTokenFunctions[ordinal] = function () {
                return this.localeData().ordinal(
                    func.apply(this, arguments),
                    token
                );
            };
        }
    }

    function removeFormattingTokens(input) {
        if (input.match(/\[[\s\S]/)) {
            return input.replace(/^\[|\]$/g, '');
        }
        return input.replace(/\\/g, '');
    }

    function makeFormatFunction(format) {
        var array = format.match(formattingTokens),
            i,
            length;

        for (i = 0, length = array.length; i < length; i++) {
            if (formatTokenFunctions[array[i]]) {
                array[i] = formatTokenFunctions[array[i]];
            } else {
                array[i] = removeFormattingTokens(array[i]);
            }
        }

        return function (mom) {
            var output = '',
                i;
            for (i = 0; i < length; i++) {
                output += isFunction(array[i])
                    ? array[i].call(mom, format)
                    : array[i];
            }
            return output;
        };
    }

    // format date using native date object
    function formatMoment(m, format) {
        if (!m.isValid()) {
            return m.localeData().invalidDate();
        }

        format = expandFormat(format, m.localeData());
        formatFunctions[format] =
            formatFunctions[format] || makeFormatFunction(format);

        return formatFunctions[format](m);
    }

    function expandFormat(format, locale) {
        var i = 5;

        function replaceLongDateFormatTokens(input) {
            return locale.longDateFormat(input) || input;
        }

        localFormattingTokens.lastIndex = 0;
        while (i >= 0 && localFormattingTokens.test(format)) {
            format = format.replace(
                localFormattingTokens,
                replaceLongDateFormatTokens
            );
            localFormattingTokens.lastIndex = 0;
            i -= 1;
        }

        return format;
    }

    var defaultLongDateFormat = {
        LTS: 'h:mm:ss A',
        LT: 'h:mm A',
        L: 'MM/DD/YYYY',
        LL: 'MMMM D, YYYY',
        LLL: 'MMMM D, YYYY h:mm A',
        LLLL: 'dddd, MMMM D, YYYY h:mm A',
    };

    function longDateFormat(key) {
        var format = this._longDateFormat[key],
            formatUpper = this._longDateFormat[key.toUpperCase()];

        if (format || !formatUpper) {
            return format;
        }

        this._longDateFormat[key] = formatUpper
            .match(formattingTokens)
            .map(function (tok) {
                if (
                    tok === 'MMMM' ||
                    tok === 'MM' ||
                    tok === 'DD' ||
                    tok === 'dddd'
                ) {
                    return tok.slice(1);
                }
                return tok;
            })
            .join('');

        return this._longDateFormat[key];
    }

    var defaultInvalidDate = 'Invalid date';

    function invalidDate() {
        return this._invalidDate;
    }

    var defaultOrdinal = '%d',
        defaultDayOfMonthOrdinalParse = /\d{1,2}/;

    function ordinal(number) {
        return this._ordinal.replace('%d', number);
    }

    var defaultRelativeTime = {
        future: 'in %s',
        past: '%s ago',
        s: 'a few seconds',
        ss: '%d seconds',
        m: 'a minute',
        mm: '%d minutes',
        h: 'an hour',
        hh: '%d hours',
        d: 'a day',
        dd: '%d days',
        w: 'a week',
        ww: '%d weeks',
        M: 'a month',
        MM: '%d months',
        y: 'a year',
        yy: '%d years',
    };

    function relativeTime(number, withoutSuffix, string, isFuture) {
        var output = this._relativeTime[string];
        return isFunction(output)
            ? output(number, withoutSuffix, string, isFuture)
            : output.replace(/%d/i, number);
    }

    function pastFuture(diff, output) {
        var format = this._relativeTime[diff > 0 ? 'future' : 'past'];
        return isFunction(format) ? format(output) : format.replace(/%s/i, output);
    }

    var aliases = {};

    function addUnitAlias(unit, shorthand) {
        var lowerCase = unit.toLowerCase();
        aliases[lowerCase] = aliases[lowerCase + 's'] = aliases[shorthand] = unit;
    }

    function normalizeUnits(units) {
        return typeof units === 'string'
            ? aliases[units] || aliases[units.toLowerCase()]
            : undefined;
    }

    function normalizeObjectUnits(inputObject) {
        var normalizedInput = {},
            normalizedProp,
            prop;

        for (prop in inputObject) {
            if (hasOwnProp(inputObject, prop)) {
                normalizedProp = normalizeUnits(prop);
                if (normalizedProp) {
                    normalizedInput[normalizedProp] = inputObject[prop];
                }
            }
        }

        return normalizedInput;
    }

    var priorities = {};

    function addUnitPriority(unit, priority) {
        priorities[unit] = priority;
    }

    function getPrioritizedUnits(unitsObj) {
        var units = [],
            u;
        for (u in unitsObj) {
            if (hasOwnProp(unitsObj, u)) {
                units.push({ unit: u, priority: priorities[u] });
            }
        }
        units.sort(function (a, b) {
            return a.priority - b.priority;
        });
        return units;
    }

    function isLeapYear(year) {
        return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;
    }

    function absFloor(number) {
        if (number < 0) {
            // -0 -> 0
            return Math.ceil(number) || 0;
        } else {
            return Math.floor(number);
        }
    }

    function toInt(argumentForCoercion) {
        var coercedNumber = +argumentForCoercion,
            value = 0;

        if (coercedNumber !== 0 && isFinite(coercedNumber)) {
            value = absFloor(coercedNumber);
        }

        return value;
    }

    function makeGetSet(unit, keepTime) {
        return function (value) {
            if (value != null) {
                set$1(this, unit, value);
                hooks.updateOffset(this, keepTime);
                return this;
            } else {
                return get(this, unit);
            }
        };
    }

    function get(mom, unit) {
        return mom.isValid()
            ? mom._d['get' + (mom._isUTC ? 'UTC' : '') + unit]()
            : NaN;
    }

    function set$1(mom, unit, value) {
        if (mom.isValid() && !isNaN(value)) {
            if (
                unit === 'FullYear' &&
                isLeapYear(mom.year()) &&
                mom.month() === 1 &&
                mom.date() === 29
            ) {
                value = toInt(value);
                mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](
                    value,
                    mom.month(),
                    daysInMonth(value, mom.month())
                );
            } else {
                mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](value);
            }
        }
    }

    // MOMENTS

    function stringGet(units) {
        units = normalizeUnits(units);
        if (isFunction(this[units])) {
            return this[units]();
        }
        return this;
    }

    function stringSet(units, value) {
        if (typeof units === 'object') {
            units = normalizeObjectUnits(units);
            var prioritized = getPrioritizedUnits(units),
                i;
            for (i = 0; i < prioritized.length; i++) {
                this[prioritized[i].unit](units[prioritized[i].unit]);
            }
        } else {
            units = normalizeUnits(units);
            if (isFunction(this[units])) {
                return this[units](value);
            }
        }
        return this;
    }

    var match1 = /\d/, //       0 - 9
        match2 = /\d\d/, //      00 - 99
        match3 = /\d{3}/, //     000 - 999
        match4 = /\d{4}/, //    0000 - 9999
        match6 = /[+-]?\d{6}/, // -999999 - 999999
        match1to2 = /\d\d?/, //       0 - 99
        match3to4 = /\d\d\d\d?/, //     999 - 9999
        match5to6 = /\d\d\d\d\d\d?/, //   99999 - 999999
        match1to3 = /\d{1,3}/, //       0 - 999
        match1to4 = /\d{1,4}/, //       0 - 9999
        match1to6 = /[+-]?\d{1,6}/, // -999999 - 999999
        matchUnsigned = /\d+/, //       0 - inf
        matchSigned = /[+-]?\d+/, //    -inf - inf
        matchOffset = /Z|[+-]\d\d:?\d\d/gi, // +00:00 -00:00 +0000 -0000 or Z
        matchShortOffset = /Z|[+-]\d\d(?::?\d\d)?/gi, // +00 -00 +00:00 -00:00 +0000 -0000 or Z
        matchTimestamp = /[+-]?\d+(\.\d{1,3})?/, // 123456789 123456789.123
        // any word (or two) characters or numbers including two/three word month in arabic.
        // includes scottish gaelic two word and hyphenated months
        matchWord = /[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i,
        regexes;

    regexes = {};

    function addRegexToken(token, regex, strictRegex) {
        regexes[token] = isFunction(regex)
            ? regex
            : function (isStrict, localeData) {
                  return isStrict && strictRegex ? strictRegex : regex;
              };
    }

    function getParseRegexForToken(token, config) {
        if (!hasOwnProp(regexes, token)) {
            return new RegExp(unescapeFormat(token));
        }

        return regexes[token](config._strict, config._locale);
    }

    // Code from http://stackoverflow.com/questions/3561493/is-there-a-regexp-escape-function-in-javascript
    function unescapeFormat(s) {
        return regexEscape(
            s
                .replace('\\', '')
                .replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g, function (
                    matched,
                    p1,
                    p2,
                    p3,
                    p4
                ) {
                    return p1 || p2 || p3 || p4;
                })
        );
    }

    function regexEscape(s) {
        return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
    }

    var tokens = {};

    function addParseToken(token, callback) {
        var i,
            func = callback;
        if (typeof token === 'string') {
            token = [token];
        }
        if (isNumber(callback)) {
            func = function (input, array) {
                array[callback] = toInt(input);
            };
        }
        for (i = 0; i < token.length; i++) {
            tokens[token[i]] = func;
        }
    }

    function addWeekParseToken(token, callback) {
        addParseToken(token, function (input, array, config, token) {
            config._w = config._w || {};
            callback(input, config._w, config, token);
        });
    }

    function addTimeToArrayFromToken(token, input, config) {
        if (input != null && hasOwnProp(tokens, token)) {
            tokens[token](input, config._a, config, token);
        }
    }

    var YEAR = 0,
        MONTH = 1,
        DATE = 2,
        HOUR = 3,
        MINUTE = 4,
        SECOND = 5,
        MILLISECOND = 6,
        WEEK = 7,
        WEEKDAY = 8;

    function mod(n, x) {
        return ((n % x) + x) % x;
    }

    var indexOf;

    if (Array.prototype.indexOf) {
        indexOf = Array.prototype.indexOf;
    } else {
        indexOf = function (o) {
            // I know
            var i;
            for (i = 0; i < this.length; ++i) {
                if (this[i] === o) {
                    return i;
                }
            }
            return -1;
        };
    }

    function daysInMonth(year, month) {
        if (isNaN(year) || isNaN(month)) {
            return NaN;
        }
        var modMonth = mod(month, 12);
        year += (month - modMonth) / 12;
        return modMonth === 1
            ? isLeapYear(year)
                ? 29
                : 28
            : 31 - ((modMonth % 7) % 2);
    }

    // FORMATTING

    addFormatToken('M', ['MM', 2], 'Mo', function () {
        return this.month() + 1;
    });

    addFormatToken('MMM', 0, 0, function (format) {
        return this.localeData().monthsShort(this, format);
    });

    addFormatToken('MMMM', 0, 0, function (format) {
        return this.localeData().months(this, format);
    });

    // ALIASES

    addUnitAlias('month', 'M');

    // PRIORITY

    addUnitPriority('month', 8);

    // PARSING

    addRegexToken('M', match1to2);
    addRegexToken('MM', match1to2, match2);
    addRegexToken('MMM', function (isStrict, locale) {
        return locale.monthsShortRegex(isStrict);
    });
    addRegexToken('MMMM', function (isStrict, locale) {
        return locale.monthsRegex(isStrict);
    });

    addParseToken(['M', 'MM'], function (input, array) {
        array[MONTH] = toInt(input) - 1;
    });

    addParseToken(['MMM', 'MMMM'], function (input, array, config, token) {
        var month = config._locale.monthsParse(input, token, config._strict);
        // if we didn't find a month name, mark the date as invalid.
        if (month != null) {
            array[MONTH] = month;
        } else {
            getParsingFlags(config).invalidMonth = input;
        }
    });

    // LOCALES

    var defaultLocaleMonths = 'January_February_March_April_May_June_July_August_September_October_November_December'.split(
            '_'
        ),
        defaultLocaleMonthsShort = 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split(
            '_'
        ),
        MONTHS_IN_FORMAT = /D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/,
        defaultMonthsShortRegex = matchWord,
        defaultMonthsRegex = matchWord;

    function localeMonths(m, format) {
        if (!m) {
            return isArray(this._months)
                ? this._months
                : this._months['standalone'];
        }
        return isArray(this._months)
            ? this._months[m.month()]
            : this._months[
                  (this._months.isFormat || MONTHS_IN_FORMAT).test(format)
                      ? 'format'
                      : 'standalone'
              ][m.month()];
    }

    function localeMonthsShort(m, format) {
        if (!m) {
            return isArray(this._monthsShort)
                ? this._monthsShort
                : this._monthsShort['standalone'];
        }
        return isArray(this._monthsShort)
            ? this._monthsShort[m.month()]
            : this._monthsShort[
                  MONTHS_IN_FORMAT.test(format) ? 'format' : 'standalone'
              ][m.month()];
    }

    function handleStrictParse(monthName, format, strict) {
        var i,
            ii,
            mom,
            llc = monthName.toLocaleLowerCase();
        if (!this._monthsParse) {
            // this is not used
            this._monthsParse = [];
            this._longMonthsParse = [];
            this._shortMonthsParse = [];
            for (i = 0; i < 12; ++i) {
                mom = createUTC([2000, i]);
                this._shortMonthsParse[i] = this.monthsShort(
                    mom,
                    ''
                ).toLocaleLowerCase();
                this._longMonthsParse[i] = this.months(mom, '').toLocaleLowerCase();
            }
        }

        if (strict) {
            if (format === 'MMM') {
                ii = indexOf.call(this._shortMonthsParse, llc);
                return ii !== -1 ? ii : null;
            } else {
                ii = indexOf.call(this._longMonthsParse, llc);
                return ii !== -1 ? ii : null;
            }
        } else {
            if (format === 'MMM') {
                ii = indexOf.call(this._shortMonthsParse, llc);
                if (ii !== -1) {
                    return ii;
                }
                ii = indexOf.call(this._longMonthsParse, llc);
                return ii !== -1 ? ii : null;
            } else {
                ii = indexOf.call(this._longMonthsParse, llc);
                if (ii !== -1) {
                    return ii;
                }
                ii = indexOf.call(this._shortMonthsParse, llc);
                return ii !== -1 ? ii : null;
            }
        }
    }

    function localeMonthsParse(monthName, format, strict) {
        var i, mom, regex;

        if (this._monthsParseExact) {
            return handleStrictParse.call(this, monthName, format, strict);
        }

        if (!this._monthsParse) {
            this._monthsParse = [];
            this._longMonthsParse = [];
            this._shortMonthsParse = [];
        }

        // TODO: add sorting
        // Sorting makes sure if one month (or abbr) is a prefix of another
        // see sorting in computeMonthsParse
        for (i = 0; i < 12; i++) {
            // make the regex if we don't have it already
            mom = createUTC([2000, i]);
            if (strict && !this._longMonthsParse[i]) {
                this._longMonthsParse[i] = new RegExp(
                    '^' + this.months(mom, '').replace('.', '') + '$',
                    'i'
                );
                this._shortMonthsParse[i] = new RegExp(
                    '^' + this.monthsShort(mom, '').replace('.', '') + '$',
                    'i'
                );
            }
            if (!strict && !this._monthsParse[i]) {
                regex =
                    '^' + this.months(mom, '') + '|^' + this.monthsShort(mom, '');
                this._monthsParse[i] = new RegExp(regex.replace('.', ''), 'i');
            }
            // test the regex
            if (
                strict &&
                format === 'MMMM' &&
                this._longMonthsParse[i].test(monthName)
            ) {
                return i;
            } else if (
                strict &&
                format === 'MMM' &&
                this._shortMonthsParse[i].test(monthName)
            ) {
                return i;
            } else if (!strict && this._monthsParse[i].test(monthName)) {
                return i;
            }
        }
    }

    // MOMENTS

    function setMonth(mom, value) {
        var dayOfMonth;

        if (!mom.isValid()) {
            // No op
            return mom;
        }

        if (typeof value === 'string') {
            if (/^\d+$/.test(value)) {
                value = toInt(value);
            } else {
                value = mom.localeData().monthsParse(value);
                // TODO: Another silent failure?
                if (!isNumber(value)) {
                    return mom;
                }
            }
        }

        dayOfMonth = Math.min(mom.date(), daysInMonth(mom.year(), value));
        mom._d['set' + (mom._isUTC ? 'UTC' : '') + 'Month'](value, dayOfMonth);
        return mom;
    }

    function getSetMonth(value) {
        if (value != null) {
            setMonth(this, value);
            hooks.updateOffset(this, true);
            return this;
        } else {
            return get(this, 'Month');
        }
    }

    function getDaysInMonth() {
        return daysInMonth(this.year(), this.month());
    }

    function monthsShortRegex(isStrict) {
        if (this._monthsParseExact) {
            if (!hasOwnProp(this, '_monthsRegex')) {
                computeMonthsParse.call(this);
            }
            if (isStrict) {
                return this._monthsShortStrictRegex;
            } else {
                return this._monthsShortRegex;
            }
        } else {
            if (!hasOwnProp(this, '_monthsShortRegex')) {
                this._monthsShortRegex = defaultMonthsShortRegex;
            }
            return this._monthsShortStrictRegex && isStrict
                ? this._monthsShortStrictRegex
                : this._monthsShortRegex;
        }
    }

    function monthsRegex(isStrict) {
        if (this._monthsParseExact) {
            if (!hasOwnProp(this, '_monthsRegex')) {
                computeMonthsParse.call(this);
            }
            if (isStrict) {
                return this._monthsStrictRegex;
            } else {
                return this._monthsRegex;
            }
        } else {
            if (!hasOwnProp(this, '_monthsRegex')) {
                this._monthsRegex = defaultMonthsRegex;
            }
            return this._monthsStrictRegex && isStrict
                ? this._monthsStrictRegex
                : this._monthsRegex;
        }
    }

    function computeMonthsParse() {
        function cmpLenRev(a, b) {
            return b.length - a.length;
        }

        var shortPieces = [],
            longPieces = [],
            mixedPieces = [],
            i,
            mom;
        for (i = 0; i < 12; i++) {
            // make the regex if we don't have it already
            mom = createUTC([2000, i]);
            shortPieces.push(this.monthsShort(mom, ''));
            longPieces.push(this.months(mom, ''));
            mixedPieces.push(this.months(mom, ''));
            mixedPieces.push(this.monthsShort(mom, ''));
        }
        // Sorting makes sure if one month (or abbr) is a prefix of another it
        // will match the longer piece.
        shortPieces.sort(cmpLenRev);
        longPieces.sort(cmpLenRev);
        mixedPieces.sort(cmpLenRev);
        for (i = 0; i < 12; i++) {
            shortPieces[i] = regexEscape(shortPieces[i]);
            longPieces[i] = regexEscape(longPieces[i]);
        }
        for (i = 0; i < 24; i++) {
            mixedPieces[i] = regexEscape(mixedPieces[i]);
        }

        this._monthsRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i');
        this._monthsShortRegex = this._monthsRegex;
        this._monthsStrictRegex = new RegExp(
            '^(' + longPieces.join('|') + ')',
            'i'
        );
        this._monthsShortStrictRegex = new RegExp(
            '^(' + shortPieces.join('|') + ')',
            'i'
        );
    }

    // FORMATTING

    addFormatToken('Y', 0, 0, function () {
        var y = this.year();
        return y <= 9999 ? zeroFill(y, 4) : '+' + y;
    });

    addFormatToken(0, ['YY', 2], 0, function () {
        return this.year() % 100;
    });

    addFormatToken(0, ['YYYY', 4], 0, 'year');
    addFormatToken(0, ['YYYYY', 5], 0, 'year');
    addFormatToken(0, ['YYYYYY', 6, true], 0, 'year');

    // ALIASES

    addUnitAlias('year', 'y');

    // PRIORITIES

    addUnitPriority('year', 1);

    // PARSING

    addRegexToken('Y', matchSigned);
    addRegexToken('YY', match1to2, match2);
    addRegexToken('YYYY', match1to4, match4);
    addRegexToken('YYYYY', match1to6, match6);
    addRegexToken('YYYYYY', match1to6, match6);

    addParseToken(['YYYYY', 'YYYYYY'], YEAR);
    addParseToken('YYYY', function (input, array) {
        array[YEAR] =
            input.length === 2 ? hooks.parseTwoDigitYear(input) : toInt(input);
    });
    addParseToken('YY', function (input, array) {
        array[YEAR] = hooks.parseTwoDigitYear(input);
    });
    addParseToken('Y', function (input, array) {
        array[YEAR] = parseInt(input, 10);
    });

    // HELPERS

    function daysInYear(year) {
        return isLeapYear(year) ? 366 : 365;
    }

    // HOOKS

    hooks.parseTwoDigitYear = function (input) {
        return toInt(input) + (toInt(input) > 68 ? 1900 : 2000);
    };

    // MOMENTS

    var getSetYear = makeGetSet('FullYear', true);

    function getIsLeapYear() {
        return isLeapYear(this.year());
    }

    function createDate(y, m, d, h, M, s, ms) {
        // can't just apply() to create a date:
        // https://stackoverflow.com/q/181348
        var date;
        // the date constructor remaps years 0-99 to 1900-1999
        if (y < 100 && y >= 0) {
            // preserve leap years using a full 400 year cycle, then reset
            date = new Date(y + 400, m, d, h, M, s, ms);
            if (isFinite(date.getFullYear())) {
                date.setFullYear(y);
            }
        } else {
            date = new Date(y, m, d, h, M, s, ms);
        }

        return date;
    }

    function createUTCDate(y) {
        var date, args;
        // the Date.UTC function remaps years 0-99 to 1900-1999
        if (y < 100 && y >= 0) {
            args = Array.prototype.slice.call(arguments);
            // preserve leap years using a full 400 year cycle, then reset
            args[0] = y + 400;
            date = new Date(Date.UTC.apply(null, args));
            if (isFinite(date.getUTCFullYear())) {
                date.setUTCFullYear(y);
            }
        } else {
            date = new Date(Date.UTC.apply(null, arguments));
        }

        return date;
    }

    // start-of-first-week - start-of-year
    function firstWeekOffset(year, dow, doy) {
        var // first-week day -- which january is always in the first week (4 for iso, 1 for other)
            fwd = 7 + dow - doy,
            // first-week day local weekday -- which local weekday is fwd
            fwdlw = (7 + createUTCDate(year, 0, fwd).getUTCDay() - dow) % 7;

        return -fwdlw + fwd - 1;
    }

    // https://en.wikipedia.org/wiki/ISO_week_date#Calculating_a_date_given_the_year.2C_week_number_and_weekday
    function dayOfYearFromWeeks(year, week, weekday, dow, doy) {
        var localWeekday = (7 + weekday - dow) % 7,
            weekOffset = firstWeekOffset(year, dow, doy),
            dayOfYear = 1 + 7 * (week - 1) + localWeekday + weekOffset,
            resYear,
            resDayOfYear;

        if (dayOfYear <= 0) {
            resYear = year - 1;
            resDayOfYear = daysInYear(resYear) + dayOfYear;
        } else if (dayOfYear > daysInYear(year)) {
            resYear = year + 1;
            resDayOfYear = dayOfYear - daysInYear(year);
        } else {
            resYear = year;
            resDayOfYear = dayOfYear;
        }

        return {
            year: resYear,
            dayOfYear: resDayOfYear,
        };
    }

    function weekOfYear(mom, dow, doy) {
        var weekOffset = firstWeekOffset(mom.year(), dow, doy),
            week = Math.floor((mom.dayOfYear() - weekOffset - 1) / 7) + 1,
            resWeek,
            resYear;

        if (week < 1) {
            resYear = mom.year() - 1;
            resWeek = week + weeksInYear(resYear, dow, doy);
        } else if (week > weeksInYear(mom.year(), dow, doy)) {
            resWeek = week - weeksInYear(mom.year(), dow, doy);
            resYear = mom.year() + 1;
        } else {
            resYear = mom.year();
            resWeek = week;
        }

        return {
            week: resWeek,
            year: resYear,
        };
    }

    function weeksInYear(year, dow, doy) {
        var weekOffset = firstWeekOffset(year, dow, doy),
            weekOffsetNext = firstWeekOffset(year + 1, dow, doy);
        return (daysInYear(year) - weekOffset + weekOffsetNext) / 7;
    }

    // FORMATTING

    addFormatToken('w', ['ww', 2], 'wo', 'week');
    addFormatToken('W', ['WW', 2], 'Wo', 'isoWeek');

    // ALIASES

    addUnitAlias('week', 'w');
    addUnitAlias('isoWeek', 'W');

    // PRIORITIES

    addUnitPriority('week', 5);
    addUnitPriority('isoWeek', 5);

    // PARSING

    addRegexToken('w', match1to2);
    addRegexToken('ww', match1to2, match2);
    addRegexToken('W', match1to2);
    addRegexToken('WW', match1to2, match2);

    addWeekParseToken(['w', 'ww', 'W', 'WW'], function (
        input,
        week,
        config,
        token
    ) {
        week[token.substr(0, 1)] = toInt(input);
    });

    // HELPERS

    // LOCALES

    function localeWeek(mom) {
        return weekOfYear(mom, this._week.dow, this._week.doy).week;
    }

    var defaultLocaleWeek = {
        dow: 0, // Sunday is the first day of the week.
        doy: 6, // The week that contains Jan 6th is the first week of the year.
    };

    function localeFirstDayOfWeek() {
        return this._week.dow;
    }

    function localeFirstDayOfYear() {
        return this._week.doy;
    }

    // MOMENTS

    function getSetWeek(input) {
        var week = this.localeData().week(this);
        return input == null ? week : this.add((input - week) * 7, 'd');
    }

    function getSetISOWeek(input) {
        var week = weekOfYear(this, 1, 4).week;
        return input == null ? week : this.add((input - week) * 7, 'd');
    }

    // FORMATTING

    addFormatToken('d', 0, 'do', 'day');

    addFormatToken('dd', 0, 0, function (format) {
        return this.localeData().weekdaysMin(this, format);
    });

    addFormatToken('ddd', 0, 0, function (format) {
        return this.localeData().weekdaysShort(this, format);
    });

    addFormatToken('dddd', 0, 0, function (format) {
        return this.localeData().weekdays(this, format);
    });

    addFormatToken('e', 0, 0, 'weekday');
    addFormatToken('E', 0, 0, 'isoWeekday');

    // ALIASES

    addUnitAlias('day', 'd');
    addUnitAlias('weekday', 'e');
    addUnitAlias('isoWeekday', 'E');

    // PRIORITY
    addUnitPriority('day', 11);
    addUnitPriority('weekday', 11);
    addUnitPriority('isoWeekday', 11);

    // PARSING

    addRegexToken('d', match1to2);
    addRegexToken('e', match1to2);
    addRegexToken('E', match1to2);
    addRegexToken('dd', function (isStrict, locale) {
        return locale.weekdaysMinRegex(isStrict);
    });
    addRegexToken('ddd', function (isStrict, locale) {
        return locale.weekdaysShortRegex(isStrict);
    });
    addRegexToken('dddd', function (isStrict, locale) {
        return locale.weekdaysRegex(isStrict);
    });

    addWeekParseToken(['dd', 'ddd', 'dddd'], function (input, week, config, token) {
        var weekday = config._locale.weekdaysParse(input, token, config._strict);
        // if we didn't get a weekday name, mark the date as invalid
        if (weekday != null) {
            week.d = weekday;
        } else {
            getParsingFlags(config).invalidWeekday = input;
        }
    });

    addWeekParseToken(['d', 'e', 'E'], function (input, week, config, token) {
        week[token] = toInt(input);
    });

    // HELPERS

    function parseWeekday(input, locale) {
        if (typeof input !== 'string') {
            return input;
        }

        if (!isNaN(input)) {
            return parseInt(input, 10);
        }

        input = locale.weekdaysParse(input);
        if (typeof input === 'number') {
            return input;
        }

        return null;
    }

    function parseIsoWeekday(input, locale) {
        if (typeof input === 'string') {
            return locale.weekdaysParse(input) % 7 || 7;
        }
        return isNaN(input) ? null : input;
    }

    // LOCALES
    function shiftWeekdays(ws, n) {
        return ws.slice(n, 7).concat(ws.slice(0, n));
    }

    var defaultLocaleWeekdays = 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split(
            '_'
        ),
        defaultLocaleWeekdaysShort = 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'),
        defaultLocaleWeekdaysMin = 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'),
        defaultWeekdaysRegex = matchWord,
        defaultWeekdaysShortRegex = matchWord,
        defaultWeekdaysMinRegex = matchWord;

    function localeWeekdays(m, format) {
        var weekdays = isArray(this._weekdays)
            ? this._weekdays
            : this._weekdays[
                  m && m !== true && this._weekdays.isFormat.test(format)
                      ? 'format'
                      : 'standalone'
              ];
        return m === true
            ? shiftWeekdays(weekdays, this._week.dow)
            : m
            ? weekdays[m.day()]
            : weekdays;
    }

    function localeWeekdaysShort(m) {
        return m === true
            ? shiftWeekdays(this._weekdaysShort, this._week.dow)
            : m
            ? this._weekdaysShort[m.day()]
            : this._weekdaysShort;
    }

    function localeWeekdaysMin(m) {
        return m === true
            ? shiftWeekdays(this._weekdaysMin, this._week.dow)
            : m
            ? this._weekdaysMin[m.day()]
            : this._weekdaysMin;
    }

    function handleStrictParse$1(weekdayName, format, strict) {
        var i,
            ii,
            mom,
            llc = weekdayName.toLocaleLowerCase();
        if (!this._weekdaysParse) {
            this._weekdaysParse = [];
            this._shortWeekdaysParse = [];
            this._minWeekdaysParse = [];

            for (i = 0; i < 7; ++i) {
                mom = createUTC([2000, 1]).day(i);
                this._minWeekdaysParse[i] = this.weekdaysMin(
                    mom,
                    ''
                ).toLocaleLowerCase();
                this._shortWeekdaysParse[i] = this.weekdaysShort(
                    mom,
                    ''
                ).toLocaleLowerCase();
                this._weekdaysParse[i] = this.weekdays(mom, '').toLocaleLowerCase();
            }
        }

        if (strict) {
            if (format === 'dddd') {
                ii = indexOf.call(this._weekdaysParse, llc);
                return ii !== -1 ? ii : null;
            } else if (format === 'ddd') {
                ii = indexOf.call(this._shortWeekdaysParse, llc);
                return ii !== -1 ? ii : null;
            } else {
                ii = indexOf.call(this._minWeekdaysParse, llc);
                return ii !== -1 ? ii : null;
            }
        } else {
            if (format === 'dddd') {
                ii = indexOf.call(this._weekdaysParse, llc);
                if (ii !== -1) {
                    return ii;
                }
                ii = indexOf.call(this._shortWeekdaysParse, llc);
                if (ii !== -1) {
                    return ii;
                }
                ii = indexOf.call(this._minWeekdaysParse, llc);
                return ii !== -1 ? ii : null;
            } else if (format === 'ddd') {
                ii = indexOf.call(this._shortWeekdaysParse, llc);
                if (ii !== -1) {
                    return ii;
                }
                ii = indexOf.call(this._weekdaysParse, llc);
                if (ii !== -1) {
                    return ii;
                }
                ii = indexOf.call(this._minWeekdaysParse, llc);
                return ii !== -1 ? ii : null;
            } else {
                ii = indexOf.call(this._minWeekdaysParse, llc);
                if (ii !== -1) {
                    return ii;
                }
                ii = indexOf.call(this._weekdaysParse, llc);
                if (ii !== -1) {
                    return ii;
                }
                ii = indexOf.call(this._shortWeekdaysParse, llc);
                return ii !== -1 ? ii : null;
            }
        }
    }

    function localeWeekdaysParse(weekdayName, format, strict) {
        var i, mom, regex;

        if (this._weekdaysParseExact) {
            return handleStrictParse$1.call(this, weekdayName, format, strict);
        }

        if (!this._weekdaysParse) {
            this._weekdaysParse = [];
            this._minWeekdaysParse = [];
            this._shortWeekdaysParse = [];
            this._fullWeekdaysParse = [];
        }

        for (i = 0; i < 7; i++) {
            // make the regex if we don't have it already

            mom = createUTC([2000, 1]).day(i);
            if (strict && !this._fullWeekdaysParse[i]) {
                this._fullWeekdaysParse[i] = new RegExp(
                    '^' + this.weekdays(mom, '').replace('.', '\\.?') + '$',
                    'i'
                );
                this._shortWeekdaysParse[i] = new RegExp(
                    '^' + this.weekdaysShort(mom, '').replace('.', '\\.?') + '$',
                    'i'
                );
                this._minWeekdaysParse[i] = new RegExp(
                    '^' + this.weekdaysMin(mom, '').replace('.', '\\.?') + '$',
                    'i'
                );
            }
            if (!this._weekdaysParse[i]) {
                regex =
                    '^' +
                    this.weekdays(mom, '') +
                    '|^' +
                    this.weekdaysShort(mom, '') +
                    '|^' +
                    this.weekdaysMin(mom, '');
                this._weekdaysParse[i] = new RegExp(regex.replace('.', ''), 'i');
            }
            // test the regex
            if (
                strict &&
                format === 'dddd' &&
                this._fullWeekdaysParse[i].test(weekdayName)
            ) {
                return i;
            } else if (
                strict &&
                format === 'ddd' &&
                this._shortWeekdaysParse[i].test(weekdayName)
            ) {
                return i;
            } else if (
                strict &&
                format === 'dd' &&
                this._minWeekdaysParse[i].test(weekdayName)
            ) {
                return i;
            } else if (!strict && this._weekdaysParse[i].test(weekdayName)) {
                return i;
            }
        }
    }

    // MOMENTS

    function getSetDayOfWeek(input) {
        if (!this.isValid()) {
            return input != null ? this : NaN;
        }
        var day = this._isUTC ? this._d.getUTCDay() : this._d.getDay();
        if (input != null) {
            input = parseWeekday(input, this.localeData());
            return this.add(input - day, 'd');
        } else {
            return day;
        }
    }

    function getSetLocaleDayOfWeek(input) {
        if (!this.isValid()) {
            return input != null ? this : NaN;
        }
        var weekday = (this.day() + 7 - this.localeData()._week.dow) % 7;
        return input == null ? weekday : this.add(input - weekday, 'd');
    }

    function getSetISODayOfWeek(input) {
        if (!this.isValid()) {
            return input != null ? this : NaN;
        }

        // behaves the same as moment#day except
        // as a getter, returns 7 instead of 0 (1-7 range instead of 0-6)
        // as a setter, sunday should belong to the previous week.

        if (input != null) {
            var weekday = parseIsoWeekday(input, this.localeData());
            return this.day(this.day() % 7 ? weekday : weekday - 7);
        } else {
            return this.day() || 7;
        }
    }

    function weekdaysRegex(isStrict) {
        if (this._weekdaysParseExact) {
            if (!hasOwnProp(this, '_weekdaysRegex')) {
                computeWeekdaysParse.call(this);
            }
            if (isStrict) {
                return this._weekdaysStrictRegex;
            } else {
                return this._weekdaysRegex;
            }
        } else {
            if (!hasOwnProp(this, '_weekdaysRegex')) {
                this._weekdaysRegex = defaultWeekdaysRegex;
            }
            return this._weekdaysStrictRegex && isStrict
                ? this._weekdaysStrictRegex
                : this._weekdaysRegex;
        }
    }

    function weekdaysShortRegex(isStrict) {
        if (this._weekdaysParseExact) {
            if (!hasOwnProp(this, '_weekdaysRegex')) {
                computeWeekdaysParse.call(this);
            }
            if (isStrict) {
                return this._weekdaysShortStrictRegex;
            } else {
                return this._weekdaysShortRegex;
            }
        } else {
            if (!hasOwnProp(this, '_weekdaysShortRegex')) {
                this._weekdaysShortRegex = defaultWeekdaysShortRegex;
            }
            return this._weekdaysShortStrictRegex && isStrict
                ? this._weekdaysShortStrictRegex
                : this._weekdaysShortRegex;
        }
    }

    function weekdaysMinRegex(isStrict) {
        if (this._weekdaysParseExact) {
            if (!hasOwnProp(this, '_weekdaysRegex')) {
                computeWeekdaysParse.call(this);
            }
            if (isStrict) {
                return this._weekdaysMinStrictRegex;
            } else {
                return this._weekdaysMinRegex;
            }
        } else {
            if (!hasOwnProp(this, '_weekdaysMinRegex')) {
                this._weekdaysMinRegex = defaultWeekdaysMinRegex;
            }
            return this._weekdaysMinStrictRegex && isStrict
                ? this._weekdaysMinStrictRegex
                : this._weekdaysMinRegex;
        }
    }

    function computeWeekdaysParse() {
        function cmpLenRev(a, b) {
            return b.length - a.length;
        }

        var minPieces = [],
            shortPieces = [],
            longPieces = [],
            mixedPieces = [],
            i,
            mom,
            minp,
            shortp,
            longp;
        for (i = 0; i < 7; i++) {
            // make the regex if we don't have it already
            mom = createUTC([2000, 1]).day(i);
            minp = regexEscape(this.weekdaysMin(mom, ''));
            shortp = regexEscape(this.weekdaysShort(mom, ''));
            longp = regexEscape(this.weekdays(mom, ''));
            minPieces.push(minp);
            shortPieces.push(shortp);
            longPieces.push(longp);
            mixedPieces.push(minp);
            mixedPieces.push(shortp);
            mixedPieces.push(longp);
        }
        // Sorting makes sure if one weekday (or abbr) is a prefix of another it
        // will match the longer piece.
        minPieces.sort(cmpLenRev);
        shortPieces.sort(cmpLenRev);
        longPieces.sort(cmpLenRev);
        mixedPieces.sort(cmpLenRev);

        this._weekdaysRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i');
        this._weekdaysShortRegex = this._weekdaysRegex;
        this._weekdaysMinRegex = this._weekdaysRegex;

        this._weekdaysStrictRegex = new RegExp(
            '^(' + longPieces.join('|') + ')',
            'i'
        );
        this._weekdaysShortStrictRegex = new RegExp(
            '^(' + shortPieces.join('|') + ')',
            'i'
        );
        this._weekdaysMinStrictRegex = new RegExp(
            '^(' + minPieces.join('|') + ')',
            'i'
        );
    }

    // FORMATTING

    function hFormat() {
        return this.hours() % 12 || 12;
    }

    function kFormat() {
        return this.hours() || 24;
    }

    addFormatToken('H', ['HH', 2], 0, 'hour');
    addFormatToken('h', ['hh', 2], 0, hFormat);
    addFormatToken('k', ['kk', 2], 0, kFormat);

    addFormatToken('hmm', 0, 0, function () {
        return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2);
    });

    addFormatToken('hmmss', 0, 0, function () {
        return (
            '' +
            hFormat.apply(this) +
            zeroFill(this.minutes(), 2) +
            zeroFill(this.seconds(), 2)
        );
    });

    addFormatToken('Hmm', 0, 0, function () {
        return '' + this.hours() + zeroFill(this.minutes(), 2);
    });

    addFormatToken('Hmmss', 0, 0, function () {
        return (
            '' +
            this.hours() +
            zeroFill(this.minutes(), 2) +
            zeroFill(this.seconds(), 2)
        );
    });

    function meridiem(token, lowercase) {
        addFormatToken(token, 0, 0, function () {
            return this.localeData().meridiem(
                this.hours(),
                this.minutes(),
                lowercase
            );
        });
    }

    meridiem('a', true);
    meridiem('A', false);

    // ALIASES

    addUnitAlias('hour', 'h');

    // PRIORITY
    addUnitPriority('hour', 13);

    // PARSING

    function matchMeridiem(isStrict, locale) {
        return locale._meridiemParse;
    }

    addRegexToken('a', matchMeridiem);
    addRegexToken('A', matchMeridiem);
    addRegexToken('H', match1to2);
    addRegexToken('h', match1to2);
    addRegexToken('k', match1to2);
    addRegexToken('HH', match1to2, match2);
    addRegexToken('hh', match1to2, match2);
    addRegexToken('kk', match1to2, match2);

    addRegexToken('hmm', match3to4);
    addRegexToken('hmmss', match5to6);
    addRegexToken('Hmm', match3to4);
    addRegexToken('Hmmss', match5to6);

    addParseToken(['H', 'HH'], HOUR);
    addParseToken(['k', 'kk'], function (input, array, config) {
        var kInput = toInt(input);
        array[HOUR] = kInput === 24 ? 0 : kInput;
    });
    addParseToken(['a', 'A'], function (input, array, config) {
        config._isPm = config._locale.isPM(input);
        config._meridiem = input;
    });
    addParseToken(['h', 'hh'], function (input, array, config) {
        array[HOUR] = toInt(input);
        getParsingFlags(config).bigHour = true;
    });
    addParseToken('hmm', function (input, array, config) {
        var pos = input.length - 2;
        array[HOUR] = toInt(input.substr(0, pos));
        array[MINUTE] = toInt(input.substr(pos));
        getParsingFlags(config).bigHour = true;
    });
    addParseToken('hmmss', function (input, array, config) {
        var pos1 = input.length - 4,
            pos2 = input.length - 2;
        array[HOUR] = toInt(input.substr(0, pos1));
        array[MINUTE] = toInt(input.substr(pos1, 2));
        array[SECOND] = toInt(input.substr(pos2));
        getParsingFlags(config).bigHour = true;
    });
    addParseToken('Hmm', function (input, array, config) {
        var pos = input.length - 2;
        array[HOUR] = toInt(input.substr(0, pos));
        array[MINUTE] = toInt(input.substr(pos));
    });
    addParseToken('Hmmss', function (input, array, config) {
        var pos1 = input.length - 4,
            pos2 = input.length - 2;
        array[HOUR] = toInt(input.substr(0, pos1));
        array[MINUTE] = toInt(input.substr(pos1, 2));
        array[SECOND] = toInt(input.substr(pos2));
    });

    // LOCALES

    function localeIsPM(input) {
        // IE8 Quirks Mode & IE7 Standards Mode do not allow accessing strings like arrays
        // Using charAt should be more compatible.
        return (input + '').toLowerCase().charAt(0) === 'p';
    }

    var defaultLocaleMeridiemParse = /[ap]\.?m?\.?/i,
        // Setting the hour should keep the time, because the user explicitly
        // specified which hour they want. So trying to maintain the same hour (in
        // a new timezone) makes sense. Adding/subtracting hours does not follow
        // this rule.
        getSetHour = makeGetSet('Hours', true);

    function localeMeridiem(hours, minutes, isLower) {
        if (hours > 11) {
            return isLower ? 'pm' : 'PM';
        } else {
            return isLower ? 'am' : 'AM';
        }
    }

    var baseConfig = {
        calendar: defaultCalendar,
        longDateFormat: defaultLongDateFormat,
        invalidDate: defaultInvalidDate,
        ordinal: defaultOrdinal,
        dayOfMonthOrdinalParse: defaultDayOfMonthOrdinalParse,
        relativeTime: defaultRelativeTime,

        months: defaultLocaleMonths,
        monthsShort: defaultLocaleMonthsShort,

        week: defaultLocaleWeek,

        weekdays: defaultLocaleWeekdays,
        weekdaysMin: defaultLocaleWeekdaysMin,
        weekdaysShort: defaultLocaleWeekdaysShort,

        meridiemParse: defaultLocaleMeridiemParse,
    };

    // internal storage for locale config files
    var locales = {},
        localeFamilies = {},
        globalLocale;

    function commonPrefix(arr1, arr2) {
        var i,
            minl = Math.min(arr1.length, arr2.length);
        for (i = 0; i < minl; i += 1) {
            if (arr1[i] !== arr2[i]) {
                return i;
            }
        }
        return minl;
    }

    function normalizeLocale(key) {
        return key ? key.toLowerCase().replace('_', '-') : key;
    }

    // pick the locale from the array
    // try ['en-au', 'en-gb'] as 'en-au', 'en-gb', 'en', as in move through the list trying each
    // substring from most specific to least, but move to the next array item if it's a more specific variant than the current root
    function chooseLocale(names) {
        var i = 0,
            j,
            next,
            locale,
            split;

        while (i < names.length) {
            split = normalizeLocale(names[i]).split('-');
            j = split.length;
            next = normalizeLocale(names[i + 1]);
            next = next ? next.split('-') : null;
            while (j > 0) {
                locale = loadLocale(split.slice(0, j).join('-'));
                if (locale) {
                    return locale;
                }
                if (
                    next &&
                    next.length >= j &&
                    commonPrefix(split, next) >= j - 1
                ) {
                    //the next array item is better than a shallower substring of this one
                    break;
                }
                j--;
            }
            i++;
        }
        return globalLocale;
    }

    function loadLocale(name) {
        var oldLocale = null,
            aliasedRequire;
        // TODO: Find a better way to register and load all the locales in Node
        if (
            locales[name] === undefined &&
            typeof module !== 'undefined' &&
            module &&
            module.exports
        ) {
            try {
                oldLocale = globalLocale._abbr;
                aliasedRequire = require;
                __webpack_require__(32)("./" + name);
                getSetGlobalLocale(oldLocale);
            } catch (e) {
                // mark as not found to avoid repeating expensive file require call causing high CPU
                // when trying to find en-US, en_US, en-us for every format call
                locales[name] = null; // null means not found
            }
        }
        return locales[name];
    }

    // This function will load locale and then set the global locale.  If
    // no arguments are passed in, it will simply return the current global
    // locale key.
    function getSetGlobalLocale(key, values) {
        var data;
        if (key) {
            if (isUndefined(values)) {
                data = getLocale(key);
            } else {
                data = defineLocale(key, values);
            }

            if (data) {
                // moment.duration._locale = moment._locale = data;
                globalLocale = data;
            } else {
                if (typeof console !== 'undefined' && console.warn) {
                    //warn user if arguments are passed but the locale could not be set
                    console.warn(
                        'Locale ' + key + ' not found. Did you forget to load it?'
                    );
                }
            }
        }

        return globalLocale._abbr;
    }

    function defineLocale(name, config) {
        if (config !== null) {
            var locale,
                parentConfig = baseConfig;
            config.abbr = name;
            if (locales[name] != null) {
                deprecateSimple(
                    'defineLocaleOverride',
                    'use moment.updateLocale(localeName, config) to change ' +
                        'an existing locale. moment.defineLocale(localeName, ' +
                        'config) should only be used for creating a new locale ' +
                        'See http://momentjs.com/guides/#/warnings/define-locale/ for more info.'
                );
                parentConfig = locales[name]._config;
            } else if (config.parentLocale != null) {
                if (locales[config.parentLocale] != null) {
                    parentConfig = locales[config.parentLocale]._config;
                } else {
                    locale = loadLocale(config.parentLocale);
                    if (locale != null) {
                        parentConfig = locale._config;
                    } else {
                        if (!localeFamilies[config.parentLocale]) {
                            localeFamilies[config.parentLocale] = [];
                        }
                        localeFamilies[config.parentLocale].push({
                            name: name,
                            config: config,
                        });
                        return null;
                    }
                }
            }
            locales[name] = new Locale(mergeConfigs(parentConfig, config));

            if (localeFamilies[name]) {
                localeFamilies[name].forEach(function (x) {
                    defineLocale(x.name, x.config);
                });
            }

            // backwards compat for now: also set the locale
            // make sure we set the locale AFTER all child locales have been
            // created, so we won't end up with the child locale set.
            getSetGlobalLocale(name);

            return locales[name];
        } else {
            // useful for testing
            delete locales[name];
            return null;
        }
    }

    function updateLocale(name, config) {
        if (config != null) {
            var locale,
                tmpLocale,
                parentConfig = baseConfig;

            if (locales[name] != null && locales[name].parentLocale != null) {
                // Update existing child locale in-place to avoid memory-leaks
                locales[name].set(mergeConfigs(locales[name]._config, config));
            } else {
                // MERGE
                tmpLocale = loadLocale(name);
                if (tmpLocale != null) {
                    parentConfig = tmpLocale._config;
                }
                config = mergeConfigs(parentConfig, config);
                if (tmpLocale == null) {
                    // updateLocale is called for creating a new locale
                    // Set abbr so it will have a name (getters return
                    // undefined otherwise).
                    config.abbr = name;
                }
                locale = new Locale(config);
                locale.parentLocale = locales[name];
                locales[name] = locale;
            }

            // backwards compat for now: also set the locale
            getSetGlobalLocale(name);
        } else {
            // pass null for config to unupdate, useful for tests
            if (locales[name] != null) {
                if (locales[name].parentLocale != null) {
                    locales[name] = locales[name].parentLocale;
                    if (name === getSetGlobalLocale()) {
                        getSetGlobalLocale(name);
                    }
                } else if (locales[name] != null) {
                    delete locales[name];
                }
            }
        }
        return locales[name];
    }

    // returns locale data
    function getLocale(key) {
        var locale;

        if (key && key._locale && key._locale._abbr) {
            key = key._locale._abbr;
        }

        if (!key) {
            return globalLocale;
        }

        if (!isArray(key)) {
            //short-circuit everything else
            locale = loadLocale(key);
            if (locale) {
                return locale;
            }
            key = [key];
        }

        return chooseLocale(key);
    }

    function listLocales() {
        return keys(locales);
    }

    function checkOverflow(m) {
        var overflow,
            a = m._a;

        if (a && getParsingFlags(m).overflow === -2) {
            overflow =
                a[MONTH] < 0 || a[MONTH] > 11
                    ? MONTH
                    : a[DATE] < 1 || a[DATE] > daysInMonth(a[YEAR], a[MONTH])
                    ? DATE
                    : a[HOUR] < 0 ||
                      a[HOUR] > 24 ||
                      (a[HOUR] === 24 &&
                          (a[MINUTE] !== 0 ||
                              a[SECOND] !== 0 ||
                              a[MILLISECOND] !== 0))
                    ? HOUR
                    : a[MINUTE] < 0 || a[MINUTE] > 59
                    ? MINUTE
                    : a[SECOND] < 0 || a[SECOND] > 59
                    ? SECOND
                    : a[MILLISECOND] < 0 || a[MILLISECOND] > 999
                    ? MILLISECOND
                    : -1;

            if (
                getParsingFlags(m)._overflowDayOfYear &&
                (overflow < YEAR || overflow > DATE)
            ) {
                overflow = DATE;
            }
            if (getParsingFlags(m)._overflowWeeks && overflow === -1) {
                overflow = WEEK;
            }
            if (getParsingFlags(m)._overflowWeekday && overflow === -1) {
                overflow = WEEKDAY;
            }

            getParsingFlags(m).overflow = overflow;
        }

        return m;
    }

    // iso 8601 regex
    // 0000-00-00 0000-W00 or 0000-W00-0 + T + 00 or 00:00 or 00:00:00 or 00:00:00.000 + +00:00 or +0000 or +00)
    var extendedIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,
        basicIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,
        tzRegex = /Z|[+-]\d\d(?::?\d\d)?/,
        isoDates = [
            ['YYYYYY-MM-DD', /[+-]\d{6}-\d\d-\d\d/],
            ['YYYY-MM-DD', /\d{4}-\d\d-\d\d/],
            ['GGGG-[W]WW-E', /\d{4}-W\d\d-\d/],
            ['GGGG-[W]WW', /\d{4}-W\d\d/, false],
            ['YYYY-DDD', /\d{4}-\d{3}/],
            ['YYYY-MM', /\d{4}-\d\d/, false],
            ['YYYYYYMMDD', /[+-]\d{10}/],
            ['YYYYMMDD', /\d{8}/],
            ['GGGG[W]WWE', /\d{4}W\d{3}/],
            ['GGGG[W]WW', /\d{4}W\d{2}/, false],
            ['YYYYDDD', /\d{7}/],
            ['YYYYMM', /\d{6}/, false],
            ['YYYY', /\d{4}/, false],
        ],
        // iso time formats and regexes
        isoTimes = [
            ['HH:mm:ss.SSSS', /\d\d:\d\d:\d\d\.\d+/],
            ['HH:mm:ss,SSSS', /\d\d:\d\d:\d\d,\d+/],
            ['HH:mm:ss', /\d\d:\d\d:\d\d/],
            ['HH:mm', /\d\d:\d\d/],
            ['HHmmss.SSSS', /\d\d\d\d\d\d\.\d+/],
            ['HHmmss,SSSS', /\d\d\d\d\d\d,\d+/],
            ['HHmmss', /\d\d\d\d\d\d/],
            ['HHmm', /\d\d\d\d/],
            ['HH', /\d\d/],
        ],
        aspNetJsonRegex = /^\/?Date\((-?\d+)/i,
        // RFC 2822 regex: For details see https://tools.ietf.org/html/rfc2822#section-3.3
        rfc2822 = /^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/,
        obsOffsets = {
            UT: 0,
            GMT: 0,
            EDT: -4 * 60,
            EST: -5 * 60,
            CDT: -5 * 60,
            CST: -6 * 60,
            MDT: -6 * 60,
            MST: -7 * 60,
            PDT: -7 * 60,
            PST: -8 * 60,
        };

    // date from iso format
    function configFromISO(config) {
        var i,
            l,
            string = config._i,
            match = extendedIsoRegex.exec(string) || basicIsoRegex.exec(string),
            allowTime,
            dateFormat,
            timeFormat,
            tzFormat;

        if (match) {
            getParsingFlags(config).iso = true;

            for (i = 0, l = isoDates.length; i < l; i++) {
                if (isoDates[i][1].exec(match[1])) {
                    dateFormat = isoDates[i][0];
                    allowTime = isoDates[i][2] !== false;
                    break;
                }
            }
            if (dateFormat == null) {
                config._isValid = false;
                return;
            }
            if (match[3]) {
                for (i = 0, l = isoTimes.length; i < l; i++) {
                    if (isoTimes[i][1].exec(match[3])) {
                        // match[2] should be 'T' or space
                        timeFormat = (match[2] || ' ') + isoTimes[i][0];
                        break;
                    }
                }
                if (timeFormat == null) {
                    config._isValid = false;
                    return;
                }
            }
            if (!allowTime && timeFormat != null) {
                config._isValid = false;
                return;
            }
            if (match[4]) {
                if (tzRegex.exec(match[4])) {
                    tzFormat = 'Z';
                } else {
                    config._isValid = false;
                    return;
                }
            }
            config._f = dateFormat + (timeFormat || '') + (tzFormat || '');
            configFromStringAndFormat(config);
        } else {
            config._isValid = false;
        }
    }

    function extractFromRFC2822Strings(
        yearStr,
        monthStr,
        dayStr,
        hourStr,
        minuteStr,
        secondStr
    ) {
        var result = [
            untruncateYear(yearStr),
            defaultLocaleMonthsShort.indexOf(monthStr),
            parseInt(dayStr, 10),
            parseInt(hourStr, 10),
            parseInt(minuteStr, 10),
        ];

        if (secondStr) {
            result.push(parseInt(secondStr, 10));
        }

        return result;
    }

    function untruncateYear(yearStr) {
        var year = parseInt(yearStr, 10);
        if (year <= 49) {
            return 2000 + year;
        } else if (year <= 999) {
            return 1900 + year;
        }
        return year;
    }

    function preprocessRFC2822(s) {
        // Remove comments and folding whitespace and replace multiple-spaces with a single space
        return s
            .replace(/\([^)]*\)|[\n\t]/g, ' ')
            .replace(/(\s\s+)/g, ' ')
            .replace(/^\s\s*/, '')
            .replace(/\s\s*$/, '');
    }

    function checkWeekday(weekdayStr, parsedInput, config) {
        if (weekdayStr) {
            // TODO: Replace the vanilla JS Date object with an independent day-of-week check.
            var weekdayProvided = defaultLocaleWeekdaysShort.indexOf(weekdayStr),
                weekdayActual = new Date(
                    parsedInput[0],
                    parsedInput[1],
                    parsedInput[2]
                ).getDay();
            if (weekdayProvided !== weekdayActual) {
                getParsingFlags(config).weekdayMismatch = true;
                config._isValid = false;
                return false;
            }
        }
        return true;
    }

    function calculateOffset(obsOffset, militaryOffset, numOffset) {
        if (obsOffset) {
            return obsOffsets[obsOffset];
        } else if (militaryOffset) {
            // the only allowed military tz is Z
            return 0;
        } else {
            var hm = parseInt(numOffset, 10),
                m = hm % 100,
                h = (hm - m) / 100;
            return h * 60 + m;
        }
    }

    // date and time from ref 2822 format
    function configFromRFC2822(config) {
        var match = rfc2822.exec(preprocessRFC2822(config._i)),
            parsedArray;
        if (match) {
            parsedArray = extractFromRFC2822Strings(
                match[4],
                match[3],
                match[2],
                match[5],
                match[6],
                match[7]
            );
            if (!checkWeekday(match[1], parsedArray, config)) {
                return;
            }

            config._a = parsedArray;
            config._tzm = calculateOffset(match[8], match[9], match[10]);

            config._d = createUTCDate.apply(null, config._a);
            config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);

            getParsingFlags(config).rfc2822 = true;
        } else {
            config._isValid = false;
        }
    }

    // date from 1) ASP.NET, 2) ISO, 3) RFC 2822 formats, or 4) optional fallback if parsing isn't strict
    function configFromString(config) {
        var matched = aspNetJsonRegex.exec(config._i);
        if (matched !== null) {
            config._d = new Date(+matched[1]);
            return;
        }

        configFromISO(config);
        if (config._isValid === false) {
            delete config._isValid;
        } else {
            return;
        }

        configFromRFC2822(config);
        if (config._isValid === false) {
            delete config._isValid;
        } else {
            return;
        }

        if (config._strict) {
            config._isValid = false;
        } else {
            // Final attempt, use Input Fallback
            hooks.createFromInputFallback(config);
        }
    }

    hooks.createFromInputFallback = deprecate(
        'value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), ' +
            'which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are ' +
            'discouraged and will be removed in an upcoming major release. Please refer to ' +
            'http://momentjs.com/guides/#/warnings/js-date/ for more info.',
        function (config) {
            config._d = new Date(config._i + (config._useUTC ? ' UTC' : ''));
        }
    );

    // Pick the first defined of two or three arguments.
    function defaults(a, b, c) {
        if (a != null) {
            return a;
        }
        if (b != null) {
            return b;
        }
        return c;
    }

    function currentDateArray(config) {
        // hooks is actually the exported moment object
        var nowValue = new Date(hooks.now());
        if (config._useUTC) {
            return [
                nowValue.getUTCFullYear(),
                nowValue.getUTCMonth(),
                nowValue.getUTCDate(),
            ];
        }
        return [nowValue.getFullYear(), nowValue.getMonth(), nowValue.getDate()];
    }

    // convert an array to a date.
    // the array should mirror the parameters below
    // note: all values past the year are optional and will default to the lowest possible value.
    // [year, month, day , hour, minute, second, millisecond]
    function configFromArray(config) {
        var i,
            date,
            input = [],
            currentDate,
            expectedWeekday,
            yearToUse;

        if (config._d) {
            return;
        }

        currentDate = currentDateArray(config);

        //compute day of the year from weeks and weekdays
        if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {
            dayOfYearFromWeekInfo(config);
        }

        //if the day of the year is set, figure out what it is
        if (config._dayOfYear != null) {
            yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);

            if (
                config._dayOfYear > daysInYear(yearToUse) ||
                config._dayOfYear === 0
            ) {
                getParsingFlags(config)._overflowDayOfYear = true;
            }

            date = createUTCDate(yearToUse, 0, config._dayOfYear);
            config._a[MONTH] = date.getUTCMonth();
            config._a[DATE] = date.getUTCDate();
        }

        // Default to current date.
        // * if no year, month, day of month are given, default to today
        // * if day of month is given, default month and year
        // * if month is given, default only year
        // * if year is given, don't default anything
        for (i = 0; i < 3 && config._a[i] == null; ++i) {
            config._a[i] = input[i] = currentDate[i];
        }

        // Zero out whatever was not defaulted, including time
        for (; i < 7; i++) {
            config._a[i] = input[i] =
                config._a[i] == null ? (i === 2 ? 1 : 0) : config._a[i];
        }

        // Check for 24:00:00.000
        if (
            config._a[HOUR] === 24 &&
            config._a[MINUTE] === 0 &&
            config._a[SECOND] === 0 &&
            config._a[MILLISECOND] === 0
        ) {
            config._nextDay = true;
            config._a[HOUR] = 0;
        }

        config._d = (config._useUTC ? createUTCDate : createDate).apply(
            null,
            input
        );
        expectedWeekday = config._useUTC
            ? config._d.getUTCDay()
            : config._d.getDay();

        // Apply timezone offset from input. The actual utcOffset can be changed
        // with parseZone.
        if (config._tzm != null) {
            config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);
        }

        if (config._nextDay) {
            config._a[HOUR] = 24;
        }

        // check for mismatching day of week
        if (
            config._w &&
            typeof config._w.d !== 'undefined' &&
            config._w.d !== expectedWeekday
        ) {
            getParsingFlags(config).weekdayMismatch = true;
        }
    }

    function dayOfYearFromWeekInfo(config) {
        var w, weekYear, week, weekday, dow, doy, temp, weekdayOverflow, curWeek;

        w = config._w;
        if (w.GG != null || w.W != null || w.E != null) {
            dow = 1;
            doy = 4;

            // TODO: We need to take the current isoWeekYear, but that depends on
            // how we interpret now (local, utc, fixed offset). So create
            // a now version of current config (take local/utc/offset flags, and
            // create now).
            weekYear = defaults(
                w.GG,
                config._a[YEAR],
                weekOfYear(createLocal(), 1, 4).year
            );
            week = defaults(w.W, 1);
            weekday = defaults(w.E, 1);
            if (weekday < 1 || weekday > 7) {
                weekdayOverflow = true;
            }
        } else {
            dow = config._locale._week.dow;
            doy = config._locale._week.doy;

            curWeek = weekOfYear(createLocal(), dow, doy);

            weekYear = defaults(w.gg, config._a[YEAR], curWeek.year);

            // Default to current week.
            week = defaults(w.w, curWeek.week);

            if (w.d != null) {
                // weekday -- low day numbers are considered next week
                weekday = w.d;
                if (weekday < 0 || weekday > 6) {
                    weekdayOverflow = true;
                }
            } else if (w.e != null) {
                // local weekday -- counting starts from beginning of week
                weekday = w.e + dow;
                if (w.e < 0 || w.e > 6) {
                    weekdayOverflow = true;
                }
            } else {
                // default to beginning of week
                weekday = dow;
            }
        }
        if (week < 1 || week > weeksInYear(weekYear, dow, doy)) {
            getParsingFlags(config)._overflowWeeks = true;
        } else if (weekdayOverflow != null) {
            getParsingFlags(config)._overflowWeekday = true;
        } else {
            temp = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy);
            config._a[YEAR] = temp.year;
            config._dayOfYear = temp.dayOfYear;
        }
    }

    // constant that refers to the ISO standard
    hooks.ISO_8601 = function () {};

    // constant that refers to the RFC 2822 form
    hooks.RFC_2822 = function () {};

    // date from string and format string
    function configFromStringAndFormat(config) {
        // TODO: Move this to another part of the creation flow to prevent circular deps
        if (config._f === hooks.ISO_8601) {
            configFromISO(config);
            return;
        }
        if (config._f === hooks.RFC_2822) {
            configFromRFC2822(config);
            return;
        }
        config._a = [];
        getParsingFlags(config).empty = true;

        // This array is used to make a Date, either with `new Date` or `Date.UTC`
        var string = '' + config._i,
            i,
            parsedInput,
            tokens,
            token,
            skipped,
            stringLength = string.length,
            totalParsedInputLength = 0,
            era;

        tokens =
            expandFormat(config._f, config._locale).match(formattingTokens) || [];

        for (i = 0; i < tokens.length; i++) {
            token = tokens[i];
            parsedInput = (string.match(getParseRegexForToken(token, config)) ||
                [])[0];
            if (parsedInput) {
                skipped = string.substr(0, string.indexOf(parsedInput));
                if (skipped.length > 0) {
                    getParsingFlags(config).unusedInput.push(skipped);
                }
                string = string.slice(
                    string.indexOf(parsedInput) + parsedInput.length
                );
                totalParsedInputLength += parsedInput.length;
            }
            // don't parse if it's not a known token
            if (formatTokenFunctions[token]) {
                if (parsedInput) {
                    getParsingFlags(config).empty = false;
                } else {
                    getParsingFlags(config).unusedTokens.push(token);
                }
                addTimeToArrayFromToken(token, parsedInput, config);
            } else if (config._strict && !parsedInput) {
                getParsingFlags(config).unusedTokens.push(token);
            }
        }

        // add remaining unparsed input length to the string
        getParsingFlags(config).charsLeftOver =
            stringLength - totalParsedInputLength;
        if (string.length > 0) {
            getParsingFlags(config).unusedInput.push(string);
        }

        // clear _12h flag if hour is <= 12
        if (
            config._a[HOUR] <= 12 &&
            getParsingFlags(config).bigHour === true &&
            config._a[HOUR] > 0
        ) {
            getParsingFlags(config).bigHour = undefined;
        }

        getParsingFlags(config).parsedDateParts = config._a.slice(0);
        getParsingFlags(config).meridiem = config._meridiem;
        // handle meridiem
        config._a[HOUR] = meridiemFixWrap(
            config._locale,
            config._a[HOUR],
            config._meridiem
        );

        // handle era
        era = getParsingFlags(config).era;
        if (era !== null) {
            config._a[YEAR] = config._locale.erasConvertYear(era, config._a[YEAR]);
        }

        configFromArray(config);
        checkOverflow(config);
    }

    function meridiemFixWrap(locale, hour, meridiem) {
        var isPm;

        if (meridiem == null) {
            // nothing to do
            return hour;
        }
        if (locale.meridiemHour != null) {
            return locale.meridiemHour(hour, meridiem);
        } else if (locale.isPM != null) {
            // Fallback
            isPm = locale.isPM(meridiem);
            if (isPm && hour < 12) {
                hour += 12;
            }
            if (!isPm && hour === 12) {
                hour = 0;
            }
            return hour;
        } else {
            // this is not supposed to happen
            return hour;
        }
    }

    // date from string and array of format strings
    function configFromStringAndArray(config) {
        var tempConfig,
            bestMoment,
            scoreToBeat,
            i,
            currentScore,
            validFormatFound,
            bestFormatIsValid = false;

        if (config._f.length === 0) {
            getParsingFlags(config).invalidFormat = true;
            config._d = new Date(NaN);
            return;
        }

        for (i = 0; i < config._f.length; i++) {
            currentScore = 0;
            validFormatFound = false;
            tempConfig = copyConfig({}, config);
            if (config._useUTC != null) {
                tempConfig._useUTC = config._useUTC;
            }
            tempConfig._f = config._f[i];
            configFromStringAndFormat(tempConfig);

            if (isValid(tempConfig)) {
                validFormatFound = true;
            }

            // if there is any input that was not parsed add a penalty for that format
            currentScore += getParsingFlags(tempConfig).charsLeftOver;

            //or tokens
            currentScore += getParsingFlags(tempConfig).unusedTokens.length * 10;

            getParsingFlags(tempConfig).score = currentScore;

            if (!bestFormatIsValid) {
                if (
                    scoreToBeat == null ||
                    currentScore < scoreToBeat ||
                    validFormatFound
                ) {
                    scoreToBeat = currentScore;
                    bestMoment = tempConfig;
                    if (validFormatFound) {
                        bestFormatIsValid = true;
                    }
                }
            } else {
                if (currentScore < scoreToBeat) {
                    scoreToBeat = currentScore;
                    bestMoment = tempConfig;
                }
            }
        }

        extend(config, bestMoment || tempConfig);
    }

    function configFromObject(config) {
        if (config._d) {
            return;
        }

        var i = normalizeObjectUnits(config._i),
            dayOrDate = i.day === undefined ? i.date : i.day;
        config._a = map(
            [i.year, i.month, dayOrDate, i.hour, i.minute, i.second, i.millisecond],
            function (obj) {
                return obj && parseInt(obj, 10);
            }
        );

        configFromArray(config);
    }

    function createFromConfig(config) {
        var res = new Moment(checkOverflow(prepareConfig(config)));
        if (res._nextDay) {
            // Adding is smart enough around DST
            res.add(1, 'd');
            res._nextDay = undefined;
        }

        return res;
    }

    function prepareConfig(config) {
        var input = config._i,
            format = config._f;

        config._locale = config._locale || getLocale(config._l);

        if (input === null || (format === undefined && input === '')) {
            return createInvalid({ nullInput: true });
        }

        if (typeof input === 'string') {
            config._i = input = config._locale.preparse(input);
        }

        if (isMoment(input)) {
            return new Moment(checkOverflow(input));
        } else if (isDate(input)) {
            config._d = input;
        } else if (isArray(format)) {
            configFromStringAndArray(config);
        } else if (format) {
            configFromStringAndFormat(config);
        } else {
            configFromInput(config);
        }

        if (!isValid(config)) {
            config._d = null;
        }

        return config;
    }

    function configFromInput(config) {
        var input = config._i;
        if (isUndefined(input)) {
            config._d = new Date(hooks.now());
        } else if (isDate(input)) {
            config._d = new Date(input.valueOf());
        } else if (typeof input === 'string') {
            configFromString(config);
        } else if (isArray(input)) {
            config._a = map(input.slice(0), function (obj) {
                return parseInt(obj, 10);
            });
            configFromArray(config);
        } else if (isObject(input)) {
            configFromObject(config);
        } else if (isNumber(input)) {
            // from milliseconds
            config._d = new Date(input);
        } else {
            hooks.createFromInputFallback(config);
        }
    }

    function createLocalOrUTC(input, format, locale, strict, isUTC) {
        var c = {};

        if (format === true || format === false) {
            strict = format;
            format = undefined;
        }

        if (locale === true || locale === false) {
            strict = locale;
            locale = undefined;
        }

        if (
            (isObject(input) && isObjectEmpty(input)) ||
            (isArray(input) && input.length === 0)
        ) {
            input = undefined;
        }
        // object construction must be done this way.
        // https://github.com/moment/moment/issues/1423
        c._isAMomentObject = true;
        c._useUTC = c._isUTC = isUTC;
        c._l = locale;
        c._i = input;
        c._f = format;
        c._strict = strict;

        return createFromConfig(c);
    }

    function createLocal(input, format, locale, strict) {
        return createLocalOrUTC(input, format, locale, strict, false);
    }

    var prototypeMin = deprecate(
            'moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/',
            function () {
                var other = createLocal.apply(null, arguments);
                if (this.isValid() && other.isValid()) {
                    return other < this ? this : other;
                } else {
                    return createInvalid();
                }
            }
        ),
        prototypeMax = deprecate(
            'moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/',
            function () {
                var other = createLocal.apply(null, arguments);
                if (this.isValid() && other.isValid()) {
                    return other > this ? this : other;
                } else {
                    return createInvalid();
                }
            }
        );

    // Pick a moment m from moments so that m[fn](other) is true for all
    // other. This relies on the function fn to be transitive.
    //
    // moments should either be an array of moment objects or an array, whose
    // first element is an array of moment objects.
    function pickBy(fn, moments) {
        var res, i;
        if (moments.length === 1 && isArray(moments[0])) {
            moments = moments[0];
        }
        if (!moments.length) {
            return createLocal();
        }
        res = moments[0];
        for (i = 1; i < moments.length; ++i) {
            if (!moments[i].isValid() || moments[i][fn](res)) {
                res = moments[i];
            }
        }
        return res;
    }

    // TODO: Use [].sort instead?
    function min() {
        var args = [].slice.call(arguments, 0);

        return pickBy('isBefore', args);
    }

    function max() {
        var args = [].slice.call(arguments, 0);

        return pickBy('isAfter', args);
    }

    var now = function () {
        return Date.now ? Date.now() : +new Date();
    };

    var ordering = [
        'year',
        'quarter',
        'month',
        'week',
        'day',
        'hour',
        'minute',
        'second',
        'millisecond',
    ];

    function isDurationValid(m) {
        var key,
            unitHasDecimal = false,
            i;
        for (key in m) {
            if (
                hasOwnProp(m, key) &&
                !(
                    indexOf.call(ordering, key) !== -1 &&
                    (m[key] == null || !isNaN(m[key]))
                )
            ) {
                return false;
            }
        }

        for (i = 0; i < ordering.length; ++i) {
            if (m[ordering[i]]) {
                if (unitHasDecimal) {
                    return false; // only allow non-integers for smallest unit
                }
                if (parseFloat(m[ordering[i]]) !== toInt(m[ordering[i]])) {
                    unitHasDecimal = true;
                }
            }
        }

        return true;
    }

    function isValid$1() {
        return this._isValid;
    }

    function createInvalid$1() {
        return createDuration(NaN);
    }

    function Duration(duration) {
        var normalizedInput = normalizeObjectUnits(duration),
            years = normalizedInput.year || 0,
            quarters = normalizedInput.quarter || 0,
            months = normalizedInput.month || 0,
            weeks = normalizedInput.week || normalizedInput.isoWeek || 0,
            days = normalizedInput.day || 0,
            hours = normalizedInput.hour || 0,
            minutes = normalizedInput.minute || 0,
            seconds = normalizedInput.second || 0,
            milliseconds = normalizedInput.millisecond || 0;

        this._isValid = isDurationValid(normalizedInput);

        // representation for dateAddRemove
        this._milliseconds =
            +milliseconds +
            seconds * 1e3 + // 1000
            minutes * 6e4 + // 1000 * 60
            hours * 1000 * 60 * 60; //using 1000 * 60 * 60 instead of 36e5 to avoid floating point rounding errors https://github.com/moment/moment/issues/2978
        // Because of dateAddRemove treats 24 hours as different from a
        // day when working around DST, we need to store them separately
        this._days = +days + weeks * 7;
        // It is impossible to translate months into days without knowing
        // which months you are are talking about, so we have to store
        // it separately.
        this._months = +months + quarters * 3 + years * 12;

        this._data = {};

        this._locale = getLocale();

        this._bubble();
    }

    function isDuration(obj) {
        return obj instanceof Duration;
    }

    function absRound(number) {
        if (number < 0) {
            return Math.round(-1 * number) * -1;
        } else {
            return Math.round(number);
        }
    }

    // compare two arrays, return the number of differences
    function compareArrays(array1, array2, dontConvert) {
        var len = Math.min(array1.length, array2.length),
            lengthDiff = Math.abs(array1.length - array2.length),
            diffs = 0,
            i;
        for (i = 0; i < len; i++) {
            if (
                (dontConvert && array1[i] !== array2[i]) ||
                (!dontConvert && toInt(array1[i]) !== toInt(array2[i]))
            ) {
                diffs++;
            }
        }
        return diffs + lengthDiff;
    }

    // FORMATTING

    function offset(token, separator) {
        addFormatToken(token, 0, 0, function () {
            var offset = this.utcOffset(),
                sign = '+';
            if (offset < 0) {
                offset = -offset;
                sign = '-';
            }
            return (
                sign +
                zeroFill(~~(offset / 60), 2) +
                separator +
                zeroFill(~~offset % 60, 2)
            );
        });
    }

    offset('Z', ':');
    offset('ZZ', '');

    // PARSING

    addRegexToken('Z', matchShortOffset);
    addRegexToken('ZZ', matchShortOffset);
    addParseToken(['Z', 'ZZ'], function (input, array, config) {
        config._useUTC = true;
        config._tzm = offsetFromString(matchShortOffset, input);
    });

    // HELPERS

    // timezone chunker
    // '+10:00' > ['10',  '00']
    // '-1530'  > ['-15', '30']
    var chunkOffset = /([\+\-]|\d\d)/gi;

    function offsetFromString(matcher, string) {
        var matches = (string || '').match(matcher),
            chunk,
            parts,
            minutes;

        if (matches === null) {
            return null;
        }

        chunk = matches[matches.length - 1] || [];
        parts = (chunk + '').match(chunkOffset) || ['-', 0, 0];
        minutes = +(parts[1] * 60) + toInt(parts[2]);

        return minutes === 0 ? 0 : parts[0] === '+' ? minutes : -minutes;
    }

    // Return a moment from input, that is local/utc/zone equivalent to model.
    function cloneWithOffset(input, model) {
        var res, diff;
        if (model._isUTC) {
            res = model.clone();
            diff =
                (isMoment(input) || isDate(input)
                    ? input.valueOf()
                    : createLocal(input).valueOf()) - res.valueOf();
            // Use low-level api, because this fn is low-level api.
            res._d.setTime(res._d.valueOf() + diff);
            hooks.updateOffset(res, false);
            return res;
        } else {
            return createLocal(input).local();
        }
    }

    function getDateOffset(m) {
        // On Firefox.24 Date#getTimezoneOffset returns a floating point.
        // https://github.com/moment/moment/pull/1871
        return -Math.round(m._d.getTimezoneOffset());
    }

    // HOOKS

    // This function will be called whenever a moment is mutated.
    // It is intended to keep the offset in sync with the timezone.
    hooks.updateOffset = function () {};

    // MOMENTS

    // keepLocalTime = true means only change the timezone, without
    // affecting the local hour. So 5:31:26 +0300 --[utcOffset(2, true)]-->
    // 5:31:26 +0200 It is possible that 5:31:26 doesn't exist with offset
    // +0200, so we adjust the time as needed, to be valid.
    //
    // Keeping the time actually adds/subtracts (one hour)
    // from the actual represented time. That is why we call updateOffset
    // a second time. In case it wants us to change the offset again
    // _changeInProgress == true case, then we have to adjust, because
    // there is no such time in the given timezone.
    function getSetOffset(input, keepLocalTime, keepMinutes) {
        var offset = this._offset || 0,
            localAdjust;
        if (!this.isValid()) {
            return input != null ? this : NaN;
        }
        if (input != null) {
            if (typeof input === 'string') {
                input = offsetFromString(matchShortOffset, input);
                if (input === null) {
                    return this;
                }
            } else if (Math.abs(input) < 16 && !keepMinutes) {
                input = input * 60;
            }
            if (!this._isUTC && keepLocalTime) {
                localAdjust = getDateOffset(this);
            }
            this._offset = input;
            this._isUTC = true;
            if (localAdjust != null) {
                this.add(localAdjust, 'm');
            }
            if (offset !== input) {
                if (!keepLocalTime || this._changeInProgress) {
                    addSubtract(
                        this,
                        createDuration(input - offset, 'm'),
                        1,
                        false
                    );
                } else if (!this._changeInProgress) {
                    this._changeInProgress = true;
                    hooks.updateOffset(this, true);
                    this._changeInProgress = null;
                }
            }
            return this;
        } else {
            return this._isUTC ? offset : getDateOffset(this);
        }
    }

    function getSetZone(input, keepLocalTime) {
        if (input != null) {
            if (typeof input !== 'string') {
                input = -input;
            }

            this.utcOffset(input, keepLocalTime);

            return this;
        } else {
            return -this.utcOffset();
        }
    }

    function setOffsetToUTC(keepLocalTime) {
        return this.utcOffset(0, keepLocalTime);
    }

    function setOffsetToLocal(keepLocalTime) {
        if (this._isUTC) {
            this.utcOffset(0, keepLocalTime);
            this._isUTC = false;

            if (keepLocalTime) {
                this.subtract(getDateOffset(this), 'm');
            }
        }
        return this;
    }

    function setOffsetToParsedOffset() {
        if (this._tzm != null) {
            this.utcOffset(this._tzm, false, true);
        } else if (typeof this._i === 'string') {
            var tZone = offsetFromString(matchOffset, this._i);
            if (tZone != null) {
                this.utcOffset(tZone);
            } else {
                this.utcOffset(0, true);
            }
        }
        return this;
    }

    function hasAlignedHourOffset(input) {
        if (!this.isValid()) {
            return false;
        }
        input = input ? createLocal(input).utcOffset() : 0;

        return (this.utcOffset() - input) % 60 === 0;
    }

    function isDaylightSavingTime() {
        return (
            this.utcOffset() > this.clone().month(0).utcOffset() ||
            this.utcOffset() > this.clone().month(5).utcOffset()
        );
    }

    function isDaylightSavingTimeShifted() {
        if (!isUndefined(this._isDSTShifted)) {
            return this._isDSTShifted;
        }

        var c = {},
            other;

        copyConfig(c, this);
        c = prepareConfig(c);

        if (c._a) {
            other = c._isUTC ? createUTC(c._a) : createLocal(c._a);
            this._isDSTShifted =
                this.isValid() && compareArrays(c._a, other.toArray()) > 0;
        } else {
            this._isDSTShifted = false;
        }

        return this._isDSTShifted;
    }

    function isLocal() {
        return this.isValid() ? !this._isUTC : false;
    }

    function isUtcOffset() {
        return this.isValid() ? this._isUTC : false;
    }

    function isUtc() {
        return this.isValid() ? this._isUTC && this._offset === 0 : false;
    }

    // ASP.NET json date format regex
    var aspNetRegex = /^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/,
        // from http://docs.closure-library.googlecode.com/git/closure_goog_date_date.js.source.html
        // somewhat more in line with 4.4.3.2 2004 spec, but allows decimal anywhere
        // and further modified to allow for strings containing both week and day
        isoRegex = /^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;

    function createDuration(input, key) {
        var duration = input,
            // matching against regexp is expensive, do it on demand
            match = null,
            sign,
            ret,
            diffRes;

        if (isDuration(input)) {
            duration = {
                ms: input._milliseconds,
                d: input._days,
                M: input._months,
            };
        } else if (isNumber(input) || !isNaN(+input)) {
            duration = {};
            if (key) {
                duration[key] = +input;
            } else {
                duration.milliseconds = +input;
            }
        } else if ((match = aspNetRegex.exec(input))) {
            sign = match[1] === '-' ? -1 : 1;
            duration = {
                y: 0,
                d: toInt(match[DATE]) * sign,
                h: toInt(match[HOUR]) * sign,
                m: toInt(match[MINUTE]) * sign,
                s: toInt(match[SECOND]) * sign,
                ms: toInt(absRound(match[MILLISECOND] * 1000)) * sign, // the millisecond decimal point is included in the match
            };
        } else if ((match = isoRegex.exec(input))) {
            sign = match[1] === '-' ? -1 : 1;
            duration = {
                y: parseIso(match[2], sign),
                M: parseIso(match[3], sign),
                w: parseIso(match[4], sign),
                d: parseIso(match[5], sign),
                h: parseIso(match[6], sign),
                m: parseIso(match[7], sign),
                s: parseIso(match[8], sign),
            };
        } else if (duration == null) {
            // checks for null or undefined
            duration = {};
        } else if (
            typeof duration === 'object' &&
            ('from' in duration || 'to' in duration)
        ) {
            diffRes = momentsDifference(
                createLocal(duration.from),
                createLocal(duration.to)
            );

            duration = {};
            duration.ms = diffRes.milliseconds;
            duration.M = diffRes.months;
        }

        ret = new Duration(duration);

        if (isDuration(input) && hasOwnProp(input, '_locale')) {
            ret._locale = input._locale;
        }

        if (isDuration(input) && hasOwnProp(input, '_isValid')) {
            ret._isValid = input._isValid;
        }

        return ret;
    }

    createDuration.fn = Duration.prototype;
    createDuration.invalid = createInvalid$1;

    function parseIso(inp, sign) {
        // We'd normally use ~~inp for this, but unfortunately it also
        // converts floats to ints.
        // inp may be undefined, so careful calling replace on it.
        var res = inp && parseFloat(inp.replace(',', '.'));
        // apply sign while we're at it
        return (isNaN(res) ? 0 : res) * sign;
    }

    function positiveMomentsDifference(base, other) {
        var res = {};

        res.months =
            other.month() - base.month() + (other.year() - base.year()) * 12;
        if (base.clone().add(res.months, 'M').isAfter(other)) {
            --res.months;
        }

        res.milliseconds = +other - +base.clone().add(res.months, 'M');

        return res;
    }

    function momentsDifference(base, other) {
        var res;
        if (!(base.isValid() && other.isValid())) {
            return { milliseconds: 0, months: 0 };
        }

        other = cloneWithOffset(other, base);
        if (base.isBefore(other)) {
            res = positiveMomentsDifference(base, other);
        } else {
            res = positiveMomentsDifference(other, base);
            res.milliseconds = -res.milliseconds;
            res.months = -res.months;
        }

        return res;
    }

    // TODO: remove 'name' arg after deprecation is removed
    function createAdder(direction, name) {
        return function (val, period) {
            var dur, tmp;
            //invert the arguments, but complain about it
            if (period !== null && !isNaN(+period)) {
                deprecateSimple(
                    name,
                    'moment().' +
                        name +
                        '(period, number) is deprecated. Please use moment().' +
                        name +
                        '(number, period). ' +
                        'See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info.'
                );
                tmp = val;
                val = period;
                period = tmp;
            }

            dur = createDuration(val, period);
            addSubtract(this, dur, direction);
            return this;
        };
    }

    function addSubtract(mom, duration, isAdding, updateOffset) {
        var milliseconds = duration._milliseconds,
            days = absRound(duration._days),
            months = absRound(duration._months);

        if (!mom.isValid()) {
            // No op
            return;
        }

        updateOffset = updateOffset == null ? true : updateOffset;

        if (months) {
            setMonth(mom, get(mom, 'Month') + months * isAdding);
        }
        if (days) {
            set$1(mom, 'Date', get(mom, 'Date') + days * isAdding);
        }
        if (milliseconds) {
            mom._d.setTime(mom._d.valueOf() + milliseconds * isAdding);
        }
        if (updateOffset) {
            hooks.updateOffset(mom, days || months);
        }
    }

    var add = createAdder(1, 'add'),
        subtract = createAdder(-1, 'subtract');

    function isString(input) {
        return typeof input === 'string' || input instanceof String;
    }

    // type MomentInput = Moment | Date | string | number | (number | string)[] | MomentInputObject | void; // null | undefined
    function isMomentInput(input) {
        return (
            isMoment(input) ||
            isDate(input) ||
            isString(input) ||
            isNumber(input) ||
            isNumberOrStringArray(input) ||
            isMomentInputObject(input) ||
            input === null ||
            input === undefined
        );
    }

    function isMomentInputObject(input) {
        var objectTest = isObject(input) && !isObjectEmpty(input),
            propertyTest = false,
            properties = [
                'years',
                'year',
                'y',
                'months',
                'month',
                'M',
                'days',
                'day',
                'd',
                'dates',
                'date',
                'D',
                'hours',
                'hour',
                'h',
                'minutes',
                'minute',
                'm',
                'seconds',
                'second',
                's',
                'milliseconds',
                'millisecond',
                'ms',
            ],
            i,
            property;

        for (i = 0; i < properties.length; i += 1) {
            property = properties[i];
            propertyTest = propertyTest || hasOwnProp(input, property);
        }

        return objectTest && propertyTest;
    }

    function isNumberOrStringArray(input) {
        var arrayTest = isArray(input),
            dataTypeTest = false;
        if (arrayTest) {
            dataTypeTest =
                input.filter(function (item) {
                    return !isNumber(item) && isString(input);
                }).length === 0;
        }
        return arrayTest && dataTypeTest;
    }

    function isCalendarSpec(input) {
        var objectTest = isObject(input) && !isObjectEmpty(input),
            propertyTest = false,
            properties = [
                'sameDay',
                'nextDay',
                'lastDay',
                'nextWeek',
                'lastWeek',
                'sameElse',
            ],
            i,
            property;

        for (i = 0; i < properties.length; i += 1) {
            property = properties[i];
            propertyTest = propertyTest || hasOwnProp(input, property);
        }

        return objectTest && propertyTest;
    }

    function getCalendarFormat(myMoment, now) {
        var diff = myMoment.diff(now, 'days', true);
        return diff < -6
            ? 'sameElse'
            : diff < -1
            ? 'lastWeek'
            : diff < 0
            ? 'lastDay'
            : diff < 1
            ? 'sameDay'
            : diff < 2
            ? 'nextDay'
            : diff < 7
            ? 'nextWeek'
            : 'sameElse';
    }

    function calendar$1(time, formats) {
        // Support for single parameter, formats only overload to the calendar function
        if (arguments.length === 1) {
            if (isMomentInput(arguments[0])) {
                time = arguments[0];
                formats = undefined;
            } else if (isCalendarSpec(arguments[0])) {
                formats = arguments[0];
                time = undefined;
            }
        }
        // We want to compare the start of today, vs this.
        // Getting start-of-today depends on whether we're local/utc/offset or not.
        var now = time || createLocal(),
            sod = cloneWithOffset(now, this).startOf('day'),
            format = hooks.calendarFormat(this, sod) || 'sameElse',
            output =
                formats &&
                (isFunction(formats[format])
                    ? formats[format].call(this, now)
                    : formats[format]);

        return this.format(
            output || this.localeData().calendar(format, this, createLocal(now))
        );
    }

    function clone() {
        return new Moment(this);
    }

    function isAfter(input, units) {
        var localInput = isMoment(input) ? input : createLocal(input);
        if (!(this.isValid() && localInput.isValid())) {
            return false;
        }
        units = normalizeUnits(units) || 'millisecond';
        if (units === 'millisecond') {
            return this.valueOf() > localInput.valueOf();
        } else {
            return localInput.valueOf() < this.clone().startOf(units).valueOf();
        }
    }

    function isBefore(input, units) {
        var localInput = isMoment(input) ? input : createLocal(input);
        if (!(this.isValid() && localInput.isValid())) {
            return false;
        }
        units = normalizeUnits(units) || 'millisecond';
        if (units === 'millisecond') {
            return this.valueOf() < localInput.valueOf();
        } else {
            return this.clone().endOf(units).valueOf() < localInput.valueOf();
        }
    }

    function isBetween(from, to, units, inclusivity) {
        var localFrom = isMoment(from) ? from : createLocal(from),
            localTo = isMoment(to) ? to : createLocal(to);
        if (!(this.isValid() && localFrom.isValid() && localTo.isValid())) {
            return false;
        }
        inclusivity = inclusivity || '()';
        return (
            (inclusivity[0] === '('
                ? this.isAfter(localFrom, units)
                : !this.isBefore(localFrom, units)) &&
            (inclusivity[1] === ')'
                ? this.isBefore(localTo, units)
                : !this.isAfter(localTo, units))
        );
    }

    function isSame(input, units) {
        var localInput = isMoment(input) ? input : createLocal(input),
            inputMs;
        if (!(this.isValid() && localInput.isValid())) {
            return false;
        }
        units = normalizeUnits(units) || 'millisecond';
        if (units === 'millisecond') {
            return this.valueOf() === localInput.valueOf();
        } else {
            inputMs = localInput.valueOf();
            return (
                this.clone().startOf(units).valueOf() <= inputMs &&
                inputMs <= this.clone().endOf(units).valueOf()
            );
        }
    }

    function isSameOrAfter(input, units) {
        return this.isSame(input, units) || this.isAfter(input, units);
    }

    function isSameOrBefore(input, units) {
        return this.isSame(input, units) || this.isBefore(input, units);
    }

    function diff(input, units, asFloat) {
        var that, zoneDelta, output;

        if (!this.isValid()) {
            return NaN;
        }

        that = cloneWithOffset(input, this);

        if (!that.isValid()) {
            return NaN;
        }

        zoneDelta = (that.utcOffset() - this.utcOffset()) * 6e4;

        units = normalizeUnits(units);

        switch (units) {
            case 'year':
                output = monthDiff(this, that) / 12;
                break;
            case 'month':
                output = monthDiff(this, that);
                break;
            case 'quarter':
                output = monthDiff(this, that) / 3;
                break;
            case 'second':
                output = (this - that) / 1e3;
                break; // 1000
            case 'minute':
                output = (this - that) / 6e4;
                break; // 1000 * 60
            case 'hour':
                output = (this - that) / 36e5;
                break; // 1000 * 60 * 60
            case 'day':
                output = (this - that - zoneDelta) / 864e5;
                break; // 1000 * 60 * 60 * 24, negate dst
            case 'week':
                output = (this - that - zoneDelta) / 6048e5;
                break; // 1000 * 60 * 60 * 24 * 7, negate dst
            default:
                output = this - that;
        }

        return asFloat ? output : absFloor(output);
    }

    function monthDiff(a, b) {
        if (a.date() < b.date()) {
            // end-of-month calculations work correct when the start month has more
            // days than the end month.
            return -monthDiff(b, a);
        }
        // difference in months
        var wholeMonthDiff = (b.year() - a.year()) * 12 + (b.month() - a.month()),
            // b is in (anchor - 1 month, anchor + 1 month)
            anchor = a.clone().add(wholeMonthDiff, 'months'),
            anchor2,
            adjust;

        if (b - anchor < 0) {
            anchor2 = a.clone().add(wholeMonthDiff - 1, 'months');
            // linear across the month
            adjust = (b - anchor) / (anchor - anchor2);
        } else {
            anchor2 = a.clone().add(wholeMonthDiff + 1, 'months');
            // linear across the month
            adjust = (b - anchor) / (anchor2 - anchor);
        }

        //check for negative zero, return zero if negative zero
        return -(wholeMonthDiff + adjust) || 0;
    }

    hooks.defaultFormat = 'YYYY-MM-DDTHH:mm:ssZ';
    hooks.defaultFormatUtc = 'YYYY-MM-DDTHH:mm:ss[Z]';

    function toString() {
        return this.clone().locale('en').format('ddd MMM DD YYYY HH:mm:ss [GMT]ZZ');
    }

    function toISOString(keepOffset) {
        if (!this.isValid()) {
            return null;
        }
        var utc = keepOffset !== true,
            m = utc ? this.clone().utc() : this;
        if (m.year() < 0 || m.year() > 9999) {
            return formatMoment(
                m,
                utc
                    ? 'YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]'
                    : 'YYYYYY-MM-DD[T]HH:mm:ss.SSSZ'
            );
        }
        if (isFunction(Date.prototype.toISOString)) {
            // native implementation is ~50x faster, use it when we can
            if (utc) {
                return this.toDate().toISOString();
            } else {
                return new Date(this.valueOf() + this.utcOffset() * 60 * 1000)
                    .toISOString()
                    .replace('Z', formatMoment(m, 'Z'));
            }
        }
        return formatMoment(
            m,
            utc ? 'YYYY-MM-DD[T]HH:mm:ss.SSS[Z]' : 'YYYY-MM-DD[T]HH:mm:ss.SSSZ'
        );
    }

    /**
     * Return a human readable representation of a moment that can
     * also be evaluated to get a new moment which is the same
     *
     * @link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects
     */
    function inspect() {
        if (!this.isValid()) {
            return 'moment.invalid(/* ' + this._i + ' */)';
        }
        var func = 'moment',
            zone = '',
            prefix,
            year,
            datetime,
            suffix;
        if (!this.isLocal()) {
            func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone';
            zone = 'Z';
        }
        prefix = '[' + func + '("]';
        year = 0 <= this.year() && this.year() <= 9999 ? 'YYYY' : 'YYYYYY';
        datetime = '-MM-DD[T]HH:mm:ss.SSS';
        suffix = zone + '[")]';

        return this.format(prefix + year + datetime + suffix);
    }

    function format(inputString) {
        if (!inputString) {
            inputString = this.isUtc()
                ? hooks.defaultFormatUtc
                : hooks.defaultFormat;
        }
        var output = formatMoment(this, inputString);
        return this.localeData().postformat(output);
    }

    function from(time, withoutSuffix) {
        if (
            this.isValid() &&
            ((isMoment(time) && time.isValid()) || createLocal(time).isValid())
        ) {
            return createDuration({ to: this, from: time })
                .locale(this.locale())
                .humanize(!withoutSuffix);
        } else {
            return this.localeData().invalidDate();
        }
    }

    function fromNow(withoutSuffix) {
        return this.from(createLocal(), withoutSuffix);
    }

    function to(time, withoutSuffix) {
        if (
            this.isValid() &&
            ((isMoment(time) && time.isValid()) || createLocal(time).isValid())
        ) {
            return createDuration({ from: this, to: time })
                .locale(this.locale())
                .humanize(!withoutSuffix);
        } else {
            return this.localeData().invalidDate();
        }
    }

    function toNow(withoutSuffix) {
        return this.to(createLocal(), withoutSuffix);
    }

    // If passed a locale key, it will set the locale for this
    // instance.  Otherwise, it will return the locale configuration
    // variables for this instance.
    function locale(key) {
        var newLocaleData;

        if (key === undefined) {
            return this._locale._abbr;
        } else {
            newLocaleData = getLocale(key);
            if (newLocaleData != null) {
                this._locale = newLocaleData;
            }
            return this;
        }
    }

    var lang = deprecate(
        'moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.',
        function (key) {
            if (key === undefined) {
                return this.localeData();
            } else {
                return this.locale(key);
            }
        }
    );

    function localeData() {
        return this._locale;
    }

    var MS_PER_SECOND = 1000,
        MS_PER_MINUTE = 60 * MS_PER_SECOND,
        MS_PER_HOUR = 60 * MS_PER_MINUTE,
        MS_PER_400_YEARS = (365 * 400 + 97) * 24 * MS_PER_HOUR;

    // actual modulo - handles negative numbers (for dates before 1970):
    function mod$1(dividend, divisor) {
        return ((dividend % divisor) + divisor) % divisor;
    }

    function localStartOfDate(y, m, d) {
        // the date constructor remaps years 0-99 to 1900-1999
        if (y < 100 && y >= 0) {
            // preserve leap years using a full 400 year cycle, then reset
            return new Date(y + 400, m, d) - MS_PER_400_YEARS;
        } else {
            return new Date(y, m, d).valueOf();
        }
    }

    function utcStartOfDate(y, m, d) {
        // Date.UTC remaps years 0-99 to 1900-1999
        if (y < 100 && y >= 0) {
            // preserve leap years using a full 400 year cycle, then reset
            return Date.UTC(y + 400, m, d) - MS_PER_400_YEARS;
        } else {
            return Date.UTC(y, m, d);
        }
    }

    function startOf(units) {
        var time, startOfDate;
        units = normalizeUnits(units);
        if (units === undefined || units === 'millisecond' || !this.isValid()) {
            return this;
        }

        startOfDate = this._isUTC ? utcStartOfDate : localStartOfDate;

        switch (units) {
            case 'year':
                time = startOfDate(this.year(), 0, 1);
                break;
            case 'quarter':
                time = startOfDate(
                    this.year(),
                    this.month() - (this.month() % 3),
                    1
                );
                break;
            case 'month':
                time = startOfDate(this.year(), this.month(), 1);
                break;
            case 'week':
                time = startOfDate(
                    this.year(),
                    this.month(),
                    this.date() - this.weekday()
                );
                break;
            case 'isoWeek':
                time = startOfDate(
                    this.year(),
                    this.month(),
                    this.date() - (this.isoWeekday() - 1)
                );
                break;
            case 'day':
            case 'date':
                time = startOfDate(this.year(), this.month(), this.date());
                break;
            case 'hour':
                time = this._d.valueOf();
                time -= mod$1(
                    time + (this._isUTC ? 0 : this.utcOffset() * MS_PER_MINUTE),
                    MS_PER_HOUR
                );
                break;
            case 'minute':
                time = this._d.valueOf();
                time -= mod$1(time, MS_PER_MINUTE);
                break;
            case 'second':
                time = this._d.valueOf();
                time -= mod$1(time, MS_PER_SECOND);
                break;
        }

        this._d.setTime(time);
        hooks.updateOffset(this, true);
        return this;
    }

    function endOf(units) {
        var time, startOfDate;
        units = normalizeUnits(units);
        if (units === undefined || units === 'millisecond' || !this.isValid()) {
            return this;
        }

        startOfDate = this._isUTC ? utcStartOfDate : localStartOfDate;

        switch (units) {
            case 'year':
                time = startOfDate(this.year() + 1, 0, 1) - 1;
                break;
            case 'quarter':
                time =
                    startOfDate(
                        this.year(),
                        this.month() - (this.month() % 3) + 3,
                        1
                    ) - 1;
                break;
            case 'month':
                time = startOfDate(this.year(), this.month() + 1, 1) - 1;
                break;
            case 'week':
                time =
                    startOfDate(
                        this.year(),
                        this.month(),
                        this.date() - this.weekday() + 7
                    ) - 1;
                break;
            case 'isoWeek':
                time =
                    startOfDate(
                        this.year(),
                        this.month(),
                        this.date() - (this.isoWeekday() - 1) + 7
                    ) - 1;
                break;
            case 'day':
            case 'date':
                time = startOfDate(this.year(), this.month(), this.date() + 1) - 1;
                break;
            case 'hour':
                time = this._d.valueOf();
                time +=
                    MS_PER_HOUR -
                    mod$1(
                        time + (this._isUTC ? 0 : this.utcOffset() * MS_PER_MINUTE),
                        MS_PER_HOUR
                    ) -
                    1;
                break;
            case 'minute':
                time = this._d.valueOf();
                time += MS_PER_MINUTE - mod$1(time, MS_PER_MINUTE) - 1;
                break;
            case 'second':
                time = this._d.valueOf();
                time += MS_PER_SECOND - mod$1(time, MS_PER_SECOND) - 1;
                break;
        }

        this._d.setTime(time);
        hooks.updateOffset(this, true);
        return this;
    }

    function valueOf() {
        return this._d.valueOf() - (this._offset || 0) * 60000;
    }

    function unix() {
        return Math.floor(this.valueOf() / 1000);
    }

    function toDate() {
        return new Date(this.valueOf());
    }

    function toArray() {
        var m = this;
        return [
            m.year(),
            m.month(),
            m.date(),
            m.hour(),
            m.minute(),
            m.second(),
            m.millisecond(),
        ];
    }

    function toObject() {
        var m = this;
        return {
            years: m.year(),
            months: m.month(),
            date: m.date(),
            hours: m.hours(),
            minutes: m.minutes(),
            seconds: m.seconds(),
            milliseconds: m.milliseconds(),
        };
    }

    function toJSON() {
        // new Date(NaN).toJSON() === null
        return this.isValid() ? this.toISOString() : null;
    }

    function isValid$2() {
        return isValid(this);
    }

    function parsingFlags() {
        return extend({}, getParsingFlags(this));
    }

    function invalidAt() {
        return getParsingFlags(this).overflow;
    }

    function creationData() {
        return {
            input: this._i,
            format: this._f,
            locale: this._locale,
            isUTC: this._isUTC,
            strict: this._strict,
        };
    }

    addFormatToken('N', 0, 0, 'eraAbbr');
    addFormatToken('NN', 0, 0, 'eraAbbr');
    addFormatToken('NNN', 0, 0, 'eraAbbr');
    addFormatToken('NNNN', 0, 0, 'eraName');
    addFormatToken('NNNNN', 0, 0, 'eraNarrow');

    addFormatToken('y', ['y', 1], 'yo', 'eraYear');
    addFormatToken('y', ['yy', 2], 0, 'eraYear');
    addFormatToken('y', ['yyy', 3], 0, 'eraYear');
    addFormatToken('y', ['yyyy', 4], 0, 'eraYear');

    addRegexToken('N', matchEraAbbr);
    addRegexToken('NN', matchEraAbbr);
    addRegexToken('NNN', matchEraAbbr);
    addRegexToken('NNNN', matchEraName);
    addRegexToken('NNNNN', matchEraNarrow);

    addParseToken(['N', 'NN', 'NNN', 'NNNN', 'NNNNN'], function (
        input,
        array,
        config,
        token
    ) {
        var era = config._locale.erasParse(input, token, config._strict);
        if (era) {
            getParsingFlags(config).era = era;
        } else {
            getParsingFlags(config).invalidEra = input;
        }
    });

    addRegexToken('y', matchUnsigned);
    addRegexToken('yy', matchUnsigned);
    addRegexToken('yyy', matchUnsigned);
    addRegexToken('yyyy', matchUnsigned);
    addRegexToken('yo', matchEraYearOrdinal);

    addParseToken(['y', 'yy', 'yyy', 'yyyy'], YEAR);
    addParseToken(['yo'], function (input, array, config, token) {
        var match;
        if (config._locale._eraYearOrdinalRegex) {
            match = input.match(config._locale._eraYearOrdinalRegex);
        }

        if (config._locale.eraYearOrdinalParse) {
            array[YEAR] = config._locale.eraYearOrdinalParse(input, match);
        } else {
            array[YEAR] = parseInt(input, 10);
        }
    });

    function localeEras(m, format) {
        var i,
            l,
            date,
            eras = this._eras || getLocale('en')._eras;
        for (i = 0, l = eras.length; i < l; ++i) {
            switch (typeof eras[i].since) {
                case 'string':
                    // truncate time
                    date = hooks(eras[i].since).startOf('day');
                    eras[i].since = date.valueOf();
                    break;
            }

            switch (typeof eras[i].until) {
                case 'undefined':
                    eras[i].until = +Infinity;
                    break;
                case 'string':
                    // truncate time
                    date = hooks(eras[i].until).startOf('day').valueOf();
                    eras[i].until = date.valueOf();
                    break;
            }
        }
        return eras;
    }

    function localeErasParse(eraName, format, strict) {
        var i,
            l,
            eras = this.eras(),
            name,
            abbr,
            narrow;
        eraName = eraName.toUpperCase();

        for (i = 0, l = eras.length; i < l; ++i) {
            name = eras[i].name.toUpperCase();
            abbr = eras[i].abbr.toUpperCase();
            narrow = eras[i].narrow.toUpperCase();

            if (strict) {
                switch (format) {
                    case 'N':
                    case 'NN':
                    case 'NNN':
                        if (abbr === eraName) {
                            return eras[i];
                        }
                        break;

                    case 'NNNN':
                        if (name === eraName) {
                            return eras[i];
                        }
                        break;

                    case 'NNNNN':
                        if (narrow === eraName) {
                            return eras[i];
                        }
                        break;
                }
            } else if ([name, abbr, narrow].indexOf(eraName) >= 0) {
                return eras[i];
            }
        }
    }

    function localeErasConvertYear(era, year) {
        var dir = era.since <= era.until ? +1 : -1;
        if (year === undefined) {
            return hooks(era.since).year();
        } else {
            return hooks(era.since).year() + (year - era.offset) * dir;
        }
    }

    function getEraName() {
        var i,
            l,
            val,
            eras = this.localeData().eras();
        for (i = 0, l = eras.length; i < l; ++i) {
            // truncate time
            val = this.startOf('day').valueOf();

            if (eras[i].since <= val && val <= eras[i].until) {
                return eras[i].name;
            }
            if (eras[i].until <= val && val <= eras[i].since) {
                return eras[i].name;
            }
        }

        return '';
    }

    function getEraNarrow() {
        var i,
            l,
            val,
            eras = this.localeData().eras();
        for (i = 0, l = eras.length; i < l; ++i) {
            // truncate time
            val = this.startOf('day').valueOf();

            if (eras[i].since <= val && val <= eras[i].until) {
                return eras[i].narrow;
            }
            if (eras[i].until <= val && val <= eras[i].since) {
                return eras[i].narrow;
            }
        }

        return '';
    }

    function getEraAbbr() {
        var i,
            l,
            val,
            eras = this.localeData().eras();
        for (i = 0, l = eras.length; i < l; ++i) {
            // truncate time
            val = this.startOf('day').valueOf();

            if (eras[i].since <= val && val <= eras[i].until) {
                return eras[i].abbr;
            }
            if (eras[i].until <= val && val <= eras[i].since) {
                return eras[i].abbr;
            }
        }

        return '';
    }

    function getEraYear() {
        var i,
            l,
            dir,
            val,
            eras = this.localeData().eras();
        for (i = 0, l = eras.length; i < l; ++i) {
            dir = eras[i].since <= eras[i].until ? +1 : -1;

            // truncate time
            val = this.startOf('day').valueOf();

            if (
                (eras[i].since <= val && val <= eras[i].until) ||
                (eras[i].until <= val && val <= eras[i].since)
            ) {
                return (
                    (this.year() - hooks(eras[i].since).year()) * dir +
                    eras[i].offset
                );
            }
        }

        return this.year();
    }

    function erasNameRegex(isStrict) {
        if (!hasOwnProp(this, '_erasNameRegex')) {
            computeErasParse.call(this);
        }
        return isStrict ? this._erasNameRegex : this._erasRegex;
    }

    function erasAbbrRegex(isStrict) {
        if (!hasOwnProp(this, '_erasAbbrRegex')) {
            computeErasParse.call(this);
        }
        return isStrict ? this._erasAbbrRegex : this._erasRegex;
    }

    function erasNarrowRegex(isStrict) {
        if (!hasOwnProp(this, '_erasNarrowRegex')) {
            computeErasParse.call(this);
        }
        return isStrict ? this._erasNarrowRegex : this._erasRegex;
    }

    function matchEraAbbr(isStrict, locale) {
        return locale.erasAbbrRegex(isStrict);
    }

    function matchEraName(isStrict, locale) {
        return locale.erasNameRegex(isStrict);
    }

    function matchEraNarrow(isStrict, locale) {
        return locale.erasNarrowRegex(isStrict);
    }

    function matchEraYearOrdinal(isStrict, locale) {
        return locale._eraYearOrdinalRegex || matchUnsigned;
    }

    function computeErasParse() {
        var abbrPieces = [],
            namePieces = [],
            narrowPieces = [],
            mixedPieces = [],
            i,
            l,
            eras = this.eras();

        for (i = 0, l = eras.length; i < l; ++i) {
            namePieces.push(regexEscape(eras[i].name));
            abbrPieces.push(regexEscape(eras[i].abbr));
            narrowPieces.push(regexEscape(eras[i].narrow));

            mixedPieces.push(regexEscape(eras[i].name));
            mixedPieces.push(regexEscape(eras[i].abbr));
            mixedPieces.push(regexEscape(eras[i].narrow));
        }

        this._erasRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i');
        this._erasNameRegex = new RegExp('^(' + namePieces.join('|') + ')', 'i');
        this._erasAbbrRegex = new RegExp('^(' + abbrPieces.join('|') + ')', 'i');
        this._erasNarrowRegex = new RegExp(
            '^(' + narrowPieces.join('|') + ')',
            'i'
        );
    }

    // FORMATTING

    addFormatToken(0, ['gg', 2], 0, function () {
        return this.weekYear() % 100;
    });

    addFormatToken(0, ['GG', 2], 0, function () {
        return this.isoWeekYear() % 100;
    });

    function addWeekYearFormatToken(token, getter) {
        addFormatToken(0, [token, token.length], 0, getter);
    }

    addWeekYearFormatToken('gggg', 'weekYear');
    addWeekYearFormatToken('ggggg', 'weekYear');
    addWeekYearFormatToken('GGGG', 'isoWeekYear');
    addWeekYearFormatToken('GGGGG', 'isoWeekYear');

    // ALIASES

    addUnitAlias('weekYear', 'gg');
    addUnitAlias('isoWeekYear', 'GG');

    // PRIORITY

    addUnitPriority('weekYear', 1);
    addUnitPriority('isoWeekYear', 1);

    // PARSING

    addRegexToken('G', matchSigned);
    addRegexToken('g', matchSigned);
    addRegexToken('GG', match1to2, match2);
    addRegexToken('gg', match1to2, match2);
    addRegexToken('GGGG', match1to4, match4);
    addRegexToken('gggg', match1to4, match4);
    addRegexToken('GGGGG', match1to6, match6);
    addRegexToken('ggggg', match1to6, match6);

    addWeekParseToken(['gggg', 'ggggg', 'GGGG', 'GGGGG'], function (
        input,
        week,
        config,
        token
    ) {
        week[token.substr(0, 2)] = toInt(input);
    });

    addWeekParseToken(['gg', 'GG'], function (input, week, config, token) {
        week[token] = hooks.parseTwoDigitYear(input);
    });

    // MOMENTS

    function getSetWeekYear(input) {
        return getSetWeekYearHelper.call(
            this,
            input,
            this.week(),
            this.weekday(),
            this.localeData()._week.dow,
            this.localeData()._week.doy
        );
    }

    function getSetISOWeekYear(input) {
        return getSetWeekYearHelper.call(
            this,
            input,
            this.isoWeek(),
            this.isoWeekday(),
            1,
            4
        );
    }

    function getISOWeeksInYear() {
        return weeksInYear(this.year(), 1, 4);
    }

    function getISOWeeksInISOWeekYear() {
        return weeksInYear(this.isoWeekYear(), 1, 4);
    }

    function getWeeksInYear() {
        var weekInfo = this.localeData()._week;
        return weeksInYear(this.year(), weekInfo.dow, weekInfo.doy);
    }

    function getWeeksInWeekYear() {
        var weekInfo = this.localeData()._week;
        return weeksInYear(this.weekYear(), weekInfo.dow, weekInfo.doy);
    }

    function getSetWeekYearHelper(input, week, weekday, dow, doy) {
        var weeksTarget;
        if (input == null) {
            return weekOfYear(this, dow, doy).year;
        } else {
            weeksTarget = weeksInYear(input, dow, doy);
            if (week > weeksTarget) {
                week = weeksTarget;
            }
            return setWeekAll.call(this, input, week, weekday, dow, doy);
        }
    }

    function setWeekAll(weekYear, week, weekday, dow, doy) {
        var dayOfYearData = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy),
            date = createUTCDate(dayOfYearData.year, 0, dayOfYearData.dayOfYear);

        this.year(date.getUTCFullYear());
        this.month(date.getUTCMonth());
        this.date(date.getUTCDate());
        return this;
    }

    // FORMATTING

    addFormatToken('Q', 0, 'Qo', 'quarter');

    // ALIASES

    addUnitAlias('quarter', 'Q');

    // PRIORITY

    addUnitPriority('quarter', 7);

    // PARSING

    addRegexToken('Q', match1);
    addParseToken('Q', function (input, array) {
        array[MONTH] = (toInt(input) - 1) * 3;
    });

    // MOMENTS

    function getSetQuarter(input) {
        return input == null
            ? Math.ceil((this.month() + 1) / 3)
            : this.month((input - 1) * 3 + (this.month() % 3));
    }

    // FORMATTING

    addFormatToken('D', ['DD', 2], 'Do', 'date');

    // ALIASES

    addUnitAlias('date', 'D');

    // PRIORITY
    addUnitPriority('date', 9);

    // PARSING

    addRegexToken('D', match1to2);
    addRegexToken('DD', match1to2, match2);
    addRegexToken('Do', function (isStrict, locale) {
        // TODO: Remove "ordinalParse" fallback in next major release.
        return isStrict
            ? locale._dayOfMonthOrdinalParse || locale._ordinalParse
            : locale._dayOfMonthOrdinalParseLenient;
    });

    addParseToken(['D', 'DD'], DATE);
    addParseToken('Do', function (input, array) {
        array[DATE] = toInt(input.match(match1to2)[0]);
    });

    // MOMENTS

    var getSetDayOfMonth = makeGetSet('Date', true);

    // FORMATTING

    addFormatToken('DDD', ['DDDD', 3], 'DDDo', 'dayOfYear');

    // ALIASES

    addUnitAlias('dayOfYear', 'DDD');

    // PRIORITY
    addUnitPriority('dayOfYear', 4);

    // PARSING

    addRegexToken('DDD', match1to3);
    addRegexToken('DDDD', match3);
    addParseToken(['DDD', 'DDDD'], function (input, array, config) {
        config._dayOfYear = toInt(input);
    });

    // HELPERS

    // MOMENTS

    function getSetDayOfYear(input) {
        var dayOfYear =
            Math.round(
                (this.clone().startOf('day') - this.clone().startOf('year')) / 864e5
            ) + 1;
        return input == null ? dayOfYear : this.add(input - dayOfYear, 'd');
    }

    // FORMATTING

    addFormatToken('m', ['mm', 2], 0, 'minute');

    // ALIASES

    addUnitAlias('minute', 'm');

    // PRIORITY

    addUnitPriority('minute', 14);

    // PARSING

    addRegexToken('m', match1to2);
    addRegexToken('mm', match1to2, match2);
    addParseToken(['m', 'mm'], MINUTE);

    // MOMENTS

    var getSetMinute = makeGetSet('Minutes', false);

    // FORMATTING

    addFormatToken('s', ['ss', 2], 0, 'second');

    // ALIASES

    addUnitAlias('second', 's');

    // PRIORITY

    addUnitPriority('second', 15);

    // PARSING

    addRegexToken('s', match1to2);
    addRegexToken('ss', match1to2, match2);
    addParseToken(['s', 'ss'], SECOND);

    // MOMENTS

    var getSetSecond = makeGetSet('Seconds', false);

    // FORMATTING

    addFormatToken('S', 0, 0, function () {
        return ~~(this.millisecond() / 100);
    });

    addFormatToken(0, ['SS', 2], 0, function () {
        return ~~(this.millisecond() / 10);
    });

    addFormatToken(0, ['SSS', 3], 0, 'millisecond');
    addFormatToken(0, ['SSSS', 4], 0, function () {
        return this.millisecond() * 10;
    });
    addFormatToken(0, ['SSSSS', 5], 0, function () {
        return this.millisecond() * 100;
    });
    addFormatToken(0, ['SSSSSS', 6], 0, function () {
        return this.millisecond() * 1000;
    });
    addFormatToken(0, ['SSSSSSS', 7], 0, function () {
        return this.millisecond() * 10000;
    });
    addFormatToken(0, ['SSSSSSSS', 8], 0, function () {
        return this.millisecond() * 100000;
    });
    addFormatToken(0, ['SSSSSSSSS', 9], 0, function () {
        return this.millisecond() * 1000000;
    });

    // ALIASES

    addUnitAlias('millisecond', 'ms');

    // PRIORITY

    addUnitPriority('millisecond', 16);

    // PARSING

    addRegexToken('S', match1to3, match1);
    addRegexToken('SS', match1to3, match2);
    addRegexToken('SSS', match1to3, match3);

    var token, getSetMillisecond;
    for (token = 'SSSS'; token.length <= 9; token += 'S') {
        addRegexToken(token, matchUnsigned);
    }

    function parseMs(input, array) {
        array[MILLISECOND] = toInt(('0.' + input) * 1000);
    }

    for (token = 'S'; token.length <= 9; token += 'S') {
        addParseToken(token, parseMs);
    }

    getSetMillisecond = makeGetSet('Milliseconds', false);

    // FORMATTING

    addFormatToken('z', 0, 0, 'zoneAbbr');
    addFormatToken('zz', 0, 0, 'zoneName');

    // MOMENTS

    function getZoneAbbr() {
        return this._isUTC ? 'UTC' : '';
    }

    function getZoneName() {
        return this._isUTC ? 'Coordinated Universal Time' : '';
    }

    var proto = Moment.prototype;

    proto.add = add;
    proto.calendar = calendar$1;
    proto.clone = clone;
    proto.diff = diff;
    proto.endOf = endOf;
    proto.format = format;
    proto.from = from;
    proto.fromNow = fromNow;
    proto.to = to;
    proto.toNow = toNow;
    proto.get = stringGet;
    proto.invalidAt = invalidAt;
    proto.isAfter = isAfter;
    proto.isBefore = isBefore;
    proto.isBetween = isBetween;
    proto.isSame = isSame;
    proto.isSameOrAfter = isSameOrAfter;
    proto.isSameOrBefore = isSameOrBefore;
    proto.isValid = isValid$2;
    proto.lang = lang;
    proto.locale = locale;
    proto.localeData = localeData;
    proto.max = prototypeMax;
    proto.min = prototypeMin;
    proto.parsingFlags = parsingFlags;
    proto.set = stringSet;
    proto.startOf = startOf;
    proto.subtract = subtract;
    proto.toArray = toArray;
    proto.toObject = toObject;
    proto.toDate = toDate;
    proto.toISOString = toISOString;
    proto.inspect = inspect;
    if (typeof Symbol !== 'undefined' && Symbol.for != null) {
        proto[Symbol.for('nodejs.util.inspect.custom')] = function () {
            return 'Moment<' + this.format() + '>';
        };
    }
    proto.toJSON = toJSON;
    proto.toString = toString;
    proto.unix = unix;
    proto.valueOf = valueOf;
    proto.creationData = creationData;
    proto.eraName = getEraName;
    proto.eraNarrow = getEraNarrow;
    proto.eraAbbr = getEraAbbr;
    proto.eraYear = getEraYear;
    proto.year = getSetYear;
    proto.isLeapYear = getIsLeapYear;
    proto.weekYear = getSetWeekYear;
    proto.isoWeekYear = getSetISOWeekYear;
    proto.quarter = proto.quarters = getSetQuarter;
    proto.month = getSetMonth;
    proto.daysInMonth = getDaysInMonth;
    proto.week = proto.weeks = getSetWeek;
    proto.isoWeek = proto.isoWeeks = getSetISOWeek;
    proto.weeksInYear = getWeeksInYear;
    proto.weeksInWeekYear = getWeeksInWeekYear;
    proto.isoWeeksInYear = getISOWeeksInYear;
    proto.isoWeeksInISOWeekYear = getISOWeeksInISOWeekYear;
    proto.date = getSetDayOfMonth;
    proto.day = proto.days = getSetDayOfWeek;
    proto.weekday = getSetLocaleDayOfWeek;
    proto.isoWeekday = getSetISODayOfWeek;
    proto.dayOfYear = getSetDayOfYear;
    proto.hour = proto.hours = getSetHour;
    proto.minute = proto.minutes = getSetMinute;
    proto.second = proto.seconds = getSetSecond;
    proto.millisecond = proto.milliseconds = getSetMillisecond;
    proto.utcOffset = getSetOffset;
    proto.utc = setOffsetToUTC;
    proto.local = setOffsetToLocal;
    proto.parseZone = setOffsetToParsedOffset;
    proto.hasAlignedHourOffset = hasAlignedHourOffset;
    proto.isDST = isDaylightSavingTime;
    proto.isLocal = isLocal;
    proto.isUtcOffset = isUtcOffset;
    proto.isUtc = isUtc;
    proto.isUTC = isUtc;
    proto.zoneAbbr = getZoneAbbr;
    proto.zoneName = getZoneName;
    proto.dates = deprecate(
        'dates accessor is deprecated. Use date instead.',
        getSetDayOfMonth
    );
    proto.months = deprecate(
        'months accessor is deprecated. Use month instead',
        getSetMonth
    );
    proto.years = deprecate(
        'years accessor is deprecated. Use year instead',
        getSetYear
    );
    proto.zone = deprecate(
        'moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/',
        getSetZone
    );
    proto.isDSTShifted = deprecate(
        'isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information',
        isDaylightSavingTimeShifted
    );

    function createUnix(input) {
        return createLocal(input * 1000);
    }

    function createInZone() {
        return createLocal.apply(null, arguments).parseZone();
    }

    function preParsePostFormat(string) {
        return string;
    }

    var proto$1 = Locale.prototype;

    proto$1.calendar = calendar;
    proto$1.longDateFormat = longDateFormat;
    proto$1.invalidDate = invalidDate;
    proto$1.ordinal = ordinal;
    proto$1.preparse = preParsePostFormat;
    proto$1.postformat = preParsePostFormat;
    proto$1.relativeTime = relativeTime;
    proto$1.pastFuture = pastFuture;
    proto$1.set = set;
    proto$1.eras = localeEras;
    proto$1.erasParse = localeErasParse;
    proto$1.erasConvertYear = localeErasConvertYear;
    proto$1.erasAbbrRegex = erasAbbrRegex;
    proto$1.erasNameRegex = erasNameRegex;
    proto$1.erasNarrowRegex = erasNarrowRegex;

    proto$1.months = localeMonths;
    proto$1.monthsShort = localeMonthsShort;
    proto$1.monthsParse = localeMonthsParse;
    proto$1.monthsRegex = monthsRegex;
    proto$1.monthsShortRegex = monthsShortRegex;
    proto$1.week = localeWeek;
    proto$1.firstDayOfYear = localeFirstDayOfYear;
    proto$1.firstDayOfWeek = localeFirstDayOfWeek;

    proto$1.weekdays = localeWeekdays;
    proto$1.weekdaysMin = localeWeekdaysMin;
    proto$1.weekdaysShort = localeWeekdaysShort;
    proto$1.weekdaysParse = localeWeekdaysParse;

    proto$1.weekdaysRegex = weekdaysRegex;
    proto$1.weekdaysShortRegex = weekdaysShortRegex;
    proto$1.weekdaysMinRegex = weekdaysMinRegex;

    proto$1.isPM = localeIsPM;
    proto$1.meridiem = localeMeridiem;

    function get$1(format, index, field, setter) {
        var locale = getLocale(),
            utc = createUTC().set(setter, index);
        return locale[field](utc, format);
    }

    function listMonthsImpl(format, index, field) {
        if (isNumber(format)) {
            index = format;
            format = undefined;
        }

        format = format || '';

        if (index != null) {
            return get$1(format, index, field, 'month');
        }

        var i,
            out = [];
        for (i = 0; i < 12; i++) {
            out[i] = get$1(format, i, field, 'month');
        }
        return out;
    }

    // ()
    // (5)
    // (fmt, 5)
    // (fmt)
    // (true)
    // (true, 5)
    // (true, fmt, 5)
    // (true, fmt)
    function listWeekdaysImpl(localeSorted, format, index, field) {
        if (typeof localeSorted === 'boolean') {
            if (isNumber(format)) {
                index = format;
                format = undefined;
            }

            format = format || '';
        } else {
            format = localeSorted;
            index = format;
            localeSorted = false;

            if (isNumber(format)) {
                index = format;
                format = undefined;
            }

            format = format || '';
        }

        var locale = getLocale(),
            shift = localeSorted ? locale._week.dow : 0,
            i,
            out = [];

        if (index != null) {
            return get$1(format, (index + shift) % 7, field, 'day');
        }

        for (i = 0; i < 7; i++) {
            out[i] = get$1(format, (i + shift) % 7, field, 'day');
        }
        return out;
    }

    function listMonths(format, index) {
        return listMonthsImpl(format, index, 'months');
    }

    function listMonthsShort(format, index) {
        return listMonthsImpl(format, index, 'monthsShort');
    }

    function listWeekdays(localeSorted, format, index) {
        return listWeekdaysImpl(localeSorted, format, index, 'weekdays');
    }

    function listWeekdaysShort(localeSorted, format, index) {
        return listWeekdaysImpl(localeSorted, format, index, 'weekdaysShort');
    }

    function listWeekdaysMin(localeSorted, format, index) {
        return listWeekdaysImpl(localeSorted, format, index, 'weekdaysMin');
    }

    getSetGlobalLocale('en', {
        eras: [
            {
                since: '0001-01-01',
                until: +Infinity,
                offset: 1,
                name: 'Anno Domini',
                narrow: 'AD',
                abbr: 'AD',
            },
            {
                since: '0000-12-31',
                until: -Infinity,
                offset: 1,
                name: 'Before Christ',
                narrow: 'BC',
                abbr: 'BC',
            },
        ],
        dayOfMonthOrdinalParse: /\d{1,2}(th|st|nd|rd)/,
        ordinal: function (number) {
            var b = number % 10,
                output =
                    toInt((number % 100) / 10) === 1
                        ? 'th'
                        : b === 1
                        ? 'st'
                        : b === 2
                        ? 'nd'
                        : b === 3
                        ? 'rd'
                        : 'th';
            return number + output;
        },
    });

    // Side effect imports

    hooks.lang = deprecate(
        'moment.lang is deprecated. Use moment.locale instead.',
        getSetGlobalLocale
    );
    hooks.langData = deprecate(
        'moment.langData is deprecated. Use moment.localeData instead.',
        getLocale
    );

    var mathAbs = Math.abs;

    function abs() {
        var data = this._data;

        this._milliseconds = mathAbs(this._milliseconds);
        this._days = mathAbs(this._days);
        this._months = mathAbs(this._months);

        data.milliseconds = mathAbs(data.milliseconds);
        data.seconds = mathAbs(data.seconds);
        data.minutes = mathAbs(data.minutes);
        data.hours = mathAbs(data.hours);
        data.months = mathAbs(data.months);
        data.years = mathAbs(data.years);

        return this;
    }

    function addSubtract$1(duration, input, value, direction) {
        var other = createDuration(input, value);

        duration._milliseconds += direction * other._milliseconds;
        duration._days += direction * other._days;
        duration._months += direction * other._months;

        return duration._bubble();
    }

    // supports only 2.0-style add(1, 's') or add(duration)
    function add$1(input, value) {
        return addSubtract$1(this, input, value, 1);
    }

    // supports only 2.0-style subtract(1, 's') or subtract(duration)
    function subtract$1(input, value) {
        return addSubtract$1(this, input, value, -1);
    }

    function absCeil(number) {
        if (number < 0) {
            return Math.floor(number);
        } else {
            return Math.ceil(number);
        }
    }

    function bubble() {
        var milliseconds = this._milliseconds,
            days = this._days,
            months = this._months,
            data = this._data,
            seconds,
            minutes,
            hours,
            years,
            monthsFromDays;

        // if we have a mix of positive and negative values, bubble down first
        // check: https://github.com/moment/moment/issues/2166
        if (
            !(
                (milliseconds >= 0 && days >= 0 && months >= 0) ||
                (milliseconds <= 0 && days <= 0 && months <= 0)
            )
        ) {
            milliseconds += absCeil(monthsToDays(months) + days) * 864e5;
            days = 0;
            months = 0;
        }

        // The following code bubbles up values, see the tests for
        // examples of what that means.
        data.milliseconds = milliseconds % 1000;

        seconds = absFloor(milliseconds / 1000);
        data.seconds = seconds % 60;

        minutes = absFloor(seconds / 60);
        data.minutes = minutes % 60;

        hours = absFloor(minutes / 60);
        data.hours = hours % 24;

        days += absFloor(hours / 24);

        // convert days to months
        monthsFromDays = absFloor(daysToMonths(days));
        months += monthsFromDays;
        days -= absCeil(monthsToDays(monthsFromDays));

        // 12 months -> 1 year
        years = absFloor(months / 12);
        months %= 12;

        data.days = days;
        data.months = months;
        data.years = years;

        return this;
    }

    function daysToMonths(days) {
        // 400 years have 146097 days (taking into account leap year rules)
        // 400 years have 12 months === 4800
        return (days * 4800) / 146097;
    }

    function monthsToDays(months) {
        // the reverse of daysToMonths
        return (months * 146097) / 4800;
    }

    function as(units) {
        if (!this.isValid()) {
            return NaN;
        }
        var days,
            months,
            milliseconds = this._milliseconds;

        units = normalizeUnits(units);

        if (units === 'month' || units === 'quarter' || units === 'year') {
            days = this._days + milliseconds / 864e5;
            months = this._months + daysToMonths(days);
            switch (units) {
                case 'month':
                    return months;
                case 'quarter':
                    return months / 3;
                case 'year':
                    return months / 12;
            }
        } else {
            // handle milliseconds separately because of floating point math errors (issue #1867)
            days = this._days + Math.round(monthsToDays(this._months));
            switch (units) {
                case 'week':
                    return days / 7 + milliseconds / 6048e5;
                case 'day':
                    return days + milliseconds / 864e5;
                case 'hour':
                    return days * 24 + milliseconds / 36e5;
                case 'minute':
                    return days * 1440 + milliseconds / 6e4;
                case 'second':
                    return days * 86400 + milliseconds / 1000;
                // Math.floor prevents floating point math errors here
                case 'millisecond':
                    return Math.floor(days * 864e5) + milliseconds;
                default:
                    throw new Error('Unknown unit ' + units);
            }
        }
    }

    // TODO: Use this.as('ms')?
    function valueOf$1() {
        if (!this.isValid()) {
            return NaN;
        }
        return (
            this._milliseconds +
            this._days * 864e5 +
            (this._months % 12) * 2592e6 +
            toInt(this._months / 12) * 31536e6
        );
    }

    function makeAs(alias) {
        return function () {
            return this.as(alias);
        };
    }

    var asMilliseconds = makeAs('ms'),
        asSeconds = makeAs('s'),
        asMinutes = makeAs('m'),
        asHours = makeAs('h'),
        asDays = makeAs('d'),
        asWeeks = makeAs('w'),
        asMonths = makeAs('M'),
        asQuarters = makeAs('Q'),
        asYears = makeAs('y');

    function clone$1() {
        return createDuration(this);
    }

    function get$2(units) {
        units = normalizeUnits(units);
        return this.isValid() ? this[units + 's']() : NaN;
    }

    function makeGetter(name) {
        return function () {
            return this.isValid() ? this._data[name] : NaN;
        };
    }

    var milliseconds = makeGetter('milliseconds'),
        seconds = makeGetter('seconds'),
        minutes = makeGetter('minutes'),
        hours = makeGetter('hours'),
        days = makeGetter('days'),
        months = makeGetter('months'),
        years = makeGetter('years');

    function weeks() {
        return absFloor(this.days() / 7);
    }

    var round = Math.round,
        thresholds = {
            ss: 44, // a few seconds to seconds
            s: 45, // seconds to minute
            m: 45, // minutes to hour
            h: 22, // hours to day
            d: 26, // days to month/week
            w: null, // weeks to month
            M: 11, // months to year
        };

    // helper function for moment.fn.from, moment.fn.fromNow, and moment.duration.fn.humanize
    function substituteTimeAgo(string, number, withoutSuffix, isFuture, locale) {
        return locale.relativeTime(number || 1, !!withoutSuffix, string, isFuture);
    }

    function relativeTime$1(posNegDuration, withoutSuffix, thresholds, locale) {
        var duration = createDuration(posNegDuration).abs(),
            seconds = round(duration.as('s')),
            minutes = round(duration.as('m')),
            hours = round(duration.as('h')),
            days = round(duration.as('d')),
            months = round(duration.as('M')),
            weeks = round(duration.as('w')),
            years = round(duration.as('y')),
            a =
                (seconds <= thresholds.ss && ['s', seconds]) ||
                (seconds < thresholds.s && ['ss', seconds]) ||
                (minutes <= 1 && ['m']) ||
                (minutes < thresholds.m && ['mm', minutes]) ||
                (hours <= 1 && ['h']) ||
                (hours < thresholds.h && ['hh', hours]) ||
                (days <= 1 && ['d']) ||
                (days < thresholds.d && ['dd', days]);

        if (thresholds.w != null) {
            a =
                a ||
                (weeks <= 1 && ['w']) ||
                (weeks < thresholds.w && ['ww', weeks]);
        }
        a = a ||
            (months <= 1 && ['M']) ||
            (months < thresholds.M && ['MM', months]) ||
            (years <= 1 && ['y']) || ['yy', years];

        a[2] = withoutSuffix;
        a[3] = +posNegDuration > 0;
        a[4] = locale;
        return substituteTimeAgo.apply(null, a);
    }

    // This function allows you to set the rounding function for relative time strings
    function getSetRelativeTimeRounding(roundingFunction) {
        if (roundingFunction === undefined) {
            return round;
        }
        if (typeof roundingFunction === 'function') {
            round = roundingFunction;
            return true;
        }
        return false;
    }

    // This function allows you to set a threshold for relative time strings
    function getSetRelativeTimeThreshold(threshold, limit) {
        if (thresholds[threshold] === undefined) {
            return false;
        }
        if (limit === undefined) {
            return thresholds[threshold];
        }
        thresholds[threshold] = limit;
        if (threshold === 's') {
            thresholds.ss = limit - 1;
        }
        return true;
    }

    function humanize(argWithSuffix, argThresholds) {
        if (!this.isValid()) {
            return this.localeData().invalidDate();
        }

        var withSuffix = false,
            th = thresholds,
            locale,
            output;

        if (typeof argWithSuffix === 'object') {
            argThresholds = argWithSuffix;
            argWithSuffix = false;
        }
        if (typeof argWithSuffix === 'boolean') {
            withSuffix = argWithSuffix;
        }
        if (typeof argThresholds === 'object') {
            th = Object.assign({}, thresholds, argThresholds);
            if (argThresholds.s != null && argThresholds.ss == null) {
                th.ss = argThresholds.s - 1;
            }
        }

        locale = this.localeData();
        output = relativeTime$1(this, !withSuffix, th, locale);

        if (withSuffix) {
            output = locale.pastFuture(+this, output);
        }

        return locale.postformat(output);
    }

    var abs$1 = Math.abs;

    function sign(x) {
        return (x > 0) - (x < 0) || +x;
    }

    function toISOString$1() {
        // for ISO strings we do not use the normal bubbling rules:
        //  * milliseconds bubble up until they become hours
        //  * days do not bubble at all
        //  * months bubble up until they become years
        // This is because there is no context-free conversion between hours and days
        // (think of clock changes)
        // and also not between days and months (28-31 days per month)
        if (!this.isValid()) {
            return this.localeData().invalidDate();
        }

        var seconds = abs$1(this._milliseconds) / 1000,
            days = abs$1(this._days),
            months = abs$1(this._months),
            minutes,
            hours,
            years,
            s,
            total = this.asSeconds(),
            totalSign,
            ymSign,
            daysSign,
            hmsSign;

        if (!total) {
            // this is the same as C#'s (Noda) and python (isodate)...
            // but not other JS (goog.date)
            return 'P0D';
        }

        // 3600 seconds -> 60 minutes -> 1 hour
        minutes = absFloor(seconds / 60);
        hours = absFloor(minutes / 60);
        seconds %= 60;
        minutes %= 60;

        // 12 months -> 1 year
        years = absFloor(months / 12);
        months %= 12;

        // inspired by https://github.com/dordille/moment-isoduration/blob/master/moment.isoduration.js
        s = seconds ? seconds.toFixed(3).replace(/\.?0+$/, '') : '';

        totalSign = total < 0 ? '-' : '';
        ymSign = sign(this._months) !== sign(total) ? '-' : '';
        daysSign = sign(this._days) !== sign(total) ? '-' : '';
        hmsSign = sign(this._milliseconds) !== sign(total) ? '-' : '';

        return (
            totalSign +
            'P' +
            (years ? ymSign + years + 'Y' : '') +
            (months ? ymSign + months + 'M' : '') +
            (days ? daysSign + days + 'D' : '') +
            (hours || minutes || seconds ? 'T' : '') +
            (hours ? hmsSign + hours + 'H' : '') +
            (minutes ? hmsSign + minutes + 'M' : '') +
            (seconds ? hmsSign + s + 'S' : '')
        );
    }

    var proto$2 = Duration.prototype;

    proto$2.isValid = isValid$1;
    proto$2.abs = abs;
    proto$2.add = add$1;
    proto$2.subtract = subtract$1;
    proto$2.as = as;
    proto$2.asMilliseconds = asMilliseconds;
    proto$2.asSeconds = asSeconds;
    proto$2.asMinutes = asMinutes;
    proto$2.asHours = asHours;
    proto$2.asDays = asDays;
    proto$2.asWeeks = asWeeks;
    proto$2.asMonths = asMonths;
    proto$2.asQuarters = asQuarters;
    proto$2.asYears = asYears;
    proto$2.valueOf = valueOf$1;
    proto$2._bubble = bubble;
    proto$2.clone = clone$1;
    proto$2.get = get$2;
    proto$2.milliseconds = milliseconds;
    proto$2.seconds = seconds;
    proto$2.minutes = minutes;
    proto$2.hours = hours;
    proto$2.days = days;
    proto$2.weeks = weeks;
    proto$2.months = months;
    proto$2.years = years;
    proto$2.humanize = humanize;
    proto$2.toISOString = toISOString$1;
    proto$2.toString = toISOString$1;
    proto$2.toJSON = toISOString$1;
    proto$2.locale = locale;
    proto$2.localeData = localeData;

    proto$2.toIsoString = deprecate(
        'toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)',
        toISOString$1
    );
    proto$2.lang = lang;

    // FORMATTING

    addFormatToken('X', 0, 0, 'unix');
    addFormatToken('x', 0, 0, 'valueOf');

    // PARSING

    addRegexToken('x', matchSigned);
    addRegexToken('X', matchTimestamp);
    addParseToken('X', function (input, array, config) {
        config._d = new Date(parseFloat(input) * 1000);
    });
    addParseToken('x', function (input, array, config) {
        config._d = new Date(toInt(input));
    });

    //! moment.js

    hooks.version = '2.27.0';

    setHookCallback(createLocal);

    hooks.fn = proto;
    hooks.min = min;
    hooks.max = max;
    hooks.now = now;
    hooks.utc = createUTC;
    hooks.unix = createUnix;
    hooks.months = listMonths;
    hooks.isDate = isDate;
    hooks.locale = getSetGlobalLocale;
    hooks.invalid = createInvalid;
    hooks.duration = createDuration;
    hooks.isMoment = isMoment;
    hooks.weekdays = listWeekdays;
    hooks.parseZone = createInZone;
    hooks.localeData = getLocale;
    hooks.isDuration = isDuration;
    hooks.monthsShort = listMonthsShort;
    hooks.weekdaysMin = listWeekdaysMin;
    hooks.defineLocale = defineLocale;
    hooks.updateLocale = updateLocale;
    hooks.locales = listLocales;
    hooks.weekdaysShort = listWeekdaysShort;
    hooks.normalizeUnits = normalizeUnits;
    hooks.relativeTimeRounding = getSetRelativeTimeRounding;
    hooks.relativeTimeThreshold = getSetRelativeTimeThreshold;
    hooks.calendarFormat = getCalendarFormat;
    hooks.prototype = proto;

    // currently HTML5 input type only supports 24-hour formats
    hooks.HTML5_FMT = {
        DATETIME_LOCAL: 'YYYY-MM-DDTHH:mm', // <input type="datetime-local" />
        DATETIME_LOCAL_SECONDS: 'YYYY-MM-DDTHH:mm:ss', // <input type="datetime-local" step="1" />
        DATETIME_LOCAL_MS: 'YYYY-MM-DDTHH:mm:ss.SSS', // <input type="datetime-local" step="0.001" />
        DATE: 'YYYY-MM-DD', // <input type="date" />
        TIME: 'HH:mm', // <input type="time" />
        TIME_SECONDS: 'HH:mm:ss', // <input type="time" step="1" />
        TIME_MS: 'HH:mm:ss.SSS', // <input type="time" step="0.001" />
        WEEK: 'GGGG-[W]WW', // <input type="week" />
        MONTH: 'YYYY-MM', // <input type="month" />
    };

    return hooks;

})));

/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(18)(module)))

/***/ }),
/* 12 */
/***/ (function(module, exports) {

var g;

// This works in non-strict mode
g = (function() {
	return this;
})();

try {
	// This works if eval is allowed (see CSP)
	g = g || new Function("return this")();
} catch (e) {
	// This works if the window reference is available
	if (typeof window === "object") g = window;
}

// g can still be undefined, but nothing to do about it...
// We return undefined, instead of nothing here, so it's
// easier to handle this case. if(!global) { ...}

module.exports = g;


/***/ }),
/* 13 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var __assign = (this && this.__assign) || function () {
    __assign = Object.assign || function(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);
};
var __awaiter = (this && this.__awaiter) || function (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());
    });
};
var __generator = (this && this.__generator) || function (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 };
    }
};
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.SaveModule = void 0;
var ramda_1 = __webpack_require__(4);
var moment_1 = __importDefault(__webpack_require__(11));
var RuqESModule_1 = __webpack_require__(6);
var modules_1 = __webpack_require__(9);
var config_1 = __webpack_require__(7);
var common_1 = __webpack_require__(0);
var selectors_1 = __webpack_require__(5);
var styles_1 = __webpack_require__(3);
var renderSavedPost_1 = __webpack_require__(68);
var renderSavedComment_1 = __webpack_require__(69);
var savePostText = 'Save';
var savedPostText = 'Saved';
var saveIconClasses = 'fas fa-save';
var savedIconClasses = 'fal fa-save';
var SaveModule = /** @class */ (function (_super) {
    __extends(SaveModule, _super);
    function SaveModule() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    SaveModule.prototype.onSavePostButtonClick = function (el, info) {
        return __awaiter(this, void 0, void 0, function () {
            var cfg, newCfg, updateSavedPostsInConfig;
            return __generator(this, function (_a) {
                switch (_a.label) {
                    case 0:
                        common_1.debugLog('onSavePostButtonClick', { el: el, info: info });
                        return [4 /*yield*/, config_1.readConfig()];
                    case 1:
                        cfg = _a.sent();
                        updateSavedPostsInConfig = function (cfg) { return function (over) { return (__assign(__assign({}, cfg), { save: __assign(__assign({}, cfg.save), { posts: over(cfg.save.posts) }) })); }; };
                        if (cfg.save.posts.find(function (x) { return x.id === info.id; })) {
                            newCfg = updateSavedPostsInConfig(cfg)(ramda_1.filter(function (x) { return x.id !== info.id; }));
                            SaveModule.setSaveButtonState(el, false);
                        }
                        else {
                            newCfg = updateSavedPostsInConfig(cfg)(ramda_1.append(SaveModule.convertPostInfoToPostSave(info)));
                            SaveModule.setSaveButtonState(el, true);
                        }
                        return [4 /*yield*/, config_1.writeConfig(newCfg)];
                    case 2:
                        _a.sent();
                        return [2 /*return*/];
                }
            });
        });
    };
    SaveModule.prototype.onSaveCommentButtonClick = function (el, info) {
        return __awaiter(this, void 0, void 0, function () {
            var cfg, newCfg, updateSavedCommentsInConfig;
            return __generator(this, function (_a) {
                switch (_a.label) {
                    case 0:
                        common_1.debugLog('onSaveCommentButtonClick', { el: el, info: info });
                        return [4 /*yield*/, config_1.readConfig()];
                    case 1:
                        cfg = _a.sent();
                        updateSavedCommentsInConfig = function (cfg) { return function (over) { return (__assign(__assign({}, cfg), { save: __assign(__assign({}, cfg.save), { comments: over(cfg.save.comments) }) })); }; };
                        if (cfg.save.comments.find(function (x) { return x.id === info.id; })) {
                            newCfg = updateSavedCommentsInConfig(cfg)(ramda_1.filter(function (x) { return x.id !== info.id; }));
                            SaveModule.setSaveButtonState(el, false);
                        }
                        else {
                            newCfg = updateSavedCommentsInConfig(cfg)(ramda_1.append(info));
                            SaveModule.setSaveButtonState(el, true);
                        }
                        return [4 /*yield*/, config_1.writeConfig(newCfg)];
                    case 2:
                        _a.sent();
                        return [2 /*return*/];
                }
            });
        });
    };
    SaveModule.convertPostInfoToPostSave = function (info) {
        return {
            title: info.title,
            author: info.author,
            guild: info.guild,
            id: info.id,
            nsfw: info.nsfw,
            url: info.url,
            link: info.link,
            thumbnail: info.thumbnail,
            date: info.date,
            dateRelative: info.dateRelative,
            dateRaw: info.dateRaw,
            previewModal: info.previewModal,
            savedOn: moment_1.default().toISOString(),
        };
    };
    SaveModule.convertCommentInfoToCommentSave = function (info) {
        if (info.id === null || info.author === null || info.link === null || info.text === null) {
            return null;
        }
        return {
            id: info.id,
            author: info.author,
            link: info.link,
            text: info.text,
            savedOn: moment_1.default().toISOString(),
        };
    };
    SaveModule.setSaveButtonState = function (el, alreadySaved) {
        el.text(alreadySaved ? savedPostText : savePostText);
        var icon = $('<i>').addClass('mr-2').addClass(alreadySaved ? savedIconClasses : saveIconClasses);
        el.prepend(icon);
    };
    SaveModule.prototype.setupSavePostActions = function (cfg) {
        var _this = this;
        selectors_1.getPosts()
            .each(function (_, rawEl) {
            var el = $(rawEl);
            if (el.hasClass(styles_1.savePostProcessedCls))
                return;
            el.addClass(styles_1.savePostProcessedCls);
            var info = common_1.extractPostInfo(el);
            var alreadySaved = cfg.save.posts.find(function (x) { return x.id === info.id; }) !== undefined;
            var btn = common_1.genJsAnchor();
            btn.click(function (evt) { _this.onSavePostButtonClick($(evt.target), info); });
            SaveModule.setSaveButtonState(btn, alreadySaved);
            selectors_1.getPostActionsListOnDesktop(el).last().append($('<li>').addClass('list-inline-item').html(btn));
            var mobilePostActions = selectors_1.getPostActionsListOnMobile(el);
            var shareActionOnMobile = mobilePostActions.find('i.fa-link');
            var mobileListItem = $('<li>').addClass('list-inline-item').html(btn.clone(true));
            if (shareActionOnMobile.length) {
                shareActionOnMobile.parent().parent().after(mobileListItem);
            }
            else {
                mobilePostActions.append(mobileListItem);
            }
        });
    };
    SaveModule.prototype.setupSaveCommentActions = function (cfg) {
        var _this = this;
        selectors_1.getComments()
            .filter(function (_, rawEl) { return !$(rawEl).hasClass(styles_1.saveCommentProcessedCls); })
            .each(function (_, rawEl) {
            var el = $(rawEl);
            el.addClass(styles_1.saveCommentProcessedCls);
            var info = common_1.extractCommentInfo(el);
            var alreadySaved = cfg.save.comments.find(function (x) { return x.id === info.id; }) !== undefined;
            var btn = common_1.genJsAnchor();
            var saveData = SaveModule.convertCommentInfoToCommentSave(info);
            if (saveData === null) {
                return;
            }
            btn.click(function (evt) { _this.onSaveCommentButtonClick($(evt.target), saveData); });
            SaveModule.setSaveButtonState(btn, alreadySaved);
            var actionsList = selectors_1.getCommentActionsList(el);
            var actionDesktopEl = $('<li>').addClass('list-inline-item d-none d-md-inline-block').html(btn);
            var actionDotsDesktop = actionsList.find('li.d-none .fa-ellipsis-h');
            if (actionDotsDesktop.length) {
                actionDotsDesktop.parent().parent().parent().before(actionDesktopEl);
            }
            else {
                actionsList.append(actionDesktopEl);
            }
            var actionMobileEl = $('<li>').addClass('list-inline-item d-inline-block d-md-none').html(btn.clone(true));
            var actionDotsOnMobile = actionsList.find('li.d-md-none .fa-ellipsis-h');
            if (actionDotsOnMobile.length) {
                actionDotsOnMobile.parent().parent().before(actionMobileEl);
            }
            else {
                actionsList.append(actionMobileEl);
            }
        });
    };
    SaveModule.prototype.setupMainMenuButton = function () {
        var text = 'Saved';
        var iconClasses = 'fas fa-save';
        var path = 'saved';
        var desktopButton = common_1.createMainMenuButtonForDesktop(text, common_1.genRuqESUrl(path), common_1.genNavigateToRuqESUrl(path), iconClasses);
        var mobileButton = common_1.createMainMenuButtonForMobile(text, common_1.genRuqESUrl(path), common_1.genNavigateToRuqESUrl(path), iconClasses);
        $('#navbar #navbarResponsive > ul > li:last-child a > i.fa-inbox').parent().after(desktopButton);
        $('#navbarResponsive > ul:last-child a > i.fa-envelope').parent().after(mobileButton);
    };
    SaveModule.prototype.genEmptySaves = function () {
        var btn = common_1.genJsAnchor();
        SaveModule.setSaveButtonState(btn, false);
        var html = "\n<span class=\"fa-stack fa-2x text-muted mb-4\">\n  <i class=\"fas fa-square text-gray-500 opacity-25 fa-stack-2x\"></i>\n  <i class=\"fas text-gray-500 fa-ghost fa-stack-1x text-lg\"></i>\n</span>\n<h2 class=\"h5\">Save your first piece of content!</h2>\n<p class=\"text-muted\">Don't know how?<br>Just click on \"<span class=\"" + styles_1.saveEmptySavesButtonPlaceholderCls + "\"></span>\" on a post or a comment.</p>\n    ";
        var el = $('<div>').html(html).addClass('text-center mt-4');
        common_1.$c(styles_1.saveEmptySavesButtonPlaceholderCls, el).html(btn);
        return el;
    };
    SaveModule.prototype.setupSavedPage = function (cfg) {
        return __awaiter(this, void 0, void 0, function () {
            var page, caption, tabs, commentsInnerContainer, comments, postsInnerContainer, posts, setActiveTab;
            return __generator(this, function (_a) {
                switch (_a.label) {
                    case 0:
                        page = $('<div>').addClass('mt-2');
                        caption = $('<div>')
                            .addClass('font-weight-bold text-muted')
                            .addClass('card d-flex justify-content-center align-items-center flex-row p-1 mt-0 mt-md-4 mb-0 mb-md-2')
                            .append($('<h2>').text('Saved content').addClass('mx-0 my-1'))
                            .append(common_1.createRuqesMark().addClass(styles_1.nonAggressiveCls).addClass('ml-2'));
                        page.append(caption);
                        tabs = $("\n      <div class=\"btn-group w-100 mt-1\">\n        <button type=\"button\" class=\"btn btn-primary " + styles_1.saveTabButtonPostsCls + "\">Posts</button>\n        <button type=\"button\" class=\"btn btn-primary " + styles_1.saveTabButtonCommentsCls + "\">Comments</button>\n      </div>\n    ");
                        page.append(tabs);
                        commentsInnerContainer = $('<div>').addClass('card px-2 pb-2');
                        ramda_1.pipe(function (x) { return ramda_1.reverse(x); }, ramda_1.map(renderSavedComment_1.renderSavedComment))(cfg.save.comments).forEach(function (x) { return commentsInnerContainer.append(x); });
                        if (ramda_1.isEmpty(cfg.save.comments)) {
                            commentsInnerContainer.append(this.genEmptySaves());
                        }
                        comments = $('<div>')
                            .addClass(['row no-gutters mt-md-3', styles_1.saveCommentsContainerCls])
                            .append($('<div>').addClass('col-12').append(commentsInnerContainer));
                        page.append(comments);
                        postsInnerContainer = $('<div>').addClass('posts');
                        ramda_1.pipe(function (x) { return ramda_1.reverse(x); }, ramda_1.map(renderSavedPost_1.renderSavedPost))(cfg.save.posts).forEach(function (x) { return postsInnerContainer.append(x); });
                        if (ramda_1.isEmpty(cfg.save.posts)) {
                            postsInnerContainer.append(this.genEmptySaves());
                        }
                        posts = $('<div>')
                            .addClass(['row no-gutters mt-md-3', styles_1.savePostsContainerCls])
                            .append($('<div>').addClass('col-12').append(postsInnerContainer));
                        page.append(posts);
                        setActiveTab = function (tabName) {
                            common_1.debugLog('setActiveTab', tabName);
                            common_1.setClass(common_1.$c(styles_1.saveTabButtonPostsCls), 'active', tabName === 'posts');
                            common_1.setClass(common_1.$c(styles_1.saveTabButtonCommentsCls), 'active', tabName === 'comments');
                            common_1.setClass(common_1.$c(styles_1.savePostsContainerCls), 'd-none', tabName !== 'posts');
                            common_1.setClass(common_1.$c(styles_1.saveCommentsContainerCls), 'd-none', tabName !== 'comments');
                        };
                        page.find("." + styles_1.saveTabButtonPostsCls).on('click', function () { return setActiveTab('posts'); });
                        page.find("." + styles_1.saveTabButtonCommentsCls).on('click', function () { return setActiveTab('comments'); });
                        common_1.$i('main-content-col').html(page);
                        setActiveTab('posts');
                        $('body').css({ paddingTop: '42px' });
                        return [4 /*yield*/, modules_1.handleModulesAfterContentChange()];
                    case 1:
                        _a.sent();
                        return [2 /*return*/];
                }
            });
        });
    };
    SaveModule.isOnSavedPage = function () { return common_1.isOnRuqESUrl('saved'); };
    SaveModule.prototype.setup = function (args, cfg) {
        return __awaiter(this, void 0, void 0, function () {
            var saveCfg;
            return __generator(this, function (_a) {
                switch (_a.label) {
                    case 0:
                        saveCfg = cfg.save;
                        if (ramda_1.prop('silent', args || {})) {
                            common_1.debugLog('SaveModule', saveCfg);
                        }
                        if (!cfg.save.enabled) {
                            return [2 /*return*/];
                        }
                        if (!this.firstSetupRunFinished) {
                            this.setupMainMenuButton();
                        }
                        if (!(SaveModule.isOnSavedPage() && !this.firstSetupRunFinished)) return [3 /*break*/, 2];
                        return [4 /*yield*/, this.setupSavedPage(cfg)];
                    case 1:
                        _a.sent();
                        _a.label = 2;
                    case 2:
                        if (cfg.save.postSavingEnabled) {
                            this.setupSavePostActions(cfg);
                        }
                        if (cfg.save.commentSavingEnabled) {
                            this.setupSaveCommentActions(cfg);
                        }
                        return [2 /*return*/];
                }
            });
        });
    };
    SaveModule.prototype.onContentChange = function (args, cfg) {
        return __awaiter(this, void 0, void 0, function () {
            return __generator(this, function (_a) {
                return [2 /*return*/, this.setup(args, cfg)];
            });
        });
    };
    return SaveModule;
}(RuqESModule_1.RuqESModule));
exports.SaveModule = SaveModule;


/***/ }),
/* 14 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.decodeHTML = exports.decodeHTMLStrict = exports.decodeXML = void 0;
var entities_json_1 = __importDefault(__webpack_require__(15));
var legacy_json_1 = __importDefault(__webpack_require__(29));
var xml_json_1 = __importDefault(__webpack_require__(16));
var decode_codepoint_1 = __importDefault(__webpack_require__(30));
exports.decodeXML = getStrictDecoder(xml_json_1.default);
exports.decodeHTMLStrict = getStrictDecoder(entities_json_1.default);
function getStrictDecoder(map) {
    var keys = Object.keys(map).join("|");
    var replace = getReplacer(map);
    keys += "|#[xX][\\da-fA-F]+|#\\d+";
    var re = new RegExp("&(?:" + keys + ");", "g");
    return function (str) { return String(str).replace(re, replace); };
}
var sorter = function (a, b) { return (a < b ? 1 : -1); };
exports.decodeHTML = (function () {
    var legacy = Object.keys(legacy_json_1.default).sort(sorter);
    var keys = Object.keys(entities_json_1.default).sort(sorter);
    for (var i = 0, j = 0; i < keys.length; i++) {
        if (legacy[j] === keys[i]) {
            keys[i] += ";?";
            j++;
        }
        else {
            keys[i] += ";";
        }
    }
    var re = new RegExp("&(?:" + keys.join("|") + "|#[xX][\\da-fA-F]+;?|#\\d+;?)", "g");
    var replace = getReplacer(entities_json_1.default);
    function replacer(str) {
        if (str.substr(-1) !== ";")
            str += ";";
        return replace(str);
    }
    //TODO consider creating a merged map
    return function (str) { return String(str).replace(re, replacer); };
})();
function getReplacer(map) {
    return function replace(str) {
        if (str.charAt(1) === "#") {
            var secondChar = str.charAt(2);
            if (secondChar === "X" || secondChar === "x") {
                return decode_codepoint_1.default(parseInt(str.substr(3), 16));
            }
            return decode_codepoint_1.default(parseInt(str.substr(2), 10));
        }
        return map[str.slice(1, -1)];
    };
}


/***/ }),
/* 15 */
/***/ (function(module) {

module.exports = JSON.parse("{\"Aacute\":\"Á\",\"aacute\":\"á\",\"Abreve\":\"Ă\",\"abreve\":\"ă\",\"ac\":\"∾\",\"acd\":\"∿\",\"acE\":\"∾̳\",\"Acirc\":\"Â\",\"acirc\":\"â\",\"acute\":\"´\",\"Acy\":\"А\",\"acy\":\"а\",\"AElig\":\"Æ\",\"aelig\":\"æ\",\"af\":\"⁡\",\"Afr\":\"𝔄\",\"afr\":\"𝔞\",\"Agrave\":\"À\",\"agrave\":\"à\",\"alefsym\":\"ℵ\",\"aleph\":\"ℵ\",\"Alpha\":\"Α\",\"alpha\":\"α\",\"Amacr\":\"Ā\",\"amacr\":\"ā\",\"amalg\":\"⨿\",\"amp\":\"&\",\"AMP\":\"&\",\"andand\":\"⩕\",\"And\":\"⩓\",\"and\":\"∧\",\"andd\":\"⩜\",\"andslope\":\"⩘\",\"andv\":\"⩚\",\"ang\":\"∠\",\"ange\":\"⦤\",\"angle\":\"∠\",\"angmsdaa\":\"⦨\",\"angmsdab\":\"⦩\",\"angmsdac\":\"⦪\",\"angmsdad\":\"⦫\",\"angmsdae\":\"⦬\",\"angmsdaf\":\"⦭\",\"angmsdag\":\"⦮\",\"angmsdah\":\"⦯\",\"angmsd\":\"∡\",\"angrt\":\"∟\",\"angrtvb\":\"⊾\",\"angrtvbd\":\"⦝\",\"angsph\":\"∢\",\"angst\":\"Å\",\"angzarr\":\"⍼\",\"Aogon\":\"Ą\",\"aogon\":\"ą\",\"Aopf\":\"𝔸\",\"aopf\":\"𝕒\",\"apacir\":\"⩯\",\"ap\":\"≈\",\"apE\":\"⩰\",\"ape\":\"≊\",\"apid\":\"≋\",\"apos\":\"'\",\"ApplyFunction\":\"⁡\",\"approx\":\"≈\",\"approxeq\":\"≊\",\"Aring\":\"Å\",\"aring\":\"å\",\"Ascr\":\"𝒜\",\"ascr\":\"𝒶\",\"Assign\":\"≔\",\"ast\":\"*\",\"asymp\":\"≈\",\"asympeq\":\"≍\",\"Atilde\":\"Ã\",\"atilde\":\"ã\",\"Auml\":\"Ä\",\"auml\":\"ä\",\"awconint\":\"∳\",\"awint\":\"⨑\",\"backcong\":\"≌\",\"backepsilon\":\"϶\",\"backprime\":\"‵\",\"backsim\":\"∽\",\"backsimeq\":\"⋍\",\"Backslash\":\"∖\",\"Barv\":\"⫧\",\"barvee\":\"⊽\",\"barwed\":\"⌅\",\"Barwed\":\"⌆\",\"barwedge\":\"⌅\",\"bbrk\":\"⎵\",\"bbrktbrk\":\"⎶\",\"bcong\":\"≌\",\"Bcy\":\"Б\",\"bcy\":\"б\",\"bdquo\":\"„\",\"becaus\":\"∵\",\"because\":\"∵\",\"Because\":\"∵\",\"bemptyv\":\"⦰\",\"bepsi\":\"϶\",\"bernou\":\"ℬ\",\"Bernoullis\":\"ℬ\",\"Beta\":\"Β\",\"beta\":\"β\",\"beth\":\"ℶ\",\"between\":\"≬\",\"Bfr\":\"𝔅\",\"bfr\":\"𝔟\",\"bigcap\":\"⋂\",\"bigcirc\":\"◯\",\"bigcup\":\"⋃\",\"bigodot\":\"⨀\",\"bigoplus\":\"⨁\",\"bigotimes\":\"⨂\",\"bigsqcup\":\"⨆\",\"bigstar\":\"★\",\"bigtriangledown\":\"▽\",\"bigtriangleup\":\"△\",\"biguplus\":\"⨄\",\"bigvee\":\"⋁\",\"bigwedge\":\"⋀\",\"bkarow\":\"⤍\",\"blacklozenge\":\"⧫\",\"blacksquare\":\"▪\",\"blacktriangle\":\"▴\",\"blacktriangledown\":\"▾\",\"blacktriangleleft\":\"◂\",\"blacktriangleright\":\"▸\",\"blank\":\"␣\",\"blk12\":\"▒\",\"blk14\":\"░\",\"blk34\":\"▓\",\"block\":\"█\",\"bne\":\"=⃥\",\"bnequiv\":\"≡⃥\",\"bNot\":\"⫭\",\"bnot\":\"⌐\",\"Bopf\":\"𝔹\",\"bopf\":\"𝕓\",\"bot\":\"⊥\",\"bottom\":\"⊥\",\"bowtie\":\"⋈\",\"boxbox\":\"⧉\",\"boxdl\":\"┐\",\"boxdL\":\"╕\",\"boxDl\":\"╖\",\"boxDL\":\"╗\",\"boxdr\":\"┌\",\"boxdR\":\"╒\",\"boxDr\":\"╓\",\"boxDR\":\"╔\",\"boxh\":\"─\",\"boxH\":\"═\",\"boxhd\":\"┬\",\"boxHd\":\"╤\",\"boxhD\":\"╥\",\"boxHD\":\"╦\",\"boxhu\":\"┴\",\"boxHu\":\"╧\",\"boxhU\":\"╨\",\"boxHU\":\"╩\",\"boxminus\":\"⊟\",\"boxplus\":\"⊞\",\"boxtimes\":\"⊠\",\"boxul\":\"┘\",\"boxuL\":\"╛\",\"boxUl\":\"╜\",\"boxUL\":\"╝\",\"boxur\":\"└\",\"boxuR\":\"╘\",\"boxUr\":\"╙\",\"boxUR\":\"╚\",\"boxv\":\"│\",\"boxV\":\"║\",\"boxvh\":\"┼\",\"boxvH\":\"╪\",\"boxVh\":\"╫\",\"boxVH\":\"╬\",\"boxvl\":\"┤\",\"boxvL\":\"╡\",\"boxVl\":\"╢\",\"boxVL\":\"╣\",\"boxvr\":\"├\",\"boxvR\":\"╞\",\"boxVr\":\"╟\",\"boxVR\":\"╠\",\"bprime\":\"‵\",\"breve\":\"˘\",\"Breve\":\"˘\",\"brvbar\":\"¦\",\"bscr\":\"𝒷\",\"Bscr\":\"ℬ\",\"bsemi\":\"⁏\",\"bsim\":\"∽\",\"bsime\":\"⋍\",\"bsolb\":\"⧅\",\"bsol\":\"\\\\\",\"bsolhsub\":\"⟈\",\"bull\":\"•\",\"bullet\":\"•\",\"bump\":\"≎\",\"bumpE\":\"⪮\",\"bumpe\":\"≏\",\"Bumpeq\":\"≎\",\"bumpeq\":\"≏\",\"Cacute\":\"Ć\",\"cacute\":\"ć\",\"capand\":\"⩄\",\"capbrcup\":\"⩉\",\"capcap\":\"⩋\",\"cap\":\"∩\",\"Cap\":\"⋒\",\"capcup\":\"⩇\",\"capdot\":\"⩀\",\"CapitalDifferentialD\":\"ⅅ\",\"caps\":\"∩︀\",\"caret\":\"⁁\",\"caron\":\"ˇ\",\"Cayleys\":\"ℭ\",\"ccaps\":\"⩍\",\"Ccaron\":\"Č\",\"ccaron\":\"č\",\"Ccedil\":\"Ç\",\"ccedil\":\"ç\",\"Ccirc\":\"Ĉ\",\"ccirc\":\"ĉ\",\"Cconint\":\"∰\",\"ccups\":\"⩌\",\"ccupssm\":\"⩐\",\"Cdot\":\"Ċ\",\"cdot\":\"ċ\",\"cedil\":\"¸\",\"Cedilla\":\"¸\",\"cemptyv\":\"⦲\",\"cent\":\"¢\",\"centerdot\":\"·\",\"CenterDot\":\"·\",\"cfr\":\"𝔠\",\"Cfr\":\"ℭ\",\"CHcy\":\"Ч\",\"chcy\":\"ч\",\"check\":\"✓\",\"checkmark\":\"✓\",\"Chi\":\"Χ\",\"chi\":\"χ\",\"circ\":\"ˆ\",\"circeq\":\"≗\",\"circlearrowleft\":\"↺\",\"circlearrowright\":\"↻\",\"circledast\":\"⊛\",\"circledcirc\":\"⊚\",\"circleddash\":\"⊝\",\"CircleDot\":\"⊙\",\"circledR\":\"®\",\"circledS\":\"Ⓢ\",\"CircleMinus\":\"⊖\",\"CirclePlus\":\"⊕\",\"CircleTimes\":\"⊗\",\"cir\":\"○\",\"cirE\":\"⧃\",\"cire\":\"≗\",\"cirfnint\":\"⨐\",\"cirmid\":\"⫯\",\"cirscir\":\"⧂\",\"ClockwiseContourIntegral\":\"∲\",\"CloseCurlyDoubleQuote\":\"”\",\"CloseCurlyQuote\":\"’\",\"clubs\":\"♣\",\"clubsuit\":\"♣\",\"colon\":\":\",\"Colon\":\"∷\",\"Colone\":\"⩴\",\"colone\":\"≔\",\"coloneq\":\"≔\",\"comma\":\",\",\"commat\":\"@\",\"comp\":\"∁\",\"compfn\":\"∘\",\"complement\":\"∁\",\"complexes\":\"ℂ\",\"cong\":\"≅\",\"congdot\":\"⩭\",\"Congruent\":\"≡\",\"conint\":\"∮\",\"Conint\":\"∯\",\"ContourIntegral\":\"∮\",\"copf\":\"𝕔\",\"Copf\":\"ℂ\",\"coprod\":\"∐\",\"Coproduct\":\"∐\",\"copy\":\"©\",\"COPY\":\"©\",\"copysr\":\"℗\",\"CounterClockwiseContourIntegral\":\"∳\",\"crarr\":\"↵\",\"cross\":\"✗\",\"Cross\":\"⨯\",\"Cscr\":\"𝒞\",\"cscr\":\"𝒸\",\"csub\":\"⫏\",\"csube\":\"⫑\",\"csup\":\"⫐\",\"csupe\":\"⫒\",\"ctdot\":\"⋯\",\"cudarrl\":\"⤸\",\"cudarrr\":\"⤵\",\"cuepr\":\"⋞\",\"cuesc\":\"⋟\",\"cularr\":\"↶\",\"cularrp\":\"⤽\",\"cupbrcap\":\"⩈\",\"cupcap\":\"⩆\",\"CupCap\":\"≍\",\"cup\":\"∪\",\"Cup\":\"⋓\",\"cupcup\":\"⩊\",\"cupdot\":\"⊍\",\"cupor\":\"⩅\",\"cups\":\"∪︀\",\"curarr\":\"↷\",\"curarrm\":\"⤼\",\"curlyeqprec\":\"⋞\",\"curlyeqsucc\":\"⋟\",\"curlyvee\":\"⋎\",\"curlywedge\":\"⋏\",\"curren\":\"¤\",\"curvearrowleft\":\"↶\",\"curvearrowright\":\"↷\",\"cuvee\":\"⋎\",\"cuwed\":\"⋏\",\"cwconint\":\"∲\",\"cwint\":\"∱\",\"cylcty\":\"⌭\",\"dagger\":\"†\",\"Dagger\":\"‡\",\"daleth\":\"ℸ\",\"darr\":\"↓\",\"Darr\":\"↡\",\"dArr\":\"⇓\",\"dash\":\"‐\",\"Dashv\":\"⫤\",\"dashv\":\"⊣\",\"dbkarow\":\"⤏\",\"dblac\":\"˝\",\"Dcaron\":\"Ď\",\"dcaron\":\"ď\",\"Dcy\":\"Д\",\"dcy\":\"д\",\"ddagger\":\"‡\",\"ddarr\":\"⇊\",\"DD\":\"ⅅ\",\"dd\":\"ⅆ\",\"DDotrahd\":\"⤑\",\"ddotseq\":\"⩷\",\"deg\":\"°\",\"Del\":\"∇\",\"Delta\":\"Δ\",\"delta\":\"δ\",\"demptyv\":\"⦱\",\"dfisht\":\"⥿\",\"Dfr\":\"𝔇\",\"dfr\":\"𝔡\",\"dHar\":\"⥥\",\"dharl\":\"⇃\",\"dharr\":\"⇂\",\"DiacriticalAcute\":\"´\",\"DiacriticalDot\":\"˙\",\"DiacriticalDoubleAcute\":\"˝\",\"DiacriticalGrave\":\"`\",\"DiacriticalTilde\":\"˜\",\"diam\":\"⋄\",\"diamond\":\"⋄\",\"Diamond\":\"⋄\",\"diamondsuit\":\"♦\",\"diams\":\"♦\",\"die\":\"¨\",\"DifferentialD\":\"ⅆ\",\"digamma\":\"ϝ\",\"disin\":\"⋲\",\"div\":\"÷\",\"divide\":\"÷\",\"divideontimes\":\"⋇\",\"divonx\":\"⋇\",\"DJcy\":\"Ђ\",\"djcy\":\"ђ\",\"dlcorn\":\"⌞\",\"dlcrop\":\"⌍\",\"dollar\":\"$\",\"Dopf\":\"𝔻\",\"dopf\":\"𝕕\",\"Dot\":\"¨\",\"dot\":\"˙\",\"DotDot\":\"⃜\",\"doteq\":\"≐\",\"doteqdot\":\"≑\",\"DotEqual\":\"≐\",\"dotminus\":\"∸\",\"dotplus\":\"∔\",\"dotsquare\":\"⊡\",\"doublebarwedge\":\"⌆\",\"DoubleContourIntegral\":\"∯\",\"DoubleDot\":\"¨\",\"DoubleDownArrow\":\"⇓\",\"DoubleLeftArrow\":\"⇐\",\"DoubleLeftRightArrow\":\"⇔\",\"DoubleLeftTee\":\"⫤\",\"DoubleLongLeftArrow\":\"⟸\",\"DoubleLongLeftRightArrow\":\"⟺\",\"DoubleLongRightArrow\":\"⟹\",\"DoubleRightArrow\":\"⇒\",\"DoubleRightTee\":\"⊨\",\"DoubleUpArrow\":\"⇑\",\"DoubleUpDownArrow\":\"⇕\",\"DoubleVerticalBar\":\"∥\",\"DownArrowBar\":\"⤓\",\"downarrow\":\"↓\",\"DownArrow\":\"↓\",\"Downarrow\":\"⇓\",\"DownArrowUpArrow\":\"⇵\",\"DownBreve\":\"̑\",\"downdownarrows\":\"⇊\",\"downharpoonleft\":\"⇃\",\"downharpoonright\":\"⇂\",\"DownLeftRightVector\":\"⥐\",\"DownLeftTeeVector\":\"⥞\",\"DownLeftVectorBar\":\"⥖\",\"DownLeftVector\":\"↽\",\"DownRightTeeVector\":\"⥟\",\"DownRightVectorBar\":\"⥗\",\"DownRightVector\":\"⇁\",\"DownTeeArrow\":\"↧\",\"DownTee\":\"⊤\",\"drbkarow\":\"⤐\",\"drcorn\":\"⌟\",\"drcrop\":\"⌌\",\"Dscr\":\"𝒟\",\"dscr\":\"𝒹\",\"DScy\":\"Ѕ\",\"dscy\":\"ѕ\",\"dsol\":\"⧶\",\"Dstrok\":\"Đ\",\"dstrok\":\"đ\",\"dtdot\":\"⋱\",\"dtri\":\"▿\",\"dtrif\":\"▾\",\"duarr\":\"⇵\",\"duhar\":\"⥯\",\"dwangle\":\"⦦\",\"DZcy\":\"Џ\",\"dzcy\":\"џ\",\"dzigrarr\":\"⟿\",\"Eacute\":\"É\",\"eacute\":\"é\",\"easter\":\"⩮\",\"Ecaron\":\"Ě\",\"ecaron\":\"ě\",\"Ecirc\":\"Ê\",\"ecirc\":\"ê\",\"ecir\":\"≖\",\"ecolon\":\"≕\",\"Ecy\":\"Э\",\"ecy\":\"э\",\"eDDot\":\"⩷\",\"Edot\":\"Ė\",\"edot\":\"ė\",\"eDot\":\"≑\",\"ee\":\"ⅇ\",\"efDot\":\"≒\",\"Efr\":\"𝔈\",\"efr\":\"𝔢\",\"eg\":\"⪚\",\"Egrave\":\"È\",\"egrave\":\"è\",\"egs\":\"⪖\",\"egsdot\":\"⪘\",\"el\":\"⪙\",\"Element\":\"∈\",\"elinters\":\"⏧\",\"ell\":\"ℓ\",\"els\":\"⪕\",\"elsdot\":\"⪗\",\"Emacr\":\"Ē\",\"emacr\":\"ē\",\"empty\":\"∅\",\"emptyset\":\"∅\",\"EmptySmallSquare\":\"◻\",\"emptyv\":\"∅\",\"EmptyVerySmallSquare\":\"▫\",\"emsp13\":\" \",\"emsp14\":\" \",\"emsp\":\" \",\"ENG\":\"Ŋ\",\"eng\":\"ŋ\",\"ensp\":\" \",\"Eogon\":\"Ę\",\"eogon\":\"ę\",\"Eopf\":\"𝔼\",\"eopf\":\"𝕖\",\"epar\":\"⋕\",\"eparsl\":\"⧣\",\"eplus\":\"⩱\",\"epsi\":\"ε\",\"Epsilon\":\"Ε\",\"epsilon\":\"ε\",\"epsiv\":\"ϵ\",\"eqcirc\":\"≖\",\"eqcolon\":\"≕\",\"eqsim\":\"≂\",\"eqslantgtr\":\"⪖\",\"eqslantless\":\"⪕\",\"Equal\":\"⩵\",\"equals\":\"=\",\"EqualTilde\":\"≂\",\"equest\":\"≟\",\"Equilibrium\":\"⇌\",\"equiv\":\"≡\",\"equivDD\":\"⩸\",\"eqvparsl\":\"⧥\",\"erarr\":\"⥱\",\"erDot\":\"≓\",\"escr\":\"ℯ\",\"Escr\":\"ℰ\",\"esdot\":\"≐\",\"Esim\":\"⩳\",\"esim\":\"≂\",\"Eta\":\"Η\",\"eta\":\"η\",\"ETH\":\"Ð\",\"eth\":\"ð\",\"Euml\":\"Ë\",\"euml\":\"ë\",\"euro\":\"€\",\"excl\":\"!\",\"exist\":\"∃\",\"Exists\":\"∃\",\"expectation\":\"ℰ\",\"exponentiale\":\"ⅇ\",\"ExponentialE\":\"ⅇ\",\"fallingdotseq\":\"≒\",\"Fcy\":\"Ф\",\"fcy\":\"ф\",\"female\":\"♀\",\"ffilig\":\"ffi\",\"fflig\":\"ff\",\"ffllig\":\"ffl\",\"Ffr\":\"𝔉\",\"ffr\":\"𝔣\",\"filig\":\"fi\",\"FilledSmallSquare\":\"◼\",\"FilledVerySmallSquare\":\"▪\",\"fjlig\":\"fj\",\"flat\":\"♭\",\"fllig\":\"fl\",\"fltns\":\"▱\",\"fnof\":\"ƒ\",\"Fopf\":\"𝔽\",\"fopf\":\"𝕗\",\"forall\":\"∀\",\"ForAll\":\"∀\",\"fork\":\"⋔\",\"forkv\":\"⫙\",\"Fouriertrf\":\"ℱ\",\"fpartint\":\"⨍\",\"frac12\":\"½\",\"frac13\":\"⅓\",\"frac14\":\"¼\",\"frac15\":\"⅕\",\"frac16\":\"⅙\",\"frac18\":\"⅛\",\"frac23\":\"⅔\",\"frac25\":\"⅖\",\"frac34\":\"¾\",\"frac35\":\"⅗\",\"frac38\":\"⅜\",\"frac45\":\"⅘\",\"frac56\":\"⅚\",\"frac58\":\"⅝\",\"frac78\":\"⅞\",\"frasl\":\"⁄\",\"frown\":\"⌢\",\"fscr\":\"𝒻\",\"Fscr\":\"ℱ\",\"gacute\":\"ǵ\",\"Gamma\":\"Γ\",\"gamma\":\"γ\",\"Gammad\":\"Ϝ\",\"gammad\":\"ϝ\",\"gap\":\"⪆\",\"Gbreve\":\"Ğ\",\"gbreve\":\"ğ\",\"Gcedil\":\"Ģ\",\"Gcirc\":\"Ĝ\",\"gcirc\":\"ĝ\",\"Gcy\":\"Г\",\"gcy\":\"г\",\"Gdot\":\"Ġ\",\"gdot\":\"ġ\",\"ge\":\"≥\",\"gE\":\"≧\",\"gEl\":\"⪌\",\"gel\":\"⋛\",\"geq\":\"≥\",\"geqq\":\"≧\",\"geqslant\":\"⩾\",\"gescc\":\"⪩\",\"ges\":\"⩾\",\"gesdot\":\"⪀\",\"gesdoto\":\"⪂\",\"gesdotol\":\"⪄\",\"gesl\":\"⋛︀\",\"gesles\":\"⪔\",\"Gfr\":\"𝔊\",\"gfr\":\"𝔤\",\"gg\":\"≫\",\"Gg\":\"⋙\",\"ggg\":\"⋙\",\"gimel\":\"ℷ\",\"GJcy\":\"Ѓ\",\"gjcy\":\"ѓ\",\"gla\":\"⪥\",\"gl\":\"≷\",\"glE\":\"⪒\",\"glj\":\"⪤\",\"gnap\":\"⪊\",\"gnapprox\":\"⪊\",\"gne\":\"⪈\",\"gnE\":\"≩\",\"gneq\":\"⪈\",\"gneqq\":\"≩\",\"gnsim\":\"⋧\",\"Gopf\":\"𝔾\",\"gopf\":\"𝕘\",\"grave\":\"`\",\"GreaterEqual\":\"≥\",\"GreaterEqualLess\":\"⋛\",\"GreaterFullEqual\":\"≧\",\"GreaterGreater\":\"⪢\",\"GreaterLess\":\"≷\",\"GreaterSlantEqual\":\"⩾\",\"GreaterTilde\":\"≳\",\"Gscr\":\"𝒢\",\"gscr\":\"ℊ\",\"gsim\":\"≳\",\"gsime\":\"⪎\",\"gsiml\":\"⪐\",\"gtcc\":\"⪧\",\"gtcir\":\"⩺\",\"gt\":\">\",\"GT\":\">\",\"Gt\":\"≫\",\"gtdot\":\"⋗\",\"gtlPar\":\"⦕\",\"gtquest\":\"⩼\",\"gtrapprox\":\"⪆\",\"gtrarr\":\"⥸\",\"gtrdot\":\"⋗\",\"gtreqless\":\"⋛\",\"gtreqqless\":\"⪌\",\"gtrless\":\"≷\",\"gtrsim\":\"≳\",\"gvertneqq\":\"≩︀\",\"gvnE\":\"≩︀\",\"Hacek\":\"ˇ\",\"hairsp\":\" \",\"half\":\"½\",\"hamilt\":\"ℋ\",\"HARDcy\":\"Ъ\",\"hardcy\":\"ъ\",\"harrcir\":\"⥈\",\"harr\":\"↔\",\"hArr\":\"⇔\",\"harrw\":\"↭\",\"Hat\":\"^\",\"hbar\":\"ℏ\",\"Hcirc\":\"Ĥ\",\"hcirc\":\"ĥ\",\"hearts\":\"♥\",\"heartsuit\":\"♥\",\"hellip\":\"…\",\"hercon\":\"⊹\",\"hfr\":\"𝔥\",\"Hfr\":\"ℌ\",\"HilbertSpace\":\"ℋ\",\"hksearow\":\"⤥\",\"hkswarow\":\"⤦\",\"hoarr\":\"⇿\",\"homtht\":\"∻\",\"hookleftarrow\":\"↩\",\"hookrightarrow\":\"↪\",\"hopf\":\"𝕙\",\"Hopf\":\"ℍ\",\"horbar\":\"―\",\"HorizontalLine\":\"─\",\"hscr\":\"𝒽\",\"Hscr\":\"ℋ\",\"hslash\":\"ℏ\",\"Hstrok\":\"Ħ\",\"hstrok\":\"ħ\",\"HumpDownHump\":\"≎\",\"HumpEqual\":\"≏\",\"hybull\":\"⁃\",\"hyphen\":\"‐\",\"Iacute\":\"Í\",\"iacute\":\"í\",\"ic\":\"⁣\",\"Icirc\":\"Î\",\"icirc\":\"î\",\"Icy\":\"И\",\"icy\":\"и\",\"Idot\":\"İ\",\"IEcy\":\"Е\",\"iecy\":\"е\",\"iexcl\":\"¡\",\"iff\":\"⇔\",\"ifr\":\"𝔦\",\"Ifr\":\"ℑ\",\"Igrave\":\"Ì\",\"igrave\":\"ì\",\"ii\":\"ⅈ\",\"iiiint\":\"⨌\",\"iiint\":\"∭\",\"iinfin\":\"⧜\",\"iiota\":\"℩\",\"IJlig\":\"IJ\",\"ijlig\":\"ij\",\"Imacr\":\"Ī\",\"imacr\":\"ī\",\"image\":\"ℑ\",\"ImaginaryI\":\"ⅈ\",\"imagline\":\"ℐ\",\"imagpart\":\"ℑ\",\"imath\":\"ı\",\"Im\":\"ℑ\",\"imof\":\"⊷\",\"imped\":\"Ƶ\",\"Implies\":\"⇒\",\"incare\":\"℅\",\"in\":\"∈\",\"infin\":\"∞\",\"infintie\":\"⧝\",\"inodot\":\"ı\",\"intcal\":\"⊺\",\"int\":\"∫\",\"Int\":\"∬\",\"integers\":\"ℤ\",\"Integral\":\"∫\",\"intercal\":\"⊺\",\"Intersection\":\"⋂\",\"intlarhk\":\"⨗\",\"intprod\":\"⨼\",\"InvisibleComma\":\"⁣\",\"InvisibleTimes\":\"⁢\",\"IOcy\":\"Ё\",\"iocy\":\"ё\",\"Iogon\":\"Į\",\"iogon\":\"į\",\"Iopf\":\"𝕀\",\"iopf\":\"𝕚\",\"Iota\":\"Ι\",\"iota\":\"ι\",\"iprod\":\"⨼\",\"iquest\":\"¿\",\"iscr\":\"𝒾\",\"Iscr\":\"ℐ\",\"isin\":\"∈\",\"isindot\":\"⋵\",\"isinE\":\"⋹\",\"isins\":\"⋴\",\"isinsv\":\"⋳\",\"isinv\":\"∈\",\"it\":\"⁢\",\"Itilde\":\"Ĩ\",\"itilde\":\"ĩ\",\"Iukcy\":\"І\",\"iukcy\":\"і\",\"Iuml\":\"Ï\",\"iuml\":\"ï\",\"Jcirc\":\"Ĵ\",\"jcirc\":\"ĵ\",\"Jcy\":\"Й\",\"jcy\":\"й\",\"Jfr\":\"𝔍\",\"jfr\":\"𝔧\",\"jmath\":\"ȷ\",\"Jopf\":\"𝕁\",\"jopf\":\"𝕛\",\"Jscr\":\"𝒥\",\"jscr\":\"𝒿\",\"Jsercy\":\"Ј\",\"jsercy\":\"ј\",\"Jukcy\":\"Є\",\"jukcy\":\"є\",\"Kappa\":\"Κ\",\"kappa\":\"κ\",\"kappav\":\"ϰ\",\"Kcedil\":\"Ķ\",\"kcedil\":\"ķ\",\"Kcy\":\"К\",\"kcy\":\"к\",\"Kfr\":\"𝔎\",\"kfr\":\"𝔨\",\"kgreen\":\"ĸ\",\"KHcy\":\"Х\",\"khcy\":\"х\",\"KJcy\":\"Ќ\",\"kjcy\":\"ќ\",\"Kopf\":\"𝕂\",\"kopf\":\"𝕜\",\"Kscr\":\"𝒦\",\"kscr\":\"𝓀\",\"lAarr\":\"⇚\",\"Lacute\":\"Ĺ\",\"lacute\":\"ĺ\",\"laemptyv\":\"⦴\",\"lagran\":\"ℒ\",\"Lambda\":\"Λ\",\"lambda\":\"λ\",\"lang\":\"⟨\",\"Lang\":\"⟪\",\"langd\":\"⦑\",\"langle\":\"⟨\",\"lap\":\"⪅\",\"Laplacetrf\":\"ℒ\",\"laquo\":\"«\",\"larrb\":\"⇤\",\"larrbfs\":\"⤟\",\"larr\":\"←\",\"Larr\":\"↞\",\"lArr\":\"⇐\",\"larrfs\":\"⤝\",\"larrhk\":\"↩\",\"larrlp\":\"↫\",\"larrpl\":\"⤹\",\"larrsim\":\"⥳\",\"larrtl\":\"↢\",\"latail\":\"⤙\",\"lAtail\":\"⤛\",\"lat\":\"⪫\",\"late\":\"⪭\",\"lates\":\"⪭︀\",\"lbarr\":\"⤌\",\"lBarr\":\"⤎\",\"lbbrk\":\"❲\",\"lbrace\":\"{\",\"lbrack\":\"[\",\"lbrke\":\"⦋\",\"lbrksld\":\"⦏\",\"lbrkslu\":\"⦍\",\"Lcaron\":\"Ľ\",\"lcaron\":\"ľ\",\"Lcedil\":\"Ļ\",\"lcedil\":\"ļ\",\"lceil\":\"⌈\",\"lcub\":\"{\",\"Lcy\":\"Л\",\"lcy\":\"л\",\"ldca\":\"⤶\",\"ldquo\":\"“\",\"ldquor\":\"„\",\"ldrdhar\":\"⥧\",\"ldrushar\":\"⥋\",\"ldsh\":\"↲\",\"le\":\"≤\",\"lE\":\"≦\",\"LeftAngleBracket\":\"⟨\",\"LeftArrowBar\":\"⇤\",\"leftarrow\":\"←\",\"LeftArrow\":\"←\",\"Leftarrow\":\"⇐\",\"LeftArrowRightArrow\":\"⇆\",\"leftarrowtail\":\"↢\",\"LeftCeiling\":\"⌈\",\"LeftDoubleBracket\":\"⟦\",\"LeftDownTeeVector\":\"⥡\",\"LeftDownVectorBar\":\"⥙\",\"LeftDownVector\":\"⇃\",\"LeftFloor\":\"⌊\",\"leftharpoondown\":\"↽\",\"leftharpoonup\":\"↼\",\"leftleftarrows\":\"⇇\",\"leftrightarrow\":\"↔\",\"LeftRightArrow\":\"↔\",\"Leftrightarrow\":\"⇔\",\"leftrightarrows\":\"⇆\",\"leftrightharpoons\":\"⇋\",\"leftrightsquigarrow\":\"↭\",\"LeftRightVector\":\"⥎\",\"LeftTeeArrow\":\"↤\",\"LeftTee\":\"⊣\",\"LeftTeeVector\":\"⥚\",\"leftthreetimes\":\"⋋\",\"LeftTriangleBar\":\"⧏\",\"LeftTriangle\":\"⊲\",\"LeftTriangleEqual\":\"⊴\",\"LeftUpDownVector\":\"⥑\",\"LeftUpTeeVector\":\"⥠\",\"LeftUpVectorBar\":\"⥘\",\"LeftUpVector\":\"↿\",\"LeftVectorBar\":\"⥒\",\"LeftVector\":\"↼\",\"lEg\":\"⪋\",\"leg\":\"⋚\",\"leq\":\"≤\",\"leqq\":\"≦\",\"leqslant\":\"⩽\",\"lescc\":\"⪨\",\"les\":\"⩽\",\"lesdot\":\"⩿\",\"lesdoto\":\"⪁\",\"lesdotor\":\"⪃\",\"lesg\":\"⋚︀\",\"lesges\":\"⪓\",\"lessapprox\":\"⪅\",\"lessdot\":\"⋖\",\"lesseqgtr\":\"⋚\",\"lesseqqgtr\":\"⪋\",\"LessEqualGreater\":\"⋚\",\"LessFullEqual\":\"≦\",\"LessGreater\":\"≶\",\"lessgtr\":\"≶\",\"LessLess\":\"⪡\",\"lesssim\":\"≲\",\"LessSlantEqual\":\"⩽\",\"LessTilde\":\"≲\",\"lfisht\":\"⥼\",\"lfloor\":\"⌊\",\"Lfr\":\"𝔏\",\"lfr\":\"𝔩\",\"lg\":\"≶\",\"lgE\":\"⪑\",\"lHar\":\"⥢\",\"lhard\":\"↽\",\"lharu\":\"↼\",\"lharul\":\"⥪\",\"lhblk\":\"▄\",\"LJcy\":\"Љ\",\"ljcy\":\"љ\",\"llarr\":\"⇇\",\"ll\":\"≪\",\"Ll\":\"⋘\",\"llcorner\":\"⌞\",\"Lleftarrow\":\"⇚\",\"llhard\":\"⥫\",\"lltri\":\"◺\",\"Lmidot\":\"Ŀ\",\"lmidot\":\"ŀ\",\"lmoustache\":\"⎰\",\"lmoust\":\"⎰\",\"lnap\":\"⪉\",\"lnapprox\":\"⪉\",\"lne\":\"⪇\",\"lnE\":\"≨\",\"lneq\":\"⪇\",\"lneqq\":\"≨\",\"lnsim\":\"⋦\",\"loang\":\"⟬\",\"loarr\":\"⇽\",\"lobrk\":\"⟦\",\"longleftarrow\":\"⟵\",\"LongLeftArrow\":\"⟵\",\"Longleftarrow\":\"⟸\",\"longleftrightarrow\":\"⟷\",\"LongLeftRightArrow\":\"⟷\",\"Longleftrightarrow\":\"⟺\",\"longmapsto\":\"⟼\",\"longrightarrow\":\"⟶\",\"LongRightArrow\":\"⟶\",\"Longrightarrow\":\"⟹\",\"looparrowleft\":\"↫\",\"looparrowright\":\"↬\",\"lopar\":\"⦅\",\"Lopf\":\"𝕃\",\"lopf\":\"𝕝\",\"loplus\":\"⨭\",\"lotimes\":\"⨴\",\"lowast\":\"∗\",\"lowbar\":\"_\",\"LowerLeftArrow\":\"↙\",\"LowerRightArrow\":\"↘\",\"loz\":\"◊\",\"lozenge\":\"◊\",\"lozf\":\"⧫\",\"lpar\":\"(\",\"lparlt\":\"⦓\",\"lrarr\":\"⇆\",\"lrcorner\":\"⌟\",\"lrhar\":\"⇋\",\"lrhard\":\"⥭\",\"lrm\":\"‎\",\"lrtri\":\"⊿\",\"lsaquo\":\"‹\",\"lscr\":\"𝓁\",\"Lscr\":\"ℒ\",\"lsh\":\"↰\",\"Lsh\":\"↰\",\"lsim\":\"≲\",\"lsime\":\"⪍\",\"lsimg\":\"⪏\",\"lsqb\":\"[\",\"lsquo\":\"‘\",\"lsquor\":\"‚\",\"Lstrok\":\"Ł\",\"lstrok\":\"ł\",\"ltcc\":\"⪦\",\"ltcir\":\"⩹\",\"lt\":\"<\",\"LT\":\"<\",\"Lt\":\"≪\",\"ltdot\":\"⋖\",\"lthree\":\"⋋\",\"ltimes\":\"⋉\",\"ltlarr\":\"⥶\",\"ltquest\":\"⩻\",\"ltri\":\"◃\",\"ltrie\":\"⊴\",\"ltrif\":\"◂\",\"ltrPar\":\"⦖\",\"lurdshar\":\"⥊\",\"luruhar\":\"⥦\",\"lvertneqq\":\"≨︀\",\"lvnE\":\"≨︀\",\"macr\":\"¯\",\"male\":\"♂\",\"malt\":\"✠\",\"maltese\":\"✠\",\"Map\":\"⤅\",\"map\":\"↦\",\"mapsto\":\"↦\",\"mapstodown\":\"↧\",\"mapstoleft\":\"↤\",\"mapstoup\":\"↥\",\"marker\":\"▮\",\"mcomma\":\"⨩\",\"Mcy\":\"М\",\"mcy\":\"м\",\"mdash\":\"—\",\"mDDot\":\"∺\",\"measuredangle\":\"∡\",\"MediumSpace\":\" \",\"Mellintrf\":\"ℳ\",\"Mfr\":\"𝔐\",\"mfr\":\"𝔪\",\"mho\":\"℧\",\"micro\":\"µ\",\"midast\":\"*\",\"midcir\":\"⫰\",\"mid\":\"∣\",\"middot\":\"·\",\"minusb\":\"⊟\",\"minus\":\"−\",\"minusd\":\"∸\",\"minusdu\":\"⨪\",\"MinusPlus\":\"∓\",\"mlcp\":\"⫛\",\"mldr\":\"…\",\"mnplus\":\"∓\",\"models\":\"⊧\",\"Mopf\":\"𝕄\",\"mopf\":\"𝕞\",\"mp\":\"∓\",\"mscr\":\"𝓂\",\"Mscr\":\"ℳ\",\"mstpos\":\"∾\",\"Mu\":\"Μ\",\"mu\":\"μ\",\"multimap\":\"⊸\",\"mumap\":\"⊸\",\"nabla\":\"∇\",\"Nacute\":\"Ń\",\"nacute\":\"ń\",\"nang\":\"∠⃒\",\"nap\":\"≉\",\"napE\":\"⩰̸\",\"napid\":\"≋̸\",\"napos\":\"ʼn\",\"napprox\":\"≉\",\"natural\":\"♮\",\"naturals\":\"ℕ\",\"natur\":\"♮\",\"nbsp\":\" \",\"nbump\":\"≎̸\",\"nbumpe\":\"≏̸\",\"ncap\":\"⩃\",\"Ncaron\":\"Ň\",\"ncaron\":\"ň\",\"Ncedil\":\"Ņ\",\"ncedil\":\"ņ\",\"ncong\":\"≇\",\"ncongdot\":\"⩭̸\",\"ncup\":\"⩂\",\"Ncy\":\"Н\",\"ncy\":\"н\",\"ndash\":\"–\",\"nearhk\":\"⤤\",\"nearr\":\"↗\",\"neArr\":\"⇗\",\"nearrow\":\"↗\",\"ne\":\"≠\",\"nedot\":\"≐̸\",\"NegativeMediumSpace\":\"​\",\"NegativeThickSpace\":\"​\",\"NegativeThinSpace\":\"​\",\"NegativeVeryThinSpace\":\"​\",\"nequiv\":\"≢\",\"nesear\":\"⤨\",\"nesim\":\"≂̸\",\"NestedGreaterGreater\":\"≫\",\"NestedLessLess\":\"≪\",\"NewLine\":\"\\n\",\"nexist\":\"∄\",\"nexists\":\"∄\",\"Nfr\":\"𝔑\",\"nfr\":\"𝔫\",\"ngE\":\"≧̸\",\"nge\":\"≱\",\"ngeq\":\"≱\",\"ngeqq\":\"≧̸\",\"ngeqslant\":\"⩾̸\",\"nges\":\"⩾̸\",\"nGg\":\"⋙̸\",\"ngsim\":\"≵\",\"nGt\":\"≫⃒\",\"ngt\":\"≯\",\"ngtr\":\"≯\",\"nGtv\":\"≫̸\",\"nharr\":\"↮\",\"nhArr\":\"⇎\",\"nhpar\":\"⫲\",\"ni\":\"∋\",\"nis\":\"⋼\",\"nisd\":\"⋺\",\"niv\":\"∋\",\"NJcy\":\"Њ\",\"njcy\":\"њ\",\"nlarr\":\"↚\",\"nlArr\":\"⇍\",\"nldr\":\"‥\",\"nlE\":\"≦̸\",\"nle\":\"≰\",\"nleftarrow\":\"↚\",\"nLeftarrow\":\"⇍\",\"nleftrightarrow\":\"↮\",\"nLeftrightarrow\":\"⇎\",\"nleq\":\"≰\",\"nleqq\":\"≦̸\",\"nleqslant\":\"⩽̸\",\"nles\":\"⩽̸\",\"nless\":\"≮\",\"nLl\":\"⋘̸\",\"nlsim\":\"≴\",\"nLt\":\"≪⃒\",\"nlt\":\"≮\",\"nltri\":\"⋪\",\"nltrie\":\"⋬\",\"nLtv\":\"≪̸\",\"nmid\":\"∤\",\"NoBreak\":\"⁠\",\"NonBreakingSpace\":\" \",\"nopf\":\"𝕟\",\"Nopf\":\"ℕ\",\"Not\":\"⫬\",\"not\":\"¬\",\"NotCongruent\":\"≢\",\"NotCupCap\":\"≭\",\"NotDoubleVerticalBar\":\"∦\",\"NotElement\":\"∉\",\"NotEqual\":\"≠\",\"NotEqualTilde\":\"≂̸\",\"NotExists\":\"∄\",\"NotGreater\":\"≯\",\"NotGreaterEqual\":\"≱\",\"NotGreaterFullEqual\":\"≧̸\",\"NotGreaterGreater\":\"≫̸\",\"NotGreaterLess\":\"≹\",\"NotGreaterSlantEqual\":\"⩾̸\",\"NotGreaterTilde\":\"≵\",\"NotHumpDownHump\":\"≎̸\",\"NotHumpEqual\":\"≏̸\",\"notin\":\"∉\",\"notindot\":\"⋵̸\",\"notinE\":\"⋹̸\",\"notinva\":\"∉\",\"notinvb\":\"⋷\",\"notinvc\":\"⋶\",\"NotLeftTriangleBar\":\"⧏̸\",\"NotLeftTriangle\":\"⋪\",\"NotLeftTriangleEqual\":\"⋬\",\"NotLess\":\"≮\",\"NotLessEqual\":\"≰\",\"NotLessGreater\":\"≸\",\"NotLessLess\":\"≪̸\",\"NotLessSlantEqual\":\"⩽̸\",\"NotLessTilde\":\"≴\",\"NotNestedGreaterGreater\":\"⪢̸\",\"NotNestedLessLess\":\"⪡̸\",\"notni\":\"∌\",\"notniva\":\"∌\",\"notnivb\":\"⋾\",\"notnivc\":\"⋽\",\"NotPrecedes\":\"⊀\",\"NotPrecedesEqual\":\"⪯̸\",\"NotPrecedesSlantEqual\":\"⋠\",\"NotReverseElement\":\"∌\",\"NotRightTriangleBar\":\"⧐̸\",\"NotRightTriangle\":\"⋫\",\"NotRightTriangleEqual\":\"⋭\",\"NotSquareSubset\":\"⊏̸\",\"NotSquareSubsetEqual\":\"⋢\",\"NotSquareSuperset\":\"⊐̸\",\"NotSquareSupersetEqual\":\"⋣\",\"NotSubset\":\"⊂⃒\",\"NotSubsetEqual\":\"⊈\",\"NotSucceeds\":\"⊁\",\"NotSucceedsEqual\":\"⪰̸\",\"NotSucceedsSlantEqual\":\"⋡\",\"NotSucceedsTilde\":\"≿̸\",\"NotSuperset\":\"⊃⃒\",\"NotSupersetEqual\":\"⊉\",\"NotTilde\":\"≁\",\"NotTildeEqual\":\"≄\",\"NotTildeFullEqual\":\"≇\",\"NotTildeTilde\":\"≉\",\"NotVerticalBar\":\"∤\",\"nparallel\":\"∦\",\"npar\":\"∦\",\"nparsl\":\"⫽⃥\",\"npart\":\"∂̸\",\"npolint\":\"⨔\",\"npr\":\"⊀\",\"nprcue\":\"⋠\",\"nprec\":\"⊀\",\"npreceq\":\"⪯̸\",\"npre\":\"⪯̸\",\"nrarrc\":\"⤳̸\",\"nrarr\":\"↛\",\"nrArr\":\"⇏\",\"nrarrw\":\"↝̸\",\"nrightarrow\":\"↛\",\"nRightarrow\":\"⇏\",\"nrtri\":\"⋫\",\"nrtrie\":\"⋭\",\"nsc\":\"⊁\",\"nsccue\":\"⋡\",\"nsce\":\"⪰̸\",\"Nscr\":\"𝒩\",\"nscr\":\"𝓃\",\"nshortmid\":\"∤\",\"nshortparallel\":\"∦\",\"nsim\":\"≁\",\"nsime\":\"≄\",\"nsimeq\":\"≄\",\"nsmid\":\"∤\",\"nspar\":\"∦\",\"nsqsube\":\"⋢\",\"nsqsupe\":\"⋣\",\"nsub\":\"⊄\",\"nsubE\":\"⫅̸\",\"nsube\":\"⊈\",\"nsubset\":\"⊂⃒\",\"nsubseteq\":\"⊈\",\"nsubseteqq\":\"⫅̸\",\"nsucc\":\"⊁\",\"nsucceq\":\"⪰̸\",\"nsup\":\"⊅\",\"nsupE\":\"⫆̸\",\"nsupe\":\"⊉\",\"nsupset\":\"⊃⃒\",\"nsupseteq\":\"⊉\",\"nsupseteqq\":\"⫆̸\",\"ntgl\":\"≹\",\"Ntilde\":\"Ñ\",\"ntilde\":\"ñ\",\"ntlg\":\"≸\",\"ntriangleleft\":\"⋪\",\"ntrianglelefteq\":\"⋬\",\"ntriangleright\":\"⋫\",\"ntrianglerighteq\":\"⋭\",\"Nu\":\"Ν\",\"nu\":\"ν\",\"num\":\"#\",\"numero\":\"№\",\"numsp\":\" \",\"nvap\":\"≍⃒\",\"nvdash\":\"⊬\",\"nvDash\":\"⊭\",\"nVdash\":\"⊮\",\"nVDash\":\"⊯\",\"nvge\":\"≥⃒\",\"nvgt\":\">⃒\",\"nvHarr\":\"⤄\",\"nvinfin\":\"⧞\",\"nvlArr\":\"⤂\",\"nvle\":\"≤⃒\",\"nvlt\":\"<⃒\",\"nvltrie\":\"⊴⃒\",\"nvrArr\":\"⤃\",\"nvrtrie\":\"⊵⃒\",\"nvsim\":\"∼⃒\",\"nwarhk\":\"⤣\",\"nwarr\":\"↖\",\"nwArr\":\"⇖\",\"nwarrow\":\"↖\",\"nwnear\":\"⤧\",\"Oacute\":\"Ó\",\"oacute\":\"ó\",\"oast\":\"⊛\",\"Ocirc\":\"Ô\",\"ocirc\":\"ô\",\"ocir\":\"⊚\",\"Ocy\":\"О\",\"ocy\":\"о\",\"odash\":\"⊝\",\"Odblac\":\"Ő\",\"odblac\":\"ő\",\"odiv\":\"⨸\",\"odot\":\"⊙\",\"odsold\":\"⦼\",\"OElig\":\"Œ\",\"oelig\":\"œ\",\"ofcir\":\"⦿\",\"Ofr\":\"𝔒\",\"ofr\":\"𝔬\",\"ogon\":\"˛\",\"Ograve\":\"Ò\",\"ograve\":\"ò\",\"ogt\":\"⧁\",\"ohbar\":\"⦵\",\"ohm\":\"Ω\",\"oint\":\"∮\",\"olarr\":\"↺\",\"olcir\":\"⦾\",\"olcross\":\"⦻\",\"oline\":\"‾\",\"olt\":\"⧀\",\"Omacr\":\"Ō\",\"omacr\":\"ō\",\"Omega\":\"Ω\",\"omega\":\"ω\",\"Omicron\":\"Ο\",\"omicron\":\"ο\",\"omid\":\"⦶\",\"ominus\":\"⊖\",\"Oopf\":\"𝕆\",\"oopf\":\"𝕠\",\"opar\":\"⦷\",\"OpenCurlyDoubleQuote\":\"“\",\"OpenCurlyQuote\":\"‘\",\"operp\":\"⦹\",\"oplus\":\"⊕\",\"orarr\":\"↻\",\"Or\":\"⩔\",\"or\":\"∨\",\"ord\":\"⩝\",\"order\":\"ℴ\",\"orderof\":\"ℴ\",\"ordf\":\"ª\",\"ordm\":\"º\",\"origof\":\"⊶\",\"oror\":\"⩖\",\"orslope\":\"⩗\",\"orv\":\"⩛\",\"oS\":\"Ⓢ\",\"Oscr\":\"𝒪\",\"oscr\":\"ℴ\",\"Oslash\":\"Ø\",\"oslash\":\"ø\",\"osol\":\"⊘\",\"Otilde\":\"Õ\",\"otilde\":\"õ\",\"otimesas\":\"⨶\",\"Otimes\":\"⨷\",\"otimes\":\"⊗\",\"Ouml\":\"Ö\",\"ouml\":\"ö\",\"ovbar\":\"⌽\",\"OverBar\":\"‾\",\"OverBrace\":\"⏞\",\"OverBracket\":\"⎴\",\"OverParenthesis\":\"⏜\",\"para\":\"¶\",\"parallel\":\"∥\",\"par\":\"∥\",\"parsim\":\"⫳\",\"parsl\":\"⫽\",\"part\":\"∂\",\"PartialD\":\"∂\",\"Pcy\":\"П\",\"pcy\":\"п\",\"percnt\":\"%\",\"period\":\".\",\"permil\":\"‰\",\"perp\":\"⊥\",\"pertenk\":\"‱\",\"Pfr\":\"𝔓\",\"pfr\":\"𝔭\",\"Phi\":\"Φ\",\"phi\":\"φ\",\"phiv\":\"ϕ\",\"phmmat\":\"ℳ\",\"phone\":\"☎\",\"Pi\":\"Π\",\"pi\":\"π\",\"pitchfork\":\"⋔\",\"piv\":\"ϖ\",\"planck\":\"ℏ\",\"planckh\":\"ℎ\",\"plankv\":\"ℏ\",\"plusacir\":\"⨣\",\"plusb\":\"⊞\",\"pluscir\":\"⨢\",\"plus\":\"+\",\"plusdo\":\"∔\",\"plusdu\":\"⨥\",\"pluse\":\"⩲\",\"PlusMinus\":\"±\",\"plusmn\":\"±\",\"plussim\":\"⨦\",\"plustwo\":\"⨧\",\"pm\":\"±\",\"Poincareplane\":\"ℌ\",\"pointint\":\"⨕\",\"popf\":\"𝕡\",\"Popf\":\"ℙ\",\"pound\":\"£\",\"prap\":\"⪷\",\"Pr\":\"⪻\",\"pr\":\"≺\",\"prcue\":\"≼\",\"precapprox\":\"⪷\",\"prec\":\"≺\",\"preccurlyeq\":\"≼\",\"Precedes\":\"≺\",\"PrecedesEqual\":\"⪯\",\"PrecedesSlantEqual\":\"≼\",\"PrecedesTilde\":\"≾\",\"preceq\":\"⪯\",\"precnapprox\":\"⪹\",\"precneqq\":\"⪵\",\"precnsim\":\"⋨\",\"pre\":\"⪯\",\"prE\":\"⪳\",\"precsim\":\"≾\",\"prime\":\"′\",\"Prime\":\"″\",\"primes\":\"ℙ\",\"prnap\":\"⪹\",\"prnE\":\"⪵\",\"prnsim\":\"⋨\",\"prod\":\"∏\",\"Product\":\"∏\",\"profalar\":\"⌮\",\"profline\":\"⌒\",\"profsurf\":\"⌓\",\"prop\":\"∝\",\"Proportional\":\"∝\",\"Proportion\":\"∷\",\"propto\":\"∝\",\"prsim\":\"≾\",\"prurel\":\"⊰\",\"Pscr\":\"𝒫\",\"pscr\":\"𝓅\",\"Psi\":\"Ψ\",\"psi\":\"ψ\",\"puncsp\":\" \",\"Qfr\":\"𝔔\",\"qfr\":\"𝔮\",\"qint\":\"⨌\",\"qopf\":\"𝕢\",\"Qopf\":\"ℚ\",\"qprime\":\"⁗\",\"Qscr\":\"𝒬\",\"qscr\":\"𝓆\",\"quaternions\":\"ℍ\",\"quatint\":\"⨖\",\"quest\":\"?\",\"questeq\":\"≟\",\"quot\":\"\\\"\",\"QUOT\":\"\\\"\",\"rAarr\":\"⇛\",\"race\":\"∽̱\",\"Racute\":\"Ŕ\",\"racute\":\"ŕ\",\"radic\":\"√\",\"raemptyv\":\"⦳\",\"rang\":\"⟩\",\"Rang\":\"⟫\",\"rangd\":\"⦒\",\"range\":\"⦥\",\"rangle\":\"⟩\",\"raquo\":\"»\",\"rarrap\":\"⥵\",\"rarrb\":\"⇥\",\"rarrbfs\":\"⤠\",\"rarrc\":\"⤳\",\"rarr\":\"→\",\"Rarr\":\"↠\",\"rArr\":\"⇒\",\"rarrfs\":\"⤞\",\"rarrhk\":\"↪\",\"rarrlp\":\"↬\",\"rarrpl\":\"⥅\",\"rarrsim\":\"⥴\",\"Rarrtl\":\"⤖\",\"rarrtl\":\"↣\",\"rarrw\":\"↝\",\"ratail\":\"⤚\",\"rAtail\":\"⤜\",\"ratio\":\"∶\",\"rationals\":\"ℚ\",\"rbarr\":\"⤍\",\"rBarr\":\"⤏\",\"RBarr\":\"⤐\",\"rbbrk\":\"❳\",\"rbrace\":\"}\",\"rbrack\":\"]\",\"rbrke\":\"⦌\",\"rbrksld\":\"⦎\",\"rbrkslu\":\"⦐\",\"Rcaron\":\"Ř\",\"rcaron\":\"ř\",\"Rcedil\":\"Ŗ\",\"rcedil\":\"ŗ\",\"rceil\":\"⌉\",\"rcub\":\"}\",\"Rcy\":\"Р\",\"rcy\":\"р\",\"rdca\":\"⤷\",\"rdldhar\":\"⥩\",\"rdquo\":\"”\",\"rdquor\":\"”\",\"rdsh\":\"↳\",\"real\":\"ℜ\",\"realine\":\"ℛ\",\"realpart\":\"ℜ\",\"reals\":\"ℝ\",\"Re\":\"ℜ\",\"rect\":\"▭\",\"reg\":\"®\",\"REG\":\"®\",\"ReverseElement\":\"∋\",\"ReverseEquilibrium\":\"⇋\",\"ReverseUpEquilibrium\":\"⥯\",\"rfisht\":\"⥽\",\"rfloor\":\"⌋\",\"rfr\":\"𝔯\",\"Rfr\":\"ℜ\",\"rHar\":\"⥤\",\"rhard\":\"⇁\",\"rharu\":\"⇀\",\"rharul\":\"⥬\",\"Rho\":\"Ρ\",\"rho\":\"ρ\",\"rhov\":\"ϱ\",\"RightAngleBracket\":\"⟩\",\"RightArrowBar\":\"⇥\",\"rightarrow\":\"→\",\"RightArrow\":\"→\",\"Rightarrow\":\"⇒\",\"RightArrowLeftArrow\":\"⇄\",\"rightarrowtail\":\"↣\",\"RightCeiling\":\"⌉\",\"RightDoubleBracket\":\"⟧\",\"RightDownTeeVector\":\"⥝\",\"RightDownVectorBar\":\"⥕\",\"RightDownVector\":\"⇂\",\"RightFloor\":\"⌋\",\"rightharpoondown\":\"⇁\",\"rightharpoonup\":\"⇀\",\"rightleftarrows\":\"⇄\",\"rightleftharpoons\":\"⇌\",\"rightrightarrows\":\"⇉\",\"rightsquigarrow\":\"↝\",\"RightTeeArrow\":\"↦\",\"RightTee\":\"⊢\",\"RightTeeVector\":\"⥛\",\"rightthreetimes\":\"⋌\",\"RightTriangleBar\":\"⧐\",\"RightTriangle\":\"⊳\",\"RightTriangleEqual\":\"⊵\",\"RightUpDownVector\":\"⥏\",\"RightUpTeeVector\":\"⥜\",\"RightUpVectorBar\":\"⥔\",\"RightUpVector\":\"↾\",\"RightVectorBar\":\"⥓\",\"RightVector\":\"⇀\",\"ring\":\"˚\",\"risingdotseq\":\"≓\",\"rlarr\":\"⇄\",\"rlhar\":\"⇌\",\"rlm\":\"‏\",\"rmoustache\":\"⎱\",\"rmoust\":\"⎱\",\"rnmid\":\"⫮\",\"roang\":\"⟭\",\"roarr\":\"⇾\",\"robrk\":\"⟧\",\"ropar\":\"⦆\",\"ropf\":\"𝕣\",\"Ropf\":\"ℝ\",\"roplus\":\"⨮\",\"rotimes\":\"⨵\",\"RoundImplies\":\"⥰\",\"rpar\":\")\",\"rpargt\":\"⦔\",\"rppolint\":\"⨒\",\"rrarr\":\"⇉\",\"Rrightarrow\":\"⇛\",\"rsaquo\":\"›\",\"rscr\":\"𝓇\",\"Rscr\":\"ℛ\",\"rsh\":\"↱\",\"Rsh\":\"↱\",\"rsqb\":\"]\",\"rsquo\":\"’\",\"rsquor\":\"’\",\"rthree\":\"⋌\",\"rtimes\":\"⋊\",\"rtri\":\"▹\",\"rtrie\":\"⊵\",\"rtrif\":\"▸\",\"rtriltri\":\"⧎\",\"RuleDelayed\":\"⧴\",\"ruluhar\":\"⥨\",\"rx\":\"℞\",\"Sacute\":\"Ś\",\"sacute\":\"ś\",\"sbquo\":\"‚\",\"scap\":\"⪸\",\"Scaron\":\"Š\",\"scaron\":\"š\",\"Sc\":\"⪼\",\"sc\":\"≻\",\"sccue\":\"≽\",\"sce\":\"⪰\",\"scE\":\"⪴\",\"Scedil\":\"Ş\",\"scedil\":\"ş\",\"Scirc\":\"Ŝ\",\"scirc\":\"ŝ\",\"scnap\":\"⪺\",\"scnE\":\"⪶\",\"scnsim\":\"⋩\",\"scpolint\":\"⨓\",\"scsim\":\"≿\",\"Scy\":\"С\",\"scy\":\"с\",\"sdotb\":\"⊡\",\"sdot\":\"⋅\",\"sdote\":\"⩦\",\"searhk\":\"⤥\",\"searr\":\"↘\",\"seArr\":\"⇘\",\"searrow\":\"↘\",\"sect\":\"§\",\"semi\":\";\",\"seswar\":\"⤩\",\"setminus\":\"∖\",\"setmn\":\"∖\",\"sext\":\"✶\",\"Sfr\":\"𝔖\",\"sfr\":\"𝔰\",\"sfrown\":\"⌢\",\"sharp\":\"♯\",\"SHCHcy\":\"Щ\",\"shchcy\":\"щ\",\"SHcy\":\"Ш\",\"shcy\":\"ш\",\"ShortDownArrow\":\"↓\",\"ShortLeftArrow\":\"←\",\"shortmid\":\"∣\",\"shortparallel\":\"∥\",\"ShortRightArrow\":\"→\",\"ShortUpArrow\":\"↑\",\"shy\":\"­\",\"Sigma\":\"Σ\",\"sigma\":\"σ\",\"sigmaf\":\"ς\",\"sigmav\":\"ς\",\"sim\":\"∼\",\"simdot\":\"⩪\",\"sime\":\"≃\",\"simeq\":\"≃\",\"simg\":\"⪞\",\"simgE\":\"⪠\",\"siml\":\"⪝\",\"simlE\":\"⪟\",\"simne\":\"≆\",\"simplus\":\"⨤\",\"simrarr\":\"⥲\",\"slarr\":\"←\",\"SmallCircle\":\"∘\",\"smallsetminus\":\"∖\",\"smashp\":\"⨳\",\"smeparsl\":\"⧤\",\"smid\":\"∣\",\"smile\":\"⌣\",\"smt\":\"⪪\",\"smte\":\"⪬\",\"smtes\":\"⪬︀\",\"SOFTcy\":\"Ь\",\"softcy\":\"ь\",\"solbar\":\"⌿\",\"solb\":\"⧄\",\"sol\":\"/\",\"Sopf\":\"𝕊\",\"sopf\":\"𝕤\",\"spades\":\"♠\",\"spadesuit\":\"♠\",\"spar\":\"∥\",\"sqcap\":\"⊓\",\"sqcaps\":\"⊓︀\",\"sqcup\":\"⊔\",\"sqcups\":\"⊔︀\",\"Sqrt\":\"√\",\"sqsub\":\"⊏\",\"sqsube\":\"⊑\",\"sqsubset\":\"⊏\",\"sqsubseteq\":\"⊑\",\"sqsup\":\"⊐\",\"sqsupe\":\"⊒\",\"sqsupset\":\"⊐\",\"sqsupseteq\":\"⊒\",\"square\":\"□\",\"Square\":\"□\",\"SquareIntersection\":\"⊓\",\"SquareSubset\":\"⊏\",\"SquareSubsetEqual\":\"⊑\",\"SquareSuperset\":\"⊐\",\"SquareSupersetEqual\":\"⊒\",\"SquareUnion\":\"⊔\",\"squarf\":\"▪\",\"squ\":\"□\",\"squf\":\"▪\",\"srarr\":\"→\",\"Sscr\":\"𝒮\",\"sscr\":\"𝓈\",\"ssetmn\":\"∖\",\"ssmile\":\"⌣\",\"sstarf\":\"⋆\",\"Star\":\"⋆\",\"star\":\"☆\",\"starf\":\"★\",\"straightepsilon\":\"ϵ\",\"straightphi\":\"ϕ\",\"strns\":\"¯\",\"sub\":\"⊂\",\"Sub\":\"⋐\",\"subdot\":\"⪽\",\"subE\":\"⫅\",\"sube\":\"⊆\",\"subedot\":\"⫃\",\"submult\":\"⫁\",\"subnE\":\"⫋\",\"subne\":\"⊊\",\"subplus\":\"⪿\",\"subrarr\":\"⥹\",\"subset\":\"⊂\",\"Subset\":\"⋐\",\"subseteq\":\"⊆\",\"subseteqq\":\"⫅\",\"SubsetEqual\":\"⊆\",\"subsetneq\":\"⊊\",\"subsetneqq\":\"⫋\",\"subsim\":\"⫇\",\"subsub\":\"⫕\",\"subsup\":\"⫓\",\"succapprox\":\"⪸\",\"succ\":\"≻\",\"succcurlyeq\":\"≽\",\"Succeeds\":\"≻\",\"SucceedsEqual\":\"⪰\",\"SucceedsSlantEqual\":\"≽\",\"SucceedsTilde\":\"≿\",\"succeq\":\"⪰\",\"succnapprox\":\"⪺\",\"succneqq\":\"⪶\",\"succnsim\":\"⋩\",\"succsim\":\"≿\",\"SuchThat\":\"∋\",\"sum\":\"∑\",\"Sum\":\"∑\",\"sung\":\"♪\",\"sup1\":\"¹\",\"sup2\":\"²\",\"sup3\":\"³\",\"sup\":\"⊃\",\"Sup\":\"⋑\",\"supdot\":\"⪾\",\"supdsub\":\"⫘\",\"supE\":\"⫆\",\"supe\":\"⊇\",\"supedot\":\"⫄\",\"Superset\":\"⊃\",\"SupersetEqual\":\"⊇\",\"suphsol\":\"⟉\",\"suphsub\":\"⫗\",\"suplarr\":\"⥻\",\"supmult\":\"⫂\",\"supnE\":\"⫌\",\"supne\":\"⊋\",\"supplus\":\"⫀\",\"supset\":\"⊃\",\"Supset\":\"⋑\",\"supseteq\":\"⊇\",\"supseteqq\":\"⫆\",\"supsetneq\":\"⊋\",\"supsetneqq\":\"⫌\",\"supsim\":\"⫈\",\"supsub\":\"⫔\",\"supsup\":\"⫖\",\"swarhk\":\"⤦\",\"swarr\":\"↙\",\"swArr\":\"⇙\",\"swarrow\":\"↙\",\"swnwar\":\"⤪\",\"szlig\":\"ß\",\"Tab\":\"\\t\",\"target\":\"⌖\",\"Tau\":\"Τ\",\"tau\":\"τ\",\"tbrk\":\"⎴\",\"Tcaron\":\"Ť\",\"tcaron\":\"ť\",\"Tcedil\":\"Ţ\",\"tcedil\":\"ţ\",\"Tcy\":\"Т\",\"tcy\":\"т\",\"tdot\":\"⃛\",\"telrec\":\"⌕\",\"Tfr\":\"𝔗\",\"tfr\":\"𝔱\",\"there4\":\"∴\",\"therefore\":\"∴\",\"Therefore\":\"∴\",\"Theta\":\"Θ\",\"theta\":\"θ\",\"thetasym\":\"ϑ\",\"thetav\":\"ϑ\",\"thickapprox\":\"≈\",\"thicksim\":\"∼\",\"ThickSpace\":\"  \",\"ThinSpace\":\" \",\"thinsp\":\" \",\"thkap\":\"≈\",\"thksim\":\"∼\",\"THORN\":\"Þ\",\"thorn\":\"þ\",\"tilde\":\"˜\",\"Tilde\":\"∼\",\"TildeEqual\":\"≃\",\"TildeFullEqual\":\"≅\",\"TildeTilde\":\"≈\",\"timesbar\":\"⨱\",\"timesb\":\"⊠\",\"times\":\"×\",\"timesd\":\"⨰\",\"tint\":\"∭\",\"toea\":\"⤨\",\"topbot\":\"⌶\",\"topcir\":\"⫱\",\"top\":\"⊤\",\"Topf\":\"𝕋\",\"topf\":\"𝕥\",\"topfork\":\"⫚\",\"tosa\":\"⤩\",\"tprime\":\"‴\",\"trade\":\"™\",\"TRADE\":\"™\",\"triangle\":\"▵\",\"triangledown\":\"▿\",\"triangleleft\":\"◃\",\"trianglelefteq\":\"⊴\",\"triangleq\":\"≜\",\"triangleright\":\"▹\",\"trianglerighteq\":\"⊵\",\"tridot\":\"◬\",\"trie\":\"≜\",\"triminus\":\"⨺\",\"TripleDot\":\"⃛\",\"triplus\":\"⨹\",\"trisb\":\"⧍\",\"tritime\":\"⨻\",\"trpezium\":\"⏢\",\"Tscr\":\"𝒯\",\"tscr\":\"𝓉\",\"TScy\":\"Ц\",\"tscy\":\"ц\",\"TSHcy\":\"Ћ\",\"tshcy\":\"ћ\",\"Tstrok\":\"Ŧ\",\"tstrok\":\"ŧ\",\"twixt\":\"≬\",\"twoheadleftarrow\":\"↞\",\"twoheadrightarrow\":\"↠\",\"Uacute\":\"Ú\",\"uacute\":\"ú\",\"uarr\":\"↑\",\"Uarr\":\"↟\",\"uArr\":\"⇑\",\"Uarrocir\":\"⥉\",\"Ubrcy\":\"Ў\",\"ubrcy\":\"ў\",\"Ubreve\":\"Ŭ\",\"ubreve\":\"ŭ\",\"Ucirc\":\"Û\",\"ucirc\":\"û\",\"Ucy\":\"У\",\"ucy\":\"у\",\"udarr\":\"⇅\",\"Udblac\":\"Ű\",\"udblac\":\"ű\",\"udhar\":\"⥮\",\"ufisht\":\"⥾\",\"Ufr\":\"𝔘\",\"ufr\":\"𝔲\",\"Ugrave\":\"Ù\",\"ugrave\":\"ù\",\"uHar\":\"⥣\",\"uharl\":\"↿\",\"uharr\":\"↾\",\"uhblk\":\"▀\",\"ulcorn\":\"⌜\",\"ulcorner\":\"⌜\",\"ulcrop\":\"⌏\",\"ultri\":\"◸\",\"Umacr\":\"Ū\",\"umacr\":\"ū\",\"uml\":\"¨\",\"UnderBar\":\"_\",\"UnderBrace\":\"⏟\",\"UnderBracket\":\"⎵\",\"UnderParenthesis\":\"⏝\",\"Union\":\"⋃\",\"UnionPlus\":\"⊎\",\"Uogon\":\"Ų\",\"uogon\":\"ų\",\"Uopf\":\"𝕌\",\"uopf\":\"𝕦\",\"UpArrowBar\":\"⤒\",\"uparrow\":\"↑\",\"UpArrow\":\"↑\",\"Uparrow\":\"⇑\",\"UpArrowDownArrow\":\"⇅\",\"updownarrow\":\"↕\",\"UpDownArrow\":\"↕\",\"Updownarrow\":\"⇕\",\"UpEquilibrium\":\"⥮\",\"upharpoonleft\":\"↿\",\"upharpoonright\":\"↾\",\"uplus\":\"⊎\",\"UpperLeftArrow\":\"↖\",\"UpperRightArrow\":\"↗\",\"upsi\":\"υ\",\"Upsi\":\"ϒ\",\"upsih\":\"ϒ\",\"Upsilon\":\"Υ\",\"upsilon\":\"υ\",\"UpTeeArrow\":\"↥\",\"UpTee\":\"⊥\",\"upuparrows\":\"⇈\",\"urcorn\":\"⌝\",\"urcorner\":\"⌝\",\"urcrop\":\"⌎\",\"Uring\":\"Ů\",\"uring\":\"ů\",\"urtri\":\"◹\",\"Uscr\":\"𝒰\",\"uscr\":\"𝓊\",\"utdot\":\"⋰\",\"Utilde\":\"Ũ\",\"utilde\":\"ũ\",\"utri\":\"▵\",\"utrif\":\"▴\",\"uuarr\":\"⇈\",\"Uuml\":\"Ü\",\"uuml\":\"ü\",\"uwangle\":\"⦧\",\"vangrt\":\"⦜\",\"varepsilon\":\"ϵ\",\"varkappa\":\"ϰ\",\"varnothing\":\"∅\",\"varphi\":\"ϕ\",\"varpi\":\"ϖ\",\"varpropto\":\"∝\",\"varr\":\"↕\",\"vArr\":\"⇕\",\"varrho\":\"ϱ\",\"varsigma\":\"ς\",\"varsubsetneq\":\"⊊︀\",\"varsubsetneqq\":\"⫋︀\",\"varsupsetneq\":\"⊋︀\",\"varsupsetneqq\":\"⫌︀\",\"vartheta\":\"ϑ\",\"vartriangleleft\":\"⊲\",\"vartriangleright\":\"⊳\",\"vBar\":\"⫨\",\"Vbar\":\"⫫\",\"vBarv\":\"⫩\",\"Vcy\":\"В\",\"vcy\":\"в\",\"vdash\":\"⊢\",\"vDash\":\"⊨\",\"Vdash\":\"⊩\",\"VDash\":\"⊫\",\"Vdashl\":\"⫦\",\"veebar\":\"⊻\",\"vee\":\"∨\",\"Vee\":\"⋁\",\"veeeq\":\"≚\",\"vellip\":\"⋮\",\"verbar\":\"|\",\"Verbar\":\"‖\",\"vert\":\"|\",\"Vert\":\"‖\",\"VerticalBar\":\"∣\",\"VerticalLine\":\"|\",\"VerticalSeparator\":\"❘\",\"VerticalTilde\":\"≀\",\"VeryThinSpace\":\" \",\"Vfr\":\"𝔙\",\"vfr\":\"𝔳\",\"vltri\":\"⊲\",\"vnsub\":\"⊂⃒\",\"vnsup\":\"⊃⃒\",\"Vopf\":\"𝕍\",\"vopf\":\"𝕧\",\"vprop\":\"∝\",\"vrtri\":\"⊳\",\"Vscr\":\"𝒱\",\"vscr\":\"𝓋\",\"vsubnE\":\"⫋︀\",\"vsubne\":\"⊊︀\",\"vsupnE\":\"⫌︀\",\"vsupne\":\"⊋︀\",\"Vvdash\":\"⊪\",\"vzigzag\":\"⦚\",\"Wcirc\":\"Ŵ\",\"wcirc\":\"ŵ\",\"wedbar\":\"⩟\",\"wedge\":\"∧\",\"Wedge\":\"⋀\",\"wedgeq\":\"≙\",\"weierp\":\"℘\",\"Wfr\":\"𝔚\",\"wfr\":\"𝔴\",\"Wopf\":\"𝕎\",\"wopf\":\"𝕨\",\"wp\":\"℘\",\"wr\":\"≀\",\"wreath\":\"≀\",\"Wscr\":\"𝒲\",\"wscr\":\"𝓌\",\"xcap\":\"⋂\",\"xcirc\":\"◯\",\"xcup\":\"⋃\",\"xdtri\":\"▽\",\"Xfr\":\"𝔛\",\"xfr\":\"𝔵\",\"xharr\":\"⟷\",\"xhArr\":\"⟺\",\"Xi\":\"Ξ\",\"xi\":\"ξ\",\"xlarr\":\"⟵\",\"xlArr\":\"⟸\",\"xmap\":\"⟼\",\"xnis\":\"⋻\",\"xodot\":\"⨀\",\"Xopf\":\"𝕏\",\"xopf\":\"𝕩\",\"xoplus\":\"⨁\",\"xotime\":\"⨂\",\"xrarr\":\"⟶\",\"xrArr\":\"⟹\",\"Xscr\":\"𝒳\",\"xscr\":\"𝓍\",\"xsqcup\":\"⨆\",\"xuplus\":\"⨄\",\"xutri\":\"△\",\"xvee\":\"⋁\",\"xwedge\":\"⋀\",\"Yacute\":\"Ý\",\"yacute\":\"ý\",\"YAcy\":\"Я\",\"yacy\":\"я\",\"Ycirc\":\"Ŷ\",\"ycirc\":\"ŷ\",\"Ycy\":\"Ы\",\"ycy\":\"ы\",\"yen\":\"¥\",\"Yfr\":\"𝔜\",\"yfr\":\"𝔶\",\"YIcy\":\"Ї\",\"yicy\":\"ї\",\"Yopf\":\"𝕐\",\"yopf\":\"𝕪\",\"Yscr\":\"𝒴\",\"yscr\":\"𝓎\",\"YUcy\":\"Ю\",\"yucy\":\"ю\",\"yuml\":\"ÿ\",\"Yuml\":\"Ÿ\",\"Zacute\":\"Ź\",\"zacute\":\"ź\",\"Zcaron\":\"Ž\",\"zcaron\":\"ž\",\"Zcy\":\"З\",\"zcy\":\"з\",\"Zdot\":\"Ż\",\"zdot\":\"ż\",\"zeetrf\":\"ℨ\",\"ZeroWidthSpace\":\"​\",\"Zeta\":\"Ζ\",\"zeta\":\"ζ\",\"zfr\":\"𝔷\",\"Zfr\":\"ℨ\",\"ZHcy\":\"Ж\",\"zhcy\":\"ж\",\"zigrarr\":\"⇝\",\"zopf\":\"𝕫\",\"Zopf\":\"ℤ\",\"Zscr\":\"𝒵\",\"zscr\":\"𝓏\",\"zwj\":\"‍\",\"zwnj\":\"‌\"}");

/***/ }),
/* 16 */
/***/ (function(module) {

module.exports = JSON.parse("{\"amp\":\"&\",\"apos\":\"'\",\"gt\":\">\",\"lt\":\"<\",\"quot\":\"\\\"\"}");

/***/ }),
/* 17 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.escape = exports.encodeHTML = exports.encodeXML = void 0;
var xml_json_1 = __importDefault(__webpack_require__(16));
var inverseXML = getInverseObj(xml_json_1.default);
var xmlReplacer = getInverseReplacer(inverseXML);
exports.encodeXML = getInverse(inverseXML, xmlReplacer);
var entities_json_1 = __importDefault(__webpack_require__(15));
var inverseHTML = getInverseObj(entities_json_1.default);
var htmlReplacer = getInverseReplacer(inverseHTML);
exports.encodeHTML = getInverse(inverseHTML, htmlReplacer);
function getInverseObj(obj) {
    return Object.keys(obj)
        .sort()
        .reduce(function (inverse, name) {
        inverse[obj[name]] = "&" + name + ";";
        return inverse;
    }, {});
}
function getInverseReplacer(inverse) {
    var single = [];
    var multiple = [];
    for (var _i = 0, _a = Object.keys(inverse); _i < _a.length; _i++) {
        var k = _a[_i];
        if (k.length === 1) {
            // Add value to single array
            single.push("\\" + k);
        }
        else {
            // Add value to multiple array
            multiple.push(k);
        }
    }
    // Add ranges to single characters.
    single.sort();
    for (var start = 0; start < single.length - 1; start++) {
        // Find the end of a run of characters
        var end = start;
        while (end < single.length - 1 &&
            single[end].charCodeAt(1) + 1 === single[end + 1].charCodeAt(1)) {
            end += 1;
        }
        var count = 1 + end - start;
        // We want to replace at least three characters
        if (count < 3)
            continue;
        single.splice(start, count, single[start] + "-" + single[end]);
    }
    multiple.unshift("[" + single.join("") + "]");
    return new RegExp(multiple.join("|"), "g");
}
var reNonASCII = /(?:[\x80-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/g;
function singleCharReplacer(c) {
    // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
    return "&#x" + c.codePointAt(0).toString(16).toUpperCase() + ";";
}
function getInverse(inverse, re) {
    return function (data) {
        return data
            .replace(re, function (name) { return inverse[name]; })
            .replace(reNonASCII, singleCharReplacer);
    };
}
var reXmlChars = getInverseReplacer(inverseXML);
function escape(data) {
    return data
        .replace(reXmlChars, singleCharReplacer)
        .replace(reNonASCII, singleCharReplacer);
}
exports.escape = escape;


/***/ }),
/* 18 */
/***/ (function(module, exports) {

module.exports = function(module) {
	if (!module.webpackPolyfill) {
		module.deprecate = function() {};
		module.paths = [];
		// module.parent = undefined by default
		if (!module.children) module.children = [];
		Object.defineProperty(module, "loaded", {
			enumerable: true,
			get: function() {
				return module.l;
			}
		});
		Object.defineProperty(module, "id", {
			enumerable: true,
			get: function() {
				return module.i;
			}
		});
		module.webpackPolyfill = 1;
	}
	return module;
};


/***/ }),
/* 19 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.swapIndices = exports.isValidArrayIndex = void 0;
var ramda_1 = __webpack_require__(4);
exports.isValidArrayIndex = function (xs) { return function (i) { return i >= 0 && i < xs.length; }; };
exports.swapIndices = function (i) { return function (j) { return function (xs) {
    if (!exports.isValidArrayIndex(xs)(i) || !exports.isValidArrayIndex(xs)(j)) {
        return xs;
    }
    var iOldVal = xs[i];
    return ramda_1.pipe(ramda_1.update(i, xs[j]), ramda_1.update(j, iOldVal))(xs);
}; }; };


/***/ }),
/* 20 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var __awaiter = (this && this.__awaiter) || function (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());
    });
};
var __generator = (this && this.__generator) || function (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 };
    }
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ruqqusPostEmbed = void 0;
var EmbedProcessor_1 = __webpack_require__(2);
var ExpandoButtonModule_1 = __webpack_require__(1);
var RuqqusPostEmbed = /** @class */ (function (_super) {
    __extends(RuqqusPostEmbed, _super);
    function RuqqusPostEmbed() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    RuqqusPostEmbed.prototype.genRegex = function () {
        return /^https:\/\/(?:ruqqus\.com\/\+\w+\/post|ruqq\.us)\/([\w]+)(?:\/.*)?$/g;
    };
    RuqqusPostEmbed.prototype.processMatchingLink = function (_a) {
        var link = _a.link, box = _a.box, cfg = _a.cfg, postInfo = _a.postInfo;
        return __awaiter(this, void 0, void 0, function () {
            var id, el;
            return __generator(this, function (_b) {
                if (postInfo.textPost) {
                    return [2 /*return*/, false];
                }
                id = this.matchAllAndGetCapturedPart(link);
                if (!id) {
                    ExpandoButtonModule_1.ExpandoButtonModule.writeErrorToExpandButtonBox(box, "Failed to extract id of a post from: \"" + link + "\"");
                    return [2 /*return*/, true];
                }
                el = $("\n<div class=\"embed-responsive embed-responsive-16by9\">\n    <iframe src=\"https://ruqqus.com/embed/post/" + id + "\" allow=\"accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen=\"\" frameborder=\"0\"></iframe>\n</div>\n    ");
                ExpandoButtonModule_1.ExpandoButtonModule.insertWrappedElementIntoBox(box, el);
                return [2 /*return*/, true];
            });
        });
    };
    return RuqqusPostEmbed;
}(EmbedProcessor_1.EmbedProcessor));
exports.ruqqusPostEmbed = new RuqqusPostEmbed();


/***/ }),
/* 21 */
/***/ (function(module, exports, __webpack_require__) {

/* WEBPACK VAR INJECTION */(function(global) {/**
 * lodash (Custom Build) <https://lodash.com/>
 * Build: `lodash modularize exports="npm" -o ./`
 * Copyright jQuery Foundation and other contributors <https://jquery.org/>
 * Released under MIT license <https://lodash.com/license>
 * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
 */

/** Used as the `TypeError` message for "Functions" methods. */
var FUNC_ERROR_TEXT = 'Expected a function';

/** Used as references for various `Number` constants. */
var NAN = 0 / 0;

/** `Object#toString` result references. */
var symbolTag = '[object Symbol]';

/** Used to match leading and trailing whitespace. */
var reTrim = /^\s+|\s+$/g;

/** Used to detect bad signed hexadecimal string values. */
var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;

/** Used to detect binary string values. */
var reIsBinary = /^0b[01]+$/i;

/** Used to detect octal string values. */
var reIsOctal = /^0o[0-7]+$/i;

/** Built-in method references without a dependency on `root`. */
var freeParseInt = parseInt;

/** Detect free variable `global` from Node.js. */
var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;

/** Detect free variable `self`. */
var freeSelf = typeof self == 'object' && self && self.Object === Object && self;

/** Used as a reference to the global object. */
var root = freeGlobal || freeSelf || Function('return this')();

/** Used for built-in method references. */
var objectProto = Object.prototype;

/**
 * Used to resolve the
 * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
 * of values.
 */
var objectToString = objectProto.toString;

/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeMax = Math.max,
    nativeMin = Math.min;

/**
 * Gets the timestamp of the number of milliseconds that have elapsed since
 * the Unix epoch (1 January 1970 00:00:00 UTC).
 *
 * @static
 * @memberOf _
 * @since 2.4.0
 * @category Date
 * @returns {number} Returns the timestamp.
 * @example
 *
 * _.defer(function(stamp) {
 *   console.log(_.now() - stamp);
 * }, _.now());
 * // => Logs the number of milliseconds it took for the deferred invocation.
 */
var now = function() {
  return root.Date.now();
};

/**
 * Creates a debounced function that delays invoking `func` until after `wait`
 * milliseconds have elapsed since the last time the debounced function was
 * invoked. The debounced function comes with a `cancel` method to cancel
 * delayed `func` invocations and a `flush` method to immediately invoke them.
 * Provide `options` to indicate whether `func` should be invoked on the
 * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
 * with the last arguments provided to the debounced function. Subsequent
 * calls to the debounced function return the result of the last `func`
 * invocation.
 *
 * **Note:** If `leading` and `trailing` options are `true`, `func` is
 * invoked on the trailing edge of the timeout only if the debounced function
 * is invoked more than once during the `wait` timeout.
 *
 * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
 * until to the next tick, similar to `setTimeout` with a timeout of `0`.
 *
 * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
 * for details over the differences between `_.debounce` and `_.throttle`.
 *
 * @static
 * @memberOf _
 * @since 0.1.0
 * @category Function
 * @param {Function} func The function to debounce.
 * @param {number} [wait=0] The number of milliseconds to delay.
 * @param {Object} [options={}] The options object.
 * @param {boolean} [options.leading=false]
 *  Specify invoking on the leading edge of the timeout.
 * @param {number} [options.maxWait]
 *  The maximum time `func` is allowed to be delayed before it's invoked.
 * @param {boolean} [options.trailing=true]
 *  Specify invoking on the trailing edge of the timeout.
 * @returns {Function} Returns the new debounced function.
 * @example
 *
 * // Avoid costly calculations while the window size is in flux.
 * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
 *
 * // Invoke `sendMail` when clicked, debouncing subsequent calls.
 * jQuery(element).on('click', _.debounce(sendMail, 300, {
 *   'leading': true,
 *   'trailing': false
 * }));
 *
 * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
 * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
 * var source = new EventSource('/stream');
 * jQuery(source).on('message', debounced);
 *
 * // Cancel the trailing debounced invocation.
 * jQuery(window).on('popstate', debounced.cancel);
 */
function debounce(func, wait, options) {
  var lastArgs,
      lastThis,
      maxWait,
      result,
      timerId,
      lastCallTime,
      lastInvokeTime = 0,
      leading = false,
      maxing = false,
      trailing = true;

  if (typeof func != 'function') {
    throw new TypeError(FUNC_ERROR_TEXT);
  }
  wait = toNumber(wait) || 0;
  if (isObject(options)) {
    leading = !!options.leading;
    maxing = 'maxWait' in options;
    maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
    trailing = 'trailing' in options ? !!options.trailing : trailing;
  }

  function invokeFunc(time) {
    var args = lastArgs,
        thisArg = lastThis;

    lastArgs = lastThis = undefined;
    lastInvokeTime = time;
    result = func.apply(thisArg, args);
    return result;
  }

  function leadingEdge(time) {
    // Reset any `maxWait` timer.
    lastInvokeTime = time;
    // Start the timer for the trailing edge.
    timerId = setTimeout(timerExpired, wait);
    // Invoke the leading edge.
    return leading ? invokeFunc(time) : result;
  }

  function remainingWait(time) {
    var timeSinceLastCall = time - lastCallTime,
        timeSinceLastInvoke = time - lastInvokeTime,
        result = wait - timeSinceLastCall;

    return maxing ? nativeMin(result, maxWait - timeSinceLastInvoke) : result;
  }

  function shouldInvoke(time) {
    var timeSinceLastCall = time - lastCallTime,
        timeSinceLastInvoke = time - lastInvokeTime;

    // Either this is the first call, activity has stopped and we're at the
    // trailing edge, the system time has gone backwards and we're treating
    // it as the trailing edge, or we've hit the `maxWait` limit.
    return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
      (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
  }

  function timerExpired() {
    var time = now();
    if (shouldInvoke(time)) {
      return trailingEdge(time);
    }
    // Restart the timer.
    timerId = setTimeout(timerExpired, remainingWait(time));
  }

  function trailingEdge(time) {
    timerId = undefined;

    // Only invoke if we have `lastArgs` which means `func` has been
    // debounced at least once.
    if (trailing && lastArgs) {
      return invokeFunc(time);
    }
    lastArgs = lastThis = undefined;
    return result;
  }

  function cancel() {
    if (timerId !== undefined) {
      clearTimeout(timerId);
    }
    lastInvokeTime = 0;
    lastArgs = lastCallTime = lastThis = timerId = undefined;
  }

  function flush() {
    return timerId === undefined ? result : trailingEdge(now());
  }

  function debounced() {
    var time = now(),
        isInvoking = shouldInvoke(time);

    lastArgs = arguments;
    lastThis = this;
    lastCallTime = time;

    if (isInvoking) {
      if (timerId === undefined) {
        return leadingEdge(lastCallTime);
      }
      if (maxing) {
        // Handle invocations in a tight loop.
        timerId = setTimeout(timerExpired, wait);
        return invokeFunc(lastCallTime);
      }
    }
    if (timerId === undefined) {
      timerId = setTimeout(timerExpired, wait);
    }
    return result;
  }
  debounced.cancel = cancel;
  debounced.flush = flush;
  return debounced;
}

/**
 * Checks if `value` is the
 * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
 * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
 *
 * @static
 * @memberOf _
 * @since 0.1.0
 * @category Lang
 * @param {*} value The value to check.
 * @returns {boolean} Returns `true` if `value` is an object, else `false`.
 * @example
 *
 * _.isObject({});
 * // => true
 *
 * _.isObject([1, 2, 3]);
 * // => true
 *
 * _.isObject(_.noop);
 * // => true
 *
 * _.isObject(null);
 * // => false
 */
function isObject(value) {
  var type = typeof value;
  return !!value && (type == 'object' || type == 'function');
}

/**
 * Checks if `value` is object-like. A value is object-like if it's not `null`
 * and has a `typeof` result of "object".
 *
 * @static
 * @memberOf _
 * @since 4.0.0
 * @category Lang
 * @param {*} value The value to check.
 * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
 * @example
 *
 * _.isObjectLike({});
 * // => true
 *
 * _.isObjectLike([1, 2, 3]);
 * // => true
 *
 * _.isObjectLike(_.noop);
 * // => false
 *
 * _.isObjectLike(null);
 * // => false
 */
function isObjectLike(value) {
  return !!value && typeof value == 'object';
}

/**
 * Checks if `value` is classified as a `Symbol` primitive or object.
 *
 * @static
 * @memberOf _
 * @since 4.0.0
 * @category Lang
 * @param {*} value The value to check.
 * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
 * @example
 *
 * _.isSymbol(Symbol.iterator);
 * // => true
 *
 * _.isSymbol('abc');
 * // => false
 */
function isSymbol(value) {
  return typeof value == 'symbol' ||
    (isObjectLike(value) && objectToString.call(value) == symbolTag);
}

/**
 * Converts `value` to a number.
 *
 * @static
 * @memberOf _
 * @since 4.0.0
 * @category Lang
 * @param {*} value The value to process.
 * @returns {number} Returns the number.
 * @example
 *
 * _.toNumber(3.2);
 * // => 3.2
 *
 * _.toNumber(Number.MIN_VALUE);
 * // => 5e-324
 *
 * _.toNumber(Infinity);
 * // => Infinity
 *
 * _.toNumber('3.2');
 * // => 3.2
 */
function toNumber(value) {
  if (typeof value == 'number') {
    return value;
  }
  if (isSymbol(value)) {
    return NAN;
  }
  if (isObject(value)) {
    var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
    value = isObject(other) ? (other + '') : other;
  }
  if (typeof value != 'string') {
    return value === 0 ? value : +value;
  }
  value = value.replace(reTrim, '');
  var isBinary = reIsBinary.test(value);
  return (isBinary || reIsOctal.test(value))
    ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
    : (reIsBadHex.test(value) ? NAN : +value);
}

module.exports = debounce;

/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(12)))

/***/ }),
/* 22 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.renderMarkdown = void 0;
var marked_1 = __importDefault(__webpack_require__(67));
var ramda_1 = __webpack_require__(4);
var processUserMentions = function (x) { return x.replace(/(?:^|\W)(@\w{3,25})/g, function (_, x) { return " <a href=\"/" + x + "\" target=\"_blank\"><img class=\"profile-pic-20 mr-1\" src=\"/" + x + "/pic/profile\">" + x + "</a>"; }); };
var processGuildMentions = function (x) { return x.replace(/(?:^|\s)(\+\w{3,25})/g, function (_, x) { return " <a href=\"/" + x + "\" target=\"_blank\"><img class=\"profile-pic-20 mr-1\" src=\"/" + x + "/pic/profile\">" + x + "</a>"; }); };
var options = {
    renderer: {
        image: function (href, title, text) {
            var style = "max-height: 100px; max-width: 100%;";
            return "<img class=\"in-comment-image rounded-sm my-2\" rel=\"nofollow\" src=\"" + href + "\" style=\"" + style + "\">";
        },
        text: function (text) {
            return ramda_1.pipe(processUserMentions, processGuildMentions)(text);
        },
        link: function (href, title, text) {
            return "<a href=\"" + href + "\" target=\"_blank\">" + text + "</a>";
        }
    }
};
marked_1.default.use(options);
exports.renderMarkdown = function (x) {
    return marked_1.default(x);
};


/***/ }),
/* 23 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var __read = (this && this.__read) || function (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;
};
var __spread = (this && this.__spread) || function () {
    for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
    return ar;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ImageUploadButton = void 0;
var styles_1 = __webpack_require__(3);
var logo_svg_1 = __importDefault(__webpack_require__(8));
var common_1 = __webpack_require__(0);
var ImgBbHelpers_1 = __webpack_require__(70);
var ts_matcher_1 = __importDefault(__webpack_require__(24));
var ImageUploadButton = /** @class */ (function () {
    function ImageUploadButton() {
    }
    ImageUploadButton.addLoadingEffectsToButton = function (btn) {
        btn.prop('disabled', true).addClass(styles_1.uploadImageToImgbbButtonLoadingCls);
    };
    ImageUploadButton.removeLoadingEffectsFromButton = function (btn) {
        btn.prop('disabled', false).removeClass(styles_1.uploadImageToImgbbButtonLoadingCls);
    };
    ImageUploadButton.genUploadButton = function (type, cfg, onSuccess) {
        var btn = ts_matcher_1.default(type)
            .case('POST', function () {
            return $('<a>')
                .addClass('btn btn-secondary')
                .html(logo_svg_1.default)
                .append('Upload image')
                .addClass(styles_1.uploadImageToImgbbButtonCls);
        })
            .case('COMMENT', function () {
            return common_1.createSmallCommentButton('img')
                .addClass([styles_1.uploadImageToImgbbButtonCls, styles_1.uploadImageToImgbbButtonSmallCls])
                .prop('title', "[RuqES] Upload an image to the configured image service and insert corresponding markdown code");
        })
            .exec();
        var removeHighlight = function () { return btn.removeClass(styles_1.uploadImageToImgbbButtonHighlightedCls); };
        var onDropOnImgBbUploadButton = function (evt) {
            common_1.preventDefaults(evt);
            if (btn.hasClass(styles_1.uploadImageToImgbbButtonLoadingCls)) {
                common_1.debugLog('genUploadButton - ignoring, loading already in progress', evt);
                return;
            }
            var dt = evt.dataTransfer || evt.originalEvent.dataTransfer;
            var files = __spread(dt.files);
            common_1.debugLog('genUploadButton', 'drop', dt || 'missing DT', files || 'missing files', evt);
            removeHighlight();
            ImageUploadButton.addLoadingEffectsToButton(btn);
            var file = files[0];
            if (file) {
                ImgBbHelpers_1.uploadImageToImgBb({
                    cfg: cfg,
                    file: file,
                    onError: function (resp) {
                        ImageUploadButton.removeLoadingEffectsFromButton(btn);
                        alert("drop upload failed: " + resp.status + "\n" + resp.response);
                    },
                    onSuccess: function (url) {
                        ImageUploadButton.removeLoadingEffectsFromButton(btn);
                        onSuccess(url);
                    },
                });
            }
        };
        btn
            .on('dragover', function (evt) {
            common_1.preventDefaults(evt);
            btn.addClass(styles_1.uploadImageToImgbbButtonHighlightedCls);
        })
            .on('dragleave', function (evt) {
            common_1.preventDefaults(evt);
            removeHighlight();
        })
            .on('drop', onDropOnImgBbUploadButton);
        btn.on('click', ImageUploadButton.genClickHandler(cfg, btn, onSuccess));
        return btn;
    };
    ImageUploadButton.genClickHandler = function (cfg, el, onSuccess) { return function (evt) {
        common_1.debugLog('genClickHandler', cfg, el, evt);
        if (el.hasClass(styles_1.uploadImageToImgbbButtonLoadingCls)) {
            common_1.debugLog('genClickHandler - ignoring click, loading already in progress');
            return;
        }
        common_1.$c(styles_1.imageUploadInputCls).remove();
        var fileInput = $('<input type="file" class="d-none" accept="image/x-png,image/gif,image/jpeg">').addClass(styles_1.imageUploadInputCls);
        var enable = function () { return ImageUploadButton.removeLoadingEffectsFromButton(el); };
        var onError = function (err) {
            common_1.debugLog('onError', err);
            alert("Upload failed: " + err.status + "\n" + err.response);
            enable();
        };
        fileInput.change(function (evt) {
            common_1.debugLog('fileInput.change', evt);
            var files = fileInput.prop('files');
            if (!files || !files[0]) {
                return;
            }
            ImageUploadButton.addLoadingEffectsToButton(el);
            var file = files[0];
            common_1.debugLog('got pic for upload', file);
            if (file) {
                ImgBbHelpers_1.uploadImageToImgBb({
                    cfg: cfg,
                    file: file,
                    onSuccess: function (url) {
                        onSuccess(url);
                        enable();
                    },
                    onError: onError,
                });
            }
        });
        $('body').append(fileInput);
        fileInput.click();
    }; };
    return ImageUploadButton;
}());
exports.ImageUploadButton = ImageUploadButton;


/***/ }),
/* 24 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.Matching = exports.MatchingEmpty = exports.EqualityChecker = void 0;
var Utils = /** @class */ (function () {
    function Utils() {
    }
    Utils.any = function (xs, pred) {
        return xs.map(pred).filter(function (x) { return x; }).length > 0;
    };
    return Utils;
}());
var EqualityChecker = /** @class */ (function () {
    function EqualityChecker() {
    }
    EqualityChecker.initialize = function (isEqualFn) {
        if (isEqualFn) {
            EqualityChecker.isEqual = isEqualFn;
            EqualityChecker.equalFunctionType = 'custom';
        }
        else {
            try {
                EqualityChecker.isEqual = __webpack_require__(71);
                EqualityChecker.equalFunctionType = 'lodash';
            }
            catch (e) {
                EqualityChecker.isEqual = function (a, b, _) { return a === b; };
                EqualityChecker.equalFunctionType = '===';
            }
        }
    };
    return EqualityChecker;
}());
exports.EqualityChecker = EqualityChecker;
EqualityChecker.initialize();
/**
 * Matcher without any cases yet.
 */
var MatchingEmpty = /** @class */ (function () {
    /** @internal */
    function MatchingEmpty(value) {
        this.value = value;
    }
    /**
     * {@see Matching#case}.
     */
    MatchingEmpty.prototype.case = function (test, onMatch, customizer) {
        return this.createMatching().case(test, onMatch, customizer);
    };
    /**
     * {@see Matching#caseMulti}.
     */
    MatchingEmpty.prototype.caseMulti = function (tests, onMatch, customizer) {
        return this.createMatching().caseMulti(tests, onMatch, customizer);
    };
    /**
     * {@see Matching#caseGuarded}.
     */
    MatchingEmpty.prototype.caseGuarded = function (test, onMatch) {
        return this.createMatching().caseGuarded(test, onMatch);
    };
    MatchingEmpty.prototype.createMatching = function () {
        return new Matching(this.value, []);
    };
    return MatchingEmpty;
}());
exports.MatchingEmpty = MatchingEmpty;
/**
 * Matcher with some cases.
 */
var Matching = /** @class */ (function () {
    /** @internal */
    function Matching(value, tests) {
        this.value = value;
        this.tests = tests;
    }
    /**
     * Creates one case. During execution value is being compared to {@param test} and if it matches {@param onMatch} is
     * called and its return value returned.
     * @param test - value to match against
     * @param onMatch - successful match handler
     * @param customizer - optional parameter used for customizing equality checking
     * @return {@link Matching} object for adding more cases and as a last call in a chain invoking
     *                          an execution - {@link exec}.
     */
    Matching.prototype.case = function (test, onMatch, customizer) {
        return this.caseGuarded(function (x) { return EqualityChecker.isEqual(x, test, customizer); }, onMatch);
    };
    /**
     * Creates multiple cases. During execution value is being compared to items in {@param tests} and if
     * any of it matches, {@param onMatch} is called and its return value returned.
     * @param tests - value to match against
     * @param onMatch - successful match handler
     * @param customizer - optional parameter used for customizing equality checking
     * @return {@link Matching} object for adding more cases and as a last call in a chain invoking
     *                          an execution - {@link exec}.
     */
    Matching.prototype.caseMulti = function (tests, onMatch, customizer) {
        return this.caseGuarded(function (x) { return Utils.any(tests, function (y) { return EqualityChecker.isEqual(x, y, customizer); }); }, onMatch);
    };
    /**
     * Creates one case.
     * More generic variant of {@link case}. Accepts a function instead of a value to compare.
     * @param test - function doing the test
     * @param onMatch - successful match handler
     * @return
     */
    Matching.prototype.caseGuarded = function (test, onMatch) {
        this.test = test;
        this.onMatch = onMatch;
        return new Matching(this.value, this.tests.concat(this));
    };
    /**
     * Creates default case.
     * @param onMatch - successful match handler (always run if every case before has failed)
     * @return
     */
    Matching.prototype.default = function (onMatch) {
        return this.caseGuarded(function () { return true; }, onMatch);
    };
    /**
     * Evaluates - runs sequentially all cases and finds first test retuning true.
     * When successful case is found then is called its onMatch handler and its return value is returned.
     * @return return value from onMatch handler
     */
    Matching.prototype.exec = function () {
        return this.processMatching(this.tests);
    };
    /**
     * Evaluates (in a same way as {@link #exec}) and applies passed handler.
     * @param resultHandler - function which will be applied on a result generated by a matching case handler
     */
    Matching.prototype.execMap = function (resultHandler) {
        return resultHandler(this.exec());
    };
    /**
     * Goes through all cases. When matching case is found invokes handler and returns result from handler.
     * @param remaining - remaining cases to go through
     */
    Matching.prototype.processMatching = function (remaining) {
        if (remaining.length <= 0) {
            throw new Error("Unmatched value " + this.value + ".");
        }
        var cur = remaining[0];
        return cur.test(this.value) ? cur.onMatch(this.value) : this.processMatching(remaining.slice(1));
    };
    return Matching;
}());
exports.Matching = Matching;
var f = function (input) {
    return new MatchingEmpty(input);
};
exports.default = f;
//# sourceMappingURL=Matcher.js.map

/***/ }),
/* 25 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.setupDebugEventListeners = exports.emitInfiniteScrollLoadFail = exports.emitInfiniteScrollLoadStart = exports.emitInfiniteScrollLoaded = void 0;
var domUtils_1 = __webpack_require__(10);
var emitEvent = function (name, data) {
    var evt = new CustomEvent("ruqes" + name, { bubbles: true, detail: data });
    document.dispatchEvent(evt);
};
exports.emitInfiniteScrollLoaded = function (pageNumber, url, pageElement) {
    emitEvent('infinitescrollload', { pageNumber: pageNumber, url: url, pageElement: pageElement });
};
exports.emitInfiniteScrollLoadStart = function (pageNumber, url) {
    emitEvent('infinitescrollloadstart', { pageNumber: pageNumber, url: url });
};
exports.emitInfiniteScrollLoadFail = function (url, status, statusText) {
    emitEvent('infinitescrollloaderror', { url: url, status: status, statusText: statusText });
};
exports.setupDebugEventListeners = function () {
    domUtils_1.addCustomScript("\ndocument.addEventListener('ruqesinfinitescrollload', evt => console.log('DOC got infi scroll LOAD event', evt));\nwindow.addEventListener('ruqesinfinitescrollload', evt => console.log('WIN got infi scroll LOAD event', evt));\n\ndocument.addEventListener('ruqesinfinitescrollloadstart', evt => console.log('DOC got infi scroll START event', evt));\ndocument.addEventListener('ruqesinfinitescrollloaderror', evt => console.log('DOC got infi scroll ERROR event', evt));\n");
};


/***/ }),
/* 26 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var __awaiter = (this && this.__awaiter) || function (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());
    });
};
var __generator = (this && this.__generator) || function (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 };
    }
};
Object.defineProperty(exports, "__esModule", { value: true });
var styles_1 = __webpack_require__(3);
var common_1 = __webpack_require__(0);
var settings_1 = __webpack_require__(34);
var modules_1 = __webpack_require__(9);
var ExpandoButtonModule_1 = __webpack_require__(1);
var VotingModule_1 = __webpack_require__(62);
var SidebarModule_1 = __webpack_require__(63);
var CommentModule_1 = __webpack_require__(66);
var CreatePostModule_1 = __webpack_require__(72);
var InfiniteScrollModule_1 = __webpack_require__(73);
var PostsModule_1 = __webpack_require__(74);
var config_1 = __webpack_require__(7);
var events_1 = __webpack_require__(25);
var AdvancedModule_1 = __webpack_require__(80);
var SaveModule_1 = __webpack_require__(13);
var RuqESApi_1 = __webpack_require__(81);
var printInitMessage = function () {
    var bg = 'background-color: lightyellow;';
    var a = 'color: green; font-weight: bold; padding: 1em 0 1em 1em;' + bg;
    var b = 'color: black; padding: 1em 0; ' + bg;
    var c = 'color: purple; font-weight: bold; padding: 1em 1em 1em 0; ' + bg;
    var d = '';
    var info = GM.info;
    console.log("%c" + common_1.logPrefix + " " + common_1.scriptVersion + "%c created by %cenefi%c\n\n'" + common_1.scriptInfo.name + "' running via " + info.scriptHandler + " " + info.version + " on " + JSON.stringify(info.platform), a, b, c, d);
};
var createLoadingAppOverlay = function () { return __awaiter(void 0, void 0, void 0, function () {
    var cfg, body, wrapper, box, skipBtn;
    return __generator(this, function (_a) {
        switch (_a.label) {
            case 0: return [4 /*yield*/, config_1.readConfig()];
            case 1:
                cfg = _a.sent();
                if (cfg.application.disableLoadingOverlay) {
                    return [2 /*return*/];
                }
                body = $('body');
                wrapper = $('<div>').addClass(styles_1.loadingAppCls);
                box = $('<div>').text('Loading').addClass('px-3').append(common_1.createLoadingDots(styles_1.loadingDotsDarkCls));
                skipBtn = common_1.genJsAnchor().text('don\'t wait ➝').on('click', removeLoadingOverlay);
                wrapper.append(box).append(skipBtn);
                body.append(wrapper);
                return [2 /*return*/];
        }
    });
}); };
var removeLoadingOverlay = function () {
    common_1.$c(styles_1.loadingAppCls).remove();
};
var waitForDocumentToBeReady = function () { return __awaiter(void 0, void 0, void 0, function () {
    return __generator(this, function (_a) {
        switch (_a.label) {
            case 0: return [4 /*yield*/, config_1.readConfig()];
            case 1:
                _a.sent(); // sets debugEnabled, so debugLog can print
                return [2 /*return*/, new Promise(function (resolve, reject) {
                        var check = function () {
                            common_1.debugLog('waitForDocumentToBeReady', 'check');
                            var isReady = $('head').length && $('body').length;
                            if (isReady) {
                                resolve();
                            } //
                            else {
                                setTimeout(check, 1);
                            }
                        };
                        check();
                    })];
        }
    });
}); };
var init = function () { return __awaiter(void 0, void 0, void 0, function () {
    var _a;
    return __generator(this, function (_b) {
        switch (_b.label) {
            case 0:
                printInitMessage();
                return [4 /*yield*/, waitForDocumentToBeReady()];
            case 1:
                _b.sent();
                _a = styles_1.setupStyles;
                return [4 /*yield*/, common_1.isDarkTheme()];
            case 2:
                _a.apply(void 0, [_b.sent()]);
                return [4 /*yield*/, createLoadingAppOverlay()];
            case 3:
                _b.sent();
                [
                    new InfiniteScrollModule_1.InfiniteScrollModule(),
                    new ExpandoButtonModule_1.ExpandoButtonModule(),
                    new VotingModule_1.VotingModule(),
                    new PostsModule_1.PostsModule(),
                    new CommentModule_1.CommentModule(),
                    new SidebarModule_1.SidebarModule(),
                    new CreatePostModule_1.CreatePostModule(),
                    new AdvancedModule_1.AdvancedModule(),
                    new SaveModule_1.SaveModule(),
                ].forEach(modules_1.registerClassModule);
                return [2 /*return*/];
        }
    });
}); };
var setupDebug = function () { return __awaiter(void 0, void 0, void 0, function () {
    var cfg;
    return __generator(this, function (_a) {
        switch (_a.label) {
            case 0: return [4 /*yield*/, config_1.readConfig()];
            case 1:
                cfg = _a.sent();
                if (cfg.debug.enabled) {
                    events_1.setupDebugEventListeners();
                }
                return [2 /*return*/];
        }
    });
}); };
var work = function () { return __awaiter(void 0, void 0, void 0, function () {
    var cfg;
    return __generator(this, function (_a) {
        switch (_a.label) {
            case 0: return [4 /*yield*/, config_1.readConfig()];
            case 1:
                cfg = _a.sent();
                if (!cfg.debug.dontHideAppLoadingOverlay) {
                    removeLoadingOverlay();
                }
                return [4 /*yield*/, settings_1.setupSettings()];
            case 2:
                _a.sent();
                return [4 /*yield*/, modules_1.handleFirstSetupOfModules()];
            case 3:
                _a.sent();
                return [4 /*yield*/, setupDebug()];
            case 4:
                _a.sent();
                return [4 /*yield*/, RuqESApi_1.setupGlobalApi()];
            case 5:
                _a.sent();
                return [2 /*return*/];
        }
    });
}); };
init().then();
$(work);


/***/ }),
/* 27 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony default export */ __webpack_exports__["default"] = ("/* -------------------------------------------------------------------\n  Microtip\n\n  Modern, lightweight css-only tooltips\n  Just 1kb minified and gzipped\n\n  @author Ghosh\n  @package Microtip\n\n----------------------------------------------------------------------\n  1. Base Styles\n  2. Direction Modifiers\n  3. Position Modifiers\n--------------------------------------------------------------------*/\n\n\n/* ------------------------------------------------\n  [1] Base Styles\n-------------------------------------------------*/\n\n[aria-label][role~=\"tooltip\"] {\n  position: relative;\n}\n\n[aria-label][role~=\"tooltip\"]::before,\n[aria-label][role~=\"tooltip\"]::after {\n  transform: translate3d(0, 0, 0);\n  -webkit-backface-visibility: hidden;\n  backface-visibility: hidden;\n  will-change: transform;\n  opacity: 0;\n  pointer-events: none;\n  transition: all var(--microtip-transition-duration, .18s) var(--microtip-transition-easing, ease-in-out) var(--microtip-transition-delay, 0s);\n  position: absolute;\n  box-sizing: border-box;\n  z-index: 10;\n  transform-origin: top;\n}\n\n[aria-label][role~=\"tooltip\"]::before {\n  background-size: 100% auto !important;\n  content: \"\";\n}\n\n[aria-label][role~=\"tooltip\"]::after {\n  background: rgba(17, 17, 17, .9);\n  border-radius: 4px;\n  color: #ffffff;\n  content: attr(aria-label);\n  font-size: var(--microtip-font-size, 13px);\n  font-weight: var(--microtip-font-weight, normal);\n  text-transform: var(--microtip-text-transform, none);\n  padding: .5em 1em;\n  white-space: nowrap;\n  box-sizing: content-box;\n}\n\n[aria-label][role~=\"tooltip\"]:hover::before,\n[aria-label][role~=\"tooltip\"]:hover::after,\n[aria-label][role~=\"tooltip\"]:focus::before,\n[aria-label][role~=\"tooltip\"]:focus::after {\n  opacity: 1;\n  pointer-events: auto;\n}\n\n\n\n/* ------------------------------------------------\n  [2] Position Modifiers\n-------------------------------------------------*/\n\n[role~=\"tooltip\"][data-microtip-position|=\"top\"]::before {\n  background: url(\"data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2236px%22%20height%3D%2212px%22%3E%3Cpath%20fill%3D%22rgba%2817,%2017,%2017,%200.9%29%22%20transform%3D%22rotate%280%29%22%20d%3D%22M2.658,0.000%20C-13.615,0.000%2050.938,0.000%2034.662,0.000%20C28.662,0.000%2023.035,12.002%2018.660,12.002%20C14.285,12.002%208.594,0.000%202.658,0.000%20Z%22/%3E%3C/svg%3E\") no-repeat;\n  height: 6px;\n  width: 18px;\n  margin-bottom: 5px;\n}\n\n[role~=\"tooltip\"][data-microtip-position|=\"top\"]::after {\n  margin-bottom: 11px;\n}\n\n[role~=\"tooltip\"][data-microtip-position|=\"top\"]::before {\n  transform: translate3d(-50%, 0, 0);\n  bottom: 100%;\n  left: 50%;\n}\n\n[role~=\"tooltip\"][data-microtip-position|=\"top\"]:hover::before {\n  transform: translate3d(-50%, -5px, 0);\n}\n\n[role~=\"tooltip\"][data-microtip-position|=\"top\"]::after {\n  transform: translate3d(-50%, 0, 0);\n  bottom: 100%;\n  left: 50%;\n}\n\n[role~=\"tooltip\"][data-microtip-position=\"top\"]:hover::after {\n  transform: translate3d(-50%, -5px, 0);\n}\n\n/* ------------------------------------------------\n  [2.1] Top Left\n-------------------------------------------------*/\n[role~=\"tooltip\"][data-microtip-position=\"top-left\"]::after {\n  transform: translate3d(calc(-100% + 16px), 0, 0);\n  bottom: 100%;\n}\n\n[role~=\"tooltip\"][data-microtip-position=\"top-left\"]:hover::after {\n  transform: translate3d(calc(-100% + 16px), -5px, 0);\n}\n\n\n/* ------------------------------------------------\n  [2.2] Top Right\n-------------------------------------------------*/\n[role~=\"tooltip\"][data-microtip-position=\"top-right\"]::after {\n  transform: translate3d(calc(0% + -16px), 0, 0);\n  bottom: 100%;\n}\n\n[role~=\"tooltip\"][data-microtip-position=\"top-right\"]:hover::after {\n  transform: translate3d(calc(0% + -16px), -5px, 0);\n}\n\n\n/* ------------------------------------------------\n  [2.3] Bottom\n-------------------------------------------------*/\n[role~=\"tooltip\"][data-microtip-position|=\"bottom\"]::before {\n  background: url(\"data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2236px%22%20height%3D%2212px%22%3E%3Cpath%20fill%3D%22rgba%2817,%2017,%2017,%200.9%29%22%20transform%3D%22rotate%28180%2018%206%29%22%20d%3D%22M2.658,0.000%20C-13.615,0.000%2050.938,0.000%2034.662,0.000%20C28.662,0.000%2023.035,12.002%2018.660,12.002%20C14.285,12.002%208.594,0.000%202.658,0.000%20Z%22/%3E%3C/svg%3E\") no-repeat;\n  height: 6px;\n  width: 18px;\n  margin-top: 5px;\n  margin-bottom: 0;\n}\n\n[role~=\"tooltip\"][data-microtip-position|=\"bottom\"]::after {\n  margin-top: 11px;\n}\n\n[role~=\"tooltip\"][data-microtip-position|=\"bottom\"]::before {\n  transform: translate3d(-50%, -10px, 0);\n  bottom: auto;\n  left: 50%;\n  top: 100%;\n}\n\n[role~=\"tooltip\"][data-microtip-position|=\"bottom\"]:hover::before {\n  transform: translate3d(-50%, 0, 0);\n}\n\n[role~=\"tooltip\"][data-microtip-position|=\"bottom\"]::after {\n  transform: translate3d(-50%, -10px, 0);\n  top: 100%;\n  left: 50%;\n}\n\n[role~=\"tooltip\"][data-microtip-position=\"bottom\"]:hover::after {\n  transform: translate3d(-50%, 0, 0);\n}\n\n\n/* ------------------------------------------------\n  [2.4] Bottom Left\n-------------------------------------------------*/\n[role~=\"tooltip\"][data-microtip-position=\"bottom-left\"]::after {\n  transform: translate3d(calc(-100% + 16px), -10px, 0);\n  top: 100%;\n}\n\n[role~=\"tooltip\"][data-microtip-position=\"bottom-left\"]:hover::after {\n  transform: translate3d(calc(-100% + 16px), 0, 0);\n}\n\n\n/* ------------------------------------------------\n  [2.5] Bottom Right\n-------------------------------------------------*/\n[role~=\"tooltip\"][data-microtip-position=\"bottom-right\"]::after {\n  transform: translate3d(calc(0% + -16px), -10px, 0);\n  top: 100%;\n}\n\n[role~=\"tooltip\"][data-microtip-position=\"bottom-right\"]:hover::after {\n  transform: translate3d(calc(0% + -16px), 0, 0);\n}\n\n\n/* ------------------------------------------------\n  [2.6] Left\n-------------------------------------------------*/\n[role~=\"tooltip\"][data-microtip-position=\"left\"]::before,\n[role~=\"tooltip\"][data-microtip-position=\"left\"]::after {\n  bottom: auto;\n  left: auto;\n  right: 100%;\n  top: 50%;\n  transform: translate3d(10px, -50%, 0);\n}\n\n[role~=\"tooltip\"][data-microtip-position=\"left\"]::before {\n  background: url(\"data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2212px%22%20height%3D%2236px%22%3E%3Cpath%20fill%3D%22rgba%2817,%2017,%2017,%200.9%29%22%20transform%3D%22rotate%28-90%2018%2018%29%22%20d%3D%22M2.658,0.000%20C-13.615,0.000%2050.938,0.000%2034.662,0.000%20C28.662,0.000%2023.035,12.002%2018.660,12.002%20C14.285,12.002%208.594,0.000%202.658,0.000%20Z%22/%3E%3C/svg%3E\") no-repeat;\n  height: 18px;\n  width: 6px;\n  margin-right: 5px;\n  margin-bottom: 0;\n}\n\n[role~=\"tooltip\"][data-microtip-position=\"left\"]::after {\n  margin-right: 11px;\n}\n\n[role~=\"tooltip\"][data-microtip-position=\"left\"]:hover::before,\n[role~=\"tooltip\"][data-microtip-position=\"left\"]:hover::after {\n  transform: translate3d(0, -50%, 0);\n}\n\n\n/* ------------------------------------------------\n  [2.7] Right\n-------------------------------------------------*/\n[role~=\"tooltip\"][data-microtip-position=\"right\"]::before,\n[role~=\"tooltip\"][data-microtip-position=\"right\"]::after {\n  bottom: auto;\n  left: 100%;\n  top: 50%;\n  transform: translate3d(-10px, -50%, 0);\n}\n\n[role~=\"tooltip\"][data-microtip-position=\"right\"]::before {\n  background: url(\"data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2212px%22%20height%3D%2236px%22%3E%3Cpath%20fill%3D%22rgba%2817,%2017,%2017,%200.9%29%22%20transform%3D%22rotate%2890%206%206%29%22%20d%3D%22M2.658,0.000%20C-13.615,0.000%2050.938,0.000%2034.662,0.000%20C28.662,0.000%2023.035,12.002%2018.660,12.002%20C14.285,12.002%208.594,0.000%202.658,0.000%20Z%22/%3E%3C/svg%3E\") no-repeat;\n  height: 18px;\n  width: 6px;\n  margin-bottom: 0;\n  margin-left: 5px;\n}\n\n[role~=\"tooltip\"][data-microtip-position=\"right\"]::after {\n  margin-left: 11px;\n}\n\n[role~=\"tooltip\"][data-microtip-position=\"right\"]:hover::before,\n[role~=\"tooltip\"][data-microtip-position=\"right\"]:hover::after {\n  transform: translate3d(0, -50%, 0);\n}\n\n/* ------------------------------------------------\n  [3] Size\n-------------------------------------------------*/\n[role~=\"tooltip\"][data-microtip-size=\"small\"]::after {\n  white-space: initial;\n  width: 80px;\n}\n\n[role~=\"tooltip\"][data-microtip-size=\"medium\"]::after {\n  white-space: initial;\n  width: 150px;\n}\n\n[role~=\"tooltip\"][data-microtip-size=\"large\"]::after {\n  white-space: initial;\n  width: 260px;\n}\n");

/***/ }),
/* 28 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.encode = exports.decodeStrict = exports.decode = void 0;
var decode_1 = __webpack_require__(14);
var encode_1 = __webpack_require__(17);
/**
 * Decodes a string with entities.
 *
 * @param data String to decode.
 * @param level Optional level to decode at. 0 = XML, 1 = HTML. Default is 0.
 */
function decode(data, level) {
    return (!level || level <= 0 ? decode_1.decodeXML : decode_1.decodeHTML)(data);
}
exports.decode = decode;
/**
 * Decodes a string with entities. Does not allow missing trailing semicolons for entities.
 *
 * @param data String to decode.
 * @param level Optional level to decode at. 0 = XML, 1 = HTML. Default is 0.
 */
function decodeStrict(data, level) {
    return (!level || level <= 0 ? decode_1.decodeXML : decode_1.decodeHTMLStrict)(data);
}
exports.decodeStrict = decodeStrict;
/**
 * Encodes a string with entities.
 *
 * @param data String to encode.
 * @param level Optional level to encode at. 0 = XML, 1 = HTML. Default is 0.
 */
function encode(data, level) {
    return (!level || level <= 0 ? encode_1.encodeXML : encode_1.encodeHTML)(data);
}
exports.encode = encode;
var encode_2 = __webpack_require__(17);
Object.defineProperty(exports, "encodeXML", { enumerable: true, get: function () { return encode_2.encodeXML; } });
Object.defineProperty(exports, "encodeHTML", { enumerable: true, get: function () { return encode_2.encodeHTML; } });
Object.defineProperty(exports, "escape", { enumerable: true, get: function () { return encode_2.escape; } });
// Legacy aliases
Object.defineProperty(exports, "encodeHTML4", { enumerable: true, get: function () { return encode_2.encodeHTML; } });
Object.defineProperty(exports, "encodeHTML5", { enumerable: true, get: function () { return encode_2.encodeHTML; } });
var decode_2 = __webpack_require__(14);
Object.defineProperty(exports, "decodeXML", { enumerable: true, get: function () { return decode_2.decodeXML; } });
Object.defineProperty(exports, "decodeHTML", { enumerable: true, get: function () { return decode_2.decodeHTML; } });
Object.defineProperty(exports, "decodeHTMLStrict", { enumerable: true, get: function () { return decode_2.decodeHTMLStrict; } });
// Legacy aliases
Object.defineProperty(exports, "decodeHTML4", { enumerable: true, get: function () { return decode_2.decodeHTML; } });
Object.defineProperty(exports, "decodeHTML5", { enumerable: true, get: function () { return decode_2.decodeHTML; } });
Object.defineProperty(exports, "decodeHTML4Strict", { enumerable: true, get: function () { return decode_2.decodeHTMLStrict; } });
Object.defineProperty(exports, "decodeHTML5Strict", { enumerable: true, get: function () { return decode_2.decodeHTMLStrict; } });
Object.defineProperty(exports, "decodeXMLStrict", { enumerable: true, get: function () { return decode_2.decodeXML; } });


/***/ }),
/* 29 */
/***/ (function(module) {

module.exports = JSON.parse("{\"Aacute\":\"Á\",\"aacute\":\"á\",\"Acirc\":\"Â\",\"acirc\":\"â\",\"acute\":\"´\",\"AElig\":\"Æ\",\"aelig\":\"æ\",\"Agrave\":\"À\",\"agrave\":\"à\",\"amp\":\"&\",\"AMP\":\"&\",\"Aring\":\"Å\",\"aring\":\"å\",\"Atilde\":\"Ã\",\"atilde\":\"ã\",\"Auml\":\"Ä\",\"auml\":\"ä\",\"brvbar\":\"¦\",\"Ccedil\":\"Ç\",\"ccedil\":\"ç\",\"cedil\":\"¸\",\"cent\":\"¢\",\"copy\":\"©\",\"COPY\":\"©\",\"curren\":\"¤\",\"deg\":\"°\",\"divide\":\"÷\",\"Eacute\":\"É\",\"eacute\":\"é\",\"Ecirc\":\"Ê\",\"ecirc\":\"ê\",\"Egrave\":\"È\",\"egrave\":\"è\",\"ETH\":\"Ð\",\"eth\":\"ð\",\"Euml\":\"Ë\",\"euml\":\"ë\",\"frac12\":\"½\",\"frac14\":\"¼\",\"frac34\":\"¾\",\"gt\":\">\",\"GT\":\">\",\"Iacute\":\"Í\",\"iacute\":\"í\",\"Icirc\":\"Î\",\"icirc\":\"î\",\"iexcl\":\"¡\",\"Igrave\":\"Ì\",\"igrave\":\"ì\",\"iquest\":\"¿\",\"Iuml\":\"Ï\",\"iuml\":\"ï\",\"laquo\":\"«\",\"lt\":\"<\",\"LT\":\"<\",\"macr\":\"¯\",\"micro\":\"µ\",\"middot\":\"·\",\"nbsp\":\" \",\"not\":\"¬\",\"Ntilde\":\"Ñ\",\"ntilde\":\"ñ\",\"Oacute\":\"Ó\",\"oacute\":\"ó\",\"Ocirc\":\"Ô\",\"ocirc\":\"ô\",\"Ograve\":\"Ò\",\"ograve\":\"ò\",\"ordf\":\"ª\",\"ordm\":\"º\",\"Oslash\":\"Ø\",\"oslash\":\"ø\",\"Otilde\":\"Õ\",\"otilde\":\"õ\",\"Ouml\":\"Ö\",\"ouml\":\"ö\",\"para\":\"¶\",\"plusmn\":\"±\",\"pound\":\"£\",\"quot\":\"\\\"\",\"QUOT\":\"\\\"\",\"raquo\":\"»\",\"reg\":\"®\",\"REG\":\"®\",\"sect\":\"§\",\"shy\":\"­\",\"sup1\":\"¹\",\"sup2\":\"²\",\"sup3\":\"³\",\"szlig\":\"ß\",\"THORN\":\"Þ\",\"thorn\":\"þ\",\"times\":\"×\",\"Uacute\":\"Ú\",\"uacute\":\"ú\",\"Ucirc\":\"Û\",\"ucirc\":\"û\",\"Ugrave\":\"Ù\",\"ugrave\":\"ù\",\"uml\":\"¨\",\"Uuml\":\"Ü\",\"uuml\":\"ü\",\"Yacute\":\"Ý\",\"yacute\":\"ý\",\"yen\":\"¥\",\"yuml\":\"ÿ\"}");

/***/ }),
/* 30 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var decode_json_1 = __importDefault(__webpack_require__(31));
// modified version of https://github.com/mathiasbynens/he/blob/master/src/he.js#L94-L119
function decodeCodePoint(codePoint) {
    if ((codePoint >= 0xd800 && codePoint <= 0xdfff) || codePoint > 0x10ffff) {
        return "\uFFFD";
    }
    if (codePoint in decode_json_1.default) {
        codePoint = decode_json_1.default[codePoint];
    }
    var output = "";
    if (codePoint > 0xffff) {
        codePoint -= 0x10000;
        output += String.fromCharCode(((codePoint >>> 10) & 0x3ff) | 0xd800);
        codePoint = 0xdc00 | (codePoint & 0x3ff);
    }
    output += String.fromCharCode(codePoint);
    return output;
}
exports.default = decodeCodePoint;


/***/ }),
/* 31 */
/***/ (function(module) {

module.exports = JSON.parse("{\"0\":65533,\"128\":8364,\"130\":8218,\"131\":402,\"132\":8222,\"133\":8230,\"134\":8224,\"135\":8225,\"136\":710,\"137\":8240,\"138\":352,\"139\":8249,\"140\":338,\"142\":381,\"145\":8216,\"146\":8217,\"147\":8220,\"148\":8221,\"149\":8226,\"150\":8211,\"151\":8212,\"152\":732,\"153\":8482,\"154\":353,\"155\":8250,\"156\":339,\"158\":382,\"159\":376}");

/***/ }),
/* 32 */
/***/ (function(module, exports) {

function webpackEmptyContext(req) {
	var e = new Error("Cannot find module '" + req + "'");
	e.code = 'MODULE_NOT_FOUND';
	throw e;
}
webpackEmptyContext.keys = function() { return []; };
webpackEmptyContext.resolve = webpackEmptyContext;
module.exports = webpackEmptyContext;
webpackEmptyContext.id = 32;

/***/ }),
/* 33 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony default export */ __webpack_exports__["default"] = ("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n<svg width=\"100%\" height=\"100%\" viewBox=\"0 0 1598 1185\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" xml:space=\"preserve\" xmlns:serif=\"http://www.serif.com/\" style=\"fill-rule:evenodd;clip-rule:evenodd;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:1.5;\">\n    <g id=\"vanilla\" transform=\"matrix(5.90051,0,0,5.90051,-9582.11,-8176)\">\n        <g transform=\"matrix(1.02751,0,0,1.0144,1588.22,1356.66)\">\n            <path d=\"M290,55.9C290,46.021 282.082,38 272.328,38L60.672,38C50.918,38 43,46.021 43,55.9L43,199.1C43,208.979 50.918,217 60.672,217L272.328,217C282.082,217 290,208.979 290,199.1L290,55.9Z\" style=\"fill:rgb(160,174,192);stroke:rgb(160,174,192);stroke-width:10.97px;\"/>\n        </g>\n        <g transform=\"matrix(1.42964,0,0,1.42964,-755.806,-653.628)\">\n            <path d=\"M1759.18,1536.02C1767.98,1535.83 1773.81,1533.37 1778.54,1528.2C1780.82,1525.75 1784.37,1525.16 1787.05,1528.21C1789.17,1530.63 1788.66,1534.21 1786.04,1536.73C1779.38,1542.44 1770.78,1546.41 1759.3,1546.55L1759.3,1546.55L1759.18,1546.55L1759.05,1546.55L1759.05,1546.55C1747.58,1546.41 1738.98,1542.44 1732.32,1536.73C1729.69,1534.21 1729.19,1530.63 1731.31,1528.21C1733.98,1525.16 1737.54,1525.75 1739.82,1528.2C1744.55,1533.37 1750.38,1535.83 1759.18,1536.02Z\" style=\"fill:white;stroke:rgb(160,174,192);stroke-width:2.18px;\"/>\n        </g>\n        <g transform=\"matrix(1.46826,0,0,1.28309,-857.07,-435.425)\">\n            <path d=\"M1752,1489.31C1752,1479.2 1744.83,1471 1736,1471C1727.17,1471 1720,1479.2 1720,1489.31L1720,1505.69C1720,1515.8 1727.17,1524 1736,1524C1744.83,1524 1752,1515.8 1752,1505.69L1752,1489.31Z\" style=\"fill:none;stroke:rgb(160,174,192);stroke-width:12.11px;\"/>\n            <path d=\"M1752,1489.31C1752,1479.2 1744.83,1471 1736,1471C1727.17,1471 1720,1479.2 1720,1489.31L1720,1505.69C1720,1515.8 1727.17,1524 1736,1524C1744.83,1524 1752,1515.8 1752,1505.69L1752,1489.31Z\" style=\"fill:white;\"/>\n            <clipPath id=\"_clip1\">\n                <path d=\"M1752,1489.31C1752,1479.2 1744.83,1471 1736,1471C1727.17,1471 1720,1479.2 1720,1489.31L1720,1505.69C1720,1515.8 1727.17,1524 1736,1524C1744.83,1524 1752,1515.8 1752,1505.69L1752,1489.31Z\"/>\n            </clipPath>\n            <g clip-path=\"url(#_clip1)\">\n                <g transform=\"matrix(0.499093,0,0,0.604356,871.259,592.477)\">\n                    <path d=\"M1752,1486.12C1752,1477.78 1744.83,1471 1736,1471C1727.17,1471 1720,1477.78 1720,1486.12L1720,1508.88C1720,1517.23 1727.17,1524 1736,1524C1744.83,1524 1752,1517.23 1752,1508.88L1752,1486.12Z\" style=\"fill:rgb(160,174,192);\"/>\n                    <clipPath id=\"_clip2\">\n                        <path d=\"M1752,1486.12C1752,1477.78 1744.83,1471 1736,1471C1727.17,1471 1720,1477.78 1720,1486.12L1720,1508.88C1720,1517.23 1727.17,1524 1736,1524C1744.83,1524 1752,1517.23 1752,1508.88L1752,1486.12Z\"/>\n                    </clipPath>\n                    <g clip-path=\"url(#_clip2)\">\n                        <g transform=\"matrix(1.856,0,0,1.75393,-1489.56,-1143.6)\">\n                            <circle cx=\"1732\" cy=\"1494\" r=\"5\" style=\"fill:white;\"/>\n                        </g>\n                    </g>\n                </g>\n            </g>\n        </g>\n        <g transform=\"matrix(-1.46826,0,0,1.28309,4374.22,-435.425)\">\n            <path d=\"M1752,1489.31C1752,1479.2 1744.83,1471 1736,1471C1727.17,1471 1720,1479.2 1720,1489.31L1720,1505.69C1720,1515.8 1727.17,1524 1736,1524C1744.83,1524 1752,1515.8 1752,1505.69L1752,1489.31Z\" style=\"fill:none;stroke:rgb(160,174,192);stroke-width:12.11px;\"/>\n            <path d=\"M1752,1489.31C1752,1479.2 1744.83,1471 1736,1471C1727.17,1471 1720,1479.2 1720,1489.31L1720,1505.69C1720,1515.8 1727.17,1524 1736,1524C1744.83,1524 1752,1515.8 1752,1505.69L1752,1489.31Z\" style=\"fill:white;\"/>\n            <clipPath id=\"_clip3\">\n                <path d=\"M1752,1489.31C1752,1479.2 1744.83,1471 1736,1471C1727.17,1471 1720,1479.2 1720,1489.31L1720,1505.69C1720,1515.8 1727.17,1524 1736,1524C1744.83,1524 1752,1515.8 1752,1505.69L1752,1489.31Z\"/>\n            </clipPath>\n            <g clip-path=\"url(#_clip3)\">\n                <g transform=\"matrix(0.499093,0,0,0.604356,871.259,592.477)\">\n                    <path d=\"M1752,1486.12C1752,1477.78 1744.83,1471 1736,1471C1727.17,1471 1720,1477.78 1720,1486.12L1720,1508.88C1720,1517.23 1727.17,1524 1736,1524C1744.83,1524 1752,1517.23 1752,1508.88L1752,1486.12Z\" style=\"fill:rgb(160,174,192);\"/>\n                    <clipPath id=\"_clip4\">\n                        <path d=\"M1752,1486.12C1752,1477.78 1744.83,1471 1736,1471C1727.17,1471 1720,1477.78 1720,1486.12L1720,1508.88C1720,1517.23 1727.17,1524 1736,1524C1744.83,1524 1752,1517.23 1752,1508.88L1752,1486.12Z\"/>\n                    </clipPath>\n                    <g clip-path=\"url(#_clip4)\">\n                        <g transform=\"matrix(1.856,0,0,1.75393,-1467.62,-1143.6)\">\n                            <circle cx=\"1732\" cy=\"1494\" r=\"5\" style=\"fill:white;\"/>\n                        </g>\n                    </g>\n                </g>\n            </g>\n        </g>\n    </g>\n</svg>\n");

/***/ }),
/* 34 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var __assign = (this && this.__assign) || function () {
    __assign = Object.assign || function(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);
};
var __awaiter = (this && this.__awaiter) || function (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());
    });
};
var __generator = (this && this.__generator) || function (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 };
    }
};
var __read = (this && this.__read) || function (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;
};
var __spread = (this && this.__spread) || function () {
    for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
    return ar;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.setupSettings = void 0;
var ramda_1 = __webpack_require__(4);
var moment_1 = __importDefault(__webpack_require__(11));
var common_1 = __webpack_require__(0);
var styles_1 = __webpack_require__(3);
var config_1 = __webpack_require__(7);
var logo_svg_1 = __importDefault(__webpack_require__(8));
var downloader_1 = __webpack_require__(35);
var selectors_1 = __webpack_require__(5);
var parsePostRule_1 = __webpack_require__(36);
var swapIndices_1 = __webpack_require__(19);
var postRuleTemplates_1 = __webpack_require__(37);
var donate_bitcoin_png_1 = __importDefault(__webpack_require__(38));
var genSettingsId = function (x) { return "" + styles_1.clsPrefix + x; };
var expandoButtonId = genSettingsId('expando');
var expandoButtonStyleId = genSettingsId('expando-style');
var expandoButtonCloserId = genSettingsId('expando-closer');
var expandoButtonAlignRightId = genSettingsId('expando-align-right');
var expandoButtonResizeId = genSettingsId('expando-resize');
var expandoButtonTextClosedId = genSettingsId('expando-text-closed');
var expandoButtonTextClosedListId = genSettingsId('expando-text-closed-list');
var expandoButtonTextOpenedId = genSettingsId('expando-text-opened');
var expandoButtonTextOpenedListId = genSettingsId('expando-text-opened-list');
var expandoButtonShowCommentsId = genSettingsId('expando-show-comments');
var expandoButtonAutoExpandCommentsId = genSettingsId('expando-auto-expand-comments');
var expandoButtonHideToggleCommentsButtonId = genSettingsId('expando-hide-toggle-comments-button');
var expandoButtonPostTextOrderId = genSettingsId('expando-post-text-order');
var expandoButtonEmbedOrderId = genSettingsId('expando-post-embed-order');
var expandoButtonCommentsOrderId = genSettingsId('expando-post-comments-order');
var expandoButtonClickOnPostToOpenId = genSettingsId('expando-click-on-post-to-open');
var expandoButtonHideId = genSettingsId('expando-hide');
var expandoButtonAutoOpenOnDetailOnUnsupportedVideosId = genSettingsId('expando-auto-open-on-detail-on-unsupported-videos');
var expandoButtonAutoOpenOnDetailId = genSettingsId('expando-auto-open-on-detail');
var expandoButtonDeferLoadingOfPostId = genSettingsId('expando-button-defer-loading-of-post');
var expandoButtonAutoOpenId = genSettingsId('expando-button-auto-open');
var infiniteScrollId = genSettingsId('infinite-scroll');
var infiniteScrollLoadEarlierId = genSettingsId('infinite-scroll-load-earlier');
var bigVoteArrowsOnMobileId = genSettingsId('big-vote-arrows-on-mobile');
var voteEffectId = genSettingsId('vote-effect');
var openPostInNewTabId = genSettingsId('post-open-in-new-tab');
var hideAlreadyJoinedGuildsInDiscoveryId = genSettingsId('post-hide-already-joined-guilds');
var createPostLoadTitleId = genSettingsId('create-post-load-title');
var createPostMarkdownPreviewId = genSettingsId('create-post-markdown-preview');
var createPostOpenUrlButtonId = genSettingsId('create-post-open-url-button');
var imgBbKeyId = genSettingsId('img-bb-key');
var improvedTableStylesId = genSettingsId('improved-table-styles');
var lessAggressivePatronBadgesId = genSettingsId('less-aggressive-patron-badges');
var disablePostActionsJumpingAboveBarOnHoverId = genSettingsId('disable-post-actions-jumping-above-bar-on-hover');
var imageThumbnailIconTypeId = genSettingsId('image-thumbnail-icon-type');
var imageThumbnailIconTypeStyleId = genSettingsId('image-thumbnail-icon-type-style');
var imageThumbnailIconTypeBackgroundId = genSettingsId('image-thumbnail-icon-type-bg');
var closeButtonInImageDialogId = genSettingsId('close-button-in-image-dialog');
var postUpDownVotesAsTextId = genSettingsId('post-up-down-votes-as-text');
var postDownloadButtonId = genSettingsId('post-download-button');
var postDownloadButtonModeId = genSettingsId('post-download-button-mode');
var postDownloadButtonModeTwoClickId = genSettingsId('post-download-button-mode-two-click');
var postDownloadButtonModeDownloadServerId = genSettingsId('post-download-button-mode-download-server');
var downloadServerAddressId = genSettingsId('download-server-address');
var postShowThumbnailOnHoverId = genSettingsId('post-show-thumbnail-on-hover');
var postThumbnailModeId = genSettingsId('post-thumbnail-mode');
var savingEnabledId = genSettingsId('saving-enabled');
var savingPostsEnabledId = genSettingsId('saving-posts-enabled');
var savingCommentsEnabledId = genSettingsId('saving-comments-enabled');
var commentCtrlEnterToSendId = genSettingsId('comment-ctrl-enter-to-send');
var commentBiggerFoldButtonsId = genSettingsId('comment-bigger-fold-buttons');
var commentUpDownVotesAsTextId = genSettingsId('comment-up-down-votes-as-text');
var commentPreviewId = genSettingsId('comment-preview');
var commentAutoCollapseCommentsRegexId = genSettingsId('comment-auto-collapse-comments-regex');
var commentHideTipButtonId = genSettingsId('comment-hide-tip-button');
var commentImageUploadId = genSettingsId('comment-image-upload');
var commentReactionGifId = genSettingsId('comment-reaction-gif');
var commentRevealBlockedId = genSettingsId('comment-reveal-blocked');
var sidebarRightHideButtonId = genSettingsId('sidebar-right-hide-button');
var sidebarRightAutoHideId = genSettingsId('sidebar-right-auto-hide');
var sidebarRightAutoHideButNotOnGuildPageId = genSettingsId('sidebar-right-auto-hide-but-not-on-guild-page');
var sidebarIndependentScrollId = genSettingsId('sidebar-independent-scroll');
var sidebarFavoritesId = genSettingsId('sidebar-favorites');
var sidebarFavoritesSmallImagesId = genSettingsId('sidebar-favorites-small-images');
var sidebarSmallGuildImagesId = genSettingsId('sidebar-small-guild-images');
var sidebarSavedContentInFeedsId = genSettingsId('sidebar-saved-content-in-feeds');
var sidebarHideContentOfMyGuildsId = genSettingsId('sidebar-hide-content-of-my-guilds');
var postRulesEngineEnabledId = genSettingsId('post-rules-engine-enabled');
var postRuleNewFormSaveButtonId = genSettingsId('post-rule-new-form-save-button');
var postRulesNewButtonId = genSettingsId('post-rule-new-button');
var postRulesFromTemplateButtonId = genSettingsId('post-rule-from-template-button');
var postRulesNewFormBackButtonId = genSettingsId('post-rule-new-form-back-button');
var postRulesTemplateFormBackButtonId = genSettingsId('post-rule-template-form-back-button');
var postRulesTopBarId = genSettingsId('post-rule-top-bar');
var postRuleBodyId = genSettingsId('post-rule-body');
var operationsContainerId = genSettingsId('operations');
var importHelperId = genSettingsId('import-helper');
var disableLoadingOverlayId = genSettingsId('disable-loading-overlay');
var advancedEnabledId = genSettingsId('advanced-enabled-id');
var advancedJsId = genSettingsId('advanced-js');
var advancedCssId = genSettingsId('advanced-css');
var debugId = genSettingsId('debug');
var debugAutoOpenSettingsId = genSettingsId('debug-auto-open-settings');
var debugInsertTestPostRuleId = genSettingsId('debug-insert-test-post-rule');
var debugDontHideAppLoadingOverlayId = genSettingsId('debug-dont-hide-app-loading-overlay');
var debugSectionId = genSettingsId('debug-section');
var debugForceUpgradeId = genSettingsId('debug-force-upgrade');
var moduleContainerCls = genSettingsId('module-container');
var moduleButtonCls = genSettingsId('module-button');
var settingsState = {
    postRules: [],
    indexOfPostRuleBeingEdited: null,
    creatingNewRule: false,
    creatingFromTemplate: false,
    backInPostRulesGoesToTemplates: false,
    savedPosts: [],
    savedComments: [],
    favorites: [],
};
var setVisibilityOfDebugSectionInSettings = function (val) {
    return common_1.$i(debugSectionId).css({ display: val ? 'block' : 'none' });
};
var initializeSettingsForm = function (cfg) {
    var initChecked = function (id, val) { return common_1.$i(id).prop('checked', val); };
    var initVal = function (id, val) { return common_1.$i(id).val(val); };
    var initRadioChecked = function (id, val) { return $("input[name=\"" + id + "\"]").each(function (_, rawEl) {
        var el = $(rawEl);
        el.prop('checked', val === el.val());
    }); };
    initChecked(expandoButtonId, cfg.expandoButton.enabled);
    initChecked(expandoButtonResizeId, cfg.expandoButton.resize);
    initVal(expandoButtonStyleId, cfg.expandoButton.style);
    initChecked(expandoButtonAlignRightId, cfg.expandoButton.alignRight);
    initVal(expandoButtonTextClosedId, cfg.expandoButton.textClosed);
    initVal(expandoButtonTextOpenedId, cfg.expandoButton.textOpened);
    initChecked(expandoButtonShowCommentsId, cfg.expandoButton.showComments);
    initChecked(expandoButtonAutoExpandCommentsId, cfg.expandoButton.autoExpandComments);
    initChecked(expandoButtonHideToggleCommentsButtonId, cfg.expandoButton.hideToggleCommentsButton);
    initVal(expandoButtonPostTextOrderId, cfg.expandoButton.postTextOrder);
    initVal(expandoButtonEmbedOrderId, cfg.expandoButton.embedOrder);
    initVal(expandoButtonCommentsOrderId, cfg.expandoButton.commentsOrder);
    initChecked(expandoButtonCloserId, cfg.expandoButton.closerEnabled);
    initChecked(expandoButtonClickOnPostToOpenId, cfg.expandoButton.clickOnPostToOpen);
    initChecked(expandoButtonHideId, cfg.expandoButton.hide);
    initChecked(expandoButtonAutoOpenOnDetailOnUnsupportedVideosId, cfg.expandoButton.autoOpenOnDetailOnUnsupportedVideos);
    initChecked(expandoButtonAutoOpenOnDetailId, cfg.expandoButton.autoOpenOnDetail);
    initChecked(expandoButtonDeferLoadingOfPostId, cfg.expandoButton.deferLoadingOfPost);
    initChecked(expandoButtonAutoOpenId, cfg.expandoButton.autoOpen);
    initChecked(infiniteScrollId, cfg.infiniteScroll.enabled);
    initChecked(infiniteScrollLoadEarlierId, cfg.infiniteScroll.loadEarlier);
    initChecked(bigVoteArrowsOnMobileId, cfg.voting.bigVoteArrowsOnMobile);
    initChecked(voteEffectId, cfg.voting.clickEffect);
    initChecked(openPostInNewTabId, cfg.post.openInNewTab);
    initChecked(hideAlreadyJoinedGuildsInDiscoveryId, cfg.post.hideAlreadyJoinedGuildsInDiscovery);
    initChecked(createPostLoadTitleId, cfg.createPost.loadTitleButton);
    initChecked(createPostMarkdownPreviewId, cfg.createPost.markdownPreview);
    initChecked(createPostOpenUrlButtonId, cfg.createPost.openUrlButton);
    initVal(imgBbKeyId, cfg.external.imgbbKey);
    initChecked(improvedTableStylesId, cfg.post.improvedTableStyles);
    initChecked(lessAggressivePatronBadgesId, cfg.post.lessAggressivePatronBadges);
    initChecked(disablePostActionsJumpingAboveBarOnHoverId, cfg.post.disablePostActionsJumpingAboveBarOnHover);
    initChecked(imageThumbnailIconTypeId, cfg.post.imageThumbnailIconType);
    initVal(imageThumbnailIconTypeStyleId, cfg.post.imageThumbnailIconTypeStyle);
    initChecked(imageThumbnailIconTypeBackgroundId, cfg.post.imageThumbnailIconTypeBackground);
    initChecked(closeButtonInImageDialogId, cfg.post.closeButtonInImageDialog);
    initChecked(postUpDownVotesAsTextId, cfg.post.upDownVotesAsText);
    initChecked(postDownloadButtonId, cfg.post.downloadButton);
    initVal(downloadServerAddressId, cfg.external.downloadServerAddress);
    initRadioChecked(postDownloadButtonModeId, cfg.post.downloadButtonMode);
    initChecked(postShowThumbnailOnHoverId, cfg.post.showThumbnailOnHover);
    initVal(postThumbnailModeId, cfg.post.thumbnailMode);
    initChecked(savingEnabledId, cfg.save.enabled);
    initChecked(savingPostsEnabledId, cfg.save.postSavingEnabled);
    initChecked(savingCommentsEnabledId, cfg.save.commentSavingEnabled);
    initChecked(commentCtrlEnterToSendId, cfg.comment.ctrlEnterToSend);
    initChecked(commentBiggerFoldButtonsId, cfg.comment.ctrlEnterToSend);
    initChecked(commentUpDownVotesAsTextId, cfg.comment.upDownVotesAsText);
    initChecked(commentPreviewId, cfg.comment.preview);
    initVal(commentAutoCollapseCommentsRegexId, cfg.comment.autoCollapseCommentsRegex);
    initChecked(commentHideTipButtonId, cfg.comment.hideTipButton);
    initChecked(commentImageUploadId, cfg.comment.imageUpload);
    initChecked(commentReactionGifId, cfg.comment.reactionGifs);
    initChecked(commentRevealBlockedId, cfg.comment.revealBlocked);
    initChecked(sidebarRightHideButtonId, cfg.sidebar.rightButton);
    initChecked(sidebarRightAutoHideId, cfg.sidebar.autoHideRight);
    initChecked(sidebarRightAutoHideButNotOnGuildPageId, cfg.sidebar.autoHideRightButNotOnGuildPage);
    initChecked(sidebarIndependentScrollId, cfg.sidebar.independentScroll);
    initChecked(sidebarFavoritesId, cfg.sidebar.favoritesEnabled);
    initChecked(sidebarFavoritesSmallImagesId, cfg.sidebar.favoritesSmallImages);
    initChecked(sidebarSmallGuildImagesId, cfg.sidebar.smallGuildImages);
    initChecked(sidebarSavedContentInFeedsId, cfg.sidebar.savedContentLinkInFeeds);
    initChecked(sidebarHideContentOfMyGuildsId, cfg.sidebar.hideContentOfMyGuilds);
    initChecked(postRulesEngineEnabledId, cfg.post.rulesEngineEnabled);
    initChecked(disableLoadingOverlayId, cfg.application.disableLoadingOverlay);
    initChecked(advancedEnabledId, cfg.advanced.enabled);
    initVal(advancedJsId, cfg.advanced.js);
    initVal(advancedCssId, cfg.advanced.css);
    var debugEnabled = cfg.debug.enabled;
    initChecked(debugId, debugEnabled);
    initChecked(debugAutoOpenSettingsId, cfg.debug.autoOpenSettings);
    initChecked(debugInsertTestPostRuleId, cfg.debug.insertTestPostRule);
    initChecked(debugDontHideAppLoadingOverlayId, cfg.debug.dontHideAppLoadingOverlay);
    setVisibilityOfDebugSectionInSettings(debugEnabled);
    settingsState.postRules = cfg.post.rules;
    refreshPostRules();
    refreshPostRulesElementsVisibility();
    settingsState.savedPosts = cfg.save.posts;
    settingsState.savedComments = cfg.save.comments;
    settingsState.favorites = cfg.sidebar.favorites;
};
var openSettingsModal = function () { return __awaiter(void 0, void 0, void 0, function () {
    var _a;
    return __generator(this, function (_b) {
        switch (_b.label) {
            case 0:
                selectors_1.getTopLevelContainersForBlurring().addClass(styles_1.blurAnimatedCls).addClass(styles_1.blurCls);
                _a = initializeSettingsForm;
                return [4 /*yield*/, config_1.readConfig()];
            case 1:
                _a.apply(void 0, [_b.sent()]);
                common_1.$c(styles_1.settingsBackdropCls).show();
                common_1.$c(styles_1.settingsModalCls).addClass(styles_1.settingsModalVisibleCls);
                return [2 /*return*/];
        }
    });
}); };
var closeSettingsModal = function () {
    selectors_1.getTopLevelContainersForBlurring().removeClass(styles_1.blurCls);
    common_1.$c(styles_1.settingsModalCls).removeClass(styles_1.settingsModalVisibleCls);
    setTimeout(function () { return common_1.$c(styles_1.settingsBackdropCls).hide(); }, 200); // wait for transition to finish
};
var getConfigFromSettingsFormAndState = function () {
    var getStrVal = function (id) { return common_1.$i(id).val(); };
    var getNumVal = function (id) { var _a; return (_a = Number.parseInt(String(common_1.$i(id).val()))) !== null && _a !== void 0 ? _a : -1; };
    var getChecked = function (id) { return Boolean(common_1.$i(id).prop('checked')); };
    var getRadioChecked = function (id) { return $("input[name=\"" + id + "\"]:checked").val(); };
    return ({
        expandoButton: {
            enabled: getChecked(expandoButtonId),
            resize: getChecked(expandoButtonResizeId),
            style: ramda_1.pipe(getStrVal, config_1.asExpandoButtonStyleOrDefault)(expandoButtonStyleId),
            alignRight: getChecked(expandoButtonAlignRightId),
            textClosed: getStrVal(expandoButtonTextClosedId),
            textOpened: getStrVal(expandoButtonTextOpenedId),
            showComments: getChecked(expandoButtonShowCommentsId),
            autoExpandComments: getChecked(expandoButtonAutoExpandCommentsId),
            hideToggleCommentsButton: getChecked(expandoButtonHideToggleCommentsButtonId),
            postTextOrder: getNumVal(expandoButtonPostTextOrderId),
            embedOrder: getNumVal(expandoButtonEmbedOrderId),
            commentsOrder: getNumVal(expandoButtonCommentsOrderId),
            closerEnabled: getChecked(expandoButtonCloserId),
            clickOnPostToOpen: getChecked(expandoButtonClickOnPostToOpenId),
            hide: getChecked(expandoButtonHideId),
            autoOpenOnDetailOnUnsupportedVideos: getChecked(expandoButtonAutoOpenOnDetailOnUnsupportedVideosId),
            autoOpenOnDetail: getChecked(expandoButtonAutoOpenOnDetailId),
            deferLoadingOfPost: getChecked(expandoButtonDeferLoadingOfPostId),
            autoOpen: getChecked(expandoButtonAutoOpenId),
        },
        infiniteScroll: {
            enabled: getChecked(infiniteScrollId),
            loadEarlier: getChecked(infiniteScrollLoadEarlierId),
        },
        voting: {
            bigVoteArrowsOnMobile: getChecked(bigVoteArrowsOnMobileId),
            clickEffect: getChecked(voteEffectId),
        },
        post: {
            openInNewTab: getChecked(openPostInNewTabId),
            hideAlreadyJoinedGuildsInDiscovery: getChecked(hideAlreadyJoinedGuildsInDiscoveryId),
            improvedTableStyles: getChecked(improvedTableStylesId),
            lessAggressivePatronBadges: getChecked(lessAggressivePatronBadgesId),
            disablePostActionsJumpingAboveBarOnHover: getChecked(disablePostActionsJumpingAboveBarOnHoverId),
            imageThumbnailIconType: getChecked(imageThumbnailIconTypeId),
            imageThumbnailIconTypeStyle: ramda_1.pipe(getStrVal, config_1.asImageThumbnailIconTypeStyleOrDefault)(imageThumbnailIconTypeStyleId),
            imageThumbnailIconTypeBackground: getChecked(imageThumbnailIconTypeBackgroundId),
            closeButtonInImageDialog: getChecked(closeButtonInImageDialogId),
            rulesEngineEnabled: getChecked(postRulesEngineEnabledId),
            rules: settingsState.postRules,
            upDownVotesAsText: getChecked(postUpDownVotesAsTextId),
            downloadButton: getChecked(postDownloadButtonId),
            downloadButtonMode: ramda_1.pipe(getRadioChecked, config_1.asDownloadButtonModeOrDefault)(postDownloadButtonModeId),
            showThumbnailOnHover: getChecked(postShowThumbnailOnHoverId),
            thumbnailMode: ramda_1.pipe(getStrVal, config_1.asThumbnailModeOrDefault)(postThumbnailModeId),
        },
        sidebar: {
            rightButton: getChecked(sidebarRightHideButtonId),
            autoHideRight: getChecked(sidebarRightAutoHideId),
            autoHideRightButNotOnGuildPage: getChecked(sidebarRightAutoHideButNotOnGuildPageId),
            independentScroll: getChecked(sidebarIndependentScrollId),
            favoritesEnabled: getChecked(sidebarFavoritesId),
            favorites: settingsState.favorites,
            favoritesSmallImages: getChecked(sidebarFavoritesSmallImagesId),
            smallGuildImages: getChecked(sidebarSmallGuildImagesId),
            savedContentLinkInFeeds: getChecked(sidebarSavedContentInFeedsId),
            hideContentOfMyGuilds: getChecked(sidebarHideContentOfMyGuildsId),
        },
        createPost: {
            loadTitleButton: getChecked(createPostLoadTitleId),
            markdownPreview: getChecked(createPostMarkdownPreviewId),
            openUrlButton: getChecked(createPostOpenUrlButtonId),
        },
        comment: {
            ctrlEnterToSend: getChecked(commentCtrlEnterToSendId),
            biggerFoldButtons: getChecked(commentBiggerFoldButtonsId),
            upDownVotesAsText: getChecked(commentUpDownVotesAsTextId),
            preview: getChecked(commentPreviewId),
            autoCollapseCommentsRegex: getStrVal(commentAutoCollapseCommentsRegexId),
            hideTipButton: getChecked(commentHideTipButtonId),
            imageUpload: getChecked(commentImageUploadId),
            reactionGifs: getChecked(commentReactionGifId),
            revealBlocked: getChecked(commentRevealBlockedId),
        },
        external: {
            imgbbKey: getStrVal(imgBbKeyId),
            downloadServerAddress: getStrVal(downloadServerAddressId),
        },
        debug: {
            enabled: getChecked(debugId),
            autoOpenSettings: getChecked(debugAutoOpenSettingsId),
            insertTestPostRule: getChecked(debugInsertTestPostRuleId),
            dontHideAppLoadingOverlay: getChecked(debugDontHideAppLoadingOverlayId),
        },
        advanced: {
            enabled: getChecked(advancedEnabledId),
            js: getStrVal(advancedJsId),
            css: getStrVal(advancedCssId),
        },
        save: {
            enabled: getChecked(savingEnabledId),
            posts: settingsState.savedPosts,
            postSavingEnabled: getChecked(savingPostsEnabledId),
            commentSavingEnabled: getChecked(savingCommentsEnabledId),
            comments: settingsState.savedComments,
        },
        application: {
            disableLoadingOverlay: getChecked(disableLoadingOverlayId),
        },
    });
};
var saveAndCloseSettingsModal = function () { return __awaiter(void 0, void 0, void 0, function () {
    var newValues, _a;
    return __generator(this, function (_b) {
        switch (_b.label) {
            case 0:
                _a = [{}];
                return [4 /*yield*/, config_1.readConfig()];
            case 1:
                newValues = __assign.apply(void 0, [__assign.apply(void 0, _a.concat([_b.sent()])), getConfigFromSettingsFormAndState()]);
                common_1.debugLog('generated new config', newValues);
                return [4 /*yield*/, config_1.writeConfig(newValues)];
            case 2:
                _b.sent();
                closeSettingsModal();
                return [2 /*return*/];
        }
    });
}); };
var saveAndReloadSettings = function () { return __awaiter(void 0, void 0, void 0, function () {
    return __generator(this, function (_a) {
        switch (_a.label) {
            case 0: return [4 /*yield*/, saveAndCloseSettingsModal()];
            case 1:
                _a.sent();
                window.location.reload();
                return [2 /*return*/];
        }
    });
}); };
var resetSettings = function () { return __awaiter(void 0, void 0, void 0, function () {
    var _a;
    return __generator(this, function (_b) {
        switch (_b.label) {
            case 0: return [4 /*yield*/, config_1.writeConfig(config_1.defaultConfig)];
            case 1:
                _b.sent();
                _a = initializeSettingsForm;
                return [4 /*yield*/, config_1.readConfig()];
            case 2:
                _a.apply(void 0, [_b.sent()]);
                return [2 /*return*/];
        }
    });
}); };
var exportSettings = function () { return __awaiter(void 0, void 0, void 0, function () {
    var cfg;
    return __generator(this, function (_a) {
        switch (_a.label) {
            case 0: return [4 /*yield*/, config_1.readConfig()];
            case 1:
                cfg = _a.sent();
                downloader_1.download(JSON.stringify(cfg), 'application/json', 'RuqES-settings.json');
                return [2 /*return*/];
        }
    });
}); };
var importSettingsFileConfirmed = function (evt) {
    common_1.debugLog('importSettingsFileConfirmed', evt);
    var files = common_1.$i(importHelperId).prop('files');
    if (!files || !files[0]) {
        return;
    }
    var file = files[0];
    common_1.debugLog('got file', file);
    var reader = new FileReader();
    reader.onload = function (readEvt) { return __awaiter(void 0, void 0, void 0, function () {
        var text, newCfg;
        var _a;
        return __generator(this, function (_b) {
            switch (_b.label) {
                case 0:
                    text = (_a = readEvt === null || readEvt === void 0 ? void 0 : readEvt.target) === null || _a === void 0 ? void 0 : _a.result;
                    common_1.debugLog('read result', text);
                    newCfg = null;
                    try {
                        newCfg = JSON.parse(text);
                    } //
                    catch (e) {
                        alert("Failed to parse given file as JSON.");
                    }
                    if (!(newCfg !== null)) return [3 /*break*/, 2];
                    return [4 /*yield*/, config_1.writeConfig(newCfg)];
                case 1:
                    _b.sent();
                    window.location.reload();
                    _b.label = 2;
                case 2: return [2 /*return*/];
            }
        });
    }); };
    reader.readAsBinaryString(file);
};
var importSettings = function () { return __awaiter(void 0, void 0, void 0, function () {
    return __generator(this, function (_a) {
        common_1.$i(importHelperId).click();
        return [2 /*return*/];
    });
}); };
var createSettingsDialog = function () {
    var mobileBadge = "<span class=\"badge badge-secondary\">mobile</span>";
    var desktopBadge = "<span class=\"badge badge-dark\">desktop</span>";
    var experimentalBadge = "<span class=\"badge badge-danger\">experimental</span>";
    var infiniteScrollCoolDownBadge = common_1.withTooltip('Adds cool-down to infinite scroll', "<span class=\"badge badge-info\">IS CD</span>");
    var deferredLoadingBadge = common_1.withTooltip('Enables deferred loading of posts', "<span class=\"badge badge-info\">DL</span>");
    var deprecatedBadge = common_1.withTooltip('Will be removed in future version', "<span class=\"badge badge-warning\">deprecated</span>");
    var helpBadge = "<span class=\"badge badge-dark\">?</span>";
    var genSelectOptions = function (values, valueToNameMap) {
        return values.map(function (x) { return "<option value=\"" + x + "\">" + valueToNameMap[x] + "</option>"; }).join('\n');
    };
    var expandoContent = "\n<div class=\"form-group mb-2\">\n    <input type=\"checkbox\" id=\"" + expandoButtonId + "\" class=\"form-control\" />\n    <label for=\"" + expandoButtonId + "\">Expando button</label>\n</div>\n<div class=\"form-group mb-2\">\n    <label for=\"" + expandoButtonStyleId + "\" class=\"mr-1\">Style</label>\n    <select id=\"" + expandoButtonStyleId + "\" class=\"form-control\">\n        " + genSelectOptions(config_1.expandoButtonStyles, config_1.expandoButtonStyleNames) + "\n    </select>\n</div>\n\n<div class=\"form-group mb-2\">\n    <input type=\"checkbox\" id=\"" + expandoButtonShowCommentsId + "\" class=\"form-control\" />\n    <label for=\"" + expandoButtonShowCommentsId + "\" class=\"mr-1\">Show comments</label>\n</div>\n<div class=\"form-group mb-2 ml-3\">\n    <input type=\"checkbox\" id=\"" + expandoButtonAutoExpandCommentsId + "\" class=\"form-control\" />\n    <label for=\"" + expandoButtonAutoExpandCommentsId + "\" class=\"mr-1\">Automatically expand comments</label>" + experimentalBadge + "\n</div>\n<div class=\"form-group mb-2 ml-3\">\n    <input type=\"checkbox\" id=\"" + expandoButtonHideToggleCommentsButtonId + "\" class=\"form-control\" />\n    <label for=\"" + expandoButtonHideToggleCommentsButtonId + "\" class=\"mr-1\">Hide toggle comments button</label>" + experimentalBadge + "\n</div>\n\n<div class=\"form-group mb-2\">\n    <input type=\"checkbox\" id=\"" + expandoButtonResizeId + "\" class=\"form-control\" />\n    <label for=\"" + expandoButtonResizeId + "\">Image resizing " + desktopBadge + "</label>\n</div>\n<div class=\"form-group mb-2\">\n    <input type=\"checkbox\" id=\"" + expandoButtonDeferLoadingOfPostId + "\" class=\"form-control\" />\n    <label for=\"" + expandoButtonDeferLoadingOfPostId + "\">Defer loading of post</label>\n    <span class=\"ml-1\"></span>\n    " + experimentalBadge + "\n</div>\n<div class=\"form-group mb-2\">\n    <input type=\"checkbox\" id=\"" + expandoButtonAutoOpenId + "\" class=\"form-control\" />\n    <label for=\"" + expandoButtonAutoOpenId + "\">Automatically open</label>\n    <span class=\"ml-1\"></span>\n    " + deferredLoadingBadge() + "\n    <span class=\"ml-1\"></span>\n    " + experimentalBadge + "\n</div>\n<div class=\"form-group mb-2\">\n    <input type=\"checkbox\" id=\"" + expandoButtonAutoOpenOnDetailOnUnsupportedVideosId + "\" class=\"form-control\" />\n    <label for=\"" + expandoButtonAutoOpenOnDetailOnUnsupportedVideosId + "\">Auto-open on detail on videos not supported by Ruqqus</label>\n</div>\n<div class=\"form-group mb-2\">\n    <input type=\"checkbox\" id=\"" + expandoButtonAutoOpenOnDetailId + "\" class=\"form-control\" />\n    <label for=\"" + expandoButtonAutoOpenOnDetailId + "\">Auto-open on detail</label>\n</div>\n<div class=\"form-group mb-2\">\n    <input type=\"checkbox\" id=\"" + expandoButtonCloserId + "\" class=\"form-control\" />\n    <label for=\"" + expandoButtonCloserId + "\" class=\"mr-1\">Closer</label> " + desktopBadge + "\n    <span class=\"ml-1\"></span>\n    " + common_1.withTooltip('A thin bar used for closing the expando box, similar to comments on desktop.', helpBadge)('right', 'medium') + "\n</div>\n<div class=\"form-group mb-2\">\n    <input type=\"checkbox\" id=\"" + expandoButtonClickOnPostToOpenId + "\" class=\"form-control\" />\n    <label for=\"" + expandoButtonClickOnPostToOpenId + "\">Click on post to open</label>\n</div>\n<div class=\"form-group mb-2\">\n    <input type=\"checkbox\" id=\"" + expandoButtonHideId + "\" class=\"form-control\" />\n    <label for=\"" + expandoButtonHideId + "\">Hide</label>\n    <span class=\"ml-1\"></span>\n    " + common_1.withTooltip('Expando button functionality is preserved. Useful with \'click to open\' and similar.', helpBadge)('right', 'large') + "\n</div>\n<div class=\"form-group mb-2\">\n    <input type=\"checkbox\" id=\"" + expandoButtonAlignRightId + "\" class=\"form-control\" />\n    <label for=\"" + expandoButtonAlignRightId + "\">Align right " + mobileBadge + "</label>\n</div>\n<div class=\"form-group mb-2 " + styles_1.settingsExpandoButtonActionCharacterCls + "\">\n    <label for=\"" + expandoButtonTextClosedId + "\" class=\"mr-1\">Open character:</label><br />\n    <input type=\"text\" id=\"" + expandoButtonTextClosedId + "\" class=\"form-control " + styles_1.widthAutoCls + "\" maxlength=\"5\" list=\"" + expandoButtonTextClosedListId + "\" />\n    <datalist id=\"" + expandoButtonTextClosedListId + "\">\n        <option value=\"+\">\n        <option value=\"\u2629\">\n        <option value=\"\u2795\">\n        <option value=\"\u1690\">\n        <option value=\"\u29FE\">\n        <option value=\"\u2295\">\n        <option value=\"\u2261\">\n        <option value=\"\u2261\">\n        <option value=\"\uD834\uDF62\">\n        <option value=\"\u2263\">\n        <option value=\"\uD834\uDF63\">\n        <option value=\"\uD834\uDF09\">\n        <option value=\"\u25B6\">\n    </datalist>\n</div>\n<div class=\"form-group mb-2 " + styles_1.settingsExpandoButtonActionCharacterCls + "\">\n    <label for=\"" + expandoButtonTextOpenedId + "\" class=\"mr-1\">Close character:</label><br />\n    <input type=\"text\" id=\"" + expandoButtonTextOpenedId + "\" class=\"form-control " + styles_1.widthAutoCls + "\" maxlength=\"5\" list=\"" + expandoButtonTextOpenedListId + "\" />\n        <datalist id=\"" + expandoButtonTextOpenedListId + "\">\n        <option value=\"-\">\n        <option value=\"\u2013\">\n        <option value=\"\u2015\">\n        <option value=\"\u29FF\">\n        <option value=\"\u29FF\">\n        <option value=\"\u2796\">\n        <option value=\"\u229D\">\n        <option value=\"\u0398\">\n        <option value=\"\u25BC\">\n    </datalist>\n</div>\n\n<hr>\n\n<div class=\"" + styles_1.settingsExpandoOrdersCls + " mb-1\">\n    Number values mean order/priority. The lower the number (relative to others) the higher the element will be shown.\n</div>\n<div class=\"ml-3 " + styles_1.settingsExpandoOrdersCls + "\">\n  <div class=\"form-group mb-2\">\n      <label for=\"" + expandoButtonPostTextOrderId + "\">Post text</label>\n      <input type=\"number\" id=\"" + expandoButtonPostTextOrderId + "\" class=\"form-control\" />\n  </div>\n  <div class=\"form-group mb-2\">\n      <label for=\"" + expandoButtonEmbedOrderId + "\">Embed</label>\n      <input type=\"number\" id=\"" + expandoButtonEmbedOrderId + "\" class=\"form-control\" />\n  </div>\n  <div class=\"form-group mb-2\">\n      <label for=\"" + expandoButtonCommentsOrderId + "\">Comments</label>\n      <input type=\"number\" id=\"" + expandoButtonCommentsOrderId + "\" class=\"form-control\" />\n  </div>\n</div>\n  ";
    var infiniteScrollContent = "\n<div class=\"form-group mb-2\">\n    <input type=\"checkbox\" id=\"" + infiniteScrollId + "\" class=\"form-control\" />\n    <label for=\"" + infiniteScrollId + "\">Infinite scroll</label>\n</div>\n<div class=\"form-group mb-2 ml-3\">\n    <input type=\"checkbox\" id=\"" + infiniteScrollLoadEarlierId + "\" class=\"form-control\" />\n    <label for=\"" + infiniteScrollLoadEarlierId + "\" class=\"mr-1\">Start loading next page earlier</label>" + infiniteScrollCoolDownBadge('left') + "\n</div>\n  ";
    var postContent = "\n<div class=\"form-group mb-2\">\n    <input type=\"checkbox\" id=\"" + imageThumbnailIconTypeId + "\" class=\"form-control\" />\n    <label for=\"" + imageThumbnailIconTypeId + "\">Show icon of thumbnail action</label>\n</div>\n<div class=\"form-group mb-2 ml-3\">\n    <label for=\"" + imageThumbnailIconTypeStyleId + "\" class=\"mr-1\">Style</label>\n    <select id=\"" + imageThumbnailIconTypeStyleId + "\" class=\"form-control\">\n        " + genSelectOptions(config_1.imageThumbnailIconTypeStyles, config_1.imageThumbnailIconTypeStyleNames) + "\n    </select>\n</div>\n<div class=\"form-group mb-2 ml-3\">\n    <input type=\"checkbox\" id=\"" + imageThumbnailIconTypeBackgroundId + "\" class=\"form-control\" />\n    <label for=\"" + imageThumbnailIconTypeBackgroundId + "\">Dark background</label>\n</div>\n\n\n<div class=\"form-group mb-2\">\n    <input type=\"checkbox\" id=\"" + improvedTableStylesId + "\" class=\"form-control\" />\n    <label for=\"" + improvedTableStylesId + "\">Improved styles for tables in posts</label>\n</div>\n\n<div class=\"form-group mb-2\">\n    <input type=\"checkbox\" id=\"" + openPostInNewTabId + "\" class=\"form-control\" />\n    <label for=\"" + openPostInNewTabId + "\">Open posts in a new tab</label>\n</div>\n\n<div class=\"form-group mb-2 ml-3\">\n    <label for=\"" + postThumbnailModeId + "\" class=\"mr-1\">Thumbnail mode</label>\n    <select id=\"" + postThumbnailModeId + "\" class=\"form-control\">\n        " + genSelectOptions(config_1.thumbnailModeValues, config_1.thumbnailModeNames) + "\n    </select>\n</div>\n\n<div class=\"form-group mb-2\">\n    <input type=\"checkbox\" id=\"" + hideAlreadyJoinedGuildsInDiscoveryId + "\" class=\"form-control\" />\n    <label for=\"" + hideAlreadyJoinedGuildsInDiscoveryId + "\" class=\"mr-1\">Hide joined guilds on \"discover\" page</label> " + infiniteScrollCoolDownBadge('left') + "\n</div>\n\n<div class=\"form-group mb-2\">\n    <input type=\"checkbox\" id=\"" + lessAggressivePatronBadgesId + "\" class=\"form-control\" />\n    <label for=\"" + lessAggressivePatronBadgesId + "\">Less aggressive patron/coin/premium badges</label>\n</div>\n\n<div class=\"form-group mb-2\">\n    <input type=\"checkbox\" id=\"" + disablePostActionsJumpingAboveBarOnHoverId + "\" class=\"form-control\" />\n    <label for=\"" + disablePostActionsJumpingAboveBarOnHoverId + "\">Disable post actions jumping above bar on hover</label>\n</div>\n\n<div class=\"form-group mb-2\">\n    <input type=\"checkbox\" id=\"" + createPostMarkdownPreviewId + "\" class=\"form-control\" />\n    <label for=\"" + createPostMarkdownPreviewId + "\">Post preview (Markdown)</label>\n</div>\n\n<div class=\"form-group mb-2 d-block\">\n    <label for=\"" + imgBbKeyId + "\">\n        <a href=\"https://api.imgbb.com/\" target=\"_blank\">imgbb</a> API key:\n    </label><br />\n    <input type=\"text\" id=\"" + imgBbKeyId + "\" class=\"form-control\" />\n</div>\n\n<div class=\"form-group mb-2\">\n    <input type=\"checkbox\" id=\"" + closeButtonInImageDialogId + "\" class=\"form-control\" />\n    <label for=\"" + closeButtonInImageDialogId + "\">Add close button to image dialog</label> " + mobileBadge + "\n</div>\n\n<div class=\"form-group mb-2\">\n    <input type=\"checkbox\" id=\"" + postUpDownVotesAsTextId + "\" class=\"form-control\" />\n    <label for=\"" + postUpDownVotesAsTextId + "\" class=\"mr-1\">Up-vote and down-vote counts as text</label> " + desktopBadge + "\n</div>\n\n<div class=\"form-group mb-2\">\n    <input type=\"checkbox\" id=\"" + postDownloadButtonId + "\" class=\"form-control\" />\n    <label for=\"" + postDownloadButtonId + "\" class=\"mr-1\">Download button</label> " + desktopBadge + "\n</div>\n<div class=\"ml-3\">\n    <div class=\"form-group mb-2 d-block\">\n        <input \n            type=\"radio\"\n            id=\"" + postDownloadButtonModeTwoClickId + "\"\n            name=\"" + postDownloadButtonModeId + "\"\n            value=\"" + common_1.ofType('twoClick') + "\"\n            class=\"form-control\"\n        />\n        <label for=\"" + postDownloadButtonModeTwoClickId + "\" class=\"mr-1\">Two-click</label>\n        <span class=\"ml-1\"></span>\n        " + common_1.withTooltip('Browsers have a lot of limitations in place, so default behavior is two-click download (first click to RuqES download an image into memory and a second to trigger download attribute of anchor tag).', helpBadge)('top', 'large') + "\n    </div>\n    <div class=\"form-group mb-2 d-block\">\n        <input \n            type=\"radio\"\n            id=\"" + postDownloadButtonModeDownloadServerId + "\"\n            name=\"" + postDownloadButtonModeId + "\"\n            value=\"" + common_1.ofType('downloadServer') + "\"\n            class=\"form-control\"\n        />\n        <label for=\"" + postDownloadButtonModeDownloadServerId + "\">download-server</label>\n        (<a href=\"https://gitlab.com/enefi/download-server\" target=\"_blank\">get</a>)\n    </div>\n    <div class=\"form-group mb-2 ml-5 d-block\">\n        <label for=\"" + downloadServerAddressId + "\">\n            Address:\n        </label><br />\n        <input type=\"text\" id=\"" + downloadServerAddressId + "\" class=\"form-control\" />\n    </div>\n</div>\n\n<div class=\"form-group mb-2\">\n    <input type=\"checkbox\" id=\"" + postShowThumbnailOnHoverId + "\" class=\"form-control\" />\n    <label for=\"" + postShowThumbnailOnHoverId + "\" class=\"mr-1\">Show image on thumbnail hover</label> " + desktopBadge + "\n</div>\n\n<h3>Create post page</h3>\n\n<div class=\"form-group mb-2\">\n    <input type=\"checkbox\" id=\"" + createPostLoadTitleId + "\" class=\"form-control\" />\n    <label for=\"" + createPostLoadTitleId + "\">Load title button</label>\n</div>\n\n<div class=\"form-group mb-2\">\n    <input type=\"checkbox\" id=\"" + createPostOpenUrlButtonId + "\" class=\"form-control\" />\n    <label for=\"" + createPostOpenUrlButtonId + "\" class=\"mr-1\">Open URL button</label>\n</div>\n  ";
    var genModuleButton = function (moduleName, label) {
        return "<a class=\"" + moduleButtonCls + " btn btn-secondary m-1\" data-module=\"" + moduleName + "\">" + label + "</a>";
    };
    var postRulesContent = "\n    <div class=\"form-group mb-2\">\n        <input type=\"checkbox\" id=\"" + postRulesEngineEnabledId + "\" class=\"form-control\" />\n        <label for=\"" + postRulesEngineEnabledId + "\" class=\"mr-1\">Post rules engine</label>\n        " + common_1.withTooltip('It is recommended to only add rules of which you understand their code. While RuqES runs rules in a sandbox, the sandbox is not guaranteed to be perfect.', helpBadge)('bottom', 'large') + "\n        &nbsp;\n        " + experimentalBadge + "\n    </div>\n    <div id=\"" + postRulesTopBarId + "\" class=\"d-flex align-items-center\">\n      <h3 class=\"d-inline-block mr-2\">Rules</h3>\n      <span class=\"" + styles_1.settingsPostRulesNumberCls + "\"></span>\n      <a class=\"btn btn-secondary my-1 ml-3\" id=\"" + postRulesNewButtonId + "\" title=\"Create new rule\">\n            <i class=\"fad fa-cauldron mr-1\"></i> New rule\n      </a>\n      <a class=\"btn btn-secondary my-1 ml-2\" id=\"" + postRulesFromTemplateButtonId + "\" title=\"Create new rule form template\">\n            <i class=\"fad fa-scroll-old mr-1\"></i> From template\n      </a>\n    </div>\n    <div class=\"" + styles_1.settingsPostRulesListCls + " mb-2\"></div>\n    <div class=\"" + styles_1.settingsPostRuleNewFormCls + "\">\n      <h3 class=\"d-inline-block\">New rule</h3>\n      <span class=\"ml-2\">\n        See <a href=\"https://gitlab.com/enefi/ruqes/-/blob/master/RECIPES.md\" target=\"_blank\">recipes</a> for inspiration.\n      </span>\n      \n      <div class=\"form-group mb-1\">\n          <textarea id=\"" + postRuleBodyId + "\" class=\"form-control text-monospace " + styles_1.settingsPostRuleBodyCls + "\"></textarea>\n      </div>\n      <div class=\"d-flex justify-content-between\">\n        <a class=\"btn btn-secondary\" id=\"" + postRulesNewFormBackButtonId + "\">Back</a>\n        <a class=\"btn btn-secondary\" id=\"" + postRuleNewFormSaveButtonId + "\"></a>\n      </div>\n    </div>\n    <div class=\"" + styles_1.settingsPostRuleTemplateFormCls + "\">\n      <h3>Post rule templates</h3>\n      <div class=\"" + styles_1.settingsPostRulesTemplatesListCls + " mb-2\"></div>\n      <div class=\"d-flex justify-content-between\">\n        <a class=\"btn btn-secondary\" id=\"" + postRulesTemplateFormBackButtonId + "\">Back</a>\n        <span></span>\n      </div>\n    </div>\n";
    var advancedContent = "\n<div class=\"form-group mb-1\">\n    <input type=\"checkbox\" id=\"" + disableLoadingOverlayId + "\" class=\"form-control\" />\n    <label for=\"" + disableLoadingOverlayId + "\">Disable loading overlay</label>\n</div>\n\n<div class=\"alert alert-danger mt-3\" role=\"alert\">\n    " + common_1.withTooltip('CSS can be a privacy problem (e.g. allowing tracking of your IP address), JS can be a grieve security issue (e.g. stealing security tokens from cookies or a password from a login form).', '<span class="badge badge-danger">Warning</span>')('right', 'large') + "\n    Only enable this module if you are absolutely sure about what you are doing. There are considerable privacy and security implications.<br>\n    Do NOT mindlessly copy-paste code from untrusted sources.\n</div>\n\n<div class=\"form-group mb-2\">\n    <input type=\"checkbox\" id=\"" + advancedEnabledId + "\" class=\"form-control\" />\n    <label for=\"" + advancedEnabledId + "\">Advanced module</label>\n</div>\n\n<div class=\"ml-3\">\n    <div class=\"form-group mb-2 d-block\">\n        <label for=\"" + advancedJsId + "\">Custom JavaScript:</label>\n        <br />\n        <textarea id=\"" + advancedJsId + "\" class=\"form-control\"></textarea>\n    </div>\n    \n    <div class=\"form-group mb-2 d-block\"> \n        <label for=\"" + advancedCssId + "\">Custom CSS:</label>\n        <br />\n        <textarea id=\"" + advancedCssId + "\" class=\"form-control\"></textarea>\n    </div>\n</div>\n";
    var commentContent = "\n<div class=\"form-group mb-2\">\n    <input type=\"checkbox\" id=\"" + commentPreviewId + "\" class=\"form-control\" />\n    <label for=\"" + commentPreviewId + "\">Preview</label>\n</div>\n<div class=\"form-group mb-2\">\n    <input type=\"checkbox\" id=\"" + commentCtrlEnterToSendId + "\" class=\"form-control\" />\n    <label for=\"" + commentCtrlEnterToSendId + "\"><kbd>CTRL</kbd> + <kbd>ENTER</kbd> to send comment</label>\n</div>\n<div class=\"form-group mb-2\">\n    <input type=\"checkbox\" id=\"" + commentBiggerFoldButtonsId + "\" class=\"form-control\" />\n    <label for=\"" + commentBiggerFoldButtonsId + "\">Bigger fold buttons " + mobileBadge + "</label>\n</div>\n<div class=\"form-group mb-2\">\n    <input type=\"checkbox\" id=\"" + commentUpDownVotesAsTextId + "\" class=\"form-control\" />\n    <label for=\"" + commentUpDownVotesAsTextId + "\" class=\"mr-1\">Up-vote and down-vote counts as text</label>\n    " + common_1.withTooltip("Please note your vote isn't applied until page reload.", helpBadge)('left', 'medium') + "\n</div>\n<div class=\"form-group mb-2 d-block\">\n    <label for=\"" + commentAutoCollapseCommentsRegexId + "\" class=\"mr-1\">Auto collapse comments which match regular expression:</label><br />\n    <input type=\"text\" id=\"" + commentAutoCollapseCommentsRegexId + "\" class=\"form-control\" />\n</div>\n<div class=\"form-group mb-2\">\n    <input type=\"checkbox\" id=\"" + commentHideTipButtonId + "\" class=\"form-control\" />\n    <label for=\"" + commentHideTipButtonId + "\">Hide tip button</label>\n</div>\n<div class=\"form-group mb-2\">\n    <input type=\"checkbox\" id=\"" + commentImageUploadId + "\" class=\"form-control\" />\n    <label for=\"" + commentImageUploadId + "\" class=\"mr-1\">Image upload</label>\n    " + common_1.withTooltip("'ImgBB API key' in 'Post' tab must be filled", helpBadge)('top', 'medium') + "\n</div>\n<div class=\"form-group mb-2\">\n    <input type=\"checkbox\" id=\"" + commentReactionGifId + "\" class=\"form-control\" />\n    <label for=\"" + commentReactionGifId + "\" class=\"mr-1\">Reaction gifs</label>\n    " + desktopBadge + "\n</div>\n<div class=\"form-group mb-2\">\n    <input type=\"checkbox\" id=\"" + commentRevealBlockedId + "\" class=\"form-control\" />\n    <label for=\"" + commentRevealBlockedId + "\" class=\"mr-1\">Reveal blocked comment button</label>\n    " + common_1.withTooltip("Simple implementation - shows a name, a link and a comment body. The link can be used with right click -> Open link in incognito window", helpBadge)('top', 'large') + "\n    <span class=\"ml-1\"></span>\n    " + desktopBadge + "\n    <span class=\"ml-1\"></span>\n    " + experimentalBadge + "\n</div>\n  ";
    var saveContent = "\n<div class=\"form-group mb-2\">\n    <input type=\"checkbox\" id=\"" + savingEnabledId + "\" class=\"form-control\" />\n    <label for=\"" + savingEnabledId + "\" class=\"mr-1\">Saving module enabled</label> " + experimentalBadge + "\n</div>\n\n<div class=\"ml-3\">\n    <div class=\"form-group mb-2\">\n        <input type=\"checkbox\" id=\"" + savingPostsEnabledId + "\" class=\"form-control\" />\n        <label for=\"" + savingPostsEnabledId + "\" class=\"mr-1\">Saving posts</label>\n    </div>\n    \n    <div class=\"form-group mb-2\">\n        <input type=\"checkbox\" id=\"" + savingCommentsEnabledId + "\" class=\"form-control\" />\n        <label for=\"" + savingCommentsEnabledId + "\" class=\"mr-1\">Saving comments</label> " + experimentalBadge + "\n    </div>\n</div>\n";
    var sidebarContent = "\n<div class=\"form-group mb-2\">\n    <input type=\"checkbox\" id=\"" + sidebarRightHideButtonId + "\" class=\"form-control\" />\n    <label for=\"" + sidebarRightHideButtonId + "\">Enable hide button for right sidebar</label>\n</div>\n<div class=\"ml-3\">\n    <div class=\"form-group mb-2\">\n        <input type=\"checkbox\" id=\"" + sidebarRightAutoHideId + "\" class=\"form-control\" />\n        <label for=\"" + sidebarRightAutoHideId + "\">Auto-hide right sidebar</label>\n    </div>\n    <div class=\"ml-3\">\n        <div class=\"form-group mb-2\">\n            <input type=\"checkbox\" id=\"" + sidebarRightAutoHideButNotOnGuildPageId + "\" class=\"form-control\" />\n            <label for=\"" + sidebarRightAutoHideButNotOnGuildPageId + "\">Not on guild page</label>\n        </div>\n    </div>\n</div>\n<div class=\"form-group mb-2\">\n    <input type=\"checkbox\" id=\"" + sidebarIndependentScrollId + "\" class=\"form-control\" />\n    <label for=\"" + sidebarIndependentScrollId + "\" class=\"mr-1\">Independent scroll</label>\n    " + common_1.withTooltip('Doesn\'t move when scrolling main content.', helpBadge)() + "\n</div>\n<div class=\"form-group mb-2\">\n    <input type=\"checkbox\" id=\"" + sidebarFavoritesId + "\" class=\"form-control\" />\n    <label for=\"" + sidebarFavoritesId + "\" class=\"mr-2\">Favorites</label>\n    " + desktopBadge + "\n</div>\n<div class=\"form-group mb-2 ml-3\">\n    <input type=\"checkbox\" id=\"" + sidebarFavoritesSmallImagesId + "\" class=\"form-control\" />\n    <label for=\"" + sidebarFavoritesSmallImagesId + "\" class=\"mr-2\">Small images</label>\n</div>\n<div class=\"form-group mb-2\">\n    <input type=\"checkbox\" id=\"" + sidebarSmallGuildImagesId + "\" class=\"form-control\" />\n    <label for=\"" + sidebarSmallGuildImagesId + "\">Small guild images in left sidebar</label>\n</div>\n<div class=\"form-group mb-2\">\n    <input type=\"checkbox\" id=\"" + sidebarSavedContentInFeedsId + "\" class=\"form-control\" />\n    <label for=\"" + sidebarSavedContentInFeedsId + "\">Add link to saved content to feeds section</label>\n</div>\n<div class=\"form-group mb-2\">\n    <input type=\"checkbox\" id=\"" + sidebarHideContentOfMyGuildsId + "\" class=\"form-control\" />\n    <label for=\"" + sidebarHideContentOfMyGuildsId + "\">Hide content of \"My Guilds\"</label>\n</div>\n  ";
    var enefiLink = "<a href=\"https://ruqqus.com/@enefi\" target=\"_blank\">@enefi</a>";
    var firstPublicCommitDate = moment_1.default('2020/6/21');
    var aboutContent = "\n<div class=\"d-flex justify-content-center align-items-center " + styles_1.aboutRuqesLogoCls + " mb-2\">\n    " + logo_svg_1.default + "\n</div>\n<div class=\"d-flex align-items-center flex-column\">\n    <p>RuqES is aiming at improving user experience of Ruqqus.</p>\n    <p>It has been doing that since its first commit on " + firstPublicCommitDate.format('D. M. YYYY') + " (" + moment_1.default().diff(firstPublicCommitDate, 'days') + " days ago).</p>\n    <p>This userscript was created and is maintained by " + enefiLink + ".</p>\n    <p>If you have any questions, suggestions or bug reports, you can visit <a href=\"https://ruqqus.com/+RuqES\" target=\"_blank\">+RuqES</a>.</p>\n</div>\n<hr>\n<div>\nI spent dozens, if not hundreds, of hours working on it. If you like RuqES, please consider donating.\n</div>\n<div class=\"mt-2\">\nBitCoin (\u20BF): <code>bc1qmvnnl6pzuxvc2pu6k3zc4zvt6slp0dwu6dp2pa</code>\n<a href=\"javascript:void 0\" onclick=\"$('." + styles_1.settingsAboutQrCls + "').toggle()\" class=\"btn btn-secondary shadow-sm\">Show QR code</a>\n<div class=\"justify-content-center my-4 " + styles_1.settingsAboutQrCls + "\">\n    <img src=\"data:image/png;base64," + btoa(donate_bitcoin_png_1.default) + "\">\n</div>\n</div>\n<hr>\n<div class=\"d-flex justify-content-center align-items-center flex-column mb-2\">\n  <span>License: AGPL3</span>\n  <a href=\"https://gitlab.com/enefi/ruqes\" target=\"_blank\">https://gitlab.com/enefi/ruqes</a>\n</div>\n  ";
    var content = "\n<hr class=\"mt-0 mb-2\">\n<form class=\"" + styles_1.formCls + "\">\n\n<div class=\"" + styles_1.settingsMenuCls + "\">\n  " + genModuleButton('expandoButton', 'Expando') + "\n  " + genModuleButton('infiniteScroll', 'Infinite scroll') + "\n  " + genModuleButton('voting', 'Voting') + "\n  " + genModuleButton('post', 'Post') + "\n  " + genModuleButton('postRules', 'Post rules') + "\n  " + genModuleButton('comment', 'Comment') + "\n  " + genModuleButton('save', 'Saving') + "\n  " + genModuleButton('sidebar', 'Sidebar') + "\n  " + genModuleButton('settings', 'Settings') + "\n  " + genModuleButton('about', 'About') + "\n  " + genModuleButton('advanced', 'Advanced') + "\n  " + genModuleButton('debug', 'Debug') + "\n</div>\n\n<hr class=\"mt-1\">\n\n<div class=\"" + moduleContainerCls + "\" data-module=\"expandoButton\">\n  " + expandoContent + "\n</div>\n\n<div class=\"" + moduleContainerCls + "\" data-module=\"infiniteScroll\">\n  " + infiniteScrollContent + "\n</div>\n\n<div class=\"" + moduleContainerCls + "\" data-module=\"voting\">\n  <div class=\"form-group mb-2\">\n      <input type=\"checkbox\" id=\"" + bigVoteArrowsOnMobileId + "\" class=\"form-control\" />\n      <label for=\"" + bigVoteArrowsOnMobileId + "\">Bigger vote arrows " + mobileBadge + "</label>\n  </div>\n  \n  <div class=\"form-group mb-2\">\n      <input type=\"checkbox\" id=\"" + voteEffectId + "\" class=\"form-control\" />\n      <label for=\"" + voteEffectId + "\">Vote effect</label>\n  </div>\n</div>\n\n<div class=\"" + moduleContainerCls + "\" data-module=\"post\">\n  " + postContent + "\n</div>\n\n<div class=\"" + moduleContainerCls + "\" data-module=\"postRules\">\n    " + postRulesContent + "\n</div>\n\n<div class=\"" + moduleContainerCls + "\" data-module=\"sidebar\">\n    " + sidebarContent + "\n</div>\n\n<div class=\"" + moduleContainerCls + "\" data-module=\"comment\">\n  " + commentContent + "\n</div>\n\n<div class=\"" + moduleContainerCls + "\" data-module=\"save\">\n  " + saveContent + "\n</div>\n\n<div class=\"" + moduleContainerCls + "\" data-module=\"advanced\">\n    " + advancedContent + "\n</div>\n\n<div class=\"" + moduleContainerCls + "\" data-module=\"debug\">\n  <div class=\"form-group mb-1\">\n      <input type=\"checkbox\" id=\"" + debugId + "\" class=\"form-control\" />\n      <label for=\"" + debugId + "\">Debug mode</label>\n  </div>\n  <div id=\"" + debugSectionId + "\" class=\"ml-3\">\n      <div class=\"form-group mb-2\">\n          <input type=\"checkbox\" id=\"" + debugAutoOpenSettingsId + "\" class=\"form-control\" />\n          <label for=\"" + debugAutoOpenSettingsId + "\">Auto-open settings</label>\n      </div>\n      <a class=\"btn btn-primary " + styles_1.btnPrimaryCls + " mb-2\" id=\"" + debugForceUpgradeId + "\">Force config upgrade</a>\n      <div class=\"form-group mb-2\">\n          <input type=\"checkbox\" id=\"" + debugInsertTestPostRuleId + "\" class=\"form-control\" />\n          <label for=\"" + debugInsertTestPostRuleId + "\">Insert test post rule</label>\n      </div>\n      <div class=\"form-group mb-2\">\n          <input type=\"checkbox\" id=\"" + debugDontHideAppLoadingOverlayId + "\" class=\"form-control\" />\n          <label for=\"" + debugDontHideAppLoadingOverlayId + "\">Don't hide app loading overlay</label>\n      </div>\n  </div>\n</div>\n\n<div class=\"" + moduleContainerCls + "\" data-module=\"settings\">\n  <div class=\"mb-1\"><strong>Settings operations</strong></div>\n  <div id=\"" + operationsContainerId + "\" class=\"d-flex\">\n      <input id=\"" + importHelperId + "\" type=\"file\" class=\"d-none\" accept=\"application/json\">\n  </div>\n</div>\n\n<div class=\"" + moduleContainerCls + "\" data-module=\"about\">\n    " + aboutContent + "\n</div>\n\n</form>\n    ";
    var captionPart = "\n<div class=\"d-flex justify-content-center align-items-baseline\">\n<div class=\"" + styles_1.settingsLogoCls + "\">" + logo_svg_1.default + "</div>\n<h1 class=\"" + styles_1.settingsCaptionCls + "\">RuqES</h1>\n<div class=\"ml-1\" style=\"opacity: 0.66\">\n  <span class=\"position-absolute\" style=\"top: 0.8em\">" + common_1.scriptVersion + "</span>\n  by " + enefiLink + "\n</div>\n</div>\n    ";
    var contentEl = $("<div>" + content + "</div>");
    contentEl.find('form').submit(function () {
        saveAndReloadSettings();
        return false;
    });
    var cancelButton = $('<a class="btn btn-secondary">Cancel</a>').click(closeSettingsModal);
    var saveButton = $('<a class="btn btn-secondary">Save</a>').click(saveAndCloseSettingsModal);
    var saveAndReloadButton = $('<a class="btn btn-primary ml-2">Save & reload</a>').addClass(styles_1.btnPrimaryCls).click(saveAndReloadSettings);
    var exportButton = $('<a class="btn btn-secondary">Export</a>').click(exportSettings);
    var importButton = $('<a class="btn btn-secondary ml-2">Import</a>').click(importSettings);
    var resetButton = $('<a class="btn btn-danger ml-2">Reset</a>').addClass(styles_1.btnDangerCls).click(resetSettings);
    contentEl.find("#" + operationsContainerId)
        .append(exportButton)
        .append(importButton)
        .append(resetButton);
    contentEl.find("#" + importHelperId).change(importSettingsFileConfirmed);
    contentEl.find("." + styles_1.settingsAboutQrCls).hide();
    var changesWarningPart = "\n<div class=\"flex-grow-1\"></div>\n<div>\n  <hr class=\"my-2\">\n  <div class=\"text-right mb-2\">Changes will take effect after a page reload.</div>\n</div>\n";
    var modal = $('<div>')
        .addClass(styles_1.settingsModalCls)
        .append(captionPart)
        .append(contentEl)
        .append(changesWarningPart)
        .append($('<div>').addClass(['d-flex', 'justify-content-between', 'mt-2'])
        .append(cancelButton)
        .append($('<div>')
        .append(saveButton)
        .append(saveAndReloadButton)));
    common_1.$c(styles_1.aboutRuqesLogoCls, modal).on('dblclick', function () {
        common_1.debugLog('settingsLogoCls ee');
        common_1.$c(styles_1.aboutRuqesLogoCls).toggleClass(styles_1.settingsLogoAnimCls);
    });
    common_1.$i(debugForceUpgradeId, modal).click(function () { return config_1.readConfig({ forceUpgrade: true }); });
    common_1.$i(debugId, modal).change(function (x) { return setVisibilityOfDebugSectionInSettings(x.target.checked); });
    var backdrop = $('<div>')
        .addClass(styles_1.settingsBackdropCls)
        .click(function (evt) {
        if ($(evt.target).hasClass(styles_1.settingsBackdropCls)) {
            closeSettingsModal();
        }
    });
    common_1.$c(moduleButtonCls, modal).click(function (evt) {
        var el = $(evt.target);
        var buttonModuleName = el.data('module');
        el.parent().parent().find("." + moduleContainerCls).each(function (_, rawEl) {
            var containerEl = $(rawEl);
            var moduleName = containerEl.data('module');
            containerEl.toggle(moduleName === buttonModuleName);
        });
        el.parent().find("." + moduleButtonCls).each(function (_, rawEl) {
            var el = $(rawEl);
            common_1.setClass(el, styles_1.settingsActiveTabButtonCls, el.data('module') === buttonModuleName);
        });
    });
    var defaultActiveTab = 0;
    common_1.$c(moduleContainerCls, modal).filter(function (i) { return i !== defaultActiveTab; }).hide();
    common_1.$c(moduleButtonCls, modal).filter(function (i) { return i === defaultActiveTab; }).addClass(styles_1.settingsActiveTabButtonCls);
    common_1.$i(postRuleNewFormSaveButtonId, modal).click(onPostRuleSaveButtonClick);
    common_1.$i(postRulesNewButtonId, modal).click(function () {
        settingsState.creatingNewRule = true;
        settingsState.backInPostRulesGoesToTemplates = false;
        refreshPostRulesElementsVisibility();
    });
    common_1.$i(postRulesFromTemplateButtonId, modal).click(function () {
        settingsState.creatingFromTemplate = true;
        refreshPostRuleTemplates();
        refreshPostRulesElementsVisibility();
    });
    common_1.$i(postRulesNewFormBackButtonId, modal).click(function () {
        settingsState.creatingNewRule = false;
        settingsState.indexOfPostRuleBeingEdited = null;
        if (settingsState.backInPostRulesGoesToTemplates) {
            settingsState.creatingFromTemplate = true;
        }
        refreshPostRulesElementsVisibility();
    });
    common_1.$i(postRulesTemplateFormBackButtonId, modal).click(function () {
        settingsState.creatingFromTemplate = false;
        refreshPostRulesElementsVisibility();
    });
    return backdrop.append(modal).hide();
};
var onPostRuleDeleteClick = function (ruleName) { return __awaiter(void 0, void 0, void 0, function () {
    var confirmed;
    return __generator(this, function (_a) {
        switch (_a.label) {
            case 0: return [4 /*yield*/, common_1.showConfirmDialog("Really delete post rule \"" + ruleName + "\"?")];
            case 1:
                confirmed = _a.sent();
                if (!confirmed) {
                    return [2 /*return*/];
                }
                settingsState.postRules = settingsState.postRules.filter(function (x) { return x.name !== ruleName; });
                refreshPostRules();
                return [2 /*return*/];
        }
    });
}); };
var onPostRuleMoveUpClick = function (idx) {
    settingsState.postRules = swapIndices_1.swapIndices(idx)(idx - 1)(settingsState.postRules);
    refreshPostRules();
};
var onPostRuleMoveDownClick = function (idx) {
    settingsState.postRules = swapIndices_1.swapIndices(idx)(idx + 1)(settingsState.postRules);
    refreshPostRules();
};
var onPostRuleEditClick = function (idx) {
    settingsState.indexOfPostRuleBeingEdited = idx;
    settingsState.backInPostRulesGoesToTemplates = false;
    common_1.$i(postRuleBodyId).val(settingsState.postRules[idx].body);
    refreshPostRulesElementsVisibility();
};
var onPostRuleItemNameClick = function (idx) {
    var rule = settingsState.postRules[idx];
    rule.enabled = !rule.enabled;
    refreshPostRules();
};
var onPostRuleSaveButtonClick = function () {
    var bodyEl = common_1.$i(postRuleBodyId);
    var bodyText = bodyEl.val();
    common_1.debugLog('postRuleSaveButton', bodyText);
    var parsed = parsePostRule_1.parsePostRule(String(bodyText));
    if (parsed.tag === 'ok') {
        var s = settingsState;
        var isEdit = s.indexOfPostRuleBeingEdited !== null;
        var rulesToCheck = isEdit ? ramda_1.without([s.postRules[s.indexOfPostRuleBeingEdited]])(s.postRules) : s.postRules;
        if (ramda_1.any(function (x) { return x.name === parsed.rule.name; })(rulesToCheck)) {
            alert('Rule with same name already exists.');
        }
        else {
            if (isEdit) {
                s.postRules = ramda_1.update(s.indexOfPostRuleBeingEdited, parsed.rule, s.postRules);
            }
            else {
                s.postRules.push(parsed.rule);
            }
            bodyEl.val('');
            refreshPostRules();
            s.creatingNewRule = false;
            s.indexOfPostRuleBeingEdited = null;
            refreshPostRulesElementsVisibility();
        }
    }
    else {
        alert(parsed.error);
    }
};
var refreshPostRules = function () {
    common_1.$c(styles_1.settingsPostRulesNumberCls)
        .text("( " + settingsState.postRules.filter(function (x) { return x.enabled; }).length + " / " + settingsState.postRules.length + " )");
    var list = common_1.$c(styles_1.settingsPostRulesListCls).empty();
    var createIcon = function (classes) { return $('<i>').addClass(classes); };
    var createButton = function (icon, title) {
        var processedIcon = common_1.isString(icon) ? createIcon(icon) : icon;
        return common_1.genJsAnchor().addClass('btn btn-secondary ml-1 py-1 px-2').html(processedIcon).prop('title', title);
    };
    var createItem = function (rule, idx) {
        var removeButton = createButton('fas fa-skull', 'Delete rule').click(function () { return onPostRuleDeleteClick(rule.name); });
        var editButton = createButton('fas fa-feather-alt', 'Edit').click(function () { return onPostRuleEditClick(idx); });
        var upButton = createButton('fas fa-angle-up', 'Move up');
        if (idx === 0) {
            upButton.addClass('disabled');
        }
        else {
            upButton.click(function () { return onPostRuleMoveUpClick(idx); });
        }
        var downButton = createButton('fas fa-angle-down', 'Move down');
        if (idx === common_1.lastIndex(settingsState.postRules)) {
            downButton.addClass('disabled');
        }
        else {
            downButton.click(function () { return onPostRuleMoveDownClick(idx); });
        }
        var disabledIcon = createIcon('fas fa-square');
        var enabledIcon = createIcon('fas fa-check-square');
        var itemName = $('<div>')
            .addClass('d-inline-block text-truncate')
            .addClass(styles_1.settingsPostRuleListItemNameCls)
            .text(rule.name)
            .prop('title', rule.body)
            .click(function () { return onPostRuleItemNameClick(idx); })
            .prepend((rule.enabled ? enabledIcon : disabledIcon).addClass('mr-2'));
        return $('<div>')
            .addClass('py-1 pl-2 pr-1 d-flex align-items-center')
            .addClass(styles_1.settingsPostRuleListItemCls)
            .addClass(rule.enabled ? '' : styles_1.settingsPostRuleListItemDisabledCls)
            .append(itemName)
            .append(editButton)
            .append(upButton)
            .append(downButton)
            .append(removeButton);
    };
    settingsState.postRules.map(createItem).forEach(function (x) { return list.append(x); });
};
var onPostRuleTemplateClick = function (template) {
    settingsState.creatingFromTemplate = false;
    if (template.customizationRecommended) {
        settingsState.creatingNewRule = true;
        settingsState.backInPostRulesGoesToTemplates = true;
        common_1.$i(postRuleBodyId).val(template.sourceCode);
    }
    else {
        var parsed = parsePostRule_1.parsePostRule(template.sourceCode);
        if (parsed.tag === 'fail') {
            throw new Error("Failed to parse template " + template.name + ":\n" + template.sourceCode);
        }
        settingsState.postRules = __spread(settingsState.postRules, [parsed.rule]);
    }
    refreshPostRules();
    refreshPostRulesElementsVisibility();
};
var refreshPostRuleTemplates = function () {
    var filteredTemplates = postRuleTemplates_1.postRuleTemplates.filter(function (x) { return settingsState.postRules.find(function (y) { return y.name === x.name; }) === undefined; });
    var list = common_1.$c(styles_1.settingsPostRulesTemplatesListCls).empty();
    filteredTemplates.forEach(function (template) {
        var btnEl = common_1.genJsAnchor()
            .addClass('btn btn-secondary m-1 d-flex align-items-center justify-content-between')
            .prop('title', template.sourceCode);
        btnEl.append($('<span>'));
        btnEl.append($('<span>').text(template.name).addClass('text-truncate'));
        var iconEl = $('<i>').addClass('ml-2')
            .addClass(template.customizationRecommended ? 'fas fa-caret-right mr-1' : 'fas fa-plus-circle');
        btnEl.append(iconEl);
        btnEl.click(function () { return onPostRuleTemplateClick(template); });
        list.append(btnEl);
    });
    if (ramda_1.isEmpty(filteredTemplates)) {
        var warningEl = $('<div>')
            .addClass('d-flex alert alert-secondary m-4')
            .text('No templates available.')
            .prop('title', 'Maybe you already created post rules from all predefined templates?');
        var wrapper = $('<div>')
            .addClass('w-100 d-flex justify-content-center')
            .addClass(styles_1.settingsPostRulesTemplatesListEmptyCls)
            .append(warningEl);
        list.append(wrapper);
    }
};
var refreshPostRulesElementsVisibility = function () {
    common_1.debugLog('refreshPostRulesElementsVisibility', settingsState);
    var s = settingsState;
    var showNewForm = s.creatingNewRule || s.indexOfPostRuleBeingEdited !== null;
    var showTemplateForm = s.creatingFromTemplate;
    var showTopBar = !showNewForm && !showTemplateForm;
    var showList = showTopBar;
    common_1.$c(styles_1.settingsPostRulesListCls).toggle(showList);
    common_1.$c(styles_1.settingsPostRuleNewFormCls).toggle(showNewForm);
    common_1.$i(postRuleNewFormSaveButtonId).text(s.creatingNewRule ? 'Create rule' : 'Update rule');
    common_1.$i(postRulesTopBarId).toggle(showTopBar);
    common_1.$c(styles_1.settingsPostRuleTemplateFormCls).toggle(showTemplateForm);
};
var setupCreatorMark = function () {
    var logoEl = $('<span>').html(logo_svg_1.default).addClass(styles_1.creatorMarkCls).prop('title', 'RuqES developer');
    common_1.$c('user-name').filter(function (_, el) { return $(el).text() === 'enefi'; }).addClass(styles_1.creatorNameCls).after(logoEl);
};
var createSettingsButtonForDesktop = function () { return common_1.createMainMenuButtonForDesktop('RuqES', null, openSettingsModal, 'fas fa-wrench'); };
var createSettingsButtonForMobile = function () { return common_1.createMainMenuButtonForMobile('RuqES', null, openSettingsModal, 'fas fa-wrench'); };
exports.setupSettings = function () { return __awaiter(void 0, void 0, void 0, function () {
    var cfg;
    return __generator(this, function (_a) {
        switch (_a.label) {
            case 0: return [4 /*yield*/, config_1.readConfig()];
            case 1:
                cfg = _a.sent();
                common_1.debugLog('setupSettings', cfg);
                setupCreatorMark();
                $('#navbar #navbarResponsive > ul > li:last-child a[href="/settings"]').after(createSettingsButtonForDesktop());
                $('#navbarResponsive > ul:last-child a.nav-link[href="/settings"]').parent().after(createSettingsButtonForMobile());
                $('body').prepend(createSettingsDialog());
                if (!cfg.debug.autoOpenSettings) return [3 /*break*/, 3];
                return [4 /*yield*/, openSettingsModal()];
            case 2:
                _a.sent();
                _a.label = 3;
            case 3: return [2 /*return*/];
        }
    });
}); };


/***/ }),
/* 35 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.download = void 0;
var downloadURI = function (uri, name) {
    var link = document.createElement("a");
    link.download = name;
    link.href = uri;
    link.click();
};
exports.download = function (data, type, name) {
    var blob = new Blob([data], { type: type });
    var url = window.URL.createObjectURL(blob);
    downloadURI(url, name);
    window.URL.revokeObjectURL(url);
};


/***/ }),
/* 36 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.parsePostRule = exports.parseHeaderValues = exports.parseHeaderWrapper = void 0;
var ramda_1 = __webpack_require__(4);
exports.parseHeaderWrapper = function (tag) { return function (text) {
    var re = new RegExp("\\/\\/\\s*==" + tag + "==\\s*\\n([\\s\\S]*)\\/\\/\\s*==\\/" + tag + "==\n(?:([\\s\\S]*))?");
    var res = text.match(re);
    if (res === null) {
        return null;
    }
    if (ramda_1.isEmpty(res.length)) {
        return null;
    }
    return { innerHeader: res[1].trim(), rest: res[2] || '' };
}; };
exports.parseHeaderValues = function (text) {
    var processed = ramda_1.pipe(ramda_1.split('\n'), ramda_1.map(function (x) {
        var m = x.match(/^\/\/\s+@(\w+)\s+(.+)$/);
        if (!m || !m[1] || !m[2]) {
            return null;
        }
        return [m[1], m[2]];
    }))(text);
    if (ramda_1.any(function (x) { return x === null; })(processed)) {
        return null;
    }
    return ramda_1.fromPairs(processed);
};
exports.parsePostRule = function (text) {
    var innerHeaderParsed = exports.parseHeaderWrapper('RuqES_PostRule')(text);
    if (innerHeaderParsed === null) {
        return { tag: 'fail', error: 'Failed to locate header' };
    }
    var headerValues = exports.parseHeaderValues(innerHeaderParsed.innerHeader);
    if (headerValues === null) {
        return { tag: 'fail', error: 'Failed to parse header values' };
    }
    if (!headerValues.name) {
        return { tag: 'fail', error: 'Missing name header value' };
    }
    if (!/^\w+$/.test(headerValues.name)) {
        return { tag: 'fail', error: 'Invalid name' };
    }
    var rule = {
        name: headerValues.name,
        body: text,
        enabled: true,
    };
    return { tag: 'ok', rule: rule };
};


/***/ }),
/* 37 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var __assign = (this && this.__assign) || function () {
    __assign = Object.assign || function(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);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.postRuleTemplates = void 0;
var trimSourceCode = function (x) { return x.trim(); };
exports.postRuleTemplates = [
    {
        name: 'BlurNsfwThumbnails',
        sourceCode: "\n// ==RuqES_PostRule==\n// @name BlurNsfwThumbnails\n// ==/RuqES_PostRule==\nif (post.nsfw) return A.blurThumbnailAction();\n    ",
        customizationRecommended: false,
    },
    {
        name: 'HideVotedOn',
        sourceCode: "\n// ==RuqES_PostRule==\n// @name HideVotedOn\n// ==/RuqES_PostRule==\nif (post.vote) return A.hideAction();\n    ",
        customizationRecommended: false,
    },
    {
        name: 'SemiHideVotedOn',
        sourceCode: "\n// ==RuqES_PostRule==\n// @name SemiHideVotedOn\n// ==/RuqES_PostRule==\nif (post.vote) return A.semiHideAction();\n    ",
        customizationRecommended: false,
    },
    {
        name: 'SemiHideFromSpecificGuilds',
        sourceCode: "\n// ==RuqES_PostRule==\n// @name SemiHideFromSpecificGuilds\n// ==/RuqES_PostRule==\n\nconst guilds = [\n    'OffensiveJokes',\n    'LGBT',\n];\n// replace \"semiHideAction\" with \"hideAction\" if you want posts fully hidden\nif (guilds.includes(post.guild)) return A.semiHideAction();\n    ",
        customizationRecommended: true,
    },
    {
        name: 'HideLinkingToDomains',
        sourceCode: "\n// ==RuqES_PostRule==\n// @name HideLinkingToDomains\n// ==/RuqES_PostRule==\nconst blocked = [\n  'https://i.ruqqus.com',\n  'https://youtu.be',\n  'https://www.youtube.com',\n];\nif (blocked.some(function (x){ return (post.link || '').startsWith(x)}))\n  return A.hideAction();\n    ",
        customizationRecommended: true,
    },
].map(function (t) { return (__assign(__assign({}, t), { sourceCode: trimSourceCode(t.sourceCode) })); });


/***/ }),
/* 38 */
/***/ (function(module, exports) {

module.exports = "‰PNG\r\n\u001a\n\u0000\u0000\u0000\rIHDR\u0000\u0000\u0000Æ\u0000\u0000\u0000Æ\b\u0006\u0000\u0000\u0000‰›ÿ]\u0000\u0000\u0000\u0004sBIT\b\b\b\b|\bdˆ\u0000\u0000\u0004@IDATxœíÝAŽ[+\u0014\u0000Ñ8úûß²3ÉäKÅ\u0000\t\u0002´Î\u0019w^ÛN—®\u0000¾ßï÷\u0017ð?¿O¿\u0000¸‘0 \b\u0003‚0 \b\u0003‚0 \b\u0003‚0 \b\u0003‚0 \b\u0003³ÿàóùìx\u001dËÍn\u0001›}_«¶˜~ïª×?zΪ÷ûSÿ\u001e¬\u0018\u0010„\u0001A\u0018\u0010„\u0001A\u0018\u0010¦§R#§\u000e\u0002®šŠÌN]vOcV=÷´jäõ¿\u0007+\u0006\u0004a@\u0010\u0006\u0004a@\u0010\u0006„eS©‘Û¦\u001c§ö\bÚ»5;UÛ=MºíïaĊ\u0001A\u0018\u0010„\u0001A\u0018\u0010„\u0001aûTê\u0015«¦\u001c§Nº:\tøSY1 \b\u0003‚0 \b\u0003‚0 ˜JýuêÄÜî矺/ëuV\f\b€ \f\b€ \f\bÛ§R¯L9^9©·ê9³ïw÷^²ÛX1 \b\u0003‚0 \b\u0003‚0 ,›J½ò]l«ìžê¬zþ©ÿ—×ÿ\u001e¬\u0018\u0010„\u0001A\u0018\u0010„\u0001A\u0018\u0010>ßW6¯,òʞ¢\u0011÷Gý\u001bV\f\b€ \f\b€ \f\bÓS©WöêœúλUÏ?å•÷å;øà\u0000a@\u0010\u0006\u0004a@\u0010\u0006„e{¥VM'nۛ4kÕÔn÷ç°{ÏجS·ÁX1 \b\u0003‚0 \b\u0003‚0 \u001c;ÁwÛTdÕï½mºòŠÛÞ¯\u0015\u0003‚0 \b\u0003‚0 \b\u0003Âu·ß¶GhäÔ´äÔ\tʟ:\r\u001b±b@\u0010\u0006\u0004a@\u0010\u0006\u0004a@X6•Zåԉ¶USÛ^ç©©ÝìëÙýùϲb@\u0010\u0006\u0004a@\u0010\u0006\u0004a@X6•Ú}rm÷ï]õüS÷JÍ:5ÅzeO\u0015\u0003‚0 \b\u0003‚0 \b\u0003ÂöÛÎOM«F^?ywjO׬WöžX1 \b\u0003‚0 \b\u0003‚0 Lï•Ú½7f÷‰¶Wöê̺í6øÝ앂\u0003„\u0001A\u0018\u0010„\u0001A\u0018\u0010¶\u0007ßî©Ô©{¨f_Ï)»?ÏUϹm/œ\u0015\u0003‚0 \b\u0003‚0 \b\u0003Âö½R·í\u0011:u«öm{«vßOµêçW텳W\n\u0016\u0010\u0006\u0004a@\u0010\u0006\u0004a@˜Þ+ujŠ2rjOÎÈî=W·M·v;õ¾¬\u0018\u0010„\u0001A\u0018\u0010„\u0001A\u0018\u0010–}\u0007ß*¯Ü†½{¯Î¬ÝŸÃ©“‰§ö¶Y1 \b\u0003‚0 \b\u0003‚0 lŸJÝv¯Ô¬Û¦:§>ÏÝNMŸF¬\u0018\u0010„\u0001A\u0018\u0010„\u0001A\u0018\u0010¶ßv~›S·y¯rjJöúmðöJÁ\u0002€ \f\b€ \f\bÛo;?e4…XuÒí•éÓn«^çm÷eY1 \b\u0003‚0 \b\u0003‚0 ,;ÁwÛmç³?Û-姞?ë•ÏÍ^)X@\u0018\u0010„\u0001A\u0018\u0010„\u0001áº{¥FnÛ#4²jÐ¬Ý·ÄŸšnÚ›gŀ \f\b€ \f\b€pÝwðÝæ¶=<·}ÇßÈm{ºfY1 \b\u0003‚0 \b\u0003‚0 ˜Jýµê$Ý*§N&Ý6å\u001b±b@\u0010\u0006\u0004a@\u0010\u0006\u0004a@Ø>•ºíäÝ©iÉÈ©{®Vyå^©YV\f\b€ \f\b€ \f\b˦R·À\u001aY5ý8õ\u001d|³n{¯œX´b@\u0010\u0006\u0004a@\u0010\u0006\u0004a@ø|oÛÌ\u0004\u0017°b@\u0010\u0006\u0004a@\u0010\u0006\u0004a@\u0010\u0006\u0004a@\u0010\u0006\u0004a@\u0010\u0006\u0004a@ø\u0003\u001b¢3¬@#ôv\u0000\u0000\u0000\u0000IEND®B`‚"

/***/ }),
/* 39 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var __awaiter = (this && this.__awaiter) || function (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());
    });
};
var __generator = (this && this.__generator) || function (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 };
    }
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.handleTextOfPost = void 0;
var common_1 = __webpack_require__(0);
var styles_1 = __webpack_require__(3);
var ExpandoButtonModule_1 = __webpack_require__(1);
var RuqqusPostEmbed_1 = __webpack_require__(20);
var onFetchingPostFailed = function (postUrl, box, cfg) { return function (resp) {
    console.error('Failed to fetch a post.', resp);
    box.find("." + styles_1.postLoadingCls).remove();
    ExpandoButtonModule_1.ExpandoButtonModule.writeErrorToExpandButtonBox(box, "Failed to fetch the post. Error " + resp.status + ": " + resp.statusText, function () { return exports.handleTextOfPost(postUrl, box, cfg); });
}; };
var onFetchingPostSucceeded = function (resp, postUrl, box, cfg) {
    return __awaiter(this, void 0, void 0, function () {
        var parsed, post, emptyPost, comments, emptyComments, wrappedComments, showCommentsButton;
        return __generator(this, function (_a) {
            if (resp.status !== 200) {
                return [2 /*return*/, onFetchingPostFailed(postUrl, box, cfg)(resp)];
            }
            parsed = $(resp.response);
            post = parsed.find('#post-body').children().filter(':not(.embed-responsive)');
            box.find("." + styles_1.postLoadingCls).remove();
            emptyPost = !post.length || post.text().trim() === '';
            comments = cfg.expandoButton.showComments ? parsed.find('.comment-section:not(.text-center) > .comment') : $();
            emptyComments = comments.length === 0;
            if (emptyPost && emptyComments) {
                return [2 /*return*/];
            }
            wrappedComments = $('<div>').addClass(styles_1.boxPostCommentsCls).append(comments).hide();
            common_1.setupVoting(wrappedComments);
            showCommentsButton = $('<a>').addClass('btn btn-secondary').text('Toggle comments').click(function (evt) {
                var el = $(evt.target);
                el.parent().find("." + styles_1.boxPostCommentsCls).toggle();
            });
            if (cfg.expandoButton.hideToggleCommentsButton) {
                showCommentsButton.hide();
            }
            ExpandoButtonModule_1.ExpandoButtonModule.insertWrappedElementIntoBox(box, post, styles_1.boxPostTextCls);
            if (!emptyComments) {
                ExpandoButtonModule_1.ExpandoButtonModule.insertWrappedElementIntoBox(box, [
                    showCommentsButton,
                    wrappedComments,
                ], styles_1.boxPostCommentsWithButtonCls);
            }
            if (cfg.expandoButton.autoExpandComments) {
                showCommentsButton.click();
            }
            return [2 /*return*/];
        });
    });
};
var doRequest = function (postUrl, box, cfg) {
    return __awaiter(this, void 0, void 0, function () {
        var resp, err_1;
        return __generator(this, function (_a) {
            switch (_a.label) {
                case 0:
                    _a.trys.push([0, 3, , 4]);
                    return [4 /*yield*/, common_1.xhrP({ method: 'GET', url: postUrl })];
                case 1:
                    resp = _a.sent();
                    return [4 /*yield*/, onFetchingPostSucceeded(resp, postUrl, box, cfg)];
                case 2:
                    _a.sent();
                    return [3 /*break*/, 4];
                case 3:
                    err_1 = _a.sent();
                    onFetchingPostFailed(postUrl, box, cfg);
                    return [3 /*break*/, 4];
                case 4: return [2 /*return*/];
            }
        });
    });
};
var startFetchingPost = function (box, postUrl, cfg) { return __awaiter(void 0, void 0, void 0, function () {
    return __generator(this, function (_a) {
        switch (_a.label) {
            case 0:
                box.append(common_1.createTextLoader('Fetching post', styles_1.postLoadingCls).addClass('m-2'));
                return [4 /*yield*/, doRequest(postUrl, box, cfg)];
            case 1:
                _a.sent();
                return [2 /*return*/];
        }
    });
}); };
var createLoadPostButton = function (postUrl, box, cfg) { return __awaiter(void 0, void 0, void 0, function () {
    var btn;
    return __generator(this, function (_a) {
        btn = common_1.genJsAnchor().addClass('btn btn-secondary mb-1').text('Load post').click(function () { return __awaiter(void 0, void 0, void 0, function () {
            return __generator(this, function (_a) {
                switch (_a.label) {
                    case 0:
                        btn.remove();
                        return [4 /*yield*/, startFetchingPost(box, postUrl, cfg)];
                    case 1:
                        _a.sent();
                        return [2 /*return*/];
                }
            });
        }); });
        box.append(btn);
        return [2 /*return*/];
    });
}); };
exports.handleTextOfPost = function (postUrl, box, cfg) { return __awaiter(void 0, void 0, void 0, function () {
    return __generator(this, function (_a) {
        switch (_a.label) {
            case 0:
                if (!RuqqusPostEmbed_1.ruqqusPostEmbed.urlMatches(postUrl)) {
                    common_1.printError('handleTextOfPost', 'invalid post URL', postUrl);
                }
                if (!(cfg.expandoButton.deferLoadingOfPost || cfg.expandoButton.autoOpen)) return [3 /*break*/, 2];
                return [4 /*yield*/, createLoadPostButton(postUrl, box, cfg)];
            case 1:
                _a.sent();
                return [3 /*break*/, 4];
            case 2: return [4 /*yield*/, startFetchingPost(box, postUrl, cfg)];
            case 3:
                _a.sent();
                _a.label = 4;
            case 4: return [2 /*return*/];
        }
    });
}); };


/***/ }),
/* 40 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var __awaiter = (this && this.__awaiter) || function (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());
    });
};
var __generator = (this && this.__generator) || function (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 };
    }
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.twitchClipEmbed = void 0;
var EmbedProcessor_1 = __webpack_require__(2);
var ExpandoButtonModule_1 = __webpack_require__(1);
var TwitchClipEmbed = /** @class */ (function (_super) {
    __extends(TwitchClipEmbed, _super);
    function TwitchClipEmbed() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    TwitchClipEmbed.prototype.genRegex = function () {
        return /^https:\/\/clips\.twitch\.tv\/(\w+).*$/g;
    };
    TwitchClipEmbed.prototype.processMatchingLink = function (_a) {
        var link = _a.link, box = _a.box;
        return __awaiter(this, void 0, void 0, function () {
            var id, el;
            return __generator(this, function (_b) {
                id = this.matchAllAndGetCapturedPart(link);
                el = $("\n<div class=\"embed-responsive embed-responsive-16by9\">\n    <iframe src=\"https://clips.twitch.tv/embed?clip=" + id + "&parent=ruqqus.com\" frameborder=\"0\" allowfullscreen=\"true\" scrolling=\"no\" height=\"378\" width=\"620\"></iframe>\n</div>");
                ExpandoButtonModule_1.ExpandoButtonModule.insertWrappedElementIntoBox(box, el);
                return [2 /*return*/, true];
            });
        });
    };
    return TwitchClipEmbed;
}(EmbedProcessor_1.EmbedProcessor));
exports.twitchClipEmbed = new TwitchClipEmbed();


/***/ }),
/* 41 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var __awaiter = (this && this.__awaiter) || function (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());
    });
};
var __generator = (this && this.__generator) || function (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 };
    }
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ruqqusGuildEmbed = void 0;
var styles_1 = __webpack_require__(3);
var EmbedProcessor_1 = __webpack_require__(2);
var ExpandoButtonModule_1 = __webpack_require__(1);
var RuqqusGuildEmbed = /** @class */ (function (_super) {
    __extends(RuqqusGuildEmbed, _super);
    function RuqqusGuildEmbed() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    RuqqusGuildEmbed.prototype.genRegex = function () {
        return /^https:\/\/ruqqus\.com\/\+(\w+)$/g;
    };
    RuqqusGuildEmbed.prototype.processMatchingLink = function (_a) {
        var link = _a.link, box = _a.box, cfg = _a.cfg;
        return __awaiter(this, void 0, void 0, function () {
            var guildName, img, guildEl, wrapper;
            return __generator(this, function (_b) {
                guildName = this.matchAllAndGetCapturedPart(link);
                img = $('<img>').prop('src', "/+" + guildName + "/pic/profile");
                guildEl = $('<a>').addClass('d-flex align-items-center flex-grow-1 justify-content-center p-3')
                    .prop('href', link).append(img).append($('<strong>').text("+" + guildName).addClass('ml-2'));
                if (cfg.post.openInNewTab) {
                    guildEl.prop('target', '_blank');
                }
                wrapper = $('<div>').addClass(styles_1.boxGuildCls).addClass('d-flex align-items-center justify-content-center')
                    // .append($('<span>').addClass('mr-3').text('Guild'))
                    .append(guildEl);
                ExpandoButtonModule_1.ExpandoButtonModule.insertWrappedElementIntoBox(box, wrapper);
                return [2 /*return*/, true];
            });
        });
    };
    return RuqqusGuildEmbed;
}(EmbedProcessor_1.EmbedProcessor));
exports.ruqqusGuildEmbed = new RuqqusGuildEmbed();


/***/ }),
/* 42 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var __awaiter = (this && this.__awaiter) || function (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());
    });
};
var __generator = (this && this.__generator) || function (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 };
    }
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.lbryEmbed = void 0;
var EmbedProcessor_1 = __webpack_require__(2);
var ExpandoButtonModule_1 = __webpack_require__(1);
var common_1 = __webpack_require__(0);
var LbryEmbed = /** @class */ (function (_super) {
    __extends(LbryEmbed, _super);
    function LbryEmbed() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    LbryEmbed.prototype.genRegex = function () {
        return /^https:\/\/lbry.tv\/@[\w:]+\/[\w\-:]+$/;
    };
    LbryEmbed.prototype.processMatchingLink = function (_a) {
        var link = _a.link, box = _a.box, cfg = _a.cfg;
        return __awaiter(this, void 0, void 0, function () {
            var resp, parsed, videoUrl, el, err_1;
            return __generator(this, function (_b) {
                switch (_b.label) {
                    case 0:
                        _b.trys.push([0, 2, , 3]);
                        return [4 /*yield*/, common_1.xhrP({
                                method: 'GET',
                                url: link,
                            })];
                    case 1:
                        resp = _b.sent();
                        common_1.debugLog('handleLbryLink', resp);
                        parsed = $('<div>').append($(resp.response));
                        videoUrl = parsed.find('meta[property="og:video"]').prop('content');
                        el = $("<div class=\"handleLbryLink embed-responsive embed-responsive-16by9\"><iframe src=\"" + videoUrl + "\" allowfullscreen></iframe></div>");
                        ExpandoButtonModule_1.ExpandoButtonModule.insertWrappedElementIntoBox(box, el);
                        return [2 /*return*/, true];
                    case 2:
                        err_1 = _b.sent();
                        common_1.printError('LbryEmbed', err_1);
                        return [2 /*return*/, false];
                    case 3: return [2 /*return*/];
                }
            });
        });
    };
    return LbryEmbed;
}(EmbedProcessor_1.EmbedProcessor));
exports.lbryEmbed = new LbryEmbed();


/***/ }),
/* 43 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var __awaiter = (this && this.__awaiter) || function (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());
    });
};
var __generator = (this && this.__generator) || function (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 };
    }
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.metaEmbed = void 0;
var EmbedProcessor_1 = __webpack_require__(2);
var ExpandoButtonModule_1 = __webpack_require__(1);
var common_1 = __webpack_require__(0);
var styles_1 = __webpack_require__(3);
var MetaEmbed = /** @class */ (function (_super) {
    __extends(MetaEmbed, _super);
    function MetaEmbed() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    MetaEmbed.prototype.genRegex = function () {
        return /^https?:\/\/.*$/;
    };
    MetaEmbed.prototype.processMatchingLink = function (_a) {
        var link = _a.link, box = _a.box, cfg = _a.cfg;
        return __awaiter(this, void 0, void 0, function () {
            var resp, parsed, imageUrl, title, description, el, success, linkIcon, linkEl, imgWrapper, err_1;
            return __generator(this, function (_b) {
                switch (_b.label) {
                    case 0:
                        _b.trys.push([0, 2, , 3]);
                        return [4 /*yield*/, common_1.xhrP({
                                method: 'GET',
                                url: link,
                            })];
                    case 1:
                        resp = _b.sent();
                        common_1.debugLog('MetaEmbed', resp);
                        parsed = $('<div>').append($(resp.response));
                        imageUrl = parsed.find('meta[property="og:image"]').prop('content');
                        title = parsed.find('meta[property="og:title"]').prop('content');
                        description = parsed.find('meta[property="og:description"]').prop('content');
                        el = $('<div>').addClass(styles_1.boxMetaEmbedCls).addClass('mb-2 px-2 pb-2 d-flex flex-column position-relative');
                        success = Boolean(imageUrl || description);
                        common_1.debugLog('MetaEmbed', { imageUrl: imageUrl, title: title, description: description, success: success });
                        el.append($('<div>').addClass('text-truncate').addClass(styles_1.boxMetaEmbedUrlCls).text(link).prop('title', link));
                        el.append($('<div>').addClass('mb-4 mt-2'));
                        if (title) {
                            linkIcon = $('<i>').addClass('fas fa-external-link-alt text-small ml-2').css({ transform: 'translate(0, -4px)' });
                            linkEl = $('<a>')
                                .prop('target', '_blank').prop('href', link)
                                .text(common_1.decodeHtmlEntitiesAggressively(title))
                                .append(linkIcon);
                            el.append($('<h3>').append(linkEl).addClass('d-flex mx-1 mt-0'));
                        }
                        if (description) {
                            el.append($('<div>').text(common_1.decodeHtmlEntitiesAggressively(description)).addClass('mx-1 d-flex'));
                        }
                        if (imageUrl) {
                            imgWrapper = $('<div>').addClass('w-100 mt-2');
                            imgWrapper.append(ExpandoButtonModule_1.ExpandoButtonModule.genImageForBox(box, imageUrl, cfg, 'metaCard'));
                            el.append(imgWrapper);
                        }
                        if (success) {
                            ExpandoButtonModule_1.ExpandoButtonModule.insertWrappedElementIntoBox(box, el);
                        }
                        return [2 /*return*/, success];
                    case 2:
                        err_1 = _b.sent();
                        common_1.printError('MetaEmbed', err_1);
                        return [2 /*return*/, false];
                    case 3: return [2 /*return*/];
                }
            });
        });
    };
    return MetaEmbed;
}(EmbedProcessor_1.EmbedProcessor));
exports.metaEmbed = new MetaEmbed();


/***/ }),
/* 44 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var __awaiter = (this && this.__awaiter) || function (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());
    });
};
var __generator = (this && this.__generator) || function (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 };
    }
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.steamEmbed = void 0;
var EmbedProcessor_1 = __webpack_require__(2);
var ExpandoButtonModule_1 = __webpack_require__(1);
var SteamEmbed = /** @class */ (function (_super) {
    __extends(SteamEmbed, _super);
    function SteamEmbed() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    SteamEmbed.prototype.genRegex = function () {
        return /^https:\/\/store\.steampowered\.com\/app\/(\d+)\/?.*$/g;
    };
    SteamEmbed.prototype.processMatchingLink = function (_a) {
        var link = _a.link, box = _a.box;
        return __awaiter(this, void 0, void 0, function () {
            var id, el;
            return __generator(this, function (_b) {
                id = this.matchAllAndGetCapturedPart(link);
                el = $("\n<div class=\"\">\n    <iframe src=\"https://store.steampowered.com/widget/" + id + "/\" frameborder=\"0\" width=\"646\" height=\"190\"></iframe>\n</div>");
                ExpandoButtonModule_1.ExpandoButtonModule.insertWrappedElementIntoBox(box, el);
                return [2 /*return*/, true];
            });
        });
    };
    return SteamEmbed;
}(EmbedProcessor_1.EmbedProcessor));
exports.steamEmbed = new SteamEmbed();


/***/ }),
/* 45 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var __awaiter = (this && this.__awaiter) || function (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());
    });
};
var __generator = (this && this.__generator) || function (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 };
    }
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.videoEmbed = void 0;
var EmbedProcessor_1 = __webpack_require__(2);
var ExpandoButtonModule_1 = __webpack_require__(1);
var VideoEmbed = /** @class */ (function (_super) {
    __extends(VideoEmbed, _super);
    function VideoEmbed() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    VideoEmbed.prototype.genRegex = function () {
        return /^https?:\/\/.*\.(?:mp4|webm|ogv)$/g;
    };
    VideoEmbed.prototype.processMatchingLink = function (_a) {
        var link = _a.link, box = _a.box;
        return __awaiter(this, void 0, void 0, function () {
            var el;
            return __generator(this, function (_b) {
                el = $("\n<div class=\"embed-responsive embed-responsive-16by9\">\n    <video controls>\n    <source src=\"" + link + "\"> \n        Sorry, your browser doesn't support embedded videos.\n    </video>\n</div>");
                ExpandoButtonModule_1.ExpandoButtonModule.insertWrappedElementIntoBox(box, el);
                return [2 /*return*/, true];
            });
        });
    };
    return VideoEmbed;
}(EmbedProcessor_1.EmbedProcessor));
exports.videoEmbed = new VideoEmbed();


/***/ }),
/* 46 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var __awaiter = (this && this.__awaiter) || function (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());
    });
};
var __generator = (this && this.__generator) || function (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 };
    }
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.streamableEmbed = void 0;
var EmbedProcessor_1 = __webpack_require__(2);
var ExpandoButtonModule_1 = __webpack_require__(1);
var StreamableEmbed = /** @class */ (function (_super) {
    __extends(StreamableEmbed, _super);
    function StreamableEmbed() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    StreamableEmbed.prototype.genRegex = function () {
        return /^https:\/\/streamable\.com\/([\w\d]+).*$/g;
    };
    StreamableEmbed.prototype.processMatchingLink = function (_a) {
        var link = _a.link, box = _a.box;
        return __awaiter(this, void 0, void 0, function () {
            var id, el;
            return __generator(this, function (_b) {
                id = this.matchAllAndGetCapturedPart(link);
                el = $("\n<div class=\"embed-responsive embed-responsive-16by9\">\n    <iframe src=\"https://streamable.com/e/" + id + "\" frameborder=\"0\"></iframe>\n</div>");
                ExpandoButtonModule_1.ExpandoButtonModule.insertWrappedElementIntoBox(box, el);
                return [2 /*return*/, true];
            });
        });
    };
    return StreamableEmbed;
}(EmbedProcessor_1.EmbedProcessor));
exports.streamableEmbed = new StreamableEmbed();


/***/ }),
/* 47 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var __awaiter = (this && this.__awaiter) || function (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());
    });
};
var __generator = (this && this.__generator) || function (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 };
    }
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.twitterEmbed = void 0;
var EmbedProcessor_1 = __webpack_require__(2);
var ExpandoButtonModule_1 = __webpack_require__(1);
var common_1 = __webpack_require__(0);
var TwitterEmbed = /** @class */ (function (_super) {
    __extends(TwitterEmbed, _super);
    function TwitterEmbed() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    TwitterEmbed.prototype.genRegex = function () {
        return /^https:\/\/(?:mobile\.)?twitter\.com\/([\w0-9]+)\/status\/(\d+).*$/gm;
    };
    TwitterEmbed.prototype.processMatchingLink = function (_a) {
        var link = _a.link, box = _a.box;
        return __awaiter(this, void 0, void 0, function () {
            var resp, data, parsed, el, err_1;
            return __generator(this, function (_b) {
                switch (_b.label) {
                    case 0:
                        _b.trys.push([0, 2, , 3]);
                        return [4 /*yield*/, common_1.xhrP({
                                method: 'GET',
                                url: "https://publish.twitter.com/oembed?url=" + encodeURIComponent(link),
                            })];
                    case 1:
                        resp = _b.sent();
                        data = JSON.parse(resp.response);
                        common_1.debugLog('handleTwitterLink', data);
                        parsed = $(data.html);
                        el = $('<div>').css({ margin: '-10px 0' }).html(parsed);
                        ExpandoButtonModule_1.ExpandoButtonModule.insertWrappedElementIntoBox(box, el);
                        return [3 /*break*/, 3];
                    case 2:
                        err_1 = _b.sent();
                        this.handleResponseError(box, err_1);
                        return [3 /*break*/, 3];
                    case 3: return [2 /*return*/, true];
                }
            });
        });
    };
    return TwitterEmbed;
}(EmbedProcessor_1.EmbedProcessor));
exports.twitterEmbed = new TwitterEmbed();


/***/ }),
/* 48 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var __awaiter = (this && this.__awaiter) || function (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());
    });
};
var __generator = (this && this.__generator) || function (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 };
    }
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ibbcoEmbed = void 0;
var EmbedProcessor_1 = __webpack_require__(2);
var ExpandoButtonModule_1 = __webpack_require__(1);
var common_1 = __webpack_require__(0);
var IbbcoEmbed = /** @class */ (function (_super) {
    __extends(IbbcoEmbed, _super);
    function IbbcoEmbed() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    IbbcoEmbed.prototype.genRegex = function () {
        return /^https:\/\/ibb.co\//gm;
    };
    IbbcoEmbed.prototype.processMatchingLink = function (_a) {
        var link = _a.link, box = _a.box, cfg = _a.cfg;
        return __awaiter(this, void 0, void 0, function () {
            var resp, parsed, img, imgUrl, err_1;
            return __generator(this, function (_b) {
                switch (_b.label) {
                    case 0:
                        _b.trys.push([0, 2, , 3]);
                        return [4 /*yield*/, common_1.xhrP({
                                method: 'GET',
                                url: link,
                            })];
                    case 1:
                        resp = _b.sent();
                        parsed = $(resp.response);
                        img = parsed.find('#image-viewer-container img');
                        imgUrl = img.prop('src');
                        ExpandoButtonModule_1.ExpandoButtonModule.insertImageIntoBox(box, imgUrl, cfg);
                        return [3 /*break*/, 3];
                    case 2:
                        err_1 = _b.sent();
                        this.handleResponseError(box, err_1);
                        return [3 /*break*/, 3];
                    case 3: return [2 /*return*/, true];
                }
            });
        });
    };
    return IbbcoEmbed;
}(EmbedProcessor_1.EmbedProcessor));
exports.ibbcoEmbed = new IbbcoEmbed();


/***/ }),
/* 49 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var __awaiter = (this && this.__awaiter) || function (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());
    });
};
var __generator = (this && this.__generator) || function (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 };
    }
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.imgFlipEmbed = void 0;
var EmbedProcessor_1 = __webpack_require__(2);
var ExpandoButtonModule_1 = __webpack_require__(1);
var ImgFlipEmbed = /** @class */ (function (_super) {
    __extends(ImgFlipEmbed, _super);
    function ImgFlipEmbed() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    ImgFlipEmbed.prototype.genRegex = function () {
        return /^https:\/\/imgflip\.com\/i\/.*?([a-zA-Z0-9]+)$/gm;
    };
    ImgFlipEmbed.prototype.processMatchingLink = function (_a) {
        var link = _a.link, box = _a.box, cfg = _a.cfg;
        return __awaiter(this, void 0, void 0, function () {
            var id, src;
            return __generator(this, function (_b) {
                id = this.matchAllAndGetCapturedPart(link);
                src = "https://i.imgflip.com/" + id + ".jpg";
                ExpandoButtonModule_1.ExpandoButtonModule.insertImageIntoBox(box, src, cfg);
                return [2 /*return*/, true];
            });
        });
    };
    return ImgFlipEmbed;
}(EmbedProcessor_1.EmbedProcessor));
exports.imgFlipEmbed = new ImgFlipEmbed();


/***/ }),
/* 50 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var __awaiter = (this && this.__awaiter) || function (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());
    });
};
var __generator = (this && this.__generator) || function (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 };
    }
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.imgurGifvEmbed = void 0;
var EmbedProcessor_1 = __webpack_require__(2);
var ExpandoButtonModule_1 = __webpack_require__(1);
var ImgurGifvEmbed = /** @class */ (function (_super) {
    __extends(ImgurGifvEmbed, _super);
    function ImgurGifvEmbed() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    ImgurGifvEmbed.prototype.genRegex = function () {
        return /https:\/\/i\.imgur\.com\/(\w+)\.(gifv|mp4)/g;
    };
    ImgurGifvEmbed.prototype.processMatchingLink = function (_a) {
        var link = _a.link, box = _a.box, cfg = _a.cfg;
        return __awaiter(this, void 0, void 0, function () {
            var id, el;
            return __generator(this, function (_b) {
                id = this.matchAllAndGetCapturedPart(link);
                el = $("<div class=\"handleImgurGifv\"></div><blockquote class=\"imgur-embed-pub\" lang=\"en\" data-id=\"" + id + "\"><a href=\"//imgur.com/" + id + "\">?</a></blockquote><script async src=\"//s.imgur.com/min/embed.js\" charset=\"utf-8\"></script></div>");
                ExpandoButtonModule_1.ExpandoButtonModule.insertWrappedElementIntoBox(box, el);
                return [2 /*return*/, true];
            });
        });
    };
    return ImgurGifvEmbed;
}(EmbedProcessor_1.EmbedProcessor));
exports.imgurGifvEmbed = new ImgurGifvEmbed();


/***/ }),
/* 51 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var __awaiter = (this && this.__awaiter) || function (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());
    });
};
var __generator = (this && this.__generator) || function (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 };
    }
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.gfycatVideoEmbed = void 0;
var EmbedProcessor_1 = __webpack_require__(2);
var ExpandoButtonModule_1 = __webpack_require__(1);
var GfycatVideoEmbed = /** @class */ (function (_super) {
    __extends(GfycatVideoEmbed, _super);
    function GfycatVideoEmbed() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    GfycatVideoEmbed.prototype.genRegex = function () {
        return /^https:\/\/gfycat\.com\/([\w_\d]+).*$/g;
    };
    GfycatVideoEmbed.prototype.processMatchingLink = function (_a) {
        var link = _a.link, box = _a.box, cfg = _a.cfg;
        return __awaiter(this, void 0, void 0, function () {
            var id, el;
            return __generator(this, function (_b) {
                id = this.matchAllAndGetCapturedPart(link);
                if (!id) {
                    console.log('failed to get Gfycat video id', link);
                    return [2 /*return*/, false];
                }
                el = $("<div class=\"handleGfycatVideo embed-responsive embed-responsive-16by9\"><iframe src='https://gfycat.com/ifr/" + id + "' frameborder='0' scrolling='no' allowfullscreen width='640' height='492'></iframe></div>");
                ExpandoButtonModule_1.ExpandoButtonModule.insertWrappedElementIntoBox(box, el);
                return [2 /*return*/, true];
            });
        });
    };
    return GfycatVideoEmbed;
}(EmbedProcessor_1.EmbedProcessor));
exports.gfycatVideoEmbed = new GfycatVideoEmbed();


/***/ }),
/* 52 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var __awaiter = (this && this.__awaiter) || function (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());
    });
};
var __generator = (this && this.__generator) || function (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 };
    }
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.gifDeliveryNetworkEmbed = void 0;
var EmbedProcessor_1 = __webpack_require__(2);
var ExpandoButtonModule_1 = __webpack_require__(1);
var GifDeliveryNetworkEmbed = /** @class */ (function (_super) {
    __extends(GifDeliveryNetworkEmbed, _super);
    function GifDeliveryNetworkEmbed() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    GifDeliveryNetworkEmbed.prototype.genRegex = function () {
        return /^https:\/\/(?:www\.)gifdeliverynetwork\.com\/([\w_\d]+).*$/gm;
    };
    GifDeliveryNetworkEmbed.prototype.processMatchingLink = function (_a) {
        var link = _a.link, box = _a.box, cfg = _a.cfg;
        return __awaiter(this, void 0, void 0, function () {
            var id, el;
            return __generator(this, function (_b) {
                id = this.matchAllAndGetCapturedPart(link);
                if (!id) {
                    console.log('failed to get GifDeliveryNetwork video id', link);
                    return [2 /*return*/, false];
                }
                el = $("<div class=\"handleGfycatVideo embed-responsive embed-responsive-16by9\"><iframe src='https://gfycat.com/ifr/" + id + "' frameborder='0' scrolling='no' allowfullscreen width='640' height='492'></iframe></div>");
                ExpandoButtonModule_1.ExpandoButtonModule.insertWrappedElementIntoBox(box, el);
                return [2 /*return*/, true];
            });
        });
    };
    return GifDeliveryNetworkEmbed;
}(EmbedProcessor_1.EmbedProcessor));
exports.gifDeliveryNetworkEmbed = new GifDeliveryNetworkEmbed();


/***/ }),
/* 53 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var __awaiter = (this && this.__awaiter) || function (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());
    });
};
var __generator = (this && this.__generator) || function (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 };
    }
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.redGifsVideoEmbed = void 0;
var EmbedProcessor_1 = __webpack_require__(2);
var ExpandoButtonModule_1 = __webpack_require__(1);
var RedGifsVideoEmbed = /** @class */ (function (_super) {
    __extends(RedGifsVideoEmbed, _super);
    function RedGifsVideoEmbed() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    RedGifsVideoEmbed.prototype.genRegex = function () {
        return /^https:\/\/(?:www\.)?redgifs\.com\/watch\/([\w_\d\-]+).*$/g;
    };
    RedGifsVideoEmbed.prototype.processMatchingLink = function (_a) {
        var link = _a.link, box = _a.box, cfg = _a.cfg;
        return __awaiter(this, void 0, void 0, function () {
            var id, el;
            return __generator(this, function (_b) {
                id = this.matchAllAndGetCapturedPart(link);
                if (!id) {
                    console.log('failed to get RedGifs video id', link);
                    return [2 /*return*/, false];
                }
                el = $("<div class=\"handleRedGifsVideo embed-responsive embed-responsive-16by9\"><iframe src='https://redgifs.com/ifr/" + id + "' frameborder='0' scrolling='no' allowfullscreen width='640' height='360'></iframe></div>");
                ExpandoButtonModule_1.ExpandoButtonModule.insertWrappedElementIntoBox(box, el);
                return [2 /*return*/, true];
            });
        });
    };
    return RedGifsVideoEmbed;
}(EmbedProcessor_1.EmbedProcessor));
exports.redGifsVideoEmbed = new RedGifsVideoEmbed();


/***/ }),
/* 54 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var __awaiter = (this && this.__awaiter) || function (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());
    });
};
var __generator = (this && this.__generator) || function (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 };
    }
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.bitChuteEmbed = void 0;
var EmbedProcessor_1 = __webpack_require__(2);
var ExpandoButtonModule_1 = __webpack_require__(1);
var BitChuteEmbed = /** @class */ (function (_super) {
    __extends(BitChuteEmbed, _super);
    function BitChuteEmbed() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    BitChuteEmbed.prototype.genRegex = function () {
        return /^https:\/\/www\.bitchute\.com\/video\/(\w+).*$/g;
    };
    BitChuteEmbed.prototype.processMatchingLink = function (_a) {
        var link = _a.link, box = _a.box, cfg = _a.cfg;
        return __awaiter(this, void 0, void 0, function () {
            var id, el;
            return __generator(this, function (_b) {
                id = this.matchAllAndGetCapturedPart(link);
                if (!id) {
                    console.log('failed to get BitChute video id', link);
                    return [2 /*return*/, false];
                }
                el = $("<div class=\"handleBitChuteVideo embed-responsive embed-responsive-16by9\"><iframe width=\"640\" height=\"360\" scrolling=\"no\" frameborder=\"0\" style=\"border: none;\" src=\"https://www.bitchute.com/embed/" + id + "/\"></iframe></div>");
                ExpandoButtonModule_1.ExpandoButtonModule.insertWrappedElementIntoBox(box, el);
                return [2 /*return*/, true];
            });
        });
    };
    return BitChuteEmbed;
}(EmbedProcessor_1.EmbedProcessor));
exports.bitChuteEmbed = new BitChuteEmbed();


/***/ }),
/* 55 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var __awaiter = (this && this.__awaiter) || function (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());
    });
};
var __generator = (this && this.__generator) || function (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 };
    }
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.youTubeEmbed = void 0;
var EmbedProcessor_1 = __webpack_require__(2);
var ExpandoButtonModule_1 = __webpack_require__(1);
var YouTubeEmbed = /** @class */ (function (_super) {
    __extends(YouTubeEmbed, _super);
    function YouTubeEmbed() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    YouTubeEmbed.prototype.genRegex = function () {
        return /^https:\/\/(?:(?:www|m)\.)?youtube\.com\/watch\/?\?v=([\w-]+).*$|^https:\/\/youtu\.be\/([\w-]+)$/g;
    };
    YouTubeEmbed.prototype.processMatchingLink = function (_a) {
        var link = _a.link, box = _a.box, cfg = _a.cfg;
        return __awaiter(this, void 0, void 0, function () {
            var id, el;
            return __generator(this, function (_b) {
                id = this.matchAllAndGetCapturedPart(link);
                if (!id) {
                    console.log('failed to get YouTube video id', link);
                    return [2 /*return*/, false];
                }
                el = $("<div class=\"handleYouTubeVideo embed-responsive embed-responsive-16by9\"><iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/" + id + "\" frameborder=\"0\" allow=\"accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen></iframe></div>");
                ExpandoButtonModule_1.ExpandoButtonModule.insertWrappedElementIntoBox(box, el);
                return [2 /*return*/, true];
            });
        });
    };
    return YouTubeEmbed;
}(EmbedProcessor_1.EmbedProcessor));
exports.youTubeEmbed = new YouTubeEmbed();


/***/ }),
/* 56 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var __awaiter = (this && this.__awaiter) || function (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());
    });
};
var __generator = (this && this.__generator) || function (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 };
    }
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.imgurGalleryEmbed = void 0;
var ramda_1 = __webpack_require__(4);
var EmbedProcessor_1 = __webpack_require__(2);
var ExpandoButtonModule_1 = __webpack_require__(1);
var common_1 = __webpack_require__(0);
var ImgurGalleryEmbed = /** @class */ (function (_super) {
    __extends(ImgurGalleryEmbed, _super);
    function ImgurGalleryEmbed() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    ImgurGalleryEmbed.prototype.urlMatches = function (link) {
        return ImgurGalleryEmbed.isImgurGallery(link);
    };
    ImgurGalleryEmbed.prototype.processMatchingLink = function (_a) {
        var origLink = _a.link, box = _a.box, cfg = _a.cfg;
        return __awaiter(this, void 0, void 0, function () {
            var response, res, images, firstImage, link, response_1;
            return __generator(this, function (_b) {
                switch (_b.label) {
                    case 0:
                        _b.trys.push([0, 2, , 3]);
                        return [4 /*yield*/, common_1.xhrP({
                                url: 'https://api.imgur.com/3/gallery/album/' + ramda_1.drop(ImgurGalleryEmbed.imgurGalleryPrefix.length)(origLink),
                                method: 'GET',
                                headers: { Authorization: "Client-ID " + ImgurGalleryEmbed.imgurApiClientId },
                            })];
                    case 1:
                        response = _b.sent();
                        common_1.debugLog('handleImgurGallery', 'onload', response);
                        res = common_1.tryParseJSON(response.response);
                        if (!res || !ramda_1.path(['success'])(res)) {
                            ExpandoButtonModule_1.ExpandoButtonModule.writeErrorToExpandButtonBox(box, 'Imgur responded with error.');
                            return [2 /*return*/, true];
                        }
                        common_1.debugLog('handleImgurGallery', 'parsed JSON, res =', res);
                        images = ramda_1.path(['data', 'images'])(res);
                        if (!images || !common_1.isArray(images)) {
                            ExpandoButtonModule_1.ExpandoButtonModule.writeErrorToExpandButtonBox(box, 'Failed to extract "images" field.');
                            return [2 /*return*/, true];
                        }
                        firstImage = images[0];
                        link = ramda_1.path(['link'])(firstImage);
                        if (!link || !common_1.isString(link)) {
                            ExpandoButtonModule_1.ExpandoButtonModule.writeErrorToExpandButtonBox(box, 'Failed to get a link from image');
                            return [2 /*return*/, true];
                        }
                        ExpandoButtonModule_1.ExpandoButtonModule.insertImageIntoBox(box, link, cfg)
                            .prop('title', images.length > 1 ? "1 / " + images.length : '');
                        return [2 /*return*/, true];
                    case 2:
                        response_1 = _b.sent();
                        common_1.printError('handleImgurGallery', 'failed', response_1);
                        ExpandoButtonModule_1.ExpandoButtonModule.writeErrorToExpandButtonBox(box, 'Imgur request failed: ' + response_1.status + ' - ' + String(response_1.response));
                        return [2 /*return*/, false];
                    case 3: return [2 /*return*/];
                }
            });
        });
    };
    ImgurGalleryEmbed.imgurGalleryPrefix = 'https://imgur.com/gallery/';
    ImgurGalleryEmbed.imgurApiClientId = '3d83b5e5341b638';
    ImgurGalleryEmbed.isImgurGallery = function (x) { return x.startsWith(ImgurGalleryEmbed.imgurGalleryPrefix); };
    return ImgurGalleryEmbed;
}(EmbedProcessor_1.EmbedProcessor));
exports.imgurGalleryEmbed = new ImgurGalleryEmbed();


/***/ }),
/* 57 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var __awaiter = (this && this.__awaiter) || function (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());
    });
};
var __generator = (this && this.__generator) || function (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 };
    }
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.directImageEmbed = void 0;
var EmbedProcessor_1 = __webpack_require__(2);
var ExpandoButtonModule_1 = __webpack_require__(1);
var DirectImageEmbed = /** @class */ (function (_super) {
    __extends(DirectImageEmbed, _super);
    function DirectImageEmbed() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    DirectImageEmbed.prototype.genRegex = function () {
        return /\.(?:jpg|jpeg|png|gif|svg|webp)(?:\?.*)?$|^https:\/\/i.ruqqus.com\//i;
    };
    DirectImageEmbed.prototype.processMatchingLink = function (_a) {
        var link = _a.link, box = _a.box, cfg = _a.cfg;
        return __awaiter(this, void 0, void 0, function () {
            return __generator(this, function (_b) {
                ExpandoButtonModule_1.ExpandoButtonModule.insertImageIntoBox(box, link, cfg);
                return [2 /*return*/, true];
            });
        });
    };
    return DirectImageEmbed;
}(EmbedProcessor_1.EmbedProcessor));
exports.directImageEmbed = new DirectImageEmbed();


/***/ }),
/* 58 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var __awaiter = (this && this.__awaiter) || function (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());
    });
};
var __generator = (this && this.__generator) || function (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 };
    }
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.imgurAlbumEmbed = void 0;
var ramda_1 = __webpack_require__(4);
var EmbedProcessor_1 = __webpack_require__(2);
var ExpandoButtonModule_1 = __webpack_require__(1);
var ImgurAlbumEmbed = /** @class */ (function (_super) {
    __extends(ImgurAlbumEmbed, _super);
    function ImgurAlbumEmbed() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    ImgurAlbumEmbed.prototype.urlMatches = function (link) {
        return ImgurAlbumEmbed.isImgurAlbum(link);
    };
    ImgurAlbumEmbed.prototype.processMatchingLink = function (_a) {
        var link = _a.link, box = _a.box, cfg = _a.cfg;
        return __awaiter(this, void 0, void 0, function () {
            var albumId, el;
            return __generator(this, function (_b) {
                albumId = ramda_1.drop(ImgurAlbumEmbed.imgurAlbumPrefix.length, link);
                el = $("\n<blockquote class=\"imgur-embed-pub\" lang=\"en\" data-id=\"a/" + albumId + "\">\n    <a href=\"//imgur.com/a/" + albumId + "\">View album " + albumId + " on Imgur</a>\n</blockquote>\n<script async src=\"//s.imgur.com/min/embed.js\" charset=\"utf-8\"></script>\n");
                ExpandoButtonModule_1.ExpandoButtonModule.insertWrappedElementIntoBox(box, el);
                return [2 /*return*/, true];
            });
        });
    };
    ImgurAlbumEmbed.imgurAlbumPrefix = 'https://imgur.com/a/';
    ImgurAlbumEmbed.isImgurAlbum = function (x) { return x.startsWith(ImgurAlbumEmbed.imgurAlbumPrefix); };
    return ImgurAlbumEmbed;
}(EmbedProcessor_1.EmbedProcessor));
exports.imgurAlbumEmbed = new ImgurAlbumEmbed();


/***/ }),
/* 59 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var __awaiter = (this && this.__awaiter) || function (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());
    });
};
var __generator = (this && this.__generator) || function (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 };
    }
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.imgurBrokenEmbed = void 0;
var EmbedProcessor_1 = __webpack_require__(2);
var ExpandoButtonModule_1 = __webpack_require__(1);
var common_1 = __webpack_require__(0);
var ImgurBrokenEmbed = /** @class */ (function (_super) {
    __extends(ImgurBrokenEmbed, _super);
    function ImgurBrokenEmbed() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    ImgurBrokenEmbed.prototype.urlMatches = function (link) {
        return ImgurBrokenEmbed.isImgurBroken(link);
    };
    ImgurBrokenEmbed.prototype.processMatchingLink = function (_a) {
        var link = _a.link, box = _a.box, cfg = _a.cfg;
        return __awaiter(this, void 0, void 0, function () {
            var resp, parsed, imgContainer, imgId, src, err_1;
            return __generator(this, function (_b) {
                switch (_b.label) {
                    case 0:
                        _b.trys.push([0, 2, , 3]);
                        return [4 /*yield*/, common_1.xhrP({
                                method: 'GET',
                                url: link,
                            })];
                    case 1:
                        resp = _b.sent();
                        parsed = $(resp.response);
                        imgContainer = parsed.find('.post-image-container');
                        imgId = imgContainer.prop('id');
                        src = "https://i.imgur.com/" + imgId + ".png";
                        ExpandoButtonModule_1.ExpandoButtonModule.insertImageIntoBox(box, src, cfg);
                        return [2 /*return*/, true];
                    case 2:
                        err_1 = _b.sent();
                        common_1.printError('ImgurBrokenEmbed', 'failed to get or parse imgur document', err_1);
                        return [2 /*return*/, false];
                    case 3: return [2 /*return*/];
                }
            });
        });
    };
    ImgurBrokenEmbed.brokenImgurRegexGen = function () { return /^https:\/\/(?:m\.)?imgur\.com\/.*?([a-zA-Z0-9]+)$/gm; };
    ImgurBrokenEmbed.isImgurBroken = function (x) {
        return ImgurBrokenEmbed.brokenImgurRegexGen().test(x) && !x.includes('gallery') && !x.includes('/a/');
    };
    return ImgurBrokenEmbed;
}(EmbedProcessor_1.EmbedProcessor));
exports.imgurBrokenEmbed = new ImgurBrokenEmbed();


/***/ }),
/* 60 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var __awaiter = (this && this.__awaiter) || function (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());
    });
};
var __generator = (this && this.__generator) || function (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 };
    }
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.odyseeEmbed = void 0;
var EmbedProcessor_1 = __webpack_require__(2);
var ExpandoButtonModule_1 = __webpack_require__(1);
var common_1 = __webpack_require__(0);
var OdyseeEmbed = /** @class */ (function (_super) {
    __extends(OdyseeEmbed, _super);
    function OdyseeEmbed() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    OdyseeEmbed.prototype.genRegex = function () {
        return /^https:\/\/odysee.com\/@[\w:]+\/[\w\-:]+$/;
    };
    OdyseeEmbed.prototype.processMatchingLink = function (_a) {
        var link = _a.link, box = _a.box, cfg = _a.cfg;
        return __awaiter(this, void 0, void 0, function () {
            var resp, parsed, videoUrl, el, err_1;
            return __generator(this, function (_b) {
                switch (_b.label) {
                    case 0:
                        _b.trys.push([0, 2, , 3]);
                        return [4 /*yield*/, common_1.xhrP({
                                method: 'GET',
                                url: link,
                            })];
                    case 1:
                        resp = _b.sent();
                        common_1.debugLog('handleOdyseeLink', resp);
                        parsed = $('<div>').append($(resp.response));
                        videoUrl = parsed.find('meta[property="og:video"]').prop('content');
                        el = $("<div class=\"handleOdyseeLink embed-responsive embed-responsive-16by9\"><iframe src=\"" + videoUrl + "\" allowfullscreen></iframe></div>");
                        ExpandoButtonModule_1.ExpandoButtonModule.insertWrappedElementIntoBox(box, el);
                        return [2 /*return*/, true];
                    case 2:
                        err_1 = _b.sent();
                        common_1.printError('OdyseeEmbed', err_1);
                        return [2 /*return*/, false];
                    case 3: return [2 /*return*/];
                }
            });
        });
    };
    return OdyseeEmbed;
}(EmbedProcessor_1.EmbedProcessor));
exports.odyseeEmbed = new OdyseeEmbed();


/***/ }),
/* 61 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var __awaiter = (this && this.__awaiter) || function (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());
    });
};
var __generator = (this && this.__generator) || function (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 };
    }
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.parlerEmbed = void 0;
var EmbedProcessor_1 = __webpack_require__(2);
var ExpandoButtonModule_1 = __webpack_require__(1);
var ParlerEmbed = /** @class */ (function (_super) {
    __extends(ParlerEmbed, _super);
    function ParlerEmbed() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    ParlerEmbed.prototype.genRegex = function () {
        return /^https:\/\/parler\.com\/post\/(\w+).*$/g;
    };
    ParlerEmbed.prototype.processMatchingLink = function (_a) {
        var link = _a.link, box = _a.box, cfg = _a.cfg;
        return __awaiter(this, void 0, void 0, function () {
            var id, el;
            return __generator(this, function (_b) {
                id = this.matchAllAndGetCapturedPart(link);
                if (!id) {
                    console.log('failed to get Parler video id', link);
                    return [2 /*return*/, false];
                }
                el = $("\n<blockquote class=\"parler-parley\">\n  <a lang=\"en\" dir=\"ltr\" href=\"https://embed.parler.com/post/" + id + "\" target=\"_blank\"></a>\n</blockquote>\n<script async src=\"https://embed.parler.com/embed/parley-embed.min.js\" charset=\"utf-8\"></script>\n");
                ExpandoButtonModule_1.ExpandoButtonModule.insertWrappedElementIntoBox(box, el);
                return [2 /*return*/, true];
            });
        });
    };
    return ParlerEmbed;
}(EmbedProcessor_1.EmbedProcessor));
exports.parlerEmbed = new ParlerEmbed();


/***/ }),
/* 62 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var __awaiter = (this && this.__awaiter) || function (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());
    });
};
var __generator = (this && this.__generator) || function (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 };
    }
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.VotingModule = void 0;
var ramda_1 = __webpack_require__(4);
var styles_1 = __webpack_require__(3);
var common_1 = __webpack_require__(0);
var RuqESModule_1 = __webpack_require__(6);
var VotingModule = /** @class */ (function (_super) {
    __extends(VotingModule, _super);
    function VotingModule() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    VotingModule.prototype.setupClickEffect = function () {
        $('.arrow-up, .arrow-down')
            .filter(function (_, rawEl) { return !$(rawEl).hasClass(styles_1.voteAnimHandlerAppliedCls); })
            .addClass(styles_1.voteAnimHandlerAppliedCls)
            .click(function (evt) {
            var evtTargetEl = $(evt.target);
            var el = evtTargetEl;
            if (el.prop('tagName').toLowerCase() === 'i') {
                el = el.parent();
            }
            var isOnMobile = Boolean(el.closest('.voting.d-md-none').length);
            if (el.prop('tagName').toLowerCase() !== 'span' && el.prop('tagName').toLowerCase() !== 'div') {
                common_1.printError('clickEffect: failed to locate voting elem');
                return true;
            }
            common_1.debugLog('voting - clickEffect - click handler', 'el =', el, '; evtTargetEl = ', evtTargetEl, 'isOnMobile = ', isOnMobile, '; evt =', evt);
            var animEl = $('<i>')
                .addClass(el.prop('class').includes('up') ? 'fa-arrow-alt-up' : 'fa-arrow-alt-down')
                .addClass('fas position-absolute')
                .addClass(styles_1.voteAnimCls);
            if (!isOnMobile) {
                animEl.css({ left: $('#thread').length ? '18%' : '35%' });
            }
            el.prepend(animEl);
            el.css({ position: 'relative' });
            setTimeout(function () { return animEl.remove(); }, 750);
            return true;
        });
    };
    VotingModule.prototype.setup = function (args, cfg) {
        return __awaiter(this, void 0, void 0, function () {
            var votingCfg;
            return __generator(this, function (_a) {
                votingCfg = cfg.voting;
                if (!ramda_1.prop('silent', args || {})) {
                    common_1.debugLog('setupVoting', votingCfg);
                }
                if (votingCfg.bigVoteArrowsOnMobile) {
                    $('.voting.d-md-none').addClass(styles_1.bigVoteArrowsOnMobileCls);
                }
                if (votingCfg.clickEffect) {
                    this.setupClickEffect();
                }
                return [2 /*return*/, Promise.resolve()];
            });
        });
    };
    ;
    VotingModule.prototype.onContentChange = function (args, cfg) {
        return __awaiter(this, void 0, void 0, function () {
            return __generator(this, function (_a) {
                return [2 /*return*/, this.setup(args, cfg)];
            });
        });
    };
    return VotingModule;
}(RuqESModule_1.RuqESModule));
exports.VotingModule = VotingModule;


/***/ }),
/* 63 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var __awaiter = (this && this.__awaiter) || function (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());
    });
};
var __generator = (this && this.__generator) || function (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 };
    }
};
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.SidebarModule = void 0;
var selectors_1 = __webpack_require__(5);
var styles_1 = __webpack_require__(3);
var common_1 = __webpack_require__(0);
var config_1 = __webpack_require__(7);
var RuqESModule_1 = __webpack_require__(6);
var renderFavoritesInSidebar_1 = __webpack_require__(64);
var swapIndices_1 = __webpack_require__(19);
var saved_pfp_png_1 = __importDefault(__webpack_require__(65));
var SidebarModule = /** @class */ (function (_super) {
    __extends(SidebarModule, _super);
    function SidebarModule() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.genClickHandlerOfMoveButtons = function (offset) { return function (evt) {
            var el = $(evt.target);
            var idxARaw = el.closest('li').data('index');
            if (idxARaw === undefined) {
                common_1.printError('genClickHandlerOfMoveButtons', 'failed to get index of current fav');
                return;
            }
            var idxA = parseInt(idxARaw);
            if (!common_1.isNumber(idxA)) {
                common_1.printError('genClickHandlerOfMoveButtons', 'invalid index', idxA);
                return;
            }
            _this.swapFavorites(idxA, idxA + offset);
        }; };
        _this.isOnHelpPage = common_1.isOnPathOrSubpageGen('help');
        return _this;
    }
    SidebarModule.prototype.toggleSidebar = function () {
        var btn = common_1.$c(styles_1.sidebarButtonCls);
        btn.toggleClass('opened');
        var opened = btn.hasClass('opened');
        common_1.setClass(selectors_1.getRightSidebarEl(), styles_1.sidebarClosedCls, !opened);
    };
    ;
    SidebarModule.prototype.setupFavSidebar = function (cfg) {
        var _this = this;
        var oldEl = common_1.$c(styles_1.sidebarFavoritesCls);
        var wasEditing = oldEl.hasClass(styles_1.sidebarFavoritesEditingCls);
        oldEl.remove();
        var bar = selectors_1.getLeftSidebarEl();
        var body = bar.find('.sidebar-section > .body');
        var el = renderFavoritesInSidebar_1.renderFavoritesInSidebar(cfg, cfg.sidebar.favorites);
        common_1.debugLog('setupFavorites', { bar: bar, cfg: cfg, body: body });
        if (wasEditing) {
            el.addClass(styles_1.sidebarFavoritesEditingCls);
        }
        el.find("." + styles_1.sidebarFavoritesEditButtonCls).click(function (evt) {
            el.toggleClass(styles_1.sidebarFavoritesEditingCls);
        });
        el.find("." + styles_1.sidebarFavoritesDeleteItemCls).click(function (evt) {
            var el = $(evt.target);
            var idx = el.closest('li').data('index');
            if (idx !== undefined) {
                _this.removeFromFavorites(idx);
            }
        });
        el.find("." + styles_1.sidebarFavoritesUpItemCls).click(this.genClickHandlerOfMoveButtons(-1));
        el.find("." + styles_1.sidebarFavoritesDownItemCls).click(this.genClickHandlerOfMoveButtons(1));
        body.children().first().after(el);
    };
    SidebarModule.prototype.addGuildToFavorites = function (name) {
        return __awaiter(this, void 0, void 0, function () {
            var newItem;
            return __generator(this, function (_a) {
                switch (_a.label) {
                    case 0:
                        newItem = {
                            tag: 'guild',
                            guildName: name,
                            openTarget: '_self',
                            label: null,
                            sort: common_1.getCurrentSort(),
                            image: common_1.getGuildImageOnGuildPage(),
                        };
                        return [4 /*yield*/, this.addToFavorites(newItem)];
                    case 1:
                        _a.sent();
                        return [2 /*return*/];
                }
            });
        });
    };
    SidebarModule.prototype.addToFavorites = function (item) {
        return __awaiter(this, void 0, void 0, function () {
            var cfg;
            return __generator(this, function (_a) {
                switch (_a.label) {
                    case 0: return [4 /*yield*/, config_1.readConfig()];
                    case 1:
                        cfg = _a.sent();
                        cfg.sidebar.favorites.push(item);
                        return [4 /*yield*/, config_1.writeConfig(cfg)];
                    case 2:
                        _a.sent();
                        this.setupFavButton(cfg);
                        this.setupFavSidebar(cfg);
                        return [2 /*return*/];
                }
            });
        });
    };
    SidebarModule.prototype.removeFromFavorites = function (index) {
        return __awaiter(this, void 0, void 0, function () {
            var cfg;
            return __generator(this, function (_a) {
                switch (_a.label) {
                    case 0: return [4 /*yield*/, config_1.readConfig()];
                    case 1:
                        cfg = _a.sent();
                        cfg.sidebar.favorites = cfg.sidebar.favorites.filter(function (_, idx) { return idx !== index; });
                        return [4 /*yield*/, config_1.writeConfig(cfg)];
                    case 2:
                        _a.sent();
                        this.setupFavButton(cfg);
                        this.setupFavSidebar(cfg);
                        return [2 /*return*/];
                }
            });
        });
    };
    SidebarModule.prototype.removeGuildFromFavorites = function (name) {
        return __awaiter(this, void 0, void 0, function () {
            var cfg, idx;
            return __generator(this, function (_a) {
                switch (_a.label) {
                    case 0: return [4 /*yield*/, config_1.readConfig()];
                    case 1:
                        cfg = _a.sent();
                        idx = cfg.sidebar.favorites.findIndex(function (x) { return x.tag === 'guild' && x.guildName === name; });
                        if (!(idx !== undefined)) return [3 /*break*/, 3];
                        return [4 /*yield*/, this.removeFromFavorites(idx)];
                    case 2:
                        _a.sent();
                        _a.label = 3;
                    case 3: return [2 /*return*/];
                }
            });
        });
    };
    SidebarModule.prototype.swapFavorites = function (idxA, idxB) {
        return __awaiter(this, void 0, void 0, function () {
            var cfg, maxIdx;
            return __generator(this, function (_a) {
                switch (_a.label) {
                    case 0: return [4 /*yield*/, config_1.readConfig()];
                    case 1:
                        cfg = _a.sent();
                        maxIdx = cfg.sidebar.favorites.length - 1;
                        if (idxA < 0 || idxA > maxIdx || idxB < 0 || idxB > maxIdx) {
                            return [2 /*return*/];
                        }
                        cfg.sidebar.favorites = swapIndices_1.swapIndices(idxA)(idxB)(cfg.sidebar.favorites);
                        return [4 /*yield*/, config_1.writeConfig(cfg)];
                    case 2:
                        _a.sent();
                        this.setupFavSidebar(cfg);
                        return [2 /*return*/];
                }
            });
        });
    };
    SidebarModule.prototype.setupFavButton = function (cfg) {
        var _this = this;
        if (!common_1.isOnGuildPage()) {
            return;
        }
        common_1.$c(styles_1.sidebarFavoritesGuildBtnCls).remove();
        var gName = common_1.getGuildNameFromPathname();
        var isInFavorites = Boolean(cfg.sidebar.favorites.find(function (x) { return x.tag === 'guild' && x.guildName === gName; }));
        var iconCls = isInFavorites ? 'fas fa-star' : 'far fa-star';
        var iconEl = $('<i>').addClass(iconCls).addClass('mr-1');
        var target = $('#main-content-col').children().first().next().find('.col');
        var btnTextEl = $('<span>').text(isInFavorites ? 'Remove from favorites' : 'Add to favorites');
        var el = common_1.genJsAnchor().addClass(styles_1.sidebarFavoritesGuildBtnCls)
            .append(iconEl)
            .append(btnTextEl);
        el.click(function () {
            if (!isInFavorites) {
                _this.addGuildToFavorites(gName);
            }
            else {
                _this.removeGuildFromFavorites(gName);
            }
        });
        target.append(el);
    };
    SidebarModule.prototype.setupFavorites = function (cfg) {
        this.setupFavSidebar(cfg);
        this.setupFavButton(cfg);
    };
    SidebarModule.prototype.setupSavedContentLinkInFeeds = function () {
        var path = 'saved';
        var linkUnfoldedEl = $(("\n<li class=\"guild-recommendations-item\">\n    <a href=\"" + common_1.genRuqESUrl(path) + "\">\n        <div class=\"d-flex\">\n            <div>\n                <img src=\"data:image/png;base64," + btoa(saved_pfp_png_1.default) + "\" class=\"profile-pic profile-pic-30\">\n            </div>\n            <div class=\"my-auto ml-2\">\n                <div class=\"text-black font-weight-normal\">Saved</div>\n            </div>\n        </div>\n    </a>\n</li>\n    ").trim());
        linkUnfoldedEl.find('a').click(common_1.genNavigateToRuqESUrl(path));
        var linkFoldedEl = $(("\n<li class=\"guild-recommendations-item\">\n    <a href=\"" + common_1.genRuqESUrl(path) + "\">\n        <img src=\"data:image/png;base64," + btoa(saved_pfp_png_1.default) + "\" class=\"profile-pic profile-pic-30 transition-square\">\n    </a>\n</li>\n    ").trim());
        linkFoldedEl.find('a').click(common_1.genNavigateToRuqESUrl(path));
        var feedsSections = selectors_1.getLeftSidebarEl().find('.body > .mb-4').first().find('ul');
        feedsSections.first().append(linkUnfoldedEl);
        feedsSections.eq(1).append(linkFoldedEl);
    };
    SidebarModule.prototype.setupRightButton = function (sidebarCfg) {
        var iconEl = $('<span>').addClass(styles_1.sidebarButtonIconCls);
        var btnEl = $('<a>').addClass('btn opened').addClass(styles_1.sidebarButtonCls).html(iconEl).click(this.toggleSidebar);
        selectors_1.getRightSidebarEl().prepend(btnEl);
        common_1.debugLog('[SidebarModule] setupRightButton', {
            'isOnGuildPage()': common_1.isOnGuildPage(),
            'sidebarCfg.autoHideRightButNotOnGuildPage': sidebarCfg.autoHideRightButNotOnGuildPage,
        });
        if (sidebarCfg.autoHideRight) {
            if (!sidebarCfg.autoHideRightButNotOnGuildPage || !common_1.isOnGuildPage()) {
                this.toggleSidebar();
            }
        }
    };
    SidebarModule.prototype.setup = function (args, cfg) {
        return __awaiter(this, void 0, void 0, function () {
            var sidebarCfg;
            return __generator(this, function (_a) {
                sidebarCfg = cfg.sidebar;
                common_1.debugLog('setupSidebar', sidebarCfg);
                if (sidebarCfg.rightButton) {
                    this.setupRightButton(sidebarCfg);
                }
                if (sidebarCfg.independentScroll && !this.isOnHelpPage()) {
                    selectors_1.getRightSidebarEl().wrapInner($('<div>').addClass(styles_1.sidebarIndependentScrollCls).addClass(styles_1.hideScrollbarCls));
                }
                if (sidebarCfg.favoritesEnabled) {
                    this.setupFavorites(cfg);
                }
                if (sidebarCfg.smallGuildImages) {
                    selectors_1.getLeftSidebarEl().find(".body > .mb-4:not(." + styles_1.sidebarFavoritesCls + "), .body > .pl-0").addClass(styles_1.sidebarSmallGuildImageCls);
                }
                if (sidebarCfg.savedContentLinkInFeeds && cfg.save.enabled) {
                    this.setupSavedContentLinkInFeeds();
                }
                if (sidebarCfg.hideContentOfMyGuilds) {
                    selectors_1.getMyGuildsInSidebarEl().find('ul').hide();
                }
                return [2 /*return*/];
            });
        });
    };
    return SidebarModule;
}(RuqESModule_1.RuqESModule));
exports.SidebarModule = SidebarModule;


/***/ }),
/* 64 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.renderFavoritesInSidebar = void 0;
var styles_1 = __webpack_require__(3);
var common_1 = __webpack_require__(0);
var ramda_1 = __webpack_require__(4);
var getLinkFromItem = function (x) {
    switch (x.tag) {
        case 'link':
            return x.url;
        case 'guild':
            var args = x.sort ? "?sort=" + x.sort : '';
            return "/+" + x.guildName + args;
    }
};
var getLabelFromItem = function (x) {
    if (x.label) {
        return x.label;
    }
    switch (x.tag) {
        case 'link':
            return x.url;
        case 'guild':
            return "+" + x.guildName;
    }
};
var defaultGuildImage = '/assets/images/guilds/default-guild-icon.png';
var getImageFromItem = function (x) {
    if (x.image) {
        return x.image;
    }
    switch (x.tag) {
        case 'link':
            return '/assets/images/icons/default_thumb_text.png'; // TODO?
        case 'guild':
            return defaultGuildImage;
    }
};
var renderBigItem = function (x, i, allItems) {
    var isLast = i === allItems.length - 1;
    var isFirst = i === 0;
    return "\n  <li class=\"guild-recommendations-item d-flex justify-content-between w-100\" data-index=\"" + i + "\">\n      <a\n          href=\"" + getLinkFromItem(x) + "\"\n          target=\"" + x.openTarget + "\"\n          title=\"" + getLabelFromItem(x) + "\"\n          class=\"flex-grow-1 text-truncate\"\n      >\n          <div class=\"d-flex\">\n              <div>\n                  <img src=\"" + getImageFromItem(x) + "\" class=\"profile-pic profile-pic-30 mr-2\">\n              </div>\n              <div class=\"my-auto\">\n                  <div class=\"text-black font-weight-normal\">" + getLabelFromItem(x) + "</div>\n              </div>\n          </div>\n      </a>\n      <div\n          class=\"disabled " + styles_1.sidebarFavoritesShowOnlyInEditingCls + " " + styles_1.sidebarFavoritesItemButtonCls + " " + styles_1.sidebarFavoritesEditItemCls + "\"\n      >\n          <i class=\"fas fa-feather-alt\"></i>\n      </div>\n  \n      <div\n          class=\"" + styles_1.sidebarFavoritesShowOnlyInEditingCls + " " + styles_1.sidebarFavoritesItemButtonCls + " " + styles_1.sidebarFavoritesUpItemCls + " " + (isFirst ? 'disabled' : '') + "\"\n            title=\"Move up\"\n        >\n          <i class=\"fas fa-angle-up\"></i>\n      </div>\n      <div\n          class=\"" + styles_1.sidebarFavoritesShowOnlyInEditingCls + " " + styles_1.sidebarFavoritesItemButtonCls + " " + styles_1.sidebarFavoritesDownItemCls + " " + (isLast ? 'disabled' : '') + "\"\n            title=\"Move down\"\n      >\n          <i class=\"fas fa-angle-down\"></i>\n      </div>\n  \n      <div\n          class=\"" + styles_1.sidebarFavoritesShowOnlyInEditingCls + " " + styles_1.sidebarFavoritesItemButtonCls + " " + styles_1.sidebarFavoritesDeleteItemCls + "\"\n          title=\"Remove from favorites\"\n      >\n          <i class=\"fas fa-skull\"></i>\n      </div>\n  </li>\n    ";
};
var renderSmallItem = function (x, i) { return "\n<li class=\"guild-recommendations-item\" data-index=\"" + i + "\">\n    <a href=\"" + getLinkFromItem(x) + "\" target=\"" + x.openTarget + "\" title=\"" + getLabelFromItem(x) + "\">\n        <img src=\"" + getImageFromItem(x) + "\" class=\"profile-pic profile-pic-30 transition-square\">\n    </a>\n</li>\n"; };
exports.renderFavoritesInSidebar = function (cfg, items) {
    var html = "<div class=\"mb-4 " + styles_1.sidebarFavoritesCls + " " + (cfg.sidebar.favoritesSmallImages ? styles_1.sidebarFavoritesSmallImageCls : '') + "\">\n    <div class=\"sidebar-collapsed-hidden\">\n        <div class=\"d-flex justify-content-between align-items-center mb-3\">\n            <div class=\"text-small font-weight-bold text-muted text-uppercase\" style=\"letter-spacing: 0.025rem;\">\n                Favorites\n                " + common_1.createRuqesMark().addClass(styles_1.nonAggressiveCls).addClass('ml-2').prop('title', 'RuqES')[0].outerHTML + "\n            </div>\n            <span\n                class=\"px-0 " + styles_1.nonAggressiveCls + " " + styles_1.sidebarFavoritesEditButtonCls + "\"\n                title=\"Edit favorites\"\n            >\n                <i class=\"fas fa-cog\"></i> \n            </span>\n        </div>\n    </div>\n    <div class=\"sidebar-collapsed-visible\" title=\"Favorites (RuqES)\">\n        <i class=\"fas fa-star text-muted mb-3\" style=\"font-size: 1rem;\"></i>\n    </div>\n    <ul class=\"no-bullets guild-recommendations-list pl-0 sidebar-collapsed-hidden\">\n        " + items.map(renderBigItem).join('\n') + "\n    </ul>\n\n    <ul class=\"no-bullets guild-recommendations-list pl-0 sidebar-collapsed-visible\">\n        " + items.map(renderSmallItem).join('\n') + "\n    </ul>\n    \n    <span class=\"" + styles_1.sidebarFavoritesEmptyNoticeCls + " " + (ramda_1.isEmpty(items) ? 'd-flex' : 'd-none') + " p-3 flex-column justify-content-center align-items-center\">\n        <i class=\"fad fa-star mb-2\"></i>\n        <div class=\"text-center\">\n            No favorites, yet.<br>\n            Use <i class=\"far fa-star\"></i> to add some.\n        </div>\n    </span>\n</div>\n  ";
    var res = $(html);
    return res;
};


/***/ }),
/* 65 */
/***/ (function(module, exports) {

module.exports = "‰PNG\r\n\u001a\n\u0000\u0000\u0000\rIHDR\u0000\u0000\u0001*\u0000\u0000\u0001*\b\u0002\u0000\u0000\u0000-XŠx\u0000\u0000\n\u000bzTXtRaw profile type exif\u0000\u0000xÚí˜Y’£+\u000e…ßYE/\u0001!@°\u001cƈ»ƒ^~`çPY™5t݇ŽŽë¿Ê8\u0001\u000b¡£áÈnýû¯íþÅK“Ï.&+¹æìyÅ\u001akh|(þíµžãcN|¼ï//y¾‹ût!0*£>&->Wõ9ÿ²?¿Ž\búdA҇/èë1áýÁ֞óÁ‡o4Òà§ÿ*oÿ÷žeïõ¸]‹\u00193äÇ¥\u001eG¸\u00171lìXIï×2ñ?ñÙîSyŠo~Hä°á;ϐ*AÔo‰24Ù²d2\u000e\u0019è\u0018Ã\nÆ\u0018Â\bzçŠZ¨a¨WÑx\u001eÙÁ´êÔ¢AGXª\u001a†W]äž[ïyC\n'Oak\u0010„\t_ùáã~¶áWž½‡ÇF\"Ü^ž¶B¯\u0010\u000e\u000er̨çm\u0000\"û‰[º\u0006~y^_î\u001d°\n‚éš¹pÁæûCDOòæ[z\u001d@ٗ\u0018\u001fþ%6\u000fjázIäì„2¢@à³h’,ÞB0‘¨¡\u0000PCó 1t\u0010”ÂDÉ\u0010U3Ø\u0014üˆ³ùŽÉÝ\u001bRxÌ\u0013*à“4«MÕ\u0006X1&üÇbÁ‡ZÒ\u0014SJ9Y*©¦æ²æ˜SÎÙò‰¹fjђe3+V­\u0015-±¤’‹•Rji5T%$SÍÕj©µ¶Æ™-º–\u001aßnìh­‡®=öÔs·^zímà>#Ž4ò°QF\u001dm†©3Î4ó´YfmÉ•܊+­¼l•UWÛøÚÖ\u001dwÚyÛ.»îöŠÚ\u0013Õïžß@Mž¨…‹ÔÙg¯¨1kv\u0004]\u0011ròL:˜Xˆ\u0002âv\u0010À¡ÃÁÌ\u0017‰1\u001cä\u000ef¾\u0006¢\"\u0005”L\u0007›)¾9É@\u0018—„´å\u0015»7ä~\u00197‡­†[ø\u0015ä܁îo@.¸¥\u001fpû\u0004µy2Ḉ=¢ðØÔ+Ñ׸ögq•8¹ø?\u001bݟ\nøGÐÿ° 4£•Ô‡LÝ¥¨š„^K\u00183.µ¥Õœ®‚/·šÈ¢KÇTË1ä5,l\u001c­ûhÛ¯M “ô›Ö9v«5\"\u000ew\\’Ö.F\u0001¶ââ<S¶ã4±+™Xƒ1p̑tŠHèsSŠÙ7¶¯}¯½jÓý*\u0007‘æʑtä\b‘P£ue–k,®ƒ^ìjۆ^1TÕ|ƾ[†\b\u0014ÎYrWêr¢¶çžÊ\u0015rK²ÆÐoÔA‹§BðƒÏ\u0015âbqº—‹}ªP:«¨¤ãÚd?T:\nuoWŒï’zÇpNGYk4\r™ôºbE'›¹5©eúª=\u000f=’ëœ\u0012Ûh䑔ÈjÝk\t¾-s\rHjηPøçÿttǖ\u000b£Ì \u001döÑƚÒ\u001b†ùV€\u001a?°­ôÜvc›í¥3`¼¶rߣutœµ/—JÛIµ•Ø#¾$³µ¸!TÓê5æîiQܵD-\u0018&­SaZ\bI\u000fëìë\u0005X]\\½ç&ӓлΓp·ÔcÚ\u0012/f\u0011‹ãÍLÙJ†S\u001dàã©T\u0017ŠÇ\u0012åè¹Ú[ß=¬n–ö$5·\u00153\u0010\u001eìô\"æ\u001fÂ\u000bèÛ\u0016ÀçZw&\u001d\u001f©ÛíkgeV\u0003Ô¶W_Q0Âι…>2\u0006’+–Ê…SÁ\u0011ñÁz5ÃØúXýn…÷:j•º\bÒdÐû¢\u0014™Zœ9S\u001a:!\u0012ëòµÅTF9唚EýÅY¬Õi!aƱŠÆf3Rƚb\u0011LXT,…ȤÅ\u0015}'hqÅ-\u0014¢cC0\u000eÍN5\reµãzë°«ês_¥S¾Œû-?È*5A\n&Ka®P†\u001bõ½\u0018Ìä—öj›\u001bi^e´2zS\u001d„i£<S”\u0003\u000eþþ\b<{v%±ý±k_Gußy*±ü•\u000fۘ\u001d\u00020Žöñ81Uú|ND²;Si뜸À XHA\u0013#á\u0011iÇ\u0010ë^mîU°‘(?ž\u0003Á/G|™{¬š“öAˆD‰\u0003žqôÜ9Nõ¥Ö¿Œ}¶p=¼˜Å›ÄÚ®×¢œs‚h¦å\u00156ò³M!s/XÖXͧ[\u0006È5µ¢ÿ\u0016ß\u0007ÍcOØ£»”[eEº“ãƒ\u0005æWæ܉lFÌ\u001b.\u001fZÉÛ\u000föá_\u0004q\u0018<\röij`\u0001©yâqUhÜ1Ãé䞧–š¯¼¹w\u0013ÈÖyH¬Aó.\u001a$\u0013Â\u0005˜¾^ƒBõ<ývõ@bÉÛ¸\u0000õ\u0007@£\u0015\u0000†8Ä\u001dof£?èBØúJ¤™\u0002Õ\f«vtŽ•Š+€ Å̽Ҫ”Vh\u0002ûʉ?¥¦²=¨á¹d\bl{j%ڀ-Ç쎜=naŠ 6´_\u0007óýä\u0013\nÄ3æ¸AO°M”À¸µ\u001aÁKŠøJ¬ûVîWb¿\u0015ZL\u001bü4\u001f×[Ï﹯¾øzäó\u001e¸æˉ'\u0011¥‰Ie¯,WÑMsLJM‹>÷ÖÒúÑ!«äº$O\t£-œ$Ì\u001dñ\r\u001cOkÊ\u0010bO.Ì\u0014\b\u0007<#óYÇŽ”G„vÛ#´;ôœ^aě¯i»W»ŸÒê$RhL†ç´N˜Ž\büûeÇÇõqr‡û×64?eÏD\u001bÿ!\u001eÏè>N|:â]ÖÉãeGŒ½zÅ5\u0003q¹ÞVÜ·K#’9ïØ\u00185…ÆçF\f>UnðÐXñ7‰è4A‘ˆ,–'±(n剥÷œ#x\u001a\u0007»\fn̓t\ré$gZ\u001fr.¸ÎšC:¿~\fܝ\b àΜÆè4M\\­ŸB8Ï©5SdHka†èsª|?l©ˆ+â\u001cü\u001bÉ¡Ðӌ(9-›½Î\u001e(\u001fÁ‘i¬Æã7ëFØf¢ÛÝa\u0016\u0019‰~­];-’å‹Å\u00061\f(£@=Ûɧ0=©¶Q׶Ï$Ÿúَ·eå€\u0012Ò:4k–‡Üb¿xºÿ¾n|[\u001cÜo֍C~NƒVF&ó•\u0011éÍ͋«§}\u0004\u0004j\u0002\u0014Ò\u000eŸÆžº Št‹5J¥\u001dæ\u0014¤\u000eøLN2H‚µ'køÉ\u0006˜µwPÁCąŒ{ÚJ\u001alœàüþ—Bê‡6\u0005ZR hU\u0001\r÷é§Þ\u0006Ò|Æñ¢P\u0013nÙpø\u0015þ•š\u0001\u001b‡Ãe\u0004KÆX4DbÄ6e\u0019:LKÍ\u0015 \f\rIG/Ôy\u00161zwÌæ\u001eöûÕÐü:2Ýï…æ×£ûÕÐ̝S°´×€ÍUZ•÷E¤ºg\u0011©\u000f\u000f†*WUöáq\u0003\bnT`¢)Jj£E#—\n1Ði\u0017ˆ\bRær¹SF\bä\u0002\u0001;\u0004K†¤,%\u001c-\u001aQ\t\u001f¶Tɬc\u00122Qµ_^Jݙ¶ ãð&ˆÚ:Ì\u000f¢W\u000eÓ\bèF1\u0012‰\":\u0000Äb¢$“?\u001b\u001c‘-…ÔM[ÕÄVƒF\u0016$Öӊ¹\r©Ÿi\"#t\u001c\tÿ„ÙõÔ#4q“l}¢Ú¥R¹rJ\u0019áh|\u0014›O\u0013leÏ͐ïÐÿ*éB„èh\u0004f*´;ÐU]£“¿ ¹“\u001e‹†¬ºSÚ%ÐE¤’ǃ\u0006XCƒ·|øk£{°\u0006ɕN\u0017•a3Ó)^\u0013'“9\tM\t\n›“•¡»Å[?éŠDFF\u001cp~z‘öäF\u001aâF°Éi\u001c‹‡sгU\t>Æ\u00193ð§=œkø=óÅmBåú)ŸqÝÂíx‡m\u0014šœJçH•™³¡dێLL•éQ\u001fES´÷GO;à•·{}]sŸ,&h`­Þ‚|”v²Òã\u000b\u001fe]VûÝRº¤÷sY_iæ~°ø[š¹\u001f)ýQ³l2gArˆn»…aÞ\u001f æ¦@>ˆ\f\rú„Ià±¾ÅÞJ¢û$ýµ\u0019ºÐϧÛt‘çÆ8¿\r,:w£™©Ýjà`4ꡞÜi‡\u001e\u001b\\åüŒJÑ«û°M\"þ:(ԊhoB?\u000f݅\u0011>¢cŽ7êëþŽŸ|þ\u0011ôÿ&\b·Õý\u0007òµ\u0012ßk¥#[\u0000\u0000\u0001…iCCPICC profile\u0000\u0000xœ}‘=HÃ@\u001cÅ_[µµT\u001cì ꐡ:Y\u0010\u0015qÔ*\u0014¡B¨\u0015Zu0¹ôChҐ¤¸8\n®\u0005\u0007?\u0016«\u000e.κ:¸\n‚à\u0007ˆ“£“¢‹”ø¿¤Ð\"ƃã~¼»÷¸{\u0007øëe¦š\u001dc€ªYF:™\u0010²¹\u0015!øŠ0BèB7\u0006%fê³¢˜‚çøº‡¯wqžå}îÏÑ£äM\u0006ø\u0004â\u0019¦\u001b\u0016ñ:ñÔ¦¥sÞ'Ž²’¤\u0010Ÿ\u0013\u001atAâG®Ë.¿q.:ìç™Q#“ž#Ž\u0012\u000bÅ6–Û˜•\f•x’8¦¨\u001aåû³.+œ·8«å*kޓ¿0’×–—¸Ns\bI,`\u0011\"\u0004Ȩb\u0003eXˆÓª‘b\"Mû\t\u000fÿ€ã\u0017É%“k\u0003Œ\u001có¨@…äøÁÿàw·fabÜMŠ$€Î\u0017Ûþ\u0018\u0006‚»@£fÛßǶÝ8\u0001\u0002ÏÀ•ÖòWêÀô'鵖\u0016;\u0002z·‹ë–&ï\u0001—;@ÿ“.\u0019’#\u0005hú\u000b\u0005àýŒ¾)\u0007ôÝ\u0002áU··æ>N\u001f€\fu•º\u0001\u000e\u000e‘\"e¯y¼;ÔÞÛ¿gšýý\u0000\u0000\u0015ry=îÌy\u0000\u0000\u0000\tpHYs\u0000\u0000\u0016%\u0000\u0000\u0016%\u0001IR$ð\u0000\u0000\u0000\u0007tIME\u0007ä\n\b\u0006\f\u0002ˆ3‘è\u0000\u0000\t0IDATxÚíÝyŒT…\u001dÀñ9vwvgwg\u000f˜]a»«­\nŠ‚â\u0001*\u001e+\u0015ZL½Š­†˜Ø¤Mè\u001fM“&ýÓÿ›6ýÃÖÚÆDMM­‰·AEb[\u000bµBU¤‚â‚\u0007ì.,»ÌÞ×ìÌNÿ\bâ,s,3ŸÏ¿$ó2?Þwß5ï½à=ëv\u0004€B\b\u0019\u0001È\u000fä\u0007È\u000fä\u0007È\u000fä\u0007È\u000fä\u0007È\u000fä\u0007È\u000fä\u0007È\u000fä\u0007È\u000fä\u0007ò\u0003ä\u0007ò\u0003ä\u0007ò\u0003ä\u0007ò\u0003ä\u0007ò\u0003ä\u0007ò\u0003ä\u0007ò\u0003ä\u0007ò\u0003ä\u0007ò\u0003ù\u0001ò\u0003ù\u0001ò\u0003ù\u0001ò\u0003ù\u0001ò\u0003ù\u0001ò\u0003ù\u0001ò\u0003ù\u0001ò\u0003ùü\u0000ùü\u0000ùü\u0000ùü\u0000ùü\u0000ùü\u0000ùü\u0000ùü\u0000ùü@~€ü@~€ü@~€ü@~€ü@~€ü@~€ü@~€ü@~ ?@~ ?@~PÜʌà\u000bÿ2…\u0002Ím•5õe5õe\u0015‘P0Xäß7“\t$'§G\u0007SÃý©ž½\u0013ÓÓV\u0001ù\u0015‚¥5K®¬?kIM$Z¢{\u0007“cÓ{þ7²}Óà®7†­\u000fò˓ֳ«V­;­uAU‰Ï!\u0012\r-Z\u001e[´<ÖÙ1¾á‘\u0003û:Æ­\u001b¹\u0010n_|—)|ì²5·ÞÝZ7·Ü(>\u0011›S~áÕ\r“\u0013éÎÝ\n´õ˙\u001b~8\ræðYÁPà[wœ\u0016o©|îîLÆ<²z~Á\b\u0002@ûÚ¸ö¾ÜE×Ößò³–¢?ÿ$¿|;ç’Úkn‰›Ãq-^Q§@ùeuç»<¸æÎy\u0001«”\u0002å—Ë¿Ý\u0018kt\u0000¬@ù\u0015²UV\u0002\u0005ʯ\u0000šÛ\"±9.3(P~…pæâ\u001ak€\u0002åW\u0018õñ\nk€\u0002åW\u00185õNº(P~\u0005RUí²§\u0002åW A«Œ\u0002å‡\u0002å\u0007\nÌ+ç\u001ef.“\t$NjážðHU([?»[¼¢.\u0010\b<y_—{#ä—+\u0007>œxþ¡\u0003]SÅ°–UՄ¯½µéÒU\r\n”ßl75™ùëoö\u000e%REóÆGÒë\u001fÜ?th꛷7)бֵ߬g¼˜ÚûĦgû^{1á8P~³ÚPbªX¿Úˏ\u001dÌâî´\u0002å—}™é¢Ý£JNL\fdsî@ùQH\n”\u001f\n”\u001f\nD~(P~”\\7ÿ´Å\u001cäGa,¹²nå÷šÌA~\u0014ÆU7Ï=ÿò˜9ȏÂXsç¼H•uO~\u0014B´6¼â†¹æ ?\ncùêÆp8(?(€ŠªÐéçFå\u0007…qÖ\u00055òƒÂhl®\u001f\u0014†ç¬Ê‚‰ÖÊ\u000f\nµò•üÚ'?\u001fÈ\u000f\u001fÈ\u000f\u001fÈ\u000f\u001fÈ\u000f\u001fÈ\u000f\u001fȯ\b•GŠyhå\u0015V\tùÍbsæEŠõ«UU‡£±°ÿbùÍ^Ím‘…\u0017×\u0016åW»ú\u0016O\u001fË+/—ž‰Û~޺핁Ύ±±át1|Ÿ` ÖX¾`i͙KjüçÊoÖ¯®¡ÀÒöú¥íõFO\u001f ?\u001f ?\u001f ?\u001fÈ\u000f\u001fÈ\u000f\u001fÈ\u000f\u001fÈ\u000f\u001fÈ\u000f˜\u0011w»Ÿ2RÉ̇ïŒîÝ5vpßdorb4=•Ì”•\u0007#U¡†xÅܖÈéçDÏXT\u001d©ò'U~dOÏÞÉÿ<h疡äÄôgÿu¸?ÐםìxkäÕõ‡Êʃg_XsùõsZ\u0017DÍM~œ”¡DjÃ_\u000eìxmè«n!§2ïl\u001d~gëð7ί^sç¼¹ó+Ìб\u001f3±ãÕ¡ßÿr÷Woïhï¿=úÇ_íyíń1ÚúqÂ6>Ú³ùÙC'ó\tét慇\u000ftï\u0019¿é'óC᠑Úúñ•<÷Àþ“lï\u0013Û7\u000f>úÛ}Ó錩ʏã{ù±ƒ¯¿ÜŸÅ\u000fìØ6òôýÝ\u0006+?ŽãÝÿ\u000eÿë龬ìö̓Ž\u0003åǗ\u0019\u001bJ?ó§\\m¦^z¤§¯;iÈòãómü[Ïøh®^\u001a‘Ngžh¿!ˏÏ1Ð;õÖ+\u00039]Äûoî{ǫåDZ¶lHLOç|)¯®?dÔòãS2™ÀÛÿ\u001eÌÂ:¶LŽO\u001b¸ü8¢ç£‰áT\u001e\u0016”šÊ|¸sÔÀåÇ\u0011{wåïì£w\u001dþɏ£ôvMæmY}y\\\u0016ò;\u0005\fôNåmYý½®þɏ£LŒåï\u001dñN½ÈOI§ò÷“èԔŸ_ˏ£”Uäò\n7\u001fɏ£TFÃù[VuØÀåÇ\u0011\rMù{*DCÜ\u0013(äÇQšZ#E¹,äw\nh[\u0018-Êe!¿S@¼%ÒÐTž‡\u0005UT†Î8·ÚÀåǧ,¹²>\u000fKY´,Væ̧ü8Æ¥«\u001aËÊs\u001eÆekæ\u0018µü8Vu,¼lucN\u0017qÞòXs›ó.òãó\\óÝx¬1WO^­¨\f­¾ã4C–\u001f_XÈÚ»¿\u0016ÌÍ\u001eè?šŸ»¶‘_1h[\u0018½þ\u0007ó²þ±+n˜sÞå1ã•\u001fÇqÉu\r+¿ß”Å\u000f¼xeÃu·7\u001bì,dod6ºê¦¹UÕáõ\u000fîÏd²ðQٍ\u0019ù•Ä6°©5òø½C‰\u0019>\u0003¦ª:|ãçŸsI­aʏ™\u001c\u0007Þõë³þùDï–\r‰\u0013ºI/\u0014\n\\puýu·5Gcnn\u001f3UQ\u0019Zµ®ùŠïÌÝúRbû¦þƒÇy&Em}ÙùWÔ-[ÝX\u001f/7=ù‘\u0005Õ±pûÚxûÚxo×äáw»\u001fLNŒ¥SÉL¸,X\u0019\r×ÇËã-‘¶…ÑæÓ+ƒ~R&?r!Þ\u0012‰·øÙJñpá\u0001ä\u0007ò\u0003ä—\u000fÞx^X钟Iç7:œÖ@\u0001\r¥åWÂù\r¦4P@#\u0003)ù•®^/\u001b)ìü»'åWº:¶\rk ósX~¥k(‘ÚÿÁ„\f\nuà×¹{\\~%mÓ3}J(ÌäŸí˔ü‰çRÏo疡î=ãbÈ÷~Ç¡©-\u001b\u0012æà²{àé?w''¼ò.¦Ó§îïÎç;Õä7{\u001dÜ7ùø½v„ò慇÷°cÔ\u001cäwØ{oŽ<u_WÚ{'s,“\tl|´gëÆ~£ø˜\u001bŽ\u000eÛ¾y0ѓ¼ý\u0017­Õuf’\u0013ɉé'þеëu\u0017{Ž\b·/¾Ë\u0014\u000eŸ\u000fH¤Þø{ \u0010˜ÿõªPØ]«Ù<Ø{ã\u001fýý®Óežc\u0004ïY·Ã\u0014ŽQSWv\u000b.ªm[\u0018­¨´>C©©L×îñ÷Þ\u001cÞ¹eh wÊ@äwÂ**C5ue\"<!S“Ó£C©‰1ç“\u001dûô\u0011Kb\"i\u000eä‚?ê ?\u001f ?\u001f ?\u001f ?\u001f ?\u001f ?\u001f ?\u001f ?\u001fÈ\u000f\u001fÈ\u000f\u001fÈ\u000f\u001fÈ\u000f\u001fÈ\u000f\u001fÈ\u000f\u001fÈ\u000f\u001fÈ\u000f\u001fÈ\u000fä\u0007È\u000fä\u0007È\u000fä\u0007È\u000fä\u0007È\u000fä\u0007È\u000fä\u0007È\u000fä\u0007È\u000fä\u0007ò\u0003ä\u0007ò\u0003ä\u0007ò\u0003ä\u0007ò\u0003ä\u0007ò\u0003ä\u0007ò\u0003ä\u0007ò\u0003ä\u0007ò\u0003ä\u0007ò\u0003ù\u0001ò\u0003ù\u0001ò\u0003ù\u0001ò\u0003ù\u0001ò\u0003ù\u0001ò\u0003ù\u0001ò\u0003ù\u0001ò\u0003ùA‰û?\u0018thÜÎ\u001fb¸\u0000\u0000\u0000\u0000IEND®B`‚"

/***/ }),
/* 66 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var __awaiter = (this && this.__awaiter) || function (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());
    });
};
var __generator = (this && this.__generator) || function (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 };
    }
};
var __read = (this && this.__read) || function (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;
};
var __spread = (this && this.__spread) || function () {
    for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
    return ar;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.CommentModule = exports.reactionGifs = void 0;
var ramda_1 = __webpack_require__(4);
var lodash_debounce_1 = __importDefault(__webpack_require__(21));
var common_1 = __webpack_require__(0);
var styles_1 = __webpack_require__(3);
var RuqESModule_1 = __webpack_require__(6);
var selectors_1 = __webpack_require__(5);
var renderMarkdown_1 = __webpack_require__(22);
var SaveModule_1 = __webpack_require__(13);
var ImageUploadButton_1 = __webpack_require__(23);
var genCommentId = function (x) { return "" + styles_1.clsPrefix + x; };
var processedCommentBoxMarkCls = genCommentId('processed-comment-box');
var textAreaIdDataName = 'textareaId';
exports.reactionGifs = [
    {
        name: "clapping",
        url: "https://i.ibb.co/sbkkygZ/clapping.gif",
    },
    {
        name: "laughing",
        url: "https://i.ibb.co/DYn0Gb8/laughing.gif",
    },
    {
        name: "lifting",
        url: "https://i.ibb.co/wy0H7gG/lifting.gif",
    },
    {
        name: "sad",
        url: "https://i.ibb.co/TvNKmDF/sad.gif",
    },
    {
        name: "angry",
        url: "https://i.ibb.co/r48rMF3/scowling.gif",
    },
    {
        name: "smug",
        url: "https://i.ibb.co/TqMz92L/smug.gif",
    },
    {
        name: "shocked",
        url: "https://i.ibb.co/J2XYxnC/surprised.gif",
    },
    {
        name: "weak",
        url: "https://i.ibb.co/H43XwjT/weak.gif",
    },
    {
        name: "shrug",
        url: "https://i.ibb.co/PY4Nf8s/what.gif",
    },
    {
        name: "giving crown",
        url: "https://i.ibb.co/VvKsWs4/giving-crown.gif",
    },
];
var popupFadeDuration = 200;
var previewDebounceTime = 200;
var CommentModule = /** @class */ (function (_super) {
    __extends(CommentModule, _super);
    function CommentModule() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.setupReactionGifs = function () {
            var _a;
            var processComment = function (_, rawEl) {
                var el = $(rawEl);
                if (el.hasClass(styles_1.commentReactionGifIcoProcessedCls)) {
                    return;
                }
                el.addClass(styles_1.commentReactionGifIcoProcessedCls);
                var replyEl = selectors_1.isReplyToPost(el) ? el : selectors_1.getCommentReplyToPart(el);
                if (!replyEl) {
                    common_1.printError('CommentModule', 'setupReactionGifs', 'failed to locate reply element', { el: el, replyEl: replyEl });
                    return;
                }
                var textEl = selectors_1.getReplyTextArea(replyEl);
                if (!textEl.length) {
                    common_1.printError('setupReactionGifs', 'onSuccess', 'failed to get textEl');
                    return;
                }
                var lastActionButton = replyEl.find('.comment-format label').last();
                var btn = common_1.createSmallCommentButton('');
                btn.append(common_1.createReactionGifIco());
                lastActionButton.after(btn);
                btn.on('click', function (evt) {
                    var offset = btn.offset();
                    var textareaId = textEl.prop('id');
                    if (!textareaId) {
                        common_1.printError('setupReactionGifs', 'button click handler', 'missing text area id');
                        return;
                    }
                    _this.openReactionGifPopUp(evt, offset); // may get created at this point
                    _this.getReactionGifPopUpEl().data(textAreaIdDataName, textareaId);
                });
            };
            common_1.getValidComments().each(processComment);
            (_a = selectors_1.getReplyToPost()) === null || _a === void 0 ? void 0 : _a.each(processComment);
        };
        _this.genRevealButtonClickHandler = function (el) { return function (evt) { return __awaiter(_this, void 0, void 0, function () {
            var btnEl, fail, commentId, resp, e_1, parsed, commentFromResp, info, barEl, textEl, boxEl;
            return __generator(this, function (_a) {
                switch (_a.label) {
                    case 0:
                        btnEl = $(evt.target);
                        btnEl.prop('disabled', true).addClass('disabled').text('⏳');
                        fail = function (errorText) {
                            var args = [];
                            for (var _i = 1; _i < arguments.length; _i++) {
                                args[_i - 1] = arguments[_i];
                            }
                            common_1.printError.apply(void 0, __spread(['genRevealButtonClickHandler', errorText], args));
                            var errorEl = $('<div>')
                                .addClass(styles_1.errorTextCls)
                                .append($('<span>').text(errorText));
                            el.append(errorEl);
                        };
                        commentId = common_1.getCommentId(el);
                        if (!commentId) {
                            fail('Failed to get comment id', el);
                            return [2 /*return*/];
                        }
                        _a.label = 1;
                    case 1:
                        _a.trys.push([1, 3, , 4]);
                        return [4 /*yield*/, common_1.xhrP({
                                method: 'GET',
                                url: "https://ruqqus.com/+x/post/x/x/" + commentId,
                                anonymous: true,
                            })];
                    case 2:
                        resp = _a.sent();
                        return [3 /*break*/, 4];
                    case 3:
                        e_1 = _a.sent();
                        fail('Request failed', el, e_1);
                        return [2 /*return*/];
                    case 4:
                        common_1.debugLog('genRevealButtonClickHandler', 'got response', resp);
                        parsed = $('<div>').append($(resp.response));
                        commentFromResp = parsed.find("#comment-" + commentId + "-only");
                        if (!commentFromResp.length) {
                            fail('Failed to extract comment', { el: el, resp: resp, parsed: parsed });
                            return [2 /*return*/];
                        }
                        info = common_1.extractCommentInfo(commentFromResp);
                        barEl = $('<div>')
                            .append("@" + info.author)
                            .append(' · ')
                            .append($('<a>').text('link').prop('href', resp.finalUrl).prop('target', '_blank'));
                        textEl = $('<div>').html(info.text);
                        boxEl = $('<div>').append(barEl).append(textEl);
                        el.append(boxEl);
                        btnEl.remove();
                        return [2 /*return*/];
                }
            });
        }); }; };
        return _this;
    }
    CommentModule.prototype.setupCtrlEnterToSend = function () {
        $('.comment-box')
            .filter(function (_, el) { return !$(el).hasClass(processedCommentBoxMarkCls); })
            .keydown(function (evt) {
            if (evt.key === 'Enter' && (evt.ctrlKey || evt.metaKey)) {
                common_1.debugLog('setupCtrlEnterToSend', 'CTRL+Enter detected', evt);
                var btn = $(evt.target).parent().find('a:contains(Comment)');
                if (btn.length > 1) {
                    common_1.printError('setupCtrlEnterToSend', 'found multiple send buttons', btn);
                }
                else if (btn.length === 0) {
                    common_1.printError('setupCtrlEnterToSend', 'no send button found', btn);
                }
                else {
                    common_1.debugLog('setupCtrlEnterToSend', 'clicking on send button', btn);
                    btn.click();
                }
            }
        })
            .addClass(processedCommentBoxMarkCls);
    };
    ;
    CommentModule.prototype.setupBiggerFoldButtons = function () {
        $('body').addClass(styles_1.commentBiggerFoldButtonsCls);
    };
    CommentModule.prototype.setupUpDownVotesAsText = function () {
        selectors_1.getComments()
            .filter(function (_, rawEl) { return !$(rawEl).hasClass(styles_1.commentUpDownVotesAsTextProcessedCls); })
            .each(function (_, rawEl) {
            var el = $(rawEl);
            el.addClass(styles_1.commentUpDownVotesAsTextProcessedCls);
            var pointsEl = el.find('.points');
            var _a = __read(common_1.parseUpDownCounts(pointsEl.data('originalTitle')), 2), upCount = _a[0], downCount = _a[1];
            var counters = common_1.genTextUpDownCounters(upCount, downCount);
            el.find('.user-info .time-stamp').after(counters);
        });
    };
    CommentModule.prototype.setupOneCommentPreview = function (cfg, textArea, insertPreviewBox) {
        if (textArea.hasClass(styles_1.commentPreviewAppliedCls)) {
            return;
        }
        textArea.addClass(styles_1.commentPreviewAppliedCls);
        var previewBox = $('<div>').addClass(styles_1.commentPreviewCls);
        if (cfg.post.improvedTableStyles) {
            previewBox.addClass(styles_1.improvedTableCls);
        }
        var inputChangedHandler = lodash_debounce_1.default(function (evt) {
            var el = $(evt.target);
            previewBox.html(renderMarkdown_1.renderMarkdown(String(el.val())));
        }, previewDebounceTime);
        textArea.on('input', inputChangedHandler);
        insertPreviewBox(previewBox);
    };
    CommentModule.prototype.setupPreview = function (cfg) {
        var _this = this;
        var replyToPostEl = selectors_1.getReplyToPost();
        if ((replyToPostEl === null || replyToPostEl === void 0 ? void 0 : replyToPostEl.length) !== 1) {
            common_1.debugLog('CommentModule', 'setupPreview', 'failed to locate reply to post element', replyToPostEl);
        }
        else {
            this.setupOneCommentPreview(cfg, $('textarea[name="body"]', replyToPostEl), function (previewBox) { return replyToPostEl.append(previewBox); });
        }
        if (SaveModule_1.SaveModule.isOnSavedPage()) {
            return;
        }
        common_1.getValidComments().each(function (_, rawEl) {
            var el = $(rawEl);
            var replyEl = selectors_1.getCommentReplyToPart(el);
            if (!replyEl) {
                common_1.printError('CommentModule', 'setupPreview', 'failed to locate reply element', { el: el, replyEl: replyEl });
                return;
            }
            _this.setupOneCommentPreview(cfg, $('textarea[name="body"]', replyEl), function (previewBox) { return replyEl.find('form').after(previewBox); });
        });
    };
    CommentModule.prototype.setupAutoCollapsingOfCommentsByRegex = function (cfg) {
        common_1.debugLog('setupAutoCollapsingOfCommentsByRegex', cfg.comment);
        var strRegex = cfg.comment.autoCollapseCommentsRegex;
        if (!strRegex) {
            return;
        }
        var regex;
        try {
            regex = new RegExp(strRegex, 'isu');
        }
        catch (e) {
            common_1.printError('setupAutoCollapsingOfCommentsByRegex', 'invalid regex', e);
            return;
        }
        selectors_1.getComments().filter(function (_, rawEl) { return !$(rawEl).hasClass(styles_1.commentCollapseByRegexProcessedCls); }).each(function (_, rawEl) {
            var el = $(rawEl);
            el.addClass(styles_1.commentCollapseByRegexProcessedCls);
            var text = el.find('.comment-text').text();
            if (regex.test(text)) {
                el.parent().parent().addClass('collapsed');
            }
        });
    };
    CommentModule.prototype.insertMarkdownImageToTextArea = function (textEl, url) {
        this.insertTextToTextArea(textEl, "![](" + url + ")");
    };
    CommentModule.prototype.insertTextToTextArea = function (textEl, text) {
        var insertPos = textEl.prop('selectionStart') || 0;
        var oldText = String(textEl.val());
        var _a = __read(ramda_1.splitAt(insertPos, oldText), 2), bef = _a[0], aft = _a[1];
        var newText = bef + text + aft;
        common_1.debugLog("insertTextToTextArea", { insertPos: insertPos, oldText: oldText, bef: bef, aft: aft, text: text, newText: newText, textEl: textEl });
        textEl.val(newText).trigger('change').trigger('input');
    };
    CommentModule.prototype.setupImageUpload = function (cfg) {
        var _this = this;
        var _a;
        common_1.debugLog('setupImageUpload', cfg.comment, cfg.external);
        var processComment = function (_, rawEl) {
            var el = $(rawEl);
            if (el.hasClass(styles_1.commentImageUploadProcessedCls)) {
                return;
            }
            el.addClass(styles_1.commentImageUploadProcessedCls);
            var replyEl = selectors_1.isReplyToPost(el) ? el : selectors_1.getCommentReplyToPart(el);
            if (!replyEl) {
                common_1.printError('CommentModule', 'setupImageUpload', 'failed to locate reply element', { el: el, replyEl: replyEl });
                return;
            }
            var lastActionButton = replyEl.find('.comment-format label').last();
            var onSuccess = function (url) {
                common_1.debugLog('setupImageUpload', 'onSuccess', url, cfg);
                var textEl = selectors_1.getReplyTextArea(replyEl);
                if (!textEl.length) {
                    common_1.printError('setupImageUpload', 'onSuccess', 'failed to get textEl');
                    return;
                }
                _this.insertMarkdownImageToTextArea(textEl, url);
            };
            var btnEl = ImageUploadButton_1.ImageUploadButton.genUploadButton('COMMENT', cfg, onSuccess);
            lastActionButton.after(btnEl);
        };
        common_1.getValidComments().each(processComment);
        (_a = selectors_1.getReplyToPost()) === null || _a === void 0 ? void 0 : _a.each(processComment);
    };
    CommentModule.prototype.reactionGifCommentClicked = function (eventTarget) {
        if (!eventTarget.closest("." + styles_1.reactionGifPopUpCls).length) {
            this.closeReactionGifPopUp();
        }
    };
    CommentModule.prototype.getReactionGifPopUpEl = function () {
        return common_1.$c(styles_1.reactionGifPopUpCls);
    };
    CommentModule.prototype.closeReactionGifPopUp = function () {
        this.getReactionGifPopUpEl().fadeOut(popupFadeDuration);
    };
    CommentModule.prototype.openReactionGifPopUp = function (evt, btnOffset) {
        if (!this.getReactionGifPopUpEl().length) {
            this.createReactionGifsPopUp();
        }
        var popUp = this.getReactionGifPopUpEl();
        var popUpHeight = popUp.height();
        popUp.css({
            top: Math.round((btnOffset.top - popUpHeight - 10)) + 'px',
            left: Math.round(btnOffset.left) + 'px',
        });
        popUp.fadeIn(popupFadeDuration);
        common_1.preventDefaults(evt);
    };
    CommentModule.prototype.createReactionGifsPopUp = function () {
        var _this = this;
        var body = $('body');
        var popUp = $('<div>').addClass(styles_1.reactionGifPopUpCls);
        var gifs = exports.reactionGifs.map(function (gif) {
            return common_1.createReactionGif(gif.name, gif.url)
                .on('click', function () {
                var textareaId = _this.getReactionGifPopUpEl().data(textAreaIdDataName);
                if (!textareaId) {
                    common_1.printError('createReactionGifsPopUp', 'missing text area id');
                    return;
                }
                var textArea = common_1.$i(textareaId);
                _this.insertMarkdownImageToTextArea(textArea, gif.url);
                _this.closeReactionGifPopUp();
            });
        });
        body.append(popUp);
        popUp.prepend(gifs).hide();
        body.on('click', function (event) { _this.reactionGifCommentClicked($(event.target)); });
    };
    CommentModule.prototype.setupRevealBlockedComment = function (cfg) {
        var _this = this;
        var process = function (_, rawEl) {
            var el = $(rawEl);
            if (el.hasClass(styles_1.commentRevealBlockedProcessedCls)) {
                return;
            }
            el.addClass(styles_1.commentRevealBlockedProcessedCls);
            var btn = common_1.genJsAnchor().addClass('btn btn-secondary').text('Reveal').prepend(common_1.createRuqesMark()).on('click', _this.genRevealButtonClickHandler(el));
            el.append(btn);
        };
        common_1.getBlockedComments().each(process);
    };
    CommentModule.prototype.setup = function (args, cfg) {
        return __awaiter(this, void 0, void 0, function () {
            var commentCfg;
            return __generator(this, function (_a) {
                commentCfg = cfg.comment;
                if (!ramda_1.prop('silent', args)) {
                    common_1.debugLog('setupComment', commentCfg);
                }
                if (!this.firstSetupRunFinished) {
                    if (commentCfg.ctrlEnterToSend) {
                        setInterval(this.setupCtrlEnterToSend, 1000);
                    }
                    if (commentCfg.biggerFoldButtons) {
                        this.setupBiggerFoldButtons();
                    }
                }
                if (commentCfg.upDownVotesAsText) {
                    this.setupUpDownVotesAsText();
                }
                if (commentCfg.preview) {
                    this.setupPreview(cfg);
                }
                if (commentCfg.hideTipButton) {
                    selectors_1.getComments().find('[data-target="#tipModal"]').parent().css('display', 'none');
                }
                this.setupAutoCollapsingOfCommentsByRegex(cfg);
                if (commentCfg.imageUpload && cfg.external.imgbbKey) {
                    this.setupImageUpload(cfg);
                }
                if (commentCfg.reactionGifs) {
                    this.setupReactionGifs();
                }
                if (commentCfg.revealBlocked) {
                    this.setupRevealBlockedComment(cfg);
                }
                return [2 /*return*/];
            });
        });
    };
    CommentModule.prototype.onContentChange = function (args, cfg) {
        return __awaiter(this, void 0, void 0, function () {
            return __generator(this, function (_a) {
                switch (_a.label) {
                    case 0: return [4 /*yield*/, this.setup(args, cfg)];
                    case 1:
                        _a.sent();
                        return [2 /*return*/];
                }
            });
        });
    };
    return CommentModule;
}(RuqESModule_1.RuqESModule));
exports.CommentModule = CommentModule;


/***/ }),
/* 67 */
/***/ (function(module, exports, __webpack_require__) {

/**
 * marked - a markdown parser
 * Copyright (c) 2011-2020, Christopher Jeffrey. (MIT Licensed)
 * https://github.com/markedjs/marked
 */

/**
 * DO NOT EDIT THIS FILE
 * The code in this file is generated from files in ./src/
 */

(function (global, factory) {
   true ? module.exports = factory() :
  undefined;
}(this, (function () { 'use strict';

  function _defineProperties(target, props) {
    for (var i = 0; i < props.length; i++) {
      var descriptor = props[i];
      descriptor.enumerable = descriptor.enumerable || false;
      descriptor.configurable = true;
      if ("value" in descriptor) descriptor.writable = true;
      Object.defineProperty(target, descriptor.key, descriptor);
    }
  }

  function _createClass(Constructor, protoProps, staticProps) {
    if (protoProps) _defineProperties(Constructor.prototype, protoProps);
    if (staticProps) _defineProperties(Constructor, staticProps);
    return Constructor;
  }

  function _unsupportedIterableToArray(o, minLen) {
    if (!o) return;
    if (typeof o === "string") return _arrayLikeToArray(o, minLen);
    var n = Object.prototype.toString.call(o).slice(8, -1);
    if (n === "Object" && o.constructor) n = o.constructor.name;
    if (n === "Map" || n === "Set") return Array.from(o);
    if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
  }

  function _arrayLikeToArray(arr, len) {
    if (len == null || len > arr.length) len = arr.length;

    for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];

    return arr2;
  }

  function _createForOfIteratorHelperLoose(o, allowArrayLike) {
    var it;

    if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) {
      if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
        if (it) o = it;
        var i = 0;
        return function () {
          if (i >= o.length) return {
            done: true
          };
          return {
            done: false,
            value: o[i++]
          };
        };
      }

      throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
    }

    it = o[Symbol.iterator]();
    return it.next.bind(it);
  }

  function createCommonjsModule(fn, module) {
  	return module = { exports: {} }, fn(module, module.exports), module.exports;
  }

  var defaults = createCommonjsModule(function (module) {
    function getDefaults() {
      return {
        baseUrl: null,
        breaks: false,
        gfm: true,
        headerIds: true,
        headerPrefix: '',
        highlight: null,
        langPrefix: 'language-',
        mangle: true,
        pedantic: false,
        renderer: null,
        sanitize: false,
        sanitizer: null,
        silent: false,
        smartLists: false,
        smartypants: false,
        tokenizer: null,
        walkTokens: null,
        xhtml: false
      };
    }

    function changeDefaults(newDefaults) {
      module.exports.defaults = newDefaults;
    }

    module.exports = {
      defaults: getDefaults(),
      getDefaults: getDefaults,
      changeDefaults: changeDefaults
    };
  });
  var defaults_1 = defaults.defaults;
  var defaults_2 = defaults.getDefaults;
  var defaults_3 = defaults.changeDefaults;

  /**
   * Helpers
   */
  var escapeTest = /[&<>"']/;
  var escapeReplace = /[&<>"']/g;
  var escapeTestNoEncode = /[<>"']|&(?!#?\w+;)/;
  var escapeReplaceNoEncode = /[<>"']|&(?!#?\w+;)/g;
  var escapeReplacements = {
    '&': '&amp;',
    '<': '&lt;',
    '>': '&gt;',
    '"': '&quot;',
    "'": '&#39;'
  };

  var getEscapeReplacement = function getEscapeReplacement(ch) {
    return escapeReplacements[ch];
  };

  function escape(html, encode) {
    if (encode) {
      if (escapeTest.test(html)) {
        return html.replace(escapeReplace, getEscapeReplacement);
      }
    } else {
      if (escapeTestNoEncode.test(html)) {
        return html.replace(escapeReplaceNoEncode, getEscapeReplacement);
      }
    }

    return html;
  }

  var unescapeTest = /&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;

  function unescape(html) {
    // explicitly match decimal, hex, and named HTML entities
    return html.replace(unescapeTest, function (_, n) {
      n = n.toLowerCase();
      if (n === 'colon') return ':';

      if (n.charAt(0) === '#') {
        return n.charAt(1) === 'x' ? String.fromCharCode(parseInt(n.substring(2), 16)) : String.fromCharCode(+n.substring(1));
      }

      return '';
    });
  }

  var caret = /(^|[^\[])\^/g;

  function edit(regex, opt) {
    regex = regex.source || regex;
    opt = opt || '';
    var obj = {
      replace: function replace(name, val) {
        val = val.source || val;
        val = val.replace(caret, '$1');
        regex = regex.replace(name, val);
        return obj;
      },
      getRegex: function getRegex() {
        return new RegExp(regex, opt);
      }
    };
    return obj;
  }

  var nonWordAndColonTest = /[^\w:]/g;
  var originIndependentUrl = /^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;

  function cleanUrl(sanitize, base, href) {
    if (sanitize) {
      var prot;

      try {
        prot = decodeURIComponent(unescape(href)).replace(nonWordAndColonTest, '').toLowerCase();
      } catch (e) {
        return null;
      }

      if (prot.indexOf('javascript:') === 0 || prot.indexOf('vbscript:') === 0 || prot.indexOf('data:') === 0) {
        return null;
      }
    }

    if (base && !originIndependentUrl.test(href)) {
      href = resolveUrl(base, href);
    }

    try {
      href = encodeURI(href).replace(/%25/g, '%');
    } catch (e) {
      return null;
    }

    return href;
  }

  var baseUrls = {};
  var justDomain = /^[^:]+:\/*[^/]*$/;
  var protocol = /^([^:]+:)[\s\S]*$/;
  var domain = /^([^:]+:\/*[^/]*)[\s\S]*$/;

  function resolveUrl(base, href) {
    if (!baseUrls[' ' + base]) {
      // we can ignore everything in base after the last slash of its path component,
      // but we might need to add _that_
      // https://tools.ietf.org/html/rfc3986#section-3
      if (justDomain.test(base)) {
        baseUrls[' ' + base] = base + '/';
      } else {
        baseUrls[' ' + base] = rtrim(base, '/', true);
      }
    }

    base = baseUrls[' ' + base];
    var relativeBase = base.indexOf(':') === -1;

    if (href.substring(0, 2) === '//') {
      if (relativeBase) {
        return href;
      }

      return base.replace(protocol, '$1') + href;
    } else if (href.charAt(0) === '/') {
      if (relativeBase) {
        return href;
      }

      return base.replace(domain, '$1') + href;
    } else {
      return base + href;
    }
  }

  var noopTest = {
    exec: function noopTest() {}
  };

  function merge(obj) {
    var i = 1,
        target,
        key;

    for (; i < arguments.length; i++) {
      target = arguments[i];

      for (key in target) {
        if (Object.prototype.hasOwnProperty.call(target, key)) {
          obj[key] = target[key];
        }
      }
    }

    return obj;
  }

  function splitCells(tableRow, count) {
    // ensure that every cell-delimiting pipe has a space
    // before it to distinguish it from an escaped pipe
    var row = tableRow.replace(/\|/g, function (match, offset, str) {
      var escaped = false,
          curr = offset;

      while (--curr >= 0 && str[curr] === '\\') {
        escaped = !escaped;
      }

      if (escaped) {
        // odd number of slashes means | is escaped
        // so we leave it alone
        return '|';
      } else {
        // add space before unescaped |
        return ' |';
      }
    }),
        cells = row.split(/ \|/);
    var i = 0;

    if (cells.length > count) {
      cells.splice(count);
    } else {
      while (cells.length < count) {
        cells.push('');
      }
    }

    for (; i < cells.length; i++) {
      // leading or trailing whitespace is ignored per the gfm spec
      cells[i] = cells[i].trim().replace(/\\\|/g, '|');
    }

    return cells;
  } // Remove trailing 'c's. Equivalent to str.replace(/c*$/, '').
  // /c*$/ is vulnerable to REDOS.
  // invert: Remove suffix of non-c chars instead. Default falsey.


  function rtrim(str, c, invert) {
    var l = str.length;

    if (l === 0) {
      return '';
    } // Length of suffix matching the invert condition.


    var suffLen = 0; // Step left until we fail to match the invert condition.

    while (suffLen < l) {
      var currChar = str.charAt(l - suffLen - 1);

      if (currChar === c && !invert) {
        suffLen++;
      } else if (currChar !== c && invert) {
        suffLen++;
      } else {
        break;
      }
    }

    return str.substr(0, l - suffLen);
  }

  function findClosingBracket(str, b) {
    if (str.indexOf(b[1]) === -1) {
      return -1;
    }

    var l = str.length;
    var level = 0,
        i = 0;

    for (; i < l; i++) {
      if (str[i] === '\\') {
        i++;
      } else if (str[i] === b[0]) {
        level++;
      } else if (str[i] === b[1]) {
        level--;

        if (level < 0) {
          return i;
        }
      }
    }

    return -1;
  }

  function checkSanitizeDeprecation(opt) {
    if (opt && opt.sanitize && !opt.silent) {
      console.warn('marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options');
    }
  }

  var helpers = {
    escape: escape,
    unescape: unescape,
    edit: edit,
    cleanUrl: cleanUrl,
    resolveUrl: resolveUrl,
    noopTest: noopTest,
    merge: merge,
    splitCells: splitCells,
    rtrim: rtrim,
    findClosingBracket: findClosingBracket,
    checkSanitizeDeprecation: checkSanitizeDeprecation
  };

  var defaults$1 = defaults.defaults;
  var rtrim$1 = helpers.rtrim,
      splitCells$1 = helpers.splitCells,
      _escape = helpers.escape,
      findClosingBracket$1 = helpers.findClosingBracket;

  function outputLink(cap, link, raw) {
    var href = link.href;
    var title = link.title ? _escape(link.title) : null;
    var text = cap[1].replace(/\\([\[\]])/g, '$1');

    if (cap[0].charAt(0) !== '!') {
      return {
        type: 'link',
        raw: raw,
        href: href,
        title: title,
        text: text
      };
    } else {
      return {
        type: 'image',
        raw: raw,
        href: href,
        title: title,
        text: _escape(text)
      };
    }
  }

  function indentCodeCompensation(raw, text) {
    var matchIndentToCode = raw.match(/^(\s+)(?:```)/);

    if (matchIndentToCode === null) {
      return text;
    }

    var indentToCode = matchIndentToCode[1];
    return text.split('\n').map(function (node) {
      var matchIndentInNode = node.match(/^\s+/);

      if (matchIndentInNode === null) {
        return node;
      }

      var indentInNode = matchIndentInNode[0];

      if (indentInNode.length >= indentToCode.length) {
        return node.slice(indentToCode.length);
      }

      return node;
    }).join('\n');
  }
  /**
   * Tokenizer
   */


  var Tokenizer_1 = /*#__PURE__*/function () {
    function Tokenizer(options) {
      this.options = options || defaults$1;
    }

    var _proto = Tokenizer.prototype;

    _proto.space = function space(src) {
      var cap = this.rules.block.newline.exec(src);

      if (cap) {
        if (cap[0].length > 1) {
          return {
            type: 'space',
            raw: cap[0]
          };
        }

        return {
          raw: '\n'
        };
      }
    };

    _proto.code = function code(src, tokens) {
      var cap = this.rules.block.code.exec(src);

      if (cap) {
        var lastToken = tokens[tokens.length - 1]; // An indented code block cannot interrupt a paragraph.

        if (lastToken && lastToken.type === 'paragraph') {
          return {
            raw: cap[0],
            text: cap[0].trimRight()
          };
        }

        var text = cap[0].replace(/^ {4}/gm, '');
        return {
          type: 'code',
          raw: cap[0],
          codeBlockStyle: 'indented',
          text: !this.options.pedantic ? rtrim$1(text, '\n') : text
        };
      }
    };

    _proto.fences = function fences(src) {
      var cap = this.rules.block.fences.exec(src);

      if (cap) {
        var raw = cap[0];
        var text = indentCodeCompensation(raw, cap[3] || '');
        return {
          type: 'code',
          raw: raw,
          lang: cap[2] ? cap[2].trim() : cap[2],
          text: text
        };
      }
    };

    _proto.heading = function heading(src) {
      var cap = this.rules.block.heading.exec(src);

      if (cap) {
        return {
          type: 'heading',
          raw: cap[0],
          depth: cap[1].length,
          text: cap[2]
        };
      }
    };

    _proto.nptable = function nptable(src) {
      var cap = this.rules.block.nptable.exec(src);

      if (cap) {
        var item = {
          type: 'table',
          header: splitCells$1(cap[1].replace(/^ *| *\| *$/g, '')),
          align: cap[2].replace(/^ *|\| *$/g, '').split(/ *\| */),
          cells: cap[3] ? cap[3].replace(/\n$/, '').split('\n') : [],
          raw: cap[0]
        };

        if (item.header.length === item.align.length) {
          var l = item.align.length;
          var i;

          for (i = 0; i < l; i++) {
            if (/^ *-+: *$/.test(item.align[i])) {
              item.align[i] = 'right';
            } else if (/^ *:-+: *$/.test(item.align[i])) {
              item.align[i] = 'center';
            } else if (/^ *:-+ *$/.test(item.align[i])) {
              item.align[i] = 'left';
            } else {
              item.align[i] = null;
            }
          }

          l = item.cells.length;

          for (i = 0; i < l; i++) {
            item.cells[i] = splitCells$1(item.cells[i], item.header.length);
          }

          return item;
        }
      }
    };

    _proto.hr = function hr(src) {
      var cap = this.rules.block.hr.exec(src);

      if (cap) {
        return {
          type: 'hr',
          raw: cap[0]
        };
      }
    };

    _proto.blockquote = function blockquote(src) {
      var cap = this.rules.block.blockquote.exec(src);

      if (cap) {
        var text = cap[0].replace(/^ *> ?/gm, '');
        return {
          type: 'blockquote',
          raw: cap[0],
          text: text
        };
      }
    };

    _proto.list = function list(src) {
      var cap = this.rules.block.list.exec(src);

      if (cap) {
        var raw = cap[0];
        var bull = cap[2];
        var isordered = bull.length > 1;
        var isparen = bull[bull.length - 1] === ')';
        var list = {
          type: 'list',
          raw: raw,
          ordered: isordered,
          start: isordered ? +bull.slice(0, -1) : '',
          loose: false,
          items: []
        }; // Get each top-level item.

        var itemMatch = cap[0].match(this.rules.block.item);
        var next = false,
            item,
            space,
            b,
            addBack,
            loose,
            istask,
            ischecked;
        var l = itemMatch.length;

        for (var i = 0; i < l; i++) {
          item = itemMatch[i];
          raw = item; // Remove the list item's bullet
          // so it is seen as the next token.

          space = item.length;
          item = item.replace(/^ *([*+-]|\d+[.)]) */, ''); // Outdent whatever the
          // list item contains. Hacky.

          if (~item.indexOf('\n ')) {
            space -= item.length;
            item = !this.options.pedantic ? item.replace(new RegExp('^ {1,' + space + '}', 'gm'), '') : item.replace(/^ {1,4}/gm, '');
          } // Determine whether the next list item belongs here.
          // Backpedal if it does not belong in this list.


          if (i !== l - 1) {
            b = this.rules.block.bullet.exec(itemMatch[i + 1])[0];

            if (isordered ? b.length === 1 || !isparen && b[b.length - 1] === ')' : b.length > 1 || this.options.smartLists && b !== bull) {
              addBack = itemMatch.slice(i + 1).join('\n');
              list.raw = list.raw.substring(0, list.raw.length - addBack.length);
              i = l - 1;
            }
          } // Determine whether item is loose or not.
          // Use: /(^|\n)(?! )[^\n]+\n\n(?!\s*$)/
          // for discount behavior.


          loose = next || /\n\n(?!\s*$)/.test(item);

          if (i !== l - 1) {
            next = item.charAt(item.length - 1) === '\n';
            if (!loose) loose = next;
          }

          if (loose) {
            list.loose = true;
          } // Check for task list items


          istask = /^\[[ xX]\] /.test(item);
          ischecked = undefined;

          if (istask) {
            ischecked = item[1] !== ' ';
            item = item.replace(/^\[[ xX]\] +/, '');
          }

          list.items.push({
            type: 'list_item',
            raw: raw,
            task: istask,
            checked: ischecked,
            loose: loose,
            text: item
          });
        }

        return list;
      }
    };

    _proto.html = function html(src) {
      var cap = this.rules.block.html.exec(src);

      if (cap) {
        return {
          type: this.options.sanitize ? 'paragraph' : 'html',
          raw: cap[0],
          pre: !this.options.sanitizer && (cap[1] === 'pre' || cap[1] === 'script' || cap[1] === 'style'),
          text: this.options.sanitize ? this.options.sanitizer ? this.options.sanitizer(cap[0]) : _escape(cap[0]) : cap[0]
        };
      }
    };

    _proto.def = function def(src) {
      var cap = this.rules.block.def.exec(src);

      if (cap) {
        if (cap[3]) cap[3] = cap[3].substring(1, cap[3].length - 1);
        var tag = cap[1].toLowerCase().replace(/\s+/g, ' ');
        return {
          tag: tag,
          raw: cap[0],
          href: cap[2],
          title: cap[3]
        };
      }
    };

    _proto.table = function table(src) {
      var cap = this.rules.block.table.exec(src);

      if (cap) {
        var item = {
          type: 'table',
          header: splitCells$1(cap[1].replace(/^ *| *\| *$/g, '')),
          align: cap[2].replace(/^ *|\| *$/g, '').split(/ *\| */),
          cells: cap[3] ? cap[3].replace(/\n$/, '').split('\n') : []
        };

        if (item.header.length === item.align.length) {
          item.raw = cap[0];
          var l = item.align.length;
          var i;

          for (i = 0; i < l; i++) {
            if (/^ *-+: *$/.test(item.align[i])) {
              item.align[i] = 'right';
            } else if (/^ *:-+: *$/.test(item.align[i])) {
              item.align[i] = 'center';
            } else if (/^ *:-+ *$/.test(item.align[i])) {
              item.align[i] = 'left';
            } else {
              item.align[i] = null;
            }
          }

          l = item.cells.length;

          for (i = 0; i < l; i++) {
            item.cells[i] = splitCells$1(item.cells[i].replace(/^ *\| *| *\| *$/g, ''), item.header.length);
          }

          return item;
        }
      }
    };

    _proto.lheading = function lheading(src) {
      var cap = this.rules.block.lheading.exec(src);

      if (cap) {
        return {
          type: 'heading',
          raw: cap[0],
          depth: cap[2].charAt(0) === '=' ? 1 : 2,
          text: cap[1]
        };
      }
    };

    _proto.paragraph = function paragraph(src) {
      var cap = this.rules.block.paragraph.exec(src);

      if (cap) {
        return {
          type: 'paragraph',
          raw: cap[0],
          text: cap[1].charAt(cap[1].length - 1) === '\n' ? cap[1].slice(0, -1) : cap[1]
        };
      }
    };

    _proto.text = function text(src, tokens) {
      var cap = this.rules.block.text.exec(src);

      if (cap) {
        var lastToken = tokens[tokens.length - 1];

        if (lastToken && lastToken.type === 'text') {
          return {
            raw: cap[0],
            text: cap[0]
          };
        }

        return {
          type: 'text',
          raw: cap[0],
          text: cap[0]
        };
      }
    };

    _proto.escape = function escape(src) {
      var cap = this.rules.inline.escape.exec(src);

      if (cap) {
        return {
          type: 'escape',
          raw: cap[0],
          text: _escape(cap[1])
        };
      }
    };

    _proto.tag = function tag(src, inLink, inRawBlock) {
      var cap = this.rules.inline.tag.exec(src);

      if (cap) {
        if (!inLink && /^<a /i.test(cap[0])) {
          inLink = true;
        } else if (inLink && /^<\/a>/i.test(cap[0])) {
          inLink = false;
        }

        if (!inRawBlock && /^<(pre|code|kbd|script)(\s|>)/i.test(cap[0])) {
          inRawBlock = true;
        } else if (inRawBlock && /^<\/(pre|code|kbd|script)(\s|>)/i.test(cap[0])) {
          inRawBlock = false;
        }

        return {
          type: this.options.sanitize ? 'text' : 'html',
          raw: cap[0],
          inLink: inLink,
          inRawBlock: inRawBlock,
          text: this.options.sanitize ? this.options.sanitizer ? this.options.sanitizer(cap[0]) : _escape(cap[0]) : cap[0]
        };
      }
    };

    _proto.link = function link(src) {
      var cap = this.rules.inline.link.exec(src);

      if (cap) {
        var lastParenIndex = findClosingBracket$1(cap[2], '()');

        if (lastParenIndex > -1) {
          var start = cap[0].indexOf('!') === 0 ? 5 : 4;
          var linkLen = start + cap[1].length + lastParenIndex;
          cap[2] = cap[2].substring(0, lastParenIndex);
          cap[0] = cap[0].substring(0, linkLen).trim();
          cap[3] = '';
        }

        var href = cap[2];
        var title = '';

        if (this.options.pedantic) {
          var link = /^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(href);

          if (link) {
            href = link[1];
            title = link[3];
          } else {
            title = '';
          }
        } else {
          title = cap[3] ? cap[3].slice(1, -1) : '';
        }

        href = href.trim().replace(/^<([\s\S]*)>$/, '$1');
        var token = outputLink(cap, {
          href: href ? href.replace(this.rules.inline._escapes, '$1') : href,
          title: title ? title.replace(this.rules.inline._escapes, '$1') : title
        }, cap[0]);
        return token;
      }
    };

    _proto.reflink = function reflink(src, links) {
      var cap;

      if ((cap = this.rules.inline.reflink.exec(src)) || (cap = this.rules.inline.nolink.exec(src))) {
        var link = (cap[2] || cap[1]).replace(/\s+/g, ' ');
        link = links[link.toLowerCase()];

        if (!link || !link.href) {
          var text = cap[0].charAt(0);
          return {
            type: 'text',
            raw: text,
            text: text
          };
        }

        var token = outputLink(cap, link, cap[0]);
        return token;
      }
    };

    _proto.strong = function strong(src, maskedSrc, prevChar) {
      if (prevChar === void 0) {
        prevChar = '';
      }

      var match = this.rules.inline.strong.start.exec(src);

      if (match && (!match[1] || match[1] && (prevChar === '' || this.rules.inline.punctuation.exec(prevChar)))) {
        maskedSrc = maskedSrc.slice(-1 * src.length);
        var endReg = match[0] === '**' ? this.rules.inline.strong.endAst : this.rules.inline.strong.endUnd;
        endReg.lastIndex = 0;
        var cap;

        while ((match = endReg.exec(maskedSrc)) != null) {
          cap = this.rules.inline.strong.middle.exec(maskedSrc.slice(0, match.index + 3));

          if (cap) {
            return {
              type: 'strong',
              raw: src.slice(0, cap[0].length),
              text: src.slice(2, cap[0].length - 2)
            };
          }
        }
      }
    };

    _proto.em = function em(src, maskedSrc, prevChar) {
      if (prevChar === void 0) {
        prevChar = '';
      }

      var match = this.rules.inline.em.start.exec(src);

      if (match && (!match[1] || match[1] && (prevChar === '' || this.rules.inline.punctuation.exec(prevChar)))) {
        maskedSrc = maskedSrc.slice(-1 * src.length);
        var endReg = match[0] === '*' ? this.rules.inline.em.endAst : this.rules.inline.em.endUnd;
        endReg.lastIndex = 0;
        var cap;

        while ((match = endReg.exec(maskedSrc)) != null) {
          cap = this.rules.inline.em.middle.exec(maskedSrc.slice(0, match.index + 2));

          if (cap) {
            return {
              type: 'em',
              raw: src.slice(0, cap[0].length),
              text: src.slice(1, cap[0].length - 1)
            };
          }
        }
      }
    };

    _proto.codespan = function codespan(src) {
      var cap = this.rules.inline.code.exec(src);

      if (cap) {
        var text = cap[2].replace(/\n/g, ' ');
        var hasNonSpaceChars = /[^ ]/.test(text);
        var hasSpaceCharsOnBothEnds = text.startsWith(' ') && text.endsWith(' ');

        if (hasNonSpaceChars && hasSpaceCharsOnBothEnds) {
          text = text.substring(1, text.length - 1);
        }

        text = _escape(text, true);
        return {
          type: 'codespan',
          raw: cap[0],
          text: text
        };
      }
    };

    _proto.br = function br(src) {
      var cap = this.rules.inline.br.exec(src);

      if (cap) {
        return {
          type: 'br',
          raw: cap[0]
        };
      }
    };

    _proto.del = function del(src) {
      var cap = this.rules.inline.del.exec(src);

      if (cap) {
        return {
          type: 'del',
          raw: cap[0],
          text: cap[1]
        };
      }
    };

    _proto.autolink = function autolink(src, mangle) {
      var cap = this.rules.inline.autolink.exec(src);

      if (cap) {
        var text, href;

        if (cap[2] === '@') {
          text = _escape(this.options.mangle ? mangle(cap[1]) : cap[1]);
          href = 'mailto:' + text;
        } else {
          text = _escape(cap[1]);
          href = text;
        }

        return {
          type: 'link',
          raw: cap[0],
          text: text,
          href: href,
          tokens: [{
            type: 'text',
            raw: text,
            text: text
          }]
        };
      }
    };

    _proto.url = function url(src, mangle) {
      var cap;

      if (cap = this.rules.inline.url.exec(src)) {
        var text, href;

        if (cap[2] === '@') {
          text = _escape(this.options.mangle ? mangle(cap[0]) : cap[0]);
          href = 'mailto:' + text;
        } else {
          // do extended autolink path validation
          var prevCapZero;

          do {
            prevCapZero = cap[0];
            cap[0] = this.rules.inline._backpedal.exec(cap[0])[0];
          } while (prevCapZero !== cap[0]);

          text = _escape(cap[0]);

          if (cap[1] === 'www.') {
            href = 'http://' + text;
          } else {
            href = text;
          }
        }

        return {
          type: 'link',
          raw: cap[0],
          text: text,
          href: href,
          tokens: [{
            type: 'text',
            raw: text,
            text: text
          }]
        };
      }
    };

    _proto.inlineText = function inlineText(src, inRawBlock, smartypants) {
      var cap = this.rules.inline.text.exec(src);

      if (cap) {
        var text;

        if (inRawBlock) {
          text = this.options.sanitize ? this.options.sanitizer ? this.options.sanitizer(cap[0]) : _escape(cap[0]) : cap[0];
        } else {
          text = _escape(this.options.smartypants ? smartypants(cap[0]) : cap[0]);
        }

        return {
          type: 'text',
          raw: cap[0],
          text: text
        };
      }
    };

    return Tokenizer;
  }();

  var noopTest$1 = helpers.noopTest,
      edit$1 = helpers.edit,
      merge$1 = helpers.merge;
  /**
   * Block-Level Grammar
   */

  var block = {
    newline: /^\n+/,
    code: /^( {4}[^\n]+\n*)+/,
    fences: /^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?:\n+|$)|$)/,
    hr: /^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,
    heading: /^ {0,3}(#{1,6}) +([^\n]*?)(?: +#+)? *(?:\n+|$)/,
    blockquote: /^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,
    list: /^( {0,3})(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,
    html: '^ {0,3}(?:' // optional indentation
    + '<(script|pre|style)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)' // (1)
    + '|comment[^\\n]*(\\n+|$)' // (2)
    + '|<\\?[\\s\\S]*?\\?>\\n*' // (3)
    + '|<![A-Z][\\s\\S]*?>\\n*' // (4)
    + '|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>\\n*' // (5)
    + '|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:\\n{2,}|$)' // (6)
    + '|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$)' // (7) open tag
    + '|</(?!script|pre|style)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$)' // (7) closing tag
    + ')',
    def: /^ {0,3}\[(label)\]: *\n? *<?([^\s>]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,
    nptable: noopTest$1,
    table: noopTest$1,
    lheading: /^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,
    // regex template, placeholders will be replaced according to different paragraph
    // interruption rules of commonmark and the original markdown spec:
    _paragraph: /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,
    text: /^[^\n]+/
  };
  block._label = /(?!\s*\])(?:\\[\[\]]|[^\[\]])+/;
  block._title = /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/;
  block.def = edit$1(block.def).replace('label', block._label).replace('title', block._title).getRegex();
  block.bullet = /(?:[*+-]|\d{1,9}[.)])/;
  block.item = /^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/;
  block.item = edit$1(block.item, 'gm').replace(/bull/g, block.bullet).getRegex();
  block.list = edit$1(block.list).replace(/bull/g, block.bullet).replace('hr', '\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))').replace('def', '\\n+(?=' + block.def.source + ')').getRegex();
  block._tag = 'address|article|aside|base|basefont|blockquote|body|caption' + '|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption' + '|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe' + '|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option' + '|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr' + '|track|ul';
  block._comment = /<!--(?!-?>)[\s\S]*?-->/;
  block.html = edit$1(block.html, 'i').replace('comment', block._comment).replace('tag', block._tag).replace('attribute', / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();
  block.paragraph = edit$1(block._paragraph).replace('hr', block.hr).replace('heading', ' {0,3}#{1,6} ').replace('|lheading', '') // setex headings don't interrupt commonmark paragraphs
  .replace('blockquote', ' {0,3}>').replace('fences', ' {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n').replace('list', ' {0,3}(?:[*+-]|1[.)]) ') // only lists starting from 1 can interrupt
  .replace('html', '</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)').replace('tag', block._tag) // pars can be interrupted by type (6) html blocks
  .getRegex();
  block.blockquote = edit$1(block.blockquote).replace('paragraph', block.paragraph).getRegex();
  /**
   * Normal Block Grammar
   */

  block.normal = merge$1({}, block);
  /**
   * GFM Block Grammar
   */

  block.gfm = merge$1({}, block.normal, {
    nptable: '^ *([^|\\n ].*\\|.*)\\n' // Header
    + ' *([-:]+ *\\|[-| :]*)' // Align
    + '(?:\\n((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)',
    // Cells
    table: '^ *\\|(.+)\\n' // Header
    + ' *\\|?( *[-:]+[-| :]*)' // Align
    + '(?:\\n *((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)' // Cells

  });
  block.gfm.nptable = edit$1(block.gfm.nptable).replace('hr', block.hr).replace('heading', ' {0,3}#{1,6} ').replace('blockquote', ' {0,3}>').replace('code', ' {4}[^\\n]').replace('fences', ' {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n').replace('list', ' {0,3}(?:[*+-]|1[.)]) ') // only lists starting from 1 can interrupt
  .replace('html', '</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)').replace('tag', block._tag) // tables can be interrupted by type (6) html blocks
  .getRegex();
  block.gfm.table = edit$1(block.gfm.table).replace('hr', block.hr).replace('heading', ' {0,3}#{1,6} ').replace('blockquote', ' {0,3}>').replace('code', ' {4}[^\\n]').replace('fences', ' {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n').replace('list', ' {0,3}(?:[*+-]|1[.)]) ') // only lists starting from 1 can interrupt
  .replace('html', '</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)').replace('tag', block._tag) // tables can be interrupted by type (6) html blocks
  .getRegex();
  /**
   * Pedantic grammar (original John Gruber's loose markdown specification)
   */

  block.pedantic = merge$1({}, block.normal, {
    html: edit$1('^ *(?:comment *(?:\\n|\\s*$)' + '|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)' // closed tag
    + '|<tag(?:"[^"]*"|\'[^\']*\'|\\s[^\'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))').replace('comment', block._comment).replace(/tag/g, '(?!(?:' + 'a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub' + '|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)' + '\\b)\\w+(?!:|[^\\w\\s@]*@)\\b').getRegex(),
    def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
    heading: /^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/,
    fences: noopTest$1,
    // fences not supported
    paragraph: edit$1(block.normal._paragraph).replace('hr', block.hr).replace('heading', ' *#{1,6} *[^\n]').replace('lheading', block.lheading).replace('blockquote', ' {0,3}>').replace('|fences', '').replace('|list', '').replace('|html', '').getRegex()
  });
  /**
   * Inline-Level Grammar
   */

  var inline = {
    escape: /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,
    autolink: /^<(scheme:[^\s\x00-\x1f<>]*|email)>/,
    url: noopTest$1,
    tag: '^comment' + '|^</[a-zA-Z][\\w:-]*\\s*>' // self-closing tag
    + '|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>' // open tag
    + '|^<\\?[\\s\\S]*?\\?>' // processing instruction, e.g. <?php ?>
    + '|^<![a-zA-Z]+\\s[\\s\\S]*?>' // declaration, e.g. <!DOCTYPE html>
    + '|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>',
    // CDATA section
    link: /^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,
    reflink: /^!?\[(label)\]\[(?!\s*\])((?:\\[\[\]]?|[^\[\]\\])+)\]/,
    nolink: /^!?\[(?!\s*\])((?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]])*)\](?:\[\])?/,
    reflinkSearch: 'reflink|nolink(?!\\()',
    strong: {
      start: /^(?:(\*\*(?=[*punctuation]))|\*\*)(?![\s])|__/,
      // (1) returns if starts w/ punctuation
      middle: /^\*\*(?:(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)|\*(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)*?\*)+?\*\*$|^__(?![\s])((?:(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)|_(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)*?_)+?)__$/,
      endAst: /[^punctuation\s]\*\*(?!\*)|[punctuation]\*\*(?!\*)(?:(?=[punctuation\s]|$))/,
      // last char can't be punct, or final * must also be followed by punct (or endline)
      endUnd: /[^\s]__(?!_)(?:(?=[punctuation\s])|$)/ // last char can't be a space, and final _ must preceed punct or \s (or endline)

    },
    em: {
      start: /^(?:(\*(?=[punctuation]))|\*)(?![*\s])|_/,
      // (1) returns if starts w/ punctuation
      middle: /^\*(?:(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)|\*(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)*?\*)+?\*$|^_(?![_\s])(?:(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)|_(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)*?_)+?_$/,
      endAst: /[^punctuation\s]\*(?!\*)|[punctuation]\*(?!\*)(?:(?=[punctuation\s]|$))/,
      // last char can't be punct, or final * must also be followed by punct (or endline)
      endUnd: /[^\s]_(?!_)(?:(?=[punctuation\s])|$)/ // last char can't be a space, and final _ must preceed punct or \s (or endline)

    },
    code: /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,
    br: /^( {2,}|\\)\n(?!\s*$)/,
    del: noopTest$1,
    text: /^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,
    punctuation: /^([\s*punctuation])/
  }; // list of punctuation marks from common mark spec
  // without * and _ to workaround cases with double emphasis

  inline._punctuation = '!"#$%&\'()+\\-.,/:;<=>?@\\[\\]`^{|}~';
  inline.punctuation = edit$1(inline.punctuation).replace(/punctuation/g, inline._punctuation).getRegex(); // sequences em should skip over [title](link), `code`, <html>

  inline._blockSkip = '\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>';
  inline._overlapSkip = '__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*';
  inline.em.start = edit$1(inline.em.start).replace(/punctuation/g, inline._punctuation).getRegex();
  inline.em.middle = edit$1(inline.em.middle).replace(/punctuation/g, inline._punctuation).replace(/overlapSkip/g, inline._overlapSkip).getRegex();
  inline.em.endAst = edit$1(inline.em.endAst, 'g').replace(/punctuation/g, inline._punctuation).getRegex();
  inline.em.endUnd = edit$1(inline.em.endUnd, 'g').replace(/punctuation/g, inline._punctuation).getRegex();
  inline.strong.start = edit$1(inline.strong.start).replace(/punctuation/g, inline._punctuation).getRegex();
  inline.strong.middle = edit$1(inline.strong.middle).replace(/punctuation/g, inline._punctuation).replace(/blockSkip/g, inline._blockSkip).getRegex();
  inline.strong.endAst = edit$1(inline.strong.endAst, 'g').replace(/punctuation/g, inline._punctuation).getRegex();
  inline.strong.endUnd = edit$1(inline.strong.endUnd, 'g').replace(/punctuation/g, inline._punctuation).getRegex();
  inline.blockSkip = edit$1(inline._blockSkip, 'g').getRegex();
  inline.overlapSkip = edit$1(inline._overlapSkip, 'g').getRegex();
  inline._escapes = /\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g;
  inline._scheme = /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/;
  inline._email = /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/;
  inline.autolink = edit$1(inline.autolink).replace('scheme', inline._scheme).replace('email', inline._email).getRegex();
  inline._attribute = /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/;
  inline.tag = edit$1(inline.tag).replace('comment', block._comment).replace('attribute', inline._attribute).getRegex();
  inline._label = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/;
  inline._href = /<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/;
  inline._title = /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/;
  inline.link = edit$1(inline.link).replace('label', inline._label).replace('href', inline._href).replace('title', inline._title).getRegex();
  inline.reflink = edit$1(inline.reflink).replace('label', inline._label).getRegex();
  inline.reflinkSearch = edit$1(inline.reflinkSearch, 'g').replace('reflink', inline.reflink).replace('nolink', inline.nolink).getRegex();
  /**
   * Normal Inline Grammar
   */

  inline.normal = merge$1({}, inline);
  /**
   * Pedantic Inline Grammar
   */

  inline.pedantic = merge$1({}, inline.normal, {
    strong: {
      start: /^__|\*\*/,
      middle: /^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,
      endAst: /\*\*(?!\*)/g,
      endUnd: /__(?!_)/g
    },
    em: {
      start: /^_|\*/,
      middle: /^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,
      endAst: /\*(?!\*)/g,
      endUnd: /_(?!_)/g
    },
    link: edit$1(/^!?\[(label)\]\((.*?)\)/).replace('label', inline._label).getRegex(),
    reflink: edit$1(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace('label', inline._label).getRegex()
  });
  /**
   * GFM Inline Grammar
   */

  inline.gfm = merge$1({}, inline.normal, {
    escape: edit$1(inline.escape).replace('])', '~|])').getRegex(),
    _extended_email: /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,
    url: /^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,
    _backpedal: /(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,
    del: /^~+(?=\S)([\s\S]*?\S)~+/,
    text: /^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*~]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))|(?= {2,}\n|[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))/
  });
  inline.gfm.url = edit$1(inline.gfm.url, 'i').replace('email', inline.gfm._extended_email).getRegex();
  /**
   * GFM + Line Breaks Inline Grammar
   */

  inline.breaks = merge$1({}, inline.gfm, {
    br: edit$1(inline.br).replace('{2,}', '*').getRegex(),
    text: edit$1(inline.gfm.text).replace('\\b_', '\\b_| {2,}\\n').replace(/\{2,\}/g, '*').getRegex()
  });
  var rules = {
    block: block,
    inline: inline
  };

  var defaults$2 = defaults.defaults;
  var block$1 = rules.block,
      inline$1 = rules.inline;
  /**
   * smartypants text replacement
   */

  function smartypants(text) {
    return text // em-dashes
    .replace(/---/g, "\u2014") // en-dashes
    .replace(/--/g, "\u2013") // opening singles
    .replace(/(^|[-\u2014/(\[{"\s])'/g, "$1\u2018") // closing singles & apostrophes
    .replace(/'/g, "\u2019") // opening doubles
    .replace(/(^|[-\u2014/(\[{\u2018\s])"/g, "$1\u201C") // closing doubles
    .replace(/"/g, "\u201D") // ellipses
    .replace(/\.{3}/g, "\u2026");
  }
  /**
   * mangle email addresses
   */


  function mangle(text) {
    var out = '',
        i,
        ch;
    var l = text.length;

    for (i = 0; i < l; i++) {
      ch = text.charCodeAt(i);

      if (Math.random() > 0.5) {
        ch = 'x' + ch.toString(16);
      }

      out += '&#' + ch + ';';
    }

    return out;
  }
  /**
   * Block Lexer
   */


  var Lexer_1 = /*#__PURE__*/function () {
    function Lexer(options) {
      this.tokens = [];
      this.tokens.links = Object.create(null);
      this.options = options || defaults$2;
      this.options.tokenizer = this.options.tokenizer || new Tokenizer_1();
      this.tokenizer = this.options.tokenizer;
      this.tokenizer.options = this.options;
      var rules = {
        block: block$1.normal,
        inline: inline$1.normal
      };

      if (this.options.pedantic) {
        rules.block = block$1.pedantic;
        rules.inline = inline$1.pedantic;
      } else if (this.options.gfm) {
        rules.block = block$1.gfm;

        if (this.options.breaks) {
          rules.inline = inline$1.breaks;
        } else {
          rules.inline = inline$1.gfm;
        }
      }

      this.tokenizer.rules = rules;
    }
    /**
     * Expose Rules
     */


    /**
     * Static Lex Method
     */
    Lexer.lex = function lex(src, options) {
      var lexer = new Lexer(options);
      return lexer.lex(src);
    }
    /**
     * Preprocessing
     */
    ;

    var _proto = Lexer.prototype;

    _proto.lex = function lex(src) {
      src = src.replace(/\r\n|\r/g, '\n').replace(/\t/g, '    ');
      this.blockTokens(src, this.tokens, true);
      this.inline(this.tokens);
      return this.tokens;
    }
    /**
     * Lexing
     */
    ;

    _proto.blockTokens = function blockTokens(src, tokens, top) {
      if (tokens === void 0) {
        tokens = [];
      }

      if (top === void 0) {
        top = true;
      }

      src = src.replace(/^ +$/gm, '');
      var token, i, l, lastToken;

      while (src) {
        // newline
        if (token = this.tokenizer.space(src)) {
          src = src.substring(token.raw.length);

          if (token.type) {
            tokens.push(token);
          }

          continue;
        } // code


        if (token = this.tokenizer.code(src, tokens)) {
          src = src.substring(token.raw.length);

          if (token.type) {
            tokens.push(token);
          } else {
            lastToken = tokens[tokens.length - 1];
            lastToken.raw += '\n' + token.raw;
            lastToken.text += '\n' + token.text;
          }

          continue;
        } // fences


        if (token = this.tokenizer.fences(src)) {
          src = src.substring(token.raw.length);
          tokens.push(token);
          continue;
        } // heading


        if (token = this.tokenizer.heading(src)) {
          src = src.substring(token.raw.length);
          tokens.push(token);
          continue;
        } // table no leading pipe (gfm)


        if (token = this.tokenizer.nptable(src)) {
          src = src.substring(token.raw.length);
          tokens.push(token);
          continue;
        } // hr


        if (token = this.tokenizer.hr(src)) {
          src = src.substring(token.raw.length);
          tokens.push(token);
          continue;
        } // blockquote


        if (token = this.tokenizer.blockquote(src)) {
          src = src.substring(token.raw.length);
          token.tokens = this.blockTokens(token.text, [], top);
          tokens.push(token);
          continue;
        } // list


        if (token = this.tokenizer.list(src)) {
          src = src.substring(token.raw.length);
          l = token.items.length;

          for (i = 0; i < l; i++) {
            token.items[i].tokens = this.blockTokens(token.items[i].text, [], false);
          }

          tokens.push(token);
          continue;
        } // html


        if (token = this.tokenizer.html(src)) {
          src = src.substring(token.raw.length);
          tokens.push(token);
          continue;
        } // def


        if (top && (token = this.tokenizer.def(src))) {
          src = src.substring(token.raw.length);

          if (!this.tokens.links[token.tag]) {
            this.tokens.links[token.tag] = {
              href: token.href,
              title: token.title
            };
          }

          continue;
        } // table (gfm)


        if (token = this.tokenizer.table(src)) {
          src = src.substring(token.raw.length);
          tokens.push(token);
          continue;
        } // lheading


        if (token = this.tokenizer.lheading(src)) {
          src = src.substring(token.raw.length);
          tokens.push(token);
          continue;
        } // top-level paragraph


        if (top && (token = this.tokenizer.paragraph(src))) {
          src = src.substring(token.raw.length);
          tokens.push(token);
          continue;
        } // text


        if (token = this.tokenizer.text(src, tokens)) {
          src = src.substring(token.raw.length);

          if (token.type) {
            tokens.push(token);
          } else {
            lastToken = tokens[tokens.length - 1];
            lastToken.raw += '\n' + token.raw;
            lastToken.text += '\n' + token.text;
          }

          continue;
        }

        if (src) {
          var errMsg = 'Infinite loop on byte: ' + src.charCodeAt(0);

          if (this.options.silent) {
            console.error(errMsg);
            break;
          } else {
            throw new Error(errMsg);
          }
        }
      }

      return tokens;
    };

    _proto.inline = function inline(tokens) {
      var i, j, k, l2, row, token;
      var l = tokens.length;

      for (i = 0; i < l; i++) {
        token = tokens[i];

        switch (token.type) {
          case 'paragraph':
          case 'text':
          case 'heading':
            {
              token.tokens = [];
              this.inlineTokens(token.text, token.tokens);
              break;
            }

          case 'table':
            {
              token.tokens = {
                header: [],
                cells: []
              }; // header

              l2 = token.header.length;

              for (j = 0; j < l2; j++) {
                token.tokens.header[j] = [];
                this.inlineTokens(token.header[j], token.tokens.header[j]);
              } // cells


              l2 = token.cells.length;

              for (j = 0; j < l2; j++) {
                row = token.cells[j];
                token.tokens.cells[j] = [];

                for (k = 0; k < row.length; k++) {
                  token.tokens.cells[j][k] = [];
                  this.inlineTokens(row[k], token.tokens.cells[j][k]);
                }
              }

              break;
            }

          case 'blockquote':
            {
              this.inline(token.tokens);
              break;
            }

          case 'list':
            {
              l2 = token.items.length;

              for (j = 0; j < l2; j++) {
                this.inline(token.items[j].tokens);
              }

              break;
            }
        }
      }

      return tokens;
    }
    /**
     * Lexing/Compiling
     */
    ;

    _proto.inlineTokens = function inlineTokens(src, tokens, inLink, inRawBlock, prevChar) {
      if (tokens === void 0) {
        tokens = [];
      }

      if (inLink === void 0) {
        inLink = false;
      }

      if (inRawBlock === void 0) {
        inRawBlock = false;
      }

      if (prevChar === void 0) {
        prevChar = '';
      }

      var token; // String with links masked to avoid interference with em and strong

      var maskedSrc = src;
      var match; // Mask out reflinks

      if (this.tokens.links) {
        var links = Object.keys(this.tokens.links);

        if (links.length > 0) {
          while ((match = this.tokenizer.rules.inline.reflinkSearch.exec(maskedSrc)) != null) {
            if (links.includes(match[0].slice(match[0].lastIndexOf('[') + 1, -1))) {
              maskedSrc = maskedSrc.slice(0, match.index) + '[' + 'a'.repeat(match[0].length - 2) + ']' + maskedSrc.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex);
            }
          }
        }
      } // Mask out other blocks


      while ((match = this.tokenizer.rules.inline.blockSkip.exec(maskedSrc)) != null) {
        maskedSrc = maskedSrc.slice(0, match.index) + '[' + 'a'.repeat(match[0].length - 2) + ']' + maskedSrc.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
      }

      while (src) {
        // escape
        if (token = this.tokenizer.escape(src)) {
          src = src.substring(token.raw.length);
          tokens.push(token);
          continue;
        } // tag


        if (token = this.tokenizer.tag(src, inLink, inRawBlock)) {
          src = src.substring(token.raw.length);
          inLink = token.inLink;
          inRawBlock = token.inRawBlock;
          tokens.push(token);
          continue;
        } // link


        if (token = this.tokenizer.link(src)) {
          src = src.substring(token.raw.length);

          if (token.type === 'link') {
            token.tokens = this.inlineTokens(token.text, [], true, inRawBlock);
          }

          tokens.push(token);
          continue;
        } // reflink, nolink


        if (token = this.tokenizer.reflink(src, this.tokens.links)) {
          src = src.substring(token.raw.length);

          if (token.type === 'link') {
            token.tokens = this.inlineTokens(token.text, [], true, inRawBlock);
          }

          tokens.push(token);
          continue;
        } // strong


        if (token = this.tokenizer.strong(src, maskedSrc, prevChar)) {
          src = src.substring(token.raw.length);
          token.tokens = this.inlineTokens(token.text, [], inLink, inRawBlock);
          tokens.push(token);
          continue;
        } // em


        if (token = this.tokenizer.em(src, maskedSrc, prevChar)) {
          src = src.substring(token.raw.length);
          token.tokens = this.inlineTokens(token.text, [], inLink, inRawBlock);
          tokens.push(token);
          continue;
        } // code


        if (token = this.tokenizer.codespan(src)) {
          src = src.substring(token.raw.length);
          tokens.push(token);
          continue;
        } // br


        if (token = this.tokenizer.br(src)) {
          src = src.substring(token.raw.length);
          tokens.push(token);
          continue;
        } // del (gfm)


        if (token = this.tokenizer.del(src)) {
          src = src.substring(token.raw.length);
          token.tokens = this.inlineTokens(token.text, [], inLink, inRawBlock);
          tokens.push(token);
          continue;
        } // autolink


        if (token = this.tokenizer.autolink(src, mangle)) {
          src = src.substring(token.raw.length);
          tokens.push(token);
          continue;
        } // url (gfm)


        if (!inLink && (token = this.tokenizer.url(src, mangle))) {
          src = src.substring(token.raw.length);
          tokens.push(token);
          continue;
        } // text


        if (token = this.tokenizer.inlineText(src, inRawBlock, smartypants)) {
          src = src.substring(token.raw.length);
          prevChar = token.raw.slice(-1);
          tokens.push(token);
          continue;
        }

        if (src) {
          var errMsg = 'Infinite loop on byte: ' + src.charCodeAt(0);

          if (this.options.silent) {
            console.error(errMsg);
            break;
          } else {
            throw new Error(errMsg);
          }
        }
      }

      return tokens;
    };

    _createClass(Lexer, null, [{
      key: "rules",
      get: function get() {
        return {
          block: block$1,
          inline: inline$1
        };
      }
    }]);

    return Lexer;
  }();

  var defaults$3 = defaults.defaults;
  var cleanUrl$1 = helpers.cleanUrl,
      escape$1 = helpers.escape;
  /**
   * Renderer
   */

  var Renderer_1 = /*#__PURE__*/function () {
    function Renderer(options) {
      this.options = options || defaults$3;
    }

    var _proto = Renderer.prototype;

    _proto.code = function code(_code, infostring, escaped) {
      var lang = (infostring || '').match(/\S*/)[0];

      if (this.options.highlight) {
        var out = this.options.highlight(_code, lang);

        if (out != null && out !== _code) {
          escaped = true;
          _code = out;
        }
      }

      if (!lang) {
        return '<pre><code>' + (escaped ? _code : escape$1(_code, true)) + '</code></pre>\n';
      }

      return '<pre><code class="' + this.options.langPrefix + escape$1(lang, true) + '">' + (escaped ? _code : escape$1(_code, true)) + '</code></pre>\n';
    };

    _proto.blockquote = function blockquote(quote) {
      return '<blockquote>\n' + quote + '</blockquote>\n';
    };

    _proto.html = function html(_html) {
      return _html;
    };

    _proto.heading = function heading(text, level, raw, slugger) {
      if (this.options.headerIds) {
        return '<h' + level + ' id="' + this.options.headerPrefix + slugger.slug(raw) + '">' + text + '</h' + level + '>\n';
      } // ignore IDs


      return '<h' + level + '>' + text + '</h' + level + '>\n';
    };

    _proto.hr = function hr() {
      return this.options.xhtml ? '<hr/>\n' : '<hr>\n';
    };

    _proto.list = function list(body, ordered, start) {
      var type = ordered ? 'ol' : 'ul',
          startatt = ordered && start !== 1 ? ' start="' + start + '"' : '';
      return '<' + type + startatt + '>\n' + body + '</' + type + '>\n';
    };

    _proto.listitem = function listitem(text) {
      return '<li>' + text + '</li>\n';
    };

    _proto.checkbox = function checkbox(checked) {
      return '<input ' + (checked ? 'checked="" ' : '') + 'disabled="" type="checkbox"' + (this.options.xhtml ? ' /' : '') + '> ';
    };

    _proto.paragraph = function paragraph(text) {
      return '<p>' + text + '</p>\n';
    };

    _proto.table = function table(header, body) {
      if (body) body = '<tbody>' + body + '</tbody>';
      return '<table>\n' + '<thead>\n' + header + '</thead>\n' + body + '</table>\n';
    };

    _proto.tablerow = function tablerow(content) {
      return '<tr>\n' + content + '</tr>\n';
    };

    _proto.tablecell = function tablecell(content, flags) {
      var type = flags.header ? 'th' : 'td';
      var tag = flags.align ? '<' + type + ' align="' + flags.align + '">' : '<' + type + '>';
      return tag + content + '</' + type + '>\n';
    } // span level renderer
    ;

    _proto.strong = function strong(text) {
      return '<strong>' + text + '</strong>';
    };

    _proto.em = function em(text) {
      return '<em>' + text + '</em>';
    };

    _proto.codespan = function codespan(text) {
      return '<code>' + text + '</code>';
    };

    _proto.br = function br() {
      return this.options.xhtml ? '<br/>' : '<br>';
    };

    _proto.del = function del(text) {
      return '<del>' + text + '</del>';
    };

    _proto.link = function link(href, title, text) {
      href = cleanUrl$1(this.options.sanitize, this.options.baseUrl, href);

      if (href === null) {
        return text;
      }

      var out = '<a href="' + escape$1(href) + '"';

      if (title) {
        out += ' title="' + title + '"';
      }

      out += '>' + text + '</a>';
      return out;
    };

    _proto.image = function image(href, title, text) {
      href = cleanUrl$1(this.options.sanitize, this.options.baseUrl, href);

      if (href === null) {
        return text;
      }

      var out = '<img src="' + href + '" alt="' + text + '"';

      if (title) {
        out += ' title="' + title + '"';
      }

      out += this.options.xhtml ? '/>' : '>';
      return out;
    };

    _proto.text = function text(_text) {
      return _text;
    };

    return Renderer;
  }();

  /**
   * TextRenderer
   * returns only the textual part of the token
   */
  var TextRenderer_1 = /*#__PURE__*/function () {
    function TextRenderer() {}

    var _proto = TextRenderer.prototype;

    // no need for block level renderers
    _proto.strong = function strong(text) {
      return text;
    };

    _proto.em = function em(text) {
      return text;
    };

    _proto.codespan = function codespan(text) {
      return text;
    };

    _proto.del = function del(text) {
      return text;
    };

    _proto.html = function html(text) {
      return text;
    };

    _proto.text = function text(_text) {
      return _text;
    };

    _proto.link = function link(href, title, text) {
      return '' + text;
    };

    _proto.image = function image(href, title, text) {
      return '' + text;
    };

    _proto.br = function br() {
      return '';
    };

    return TextRenderer;
  }();

  /**
   * Slugger generates header id
   */
  var Slugger_1 = /*#__PURE__*/function () {
    function Slugger() {
      this.seen = {};
    }
    /**
     * Convert string to unique id
     */


    var _proto = Slugger.prototype;

    _proto.slug = function slug(value) {
      var slug = value.toLowerCase().trim() // remove html tags
      .replace(/<[!\/a-z].*?>/ig, '') // remove unwanted chars
      .replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g, '').replace(/\s/g, '-');

      if (this.seen.hasOwnProperty(slug)) {
        var originalSlug = slug;

        do {
          this.seen[originalSlug]++;
          slug = originalSlug + '-' + this.seen[originalSlug];
        } while (this.seen.hasOwnProperty(slug));
      }

      this.seen[slug] = 0;
      return slug;
    };

    return Slugger;
  }();

  var defaults$4 = defaults.defaults;
  var unescape$1 = helpers.unescape;
  /**
   * Parsing & Compiling
   */

  var Parser_1 = /*#__PURE__*/function () {
    function Parser(options) {
      this.options = options || defaults$4;
      this.options.renderer = this.options.renderer || new Renderer_1();
      this.renderer = this.options.renderer;
      this.renderer.options = this.options;
      this.textRenderer = new TextRenderer_1();
      this.slugger = new Slugger_1();
    }
    /**
     * Static Parse Method
     */


    Parser.parse = function parse(tokens, options) {
      var parser = new Parser(options);
      return parser.parse(tokens);
    }
    /**
     * Parse Loop
     */
    ;

    var _proto = Parser.prototype;

    _proto.parse = function parse(tokens, top) {
      if (top === void 0) {
        top = true;
      }

      var out = '',
          i,
          j,
          k,
          l2,
          l3,
          row,
          cell,
          header,
          body,
          token,
          ordered,
          start,
          loose,
          itemBody,
          item,
          checked,
          task,
          checkbox;
      var l = tokens.length;

      for (i = 0; i < l; i++) {
        token = tokens[i];

        switch (token.type) {
          case 'space':
            {
              continue;
            }

          case 'hr':
            {
              out += this.renderer.hr();
              continue;
            }

          case 'heading':
            {
              out += this.renderer.heading(this.parseInline(token.tokens), token.depth, unescape$1(this.parseInline(token.tokens, this.textRenderer)), this.slugger);
              continue;
            }

          case 'code':
            {
              out += this.renderer.code(token.text, token.lang, token.escaped);
              continue;
            }

          case 'table':
            {
              header = ''; // header

              cell = '';
              l2 = token.header.length;

              for (j = 0; j < l2; j++) {
                cell += this.renderer.tablecell(this.parseInline(token.tokens.header[j]), {
                  header: true,
                  align: token.align[j]
                });
              }

              header += this.renderer.tablerow(cell);
              body = '';
              l2 = token.cells.length;

              for (j = 0; j < l2; j++) {
                row = token.tokens.cells[j];
                cell = '';
                l3 = row.length;

                for (k = 0; k < l3; k++) {
                  cell += this.renderer.tablecell(this.parseInline(row[k]), {
                    header: false,
                    align: token.align[k]
                  });
                }

                body += this.renderer.tablerow(cell);
              }

              out += this.renderer.table(header, body);
              continue;
            }

          case 'blockquote':
            {
              body = this.parse(token.tokens);
              out += this.renderer.blockquote(body);
              continue;
            }

          case 'list':
            {
              ordered = token.ordered;
              start = token.start;
              loose = token.loose;
              l2 = token.items.length;
              body = '';

              for (j = 0; j < l2; j++) {
                item = token.items[j];
                checked = item.checked;
                task = item.task;
                itemBody = '';

                if (item.task) {
                  checkbox = this.renderer.checkbox(checked);

                  if (loose) {
                    if (item.tokens.length > 0 && item.tokens[0].type === 'text') {
                      item.tokens[0].text = checkbox + ' ' + item.tokens[0].text;

                      if (item.tokens[0].tokens && item.tokens[0].tokens.length > 0 && item.tokens[0].tokens[0].type === 'text') {
                        item.tokens[0].tokens[0].text = checkbox + ' ' + item.tokens[0].tokens[0].text;
                      }
                    } else {
                      item.tokens.unshift({
                        type: 'text',
                        text: checkbox
                      });
                    }
                  } else {
                    itemBody += checkbox;
                  }
                }

                itemBody += this.parse(item.tokens, loose);
                body += this.renderer.listitem(itemBody, task, checked);
              }

              out += this.renderer.list(body, ordered, start);
              continue;
            }

          case 'html':
            {
              // TODO parse inline content if parameter markdown=1
              out += this.renderer.html(token.text);
              continue;
            }

          case 'paragraph':
            {
              out += this.renderer.paragraph(this.parseInline(token.tokens));
              continue;
            }

          case 'text':
            {
              body = token.tokens ? this.parseInline(token.tokens) : token.text;

              while (i + 1 < l && tokens[i + 1].type === 'text') {
                token = tokens[++i];
                body += '\n' + (token.tokens ? this.parseInline(token.tokens) : token.text);
              }

              out += top ? this.renderer.paragraph(body) : body;
              continue;
            }

          default:
            {
              var errMsg = 'Token with "' + token.type + '" type was not found.';

              if (this.options.silent) {
                console.error(errMsg);
                return;
              } else {
                throw new Error(errMsg);
              }
            }
        }
      }

      return out;
    }
    /**
     * Parse Inline Tokens
     */
    ;

    _proto.parseInline = function parseInline(tokens, renderer) {
      renderer = renderer || this.renderer;
      var out = '',
          i,
          token;
      var l = tokens.length;

      for (i = 0; i < l; i++) {
        token = tokens[i];

        switch (token.type) {
          case 'escape':
            {
              out += renderer.text(token.text);
              break;
            }

          case 'html':
            {
              out += renderer.html(token.text);
              break;
            }

          case 'link':
            {
              out += renderer.link(token.href, token.title, this.parseInline(token.tokens, renderer));
              break;
            }

          case 'image':
            {
              out += renderer.image(token.href, token.title, token.text);
              break;
            }

          case 'strong':
            {
              out += renderer.strong(this.parseInline(token.tokens, renderer));
              break;
            }

          case 'em':
            {
              out += renderer.em(this.parseInline(token.tokens, renderer));
              break;
            }

          case 'codespan':
            {
              out += renderer.codespan(token.text);
              break;
            }

          case 'br':
            {
              out += renderer.br();
              break;
            }

          case 'del':
            {
              out += renderer.del(this.parseInline(token.tokens, renderer));
              break;
            }

          case 'text':
            {
              out += renderer.text(token.text);
              break;
            }

          default:
            {
              var errMsg = 'Token with "' + token.type + '" type was not found.';

              if (this.options.silent) {
                console.error(errMsg);
                return;
              } else {
                throw new Error(errMsg);
              }
            }
        }
      }

      return out;
    };

    return Parser;
  }();

  var merge$2 = helpers.merge,
      checkSanitizeDeprecation$1 = helpers.checkSanitizeDeprecation,
      escape$2 = helpers.escape;
  var getDefaults = defaults.getDefaults,
      changeDefaults = defaults.changeDefaults,
      defaults$5 = defaults.defaults;
  /**
   * Marked
   */

  function marked(src, opt, callback) {
    // throw error in case of non string input
    if (typeof src === 'undefined' || src === null) {
      throw new Error('marked(): input parameter is undefined or null');
    }

    if (typeof src !== 'string') {
      throw new Error('marked(): input parameter is of type ' + Object.prototype.toString.call(src) + ', string expected');
    }

    if (typeof opt === 'function') {
      callback = opt;
      opt = null;
    }

    opt = merge$2({}, marked.defaults, opt || {});
    checkSanitizeDeprecation$1(opt);

    if (callback) {
      var highlight = opt.highlight;
      var tokens;

      try {
        tokens = Lexer_1.lex(src, opt);
      } catch (e) {
        return callback(e);
      }

      var done = function done(err) {
        var out;

        if (!err) {
          try {
            out = Parser_1.parse(tokens, opt);
          } catch (e) {
            err = e;
          }
        }

        opt.highlight = highlight;
        return err ? callback(err) : callback(null, out);
      };

      if (!highlight || highlight.length < 3) {
        return done();
      }

      delete opt.highlight;
      if (!tokens.length) return done();
      var pending = 0;
      marked.walkTokens(tokens, function (token) {
        if (token.type === 'code') {
          pending++;
          setTimeout(function () {
            highlight(token.text, token.lang, function (err, code) {
              if (err) {
                return done(err);
              }

              if (code != null && code !== token.text) {
                token.text = code;
                token.escaped = true;
              }

              pending--;

              if (pending === 0) {
                done();
              }
            });
          }, 0);
        }
      });

      if (pending === 0) {
        done();
      }

      return;
    }

    try {
      var _tokens = Lexer_1.lex(src, opt);

      if (opt.walkTokens) {
        marked.walkTokens(_tokens, opt.walkTokens);
      }

      return Parser_1.parse(_tokens, opt);
    } catch (e) {
      e.message += '\nPlease report this to https://github.com/markedjs/marked.';

      if (opt.silent) {
        return '<p>An error occurred:</p><pre>' + escape$2(e.message + '', true) + '</pre>';
      }

      throw e;
    }
  }
  /**
   * Options
   */


  marked.options = marked.setOptions = function (opt) {
    merge$2(marked.defaults, opt);
    changeDefaults(marked.defaults);
    return marked;
  };

  marked.getDefaults = getDefaults;
  marked.defaults = defaults$5;
  /**
   * Use Extension
   */

  marked.use = function (extension) {
    var opts = merge$2({}, extension);

    if (extension.renderer) {
      (function () {
        var renderer = marked.defaults.renderer || new Renderer_1();

        var _loop = function _loop(prop) {
          var prevRenderer = renderer[prop];

          renderer[prop] = function () {
            for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
              args[_key] = arguments[_key];
            }

            var ret = extension.renderer[prop].apply(renderer, args);

            if (ret === false) {
              ret = prevRenderer.apply(renderer, args);
            }

            return ret;
          };
        };

        for (var prop in extension.renderer) {
          _loop(prop);
        }

        opts.renderer = renderer;
      })();
    }

    if (extension.tokenizer) {
      (function () {
        var tokenizer = marked.defaults.tokenizer || new Tokenizer_1();

        var _loop2 = function _loop2(prop) {
          var prevTokenizer = tokenizer[prop];

          tokenizer[prop] = function () {
            for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
              args[_key2] = arguments[_key2];
            }

            var ret = extension.tokenizer[prop].apply(tokenizer, args);

            if (ret === false) {
              ret = prevTokenizer.apply(tokenizer, args);
            }

            return ret;
          };
        };

        for (var prop in extension.tokenizer) {
          _loop2(prop);
        }

        opts.tokenizer = tokenizer;
      })();
    }

    if (extension.walkTokens) {
      var walkTokens = marked.defaults.walkTokens;

      opts.walkTokens = function (token) {
        extension.walkTokens(token);

        if (walkTokens) {
          walkTokens(token);
        }
      };
    }

    marked.setOptions(opts);
  };
  /**
   * Run callback for every token
   */


  marked.walkTokens = function (tokens, callback) {
    for (var _iterator = _createForOfIteratorHelperLoose(tokens), _step; !(_step = _iterator()).done;) {
      var token = _step.value;
      callback(token);

      switch (token.type) {
        case 'table':
          {
            for (var _iterator2 = _createForOfIteratorHelperLoose(token.tokens.header), _step2; !(_step2 = _iterator2()).done;) {
              var cell = _step2.value;
              marked.walkTokens(cell, callback);
            }

            for (var _iterator3 = _createForOfIteratorHelperLoose(token.tokens.cells), _step3; !(_step3 = _iterator3()).done;) {
              var row = _step3.value;

              for (var _iterator4 = _createForOfIteratorHelperLoose(row), _step4; !(_step4 = _iterator4()).done;) {
                var _cell = _step4.value;
                marked.walkTokens(_cell, callback);
              }
            }

            break;
          }

        case 'list':
          {
            marked.walkTokens(token.items, callback);
            break;
          }

        default:
          {
            if (token.tokens) {
              marked.walkTokens(token.tokens, callback);
            }
          }
      }
    }
  };
  /**
   * Expose
   */


  marked.Parser = Parser_1;
  marked.parser = Parser_1.parse;
  marked.Renderer = Renderer_1;
  marked.TextRenderer = TextRenderer_1;
  marked.Lexer = Lexer_1;
  marked.lexer = Lexer_1.lex;
  marked.Tokenizer = Tokenizer_1;
  marked.Slugger = Slugger_1;
  marked.parse = marked;
  var marked_1 = marked;

  return marked_1;

})));


/***/ }),
/* 68 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.renderSavedPost = void 0;
var moment_1 = __importDefault(__webpack_require__(11));
var common_1 = __webpack_require__(0);
var styles_1 = __webpack_require__(3);
var defaultGuildIcon = '/assets/images/guilds/default-guild-icon.png';
var defaultNsfwGuildIcon = '/assets/images/icons/nsfw_guild_icon.png';
exports.renderSavedPost = function (x) {
    var guildImage = x.guild ? "https://i.ruqqus.com/board/" + x.guild.toLowerCase() + "/profile-1.png" : '';
    var domain = '(' + (common_1.getDomain(x.link || x.url) || '?') + ')';
    var dateRelative = moment_1.default(x.date).fromNow();
    var mainUrl = x.link || x.url;
    var html = "\n  <div id=\"post-" + x.id + "\" class=\"card " + (x.nsfw ? 'nsfw' : '') + "\">\n      <div class=\"d-flex flex-row-reverse flex-md-row flex-nowrap justify-content-end\">\n          <div class=\"card-header bg-transparent border-0 d-flex flex-row flex-nowrap pl-2 pl-md-0 p-0 mr-md-2\">\n              <div class=\"position-relative d-none d-md-block\" style=\"z-index: 3;\">\n                  <a href=\"" + mainUrl + "\" rel=\"nofollow noopener\" " + (x.previewModal ? 'data-toggle="modal" data-target="#expandImageModal"' : '') + ">\n                      <img src=\"" + x.thumbnail + "\" class=\"post-img\" alt=\"\" " + (x.previewModal ? "onclick=\"expandDesktopImage('" + x.link + "','" + x.link + "')\"" : '') + ">\n                  </a>\n              </div>\n              <div class=\"d-block d-md-none\" style=\"z-index: 3;\">\n                  <a href=\"javascript:void(0)\" rel=\"nofollow noopener\" " + (x.previewModal ? 'data-toggle="modal" data-target="#expandImageModal"' : '') + ">\n                      <img src=\"" + x.thumbnail + "\" class=\"post-img\" alt=\"\" " + (x.previewModal ? "onclick=\"expandDesktopImage('" + x.link + "','" + x.link + "')\"" : '') + ">\n                  </a>\n                  <a>\n                  </a>\n              </div>\n              <a></a>\n          </div>\n          <a>\n          </a>\n          <div class=\"card-block text-left x-scroll-parent my-md-auto w-100\"><a>\n          </a>\n              <div style=\"height: 21px\" class=\"d-block d-md-none mb-1\"><a>\n              </a>\n                  <div class=\"post-meta text-left x-scroll " + styles_1.hideScrollbarCls + "\" style=\"overflow-x: scroll;\">\n                        <a>\n                            <span class=\"post-meta-guild\"></span>\n                        </a>\n                        <a href=\"/+" + x.guild + "\">+" + x.guild + "</a>\n                        " + (x.nsfw ? " \u00B7 <span class=\"text-danger\"><i class=\"far fa-exclamation-triangle text-small mr-1\"></i>nsfw</span>" : '') + "\n                        \u00B7 \n                        <span data-toggle=\"tooltip\" title=\"" + x.dateRaw + "\">" + dateRelative + "</span> \n                        by\n                        <a href=\"/@" + x.author + "\" class=\"user-name\">" + x.author + "</a>\n                        \u00B7\n                        " + domain + "\n                  </div>\n              </div>\n              <div class=\"post-meta text-left d-none d-md-block mb-md-2\">\n                  <span class=\"post-meta-guild\">\n                      <span class=\"font-weight-bold\">\n                          <a href=\"/+" + x.guild + "\" class=\"text-black\">\n                            <img src=\"" + guildImage + "\" class=\"profile-pic-20 align-top mr-1 " + styles_1.saveGuildImageCls + "\">\n                            +" + x.guild + "\n                          </a>\n                      </span>\n                      \u00B7\n                  </span>\n                  <span data-toggle=\"tooltip\" title=\"" + x.dateRaw + "\">" + dateRelative + "</span> \n                  by <a href=\"/@" + x.author + "\" class=\"user-name\">" + x.author + "</a>\n                  \u00B7 " + domain + "\n                  " + (x.nsfw ? " \u00B7 <span class=\"badge text-danger border-danger border-1 text-small-extra\">nsfw</span>" : '') + "\n              </div>\n              <h5 class=\"card-title post-title text-left w-lg-75 mb-0 mb-md-2\">\n                    <a href=\"" + x.url + "\" class=\"stretched-link\">" + x.title + "</a>\n              </h5>\n  \n              <div class=\"row post-img-lg mb-3\">\n                  <div class=\"col px-0\">\n                      <a target=\"_blank\" href=\"" + x.url + "\" rel=\"nofollow noopener\">\n                        <img src=\"" + x.thumbnail + "\" class=\"img-fluid\" alt=\"post image\">\n                      </a>\n                  </div>\n              </div>\n              <div class=\"post-actions mt-2 d-none d-md-block\">\n                  <ul class=\"list-inline text-right d-flex\">\n                      <li class=\"list-inline-item\">\n                          <a href=\"" + x.url + "\">\n                            <i class=\"fas fa-comment-dots\"></i>\n                            Comments\n                          </a>\n                        </li>\n                  </ul>\n              </div>\n          </div>\n      </div>\n  \n      <div class=\"card-footer d-block d-md-none mt-2\">\n          <div class=\"post-actions\">\n              <ul class=\"list-inline text-right d-flex\">\n                  <li class=\"list-inline-item\"><a href=\"" + x.url + "\"><i\n                          class=\"fas fa-comment-dots\"></i>Comments</a></li>\n              </ul>\n          </div>\n      </div>\n      <!--\n" + JSON.stringify(common_1.encodeHtmlEntitiesDeeplyInStrings(x), null, 4) + "\n      !-->\n  </div>\n  ";
    var el = $(html);
    common_1.$c(styles_1.saveGuildImageCls, el).on('error', function (evt) {
        return $(evt.target).prop('src', x.nsfw ? defaultNsfwGuildIcon : defaultGuildIcon);
    });
    return el;
};


/***/ }),
/* 69 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.renderSavedComment = void 0;
var common_1 = __webpack_require__(0);
exports.renderSavedComment = function (x) {
    var html = "<!-- " + JSON.stringify(common_1.encodeHtmlEntitiesDeeplyInStrings(x), null, 4) + " -->\n<div id=\"comment-" + x.id + "\" class=\"comment rounded\">\n<span\n        class=\"comment-collapse d-md-block d-none\"\n        onclick=\"collapse_comment('" + x.id + "')\"\n></span>\n    <div class=\"comment-body\">\n        <div id=\"comment-" + x.id + "-only\">\n            <div class=\"user-info\"><a href=\"/@" + x.author + "\" class=\"user-name \">" + x.author + "</a>\n                <!-- <span class=\"time-stamp\"> \u00B7 20 minutes ago TODO</span> -->\n                <span\n                        class=\"comment-collapse d-md-none\"\n                        onclick=\"collapse_comment('" + x.id + "')\"\n                ></span>\n            </div>\n            <div id=\"comment-text-" + x.id + "\" class=\"comment-text mb-0\">\n                " + x.text + "\n            </div>\n            <div id=\"comment-" + x.id + "-actions\" class=\"comment-actions\">\n                <ul class=\"list-inline text-right text-md-left\">\n                    <li class=\"list-inline-item text-muted\">\n                        <a href=\"" + x.link + "\"\n                           rel=\"nofollow\">\n                            <i class=\"fas fa-link\"></i>Permalink\n                        </a>\n                    </li>\n                    <li class=\"list-inline-item text-muted d-none d-md-inline-block\">\n                        <a href=\"javascript:void(0);\"\n                           role=\"button\"\n                           class=\"copy-link\"\n                           data-clipboard-text=\"" + x.link + "\">\n                            <i class=\"fas fa-copy\"></i>Copy link\n                        </a>\n                    </li>\n                </ul>\n            </div>\n        </div>\n    </div>\n</div>\n";
    var el = $(html);
    return el;
};


/***/ }),
/* 70 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.uploadImageToImgBb = void 0;
var common_1 = __webpack_require__(0);
var ramda_1 = __webpack_require__(4);
exports.uploadImageToImgBb = function (args) {
    var cfg = args.cfg, file = args.file, onError = args.onError, onSuccess = args.onSuccess;
    common_1.debugLog('uploadImageToImgBb', { cfg: cfg, file: file });
    var doRequest = function (image) {
        var _a;
        common_1.debugLog('doRequest');
        var fd = new FormData();
        fd.append('image', btoa(image));
        var data = fd;
        common_1.debugLog({ data: data });
        common_1.xhr({
            method: 'POST',
            url: "https://api.imgbb.com/1/upload?key=" + ((_a = cfg === null || cfg === void 0 ? void 0 : cfg.external) === null || _a === void 0 ? void 0 : _a.imgbbKey),
            data: data,
            onload: function (resp) {
                if (resp.status !== 200) {
                    return onError(resp);
                }
                common_1.debugLog('imgbb upload success', resp, resp.response);
                var json = null;
                try {
                    json = JSON.parse(resp.response);
                }
                catch (e) { }
                if (json) {
                    var url = String(ramda_1.path(['data', 'url'])(json));
                    common_1.debugLog('parsed imgbb response, url is', url, '; whole json = ', json);
                    onSuccess(url);
                }
                else {
                    alert("Failed to parse response from ImgBB:\n" + resp.response);
                    onError(resp);
                }
            },
            onerror: function (err) { return onError(err); },
        });
    };
    var reader = new FileReader();
    reader.onload = function (readEvt) {
        var _a;
        doRequest((_a = readEvt.target) === null || _a === void 0 ? void 0 : _a.result);
    };
    reader.readAsBinaryString(file);
};


/***/ }),
/* 71 */
/***/ (function(module, exports, __webpack_require__) {

/* WEBPACK VAR INJECTION */(function(global, module) {/**
 * lodash (Custom Build) <https://lodash.com/>
 * Build: `lodash modularize exports="npm" -o ./`
 * Copyright jQuery Foundation and other contributors <https://jquery.org/>
 * Released under MIT license <https://lodash.com/license>
 * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
 */

/** Used as the size to enable large array optimizations. */
var LARGE_ARRAY_SIZE = 200;

/** Used to stand-in for `undefined` hash values. */
var HASH_UNDEFINED = '__lodash_hash_undefined__';

/** Used to compose bitmasks for comparison styles. */
var UNORDERED_COMPARE_FLAG = 1,
    PARTIAL_COMPARE_FLAG = 2;

/** Used as references for various `Number` constants. */
var MAX_SAFE_INTEGER = 9007199254740991;

/** `Object#toString` result references. */
var argsTag = '[object Arguments]',
    arrayTag = '[object Array]',
    boolTag = '[object Boolean]',
    dateTag = '[object Date]',
    errorTag = '[object Error]',
    funcTag = '[object Function]',
    genTag = '[object GeneratorFunction]',
    mapTag = '[object Map]',
    numberTag = '[object Number]',
    objectTag = '[object Object]',
    promiseTag = '[object Promise]',
    regexpTag = '[object RegExp]',
    setTag = '[object Set]',
    stringTag = '[object String]',
    symbolTag = '[object Symbol]',
    weakMapTag = '[object WeakMap]';

var arrayBufferTag = '[object ArrayBuffer]',
    dataViewTag = '[object DataView]',
    float32Tag = '[object Float32Array]',
    float64Tag = '[object Float64Array]',
    int8Tag = '[object Int8Array]',
    int16Tag = '[object Int16Array]',
    int32Tag = '[object Int32Array]',
    uint8Tag = '[object Uint8Array]',
    uint8ClampedTag = '[object Uint8ClampedArray]',
    uint16Tag = '[object Uint16Array]',
    uint32Tag = '[object Uint32Array]';

/**
 * Used to match `RegExp`
 * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
 */
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;

/** Used to detect host constructors (Safari). */
var reIsHostCtor = /^\[object .+?Constructor\]$/;

/** Used to detect unsigned integer values. */
var reIsUint = /^(?:0|[1-9]\d*)$/;

/** Used to identify `toStringTag` values of typed arrays. */
var typedArrayTags = {};
typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
typedArrayTags[uint32Tag] = true;
typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
typedArrayTags[errorTag] = typedArrayTags[funcTag] =
typedArrayTags[mapTag] = typedArrayTags[numberTag] =
typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
typedArrayTags[setTag] = typedArrayTags[stringTag] =
typedArrayTags[weakMapTag] = false;

/** Detect free variable `global` from Node.js. */
var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;

/** Detect free variable `self`. */
var freeSelf = typeof self == 'object' && self && self.Object === Object && self;

/** Used as a reference to the global object. */
var root = freeGlobal || freeSelf || Function('return this')();

/** Detect free variable `exports`. */
var freeExports =  true && exports && !exports.nodeType && exports;

/** Detect free variable `module`. */
var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;

/** Detect the popular CommonJS extension `module.exports`. */
var moduleExports = freeModule && freeModule.exports === freeExports;

/** Detect free variable `process` from Node.js. */
var freeProcess = moduleExports && freeGlobal.process;

/** Used to access faster Node.js helpers. */
var nodeUtil = (function() {
  try {
    return freeProcess && freeProcess.binding('util');
  } catch (e) {}
}());

/* Node.js helper references. */
var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;

/**
 * A specialized version of `_.some` for arrays without support for iteratee
 * shorthands.
 *
 * @private
 * @param {Array} [array] The array to iterate over.
 * @param {Function} predicate The function invoked per iteration.
 * @returns {boolean} Returns `true` if any element passes the predicate check,
 *  else `false`.
 */
function arraySome(array, predicate) {
  var index = -1,
      length = array ? array.length : 0;

  while (++index < length) {
    if (predicate(array[index], index, array)) {
      return true;
    }
  }
  return false;
}

/**
 * The base implementation of `_.times` without support for iteratee shorthands
 * or max array length checks.
 *
 * @private
 * @param {number} n The number of times to invoke `iteratee`.
 * @param {Function} iteratee The function invoked per iteration.
 * @returns {Array} Returns the array of results.
 */
function baseTimes(n, iteratee) {
  var index = -1,
      result = Array(n);

  while (++index < n) {
    result[index] = iteratee(index);
  }
  return result;
}

/**
 * The base implementation of `_.unary` without support for storing metadata.
 *
 * @private
 * @param {Function} func The function to cap arguments for.
 * @returns {Function} Returns the new capped function.
 */
function baseUnary(func) {
  return function(value) {
    return func(value);
  };
}

/**
 * Gets the value at `key` of `object`.
 *
 * @private
 * @param {Object} [object] The object to query.
 * @param {string} key The key of the property to get.
 * @returns {*} Returns the property value.
 */
function getValue(object, key) {
  return object == null ? undefined : object[key];
}

/**
 * Checks if `value` is a host object in IE < 9.
 *
 * @private
 * @param {*} value The value to check.
 * @returns {boolean} Returns `true` if `value` is a host object, else `false`.
 */
function isHostObject(value) {
  // Many host objects are `Object` objects that can coerce to strings
  // despite having improperly defined `toString` methods.
  var result = false;
  if (value != null && typeof value.toString != 'function') {
    try {
      result = !!(value + '');
    } catch (e) {}
  }
  return result;
}

/**
 * Converts `map` to its key-value pairs.
 *
 * @private
 * @param {Object} map The map to convert.
 * @returns {Array} Returns the key-value pairs.
 */
function mapToArray(map) {
  var index = -1,
      result = Array(map.size);

  map.forEach(function(value, key) {
    result[++index] = [key, value];
  });
  return result;
}

/**
 * Creates a unary function that invokes `func` with its argument transformed.
 *
 * @private
 * @param {Function} func The function to wrap.
 * @param {Function} transform The argument transform.
 * @returns {Function} Returns the new function.
 */
function overArg(func, transform) {
  return function(arg) {
    return func(transform(arg));
  };
}

/**
 * Converts `set` to an array of its values.
 *
 * @private
 * @param {Object} set The set to convert.
 * @returns {Array} Returns the values.
 */
function setToArray(set) {
  var index = -1,
      result = Array(set.size);

  set.forEach(function(value) {
    result[++index] = value;
  });
  return result;
}

/** Used for built-in method references. */
var arrayProto = Array.prototype,
    funcProto = Function.prototype,
    objectProto = Object.prototype;

/** Used to detect overreaching core-js shims. */
var coreJsData = root['__core-js_shared__'];

/** Used to detect methods masquerading as native. */
var maskSrcKey = (function() {
  var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
  return uid ? ('Symbol(src)_1.' + uid) : '';
}());

/** Used to resolve the decompiled source of functions. */
var funcToString = funcProto.toString;

/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;

/**
 * Used to resolve the
 * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
 * of values.
 */
var objectToString = objectProto.toString;

/** Used to detect if a method is native. */
var reIsNative = RegExp('^' +
  funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
  .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
);

/** Built-in value references. */
var Symbol = root.Symbol,
    Uint8Array = root.Uint8Array,
    propertyIsEnumerable = objectProto.propertyIsEnumerable,
    splice = arrayProto.splice;

/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeKeys = overArg(Object.keys, Object);

/* Built-in method references that are verified to be native. */
var DataView = getNative(root, 'DataView'),
    Map = getNative(root, 'Map'),
    Promise = getNative(root, 'Promise'),
    Set = getNative(root, 'Set'),
    WeakMap = getNative(root, 'WeakMap'),
    nativeCreate = getNative(Object, 'create');

/** Used to detect maps, sets, and weakmaps. */
var dataViewCtorString = toSource(DataView),
    mapCtorString = toSource(Map),
    promiseCtorString = toSource(Promise),
    setCtorString = toSource(Set),
    weakMapCtorString = toSource(WeakMap);

/** Used to convert symbols to primitives and strings. */
var symbolProto = Symbol ? Symbol.prototype : undefined,
    symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;

/**
 * Creates a hash object.
 *
 * @private
 * @constructor
 * @param {Array} [entries] The key-value pairs to cache.
 */
function Hash(entries) {
  var index = -1,
      length = entries ? entries.length : 0;

  this.clear();
  while (++index < length) {
    var entry = entries[index];
    this.set(entry[0], entry[1]);
  }
}

/**
 * Removes all key-value entries from the hash.
 *
 * @private
 * @name clear
 * @memberOf Hash
 */
function hashClear() {
  this.__data__ = nativeCreate ? nativeCreate(null) : {};
}

/**
 * Removes `key` and its value from the hash.
 *
 * @private
 * @name delete
 * @memberOf Hash
 * @param {Object} hash The hash to modify.
 * @param {string} key The key of the value to remove.
 * @returns {boolean} Returns `true` if the entry was removed, else `false`.
 */
function hashDelete(key) {
  return this.has(key) && delete this.__data__[key];
}

/**
 * Gets the hash value for `key`.
 *
 * @private
 * @name get
 * @memberOf Hash
 * @param {string} key The key of the value to get.
 * @returns {*} Returns the entry value.
 */
function hashGet(key) {
  var data = this.__data__;
  if (nativeCreate) {
    var result = data[key];
    return result === HASH_UNDEFINED ? undefined : result;
  }
  return hasOwnProperty.call(data, key) ? data[key] : undefined;
}

/**
 * Checks if a hash value for `key` exists.
 *
 * @private
 * @name has
 * @memberOf Hash
 * @param {string} key The key of the entry to check.
 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
 */
function hashHas(key) {
  var data = this.__data__;
  return nativeCreate ? data[key] !== undefined : hasOwnProperty.call(data, key);
}

/**
 * Sets the hash `key` to `value`.
 *
 * @private
 * @name set
 * @memberOf Hash
 * @param {string} key The key of the value to set.
 * @param {*} value The value to set.
 * @returns {Object} Returns the hash instance.
 */
function hashSet(key, value) {
  var data = this.__data__;
  data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
  return this;
}

// Add methods to `Hash`.
Hash.prototype.clear = hashClear;
Hash.prototype['delete'] = hashDelete;
Hash.prototype.get = hashGet;
Hash.prototype.has = hashHas;
Hash.prototype.set = hashSet;

/**
 * Creates an list cache object.
 *
 * @private
 * @constructor
 * @param {Array} [entries] The key-value pairs to cache.
 */
function ListCache(entries) {
  var index = -1,
      length = entries ? entries.length : 0;

  this.clear();
  while (++index < length) {
    var entry = entries[index];
    this.set(entry[0], entry[1]);
  }
}

/**
 * Removes all key-value entries from the list cache.
 *
 * @private
 * @name clear
 * @memberOf ListCache
 */
function listCacheClear() {
  this.__data__ = [];
}

/**
 * Removes `key` and its value from the list cache.
 *
 * @private
 * @name delete
 * @memberOf ListCache
 * @param {string} key The key of the value to remove.
 * @returns {boolean} Returns `true` if the entry was removed, else `false`.
 */
function listCacheDelete(key) {
  var data = this.__data__,
      index = assocIndexOf(data, key);

  if (index < 0) {
    return false;
  }
  var lastIndex = data.length - 1;
  if (index == lastIndex) {
    data.pop();
  } else {
    splice.call(data, index, 1);
  }
  return true;
}

/**
 * Gets the list cache value for `key`.
 *
 * @private
 * @name get
 * @memberOf ListCache
 * @param {string} key The key of the value to get.
 * @returns {*} Returns the entry value.
 */
function listCacheGet(key) {
  var data = this.__data__,
      index = assocIndexOf(data, key);

  return index < 0 ? undefined : data[index][1];
}

/**
 * Checks if a list cache value for `key` exists.
 *
 * @private
 * @name has
 * @memberOf ListCache
 * @param {string} key The key of the entry to check.
 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
 */
function listCacheHas(key) {
  return assocIndexOf(this.__data__, key) > -1;
}

/**
 * Sets the list cache `key` to `value`.
 *
 * @private
 * @name set
 * @memberOf ListCache
 * @param {string} key The key of the value to set.
 * @param {*} value The value to set.
 * @returns {Object} Returns the list cache instance.
 */
function listCacheSet(key, value) {
  var data = this.__data__,
      index = assocIndexOf(data, key);

  if (index < 0) {
    data.push([key, value]);
  } else {
    data[index][1] = value;
  }
  return this;
}

// Add methods to `ListCache`.
ListCache.prototype.clear = listCacheClear;
ListCache.prototype['delete'] = listCacheDelete;
ListCache.prototype.get = listCacheGet;
ListCache.prototype.has = listCacheHas;
ListCache.prototype.set = listCacheSet;

/**
 * Creates a map cache object to store key-value pairs.
 *
 * @private
 * @constructor
 * @param {Array} [entries] The key-value pairs to cache.
 */
function MapCache(entries) {
  var index = -1,
      length = entries ? entries.length : 0;

  this.clear();
  while (++index < length) {
    var entry = entries[index];
    this.set(entry[0], entry[1]);
  }
}

/**
 * Removes all key-value entries from the map.
 *
 * @private
 * @name clear
 * @memberOf MapCache
 */
function mapCacheClear() {
  this.__data__ = {
    'hash': new Hash,
    'map': new (Map || ListCache),
    'string': new Hash
  };
}

/**
 * Removes `key` and its value from the map.
 *
 * @private
 * @name delete
 * @memberOf MapCache
 * @param {string} key The key of the value to remove.
 * @returns {boolean} Returns `true` if the entry was removed, else `false`.
 */
function mapCacheDelete(key) {
  return getMapData(this, key)['delete'](key);
}

/**
 * Gets the map value for `key`.
 *
 * @private
 * @name get
 * @memberOf MapCache
 * @param {string} key The key of the value to get.
 * @returns {*} Returns the entry value.
 */
function mapCacheGet(key) {
  return getMapData(this, key).get(key);
}

/**
 * Checks if a map value for `key` exists.
 *
 * @private
 * @name has
 * @memberOf MapCache
 * @param {string} key The key of the entry to check.
 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
 */
function mapCacheHas(key) {
  return getMapData(this, key).has(key);
}

/**
 * Sets the map `key` to `value`.
 *
 * @private
 * @name set
 * @memberOf MapCache
 * @param {string} key The key of the value to set.
 * @param {*} value The value to set.
 * @returns {Object} Returns the map cache instance.
 */
function mapCacheSet(key, value) {
  getMapData(this, key).set(key, value);
  return this;
}

// Add methods to `MapCache`.
MapCache.prototype.clear = mapCacheClear;
MapCache.prototype['delete'] = mapCacheDelete;
MapCache.prototype.get = mapCacheGet;
MapCache.prototype.has = mapCacheHas;
MapCache.prototype.set = mapCacheSet;

/**
 *
 * Creates an array cache object to store unique values.
 *
 * @private
 * @constructor
 * @param {Array} [values] The values to cache.
 */
function SetCache(values) {
  var index = -1,
      length = values ? values.length : 0;

  this.__data__ = new MapCache;
  while (++index < length) {
    this.add(values[index]);
  }
}

/**
 * Adds `value` to the array cache.
 *
 * @private
 * @name add
 * @memberOf SetCache
 * @alias push
 * @param {*} value The value to cache.
 * @returns {Object} Returns the cache instance.
 */
function setCacheAdd(value) {
  this.__data__.set(value, HASH_UNDEFINED);
  return this;
}

/**
 * Checks if `value` is in the array cache.
 *
 * @private
 * @name has
 * @memberOf SetCache
 * @param {*} value The value to search for.
 * @returns {number} Returns `true` if `value` is found, else `false`.
 */
function setCacheHas(value) {
  return this.__data__.has(value);
}

// Add methods to `SetCache`.
SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
SetCache.prototype.has = setCacheHas;

/**
 * Creates a stack cache object to store key-value pairs.
 *
 * @private
 * @constructor
 * @param {Array} [entries] The key-value pairs to cache.
 */
function Stack(entries) {
  this.__data__ = new ListCache(entries);
}

/**
 * Removes all key-value entries from the stack.
 *
 * @private
 * @name clear
 * @memberOf Stack
 */
function stackClear() {
  this.__data__ = new ListCache;
}

/**
 * Removes `key` and its value from the stack.
 *
 * @private
 * @name delete
 * @memberOf Stack
 * @param {string} key The key of the value to remove.
 * @returns {boolean} Returns `true` if the entry was removed, else `false`.
 */
function stackDelete(key) {
  return this.__data__['delete'](key);
}

/**
 * Gets the stack value for `key`.
 *
 * @private
 * @name get
 * @memberOf Stack
 * @param {string} key The key of the value to get.
 * @returns {*} Returns the entry value.
 */
function stackGet(key) {
  return this.__data__.get(key);
}

/**
 * Checks if a stack value for `key` exists.
 *
 * @private
 * @name has
 * @memberOf Stack
 * @param {string} key The key of the entry to check.
 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
 */
function stackHas(key) {
  return this.__data__.has(key);
}

/**
 * Sets the stack `key` to `value`.
 *
 * @private
 * @name set
 * @memberOf Stack
 * @param {string} key The key of the value to set.
 * @param {*} value The value to set.
 * @returns {Object} Returns the stack cache instance.
 */
function stackSet(key, value) {
  var cache = this.__data__;
  if (cache instanceof ListCache) {
    var pairs = cache.__data__;
    if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
      pairs.push([key, value]);
      return this;
    }
    cache = this.__data__ = new MapCache(pairs);
  }
  cache.set(key, value);
  return this;
}

// Add methods to `Stack`.
Stack.prototype.clear = stackClear;
Stack.prototype['delete'] = stackDelete;
Stack.prototype.get = stackGet;
Stack.prototype.has = stackHas;
Stack.prototype.set = stackSet;

/**
 * Creates an array of the enumerable property names of the array-like `value`.
 *
 * @private
 * @param {*} value The value to query.
 * @param {boolean} inherited Specify returning inherited property names.
 * @returns {Array} Returns the array of property names.
 */
function arrayLikeKeys(value, inherited) {
  // Safari 8.1 makes `arguments.callee` enumerable in strict mode.
  // Safari 9 makes `arguments.length` enumerable in strict mode.
  var result = (isArray(value) || isArguments(value))
    ? baseTimes(value.length, String)
    : [];

  var length = result.length,
      skipIndexes = !!length;

  for (var key in value) {
    if ((inherited || hasOwnProperty.call(value, key)) &&
        !(skipIndexes && (key == 'length' || isIndex(key, length)))) {
      result.push(key);
    }
  }
  return result;
}

/**
 * Gets the index at which the `key` is found in `array` of key-value pairs.
 *
 * @private
 * @param {Array} array The array to inspect.
 * @param {*} key The key to search for.
 * @returns {number} Returns the index of the matched value, else `-1`.
 */
function assocIndexOf(array, key) {
  var length = array.length;
  while (length--) {
    if (eq(array[length][0], key)) {
      return length;
    }
  }
  return -1;
}

/**
 * The base implementation of `getTag`.
 *
 * @private
 * @param {*} value The value to query.
 * @returns {string} Returns the `toStringTag`.
 */
function baseGetTag(value) {
  return objectToString.call(value);
}

/**
 * The base implementation of `_.isEqual` which supports partial comparisons
 * and tracks traversed objects.
 *
 * @private
 * @param {*} value The value to compare.
 * @param {*} other The other value to compare.
 * @param {Function} [customizer] The function to customize comparisons.
 * @param {boolean} [bitmask] The bitmask of comparison flags.
 *  The bitmask may be composed of the following flags:
 *     1 - Unordered comparison
 *     2 - Partial comparison
 * @param {Object} [stack] Tracks traversed `value` and `other` objects.
 * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
 */
function baseIsEqual(value, other, customizer, bitmask, stack) {
  if (value === other) {
    return true;
  }
  if (value == null || other == null || (!isObject(value) && !isObjectLike(other))) {
    return value !== value && other !== other;
  }
  return baseIsEqualDeep(value, other, baseIsEqual, customizer, bitmask, stack);
}

/**
 * A specialized version of `baseIsEqual` for arrays and objects which performs
 * deep comparisons and tracks traversed objects enabling objects with circular
 * references to be compared.
 *
 * @private
 * @param {Object} object The object to compare.
 * @param {Object} other The other object to compare.
 * @param {Function} equalFunc The function to determine equivalents of values.
 * @param {Function} [customizer] The function to customize comparisons.
 * @param {number} [bitmask] The bitmask of comparison flags. See `baseIsEqual`
 *  for more details.
 * @param {Object} [stack] Tracks traversed `object` and `other` objects.
 * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
 */
function baseIsEqualDeep(object, other, equalFunc, customizer, bitmask, stack) {
  var objIsArr = isArray(object),
      othIsArr = isArray(other),
      objTag = arrayTag,
      othTag = arrayTag;

  if (!objIsArr) {
    objTag = getTag(object);
    objTag = objTag == argsTag ? objectTag : objTag;
  }
  if (!othIsArr) {
    othTag = getTag(other);
    othTag = othTag == argsTag ? objectTag : othTag;
  }
  var objIsObj = objTag == objectTag && !isHostObject(object),
      othIsObj = othTag == objectTag && !isHostObject(other),
      isSameTag = objTag == othTag;

  if (isSameTag && !objIsObj) {
    stack || (stack = new Stack);
    return (objIsArr || isTypedArray(object))
      ? equalArrays(object, other, equalFunc, customizer, bitmask, stack)
      : equalByTag(object, other, objTag, equalFunc, customizer, bitmask, stack);
  }
  if (!(bitmask & PARTIAL_COMPARE_FLAG)) {
    var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
        othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');

    if (objIsWrapped || othIsWrapped) {
      var objUnwrapped = objIsWrapped ? object.value() : object,
          othUnwrapped = othIsWrapped ? other.value() : other;

      stack || (stack = new Stack);
      return equalFunc(objUnwrapped, othUnwrapped, customizer, bitmask, stack);
    }
  }
  if (!isSameTag) {
    return false;
  }
  stack || (stack = new Stack);
  return equalObjects(object, other, equalFunc, customizer, bitmask, stack);
}

/**
 * The base implementation of `_.isNative` without bad shim checks.
 *
 * @private
 * @param {*} value The value to check.
 * @returns {boolean} Returns `true` if `value` is a native function,
 *  else `false`.
 */
function baseIsNative(value) {
  if (!isObject(value) || isMasked(value)) {
    return false;
  }
  var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor;
  return pattern.test(toSource(value));
}

/**
 * The base implementation of `_.isTypedArray` without Node.js optimizations.
 *
 * @private
 * @param {*} value The value to check.
 * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
 */
function baseIsTypedArray(value) {
  return isObjectLike(value) &&
    isLength(value.length) && !!typedArrayTags[objectToString.call(value)];
}

/**
 * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
 *
 * @private
 * @param {Object} object The object to query.
 * @returns {Array} Returns the array of property names.
 */
function baseKeys(object) {
  if (!isPrototype(object)) {
    return nativeKeys(object);
  }
  var result = [];
  for (var key in Object(object)) {
    if (hasOwnProperty.call(object, key) && key != 'constructor') {
      result.push(key);
    }
  }
  return result;
}

/**
 * A specialized version of `baseIsEqualDeep` for arrays with support for
 * partial deep comparisons.
 *
 * @private
 * @param {Array} array The array to compare.
 * @param {Array} other The other array to compare.
 * @param {Function} equalFunc The function to determine equivalents of values.
 * @param {Function} customizer The function to customize comparisons.
 * @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual`
 *  for more details.
 * @param {Object} stack Tracks traversed `array` and `other` objects.
 * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
 */
function equalArrays(array, other, equalFunc, customizer, bitmask, stack) {
  var isPartial = bitmask & PARTIAL_COMPARE_FLAG,
      arrLength = array.length,
      othLength = other.length;

  if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
    return false;
  }
  // Assume cyclic values are equal.
  var stacked = stack.get(array);
  if (stacked && stack.get(other)) {
    return stacked == other;
  }
  var index = -1,
      result = true,
      seen = (bitmask & UNORDERED_COMPARE_FLAG) ? new SetCache : undefined;

  stack.set(array, other);
  stack.set(other, array);

  // Ignore non-index properties.
  while (++index < arrLength) {
    var arrValue = array[index],
        othValue = other[index];

    if (customizer) {
      var compared = isPartial
        ? customizer(othValue, arrValue, index, other, array, stack)
        : customizer(arrValue, othValue, index, array, other, stack);
    }
    if (compared !== undefined) {
      if (compared) {
        continue;
      }
      result = false;
      break;
    }
    // Recursively compare arrays (susceptible to call stack limits).
    if (seen) {
      if (!arraySome(other, function(othValue, othIndex) {
            if (!seen.has(othIndex) &&
                (arrValue === othValue || equalFunc(arrValue, othValue, customizer, bitmask, stack))) {
              return seen.add(othIndex);
            }
          })) {
        result = false;
        break;
      }
    } else if (!(
          arrValue === othValue ||
            equalFunc(arrValue, othValue, customizer, bitmask, stack)
        )) {
      result = false;
      break;
    }
  }
  stack['delete'](array);
  stack['delete'](other);
  return result;
}

/**
 * A specialized version of `baseIsEqualDeep` for comparing objects of
 * the same `toStringTag`.
 *
 * **Note:** This function only supports comparing values with tags of
 * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
 *
 * @private
 * @param {Object} object The object to compare.
 * @param {Object} other The other object to compare.
 * @param {string} tag The `toStringTag` of the objects to compare.
 * @param {Function} equalFunc The function to determine equivalents of values.
 * @param {Function} customizer The function to customize comparisons.
 * @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual`
 *  for more details.
 * @param {Object} stack Tracks traversed `object` and `other` objects.
 * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
 */
function equalByTag(object, other, tag, equalFunc, customizer, bitmask, stack) {
  switch (tag) {
    case dataViewTag:
      if ((object.byteLength != other.byteLength) ||
          (object.byteOffset != other.byteOffset)) {
        return false;
      }
      object = object.buffer;
      other = other.buffer;

    case arrayBufferTag:
      if ((object.byteLength != other.byteLength) ||
          !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
        return false;
      }
      return true;

    case boolTag:
    case dateTag:
    case numberTag:
      // Coerce booleans to `1` or `0` and dates to milliseconds.
      // Invalid dates are coerced to `NaN`.
      return eq(+object, +other);

    case errorTag:
      return object.name == other.name && object.message == other.message;

    case regexpTag:
    case stringTag:
      // Coerce regexes to strings and treat strings, primitives and objects,
      // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
      // for more details.
      return object == (other + '');

    case mapTag:
      var convert = mapToArray;

    case setTag:
      var isPartial = bitmask & PARTIAL_COMPARE_FLAG;
      convert || (convert = setToArray);

      if (object.size != other.size && !isPartial) {
        return false;
      }
      // Assume cyclic values are equal.
      var stacked = stack.get(object);
      if (stacked) {
        return stacked == other;
      }
      bitmask |= UNORDERED_COMPARE_FLAG;

      // Recursively compare objects (susceptible to call stack limits).
      stack.set(object, other);
      var result = equalArrays(convert(object), convert(other), equalFunc, customizer, bitmask, stack);
      stack['delete'](object);
      return result;

    case symbolTag:
      if (symbolValueOf) {
        return symbolValueOf.call(object) == symbolValueOf.call(other);
      }
  }
  return false;
}

/**
 * A specialized version of `baseIsEqualDeep` for objects with support for
 * partial deep comparisons.
 *
 * @private
 * @param {Object} object The object to compare.
 * @param {Object} other The other object to compare.
 * @param {Function} equalFunc The function to determine equivalents of values.
 * @param {Function} customizer The function to customize comparisons.
 * @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual`
 *  for more details.
 * @param {Object} stack Tracks traversed `object` and `other` objects.
 * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
 */
function equalObjects(object, other, equalFunc, customizer, bitmask, stack) {
  var isPartial = bitmask & PARTIAL_COMPARE_FLAG,
      objProps = keys(object),
      objLength = objProps.length,
      othProps = keys(other),
      othLength = othProps.length;

  if (objLength != othLength && !isPartial) {
    return false;
  }
  var index = objLength;
  while (index--) {
    var key = objProps[index];
    if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
      return false;
    }
  }
  // Assume cyclic values are equal.
  var stacked = stack.get(object);
  if (stacked && stack.get(other)) {
    return stacked == other;
  }
  var result = true;
  stack.set(object, other);
  stack.set(other, object);

  var skipCtor = isPartial;
  while (++index < objLength) {
    key = objProps[index];
    var objValue = object[key],
        othValue = other[key];

    if (customizer) {
      var compared = isPartial
        ? customizer(othValue, objValue, key, other, object, stack)
        : customizer(objValue, othValue, key, object, other, stack);
    }
    // Recursively compare objects (susceptible to call stack limits).
    if (!(compared === undefined
          ? (objValue === othValue || equalFunc(objValue, othValue, customizer, bitmask, stack))
          : compared
        )) {
      result = false;
      break;
    }
    skipCtor || (skipCtor = key == 'constructor');
  }
  if (result && !skipCtor) {
    var objCtor = object.constructor,
        othCtor = other.constructor;

    // Non `Object` object instances with different constructors are not equal.
    if (objCtor != othCtor &&
        ('constructor' in object && 'constructor' in other) &&
        !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
          typeof othCtor == 'function' && othCtor instanceof othCtor)) {
      result = false;
    }
  }
  stack['delete'](object);
  stack['delete'](other);
  return result;
}

/**
 * Gets the data for `map`.
 *
 * @private
 * @param {Object} map The map to query.
 * @param {string} key The reference key.
 * @returns {*} Returns the map data.
 */
function getMapData(map, key) {
  var data = map.__data__;
  return isKeyable(key)
    ? data[typeof key == 'string' ? 'string' : 'hash']
    : data.map;
}

/**
 * Gets the native function at `key` of `object`.
 *
 * @private
 * @param {Object} object The object to query.
 * @param {string} key The key of the method to get.
 * @returns {*} Returns the function if it's native, else `undefined`.
 */
function getNative(object, key) {
  var value = getValue(object, key);
  return baseIsNative(value) ? value : undefined;
}

/**
 * Gets the `toStringTag` of `value`.
 *
 * @private
 * @param {*} value The value to query.
 * @returns {string} Returns the `toStringTag`.
 */
var getTag = baseGetTag;

// Fallback for data views, maps, sets, and weak maps in IE 11,
// for data views in Edge < 14, and promises in Node.js.
if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
    (Map && getTag(new Map) != mapTag) ||
    (Promise && getTag(Promise.resolve()) != promiseTag) ||
    (Set && getTag(new Set) != setTag) ||
    (WeakMap && getTag(new WeakMap) != weakMapTag)) {
  getTag = function(value) {
    var result = objectToString.call(value),
        Ctor = result == objectTag ? value.constructor : undefined,
        ctorString = Ctor ? toSource(Ctor) : undefined;

    if (ctorString) {
      switch (ctorString) {
        case dataViewCtorString: return dataViewTag;
        case mapCtorString: return mapTag;
        case promiseCtorString: return promiseTag;
        case setCtorString: return setTag;
        case weakMapCtorString: return weakMapTag;
      }
    }
    return result;
  };
}

/**
 * Checks if `value` is a valid array-like index.
 *
 * @private
 * @param {*} value The value to check.
 * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
 * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
 */
function isIndex(value, length) {
  length = length == null ? MAX_SAFE_INTEGER : length;
  return !!length &&
    (typeof value == 'number' || reIsUint.test(value)) &&
    (value > -1 && value % 1 == 0 && value < length);
}

/**
 * Checks if `value` is suitable for use as unique object key.
 *
 * @private
 * @param {*} value The value to check.
 * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
 */
function isKeyable(value) {
  var type = typeof value;
  return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
    ? (value !== '__proto__')
    : (value === null);
}

/**
 * Checks if `func` has its source masked.
 *
 * @private
 * @param {Function} func The function to check.
 * @returns {boolean} Returns `true` if `func` is masked, else `false`.
 */
function isMasked(func) {
  return !!maskSrcKey && (maskSrcKey in func);
}

/**
 * Checks if `value` is likely a prototype object.
 *
 * @private
 * @param {*} value The value to check.
 * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
 */
function isPrototype(value) {
  var Ctor = value && value.constructor,
      proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;

  return value === proto;
}

/**
 * Converts `func` to its source code.
 *
 * @private
 * @param {Function} func The function to process.
 * @returns {string} Returns the source code.
 */
function toSource(func) {
  if (func != null) {
    try {
      return funcToString.call(func);
    } catch (e) {}
    try {
      return (func + '');
    } catch (e) {}
  }
  return '';
}

/**
 * Performs a
 * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
 * comparison between two values to determine if they are equivalent.
 *
 * @static
 * @memberOf _
 * @since 4.0.0
 * @category Lang
 * @param {*} value The value to compare.
 * @param {*} other The other value to compare.
 * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
 * @example
 *
 * var object = { 'a': 1 };
 * var other = { 'a': 1 };
 *
 * _.eq(object, object);
 * // => true
 *
 * _.eq(object, other);
 * // => false
 *
 * _.eq('a', 'a');
 * // => true
 *
 * _.eq('a', Object('a'));
 * // => false
 *
 * _.eq(NaN, NaN);
 * // => true
 */
function eq(value, other) {
  return value === other || (value !== value && other !== other);
}

/**
 * Checks if `value` is likely an `arguments` object.
 *
 * @static
 * @memberOf _
 * @since 0.1.0
 * @category Lang
 * @param {*} value The value to check.
 * @returns {boolean} Returns `true` if `value` is an `arguments` object,
 *  else `false`.
 * @example
 *
 * _.isArguments(function() { return arguments; }());
 * // => true
 *
 * _.isArguments([1, 2, 3]);
 * // => false
 */
function isArguments(value) {
  // Safari 8.1 makes `arguments.callee` enumerable in strict mode.
  return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') &&
    (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag);
}

/**
 * Checks if `value` is classified as an `Array` object.
 *
 * @static
 * @memberOf _
 * @since 0.1.0
 * @category Lang
 * @param {*} value The value to check.
 * @returns {boolean} Returns `true` if `value` is an array, else `false`.
 * @example
 *
 * _.isArray([1, 2, 3]);
 * // => true
 *
 * _.isArray(document.body.children);
 * // => false
 *
 * _.isArray('abc');
 * // => false
 *
 * _.isArray(_.noop);
 * // => false
 */
var isArray = Array.isArray;

/**
 * Checks if `value` is array-like. A value is considered array-like if it's
 * not a function and has a `value.length` that's an integer greater than or
 * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
 *
 * @static
 * @memberOf _
 * @since 4.0.0
 * @category Lang
 * @param {*} value The value to check.
 * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
 * @example
 *
 * _.isArrayLike([1, 2, 3]);
 * // => true
 *
 * _.isArrayLike(document.body.children);
 * // => true
 *
 * _.isArrayLike('abc');
 * // => true
 *
 * _.isArrayLike(_.noop);
 * // => false
 */
function isArrayLike(value) {
  return value != null && isLength(value.length) && !isFunction(value);
}

/**
 * This method is like `_.isArrayLike` except that it also checks if `value`
 * is an object.
 *
 * @static
 * @memberOf _
 * @since 4.0.0
 * @category Lang
 * @param {*} value The value to check.
 * @returns {boolean} Returns `true` if `value` is an array-like object,
 *  else `false`.
 * @example
 *
 * _.isArrayLikeObject([1, 2, 3]);
 * // => true
 *
 * _.isArrayLikeObject(document.body.children);
 * // => true
 *
 * _.isArrayLikeObject('abc');
 * // => false
 *
 * _.isArrayLikeObject(_.noop);
 * // => false
 */
function isArrayLikeObject(value) {
  return isObjectLike(value) && isArrayLike(value);
}

/**
 * This method is like `_.isEqual` except that it accepts `customizer` which
 * is invoked to compare values. If `customizer` returns `undefined`, comparisons
 * are handled by the method instead. The `customizer` is invoked with up to
 * six arguments: (objValue, othValue [, index|key, object, other, stack]).
 *
 * @static
 * @memberOf _
 * @since 4.0.0
 * @category Lang
 * @param {*} value The value to compare.
 * @param {*} other The other value to compare.
 * @param {Function} [customizer] The function to customize comparisons.
 * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
 * @example
 *
 * function isGreeting(value) {
 *   return /^h(?:i|ello)$/.test(value);
 * }
 *
 * function customizer(objValue, othValue) {
 *   if (isGreeting(objValue) && isGreeting(othValue)) {
 *     return true;
 *   }
 * }
 *
 * var array = ['hello', 'goodbye'];
 * var other = ['hi', 'goodbye'];
 *
 * _.isEqualWith(array, other, customizer);
 * // => true
 */
function isEqualWith(value, other, customizer) {
  customizer = typeof customizer == 'function' ? customizer : undefined;
  var result = customizer ? customizer(value, other) : undefined;
  return result === undefined ? baseIsEqual(value, other, customizer) : !!result;
}

/**
 * Checks if `value` is classified as a `Function` object.
 *
 * @static
 * @memberOf _
 * @since 0.1.0
 * @category Lang
 * @param {*} value The value to check.
 * @returns {boolean} Returns `true` if `value` is a function, else `false`.
 * @example
 *
 * _.isFunction(_);
 * // => true
 *
 * _.isFunction(/abc/);
 * // => false
 */
function isFunction(value) {
  // The use of `Object#toString` avoids issues with the `typeof` operator
  // in Safari 8-9 which returns 'object' for typed array and other constructors.
  var tag = isObject(value) ? objectToString.call(value) : '';
  return tag == funcTag || tag == genTag;
}

/**
 * Checks if `value` is a valid array-like length.
 *
 * **Note:** This method is loosely based on
 * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
 *
 * @static
 * @memberOf _
 * @since 4.0.0
 * @category Lang
 * @param {*} value The value to check.
 * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
 * @example
 *
 * _.isLength(3);
 * // => true
 *
 * _.isLength(Number.MIN_VALUE);
 * // => false
 *
 * _.isLength(Infinity);
 * // => false
 *
 * _.isLength('3');
 * // => false
 */
function isLength(value) {
  return typeof value == 'number' &&
    value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
}

/**
 * Checks if `value` is the
 * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
 * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
 *
 * @static
 * @memberOf _
 * @since 0.1.0
 * @category Lang
 * @param {*} value The value to check.
 * @returns {boolean} Returns `true` if `value` is an object, else `false`.
 * @example
 *
 * _.isObject({});
 * // => true
 *
 * _.isObject([1, 2, 3]);
 * // => true
 *
 * _.isObject(_.noop);
 * // => true
 *
 * _.isObject(null);
 * // => false
 */
function isObject(value) {
  var type = typeof value;
  return !!value && (type == 'object' || type == 'function');
}

/**
 * Checks if `value` is object-like. A value is object-like if it's not `null`
 * and has a `typeof` result of "object".
 *
 * @static
 * @memberOf _
 * @since 4.0.0
 * @category Lang
 * @param {*} value The value to check.
 * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
 * @example
 *
 * _.isObjectLike({});
 * // => true
 *
 * _.isObjectLike([1, 2, 3]);
 * // => true
 *
 * _.isObjectLike(_.noop);
 * // => false
 *
 * _.isObjectLike(null);
 * // => false
 */
function isObjectLike(value) {
  return !!value && typeof value == 'object';
}

/**
 * Checks if `value` is classified as a typed array.
 *
 * @static
 * @memberOf _
 * @since 3.0.0
 * @category Lang
 * @param {*} value The value to check.
 * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
 * @example
 *
 * _.isTypedArray(new Uint8Array);
 * // => true
 *
 * _.isTypedArray([]);
 * // => false
 */
var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;

/**
 * Creates an array of the own enumerable property names of `object`.
 *
 * **Note:** Non-object values are coerced to objects. See the
 * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
 * for more details.
 *
 * @static
 * @since 0.1.0
 * @memberOf _
 * @category Object
 * @param {Object} object The object to query.
 * @returns {Array} Returns the array of property names.
 * @example
 *
 * function Foo() {
 *   this.a = 1;
 *   this.b = 2;
 * }
 *
 * Foo.prototype.c = 3;
 *
 * _.keys(new Foo);
 * // => ['a', 'b'] (iteration order is not guaranteed)
 *
 * _.keys('hi');
 * // => ['0', '1']
 */
function keys(object) {
  return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
}

module.exports = isEqualWith;

/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(12), __webpack_require__(18)(module)))

/***/ }),
/* 72 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var __awaiter = (this && this.__awaiter) || function (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());
    });
};
var __generator = (this && this.__generator) || function (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 };
    }
};
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.CreatePostModule = void 0;
var ramda_1 = __webpack_require__(4);
var lodash_debounce_1 = __importDefault(__webpack_require__(21));
var common_1 = __webpack_require__(0);
var logo_svg_1 = __importDefault(__webpack_require__(8));
var styles_1 = __webpack_require__(3);
var selectors_1 = __webpack_require__(5);
var RuqESModule_1 = __webpack_require__(6);
var renderMarkdown_1 = __webpack_require__(22);
var ImageUploadButton_1 = __webpack_require__(23);
var CreatePostModule = /** @class */ (function (_super) {
    __extends(CreatePostModule, _super);
    function CreatePostModule() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.onLoadTitleButtonClick = function (el) { return function (evt) {
            common_1.debugLog('onLoadTitleButtonClick', el, evt);
            if (el.hasClass(styles_1.loadTitleButtonLoadingCls)) {
                common_1.debugLog('onLoadTitleButtonClick - ignoring click, loading already in progress');
                return;
            }
            var url = String(selectors_1.getPostUrlInPostCreation().val());
            if (!url || (!url.startsWith('https://') && !url.startsWith('http://'))) {
                common_1.debugLog('onLoadTitleButtonClick - ignoring click, url doesn\'t look valid', url);
                return;
            }
            el.prop('disabled', true).addClass(styles_1.loadTitleButtonLoadingCls);
            var enable = function () { return el.prop('disabled', false).removeClass(styles_1.loadTitleButtonLoadingCls); };
            common_1.xhr({
                method: 'GET',
                url: url,
                onload: function (resp) {
                    if (resp.status !== 200) {
                        return;
                    }
                    var parsed = $('<div>').append($(resp.response));
                    var titleFromItemPropName = parsed.find('meta[itemprop=name]').prop('content');
                    var titleFromTitleTag = parsed.find('title').first().text();
                    common_1.debugLog('createPost - possible titles', { titleFromItemPropName: titleFromItemPropName, titleFromTitleTag: titleFromTitleTag });
                    var title = titleFromItemPropName || titleFromTitleTag;
                    if (!title) {
                        common_1.debugLog('failed to get title', parsed);
                    }
                    selectors_1.getPostTitleInPostCreation().val(title);
                    enable();
                },
                onerror: function (err) {
                    common_1.debugLog('post loading failed', err);
                    enable();
                },
            });
        }; };
        _this.appendElToUrlLabel = function (el) {
            return selectors_1.getPostUrlInPostCreation()
                .parent()
                .find('label')
                .append(el)
                .addClass('d-flex justify-content-between align-items-end');
        };
        _this.setupLoadTitleButton = function (cfg) {
            if (!(cfg === null || cfg === void 0 ? void 0 : cfg.loadTitleButton)) {
                return;
            }
            if (window.location.pathname !== '/submit') {
                return;
            }
            var onlyForYouTube = false;
            var btn = $('<a>')
                .addClass('btn btn-secondary')
                .html(logo_svg_1.default)
                .append('Load title')
                .addClass(styles_1.loadTitleButtonCls)
                .hide();
            if (!onlyForYouTube) {
                btn.show();
            }
            selectors_1.getPostUrlInPostCreation().change(function (evt) {
                var val = evt.target.value;
                var isYT = val.includes('youtube.com') || val.includes('youtu.be');
                if ((onlyForYouTube && isYT) || (!onlyForYouTube)) {
                    btn.show();
                }
                else {
                    btn.hide();
                }
            });
            _this.appendElToUrlLabel(btn);
            btn.click(_this.onLoadTitleButtonClick(btn));
        };
        _this.fillUrl = function (url) {
            selectors_1.getPostUrlInPostCreation().val(url).trigger('input');
        };
        _this.setupImgbbUploadButton = function (cfg) {
            var _a;
            if (!((_a = cfg === null || cfg === void 0 ? void 0 : cfg.external) === null || _a === void 0 ? void 0 : _a.imgbbKey)) {
                return;
            }
            if (window.location.pathname !== '/submit') {
                return;
            }
            var btn = ImageUploadButton_1.ImageUploadButton.genUploadButton('POST', cfg, function (url) { return _this.fillUrl(url); });
            _this.appendElToUrlLabel(btn);
        };
        return _this;
    }
    CreatePostModule.prototype.setupPreview = function (cfg) {
        if (!cfg.createPost.markdownPreview) {
            return;
        }
        var previewBox = $('<div>').addClass(styles_1.postPreviewCls);
        if (cfg.post.improvedTableStyles) {
            previewBox.addClass(styles_1.improvedTableCls);
        }
        var inputChangedHandler = lodash_debounce_1.default(function (evt) {
            var el = $(evt.target);
            previewBox.html(renderMarkdown_1.renderMarkdown(String(el.val())));
        }, 200);
        common_1.$i('post-text').on('input', inputChangedHandler);
        $('label[for=board]').before(previewBox);
        var toggleButton = common_1.genJsAnchor().addClass(styles_1.postPreviewButtonCls).addClass('mx-1').html($('<i>').addClass('fas fa-minus-circle').click(function (evt) {
            previewBox.toggle();
            $(evt.target).toggleClass('fa-minus-circle fa-plus-circle');
        }));
        var label = $('<label>').prop('href', 'javascript:void 0').text('Preview').addClass('d-block mt-1')
            .append(toggleButton).append(common_1.createRuqesMark().addClass(styles_1.nonAggressiveCls));
        previewBox.before(label);
    };
    CreatePostModule.prototype.setupOpenUrlButton = function (cfg) {
        if (!cfg.createPost.openUrlButton) {
            return;
        }
        var onClick = function () {
            window.open(selectors_1.getPostUrlInPostCreation().val().toString(), '_blank');
        };
        var btn = $('<a>')
            .addClass('btn btn-secondary ml-2')
            .html(logo_svg_1.default)
            .append('Open')
            .addClass(styles_1.loadTitleButtonCls)
            .prop('title', 'Open URL in new tab')
            .on('click', onClick);
        this.appendElToUrlLabel(btn);
    };
    CreatePostModule.prototype.setup = function (args, cfg) {
        return __awaiter(this, void 0, void 0, function () {
            var creatPostCfg;
            return __generator(this, function (_a) {
                creatPostCfg = cfg.createPost;
                if (!ramda_1.prop('silent', args || {})) {
                    common_1.debugLog('setupCreatePost');
                }
                this.appendElToUrlLabel($('<i>').css({ flexGrow: 10 }));
                this.setupLoadTitleButton(creatPostCfg);
                this.setupImgbbUploadButton(cfg);
                this.setupPreview(cfg);
                this.setupOpenUrlButton(cfg);
                return [2 /*return*/];
            });
        });
    };
    ;
    return CreatePostModule;
}(RuqESModule_1.RuqESModule));
exports.CreatePostModule = CreatePostModule;


/***/ }),
/* 73 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var __awaiter = (this && this.__awaiter) || function (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());
    });
};
var __generator = (this && this.__generator) || function (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 };
    }
};
var __read = (this && this.__read) || function (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;
};
var __spread = (this && this.__spread) || function () {
    for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
    return ar;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.InfiniteScrollModule = void 0;
var ramda_1 = __webpack_require__(4);
var selectors_1 = __webpack_require__(5);
var common_1 = __webpack_require__(0);
var styles_1 = __webpack_require__(3);
var modules_1 = __webpack_require__(9);
var RuqESModule_1 = __webpack_require__(6);
var events_1 = __webpack_require__(25);
var coolDownWhenCombinedWithFullHidingOfPosts = 1500;
var InfiniteScrollModule = /** @class */ (function (_super) {
    __extends(InfiniteScrollModule, _super);
    function InfiniteScrollModule() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.infiniteScrollState = {
            loading: false,
            nextPageUrl: null,
            coolDownActive: false,
            coolDownTimeoutId: null,
            loadNextPageAfterCoolDownFinishes: false,
        };
        _this.onNextPageSuccessResponse = function (resp) { return __awaiter(_this, void 0, void 0, function () {
            var parsed, newData, pageNum, newPageId, newPage, pageCounter;
            var _a;
            return __generator(this, function (_b) {
                switch (_b.label) {
                    case 0:
                        if (resp.status !== 200) {
                            return [2 /*return*/, this.onNextPageErrorResponse(resp)];
                        }
                        parsed = $(resp.response);
                        common_1.debugLog('onNextPageSuccessResponse', resp);
                        newData = parsed.find('#posts');
                        if (!newData.length) {
                            newData = parsed.find('.guild-border-top').next();
                        }
                        if (!newData.length) {
                            newData = parsed.find('.posts');
                        }
                        if (!newData.length) {
                            common_1.printError('InfiniteScroll failed to locate data in response.', parsed);
                            selectors_1.getPageLoadingMarker().html('[RuqES] Failed to locate data in response.');
                            selectors_1.getPagination().css('display', 'block');
                            return [2 /*return*/];
                        }
                        pageNum = (_a = InfiniteScrollModule.parsePageNumber(this.infiniteScrollState.nextPageUrl)) !== null && _a !== void 0 ? _a : -1;
                        newPageId = styles_1.clsPrefix + "page-" + pageNum;
                        newPage = $('<div>')
                            .prop('id', newPageId)
                            .html(newData)
                            .append(selectors_1.getPagination(parsed));
                        common_1.setupVoting(newPage);
                        pageCounter = $('<div>').text("Page " + (pageNum || '?'))
                            .addClass(['card', 'text-center', 'py-1']);
                        selectors_1.getPagination().remove();
                        selectors_1.getPostListContainer().append(pageCounter);
                        selectors_1.getPostListContainer().append(newPage);
                        selectors_1.getPageLoadingMarker().remove();
                        this.infiniteScrollState.loading = false;
                        this.infiniteScrollState.nextPageUrl = null;
                        return [4 /*yield*/, modules_1.handleModulesAfterContentChange()];
                    case 1:
                        _b.sent();
                        events_1.emitInfiniteScrollLoaded(pageNum, resp.finalUrl, common_1.$i(newPageId)[0]);
                        return [2 /*return*/];
                }
            });
        }); };
        _this.onNextPageErrorResponse = function (resp) {
            console.error(common_1.logPrefix, 'loading of next page FAILED', resp);
            var textEl = $('<pre>').addClass(styles_1.codeBlockCls).html($('<code>').text(resp.responseText));
            var tryManuallyBtn = $('<a>')
                .text('Go to next page manually')
                .prop('href', _this.infiniteScrollState.nextPageUrl);
            var retryBtn = $('<button>')
                .text('Retry')
                .addClass('btn')
                .addClass('btn-primary')
                .addClass('ml-1')
                .click(function () {
                _this.infiniteScrollState.loading = false;
                selectors_1.getPageLoadingMarker().remove();
                _this.startLoadingNextPage();
            });
            var errorEl = $('<div>')
                .addClass(styles_1.pageLoadingErrorCls)
                .append($('<div>').text("Error " + resp.status + ": " + resp.statusText).append(retryBtn))
                .append(tryManuallyBtn)
                .append(textEl);
            selectors_1.getPageLoadingMarker().html(errorEl);
            events_1.emitInfiniteScrollLoadFail(resp.finalUrl, resp.status, resp.statusText);
        };
        _this.startLoadingNextPage = function () {
            if (_this.infiniteScrollState.coolDownActive) {
                _this.infiniteScrollState.loadNextPageAfterCoolDownFinishes = true;
                if (common_1.$c(styles_1.infiniteScrollCoolDownMarkerCls).length === 0) {
                    var cdMarker = $('<span>⏳</span>').addClass(styles_1.infiniteScrollCoolDownMarkerCls);
                    selectors_1.getPagination().find('ul').append(cdMarker);
                }
                return;
            }
            var nextUrl = selectors_1.getNextPageLink().prop('href');
            common_1.debugLog('InfiniteScroll starts fetching', nextUrl);
            if (!nextUrl) {
                return;
            }
            _this.infiniteScrollState.loading = true;
            _this.infiniteScrollState.nextPageUrl = nextUrl;
            var pageNumber = InfiniteScrollModule.parsePageNumber(nextUrl);
            if (pageNumber !== null) {
                events_1.emitInfiniteScrollLoadStart(pageNumber, nextUrl);
            }
            common_1.xhr({
                method: 'GET',
                url: nextUrl,
                onload: _this.onNextPageSuccessResponse,
                onerror: _this.onNextPageErrorResponse,
            });
            var loader = common_1.createTextLoader('Loading next page', styles_1.pageLoadingCls).addClass('h4');
            selectors_1.getPagination()
                .css('display', 'none')
                .after(loader);
        };
        _this.onNextPageLinkScrolledTo = function () {
            if (_this.infiniteScrollState.loading) {
                return;
            }
            _this.startLoadingNextPage();
        };
        _this.isValidPathForInfiniteScroll = function (path) { return true; };
        _this.activateInfiniteScrollCoolDown = function () {
            common_1.debugLog('activateInfiniteScrollCoolDown called');
            if (_this.infiniteScrollState.coolDownActive && _this.infiniteScrollState.coolDownTimeoutId) {
                clearTimeout(_this.infiniteScrollState.coolDownTimeoutId);
            }
            _this.infiniteScrollState.coolDownActive = true;
            _this.infiniteScrollState.coolDownTimeoutId = setTimeout(function () {
                common_1.debugLog('activateInfiniteScrollCoolDown - cool down ended');
                _this.infiniteScrollState.coolDownActive = false;
                _this.infiniteScrollState.coolDownTimeoutId = null;
                if (_this.infiniteScrollState.loadNextPageAfterCoolDownFinishes) {
                    _this.startLoadingNextPage();
                    _this.infiniteScrollState.loadNextPageAfterCoolDownFinishes = false;
                }
            }, coolDownWhenCombinedWithFullHidingOfPosts);
        };
        _this.checkScrollPosition = function (cfg) { return function () {
            var doc = $(document);
            if (!_this.isValidPathForInfiniteScroll(window.location.pathname)) {
                return;
            }
            var nextPageLink = selectors_1.getNextPageLink();
            if (!nextPageLink[0]) {
                return;
            }
            var offset = cfg.infiniteScroll.loadEarlier ? -2000 : 0;
            if ((doc.scrollTop() || 0) + ($(window).height() || 0) >= nextPageLink.position().top + offset) {
                _this.onNextPageLinkScrolledTo();
                if (cfg.infiniteScroll.loadEarlier && !_this.infiniteScrollState.coolDownActive) {
                    _this.activateInfiniteScrollCoolDown();
                }
            }
        }; };
        return _this;
    }
    InfiniteScrollModule.parsePageNumber = function (url) {
        if (!url) {
            return null;
        }
        var parsed = Number.parseInt(ramda_1.prop(1, __spread(url === null || url === void 0 ? void 0 : url.match(/page=(\d+)/))));
        return isNaN(parsed) ? null : parsed;
    };
    InfiniteScrollModule.prototype.setup = function (args, cfg) {
        var _a;
        return __awaiter(this, void 0, void 0, function () {
            return __generator(this, function (_b) {
                if (!((_a = cfg === null || cfg === void 0 ? void 0 : cfg.infiniteScroll) === null || _a === void 0 ? void 0 : _a.enabled)) {
                    return [2 /*return*/];
                }
                common_1.debugLog('setupInfiniteScroll');
                $(document).on('scroll', this.checkScrollPosition(cfg));
                $('#main-content-col').css('margin-bottom', '2em');
                setTimeout(this.checkScrollPosition(cfg), 100);
                setInterval(this.checkScrollPosition(cfg), coolDownWhenCombinedWithFullHidingOfPosts);
                return [2 /*return*/];
            });
        });
    };
    ;
    InfiniteScrollModule.prototype.onSomePostsFullyHidden = function (cfg) {
        this.activateInfiniteScrollCoolDown();
    };
    return InfiniteScrollModule;
}(RuqESModule_1.RuqESModule));
exports.InfiniteScrollModule = InfiniteScrollModule;


/***/ }),
/* 74 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var __awaiter = (this && this.__awaiter) || function (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());
    });
};
var __generator = (this && this.__generator) || function (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 };
    }
};
var __read = (this && this.__read) || function (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;
};
var __spread = (this && this.__spread) || function () {
    for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
    return ar;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.PostsModule = void 0;
var ramda_1 = __webpack_require__(4);
var notevil_1 = __importDefault(__webpack_require__(75));
var styles_1 = __webpack_require__(3);
var common_1 = __webpack_require__(0);
var modules_1 = __webpack_require__(9);
var RuqESModule_1 = __webpack_require__(6);
var ts_matcher_1 = __importDefault(__webpack_require__(24));
var selectors_1 = __webpack_require__(5);
var SaveModule_1 = __webpack_require__(13);
var validPostRuleActionTags = ['semiHide', 'hide', 'setBackground', 'blurThumbnail'];
var testPostRuleBody = "\n    if (post.nsfw) return [A.setBackgroundAction('pink'), A.semiHideAction()];\n    if (post.guild === 'Ruqqus') {\n      return A.hideAction();\n    }\n    if (['WatchRedditDie'].includes(post.guild)) {\n      return A.setBackgroundAction('orange');\n    }\n    if (post.author.toLowerCase().charAt(0) === 't') {\n      return A.semiHideAction();\n    }\n    if (post.vote) {\n      return A.setBackgroundAction('cyan');\n    }\n    if (location.path === '/all') {\n      return A.setBackgroundAction('darkgreen');\n    }\n  ";
var testPostRule = { name: 'Test post rule', body: testPostRuleBody, enabled: true };
var PostsModule = /** @class */ (function (_super) {
    __extends(PostsModule, _super);
    function PostsModule() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.postRuleFunctions = [];
        _this.isOnDiscoverPage = common_1.isOnExactPathGen('browse');
        return _this;
    }
    PostsModule.prototype.hideAlreadyJoinedGuildTiles = function () {
        $('#main-content-col .card-footer :not(.d-none) > .btn-secondary')
            .each(function (_, rawEl) { $(rawEl).closest('.col').remove(); });
    };
    PostsModule.prototype.setupCloseButtonInImageDialog = function () {
        var expImgLinkEl = $('#desktop-expanded-image-link');
        if (expImgLinkEl.parent().find("." + styles_1.closeButtonInImageDialogCls).length) {
            return;
        }
        var closeLink = common_1.genJsAnchor()
            .text('Close')
            .addClass('text-gray-500 font-weight-bold text-right')
            .addClass(styles_1.closeButtonInImageDialogCls)
            .click(function () { return $('#expandImageModal').click(); });
        expImgLinkEl.after(closeLink);
    };
    PostsModule.prototype.setupImageThumbnailIconType = function (style, background, thumbnailMode) {
        if (thumbnailMode === 'hide') {
            return;
        }
        var addCommonClassesToIcon = function (x) { return x
            .addClass(background ? styles_1.imageThumbnailTypeIconBackgroundCls : '')
            .addClass(styles_1.imageThumbnailTypeIconCls); };
        var genThumbnailIconEmoji = function (args) { return ramda_1.pipe(function (x) { return x.text(args.isImage ? '🖼' : '🔗'); }, addCommonClassesToIcon)($('<div>')); };
        var genThumbnailIconFA = function (args) { return ramda_1.pipe(function (x) { return x
            .addClass(styles_1.imageThumbnailTypeIconFACls)
            .html($('<i>').addClass('fas').addClass(args.isImage ? 'fa-camera' : 'fa-link')); }, addCommonClassesToIcon)($('<div>')); };
        $('.post-img').parent().each(function (_, rawEl) {
            var el = $(rawEl);
            if (el.parent().parent().find("." + styles_1.imageThumbnailTypeIconCls).length) {
                return;
            }
            var isImage = el.attr('data-toggle') === 'modal';
            var icon = ts_matcher_1.default(style)
                .case('emoji', function () { return genThumbnailIconEmoji; })
                .case('fa', function () { return genThumbnailIconFA; })
                .exec()({ isImage: isImage });
            el.parent().append(icon);
            el.closest('.card-header')
                .find('.d-md-none')
                .filter(function (_, rawEl) { return $(rawEl).children().length > 0; })
                .append(icon.clone().addClass(styles_1.imageThumbnailTypeIconOnMobileCls));
        });
    };
    PostsModule.compileRule = function (rule) {
        var isUnsafePostRule = function (x) {
            return common_1.isObject(x) && validPostRuleActionTags.includes(x.tag);
        };
        return function (post, A, location) {
            var prg = "(function() {/* " + rule.name + " */ " + rule.body + "\n})()";
            var res;
            try {
                res = notevil_1.default(prg, { post: post, A: A, location: location });
            }
            catch (e) {
                common_1.printError("Error while running post rule '" + rule.name + "':\n" + e + "\nRule code:\n" + rule.body);
                return undefined;
            }
            if (!common_1.isArray(res) && !common_1.isObject(res)) {
                return;
            }
            if (common_1.isArray(res)) {
                return res.filter(isUnsafePostRule);
            }
            if (isUnsafePostRule(res)) {
                return res;
            }
            return undefined;
        };
    };
    PostsModule.prototype.applyRule = function (el, resultingActions) {
        var _this = this;
        resultingActions.forEach(function (action) {
            var _a;
            switch (action.tag) {
                case 'hide':
                    el.hide();
                    (_a = _this.somePostsFullyHiddenCb) === null || _a === void 0 ? void 0 : _a.call(_this);
                    return;
                case 'semiHide':
                    el.addClass(styles_1.semiHiddenPostCls);
                    return;
                case 'setBackground':
                    el.css({ backgroundColor: PostsModule.validateCssColor(action.color) || '' });
                    return;
                case 'blurThumbnail':
                    el.addClass(styles_1.blurThumbnailCls);
                    return;
                default:
                    common_1.printError("Unknown post action", action, el);
                    return;
            }
        });
    };
    PostsModule.validateCssColor = function (x) {
        if (x === undefined || !common_1.isString(x)) {
            return undefined;
        }
        if (!common_1.isValidCssColor(x)) {
            common_1.printError("Invalid CSS color: '" + x + "'.", x);
            return undefined;
        }
        return x;
    };
    PostsModule.prototype.applyRules = function () {
        var _this = this;
        var debugInfo = [];
        selectors_1.getPosts().filter(function (_, rawEl) { return !$(rawEl).hasClass(styles_1.postRulesAppliedCls); }).each(function (_, rawEl) {
            var el = $(rawEl);
            var info = common_1.extractPostInfo(el);
            var descr = {
                title: info.title,
                author: info.author,
                guild: info.guild,
                id: info.id,
                nsfw: info.nsfw,
                score: info.score,
                vote: info.vote,
                url: info.url,
                link: info.link,
                date: info.date,
                dateRaw: info.dateRaw,
                dateRelative: info.dateRelative,
                pinned: info.pinned,
            };
            var zero = [];
            var resultingActions = _this.postRuleFunctions.reduce(function (acc, ruleFunction) {
                var _a;
                if (ramda_1.isEmpty(acc)) {
                    var api = {
                        hideAction: function () { return ({ tag: 'hide' }); },
                        semiHideAction: function () { return ({ tag: 'semiHide' }); },
                        setBackgroundAction: function (color) { return ({ tag: 'setBackground', color: color }); },
                        blurThumbnailAction: function () { return ({ tag: 'blurThumbnail' }); },
                    };
                    var winLoc = window.location;
                    var loc = {
                        href: winLoc.href,
                        path: winLoc.pathname,
                        search: winLoc.search,
                    };
                    var ret = (_a = ruleFunction(descr, api, loc)) !== null && _a !== void 0 ? _a : zero;
                    return common_1.isArray(ret) ? ret : [ret];
                }
                else {
                    return acc;
                }
            }, zero);
            debugInfo.push({ postId: descr.id, resultingAction: resultingActions, descr: descr, info: info });
            el.addClass(styles_1.postRulesAppliedCls);
            _this.applyRule(el, resultingActions);
        });
        common_1.debugLog('applyRules', debugInfo);
    };
    PostsModule.prototype.setupRulesEngine = function (cfg) {
        var rules = __spread(cfg.debug.enabled && cfg.debug.insertTestPostRule ? [testPostRule] : [], cfg.post.rules);
        common_1.debugLog('setupRulesEngine', cfg);
        if (!this.firstSetupRunFinished) {
            this.postRuleFunctions = rules.filter(function (x) { return x.enabled; }).map(PostsModule.compileRule);
        }
        this.applyRules();
    };
    PostsModule.prototype.setupUpDownVotesAsText = function () {
        selectors_1.getPosts()
            .filter(function (_, rawEl) { return !$(rawEl).hasClass(styles_1.postUpDownVotesAsTextProcessedCls); })
            .each(function (_, rawEl) {
            var el = $(rawEl);
            el.addClass(styles_1.postUpDownVotesAsTextProcessedCls);
            var _a = __read(common_1.parseUpDownCounts(el.find('.score').data('originalTitle')), 2), upCount = _a[0], downCount = _a[1];
            var counters = common_1.genTextUpDownCounters(upCount, downCount);
            el.find('.post-meta').append(counters);
        });
    };
    PostsModule.prototype.setupDownloadButton = function (cfg) {
        var genDownloadIcon = function () { return $('<i class="fas fa-download"></i>'); };
        var genOkIcon = function () { return $('<i class="fas fa-check"></i>'); };
        var genDownloadingIcon = function () { return $('<i class="fad fa-hourglass-half mr-1"></i>'); };
        var genErrorIcon = function () { return $('<i class="fas fa-bomb"></i>'); };
        var setTextAndAddIcon = function (text, genIcon) { return function (_, el) { $(el).text(text).prepend(genIcon()); }; };
        var setPrepareText = setTextAndAddIcon('Prepare', genDownloadIcon);
        var setDownloadText = setTextAndAddIcon('Download', genDownloadIcon);
        var setDownloadingText = setTextAndAddIcon('Downloading', genDownloadingIcon);
        var setPreparingText = setTextAndAddIcon('Preparing', genDownloadingIcon);
        var setOkText = setTextAndAddIcon('Downloaded', genOkIcon);
        var setErrorText = setTextAndAddIcon('Download failed', genErrorIcon);
        var finishSetupOfTwoClickDownloadButton = function (btn, postEl, imgUrl) {
            btn.each(setPrepareText);
            btn.click(function () {
                if (btn.prop('download')) {
                    btn.each(setOkText);
                    return;
                }
                btn.each(setPreparingText).prop('title', '');
                common_1.xhrP({ method: 'GET', url: imgUrl, responseType: 'blob' }).then(function (resp) {
                    common_1.debugLog('download button (two-click)', 'got response', resp);
                    var reader = new FileReader();
                    reader.readAsDataURL(resp.response);
                    reader.onloadend = function () {
                        var href = reader.result;
                        common_1.debugLog('download button', 'reader result', { href: href });
                        btn.prop('href', href).prop('download', imgUrl).each(setDownloadText);
                    };
                }).catch(function (err) {
                    common_1.printError(err);
                    btn.each(setErrorText);
                });
            });
        };
        var finishSetupOfDownloadServerDownloadButton = function (btn, postEl, imgUrl) {
            btn.each(setDownloadText);
            btn.click(function () {
                btn.each(setDownloadingText).prop('title', '');
                common_1.xhrPJson({
                    method: 'POST',
                    url: cfg.external.downloadServerAddress + '/download',
                    data: { url: imgUrl },
                }).then(function (resp) {
                    common_1.debugLog('download button (downloader-server)', 'got response', resp);
                    btn.each(setOkText);
                }).catch(function (err) {
                    common_1.printError('download-server returned error', err);
                    btn.each(setErrorText);
                    var errorMessage = (err === null || err === void 0 ? void 0 : err.status) + ": " + (err === null || err === void 0 ? void 0 : err.responseText);
                    btn.prop('title', errorMessage);
                });
            });
        };
        var processPost = function (_, rawEl) {
            var postEl = $(rawEl);
            postEl.addClass(styles_1.postDownloadButtonProcessedCls);
            var imgUrl = common_1.getImageUrlFromPostThumbnail(postEl);
            if (!imgUrl) {
                return;
            }
            var btn = common_1.genJsAnchor().prop('download', '');
            selectors_1.getPostActionsListOnDesktop(postEl).append($('<li>').addClass('list-inline-item').html(btn));
            switch (cfg.post.downloadButtonMode) {
                case 'twoClick': {
                    finishSetupOfTwoClickDownloadButton(btn, postEl, imgUrl);
                    break;
                }
                case 'downloadServer': {
                    finishSetupOfDownloadServerDownloadButton(btn, postEl, imgUrl);
                    break;
                }
            }
        };
        selectors_1.getPosts()
            .filter(function (_, rawEl) { return !$(rawEl).hasClass(styles_1.postDownloadButtonProcessedCls); })
            .each(processPost);
    };
    PostsModule.prototype.setupShowThumbnailOnHover = function () {
        if (common_1.$c(styles_1.postShowThumbnailOnHoverWrapperCls).length === 0) {
            var imgEl_1 = $('<img>').addClass(styles_1.postShowThumbnailOnHoverImageCls);
            var wrapperEl_1 = $('<div>').addClass(styles_1.postShowThumbnailOnHoverWrapperCls).append(imgEl_1).hide();
            $('body').append(wrapperEl_1);
        }
        var wrapperEl = common_1.$c(styles_1.postShowThumbnailOnHoverWrapperCls);
        var imgEl = common_1.$c(styles_1.postShowThumbnailOnHoverImageCls);
        if (!wrapperEl.length || !imgEl.length) {
            common_1.printError('setupShowThumbnailOnHover: failed to get wrapper or img el', { wrapperEl: wrapperEl, imgEl: imgEl });
            return;
        }
        selectors_1.getPosts()
            .filter(function (_, rawEl) { return !$(rawEl).hasClass(styles_1.postShowThumbnailOnHoverProcessedCls); })
            .each(function (_, rawEl) {
            var postEl = $(rawEl);
            postEl.addClass(styles_1.postShowThumbnailOnHoverProcessedCls);
            var info = common_1.extractPostInfo(postEl);
            if (!info.previewModal) {
                return;
            }
            postEl.find('.card-header .post-img').each(function (_, rawEl) {
                var thumbEl = $(rawEl);
                thumbEl.on('mouseenter', function () {
                    var left = thumbEl.offset().left + thumbEl.width();
                    wrapperEl.css('left', left + 'px').show();
                    imgEl.prop('src', '').prop('src', info.link);
                });
                thumbEl.on('mouseleave', function () {
                    wrapperEl.hide();
                });
            });
        });
    };
    PostsModule.prototype.setupThumbnailMode = function (cfg) {
        if (common_1.isOnPostDetail()) {
            return;
        }
        var mode = cfg.post.thumbnailMode;
        var processPost = function (_, rawEl) {
            var postEl = $(rawEl);
            postEl.addClass(styles_1.postThumbnailModeProcessedCls);
            var imgEl = postEl.find('img.post-img');
            var imgLinkEl = imgEl.parent();
            var linkWrapperEl = imgLinkEl.parent();
            var outerLinkWrapperEl = linkWrapperEl.parent();
            outerLinkWrapperEl.addClass(styles_1.postThumbnailModeCls + "-" + mode);
        };
        selectors_1.getPosts()
            .filter(function (_, rawEl) { return !$(rawEl).hasClass(styles_1.postThumbnailModeProcessedCls); })
            .each(processPost);
    };
    PostsModule.prototype.setupCategoryChangeDetection = function () {
        var _this = this;
        var check = function () { return __awaiter(_this, void 0, void 0, function () {
            var el;
            return __generator(this, function (_a) {
                switch (_a.label) {
                    case 0:
                        el = common_1.$i('posts');
                        if (!!el.length) return [3 /*break*/, 1];
                        return [2 /*return*/];
                    case 1:
                        if (!el.find("." + styles_1.postCategoryChangeDetectorCls).length) return [3 /*break*/, 2];
                        return [2 /*return*/];
                    case 2:
                        common_1.debugLog('setupCategoryChangeDetection', 'category change detected');
                        el.prepend($('<i>').addClass(['d-none', styles_1.postCategoryChangeDetectorCls]));
                        return [4 /*yield*/, modules_1.handleModulesAfterContentChange()];
                    case 3:
                        _a.sent();
                        _a.label = 4;
                    case 4: return [2 /*return*/];
                }
            });
        }); };
        setInterval(check, 2000);
    };
    PostsModule.prototype.setup = function (args, cfg) {
        var _a;
        return __awaiter(this, void 0, void 0, function () {
            var postsCfg;
            return __generator(this, function (_b) {
                postsCfg = cfg.post;
                if (ramda_1.prop('silent', args || {})) {
                    common_1.debugLog('PostsModule', postsCfg);
                }
                if (postsCfg.openInNewTab) {
                    $('.post-title a').prop('target', '_blank');
                    $('.post-actions a > i.fa-comment-dots').parent().prop('target', '_blank');
                }
                if (postsCfg.hideAlreadyJoinedGuildsInDiscovery && this.isOnDiscoverPage()) {
                    this.hideAlreadyJoinedGuildTiles();
                    (_a = this.somePostsFullyHiddenCb) === null || _a === void 0 ? void 0 : _a.call(this);
                }
                if (postsCfg.improvedTableStyles) {
                    $("." + styles_1.boxPostTextCls + ", #post-body").addClass(styles_1.improvedTableCls);
                }
                if (postsCfg.lessAggressivePatronBadges) {
                    $('.post-meta, .user-info').find('[src$="/ruqqus-coin.png"]').parent().addClass(styles_1.nonAggressiveCls);
                }
                if (postsCfg.disablePostActionsJumpingAboveBarOnHover) {
                    $('body').addClass(styles_1.disablePostActionsJumpingAboveBarOnHoverCls);
                }
                if (postsCfg.imageThumbnailIconType) {
                    this.setupImageThumbnailIconType(cfg.post.imageThumbnailIconTypeStyle, cfg.post.imageThumbnailIconTypeBackground, cfg.post.thumbnailMode);
                }
                if (postsCfg.closeButtonInImageDialog) {
                    this.setupCloseButtonInImageDialog();
                }
                if (postsCfg.rulesEngineEnabled) {
                    this.setupRulesEngine(cfg);
                }
                if (postsCfg.upDownVotesAsText && !SaveModule_1.SaveModule.isOnSavedPage()) {
                    this.setupUpDownVotesAsText();
                }
                if (postsCfg.downloadButton) {
                    this.setupDownloadButton(cfg);
                }
                if (postsCfg.showThumbnailOnHover && !common_1.isOnPostDetail()) {
                    this.setupShowThumbnailOnHover();
                }
                if (postsCfg.thumbnailMode != 'vanilla') {
                    this.setupThumbnailMode(cfg);
                }
                if (!this.firstSetupRunFinished) {
                    this.setupCategoryChangeDetection();
                }
                return [2 /*return*/];
            });
        });
    };
    PostsModule.prototype.onContentChange = function (args, cfg) {
        return __awaiter(this, void 0, void 0, function () {
            return __generator(this, function (_a) {
                return [2 /*return*/, this.setup(args, cfg)];
            });
        });
    };
    return PostsModule;
}(RuqESModule_1.RuqESModule));
exports.PostsModule = PostsModule;


/***/ }),
/* 75 */
/***/ (function(module, exports, __webpack_require__) {

/* WEBPACK VAR INJECTION */(function(global) {var parse = __webpack_require__(76).parse
var hoist = __webpack_require__(77)

var InfiniteChecker = __webpack_require__(78)
var Primitives = __webpack_require__(79)

module.exports = safeEval
module.exports.eval = safeEval
module.exports.FunctionFactory = FunctionFactory
module.exports.Function = FunctionFactory()

var maxIterations = 1000000

// 'eval' with a controlled environment
function safeEval(src, parentContext){
  var tree = prepareAst(src)
  var context = Object.create(parentContext || {})
  return finalValue(evaluateAst(tree, context))
}

// create a 'Function' constructor for a controlled environment
function FunctionFactory(parentContext){
  var context = Object.create(parentContext || {})
  return function Function() {
    // normalize arguments array
    var args = Array.prototype.slice.call(arguments)
    var src = args.slice(-1)[0]
    args = args.slice(0,-1)
    if (typeof src === 'string'){
      //HACK: esprima doesn't like returns outside functions
      src = parse('function a(){' + src + '}').body[0].body
    }
    var tree = prepareAst(src)
    return getFunction(tree, args, context)
  }
}

// takes an AST or js source and returns an AST
function prepareAst(src){
  var tree = (typeof src === 'string') ? parse(src, {loc: true}) : src
  return hoist(tree)
}

// evaluate an AST in the given context
function evaluateAst(tree, context){

  var safeFunction = FunctionFactory(context)
  var primitives = Primitives(context)

  // block scoped context for catch (ex) and 'let'
  var blockContext = context

  return walk(tree)

  // recursively walk every node in an array
  function walkAll(nodes){
    var result = undefined
    for (var i=0;i<nodes.length;i++){
      var childNode = nodes[i]
      if (childNode.type === 'EmptyStatement') continue
      result = walk(childNode)
      if (result instanceof ReturnValue){
        return result
      }
    }
    return result
  }

  // recursively evalutate the node of an AST
  function walk(node, traceNode){
    try {
      if (!node) return
      switch (node.type) {
  
        case 'Program':
          return walkAll(node.body)
  
        case 'BlockStatement':
          enterBlock()
          var result = walkAll(node.body)
          leaveBlock()
          return result
  
        case 'FunctionDeclaration':
          var params = node.params.map(getName)
          var value = getFunction(node.body, params, blockContext, node)
          return context[node.id.name] = value
  
        case 'FunctionExpression':
          var params = node.params.map(getName)

          // HACK: trace the function name for stack traces
          if (!node.id && traceNode && traceNode.key && traceNode.key.type === 'Identifier') {
            node.id = traceNode.key
          }

          return getFunction(node.body, params, blockContext, node)
  
        case 'ReturnStatement':
          var value = walk(node.argument)
          return new ReturnValue('return', value)
  
        case 'BreakStatement':
          return new ReturnValue('break')
  
        case 'ContinueStatement':
          return new ReturnValue('continue')
  
        case 'ExpressionStatement':
          return walk(node.expression)
  
        case 'AssignmentExpression':
          return setValue(blockContext, node.left, node.right, node.operator)
  
        case 'UpdateExpression':
          return setValue(blockContext, node.argument, null, node.operator)
  
        case 'VariableDeclaration':
          node.declarations.forEach(function(declaration){
            var target = node.kind === 'let' ? blockContext : context
            if (declaration.init){
              target[declaration.id.name] = walk(declaration.init)
            } else {
              target[declaration.id.name] = undefined
            }
          })
          break
  
        case 'SwitchStatement':
          var defaultHandler = null
          var matched = false
          var value = walk(node.discriminant)
          var result = undefined
  
          enterBlock()
  
          var i = 0
          while (result == null){
            if (i<node.cases.length){
              if (node.cases[i].test){ // check or fall through
                matched = matched || (walk(node.cases[i].test) === value)
              } else if (defaultHandler == null) {
                defaultHandler = i
              }
              if (matched){
                var r = walkAll(node.cases[i].consequent)
                if (r instanceof ReturnValue){ // break out
                  if (r.type == 'break') break
                  result = r
                }
              }
              i += 1 // continue
            } else if (!matched && defaultHandler != null){
              // go back and do the default handler
              i = defaultHandler
              matched = true
            } else {
              // nothing we can do
              break
            }
          }
  
          leaveBlock()
          return result
  
        case 'IfStatement':
          if (walk(node.test)){
            return walk(node.consequent)
          } else if (node.alternate) {
            return walk(node.alternate)
          }
  
        case 'ForStatement':
          var infinite = InfiniteChecker(maxIterations)
          var result = undefined
  
          enterBlock() // allow lets on delarations
          for (walk(node.init); walk(node.test); walk(node.update)){
            var r = walk(node.body)
  
            // handle early return, continue and break
            if (r instanceof ReturnValue){
              if (r.type == 'continue') continue
              if (r.type == 'break') break
              result = r
              break
            }
  
            infinite.check()
          }
          leaveBlock()
          return result
  
        case 'ForInStatement':
          var infinite = InfiniteChecker(maxIterations)
          var result = undefined
  
          var value = walk(node.right)
          var property = node.left
  
          var target = context
          enterBlock()
  
          if (property.type == 'VariableDeclaration'){
            walk(property)
            property = property.declarations[0].id
            if (property.kind === 'let'){
              target = blockContext
            }
          }
  
          for (var key in value){
            setValue(target, property, {type: 'Literal', value: key})
            var r = walk(node.body)
  
            // handle early return, continue and break
            if (r instanceof ReturnValue){
              if (r.type == 'continue') continue
              if (r.type == 'break') break
              result = r
              break
            }
  
            infinite.check()
          }
          leaveBlock()
  
          return result
  
        case 'WhileStatement':
          var infinite = InfiniteChecker(maxIterations)
          while (walk(node.test)){
            walk(node.body)
            infinite.check()
          }
          break
  
        case 'TryStatement':
          try {
            walk(node.block)
          } catch (error) {
            enterBlock()
            var catchClause = node.handlers[0]
            if (catchClause) {
              blockContext[catchClause.param.name] = error
              walk(catchClause.body)
            }
            leaveBlock()
          } finally {
            if (node.finalizer) {
              walk(node.finalizer)
            }
          }
          break
  
        case 'Literal':
          return node.value
  
        case 'UnaryExpression':
          if (node.operator === 'delete' && node.argument.type === 'MemberExpression') {
            var arg = node.argument
            var parent = walk(arg.object)
            var prop = arg.computed ? walk(arg.property) : arg.property.name
            delete parent[prop]
            return true
          } else {
            var val = walk(node.argument)
            switch(node.operator) {
              case '+': return +val
              case '-': return -val
              case '~': return ~val
              case '!': return !val
              case 'typeof': return typeof val
              default: return unsupportedExpression(node)
            }
          }
  
        case 'ArrayExpression':
          var obj = blockContext['Array']()
          for (var i=0;i<node.elements.length;i++){
            obj.push(walk(node.elements[i]))
          }
          return obj
  
        case 'ObjectExpression':
          var obj = blockContext['Object']()
          for (var i = 0; i < node.properties.length; i++) {
            var prop = node.properties[i]
            var value = (prop.value === null) ? prop.value : walk(prop.value, prop)
            obj[prop.key.value || prop.key.name] = value
          }
          return obj
  
        case 'NewExpression':
          var args = node.arguments.map(function(arg){
            return walk(arg)
          })
          var target = walk(node.callee)
          return primitives.applyNew(target, args)
  
  
        case 'BinaryExpression':
          var l = walk(node.left)
          var r = walk(node.right)
          switch(node.operator) {
            case '==':  return l == r
            case '===': return l === r
            case '!=':  return l != r
            case '!==': return l !== r
            case '+':   return l + r
            case '-':   return l - r
            case '*':   return l * r
            case '/':   return l / r
            case '%':   return l % r
            case '<':   return l < r
            case '<=':  return l <= r
            case '>':   return l > r
            case '>=':  return l >= r
            case '|':   return l | r
            case '&':   return l & r
            case '^':   return l ^ r
            case 'instanceof': return l instanceof r
            default: return unsupportedExpression(node)
          }
  
        case 'LogicalExpression':
          switch(node.operator) {
            case '&&':  return walk(node.left) && walk(node.right)
            case '||':  return walk(node.left) || walk(node.right)
            default: return unsupportedExpression(node)
          }
  
        case 'ThisExpression':
          return blockContext['this']
  
        case 'Identifier':
          if (node.name === 'undefined'){
            return undefined
          } else if (hasProperty(blockContext, node.name, primitives)){
            return checkValue(blockContext[node.name])
          } else {
            throw new ReferenceError(node.name + ' is not defined')
          }
  
        case 'CallExpression':
          var args = node.arguments.map(function(arg){
            return walk(arg)
          })
          var object = null
          var target = walk(node.callee)
  
          if (node.callee.type === 'MemberExpression'){
            object = walk(node.callee.object)
          }
          return checkValue(target.apply(object, args))
  
        case 'MemberExpression':
          var obj = walk(node.object)
          if (node.computed){
            var prop = walk(node.property)
          } else {
            var prop = node.property.name
          }
          obj = primitives.getPropertyObject(obj, prop)
          return checkValue(obj[prop]);
  
        case 'ConditionalExpression':
          var val = walk(node.test)
          return val ? walk(node.consequent) : walk(node.alternate)
  
        case 'EmptyStatement':
          return
  
        default:
          return unsupportedExpression(node)
      }
    } catch (ex) {
      ex.trace = ex.trace || []
      ex.trace.push(node)
      throw ex
    }
  }

  // safely retrieve a value
  function checkValue(value){
    if (value === Function){
      value = safeFunction
    }
    return finalValue(value)
  }

  // block scope context control
  function enterBlock(){
    blockContext = Object.create(blockContext)
  }
  function leaveBlock(){
    blockContext = Object.getPrototypeOf(blockContext)
  }

  // set a value in the specified context if allowed
  function setValue(object, left, right, operator){
    var name = null

    if (left.type === 'Identifier'){
      name = left.name
      // handle parent context shadowing
      object = objectForKey(object, name, primitives)
    } else if (left.type === 'MemberExpression'){
      if (left.computed){
        name = walk(left.property)
      } else {
        name = left.property.name
      }
      object = walk(left.object)
    }

    // stop built in properties from being able to be changed
    if (canSetProperty(object, name, primitives)){
      switch(operator) {
        case undefined: return object[name] = walk(right)
        case '=':  return object[name] = walk(right)
        case '+=': return object[name] += walk(right)
        case '-=': return object[name] -= walk(right)
        case '++': return object[name]++
        case '--': return object[name]--
      }
    }

  }

}

// when an unsupported expression is encountered, throw an error
function unsupportedExpression(node){
  console.error(node)
  var err = new Error('Unsupported expression: ' + node.type)
  err.node = node
  throw err
}

// walk a provided object's prototypal hierarchy to retrieve an inherited object
function objectForKey(object, key, primitives){
  var proto = primitives.getPrototypeOf(object)
  if (!proto || hasOwnProperty(object, key)){
    return object
  } else {
    return objectForKey(proto, key, primitives)
  }
}

function hasProperty(object, key, primitives){
  var proto = primitives.getPrototypeOf(object)
  var hasOwn = hasOwnProperty(object, key)
  if (object[key] !== undefined){
    return true
  } else if (!proto || hasOwn){
    return hasOwn
  } else {
    return hasProperty(proto, key, primitives)
  }
}

function hasOwnProperty(object, key){
  return Object.prototype.hasOwnProperty.call(object, key)
}

function propertyIsEnumerable(object, key){
  return Object.prototype.propertyIsEnumerable.call(object, key)
}


// determine if we have write access to a property
function canSetProperty(object, property, primitives){
  if (property === '__proto__' || primitives.isPrimitive(object)){
    return false
  } else if (object != null){

    if (hasOwnProperty(object, property)){
      if (propertyIsEnumerable(object, property)){
        return true
      } else {
        return false
      }
    } else {
      return canSetProperty(primitives.getPrototypeOf(object), property, primitives)
    }

  } else {
    return true
  }
}

// generate a function with specified context
function getFunction(body, params, parentContext, traceNode){
    return function(){
      try {
        var context = Object.create(parentContext)
        if (this == global){
          context['this'] = null
        } else {
          context['this'] = this
        }
        // normalize arguments array
        var args = Array.prototype.slice.call(arguments)
        context['arguments'] = arguments
        args.forEach(function(arg,idx){
          var param = params[idx]
          if (param){
            context[param] = arg
          }
        })
        var result = evaluateAst(body, context)
    
        if (result instanceof ReturnValue){
          return result.value
        }
      } catch (ex) {
        ex.trace = ex.trace || []
        ex.trace.push(traceNode)
        throw ex
      }
    }
}

function finalValue(value){
  if (value instanceof ReturnValue){
    return value.value
  }
  return value
}

// get the name of an identifier
function getName(identifier){
  return identifier.name
}

// a ReturnValue struct for differentiating between expression result and return statement
function ReturnValue(type, value){
  this.type = type
  this.value = value
}

/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(12)))

/***/ }),
/* 76 */
/***/ (function(module, exports, __webpack_require__) {

var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*
  Copyright (C) 2012 Ariya Hidayat <ariya.hidayat@gmail.com>
  Copyright (C) 2012 Mathias Bynens <mathias@qiwi.be>
  Copyright (C) 2012 Joost-Wim Boekesteijn <joost-wim@boekesteijn.nl>
  Copyright (C) 2012 Kris Kowal <kris.kowal@cixar.com>
  Copyright (C) 2012 Yusuke Suzuki <utatane.tea@gmail.com>
  Copyright (C) 2012 Arpad Borsos <arpad.borsos@googlemail.com>
  Copyright (C) 2011 Ariya Hidayat <ariya.hidayat@gmail.com>

  Redistribution and use in source and binary forms, with or without
  modification, are permitted provided that the following conditions are met:

    * Redistributions of source code must retain the above copyright
      notice, this list of conditions and the following disclaimer.
    * Redistributions in binary form must reproduce the above copyright
      notice, this list of conditions and the following disclaimer in the
      documentation and/or other materials provided with the distribution.

  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
  DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

/*jslint bitwise:true plusplus:true */
/*global esprima:true, define:true, exports:true, window: true,
throwError: true, createLiteral: true, generateStatement: true,
parseAssignmentExpression: true, parseBlock: true, parseExpression: true,
parseFunctionDeclaration: true, parseFunctionExpression: true,
parseFunctionSourceElements: true, parseVariableIdentifier: true,
parseLeftHandSideExpression: true,
parseStatement: true, parseSourceElement: true */

(function (root, factory) {
    'use strict';

    // Universal Module Definition (UMD) to support AMD, CommonJS/Node.js,
    // Rhino, and plain browser loading.
    if (true) {
        !(__WEBPACK_AMD_DEFINE_ARRAY__ = [exports], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
				__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
				(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
				__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
    } else {}
}(this, function (exports) {
    'use strict';

    var Token,
        TokenName,
        Syntax,
        PropertyKind,
        Messages,
        Regex,
        source,
        strict,
        index,
        lineNumber,
        lineStart,
        length,
        buffer,
        state,
        extra;

    Token = {
        BooleanLiteral: 1,
        EOF: 2,
        Identifier: 3,
        Keyword: 4,
        NullLiteral: 5,
        NumericLiteral: 6,
        Punctuator: 7,
        StringLiteral: 8
    };

    TokenName = {};
    TokenName[Token.BooleanLiteral] = 'Boolean';
    TokenName[Token.EOF] = '<end>';
    TokenName[Token.Identifier] = 'Identifier';
    TokenName[Token.Keyword] = 'Keyword';
    TokenName[Token.NullLiteral] = 'Null';
    TokenName[Token.NumericLiteral] = 'Numeric';
    TokenName[Token.Punctuator] = 'Punctuator';
    TokenName[Token.StringLiteral] = 'String';

    Syntax = {
        AssignmentExpression: 'AssignmentExpression',
        ArrayExpression: 'ArrayExpression',
        BlockStatement: 'BlockStatement',
        BinaryExpression: 'BinaryExpression',
        BreakStatement: 'BreakStatement',
        CallExpression: 'CallExpression',
        CatchClause: 'CatchClause',
        ConditionalExpression: 'ConditionalExpression',
        ContinueStatement: 'ContinueStatement',
        DoWhileStatement: 'DoWhileStatement',
        DebuggerStatement: 'DebuggerStatement',
        EmptyStatement: 'EmptyStatement',
        ExpressionStatement: 'ExpressionStatement',
        ForStatement: 'ForStatement',
        ForInStatement: 'ForInStatement',
        FunctionDeclaration: 'FunctionDeclaration',
        FunctionExpression: 'FunctionExpression',
        Identifier: 'Identifier',
        IfStatement: 'IfStatement',
        Literal: 'Literal',
        LabeledStatement: 'LabeledStatement',
        LogicalExpression: 'LogicalExpression',
        MemberExpression: 'MemberExpression',
        NewExpression: 'NewExpression',
        ObjectExpression: 'ObjectExpression',
        Program: 'Program',
        Property: 'Property',
        ReturnStatement: 'ReturnStatement',
        SequenceExpression: 'SequenceExpression',
        SwitchStatement: 'SwitchStatement',
        SwitchCase: 'SwitchCase',
        ThisExpression: 'ThisExpression',
        ThrowStatement: 'ThrowStatement',
        TryStatement: 'TryStatement',
        UnaryExpression: 'UnaryExpression',
        UpdateExpression: 'UpdateExpression',
        VariableDeclaration: 'VariableDeclaration',
        VariableDeclarator: 'VariableDeclarator',
        WhileStatement: 'WhileStatement',
        WithStatement: 'WithStatement'
    };

    PropertyKind = {
        Data: 1,
        Get: 2,
        Set: 4
    };

    // Error messages should be identical to V8.
    Messages = {
        UnexpectedToken:  'Unexpected token %0',
        UnexpectedNumber:  'Unexpected number',
        UnexpectedString:  'Unexpected string',
        UnexpectedIdentifier:  'Unexpected identifier',
        UnexpectedReserved:  'Unexpected reserved word',
        UnexpectedEOS:  'Unexpected end of input',
        NewlineAfterThrow:  'Illegal newline after throw',
        InvalidRegExp: 'Invalid regular expression',
        UnterminatedRegExp:  'Invalid regular expression: missing /',
        InvalidLHSInAssignment:  'Invalid left-hand side in assignment',
        InvalidLHSInForIn:  'Invalid left-hand side in for-in',
        MultipleDefaultsInSwitch: 'More than one default clause in switch statement',
        NoCatchOrFinally:  'Missing catch or finally after try',
        UnknownLabel: 'Undefined label \'%0\'',
        Redeclaration: '%0 \'%1\' has already been declared',
        IllegalContinue: 'Illegal continue statement',
        IllegalBreak: 'Illegal break statement',
        IllegalReturn: 'Illegal return statement',
        StrictModeWith:  'Strict mode code may not include a with statement',
        StrictCatchVariable:  'Catch variable may not be eval or arguments in strict mode',
        StrictVarName:  'Variable name may not be eval or arguments in strict mode',
        StrictParamName:  'Parameter name eval or arguments is not allowed in strict mode',
        StrictParamDupe: 'Strict mode function may not have duplicate parameter names',
        StrictFunctionName:  'Function name may not be eval or arguments in strict mode',
        StrictOctalLiteral:  'Octal literals are not allowed in strict mode.',
        StrictDelete:  'Delete of an unqualified identifier in strict mode.',
        StrictDuplicateProperty:  'Duplicate data property in object literal not allowed in strict mode',
        AccessorDataProperty:  'Object literal may not have data and accessor property with the same name',
        AccessorGetSet:  'Object literal may not have multiple get/set accessors with the same name',
        StrictLHSAssignment:  'Assignment to eval or arguments is not allowed in strict mode',
        StrictLHSPostfix:  'Postfix increment/decrement may not have eval or arguments operand in strict mode',
        StrictLHSPrefix:  'Prefix increment/decrement may not have eval or arguments operand in strict mode',
        StrictReservedWord:  'Use of future reserved word in strict mode'
    };

    // See also tools/generate-unicode-regex.py.
    Regex = {
        NonAsciiIdentifierStart: new RegExp('[\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376\u0377\u037a-\u037d\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05d0-\u05ea\u05f0-\u05f2\u0620-\u064a\u066e\u066f\u0671-\u06d3\u06d5\u06e5\u06e6\u06ee\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07ca-\u07ea\u07f4\u07f5\u07fa\u0800-\u0815\u081a\u0824\u0828\u0840-\u0858\u08a0\u08a2-\u08ac\u0904-\u0939\u093d\u0950\u0958-\u0961\u0971-\u0977\u0979-\u097f\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bd\u09ce\u09dc\u09dd\u09df-\u09e1\u09f0\u09f1\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a59-\u0a5c\u0a5e\u0a72-\u0a74\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abd\u0ad0\u0ae0\u0ae1\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3d\u0b5c\u0b5d\u0b5f-\u0b61\u0b71\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bd0\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c33\u0c35-\u0c39\u0c3d\u0c58\u0c59\u0c60\u0c61\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cde\u0ce0\u0ce1\u0cf1\u0cf2\u0d05-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d\u0d4e\u0d60\u0d61\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0e01-\u0e30\u0e32\u0e33\u0e40-\u0e46\u0e81\u0e82\u0e84\u0e87\u0e88\u0e8a\u0e8d\u0e94-\u0e97\u0e99-\u0e9f\u0ea1-\u0ea3\u0ea5\u0ea7\u0eaa\u0eab\u0ead-\u0eb0\u0eb2\u0eb3\u0ebd\u0ec0-\u0ec4\u0ec6\u0edc-\u0edf\u0f00\u0f40-\u0f47\u0f49-\u0f6c\u0f88-\u0f8c\u1000-\u102a\u103f\u1050-\u1055\u105a-\u105d\u1061\u1065\u1066\u106e-\u1070\u1075-\u1081\u108e\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u1380-\u138f\u13a0-\u13f4\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f0\u1700-\u170c\u170e-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1780-\u17b3\u17d7\u17dc\u1820-\u1877\u1880-\u18a8\u18aa\u18b0-\u18f5\u1900-\u191c\u1950-\u196d\u1970-\u1974\u1980-\u19ab\u19c1-\u19c7\u1a00-\u1a16\u1a20-\u1a54\u1aa7\u1b05-\u1b33\u1b45-\u1b4b\u1b83-\u1ba0\u1bae\u1baf\u1bba-\u1be5\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c7d\u1ce9-\u1cec\u1cee-\u1cf1\u1cf5\u1cf6\u1d00-\u1dbf\u1e00-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u2071\u207f\u2090-\u209c\u2102\u2107\u210a-\u2113\u2115\u2119-\u211d\u2124\u2126\u2128\u212a-\u212d\u212f-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2c2e\u2c30-\u2c5e\u2c60-\u2ce4\u2ceb-\u2cee\u2cf2\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u2e2f\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303c\u3041-\u3096\u309d-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312d\u3131-\u318e\u31a0-\u31ba\u31f0-\u31ff\u3400-\u4db5\u4e00-\u9fcc\ua000-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua697\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua78e\ua790-\ua793\ua7a0-\ua7aa\ua7f8-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua90a-\ua925\ua930-\ua946\ua960-\ua97c\ua984-\ua9b2\ua9cf\uaa00-\uaa28\uaa40-\uaa42\uaa44-\uaa4b\uaa60-\uaa76\uaa7a\uaa80-\uaaaf\uaab1\uaab5\uaab6\uaab9-\uaabd\uaac0\uaac2\uaadb-\uaadd\uaae0-\uaaea\uaaf2-\uaaf4\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uabc0-\uabe2\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d\ufb1f-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\uff21-\uff3a\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc]'),
        NonAsciiIdentifierPart: new RegExp('[\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0300-\u0374\u0376\u0377\u037a-\u037d\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u0483-\u0487\u048a-\u0527\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u05d0-\u05ea\u05f0-\u05f2\u0610-\u061a\u0620-\u0669\u066e-\u06d3\u06d5-\u06dc\u06df-\u06e8\u06ea-\u06fc\u06ff\u0710-\u074a\u074d-\u07b1\u07c0-\u07f5\u07fa\u0800-\u082d\u0840-\u085b\u08a0\u08a2-\u08ac\u08e4-\u08fe\u0900-\u0963\u0966-\u096f\u0971-\u0977\u0979-\u097f\u0981-\u0983\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bc-\u09c4\u09c7\u09c8\u09cb-\u09ce\u09d7\u09dc\u09dd\u09df-\u09e3\u09e6-\u09f1\u0a01-\u0a03\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a3c\u0a3e-\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a59-\u0a5c\u0a5e\u0a66-\u0a75\u0a81-\u0a83\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abc-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0ad0\u0ae0-\u0ae3\u0ae6-\u0aef\u0b01-\u0b03\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3c-\u0b44\u0b47\u0b48\u0b4b-\u0b4d\u0b56\u0b57\u0b5c\u0b5d\u0b5f-\u0b63\u0b66-\u0b6f\u0b71\u0b82\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd0\u0bd7\u0be6-\u0bef\u0c01-\u0c03\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c33\u0c35-\u0c39\u0c3d-\u0c44\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c58\u0c59\u0c60-\u0c63\u0c66-\u0c6f\u0c82\u0c83\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbc-\u0cc4\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5\u0cd6\u0cde\u0ce0-\u0ce3\u0ce6-\u0cef\u0cf1\u0cf2\u0d02\u0d03\u0d05-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d-\u0d44\u0d46-\u0d48\u0d4a-\u0d4e\u0d57\u0d60-\u0d63\u0d66-\u0d6f\u0d7a-\u0d7f\u0d82\u0d83\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0dca\u0dcf-\u0dd4\u0dd6\u0dd8-\u0ddf\u0df2\u0df3\u0e01-\u0e3a\u0e40-\u0e4e\u0e50-\u0e59\u0e81\u0e82\u0e84\u0e87\u0e88\u0e8a\u0e8d\u0e94-\u0e97\u0e99-\u0e9f\u0ea1-\u0ea3\u0ea5\u0ea7\u0eaa\u0eab\u0ead-\u0eb9\u0ebb-\u0ebd\u0ec0-\u0ec4\u0ec6\u0ec8-\u0ecd\u0ed0-\u0ed9\u0edc-\u0edf\u0f00\u0f18\u0f19\u0f20-\u0f29\u0f35\u0f37\u0f39\u0f3e-\u0f47\u0f49-\u0f6c\u0f71-\u0f84\u0f86-\u0f97\u0f99-\u0fbc\u0fc6\u1000-\u1049\u1050-\u109d\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u135d-\u135f\u1380-\u138f\u13a0-\u13f4\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f0\u1700-\u170c\u170e-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176c\u176e-\u1770\u1772\u1773\u1780-\u17d3\u17d7\u17dc\u17dd\u17e0-\u17e9\u180b-\u180d\u1810-\u1819\u1820-\u1877\u1880-\u18aa\u18b0-\u18f5\u1900-\u191c\u1920-\u192b\u1930-\u193b\u1946-\u196d\u1970-\u1974\u1980-\u19ab\u19b0-\u19c9\u19d0-\u19d9\u1a00-\u1a1b\u1a20-\u1a5e\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1aa7\u1b00-\u1b4b\u1b50-\u1b59\u1b6b-\u1b73\u1b80-\u1bf3\u1c00-\u1c37\u1c40-\u1c49\u1c4d-\u1c7d\u1cd0-\u1cd2\u1cd4-\u1cf6\u1d00-\u1de6\u1dfc-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u200c\u200d\u203f\u2040\u2054\u2071\u207f\u2090-\u209c\u20d0-\u20dc\u20e1\u20e5-\u20f0\u2102\u2107\u210a-\u2113\u2115\u2119-\u211d\u2124\u2126\u2128\u212a-\u212d\u212f-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2c2e\u2c30-\u2c5e\u2c60-\u2ce4\u2ceb-\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d7f-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u2de0-\u2dff\u2e2f\u3005-\u3007\u3021-\u302f\u3031-\u3035\u3038-\u303c\u3041-\u3096\u3099\u309a\u309d-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312d\u3131-\u318e\u31a0-\u31ba\u31f0-\u31ff\u3400-\u4db5\u4e00-\u9fcc\ua000-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua62b\ua640-\ua66f\ua674-\ua67d\ua67f-\ua697\ua69f-\ua6f1\ua717-\ua71f\ua722-\ua788\ua78b-\ua78e\ua790-\ua793\ua7a0-\ua7aa\ua7f8-\ua827\ua840-\ua873\ua880-\ua8c4\ua8d0-\ua8d9\ua8e0-\ua8f7\ua8fb\ua900-\ua92d\ua930-\ua953\ua960-\ua97c\ua980-\ua9c0\ua9cf-\ua9d9\uaa00-\uaa36\uaa40-\uaa4d\uaa50-\uaa59\uaa60-\uaa76\uaa7a\uaa7b\uaa80-\uaac2\uaadb-\uaadd\uaae0-\uaaef\uaaf2-\uaaf6\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uabc0-\uabea\uabec\uabed\uabf0-\uabf9\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe00-\ufe0f\ufe20-\ufe26\ufe33\ufe34\ufe4d-\ufe4f\ufe70-\ufe74\ufe76-\ufefc\uff10-\uff19\uff21-\uff3a\uff3f\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc]')
    };

    // Ensure the condition is true, otherwise throw an error.
    // This is only to have a better contract semantic, i.e. another safety net
    // to catch a logic error. The condition shall be fulfilled in normal case.
    // Do NOT use this to enforce a certain condition on any user input.

    function assert(condition, message) {
        if (!condition) {
            throw new Error('ASSERT: ' + message);
        }
    }

    function sliceSource(from, to) {
        return source.slice(from, to);
    }

    if (typeof 'esprima'[0] === 'undefined') {
        sliceSource = function sliceArraySource(from, to) {
            return source.slice(from, to).join('');
        };
    }

    function isDecimalDigit(ch) {
        return '0123456789'.indexOf(ch) >= 0;
    }

    function isHexDigit(ch) {
        return '0123456789abcdefABCDEF'.indexOf(ch) >= 0;
    }

    function isOctalDigit(ch) {
        return '01234567'.indexOf(ch) >= 0;
    }


    // 7.2 White Space

    function isWhiteSpace(ch) {
        return (ch === ' ') || (ch === '\u0009') || (ch === '\u000B') ||
            (ch === '\u000C') || (ch === '\u00A0') ||
            (ch.charCodeAt(0) >= 0x1680 &&
             '\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\uFEFF'.indexOf(ch) >= 0);
    }

    // 7.3 Line Terminators

    function isLineTerminator(ch) {
        return (ch === '\n' || ch === '\r' || ch === '\u2028' || ch === '\u2029');
    }

    // 7.6 Identifier Names and Identifiers

    function isIdentifierStart(ch) {
        return (ch === '$') || (ch === '_') || (ch === '\\') ||
            (ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') ||
            ((ch.charCodeAt(0) >= 0x80) && Regex.NonAsciiIdentifierStart.test(ch));
    }

    function isIdentifierPart(ch) {
        return (ch === '$') || (ch === '_') || (ch === '\\') ||
            (ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') ||
            ((ch >= '0') && (ch <= '9')) ||
            ((ch.charCodeAt(0) >= 0x80) && Regex.NonAsciiIdentifierPart.test(ch));
    }

    // 7.6.1.2 Future Reserved Words

    function isFutureReservedWord(id) {
        switch (id) {

        // Future reserved words.
        case 'class':
        case 'enum':
        case 'export':
        case 'extends':
        case 'import':
        case 'super':
            return true;
        }

        return false;
    }

    function isStrictModeReservedWord(id) {
        switch (id) {

        // Strict Mode reserved words.
        case 'implements':
        case 'interface':
        case 'package':
        case 'private':
        case 'protected':
        case 'public':
        case 'static':
        case 'yield':
        case 'let':
            return true;
        }

        return false;
    }

    function isRestrictedWord(id) {
        return id === 'eval' || id === 'arguments';
    }

    // 7.6.1.1 Keywords

    function isKeyword(id) {
        var keyword = false;
        switch (id.length) {
        case 2:
            keyword = (id === 'if') || (id === 'in') || (id === 'do');
            break;
        case 3:
            keyword = (id === 'var') || (id === 'for') || (id === 'new') || (id === 'try');
            break;
        case 4:
            keyword = (id === 'this') || (id === 'else') || (id === 'case') || (id === 'void') || (id === 'with');
            break;
        case 5:
            keyword = (id === 'while') || (id === 'break') || (id === 'catch') || (id === 'throw');
            break;
        case 6:
            keyword = (id === 'return') || (id === 'typeof') || (id === 'delete') || (id === 'switch');
            break;
        case 7:
            keyword = (id === 'default') || (id === 'finally');
            break;
        case 8:
            keyword = (id === 'function') || (id === 'continue') || (id === 'debugger');
            break;
        case 10:
            keyword = (id === 'instanceof');
            break;
        }

        if (keyword) {
            return true;
        }

        switch (id) {
        // Future reserved words.
        // 'const' is specialized as Keyword in V8.
        case 'const':
            return true;

        // For compatiblity to SpiderMonkey and ES.next
        case 'yield':
        case 'let':
            return true;
        }

        if (strict && isStrictModeReservedWord(id)) {
            return true;
        }

        return isFutureReservedWord(id);
    }

    // 7.4 Comments

    function skipComment() {
        var ch, blockComment, lineComment;

        blockComment = false;
        lineComment = false;

        while (index < length) {
            ch = source[index];

            if (lineComment) {
                ch = source[index++];
                if (isLineTerminator(ch)) {
                    lineComment = false;
                    if (ch === '\r' && source[index] === '\n') {
                        ++index;
                    }
                    ++lineNumber;
                    lineStart = index;
                }
            } else if (blockComment) {
                if (isLineTerminator(ch)) {
                    if (ch === '\r' && source[index + 1] === '\n') {
                        ++index;
                    }
                    ++lineNumber;
                    ++index;
                    lineStart = index;
                    if (index >= length) {
                        throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
                    }
                } else {
                    ch = source[index++];
                    if (index >= length) {
                        throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
                    }
                    if (ch === '*') {
                        ch = source[index];
                        if (ch === '/') {
                            ++index;
                            blockComment = false;
                        }
                    }
                }
            } else if (ch === '/') {
                ch = source[index + 1];
                if (ch === '/') {
                    index += 2;
                    lineComment = true;
                } else if (ch === '*') {
                    index += 2;
                    blockComment = true;
                    if (index >= length) {
                        throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
                    }
                } else {
                    break;
                }
            } else if (isWhiteSpace(ch)) {
                ++index;
            } else if (isLineTerminator(ch)) {
                ++index;
                if (ch ===  '\r' && source[index] === '\n') {
                    ++index;
                }
                ++lineNumber;
                lineStart = index;
            } else {
                break;
            }
        }
    }

    function scanHexEscape(prefix) {
        var i, len, ch, code = 0;

        len = (prefix === 'u') ? 4 : 2;
        for (i = 0; i < len; ++i) {
            if (index < length && isHexDigit(source[index])) {
                ch = source[index++];
                code = code * 16 + '0123456789abcdef'.indexOf(ch.toLowerCase());
            } else {
                return '';
            }
        }
        return String.fromCharCode(code);
    }

    function scanIdentifier() {
        var ch, start, id, restore;

        ch = source[index];
        if (!isIdentifierStart(ch)) {
            return;
        }

        start = index;
        if (ch === '\\') {
            ++index;
            if (source[index] !== 'u') {
                return;
            }
            ++index;
            restore = index;
            ch = scanHexEscape('u');
            if (ch) {
                if (ch === '\\' || !isIdentifierStart(ch)) {
                    return;
                }
                id = ch;
            } else {
                index = restore;
                id = 'u';
            }
        } else {
            id = source[index++];
        }

        while (index < length) {
            ch = source[index];
            if (!isIdentifierPart(ch)) {
                break;
            }
            if (ch === '\\') {
                ++index;
                if (source[index] !== 'u') {
                    return;
                }
                ++index;
                restore = index;
                ch = scanHexEscape('u');
                if (ch) {
                    if (ch === '\\' || !isIdentifierPart(ch)) {
                        return;
                    }
                    id += ch;
                } else {
                    index = restore;
                    id += 'u';
                }
            } else {
                id += source[index++];
            }
        }

        // There is no keyword or literal with only one character.
        // Thus, it must be an identifier.
        if (id.length === 1) {
            return {
                type: Token.Identifier,
                value: id,
                lineNumber: lineNumber,
                lineStart: lineStart,
                range: [start, index]
            };
        }

        if (isKeyword(id)) {
            return {
                type: Token.Keyword,
                value: id,
                lineNumber: lineNumber,
                lineStart: lineStart,
                range: [start, index]
            };
        }

        // 7.8.1 Null Literals

        if (id === 'null') {
            return {
                type: Token.NullLiteral,
                value: id,
                lineNumber: lineNumber,
                lineStart: lineStart,
                range: [start, index]
            };
        }

        // 7.8.2 Boolean Literals

        if (id === 'true' || id === 'false') {
            return {
                type: Token.BooleanLiteral,
                value: id,
                lineNumber: lineNumber,
                lineStart: lineStart,
                range: [start, index]
            };
        }

        return {
            type: Token.Identifier,
            value: id,
            lineNumber: lineNumber,
            lineStart: lineStart,
            range: [start, index]
        };
    }

    // 7.7 Punctuators

    function scanPunctuator() {
        var start = index,
            ch1 = source[index],
            ch2,
            ch3,
            ch4;

        // Check for most common single-character punctuators.

        if (ch1 === ';' || ch1 === '{' || ch1 === '}') {
            ++index;
            return {
                type: Token.Punctuator,
                value: ch1,
                lineNumber: lineNumber,
                lineStart: lineStart,
                range: [start, index]
            };
        }

        if (ch1 === ',' || ch1 === '(' || ch1 === ')') {
            ++index;
            return {
                type: Token.Punctuator,
                value: ch1,
                lineNumber: lineNumber,
                lineStart: lineStart,
                range: [start, index]
            };
        }

        // Dot (.) can also start a floating-point number, hence the need
        // to check the next character.

        ch2 = source[index + 1];
        if (ch1 === '.' && !isDecimalDigit(ch2)) {
            return {
                type: Token.Punctuator,
                value: source[index++],
                lineNumber: lineNumber,
                lineStart: lineStart,
                range: [start, index]
            };
        }

        // Peek more characters.

        ch3 = source[index + 2];
        ch4 = source[index + 3];

        // 4-character punctuator: >>>=

        if (ch1 === '>' && ch2 === '>' && ch3 === '>') {
            if (ch4 === '=') {
                index += 4;
                return {
                    type: Token.Punctuator,
                    value: '>>>=',
                    lineNumber: lineNumber,
                    lineStart: lineStart,
                    range: [start, index]
                };
            }
        }

        // 3-character punctuators: === !== >>> <<= >>=

        if (ch1 === '=' && ch2 === '=' && ch3 === '=') {
            index += 3;
            return {
                type: Token.Punctuator,
                value: '===',
                lineNumber: lineNumber,
                lineStart: lineStart,
                range: [start, index]
            };
        }

        if (ch1 === '!' && ch2 === '=' && ch3 === '=') {
            index += 3;
            return {
                type: Token.Punctuator,
                value: '!==',
                lineNumber: lineNumber,
                lineStart: lineStart,
                range: [start, index]
            };
        }

        if (ch1 === '>' && ch2 === '>' && ch3 === '>') {
            index += 3;
            return {
                type: Token.Punctuator,
                value: '>>>',
                lineNumber: lineNumber,
                lineStart: lineStart,
                range: [start, index]
            };
        }

        if (ch1 === '<' && ch2 === '<' && ch3 === '=') {
            index += 3;
            return {
                type: Token.Punctuator,
                value: '<<=',
                lineNumber: lineNumber,
                lineStart: lineStart,
                range: [start, index]
            };
        }

        if (ch1 === '>' && ch2 === '>' && ch3 === '=') {
            index += 3;
            return {
                type: Token.Punctuator,
                value: '>>=',
                lineNumber: lineNumber,
                lineStart: lineStart,
                range: [start, index]
            };
        }

        // 2-character punctuators: <= >= == != ++ -- << >> && ||
        // += -= *= %= &= |= ^= /=

        if (ch2 === '=') {
            if ('<>=!+-*%&|^/'.indexOf(ch1) >= 0) {
                index += 2;
                return {
                    type: Token.Punctuator,
                    value: ch1 + ch2,
                    lineNumber: lineNumber,
                    lineStart: lineStart,
                    range: [start, index]
                };
            }
        }

        if (ch1 === ch2 && ('+-<>&|'.indexOf(ch1) >= 0)) {
            if ('+-<>&|'.indexOf(ch2) >= 0) {
                index += 2;
                return {
                    type: Token.Punctuator,
                    value: ch1 + ch2,
                    lineNumber: lineNumber,
                    lineStart: lineStart,
                    range: [start, index]
                };
            }
        }

        // The remaining 1-character punctuators.

        if ('[]<>+-*%&|^!~?:=/'.indexOf(ch1) >= 0) {
            return {
                type: Token.Punctuator,
                value: source[index++],
                lineNumber: lineNumber,
                lineStart: lineStart,
                range: [start, index]
            };
        }
    }

    // 7.8.3 Numeric Literals

    function scanNumericLiteral() {
        var number, start, ch;

        ch = source[index];
        assert(isDecimalDigit(ch) || (ch === '.'),
            'Numeric literal must start with a decimal digit or a decimal point');

        start = index;
        number = '';
        if (ch !== '.') {
            number = source[index++];
            ch = source[index];

            // Hex number starts with '0x'.
            // Octal number starts with '0'.
            if (number === '0') {
                if (ch === 'x' || ch === 'X') {
                    number += source[index++];
                    while (index < length) {
                        ch = source[index];
                        if (!isHexDigit(ch)) {
                            break;
                        }
                        number += source[index++];
                    }

                    if (number.length <= 2) {
                        // only 0x
                        throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
                    }

                    if (index < length) {
                        ch = source[index];
                        if (isIdentifierStart(ch)) {
                            throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
                        }
                    }
                    return {
                        type: Token.NumericLiteral,
                        value: parseInt(number, 16),
                        lineNumber: lineNumber,
                        lineStart: lineStart,
                        range: [start, index]
                    };
                } else if (isOctalDigit(ch)) {
                    number += source[index++];
                    while (index < length) {
                        ch = source[index];
                        if (!isOctalDigit(ch)) {
                            break;
                        }
                        number += source[index++];
                    }

                    if (index < length) {
                        ch = source[index];
                        if (isIdentifierStart(ch) || isDecimalDigit(ch)) {
                            throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
                        }
                    }
                    return {
                        type: Token.NumericLiteral,
                        value: parseInt(number, 8),
                        octal: true,
                        lineNumber: lineNumber,
                        lineStart: lineStart,
                        range: [start, index]
                    };
                }

                // decimal number starts with '0' such as '09' is illegal.
                if (isDecimalDigit(ch)) {
                    throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
                }
            }

            while (index < length) {
                ch = source[index];
                if (!isDecimalDigit(ch)) {
                    break;
                }
                number += source[index++];
            }
        }

        if (ch === '.') {
            number += source[index++];
            while (index < length) {
                ch = source[index];
                if (!isDecimalDigit(ch)) {
                    break;
                }
                number += source[index++];
            }
        }

        if (ch === 'e' || ch === 'E') {
            number += source[index++];

            ch = source[index];
            if (ch === '+' || ch === '-') {
                number += source[index++];
            }

            ch = source[index];
            if (isDecimalDigit(ch)) {
                number += source[index++];
                while (index < length) {
                    ch = source[index];
                    if (!isDecimalDigit(ch)) {
                        break;
                    }
                    number += source[index++];
                }
            } else {
                ch = 'character ' + ch;
                if (index >= length) {
                    ch = '<end>';
                }
                throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
            }
        }

        if (index < length) {
            ch = source[index];
            if (isIdentifierStart(ch)) {
                throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
            }
        }

        return {
            type: Token.NumericLiteral,
            value: parseFloat(number),
            lineNumber: lineNumber,
            lineStart: lineStart,
            range: [start, index]
        };
    }

    // 7.8.4 String Literals

    function scanStringLiteral() {
        var str = '', quote, start, ch, code, unescaped, restore, octal = false;

        quote = source[index];
        assert((quote === '\'' || quote === '"'),
            'String literal must starts with a quote');

        start = index;
        ++index;

        while (index < length) {
            ch = source[index++];

            if (ch === quote) {
                quote = '';
                break;
            } else if (ch === '\\') {
                ch = source[index++];
                if (!isLineTerminator(ch)) {
                    switch (ch) {
                    case 'n':
                        str += '\n';
                        break;
                    case 'r':
                        str += '\r';
                        break;
                    case 't':
                        str += '\t';
                        break;
                    case 'u':
                    case 'x':
                        restore = index;
                        unescaped = scanHexEscape(ch);
                        if (unescaped) {
                            str += unescaped;
                        } else {
                            index = restore;
                            str += ch;
                        }
                        break;
                    case 'b':
                        str += '\b';
                        break;
                    case 'f':
                        str += '\f';
                        break;
                    case 'v':
                        str += '\x0B';
                        break;

                    default:
                        if (isOctalDigit(ch)) {
                            code = '01234567'.indexOf(ch);

                            // \0 is not octal escape sequence
                            if (code !== 0) {
                                octal = true;
                            }

                            if (index < length && isOctalDigit(source[index])) {
                                octal = true;
                                code = code * 8 + '01234567'.indexOf(source[index++]);

                                // 3 digits are only allowed when string starts
                                // with 0, 1, 2, 3
                                if ('0123'.indexOf(ch) >= 0 &&
                                        index < length &&
                                        isOctalDigit(source[index])) {
                                    code = code * 8 + '01234567'.indexOf(source[index++]);
                                }
                            }
                            str += String.fromCharCode(code);
                        } else {
                            str += ch;
                        }
                        break;
                    }
                } else {
                    ++lineNumber;
                    if (ch ===  '\r' && source[index] === '\n') {
                        ++index;
                    }
                }
            } else if (isLineTerminator(ch)) {
                break;
            } else {
                str += ch;
            }
        }

        if (quote !== '') {
            throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
        }

        return {
            type: Token.StringLiteral,
            value: str,
            octal: octal,
            lineNumber: lineNumber,
            lineStart: lineStart,
            range: [start, index]
        };
    }

    function scanRegExp() {
        var str, ch, start, pattern, flags, value, classMarker = false, restore, terminated = false;

        buffer = null;
        skipComment();

        start = index;
        ch = source[index];
        assert(ch === '/', 'Regular expression literal must start with a slash');
        str = source[index++];

        while (index < length) {
            ch = source[index++];
            str += ch;
            if (ch === '\\') {
                ch = source[index++];
                // ECMA-262 7.8.5
                if (isLineTerminator(ch)) {
                    throwError({}, Messages.UnterminatedRegExp);
                }
                str += ch;
            } else if (classMarker) {
                if (ch === ']') {
                    classMarker = false;
                }
            } else {
                if (ch === '/') {
                    terminated = true;
                    break;
                } else if (ch === '[') {
                    classMarker = true;
                } else if (isLineTerminator(ch)) {
                    throwError({}, Messages.UnterminatedRegExp);
                }
            }
        }

        if (!terminated) {
            throwError({}, Messages.UnterminatedRegExp);
        }

        // Exclude leading and trailing slash.
        pattern = str.substr(1, str.length - 2);

        flags = '';
        while (index < length) {
            ch = source[index];
            if (!isIdentifierPart(ch)) {
                break;
            }

            ++index;
            if (ch === '\\' && index < length) {
                ch = source[index];
                if (ch === 'u') {
                    ++index;
                    restore = index;
                    ch = scanHexEscape('u');
                    if (ch) {
                        flags += ch;
                        str += '\\u';
                        for (; restore < index; ++restore) {
                            str += source[restore];
                        }
                    } else {
                        index = restore;
                        flags += 'u';
                        str += '\\u';
                    }
                } else {
                    str += '\\';
                }
            } else {
                flags += ch;
                str += ch;
            }
        }

        try {
            value = new RegExp(pattern, flags);
        } catch (e) {
            throwError({}, Messages.InvalidRegExp);
        }

        return {
            literal: str,
            value: value,
            range: [start, index]
        };
    }

    function isIdentifierName(token) {
        return token.type === Token.Identifier ||
            token.type === Token.Keyword ||
            token.type === Token.BooleanLiteral ||
            token.type === Token.NullLiteral;
    }

    function advance() {
        var ch, token;

        skipComment();

        if (index >= length) {
            return {
                type: Token.EOF,
                lineNumber: lineNumber,
                lineStart: lineStart,
                range: [index, index]
            };
        }

        token = scanPunctuator();
        if (typeof token !== 'undefined') {
            return token;
        }

        ch = source[index];

        if (ch === '\'' || ch === '"') {
            return scanStringLiteral();
        }

        if (ch === '.' || isDecimalDigit(ch)) {
            return scanNumericLiteral();
        }

        token = scanIdentifier();
        if (typeof token !== 'undefined') {
            return token;
        }

        throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
    }

    function lex() {
        var token;

        if (buffer) {
            index = buffer.range[1];
            lineNumber = buffer.lineNumber;
            lineStart = buffer.lineStart;
            token = buffer;
            buffer = null;
            return token;
        }

        buffer = null;
        return advance();
    }

    function lookahead() {
        var pos, line, start;

        if (buffer !== null) {
            return buffer;
        }

        pos = index;
        line = lineNumber;
        start = lineStart;
        buffer = advance();
        index = pos;
        lineNumber = line;
        lineStart = start;

        return buffer;
    }

    // Return true if there is a line terminator before the next token.

    function peekLineTerminator() {
        var pos, line, start, found;

        pos = index;
        line = lineNumber;
        start = lineStart;
        skipComment();
        found = lineNumber !== line;
        index = pos;
        lineNumber = line;
        lineStart = start;

        return found;
    }

    // Throw an exception

    function throwError(token, messageFormat) {
        var error,
            args = Array.prototype.slice.call(arguments, 2),
            msg = messageFormat.replace(
                /%(\d)/g,
                function (whole, index) {
                    return args[index] || '';
                }
            );

        if (typeof token.lineNumber === 'number') {
            error = new Error('Line ' + token.lineNumber + ': ' + msg);
            error.index = token.range[0];
            error.lineNumber = token.lineNumber;
            error.column = token.range[0] - lineStart + 1;
        } else {
            error = new Error('Line ' + lineNumber + ': ' + msg);
            error.index = index;
            error.lineNumber = lineNumber;
            error.column = index - lineStart + 1;
        }

        throw error;
    }

    function throwErrorTolerant() {
        try {
            throwError.apply(null, arguments);
        } catch (e) {
            if (extra.errors) {
                extra.errors.push(e);
            } else {
                throw e;
            }
        }
    }


    // Throw an exception because of the token.

    function throwUnexpected(token) {
        if (token.type === Token.EOF) {
            throwError(token, Messages.UnexpectedEOS);
        }

        if (token.type === Token.NumericLiteral) {
            throwError(token, Messages.UnexpectedNumber);
        }

        if (token.type === Token.StringLiteral) {
            throwError(token, Messages.UnexpectedString);
        }

        if (token.type === Token.Identifier) {
            throwError(token, Messages.UnexpectedIdentifier);
        }

        if (token.type === Token.Keyword) {
            if (isFutureReservedWord(token.value)) {
                throwError(token, Messages.UnexpectedReserved);
            } else if (strict && isStrictModeReservedWord(token.value)) {
                throwErrorTolerant(token, Messages.StrictReservedWord);
                return;
            }
            throwError(token, Messages.UnexpectedToken, token.value);
        }

        // BooleanLiteral, NullLiteral, or Punctuator.
        throwError(token, Messages.UnexpectedToken, token.value);
    }

    // Expect the next token to match the specified punctuator.
    // If not, an exception will be thrown.

    function expect(value) {
        var token = lex();
        if (token.type !== Token.Punctuator || token.value !== value) {
            throwUnexpected(token);
        }
    }

    // Expect the next token to match the specified keyword.
    // If not, an exception will be thrown.

    function expectKeyword(keyword) {
        var token = lex();
        if (token.type !== Token.Keyword || token.value !== keyword) {
            throwUnexpected(token);
        }
    }

    // Return true if the next token matches the specified punctuator.

    function match(value) {
        var token = lookahead();
        return token.type === Token.Punctuator && token.value === value;
    }

    // Return true if the next token matches the specified keyword

    function matchKeyword(keyword) {
        var token = lookahead();
        return token.type === Token.Keyword && token.value === keyword;
    }

    // Return true if the next token is an assignment operator

    function matchAssign() {
        var token = lookahead(),
            op = token.value;

        if (token.type !== Token.Punctuator) {
            return false;
        }
        return op === '=' ||
            op === '*=' ||
            op === '/=' ||
            op === '%=' ||
            op === '+=' ||
            op === '-=' ||
            op === '<<=' ||
            op === '>>=' ||
            op === '>>>=' ||
            op === '&=' ||
            op === '^=' ||
            op === '|=';
    }

    function consumeSemicolon() {
        var token, line;

        // Catch the very common case first.
        if (source[index] === ';') {
            lex();
            return;
        }

        line = lineNumber;
        skipComment();
        if (lineNumber !== line) {
            return;
        }

        if (match(';')) {
            lex();
            return;
        }

        token = lookahead();
        if (token.type !== Token.EOF && !match('}')) {
            throwUnexpected(token);
        }
    }

    // Return true if provided expression is LeftHandSideExpression

    function isLeftHandSide(expr) {
        return expr.type === Syntax.Identifier || expr.type === Syntax.MemberExpression;
    }

    // 11.1.4 Array Initialiser

    function parseArrayInitialiser() {
        var elements = [];

        expect('[');

        while (!match(']')) {
            if (match(',')) {
                lex();
                elements.push(null);
            } else {
                elements.push(parseAssignmentExpression());

                if (!match(']')) {
                    expect(',');
                }
            }
        }

        expect(']');

        return {
            type: Syntax.ArrayExpression,
            elements: elements
        };
    }

    // 11.1.5 Object Initialiser

    function parsePropertyFunction(param, first) {
        var previousStrict, body;

        previousStrict = strict;
        body = parseFunctionSourceElements();
        if (first && strict && isRestrictedWord(param[0].name)) {
            throwErrorTolerant(first, Messages.StrictParamName);
        }
        strict = previousStrict;

        return {
            type: Syntax.FunctionExpression,
            id: null,
            params: param,
            defaults: [],
            body: body,
            rest: null,
            generator: false,
            expression: false
        };
    }

    function parseObjectPropertyKey() {
        var token = lex();

        // Note: This function is called only from parseObjectProperty(), where
        // EOF and Punctuator tokens are already filtered out.

        if (token.type === Token.StringLiteral || token.type === Token.NumericLiteral) {
            if (strict && token.octal) {
                throwErrorTolerant(token, Messages.StrictOctalLiteral);
            }
            return createLiteral(token);
        }

        return {
            type: Syntax.Identifier,
            name: token.value
        };
    }

    function parseObjectProperty() {
        var token, key, id, param;

        token = lookahead();

        if (token.type === Token.Identifier) {

            id = parseObjectPropertyKey();

            // Property Assignment: Getter and Setter.

            if (token.value === 'get' && !match(':')) {
                key = parseObjectPropertyKey();
                expect('(');
                expect(')');
                return {
                    type: Syntax.Property,
                    key: key,
                    value: parsePropertyFunction([]),
                    kind: 'get'
                };
            } else if (token.value === 'set' && !match(':')) {
                key = parseObjectPropertyKey();
                expect('(');
                token = lookahead();
                if (token.type !== Token.Identifier) {
                    expect(')');
                    throwErrorTolerant(token, Messages.UnexpectedToken, token.value);
                    return {
                        type: Syntax.Property,
                        key: key,
                        value: parsePropertyFunction([]),
                        kind: 'set'
                    };
                } else {
                    param = [ parseVariableIdentifier() ];
                    expect(')');
                    return {
                        type: Syntax.Property,
                        key: key,
                        value: parsePropertyFunction(param, token),
                        kind: 'set'
                    };
                }
            } else {
                expect(':');
                return {
                    type: Syntax.Property,
                    key: id,
                    value: parseAssignmentExpression(),
                    kind: 'init'
                };
            }
        } else if (token.type === Token.EOF || token.type === Token.Punctuator) {
            throwUnexpected(token);
        } else {
            key = parseObjectPropertyKey();
            expect(':');
            return {
                type: Syntax.Property,
                key: key,
                value: parseAssignmentExpression(),
                kind: 'init'
            };
        }
    }

    function parseObjectInitialiser() {
        var properties = [], property, name, kind, map = {}, toString = String;

        expect('{');

        while (!match('}')) {
            property = parseObjectProperty();

            if (property.key.type === Syntax.Identifier) {
                name = property.key.name;
            } else {
                name = toString(property.key.value);
            }
            kind = (property.kind === 'init') ? PropertyKind.Data : (property.kind === 'get') ? PropertyKind.Get : PropertyKind.Set;
            if (Object.prototype.hasOwnProperty.call(map, name)) {
                if (map[name] === PropertyKind.Data) {
                    if (strict && kind === PropertyKind.Data) {
                        throwErrorTolerant({}, Messages.StrictDuplicateProperty);
                    } else if (kind !== PropertyKind.Data) {
                        throwErrorTolerant({}, Messages.AccessorDataProperty);
                    }
                } else {
                    if (kind === PropertyKind.Data) {
                        throwErrorTolerant({}, Messages.AccessorDataProperty);
                    } else if (map[name] & kind) {
                        throwErrorTolerant({}, Messages.AccessorGetSet);
                    }
                }
                map[name] |= kind;
            } else {
                map[name] = kind;
            }

            properties.push(property);

            if (!match('}')) {
                expect(',');
            }
        }

        expect('}');

        return {
            type: Syntax.ObjectExpression,
            properties: properties
        };
    }

    // 11.1.6 The Grouping Operator

    function parseGroupExpression() {
        var expr;

        expect('(');

        expr = parseExpression();

        expect(')');

        return expr;
    }


    // 11.1 Primary Expressions

    function parsePrimaryExpression() {
        var token = lookahead(),
            type = token.type;

        if (type === Token.Identifier) {
            return {
                type: Syntax.Identifier,
                name: lex().value
            };
        }

        if (type === Token.StringLiteral || type === Token.NumericLiteral) {
            if (strict && token.octal) {
                throwErrorTolerant(token, Messages.StrictOctalLiteral);
            }
            return createLiteral(lex());
        }

        if (type === Token.Keyword) {
            if (matchKeyword('this')) {
                lex();
                return {
                    type: Syntax.ThisExpression
                };
            }

            if (matchKeyword('function')) {
                return parseFunctionExpression();
            }
        }

        if (type === Token.BooleanLiteral) {
            lex();
            token.value = (token.value === 'true');
            return createLiteral(token);
        }

        if (type === Token.NullLiteral) {
            lex();
            token.value = null;
            return createLiteral(token);
        }

        if (match('[')) {
            return parseArrayInitialiser();
        }

        if (match('{')) {
            return parseObjectInitialiser();
        }

        if (match('(')) {
            return parseGroupExpression();
        }

        if (match('/') || match('/=')) {
            return createLiteral(scanRegExp());
        }

        return throwUnexpected(lex());
    }

    // 11.2 Left-Hand-Side Expressions

    function parseArguments() {
        var args = [];

        expect('(');

        if (!match(')')) {
            while (index < length) {
                args.push(parseAssignmentExpression());
                if (match(')')) {
                    break;
                }
                expect(',');
            }
        }

        expect(')');

        return args;
    }

    function parseNonComputedProperty() {
        var token = lex();

        if (!isIdentifierName(token)) {
            throwUnexpected(token);
        }

        return {
            type: Syntax.Identifier,
            name: token.value
        };
    }

    function parseNonComputedMember() {
        expect('.');

        return parseNonComputedProperty();
    }

    function parseComputedMember() {
        var expr;

        expect('[');

        expr = parseExpression();

        expect(']');

        return expr;
    }

    function parseNewExpression() {
        var expr;

        expectKeyword('new');

        expr = {
            type: Syntax.NewExpression,
            callee: parseLeftHandSideExpression(),
            'arguments': []
        };

        if (match('(')) {
            expr['arguments'] = parseArguments();
        }

        return expr;
    }

    function parseLeftHandSideExpressionAllowCall() {
        var expr;

        expr = matchKeyword('new') ? parseNewExpression() : parsePrimaryExpression();

        while (match('.') || match('[') || match('(')) {
            if (match('(')) {
                expr = {
                    type: Syntax.CallExpression,
                    callee: expr,
                    'arguments': parseArguments()
                };
            } else if (match('[')) {
                expr = {
                    type: Syntax.MemberExpression,
                    computed: true,
                    object: expr,
                    property: parseComputedMember()
                };
            } else {
                expr = {
                    type: Syntax.MemberExpression,
                    computed: false,
                    object: expr,
                    property: parseNonComputedMember()
                };
            }
        }

        return expr;
    }


    function parseLeftHandSideExpression() {
        var expr;

        expr = matchKeyword('new') ? parseNewExpression() : parsePrimaryExpression();

        while (match('.') || match('[')) {
            if (match('[')) {
                expr = {
                    type: Syntax.MemberExpression,
                    computed: true,
                    object: expr,
                    property: parseComputedMember()
                };
            } else {
                expr = {
                    type: Syntax.MemberExpression,
                    computed: false,
                    object: expr,
                    property: parseNonComputedMember()
                };
            }
        }

        return expr;
    }

    // 11.3 Postfix Expressions

    function parsePostfixExpression() {
        var expr = parseLeftHandSideExpressionAllowCall(), token;

        token = lookahead();
        if (token.type !== Token.Punctuator) {
            return expr;
        }

        if ((match('++') || match('--')) && !peekLineTerminator()) {
            // 11.3.1, 11.3.2
            if (strict && expr.type === Syntax.Identifier && isRestrictedWord(expr.name)) {
                throwErrorTolerant({}, Messages.StrictLHSPostfix);
            }
            if (!isLeftHandSide(expr)) {
                throwErrorTolerant({}, Messages.InvalidLHSInAssignment);
            }

            expr = {
                type: Syntax.UpdateExpression,
                operator: lex().value,
                argument: expr,
                prefix: false
            };
        }

        return expr;
    }

    // 11.4 Unary Operators

    function parseUnaryExpression() {
        var token, expr;

        token = lookahead();
        if (token.type !== Token.Punctuator && token.type !== Token.Keyword) {
            return parsePostfixExpression();
        }

        if (match('++') || match('--')) {
            token = lex();
            expr = parseUnaryExpression();
            // 11.4.4, 11.4.5
            if (strict && expr.type === Syntax.Identifier && isRestrictedWord(expr.name)) {
                throwErrorTolerant({}, Messages.StrictLHSPrefix);
            }

            if (!isLeftHandSide(expr)) {
                throwErrorTolerant({}, Messages.InvalidLHSInAssignment);
            }

            expr = {
                type: Syntax.UpdateExpression,
                operator: token.value,
                argument: expr,
                prefix: true
            };
            return expr;
        }

        if (match('+') || match('-') || match('~') || match('!')) {
            expr = {
                type: Syntax.UnaryExpression,
                operator: lex().value,
                argument: parseUnaryExpression(),
                prefix: true
            };
            return expr;
        }

        if (matchKeyword('delete') || matchKeyword('void') || matchKeyword('typeof')) {
            expr = {
                type: Syntax.UnaryExpression,
                operator: lex().value,
                argument: parseUnaryExpression(),
                prefix: true
            };
            if (strict && expr.operator === 'delete' && expr.argument.type === Syntax.Identifier) {
                throwErrorTolerant({}, Messages.StrictDelete);
            }
            return expr;
        }

        return parsePostfixExpression();
    }

    // 11.5 Multiplicative Operators

    function parseMultiplicativeExpression() {
        var expr = parseUnaryExpression();

        while (match('*') || match('/') || match('%')) {
            expr = {
                type: Syntax.BinaryExpression,
                operator: lex().value,
                left: expr,
                right: parseUnaryExpression()
            };
        }

        return expr;
    }

    // 11.6 Additive Operators

    function parseAdditiveExpression() {
        var expr = parseMultiplicativeExpression();

        while (match('+') || match('-')) {
            expr = {
                type: Syntax.BinaryExpression,
                operator: lex().value,
                left: expr,
                right: parseMultiplicativeExpression()
            };
        }

        return expr;
    }

    // 11.7 Bitwise Shift Operators

    function parseShiftExpression() {
        var expr = parseAdditiveExpression();

        while (match('<<') || match('>>') || match('>>>')) {
            expr = {
                type: Syntax.BinaryExpression,
                operator: lex().value,
                left: expr,
                right: parseAdditiveExpression()
            };
        }

        return expr;
    }
    // 11.8 Relational Operators

    function parseRelationalExpression() {
        var expr, previousAllowIn;

        previousAllowIn = state.allowIn;
        state.allowIn = true;

        expr = parseShiftExpression();

        while (match('<') || match('>') || match('<=') || match('>=') || (previousAllowIn && matchKeyword('in')) || matchKeyword('instanceof')) {
            expr = {
                type: Syntax.BinaryExpression,
                operator: lex().value,
                left: expr,
                right: parseShiftExpression()
            };
        }

        state.allowIn = previousAllowIn;
        return expr;
    }

    // 11.9 Equality Operators

    function parseEqualityExpression() {
        var expr = parseRelationalExpression();

        while (match('==') || match('!=') || match('===') || match('!==')) {
            expr = {
                type: Syntax.BinaryExpression,
                operator: lex().value,
                left: expr,
                right: parseRelationalExpression()
            };
        }

        return expr;
    }

    // 11.10 Binary Bitwise Operators

    function parseBitwiseANDExpression() {
        var expr = parseEqualityExpression();

        while (match('&')) {
            lex();
            expr = {
                type: Syntax.BinaryExpression,
                operator: '&',
                left: expr,
                right: parseEqualityExpression()
            };
        }

        return expr;
    }

    function parseBitwiseXORExpression() {
        var expr = parseBitwiseANDExpression();

        while (match('^')) {
            lex();
            expr = {
                type: Syntax.BinaryExpression,
                operator: '^',
                left: expr,
                right: parseBitwiseANDExpression()
            };
        }

        return expr;
    }

    function parseBitwiseORExpression() {
        var expr = parseBitwiseXORExpression();

        while (match('|')) {
            lex();
            expr = {
                type: Syntax.BinaryExpression,
                operator: '|',
                left: expr,
                right: parseBitwiseXORExpression()
            };
        }

        return expr;
    }

    // 11.11 Binary Logical Operators

    function parseLogicalANDExpression() {
        var expr = parseBitwiseORExpression();

        while (match('&&')) {
            lex();
            expr = {
                type: Syntax.LogicalExpression,
                operator: '&&',
                left: expr,
                right: parseBitwiseORExpression()
            };
        }

        return expr;
    }

    function parseLogicalORExpression() {
        var expr = parseLogicalANDExpression();

        while (match('||')) {
            lex();
            expr = {
                type: Syntax.LogicalExpression,
                operator: '||',
                left: expr,
                right: parseLogicalANDExpression()
            };
        }

        return expr;
    }

    // 11.12 Conditional Operator

    function parseConditionalExpression() {
        var expr, previousAllowIn, consequent;

        expr = parseLogicalORExpression();

        if (match('?')) {
            lex();
            previousAllowIn = state.allowIn;
            state.allowIn = true;
            consequent = parseAssignmentExpression();
            state.allowIn = previousAllowIn;
            expect(':');

            expr = {
                type: Syntax.ConditionalExpression,
                test: expr,
                consequent: consequent,
                alternate: parseAssignmentExpression()
            };
        }

        return expr;
    }

    // 11.13 Assignment Operators

    function parseAssignmentExpression() {
        var token, expr;

        token = lookahead();
        expr = parseConditionalExpression();

        if (matchAssign()) {
            // LeftHandSideExpression
            if (!isLeftHandSide(expr)) {
                throwErrorTolerant({}, Messages.InvalidLHSInAssignment);
            }

            // 11.13.1
            if (strict && expr.type === Syntax.Identifier && isRestrictedWord(expr.name)) {
                throwErrorTolerant(token, Messages.StrictLHSAssignment);
            }

            expr = {
                type: Syntax.AssignmentExpression,
                operator: lex().value,
                left: expr,
                right: parseAssignmentExpression()
            };
        }

        return expr;
    }

    // 11.14 Comma Operator

    function parseExpression() {
        var expr = parseAssignmentExpression();

        if (match(',')) {
            expr = {
                type: Syntax.SequenceExpression,
                expressions: [ expr ]
            };

            while (index < length) {
                if (!match(',')) {
                    break;
                }
                lex();
                expr.expressions.push(parseAssignmentExpression());
            }

        }
        return expr;
    }

    // 12.1 Block

    function parseStatementList() {
        var list = [],
            statement;

        while (index < length) {
            if (match('}')) {
                break;
            }
            statement = parseSourceElement();
            if (typeof statement === 'undefined') {
                break;
            }
            list.push(statement);
        }

        return list;
    }

    function parseBlock() {
        var block;

        expect('{');

        block = parseStatementList();

        expect('}');

        return {
            type: Syntax.BlockStatement,
            body: block
        };
    }

    // 12.2 Variable Statement

    function parseVariableIdentifier() {
        var token = lex();

        if (token.type !== Token.Identifier) {
            throwUnexpected(token);
        }

        return {
            type: Syntax.Identifier,
            name: token.value
        };
    }

    function parseVariableDeclaration(kind) {
        var id = parseVariableIdentifier(),
            init = null;

        // 12.2.1
        if (strict && isRestrictedWord(id.name)) {
            throwErrorTolerant({}, Messages.StrictVarName);
        }

        if (kind === 'const') {
            expect('=');
            init = parseAssignmentExpression();
        } else if (match('=')) {
            lex();
            init = parseAssignmentExpression();
        }

        return {
            type: Syntax.VariableDeclarator,
            id: id,
            init: init
        };
    }

    function parseVariableDeclarationList(kind) {
        var list = [];

        do {
            list.push(parseVariableDeclaration(kind));
            if (!match(',')) {
                break;
            }
            lex();
        } while (index < length);

        return list;
    }

    function parseVariableStatement() {
        var declarations;

        expectKeyword('var');

        declarations = parseVariableDeclarationList();

        consumeSemicolon();

        return {
            type: Syntax.VariableDeclaration,
            declarations: declarations,
            kind: 'var'
        };
    }

    // kind may be `const` or `let`
    // Both are experimental and not in the specification yet.
    // see http://wiki.ecmascript.org/doku.php?id=harmony:const
    // and http://wiki.ecmascript.org/doku.php?id=harmony:let
    function parseConstLetDeclaration(kind) {
        var declarations;

        expectKeyword(kind);

        declarations = parseVariableDeclarationList(kind);

        consumeSemicolon();

        return {
            type: Syntax.VariableDeclaration,
            declarations: declarations,
            kind: kind
        };
    }

    // 12.3 Empty Statement

    function parseEmptyStatement() {
        expect(';');

        return {
            type: Syntax.EmptyStatement
        };
    }

    // 12.4 Expression Statement

    function parseExpressionStatement() {
        var expr = parseExpression();

        consumeSemicolon();

        return {
            type: Syntax.ExpressionStatement,
            expression: expr
        };
    }

    // 12.5 If statement

    function parseIfStatement() {
        var test, consequent, alternate;

        expectKeyword('if');

        expect('(');

        test = parseExpression();

        expect(')');

        consequent = parseStatement();

        if (matchKeyword('else')) {
            lex();
            alternate = parseStatement();
        } else {
            alternate = null;
        }

        return {
            type: Syntax.IfStatement,
            test: test,
            consequent: consequent,
            alternate: alternate
        };
    }

    // 12.6 Iteration Statements

    function parseDoWhileStatement() {
        var body, test, oldInIteration;

        expectKeyword('do');

        oldInIteration = state.inIteration;
        state.inIteration = true;

        body = parseStatement();

        state.inIteration = oldInIteration;

        expectKeyword('while');

        expect('(');

        test = parseExpression();

        expect(')');

        if (match(';')) {
            lex();
        }

        return {
            type: Syntax.DoWhileStatement,
            body: body,
            test: test
        };
    }

    function parseWhileStatement() {
        var test, body, oldInIteration;

        expectKeyword('while');

        expect('(');

        test = parseExpression();

        expect(')');

        oldInIteration = state.inIteration;
        state.inIteration = true;

        body = parseStatement();

        state.inIteration = oldInIteration;

        return {
            type: Syntax.WhileStatement,
            test: test,
            body: body
        };
    }

    function parseForVariableDeclaration() {
        var token = lex();

        return {
            type: Syntax.VariableDeclaration,
            declarations: parseVariableDeclarationList(),
            kind: token.value
        };
    }

    function parseForStatement() {
        var init, test, update, left, right, body, oldInIteration;

        init = test = update = null;

        expectKeyword('for');

        expect('(');

        if (match(';')) {
            lex();
        } else {
            if (matchKeyword('var') || matchKeyword('let')) {
                state.allowIn = false;
                init = parseForVariableDeclaration();
                state.allowIn = true;

                if (init.declarations.length === 1 && matchKeyword('in')) {
                    lex();
                    left = init;
                    right = parseExpression();
                    init = null;
                }
            } else {
                state.allowIn = false;
                init = parseExpression();
                state.allowIn = true;

                if (matchKeyword('in')) {
                    // LeftHandSideExpression
                    if (!isLeftHandSide(init)) {
                        throwErrorTolerant({}, Messages.InvalidLHSInForIn);
                    }

                    lex();
                    left = init;
                    right = parseExpression();
                    init = null;
                }
            }

            if (typeof left === 'undefined') {
                expect(';');
            }
        }

        if (typeof left === 'undefined') {

            if (!match(';')) {
                test = parseExpression();
            }
            expect(';');

            if (!match(')')) {
                update = parseExpression();
            }
        }

        expect(')');

        oldInIteration = state.inIteration;
        state.inIteration = true;

        body = parseStatement();

        state.inIteration = oldInIteration;

        if (typeof left === 'undefined') {
            return {
                type: Syntax.ForStatement,
                init: init,
                test: test,
                update: update,
                body: body
            };
        }

        return {
            type: Syntax.ForInStatement,
            left: left,
            right: right,
            body: body,
            each: false
        };
    }

    // 12.7 The continue statement

    function parseContinueStatement() {
        var token, label = null;

        expectKeyword('continue');

        // Optimize the most common form: 'continue;'.
        if (source[index] === ';') {
            lex();

            if (!state.inIteration) {
                throwError({}, Messages.IllegalContinue);
            }

            return {
                type: Syntax.ContinueStatement,
                label: null
            };
        }

        if (peekLineTerminator()) {
            if (!state.inIteration) {
                throwError({}, Messages.IllegalContinue);
            }

            return {
                type: Syntax.ContinueStatement,
                label: null
            };
        }

        token = lookahead();
        if (token.type === Token.Identifier) {
            label = parseVariableIdentifier();

            if (!Object.prototype.hasOwnProperty.call(state.labelSet, label.name)) {
                throwError({}, Messages.UnknownLabel, label.name);
            }
        }

        consumeSemicolon();

        if (label === null && !state.inIteration) {
            throwError({}, Messages.IllegalContinue);
        }

        return {
            type: Syntax.ContinueStatement,
            label: label
        };
    }

    // 12.8 The break statement

    function parseBreakStatement() {
        var token, label = null;

        expectKeyword('break');

        // Optimize the most common form: 'break;'.
        if (source[index] === ';') {
            lex();

            if (!(state.inIteration || state.inSwitch)) {
                throwError({}, Messages.IllegalBreak);
            }

            return {
                type: Syntax.BreakStatement,
                label: null
            };
        }

        if (peekLineTerminator()) {
            if (!(state.inIteration || state.inSwitch)) {
                throwError({}, Messages.IllegalBreak);
            }

            return {
                type: Syntax.BreakStatement,
                label: null
            };
        }

        token = lookahead();
        if (token.type === Token.Identifier) {
            label = parseVariableIdentifier();

            if (!Object.prototype.hasOwnProperty.call(state.labelSet, label.name)) {
                throwError({}, Messages.UnknownLabel, label.name);
            }
        }

        consumeSemicolon();

        if (label === null && !(state.inIteration || state.inSwitch)) {
            throwError({}, Messages.IllegalBreak);
        }

        return {
            type: Syntax.BreakStatement,
            label: label
        };
    }

    // 12.9 The return statement

    function parseReturnStatement() {
        var token, argument = null;

        expectKeyword('return');

        if (!state.inFunctionBody) {
            throwErrorTolerant({}, Messages.IllegalReturn);
        }

        // 'return' followed by a space and an identifier is very common.
        if (source[index] === ' ') {
            if (isIdentifierStart(source[index + 1])) {
                argument = parseExpression();
                consumeSemicolon();
                return {
                    type: Syntax.ReturnStatement,
                    argument: argument
                };
            }
        }

        if (peekLineTerminator()) {
            return {
                type: Syntax.ReturnStatement,
                argument: null
            };
        }

        if (!match(';')) {
            token = lookahead();
            if (!match('}') && token.type !== Token.EOF) {
                argument = parseExpression();
            }
        }

        consumeSemicolon();

        return {
            type: Syntax.ReturnStatement,
            argument: argument
        };
    }

    // 12.10 The with statement

    function parseWithStatement() {
        var object, body;

        if (strict) {
            throwErrorTolerant({}, Messages.StrictModeWith);
        }

        expectKeyword('with');

        expect('(');

        object = parseExpression();

        expect(')');

        body = parseStatement();

        return {
            type: Syntax.WithStatement,
            object: object,
            body: body
        };
    }

    // 12.10 The swith statement

    function parseSwitchCase() {
        var test,
            consequent = [],
            statement;

        if (matchKeyword('default')) {
            lex();
            test = null;
        } else {
            expectKeyword('case');
            test = parseExpression();
        }
        expect(':');

        while (index < length) {
            if (match('}') || matchKeyword('default') || matchKeyword('case')) {
                break;
            }
            statement = parseStatement();
            if (typeof statement === 'undefined') {
                break;
            }
            consequent.push(statement);
        }

        return {
            type: Syntax.SwitchCase,
            test: test,
            consequent: consequent
        };
    }

    function parseSwitchStatement() {
        var discriminant, cases, clause, oldInSwitch, defaultFound;

        expectKeyword('switch');

        expect('(');

        discriminant = parseExpression();

        expect(')');

        expect('{');

        cases = [];

        if (match('}')) {
            lex();
            return {
                type: Syntax.SwitchStatement,
                discriminant: discriminant,
                cases: cases
            };
        }

        oldInSwitch = state.inSwitch;
        state.inSwitch = true;
        defaultFound = false;

        while (index < length) {
            if (match('}')) {
                break;
            }
            clause = parseSwitchCase();
            if (clause.test === null) {
                if (defaultFound) {
                    throwError({}, Messages.MultipleDefaultsInSwitch);
                }
                defaultFound = true;
            }
            cases.push(clause);
        }

        state.inSwitch = oldInSwitch;

        expect('}');

        return {
            type: Syntax.SwitchStatement,
            discriminant: discriminant,
            cases: cases
        };
    }

    // 12.13 The throw statement

    function parseThrowStatement() {
        var argument;

        expectKeyword('throw');

        if (peekLineTerminator()) {
            throwError({}, Messages.NewlineAfterThrow);
        }

        argument = parseExpression();

        consumeSemicolon();

        return {
            type: Syntax.ThrowStatement,
            argument: argument
        };
    }

    // 12.14 The try statement

    function parseCatchClause() {
        var param;

        expectKeyword('catch');

        expect('(');
        if (match(')')) {
            throwUnexpected(lookahead());
        }

        param = parseVariableIdentifier();
        // 12.14.1
        if (strict && isRestrictedWord(param.name)) {
            throwErrorTolerant({}, Messages.StrictCatchVariable);
        }

        expect(')');

        return {
            type: Syntax.CatchClause,
            param: param,
            body: parseBlock()
        };
    }

    function parseTryStatement() {
        var block, handlers = [], finalizer = null;

        expectKeyword('try');

        block = parseBlock();

        if (matchKeyword('catch')) {
            handlers.push(parseCatchClause());
        }

        if (matchKeyword('finally')) {
            lex();
            finalizer = parseBlock();
        }

        if (handlers.length === 0 && !finalizer) {
            throwError({}, Messages.NoCatchOrFinally);
        }

        return {
            type: Syntax.TryStatement,
            block: block,
            guardedHandlers: [],
            handlers: handlers,
            finalizer: finalizer
        };
    }

    // 12.15 The debugger statement

    function parseDebuggerStatement() {
        expectKeyword('debugger');

        consumeSemicolon();

        return {
            type: Syntax.DebuggerStatement
        };
    }

    // 12 Statements

    function parseStatement() {
        var token = lookahead(),
            expr,
            labeledBody;

        if (token.type === Token.EOF) {
            throwUnexpected(token);
        }

        if (token.type === Token.Punctuator) {
            switch (token.value) {
            case ';':
                return parseEmptyStatement();
            case '{':
                return parseBlock();
            case '(':
                return parseExpressionStatement();
            default:
                break;
            }
        }

        if (token.type === Token.Keyword) {
            switch (token.value) {
            case 'break':
                return parseBreakStatement();
            case 'continue':
                return parseContinueStatement();
            case 'debugger':
                return parseDebuggerStatement();
            case 'do':
                return parseDoWhileStatement();
            case 'for':
                return parseForStatement();
            case 'function':
                return parseFunctionDeclaration();
            case 'if':
                return parseIfStatement();
            case 'return':
                return parseReturnStatement();
            case 'switch':
                return parseSwitchStatement();
            case 'throw':
                return parseThrowStatement();
            case 'try':
                return parseTryStatement();
            case 'var':
                return parseVariableStatement();
            case 'while':
                return parseWhileStatement();
            case 'with':
                return parseWithStatement();
            default:
                break;
            }
        }

        expr = parseExpression();

        // 12.12 Labelled Statements
        if ((expr.type === Syntax.Identifier) && match(':')) {
            lex();

            if (Object.prototype.hasOwnProperty.call(state.labelSet, expr.name)) {
                throwError({}, Messages.Redeclaration, 'Label', expr.name);
            }

            state.labelSet[expr.name] = true;
            labeledBody = parseStatement();
            delete state.labelSet[expr.name];

            return {
                type: Syntax.LabeledStatement,
                label: expr,
                body: labeledBody
            };
        }

        consumeSemicolon();

        return {
            type: Syntax.ExpressionStatement,
            expression: expr
        };
    }

    // 13 Function Definition

    function parseFunctionSourceElements() {
        var sourceElement, sourceElements = [], token, directive, firstRestricted,
            oldLabelSet, oldInIteration, oldInSwitch, oldInFunctionBody;

        expect('{');

        while (index < length) {
            token = lookahead();
            if (token.type !== Token.StringLiteral) {
                break;
            }

            sourceElement = parseSourceElement();
            sourceElements.push(sourceElement);
            if (sourceElement.expression.type !== Syntax.Literal) {
                // this is not directive
                break;
            }
            directive = sliceSource(token.range[0] + 1, token.range[1] - 1);
            if (directive === 'use strict') {
                strict = true;
                if (firstRestricted) {
                    throwErrorTolerant(firstRestricted, Messages.StrictOctalLiteral);
                }
            } else {
                if (!firstRestricted && token.octal) {
                    firstRestricted = token;
                }
            }
        }

        oldLabelSet = state.labelSet;
        oldInIteration = state.inIteration;
        oldInSwitch = state.inSwitch;
        oldInFunctionBody = state.inFunctionBody;

        state.labelSet = {};
        state.inIteration = false;
        state.inSwitch = false;
        state.inFunctionBody = true;

        while (index < length) {
            if (match('}')) {
                break;
            }
            sourceElement = parseSourceElement();
            if (typeof sourceElement === 'undefined') {
                break;
            }
            sourceElements.push(sourceElement);
        }

        expect('}');

        state.labelSet = oldLabelSet;
        state.inIteration = oldInIteration;
        state.inSwitch = oldInSwitch;
        state.inFunctionBody = oldInFunctionBody;

        return {
            type: Syntax.BlockStatement,
            body: sourceElements
        };
    }

    function parseFunctionDeclaration() {
        var id, param, params = [], body, token, stricted, firstRestricted, message, previousStrict, paramSet;

        expectKeyword('function');
        token = lookahead();
        id = parseVariableIdentifier();
        if (strict) {
            if (isRestrictedWord(token.value)) {
                throwErrorTolerant(token, Messages.StrictFunctionName);
            }
        } else {
            if (isRestrictedWord(token.value)) {
                firstRestricted = token;
                message = Messages.StrictFunctionName;
            } else if (isStrictModeReservedWord(token.value)) {
                firstRestricted = token;
                message = Messages.StrictReservedWord;
            }
        }

        expect('(');

        if (!match(')')) {
            paramSet = {};
            while (index < length) {
                token = lookahead();
                param = parseVariableIdentifier();
                if (strict) {
                    if (isRestrictedWord(token.value)) {
                        stricted = token;
                        message = Messages.StrictParamName;
                    }
                    if (Object.prototype.hasOwnProperty.call(paramSet, token.value)) {
                        stricted = token;
                        message = Messages.StrictParamDupe;
                    }
                } else if (!firstRestricted) {
                    if (isRestrictedWord(token.value)) {
                        firstRestricted = token;
                        message = Messages.StrictParamName;
                    } else if (isStrictModeReservedWord(token.value)) {
                        firstRestricted = token;
                        message = Messages.StrictReservedWord;
                    } else if (Object.prototype.hasOwnProperty.call(paramSet, token.value)) {
                        firstRestricted = token;
                        message = Messages.StrictParamDupe;
                    }
                }
                params.push(param);
                paramSet[param.name] = true;
                if (match(')')) {
                    break;
                }
                expect(',');
            }
        }

        expect(')');

        previousStrict = strict;
        body = parseFunctionSourceElements();
        if (strict && firstRestricted) {
            throwError(firstRestricted, message);
        }
        if (strict && stricted) {
            throwErrorTolerant(stricted, message);
        }
        strict = previousStrict;

        return {
            type: Syntax.FunctionDeclaration,
            id: id,
            params: params,
            defaults: [],
            body: body,
            rest: null,
            generator: false,
            expression: false
        };
    }

    function parseFunctionExpression() {
        var token, id = null, stricted, firstRestricted, message, param, params = [], body, previousStrict, paramSet;

        expectKeyword('function');

        if (!match('(')) {
            token = lookahead();
            id = parseVariableIdentifier();
            if (strict) {
                if (isRestrictedWord(token.value)) {
                    throwErrorTolerant(token, Messages.StrictFunctionName);
                }
            } else {
                if (isRestrictedWord(token.value)) {
                    firstRestricted = token;
                    message = Messages.StrictFunctionName;
                } else if (isStrictModeReservedWord(token.value)) {
                    firstRestricted = token;
                    message = Messages.StrictReservedWord;
                }
            }
        }

        expect('(');

        if (!match(')')) {
            paramSet = {};
            while (index < length) {
                token = lookahead();
                param = parseVariableIdentifier();
                if (strict) {
                    if (isRestrictedWord(token.value)) {
                        stricted = token;
                        message = Messages.StrictParamName;
                    }
                    if (Object.prototype.hasOwnProperty.call(paramSet, token.value)) {
                        stricted = token;
                        message = Messages.StrictParamDupe;
                    }
                } else if (!firstRestricted) {
                    if (isRestrictedWord(token.value)) {
                        firstRestricted = token;
                        message = Messages.StrictParamName;
                    } else if (isStrictModeReservedWord(token.value)) {
                        firstRestricted = token;
                        message = Messages.StrictReservedWord;
                    } else if (Object.prototype.hasOwnProperty.call(paramSet, token.value)) {
                        firstRestricted = token;
                        message = Messages.StrictParamDupe;
                    }
                }
                params.push(param);
                paramSet[param.name] = true;
                if (match(')')) {
                    break;
                }
                expect(',');
            }
        }

        expect(')');

        previousStrict = strict;
        body = parseFunctionSourceElements();
        if (strict && firstRestricted) {
            throwError(firstRestricted, message);
        }
        if (strict && stricted) {
            throwErrorTolerant(stricted, message);
        }
        strict = previousStrict;

        return {
            type: Syntax.FunctionExpression,
            id: id,
            params: params,
            defaults: [],
            body: body,
            rest: null,
            generator: false,
            expression: false
        };
    }

    // 14 Program

    function parseSourceElement() {
        var token = lookahead();

        if (token.type === Token.Keyword) {
            switch (token.value) {
            case 'const':
            case 'let':
                return parseConstLetDeclaration(token.value);
            case 'function':
                return parseFunctionDeclaration();
            default:
                return parseStatement();
            }
        }

        if (token.type !== Token.EOF) {
            return parseStatement();
        }
    }

    function parseSourceElements() {
        var sourceElement, sourceElements = [], token, directive, firstRestricted;

        while (index < length) {
            token = lookahead();
            if (token.type !== Token.StringLiteral) {
                break;
            }

            sourceElement = parseSourceElement();
            sourceElements.push(sourceElement);
            if (sourceElement.expression.type !== Syntax.Literal) {
                // this is not directive
                break;
            }
            directive = sliceSource(token.range[0] + 1, token.range[1] - 1);
            if (directive === 'use strict') {
                strict = true;
                if (firstRestricted) {
                    throwErrorTolerant(firstRestricted, Messages.StrictOctalLiteral);
                }
            } else {
                if (!firstRestricted && token.octal) {
                    firstRestricted = token;
                }
            }
        }

        while (index < length) {
            sourceElement = parseSourceElement();
            if (typeof sourceElement === 'undefined') {
                break;
            }
            sourceElements.push(sourceElement);
        }
        return sourceElements;
    }

    function parseProgram() {
        var program;
        strict = false;
        program = {
            type: Syntax.Program,
            body: parseSourceElements()
        };
        return program;
    }

    // The following functions are needed only when the option to preserve
    // the comments is active.

    function addComment(type, value, start, end, loc) {
        assert(typeof start === 'number', 'Comment must have valid position');

        // Because the way the actual token is scanned, often the comments
        // (if any) are skipped twice during the lexical analysis.
        // Thus, we need to skip adding a comment if the comment array already
        // handled it.
        if (extra.comments.length > 0) {
            if (extra.comments[extra.comments.length - 1].range[1] > start) {
                return;
            }
        }

        extra.comments.push({
            type: type,
            value: value,
            range: [start, end],
            loc: loc
        });
    }

    function scanComment() {
        var comment, ch, loc, start, blockComment, lineComment;

        comment = '';
        blockComment = false;
        lineComment = false;

        while (index < length) {
            ch = source[index];

            if (lineComment) {
                ch = source[index++];
                if (isLineTerminator(ch)) {
                    loc.end = {
                        line: lineNumber,
                        column: index - lineStart - 1
                    };
                    lineComment = false;
                    addComment('Line', comment, start, index - 1, loc);
                    if (ch === '\r' && source[index] === '\n') {
                        ++index;
                    }
                    ++lineNumber;
                    lineStart = index;
                    comment = '';
                } else if (index >= length) {
                    lineComment = false;
                    comment += ch;
                    loc.end = {
                        line: lineNumber,
                        column: length - lineStart
                    };
                    addComment('Line', comment, start, length, loc);
                } else {
                    comment += ch;
                }
            } else if (blockComment) {
                if (isLineTerminator(ch)) {
                    if (ch === '\r' && source[index + 1] === '\n') {
                        ++index;
                        comment += '\r\n';
                    } else {
                        comment += ch;
                    }
                    ++lineNumber;
                    ++index;
                    lineStart = index;
                    if (index >= length) {
                        throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
                    }
                } else {
                    ch = source[index++];
                    if (index >= length) {
                        throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
                    }
                    comment += ch;
                    if (ch === '*') {
                        ch = source[index];
                        if (ch === '/') {
                            comment = comment.substr(0, comment.length - 1);
                            blockComment = false;
                            ++index;
                            loc.end = {
                                line: lineNumber,
                                column: index - lineStart
                            };
                            addComment('Block', comment, start, index, loc);
                            comment = '';
                        }
                    }
                }
            } else if (ch === '/') {
                ch = source[index + 1];
                if (ch === '/') {
                    loc = {
                        start: {
                            line: lineNumber,
                            column: index - lineStart
                        }
                    };
                    start = index;
                    index += 2;
                    lineComment = true;
                    if (index >= length) {
                        loc.end = {
                            line: lineNumber,
                            column: index - lineStart
                        };
                        lineComment = false;
                        addComment('Line', comment, start, index, loc);
                    }
                } else if (ch === '*') {
                    start = index;
                    index += 2;
                    blockComment = true;
                    loc = {
                        start: {
                            line: lineNumber,
                            column: index - lineStart - 2
                        }
                    };
                    if (index >= length) {
                        throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
                    }
                } else {
                    break;
                }
            } else if (isWhiteSpace(ch)) {
                ++index;
            } else if (isLineTerminator(ch)) {
                ++index;
                if (ch ===  '\r' && source[index] === '\n') {
                    ++index;
                }
                ++lineNumber;
                lineStart = index;
            } else {
                break;
            }
        }
    }

    function filterCommentLocation() {
        var i, entry, comment, comments = [];

        for (i = 0; i < extra.comments.length; ++i) {
            entry = extra.comments[i];
            comment = {
                type: entry.type,
                value: entry.value
            };
            if (extra.range) {
                comment.range = entry.range;
            }
            if (extra.loc) {
                comment.loc = entry.loc;
            }
            comments.push(comment);
        }

        extra.comments = comments;
    }

    function collectToken() {
        var start, loc, token, range, value;

        skipComment();
        start = index;
        loc = {
            start: {
                line: lineNumber,
                column: index - lineStart
            }
        };

        token = extra.advance();
        loc.end = {
            line: lineNumber,
            column: index - lineStart
        };

        if (token.type !== Token.EOF) {
            range = [token.range[0], token.range[1]];
            value = sliceSource(token.range[0], token.range[1]);
            extra.tokens.push({
                type: TokenName[token.type],
                value: value,
                range: range,
                loc: loc
            });
        }

        return token;
    }

    function collectRegex() {
        var pos, loc, regex, token;

        skipComment();

        pos = index;
        loc = {
            start: {
                line: lineNumber,
                column: index - lineStart
            }
        };

        regex = extra.scanRegExp();
        loc.end = {
            line: lineNumber,
            column: index - lineStart
        };

        // Pop the previous token, which is likely '/' or '/='
        if (extra.tokens.length > 0) {
            token = extra.tokens[extra.tokens.length - 1];
            if (token.range[0] === pos && token.type === 'Punctuator') {
                if (token.value === '/' || token.value === '/=') {
                    extra.tokens.pop();
                }
            }
        }

        extra.tokens.push({
            type: 'RegularExpression',
            value: regex.literal,
            range: [pos, index],
            loc: loc
        });

        return regex;
    }

    function filterTokenLocation() {
        var i, entry, token, tokens = [];

        for (i = 0; i < extra.tokens.length; ++i) {
            entry = extra.tokens[i];
            token = {
                type: entry.type,
                value: entry.value
            };
            if (extra.range) {
                token.range = entry.range;
            }
            if (extra.loc) {
                token.loc = entry.loc;
            }
            tokens.push(token);
        }

        extra.tokens = tokens;
    }

    function createLiteral(token) {
        return {
            type: Syntax.Literal,
            value: token.value
        };
    }

    function createRawLiteral(token) {
        return {
            type: Syntax.Literal,
            value: token.value,
            raw: sliceSource(token.range[0], token.range[1])
        };
    }

    function createLocationMarker() {
        var marker = {};

        marker.range = [index, index];
        marker.loc = {
            start: {
                line: lineNumber,
                column: index - lineStart
            },
            end: {
                line: lineNumber,
                column: index - lineStart
            }
        };

        marker.end = function () {
            this.range[1] = index;
            this.loc.end.line = lineNumber;
            this.loc.end.column = index - lineStart;
        };

        marker.applyGroup = function (node) {
            if (extra.range) {
                node.groupRange = [this.range[0], this.range[1]];
            }
            if (extra.loc) {
                node.groupLoc = {
                    start: {
                        line: this.loc.start.line,
                        column: this.loc.start.column
                    },
                    end: {
                        line: this.loc.end.line,
                        column: this.loc.end.column
                    }
                };
            }
        };

        marker.apply = function (node) {
            if (extra.range) {
                node.range = [this.range[0], this.range[1]];
            }
            if (extra.loc) {
                node.loc = {
                    start: {
                        line: this.loc.start.line,
                        column: this.loc.start.column
                    },
                    end: {
                        line: this.loc.end.line,
                        column: this.loc.end.column
                    }
                };
            }
        };

        return marker;
    }

    function trackGroupExpression() {
        var marker, expr;

        skipComment();
        marker = createLocationMarker();
        expect('(');

        expr = parseExpression();

        expect(')');

        marker.end();
        marker.applyGroup(expr);

        return expr;
    }

    function trackLeftHandSideExpression() {
        var marker, expr;

        skipComment();
        marker = createLocationMarker();

        expr = matchKeyword('new') ? parseNewExpression() : parsePrimaryExpression();

        while (match('.') || match('[')) {
            if (match('[')) {
                expr = {
                    type: Syntax.MemberExpression,
                    computed: true,
                    object: expr,
                    property: parseComputedMember()
                };
                marker.end();
                marker.apply(expr);
            } else {
                expr = {
                    type: Syntax.MemberExpression,
                    computed: false,
                    object: expr,
                    property: parseNonComputedMember()
                };
                marker.end();
                marker.apply(expr);
            }
        }

        return expr;
    }

    function trackLeftHandSideExpressionAllowCall() {
        var marker, expr;

        skipComment();
        marker = createLocationMarker();

        expr = matchKeyword('new') ? parseNewExpression() : parsePrimaryExpression();

        while (match('.') || match('[') || match('(')) {
            if (match('(')) {
                expr = {
                    type: Syntax.CallExpression,
                    callee: expr,
                    'arguments': parseArguments()
                };
                marker.end();
                marker.apply(expr);
            } else if (match('[')) {
                expr = {
                    type: Syntax.MemberExpression,
                    computed: true,
                    object: expr,
                    property: parseComputedMember()
                };
                marker.end();
                marker.apply(expr);
            } else {
                expr = {
                    type: Syntax.MemberExpression,
                    computed: false,
                    object: expr,
                    property: parseNonComputedMember()
                };
                marker.end();
                marker.apply(expr);
            }
        }

        return expr;
    }

    function filterGroup(node) {
        var n, i, entry;

        n = (Object.prototype.toString.apply(node) === '[object Array]') ? [] : {};
        for (i in node) {
            if (node.hasOwnProperty(i) && i !== 'groupRange' && i !== 'groupLoc') {
                entry = node[i];
                if (entry === null || typeof entry !== 'object' || entry instanceof RegExp) {
                    n[i] = entry;
                } else {
                    n[i] = filterGroup(entry);
                }
            }
        }
        return n;
    }

    function wrapTrackingFunction(range, loc) {

        return function (parseFunction) {

            function isBinary(node) {
                return node.type === Syntax.LogicalExpression ||
                    node.type === Syntax.BinaryExpression;
            }

            function visit(node) {
                var start, end;

                if (isBinary(node.left)) {
                    visit(node.left);
                }
                if (isBinary(node.right)) {
                    visit(node.right);
                }

                if (range) {
                    if (node.left.groupRange || node.right.groupRange) {
                        start = node.left.groupRange ? node.left.groupRange[0] : node.left.range[0];
                        end = node.right.groupRange ? node.right.groupRange[1] : node.right.range[1];
                        node.range = [start, end];
                    } else if (typeof node.range === 'undefined') {
                        start = node.left.range[0];
                        end = node.right.range[1];
                        node.range = [start, end];
                    }
                }
                if (loc) {
                    if (node.left.groupLoc || node.right.groupLoc) {
                        start = node.left.groupLoc ? node.left.groupLoc.start : node.left.loc.start;
                        end = node.right.groupLoc ? node.right.groupLoc.end : node.right.loc.end;
                        node.loc = {
                            start: start,
                            end: end
                        };
                    } else if (typeof node.loc === 'undefined') {
                        node.loc = {
                            start: node.left.loc.start,
                            end: node.right.loc.end
                        };
                    }
                }
            }

            return function () {
                var marker, node;

                skipComment();

                marker = createLocationMarker();
                node = parseFunction.apply(null, arguments);
                marker.end();

                if (range && typeof node.range === 'undefined') {
                    marker.apply(node);
                }

                if (loc && typeof node.loc === 'undefined') {
                    marker.apply(node);
                }

                if (isBinary(node)) {
                    visit(node);
                }

                return node;
            };
        };
    }

    function patch() {

        var wrapTracking;

        if (extra.comments) {
            extra.skipComment = skipComment;
            skipComment = scanComment;
        }

        if (extra.raw) {
            extra.createLiteral = createLiteral;
            createLiteral = createRawLiteral;
        }

        if (extra.range || extra.loc) {

            extra.parseGroupExpression = parseGroupExpression;
            extra.parseLeftHandSideExpression = parseLeftHandSideExpression;
            extra.parseLeftHandSideExpressionAllowCall = parseLeftHandSideExpressionAllowCall;
            parseGroupExpression = trackGroupExpression;
            parseLeftHandSideExpression = trackLeftHandSideExpression;
            parseLeftHandSideExpressionAllowCall = trackLeftHandSideExpressionAllowCall;

            wrapTracking = wrapTrackingFunction(extra.range, extra.loc);

            extra.parseAdditiveExpression = parseAdditiveExpression;
            extra.parseAssignmentExpression = parseAssignmentExpression;
            extra.parseBitwiseANDExpression = parseBitwiseANDExpression;
            extra.parseBitwiseORExpression = parseBitwiseORExpression;
            extra.parseBitwiseXORExpression = parseBitwiseXORExpression;
            extra.parseBlock = parseBlock;
            extra.parseFunctionSourceElements = parseFunctionSourceElements;
            extra.parseCatchClause = parseCatchClause;
            extra.parseComputedMember = parseComputedMember;
            extra.parseConditionalExpression = parseConditionalExpression;
            extra.parseConstLetDeclaration = parseConstLetDeclaration;
            extra.parseEqualityExpression = parseEqualityExpression;
            extra.parseExpression = parseExpression;
            extra.parseForVariableDeclaration = parseForVariableDeclaration;
            extra.parseFunctionDeclaration = parseFunctionDeclaration;
            extra.parseFunctionExpression = parseFunctionExpression;
            extra.parseLogicalANDExpression = parseLogicalANDExpression;
            extra.parseLogicalORExpression = parseLogicalORExpression;
            extra.parseMultiplicativeExpression = parseMultiplicativeExpression;
            extra.parseNewExpression = parseNewExpression;
            extra.parseNonComputedProperty = parseNonComputedProperty;
            extra.parseObjectProperty = parseObjectProperty;
            extra.parseObjectPropertyKey = parseObjectPropertyKey;
            extra.parsePostfixExpression = parsePostfixExpression;
            extra.parsePrimaryExpression = parsePrimaryExpression;
            extra.parseProgram = parseProgram;
            extra.parsePropertyFunction = parsePropertyFunction;
            extra.parseRelationalExpression = parseRelationalExpression;
            extra.parseStatement = parseStatement;
            extra.parseShiftExpression = parseShiftExpression;
            extra.parseSwitchCase = parseSwitchCase;
            extra.parseUnaryExpression = parseUnaryExpression;
            extra.parseVariableDeclaration = parseVariableDeclaration;
            extra.parseVariableIdentifier = parseVariableIdentifier;

            parseAdditiveExpression = wrapTracking(extra.parseAdditiveExpression);
            parseAssignmentExpression = wrapTracking(extra.parseAssignmentExpression);
            parseBitwiseANDExpression = wrapTracking(extra.parseBitwiseANDExpression);
            parseBitwiseORExpression = wrapTracking(extra.parseBitwiseORExpression);
            parseBitwiseXORExpression = wrapTracking(extra.parseBitwiseXORExpression);
            parseBlock = wrapTracking(extra.parseBlock);
            parseFunctionSourceElements = wrapTracking(extra.parseFunctionSourceElements);
            parseCatchClause = wrapTracking(extra.parseCatchClause);
            parseComputedMember = wrapTracking(extra.parseComputedMember);
            parseConditionalExpression = wrapTracking(extra.parseConditionalExpression);
            parseConstLetDeclaration = wrapTracking(extra.parseConstLetDeclaration);
            parseEqualityExpression = wrapTracking(extra.parseEqualityExpression);
            parseExpression = wrapTracking(extra.parseExpression);
            parseForVariableDeclaration = wrapTracking(extra.parseForVariableDeclaration);
            parseFunctionDeclaration = wrapTracking(extra.parseFunctionDeclaration);
            parseFunctionExpression = wrapTracking(extra.parseFunctionExpression);
            parseLeftHandSideExpression = wrapTracking(parseLeftHandSideExpression);
            parseLogicalANDExpression = wrapTracking(extra.parseLogicalANDExpression);
            parseLogicalORExpression = wrapTracking(extra.parseLogicalORExpression);
            parseMultiplicativeExpression = wrapTracking(extra.parseMultiplicativeExpression);
            parseNewExpression = wrapTracking(extra.parseNewExpression);
            parseNonComputedProperty = wrapTracking(extra.parseNonComputedProperty);
            parseObjectProperty = wrapTracking(extra.parseObjectProperty);
            parseObjectPropertyKey = wrapTracking(extra.parseObjectPropertyKey);
            parsePostfixExpression = wrapTracking(extra.parsePostfixExpression);
            parsePrimaryExpression = wrapTracking(extra.parsePrimaryExpression);
            parseProgram = wrapTracking(extra.parseProgram);
            parsePropertyFunction = wrapTracking(extra.parsePropertyFunction);
            parseRelationalExpression = wrapTracking(extra.parseRelationalExpression);
            parseStatement = wrapTracking(extra.parseStatement);
            parseShiftExpression = wrapTracking(extra.parseShiftExpression);
            parseSwitchCase = wrapTracking(extra.parseSwitchCase);
            parseUnaryExpression = wrapTracking(extra.parseUnaryExpression);
            parseVariableDeclaration = wrapTracking(extra.parseVariableDeclaration);
            parseVariableIdentifier = wrapTracking(extra.parseVariableIdentifier);
        }

        if (typeof extra.tokens !== 'undefined') {
            extra.advance = advance;
            extra.scanRegExp = scanRegExp;

            advance = collectToken;
            scanRegExp = collectRegex;
        }
    }

    function unpatch() {
        if (typeof extra.skipComment === 'function') {
            skipComment = extra.skipComment;
        }

        if (extra.raw) {
            createLiteral = extra.createLiteral;
        }

        if (extra.range || extra.loc) {
            parseAdditiveExpression = extra.parseAdditiveExpression;
            parseAssignmentExpression = extra.parseAssignmentExpression;
            parseBitwiseANDExpression = extra.parseBitwiseANDExpression;
            parseBitwiseORExpression = extra.parseBitwiseORExpression;
            parseBitwiseXORExpression = extra.parseBitwiseXORExpression;
            parseBlock = extra.parseBlock;
            parseFunctionSourceElements = extra.parseFunctionSourceElements;
            parseCatchClause = extra.parseCatchClause;
            parseComputedMember = extra.parseComputedMember;
            parseConditionalExpression = extra.parseConditionalExpression;
            parseConstLetDeclaration = extra.parseConstLetDeclaration;
            parseEqualityExpression = extra.parseEqualityExpression;
            parseExpression = extra.parseExpression;
            parseForVariableDeclaration = extra.parseForVariableDeclaration;
            parseFunctionDeclaration = extra.parseFunctionDeclaration;
            parseFunctionExpression = extra.parseFunctionExpression;
            parseGroupExpression = extra.parseGroupExpression;
            parseLeftHandSideExpression = extra.parseLeftHandSideExpression;
            parseLeftHandSideExpressionAllowCall = extra.parseLeftHandSideExpressionAllowCall;
            parseLogicalANDExpression = extra.parseLogicalANDExpression;
            parseLogicalORExpression = extra.parseLogicalORExpression;
            parseMultiplicativeExpression = extra.parseMultiplicativeExpression;
            parseNewExpression = extra.parseNewExpression;
            parseNonComputedProperty = extra.parseNonComputedProperty;
            parseObjectProperty = extra.parseObjectProperty;
            parseObjectPropertyKey = extra.parseObjectPropertyKey;
            parsePrimaryExpression = extra.parsePrimaryExpression;
            parsePostfixExpression = extra.parsePostfixExpression;
            parseProgram = extra.parseProgram;
            parsePropertyFunction = extra.parsePropertyFunction;
            parseRelationalExpression = extra.parseRelationalExpression;
            parseStatement = extra.parseStatement;
            parseShiftExpression = extra.parseShiftExpression;
            parseSwitchCase = extra.parseSwitchCase;
            parseUnaryExpression = extra.parseUnaryExpression;
            parseVariableDeclaration = extra.parseVariableDeclaration;
            parseVariableIdentifier = extra.parseVariableIdentifier;
        }

        if (typeof extra.scanRegExp === 'function') {
            advance = extra.advance;
            scanRegExp = extra.scanRegExp;
        }
    }

    function stringToArray(str) {
        var length = str.length,
            result = [],
            i;
        for (i = 0; i < length; ++i) {
            result[i] = str.charAt(i);
        }
        return result;
    }

    function parse(code, options) {
        var program, toString;

        toString = String;
        if (typeof code !== 'string' && !(code instanceof String)) {
            code = toString(code);
        }

        source = code;
        index = 0;
        lineNumber = (source.length > 0) ? 1 : 0;
        lineStart = 0;
        length = source.length;
        buffer = null;
        state = {
            allowIn: true,
            labelSet: {},
            inFunctionBody: false,
            inIteration: false,
            inSwitch: false
        };

        extra = {};
        if (typeof options !== 'undefined') {
            extra.range = (typeof options.range === 'boolean') && options.range;
            extra.loc = (typeof options.loc === 'boolean') && options.loc;
            extra.raw = (typeof options.raw === 'boolean') && options.raw;
            if (typeof options.tokens === 'boolean' && options.tokens) {
                extra.tokens = [];
            }
            if (typeof options.comment === 'boolean' && options.comment) {
                extra.comments = [];
            }
            if (typeof options.tolerant === 'boolean' && options.tolerant) {
                extra.errors = [];
            }
        }

        if (length > 0) {
            if (typeof source[0] === 'undefined') {
                // Try first to convert to a string. This is good as fast path
                // for old IE which understands string indexing for string
                // literals only and not for string object.
                if (code instanceof String) {
                    source = code.valueOf();
                }

                // Force accessing the characters via an array.
                if (typeof source[0] === 'undefined') {
                    source = stringToArray(code);
                }
            }
        }

        patch();
        try {
            program = parseProgram();
            if (typeof extra.comments !== 'undefined') {
                filterCommentLocation();
                program.comments = extra.comments;
            }
            if (typeof extra.tokens !== 'undefined') {
                filterTokenLocation();
                program.tokens = extra.tokens;
            }
            if (typeof extra.errors !== 'undefined') {
                program.errors = extra.errors;
            }
            if (extra.range || extra.loc) {
                program.body = filterGroup(program.body);
            }
        } catch (e) {
            throw e;
        } finally {
            unpatch();
            extra = {};
        }

        return program;
    }

    // Sync with package.json.
    exports.version = '1.0.4';

    exports.parse = parse;

    // Deep copy.
    exports.Syntax = (function () {
        var name, types = {};

        if (typeof Object.create === 'function') {
            types = Object.create(null);
        }

        for (name in Syntax) {
            if (Syntax.hasOwnProperty(name)) {
                types[name] = Syntax[name];
            }
        }

        if (typeof Object.freeze === 'function') {
            Object.freeze(types);
        }

        return types;
    }());

}));
/* vim: set sw=4 ts=4 et tw=80 : */


/***/ }),
/* 77 */
/***/ (function(module, exports) {

module.exports = hoist

function hoist(ast){

  var parentStack = []
  var variables = []
  var functions = []

  if (Array.isArray(ast)){

    walkAll(ast)
    prependScope(ast, variables, functions)
    
  } else {
    walk(ast)
  }

  return ast

  // walk through each node of a program of block statement
  function walkAll(nodes){
    var result = null
    for (var i=0;i<nodes.length;i++){
      var childNode = nodes[i]
      if (childNode.type === 'EmptyStatement') continue
      var result = walk(childNode)
      if (result === 'remove'){
        nodes.splice(i--, 1)
      }
    }
  }

  function walk(node){
    var parent = parentStack[parentStack.length-1]
    var remove = false
    parentStack.push(node)

    var excludeBody = false
    if (shouldScope(node, parent)){
      hoist(node.body)
      excludeBody = true
    }

    if (node.type === 'VariableDeclarator'){
      variables.push(node)
    }

    if (node.type === 'FunctionDeclaration'){
      functions.push(node)
      remove = true
    }

    for (var key in node){
      if (key === 'type' || (excludeBody && key === 'body')) continue
      if (key in node && node[key] && typeof node[key] == 'object'){
        if (node[key].type){
          walk(node[key])
        } else if (Array.isArray(node[key])){
          walkAll(node[key])
        }
      }
    }

    parentStack.pop()
    if (remove){
      return 'remove'
    }
  }
}

function shouldScope(node, parent){
  if (node.type === 'Program'){
    return true
  } else if (node.type === 'BlockStatement'){
    if (parent && (parent.type === 'FunctionExpression' || parent.type === 'FunctionDeclaration')){
      return true
    }
  }
}

function prependScope(nodes, variables, functions){
  if (variables && variables.length){
    var declarations = []
    for (var i=0;i<variables.length;i++){
      declarations.push({
        type: 'VariableDeclarator', 
        id: variables[i].id,
        init: null
      })
    }
    
    nodes.unshift({
      type: 'VariableDeclaration', 
      kind: 'var', 
      declarations: declarations
    })

  }

  if (functions && functions.length){
    for (var i=0;i<functions.length;i++){
      nodes.unshift(functions[i]) 
    }
  }
}

/***/ }),
/* 78 */
/***/ (function(module, exports) {

module.exports = InfiniteChecker

function InfiniteChecker(maxIterations){
  if (this instanceof InfiniteChecker){
    this.maxIterations = maxIterations
    this.count = 0
  } else {
    return new InfiniteChecker(maxIterations)
  }
}

InfiniteChecker.prototype.check = function(){
  this.count += 1
  if (this.count > this.maxIterations){
    throw new Error('Infinite loop detected - reached max iterations')
  }
}

/***/ }),
/* 79 */
/***/ (function(module, exports, __webpack_require__) {

/* WEBPACK VAR INJECTION */(function(global) {var names = ['Object', 'String', 'Boolean', 'Number', 'RegExp', 'Date', 'Array', 'Function']
var immutable = {string: 'String', boolean: 'Boolean', number: 'Number' }

var primitives = names.map(getGlobal)
var protos = primitives.map(getProto)

var protoReplacements = {}

module.exports = Primitives

function Primitives(context){
  if (this instanceof Primitives){
    this.context = context
    for (var i=0;i<names.length;i++){
      if (!this.context[names[i]]){
        this.context[names[i]] = wrap(primitives[i])
      }
    }
  } else {
    return new Primitives(context)
  }
}

Primitives.prototype.replace = function(value){
  var primIndex = primitives.indexOf(value)
  var protoIndex = protos.indexOf(value)

  if (~primIndex){
    var name = names[primIndex]
    return this.context[name]
  } else if (~protoIndex) {
    var name = names[protoIndex]
    return this.context[name].prototype
  } else  {
    return value
  }
}

Primitives.prototype.getPropertyObject = function(object, property){
  if (immutable[typeof object]){
    return this.getPrototypeOf(object)
  }
  return object
}

Primitives.prototype.isPrimitive = function(value){
  return !!~primitives.indexOf(value) || !!~protos.indexOf(value)
}

Primitives.prototype.getPrototypeOf = function(value){
  if (value == null){ // handle null and undefined
    return value
  }

  var immutableType = immutable[typeof value]
  if (immutableType){
    var proto = this.context[immutableType].prototype
  } else {
    var proto = Object.getPrototypeOf(value)
  }

  if (!proto || proto === Object.prototype){
    return null
  } else {
    var replacement = this.replace(proto)
    if (replacement === value){
      replacement = this.replace(Object.prototype)
    }
    return replacement
  }
}

Primitives.prototype.applyNew = function(func, args){
  if (func.wrapped){
    var prim = Object.getPrototypeOf(func)
    var instance = new (Function.prototype.bind.apply(prim, arguments))
    setProto(instance, func.prototype)
    return instance
  } else {
    return new (Function.prototype.bind.apply(func, arguments))
  }
}

function getProto(func){
  return func.prototype
}

function getGlobal(str){
  return global[str]
}

function setProto(obj, proto){
  obj.__proto__ = proto
}

function wrap(prim){
  var proto = Object.create(prim.prototype)

  var result = function() {
    if (this instanceof result){
      prim.apply(this, arguments)
    } else {
      var instance = prim.apply(null, arguments)
      setProto(instance, proto)
      return instance
    }
  }
  setProto(result, prim)
  result.prototype = proto
  result.wrapped = true
  return result
}
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(12)))

/***/ }),
/* 80 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var __awaiter = (this && this.__awaiter) || function (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());
    });
};
var __generator = (this && this.__generator) || function (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 };
    }
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.AdvancedModule = void 0;
var RuqESModule_1 = __webpack_require__(6);
var common_1 = __webpack_require__(0);
var domUtils_1 = __webpack_require__(10);
var styles_1 = __webpack_require__(3);
var AdvancedModule = /** @class */ (function (_super) {
    __extends(AdvancedModule, _super);
    function AdvancedModule() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    AdvancedModule.prototype.setup = function (args, cfg) {
        return __awaiter(this, void 0, void 0, function () {
            return __generator(this, function (_a) {
                common_1.debugLog('AdvancedModule', cfg);
                if (cfg.advanced.enabled) {
                    domUtils_1.addCustomScript(cfg.advanced.js, styles_1.advancedModuleJavaScriptId);
                    domUtils_1.addStyle(cfg.advanced.css, styles_1.advancedModuleCssId);
                }
                return [2 /*return*/];
            });
        });
    };
    return AdvancedModule;
}(RuqESModule_1.RuqESModule));
exports.AdvancedModule = AdvancedModule;


/***/ }),
/* 81 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var __awaiter = (this && this.__awaiter) || function (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());
    });
};
var __generator = (this && this.__generator) || function (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 };
    }
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.setupGlobalApi = void 0;
var common_1 = __webpack_require__(0);
var selectors_1 = __webpack_require__(5);
exports.setupGlobalApi = function () { return __awaiter(void 0, void 0, void 0, function () {
    var api;
    return __generator(this, function (_a) {
        api = {
            getPosts: function () { return selectors_1.getPosts().toArray().map(function (rawEl) { return common_1.extractPostInfo($(rawEl)); }); },
        };
        common_1.getRuqqusWindow().RuqES = api;
        return [2 /*return*/];
    });
}); };


/***/ })
/******/ ]);