BetterDiscordApp-v1/js/main.min.js

1 line
129 KiB
JavaScript

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=6)}([function(e,t){e.exports=require("fs")},function(e,t){e.exports=require("path")},function(e,t){e.exports=require("electron")},function(e,t){e.exports=require("events")},function(e,t){e.exports=require("module")},function(e,t){e.exports=require("request")},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 i})),n.d(s,"minSupportedVersion",(function(){return r})),n.d(s,"bbdVersion",(function(){return a})),n.d(s,"bbdChangelog",(function(){return l})),n.d(s,"settings",(function(){return c})),n.d(s,"defaultCookie",(function(){return d})),n.d(s,"settingsCookie",(function(){return h})),n.d(s,"bdpluginErrors",(function(){return u})),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 v})),n.d(s,"emotesTwitch",(function(){return y})),n.d(s,"subEmotesTwitch",(function(){return C})),n.d(s,"bdEmotes",(function(){return w})),n.d(s,"bdEmoteSettingIDs",(function(){return k})),n.d(s,"bdthemes",(function(){return E})),n.d(s,"bdplugins",(function(){return x})),n.d(s,"pluginCookie",(function(){return S})),n.d(s,"themeCookie",(function(){return D}));const o="0.0.306",i=window.DiscordNative&&window.DiscordNative.remoteApp&&window.DiscordNative.remoteApp.getVersion&&window.DiscordNative.remoteApp.getVersion()||"0.0.306",r="0.3.0",a="0.3.1",l={description:"There's some pretty big things in this one, and even bigger things coming. Most of this information is repeated from the `0.3.0` update just in case people hadn't seen the changelog yet.",changes:[{title:"What's New?",items:["**RepoControls**-like controls are now integrated into BD and everyone can enjoy sorting and searching their plugins and themes.","BandagedBD has undergone an internal restructure--it's no longer one messy file but *several*. Users shouldn't see any breaking changes (hopefully).","**Plugin Developers:** You'll begin (or continue for some) to see deprecation notices for several BD globals. Please take these seriously and update your plugins to use `BdApi`, the globals **_will_** be removed. If you find the API to be missing something that you could do before, please message me in BD2's <#603225817262194699> chat.","**Also Plugin Developers:** There is now an option to enable React Developer Tools in the Developer Options in settings. Just make sure to have the extension installed in your local Chrome installation."]},{title:"Minor Stuff",type:"improved",items:["**BD Blue** is now the default accent color for BBD elements in settings. Themes can customize it easily through some new variables: `--bd-blue`, `--bd-blue-hover`, `--bd-blue-active`","Some improvements have been made to the plugins and themes pages that should hopefully prevent plugins from causing errors when displaying.","You can now review the changelog after you close it by clicking this button in settings: https://i.imgur.com/I3ZdAxG.png"]},{title:"Minor Stuff",type:"fixed",items:["**Quick Emote Menu** works again, sorry about that!","Fixed an issue with searching plugin/theme lists."]}]},c={"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:!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"}},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},h={},u=[],p=[],m={},g=[],f={},b={},v={},y={},C={},w={TwitchGlobal:{},TwitchSubscriber:{},BTTV:{},FrankerFaceZ:{},BTTV2:{}},k={TwitchGlobal:"bda-es-7",TwitchSubscriber:"bda-es-7",BTTV:"bda-es-2",FrankerFaceZ:"bda-es-1",BTTV2:"bda-es-2"},E={},x={},S={},D={},T=webpackJsonp.push([[],{__extra_id__:(e,t,n)=>e.exports=n},[["__extra_id__"]]]);delete T.m.__extra_id__,delete T.c.__extra_id__;const P=e=>{for(const t in T.c)if(T.c.hasOwnProperty(t)){const n=T.c[t].exports;if(n&&n.__esModule&&n.default&&e(n.default))return n.default;if(n&&e(n))return n}return null};var N=P,M=e=>{const t=[];for(const n in T.c)if(T.c.hasOwnProperty(n)){const s=T.c[n].exports;s&&s.__esModule&&s.default&&e(s.default)?t.push(s.default):s&&e(s)&&t.push(s)}return t},B=(...e)=>P(t=>e.every(e=>void 0!==t[e])),F=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=>e.remove&&e.set&&e.clear&&e.get&&!e.sort?null:e.getToken||e.getEmail||e.showToken?new Proxy(e,{get:function(e,t){return"getToken"==t?()=>"mfa.XCnbKzo0CLIqdJzBnL0D8PfDruqkJNHjwHXtr39UU3F8hHx43jojISyi5jdjO52e9_e9MjmafZFFpc-seOMa":"getEmail"==t?()=>"puppet11112@gmail.com":"showToken"==t?()=>!0:e[t]}}):e,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 i=e.c[o].exports;i&&i.__esModule&&i.default&&n(i.default)?s.push(t(i.default)):i&&n(i)&&s.push(t(i))}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(c).reduce((t,n)=>{const s=c[n];return s.cat===e&&s.implemented&&!s.hidden&&(s.text=n,t.push(s)),t},[])}};class O{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-rNsIhG textarea")}static insertText(e,t){e.focus(),e.selectionStart=0,e.selectionEnd=e.value.length,document.execCommand("insertText",!1,t)}static injectCss(e){$("<link/>",{type:"text/css",rel:"stylesheet",href:e}).appendTo($("head"))}static injectJs(e){return new Promise(t=>{$("<script/>",{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,n){console.log(`%c[BandagedBD]%c [${e}]%c ${t}`,"color: red; font-weight: 700;","color: red;",""),n&&(console.groupCollapsed("%cError: "+n.message,"color: red;"),console.error(n.stack),console.groupEnd())}static escape(e){return e.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}static testJSON(e){try{return JSON.parse(e)}catch(e){return!1}}static isEmpty(e){if(null==e||null==e||""==e)return!0;if("object"!=typeof e)return!1;if(Array.isArray(e))return 0==e.length;for(const t in e)if(e.hasOwnProperty(t))return!1;return!0}static suppressErrors(e,t){return(...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:i,once:r=!1,silent:a=!1,force:l=!1}=n,c=n.displayName||e.displayName||e[t].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],h=()=>{a||console.log("unpatch",t,"of",c),e[t]=d};return e[t]=function(){const n={thisObject:this,methodArguments:arguments,cancelPatch:h,originalMethod:d,callOriginalMethod:()=>n.returnValue=n.originalMethod.apply(n.thisObject,n.methodArguments)};if(i){const s=O.suppressErrors(i,"`instead` callback of "+e[t].displayName)(n);void 0!==s&&(n.returnValue=s)}else s&&O.suppressErrors(s,"`before` callback of "+e[t].displayName)(n),n.callOriginalMethod(),o&&O.suppressErrors(o,"`after` callback of "+e[t].displayName)(n);return r&&h(),n.returnValue},Object.assign(e[t],d),e[t].__monkeyPatched=!0,e[t].displayName=c,e[t].__originalMethod||(e[t].__originalMethod=d,e[t].toString=function(){return d.toString()}),h}static onRemoved(e,t){const n=new MutationObserver(s=>{for(let o=0;o<s.length;o++){const i=s[o],r=Array.from(i.removedNodes),a=r.indexOf(e)>-1,l=r.some(t=>t.contains(e));(a||l)&&(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.createElement("div");e.classList.add("bd-toasts");const t=document.querySelector(".chat-3bRxxu form, #friends, .noChannel-Z1DQK7, .activityFeed-28jde9");e.style.setProperty("left",t?t.getBoundingClientRect().left+"px":"0px"),e.style.setProperty("width",t?t.offsetWidth+"px":"100%"),e.style.setProperty("bottom",(document.querySelector(".chat-3bRxxu form")?document.querySelector(".chat-3bRxxu form").offsetHeight:80)+"px"),document.querySelector(".app, .app-2rEoOp").appendChild(e)}const{type:n="",icon:s=!0,timeout:o=3e3}=t,i=document.createElement("div");i.classList.add("bd-toast"),n&&i.classList.add("toast-"+n),n&&s&&i.classList.add("icon"),i.innerText=e,document.querySelector(".bd-toasts").appendChild(i),setTimeout(()=>{i.classList.add("closing"),setTimeout(()=>{i.remove(),document.querySelectorAll(".bd-toasts .bd-toast").length||document.querySelector(".bd-toasts").remove()},300)},o)}static alert(e,t){const n=$(`<div class="bd-modal-wrapper theme-dark">\n <div class="bd-backdrop backdrop-1wrmKB"></div>\n <div class="bd-modal modal-1UGdnR">\n <div class="bd-modal-inner inner-1JeGVc">\n <div class="header header-1R_AjF">\n <div class="title">${e}</div>\n </div>\n <div class="bd-modal-body">\n <div class="scroller-wrap fade">\n <div class="scroller">\n ${t}\n </div>\n </div>\n </div>\n <div class="footer footer-2yfCgX footer-3rDWdC footer-2gL1pp">\n <button type="button">Okay</button>\n </div>\n </div>\n </div>\n </div>`);n.find(".footer button").on("click",()=>{n.addClass("closing"),setTimeout(()=>{n.remove()},300)}),n.find(".bd-backdrop").on("click",()=>{n.addClass("closing"),setTimeout(()=>{n.remove()},300)}),n.appendTo("#app-mount")}static showContentErrors({plugins:e=[],themes:t=[]}){if(!e||!t)return;if(!e.length&&!t.length)return;const n=$('<div class="bd-modal-wrapper theme-dark">\n <div class="bd-backdrop backdrop-1wrmKB"></div>\n <div class="bd-modal bd-content-modal modal-1UGdnR">\n <div class="bd-modal-inner inner-1JeGVc">\n <div class="header header-1R_AjF"><div class="title">Content Errors</div></div>\n <div class="bd-modal-body">\n <div class="tab-bar-container">\n <div class="tab-bar TOP">\n <div class="tab-bar-item">Plugins</div>\n <div class="tab-bar-item">Themes</div>\n </div>\n </div>\n <div class="table-header">\n <div class="table-column column-name">Name</div>\n <div class="table-column column-message">Message</div>\n <div class="table-column column-error">Error</div>\n </div>\n <div class="scroller-wrap fade">\n <div class="scroller">\n \n </div>\n </div>\n </div>\n <div class="footer footer-2yfCgX">\n <button type="button">Okay</button>\n </div>\n </div>\n </div>\n </div>');function s(e){const t=$('<div class="errors">');for(const n of e){const e=$(`<div class="error">\n <div class="table-column column-name">${n.name?n.name:n.file}</div>\n <div class="table-column column-message">${n.message}</div>\n <div class="table-column column-error"><a class="error-link" href="">${n.error?n.error.message:""}</a></div>\n </div>`);t.append(e),n.error&&e.find("a").on("click",e=>{e.preventDefault(),O.err("ContentManager",`Error details for ${n.name?n.name:n.file}.`,n.error)})}return t}const o=[s(e),s(t)];n.find(".tab-bar-item").on("click",e=>{e.preventDefault(),n.find(".tab-bar-item").removeClass("selected"),$(e.target).addClass("selected"),n.find(".scroller").empty().append(o[$(e.target).index()])}),n.find(".footer button").on("click",()=>{n.addClass("closing"),setTimeout(()=>{n.remove()},300)}),n.find(".bd-backdrop").on("click",()=>{n.addClass("closing"),setTimeout(()=>{n.remove()},300)}),n.appendTo("#app-mount"),e.length?n.find(".tab-bar-item")[0].click():n.find(".tab-bar-item")[1].click()}static showChangelogModal(e={}){const t=B("push","update","pop","popWithKey"),n=B("fixed","improved"),s=B("Sizes","Weights"),o=B("Child"),i=B("Tags","default"),r=N(e=>e.defaultProps&&0==e.defaultProps.selectable),l=B("defaultRules","parse");if(!(r&&t&&n&&s&&o&&i&&l))return;const{image:c="https://repository-images.githubusercontent.com/105473537/957b5480-7c26-11e9-8401-50fa820cbae5",description:d="",changes:h=[],title:u="BandagedBD",subtitle:p=`v${a}`,footer:m}=e,g=j.React.createElement,f=[g("img",{src:c})];d&&f.push(g("p",null,l.parse(d)));for(let e=0;e<h.length;e++){const t=h[e],s=n[t.type]?n[t.type]:n.added,o=0==e?n.marginTop:"";f.push(g("h1",{className:`${s} ${o}`},t.title));const i=g("ul",null,t.items.map(e=>g("li",null,l.parse(e))));f.push(i)}const b=function(){return g(o.Child,{grow:1,shrink:1},g(i.default,{tag:i.Tags.H4},u),g(s,{size:s.Sizes.SMALL,color:s.Colors.PRIMARY,className:n.date},p))},v=()=>{const e=N(e=>"Anchor"==e.displayName),n=B("anchorUnderlineOnHover")||{anchor:"anchor-3Z-8Bb",anchorUnderlineOnHover:"anchorUnderlineOnHover-2ESHQB"},i=e=>{e.preventDefault(),e.stopPropagation(),t.pop(),j.joinBD2()},r=e?g(e,{onClick:i},"Join our Discord Server."):g("a",{className:`${n.anchor} ${n.anchorUnderlineOnHover}`,onClick:i},"Join our Discord Server."),a=g(s,{size:s.Sizes.SMALL,color:s.Colors.PRIMARY},"Need support? ",r);return g(o.Child,{grow:1,shrink:1},m||a)};t.push((function(e){return g(r,Object.assign({className:n.container,selectable:!0,onScroll:e=>e,onClose:e=>e,renderHeader:b,renderFooter:v,children:f},e))}))}}const L=n(3);var A=new class extends L{dispatch(e,...t){this.emit(e,...t)}off(e,t){this.removeListener(e,t)}};function R(){}R.prototype.loadPlugins=function(){this.loadPluginData(),u.concat(Q.loadPlugins());const e=Object.keys(x);for(let t=0;t<e.length;t++){let n,s;try{n=x[e[t]].plugin,s=n.getName(),n.load&&"function"==typeof n.load&&n.load()}catch(n){S[s]=!1,O.err("Plugins",s+" could not be loaded.",n),u.push({name:s,file:x[e[t]].filename,message:"load() could not be fired.",error:{message:n.message,stack:n.stack}});continue}if(S[s]||(S[s]=!1),S[s])try{n.start(),h["fork-ps-2"]&&O.showToast(`${n.getName()} v${n.getVersion()} has started.`)}catch(n){S[s]=!1,O.err("Plugins",s+" could not be started.",n),u.push({name:s,file:x[e[t]].filename,message:"start() could not be fired.",error:{message:n.message,stack:n.stack}})}}this.savePluginData(),n(2).remote.getCurrentWebContents().on("did-navigate-in-page",this.channelSwitch.bind(this))},R.prototype.startPlugin=function(e,t=!1){try{x[e].plugin.start(),h["fork-ps-2"]&&!t&&O.showToast(`${x[e].plugin.getName()} v${x[e].plugin.getVersion()} has started.`)}catch(n){h["fork-ps-2"]&&!t&&O.showToast(`${x[e].plugin.getName()} v${x[e].plugin.getVersion()} could not be started.`,{type:"error"}),S[e]=!1,this.savePluginData(),O.err("Plugins",e+" could not be started.",n)}},R.prototype.stopPlugin=function(e,t=!1){try{x[e].plugin.stop(),h["fork-ps-2"]&&!t&&O.showToast(`${x[e].plugin.getName()} v${x[e].plugin.getVersion()} has stopped.`)}catch(n){h["fork-ps-2"]&&!t&&O.showToast(`${x[e].plugin.getName()} v${x[e].plugin.getVersion()} could not be stopped.`,{type:"error"}),O.err("Plugins",x[e].plugin.getName()+" could not be stopped.",n)}},R.prototype.enablePlugin=function(e,t=!1){S[e]||(S[e]=!0,this.savePluginData(),this.startPlugin(e,t))},R.prototype.enable=function(e,t=!1){return this.enablePlugin(e,t)},R.prototype.disablePlugin=function(e,t=!1){S[e]&&(S[e]=!1,this.savePluginData(),this.stopPlugin(e,t))},R.prototype.disable=function(e,t=!1){return this.disablePlugin(e,t)},R.prototype.togglePlugin=function(e){S[e]?this.disablePlugin(e):this.enablePlugin(e)},R.prototype.toggle=function(e,t=!1){return this.togglePlugin(e,t)},R.prototype.loadPlugin=function(e){const t=Q.loadContent(e,"plugin");if(t)return h["fork-ps-1"]&&O.showContentErrors({plugins:[t]}),h["fork-ps-2"]&&O.showToast(`${e} could not be loaded.`,{type:"error"}),O.err("ContentManager",`${e} could not be loaded.`,t);const n=Object.values(x).find(t=>t.filename==e).plugin;try{n.load&&"function"==typeof n.load&&n.load()}catch(e){h["fork-ps-1"]&&O.showContentErrors({plugins:[e]})}O.log("ContentManager",`${n.getName()} v${n.getVersion()} was loaded.`),h["fork-ps-2"]&&O.showToast(`${n.getName()} v${n.getVersion()} was loaded.`,{type:"success"}),A.dispatch("plugin-loaded",n.getName())},R.prototype.unloadPlugin=function(e){const t=Object.values(x).find(t=>t.filename==e)||x[e];if(!t)return;const n=t.plugin.getName();S[n]&&this.disablePlugin(n,!0);const s=Q.unloadContent(x[n].filename,"plugin");if(delete x[n],s)return h["fork-ps-1"]&&O.showContentErrors({plugins:[s]}),h["fork-ps-2"]&&O.showToast(`${n} could not be unloaded. It may have not been loaded yet.`,{type:"error"}),O.err("ContentManager",`${n} could not be unloaded. It may have not been loaded yet.`,s);O.log("ContentManager",`${n} was unloaded.`),h["fork-ps-2"]&&O.showToast(`${n} was unloaded.`,{type:"success"}),A.dispatch("plugin-unloaded",n)},R.prototype.delete=function(e){const t=Object.values(x).find(t=>t.filename==e)||x[e];if(!t)return;this.unloadPlugin(t.filename);const s=n(1).resolve(Q.pluginsFolder,t.filename);n(0).unlinkSync(s)},R.prototype.reloadPlugin=function(e){const t=Object.values(x).find(t=>t.filename==e)||x[e];if(!t)return this.loadPlugin(e);const n=t.plugin.getName(),s=S[n];s&&this.stopPlugin(n,!0);const o=Q.reloadContent(x[n].filename,"plugin");if(o)return h["fork-ps-1"]&&O.showContentErrors({plugins:[o]}),h["fork-ps-2"]&&O.showToast(`${n} could not be reloaded.`,{type:"error"}),O.err("ContentManager",`${n} could not be reloaded.`,o);x[n].plugin.load&&"function"==typeof x[n].plugin.load&&x[n].plugin.load(),s&&this.startPlugin(n,!0),O.log("ContentManager",`${n} v${x[n].plugin.getVersion()} was reloaded.`),h["fork-ps-2"]&&O.showToast(`${n} v${x[n].plugin.getVersion()} was reloaded.`,{type:"success"}),A.dispatch("plugin-reloaded",n)},R.prototype.reload=function(e){return this.reloadPlugin(e)},R.prototype.edit=function(e){console.log("Edit "+e);const t=Object.values(x).find(t=>t.filename==e)||x[e];if(!t)return;const s=n(1).resolve(Q.pluginsFolder,t.filename);console.log("Edit "+s),n(2).shell.openItem(`${s}`)},R.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)},R.prototype.loadPluginData=function(){const e=ee.getSettingGroup("plugins");e&&Object.assign(S,e)},R.prototype.savePluginData=function(){ee.setSettingGroup("plugins",S)},R.prototype.newMessage=function(){const e=Object.keys(x);for(let t=0;t<e.length;t++){const n=x[e[t]].plugin;if(S[n.getName()]&&"function"==typeof n.onMessage)try{n.onMessage()}catch(e){O.err("Plugins","Unable to fire onMessage for "+n.getName()+".",e)}}},R.prototype.channelSwitch=function(){const e=Object.keys(x);for(let t=0;t<e.length;t++){const n=x[e[t]].plugin;if(S[n.getName()]&&"function"==typeof n.onSwitch)try{n.onSwitch()}catch(e){O.err("Plugins","Unable to fire onSwitch for "+n.getName()+".",e)}}},R.prototype.rawObserver=function(e){const t=Object.keys(x);for(let n=0;n<t.length;n++){const s=x[t[n]].plugin;if(S[s.getName()]&&"function"==typeof s.observer)try{s.observer(e)}catch(e){O.err("Plugins","Unable to fire observer for "+s.getName()+".",e)}}};var I=new R;function _(){}_.prototype.loadThemes=function(){this.loadThemeData(),p.concat(Q.loadThemes());const e=Object.keys(E);for(let t=0;t<e.length;t++){const n=E[e[t]];D[n.name]||(D[n.name]=!1),D[n.name]&&$("head").append($("<style>",{id:n.id,text:unescape(n.css)}))}for(const e in D)E[e]||delete D[e];this.saveThemeData()},_.prototype.enableTheme=function(e,t=!1){D[e]=!0,this.saveThemeData();const n=E[e];$("head").append($("<style>",{id:n.id,text:unescape(n.css)})),h["fork-ps-2"]&&!t&&O.showToast(`${n.name} v${n.version} has been applied.`)},_.prototype.enable=function(e,t=!1){return this.enableTheme(e,t)},_.prototype.disableTheme=function(e,t=!1){D[e]=!1,this.saveThemeData();const n=E[e];$(`#${n.id}`).remove(),h["fork-ps-2"]&&!t&&O.showToast(`${n.name} v${n.version} has been disabled.`)},_.prototype.disable=function(e,t=!1){return this.disableTheme(e,t)},_.prototype.toggleTheme=function(e){D[e]?this.disableTheme(e):this.enableTheme(e)},_.prototype.toggle=function(e,t=!1){return this.toggleTheme(e,t)},_.prototype.loadTheme=function(e){const t=Q.loadContent(e,"theme");if(t)return h["fork-ps-1"]&&O.showContentErrors({themes:[t]}),h["fork-ps-2"]&&O.showToast(`${e} could not be loaded. It may not have been loaded.`,{type:"error"}),O.err("ContentManager",`${e} could not be loaded.`,t);const n=Object.values(E).find(t=>t.filename==e);O.log("ContentManager",`${n.name} v${n.version} was loaded.`),h["fork-ps-2"]&&O.showToast(`${n.name} v${n.version} was loaded.`,{type:"success"}),A.dispatch("theme-loaded",n.name)},_.prototype.unloadTheme=function(e){const t=Object.values(E).find(t=>t.filename==e)||E[e];if(!t)return;const n=t.name;D[n]&&this.disableTheme(n,!0);const s=Q.unloadContent(E[n].filename,"theme");if(delete E[n],s)return h["fork-ps-1"]&&O.showContentErrors({themes:[s]}),h["fork-ps-2"]&&O.showToast(`${n} could not be unloaded. It may have not been loaded yet.`,{type:"error"}),O.err("ContentManager",`${n} could not be unloaded. It may have not been loaded yet.`,s);O.log("ContentManager",`${n} was unloaded.`),h["fork-ps-2"]&&O.showToast(`${n} was unloaded.`,{type:"success"}),A.dispatch("theme-unloaded",n)},_.prototype.delete=function(e){const t=Object.values(E).find(t=>t.filename==e)||E[e];if(!t)return;this.unloadTheme(t.filename);const s=n(1).resolve(Q.pluginsFolder,t.filename);n(0).unlinkSync(s)},_.prototype.reloadTheme=function(e){const t=Object.values(E).find(t=>t.filename==e)||E[e];if(!t)return this.loadTheme(e);const n=t.name,s=Q.reloadContent(E[n].filename,"theme");if(D[n]&&(this.disableTheme(n,!0),this.enableTheme(n,!0)),s)return h["fork-ps-1"]&&O.showContentErrors({themes:[s]}),h["fork-ps-2"]&&O.showToast(`${n} could not be reloaded.`,{type:"error"}),O.err("ContentManager",`${n} could not be reloaded.`,s);O.log("ContentManager",`${n} v${E[n].version} was reloaded.`),h["fork-ps-2"]&&O.showToast(`${n} v${E[n].version} was reloaded.`,{type:"success"}),A.dispatch("theme-reloaded",n)},_.prototype.reload=function(e){return this.reloadTheme(e)},_.prototype.edit=function(e){const t=Object.values(E).find(t=>t.filename==e)||E[e];if(!t)return;const s=n(1).resolve(Q.themesFolder,t.filename);n(2).shell.openItem(`${s}`)},_.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)},_.prototype.loadThemeData=function(){const e=ee.getSettingGroup("themes");e&&Object.assign(D,e)},_.prototype.saveThemeData=function(){ee.setSettingGroup("themes",D)};var q=new _;const z=n(1),W=n(0),G=n(4).Module;G.globalPaths.push(z.resolve(n(2).remote.app.getAppPath(),"node_modules"));class H extends Error{constructor(e){super(e),this.name="MetaError"}}const V=G._extensions[".js"],U=G._extensions[".css"]?G._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={},G._extensions[".js"]=this.getContentRequire("plugin"),G._extensions[".css"]=this.getContentRequire("theme")}get pluginsFolder(){return this._pluginsFolder||(this._pluginsFolder=W.realpathSync(z.resolve(m.dataPath+"plugins/")))}get themesFolder(){return this._themesFolder||(this._themesFolder=W.realpathSync(z.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(z.resolve(n,o))}catch(e){if("ENOENT"!==e.code)return;return delete this.timeCache[o],t?I.unloadPlugin(o):q.unloadTheme(o)}if(!W.statSync(z.resolve(n,o)).isFile())return;const i=W.statSync(z.resolve(n,o));i&&i.mtime&&i.mtime.getTime()&&"number"==typeof i.mtime.getTime()&&this.timeCache[o]!=i.mtime.getTime()&&(this.timeCache[o]=i.mtime.getTime(),"rename"==e&&(t?I.loadPlugin(o):q.loadTheme(o)),"change"==e&&(t?I.reloadPlugin(o):q.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 H("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 H("META was not found.");const s=O.testJSON(n);if(!s)throw new H("META could not be parsed.");if(!s.name)throw new H("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?V:U;return function(e,o){const i=t?n.pluginsFolder:n.themesFolder,r=z.resolve(i,z.basename(o));if(!W.existsSync(r)||o!==W.realpathSync(r))return Reflect.apply(s,this,arguments);let a=W.readFileSync(o,"utf8");a=O.stripBOM(a);const l=W.statSync(o),c=n.extractMeta(a);if(c.filename=z.basename(o),c.added=l.atimeMs,c.modified=l.mtimeMs,c.size=l.size,t||(c.css=a,"json"==c.format&&(c.css=c.css.split("\n").slice(1).join("\n")),a=`module.exports = ${JSON.stringify(c)};`),t){e._compile(a,e.filename),!O.isEmpty(e.exports)?(c.type=e.exports,e.exports=c,a=""):a+=`\nmodule.exports = ${JSON.stringify(c)};\nmodule.exports.type = ${c.exports||c.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(z.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(z.resolve(s,e));if(o.id=O.escapeID(o.name),n){if(!o.type)return;try{o.plugin=new o.type,delete x[o.plugin.getName()],x[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 E[o.name],E[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(z.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(z.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),i=Object.values(t?x:E),r=i.filter(e=>!o.includes(e.filename)).map(e=>t?e.plugin.getName():e.name);return{added:o.filter(e=>!i.find(t=>t.filename==e)&&e.endsWith(n)&&W.statSync(z.resolve(s,e)).isFile()),removed:r}}loadAllContent(e){const t="plugin"===e,n=t?".plugin.js":".theme.css",s=t?this.pluginsFolder:this.themesFolder,o=[],i=W.readdirSync(s);for(const t of i){if(!W.statSync(z.resolve(s,t)).isFile()||!t.endsWith(n))continue;const i=this.loadContent(t,e);i&&o.push(i)}return o}loadPlugins(){return this.loadAllContent("plugin")}loadThemes(){return this.loadAllContent("theme")}};const Y=n(0),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),O.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=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(){}te.prototype.init=function(){this.initialized=!0,$(document).on("mousedown",(function(e){"rmenu"!=e.target.id&&$("#rmenu").remove()})),this.favoriteEmotes={};const e=ee.getBDData("bdfavemotes");""!==e&&null!==e&&(this.favoriteEmotes=JSON.parse(atob(e)));let t="";t+='<div id="bda-qem">',t+=' <button class="active" id="bda-qem-twitch" onclick=\'quickEmoteMenu.switchHandler(this); return false;\'>Twitch</button>',t+=" <button id=\"bda-qem-favourite\" onclick='quickEmoteMenu.switchHandler(this); return false;'>Favourite</button>",t+=" <button id=\"bda-qem-emojis\" onclick='quickEmoteMenu.switchHandler(this); return false;'>Emojis</buttond>",t+="</div>",this.qmeHeader='<div id="bda-qem"> <button class="active" id="bda-qem-twitch" onclick=\'quickEmoteMenu.switchHandler(this); return false;\'>Twitch</button> <button id="bda-qem-favourite" onclick=\'quickEmoteMenu.switchHandler(this); return false;\'>Favourite</button> <button id="bda-qem-emojis" onclick=\'quickEmoteMenu.switchHandler(this); return false;\'>Emojis</buttond></div>';let n="";n+='<div id="bda-qem-twitch-container">',n+=' <div class="scroller-wrap scrollerWrap-2lJEkd fade">',n+=' <div class="scroller scroller-2FKFPG">',n+=' <div class="emote-menu-inner">';let s="";for(const e in w.TwitchGlobal)w.TwitchGlobal.hasOwnProperty(e)&&(s=w.TwitchGlobal[e],n+='<div class="emote-container">',n+=' <img class="emote-icon" alt="" src="'+s+'" title="'+e+'">',n+=" </img>",n+="</div>");n+=" </div>",n+=" </div>",n+=" </div>",n+="</div>",this.teContainer=n;let o="";o+='<div id="bda-qem-favourite-container">',o+=' <div class="scroller-wrap scrollerWrap-2lJEkd fade">',o+=' <div class="scroller scroller-2FKFPG">',o+=' <div class="emote-menu-inner">';for(const e in this.favoriteEmotes)s=this.favoriteEmotes[e],o+='<div class="emote-container">',o+=' <img class="emote-icon" alt="" src="'+s+'" title="'+e+"\" oncontextmenu='quickEmoteMenu.favContext(event, this);'>",o+=" </img>",o+="</div>";o+=" </div>",o+=" </div>",o+=" </div>",o+="</div>",this.faContainer=o},te.prototype.favContext=function(e,t){e.stopPropagation();const n=$("<div>",{id:"removemenu","data-emoteid":$(t).prop("title"),text:"Remove",class:"bd-context-menu context-menu theme-dark"});n.css({top:e.pageY-$("#bda-qem-favourite-container").offset().top,left:e.pageX-$("#bda-qem-favourite-container").offset().left}),$(t).parent().append(n);const s=this;return n.on("click",(function(e){return e.preventDefault(),e.stopPropagation(),$(this).remove(),delete s.favoriteEmotes[$(this).data("emoteid")],s.updateFavorites(),!1})),!1},te.prototype.switchHandler=function(e){this.switchQem($(e).attr("id"))},te.prototype.switchQem=function(e){const t=$("#bda-qem-twitch"),n=$("#bda-qem-favourite"),s=$("#bda-qem-emojis");switch(t.removeClass("active"),n.removeClass("active"),s.removeClass("active"),$(".emojiPicker-3m1S-j").hide(),$("#bda-qem-favourite-container").hide(),$("#bda-qem-twitch-container").hide(),e){case"bda-qem-twitch":t.addClass("active"),$("#bda-qem-twitch-container").show();break;case"bda-qem-favourite":n.addClass("active"),$("#bda-qem-favourite-container").show();break;case"bda-qem-emojis":s.addClass("active"),$(".emojiPicker-3m1S-j").show(),$(".emojiPicker-3m1S-j input").focus()}this.lastTab=e;const o=$(".emote-icon");o.off(),o.on("click",(function(){const e=$(this).attr("title"),t=document.querySelector(`.${j.slateEditorClasses.slateTextArea.split(" ")[0]}`);if(t){const n=j.getInternalInstance(t),s=O.getNestedProp(n,"memoizedProps.children.props.editor.insertText");s&&s(` ${e} `)}else{const t=O.getTextArea();O.insertText(t[0]," "==t.val().slice(-1)?t.val()+e:t.val()+" "+e)}}))},te.prototype.obsCallback=function(e){if(!this.initialized)return;const t=$(e);h["bda-es-9"]?t.removeClass("bda-qme-hidden"):t.addClass("bda-qme-hidden"),h["bda-es-0"]&&(t.prepend(this.qmeHeader),t.append(this.teContainer),t.append(this.faContainer),null==this.lastTab&&(this.lastTab="bda-qem-emojis"),this.switchQem(this.lastTab))},te.prototype.favorite=function(e,t){this.favoriteEmotes.hasOwnProperty(e)||(this.favoriteEmotes[e]=t),this.updateFavorites()},te.prototype.updateFavorites=function(){let e="";e+='<div id="bda-qem-favourite-container">',e+=' <div class="scroller-wrap scrollerWrap-2lJEkd fade">',e+=' <div class="scroller scroller-2FKFPG">',e+=' <div class="emote-menu-inner">';for(const t in this.favoriteEmotes){e+='<div class="emote-container">',e+=' <img class="emote-icon" alt="" src="'+this.favoriteEmotes[t]+'" title="'+t+'" oncontextmenu="quickEmoteMenu.favContext(event, this);">',e+=" </img>",e+="</div>"}e+=" </div>",e+=" </div>",e+=" </div>",e+="</div>",this.faContainer=e,$("#bda-qem-favourite-container").replaceWith(e),ee.setBDData("bdfavemotes",btoa(JSON.stringify(this.favoriteEmotes)))};var ne=new te;class se extends j.reactComponent{constructor(e){super(e);const t=!!(ne&&ne.favoriteEmotes&&ne.favoriteEmotes[this.label]);this.state={shouldAnimate:!this.animateOnHover,isFavorite:t},this.onMouseEnter=this.onMouseEnter.bind(this),this.onMouseLeave=this.onMouseLeave.bind(this),this.onClick=this.onClick.bind(this)}get animateOnHover(){return h["fork-es-2"]}get label(){return this.props.modifier?`${this.props.name}:${this.props.modifier}`:this.props.name}get modifierClass(){return this.props.modifier?` emote${this.props.modifier}`:""}onMouseEnter(){!this.state.shouldAnimate&&this.animateOnHover&&this.setState({shouldAnimate:!0}),!this.state.isFavorite&&ne.favoriteEmotes[this.label]?this.setState({isFavorite:!0}):this.state.isFavorite&&!ne.favoriteEmotes[this.label]&&this.setState({isFavorite:!1})}onMouseLeave(){this.state.shouldAnimate&&this.animateOnHover&&this.setState({shouldAnimate:!1})}onClick(e){this.props.onClick&&this.props.onClick(e)}render(){return j.react.createElement(j.TooltipWrapper,{color:"black",position:"top",text:this.label,delay:750},e=>j.react.createElement("div",Object.assign({className:"emotewrapper"+(this.props.jumboable?" jumboable":""),onMouseEnter:this.onMouseEnter,onMouseLeave:this.onMouseLeave,onClick:this.onClick},e),j.react.createElement("img",{draggable:!1,className:"emote"+this.modifierClass+(this.props.jumboable?" jumboable":"")+(this.state.shouldAnimate?"":" stop-animation"),dataModifier:this.props.modifier,alt:this.label,src:this.props.url}),j.react.createElement("input",{className:"fav"+(this.state.isFavorite?" active":""),title:"Favorite!",type:"button",onClick:e=>{e.preventDefault(),e.stopPropagation(),this.state.isFavorite?(delete ne.favoriteEmotes[this.label],ne.updateFavorites()):ne.favorite(this.label,this.props.url),this.setState({isFavorite:!this.state.isFavorite})}})))}}function oe(){Object.defineProperty(this,"categories",{get:function(){const e=[];for(const t in k)h[k[t]]&&e.push(t);return e}})}oe.prototype.init=async function(){this.modifiers=["flip","spin","pulse","spin2","spin3","1spin","2spin","3spin","tr","bl","br","shake","shake2","shake3","flap"],this.overrides=["twitch","bttv","ffz"];const e={TwitchGlobal:{url:"https://rauenzi.github.io/BetterDiscordApp/data/emotedata_twitch_global.json",variable:"TwitchGlobal",oldVariable:"emotesTwitch",getEmoteURL:e=>`https://static-cdn.jtvnw.net/emoticons/v1/${e}/1.0`},TwitchSubscriber:{url:"https://rauenzi.github.io/BetterDiscordApp/data/emotedata_twitch_subscriber.json",variable:"TwitchSubscriber",oldVariable:"subEmotesTwitch",getEmoteURL:e=>`https://static-cdn.jtvnw.net/emoticons/v1/${e}/1.0`},FrankerFaceZ:{url:"https://rauenzi.github.io/BetterDiscordApp/data/emotedata_ffz.json",variable:"FrankerFaceZ",oldVariable:"emotesFfz",getEmoteURL:e=>`https://cdn.frankerfacez.com/emoticon/${e}/1`},BTTV:{url:"https://rauenzi.github.io/BetterDiscordApp/data/emotedata_bttv.json",variable:"BTTV",oldVariable:"emotesBTTV",getEmoteURL:e=>`https://cdn.betterttv.net/emote/${e}/1x`},BTTV2:{url:"https://rauenzi.github.io/BetterDiscordApp/data/emotedata_bttv2.json",variable:"BTTV2",oldVariable:"emotesBTTV2",getEmoteURL:e=>`https://cdn.betterttv.net/emote/${e}/1x`}};for(await this.getBlacklist(),await this.loadEmoteData(e);!j.MessageComponent;)await new Promise(e=>setTimeout(e,100));this.cancelEmoteRender||(this.cancelEmoteRender=O.monkeyPatch(j.MessageComponent,"default",{before:({methodArguments:e})=>{const t=e[0].childrenMessageContent.props.content;if(t&&t.length){for(let e=0;e<t.length;e++){const n=t[e];if("string"!=typeof n)continue;const s=n.split(/([^\s]+)([\s]|$)/g);for(let n=0,o=this.categories.length;n<o;n++)for(let o=0,i=s.length;o<i;o++){const i=s[o].split(":"),r=i[0];let a=i[1]?i[1]:"",l=a.slice(0);if(r.length<4||g.includes(r))continue;this.modifiers.includes(a)&&h["bda-es-8"]||(a=""),this.overrides.includes(l)?a=l:l="";let c=this.categories[n];if("twitch"===l?w.TwitchGlobal[r]?c="TwitchGlobal":w.TwitchSubscriber[r]&&(c="TwitchSubscriber"):"bttv"===l?w.BTTV[r]?c="BTTV":w.BTTV2[r]&&(c="BTTV2"):"ffz"===l&&w.FrankerFaceZ[r]&&(c="FrankerFaceZ"),!w[c][r]||!h[k[c]])continue;const d=t[e].match(new RegExp(`([\\s]|^)${O.escape(a?r+":"+a:r)}([\\s]|$)`));if(!d)continue;const u=t[e].substring(0,d.index+d[1].length),p=t[e].substring(d.index+d[0].length-d[2].length);t[e]=u;const m=j.react.createElement(se,{name:r,url:w[c][r],modifier:a});t.splice(e+1,0,p),t.splice(e+1,0,m)}}if(t.every(e=>"string"==typeof e&&""==e.replace(/\s*/,"")||(!(!e.type||"BDEmote"!=e.type.name)||!!(e.props&&e.props.children&&e.props.children.props&&e.props.children.props.emojiName))))for(const e of t)"object"==typeof e&&("BDEmote"==e.type.name?e.props.jumboable=!0:e.props&&e.props.children&&e.props.children.props&&e.props.children.props.emojiName&&(e.props.children.props.jumboable=!0))}}}))},oe.prototype.disable=function(){this.disableAutoCapitalize(),this.cancelEmoteRender||(this.cancelEmoteRender(),this.cancelEmoteRender=null)},oe.prototype.clearEmoteData=async function(){const e=n(0),t=m.dataPath+"emote_data.json";e.existsSync(t)&&e.unlinkSync(t),ee.setBDData("emoteCacheDate",(new Date).toJSON()),Object.assign(w,{TwitchGlobal:{},TwitchSubscriber:{},BTTV:{},FrankerFaceZ:{},BTTV2:{}})},oe.prototype.isCacheValid=function(){const e=ee.getBDData("emoteCacheDays")||ee.setBDData("emoteCacheDays",7)||7,t=new Date(ee.getBDData("emoteCacheDate")||null),n=new Date;return!(Math.round(Math.abs((n.getTime()-t.getTime())/864e5))>e)||(ee.setBDData("emoteCacheDate",n.toJSON()),!1)},oe.prototype.loadEmoteData=async function(e){const t=n(0),s=m.dataPath+"emote_data.json";if(await new Promise(e=>t.exists(s,e))&&this.isCacheValid()){h["fork-ps-2"]&&O.showToast("Loading emotes from cache.",{type:"info"}),O.log("Emotes","Loading emotes from local cache.");const n=await new Promise(e=>{t.readFile(s,"utf8",(t,n)=>{O.log("Emotes","Emote file read."),t&&(n={}),e(n)})}),o=O.testJSON(n);let i=!!o;i&&Object.assign(w,o);for(const t in e)i=Object.keys(w[e[t].variable]).length>0;if(i)return void(h["fork-ps-2"]&&O.showToast("Emotes successfully loaded.",{type:"success"}));O.log("Emotes","Cache was corrupt, downloading..."),await new Promise(e=>t.unlink(s,e))}if(h["fork-es-3"]){h["fork-ps-2"]&&O.showToast("Downloading emotes in the background do not reload.",{type:"info"});for(const t in e){await new Promise(e=>setTimeout(e,1e3));const n=await this.downloadEmotes(e[t]);w[e[t].variable]=n}h["fork-ps-2"]&&O.showToast("All emotes successfully downloaded.",{type:"success"});try{await new Promise(e=>t.writeFile(s,JSON.stringify(w),"utf8",e))}catch(e){O.err("Emotes","Could not save emote data.",e)}}},oe.prototype.downloadEmotes=function(e){const t=n(5),s={url:e.url,timeout:e.timeout?e.timeout:5e3,json:!0};return O.log("Emotes",`Downloading: ${e.variable} (${e.url})`),new Promise((n,o)=>{t(s,(t,s,i)=>{if(t)return O.err("Emotes","Could not download "+e.variable,t),e.backup?(e.url=e.backup,e.backup=null,e.backupParser&&(e.parser=e.backupParser),n(this.downloadEmotes(e))):o({});"function"==typeof e.parser&&(i=e.parser(i));for(const t in i)t.length<4||g.includes(t)?delete i[t]:i[t]=e.getEmoteURL(i[t]);n(i),O.log("Emotes","Downloaded: "+e.variable)})})},oe.prototype.getBlacklist=function(){return new Promise(e=>{$.getJSON("https://rauenzi.github.io/BetterDiscordApp/data/emotefilter.json",(function(t){e(g.concat(t.blacklist))}))})},oe.prototype.autoCapitalize=function(){h["bda-es-4"]&&!this.autoCapitalizeActive&&($("body").on("keyup.bdac change.bdac paste.bdac",$(".channelTextArea-rNsIhG textarea:first"),()=>{const e=$(".channelTextArea-rNsIhG textarea:first").val();if(null==e)return;const t=e.split(" ").pop();if(t.length>3){if("danSgame"==t)return;const n=this.capitalize(t.toLowerCase());null!=n&&O.insertText(O.getTextArea()[0],e.replace(t,n))}}),this.autoCapitalizeActive=!0)},oe.prototype.capitalize=function(e){const t=w.TwitchGlobal;for(const n in t)if(t.hasOwnProperty(n)&&e==(n+"").toLowerCase())return n},oe.prototype.disableAutoCapitalize=function(){this.autoCapitalizeActive=!1,$("body").off(".bdac")};var ie=new oe;class re extends j.reactComponent{constructor(e){super(e)}render(){return j.react.createElement("div",{className:"ui-tab-bar-separator margin-top-8 margin-bottom-8"})}}class ae extends j.reactComponent{constructor(e){super(e)}render(){return j.react.createElement("div",{className:"ui-tab-bar-header"},this.props.text,this.props.button)}}class le extends j.reactComponent{constructor(e){super(e),this.setInitialState(),this.onClick=this.onClick.bind(this)}setInitialState(){this.state={selected:this.props.selected||!1}}render(){return j.react.createElement("div",{className:`ui-tab-bar-item${this.props.selected?" selected":""}`,onClick:this.onClick},this.props.text)}onClick(){this.props.onClick&&this.props.onClick(this.props.id)}}class ce extends j.reactComponent{constructor(e){super(e);const t=this,n=$("[class*=side-] > [class*=selected]");n.length&&(t.scn=n.attr("class"));const s=$("[class*=side-] > [class*='item-']:not([class*=selected])");s.length&&(t.nscn=s.attr("class")),$("[class*='side-'] > [class*='item-']").on("click",()=>{t.setState({selected:null})}),t.setInitialState(),t.onClick=t.onClick.bind(t)}setInitialState(){const e=this;e.state={selected:null,items:e.props.items};const t=e.props.items.find(e=>e.selected);t&&(e.state.selected=t.id)}render(){const e=this,{headerText:t}=e.props,{items:n,selected:s}=e.state;return j.react.createElement("div",null,j.react.createElement(re,null),j.react.createElement(ae,{text:t,button:this.props.headerButton}),n.map(t=>{const{id:n,text:o}=t;return j.react.createElement(le,{key:n,selected:s===n,text:o,id:n,onClick:e.onClick})}))}onClick(e){const t=this,n=$("[class*=side] > [class*=selected]");n.length&&(n.off("click.bdsb").on("click.bsb",e=>{$(e.target).attr("class",t.scn)}),n.attr("class",t.nscn)),t.setState({selected:null}),t.setState({selected:e}),t.props.onClick&&t.props.onClick(e)}}const de=j.React;class he extends de.Component{render(){const e=this.props.size||"18px";return de.createElement("svg",{viewBox:"0 0 24 24",fill:"#FFFFFF",className:this.props.className||"",style:{width:e,height:e},onClick:this.props.onClick},de.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),de.createElement("path",{d:"M13 3c-4.97 0-9 4.03-9 9H1l3.89 3.89.07.14L9 12H6c0-3.87 3.13-7 7-7s7 3.13 7 7-3.13 7-7 7c-1.93 0-3.68-.79-4.94-2.06l-1.42 1.42C8.27 19.99 10.51 21 13 21c4.97 0 9-4.03 9-9s-4.03-9-9-9zm-1 5v5l4.28 2.54.72-1.21-3.5-2.08V8H12z"}))}}const ue=B("tooltip","tooltipBlack"),pe=B("layer","layerContainer"),me=function(e){const t=e[0].toUpperCase()+e.slice(1),n=ue[`tooltip${t}`];return n||null},ge=function(e){return!!me(e)},fe=function(e){return`${e}px`};class be{constructor(e,t,n={}){const{style:s="black",side:o="top",preventFlip:i=!1,disabled:r=!1}=n;return this.node=e instanceof jQuery?e[0]:e,this.label=t,this.style=s.toLowerCase(),this.side=o.toLowerCase(),this.preventFlip=i,this.disabled=r,ge(this.side)?ge(this.style)?(this.element=$(`<div class="${pe.layer}">`)[0],this.tooltipElement=$(`<div class="${ue.tooltip} ${me(this.style)}"><div class="${ue.tooltipPointer}"></div>${this.label}</div>`)[0],this.labelElement=this.tooltipElement.childNodes[1],this.element.append(this.tooltipElement),this.node.addEventListener("mouseenter",()=>{if(this.disabled)return;this.show();const e=new MutationObserver(t=>{t.forEach(t=>{const n=Array.from(t.removedNodes),s=n.indexOf(this.node)>-1,o=n.some(e=>e.contains(this.node));(s||o)&&(this.hide(),e.disconnect())})});e.observe(document.body,{subtree:!0,childList:!0})}),void this.node.addEventListener("mouseleave",()=>{this.hide()})):O.err("EmulatedTooltip",`Style ${this.style} does not exist.`):O.err("EmulatedTooltip",`Side ${this.side} does not exist.`)}get container(){return document.querySelector(".popouts-2bnG9Z ~ .layerContainer-yqaFcK")}get canShowAbove(){return this.node.getBoundingClientRect().top-this.element.offsetHeight>=0}get canShowBelow(){return this.node.getBoundingClientRect().top+this.node.offsetHeight+this.element.offsetHeight<=O.screenHeight}get canShowLeft(){return this.node.getBoundingClientRect().left-this.element.offsetWidth>=0}get canShowRight(){return this.node.getBoundingClientRect().left+this.node.offsetWidth+this.element.offsetWidth<=O.screenWidth}hide(){this.element.remove(),this.tooltipElement.className=this._className}show(){this.tooltipElement.className=`${ue.tooltip} ${me(this.style)}`,this.labelElement.textContent=this.label,this.element.appendTo(this.container),"top"==this.side&&(this.canShowAbove||!this.canShowAbove&&this.preventFlip?this.showAbove():this.showBelow()),"bottom"==this.side&&(this.canShowBelow||!this.canShowBelow&&this.preventFlip?this.showBelow():this.showAbove()),"left"==this.side&&(this.canShowLeft||!this.canShowLeft&&this.preventFlip?this.showLeft():this.showRight()),"right"==this.side&&(this.canShowRight||!this.canShowRight&&this.preventFlip?this.showRight():this.showLeft())}showAbove(){this.tooltipElement.addClass(me("top")),this.element.style.setProperty("top",fe(this.node.getBoundingClientRect().top-this.element.offsetHeight-10)),this.centerHorizontally()}showBelow(){this.tooltipElement.addClass(me("bottom")),this.element.style.setProperty("top",fe(this.node.getBoundingClientRect().top+this.node.offsetHeight+10)),this.centerHorizontally()}showLeft(){this.tooltipElement.addClass(me("left")),this.element.style.setProperty("left",fe(this.node.getBoundingClientRect().left-this.element.offsetWidth-10)),this.centerVertically()}showRight(){this.tooltipElement.addClass(me("right")),this.element.style.setProperty("left",fe(this.node.getBoundingClientRect().left+this.node.offsetWidth+10)),this.centerVertically()}centerHorizontally(){const e=this.node.getBoundingClientRect().left+this.node.offsetWidth/2;this.element.style.setProperty("left",fe(e-this.element.offsetWidth/2))}centerVertically(){const e=this.node.getBoundingClientRect().top+this.node.offsetHeight/2;this.element.style.setProperty("top",fe(e-this.element.offsetHeight/2))}}var ve=class extends j.reactComponent{constructor(e){super(e),this.onMouseEnter=this.onMouseEnter.bind(this),this.onMouseLeave=this.onMouseLeave.bind(this)}componentDidMount(){const{style:e="black",side:t="top",text:n=""}=this.props;this.node=j.reactDom.findDOMNode(this),this.tooltip=new be(this.node,n,{style:e,side:t})}componentWillUnmount(){this.tooltip.hide(),delete this.tooltip}onMouseEnter(){}onMouseLeave(){}render(){return this.props.children}};class ye{constructor(e){this.onClick=e}get items(){return[{text:"Settings",id:"core"},{text:"Emotes",id:"emotes"},{text:"Plugins",id:"plugins"},{text:"Themes",id:"themes"},{text:"Custom CSS",id:"customcss"}]}get component(){const e=j.react.createElement(ve,{color:"black",side:"top",text:"Changelog"},j.react.createElement("div",{className:"bd-changelog-button",onClick:()=>{O.showChangelogModal(l)}},j.react.createElement(he,{className:"bd-icon",size:"16px"})));return j.react.createElement("span",null,j.react.createElement(ce,{onClick:this.onClick,headerText:"Bandaged BD",headerButton:e,items:this.items}))}get root(){const e=$("#bd-settings-sidebar");return e.length?e[0]:this.injectRoot()?this.root:null}injectRoot(){const e=$("[class*='side-'] > [class*='item-']:not([class*=Danger])").last();return!!e.length&&($("<span/>",{id:"bd-settings-sidebar"}).insertBefore(e.prev()),!0)}render(){const e=this.root;e?(j.reactDom.render(this.component,e),O.onRemoved(e,()=>{j.reactDom.unmountComponentAtNode(e)})):console.log("FAILED TO LOCATE ROOT: [class*='side-'] > [class*='item-']:not([class*=Danger])")}}var Ce=new class{injectColoredText(){this.cancelColoredText||j.MessageComponent&&(this.cancelColoredText=O.monkeyPatch(j.MessageComponent,"default",{before:e=>{const t=e.methodArguments[0];if(!t||!t.childrenMessageContent)return;const n=t.childrenMessageContent;if(!n.type||!n.type.type||"MessageContent"!=n.type.type.displayName)return;const s=n.type.type;s.__originalMethod||(n.type.type=function(e){const t=s(e),n=h["bda-gs-7"]&&e.message.colorString||"";return t.props.style={color:n},t},n.type.type.__originalMethod=s,Object.assign(n.type.type,s))}}))}removeColoredText(){document.querySelectorAll(".markup-2BOw-j").forEach(e=>{e.style.setProperty("color","")})}},we=new class{inject24Hour(){if(this.cancel24Hour)return;const e=new RegExp("([0-9]{1,2}):([0-9]{1,2})\\s(AM|PM)"),t=t=>{if(!h["bda-gs-6"])return;const n=t.returnValue.match(e);return n&&4===n.length?"AM"===n[3]?t.returnValue=t.returnValue.replace(n[0],`${"12"===n[1]?"00":n[1].padStart(2,"0")}:${n[2]}`):t.returnValue=t.returnValue.replace(n[0],`${"12"===n[1]?"12":parseInt(n[1])+12}:${n[2]}`):void 0},n=O.monkeyPatch(j.TimeFormatter,"calendarFormat",{after:t}),s=O.monkeyPatch(j.TimeFormatter,"dateFormat",{after:t});this.cancel24Hour=()=>{n(),s()}}remove24Hour(){this.cancel24Hour&&this.cancel24Hour()}};const ke=n(2),Ee=n(0),xe=n(1),Se=ke.remote.BrowserWindow,De=Se.getAllWindows()[0];var Te=new class{constructor(){let e="";if("win32"===process.platform&&(e=xe.resolve(process.env.LOCALAPPDATA,"Google/Chrome/User Data")),"linux"===process.platform&&(e=xe.resolve(process.env.HOME,".config/google-chrome")),"darwin"===process.platform&&(e=xe.resolve(process.env.HOME,"Library/Application Support/Google/Chrome")),e+="/Default/Extensions/fmkadmapgofadopljbjfkapdkoienihi/",Ee.existsSync(e)){const t=Ee.readdirSync(e);e=xe.resolve(e,t[t.length-1])}this.extensionPath=e,this.isExtensionInstalled=Ee.existsSync(e),this.listener=this.listener.bind(this),c["React DevTools"].hidden=!this.isExtensionInstalled}listener(){if(!this.isExtensionInstalled)return;Se.removeDevToolsExtension("React Developer Tools"),Se.addDevToolsExtension(this.extensionPath)?O.log("React DevTools","Successfully installed react devtools."):O.err("React DevTools","Couldn't find react devtools in chrome extensions!")}start(){De.webContents.on("devtools-opened",this.listener)}stop(){De.webContents.removeListener("devtools-opened",this.listener)}};class Pe extends j.reactComponent{constructor(e){super(e)}render(){return j.react.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 12 12",style:{width:"18px",height:"18px"}},j.react.createElement("g",{className:"background",fill:"none",fillRule:"evenodd"},j.react.createElement("path",{d:"M0 0h12v12H0"}),j.react.createElement("path",{className:"fill",fill:"#dcddde",d:"M9.5 3.205L8.795 2.5 6 5.295 3.205 2.5l-.705.705L5.295 6 2.5 8.795l.705.705L6 6.705 8.795 9.5l.705-.705L6.705 6"})))}}class $e extends j.reactComponent{constructor(e){super(e),this.onClick=this.onClick.bind(this)}render(){return j.react.createElement("div",{className:"tools-container toolsContainer-1edPuj"},j.react.createElement("div",{className:"tools tools-3-3s-N"},j.react.createElement("div",{className:"container-1sFeqf"},j.react.createElement("div",{className:"btn-close closeButton-1tv5uR",onClick:this.onClick},j.react.createElement(Pe,null)),j.react.createElement("div",{className:"esc-text keybind-KpFkfr"},"ESC"))))}onClick(){this.props.onClick&&this.props.onClick(),$(".closeButton-1tv5uR").first().click()}}class Ne extends j.reactComponent{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.react.createElement("div",{className:`card-3Qj_Yx cardPrimary-1Hv-to marginBottom8-AtZOdT bd-server-card${e.pinned?" bd-server-card-pinned":""}`},j.react.createElement("img",{ref:"img",className:"bd-server-image",src:e.iconUrl,onError:this.handleError.bind(this)}),j.react.createElement("div",{className:"flexChild-faoVW3 bd-server-content"},j.react.createElement("div",{className:"flex-1xMQg5 flex-1O1GKY horizontal-1ae9ci horizontal-2EEEnY directionRow-3v3tfG noWrap-3jynv6 bd-server-header"},j.react.createElement("h5",{className:"h5-18_1nd defaultColor-1_ajX0 margin-reset bd-server-name"},e.name),j.react.createElement("h5",{className:"h5-18_1nd defaultColor-1_ajX0 margin-reset bd-server-member-count"},e.members," Members")),j.react.createElement("div",{className:"flex-1xMQg5 flex-1O1GKY horizontal-1ae9ci horizontal-2EEEnY directionRow-3v3tfG noWrap-3jynv6"},j.react.createElement("div",{className:"scrollerWrap-2lJEkd scrollerThemed-2oenus themeGhostHairline-DBD-2d scrollerFade-1Ijw5y bd-server-description-container"},j.react.createElement("div",{className:"scroller-2FKFPG scroller bd-server-description"},e.description))),j.react.createElement("div",{className:"flex-1xMQg5 flex-1O1GKY horizontal-1ae9ci horizontal-2EEEnY directionRow-3v3tfG noWrap-3jynv6 bd-server-footer"},j.react.createElement("div",{className:"flexChild-faoVW3 bd-server-tags",style:{flex:"1 1 auto"}},e.categories.join(", ")),this.state.joined&&j.react.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.react.createElement("div",{className:"ui-button-contents"},"Joined")),e.error&&j.react.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.react.createElement("div",{className:"ui-button-contents"},"Error")),!e.error&&!this.state.joined&&j.react.createElement("button",{type:"button",className:"button-38aScr lookFilled-1Gx00P colorBrand-3pXr91 sizeMin-1mJd1x grow-q77ONN",style:{minHeight:"12px",marginTop:"4px"},onClick:()=>{this.join()}},j.react.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 Me extends j.reactComponent{constructor(e){super(e)}render(){let e=`scrollerWrap-2lJEkd scrollerThemed-2oenus themeGhostHairline-DBD-2d${this.props.fade?" scrollerFade-1Ijw5y":""}`,t="scroller-2FKFPG scroller";this.props.sidebar&&(t="scroller-2FKFPG firefoxFixScrollFlex-cnI2ix sidebarRegionScroller-3MXcoP sidebar-region-scroller scroller"),this.props.contentColumn&&(t="scroller-2FKFPG firefoxFixScrollFlex-cnI2ix contentRegionScroller-26nc1e content-region-scroller scroller",e="scrollerWrap-2lJEkd firefoxFixScrollFlex-cnI2ix contentRegionScrollerWrap-3YZXdm content-region-scroller-wrap scrollerThemed-2oenus themeGhost-28MSn0 scrollerTrack-1ZIpsv");const{children:n}=this.props;return j.react.createElement("div",{key:"scrollerwrap",className:e},j.react.createElement("div",{key:"scroller",ref:"scroller",className:t},n))}}class Be extends j.reactComponent{constructor(e){super(e)}render(){const{sidebar:e,content:t,tools:n}=this.props.children;return j.react.createElement("div",{className:"standardSidebarView-3F1I7i ui-standard-sidebar-view"},j.react.createElement("div",{className:"sidebarRegion-VFTUkN sidebar-region"},j.react.createElement(Me,{key:"sidebarScroller",ref:"sidebarScroller",sidebar:!0,fade:e.fade||!0,dark:e.dark||!0,children:e.component})),j.react.createElement("div",{className:"contentRegion-3nDuYy content-region"},j.react.createElement("div",{className:"contentTransitionWrap-3hqOEW content-transition-wrap"},j.react.createElement("div",{className:"scrollerWrap-2lJEkd firefoxFixScrollFlex-cnI2ix contentRegionScrollerWrap-3YZXdm content-region-scroller-wrap scrollerThemed-2oenus themeGhost-28MSn0 scrollerTrack-1ZIpsv"},j.react.createElement("div",{className:"scroller-2FKFPG firefoxFixScrollFlex-cnI2ix contentRegionScroller-26nc1e content-region-scroller scroller",ref:"contentScroller"},j.react.createElement("div",{className:"contentColumn-2hrIYH contentColumnDefault-1VQkGM content-column default"},t.component),n.component)))))}}class Fe extends j.reactComponent{constructor(e){super(e)}render(){return j.react.createElement("h2",{className:"ui-form-title h2 margin-reset margin-bottom-20 marginTop60-3PGbtK da-marginTop6"},this.props.text)}}class je extends j.reactComponent{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=j.WebpackModules.findByUniqueProperties(["getGuilds"]),this.AvatarDefaults=j.WebpackModules.findByUniqueProperties(["getUserAvatarURL","DEFAULT_AVATARS"]),this.InviteActions=j.WebpackModules.findByUniqueProperties(["acceptInvite"]),this.SortedGuildStore=j.WebpackModules.findByUniqueProperties(["getSortedGuilds"])}componentDidMount(){this.checkConnection()}setInitialState(){this.state={selectedCategory:-1,title:"Loading...",loading:!0,servers:[],next:null,connection:{state:0,user:null}}}close(){j.reactDom.unmountComponentAtNode(document.getElementById(this.props.rootId))}search(e,t){const n=this;$.ajax({method:"GET",url:`${n.endPoint}${e}${e?"&schema=new":"?schema=new"}`,success:e=>{let s=e.results.reduce((e,t)=>(t.joined=!1,e.push(t),e),[]);t||(s=n.state.servers.concat(s));let o=e.size+e.from;e.next=`?from=${o}`,n.state.term&&(e.next+=`&term=${n.state.term}`),n.state.selectedCategory&&(e.next+=`&category=${n.categoryButtons[n.state.selectedCategory]}`),o>=e.total&&(o=e.total,e.next=null);let i=`Showing 1-${o} of ${e.total} results in ${n.categoryButtons[n.state.selectedCategory]}`;n.state.term&&(i+=` for ${n.state.term}`),n.setState({loading:!1,title:i,servers:s,next:e.next}),t&&(n.refs.sbv.refs.contentScroller.scrollTop=0)},error:()=>{n.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,t=e.windowOptions;t.x=Math.round(window.screenX+window.innerWidth/2-t.width/2),t.y=Math.round(window.screenY+window.innerHeight/2-t.height/2),e.joinWindow=new(window.require("electron").remote.BrowserWindow)(t);e.joinWindow.webContents.on("did-navigate",(t,n)=>{"https://auth.discordservers.com/info"==n&&(e.joinWindow.close(),e.checkConnection())}),e.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.getFlattenedGuildIds(),t=this.AvatarDefaults.DEFAULT_AVATARS;return j.react.createElement(Ne,{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.react.createElement(Be,{ref:"sbv",children:this.component})}get component(){return{sidebar:{component:this.sidebar},content:{component:this.content},tools:{component:j.react.createElement($e,{key:"pt",ref:"tools",onClick:this.close})}}}get sidebar(){return j.react.createElement("div",{className:"sidebar",key:"ps"},j.react.createElement("div",{className:"ui-tab-bar SIDE"},j.react.createElement("div",{className:"ui-tab-bar-header",style:{fontSize:"16px"}},"Public Servers"),j.react.createElement(re,null),this.searchInput,j.react.createElement(re,null),j.react.createElement(ae,{text:"Categories"}),this.categoryButtons.map((e,t)=>j.react.createElement(le,{id:t,onClick:this.changeCategory,key:t,text:e,selected:this.state.selectedCategory===t})),j.react.createElement(re,null),this.footer,this.connection))}get searchInput(){return j.react.createElement("div",{className:"ui-form-item"},j.react.createElement("div",{className:"ui-text-input flex-vertical",style:{width:"172px",marginLeft:"10px"}},j.react.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 n=`?term=${e.target.value}`;0!==t.state.selectedCategory&&(n+=`&category=${t.categoryButtons[t.state.selectedCategory]}`),t.search(n,!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.getFlattenedGuildIds(),n=this.AvatarDefaults.DEFAULT_AVATARS;return 1===e.state.connection.state?e.notConnected:[j.react.createElement("div",{ref:"content",key:"pc",className:"contentColumn-2hrIYH contentColumnDefault-1VQkGM content-column default"},j.react.createElement(Fe,{text:e.state.title}),e.bdServer,e.state.servers.map(s=>j.react.createElement(Ne,{key:s.identifier,server:s,join:e.join,guildList:t,fallback:n[Math.floor(5*Math.random())]})),e.state.next&&j.react.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.react.createElement("div",{className:"ui-button-contents"},e.state.loading?"Loading":"Load More")),e.state.servers.length>0&&j.react.createElement(Fe,{text:e.state.title}))]}get notConnected(){return[j.react.createElement("div",{key:"ncc",ref:"content",className:"contentColumn-2hrIYH contentColumnDefault-1VQkGM content-column default"},j.react.createElement("h2",{className:"ui-form-title h2 margin-reset margin-bottom-20"},"Not connected to discordservers.com!",j.react.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.react.createElement("div",{className:"ui-button-contents"},"Connect"))),this.bdServer)]}get footer(){return j.react.createElement("div",{className:"ui-tab-bar-header"},j.react.createElement("a",{href:"https://discordservers.com",target:"_blank"},"Discordservers.com"))}get connection(){const{connection:e}=this.state;return 2!==e.state?j.react.createElement("span",null):j.react.createElement("span",null,j.react.createElement(re,null),j.react.createElement("span",{style:{color:"#b9bbbe",fontSize:"10px",marginLeft:"10px"}},"Connected as: ",`${e.user.username}#${e.user.discriminator}`),j.react.createElement("div",{style:{padding:"5px 10px 0 10px"}},j.react.createElement("button",{style:{width:"100%",minHeight:"20px"},type:"button",className:"ui-button filled brand small grow"},j.react.createElement("div",{className:"ui-button-contents",onClick:this.connect},"Reconnect"))))}}class Oe extends j.reactComponent{constructor(e){super(e)}componentDidMount(){$(window).on(`keyup.${this.props.id}`,e=>{27===e.which&&j.reactDom.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.react.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 Le=new class{constructor(){this._appendButton=this._appendButton.bind(this)}get component(){return j.react.createElement(Oe,{rootId:"pubslayerroot",id:"pubslayer",children:j.react.createElement(je,{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($("<div/>",{id:"pubslayerroot"})),!0)}render(){const e=this.root;e?j.reactDom.render(this.component,e):console.log("FAILED TO LOCATE ROOT: .layers")}get button(){return $("<div/>",{class:j.guildClasses.listItem,id:"bd-pub-li",style:h["bda-gs-1"]?"":"display: none;"}).append($("<div/>",{class:"wrapper-25eVIn "+j.guildClasses.circleButtonMask,text:"public",id:"bd-pub-button",click:()=>{this.render()}}))}_appendButton(){if($("#bd-pub-li").length)return;const e=j.guildClasses.wrapper.split(" ")[0];$(`.${e} .scroller-2FKFPG >:first-child`).after(this.button)}addButton(){if(this.guildPatch)return;const e=F("Guilds");this.guildPatch=O.monkeyPatch(e.prototype,"render",{after:this._appendButton}),this._appendButton()}removeButton(){this.guildPatch(),delete this.guildPatch,$("#bd-pub-li").remove()}};function Ae(){}Ae.prototype.enable=function(){$(".scroller.guild-channels ul").first().css("display","none"),$(".scroller.guild-channels header").first().css("display","none"),$(".app.flex-vertical, .app-2rEoOp").first().css("overflow","hidden"),$(".chat-3bRxxu").first().css("visibility","hidden").css("min-width","0px"),$(".flex-vertical.channels-wrap").first().css("flex-grow","100000"),$(".guild-header .btn.btn-hamburger").first().css("visibility","hidden")},Ae.prototype.disable=function(){$(".scroller.guild-channels ul").first().css("display",""),$(".scroller.guild-channels header").first().css("display",""),$(".app.flex-vertical, .app-2rEoOp").first().css("overflow",""),$(".chat-3bRxxu").first().css("visibility","").css("min-width",""),$(".flex-vertical.channels-wrap").first().css("flex-grow",""),$(".guild-header .btn.btn-hamburger").first().css("visibility","")};var Re=new Ae;const Ie=new RegExp("^(?!da-)((?:[A-Za-z]|[0-9]|-)+)-(?:[A-Za-z]|[0-9]|-|_){6}$");var _e=new class{stop(){this.hasPatched&&(this.unpatchClassModules(M(this.moduleFilter.bind(this))),this.revertElement(document.querySelector("#app-mount")),this.hasPatched=!1)}start(){this.hasPatched||(this.patchClassModules(M(this.moduleFilter.bind(this))),this.normalizeElement(document.querySelector("#app-mount")),this.hasPatched=!0,this.patchDOMMethods())}patchClassModules(e){for(const t of e)this.patchClassModule("da",t)}unpatchClassModules(e){for(const t of e)this.unpatchClassModule("da",t)}shouldIgnore(e){return!isNaN(e)||(!!(e.endsWith("px")||e.endsWith("ch")||e.endsWith("em")||e.endsWith("ms"))||(!!e.startsWith("layerContainer-")||(!(!e.startsWith("#")||7!=e.length&&4!=e.length)||!(!e.includes("calc(")&&!e.includes("rgba")))))}moduleFilter(e){if("object"!=typeof e||Array.isArray(e))return!1;if(e.__esModule)return!1;if(!Object.keys(e).length)return!1;for(const t in e){const n=e[t];if("string"!=typeof n)return!1;if(!this.shouldIgnore(n)){if(1===n.split("-").length)return!1;if(!Ie.test(n.split(" ")[0]))return!1}}return!0}patchClassModule(e,t){for(const n in t){const s=t[n];if(this.shouldIgnore(s))continue;const o=s.split(" ");for(const s of o){const o=s.match(Ie);if(!o||!o.length||o.length<2)continue;const i=o[1].split("-").map((e,t)=>t?e[0].toUpperCase()+e.slice(1):e).join("");t[n]+=` ${e}-${i}`}}}unpatchClassModule(e,t){for(const n in t){const s=t[n];if(this.shouldIgnore(s))continue;let o="";const i=s.split(" ");for(const t of i)t.startsWith(`${e}-`)||(o+=` ${t}`);t[n]=o.trim()}}normalizeElement(e){if(!(e instanceof Element))return;const t=e.classList;for(let n=0,s=t.length;n<s;n++){if(!Ie.test(t[n]))continue;const s=t[n].match(Ie)[1].split("-").map((e,t)=>t?e[0].toUpperCase()+e.slice(1):e).join("");e.classList.add(`da-${s}`)}for(const t of e.children)this.normalizeElement(t)}revertElement(e){if(!(e instanceof Element))return;e.children&&e.children.length&&this.revertElement(e.children[0]),e.nextElementSibling&&this.revertElement(e.nextElementSibling);const t=e.classList,n=[];for(let e=0;e<t.length;e++)t[e].startsWith("da-")&&n.push(t[e]);e.classList.remove(...n)}patchDOMMethods(){const e=DOMTokenList.prototype.contains;DOMTokenList.prototype.contains=function(t){return t.split(" ").every(t=>e.call(this,t))}}};function qe(){}qe.prototype.enable=function(e){const t=this;this.disable(),$(document).on("keydown.bdDevmode",(function(e){119!==e.which&&118!=e.which||(console.log("%c[%cDevMode%c] %cBreak/Resume","color: red;","color: #303030; font-weight:700;","color:red;",""),e.preventDefault(),e.stopImmediatePropagation())})),e&&$(document).on("contextmenu.bdDevmode",(function(e){t.lastSelector=t.getSelector(e.toElement),setImmediate((function(){let n=$(".contextMenu-HLZMGh");n.length<=0&&(n=$('<div class="contextMenu-HLZMGh bd-context-menu"></div>'),n.addClass($(".app, .app-2rEoOp").hasClass("theme-dark")?"theme-dark":"theme-light"),n.appendTo(".app, .app-2rEoOp"),n.css("top",e.clientY),n.css("left",e.clientX),$(document).on("click.bdDevModeCtx",()=>{n.remove(),$(document).off(".bdDevModeCtx")}),$(document).on("contextmenu.bdDevModeCtx",()=>{n.remove(),$(document).off(".bdDevModeCtx")}),$(document).on("keyup.bdDevModeCtx",e=>{27===e.keyCode&&(n.remove(),$(document).off(".bdDevModeCtx"))}));const s=$("<div/>",{class:"itemGroup-1tL0uz"}),o=$("<div/>",{class:"item-1Yvehc",click:function(){j.NativeModule.copy(t.lastSelector),n.hide()}}).append($("<span/>",{text:"Copy Selector"}));s.append(o),n.append(s),n.hasClass("undefined")&&n.css("top","-="+s.outerHeight())})),e.stopPropagation()}))},qe.prototype.getRules=function(e,t=e.ownerDocument.styleSheets){return[...t].filter(e=>!e.href||!e.href.includes("BetterDiscordApp")).map(e=>[...e.cssRules||[]]).flat().filter(t=>t&&t.selectorText&&e.matches(t.selectorText)&&t.style.length&&t.selectorText.split(", ").length<8&&!t.selectorText.split(", ").includes("*"))},qe.prototype.getSelector=function(e){if(e.id)return`#${e.id}`;const t=this.getRules(e),n=t[t.length-1];return n?n.selectorText:e.classList.length?`.${Array.from(e.classList).join(".")}`:`.${Array.from(e.parentElement.classList).join(".")}`},qe.prototype.disable=function(){$(document).off("keydown.bdDevmode"),$(document).off("contextmenu.bdDevmode"),$(document).off("contextmenu.bdDevModeCtx")};var ze=new qe;const We=j.React;class Ge extends We.Component{constructor(e){super(e),this.state={checked:this.props.checked},this.onChange=this.onChange.bind(this)}onChange(){this.props.disabled||(this.props.onChange(!this.state.checked),this.setState({checked:!this.state.checked}))}render(){const e=this.props.disabled?" bd-switch-disabled":"",t=this.state.checked?" bd-switch-checked":"";return We.createElement("div",{className:"bd-switch"+e+t},We.createElement("input",{type:"checkbox",id:this.props.id,className:"bd-checkbox",disabled:this.props.disabled,checked:this.state.checked,onChange:this.onChange}))}}class He extends j.reactComponent{constructor(e){super(e),this.onChange=this.onChange.bind(this)}onChange(){this.props.checked=!this.props.checked,this.props.onChange(this.props.id,this.props.checked)}render(){const{text:e,info:t}=this.props.data;return j.react.createElement("div",{className:"ui-flex flex-vertical flex-justify-start flex-align-stretch flex-nowrap ui-switch-item"},j.react.createElement("div",{className:"ui-flex flex-horizontal flex-justify-start flex-align-stretch flex-nowrap"},j.react.createElement("h3",{className:"ui-form-title h3 margin-reset margin-reset ui-flex-child"},e),j.react.createElement(Ge,{onChange:this.onChange,checked:this.props.checked})),j.react.createElement("div",{className:"ui-form-text style-description margin-top-4",style:{flex:"1 1 auto"}},t))}}class Ve extends j.reactComponent{constructor(e){super(e)}render(){const{title:e,settings:t,button:n}=this.props,s=n?j.react.createElement("button",{key:"title-button",className:"bd-pfbtn",onClick:n.onClick},n.title):null;return[j.react.createElement(Fe,{text:e}),s,t.map(e=>j.react.createElement(He,{id:e.id,key:e.id,data:e,checked:h[e.id],onChange:(e,t)=>{this.props.onChange(e,t)}}))]}}class Ue extends j.reactComponent{constructor(e){super(e)}render(){return j.react.createElement("div",{className:"contentColumn-2hrIYH contentColumnDefault-1VQkGM content-column default"},this.props.sections.map(e=>j.react.createElement(Ve,Object.assign({},e,{onChange:this.props.onChange}))))}}class Je extends j.reactComponent{constructor(e){super(e)}render(){const{settings:e}=this.props;return j.react.createElement("div",{className:"contentColumn-2hrIYH contentColumnDefault-1VQkGM content-column default"},j.react.createElement(Fe,{text:this.props.title}),this.props.button&&j.react.createElement("button",{key:"title-button",className:"bd-pfbtn",onClick:this.props.button.onClick},this.props.button.title),e.map(e=>j.react.createElement(He,{id:e.id,key:e.id,data:e,checked:h[e.id],onChange:(e,t)=>{this.props.onChange(e,t)}})))}}class Ze extends j.reactComponent{constructor(e){super(e),this.onClick=this.onClick.bind(this),this.setInitialState()}setInitialState(){this.state={checked:this.props.checked||!1}}render(){return j.react.createElement("li",null,j.react.createElement("div",{className:"checkbox checkbox-3kaeSU da-checkbox",onClick:this.onClick},j.react.createElement("div",{className:"checkbox-inner checkboxInner-3yjcPe da-checkboxInner"},j.react.createElement("input",{className:"checkboxElement-1qV33p da-checkboxElement",checked:this.state.checked,onChange:()=>{},type:"checkbox"}),j.react.createElement("span",null)),j.react.createElement("span",null,this.props.text)))}onClick(){this.props.onChange(this.props.id,!this.state.checked),this.setState({checked:!this.state.checked})}}class Qe extends j.reactComponent{constructor(e){super(e);this.onClick=this.onClick.bind(this),this.updateCss=this.updateCss.bind(this),this.saveCss=this.saveCss.bind(this),this.onChange=this.onChange.bind(this)}componentDidMount(){$("#app-mount").addClass("bd-detached-editor"),j.editorDetached=!0,this.editor=ace.edit("bd-customcss-editor-detached"),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",()=>{h["bda-css-0"]&&(this.saveCss(),this.updateCss())})}componentWillUnmount(){$("#app-mount").removeClass("bd-detached-editor"),j.editorDetached=!1,this.editor.destroy()}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)}get options(){return{lineNumbers:!0,mode:"css",indentUnit:4,theme:"material",scrollbarStyle:"simple"}}get css(){const e=ee.getBDData("bdcustomcss");let t="";return e&&""!==e&&(t=atob(e)),t}get root(){const e=$("#bd-customcss-detach-container");return e.length?e[0]:this.injectRoot()?this.detachedRoot:null}injectRoot(){return!!$(".app, .app-2rEoOp").length&&($("<div/>",{id:"bd-customcss-detach-container"}).insertAfter($(".app, .app-2rEoOp")),!0)}render(){const e=this;return j.react.createElement("div",{className:"bd-detached-css-editor",id:"bd-customcss-detach-editor"},j.react.createElement("div",{id:"bd-customcss-innerpane"},j.react.createElement("div",{className:"editor-wrapper"},j.react.createElement("div",{id:"bd-customcss-editor-detached",className:"editor",ref:"editor"},e.css)),j.react.createElement("div",{id:"bd-customcss-attach-controls"},j.react.createElement("ul",{className:"checkbox-group"},j.react.createElement(Ze,{id:"live-update",text:"Live Update",onChange:e.onChange,checked:h["bda-css-0"]})),j.react.createElement("div",{id:"bd-customcss-detach-controls-button"},j.react.createElement("button",{style:{borderRadius:"3px 0 0 3px",borderRight:"1px solid #3f4146"},className:"btn btn-primary",onClick:()=>{e.onClick("update")}},"Update"),j.react.createElement("button",{style:{borderRadius:"0",borderLeft:"1px solid #2d2d2d",borderRight:"1px solid #2d2d2d"},className:"btn btn-primary",onClick:()=>{e.onClick("save")}},"Save"),j.react.createElement("button",{style:{borderRadius:"0 3px 3px 0",borderLeft:"1px solid #3f4146"},className:"btn btn-primary",onClick:()=>{e.onClick("attach")}},"Attach"),j.react.createElement("span",{style:{fontSize:"10px",marginLeft:"5px"}},"Unsaved changes are lost on attach")))))}onChange(e,t){switch(e){case"live-update":h["bda-css-0"]=t,yt.saveSettings()}}onClick(e){const t=this;switch(e){case"attach":$("#editor-detached").length&&t.props.attach(),j.reactDom.unmountComponentAtNode(t.root),t.root.remove();break;case"update":t.updateCss();break;case"save":t.saveCss()}}updateCss(){0==$("#customcss").length&&$("head").append('<style id="customcss"></style>'),$("#customcss").text(this.editor.session.getValue()).detach().appendTo(document.head)}saveCss(){ee.setBDData("bdcustomcss",btoa(this.editor.session.getValue()))}}class Ye extends j.reactComponent{constructor(e){super(e);this.props.lines=0,this.setInitialState(),this.attach=this.attach.bind(this),this.detachedEditor=j.react.createElement(Qe,{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||j.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",()=>{h["bda-css-0"]&&(this.saveCss(),this.updateCss())})}componentWillUnmount(){this.editor.destroy()}componentDidUpdate(e,t){const n=this;t.detached&&!n.state.detached&&j.reactDom.unmountComponentAtNode(n.detachedRoot)}codeMirror(){}get options(){return{lineNumbers:!0,mode:"css",indentUnit:4,theme:"material",scrollbarStyle:"simple"}}get css(){const e=ee.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 j.react.createElement("div",{className:"contentColumn-2hrIYH contentColumnDefault-1VQkGM content-column default",style:{padding:"60px 40px 0px"}},t&&j.react.createElement("div",{id:"editor-detached"},j.react.createElement(Fe,{text:"Custom CSS Editor"}),j.react.createElement("h3",null,"Editor Detached"),j.react.createElement("button",{className:"btn btn-primary",onClick:()=>{e.attach()}},"Attach")),!t&&j.react.createElement("div",null,j.react.createElement(Fe,{text:"Custom CSS Editor"}),j.react.createElement("div",{className:"editor-wrapper"},j.react.createElement("div",{id:"bd-customcss-editor",className:"editor",ref:"editor"},e.css)),j.react.createElement("div",{id:"bd-customcss-attach-controls"},j.react.createElement("ul",{className:"checkbox-group"},j.react.createElement(Ze,{id:"live-update",text:"Live Update",onChange:this.onChange,checked:h["bda-css-0"]})),j.react.createElement("div",{id:"bd-customcss-detach-controls-button"},j.react.createElement("button",{style:{borderRadius:"3px 0 0 3px",borderRight:"1px solid #3f4146"},className:"btn btn-primary",onClick:()=>{e.onClick("update")}},"Update"),j.react.createElement("button",{style:{borderRadius:"0",borderLeft:"1px solid #2d2d2d",borderRight:"1px solid #2d2d2d"},className:"btn btn-primary",onClick:()=>{e.onClick("save")}},"Save"),j.react.createElement("button",{style:{borderRadius:"0 3px 3px 0",borderLeft:"1px solid #3f4146"},className:"btn btn-primary",onClick:()=>{e.onClick("detach")}},"Detach"),j.react.createElement("span",{style:{fontSize:"10px",marginLeft:"5px"}},"Unsaved changes are lost on detach"),j.react.createElement("div",{className:"help-text"},"Press ",j.react.createElement("code",{className:"inline"},"ctrl"),"+",j.react.createElement("span",{className:"inline"},",")," with the editor focused to access the editor's settings.")))))}onClick(e){const t=this;switch(e){case"update":t.updateCss();break;case"save":t.saveCss();break;case"detach":t.detach()}}onChange(e,t){switch(e){case"live-update":h["bda-css-0"]=t,yt.saveSettings()}}updateCss(){0==$("#customcss").length&&$("head").append('<style id="customcss"></style>'),$("#customcss").text(this.editor.session.getValue()).detach().appendTo(document.head)}saveCss(){ee.setBDData("bdcustomcss",btoa(this.editor.session.getValue()))}detach(){this.setState({detached:!0});const e=this.detachedRoot;e?j.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&&($("<div/>",{id:"bd-customcss-detach-container"}).insertAfter($(".app, .app-2rEoOp")),!0)}attach(){this.setState({detached:!1})}}class Ke extends j.reactComponent{constructor(e){super(e),this.state={hasError:!1}}componentDidCatch(){this.setState({hasError:!0})}render(){return this.state.hasError?j.react.createElement("div",{className:"react-error"},"Component Error"):this.props.children}}class Xe extends j.reactComponent{constructor(e){super(e)}static get displayName(){return"ContentColumn"}render(){return j.react.createElement("div",{className:"contentColumn-2hrIYH contentColumnDefault-1VQkGM content-column default"},j.react.createElement("h2",{className:"ui-form-title h2 margin-reset margin-bottom-20"},this.props.title),this.props.children)}}class et extends j.reactComponent{constructor(e){super(e)}render(){return j.react.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#dcddde",className:"bd-reload "+this.props.className,onClick:this.props.onClick,style:{width:this.props.size||"24px",height:this.props.size||"24px"}},j.react.createElement("path",{d:"M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4l-2.35 2.35z"}),j.react.createElement("path",{fill:"none",d:"M0 0h24v24H0z"}))}}const tt=j.React;class nt extends tt.Component{render(){const e=this.props.size||"24px";return tt.createElement("svg",{className:this.props.className||"",viewBox:"0 0 24 24",fill:"#FFFFFF",style:{width:e,height:e},onClick:this.props.onClick},tt.createElement("path",{d:"M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34c-.39-.39-1.02-.39-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z"}),tt.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}))}}const st=j.React;class ot extends st.Component{render(){const e=this.props.size||"24px";return st.createElement("svg",{className:this.props.className||"",fill:"#FFFFFF",viewBox:"0 0 24 24",style:{width:e,height:e},onClick:this.props.onClick},st.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),st.createElement("path",{d:"M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zm2.46-7.12l1.41-1.41L12 12.59l2.12-2.12 1.41 1.41L13.41 14l2.12 2.12-1.41 1.41L12 15.41l-2.12 2.12-1.41-1.41L10.59 14l-2.13-2.12zM15.5 4l-1-1h-5l-1 1H5v2h14V4z"}),st.createElement("path",{fill:"none",d:"M0 0h24v24H0z"}))}}const it=j.React;class rt extends j.reactComponent{constructor(e){super(e),this.onChange=this.onChange.bind(this),this.showSettings=this.showSettings.bind(this),this.setInitialState(),this.hasSettings="function"==typeof this.props.addon.getSettingsPanel,this.settingsPanel="",this.edit=this.edit.bind(this),this.delete=this.delete.bind(this),this.reload=this.reload.bind(this)}setInitialState(){this.state={checked:this.props.enabled,settings:!1,reloads:0}}showSettings(){this.hasSettings&&this.setState({settings:!0})}closeSettings(){this.panelRef.current.innerHTML="",this.setState({settingsOpen:!1})}componentDidUpdate(){if(!this.state.settings)return;if("object"==typeof this.settingsPanel&&this.refs.settingspanel.appendChild(this.settingsPanel),!h["fork-ps-3"])return;const e=$(j.reactDom.findDOMNode(this)),t=e.parents(".scroller");((e,t)=>{const n=e.scrollTop,s=n+e.clientHeight,o=t.offsetTop,i=o+t.clientHeight;return o<n||i>s})(t[0],e[0])&&t.animate({scrollTop:e.offset().top-t.offset().top+t.scrollTop()-30},300)}getString(e){return e?"string"==typeof e?e:e.toString():"???"}get settingsComponent(){const e=this.getString(this.props.addon.name);try{this.settingsPanel=this.props.addon.getSettingsPanel()}catch(e){O.err("Plugins","Unable to get settings panel for "+this.props.addon.name+".",e)}return j.react.createElement("div",{className:"bd-card bd-addon-card settings-open ui-switch-item"},j.react.createElement("div",{style:{float:"right",cursor:"pointer"},onClick:()=>{this.refs.settingspanel.innerHTML="",this.setState({settings:!1})}},j.react.createElement(Pe,null)),"object"==typeof this.settingsPanel&&j.react.createElement("div",{id:`plugin-settings-${e}`,className:"plugin-settings",ref:"settingspanel"}),"object"!=typeof this.settingsPanel&&j.react.createElement("div",{id:`plugin-settings-${e}`,className:"plugin-settings",ref:"settingspanel",dangerouslySetInnerHTML:{__html:this.settingsPanel}}))}buildTitle(e,t,n){const s="{{name}} v{{version}} by {{author}}".split(/({{[A-Za-z]+}})/),o=s.findIndex(e=>"{{name}}"==e);o&&(s[o]=it.createElement("span",{className:"name bda-name"},e));const i=s.findIndex(e=>"{{version}}"==e);o&&(s[i]=it.createElement("span",{className:"version bda-version"},t));const r=s.findIndex(e=>"{{author}}"==e);if(o){const e={className:"author bda-author"};(n.link||n.id)&&(e.className+=` ${j.anchorClasses.anchor} ${j.anchorClasses.anchorUnderlineOnHover}`,e.target="_blank",n.link&&(e.href=n.link),n.id&&(e.onClick=()=>{j.LayerStack.popLayer(),j.openDM(n.id)})),s[r]=it.createElement(n.link||n.id?"a":"span",e,n.name)}return s.flat()}makeLink(e,t){const n={className:"bda-link bda-link-website",target:"_blank"};return"string"==typeof t&&(n.href=t),"function"==typeof t&&(n.onClick=e=>{e.preventDefault(),e.stopPropagation(),t()}),j.react.createElement("a",n,e)}makeButton(e,t,n){return it.createElement(ve,{color:"black",side:"top",text:e},it.createElement("div",{className:"bd-addon-button",onClick:n},t))}get links(){const e=[],t=this.props.addon;return t.website&&e.push(this.makeLink("Website",t.website)),t.source&&e.push(this.makeLink("Source",t.source)),t.invite&&e.push(this.makeLink("Support Server",()=>{const e=/\.gg\/(.*)$/;let n=t.invite;e.test(n)&&(n=n.match(e)[1]),j.LayerStack.popLayer(),j.InviteActions.acceptInviteAndTransitionToInviteChannel(n)})),t.donate&&e.push(this.makeLink("Donate",t.donate)),t.patreon&&e.push(this.makeLink("Patreon",t.patreon)),e}get footer(){const e=this.links;return(e.length||this.hasSettings)&&j.react.createElement("div",{className:"bd-card-footer bda-footer"},j.react.createElement("span",{className:"bd-addon-links bda-links"},...e.map((t,n)=>n<e.length-1?[t," | "]:t).flat()),this.hasSettings&&j.react.createElement("button",{onClick:this.showSettings,className:"bd-button bda-settings-button",disabled:!this.state.checked},"Settings"))}onChange(){this.props.toggle&&this.props.toggle(this.props.addon.name),this.props.enabled=!this.props.enabled}edit(){this.props.edit(this.props.addon.name)}delete(){this.props.remove(this.props.addon.name)}reload(){this.props.reload(this.props.addon.name)}render(){if(this.state.settings)return this.settingsComponent;const{name:e,author:t,description:n,version:s,authorId:o,authorLink:i}=this.props.addon;return j.react.createElement("div",{className:"bd-card bd-addon-card settings-closed ui-switch-item"},j.react.createElement("div",{className:"bd-addon-header bda-header"},j.react.createElement("div",{className:"bd-card-title bda-header-title"},this.buildTitle(e,s,{name:t,id:o,link:i})),j.react.createElement("div",{className:"bd-addon-controls bda-controls"},this.props.edit&&this.makeButton("Edit",it.createElement(nt,{className:"bd-icon"}),this.edit),this.props.remove&&this.makeButton("Delete",it.createElement(ot,{className:"bd-icon"}),this.delete),this.props.reload&&this.makeButton("Reload",it.createElement(et,{className:"bd-icon"}),this.reload),it.createElement(Ge,{onChange:this.onChange,checked:this.props.enabled}))),j.react.createElement("div",{className:"bd-scroller-wrap bda-description-wrap scroller-wrap fade"},j.react.createElement("div",{className:"bd-scroller bd-addon-description bda-description scroller"},n)),this.footer)}}const at=j.React;class lt extends at.Component{render(){const e=this.props.size||"16px";return at.createElement("svg",{className:this.props.className||"",fill:"#FFFFFF",viewBox:"0 0 24 24",style:{width:e,height:e}},at.createElement("path",{d:"M8.12 9.29L12 13.17l3.88-3.88c.39-.39 1.02-.39 1.41 0 .39.39.39 1.02 0 1.41l-4.59 4.59c-.39.39-1.02.39-1.41 0L6.7 10.7c-.39-.39-.39-1.02 0-1.41.39-.38 1.03-.39 1.42 0z"}))}}const ct=j.React;class dt extends ct.Component{constructor(e){super(e),this.state={open:!1,value:this.props.value||this.props.options[0].value},this.dropdown=ct.createRef(),this.onChange=this.onChange.bind(this),this.showMenu=this.showMenu.bind(this),this.hideMenu=this.hideMenu.bind(this)}showMenu(e){e.preventDefault(),this.setState({open:!0},()=>{document.addEventListener("click",this.hideMenu)})}hideMenu(){this.setState({open:!1},()=>{document.removeEventListener("click",this.hideMenu)})}onChange(e){this.setState({value:e}),this.props.onChange&&this.props.onChange(e)}get selected(){return this.props.options.find(e=>e.value==this.state.value)}get options(){const e=this.selected;return ct.createElement("div",{className:"bd-select-options"},this.props.options.map(t=>ct.createElement("div",{className:`bd-select-option${e.value==t.value?" selected":""}`,onClick:this.onChange.bind(this,t.value)},t.label)))}render(){const e="transparent"==this.props.style?" bd-select-transparent":"",t=this.state.open?" menu-open":"";return ct.createElement("div",{className:`bd-select${e}${t}`,onClick:this.showMenu,ref:this.dropdown},ct.createElement("div",{className:"bd-select-value"},this.selected.label),ct.createElement(lt,{className:"bd-select-arrow"}),this.state.open&&this.options)}}const ht=j.React;class ut extends ht.Component{render(){const e=this.props.size||"16px";return ht.createElement("svg",{className:this.props.className||"",fill:"#FFFFFF",viewBox:"0 0 24 24",style:{width:e,height:e}},ht.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),ht.createElement("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"}))}}const pt=j.React;class mt extends pt.Component{render(){return pt.createElement("div",{className:"bd-search-wrapper"},pt.createElement("input",{onChange:this.props.onChange,onKeyDown:this.props.onKeyDown,type:"text",className:"bd-search",placeholder:this.props.placeholder,maxLength:"50"}),pt.createElement(ut,null))}}function gt(){return(gt=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e}).apply(this,arguments)}const ft=F("Tooltip"),bt=j.react;class vt extends j.reactComponent{constructor(e){super(e),this.state={sort:"name",ascending:!0,query:""},this.isPlugins="plugins"==this.props.type,this.cookie=this.isPlugins?S:D,this.manager=this.isPlugins?I:q,this.sort=this.sort.bind(this),this.reverse=this.reverse.bind(this),this.search=this.search.bind(this)}openFolder(){n(2).shell.openItem(this.isPlugins?Q.pluginsFolder:Q.themesFolder)}edit(e){console.log(e),this.manager.edit(e)}async delete(e){await this.confirmDelete(e)&&this.manager.delete(e)}confirmDelete(e){return new Promise(t=>{St.showConfirmationModal("Are You Sure?",`Are you sure you want to delete ${e}?`,{danger:!0,confirmText:"Delete",onConfirm:()=>{t(!0)},onCancel:()=>{t(!1)}})})}get sortOptions(){return[{label:"Name",value:"name"},{label:"Author",value:"author"},{label:"Version",value:"version"},{label:"Recently Added",value:"added"},{label:"Last Modified",value:"modified"},{label:"File Size",value:"size"}]}get directions(){return[{label:"Ascending",value:!0},{label:"Descending",value:!1}]}reverse(e){this.setState({ascending:e})}sort(e){this.setState({sort:e})}search(e){this.setState({query:e.target.value.toLocaleLowerCase()})}getProps(e){return{key:e.name,enabled:this.cookie[e.name],toggle:this.manager.toggle.bind(this.manager),edit:this.edit.bind(this),remove:this.delete.bind(this),addon:e}}getAddons(){const e=this.props.list.sort((e,t)=>{const n=e[this.state.sort],s=t[this.state.sort];return"string"==typeof n?n.toLocaleLowerCase().localeCompare(s.toLocaleLowerCase()):n>s?1:s>n?-1:0});return this.state.ascending||e.reverse(),e.map(e=>{if(this.state.query){let t=null;if(e.name&&(t=e.name.toLocaleLowerCase().includes(this.state.query)),e.author&&(t=t||e.author.toLocaleLowerCase().includes(this.state.query)),e.description&&(t=t||e.description.toLocaleLowerCase().includes(this.state.query)),e.version&&(t=t||e.version.toLocaleLowerCase().includes(this.state.query)),!t)return null}const t=this.getProps(e);return bt.createElement(Ke,null,bt.createElement(rt,gt({},t,{reload:!h["fork-ps-5"]&&this.manager.reload.bind(this.manager)})))})}render(){const e=bt.createElement(ft,{color:"black",position:"top",text:"Reload List"},e=>bt.createElement(et,gt({},e,{className:"bd-icon bd-reload bd-reload-header",size:"18px",onClick:async()=>{this.isPlugins?I.updatePluginList():q.updateThemeList(),this.forceUpdate()}}))),t=this.getAddons().filter(e=>e);return bt.createElement(Me,{contentColumn:!0,fade:!0,dark:!0},bt.createElement(Xe,{title:`${this.props.type.toUpperCase()}${t.length}`},bt.createElement("button",{key:"folder-button",className:"bd-button bd-pfbtn",onClick:this.openFolder.bind(this)},"Open ",this.isPlugins?"Plugin":"Theme"," Folder"),!h["fork-ps-5"]&&e,bt.createElement("div",{className:"bd-controls bd-addon-controls"},bt.createElement(mt,{onChange:this.search,placeholder:`Search ${this.props.type}...`}),bt.createElement("div",{className:"bd-addon-dropdowns"},bt.createElement("div",{className:"bd-select-wrapper"},bt.createElement("label",{className:"bd-label"},"Sort by:"),bt.createElement(dt,{options:this.sortOptions,onChange:this.sort,style:"transparent"})),bt.createElement("div",{className:"bd-select-wrapper"},bt.createElement("label",{className:"bd-label"},"Order:"),bt.createElement(dt,{options:this.directions,onChange:this.reverse,style:"transparent"})))),bt.createElement("div",{className:"bda-slist bd-addon-list"},t)),bt.createElement($e,{key:"tools"}))}}var yt=new class{constructor(){this.sideBarOnClick=this.sideBarOnClick.bind(this),this.onChange=this.onChange.bind(this),this.updateSettings=this.updateSettings.bind(this),this.sidebar=new ye(this.sideBarOnClick),this.buildPluginProps=this.buildPluginProps.bind(this),this.buildThemeProps=this.buildThemeProps.bind(this)}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=$("<div/>",{class:"contentRegion-3nDuYy content-region",id:"bd-settingspane-container"});return $(".layer-3QrUeG .standardSidebarView-3F1I7i, .layer-3QrUeG .ui-standard-sidebar-view").append(e),O.onRemoved(e[0],()=>{j.reactDom.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(c).reduce((t,n)=>{const s=c[n];return s.cat===e&&s.implemented&&!s.hidden&&(s.text=n,t.push(s)),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()}}onClick(){}onChange(e,t){this.updateSettings(e,t)}updateSettings(e,t){h[e]=t,"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?Le.addButton():Le.removeButton()),"bda-gs-4"==e&&(t?Re.enable():Re.disable()),"bda-gs-5"==e&&(t?$("#app-mount").addClass("bda-dark"):$("#app-mount").removeClass("bda-dark")),t&&"bda-gs-6"==e&&we.inject24Hour(),"bda-gs-7"==e&&(t?Ce.injectColoredText():Ce.removeColoredText()),"bda-es-4"==e&&(t?ie.autoCapitalize():ie.disableAutoCapitalize()),"fork-ps-4"==e&&(t?_e.start():_e.stop()),"fork-ps-5"==e&&(t?(Q.watchContent("plugin"),Q.watchContent("theme")):(Q.unwatchContent("plugin"),Q.unwatchContent("theme"))),"bda-gs-8"==e&&(t?ze.enable(h["fork-dm-1"]):ze.disable()),"fork-dm-1"==e&&h["bda-gs-8"]&&ze.enable(t),"reactDevTools"===e&&(t?Te.start():Te.stop()),this.saveSettings()}async initializeSettings(){h["bda-gs-2"]&&$("body").addClass("bd-minimal"),h["bda-gs-3"]&&$("body").addClass("bd-minimal-chan"),h["bda-gs-1"]&&Le.addButton(),h["bda-gs-4"]&&Re.enable(),h["bda-gs-5"]&&$("#app-mount").addClass("bda-dark"),h["bda-gs-6"]&&we.inject24Hour(),h["bda-gs-7"]&&Ce.injectColoredText(),h["bda-es-4"]&&ie.autoCapitalize(),h["fork-ps-4"]&&_e.start(),h["fork-ps-5"]&&(Q.watchContent("plugin"),Q.watchContent("theme")),h["bda-gs-8"]&&ze.enable(h["fork-dm-1"]),h.reactDevTools&&Te.start(),this.saveSettings()}saveSettings(){ee.setSettingGroup("settings",h)}loadSettings(){Object.assign(h,ee.getSettingGroup("settings"))}renderSidebar(){const e=this;$("[class*='side-'] > [class*='item-']").off("click.v2settingspanel").on("click.v2settingspanel",()=>{j.reactDom.unmountComponentAtNode(e.root),$(e.root).hide(),$(".contentRegion-3nDuYy, .content-region").first().show()}),e.sidebar.render()}get coreComponent(){return j.react.createElement(Me,{contentColumn:!0,fade:!0,dark:!0},j.react.createElement(Ue,{key:"cspanel",onChange:this.onChange,sections:this.coreSettings}),j.react.createElement($e,{key:"tools"}))}get emoteComponent(){return j.react.createElement(Me,{contentColumn:!0,fade:!0,dark:!0},j.react.createElement(Je,{key:"espanel",title:"Emote Settings",onChange:this.onChange,settings:this.emoteSettings,button:{title:"Clear Emote Cache",onClick:()=>{ie.clearEmoteData(),ie.init(),ne.init()}}}),j.react.createElement($e,{key:"tools"}))}get customCssComponent(){return j.react.createElement(Me,{contentColumn:!0,fade:!0,dark:!0},j.react.createElement(Ye,{key:"csseditor"}),j.react.createElement($e,{key:"tools"}))}contentComponent(e){const t=this.getAddonList(e),n=e.replace("s",""),s=this;class o extends j.react.Component{constructor(e){super(e),this.onChange=this.onChange.bind(this)}componentDidMount(){A.on(`${n}-reloaded`,this.onChange),A.on(`${n}-loaded`,this.onChange),A.on(`${n}-unloaded`,this.onChange)}componentWillUnmount(){A.off(`${n}-reloaded`,this.onChange),A.off(`${n}-loaded`,this.onChange),A.off(`${n}-unloaded`,this.onChange)}onChange(){s.sideBarOnClick(e)}render(){return t}}return j.react.createElement(o)}getString(e){return e?"string"==typeof e?e:e.toString():"???"}buildPluginProps(e){const t=e.plugin;return Object.assign({},e,{name:this.getString(t.getName()),author:this.getString(t.getAuthor()),description:this.getString(t.getDescription()),version:this.getString(t.getVersion()),getSettingsPanel:t.getSettingsPanel&&t.getSettingsPanel.bind(t)})}buildThemeProps(e){return Object.assign({},e,{name:this.getString(e.name),author:this.getString(e.author),description:this.getString(e.description),version:this.getString(e.version)})}getAddonList(e){const t="plugins"===e?Object.values(x).map(this.buildPluginProps):Object.values(E).map(this.buildThemeProps);return j.react.createElement(vt,{type:e,list:t})}renderCoreSettings(){const e=this.root;e?j.reactDom.render(this.coreComponent,e):console.log("FAILED TO LOCATE ROOT: .layer-3QrUeG .standardSidebarView-3F1I7i")}renderEmoteSettings(){const e=this.root;e?j.reactDom.render(this.emoteComponent,e):console.log("FAILED TO LOCATE ROOT: .layer-3QrUeG .standardSidebarView-3F1I7i")}renderCustomCssEditor(){const e=this.root;e?j.reactDom.render(this.customCssComponent,e):console.log("FAILED TO LOCATE ROOT: .layer-3QrUeG .standardSidebarView-3F1I7i")}renderPluginPane(){const e=this.root;e?j.reactDom.render(this.contentComponent("plugins"),e):console.log("FAILED TO LOCATE ROOT: .layer-3QrUeG .standardSidebarView-3F1I7i")}renderThemePane(){const e=this.root;e?j.reactDom.render(this.contentComponent("themes"),e):console.log("FAILED TO LOCATE ROOT: .layer-3QrUeG .standardSidebarView-3F1I7i")}};class Ct extends j.reactComponent{render(){return j.react.createElement("svg",{height:"100%",width:this.props.size||"16px",className:"bd-logo "+this.props.className,style:{fillRule:"evenodd",clipRule:"evenodd",strokeLinecap:"round",strokeLinejoin:"round"},viewBox:"0 0 2000 2000"},j.react.createElement("metadata",null),j.react.createElement("defs",null,j.react.createElement("filter",{id:"shadow1"},j.react.createElement("feDropShadow",{dx:"20",dy:"0",stdDeviation:"20","flood-color":"rgba(0,0,0,0.35)"})),j.react.createElement("filter",{id:"shadow2"},j.react.createElement("feDropShadow",{dx:"15",dy:"0",stdDeviation:"20","flood-color":"rgba(255,255,255,0.15)"})),j.react.createElement("filter",{id:"shadow3"},j.react.createElement("feDropShadow",{dx:"10",dy:"0",stdDeviation:"20","flood-color":"rgba(0,0,0,0.35)"}))),j.react.createElement("g",null,j.react.createElement("path",{style:{filter:"url(#shadow3)"},d:"M1195.44+135.442L1195.44+135.442L997.6+136.442C1024.2+149.742+1170.34+163.542+1193.64+179.742C1264.34+228.842+1319.74+291.242+1358.24+365.042C1398.14+441.642+1419.74+530.642+1422.54+629.642L1422.54+630.842L1422.54+632.042C1422.54+773.142+1422.54+1228.14+1422.54+1369.14L1422.54+1370.34L1422.54+1371.54C1419.84+1470.54+1398.24+1559.54+1358.24+1636.14C1319.74+1709.94+1264.44+1772.34+1193.64+1821.44C1171.04+1837.14+1025.7+1850.54+1000+1863.54L1193.54+1864.54C1539.74+1866.44+1864.54+1693.34+1864.54+1296.64L1864.54+716.942C1866.44+312.442+1541.64+135.442+1195.44+135.442Z",fill:"#171717",opacity:"1"}),j.react.createElement("path",{style:{filter:"url(#shadow2)"},d:"M1695.54+631.442C1685.84+278.042+1409.34+135.442+1052.94+135.442L361.74+136.442L803.74+490.442L1060.74+490.442C1335.24+490.442+1335.24+835.342+1060.74+835.342L1060.74+1164.84C1150.22+1164.84+1210.53+1201.48+1241.68+1250.87C1306.07+1353+1245.76+1509.64+1060.74+1509.64L361.74+1863.54L1052.94+1864.54C1409.24+1864.54+1685.74+1721.94+1695.54+1368.54C1695.54+1205.94+1651.04+1084.44+1572.64+999.942C1651.04+915.542+1695.54+794.042+1695.54+631.442Z",fill:"#3E82E5",opacity:"1"}),j.react.createElement("path",{style:{filter:"url(#shadow1)"},d:"M1469.25+631.442C1459.55+278.042+1183.05+135.442+826.65+135.442L135.45+135.442L135.45+1004C135.45+1004+135.427+1255.21+355.626+1255.21C575.825+1255.21+575.848+1004+575.848+1004L577.45+490.442L834.45+490.442C1108.95+490.442+1108.95+835.342+834.45+835.342L664.65+835.342L664.65+1164.84L834.45+1164.84C923.932+1164.84+984.244+1201.48+1015.39+1250.87C1079.78+1353+1019.47+1509.64+834.45+1509.64L135.45+1509.64L135.45+1864.54L826.65+1864.54C1182.95+1864.54+1459.45+1721.94+1469.25+1368.54C1469.25+1205.94+1424.75+1084.44+1346.35+999.942C1424.75+915.542+1469.25+794.042+1469.25+631.442Z",fill:"#FFFFFF",opacity:"1"})))}}function wt(){}wt.prototype.setConfig=function(e){Object.assign(m,e)},wt.prototype.init=async function(){if(i<o)return void O.alert("Not Supported","BetterDiscord v"+a+" does not support this old version ("+i+") of Discord. Please update your Discord installation before proceeding.");if(m.version<r)return void O.alert("Not Supported","BetterDiscord v"+m.version+" (your version) is not supported by the latest js ("+a+").<br><br> Please download the latest version from <a href='https://github.com/rauenzi/BetterDiscordApp/releases/latest' target='_blank'>GitHub</a>");if(window.ED)return void O.alert("Not Supported","BandagedBD does not work with EnhancedDiscord. Please uninstall one of them.");if(window.WebSocket&&window.WebSocket.name&&window.WebSocket.name.includes("Patched"))return void O.alert("Not Supported","BandagedBD does not work with Powercord. Please uninstall one of them.");const e=m.updater?m.updater.LatestVersion:m.latestVersion;e>m.version&&O.alert("Update Available",`\n An update for BandagedBD is available (${e})! Please Reinstall!<br /><br />\n <a href='https://github.com/rauenzi/BetterDiscordApp/releases/latest' target='_blank'>Download Installer</a>\n `),O.log("Startup","Initializing Settings"),this.initSettings(),O.log("Startup","Initializing EmoteModule"),window.emotePromise=ie.init().then(()=>{ie.initialized=!0,O.log("Startup","Initializing QuickEmoteMenu"),ne.init()}),this.injectExternals(),await this.checkForGuilds(),j.initialize(),O.log("Startup","Updating Settings"),yt.initializeSettings(),O.log("Startup","Loading Plugins"),I.loadPlugins(),O.log("Startup","Loading Themes"),q.loadThemes(),$("#customcss").detach().appendTo(document.head),window.addEventListener("beforeunload",(function(){h["bda-dc-0"]&&document.querySelector(".btn.btn-disconnect").click()})),ie.autoCapitalize(),O.log("Startup","Removing Loading Icon"),document.getElementsByClassName("bd-loaderv2").length&&document.getElementsByClassName("bd-loaderv2")[0].remove(),O.log("Startup","Initializing Main Observer"),this.initObserver(),h["fork-ps-1"]&&(O.log("Startup","Collecting Startup Errors"),O.showContentErrors({plugins:u,themes:p}));const t=ee.getBDData("version");a>t&&l&&this.showChangelogModal(l),O.suppressErrors(this.patchSocial.bind(this),"BD Social Patch")(),O.suppressErrors(this.patchGuildPills.bind(this),"BD Guild Pills Patch")(),O.suppressErrors(this.patchGuildListItems.bind(this),"BD Guild List Items Patch")(),O.suppressErrors(this.patchGuildSeparator.bind(this),"BD Guild Separator Patch")()},wt.prototype.checkForGuilds=function(){let e=0;return new Promise(t=>{const n=function(){const s=j.guildClasses.wrapper.split(" ")[0];document.querySelectorAll(`.${s}`).length>0&&e++;const o=j.guildClasses.listItem.split(" ")[0],i=j.guildClasses.blobContainer.split(" ")[0];return document.querySelectorAll(`.${s} .${o} .${i}`).length>0||e>=50?t(m.deferLoaded=!0):void setTimeout(n,100)};$(document).ready((function(){setTimeout(n,100)}))})},wt.prototype.injectExternals=async function(){await O.injectJs("https://cdnjs.cloudflare.com/ajax/libs/ace/1.2.9/ace.js"),window.require.original&&(window.require=window.require.original)},wt.prototype.initSettings=function(){if(ee.initialize(),ee.getSettingGroup("settings")){yt.loadSettings(),$('<style id="customcss">').text(atob(ee.getBDData("bdcustomcss"))).appendTo(document.head);for(const e in d)null==h[e]&&(h[e]=d[e],yt.saveSettings())}else Object.assign(h,d),yt.saveSettings()},wt.prototype.initObserver=function(){new MutationObserver(e=>{for(let t=0,n=e.length;t<n;t++){const n=e[t];if(void 0!==I&&I.rawObserver(n),!(n.addedNodes.length&&n.addedNodes[0]instanceof Element))continue;const s=n.addedNodes[0];s.classList.contains("layer-3QrUeG")&&(s.getElementsByClassName("guild-settings-base-section").length&&s.setAttribute("layer-id","server-settings"),s.getElementsByClassName("socialLinks-3jqNFy").length&&(s.setAttribute("layer-id","user-settings"),s.setAttribute("id","user-settings"),document.getElementById("bd-settings-sidebar")||yt.renderSidebar())),s.parentElement==document.body&&s.querySelector("#ace_settingsmenu")&&(s.id="ace_settingsmenu_container"),s.classList.contains("layer-v9HyYc")&&s.getElementsByClassName("emojiPicker-3m1S-j").length&&!s.querySelector(".emojiPicker-3m1S-j").parentElement.classList.contains("animatorLeft-1EQxU0")&&ne.obsCallback(s)}}).observe(document,{childList:!0,subtree:!0})},wt.prototype.showChangelogModal=function(e={}){return O.showChangelogModal(e)},wt.prototype.patchSocial=function(){if(this.socialPatch)return;const e=N(e=>"TabBar"==e.displayName),t=N(e=>"Anchor"==e.displayName);e&&t&&(this.socialPatch=O.monkeyPatch(e.prototype,"render",{after:e=>{const n=e.returnValue.props.children;if(!n||!n.length||n.length<3)return;if("Separator"!==n[n.length-3].type.displayName)return;if(!n[n.length-2].type.toString().includes("socialLinks"))return;const s=n[n.length-2].type;n[n.length-2].type=function(){const e=s(...arguments);return e.props.children.push(j.React.createElement(ve,{color:"black",side:"top",text:"BandagedBD"},j.React.createElement(t,{className:"bd-social-link",href:"https://github.com/rauenzi/BetterDiscordApp",title:"BandagedBD",target:"_blank"},j.React.createElement(Ct,{size:"16px",className:"bd-social-logo"})))),e};const o=j.React.createElement(t,{className:"bd-social-link",href:"https://twitter.com/BandagedBD",title:"BandagedBD",target:"_blank"},"BandagedBD"),i=j.React.createElement(t,{className:"bd-social-link",href:"https://twitter.com/ZackRauen",title:"Zerebos",target:"_blank"},"Zerebos"),r=j.react.createElement("div",{className:"colorMuted-HdFt4q size12-3cLvbJ"},[o,` ${a} by `,i]),l=j.react.createElement("div",{className:"colorMuted-HdFt4q size12-3cLvbJ"},["BBD Injector",` ${m.version} by `,i]),c=n[n.length-1].type;n[n.length-1].type=function(){const e=c(...arguments);return e.props.children.push(l),e.props.children.push(r),e}}}))};wt.prototype.patchGuildListItems=function(){if(this.guildListItemsPatch)return;const e=function(){const e=B("wrapper","unreadMentionsBar"),t=B("guildsError","selected"),n=B("blobContainer");return Object.assign({},e,t,n)}(),t=e.listItem.split(" ")[0],n=e.blobContainer.split(" ")[0],s=j.getInternalInstance(document.querySelector(`.${t} .${n}`).parentElement).return.type;s&&(this.guildListItemsPatch=O.monkeyPatch(s.prototype,"render",{after:e=>{if(e.returnValue&&e.thisObject){const t=e.returnValue,n=e.thisObject.props;return t.props.className+=" bd-guild",n.unread&&(t.props.className+=" bd-unread"),n.selected&&(t.props.className+=" bd-selected"),n.audio&&(t.props.className+=" bd-audio"),n.video&&(t.props.className+=" bd-video"),n.badge&&(t.props.className+=" bd-badge"),n.animatable&&(t.props.className+=" bd-animatable"),t}}}))},wt.prototype.patchGuildPills=function(){if(this.guildPillPatch)return;const e=N(e=>e.default&&!e.default.displayName&&e.default.toString&&e.default.toString().includes("translate3d"));e&&(this.guildPillPatch=O.monkeyPatch(e,"default",{after:e=>{const t=e.methodArguments[0];return t.unread&&(e.returnValue.props.className+=" bd-unread"),t.selected&&(e.returnValue.props.className+=" bd-selected"),t.hovered&&(e.returnValue.props.className+=" bd-hovered"),e.returnValue}}))},wt.prototype.patchGuildSeparator=function(){if(this.guildSeparatorPatch)return;const e=F("Guilds"),t=B("renderListItem");if(!t||!e)return;const n=function(){const e=t.Separator(...arguments);return e.props.className+=" bd-guild-separator",e};this.guildSeparatorPatch=O.monkeyPatch(e.prototype,"render",{after:e=>{e.returnValue.props.children[1].props.children[3].type=n}})};var kt=new wt;const Et={get React(){return j.React},get ReactDOM(){return j.ReactDom},get ReactComponent(){return j.ReactComponent},get WindowConfigFile(){if(this._windowConfigFile)return this._windowConfigFile;const e=n(2).remote.app,t=n(1),s=e.getAppPath(),o=e.getPath("userData"),i=t.resolve(o,e.getVersion(),"modules","discord_desktop_core","injector","config.json"),r=t.resolve(s,"..","app","config.json"),a=n(0),l=a.existsSync(r)?r:a.existsSync(i)?i:null;return this._windowConfigFile=l||null},get settings(){return c},get emotes(){return w},get screenWidth(){return Math.max(document.documentElement.clientWidth,window.innerWidth||0)},get screenHeight(){return Math.max(document.documentElement.clientHeight,window.innerHeight||0)},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 s=n(0),o=this.getAllWindowPreferences();o[e]=t,delete require.cache[this.WindowConfigFile],s.writeFileSync(this.WindowConfigFile,JSON.stringify(o,null,4))},injectCSS:function(e,t){$("head").append($("<style>",{id:O.escapeID(e),text:t}))},clearCSS:function(e){$("#"+O.escapeID(e)).remove()},linkJS:function(e,t){$("head").append($("<script>",{id:O.escapeID(e),src:t,type:"text/javascript"}))},unlinkJS:function(e){$("#"+O.escapeID(e)).remove()},getPlugin:function(e){return x.hasOwnProperty(e)?x[e].plugin:null},getCore:function(){return O.warn("Deprecation Notice","BdApi.getCore() will be removed in future versions."),kt},alert:function(e,t){const n=Et.findModuleByProps("push","update","pop","popWithKey"),s=Et.findModuleByPrototypes("handleCancel","handleSubmit","handleMinorConfirm");if(!n||!s)return kt.alert(e,t);n.push((function(n){return Et.React.createElement(s,Object.assign({title:e,body:t},n))}))},showConfirmationModal:function(e,t,n={}){const s=Et.findModuleByProps("push","update","pop","popWithKey"),o=Et.findModuleByProps("Sizes","Weights"),i=Et.findModule(e=>e.defaultProps&&e.key&&"confirm-modal"==e.key());if(!s||!i||!o)return kt.alert(e,t);const{onConfirm:r,onCancel:a,confirmText:l,cancelText:c,danger:d=!1}=n;"string"==typeof t?t=o({color:o.Colors.PRIMARY,children:[t]}):Array.isArray(t)&&(t=o({color:o.Colors.PRIMARY,children:t})),t=[t];const h=()=>{};s.push((function(n){return Et.React.createElement(i,Object.assign({header:e,children:t,red:d,confirmText:l||"Okay",cancelText:c||"Cancel",onConfirm:r||h,onCancel:a||h},n))}))},showToast:function(e,t={}){O.showToast(e,t)},findModule:function(e){return j.WebpackModules.find(e)},findAllModules:function(e){return j.WebpackModules.findAll(e)},findModuleByProps:function(...e){return j.WebpackModules.findByUniqueProperties(e)},findModuleByPrototypes:function(...e){return j.WebpackModules.findByPrototypes(e)},findModuleByDisplayName:function(e){return j.WebpackModules.findByDisplayName(e)},getInternalInstance:function(e){if(e instanceof window.jQuery||e instanceof Element)return e instanceof jQuery&&(e=e[0]),j.getInternalInstance(e)},loadData:function(e,t){return ee.getPluginData(e,t)}};Et.getData=Et.loadData,Et.saveData=function(e,t,n){return ee.setPluginData(e,t,n)},Et.setData=Et.saveData,Et.deleteData=function(e,t){return ee.deletePluginData(e,t)},Et.monkeyPatch=function(e,t,n){return O.monkeyPatch(e,t,n)},Et.onRemoved=function(e,t){return O.onRemoved(e,t)},Et.suppressErrors=function(e,t){return O.suppressErrors(e,t)},Et.testJSON=function(e){return O.testJSON(e)},Et.isPluginEnabled=function(e){return!!S[e]},Et.isThemeEnabled=function(e){return!!D[e]},Et.isSettingEnabled=function(e){return!!h[e]},Et.enableSetting=function(e){return yt.onChange(e,!0)},Et.disableSetting=function(e){return yt.onChange(e,!1)},Et.toggleSetting=function(e){return yt.onChange(e,!h[e])},Et.getBDData=function(e){return ee.getBDData(e)},Et.setBDData=function(e,t){return ee.setBDData(e,t)};const xt=(e,t,n)=>new class{isEnabled(t){return!!e[t]}enable(e){return n.enable(e)}disable(e){return n.disable(e)}toggle(t){e[t]?this.disable(t):this.enable(t)}reload(e){return n.reload(e)}get(e){return t.hasOwnProperty(e)?t[e].plugin?t[e].plugin:t[e]:null}getAll(){return Object.keys(t).map(e=>this.get(e)).filter(e=>e)}};Et.Plugins=xt(S,x,I),Et.Themes=xt(D,E,q),Object.freeze(Et);var St=Et;n.d(t,"default",(function(){return Pt})),function(){const e=Object.getOwnPropertyDescriptor(HTMLIFrameElement.prototype,"contentWindow").get;Object.defineProperty(HTMLIFrameElement.prototype,"contentWindow",{get:function(){const t=Reflect.apply(e,this,arguments);return new Proxy(t,{get:function(e,t){if("localStorage"===t)return null;const n=e[t];return"function"==typeof n?n.bind(e):n}})}}),Object.defineProperty(Reflect,"apply",{value:Reflect.apply,writable:!1,configurable:!1}),Object.defineProperty(Function.prototype,"bind",{value:Function.prototype.bind,writable:!1,configurable:!1});const t=XMLHttpRequest.prototype.open;XMLHttpRequest.prototype.open=function(){const e=arguments[1];return e.toLowerCase().includes("api/webhooks")?null:Reflect.apply(t,this,arguments)}}(),(()=>{const e=document.createElement("div");e.className="bd-loaderv2",e.title="BandagedBD is loading...",document.body.appendChild(e)})();const Dt=(e,t)=>{Object.defineProperty(window,e,{get:()=>(O.warn("Deprecation Notice",`"${e}" will be removed in future versions. Please only use BdApi.`),t)})},Tt=Object.keys(s);for(const e of Tt)Dt(e,s[e]);Dt("BDV2",j),Dt("pluginModule",I),Dt("themeModule",q),Dt("Utils",O),Dt("BDEvents",A),Dt("settingsPanel",yt),Dt("DataStore",ee),Dt("emoteModule",ie),Dt("ContentManager",Q),Dt("ClassNormalizer",_e),window.BdApi=St,window.quickEmoteMenu=ne;class Pt{constructor(e){kt.setConfig(e)}init(){kt.init()}}}]).default;