diff --git a/js/main.js b/js/main.js index 3d58772c..e66af7d2 100644 --- a/js/main.js +++ b/js/main.js @@ -155,7 +155,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _0gl /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _0globals__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../0globals */ \"./src/0globals.js\");\n/* harmony import */ var _core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./core */ \"./src/modules/core.js\");\n/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./utils */ \"./src/modules/utils.js\");\n/* harmony import */ var _v2__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./v2 */ \"./src/modules/v2.js\");\n/* harmony import */ var _dataStore__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./dataStore */ \"./src/modules/dataStore.js\");\n/* harmony import */ var _pluginModule__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./pluginModule */ \"./src/modules/pluginModule.js\");\n/* harmony import */ var _themeModule__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./themeModule */ \"./src/modules/themeModule.js\");\n/* harmony import */ var _settingsPanel__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./settingsPanel */ \"./src/modules/settingsPanel.js\");\n/* harmony import */ var _domtools__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./domtools */ \"./src/modules/domtools.js\");\n\n\n\n\n\n\n\n\n\nconst BdApi = {\n get React() {\n return _v2__WEBPACK_IMPORTED_MODULE_3__[\"default\"].React;\n },\n\n get ReactDOM() {\n return _v2__WEBPACK_IMPORTED_MODULE_3__[\"default\"].ReactDom;\n },\n\n get ReactComponent() {\n return _v2__WEBPACK_IMPORTED_MODULE_3__[\"default\"].ReactComponent;\n },\n\n get WindowConfigFile() {\n return _utils__WEBPACK_IMPORTED_MODULE_2__[\"default\"].WindowConfigFile;\n },\n\n get settings() {\n return _0globals__WEBPACK_IMPORTED_MODULE_0__[\"settings\"];\n },\n\n get emotes() {\n return _0globals__WEBPACK_IMPORTED_MODULE_0__[\"bdEmotes\"];\n },\n\n get screenWidth() {\n return Math.max(document.documentElement.clientWidth, window.innerWidth || 0);\n },\n\n get screenHeight() {\n return Math.max(document.documentElement.clientHeight, window.innerHeight || 0);\n }\n\n};\n\nBdApi.getAllWindowPreferences = function () {\n return _utils__WEBPACK_IMPORTED_MODULE_2__[\"default\"].getAllWindowPreferences();\n};\n\nBdApi.getWindowPreference = function (key) {\n return _utils__WEBPACK_IMPORTED_MODULE_2__[\"default\"].getWindowPreference(key);\n};\n\nBdApi.setWindowPreference = function (key, value) {\n return _utils__WEBPACK_IMPORTED_MODULE_2__[\"default\"].setWindowPreference(key, value);\n}; //Inject CSS to document head\n//id = id of element\n//css = custom css\n\n\nBdApi.injectCSS = function (id, css) {\n _domtools__WEBPACK_IMPORTED_MODULE_8__[\"default\"].addStyle(_domtools__WEBPACK_IMPORTED_MODULE_8__[\"default\"].escapeID(id), css);\n}; //Clear css/remove any element\n//id = id of element\n\n\nBdApi.clearCSS = function (id) {\n _domtools__WEBPACK_IMPORTED_MODULE_8__[\"default\"].removeStyle(_domtools__WEBPACK_IMPORTED_MODULE_8__[\"default\"].escapeID(id));\n}; //Inject CSS to document head\n//id = id of element\n//css = custom css\n\n\nBdApi.linkJS = function (id, url) {\n _domtools__WEBPACK_IMPORTED_MODULE_8__[\"default\"].addScript(_domtools__WEBPACK_IMPORTED_MODULE_8__[\"default\"].escapeID(id), url);\n}; //Clear css/remove any element\n//id = id of element\n\n\nBdApi.unlinkJS = function (id) {\n _domtools__WEBPACK_IMPORTED_MODULE_8__[\"default\"].removeScript(_domtools__WEBPACK_IMPORTED_MODULE_8__[\"default\"].escapeID(id));\n}; //Get another plugin\n//name = name of plugin\n\n\nBdApi.getPlugin = function (name) {\n if (_0globals__WEBPACK_IMPORTED_MODULE_0__[\"bdplugins\"].hasOwnProperty(name)) {\n return _0globals__WEBPACK_IMPORTED_MODULE_0__[\"bdplugins\"][name].plugin;\n }\n\n return null;\n}; //Get BetterDiscord Core\n\n\nBdApi.getCore = function () {\n _utils__WEBPACK_IMPORTED_MODULE_2__[\"default\"].warn(\"Deprecation Notice\", `BdApi.getCore() will be removed in future versions.`);\n return _core__WEBPACK_IMPORTED_MODULE_1__[\"default\"];\n};\n/**\r\n * Shows a generic but very customizable modal.\r\n * @param {string} title - title of the modal\r\n * @param {string} content - a string of text to display in the modal\r\n */\n\n\nBdApi.alert = function (title, content) {\n const ModalStack = BdApi.findModuleByProps(\"push\", \"update\", \"pop\", \"popWithKey\");\n const AlertModal = BdApi.findModuleByPrototypes(\"handleCancel\", \"handleSubmit\", \"handleMinorConfirm\");\n if (!ModalStack || !AlertModal) return _core__WEBPACK_IMPORTED_MODULE_1__[\"default\"].alert(title, content);\n ModalStack.push(function (props) {\n return BdApi.React.createElement(AlertModal, Object.assign({\n title: title,\n body: content\n }, props));\n });\n};\n/**\r\n * Shows a generic but very customizable confirmation modal with optional confirm and cancel callbacks.\r\n * @param {string} title - title of the modal\r\n * @param {(string|ReactElement|Array)} children - a single or mixed array of react elements and strings. Every string is wrapped in Discord's `Markdown` component so strings will show and render properly.\r\n * @param {object} [options] - options to modify the modal\r\n * @param {boolean} [options.danger=false] - whether the main button should be red or not\r\n * @param {string} [options.confirmText=Okay] - text for the confirmation/submit button\r\n * @param {string} [options.cancelText=Cancel] - text for the cancel button\r\n * @param {callable} [options.onConfirm=NOOP] - callback to occur when clicking the submit button\r\n * @param {callable} [options.onCancel=NOOP] - callback to occur when clicking the cancel button\r\n */\n\n\nBdApi.showConfirmationModal = function (title, content, options = {}) {\n _utils__WEBPACK_IMPORTED_MODULE_2__[\"default\"].showConfirmationModal(title, content, options);\n}; //Show toast alert\n\n\nBdApi.showToast = function (content, options = {}) {\n _utils__WEBPACK_IMPORTED_MODULE_2__[\"default\"].showToast(content, options);\n}; // Finds module\n\n\nBdApi.findModule = function (filter) {\n return _v2__WEBPACK_IMPORTED_MODULE_3__[\"default\"].WebpackModules.find(filter);\n}; // Finds module\n\n\nBdApi.findAllModules = function (filter) {\n return _v2__WEBPACK_IMPORTED_MODULE_3__[\"default\"].WebpackModules.findAll(filter);\n}; // Finds module\n\n\nBdApi.findModuleByProps = function (...props) {\n return _v2__WEBPACK_IMPORTED_MODULE_3__[\"default\"].WebpackModules.findByUniqueProperties(props);\n};\n\nBdApi.findModuleByPrototypes = function (...protos) {\n return _v2__WEBPACK_IMPORTED_MODULE_3__[\"default\"].WebpackModules.findByPrototypes(protos);\n};\n\nBdApi.findModuleByDisplayName = function (name) {\n return _v2__WEBPACK_IMPORTED_MODULE_3__[\"default\"].WebpackModules.findByDisplayName(name);\n}; // Gets react instance\n\n\nBdApi.getInternalInstance = function (node) {\n if (!(node instanceof window.jQuery) && !(node instanceof Element)) return undefined;\n if (node instanceof jQuery) node = node[0];\n return _v2__WEBPACK_IMPORTED_MODULE_3__[\"default\"].getInternalInstance(node);\n}; // Gets data\n\n\nBdApi.loadData = function (pluginName, key) {\n return _dataStore__WEBPACK_IMPORTED_MODULE_4__[\"default\"].getPluginData(pluginName, key);\n};\n\nBdApi.getData = BdApi.loadData; // Sets data\n\nBdApi.saveData = function (pluginName, key, data) {\n return _dataStore__WEBPACK_IMPORTED_MODULE_4__[\"default\"].setPluginData(pluginName, key, data);\n};\n\nBdApi.setData = BdApi.saveData; // Deletes data\n\nBdApi.deleteData = function (pluginName, key) {\n return _dataStore__WEBPACK_IMPORTED_MODULE_4__[\"default\"].deletePluginData(pluginName, key);\n}; // Patches other functions\n\n\nBdApi.monkeyPatch = function (what, methodName, options) {\n return _utils__WEBPACK_IMPORTED_MODULE_2__[\"default\"].monkeyPatch(what, methodName, options);\n}; // Event when element is removed\n\n\nBdApi.onRemoved = function (node, callback) {\n return _utils__WEBPACK_IMPORTED_MODULE_2__[\"default\"].onRemoved(node, callback);\n}; // Wraps function in try..catch\n\n\nBdApi.suppressErrors = function (method, message) {\n return _utils__WEBPACK_IMPORTED_MODULE_2__[\"default\"].suppressErrors(method, message);\n}; // Tests for valid JSON\n\n\nBdApi.testJSON = function (data) {\n return _utils__WEBPACK_IMPORTED_MODULE_2__[\"default\"].testJSON(data);\n};\n\nBdApi.isPluginEnabled = function (name) {\n return !!_0globals__WEBPACK_IMPORTED_MODULE_0__[\"pluginCookie\"][name];\n};\n\nBdApi.isThemeEnabled = function (name) {\n return !!_0globals__WEBPACK_IMPORTED_MODULE_0__[\"themeCookie\"][name];\n};\n\nBdApi.isSettingEnabled = function (id) {\n return !!_0globals__WEBPACK_IMPORTED_MODULE_0__[\"settingsCookie\"][id];\n};\n\nBdApi.enableSetting = function (id) {\n return _settingsPanel__WEBPACK_IMPORTED_MODULE_7__[\"default\"].onChange(id, true);\n};\n\nBdApi.disableSetting = function (id) {\n return _settingsPanel__WEBPACK_IMPORTED_MODULE_7__[\"default\"].onChange(id, false);\n};\n\nBdApi.toggleSetting = function (id) {\n return _settingsPanel__WEBPACK_IMPORTED_MODULE_7__[\"default\"].onChange(id, !_0globals__WEBPACK_IMPORTED_MODULE_0__[\"settingsCookie\"][id]);\n}; // Gets data\n\n\nBdApi.getBDData = function (key) {\n return _dataStore__WEBPACK_IMPORTED_MODULE_4__[\"default\"].getBDData(key);\n}; // Sets data\n\n\nBdApi.setBDData = function (key, data) {\n return _dataStore__WEBPACK_IMPORTED_MODULE_4__[\"default\"].setBDData(key, data);\n};\n\nconst makeAddonAPI = (cookie, list, manager) => new class AddonAPI {\n get folder() {\n return manager.folder;\n }\n\n isEnabled(name) {\n return !!cookie[name];\n }\n\n enable(name) {\n return manager.enable(name);\n }\n\n disable(name) {\n return manager.disable(name);\n }\n\n toggle(name) {\n if (cookie[name]) this.disable(name);else this.enable(name);\n }\n\n reload(name) {\n return manager.reload(name);\n }\n\n get(name) {\n if (list.hasOwnProperty(name)) {\n if (list[name].plugin) return list[name].plugin;\n return list[name];\n }\n\n return null;\n }\n\n getAll() {\n return Object.keys(list).map(k => this.get(k)).filter(a => a);\n }\n\n}();\n\nBdApi.Plugins = makeAddonAPI(_0globals__WEBPACK_IMPORTED_MODULE_0__[\"pluginCookie\"], _0globals__WEBPACK_IMPORTED_MODULE_0__[\"bdplugins\"], _pluginModule__WEBPACK_IMPORTED_MODULE_5__[\"default\"]);\nBdApi.Themes = makeAddonAPI(_0globals__WEBPACK_IMPORTED_MODULE_0__[\"themeCookie\"], _0globals__WEBPACK_IMPORTED_MODULE_0__[\"bdthemes\"], _themeModule__WEBPACK_IMPORTED_MODULE_6__[\"default\"]);\n/* harmony default export */ __webpack_exports__[\"default\"] = (BdApi);//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiLi9zcmMvbW9kdWxlcy9iZEFwaS5qcy5qcyIsInNvdXJjZXMiOlsid2VicGFjazovL0NvcmUvLi9zcmMvbW9kdWxlcy9iZEFwaS5qcz9hOWEzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IHBsdWdpbkNvb2tpZSwgdGhlbWVDb29raWUsIGJkcGx1Z2lucywgYmR0aGVtZXMsIHNldHRpbmdzQ29va2llLCBzZXR0aW5ncywgYmRFbW90ZXMgfSBmcm9tIFwiLi4vMGdsb2JhbHNcIjtcbmltcG9ydCBtYWluQ29yZSBmcm9tIFwiLi9jb3JlXCI7XG5pbXBvcnQgVXRpbHMgZnJvbSBcIi4vdXRpbHNcIjtcbmltcG9ydCBCRFYyIGZyb20gXCIuL3YyXCI7XG5pbXBvcnQgRGF0YVN0b3JlIGZyb20gXCIuL2RhdGFTdG9yZVwiO1xuaW1wb3J0IHBsdWdpbk1vZHVsZSBmcm9tIFwiLi9wbHVnaW5Nb2R1bGVcIjtcbmltcG9ydCB0aGVtZU1vZHVsZSBmcm9tIFwiLi90aGVtZU1vZHVsZVwiO1xuaW1wb3J0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.r(__webpack_exports__);\n/* harmony import */ var _0globals__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../0globals */ \"./src/0globals.js\");\n/* harmony import */ var _core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./core */ \"./src/modules/core.js\");\n/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./utils */ \"./src/modules/utils.js\");\n/* harmony import */ var _v2__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./v2 */ \"./src/modules/v2.js\");\n/* harmony import */ var _dataStore__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./dataStore */ \"./src/modules/dataStore.js\");\n/* harmony import */ var _pluginModule__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./pluginModule */ \"./src/modules/pluginModule.js\");\n/* harmony import */ var _themeModule__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./themeModule */ \"./src/modules/themeModule.js\");\n/* harmony import */ var _settingsPanel__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./settingsPanel */ \"./src/modules/settingsPanel.js\");\n/* harmony import */ var _domtools__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./domtools */ \"./src/modules/domtools.js\");\n\n\n\n\n\n\n\n\n\nconst BdApi = {\n get React() {\n return _v2__WEBPACK_IMPORTED_MODULE_3__[\"default\"].React;\n },\n\n get ReactDOM() {\n return _v2__WEBPACK_IMPORTED_MODULE_3__[\"default\"].ReactDom;\n },\n\n get ReactComponent() {\n return _v2__WEBPACK_IMPORTED_MODULE_3__[\"default\"].ReactComponent;\n },\n\n get WindowConfigFile() {\n return _utils__WEBPACK_IMPORTED_MODULE_2__[\"default\"].WindowConfigFile;\n },\n\n get settings() {\n return _0globals__WEBPACK_IMPORTED_MODULE_0__[\"settings\"];\n },\n\n get emotes() {\n return _0globals__WEBPACK_IMPORTED_MODULE_0__[\"bdEmotes\"];\n },\n\n get screenWidth() {\n return Math.max(document.documentElement.clientWidth, window.innerWidth || 0);\n },\n\n get screenHeight() {\n return Math.max(document.documentElement.clientHeight, window.innerHeight || 0);\n }\n\n};\n\nBdApi.getAllWindowPreferences = function () {\n return _utils__WEBPACK_IMPORTED_MODULE_2__[\"default\"].getAllWindowPreferences();\n};\n\nBdApi.getWindowPreference = function (key) {\n return _utils__WEBPACK_IMPORTED_MODULE_2__[\"default\"].getWindowPreference(key);\n};\n\nBdApi.setWindowPreference = function (key, value) {\n return _utils__WEBPACK_IMPORTED_MODULE_2__[\"default\"].setWindowPreference(key, value);\n}; //Inject CSS to document head\n//id = id of element\n//css = custom css\n\n\nBdApi.injectCSS = function (id, css) {\n _domtools__WEBPACK_IMPORTED_MODULE_8__[\"default\"].addStyle(_domtools__WEBPACK_IMPORTED_MODULE_8__[\"default\"].escapeID(id), css);\n}; //Clear css/remove any element\n//id = id of element\n\n\nBdApi.clearCSS = function (id) {\n _domtools__WEBPACK_IMPORTED_MODULE_8__[\"default\"].removeStyle(_domtools__WEBPACK_IMPORTED_MODULE_8__[\"default\"].escapeID(id));\n}; //Inject CSS to document head\n//id = id of element\n//css = custom css\n\n\nBdApi.linkJS = function (id, url) {\n _domtools__WEBPACK_IMPORTED_MODULE_8__[\"default\"].addScript(_domtools__WEBPACK_IMPORTED_MODULE_8__[\"default\"].escapeID(id), url);\n}; //Clear css/remove any element\n//id = id of element\n\n\nBdApi.unlinkJS = function (id) {\n _domtools__WEBPACK_IMPORTED_MODULE_8__[\"default\"].removeScript(_domtools__WEBPACK_IMPORTED_MODULE_8__[\"default\"].escapeID(id));\n}; //Get another plugin\n//name = name of plugin\n\n\nBdApi.getPlugin = function (name) {\n if (_0globals__WEBPACK_IMPORTED_MODULE_0__[\"bdplugins\"].hasOwnProperty(name)) {\n return _0globals__WEBPACK_IMPORTED_MODULE_0__[\"bdplugins\"][name].plugin;\n }\n\n return null;\n}; //Get BetterDiscord Core\n\n\nBdApi.getCore = function () {\n _utils__WEBPACK_IMPORTED_MODULE_2__[\"default\"].warn(\"Deprecation Notice\", `BdApi.getCore() will be removed in future versions.`);\n return _core__WEBPACK_IMPORTED_MODULE_1__[\"default\"];\n};\n/**\r\n * Shows a generic but very customizable modal.\r\n * @param {string} title - title of the modal\r\n * @param {string} content - a string of text to display in the modal\r\n */\n\n\nBdApi.alert = function (title, content) {\n _utils__WEBPACK_IMPORTED_MODULE_2__[\"default\"].showConfirmationModal(title, content, {\n cancelText: null\n });\n};\n/**\r\n * Shows a generic but very customizable confirmation modal with optional confirm and cancel callbacks.\r\n * @param {string} title - title of the modal\r\n * @param {(string|ReactElement|Array)} children - a single or mixed array of react elements and strings. Every string is wrapped in Discord's `Markdown` component so strings will show and render properly.\r\n * @param {object} [options] - options to modify the modal\r\n * @param {boolean} [options.danger=false] - whether the main button should be red or not\r\n * @param {string} [options.confirmText=Okay] - text for the confirmation/submit button\r\n * @param {string} [options.cancelText=Cancel] - text for the cancel button\r\n * @param {callable} [options.onConfirm=NOOP] - callback to occur when clicking the submit button\r\n * @param {callable} [options.onCancel=NOOP] - callback to occur when clicking the cancel button\r\n */\n\n\nBdApi.showConfirmationModal = function (title, content, options = {}) {\n _utils__WEBPACK_IMPORTED_MODULE_2__[\"default\"].showConfirmationModal(title, content, options);\n}; //Show toast alert\n\n\nBdApi.showToast = function (content, options = {}) {\n _utils__WEBPACK_IMPORTED_MODULE_2__[\"default\"].showToast(content, options);\n}; // Finds module\n\n\nBdApi.findModule = function (filter) {\n return _v2__WEBPACK_IMPORTED_MODULE_3__[\"default\"].WebpackModules.find(filter);\n}; // Finds module\n\n\nBdApi.findAllModules = function (filter) {\n return _v2__WEBPACK_IMPORTED_MODULE_3__[\"default\"].WebpackModules.findAll(filter);\n}; // Finds module\n\n\nBdApi.findModuleByProps = function (...props) {\n return _v2__WEBPACK_IMPORTED_MODULE_3__[\"default\"].WebpackModules.findByUniqueProperties(props);\n};\n\nBdApi.findModuleByPrototypes = function (...protos) {\n return _v2__WEBPACK_IMPORTED_MODULE_3__[\"default\"].WebpackModules.findByPrototypes(protos);\n};\n\nBdApi.findModuleByDisplayName = function (name) {\n return _v2__WEBPACK_IMPORTED_MODULE_3__[\"default\"].WebpackModules.findByDisplayName(name);\n}; // Gets react instance\n\n\nBdApi.getInternalInstance = function (node) {\n if (!(node instanceof window.jQuery) && !(node instanceof Element)) return undefined;\n if (node instanceof jQuery) node = node[0];\n return _v2__WEBPACK_IMPORTED_MODULE_3__[\"default\"].getInternalInstance(node);\n}; // Gets data\n\n\nBdApi.loadData = function (pluginName, key) {\n return _dataStore__WEBPACK_IMPORTED_MODULE_4__[\"default\"].getPluginData(pluginName, key);\n};\n\nBdApi.getData = BdApi.loadData; // Sets data\n\nBdApi.saveData = function (pluginName, key, data) {\n return _dataStore__WEBPACK_IMPORTED_MODULE_4__[\"default\"].setPluginData(pluginName, key, data);\n};\n\nBdApi.setData = BdApi.saveData; // Deletes data\n\nBdApi.deleteData = function (pluginName, key) {\n return _dataStore__WEBPACK_IMPORTED_MODULE_4__[\"default\"].deletePluginData(pluginName, key);\n}; // Patches other functions\n\n\nBdApi.monkeyPatch = function (what, methodName, options) {\n return _utils__WEBPACK_IMPORTED_MODULE_2__[\"default\"].monkeyPatch(what, methodName, options);\n}; // Event when element is removed\n\n\nBdApi.onRemoved = function (node, callback) {\n return _utils__WEBPACK_IMPORTED_MODULE_2__[\"default\"].onRemoved(node, callback);\n}; // Wraps function in try..catch\n\n\nBdApi.suppressErrors = function (method, message) {\n return _utils__WEBPACK_IMPORTED_MODULE_2__[\"default\"].suppressErrors(method, message);\n}; // Tests for valid JSON\n\n\nBdApi.testJSON = function (data) {\n return _utils__WEBPACK_IMPORTED_MODULE_2__[\"default\"].testJSON(data);\n};\n\nBdApi.isPluginEnabled = function (name) {\n return !!_0globals__WEBPACK_IMPORTED_MODULE_0__[\"pluginCookie\"][name];\n};\n\nBdApi.isThemeEnabled = function (name) {\n return !!_0globals__WEBPACK_IMPORTED_MODULE_0__[\"themeCookie\"][name];\n};\n\nBdApi.isSettingEnabled = function (id) {\n return !!_0globals__WEBPACK_IMPORTED_MODULE_0__[\"settingsCookie\"][id];\n};\n\nBdApi.enableSetting = function (id) {\n return _settingsPanel__WEBPACK_IMPORTED_MODULE_7__[\"default\"].onChange(id, true);\n};\n\nBdApi.disableSetting = function (id) {\n return _settingsPanel__WEBPACK_IMPORTED_MODULE_7__[\"default\"].onChange(id, false);\n};\n\nBdApi.toggleSetting = function (id) {\n return _settingsPanel__WEBPACK_IMPORTED_MODULE_7__[\"default\"].onChange(id, !_0globals__WEBPACK_IMPORTED_MODULE_0__[\"settingsCookie\"][id]);\n}; // Gets data\n\n\nBdApi.getBDData = function (key) {\n return _dataStore__WEBPACK_IMPORTED_MODULE_4__[\"default\"].getBDData(key);\n}; // Sets data\n\n\nBdApi.setBDData = function (key, data) {\n return _dataStore__WEBPACK_IMPORTED_MODULE_4__[\"default\"].setBDData(key, data);\n};\n\nconst makeAddonAPI = (cookie, list, manager) => new class AddonAPI {\n get folder() {\n return manager.folder;\n }\n\n isEnabled(name) {\n return !!cookie[name];\n }\n\n enable(name) {\n return manager.enable(name);\n }\n\n disable(name) {\n return manager.disable(name);\n }\n\n toggle(name) {\n if (cookie[name]) this.disable(name);else this.enable(name);\n }\n\n reload(name) {\n return manager.reload(name);\n }\n\n get(name) {\n if (list.hasOwnProperty(name)) {\n if (list[name].plugin) return list[name].plugin;\n return list[name];\n }\n\n return null;\n }\n\n getAll() {\n return Object.keys(list).map(k => this.get(k)).filter(a => a);\n }\n\n}();\n\nBdApi.Plugins = makeAddonAPI(_0globals__WEBPACK_IMPORTED_MODULE_0__[\"pluginCookie\"], _0globals__WEBPACK_IMPORTED_MODULE_0__[\"bdplugins\"], _pluginModule__WEBPACK_IMPORTED_MODULE_5__[\"default\"]);\nBdApi.Themes = makeAddonAPI(_0globals__WEBPACK_IMPORTED_MODULE_0__[\"themeCookie\"], _0globals__WEBPACK_IMPORTED_MODULE_0__[\"bdthemes\"], _themeModule__WEBPACK_IMPORTED_MODULE_6__[\"default\"]);\n/* harmony default export */ __webpack_exports__[\"default\"] = (BdApi);//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiLi9zcmMvbW9kdWxlcy9iZEFwaS5qcy5qcyIsInNvdXJjZXMiOlsid2VicGFjazovL0NvcmUvLi9zcmMvbW9kdWxlcy9iZEFwaS5qcz9hOWEzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IHBsdWdpbkNvb2tpZSwgdGhlbWVDb29raWUsIGJkcGx1Z2lucywgYmR0aGVtZXMsIHNldHRpbmdzQ29va2llLCBzZXR0aW5ncywgYmRFbW90ZXMgfSBmcm9tIFwiLi4vMGdsb2JhbHNcIjtcbmltcG9ydCBtYWluQ29yZSBmcm9tIFwiLi9jb3JlXCI7XG5pbXBvcnQgVXRpbHMgZnJvbSBcIi4vdXRpbHNcIjtcbmltcG9ydCBCRFYyIGZyb20gXCIuL3YyXCI7XG5pbXBvcnQgRGF0YVN0b3JlIGZyb20gXCIuL2RhdGFTdG9yZVwiO1xuaW1wb3J0IHBsdWdpbk1vZHVsZSBmcm9tIFwiLi9wbHVnaW5Nb2R1bGVcIjtcbmltcG9ydCB0aGVtZU1vZHVsZSBmcm9tIFwiLi90aGVtZU1vZHVsZVwiO1xuaW1wb3J0IHNldHRpbmdzUGFuZWwgZnJvbSBcIi4vc2V0dGluZ3NQYW5lbFwiO1xuaW1wb3J0IERPTSBmcm9tIFwiLi9kb210b29sc1wiO1xuY29uc3QgQmRBcGkgPSB7XG4gIGdldCBSZWFjdCgpIHtcbiAgICByZXR1cm4gQkRWMi5SZWFjdDtcbiAgfSxcblxuICBnZXQgUmVhY3RET00oKSB7XG4gICAgcmV0dXJuIEJEVjIuUmVhY3REb207XG4gIH0sXG5cbiAgZ2V0IFJlYWN0Q29tcG9uZW50KCkge1xuICAgIHJldHVybiBCRFYyLlJlYWN0Q29tcG9uZW50O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FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQSIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///./src/modules/bdApi.js\n"); /***/ }), @@ -215,7 +215,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _0gl /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _0globals__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../0globals */ \"./src/0globals.js\");\n/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./utils */ \"./src/modules/utils.js\");\n/* harmony import */ var _emoteModule__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./emoteModule */ \"./src/modules/emoteModule.js\");\n/* harmony import */ var _quickEmoteMenu__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./quickEmoteMenu */ \"./src/modules/quickEmoteMenu.js\");\n/* harmony import */ var _v2__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./v2 */ \"./src/modules/v2.js\");\n/* harmony import */ var _settingsPanel__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./settingsPanel */ \"./src/modules/settingsPanel.js\");\n/* harmony import */ var _pluginModule__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./pluginModule */ \"./src/modules/pluginModule.js\");\n/* harmony import */ var _themeModule__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./themeModule */ \"./src/modules/themeModule.js\");\n/* harmony import */ var _dataStore__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./dataStore */ \"./src/modules/dataStore.js\");\n/* harmony import */ var _webpackModules__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./webpackModules */ \"./src/modules/webpackModules.js\");\n/* harmony import */ var _domtools__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./domtools */ \"./src/modules/domtools.js\");\n/* harmony import */ var _ui_bdLogo__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../ui/bdLogo */ \"./src/ui/bdLogo.js\");\n/* harmony import */ var _ui_tooltipWrap__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../ui/tooltipWrap */ \"./src/ui/tooltipWrap.js\");\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nfunction Core() {// Object.assign(bdConfig, __non_webpack_require__(DataStore.configFile));\n // this.init();\n}\n\nCore.prototype.setConfig = function (config) {\n Object.assign(_0globals__WEBPACK_IMPORTED_MODULE_0__[\"bdConfig\"], config);\n};\n\nCore.prototype.init = async function () {\n if (!Array.prototype.flat) {\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].alert(\"Not Supported\", \"BetterDiscord v\" + _0globals__WEBPACK_IMPORTED_MODULE_0__[\"bbdVersion\"] + \" does not support this old version (\" + _0globals__WEBPACK_IMPORTED_MODULE_0__[\"currentDiscordVersion\"] + \") of Discord. Please update your Discord installation before proceeding.\");\n return;\n }\n\n if (_0globals__WEBPACK_IMPORTED_MODULE_0__[\"bdConfig\"].version < _0globals__WEBPACK_IMPORTED_MODULE_0__[\"minSupportedVersion\"]) {\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].alert(\"Not Supported\", \"BetterDiscord v\" + _0globals__WEBPACK_IMPORTED_MODULE_0__[\"bdConfig\"].version + \" (your version)\" + \" is not supported by the latest js (\" + _0globals__WEBPACK_IMPORTED_MODULE_0__[\"bbdVersion\"] + \").

Please download the latest version from GitHub\");\n return;\n }\n\n if (window.ED) {\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].alert(\"Not Supported\", \"BandagedBD does not work with EnhancedDiscord. Please uninstall one of them.\");\n return;\n }\n\n if (window.WebSocket && window.WebSocket.name && window.WebSocket.name.includes(\"Patched\")) {\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].alert(\"Not Supported\", \"BandagedBD does not work with Powercord. Please uninstall one of them.\");\n return;\n }\n\n const latestLocalVersion = _0globals__WEBPACK_IMPORTED_MODULE_0__[\"bdConfig\"].updater ? _0globals__WEBPACK_IMPORTED_MODULE_0__[\"bdConfig\"].updater.LatestVersion : _0globals__WEBPACK_IMPORTED_MODULE_0__[\"bdConfig\"].latestVersion;\n\n if (latestLocalVersion > _0globals__WEBPACK_IMPORTED_MODULE_0__[\"bdConfig\"].version) {\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].showConfirmationModal(\"Update Available\", [`There is an update available for BandagedBD's Injector (${latestLocalVersion}).`, \"You can either update and restart now, or later.\"], {\n confirmText: \"Update Now\",\n cancelText: \"Maybe Later\",\n onConfirm: async () => {\n const onUpdateFailed = () => {\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].alert(\"Could Not Update\", `Unable to update automatically, please download the installer and reinstall normally.

Download Installer`);\n };\n\n try {\n const didUpdate = await this.updateInjector();\n if (!didUpdate) return onUpdateFailed();\n\n const app = __webpack_require__(/*! electron */ \"electron\").remote.app;\n\n app.relaunch();\n app.exit();\n } catch (err) {\n onUpdateFailed();\n }\n }\n });\n }\n\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].log(\"Startup\", \"Initializing Settings\");\n this.initSettings();\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].log(\"Startup\", \"Initializing EmoteModule\");\n window.emotePromise = _emoteModule__WEBPACK_IMPORTED_MODULE_2__[\"default\"].init().then(() => {\n _emoteModule__WEBPACK_IMPORTED_MODULE_2__[\"default\"].initialized = true;\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].log(\"Startup\", \"Initializing QuickEmoteMenu\");\n _quickEmoteMenu__WEBPACK_IMPORTED_MODULE_3__[\"default\"].init();\n });\n this.injectExternals();\n await this.checkForGuilds();\n _v2__WEBPACK_IMPORTED_MODULE_4__[\"default\"].initialize();\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].log(\"Startup\", \"Updating Settings\");\n _settingsPanel__WEBPACK_IMPORTED_MODULE_5__[\"default\"].initializeSettings();\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].log(\"Startup\", \"Loading Plugins\");\n _pluginModule__WEBPACK_IMPORTED_MODULE_6__[\"default\"].loadPlugins();\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].log(\"Startup\", \"Loading Themes\");\n _themeModule__WEBPACK_IMPORTED_MODULE_7__[\"default\"].loadThemes();\n _domtools__WEBPACK_IMPORTED_MODULE_10__[\"default\"].addStyle(\"customcss\", atob(_dataStore__WEBPACK_IMPORTED_MODULE_8__[\"default\"].getBDData(\"bdcustomcss\")));\n window.addEventListener(\"beforeunload\", function () {\n if (_0globals__WEBPACK_IMPORTED_MODULE_0__[\"settingsCookie\"][\"bda-dc-0\"]) document.querySelector(\".btn.btn-disconnect\").click();\n });\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].log(\"Startup\", \"Removing Loading Icon\");\n if (document.getElementsByClassName(\"bd-loaderv2\").length) document.getElementsByClassName(\"bd-loaderv2\")[0].remove();\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].log(\"Startup\", \"Initializing Main Observer\");\n this.initObserver(); // Show loading errors\n\n if (_0globals__WEBPACK_IMPORTED_MODULE_0__[\"settingsCookie\"][\"fork-ps-1\"]) {\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].log(\"Startup\", \"Collecting Startup Errors\");\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].showContentErrors({\n plugins: _0globals__WEBPACK_IMPORTED_MODULE_0__[\"bdpluginErrors\"],\n themes: _0globals__WEBPACK_IMPORTED_MODULE_0__[\"bdthemeErrors\"]\n });\n }\n\n const previousVersion = _dataStore__WEBPACK_IMPORTED_MODULE_8__[\"default\"].getBDData(\"version\");\n\n if (_0globals__WEBPACK_IMPORTED_MODULE_0__[\"bbdVersion\"] > previousVersion) {\n if (_0globals__WEBPACK_IMPORTED_MODULE_0__[\"bbdChangelog\"]) this.showChangelogModal(_0globals__WEBPACK_IMPORTED_MODULE_0__[\"bbdChangelog\"]);\n _dataStore__WEBPACK_IMPORTED_MODULE_8__[\"default\"].setBDData(\"version\", _0globals__WEBPACK_IMPORTED_MODULE_0__[\"bbdVersion\"]);\n }\n\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].suppressErrors(this.patchSocial.bind(this), \"BD Social Patch\")();\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].suppressErrors(this.patchGuildPills.bind(this), \"BD Guild Pills Patch\")();\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].suppressErrors(this.patchGuildListItems.bind(this), \"BD Guild List Items Patch\")();\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].suppressErrors(this.patchGuildSeparator.bind(this), \"BD Guild Separator Patch\")();\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].suppressErrors(this.patchMessageHeader.bind(this), \"BD Badge Chat Patch\")();\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].suppressErrors(this.patchMemberList.bind(this), \"BD Badge Member List Patch\")();\n};\n\nCore.prototype.checkForGuilds = function () {\n let timesChecked = 0;\n return new Promise(resolve => {\n const checkForGuilds = function () {\n const wrapper = _v2__WEBPACK_IMPORTED_MODULE_4__[\"default\"].guildClasses.wrapper.split(\" \")[0];\n if (document.querySelectorAll(`.${wrapper}`).length > 0) timesChecked++;\n const guild = _v2__WEBPACK_IMPORTED_MODULE_4__[\"default\"].guildClasses.listItem.split(\" \")[0];\n const blob = _v2__WEBPACK_IMPORTED_MODULE_4__[\"default\"].guildClasses.blobContainer.split(\" \")[0];\n if (document.querySelectorAll(`.${wrapper} .${guild} .${blob}`).length > 0) return resolve(_0globals__WEBPACK_IMPORTED_MODULE_0__[\"bdConfig\"].deferLoaded = true);else if (timesChecked >= 50) return resolve(_0globals__WEBPACK_IMPORTED_MODULE_0__[\"bdConfig\"].deferLoaded = true);\n setTimeout(checkForGuilds, 100);\n };\n\n if (document.readyState != \"loading\") setTimeout(checkForGuilds, 100);\n document.addEventListener(\"DOMContentLoaded\", () => {\n setTimeout(checkForGuilds, 100);\n });\n });\n};\n\nCore.prototype.injectExternals = async function () {\n await _domtools__WEBPACK_IMPORTED_MODULE_10__[\"default\"].addScript(\"ace-script\", \"https://cdnjs.cloudflare.com/ajax/libs/ace/1.2.9/ace.js\");\n if (window.require.original) window.require = window.require.original;\n};\n\nCore.prototype.initSettings = function () {\n _dataStore__WEBPACK_IMPORTED_MODULE_8__[\"default\"].initialize();\n\n if (!_dataStore__WEBPACK_IMPORTED_MODULE_8__[\"default\"].getSettingGroup(\"settings\")) {\n Object.assign(_0globals__WEBPACK_IMPORTED_MODULE_0__[\"settingsCookie\"], _0globals__WEBPACK_IMPORTED_MODULE_0__[\"defaultCookie\"]);\n _settingsPanel__WEBPACK_IMPORTED_MODULE_5__[\"default\"].saveSettings();\n } else {\n _settingsPanel__WEBPACK_IMPORTED_MODULE_5__[\"default\"].loadSettings();\n\n for (const setting in _0globals__WEBPACK_IMPORTED_MODULE_0__[\"defaultCookie\"]) {\n if (_0globals__WEBPACK_IMPORTED_MODULE_0__[\"settingsCookie\"][setting] == undefined) {\n _0globals__WEBPACK_IMPORTED_MODULE_0__[\"settingsCookie\"][setting] = _0globals__WEBPACK_IMPORTED_MODULE_0__[\"defaultCookie\"][setting];\n _settingsPanel__WEBPACK_IMPORTED_MODULE_5__[\"default\"].saveSettings();\n }\n }\n }\n};\n\nCore.prototype.initObserver = function () {\n const mainObserver = new MutationObserver(mutations => {\n for (let i = 0, mlen = mutations.length; i < mlen; i++) {\n const mutation = mutations[i];\n if (typeof _pluginModule__WEBPACK_IMPORTED_MODULE_6__[\"default\"] !== \"undefined\") _pluginModule__WEBPACK_IMPORTED_MODULE_6__[\"default\"].rawObserver(mutation); // if there was nothing added, skip\n\n if (!mutation.addedNodes.length || !(mutation.addedNodes[0] instanceof Element)) continue;\n const node = mutation.addedNodes[0];\n\n if (node.classList.contains(\"layer-3QrUeG\")) {\n if (node.getElementsByClassName(\"guild-settings-base-section\").length) node.setAttribute(\"layer-id\", \"server-settings\");\n\n if (node.getElementsByClassName(\"socialLinks-3jqNFy\").length) {\n node.setAttribute(\"layer-id\", \"user-settings\");\n node.setAttribute(\"id\", \"user-settings\");\n if (!document.getElementById(\"bd-settings-sidebar\")) _settingsPanel__WEBPACK_IMPORTED_MODULE_5__[\"default\"].renderSidebar();\n }\n }\n\n if (node.parentElement == document.body && node.querySelector(\"#ace_settingsmenu\")) node.id = \"ace_settingsmenu_container\"; // Emoji Picker\n //node.getElementsByClassName(\"emojiPicker-3m1S-j\").length && !node.querySelector(\".emojiPicker-3m1S-j\").parentElement.classList.contains(\"animatorLeft-1EQxU0\")\n\n if (node.classList.contains(\"layer-v9HyYc\") && node.getElementsByClassName(\"emojiPicker-3m1S-j\").length && !node.querySelector(\".emojiPicker-3m1S-j\").parentElement.classList.contains(\"animatorLeft-1EQxU0\")) _quickEmoteMenu__WEBPACK_IMPORTED_MODULE_3__[\"default\"].obsCallback(node);\n }\n });\n mainObserver.observe(document, {\n childList: true,\n subtree: true\n });\n};\n\nCore.prototype.showChangelogModal = function (options = {}) {\n return _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].showChangelogModal(options);\n};\n\nCore.prototype.patchSocial = function () {\n if (this.socialPatch) return;\n const TabBar = _webpackModules__WEBPACK_IMPORTED_MODULE_9__[\"default\"].find(m => m.displayName == \"TabBar\");\n const Anchor = _webpackModules__WEBPACK_IMPORTED_MODULE_9__[\"default\"].find(m => m.displayName == \"Anchor\");\n if (!TabBar) return;\n this.socialPatch = _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].monkeyPatch(TabBar.prototype, \"render\", {\n after: data => {\n const children = data.returnValue.props.children;\n if (!children || !children.length || children.length < 3) return;\n if (children[children.length - 3].type.displayName !== \"Separator\") return;\n if (!children[children.length - 2].type.toString().includes(\"socialLinks\")) return;\n\n if (Anchor) {\n const original = children[children.length - 2].type;\n\n const newOne = function () {\n const returnVal = original(...arguments);\n returnVal.props.children.push(_v2__WEBPACK_IMPORTED_MODULE_4__[\"default\"].React.createElement(_ui_tooltipWrap__WEBPACK_IMPORTED_MODULE_12__[\"default\"], {\n color: \"black\",\n side: \"top\",\n text: \"BandagedBD\"\n }, _v2__WEBPACK_IMPORTED_MODULE_4__[\"default\"].React.createElement(Anchor, {\n className: \"bd-social-link\",\n href: \"https://github.com/rauenzi/BetterDiscordApp\",\n title: \"BandagedBD\",\n target: \"_blank\"\n }, _v2__WEBPACK_IMPORTED_MODULE_4__[\"default\"].React.createElement(_ui_bdLogo__WEBPACK_IMPORTED_MODULE_11__[\"default\"], {\n size: \"16px\",\n className: \"bd-social-logo\"\n }))));\n return returnVal;\n };\n\n children[children.length - 2].type = newOne;\n }\n\n const injector = _v2__WEBPACK_IMPORTED_MODULE_4__[\"default\"].react.createElement(\"div\", {\n className: \"colorMuted-HdFt4q size12-3cLvbJ\"\n }, `Injector ${_0globals__WEBPACK_IMPORTED_MODULE_0__[\"bdConfig\"].version}`);\n const versionHash = `(${_0globals__WEBPACK_IMPORTED_MODULE_0__[\"bdConfig\"].hash ? _0globals__WEBPACK_IMPORTED_MODULE_0__[\"bdConfig\"].hash.substring(0, 7) : _0globals__WEBPACK_IMPORTED_MODULE_0__[\"bdConfig\"].branch})`;\n const additional = _v2__WEBPACK_IMPORTED_MODULE_4__[\"default\"].react.createElement(\"div\", {\n className: \"colorMuted-HdFt4q size12-3cLvbJ\"\n }, `BBD ${_0globals__WEBPACK_IMPORTED_MODULE_0__[\"bbdVersion\"]} `, _v2__WEBPACK_IMPORTED_MODULE_4__[\"default\"].react.createElement(\"span\", {\n className: \"versionHash-2gXjIB da-versionHash\"\n }, versionHash));\n const originalVersions = children[children.length - 1].type;\n\n children[children.length - 1].type = function () {\n const returnVal = originalVersions(...arguments);\n returnVal.props.children.splice(returnVal.props.children.length - 1, 0, injector);\n returnVal.props.children.splice(1, 0, additional);\n return returnVal;\n };\n }\n });\n};\n\nconst getGuildClasses = function () {\n const guildsWrapper = _webpackModules__WEBPACK_IMPORTED_MODULE_9__[\"default\"].findByProps(\"wrapper\", \"unreadMentionsBar\");\n const guilds = _webpackModules__WEBPACK_IMPORTED_MODULE_9__[\"default\"].findByProps(\"guildsError\", \"selected\");\n const pill = _webpackModules__WEBPACK_IMPORTED_MODULE_9__[\"default\"].findByProps(\"blobContainer\");\n return Object.assign({}, guildsWrapper, guilds, pill);\n};\n\nCore.prototype.patchGuildListItems = function () {\n if (this.guildListItemsPatch) return;\n const GuildClasses = getGuildClasses();\n const listItemClass = GuildClasses.listItem.split(\" \")[0];\n const blobClass = GuildClasses.blobContainer.split(\" \")[0];\n const reactInstance = _v2__WEBPACK_IMPORTED_MODULE_4__[\"default\"].getInternalInstance(document.querySelector(`.${listItemClass} .${blobClass}`).parentElement);\n const GuildComponent = reactInstance.return.type;\n if (!GuildComponent) return;\n this.guildListItemsPatch = _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].monkeyPatch(GuildComponent.prototype, \"render\", {\n after: data => {\n if (data.returnValue && data.thisObject) {\n const returnValue = data.returnValue;\n const guildData = data.thisObject.props;\n returnValue.props.className += \" bd-guild\";\n if (guildData.unread) returnValue.props.className += \" bd-unread\";\n if (guildData.selected) returnValue.props.className += \" bd-selected\";\n if (guildData.audio) returnValue.props.className += \" bd-audio\";\n if (guildData.video) returnValue.props.className += \" bd-video\";\n if (guildData.badge) returnValue.props.className += \" bd-badge\";\n if (guildData.animatable) returnValue.props.className += \" bd-animatable\";\n return returnValue;\n }\n }\n });\n};\n\nCore.prototype.patchGuildPills = function () {\n if (this.guildPillPatch) return;\n const guildPill = _webpackModules__WEBPACK_IMPORTED_MODULE_9__[\"default\"].find(m => m.default && !m.default.displayName && m.default.toString && m.default.toString().includes(\"translate3d\"));\n if (!guildPill) return;\n this.guildPillPatch = _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].monkeyPatch(guildPill, \"default\", {\n after: data => {\n const props = data.methodArguments[0];\n if (props.unread) data.returnValue.props.className += \" bd-unread\";\n if (props.selected) data.returnValue.props.className += \" bd-selected\";\n if (props.hovered) data.returnValue.props.className += \" bd-hovered\";\n return data.returnValue;\n }\n });\n};\n\nCore.prototype.patchGuildSeparator = function () {\n if (this.guildSeparatorPatch) return;\n const Guilds = _webpackModules__WEBPACK_IMPORTED_MODULE_9__[\"default\"].findByDisplayName(\"Guilds\");\n const guildComponents = _webpackModules__WEBPACK_IMPORTED_MODULE_9__[\"default\"].findByProps(\"renderListItem\");\n if (!guildComponents || !Guilds) return;\n\n const GuildSeparator = function () {\n const returnValue = guildComponents.Separator(...arguments);\n returnValue.props.className += \" bd-guild-separator\";\n return returnValue;\n };\n\n this.guildSeparatorPatch = _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].monkeyPatch(Guilds.prototype, \"render\", {\n after: data => {\n data.returnValue.props.children[1].props.children[3].type = GuildSeparator;\n }\n });\n};\n\nCore.prototype.patchMessageHeader = function () {\n if (this.messageHeaderPatch) return;\n const MessageHeader = _webpackModules__WEBPACK_IMPORTED_MODULE_9__[\"default\"].findByProps(\"MessageTimestamp\");\n const Anchor = _webpackModules__WEBPACK_IMPORTED_MODULE_9__[\"default\"].find(m => m.displayName == \"Anchor\");\n if (!Anchor || !MessageHeader || !MessageHeader.default) return;\n this.messageHeaderPatch = _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].monkeyPatch(MessageHeader, \"default\", {\n after: data => {\n const author = _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].getNestedProp(data.methodArguments[0], \"message.author\"); // const header = Utils.getNestedProp(data.returnValue, \"props.children.1.props\");\n\n const children = _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].getNestedProp(data.returnValue, \"props.children.1.props.children.1.props.children\");\n if (!children || !author || !author.id || author.id !== \"249746236008169473\") return; // if (header && header.className) header.className += \" \"\n\n if (!Array.isArray(children)) return;\n children.push(_v2__WEBPACK_IMPORTED_MODULE_4__[\"default\"].React.createElement(_ui_tooltipWrap__WEBPACK_IMPORTED_MODULE_12__[\"default\"], {\n color: \"black\",\n side: \"top\",\n text: \"BandagedBD Developer\"\n }, _v2__WEBPACK_IMPORTED_MODULE_4__[\"default\"].React.createElement(Anchor, {\n className: \"bd-chat-badge\",\n href: \"https://github.com/rauenzi/BetterDiscordApp\",\n title: \"BandagedBD\",\n target: \"_blank\"\n }, _v2__WEBPACK_IMPORTED_MODULE_4__[\"default\"].React.createElement(_ui_bdLogo__WEBPACK_IMPORTED_MODULE_11__[\"default\"], {\n size: \"16px\",\n className: \"bd-logo\"\n }))));\n }\n });\n};\n\nCore.prototype.patchMemberList = function () {\n if (this.memberListPatch) return;\n const MemberListItem = _webpackModules__WEBPACK_IMPORTED_MODULE_9__[\"default\"].findByDisplayName(\"MemberListItem\");\n const Anchor = _webpackModules__WEBPACK_IMPORTED_MODULE_9__[\"default\"].find(m => m.displayName == \"Anchor\");\n if (!Anchor || !MemberListItem || !MemberListItem.prototype || !MemberListItem.prototype.renderDecorators) return;\n this.memberListPatch = _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].monkeyPatch(MemberListItem.prototype, \"renderDecorators\", {\n after: data => {\n const user = _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].getNestedProp(data.thisObject, \"props.user\");\n const children = _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].getNestedProp(data.returnValue, \"props.children\");\n if (!children || !user || !user.id || user.id !== \"249746236008169473\") return;\n if (!Array.isArray(children)) return;\n children.push(_v2__WEBPACK_IMPORTED_MODULE_4__[\"default\"].React.createElement(_ui_tooltipWrap__WEBPACK_IMPORTED_MODULE_12__[\"default\"], {\n color: \"black\",\n side: \"top\",\n text: \"BandagedBD Developer\"\n }, _v2__WEBPACK_IMPORTED_MODULE_4__[\"default\"].React.createElement(Anchor, {\n className: \"bd-member-badge\",\n href: \"https://github.com/rauenzi/BetterDiscordApp\",\n title: \"BandagedBD\",\n target: \"_blank\"\n }, _v2__WEBPACK_IMPORTED_MODULE_4__[\"default\"].React.createElement(_ui_bdLogo__WEBPACK_IMPORTED_MODULE_11__[\"default\"], {\n size: \"16px\",\n className: \"bd-logo\"\n }))));\n }\n });\n};\n\nCore.prototype.updateInjector = async function () {\n const injectionPath = _dataStore__WEBPACK_IMPORTED_MODULE_8__[\"default\"].injectionPath;\n if (!injectionPath) return false;\n\n const fs = __webpack_require__(/*! fs */ \"fs\");\n\n const path = __webpack_require__(/*! path */ \"path\");\n\n const rmrf = __webpack_require__(/*! rimraf */ \"rimraf\");\n\n const yauzl = __webpack_require__(/*! yauzl */ \"yauzl\");\n\n const mkdirp = __webpack_require__(/*! mkdirp */ \"mkdirp\");\n\n const request = __webpack_require__(/*! request */ \"request\");\n\n const parentPath = path.resolve(injectionPath, \"..\");\n const folderName = path.basename(injectionPath);\n const zipLink = \"https://github.com/rauenzi/BetterDiscordApp/archive/injector.zip\";\n const savedZip = path.resolve(parentPath, \"injector.zip\");\n const extractedFolder = path.resolve(parentPath, \"BetterDiscordApp-injector\"); // Download the injector zip file\n\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].log(\"InjectorUpdate\", \"Downloading \" + zipLink);\n let success = await new Promise(resolve => {\n request.get({\n url: zipLink,\n encoding: null\n }, async (error, response, body) => {\n if (error || response.statusCode !== 200) return resolve(false); // Save a backup in case someone has their own copy\n\n const alreadyExists = await new Promise(res => fs.exists(savedZip, res));\n if (alreadyExists) await new Promise(res => fs.rename(savedZip, `${savedZip}.bak${Math.round(performance.now())}`, res));\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].log(\"InjectorUpdate\", \"Writing \" + savedZip);\n fs.writeFile(savedZip, body, err => resolve(!err));\n });\n });\n if (!success) return success; // Check and delete rename extraction\n\n const alreadyExists = await new Promise(res => fs.exists(extractedFolder, res));\n if (alreadyExists) await new Promise(res => fs.rename(extractedFolder, `${extractedFolder}.bak${Math.round(performance.now())}`, res)); // Unzip the downloaded zip file\n\n const zipfile = await new Promise(r => yauzl.open(savedZip, {\n lazyEntries: true\n }, (err, zip) => r(zip)));\n zipfile.on(\"entry\", function (entry) {\n // Skip directories, they are handled with mkdirp\n if (entry.fileName.endsWith(\"/\")) return zipfile.readEntry();\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].log(\"InjectorUpdate\", \"Extracting \" + entry.fileName); // Make any needed parent directories\n\n const fullPath = path.resolve(parentPath, entry.fileName);\n mkdirp.sync(path.dirname(fullPath));\n zipfile.openReadStream(entry, function (err, readStream) {\n if (err) return success = false;\n readStream.on(\"end\", function () {\n zipfile.readEntry();\n }); // Go to next file after this\n\n readStream.pipe(fs.createWriteStream(fullPath));\n });\n });\n zipfile.readEntry(); // Start reading\n // Wait for the final file to finish\n\n await new Promise(resolve => zipfile.once(\"end\", resolve)); // Save a backup in case something goes wrong during final step\n\n const backupFolder = path.resolve(parentPath, `${folderName}.bak${Math.round(performance.now())}`);\n await new Promise(resolve => fs.rename(injectionPath, backupFolder, resolve)); // Rename the extracted folder to what it should be\n\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].log(\"InjectorUpdate\", `Renaming ${path.basename(extractedFolder)} to ${folderName}`);\n success = await new Promise(resolve => fs.rename(extractedFolder, injectionPath, err => resolve(!err)));\n\n if (!success) {\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].err(\"InjectorUpdate\", \"Failed to rename the final directory\");\n return success;\n } // If rename had issues, delete what we tried to rename and restore backup\n\n\n if (!success) {\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].err(\"InjectorUpdate\", \"Something went wrong... restoring backups.\");\n await new Promise(resolve => rmrf(extractedFolder, resolve));\n await new Promise(resolve => fs.rename(backupFolder, injectionPath, resolve));\n return success;\n } // If we've gotten to this point, everything should have gone smoothly.\n // Cleanup the backup folder then remove the zip\n\n\n await new Promise(resolve => rmrf(backupFolder, resolve));\n await new Promise(resolve => fs.unlink(savedZip, resolve));\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].log(\"InjectorUpdate\", \"Injector Updated!\");\n return success;\n};\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (new Core());//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiLi9zcmMvbW9kdWxlcy9jb3JlLmpzLmpzIiwic291cmNlcyI6WyJ3ZWJwYWNrOi8vQ29yZS8uL3NyYy9tb2R1bGVzL2NvcmUuanM/MTNjMiJdLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBiZENvbmZpZywgbWluU3VwcG9ydGVkVmVyc2lvbiwgYmJkVmVyc2lvbiwgc2V0dGluZ3NDb29raWUsIGJkcGx1Z2luRXJyb3JzLCBiZHRoZW1lRXJyb3JzLCBiYmRDaGFuZ2Vsb2csIGRlZmF1bHRDb29raWUsIGN1cnJlbnREaXNjb3JkVmVyc2lvbiB9IGZyb20gXCIuLi8wZ2xvYmFsc1wiO1xuaW1wb3J0IFV0aWxzIGZyb20gXCIuL3V0aWxzXCI7XG5pbXBvcnQgZW1vdGVNb2R1bGUgZnJvbSBcIi4vZW1vdGVNb2R1bGVcIjtcbmltcG9ydCBxdWlja0Vtb3RlTWVudSBmcm9tIFwiLi9xdWlja0Vtb3RlTWVudVwiO1xuaW1wb3J0IEJEVjIgZnJvbSBcIi4vdjJcIjtcbmltcG9ydCBzZXR0aW5nc1BhbmVsIGZyb20gXCIuL3NldHRpbmdzUGFuZWxcIjtcbmltcG9ydCBwbHVnaW5Nb2R1bGUgZnJvbSBcIi4vcGx1Z2luTW9kdWxlXCI7XG5pbXBvcnQgdGhlbWVNb2R1bGUgZnJvbSBcIi4vdGhlbWVNb2R1bGVcIjtcbmltcG9ydCBEYXRhU3RvcmUgZnJvbSBcIi4vZ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BO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBIiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///./src/modules/core.js\n"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _0globals__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../0globals */ \"./src/0globals.js\");\n/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./utils */ \"./src/modules/utils.js\");\n/* harmony import */ var _emoteModule__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./emoteModule */ \"./src/modules/emoteModule.js\");\n/* harmony import */ var _quickEmoteMenu__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./quickEmoteMenu */ \"./src/modules/quickEmoteMenu.js\");\n/* harmony import */ var _v2__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./v2 */ \"./src/modules/v2.js\");\n/* harmony import */ var _settingsPanel__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./settingsPanel */ \"./src/modules/settingsPanel.js\");\n/* harmony import */ var _pluginModule__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./pluginModule */ \"./src/modules/pluginModule.js\");\n/* harmony import */ var _themeModule__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./themeModule */ \"./src/modules/themeModule.js\");\n/* harmony import */ var _dataStore__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./dataStore */ \"./src/modules/dataStore.js\");\n/* harmony import */ var _webpackModules__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./webpackModules */ \"./src/modules/webpackModules.js\");\n/* harmony import */ var _domtools__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./domtools */ \"./src/modules/domtools.js\");\n/* harmony import */ var _ui_bdLogo__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../ui/bdLogo */ \"./src/ui/bdLogo.js\");\n/* harmony import */ var _ui_tooltipWrap__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../ui/tooltipWrap */ \"./src/ui/tooltipWrap.js\");\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nfunction Core() {// Object.assign(bdConfig, __non_webpack_require__(DataStore.configFile));\n // this.init();\n}\n\nCore.prototype.setConfig = function (config) {\n Object.assign(_0globals__WEBPACK_IMPORTED_MODULE_0__[\"bdConfig\"], config);\n};\n\nCore.prototype.init = async function () {\n if (!Array.prototype.flat) {\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].alert(\"Not Supported\", \"BetterDiscord v\" + _0globals__WEBPACK_IMPORTED_MODULE_0__[\"bbdVersion\"] + \" does not support this old version (\" + _0globals__WEBPACK_IMPORTED_MODULE_0__[\"currentDiscordVersion\"] + \") of Discord. Please update your Discord installation before proceeding.\");\n return;\n }\n\n if (_0globals__WEBPACK_IMPORTED_MODULE_0__[\"bdConfig\"].version < _0globals__WEBPACK_IMPORTED_MODULE_0__[\"minSupportedVersion\"]) {\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].alert(\"Not Supported\", \"BetterDiscord v\" + _0globals__WEBPACK_IMPORTED_MODULE_0__[\"bdConfig\"].version + \" (your version)\" + \" is not supported by the latest js (\" + _0globals__WEBPACK_IMPORTED_MODULE_0__[\"bbdVersion\"] + \").

Please download the latest version from GitHub\");\n return;\n }\n\n if (window.ED) {\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].alert(\"Not Supported\", \"BandagedBD does not work with EnhancedDiscord. Please uninstall one of them.\");\n return;\n }\n\n if (window.WebSocket && window.WebSocket.name && window.WebSocket.name.includes(\"Patched\")) {\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].alert(\"Not Supported\", \"BandagedBD does not work with Powercord. Please uninstall one of them.\");\n return;\n }\n\n const latestLocalVersion = _0globals__WEBPACK_IMPORTED_MODULE_0__[\"bdConfig\"].updater ? _0globals__WEBPACK_IMPORTED_MODULE_0__[\"bdConfig\"].updater.LatestVersion : _0globals__WEBPACK_IMPORTED_MODULE_0__[\"bdConfig\"].latestVersion;\n\n if (latestLocalVersion > _0globals__WEBPACK_IMPORTED_MODULE_0__[\"bdConfig\"].version) {\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].showConfirmationModal(\"Update Available\", [`There is an update available for BandagedBD's Injector (${latestLocalVersion}).`, \"You can either update and restart now, or later.\"], {\n confirmText: \"Update Now\",\n cancelText: \"Maybe Later\",\n onConfirm: async () => {\n const onUpdateFailed = () => {\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].alert(\"Could Not Update\", `Unable to update automatically, please download the installer and reinstall normally.

Download Installer`);\n };\n\n try {\n const didUpdate = await this.updateInjector();\n if (!didUpdate) return onUpdateFailed();\n\n const app = __webpack_require__(/*! electron */ \"electron\").remote.app;\n\n app.relaunch();\n app.exit();\n } catch (err) {\n onUpdateFailed();\n }\n }\n });\n }\n\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].log(\"Startup\", \"Initializing Settings\");\n this.initSettings();\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].log(\"Startup\", \"Initializing EmoteModule\");\n window.emotePromise = _emoteModule__WEBPACK_IMPORTED_MODULE_2__[\"default\"].init().then(() => {\n _emoteModule__WEBPACK_IMPORTED_MODULE_2__[\"default\"].initialized = true;\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].log(\"Startup\", \"Initializing QuickEmoteMenu\");\n _quickEmoteMenu__WEBPACK_IMPORTED_MODULE_3__[\"default\"].init();\n });\n this.injectExternals();\n await this.checkForGuilds();\n _v2__WEBPACK_IMPORTED_MODULE_4__[\"default\"].initialize();\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].log(\"Startup\", \"Updating Settings\");\n _settingsPanel__WEBPACK_IMPORTED_MODULE_5__[\"default\"].initializeSettings();\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].log(\"Startup\", \"Loading Plugins\");\n _pluginModule__WEBPACK_IMPORTED_MODULE_6__[\"default\"].loadPlugins();\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].log(\"Startup\", \"Loading Themes\");\n _themeModule__WEBPACK_IMPORTED_MODULE_7__[\"default\"].loadThemes();\n _domtools__WEBPACK_IMPORTED_MODULE_10__[\"default\"].addStyle(\"customcss\", atob(_dataStore__WEBPACK_IMPORTED_MODULE_8__[\"default\"].getBDData(\"bdcustomcss\")));\n window.addEventListener(\"beforeunload\", function () {\n if (_0globals__WEBPACK_IMPORTED_MODULE_0__[\"settingsCookie\"][\"bda-dc-0\"]) document.querySelector(\".btn.btn-disconnect\").click();\n });\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].log(\"Startup\", \"Removing Loading Icon\");\n if (document.getElementsByClassName(\"bd-loaderv2\").length) document.getElementsByClassName(\"bd-loaderv2\")[0].remove();\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].log(\"Startup\", \"Initializing Main Observer\");\n this.initObserver(); // Show loading errors\n\n if (_0globals__WEBPACK_IMPORTED_MODULE_0__[\"settingsCookie\"][\"fork-ps-1\"]) {\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].log(\"Startup\", \"Collecting Startup Errors\");\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].showContentErrors({\n plugins: _0globals__WEBPACK_IMPORTED_MODULE_0__[\"bdpluginErrors\"],\n themes: _0globals__WEBPACK_IMPORTED_MODULE_0__[\"bdthemeErrors\"]\n });\n }\n\n const previousVersion = _dataStore__WEBPACK_IMPORTED_MODULE_8__[\"default\"].getBDData(\"version\");\n\n if (_0globals__WEBPACK_IMPORTED_MODULE_0__[\"bbdVersion\"] > previousVersion) {\n if (_0globals__WEBPACK_IMPORTED_MODULE_0__[\"bbdChangelog\"]) this.showChangelogModal(_0globals__WEBPACK_IMPORTED_MODULE_0__[\"bbdChangelog\"]);\n _dataStore__WEBPACK_IMPORTED_MODULE_8__[\"default\"].setBDData(\"version\", _0globals__WEBPACK_IMPORTED_MODULE_0__[\"bbdVersion\"]);\n }\n\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].suppressErrors(this.patchSocial.bind(this), \"BD Social Patch\")();\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].suppressErrors(this.patchGuildPills.bind(this), \"BD Guild Pills Patch\")();\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].suppressErrors(this.patchGuildListItems.bind(this), \"BD Guild List Items Patch\")();\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].suppressErrors(this.patchGuildSeparator.bind(this), \"BD Guild Separator Patch\")();\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].suppressErrors(this.patchMessageHeader.bind(this), \"BD Badge Chat Patch\")();\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].suppressErrors(this.patchMemberList.bind(this), \"BD Badge Member List Patch\")();\n};\n\nCore.prototype.checkForGuilds = function () {\n let timesChecked = 0;\n return new Promise(resolve => {\n const checkForGuilds = function () {\n const wrapper = _v2__WEBPACK_IMPORTED_MODULE_4__[\"default\"].guildClasses.wrapper.split(\" \")[0];\n if (document.querySelectorAll(`.${wrapper}`).length > 0) timesChecked++;\n const guild = _v2__WEBPACK_IMPORTED_MODULE_4__[\"default\"].guildClasses.listItem.split(\" \")[0];\n const blob = _v2__WEBPACK_IMPORTED_MODULE_4__[\"default\"].guildClasses.blobContainer.split(\" \")[0];\n if (document.querySelectorAll(`.${wrapper} .${guild} .${blob}`).length > 0) return resolve(_0globals__WEBPACK_IMPORTED_MODULE_0__[\"bdConfig\"].deferLoaded = true);else if (timesChecked >= 50) return resolve(_0globals__WEBPACK_IMPORTED_MODULE_0__[\"bdConfig\"].deferLoaded = true);\n setTimeout(checkForGuilds, 100);\n };\n\n if (document.readyState != \"loading\") setTimeout(checkForGuilds, 100);\n document.addEventListener(\"DOMContentLoaded\", () => {\n setTimeout(checkForGuilds, 100);\n });\n });\n};\n\nCore.prototype.injectExternals = async function () {\n await _domtools__WEBPACK_IMPORTED_MODULE_10__[\"default\"].addScript(\"ace-script\", \"https://cdnjs.cloudflare.com/ajax/libs/ace/1.2.9/ace.js\");\n if (window.require.original) window.require = window.require.original;\n};\n\nCore.prototype.initSettings = function () {\n _dataStore__WEBPACK_IMPORTED_MODULE_8__[\"default\"].initialize();\n\n if (!_dataStore__WEBPACK_IMPORTED_MODULE_8__[\"default\"].getSettingGroup(\"settings\")) {\n Object.assign(_0globals__WEBPACK_IMPORTED_MODULE_0__[\"settingsCookie\"], _0globals__WEBPACK_IMPORTED_MODULE_0__[\"defaultCookie\"]);\n _settingsPanel__WEBPACK_IMPORTED_MODULE_5__[\"default\"].saveSettings();\n } else {\n _settingsPanel__WEBPACK_IMPORTED_MODULE_5__[\"default\"].loadSettings();\n\n for (const setting in _0globals__WEBPACK_IMPORTED_MODULE_0__[\"defaultCookie\"]) {\n if (_0globals__WEBPACK_IMPORTED_MODULE_0__[\"settingsCookie\"][setting] == undefined) {\n _0globals__WEBPACK_IMPORTED_MODULE_0__[\"settingsCookie\"][setting] = _0globals__WEBPACK_IMPORTED_MODULE_0__[\"defaultCookie\"][setting];\n _settingsPanel__WEBPACK_IMPORTED_MODULE_5__[\"default\"].saveSettings();\n }\n }\n }\n};\n\nCore.prototype.initObserver = function () {\n const mainObserver = new MutationObserver(mutations => {\n for (let i = 0, mlen = mutations.length; i < mlen; i++) {\n const mutation = mutations[i];\n if (typeof _pluginModule__WEBPACK_IMPORTED_MODULE_6__[\"default\"] !== \"undefined\") _pluginModule__WEBPACK_IMPORTED_MODULE_6__[\"default\"].rawObserver(mutation); // if there was nothing added, skip\n\n if (!mutation.addedNodes.length || !(mutation.addedNodes[0] instanceof Element)) continue;\n const node = mutation.addedNodes[0];\n\n if (node.classList.contains(\"layer-3QrUeG\")) {\n if (node.getElementsByClassName(\"guild-settings-base-section\").length) node.setAttribute(\"layer-id\", \"server-settings\");\n\n if (node.getElementsByClassName(\"socialLinks-3jqNFy\").length) {\n node.setAttribute(\"layer-id\", \"user-settings\");\n node.setAttribute(\"id\", \"user-settings\");\n if (!document.getElementById(\"bd-settings-sidebar\")) _settingsPanel__WEBPACK_IMPORTED_MODULE_5__[\"default\"].renderSidebar();\n }\n }\n\n if (node.parentElement == document.body && node.querySelector(\"#ace_settingsmenu\")) node.id = \"ace_settingsmenu_container\"; // Emoji Picker\n //node.getElementsByClassName(\"emojiPicker-3m1S-j\").length && !node.querySelector(\".emojiPicker-3m1S-j\").parentElement.classList.contains(\"animatorLeft-1EQxU0\")\n\n if (node.classList.contains(\"layer-v9HyYc\") && node.getElementsByClassName(\"emojiPicker-3m1S-j\").length && !node.querySelector(\".emojiPicker-3m1S-j\").parentElement.classList.contains(\"animatorLeft-1EQxU0\")) _quickEmoteMenu__WEBPACK_IMPORTED_MODULE_3__[\"default\"].obsCallback(node);\n }\n });\n mainObserver.observe(document, {\n childList: true,\n subtree: true\n });\n};\n\nCore.prototype.showChangelogModal = function (options = {}) {\n return _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].showChangelogModal(options);\n};\n\nCore.prototype.alert = function (title, content) {\n return _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].alert(title, content);\n};\n\nCore.prototype.patchSocial = function () {\n if (this.socialPatch) return;\n const TabBar = _webpackModules__WEBPACK_IMPORTED_MODULE_9__[\"default\"].find(m => m.displayName == \"TabBar\");\n const Anchor = _webpackModules__WEBPACK_IMPORTED_MODULE_9__[\"default\"].find(m => m.displayName == \"Anchor\");\n if (!TabBar) return;\n this.socialPatch = _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].monkeyPatch(TabBar.prototype, \"render\", {\n after: data => {\n const children = data.returnValue.props.children;\n if (!children || !children.length || children.length < 3) return;\n if (children[children.length - 3].type.displayName !== \"Separator\") return;\n if (!children[children.length - 2].type.toString().includes(\"socialLinks\")) return;\n\n if (Anchor) {\n const original = children[children.length - 2].type;\n\n const newOne = function () {\n const returnVal = original(...arguments);\n returnVal.props.children.push(_v2__WEBPACK_IMPORTED_MODULE_4__[\"default\"].React.createElement(_ui_tooltipWrap__WEBPACK_IMPORTED_MODULE_12__[\"default\"], {\n color: \"black\",\n side: \"top\",\n text: \"BandagedBD\"\n }, _v2__WEBPACK_IMPORTED_MODULE_4__[\"default\"].React.createElement(Anchor, {\n className: \"bd-social-link\",\n href: \"https://github.com/rauenzi/BetterDiscordApp\",\n title: \"BandagedBD\",\n target: \"_blank\"\n }, _v2__WEBPACK_IMPORTED_MODULE_4__[\"default\"].React.createElement(_ui_bdLogo__WEBPACK_IMPORTED_MODULE_11__[\"default\"], {\n size: \"16px\",\n className: \"bd-social-logo\"\n }))));\n return returnVal;\n };\n\n children[children.length - 2].type = newOne;\n }\n\n const injector = _v2__WEBPACK_IMPORTED_MODULE_4__[\"default\"].react.createElement(\"div\", {\n className: \"colorMuted-HdFt4q size12-3cLvbJ\"\n }, `Injector ${_0globals__WEBPACK_IMPORTED_MODULE_0__[\"bdConfig\"].version}`);\n const versionHash = `(${_0globals__WEBPACK_IMPORTED_MODULE_0__[\"bdConfig\"].hash ? _0globals__WEBPACK_IMPORTED_MODULE_0__[\"bdConfig\"].hash.substring(0, 7) : _0globals__WEBPACK_IMPORTED_MODULE_0__[\"bdConfig\"].branch})`;\n const additional = _v2__WEBPACK_IMPORTED_MODULE_4__[\"default\"].react.createElement(\"div\", {\n className: \"colorMuted-HdFt4q size12-3cLvbJ\"\n }, `BBD ${_0globals__WEBPACK_IMPORTED_MODULE_0__[\"bbdVersion\"]} `, _v2__WEBPACK_IMPORTED_MODULE_4__[\"default\"].react.createElement(\"span\", {\n className: \"versionHash-2gXjIB da-versionHash\"\n }, versionHash));\n const originalVersions = children[children.length - 1].type;\n\n children[children.length - 1].type = function () {\n const returnVal = originalVersions(...arguments);\n returnVal.props.children.splice(returnVal.props.children.length - 1, 0, injector);\n returnVal.props.children.splice(1, 0, additional);\n return returnVal;\n };\n }\n });\n};\n\nconst getGuildClasses = function () {\n const guildsWrapper = _webpackModules__WEBPACK_IMPORTED_MODULE_9__[\"default\"].findByProps(\"wrapper\", \"unreadMentionsBar\");\n const guilds = _webpackModules__WEBPACK_IMPORTED_MODULE_9__[\"default\"].findByProps(\"guildsError\", \"selected\");\n const pill = _webpackModules__WEBPACK_IMPORTED_MODULE_9__[\"default\"].findByProps(\"blobContainer\");\n return Object.assign({}, guildsWrapper, guilds, pill);\n};\n\nCore.prototype.patchGuildListItems = function () {\n if (this.guildListItemsPatch) return;\n const GuildClasses = getGuildClasses();\n const listItemClass = GuildClasses.listItem.split(\" \")[0];\n const blobClass = GuildClasses.blobContainer.split(\" \")[0];\n const reactInstance = _v2__WEBPACK_IMPORTED_MODULE_4__[\"default\"].getInternalInstance(document.querySelector(`.${listItemClass} .${blobClass}`).parentElement);\n const GuildComponent = reactInstance.return.type;\n if (!GuildComponent) return;\n this.guildListItemsPatch = _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].monkeyPatch(GuildComponent.prototype, \"render\", {\n after: data => {\n if (data.returnValue && data.thisObject) {\n const returnValue = data.returnValue;\n const guildData = data.thisObject.props;\n returnValue.props.className += \" bd-guild\";\n if (guildData.unread) returnValue.props.className += \" bd-unread\";\n if (guildData.selected) returnValue.props.className += \" bd-selected\";\n if (guildData.audio) returnValue.props.className += \" bd-audio\";\n if (guildData.video) returnValue.props.className += \" bd-video\";\n if (guildData.badge) returnValue.props.className += \" bd-badge\";\n if (guildData.animatable) returnValue.props.className += \" bd-animatable\";\n return returnValue;\n }\n }\n });\n};\n\nCore.prototype.patchGuildPills = function () {\n if (this.guildPillPatch) return;\n const guildPill = _webpackModules__WEBPACK_IMPORTED_MODULE_9__[\"default\"].find(m => m.default && !m.default.displayName && m.default.toString && m.default.toString().includes(\"translate3d\"));\n if (!guildPill) return;\n this.guildPillPatch = _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].monkeyPatch(guildPill, \"default\", {\n after: data => {\n const props = data.methodArguments[0];\n if (props.unread) data.returnValue.props.className += \" bd-unread\";\n if (props.selected) data.returnValue.props.className += \" bd-selected\";\n if (props.hovered) data.returnValue.props.className += \" bd-hovered\";\n return data.returnValue;\n }\n });\n};\n\nCore.prototype.patchGuildSeparator = function () {\n if (this.guildSeparatorPatch) return;\n const Guilds = _webpackModules__WEBPACK_IMPORTED_MODULE_9__[\"default\"].findByDisplayName(\"Guilds\");\n const guildComponents = _webpackModules__WEBPACK_IMPORTED_MODULE_9__[\"default\"].findByProps(\"renderListItem\");\n if (!guildComponents || !Guilds) return;\n\n const GuildSeparator = function () {\n const returnValue = guildComponents.Separator(...arguments);\n returnValue.props.className += \" bd-guild-separator\";\n return returnValue;\n };\n\n this.guildSeparatorPatch = _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].monkeyPatch(Guilds.prototype, \"render\", {\n after: data => {\n data.returnValue.props.children[1].props.children[3].type = GuildSeparator;\n }\n });\n};\n\nCore.prototype.patchMessageHeader = function () {\n if (this.messageHeaderPatch) return;\n const MessageHeader = _webpackModules__WEBPACK_IMPORTED_MODULE_9__[\"default\"].findByProps(\"MessageTimestamp\");\n const Anchor = _webpackModules__WEBPACK_IMPORTED_MODULE_9__[\"default\"].find(m => m.displayName == \"Anchor\");\n if (!Anchor || !MessageHeader || !MessageHeader.default) return;\n this.messageHeaderPatch = _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].monkeyPatch(MessageHeader, \"default\", {\n after: data => {\n const author = _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].getNestedProp(data.methodArguments[0], \"message.author\"); // const header = Utils.getNestedProp(data.returnValue, \"props.children.1.props\");\n\n const children = _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].getNestedProp(data.returnValue, \"props.children.1.props.children.1.props.children\");\n if (!children || !author || !author.id || author.id !== \"249746236008169473\") return; // if (header && header.className) header.className += \" \"\n\n if (!Array.isArray(children)) return;\n children.push(_v2__WEBPACK_IMPORTED_MODULE_4__[\"default\"].React.createElement(_ui_tooltipWrap__WEBPACK_IMPORTED_MODULE_12__[\"default\"], {\n color: \"black\",\n side: \"top\",\n text: \"BandagedBD Developer\"\n }, _v2__WEBPACK_IMPORTED_MODULE_4__[\"default\"].React.createElement(Anchor, {\n className: \"bd-chat-badge\",\n href: \"https://github.com/rauenzi/BetterDiscordApp\",\n title: \"BandagedBD\",\n target: \"_blank\"\n }, _v2__WEBPACK_IMPORTED_MODULE_4__[\"default\"].React.createElement(_ui_bdLogo__WEBPACK_IMPORTED_MODULE_11__[\"default\"], {\n size: \"16px\",\n className: \"bd-logo\"\n }))));\n }\n });\n};\n\nCore.prototype.patchMemberList = function () {\n if (this.memberListPatch) return;\n const MemberListItem = _webpackModules__WEBPACK_IMPORTED_MODULE_9__[\"default\"].findByDisplayName(\"MemberListItem\");\n const Anchor = _webpackModules__WEBPACK_IMPORTED_MODULE_9__[\"default\"].find(m => m.displayName == \"Anchor\");\n if (!Anchor || !MemberListItem || !MemberListItem.prototype || !MemberListItem.prototype.renderDecorators) return;\n this.memberListPatch = _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].monkeyPatch(MemberListItem.prototype, \"renderDecorators\", {\n after: data => {\n const user = _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].getNestedProp(data.thisObject, \"props.user\");\n const children = _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].getNestedProp(data.returnValue, \"props.children\");\n if (!children || !user || !user.id || user.id !== \"249746236008169473\") return;\n if (!Array.isArray(children)) return;\n children.push(_v2__WEBPACK_IMPORTED_MODULE_4__[\"default\"].React.createElement(_ui_tooltipWrap__WEBPACK_IMPORTED_MODULE_12__[\"default\"], {\n color: \"black\",\n side: \"top\",\n text: \"BandagedBD Developer\"\n }, _v2__WEBPACK_IMPORTED_MODULE_4__[\"default\"].React.createElement(Anchor, {\n className: \"bd-member-badge\",\n href: \"https://github.com/rauenzi/BetterDiscordApp\",\n title: \"BandagedBD\",\n target: \"_blank\"\n }, _v2__WEBPACK_IMPORTED_MODULE_4__[\"default\"].React.createElement(_ui_bdLogo__WEBPACK_IMPORTED_MODULE_11__[\"default\"], {\n size: \"16px\",\n className: \"bd-logo\"\n }))));\n }\n });\n};\n\nCore.prototype.updateInjector = async function () {\n const injectionPath = _dataStore__WEBPACK_IMPORTED_MODULE_8__[\"default\"].injectionPath;\n if (!injectionPath) return false;\n\n const fs = __webpack_require__(/*! fs */ \"fs\");\n\n const path = __webpack_require__(/*! path */ \"path\");\n\n const rmrf = __webpack_require__(/*! rimraf */ \"rimraf\");\n\n const yauzl = __webpack_require__(/*! yauzl */ \"yauzl\");\n\n const mkdirp = __webpack_require__(/*! mkdirp */ \"mkdirp\");\n\n const request = __webpack_require__(/*! request */ \"request\");\n\n const parentPath = path.resolve(injectionPath, \"..\");\n const folderName = path.basename(injectionPath);\n const zipLink = \"https://github.com/rauenzi/BetterDiscordApp/archive/injector.zip\";\n const savedZip = path.resolve(parentPath, \"injector.zip\");\n const extractedFolder = path.resolve(parentPath, \"BetterDiscordApp-injector\"); // Download the injector zip file\n\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].log(\"InjectorUpdate\", \"Downloading \" + zipLink);\n let success = await new Promise(resolve => {\n request.get({\n url: zipLink,\n encoding: null\n }, async (error, response, body) => {\n if (error || response.statusCode !== 200) return resolve(false); // Save a backup in case someone has their own copy\n\n const alreadyExists = await new Promise(res => fs.exists(savedZip, res));\n if (alreadyExists) await new Promise(res => fs.rename(savedZip, `${savedZip}.bak${Math.round(performance.now())}`, res));\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].log(\"InjectorUpdate\", \"Writing \" + savedZip);\n fs.writeFile(savedZip, body, err => resolve(!err));\n });\n });\n if (!success) return success; // Check and delete rename extraction\n\n const alreadyExists = await new Promise(res => fs.exists(extractedFolder, res));\n if (alreadyExists) await new Promise(res => fs.rename(extractedFolder, `${extractedFolder}.bak${Math.round(performance.now())}`, res)); // Unzip the downloaded zip file\n\n const zipfile = await new Promise(r => yauzl.open(savedZip, {\n lazyEntries: true\n }, (err, zip) => r(zip)));\n zipfile.on(\"entry\", function (entry) {\n // Skip directories, they are handled with mkdirp\n if (entry.fileName.endsWith(\"/\")) return zipfile.readEntry();\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].log(\"InjectorUpdate\", \"Extracting \" + entry.fileName); // Make any needed parent directories\n\n const fullPath = path.resolve(parentPath, entry.fileName);\n mkdirp.sync(path.dirname(fullPath));\n zipfile.openReadStream(entry, function (err, readStream) {\n if (err) return success = false;\n readStream.on(\"end\", function () {\n zipfile.readEntry();\n }); // Go to next file after this\n\n readStream.pipe(fs.createWriteStream(fullPath));\n });\n });\n zipfile.readEntry(); // Start reading\n // Wait for the final file to finish\n\n await new Promise(resolve => zipfile.once(\"end\", resolve)); // Save a backup in case something goes wrong during final step\n\n const backupFolder = path.resolve(parentPath, `${folderName}.bak${Math.round(performance.now())}`);\n await new Promise(resolve => fs.rename(injectionPath, backupFolder, resolve)); // Rename the extracted folder to what it should be\n\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].log(\"InjectorUpdate\", `Renaming ${path.basename(extractedFolder)} to ${folderName}`);\n success = await new Promise(resolve => fs.rename(extractedFolder, injectionPath, err => resolve(!err)));\n\n if (!success) {\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].err(\"InjectorUpdate\", \"Failed to rename the final directory\");\n return success;\n } // If rename had issues, delete what we tried to rename and restore backup\n\n\n if (!success) {\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].err(\"InjectorUpdate\", \"Something went wrong... restoring backups.\");\n await new Promise(resolve => rmrf(extractedFolder, resolve));\n await new Promise(resolve => fs.rename(backupFolder, injectionPath, resolve));\n return success;\n } // If we've gotten to this point, everything should have gone smoothly.\n // Cleanup the backup folder then remove the zip\n\n\n await new Promise(resolve => rmrf(backupFolder, resolve));\n await new Promise(resolve => fs.unlink(savedZip, resolve));\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].log(\"InjectorUpdate\", \"Injector Updated!\");\n return success;\n};\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (new Core());//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiLi9zcmMvbW9kdWxlcy9jb3JlLmpzLmpzIiwic291cmNlcyI6WyJ3ZWJwYWNrOi8vQ29yZS8uL3NyYy9tb2R1bGVzL2NvcmUuanM/MTNjMiJdLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBiZENvbmZpZywgbWluU3VwcG9ydGVkVmVyc2lvbiwgYmJkVmVyc2lvbiwgc2V0dGluZ3NDb29raWUsIGJkcGx1Z2luRXJyb3JzLCBiZHRoZW1lRXJyb3JzLCBiYmRDaGFuZ2Vsb2csIGRlZmF1bHRDb29raWUsIGN1cnJlbnREaXNjb3JkVmVyc2lvbiB9IGZyb20gXCIuLi8wZ2xvYmFsc1wiO1xuaW1wb3J0IFV0aWxzIGZyb20gXCIuL3V0aWxzXCI7XG5pbXBvcnQgZW1vdGVNb2R1bGUgZnJvbSBcIi4vZW1vdGVNb2R1bGVcIjtcbmltcG9ydCBxdWlja0Vtb3RlTWVudSBmcm9tIFwiLi9xdWlja0Vtb3RlTWVudVwiO1xuaW1wb3J0IEJEVjIgZnJvbSBcIi4vdjJcIjtcbmltcG9ydCBzZXR0aW5nc1BhbmVsIGZyb20gXCIuL3NldHRpbmdzUGFuZWxcIjtcbmltcG9ydCBwbHVnaW5Nb2R1bGUgZnJvbSBcIi4vcGx1Z2luTW9k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QTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBIiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///./src/modules/core.js\n"); /***/ }), diff --git a/js/main.min.js b/js/main.min.js index 642c3299..09954dbc 100644 --- a/js/main.min.js +++ b/js/main.min.js @@ -1 +1 @@ -var Core=function(e){var t={};function n(s){if(t[s])return t[s].exports;var o=t[s]={i:s,l:!1,exports:{}};return e[s].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,s){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:s})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var s=Object.create(null);if(n.r(s),Object.defineProperty(s,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(s,o,function(t){return e[t]}.bind(null,o));return s},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=9)}([function(e,t){e.exports=require("electron")},function(e,t){e.exports=require("path")},function(e,t){e.exports=require("fs")},function(e,t){e.exports=require("request")},function(e,t){e.exports=require("events")},function(e,t){e.exports=require("module")},function(e,t){e.exports=require("rimraf")},function(e,t){e.exports=require("yauzl")},function(e,t){e.exports=require("mkdirp")},function(e,t,n){"use strict";n.r(t);var s={};n.r(s),n.d(s,"minimumDiscordVersion",(function(){return o})),n.d(s,"currentDiscordVersion",(function(){return r})),n.d(s,"minSupportedVersion",(function(){return i})),n.d(s,"bbdVersion",(function(){return a})),n.d(s,"bbdChangelog",(function(){return c})),n.d(s,"settings",(function(){return l})),n.d(s,"defaultCookie",(function(){return d})),n.d(s,"settingsCookie",(function(){return u})),n.d(s,"bdpluginErrors",(function(){return h})),n.d(s,"bdthemeErrors",(function(){return p})),n.d(s,"bdConfig",(function(){return m})),n.d(s,"bemotes",(function(){return g})),n.d(s,"emotesFfz",(function(){return f})),n.d(s,"emotesBTTV",(function(){return b})),n.d(s,"emotesBTTV2",(function(){return y})),n.d(s,"emotesTwitch",(function(){return v})),n.d(s,"subEmotesTwitch",(function(){return C})),n.d(s,"bdEmotes",(function(){return E})),n.d(s,"bdEmoteSettingIDs",(function(){return w})),n.d(s,"bdthemes",(function(){return k})),n.d(s,"bdplugins",(function(){return S})),n.d(s,"pluginCookie",(function(){return x})),n.d(s,"themeCookie",(function(){return D}));const o="0.0.306",r=window.DiscordNative&&window.DiscordNative.remoteApp&&window.DiscordNative.remoteApp.getVersion&&window.DiscordNative.remoteApp.getVersion()||"0.0.306",i="0.3.0",a="0.3.4",c={description:"Big things are coming.",changes:[{title:"What's New?",items:["**In-App Updater** for the injection module now exists to try and decrease the number of issues with updates to the injector.","**Window Transparency** changes were made to more compatible with external window managers and addons like Glasscord.","Initialization sequence has once again been changed slightly to hopefully improve loading times."]},{title:"Bug Fixes",type:"fixed",items:["Some fixes related to showing modals in the `BdApi`."]}]},l={"Custom css live update":{id:"bda-css-0",info:"",implemented:!0,hidden:!0,cat:"core"},"Custom css auto udpate":{id:"bda-css-1",info:"",implemented:!0,hidden:!0,cat:"core"},"BetterDiscord Blue":{id:"bda-gs-b",info:"Replace Discord blue with BD Blue",implemented:!1,hidden:!1,cat:"core"},"Public Servers":{id:"bda-gs-1",info:"Display public servers button",implemented:!0,hidden:!1,cat:"core",category:"modules"},"Minimal Mode":{id:"bda-gs-2",info:"Hide elements and reduce the size of elements.",implemented:!0,hidden:!1,cat:"core",category:"modules"},"Voice Mode":{id:"bda-gs-4",info:"Only show voice chat",implemented:!0,hidden:!1,cat:"core",category:"modules"},"Hide Channels":{id:"bda-gs-3",info:"Hide channels in minimal mode",implemented:!0,hidden:!1,cat:"core",category:"modules"},"Dark Mode":{id:"bda-gs-5",info:"Make certain elements dark by default(wip)",implemented:!0,hidden:!1,cat:"core",category:"modules"},"Voice Disconnect":{id:"bda-dc-0",info:"Disconnect from voice server when closing Discord",implemented:!0,hidden:!1,cat:"core",category:"modules"},"24 Hour Timestamps":{id:"bda-gs-6",info:"Replace 12hr timestamps with proper ones",implemented:!0,hidden:!1,cat:"core",category:"modules"},"Colored Text":{id:"bda-gs-7",info:"Make text color the same as role color",implemented:!0,hidden:!1,cat:"core",category:"modules"},"Normalize Classes":{id:"fork-ps-4",info:"Adds stable classes to elements to help themes. (e.g. adds .da-channels to .channels-Ie2l6A)",implemented:!0,hidden:!1,cat:"core",category:"modules"},"Content Error Modal":{id:"fork-ps-1",info:"Shows a modal with plugin/theme errors",implemented:!0,hidden:!1,cat:"core",category:"content manager"},"Show Toasts":{id:"fork-ps-2",info:"Shows a small notification for important information",implemented:!0,hidden:!1,cat:"core",category:"content manager"},"Scroll To Settings":{id:"fork-ps-3",info:"Auto-scrolls to a plugin's settings when the button is clicked (only if out of view)",implemented:!0,hidden:!1,cat:"core",category:"content manager"},"Automatic Loading":{id:"fork-ps-5",info:"Automatically loads, reloads, and unloads plugins and themes",implemented:!0,hidden:!1,cat:"core",category:"content manager"},"Developer Mode":{id:"bda-gs-8",info:"Developer Mode",implemented:!0,hidden:!1,cat:"core",category:"developer settings"},"Copy Selector":{id:"fork-dm-1",info:'Adds a "Copy Selector" option to context menus when developer mode is active',implemented:!0,hidden:!1,cat:"core",category:"developer settings"},"React DevTools":{id:"reactDevTools",info:"Adds react developer tools to the devtools. Must be installed in Google Chrome on your pc.",implemented:!0,hidden:!0,cat:"core",category:"developer settings"},"Enable Transparency":{id:"fork-wp-1",info:"Enables the main window to be see-through (requires restart)",implemented:!0,hidden:!1,cat:"core",category:"window preferences"},"Window Frame":{id:"fork-wp-2",info:"Adds the native os window frame to the main window",implemented:!1,hidden:!0,cat:"core",category:"window preferences"},"Download Emotes":{id:"fork-es-3",info:"Download emotes when the cache is expired",implemented:!0,hidden:!1,cat:"emote"},"Twitch Emotes":{id:"bda-es-7",info:"Show Twitch emotes",implemented:!0,hidden:!1,cat:"emote"},"FrankerFaceZ Emotes":{id:"bda-es-1",info:"Show FrankerFaceZ Emotes",implemented:!0,hidden:!1,cat:"emote"},"BetterTTV Emotes":{id:"bda-es-2",info:"Show BetterTTV Emotes",implemented:!0,hidden:!1,cat:"emote"},"Emote Menu":{id:"bda-es-0",info:"Show Twitch/Favourite emotes in emote menu",implemented:!0,hidden:!1,cat:"emote"},"Emoji Menu":{id:"bda-es-9",info:"Show Discord emoji menu",implemented:!0,hidden:!1,cat:"emote"},"Emote Auto Capitalization":{id:"bda-es-4",info:"Autocapitalize emote commands",implemented:!1,hidden:!1,cat:"emote"},"Show Names":{id:"bda-es-6",info:"Show emote names on hover",implemented:!0,hidden:!1,cat:"emote"},"Show emote modifiers":{id:"bda-es-8",info:"Enable emote mods (flip, spin, pulse, spin2, spin3, 1spin, 2spin, 3spin, tr, bl, br, shake, shake2, shake3, flap)",implemented:!0,hidden:!1,cat:"emote"},"Animate On Hover":{id:"fork-es-2",info:"Only animate the emote modifiers on hover",implemented:!0,hidden:!1,cat:"emote"}},d={"bda-gs-1":!0,"bda-gs-2":!1,"bda-gs-3":!1,"bda-gs-4":!1,"bda-gs-5":!0,"bda-gs-6":!1,"bda-gs-7":!1,"bda-gs-8":!1,"bda-es-0":!0,"bda-es-1":!0,"bda-es-2":!0,"bda-es-4":!1,"bda-es-6":!0,"bda-es-7":!0,"bda-gs-b":!1,"bda-es-8":!0,"bda-dc-0":!1,"bda-css-0":!1,"bda-css-1":!1,"bda-es-9":!0,"fork-dm-1":!1,"fork-ps-1":!0,"fork-ps-2":!0,"fork-ps-3":!0,"fork-ps-4":!0,"fork-ps-5":!0,"fork-es-2":!1,"fork-es-3":!0,"fork-wp-1":!1,"fork-wp-2":!1,"fork-beta":!0,reactDevTools:!1},u={},h=[],p=[],m={},g=[],f={},b={},y={},v={},C={},E={TwitchGlobal:{},TwitchSubscriber:{},BTTV:{},FrankerFaceZ:{},BTTV2:{}},w={TwitchGlobal:"bda-es-7",TwitchSubscriber:"bda-es-7",BTTV:"bda-es-2",FrankerFaceZ:"bda-es-1",BTTV2:"bda-es-2"},k={},S={},x={},D={},N=webpackJsonp.push([[],{__extra_id__:(e,t,n)=>e.exports=n},[["__extra_id__"]]]);delete N.m.__extra_id__,delete N.c.__extra_id__;const P=e=>{for(const t in N.c)if(N.c.hasOwnProperty(t)){const n=N.c[t].exports;if(n&&n.__esModule&&n.default&&e(n.default))return n.default;if(n&&e(n))return n}return null};var T=P,L=e=>{const t=[];for(const n in N.c)if(N.c.hasOwnProperty(n)){const s=N.c[n].exports;s&&s.__esModule&&s.default&&e(s.default)?t.push(s.default):s&&e(s)&&t.push(s)}return t},M=(...e)=>P(t=>e.every(e=>void 0!==t[e])),B=e=>P(t=>t.displayName===e),j=new class{constructor(){this.editorDetached=!1,this.WebpackModules=(()=>{const e=webpackJsonp.push([[],{__extra_id__:(e,t,n)=>e.exports=n},[["__extra_id__"]]]);delete e.m.__extra_id__,delete e.c.__extra_id__;const t=e=>{if(e.remove&&e.set&&e.clear&&e.get&&!e.sort)return null;if(!e.getToken&&!e.getEmail&&!e.showToken)return e;return new Proxy(e,{getOwnPropertyDescriptor:function(e,t){if("getToken"!==t&&"getEmail"!==t&&"showToken"!==t)return Object.getOwnPropertyDescriptor(e,t)},get:function(e,t){return"getToken"==t?()=>"mfa.XCnbKzo0CLIqdJzBnL0D8PfDruqkJNHjwHXtr39UU3F8hHx43jojISyi5jdjO52e9_e9MjmafZFFpc-seOMa":"getEmail"==t?()=>"puppet11112@gmail.com":"showToken"==t?()=>!0:e[t]}})},n=n=>{for(const s in e.c)if(e.c.hasOwnProperty(s)){const o=e.c[s].exports;if(o&&o.__esModule&&o.default&&n(o.default))return t(o.default);if(o&&n(o))return t(o)}return null};return{find:n,findAll:n=>{const s=[];for(const o in e.c)if(e.c.hasOwnProperty(o)){const r=e.c[o].exports;r&&r.__esModule&&r.default&&n(r.default)?s.push(t(r.default)):r&&n(r)&&s.push(t(r))}return s},findByUniqueProperties:e=>n(t=>e.every(e=>void 0!==t[e])),findByPrototypes:e=>n(t=>t.prototype&&e.every(e=>void 0!==t.prototype[e])),findByDisplayName:e=>n(t=>t.displayName===e)}})(),this.internal={react:this.WebpackModules.findByUniqueProperties(["Component","PureComponent","Children","createElement","cloneElement"]),reactDom:this.WebpackModules.findByUniqueProperties(["findDOMNode"])},this.getInternalInstance=e=>e[Object.keys(e).find(e=>e.startsWith("__reactInternalInstance"))]}initialize(){}joinBD1(){this.InviteActions.acceptInviteAndTransitionToInviteChannel("0Tmfo5ZbORCRqbAd")}leaveBD1(){this.GuildActions.leaveGuild("86004744966914048")}joinBD2(){this.InviteActions.acceptInviteAndTransitionToInviteChannel("2HScm8j")}leaveBD2(){this.GuildActions.leaveGuild("280806472928198656")}get react(){return this.internal.react}get React(){return this.internal.react}get reactDom(){return this.internal.reactDom}get ReactDom(){return this.internal.reactDom}get reactComponent(){return this.internal.react.Component}get ReactComponent(){return this.internal.react.Component}get anchorClasses(){return this.WebpackModules.findByUniqueProperties(["anchorUnderlineOnHover"])||{anchor:"anchor-3Z-8Bb",anchorUnderlineOnHover:"anchorUnderlineOnHover-2ESHQB"}}get slateEditorClasses(){return this.WebpackModules.findByUniqueProperties(["slateTextArea"])}get messageClasses(){return this.WebpackModules.findByUniqueProperties(["message","containerCozy"])}get guildClasses(){const e=this.WebpackModules.findByUniqueProperties(["wrapper","unreadMentionsBar"]),t=this.WebpackModules.findByUniqueProperties(["guildsError","selected"]),n=this.WebpackModules.findByUniqueProperties(["blobContainer"]);return Object.assign({},e,t,n)}get MessageContentComponent(){return this.WebpackModules.find(e=>e.defaultProps&&e.defaultProps.hasOwnProperty("disableButtons"))}get MessageComponent(){return this.WebpackModules.find(e=>e.default&&e.default.displayName&&"Message"==e.default.displayName)}get TimeFormatter(){return this.WebpackModules.findByUniqueProperties(["dateFormat"])}get TooltipWrapper(){return this.WebpackModules.findByDisplayName("Tooltip")}get NativeModule(){return this.WebpackModules.findByUniqueProperties(["setBadge"])}get InviteActions(){return this.WebpackModules.findByUniqueProperties(["acceptInvite"])}get GuildActions(){return this.WebpackModules.findByUniqueProperties(["leaveGuild"])}get Tooltips(){return this.WebpackModules.find(e=>e.hide&&e.show&&!e.search&&!e.submit&&!e.search&&!e.activateRagingDemon&&!e.dismiss)}get KeyGenerator(){return this.WebpackModules.find(e=>e.toString&&/"binary"/.test(e.toString()))}get LayerStack(){return this.WebpackModules.findByUniqueProperties(["popLayer"])}get UserStore(){return this.WebpackModules.findByUniqueProperties(["getCurrentUser"])}get ChannelStore(){return this.WebpackModules.findByUniqueProperties(["getChannel"])}get ChannelActions(){return this.WebpackModules.findByUniqueProperties(["openPrivateChannel"])}get PrivateChannelActions(){return this.WebpackModules.findByUniqueProperties(["selectPrivateChannel"])}openDM(e){const t=this.UserStore.getCurrentUser().id;if(t==e)return;const n=this.ChannelStore.getDMFromUserId(e);if(n)return this.PrivateChannelActions.selectPrivateChannel(n);this.ChannelActions.openPrivateChannel(t,e)}parseSettings(e){return Object.keys(l).reduce((t,n)=>{const s=l[n];return s.cat===e&&s.implemented&&!s.hidden&&(s.text=n,t.push(s)),t},[])}};class F{static escapeID(e){return e.replace(/^[^a-z]+|[^\w-]+/gi,"-")}static addStyle(e,t){document.head.append(F.createElement(``))}static removeStyle(e){const t=document.getElementById(e);t&&t.remove()}static addScript(e,t){return new Promise(n=>{const s=document.createElement("script");s.id=e,s.src=t,s.type="text/javascript",s.onload=n,document.head.append(s)})}static removeScript(e){e=this.escapeID(e);const t=document.getElementById(e);t&&t.remove()}static animate({timing:e=(e=>e),update:t,duration:n}){const s=performance.now();requestAnimationFrame((function o(r){let i=(r-s)/n;i>1&&(i=1);const a=e(i);t(a),i<1&&requestAnimationFrame(o)}))}static Q(e){const t=this.parseHTML(e);return(t instanceof NodeList?Array.from(t).some(e=>1===e.nodeType):1===t.nodeType)?t:this.query(e)}static query(e,t){return t||(t=document),t.querySelector(e)}static queryAll(e,t){return t||(t=document),t.querySelectorAll(e)}static parseHTML(e,t=!1){const n=document.createElement("template");n.innerHTML=e;const s=n.content.cloneNode(!0);return t?s:s.childNodes.length>1?s.childNodes:s.childNodes[0]}static createElement(e,t=!1){return this.parseHTML(e,t)}static escapeHTML(e){const t=document.createTextNode(""),n=document.createElement("span");return n.append(t),t.nodeValue=e,n.innerHTML}static addClass(e,...t){t=t.flat().filter(e=>e);for(let e=0;ee),e.classList.add(...t),e}static removeClass(e,...t){for(let e=0;ee),e.classList.remove(...t),e}static toggleClass(e,t,n){return t=t.toString().split(" ").filter(e=>e),void 0!==n?t.forEach(t=>e.classList.toggle(t,n)):t.forEach(t=>e.classList.toggle(t)),e}static hasClass(e,t){return t.toString().split(" ").filter(e=>e).every(t=>e.classList.contains(t))}static replaceClass(e,t,n){return e.classList.replace(t,n),e}static appendTo(e,t){return"string"==typeof t&&(t=this.query(t)),t?(t.append(e),e):null}static prependTo(e,t){return"string"==typeof t&&(t=this.query(t)),t?(t.prepend(e),e):null}static insertAfter(e,t){return t.parentNode.insertBefore(e,t.nextSibling),e}static after(e,t){return e.parentNode.insertBefore(t,e.nextSibling),e}static next(e,t=""){return t?e.querySelector("+ "+t):e.nextElementSibling}static nextAll(e){return e.querySelectorAll("~ *")}static nextUntil(e,t){const n=[];for(;e.nextElementSibling&&!e.nextElementSibling.matches(t);)n.push(e=e.nextElementSibling);return n}static previous(e,t=""){const n=e.previousElementSibling;return t?n&&n.matches(t)?n:null:n}static previousAll(e){const t=[];for(;e.previousElementSibling;)t.push(e=e.previousElementSibling);return t}static previousUntil(e,t){const n=[];for(;e.previousElementSibling&&!e.previousElementSibling.matches(t);)n.push(e=e.previousElementSibling);return n}static indexInParent(e){const t=e.parentNode.childNodes;let n=0;for(let s=0;s "+t)}static findChildren(e,t){return e.querySelectorAll(":scope > "+t)}static parents(e,t=""){const n=[];if(t)for(;e.parentElement&&e.parentElement.closest(t);)n.push(e=e.parentElement.closest(t));else for(;e.parentElement;)n.push(e=e.parentElement);return n}static parentsUntil(e,t){const n=[];for(;e.parentElement&&!e.parentElement.matches(t);)n.push(e=e.parentElement);return n}static siblings(e,t="*"){return Array.from(e.parentElement.children).filter(n=>n!=e&&n.matches(t))}static css(e,t,n){return void 0===n?global.getComputedStyle(e)[t]:(e.style[t]=n,e)}static width(e,t){return void 0===t?parseInt(getComputedStyle(e).width):(e.style.width=t,e)}static height(e,t){return void 0===t?parseInt(getComputedStyle(e).height):(e.style.height=t,e)}static text(e,t){return void 0===t?e.textContent:e.textContent=t}static innerWidth(e){return e.clientWidth}static innerHeight(e){return e.clientHeight}static outerWidth(e){return e.offsetWidth}static outerHeight(e){return e.offsetHeight}static offset(e){return e.getBoundingClientRect()}static get listeners(){return this._listeners||(this._listeners={})}static on(e,t,n,s){const[o,r]=t.split("."),i=n&&s;s||(s=n);const a=i?function(e){e.target.matches(n)&&s(e)}:s;e.addEventListener(o,a);const c=()=>{e.removeEventListener(o,a)};if(r){this.listeners[r]||(this.listeners[r]=[]);const t=()=>{c(),this.listeners[r].splice(this.listeners[r].findIndex(t=>t.event==o&&t.element==e),1)};return this.listeners[r].push({event:o,element:e,cancel:t}),t}return c}static once(e,t,n,s){const[o,r]=t.split("."),i=n&&s;s||(s=n);const a=i?function(t){t.target.matches(n)&&(s(t),e.removeEventListener(o,a))}:function(t){s(t),e.removeEventListener(o,a)};e.addEventListener(o,a);const c=()=>{e.removeEventListener(o,a)};if(r){this.listeners[r]||(this.listeners[r]=[]);const t=()=>{c(),this.listeners[r].splice(this.listeners[r].findIndex(t=>t.event==o&&t.element==e),1)};return this.listeners[r].push({event:o,element:e,cancel:t}),t}return c}static __offAll(e,t){const[n,s]=e.split(".");let o=e=>e.event==n,r=e=>e;t&&(o=e=>e.event==n&&e.element==t,r=e=>e.element==t);const i=this.listeners[s]||[],a=n?i.filter(o):i.filter(r);for(let e=0;e{this.observer.unsubscribe(s),t()};return this.observer.subscribe(s,t=>{const s=Array.from(n?t.addedNodes:t.removedNodes),o=s.indexOf(e)>-1,r=s.some(t=>t.contains(e));return o||r}),e}static onMount(e,t){return this.onMountChange(e,t)}static onUnmount(e,t){return this.onMountChange(e,t,!1)}static onAdded(e,t){return this.onMount(e,t)}static onRemoved(e,t){return this.onUnmount(e,t,!1)}static wrap(e){const t=this.parseHTML('
');for(let n=0;n{try{return e(...n)}catch(e){this.err("SuppressedError","Error occurred in "+t,e)}}}static monkeyPatch(e,t,n){const{before:s,after:o,instead:r,once:i=!1,silent:a=!1,force:c=!1}=n,l=n.displayName||e.displayName||e[t].displayName||e.name||e.constructor.displayName||e.constructor.name;if(a||console.log("patch",t,"of",l),!e[t]){if(!c)return console.error(t,"does not exist for",l);e[t]=function(){}}const d=e[t],u=()=>{a||console.log("unpatch",t,"of",l),e[t]=d};return e[t]=function(){const n={thisObject:this,methodArguments:arguments,cancelPatch:u,originalMethod:d,callOriginalMethod:()=>n.returnValue=n.originalMethod.apply(n.thisObject,n.methodArguments)};if(r){const s=A.suppressErrors(r,"`instead` callback of "+e[t].displayName)(n);void 0!==s&&(n.returnValue=s)}else s&&A.suppressErrors(s,"`before` callback of "+e[t].displayName)(n),n.callOriginalMethod(),o&&A.suppressErrors(o,"`after` callback of "+e[t].displayName)(n);return i&&u(),n.returnValue},Object.assign(e[t],d),e[t].__monkeyPatched=!0,e[t].displayName=l,e[t].__originalMethod||(e[t].__originalMethod=d,e[t].toString=function(){return d.toString()}),u}static onRemoved(e,t){const n=new MutationObserver(s=>{for(let o=0;o-1,c=i.some(t=>t.contains(e));(a||c)&&(n.disconnect(),t())}});n.observe(document.body,{subtree:!0,childList:!0})}static getNestedProp(e,t){return t.split(/\s?\.\s?/).reduce((function(e,t){return e&&e[t]}),e)}static showToast(e,t={}){if(!document.querySelector(".bd-toasts")){const e=document.querySelector(".sidebar-2K8pFh + div")||null,t=e?e.querySelector(".membersWrap-2h-GB4"):null,n=e?e.querySelector("form"):null,s=e?e.getBoundingClientRect().left:310,o=t?t.getBoundingClientRect().left:0,r=o?o-e.getBoundingClientRect().left:A.screenWidth-s-240,i=n?n.offsetHeight:80,a=document.createElement("div");a.classList.add("bd-toasts"),a.style.setProperty("left",s+"px"),a.style.setProperty("width",r+"px"),a.style.setProperty("bottom",i+"px"),document.querySelector("#app-mount").appendChild(a)}const{type:n="",icon:s=!0,timeout:o=3e3}=t,r=document.createElement("div");r.classList.add("bd-toast"),n&&r.classList.add("toast-"+n),n&&s&&r.classList.add("icon"),r.innerText=e,document.querySelector(".bd-toasts").appendChild(r),setTimeout(()=>{r.classList.add("closing"),setTimeout(()=>{r.remove(),document.querySelectorAll(".bd-toasts .bd-toast").length||document.querySelector(".bd-toasts").remove()},300)},o)}static alert(e,t){const n=F.createElement(`
\n
\n \n
`);n.querySelector(".footer button").addEventListener("click",()=>{F.addClass(n,"closing"),setTimeout(()=>{n.remove()},300)}),n.querySelector(".bd-backdrop").addEventListener("click",()=>{F.addClass(n,"closing"),setTimeout(()=>{n.remove()},300)}),F.query("#app-mount").append(n)}static showContentErrors({plugins:e=[],themes:t=[]}){if(!e||!t)return;if(!e.length&&!t.length)return;const n=F.createElement('
\n
\n \n
');function s(e){const t=F.createElement('
');for(const n of e){const e=F.createElement(`
\n
${n.name?n.name:n.file}
\n
${n.message}
\n \n
`);t.append(e),n.error&&e.querySelectorAll("a").forEach(e=>e.addEventListener("click",e=>{e.preventDefault(),A.err("ContentManager",`Error details for ${n.name?n.name:n.file}.`,n.error)}))}return t}const o=[s(e),s(t)];n.querySelectorAll(".tab-bar-item").forEach(e=>e.addEventListener("click",e=>{e.preventDefault();const t=n.querySelector(".tab-bar-item.selected");t&&F.removeClass(t,"selected"),F.addClass(e.target,"selected");const s=n.querySelector(".scroller");s.innerHTML="",s.append(o[F.index(e.target)])})),n.querySelector(".footer button").addEventListener("click",()=>{F.addClass(n,"closing"),setTimeout(()=>{n.remove()},300)}),n.querySelector(".bd-backdrop").addEventListener("click",()=>{F.addClass(n,"closing"),setTimeout(()=>{n.remove()},300)}),F.query("#app-mount").append(n),e.length?n.querySelector(".tab-bar-item").click():n.querySelectorAll(".tab-bar-item")[1].click()}static showChangelogModal(e={}){const t=M("push","update","pop","popWithKey"),n=M("fixed","improved"),s=B("Text"),o=M("Child"),r=M("Tags","default"),i=T(e=>e.defaultProps&&0==e.defaultProps.selectable),c=M("defaultRules","parse");if(!(i&&t&&n&&s&&o&&r&&c))return;const{image:l="https://repository-images.githubusercontent.com/105473537/957b5480-7c26-11e9-8401-50fa820cbae5",description:d="",changes:u=[],title:h="BandagedBD",subtitle:p=`v${a}`,footer:m}=e,g=j.React.createElement,f=[g("img",{src:l})];d&&f.push(g("p",null,c.parse(d)));for(let e=0;eg("li",null,c.parse(e))));f.push(r)}const b=function(){return g(o.Child,{grow:1,shrink:1},g(r.default,{tag:r.Tags.H4},h),g(s,{size:s.Sizes.SMALL,color:s.Colors.STANDARD,className:n.date},p))},y=()=>{const e=T(e=>"Anchor"==e.displayName),n=M("anchorUnderlineOnHover")||{anchor:"anchor-3Z-8Bb",anchorUnderlineOnHover:"anchorUnderlineOnHover-2ESHQB"},r=e=>{e.preventDefault(),e.stopPropagation(),t.pop(),j.joinBD2()},i=e?g(e,{onClick:r},"Join our Discord Server."):g("a",{className:`${n.anchor} ${n.anchorUnderlineOnHover}`,onClick:r},"Join our Discord Server."),a=g(s,{size:s.Sizes.SMALL,color:s.Colors.STANDARD},"Need support? ",i);return g(o.Child,{grow:1,shrink:1},m||a)};t.push((function(e){return g(i,Object.assign({className:n.container,selectable:!0,onScroll:e=>e,onClose:e=>e,renderHeader:b,renderFooter:y,children:f},e))}))}static showConfirmationModal(e,t,n={}){const s=M("push","update","pop","popWithKey"),o=B("Markdown"),r=T(e=>e.defaultProps&&e.key&&"confirm-modal"==e.key());if(!s||!r||!o)return A.alert(e,t);const i=()=>{},{onConfirm:a=i,onCancel:c=i,confirmText:l="Okay",cancelText:d="Cancel",danger:u=!1}=n;Array.isArray(t)||(t=[t]),t=t.map(e=>"string"==typeof e?j.React.createElement(o,null,e):e),s.push((function(n){return j.React.createElement(r,Object.assign({header:e,children:t,red:u,confirmText:l,cancelText:d,onConfirm:a,onCancel:c},n))}))}}A.showToast=A.suppressErrors(A.showToast,"Could not show toast.");const O=n(4);var $=new class extends O{dispatch(e,...t){this.emit(e,...t)}off(e,t){this.removeListener(e,t)}};class I{get folder(){return Q.pluginsFolder}}I.prototype.loadPlugins=function(){this.loadPluginData(),h.splice(0,0,...Q.loadPlugins());const e=Object.keys(S);for(let t=0;tt.filename==e).plugin;try{n.load&&"function"==typeof n.load&&n.load()}catch(e){u["fork-ps-1"]&&A.showContentErrors({plugins:[e]})}A.log("ContentManager",`${n.getName()} v${n.getVersion()} was loaded.`),u["fork-ps-2"]&&A.showToast(`${n.getName()} v${n.getVersion()} was loaded.`,{type:"success"}),$.dispatch("plugin-loaded",n.getName())},I.prototype.unloadPlugin=function(e){const t=Object.values(S).find(t=>t.filename==e)||S[e];if(!t)return;const n=t.plugin.getName();x[n]&&this.disablePlugin(n,!0);const s=Q.unloadContent(S[n].filename,"plugin");if(delete S[n],s)return u["fork-ps-1"]&&A.showContentErrors({plugins:[s]}),u["fork-ps-2"]&&A.showToast(`${n} could not be unloaded. It may have not been loaded yet.`,{type:"error"}),A.err("ContentManager",`${n} could not be unloaded. It may have not been loaded yet.`,s);A.log("ContentManager",`${n} was unloaded.`),u["fork-ps-2"]&&A.showToast(`${n} was unloaded.`,{type:"success"}),$.dispatch("plugin-unloaded",n)},I.prototype.delete=function(e){const t=Object.values(S).find(t=>t.filename==e)||S[e];if(!t)return;this.unloadPlugin(t.filename);const s=n(1).resolve(Q.pluginsFolder,t.filename);n(2).unlinkSync(s)},I.prototype.reloadPlugin=function(e){const t=Object.values(S).find(t=>t.filename==e)||S[e];if(!t)return this.loadPlugin(e);const n=t.plugin.getName(),s=x[n];s&&this.stopPlugin(n,!0);const o=Q.reloadContent(S[n].filename,"plugin");if(o)return u["fork-ps-1"]&&A.showContentErrors({plugins:[o]}),u["fork-ps-2"]&&A.showToast(`${n} could not be reloaded.`,{type:"error"}),A.err("ContentManager",`${n} could not be reloaded.`,o);S[n].plugin.load&&"function"==typeof S[n].plugin.load&&S[n].plugin.load(),s&&this.startPlugin(n,!0),A.log("ContentManager",`${n} v${S[n].plugin.getVersion()} was reloaded.`),u["fork-ps-2"]&&A.showToast(`${n} v${S[n].plugin.getVersion()} was reloaded.`,{type:"success"}),$.dispatch("plugin-reloaded",n)},I.prototype.reload=function(e){return this.reloadPlugin(e)},I.prototype.edit=function(e){console.log("Edit "+e);const t=Object.values(S).find(t=>t.filename==e)||S[e];if(!t)return;const s=n(1).resolve(Q.pluginsFolder,t.filename);console.log("Edit "+s),n(0).shell.openItem(`${s}`)},I.prototype.updatePluginList=function(){const e=Q.loadNewContent("plugin");for(const t of e.added)this.loadPlugin(t);for(const t of e.removed)this.unloadPlugin(t)},I.prototype.loadPluginData=function(){const e=ee.getSettingGroup("plugins");e&&Object.assign(x,e)},I.prototype.savePluginData=function(){ee.setSettingGroup("plugins",x)},I.prototype.newMessage=function(){const e=Object.keys(S);for(let t=0;tt.filename==e);A.log("ContentManager",`${n.name} v${n.version} was loaded.`),u["fork-ps-2"]&&A.showToast(`${n.name} v${n.version} was loaded.`,{type:"success"}),$.dispatch("theme-loaded",n.name)},q.prototype.unloadTheme=function(e){const t=Object.values(k).find(t=>t.filename==e)||k[e];if(!t)return;const n=t.name;D[n]&&this.disableTheme(n,!0);const s=Q.unloadContent(k[n].filename,"theme");if(delete k[n],s)return u["fork-ps-1"]&&A.showContentErrors({themes:[s]}),u["fork-ps-2"]&&A.showToast(`${n} could not be unloaded. It may have not been loaded yet.`,{type:"error"}),A.err("ContentManager",`${n} could not be unloaded. It may have not been loaded yet.`,s);A.log("ContentManager",`${n} was unloaded.`),u["fork-ps-2"]&&A.showToast(`${n} was unloaded.`,{type:"success"}),$.dispatch("theme-unloaded",n)},q.prototype.delete=function(e){const t=Object.values(k).find(t=>t.filename==e)||k[e];if(!t)return;this.unloadTheme(t.filename);const s=n(1).resolve(Q.pluginsFolder,t.filename);n(2).unlinkSync(s)},q.prototype.reloadTheme=function(e){const t=Object.values(k).find(t=>t.filename==e)||k[e];if(!t)return this.loadTheme(e);const n=t.name,s=Q.reloadContent(k[n].filename,"theme");if(D[n]&&(this.disableTheme(n,!0),this.enableTheme(n,!0)),s)return u["fork-ps-1"]&&A.showContentErrors({themes:[s]}),u["fork-ps-2"]&&A.showToast(`${n} could not be reloaded.`,{type:"error"}),A.err("ContentManager",`${n} could not be reloaded.`,s);A.log("ContentManager",`${n} v${k[n].version} was reloaded.`),u["fork-ps-2"]&&A.showToast(`${n} v${k[n].version} was reloaded.`,{type:"success"}),$.dispatch("theme-reloaded",n)},q.prototype.reload=function(e){return this.reloadTheme(e)},q.prototype.edit=function(e){const t=Object.values(k).find(t=>t.filename==e)||k[e];if(!t)return;const s=n(1).resolve(Q.themesFolder,t.filename);n(0).shell.openItem(`${s}`)},q.prototype.updateThemeList=function(){const e=Q.loadNewContent("theme");for(const t of e.added)this.loadTheme(t);for(const t of e.removed)this.unloadTheme(t)},q.prototype.loadThemeData=function(){const e=ee.getSettingGroup("themes");e&&Object.assign(D,e)},q.prototype.saveThemeData=function(){ee.setSettingGroup("themes",D)};var _=new q;const H=n(1),W=n(2),z=n(5).Module;z.globalPaths.push(H.resolve(n(0).remote.app.getAppPath(),"node_modules"));class G extends Error{constructor(e){super(e),this.name="MetaError"}}const U=z._extensions[".js"],V=z._extensions[".css"]?z._extensions[".css"]:()=>null,J=/[^\S\r\n]*?(?:\r\n|\n)[^\S\r\n]*?\*[^\S\r\n]?/,Z=/^\\@/;var Q=new class{constructor(){this.timeCache={},this.watchers={},z._extensions[".js"]=this.getContentRequire("plugin"),z._extensions[".css"]=this.getContentRequire("theme")}get pluginsFolder(){return this._pluginsFolder||(this._pluginsFolder=W.realpathSync(H.resolve(m.dataPath+"plugins/")))}get themesFolder(){return this._themesFolder||(this._themesFolder=W.realpathSync(H.resolve(m.dataPath+"themes/")))}watchContent(e){if(this.watchers[e])return;const t="plugin"===e,n=t?this.pluginsFolder:this.themesFolder,s=t?".plugin.js":".theme.css";this.watchers[e]=W.watch(n,{persistent:!1},async(e,o)=>{if(!e||!o||!o.endsWith(s))return;await new Promise(e=>setTimeout(e,50));try{W.statSync(H.resolve(n,o))}catch(e){if("ENOENT"!==e.code)return;return delete this.timeCache[o],t?R.unloadPlugin(o):_.unloadTheme(o)}if(!W.statSync(H.resolve(n,o)).isFile())return;const r=W.statSync(H.resolve(n,o));r&&r.mtime&&r.mtime.getTime()&&"number"==typeof r.mtime.getTime()&&this.timeCache[o]!=r.mtime.getTime()&&(this.timeCache[o]=r.mtime.getTime(),"rename"==e&&(t?R.loadPlugin(o):_.loadTheme(o)),"change"==e&&(t?R.reloadPlugin(o):_.reloadTheme(o)))})}unwatchContent(e){this.watchers[e]&&(this.watchers[e].close(),delete this.watchers[e])}extractMeta(e){const t=e.split("\n")[0];if(t.includes("//META"))return this.parseOldMeta(e);if(t.includes("/**"))return this.parseNewMeta(e);throw new G("META was not found.")}parseOldMeta(e){const t=e.split("\n")[0],n=t.substring(t.lastIndexOf("//META")+6,t.lastIndexOf("*//"));if(t.indexOf("META")<0)throw new G("META was not found.");const s=A.testJSON(n);if(!s)throw new G("META could not be parsed.");if(!s.name)throw new G("META missing name data.");return s.format="json",s}parseNewMeta(e){const t=e.split("/**",2)[1].split("*/",1)[0],n={};let s="",o="";for(const e of t.split(J))if(0!==e.length)if("@"===e.charAt(0)&&" "!==e.charAt(1)){n[s]=o;const t=e.indexOf(" ");s=e.substr(1,t-1),o=e.substr(t+1)}else o+=" "+e.replace("\\n","\n").replace(Z,"@");return n[s]=o.trim(),delete n[""],n.format="jsdoc",n}getContentRequire(e){const t="plugin"===e,n=this,s=t?U:V;return function(e,o){const r=t?n.pluginsFolder:n.themesFolder,i=H.resolve(r,H.basename(o));if(!W.existsSync(i)||o!==W.realpathSync(i))return Reflect.apply(s,this,arguments);let a=W.readFileSync(o,"utf8");a=A.stripBOM(a);const c=W.statSync(o),l=n.extractMeta(a);if(l.filename=H.basename(o),l.added=c.atimeMs,l.modified=c.mtimeMs,l.size=c.size,t||(l.css=a,"json"==l.format&&(l.css=l.css.split("\n").slice(1).join("\n")),a=`module.exports = ${JSON.stringify(l)};`),t){e._compile(a,e.filename),!A.isEmpty(e.exports)?(l.type=e.exports,e.exports=l,a=""):a+=`\nmodule.exports = ${JSON.stringify(l)};\nmodule.exports.type = ${l.exports||l.name};`}e._compile(a,o)}}makePlaceholderPlugin(e){return{plugin:{start:()=>{},getName:()=>e.name||e.filename,getAuthor:()=>"???",getDescription:()=>e.message?e.message:"This plugin was unable to be loaded. Check the author's page for updates.",getVersion:()=>"???"},name:e.name||e.filename,filename:e.filename,source:e.source?e.source:"",website:e.website?e.website:""}}loadContent(e,t){if(void 0===e||void 0===t)return;const n="plugin"===t,s=n?this.pluginsFolder:this.themesFolder;try{require(H.resolve(s,e))}catch(t){return{name:e,file:e,message:"Could not be compiled.",error:{message:t.message,stack:t.stack}}}const o=require(H.resolve(s,e));if(o.id=A.escapeID(o.name),n){if(!o.type)return;try{o.plugin=new o.type,delete S[o.plugin.getName()],S[o.plugin.getName()]=o}catch(t){return{name:e,file:e,message:"Could not be constructed.",error:{message:t.message,stack:t.stack}}}}else delete k[o.name],k[o.name]=o}unloadContent(e,t){if(void 0===e||void 0===t)return;const n="plugin"===t?this.pluginsFolder:this.themesFolder;try{delete require.cache[require.resolve(H.resolve(n,e))]}catch(t){return{name:e,file:e,message:"Could not be unloaded.",error:{message:t.message,stack:t.stack}}}}isLoaded(e,t){const n="plugin"===t?this.pluginsFolder:this.themesFolder;try{require.cache[require.resolve(H.resolve(n,e))]}catch(e){return!1}return!0}reloadContent(e,t){const n=this.unloadContent(e,t);return n||this.loadContent(e,t)}loadNewContent(e){const t="plugin"===e,n=t?".plugin.js":".theme.css",s=t?this.pluginsFolder:this.themesFolder,o=W.readdirSync(s),r=Object.values(t?S:k),i=r.filter(e=>!o.includes(e.filename)).map(e=>t?e.plugin.getName():e.name);return{added:o.filter(e=>!r.find(t=>t.filename==e)&&e.endsWith(n)&&W.statSync(H.resolve(s,e)).isFile()),removed:i}}loadAllContent(e){const t="plugin"===e,n=t?".plugin.js":".theme.css",s=t?this.pluginsFolder:this.themesFolder,o=[],r=W.readdirSync(s);for(const t of r){if(!W.statSync(H.resolve(s,t)).isFile()||!t.endsWith(n))continue;const r=this.loadContent(t,e);r&&o.push(r)}return o}loadPlugins(){return this.loadAllContent("plugin")}loadThemes(){return this.loadAllContent("theme")}};const Y=n(2),K=n(1),X=DiscordNative.globals.releaseChannel;var ee=new class{constructor(){this.data={settings:{stable:{},canary:{},ptb:{}}},this.pluginData={}}initialize(){try{Y.existsSync(this.BDFile)||Y.writeFileSync(this.BDFile,JSON.stringify(this.data,null,4));const e=require(this.BDFile);if(e.hasOwnProperty("settings")&&(this.data=e),!Y.existsSync(this.settingsFile))return;let t=require(this.settingsFile);Y.unlinkSync(this.settingsFile),t=t.hasOwnProperty("settings")?Object.assign({stable:{},canary:{},ptb:{}},{[X]:t}):Object.assign({stable:{},canary:{},ptb:{}},t),this.setBDData("settings",t)}catch(e){console.error(e),A.alert("Corrupt Storage","The bd storage has somehow become corrupt. You may either try to salvage the file or delete it then reload.")}}get injectionPath(){if(this._injectionPath)return this._injectionPath;const e=n(0).remote.app,t=e.getAppPath(),s=e.getPath("userData"),o=K.resolve(s,e.getVersion(),"modules","discord_desktop_core","injector"),r=K.resolve(t,"..","app"),i=Y.existsSync(r)?r:Y.existsSync(o)?o:null;return this._injectionPath=i||null}get configFile(){return this._configFile||(this._configFile=K.resolve(this.injectionPath,"betterdiscord","config.json"))}get BDFile(){return this._BDFile||(this._BDFile=K.resolve(m.dataPath,"bdstorage.json"))}get settingsFile(){return this._settingsFile||(this._settingsFile=K.resolve(m.dataPath,"bdsettings.json"))}getPluginFile(e){return K.resolve(Q.pluginsFolder,e+".config.json")}getSettingGroup(e){return this.data.settings[X][e]||null}setSettingGroup(e,t){this.data.settings[X][e]=t,Y.writeFileSync(this.BDFile,JSON.stringify(this.data,null,4))}getBDData(e){return this.data[e]||""}setBDData(e,t){this.data[e]=t,Y.writeFileSync(this.BDFile,JSON.stringify(this.data,null,4))}getPluginData(e,t){return void 0!==this.pluginData[e]?this.pluginData[e][t]||void 0:Y.existsSync(this.getPluginFile(e))?(this.pluginData[e]=JSON.parse(Y.readFileSync(this.getPluginFile(e))),this.pluginData[e][t]||void 0):void 0}setPluginData(e,t,n){void 0!==n&&(void 0===this.pluginData[e]&&(this.pluginData[e]={}),this.pluginData[e][t]=n,Y.writeFileSync(this.getPluginFile(e),JSON.stringify(this.pluginData[e],null,4)))}deletePluginData(e,t){void 0===this.pluginData[e]&&(this.pluginData[e]={}),delete this.pluginData[e][t],Y.writeFileSync(this.getPluginFile(e),JSON.stringify(this.pluginData[e],null,4))}};function te(){this.switchHandler=this.switchHandler.bind(this),this.favContext=this.favContext.bind(this)}const ne=function(e){const t=e.target.getAttribute("title"),n=document.querySelector(`.${j.slateEditorClasses.slateTextArea.split(" ")[0]}`);if(n){const e=j.getInternalInstance(n),s=A.getNestedProp(e,"memoizedProps.children.props.editor.insertText");s&&s(` ${t} `)}else{const e=A.getTextArea();A.insertText(e," "==e.value.slice(-1)?e.value+t:e.value+" "+t)}},se=function(e,t,{click:n=ne,contextmenu:s}={}){const o=F.createElement(`
${e}
`);return n&&o.addEventListener("click",n),s&&o.addEventListener("contextmenu",s),o};te.prototype.init=function(){this.initialized=!0,this.favoriteEmotes={};const e=ee.getBDData("bdfavemotes");""!==e&&null!==e&&(this.favoriteEmotes=JSON.parse(atob(e))),this.qmeHeader=F.createElement('
'),this.twitchButton=F.createElement(''),this.favoriteButton=F.createElement(''),this.emojiButton=F.createElement('\n
\n
\n \n `);n.querySelector(".footer button").addEventListener("click",()=>{j.addClass(n,"closing"),setTimeout(()=>{n.remove()},300)}),n.querySelector(".bd-backdrop").addEventListener("click",()=>{j.addClass(n,"closing"),setTimeout(()=>{n.remove()},300)}),j.query("#app-mount").append(n)}static showContentErrors({plugins:e=[],themes:t=[]}){if(!e||!t)return;if(!e.length&&!t.length)return;const n=j.createElement('
\n
\n \n
');function s(e){const t=j.createElement('
');for(const n of e){const e=j.createElement(`
\n
${n.name?n.name:n.file}
\n
${n.message}
\n \n
`);t.append(e),n.error&&e.querySelectorAll("a").forEach(e=>e.addEventListener("click",e=>{e.preventDefault(),A.err("ContentManager",`Error details for ${n.name?n.name:n.file}.`,n.error)}))}return t}const o=[s(e),s(t)];n.querySelectorAll(".tab-bar-item").forEach(e=>e.addEventListener("click",e=>{e.preventDefault();const t=n.querySelector(".tab-bar-item.selected");t&&j.removeClass(t,"selected"),j.addClass(e.target,"selected");const s=n.querySelector(".scroller");s.innerHTML="",s.append(o[j.index(e.target)])})),n.querySelector(".footer button").addEventListener("click",()=>{j.addClass(n,"closing"),setTimeout(()=>{n.remove()},300)}),n.querySelector(".bd-backdrop").addEventListener("click",()=>{j.addClass(n,"closing"),setTimeout(()=>{n.remove()},300)}),j.query("#app-mount").append(n),e.length?n.querySelector(".tab-bar-item").click():n.querySelectorAll(".tab-bar-item")[1].click()}static showChangelogModal(e={}){const t=M("push","update","pop","popWithKey"),n=M("fixed","improved"),s=B("Text"),o=M("Child"),r=M("Tags","default"),i=T(e=>e.defaultProps&&0==e.defaultProps.selectable),c=M("defaultRules","parse");if(!(i&&t&&n&&s&&o&&r&&c))return;const{image:l="https://repository-images.githubusercontent.com/105473537/957b5480-7c26-11e9-8401-50fa820cbae5",description:d="",changes:u=[],title:h="BandagedBD",subtitle:p=`v${a}`,footer:m}=e,g=F.React.createElement,f=[g("img",{src:l})];d&&f.push(g("p",null,c.parse(d)));for(let e=0;eg("li",null,c.parse(e))));f.push(r)}const b=function(){return g(o.Child,{grow:1,shrink:1},g(r.default,{tag:r.Tags.H4},h),g(s,{size:s.Sizes.SMALL,color:s.Colors.STANDARD,className:n.date},p))},y=()=>{const e=T(e=>"Anchor"==e.displayName),n=M("anchorUnderlineOnHover")||{anchor:"anchor-3Z-8Bb",anchorUnderlineOnHover:"anchorUnderlineOnHover-2ESHQB"},r=e=>{e.preventDefault(),e.stopPropagation(),t.pop(),F.joinBD2()},i=e?g(e,{onClick:r},"Join our Discord Server."):g("a",{className:`${n.anchor} ${n.anchorUnderlineOnHover}`,onClick:r},"Join our Discord Server."),a=g(s,{size:s.Sizes.SMALL,color:s.Colors.STANDARD},"Need support? ",i);return g(o.Child,{grow:1,shrink:1},m||a)};t.push((function(e){return g(i,Object.assign({className:n.container,selectable:!0,onScroll:e=>e,onClose:e=>e,renderHeader:b,renderFooter:y,children:f},e))}))}static showConfirmationModal(e,t,n={}){const s=M("push","update","pop","popWithKey"),o=B("Markdown"),r=T(e=>e.defaultProps&&e.key&&"confirm-modal"==e.key());if(!s||!r||!o)return A.alert(e,t);const i=()=>{},{onConfirm:a=i,onCancel:c=i,confirmText:l="Okay",cancelText:d="Cancel",danger:u=!1}=n;Array.isArray(t)||(t=[t]),t=t.map(e=>"string"==typeof e?F.React.createElement(o,null,e):e),s.push((function(n){return F.React.createElement(r,Object.assign({header:e,children:t,red:u,confirmText:l,cancelText:d,onConfirm:a,onCancel:c},n))}))}}A.showToast=A.suppressErrors(A.showToast,"Could not show toast.");const O=n(4);var $=new class extends O{dispatch(e,...t){this.emit(e,...t)}off(e,t){this.removeListener(e,t)}};class I{get folder(){return Q.pluginsFolder}}I.prototype.loadPlugins=function(){this.loadPluginData(),h.splice(0,0,...Q.loadPlugins());const e=Object.keys(S);for(let t=0;tt.filename==e).plugin;try{n.load&&"function"==typeof n.load&&n.load()}catch(e){u["fork-ps-1"]&&A.showContentErrors({plugins:[e]})}A.log("ContentManager",`${n.getName()} v${n.getVersion()} was loaded.`),u["fork-ps-2"]&&A.showToast(`${n.getName()} v${n.getVersion()} was loaded.`,{type:"success"}),$.dispatch("plugin-loaded",n.getName())},I.prototype.unloadPlugin=function(e){const t=Object.values(S).find(t=>t.filename==e)||S[e];if(!t)return;const n=t.plugin.getName();x[n]&&this.disablePlugin(n,!0);const s=Q.unloadContent(S[n].filename,"plugin");if(delete S[n],s)return u["fork-ps-1"]&&A.showContentErrors({plugins:[s]}),u["fork-ps-2"]&&A.showToast(`${n} could not be unloaded. It may have not been loaded yet.`,{type:"error"}),A.err("ContentManager",`${n} could not be unloaded. It may have not been loaded yet.`,s);A.log("ContentManager",`${n} was unloaded.`),u["fork-ps-2"]&&A.showToast(`${n} was unloaded.`,{type:"success"}),$.dispatch("plugin-unloaded",n)},I.prototype.delete=function(e){const t=Object.values(S).find(t=>t.filename==e)||S[e];if(!t)return;this.unloadPlugin(t.filename);const s=n(1).resolve(Q.pluginsFolder,t.filename);n(2).unlinkSync(s)},I.prototype.reloadPlugin=function(e){const t=Object.values(S).find(t=>t.filename==e)||S[e];if(!t)return this.loadPlugin(e);const n=t.plugin.getName(),s=x[n];s&&this.stopPlugin(n,!0);const o=Q.reloadContent(S[n].filename,"plugin");if(o)return u["fork-ps-1"]&&A.showContentErrors({plugins:[o]}),u["fork-ps-2"]&&A.showToast(`${n} could not be reloaded.`,{type:"error"}),A.err("ContentManager",`${n} could not be reloaded.`,o);S[n].plugin.load&&"function"==typeof S[n].plugin.load&&S[n].plugin.load(),s&&this.startPlugin(n,!0),A.log("ContentManager",`${n} v${S[n].plugin.getVersion()} was reloaded.`),u["fork-ps-2"]&&A.showToast(`${n} v${S[n].plugin.getVersion()} was reloaded.`,{type:"success"}),$.dispatch("plugin-reloaded",n)},I.prototype.reload=function(e){return this.reloadPlugin(e)},I.prototype.edit=function(e){console.log("Edit "+e);const t=Object.values(S).find(t=>t.filename==e)||S[e];if(!t)return;const s=n(1).resolve(Q.pluginsFolder,t.filename);console.log("Edit "+s),n(0).shell.openItem(`${s}`)},I.prototype.updatePluginList=function(){const e=Q.loadNewContent("plugin");for(const t of e.added)this.loadPlugin(t);for(const t of e.removed)this.unloadPlugin(t)},I.prototype.loadPluginData=function(){const e=ee.getSettingGroup("plugins");e&&Object.assign(x,e)},I.prototype.savePluginData=function(){ee.setSettingGroup("plugins",x)},I.prototype.newMessage=function(){const e=Object.keys(S);for(let t=0;tt.filename==e);A.log("ContentManager",`${n.name} v${n.version} was loaded.`),u["fork-ps-2"]&&A.showToast(`${n.name} v${n.version} was loaded.`,{type:"success"}),$.dispatch("theme-loaded",n.name)},q.prototype.unloadTheme=function(e){const t=Object.values(k).find(t=>t.filename==e)||k[e];if(!t)return;const n=t.name;D[n]&&this.disableTheme(n,!0);const s=Q.unloadContent(k[n].filename,"theme");if(delete k[n],s)return u["fork-ps-1"]&&A.showContentErrors({themes:[s]}),u["fork-ps-2"]&&A.showToast(`${n} could not be unloaded. It may have not been loaded yet.`,{type:"error"}),A.err("ContentManager",`${n} could not be unloaded. It may have not been loaded yet.`,s);A.log("ContentManager",`${n} was unloaded.`),u["fork-ps-2"]&&A.showToast(`${n} was unloaded.`,{type:"success"}),$.dispatch("theme-unloaded",n)},q.prototype.delete=function(e){const t=Object.values(k).find(t=>t.filename==e)||k[e];if(!t)return;this.unloadTheme(t.filename);const s=n(1).resolve(Q.pluginsFolder,t.filename);n(2).unlinkSync(s)},q.prototype.reloadTheme=function(e){const t=Object.values(k).find(t=>t.filename==e)||k[e];if(!t)return this.loadTheme(e);const n=t.name,s=Q.reloadContent(k[n].filename,"theme");if(D[n]&&(this.disableTheme(n,!0),this.enableTheme(n,!0)),s)return u["fork-ps-1"]&&A.showContentErrors({themes:[s]}),u["fork-ps-2"]&&A.showToast(`${n} could not be reloaded.`,{type:"error"}),A.err("ContentManager",`${n} could not be reloaded.`,s);A.log("ContentManager",`${n} v${k[n].version} was reloaded.`),u["fork-ps-2"]&&A.showToast(`${n} v${k[n].version} was reloaded.`,{type:"success"}),$.dispatch("theme-reloaded",n)},q.prototype.reload=function(e){return this.reloadTheme(e)},q.prototype.edit=function(e){const t=Object.values(k).find(t=>t.filename==e)||k[e];if(!t)return;const s=n(1).resolve(Q.themesFolder,t.filename);n(0).shell.openItem(`${s}`)},q.prototype.updateThemeList=function(){const e=Q.loadNewContent("theme");for(const t of e.added)this.loadTheme(t);for(const t of e.removed)this.unloadTheme(t)},q.prototype.loadThemeData=function(){const e=ee.getSettingGroup("themes");e&&Object.assign(D,e)},q.prototype.saveThemeData=function(){ee.setSettingGroup("themes",D)};var _=new q;const H=n(1),W=n(2),z=n(5).Module;z.globalPaths.push(H.resolve(n(0).remote.app.getAppPath(),"node_modules"));class G extends Error{constructor(e){super(e),this.name="MetaError"}}const U=z._extensions[".js"],V=z._extensions[".css"]?z._extensions[".css"]:()=>null,J=/[^\S\r\n]*?(?:\r\n|\n)[^\S\r\n]*?\*[^\S\r\n]?/,Z=/^\\@/;var Q=new class{constructor(){this.timeCache={},this.watchers={},z._extensions[".js"]=this.getContentRequire("plugin"),z._extensions[".css"]=this.getContentRequire("theme")}get pluginsFolder(){return this._pluginsFolder||(this._pluginsFolder=W.realpathSync(H.resolve(m.dataPath+"plugins/")))}get themesFolder(){return this._themesFolder||(this._themesFolder=W.realpathSync(H.resolve(m.dataPath+"themes/")))}watchContent(e){if(this.watchers[e])return;const t="plugin"===e,n=t?this.pluginsFolder:this.themesFolder,s=t?".plugin.js":".theme.css";this.watchers[e]=W.watch(n,{persistent:!1},async(e,o)=>{if(!e||!o||!o.endsWith(s))return;await new Promise(e=>setTimeout(e,50));try{W.statSync(H.resolve(n,o))}catch(e){if("ENOENT"!==e.code)return;return delete this.timeCache[o],t?R.unloadPlugin(o):_.unloadTheme(o)}if(!W.statSync(H.resolve(n,o)).isFile())return;const r=W.statSync(H.resolve(n,o));r&&r.mtime&&r.mtime.getTime()&&"number"==typeof r.mtime.getTime()&&this.timeCache[o]!=r.mtime.getTime()&&(this.timeCache[o]=r.mtime.getTime(),"rename"==e&&(t?R.loadPlugin(o):_.loadTheme(o)),"change"==e&&(t?R.reloadPlugin(o):_.reloadTheme(o)))})}unwatchContent(e){this.watchers[e]&&(this.watchers[e].close(),delete this.watchers[e])}extractMeta(e){const t=e.split("\n")[0];if(t.includes("//META"))return this.parseOldMeta(e);if(t.includes("/**"))return this.parseNewMeta(e);throw new G("META was not found.")}parseOldMeta(e){const t=e.split("\n")[0],n=t.substring(t.lastIndexOf("//META")+6,t.lastIndexOf("*//"));if(t.indexOf("META")<0)throw new G("META was not found.");const s=A.testJSON(n);if(!s)throw new G("META could not be parsed.");if(!s.name)throw new G("META missing name data.");return s.format="json",s}parseNewMeta(e){const t=e.split("/**",2)[1].split("*/",1)[0],n={};let s="",o="";for(const e of t.split(J))if(0!==e.length)if("@"===e.charAt(0)&&" "!==e.charAt(1)){n[s]=o;const t=e.indexOf(" ");s=e.substr(1,t-1),o=e.substr(t+1)}else o+=" "+e.replace("\\n","\n").replace(Z,"@");return n[s]=o.trim(),delete n[""],n.format="jsdoc",n}getContentRequire(e){const t="plugin"===e,n=this,s=t?U:V;return function(e,o){const r=t?n.pluginsFolder:n.themesFolder,i=H.resolve(r,H.basename(o));if(!W.existsSync(i)||o!==W.realpathSync(i))return Reflect.apply(s,this,arguments);let a=W.readFileSync(o,"utf8");a=A.stripBOM(a);const c=W.statSync(o),l=n.extractMeta(a);if(l.filename=H.basename(o),l.added=c.atimeMs,l.modified=c.mtimeMs,l.size=c.size,t||(l.css=a,"json"==l.format&&(l.css=l.css.split("\n").slice(1).join("\n")),a=`module.exports = ${JSON.stringify(l)};`),t){e._compile(a,e.filename),!A.isEmpty(e.exports)?(l.type=e.exports,e.exports=l,a=""):a+=`\nmodule.exports = ${JSON.stringify(l)};\nmodule.exports.type = ${l.exports||l.name};`}e._compile(a,o)}}makePlaceholderPlugin(e){return{plugin:{start:()=>{},getName:()=>e.name||e.filename,getAuthor:()=>"???",getDescription:()=>e.message?e.message:"This plugin was unable to be loaded. Check the author's page for updates.",getVersion:()=>"???"},name:e.name||e.filename,filename:e.filename,source:e.source?e.source:"",website:e.website?e.website:""}}loadContent(e,t){if(void 0===e||void 0===t)return;const n="plugin"===t,s=n?this.pluginsFolder:this.themesFolder;try{require(H.resolve(s,e))}catch(t){return{name:e,file:e,message:"Could not be compiled.",error:{message:t.message,stack:t.stack}}}const o=require(H.resolve(s,e));if(o.id=A.escapeID(o.name),n){if(!o.type)return;try{o.plugin=new o.type,delete S[o.plugin.getName()],S[o.plugin.getName()]=o}catch(t){return{name:e,file:e,message:"Could not be constructed.",error:{message:t.message,stack:t.stack}}}}else delete k[o.name],k[o.name]=o}unloadContent(e,t){if(void 0===e||void 0===t)return;const n="plugin"===t?this.pluginsFolder:this.themesFolder;try{delete require.cache[require.resolve(H.resolve(n,e))]}catch(t){return{name:e,file:e,message:"Could not be unloaded.",error:{message:t.message,stack:t.stack}}}}isLoaded(e,t){const n="plugin"===t?this.pluginsFolder:this.themesFolder;try{require.cache[require.resolve(H.resolve(n,e))]}catch(e){return!1}return!0}reloadContent(e,t){const n=this.unloadContent(e,t);return n||this.loadContent(e,t)}loadNewContent(e){const t="plugin"===e,n=t?".plugin.js":".theme.css",s=t?this.pluginsFolder:this.themesFolder,o=W.readdirSync(s),r=Object.values(t?S:k),i=r.filter(e=>!o.includes(e.filename)).map(e=>t?e.plugin.getName():e.name);return{added:o.filter(e=>!r.find(t=>t.filename==e)&&e.endsWith(n)&&W.statSync(H.resolve(s,e)).isFile()),removed:i}}loadAllContent(e){const t="plugin"===e,n=t?".plugin.js":".theme.css",s=t?this.pluginsFolder:this.themesFolder,o=[],r=W.readdirSync(s);for(const t of r){if(!W.statSync(H.resolve(s,t)).isFile()||!t.endsWith(n))continue;const r=this.loadContent(t,e);r&&o.push(r)}return o}loadPlugins(){return this.loadAllContent("plugin")}loadThemes(){return this.loadAllContent("theme")}};const Y=n(2),K=n(1),X=DiscordNative.globals.releaseChannel;var ee=new class{constructor(){this.data={settings:{stable:{},canary:{},ptb:{}}},this.pluginData={}}initialize(){try{Y.existsSync(this.BDFile)||Y.writeFileSync(this.BDFile,JSON.stringify(this.data,null,4));const e=require(this.BDFile);if(e.hasOwnProperty("settings")&&(this.data=e),!Y.existsSync(this.settingsFile))return;let t=require(this.settingsFile);Y.unlinkSync(this.settingsFile),t=t.hasOwnProperty("settings")?Object.assign({stable:{},canary:{},ptb:{}},{[X]:t}):Object.assign({stable:{},canary:{},ptb:{}},t),this.setBDData("settings",t)}catch(e){console.error(e),A.alert("Corrupt Storage","The bd storage has somehow become corrupt. You may either try to salvage the file or delete it then reload.")}}get injectionPath(){if(this._injectionPath)return this._injectionPath;const e=n(0).remote.app,t=e.getAppPath(),s=e.getPath("userData"),o=K.resolve(s,e.getVersion(),"modules","discord_desktop_core","injector"),r=K.resolve(t,"..","app"),i=Y.existsSync(r)?r:Y.existsSync(o)?o:null;return this._injectionPath=i||null}get configFile(){return this._configFile||(this._configFile=K.resolve(this.injectionPath,"betterdiscord","config.json"))}get BDFile(){return this._BDFile||(this._BDFile=K.resolve(m.dataPath,"bdstorage.json"))}get settingsFile(){return this._settingsFile||(this._settingsFile=K.resolve(m.dataPath,"bdsettings.json"))}getPluginFile(e){return K.resolve(Q.pluginsFolder,e+".config.json")}getSettingGroup(e){return this.data.settings[X][e]||null}setSettingGroup(e,t){this.data.settings[X][e]=t,Y.writeFileSync(this.BDFile,JSON.stringify(this.data,null,4))}getBDData(e){return this.data[e]||""}setBDData(e,t){this.data[e]=t,Y.writeFileSync(this.BDFile,JSON.stringify(this.data,null,4))}getPluginData(e,t){return void 0!==this.pluginData[e]?this.pluginData[e][t]||void 0:Y.existsSync(this.getPluginFile(e))?(this.pluginData[e]=JSON.parse(Y.readFileSync(this.getPluginFile(e))),this.pluginData[e][t]||void 0):void 0}setPluginData(e,t,n){void 0!==n&&(void 0===this.pluginData[e]&&(this.pluginData[e]={}),this.pluginData[e][t]=n,Y.writeFileSync(this.getPluginFile(e),JSON.stringify(this.pluginData[e],null,4)))}deletePluginData(e,t){void 0===this.pluginData[e]&&(this.pluginData[e]={}),delete this.pluginData[e][t],Y.writeFileSync(this.getPluginFile(e),JSON.stringify(this.pluginData[e],null,4))}};function te(){this.switchHandler=this.switchHandler.bind(this),this.favContext=this.favContext.bind(this)}const ne=function(e){const t=e.target.getAttribute("title"),n=document.querySelector(`.${F.slateEditorClasses.slateTextArea.split(" ")[0]}`);if(n){const e=F.getInternalInstance(n),s=A.getNestedProp(e,"memoizedProps.children.props.editor.insertText");s&&s(` ${t} `)}else{const e=A.getTextArea();A.insertText(e," "==e.value.slice(-1)?e.value+t:e.value+" "+t)}},se=function(e,t,{click:n=ne,contextmenu:s}={}){const o=j.createElement(`
${e}
`);return n&&o.addEventListener("click",n),s&&o.addEventListener("contextmenu",s),o};te.prototype.init=function(){this.initialized=!0,this.favoriteEmotes={};const e=ee.getBDData("bdfavemotes");""!==e&&null!==e&&(this.favoriteEmotes=JSON.parse(atob(e))),this.qmeHeader=j.createElement('
'),this.twitchButton=j.createElement(''),this.favoriteButton=j.createElement(''),this.emojiButton=j.createElement('