');i.append(h.createElement(`
${k.Developer.copySelector}
`)),i.addEventListener("click",()=>{f.ElectronModule.copy(t),s.style.display="none"}),n.append(i),s.append(n)}))}getSelector(e){if(e.id)return"#"+e.id;const t=this.getRules(e),s=t[t.length-1];return s?s.selectorText:e.classList.length?"."+Array.from(e.classList).join("."):"."+Array.from(e.parentElement.classList).join(".")}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("*"))}},Ut=new class extends Xe{get name(){return"Debugger"}get category(){return"developer"}get id(){return"debuggerHotkey"}enabled(){document.addEventListener("keydown",this.debugListener)}disabled(){document.removeEventListener("keydown",this.debugListener)}debugListener(e){119!==e.which&&118!=e.which||(e.preventDefault(),e.stopImmediatePropagation())}};const Ht=s(0),qt=s(2),$t=s(1),Wt=Ht.remote.BrowserWindow;var _t=new class extends Xe{get name(){return"ReactDevTools"}get category(){return"developer"}get id(){return"reactDevTools"}initialize(){super.initialize(),this.findExtension()}findExtension(){let e="";if(e="win32"===process.platform?$t.resolve(process.env.LOCALAPPDATA,"Google/Chrome/User Data"):"linux"===process.platform?$t.resolve(process.env.HOME,".config/google-chrome"):"darwin"===process.platform?$t.resolve(process.env.HOME,"Library/Application Support/Google/Chrome"):$t.resolve(process.env.HOME,".config/chromium"),e+="/Default/Extensions/fmkadmapgofadopljbjfkapdkoienihi/",qt.existsSync(e)){const t=qt.readdirSync(e);e=$t.resolve(e,t[t.length-1])}this.extensionPath=e,this.isExtensionInstalled=qt.existsSync(e)}enabled(){if(this.isExtensionInstalled||this.findExtension(),!this.isExtensionInstalled)return W.alert(k.ReactDevTools.notFound,k.ReactDevTools.notFoundDetails);Wt.addDevToolsExtension(this.extensionPath)?this.log("Successfully installed react devtools."):this.error("Couldn't find react devtools in chrome extensions!")}disabled(){this.isExtensionInstalled&&Wt.removeDevToolsExtension("React Developer Tools")}};class Gt extends O.Component{render(){return O.createElement("svg",{className:"bd-logo "+this.props.className,height:"100%",width:this.props.size||"16px",viewBox:"0 0 2000 2000",style:{fillRule:"evenodd",clipRule:"evenodd",strokeLinecap:"round",strokeLinejoin:"round"}},O.createElement("metadata",null),O.createElement("defs",null,O.createElement("filter",{id:"shadow1"},O.createElement("feDropShadow",{dx:"20",dy:"0",stdDeviation:"20",floodColor:"rgba(0,0,0,0.35)"})),O.createElement("filter",{id:"shadow2"},O.createElement("feDropShadow",{dx:"15",dy:"0",stdDeviation:"20",floodColor:"rgba(255,255,255,0.15)"})),O.createElement("filter",{id:"shadow3"},O.createElement("feDropShadow",{dx:"10",dy:"0",stdDeviation:"20",floodColor:"rgba(0,0,0,0.35)"}))),O.createElement("g",null,O.createElement("path",{style:{filter:"url(#shadow3)"},fill:"#171717",opacity:"1",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"}),O.createElement("path",{style:{filter:"url(#shadow2)"},fill:"#3E82E5",opacity:"1",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"}),O.createElement("path",{style:{filter:"url(#shadow1)"},fill:"#FFFFFF",opacity:"1",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"})))}}const Qt=f.React,Vt=g.getByDisplayName("Tooltip");var Zt=new class{initialize(){u.suppressErrors(this.patchSocial.bind(this),"BD Social Patch")(),u.suppressErrors(this.patchGuildPills.bind(this),"BD Guild Pills Patch")(),u.suppressErrors(this.patchGuildListItems.bind(this),"BD Guild List Items Patch")(),u.suppressErrors(this.patchGuildSeparator.bind(this),"BD Guild Separator Patch")(),u.suppressErrors(this.patchMessageHeader.bind(this),"BD Message Header Patch")(),u.suppressErrors(this.patchMemberList.bind(this),"BD Member List Patch")()}patchSocial(){if(this.socialPatch)return;const e=g.getByDisplayName("TabBar"),t=g.getByDisplayName("Anchor");e&&(this.socialPatch=L.after("ComponentPatcher",e.prototype,"render",(e,s,n)=>{const o=n.props.children;if(!o||!o.length||o.length<3)return;if("Separator"!==o[o.length-3].type.displayName)return;if(!o[o.length-2].type.toString().includes("socialLinks"))return;if(t){const e=o[o.length-2].type,s=function(){const s=e(...arguments);return s.props.children.push(f.React.createElement(t,{className:"bd-social-link",href:"https://twitter.com/BandagedBD",title:"BandagedBD",target:"_blank"},f.React.createElement(Gt,{size:"16px",className:"bd-social-logo"}))),s};o[o.length-2].type=s}const r=f.React.createElement("div",{className:"colorMuted-HdFt4q size12-3cLvbJ"},"Injector "+i.version),a=`(${i.hash?i.hash.substring(0,7):i.branch})`,l=f.React.createElement("div",{className:"colorMuted-HdFt4q size12-3cLvbJ"},`BBD ${i.bbdVersion} `,f.React.createElement("span",{className:"versionHash-2gXjIB da-versionHash"},a)),d=o[o.length-1].type;o[o.length-1].type=function(){const e=d(...arguments);return e.props.children.splice(e.props.children.length-1,0,r),e.props.children.splice(1,0,l),e}}))}patchGuildListItems(){if(this.guildListItemsPatch)return;const e=f.GuildClasses.listItem.split(" ")[0],t=f.GuildClasses.blobContainer.split(" ")[0],s=u.getReactInstance(document.querySelector(`.${e} .${t}`).parentElement).return.type;s&&(this.guildListItemsPatch=L.after("ComponentPatcher",s.prototype,"render",(e,t,s)=>{if(!s||!e)return;const n=e.props;return s.props.className+=" bd-guild",n.unread&&(s.props.className+=" bd-unread"),n.selected&&(s.props.className+=" bd-selected"),n.audio&&(s.props.className+=" bd-audio"),n.video&&(s.props.className+=" bd-video"),n.badge&&(s.props.className+=" bd-badge"),n.animatable&&(s.props.className+=" bd-animatable"),s}))}patchGuildPills(){if(this.guildPillPatch)return;const e=g.getModule(e=>e.default&&!e.default.displayName&&e.default.toString&&e.default.toString().includes("translate3d"));e&&(this.guildPillPatch=L.after("ComponentPatcher",e,"default",(e,t,s)=>{const n=t[0];return n.unread&&(s.props.className+=" bd-unread"),n.selected&&(s.props.className+=" bd-selected"),n.hovered&&(s.props.className+=" bd-hovered"),s}))}patchGuildSeparator(){if(this.guildSeparatorPatch)return;const e=g.getByDisplayName("Guilds"),t=g.getByProps("renderListItem");if(!t||!e)return;const s=function(){const e=t.Separator(...arguments);return e.props.className+=" bd-guild-separator",e};this.guildSeparatorPatch=L.after("ComponentPatcher",e.prototype,"render",(e,t,n)=>{const i=u.findInReactTree(n,e=>e.type&&!e.type.displayName&&"function"==typeof e.type&&u.isEmpty(e.props));i&&(i.type=s)})}patchMessageHeader(){if(this.messageHeaderPatch)return;const e=g.getByProps("MessageTimestamp"),t=g.find(e=>"Anchor"==e.displayName);t&&e&&e.default&&(this.messageHeaderPatch=L.after("ComponentPatcher",e,"default",(e,s,n)=>{const i=u.getNestedProp(s[0],"message.author"),o=u.getNestedProp(n,"props.children.1.props.children.1.props.children");o&&i&&i.id&&"249746236008169473"===i.id&&Array.isArray(o)&&o.push(Qt.createElement(Vt,{color:"black",position:"top",text:"BandagedBD Developer"},e=>Qt.createElement(t,Object.assign({className:"bd-chat-badge",href:"https://github.com/rauenzi/BetterDiscordApp",title:"BandagedBD",target:"_blank"},e),Qt.createElement(Gt,{size:"16px",className:"bd-logo"}))))}))}patchMemberList(){if(this.memberListPatch)return;const e=g.findByDisplayName("MemberListItem"),t=g.find(e=>"Anchor"==e.displayName);t&&e&&e.prototype&&e.prototype.renderDecorators&&(this.memberListPatch=L.after("ComponentPatcher",e.prototype,"renderDecorators",(e,s,n)=>{const i=u.getNestedProp(e,"props.user"),o=u.getNestedProp(n,"props.children");o&&i&&i.id&&"249746236008169473"===i.id&&Array.isArray(o)&&o.push(Qt.createElement(Vt,{color:"black",position:"top",text:"BandagedBD Developer"},e=>Qt.createElement(t,Object.assign({className:"bd-member-badge",href:"https://github.com/rauenzi/BetterDiscordApp",title:"BandagedBD",target:"_blank"},e),Qt.createElement(Gt,{size:"16px",className:"bd-logo"}))))}))}};const Yt=document.createElement("style");Yt.textContent="/* BEGIN V2 LOADER */\n/* =============== */\n\n#bd-loading-icon {\n background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+IDwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExL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1KzE3MjEuOTQrMTQ2OS4yNSsxMzY4LjU0QzE0NjkuMjUrMTIwNS45NCsxNDI0Ljc1KzEwODQuNDQrMTM0Ni4zNSs5OTkuOTQyQzE0MjQuNzUrOTE1LjU0MisxNDY5LjI1Kzc5NC4wNDIrMTQ2OS4yNSs2MzEuNDQyWiIgZmlsbD0iI0ZGRkZGRiIgb3BhY2l0eT0iMSIvPiAgICA8L2c+PC9zdmc+);\n}\n#bd-loading-icon {\n position: fixed;\n bottom:5px;\n right:5px;\n z-index: 2147483647;\n display: block;\n width: 20px;\n height: 20px;\n background-size: 100% 100%;\n animation: bd-loading-animation 1.5s ease-in-out infinite;\n}\n\n@keyframes bd-loading-animation {\n 0% { opacity: 0.05; }\n 50% { opacity: 0.6; }\n 100% { opacity: 0.05; }\n}\n/* =============== */\n/* END V2 LOADER */";const Jt=document.createElement("div");Jt.id="bd-loading-icon",Jt.className="bd-loaderv2",Jt.title="BandagedBD is loading...";var Kt=class{static show(){document.body.appendChild(Yt),document.body.appendChild(Jt)}static hide(){Yt&&Yt.remove(),Jt&&Jt.remove()}};const{ipcRenderer:Xt}=s(0),es=f.GuildClasses;new class{constructor(){Xt.invoke("bd-config","get").then(e=>{this.hasStarted||(Object.assign(i,e),this.init())})}get dependencies(){return[{name:"jquery",type:"script",url:"//ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js",backup:"//cdn.jsdelivr.net/gh/jquery/jquery@2.0.0/jquery.min.js",local:null},{name:"bd-stylesheet",type:"style",url:"//cdn.staticaly.com/gh/{{repo}}/BetterDiscordApp/{{hash}}/dist/style.css",backup:"//rauenzi.github.io/BetterDiscordApp/dist/style.css",local:"{{localServer}}/BetterDiscordApp/dist/style.css"}]}setConfig(e){this.hasStarted||Object.assign(i,e)}async init(){if(this.hasStarted)return;this.hasStarted=!0;let e=new Promise(e=>e());if(window.$&&window.jQuery||(e=this.loadDependencies()),w.initialize(),await D.initialize(),i.version
i.version&&W.showConfirmationModal(k.Startup.updateAvailable,k.Startup.updateInfo.format({version:t}),{confirmText:k.Startup.updateNow,cancelText:k.Startup.maybeLater,onConfirm:async()=>{const e=()=>{W.alert(k.Startup.updateFailed,k.Startup.manualUpdate)};try{if(!await this.updateInjector())return e();const t=s(0).remote.app;t.relaunch(),t.exit()}catch(t){e()}}}),c.log("Startup","Initializing Settings"),T.initialize(),await this.waitForGuilds(),F.initialize(),Zt.initialize();for(const e in n)n[e].initialize();await e,c.log("Startup","Loading Plugins");const o=Qe.initialize();c.log("Startup","Loading Themes");const r=Ze.initialize();c.log("Startup","Removing Loading Icon"),Kt.hide(),c.log("Startup","Collecting Startup Errors"),W.showAddonErrors({plugins:o,themes:r});const a=w.getBDData("version");i.bbdVersion>a&&(W.showChangelogModal(l),w.setBDData("version",i.bbdVersion))}waitForGuilds(){let e=0;return new Promise(t=>{const s=function(){e++,"complete"!=document.readyState&&setTimeout(s,100);const n=es.wrapper.split(" ")[0],o=es.listItem.split(" ")[0],r=es.blobContainer.split(" ")[0];return document.querySelectorAll(`.${n} .${o} .${r}`).length>0||e>=50?t(i.deferLoaded=!0):void setTimeout(s,100)};s()})}async loadDependencies(){for(const e of this.dependencies){const t=u.formatString(i.local&&null!=e.local?e.local:e.url,{repo:i.repo,hash:i.hash,localServer:i.localServer});c.log("Startup",`Loading Resource (${t})`);const s=("script"==e.type?C.injectScript:C.linkStyle).bind(C);try{await s(e.name,t)}catch(n){const o=u.formatString(e.backup,{minified:i.minified?".min":""});c.stacktrace("Startup",`Could not load ${t}. Using backup ${o}`,n);try{await s(e.name,o)}catch(s){c.stacktrace("Startup",`Could not load ${t}. Using backup ${o}`,n),"jquery"===e.name&&W.alert(k.Startup.jqueryFailed,k.Startup.jqueryFailedDetails)}}}}async updateInjector(){const e=w.injectionPath;if(!e)return!1;const t=s(2),n=s(1),i=s(6),o=s(7),r=s(8),a=s(3),l=n.resolve(e,".."),d=n.basename(e),h="https://github.com/rauenzi/BetterDiscordApp/archive/injector.zip",u=n.resolve(l,"injector.zip"),p=n.resolve(l,"BetterDiscordApp-injector");c.log("InjectorUpdate","Downloading "+h);let m=await new Promise(e=>{a.get({url:h,encoding:null},async(s,n,i)=>{if(s||200!==n.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)),c.log("InjectorUpdate","Writing "+u),t.writeFile(u,i,t=>e(!t))})});if(!m)return m;await new Promise(e=>t.exists(p,e))&&await new Promise(e=>t.rename(p,`${p}.bak${Math.round(performance.now())}`,e));const g=await new Promise(e=>o.open(u,{lazyEntries:!0},(t,s)=>e(s)));g.on("entry",(function(e){if(e.fileName.endsWith("/"))return g.readEntry();c.log("InjectorUpdate","Extracting "+e.fileName);const s=n.resolve(l,e.fileName);r.sync(n.dirname(s)),g.openReadStream(e,(function(e,n){if(e)return m=!1;n.on("end",(function(){g.readEntry()})),n.pipe(t.createWriteStream(s))}))})),g.readEntry(),await new Promise(e=>g.once("end",e));const f=n.resolve(l,`${d}.bak${Math.round(performance.now())}`);return await new Promise(s=>t.rename(e,f,s)),c.log("InjectorUpdate",`Renaming ${n.basename(p)} to ${d}`),m=await new Promise(s=>t.rename(p,e,e=>s(!e))),m?m?(await new Promise(e=>i(f,e)),await new Promise(e=>t.unlink(u,e)),c.log("InjectorUpdate","Injector Updated!"),m):(c.err("InjectorUpdate","Something went wrong... restoring backups."),await new Promise(e=>i(p,e)),await new Promise(s=>t.rename(f,e,s)),m):(c.err("InjectorUpdate","Failed to rename the final directory"),m)}};!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 s=e[t];return"function"==typeof s?s.bind(e):s}})}}),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)}}(),function(){const e="betterdiscord/",t=s(4),n=t._load;t._load=function(t){if("betterdiscord"===t||t.startsWith(e)){if("bdapi"==t.substr(e.length))return Ke}return n.apply(this,arguments)}}(),window.BdApi=Ke,Kt.show()}]).default;