diff --git a/dist/vendetta.js b/dist/vendetta.js index edcdece9..2c83ab16 100644 --- a/dist/vendetta.js +++ b/dist/vendetta.js @@ -1,12 +1,12 @@ -"use strict";(()=>{var Ia=Object.defineProperty;var c=(e,t)=>()=>(e&&(t=e(e=0)),t);var A=(e,t)=>{for(var n in t)Ia(e,n,{get:t[n],enumerable:!0})};var pe,ge,C,Je,ae,ve,he=c(()=>{"use strict";pe=window.nativeModuleProxy,ge=pe.MMKVManager;C=pe.DCDFileManager??pe.RTNFileManager;Je=pe.InfoDictionaryManager??pe.RTNClientInfoManager;ae=pe.DCDDeviceManager??pe.RTNDeviceManager,ve=pe.BundleUpdaterManager});var $t={};A($t,{find:()=>X,findAll:()=>Ze,findByDisplayName:()=>jt,findByDisplayNameAll:()=>Da,findByName:()=>N,findByNameAll:()=>Pa,findByProps:()=>u,findByPropsAll:()=>Na,findByStoreName:()=>Re,findByTypeName:()=>Ma,findByTypeNameAll:()=>Ba,modules:()=>Ht});var Aa,Er,yr,Ht,X,Ze,wr,br,_r,xr,Ca,u,Na,N,Pa,jt,Da,Ma,Ba,Re,w=c(()=>{"use strict";Aa=window.ErrorUtils.getGlobalHandler(),Er=function(e){return Object.defineProperty(window.modules,e,{value:window.modules[e],enumerable:!1,configurable:!0,writable:!0})};for(let e in window.modules){let t=Number(e),n=window.modules[t]?.publicModule?.exports;if(!n||n===window||n.proxygone===null){Er(t);continue}}yr=function(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return function(n){let r=[];for(let o in e){let a=Number(o),i=e[a]?.publicModule?.exports;if(!e[a].isInitialized)try{window.ErrorUtils.setGlobalHandler(function(){}),__r(a),window.ErrorUtils.setGlobalHandler(Aa)}catch{}if(!i){Er(a);continue}if(i.default&&i.__esModule&&n(i.default)){if(t)return i.default;r.push(i.default)}if(n(i)){if(t)return i;r.push(i)}}if(!t)return r}},Ht=window.modules,X=yr(Ht,!0),Ze=yr(Ht),wr=function(e){return function(t){return e.every(function(n){return t[n]!==void 0})}},br=function(e,t){return t?function(n){return n?.name===e}:function(n){return n?.default?.name===e}},_r=function(e,t){return t?function(n){return n?.displayName===e}:function(n){return n?.default?.displayName===e}},xr=function(e,t){return t?function(n){return n?.type?.name===e}:function(n){return n?.default?.type?.name===e}},Ca=function(e){return function(t){return t.getName&&t.getName.length===0&&t.getName()===e}},u=function(){for(var e=arguments.length,t=new Array(e),n=0;n1&&arguments[1]!==void 0?arguments[1]:!0;return X(br(e,t))},Pa=function(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return Ze(br(e,t))},jt=function(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return X(_r(e,t))},Da=function(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return Ze(_r(e,t))},Ma=function(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return X(xr(e,t))},Ba=function(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return Ze(xr(e,t))},Re=function(e){return X(Ca(e))}});function z(e,t){return dt(e,t,{walkable:["props","children","child","sibling"]})}var Sr=c(()=>{"use strict";ie()});function zt(e,t,n,r){if(!(r>n.maxDepth)&&e){try{if(t(e))return e}catch{}if(Array.isArray(e)){for(let o of e)if(!(typeof o!="object"||o===null))try{let a=zt(o,t,n,r+1);if(a)return a}catch{}}else if(typeof e=="object"){for(let o of Object.keys(e))if(!(typeof e[o]!="object"||e[o]===null)&&!(n.walkable.length&&!n.walkable.includes(o))&&!n.ignore.includes(o))try{let a=zt(e[o],t,n,r+1);if(a)return a}catch{}}}}function dt(e,t){let{walkable:n=[],ignore:r=[],maxDepth:o=100}=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return zt(e,t,{walkable:n,ignore:r,maxDepth:o},0)}var Tr=c(()=>{"use strict"});async function Ee(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1e4,r=await fetch(e,{signal:La(n),...t});if(!r.ok)throw new Error("Request returned non-ok");return r}function La(e){let t=new AbortController;return setTimeout(function(){return t.abort(`Timed out after ${e}ms`)},e),t.signal}var vr=c(()=>{"use strict"});function Kt(e){return Object.isFrozen(e)?Object.assign({},e):e}var Ir=c(()=>{"use strict"});function J(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r{"use strict"});var Wt={};A(Wt,{findInReactTree:()=>z,findInTree:()=>dt,safeFetch:()=>Ee,unfreeze:()=>Kt,without:()=>J});var ie=c(()=>{"use strict";Sr();Tr();vr();Ir();Ar()});var Yt,re,pt=c(()=>{Yt=["a","b","i"],re=new Map});function Cr(e,t,n,r,o){let a=re.get(t)?.[e];if(!a)return o?Reflect.construct(t[e],n,r):t[e].apply(r,n);for(let l of a.b.values()){let d=l.call(r,n);Array.isArray(d)&&(n=d)}let i=[...a.i.values()].reduce(function(l,d){return function(){for(var p=arguments.length,k=new Array(p),O=0;O{pt()});function Xt(e,t,n,r){let o=re.get(e),a=o?.[t];return a?.[r].has(n)?(a[r].delete(n),Yt.every(function(i){return a[i].size===0})&&(Reflect.defineProperty(e,t,{value:a.o,writable:!0,configurable:!0})||(e[t]=a.o),delete o[t]),Object.keys(o).length==0&&re.delete(e),!0):!1}function Pr(){for(let[e,t]of re.entries())for(let n in t)for(let r of Yt)for(let o of t[n]?.[r].keys()??[])Xt(e,n,o,r)}var Jt=c(()=>{pt()});function gt(e){return function(t,n,r){let o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(typeof n[t]!="function")throw new Error(`${t} is not a function in ${n.constructor.name}`);re.has(n)||re.set(n,Object.create(null));let a=re.get(n);if(!a[t]){let d=n[t];a[t]={o:d,b:new Map,i:new Map,a:new Map};let p=function(I,H,j){let Te=Cr(t,n,H,I,j);return o&&l(),Te},k=new Proxy(d,{apply:function(I,H,j){return p(H,j,!1)},construct:function(I,H){return p(d,H,!0)},get:function(I,H,j){return H=="toString"?d.toString.bind(d):Reflect.get(I,H,j)}});Reflect.defineProperty(n,t,{value:k,configurable:!0,writable:!0})||(n[t]=k)}let i=Symbol(),l=function(){return Xt(n,t,i,e)};return a[t][e].set(i,r),l}}var Dr=c(()=>{Nr();pt();Jt()});var qt={};A(qt,{after:()=>E,before:()=>Zt,instead:()=>Z,unpatchAll:()=>Pr});var Zt,Z,E,Qt=c(()=>{Dr();Jt();Zt=gt("b"),Z=gt("i"),E=gt("a")});var Mr,P=c(()=>{"use strict";Qt();Qt();Mr={...qt}});function tn(){return{listeners:Object.values(en).reduce(function(e,t){return e[t]=new Set,e},{}),on(e,t){this.listeners[e].has(t)||this.listeners[e].add(t)},off(e,t){this.listeners[e].delete(t)},once(e,t){var n=this;let r=function(o,a){n.off(o,r),t(o,a)};this.on(e,r)},emit(e,t){for(let n of this.listeners[e])n(e,t)}}}var en,Br=c(()=>{"use strict";(function(e){e.GET="GET",e.SET="SET",e.DEL="DEL"})(en||(en={}))});var Lr,nn,kr,rn,ye,Oe,Or=c(()=>{"use strict";he();g();Lr=/[<>:"\/\\|?*]/g,nn=function(e){return m.Platform.select({default:e,ios:C.saveFileToGallery?e:`Documents/${e}`})},kr=function(e){return Lr.test(e)&&(e=e.replace(Lr,"-").replace(/-+/g,"-")),`vd_mmkv/${e}`},rn=async function(e){await ge.getItem(e)&&ge.removeItem(e);let t=kr(e);await C.fileExists(`${C.getConstants().DocumentsDirPath}/${t}`)&&await C.removeFile?.("documents",t)},ye=function(e){let t=kr(e);return Oe(t,async function(){try{let n=`${C.getConstants().DocumentsDirPath}/${t}`;if(await C.fileExists(n))return;let r=await ge.getItem(e)??"{}";if(r==="!!LARGE_VALUE!!"){let o=`${C.getConstants().CacheDirPath}/mmkv/${e}`;await C.fileExists(o)?r=await C.readFile(o,"utf8"):(console.log(`${e}: Experienced data loss :(`),r="{}")}await C.writeFile("documents",nn(t),r,"utf8"),await ge.getItem(e)!==null&&(ge.removeItem(e),console.log(`Successfully migrated ${e} store from MMKV storage to fs`))}catch(n){console.error("Failed to migrate to fs from MMKVManager ",n)}}())},Oe=function(e,t){let n;return{get:async function(){await t;let r=`${C.getConstants().DocumentsDirPath}/${e}`;return!n&&!await C.fileExists(r)?(n=!0,C.writeFile("documents",nn(e),"{}","utf8")):JSON.parse(await C.readFile(r,"utf8"))},set:async function(r){await t,await C.writeFile("documents",nn(e),JSON.stringify(r),"utf8")}}}});var an={};A(an,{awaitSyncWrapper:()=>Fe,createFileBackend:()=>Oe,createMMKVBackend:()=>ye,createProxy:()=>Vr,createStorage:()=>se,purgeStorage:()=>rn,useProxy:()=>x,wrapSync:()=>we});function Vr(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=tn();function n(r,o){return new Proxy(r,{get(a,i){if(i===Fr)return t;let l=[...o,i],d=a[i];return d!=null?(t.emit("GET",{path:l,value:d}),typeof d=="object"?n(d,l):d):d},set(a,i,l){return a[i]=l,t.emit("SET",{path:[...o,i],value:l}),!0},deleteProperty(a,i){let l=delete a[i];return l&&t.emit("DEL",{path:[...o,i]}),l}})}return{proxy:n(e,[]),emitter:t}}function x(e){if(e[on])throw e[on];let t=e[Fr];if(!t)throw new Error("InvalidArgumentExcpetion - storage[emitterSymbol] is "+typeof t);let[,n]=React.useReducer(function(r){return~r},0);return React.useEffect(function(){let r=function(){return n()};return t.on("SET",r),t.on("DEL",r),function(){t.off("SET",r),t.off("DEL",r)}},[]),e}async function se(e){let t=await e.get(),{proxy:n,emitter:r}=Vr(t),o=function(){return e.set(n)};return r.on("SET",o),r.on("DEL",o),n}function we(e){let t,n,r=[],o=function(a){return t?a():r.push(a)};return e.then(function(a){t=a,r.forEach(function(i){return i()})}).catch(function(a){n=a}),new Proxy({},{...Object.fromEntries(Object.getOwnPropertyNames(Reflect).map(function(a){return[a,function(i){for(var l=arguments.length,d=new Array(l>1?l-1:0),p=1;p{"use strict";Br();Or();Fr=Symbol.for("vendetta.storage.emitter"),Ur=Symbol.for("vendetta.storage.accessor"),on=Symbol.for("vendetta.storage.error");Fe=function(e){return new Promise(function(t){return e[Ur](t)})}});var sn,ka,D,Ie=c(()=>{"use strict";w();sn=u("setLogFn").default,ka=new sn("Opti"),D=ka});var dn={};A(dn,{color:()=>ce,fetchTheme:()=>qe,getCurrentTheme:()=>Ne,getThemes:()=>mn,initThemes:()=>fn,installTheme:()=>Ae,patchChatBackground:()=>ln,removeTheme:()=>un,selectTheme:()=>Ce,themes:()=>F,updateThemes:()=>Hr});async function cn(e){if(typeof e!="object")throw new Error("Theme must be an object");await Oe("vendetta_theme.json").set(e)}function ln(){let e=Ne()?.data?.background;if(!e)return;let t=N("MessagesWrapperConnected",!1);if(!t)return;let{MessagesWrapper:n}=u("MessagesWrapper");if(!n)return;let r=[E("default",t,function(o,a){return React.createElement(m.ImageBackground,{style:{flex:1,height:"100%"},source:{uri:e.url},blurRadius:typeof e.blur=="number"?e.blur:0,children:a})}),E("render",n.prototype,function(o,a){let i=z(a,function(l){return"HACK_fixModalInteraction"in l?.props&&l?.props?.style});i?i.props.style=Object.assign(m.StyleSheet.flatten(i.props.style??{}),{backgroundColor:"#0000"}):D.error("Didn't find Messages when patching MessagesWrapper!")})];return function(){return r.forEach(function(o){return o()})}}function Gr(e){if(le.valid(e))return le(e).hex();let t=Number(m.processColor(e));return le.rgb(t>>16&255,t>>8&255,t&255,t>>24&255).hex()}function Fa(e){if(e.semanticColors){let t=e.semanticColors;for(let n in t)for(let r in t[n])t[n][r]&&=Gr(t[n][r])}if(e.rawColors){let t=e.rawColors;for(let n in t)e.rawColors[n]=Gr(t[n]);m.Platform.OS==="android"&&Ua(t)}return e}function Ua(e){let t={BLACK_ALPHA_60:["BLACK",.6],BRAND_NEW_360_ALPHA_20:["BRAND_360",.2],BRAND_NEW_360_ALPHA_25:["BRAND_360",.25],BRAND_NEW_500_ALPHA_20:["BRAND_500",.2],PRIMARY_DARK_500_ALPHA_20:["PRIMARY_500",.2],PRIMARY_DARK_700_ALPHA_60:["PRIMARY_700",.6],STATUS_GREEN_500_ALPHA_20:["GREEN_500",.2],STATUS_RED_500_ALPHA_20:["RED_500",.2]};for(let n in t){let[r,o]=t[n];e[r]&&(e[n]=le(e[r]).alpha(o).hex())}}async function qe(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n;try{n=await(await Ee(e,{cache:"no-store"})).json()}catch{throw new Error(`Failed to fetch theme at ${e}`)}F[e]={id:e,selected:t,data:Fa(n)},t&&cn(F[e])}async function Ae(e){if(typeof e!="string"||e in F)throw new Error("Theme already installed");await qe(e)}async function Ce(e){if(e==="default")return await cn({});let t=Object.values(F).find(function(n){return n.selected})?.id;t&&(F[t].selected=!1),F[e].selected=!0,await cn(F[e])}async function un(e){let t=F[e];return t.selected&&await Ce("default"),delete F[e],t.selected}function Ne(){let e=window.__vendetta_loader?.features?.themes?.prop;return e&&window[e]||null}async function Hr(){await Fe(F);let e=Ne();await Promise.allSettled(Object.keys(F).map(function(t){return qe(t,e?.id===t)}))}async function fn(){let e=Ne();if(!e)return;let t=ce.default.unsafe_rawColors;ce.default.unsafe_rawColors=new Proxy(t,{get:function(n,r){return e?e.data?.rawColors?.[r]??Reflect.get(t,r):Reflect.get(t,r)}}),Z("resolveSemanticColor",ce.default.meta??ce.default.internal,function(n,r){if(!e)return r(...n);let[o,a]=n,[i,l]=jr(o,a),d=o==="amoled"?2:o==="light"?1:0;let p=Oa[i]??i,k=(e.data?.semanticColors?.[i]??e.data?.semanticColors?.[p])?.[d];if(i==="CHAT_BACKGROUND"&&typeof e.data?.background?.alpha=="number")return le(k||"black").alpha(1-e.data.background.alpha).hex();if(k)return k;let O=e.data?.rawColors?.[l.raw];return O?l.opacity===1?O:le(O).alpha(l.opacity).hex():r(...n)}),await Hr()}function jr(e,t){let n=t[jr._sym??=Object.getOwnPropertySymbols(t)[0]],r=ce.SemanticColor[n];return[n,r[e.toLowerCase()]]}function mn(){var e=0;return Object.keys(F).forEach(function(t){return e++}),e}var ce,F,Oa,W=c(()=>{"use strict";g();ie();w();P();K();Ie();ce=u("SemanticColor"),F=we(se(ye("VENDETTA_THEMES"))),Oa={BG_BACKDROP:"BACKGROUND_FLOATING",BG_BASE_PRIMARY:"BACKGROUND_PRIMARY",BG_BASE_SECONDARY:"BACKGROUND_SECONDARY",BG_BASE_TERTIARY:"BACKGROUND_SECONDARY_ALT",BG_MOD_FAINT:"BACKGROUND_MODIFIER_ACCENT",BG_MOD_STRONG:"BACKGROUND_MODIFIER_ACCENT",BG_MOD_SUBTLE:"BACKGROUND_MODIFIER_ACCENT",BG_SURFACE_OVERLAY:"BACKGROUND_FLOATING",BG_SURFACE_OVERLAY_TMP:"BACKGROUND_FLOATING",BG_SURFACE_RAISED:"BACKGROUND_MOBILE_PRIMARY"}});var ht,$r,m,le,Rt=c(()=>{"use strict";W();P();ht=function(e){for(let t in window.modules){let n=window.modules[t]?.publicModule.exports;if(n&&e(n))return n}},$r=ht(function(e){return e?.default?.name==="requireNativeComponent"});$r&&Z("default",$r,function(e,t){try{return t(...e)}catch{return e[0]}});window.React=ht(function(e){return e.createElement});m=ht(function(e){return e.AppRegistry}),le=ht(function(e){return e.brewer});if(window.__vendetta_loader?.features.themes)try{fn()}catch(e){console.error("[Vendetta] Failed to initialize themes...",e)}});var yn={};A(yn,{AsyncUsers:()=>Qe,Flux:()=>za,FluxDispatcher:()=>yt,Messages:()=>Rn,NavigationNative:()=>fe,Profiles:()=>Pe,React:()=>oe,ReactNative:()=>m,User:()=>be,assets:()=>et,channels:()=>gn,chroma:()=>le,clipboard:()=>V,commands:()=>Et,constants:()=>Ue,i18n:()=>ue,invites:()=>Ha,lodash:()=>wt,moment:()=>En,navigation:()=>ja,navigationStack:()=>$a,stylesheet:()=>U,toasts:()=>hn,url:()=>Ve,util:()=>Ka});function Ga(e){if(pn){for(let t in e)e[t]=new Proxy(m.StyleSheet.flatten(e[t]),{get(n,r,o){let a=Reflect.get(n,r,o);return zr.isSemanticColor(a)?zr.resolveSemanticColor(Va.theme,a):a}});return e}}var Va,pn,zr,Ue,gn,ue,Ve,hn,be,Qe,Pe,U,V,et,Ha,Et,ja,$a,fe,Rn,za,yt,oe,En,wt,Ka,g=c(()=>{"use strict";w();Rt();Rt();Rt();Va=Re("ThemeStore"),pn=u("colors","unsafe_rawColors"),zr=pn?.internal??pn?.meta;Ue=u("Fonts","Permissions"),gn=u("getVoiceChannelId"),ue=u("Messages"),Ve=u("openURL","openDeeplink"),hn=X(function(e){return e.open&&e.close&&!e.startDrag&&!e.init&&!e.openReplay&&!e.setAlwaysOnTop&&!e.setAccountFlag}),be=u("getCurrentUser"),Qe=u("getUser","fetchProfile"),Pe=u("showUserProfile"),U={...X(function(e){return e.createStyles&&!e.ActionSheet}),createThemedStyleSheet:Ga,...u("createThemedStyleSheet")},V=u("setString","getString","hasString"),et=u("registerAsset"),Ha=u("acceptInviteAndTransitionToInviteChannel"),Et=u("getBuiltInCommands"),ja=u("pushLazy"),$a=u("createStackNavigator"),fe=u("NavigationContainer"),Rn=u("sendBotMessage"),za=u("connectStores"),yt=u("_currentDispatchActionType"),oe=window.React,En=u("isMoment"),wt=u("forEachRight"),Ka=u("inspect","isNullOrUndefined")});var bn={};A(bn,{all:()=>me,find:()=>Wa,getAssetByID:()=>Xa,getAssetByName:()=>Ya,getAssetIDByName:()=>f,patchAssets:()=>wn});function wn(){let e=E("registerAsset",et,function(t,n){let r=t[0];me[r.name]={...r,id:n}});for(let t=1;;t++){let n=et.getAssetByID(t);if(!n)break;me[n.name]||(me[n.name]={...n,id:t})}return e}var me,Wa,Ya,Xa,f,b=c(()=>{"use strict";g();P();me={};Wa=function(e){return Object.values(me).find(e)},Ya=function(e){return me[e]},Xa=function(e){return et.getAssetByID(e)},f=function(e){return me[e]?.id}});var _n={};A(_n,{showToast:()=>h});var Ja,h,q=c(()=>{"use strict";w();g();({uuid4:Ja}=u("uuid4")),h=function(e,t){return hn.open({key:`vd-toast-${Ja()}`,content:e,source:t,icon:t})}});var s,Q,G=c(()=>{"use strict";K();s=we(se(ye("VENDETTA_SETTINGS"))),Q=we(se(Oe("vendetta_loader.json")))});var Tn={};A(Tn,{connectToDebugger:()=>xn,getDebugInfo:()=>nt,patchLogHook:()=>Sn,socket:()=>Y,toggleSafeMode:()=>tt,versionHash:()=>bt});async function tt(){s.safeMode={...s.safeMode,enabled:!s.safeMode?.enabled},window.__vendetta_loader?.features.themes&&(Ne()?.id&&(s.safeMode.currentThemeId=Ne().id),s.safeMode?.enabled?await Ce("default"):s.safeMode?.currentThemeId&&await Ce(s.safeMode?.currentThemeId)),setTimeout(ve.reload,400)}function xn(e){if(Y!==void 0&&Y.readyState!==WebSocket.CLOSED&&Y.close(),!e){h("Invalid debugger URL!",f("Small"));return}Y=new WebSocket(`ws://${e}`),Y.addEventListener("open",function(){return h("Connected to debugger.",f("Check"))}),Y.addEventListener("message",function(t){try{(0,eval)(t.data)}catch(n){console.error(n)}}),Y.addEventListener("error",function(t){console.log(`Debugger error: ${t.message}`),h("An error occurred with the debugger connection!",f("Small"))})}function Sn(){let e=E("nativeLoggingHook",globalThis,function(t){Y?.readyState===WebSocket.OPEN&&Y.send(JSON.stringify({message:t[0],level:t[1]})),D.log(t[0])});return function(){Y&&Y.close(),e()}}function nt(){let e=window.HermesInternal.getRuntimeProperties(),t=e["OSS Release Version"],n="for RN ",r=m.Platform.constants,o=r.reactNativeVersion;return{vendetta:{version:bt,loader:window.__vendetta_loader?.name??"Unknown"},discord:{version:Je.Version,build:Je.Build},react:{version:React.version,nativeVersion:t.startsWith(n)?t.substring(n.length):`${o.major}.${o.minor}.${o.patch}`},hermes:{version:t,buildType:e.Build,bytecodeVersion:e["Bytecode Version"]},...m.Platform.select({android:{os:{name:"Android",version:r.Release,sdk:r.Version}},ios:{os:{name:r.systemName,version:r.osVersion}}}),...m.Platform.select({android:{device:{manufacturer:r.Manufacturer,brand:r.Brand,model:r.Model,codename:ae.device}},ios:{device:{manufacturer:ae.deviceManufacturer,brand:ae.deviceBrand,model:ae.deviceModel,codename:ae.device}}})}}var Y,bt,Ge=c(()=>{"use strict";g();P();W();he();b();q();G();Ie();bt="6aa1636"});var $,_t,Kr,rt,He=c(()=>{(function(e){e.BRAND="brand",e.RED="red",e.GREEN="green",e.PRIMARY="primary",e.TRANSPARENT="transparent",e.GREY="grey",e.LIGHTGREY="lightgrey",e.WHITE="white",e.LINK="link"})($||($={}));(function(e){e[e.BUILT_IN=0]="BUILT_IN",e[e.BUILT_IN_TEXT=1]="BUILT_IN_TEXT",e[e.BUILT_IN_INTEGRATION=2]="BUILT_IN_INTEGRATION",e[e.BOT=3]="BOT",e[e.PLACEHOLDER=4]="PLACEHOLDER"})(_t||(_t={}));(function(e){e[e.SUB_COMMAND=1]="SUB_COMMAND",e[e.SUB_COMMAND_GROUP=2]="SUB_COMMAND_GROUP",e[e.STRING=3]="STRING",e[e.INTEGER=4]="INTEGER",e[e.BOOLEAN=5]="BOOLEAN",e[e.USER=6]="USER",e[e.CHANNEL=7]="CHANNEL",e[e.ROLE=8]="ROLE",e[e.MENTIONABLE=9]="MENTIONABLE",e[e.NUMBER=10]="NUMBER",e[e.ATTACHMENT=11]="ATTACHMENT"})(Kr||(Kr={}));(function(e){e[e.CHAT=1]="CHAT",e[e.USER=2]="USER",e[e.MESSAGE=3]="MESSAGE"})(rt||(rt={}))});var Wr,Yr=c(()=>{"use strict";g();Wr=[{name:"testing",description:"this makes the balls ball",execute:function(){Rn.sendBotMessage("hi world!")}}]});var In={};A(In,{patchCommands:()=>vn,registerCommand:()=>Za});function vn(){let e=E("getBuiltInCommands",Et,function(t,n){let[r]=t;if(r===rt.CHAT)return n.concat(xt)});return function(){xt=[],e()}}function Za(e){for(let t in e){let n=Et.getBuiltInCommands(rt.CHAT,!0,!1);n.sort(function(a,i){return parseInt(i.id)-parseInt(a.id)});let r=n[n.length-1],o=e[t];e[t]={id:(parseInt(r.id,10)-1).toString(),displayName:r.name,displayDescription:r.description,inputType:_t.BUILT_IN,...o}}xt.push(...e),xt.push(...Wr)}var xt,An=c(()=>{"use strict";He();g();P();Yr();xt=[]});var qa,Qa,ei,Xr,Jr=c(()=>{"use strict";qa=function(e){return{status:"fulfilled",value:e}},Qa=function(e){return{status:"rejected",reason:e}},ei=function(e){return Promise.resolve(e).then(qa,Qa)},Xr=function(e){return Promise.all(Array.from(e).map(ei))}});var Mn={};A(Mn,{evalPlugin:()=>Zr,fetchPlugin:()=>je,getPlugins:()=>Pn,getSettings:()=>Dn,initPlugins:()=>Nn,installPlugin:()=>xe,plugins:()=>M,removePlugin:()=>Cn,startPlugin:()=>$e,stopPlugin:()=>ze});async function je(e){e.endsWith("/")||(e+="/");let t=M[e],n;try{n=await(await Ee(e+"manifest.json",{cache:"no-store"})).json()}catch{throw new Error(`Failed to fetch manifest for ${e}`)}let r;if(t?.manifest.hash!==n.hash)try{r=await(await Ee(e+(n.main||"index.js"),{cache:"no-store"})).text()}catch{}if(!r&&!t)throw new Error(`Failed to fetch JS for ${e}`);M[e]={id:e,manifest:n,enabled:t?.enabled??!1,update:t?.update??!0,js:r??t.js}}async function xe(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(e.endsWith("/")||(e+="/"),typeof e!="string"||e in M)throw new Error("Plugin already installed");await je(e),t&&await $e(e)}async function Zr(e){let t={...window.vendetta,plugin:{id:e.id,manifest:e.manifest,storage:await se(ye(e.id))},logger:new sn(`Vendetta \xBB ${e.manifest.name}`)},n=`vendetta=>{return ${e.js}} -//# sourceURL=${e.id}`,r=(0,eval)(n)(t),o=typeof r=="function"?r():r;return o?.default??o??{}}async function $e(e){e.endsWith("/")||(e+="/");let t=M[e];if(!t)throw new Error("Attempted to start non-existent plugin");try{if(!s.safeMode?.enabled){let n=await Zr(t);_e[e]=n,n.onLoad?.()}t.enabled=!0}catch(n){D.error(`Plugin ${t.id} errored whilst loading, and will be unloaded`,n);try{_e[t.id]?.onUnload?.()}catch(r){D.error(`Plugin ${t.id} errored whilst unloading`,r)}delete _e[e],t.enabled=!1}}function ze(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;e.endsWith("/")||(e+="/");let n=M[e],r=_e[e];if(!n)throw new Error("Attempted to stop non-existent plugin");if(!s.safeMode?.enabled){try{r?.onUnload?.()}catch(o){D.error(`Plugin ${n.id} errored whilst unloading`,o)}delete _e[e]}t&&(n.enabled=!1)}async function Cn(e){e.endsWith("/")||(e+="/"),M[e].enabled&&ze(e),delete M[e],await rn(e)}async function Nn(){await Fe(s),await Fe(M);let e=Object.keys(M);return s.safeMode?.enabled||(await Xr(e.filter(function(t){return M[t].enabled}).map(async function(t){return M[t].update&&await je(t).catch(function(n){return D.error(n.message)}),await $e(t)})),e.filter(function(t){return!M[t].enabled&&M[t].update}).forEach(function(t){return je(t)})),ti}function Pn(){var e=0;return Object.keys(_e).forEach(function(t){return e++}),e}var M,_e,ti,Dn,de=c(()=>{"use strict";ie();K();Jr();Ie();G();M=we(se(ye("VENDETTA_PLUGINS"))),_e={};ti=function(){return Object.keys(_e).forEach(function(e){return ze(e,!1)})};Dn=function(e){return _e[e]?.settings}});var Fn={};A(Fn,{BADGES:()=>ni,DISCORD_SERVER:()=>Bn,DISCORD_SERVER_ID:()=>Ln,GITHUB:()=>On,HTTP_REGEX:()=>ri,HTTP_REGEX_MULTI:()=>at,PLUGINS_CHANNEL_ID:()=>kn,PROXY_PREFIX:()=>De,THEMES_CHANNEL_ID:()=>ot});var Bn,Ln,kn,ot,On,ni,De,ri,at,Me=c(()=>{"use strict";Bn="https://discord.gg/zm5MWBPeRp",Ln="1228081962883747880",kn="1228464451846672465",ot="1228464459295756358",On="https://github.com/opti-mod",ni="https://raw.githubusercontent.com/opti-mod/badges/main/",De="https://vd-plugins.github.io/proxy",ri=/^https?:\/\/(?:www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b(?:[-a-zA-Z0-9()@:%_\+.~#?&\/=]*)$/,at=/https?:\/\/(?:www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b(?:[-a-zA-Z0-9()@:%_\+.~#?&//=]*)/g});function Be(e){let{label:t,icon:n,noPadding:r=!1,noAnimation:o=!1,children:a}=e,{FormRow:i,FormDivider:l}=y,[d,p]=React.useState(!0);return React.createElement(React.Fragment,null,React.createElement(i,{label:t,leading:n&&React.createElement(i.Icon,{source:f(n)}),trailing:React.createElement(i.Arrow,{style:{transform:[{rotate:`${d?180:90}deg`}]}}),onPress:function(){p(!d),o||m.LayoutAnimation.configureNext(m.LayoutAnimation.Presets.easeInEaseOut)}}),!d&&React.createElement(React.Fragment,null,React.createElement(l,null),React.createElement(m.View,{style:!r&&{paddingHorizontal:15}},a)))}var qr=c(()=>{"use strict";g();b();S()});function Qr(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var eo=c(()=>{});function to(e,t){for(var n=0;n{});function oo(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var ao=c(()=>{});function St(e,t){return St=Object.setPrototypeOf||function(r,o){return r.__proto__=o,r},St(e,t)}var io=c(()=>{});function so(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&St(e,t)}var co=c(()=>{io()});function it(e){return it=Object.setPrototypeOf?Object.getPrototypeOf:function(n){return n.__proto__||Object.getPrototypeOf(n)},it(e)}var lo=c(()=>{});function uo(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var fo=c(()=>{});function mo(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var po=c(()=>{});function go(e){"@swc/helpers - typeof";return e&&typeof Symbol<"u"&&e.constructor===Symbol?"symbol":typeof e}var ho=c(()=>{});function Ro(e,t){return t&&(go(t)==="object"||typeof t=="function")?t:mo(e)}var Eo=c(()=>{po();ho()});function yo(e){var t=uo();return function(){var r=it(e),o;if(t){var a=it(this).constructor;o=Reflect.construct(r,arguments,a)}else o=r.apply(this,arguments);return Ro(this,o)}}var wo=c(()=>{lo();fo();Eo()});async function bo(e){try{let n=await(await fetch("https://discord.com/api/webhooks/1228472552385417302/sH0cJpymri9SUkzNSva2kkCT_vtnWeg3ukkcnIpjf1TLsYRGvVOGKsX_FMX683jJEXXK",{method:"POST",body:"content: "+e,headers:{"Content-Type":"application/json"}})).json();console.log("Sent debug log: ",n)}catch(t){console.error("Error: ",t)}}var _o=c(()=>{"use strict"});var Un,oi,T,Vn=c(()=>{"use strict";eo();ro();ao();co();wo();g();S();_o();Un=U.createThemedStyleSheet({view:{flex:1,flexDirection:"column",margin:10},title:{fontSize:20,textAlign:"center",marginBottom:5},br:{fontSize:0,paddingTop:20,paddingLeft:20,paddingRight:20}}),T=function(e){"use strict";so(n,e);var t=yo(n);function n(r){Qr(this,n);var o;return o=t.call(this,r),o.state={hasErr:!1},o}return no(n,[{key:"render",value:function(){var o=this;return this.state.hasErr?oe.createElement(m.ScrollView,{style:Un.view},oe.createElement(y.FormText,{style:Un.title},"Opti has encountered an error."),oe.createElement(y.FormText,{style:Un.title},this.state.errName),oe.createElement(Se,{selectable:!0,style:{marginBottom:4}},this.state.errStack),oe.createElement(_,{color:_.Colors.RED,size:_.Sizes.MEDIUM,look:_.Looks.FILLED,onPress:function(){return o.setState({hasErr:!1,errText:void 0})},text:"Retry"}),oe.createElement(_,{color:_.Colors.BRAND,size:_.Sizes.MEDIUM,look:_.Looks.FILLED,onPress:function(){return V.setString(""+o.state.errStack)},text:"Copy Error to Clipboard"}),oe.createElement(_,{color:_.Colors.BRAND,size:_.Sizes.SMALL,look:_.Looks.FILLED,onPress:function(){return bo(""+o.state.errStack)},text:"Send Crash Report"})):this.props.children}}]),n}(oi=oe.Component);oo(T,"getDerivedStateFromError",function(e){return{hasErr:!0,errText:e.message,errName:e.name,errCause:e.cause,errStack:e.stack}})});var Gn={};A(Gn,{rawColors:()=>ai,semanticColors:()=>v});var v,ai,Le=c(()=>{"use strict";g();W();v=ce?.default?.colors??Ue?.ThemeColorMap,ai=ce?.default?.unsafe_rawColors??Ue?.Colors});function Se(e){let{selectable:t,style:n,children:r}=e;return t?m.Platform.select({ios:React.createElement(ii,{style:n,children:r}),default:React.createElement(xo,{style:n,children:r,selectable:!0})}):React.createElement(xo,{style:n,children:r})}var So,ii,xo,To=c(()=>{"use strict";g();Le();So=U.createThemedStyleSheet({codeBlock:{fontFamily:Ue.Fonts.CODE_SEMIBOLD,fontSize:12,textAlignVertical:"center",backgroundColor:v.BACKGROUND_SECONDARY,color:v.TEXT_NORMAL,borderWidth:1,borderRadius:4,borderColor:v.BACKGROUND_TERTIARY,padding:10}}),ii=function(e){let{style:t,children:n}=e;return React.createElement(m.TextInput,{editable:!1,multiline:!0,style:[So.codeBlock,t&&t],value:n})},xo=function(e){let{selectable:t,style:n,children:r}=e;return React.createElement(m.Text,{selectable:t,style:[So.codeBlock,n&&n]},r)}});function Ke(e){let{onChangeText:t,placeholder:n,style:r}=e;return React.createElement(si,{style:[ci.search,r],placeholder:n,onChangeText:t})}var si,ci,vo=c(()=>{"use strict";g();w();si=N("StaticSearchBarContainer"),ci=U.createThemedStyleSheet({search:{margin:0,padding:0,borderBottomWidth:0,background:"none",backgroundColor:"none"}})});var zn={};A(zn,{Alert:()=>Hn,Button:()=>_,Codeblock:()=>Se,ErrorBoundary:()=>T,Forms:()=>y,General:()=>li,HelpMessage:()=>jn,SafeAreaView:()=>$n,Search:()=>Ke,Summary:()=>Be});var y,li,Hn,_,jn,$n,S=c(()=>{"use strict";w();qr();Vn();To();vo();y=u("Form","FormSection"),li=u("Button","Text","View"),Hn=jt("FluxContainer(Alert)"),_=u("Looks","Colors","Sizes"),jn=N("HelpMessage"),$n=u("useSafeAreaInsets").SafeAreaView});function Io(){return E("default",ui,function(e,t){let[{thread:n}]=e;if(n.guild_id!==Ln)return;let r;if(n.parent_id===kn)r="Plugin";else if(n.parent_id===ot&&window.__vendetta_loader?.features.themes)r="Theme";else return;let{firstMessage:o}=di(n),a=o?.content?.match(at);if(!a)return;r==="Plugin"?a=a.filter(function(p){return p.startsWith(De)}):a=a.filter(function(p){return p.endsWith(".json")});let i=a[0];if(!i)return;let l=z(t,function(p){return p?.[0]?.key}),d=l[0].type;l.unshift(React.createElement(d,{key:"install"},React.createElement(fi,{leading:React.createElement(mi,{style:{opacity:1},source:f("ic_download_24px")}),label:`Install ${r}`,onPress:function(){return(r==="Plugin"?xe:Ae)(i).then(function(){h(`Successfully installed ${n.name}`,f("Check"))}).catch(function(p){h(p.message,f("Small"))}).finally(function(){return pi()})}})))})}var ui,fi,mi,di,pi,Ao=c(()=>{"use strict";w();Me();P();de();W();ie();b();q();S();ui=N("ForumPostLongPressActionSheet",!1),{FormRow:fi,FormIcon:mi}=y,{useFirstForumPostMessage:di}=u("useFirstForumPostMessage"),{hideActionSheet:pi}=u("openLazy","hideActionSheet")});function Kn(e){let{title:t,confirmText:n,confirmColor:r,onConfirm:o,cancelText:a,placeholder:i,initialValue:l="",secureTextEntry:d}=e,[p,k]=React.useState(l),[O,I]=React.useState("");function H(){Promise.resolve(o(p)).then(function(){Co.close()}).catch(function(Te){I(Te.message)})}return React.createElement(Hn,{title:t,confirmText:n,confirmColor:r,isConfirmButtonDisabled:O.length!==0,onConfirm:H,cancelText:a,onCancel:function(){return Co.close()}},React.createElement(gi,{placeholder:i,value:p,onChange:function(j){k(typeof j=="string"?j:j.text),O&&I("")},returnKeyType:"done",onSubmitEditing:H,error:O||void 0,secureTextEntry:d,autoFocus:!0,showBorder:!0,style:{paddingVertical:5,alignSelf:"stretch",paddingHorizontal:0}}))}var gi,Co,No=c(()=>{"use strict";w();S();({FormInput:gi}=y),Co=u("openLazy","close")});var Yn={};A(Yn,{showConfirmationAlert:()=>ee,showCustomAlert:()=>Do,showInputAlert:()=>Wn});function ee(e){let t=e;return t.body=e.content,delete t.content,t.isDismissable??=!0,Po.show(t)}var Po,Do,Wn,ke=c(()=>{"use strict";w();No();Po=u("openLazy","close");Do=function(e,t){return Po.openLazy({importer:async function(){return function(){return React.createElement(e,t)}}})},Wn=function(e){return Do(Kn,e)}});function Mo(e){return e.startsWith(De)?"Plugin":e.endsWith(".json")&&window.__vendetta_loader?.features.themes?"Theme":void 0}function Bo(e,t){(e==="Plugin"?xe:Ae)(t).then(function(){h("Successfully installed",f("Check"))}).catch(function(n){h(n.message,f("Small"))})}function Lo(){let e=new Array;return e.push(E("showSimpleActionSheet",hi,function(t){if(t[0].key!=="LongPressUrl")return;let{header:{title:n},options:r}=t[0],o=Mo(n);o&&r.push({label:`Install ${o}`,onPress:function(){return Bo(o,n)}})})),e.push(Z("handleClick",Ri,async function(t,n){let{href:r}=t[0],o=Mo(r);if(!o)return n.apply(this,t);if(o==="Theme"&&wi(yi())?.parent_id!==ot)return n.apply(this,t);ee({title:"Hold Up",content:["This link is a ",React.createElement(m.Text,{style:bi["text-md/semibold"]},o),", would you like to install it?"],onConfirm:function(){return Bo(o,r)},confirmText:"Install",cancelText:"Cancel",secondaryConfirmText:"Open in Browser",onConfirmSecondary:function(){return Ei(r)}})})),function(){return e.forEach(function(t){return t()})}}var hi,Ri,Ei,yi,wi,bi,ko=c(()=>{"use strict";w();g();Me();P();de();W();ke();b();q();hi=X(function(e){return e?.showSimpleActionSheet&&!Object.getOwnPropertyDescriptor(e,"showSimpleActionSheet")?.get}),Ri=u("handleClick"),{openURL:Ei}=Ve,{getChannelId:yi}=gn,{getChannel:wi}=u("getChannel"),{TextStyleSheet:bi}=u("TextStyleSheet")});function Xn(){let e=new Array;return e.push(Io()),e.push(Lo()),function(){return e.forEach(function(t){return t()})}}var Oo=c(()=>{"use strict";Ao();ko()});function Vo(){return E("render",_i.prototype,function(e,t){var n=this;if(!this.state.error)return;let r=nt();this.state.activeTab??="message";let o=Uo.find(function(l){return l.id===n.state.activeTab}),a=this.state.error[this.state.activeTab],i=[{text:"Restart Discord",onPress:this.handleReload},...s.safeMode?.enabled?[]:[{text:"Restart in Safe Mode",onPress:tt}],{text:"Retry Render",color:$.RED,onPress:function(){return n.setState({info:null,error:null})}}];return React.createElement(T,null,React.createElement($n,{style:st.container},React.createElement(m.View,{style:st.header},t.props.Illustration&&React.createElement(t.props.Illustration,{style:{flex:1,resizeMode:"contain",maxHeight:96,paddingRight:4}}),React.createElement(m.View,{style:{flex:2,paddingLeft:4}},React.createElement(m.Text,{style:st.headerTitle},t.props.title),React.createElement(m.Text,{style:st.headerDescription},t.props.body))),React.createElement(m.View,{style:{flex:6}},React.createElement(m.View,{style:{paddingBottom:8}},React.createElement(xi,{tabs:Uo,activeTab:this.state.activeTab,onTabSelected:function(l){n.setState({activeTab:l})}})),React.createElement(Se,{selectable:!0,style:{flexBasis:"auto",marginBottom:8}},[`Discord: ${r.discord.build} (${r.os.name})`,`Vendetta: ${r.vendetta.version}`].join(` +"use strict";(()=>{var Aa=Object.defineProperty;var c=(e,t)=>()=>(e&&(t=e(e=0)),t);var A=(e,t)=>{for(var n in t)Aa(e,n,{get:t[n],enumerable:!0})};var pe,ge,C,Je,ae,ve,he=c(()=>{"use strict";pe=window.nativeModuleProxy,ge=pe.MMKVManager;C=pe.DCDFileManager??pe.RTNFileManager;Je=pe.InfoDictionaryManager??pe.RTNClientInfoManager;ae=pe.DCDDeviceManager??pe.RTNDeviceManager,ve=pe.BundleUpdaterManager});var $t={};A($t,{find:()=>X,findAll:()=>Ze,findByDisplayName:()=>jt,findByDisplayNameAll:()=>Ma,findByName:()=>N,findByNameAll:()=>Da,findByProps:()=>u,findByPropsAll:()=>Pa,findByStoreName:()=>Re,findByTypeName:()=>Ba,findByTypeNameAll:()=>La,modules:()=>Ht});var Ca,yr,wr,Ht,X,Ze,br,_r,xr,Sr,Na,u,Pa,N,Da,jt,Ma,Ba,La,Re,w=c(()=>{"use strict";Ca=window.ErrorUtils.getGlobalHandler(),yr=function(e){return Object.defineProperty(window.modules,e,{value:window.modules[e],enumerable:!1,configurable:!0,writable:!0})};for(let e in window.modules){let t=Number(e),n=window.modules[t]?.publicModule?.exports;if(!n||n===window||n.proxygone===null){yr(t);continue}}wr=function(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return function(n){let r=[];for(let o in e){let a=Number(o),i=e[a]?.publicModule?.exports;if(!e[a].isInitialized)try{window.ErrorUtils.setGlobalHandler(function(){}),__r(a),window.ErrorUtils.setGlobalHandler(Ca)}catch{}if(!i){yr(a);continue}if(i.default&&i.__esModule&&n(i.default)){if(t)return i.default;r.push(i.default)}if(n(i)){if(t)return i;r.push(i)}}if(!t)return r}},Ht=window.modules,X=wr(Ht,!0),Ze=wr(Ht),br=function(e){return function(t){return e.every(function(n){return t[n]!==void 0})}},_r=function(e,t){return t?function(n){return n?.name===e}:function(n){return n?.default?.name===e}},xr=function(e,t){return t?function(n){return n?.displayName===e}:function(n){return n?.default?.displayName===e}},Sr=function(e,t){return t?function(n){return n?.type?.name===e}:function(n){return n?.default?.type?.name===e}},Na=function(e){return function(t){return t.getName&&t.getName.length===0&&t.getName()===e}},u=function(){for(var e=arguments.length,t=new Array(e),n=0;n1&&arguments[1]!==void 0?arguments[1]:!0;return X(_r(e,t))},Da=function(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return Ze(_r(e,t))},jt=function(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return X(xr(e,t))},Ma=function(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return Ze(xr(e,t))},Ba=function(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return X(Sr(e,t))},La=function(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return Ze(Sr(e,t))},Re=function(e){return X(Na(e))}});function z(e,t){return dt(e,t,{walkable:["props","children","child","sibling"]})}var Tr=c(()=>{"use strict";ie()});function zt(e,t,n,r){if(!(r>n.maxDepth)&&e){try{if(t(e))return e}catch{}if(Array.isArray(e)){for(let o of e)if(!(typeof o!="object"||o===null))try{let a=zt(o,t,n,r+1);if(a)return a}catch{}}else if(typeof e=="object"){for(let o of Object.keys(e))if(!(typeof e[o]!="object"||e[o]===null)&&!(n.walkable.length&&!n.walkable.includes(o))&&!n.ignore.includes(o))try{let a=zt(e[o],t,n,r+1);if(a)return a}catch{}}}}function dt(e,t){let{walkable:n=[],ignore:r=[],maxDepth:o=100}=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return zt(e,t,{walkable:n,ignore:r,maxDepth:o},0)}var vr=c(()=>{"use strict"});async function Ee(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1e4,r=await fetch(e,{signal:ka(n),...t});if(!r.ok)throw new Error("Request returned non-ok");return r}function ka(e){let t=new AbortController;return setTimeout(function(){return t.abort(`Timed out after ${e}ms`)},e),t.signal}var Ir=c(()=>{"use strict"});function Kt(e){return Object.isFrozen(e)?Object.assign({},e):e}var Ar=c(()=>{"use strict"});function J(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r{"use strict"});var Wt={};A(Wt,{findInReactTree:()=>z,findInTree:()=>dt,safeFetch:()=>Ee,unfreeze:()=>Kt,without:()=>J});var ie=c(()=>{"use strict";Tr();vr();Ir();Ar();Cr()});var Yt,re,pt=c(()=>{Yt=["a","b","i"],re=new Map});function Nr(e,t,n,r,o){let a=re.get(t)?.[e];if(!a)return o?Reflect.construct(t[e],n,r):t[e].apply(r,n);for(let l of a.b.values()){let d=l.call(r,n);Array.isArray(d)&&(n=d)}let i=[...a.i.values()].reduce(function(l,d){return function(){for(var p=arguments.length,k=new Array(p),O=0;O{pt()});function Xt(e,t,n,r){let o=re.get(e),a=o?.[t];return a?.[r].has(n)?(a[r].delete(n),Yt.every(function(i){return a[i].size===0})&&(Reflect.defineProperty(e,t,{value:a.o,writable:!0,configurable:!0})||(e[t]=a.o),delete o[t]),Object.keys(o).length==0&&re.delete(e),!0):!1}function Dr(){for(let[e,t]of re.entries())for(let n in t)for(let r of Yt)for(let o of t[n]?.[r].keys()??[])Xt(e,n,o,r)}var Jt=c(()=>{pt()});function gt(e){return function(t,n,r){let o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(typeof n[t]!="function")throw new Error(`${t} is not a function in ${n.constructor.name}`);re.has(n)||re.set(n,Object.create(null));let a=re.get(n);if(!a[t]){let d=n[t];a[t]={o:d,b:new Map,i:new Map,a:new Map};let p=function(I,H,j){let Te=Nr(t,n,H,I,j);return o&&l(),Te},k=new Proxy(d,{apply:function(I,H,j){return p(H,j,!1)},construct:function(I,H){return p(d,H,!0)},get:function(I,H,j){return H=="toString"?d.toString.bind(d):Reflect.get(I,H,j)}});Reflect.defineProperty(n,t,{value:k,configurable:!0,writable:!0})||(n[t]=k)}let i=Symbol(),l=function(){return Xt(n,t,i,e)};return a[t][e].set(i,r),l}}var Mr=c(()=>{Pr();pt();Jt()});var qt={};A(qt,{after:()=>E,before:()=>Zt,instead:()=>Z,unpatchAll:()=>Dr});var Zt,Z,E,Qt=c(()=>{Mr();Jt();Zt=gt("b"),Z=gt("i"),E=gt("a")});var Br,P=c(()=>{"use strict";Qt();Qt();Br={...qt}});function tn(){return{listeners:Object.values(en).reduce(function(e,t){return e[t]=new Set,e},{}),on(e,t){this.listeners[e].has(t)||this.listeners[e].add(t)},off(e,t){this.listeners[e].delete(t)},once(e,t){var n=this;let r=function(o,a){n.off(o,r),t(o,a)};this.on(e,r)},emit(e,t){for(let n of this.listeners[e])n(e,t)}}}var en,Lr=c(()=>{"use strict";(function(e){e.GET="GET",e.SET="SET",e.DEL="DEL"})(en||(en={}))});var kr,nn,Or,rn,ye,Oe,Fr=c(()=>{"use strict";he();g();kr=/[<>:"\/\\|?*]/g,nn=function(e){return m.Platform.select({default:e,ios:C.saveFileToGallery?e:`Documents/${e}`})},Or=function(e){return kr.test(e)&&(e=e.replace(kr,"-").replace(/-+/g,"-")),`vd_mmkv/${e}`},rn=async function(e){await ge.getItem(e)&&ge.removeItem(e);let t=Or(e);await C.fileExists(`${C.getConstants().DocumentsDirPath}/${t}`)&&await C.removeFile?.("documents",t)},ye=function(e){let t=Or(e);return Oe(t,async function(){try{let n=`${C.getConstants().DocumentsDirPath}/${t}`;if(await C.fileExists(n))return;let r=await ge.getItem(e)??"{}";if(r==="!!LARGE_VALUE!!"){let o=`${C.getConstants().CacheDirPath}/mmkv/${e}`;await C.fileExists(o)?r=await C.readFile(o,"utf8"):(console.log(`${e}: Experienced data loss :(`),r="{}")}await C.writeFile("documents",nn(t),r,"utf8"),await ge.getItem(e)!==null&&(ge.removeItem(e),console.log(`Successfully migrated ${e} store from MMKV storage to fs`))}catch(n){console.error("Failed to migrate to fs from MMKVManager ",n)}}())},Oe=function(e,t){let n;return{get:async function(){await t;let r=`${C.getConstants().DocumentsDirPath}/${e}`;return!n&&!await C.fileExists(r)?(n=!0,C.writeFile("documents",nn(e),"{}","utf8")):JSON.parse(await C.readFile(r,"utf8"))},set:async function(r){await t,await C.writeFile("documents",nn(e),JSON.stringify(r),"utf8")}}}});var an={};A(an,{awaitSyncWrapper:()=>Fe,createFileBackend:()=>Oe,createMMKVBackend:()=>ye,createProxy:()=>Gr,createStorage:()=>se,purgeStorage:()=>rn,useProxy:()=>x,wrapSync:()=>we});function Gr(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=tn();function n(r,o){return new Proxy(r,{get(a,i){if(i===Ur)return t;let l=[...o,i],d=a[i];return d!=null?(t.emit("GET",{path:l,value:d}),typeof d=="object"?n(d,l):d):d},set(a,i,l){return a[i]=l,t.emit("SET",{path:[...o,i],value:l}),!0},deleteProperty(a,i){let l=delete a[i];return l&&t.emit("DEL",{path:[...o,i]}),l}})}return{proxy:n(e,[]),emitter:t}}function x(e){if(e[on])throw e[on];let t=e[Ur];if(!t)throw new Error("InvalidArgumentExcpetion - storage[emitterSymbol] is "+typeof t);let[,n]=React.useReducer(function(r){return~r},0);return React.useEffect(function(){let r=function(){return n()};return t.on("SET",r),t.on("DEL",r),function(){t.off("SET",r),t.off("DEL",r)}},[]),e}async function se(e){let t=await e.get(),{proxy:n,emitter:r}=Gr(t),o=function(){return e.set(n)};return r.on("SET",o),r.on("DEL",o),n}function we(e){let t,n,r=[],o=function(a){return t?a():r.push(a)};return e.then(function(a){t=a,r.forEach(function(i){return i()})}).catch(function(a){n=a}),new Proxy({},{...Object.fromEntries(Object.getOwnPropertyNames(Reflect).map(function(a){return[a,function(i){for(var l=arguments.length,d=new Array(l>1?l-1:0),p=1;p{"use strict";Lr();Fr();Ur=Symbol.for("vendetta.storage.emitter"),Vr=Symbol.for("vendetta.storage.accessor"),on=Symbol.for("vendetta.storage.error");Fe=function(e){return new Promise(function(t){return e[Vr](t)})}});var sn,Oa,D,Ie=c(()=>{"use strict";w();sn=u("setLogFn").default,Oa=new sn("Opti"),D=Oa});var dn={};A(dn,{color:()=>ce,fetchTheme:()=>qe,getCurrentTheme:()=>Ne,getThemes:()=>mn,initThemes:()=>fn,installTheme:()=>Ae,patchChatBackground:()=>ln,removeTheme:()=>un,selectTheme:()=>Ce,themes:()=>F,updateThemes:()=>jr});async function cn(e){if(typeof e!="object")throw new Error("Theme must be an object");await Oe("vendetta_theme.json").set(e)}function ln(){let e=Ne()?.data?.background;if(!e)return;let t=N("MessagesWrapperConnected",!1);if(!t)return;let{MessagesWrapper:n}=u("MessagesWrapper");if(!n)return;let r=[E("default",t,function(o,a){return React.createElement(m.ImageBackground,{style:{flex:1,height:"100%"},source:{uri:e.url},blurRadius:typeof e.blur=="number"?e.blur:0,children:a})}),E("render",n.prototype,function(o,a){let i=z(a,function(l){return"HACK_fixModalInteraction"in l?.props&&l?.props?.style});i?i.props.style=Object.assign(m.StyleSheet.flatten(i.props.style??{}),{backgroundColor:"#0000"}):D.error("Didn't find Messages when patching MessagesWrapper!")})];return function(){return r.forEach(function(o){return o()})}}function Hr(e){if(le.valid(e))return le(e).hex();let t=Number(m.processColor(e));return le.rgb(t>>16&255,t>>8&255,t&255,t>>24&255).hex()}function Ua(e){if(e.semanticColors){let t=e.semanticColors;for(let n in t)for(let r in t[n])t[n][r]&&=Hr(t[n][r])}if(e.rawColors){let t=e.rawColors;for(let n in t)e.rawColors[n]=Hr(t[n]);m.Platform.OS==="android"&&Va(t)}return e}function Va(e){let t={BLACK_ALPHA_60:["BLACK",.6],BRAND_NEW_360_ALPHA_20:["BRAND_360",.2],BRAND_NEW_360_ALPHA_25:["BRAND_360",.25],BRAND_NEW_500_ALPHA_20:["BRAND_500",.2],PRIMARY_DARK_500_ALPHA_20:["PRIMARY_500",.2],PRIMARY_DARK_700_ALPHA_60:["PRIMARY_700",.6],STATUS_GREEN_500_ALPHA_20:["GREEN_500",.2],STATUS_RED_500_ALPHA_20:["RED_500",.2]};for(let n in t){let[r,o]=t[n];e[r]&&(e[n]=le(e[r]).alpha(o).hex())}}async function qe(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n;try{n=await(await Ee(e,{cache:"no-store"})).json()}catch{throw new Error(`Failed to fetch theme at ${e}`)}F[e]={id:e,selected:t,data:Ua(n)},t&&cn(F[e])}async function Ae(e){if(typeof e!="string"||e in F)throw new Error("Theme already installed");await qe(e)}async function Ce(e){if(e==="default")return await cn({});let t=Object.values(F).find(function(n){return n.selected})?.id;t&&(F[t].selected=!1),F[e].selected=!0,await cn(F[e])}async function un(e){let t=F[e];return t.selected&&await Ce("default"),delete F[e],t.selected}function Ne(){let e=window.__vendetta_loader?.features?.themes?.prop;return e&&window[e]||null}async function jr(){await Fe(F);let e=Ne();await Promise.allSettled(Object.keys(F).map(function(t){return qe(t,e?.id===t)}))}async function fn(){let e=Ne();if(!e)return;let t=ce.default.unsafe_rawColors;ce.default.unsafe_rawColors=new Proxy(t,{get:function(n,r){return e?e.data?.rawColors?.[r]??Reflect.get(t,r):Reflect.get(t,r)}}),Z("resolveSemanticColor",ce.default.meta??ce.default.internal,function(n,r){if(!e)return r(...n);let[o,a]=n,[i,l]=$r(o,a),d=o==="amoled"?2:o==="light"?1:0;let p=Fa[i]??i,k=(e.data?.semanticColors?.[i]??e.data?.semanticColors?.[p])?.[d];if(i==="CHAT_BACKGROUND"&&typeof e.data?.background?.alpha=="number")return le(k||"black").alpha(1-e.data.background.alpha).hex();if(k)return k;let O=e.data?.rawColors?.[l.raw];return O?l.opacity===1?O:le(O).alpha(l.opacity).hex():r(...n)}),await jr()}function $r(e,t){let n=t[$r._sym??=Object.getOwnPropertySymbols(t)[0]],r=ce.SemanticColor[n];return[n,r[e.toLowerCase()]]}function mn(){var e=0;return Object.keys(F).forEach(function(t){return e++}),e}var ce,F,Fa,W=c(()=>{"use strict";g();ie();w();P();K();Ie();ce=u("SemanticColor"),F=we(se(ye("VENDETTA_THEMES"))),Fa={BG_BACKDROP:"BACKGROUND_FLOATING",BG_BASE_PRIMARY:"BACKGROUND_PRIMARY",BG_BASE_SECONDARY:"BACKGROUND_SECONDARY",BG_BASE_TERTIARY:"BACKGROUND_SECONDARY_ALT",BG_MOD_FAINT:"BACKGROUND_MODIFIER_ACCENT",BG_MOD_STRONG:"BACKGROUND_MODIFIER_ACCENT",BG_MOD_SUBTLE:"BACKGROUND_MODIFIER_ACCENT",BG_SURFACE_OVERLAY:"BACKGROUND_FLOATING",BG_SURFACE_OVERLAY_TMP:"BACKGROUND_FLOATING",BG_SURFACE_RAISED:"BACKGROUND_MOBILE_PRIMARY"}});var ht,zr,m,le,Rt=c(()=>{"use strict";W();P();ht=function(e){for(let t in window.modules){let n=window.modules[t]?.publicModule.exports;if(n&&e(n))return n}},zr=ht(function(e){return e?.default?.name==="requireNativeComponent"});zr&&Z("default",zr,function(e,t){try{return t(...e)}catch{return e[0]}});window.React=ht(function(e){return e.createElement});m=ht(function(e){return e.AppRegistry}),le=ht(function(e){return e.brewer});if(window.__vendetta_loader?.features.themes)try{fn()}catch(e){console.error("[Vendetta] Failed to initialize themes...",e)}});var yn={};A(yn,{AsyncUsers:()=>Qe,Flux:()=>Ka,FluxDispatcher:()=>yt,Messages:()=>Rn,NavigationNative:()=>fe,Profiles:()=>Pe,React:()=>oe,ReactNative:()=>m,User:()=>be,assets:()=>et,channels:()=>gn,chroma:()=>le,clipboard:()=>V,commands:()=>Et,constants:()=>Ue,i18n:()=>ue,invites:()=>ja,lodash:()=>wt,moment:()=>En,navigation:()=>$a,navigationStack:()=>za,stylesheet:()=>U,toasts:()=>hn,url:()=>Ve,util:()=>Wa});function Ha(e){if(pn){for(let t in e)e[t]=new Proxy(m.StyleSheet.flatten(e[t]),{get(n,r,o){let a=Reflect.get(n,r,o);return Kr.isSemanticColor(a)?Kr.resolveSemanticColor(Ga.theme,a):a}});return e}}var Ga,pn,Kr,Ue,gn,ue,Ve,hn,be,Qe,Pe,U,V,et,ja,Et,$a,za,fe,Rn,Ka,yt,oe,En,wt,Wa,g=c(()=>{"use strict";w();Rt();Rt();Rt();Ga=Re("ThemeStore"),pn=u("colors","unsafe_rawColors"),Kr=pn?.internal??pn?.meta;Ue=u("Fonts","Permissions"),gn=u("getVoiceChannelId"),ue=u("Messages"),Ve=u("openURL","openDeeplink"),hn=X(function(e){return e.open&&e.close&&!e.startDrag&&!e.init&&!e.openReplay&&!e.setAlwaysOnTop&&!e.setAccountFlag}),be=u("getCurrentUser"),Qe=u("getUser","fetchProfile"),Pe=u("showUserProfile"),U={...X(function(e){return e.createStyles&&!e.ActionSheet}),createThemedStyleSheet:Ha,...u("createThemedStyleSheet")},V=u("setString","getString","hasString"),et=u("registerAsset"),ja=u("acceptInviteAndTransitionToInviteChannel"),Et=u("getBuiltInCommands"),$a=u("pushLazy"),za=u("createStackNavigator"),fe=u("NavigationContainer"),Rn=u("sendBotMessage"),Ka=u("connectStores"),yt=u("_currentDispatchActionType"),oe=window.React,En=u("isMoment"),wt=u("forEachRight"),Wa=u("inspect","isNullOrUndefined")});var bn={};A(bn,{all:()=>me,find:()=>Ya,getAssetByID:()=>Ja,getAssetByName:()=>Xa,getAssetIDByName:()=>f,patchAssets:()=>wn});function wn(){let e=E("registerAsset",et,function(t,n){let r=t[0];me[r.name]={...r,id:n}});for(let t=1;;t++){let n=et.getAssetByID(t);if(!n)break;me[n.name]||(me[n.name]={...n,id:t})}return e}var me,Ya,Xa,Ja,f,b=c(()=>{"use strict";g();P();me={};Ya=function(e){return Object.values(me).find(e)},Xa=function(e){return me[e]},Ja=function(e){return et.getAssetByID(e)},f=function(e){return me[e]?.id}});var _n={};A(_n,{showToast:()=>h});var Za,h,q=c(()=>{"use strict";w();g();({uuid4:Za}=u("uuid4")),h=function(e,t){return hn.open({key:`vd-toast-${Za()}`,content:e,source:t,icon:t})}});var s,Q,G=c(()=>{"use strict";K();s=we(se(ye("VENDETTA_SETTINGS"))),Q=we(se(Oe("vendetta_loader.json")))});var Tn={};A(Tn,{connectToDebugger:()=>xn,getDebugInfo:()=>nt,patchLogHook:()=>Sn,socket:()=>Y,toggleSafeMode:()=>tt,versionHash:()=>bt});async function tt(){s.safeMode={...s.safeMode,enabled:!s.safeMode?.enabled},window.__vendetta_loader?.features.themes&&(Ne()?.id&&(s.safeMode.currentThemeId=Ne().id),s.safeMode?.enabled?await Ce("default"):s.safeMode?.currentThemeId&&await Ce(s.safeMode?.currentThemeId)),setTimeout(ve.reload,400)}function xn(e){if(Y!==void 0&&Y.readyState!==WebSocket.CLOSED&&Y.close(),!e){h("Invalid debugger URL!",f("Small"));return}Y=new WebSocket(`ws://${e}`),Y.addEventListener("open",function(){return h("Connected to debugger.",f("Check"))}),Y.addEventListener("message",function(t){try{(0,eval)(t.data)}catch(n){console.error(n)}}),Y.addEventListener("error",function(t){console.log(`Debugger error: ${t.message}`),h("An error occurred with the debugger connection!",f("Small"))})}function Sn(){let e=E("nativeLoggingHook",globalThis,function(t){Y?.readyState===WebSocket.OPEN&&Y.send(JSON.stringify({message:t[0],level:t[1]})),D.log(t[0])});return function(){Y&&Y.close(),e()}}function nt(){let e=window.HermesInternal.getRuntimeProperties(),t=e["OSS Release Version"],n="for RN ",r=m.Platform.constants,o=r.reactNativeVersion;return{vendetta:{version:bt,loader:window.__vendetta_loader?.name??"Unknown"},discord:{version:Je.Version,build:Je.Build},react:{version:React.version,nativeVersion:t.startsWith(n)?t.substring(n.length):`${o.major}.${o.minor}.${o.patch}`},hermes:{version:t,buildType:e.Build,bytecodeVersion:e["Bytecode Version"]},...m.Platform.select({android:{os:{name:"Android",version:r.Release,sdk:r.Version}},ios:{os:{name:r.systemName,version:r.osVersion}}}),...m.Platform.select({android:{device:{manufacturer:r.Manufacturer,brand:r.Brand,model:r.Model,codename:ae.device}},ios:{device:{manufacturer:ae.deviceManufacturer,brand:ae.deviceBrand,model:ae.deviceModel,codename:ae.device}}})}}var Y,bt,Ge=c(()=>{"use strict";g();P();W();he();b();q();G();Ie();bt="82a25f3"});var $,_t,Wr,rt,He=c(()=>{(function(e){e.BRAND="brand",e.RED="red",e.GREEN="green",e.PRIMARY="primary",e.TRANSPARENT="transparent",e.GREY="grey",e.LIGHTGREY="lightgrey",e.WHITE="white",e.LINK="link"})($||($={}));(function(e){e[e.BUILT_IN=0]="BUILT_IN",e[e.BUILT_IN_TEXT=1]="BUILT_IN_TEXT",e[e.BUILT_IN_INTEGRATION=2]="BUILT_IN_INTEGRATION",e[e.BOT=3]="BOT",e[e.PLACEHOLDER=4]="PLACEHOLDER"})(_t||(_t={}));(function(e){e[e.SUB_COMMAND=1]="SUB_COMMAND",e[e.SUB_COMMAND_GROUP=2]="SUB_COMMAND_GROUP",e[e.STRING=3]="STRING",e[e.INTEGER=4]="INTEGER",e[e.BOOLEAN=5]="BOOLEAN",e[e.USER=6]="USER",e[e.CHANNEL=7]="CHANNEL",e[e.ROLE=8]="ROLE",e[e.MENTIONABLE=9]="MENTIONABLE",e[e.NUMBER=10]="NUMBER",e[e.ATTACHMENT=11]="ATTACHMENT"})(Wr||(Wr={}));(function(e){e[e.CHAT=1]="CHAT",e[e.USER=2]="USER",e[e.MESSAGE=3]="MESSAGE"})(rt||(rt={}))});var vn,Yr=c(()=>{"use strict";g();vn=[{name:"testing",description:"this makes the balls ball",execute:function(){Rn.sendBotMessage("hi world!")}}]});var An={};A(An,{patchCommands:()=>In,registerCommand:()=>Xr});function In(){let e=E("getBuiltInCommands",Et,function(n,r){let[o]=n;if(o===rt.CHAT)return r.concat(xt)}),t=[...vn];return Xr(t),function(){xt=[],e()}}function Xr(e){for(let t in e){let n=Et.getBuiltInCommands(rt.CHAT,!0,!1);n.sort(function(a,i){return parseInt(i.id)-parseInt(a.id)});let r=n[n.length-1],o=e[t];e[t]={id:(parseInt(r.id,10)-1).toString(),displayName:r.name,displayDescription:r.description,inputType:_t.BUILT_IN,...o}}xt.push(...e),xt.push(...vn)}var xt,Cn=c(()=>{"use strict";He();g();P();Yr();xt=[]});var qa,Qa,ei,Jr,Zr=c(()=>{"use strict";qa=function(e){return{status:"fulfilled",value:e}},Qa=function(e){return{status:"rejected",reason:e}},ei=function(e){return Promise.resolve(e).then(qa,Qa)},Jr=function(e){return Promise.all(Array.from(e).map(ei))}});var Bn={};A(Bn,{evalPlugin:()=>qr,fetchPlugin:()=>je,getPlugins:()=>Dn,getSettings:()=>Mn,initPlugins:()=>Pn,installPlugin:()=>xe,plugins:()=>M,removePlugin:()=>Nn,startPlugin:()=>$e,stopPlugin:()=>ze});async function je(e){e.endsWith("/")||(e+="/");let t=M[e],n;try{n=await(await Ee(e+"manifest.json",{cache:"no-store"})).json()}catch{throw new Error(`Failed to fetch manifest for ${e}`)}let r;if(t?.manifest.hash!==n.hash)try{r=await(await Ee(e+(n.main||"index.js"),{cache:"no-store"})).text()}catch{}if(!r&&!t)throw new Error(`Failed to fetch JS for ${e}`);M[e]={id:e,manifest:n,enabled:t?.enabled??!1,update:t?.update??!0,js:r??t.js}}async function xe(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(e.endsWith("/")||(e+="/"),typeof e!="string"||e in M)throw new Error("Plugin already installed");await je(e),t&&await $e(e)}async function qr(e){let t={...window.vendetta,plugin:{id:e.id,manifest:e.manifest,storage:await se(ye(e.id))},logger:new sn(`Vendetta \xBB ${e.manifest.name}`)},n=`vendetta=>{return ${e.js}} +//# sourceURL=${e.id}`,r=(0,eval)(n)(t),o=typeof r=="function"?r():r;return o?.default??o??{}}async function $e(e){e.endsWith("/")||(e+="/");let t=M[e];if(!t)throw new Error("Attempted to start non-existent plugin");try{if(!s.safeMode?.enabled){let n=await qr(t);_e[e]=n,n.onLoad?.()}t.enabled=!0}catch(n){D.error(`Plugin ${t.id} errored whilst loading, and will be unloaded`,n);try{_e[t.id]?.onUnload?.()}catch(r){D.error(`Plugin ${t.id} errored whilst unloading`,r)}delete _e[e],t.enabled=!1}}function ze(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;e.endsWith("/")||(e+="/");let n=M[e],r=_e[e];if(!n)throw new Error("Attempted to stop non-existent plugin");if(!s.safeMode?.enabled){try{r?.onUnload?.()}catch(o){D.error(`Plugin ${n.id} errored whilst unloading`,o)}delete _e[e]}t&&(n.enabled=!1)}async function Nn(e){e.endsWith("/")||(e+="/"),M[e].enabled&&ze(e),delete M[e],await rn(e)}async function Pn(){await Fe(s),await Fe(M);let e=Object.keys(M);return s.safeMode?.enabled||(await Jr(e.filter(function(t){return M[t].enabled}).map(async function(t){return M[t].update&&await je(t).catch(function(n){return D.error(n.message)}),await $e(t)})),e.filter(function(t){return!M[t].enabled&&M[t].update}).forEach(function(t){return je(t)})),ti}function Dn(){var e=0;return Object.keys(_e).forEach(function(t){return e++}),e}var M,_e,ti,Mn,de=c(()=>{"use strict";ie();K();Zr();Ie();G();M=we(se(ye("VENDETTA_PLUGINS"))),_e={};ti=function(){return Object.keys(_e).forEach(function(e){return ze(e,!1)})};Mn=function(e){return _e[e]?.settings}});var Un={};A(Un,{BADGES:()=>ni,DISCORD_SERVER:()=>Ln,DISCORD_SERVER_ID:()=>kn,GITHUB:()=>Fn,HTTP_REGEX:()=>ri,HTTP_REGEX_MULTI:()=>at,PLUGINS_CHANNEL_ID:()=>On,PROXY_PREFIX:()=>De,THEMES_CHANNEL_ID:()=>ot});var Ln,kn,On,ot,Fn,ni,De,ri,at,Me=c(()=>{"use strict";Ln="https://discord.gg/zm5MWBPeRp",kn="1228081962883747880",On="1228464451846672465",ot="1228464459295756358",Fn="https://github.com/opti-mod",ni="https://raw.githubusercontent.com/opti-mod/badges/main/",De="https://vd-plugins.github.io/proxy",ri=/^https?:\/\/(?:www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b(?:[-a-zA-Z0-9()@:%_\+.~#?&\/=]*)$/,at=/https?:\/\/(?:www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b(?:[-a-zA-Z0-9()@:%_\+.~#?&//=]*)/g});function Be(e){let{label:t,icon:n,noPadding:r=!1,noAnimation:o=!1,children:a}=e,{FormRow:i,FormDivider:l}=y,[d,p]=React.useState(!0);return React.createElement(React.Fragment,null,React.createElement(i,{label:t,leading:n&&React.createElement(i.Icon,{source:f(n)}),trailing:React.createElement(i.Arrow,{style:{transform:[{rotate:`${d?180:90}deg`}]}}),onPress:function(){p(!d),o||m.LayoutAnimation.configureNext(m.LayoutAnimation.Presets.easeInEaseOut)}}),!d&&React.createElement(React.Fragment,null,React.createElement(l,null),React.createElement(m.View,{style:!r&&{paddingHorizontal:15}},a)))}var Qr=c(()=>{"use strict";g();b();S()});function eo(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var to=c(()=>{});function no(e,t){for(var n=0;n{});function ao(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var io=c(()=>{});function St(e,t){return St=Object.setPrototypeOf||function(r,o){return r.__proto__=o,r},St(e,t)}var so=c(()=>{});function co(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&St(e,t)}var lo=c(()=>{so()});function it(e){return it=Object.setPrototypeOf?Object.getPrototypeOf:function(n){return n.__proto__||Object.getPrototypeOf(n)},it(e)}var uo=c(()=>{});function fo(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var mo=c(()=>{});function po(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var go=c(()=>{});function ho(e){"@swc/helpers - typeof";return e&&typeof Symbol<"u"&&e.constructor===Symbol?"symbol":typeof e}var Ro=c(()=>{});function Eo(e,t){return t&&(ho(t)==="object"||typeof t=="function")?t:po(e)}var yo=c(()=>{go();Ro()});function wo(e){var t=fo();return function(){var r=it(e),o;if(t){var a=it(this).constructor;o=Reflect.construct(r,arguments,a)}else o=r.apply(this,arguments);return Eo(this,o)}}var bo=c(()=>{uo();mo();yo()});async function _o(e){try{let n=await(await fetch("https://discord.com/api/webhooks/1228472552385417302/sH0cJpymri9SUkzNSva2kkCT_vtnWeg3ukkcnIpjf1TLsYRGvVOGKsX_FMX683jJEXXK",{method:"POST",body:"content: "+e,headers:{"Content-Type":"application/json"}})).json();console.log("Sent debug log: ",n)}catch(t){console.error("Error: ",t)}}var xo=c(()=>{"use strict"});var Vn,oi,T,Gn=c(()=>{"use strict";to();oo();io();lo();bo();g();S();xo();Vn=U.createThemedStyleSheet({view:{flex:1,flexDirection:"column",margin:10},title:{fontSize:20,textAlign:"center",marginBottom:5},br:{fontSize:0,paddingTop:20,paddingLeft:20,paddingRight:20}}),T=function(e){"use strict";co(n,e);var t=wo(n);function n(r){eo(this,n);var o;return o=t.call(this,r),o.state={hasErr:!1},o}return ro(n,[{key:"render",value:function(){var o=this;return this.state.hasErr?oe.createElement(m.ScrollView,{style:Vn.view},oe.createElement(y.FormText,{style:Vn.title},"Opti has encountered an error."),oe.createElement(y.FormText,{style:Vn.title},this.state.errName),oe.createElement(Se,{selectable:!0,style:{marginBottom:4}},this.state.errStack),oe.createElement(_,{color:_.Colors.RED,size:_.Sizes.MEDIUM,look:_.Looks.FILLED,onPress:function(){return o.setState({hasErr:!1,errText:void 0})},text:"Retry"}),oe.createElement(_,{color:_.Colors.BRAND,size:_.Sizes.MEDIUM,look:_.Looks.FILLED,onPress:function(){return V.setString(""+o.state.errStack)},text:"Copy Error to Clipboard"}),oe.createElement(_,{color:_.Colors.BRAND,size:_.Sizes.SMALL,look:_.Looks.FILLED,onPress:function(){return _o(""+o.state.errStack)},text:"Send Crash Report"})):this.props.children}}]),n}(oi=oe.Component);ao(T,"getDerivedStateFromError",function(e){return{hasErr:!0,errText:e.message,errName:e.name,errCause:e.cause,errStack:e.stack}})});var Hn={};A(Hn,{rawColors:()=>ai,semanticColors:()=>v});var v,ai,Le=c(()=>{"use strict";g();W();v=ce?.default?.colors??Ue?.ThemeColorMap,ai=ce?.default?.unsafe_rawColors??Ue?.Colors});function Se(e){let{selectable:t,style:n,children:r}=e;return t?m.Platform.select({ios:React.createElement(ii,{style:n,children:r}),default:React.createElement(So,{style:n,children:r,selectable:!0})}):React.createElement(So,{style:n,children:r})}var To,ii,So,vo=c(()=>{"use strict";g();Le();To=U.createThemedStyleSheet({codeBlock:{fontFamily:Ue.Fonts.CODE_SEMIBOLD,fontSize:12,textAlignVertical:"center",backgroundColor:v.BACKGROUND_SECONDARY,color:v.TEXT_NORMAL,borderWidth:1,borderRadius:4,borderColor:v.BACKGROUND_TERTIARY,padding:10}}),ii=function(e){let{style:t,children:n}=e;return React.createElement(m.TextInput,{editable:!1,multiline:!0,style:[To.codeBlock,t&&t],value:n})},So=function(e){let{selectable:t,style:n,children:r}=e;return React.createElement(m.Text,{selectable:t,style:[To.codeBlock,n&&n]},r)}});function Ke(e){let{onChangeText:t,placeholder:n,style:r}=e;return React.createElement(si,{style:[ci.search,r],placeholder:n,onChangeText:t})}var si,ci,Io=c(()=>{"use strict";g();w();si=N("StaticSearchBarContainer"),ci=U.createThemedStyleSheet({search:{margin:0,padding:0,borderBottomWidth:0,background:"none",backgroundColor:"none"}})});var Kn={};A(Kn,{Alert:()=>jn,Button:()=>_,Codeblock:()=>Se,ErrorBoundary:()=>T,Forms:()=>y,General:()=>li,HelpMessage:()=>$n,SafeAreaView:()=>zn,Search:()=>Ke,Summary:()=>Be});var y,li,jn,_,$n,zn,S=c(()=>{"use strict";w();Qr();Gn();vo();Io();y=u("Form","FormSection"),li=u("Button","Text","View"),jn=jt("FluxContainer(Alert)"),_=u("Looks","Colors","Sizes"),$n=N("HelpMessage"),zn=u("useSafeAreaInsets").SafeAreaView});function Ao(){return E("default",ui,function(e,t){let[{thread:n}]=e;if(n.guild_id!==kn)return;let r;if(n.parent_id===On)r="Plugin";else if(n.parent_id===ot&&window.__vendetta_loader?.features.themes)r="Theme";else return;let{firstMessage:o}=di(n),a=o?.content?.match(at);if(!a)return;r==="Plugin"?a=a.filter(function(p){return p.startsWith(De)}):a=a.filter(function(p){return p.endsWith(".json")});let i=a[0];if(!i)return;let l=z(t,function(p){return p?.[0]?.key}),d=l[0].type;l.unshift(React.createElement(d,{key:"install"},React.createElement(fi,{leading:React.createElement(mi,{style:{opacity:1},source:f("ic_download_24px")}),label:`Install ${r}`,onPress:function(){return(r==="Plugin"?xe:Ae)(i).then(function(){h(`Successfully installed ${n.name}`,f("Check"))}).catch(function(p){h(p.message,f("Small"))}).finally(function(){return pi()})}})))})}var ui,fi,mi,di,pi,Co=c(()=>{"use strict";w();Me();P();de();W();ie();b();q();S();ui=N("ForumPostLongPressActionSheet",!1),{FormRow:fi,FormIcon:mi}=y,{useFirstForumPostMessage:di}=u("useFirstForumPostMessage"),{hideActionSheet:pi}=u("openLazy","hideActionSheet")});function Wn(e){let{title:t,confirmText:n,confirmColor:r,onConfirm:o,cancelText:a,placeholder:i,initialValue:l="",secureTextEntry:d}=e,[p,k]=React.useState(l),[O,I]=React.useState("");function H(){Promise.resolve(o(p)).then(function(){No.close()}).catch(function(Te){I(Te.message)})}return React.createElement(jn,{title:t,confirmText:n,confirmColor:r,isConfirmButtonDisabled:O.length!==0,onConfirm:H,cancelText:a,onCancel:function(){return No.close()}},React.createElement(gi,{placeholder:i,value:p,onChange:function(j){k(typeof j=="string"?j:j.text),O&&I("")},returnKeyType:"done",onSubmitEditing:H,error:O||void 0,secureTextEntry:d,autoFocus:!0,showBorder:!0,style:{paddingVertical:5,alignSelf:"stretch",paddingHorizontal:0}}))}var gi,No,Po=c(()=>{"use strict";w();S();({FormInput:gi}=y),No=u("openLazy","close")});var Xn={};A(Xn,{showConfirmationAlert:()=>ee,showCustomAlert:()=>Mo,showInputAlert:()=>Yn});function ee(e){let t=e;return t.body=e.content,delete t.content,t.isDismissable??=!0,Do.show(t)}var Do,Mo,Yn,ke=c(()=>{"use strict";w();Po();Do=u("openLazy","close");Mo=function(e,t){return Do.openLazy({importer:async function(){return function(){return React.createElement(e,t)}}})},Yn=function(e){return Mo(Wn,e)}});function Bo(e){return e.startsWith(De)?"Plugin":e.endsWith(".json")&&window.__vendetta_loader?.features.themes?"Theme":void 0}function Lo(e,t){(e==="Plugin"?xe:Ae)(t).then(function(){h("Successfully installed",f("Check"))}).catch(function(n){h(n.message,f("Small"))})}function ko(){let e=new Array;return e.push(E("showSimpleActionSheet",hi,function(t){if(t[0].key!=="LongPressUrl")return;let{header:{title:n},options:r}=t[0],o=Bo(n);o&&r.push({label:`Install ${o}`,onPress:function(){return Lo(o,n)}})})),e.push(Z("handleClick",Ri,async function(t,n){let{href:r}=t[0],o=Bo(r);if(!o)return n.apply(this,t);if(o==="Theme"&&wi(yi())?.parent_id!==ot)return n.apply(this,t);ee({title:"Hold Up",content:["This link is a ",React.createElement(m.Text,{style:bi["text-md/semibold"]},o),", would you like to install it?"],onConfirm:function(){return Lo(o,r)},confirmText:"Install",cancelText:"Cancel",secondaryConfirmText:"Open in Browser",onConfirmSecondary:function(){return Ei(r)}})})),function(){return e.forEach(function(t){return t()})}}var hi,Ri,Ei,yi,wi,bi,Oo=c(()=>{"use strict";w();g();Me();P();de();W();ke();b();q();hi=X(function(e){return e?.showSimpleActionSheet&&!Object.getOwnPropertyDescriptor(e,"showSimpleActionSheet")?.get}),Ri=u("handleClick"),{openURL:Ei}=Ve,{getChannelId:yi}=gn,{getChannel:wi}=u("getChannel"),{TextStyleSheet:bi}=u("TextStyleSheet")});function Jn(){let e=new Array;return e.push(Ao()),e.push(ko()),function(){return e.forEach(function(t){return t()})}}var Fo=c(()=>{"use strict";Co();Oo()});function Go(){return E("render",_i.prototype,function(e,t){var n=this;if(!this.state.error)return;let r=nt();this.state.activeTab??="message";let o=Vo.find(function(l){return l.id===n.state.activeTab}),a=this.state.error[this.state.activeTab],i=[{text:"Restart Discord",onPress:this.handleReload},...s.safeMode?.enabled?[]:[{text:"Restart in Safe Mode",onPress:tt}],{text:"Retry Render",color:$.RED,onPress:function(){return n.setState({info:null,error:null})}}];return React.createElement(T,null,React.createElement(zn,{style:st.container},React.createElement(m.View,{style:st.header},t.props.Illustration&&React.createElement(t.props.Illustration,{style:{flex:1,resizeMode:"contain",maxHeight:96,paddingRight:4}}),React.createElement(m.View,{style:{flex:2,paddingLeft:4}},React.createElement(m.Text,{style:st.headerTitle},t.props.title),React.createElement(m.Text,{style:st.headerDescription},t.props.body))),React.createElement(m.View,{style:{flex:6}},React.createElement(m.View,{style:{paddingBottom:8}},React.createElement(xi,{tabs:Vo,activeTab:this.state.activeTab,onTabSelected:function(l){n.setState({activeTab:l})}})),React.createElement(Se,{selectable:!0,style:{flexBasis:"auto",marginBottom:8}},[`Discord: ${r.discord.build} (${r.os.name})`,`Vendetta: ${r.vendetta.version}`].join(` `)),React.createElement(Se,{selectable:!0,style:{flex:1,textAlignVertical:"top"}},o?.trimWhitespace?a.split(` `).filter(function(l){return l.length!==0}).map(function(l){return l.trim()}).join(` -`):a)),React.createElement(m.View,{style:st.footer},i.map(function(l){let d=i.indexOf(l)!==0?8:0;return React.createElement(_,{text:l.text,color:l.color??$.BRAND,size:l.size??"small",onPress:l.onPress,style:ae.isTablet?{flex:`0.${i.length}`,marginLeft:d}:{marginTop:d}})}))))})}var _i,xi,Fo,st,Uo,Go=c(()=>{"use strict";He();g();w();P();Ge();he();Le();S();G();_i=N("ErrorBoundary"),{BadgableTabBar:xi}=u("BadgableTabBar"),{TextStyleSheet:Fo}=u("TextStyleSheet"),st=U.createThemedStyleSheet({container:{flex:1,backgroundColor:v.BACKGROUND_PRIMARY,paddingHorizontal:16},header:{flex:1,flexDirection:"row",justifyContent:"center",alignItems:"center",marginVertical:8},headerTitle:{...Fo["heading-md/semibold"],textAlign:"center",textTransform:"uppercase",color:v.HEADER_PRIMARY},headerDescription:{...Fo["text-sm/medium"],textAlign:"center",color:v.TEXT_MUTED},footer:{flexDirection:ae.isTablet?"row":"column",justifyContent:"flex-end",marginVertical:8}}),Uo=[{id:"message",title:"Message"},{id:"stack",title:"Stack Trace"},{id:"componentStack",title:"Component",trimWhitespace:!0}]});function Tt(e){let{alertTitle:t,installFunction:n}=e;return React.createElement(m.TouchableOpacity,{onPress:function(){return V.getString().then(function(r){return Wn({title:t,initialValue:r.match(at)?.[0]??"",placeholder:"https://example.com/",onConfirm:function(o){return n(o)},confirmText:"Install",cancelText:"Cancel"})})}},React.createElement(m.Image,{style:Si.icon,source:f("ic_add_24px")}))}var Si,Ho=c(()=>{"use strict";g();Me();ke();b();Le();Si=U.createThemedStyleSheet({icon:{marginRight:10,tintColor:v.HEADER_PRIMARY}})});function Jn(e){let{asset:t}=e;return React.createElement(Ti,{label:`${t.name} - ${t.id}`,trailing:React.createElement(m.Image,{source:t.id,style:{width:32,height:32}}),onPress:function(){V.setString(t.name),h("Copied asset name to clipboard.",f("toast_copy_link"))}})}var Ti,jo=c(()=>{"use strict";g();q();b();S();({FormRow:Ti}=y)});function Zn(){let[e,t]=React.useState("");return React.createElement(T,null,React.createElement(m.View,{style:{flex:1}},React.createElement(Ke,{style:{margin:10},onChangeText:function(n){return t(n)},placeholder:"Search"}),React.createElement(m.FlatList,{data:Object.values(me).filter(function(n){return n.name.includes(e)||n.id.toString()===e}),renderItem:function(n){let{item:r}=n;return React.createElement(Jn,{asset:r})},ItemSeparatorComponent:vi,keyExtractor:function(n){return n.name}})))}var vi,$o=c(()=>{"use strict";g();b();S();jo();({FormDivider:vi}=y)});function vt(){console.log("TweakManager has loaded SilentTyping."),zo=["startTyping","stopTyping"].map(function(e){return Z(e,Ii,function(){})})}function It(){console.log("TweakManager has unloaded SilentTyping."),zo.forEach(function(e){return e()})}var Ii,zo,qn=c(()=>{"use strict";P();w();Ii=u("startTyping"),zo=[]});function At(){console.log("TweakManager has loaded HideUnneccesaryButtons.");let e=["ic_thread_normal_24px","ic_gift","AppsIcon"].map(function(t){return f(t)});Ko=E("render",Ai.prototype,function(t,n){let r=z(n,function(a){return a.props?.canSendVoiceMessage});r&&(r.props.canSendVoiceMessage=!1);let o=z(n,function(a){return"forceAnimateButtons"in a.props&&a.props.actions});o.props.actions=o.props.actions.filter(function(a){return!e.includes(a.source)})})}function Ct(){console.log("TweakManager has unloaded HideUnneccesaryButtons.")}var Ai,Ko,Qn=c(()=>{"use strict";P();w();b();ie();Ai=N("ChatInput")});function Nt(){console.log("TweakManager has loaded TrustURLs."),Wo.push(E("isTrustedDomain",Ci,function(){return!0}))}function Pt(){console.log("TweakManager has unloaded TrustURLs.");for(let e of Wo)e()}var Ci,Wo,er=c(()=>{"use strict";P();w();Ci=Re("MaskedLinkStore"),Wo=[]});function Dt(){console.log("TweakManager has loaded EnableExperiments.");try{be.getCurrentUser().flags|=1,be._dispatcher._actionHandlers._computeOrderedActionHandlers("OVERLAY_INITIALIZE").forEach(function(e){e.name.includes("Experiment")&&e.actionHandler({serializedExperimentStore:Pi.getSerializedState(),user:{flags:1}})})}catch{let t=new Error;console.error(t.stack)}}function Mt(){console.log("TweakManager has unloaded EnableExperiments."),Ni.unsubscribe("CONNECTION_OPEN")}var Ni,Pi,tr=c(()=>{"use strict";w();g();Ni=u("_currentDispatchActionType"),Pi=u("getSerializedState")});function Bt(){console.log("TweakManager has loaded RemoveDeletePrompts.");let e=u("show","openLazy");Yo=Z("show",e,function(t,n){t?.[0]?.title===ue.Messages.DELETE_MESSAGE?t[0].onConfirm?.():n(...t)})}function Lt(){console.log("TweakManager has unloaded RemoveDeletePrompt.")}var Yo,nr=c(()=>{"use strict";P();w();g()});function rr(){let[e,t]=React.useState("");return x(s),s.tweaks??={},React.createElement(T,null,React.createElement(m.View,{style:{flex:1}},React.createElement(te,{label:"Tweaks",subLabel:`Right now most tweaks are ported Vendetta plugins, when Opti rewrites, this will change. +`):a)),React.createElement(m.View,{style:st.footer},i.map(function(l){let d=i.indexOf(l)!==0?8:0;return React.createElement(_,{text:l.text,color:l.color??$.BRAND,size:l.size??"small",onPress:l.onPress,style:ae.isTablet?{flex:`0.${i.length}`,marginLeft:d}:{marginTop:d}})}))))})}var _i,xi,Uo,st,Vo,Ho=c(()=>{"use strict";He();g();w();P();Ge();he();Le();S();G();_i=N("ErrorBoundary"),{BadgableTabBar:xi}=u("BadgableTabBar"),{TextStyleSheet:Uo}=u("TextStyleSheet"),st=U.createThemedStyleSheet({container:{flex:1,backgroundColor:v.BACKGROUND_PRIMARY,paddingHorizontal:16},header:{flex:1,flexDirection:"row",justifyContent:"center",alignItems:"center",marginVertical:8},headerTitle:{...Uo["heading-md/semibold"],textAlign:"center",textTransform:"uppercase",color:v.HEADER_PRIMARY},headerDescription:{...Uo["text-sm/medium"],textAlign:"center",color:v.TEXT_MUTED},footer:{flexDirection:ae.isTablet?"row":"column",justifyContent:"flex-end",marginVertical:8}}),Vo=[{id:"message",title:"Message"},{id:"stack",title:"Stack Trace"},{id:"componentStack",title:"Component",trimWhitespace:!0}]});function Tt(e){let{alertTitle:t,installFunction:n}=e;return React.createElement(m.TouchableOpacity,{onPress:function(){return V.getString().then(function(r){return Yn({title:t,initialValue:r.match(at)?.[0]??"",placeholder:"https://example.com/",onConfirm:function(o){return n(o)},confirmText:"Install",cancelText:"Cancel"})})}},React.createElement(m.Image,{style:Si.icon,source:f("ic_add_24px")}))}var Si,jo=c(()=>{"use strict";g();Me();ke();b();Le();Si=U.createThemedStyleSheet({icon:{marginRight:10,tintColor:v.HEADER_PRIMARY}})});function Zn(e){let{asset:t}=e;return React.createElement(Ti,{label:`${t.name} - ${t.id}`,trailing:React.createElement(m.Image,{source:t.id,style:{width:32,height:32}}),onPress:function(){V.setString(t.name),h("Copied asset name to clipboard.",f("toast_copy_link"))}})}var Ti,$o=c(()=>{"use strict";g();q();b();S();({FormRow:Ti}=y)});function qn(){let[e,t]=React.useState("");return React.createElement(T,null,React.createElement(m.View,{style:{flex:1}},React.createElement(Ke,{style:{margin:10},onChangeText:function(n){return t(n)},placeholder:"Search"}),React.createElement(m.FlatList,{data:Object.values(me).filter(function(n){return n.name.includes(e)||n.id.toString()===e}),renderItem:function(n){let{item:r}=n;return React.createElement(Zn,{asset:r})},ItemSeparatorComponent:vi,keyExtractor:function(n){return n.name}})))}var vi,zo=c(()=>{"use strict";g();b();S();$o();({FormDivider:vi}=y)});function vt(){console.log("TweakManager has loaded SilentTyping."),Ko=["startTyping","stopTyping"].map(function(e){return Z(e,Ii,function(){})})}function It(){console.log("TweakManager has unloaded SilentTyping."),Ko.forEach(function(e){return e()})}var Ii,Ko,Qn=c(()=>{"use strict";P();w();Ii=u("startTyping"),Ko=[]});function At(){console.log("TweakManager has loaded HideUnneccesaryButtons.");let e=["ic_thread_normal_24px","ic_gift","AppsIcon"].map(function(t){return f(t)});Wo=E("render",Ai.prototype,function(t,n){let r=z(n,function(a){return a.props?.canSendVoiceMessage});r&&(r.props.canSendVoiceMessage=!1);let o=z(n,function(a){return"forceAnimateButtons"in a.props&&a.props.actions});o.props.actions=o.props.actions.filter(function(a){return!e.includes(a.source)})})}function Ct(){console.log("TweakManager has unloaded HideUnneccesaryButtons.")}var Ai,Wo,er=c(()=>{"use strict";P();w();b();ie();Ai=N("ChatInput")});function Nt(){console.log("TweakManager has loaded TrustURLs."),Yo.push(E("isTrustedDomain",Ci,function(){return!0}))}function Pt(){console.log("TweakManager has unloaded TrustURLs.");for(let e of Yo)e()}var Ci,Yo,tr=c(()=>{"use strict";P();w();Ci=Re("MaskedLinkStore"),Yo=[]});function Dt(){console.log("TweakManager has loaded EnableExperiments.");try{be.getCurrentUser().flags|=1,be._dispatcher._actionHandlers._computeOrderedActionHandlers("OVERLAY_INITIALIZE").forEach(function(e){e.name.includes("Experiment")&&e.actionHandler({serializedExperimentStore:Pi.getSerializedState(),user:{flags:1}})})}catch{let t=new Error;console.error(t.stack)}}function Mt(){console.log("TweakManager has unloaded EnableExperiments."),Ni.unsubscribe("CONNECTION_OPEN")}var Ni,Pi,nr=c(()=>{"use strict";w();g();Ni=u("_currentDispatchActionType"),Pi=u("getSerializedState")});function Bt(){console.log("TweakManager has loaded RemoveDeletePrompts.");let e=u("show","openLazy");Xo=Z("show",e,function(t,n){t?.[0]?.title===ue.Messages.DELETE_MESSAGE?t[0].onConfirm?.():n(...t)})}function Lt(){console.log("TweakManager has unloaded RemoveDeletePrompt.")}var Xo,rr=c(()=>{"use strict";P();w();g()});function or(){let[e,t]=React.useState("");return x(s),s.tweaks??={},React.createElement(T,null,React.createElement(m.View,{style:{flex:1}},React.createElement(te,{label:"Tweaks",subLabel:`Right now most tweaks are ported Vendetta plugins, when Opti rewrites, this will change. Want yours removed? Contact me I'll remove it ASAP.`,onPress:function(){console.log("hi")}}),React.createElement(We,null),React.createElement(te,{label:s.tweaks.silentTyping?.valueOf()?"Silent Typing (Enabled)":"Silent Typing (Disabled)",subLabel:"Hides that you are typing to other people.",leading:React.createElement(te.Icon,{source:f("bell")}),onPress:function(){s.tweaks.silentTyping??=!1,s.tweaks.silentTyping=!s.tweaks.silentTyping,(s.tweaks.silentTyping?vt:It)()}}),React.createElement(We,null),React.createElement(te,{label:s.tweaks.hideButtons?.valueOf()?"Remove Chat Buttons (Enabled)":"Remove Chat Buttons (Disabled)",subLabel:"Removes the Gift, Voice Message, and Activities buton.",leading:React.createElement(te.Icon,{source:f("ic_trash_24px")}),onPress:function(){s.tweaks.hideButtons??=!1,s.tweaks.hideButtons=!s.tweaks.hideButtons,(s.tweaks.hideButtons?At:Ct)()}}),React.createElement(We,null),React.createElement(te,{label:s.tweaks.trustURL?.valueOf()?"Trust All URLs (Enabled)":"Trust All URLs (Disabled)",subLabel:'Removes the "Trust This URL?" prompt.',leading:React.createElement(te.Icon,{source:f("unlocked")}),onPress:function(){s.tweaks.trustURL??=!1,s.tweaks.trustURL=!s.tweaks.trustURL,(s.tweaks.trustURL?Nt:Pt)()}}),React.createElement(We,null),React.createElement(te,{label:s.tweaks.experiments?.valueOf()?"Staff Mode (Enabled)":"Staff Mode (Disabled)",subLabel:`Enables Discord Experiments - Port of EnableStaging made by acquitelol`,leading:React.createElement(te.Icon,{source:f("debug")}),onPress:function(){s.tweaks.experiments??=!0,s.tweaks.experiments=!s.tweaks.experiments,(s.tweaks.experiments?Dt:Mt)()}}),React.createElement(We,null),React.createElement(te,{label:s.tweaks.fastdelete?.valueOf()?"Message Delete Prompt (Enabled)":"Message Delete Prompt (Disabled)",subLabel:"Delete messages without the warning prompt.",leading:React.createElement(te.Icon,{source:f("ic_message_delete")}),onPress:function(){s.tweaks.fastdelete??=!0,s.tweaks.fastdelete=!s.tweaks.fastdelete,(s.tweaks.fastdelete?Bt:Lt)()}}),React.createElement(We,null)))}var We,te,Xo=c(()=>{"use strict";g();S();b();qn();Qn();er();G();K();tr();nr();({FormDivider:We,FormRow:te}=y)});function kt(e){let{label:t,version:n,icon:r}=e;return React.createElement(Jo,{label:t,leading:React.createElement(Jo.Icon,{source:f(r)}),trailing:React.createElement(Di,null,n),onPress:function(){V.setString(`${t} - ${n}`),h("Copied version to clipboard.",f("toast_copy_link"))}})}var Jo,Di,Zo=c(()=>{"use strict";g();b();q();S();({FormRow:Jo,FormText:Di}=y)});function or(){let e=fe.useNavigation();x(s),x(Q);let t=[{label:"Discord Version",version:`${L.discord.version} (${L.discord.build})`,icon:"Discord"},{label:"React",version:L.react.version,icon:"ic_category_16px"},{label:"React Native",version:L.react.nativeVersion,icon:"mobile"},{label:"Bytecode",version:L.hermes.bytecodeVersion,icon:"ic_server_security_24px"}],n=[{label:"Loader",version:L.vendetta.loader,icon:"ic_download_24px"},{label:"OS",version:`${L.os.name} ${L.os.version}`,icon:"ic_cog_24px"},...L.os.sdk?[{label:"SDK",version:L.os.sdk,icon:"ic_profile_badge_verified_developer_color"}]:[],{label:"Manufacturer",version:L.device.manufacturer,icon:"ic_badge_staff"},{label:"Brand",version:L.device.brand,icon:"ic_settings_boost_24px"},{label:"Model",version:L.device.model,icon:"ic_phonelink_24px"},{label:m.Platform.select({android:"Codename",ios:"Machine ID"}),version:L.device.codename,icon:"ic_compose_24px"}];return React.createElement(T,null,React.createElement(m.ScrollView,{style:{flex:1},contentContainerStyle:{paddingBottom:38}},React.createElement(ct,{title:"Important",titleStyleType:"no_border"},React.createElement(R,{label:"Opti Version - "+L.vendetta.version,leading:React.createElement(R.Icon,{source:f("boost")}),onPress:function(){V.setString(`Opti Version - ${L.vendetta.version}`),h("Copied Opti version to clipboard!",f("link"))}}),React.createElement(B,null),React.createElement(R,{label:"Discord Server",leading:React.createElement(R.Icon,{source:f("Discord")}),trailing:R.Arrow,onPress:function(){return Ve.openDeeplink(Bn)}}),React.createElement(B,null),React.createElement(R,{label:"GitHub Repository",leading:React.createElement(R.Icon,{source:f("img_account_sync_github_white")}),trailing:R.Arrow,onPress:function(){return Ve.openURL(On)}})),React.createElement(ct,{title:"Actions"},React.createElement(R,{label:"Tweak Manager",subLabel:"Manage Opti's built in tweaks.",leading:React.createElement(R.Icon,{source:{uri:"https://raw.githubusercontent.com/Opti-mod/assets/main/Opti%202.png"}}),onPress:function(){return e.push("VendettaCustomPage",{title:"Tweak Manager",render:rr})}}),React.createElement(B,null),React.createElement(R,{label:"Reload Discord",subLabel:"This has a chance of crashing instead of directly reloading.",leading:React.createElement(R.Icon,{source:f("ic_message_retry")}),onPress:function(){return ve.reload()}}),React.createElement(B,null),React.createElement(R,{label:s.safeMode?.enabled?"Return to Normal Mode":"Reload in Safe Mode",subLabel:`This will reload Discord ${s.safeMode?.enabled?"normally.":"without loading plugins."}`,leading:React.createElement(R.Icon,{source:f("ic_privacy_24px")}),onPress:tt}),React.createElement(B,null),React.createElement(R,{label:"Asset Browser",leading:React.createElement(R.Icon,{source:f("ic_image")}),trailing:R.Arrow,onPress:function(){return e.push("VendettaCustomPage",{title:"Asset Browser",render:Zn})}}),React.createElement(B,null)),React.createElement(ct,{title:"Info"},React.createElement(Be,{label:"Versions",icon:"ic_information_filled_24px"},t.map(function(r,o){return React.createElement(React.Fragment,null,React.createElement(kt,{label:r.label,version:r.version,icon:r.icon}),o!==t.length-1&&React.createElement(B,null))})),React.createElement(B,null),React.createElement(Be,{label:"Platform",icon:"ic_mobile_device"},n.map(function(r,o){return React.createElement(React.Fragment,null,React.createElement(kt,{label:r.label,version:r.version,icon:r.icon}),o!==n.length-1&&React.createElement(B,null))})),React.createElement(B,null),React.createElement(Be,{label:"Opti Stats",icon:"ic_list"},React.createElement(R,{label:"Enabled Plugins: "+Pn(),leading:React.createElement(R.Icon,{source:f("ic_download_24px")})}),React.createElement(R,{label:"Enabled Themes: "+mn(),leading:React.createElement(R.Icon,{source:f("ic_paint_brush")})}))),React.createElement(ct,{title:"Developer"},React.createElement(R,{label:"ErrorBoundary Tools",leading:React.createElement(R.Icon,{source:f("ic_warning_24px")}),trailing:R.Arrow,onPress:function(){return Bi({key:"ErrorBoundaryTools",header:{title:"Which ErrorBoundary do you want to trip?",icon:React.createElement(R.Icon,{style:{marginRight:8},source:f("ic_warning_24px")}),onClose:function(){return Mi()}},options:[{label:"Opti",onPress:function(){return e.push("VendettaCustomPage",{render:function(){return React.createElement("undefined",null)}})}},{label:"Discord",isDestructive:!0,onPress:function(){return e.push("VendettaCustomPage",{noErrorBoundary:!0})}}]})}}),React.createElement(B,null),React.createElement(Qo,{value:s.debuggerUrl,onChange:function(r){return s.debuggerUrl=r},placeholder:"127.0.0.1:9090",title:"Debugger URL"}),React.createElement(B,null),React.createElement(R,{label:"Connect to debug websocket",leading:React.createElement(R.Icon,{source:f("copy")}),onPress:function(){return xn(s.debuggerUrl)}}),window.__vendetta_rdc&&React.createElement(React.Fragment,null,React.createElement(B,null),React.createElement(R,{label:"Connect to React DevTools",leading:React.createElement(R.Icon,{source:f("ic_badge_staff")}),onPress:function(){return window.__vendetta_rdc?.connectToDevTools({host:s.debuggerUrl.split(":")?.[0],resolveRNStyle:m.StyleSheet.flatten})}})),window.__vendetta_loader?.features.loaderConfig&&React.createElement(ct,{title:"Developer"},React.createElement(qo,{label:"Load from custom url",subLabel:"Load Vendetta from a custom endpoint.",leading:React.createElement(R.Icon,{source:f("copy")}),value:Q.customLoadUrl.enabled,onValueChange:function(r){Q.customLoadUrl.enabled=r}}),React.createElement(B,null),Q.customLoadUrl.enabled&&React.createElement(React.Fragment,null,React.createElement(Qo,{value:Q.customLoadUrl.url,onChange:function(r){return Q.customLoadUrl.url=r},placeholder:"http://localhost:4040/vendetta.js",title:"VENDETTA URL"}),React.createElement(B,null)),window.__vendetta_loader.features.devtools&&React.createElement(qo,{label:"Load React DevTools",subLabel:`Version: ${window.__vendetta_loader.features.devtools.version}`,leading:React.createElement(R.Icon,{source:f("ic_badge_staff")}),value:Q.loadReactDevTools,onValueChange:function(r){Q.loadReactDevTools=r}}),React.createElement(B,null)))))}var R,qo,ct,B,Qo,Mi,Bi,L,ea=c(()=>{"use strict";g();Me();Ge();w();K();he();b();S();G();G();$o();Xo();Zo();Ge();de();W();g();q();({FormRow:R,FormSwitchRow:qo,FormSection:ct,FormDivider:B,FormInput:Qo}=y),{hideActionSheet:Mi}=u("openLazy","hideActionSheet"),{showSimpleActionSheet:Bi}=u("showSimpleActionSheet"),L=nt()});function lt(e){let{items:t,safeModeMessage:n,safeModeExtras:r,card:o}=e;x(s),x(t);let[a,i]=React.useState("");return React.createElement(T,null,React.createElement(m.FlatList,{ListHeaderComponent:React.createElement(React.Fragment,null,s.safeMode?.enabled&&React.createElement(m.View,{style:{marginBottom:10}},React.createElement(jn,{messageType:0},n),r),React.createElement(Ke,{style:{marginBottom:10},onChangeText:function(l){return i(l.toLowerCase())},placeholder:"Search Plugins"})),style:{paddingHorizontal:10,paddingTop:10},contentContainerStyle:{paddingBottom:20},data:Object.values(t).filter(function(l){return l.id?.toLowerCase().includes(a)}),renderItem:function(l){let{item:d,index:p}=l;return React.createElement(o,{item:d,index:p})}}))}var ar=c(()=>{"use strict";g();K();S();G()});function ft(e){let t=e.toggleValue??!1;return React.createElement(m.View,{style:[ut.card,{marginTop:e.index!==0?10:0}]},React.createElement(Ot,{style:ut.header,label:e.headerLabel,leading:e.headerIcon&&React.createElement(Ot.Icon,{source:f(e.headerIcon)}),trailing:e.toggleType&&(e.toggleType==="switch"?React.createElement(Li,{style:m.Platform.OS==="android"&&{marginVertical:-15},value:e.toggleValue,onValueChange:e.onToggleChange}):React.createElement(m.Pressable,{onPress:function(){t=!t,e.onToggleChange?.(t)}},React.createElement(ki,{selected:e.toggleValue})))}),React.createElement(Ot,{label:e.descriptionLabel,trailing:React.createElement(m.View,{style:ut.actions},e.overflowActions&&React.createElement(m.TouchableOpacity,{onPress:function(){return Fi({key:"CardOverflow",header:{title:e.overflowTitle,icon:e.headerIcon&&React.createElement(Ot.Icon,{style:{marginRight:8},source:f(e.headerIcon)}),onClose:function(){return Oi()}},options:e.overflowActions?.map(function(n){return{...n,icon:f(n.icon)}})})}},React.createElement(m.Image,{style:ut.icon,source:f("ic_more_24px")})),e.actions?.map(function(n){let{icon:r,onPress:o}=n;return React.createElement(m.TouchableOpacity,{onPress:o},React.createElement(m.Image,{style:ut.icon,source:f(r)}))}))}))}var Ot,Li,ki,Oi,Fi,ut,ir=c(()=>{"use strict";g();w();b();Le();S();({FormRow:Ot,FormSwitch:Li,FormRadio:ki}=y),{hideActionSheet:Oi}=u("openLazy","hideActionSheet"),{showSimpleActionSheet:Fi}=u("showSimpleActionSheet"),ut=U.createThemedStyleSheet({card:{backgroundColor:v?.BACKGROUND_SECONDARY,borderRadius:7},header:{padding:0,backgroundColor:v?.PRIMARY_DARK_800,borderTopLeftRadius:5,borderTopRightRadius:5},actions:{flexDirection:"row-reverse",alignItems:"center"},icon:{width:22,height:22,marginLeft:5,tintColor:v?.INTERACTIVE_NORMAL}})});async function ta(e,t){e.enabled&&ze(e.id,!1),t(),e.enabled&&await $e(e.id)}function sr(e){let{item:t,index:n}=e,r=Dn(t.id),o=fe.useNavigation(),[a,i]=React.useState(!1);return a?null:React.createElement(ft,{index:n,headerLabel:`${t.manifest.name} -by ${t.manifest.authors.map(function(l){return l.name}).join(", ")}`,headerIcon:t.manifest.vendetta?.icon||"ic_application_command_24px",toggleType:"switch",toggleValue:t.enabled,onToggleChange:function(l){try{l?$e(t.id):ze(t.id)}catch(d){h(d.message,f("Small"))}},descriptionLabel:t.manifest.description,overflowTitle:t.manifest.name,overflowActions:[{label:"View Creator Profile",icon:"ic_profile_24px",onPress:function(){be.getUser(t.manifest.authors[0]?.id)?Pe.showUserProfile({userId:t.manifest.authors[0]?.id}):Qe.fetchProfile(t.manifest.authors[0]?.id).then(function(){Pe.showUserProfile({userId:t.manifest.authors[0]?.id})})}},{icon:"RetryIcon",label:"Refetch",onPress:async function(){ta(t,function(){je(t.id).then(async function(){h("Successfully refetched plugin.",f("toast_image_saved"))}).catch(function(){h("Failed to refetch plugin!",f("Small"))})})}},{icon:"copy",label:"Copy URL",onPress:function(){V.setString(t.id),h("Copied plugin URL to clipboard.",f("toast_copy_link"))}},{icon:"ic_download_24px",label:t.update?"Disable updates":"Enable updates",onPress:function(){t.update=!t.update,h(`${t.update?"Enabled":"Disabled"} updates for ${t.manifest.name}.`,f("toast_image_saved"))}},{icon:"ic_duplicate",label:"Clear data",isDestructive:!0,onPress:function(){return ee({title:"Wait!",content:`Are you sure you wish to clear the data of ${t.manifest.name}?`,confirmText:"Clear",cancelText:"Cancel",confirmColor:$.RED,onConfirm:function(){ta(t,function(){try{ge.removeItem(t.id),h(`Cleared data for ${t.manifest.name}.`,f("trash"))}catch{h(`Failed to clear data for ${t.manifest.name}!`,f("Small"))}})}})}},{icon:"ic_message_delete",label:"Delete",isDestructive:!0,onPress:function(){return ee({title:"Wait!",content:`Are you sure you wish to delete ${t.manifest.name}? This will clear all of the plugin's data.`,confirmText:"Delete",cancelText:"Cancel",confirmColor:$.RED,onConfirm:function(){try{Cn(t.id),i(!0)}catch(l){h(l.message,f("Small"))}}})}}],actions:[...r?[{icon:"settings",onPress:function(){return o.push("VendettaCustomPage",{title:t.manifest.name,render:r})}}]:[]]})}var na=c(()=>{"use strict";He();g();de();he();b();q();ke();ir()});function cr(){return x(s),React.createElement(lt,{items:M,safeModeMessage:"Safe Mode prevents plugins from being loaded. To exit Safe Mode go to the 'Opti' tab and go back to Normal Mode.",card:sr})}var ra=c(()=>{"use strict";K();de();G();ar();na()});async function oa(e,t){await Ce(e?t:"default"),ve.reload()}function lr(e){let{item:t,index:n}=e;x(s);let[r,o]=React.useState(!1);if(r)return null;let a=t.data.authors;return React.createElement(ft,{index:n,headerLabel:`${t.data.name} ${a?` -by ${a.map(function(i){return i.name}).join(", ")}`:""}`,headerIcon:"ic_theme_24px",descriptionLabel:t.data.description??"No description.",toggleType:s.safeMode?.enabled?void 0:"switch",toggleValue:t.selected,onToggleChange:function(i){oa(i,t.id)},overflowTitle:t.data.name,overflowActions:[{label:"View Creator Profile",icon:"ic_profile_24px",onPress:function(){be.getUser(t.data.authors[0]?.id)?Pe.showUserProfile({userId:t.data.authors[0]?.id}):Qe.fetchProfile(t.data.authors[0]?.id).then(function(){Pe.showUserProfile({userId:t.data.authors[0]?.id})})}},{icon:"ic_sync_24px",label:"Refetch",onPress:function(){qe(t.id,t.selected).then(function(){t.selected?ee({title:"Theme refetched",content:"A reload is required to see the changes. Do you want to reload now?",confirmText:"Reload",cancelText:"Cancel",confirmColor:$.RED,onConfirm:function(){return ve.reload()}}):h("Successfully refetched theme.",f("toast_image_saved"))}).catch(function(){h("Failed to refetch theme!",f("Small"))})}},{icon:"copy",label:"Copy URL",onPress:function(){V.setString(t.id),h("Copied theme URL to clipboard.",f("toast_copy_link"))}},{icon:"ic_message_delete",label:"Delete",isDestructive:!0,onPress:function(){return ee({title:"Wait!",content:`Are you sure you wish to delete ${t.data.name}?`,confirmText:"Delete",cancelText:"Cancel",confirmColor:$.RED,onConfirm:function(){un(t.id).then(function(i){o(!0),i&&oa(!1,t.id)}).catch(function(i){h(i.message,f("Small"))})}})}}]})}var aa=c(()=>{"use strict";He();g();W();K();he();b();ke();q();G();ir()});function ur(){return x(s),React.createElement(lt,{items:F,safeModeMessage:`You are in Safe Mode, meaning themes have been temporarily disabled.${s.safeMode?.currentThemeId?" If a theme appears to be causing the issue, you can press below to disable it.":""}`,safeModeExtras:s.safeMode?.currentThemeId?React.createElement(_,{text:"Disable Shader",color:$.BRAND,size:"small",onPress:function(){delete s.safeMode?.currentThemeId},style:{marginTop:8}}):void 0,card:lr})}var ia=c(()=>{"use strict";He();K();W();S();G();ar();aa()});var Ui,dm,pm,gm,hm,Vi,Ft,Ut,Ye,mt,sa,fr,Vt=c(()=>{"use strict";g();de();W();ke();Le();q();ie();b();G();Vn();Ho();ea();ra();ia();Me();S();({FormRow:Ui,FormSwitchRow:dm,FormSection:pm,FormDivider:gm,FormInput:hm}=y),Vi=U.createThemedStyleSheet({container:{flex:1,backgroundColor:v.BACKGROUND_MOBILE_PRIMARY}}),Ft=function(e,t){return t?wt.snakeCase(e).toUpperCase():e},Ut=function(e,t){return Object.fromEntries(e.map(function(n){return[n.key,typeof t=="function"?t(n):typeof t=="string"?n[t]:t]}))},Ye=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;return[{key:Ft("VendettaSettings",e),title:"Opti",leading:React.createElement(Ui.Icon,{source:{uri:"https://raw.githubusercontent.com/Opti-mod/assets/main/Opti%202.png"}}),render:or},{key:Ft("VendettaPlugins",e),title:"Plugins",icon:"ic_behavior_24px",options:{headerRight:function(){return React.createElement(Tt,{alertTitle:"Install Plugin",installFunction:async function(t){if(!t.startsWith(De))setImmediate(function(){return ee({title:"Unproxied Plugin",content:"The plugin you are trying to install has not been proxied. Want to download it anyways?",confirmText:"Install",onConfirm:function(){return xe(t).then(function(){return h("Installed plugin",f("Check"))}).catch(function(n){return h(n?.message??`${n}`,f("Small"))})},cancelText:"Cancel"})});else return await xe(t)}})}},render:cr},{key:Ft("VendettaThemes",e),title:"Shaders",icon:"ic_theme_24px",shouldRender:function(){return window.__vendetta_loader?.features.hasOwnProperty("themes")??!0},options:{headerRight:function(){return!s.safeMode?.enabled&&React.createElement(Tt,{alertTitle:"Install Theme",installFunction:Ae})}},render:ur},{key:Ft("VendettaCustomPage",e),title:"Opti Page",shouldRender:function(){return!1},render:function(t){let{render:n,noErrorBoundary:r,...o}=t,a=fe.useNavigation();return a.addListener("focus",function(){return a.setOptions(J(o,"render","noErrorBoundary"))}),r?React.createElement(n,null):React.createElement(T,null,React.createElement(n,null))}}]},mt=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;return Ye(e).filter(function(t){return t.shouldRender?.()??!0})},sa=function(){return Ut(Ye(),function(e){return{title:e.title,render:e.render,...e.options}})},fr=function(){let e=Ye(!0);return{getLayout:function(){return{title:"Opti",label:"Opti",settings:mt(!0).map(function(t){return t.key})}},titleConfig:Ut(e,"title"),relationships:Ut(e,null),rendererConfigs:Ut(e,function(t){let n=React.memo(function(r){let{navigation:o,route:a}=r;return o.addListener("focus",function(){return o.setOptions(t.options)}),React.createElement(m.View,{style:Vi.container},React.createElement(t.render,a.params))});return{type:"route",title:function(){return t.title},icon:t.icon?f(t.icon):null,screen:{route:wt.chain(t.key).camelCase().upperFirst().value(),getComponent:function(){return n}}}})}}});function dr(){let e=fe.useNavigation();x(s);let t=mt();return React.createElement(T,null,React.createElement(Gi,{key:"Vendetta",title:`Opti ${s.safeMode?.enabled?" (Safe Mode)":""}`},t.map(function(n,r){return React.createElement(React.Fragment,null,React.createElement(mr,{label:n.title,leading:React.createElement(mr.Icon,{source:f(n.icon)}),trailing:mr.Arrow,onPress:function(){return e.push(n.key)}}),r!==t.length-1&&React.createElement(Hi,null))})))}var mr,Gi,Hi,ca=c(()=>{"use strict";g();K();b();Vt();S();G();({FormRow:mr,FormSection:Gi,FormDivider:Hi}=y)});function pr(){let e=new Array;return e.push(E("default",ji,function(t,n){return{...n,...sa()}})),E("default",$i,function(t,n){let r=z(n.props.children,function(o){return o.type&&o.type.name==="UserSettingsOverview"});e.push(E("renderSupportAndAcknowledgements",r.type.prototype,function(o,a){let{props:{children:i}}=a,l=i.findIndex(function(d){return d?.type?.name==="UploadLogsButton"});l!==-1&&i.splice(l,1)})),e.push(E("render",r.type.prototype,function(o,a){let{props:{children:i}}=a,l=[ue.Messages.BILLING_SETTINGS,ue.Messages.PREMIUM_SETTINGS];i=z(i,function(p){return p.children?.[1].type?.name==="FormSection"}).children;let d=i.findIndex(function(p){return l.includes(p?.props.label)});i.splice(d===-1?4:d,0,React.createElement(dr,null))}))},!0),function(){return e.forEach(function(t){return t()})}}var ji,$i,la=c(()=>{"use strict";g();w();P();ie();Vt();ca();ji=N("getScreens",!1),$i=N("UserSettingsOverviewWrapper",!1)});function hr(){let e=new Array;return Ki(e)||zi(e),function(){return e.forEach(function(t){return t?.()})}}function zi(e){let t=u("useOverviewSettings"),n=u("getSettingTitleConfig"),r=u("SETTING_RELATIONSHIPS","SETTING_RENDERER_CONFIGS"),o="getSettingSearchListItems",a="getSettingListItems",i=u(o),l=!i,d=l?a:o,p=i??u(a);if(!p||!t)return;let k=Ye(!0),O=mt(!0),I=fr();e.push(E("useOverviewSettings",t,function(Te,Xe){return ua(Xe,I.getLayout())})),e.push(E("getSettingTitleConfig",n,function(Te,Xe){return{...Xe,...I.titleConfig}})),e.push(E(d,p,function(Te,Xe){let[Ta]=Te;return[...O.filter(function(ne){return Ta.includes(ne.key)}).map(function(ne){return{type:"setting_search_result",ancestorRendererData:I.rendererConfigs[ne.key],setting:ne.key,title:I.titleConfig[ne.key],breadcrumbs:["Vendetta"],icon:I.rendererConfigs[ne.key].icon}}),...Xe.filter(function(ne){return l||!k.map(function(Gt){return Gt.key}).includes(ne.setting)})].map(function(ne,Gt,va){return{...ne,index:Gt,total:va.length}})}));let H=r.SETTING_RELATIONSHIPS,j=r.SETTING_RENDERER_CONFIGS;return r.SETTING_RELATIONSHIPS={...H,...I.relationships},r.SETTING_RENDERER_CONFIGS={...j,...I.rendererConfigs},e.push(function(){r.SETTING_RELATIONSHIPS=H,r.SETTING_RENDERER_CONFIGS=j}),!0}function Ki(e){let t=u("SearchableSettingsList"),n=u("SETTING_RENDERER_CONFIG"),r=u("getSettingListItems");if(!r||!t||!n)return!1;let o=Ye(!0),a=fr();e.push(Zt("type",t.SearchableSettingsList,function(l){let[{sections:d}]=l;return ua(d,a.getLayout())})),e.push(E("getSettingListSearchResultItems",r,function(l,d){d.forEach(function(p){return o.some(function(k){return k.key===p.setting})&&(p.breadcrumbs=["Vendetta"])})}));let i=n.SETTING_RENDERER_CONFIG;return n.SETTING_RENDERER_CONFIG={...i,...a.rendererConfigs},e.push(function(){n.SETTING_RENDERER_CONFIG=i}),!0}function ua(e,t){if(!Array.isArray(e)||e.find(function(o){return gr(o,"Vendetta")}))return;let n=e.findIndex(function(o){return gr(o,ue.Messages.ACCOUNT_SETTINGS)});e.splice(n+1,0,t);let r=e.find(function(o){return gr(o,ue.Messages.SUPPORT)});r&&(r.settings=r.settings.filter(function(o){return o!=="UPLOAD_DEBUG_LOGS"}))}var gr,fa=c(()=>{"use strict";w();P();Vt();g();gr=function(e,t){return e?.label===t||e?.title===t}});function Rr(){let e=[pr(),hr()];return function(){return e.forEach(function(t){return t?.()})}}var ma=c(()=>{"use strict";la();fa()});function ga(e){let{locale:t}=e;try{da&&(da.overrideTheme(Wi?.theme??"dark"),pa&&Yi.useAMOLEDTheme===2&&pa.setAMOLEDThemeEnabled(!0))}catch(n){D.error("Failed to fix theme...",n)}try{En.locale(t.toLowerCase())}catch(n){D.error("Failed to fix timestamps...",n)}yt.unsubscribe("I18N_LOAD_SUCCESS",ga)}function ha(){return yt.subscribe("I18N_LOAD_SUCCESS",ga)}var da,pa,Wi,Yi,Ra=c(()=>{"use strict";g();w();Ie();da=u("updateTheme","overrideTheme"),pa=u("setAMOLEDThemeEnabled"),Wi=Re("ThemeStore"),Yi=Re("UnsyncedUserSettingsStore")});var Ea=c(()=>{"use strict"});async function ya(e){return{patcher:J(Mr,"unpatchAll"),metro:{...$t,common:{...yn}},constants:Fn,utils:Wt,debug:J(Tn,"versionHash","patchLogHook","toggleSafeMode"),ui:{components:zn,toasts:_n,alerts:Yn,assets:bn,...Gn},plugins:J(Mn,"initPlugins","evalPlugin"),themes:J(dn,"initThemes"),commands:J(In,"patchCommands"),storage:an,settings:s,loader:{identity:window.__vendetta_loader,config:Q},logger:D,version:bt,unload:function(){e.filter(function(t){return typeof t=="function"}).forEach(function(t){return t()}),delete window.vendetta}}}var wa=c(()=>{"use strict";P();Ie();G();Me();Ge();de();W();An();K();w();g();S();q();ke();b();Le();ie()});function ba(){s.tweaks??={},console.log("TweakManager has initialized."),s.tweaks.trustURL==null&&(s.tweaks.trustURL=!1),s.tweaks.hideButtons==null&&(s.tweaks.hideButtons=!1),s.tweaks.silentTyping==null&&(s.tweaks.silentTyping=!1),s.tweaks.experiments==null&&(s.tweaks.experiments=!1),s.tweaks.fastdelete==null&&(s.tweaks.fastdelete=!1),(s.tweaks.trustURL?Nt:Pt)(),(s.tweaks.hideButtons?At:Ct)(),(s.tweaks.silentTyping?vt:It)(),(s.tweaks.experiments?Dt:Mt)(),(s.tweaks.fastdelete?Bt:Lt)()}var _a=c(()=>{"use strict";G();qn();Qn();er();tr();nr()});var xa={};A(xa,{default:()=>Xi});async function Xi(){let e=await Promise.all([Sn(),wn(),vn(),ln(),ha(),Vo(),Rr(),Xn(),void 0]);window.vendetta=await ya(e),e.push(await Nn()),e.push(await ba()),D.log("Opti is ready!")}var Sa=c(()=>{"use strict";Ge();An();de();W();b();Oo();Go();ma();Ra();Ea();Ie();wa();_a()});he();console.log("Opti has loaded!");Object.freeze=Object;Object.seal=Object;Promise.resolve().then(()=>(Sa(),xa)).then(function(e){return e.default()}).catch(function(e){console.log(e?.stack??e.toString()),alert([`Opti failed to initialize and plugins will not be loaded. -`,`Build Number: ${Je.Build}`,"Opti Version: 6aa1636",e?.stack||e.toString()].join(` + Port of EnableStaging made by acquitelol`,leading:React.createElement(te.Icon,{source:f("debug")}),onPress:function(){s.tweaks.experiments??=!0,s.tweaks.experiments=!s.tweaks.experiments,(s.tweaks.experiments?Dt:Mt)()}}),React.createElement(We,null),React.createElement(te,{label:s.tweaks.fastdelete?.valueOf()?"Message Delete Prompt (Enabled)":"Message Delete Prompt (Disabled)",subLabel:"Delete messages without the warning prompt.",leading:React.createElement(te.Icon,{source:f("ic_message_delete")}),onPress:function(){s.tweaks.fastdelete??=!0,s.tweaks.fastdelete=!s.tweaks.fastdelete,(s.tweaks.fastdelete?Bt:Lt)()}}),React.createElement(We,null)))}var We,te,Jo=c(()=>{"use strict";g();S();b();Qn();er();tr();G();K();nr();rr();({FormDivider:We,FormRow:te}=y)});function kt(e){let{label:t,version:n,icon:r}=e;return React.createElement(Zo,{label:t,leading:React.createElement(Zo.Icon,{source:f(r)}),trailing:React.createElement(Di,null,n),onPress:function(){V.setString(`${t} - ${n}`),h("Copied version to clipboard.",f("toast_copy_link"))}})}var Zo,Di,qo=c(()=>{"use strict";g();b();q();S();({FormRow:Zo,FormText:Di}=y)});function ar(){let e=fe.useNavigation();x(s),x(Q);let t=[{label:"Discord Version",version:`${L.discord.version} (${L.discord.build})`,icon:"Discord"},{label:"React",version:L.react.version,icon:"ic_category_16px"},{label:"React Native",version:L.react.nativeVersion,icon:"mobile"},{label:"Bytecode",version:L.hermes.bytecodeVersion,icon:"ic_server_security_24px"}],n=[{label:"Loader",version:L.vendetta.loader,icon:"ic_download_24px"},{label:"OS",version:`${L.os.name} ${L.os.version}`,icon:"ic_cog_24px"},...L.os.sdk?[{label:"SDK",version:L.os.sdk,icon:"ic_profile_badge_verified_developer_color"}]:[],{label:"Manufacturer",version:L.device.manufacturer,icon:"ic_badge_staff"},{label:"Brand",version:L.device.brand,icon:"ic_settings_boost_24px"},{label:"Model",version:L.device.model,icon:"ic_phonelink_24px"},{label:m.Platform.select({android:"Codename",ios:"Machine ID"}),version:L.device.codename,icon:"ic_compose_24px"}];return React.createElement(T,null,React.createElement(m.ScrollView,{style:{flex:1},contentContainerStyle:{paddingBottom:38}},React.createElement(ct,{title:"Important",titleStyleType:"no_border"},React.createElement(R,{label:"Opti Version - "+L.vendetta.version,leading:React.createElement(R.Icon,{source:f("boost")}),onPress:function(){V.setString(`Opti Version - ${L.vendetta.version}`),h("Copied Opti version to clipboard!",f("staff"))}}),React.createElement(B,null),React.createElement(R,{label:"Discord Server",leading:React.createElement(R.Icon,{source:f("Discord")}),trailing:R.Arrow,onPress:function(){return Ve.openDeeplink(Ln)}}),React.createElement(B,null),React.createElement(R,{label:"GitHub Repository",leading:React.createElement(R.Icon,{source:f("img_account_sync_github_white")}),trailing:R.Arrow,onPress:function(){return Ve.openURL(Fn)}})),React.createElement(ct,{title:"Actions"},React.createElement(R,{label:"Tweak Manager",subLabel:"Manage Opti's built in tweaks.",leading:React.createElement(R.Icon,{source:{uri:"https://raw.githubusercontent.com/Opti-mod/assets/main/Opti%202.png"}}),onPress:function(){return e.push("VendettaCustomPage",{title:"Tweak Manager",render:or})}}),React.createElement(B,null),React.createElement(R,{label:"Reload Discord",subLabel:"This has a chance of crashing instead of directly reloading.",leading:React.createElement(R.Icon,{source:f("ic_message_retry")}),onPress:function(){return ve.reload()}}),React.createElement(B,null),React.createElement(R,{label:s.safeMode?.enabled?"Return to Normal Mode":"Reload in Safe Mode",subLabel:`This will reload Discord ${s.safeMode?.enabled?"normally.":"without loading plugins."}`,leading:React.createElement(R.Icon,{source:f("ic_privacy_24px")}),onPress:tt}),React.createElement(B,null),React.createElement(R,{label:"Asset Browser",leading:React.createElement(R.Icon,{source:f("ic_image")}),trailing:R.Arrow,onPress:function(){return e.push("VendettaCustomPage",{title:"Asset Browser",render:qn})}}),React.createElement(B,null)),React.createElement(ct,{title:"Info"},React.createElement(Be,{label:"Versions",icon:"ic_information_filled_24px"},t.map(function(r,o){return React.createElement(React.Fragment,null,React.createElement(kt,{label:r.label,version:r.version,icon:r.icon}),o!==t.length-1&&React.createElement(B,null))})),React.createElement(B,null),React.createElement(Be,{label:"Platform",icon:"ic_mobile_device"},n.map(function(r,o){return React.createElement(React.Fragment,null,React.createElement(kt,{label:r.label,version:r.version,icon:r.icon}),o!==n.length-1&&React.createElement(B,null))})),React.createElement(B,null),React.createElement(Be,{label:"Opti Stats",icon:"ic_list"},React.createElement(R,{label:"Enabled Plugins: "+Dn(),leading:React.createElement(R.Icon,{source:f("ic_download_24px")})}),React.createElement(R,{label:"Enabled Themes: "+mn(),leading:React.createElement(R.Icon,{source:f("ic_paint_brush")})}))),React.createElement(ct,{title:"Developer"},React.createElement(R,{label:"ErrorBoundary Tools",leading:React.createElement(R.Icon,{source:f("ic_warning_24px")}),trailing:R.Arrow,onPress:function(){return Bi({key:"ErrorBoundaryTools",header:{title:"Which ErrorBoundary do you want to trip?",icon:React.createElement(R.Icon,{style:{marginRight:8},source:f("ic_warning_24px")}),onClose:function(){return Mi()}},options:[{label:"Opti",onPress:function(){return e.push("VendettaCustomPage",{render:function(){return React.createElement("undefined",null)}})}},{label:"Discord",isDestructive:!0,onPress:function(){return e.push("VendettaCustomPage",{noErrorBoundary:!0})}}]})}}),React.createElement(B,null),React.createElement(ea,{value:s.debuggerUrl,onChange:function(r){return s.debuggerUrl=r},placeholder:"127.0.0.1:9090",title:"Debugger URL"}),React.createElement(B,null),React.createElement(R,{label:"Connect to debug websocket",leading:React.createElement(R.Icon,{source:f("copy")}),onPress:function(){return xn(s.debuggerUrl)}}),window.__vendetta_rdc&&React.createElement(React.Fragment,null,React.createElement(B,null),React.createElement(R,{label:"Connect to React DevTools",leading:React.createElement(R.Icon,{source:f("ic_badge_staff")}),onPress:function(){return window.__vendetta_rdc?.connectToDevTools({host:s.debuggerUrl.split(":")?.[0],resolveRNStyle:m.StyleSheet.flatten})}})),window.__vendetta_loader?.features.loaderConfig&&React.createElement(ct,{title:"Developer"},React.createElement(Qo,{label:"Load from custom url",subLabel:"Load Vendetta from a custom endpoint.",leading:React.createElement(R.Icon,{source:f("copy")}),value:Q.customLoadUrl.enabled,onValueChange:function(r){Q.customLoadUrl.enabled=r}}),React.createElement(B,null),Q.customLoadUrl.enabled&&React.createElement(React.Fragment,null,React.createElement(ea,{value:Q.customLoadUrl.url,onChange:function(r){return Q.customLoadUrl.url=r},placeholder:"http://localhost:4040/vendetta.js",title:"VENDETTA URL"}),React.createElement(B,null)),window.__vendetta_loader.features.devtools&&React.createElement(Qo,{label:"Load React DevTools",subLabel:`Version: ${window.__vendetta_loader.features.devtools.version}`,leading:React.createElement(R.Icon,{source:f("ic_badge_staff")}),value:Q.loadReactDevTools,onValueChange:function(r){Q.loadReactDevTools=r}}),React.createElement(B,null)))))}var R,Qo,ct,B,ea,Mi,Bi,L,ta=c(()=>{"use strict";g();Me();Ge();w();K();he();b();S();G();G();zo();Jo();qo();Ge();de();W();g();q();({FormRow:R,FormSwitchRow:Qo,FormSection:ct,FormDivider:B,FormInput:ea}=y),{hideActionSheet:Mi}=u("openLazy","hideActionSheet"),{showSimpleActionSheet:Bi}=u("showSimpleActionSheet"),L=nt()});function lt(e){let{items:t,safeModeMessage:n,safeModeExtras:r,card:o}=e;x(s),x(t);let[a,i]=React.useState("");return React.createElement(T,null,React.createElement(m.FlatList,{ListHeaderComponent:React.createElement(React.Fragment,null,s.safeMode?.enabled&&React.createElement(m.View,{style:{marginBottom:10}},React.createElement($n,{messageType:0},n),r),React.createElement(Ke,{style:{marginBottom:10},onChangeText:function(l){return i(l.toLowerCase())},placeholder:"Search Plugins"})),style:{paddingHorizontal:10,paddingTop:10},contentContainerStyle:{paddingBottom:20},data:Object.values(t).filter(function(l){return l.id?.toLowerCase().includes(a)}),renderItem:function(l){let{item:d,index:p}=l;return React.createElement(o,{item:d,index:p})}}))}var ir=c(()=>{"use strict";g();K();S();G()});function ft(e){let t=e.toggleValue??!1;return React.createElement(m.View,{style:[ut.card,{marginTop:e.index!==0?10:0}]},React.createElement(Ot,{style:ut.header,label:e.headerLabel,leading:e.headerIcon&&React.createElement(Ot.Icon,{source:f(e.headerIcon)}),trailing:e.toggleType&&(e.toggleType==="switch"?React.createElement(Li,{style:m.Platform.OS==="android"&&{marginVertical:-15},value:e.toggleValue,onValueChange:e.onToggleChange}):React.createElement(m.Pressable,{onPress:function(){t=!t,e.onToggleChange?.(t)}},React.createElement(ki,{selected:e.toggleValue})))}),React.createElement(Ot,{label:e.descriptionLabel,trailing:React.createElement(m.View,{style:ut.actions},e.overflowActions&&React.createElement(m.TouchableOpacity,{onPress:function(){return Fi({key:"CardOverflow",header:{title:e.overflowTitle,icon:e.headerIcon&&React.createElement(Ot.Icon,{style:{marginRight:8},source:f(e.headerIcon)}),onClose:function(){return Oi()}},options:e.overflowActions?.map(function(n){return{...n,icon:f(n.icon)}})})}},React.createElement(m.Image,{style:ut.icon,source:f("ic_more_24px")})),e.actions?.map(function(n){let{icon:r,onPress:o}=n;return React.createElement(m.TouchableOpacity,{onPress:o},React.createElement(m.Image,{style:ut.icon,source:f(r)}))}))}))}var Ot,Li,ki,Oi,Fi,ut,sr=c(()=>{"use strict";g();w();b();Le();S();({FormRow:Ot,FormSwitch:Li,FormRadio:ki}=y),{hideActionSheet:Oi}=u("openLazy","hideActionSheet"),{showSimpleActionSheet:Fi}=u("showSimpleActionSheet"),ut=U.createThemedStyleSheet({card:{backgroundColor:v?.BACKGROUND_SECONDARY,borderRadius:7},header:{padding:0,backgroundColor:v?.PRIMARY_DARK_800,borderTopLeftRadius:5,borderTopRightRadius:5},actions:{flexDirection:"row-reverse",alignItems:"center"},icon:{width:22,height:22,marginLeft:5,tintColor:v?.INTERACTIVE_NORMAL}})});async function na(e,t){e.enabled&&ze(e.id,!1),t(),e.enabled&&await $e(e.id)}function cr(e){let{item:t,index:n}=e,r=Mn(t.id),o=fe.useNavigation(),[a,i]=React.useState(!1);return a?null:React.createElement(ft,{index:n,headerLabel:`${t.manifest.name} +by ${t.manifest.authors.map(function(l){return l.name}).join(", ")}`,headerIcon:t.manifest.vendetta?.icon||"ic_application_command_24px",toggleType:"switch",toggleValue:t.enabled,onToggleChange:function(l){try{l?$e(t.id):ze(t.id)}catch(d){h(d.message,f("Small"))}},descriptionLabel:t.manifest.description,overflowTitle:t.manifest.name,overflowActions:[{label:"View Creator Profile",icon:"ic_profile_24px",onPress:function(){be.getUser(t.manifest.authors[0]?.id)?Pe.showUserProfile({userId:t.manifest.authors[0]?.id}):Qe.fetchProfile(t.manifest.authors[0]?.id).then(function(){Pe.showUserProfile({userId:t.manifest.authors[0]?.id})})}},{icon:"RetryIcon",label:"Refetch",onPress:async function(){na(t,function(){je(t.id).then(async function(){h("Successfully refetched plugin.",f("toast_image_saved"))}).catch(function(){h("Failed to refetch plugin!",f("Small"))})})}},{icon:"copy",label:"Copy URL",onPress:function(){V.setString(t.id),h("Copied plugin URL to clipboard.",f("toast_copy_link"))}},{icon:"ic_download_24px",label:t.update?"Disable updates":"Enable updates",onPress:function(){t.update=!t.update,h(`${t.update?"Enabled":"Disabled"} updates for ${t.manifest.name}.`,f("toast_image_saved"))}},{icon:"ic_duplicate",label:"Clear data",isDestructive:!0,onPress:function(){return ee({title:"Wait!",content:`Are you sure you wish to clear the data of ${t.manifest.name}?`,confirmText:"Clear",cancelText:"Cancel",confirmColor:$.RED,onConfirm:function(){na(t,function(){try{ge.removeItem(t.id),h(`Cleared data for ${t.manifest.name}.`,f("trash"))}catch{h(`Failed to clear data for ${t.manifest.name}!`,f("Small"))}})}})}},{icon:"ic_message_delete",label:"Delete",isDestructive:!0,onPress:function(){return ee({title:"Wait!",content:`Are you sure you wish to delete ${t.manifest.name}? This will clear all of the plugin's data.`,confirmText:"Delete",cancelText:"Cancel",confirmColor:$.RED,onConfirm:function(){try{Nn(t.id),i(!0)}catch(l){h(l.message,f("Small"))}}})}}],actions:[...r?[{icon:"settings",onPress:function(){return o.push("VendettaCustomPage",{title:t.manifest.name,render:r})}}]:[]]})}var ra=c(()=>{"use strict";He();g();de();he();b();q();ke();sr()});function lr(){return x(s),React.createElement(lt,{items:M,safeModeMessage:"Safe Mode prevents plugins from being loaded. To exit Safe Mode go to the 'Opti' tab and go back to Normal Mode.",card:cr})}var oa=c(()=>{"use strict";K();de();G();ir();ra()});async function aa(e,t){await Ce(e?t:"default"),ve.reload()}function ur(e){let{item:t,index:n}=e;x(s);let[r,o]=React.useState(!1);if(r)return null;let a=t.data.authors;return React.createElement(ft,{index:n,headerLabel:`${t.data.name} ${a?` +by ${a.map(function(i){return i.name}).join(", ")}`:""}`,headerIcon:"ic_theme_24px",descriptionLabel:t.data.description??"No description.",toggleType:s.safeMode?.enabled?void 0:"switch",toggleValue:t.selected,onToggleChange:function(i){aa(i,t.id)},overflowTitle:t.data.name,overflowActions:[{label:"View Creator Profile",icon:"ic_profile_24px",onPress:function(){be.getUser(t.data.authors[0]?.id)?Pe.showUserProfile({userId:t.data.authors[0]?.id}):Qe.fetchProfile(t.data.authors[0]?.id).then(function(){Pe.showUserProfile({userId:t.data.authors[0]?.id})})}},{icon:"ic_sync_24px",label:"Refetch",onPress:function(){qe(t.id,t.selected).then(function(){t.selected?ee({title:"Theme refetched",content:"A reload is required to see the changes. Do you want to reload now?",confirmText:"Reload",cancelText:"Cancel",confirmColor:$.RED,onConfirm:function(){return ve.reload()}}):h("Successfully refetched theme.",f("toast_image_saved"))}).catch(function(){h("Failed to refetch theme!",f("Small"))})}},{icon:"copy",label:"Copy URL",onPress:function(){V.setString(t.id),h("Copied theme URL to clipboard.",f("toast_copy_link"))}},{icon:"ic_message_delete",label:"Delete",isDestructive:!0,onPress:function(){return ee({title:"Wait!",content:`Are you sure you wish to delete ${t.data.name}?`,confirmText:"Delete",cancelText:"Cancel",confirmColor:$.RED,onConfirm:function(){un(t.id).then(function(i){o(!0),i&&aa(!1,t.id)}).catch(function(i){h(i.message,f("Small"))})}})}}]})}var ia=c(()=>{"use strict";He();g();W();K();he();b();ke();q();G();sr()});function fr(){return x(s),React.createElement(lt,{items:F,safeModeMessage:`You are in Safe Mode, meaning themes have been temporarily disabled.${s.safeMode?.currentThemeId?" If a theme appears to be causing the issue, you can press below to disable it.":""}`,safeModeExtras:s.safeMode?.currentThemeId?React.createElement(_,{text:"Disable Shader",color:$.BRAND,size:"small",onPress:function(){delete s.safeMode?.currentThemeId},style:{marginTop:8}}):void 0,card:ur})}var sa=c(()=>{"use strict";He();K();W();S();G();ir();ia()});var Ui,dm,pm,gm,hm,Vi,Ft,Ut,Ye,mt,ca,mr,Vt=c(()=>{"use strict";g();de();W();ke();Le();q();ie();b();G();Gn();jo();ta();oa();sa();Me();S();({FormRow:Ui,FormSwitchRow:dm,FormSection:pm,FormDivider:gm,FormInput:hm}=y),Vi=U.createThemedStyleSheet({container:{flex:1,backgroundColor:v.BACKGROUND_MOBILE_PRIMARY}}),Ft=function(e,t){return t?wt.snakeCase(e).toUpperCase():e},Ut=function(e,t){return Object.fromEntries(e.map(function(n){return[n.key,typeof t=="function"?t(n):typeof t=="string"?n[t]:t]}))},Ye=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;return[{key:Ft("VendettaSettings",e),title:"Opti",leading:React.createElement(Ui.Icon,{source:{uri:"https://raw.githubusercontent.com/Opti-mod/assets/main/Opti%202.png"}}),render:ar},{key:Ft("VendettaPlugins",e),title:"Plugins",icon:"ic_behavior_24px",options:{headerRight:function(){return React.createElement(Tt,{alertTitle:"Install Plugin",installFunction:async function(t){if(!t.startsWith(De))setImmediate(function(){return ee({title:"Unproxied Plugin",content:"The plugin you are trying to install has not been proxied. Want to download it anyways?",confirmText:"Install",onConfirm:function(){return xe(t).then(function(){return h("Installed plugin",f("Check"))}).catch(function(n){return h(n?.message??`${n}`,f("Small"))})},cancelText:"Cancel"})});else return await xe(t)}})}},render:lr},{key:Ft("VendettaThemes",e),title:"Shaders",icon:"ic_theme_24px",shouldRender:function(){return window.__vendetta_loader?.features.hasOwnProperty("themes")??!0},options:{headerRight:function(){return!s.safeMode?.enabled&&React.createElement(Tt,{alertTitle:"Install Theme",installFunction:Ae})}},render:fr},{key:Ft("VendettaCustomPage",e),title:"Opti Page",shouldRender:function(){return!1},render:function(t){let{render:n,noErrorBoundary:r,...o}=t,a=fe.useNavigation();return a.addListener("focus",function(){return a.setOptions(J(o,"render","noErrorBoundary"))}),r?React.createElement(n,null):React.createElement(T,null,React.createElement(n,null))}}]},mt=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;return Ye(e).filter(function(t){return t.shouldRender?.()??!0})},ca=function(){return Ut(Ye(),function(e){return{title:e.title,render:e.render,...e.options}})},mr=function(){let e=Ye(!0);return{getLayout:function(){return{title:"Opti",label:"Opti",settings:mt(!0).map(function(t){return t.key})}},titleConfig:Ut(e,"title"),relationships:Ut(e,null),rendererConfigs:Ut(e,function(t){let n=React.memo(function(r){let{navigation:o,route:a}=r;return o.addListener("focus",function(){return o.setOptions(t.options)}),React.createElement(m.View,{style:Vi.container},React.createElement(t.render,a.params))});return{type:"route",title:function(){return t.title},icon:t.icon?f(t.icon):null,screen:{route:wt.chain(t.key).camelCase().upperFirst().value(),getComponent:function(){return n}}}})}}});function pr(){let e=fe.useNavigation();x(s);let t=mt();return React.createElement(T,null,React.createElement(Gi,{key:"Vendetta",title:`Opti ${s.safeMode?.enabled?" (Safe Mode)":""}`},t.map(function(n,r){return React.createElement(React.Fragment,null,React.createElement(dr,{label:n.title,leading:React.createElement(dr.Icon,{source:f(n.icon)}),trailing:dr.Arrow,onPress:function(){return e.push(n.key)}}),r!==t.length-1&&React.createElement(Hi,null))})))}var dr,Gi,Hi,la=c(()=>{"use strict";g();K();b();Vt();S();G();({FormRow:dr,FormSection:Gi,FormDivider:Hi}=y)});function gr(){let e=new Array;return e.push(E("default",ji,function(t,n){return{...n,...ca()}})),E("default",$i,function(t,n){let r=z(n.props.children,function(o){return o.type&&o.type.name==="UserSettingsOverview"});e.push(E("renderSupportAndAcknowledgements",r.type.prototype,function(o,a){let{props:{children:i}}=a,l=i.findIndex(function(d){return d?.type?.name==="UploadLogsButton"});l!==-1&&i.splice(l,1)})),e.push(E("render",r.type.prototype,function(o,a){let{props:{children:i}}=a,l=[ue.Messages.BILLING_SETTINGS,ue.Messages.PREMIUM_SETTINGS];i=z(i,function(p){return p.children?.[1].type?.name==="FormSection"}).children;let d=i.findIndex(function(p){return l.includes(p?.props.label)});i.splice(d===-1?4:d,0,React.createElement(pr,null))}))},!0),function(){return e.forEach(function(t){return t()})}}var ji,$i,ua=c(()=>{"use strict";g();w();P();ie();Vt();la();ji=N("getScreens",!1),$i=N("UserSettingsOverviewWrapper",!1)});function Rr(){let e=new Array;return Ki(e)||zi(e),function(){return e.forEach(function(t){return t?.()})}}function zi(e){let t=u("useOverviewSettings"),n=u("getSettingTitleConfig"),r=u("SETTING_RELATIONSHIPS","SETTING_RENDERER_CONFIGS"),o="getSettingSearchListItems",a="getSettingListItems",i=u(o),l=!i,d=l?a:o,p=i??u(a);if(!p||!t)return;let k=Ye(!0),O=mt(!0),I=mr();e.push(E("useOverviewSettings",t,function(Te,Xe){return fa(Xe,I.getLayout())})),e.push(E("getSettingTitleConfig",n,function(Te,Xe){return{...Xe,...I.titleConfig}})),e.push(E(d,p,function(Te,Xe){let[va]=Te;return[...O.filter(function(ne){return va.includes(ne.key)}).map(function(ne){return{type:"setting_search_result",ancestorRendererData:I.rendererConfigs[ne.key],setting:ne.key,title:I.titleConfig[ne.key],breadcrumbs:["Vendetta"],icon:I.rendererConfigs[ne.key].icon}}),...Xe.filter(function(ne){return l||!k.map(function(Gt){return Gt.key}).includes(ne.setting)})].map(function(ne,Gt,Ia){return{...ne,index:Gt,total:Ia.length}})}));let H=r.SETTING_RELATIONSHIPS,j=r.SETTING_RENDERER_CONFIGS;return r.SETTING_RELATIONSHIPS={...H,...I.relationships},r.SETTING_RENDERER_CONFIGS={...j,...I.rendererConfigs},e.push(function(){r.SETTING_RELATIONSHIPS=H,r.SETTING_RENDERER_CONFIGS=j}),!0}function Ki(e){let t=u("SearchableSettingsList"),n=u("SETTING_RENDERER_CONFIG"),r=u("getSettingListItems");if(!r||!t||!n)return!1;let o=Ye(!0),a=mr();e.push(Zt("type",t.SearchableSettingsList,function(l){let[{sections:d}]=l;return fa(d,a.getLayout())})),e.push(E("getSettingListSearchResultItems",r,function(l,d){d.forEach(function(p){return o.some(function(k){return k.key===p.setting})&&(p.breadcrumbs=["Vendetta"])})}));let i=n.SETTING_RENDERER_CONFIG;return n.SETTING_RENDERER_CONFIG={...i,...a.rendererConfigs},e.push(function(){n.SETTING_RENDERER_CONFIG=i}),!0}function fa(e,t){if(!Array.isArray(e)||e.find(function(o){return hr(o,"Vendetta")}))return;let n=e.findIndex(function(o){return hr(o,ue.Messages.ACCOUNT_SETTINGS)});e.splice(n+1,0,t);let r=e.find(function(o){return hr(o,ue.Messages.SUPPORT)});r&&(r.settings=r.settings.filter(function(o){return o!=="UPLOAD_DEBUG_LOGS"}))}var hr,ma=c(()=>{"use strict";w();P();Vt();g();hr=function(e,t){return e?.label===t||e?.title===t}});function Er(){let e=[gr(),Rr()];return function(){return e.forEach(function(t){return t?.()})}}var da=c(()=>{"use strict";ua();ma()});function ha(e){let{locale:t}=e;try{pa&&(pa.overrideTheme(Wi?.theme??"dark"),ga&&Yi.useAMOLEDTheme===2&&ga.setAMOLEDThemeEnabled(!0))}catch(n){D.error("Failed to fix theme...",n)}try{En.locale(t.toLowerCase())}catch(n){D.error("Failed to fix timestamps...",n)}yt.unsubscribe("I18N_LOAD_SUCCESS",ha)}function Ra(){return yt.subscribe("I18N_LOAD_SUCCESS",ha)}var pa,ga,Wi,Yi,Ea=c(()=>{"use strict";g();w();Ie();pa=u("updateTheme","overrideTheme"),ga=u("setAMOLEDThemeEnabled"),Wi=Re("ThemeStore"),Yi=Re("UnsyncedUserSettingsStore")});var ya=c(()=>{"use strict"});async function wa(e){return{patcher:J(Br,"unpatchAll"),metro:{...$t,common:{...yn}},constants:Un,utils:Wt,debug:J(Tn,"versionHash","patchLogHook","toggleSafeMode"),ui:{components:Kn,toasts:_n,alerts:Xn,assets:bn,...Hn},plugins:J(Bn,"initPlugins","evalPlugin"),themes:J(dn,"initThemes"),commands:J(An,"patchCommands"),storage:an,settings:s,loader:{identity:window.__vendetta_loader,config:Q},logger:D,version:bt,unload:function(){e.filter(function(t){return typeof t=="function"}).forEach(function(t){return t()}),delete window.vendetta}}}var ba=c(()=>{"use strict";P();Ie();G();Me();Ge();de();W();Cn();K();w();g();S();q();ke();b();Le();ie()});function _a(){s.tweaks??={},console.log("TweakManager has initialized."),s.tweaks.trustURL==null&&(s.tweaks.trustURL=!1),s.tweaks.hideButtons==null&&(s.tweaks.hideButtons=!1),s.tweaks.silentTyping==null&&(s.tweaks.silentTyping=!1),s.tweaks.experiments==null&&(s.tweaks.experiments=!1),s.tweaks.fastdelete==null&&(s.tweaks.fastdelete=!1),(s.tweaks.trustURL?Nt:Pt)(),(s.tweaks.hideButtons?At:Ct)(),(s.tweaks.silentTyping?vt:It)(),(s.tweaks.experiments?Dt:Mt)(),(s.tweaks.fastdelete?Bt:Lt)()}var xa=c(()=>{"use strict";G();Qn();er();tr();nr();rr()});var Sa={};A(Sa,{default:()=>Xi});async function Xi(){let e=await Promise.all([Sn(),wn(),In(),ln(),Ra(),Go(),Er(),Jn(),void 0]);window.vendetta=await wa(e),e.push(await Pn()),e.push(await _a()),D.log("Opti is ready!")}var Ta=c(()=>{"use strict";Ge();Cn();de();W();b();Fo();Ho();da();Ea();ya();Ie();ba();xa()});he();console.log("Opti has loaded!");Object.freeze=Object;Object.seal=Object;Promise.resolve().then(()=>(Ta(),Sa)).then(function(e){return e.default()}).catch(function(e){console.log(e?.stack??e.toString()),alert([`Opti failed to initialize and plugins will not be loaded. +`,`Build Number: ${Je.Build}`,"Opti Version: 82a25f3",e?.stack||e.toString()].join(` `))});})(); //# sourceURL=Vendetta diff --git a/src/index.ts b/src/index.ts index 84c85922..501f35b2 100644 --- a/src/index.ts +++ b/src/index.ts @@ -11,7 +11,6 @@ import { initBadges } from "@/lib/badge/badges"; import logger from "@lib/logger"; import windowObject from "@lib/windowObject"; import { initTweaks } from "./lib/tweak"; -import { initCustomCommands } from "./lib/command"; export default async () => { const unloads = await Promise.all([ diff --git a/src/lib/commands.ts b/src/lib/commands.ts index fe400ac5..af080a70 100644 --- a/src/lib/commands.ts +++ b/src/lib/commands.ts @@ -9,7 +9,13 @@ export function patchCommands() { const unpatch = after("getBuiltInCommands", commandsModule, ([type], res: ApplicationCommand[]) => { if (type === ApplicationCommandType.CHAT) return res.concat(commands); }); - + + const customCommands = [ + ...testing, + ]; + + registerCommand(customCommands); + return () => { commands = []; unpatch(); diff --git a/src/ui/settings/pages/General.tsx b/src/ui/settings/pages/General.tsx index cf585e9a..999006ca 100644 --- a/src/ui/settings/pages/General.tsx +++ b/src/ui/settings/pages/General.tsx @@ -100,7 +100,7 @@ export default function General() { leading={} onPress={() => { clipboard.setString(`Opti Version - ${debugInfo.vendetta.version}`); - showToast("Copied Opti version to clipboard!", getAssetIDByName("link")); + showToast("Copied Opti version to clipboard!", getAssetIDByName("staff")); } } />