-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.js
4 lines (4 loc) · 8.5 KB
/
build.js
1
2
3
4
(()=>{var i={modules:{},baked:!1,classes:{},_current:null,_loadQueue:[],_waitForOnload:0,copy(e){if(!e||typeof e!="object"||e instanceof HTMLElement||e instanceof i.Class)return e;if(e instanceof Array){let t=[];for(let r of e)t[r]=i.copy(r);return t}else{let t={};for(let r in e)t[r]=i.copy(e[r]);return t}},module(e){if(i._current)throw new Error(`Module ${i._current.name} defines nothing`);if(i.modules[e]&&i.modules[e].body)throw new Error(`Module ${e} is already defined`);return i._current={name:e,requires:[],loaded:!1,body:null},i.modules[e]=i._current,i._loadQueue.push(i._current),i},requires(){return i._current.requires=Array.prototype.slice.call(arguments),i},defines(e){i._current.body=e,i._current=null,i._initDOMReady()},_execModules(){let e=!1;for(let t=0;t<i._loadQueue.length;t++){let r=i._loadQueue[t],n=!0;for(let o=0;o<r.requires.length;o++){let s=r.requires[o];i.modules[s]&&(i.modules[s].loaded||(n=!1))}n&&r.body&&(i._loadQueue.splice(t,1),r.loaded=!0,r.body(),e=!0,t--)}if(e)i._execModules();else if(!i.baked&&i._waitForOnload==0&&i._loadQueue.length!=0){let t=[];for(let r=0;r<i._loadQueue.length;r++){let n=[],o=i._loadQueue[r].requires;for(let s=0;s<o.length;s++){let c=i.modules[o[s]];(!c||!c.loaded)&&n.push(o[s])}t.push(i._loadQueue[r].name+" (requires: "+n.join(", ")+")")}throw`Unresolved (or circular?) dependencies. Most likely there's a name/path mismatch for one of the listed modules or a previous syntax error prevents a module from loading:
`+t.join(`
`)}},_DOMReady(){if(!i.modules["dom.ready"].loaded){if(!document.body)return setTimeout(i._DOMReady,13);i.modules["dom.ready"].loaded=!0,i._waitForOnload--,i._execModules()}return 0},_initDOMReady(){if(i.modules["dom.ready"]){i._execModules();return}i.modules["dom.ready"]={requires:[],loaded:!1,body:null},i._waitForOnload++,document.readyState==="complete"?i._DOMReady():(document.addEventListener("DOMContentLoaded",i._DOMReady,!1),window.addEventListener("load",i._DOMReady,!1))}},b=!1,P=/xyz/.test(()=>xyz)?/\bparent\b/:/.*/,z=0;i.Class=function(){};function U(e){let t=this.prototype,r={};for(let n in e)typeof e[n]=="function"&&typeof t[n]=="function"&&P.test(e[n])?(r[n]=t[n],t[n]=function(o,s){return function(){let c=this.parent;this.parent=r[o];let u=s.apply(this,arguments);return this.parent=c,u}}(n,e[n])):t[n]=e[n]}i.Class.extend=function(e){var t=this.prototype;b=!0;let r=new this;b=!1;for(let o in e)typeof e[o]=="function"&&typeof t[o]=="function"&&P.test(e[o])?r[o]=function(s,c){return function(){let u=this.parent;this.parent=t[s];var l=c.apply(this,arguments);return this.parent=u,l}}(o,e[o]):r[o]=e[o];function n(){if(!b){if(this.staticInstantiate){var o=this.staticInstantiate.apply(this,arguments);if(o)return o}for(let s in this)typeof this[s]=="object"&&(this[s]=i.copy(this[s]));this.init&&this.init.apply(this,arguments)}return this}return n.prototype=r,n.prototype.constructor=n,n.extend=i.Class.extend,n.inject=U,n.classId=r.classId=++z,n};var a=i;function $(){let e;return webpackChunkdiscord_app.push([[Symbol("Flicker")],{},t=>{e=t}]),e.c}function T(e,t,r=!1){let n=[];for(let o in e)if(e.hasOwnProperty(o)){let s=e[o].exports;s&&(s.default&&s.__esModule&&t(s.default)&&n.push(s.default),t(s)&&n.push(s))}return n}var E=$();a.module("flicker.webpack.webpackModules").requires("dom.ready").defines(()=>{a.classes.Webpack=a.Class.extend({find:e=>T(E,e)[0],findAll:e=>T(E,e),getModule:e=>{for(let t in E){let r=E[t]?.exports;if(r===e||r?.default===e)return r}},findByProps(...e){return this.find(t=>e.every(r=>t[r]!==void 0))},findByPropsAll(...e){return this.findAll(t=>e.every(r=>t[r]!==void 0))},findByPrototypes(...e){return this.find(t=>t.prototype&&e.every(r=>t.prototype[r]!==void 0))},findByDisplayName(e,t=!1){return t?this.find(r=>r?.default?.displayName===e):this.find(r=>r.displayName===e)},findByDisplayNameAll(e){return this.findAll(t=>t.displayName===e)}})});var R=new a.classes.Webpack,C={React:R.findByProps("__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED","createElement"),ReactDOM:R.findByProps("__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED","hydrate")},d=C.React,A=C;function F(e,t,r){console[r]("%cFlicker%c",`background-color: ${t}; color: white; border-radius: 4px; padding: 0px 6px 0px 6px; font-weight: bold`,"",...e)}a.module("flicker.logging").requires("dom.ready").defines(()=>{a.classes.Logger=a.Class.extend({log(...e){F(e,"#552954","log")},warn(...e){F(e,"#c11c3e","warn")},error(...e){F(e,"red","error")}})});var I=e=>typeof e.prev=="function"?e.prev:I(e.prev),L=(e,t,r)=>{let n=t[e][r];return n===void 0?t[r]:I(n)};var k=class{constructor(t,r,n){this.data={id:t,func:(o,...s)=>n(o,typeof this.prev=="function"?this.prev:this.prev.data.func,s)},this.prev=r}};var B=(e,t,r,n)=>{let o=e[n][t];if(o.data.id===r){if(typeof o.prev=="function"){e[t]=o.prev,delete e[n][t];return}e[n][t]=o.prev,e[t]=o.prev.data.func;return}let s=l=>l&&typeof l.prev=="object"?(l.data=l.prev.data,l.prev=l.prev.prev,s(l.prev)):!0,c=l=>{if(!l)throw new Error("could not find unpatch");return typeof l.prev=="object"&&l.data.id!==r?c(l.prev):s(l)},u=Object.assign({},o);c(u),e[n][t]=u,e[t]=u.data.func};var q=function(e,t,r,n,o){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(e,r):o?o.value=r:t.set(e,r),r},f=function(e,t,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(e):n?n.value:t.get(e)},v,p,_,M,S=class{constructor(t="simian"){v.add(this),p.set(this,void 0),_.set(this,void 0),q(this,p,Symbol(t),"f"),q(this,_,new Set,"f")}after(t,r,n){return f(this,v,"m",M).call(this,"AFTER",t,r,n)}before(t,r,n){return f(this,v,"m",M).call(this,"BEFORE",t,r,n)}instead(t,r,n){return f(this,v,"m",M).call(this,"INSTEAD",t,r,n)}cleanupAll(){for(let t of f(this,_,"f")){for(let r in t[f(this,p,"f")]){let n=L(f(this,p,"f"),t,r);t[r]=n,t[f(this,p,"f")][r]=void 0}t[f(this,p,"f")]=void 0,delete t[f(this,p,"f")]}f(this,_,"f").clear()}};p=new WeakMap,_=new WeakMap,v=new WeakSet,M=function(t,r,n,o){let s=n[r];if(s===void 0||typeof s!="function")throw new Error(`${r} is not a function on ${n}`);let c=Symbol();n[f(this,p,"f")]===void 0&&(n[f(this,p,"f")]={});let u;switch(t){case"AFTER":u=(h,g,m)=>{let y=g.apply(h,m),w=o.apply(h,[m,y]);return typeof w!="undefined"&&(y=w),y};break;case"BEFORE":u=(h,g,m)=>{var y;let w=m,D=(y=o.apply(h,[m]))!==null&&y!==void 0?y:m;return Array.isArray(D)&&(w=D),g.apply(h,w)};break;case"INSTEAD":u=(h,g,m)=>o.apply(h,[m,g.bind(h)]);break;default:break}let l=n[f(this,p,"f")][r];return l===void 0?l=new k(c,s,u):l=new k(c,l,u),n[f(this,p,"f")][r]=l,n[r]=function(){return l.data.func(this,...arguments)},Object.assign(n[r],s),f(this,_,"f").add(n),()=>B(n,r,c,f(this,p,"f"))};var W=S;a.module("flicker.patcher").requires("dom.ready").defines(()=>{let e=new W("Flicker");a.classes.Patcher=a.Class.extend({after:(t,r,n)=>e.after(t,r,n),before:(t,r,n)=>e.before(t,r,n),instead:(t,r,n)=>e.instead(t,r,n)})});var x=new a.classes.Webpack,G=x.findByDisplayName("FormTitle"),H=x.findByDisplayName("FormSection"),K=x.findByDisplayName("Flex"),V=x.findByDisplayName("SwitchItem"),Q=()=>d.createElement(H,null,d.createElement(G,{tag:"h1"},"Settings"),d.createElement(K,{basis:"auto",grow:1,shrink:1},d.createElement(V,{note:"Note"},"Title")));var Y=new a.classes.Webpack,J=new a.classes.Patcher;a.module("flicker.ui.settings").requires("dom.ready","flicker.patcher").defines(()=>{a.classes.Settings=a.Class.extend({initializeSettings:()=>{let e=Y.findByDisplayName("SettingsView");J.after("getPredicateSections",e.prototype,(t,r)=>{let n=r.findIndex(s=>s.section=="changelog")-1;if(n<0)return r;let o=[{section:"DIVIDER"},{section:"HEADER",label:"Flicker"},{section:"FLICKER_SETTINGS",label:"Settings",element:Q}];return r.splice(n,0,...o),r})}})});var N=["Loading Flicker...","Looking at the sky...","Watching the water unfold...","Making Discord feel alive...","Keep going keep going keep going keep going..."];function O(){new a.classes.Logger().log(N[Math.floor(Math.random()*N.length)]),window.flicker={...a,modules:{webpackModules:new a.classes.Webpack,common:A},utils:{logger:new a.classes.Logger},patcher:new a.classes.Patcher},new a.classes.Settings().initializeSettings()}if(window.flicker)throw new Error("Flicker is already injected!");O();})();
//# sourceURL=Flicker