var Core=function(e){var t={};function s(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,s),o.l=!0,o.exports}return s.m=e,s.c=t,s.d=function(e,t,n){s.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},s.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},s.t=function(e,t){if(1&t&&(e=s(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(s.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)s.d(n,o,function(t){return e[t]}.bind(null,o));return n},s.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return s.d(t,"a",t),t},s.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},s.p="",s(s.s=6)}([function(e,t){e.exports=require("fs")},function(e,t){e.exports=require("electron")},function(e,t){e.exports=require("path")},function(e,t){e.exports=require("module")},function(e,t){e.exports=require("events")},function(e,t){e.exports=require("request")},function(e,t,s){"use strict";s.r(t);var n={};s.r(n),s.d(n,"Menu",function(){return ke}),s.d(n,"Card",function(){return Ee}),s.d(n,"Layer",function(){return Se});var o={"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"},"Coloured Text":{id:"bda-gs-7",info:"Make text colour the same as role colour",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"},"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:!0,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"}},r={"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},i={local:!1,localServer:"//localhost:8080",minified:!0,version:"0.3.0",branch:"master",repo:"rauenzi",minSupportedVersion:"0.3.0",bbdVersion:"0.2.17"},a={},l={},c={},d={},u={TwitchGlobal:{},TwitchSubscriber:{},BTTV:{},FrankerFaceZ:{},BTTV2:{}},p=[];class h{static get screenWidth(){return Math.max(document.documentElement.clientWidth,window.innerWidth||0)}static get screenHeight(){return Math.max(document.documentElement.clientHeight,window.innerHeight||0)}static stripBOM(e){return 65279===e.charCodeAt(0)&&(e=e.slice(1)),e}static getTextArea(){return $(".channelTextArea-1LDbYG textarea")}static getInternalInstance(e){return e[Object.keys(e).find(e=>e.startsWith("__reactInternalInstance"))]||null}static insertText(e,t){e.focus(),e.selectionStart=0,e.selectionEnd=e.value.length,document.execCommand("insertText",!1,t)}static injectCss(e){$("",{type:"text/css",rel:"stylesheet",href:e}).appendTo($("head"))}static injectJs(e){return new Promise(t=>{$("",{type:"text/javascript",src:e,onload:t}).appendTo($("body"))})}static escapeID(e){return e.replace(/^[^a-z]+|[^\w-]+/gi,"")}static log(e,t){console.log(`%c[BandagedBD]%c [${e}]%c ${t}`,"color: #3a71c1; font-weight: 700;","color: #3a71c1;","")}static warn(e,t){console.warn(`%c[BandagedBD]%c [${e}]%c ${t}`,"color: #E8A400; font-weight: 700;","color: #E8A400;","")}static err(e,t,s){console.log(`%c[BandagedBD]%c [${e}]%c ${t}`,"color: red; font-weight: 700;","color: red;",""),s&&(console.groupCollapsed("%cError: "+s.message,"color: red;"),console.error(s.stack),console.groupEnd())}static escape(e){return e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}static testJSON(e){try{return JSON.parse(e),!0}catch(e){return!1}}static suppressErrors(e,t){return(...s)=>{try{return e(...s)}catch(e){this.err("SuppressedError","Error occurred in "+t,e)}}}static monkeyPatch(e,t,s){const{before:n,after:o,instead:r,once:i=!1,silent:a=!1,force:l=!1}=s,c=s.displayName||e.displayName||e.name||e.constructor.displayName||e.constructor.name;if(a||console.log("patch",t,"of",c),!e[t]){if(!l)return console.error(t,"does not exist for",c);e[t]=function(){}}const d=e[t],u=()=>{a||console.log("unpatch",t,"of",c),e[t]=d};return e[t]=function(){const s={thisObject:this,methodArguments:arguments,cancelPatch:u,originalMethod:d,callOriginalMethod:()=>s.returnValue=s.originalMethod.apply(s.thisObject,s.methodArguments)};if(r){const n=h.suppressErrors(r,"`instead` callback of "+e[t].displayName)(s);void 0!==n&&(s.returnValue=n)}else n&&h.suppressErrors(n,"`before` callback of "+e[t].displayName)(s),s.callOriginalMethod(),o&&h.suppressErrors(o,"`after` callback of "+e[t].displayName)(s);return i&&u(),s.returnValue},e[t].__monkeyPatched=!0,e[t].__originalMethod||(e[t].__originalMethod=d),e[t].displayName="patched "+(e[t].displayName||t),u}static onRemoved(e,t){const s=new MutationObserver(n=>{for(let o=0;o-1,l=i.some(t=>t.contains(e));(a||l)&&(s.disconnect(),t())}});s.observe(document.body,{subtree:!0,childList:!0})}static memoizeObject(e){const t=new Proxy(e,{get:function(e,t){if(e.hasOwnProperty(t)){if(Object.getOwnPropertyDescriptor(e,t).get){const s=e[t];delete e[t],e[t]=s}return e[t]}},set:function(e,t,s){return e.hasOwnProperty(t)?this.err("MemoizedObject","Trying to overwrite existing property"):(e[t]=s,e[t])}});return Object.defineProperty(t,"hasOwnProperty",{value:function(e){return void 0!==this[e]}}),t}}const m=h.memoizeObject({get React(){return f.getByProps("createElement","cloneElement")},get ReactDOM(){return f.getByProps("render","findDOMNode")},get Flux(){return f.getByProps("connectStores")},get Events(){return f.getByPrototypes("setMaxListeners","emit")},get GuildStore(){return f.getByProps("getGuild")},get SortedGuildStore(){return f.getByProps("getSortedGuilds")},get SelectedGuildStore(){return f.getByProps("getLastSelectedGuildId")},get GuildSync(){return f.getByProps("getSyncedGuilds")},get GuildInfo(){return f.getByProps("getAcronym")},get GuildChannelsStore(){return f.getByProps("getChannels","getDefaultChannel")},get GuildMemberStore(){return f.getByProps("getMember")},get MemberCountStore(){return f.getByProps("getMemberCounts")},get GuildEmojiStore(){return f.getByProps("getEmojis")},get GuildActions(){return f.getByProps("markGuildAsRead")},get GuildPermissions(){return f.getByProps("getGuildPermissions")},get ChannelStore(){return f.getByProps("getChannels","getDMFromUserId")},get SelectedChannelStore(){return f.getByProps("getLastSelectedChannelId")},get ChannelActions(){return f.getByProps("selectChannel")},get PrivateChannelActions(){return f.getByProps("openPrivateChannel")},get ChannelSelector(){return f.getByProps("selectGuild","selectChannel")},get UserInfoStore(){return f.getByProps("getToken")},get UserSettingsStore(){return f.getByProps("guildPositions")},get AccountManager(){return f.getByProps("register","login")},get UserSettingsUpdater(){return f.getByProps("updateRemoteSettings")},get OnlineWatcher(){return f.getByProps("isOnline")},get CurrentUserIdle(){return f.getByProps("getIdleTime")},get RelationshipStore(){return f.getByProps("isBlocked","getFriendIDs")},get RelationshipManager(){return f.getByProps("addRelationship")},get MentionStore(){return f.getByProps("getMentions")},get UserStore(){return f.getByProps("getCurrentUser")},get UserStatusStore(){return f.getByProps("getStatus","getState")},get UserTypingStore(){return f.getByProps("isTyping")},get UserActivityStore(){return f.getByProps("getActivity")},get UserNameResolver(){return f.getByProps("getName")},get UserNoteStore(){return f.getByProps("getNote")},get UserNoteActions(){return f.getByProps("updateNote")},get EmojiInfo(){return f.getByProps("isEmojiDisabled")},get EmojiUtils(){return f.getByProps("getGuildEmoji")},get EmojiStore(){return f.getByProps("getByCategory","EMOJI_NAME_RE")},get InviteStore(){return f.getByProps("getInvites")},get InviteResolver(){return f.getByProps("findInvite")},get InviteActions(){return f.getByProps("acceptInvite")},get DiscordConstants(){return f.getByProps("Permissions","ActivityTypes","StatusTypes")},get DiscordPermissions(){return f.getByProps("Permissions","ActivityTypes","StatusTypes").Permissions},get PermissionUtils(){return f.getByProps("getHighestRole")},get ColorConverter(){return f.getByProps("hex2int")},get ColorShader(){return f.getByProps("darken")},get TinyColor(){return f.getByPrototypes("toRgb")},get ClassResolver(){return f.getByProps("getClass")},get ButtonData(){return f.getByProps("ButtonSizes")},get IconNames(){return f.getByProps("IconNames")},get NavigationUtils(){return f.getByProps("transitionTo","replaceWith","getHistory")},get MessageStore(){return f.getByProps("getMessages")},get MessageActions(){return f.getByProps("jumpToMessage","_sendMessage")},get MessageQueue(){return f.getByProps("enqueue")},get MessageParser(){return f.getByProps("createMessage","parse","unparse")},get hljs(){return f.getByProps("highlight","highlightBlock")},get SimpleMarkdown(){return f.getByProps("parseBlock","parseInline","defaultOutput")},get ExperimentStore(){return f.getByProps("getExperimentOverrides")},get ExperimentsManager(){return f.getByProps("isDeveloper")},get CurrentExperiment(){return f.getByProps("getExperimentId")},get ImageResolver(){return f.getByProps("getUserAvatarURL","getGuildIconURL")},get ImageUtils(){return f.getByProps("getSizedImageSrc")},get AvatarDefaults(){return f.getByProps("getUserAvatarURL","DEFAULT_AVATARS")},get WindowInfo(){return f.getByProps("isFocused","windowSize")},get TagInfo(){return f.getByProps("VALID_TAG_NAMES")},get DOMInfo(){return f.getByProps("canUseDOM")},get LocaleManager(){return f.getByProps("setLocale")},get Moment(){return f.getByProps("parseZone")},get LocationManager(){return f.getByProps("createLocation")},get Timestamps(){return f.getByProps("fromTimestamp")},get Strings(){return f.getByProps("Messages").Messages},get StringFormats(){return f.getByProps("a","z")},get StringUtils(){return f.getByProps("toASCII")},get URLParser(){return f.getByProps("Url","parse")},get ExtraURLs(){return f.getByProps("getArticleURL")},get DNDActions(){return f.getByProps("beginDrag")},get DNDSources(){return f.getByProps("addTarget")},get DNDObjects(){return f.getByProps("DragSource")},get MediaDeviceInfo(){return f.getByProps("Codecs","SUPPORTED_BROWSERS")},get MediaInfo(){return f.getByProps("getOutputVolume")},get MediaEngineInfo(){return f.getByProps("MediaEngineFeatures")},get VoiceInfo(){return f.getByProps("EchoCancellation")},get VideoStream(){return f.getByProps("getVideoStream")},get SoundModule(){return f.getByProps("playSound")},get ElectronModule(){return f.getByProps("setBadge")},get Dispatcher(){return f.getByProps("dirtyDispatch")},get PathUtils(){return f.getByProps("hasBasename")},get NotificationModule(){return f.getByProps("showNotification")},get RouterModule(){return f.getByProps("Router")},get APIModule(){return f.getByProps("getAPIBaseURL")},get AnalyticEvents(){return f.getByProps("AnalyticEventConfigs")},get KeyGenerator(){return f.getByRegex(/"binary"/)},get Buffers(){return f.getByProps("Buffer","kMaxLength")},get DeviceStore(){return f.getByProps("getDevices")},get SoftwareInfo(){return f.getByProps("os")},get CurrentContext(){return f.getByProps("setTagsContext")}});class g{static byProperties(e,t=(e=>e)){return s=>{const n=t(s);return!!n&&e.every(e=>void 0!==n[e])}}static byPrototypeFields(e,t=(e=>e)){return s=>{const n=t(s);return!!n&&(!!n.prototype&&e.every(e=>void 0!==n.prototype[e]))}}static byCode(e,t=(e=>e)){return s=>{const n=t(s);return!!n&&-1!==n.toString([]).search(e)}}static byString(...e){return t=>{const s=t.toString([]);for(const t of e)if(!s.includes(t))return!1;return!0}}static byDisplayName(e){return t=>t&&t.displayName===e}static combine(...e){return t=>e.every(e=>e(t))}}class f{static find(e,t=!0){return this.getModule(e,t)}static findAll(e){return this.getModule(e,!1)}static findByUniqueProperties(e,t=!0){return t?this.getByProps(...e):this.getAllByProps(...e)}static findByDisplayName(e){return this.getByDisplayName(e)}static getModule(e,t=!0){const s=this.getAllModules(),n=[];for(const o in s){if(!s.hasOwnProperty(o))continue;const r=s[o],{exports:i}=r;let a=null;if(i&&(i.__esModule&&i.default&&e(i.default)&&(a=i.default),e(i)&&(a=i),a)){if(t)return a;n.push(a)}}return t||0==n.length?void 0:n}static getModules(e){return this.getModule(e,!1)}static getModuleByName(e,t){if(m.hasOwnProperty(e))return m[e];if(!t)return;const s=this.getModule(t,!0);return s?m[e]=s:void 0}static getByDisplayName(e){return this.getModule(g.byDisplayName(e),!0)}static getByRegex(e,t=!0){return this.getModule(g.byCode(e),t)}static getByPrototypes(...e){return this.getModule(g.byPrototypeFields(e),!0)}static getAllByPrototypes(...e){return this.getModule(g.byPrototypeFields(e),!1)}static getByProps(...e){return this.getModule(g.byProperties(e),!0)}static getAllByProps(...e){return this.getModule(g.byProperties(e),!1)}static getByString(...e){return this.getModule(g.byString(...e),!0)}static getAllByString(...e){return this.getModule(g.byString(...e),!1)}static get require(){if(this._require)return this._require;const e="bbd-webpackmodules",t="function"==typeof window.webpackJsonp?window.webpackJsonp([],{[e]:(e,t,s)=>t.default=s},[e]).default:window.webpackJsonp.push([[],{[e]:(e,t,s)=>e.exports=s},[[e]]]);return delete t.m[e],delete t.c[e],this._require=t}static getAllModules(){return this.require.c}}const b=s(0),y=s(2),v=DiscordNative.globals.releaseChannel;var C=new class{constructor(){this.data={settings:{stable:{},canary:{},ptb:{}}},this.pluginData={}}initialize(){try{b.existsSync(this.BDFile)||b.writeFileSync(this.BDFile,JSON.stringify(this.data,null,4));const e=require(this.BDFile);if(e.hasOwnProperty("settings")&&(this.data=e),!b.existsSync(this.settingsFile))return;let t=require(this.settingsFile);b.unlinkSync(this.settingsFile),t=t.hasOwnProperty("settings")?Object.assign({stable:{},canary:{},ptb:{}},{[v]:t}):Object.assign({stable:{},canary:{},ptb:{}},t),this.setBDData("settings",t)}catch(e){E.alert("Corrupt Storage","The bd storage has somehow become corrupt. You may either try to salvage the file or delete it then reload.")}}get BDFile(){return this._BDFile||(this._BDFile=y.resolve(i.dataPath,"bdstorage.json"))}get settingsFile(){return this._settingsFile||(this._settingsFile=y.resolve(i.dataPath,"bdsettings.json"))}getPluginFile(e){return y.resolve(i.dataPath,"plugins",e+".config.json")}getSettingGroup(e){return this.data.settings[v][e]||null}setSettingGroup(e,t){this.data.settings[v][e]=t,b.writeFileSync(this.BDFile,JSON.stringify(this.data,null,4))}getBDData(e){return this.data[e]||""}setBDData(e,t){this.data[e]=t,b.writeFileSync(this.BDFile,JSON.stringify(this.data,null,4))}getPluginData(e,t){return void 0!==this.pluginData[e]?this.pluginData[e][t]||void 0:b.existsSync(this.getPluginFile(e))?(this.pluginData[e]=JSON.parse(b.readFileSync(this.getPluginFile(e))),this.pluginData[e][t]||void 0):void 0}setPluginData(e,t,s){void 0!==s&&(void 0===this.pluginData[e]&&(this.pluginData[e]={}),this.pluginData[e][t]=s,b.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],b.writeFileSync(this.getPluginFile(e),JSON.stringify(this.pluginData[e],null,4))}};const w={get React(){return m.React},get ReactDOM(){return m.ReactDOM},get WindowConfigFile(){if(this._windowConfigFile)return this._windowConfigFile;const e=s(1).remote.app,t=s(2),n=e.getAppPath(),o=e.getPath("userData"),r=t.resolve(o,e.getVersion(),"modules","discord_desktop_core","injector","config.json"),i=t.resolve(n,"..","app","config.json"),a=s(0),l=a.existsSync(i)?i:a.existsSync(r)?r:null;return this._windowConfigFile=l||null},getAllWindowPreferences:function(){return this.WindowConfigFile?require(this.WindowConfigFile):{}},getWindowPreference:function(e){if(this.WindowConfigFile)return this.getAllWindowPreferences()[e]},setWindowPreference:function(e,t){if(!this.WindowConfigFile)return;const n=s(0),o=this.getAllWindowPreferences();o[e]=t,delete s.c[this.WindowConfigFile],n.writeFileSync(this.WindowConfigFile,JSON.stringify(o,null,4))},injectCSS:function(e,t){$("head").append($("'),$("#customcss").text(this.editor.session.getValue()).detach().appendTo(document.head)}saveCss(){C.setBDData("bdcustomcss",btoa(this.editor.session.getValue()))}}class ve extends m.React.Component{constructor(e){super(e),this.props.lines=0,this.setInitialState(),this.attach=this.attach.bind(this),this.detachedEditor=m.React.createElement(ye,{attach:this.attach}),this.onClick=this.onClick.bind(this),this.updateCss=this.updateCss.bind(this),this.saveCss=this.saveCss.bind(this),this.detach=this.detach.bind(this)}setInitialState(){this.state={detached:this.props.detached||Q.editorDetached}}componentDidMount(){this.editor=ace.edit("bd-customcss-editor"),this.editor.setTheme("ace/theme/monokai"),this.editor.session.setMode("ace/mode/css"),this.editor.setShowPrintMargin(!1),this.editor.setFontSize(14),this.editor.on("change",()=>{r["bda-css-0"]&&(this.saveCss(),this.updateCss())})}componentWillUnmount(){this.editor.destroy()}componentDidUpdate(e,t){t.detached&&!this.state.detached&&m.ReactDOM.unmountComponentAtNode(this.detachedRoot)}codeMirror(){}get options(){return{lineNumbers:!0,mode:"css",indentUnit:4,theme:"material",scrollbarStyle:"simple"}}get css(){const e=C.getBDData("bdcustomcss");let t="";return e&&""!==e&&(t=atob(e)),t}updateLineCount(){const e=this.refs.editor.value.split("\n").length;e!=this.props.lines&&(this.refs.lines.textContent=Array.from(new Array(e),(e,t)=>t+1).join(".\n")+".",this.props.lines=e)}render(){const e=this,{detached:t}=e.state;return m.React.createElement("div",{className:"contentColumn-2hrIYH contentColumnDefault-1VQkGM content-column default",style:{padding:"60px 40px 0px"}},t&&m.React.createElement("div",{id:"editor-detached"},m.React.createElement(ae,{text:"Custom CSS Editor"}),m.React.createElement("h3",null,"Editor Detached"),m.React.createElement("button",{className:"btn btn-primary",onClick:()=>{e.attach()}},"Attach")),!t&&m.React.createElement("div",null,m.React.createElement(ae,{text:"Custom CSS Editor"}),m.React.createElement("div",{className:"editor-wrapper"},m.React.createElement("div",{id:"bd-customcss-editor",className:"editor",ref:"editor"},e.css)),m.React.createElement("div",{id:"bd-customcss-attach-controls"},m.React.createElement("ul",{className:"checkbox-group"},m.React.createElement(be,{id:"live-update",text:"Live Update",onChange:this.onChange,checked:r["bda-css-0"]})),m.React.createElement("div",{id:"bd-customcss-detach-controls-button"},m.React.createElement("button",{style:{borderRadius:"3px 0 0 3px",borderRight:"1px solid #3f4146"},className:"btn btn-primary",onClick:()=>{e.onClick("update")}},"Update"),m.React.createElement("button",{style:{borderRadius:"0",borderLeft:"1px solid #2d2d2d",borderRight:"1px solid #2d2d2d"},className:"btn btn-primary",onClick:()=>{e.onClick("save")}},"Save"),m.React.createElement("button",{style:{borderRadius:"0 3px 3px 0",borderLeft:"1px solid #3f4146"},className:"btn btn-primary",onClick:()=>{e.onClick("detach")}},"Detach"),m.React.createElement("span",{style:{fontSize:"10px",marginLeft:"5px"}},"Unsaved changes are lost on detach"),m.React.createElement("div",{className:"help-text"},"Press ",m.React.createElement("code",{className:"inline"},"ctrl"),"+",m.React.createElement("span",{className:"inline"},",")," with the editor focused to access the editor's settings.")))))}onClick(e){switch(e){case"update":this.updateCss();break;case"save":this.saveCss();break;case"detach":this.detach()}}onChange(e,t){switch(e){case"live-update":r["bda-css-0"]=t,Ne.saveSettings()}}updateCss(){0==$("#customcss").length&&$("head").append(''),$("#customcss").text(this.editor.session.getValue()).detach().appendTo(document.head)}saveCss(){C.setBDData("bdcustomcss",btoa(this.editor.session.getValue()))}detach(){this.setState({detached:!0});const e=this.detachedRoot;e?m.ReactDOM.render(this.detachedEditor,e):console.log("FAILED TO INJECT ROOT: .app")}get detachedRoot(){const e=$("#bd-customcss-detach-container");return e.length?e[0]:this.injectDetachedRoot()?this.detachedRoot:null}injectDetachedRoot(){return!!$(".app, .app-2rEoOp").length&&($("",{id:"bd-customcss-detach-container"}).insertAfter($(".app, .app-2rEoOp")),!0)}attach(){this.setState({detached:!1})}}class Ce{constructor(e){this.sideBarOnClick=this.sideBarOnClick.bind(this),this.onChange=e.onChange,this.sidebar=new ne(this.sideBarOnClick)}get root(){const e=$("#bd-settingspane-container");return e.length?e[0]:this.injectRoot()?this.root:null}injectRoot(){if(!$(".layer-3QrUeG .standardSidebarView-3F1I7i, .layer-3QrUeG .ui-standard-sidebar-view").length)return!1;const e=$("",{class:"contentRegion-3nDuYy content-region",id:"bd-settingspane-container"});return $(".layer-3QrUeG .standardSidebarView-3F1I7i, .layer-3QrUeG .ui-standard-sidebar-view").append(e),h.onRemoved(e[0],()=>{Z.unmountComponentAtNode(e[0])}),!0}get coreSettings(){const e=this.getSettings("core");return[...new Set(e.map(e=>e.category))].map(t=>({title:t,settings:e.filter(e=>e.category==t)}))}get emoteSettings(){return this.getSettings("emote")}getSettings(e){return Object.keys(o).reduce((t,s)=>{const n=o[s];return n.cat===e&&n.implemented&&!n.hidden&&(n.text=s,t.push(n)),t},[])}sideBarOnClick(e){const t=this;switch($(".contentRegion-3nDuYy, .content-region").first().hide(),$(t.root).show(),e){case"core":t.renderCoreSettings();break;case"emotes":t.renderEmoteSettings();break;case"customcss":t.renderCustomCssEditor();break;case"plugins":t.renderPluginPane();break;case"themes":t.renderThemePane()}}renderSidebar(){const e=this;$("[class*='side-'] > [class*='item-']").off("click.v2settingspanel").on("click.v2settingspanel",()=>{Z.unmountComponentAtNode(e.root),$(e.root).hide(),$(".contentRegion-3nDuYy, .content-region").first().show()}),e.sidebar.render()}get coreComponent(){return J.createElement(oe,{contentColumn:!0,fade:!0,dark:!0,children:[J.createElement(de,{key:"cspanel",onChange:this.onChange,sections:this.coreSettings}),J.createElement(pe,{key:"tools"})]})}get emoteComponent(){return J.createElement(oe,{contentColumn:!0,fade:!0,dark:!0,children:[J.createElement(he,{key:"espanel",title:"Emote Settings",onChange:this.onChange,settings:this.emoteSettings,button:{title:"Clear Emote Cache",onClick:()=>{W.clearEmoteData(),W.init(),z.init()}}}),J.createElement(pe,{key:"tools"})]})}get customCssComponent(){return J.createElement(oe,{contentColumn:!0,fade:!0,dark:!0,children:[J.createElement(ve,{key:"csseditor"}),J.createElement(pe,{key:"tools"})]})}contentComponent(e){const t="plugins"==e?this.pluginsComponent:this.themesComponent,s=e.replace("s",""),n=this;return J.createElement(class extends J.Component{constructor(e){super(e),this.onChange=this.onChange.bind(this)}componentDidMount(){P.on(`${s}-reloaded`,this.onChange),P.on(`${s}-loaded`,this.onChange),P.on(`${s}-unloaded`,this.onChange)}componentWillUnmount(){P.off(`${s}-reloaded`,this.onChange),P.off(`${s}-loaded`,this.onChange),P.off(`${s}-unloaded`,this.onChange)}onChange(){n.sideBarOnClick(e)}render(){return t}})}get pluginsComponent(){const e=Object.keys(d).sort((e,t)=>e.toLowerCase().localeCompare(t.toLowerCase())).reduce((e,t)=>(e.push(J.createElement(ge,{key:t,plugin:d[t].plugin})),e),[]),t=J.createElement(re,{key:"plugin-list",className:"bda-slist",children:e}),n=!r["fork-ps-5"]&&J.createElement(me,{className:"bd-reload-header",size:"18px",onClick:async()=>{N.updatePluginList(),this.sideBarOnClick("plugins")}}),o=J.createElement("button",{key:"folder-button",className:"bd-pfbtn",onClick:()=>{s(1).shell.openItem(I.pluginsFolder)}},"Open Plugin Folder"),i=J.createElement(ie,{key:"pcolumn",title:"Plugins",children:[n,o,t]});return J.createElement(oe,{contentColumn:!0,fade:!0,dark:!0,children:[i,J.createElement(pe,{key:"tools"})]})}get themesComponent(){const e=Object.keys(c).sort((e,t)=>e.toLowerCase().localeCompare(t.toLowerCase())).reduce((e,t)=>(e.push(J.createElement(fe,{key:t,theme:c[t]})),e),[]),t=J.createElement(re,{key:"theme-list",className:"bda-slist",children:e}),n=!r["fork-ps-5"]&&J.createElement(me,{className:"bd-reload-header",size:"18px",onClick:async()=>{B.updateThemeList(),this.sideBarOnClick("themes")}}),o=J.createElement("button",{key:"folder-button",className:"bd-pfbtn",onClick:()=>{s(1).shell.openItem(I.themesFolder)}},"Open Theme Folder"),i=J.createElement(ie,{key:"tcolumn",title:"Themes",children:[n,o,t]});return J.createElement(oe,{contentColumn:!0,fade:!0,dark:!0,children:[i,J.createElement(pe,{key:"tools"})]})}renderCoreSettings(){const e=this.root;e?Z.render(this.coreComponent,e):console.log("FAILED TO LOCATE ROOT: .layer-3QrUeG .standardSidebarView-3F1I7i")}renderEmoteSettings(){const e=this.root;e?Z.render(this.emoteComponent,e):console.log("FAILED TO LOCATE ROOT: .layer-3QrUeG .standardSidebarView-3F1I7i")}renderCustomCssEditor(){const e=this.root;e?Z.render(this.customCssComponent,e):console.log("FAILED TO LOCATE ROOT: .layer-3QrUeG .standardSidebarView-3F1I7i")}renderPluginPane(){const e=this.root;e?Z.render(this.contentComponent("plugins"),e):console.log("FAILED TO LOCATE ROOT: .layer-3QrUeG .standardSidebarView-3F1I7i")}renderThemePane(){const e=this.root;e?Z.render(this.contentComponent("themes"),e):console.log("FAILED TO LOCATE ROOT: .layer-3QrUeG .standardSidebarView-3F1I7i")}}class we extends J.Component{constructor(e){super(e)}render(){const{sidebar:e,content:t,tools:s}=this.props.children;return J.createElement("div",{className:"standardSidebarView-3F1I7i ui-standard-sidebar-view"},J.createElement("div",{className:"sidebarRegion-VFTUkN sidebar-region"},J.createElement(oe,{key:"sidebarScroller",ref:"sidebarScroller",sidebar:!0,fade:e.fade||!0,dark:e.dark||!0,children:e.component})),J.createElement("div",{className:"contentRegion-3nDuYy content-region"},J.createElement("div",{className:"contentTransitionWrap-3hqOEW content-transition-wrap"},J.createElement("div",{className:"scrollerWrap-2lJEkd firefoxFixScrollFlex-cnI2ix contentRegionScrollerWrap-3YZXdm content-region-scroller-wrap scrollerThemed-2oenus themeGhost-28MSn0 scrollerTrack-1ZIpsv"},J.createElement("div",{className:"scroller-2FKFPG firefoxFixScrollFlex-cnI2ix contentRegionScroller-26nc1e content-region-scroller scroller",ref:"contentScroller"},J.createElement("div",{className:"contentColumn-2hrIYH contentColumnDefault-1VQkGM content-column default"},t.component),s.component)))))}}class Ee extends J.Component{constructor(e){super(e),this.props.server.iconUrl||(this.props.server.iconUrl=this.props.fallback),this.state={imageError:!1,joined:this.props.guildList.includes(this.props.server.identifier)}}render(){const{server:e}=this.props;return J.createElement("div",{className:`card-3Qj_Yx cardPrimary-1Hv-to marginBottom8-AtZOdT bd-server-card${e.pinned?" bd-server-card-pinned":""}`},J.createElement("img",{ref:"img",className:"bd-server-image",src:e.iconUrl,onError:this.handleError.bind(this)}),J.createElement("div",{className:"flexChild-faoVW3 bd-server-content"},J.createElement("div",{className:"flex-1xMQg5 flex-1O1GKY horizontal-1ae9ci horizontal-2EEEnY directionRow-3v3tfG noWrap-3jynv6 bd-server-header"},J.createElement("h5",{className:"h5-18_1nd defaultColor-1_ajX0 margin-reset bd-server-name"},e.name),J.createElement("h5",{className:"h5-18_1nd defaultColor-1_ajX0 margin-reset bd-server-member-count"},e.members," Members")),J.createElement("div",{className:"flex-1xMQg5 flex-1O1GKY horizontal-1ae9ci horizontal-2EEEnY directionRow-3v3tfG noWrap-3jynv6"},J.createElement("div",{className:"scrollerWrap-2lJEkd scrollerThemed-2oenus themeGhostHairline-DBD-2d scrollerFade-1Ijw5y bd-server-description-container"},J.createElement("div",{className:"scroller-2FKFPG scroller bd-server-description"},e.description))),J.createElement("div",{className:"flex-1xMQg5 flex-1O1GKY horizontal-1ae9ci horizontal-2EEEnY directionRow-3v3tfG noWrap-3jynv6 bd-server-footer"},J.createElement("div",{className:"flexChild-faoVW3 bd-server-tags",style:{flex:"1 1 auto"}},e.categories.join(", ")),this.state.joined&&J.createElement("button",{type:"button",className:"button-38aScr lookFilled-1Gx00P colorBrand-3pXr91 sizeMin-1mJd1x grow-q77ONN colorGreen-29iAKY",style:{minHeight:"12px",marginTop:"4px",backgroundColor:"#3ac15c"}},J.createElement("div",{className:"ui-button-contents"},"Joined")),e.error&&J.createElement("button",{type:"button",className:"button-38aScr lookFilled-1Gx00P colorBrand-3pXr91 sizeMin-1mJd1x grow-q77ONN disabled-9aF2ug",style:{minHeight:"12px",marginTop:"4px",backgroundColor:"#c13a3a"}},J.createElement("div",{className:"ui-button-contents"},"Error")),!e.error&&!this.state.joined&&J.createElement("button",{type:"button",className:"button-38aScr lookFilled-1Gx00P colorBrand-3pXr91 sizeMin-1mJd1x grow-q77ONN",style:{minHeight:"12px",marginTop:"4px"},onClick:()=>{this.join()}},J.createElement("div",{className:"ui-button-contents"},"Join")))))}handleError(){this.props.server.iconUrl=this.props.fallback,this.setState({imageError:!0})}join(){this.props.join(this)}}class ke extends J.Component{constructor(e){super(e),this.setInitialState(),this.close=this.close.bind(this),this.changeCategory=this.changeCategory.bind(this),this.search=this.search.bind(this),this.searchKeyDown=this.searchKeyDown.bind(this),this.checkConnection=this.checkConnection.bind(this),this.join=this.join.bind(this),this.connect=this.connect.bind(this),this.GuildStore=f.getByProps("getGuilds"),this.AvatarDefaults=f.getByProps("getUserAvatarURL","DEFAULT_AVATARS"),this.InviteActions=f.getByProps("acceptInvite"),this.SortedGuildStore=f.getByProps("getSortedGuilds")}componentDidMount(){this.checkConnection()}setInitialState(){this.state={selectedCategory:-1,title:"Loading...",loading:!0,servers:[],next:null,connection:{state:0,user:null}}}close(){Z.unmountComponentAtNode(document.getElementById(this.props.rootId))}search(e,t){const s=this;$.ajax({method:"GET",url:`${s.endPoint}${e}${e?"&schema=new":"?schema=new"}`,success:e=>{let n=e.results.reduce((e,t)=>(t.joined=!1,e.push(t),e),[]);t||(n=s.state.servers.concat(n));let o=e.size+e.from;e.next=`?from=${o}`,s.state.term&&(e.next+=`&term=${s.state.term}`),s.state.selectedCategory&&(e.next+=`&category=${s.categoryButtons[s.state.selectedCategory]}`),o>=e.total&&(o=e.total,e.next=null);let r=`Showing 1-${o} of ${e.total} results in ${s.categoryButtons[s.state.selectedCategory]}`;s.state.term&&(r+=` for ${s.state.term}`),s.setState({loading:!1,title:r,servers:n,next:e.next}),t&&(s.refs.sbv.refs.contentScroller.scrollTop=0)},error:()=>{s.setState({loading:!1,title:"Failed to load servers. Check console for details"})}})}join(e){if(e.props.pinned)return this.InviteActions.acceptInvite(e.props.invite_code);$.ajax({method:"GET",url:`${this.joinEndPoint}/${e.props.server.identifier}`,headers:{Accept:"application/json;","Content-Type":"application/json;","x-discord-token":this.state.connection.user.accessToken},crossDomain:!0,xhrFields:{withCredentials:!0},success:()=>{e.setState({joined:!0})}})}connect(){const e=this.windowOptions;e.x=Math.round(window.screenX+window.innerWidth/2-e.width/2),e.y=Math.round(window.screenY+window.innerHeight/2-e.height/2),this.joinWindow=new(window.require("electron").remote.BrowserWindow)(e);this.joinWindow.webContents.on("did-navigate",(e,t)=>{"https://auth.discordservers.com/info"==t&&(this.joinWindow.close(),this.checkConnection())}),this.joinWindow.loadURL("https://auth.discordservers.com/connect?scopes=guilds.join&previousUrl=https://auth.discordservers.com/info")}get windowOptions(){return{width:500,height:550,backgroundColor:"#282b30",show:!0,resizable:!1,maximizable:!1,minimizable:!1,alwaysOnTop:!0,frame:!1,center:!1,webPreferences:{nodeIntegration:!1}}}get bdServer(){const e=this.SortedGuildStore.guildPositions,t=this.AvatarDefaults.DEFAULT_AVATARS;return J.createElement(Ee,{server:{name:"BetterDiscord",online:"7500+",members:"20000+",categories:["community","programming","support"],description:"Official BetterDiscord server for support etc",identifier:"86004744966914048",iconUrl:"https://cdn.discordapp.com/icons/86004744966914048/292e7f6bfff2b71dfd13e508a859aedd.webp",nativejoin:!0,invite_code:"0Tmfo5ZbORCRqbAd",pinned:!0},pinned:!0,join:this.join,guildList:e,fallback:t[Math.floor(5*Math.random())]})}get endPoint(){return"https://search.discordservers.com"}get joinEndPoint(){return"https://j.discordservers.com"}get connectEndPoint(){return"https://join.discordservers.com/connect"}checkConnection(){const e=this;try{$.ajax({method:"GET",url:"https://auth.discordservers.com/info",headers:{Accept:"application/json;","Content-Type":"application/json;"},crossDomain:!0,xhrFields:{withCredentials:!0},success:t=>{e.setState({selectedCategory:0,connection:{state:2,user:t}}),e.search("",!0)},error:()=>{e.setState({title:"Not connected to discordservers.com!",loading:!0,selectedCategory:-1,connection:{state:1,user:null}})}})}catch(t){e.setState({title:"Not connected to discordservers.com!",loading:!0,selectedCategory:-1,connection:{state:1,user:null}})}}render(){return J.createElement(we,{ref:"sbv",children:this.component})}get component(){return{sidebar:{component:this.sidebar},content:{component:this.content},tools:{component:J.createElement(pe,{key:"pt",ref:"tools",onClick:this.close})}}}get sidebar(){return J.createElement("div",{className:"sidebar",key:"ps"},J.createElement("div",{className:"ui-tab-bar SIDE"},J.createElement("div",{className:"ui-tab-bar-header",style:{fontSize:"16px"}},"Public Servers"),J.createElement(te.Separator,null),this.searchInput,J.createElement(te.Separator,null),J.createElement(te.Header,{text:"Categories"}),this.categoryButtons.map((e,t)=>J.createElement(te.Item,{id:t,onClick:this.changeCategory,key:t,text:e,selected:this.state.selectedCategory===t})),J.createElement(te.Separator,null),this.footer,this.connection))}get searchInput(){return J.createElement("div",{className:"ui-form-item"},J.createElement("div",{className:"ui-text-input flex-vertical",style:{width:"172px",marginLeft:"10px"}},J.createElement("input",{ref:"searchinput",onKeyDown:this.searchKeyDown,onChange:()=>{},type:"text",className:"input default",placeholder:"Search...",maxLength:"50"})))}searchKeyDown(e){const t=this;if(t.state.loading||13!==e.which)return;t.setState({loading:!0,title:"Loading...",term:e.target.value});let s=`?term=${e.target.value}`;0!==t.state.selectedCategory&&(s+=`&category=${t.categoryButtons[t.state.selectedCategory]}`),t.search(s,!0)}get categoryButtons(){return["All","FPS Games","MMO Games","Strategy Games","MOBA Games","RPG Games","Tabletop Games","Sandbox Games","Simulation Games","Music","Community","Language","Programming","Other"]}changeCategory(e){const t=this;t.state.loading||(t.refs.searchinput.value="",t.setState({loading:!0,selectedCategory:e,title:"Loading...",term:null}),0!==e?t.search(`?category=${t.categoryButtons[e]}`,!0):t.search("",!0))}get content(){const e=this,t=this.SortedGuildStore.guildPositions,s=this.AvatarDefaults.DEFAULT_AVATARS;return 1===e.state.connection.state?e.notConnected:[J.createElement("div",{ref:"content",key:"pc",className:"contentColumn-2hrIYH contentColumnDefault-1VQkGM content-column default"},J.createElement(ae,{text:e.state.title}),e.bdServer,e.state.servers.map(n=>J.createElement(Ee,{key:n.identifier,server:n,join:e.join,guildList:t,fallback:s[Math.floor(5*Math.random())]})),e.state.next&&J.createElement("button",{type:"button",onClick:()=>{e.state.loading||(e.setState({loading:!0}),e.search(e.state.next,!1))},className:"ui-button filled brand small grow",style:{width:"100%",marginTop:"10px",marginBottom:"10px"}},J.createElement("div",{className:"ui-button-contents"},e.state.loading?"Loading":"Load More")),e.state.servers.length>0&&J.createElement(ae,{text:e.state.title}))]}get notConnected(){return[J.createElement("div",{key:"ncc",ref:"content",className:"contentColumn-2hrIYH contentColumnDefault-1VQkGM content-column default"},J.createElement("h2",{className:"ui-form-title h2 margin-reset margin-bottom-20"},"Not connected to discordservers.com!",J.createElement("button",{onClick:this.connect,type:"button",className:"ui-button filled brand small grow",style:{display:"inline-block",minHeight:"18px",marginLeft:"10px",lineHeight:"14px"}},J.createElement("div",{className:"ui-button-contents"},"Connect"))),this.bdServer)]}get footer(){return J.createElement("div",{className:"ui-tab-bar-header"},J.createElement("a",{href:"https://discordservers.com",target:"_blank"},"Discordservers.com"))}get connection(){const{connection:e}=this.state;return 2!==e.state?J.createElement("span",null):J.createElement("span",null,J.createElement(te.Separator,null),J.createElement("span",{style:{color:"#b9bbbe",fontSize:"10px",marginLeft:"10px"}},"Connected as: ",`${e.user.username}#${e.user.discriminator}`),J.createElement("div",{style:{padding:"5px 10px 0 10px"}},J.createElement("button",{style:{width:"100%",minHeight:"20px"},type:"button",className:"ui-button filled brand small grow"},J.createElement("div",{className:"ui-button-contents",onClick:this.connect},"Reconnect"))))}}class Se extends J.Component{constructor(e){super(e)}componentDidMount(){$(window).on(`keyup.${this.props.id}`,e=>{27===e.which&&Z.unmountComponentAtNode(this.refs.root.parentNode)}),$(`#${this.props.id}`).animate({opacity:1},{step:function(e){$(this).css("transform",`scale(${1.1-.1*e}) translateZ(0px)`)},duration:200,done:()=>{$(`#${this.props.id}`).css("opacity","").css("transform","")}})}componentWillUnmount(){$(window).off(`keyup.${this.props.id}`),$(`#${this.props.id}`).animate({opacity:0},{step:function(e){$(this).css("transform",`scale(${1.1-.1*e}) translateZ(0px)`)},duration:200,done:()=>{$(`#${this.props.rootId}`).remove()}}),$('[class*="layer-"]').removeClass("publicServersOpen").animate({opacity:1},{step:function(e){$(this).css("transform",`scale(${.07*e+.93}) translateZ(0px)`)},duration:200,done:()=>{$('[class*="layer-"]').css("opacity","").css("transform","")}})}componentWillMount(){$('[class*="layer-"]').addClass("publicServersOpen").animate({opacity:0},{step:function(e){$(this).css("transform",`scale(${.07*e+.93}) translateZ(0px)`)},duration:200})}render(){return J.createElement("div",{className:"layer bd-layer layer-3QrUeG",id:this.props.id,ref:"root",style:{opacity:0,transform:"scale(1.1) translateZ(0px)"}},this.props.children)}}var xe=new class{initialize(){const e=Q.guildClasses.wrapper.split(" ")[0];$(`.${e} .scroller-2FKFPG >:first-child`).after(this.button)}get component(){return m.React.createElement(n.Layer,{rootId:"pubslayerroot",id:"pubslayer",children:m.React.createElement(n.Menu,{rootId:"pubslayerroot"})})}get root(){const e=document.getElementById("pubslayerroot");return e||(this.injectRoot()?this.root:null)}injectRoot(){return!!$(".layers, .layers-3iHuyZ").length&&($(".layers, .layers-3iHuyZ").append($("",{id:"pubslayerroot"})),!0)}render(){const e=this.root;e?m.ReactDOM.render(this.component,e):console.log("FAILED TO LOCATE ROOT: .layers")}get button(){return $("",{class:Q.guildClasses.listItem,id:"bd-pub-li",style:r["bda-gs-1"]?"":"display: none;"}).append($("",{class:"wrapper-25eVIn "+Q.guildClasses.circleButtonMask,text:"public",id:"bd-pub-button",click:()=>{this.render()}}))}},Pe=new class{constructor(){this.renderer=new Ce({onChange:this.updateSettings.bind(this)})}renderSidebar(){this.renderer.renderSidebar()}updateSettings(e,t){r[e]=t,"bda-es-0"==e&&(t?$("#twitchcord-button-container").show():$("#twitchcord-button-container").hide()),"bda-gs-2"==e&&(t?$("body").addClass("bd-minimal"):$("body").removeClass("bd-minimal")),"bda-gs-3"==e&&(t?$("body").addClass("bd-minimal-chan"):$("body").removeClass("bd-minimal-chan")),"bda-gs-1"==e&&(t?$("#bd-pub-li").show():$("#bd-pub-li").hide()),"bda-gs-4"==e&&(t?H.enable():H.disable()),"bda-gs-5"==e&&(t?$("#app-mount").addClass("bda-dark"):$("#app-mount").removeClass("bda-dark")),t&&"bda-gs-6"==e&&Ne.inject24Hour(),"bda-gs-7"==e&&(t?Ne.injectColoredText():Ne.removeColoredText()),"bda-es-4"==e&&(t?W.autoCapitalize():W.disableAutoCapitalize()),"fork-ps-4"==e&&(t?S.start():S.stop()),"fork-ps-5"==e&&(t?(I.watchContent("plugin"),I.watchContent("theme")):(I.unwatchContent("plugin"),I.unwatchContent("theme"))),"fork-wp-1"==e&&(E.setWindowPreference("transparent",t),t?E.setWindowPreference("backgroundColor",null):E.setWindowPreference("backgroundColor","#2f3136")),"bda-gs-8"==e&&(t?G.enable(r["fork-dm-1"]):G.disable()),Ne.saveSettings()}initializeSettings(){r["bda-es-0"]&&$("#twitchcord-button-container").show(),r["bda-gs-2"]&&$("body").addClass("bd-minimal"),r["bda-gs-3"]&&$("body").addClass("bd-minimal-chan"),r["bda-gs-1"]&&$("#bd-pub-li").show(),r["bda-gs-4"]&&H.enable(),r["bda-gs-5"]&&$("#app-mount").addClass("bda-dark"),r["bda-gs-6"]&&Ne.inject24Hour(),r["bda-gs-7"]&&Ne.injectColoredText(),r["bda-es-4"]&&W.autoCapitalize(),r["fork-ps-4"]&&S.start(),r["fork-ps-5"]&&(I.watchContent("plugin"),I.watchContent("theme")),r["bda-gs-8"]&&G.enable(r["fork-dm-1"]),Ne.saveSettings()}};function De(){}De.prototype.setConfig=function(e){Object.assign(i,e)},De.prototype.init=async function(){if(i.version
Please download the latest version from GitHub");const e=i.updater?i.updater.LatestVersion:i.latestVersion;e>i.version&&this.alert("Update Available",`\n An update for BandagedBD is available (${e})! Please Reinstall!
\n Download Installer\n `),h.log("Startup","Initializing Settings"),this.initSettings(),h.log("Startup","Initializing EmoteModule"),window.emotePromise=W.init().then(()=>{W.initialized=!0,h.log("Startup","Initializing QuickEmoteMenu"),z.init()}),this.injectExternals(),await this.checkForGuilds(),Q.initialize(),h.log("Startup","Updating Settings"),Pe.initializeSettings(),h.log("Startup","Loading Plugins");const t=N.loadPlugins();h.log("Startup","Loading Themes");const s=B.loadThemes();$("#customcss").detach().appendTo(document.head),window.addEventListener("beforeunload",function(){r["bda-dc-0"]&&document.querySelector(".btn.btn-disconnect").click()}),xe.initialize(),W.autoCapitalize(),h.log("Startup","Removing Loading Icon"),document.getElementsByClassName("bd-loaderv2")[0].remove(),h.log("Startup","Initializing Main Observer"),this.initObserver(),r["fork-ps-1"]&&(h.log("Startup","Collecting Startup Errors"),this.showContentErrors({plugins:t,themes:s}))},De.prototype.checkForGuilds=function(){return new Promise(e=>{const t=function(){const s=Q.guildClasses.wrapper.split(" ")[0],n=Q.guildClasses.listItem.split(" ")[0],o=Q.guildClasses.blobContainer.split(" ")[0];if(document.querySelectorAll(`.${s} .${n} .${o}`).length>0)return e(i.deferLoaded=!0);setTimeout(t,100)};$(document).ready(function(){setTimeout(t,100)})})},De.prototype.injectExternals=async function(){await h.injectJs("https://cdnjs.cloudflare.com/ajax/libs/ace/1.2.9/ace.js"),window.require.original&&(window.require=window.require.original)},De.prototype.initSettings=function(){if(C.initialize(),!C.getSettingGroup("settings"))return this.saveSettings();const e=this.loadSettings();$('