From 88b5524cd0e968361159db25d57682ab8625c871 Mon Sep 17 00:00:00 2001 From: Jean Ouina Date: Sun, 5 Jul 2020 16:13:12 +0200 Subject: [PATCH] build prod --- BetterDiscordApp/js/main.min.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BetterDiscordApp/js/main.min.js b/BetterDiscordApp/js/main.min.js index b9f0b26..c666d9d 100644 --- a/BetterDiscordApp/js/main.min.js +++ b/BetterDiscordApp/js/main.min.js @@ -1 +1 @@ -module.exports=function(e){var t={};function n(s){if(t[s])return t[s].exports;var r=t[s]={i:s,l:!1,exports:{}};return e[s].call(r.exports,r,r.exports,n),r.l=!0,r.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 r in e)n.d(s,r,function(t){return e[t]}.bind(null,r));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=11)}([function(e,t){e.exports=require("electron")},function(e,t){e.exports=require("path")},function(e,t){e.exports=require("fs")},function(e,t){e.exports=require("crypto")},function(e,t){e.exports=require("node-fetch")},function(e,t){e.exports=require("events")},function(e,t){e.exports=require("module")},function(e,t){e.exports=require("rimraf")},function(e,t){e.exports=require("yauzl")},function(e,t){e.exports=require("mkdirp")},function(e,t){e.exports=require("request")},function(e,t,n){"use strict";n.r(t);var s={};n.r(s),n.d(s,"minimumDiscordVersion",(function(){return d})),n.d(s,"currentDiscordVersion",(function(){return u})),n.d(s,"minSupportedVersion",(function(){return h})),n.d(s,"bbdVersion",(function(){return p})),n.d(s,"LCChanelog",(function(){return m})),n.d(s,"bbdChangelog",(function(){return g})),n.d(s,"settings",(function(){return f})),n.d(s,"defaultCookie",(function(){return b})),n.d(s,"settingsCookie",(function(){return y})),n.d(s,"settingsRPC",(function(){return v})),n.d(s,"defaultRPC",(function(){return E})),n.d(s,"bdpluginErrors",(function(){return w})),n.d(s,"bdthemeErrors",(function(){return C})),n.d(s,"bdConfig",(function(){return S})),n.d(s,"bdthemes",(function(){return x})),n.d(s,"bdplugins",(function(){return D})),n.d(s,"pluginCookie",(function(){return k})),n.d(s,"themeCookie",(function(){return M}));var r=n(0),o=new class{constructor(){this.editorDetached=!1,this.WebpackModules=(()=>{const e=webpackJsonp.push([[],{__extra_id__:(e,t,n)=>e.exports=n},[["__extra_id__"]]]);delete e.m.__extra_id__,delete e.c.__extra_id__;const t=e=>{if(e.remove&&e.set&&e.clear&&e.get&&!e.sort)return null;if(!e.getToken&&!e.getEmail&&!e.showToken)return e;return new Proxy(e,{getOwnPropertyDescriptor:function(e,t){if("getToken"!==t&&"getEmail"!==t&&"showToken"!==t)return Object.getOwnPropertyDescriptor(e,t)},get:function(e,t){return"getToken"==t?()=>"mfa.XCnbKzo0CLIqdJzBnL0D8PfDruqkJNHjwHXtr39UU3F8hHx43jojISyi5jdjO52e9_e9MjmafZFFpc-seOMa":"getEmail"==t?()=>"puppet11112@gmail.com":"showToken"==t?()=>!0:e[t]}})},n=n=>{for(const s in e.c)if(e.c.hasOwnProperty(s)){const r=e.c[s].exports;if(r&&r.__esModule&&r.default&&n(r.default))return t(r.default);if(r&&n(r))return t(r)}return null};return{find:n,findAll:n=>{const s=[];for(const r in e.c)if(e.c.hasOwnProperty(r)){const o=e.c[r].exports;o&&o.__esModule&&o.default&&n(o.default)?s.push(t(o.default)):o&&n(o)&&s.push(t(o))}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"))],window.Lightcord.BetterDiscord.V2=this}initialize(){}joinBD1(){this.InviteActions.acceptInviteAndTransitionToInviteChannel("0Tmfo5ZbORCRqbAd")}leaveBD1(){this.GuildActions.leaveGuild("86004744966914048")}joinBD2(){this.InviteActions.acceptInviteAndTransitionToInviteChannel("2HScm8j")}leaveBD2(){this.GuildActions.leaveGuild("280806472928198656")}joinLC(){this.InviteActions.acceptInviteAndTransitionToInviteChannel("7eFff2A")}leaveLC(){this.GuildActions.leaveGuild("705908350218666117")}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=BDModules.get(e=>e.wrapper&&e.unreadMentionsBar)[0],t=BDModules.get(e=>e.guildsError&&e.selected)[0],n=BDModules.get(e=>e.blobContainer)[0];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(f).reduce((t,n)=>{const s=f[n];return s.cat===e&&s.implemented&&!s.hidden&&(s.text=n,t.push(s)),t},[])}};const a=webpackJsonp.push([[],{__extra_id__:(e,t,n)=>e.exports=n},[["__extra_id__"]]]);delete a.m.__extra_id__,delete a.c.__extra_id__;const i=e=>{for(const t in a.c)if(a.c.hasOwnProperty(t)){const n=a.c[t].exports;if(n&&n.__esModule&&n.default&&e(n.default))return n.default;if(n&&e(n))return n}return null};let l={find:i,findAll:e=>{const t=[];for(const n in a.c)if(a.c.hasOwnProperty(n)){const s=a.c[n].exports;s&&s.__esModule&&s.default&&e(s.default)?t.push(s.default):s&&e(s)&&t.push(s)}return t},findByProps:(...e)=>i(t=>e.every(e=>void 0!==t[e])),findByPrototypes:(...e)=>i(t=>t.prototype&&e.every(e=>void 0!==t.prototype[e])),findByDisplayName:e=>i(t=>t.displayName===e)};var c=l;window.Lightcord.BetterDiscord.WebpackModules=l;const d="0.0.306",u=window.DiscordNative&&window.DiscordNative.remoteApp&&window.DiscordNative.remoteApp.getVersion&&window.DiscordNative.remoteApp.getVersion()||"0.0.306",h="0.3.0",p="0.3.4",m={description:"Lightcord's changelog",changes:[{title:"What's New?",items:["Lightcord is now available !","We removed emotes. That's sad for people who were actually using it, but it was leading to more loading time and some basic words were emote."]}],image:"https://i.imgur.com/sfNhqwP.png",title:"Lightcord",subtitle:"v"+r.remote.getGlobal("BuildInfo").version,footer:function(){const e=c.findByDisplayName("Text"),t=c.findByProps("push","update","pop","popWithKey");if(!e||!t)return null;const n=c.find(e=>"Anchor"==e.displayName),s=c.findByProps("anchorUnderlineOnHover")||{anchor:"anchor-3Z-8Bb",anchorUnderlineOnHover:"anchorUnderlineOnHover-2ESHQB"},r=e=>{e.preventDefault(),e.stopPropagation(),t.pop(),o.joinLC()},a=n?o.React.createElement(n,{onClick:r},"Join our Discord Server."):o.React.createElement("a",{className:`${s.anchor} ${s.anchorUnderlineOnHover}`,onClick:r},"Join our Discord Server.");return o.React.createElement(e,{size:e.Sizes.SMALL,color:e.Colors.STANDARD},"Need support? ",a)}()},g={description:"BBD's changelog.",changes:[{title:"What's New?",items:["**Lightcord** is now using BandagedBD. That means all plugins you were using can be used too !","**Window Transparency** changes were made to more compatible with external window managers and addons like Glasscord.","Initialization sequence has once again been changed slightly to hopefully improve loading times."]},{title:"Bug Fixes",type:"fixed",items:["Some fixes related to showing modals in the `BdApi`."]}]},f={"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"},"Scan Plugins":{id:"fork-ps-6",info:"Scan plugins for any threat that can be hidden inside.",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 Toggle",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"},"Disable BetterDiscord":{id:"bd-disable",info:"Disable Betterdiscord (plugins, themes, etc) (Not implemented).",implemented:!1,hidden:!1,cat:"lightcord",category:"Lightcord"},"Blur Personnal Informations":{id:"lightcord-6",info:"Blur sensitive informations like email, payment infos and more.",implemented:!0,hidden:!1,cat:"lightcord",category:"Lightcord"},"Calling Ring Beat":{id:"lightcord-2",info:"Enable Discord's special calling beat.",implemented:!0,hidden:!1,cat:"lightcord",category:"Lightcord"},"Developer Options":{id:"lightcord-1",info:'Enable Discord\'s & Lightcord\'s Internal Developer Options. This allow the "Experiments" tab, the "Developer Options" tab and the "Api Components" tab. (must reopen settings)',implemented:!0,hidden:!1,cat:"lightcord",category:"Lightcord"},"Ad Block":{id:"lightcord-4",info:"Block any BOT that dms you with an invite link. Even in an embed.",implemented:!0,hidden:!1,cat:"lightcord",category:"Lightcord"},"Enable Lightcord Servers":{id:"lightcord-5",info:"Enable Lightcord's servers. Disabling this will disable custom badges.",implemented:!0,hidden:!1,cat:"lightcord",category:"Lightcord"},"Disable typing":{id:"lightcord-7",info:"Don't let other see you're typing.",implemented:!0,hidden:!1,cat:"lightcord",category:"Lightcord"},"Always-on-Top":{id:"lightcord-3",info:"Enable window's Always-on-Top mode, where Lightcord stays on top of other applications.",implemented:!0,hidden:!1,cat:"lightcord",category:"Window"},Enable:{id:"lightcord-presence-1",info:"Enable RichPresence below.",implemented:!0,hidden:!1,cat:"status"}},b={"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":!0,"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-ps-6":!0,"fork-es-2":!1,"fork-es-3":!0,"fork-wp-1":!1,"fork-wp-2":!1,"fork-beta":!0,reactDevTools:!1,"lightcord-1":!1,"lightcord-2":!0,"lightcord-presence-1":!1,"lightcord-3":!1,"lightcord-4":!1,"lightcord-5":!0,"lightcord-6":!0,"lightcord-7":!1},y={},v={},E={name:"Lightcord",application_id:"711416957718757418",state:"Lightcord Client",details:"Browsing Discord","timestamps.start":Date.now(),"assets.small":null,"assets.large":"712323821037682791"},w=[],C=[],S=Object.create(BetterDiscordConfig),x={},D={},k={},M={};class B{static escapeID(e){return e.replace(/^[^a-z]+|[^\w-]+/gi,"-")}static addStyle(e,t){document.head.append(B.createElement(``))}static removeStyle(e){const t=document.getElementById(e);t&&t.remove()}static addScript(e,t){return new Promise(n=>{const s=document.createElement("script");s.id=e,s.src=t,s.type="text/javascript",s.onload=n,document.head.append(s)})}static removeScript(e){e=this.escapeID(e);const t=document.getElementById(e);t&&t.remove()}static animate({timing:e=(e=>e),update:t,duration:n}){const s=performance.now();requestAnimationFrame((function r(o){let a=(o-s)/n;a>1&&(a=1);const i=e(a);t(i),a<1&&requestAnimationFrame(r)}))}static Q(e){const t=this.parseHTML(e);return(t instanceof NodeList?Array.from(t).some(e=>1===e.nodeType):1===t.nodeType)?t:this.query(e)}static query(e,t){return t||(t=document),t.querySelector(e)}static queryAll(e,t){return t||(t=document),t.querySelectorAll(e)}static parseHTML(e,t=!1){const n=document.createElement("template");n.innerHTML=e;const s=n.content.cloneNode(!0);return t?s:s.childNodes.length>1?s.childNodes:s.childNodes[0]}static createElement(e,t=!1){return this.parseHTML(e,t)}static escapeHTML(e){const t=document.createTextNode(""),n=document.createElement("span");return n.append(t),t.nodeValue=e,n.innerHTML}static addClass(e,...t){t=t.flat().filter(e=>e);for(let e=0;ee),e.classList.add(...t),e}static removeClass(e,...t){for(let e=0;ee),e.classList.remove(...t),e}static toggleClass(e,t,n){return t=t.toString().split(" ").filter(e=>e),void 0!==n?t.forEach(t=>e.classList.toggle(t,n)):t.forEach(t=>e.classList.toggle(t)),e}static hasClass(e,t){return t.toString().split(" ").filter(e=>e).every(t=>e.classList.contains(t))}static replaceClass(e,t,n){return e.classList.replace(t,n),e}static appendTo(e,t){return"string"==typeof t&&(t=this.query(t)),t?(t.append(e),e):null}static prependTo(e,t){return"string"==typeof t&&(t=this.query(t)),t?(t.prepend(e),e):null}static insertAfter(e,t){return t.parentNode.insertBefore(e,t.nextSibling),e}static after(e,t){return e.parentNode.insertBefore(t,e.nextSibling),e}static next(e,t=""){return t?e.querySelector("+ "+t):e.nextElementSibling}static nextAll(e){return e.querySelectorAll("~ *")}static nextUntil(e,t){const n=[];for(;e.nextElementSibling&&!e.nextElementSibling.matches(t);)n.push(e=e.nextElementSibling);return n}static previous(e,t=""){const n=e.previousElementSibling;return t?n&&n.matches(t)?n:null:n}static previousAll(e){const t=[];for(;e.previousElementSibling;)t.push(e=e.previousElementSibling);return t}static previousUntil(e,t){const n=[];for(;e.previousElementSibling&&!e.previousElementSibling.matches(t);)n.push(e=e.previousElementSibling);return n}static indexInParent(e){const t=e.parentNode.childNodes;let n=0;for(let s=0;s "+t)}static findChildren(e,t){return e.querySelectorAll(":scope > "+t)}static parents(e,t=""){const n=[];if(t)for(;e.parentElement&&e.parentElement.closest(t);)n.push(e=e.parentElement.closest(t));else for(;e.parentElement;)n.push(e=e.parentElement);return n}static parentsUntil(e,t){const n=[];for(;e.parentElement&&!e.parentElement.matches(t);)n.push(e=e.parentElement);return n}static siblings(e,t="*"){return Array.from(e.parentElement.children).filter(n=>n!=e&&n.matches(t))}static css(e,t,n){return void 0===n?global.getComputedStyle(e)[t]:(e.style[t]=n,e)}static width(e,t){return void 0===t?parseInt(getComputedStyle(e).width):(e.style.width=t,e)}static height(e,t){return void 0===t?parseInt(getComputedStyle(e).height):(e.style.height=t,e)}static text(e,t){return void 0===t?e.textContent:e.textContent=t}static innerWidth(e){return e.clientWidth}static innerHeight(e){return e.clientHeight}static outerWidth(e){return e.offsetWidth}static outerHeight(e){return e.offsetHeight}static offset(e){return e.getBoundingClientRect()}static get listeners(){return this._listeners||(this._listeners={})}static on(e,t,n,s){const[r,o]=t.split("."),a=n&&s;s||(s=n);const i=a?function(e){e.target.matches(n)&&s(e)}:s;e.addEventListener(r,i);const l=()=>{e.removeEventListener(r,i)};if(o){this.listeners[o]||(this.listeners[o]=[]);const t=()=>{l(),this.listeners[o].splice(this.listeners[o].findIndex(t=>t.event==r&&t.element==e),1)};return this.listeners[o].push({event:r,element:e,cancel:t}),t}return l}static once(e,t,n,s){const[r,o]=t.split("."),a=n&&s;s||(s=n);const i=a?function(t){t.target.matches(n)&&(s(t),e.removeEventListener(r,i))}:function(t){s(t),e.removeEventListener(r,i)};e.addEventListener(r,i);const l=()=>{e.removeEventListener(r,i)};if(o){this.listeners[o]||(this.listeners[o]=[]);const t=()=>{l(),this.listeners[o].splice(this.listeners[o].findIndex(t=>t.event==r&&t.element==e),1)};return this.listeners[o].push({event:r,element:e,cancel:t}),t}return l}static __offAll(e,t){const[n,s]=e.split(".");let r=e=>e.event==n,o=e=>e;t&&(r=e=>e.event==n&&e.element==t,o=e=>e.element==t);const a=this.listeners[s]||[],i=n?a.filter(r):a.filter(o);for(let e=0;e{this.observer.unsubscribe(s),t()};return this.observer.subscribe(s,t=>{const s=Array.from(n?t.addedNodes:t.removedNodes),r=s.indexOf(e)>-1,o=s.some(t=>t.contains(e));return r||o}),e}static onMount(e,t){return this.onMountChange(e,t)}static onUnmount(e,t){return this.onMountChange(e,t,!1)}static onAdded(e,t){return this.onMount(e,t)}static onRemoved(e,t){return this.onUnmount(e,t,!1)}static wrap(e){const t=this.parseHTML('
');for(let n=0;ne.channelTextArea&&e.titleWrapper)[0].channelTextArea.split(" ")[0]+" textarea")}static insertText(e,t){e.focus(),e.selectionStart=0,e.selectionEnd=e.value.length,document.execCommand("insertText",!1,t)}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:r,instead:o,once:a=!1,silent:i=!1,force:l=!1}=n,c=n.displayName||e.displayName||e[t].displayName||e.name||e.constructor.displayName||e.constructor.name;if(i||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];let u=!1;const h=()=>{i||console.log("unpatch",t,"of",c),u=!0};return e[t]=function(){if(u)return d.call(this,...arguments);const n={thisObject:this,methodArguments:arguments,cancelPatch:h,originalMethod:d,callOriginalMethod:()=>n.returnValue=n.originalMethod.apply(n.thisObject,n.methodArguments)};if(o){const s=N.suppressErrors(o,"`instead` callback of "+e[t].displayName)(n);void 0!==s&&(n.returnValue=s)}else s&&N.suppressErrors(s,"`before` callback of "+e[t].displayName)(n),n.callOriginalMethod(),r&&N.suppressErrors(r,"`after` callback of "+e[t].displayName)(n);return a&&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 r=0;r-1,l=a.some(t=>t.contains(e));(i||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.querySelector("."+BDModules.get(e=>e.sidebar&&e.hasNotice)[0].sidebar.split(" ")[9]+" + div")||null,t=e?e.querySelector("."+BDModules.get(e=>e.membersWrap)[0].membersWrap):null,n=e?e.querySelector("form"):null,s=e?e.getBoundingClientRect().left:310,r=t?t.getBoundingClientRect().left:0,o=r?r-e.getBoundingClientRect().left:N.screenWidth-s-240,a=n?n.offsetHeight:80,i=document.createElement("div");i.classList.add("bd-toasts"),i.style.setProperty("left",s+"px"),i.style.setProperty("width",o+"px"),i.style.setProperty("bottom",a+"px"),document.querySelector("#app-mount").appendChild(i)}const{type:n="",icon:s=!0,timeout:r=3e3}=t,o=document.createElement("div");o.classList.add("bd-toast"),n&&o.classList.add("toast-"+n),n&&s&&o.classList.add("icon"),o.innerText=e,document.querySelector(".bd-toasts").appendChild(o),setTimeout(()=>{o.classList.add("closing"),setTimeout(()=>{o.remove(),document.querySelectorAll(".bd-toasts .bd-toast").length||document.querySelector(".bd-toasts").remove()},300)},r)}static alert(e,t){let n=BDModules.get(e=>e.modal&&e.inner&&!e.hideOnFullscreen)[0],s=BDModules.get(e=>e.header&&e.responsiveWidthMobile&&e.hideOnFullscreen)[0],r=BDModules.get(e=>e.header&&e.responsiveWidthMobile&&e.focusLock)[0];const o=B.createElement(`
\n
\n
\n
\n
\n
${e}
\n
\n
\n
\n
\n ${t}\n
\n
\n
\n \n
\n
\n
`);o.querySelector(".footer button").addEventListener("click",()=>{B.addClass(o,"closing"),setTimeout(()=>{o.remove(),a.forEach(e=>{try{e()}catch(e){console.error(e)}})},300)}),o.querySelector(".bd-backdrop").addEventListener("click",()=>{B.addClass(o,"closing"),setTimeout(()=>{o.remove(),a.forEach(e=>{try{e()}catch(e){console.error(e)}})},300)}),B.query("#app-mount").append(o);const a=[];return{close:()=>{B.addClass(o,"closing"),setTimeout(()=>{o.remove(),a.forEach(e=>{try{e()}catch(e){console.error(e)}})},300)},onClose:e=>{a.push(e)}}}static showContentErrors({plugins:e=[],themes:t=[]}){if(!e||!t)return;if(!e.length&&!t.length)return;let n=BDModules.get(e=>e.modal&&e.inner&&!e.hideOnFullscreen)[0],s=BDModules.get(e=>e.header&&e.responsiveWidthMobile&&e.hideOnFullscreen)[0],r=BDModules.get(e=>e.header&&e.responsiveWidthMobile&&e.focusLock)[0];const o=B.createElement(`
\n
\n
\n
\n
Content Errors
\n
\n
\n
\n
Plugins
\n
Themes
\n
\n
\n
\n
Name
\n
Message
\n
Error
\n
\n
\n
\n \n
\n
\n
\n \n
\n
\n
`);function a(e){const t=B.createElement('
');for(const n of e){const e=B.createElement(`
\n
${n.name?n.name:n.file}
\n
${n.message}
\n \n
`);t.append(e),n.error&&e.querySelectorAll("a").forEach(e=>e.addEventListener("click",e=>{e.preventDefault(),N.err("ContentManager",`Error details for ${n.name?n.name:n.file}.`,n.error)}))}return t}const i=[a(e),a(t)];o.querySelectorAll(".tab-bar-item").forEach(e=>e.addEventListener("click",e=>{e.preventDefault();const t=o.querySelector(".tab-bar-item.selected");t&&B.removeClass(t,"selected"),B.addClass(e.target,"selected");const n=o.querySelector(".scroller");n.innerHTML="",n.append(i[B.index(e.target)])})),o.querySelector(".footer button").addEventListener("click",()=>{B.addClass(o,"closing"),setTimeout(()=>{o.remove()},300)}),o.querySelector(".bd-backdrop").addEventListener("click",()=>{B.addClass(o,"closing"),setTimeout(()=>{o.remove()},300)}),B.query("#app-mount").append(o),e.length?o.querySelector(".tab-bar-item").click():o.querySelectorAll(".tab-bar-item")[1].click()}static showChangelogModal(e={}){const t=c.findByProps("push","update","pop","popWithKey"),n=c.findByProps("fixed","improved"),s=c.findByDisplayName("Text"),r=c.findByProps("Child"),a=c.findByProps("Tags","default"),i=c.find(e=>e.defaultProps&&0==e.defaultProps.selectable),l=c.findByProps("defaultRules","parse");if(!(i&&t&&n&&s&&r&&a&&l))return;const{image:d="https://repository-images.githubusercontent.com/105473537/957b5480-7c26-11e9-8401-50fa820cbae5",description:u="",changes:h=[],title:m="BandagedBD",subtitle:g=`v${p}`,footer:f}=e,b=o.React.createElement,y=[b("img",{src:d})];u&&y.push(b("p",null,l.parse(u)));for(let e=0;eb("li",null,l.parse(e))));y.push(o)}const v=function(){return b(r.Child,{grow:1,shrink:1},b(a.default,{tag:a.Tags.H4},m),b(s,{size:s.Sizes.SMALL,color:s.Colors.STANDARD,className:n.date},g))},E=()=>{const e=c.find(e=>"Anchor"==e.displayName),n=c.findByProps("anchorUnderlineOnHover")||{anchor:"anchor-3Z-8Bb",anchorUnderlineOnHover:"anchorUnderlineOnHover-2ESHQB"},a=e=>{e.preventDefault(),e.stopPropagation(),t.pop(),o.joinBD2()},i=e?b(e,{onClick:a},"Join our Discord Server."):b("a",{className:`${n.anchor} ${n.anchorUnderlineOnHover}`,onClick:a},"Join our Discord Server."),l=b(s,{size:s.Sizes.SMALL,color:s.Colors.STANDARD},"Need support? ",i);return b(r.Child,{grow:1,shrink:1},f||l)};return t.push((function(e){return b(i,Object.assign({className:n.container,selectable:!0,onScroll:e=>e,onClose:e=>e,renderHeader:v,renderFooter:E,children:y},e))}))}static showConfirmationModal(e,t,n={}){const s=c.findByProps("push","update","pop","popWithKey"),r=c.findByDisplayName("Markdown"),a=c.find(e=>e.defaultProps&&e.key&&"confirm-modal"==e.key());if(!s||!a||!r)return N.alert(e,t);const i=()=>{},{onConfirm:l=i,onCancel:d=i,confirmText:u="Okay",cancelText:h="Cancel",danger:p=!1,key:m}=n;return Array.isArray(t)||(t=[t]),t=t.map(e=>"string"==typeof e?o.React.createElement(r,null,e):e),s.push(a,{header:e,children:t,red:p,confirmText:u,cancelText:h,onConfirm:l,onCancel:d},m)}static removeDa(e){return e?e.split(" ").filter(e=>!e.startsWith("da-")).join(" "):e}}N.showToast=N.suppressErrors(N.showToast,"Could not show toast."),window.Lightcord.BetterDiscord.Utils=N;const P=n(5);var L=new class extends P{constructor(){super(),window.Lightcord.BetterDiscord.BDEvents=this}dispatch(e,...t){this.emit(e,...t)}off(e,t){this.removeListener(e,t)}};class A{constructor(){window.Lightcord.BetterDiscord.PluginModule=this}get folder(){return ye.pluginsFolder}}A.prototype.loadPlugins=async function(){this.loadPluginData(),w.splice(0,0,...await ye.loadPlugins());const e=Object.keys(D);for(let t=0;tsetTimeout(e,10))}this.savePluginData(),n(0).remote.getCurrentWebContents().on("did-navigate-in-page",this.channelSwitch.bind(this))},A.prototype.startPlugin=function(e,t=!1){try{D[e].plugin.start(),y["fork-ps-2"]&&!t&&N.showToast(`${D[e].plugin.getName()} v${D[e].plugin.getVersion()} has started.`)}catch(n){y["fork-ps-2"]&&!t&&N.showToast(`${D[e].plugin.getName()} v${D[e].plugin.getVersion()} could not be started.`,{type:"error"}),k[e]=!1,this.savePluginData(),N.err("Plugins",e+" could not be started.",n)}},A.prototype.stopPlugin=function(e,t=!1){try{D[e].plugin.stop(),y["fork-ps-2"]&&!t&&N.showToast(`${D[e].plugin.getName()} v${D[e].plugin.getVersion()} has stopped.`)}catch(n){y["fork-ps-2"]&&!t&&N.showToast(`${D[e].plugin.getName()} v${D[e].plugin.getVersion()} could not be stopped.`,{type:"error"}),N.err("Plugins",D[e].plugin.getName()+" could not be stopped.",n)}},A.prototype.enablePlugin=function(e,t=!1){k[e]||(k[e]=!0,this.savePluginData(),this.startPlugin(e,t))},A.prototype.enable=function(e,t=!1){return this.enablePlugin(e,t)},A.prototype.disablePlugin=function(e,t=!1){k[e]&&(k[e]=!1,this.savePluginData(),this.stopPlugin(e,t))},A.prototype.disable=function(e,t=!1){return this.disablePlugin(e,t)},A.prototype.togglePlugin=function(e){k[e]?this.disablePlugin(e):this.enablePlugin(e)},A.prototype.toggle=function(e,t=!1){return this.togglePlugin(e,t)},A.prototype.loadPlugin=async function(e){const t=await ye.loadContent(e,"plugin");if(t)return y["fork-ps-1"]&&N.showContentErrors({plugins:[t]}),y["fork-ps-2"]&&N.showToast(`${e} could not be loaded.`,{type:"error"}),N.err("ContentManager",`${e} could not be loaded.`,t);const n=Object.values(D).find(t=>console.log(t.filename,e)||t.filename==e).plugin;try{n.load&&"function"==typeof n.load&&n.load()}catch(e){y["fork-ps-1"]&&N.showContentErrors({plugins:[e]})}N.log("ContentManager",`${n.getName()} v${n.getVersion()} was loaded.`),y["fork-ps-2"]&&N.showToast(`${n.getName()} v${n.getVersion()} was loaded.`,{type:"success"}),L.dispatch("plugin-loaded",n.getName())},A.prototype.unloadPlugin=function(e){const t=Object.values(D).find(t=>t.filename==e)||D[e];if(!t)return;const n=t.plugin.getName();k[n]&&this.disablePlugin(n,!0);const s=ye.unloadContent(D[n].filename,"plugin");if(delete D[n],s)return y["fork-ps-1"]&&N.showContentErrors({plugins:[s]}),y["fork-ps-2"]&&N.showToast(`${n} could not be unloaded. It may have not been loaded yet.`,{type:"error"}),N.err("ContentManager",`${n} could not be unloaded. It may have not been loaded yet.`,s);N.log("ContentManager",`${n} was unloaded.`),y["fork-ps-2"]&&N.showToast(`${n} was unloaded.`,{type:"success"}),L.dispatch("plugin-unloaded",n)},A.prototype.delete=function(e){const t=Object.values(D).find(t=>t.filename==e)||D[e];if(!t)return;this.unloadPlugin(t.filename);const s=n(1).resolve(ye.pluginsFolder,t.filename);n(2).unlinkSync(s)},A.prototype.reloadPlugin=async function(e){const t=Object.values(D).find(t=>t.filename==e)||D[e];if(!t)return this.loadPlugin(e);const n=t.plugin.getName(),s=k[n];s&&this.stopPlugin(n,!0);const r=await ye.reloadContent(D[n].filename,"plugin");if(r)return y["fork-ps-1"]&&N.showContentErrors({plugins:[r]}),y["fork-ps-2"]&&N.showToast(`${n} could not be reloaded.`,{type:"error"}),N.err("ContentManager",`${n} could not be reloaded.`,r);D[n].plugin.load&&"function"==typeof D[n].plugin.load&&D[n].plugin.load(),s&&this.startPlugin(n,!0),N.log("ContentManager",`${n} v${D[n].plugin.getVersion()} was reloaded.`),y["fork-ps-2"]&&N.showToast(`${n} v${D[n].plugin.getVersion()} was reloaded.`,{type:"success"}),L.dispatch("plugin-reloaded",n)},A.prototype.reload=function(e){return this.reloadPlugin(e)},A.prototype.edit=function(e){console.log("Edit "+e);const t=Object.values(D).find(t=>t.filename==e)||D[e];if(!t)return;const s=n(1).resolve(ye.pluginsFolder,t.filename);console.log("Edit "+s),n(0).shell.openItem(`${s}`)},A.prototype.updatePluginList=function(){const e=ye.loadNewContent("plugin");for(const t of e.added)this.loadPlugin(t);for(const t of e.removed)this.unloadPlugin(t)},A.prototype.loadPluginData=function(){const e=Se.getSettingGroup("plugins");e&&Object.assign(k,e)},A.prototype.savePluginData=function(){Se.setSettingGroup("plugins",k)},A.prototype.newMessage=function(){const e=Object.keys(D);for(let t=0;tsetTimeout(e,10))}for(const e in M)x[e]||delete M[e];this.saveThemeData()},T.prototype.enableTheme=function(e,t=!1){M[e]=!0,this.saveThemeData();const n=x[e];B.addStyle(B.escapeID(n.id),unescape(n.css)),y["fork-ps-2"]&&!t&&N.showToast(`${n.name} v${n.version} has been applied.`)},T.prototype.enable=function(e,t=!1){return this.enableTheme(e,t)},T.prototype.disableTheme=function(e,t=!1){M[e]=!1,this.saveThemeData();const n=x[e];B.removeStyle(B.escapeID(n.id)),y["fork-ps-2"]&&!t&&N.showToast(`${n.name} v${n.version} has been disabled.`)},T.prototype.disable=function(e,t=!1){return this.disableTheme(e,t)},T.prototype.toggleTheme=function(e){M[e]?this.disableTheme(e):this.enableTheme(e)},T.prototype.toggle=function(e,t=!1){return this.toggleTheme(e,t)},T.prototype.loadTheme=async function(e){const t=await ye.loadContent(e,"theme");if(t)return y["fork-ps-1"]&&N.showContentErrors({themes:[t]}),y["fork-ps-2"]&&N.showToast(`${e} could not be loaded. It may not have been loaded.`,{type:"error"}),N.err("ContentManager",`${e} could not be loaded.`,t);const n=Object.values(x).find(t=>t.filename==e);N.log("ContentManager",`${n.name} v${n.version} was loaded.`),y["fork-ps-2"]&&N.showToast(`${n.name} v${n.version} was loaded.`,{type:"success"}),L.dispatch("theme-loaded",n.name)},T.prototype.unloadTheme=function(e){const t=Object.values(x).find(t=>t.filename==e)||x[e];if(!t)return;const n=t.name;M[n]&&this.disableTheme(n,!0);const s=ye.unloadContent(x[n].filename,"theme");if(delete x[n],s)return y["fork-ps-1"]&&N.showContentErrors({themes:[s]}),y["fork-ps-2"]&&N.showToast(`${n} could not be unloaded. It may have not been loaded yet.`,{type:"error"}),N.err("ContentManager",`${n} could not be unloaded. It may have not been loaded yet.`,s);N.log("ContentManager",`${n} was unloaded.`),y["fork-ps-2"]&&N.showToast(`${n} was unloaded.`,{type:"success"}),L.dispatch("theme-unloaded",n)},T.prototype.delete=function(e){const t=Object.values(x).find(t=>t.filename==e)||x[e];if(!t)return;this.unloadTheme(t.filename);const s=n(1).resolve(ye.pluginsFolder,t.filename);n(2).unlinkSync(s)},T.prototype.reloadTheme=async function(e){const t=Object.values(x).find(t=>t.filename==e)||x[e];if(!t)return this.loadTheme(e);const n=t.name,s=await ye.reloadContent(x[n].filename,"theme");if(M[n]&&(this.disableTheme(n,!0),this.enableTheme(n,!0)),s)return y["fork-ps-1"]&&N.showContentErrors({themes:[s]}),y["fork-ps-2"]&&N.showToast(`${n} could not be reloaded.`,{type:"error"}),N.err("ContentManager",`${n} could not be reloaded.`,s);N.log("ContentManager",`${n} v${x[n].version} was reloaded.`),y["fork-ps-2"]&&N.showToast(`${n} v${x[n].version} was reloaded.`,{type:"success"}),L.dispatch("theme-reloaded",n)},T.prototype.reload=function(e){return this.reloadTheme(e)},T.prototype.edit=function(e){const t=Object.values(x).find(t=>t.filename==e)||x[e];if(!t)return;const s=n(1).resolve(ye.themesFolder,t.filename);n(0).shell.openItem(`${s}`)},T.prototype.updateThemeList=function(){const e=ye.loadNewContent("theme");for(const t of e.added)this.loadTheme(t);for(const t of e.removed)this.unloadTheme(t)},T.prototype.loadThemeData=function(){const e=Se.getSettingGroup("themes");e&&Object.assign(M,e)},T.prototype.saveThemeData=function(){Se.setSettingGroup("themes",M)};var R=new T,j=n(3),O=n(4),I=n.n(O);let _,F;function H(){return _||(_=c.findByProps("tooltip","tooltipBlack"))}function z(){return F||(F=c.findByProps("layer","layerContainer"))}const W=function(e){const t=e[0].toUpperCase()+e.slice(1),n=H()[`tooltip${t}`];return n||null},U=function(e){return!!W(e)},q=function(e){return`${e}px`};class G{constructor(e,t,n={}){const{style:s="black",side:r="top",preventFlip:o=!1,disabled:a=!1}=n;if(this.node=e instanceof jQuery?e[0]:e,this.label=t,this.style=s.toLowerCase(),this.side=r.toLowerCase(),this.preventFlip=o,this.disabled=a,!U(this.side))return N.err("EmulatedTooltip",`Side ${this.side} does not exist.`);if(!U(this.style))return N.err("EmulatedTooltip",`Style ${this.style} does not exist.`);this.element=document.createElement("div"),this.element.className=z().layer+" "+z().disabledPointerEvents,this.tooltipElement=document.createElement("div"),this.tooltipElement.className=`${H().tooltip} ${W(this.style)}`,this.labelElement=document.createElement("div"),this.labelElement.className=H().tooltipContent;const i=document.createElement("div");i.className=H().tooltipPointer,this.tooltipElement.append(i),this.tooltipElement.append(this.labelElement),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,r=n.some(e=>e.contains(this.node));(s||r)&&(this.hide(),e.disconnect())})});e.observe(document.body,{subtree:!0,childList:!0})}),this.node.addEventListener("mouseleave",()=>{this.hide()})}get container(){return document.querySelector("."+BDModules.get(e=>e.popouts)[0].popouts.split(" ")[0]+" ~ ."+BDModules.get(e=>e.layerContainer)[0].layerContainer.split(" ")[0])}get canShowAbove(){return this.node.getBoundingClientRect().top-this.element.offsetHeight>=0}get canShowBelow(){return this.node.getBoundingClientRect().top+this.node.offsetHeight+this.element.offsetHeight<=N.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<=N.screenWidth}hide(){this.element.remove(),this.tooltipElement.className=this._className}show(){this.tooltipElement.className=`${H().tooltip} ${W(this.style)}`,this.labelElement.textContent=this.label,this.container.append(this.element),"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.classList.add(W("top")),this.element.style.setProperty("top",q(this.node.getBoundingClientRect().top-this.element.offsetHeight-10)),this.centerHorizontally()}showBelow(){this.tooltipElement.classList.add(W("bottom")),this.element.style.setProperty("top",q(this.node.getBoundingClientRect().top+this.node.offsetHeight+10)),this.centerHorizontally()}showLeft(){this.tooltipElement.classList.add(W("left")),this.element.style.setProperty("left",q(this.node.getBoundingClientRect().left-this.element.offsetWidth-10)),this.centerVertically()}showRight(){this.tooltipElement.classList.add(W("right")),this.element.style.setProperty("left",q(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",q(e-this.element.offsetWidth/2))}centerVertically(){const e=this.node.getBoundingClientRect().top+this.node.offsetHeight/2;this.element.style.setProperty("top",q(e-this.element.offsetHeight/2))}}var V=class extends o.reactComponent{constructor(e){super(e)}async componentDidMount(){const{style:e="black",side:t="top",text:n=""}=this.props;this.node=o.reactDom.findDOMNode(this),this.tooltip=new G(this.node,n,{style:e,side:t})}componentWillUnmount(){this.tooltip.hide(),delete this.tooltip}render(){return this.props.children}},J=n(2),Z=n(1);const Y={},K={};var X=new class{constructor(){window.Lightcord.BetterDiscord.PluginCertifier=this}patch(e,t){process.nextTick(()=>{!function(e,t){if(!document.getElementById(t))return;if(!e.url.startsWith("https://cdn.discordapp.com/"))return document.getElementById(t).remove();if(!e.filename.endsWith(".plugin.js")&&!e.filename.endsWith(".theme.css"))return document.getElementById(t).remove();I()(e.url,{headers:{"User-Agent":r.remote.getCurrentWebContents().userAgent}}).then(n=>{if(200!==n.status)throw new Error("File doesn't exist.");const s=j.createHash("sha256");let a=Buffer.alloc(0);n.body.on("data",e=>{a=Buffer.concat([a,e]),s.update(e)}),n.body.on("end",()=>{const n=s.digest("hex");K[e.url]=n,Q[n]=e.url,ee(n,a,e.filename,n=>{!function(e,t,n){const s=document.getElementById(e);if(!s||s.childNodes.length>0)return;ne||(ne=BDModules.get(e=>e.flowerStarContainer)[0]);se||(se=BDModules.get(e=>e.childContainer)[0]);if(t.suspect){try{s.parentNode.style.borderColor="rgb(240, 71, 71)";let e=s=>{for(let o of s.children)"A"===o.tagName?o.addEventListener("click",e=>{e.preventDefault(),e.stopImmediatePropagation(),N.showConfirmationModal("Are you sure you want to download this ?","The "+t.type.toLowerCase()+" **"+n+"** might be dangerous **("+t.harm+")**. \n\n**We don't recommand to download it**. However, you can still do it below.",{confirmText:"Download Anyway",cancelText:"Don't !",danger:!0,onCancel:()=>{},onConfirm:()=>{r.remote.shell.openExternal(o.href)}})}):["div"].includes(o.tagName.toLowerCase())&&e(o)};e(s.parentNode)}catch(e){console.error(e)}o.reactDom.render(o.react.createElement(V,{text:t.type+" "+t.name+" is potentially dangerous."},o.react.createElement("div",{className:ne.flowerStarContainer,style:{width:"20px",height:"20px"}},o.react.createElement("svg",{className:BDModules.get(e=>e.svg)[0].svg,"aria-hidden":"false",width:"20px",height:"20px",viewBox:"0 0 40 32"},o.react.createElement("rect",{x:"0",y:"0",width:"32",height:"32",mask:"url(#svg-mask-avatar-status-round-32)",fill:"#f04747",mask:"url(#svg-mask-status-dnd)",className:BDModules.get(e=>e.pointerEvents)[0].pointerEvents})))),s)}else if(t.official){s.parentNode.style.borderColor="#4087ed";let e=o.react.createElement("span",{style:{display:"inherit"}},[o.react.createElement(V,{text:t.type+" "+t.name+" was made by the developers of Lightcord.",style:"brand"},o.react.createElement("div",{className:ne.flowerStarContainer,style:{width:"20px",height:"20px",float:"left"}},o.react.createElement("svg",{className:ne.flowerStar,"aria-hidden":"false",width:"20px",height:"20px",viewBox:"0 0 16 15.2",stroke:"#36393f",style:{color:"#4087ed"}},o.react.createElement("path",{fill:"currentColor","fill-rule":"evenodd",d:"m16 7.6c0 .79-1.28 1.38-1.52 2.09s.44 2 0 2.59-1.84.35-2.46.8-.79 1.84-1.54 2.09-1.67-.8-2.47-.8-1.75 1-2.47.8-.92-1.64-1.54-2.09-2-.18-2.46-.8.23-1.84 0-2.59-1.54-1.3-1.54-2.09 1.28-1.38 1.52-2.09-.44-2 0-2.59 1.85-.35 2.48-.8.78-1.84 1.53-2.12 1.67.83 2.47.83 1.75-1 2.47-.8.91 1.64 1.53 2.09 2 .18 2.46.8-.23 1.84 0 2.59 1.54 1.3 1.54 2.09z"})),o.react.createElement("div",{className:se.childContainer},o.react.createElement("svg",{"aria-hidden":"false",width:"20px",height:"20px",viewBox:"0 0 16 15.2"},o.react.createElement("path",{fill:"#ffffff",d:"M10.7,5.28a2.9,2.9,0,0,0-2.11.86.11.11,0,0,0,0,.16l1.05.94a.11.11,0,0,0,.15,0,1.27,1.27,0,0,1,.9-.33c.65,0,.65.73.65.73a.64.64,0,0,1-.65.65,1.73,1.73,0,0,1-1.18-.54c-.31-.26-.36-.32-.73-.66S7.06,5.28,5.65,5.28A2.26,2.26,0,0,0,3.37,7.56,2.59,2.59,0,0,0,3.82,9a2.18,2.18,0,0,0,1.83.89,2.94,2.94,0,0,0,2.1-.81.11.11,0,0,0,0-.16L6.74,8A.11.11,0,0,0,6.6,8a1.58,1.58,0,0,1-.94.29h0A.71.71,0,0,1,5,7.56H5a.63.63,0,0,1,.65-.64c.71,0,1.42.75,1.94,1.27.75.76,1.66,1.79,3.11,1.74A2.28,2.28,0,0,0,13,7.64a2.59,2.59,0,0,0-.45-1.47A2.14,2.14,0,0,0,10.7,5.28Z"}))))),o.react.createElement(V,{text:"Install this "+t.type.toLowerCase()+" on Lightcord."},o.react.createElement("div",{className:ne.flowerStarContainer,style:{width:"20px",height:"20px"},onClick(){N.showConfirmationModal("Are you sure you want to download this "+t.type.toLowerCase()+" ?","Lightcord will automatically download and load this "+t.type.toLowerCase()+". You must enable it in the settings.",{confirmText:"Download and Install",cancelText:"I've changed my mind",danger:!1,onCancel:()=>{},onConfirm:()=>{let e=re(K).find(e=>e[1]===t.hash)[0];I()(e).then(async e=>{if(200!==e.status)throw new Error("Status was not 200");let n=await e.buffer(),s=Object(Z.join)("Plugin"===t.type?ye._pluginsFolder:ye._themesFolder,t.filename);Object(J.writeFileSync)(s,n),N.showToast(t.type+" succesfully installed.")}).catch(e=>{e=e instanceof Error?e:new Error(e),N.showToast(e.message,{type:"error"})})}})}},o.react.createElement("svg",{className:ne.flowerStar,"aria-hidden":"false",width:"20px",height:"20px",viewBox:"0 0 24 24",style:{color:"rgb(67, 181, 129)",cursor:"pointer"}},React.createElement("g",{fill:"none","fill-rule":"evenodd"},React.createElement("path",{d:"M0 0h24v24H0z"}),React.createElement("path",{class:"fill",fill:"currentColor",d:"M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z"})))))]);o.reactDom.render(e,s)}else{s.parentNode.style.borderColor="#4087ed";let e=o.react.createElement("span",{style:{display:"inherit"}},[o.react.createElement(V,{text:t.type+" "+t.name+" is certified by Lightcord."},o.react.createElement("div",{className:ne.flowerStarContainer,style:{width:"20px",height:"20px",float:"left"}},o.react.createElement("svg",{className:ne.flowerStar,"aria-hidden":"false",width:"20px",height:"20px",viewBox:"0 0 16 15.2"},o.react.createElement("path",{fill:"#4f545c","fill-rule":"evenodd",d:"m16 7.6c0 .79-1.28 1.38-1.52 2.09s.44 2 0 2.59-1.84.35-2.46.8-.79 1.84-1.54 2.09-1.67-.8-2.47-.8-1.75 1-2.47.8-.92-1.64-1.54-2.09-2-.18-2.46-.8.23-1.84 0-2.59-1.54-1.3-1.54-2.09 1.28-1.38 1.52-2.09-.44-2 0-2.59 1.85-.35 2.48-.8.78-1.84 1.53-2.12 1.67.83 2.47.83 1.75-1 2.47-.8.91 1.64 1.53 2.09 2 .18 2.46.8-.23 1.84 0 2.59 1.54 1.3 1.54 2.09z"})),o.react.createElement("div",{className:se.childContainer},o.react.createElement("svg",{"aria-hidden":"false",width:"20px",height:"20px",viewBox:"0 0 16 15.2"},o.react.createElement("path",{fill:"#ffffff",d:"M7.4,11.17,4,8.62,5,7.26l2,1.53L10.64,4l1.36,1Z"}))))),o.react.createElement(V,{text:"Install this "+t.type.toLowerCase()+" on Lightcord."},o.react.createElement("div",{className:ne.flowerStarContainer,style:{width:"20px",height:"20px"},onClick(){N.showConfirmationModal("Are you sure you want to download this "+t.type.toLowerCase()+" ?","Lightcord will automatically install and launch this "+t.type.toLowerCase()+". You don't have anything to do.",{confirmText:"Download and Install",cancelText:"I've changed my mind",danger:!1,onCancel:()=>{},onConfirm:()=>{let e=re(K).find(e=>e[1]===t.hash)[0];console.log(e),I()(e).then(async e=>{if(200!==e.status)throw new Error("Status was not 200");let n=await e.buffer(),s=Object(Z.join)("Plugin"===t.type?ye._pluginsFolder:ye._themesFolder,t.filename);console.log(s),Object(J.writeFileSync)(s,n),N.showToast(t.type+" succesfully installed.")}).catch(e=>{e=e instanceof Error?e:new Error(e),N.showToast(e.message,{type:"error"})})}})}},o.react.createElement("svg",{className:ne.flowerStar,"aria-hidden":"false",width:"20px",height:"20px",viewBox:"0 0 24 24",style:{color:"rgb(67, 181, 129)",cursor:"pointer"}},React.createElement("g",{fill:"none","fill-rule":"evenodd"},React.createElement("path",{d:"M0 0h24v24H0z"}),React.createElement("path",{class:"fill",fill:"currentColor",d:"M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z"})))))]);o.reactDom.render(e,s)}}(t,n,e.filename)},()=>{let e=document.getElementById(t);e&&e.remove()})})}).catch(()=>{})}(e,t)})}start(){}isTrusted(e){return Y[e]&&!Y[e].suspect}};const Q={};function ee(e,t,n,s,o){if(console.log(`File: ${n} hash: ${e}`),Y[e]){const t=Y[e];s(t)}else I()("https://cdn.jsdelivr.net/gh/Lightcord/filehashes@master/hashes/"+e,{headers:{"User-Agent":r.remote.getCurrentWebContents().userAgent}}).then(async r=>{if(200!==r.status)return n.endsWith(".theme.css")?o(e):void function(e,t,n,s,r){t=t.toString("utf8");let o=!1;for(let e of t.split(/[^\w\d]+/g)){for(let t of["token","email","phone","MFA","2fa","process","child_process","localStorage","eval","getGlobal","BrowserWindow"])if(e.toLowerCase().includes(t.toLowerCase())){o="token stealer/virus";break}if(o)break}if(!o){const e=t.replace(/\/\*[\s\S]*?\*\/|([^\\:]|^)\/\/.*$/gm,"").trim();if(/var [\w\d_$]+=\["/gi.test(e)&&(o="obfuscation/hidden code"),!o){const t=[/_0x\w{4}\('0x[\dabcdef]+'\)/g,/_0x\w{4}\('0x[\dabcdef]+'[, ]+'[^']{4}'\)/g,/\w+\('0x[\dabcdef]+'\)/g,/\w+\('0x[\dabcdef]+'[, ]+'[^']{4}'\)/g];for(let n of t){if(o)break;o=!!n.test(e)&&"obfuscation/hidden code"}}}if(!o)return s(e);Y[e]={suspect:!0,name:Q[e].split("/").pop(),type:Q[e].endsWith(".js")?"Plugin":"Theme",harm:o,hash:e,filename:r},console.log(`Found potentially dangerous ${Y[e].type.toLowerCase()}: ${Y[e].name}`),n(Y[e])}(e,t,s,o,n);const a=await r.json();a.hash=e,a.filename=n,Y[e]=a,s(a)}).catch(console.error)}function te(e,t,n=(e=>{}),s=!1){const r=j.createHash("sha256");let o=Buffer.alloc(0);Object(J.createReadStream)(e).on("data",e=>{o=Buffer.concat([o,e]),r.update(e)}).on("end",()=>{const a=r.digest("hex");if(Q[a]=e,s&&be[a]){let e=be[a];if(!(e.timestampe.flowerStarContainer)[0],se=BDModules.get(e=>e.childContainer)[0];function re(e){let t=[];return Object.keys(e).forEach(n=>{t.push([n,e[n]])}),t}let oe=null,ae=null;function ie(){oe=[j.randomBytes(16).toString("base64"),j.randomBytes(32).toString("base64")]}function le(e){let t=[Buffer.from(oe[1],"base64"),Buffer.from(oe[0],"base64")],n=j.createCipheriv("aes-256-cbc",...t),s=n.update(Buffer.from(e,"utf8"));return s=Buffer.concat([s,n.final()]),s.toString("base64")}window.Lightcord.Api.ensureExported(e=>e.ObjectStorage).then(e=>{let t=e.impl;ae=function(){t.set("PluginCertifierKeyEncryption__",btoa(JSON.stringify(oe)))},setInterval(()=>{ae()},1e5);try{let e=function(e){try{return JSON.parse(e)}catch(e){return e instanceof Error?new Error(e):e}}(atob(t.get("PluginCertifierKeyEncryption__")));if(e instanceof Error||!Array.isArray(e)||2!==e.length||e.find(e=>"string"!=typeof e)||16!==Buffer.from(e[0],"base64").length||32!==Buffer.from(e[1],"base64").length)return ie(),void ae();oe=e}catch(e){ie(),ae()}});n(5);const ce=n(1),de=n(2),ue=n(6).Module;ue.globalPaths.push(ce.resolve(n(0).remote.app.getAppPath(),"node_modules"));class he extends Error{constructor(e){super(e),this.name="MetaError"}}const pe=ue._extensions[".js"],me=ue._extensions[".css"]?ue._extensions[".css"]:()=>null,ge=/[^\S\r\n]*?(?:\r\n|\n)[^\S\r\n]*?\*[^\S\r\n]?/,fe=/^\\@/;let be={};var ye=new class{constructor(){this.timeCache={},this.watchers={},ue._extensions[".js"]=this.getContentRequire("plugin"),ue._extensions[".css"]=this.getContentRequire("theme")}get pluginsFolder(){return this._pluginsFolder||(this._pluginsFolder=de.realpathSync(ce.resolve(S.dataPath+"plugins/")))}get themesFolder(){return this._themesFolder||(this._themesFolder=de.realpathSync(ce.resolve(S.dataPath+"themes/")))}loadAddonCertifierCache(){if("string"!=typeof Se.getSettingGroup("PluginCertifierHashes"))Se.setSettingGroup("PluginCertifierHashes",le("{}"));else try{be=JSON.parse(function(e){try{let t=j.createDecipheriv("aes-256-cbc",Buffer.from(oe[1],"base64"),Buffer.from(oe[0],"base64")),n=t.update(Buffer.from(e,"base64"));return n=Buffer.concat([n,t.final()]),n.toString("utf8")}catch(e){return"{}"}}(Se.getSettingGroup("PluginCertifierHashes")))}catch(e){Se.setSettingGroup("PluginCertifierHashes",le("{}")),be={}}Object.keys(be).forEach(e=>{let t=be[e];if(!t||"object"!=typeof t||Array.isArray(t))return delete be[e];let n=[{key:"timestamp",type:"number"},{key:"result",type:"object"},{key:"hash",type:"string"}];for(let s of n)if(!(s.key in t)||typeof t[s.key]!==s.type)return void delete be[e];t.hash===e||delete be[e]}),this.saveAddonCache()}saveAddonCache(){Se.setSettingGroup("PluginCertifierHashes",le(JSON.stringify(be)))}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]=de.watch(n,{persistent:!1},async(e,r)=>{if(!e||!r||!r.endsWith(s))return;await new Promise(e=>setTimeout(e,50));try{de.statSync(ce.resolve(n,r))}catch(e){if("ENOENT"!==e.code)return;return delete this.timeCache[r],t?$.unloadPlugin(r):R.unloadTheme(r)}if(!de.statSync(ce.resolve(n,r)).isFile())return;const o=de.statSync(ce.resolve(n,r));o&&o.mtime&&o.mtime.getTime()&&"number"==typeof o.mtime.getTime()&&this.timeCache[r]!=o.mtime.getTime()&&(this.timeCache[r]=o.mtime.getTime(),"rename"==e&&(t?await $.loadPlugin(r):await R.loadTheme(r)),"change"==e&&(t?await $.reloadPlugin(r):await R.reloadTheme(r)))})}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 he("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 he("META was not found.");const s=N.testJSON(n);if(!s)throw new he("META could not be parsed.");if(!s.name)throw new he("META missing name data.");return s.format="json",s}parseNewMeta(e){const t=e.split("/**",2)[1].split("*/",1)[0],n={};let s="",r="";for(const e of t.split(ge))if(0!==e.length)if("@"===e.charAt(0)&&" "!==e.charAt(1)){n[s]=r;const t=e.indexOf(" ");s=e.substr(1,t-1),r=e.substr(t+1)}else r+=" "+e.replace("\\n","\n").replace(fe,"@");return n[s]=r.trim(),delete n[""],n.format="jsdoc",n}getContentRequire(e){const t="plugin"===e,n=this,s=t?pe:me;return function(e,r){const o=t?n.pluginsFolder:n.themesFolder,a=ce.resolve(o,ce.basename(r));if(!de.existsSync(a)||r!==de.realpathSync(a))return Reflect.apply(s,this,arguments);let i=de.readFileSync(r,"utf8");i=N.stripBOM(i);const l=de.statSync(r),c=n.extractMeta(i);if(c.filename=ce.basename(r),c.added=l.atimeMs,c.modified=l.mtimeMs,c.size=l.size,t||(c.css=i,"json"==c.format&&(c.css=c.css.split("\n").slice(1).join("\n")),i=`module.exports = ${JSON.stringify(c)};`),t){e._compile(i,e.filename),!N.isEmpty(e.exports)?(c.type=e.exports,e.exports=c,i=""):i+=`\nmodule.exports = ${JSON.stringify(c)};\nmodule.exports.type = ${c.exports||c.name};`}e._compile(i,r)}}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:""}}async loadContent(e,t){if(void 0===e||void 0===t)return;const n="plugin"===t,s=n?this.pluginsFolder:this.themesFolder;if(y["fork-ps-6"]){let t=await new Promise(t=>{te(ce.resolve(s,e),e=>{console.log(e),t(e)},n=>{t({suspect:!1,hash:n,filename:e,name:e})},!0)});if(t&&(be[t.hash]={timestamp:Date.now(),hash:t.hash,result:t},this.saveAddonCache(),t.suspect))return{name:e,file:e,message:"This plugin might be dangerous ("+t.harm+").",error:new Error("This plugin might be dangerous ("+t.harm+").")}}try{window.require(ce.resolve(s,e))}catch(t){return{name:e,file:e,message:"Could not be compiled.",error:{message:t.message,stack:t.stack}}}const r=window.require(ce.resolve(s,e));if(!r.name)return{name:e,file:e,message:"Cannot escape the ID.",error:{message:"Cannot read property 'replace' of undefined",stack:"Cannot read property 'replace' of undefined"}};if(r.id=N.escapeID(r.name),n){if(!r.type)return;try{r.plugin=new r.type,delete D[r.plugin.getName()],D[r.plugin.getName()]=r}catch(t){return{name:e,file:e,message:"Could not be constructed.",error:{message:t.message,stack:t.stack}}}}else delete x[r.name],x[r.name]=r}unloadContent(e,t){if(void 0===e||void 0===t)return;const n="plugin"===t?this.pluginsFolder:this.themesFolder;try{delete window.require.cache[window.require.resolve(ce.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{window.require.cache[window.require.resolve(ce.resolve(n,e))]}catch(e){return!1}return!0}async reloadContent(e,t){const n=this.unloadContent(e,t);return n||await this.loadContent(e,t)}loadNewContent(e){const t="plugin"===e,n=t?".plugin.js":".theme.css",s=t?this.pluginsFolder:this.themesFolder,r=de.readdirSync(s),o=Object.values(t?D:x),a=o.filter(e=>!r.includes(e.filename)).map(e=>t?e.plugin.getName():e.name);return{added:r.filter(e=>!o.find(t=>t.filename==e)&&e.endsWith(n)&&de.statSync(ce.resolve(s,e)).isFile()),removed:a}}async loadAllContent(e){const t="plugin"===e,n=t?".plugin.js":".theme.css",s=t?this.pluginsFolder:this.themesFolder,r=[],o=de.readdirSync(s);for(const t of o){if(!de.statSync(ce.resolve(s,t)).isFile()||!t.endsWith(n))continue;const o=await this.loadContent(t,e);o&&r.push(o)}return r}loadPlugins(){return this.loadAllContent("plugin")}loadThemes(){return this.loadAllContent("theme")}};const ve=window.require,Ee=n(2),we=n(1),Ce=DiscordNative.globals?DiscordNative.globals.releaseChannel:DiscordNative.app?DiscordNative.app.getReleaseChannel():"stable";var Se=new class{constructor(){this.data={settings:{stable:{},canary:{},ptb:{}}},this.pluginData={},window.Lightcord.BetterDiscord.DataStore=this}initialize(){try{Ee.existsSync(this.BDFile)||Ee.writeFileSync(this.BDFile,JSON.stringify(this.data,null,4),"binary");const e=JSON.parse(Ee.readFileSync(this.BDFile,"binary"));if(e.hasOwnProperty("settings")&&(this.data=e),!Ee.existsSync(this.settingsFile))return;let t=ve(this.settingsFile);Ee.unlinkSync(this.settingsFile),t=t.hasOwnProperty("settings")?Object.assign({stable:{},canary:{},ptb:{}},{[Ce]:t}):Object.assign({stable:{},canary:{},ptb:{}},t),this.setBDData("settings",t)}catch(e){console.error(e),N.alert("Corrupt Storage","The bd storage has somehow become corrupt. You may either try to salvage the file or delete it then reload.")}}get injectionPath(){return this._injectionPath=null}get configFile(){return this._configFile||(this._configFile=we.resolve(this.injectionPath,"betterdiscord","config.json"))}get BDFile(){return this._BDFile||(this._BDFile=we.resolve(S.dataPath,"bdstorage.json"))}get settingsFile(){return this._settingsFile||(this._settingsFile=we.resolve(S.dataPath,"bdsettings.json"))}getPluginFile(e){return we.resolve(ye.pluginsFolder,e+".config.json")}getSettingGroup(e){return this.data.settings[Ce][e]||null}setSettingGroup(e,t){this.data.settings[Ce][e]=t,Ee.writeFileSync(this.BDFile,JSON.stringify(this.data,null,4),"binary")}getBDData(e){return this.data[e]||""}setBDData(e,t){this.data[e]=t,Ee.writeFileSync(this.BDFile,JSON.stringify(this.data,null,4),"binary")}getPluginData(e,t){return void 0!==this.pluginData[e]?this.pluginData[e][t]:Ee.existsSync(this.getPluginFile(e))?(this.pluginData[e]=JSON.parse(Ee.readFileSync(this.getPluginFile(e))),this.pluginData[e][t]):void 0}setPluginData(e,t,n){void 0!==n&&(void 0===this.pluginData[e]&&(this.pluginData[e]={}),this.pluginData[e][t]=n,Ee.writeFileSync(this.getPluginFile(e),JSON.stringify(this.pluginData[e],null,4),"binary"))}deletePluginData(e,t){void 0===this.pluginData[e]&&(this.pluginData[e]={}),delete this.pluginData[e][t],Ee.writeFileSync(this.getPluginFile(e),JSON.stringify(this.pluginData[e],null,4),"binary")}};class xe{constructor(){this.panels={}}register(e,t){this.panels[e]=t}getComponent(e){return this.panels[e]}get items(){return[{text:"BetterDiscord Settings",id:"core"},{text:"Plugins",id:"plugins"},{text:"Themes",id:"themes"},{text:"Custom CSS",id:"customcss"}]}get LCitems(){let e=[{text:"Lightcord Settings",id:"lightcord"},{text:"RichPresence",id:"status"},{text:"Account Info",id:"accountinfo"}];return window.Lightcord.Settings.devMode&&e.push({text:"Api Components Preview",id:"lcapipreview"}),e}render(){return[{section:"HEADER",label:"Lightcord"},...this.LCitems.map(e=>({section:e.id,label:e.text,element:this.getComponent(e.id)})),{section:"DIVIDER"},{section:"CUSTOM",element:this.getComponent("BDChangelogTitle")},...this.items.map(e=>({section:e.id,label:e.text,element:this.getComponent(e.id)})),{section:"DIVIDER"}]}}var De=new class{injectColoredText(){this.cancelColoredText||o.MessageComponent&&(this.cancelColoredText=N.monkeyPatch(o.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=y["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(){let e=BDModules.get(e=>e.markup)[0].markup;document.querySelectorAll("."+e.split(" ")[0]).forEach(e=>{e.style.setProperty("color","")})}},ke=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(!y["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=N.monkeyPatch(o.TimeFormatter,"calendarFormat",{after:t}),s=N.monkeyPatch(o.TimeFormatter,"dateFormat",{after:t});this.cancel24Hour=()=>{n(),s()}}remove24Hour(){this.cancel24Hour&&this.cancel24Hour()}};class Me extends o.reactComponent{constructor(e){super(e)}render(){return o.react.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 12 12",style:{width:"18px",height:"18px"}},o.react.createElement("g",{className:"background",fill:"none",fillRule:"evenodd"},o.react.createElement("path",{d:"M0 0h12v12H0"}),o.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 Be extends o.reactComponent{constructor(e){super(e),this.onClick=this.onClick.bind(this)}render(){let e=BDModules.get(e=>e.toolsContainer)[0],t=BDModules.get(e=>e.container&&e.closeButton&&e.closeButtonBold)[0];return o.react.createElement("div",{className:"tools-container "+e.toolsContainer},o.react.createElement("div",{className:"tools "+e.tools},o.react.createElement("div",{className:t.container},o.react.createElement("div",{className:"btn-close "+t.closeButton,onClick:this.onClick},o.react.createElement(Me,null)),o.react.createElement("div",{className:"esc-text "+t.keybind},"ESC"))))}onClick(){this.props.onClick&&this.props.onClick();const e=document.querySelector("."+BDModules.get(e=>e.closeButton&&e.keybindBold)[0].closeButton.split(" ")[0]);e&&e.click()}}class Ne extends o.reactComponent{constructor(e){super(e)}render(){return o.react.createElement("h2",{className:"ui-form-title h2 margin-reset margin-bottom-20"},this.props.text)}}class Pe extends o.reactComponent{constructor(e){super(e)}render(){return o.react.createElement("div",{className:"ui-tab-bar-separator margin-top-8 margin-bottom-8"})}}class Le extends o.reactComponent{constructor(e){super(e)}render(){return o.react.createElement("div",{className:"ui-tab-bar-header"},this.props.text,this.props.button)}}class Ae extends o.reactComponent{constructor(e){super(e),this.setInitialState(),this.onClick=this.onClick.bind(this)}setInitialState(){this.state={selected:this.props.selected||!1}}render(){return o.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 $e extends o.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;let t=BDModules.get(e=>e.card&&e.cardPrimary)[0],n=BDModules.get(e=>e.flexChild&&e._horizontalReverse)[0],s=BDModules.get(e=>e.noWrap&&!e.streamerModeEnabled)[0];return o.react.createElement("div",{className:`${t.card} ${t.cardPrimary} ${BDModules.get(e=>e.marginBottom8)[0].marginBottom8} bd-server-card${e.pinned?" bd-server-card-pinned":""}`},o.react.createElement("img",{ref:"img",className:"bd-server-image",src:e.iconUrl,onError:this.handleError.bind(this),draggable:!1}),o.react.createElement("div",{className:n.flexChild+" bd-server-content"},o.react.createElement("div",{className:n.horizontal+" "+s.noWrap+" bd-server-header"},o.react.createElement("h5",{className:"h5-18_1nd defaultColor-1_ajX0 margin-reset bd-server-name"},e.name),o.react.createElement("h5",{className:"h5-18_1nd defaultColor-1_ajX0 margin-reset bd-server-member-count"},e.members," Members")),o.react.createElement("div",{className:n.horizontal+" "+s.noWrap},o.react.createElement("div",{className:"scrollerWrap-2lJEkd scrollerThemed-2oenus themeGhostHairline-DBD-2d scrollerFade-1Ijw5y bd-server-description-container"},o.react.createElement("div",{className:"scroller-2FKFPG scroller bd-server-description"},e.description))),o.react.createElement("div",{className:"flex-1xMQg5 flex-1O1GKY horizontal-1ae9ci horizontal-2EEEnY directionRow-3v3tfG noWrap-3jynv6 bd-server-footer"},o.react.createElement("div",{className:"flexChild-faoVW3 bd-server-tags",style:{flex:"1 1 auto"}},e.categories.join(", ")),this.state.joined&&o.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"}},o.react.createElement("div",{className:"ui-button-contents"},"Joined")),e.error&&o.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"}},o.react.createElement("div",{className:"ui-button-contents"},"Error")),!e.error&&!this.state.joined&&o.react.createElement("button",{type:"button",className:"button-38aScr lookFilled-1Gx00P colorBrand-3pXr91 sizeMin-1mJd1x grow-q77ONN",style:{minHeight:"12px",marginTop:"4px"},onClick:()=>{this.join()}},o.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 Te extends o.reactComponent{constructor(e){super(e)}render(){let e=BDModules.get(e=>e.scrollerHorizontal)[0],t=BDModules.get(e=>e.sidebarRegionScroller)[0],n=`${e.scrollerWrap} ${e.scrollerThemed} ${e.themeGhostHairline}${this.props.fade?" "+e.scrollerFade:""}`,s=e.scroller+" scroller";this.props.sidebar&&(s+=` ${t.sidebarRegionScroller} sidebar-region-scroller`),this.props.contentColumn&&(s+=" "+t.contentRegionScroller+" content-region-scroller",n=`${e.scrollerWrap} ${t.contentRegionScrollerWrap} content-region-scroller-wrap ${e.scrollerThemed} ${e.themeGhost} ${e.scrollerTrack}`);const{children:r}=this.props;return o.react.createElement("div",{key:"scrollerwrap",className:n},o.react.createElement("div",{key:"scroller",ref:"scroller",className:s},r))}}class Re extends o.reactComponent{constructor(e){super(e)}render(){const{sidebar:e,content:t,tools:n}=this.props.children;return o.react.createElement("div",{className:"standardSidebarView-3F1I7i ui-standard-sidebar-view"},o.react.createElement("div",{className:"sidebarRegion-VFTUkN sidebar-region"},o.react.createElement(Te,{key:"sidebarScroller",ref:"sidebarScroller",sidebar:!0,fade:e.fade||!0,dark:e.dark||!0},e.component)),o.react.createElement("div",{className:"contentRegion-3nDuYy content-region"},o.react.createElement("div",{className:"contentTransitionWrap-3hqOEW content-transition-wrap"},o.react.createElement("div",{className:"scrollerWrap-2lJEkd firefoxFixScrollFlex-cnI2ix contentRegionScrollerWrap-3YZXdm content-region-scroller-wrap scrollerThemed-2oenus themeGhost-28MSn0 scrollerTrack-1ZIpsv"},o.react.createElement("div",{className:"scroller-2FKFPG firefoxFixScrollFlex-cnI2ix contentRegionScroller-26nc1e content-region-scroller scroller",ref:"contentScroller"},o.react.createElement("div",{className:"contentColumn-2hrIYH contentColumnDefault-1VQkGM content-column default"},t.component),n.component)))))}}class je extends o.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=o.WebpackModules.findByUniqueProperties(["getGuilds"]),this.AvatarDefaults=o.WebpackModules.findByUniqueProperties(["getUserAvatarURL","DEFAULT_AVATARS"]),this.InviteActions=o.WebpackModules.findByUniqueProperties(["acceptInvite"]),this.SortedGuildStore=o.WebpackModules.findByUniqueProperties(["getSortedGuilds"])}componentDidMount(){this.checkConnection()}setInitialState(){this.state={selectedCategory:-1,title:"Loading...",loading:!0,servers:[],next:null,connection:{state:0,user:null}}}close(){o.reactDom.unmountComponentAtNode(document.getElementById(this.props.rootId))}search(e,t){const n=this;fetch(`${n.endPoint}${e}${e?"&schema=new":"?schema=new"}`,{method:"get"}).then(async e=>{if(200!==e.status)throw await e.text();let s=await e.json(),r=s.results.reduce((e,t)=>(t.joined=!1,e.push(t),e),[]);t||(r=n.state.servers.concat(r));let o=s.size+s.from;s.next=`?from=${o}`,n.state.term&&(s.next+=`&term=${n.state.term}`),n.state.selectedCategory&&(s.next+=`&category=${n.categoryButtons[n.state.selectedCategory]}`),o>=s.total&&(o=s.total,s.next=null);let a=`Showing 1-${o} of ${s.total} results in ${n.categoryButtons[n.state.selectedCategory]}`;n.state.term&&(a+=` for ${n.state.term}`),n.setState({loading:!1,title:a,servers:r,next:s.next}),t&&(n.refs.sbv.refs.contentScroller.scrollTop=0)}).catch(e=>(console.error(e),n.setState({loading:!1,title:"Failed to load servers. Check console for details"})))}async join(e){if(e.props.pinned)return this.InviteActions.acceptInvite(e.props.invite_code);await fetch(`${this.joinEndPoint}/${e.props.server.identifier}`,{method:"GET",credentials:"include",mode:"cors",headers:{Accept:"application/json","Content-Type":"application/json"}}),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[o.react.createElement($e,{server:{name:"Lightcord",online:"30+",members:"50+",categories:["community","programming","support"],description:"Official Lightcord server for support etc",identifier:"86004744966914048",iconUrl:"https://avatars3.githubusercontent.com/u/65690058?s=200&v=4",nativejoin:!0,invite_code:"7eFff2A",pinned:!0},pinned:!0,join:this.join,guildList:e,fallback:t[Math.floor(5*Math.random())]}),o.react.createElement($e,{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"}async checkConnection(){const e=this;try{const t=await fetch("https://auth.discordservers.com/info",{method:"GET",credentials:"include",mode:"cors",headers:{Accept:"application/json","Content-Type":"application/json"}}),n=await t.json();e.setState({selectedCategory:0,connection:{state:2,user:n}}),e.search("",!0)}catch(t){console.error(t),e.setState({title:"Not connected to discordservers.com!",loading:!0,selectedCategory:-1,connection:{state:1,user:null}})}}render(){return o.react.createElement(Re,{ref:"sbv"},this.component)}get component(){return{sidebar:{component:this.sidebar},content:{component:this.content},tools:{component:o.react.createElement(Be,{key:"pt",ref:"tools",onClick:this.close})}}}get sidebar(){return o.react.createElement("div",{className:"sidebar",key:"ps"},o.react.createElement("div",{className:"ui-tab-bar SIDE"},o.react.createElement("div",{className:"ui-tab-bar-header",style:{fontSize:"16px"}},"Public Servers"),o.react.createElement(Pe,null),this.searchInput,o.react.createElement(Pe,null),o.react.createElement(Le,{text:"Categories"}),this.categoryButtons.map((e,t)=>o.react.createElement(Ae,{id:t,onClick:this.changeCategory,key:t,text:e,selected:this.state.selectedCategory===t})),o.react.createElement(Pe,null),this.footer,this.connection))}get searchInput(){return o.react.createElement("div",{className:"ui-form-item"},o.react.createElement("div",{className:"ui-text-input flex-vertical",style:{width:"172px",marginLeft:"10px"}},o.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;if(1===e.state.connection.state)return e.notConnected;let s=BDModules.get(e=>e.contentColumnDefault)[0];return[o.react.createElement("div",{ref:"content",key:"pc",className:s.contentColumn+" "+s.contentColumn+" content-column default"},o.react.createElement(Ne,{text:e.state.title}),e.bdServer,e.state.servers.map(s=>o.react.createElement($e,{key:s.identifier,server:s,join:e.join,guildList:t,fallback:n[Math.floor(5*Math.random())]})),e.state.next&&o.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"}},o.react.createElement("div",{className:"ui-button-contents"},e.state.loading?"Loading":"Load More")),e.state.servers.length>0&&o.react.createElement(Ne,{text:e.state.title}))]}get notConnected(){let e=BDModules.get(e=>e.contentColumnDefault)[0];return[o.react.createElement("div",{key:"ncc",ref:"content",className:e.contentColumn+" "+e.contentColumn+" content-column default"},o.react.createElement("h2",{className:"ui-form-title h2 margin-reset margin-bottom-20"},"Not connected to discordservers.com!",o.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"}},o.react.createElement("div",{className:"ui-button-contents"},"Connect"))),this.bdServer)]}get footer(){return o.react.createElement("div",{className:"ui-tab-bar-header"},o.react.createElement("a",{href:"https://discordservers.com",target:"_blank"},"Discordservers.com"))}get connection(){const{connection:e}=this.state;return 2!==e.state?o.react.createElement("span",null):o.react.createElement("span",null,o.react.createElement(Pe,null),o.react.createElement("span",{style:{color:"#b9bbbe",fontSize:"10px",marginLeft:"10px"}},"Connected as: ",`${e.user.username}#${e.user.discriminator}`),o.react.createElement("div",{style:{padding:"5px 10px 0 10px"}},o.react.createElement("button",{style:{width:"100%",minHeight:"20px"},type:"button",className:"ui-button filled brand small grow"},o.react.createElement("div",{className:"ui-button-contents",onClick:this.connect},"Reconnect"))))}}class Oe extends o.reactComponent{constructor(e){super(e),this.keyupListener=this.keyupListener.bind(this)}keyupListener(e){27===e.which&&o.reactDom.unmountComponentAtNode(this.refs.root.parentNode)}componentDidMount(){window.addEventListener("keyup",this.keyupListener);const e=B.query(`#${this.props.id}`);B.animate({duration:200,update:function(t){e.style.transform=`scale(${1.1-.1*t}) translateZ(0px)`,e.style.opacity=t,1==t&&setImmediate(()=>{e.style.transform="",e.style.opacity=""})}})}componentWillUnmount(){window.removeEventListener("keyup",this.keyupListener);const e=B.query(`#${this.props.id}`);B.animate({duration:200,update:function(t){e.style.transform=`scale(${1.1-.1*(1-t)}) translateZ(0px)`,e.style.opacity=1-t,1==t&&setImmediate(()=>{e.remove()})}});const t=B.query(".publicServersOpen");t.classList.remove("publicServersOpen"),B.animate({duration:200,update:function(e){t.style.transform=`scale(${.07*e+.93}) translateZ(0px)`,t.style.opacity=e,1==e&&setImmediate(()=>{t.style.transform="",t.style.opacity=""})}})}componentWillMount(){const e=B.query('[class*="layer-"]');e.classList.add("publicServersOpen"),B.animate({duration:200,update:function(t){e.style.transform=`scale(${.07*(1-t)+.93}) translateZ(0px)`,e.style.opacity=1-t}})}render(){return o.react.createElement("div",{className:"layer bd-layer "+BDModules.get(e=>e.layer&&e.animating)[0].layer,id:this.props.id,ref:"root",style:{opacity:0,transform:"scale(1.1) translateZ(0px)"}},this.props.children)}}var Ie=new class{constructor(){this._appendButton=this._appendButton.bind(this),window.Lightcord.BetterDiscord.V2_PublicServers=this}get component(){return o.react.createElement(Oe,{rootId:"pubslayerroot",id:"pubslayer"},o.react.createElement(je,{rootId:"pubslayerroot"}))}get root(){const e=document.getElementById("pubslayerroot");return e||(this.injectRoot()?this.root:null)}injectRoot(){let[e]=[BDModules.get(e=>e.layers&&e.layer)[0].layers.split(" ")[0]];const t=B.query(".layers, ."+e);return!!t&&(t.append(B.createElement("
")),!0)}render(){const e=this.root;e?o.reactDom.render(this.component,e):console.log("FAILED TO LOCATE ROOT: .layers")}get button(){const e=B.createElement(`
`);y["bda-gs-1"]||(e.style.display="none");const t=B.createElement(`
public
`);return t.addEventListener("click",()=>{this.render()}),e.append(t),e}_appendButton(){let[e]=[N.removeDa(BDModules.get(e=>e.downloadProgress&&e.tutorialContainer)[0].tutorialContainer)];if(B.query("#bd-pub-li"))return;const t=B.query(`div.${e} > div`);B.after(t,this.button)}addButton(){if(this.guildPatch)return;const e=c.find(e=>e.default&&"NavigableGuilds"==e.default.displayName),t=c.findByDisplayName("Guilds");e||t||N.warn("PublicServer","Can't find GuildList component"),this.guildPatch=N.monkeyPatch(e||t.prototype,e?"default":"render",{after:this._appendButton}),this._appendButton()}removeButton(){this.guildPatch(),delete this.guildPatch,B.query("#bd-pub-li").remove()}};var _e=new class{start(){B.addStyle("VoiceMode","\n .container-2Rl01u {\n display: none!important;\n }\n\n .chat-3bRxxu {\n display: none!important;\n }\n\n .sidebar-2K8pFh {\n flex-grow: 1!important;\n }\n")}stop(){B.removeStyle("VoiceMode")}};const Fe=new RegExp("^(?!da-)((?:[A-Za-z]|[0-9]|-)+)-(?:[A-Za-z]|[0-9]|-|_){6}$");var He=new class{constructor(){window.Lightcord.BetterDiscord.BDEvents=this}stop(){this.hasPatched&&(this.unpatchClassModules(c.findAll(this.moduleFilter.bind(this))),this.revertElement(document.querySelector("#app-mount")),this.hasPatched=!1)}start(){this.hasPatched||(this.patchClassModules(c.findAll(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(!Fe.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 r=s.split(" ");for(const s of r){const r=s.match(Fe);if(!r||!r.length||r.length<2)continue;const o=r[1].split("-").map((e,t)=>t?e[0].toUpperCase()+e.slice(1):e).join("");t[n]+=` ${e}-${o}`}}}unpatchClassModule(e,t){for(const n in t){const s=t[n];if(this.shouldIgnore(s))continue;let r="";const o=s.split(" ");for(const t of o)t.startsWith(`${e}-`)||(r+=` ${t}`);t[n]=r.trim()}}normalizeElement(e){if(!(e instanceof Element))return;const t=e.classList;for(let n=0,s=t.length;nt?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;ee.layer&&"string"==typeof e.layer&&e.disabledPointerEvents)[0],BDModules.get(e=>e.menu)[0]];setTimeout((function(){if(!s||!n.layer)return console.log(s,n.layer);let r=B.query("."+N.removeDa(s.menu));if(!r){const t=B.query("#app-mount > ."+N.removeDa(n.layerContainer)),o=B.createElement(`
`);r=B.createElement(`
`),o.append(r),t.append(o),o.style.top=e.clientY+"px",o.style.left=e.clientX+"px",o.setAttribute("role","menu"),o.setAttribute("tabindex","-1"),o.id="bd-copy-selector-context",o.setAttribute("aria-label","Copy Selector Actions");const a=BDModules.get(e=>e.scrollerWrap)[0],i=B.createElement(`
`),l=B.createElement(`
`);i.append(l),r.append(i);const c=function(e){e.keyCode&&27!==e.keyCode||(o.remove(),document.removeEventListener("click",c),document.removeEventListener("contextmenu",c),document.removeEventListener("keyup",c))};document.addEventListener("click",c),document.addEventListener("contextmenu",c),document.addEventListener("keyup",c)}const a=r.parentElement,i=r.childNodes[0].childNodes[0],l=B.createElement('
'),c=B.createElement(``);if(c.append(B.createElement(`
Copy Selector
`)),c.addEventListener("click",()=>{o.NativeModule.copy(t),a.style.display="none"}),c.addEventListener("mouseover",e=>{let t=B.queryAll("div[role=menuitem]."+N.removeDa(s.focused));t&&t.forEach(e=>e.classList.remove(s.focused)),c.classList.add(s.focused)}),c.addEventListener("mouseout",e=>{c.classList.remove(s.focused)}),l.append(c),i.childNodes.length){const e=B.createElement(``);i.append(e)}i.append(l),a.clientHeight"."+e).join(""));else{for(var n=1,s=e;s.previousElementSibling;s=s.previousElementSibling,n++);t.unshift(e.tagName.toLowerCase()+("string"==typeof e.className&&e.className||"").split(" ").filter(e=>!!e).map(e=>"."+e).join("")+":nth-child("+n+")")}e=e.parentNode}return t.join(" > ")}(e)}getRules(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("*"))}};const We=o.React;class Ue extends We.Component{constructor(e){super(e),this.state={checked:this.props.checked},this.onChange=this.onChange.bind(this)}onChange(e){this.props.disabled||(this.props.onChange(e),this.setState({checked:e}))}render(){return We.createElement(Lightcord.Api.Components.inputs.Switch,{onChange:this.onChange,value:this.state.checked})}}class qe extends o.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 o.react.createElement("div",{className:"ui-flex flex-vertical flex-justify-start flex-align-stretch flex-nowrap ui-switch-item"},o.react.createElement("div",{className:"ui-flex flex-horizontal flex-justify-start flex-align-stretch flex-nowrap"},o.react.createElement("h3",{className:"ui-form-title h3 margin-reset margin-reset ui-flex-child"},e),o.react.createElement(Ue,{onChange:this.onChange,checked:this.props.checked})),o.react.createElement("div",{className:"ui-form-text style-description margin-top-4",style:{flex:"1 1 auto"}},t))}}class Ge extends o.reactComponent{constructor(e){super(e)}render(){const{title:e,settings:t,button:n}=this.props,s=n?o.react.createElement("button",{key:"title-button",className:"bd-pfbtn",onClick:n.onClick},n.title):null;return[o.react.createElement(Ne,{text:e}),s,t.map(e=>o.react.createElement(qe,{id:e.id,key:e.id,data:e,checked:y[e.id],onChange:(e,t)=>{this.props.onChange(e,t)}}))]}}let Ve=BDModules.get(e=>e.marginTop60)[0];class Je extends React.Component{render(){return Ve||(Ve=BDModules.get(e=>e.marginTop60)[0]),React.createElement("div",{className:Ve.marginTop60})}}class Ze extends o.reactComponent{constructor(e){super(e)}render(){return this.props.sections.map((e,t)=>[0!==t?o.react.createElement(Je,{}):null,o.react.createElement(Ge,Object.assign({},e,{onChange:this.props.onChange}))])}}class Ye extends o.reactComponent{constructor(e){super(e),this.onClick=this.onClick.bind(this),this.setInitialState()}setInitialState(){this.state={checked:this.props.checked||!1}}render(){return o.react.createElement("li",null,o.react.createElement("div",{className:"checkbox "+BDModules.get(e=>e.checkboxElement)[0].checkbox,onClick:this.onClick},o.react.createElement("div",{className:"checkbox-inner "+BDModules.get(e=>e.checkboxInner)[0].checkboxInner},o.react.createElement("input",{className:BDModules.get(e=>e.checkboxElement)[0].checkboxElement,checked:this.state.checked,onChange:()=>{},type:"checkbox"}),o.react.createElement("span",null)),o.react.createElement("span",null,this.props.text)))}onClick(){this.props.onChange(this.props.id,!this.state.checked),this.setState({checked:!this.state.checked})}}class Ke extends o.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(){B.addClass(B.query("#app-mount"),"bd-detached-editor"),o.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",()=>{y["bda-css-0"]&&(this.saveCss(),this.updateCss())})}componentWillUnmount(){B.removeClass(B.query("#app-mount"),"bd-detached-editor"),o.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=Se.getBDData("bdcustomcss");let t="";return e&&""!==e&&(t=atob(e)),t}get root(){const e=B.query("#bd-customcss-detach-container");return e||(this.injectRoot()?this.detachedRoot:null)}injectRoot(){const e=B.query(".app, ."+BDModules.get(e=>e.app&&e.layers)[0].app.split(" ")[0]);return!!e&&(B.insertAfter(B.createElement('
'),e),!0)}render(){const e=this;return o.react.createElement("div",{className:"bd-detached-css-editor",id:"bd-customcss-detach-editor"},o.react.createElement("div",{id:"bd-customcss-innerpane"},o.react.createElement("div",{className:"editor-wrapper"},o.react.createElement("div",{id:"bd-customcss-editor-detached",className:"editor",ref:"editor"},e.css)),o.react.createElement("div",{id:"bd-customcss-attach-controls"},o.react.createElement("ul",{className:"checkbox-group"},o.react.createElement(Ye,{id:"live-update",text:"Live Update",onChange:e.onChange,checked:y["bda-css-0"]})),o.react.createElement("div",{id:"bd-customcss-detach-controls-button"},o.react.createElement("button",{style:{borderRadius:"3px 0 0 3px",borderRight:"1px solid #3f4146"},className:"btn btn-primary",onClick:()=>{e.onClick("update")}},"Update"),o.react.createElement("button",{style:{borderRadius:"0",borderLeft:"1px solid #2d2d2d",borderRight:"1px solid #2d2d2d"},className:"btn btn-primary",onClick:()=>{e.onClick("save")}},"Save"),o.react.createElement("button",{style:{borderRadius:"0 3px 3px 0",borderLeft:"1px solid #3f4146"},className:"btn btn-primary",onClick:()=>{e.onClick("attach")}},"Attach"),o.react.createElement("span",{style:{fontSize:"10px",marginLeft:"5px"}},"Unsaved changes are lost on attach")))))}onChange(e,t){switch(e){case"live-update":y["bda-css-0"]=t,Jn.saveSettings()}}onClick(e){const t=this;switch(e){case"attach":B.query("#editor-detached")&&t.props.attach(),o.reactDom.unmountComponentAtNode(t.root),t.root.remove();break;case"update":t.updateCss();break;case"save":t.saveCss()}}updateCss(){B.removeStyle("customcss"),B.addStyle("customcss",this.editor.session.getValue())}saveCss(){Se.setBDData("bdcustomcss",btoa(this.editor.session.getValue()))}}class Xe extends o.reactComponent{constructor(e){super(e);this.props.lines=0,this.setInitialState(),this.attach=this.attach.bind(this),this.detachedEditor=o.react.createElement(Ke,{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||o.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",()=>{y["bda-css-0"]&&(this.saveCss(),this.updateCss())})}componentWillUnmount(){this.editor.destroy()}componentDidUpdate(e,t){const n=this;t.detached&&!n.state.detached&&o.reactDom.unmountComponentAtNode(n.detachedRoot)}codeMirror(){}get options(){return{lineNumbers:!0,mode:"css",indentUnit:4,theme:"material",scrollbarStyle:"simple"}}get css(){const e=Se.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[t&&o.react.createElement("div",{id:"editor-detached"},o.react.createElement(Ne,{text:"Custom CSS Editor"}),o.react.createElement("h3",null,"Editor Detached"),o.react.createElement("button",{className:"btn btn-primary",onClick:()=>{e.attach()}},"Attach")),!t&&o.react.createElement("div",null,o.react.createElement(Ne,{text:"Custom CSS Editor"}),o.react.createElement("div",{className:"editor-wrapper"},o.react.createElement("div",{id:"bd-customcss-editor",className:"editor",ref:"editor"},e.css)),o.react.createElement("div",{id:"bd-customcss-attach-controls"},o.react.createElement("ul",{className:"checkbox-group"},o.react.createElement(Ye,{id:"live-update",text:"Live Update",onChange:this.onChange,checked:y["bda-css-0"]})),o.react.createElement("div",{id:"bd-customcss-detach-controls-button"},o.react.createElement("button",{style:{borderRadius:"3px 0 0 3px",borderRight:"1px solid #3f4146"},className:"btn btn-primary",onClick:()=>{e.onClick("update")}},"Update"),o.react.createElement("button",{style:{borderRadius:"0",borderLeft:"1px solid #2d2d2d",borderRight:"1px solid #2d2d2d"},className:"btn btn-primary",onClick:()=>{e.onClick("save")}},"Save"),o.react.createElement("button",{style:{borderRadius:"0 3px 3px 0",borderLeft:"1px solid #3f4146"},className:"btn btn-primary",onClick:()=>{e.onClick("detach")}},"Detach"),o.react.createElement("span",{style:{fontSize:"10px",marginLeft:"5px"}},"Unsaved changes are lost on detach"),o.react.createElement("div",{className:"help-text"},"Press ",o.react.createElement("code",{className:"inline"},"ctrl"),"+",o.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":y["bda-css-0"]=t,Jn.saveSettings()}}updateCss(){B.removeStyle("customcss"),B.addStyle("customcss",this.editor.session.getValue())}saveCss(){Se.setBDData("bdcustomcss",btoa(this.editor.session.getValue()))}detach(){this.setState({detached:!0});const e=this.detachedRoot;e?o.reactDom.render(this.detachedEditor,e):console.log("FAILED TO INJECT ROOT: .app")}get detachedRoot(){const e=B.query("#bd-customcss-detach-container");return e||(this.injectDetachedRoot()?this.detachedRoot:null)}injectDetachedRoot(){const e=B.query(".app, ."+BDModules.get(e=>e.app&&e.layers)[0].app.split(" ")[0]);return!!e&&(B.insertAfter(B.createElement('
'),e),!0)}attach(){this.setState({detached:!1})}}class Qe extends o.reactComponent{constructor(e){super(e),this.state={hasError:!1}}componentDidCatch(){this.setState({hasError:!0})}render(){return this.state.hasError?o.react.createElement("div",{className:"react-error"},"Component Error"):this.props.children}}const et=Qe.prototype.render;Object.defineProperty(Qe.prototype,"render",{enumerable:!1,configurable:!1,set:function(){console.warn("Addon policy for plugins #5 https://github.com/rauenzi/BetterDiscordApp/wiki/Addon-Policies#plugins")},get:()=>et});class tt extends o.reactComponent{constructor(e){super(e)}static get displayName(){return"ContentColumn"}render(){let e=this.props.title?o.react.createElement("h2",{className:"ui-form-title h2 margin-reset margin-bottom-20"},this.props.title):null;return[e,this.props.children]}}class nt extends o.reactComponent{constructor(e){super(e)}render(){return o.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"}},o.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"}),o.react.createElement("path",{fill:"none",d:"M0 0h24v24H0z"}))}}const st=o.React;class rt extends st.Component{render(){const e=this.props.size||"24px";return st.createElement("svg",{className:this.props.className||"",viewBox:"0 0 24 24",fill:"#FFFFFF",style:{width:e,height:e},onClick:this.props.onClick},st.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"}),st.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}))}}const ot=o.React;class at extends ot.Component{render(){const e=this.props.size||"24px";return ot.createElement("svg",{className:this.props.className||"",fill:"#FFFFFF",viewBox:"0 0 24 24",style:{width:e,height:e},onClick:this.props.onClick},ot.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),ot.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"}),ot.createElement("path",{fill:"none",d:"M0 0h24v24H0z"}))}}const it=o.React,lt=o.anchorClasses;class ct extends o.reactComponent{constructor(e){super(e),this.onChange=this.onChange.bind(this),this.showSettings=this.showSettings.bind(this),this.setInitialState(),this.hasSettings=this.props.addon.plugin&&"function"==typeof this.props.addon.plugin.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,trusted:!1}}showSettings(){this.hasSettings&&this.setState({settings:!0})}closeSettings(){this.panelRef.current.innerHTML="",this.setState({settingsOpen:!1})}componentDidUpdate(){this.state.settings&&("object"==typeof this.settingsPanel&&this.refs.settingspanel.appendChild(this.settingsPanel),y["fork-ps-3"]&&setImmediate(()=>{const e=this.refs.cardNode,t=e.closest('div[class*="scroller-"]');if(!((e,t)=>{const n=e.scrollTop,s=n+e.clientHeight,r=t.offsetTop,o=r+t.clientHeight;return rs})(t,e))return;const n=B.offset(e),s=B.offset(t),r=t.scrollTop,o=n.top-s.top+t.scrollTop-30;B.animate({duration:300,update:function(e){t.scrollTop=o>r?r+e*(o-r):r-e*(r-o)}})}))}getString(e){return e?"string"==typeof e?e:e.toString():"???"}get settingsComponent(){try{this.settingsPanel=this.props.addon.plugin.getSettingsPanel()}catch(e){N.err("Plugins","Unable to get settings panel for "+this.name+".",e)}return o.react.createElement("div",{className:"bd-card bd-addon-card settings-open ui-switch-item",ref:"cardNode"},o.react.createElement("div",{style:{float:"right",cursor:"pointer"},onClick:()=>{this.refs.settingspanel.innerHTML="",this.setState({settings:!1})}},o.react.createElement(Me,null)),"object"==typeof this.settingsPanel&&o.react.createElement("div",{id:`plugin-settings-${this.name}`,className:"plugin-settings",ref:"settingspanel"}),"object"!=typeof this.settingsPanel&&o.react.createElement("div",{id:`plugin-settings-${this.name}`,className:"plugin-settings",ref:"settingspanel",dangerouslySetInnerHTML:{__html:this.settingsPanel}}))}buildTitle(e,t,n){const s="{{name}} v{{version}} by {{author}}".split(/({{[A-Za-z]+}})/),r=s.findIndex(e=>"{{name}}"==e);r&&(s[r]=it.createElement("span",{className:"name bda-name"},e));const a=s.findIndex(e=>"{{version}}"==e);r&&(s[a]=it.createElement("span",{className:"version bda-version"},t));const i=s.findIndex(e=>"{{author}}"==e);if(r){const e={className:"author bda-author"};(n.link||n.id)&&(e.className+=` ${lt.anchor} ${lt.anchorUnderlineOnHover}`,e.target="_blank",n.link&&(e.href=n.link),n.id&&(e.onClick=()=>{o.LayerStack.popLayer(),o.openDM(n.id)})),s[i]=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()}),o.react.createElement("a",n,e)}makeButton(e,t,n){return it.createElement(V,{color:"black",side:"top",text:e},it.createElement("div",{className:"bd-addon-button",onClick:n},t))}componentWillUnmount(){this.unmounted=!0}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]),o.LayerStack.popLayer(),o.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)&&o.react.createElement("div",{className:"bd-card-footer bda-footer"},o.react.createElement("span",{className:"bd-addon-links bda-links"},...e.map((t,n)=>n{this.unmounted||this.setState({isTrusted:!e.suspect||"suspect"})},()=>{}))),o.react.createElement("div",{className:"bd-card bd-addon-card settings-closed ui-switch-item",style:n},o.react.createElement("div",{className:"bd-addon-header bda-header"},o.react.createElement("div",{className:"bd-card-title bda-header-title"},this.buildTitle(this.name,this.version,{name:this.author,id:e,link:t})),o.react.createElement("div",{className:"bd-addon-controls bda-controls"},this.props.edit&&this.makeButton("Edit",it.createElement(rt,{className:"bd-icon"}),this.edit),this.props.remove&&this.makeButton("Delete",it.createElement(at,{className:"bd-icon"}),this.delete),this.props.reload&&this.makeButton("Reload",it.createElement(nt,{className:"bd-icon"}),this.reload),it.createElement(Ue,{onChange:this.onChange,checked:this.state.checked}))),o.react.createElement("div",{className:"bd-scroller-wrap bda-description-wrap scroller-wrap fade"},o.react.createElement("div",{className:"bd-scroller bd-addon-description bda-description scroller"},this.description)),this.footer)}}const dt=ct.prototype.render;Object.defineProperty(ct.prototype,"render",{enumerable:!1,configurable:!1,set:function(){console.warn("Addon policy for plugins #5 https://github.com/rauenzi/BetterDiscordApp/wiki/Addon-Policies#plugins")},get:()=>dt});const ut=o.React;class ht extends ut.Component{render(){const e=this.props.size||"16px";return ut.createElement("svg",{className:this.props.className||"",fill:"#FFFFFF",viewBox:"0 0 24 24",style:{width:e,height:e}},ut.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 pt=o.React;class mt extends pt.Component{constructor(e){super(e),this.state={open:!1,value:this.props.value||this.props.options[0].value},this.dropdown=pt.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 pt.createElement("div",{className:"bd-select-options"},this.props.options.map(t=>pt.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 pt.createElement("div",{className:`bd-select${e}${t}`,onClick:this.showMenu,ref:this.dropdown},pt.createElement("div",{className:"bd-select-value"},this.selected.label),pt.createElement(ht,{className:"bd-select-arrow"}),this.state.open&&this.options)}}const gt=o.React;class ft extends gt.Component{render(){const e=this.props.size||"16px";return gt.createElement("svg",{className:this.props.className||"",fill:"#FFFFFF",viewBox:"0 0 24 24",style:{width:e,height:e}},gt.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),gt.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 bt=o.React;class yt extends bt.Component{render(){return bt.createElement("div",{className:"bd-search-wrapper"},bt.createElement("input",{onChange:this.props.onChange,onKeyDown:this.props.onKeyDown,type:"text",className:"bd-search",placeholder:this.props.placeholder,maxLength:"50"}),bt.createElement(ft,null))}}function vt(){return(vt=Object.assign||function(e){for(var t=1;t{xs.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:this.getName(e),enabled:this.cookie[this.getName(e)],toggle:this.manager.toggle.bind(this.manager),remove:this.delete.bind(this),addon:e,hash:e.hash}}getString(e){return e?"string"==typeof e?e:e.toString():"???"}get list(){return"plugins"===this.props.type?Object.values(bdplugins):Object.values(bdthemes)}getAddons(){const e=this.list.sort((e,t)=>{const n=this.state.sort.charAt(0).toUpperCase()+this.state.sort.slice(1),s=e.plugin&&e.plugin[`get${n}`]?this.getString(e.plugin[`get${n}`]()):e[this.state.sort],r=t.plugin&&t.plugin[`get${n}`]?this.getString(t.plugin[`get${n}`]()):t[this.state.sort];return"string"==typeof s?s.toLocaleLowerCase().localeCompare(r.toLocaleLowerCase()):s>r?1:r>s?-1:0});this.state.ascending||e.reverse();const t=[];for(let n=0;nwt.createElement(nt,vt({},e,{className:"bd-icon bd-reload bd-reload-header",size:"18px",onClick:async()=>{this.isPlugins?$.updatePluginList():R.updateThemeList(),this.forceUpdate()}}))),t=this.getAddons();return wt.createElement(tt,{title:`${this.props.type.toUpperCase()}—${t.length}`},wt.createElement("button",{key:"folder-button",className:"bd-button bd-pfbtn",onClick:this.openFolder.bind(this)},"Open ",this.isPlugins?"Plugin":"Theme"," Folder"),!y["fork-ps-5"]&&e,wt.createElement("div",{className:"bd-controls bd-addon-controls"},wt.createElement(yt,{onChange:this.search,placeholder:`Search ${this.props.type}...`}),wt.createElement("div",{className:"bd-addon-dropdowns"},wt.createElement("div",{className:"bd-select-wrapper"},wt.createElement("label",{className:"bd-label"},"Sort by:"),wt.createElement(mt,{options:this.sortOptions,onChange:this.sort,style:"transparent"})),wt.createElement("div",{className:"bd-select-wrapper"},wt.createElement("label",{className:"bd-label"},"Order:"),wt.createElement(mt,{options:this.directions,onChange:this.reverse,style:"transparent"})))),wt.createElement("div",{className:"bda-slist bd-addon-list"},t))}}const St=Ct.prototype.render;Object.defineProperty(Ct.prototype,"render",{enumerable:!1,configurable:!1,set:function(){console.warn("Addon policy for plugins #5 https://github.com/rauenzi/BetterDiscordApp/wiki/Addon-Policies#plugins")},get:()=>St});const xt=BDModules.get(e=>e.Dispatcher&&e.default&&e.default.dispatch)[0].default,Dt=BDModules.get(e=>e.ActionTypes)[0].ActionTypes,kt=process.pid;var Mt=new class{constructor(){this.enabled=!1,this.game=v}get formatedGame(){if(!this.game)return null;if(!1===this.enabled)return null;return{name:this.game.name||E.name,application_id:this.game.application_id||E.application_id,details:this.game.details||void 0,state:this.game.state||void 0,timestamps:this.game["timestamps.start"]?{start:this.game["timestamps.start"]}:void 0,assets:this.game["assets.large"]?{large_image:this.game["assets.large"],small_image:this.game["assets.small"]||void 0}:void 0}}sendGame(){xt.dispatch({type:Dt.LOCAL_ACTIVITY_UPDATE,socketId:"lightcord-spoof-socket",pid:kt,activity:this.formatedGame})}enable(){this.enabled||(this.enabled=!0,console.log("Enabling custom RichPresence"),this.set(v||Object.create(E)),this.sendGame())}disable(){this.enabled&&(this.enabled=!1,console.log("Disabling custom RichPresence"),this.sendGame())}async fetchAssets(e){let t=await BDModules.get(e=>e.getAssets)[0].getAssets(e);if(t.undefined&&"number"==typeof t.undefined)throw new Error("Unknown Application");return t}set(e){this.game=e,this.sendGame()}};const Bt=o.react,Nt=BDModules.get(e=>e.Interval)[0];var Pt=function(e,t){class n extends Bt.PureComponent{constructor(e){super(e),this._interval=new Nt.Interval,this.state=Object.assign({},this.getUpdatedTime())}componentDidMount(){let e=this;this._interval.start(1e3,(function(){return e.setState(e.getUpdatedTime())}))}componentWillUnmount(){this._interval.stop()}componentDidUpdate(e){e.timestamps.end===this.props.timestamps.end&&e.timestamps.start===this.props.timestamps.start||this.setState(this.getUpdatedTime())}getUpdatedTime(){let e=this.props.timestamps,t=Date.now()/1e3;return null!=e.end?this.getDiff(t,Lt(e.end)/1e3):null!=e.start?this.getDiff(Lt(e.start)/1e3,t):{hours:0,minutes:0,seconds:0}}renderTime(e,t){return void 0===t&&(t=!1),t&&e<=0?-1:e<10?"0"+e:e}getDiff(e,t){let n=Math.max(t-e,0),s=Math.floor(n)%60,r=Math.floor(n/60)%60;return{hours:Math.floor(n/3600)%24,minutes:r,seconds:s}}render(){let n=this.props,s=n.timestamps,r=function(e,t){if(null==e)return{};let n={},s=Object.keys(e);for(let r=0;r=0&&(n[o]=e[o])}return n}(n,["timestamps"]),o=this.state,a=o.hours,i=o.minutes,l=o.seconds,c={hours:this.renderTime(a,!0),minutes:this.renderTime(i),seconds:this.renderTime(l)};return null!==s.end?Bt.createElement(e,Object.assign({},r,{message:t.USER_ACTIVITY_TIMESTAMP_END.format(c)})):null!==s.start?Bt.createElement(e,Object.assign({},r,{message:t.USER_ACTIVITY_TIMESTAMP_START.format(c)})):null}}return n};function Lt(e){return(""+e).length<13?1e3*e:e}const At=o.React;let $t;class Tt extends At.Component{constructor(e){super(e),this.state={data:Se.getSettingGroup("rpc")||E,assets:[]},this.preview=null,this.isfetching=!1,this.state.data.application_id&&this.fetchAssets(),this.assetComponents=new Set}updateWhenFetched(e){this.assetComponents.add(e)}onChange(e,t){let n=Rt.find(t=>t.id===e.props.id);this.setState({data:Object.assign(v,this.state.data,{[n.id]:t||null}),assets:this.state.assets}),"application_id"===e.props.id&&this.fetchAssets(),Se.setSettingGroup("rpc",v),this.preview.forceUpdate(),Mt.set(v)}fetchAssets(){if(!0===this.isfetching){let e=this.state.data.application_id;setTimeout(()=>{this.state.data.application_id===e&&this.fetchAssets()},5e3)}if(!this.state.data.application_id)return this.setState({data:this.state.data,assets:[]}),this.forceUpdate(),void this.assetComponents.forEach(e=>e.forceUpdate());this.isfetching=!0,Mt.fetchAssets(this.state.data.application_id).then(e=>{this.isfetching=!1,this.setState({data:this.state.data,assets:Object.keys(e).map(t=>{let n=e[t];return{id:n.id,name:n.name,type:n.type}})}),this.forceUpdate(),this.assetComponents.forEach(e=>e.forceUpdate())}).catch(()=>{this.isfetching=!1,this.setState({data:this.state.data,assets:[]}),this.forceUpdate(),this.assetComponents.forEach(e=>e.forceUpdate())})}updatePreview(e){this.setState({data:e})}get modules(){return $t||($t=[BDModules.get(e=>e.marginBottom20)[0]])}render(){console.log("Rerendering rpc manager");let[e]=this.modules;return[At.createElement(Ge,{title:"RichPresence Settings",settings:this.props.settings,onChange:this.props.onChange}),At.createElement(Je,null),At.createElement(Ne,{text:"RichPresence"}),At.createElement("div",null,this.optionsComponents),At.createElement("div",null,At.createElement(Je,null),At.createElement(Ne,{text:"Preview"}),At.createElement(Gt,{settings:this})),At.createElement("div",{className:e.marginBottom20}),At.createElement("button",{style:{opacity:.01},onClick:window.ohgodohfuck},"Oh god Oh fuck"),At.createElement("button",{style:{opacity:.01},onClick:()=>{r.remote.shell.openExternal("https://www.youtube.com/watch?v=LkYa7rps_g4")}},"See ? I pulled a litle sneaky on ya")]}get optionsComponents(){return this._optionsComponents||(this._optionsComponents=Rt.map(e=>{if("text"===e.type)return At.createElement(_t,{setting:e,manager:this,id:e.id});if("number"===e.type){return[At.createElement(Ft,{setting:e,manager:this,id:e.id})]}return"choice"===e.type?["assets.small","assets.large"].includes(e.id)?At.createElement(Ht,{setting:e,manager:this,id:e.id,choices:[{value:"none",label:"No assets"}].concat(this.state.assets.map(e=>({value:"asset-"+e.id,label:e.name})))}):"Unknown choice.":void 0}))}}const Rt=[{title:"Application ID",id:"application_id",type:"number",placeholder:"711416957718757418"},{title:"Name",id:"name",type:"text",placeholder:"Lightcord"},{title:"Details",id:"details",type:"text",placeholder:"Browsing Discord"},{title:"State",id:"state",type:"text",placeholder:"Lightcord Client"},{title:"Timestamp Start",id:"timestamps.start",type:"number",get placeholder(){return Date.now()}},{title:"LargeAsset",id:"assets.large",type:"choice"},{title:"SmallAsset",id:"assets.small",type:"choice"}];let jt,Ot,It;class _t extends At.PureComponent{get modules(){return jt&&jt[0]?jt:jt=[BDModules.get(e=>e.removeKeybind)[0],BDModules.get(e=>e.marginBottom20)[0],BDModules.get(e=>e.defaultMarginh5)[0],BDModules.get(e=>e.colorStandard)[0],BDModules.get(e=>e.size32)[0],BDModules.get(e=>e._horizontal)[0],BDModules.get(e=>e.inputMini)[0],BDModules.get(e=>e.size16&&e.size20)[0]]}constructor(e){super(e);let t=this.props.setting;this.state={data:this.props.manager.state.data[t.id]},this.input=At.createElement(window.Lightcord.Api.Components.inputs.TextInput,{placeholder:t.placeholder,name:t.id,value:this.state.data,onChange:e=>{this.setState({data:e}),!this.lastEdited||this.lastEdited{this.props.manager.onChange(this,this.state.data),this.isTiming=null,this.lastEdited=Date.now()},500))},type:"text"})}render(){let e=this.props.setting,[t,n,s,r,o,a,i,l]=this.modules;return At.createElement("div",{className:t.row+" "+n.marginBottom20},At.createElement("div",{className:`${t.item} ${a.flexChild}`},At.createElement("h5",{className:r.colorStandard+" "+o.size14+" "+s.h5+" "+s.defaultMarginh5},e.title),this.input),At.createElement(qt,null))}}class Ft extends At.PureComponent{get modules(){return Ot||(Ot=[BDModules.get(e=>e.removeKeybind)[0],BDModules.get(e=>e.marginBottom20)[0],BDModules.get(e=>e.defaultMarginh5)[0],BDModules.get(e=>e.colorStandard)[0],BDModules.get(e=>e.size32)[0],BDModules.get(e=>e._horizontal)[0],BDModules.get(e=>e.inputMini)[0],BDModules.get(e=>e.size16&&e.size20)[0],BDModules.get(e=>e.colorTransparent)[0]])}constructor(e){super(e);let t=this.props.setting;this.state={data:this.props.manager.state.data[t.id]},this.input=At.createElement(window.Lightcord.Api.Components.inputs.TextInput,{placeholder:t.placeholder,name:t.id,value:this.state.data,type:"number",onChange:(e,t,n)=>{(e=e.replace(/[^\d]+/g,""))!=this.state.data?(!this.lastEdited||this.lastEdited{this.props.manager.onChange(this,this.state.data),this.isTiming=null,this.lastEdited=Date.now()},500)),this.setState({data:e})):n.setValue(e)},type:"text"})}render(){let e=this.props.setting,[t,n,s,r,o,a]=this.modules;return At.createElement("div",{className:t.row+" "+n.marginBottom20},At.createElement("div",{className:`${t.item} ${a.flexChild}`},At.createElement("h5",{className:r.colorStandard+" "+o.size14+" "+s.h5+" "+s.defaultMarginh5},e.title),this.input,"timestamps.start"===e.id?At.createElement(Lightcord.Api.Components.inputs.Button,{onClick:()=>{DiscordNative.clipboard.copy(Date.now()+"")},color:"brand"},"Copy current timestamp"):null),At.createElement(qt,null))}}class Ht extends At.PureComponent{constructor(e){super(e);let t=this.props.setting;this.state={data:this.props.manager.state.data[t.id]?"asset-"+this.props.manager.state.data[t.id]:"none"},this.props.manager.updateWhenFetched(this)}onChange(e){let t=e.value;!this.lastEdited||this.lastEdited{this.props.manager.onChange(this,"none"===this.state.data?null:this.state.data.replace("asset-","")),this.isTiming=null,this.lastEdited=Date.now()},500)),this.setState({data:t}),this.forceUpdate()}get modules(){return It||(It=[BDModules.get(e=>e.removeKeybind)[0],BDModules.get(e=>e.marginBottom20)[0],BDModules.get(e=>e.defaultMarginh5)[0],BDModules.get(e=>e.colorStandard)[0],BDModules.get(e=>e.size32)[0],BDModules.get(e=>e._horizontal)[0]])}render(){let e=this.props.setting,[t,n,s,r,o,a]=this.modules,i=this.props.manager.state.assets.map(e=>({value:"asset-"+e.id,label:e.name}));return i.unshift({value:"none",label:"No assets"}),At.createElement("div",{className:t.row+" "+n.marginBottom20},At.createElement("div",{className:`${t.item} ${a.flexChild}`},At.createElement("h5",{className:r.colorStandard+" "+o.size14+" "+s.h5+" "+s.defaultMarginh5},e.title),At.createElement(window.Lightcord.Api.Components.inputs.Dropdown,{value:this.state.data,options:i,onChange:this.onChange.bind(this)})),At.createElement(qt,null))}}let zt,Wt,Ut=[];class qt extends At.PureComponent{get modules(){return Ut&&Ut[0]?Ut:Ut=[BDModules.get(e=>e.divider&&1===Object.keys(e).length)[0],BDModules.get(e=>e.dividerDefault)[0]]}render(){let[e,t]=this.modules;return At.createElement("div",{class:`${e.divider} ${t.dividerDefault}`})}}At.Component;class Gt extends At.Component{constructor(e={}){super(e),this.state={active:"profile"},this.tabs=[],this.props.settings.preview=this}changeTab(e){this.state.active!==e.props.id&&(this.tabs.forEach(e=>{e.setActive(!1)}),e.setActive(!0),this.setState({active:e.props.id}))}render(){let e=new this.preview({preview:this});return e.setState(this.state.rpc),At.createElement("div",{className:"lc-tabWrapper"},At.createElement("div",{className:"lc-tabnav",style:{flex:"0 1 auto"}},At.createElement(Vt,{preview:this,title:"Full Profile",id:"profile"}),At.createElement(Vt,{preview:this,title:"User Popout",id:"popout"})),e.render())}isActive(e){return this.state.active===e}get preview(){return"profile"===this.state.active?Xt:Jt}}class Vt extends At.Component{constructor(e){super(e),this.state={active:e.preview.isActive(e.id)},e.preview.tabs.push(this)}setActive(e){this.setState({active:!!e})}render(){let e="lc-navItem";return this.state.active?e+=" lc-navItemActive":e+=" lc-navItemInactive",At.createElement("div",{className:e,onClick:()=>{this.props.preview.changeTab(this)}},this.props.title)}}class Jt extends At.Component{get modules(){return zt||(zt=[BDModules.get(e=>e.userPopout)[0],BDModules.get(e=>e._horizontal)[0],BDModules.get(e=>e.vertical&&e.alignStretch&&!e.streamerModeEnabledBtn)[0],BDModules.get(e=>e.bot)[0],BDModules.get(e=>e.activityUserPopout)[0],BDModules.get(e=>e.muted&&e.wrapper&&e.base)[0],BDModules.get(e=>e.size32)[0],BDModules.get(e=>e.themeGhostHairlineChannels)[0],BDModules.get(e=>e.note&&1===Object.keys(e).length)[0],BDModules.get(e=>e.pro&&e.inline)[0],BDModules.get(e=>e.colorStandard)[0],BDModules.get(e=>e.default&&e.default.Messages)[0].default.Messages,BDModules.get(e=>e.pointerEvents)[0],BDModules.get(e=>e.default&&e.default.getCurrentUser)[0].default])}render(){let[e,t,n,s,r,o,a,i,l,c,d,u,h,p]=this.modules,m=p.getCurrentUser(),g=m.getAvatarURL(m.avatar.startsWith("a_")?"gif":"png"),f=Object.assign({},E,this.props.preview.props.settings.state.data);Kt=Kt||r.timestamp;let b=(()=>{if(!f["assets.large"])return null;let e=[];return f["assets.large"]&&e.push(At.createElement("img",{alt:"",src:`https://cdn.discordapp.com/app-assets/${f.application_id}/${f["assets.large"]}.png`,class:`${r.assetsLargeImageUserPopout} ${f["assets.small"]?r.assetsLargeMaskUserPopout:""}`})),f["assets.small"]&&e.push(At.createElement("img",{alt:"",src:`https://cdn.discordapp.com/app-assets/${f.application_id}/${f["assets.small"]}.png`,class:r.assetsSmallImageUserPopout})),e.length?At.createElement("div",{class:r.assets},e):null})();return At.createElement("div",{className:"lc-userPopout lc-tab-box-shadow"},At.createElement("div",{class:e.userPopout,role:"dialog",tabindex:"-1"},At.createElement("div",{class:e.headerPlaying},At.createElement("div",{class:`${t.flex} ${n.vertical} ${n.justifyCenter} ${n.alignCenter} ${n.noWrap} ${e.headerTop}`,style:{flex:"1 1 auto"}},At.createElement("div",{class:e.avatarWrapperNormal,role:"button",tabindex:"0"},At.createElement("div",{class:h,role:"img",style:{width:"80px",height:"80px"}},At.createElement("svg",{width:"92",height:"80",viewBox:"0 0 92 80",class:`${h.mask} ${h.svg}`},At.createElement("foreignObject",{x:"0",y:"0",width:"80",height:"80",mask:"url(#svg-mask-avatar-status-round-80)"},At.createElement("img",{src:g,alt:" ",class:h.avatar})),At.createElement(Zt,null))),At.createElement("svg",{width:"80",height:"80",class:e.avatarHint,viewBox:"0 0 80 80"},At.createElement("foreignObject",{x:"0",y:"0",width:"80",height:"80",mask:"url(#svg-mask-avatar-status-round-80)"},At.createElement("div",{class:e.avatarHintInner},u.VIEW_PROFILE)))),At.createElement("div",{class:e.headerText},At.createElement("div",{class:`${t.flex} ${n.horizontal} ${n.justifyStart} ${n.alignCenter} ${n.noWrap}`,style:{flex:"1 1 auto"}},At.createElement("div",{class:`${e.headerTagNoNickname} ${s.nameTag}`},At.createElement("span",{class:`${s.username} ${e.headerTagUsernameNoNickname}`},m.username),At.createElement("span",null,"#",m.discriminator))))),At.createElement("div",{class:`${r.activityUserPopout} ${e.activity}`},At.createElement("h3",{class:`${r.headerTextNormal} ${o.base} ${a.size12}`},u.USER_ACTIVITY_HEADER_PLAYING),At.createElement("div",{class:r.bodyNormal},b,At.createElement("div",{class:b?r.contentImagesUserPopout:r.contentNoImagesUserPopout,style:{flex:"1 1 auto"}},f.name?At.createElement("h3",{class:`${r.nameNormal} ${o.base} ${a.size14}`,title:f.name},At.createElement("span",{class:r.activityName},f.name)):null,f.details?At.createElement("div",{title:f.title,class:r.details},f.details):null,f.state?At.createElement("div",{class:r.state},At.createElement("span",{title:f.state},f.state)):null,(()=>{if(!f["timestamps.start"])return null;let e=Pt(sn,u);return At.createElement("div",{class:r.timestamp},At.createElement(e,{timestamps:{end:null,start:f["timestamps.start"]}}))})())))),At.createElement("div",{class:`${i.scrollerWrap} ${e.body} ${i.scrollerThemed} ${i.themeGhostHairline} ${i.scrollerFade}`},At.createElement("div",{class:`${i.scroller} ${e.bodyInner}`},At.createElement("div",{class:e.bodyTitle},u.NOTE),At.createElement("div",{class:`${l.note} ${e.note}`},At.createElement("textarea",{placeholder:u.NOTE_PLACEHOLDER,maxlength:"256",autocorrect:"off",class:BDModules.get(e=>e.scrollbarGhostHairline)[0].scrollbarGhostHairline,style:{height:"36px"},disabled:!0})))),At.createElement("div",{class:e.footer},At.createElement("div",{class:`${e.protip} ${c.inline}`},At.createElement("h3",{class:`${c.pro} ${o.base} ${a.size12}`,style:{color:"rgb(67, 181, 129)"}},u.PINNED_MESSAGES_PRO_TIP),At.createElement("div",{class:`${d.colorStandard} ${a.size14} ${c.tip}`},u.CONTEXT_MENU_HINT)))))}}class Zt extends At.Component{get modules(){return Wt||(Wt=[BDModules.get(e=>e.default&&e.default.getPresence)[0],BDModules.get(e=>e.pointerEvents)[0].pointerEvents])}render(){let[e,t]=this.modules,n=e.default.getPresence().status;return"invisible"===n&&(n="offline"),At.createElement("rect",{width:"16",height:"16",x:"60",y:"60",fill:"#ffffff",mask:`url(#svg-mask-status-${n})`,className:t})}}let Yt,Kt="";class Xt extends At.Component{get modules(){return Yt||(Yt=[BDModules.get(e=>e.flex&&e._horizontal)[0],BDModules.get(e=>e.vertical&&e.alignStretch&&!e.streamerModeEnabledBtn)[0],BDModules.get(e=>e.topSectionStreaming)[0],BDModules.get(e=>e.pointerEvents)[0],BDModules.get(e=>e.bot)[0],BDModules.get(e=>e.activityProfile)[0],BDModules.get(e=>e.muted&&e.wrapper&&e.base)[0],BDModules.get(e=>e.size32)[0],BDModules.get(e=>e.scrollerFade)[0],BDModules.get(e=>e.note&&1===Object.keys(e).length)[0],BDModules.get(e=>e.default&&e.default.Messages)[0].default.Messages])}render(){let e=BDModules.get(e=>e.default&&e.default.getCurrentUser)[0].default.getCurrentUser(),t=e.getAvatarURL(e.avatar.startsWith("a_")?"gif":"png"),[n,s,r,o,a,i,l,c,d,u,h]=this.modules,p=Object.assign({},E,this.props.preview.props.settings.state.data);Kt=Kt||i.timestamp;let m=(()=>{if(!p["assets.large"])return null;let e=[];return p["assets.large"]&&e.push(At.createElement("img",{alt:"",src:`https://cdn.discordapp.com/app-assets/${p.application_id}/${p["assets.large"]}.png`,class:`${i.assetsLargeImageProfile} ${p["assets.small"]?i.assetsLargeMaskProfile:""}`})),p["assets.small"]&&e.push(At.createElement("img",{alt:"",src:`https://cdn.discordapp.com/app-assets/${p.application_id}/${p["assets.small"]}.png`,class:i.assetsSmallImageProfile})),e.length?At.createElement("div",{class:i.assets},e):null})();return[At.createElement("div",{className:"lc-tab lc-tab-box-shadow"},At.createElement("div",{class:`${n.flex} ${s.vertical} ${s.justifyStart} ${s.alignStretch} ${s.noWrap} ${r.root}`,style:{flex:"1 1 auto"}},At.createElement("div",{class:r.topSectionPlaying},At.createElement("header",{class:r.header},At.createElement("div",{class:`${r.avatar} ${o.wrapper}`,role:"img",style:{width:"80px",height:"80px"}},At.createElement("svg",{width:"92",height:"80",viewBox:"0 0 92 80",class:`${o.mask} ${o.svg}`},At.createElement("foreignObject",{x:"0",y:"0",width:"80",height:"80",mask:"url(#svg-mask-avatar-status-round-80)"},At.createElement("img",{src:t,alt:" ",class:o.avatar})),At.createElement(Zt,null))),At.createElement("div",{class:`${r.headerInfo}`},At.createElement("div",{class:`${r.nameTag} ${a.nameTag}`},At.createElement("span",{class:`${r.username} ${r.username}`},e.username),At.createElement("span",{class:r.discriminator},"#",e.discriminator)),At.createElement("div",{class:`${n.flex} ${n.horizontal} ${s.justifyStart} ${s.alignStretch} ${s.noWrap} ${r.profileBadges}`,style:{flex:"1 1 auto"}},At.createElement(tn,null)))),At.createElement("div",{class:r.headerFill},At.createElement("div",{class:`${i.activityProfile} ${r.activity}`},At.createElement("h3",{class:`${i.headerTextNormal} ${l.base} ${c.size12}`},h.USER_ACTIVITY_HEADER_PLAYING),At.createElement("div",{class:i.bodyNormal},m,At.createElement("div",{class:m?i.contentImagesProfile:i.contentNoImagesUserPopout,style:{flex:"1 1 auto"}},p.name?At.createElement("h3",{class:`${i.nameNormal} ${l.base} ${c.size14}`,title:p.name},At.createElement("span",{class:i.activityName},p.name)):null,p.details?At.createElement("div",{title:p.title,class:i.details},p.details):null,p.state?At.createElement("div",{class:i.state},At.createElement("span",{title:p.state},p.state)):null,(()=>{if(!p["timestamps.start"])return null;let e=Pt(sn,h);return At.createElement("div",{class:i.timestamp},At.createElement(e,{timestamps:{end:null,start:p["timestamps.start"]}}))})()))))),At.createElement("div",{class:r.body},At.createElement("div",{class:`${d.scrollerWrap} ${d.scrollerFade}`},At.createElement("div",{class:d.scroller},At.createElement("div",{class:r.userInfoSection},At.createElement("div",{class:r.userInfoSectionHeader},h.NOTE),At.createElement("div",{class:`${r.note} ${u.note}`},At.createElement("textarea",{placeholder:h.NOTE_PLACEHOLDER,maxlength:"256",autocorrect:"off",class:BDModules.get(e=>e.scrollbarGhostHairline)[0].scrollbarGhostHairline,style:{height:"40px"},disabled:!0}))),At.createElement(Qt,null))))))]}}class Qt extends At.Component{render(){let e=[],t=BDModules.get(e=>e.topSectionStreaming)[0],n=BDModules.get(e=>e.default&&e.default.getAccounts)[0].default.getAccounts().filter(e=>1===e.visibility);for(let t of n)e.push(At.createElement(en,{acc:t}));return e.length>0?At.createElement("div",{class:t.userInfoSection},At.createElement("div",{class:t.connectedAccounts},e)):null}}class en extends At.Component{render(){let[e,t,n,s,r,o]=[BDModules.get(e=>e.flex&&e._horizontal)[0],BDModules.get(e=>e.vertical&&e.alignStretch&&!e.streamerModeEnabledBtn)[0],BDModules.get(e=>e.topSectionStreaming)[0],BDModules.get(e=>e.flowerStarContainer)[0],BDModules.get(e=>e.anchor)[0],BDModules.get(e=>e.default&&e.default.get&&e.default.map)[0].default],a=this.props.acc,i=o.get(a.type);return At.createElement("div",{class:`${e.flex} ${e.horizontal} ${t.justifyStart} ${t.alignCenter} ${t.noWrap} ${n.connectedAccount}`,style:{flex:"0 1 auto"}},At.createElement("img",{alt:`Logo ${i.name}`,class:n.connectedAccountIcon,src:i.icon.color||i.icon.white||i.icon.grey}),At.createElement("div",{class:n.connectedAccountNameInner},At.createElement("div",{class:n.connectedAccountName},a.name),a.verified?At.createElement("span",null,At.createElement("div",{class:`${s.flowerStarContainer} ${n.connectedAccountVerifiedIcon}`,style:{width:"16px",height:"16px"}},At.createElement("svg",{class:s.flowerStar,width:"16",height:"16",viewBox:"0 0 16 15.2"},At.createElement("path",{fill:"#4f545c","fill-rule":"evenodd",d:"m16 7.6c0 .79-1.28 1.38-1.52 2.09s.44 2 0 2.59-1.84.35-2.46.8-.79 1.84-1.54 2.09-1.67-.8-2.47-.8-1.75 1-2.47.8-.92-1.64-1.54-2.09-2-.18-2.46-.8.23-1.84 0-2.59-1.54-1.3-1.54-2.09 1.28-1.38 1.52-2.09-.44-2 0-2.59 1.85-.35 2.48-.8.78-1.84 1.53-2.12 1.67.83 2.47.83 1.75-1 2.47-.8.91 1.64 1.53 2.09 2 .18 2.46.8-.23 1.84 0 2.59 1.54 1.3 1.54 2.09z"})),At.createElement("div",{class:s.childContainer},At.createElement("svg",{width:"16",height:"16",viewBox:"0 0 16 15.2"},At.createElement("path",{d:"M7.4,11.17,4,8.62,5,7.26l2,1.53L10.64,4l1.36,1Z",fill:"#ffffff"}))))):null),At.createElement("a",{class:`${r.anchor} ${r.anchorUnderlineOnHover}`,rel:"noreferrer noopener",target:"_blank",role:"button",tabindex:"0"},At.createElement("svg",{class:n.connectedAccountOpenIcon,width:"24",height:"24",viewBox:"0 0 24 24"},At.createElement("path",{fill:"currentColor",d:"M10 5V3H5.375C4.06519 3 3 4.06519 3 5.375V18.625C3 19.936 4.06519 21 5.375 21H18.625C19.936 21 21 19.936 21 18.625V14H19V19H5V5H10Z"}),At.createElement("path",{fill:"currentColor",d:"M21 2.99902H14V4.99902H17.586L9.29297 13.292L10.707 14.706L19 6.41302V9.99902H21V2.99902Z"}))))}}class tn extends At.Component{render(){let e=BDModules.get(e=>e.default&&e.default.getCurrentUser)[0].default.getCurrentUser(),t=BDModules.get(e=>e.topSectionStreaming)[0],n=BDModules.get(e=>e.UserFlags)[0].UserFlags,s=[],r=[];for(let t in n)e.hasFlag(n[t])&&r.push(t);for(let e of r){let n=`profileBadge${e.toLowerCase().replace(/_/g," ").split(" ").map(e=>e[0].toUpperCase()+e.slice(1)).join("")}`;n=n.replace("HypesquadOnline","HypeSquadOnline"),t[n]&&s.push(At.createElement(nn,{name:n}))}return e.hasPremiumSubscription&&s.push(At.createElement(nn,{name:"profileBadgePremium"})),s}}class nn extends At.Component{render(){let e=BDModules.get(e=>e.topSectionStreaming)[0];return At.createElement("div",{class:e.profileBadgeWrapper},At.createElement("div",null,At.createElement("div",{class:"",role:"button",tabindex:"0"},At.createElement("div",{class:`${e.profileBadge} ${e[this.props.name]}`}))))}}class sn extends At.Component{render(){return At.createElement("div",{className:Kt},this.props.message)}}const rn=o.React;let on=BDModules.get(e=>e.defaultMarginh5)[0],an=BDModules.get(e=>e.colorStandard)[0],ln=BDModules.get(e=>e.size32)[0],cn=BDModules.get(e=>e.scrollbarGhostHairline)[0];const dn=BDModules.get(e=>e.default&&e.default.getGuilds)[0].default,un=BDModules.get(e=>e.default&&e.default.getRelationships)[0].default,hn=BDModules.get(e=>e.default&&e.default.getSessions)[0].default,pn=BDModules.get(e=>e.default&&e.default.getCurrentUser)[0].default;class mn extends rn.Component{constructor(e){super(e)}render(){return on||(on=BDModules.get(e=>e.defaultMarginh5)[0]),an||(an=BDModules.get(e=>e.colorStandard)[0]),ln||(ln=BDModules.get(e=>e.size32)[0]),[rn.createElement(Ne,{text:"Account Infos"}),rn.createElement("div",null,rn.createElement("h5",{className:an.colorStandard+" "+ln.size14+" "+on.h5+" "+on.defaultMarginh5},"Profile"),rn.createElement(yn,{content:this.getProfileValue(),language:"diff"}),rn.createElement("h5",{className:an.colorStandard+" "+ln.size14+" "+on.h5+" "+on.defaultMarginh5},"Statistics"),rn.createElement(yn,{content:this.getStatistics(),language:"diff"}),rn.createElement("h5",{className:an.colorStandard+" "+ln.size14+" "+on.h5+" "+on.defaultMarginh5},"Connected Sessions"),rn.createElement(yn,{content:this.getSessionValue(),language:"diff"})),rn.createElement("div",{className:BDModules.get(e=>e.marginBottom20)[0].marginBottom20})]}getSessionValue(){const e=hn.getSessions(),t=Object.keys(e).filter(e=>"all"!==e).map(t=>e[t]);return 0===t.length?"- No session detected. Please try in a few seconds":t.map(e=>`+ id: ${e.sessionId}\n+ os: ${e.clientInfo.os[0].toUpperCase()+e.clientInfo.os.slice(1)}\n+ client: ${e.clientInfo.client}\n+ status: ${e.status}\n+ active: ${e.active?"Yes":"No"}\n+ Activities: ${e.activities.length}`).join("\n"+"-".repeat(38)+"\n")}getProfileValue(){const e=pn.getCurrentUser(),t=e.createdAt;return`+ Username: ${e.username}\n+ Discriminator: ${e.discriminator}\n+ Tag: ${e.tag}\n+ ID: ${e.id}\n+ Avatar: ${e.avatar}\n+ Avatar URL: https://cdn.discordapp.com/avatars/${e.id}/${e.avatar}.${e.avatar.startsWith("a_")?"gif":"png"}?size=4096\n+ Creation Date: ${t.getDate().toString().padStart(2,"0")}/${(t.getMonth()+1).toString().padStart(2,"0")}/${t.getFullYear().toString().padStart(2,"0")} ${t.getHours().toString().padStart(2,"0")}h ${t.getMinutes().toString().padStart(2,"0")}min ${t.getSeconds()}s\n+ Flags: ${e.flags}\n+ Has Nitro: ${e.hasPremiumSubscription?"Yes":"No"}\n- Email: ${e.email}\n- 2FA: ${e.mfaEnabled?"Yes":"No"}\n- Has Been On Mobile: ${e.mobile?"Yes":"No"}\n- Phone: ${e.phone||"None"}\n- Verified: ${e.verified}`}getStatistics(){const e=Object.values(dn.getGuilds()),t=Object.keys(un.getRelationships()),n=t.filter(e=>un.isFriend(e)),s=t.filter(e=>un.isBlocked(e));return`+ Server Count: ${e.length} servers\n+ Relations: ${t.length} relations\n+ Friends Count: ${n.length} friends\n- Blocked Users Count: ${s.length} blocked users`}}let gn=BDModules.get(e=>e.highlight)[0],fn=BDModules.get(e=>e.markup)[0],bn=BDModules.get(e=>e.messageContent)[0];class yn extends rn.Component{render(){return fn||(fn=BDModules.get(e=>e.markup)[0]),bn||(bn=BDModules.get(e=>e.messageContent)[0]),cn||(cn=BDModules.get(e=>e.scrollbarGhostHairline)[0]),gn||(gn=BDModules.get(e=>e.highlight)[0]),rn.createElement("div",{class:`${fn.markup} ${bn.messageContent}`},rn.createElement("pre",null,rn.createElement("code",{class:`${cn.scrollbarGhostHairline} hljs`,dangerouslySetInnerHTML:{__html:gn.highlight(this.props.language,this.props.content).value}})),rn.createElement("div",{className:BDModules.get(e=>e.marginBottom8)[0].marginBottom8}))}}const vn=window.Lightcord.DiscordModules.dispatcher,En=BDModules.get(e=>e.default&&e.default.getChannel&&e.default.hasChannel)[0].default;let wn=BDModules.get(e=>e.default&&e.default.addRelationship)[0],Cn=BDModules.get(e=>e.default&&e.default.closePrivateChannel)[0];const Sn={};let xn=BDModules.get(e=>e.default&&e.default.getCurrentUser)[0];var Dn=new class{constructor(){this.antiDM=this.antiDM.bind(this),this.enabled=!1}enable(){this.enabled||(this.enabled=!0,vn.subscribe("MESSAGE_CREATE",this.antiDM))}disable(){this.enabled&&(this.enabled=!1,vn.unsubscribe("MESSAGE_CREATE",this.antiDM))}antiDM(e){if(!e.message.author.bot)return;if(e.message.author.id===(xn?xn.default.getCurrentUser():null).id&&e.message.guild_id)return;const t=En.getChannel(e.message.channel_id);var n;t&&(1===t.type&&(Sn[e.message.author.id]||(n=e.message,(/(discord\.gg|discord\.com\/invite\/|discordapp\.com\/invite\/)/g.test(n.content)||kn(n,"discord.gg/")||kn(n,"discord.com/invite/")||kn(n,"discordapp.com/invite/"))&&(Sn[e.message.author.id]=!0,N.showToast(`[AdBlock]: Blocked ${e.message.author.username}#${e.message.author.discriminator}`,{type:"warning"}),wn||(wn=BDModules.get(e=>e.default&&e.default.addRelationship)[0]),wn.default.addRelationship(e.message.author.id,{location:"ContextMenu"},2),Cn||(Cn=BDModules.get(e=>e.default&&e.default.closePrivateChannel)[0]),Cn.default.closePrivateChannel(t.id,!1)))))}};function kn(e,t){let n=e.embeds;return 0!==n.length&&n.map(e=>"rich"===e.type&&(!!(e.title||"").includes(t)||(!!(e.description||"").includes(t)||(!!((e.footer?e.footer.text:"")||"").includes(t)||!!e.fields.map(e=>e.value.includes(t)||e.name.includes(t)).includes(!0))))).includes(!0)}let Mn;const Bn=N.removeDa;var Nn=new class{constructor(){this.enabled=!1}enable(){this.enabled||(this.enabled=!0,Mn=Mn||function(){let e=BDModules.get(e=>e.standardSidebarView)[0];if(!e)return null;let t=Bn(e.standardSidebarView),n=[];return n.push(`#app-mount .${t} .payment-info .${Bn(BDModules.get(e=>e.description&&"string"==typeof e.description&&e.description.includes("formText"))[0].description)}`),n.push(`#app-mount .${t} .${Bn(BDModules.get(e=>e.paymentSourceRow)[0].paymentSourceRow)} .${Bn(BDModules.get(e=>e.subText&&e.descriptionWrapper)[0].subText)}`),n.push(`#app-mount .${t} .${Bn(BDModules.get(e=>e.userSettingsAccount)[0].userSettingsAccount)} div:nth-child(2)>div:nth-child(2)>.${Bn(BDModules.get(e=>e.viewBody)[0].viewBody)}`),n}(),Mn||console.error(new Error("Couldn't find selectors to blur personnal informations.")),B.addStyle("blurPrivate",`\n${Mn[0]}, ${Mn[1]}, ${Mn[2]} {\n transition: all 150ms cubic-bezier(.55,.085,.68,.53);\n filter: blur(4px);\n opacity: .8;\n}\n\n${Mn[0]}:hover, ${Mn[1]}:hover, ${Mn[2]}:hover {\n transition: all 150ms cubic-bezier(.55,.09,.68,.53);\n filter: none;\n opacity: 1;\n}`))}disable(){this.enabled&&(this.enabled=!1,B.removeStyle("blurPrivate"))}},Pn=new class{constructor(){window.Lightcord.Api.ensureExported(e=>e.default&&e.default.startTyping).then(e=>{let t=this;const n=e.default.startTyping;e.default.startTyping=function(){if(t.disabled)return n.call(this,...arguments)};const s=e.default.stopTyping;e.default.stopTyping=function(){if(t.disabled)return s.call(this,...arguments)},this.disabled=!0}),window.Lightcord.BetterDiscord.DisableTyping=this}disable(){this.disabled=!0}enable(){this.disabled=!1}};function Ln(){return(Ln=Object.assign||function(e){for(var t=1;te.default&&e.default.open&&e.default.fetchMutualFriends)[0];React.Component;function $n(){return($n=Object.assign||function(e){for(var t=1;tt=e);jn[e]=n;const s=[];for(let t of Hn.badges)t.defaultUsers.includes(e)&&s.push(t);const r=await new Promise(t=>{if(!y["lightcord-5"])return t([]);On.push([e,t]),setTimeout(()=>{let e=On;0!==e.length&&(On=[],_n(zn.badges,"POST",JSON.stringify(e.map(e=>e[0]))).then(async t=>{200!==t.status&&e.forEach(e=>{e[1]([])});const n=await t.json();console.log(n);for(let t of n){e.find(e=>e[0]===t.user_id)[1](t.badges)}}).catch(t=>{t instanceof Fn||console.error(t),e.forEach(e=>{e[1]([])})}))},0)});for(let e of r)Hn.badges.find(t=>t.id===e)&&(s.find(t=>t.id===e)||s.push(Hn.badges.find(t=>t.id===e)));return this.cache={badges:Object.assign(this.cache.badges,{[e]:s})},setTimeout(()=>{delete this.cache.badges[e]},6e5),t(s),delete jn[e],s}};const _n=function(e,t,n){return y["lightcord-5"]?(console.log(`Sending request on ${e} with method ${t} and body`,n),I()(`${Hn.SERVER_URL}/api/v1${e}`,{method:t,headers:{CLIENT:"Lightcord",Authorization:window.Lightcord.Api.Authorization||"None::Anonymous"},...n?{body:n}:{}})):(console.warn(`Canceling request on ${e} with method ${t} and body`,n,"because of settings."),Promise.reject(new Fn("The current settings blocked the request.")))};class Fn extends Error{constructor(){super(...arguments),this.name="LightcordError"}}const Hn={SERVER_URL:"https://lightcord.deroku.xyz/",badges:[{name:"Lightcord Bug Hunter",id:"f04698f5-816b-41e3-bd01-92291193d7a5",defaultUsers:["696481194443014174","696003456611385396"],scopes:[],component:An,href:"https://github.com/lightcord/lightcord/wiki/badges#bug_hunter"},{name:"Buffoon",id:"06904d31-65b4-41ec-a50c-8658bbd1af96",defaultUsers:["389016895543705602","664600134528663565","625350657829896224"],scopes:[],component:Tn,href:"https://youtu.be/EJtb6z-dlT8?t=145"}]},zn={badges:"/users/badges"};Rn();let Wn;class Un extends React.PureComponent{constructor(){super(...arguments),this.state={states:[]}}render(){Wn||(Wn=c.find(e=>e.FormSection));const e=[...new Set(Object.keys(window.Lightcord.Api.Components).map(e=>Object.keys(window.Lightcord.Api.Components[e]).map(t=>window.Lightcord.Api.Components[e][t])).flat())];return[React.createElement(Wn.FormSection,{tag:"h2",title:"Lightcord's Api Availlable components"},React.createElement(Wn.FormText,{type:"description",className:"",selectable:!1},"These components are here for the plugin devs. They can quickly embed any component below with this panel."),React.createElement(Je,null),React.createElement(Lightcord.Api.Components.inputs.Button,{color:"brand",look:"outlined",size:"medium",hoverColor:"green",onClick:()=>{r.remote.shell.openExternal("https://github.com/lightcord/lightcord/wiki/Apis")},wrapper:!1},"Documentation")),e.map(e=>{let t=[];e.AllPreviews&&(t=e.AllPreviews);let n=t=>{this.setState({states:[Object.assign(s,t)].concat(this.state.states.filter(t=>t.elem!==e))})},s=this.state.states.find(t=>t.elem===e);s||(s={tab:"preview",elem:e,options:{}},this.state.states.push(s));let r=()=>{let e={};return t.forEach(t=>{e[Object.keys(t[0])[0]]=t[0][Object.keys(t[0])[0]]}),Object.keys(s.options).forEach(n=>{e[n]=t.find(e=>e.find(e=>e[n]))[s.options[n]][n]}),e},o=(e,t,n)=>{if("string"==typeof e)return e;if("boolean"==typeof e)return String(e);if("function"==typeof e)return e.toString();if("object"==typeof e){if(e&&e.$$typeof&&(e.$$typeof===Symbol.for("react.element")||60103===e.$$typeof)){if("Lightcord.Api.Components.general.Tabs"===t){if("react"===n)return'React.createElement("div", {style: {\n marginTop: "20px", marginBottom: "20px"\n}},\n React.createElement("div", {style: {\n backgroundColor: "var(--background-primary)",\n padding: "30px 30px",\n borderRadius: "8px"\n }, className: "lc-tab-box-shadow" },\n React.createElement(Lightcord.Api.Components.general.Title, null, "Preview tabs")\n )\n)';if("jsx"===n)return'
\n
\n Preview tabs\n
\n
'}return"Your components here."}return JSON.stringify(e,null," ")}return String(e)},a=function(t){const n=e.displayName||e.name;const s=`Lightcord.Api.Components.${Object.keys(window.Lightcord.Api.Components).find(e=>window.Lightcord.Api.Components[e][n])}.${n}`,a=r();if("jsx"===t){let e,n=[],r=null;if(Object.keys(a).forEach(e=>{if("children"==e)r=o(a[e],s,t);else{let r=e+"=";"string"==typeof a[e]?r+=JSON.stringify(a[e]):r+=`{${o(a[e],s,t)}}`,n.push(r)}}),r){return e=`<${s} ${n.join(" ")}>`,`${e}\n ${r}\n${``}`}return e=`<${s} ${n.join(" ")}/>`,e}if("react"===t){let e=a.children||null;delete a.children,e&&e.$$typeof&&(e.$$typeof===Symbol.for("react.element")||60103===e.$$typeof)&&(e=o(e,s,t));let n=[];Object.keys(a).forEach(e=>{let r=(/[^\w\d_]/g.test(e)?JSON.stringify(e):e)+": ";"string"==typeof a[e]?r+=JSON.stringify(a[e]):r+=o(a[e],s,t).split("\n").map((e,t)=>0===t?e:" "+e).join("\n"),n.push(r)});let r="{";n.length?n.forEach((e,t)=>{let s=t===n.length-1;0===t||(r+=","),r+="\n ",r+=e,s&&(r+="\n}")}):r+="}";let i="string"==typeof e&&e.startsWith("React.createElement")?e:JSON.stringify(e);return`React.createElement(${s}, ${r}, ${i})`}};return React.createElement("div",null,React.createElement(window.Lightcord.Api.Components.general.SettingsTitle,null,e.displayName||e.name),t.map(e=>{if(e[0].onClick)return null;if(e[0].text)return null;if(e[0].children)return null;if(1===e.length)return null;let t=Object.keys(e[0])[0];return[React.createElement(window.Lightcord.Api.Components.general.SettingSubTitle,null,t),React.createElement(window.Lightcord.Api.Components.inputs.Dropdown,{options:e.map((e,t)=>({value:"opt-"+t,label:JSON.stringify(e[Object.keys(e)[0]])})),value:"opt-"+(s.options[t]||"0"),onChange:e=>{n({options:Object.assign({},s.options,{[t]:(e.value||"0").replace("opt-","")})})},searchable:!0}),React.createElement("div",{style:{marginBottom:"8px"}})]}),React.createElement(window.Lightcord.Api.Components.general.Tabs,{tabs:[{label:"Preview",id:"preview"},{label:"Code",id:"code"}],active:s.tab,children:"preview"===s.tab?React.createElement("div",{style:{margin:"20px"}},React.createElement("div",{style:{backgroundColor:"var(--background-primary)",padding:"30px 30px",borderRadius:"8px"},className:"lc-tab-box-shadow"},React.createElement(e,r()))):React.createElement("div",{style:{margin:"20px"}},React.createElement("div",{style:{backgroundColor:"var(--background-primary)",padding:"30px 30px",borderRadius:"8px"},className:"lc-tab-box-shadow"},React.createElement(window.Lightcord.Api.Components.general.SettingSubTitle,null,"JSX"),React.createElement(window.Lightcord.Api.Components.general.CodeBlock,{language:"jsx",content:a("jsx")}),React.createElement(window.Lightcord.Api.Components.general.SettingSubTitle,null,"React"),React.createElement(window.Lightcord.Api.Components.general.CodeBlock,{language:"js",content:a("react")}))),onChange:e=>{n({tab:e})}}))})]}get renders(){}}const qn=o.React;class Gn extends qn.Component{render(){const e=this.props.size||"18px";return qn.createElement("svg",{viewBox:"0 0 24 24",fill:"#FFFFFF",className:this.props.className||"",style:{width:e,height:e},onClick:this.props.onClick},qn.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),qn.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"}))}}class Vn extends React.PureComponent{render(){let e=c.find(e=>e.Separator&&e.Header&&e.Item);const t=React.createElement(V,{color:"black",side:"top",text:"Changelog"},React.createElement("span",{style:{float:"right",cursor:"pointer"},className:"bd-changelog-button",onClick:()=>{N.showChangelogModal(bbdChangelog)}},React.createElement(Gn,{className:"bd-icon",size:"16px"})));return new e.Header({children:React.createElement("span",null,"Bandaged BD",t),className:"ui-tab-bar-header"})}}var Jn=new class{constructor(){this.onChange=this.onChange.bind(this),this.updateSettings=this.updateSettings.bind(this),this.sidebar=new xe,this.registerComponents()}registerComponents(){this.sidebar.register("lightcord",Zn(this.lightcordComponent.bind(this))),this.sidebar.register("status",Zn(this.PresenceComponent.bind(this))),this.sidebar.register("accountinfo",Zn(this.AccountInfosComponent.bind(this))),this.sidebar.register("lcapipreview",Zn(this.ApiPreviewComponent.bind(this))),this.sidebar.register("BDChangelogTitle",Zn(()=>(new Vn).render())),this.sidebar.register("core",Zn(this.coreComponent.bind(this))),this.sidebar.register("customcss",Zn(this.customCssComponent.bind(this))),this.sidebar.register("plugins",Zn(this.renderAddonPane("plugins"))),this.sidebar.register("themes",Zn(this.renderAddonPane("themes")))}get root(){const e=B.query("#bd-settingspane-container");return e||(this.injectRoot()?this.root:null)}injectRoot(){let[e,t]=[BDModules.get(e=>e.layer&&e.animating)[0].layer.split(" ")[0],BDModules.get(e=>e.standardSidebarView)[0]];const n=B.query("."+e+" ."+t.standardSidebarView.split(" ")[0]+", ."+e+" .ui-standard-sidebar-view");if(!n)return!1;const s=B.createElement(`
`);return n.append(s),N.onRemoved(s,()=>{o.reactDom.unmountComponentAtNode(s)}),!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 lightcordSettings(){const e=this.getSettings("lightcord");return[...new Set(e.map(e=>e.category))].map(t=>({title:t,settings:e.filter(e=>e.category==t)}))}get PresenceSettings(){return this.getSettings("status")}get MsgLogSettings(){return this.getSettings("msglog")}getSettings(e){return Object.keys(f).reduce((t,n)=>{const s=f[n];return s.cat===e&&s.implemented&&!s.hidden&&(s.text=n,t.push(s)),t},[])}onClick(){}onChange(e,t){this.updateSettings(e,t)}updateSettings(e,t){if(y[e]=t,"bda-gs-2"==e&&(t?B.addClass(document.body,"bd-minimal"):B.removeClass(document.body,"bd-minimal")),"bda-gs-3"==e&&(t?B.addClass(document.body,"bd-minimal-chan"):B.removeClass(document.body,"bd-minimal-chan")),"bda-gs-1"==e&&(t?Ie.addButton():Ie.removeButton()),"bda-gs-4"==e&&(t?_e.start():_e.stop()),"bda-gs-5"==e&&(t?B.addClass(B.query("#app-mount"),"bda-dark"):B.removeClass(B.query("#app-mount"),"bda-dark")),t&&"bda-gs-6"==e&&ke.inject24Hour(),"bda-gs-7"==e&&(t?De.injectColoredText():De.removeColoredText()),"fork-ps-4"==e&&(t?He.start():He.stop()),"fork-ps-5"==e&&(t?(ye.watchContent("plugin"),ye.watchContent("theme")):(ye.unwatchContent("plugin"),ye.unwatchContent("theme"))),"fork-wp-1"==e&&(N.setWindowPreference("transparent",t),t?N.setWindowPreference("backgroundColor",null):N.setWindowPreference("backgroundColor","#2f3136")),"bda-gs-8"==e&&(t?ze.startDebugListener():ze.stopDebugListener()),"fork-dm-1"==e&&(t?ze.startCopySelector():ze.stopCopySelector()),"lightcord-1"===e&&(window.Lightcord.Settings.devMode=!!t),"lightcord-2"===e&&(window.Lightcord.Settings.callRingingBeat=!!t),"lightcord-presence-1"===e)if(t){Mt.enable();const e=BDModules.get(e=>e.default&&"object"==typeof e.default&&"showCurrentGame"in e.default)[0];e&&!e.default.showCurrentGame&&BDModules.get(e=>e.default&&e.default.updateRemoteSettings)[0].default.updateRemoteSettings({showCurrentGame:!0})}else Mt.disable();"lightcord-3"===e&&(t?r.remote.getCurrentWindow().setAlwaysOnTop(!0):r.remote.getCurrentWindow().setAlwaysOnTop(!1)),"lightcord-4"===e&&(t?Dn.enable():Dn.disable()),"lightcord-6"===e&&(t?Nn.enable():Nn.disable()),"lightcord-7"===e&&(t?Pn.enable():Pn.disable()),this.saveSettings()}async initializeSettings(){y["bda-gs-2"]&&B.addClass(document.body,"bd-minimal"),y["bda-gs-3"]&&B.addClass(document.body,"bd-minimal-chan"),y["bda-gs-1"]&&Ie.addButton(),y["bda-gs-4"]&&_e.start(),y["bda-gs-5"]&&B.addClass(B.query("#app-mount"),"bda-dark"),y["bda-gs-6"]&&ke.inject24Hour(),y["bda-gs-7"]&&De.injectColoredText(),y["fork-ps-4"]&&He.start(),y["lightcord-1"]&&(window.Lightcord.Settings.devMode=!0),y["lightcord-2"]&&(window.Lightcord.Settings.callRingingBeat=!0),y["lightcord-presence-1"]&&Mt.enable(),y["lightcord-3"]&&r.remote.getCurrentWindow().setAlwaysOnTop(!0),y["lightcord-4"]&&Dn.enable(),y["lightcord-6"]&&Nn.enable(),y["lightcord-7"]&&Pn.enable(),y["fork-ps-5"]&&(ye.watchContent("plugin"),ye.watchContent("theme")),y["bda-gs-8"]&&ze.startDebugListener(),y["fork-dm-1"]&&ze.startCopySelector(),this.saveSettings()}saveSettings(){Se.setSettingGroup("settings",y),Se.setSettingGroup("rpc",v)}loadSettings(){Object.assign(y,Se.getSettingGroup("settings")),Object.assign(v,Se.getSettingGroup("rpc"))}renderSidebar(){return this.sidebar.render()}coreComponent(){return o.react.createElement(Ze,{key:"cspanel",onChange:this.onChange,sections:this.coreSettings})}lightcordComponent(){return[this.lightcordSettings.map((e,t)=>[0===t?null:o.react.createElement(Je),o.react.createElement("h2",{className:"ui-form-title h2 margin-reset margin-bottom-20"},e.title),e.settings.map(e=>o.react.createElement(qe,{id:e.id,key:e.id,data:e,checked:y[e.id],onChange:(e,t)=>{this.onChange(e,t)}}))]),o.react.createElement(window.Lightcord.Api.Components.inputs.Button,{color:"yellow",look:"ghost",size:"medium",hoverColor:"red",onClick(){console.log("Should relaunch"),r.remote.app.relaunch({args:r.remote.process.argv.slice(1).concat(["--disable-betterdiscord"])}),r.remote.app.quit()},wrapper:!0},"Relaunch without BetterDiscord")]}PresenceComponent(){return o.react.createElement(Tt,{key:"lppannel",onChange:this.onChange,settings:this.PresenceSettings})}AccountInfosComponent(){return o.react.createElement(mn,{key:"lapannel"})}ApiPreviewComponent(){return o.react.createElement(Un,{key:"lapipannel"})}customCssComponent(){return o.react.createElement(Xe,{key:"csseditor"})}renderAddonPane(e){class t extends o.react.Component{constructor(e){super(e),this.prefix=this.props.type.replace("s","")}onChange(){this.props.onChange(this.props.type)}render(){return this.props.children}}const n=t.prototype.render;return Object.defineProperty(t.prototype,"render",{enumerable:!1,configurable:!1,set:function(){console.warn("Addon policy for plugins #5 https://github.com/rauenzi/BetterDiscordApp/wiki/Addon-Policies#plugins")},get:()=>n}),function(){return o.react.createElement(t,{type:e},o.react.createElement(Ct,{type:e}))}}};function Zn(e){class t extends React.Component{render(){return e()}}return t}class Yn extends o.reactComponent{render(){return o.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"},o.react.createElement("metadata",null),o.react.createElement("defs",null,o.react.createElement("filter",{id:"shadow1"},o.react.createElement("feDropShadow",{dx:"20",dy:"0",stdDeviation:"20","flood-color":"rgba(0,0,0,0.35)"})),o.react.createElement("filter",{id:"shadow2"},o.react.createElement("feDropShadow",{dx:"15",dy:"0",stdDeviation:"20","flood-color":"rgba(255,255,255,0.15)"})),o.react.createElement("filter",{id:"shadow3"},o.react.createElement("feDropShadow",{dx:"10",dy:"0",stdDeviation:"20","flood-color":"rgba(0,0,0,0.35)"}))),o.react.createElement("g",null,o.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"}),o.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"}),o.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 Kn(){return(Kn=Object.assign||function(e){for(var t=1;t/g};let es=BDModules.get(e=>e.CustomEmoji)[0],ts=BDModules.get(e=>e.default&&e.default.getCustomEmojiById)[0],ns=BDModules.get(e=>e.default&&"Autocomplete"===e.default.displayName)[0],ss=BDModules.get(e=>e.getAutocompleteOptions)[0],rs=BDModules.get(e=>e.default&&e.default.queryEmojiResults)[0],os=BDModules.get(e=>e.default&&e.default.Messages&&e.default.Messages.EMOJI_MATCHING)[0],as=BDModules.get(e=>e.default&&e.default.getGuild&&e.default.getGuilds&&!e.default.isFetching)[0],is=BDModules.get(e=>e.default&&e.default.getDisambiguatedEmojiContext);var ls=new class{constructor(){this.init().catch(e=>N.err("EmojiModule","An error occured",e))}async init(){if(ns||(ns=await window.Lightcord.Api.ensureExported(e=>e.default&&"Autocomplete"===e.default.displayName)),ss||(ss=await window.Lightcord.Api.ensureExported(e=>e.getAutocompleteOptions)),rs||(rs=await window.Lightcord.Api.ensureExported(e=>e.default&&e.default.queryEmojiResults)),os||(os=await window.Lightcord.Api.ensureExported(e=>e.default&&e.default.Messages&&e.default.Messages.EMOJI_MATCHING)),as||(as=await window.Lightcord.Api.ensureExported(e=>e.default&&e.default.getGuild&&e.default.getGuilds&&!e.default.isFetching)),is||(is=await window.Lightcord.Api.ensureExported(e=>e.default&&e.default.getDisambiguatedEmojiContext)),ns&&ss&&rs&&os&&as&&is){console.log("Patching getAutocompleteOptions of AutoCompletionTemplates",ss);const e=ss.getAutocompleteOptions;ss.getAutocompleteOptions=function(t,n,s,r,o){const a=e.call(this,...arguments);return a.LIGHTCORD_EMOJIS={matches(e,t){let n=t.length>1&&"."===e;return ys(n),n},queryResults:e=>rs.default.queryEmojiResults(e,t),renderResults:(e,t,n,s,r)=>cs(e,t,r.emojis,n,s,os.default.Messages.EMOJI_MATCHING,os.default.Messages.EMOJI,ns.default.Emoji,(function(e){return{emoji:e,key:e.id||e.uniqueName||e.name,sentinel:".",guild:null!=e.guildId?as.default.getGuild(e.guildId):null}}),(function(e){return"."+e+"."})),getPlainText(e,t){var n=t.emojis;if(null==n||null==n[e])return"";var s=n[e],r=s.animated?"a":"";return s.managed||null==s.id?"."+s.name+".":"<"+r+"."+(s.originalName||s.name)+"."+s.id+">"},getRawText(e,t){var n=t.emojis;if(null==n||null==n[e])return"";var s=n[e],r=s.animated?"a":"";return s.managed||null==s.id?"."+s.name+".":"<"+r+"."+(s.originalName||s.name)+"."+s.id+">"}},a}}else console.error(new Error("Couldn't start autocompletion of Lightcord's emojis."));for(;!o.MessageComponent;)await new Promise(e=>setTimeout(e,100));this.cancelEmojiRender||(this.cancelEmoteRender=N.monkeyPatch(o.MessageComponent,"default",{before:e=>{if(!N.getNestedProp(e.methodArguments[0],"childrenMessageContent.props.message"))return;const t=N.getNestedProp(e.methodArguments[0],"childrenMessageContent.props.content");if(!t||!t.length)return;let n=[];const s=[];for(let e of t){if("string"!=typeof e){s.push(e);continue}let r,o=!1;do{if(r=Qn.EmojiRegex.exec(e),r){o=!0,ts||(ts=BDModules.get(e=>e.default&&e.default.getCustomEmojiById)[0]);const e=ts.default.getCustomEmojiById(r[2]);e?n.push({animated:e.animated,name:e.name,id:e.id,raw:r[0]}):n.push({animated:r[0].startsWith("{if(!e)return"";const o=n.find(t=>t.raw==e);return o?(es||(es=BDModules.get(e=>e.CustomEmoji)[0]),React.createElement(es.CustomEmoji,{emoji:{name:`.${o.name}.`,emojiId:o.id,animated:o.animated,jumboable:1===r.length&&1===t.length}})):e}).reduce((e,t)=>0===e.length?[t]:"string"==typeof t?"string"==typeof e[e.length-1]?(e[e.length-1]+=` ${t}`,e):(e.push(" "+t),e):(e.push(" ",t),e),[]);s.push(...r)}else s.push(e)}for(;e.methodArguments[0].childrenMessageContent.props.content[0];)e.methodArguments[0].childrenMessageContent.props.content.shift();for(;s[0];)e.methodArguments[0].childrenMessageContent.props.content.push(s.shift())}}))}disable(){this.cancelEmoteRender&&(this.cancelEmoteRender(),this.cancelEmoteRender=null)}start(){}};function cs(e,t,n,s,r,o,a,i,l,c){if(null==n||0===n.length)return null;var d=n.map((function(e,n){return React.createElement(i,Object.assign({onClick:r,onHover:s,selected:t===n,index:n},l(e,n)))}));return[ds(o,a,e,c),d]}function ds(e,t,n,s){var r=n.length>0?e.format({prefix:s(n)}):t;return Array.isArray(r)?r.unshift(React.createElement("strong",{},"[Lightcord] ")):r="[LIGHTCORD] "+r,React.createElement(ns.default.Title,{title:r},r)}ds.displayName="renderHeader";let us,hs,ps,ms=BDModules.get(e=>e.default&&e.default.isEmojiDisabled)[0],gs=ms&&ms.default.isEmojiDisabled,fs=!1,bs=!1;function ys(e){fs=e,bs||(ms||(ms=BDModules.get(e=>e.default&&e.default.isEmojiDisabled)[0]),ms&&(gs||(gs=ms.default.isEmojiDisabled),bs=!0,ms.default.isEmojiDisabled=function(e){return fs?!(!e.surrogates&&!e.diversity):gs.call(this,...arguments)}))}function vs(){}vs.prototype.setConfig=function(e){Object.assign(S,e)},vs.prototype.init=async function(){if(!Array.prototype.flat)return void N.alert("Not Supported","BetterDiscord v"+p+" does not support this old version ("+u+") of Discord. Please update your Discord installation before proceeding.");if(S.version
Please download the latest version from GitHub");if(window.ED)return void N.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 N.alert("Not Supported","BandagedBD does not work with Powercord. Please uninstall one of them.");N.suppressErrors(this.patchAttributes.bind(this),"LC Plugin Certifier Patch")(),N.log("Startup","Initializing Settings"),this.initSettings(),await this.checkForGuilds(),o.initialize(),N.log("Startup","Updating Settings"),Jn.initializeSettings(),N.log("Startup","Loading Addons Cache"),await ye.loadAddonCertifierCache(),N.log("Startup","Loading Plugins"),await $.loadPlugins(),N.log("Startup","Loading Themes"),await R.loadThemes(),B.addStyle("customcss",atob(Se.getBDData("bdcustomcss"))),window.addEventListener("beforeunload",(function(){y["bda-dc-0"]&&document.querySelector(".btn.btn-disconnect").click()})),X.start(),N.log("Startup","Removing Loading Icon"),document.getElementsByClassName("bd-loaderv2").length&&document.getElementsByClassName("bd-loaderv2")[0].remove(),N.log("Startup","Initializing Main Observer"),this.initObserver(),y["fork-ps-1"]&&(N.log("Startup","Collecting Startup Errors"),N.showContentErrors({plugins:w,themes:C}));const e=Se.getBDData("version");if(p>e&&(g&&this.showChangelogModal(g),Se.setBDData("version",p)),ls.start(),N.suppressErrors(this.patchSocial.bind(this),"BD Social Patch")(),N.suppressErrors(this.patchGuildPills.bind(this),"BD Guild Pills Patch")(),N.suppressErrors(this.patchGuildListItems.bind(this),"BD Guild List Items Patch")(),N.suppressErrors(this.patchGuildSeparator.bind(this),"BD Guild Separator Patch")(),N.suppressErrors(this.patchMessageHeader.bind(this),"BD Badge Chat Patch")(),N.suppressErrors(this.patchMemberList.bind(this),"BD Badge Member List Patch")(),N.suppressErrors(this.patchAttachment.bind(this),"LC Plugin Certifier Patch")(),S.haveInstalledDefault){let e=N.alert("First Installation","As it is the first time you install Lightcord, We added two default themes and one default plugin in your plugin/theme folder. Check it in the Plugin/Theme settings.");await new Promise(t=>{e.onClose(t)})}const t=document.querySelector("#app-mount > div.typeWindows-1za-n7.withFrame-haYltI.titleBar-AC4pGV.horizontalReverse-3tRjY7.flex-1O1GKY.directionRowReverse-m8IjIq.justifyStart-2NDFzi.alignStretch-DpGPf3.da-typeWindows.da-withFrame.da-titleBar.da-horizontalReverse.da-flex.da-directionRowReverse.da-justifyStart.da-alignStretch > div.wordmarkWindows-1v0lYD.wordmark-2iDDfm.da-wordmarkWindows.da-wordmark");t&&(t.style.top="3px",t.innerHTML='\n \n \n \n')},vs.prototype.patchAttributes=async function(){let e=[];for(this.cancelPatchAttributes=function(){e.forEach(e=>e())};!o.MessageComponent;)await new Promise(e=>setTimeout(e,100));const t=c.find(e=>"Anchor"==e.displayName);ensureExported(e=>e.default&&"DiscordTag"===e.default.displayName).then(e=>{let n=e.default;e.default=function(e){let s=n(e),r=Rn(),a=o.React.createElement("div",{style:{display:"inline",marginTop:"5px"}},o.React.createElement("span",{id:"badges-"+r,key:"badges-"+r,style:{display:"inherit"}})),i=[s];"249746236008169473"===e.user.id?i.push(o.React.createElement(V,{color:"black",side:"top",text:"BandagedBD Developer"},o.React.createElement(t,{className:"bd-chat-badge",href:"https://github.com/rauenzi/BetterDiscordApp",title:"BandagedBD",target:"_blank"},o.React.createElement(Yn,{size:"16px",className:"bd-logo"})))):"696481194443014174"!==e.user.id&&"696003456611385396"!==e.user.id||i.push(o.React.createElement(V,{color:"black",side:"top",text:"Lightcord Developer"},o.React.createElement(t,{className:"bd-chat-badge",href:"https://github.com/Lightcord/Lightcord",title:"Lightcord",target:"_blank"},o.React.createElement(Xn,{size:"16px",className:"bd-logo"})))),i.push(a);let l=o.React.createElement("div",{style:{display:"block"}},i);return Es(r,e.user,!1),l}}),e.push(N.monkeyPatch(o.MessageComponent,"default",{after:e=>{e.methodArguments[0].childrenMessageContent.props.message&&(e.returnValue.props["data-message-id"]=e.methodArguments[0].childrenMessageContent.props.message.id)}}))},vs.prototype.checkForGuilds=function(){let e=0;return new Promise(t=>{const n=function(){const s=o.guildClasses.wrapper.split(" ")[0];document.querySelectorAll(`.${s}`).length>0&&e++;const r=o.guildClasses.listItem.split(" ")[0],a=o.guildClasses.blobContainer.split(" ")[0];return document.querySelectorAll(`.${s} .${r} .${a}`).length>0||e>=50?t(S.deferLoaded=!0):void setTimeout(n,100)};"loading"!=document.readyState&&setTimeout(n,100),document.addEventListener("DOMContentLoaded",()=>{setTimeout(n,100)})})},vs.prototype.injectExternals=async function(){await B.addScript("ace-script","https://cdnjs.cloudflare.com/ajax/libs/ace/1.2.9/ace.js"),window.require.original&&(window.require=window.require.original)},vs.prototype.initSettings=function(){if(Se.initialize(),Se.getSettingGroup("settings")||Se.getSettingGroup("rpc")){Jn.loadSettings();for(const e in b)null==y[e]&&(y[e]=b[e],Jn.saveSettings())}else Se.getSettingGroup("settings")||Object.assign(y,b),Se.getSettingGroup("rpc")||Object.assign(v,E),Jn.saveSettings();window.Lightcord.Api.ensureExported(e=>e.default&&e.default.prototype&&e.default.prototype.getPredicateSections).then(e=>{let t=e.default.prototype.getPredicateSections;e.default.prototype.getPredicateSections=function(){let e=t.call(this,...arguments);if("My Account"===e[1].section){let t=[];for(t.push(e.pop()),t.push(e.pop()),t.push(e.pop()),t.push(e.pop()),e.push(...Jn.renderSidebar());t[0];)e.push(t.pop())}return e}})},vs.prototype.initObserver=function(){new MutationObserver(e=>{for(let t=0,n=e.length;te.layer&&"string"==typeof e.layer&&e.animating)[0].layer),hs||(hs=BDModules.get(e=>e.socialLinks&&"string"==typeof e.socialLinks)[0].socialLinks),ps||(ps=BDModules.get(e=>e.modal&&"string"==typeof e.modal&&e.inner&&"string"==typeof e.inner&&!e.responsiveWidthMobile)[0].modal),s.classList.contains(us)&&(s.getElementsByClassName("guild-settings-base-section").length&&s.setAttribute("layer-id","server-settings"),s.getElementsByClassName(hs).length&&(s.setAttribute("layer-id","user-settings"),s.setAttribute("id","user-settings"))),s.parentElement==document.body&&s.querySelector("#ace_settingsmenu")&&(s.id="ace_settingsmenu_container")}}).observe(document,{childList:!0,subtree:!0})},vs.prototype.showChangelogModal=function(e={}){return N.showChangelogModal(e)},vs.prototype.alert=function(e,t){return N.alert(e,t)},vs.prototype.patchSocial=function(){if(this.socialPatch)return;const e=c.find(e=>"TabBar"==e.displayName),t=c.find(e=>"Anchor"==e.displayName);e&&(this.socialPatch=N.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;if(t){let e=BDModules.get(e=>e.socialLinks)[0];const s=n[n.length-2].type,r=function(){const n=s(...arguments);return n.props.children.push(o.React.createElement(V,{color:"black",side:"top",text:"Lightcord"},o.React.createElement(t,{className:"bd-social-link "+e.link,href:"https://github.com/Lightcord/Lightcord",title:"Lightcord",target:"_blank"},o.React.createElement(Xn,{size:"16px",className:"bd-social-logo"})))),n.props.children.push(o.React.createElement(V,{color:"black",side:"top",text:"BandagedBD"},o.React.createElement(t,{className:"bd-social-link "+e.link,href:"https://github.com/rauenzi/BetterDiscordApp",title:"BandagedBD",target:"_blank"},o.React.createElement(Yn,{size:"16px",className:"bd-social-logo"})))),n};n[n.length-2].type=r}let[s,a,i]=[BDModules.get(e=>e.colorMuted)[0].colorMuted,BDModules.get(e=>e.size32)[0],BDModules.get(e=>e.versionHash)[0].versionHash];const l=`(${S.hash?S.hash.substring(0,7):S.branch})`,c=[o.react.createElement("div",{className:`${s} ${a.size12}`},`Lightcord ${r.remote.getGlobal("BuildInfo").version} `,o.react.createElement("span",{className:i+" da-versionHash"},`(${(r.remote.getGlobal("BuildInfo").commit||"Unknown").slice(0,7)})`)),o.react.createElement("div",{className:`${s} ${a.size12}`},`BBD ${p} `,o.react.createElement("span",{className:i+" da-versionHash"},l))],d=n[n.length-1].type;n[n.length-1].type=function(){const e=d(...arguments);return e.props.children.splice(1,0,c),e}}}))};function Es(e,t,n){process.nextTick(()=>{const s=document.getElementById("badges-"+e);if(!s||s.childNodes.length>0)return;if(s.childNodes.length)return;let r=document.createElement("div");r.style.display="none",s.appendChild(r);const a=c.find(e=>"Anchor"==e.displayName);In.getBadges(t.id).then(e=>{e.forEach(e=>{const r={svg:{size:"16px",className:"bd-logo",width:"16px"}};e.scopes.forEach(e=>{"user"===e&&(r.user=t)}),e.href||(r.Anchor=a,r.href={className:n?"bd-chat-badge":"bd-member-badge",title:e.name,target:"_blank"});const i=o.React.createElement(V,{color:"black",side:"top",text:e.name},e.href?o.react.createElement(a,{href:e.href,className:n?"bd-chat-badge":"bd-member-badge",title:e.name,target:"_blank"},o.React.createElement(e.component,r)):o.React.createElement(e.component,r)),l=document.createElement("div");o.reactDom.render(i,l),l.childNodes.forEach(e=>{s.appendChild(e)})})})})}vs.prototype.patchGuildListItems=function(){if(this.guildListItemsPatch)return;const e=function(){const e=c.findByProps("wrapper","unreadMentionsBar"),t=c.findByProps("guildsError","selected"),n=c.findByProps("blobContainer");return Object.assign({},e,t,n)}(),t=e.listItem.split(" ")[0],n=e.blobContainer.split(" ")[0],s=o.getInternalInstance(document.querySelector(`.${t} .${n}`).parentElement).return.type;s&&(this.guildListItemsPatch=N.monkeyPatch(s.prototype,"render",{after:e=>{if(e.returnValue&&e.thisObject){const t=e.returnValue,n=e.thisObject.props;let s=t.props.className;return s+=" bd-guild",n.unread&&(s+=" bd-unread"),n.selected&&(s+=" bd-selected"),n.audio&&(s+=" bd-audio"),n.video&&(s+=" bd-video"),n.badge&&(s+=" bd-badge"),n.animatable&&(s+=" bd-animatable"),t.props.className=s,t}}}))},vs.prototype.patchGuildPills=function(){if(this.guildPillPatch)return;const e=c.find(e=>e.default&&!e.default.displayName&&e.default.toString&&e.default.toString().includes("translate3d"));e&&(this.guildPillPatch=N.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}}))},vs.prototype.patchGuildSeparator=function(){if(this.guildSeparatorPatch)return;const e=c.findByDisplayName("Guilds"),t=c.findByProps("renderListItem");if(!t||!e)return;const n=function(){const e=t.Separator(...arguments);return e.props.className+=" bd-guild-separator",e};this.guildSeparatorPatch=N.monkeyPatch(e.prototype,"render",{after:e=>{e.returnValue.props.children[1].props.children[3].type=n}})},vs.prototype.patchAttachment=function(){if(this.AttachmentPatch)return;const e=BDModules.get(e=>e.default&&"Attachment"===e.default.displayName)[0];c.find(e=>"Anchor"==e.displayName)&&e&&e.default&&(this.AttachmentPatch=N.monkeyPatch(e,"default",{after:e=>{if(!y["fork-ps-6"])return;const t=e.methodArguments[0]||null,n=N.getNestedProp(e.returnValue,"props.children");if(!n||!t||!t.url)return;if(!Array.isArray(n))return;const s=Rn();n.push(o.react.createElement("span",{id:"certified-"+s})),X.patch(t,"certified-"+s)}}))},vs.prototype.patchMessageHeader=function(){if(this.messageHeaderPatch)return;const e=c.findByProps("MessageTimestamp"),t=c.find(e=>"Anchor"==e.displayName);t&&e&&e.default&&(this.messageHeaderPatch=N.monkeyPatch(e,"default",{after:e=>{const n=N.getNestedProp(e.methodArguments[0],"message.author"),s=N.getNestedProp(e.returnValue,"props.children.1.props.children.1.props.children");if(!s||!n||!n.id)return;if(!Array.isArray(s))return;"249746236008169473"===n.id?s.push(o.React.createElement(V,{color:"black",side:"top",text:"BandagedBD Developer"},o.React.createElement(t,{className:"bd-chat-badge",href:"https://github.com/rauenzi/BetterDiscordApp",title:"BandagedBD",target:"_blank"},o.React.createElement(Yn,{size:"16px",className:"bd-logo"})))):"696481194443014174"!==n.id&&"696003456611385396"!==n.id||s.push(o.React.createElement(V,{color:"black",side:"top",text:"Lightcord Developer"},o.React.createElement(t,{className:"bd-chat-badge",href:"https://github.com/Lightcord/Lightcord",title:"Lightcord",target:"_blank"},o.React.createElement(Xn,{size:"16px",className:"bd-logo"}))));const r=Rn();s.push(o.React.createElement("div",{id:"badges-"+r,style:{display:"inline"}})),Es(r,n,!0)}}))},vs.prototype.patchMemberList=function(){if(this.memberListPatch)return;const e=c.findByDisplayName("MemberListItem"),t=c.find(e=>"Anchor"==e.displayName);t&&e&&e.prototype&&e.prototype.renderDecorators&&(this.memberListPatch=N.monkeyPatch(e.prototype,"renderDecorators",{after:e=>{const n=N.getNestedProp(e.thisObject,"props.user"),s=N.getNestedProp(e.returnValue,"props.children");if(!s||!n||!n.id)return;if(!Array.isArray(s))return;"249746236008169473"===n.id?s.push(o.React.createElement(V,{color:"black",side:"top",text:"BandagedBD Developer"},o.React.createElement(t,{className:"bd-member-badge",href:"https://github.com/rauenzi/BetterDiscordApp",title:"BandagedBD",target:"_blank"},o.React.createElement(Yn,{size:"16px",className:"bd-logo"})))):"696481194443014174"!==n.id&&"696003456611385396"!==n.id||s.push(o.React.createElement(V,{color:"black",side:"top",text:"Lightcord Developer"},o.React.createElement(t,{className:"bd-member-badge",href:"https://github.com/Lightcord/Lightcord",title:"Lightcord",target:"_blank"},o.React.createElement(Xn,{size:"16px",className:"bd-logo"}))));const r=Rn();s.push(o.React.createElement("div",{id:"badges-"+r})),Es(r,n,!1)}}))},vs.prototype.updateInjector=async function(){const e=Se.injectionPath;if(!e)return!1;const t=n(2),s=n(1),r=n(7),o=n(8),a=n(9),i=s.resolve(e,".."),l=s.basename(e),c="https://github.com/rauenzi/BetterDiscordApp/archive/injector.zip",d=s.resolve(i,"injector.zip"),u=s.resolve(i,"BetterDiscordApp-injector");N.log("InjectorUpdate","Downloading "+c);let h=await new Promise(e=>{null.get({url:c,encoding:null},async(n,s,r)=>{if(n||200!==s.statusCode)return e(!1);await new Promise(e=>t.exists(d,e))&&await new Promise(e=>t.rename(d,`${d}.bak${Math.round(performance.now())}`,e)),N.log("InjectorUpdate","Writing "+d),t.writeFile(d,r,t=>e(!t))})});if(!h)return h;await new Promise(e=>t.exists(u,e))&&await new Promise(e=>t.rename(u,`${u}.bak${Math.round(performance.now())}`,e));const p=await new Promise(e=>o.open(d,{lazyEntries:!0},(t,n)=>e(n)));p.on("entry",(function(e){if(e.fileName.endsWith("/"))return p.readEntry();N.log("InjectorUpdate","Extracting "+e.fileName);const n=s.resolve(i,e.fileName);a.sync(s.dirname(n)),p.openReadStream(e,(function(e,s){if(e)return h=!1;s.on("end",(function(){p.readEntry()})),s.pipe(t.createWriteStream(n))}))})),p.readEntry(),await new Promise(e=>p.once("end",e));const m=s.resolve(i,`${l}.bak${Math.round(performance.now())}`);return await new Promise(n=>t.rename(e,m,n)),N.log("InjectorUpdate",`Renaming ${s.basename(u)} to ${l}`),h=await new Promise(n=>t.rename(u,e,e=>n(!e))),h?h?(await new Promise(e=>r(m,e)),await new Promise(e=>t.unlink(d,e)),N.log("InjectorUpdate","Injector Updated!"),h):(N.err("InjectorUpdate","Something went wrong... restoring backups."),await new Promise(e=>r(u,e)),await new Promise(n=>t.rename(m,e,n)),h):(N.err("InjectorUpdate","Failed to rename the final directory"),h)};var ws=new vs;const Cs={get React(){return o.React},get ReactDOM(){return o.ReactDom},get ReactComponent(){return o.ReactComponent},get WindowConfigFile(){return N.WindowConfigFile},get settings(){return f},get emotes(){return{}},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 N.getAllWindowPreferences()},getWindowPreference:function(e){return N.getWindowPreference(e)},setWindowPreference:function(e,t){return N.setWindowPreference(e,t)},injectCSS:function(e,t){B.addStyle(B.escapeID(e),t)},clearCSS:function(e){B.removeStyle(B.escapeID(e))},linkJS:function(e,t){B.addScript(B.escapeID(e),t)},unlinkJS:function(e){B.removeScript(B.escapeID(e))},getPlugin:function(e){return D.hasOwnProperty(e)?D[e].plugin:null},getCore:function(){return N.warn("Deprecation Notice","BdApi.getCore() will be removed in future versions."),ws},alert:function(e,t){return N.showConfirmationModal(e,t,{cancelText:null})},showConfirmationModal:function(e,t,n={}){return N.showConfirmationModal(e,t,n)},showToast:function(e,t={}){N.showToast(e,t)},findModule:function(e){return o.WebpackModules.find(e)},findAllModules:function(e){return o.WebpackModules.findAll(e)},findModuleByProps:function(...e){return o.WebpackModules.findByUniqueProperties(e)},findModuleByPrototypes:function(...e){return o.WebpackModules.findByPrototypes(e)},findModuleByDisplayName:function(e){return o.WebpackModules.findByDisplayName(e)},getInternalInstance:function(e){if(e instanceof window.jQuery||e instanceof Element)return e instanceof jQuery&&(e=e[0]),o.getInternalInstance(e)},loadData:function(e,t){return Se.getPluginData(e,t)}};Cs.getData=Cs.loadData,Cs.saveData=function(e,t,n){return Se.setPluginData(e,t,n)},Cs.setData=Cs.saveData,Cs.deleteData=function(e,t){return Se.deletePluginData(e,t)},Cs.monkeyPatch=function(e,t,n){return N.monkeyPatch(e,t,n)},Cs.onRemoved=function(e,t){return N.onRemoved(e,t)},Cs.suppressErrors=function(e,t){return N.suppressErrors(e,t)},Cs.testJSON=function(e){return N.testJSON(e)},Cs.isPluginEnabled=function(e){return!!k[e]},Cs.isThemeEnabled=function(e){return!!M[e]},Cs.isSettingEnabled=function(e){return!!y[e]},Cs.enableSetting=function(e){return Jn.onChange(e,!0)},Cs.disableSetting=function(e){return Jn.onChange(e,!1)},Cs.toggleSetting=function(e){return Jn.onChange(e,!y[e])},Cs.getBDData=function(e){return Se.getBDData(e)},Cs.setBDData=function(e,t){return Se.setBDData(e,t)};const Ss=(e,t,n)=>new class{get folder(){return n.folder}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)}};Cs.Plugins=Ss(k,D,$),Cs.Themes=Ss(M,x,R);var xs=Cs;window.Lightcord.BetterDiscord.BdApi=Cs,n.d(t,"default",(function(){return Ms})),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,{getOwnPropertyDescriptor:function(e,t){if("localStorage"!==t)return Object.getOwnPropertyDescriptor(e,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 Ds=(e,t)=>{Object.defineProperty(window,e,{get:()=>(N.warn("Deprecated Global",`"${e}" will be removed in future versions. Please only use BdApi.`),t)})},ks=Object.keys(s);for(const e of ks)Ds(e,s[e]);Ds("BDV2",o),Ds("pluginModule",$),Ds("themeModule",R),Ds("Utils",N),Ds("BDEvents",L),Ds("settingsPanel",Jn),Ds("DataStore",Se),Ds("ContentManager",ye),Ds("ClassNormalizer",He),window.BdApi=xs,Ds("mainCore",ws);class Ms{constructor(e){ws.setConfig(e)}init(){ws.init()}}n(10)}]); \ No newline at end of file +module.exports=function(e){var t={};function n(s){if(t[s])return t[s].exports;var r=t[s]={i:s,l:!1,exports:{}};return e[s].call(r.exports,r,r.exports,n),r.l=!0,r.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 r in e)n.d(s,r,function(t){return e[t]}.bind(null,r));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=11)}([function(e,t){e.exports=require("electron")},function(e,t){e.exports=require("path")},function(e,t){e.exports=require("fs")},function(e,t){e.exports=require("crypto")},function(e,t){e.exports=require("node-fetch")},function(e,t){e.exports=require("events")},function(e,t){e.exports=require("module")},function(e,t){e.exports=require("rimraf")},function(e,t){e.exports=require("yauzl")},function(e,t){e.exports=require("mkdirp")},function(e,t){e.exports=require("request")},function(e,t,n){"use strict";n.r(t);var s={};n.r(s),n.d(s,"minimumDiscordVersion",(function(){return ae})),n.d(s,"currentDiscordVersion",(function(){return ie})),n.d(s,"minSupportedVersion",(function(){return le})),n.d(s,"bbdVersion",(function(){return ce})),n.d(s,"LCChanelog",(function(){return de})),n.d(s,"bbdChangelog",(function(){return ue})),n.d(s,"settings",(function(){return he})),n.d(s,"defaultCookie",(function(){return pe})),n.d(s,"settingsCookie",(function(){return me})),n.d(s,"settingsRPC",(function(){return ge})),n.d(s,"defaultRPC",(function(){return fe})),n.d(s,"bdpluginErrors",(function(){return be})),n.d(s,"bdthemeErrors",(function(){return ye})),n.d(s,"bdConfig",(function(){return ve})),n.d(s,"bdthemes",(function(){return we})),n.d(s,"bdplugins",(function(){return Ee})),n.d(s,"pluginCookie",(function(){return Ce})),n.d(s,"themeCookie",(function(){return Se}));var r=n(0);const o=webpackJsonp.push([[],{__extra_id__:(e,t,n)=>e.exports=n},[["__extra_id__"]]]);delete o.m.__extra_id__,delete o.c.__extra_id__;const a=e=>{for(const t in o.c)if(o.c.hasOwnProperty(t)){const n=o.c[t].exports;if(n&&n.__esModule&&n.default&&e(n.default))return n.default;if(n&&e(n))return n}return null};let i={find:a,findAll:e=>{const t=[];for(const n in o.c)if(o.c.hasOwnProperty(n)){const s=o.c[n].exports;s&&s.__esModule&&s.default&&e(s.default)?t.push(s.default):s&&e(s)&&t.push(s)}return t},findByProps:(...e)=>a(t=>e.every(e=>void 0!==t[e])),findByPrototypes:(...e)=>a(t=>t.prototype&&e.every(e=>void 0!==t.prototype[e])),findByDisplayName:e=>a(t=>t.displayName===e)};var l=i;window.Lightcord.BetterDiscord.WebpackModules=i;class c{static escapeID(e){return e.replace(/^[^a-z]+|[^\w-]+/gi,"-")}static addStyle(e,t){document.head.append(c.createElement(``))}static removeStyle(e){const t=document.getElementById(e);t&&t.remove()}static addScript(e,t){return new Promise(n=>{const s=document.createElement("script");s.id=e,s.src=t,s.type="text/javascript",s.onload=n,document.head.append(s)})}static removeScript(e){e=this.escapeID(e);const t=document.getElementById(e);t&&t.remove()}static animate({timing:e=(e=>e),update:t,duration:n}){const s=performance.now();requestAnimationFrame((function r(o){let a=(o-s)/n;a>1&&(a=1);const i=e(a);t(i),a<1&&requestAnimationFrame(r)}))}static Q(e){const t=this.parseHTML(e);return(t instanceof NodeList?Array.from(t).some(e=>1===e.nodeType):1===t.nodeType)?t:this.query(e)}static query(e,t){return t||(t=document),t.querySelector(e)}static queryAll(e,t){return t||(t=document),t.querySelectorAll(e)}static parseHTML(e,t=!1){const n=document.createElement("template");n.innerHTML=e;const s=n.content.cloneNode(!0);return t?s:s.childNodes.length>1?s.childNodes:s.childNodes[0]}static createElement(e,t=!1){return this.parseHTML(e,t)}static escapeHTML(e){const t=document.createTextNode(""),n=document.createElement("span");return n.append(t),t.nodeValue=e,n.innerHTML}static addClass(e,...t){t=t.flat().filter(e=>e);for(let e=0;ee),e.classList.add(...t),e}static removeClass(e,...t){for(let e=0;ee),e.classList.remove(...t),e}static toggleClass(e,t,n){return t=t.toString().split(" ").filter(e=>e),void 0!==n?t.forEach(t=>e.classList.toggle(t,n)):t.forEach(t=>e.classList.toggle(t)),e}static hasClass(e,t){return t.toString().split(" ").filter(e=>e).every(t=>e.classList.contains(t))}static replaceClass(e,t,n){return e.classList.replace(t,n),e}static appendTo(e,t){return"string"==typeof t&&(t=this.query(t)),t?(t.append(e),e):null}static prependTo(e,t){return"string"==typeof t&&(t=this.query(t)),t?(t.prepend(e),e):null}static insertAfter(e,t){return t.parentNode.insertBefore(e,t.nextSibling),e}static after(e,t){return e.parentNode.insertBefore(t,e.nextSibling),e}static next(e,t=""){return t?e.querySelector("+ "+t):e.nextElementSibling}static nextAll(e){return e.querySelectorAll("~ *")}static nextUntil(e,t){const n=[];for(;e.nextElementSibling&&!e.nextElementSibling.matches(t);)n.push(e=e.nextElementSibling);return n}static previous(e,t=""){const n=e.previousElementSibling;return t?n&&n.matches(t)?n:null:n}static previousAll(e){const t=[];for(;e.previousElementSibling;)t.push(e=e.previousElementSibling);return t}static previousUntil(e,t){const n=[];for(;e.previousElementSibling&&!e.previousElementSibling.matches(t);)n.push(e=e.previousElementSibling);return n}static indexInParent(e){const t=e.parentNode.childNodes;let n=0;for(let s=0;s "+t)}static findChildren(e,t){return e.querySelectorAll(":scope > "+t)}static parents(e,t=""){const n=[];if(t)for(;e.parentElement&&e.parentElement.closest(t);)n.push(e=e.parentElement.closest(t));else for(;e.parentElement;)n.push(e=e.parentElement);return n}static parentsUntil(e,t){const n=[];for(;e.parentElement&&!e.parentElement.matches(t);)n.push(e=e.parentElement);return n}static siblings(e,t="*"){return Array.from(e.parentElement.children).filter(n=>n!=e&&n.matches(t))}static css(e,t,n){return void 0===n?global.getComputedStyle(e)[t]:(e.style[t]=n,e)}static width(e,t){return void 0===t?parseInt(getComputedStyle(e).width):(e.style.width=t,e)}static height(e,t){return void 0===t?parseInt(getComputedStyle(e).height):(e.style.height=t,e)}static text(e,t){return void 0===t?e.textContent:e.textContent=t}static innerWidth(e){return e.clientWidth}static innerHeight(e){return e.clientHeight}static outerWidth(e){return e.offsetWidth}static outerHeight(e){return e.offsetHeight}static offset(e){return e.getBoundingClientRect()}static get listeners(){return this._listeners||(this._listeners={})}static on(e,t,n,s){const[r,o]=t.split("."),a=n&&s;s||(s=n);const i=a?function(e){e.target.matches(n)&&s(e)}:s;e.addEventListener(r,i);const l=()=>{e.removeEventListener(r,i)};if(o){this.listeners[o]||(this.listeners[o]=[]);const t=()=>{l(),this.listeners[o].splice(this.listeners[o].findIndex(t=>t.event==r&&t.element==e),1)};return this.listeners[o].push({event:r,element:e,cancel:t}),t}return l}static once(e,t,n,s){const[r,o]=t.split("."),a=n&&s;s||(s=n);const i=a?function(t){t.target.matches(n)&&(s(t),e.removeEventListener(r,i))}:function(t){s(t),e.removeEventListener(r,i)};e.addEventListener(r,i);const l=()=>{e.removeEventListener(r,i)};if(o){this.listeners[o]||(this.listeners[o]=[]);const t=()=>{l(),this.listeners[o].splice(this.listeners[o].findIndex(t=>t.event==r&&t.element==e),1)};return this.listeners[o].push({event:r,element:e,cancel:t}),t}return l}static __offAll(e,t){const[n,s]=e.split(".");let r=e=>e.event==n,o=e=>e;t&&(r=e=>e.event==n&&e.element==t,o=e=>e.element==t);const a=this.listeners[s]||[],i=n?a.filter(r):a.filter(o);for(let e=0;e{this.observer.unsubscribe(s),t()};return this.observer.subscribe(s,t=>{const s=Array.from(n?t.addedNodes:t.removedNodes),r=s.indexOf(e)>-1,o=s.some(t=>t.contains(e));return r||o}),e}static onMount(e,t){return this.onMountChange(e,t)}static onUnmount(e,t){return this.onMountChange(e,t,!1)}static onAdded(e,t){return this.onMount(e,t)}static onRemoved(e,t){return this.onUnmount(e,t,!1)}static wrap(e){const t=this.parseHTML('
');for(let n=0;ne.channelTextArea&&e.titleWrapper)[0].channelTextArea.split(" ")[0]+" textarea")}static insertText(e,t){e.focus(),e.selectionStart=0,e.selectionEnd=e.value.length,document.execCommand("insertText",!1,t)}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:r,instead:o,once:a=!1,silent:i=!1,force:l=!1}=n,c=n.displayName||e.displayName||e[t].displayName||e.name||e.constructor.displayName||e.constructor.name;if(i||console.log("patch",t,"of",c),!e[t]){if(!l)return console.error(t,"does not exist for",c);e[t]=function(){}}const u=e[t];let h=!1;const p=()=>{i||console.log("unpatch",t,"of",c),h=!0};return e[t]=function(){if(h)return u.call(this,...arguments);const n={thisObject:this,methodArguments:arguments,cancelPatch:p,originalMethod:u,callOriginalMethod:()=>n.returnValue=n.originalMethod.apply(n.thisObject,n.methodArguments)};if(o){const s=d.suppressErrors(o,"`instead` callback of "+e[t].displayName)(n);void 0!==s&&(n.returnValue=s)}else s&&d.suppressErrors(s,"`before` callback of "+e[t].displayName)(n),n.callOriginalMethod(),r&&d.suppressErrors(r,"`after` callback of "+e[t].displayName)(n);return a&&p(),n.returnValue},Object.assign(e[t],u),e[t].__monkeyPatched=!0,e[t].displayName=c,e[t].__originalMethod||(e[t].__originalMethod=u,e[t].toString=function(){return u.toString()}),p}static onRemoved(e,t){const n=new MutationObserver(s=>{for(let r=0;r-1,l=a.some(t=>t.contains(e));(i||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.querySelector("."+BDModules.get(e=>e.sidebar&&e.hasNotice)[0].sidebar.split(" ")[9]+" + div")||null,t=e?e.querySelector("."+BDModules.get(e=>e.membersWrap)[0].membersWrap):null,n=e?e.querySelector("form"):null,s=e?e.getBoundingClientRect().left:310,r=t?t.getBoundingClientRect().left:0,o=r?r-e.getBoundingClientRect().left:d.screenWidth-s-240,a=n?n.offsetHeight:80,i=document.createElement("div");i.classList.add("bd-toasts"),i.style.setProperty("left",s+"px"),i.style.setProperty("width",o+"px"),i.style.setProperty("bottom",a+"px"),document.querySelector("#app-mount").appendChild(i)}const{type:n="",icon:s=!0,timeout:r=3e3}=t,o=document.createElement("div");o.classList.add("bd-toast"),n&&o.classList.add("toast-"+n),n&&s&&o.classList.add("icon"),o.innerText=e,document.querySelector(".bd-toasts").appendChild(o),setTimeout(()=>{o.classList.add("closing"),setTimeout(()=>{o.remove(),document.querySelectorAll(".bd-toasts .bd-toast").length||document.querySelector(".bd-toasts").remove()},300)},r)}static alert(e,t){let n=BDModules.get(e=>e.modal&&e.inner&&!e.hideOnFullscreen)[0],s=BDModules.get(e=>e.header&&e.responsiveWidthMobile&&e.hideOnFullscreen)[0],r=BDModules.get(e=>e.header&&e.responsiveWidthMobile&&e.focusLock)[0];const o=c.createElement(`
\n
\n
\n
\n
\n
${e}
\n
\n
\n
\n
\n ${t}\n
\n
\n
\n \n
\n
\n
`);o.querySelector(".footer button").addEventListener("click",()=>{c.addClass(o,"closing"),setTimeout(()=>{o.remove(),a.forEach(e=>{try{e()}catch(e){console.error(e)}})},300)}),o.querySelector(".bd-backdrop").addEventListener("click",()=>{c.addClass(o,"closing"),setTimeout(()=>{o.remove(),a.forEach(e=>{try{e()}catch(e){console.error(e)}})},300)}),c.query("#app-mount").append(o);const a=[];return{close:()=>{c.addClass(o,"closing"),setTimeout(()=>{o.remove(),a.forEach(e=>{try{e()}catch(e){console.error(e)}})},300)},onClose:e=>{a.push(e)}}}static showContentErrors({plugins:e=[],themes:t=[]}){if(!e||!t)return;if(!e.length&&!t.length)return;let n=BDModules.get(e=>e.modal&&e.inner&&!e.hideOnFullscreen)[0],s=BDModules.get(e=>e.header&&e.responsiveWidthMobile&&e.hideOnFullscreen)[0],r=BDModules.get(e=>e.header&&e.responsiveWidthMobile&&e.focusLock)[0];const o=c.createElement(`
\n
\n
\n
\n
Content Errors
\n
\n
\n
\n
Plugins
\n
Themes
\n
\n
\n
\n
Name
\n
Message
\n
Error
\n
\n
\n
\n \n
\n
\n
\n \n
\n
\n
`);function a(e){const t=c.createElement('
');for(const n of e){const e=c.createElement(`
\n
${n.name?n.name:n.file}
\n
${n.message}
\n \n
`);t.append(e),n.error&&e.querySelectorAll("a").forEach(e=>e.addEventListener("click",e=>{e.preventDefault(),d.err("ContentManager",`Error details for ${n.name?n.name:n.file}.`,n.error)}))}return t}const i=[a(e),a(t)];o.querySelectorAll(".tab-bar-item").forEach(e=>e.addEventListener("click",e=>{e.preventDefault();const t=o.querySelector(".tab-bar-item.selected");t&&c.removeClass(t,"selected"),c.addClass(e.target,"selected");const n=o.querySelector(".scroller");n.innerHTML="",n.append(i[c.index(e.target)])})),o.querySelector(".footer button").addEventListener("click",()=>{c.addClass(o,"closing"),setTimeout(()=>{o.remove()},300)}),o.querySelector(".bd-backdrop").addEventListener("click",()=>{c.addClass(o,"closing"),setTimeout(()=>{o.remove()},300)}),c.query("#app-mount").append(o),e.length?o.querySelector(".tab-bar-item").click():o.querySelectorAll(".tab-bar-item")[1].click()}static showChangelogModal(e={}){const t=l.findByProps("push","update","pop","popWithKey"),n=l.findByProps("fixed","improved"),s=l.findByDisplayName("Text"),r=l.findByProps("Child"),o=l.findByProps("Tags","default"),a=l.find(e=>e.defaultProps&&0==e.defaultProps.selectable),i=l.findByProps("defaultRules","parse");if(!(a&&t&&n&&s&&r&&o&&i))return;const{image:c="https://repository-images.githubusercontent.com/105473537/957b5480-7c26-11e9-8401-50fa820cbae5",description:d="",changes:u=[],title:h="BandagedBD",subtitle:p=`v${ce}`,footer:m}=e,g=oe.React.createElement,f=[g("img",{src:c})];d&&f.push(g("p",null,i.parse(d)));for(let e=0;eg("li",null,i.parse(e))));f.push(o)}const b=function(){return g(r.Child,{grow:1,shrink:1},g(o.default,{tag:o.Tags.H4},h),g(s,{size:s.Sizes.SMALL,color:s.Colors.STANDARD,className:n.date},p))},y=()=>{const e=l.find(e=>"Anchor"==e.displayName),n=l.findByProps("anchorUnderlineOnHover")||{anchor:"anchor-3Z-8Bb",anchorUnderlineOnHover:"anchorUnderlineOnHover-2ESHQB"},o=e=>{e.preventDefault(),e.stopPropagation(),t.pop(),oe.joinBD2()},a=e?g(e,{onClick:o},"Join our Discord Server."):g("a",{className:`${n.anchor} ${n.anchorUnderlineOnHover}`,onClick:o},"Join our Discord Server."),i=g(s,{size:s.Sizes.SMALL,color:s.Colors.STANDARD},"Need support? ",a);return g(r.Child,{grow:1,shrink:1},m||i)};return t.push((function(e){return g(a,Object.assign({className:n.container,selectable:!0,onScroll:e=>e,onClose:e=>e,renderHeader:b,renderFooter:y,children:f},e))}))}static showConfirmationModal(e,t,n={}){const s=l.findByProps("push","update","pop","popWithKey"),r=l.findByDisplayName("Markdown"),o=l.find(e=>e.defaultProps&&e.key&&"confirm-modal"==e.key());if(!s||!o||!r)return d.alert(e,t);const a=()=>{},{onConfirm:i=a,onCancel:c=a,confirmText:u="Okay",cancelText:h="Cancel",danger:p=!1,key:m}=n;return Array.isArray(t)||(t=[t]),t=t.map(e=>"string"==typeof e?oe.React.createElement(r,null,e):e),s.push(o,{header:e,children:t,red:p,confirmText:u,cancelText:h,onConfirm:i,onCancel:c},m)}static removeDa(e){return e?e.split(" ").filter(e=>!e.startsWith("da-")).join(" "):e}}d.showToast=d.suppressErrors(d.showToast,"Could not show toast."),window.Lightcord.BetterDiscord.Utils=d;const u=window.require,h=n(2),p=n(1),m=DiscordNative.globals?DiscordNative.globals.releaseChannel:DiscordNative.app?DiscordNative.app.getReleaseChannel():"stable";var g=new class{constructor(){this.data={settings:{stable:{},canary:{},ptb:{}}},this.pluginData={},window.Lightcord.BetterDiscord.DataStore=this}initialize(){try{h.existsSync(this.BDFile)||h.writeFileSync(this.BDFile,JSON.stringify(this.data,null,4),"binary");const e=JSON.parse(h.readFileSync(this.BDFile,"binary"));if(e.hasOwnProperty("settings")&&(this.data=e),!h.existsSync(this.settingsFile))return;let t=u(this.settingsFile);h.unlinkSync(this.settingsFile),t=t.hasOwnProperty("settings")?Object.assign({stable:{},canary:{},ptb:{}},{[m]:t}):Object.assign({stable:{},canary:{},ptb:{}},t),this.setBDData("settings",t)}catch(e){console.error(e),d.alert("Corrupt Storage","The bd storage has somehow become corrupt. You may either try to salvage the file or delete it then reload.")}}get injectionPath(){return this._injectionPath=null}get configFile(){return this._configFile||(this._configFile=p.resolve(this.injectionPath,"betterdiscord","config.json"))}get BDFile(){return this._BDFile||(this._BDFile=p.resolve(ve.dataPath,"bdstorage.json"))}get settingsFile(){return this._settingsFile||(this._settingsFile=p.resolve(ve.dataPath,"bdsettings.json"))}getPluginFile(e){return p.resolve(ne.pluginsFolder,e+".config.json")}getSettingGroup(e){return this.data.settings[m][e]||null}setSettingGroup(e,t){this.data.settings[m][e]=t,h.writeFileSync(this.BDFile,JSON.stringify(this.data,null,4),"binary")}getBDData(e){return this.data[e]||""}setBDData(e,t){this.data[e]=t,h.writeFileSync(this.BDFile,JSON.stringify(this.data,null,4),"binary")}getPluginData(e,t){return void 0!==this.pluginData[e]?this.pluginData[e][t]:h.existsSync(this.getPluginFile(e))?(this.pluginData[e]=JSON.parse(h.readFileSync(this.getPluginFile(e))),this.pluginData[e][t]):void 0}setPluginData(e,t,n){void 0!==n&&(void 0===this.pluginData[e]&&(this.pluginData[e]={}),this.pluginData[e][t]=n,h.writeFileSync(this.getPluginFile(e),JSON.stringify(this.pluginData[e],null,4),"binary"))}deletePluginData(e,t){void 0===this.pluginData[e]&&(this.pluginData[e]={}),delete this.pluginData[e][t],h.writeFileSync(this.getPluginFile(e),JSON.stringify(this.pluginData[e],null,4),"binary")}};const f=n(5);var b=new class extends f{constructor(){super(),window.Lightcord.BetterDiscord.BDEvents=this}dispatch(e,...t){this.emit(e,...t)}off(e,t){this.removeListener(e,t)}};class y{constructor(){window.Lightcord.BetterDiscord.PluginModule=this}get folder(){return ne.pluginsFolder}}y.prototype.loadPlugins=async function(){this.loadPluginData(),be.splice(0,0,...await ne.loadPlugins());const e=Object.keys(Ee);for(let t=0;tsetTimeout(e,10))}this.savePluginData(),n(0).remote.getCurrentWebContents().on("did-navigate-in-page",this.channelSwitch.bind(this))},y.prototype.startPlugin=function(e,t=!1){try{Ee[e].plugin.start(),me["fork-ps-2"]&&!t&&d.showToast(`${Ee[e].plugin.getName()} v${Ee[e].plugin.getVersion()} has started.`)}catch(n){me["fork-ps-2"]&&!t&&d.showToast(`${Ee[e].plugin.getName()} v${Ee[e].plugin.getVersion()} could not be started.`,{type:"error"}),Ce[e]=!1,this.savePluginData(),d.err("Plugins",e+" could not be started.",n)}},y.prototype.stopPlugin=function(e,t=!1){try{Ee[e].plugin.stop(),me["fork-ps-2"]&&!t&&d.showToast(`${Ee[e].plugin.getName()} v${Ee[e].plugin.getVersion()} has stopped.`)}catch(n){me["fork-ps-2"]&&!t&&d.showToast(`${Ee[e].plugin.getName()} v${Ee[e].plugin.getVersion()} could not be stopped.`,{type:"error"}),d.err("Plugins",Ee[e].plugin.getName()+" could not be stopped.",n)}},y.prototype.enablePlugin=function(e,t=!1){Ce[e]||(Ce[e]=!0,this.savePluginData(),this.startPlugin(e,t))},y.prototype.enable=function(e,t=!1){return this.enablePlugin(e,t)},y.prototype.disablePlugin=function(e,t=!1){Ce[e]&&(Ce[e]=!1,this.savePluginData(),this.stopPlugin(e,t))},y.prototype.disable=function(e,t=!1){return this.disablePlugin(e,t)},y.prototype.togglePlugin=function(e){Ce[e]?this.disablePlugin(e):this.enablePlugin(e)},y.prototype.toggle=function(e,t=!1){return this.togglePlugin(e,t)},y.prototype.loadPlugin=async function(e){const t=await ne.loadContent(e,"plugin");if(t)return me["fork-ps-1"]&&d.showContentErrors({plugins:[t]}),me["fork-ps-2"]&&d.showToast(`${e} could not be loaded.`,{type:"error"}),d.err("ContentManager",`${e} could not be loaded.`,t);const n=Object.values(Ee).find(t=>console.log(t.filename,e)||t.filename==e).plugin;try{n.load&&"function"==typeof n.load&&n.load()}catch(e){me["fork-ps-1"]&&d.showContentErrors({plugins:[e]})}d.log("ContentManager",`${n.getName()} v${n.getVersion()} was loaded.`),me["fork-ps-2"]&&d.showToast(`${n.getName()} v${n.getVersion()} was loaded.`,{type:"success"}),b.dispatch("plugin-loaded",n.getName())},y.prototype.unloadPlugin=function(e){const t=Object.values(Ee).find(t=>t.filename==e)||Ee[e];if(!t)return;const n=t.plugin.getName();Ce[n]&&this.disablePlugin(n,!0);const s=ne.unloadContent(Ee[n].filename,"plugin");if(delete Ee[n],s)return me["fork-ps-1"]&&d.showContentErrors({plugins:[s]}),me["fork-ps-2"]&&d.showToast(`${n} could not be unloaded. It may have not been loaded yet.`,{type:"error"}),d.err("ContentManager",`${n} could not be unloaded. It may have not been loaded yet.`,s);d.log("ContentManager",`${n} was unloaded.`),me["fork-ps-2"]&&d.showToast(`${n} was unloaded.`,{type:"success"}),b.dispatch("plugin-unloaded",n)},y.prototype.delete=function(e){const t=Object.values(Ee).find(t=>t.filename==e)||Ee[e];if(!t)return;this.unloadPlugin(t.filename);const s=n(1).resolve(ne.pluginsFolder,t.filename);n(2).unlinkSync(s)},y.prototype.reloadPlugin=async function(e){const t=Object.values(Ee).find(t=>t.filename==e)||Ee[e];if(!t)return this.loadPlugin(e);const n=t.plugin.getName(),s=Ce[n];s&&this.stopPlugin(n,!0);const r=await ne.reloadContent(Ee[n].filename,"plugin");if(r)return me["fork-ps-1"]&&d.showContentErrors({plugins:[r]}),me["fork-ps-2"]&&d.showToast(`${n} could not be reloaded.`,{type:"error"}),d.err("ContentManager",`${n} could not be reloaded.`,r);Ee[n].plugin.load&&"function"==typeof Ee[n].plugin.load&&Ee[n].plugin.load(),s&&this.startPlugin(n,!0),d.log("ContentManager",`${n} v${Ee[n].plugin.getVersion()} was reloaded.`),me["fork-ps-2"]&&d.showToast(`${n} v${Ee[n].plugin.getVersion()} was reloaded.`,{type:"success"}),b.dispatch("plugin-reloaded",n)},y.prototype.reload=function(e){return this.reloadPlugin(e)},y.prototype.edit=function(e){console.log("Edit "+e);const t=Object.values(Ee).find(t=>t.filename==e)||Ee[e];if(!t)return;const s=n(1).resolve(ne.pluginsFolder,t.filename);console.log("Edit "+s),n(0).shell.openItem(`${s}`)},y.prototype.updatePluginList=function(){const e=ne.loadNewContent("plugin");for(const t of e.added)this.loadPlugin(t);for(const t of e.removed)this.unloadPlugin(t)},y.prototype.loadPluginData=function(){const e=g.getSettingGroup("plugins");e&&Object.assign(Ce,e)},y.prototype.savePluginData=function(){g.setSettingGroup("plugins",Ce)},y.prototype.newMessage=function(){const e=Object.keys(Ee);for(let t=0;t{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,r=n.some(e=>e.contains(this.node));(s||r)&&(this.hide(),e.disconnect())})});e.observe(document.body,{subtree:!0,childList:!0})}),this.node.addEventListener("mouseleave",()=>{this.hide()})}get container(){return document.querySelector("."+BDModules.get(e=>e.popouts)[0].popouts.split(" ")[0]+" ~ ."+BDModules.get(e=>e.layerContainer)[0].layerContainer.split(" ")[0])}get canShowAbove(){return this.node.getBoundingClientRect().top-this.element.offsetHeight>=0}get canShowBelow(){return this.node.getBoundingClientRect().top+this.node.offsetHeight+this.element.offsetHeight<=d.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<=d.screenWidth}hide(){this.element.remove(),this.tooltipElement.className=this._className}show(){this.tooltipElement.className=`${D().tooltip} ${M(this.style)}`,this.labelElement.textContent=this.label,this.container.append(this.element),"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.classList.add(M("top")),this.element.style.setProperty("top",N(this.node.getBoundingClientRect().top-this.element.offsetHeight-10)),this.centerHorizontally()}showBelow(){this.tooltipElement.classList.add(M("bottom")),this.element.style.setProperty("top",N(this.node.getBoundingClientRect().top+this.node.offsetHeight+10)),this.centerHorizontally()}showLeft(){this.tooltipElement.classList.add(M("left")),this.element.style.setProperty("left",N(this.node.getBoundingClientRect().left-this.element.offsetWidth-10)),this.centerVertically()}showRight(){this.tooltipElement.classList.add(M("right")),this.element.style.setProperty("left",N(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",N(e-this.element.offsetWidth/2))}centerVertically(){const e=this.node.getBoundingClientRect().top+this.node.offsetHeight/2;this.element.style.setProperty("top",N(e-this.element.offsetHeight/2))}}var L=class extends React.Component{constructor(e){super(e)}async componentDidMount(){const{style:e="black",side:t="top",text:n=""}=this.props;this.node=oe.reactDom.findDOMNode(this),this.tooltip=new P(this.node,n,{style:e,side:t})}componentWillUnmount(){this.tooltip.hide(),delete this.tooltip}render(){return this.props.children}},A=n(2),$=n(1);const T={},R={};var j=new class{constructor(){window.Lightcord.BetterDiscord.PluginCertifier=this}patch(e,t){process.nextTick(()=>{!function(e,t){if(!document.getElementById(t))return;if(!e.url.startsWith("https://cdn.discordapp.com/"))return document.getElementById(t).remove();if(!e.filename.endsWith(".plugin.js")&&!e.filename.endsWith(".theme.css"))return document.getElementById(t).remove();C()(e.url,{headers:{"User-Agent":r.remote.getCurrentWebContents().userAgent}}).then(n=>{if(200!==n.status)throw new Error("File doesn't exist.");const s=w.createHash("sha256");let o=Buffer.alloc(0);n.body.on("data",e=>{o=Buffer.concat([o,e]),s.update(e)}),n.body.on("end",()=>{const n=s.digest("hex");R[e.url]=n,O[n]=e.url,I(n,o,e.filename,n=>{!function(e,t,n){const s=document.getElementById(e);if(!s||s.childNodes.length>0)return;F||(F=BDModules.get(e=>e.flowerStarContainer)[0]);z||(z=BDModules.get(e=>e.childContainer)[0]);if(t.suspect){try{s.parentNode.style.borderColor="rgb(240, 71, 71)";let e=s=>{for(let o of s.children)"A"===o.tagName?o.addEventListener("click",e=>{e.preventDefault(),e.stopImmediatePropagation(),d.showConfirmationModal("Are you sure you want to download this ?","The "+t.type.toLowerCase()+" **"+n+"** might be dangerous **("+t.harm+")**. \n\n**We don't recommand to download it**. However, you can still do it below.",{confirmText:"Download Anyway",cancelText:"Don't !",danger:!0,onCancel:()=>{},onConfirm:()=>{r.remote.shell.openExternal(o.href)}})}):["div"].includes(o.tagName.toLowerCase())&&e(o)};e(s.parentNode)}catch(e){console.error(e)}oe.reactDom.render(oe.react.createElement(L,{text:t.type+" "+t.name+" is potentially dangerous."},oe.react.createElement("div",{className:F.flowerStarContainer,style:{width:"20px",height:"20px"}},oe.react.createElement("svg",{className:BDModules.get(e=>e.svg)[0].svg,"aria-hidden":"false",width:"20px",height:"20px",viewBox:"0 0 40 32"},oe.react.createElement("rect",{x:"0",y:"0",width:"32",height:"32",mask:"url(#svg-mask-avatar-status-round-32)",fill:"#f04747",mask:"url(#svg-mask-status-dnd)",className:BDModules.get(e=>e.pointerEvents)[0].pointerEvents})))),s)}else if(t.official){s.parentNode.style.borderColor="#4087ed";let e=oe.react.createElement("span",{style:{display:"inherit"}},[oe.react.createElement(L,{text:t.type+" "+t.name+" was made by the developers of Lightcord.",style:"brand"},oe.react.createElement("div",{className:F.flowerStarContainer,style:{width:"20px",height:"20px",float:"left"}},oe.react.createElement("svg",{className:F.flowerStar,"aria-hidden":"false",width:"20px",height:"20px",viewBox:"0 0 16 15.2",stroke:"#36393f",style:{color:"#4087ed"}},oe.react.createElement("path",{fill:"currentColor","fill-rule":"evenodd",d:"m16 7.6c0 .79-1.28 1.38-1.52 2.09s.44 2 0 2.59-1.84.35-2.46.8-.79 1.84-1.54 2.09-1.67-.8-2.47-.8-1.75 1-2.47.8-.92-1.64-1.54-2.09-2-.18-2.46-.8.23-1.84 0-2.59-1.54-1.3-1.54-2.09 1.28-1.38 1.52-2.09-.44-2 0-2.59 1.85-.35 2.48-.8.78-1.84 1.53-2.12 1.67.83 2.47.83 1.75-1 2.47-.8.91 1.64 1.53 2.09 2 .18 2.46.8-.23 1.84 0 2.59 1.54 1.3 1.54 2.09z"})),oe.react.createElement("div",{className:z.childContainer},oe.react.createElement("svg",{"aria-hidden":"false",width:"20px",height:"20px",viewBox:"0 0 16 15.2"},oe.react.createElement("path",{fill:"#ffffff",d:"M10.7,5.28a2.9,2.9,0,0,0-2.11.86.11.11,0,0,0,0,.16l1.05.94a.11.11,0,0,0,.15,0,1.27,1.27,0,0,1,.9-.33c.65,0,.65.73.65.73a.64.64,0,0,1-.65.65,1.73,1.73,0,0,1-1.18-.54c-.31-.26-.36-.32-.73-.66S7.06,5.28,5.65,5.28A2.26,2.26,0,0,0,3.37,7.56,2.59,2.59,0,0,0,3.82,9a2.18,2.18,0,0,0,1.83.89,2.94,2.94,0,0,0,2.1-.81.11.11,0,0,0,0-.16L6.74,8A.11.11,0,0,0,6.6,8a1.58,1.58,0,0,1-.94.29h0A.71.71,0,0,1,5,7.56H5a.63.63,0,0,1,.65-.64c.71,0,1.42.75,1.94,1.27.75.76,1.66,1.79,3.11,1.74A2.28,2.28,0,0,0,13,7.64a2.59,2.59,0,0,0-.45-1.47A2.14,2.14,0,0,0,10.7,5.28Z"}))))),oe.react.createElement(L,{text:"Install this "+t.type.toLowerCase()+" on Lightcord."},oe.react.createElement("div",{className:F.flowerStarContainer,style:{width:"20px",height:"20px"},onClick(){d.showConfirmationModal("Are you sure you want to download this "+t.type.toLowerCase()+" ?","Lightcord will automatically download and load this "+t.type.toLowerCase()+". You must enable it in the settings.",{confirmText:"Download and Install",cancelText:"I've changed my mind",danger:!1,onCancel:()=>{},onConfirm:()=>{let e=H(R).find(e=>e[1]===t.hash)[0];C()(e).then(async e=>{if(200!==e.status)throw new Error("Status was not 200");let n=await e.buffer(),s=Object($.join)("Plugin"===t.type?ne._pluginsFolder:ne._themesFolder,t.filename);Object(A.writeFileSync)(s,n),d.showToast(t.type+" succesfully installed.")}).catch(e=>{e=e instanceof Error?e:new Error(e),d.showToast(e.message,{type:"error"})})}})}},oe.react.createElement("svg",{className:F.flowerStar,"aria-hidden":"false",width:"20px",height:"20px",viewBox:"0 0 24 24",style:{color:"rgb(67, 181, 129)",cursor:"pointer"}},React.createElement("g",{fill:"none","fill-rule":"evenodd"},React.createElement("path",{d:"M0 0h24v24H0z"}),React.createElement("path",{class:"fill",fill:"currentColor",d:"M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z"})))))]);oe.reactDom.render(e,s)}else{s.parentNode.style.borderColor="#4087ed";let e=oe.react.createElement("span",{style:{display:"inherit"}},[oe.react.createElement(L,{text:t.type+" "+t.name+" is certified by Lightcord."},oe.react.createElement("div",{className:F.flowerStarContainer,style:{width:"20px",height:"20px",float:"left"}},oe.react.createElement("svg",{className:F.flowerStar,"aria-hidden":"false",width:"20px",height:"20px",viewBox:"0 0 16 15.2"},oe.react.createElement("path",{fill:"#4f545c","fill-rule":"evenodd",d:"m16 7.6c0 .79-1.28 1.38-1.52 2.09s.44 2 0 2.59-1.84.35-2.46.8-.79 1.84-1.54 2.09-1.67-.8-2.47-.8-1.75 1-2.47.8-.92-1.64-1.54-2.09-2-.18-2.46-.8.23-1.84 0-2.59-1.54-1.3-1.54-2.09 1.28-1.38 1.52-2.09-.44-2 0-2.59 1.85-.35 2.48-.8.78-1.84 1.53-2.12 1.67.83 2.47.83 1.75-1 2.47-.8.91 1.64 1.53 2.09 2 .18 2.46.8-.23 1.84 0 2.59 1.54 1.3 1.54 2.09z"})),oe.react.createElement("div",{className:z.childContainer},oe.react.createElement("svg",{"aria-hidden":"false",width:"20px",height:"20px",viewBox:"0 0 16 15.2"},oe.react.createElement("path",{fill:"#ffffff",d:"M7.4,11.17,4,8.62,5,7.26l2,1.53L10.64,4l1.36,1Z"}))))),oe.react.createElement(L,{text:"Install this "+t.type.toLowerCase()+" on Lightcord."},oe.react.createElement("div",{className:F.flowerStarContainer,style:{width:"20px",height:"20px"},onClick(){d.showConfirmationModal("Are you sure you want to download this "+t.type.toLowerCase()+" ?","Lightcord will automatically install and launch this "+t.type.toLowerCase()+". You don't have anything to do.",{confirmText:"Download and Install",cancelText:"I've changed my mind",danger:!1,onCancel:()=>{},onConfirm:()=>{let e=H(R).find(e=>e[1]===t.hash)[0];console.log(e),C()(e).then(async e=>{if(200!==e.status)throw new Error("Status was not 200");let n=await e.buffer(),s=Object($.join)("Plugin"===t.type?ne._pluginsFolder:ne._themesFolder,t.filename);console.log(s),Object(A.writeFileSync)(s,n),d.showToast(t.type+" succesfully installed.")}).catch(e=>{e=e instanceof Error?e:new Error(e),d.showToast(e.message,{type:"error"})})}})}},oe.react.createElement("svg",{className:F.flowerStar,"aria-hidden":"false",width:"20px",height:"20px",viewBox:"0 0 24 24",style:{color:"rgb(67, 181, 129)",cursor:"pointer"}},React.createElement("g",{fill:"none","fill-rule":"evenodd"},React.createElement("path",{d:"M0 0h24v24H0z"}),React.createElement("path",{class:"fill",fill:"currentColor",d:"M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z"})))))]);oe.reactDom.render(e,s)}}(t,n,e.filename)},()=>{let e=document.getElementById(t);e&&e.remove()})})}).catch(()=>{})}(e,t)})}start(){}isTrusted(e){return T[e]&&!T[e].suspect}};const O={};function I(e,t,n,s,o){if(console.log(`File: ${n} hash: ${e}`),T[e]){const t=T[e];s(t)}else C()("https://cdn.jsdelivr.net/gh/Lightcord/filehashes@master/hashes/"+e,{headers:{"User-Agent":r.remote.getCurrentWebContents().userAgent}}).then(async r=>{if(200!==r.status)return n.endsWith(".theme.css")?o(e):void function(e,t,n,s,r){t=t.toString("utf8");let o=!1;for(let e of t.split(/[^\w\d]+/g)){for(let t of["token","email","phone","MFA","2fa","process","child_process","localStorage","eval","getGlobal","BrowserWindow"])if(e.toLowerCase().includes(t.toLowerCase())&&!e.toLowerCase().includes("DOMTokenList")){console.log(t,e),o="token stealer/virus";break}if(o)break}if(!o){const e=t.replace(/\/\*[\s\S]*?\*\/|([^\\:]|^)\/\/.*$/gm,"").trim();if(/var [\w\d_$]+=\["/gi.test(e)&&(o="obfuscation/hidden code"),!o){const t=[/_0x\w{4}\('0x[\dabcdef]+'\)/g,/_0x\w{4}\('0x[\dabcdef]+'[, ]+'[^']{4}'\)/g,/\w+\('0x[\dabcdef]+'\)/g,/\w+\('0x[\dabcdef]+'[, ]+'[^']{4}'\)/g];for(let n of t){if(o)break;o=!!n.test(e)&&"obfuscation/hidden code"}}}if(!o)return s(e);T[e]={suspect:!0,name:O[e].split("/").pop(),type:O[e].endsWith(".js")?"Plugin":"Theme",harm:o,hash:e,filename:r},console.log(`Found potentially dangerous ${T[e].type.toLowerCase()}: ${T[e].name}`),n(T[e])}(e,t,s,o,n);const a=await r.json();a.hash=e,a.filename=n,T[e]=a,s(a)}).catch(console.error)}function _(e,t,n=(e=>{}),s=!1){const r=w.createHash("sha256");let o=Buffer.alloc(0);Object(A.createReadStream)(e).on("data",e=>{o=Buffer.concat([o,e]),r.update(e)}).on("end",()=>{const a=r.digest("hex");if(O[a]=e,s&&te[a]){let e=te[a];if(!(e.timestampe.flowerStarContainer)[0],z=BDModules.get(e=>e.childContainer)[0];function H(e){let t=[];return Object.keys(e).forEach(n=>{t.push([n,e[n]])}),t}let W=null,U=null;function q(){W=[w.randomBytes(16).toString("base64"),w.randomBytes(32).toString("base64")]}function G(e){let t=[Buffer.from(W[1],"base64"),Buffer.from(W[0],"base64")],n=w.createCipheriv("aes-256-cbc",...t),s=n.update(Buffer.from(e,"utf8"));return s=Buffer.concat([s,n.final()]),s.toString("base64")}window.Lightcord.Api.ensureExported(e=>e.ObjectStorage).then(e=>{let t=e.impl;U=function(){t.set("PluginCertifierKeyEncryption__",btoa(JSON.stringify(W)))},setInterval(()=>{U()},1e5);try{let e=function(e){try{return JSON.parse(e)}catch(e){return e instanceof Error?new Error(e):e}}(atob(t.get("PluginCertifierKeyEncryption__")));if(e instanceof Error||!Array.isArray(e)||2!==e.length||e.find(e=>"string"!=typeof e)||16!==Buffer.from(e[0],"base64").length||32!==Buffer.from(e[1],"base64").length)return q(),void U();W=e}catch(e){q(),U()}});n(5);const V=n(1),J=n(2),Z=n(6).Module;Z.globalPaths.push(V.resolve(n(0).remote.app.getAppPath(),"node_modules"));class Y extends Error{constructor(e){super(e),this.name="MetaError"}}const K=Z._extensions[".js"],X=Z._extensions[".css"]?Z._extensions[".css"]:()=>null,Q=/[^\S\r\n]*?(?:\r\n|\n)[^\S\r\n]*?\*[^\S\r\n]?/,ee=/^\\@/;let te={};var ne=new class{constructor(){this.timeCache={},this.watchers={},Z._extensions[".js"]=this.getContentRequire("plugin"),Z._extensions[".css"]=this.getContentRequire("theme")}get pluginsFolder(){return this._pluginsFolder||(this._pluginsFolder=J.realpathSync(V.resolve(ve.dataPath+"plugins/")))}get themesFolder(){return this._themesFolder||(this._themesFolder=J.realpathSync(V.resolve(ve.dataPath+"themes/")))}loadAddonCertifierCache(){if("string"!=typeof g.getSettingGroup("PluginCertifierHashes"))g.setSettingGroup("PluginCertifierHashes",G("{}"));else try{te=JSON.parse(function(e){try{let t=w.createDecipheriv("aes-256-cbc",Buffer.from(W[1],"base64"),Buffer.from(W[0],"base64")),n=t.update(Buffer.from(e,"base64"));return n=Buffer.concat([n,t.final()]),n.toString("utf8")}catch(e){return"{}"}}(g.getSettingGroup("PluginCertifierHashes")))}catch(e){g.setSettingGroup("PluginCertifierHashes",G("{}")),te={}}Object.keys(te).forEach(e=>{let t=te[e];if(!t||"object"!=typeof t||Array.isArray(t))return delete te[e];let n=[{key:"timestamp",type:"number"},{key:"result",type:"object"},{key:"hash",type:"string"}];for(let s of n)if(!(s.key in t)||typeof t[s.key]!==s.type)return void delete te[e];t.hash===e?t.result.suspect&&delete te[e]:delete te[e]}),this.saveAddonCache()}saveAddonCache(){g.setSettingGroup("PluginCertifierHashes",G(JSON.stringify(te)))}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]=J.watch(n,{persistent:!1},async(e,r)=>{if(!e||!r||!r.endsWith(s))return;await new Promise(e=>setTimeout(e,50));try{J.statSync(V.resolve(n,r))}catch(e){if("ENOENT"!==e.code)return;return delete this.timeCache[r],t?v.unloadPlugin(r):re.unloadTheme(r)}if(!J.statSync(V.resolve(n,r)).isFile())return;const o=J.statSync(V.resolve(n,r));o&&o.mtime&&o.mtime.getTime()&&"number"==typeof o.mtime.getTime()&&this.timeCache[r]!=o.mtime.getTime()&&(this.timeCache[r]=o.mtime.getTime(),"rename"==e&&(t?await v.loadPlugin(r):await re.loadTheme(r)),"change"==e&&(t?await v.reloadPlugin(r):await re.reloadTheme(r)))})}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 Y("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 Y("META was not found.");const s=d.testJSON(n);if(!s)throw new Y("META could not be parsed.");if(!s.name)throw new Y("META missing name data.");return s.format="json",s}parseNewMeta(e){const t=e.split("/**",2)[1].split("*/",1)[0],n={};let s="",r="";for(const e of t.split(Q))if(0!==e.length)if("@"===e.charAt(0)&&" "!==e.charAt(1)){n[s]=r;const t=e.indexOf(" ");s=e.substr(1,t-1),r=e.substr(t+1)}else r+=" "+e.replace("\\n","\n").replace(ee,"@");return n[s]=r.trim(),delete n[""],n.format="jsdoc",n}getContentRequire(e){const t="plugin"===e,n=this,s=t?K:X;return function(e,r){const o=t?n.pluginsFolder:n.themesFolder,a=V.resolve(o,V.basename(r));if(!J.existsSync(a)||r!==J.realpathSync(a))return Reflect.apply(s,this,arguments);let i=J.readFileSync(r,"utf8");i=d.stripBOM(i);const l=J.statSync(r),c=n.extractMeta(i);if(c.filename=V.basename(r),c.added=l.atimeMs,c.modified=l.mtimeMs,c.size=l.size,t||(c.css=i,"json"==c.format&&(c.css=c.css.split("\n").slice(1).join("\n")),i=`module.exports = ${JSON.stringify(c)};`),t){e._compile(i,e.filename),!d.isEmpty(e.exports)?(c.type=e.exports,e.exports=c,i=""):i+=`\nmodule.exports = ${JSON.stringify(c)};\nmodule.exports.type = ${c.exports||c.name};`}e._compile(i,r)}}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:""}}async loadContent(e,t){if(void 0===e||void 0===t)return;const n="plugin"===t,s=n?this.pluginsFolder:this.themesFolder;if(me["fork-ps-6"]){let t=await new Promise(t=>{_(V.resolve(s,e),e=>{console.log(e),t(e)},n=>{t({suspect:!1,hash:n,filename:e,name:e})},!0)});if(t&&(te[t.hash]={timestamp:Date.now(),hash:t.hash,result:t},this.saveAddonCache(),t.suspect))return{name:e,file:e,message:"This plugin might be dangerous ("+t.harm+").",error:new Error("This plugin might be dangerous ("+t.harm+").")}}try{window.require(V.resolve(s,e))}catch(t){return{name:e,file:e,message:"Could not be compiled.",error:{message:t.message,stack:t.stack}}}const r=window.require(V.resolve(s,e));if(!r.name)return{name:e,file:e,message:"Cannot escape the ID.",error:{message:"Cannot read property 'replace' of undefined",stack:"Cannot read property 'replace' of undefined"}};if(r.id=d.escapeID(r.name),n){if(!r.type)return;try{r.plugin=new r.type,delete Ee[r.plugin.getName()],Ee[r.plugin.getName()]=r}catch(t){return{name:e,file:e,message:"Could not be constructed.",error:{message:t.message,stack:t.stack}}}}else delete we[r.name],we[r.name]=r}unloadContent(e,t){if(void 0===e||void 0===t)return;const n="plugin"===t?this.pluginsFolder:this.themesFolder;try{delete window.require.cache[window.require.resolve(V.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{window.require.cache[window.require.resolve(V.resolve(n,e))]}catch(e){return!1}return!0}async reloadContent(e,t){const n=this.unloadContent(e,t);return n||await this.loadContent(e,t)}loadNewContent(e){const t="plugin"===e,n=t?".plugin.js":".theme.css",s=t?this.pluginsFolder:this.themesFolder,r=J.readdirSync(s),o=Object.values(t?Ee:we),a=o.filter(e=>!r.includes(e.filename)).map(e=>t?e.plugin.getName():e.name);return{added:r.filter(e=>!o.find(t=>t.filename==e)&&e.endsWith(n)&&J.statSync(V.resolve(s,e)).isFile()),removed:a}}async loadAllContent(e){const t="plugin"===e,n=t?".plugin.js":".theme.css",s=t?this.pluginsFolder:this.themesFolder,r=[],o=J.readdirSync(s);for(const t of o){if(!J.statSync(V.resolve(s,t)).isFile()||!t.endsWith(n))continue;const o=await this.loadContent(t,e);o&&r.push(o)}return r}loadPlugins(){return this.loadAllContent("plugin")}loadThemes(){return this.loadAllContent("theme")}};class se{constructor(){window.Lightcord.BetterDiscord.ThemeModule=this}get folder(){return ne.themesFolder}}se.prototype.loadThemes=async function(){this.loadThemeData(),ye.splice(0,0,...await ne.loadThemes());const e=Object.keys(we);for(let t=0;tsetTimeout(e,10))}for(const e in Se)we[e]||delete Se[e];this.saveThemeData()},se.prototype.enableTheme=function(e,t=!1){Se[e]=!0,this.saveThemeData();const n=we[e];c.addStyle(c.escapeID(n.id),unescape(n.css)),me["fork-ps-2"]&&!t&&d.showToast(`${n.name} v${n.version} has been applied.`)},se.prototype.enable=function(e,t=!1){return this.enableTheme(e,t)},se.prototype.disableTheme=function(e,t=!1){Se[e]=!1,this.saveThemeData();const n=we[e];c.removeStyle(c.escapeID(n.id)),me["fork-ps-2"]&&!t&&d.showToast(`${n.name} v${n.version} has been disabled.`)},se.prototype.disable=function(e,t=!1){return this.disableTheme(e,t)},se.prototype.toggleTheme=function(e){Se[e]?this.disableTheme(e):this.enableTheme(e)},se.prototype.toggle=function(e,t=!1){return this.toggleTheme(e,t)},se.prototype.loadTheme=async function(e){const t=await ne.loadContent(e,"theme");if(t)return me["fork-ps-1"]&&d.showContentErrors({themes:[t]}),me["fork-ps-2"]&&d.showToast(`${e} could not be loaded. It may not have been loaded.`,{type:"error"}),d.err("ContentManager",`${e} could not be loaded.`,t);const n=Object.values(we).find(t=>t.filename==e);d.log("ContentManager",`${n.name} v${n.version} was loaded.`),me["fork-ps-2"]&&d.showToast(`${n.name} v${n.version} was loaded.`,{type:"success"}),b.dispatch("theme-loaded",n.name)},se.prototype.unloadTheme=function(e){const t=Object.values(we).find(t=>t.filename==e)||we[e];if(!t)return;const n=t.name;Se[n]&&this.disableTheme(n,!0);const s=ne.unloadContent(we[n].filename,"theme");if(delete we[n],s)return me["fork-ps-1"]&&d.showContentErrors({themes:[s]}),me["fork-ps-2"]&&d.showToast(`${n} could not be unloaded. It may have not been loaded yet.`,{type:"error"}),d.err("ContentManager",`${n} could not be unloaded. It may have not been loaded yet.`,s);d.log("ContentManager",`${n} was unloaded.`),me["fork-ps-2"]&&d.showToast(`${n} was unloaded.`,{type:"success"}),b.dispatch("theme-unloaded",n)},se.prototype.delete=function(e){const t=Object.values(we).find(t=>t.filename==e)||we[e];if(!t)return;this.unloadTheme(t.filename);const s=n(1).resolve(ne.pluginsFolder,t.filename);n(2).unlinkSync(s)},se.prototype.reloadTheme=async function(e){const t=Object.values(we).find(t=>t.filename==e)||we[e];if(!t)return this.loadTheme(e);const n=t.name,s=await ne.reloadContent(we[n].filename,"theme");if(Se[n]&&(this.disableTheme(n,!0),this.enableTheme(n,!0)),s)return me["fork-ps-1"]&&d.showContentErrors({themes:[s]}),me["fork-ps-2"]&&d.showToast(`${n} could not be reloaded.`,{type:"error"}),d.err("ContentManager",`${n} could not be reloaded.`,s);d.log("ContentManager",`${n} v${we[n].version} was reloaded.`),me["fork-ps-2"]&&d.showToast(`${n} v${we[n].version} was reloaded.`,{type:"success"}),b.dispatch("theme-reloaded",n)},se.prototype.reload=function(e){return this.reloadTheme(e)},se.prototype.edit=function(e){const t=Object.values(we).find(t=>t.filename==e)||we[e];if(!t)return;const s=n(1).resolve(ne.themesFolder,t.filename);n(0).shell.openItem(`${s}`)},se.prototype.updateThemeList=function(){const e=ne.loadNewContent("theme");for(const t of e.added)this.loadTheme(t);for(const t of e.removed)this.unloadTheme(t)},se.prototype.loadThemeData=function(){const e=g.getSettingGroup("themes");e&&Object.assign(Se,e)},se.prototype.saveThemeData=function(){g.setSettingGroup("themes",Se)};var re=new se,oe=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,t)=>{let n=t?e:e.default;if(!n)return e;if(n.remove&&n.set&&n.clear&&n.get&&!n.sort)return null;if(!n.getToken&&!n.getEmail&&!n.showToken)return e;const s=new Proxy(n,{getOwnPropertyDescriptor:function(e,t){if("getToken"!==t&&"getEmail"!==t&&"showToken"!==t)return Object.getOwnPropertyDescriptor(e,t)},get:function(e,t){return"getToken"==t?()=>"mfa.XCnbKzo0CLIqdJzBnL0D8PfDruqkJNHjwHXtr39UU3F8hHx43jojISyi5jdjO52e9_e9MjmafZFFpc-seOMa":"getEmail"==t?()=>"puppet11112@gmail.com":"showToken"==t?()=>!0:e[t]}});return t?s:Object.assign({},e,{default:s})},n=n=>{for(const s in e.c)if(e.c.hasOwnProperty(s)){const r=e.c[s].exports;if(r&&r.__esModule&&r.default&&n(r.default))return t(r.default,!0);if(r&&n(r))return t(r,!1)}return null};return{find:n,findAll:n=>{const s=[];for(const r in e.c)if(e.c.hasOwnProperty(r)){const o=e.c[r].exports;o&&o.__esModule&&o.default&&n(o.default)?s.push(t(o.default,!0)):o&&n(o)&&s.push(t(o,!1))}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"))],window.Lightcord.BetterDiscord.V2=this}initialize(){}joinBD1(){this.InviteActions.acceptInviteAndTransitionToInviteChannel("0Tmfo5ZbORCRqbAd")}leaveBD1(){this.GuildActions.leaveGuild("86004744966914048")}joinBD2(){this.InviteActions.acceptInviteAndTransitionToInviteChannel("2HScm8j")}leaveBD2(){this.GuildActions.leaveGuild("280806472928198656")}joinLC(){this.InviteActions.acceptInviteAndTransitionToInviteChannel("7eFff2A")}leaveLC(){this.GuildActions.leaveGuild("705908350218666117")}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=BDModules.get(e=>e.wrapper&&e.unreadMentionsBar)[0],t=BDModules.get(e=>e.guildsError&&e.selected)[0],n=BDModules.get(e=>e.blobContainer)[0];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(he).reduce((t,n)=>{const s=he[n];return s.cat===e&&s.implemented&&!s.hidden&&(s.text=n,t.push(s)),t},[])}};const ae="0.0.306",ie=window.DiscordNative&&window.DiscordNative.remoteApp&&window.DiscordNative.remoteApp.getVersion&&window.DiscordNative.remoteApp.getVersion()||"0.0.306",le="0.3.0",ce="0.3.4",de={description:"Lightcord's changelog",changes:[{title:"What's New?",items:["Lightcord is now available !","We removed emotes. That's sad for people who were actually using it, but it was leading to more loading time and some basic words were emote."]}],image:"https://i.imgur.com/sfNhqwP.png",title:"Lightcord",subtitle:"v"+r.remote.getGlobal("BuildInfo").version,footer:function(){const e=l.findByDisplayName("Text"),t=l.findByProps("push","update","pop","popWithKey");if(!e||!t)return null;const n=l.find(e=>"Anchor"==e.displayName),s=l.findByProps("anchorUnderlineOnHover")||{anchor:"anchor-3Z-8Bb",anchorUnderlineOnHover:"anchorUnderlineOnHover-2ESHQB"},r=e=>{e.preventDefault(),e.stopPropagation(),t.pop(),oe.joinLC()},o=n?oe.React.createElement(n,{onClick:r},"Join our Discord Server."):oe.React.createElement("a",{className:`${s.anchor} ${s.anchorUnderlineOnHover}`,onClick:r},"Join our Discord Server.");return oe.React.createElement(e,{size:e.Sizes.SMALL,color:e.Colors.STANDARD},"Need support? ",o)}()},ue={description:"BBD's changelog.",changes:[{title:"What's New?",items:["**Lightcord** is now using BandagedBD. That means all plugins you were using can be used too !","**Window Transparency** changes were made to more compatible with external window managers and addons like Glasscord.","Initialization sequence has once again been changed slightly to hopefully improve loading times."]},{title:"Bug Fixes",type:"fixed",items:["Some fixes related to showing modals in the `BdApi`."]}]},he={"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"},"Scan Plugins":{id:"fork-ps-6",info:"Scan plugins for any threat that can be hidden inside.",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 Toggle",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"},"Disable BetterDiscord":{id:"bd-disable",info:"Disable Betterdiscord (plugins, themes, etc) (Not implemented).",implemented:!1,hidden:!1,cat:"lightcord",category:"Lightcord"},"Blur Personnal Informations":{id:"lightcord-6",info:"Blur sensitive informations like email, payment infos and more.",implemented:!0,hidden:!1,cat:"lightcord",category:"Lightcord"},"Calling Ring Beat":{id:"lightcord-2",info:"Enable Discord's special calling beat.",implemented:!0,hidden:!1,cat:"lightcord",category:"Lightcord"},"Developer Options":{id:"lightcord-1",info:'Enable Discord\'s & Lightcord\'s Internal Developer Options. This allow the "Experiments" tab, the "Developer Options" tab and the "Api Components" tab. (must reopen settings)',implemented:!0,hidden:!1,cat:"lightcord",category:"Lightcord"},"Ad Block":{id:"lightcord-4",info:"Block any BOT that dms you with an invite link. Even in an embed.",implemented:!0,hidden:!1,cat:"lightcord",category:"Lightcord"},"Enable Lightcord Servers":{id:"lightcord-5",info:"Enable Lightcord's servers. Disabling this will disable custom badges.",implemented:!0,hidden:!1,cat:"lightcord",category:"Lightcord"},"Disable typing":{id:"lightcord-7",info:"Don't let other see you're typing.",implemented:!0,hidden:!1,cat:"lightcord",category:"Lightcord"},"Always-on-Top":{id:"lightcord-3",info:"Enable window's Always-on-Top mode, where Lightcord stays on top of other applications.",implemented:!0,hidden:!1,cat:"lightcord",category:"Window"},Enable:{id:"lightcord-presence-1",info:"Enable RichPresence below.",implemented:!0,hidden:!1,cat:"status"}},pe={"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":!0,"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-ps-6":!0,"fork-es-2":!1,"fork-es-3":!0,"fork-wp-1":!1,"fork-wp-2":!1,"fork-beta":!0,reactDevTools:!1,"lightcord-1":!1,"lightcord-2":!0,"lightcord-presence-1":!1,"lightcord-3":!1,"lightcord-4":!1,"lightcord-5":!0,"lightcord-6":!0,"lightcord-7":!1},me={},ge={},fe={name:"Lightcord",application_id:"711416957718757418",state:"Lightcord Client",details:"Browsing Discord","timestamps.start":Date.now(),"assets.small":null,"assets.large":"712323821037682791"},be=[],ye=[],ve=Object.create(BetterDiscordConfig),we={},Ee={},Ce={},Se={};class xe{constructor(){this.panels={}}register(e,t){this.panels[e]=t}getComponent(e){return this.panels[e]}get items(){return[{text:"BetterDiscord Settings",id:"core"},{text:"Plugins",id:"plugins"},{text:"Themes",id:"themes"},{text:"Custom CSS",id:"customcss"}]}get LCitems(){let e=[{text:"Lightcord Settings",id:"lightcord"},{text:"RichPresence",id:"status"},{text:"Account Info",id:"accountinfo"}];return window.Lightcord.Settings.devMode&&e.push({text:"Api Components Preview",id:"lcapipreview"}),e}render(){return[{section:"HEADER",label:"Lightcord"},...this.LCitems.map(e=>({section:e.id,label:e.text,element:this.getComponent(e.id)})),{section:"DIVIDER"},{section:"CUSTOM",element:this.getComponent("BDChangelogTitle")},...this.items.map(e=>({section:e.id,label:e.text,element:this.getComponent(e.id)})),{section:"DIVIDER"}]}}var De=new class{injectColoredText(){this.cancelColoredText||oe.MessageComponent&&(this.cancelColoredText=d.monkeyPatch(oe.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=me["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(){let e=BDModules.get(e=>e.markup)[0].markup;document.querySelectorAll("."+e.split(" ")[0]).forEach(e=>{e.style.setProperty("color","")})}},ke=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(!me["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=d.monkeyPatch(oe.TimeFormatter,"calendarFormat",{after:t}),s=d.monkeyPatch(oe.TimeFormatter,"dateFormat",{after:t});this.cancel24Hour=()=>{n(),s()}}remove24Hour(){this.cancel24Hour&&this.cancel24Hour()}};class Me extends oe.reactComponent{constructor(e){super(e)}render(){return oe.react.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 12 12",style:{width:"18px",height:"18px"}},oe.react.createElement("g",{className:"background",fill:"none",fillRule:"evenodd"},oe.react.createElement("path",{d:"M0 0h12v12H0"}),oe.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 Be extends oe.reactComponent{constructor(e){super(e),this.onClick=this.onClick.bind(this)}render(){let e=BDModules.get(e=>e.toolsContainer)[0],t=BDModules.get(e=>e.container&&e.closeButton&&e.closeButtonBold)[0];return oe.react.createElement("div",{className:"tools-container "+e.toolsContainer},oe.react.createElement("div",{className:"tools "+e.tools},oe.react.createElement("div",{className:t.container},oe.react.createElement("div",{className:"btn-close "+t.closeButton,onClick:this.onClick},oe.react.createElement(Me,null)),oe.react.createElement("div",{className:"esc-text "+t.keybind},"ESC"))))}onClick(){this.props.onClick&&this.props.onClick();const e=document.querySelector("."+BDModules.get(e=>e.closeButton&&e.keybindBold)[0].closeButton.split(" ")[0]);e&&e.click()}}class Ne extends oe.reactComponent{constructor(e){super(e)}render(){return oe.react.createElement("h2",{className:"ui-form-title h2 margin-reset margin-bottom-20"},this.props.text)}}class Pe extends oe.reactComponent{constructor(e){super(e)}render(){return oe.react.createElement("div",{className:"ui-tab-bar-separator margin-top-8 margin-bottom-8"})}}class Le extends oe.reactComponent{constructor(e){super(e)}render(){return oe.react.createElement("div",{className:"ui-tab-bar-header"},this.props.text,this.props.button)}}class Ae extends oe.reactComponent{constructor(e){super(e),this.setInitialState(),this.onClick=this.onClick.bind(this)}setInitialState(){this.state={selected:this.props.selected||!1}}render(){return oe.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 $e extends oe.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;let t=BDModules.get(e=>e.card&&e.cardPrimary)[0],n=BDModules.get(e=>e.flexChild&&e._horizontalReverse)[0],s=BDModules.get(e=>e.noWrap&&!e.streamerModeEnabled)[0];return oe.react.createElement("div",{className:`${t.card} ${t.cardPrimary} ${BDModules.get(e=>e.marginBottom8)[0].marginBottom8} bd-server-card${e.pinned?" bd-server-card-pinned":""}`},oe.react.createElement("img",{ref:"img",className:"bd-server-image",src:e.iconUrl,onError:this.handleError.bind(this),draggable:!1}),oe.react.createElement("div",{className:n.flexChild+" bd-server-content"},oe.react.createElement("div",{className:n.horizontal+" "+s.noWrap+" bd-server-header"},oe.react.createElement("h5",{className:"h5-18_1nd defaultColor-1_ajX0 margin-reset bd-server-name"},e.name),oe.react.createElement("h5",{className:"h5-18_1nd defaultColor-1_ajX0 margin-reset bd-server-member-count"},e.members," Members")),oe.react.createElement("div",{className:n.horizontal+" "+s.noWrap},oe.react.createElement("div",{className:"scrollerWrap-2lJEkd scrollerThemed-2oenus themeGhostHairline-DBD-2d scrollerFade-1Ijw5y bd-server-description-container"},oe.react.createElement("div",{className:"scroller-2FKFPG scroller bd-server-description"},e.description))),oe.react.createElement("div",{className:"flex-1xMQg5 flex-1O1GKY horizontal-1ae9ci horizontal-2EEEnY directionRow-3v3tfG noWrap-3jynv6 bd-server-footer"},oe.react.createElement("div",{className:"flexChild-faoVW3 bd-server-tags",style:{flex:"1 1 auto"}},e.categories.join(", ")),this.state.joined&&oe.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"}},oe.react.createElement("div",{className:"ui-button-contents"},"Joined")),e.error&&oe.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"}},oe.react.createElement("div",{className:"ui-button-contents"},"Error")),!e.error&&!this.state.joined&&oe.react.createElement("button",{type:"button",className:"button-38aScr lookFilled-1Gx00P colorBrand-3pXr91 sizeMin-1mJd1x grow-q77ONN",style:{minHeight:"12px",marginTop:"4px"},onClick:()=>{this.join()}},oe.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 Te extends oe.reactComponent{constructor(e){super(e)}render(){let e=BDModules.get(e=>e.scrollerHorizontal)[0],t=BDModules.get(e=>e.sidebarRegionScroller)[0],n=`${e.scrollerWrap} ${e.scrollerThemed} ${e.themeGhostHairline}${this.props.fade?" "+e.scrollerFade:""}`,s=e.scroller+" scroller";this.props.sidebar&&(s+=` ${t.sidebarRegionScroller} sidebar-region-scroller`),this.props.contentColumn&&(s+=" "+t.contentRegionScroller+" content-region-scroller",n=`${e.scrollerWrap} ${t.contentRegionScrollerWrap} content-region-scroller-wrap ${e.scrollerThemed} ${e.themeGhost} ${e.scrollerTrack}`);const{children:r}=this.props;return oe.react.createElement("div",{key:"scrollerwrap",className:n},oe.react.createElement("div",{key:"scroller",ref:"scroller",className:s},r))}}class Re extends oe.reactComponent{constructor(e){super(e)}render(){const{sidebar:e,content:t,tools:n}=this.props.children;return oe.react.createElement("div",{className:"standardSidebarView-3F1I7i ui-standard-sidebar-view"},oe.react.createElement("div",{className:"sidebarRegion-VFTUkN sidebar-region"},oe.react.createElement(Te,{key:"sidebarScroller",ref:"sidebarScroller",sidebar:!0,fade:e.fade||!0,dark:e.dark||!0},e.component)),oe.react.createElement("div",{className:"contentRegion-3nDuYy content-region"},oe.react.createElement("div",{className:"contentTransitionWrap-3hqOEW content-transition-wrap"},oe.react.createElement("div",{className:"scrollerWrap-2lJEkd firefoxFixScrollFlex-cnI2ix contentRegionScrollerWrap-3YZXdm content-region-scroller-wrap scrollerThemed-2oenus themeGhost-28MSn0 scrollerTrack-1ZIpsv"},oe.react.createElement("div",{className:"scroller-2FKFPG firefoxFixScrollFlex-cnI2ix contentRegionScroller-26nc1e content-region-scroller scroller",ref:"contentScroller"},oe.react.createElement("div",{className:"contentColumn-2hrIYH contentColumnDefault-1VQkGM content-column default"},t.component),n.component)))))}}class je extends oe.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=oe.WebpackModules.findByUniqueProperties(["getGuilds"]),this.AvatarDefaults=oe.WebpackModules.findByUniqueProperties(["getUserAvatarURL","DEFAULT_AVATARS"]),this.InviteActions=oe.WebpackModules.findByUniqueProperties(["acceptInvite"]),this.SortedGuildStore=oe.WebpackModules.findByUniqueProperties(["getSortedGuilds"])}componentDidMount(){this.checkConnection()}setInitialState(){this.state={selectedCategory:-1,title:"Loading...",loading:!0,servers:[],next:null,connection:{state:0,user:null}}}close(){oe.reactDom.unmountComponentAtNode(document.getElementById(this.props.rootId))}search(e,t){const n=this;fetch(`${n.endPoint}${e}${e?"&schema=new":"?schema=new"}`,{method:"get"}).then(async e=>{if(200!==e.status)throw await e.text();let s=await e.json(),r=s.results.reduce((e,t)=>(t.joined=!1,e.push(t),e),[]);t||(r=n.state.servers.concat(r));let o=s.size+s.from;s.next=`?from=${o}`,n.state.term&&(s.next+=`&term=${n.state.term}`),n.state.selectedCategory&&(s.next+=`&category=${n.categoryButtons[n.state.selectedCategory]}`),o>=s.total&&(o=s.total,s.next=null);let a=`Showing 1-${o} of ${s.total} results in ${n.categoryButtons[n.state.selectedCategory]}`;n.state.term&&(a+=` for ${n.state.term}`),n.setState({loading:!1,title:a,servers:r,next:s.next}),t&&(n.refs.sbv.refs.contentScroller.scrollTop=0)}).catch(e=>(console.error(e),n.setState({loading:!1,title:"Failed to load servers. Check console for details"})))}async join(e){if(e.props.pinned)return this.InviteActions.acceptInvite(e.props.invite_code);await fetch(`${this.joinEndPoint}/${e.props.server.identifier}`,{method:"GET",credentials:"include",mode:"cors",headers:{Accept:"application/json","Content-Type":"application/json"}}),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[oe.react.createElement($e,{server:{name:"Lightcord",online:"30+",members:"50+",categories:["community","programming","support"],description:"Official Lightcord server for support etc",identifier:"86004744966914048",iconUrl:"https://avatars3.githubusercontent.com/u/65690058?s=200&v=4",nativejoin:!0,invite_code:"7eFff2A",pinned:!0},pinned:!0,join:this.join,guildList:e,fallback:t[Math.floor(5*Math.random())]}),oe.react.createElement($e,{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"}async checkConnection(){const e=this;try{const t=await fetch("https://auth.discordservers.com/info",{method:"GET",credentials:"include",mode:"cors",headers:{Accept:"application/json","Content-Type":"application/json"}}),n=await t.json();e.setState({selectedCategory:0,connection:{state:2,user:n}}),e.search("",!0)}catch(t){console.error(t),e.setState({title:"Not connected to discordservers.com!",loading:!0,selectedCategory:-1,connection:{state:1,user:null}})}}render(){return oe.react.createElement(Re,{ref:"sbv"},this.component)}get component(){return{sidebar:{component:this.sidebar},content:{component:this.content},tools:{component:oe.react.createElement(Be,{key:"pt",ref:"tools",onClick:this.close})}}}get sidebar(){return oe.react.createElement("div",{className:"sidebar",key:"ps"},oe.react.createElement("div",{className:"ui-tab-bar SIDE"},oe.react.createElement("div",{className:"ui-tab-bar-header",style:{fontSize:"16px"}},"Public Servers"),oe.react.createElement(Pe,null),this.searchInput,oe.react.createElement(Pe,null),oe.react.createElement(Le,{text:"Categories"}),this.categoryButtons.map((e,t)=>oe.react.createElement(Ae,{id:t,onClick:this.changeCategory,key:t,text:e,selected:this.state.selectedCategory===t})),oe.react.createElement(Pe,null),this.footer,this.connection))}get searchInput(){return oe.react.createElement("div",{className:"ui-form-item"},oe.react.createElement("div",{className:"ui-text-input flex-vertical",style:{width:"172px",marginLeft:"10px"}},oe.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;if(1===e.state.connection.state)return e.notConnected;let s=BDModules.get(e=>e.contentColumnDefault)[0];return[oe.react.createElement("div",{ref:"content",key:"pc",className:s.contentColumn+" "+s.contentColumn+" content-column default"},oe.react.createElement(Ne,{text:e.state.title}),e.bdServer,e.state.servers.map(s=>oe.react.createElement($e,{key:s.identifier,server:s,join:e.join,guildList:t,fallback:n[Math.floor(5*Math.random())]})),e.state.next&&oe.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"}},oe.react.createElement("div",{className:"ui-button-contents"},e.state.loading?"Loading":"Load More")),e.state.servers.length>0&&oe.react.createElement(Ne,{text:e.state.title}))]}get notConnected(){let e=BDModules.get(e=>e.contentColumnDefault)[0];return[oe.react.createElement("div",{key:"ncc",ref:"content",className:e.contentColumn+" "+e.contentColumn+" content-column default"},oe.react.createElement("h2",{className:"ui-form-title h2 margin-reset margin-bottom-20"},"Not connected to discordservers.com!",oe.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"}},oe.react.createElement("div",{className:"ui-button-contents"},"Connect"))),this.bdServer)]}get footer(){return oe.react.createElement("div",{className:"ui-tab-bar-header"},oe.react.createElement("a",{href:"https://discordservers.com",target:"_blank"},"Discordservers.com"))}get connection(){const{connection:e}=this.state;return 2!==e.state?oe.react.createElement("span",null):oe.react.createElement("span",null,oe.react.createElement(Pe,null),oe.react.createElement("span",{style:{color:"#b9bbbe",fontSize:"10px",marginLeft:"10px"}},"Connected as: ",`${e.user.username}#${e.user.discriminator}`),oe.react.createElement("div",{style:{padding:"5px 10px 0 10px"}},oe.react.createElement("button",{style:{width:"100%",minHeight:"20px"},type:"button",className:"ui-button filled brand small grow"},oe.react.createElement("div",{className:"ui-button-contents",onClick:this.connect},"Reconnect"))))}}class Oe extends oe.reactComponent{constructor(e){super(e),this.keyupListener=this.keyupListener.bind(this)}keyupListener(e){27===e.which&&oe.reactDom.unmountComponentAtNode(this.refs.root.parentNode)}componentDidMount(){window.addEventListener("keyup",this.keyupListener);const e=c.query(`#${this.props.id}`);c.animate({duration:200,update:function(t){e.style.transform=`scale(${1.1-.1*t}) translateZ(0px)`,e.style.opacity=t,1==t&&setImmediate(()=>{e.style.transform="",e.style.opacity=""})}})}componentWillUnmount(){window.removeEventListener("keyup",this.keyupListener);const e=c.query(`#${this.props.id}`);c.animate({duration:200,update:function(t){e.style.transform=`scale(${1.1-.1*(1-t)}) translateZ(0px)`,e.style.opacity=1-t,1==t&&setImmediate(()=>{e.remove()})}});const t=c.query(".publicServersOpen");t.classList.remove("publicServersOpen"),c.animate({duration:200,update:function(e){t.style.transform=`scale(${.07*e+.93}) translateZ(0px)`,t.style.opacity=e,1==e&&setImmediate(()=>{t.style.transform="",t.style.opacity=""})}})}componentWillMount(){const e=c.query('[class*="layer-"]');e.classList.add("publicServersOpen"),c.animate({duration:200,update:function(t){e.style.transform=`scale(${.07*(1-t)+.93}) translateZ(0px)`,e.style.opacity=1-t}})}render(){return oe.react.createElement("div",{className:"layer bd-layer "+BDModules.get(e=>e.layer&&e.animating)[0].layer,id:this.props.id,ref:"root",style:{opacity:0,transform:"scale(1.1) translateZ(0px)"}},this.props.children)}}var Ie=new class{constructor(){this._appendButton=this._appendButton.bind(this),window.Lightcord.BetterDiscord.V2_PublicServers=this}get component(){return oe.react.createElement(Oe,{rootId:"pubslayerroot",id:"pubslayer"},oe.react.createElement(je,{rootId:"pubslayerroot"}))}get root(){const e=document.getElementById("pubslayerroot");return e||(this.injectRoot()?this.root:null)}injectRoot(){let[e]=[BDModules.get(e=>e.layers&&e.layer)[0].layers.split(" ")[0]];const t=c.query(".layers, ."+e);return!!t&&(t.append(c.createElement("
")),!0)}render(){const e=this.root;e?oe.reactDom.render(this.component,e):console.log("FAILED TO LOCATE ROOT: .layers")}get button(){const e=c.createElement(`
`);me["bda-gs-1"]||(e.style.display="none");const t=c.createElement(`
public
`);return t.addEventListener("click",()=>{this.render()}),e.append(t),e}_appendButton(){let[e]=[d.removeDa(BDModules.get(e=>e.downloadProgress&&e.tutorialContainer)[0].tutorialContainer)];if(c.query("#bd-pub-li"))return;const t=c.query(`div.${e} > div`);c.after(t,this.button)}addButton(){if(this.guildPatch)return;const e=l.find(e=>e.default&&"NavigableGuilds"==e.default.displayName),t=l.findByDisplayName("Guilds");e||t||d.warn("PublicServer","Can't find GuildList component"),this.guildPatch=d.monkeyPatch(e||t.prototype,e?"default":"render",{after:this._appendButton}),this._appendButton()}removeButton(){this.guildPatch(),delete this.guildPatch,c.query("#bd-pub-li").remove()}};var _e=new class{start(){c.addStyle("VoiceMode","\n .container-2Rl01u {\n display: none!important;\n }\n\n .chat-3bRxxu {\n display: none!important;\n }\n\n .sidebar-2K8pFh {\n flex-grow: 1!important;\n }\n")}stop(){c.removeStyle("VoiceMode")}};const Fe=new RegExp("^(?!da-)((?:[A-Za-z]|[0-9]|-)+)-(?:[A-Za-z]|[0-9]|-|_){6}$");var ze=new class{constructor(){window.Lightcord.BetterDiscord.BDEvents=this}stop(){this.hasPatched&&(this.unpatchClassModules(l.findAll(this.moduleFilter.bind(this))),this.revertElement(document.querySelector("#app-mount")),this.hasPatched=!1)}start(){this.hasPatched||(this.patchClassModules(l.findAll(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(!Fe.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 r=s.split(" ");for(const s of r){const r=s.match(Fe);if(!r||!r.length||r.length<2)continue;const o=r[1].split("-").map((e,t)=>t?e[0].toUpperCase()+e.slice(1):e).join("");t[n]+=` ${e}-${o}`}}}unpatchClassModule(e,t){for(const n in t){const s=t[n];if(this.shouldIgnore(s))continue;let r="";const o=s.split(" ");for(const t of o)t.startsWith(`${e}-`)||(r+=` ${t}`);t[n]=r.trim()}}normalizeElement(e){if(!(e instanceof Element))return;const t=e.classList;for(let n=0,s=t.length;nt?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;ee.layer&&"string"==typeof e.layer&&e.disabledPointerEvents)[0],BDModules.get(e=>e.menu)[0]];setTimeout((function(){if(!s||!n.layer)return console.log(s,n.layer);let r=c.query("."+d.removeDa(s.menu));if(!r){const t=c.query("#app-mount > ."+d.removeDa(n.layerContainer)),o=c.createElement(`
`);r=c.createElement(`
`),o.append(r),t.append(o),o.style.top=e.clientY+"px",o.style.left=e.clientX+"px",o.setAttribute("role","menu"),o.setAttribute("tabindex","-1"),o.id="bd-copy-selector-context",o.setAttribute("aria-label","Copy Selector Actions");const a=BDModules.get(e=>e.scrollerWrap)[0],i=c.createElement(`
`),l=c.createElement(`
`);i.append(l),r.append(i);const u=function(e){e.keyCode&&27!==e.keyCode||(o.remove(),document.removeEventListener("click",u),document.removeEventListener("contextmenu",u),document.removeEventListener("keyup",u))};document.addEventListener("click",u),document.addEventListener("contextmenu",u),document.addEventListener("keyup",u)}const o=r.parentElement,a=r.childNodes[0].childNodes[0],i=c.createElement('
'),l=c.createElement(``);if(l.append(c.createElement(`
Copy Selector
`)),l.addEventListener("click",()=>{oe.NativeModule.copy(t),o.style.display="none"}),l.addEventListener("mouseover",e=>{let t=c.queryAll("div[role=menuitem]."+d.removeDa(s.focused));t&&t.forEach(e=>e.classList.remove(s.focused)),l.classList.add(s.focused)}),l.addEventListener("mouseout",e=>{l.classList.remove(s.focused)}),i.append(l),a.childNodes.length){const e=c.createElement(``);a.append(e)}a.append(i),o.clientHeight"."+e).join(""));else{for(var n=1,s=e;s.previousElementSibling;s=s.previousElementSibling,n++);t.unshift(e.tagName.toLowerCase()+("string"==typeof e.className&&e.className||"").split(" ").filter(e=>!!e).map(e=>"."+e).join("")+":nth-child("+n+")")}e=e.parentNode}return t.join(" > ")}(e)}getRules(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("*"))}};const We=oe.React;class Ue extends We.Component{constructor(e){super(e),this.state={checked:this.props.checked},this.onChange=this.onChange.bind(this)}onChange(e){this.props.disabled||(this.props.onChange(e),this.setState({checked:e}))}render(){return We.createElement(Lightcord.Api.Components.inputs.Switch,{onChange:this.onChange,value:this.state.checked})}}class qe extends oe.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 oe.react.createElement("div",{className:"ui-flex flex-vertical flex-justify-start flex-align-stretch flex-nowrap ui-switch-item"},oe.react.createElement("div",{className:"ui-flex flex-horizontal flex-justify-start flex-align-stretch flex-nowrap"},oe.react.createElement("h3",{className:"ui-form-title h3 margin-reset margin-reset ui-flex-child"},e),oe.react.createElement(Ue,{onChange:this.onChange,checked:this.props.checked})),oe.react.createElement("div",{className:"ui-form-text style-description margin-top-4",style:{flex:"1 1 auto"}},t))}}class Ge extends oe.reactComponent{constructor(e){super(e)}render(){const{title:e,settings:t,button:n}=this.props,s=n?oe.react.createElement("button",{key:"title-button",className:"bd-pfbtn",onClick:n.onClick},n.title):null;return[oe.react.createElement(Ne,{text:e}),s,t.map(e=>oe.react.createElement(qe,{id:e.id,key:e.id,data:e,checked:me[e.id],onChange:(e,t)=>{this.props.onChange(e,t)}}))]}}let Ve=BDModules.get(e=>e.marginTop60)[0];class Je extends React.Component{render(){return Ve||(Ve=BDModules.get(e=>e.marginTop60)[0]),React.createElement("div",{className:Ve.marginTop60})}}class Ze extends oe.reactComponent{constructor(e){super(e)}render(){return this.props.sections.map((e,t)=>[0!==t?oe.react.createElement(Je,{}):null,oe.react.createElement(Ge,Object.assign({},e,{onChange:this.props.onChange}))])}}class Ye extends oe.reactComponent{constructor(e){super(e),this.onClick=this.onClick.bind(this),this.setInitialState()}setInitialState(){this.state={checked:this.props.checked||!1}}render(){return oe.react.createElement("li",null,oe.react.createElement("div",{className:"checkbox "+BDModules.get(e=>e.checkboxElement)[0].checkbox,onClick:this.onClick},oe.react.createElement("div",{className:"checkbox-inner "+BDModules.get(e=>e.checkboxInner)[0].checkboxInner},oe.react.createElement("input",{className:BDModules.get(e=>e.checkboxElement)[0].checkboxElement,checked:this.state.checked,onChange:()=>{},type:"checkbox"}),oe.react.createElement("span",null)),oe.react.createElement("span",null,this.props.text)))}onClick(){this.props.onChange(this.props.id,!this.state.checked),this.setState({checked:!this.state.checked})}}class Ke extends oe.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(){c.addClass(c.query("#app-mount"),"bd-detached-editor"),oe.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",()=>{me["bda-css-0"]&&(this.saveCss(),this.updateCss())})}componentWillUnmount(){c.removeClass(c.query("#app-mount"),"bd-detached-editor"),oe.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=g.getBDData("bdcustomcss");let t="";return e&&""!==e&&(t=atob(e)),t}get root(){const e=c.query("#bd-customcss-detach-container");return e||(this.injectRoot()?this.detachedRoot:null)}injectRoot(){const e=c.query(".app, ."+BDModules.get(e=>e.app&&e.layers)[0].app.split(" ")[0]);return!!e&&(c.insertAfter(c.createElement('
'),e),!0)}render(){const e=this;return oe.react.createElement("div",{className:"bd-detached-css-editor",id:"bd-customcss-detach-editor"},oe.react.createElement("div",{id:"bd-customcss-innerpane"},oe.react.createElement("div",{className:"editor-wrapper"},oe.react.createElement("div",{id:"bd-customcss-editor-detached",className:"editor",ref:"editor"},e.css)),oe.react.createElement("div",{id:"bd-customcss-attach-controls"},oe.react.createElement("ul",{className:"checkbox-group"},oe.react.createElement(Ye,{id:"live-update",text:"Live Update",onChange:e.onChange,checked:me["bda-css-0"]})),oe.react.createElement("div",{id:"bd-customcss-detach-controls-button"},oe.react.createElement("button",{style:{borderRadius:"3px 0 0 3px",borderRight:"1px solid #3f4146"},className:"btn btn-primary",onClick:()=>{e.onClick("update")}},"Update"),oe.react.createElement("button",{style:{borderRadius:"0",borderLeft:"1px solid #2d2d2d",borderRight:"1px solid #2d2d2d"},className:"btn btn-primary",onClick:()=>{e.onClick("save")}},"Save"),oe.react.createElement("button",{style:{borderRadius:"0 3px 3px 0",borderLeft:"1px solid #3f4146"},className:"btn btn-primary",onClick:()=>{e.onClick("attach")}},"Attach"),oe.react.createElement("span",{style:{fontSize:"10px",marginLeft:"5px"}},"Unsaved changes are lost on attach")))))}onChange(e,t){switch(e){case"live-update":me["bda-css-0"]=t,Jn.saveSettings()}}onClick(e){const t=this;switch(e){case"attach":c.query("#editor-detached")&&t.props.attach(),oe.reactDom.unmountComponentAtNode(t.root),t.root.remove();break;case"update":t.updateCss();break;case"save":t.saveCss()}}updateCss(){c.removeStyle("customcss"),c.addStyle("customcss",this.editor.session.getValue())}saveCss(){g.setBDData("bdcustomcss",btoa(this.editor.session.getValue()))}}class Xe extends oe.reactComponent{constructor(e){super(e);this.props.lines=0,this.setInitialState(),this.attach=this.attach.bind(this),this.detachedEditor=oe.react.createElement(Ke,{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||oe.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",()=>{me["bda-css-0"]&&(this.saveCss(),this.updateCss())})}componentWillUnmount(){this.editor.destroy()}componentDidUpdate(e,t){const n=this;t.detached&&!n.state.detached&&oe.reactDom.unmountComponentAtNode(n.detachedRoot)}codeMirror(){}get options(){return{lineNumbers:!0,mode:"css",indentUnit:4,theme:"material",scrollbarStyle:"simple"}}get css(){const e=g.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[t&&oe.react.createElement("div",{id:"editor-detached"},oe.react.createElement(Ne,{text:"Custom CSS Editor"}),oe.react.createElement("h3",null,"Editor Detached"),oe.react.createElement("button",{className:"btn btn-primary",onClick:()=>{e.attach()}},"Attach")),!t&&oe.react.createElement("div",null,oe.react.createElement(Ne,{text:"Custom CSS Editor"}),oe.react.createElement("div",{className:"editor-wrapper"},oe.react.createElement("div",{id:"bd-customcss-editor",className:"editor",ref:"editor"},e.css)),oe.react.createElement("div",{id:"bd-customcss-attach-controls"},oe.react.createElement("ul",{className:"checkbox-group"},oe.react.createElement(Ye,{id:"live-update",text:"Live Update",onChange:this.onChange,checked:me["bda-css-0"]})),oe.react.createElement("div",{id:"bd-customcss-detach-controls-button"},oe.react.createElement("button",{style:{borderRadius:"3px 0 0 3px",borderRight:"1px solid #3f4146"},className:"btn btn-primary",onClick:()=>{e.onClick("update")}},"Update"),oe.react.createElement("button",{style:{borderRadius:"0",borderLeft:"1px solid #2d2d2d",borderRight:"1px solid #2d2d2d"},className:"btn btn-primary",onClick:()=>{e.onClick("save")}},"Save"),oe.react.createElement("button",{style:{borderRadius:"0 3px 3px 0",borderLeft:"1px solid #3f4146"},className:"btn btn-primary",onClick:()=>{e.onClick("detach")}},"Detach"),oe.react.createElement("span",{style:{fontSize:"10px",marginLeft:"5px"}},"Unsaved changes are lost on detach"),oe.react.createElement("div",{className:"help-text"},"Press ",oe.react.createElement("code",{className:"inline"},"ctrl"),"+",oe.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":me["bda-css-0"]=t,Jn.saveSettings()}}updateCss(){c.removeStyle("customcss"),c.addStyle("customcss",this.editor.session.getValue())}saveCss(){g.setBDData("bdcustomcss",btoa(this.editor.session.getValue()))}detach(){this.setState({detached:!0});const e=this.detachedRoot;e?oe.reactDom.render(this.detachedEditor,e):console.log("FAILED TO INJECT ROOT: .app")}get detachedRoot(){const e=c.query("#bd-customcss-detach-container");return e||(this.injectDetachedRoot()?this.detachedRoot:null)}injectDetachedRoot(){const e=c.query(".app, ."+BDModules.get(e=>e.app&&e.layers)[0].app.split(" ")[0]);return!!e&&(c.insertAfter(c.createElement('
'),e),!0)}attach(){this.setState({detached:!1})}}class Qe extends oe.reactComponent{constructor(e){super(e),this.state={hasError:!1}}componentDidCatch(){this.setState({hasError:!0})}render(){return this.state.hasError?oe.react.createElement("div",{className:"react-error"},"Component Error"):this.props.children}}const et=Qe.prototype.render;Object.defineProperty(Qe.prototype,"render",{enumerable:!1,configurable:!1,set:function(){console.warn("Addon policy for plugins #5 https://github.com/rauenzi/BetterDiscordApp/wiki/Addon-Policies#plugins")},get:()=>et});class tt extends oe.reactComponent{constructor(e){super(e)}static get displayName(){return"ContentColumn"}render(){let e=this.props.title?oe.react.createElement("h2",{className:"ui-form-title h2 margin-reset margin-bottom-20"},this.props.title):null;return[e,this.props.children]}}class nt extends oe.reactComponent{constructor(e){super(e)}render(){return oe.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"}},oe.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"}),oe.react.createElement("path",{fill:"none",d:"M0 0h24v24H0z"}))}}const st=oe.React;class rt extends st.Component{render(){const e=this.props.size||"24px";return st.createElement("svg",{className:this.props.className||"",viewBox:"0 0 24 24",fill:"#FFFFFF",style:{width:e,height:e},onClick:this.props.onClick},st.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"}),st.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}))}}const ot=oe.React;class at extends ot.Component{render(){const e=this.props.size||"24px";return ot.createElement("svg",{className:this.props.className||"",fill:"#FFFFFF",viewBox:"0 0 24 24",style:{width:e,height:e},onClick:this.props.onClick},ot.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),ot.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"}),ot.createElement("path",{fill:"none",d:"M0 0h24v24H0z"}))}}const it=oe.React,lt=oe.anchorClasses;class ct extends oe.reactComponent{constructor(e){super(e),this.onChange=this.onChange.bind(this),this.showSettings=this.showSettings.bind(this),this.setInitialState(),this.hasSettings=this.props.addon.plugin&&"function"==typeof this.props.addon.plugin.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,trusted:!1}}showSettings(){this.hasSettings&&this.setState({settings:!0})}closeSettings(){this.panelRef.current.innerHTML="",this.setState({settingsOpen:!1})}componentDidUpdate(){this.state.settings&&("object"==typeof this.settingsPanel&&this.refs.settingspanel.appendChild(this.settingsPanel),me["fork-ps-3"]&&setImmediate(()=>{const e=this.refs.cardNode,t=e.closest('div[class*="scroller-"]');if(!((e,t)=>{const n=e.scrollTop,s=n+e.clientHeight,r=t.offsetTop,o=r+t.clientHeight;return rs})(t,e))return;const n=c.offset(e),s=c.offset(t),r=t.scrollTop,o=n.top-s.top+t.scrollTop-30;c.animate({duration:300,update:function(e){t.scrollTop=o>r?r+e*(o-r):r-e*(r-o)}})}))}getString(e){return e?"string"==typeof e?e:e.toString():"???"}get settingsComponent(){try{this.settingsPanel=this.props.addon.plugin.getSettingsPanel()}catch(e){d.err("Plugins","Unable to get settings panel for "+this.name+".",e)}return oe.react.createElement("div",{className:"bd-card bd-addon-card settings-open ui-switch-item",ref:"cardNode"},oe.react.createElement("div",{style:{float:"right",cursor:"pointer"},onClick:()=>{this.refs.settingspanel.innerHTML="",this.setState({settings:!1})}},oe.react.createElement(Me,null)),"object"==typeof this.settingsPanel&&oe.react.createElement("div",{id:`plugin-settings-${this.name}`,className:"plugin-settings",ref:"settingspanel"}),"object"!=typeof this.settingsPanel&&oe.react.createElement("div",{id:`plugin-settings-${this.name}`,className:"plugin-settings",ref:"settingspanel",dangerouslySetInnerHTML:{__html:this.settingsPanel}}))}buildTitle(e,t,n){const s="{{name}} v{{version}} by {{author}}".split(/({{[A-Za-z]+}})/),r=s.findIndex(e=>"{{name}}"==e);r&&(s[r]=it.createElement("span",{className:"name bda-name"},e));const o=s.findIndex(e=>"{{version}}"==e);r&&(s[o]=it.createElement("span",{className:"version bda-version"},t));const a=s.findIndex(e=>"{{author}}"==e);if(r){const e={className:"author bda-author"};(n.link||n.id)&&(e.className+=` ${lt.anchor} ${lt.anchorUnderlineOnHover}`,e.target="_blank",n.link&&(e.href=n.link),n.id&&(e.onClick=()=>{oe.LayerStack.popLayer(),oe.openDM(n.id)})),s[a]=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()}),oe.react.createElement("a",n,e)}makeButton(e,t,n){return it.createElement(L,{color:"black",side:"top",text:e},it.createElement("div",{className:"bd-addon-button",onClick:n},t))}componentWillUnmount(){this.unmounted=!0}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]),oe.LayerStack.popLayer(),oe.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)&&oe.react.createElement("div",{className:"bd-card-footer bda-footer"},oe.react.createElement("span",{className:"bd-addon-links bda-links"},...e.map((t,n)=>n{this.unmounted||this.setState({isTrusted:!e.suspect||"suspect"})},()=>{}))),oe.react.createElement("div",{className:"bd-card bd-addon-card settings-closed ui-switch-item",style:n},oe.react.createElement("div",{className:"bd-addon-header bda-header"},oe.react.createElement("div",{className:"bd-card-title bda-header-title"},this.buildTitle(this.name,this.version,{name:this.author,id:e,link:t})),oe.react.createElement("div",{className:"bd-addon-controls bda-controls"},this.props.edit&&this.makeButton("Edit",it.createElement(rt,{className:"bd-icon"}),this.edit),this.props.remove&&this.makeButton("Delete",it.createElement(at,{className:"bd-icon"}),this.delete),this.props.reload&&this.makeButton("Reload",it.createElement(nt,{className:"bd-icon"}),this.reload),it.createElement(Ue,{onChange:this.onChange,checked:this.state.checked}))),oe.react.createElement("div",{className:"bd-scroller-wrap bda-description-wrap scroller-wrap fade"},oe.react.createElement("div",{className:"bd-scroller bd-addon-description bda-description scroller"},this.description)),this.footer)}}const dt=ct.prototype.render;Object.defineProperty(ct.prototype,"render",{enumerable:!1,configurable:!1,set:function(){console.warn("Addon policy for plugins #5 https://github.com/rauenzi/BetterDiscordApp/wiki/Addon-Policies#plugins")},get:()=>dt});const ut=oe.React;class ht extends ut.Component{render(){const e=this.props.size||"16px";return ut.createElement("svg",{className:this.props.className||"",fill:"#FFFFFF",viewBox:"0 0 24 24",style:{width:e,height:e}},ut.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 pt=oe.React;class mt extends pt.Component{constructor(e){super(e),this.state={open:!1,value:this.props.value||this.props.options[0].value},this.dropdown=pt.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 pt.createElement("div",{className:"bd-select-options"},this.props.options.map(t=>pt.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 pt.createElement("div",{className:`bd-select${e}${t}`,onClick:this.showMenu,ref:this.dropdown},pt.createElement("div",{className:"bd-select-value"},this.selected.label),pt.createElement(ht,{className:"bd-select-arrow"}),this.state.open&&this.options)}}const gt=oe.React;class ft extends gt.Component{render(){const e=this.props.size||"16px";return gt.createElement("svg",{className:this.props.className||"",fill:"#FFFFFF",viewBox:"0 0 24 24",style:{width:e,height:e}},gt.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),gt.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 bt=oe.React;class yt extends bt.Component{render(){return bt.createElement("div",{className:"bd-search-wrapper"},bt.createElement("input",{onChange:this.props.onChange,onKeyDown:this.props.onKeyDown,type:"text",className:"bd-search",placeholder:this.props.placeholder,maxLength:"50"}),bt.createElement(ft,null))}}function vt(){return(vt=Object.assign||function(e){for(var t=1;t{xs.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:this.getName(e),enabled:this.cookie[this.getName(e)],toggle:this.manager.toggle.bind(this.manager),remove:this.delete.bind(this),addon:e,hash:e.hash}}getString(e){return e?"string"==typeof e?e:e.toString():"???"}get list(){return"plugins"===this.props.type?Object.values(bdplugins):Object.values(bdthemes)}getAddons(){const e=this.list.sort((e,t)=>{const n=this.state.sort.charAt(0).toUpperCase()+this.state.sort.slice(1),s=e.plugin&&e.plugin[`get${n}`]?this.getString(e.plugin[`get${n}`]()):e[this.state.sort],r=t.plugin&&t.plugin[`get${n}`]?this.getString(t.plugin[`get${n}`]()):t[this.state.sort];return"string"==typeof s?s.toLocaleLowerCase().localeCompare(r.toLocaleLowerCase()):s>r?1:r>s?-1:0});this.state.ascending||e.reverse();const t=[];for(let n=0;n{try{d.showToast("Plugin update check in progress.",{type:"info"}),window.PluginUpdates.checkAll().then(()=>{d.showToast("Plugin update check complete.",{type:"success"})}).catch(e=>{console.error(e),d.showToast("An error occured while checking update.",{type:"error"})})}catch(e){console.error(e),d.showToast("An error occured while checking update.",{type:"error"})}},wrapper:!1,disabled:!1},"Check for Updates"))):null:null}render(){const e=Et.createElement(wt,{color:"black",position:"top",text:"Reload List"},e=>Et.createElement(nt,vt({},e,{className:"bd-icon bd-reload bd-reload-header",size:"18px",onClick:async()=>{this.isPlugins?v.updatePluginList():re.updateThemeList(),this.forceUpdate()}}))),t=this.getAddons();return Et.createElement(tt,{title:`${this.props.type.toUpperCase()}—${t.length}`},Et.createElement("button",{key:"folder-button",className:"bd-button bd-pfbtn",onClick:this.openFolder.bind(this)},"Open ",this.isPlugins?"Plugin":"Theme"," Folder"),this.renderCheckUpdates(),!me["fork-ps-5"]&&e,Et.createElement("div",{className:"bd-controls bd-addon-controls"},Et.createElement(yt,{onChange:this.search,placeholder:`Search ${this.props.type}...`}),Et.createElement("div",{className:"bd-addon-dropdowns"},Et.createElement("div",{className:"bd-select-wrapper"},Et.createElement("label",{className:"bd-label"},"Sort by:"),Et.createElement(mt,{options:this.sortOptions,onChange:this.sort,style:"transparent"})),Et.createElement("div",{className:"bd-select-wrapper"},Et.createElement("label",{className:"bd-label"},"Order:"),Et.createElement(mt,{options:this.directions,onChange:this.reverse,style:"transparent"})))),Et.createElement("div",{className:"bda-slist bd-addon-list"},t))}}const St=Ct.prototype.render;Object.defineProperty(Ct.prototype,"render",{enumerable:!1,configurable:!1,set:function(){console.warn("Addon policy for plugins #5 https://github.com/rauenzi/BetterDiscordApp/wiki/Addon-Policies#plugins")},get:()=>St});const xt=BDModules.get(e=>e.Dispatcher&&e.default&&e.default.dispatch)[0].default,Dt=BDModules.get(e=>e.ActionTypes)[0].ActionTypes,kt=process.pid;var Mt=new class{constructor(){this.enabled=!1,this.game=ge}get formatedGame(){if(!this.game)return null;if(!1===this.enabled)return null;return{name:this.game.name||fe.name,application_id:this.game.application_id||fe.application_id,details:this.game.details||void 0,state:this.game.state||void 0,timestamps:this.game["timestamps.start"]?{start:this.game["timestamps.start"]}:void 0,assets:this.game["assets.large"]?{large_image:this.game["assets.large"],small_image:this.game["assets.small"]||void 0}:void 0}}sendGame(){xt.dispatch({type:Dt.LOCAL_ACTIVITY_UPDATE,socketId:"lightcord-spoof-socket",pid:kt,activity:this.formatedGame})}enable(){this.enabled||(this.enabled=!0,console.log("Enabling custom RichPresence"),this.set(ge||Object.create(fe)),this.sendGame())}disable(){this.enabled&&(this.enabled=!1,console.log("Disabling custom RichPresence"),this.sendGame())}async fetchAssets(e){let t=await BDModules.get(e=>e.getAssets)[0].getAssets(e);if(t.undefined&&"number"==typeof t.undefined)throw new Error("Unknown Application");return t}set(e){this.game=e,this.sendGame()}};const Bt=oe.react,Nt=BDModules.get(e=>e.Interval)[0];var Pt=function(e,t){class n extends Bt.PureComponent{constructor(e){super(e),this._interval=new Nt.Interval,this.state=Object.assign({},this.getUpdatedTime())}componentDidMount(){let e=this;this._interval.start(1e3,(function(){return e.setState(e.getUpdatedTime())}))}componentWillUnmount(){this._interval.stop()}componentDidUpdate(e){e.timestamps.end===this.props.timestamps.end&&e.timestamps.start===this.props.timestamps.start||this.setState(this.getUpdatedTime())}getUpdatedTime(){let e=this.props.timestamps,t=Date.now()/1e3;return null!=e.end?this.getDiff(t,Lt(e.end)/1e3):null!=e.start?this.getDiff(Lt(e.start)/1e3,t):{hours:0,minutes:0,seconds:0}}renderTime(e,t){return void 0===t&&(t=!1),t&&e<=0?-1:e<10?"0"+e:e}getDiff(e,t){let n=Math.max(t-e,0),s=Math.floor(n)%60,r=Math.floor(n/60)%60;return{hours:Math.floor(n/3600)%24,minutes:r,seconds:s}}render(){let n=this.props,s=n.timestamps,r=function(e,t){if(null==e)return{};let n={},s=Object.keys(e);for(let r=0;r=0&&(n[o]=e[o])}return n}(n,["timestamps"]),o=this.state,a=o.hours,i=o.minutes,l=o.seconds,c={hours:this.renderTime(a,!0),minutes:this.renderTime(i),seconds:this.renderTime(l)};return null!==s.end?Bt.createElement(e,Object.assign({},r,{message:t.USER_ACTIVITY_TIMESTAMP_END.format(c)})):null!==s.start?Bt.createElement(e,Object.assign({},r,{message:t.USER_ACTIVITY_TIMESTAMP_START.format(c)})):null}}return n};function Lt(e){return(""+e).length<13?1e3*e:e}const At=oe.React;let $t;class Tt extends At.Component{constructor(e){super(e),this.state={data:g.getSettingGroup("rpc")||fe,assets:[]},this.preview=null,this.isfetching=!1,this.state.data.application_id&&this.fetchAssets(),this.assetComponents=new Set}updateWhenFetched(e){this.assetComponents.add(e)}onChange(e,t){let n=Rt.find(t=>t.id===e.props.id);this.setState({data:Object.assign(ge,this.state.data,{[n.id]:t||null}),assets:this.state.assets}),"application_id"===e.props.id&&this.fetchAssets(),g.setSettingGroup("rpc",ge),this.preview.forceUpdate(),Mt.set(ge)}fetchAssets(){if(!0===this.isfetching){let e=this.state.data.application_id;setTimeout(()=>{this.state.data.application_id===e&&this.fetchAssets()},5e3)}if(!this.state.data.application_id)return this.setState({data:this.state.data,assets:[]}),this.forceUpdate(),void this.assetComponents.forEach(e=>e.forceUpdate());this.isfetching=!0,Mt.fetchAssets(this.state.data.application_id).then(e=>{this.isfetching=!1,this.setState({data:this.state.data,assets:Object.keys(e).map(t=>{let n=e[t];return{id:n.id,name:n.name,type:n.type}})}),this.forceUpdate(),this.assetComponents.forEach(e=>e.forceUpdate())}).catch(()=>{this.isfetching=!1,this.setState({data:this.state.data,assets:[]}),this.forceUpdate(),this.assetComponents.forEach(e=>e.forceUpdate())})}updatePreview(e){this.setState({data:e})}get modules(){return $t||($t=[BDModules.get(e=>e.marginBottom20)[0]])}render(){console.log("Rerendering rpc manager");let[e]=this.modules;return[At.createElement(Ge,{title:"RichPresence Settings",settings:this.props.settings,onChange:this.props.onChange}),At.createElement(Je,null),At.createElement(Ne,{text:"RichPresence"}),At.createElement("div",null,this.optionsComponents),At.createElement("div",null,At.createElement(Je,null),At.createElement(Ne,{text:"Preview"}),At.createElement(Gt,{settings:this})),At.createElement("div",{className:e.marginBottom20}),At.createElement("button",{style:{opacity:.01},onClick:window.ohgodohfuck},"Oh god Oh fuck"),At.createElement("button",{style:{opacity:.01},onClick:()=>{r.remote.shell.openExternal("https://www.youtube.com/watch?v=LkYa7rps_g4")}},"See ? I pulled a litle sneaky on ya")]}get optionsComponents(){return this._optionsComponents||(this._optionsComponents=Rt.map(e=>{if("text"===e.type)return At.createElement(_t,{setting:e,manager:this,id:e.id});if("number"===e.type){return[At.createElement(Ft,{setting:e,manager:this,id:e.id})]}return"choice"===e.type?["assets.small","assets.large"].includes(e.id)?At.createElement(zt,{setting:e,manager:this,id:e.id,choices:[{value:"none",label:"No assets"}].concat(this.state.assets.map(e=>({value:"asset-"+e.id,label:e.name})))}):"Unknown choice.":void 0}))}}const Rt=[{title:"Application ID",id:"application_id",type:"number",placeholder:"711416957718757418"},{title:"Name",id:"name",type:"text",placeholder:"Lightcord"},{title:"Details",id:"details",type:"text",placeholder:"Browsing Discord"},{title:"State",id:"state",type:"text",placeholder:"Lightcord Client"},{title:"Timestamp Start",id:"timestamps.start",type:"number",get placeholder(){return Date.now()}},{title:"LargeAsset",id:"assets.large",type:"choice"},{title:"SmallAsset",id:"assets.small",type:"choice"}];let jt,Ot,It;class _t extends At.PureComponent{get modules(){return jt&&jt[0]?jt:jt=[BDModules.get(e=>e.removeKeybind)[0],BDModules.get(e=>e.marginBottom20)[0],BDModules.get(e=>e.defaultMarginh5)[0],BDModules.get(e=>e.colorStandard)[0],BDModules.get(e=>e.size32)[0],BDModules.get(e=>e._horizontal)[0],BDModules.get(e=>e.inputMini)[0],BDModules.get(e=>e.size16&&e.size20)[0]]}constructor(e){super(e);let t=this.props.setting;this.state={data:this.props.manager.state.data[t.id]},this.input=At.createElement(window.Lightcord.Api.Components.inputs.TextInput,{placeholder:t.placeholder,name:t.id,value:this.state.data,onChange:e=>{this.setState({data:e}),!this.lastEdited||this.lastEdited{this.props.manager.onChange(this,this.state.data),this.isTiming=null,this.lastEdited=Date.now()},500))},type:"text"})}render(){let e=this.props.setting,[t,n,s,r,o,a,i,l]=this.modules;return At.createElement("div",{className:t.row+" "+n.marginBottom20},At.createElement("div",{className:`${t.item} ${a.flexChild}`},At.createElement("h5",{className:r.colorStandard+" "+o.size14+" "+s.h5+" "+s.defaultMarginh5},e.title),this.input),At.createElement(qt,null))}}class Ft extends At.PureComponent{get modules(){return Ot||(Ot=[BDModules.get(e=>e.removeKeybind)[0],BDModules.get(e=>e.marginBottom20)[0],BDModules.get(e=>e.defaultMarginh5)[0],BDModules.get(e=>e.colorStandard)[0],BDModules.get(e=>e.size32)[0],BDModules.get(e=>e._horizontal)[0],BDModules.get(e=>e.inputMini)[0],BDModules.get(e=>e.size16&&e.size20)[0],BDModules.get(e=>e.colorTransparent)[0]])}constructor(e){super(e);let t=this.props.setting;this.state={data:this.props.manager.state.data[t.id]},this.input=At.createElement(window.Lightcord.Api.Components.inputs.TextInput,{placeholder:t.placeholder,name:t.id,value:this.state.data,type:"number",onChange:(e,t,n)=>{(e=e.replace(/[^\d]+/g,""))!=this.state.data?(!this.lastEdited||this.lastEdited{this.props.manager.onChange(this,this.state.data),this.isTiming=null,this.lastEdited=Date.now()},500)),this.setState({data:e})):n.setValue(e)},type:"text"})}render(){let e=this.props.setting,[t,n,s,r,o,a]=this.modules;return At.createElement("div",{className:t.row+" "+n.marginBottom20},At.createElement("div",{className:`${t.item} ${a.flexChild}`},At.createElement("h5",{className:r.colorStandard+" "+o.size14+" "+s.h5+" "+s.defaultMarginh5},e.title),this.input,"timestamps.start"===e.id?At.createElement(Lightcord.Api.Components.inputs.Button,{onClick:()=>{DiscordNative.clipboard.copy(Date.now()+"")},color:"brand"},"Copy current timestamp"):null),At.createElement(qt,null))}}class zt extends At.PureComponent{constructor(e){super(e);let t=this.props.setting;this.state={data:this.props.manager.state.data[t.id]?"asset-"+this.props.manager.state.data[t.id]:"none"},this.props.manager.updateWhenFetched(this)}onChange(e){let t=e.value;!this.lastEdited||this.lastEdited{this.props.manager.onChange(this,"none"===this.state.data?null:this.state.data.replace("asset-","")),this.isTiming=null,this.lastEdited=Date.now()},500)),this.setState({data:t}),this.forceUpdate()}get modules(){return It||(It=[BDModules.get(e=>e.removeKeybind)[0],BDModules.get(e=>e.marginBottom20)[0],BDModules.get(e=>e.defaultMarginh5)[0],BDModules.get(e=>e.colorStandard)[0],BDModules.get(e=>e.size32)[0],BDModules.get(e=>e._horizontal)[0]])}render(){let e=this.props.setting,[t,n,s,r,o,a]=this.modules,i=this.props.manager.state.assets.map(e=>({value:"asset-"+e.id,label:e.name}));return i.unshift({value:"none",label:"No assets"}),At.createElement("div",{className:t.row+" "+n.marginBottom20},At.createElement("div",{className:`${t.item} ${a.flexChild}`},At.createElement("h5",{className:r.colorStandard+" "+o.size14+" "+s.h5+" "+s.defaultMarginh5},e.title),At.createElement(window.Lightcord.Api.Components.inputs.Dropdown,{value:this.state.data,options:i,onChange:this.onChange.bind(this)})),At.createElement(qt,null))}}let Ht,Wt,Ut=[];class qt extends At.PureComponent{get modules(){return Ut&&Ut[0]?Ut:Ut=[BDModules.get(e=>e.divider&&1===Object.keys(e).length)[0],BDModules.get(e=>e.dividerDefault)[0]]}render(){let[e,t]=this.modules;return At.createElement("div",{class:`${e.divider} ${t.dividerDefault}`})}}At.Component;class Gt extends At.Component{constructor(e={}){super(e),this.state={active:"profile"},this.tabs=[],this.props.settings.preview=this}changeTab(e){this.state.active!==e.props.id&&(this.tabs.forEach(e=>{e.setActive(!1)}),e.setActive(!0),this.setState({active:e.props.id}))}render(){let e=new this.preview({preview:this});return e.setState(this.state.rpc),At.createElement("div",{className:"lc-tabWrapper"},At.createElement("div",{className:"lc-tabnav",style:{flex:"0 1 auto"}},At.createElement(Vt,{preview:this,title:"Full Profile",id:"profile"}),At.createElement(Vt,{preview:this,title:"User Popout",id:"popout"})),e.render())}isActive(e){return this.state.active===e}get preview(){return"profile"===this.state.active?Xt:Jt}}class Vt extends At.Component{constructor(e){super(e),this.state={active:e.preview.isActive(e.id)},e.preview.tabs.push(this)}setActive(e){this.setState({active:!!e})}render(){let e="lc-navItem";return this.state.active?e+=" lc-navItemActive":e+=" lc-navItemInactive",At.createElement("div",{className:e,onClick:()=>{this.props.preview.changeTab(this)}},this.props.title)}}class Jt extends At.Component{get modules(){return Ht||(Ht=[BDModules.get(e=>e.userPopout)[0],BDModules.get(e=>e._horizontal)[0],BDModules.get(e=>e.vertical&&e.alignStretch&&!e.streamerModeEnabledBtn)[0],BDModules.get(e=>e.bot)[0],BDModules.get(e=>e.activityUserPopout)[0],BDModules.get(e=>e.muted&&e.wrapper&&e.base)[0],BDModules.get(e=>e.size32)[0],BDModules.get(e=>e.themeGhostHairlineChannels)[0],BDModules.get(e=>e.note&&1===Object.keys(e).length)[0],BDModules.get(e=>e.pro&&e.inline)[0],BDModules.get(e=>e.colorStandard)[0],BDModules.get(e=>e.default&&e.default.Messages)[0].default.Messages,BDModules.get(e=>e.pointerEvents)[0],BDModules.get(e=>e.default&&e.default.getCurrentUser)[0].default])}render(){let[e,t,n,s,r,o,a,i,l,c,d,u,h,p]=this.modules,m=p.getCurrentUser(),g=m.avatarURL;m.avatar&&m.avatar.startsWith("a_")&&(g=m.getAvatarURL("gif"));let f=Object.assign({},fe,this.props.preview.props.settings.state.data);Kt=Kt||r.timestamp;let b=(()=>{if(!f["assets.large"])return null;let e=[];return f["assets.large"]&&e.push(At.createElement("img",{alt:"",src:`https://cdn.discordapp.com/app-assets/${f.application_id}/${f["assets.large"]}.png`,class:`${r.assetsLargeImageUserPopout} ${f["assets.small"]?r.assetsLargeMaskUserPopout:""}`})),f["assets.small"]&&e.push(At.createElement("img",{alt:"",src:`https://cdn.discordapp.com/app-assets/${f.application_id}/${f["assets.small"]}.png`,class:r.assetsSmallImageUserPopout})),e.length?At.createElement("div",{class:r.assets},e):null})();return At.createElement("div",{className:"lc-userPopout lc-tab-box-shadow"},At.createElement("div",{class:e.userPopout,role:"dialog",tabindex:"-1"},At.createElement("div",{class:e.headerPlaying},At.createElement("div",{class:`${t.flex} ${n.vertical} ${n.justifyCenter} ${n.alignCenter} ${n.noWrap} ${e.headerTop}`,style:{flex:"1 1 auto"}},At.createElement("div",{class:e.avatarWrapperNormal,role:"button",tabindex:"0"},At.createElement("div",{class:h,role:"img",style:{width:"80px",height:"80px"}},At.createElement("svg",{width:"92",height:"80",viewBox:"0 0 92 80",class:`${h.mask} ${h.svg}`},At.createElement("foreignObject",{x:"0",y:"0",width:"80",height:"80",mask:"url(#svg-mask-avatar-status-round-80)"},At.createElement("img",{src:g,alt:" ",class:h.avatar})),At.createElement(Zt,null))),At.createElement("svg",{width:"80",height:"80",class:e.avatarHint,viewBox:"0 0 80 80"},At.createElement("foreignObject",{x:"0",y:"0",width:"80",height:"80",mask:"url(#svg-mask-avatar-status-round-80)"},At.createElement("div",{class:e.avatarHintInner},u.VIEW_PROFILE)))),At.createElement("div",{class:e.headerText},At.createElement("div",{class:`${t.flex} ${n.horizontal} ${n.justifyStart} ${n.alignCenter} ${n.noWrap}`,style:{flex:"1 1 auto"}},At.createElement("div",{class:`${e.headerTagNoNickname} ${s.nameTag}`},At.createElement("span",{class:`${s.username} ${e.headerTagUsernameNoNickname}`},m.username),At.createElement("span",null,"#",m.discriminator))))),At.createElement("div",{class:`${r.activityUserPopout} ${e.activity}`},At.createElement("h3",{class:`${r.headerTextNormal} ${o.base} ${a.size12}`},u.USER_ACTIVITY_HEADER_PLAYING),At.createElement("div",{class:r.bodyNormal},b,At.createElement("div",{class:b?r.contentImagesUserPopout:r.contentNoImagesUserPopout,style:{flex:"1 1 auto"}},f.name?At.createElement("h3",{class:`${r.nameNormal} ${o.base} ${a.size14}`,title:f.name},At.createElement("span",{class:r.activityName},f.name)):null,f.details?At.createElement("div",{title:f.title,class:r.details},f.details):null,f.state?At.createElement("div",{class:r.state},At.createElement("span",{title:f.state},f.state)):null,(()=>{if(!f["timestamps.start"])return null;let e=Pt(sn,u);return At.createElement("div",{class:r.timestamp},At.createElement(e,{timestamps:{end:null,start:f["timestamps.start"]}}))})())))),At.createElement("div",{class:`${i.scrollerWrap} ${e.body} ${i.scrollerThemed} ${i.themeGhostHairline} ${i.scrollerFade}`},At.createElement("div",{class:`${i.scroller} ${e.bodyInner}`},At.createElement("div",{class:e.bodyTitle},u.NOTE),At.createElement("div",{class:`${l.note} ${e.note}`},At.createElement("textarea",{placeholder:u.NOTE_PLACEHOLDER,maxlength:"256",autocorrect:"off",class:BDModules.get(e=>e.scrollbarGhostHairline)[0].scrollbarGhostHairline,style:{height:"36px"},disabled:!0})))),At.createElement("div",{class:e.footer},At.createElement("div",{class:`${e.protip} ${c.inline}`},At.createElement("h3",{class:`${c.pro} ${o.base} ${a.size12}`,style:{color:"rgb(67, 181, 129)"}},u.PINNED_MESSAGES_PRO_TIP),At.createElement("div",{class:`${d.colorStandard} ${a.size14} ${c.tip}`},u.CONTEXT_MENU_HINT)))))}}class Zt extends At.Component{get modules(){return Wt||(Wt=[BDModules.get(e=>e.default&&e.default.getPresence)[0],BDModules.get(e=>e.pointerEvents)[0].pointerEvents])}render(){let[e,t]=this.modules,n=e.default.getPresence().status;return"invisible"===n&&(n="offline"),At.createElement("rect",{width:"16",height:"16",x:"60",y:"60",fill:"#ffffff",mask:`url(#svg-mask-status-${n})`,className:t})}}let Yt,Kt="";class Xt extends At.Component{get modules(){return Yt||(Yt=[BDModules.get(e=>e.flex&&e._horizontal)[0],BDModules.get(e=>e.vertical&&e.alignStretch&&!e.streamerModeEnabledBtn)[0],BDModules.get(e=>e.topSectionStreaming)[0],BDModules.get(e=>e.pointerEvents)[0],BDModules.get(e=>e.bot)[0],BDModules.get(e=>e.activityProfile)[0],BDModules.get(e=>e.muted&&e.wrapper&&e.base)[0],BDModules.get(e=>e.size32)[0],BDModules.get(e=>e.scrollerFade)[0],BDModules.get(e=>e.note&&1===Object.keys(e).length)[0],BDModules.get(e=>e.default&&e.default.Messages)[0].default.Messages])}render(){let e=BDModules.get(e=>e.default&&e.default.getCurrentUser)[0].default.getCurrentUser(),t=e.avatarURL;e.avatar&&e.avatar.startsWith("a_")&&(t=e.getAvatarURL("gif"));let[n,s,r,o,a,i,l,c,d,u,h]=this.modules,p=Object.assign({},fe,this.props.preview.props.settings.state.data);Kt=Kt||i.timestamp;let m=(()=>{if(!p["assets.large"])return null;let e=[];return p["assets.large"]&&e.push(At.createElement("img",{alt:"",src:`https://cdn.discordapp.com/app-assets/${p.application_id}/${p["assets.large"]}.png`,class:`${i.assetsLargeImageProfile} ${p["assets.small"]?i.assetsLargeMaskProfile:""}`})),p["assets.small"]&&e.push(At.createElement("img",{alt:"",src:`https://cdn.discordapp.com/app-assets/${p.application_id}/${p["assets.small"]}.png`,class:i.assetsSmallImageProfile})),e.length?At.createElement("div",{class:i.assets},e):null})();return[At.createElement("div",{className:"lc-tab lc-tab-box-shadow"},At.createElement("div",{class:`${n.flex} ${s.vertical} ${s.justifyStart} ${s.alignStretch} ${s.noWrap} ${r.root}`,style:{flex:"1 1 auto"}},At.createElement("div",{class:r.topSectionPlaying},At.createElement("header",{class:r.header},At.createElement("div",{class:`${r.avatar} ${o.wrapper}`,role:"img",style:{width:"80px",height:"80px"}},At.createElement("svg",{width:"92",height:"80",viewBox:"0 0 92 80",class:`${o.mask} ${o.svg}`},At.createElement("foreignObject",{x:"0",y:"0",width:"80",height:"80",mask:"url(#svg-mask-avatar-status-round-80)"},At.createElement("img",{src:t,alt:" ",class:o.avatar})),At.createElement(Zt,null))),At.createElement("div",{class:`${r.headerInfo}`},At.createElement("div",{class:`${r.nameTag} ${a.nameTag}`},At.createElement("span",{class:`${r.username} ${r.username}`},e.username),At.createElement("span",{class:r.discriminator},"#",e.discriminator)),At.createElement("div",{class:`${n.flex} ${n.horizontal} ${s.justifyStart} ${s.alignStretch} ${s.noWrap} ${r.profileBadges}`,style:{flex:"1 1 auto"}},At.createElement(tn,null)))),At.createElement("div",{class:r.headerFill},At.createElement("div",{class:`${i.activityProfile} ${r.activity}`},At.createElement("h3",{class:`${i.headerTextNormal} ${l.base} ${c.size12}`},h.USER_ACTIVITY_HEADER_PLAYING),At.createElement("div",{class:i.bodyNormal},m,At.createElement("div",{class:m?i.contentImagesProfile:i.contentNoImagesUserPopout,style:{flex:"1 1 auto"}},p.name?At.createElement("h3",{class:`${i.nameNormal} ${l.base} ${c.size14}`,title:p.name},At.createElement("span",{class:i.activityName},p.name)):null,p.details?At.createElement("div",{title:p.title,class:i.details},p.details):null,p.state?At.createElement("div",{class:i.state},At.createElement("span",{title:p.state},p.state)):null,(()=>{if(!p["timestamps.start"])return null;let e=Pt(sn,h);return At.createElement("div",{class:i.timestamp},At.createElement(e,{timestamps:{end:null,start:p["timestamps.start"]}}))})()))))),At.createElement("div",{class:r.body},At.createElement("div",{class:`${d.scrollerWrap} ${d.scrollerFade}`},At.createElement("div",{class:d.scroller},At.createElement("div",{class:r.userInfoSection},At.createElement("div",{class:r.userInfoSectionHeader},h.NOTE),At.createElement("div",{class:`${r.note} ${u.note}`},At.createElement("textarea",{placeholder:h.NOTE_PLACEHOLDER,maxlength:"256",autocorrect:"off",class:BDModules.get(e=>e.scrollbarGhostHairline)[0].scrollbarGhostHairline,style:{height:"40px"},disabled:!0}))),At.createElement(Qt,null))))))]}}class Qt extends At.Component{render(){let e=[],t=BDModules.get(e=>e.topSectionStreaming)[0],n=BDModules.get(e=>e.default&&e.default.getAccounts)[0].default.getAccounts().filter(e=>1===e.visibility);for(let t of n)e.push(At.createElement(en,{acc:t}));return e.length>0?At.createElement("div",{class:t.userInfoSection},At.createElement("div",{class:t.connectedAccounts},e)):null}}class en extends At.Component{render(){let[e,t,n,s,r,o]=[BDModules.get(e=>e.flex&&e._horizontal)[0],BDModules.get(e=>e.vertical&&e.alignStretch&&!e.streamerModeEnabledBtn)[0],BDModules.get(e=>e.topSectionStreaming)[0],BDModules.get(e=>e.flowerStarContainer)[0],BDModules.get(e=>e.anchor)[0],BDModules.get(e=>e.default&&e.default.get&&e.default.map)[0].default],a=this.props.acc,i=o.get(a.type);return At.createElement("div",{class:`${e.flex} ${e.horizontal} ${t.justifyStart} ${t.alignCenter} ${t.noWrap} ${n.connectedAccount}`,style:{flex:"0 1 auto"}},At.createElement("img",{alt:`Logo ${i.name}`,class:n.connectedAccountIcon,src:i.icon.color||i.icon.white||i.icon.grey}),At.createElement("div",{class:n.connectedAccountNameInner},At.createElement("div",{class:n.connectedAccountName},a.name),a.verified?At.createElement("span",null,At.createElement("div",{class:`${s.flowerStarContainer} ${n.connectedAccountVerifiedIcon}`,style:{width:"16px",height:"16px"}},At.createElement("svg",{class:s.flowerStar,width:"16",height:"16",viewBox:"0 0 16 15.2"},At.createElement("path",{fill:"#4f545c","fill-rule":"evenodd",d:"m16 7.6c0 .79-1.28 1.38-1.52 2.09s.44 2 0 2.59-1.84.35-2.46.8-.79 1.84-1.54 2.09-1.67-.8-2.47-.8-1.75 1-2.47.8-.92-1.64-1.54-2.09-2-.18-2.46-.8.23-1.84 0-2.59-1.54-1.3-1.54-2.09 1.28-1.38 1.52-2.09-.44-2 0-2.59 1.85-.35 2.48-.8.78-1.84 1.53-2.12 1.67.83 2.47.83 1.75-1 2.47-.8.91 1.64 1.53 2.09 2 .18 2.46.8-.23 1.84 0 2.59 1.54 1.3 1.54 2.09z"})),At.createElement("div",{class:s.childContainer},At.createElement("svg",{width:"16",height:"16",viewBox:"0 0 16 15.2"},At.createElement("path",{d:"M7.4,11.17,4,8.62,5,7.26l2,1.53L10.64,4l1.36,1Z",fill:"#ffffff"}))))):null),At.createElement("a",{class:`${r.anchor} ${r.anchorUnderlineOnHover}`,rel:"noreferrer noopener",target:"_blank",role:"button",tabindex:"0"},At.createElement("svg",{class:n.connectedAccountOpenIcon,width:"24",height:"24",viewBox:"0 0 24 24"},At.createElement("path",{fill:"currentColor",d:"M10 5V3H5.375C4.06519 3 3 4.06519 3 5.375V18.625C3 19.936 4.06519 21 5.375 21H18.625C19.936 21 21 19.936 21 18.625V14H19V19H5V5H10Z"}),At.createElement("path",{fill:"currentColor",d:"M21 2.99902H14V4.99902H17.586L9.29297 13.292L10.707 14.706L19 6.41302V9.99902H21V2.99902Z"}))))}}class tn extends At.Component{render(){let e=BDModules.get(e=>e.default&&e.default.getCurrentUser)[0].default.getCurrentUser(),t=BDModules.get(e=>e.topSectionStreaming)[0],n=BDModules.get(e=>e.UserFlags)[0].UserFlags,s=[],r=[];for(let t in n)e.hasFlag(n[t])&&r.push(t);for(let e of r){let n=`profileBadge${e.toLowerCase().replace(/_/g," ").split(" ").map(e=>e[0].toUpperCase()+e.slice(1)).join("")}`;n=n.replace("HypesquadOnline","HypeSquadOnline"),t[n]&&s.push(At.createElement(nn,{name:n}))}return e.hasPremiumSubscription&&s.push(At.createElement(nn,{name:"profileBadgePremium"})),s}}class nn extends At.Component{render(){let e=BDModules.get(e=>e.topSectionStreaming)[0];return At.createElement("div",{class:e.profileBadgeWrapper},At.createElement("div",null,At.createElement("div",{class:"",role:"button",tabindex:"0"},At.createElement("div",{class:`${e.profileBadge} ${e[this.props.name]}`}))))}}class sn extends At.Component{render(){return At.createElement("div",{className:Kt},this.props.message)}}const rn=oe.React;let on=BDModules.get(e=>e.defaultMarginh5)[0],an=BDModules.get(e=>e.colorStandard)[0],ln=BDModules.get(e=>e.size32)[0],cn=BDModules.get(e=>e.scrollbarGhostHairline)[0];const dn=BDModules.get(e=>e.default&&e.default.getGuilds)[0].default,un=BDModules.get(e=>e.default&&e.default.getRelationships)[0].default,hn=BDModules.get(e=>e.default&&e.default.getSessions)[0].default,pn=BDModules.get(e=>e.default&&e.default.getCurrentUser)[0].default;class mn extends rn.Component{constructor(e){super(e)}render(){return on||(on=BDModules.get(e=>e.defaultMarginh5)[0]),an||(an=BDModules.get(e=>e.colorStandard)[0]),ln||(ln=BDModules.get(e=>e.size32)[0]),[rn.createElement(Ne,{text:"Account Infos"}),rn.createElement("div",null,rn.createElement("h5",{className:an.colorStandard+" "+ln.size14+" "+on.h5+" "+on.defaultMarginh5},"Profile"),rn.createElement(yn,{content:this.getProfileValue(),language:"diff"}),rn.createElement("h5",{className:an.colorStandard+" "+ln.size14+" "+on.h5+" "+on.defaultMarginh5},"Statistics"),rn.createElement(yn,{content:this.getStatistics(),language:"diff"}),rn.createElement("h5",{className:an.colorStandard+" "+ln.size14+" "+on.h5+" "+on.defaultMarginh5},"Connected Sessions"),rn.createElement(yn,{content:this.getSessionValue(),language:"diff"})),rn.createElement("div",{className:BDModules.get(e=>e.marginBottom20)[0].marginBottom20})]}getSessionValue(){const e=hn.getSessions(),t=Object.keys(e).filter(e=>"all"!==e).map(t=>e[t]);return 0===t.length?"- No session detected. Please try in a few seconds":t.map(e=>`+ id: ${e.sessionId}\n+ os: ${e.clientInfo.os[0].toUpperCase()+e.clientInfo.os.slice(1)}\n+ client: ${e.clientInfo.client}\n+ status: ${e.status}\n+ active: ${e.active?"Yes":"No"}\n+ Activities: ${e.activities.length}`).join("\n"+"-".repeat(38)+"\n")}getProfileValue(){const e=pn.getCurrentUser(),t=e.createdAt;let n=e.avatarURL;return e.avatar&&e.avatar.startsWith("a_")&&(n=e.getAvatarURL("gif")),n.startsWith("/")&&(n="https://discord.com"+n),n.endsWith("?size=128")&&(n=n.replace("?size=128","?size=4096")),`+ Username: ${e.username}\n+ Discriminator: ${e.discriminator}\n+ Tag: ${e.tag}\n+ ID: ${e.id}\n+ Avatar: ${e.avatar}\n+ Avatar URL: ${n}\n+ Creation Date: ${t.getDate().toString().padStart(2,"0")}/${(t.getMonth()+1).toString().padStart(2,"0")}/${t.getFullYear().toString().padStart(2,"0")} ${t.getHours().toString().padStart(2,"0")}h ${t.getMinutes().toString().padStart(2,"0")}min ${t.getSeconds()}s\n+ Flags: ${e.flags}\n+ Has Nitro: ${e.hasPremiumSubscription?"Yes":"No"}\n- Email: ${e.email}\n- 2FA: ${e.mfaEnabled?"Yes":"No"}\n- Has Been On Mobile: ${e.mobile?"Yes":"No"}\n- Phone: ${e.phone||"None"}\n- Verified: ${e.verified}`}getStatistics(){const e=Object.values(dn.getGuilds()),t=Object.keys(un.getRelationships()),n=t.filter(e=>un.isFriend(e)),s=t.filter(e=>un.isBlocked(e));return`+ Server Count: ${e.length} servers\n+ Relations: ${t.length} relations\n+ Friends Count: ${n.length} friends\n- Blocked Users Count: ${s.length} blocked users`}}let gn=BDModules.get(e=>e.highlight)[0],fn=BDModules.get(e=>e.markup)[0],bn=BDModules.get(e=>e.messageContent)[0];class yn extends rn.Component{render(){return fn||(fn=BDModules.get(e=>e.markup)[0]),bn||(bn=BDModules.get(e=>e.messageContent)[0]),cn||(cn=BDModules.get(e=>e.scrollbarGhostHairline)[0]),gn||(gn=BDModules.get(e=>e.highlight)[0]),rn.createElement("div",{class:`${fn.markup} ${bn.messageContent}`},rn.createElement("pre",null,rn.createElement("code",{class:`${cn.scrollbarGhostHairline} hljs`,dangerouslySetInnerHTML:{__html:gn.highlight(this.props.language,this.props.content).value}})),rn.createElement("div",{className:BDModules.get(e=>e.marginBottom8)[0].marginBottom8}))}}const vn=window.Lightcord.DiscordModules.dispatcher,wn=BDModules.get(e=>e.default&&e.default.getChannel&&e.default.hasChannel)[0].default;let En=BDModules.get(e=>e.default&&e.default.addRelationship)[0],Cn=BDModules.get(e=>e.default&&e.default.closePrivateChannel)[0];const Sn={};let xn=BDModules.get(e=>e.default&&e.default.getCurrentUser)[0];var Dn=new class{constructor(){this.antiDM=this.antiDM.bind(this),this.enabled=!1}enable(){this.enabled||(this.enabled=!0,vn.subscribe("MESSAGE_CREATE",this.antiDM))}disable(){this.enabled&&(this.enabled=!1,vn.unsubscribe("MESSAGE_CREATE",this.antiDM))}antiDM(e){if(!e.message.author.bot)return;if(e.message.author.id===(xn?xn.default.getCurrentUser():null).id&&e.message.guild_id)return;const t=wn.getChannel(e.message.channel_id);var n;t&&(1===t.type&&(Sn[e.message.author.id]||(n=e.message,(/(discord\.gg|discord\.com\/invite\/|discordapp\.com\/invite\/)/g.test(n.content)||kn(n,"discord.gg/")||kn(n,"discord.com/invite/")||kn(n,"discordapp.com/invite/"))&&(Sn[e.message.author.id]=!0,d.showToast(`[AdBlock]: Blocked ${e.message.author.username}#${e.message.author.discriminator}`,{type:"warning"}),En||(En=BDModules.get(e=>e.default&&e.default.addRelationship)[0]),En.default.addRelationship(e.message.author.id,{location:"ContextMenu"},2),Cn||(Cn=BDModules.get(e=>e.default&&e.default.closePrivateChannel)[0]),Cn.default.closePrivateChannel(t.id,!1)))))}};function kn(e,t){let n=e.embeds;return 0!==n.length&&n.map(e=>"rich"===e.type&&(!!(e.title||"").includes(t)||(!!(e.description||"").includes(t)||(!!((e.footer?e.footer.text:"")||"").includes(t)||!!e.fields.map(e=>e.value.includes(t)||e.name.includes(t)).includes(!0))))).includes(!0)}let Mn;const Bn=d.removeDa;var Nn=new class{constructor(){this.enabled=!1}enable(){this.enabled||(this.enabled=!0,Mn=Mn||function(){let e=BDModules.get(e=>e.standardSidebarView)[0];if(!e)return null;let t=Bn(e.standardSidebarView),n=[];return n.push(`#app-mount .${t} .payment-info .${Bn(BDModules.get(e=>e.description&&"string"==typeof e.description&&e.description.includes("formText"))[0].description)}`),n.push(`#app-mount .${t} .${Bn(BDModules.get(e=>e.paymentSourceRow)[0].paymentSourceRow)} .${Bn(BDModules.get(e=>e.subText&&e.descriptionWrapper)[0].subText)}`),n.push(`#app-mount .${t} .${Bn(BDModules.get(e=>e.userSettingsAccount)[0].userSettingsAccount)} div:nth-child(2)>div:nth-child(2)>.${Bn(BDModules.get(e=>e.viewBody)[0].viewBody)}`),n}(),Mn||console.error(new Error("Couldn't find selectors to blur personnal informations.")),c.addStyle("blurPrivate",`\n${Mn[0]}, ${Mn[1]}, ${Mn[2]} {\n transition: all 150ms cubic-bezier(.55,.085,.68,.53);\n filter: blur(4px);\n opacity: .8;\n}\n\n${Mn[0]}:hover, ${Mn[1]}:hover, ${Mn[2]}:hover {\n transition: all 150ms cubic-bezier(.55,.09,.68,.53);\n filter: none;\n opacity: 1;\n}`))}disable(){this.enabled&&(this.enabled=!1,c.removeStyle("blurPrivate"))}},Pn=new class{constructor(){window.Lightcord.Api.ensureExported(e=>e.default&&e.default.startTyping).then(e=>{let t=this;const n=e.default.startTyping;e.default.startTyping=function(){if(t.disabled)return n.call(this,...arguments)};const s=e.default.stopTyping;e.default.stopTyping=function(){if(t.disabled)return s.call(this,...arguments)},this.disabled=!0}),window.Lightcord.BetterDiscord.DisableTyping=this}disable(){this.disabled=!0}enable(){this.disabled=!1}};function Ln(){return(Ln=Object.assign||function(e){for(var t=1;te.default&&e.default.open&&e.default.fetchMutualFriends)[0];React.Component;function $n(){return($n=Object.assign||function(e){for(var t=1;tt=e);jn[e]=n;const s=[];for(let t of zn.badges)t.defaultUsers.includes(e)&&s.push(t);const r=await new Promise(t=>{if(!me["lightcord-5"])return t([]);On.push([e,t]),setTimeout(()=>{let e=On;0!==e.length&&(On=[],_n(Hn.badges,"POST",JSON.stringify(e.map(e=>e[0]))).then(async t=>{200!==t.status&&e.forEach(e=>{e[1]([])});const n=await t.json();for(let t of n){e.find(e=>e[0]===t.user_id)[1](t.badges)}}).catch(t=>{t instanceof Fn||console.error(t),e.forEach(e=>{e[1]([])})}))},0)});for(let e of r)zn.badges.find(t=>t.id===e)&&(s.find(t=>t.id===e)||s.push(zn.badges.find(t=>t.id===e)));return this.cache={badges:Object.assign(this.cache.badges,{[e]:s})},setTimeout(()=>{delete this.cache.badges[e]},6e5),t(s),delete jn[e],s}};const _n=function(e,t,n){return me["lightcord-5"]?C()(`${zn.SERVER_URL}/api/v1${e}`,{method:t,headers:{CLIENT:"Lightcord",Authorization:window.Lightcord.Api.Authorization||"None::Anonymous"},...n?{body:n}:{}}):Promise.reject(new Fn("The current settings blocked the request."))};class Fn extends Error{constructor(){super(...arguments),this.name="LightcordError"}}const zn={SERVER_URL:"https://lightcord.deroku.xyz",badges:[{name:"Lightcord Bug Hunter",id:"f04698f5-816b-41e3-bd01-92291193d7a5",defaultUsers:["696481194443014174","696003456611385396"],scopes:[],component:An,href:"https://github.com/lightcord/lightcord/wiki/badges#bug_hunter"},{name:"Buffoon",id:"06904d31-65b4-41ec-a50c-8658bbd1af96",defaultUsers:["389016895543705602","664600134528663565","625350657829896224"],scopes:[],component:Tn,href:"https://youtu.be/EJtb6z-dlT8?t=145"}]},Hn={badges:"/users/badges"};Rn();let Wn;class Un extends React.PureComponent{constructor(){super(...arguments),this.state={states:[]}}render(){Wn||(Wn=l.find(e=>e.FormSection));const e=[...new Set(Object.keys(window.Lightcord.Api.Components).map(e=>Object.keys(window.Lightcord.Api.Components[e]).map(t=>window.Lightcord.Api.Components[e][t])).flat())];return[React.createElement(Wn.FormSection,{tag:"h2",title:"Lightcord's Api Availlable components"},React.createElement(Wn.FormText,{type:"description",className:"",selectable:!1},"These components are here for the plugin devs. They can quickly embed any component below with this panel."),React.createElement(Je,null),React.createElement(Lightcord.Api.Components.inputs.Button,{color:"brand",look:"outlined",size:"medium",hoverColor:"green",onClick:()=>{r.remote.shell.openExternal("https://github.com/lightcord/lightcord/wiki/Apis")},wrapper:!1},"Documentation")),e.map(e=>{let t=[];e.AllPreviews&&(t=e.AllPreviews);let n=t=>{this.setState({states:[Object.assign(s,t)].concat(this.state.states.filter(t=>t.elem!==e))})},s=this.state.states.find(t=>t.elem===e);s||(s={tab:"preview",elem:e,options:{}},this.state.states.push(s));let r=()=>{let e={};return t.forEach(t=>{e[Object.keys(t[0])[0]]=t[0][Object.keys(t[0])[0]]}),Object.keys(s.options).forEach(n=>{e[n]=t.find(e=>e.find(e=>e[n]))[s.options[n]][n]}),e},o=(e,t,n)=>{if("string"==typeof e)return e;if("boolean"==typeof e)return String(e);if("function"==typeof e)return e.toString();if("object"==typeof e){if(e&&e.$$typeof&&(e.$$typeof===Symbol.for("react.element")||60103===e.$$typeof)){if("Lightcord.Api.Components.general.Tabs"===t){if("react"===n)return'React.createElement("div", {style: {\n marginTop: "20px", marginBottom: "20px"\n}},\n React.createElement("div", {style: {\n backgroundColor: "var(--background-primary)",\n padding: "30px 30px",\n borderRadius: "8px"\n }, className: "lc-tab-box-shadow" },\n React.createElement(Lightcord.Api.Components.general.Title, null, "Preview tabs")\n )\n)';if("jsx"===n)return'
\n
\n Preview tabs\n
\n
'}return"Your components here."}return JSON.stringify(e,null," ")}return String(e)},a=function(t){const n=e.displayName||e.name;const s=`Lightcord.Api.Components.${Object.keys(window.Lightcord.Api.Components).find(e=>window.Lightcord.Api.Components[e][n])}.${n}`,a=r();if("jsx"===t){let e,n=[],r=null;if(Object.keys(a).forEach(e=>{if("children"==e)r=o(a[e],s,t);else{let r=e+"=";"string"==typeof a[e]?r+=JSON.stringify(a[e]):r+=`{${o(a[e],s,t)}}`,n.push(r)}}),r){return e=`<${s} ${n.join(" ")}>`,`${e}\n ${r}\n${``}`}return e=`<${s} ${n.join(" ")}/>`,e}if("react"===t){let e=a.children||null;delete a.children,e&&e.$$typeof&&(e.$$typeof===Symbol.for("react.element")||60103===e.$$typeof)&&(e=o(e,s,t));let n=[];Object.keys(a).forEach(e=>{let r=(/[^\w\d_]/g.test(e)?JSON.stringify(e):e)+": ";"string"==typeof a[e]?r+=JSON.stringify(a[e]):r+=o(a[e],s,t).split("\n").map((e,t)=>0===t?e:" "+e).join("\n"),n.push(r)});let r="{";n.length?n.forEach((e,t)=>{let s=t===n.length-1;0===t||(r+=","),r+="\n ",r+=e,s&&(r+="\n}")}):r+="}";let i="string"==typeof e&&e.startsWith("React.createElement")?e:JSON.stringify(e);return`React.createElement(${s}, ${r}, ${i})`}};return React.createElement("div",null,React.createElement(window.Lightcord.Api.Components.general.SettingsTitle,null,e.displayName||e.name),t.map(e=>{if(e[0].onClick)return null;if(e[0].text)return null;if(e[0].children)return null;if(1===e.length)return null;let t=Object.keys(e[0])[0];return[React.createElement(window.Lightcord.Api.Components.general.SettingSubTitle,null,t),React.createElement(window.Lightcord.Api.Components.inputs.Dropdown,{options:e.map((e,t)=>({value:"opt-"+t,label:JSON.stringify(e[Object.keys(e)[0]])})),value:"opt-"+(s.options[t]||"0"),onChange:e=>{n({options:Object.assign({},s.options,{[t]:(e.value||"0").replace("opt-","")})})},searchable:!0}),React.createElement("div",{style:{marginBottom:"8px"}})]}),React.createElement(window.Lightcord.Api.Components.general.Tabs,{tabs:[{label:"Preview",id:"preview"},{label:"Code",id:"code"}],active:s.tab,children:"preview"===s.tab?React.createElement("div",{style:{margin:"20px"}},React.createElement("div",{style:{backgroundColor:"var(--background-primary)",padding:"30px 30px",borderRadius:"8px"},className:"lc-tab-box-shadow"},React.createElement(e,r()))):React.createElement("div",{style:{margin:"20px"}},React.createElement("div",{style:{backgroundColor:"var(--background-primary)",padding:"30px 30px",borderRadius:"8px"},className:"lc-tab-box-shadow"},React.createElement(window.Lightcord.Api.Components.general.SettingSubTitle,null,"JSX"),React.createElement(window.Lightcord.Api.Components.general.CodeBlock,{language:"jsx",content:a("jsx")}),React.createElement(window.Lightcord.Api.Components.general.SettingSubTitle,null,"React"),React.createElement(window.Lightcord.Api.Components.general.CodeBlock,{language:"js",content:a("react")}))),onChange:e=>{n({tab:e})}}))})]}get renders(){}}const qn=oe.React;class Gn extends qn.Component{render(){const e=this.props.size||"18px";return qn.createElement("svg",{viewBox:"0 0 24 24",fill:"#FFFFFF",className:this.props.className||"",style:{width:e,height:e},onClick:this.props.onClick},qn.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),qn.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"}))}}class Vn extends React.PureComponent{render(){let e=l.find(e=>e.Separator&&e.Header&&e.Item);const t=React.createElement(L,{color:"black",side:"top",text:"Changelog"},React.createElement("span",{style:{float:"right",cursor:"pointer"},className:"bd-changelog-button",onClick:()=>{d.showChangelogModal(bbdChangelog)}},React.createElement(Gn,{className:"bd-icon",size:"16px"})));return new e.Header({children:React.createElement("span",null,"Bandaged BD",t),className:"ui-tab-bar-header"})}}var Jn=new class{constructor(){this.onChange=this.onChange.bind(this),this.updateSettings=this.updateSettings.bind(this),this.sidebar=new xe,this.registerComponents()}registerComponents(){this.sidebar.register("lightcord",Zn(this.lightcordComponent.bind(this))),this.sidebar.register("status",Zn(this.PresenceComponent.bind(this))),this.sidebar.register("accountinfo",Zn(this.AccountInfosComponent.bind(this))),this.sidebar.register("lcapipreview",Zn(this.ApiPreviewComponent.bind(this))),this.sidebar.register("BDChangelogTitle",Zn(()=>(new Vn).render())),this.sidebar.register("core",Zn(this.coreComponent.bind(this))),this.sidebar.register("customcss",Zn(this.customCssComponent.bind(this))),this.sidebar.register("plugins",Zn(this.renderAddonPane("plugins"))),this.sidebar.register("themes",Zn(this.renderAddonPane("themes")))}get root(){const e=c.query("#bd-settingspane-container");return e||(this.injectRoot()?this.root:null)}injectRoot(){let[e,t]=[BDModules.get(e=>e.layer&&e.animating)[0].layer.split(" ")[0],BDModules.get(e=>e.standardSidebarView)[0]];const n=c.query("."+e+" ."+t.standardSidebarView.split(" ")[0]+", ."+e+" .ui-standard-sidebar-view");if(!n)return!1;const s=c.createElement(`
`);return n.append(s),d.onRemoved(s,()=>{oe.reactDom.unmountComponentAtNode(s)}),!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 lightcordSettings(){const e=this.getSettings("lightcord");return[...new Set(e.map(e=>e.category))].map(t=>({title:t,settings:e.filter(e=>e.category==t)}))}get PresenceSettings(){return this.getSettings("status")}get MsgLogSettings(){return this.getSettings("msglog")}getSettings(e){return Object.keys(he).reduce((t,n)=>{const s=he[n];return s.cat===e&&s.implemented&&!s.hidden&&(s.text=n,t.push(s)),t},[])}onClick(){}onChange(e,t){this.updateSettings(e,t)}updateSettings(e,t){if(me[e]=t,"bda-gs-2"==e&&(t?c.addClass(document.body,"bd-minimal"):c.removeClass(document.body,"bd-minimal")),"bda-gs-3"==e&&(t?c.addClass(document.body,"bd-minimal-chan"):c.removeClass(document.body,"bd-minimal-chan")),"bda-gs-1"==e&&(t?Ie.addButton():Ie.removeButton()),"bda-gs-4"==e&&(t?_e.start():_e.stop()),"bda-gs-5"==e&&(t?c.addClass(c.query("#app-mount"),"bda-dark"):c.removeClass(c.query("#app-mount"),"bda-dark")),t&&"bda-gs-6"==e&&ke.inject24Hour(),"bda-gs-7"==e&&(t?De.injectColoredText():De.removeColoredText()),"fork-ps-4"==e&&(t?ze.start():ze.stop()),"fork-ps-5"==e&&(t?(ne.watchContent("plugin"),ne.watchContent("theme")):(ne.unwatchContent("plugin"),ne.unwatchContent("theme"))),"fork-wp-1"==e&&(d.setWindowPreference("transparent",t),t?d.setWindowPreference("backgroundColor",null):d.setWindowPreference("backgroundColor","#2f3136")),"bda-gs-8"==e&&(t?He.startDebugListener():He.stopDebugListener()),"fork-dm-1"==e&&(t?He.startCopySelector():He.stopCopySelector()),"lightcord-1"===e&&(window.Lightcord.Settings.devMode=!!t),"lightcord-2"===e&&(window.Lightcord.Settings.callRingingBeat=!!t),"lightcord-presence-1"===e)if(t){Mt.enable();const e=BDModules.get(e=>e.default&&"object"==typeof e.default&&"showCurrentGame"in e.default)[0];e&&!e.default.showCurrentGame&&BDModules.get(e=>e.default&&e.default.updateRemoteSettings)[0].default.updateRemoteSettings({showCurrentGame:!0})}else Mt.disable();"lightcord-3"===e&&(t?r.remote.getCurrentWindow().setAlwaysOnTop(!0):r.remote.getCurrentWindow().setAlwaysOnTop(!1)),"lightcord-4"===e&&(t?Dn.enable():Dn.disable()),"lightcord-6"===e&&(t?Nn.enable():Nn.disable()),"lightcord-7"===e&&(t?Pn.enable():Pn.disable()),this.saveSettings()}async initializeSettings(){me["bda-gs-2"]&&c.addClass(document.body,"bd-minimal"),me["bda-gs-3"]&&c.addClass(document.body,"bd-minimal-chan"),me["bda-gs-1"]&&Ie.addButton(),me["bda-gs-4"]&&_e.start(),me["bda-gs-5"]&&c.addClass(c.query("#app-mount"),"bda-dark"),me["bda-gs-6"]&&ke.inject24Hour(),me["bda-gs-7"]&&De.injectColoredText(),me["fork-ps-4"]&&ze.start(),me["lightcord-1"]&&(window.Lightcord.Settings.devMode=!0),me["lightcord-2"]&&(window.Lightcord.Settings.callRingingBeat=!0),me["lightcord-presence-1"]&&Mt.enable(),me["lightcord-3"]&&r.remote.getCurrentWindow().setAlwaysOnTop(!0),me["lightcord-4"]&&Dn.enable(),me["lightcord-6"]&&Nn.enable(),me["lightcord-7"]&&Pn.enable(),me["fork-ps-5"]&&(ne.watchContent("plugin"),ne.watchContent("theme")),me["bda-gs-8"]&&He.startDebugListener(),me["fork-dm-1"]&&He.startCopySelector(),this.saveSettings()}saveSettings(){g.setSettingGroup("settings",me),g.setSettingGroup("rpc",ge)}loadSettings(){Object.assign(me,g.getSettingGroup("settings")),Object.assign(ge,g.getSettingGroup("rpc"))}renderSidebar(){return this.sidebar.render()}coreComponent(){return oe.react.createElement(Ze,{key:"cspanel",onChange:this.onChange,sections:this.coreSettings})}lightcordComponent(){return[this.lightcordSettings.map((e,t)=>[0===t?null:oe.react.createElement(Je),oe.react.createElement("h2",{className:"ui-form-title h2 margin-reset margin-bottom-20"},e.title),e.settings.map(e=>oe.react.createElement(qe,{id:e.id,key:e.id,data:e,checked:me[e.id],onChange:(e,t)=>{this.onChange(e,t)}}))]),oe.react.createElement(window.Lightcord.Api.Components.inputs.Button,{color:"yellow",look:"ghost",size:"medium",hoverColor:"red",onClick(){console.log("Should relaunch"),r.remote.app.relaunch({args:r.remote.process.argv.slice(1).concat(["--disable-betterdiscord"])}),r.remote.app.quit()},wrapper:!0},"Relaunch without BetterDiscord")]}PresenceComponent(){return oe.react.createElement(Tt,{key:"lppannel",onChange:this.onChange,settings:this.PresenceSettings})}AccountInfosComponent(){return oe.react.createElement(mn,{key:"lapannel"})}ApiPreviewComponent(){return oe.react.createElement(Un,{key:"lapipannel"})}customCssComponent(){return oe.react.createElement(Xe,{key:"csseditor"})}renderAddonPane(e){class t extends oe.react.Component{constructor(e){super(e),this.prefix=this.props.type.replace("s","")}onChange(){this.props.onChange(this.props.type)}render(){return this.props.children}}const n=t.prototype.render;return Object.defineProperty(t.prototype,"render",{enumerable:!1,configurable:!1,set:function(){console.warn("Addon policy for plugins #5 https://github.com/rauenzi/BetterDiscordApp/wiki/Addon-Policies#plugins")},get:()=>n}),function(){return oe.react.createElement(t,{type:e},oe.react.createElement(Ct,{type:e}))}}};function Zn(e){class t extends React.Component{render(){return e()}}return t}class Yn extends oe.reactComponent{render(){return oe.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"},oe.react.createElement("metadata",null),oe.react.createElement("defs",null,oe.react.createElement("filter",{id:"shadow1"},oe.react.createElement("feDropShadow",{dx:"20",dy:"0",stdDeviation:"20","flood-color":"rgba(0,0,0,0.35)"})),oe.react.createElement("filter",{id:"shadow2"},oe.react.createElement("feDropShadow",{dx:"15",dy:"0",stdDeviation:"20","flood-color":"rgba(255,255,255,0.15)"})),oe.react.createElement("filter",{id:"shadow3"},oe.react.createElement("feDropShadow",{dx:"10",dy:"0",stdDeviation:"20","flood-color":"rgba(0,0,0,0.35)"}))),oe.react.createElement("g",null,oe.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"}),oe.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"}),oe.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 Kn(){return(Kn=Object.assign||function(e){for(var t=1;t/g};let es=BDModules.get(e=>e.CustomEmoji)[0],ts=BDModules.get(e=>e.default&&e.default.getCustomEmojiById)[0],ns=BDModules.get(e=>e.default&&"Autocomplete"===e.default.displayName)[0],ss=BDModules.get(e=>e.getAutocompleteOptions)[0],rs=BDModules.get(e=>e.default&&e.default.queryEmojiResults)[0],os=BDModules.get(e=>e.default&&e.default.Messages&&e.default.Messages.EMOJI_MATCHING)[0],as=BDModules.get(e=>e.default&&e.default.getGuild&&e.default.getGuilds&&!e.default.isFetching)[0],is=BDModules.get(e=>e.default&&e.default.getDisambiguatedEmojiContext);var ls=new class{constructor(){this.init().catch(e=>d.err("EmojiModule","An error occured",e))}async init(){if(ns||(ns=await window.Lightcord.Api.ensureExported(e=>e.default&&"Autocomplete"===e.default.displayName)),ss||(ss=await window.Lightcord.Api.ensureExported(e=>e.getAutocompleteOptions)),rs||(rs=await window.Lightcord.Api.ensureExported(e=>e.default&&e.default.queryEmojiResults)),os||(os=await window.Lightcord.Api.ensureExported(e=>e.default&&e.default.Messages&&e.default.Messages.EMOJI_MATCHING)),as||(as=await window.Lightcord.Api.ensureExported(e=>e.default&&e.default.getGuild&&e.default.getGuilds&&!e.default.isFetching)),is||(is=await window.Lightcord.Api.ensureExported(e=>e.default&&e.default.getDisambiguatedEmojiContext)),ns&&ss&&rs&&os&&as&&is){console.log("Patching getAutocompleteOptions of AutoCompletionTemplates",ss);const e=ss.getAutocompleteOptions;ss.getAutocompleteOptions=function(t,n,s,r,o){const a=e.call(this,...arguments);return a.LIGHTCORD_EMOJIS={matches(e,t){let n=t.length>1&&"."===e;return ys(n),n},queryResults:e=>rs.default.queryEmojiResults(e,t),renderResults:(e,t,n,s,r)=>cs(e,t,r.emojis,n,s,os.default.Messages.EMOJI_MATCHING,os.default.Messages.EMOJI,ns.default.Emoji,(function(e){return{emoji:e,key:e.id||e.uniqueName||e.name,sentinel:".",guild:null!=e.guildId?as.default.getGuild(e.guildId):null}}),(function(e){return"."+e+"."})),getPlainText(e,t){var n=t.emojis;if(null==n||null==n[e])return"";var s=n[e],r=s.animated?"a":"";return s.managed||null==s.id?"."+s.name+".":"<"+r+"."+(s.originalName||s.name)+"."+s.id+">"},getRawText(e,t){var n=t.emojis;if(null==n||null==n[e])return"";var s=n[e],r=s.animated?"a":"";return s.managed||null==s.id?"."+s.name+".":"<"+r+"."+(s.originalName||s.name)+"."+s.id+">"}},a}}else console.error(new Error("Couldn't start autocompletion of Lightcord's emojis."));for(;!oe.MessageComponent;)await new Promise(e=>setTimeout(e,100));this.cancelEmojiRender||(this.cancelEmoteRender=d.monkeyPatch(oe.MessageComponent,"default",{before:e=>{if(!d.getNestedProp(e.methodArguments[0],"childrenMessageContent.props.message"))return;const t=d.getNestedProp(e.methodArguments[0],"childrenMessageContent.props.content");if(!t||!t.length)return;let n=[];const s=[];for(let e of t){if("string"!=typeof e){s.push(e);continue}let r,o=!1;do{if(r=Qn.EmojiRegex.exec(e),r){o=!0,ts||(ts=BDModules.get(e=>e.default&&e.default.getCustomEmojiById)[0]);const e=ts.default.getCustomEmojiById(r[2]);e?n.push({animated:e.animated,name:e.name,id:e.id,raw:r[0]}):n.push({animated:r[0].startsWith("{if(!e)return"";const o=n.find(t=>t.raw==e);return o?(es||(es=BDModules.get(e=>e.CustomEmoji)[0]),React.createElement(es.CustomEmoji,{emoji:{name:`.${o.name}.`,emojiId:o.id,animated:o.animated,jumboable:1===r.length&&1===t.length}})):e}).reduce((e,t)=>0===e.length?[t]:"string"==typeof t?"string"==typeof e[e.length-1]?(e[e.length-1]+=` ${t}`,e):(e.push(" "+t),e):(e.push(" ",t),e),[]);s.push(...r)}else s.push(e)}for(;e.methodArguments[0].childrenMessageContent.props.content[0];)e.methodArguments[0].childrenMessageContent.props.content.shift();for(;s[0];)e.methodArguments[0].childrenMessageContent.props.content.push(s.shift())}}))}disable(){this.cancelEmoteRender&&(this.cancelEmoteRender(),this.cancelEmoteRender=null)}start(){}};function cs(e,t,n,s,r,o,a,i,l,c){if(null==n||0===n.length)return null;var d=n.map((function(e,n){return React.createElement(i,Object.assign({onClick:r,onHover:s,selected:t===n,index:n},l(e,n)))}));return[ds(o,a,e,c),d]}function ds(e,t,n,s){var r=n.length>0?e.format({prefix:s(n)}):t;return Array.isArray(r)?r.unshift(React.createElement("strong",{},"[Lightcord] ")):r="[LIGHTCORD] "+r,React.createElement(ns.default.Title,{title:r},r)}ds.displayName="renderHeader";let us,hs,ps,ms=BDModules.get(e=>e.default&&e.default.isEmojiDisabled)[0],gs=ms&&ms.default.isEmojiDisabled,fs=!1,bs=!1;function ys(e){fs=e,bs||(ms||(ms=BDModules.get(e=>e.default&&e.default.isEmojiDisabled)[0]),ms&&(gs||(gs=ms.default.isEmojiDisabled),bs=!0,ms.default.isEmojiDisabled=function(e){return fs?!(!e.surrogates&&!e.diversity):gs.call(this,...arguments)}))}function vs(){}vs.prototype.setConfig=function(e){Object.assign(ve,e)},vs.prototype.init=async function(){if(!Array.prototype.flat)return void d.alert("Not Supported","BetterDiscord v"+ce+" does not support this old version ("+ie+") of Discord. Please update your Discord installation before proceeding.");if(ve.version
Please download the latest version from GitHub");if(window.ED)return void d.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 d.alert("Not Supported","BandagedBD does not work with Powercord. Please uninstall one of them.");d.suppressErrors(this.patchAttributes.bind(this),"LC Plugin Certifier Patch")(),d.log("Startup","Initializing Settings"),this.initSettings(),await this.checkForGuilds(),oe.initialize(),d.log("Startup","Updating Settings"),Jn.initializeSettings(),d.log("Startup","Loading Addons Cache"),await ne.loadAddonCertifierCache(),d.log("Startup","Loading Plugins"),await v.loadPlugins(),d.log("Startup","Loading Themes"),await re.loadThemes(),c.addStyle("customcss",atob(g.getBDData("bdcustomcss"))),window.addEventListener("beforeunload",(function(){me["bda-dc-0"]&&document.querySelector(".btn.btn-disconnect").click()})),j.start(),d.log("Startup","Removing Loading Icon"),document.getElementsByClassName("bd-loaderv2").length&&document.getElementsByClassName("bd-loaderv2")[0].remove(),d.log("Startup","Initializing Main Observer"),this.initObserver(),me["fork-ps-1"]&&(d.log("Startup","Collecting Startup Errors"),d.showContentErrors({plugins:be,themes:ye}));const e=g.getBDData("version");if(ce>e&&(ue&&this.showChangelogModal(ue),g.setBDData("version",ce)),ls.start(),d.suppressErrors(this.patchSocial.bind(this),"BD Social Patch")(),d.suppressErrors(this.patchGuildPills.bind(this),"BD Guild Pills Patch")(),d.suppressErrors(this.patchGuildListItems.bind(this),"BD Guild List Items Patch")(),d.suppressErrors(this.patchGuildSeparator.bind(this),"BD Guild Separator Patch")(),d.suppressErrors(this.patchMessageHeader.bind(this),"BD Badge Chat Patch")(),d.suppressErrors(this.patchMemberList.bind(this),"BD Badge Member List Patch")(),d.suppressErrors(this.patchAttachment.bind(this),"LC Plugin Certifier Patch")(),ve.haveInstalledDefault){let e=d.alert("First Installation","As it is the first time you install Lightcord, We added two default themes and one default plugin in your plugin/theme folder. Check it in the Plugin/Theme settings.");await new Promise(t=>{e.onClose(t)})}const t=document.querySelector("#app-mount > div.typeWindows-1za-n7.withFrame-haYltI.titleBar-AC4pGV.horizontalReverse-3tRjY7.flex-1O1GKY.directionRowReverse-m8IjIq.justifyStart-2NDFzi.alignStretch-DpGPf3.da-typeWindows.da-withFrame.da-titleBar.da-horizontalReverse.da-flex.da-directionRowReverse.da-justifyStart.da-alignStretch > div.wordmarkWindows-1v0lYD.wordmark-2iDDfm.da-wordmarkWindows.da-wordmark");t&&(t.style.top="3px",t.innerHTML='\n \n \n \n')},vs.prototype.patchAttributes=async function(){let e=[];for(this.cancelPatchAttributes=function(){e.forEach(e=>e())};!oe.MessageComponent;)await new Promise(e=>setTimeout(e,100));const t=l.find(e=>"Anchor"==e.displayName);ensureExported(e=>e.default&&"DiscordTag"===e.default.displayName).then(e=>{let n=e.default;e.default=function(e){let s=n(e),r=Rn(),o=oe.React.createElement("div",{style:{display:"inline",marginTop:"5px"}},oe.React.createElement("span",{id:"badges-"+r,key:"badges-"+r,style:{display:"inherit"}})),a=[s];"249746236008169473"===e.user.id?a.push(oe.React.createElement(L,{color:"black",side:"top",text:"BandagedBD Developer"},oe.React.createElement(t,{className:"bd-chat-badge",href:"https://github.com/rauenzi/BetterDiscordApp",title:"BandagedBD",target:"_blank"},oe.React.createElement(Yn,{size:"16px",className:"bd-logo"})))):"696481194443014174"!==e.user.id&&"696003456611385396"!==e.user.id||a.push(oe.React.createElement(L,{color:"black",side:"top",text:"Lightcord Developer"},oe.React.createElement(t,{className:"bd-chat-badge",href:"https://github.com/Lightcord/Lightcord",title:"Lightcord",target:"_blank"},oe.React.createElement(Xn,{size:"16px",className:"bd-logo"})))),a.push(o);let i=oe.React.createElement("div",{style:{display:"block"}},a);return ws(r,e.user,!1),i}}),e.push(d.monkeyPatch(oe.MessageComponent,"default",{after:e=>{e.methodArguments[0].childrenMessageContent.props.message&&(e.returnValue.props["data-message-id"]=e.methodArguments[0].childrenMessageContent.props.message.id)}}))},vs.prototype.checkForGuilds=function(){let e=0;return new Promise(t=>{const n=function(){const s=oe.guildClasses.wrapper.split(" ")[0];document.querySelectorAll(`.${s}`).length>0&&e++;const r=oe.guildClasses.listItem.split(" ")[0],o=oe.guildClasses.blobContainer.split(" ")[0];return document.querySelectorAll(`.${s} .${r} .${o}`).length>0||e>=50?t(ve.deferLoaded=!0):void setTimeout(n,100)};"loading"!=document.readyState&&setTimeout(n,100),document.addEventListener("DOMContentLoaded",()=>{setTimeout(n,100)})})},vs.prototype.injectExternals=async function(){await c.addScript("ace-script","https://cdnjs.cloudflare.com/ajax/libs/ace/1.2.9/ace.js"),window.require.original&&(window.require=window.require.original)},vs.prototype.initSettings=function(){if(g.initialize(),g.getSettingGroup("settings")||g.getSettingGroup("rpc")){Jn.loadSettings();for(const e in pe)null==me[e]&&(me[e]=pe[e],Jn.saveSettings())}else g.getSettingGroup("settings")||Object.assign(me,pe),g.getSettingGroup("rpc")||Object.assign(ge,fe),Jn.saveSettings();window.Lightcord.Api.ensureExported(e=>e.default&&e.default.prototype&&e.default.prototype.getPredicateSections).then(e=>{let t=e.default.prototype.getPredicateSections;e.default.prototype.getPredicateSections=function(){let e=t.call(this,...arguments);if("My Account"===e[1].section){let t=[];for(t.push(e.pop()),t.push(e.pop()),t.push(e.pop()),t.push(e.pop()),e.push(...Jn.renderSidebar());t[0];)e.push(t.pop())}return e}})},vs.prototype.initObserver=function(){new MutationObserver(e=>{for(let t=0,n=e.length;te.layer&&"string"==typeof e.layer&&e.animating)[0].layer),hs||(hs=BDModules.get(e=>e.socialLinks&&"string"==typeof e.socialLinks)[0].socialLinks),ps||(ps=BDModules.get(e=>e.modal&&"string"==typeof e.modal&&e.inner&&"string"==typeof e.inner&&!e.responsiveWidthMobile)[0].modal),s.classList.contains(us)&&("GUILD_SETTINGS"===s.getAttribute("aria-label")&&(s.setAttribute("layer-id","server-settings"),s.setAttribute("id","server-settings")),s.getElementsByClassName(hs).length&&(s.setAttribute("layer-id","user-settings"),s.setAttribute("id","user-settings"))),s.parentElement==document.body&&s.querySelector("#ace_settingsmenu")&&(s.id="ace_settingsmenu_container")}}).observe(document,{childList:!0,subtree:!0})},vs.prototype.showChangelogModal=function(e={}){return d.showChangelogModal(e)},vs.prototype.alert=function(e,t){return d.alert(e,t)},vs.prototype.patchSocial=function(){if(this.socialPatch)return;const e=l.find(e=>"TabBar"==e.displayName),t=l.find(e=>"Anchor"==e.displayName);e&&(this.socialPatch=d.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;if(t){let e=BDModules.get(e=>e.socialLinks)[0];const s=n[n.length-2].type,r=function(){const n=s(...arguments);return n.props.children.push(oe.React.createElement(L,{color:"black",side:"top",text:"Lightcord"},oe.React.createElement(t,{className:"bd-social-link "+e.link,href:"https://github.com/Lightcord/Lightcord",title:"Lightcord",target:"_blank"},oe.React.createElement(Xn,{size:"16px",className:"bd-social-logo"})))),n.props.children.push(oe.React.createElement(L,{color:"black",side:"top",text:"BandagedBD"},oe.React.createElement(t,{className:"bd-social-link "+e.link,href:"https://github.com/rauenzi/BetterDiscordApp",title:"BandagedBD",target:"_blank"},oe.React.createElement(Yn,{size:"16px",className:"bd-social-logo"})))),n};n[n.length-2].type=r}let[s,o,a]=[BDModules.get(e=>e.colorMuted)[0].colorMuted,BDModules.get(e=>e.size32)[0],BDModules.get(e=>e.versionHash)[0].versionHash];const i=`(${ve.hash?ve.hash.substring(0,7):ve.branch})`,l=[oe.react.createElement("div",{className:`${s} ${o.size12}`},`Lightcord ${r.remote.getGlobal("BuildInfo").version} `,oe.react.createElement("span",{className:a+" da-versionHash"},`(${(r.remote.getGlobal("BuildInfo").commit||"Unknown").slice(0,7)})`)),oe.react.createElement("div",{className:`${s} ${o.size12}`},`BBD ${ce} `,oe.react.createElement("span",{className:a+" da-versionHash"},i))],c=n[n.length-1].type;n[n.length-1].type=function(){const e=c(...arguments);return e.props.children.splice(1,0,l),e}}}))};function ws(e,t,n){process.nextTick(()=>{const s=document.getElementById("badges-"+e);if(!s||s.childNodes.length>0)return;if(s.childNodes.length)return;let r=document.createElement("div");r.style.display="none",s.appendChild(r);const o=l.find(e=>"Anchor"==e.displayName);In.getBadges(t.id).then(e=>{e.forEach(e=>{const r={svg:{size:"16px",className:"bd-logo",width:"16px"}};e.scopes.forEach(e=>{"user"===e&&(r.user=t)}),e.href||(r.Anchor=o,r.href={className:n?"bd-chat-badge":"bd-member-badge",title:e.name,target:"_blank"});const a=oe.React.createElement(L,{color:"black",side:"top",text:e.name},e.href?oe.react.createElement(o,{href:e.href,className:n?"bd-chat-badge":"bd-member-badge",title:e.name,target:"_blank"},oe.React.createElement(e.component,r)):oe.React.createElement(e.component,r)),i=document.createElement("div");oe.reactDom.render(a,i),i.childNodes.forEach(e=>{s.appendChild(e)})})})})}vs.prototype.patchGuildListItems=function(){if(this.guildListItemsPatch)return;const e=function(){const e=l.findByProps("wrapper","unreadMentionsBar"),t=l.findByProps("guildsError","selected"),n=l.findByProps("blobContainer");return Object.assign({},e,t,n)}(),t=e.listItem.split(" ")[0],n=e.blobContainer.split(" ")[0],s=oe.getInternalInstance(document.querySelector(`.${t} .${n}`).parentElement).return.type;s&&(this.guildListItemsPatch=d.monkeyPatch(s.prototype,"render",{after:e=>{if(e.returnValue&&e.thisObject){const t=e.returnValue,n=e.thisObject.props;let s=t.props.className;return s+=" bd-guild",n.unread&&(s+=" bd-unread"),n.selected&&(s+=" bd-selected"),n.audio&&(s+=" bd-audio"),n.video&&(s+=" bd-video"),n.badge&&(s+=" bd-badge"),n.animatable&&(s+=" bd-animatable"),t.props.className=s,t}}}))},vs.prototype.patchGuildPills=function(){if(this.guildPillPatch)return;const e=l.find(e=>e.default&&!e.default.displayName&&e.default.toString&&e.default.toString().includes("translate3d"));e&&(this.guildPillPatch=d.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}}))},vs.prototype.patchGuildSeparator=function(){if(this.guildSeparatorPatch)return;const e=l.findByDisplayName("Guilds"),t=l.findByProps("renderListItem");if(!t||!e)return;const n=function(){const e=t.Separator(...arguments);return e.props.className+=" bd-guild-separator",e};this.guildSeparatorPatch=d.monkeyPatch(e.prototype,"render",{after:e=>{e.returnValue.props.children[1].props.children[3].type=n}})},vs.prototype.patchAttachment=function(){if(this.AttachmentPatch)return;const e=BDModules.get(e=>e.default&&"Attachment"===e.default.displayName)[0];l.find(e=>"Anchor"==e.displayName)&&e&&e.default&&(this.AttachmentPatch=d.monkeyPatch(e,"default",{after:e=>{if(!me["fork-ps-6"])return;const t=e.methodArguments[0]||null,n=d.getNestedProp(e.returnValue,"props.children");if(!n||!t||!t.url)return;if(!Array.isArray(n))return;const s=Rn();n.push(oe.react.createElement("span",{id:"certified-"+s})),j.patch(t,"certified-"+s)}}))},vs.prototype.patchMessageHeader=function(){if(this.messageHeaderPatch)return;const e=l.findByProps("MessageTimestamp"),t=l.find(e=>"Anchor"==e.displayName);t&&e&&e.default&&(this.messageHeaderPatch=d.monkeyPatch(e,"default",{after:e=>{const n=d.getNestedProp(e.methodArguments[0],"message.author"),s=d.getNestedProp(e.returnValue,"props.children.1.props.children.1.props.children");if(!s||!n||!n.id)return;if(!Array.isArray(s))return;"249746236008169473"===n.id?s.push(oe.React.createElement(L,{color:"black",side:"top",text:"BandagedBD Developer"},oe.React.createElement(t,{className:"bd-chat-badge",href:"https://github.com/rauenzi/BetterDiscordApp",title:"BandagedBD",target:"_blank"},oe.React.createElement(Yn,{size:"16px",className:"bd-logo"})))):"696481194443014174"!==n.id&&"696003456611385396"!==n.id||s.push(oe.React.createElement(L,{color:"black",side:"top",text:"Lightcord Developer"},oe.React.createElement(t,{className:"bd-chat-badge",href:"https://github.com/Lightcord/Lightcord",title:"Lightcord",target:"_blank"},oe.React.createElement(Xn,{size:"16px",className:"bd-logo"}))));const r=Rn();s.push(oe.React.createElement("div",{id:"badges-"+r,style:{display:"inline"}})),ws(r,n,!0)}}))},vs.prototype.patchMemberList=function(){if(this.memberListPatch)return;const e=l.findByDisplayName("MemberListItem"),t=l.find(e=>"Anchor"==e.displayName);t&&e&&e.prototype&&e.prototype.renderDecorators&&(this.memberListPatch=d.monkeyPatch(e.prototype,"renderDecorators",{after:e=>{const n=d.getNestedProp(e.thisObject,"props.user"),s=d.getNestedProp(e.returnValue,"props.children");if(!s||!n||!n.id)return;if(!Array.isArray(s))return;"249746236008169473"===n.id?s.push(oe.React.createElement(L,{color:"black",side:"top",text:"BandagedBD Developer"},oe.React.createElement(t,{className:"bd-member-badge",href:"https://github.com/rauenzi/BetterDiscordApp",title:"BandagedBD",target:"_blank"},oe.React.createElement(Yn,{size:"16px",className:"bd-logo"})))):"696481194443014174"!==n.id&&"696003456611385396"!==n.id||s.push(oe.React.createElement(L,{color:"black",side:"top",text:"Lightcord Developer"},oe.React.createElement(t,{className:"bd-member-badge",href:"https://github.com/Lightcord/Lightcord",title:"Lightcord",target:"_blank"},oe.React.createElement(Xn,{size:"16px",className:"bd-logo"}))));const r=Rn();s.push(oe.React.createElement("div",{id:"badges-"+r})),ws(r,n,!1)}}))},vs.prototype.updateInjector=async function(){const e=g.injectionPath;if(!e)return!1;const t=n(2),s=n(1),r=n(7),o=n(8),a=n(9),i=s.resolve(e,".."),l=s.basename(e),c="https://github.com/rauenzi/BetterDiscordApp/archive/injector.zip",u=s.resolve(i,"injector.zip"),h=s.resolve(i,"BetterDiscordApp-injector");d.log("InjectorUpdate","Downloading "+c);let p=await new Promise(e=>{null.get({url:c,encoding:null},async(n,s,r)=>{if(n||200!==s.statusCode)return e(!1);await new Promise(e=>t.exists(u,e))&&await new Promise(e=>t.rename(u,`${u}.bak${Math.round(performance.now())}`,e)),d.log("InjectorUpdate","Writing "+u),t.writeFile(u,r,t=>e(!t))})});if(!p)return p;await new Promise(e=>t.exists(h,e))&&await new Promise(e=>t.rename(h,`${h}.bak${Math.round(performance.now())}`,e));const m=await new Promise(e=>o.open(u,{lazyEntries:!0},(t,n)=>e(n)));m.on("entry",(function(e){if(e.fileName.endsWith("/"))return m.readEntry();d.log("InjectorUpdate","Extracting "+e.fileName);const n=s.resolve(i,e.fileName);a.sync(s.dirname(n)),m.openReadStream(e,(function(e,s){if(e)return p=!1;s.on("end",(function(){m.readEntry()})),s.pipe(t.createWriteStream(n))}))})),m.readEntry(),await new Promise(e=>m.once("end",e));const f=s.resolve(i,`${l}.bak${Math.round(performance.now())}`);return await new Promise(n=>t.rename(e,f,n)),d.log("InjectorUpdate",`Renaming ${s.basename(h)} to ${l}`),p=await new Promise(n=>t.rename(h,e,e=>n(!e))),p?p?(await new Promise(e=>r(f,e)),await new Promise(e=>t.unlink(u,e)),d.log("InjectorUpdate","Injector Updated!"),p):(d.err("InjectorUpdate","Something went wrong... restoring backups."),await new Promise(e=>r(h,e)),await new Promise(n=>t.rename(f,e,n)),p):(d.err("InjectorUpdate","Failed to rename the final directory"),p)};var Es=new vs;const Cs={get React(){return oe.React},get ReactDOM(){return oe.ReactDom},get ReactComponent(){return oe.ReactComponent},get WindowConfigFile(){return d.WindowConfigFile},get settings(){return he},get emotes(){return{}},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 d.getAllWindowPreferences()},getWindowPreference:function(e){return d.getWindowPreference(e)},setWindowPreference:function(e,t){return d.setWindowPreference(e,t)},injectCSS:function(e,t){c.addStyle(c.escapeID(e),t)},clearCSS:function(e){c.removeStyle(c.escapeID(e))},linkJS:function(e,t){c.addScript(c.escapeID(e),t)},unlinkJS:function(e){c.removeScript(c.escapeID(e))},getPlugin:function(e){return Ee.hasOwnProperty(e)?Ee[e].plugin:null},getCore:function(){return d.warn("Deprecation Notice","BdApi.getCore() will be removed in future versions."),Es},alert:function(e,t){return d.showConfirmationModal(e,t,{cancelText:null})},showConfirmationModal:function(e,t,n={}){return d.showConfirmationModal(e,t,n)},showToast:function(e,t={}){d.showToast(e,t)},findModule:function(e){return oe.WebpackModules.find(e)},findAllModules:function(e){return oe.WebpackModules.findAll(e)},findModuleByProps:function(...e){return oe.WebpackModules.findByUniqueProperties(e)},findModuleByPrototypes:function(...e){return oe.WebpackModules.findByPrototypes(e)},findModuleByDisplayName:function(e){return oe.WebpackModules.findByDisplayName(e)},getInternalInstance:function(e){if(e instanceof window.jQuery||e instanceof Element)return e instanceof jQuery&&(e=e[0]),oe.getInternalInstance(e)},loadData:function(e,t){return g.getPluginData(e,t)}};Cs.getData=Cs.loadData,Cs.saveData=function(e,t,n){return g.setPluginData(e,t,n)},Cs.setData=Cs.saveData,Cs.deleteData=function(e,t){return g.deletePluginData(e,t)},Cs.monkeyPatch=function(e,t,n){return d.monkeyPatch(e,t,n)},Cs.onRemoved=function(e,t){return d.onRemoved(e,t)},Cs.suppressErrors=function(e,t){return d.suppressErrors(e,t)},Cs.testJSON=function(e){return d.testJSON(e)},Cs.isPluginEnabled=function(e){return!!Ce[e]},Cs.isThemeEnabled=function(e){return!!Se[e]},Cs.isSettingEnabled=function(e){return!!me[e]},Cs.enableSetting=function(e){return Jn.onChange(e,!0)},Cs.disableSetting=function(e){return Jn.onChange(e,!1)},Cs.toggleSetting=function(e){return Jn.onChange(e,!me[e])},Cs.getBDData=function(e){return g.getBDData(e)},Cs.setBDData=function(e,t){return g.setBDData(e,t)};const Ss=(e,t,n)=>new class{get folder(){return n.folder}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)}};Cs.Plugins=Ss(Ce,Ee,v),Cs.Themes=Ss(Se,we,re);var xs=Cs;window.Lightcord.BetterDiscord.BdApi=Cs,n.d(t,"default",(function(){return Ms})),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,{getOwnPropertyDescriptor:function(e,t){if("localStorage"!==t)return Object.getOwnPropertyDescriptor(e,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 Ds=(e,t)=>{Object.defineProperty(window,e,{get:()=>(d.warn("Deprecated Global",`"${e}" will be removed in future versions. Please only use BdApi.`),t)})},ks=Object.keys(s);for(const e of ks)Ds(e,s[e]);Ds("BDV2",oe),Ds("pluginModule",v),Ds("themeModule",re),Ds("Utils",d),Ds("BDEvents",b),Ds("settingsPanel",Jn),Ds("DataStore",g),Ds("ContentManager",ne),Ds("ClassNormalizer",ze),window.BdApi=xs,Ds("mainCore",Es);class Ms{constructor(e){Es.setConfig(e)}init(){Es.init()}}n(10)}]); \ No newline at end of file