-
Notifications
You must be signed in to change notification settings - Fork 33
/
Enmity.js
12 lines (12 loc) · 66.4 KB
/
Enmity.js
1
2
3
4
5
6
7
8
9
10
11
12
var Type,socket,ApplicationCommandSectionType,ApplicationCommandType,ApplicationCommandInputType,ApplicationCommandPermissionType,ApplicationCommandOptionType,InteractionTypes,Times,modules$1={Constants:{props:["Endpoints","Fonts"]},Clipboard:{props:["setString","getString","setImage","getImage"]},Assets:{props:["registerAsset"]},Messages:{props:["receiveMessage","sendMessage"]},Clyde:{props:["createBotMessage"]},Avatars:{props:["BOT_AVATARS"]},Native:{props:["NativeModules"],export:"NativeModules"},React:{props:["createElement"]},Dispatcher:{props:["_dispatch","dispatch"]},Storage:{props:["getItem"]},Toasts:{props:["open","close"],ensure:e=>e.open&&e.close&&!e.startDrag&&!e.init&&!e.openReplay&&!e.setAlwaysOnTop&&!e.updateGuildNotificationSettings},Dialog:{props:["show","openLazy","close"]},Token:{props:["getToken"]},REST:{props:["getAPIBaseURL"]},Settings:{props:["watchKeys"]},Users:{props:["getCurrentUser"]},AsyncUsers:{props:["getUser","fetchProfile"]},Navigation:{props:["pushLazy"]},NavigationNative:{props:["NavigationContainer"]},NavigationStack:{props:["createStackNavigator"]},Theme:{props:["theme"]},Linking:{props:["openURL"]},StyleSheet:{props:[["createStyles"],["createThemedStyleSheet"]],ensure:e=>!e.ActionSheet},ColorMap:{props:[["colors"],["ThemeColorMap"]],ensure:e=>e?.meta||e?.internal},Components:{multiple:!0,props:{Forms:["Form","FormSection"],General:["Button","Text","View"]}},Locale:{props:["Messages"]},Profiles:{props:["showUserProfile"]},Lodash:{props:["debounce","throttle"]},Logger:{name:"Logger"},Flux:{props:[["Store","connectStores"],["useStateFromStoresObject"]]},SVG:{props:["Svg"]},Scenes:{name:"getScreens",default:!1},Moment:{props:["isMoment"]},ReactNative:{props:["View","Text"]}};function _type_of(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var common={},blacklist=[],filters={byProps:(...e)=>{if(e.length>1)return t=>{for(var n=0,r=e.length;n<r;n++)if(void 0===t[e[n]])return!1;return!0};var t=e[0];return e=>void 0!==e[t]},byName:(e,t=!0)=>n=>!!n&&(t?"function"==typeof n&&n.name===e:"function"==typeof n.default&&n.default.name===e),byTypeName:(e,t=!0)=>n=>!!n&&(t?"function"==typeof n.type&&n.type.name===e:"function"==typeof n.default?.type&&n.default.type.name===e),byDisplayName:(e,t=!0)=>n=>!!n&&(t?"function"==typeof n&&n.displayName===e:"function"==typeof n.default&&n.default.displayName===e)};(()=>{try{var e=getByProps("SemanticColor","RawColor");if(!e)return;var t=window.themes?.theme??"",n=window.themes?.list??[],r=n?.find(e=>e.name===t);if(!r)return;if(r.colours??=r.colors,(1===r.spec||!r.spec)&&(r.theme_color_map&&(r.semanticColors=r.theme_color_map),r.colours)){var a={PRIMARY_DARK:"PRIMARY",PRIMARY_LIGHT:"PRIMARY",BRAND_NEW:"BRAND",STATUS_:""};r.rawColors=r.colours,Object.entries(r.colours).forEach(([e,t])=>{Object.entries(a).forEach(([n,a])=>{e.startsWith(n)&&(r.rawColors[e.replace(n,a)]=t)})})}if(r.rawColors&&(r.rawColors?.PRIMARY_660||(r.rawColors.PRIMARY_660=r?.semanticColors?.BACKGROUND_PRIMARY[0]),Object.entries(r.rawColors).forEach(([t,n])=>{e.RawColor[t]=n.replace("transparent","rgba(0,0,0,0)"),e.default.unsafe_rawColors[t]=n.replace("transparent","rgba(0,0,0,0)")})),r.semanticColors){var o={BACKGROUND_FLOATING:["BG_BACKDROP","BG_SURFACE_OVERLAY","BG_SURFACE_OVERLAY_TMP"],BACKGROUND_PRIMARY:["BG_BASE_PRIMARY","CHAT_BACKGROUND"],BACKGROUND_SECONDARY:["BG_BASE_SECONDARY"],BACKGROUND_SECONDARY_ALT:["BG_BASE_TERTIARY"],BACKGROUND_MODIFIER_ACCENT:["BG_MOD_FAINT","BG_MOD_STRONG","BG_MOD_SUBTLE"],BACKGROUND_MOBILE_PRIMARY:["BG_SURFACE_RAISED"]};Object.entries(r.semanticColors).forEach(([e,t])=>{Object.entries(o).forEach(([n,a])=>{e===n&&a.forEach(e=>r.semanticColors[e]??=t)})});var i=(e.default.meta??e.default.internal).resolveSemanticColor;(e.default.meta??e.default.internal).resolveSemanticColor=(e,t)=>{var n=t[Object.getOwnPropertySymbols(t)[0]];if(r.semanticColors[n]){var a={dark:0,light:1,amoled:2}[e.toLowerCase()]||0,o=r.semanticColors[n][a];if(o)return o}return i(e,t)}}}catch(e){console.error(Error(`[Enmity] ${e}`).stack)}})();var getters=[];Object.entries(modules$1).map(([e,t])=>{if(t.multiple)Object.entries(t.props).map(([t,n])=>{getters.push({id:t,filter:e=>filters.byProps(...n)(e),submodule:e})});else if(t.props){if(t.props.every(e=>Array.isArray(e))){var n=[];getters.push({id:e,filter:e=>{var r=t.props.some(t=>t.every(t=>e?.[t]));return(!r||!t.ensure||!!t.ensure(e))&&(r&&n.push(e),r)},map:Object.assign({},...n)})}else getters.push({id:e,filter:e=>{var n=filters.byProps(...t.props)(e);return(!n||!t.ensure||!1!==t.ensure(e))&&n},map:t.export})}else t.displayName?getters.push({id:e,filter:filters.byDisplayName(t.displayName,t.default),map:t.export}):t.name?getters.push({id:e,filter:filters.byName(t.name,t.default),map:t.export}):t.filter&&getters.push({id:e,filter:t.filter,map:t.export})});var results=bulk(...getters.map(({filter:e})=>e));function getModule(e,{all:t=!1,traverse:n=!1,defaultExport:r=!0}={}){var a=function(e){if(blacklist.includes(e))return"continue";var a=common.Moment?.locale();if(!modules[e].isInitialized)try{var s=Function.prototype.toString;__r(e),Object.defineProperty(Function.prototype,"toString",{value:s,configurable:!0,writable:!0})}catch(t){return blacklist.push(e),"continue"}var l=common.Moment?.locale(),c=common.Locale?.getLocale();if(common.Moment&&common.Locale&&l!==c&&(common.Moment.locale(c),a&&l&&a!==l))return blacklist.push(e),"continue";var u=modules[e].publicModule.exports;if(!u||u===window||null===u.ihateproxies)return blacklist.push(e),"continue";if(!u.__patched__&&u.default?.name==="requireNativeComponent"){var m=u.default,p={requireNativeComponent(...e){try{return m(...e)}catch{return e[0]}}};Object.assign(p.requireNativeComponent,m),Object.assign(u,{default:p.requireNativeComponent,__patched__:!0})}if("object"==typeof u){if(i(u,e)){if(!t)return{v:u};o.push(u)}if(u.default&&i(u.default,e)){var d=r?u.default:u;if(!t)return{v:d};o.push(d)}if(n&&u.__esModule){for(var g in u)if(void 0!==u[g]&&i(u[g],e)){if(!t)return{v:u[g]};o.push(u[g])}}}else if("function"==typeof u){if(!i(u,e))return"continue";if(!t)return{v:u};o.push(u)}};if("function"!=typeof e)return null;var o=[],i=function(t,n){try{return e(t,n)}catch{return!1}};for(var s in modules){var l=a(s);if("object"===_type_of(l))return l.v}return t?o:o[0]}function getModules(e){return getModule(e,{all:!0})}function bulk(...e){var t=Array(e.length),n=e.map(e=>t=>{try{return e(t)}catch{return!1}});return getModule(r=>{for(var a=0;a<n.length;a++){var o=n[a];"function"==typeof o&&o(r)&&null==t[a]&&(t[a]=r)}return t.filter(String).length===e.length}),t}function getByProps(...e){var[t,{bulk:n=!1,...r}]=parseOptions(e);return n?bulk(...t.map(e=>Array.isArray(e)?filters.byProps(...e):filters.byProps(e)).concat({...r})):getModule(filters.byProps(...t),r)}function getByDisplayName(...e){var[t,{bulk:n=!1,default:r=!0,...a}]=parseOptions(e);return n?bulk(...t.map(filters.byDisplayName).concat({defaultExport:r,...a})):getModule(filters.byDisplayName(t[0]),{defaultExport:r,...a})}function getByTypeName(...e){var[t,{bulk:n=!1,default:r=!0,...a}]=parseOptions(e);return n?bulk(...t.map(filters.byTypeName).concat({defaultExport:r,...a})):getModule(filters.byTypeName(t[0]),{defaultExport:r,...a})}function getByName$1(...e){var[t,{bulk:n=!1,default:r=!0,...a}]=parseOptions(e);return n?bulk(...t.map(filters.byName).concat({defaultExport:r,...a})):getModule(filters.byName(t[0]),{defaultExport:r,...a})}function getByKeyword(...e){var[[t],{caseSensitive:n=!1,all:r=!1,...a}]=parseOptions(e);return getModule(e=>{for(var r=[...Object.keys(e),...Object.keys(e.__proto__)],a=0;a<r.length;a++){var o=r[a];if(n){if(~o.indexOf(t))return!0}else{var i=t.toLowerCase();if(~o.toLowerCase().indexOf(i))return!0}}return!1},{all:r,...a})}function parseOptions(e,t=e=>"object"==typeof e&&!Array.isArray(e)){return[e,t(e[e.length-1])?e.pop():{}]}getters.map(({id:e,map:t,submodule:n},r)=>{var a=e=>e;if("string"==typeof t)a=e=>e[t];else if(Array.isArray(t)){var o={};a=e=>{for(var n of t)o[n]=e[n];return o}}if(results[r]){var i=a(results[r]);n?(common[n]??={},common[n][e]=i):common[e]=i}});var Modules=Object.freeze({__proto__:null,blacklist:blacklist,bulk:bulk,common:common,filters:filters,getByDisplayName:getByDisplayName,getByKeyword:getByKeyword,getByName:getByName$1,getByProps:getByProps,getByTypeName:getByTypeName,getModule:getModule,getModules:getModules}),{Clipboard,Assets:Assets$1,Messages,Clyde:Clyde$1,Avatars,Native:Native$1,Dispatcher,Storage,AsyncUsers,Toasts,Dialog,Token,REST,Settings:Settings$1,Users,Theme,Linking,StyleSheet:StyleSheet$1,Components:Components$1,Locale,Constants:Constants$1,Profiles,ColorMap,Logger:Logger$1,Lodash,Flux,SVG,Scenes,Navigation,NavigationNative,NavigationStack,Moment,ReactNative}=common;StyleSheet$1.createThemedStyleSheet||(StyleSheet$1.createThemedStyleSheet=function(e){for(var t in e)e[t]=new Proxy(ReactNative.StyleSheet.flatten(e[t]),{get(e,t,n){var r=Reflect.get(e,t,n);return(ColorMap.meta??ColorMap.internal).isSemanticColor(r)?(ColorMap.meta??ColorMap.internal).resolveSemanticColor(Theme.theme,r):r}});return e}),ColorMap?.colors&&(ColorMap.ThemeColorMap=StyleSheet$1.ThemeColorMap=Constants$1.ThemeColorMap=ColorMap.colors),ColorMap?.unsafe_rawColors&&(Constants$1.Colors=ColorMap.unsafe_rawColors),ColorMap?.internal&&(ColorMap.meta=ColorMap.internal);var React=common.React;!function(e){e.Before="before",e.Instead="instead",e.After="after"}(Type||(Type={}));var patches=[];function getPatchesByCaller(e){if(!e)return[];var t=[];for(var n of patches)for(var r of[...n.patches.before,...n.patches.instead,...n.patches.after])r.caller===e&&t.push(r);return t}function unpatchAll(e){var t=getPatchesByCaller(e);if(t.length)for(var n of t)n.unpatch()}function override(e){return function(){if(!e?.patches?.before.length&&!e?.patches?.after.length&&!e?.patches?.instead.length&&!patches.find(t=>t.mdl===e.mdl&&t.func===e.func))return e.unpatch(),new.target?new e.original(...arguments):e.original.apply(this,arguments);for(var t,n=arguments,r=[...e.patches.before],a=0;a<r.length;a++){var o=r[a];if(o)try{var i=o.callback(this,n,e.original.bind(this));Array.isArray(i)&&(n=i),o.once&&o.unpatch()}catch(t){console.error(`Could not fire before patch for ${e.func} of ${o.caller}`,t)}}var s=[...e.patches.instead];if(s.length)for(var l=0;l<s.length;l++){var c=s[l];if(c)try{var u=c.callback(this,n,e.original.bind(this));void 0!==u&&(t=u),c.once&&c.unpatch()}catch(t){console.error(`Could not fire instead patch for ${e.func} of ${c.caller}`,t)}}else t=new.target?new e.original(...n):e.original.apply(this,n);for(var m=[...e.patches.after],p=0;p<m.length;p++){var d=m[p];if(d)try{var g=d.callback(this,n,t,e=>t=e);void 0!==g&&(t=g),d.once&&d.unpatch()}catch(t){console.error(`Could not fire after patch for ${e.func} of ${d.caller}`,t)}}return t}}function push(e,t){var n={mdl:e,func:t,original:e[t],unpatch:()=>{n.mdl[n.func]=n.original,n.patches={before:[],after:[],instead:[]}},patches:{before:[],after:[],instead:[]}},r=override(n);e[t]=r;var a=Object.getOwnPropertyDescriptors(n.original);return delete a.length,Object.defineProperties(e[t],{...a,toString:{value:()=>n.original.toString(),configurable:!0,enumerable:!1},__original:{value:n.original,configurable:!0,enumerable:!1}}),patches.push(n),n}function get$2(e,t){return patches.find(n=>n.mdl===e&&n.func===t)||push(e,t)}function patch(e,t,n,r,a="after",o=!1){if(e&&"string"==typeof e){if(t&&["function","object"].includes(typeof t)){if(n&&"string"==typeof n){if(r&&"function"==typeof r){if(a&&"string"==typeof a&&["after","before","instead"].includes(a)){if(void 0===t[n])throw ReferenceError(`function ${n} does not exist on the second argument (object or function)`)}else throw TypeError('fifth argument "type" must be of type string and any of the three: after, before, instead')}else throw TypeError('fourth argument "callback" must be of type function')}else throw TypeError('third argument "func" must be of type string')}else throw TypeError('second argument "mdl" must be of type function or object')}else throw TypeError('first argument "caller" must be of type string');var i=get$2(t,n),s={caller:e,once:o,type:a,id:i.patches?.[a]?.length??0,callback:r,unpatch:()=>{var e=i.patches?.[a].findIndex(e=>e.id===s.id);if(~e&&i.patches?.[a].splice(e,1),!(i.patches?.before.length||i.patches?.after.length||i.patches?.instead.length)){var r=patches.findIndex(e=>e.mdl==t&&e.func==n);r&&(patches[r]?.unpatch(),patches.splice(r,1))}}};return i.patches[a]??=[],i.patches[a].push(s),s.unpatch}function before(e,t,n,r,a=!1){return patch(e,t,n,r,"before",a)}function instead(e,t,n,r,a=!1){return patch(e,t,n,r,"instead",a)}function after(e,t,n,r,a=!1){return patch(e,t,n,r,"after",a)}function create(e){return{getPatchesByCaller,before:(t,n,r,a=!1)=>before(e,t,n,r,a),instead:(t,n,r,a=!1)=>instead(e,t,n,r,a),after:(t,n,r,a=!1)=>after(e,t,n,r,a),unpatchAll:()=>unpatchAll(e)}}var Patcher$6=Object.freeze({__proto__:null,get Type(){return Type},after:after,before:before,create:create,instead:instead,patches:patches,unpatchAll:unpatchAll}),assets={};try{after("enmity-assets",Assets$1,"registerAsset",(e,[t],n)=>{assets[t.name]=Object.assign(t,{id:n})});for(var id=1;;id++){var asset=Assets$1.getAssetByID(id);if(!asset)break;assets[asset.name]||(assets[asset.name]=Object.assign(asset,{id}))}}catch{}function find(e){return Object.values(assets).find(e)}function getByName(e){return assets[e]}function getByID(e){return Assets$1.getAssetByID(e)}function getIDByName(e){return assets[e]?.id}var Icons$1=new Proxy({},{get:(e,t)=>getIDByName(t)}),Assets=Object.freeze({__proto__:null,Icons:Icons$1,assets:assets,find:find,getByID:getByID,getByName:getByName,getIDByName:getIDByName}),settings$1=Settings$1.get("enmity")??{};function getSetting(e,t,n){return settings$1[e]?.[t]??n}function get$1(e){return settings$1[e]??{}}var Events$2={ENMITY_GET_SETTING:({file:e,setting:t,defaults:n})=>settings$1[e][t]??n,ENMITY_SET_SETTING:({file:e,setting:t,value:n})=>{settings$1[e]||(settings$1[e]={}),void 0==n?delete settings$1[e][t]:settings$1[e][t]=n},ENMITY_TOGGLE_SETTING:({file:e,setting:t,defaults:n})=>{settings$1[e]||(settings$1[e]={}),void 0===settings$1[e][t]?settings$1[e][t]=!n:settings$1[e][t]=!settings$1[e][t]}},store=new Flux.Store(Dispatcher,Events$2);store.addChangeListener(Lodash.debounce(()=>Settings$1.set({enmity:settings$1}),200));var listeners={};function ENMITY_SET_SETTING(e){return handleSettingsUpdate({...e,type:"set"})}function ENMITY_TOGGLE_SETTING(e){return handleSettingsUpdate({...e,type:"toggle"})}function handleSettingsUpdate({file:e,type:t,...n}){var r=listeners[e];if(r)for(var a of r.values())a({...n})}function set(e,t,n){if(e&&"string"==typeof e){if(!t||"string"!=typeof t)throw TypeError("the second argument setting must be of type string")}else throw TypeError("the first argument file must be of type string");return Dispatcher.wait(()=>Dispatcher.dispatch({type:"ENMITY_SET_SETTING",file:e,setting:t,value:n}))}function get(e,t,n){if(e&&"string"==typeof e){if(!t||"string"!=typeof t)throw TypeError("the second argument setting must be of type string")}else throw TypeError("the first argument file must be of type string");return getSetting(e,t,n)}function getBoolean(e,t,n){if(e&&"string"==typeof e){if(t&&"string"==typeof t){if(void 0===n||"boolean"!=typeof n)throw TypeError("the third argument defaults must be of type boolean")}else throw TypeError("the second argument setting must be of type string")}else throw TypeError("the first argument file must be of type string");return!!getSetting(e,t,n)}function toggle(e,t,n){if(e&&"string"==typeof e){if(t&&"string"==typeof t){if(void 0===n||"boolean"!=typeof n)throw TypeError("the third argument defaults must be of type boolean")}else throw TypeError("the second argument setting must be of type string")}else throw TypeError("the first argument file must be of type string");return Dispatcher.wait(()=>Dispatcher.dispatch({type:"ENMITY_TOGGLE_SETTING",file:e,setting:t,defaults:n}))}function connectComponent(e,t){if(e&&["function","object"].includes(typeof e)){if(!t||"string"!=typeof t)throw TypeError("the second argument file must be of type string")}else throw TypeError("the first argument component must be of type function or object");var n=n=>{var r=React.useState({})[1];return React.useEffect(()=>{function e(){r({})}return subscribe(t,e),()=>unsubscribe(t,e)},[]),React.createElement(e,{...n,settings:makeStore(t)})};return e.displayName&&(n.displayName=e.displayName),e.name&&(n.name=`Connected${e.name}`),n}function makeStore(e){if(!e||"string"!=typeof e)throw TypeError("the first argument file must be of type string");return{settings:get$1(e),set:(t,n)=>set(e,t,n),get:(t,n)=>get(e,t,n),toggle:(t,n)=>toggle(e,t,n),getBoolean:(t,n)=>getBoolean(e,t,n)}}function subscribe(e,t){if(e&&"string"==typeof e){if(!t||"function"!=typeof t)throw TypeError("the second argument callback must be of type function")}else throw TypeError("the first argument file must be of type string");listeners[e]??=new Set,listeners[e].add(t)}function unsubscribe(e,t){if(e&&"string"==typeof e){if(!t||"function"!=typeof t)throw TypeError("the second argument callback must be of type function")}else throw TypeError("the first argument file must be of type string");listeners[e]?.delete(t),listeners[e]?.size===0&&delete listeners[e]}function connectStores(e,t){if(e&&["function","object"].includes(typeof e)){if(!t||"string"!=typeof t)throw TypeError("the second argument file must be of type string")}else throw TypeError("the first argument component must be of type function or object");return Flux.connectStores([store],()=>({settings:makeStore(t)}))(e)}Dispatcher.subscribe("ENMITY_SET_SETTING",ENMITY_SET_SETTING),Dispatcher.subscribe("ENMITY_TOGGLE_SETTING",ENMITY_TOGGLE_SETTING);var Settings=Object.freeze({__proto__:null,connectComponent:connectComponent,connectStores:connectStores,get:get,getBoolean:getBoolean,listeners:listeners,makeStore:makeStore,set:set,settings:settings$1,store:store,subscribe:subscribe,toggle:toggle,unsubscribe:unsubscribe}),Logger=getByName$1("Logger"),EnmityLogger=new Logger("Enmity");function connectWebsocket(host){console.log("Connecting to debug WebSocket"),void 0!==socket&&socket.readyState!==WebSocket.CLOSED&&(socket.close(),socket=null);var address=!!get("enmity","autoConnectWS",!1)&&get("enmity","debugWSAddress");(address||host)&&(socket=new WebSocket(`ws://${host??address}`),socket.addEventListener("open",()=>{console.log("Connected with debug websocket"),Toasts.open({content:"Connected to the WebSocket server.",source:getIDByName("Check")})}),socket.addEventListener("error",e=>{console.log(`Error with debug websocket: ${e.message}`),Toasts.open({content:"An error occured with the websocket connection.",source:getIDByName("toast_copy_link")})}),socket.addEventListener("close",e=>{console.log(`Error with debug websocket: ${e.message}`),Toasts.open({content:"The websocket connection has been closed.",source:getIDByName("toast_copy_link")})}),socket.addEventListener("message",message=>{try{console.log(eval(message.data))}catch(e){console.error(e)}}))}function initialize$5(){var e=nativeLoggingHook;globalThis.nativeLoggingHook=function(t,n){return socket?.readyState===WebSocket.OPEN&&socket.send(JSON.stringify({level:n,message:t})),EnmityLogger.log(t),e.apply(this,arguments)},get("enmity","autoConnectWS",!1)&&connectWebsocket()}function sendMessage(e){socket?.readyState===WebSocket.OPEN&&socket.send(e)}var{Alert,Button,FlatList,Image,ImageBackground,KeyboardAvoidingView,Modal,Pressable,RefreshControl,ScrollView,SectionList,StatusBar,StyleSheet,Switch,Text,TextInput,TouchableHighlight,TouchableOpacity,TouchableWithoutFeedback,Touchable,View,VirtualizedList}=Components$1.General,{Form,FormArrow,FormCTA,FormCTAButton,FormCardSection,FormCheckbox,FormDivider,FormHint,FormIcon,FormInput,FormLabel,FormRadio,FormRow,FormSection,FormSelect,FormSubLabel,FormSwitch,FormTernaryCheckBox,FormText,FormTextColors,FormTextSizes}=Components$1.Forms,Components=Object.freeze({__proto__:null,Alert:Alert,Button:Button,FlatList:FlatList,Form:Form,FormArrow:FormArrow,FormCTA:FormCTA,FormCTAButton:FormCTAButton,FormCardSection:FormCardSection,FormCheckbox:FormCheckbox,FormDivider:FormDivider,FormHint:FormHint,FormIcon:FormIcon,FormInput:FormInput,FormLabel:FormLabel,FormRadio:FormRadio,FormRow:FormRow,FormSection:FormSection,FormSelect:FormSelect,FormSubLabel:FormSubLabel,FormSwitch:FormSwitch,FormTernaryCheckBox:FormTernaryCheckBox,FormText:FormText,FormTextColors:FormTextColors,FormTextSizes:FormTextSizes,Image:Image,ImageBackground:ImageBackground,KeyboardAvoidingView:KeyboardAvoidingView,Modal:Modal,Pressable:Pressable,RefreshControl:RefreshControl,ScrollView:ScrollView,SectionList:SectionList,StatusBar:StatusBar,StyleSheet:StyleSheet,Switch:Switch,Text:Text,TextInput:TextInput,Touchable:Touchable,TouchableHighlight:TouchableHighlight,TouchableOpacity:TouchableOpacity,TouchableWithoutFeedback:TouchableWithoutFeedback,View:View,VirtualizedList:VirtualizedList});function memoize(e){var t;return(...n)=>t??=e.apply(null,n)}function debounce(e,t){var n;return function(...r){clearTimeout(n),n=setTimeout(()=>e.apply(this,r),t)}}function uuid(e=10){var t="";do{var n=16*Math.random()|0;t+=(12==t.length?4:16==t.length?3&n|8:n).toString(16)}while(t.length<e);return t}function createStore(e){var t={...e??{}},n=uuid().toUpperCase(),r={get:(e,n)=>t[e]??n,set:(e,t)=>Dispatcher.wait(()=>Dispatcher.dispatch({type:`ENMITY_FLUX_${n}_SET`,key:e,value:t})),delete:e=>r.set(e,void 0)},a=new Flux.Store(Dispatcher,{[`ENMITY_FLUX_${n}_SET`]:({key:e,value:n})=>{void 0===n?delete t[e]:t[e]=n}});return{...r,store:a,storage:t,id:n}}function findInTree(e={},t=e=>e,{ignore:n=[],walkable:r=[],maxProperties:a=100}={}){for(var o=[e],i=function(...e){try{return Reflect.apply(t,this,e)}catch{return!1}};o.length&&a;){var s=o.shift();if(i(s))return s;if(Array.isArray(s))o.push(...s);else if("object"==typeof s&&null!==s){if(r.length)for(var l in s){var c=s[l];~r.indexOf(l)&&!~n.indexOf(l)&&o.push(c)}else for(var u in s){var m=s[u];s&&~n.indexOf(u)||o.push(m)}}a--}}function findInReactTree(e,t=e=>e,n={}){return findInTree(e,t,{walkable:["props","children"],...n})}var{PixelRatio}=Components$1.General;function normalizeSize(e){return PixelRatio.getPixelSizeForLayoutSize(e)}var overrides={useMemo:e=>e(),useState:e=>[e,()=>void 0],useReducer:e=>[e,()=>void 0],useEffect:()=>{},useLayoutEffect:()=>{},useRef:()=>({current:null}),useCallback:e=>e,useImperativeHandle:()=>{},useContext:e=>e._currentValue},keys=Object.keys(overrides),wrapInHooks=e=>(...t)=>{var n=React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentDispatcher.current,r=keys.map(e=>[e,n[e]]);Object.assign(n,overrides);var a={rendered:null,error:null};try{a.rendered=e(...t)}catch(e){a.error=e}if(Object.assign(n,Object.fromEntries(r)),a.error)throw a.error;return a.rendered};function asyncGeneratorStep$4(e,t,n,r,a,o,i){try{var s=e[o](i),l=s.value}catch(e){n(e);return}s.done?t(l):Promise.resolve(l).then(r,a)}function _async_to_generator$4(e){return function(){var t=this,n=arguments;return new Promise(function(r,a){var o=e.apply(t,n);function i(e){asyncGeneratorStep$4(o,r,a,i,s,"next",e)}function s(e){asyncGeneratorStep$4(o,r,a,i,s,"throw",e)}i(void 0)})}}var{NativeModules,Platform}=getByProps("Text","View"),FileManager=NativeModules.DCDFileManager??NativeModules.RTNFileManager;function writeFile(e,t){return _writeFile.apply(this,arguments)}function _writeFile(){return(_writeFile=_async_to_generator$4(function*(e,t){if(FileManager){var n=Platform.select({default:e=>e,ios:e=>FileManager.saveFileToGallery?e:`Documents/${e}`});yield FileManager.writeFile("documents",n(e),t,"utf8")}})).apply(this,arguments)}function sleep(e){return new Promise(t=>setTimeout(t,e))}var Utilities=Object.freeze({__proto__:null,createStore:createStore,debounce:debounce,findInReactTree:findInReactTree,findInTree:findInTree,memoize:memoize,normalizeSize:normalizeSize,sleep:sleep,uuid:uuid,wrapInHooks:wrapInHooks,writeFile:writeFile});!function(e){e[e.BuiltIn=0]="BuiltIn",e[e.Guild=1]="Guild",e[e.DM=2]="DM"}(ApplicationCommandSectionType||(ApplicationCommandSectionType={})),function(e){e[e.Chat=1]="Chat",e[e.User=2]="User",e[e.Message=3]="Message"}(ApplicationCommandType||(ApplicationCommandType={})),function(e){e[e.BuiltIn=0]="BuiltIn",e[e.BuiltInText=1]="BuiltInText",e[e.BuiltInIntegration=2]="BuiltInIntegration",e[e.Bot=3]="Bot",e[e.Placeholder=4]="Placeholder"}(ApplicationCommandInputType||(ApplicationCommandInputType={})),function(e){e[e.Role=1]="Role",e[e.User=2]="User"}(ApplicationCommandPermissionType||(ApplicationCommandPermissionType={})),function(e){e[e.SubCommand=1]="SubCommand",e[e.SubCommandGroup=2]="SubCommandGroup",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.Mentionnable=9]="Mentionnable",e[e.Number=10]="Number",e[e.Attachment=11]="Attachment"}(ApplicationCommandOptionType||(ApplicationCommandOptionType={})),function(e){e[e.ApplicationCommand=2]="ApplicationCommand",e[e.MessageComponent=3]="MessageComponent"}(InteractionTypes||(InteractionTypes={}));var Patcher$5=create("enmity-commands"),Commands=getByProps("getBuiltInCommands"),sectionId="enmity",commands=[];try{initialize$4()}catch(e){console.error("Failed to patch commands: ",e.message)}function registerCommands(e,t){if(e&&"string"==typeof e){if(!t||!Array.isArray(t))throw TypeError("second argument cmds must be of type array")}else throw TypeError("first argument caller must be of type string");for(var n in t){var r=Commands.getBuiltInCommands([ApplicationCommandType.Chat],!0,!1);r.length||(r=Commands.getBuiltInCommands(ApplicationCommandType.Chat,!0,!1)),r.sort((e,t)=>parseInt(t.id)-parseInt(e.id));var a=r[r.length-1],o=t[n];t[n]={displayName:o.name,untranslatedName:o.name,displayDescription:o.description,untranslatedDescription:o.description,type:ApplicationCommandType.Chat,inputType:ApplicationCommandInputType.BuiltIn,id:`${parseInt(a.id,10)-1}`,applicationId:sectionId,...o,__enmity:!0,caller:e}}commands.push(...t)}function unregisterCommands(e){if(!e||"string"!=typeof e)throw TypeError("first argument caller must be of type string");commands=commands.filter(t=>t.caller!==e)}function initialize$4(){Patcher$5.after(Commands,"getBuiltInCommands",(e,[t],n)=>{if(t===ApplicationCommandType.Chat||Array.isArray(t)&&t.includes(ApplicationCommandType.Chat))return[...n,...commands]})}var Commands$1=Object.freeze({__proto__:null,registerCommands:registerCommands,unregisterCommands:unregisterCommands}),replies={};function sendCommand(e,t=[],n){var r=uuid();Linking.openURL(`com.hammerandchisel.discord://enmity?id=${r}&command=${e}¶ms=${t.join(",")}`).then(()=>{n&&(replies[r]=n)})}function asyncGeneratorStep$3(e,t,n,r,a,o,i){try{var s=e[o](i),l=s.value}catch(e){n(e);return}s.done?t(l):Promise.resolve(l).then(r,a)}function _async_to_generator$3(e){return function(){var t=this,n=arguments;return new Promise(function(r,a){var o=e.apply(t,n);function i(e){asyncGeneratorStep$3(o,r,a,i,s,"next",e)}function s(e){asyncGeneratorStep$3(o,r,a,i,s,"throw",e)}i(void 0)})}}Linking.addEventListener("url",e=>{var t=e.url;t=decodeURIComponent(t.replace("com.hammerandchisel.discord://",""));try{var n=JSON.parse(t);if(void 0===n.data)return;replies[n.id]&&(replies[n.id](n.data),delete replies[n.id])}catch(e){return}});var{EventEmitter:EventEmitter$1}=getByProps("EventEmitter"),plugins$1=[],enabled=window.plugins?.enabled??[],disabled=window.plugins?.disabled??[],Events$1=new EventEmitter$1;function registerPlugin(e){e&&"object"==typeof e&&(e.onEnable=()=>{try{e.onStart(),e.commands&®isterCommands(e.name,e.commands),console.log(`${e.name} has been enabled`)}catch(t){console.log(`${e.name} failed to load`,t.message)}},e.onDisable=()=>{try{if(e.patches)for(var t of e.patches)t.unpatchAll();e.commands&&unregisterCommands(e.name),e.onStop(),console.log(`${e.name} has been disabled`)}catch(t){console.log(`${e.name} failed to disable`,t.message)}},enabled.includes(e.name)&&e.onEnable(),disabled.includes(e.name)&&e.onDisable(),getPlugin(e.name)||plugins$1.push(e))}var on$1=Events$1.on.bind(Events$1),once$1=Events$1.once.bind(Events$1),off$1=Events$1.off.bind(Events$1);function getPlugin(e){return plugins$1.find(t=>t.name===e)}function getPlugins(){return plugins$1.sort((e,t)=>e.name.localeCompare(t.name))}function getEnabledPlugins(){return enabled.sort()}function getDisabledPlugins(){return disabled.sort()}function disablePlugin$1(e,t=!1,n){if(enabled.includes(e)){var r=enabled.indexOf(e);~r&&enabled.splice(r,1)}if(t&&disabled.includes(e)){var a=disabled.indexOf(e);~a&&disabled.splice(a,1)}return t||disabled.push(e),getPlugin(e).onDisable(),new Promise(t=>{sendCommand("disable-plugin",[e],(...e)=>{n&&n(...e),t(...e)})})}function enablePlugin(e,t){if(disabled.includes(e)){var n=disabled.indexOf(e);~n&&disabled.splice(n,1)}return enabled.push(e),getPlugin(e).onEnable(),new Promise(n=>{sendCommand("enable-plugin",[e],(...e)=>{t&&t(...e),n(...e)})})}function evalPlugin(e){return _evalPlugin.apply(this,arguments)}function _evalPlugin(){return(_evalPlugin=_async_to_generator$3(function*(url,enable=!1,update){try{var response=yield REST.get(url),code=response.text,name=url.split("/").pop().split(".")[0],id=Number(Object.keys(window.modules).pop())+1,wrapper=`__d(function(...args) {
try {
${code}
} catch(err) {
console.log(err);
}
}, ${id}, []);
__r(${id})`;try{eval(wrapper),enable&&!enabled.includes(name)&&(yield enablePlugin(name))}catch(e){console.log("Failed to eval plugin instance",e.message)}return update&&update(),name}catch(e){console.log("Failed to eval plugin instance",e.message)}})).apply(this,arguments)}function installPlugin(e,t,n){var r=e.split("/").pop().split(".")[0];return new Promise(a=>{sendCommand("install-plugin",[e],o=>{function i(){evalPlugin(e,!0).then(r=>{var i={name:r,data:o,url:e};Events$1.emit("installed"),t&&t(i),n(),a(i)})}return"overridden_plugin"===o?disablePlugin$1(r,!0).then(i):i()})})}function uninstallPlugin(e,t){return new Promise(n=>{sendCommand("uninstall-plugin",[e],r=>{if("uninstalled_plugin"===r){disablePlugin$1(e),enabled=enabled.filter(t=>t!==e),disabled=disabled.filter(t=>t!==e);var a=plugins$1.findIndex(t=>t.name===e);a>-1&&plugins$1.splice(a,1),Events$1.emit("uninstalled"),t&&t(r)}n(r)})})}var Plugins=Object.freeze({__proto__:null,disablePlugin:disablePlugin$1,enablePlugin:enablePlugin,evalPlugin:evalPlugin,getDisabledPlugins:getDisabledPlugins,getEnabledPlugins:getEnabledPlugins,getPlugin:getPlugin,getPlugins:getPlugins,installPlugin:installPlugin,off:off$1,on:on$1,once:once$1,registerPlugin:registerPlugin,uninstallPlugin:uninstallPlugin});function asyncGeneratorStep$2(e,t,n,r,a,o,i){try{var s=e[o](i),l=s.value}catch(e){n(e);return}s.done?t(l):Promise.resolve(l).then(r,a)}function _async_to_generator$2(e){return function(){var t=this,n=arguments;return new Promise(function(r,a){var o=e.apply(t,n);function i(e){asyncGeneratorStep$2(o,r,a,i,s,"next",e)}function s(e){asyncGeneratorStep$2(o,r,a,i,s,"throw",e)}i(void 0)})}}var{EventEmitter}=getByProps("EventEmitter"),Events=new EventEmitter,theme$1=window.themes?.theme??"",themes$1=window.themes?.list??[],on=Events.on.bind(Events),once=Events.once.bind(Events),off=Events.off.bind(Events);function getTheme(){return theme$1}function getThemeByName(e){return themes$1.find(t=>t.name===e)}function listThemes(){return themes$1.sort()}function installTheme(e,t){return _installTheme.apply(this,arguments)}function _installTheme(){return(_installTheme=_async_to_generator$2(function*(e,t){var n=({theme:t,callback:n,data:r,resolve:a})=>{var o=themes$1.findIndex(e=>e.name===t.name);o>-1&&themes$1.splice(o,1),themes$1.push(t);var i={theme:t,name:t.name,url:e,data:r,restart:getTheme()===t.name};n&&n(i),Events.emit("installed"),a(i)};return new Promise(r=>{sendCommand("install-theme",[e],a=>{REST.get(e).then(o=>{var i=JSON.parse(o.text);if(!i)throw Error("Invalid theme structure");try{var s=e.substring(e.lastIndexOf("/")+1).replace(".json",""),l={...i,displayName:i.displayName??i.name,name:s};if(i.name===s)return n({theme:i,callback:t,data:a,resolve:r});"fucky_wucky"!==a&&writeFile(`Themes/${s}.json`,JSON.stringify(l,null,2)).then(()=>n({theme:l,callback:t,data:a,resolve:r}))}catch(e){console.error(e)}})})})})).apply(this,arguments)}function applyTheme(e,t){return new Promise(n=>{sendCommand("apply-theme",[e,Theme.theme],r=>{theme$1=e,t&&t(r),Events.emit("applied",e),n(r)})})}function removeTheme(e){return new Promise(t=>{sendCommand("remove-theme",[],n=>{theme$1="",e&&e(n),Events.emit("removed"),t(n)})})}function uninstallTheme(e,t){return _uninstallTheme.apply(this,arguments)}function _uninstallTheme(){return(_uninstallTheme=_async_to_generator$2(function*(e,t){return getTheme()===e&&removeTheme(),new Promise(n=>{sendCommand("uninstall-theme",[e],r=>{if("uninstalled_theme"===r){var a=themes$1.findIndex(t=>t.name===e);a>-1&&themes$1.splice(a,1),Events.emit("uninstalled"),t&&t(r)}n(r)})})})).apply(this,arguments)}var Themes=Object.freeze({__proto__:null,applyTheme:applyTheme,getTheme:getTheme,getThemeByName:getThemeByName,installTheme:installTheme,listThemes:listThemes,off:off,on:on,once:once,removeTheme:removeTheme,uninstallTheme:uninstallTheme}),{ThemeColorMap:ThemeColorMap$6}=Constants$1,styles$6=StyleSheet$1.createThemedStyleSheet({icon:{color:ThemeColorMap$6.INTERACTIVE_NORMAL,opacity:.75,marginLeft:.5}});function PluginIcon({height:e,width:t,...n}){return React.createElement(SVG.Svg,{viewBox:"0 0 24 24",style:{height:e,width:t,...styles$6.icon},fill:"currentColor",...n},React.createElement(SVG.Path,{d:"M0 0h24v24H0z",fill:"none"}),React.createElement(SVG.Path,{d:"M20.5 11H19V7c0-1.1-.9-2-2-2h-4V3.5C13 2.12 11.88 1 10.5 1S8 2.12 8 3.5V5H4c-1.1 0-1.99.9-1.99 2v3.8H3.5c1.49 0 2.7 1.21 2.7 2.7s-1.21 2.7-2.7 2.7H2V20c0 1.1.9 2 2 2h3.8v-1.5c0-1.49 1.21-2.7 2.7-2.7 1.49 0 2.7 1.21 2.7 2.7V22H17c1.1 0 2-.9 2-2v-4h1.5c1.38 0 2.5-1.12 2.5-2.5S21.88 11 20.5 11z"}))}var{ThemeColorMap:ThemeColorMap$5}=Constants$1,styles$5=StyleSheet$1.createThemedStyleSheet({icon:{color:ThemeColorMap$5.INTERACTIVE_NORMAL,opacity:.75,marginLeft:.5}});function ThemeIcon({height:e,width:t,...n}){return React.createElement(SVG.Svg,{viewBox:"0 0 24 24",style:{height:e,width:t,...styles$5.icon},fill:"currentColor",...n},React.createElement(SVG.Path,{d:"M0 0h24v24H0z",fill:"none"}),React.createElement(SVG.Path,{d:"M12 3c-4.97 0-9 4.03-9 9s4.03 9 9 9c.83 0 1.5-.67 1.5-1.5 0-.39-.15-.74-.39-1.01-.23-.26-.38-.61-.38-.99 0-.83.67-1.5 1.5-1.5H16c2.76 0 5-2.24 5-5 0-4.42-4.03-8-9-8zm-5.5 9c-.83 0-1.5-.67-1.5-1.5S5.67 9 6.5 9 8 9.67 8 10.5 7.33 12 6.5 12zm3-4C8.67 8 8 7.33 8 6.5S8.67 5 9.5 5s1.5.67 1.5 1.5S10.33 8 9.5 8zm5 0c-.83 0-1.5-.67-1.5-1.5S13.67 5 14.5 5s1.5.67 1.5 1.5S15.33 8 14.5 8zm3 4c-.83 0-1.5-.67-1.5-1.5S16.67 9 17.5 9s1.5.67 1.5 1.5-.67 1.5-1.5 1.5z"}))}var infoDictionary=Native$1.InfoDictionaryManager??Native$1.RTNClientInfoManager,bundle=infoDictionary.Identifier,reload=Native$1.BundleUpdaterManager.reload,version=Native$1.InfoDictionaryManager.Version,os=Native$1.DCDDeviceManager.systemVersion,build=infoDictionary.Build,device=Native$1.DCDDeviceManager.device,Native=Object.freeze({__proto__:null,build:build,bundle:bundle,device:device,infoDictionary:infoDictionary,os:os,reload:reload,version:version}),BadgesDomain="https://raw.githubusercontent.com/enmity-mod/badges/main/",Invite="rMdzhWUaGT";!function(e){e[e.HOUR=36e5]="HOUR"}(Times||(Times={}));try{var{ThemeColorMap:ThemeColorMap$4}=Constants$1;throw Error(ThemeColorMap$4)}catch(e){var err=Error(e);console.error(err)}var{ThemeColorMap:ThemeColorMap1}=Constants$1,styles$4=StyleSheet$1.createThemedStyleSheet({debugText:{color:ThemeColorMap1.TEXT_MUTED},container:{marginBottom:50}}),Invites=getByProps("acceptInviteAndTransitionToInviteChannel");function Page$1({settings:e}){var t={Twitter:getIDByName("img_account_sync_twitter_white"),GitHub:getIDByName("img_account_sync_github_white"),Addon:getIDByName("img_nitro_increase_guild_limit"),Checkmark:getIDByName("Check"),Discord:getIDByName("Discord"),Refresh:getIDByName("ic_sync_24px"),Hammer:getIDByName("ic_hammer_and_chisel_24px"),Server:getIDByName("ic_server_security_24px")},n=HermesInternal.getRuntimeProperties(),r=getPlugins().map(e=>e.name),a=listThemes().map(e=>e.name);return React.createElement(ScrollView,null,React.createElement(KeyboardAvoidingView,{enabled:!0,behavior:"position",style:styles$4.container,keyboardVerticalOffset:100,contentContainerStyle:{backfaceVisibility:"hidden"}},React.createElement(FormSection,{title:"Links"},React.createElement(FormRow,{label:"Discord Server",leading:React.createElement(FormRow.Icon,{source:t.Discord}),trailing:FormRow.Arrow,onPress:()=>Invites.acceptInviteAndTransitionToInviteChannel({inviteKey:Invite,context:{location:"Invite Button Embed"},callback:()=>{}})}),React.createElement(FormDivider,null),React.createElement(FormRow,{label:"GitHub",leading:React.createElement(FormRow.Icon,{source:t.GitHub}),trailing:FormRow.Arrow,onPress:()=>Linking.openURL("https://github.com/enmity-mod")}),React.createElement(FormDivider,null),React.createElement(FormRow,{label:"Twitter",leading:React.createElement(FormRow.Icon,{source:t.Twitter}),trailing:FormRow.Arrow,onPress:()=>Linking.openURL("https://twitter.com/EnmityApp")})),React.createElement(FormSection,{title:"Debug"},React.createElement(FormRow,{label:"Installed Plugins",leading:React.createElement(PluginIcon,{width:24,height:24}),trailing:()=>React.createElement(Text,{style:styles$4.debugText},r.length),onPress:()=>{Toasts.open({content:"Copied to clipboard",source:t.Checkmark}),Clipboard.setString(`**Plugins**: ${r.join(", ")}`)}}),React.createElement(FormDivider,null),React.createElement(FormRow,{label:"Installed Themes",leading:React.createElement(ThemeIcon,{width:24,height:24}),trailing:()=>React.createElement(Text,{style:styles$4.debugText},a.length),onPress:()=>{Toasts.open({content:"Copied to clipboard",source:t.Checkmark}),Clipboard.setString(`**Themes**: ${a.join(", ")}`)}}),React.createElement(FormDivider,null),React.createElement(FormRow,{label:"Reload Discord",leading:React.createElement(FormRow.Icon,{source:t.Refresh}),onPress:()=>{Dialog.show({title:"Are You Sure?",body:"Are you sure you want to reload the discord app? This might crash your app instead of reloading it.",confirmText:"Yes",cancelText:"No",onConfirm:reload})}}),React.createElement(FormDivider,null),React.createElement(FormRow,{label:"Automatically connect to debug websocket",trailing:React.createElement(FormSwitch,{value:e.getBoolean("autoConnectWS",!1),onValueChange:()=>{e.toggle("autoConnectWS",!1);try{e.get("autoConnectWS",!1)?connectWebsocket():socket.close()}catch{}}})}),e.getBoolean("autoConnectWS",!1)&&React.createElement(React.Fragment,null,React.createElement(FormDivider,null),React.createElement(FormInput,{value:e.get("debugWSAddress","192.168.0.1:9090"),onChange:t=>e.set("debugWSAddress",t),title:"DEBUG IP"}))),React.createElement(FormSection,{title:"Runtime Versions"},React.createElement(FormRow,{label:"Enmity",leading:React.createElement(FormRow.Icon,{source:{uri:"https://enmity-mod.github.io/assets/icon-64.png"}}),trailing:()=>React.createElement(Text,{style:styles$4.debugText},window.enmity.version),onPress:()=>Linking.openURL(`https://github.com/enmity-mod/enmity/commit/${window.enmity.version}`)}),React.createElement(FormDivider,null),React.createElement(FormRow,{label:"Tweak",leading:React.createElement(FormRow.Icon,{source:getIDByName("ic_settings_white_24px")}),trailing:()=>React.createElement(Text,{style:styles$4.debugText},window.tweak?.version??"N/A"," (",window.tweak?.type??"N/A",")"),onPress:()=>{Toasts.open({content:"Copied to clipboard",source:t.Checkmark}),Clipboard.setString(JSON.stringify(window.tweak,null,2))}}),React.createElement(FormDivider,null),React.createElement(FormRow,{label:"Discord",leading:React.createElement(FormRow.Icon,{source:t.Discord}),trailing:()=>React.createElement(Text,{style:styles$4.debugText},version),onPress:()=>{Toasts.open({content:"Copied to clipboard",source:t.Checkmark}),Clipboard.setString(version)}}),React.createElement(FormDivider,null),React.createElement(FormRow,{label:"Bytecode",leading:React.createElement(FormRow.Icon,{source:t.Hammer}),trailing:()=>React.createElement(Text,{style:styles$4.debugText},n["Bytecode Version"]),onPress:()=>{Toasts.open({content:"Copied to clipboard",source:t.Checkmark}),Clipboard.setString(String(n["Bytecode Version"]))}}),React.createElement(FormDivider,null),React.createElement(FormRow,{label:"Hermes",leading:React.createElement(FormRow.Icon,{source:t.Server}),trailing:()=>React.createElement(Text,{style:styles$4.debugText},n["OSS Release Version"]),onPress:()=>{Toasts.open({content:"Copied to clipboard",source:t.Checkmark}),Clipboard.setString(n["OSS Release Version"])}}))))}var{Fonts:Fonts$3,ThemeColorMap:ThemeColorMap$3}=Constants$1,commonAuthorStyle={fontFamily:Fonts$3.PRIMARY_SEMIBOLD,display:"flex",fontSize:16,alignItems:"center",alignSelf:"center",justifyContent:"center"},styles$3=StyleSheet$1.createThemedStyleSheet({linkless:{...commonAuthorStyle,color:ThemeColorMap$3.HEADER_SECONDARY},link:{...commonAuthorStyle,color:ThemeColorMap$3.HEADER_PRIMARY}});function Authors({authors:e}){return e&&Array.isArray(e)&&e.length?React.createElement(View,null,e.map((t,n)=>{var r=n!==e.length-1;return"string"==typeof t?React.createElement(Text,{style:styles$3.linkless},t,r&&","):"object"==typeof t&&t.name&&!t.id?React.createElement(Text,{style:styles$3.linkless},t.name,r&&","):"object"==typeof t&&t.name&&t.id?React.createElement(TouchableOpacity,{key:t.id,onPress:()=>{Users.getUser(t.id)?Profiles.showUserProfile({userId:t.id}):AsyncUsers.fetchProfile(t.id).then(()=>{Profiles.showUserProfile({userId:t.id})})}},React.createElement(Text,{style:styles$3.link},t.name,r&&",")):null}).filter(Boolean)):null}var{Fonts:Fonts$2,ThemeColorMap:ThemeColorMap$2}=Constants$1,getThemeName=e=>e.displayName??e.name,styles$2=StyleSheet$1.createThemedStyleSheet({container:{backgroundColor:ThemeColorMap$2.BACKGROUND_FLOATING,borderRadius:5,borderLeftWidth:5,marginBottom:15},name:{color:ThemeColorMap$2.HEADER_PRIMARY,fontFamily:Fonts$2.PRIMARY_SEMIBOLD,fontSize:16},version:{color:ThemeColorMap$2.HEADER_SECONDARY,fontSize:16,fontFamily:Fonts$2.PRIMARY_SEMIBOLD,marginLeft:2.5,marginRight:2.5},content:{height:"auto",paddingBottom:10,paddingLeft:10,paddingRight:10},actions:{justifyContent:"flex-end",flexDirection:"row",alignItems:"center"},description:{color:ThemeColorMap$2.HEADER_SECONDARY,fontFamily:Fonts$2.PRIMARY_SEMIBOLD},info:{marginLeft:-6,flexDirection:"row",alignItems:"center",flexWrap:"wrap",width:"100%"},delete:{marginRight:7.5},trashIcon:{width:22,height:22,tintColor:ThemeColorMap$2.INTERACTIVE_NORMAL},settingsIcon:{width:22,height:22,tintColor:ThemeColorMap$2.INTERACTIVE_NORMAL}});function Card({data:e,type:t}){var[n,r]=React.useState("plugin"===t?getEnabledPlugins()?.includes(e.name):getTheme()===e.name),a=NavigationNative?.useNavigation(),o="theme"===t?getThemeName(e):e.name,i="plugin"===t?e.getSettingsPanel:void 0;return React.createElement(View,{style:[styles$2.container,{borderLeftColor:e?.color??"#524FBF"}]},React.createElement(View,null,React.createElement(FormRow,{label:()=>React.createElement(View,{style:styles$2.info},React.createElement(Text,{adjustsFontSizeToFit:!0,style:styles$2.name},o),e.version&&React.createElement(Text,{adjustsFontSizeToFit:!0,style:styles$2.version},e.version),e.authors&&React.createElement(Text,{style:styles$2.version},"by"),React.createElement(Authors,{authors:e.authors})),trailing:()=>{try{return React.createElement(View,{style:styles$2.actions},i&&n&&React.createElement(TouchableOpacity,{style:styles$2.delete,onPress:()=>{a?.push?.("EnmityCustomPage",{pageName:e.name,pagePanel:connectComponent?.(i,e.name)})}},React.createElement(Image,{style:styles$2.settingsIcon,source:getIDByName("settings")})),React.createElement(TouchableOpacity,{style:styles$2.delete,onPress:()=>{("plugin"===t?uninstallPlugin:uninstallTheme)(e.name,e=>{var n={fucky_wucky:{content:`Invalid ${t}`,source:getIDByName("ic_close_16px")},[`uninstalled_${t}`]:{content:`${o} has been uninstalled.`,source:getIDByName("Check")}};if(!Object.keys(n).includes(e))return console.log(`Uninstall returned early with outcome: ${e}`);Toasts.open(n[e])})}},React.createElement(Image,{style:styles$2.trashIcon,source:getIDByName("ic_trash_filled_16px")})),React.createElement(FormSwitch,{value:n,onValueChange:n=>{var a=getTheme();r(n),Toasts.open({content:`${o} has been ${n?"enabled":"disabled"}.`,source:getIDByName("Check")}),n?"plugin"===t?enablePlugin(e.name):applyTheme(e.name):"plugin"===t?disablePlugin$1(e.name):removeTheme(),"theme"===t&&Dialog?.show({title:`Theme ${n?"Enabled":"Disabled"}`,body:`${n?"Enabling":"Disabling"} a theme requires a restart, would you like to restart Discord to ${n?"apply":"remove"} the theme?`,confirmText:"Restart",cancelText:"Later",onConfirm:reload,onCancel:()=>{r(e=>!e),applyTheme(a)}})}}))}catch(e){console.log("An exception has been raised: "+e)}}})),React.createElement(View,{style:styles$2.content},React.createElement(Text,{style:styles$2.description},e.description??"No description provided.")))}var{Fonts:Fonts$1,ThemeColorMap:ThemeColorMap$1}=Constants$1,styles$1=StyleSheet$1.createThemedStyleSheet({container:{flex:1,padding:5},notFound:{display:"flex",justifyContent:"center",alignItems:"center",alignSelf:"center",marginTop:"50%"},notFoundText:{marginTop:10,color:ThemeColorMap$1.TEXT_MUTED,fontFamily:Fonts$1.PRIMARY_SEMIBOLD,textAlign:"center"},search:{margin:0,marginBottom:0,paddingBottom:5,paddingRight:10,paddingLeft:10,backgroundColor:"none",borderBottomWidth:0,background:"none"}}),Search=getModule(e=>"StaticSearchBarContainer"===e.name);function Page({type:e}){var t="plugin"===e,n=React.useState(null)[1],[r,a]=React.useState((t?getPlugins():listThemes()).sort((e,t)=>e.name.localeCompare(t.name))),[o,i]=React.useState(!1),[s,l]=React.useState(null);React.useEffect(()=>{function e(){n({})}return(t?Plugins:Themes).on("installed",e),(t?Plugins:Themes).on("uninstalled",e),()=>{(t?Plugins:Themes).off("installed",e),(t?Plugins:Themes).off("uninstalled",e)}},[]);var c=s?r?.filter(e=>!!(e.name.toLowerCase().includes(s.toLowerCase())||e.description?.toLowerCase().includes(s.toLowerCase())||e.authors?.find?.(e=>(e.name??e).toLowerCase().includes(s.toLowerCase())))):r;return React.createElement(React.Fragment,null,React.createElement(Search,{style:styles$1.search,placeholder:`Search ${t?"Plugins":"Themes"}...`,onChangeText:e=>l(e)}),React.createElement(View,{style:styles$1.container},React.createElement(ScrollView,{style:styles$1.container,refreshControl:React.createElement(RefreshControl,{refreshing:o,onRefresh:()=>{i(!0),a((t?getPlugins():listThemes()).sort((e,t)=>e.name.localeCompare(t.name))),i(!1)}})},c.length?React.createElement(FlatList,{data:c,renderItem:({item:t})=>React.createElement(Card,{data:t,type:e}),keyExtractor:e=>e.name+e?.version+e.authors?.reduce((e,t)=>e+t.name,"")}):s?React.createElement(View,{style:styles$1.notFound},React.createElement(Image,{source:getIDByName("img_no_results_dark")}),React.createElement(Text,{style:styles$1.notFoundText},"We searched far and wide."),React.createElement(Text,{style:[styles$1.notFoundText,{marginTop:0}]},"Unfortunately, no results were found.")):React.createElement(View,{style:styles$1.notFound},React.createElement(Image,{source:getIDByName("img_connection_empty_dark")}),React.createElement(Text,{style:styles$1.notFoundText},"You don't have any ",e,"s installed."),React.createElement(Text,{style:{...styles$1.notFoundText,marginTop:0}},"Install some by clicking the + icon!")))))}function asyncGeneratorStep$1(e,t,n,r,a,o,i){try{var s=e[o](i),l=s.value}catch(e){n(e);return}s.done?t(l):Promise.resolve(l).then(r,a)}function _async_to_generator$1(e){return function(){var t=this,n=arguments;return new Promise(function(r,a){var o=e.apply(t,n);function i(e){asyncGeneratorStep$1(o,r,a,i,s,"next",e)}function s(e){asyncGeneratorStep$1(o,r,a,i,s,"throw",e)}i(void 0)})}}var{Fonts,ThemeColorMap}=Constants$1,styles=StyleSheet$1.createThemedStyleSheet({header:{tintColor:ThemeColorMap.HEADER_PRIMARY,marginRight:15,width:18,height:18},wrapper:{marginRight:15,width:32,height:32},text:{fontFamily:Fonts.DISPLAY_BOLD,color:ThemeColorMap.TEXT_NORMAL,opacity:.975,letterSpacing:.25,fontSize:16,paddingTop:10,marginLeft:0}}),InstallText=({type:e})=>React.createElement(Text,{style:styles.text},"Paste ",e," URL here:"),showAlert=({type:e,url:t})=>{t?.endsWith("plugin"===e?".js":".json")||(t=""),Dialog?.show({title:`Install ${e}`,children:React.createElement(DialogBody,{type:e}),confirmText:"Install",cancelText:"Cancel",onConfirm:()=>{if(!t?.endsWith("plugin"===e?"js":"json"))return Toasts.open({content:`Invalid URL for ${e}`,source:getIDByName("ic_close_16px")});try{("plugin"===e?installPlugin:installTheme)(t,({data:t,restart:n,name:r})=>{var{restart:a,...o}={fucky_wucky:{content:`Failed ${e} installation of ${r}.`,source:getIDByName("ic_close_16px"),restart:!1},[`installed_${e}`]:{content:`${r} has been installed.`,source:getIDByName("Check"),restart:n},[`overridden_${e}`]:{content:`${r} has been overriden.`,source:getIDByName("Check"),restart:n}}[t];Toasts.open(o),a&&Dialog.show({title:"Theme Replaced",body:"Replacing the theme you previously had applied requires a restart, would you like to restart Discord to reload the theme values?",confirmText:"Yes",cancelText:"No",onConfirm:reload})})}catch(e){Toasts.open({content:e.message})}}})};function DialogBody({type:e}){var[t,n]=React.useState("");return React.createElement(React.Fragment,null,React.createElement(InstallText,{type:e}),React.createElement(FormInput,{placeholder:"plugin"===e?"https://github.com/discord-modifications/enmity-addons/blob/main/Plugins/ShowHiddenChannels/dist/ShowHiddenChannels.js":"https://raw.githubusercontent.com/discord-modifications/enmity-addons/main/Themes/AMOLED.json",value:t,onChange:n,autoFocus:!0,showBorder:!0,inputMode:"url"}))}function HeaderRight({type:e}){return React.createElement(TouchableOpacity,{style:styles.wrapper,onPress:_async_to_generator$1(function*(){showAlert({type:e,url:yield Clipboard?.getString?.()})})},React.createElement(Image,{style:styles.header,source:getIDByName("add_white")}))}var Patcher$4=create("enmity-settings-panels");function panels(){patchScreens(),patchSettings()}function patchScreens(){Patcher$4.after(Scenes,"default",(e,t,n)=>({...n,Enmity:{key:"Enmity",title:"Enmity",render:connectComponent(Page$1,"enmity")},EnmityPlugins:{key:"EnmityPlugins",title:"Plugins",render:()=>React.createElement(Page,{type:"plugin"}),headerRight:()=>React.createElement(HeaderRight,{type:"plugin"})},EnmityThemes:{key:"EnmityThemes",title:"Themes",render:()=>React.createElement(Page,{type:"theme"}),headerRight:()=>React.createElement(HeaderRight,{type:"theme"})},EnmityCustomPage:{key:"EnmityCustomPage",title:"Page",render:({pageName:e,pagePanel:t})=>{var n=NavigationNative.useNavigation(),r=t;return React.useEffect(()=>{e&&n.setOptions({title:e})},[]),React.createElement(r,null)}}}))}function patchSettings(){var e=getByName$1("UserSettingsOverviewWrapper",{default:!1}),t=Patcher$4.after(e,"default",(e,n,r)=>{var a=findInReactTree(r,e=>e.type?.name==="UserSettingsOverview");Patcher$4.after(a.type.prototype,"render",({props:{navigation:e}},t,n)=>{var{children:r}=build>="42188"?findInReactTree(n,e=>e.children[1].type===FormSection):n.props,a=[Locale.Messages.BILLING_SETTINGS,Locale.Messages.PREMIUM_SETTINGS],o=r.findIndex(e=>a.includes(e.props.title));r.splice(-1===o?4:o,0,React.createElement(React.Fragment,null,React.createElement(FormSection,{key:"Enmity",title:"Enmity"},React.createElement(FormRow,{label:"General",leading:React.createElement(FormRow.Icon,{source:{uri:"https://enmity-mod.github.io/assets/icon-64.png"}}),trailing:React.createElement(FormArrow,null),onPress:()=>void e.push("Enmity",{navigation:e})}),React.createElement(FormDivider,null),React.createElement(FormRow,{label:"Plugins",leading:React.createElement(PluginIcon,{width:24,height:24}),trailing:React.createElement(FormArrow,null),onPress:()=>void e.push("EnmityPlugins",{navigation:e})}),React.createElement(FormDivider,null),React.createElement(FormRow,{label:"Themes",leading:React.createElement(ThemeIcon,{width:24,height:24}),trailing:React.createElement(FormArrow,null),onPress:()=>void e.push("EnmityThemes",{navigation:e})}))));var i=r.find(e=>e.props.title===Locale.Messages.SUPPORT),s=i?.props.children;s&&(i.props.children=s.filter(e=>e?.type?.name!=="UploadLogsButton"))}),t()})}var Patcher$3=create("enmity-settings-tabs");function tabs(){patchConstants(),patchSections(),patchSearch()}var routes={General:"Enmity",Plugins:"EnmityPlugins",Themes:"EnmityThemes",Custom:"EnmityCustomPage"};function PageWithHeaderRight({type:e}){var t=NavigationNative.useNavigation(),n=t.addListener("focus",()=>{n(),t.setOptions({headerRight:()=>React.createElement(HeaderRight,{type:e})})});return React.createElement(Page,{type:e})}var screens={General:connectComponent(Page$1,"enmity"),Plugins:()=>React.createElement(PageWithHeaderRight,{type:"plugin"}),Themes:()=>React.createElement(PageWithHeaderRight,{type:"theme"}),Custom:({pageName:e,pagePanel:t})=>{var n=NavigationNative.useNavigation(),r=n.addListener("focus",()=>{r(),n.setOptions({title:e})});return React.createElement(t,null)}},titles={General:"Enmity",Plugins:"Plugins",Themes:"Themes",Custom:"Page"},icons={General:{uri:"https://enmity-mod.github.io/assets/icon-64.png"},Plugins:getIDByName("ic_activity_24px"),Themes:getIDByName("ic_paint_brush"),Custom:null},Constants=getByProps("SETTING_RENDERER_CONFIG");function patchConstants(){Constants.SETTING_RENDERER_CONFIG={...Constants.SETTING_RENDERER_CONFIG},Object.assign(Constants.SETTING_RENDERER_CONFIG,Object.keys(routes).map(e=>({[routes[e]]:{type:"route",title:titles[e],icon:icons[e],parent:null,screen:{route:routes[e],getComponent:()=>React.memo(({route:t})=>{var n=screens[e];return React.createElement(n,t?.params??{})})}}})).reduce((e,t)=>({...e,...t}),{}))}function patchSections(){var e=getByProps("SearchableSettingsList");Patcher$3.before(e.SearchableSettingsList,"type",(e,[{sections:t}])=>{var n=t?.findIndex(e=>e.settings.find(e=>"ACCOUNT"===e));t.find(e=>"Enmity"===e.label)||t.splice(-1===n?1:n+1,0,{label:"Enmity",settings:Object.values(routes).filter(e=>"EnmityCustomPage"!==e)});var r=t.find(e=>e.label===Locale.Messages.SUPPORT);r&&(r.settings=r.settings.filter(e=>"UPLOAD_DEBUG_LOGS"!==e))})}function patchSearch(){var[e,t,n]=getByProps(["getSettingSearchQuery"],["useSettingSearchResults"],["getSettingListSearchResultItems"],{bulk:!0});Patcher$3.after(t,"useSettingSearchResults",(t,n,r)=>(r=r.filter(e=>!Object.values(routes).includes(e)),Object.keys(routes).filter(e=>"Custom"!==e).forEach(t=>{["Enmity",titles[t]].some(t=>t.toLowerCase().includes(e.getSettingSearchQuery().toLowerCase()))&&!r.find(e=>e===routes[t])&&r.unshift(routes[t])}),r)),Patcher$3.after(n,"getSettingListSearchResultItems",(e,[t],n)=>(n=n.filter(e=>!Object.values(routes).includes(e.setting)),Object.keys(routes).filter(e=>"Custom"!==e).reverse().forEach(e=>{t.includes(routes[e])&&(n.unshift({type:"setting_search_result",searchResultData:Constants.SETTING_RENDERER_CONFIG[routes[e]],setting:routes[e],title:titles[e],breadcrumbs:["Enmity"],icon:icons[e]}),n.forEach((e,t,n)=>{e.index=t,e.total=n.length}))}),n))}function settings(){panels(),tabs()}var Patcher$2=create("no-track");function tracking(){var[e,t,n]=getByProps(["trackWithMetadata"],["AnalyticsActionHandlers"],["encodeProperties","track"],{bulk:!0});try{patchMetadata(e)}catch(e){console.error("Failed to patch metadata",e.message)}try{patchAnalytics(t)}catch(e){console.error("Failed to patch analytics",e.message)}try{patchProperties(n)}catch(e){console.error("Failed to patch properties",e.message)}return Patcher$2.unpatchAll}function patchMetadata(e){Patcher$2.instead(e,"trackWithMetadata",()=>{}),Patcher$2.instead(e,"trackWithGroupMetadata",()=>{})}function patchAnalytics(e){Patcher$2.instead(e.AnalyticsActionHandlers,"handleTrack",()=>{})}function patchProperties(e){Patcher$2.instead(e,"track",()=>{})}var levels={debug:0,info:1,warn:2,error:3},methods=["error","info","log","warn","trace","debug"],inspect=()=>{var e=function(e){console[e].__ORIGINAL__=console[e],console[e]=(...n)=>{for(var r=[],a=0,o=n.length;o>a;a++)r.push("string"==typeof n[a]?n[a]:t.inspect(n[a]));for(var i="",s=0,l=r.length;l>s;s++)i+=`${r[s]} `;nativeLoggingHook(i,levels[e]??levels.info)}},t=getByProps("inspect");for(var n of methods)e(n)};function asyncGeneratorStep(e,t,n,r,a,o,i){try{var s=e[o](i),l=s.value}catch(e){n(e);return}s.done?t(l):Promise.resolve(l).then(r,a)}function _async_to_generator(e){return function(){var t=this,n=arguments;return new Promise(function(r,a){var o=e.apply(t,n);function i(e){asyncGeneratorStep(o,r,a,i,s,"next",e)}function s(e){asyncGeneratorStep(o,r,a,i,s,"throw",e)}i(void 0)})}}var Patcher$1=create("badges"),cache={user:{},badges:{}};function badges(){var e=function(e){Patcher$1.after(e,"default",(t,[{user:n,isEnmity:a,style:o,...i}],s)=>{r({user:n,isEnmity:a,style:o,rest:i,res:s,kind:e.default})})},t=getByName$1("ProfileBadges",{all:!0,default:!1}),n=getByName$1("ProfileBadges",{default:!1}),r=({user:e,isEnmity:t,style:n,rest:r,res:a,kind:o})=>{if(!t){var[i,s]=React.useState([]);React.useEffect(()=>{try{fetchUserBadges(e.id).then(s)}catch(t){console.error(`Failed to request/parse badges for ${e.id}`)}},[]);var l=i.map(e=>makeBadge(e,n));if(!i.length)return a;if(!a&&Number(version)>=151)(a=wrapInHooks(o)({user:new Proxy({},{get:(t,n)=>"flags"===n?-1:"hasFlag"===n?()=>!0:e[n]}),isEnmity:!0,...r})).props.children=[],a.props.badges&&(a.props.badges=[]);else if(!a)return l;a.props.badges?a.props.badges.push(...l):a.props.children.push(...l)}};if(build>="42235")return Patcher$1.after(n,"default",(e,[{user:t,isEnmity:a,style:o,...i}],s)=>{var l=s;if(s||((s=React.createElement(View,{style:[o,{flexDirection:"row",flexWrap:"wrap",alignItems:"flex-end",justifyContent:"flex-end",paddingVertical:2}],accessibilityRole:"list",accessibilityLabel:"User Badges"})).props.children=[]),r({user:t,isEnmity:a,style:o,rest:i,res:s,kind:n.default}),!l)return s}),Patcher$1.unpatchAll;for(var a of t)e(a);return Patcher$1.unpatchAll}function fetchUserBadges(e){return _fetchUserBadges.apply(this,arguments)}function _fetchUserBadges(){return(_fetchUserBadges=_async_to_generator(function*(e){if(cache.user[e]?.date&&Date.now()-cache.user[e].date<Times.HOUR)return cache.user[e].badges;var t=yield fetch(BadgesDomain+e+".json",{headers:{"Cache-Control":"no-cache"}}).then(e=>e.json()).catch(()=>[]);return Array.isArray(t)&&(cache.user[e]={badges:t,date:Date.now()}),t})).apply(this,arguments)}var makeBadge=(e,t)=>{var n={wrapper:{alignItems:"center",flexDirection:"row",justifyContent:"flex-end"}};return React.createElement(View,{enmity:!0,key:e,style:n.wrapper},React.createElement(Badge,{type:e,size:Array.isArray(t)?t.find(e=>e.paddingVertical&&e.paddingHorizontal)?18:24:20,margin:Array.isArray(t)?4:8}))},Badge=({type:e,size:t,margin:n})=>{var[r,a]=React.useState(null);if(React.useEffect(()=>{try{fetchBadge(e).then(a)}catch(t){console.error(`Failed to get badge data for ${e}.`,t.message)}},[]),!r?.url)return null;var o={image:{width:t,height:t,resizeMode:"contain",marginLeft:n,marginRight:n+1}},i=r.url["light"===Theme.theme?"light":"dark"];return React.createElement(TouchableOpacity,{onPress:()=>Toasts.open({content:r.name,source:{uri:i}})},React.createElement(Image,{source:{uri:i},style:o.image}))};function fetchBadge(e){return _fetchBadge.apply(this,arguments)}function _fetchBadge(){return(_fetchBadge=_async_to_generator(function*(e){if(cache.badges[e]?.date&&Date.now()-cache.badges[e].date<Times.HOUR)return cache.badges[e].data;var t=yield fetch(BadgesDomain+`data/${e}.json`,{headers:{"Cache-Control":"no-cache"}}).then(e=>e.json()).catch(()=>{});return t?.url&&(cache.badges[e]={data:t,date:Date.now()}),t})).apply(this,arguments)}var theme=()=>{var[{overrideTheme:e},{setAMOLEDThemeEnabled:t},{useAMOLEDTheme:n}]=getByProps(["updateTheme","overrideTheme"],["setAMOLEDThemeEnabled"],["useAMOLEDTheme"],{bulk:!0}),r=function(){e(Theme?.theme??"dark"),t&&2===n&&t(!0),Dispatcher.unsubscribe("I18N_LOAD_SUCCESS",r)};Dispatcher.subscribe("I18N_LOAD_SUCCESS",r)},Patcher=create("toasts-fix"),toasts=()=>{Patcher.before(Toasts,"open",(e,t)=>{var[{key:n,source:r}]=t;n||(t[0].key=uuid()),r&&(t[0].icon=r,delete t[0].source)})},handlePatch=(e,t)=>{try{t()}catch(t){console.warn(`Failed to patch ${e}: ${t.message??t}`)}};function initialize$3(){Object.entries({inspect,settings,tracking,badges,theme,toasts}).forEach(e=>handlePatch(...e))}var Channels=getByProps("getLastSelectedChannelId");try{Avatars.BOT_AVATARS.ENMITY="https://github.com/enmity-mod.png"}catch{}function sendReply(e,t,n,r){var a=e??Channels?.getChannelId?.(),o=Clyde$1.createBotMessage({channelId:a,content:""});o.author.username=n??"Enmity",o.author.avatar=r?n:"ENMITY",r&&(Avatars.BOT_AVATARS[n]=r),"string"==typeof t?o.content=t:Object.assign(o,t),Messages.receiveMessage(a,o)}var Clyde=Object.freeze({__proto__:null,sendReply:sendReply}),websocket=[{name:"websocket",description:"Connect to the websocket server",options:[{name:"host",displayName:"host",description:"Host of the debugger",displayDescription:"Host of the debugger",type:ApplicationCommandOptionType.String,required:!0}],execute:([e])=>connectWebsocket(e.value)},{name:"dump",description:"Dump Discord's modules",execute:(e,t)=>{var n=t.channel.id,r=window.modules;function a(e){if("function"==typeof e)return e.name?`[Function: ${e.name}]`:"[Function]";if(Array.isArray(e))return e.map(a);if("object"==typeof e){var t={};for(var n in e)t[n]=a(e[n]);return t}return e}for(var o of Object.keys(r))try{var i=r[o],s={id:o};if(!i.publicModule?.exports)continue;var l=i.publicModule.exports;for(var c of Object.keys(i.publicModule.exports))s[c]=a(l[c]);sendMessage(JSON.stringify(s,null," "))}catch(e){console.log(`Couldn't dump module ${o}`),console.log(e)}sendReply(n,"Modules has been dumped.")}}],plugins=[{name:"plugins list",description:"List installed plugins",execute:(e,t)=>{var n=t.channel.id;if(0===getPlugins().length){sendReply(n,"No plugins installed.");return}var r=getEnabledPlugins(),a=getDisabledPlugins(),o="";r.length>0&&(o=`**Enabled plugins (${r.length})**:
> ${r.join(", ")}
`),a.length>0&&(o+=`**Disabled plugins (${a.length})**:
> ${a.join(", ")}`),sendReply(n,o)}},{name:"plugins install",description:"Install a plugin",options:[{name:"url",displayName:"url",description:"The URL of the plugin you'd like to install.",displayDescription:"The URL of the plugin you'd like to install.",required:!0,type:ApplicationCommandOptionType.String}],execute:([e],t)=>{var n=e.value,r=t.channel.id;installPlugin(n,e=>{sendReply(r,e)})}},{name:"plugins uninstall",description:"Uninstall a plugin",options:[{name:"plugin",displayName:"plugin",description:"Plugin name",displayDescription:"Plugin name",type:ApplicationCommandOptionType.String,required:!0}],execute:([e],t)=>{var n=e.value,r=t.channel.id;uninstallPlugin(n,e=>{sendReply(r,e)})}},{name:"plugins disable",description:"Disable a plugin",options:[{name:"plugin",displayName:"plugin",description:"Plugin name",displayDescription:"Plugin name",type:ApplicationCommandOptionType.String,required:!0}],execute:([e],t)=>{var n=e.value,r=t.channel.id;disablePlugin(n,e=>{if("yes"===e){sendReply(r,`**${n}** has been disabled.`);return}sendReply(r,`Error when disabling **${n}**.`)})}},{name:"plugins enable",description:"Enable a plugin",options:[{name:"plugin",displayName:"plugin",description:"Plugin name",displayDescription:"Plugin name",type:ApplicationCommandOptionType.String,required:!0}],execute:(e,t)=>{var n=e[0].value,r=t.channel.id;enablePlugin(n,e=>{if("yes"===e){sendReply(r,`**${n}** has been enabled.`);return}sendReply(r,`Error when enabling **${n}**.`)})}}],themes=[{name:"themes list",description:"List available themes",execute:(e,t)=>{var n=listThemes().sort();if(0===n.length){sendReply(t.channel.id,"No themes installed.");return}sendReply(t.channel.id,`**Installed themes (${n.length})**: ${n.map(e=>e.name).join(", ")}`)}},{name:"themes apply",description:"Apply a theme",options:[{name:"name",displayName:"name",description:"Theme's name",displayDescription:"Theme's name",type:ApplicationCommandOptionType.String,required:!0,choices:listThemes().map(e=>({name:e.name,displayName:e.name,value:e.name}))}],execute:(e,t)=>{var n=e[0].value;getThemeByName(n)||sendReply(t.channel.id,"Theme couldn't be found."),applyTheme(n).then(e=>{sendReply(t.channel.id,e)})}},{name:"themes clear",description:"Remove applied theme",execute:(e,t)=>{removeTheme().then(e=>{sendReply(t.channel.id,e)})}}],Icons={Checkmark:getIDByName("Check")},utils=[{name:"debug",description:"Print out your device information",options:[{name:"silent",displayName:"silent",description:"Prints the debug informations in silent mode. Only you will see them.",displayDescription:"Prints the debug informations in silent mode. Only you will see them.",type:ApplicationCommandOptionType.Boolean,required:!1}],execute:(e,t)=>{var n=e.find(e=>"silent"===e.name)?.value,r=[],a=HermesInternal.getRuntimeProperties();r.push("**Debug Info:**\n"),r.push(`> **Enmity:** ${window.enmity.version}`),r.push(`> **Tweak:** ${window.tweak?.version??"N/A"} (${window.tweak?.type??"N/A"})`),r.push(`> **Discord:** ${version} (Build ${build})`),r.push(`> **Hermes:** ${a["OSS Release Version"]}`),r.push(`> **Bytecode:** ${a["Bytecode Version"]}`),r.push(`> **Device:** ${device}`),r.push(`> **System:** ${os}`);var o=r.join("\n");return n?(sendReply(t.channel.id,o),{}):Messages.sendMessage(t.channel.id,{validNonShortcutEmojis:[],content:o})}},{name:"reload",description:"Reload Discord",execute:reload},{name:"token",description:"Displays your account's token.",options:[{name:"clipboard",displayName:"clipboard",description:"Copy your token directly to the clipboard.",displayDescription:"Copy your token directly to the clipboard.",type:ApplicationCommandOptionType.Boolean,required:!1}],execute:([e={value:!1}],t)=>{sendReply(t.channel.id,["This is your Discord token. It can grant full access to your account, messages and anything else you keep on Discord.","If someone is asking you to give this token to them, they are most likely attempting to get access to your account in a malicious manner","Keep your token safe, and don't share it with **anyone**",Token.getToken()].join("\n")),e.value&&(Clipboard.setString(Token.getToken()),Toasts.open({content:"Token succesfully copied into your clipboard",source:Icons.Checkmark}))}}];function initialize$2(){registerCommands("enmity",[...plugins,...websocket,...utils,...themes])}var API={modules:Modules,themer:Themes,patcher:Patcher$6,version:"a3db82e",plugins:Plugins,clyde:Clyde,commands:Commands$1,utilities:Utilities,settings:Settings,components:Components,native:Native,assets:Assets};function initialize$1(){window.enmity=API,Image.prefetch("https://enmity-mod.github.io/assets/icon.png")}function initialize(){initialize$5(),initialize$1(),initialize$3(),initialize$2(),Settings$1.get("shownDeprecationWarning",!1)||window.tweak||(Settings$1.set({shownDeprecationWarning:!0}),alert("Your Enmity Tweak/IPA is out of date! Please update soon. You can ignore this warning, we will only show this once."))}try{initialize()}catch(error){Dialog.show({title:"Error",body:`Enmity failed to initialize: ${"string"==typeof error?error:error.message}`,confirmText:"Okay"}),console.error(`Error:
${error}`)}