diff --git a/server-drawer/install/index.js b/server-drawer/install/index.js index d4764a7..67499ef 100644 --- a/server-drawer/install/index.js +++ b/server-drawer/install/index.js @@ -1 +1 @@ -(function(Q,Z,f,c,n,r,l,$,w,M,N,Ke){"use strict";function D(e){const t=window?.modules;if(t)for(const o in t){const s=t[o];if(!s?.isInitialized)continue;const i=s.publicModule?.exports;if(i)try{if(e(i))return i;if(i.default!=null&&e(i.default))return i.default}catch{}}}function y(...e){return D(function(t){return e.every(function(o){return t?.[o]!==void 0})})}function Ye(e){return D(function(t){return typeof t?.getName=="function"&&t.getName.length===0&&t.getName()===e})}function Ze(e){const t=y("useIsMobileQuestDockRendered");if(!t?.useIsMobileQuestDockRendered)return!1;const o=t.useIsMobileQuestDockRendered;return t.useIsMobileQuestDockRendered=function(...s){return o.apply(this,s),!0},e.push(function(){t.useIsMobileQuestDockRendered=o}),!0}function $e(e){const t=y("useIsMobileQuestDockRenderedBase");if(!t?.useIsMobileQuestDockRenderedBase)return!1;const o=t.useIsMobileQuestDockRenderedBase;return t.useIsMobileQuestDockRenderedBase=function(...s){return o.apply(this,s),!0},e.push(function(){t.useIsMobileQuestDockRenderedBase=o}),!0}function Ne(e){const t=y("useIsMobileQuestDockVisibleToUser");if(!t?.useIsMobileQuestDockVisibleToUser)return!1;const o=t.useIsMobileQuestDockVisibleToUser;return t.useIsMobileQuestDockVisibleToUser=function(...s){return o.apply(this,s),!0},e.push(function(){t.useIsMobileQuestDockVisibleToUser=o}),!0}function et(e){const t=y("useMobileQuestDock");if(!t?.useMobileQuestDock)return!1;const o=t.useMobileQuestDock;return t.useMobileQuestDock=function(...s){return o.apply(this,s)||{id:"server-drawer",config:{quest_content_type:0,assets:{questBarHeroVideo:null,questBarHero:null},features:[]},userStatus:{enrolledAt:"2099-01-01",claimedAt:null},benefits:{rewards:[]},guildId:"0",tasks:[]}},e.push(function(){t.useMobileQuestDock=o}),!0}const tt="[ServerDrawer]";function nt(e){const t=y("getQuestAsset");if(!t?.getQuestAsset)return console.log(tt,"WARN: getQuestAsset not found"),!1;const o=t.getQuestAsset;return t.getQuestAsset=function(...s){try{return o.apply(this,s)}catch{return{url:null,isAnimated:!1}}},e.push(function(){t.getQuestAsset=o}),!0}function C(e){let t,o=!1;return function(){if(o)return t;const s=e();return s!=null&&(t=s,o=!0),s??void 0}}const ye=l.findByStoreName("GuildStore"),ot=l.findByProps("useStateFromStores"),rt=l.findByProps("colors","unsafe_rawColors")?.colors;function me({id:e,size:t=48}){const o=ot?.useStateFromStores?.([ye],function(){return ye?.getGuild?.(e)},[e])??null;if(!o)return null;const s=t>=40?16:8;return o.icon?n.createElement(r.Image,{source:{uri:`https://cdn.discordapp.com/icons/${o.id}/${o.icon}.png?size=${t*2}`},style:{width:t,height:t,borderRadius:s}}):n.createElement(r.View,{style:[be.fallback,{width:t,height:t,borderRadius:s,backgroundColor:rt?.BG_ACCENT??"#5865f2"}]},n.createElement(r.Text,{style:[be.letter,{fontSize:Math.max(10,t*.4)}]},o.name?.split(" ").map(function(i){return i[0]}).join("").slice(0,2).toUpperCase()||"?"))}const be=r.StyleSheet.create({fallback:{alignItems:"center",justifyContent:"center"},letter:{color:"#fff",fontWeight:"700"}}),st=l.findByStoreName("ThemeStore"),it=l.find(function(e){return e?.default?.internal?.resolveSemanticColor})?.default?.internal?.resolveSemanticColor??l.find(function(e){return e?.meta?.resolveSemanticColor})?.meta?.resolveSemanticColor??function(){};function lt(e,t=st?.theme){if(e)try{return it(t,e)}catch{return}}const Se=l.findByProps("TextStyleSheet")?.TextStyleSheet,Ce=l.findByProps("triggerHapticFeedback","HapticFeedbackTypes");function v(e,t){return lt(e)??t}const F=12,ee=12,ke=42,te=220,Ee=4,x=16,L=20,we={tension:200,friction:20};function at({visible:e,items:t,title:o,anchorX:s,anchorY:i,onClose:a}){const{width:u,height:m}=r.Dimensions.get("window"),g=(o?ee+20+Ee:0)+t.length*ke;let b=s,p=i+48+10;b+te>u-F&&(b=u-te-F),bm-F&&(p=i-g-10),p0?n.createElement(r.View,{style:P.outline},n.createElement(r.View,{style:P.badge},n.createElement(r.Text,{style:P.text},t>99?"99+":String(t)))):o?n.createElement(r.View,{style:P.dotOutline},n.createElement(r.View,{style:P.dot})):null:null}function Re({node:e,onPick:t}){const o=n.useRef(null),s=n.useRef(new r.Animated.Value(1)).current,i=function(){return r.Animated.spring(s,{toValue:.85,useNativeDriver:!0}).start()},a=function(){return r.Animated.spring(s,{toValue:1,useNativeDriver:!0}).start()},[u,m]=n.useState({visible:!1,items:[],title:"",x:0,y:0}),g=n.useCallback(function(){const E=e.id,d=ut?.getGuild?.(E);if(!d)return;const S=o.current;if(!S?.measure)return;const B=[{label:"Mark as Read",action:function(){return ht(E)}},{label:"Copy Server ID",action:function(){c.clipboard.setString(E),w.showToast("Copied server ID",void 0)}}];S.measure(function(V,H,G,de,Y,T){m({visible:!0,items:B,title:d.name,x:Y,y:T})})},[e.id]),b=n.useCallback(function(){Ie?.triggerHapticFeedback?.(Ie.HapticFeedbackTypes.IMPACT_MEDIUM),g()},[g]),p=e.id;return n.createElement(n.Fragment,null,n.createElement(r.Pressable,{onPressIn:i,onPressOut:a,onPress:function(){return t(p)},onLongPress:b,delayLongPress:500},n.createElement(r.View,{ref:o,style:Fe.outer,collapsable:!1},n.createElement(r.Animated.View,{style:[Fe.icon,{transform:[{scale:s}]}]},n.createElement(me,{id:p})),n.createElement(gt,{guildId:p}))),n.createElement(at,{visible:u.visible,items:u.items,title:u.title,anchorX:u.x,anchorY:u.y,onClose:function(){return m(function(E){return{...E,visible:!1}})}}))}const Fe=r.StyleSheet.create({outer:{width:j,height:j},icon:{width:j,height:j,borderRadius:16,overflow:"hidden"}}),P=r.StyleSheet.create({outline:{position:"absolute",bottom:-3,right:-3,minWidth:23,minHeight:23,borderRadius:12,backgroundColor:"#1a1a2e",alignItems:"center",justifyContent:"center"},badge:{minWidth:19,height:19,borderRadius:9,backgroundColor:"#ed4245",alignItems:"center",justifyContent:"center",paddingHorizontal:5},text:{color:"#fff",fontSize:10,fontWeight:"700",lineHeight:19},dotOutline:{position:"absolute",bottom:-2,right:-2,width:14,height:14,borderRadius:7,backgroundColor:"#1a1a2e",alignItems:"center",justifyContent:"center"},dot:{width:10,height:10,borderRadius:5,backgroundColor:"#ed4245"}}),pt=l.findByProps("useStateFromStores");l.findByProps("colors","unsafe_rawColors")?.colors;const Be=l.findByStoreName("ExpandedGuildFolderStore");function yt(e){return pt?.useStateFromStores?.([Be],function(){const t=Be?.getExpandedFolders?.();return t instanceof Set?t.has(e):!1},[e])??!1}const mt=l.findByProps("toggleGuildFolderExpand"),bt=l.findByProps("useStateFromStores"),Te=l.findByStoreName("GuildReadStateStore"),I=48,re=16,St=[{top:6,left:6},{top:6,right:6},{bottom:6,left:6},{bottom:6,right:6}],xe=N.getAssetIDByName("FolderIcon");function Pe(e){return e==null?"#5865f2":`#${e.toString(16).padStart(6,"0")}`}function Ct({node:e}){const t=bt?.useStateFromStores?.([Te],function(){let o=0;for(const s of e.children)o+=Te?.getMentionCount?.(s.id)??0;return o},[e.children])??0;return t>0?n.createElement(r.View,{style:ie.outline},n.createElement(r.View,{style:ie.badge},n.createElement(r.Text,{style:ie.text},t>99?"99+":String(t)))):null}function kt({node:e}){$.useProxy(f.storage);const t=Pe(e.color);return n.createElement(r.View,{style:_.outer},n.createElement(r.View,{style:[_.icon,{backgroundColor:t}]},f.storage.hideFolderIcons?n.createElement(r.View,{style:_.plainIcon},n.createElement(r.Image,{source:xe,style:se.folderImg,tintColor:"#fff"})):e.children.slice(0,4).map(function(o,s){return n.createElement(r.View,{key:o.id,style:[_.cell,St[s]]},n.createElement(me,{id:o.id,size:re}))})),n.createElement(Ct,{node:e}))}const _=r.StyleSheet.create({outer:{width:I,height:I},icon:{width:I,height:I,borderRadius:16,overflow:"hidden"},cell:{position:"absolute",width:re,height:re,borderRadius:8,overflow:"hidden"},plainIcon:{width:I,height:I,alignItems:"center",justifyContent:"center"}});function Et({children:e}){const t=n.useRef(new r.Animated.Value(0)).current;return n.useEffect(function(){r.Animated.timing(t,{toValue:1,duration:180,useNativeDriver:!0}).start()},[]),n.createElement(r.Animated.View,{style:{opacity:t}},e)}function wt({node:e,onPick:t}){const o=yt(e.id),s=function(){mt?.toggleGuildFolderExpand?.(e.id)};return o?n.createElement(n.Fragment,null,n.createElement(r.Pressable,{onPress:s},n.createElement(r.View,{style:[se.openIcon,{backgroundColor:Pe(e.color)}]},n.createElement(r.Image,{source:xe,style:se.folderImg,tintColor:"#fff"}))),e.children.map(function(i){return n.createElement(Et,{key:i.id},n.createElement(Re,{node:i,onPick:t}))})):n.createElement(r.Pressable,{onPress:s},n.createElement(kt,{node:e}))}const se=r.StyleSheet.create({openIcon:{width:I,height:I,borderRadius:16,alignItems:"center",justifyContent:"center"},folderImg:{width:24,height:24}}),ie=r.StyleSheet.create({outline:{position:"absolute",bottom:-3,right:-3,minWidth:23,minHeight:23,borderRadius:12,backgroundColor:"#1a1a2e",alignItems:"center",justifyContent:"center"},badge:{minWidth:19,height:19,borderRadius:9,backgroundColor:"#ed4245",alignItems:"center",justifyContent:"center",paddingHorizontal:5},text:{color:"#fff",fontSize:10,fontWeight:"700",lineHeight:19}}),U=48,Dt=N.getAssetIDByName("ChatIcon"),Ae=l.findByProps("triggerHapticFeedback","HapticFeedbackTypes"),Ve=l.findByProps("selectPrivateChannel"),It=l.findByName("SelectedChannelStore"),Rt=l.findByProps("useStateFromStores"),He=l.findByProps("getGuildId"),Ft=l.findByProps("colors","unsafe_rawColors")?.colors;function Bt(){if(Ae?.triggerHapticFeedback(Ae.HapticFeedbackTypes.SOFT),Ve?.selectPrivateChannel){const e=It?.getLastSelectedChannelId?.();Ve.selectPrivateChannel(e)}}function Tt(){const e=Rt?.useStateFromStores?.([He],function(){return He?.getGuildId?.()==null})??!1;return n.createElement(r.Pressable,{onPress:Bt,style:Ge.outer},n.createElement(r.View,{style:[Ge.icon,{backgroundColor:e?Ft?.BG_ACCENT??"#5865f2":"rgba(128,128,128,0.24)"}]},n.createElement(r.Image,{source:Dt,style:{width:24,height:24,tintColor:"#fff"}})))}const Ge=r.StyleSheet.create({outer:{width:U,height:U},icon:{width:U,height:U,borderRadius:16,alignItems:"center",justifyContent:"center"}}),Qe=48,xt=N.getAssetIDByName("CheckmarkLargeIcon"),Pt=l.findByStoreName("SortedGuildStore"),z=l.findByStoreName("GuildChannelStore"),At=l.findByStoreName("ChannelStore"),Vt=C(function(){return y("triggerHapticFeedback","HapticFeedbackTypes")}),Ht=C(function(){return y("bulkAck","ackChannel")}),Gt=C(function(){return y("ReadStateTypes","UnreadSetting")?.ReadStateTypes});function Qt(){const e=(Pt?.getGuildsTree?.()?.root?.children??[]).filter(function(s){return s?.type!=="root"}),t=[],o=function(s){for(const i of s)i.type==="folder"?o(i.children??[]):i.id!=null&&t.push(String(i.id))};return o(e),t}function Mt(){const e=Ht(),t=Gt();if(!e?.bulkAck||t?.CHANNEL==null||!z?.getSelectableChannelIds||!z?.getVocalChannelIds){w.showToast("Couldn't find Discord's read-state action - this may be unavailable on your version.",void 0);return}const o=Qt();if(o.length===0){w.showToast("Nothing to mark as read.",void 0);return}const s=[];for(const i of o){const a=[...z.getSelectableChannelIds(i)??[],...z.getVocalChannelIds(i)??[]];for(const u of a)s.push({channelId:u,readStateType:t.CHANNEL,messageId:At?.getChannel?.(u)?.lastMessageId??null})}if(s.length===0){w.showToast("Nothing to mark as read.",void 0);return}e.bulkAck(s),w.showToast(`Marked ${s.length} channel${s.length===1?"":"s"} as read`,void 0)}function vt(){const e=n.useCallback(function(){const t=Vt();t?.triggerHapticFeedback?.(t.HapticFeedbackTypes.SOFT),Mt()},[]);return n.createElement(r.Pressable,{onPress:e,style:Lt.outer},n.createElement(r.Image,{source:xt,style:{width:24,height:24,tintColor:"#80848e"}}))}const Lt=r.StyleSheet.create({outer:{width:Qe,height:Qe,alignItems:"center",justifyContent:"center"}}),jt=l.findByProps("useStateFromStores"),Me=l.findByStoreName("SortedGuildStore"),Ot=C(function(){return y("getRootNavigationRef")}),ve=C(function(){return y("triggerHapticFeedback","HapticFeedbackTypes")}),_t=C(function(){return y("transitionToGuild")}),Ut=C(function(){return D(function(e){return typeof e?.handleCreateJoinGuildPress=="function"})}),zt=C(function(){return D(function(e){return e?.CirclePlusIcon})?.CirclePlusIcon}),Wt=C(function(){return y("colors","unsafe_rawColors")?.unsafe_rawColors}),qt=l.find(function(e){return e?.QuestDockExternalCoordinationContext}),Le=qt?.QuestDockExternalCoordinationContext,je=l.find(function(e){return e?.QuestDockMode?.COLLAPSED!=null})?.QuestDockMode,W=48,q=6,Xt=12;function Jt(){const e=n.useRef(new r.Animated.Value(1)).current,t=n.useCallback(function(){r.Animated.spring(e,{toValue:.9,useNativeDriver:!0}).start()},[e]),o=n.useCallback(function(){r.Animated.spring(e,{toValue:1,useNativeDriver:!0}).start()},[e]),s=n.useCallback(function(){const u=ve();u?.triggerHapticFeedback?.(u.HapticFeedbackTypes.SOFT),Ut()?.handleCreateJoinGuildPress?.()},[]),i=zt(),a=Wt();return n.createElement(r.Pressable,{onPress:s,onPressIn:t,onPressOut:o},n.createElement(r.Animated.View,{style:[X.createJoin,{backgroundColor:a?.GREEN_360,transform:[{scale:e}]}]},i?n.createElement(i,{size:"md",color:a?.WHITE}):n.createElement(r.Text,{style:[X.createJoinFallback,{color:a?.WHITE}]},"+")))}function Oe({gestureContext:e}){const t=n.useCallback(function(d){const S=ve();S?.triggerHapticFeedback?.(S.HapticFeedbackTypes.SOFT);const B=_t();B?.transitionToGuild?B.transitionToGuild(d):Ot()?.getRootNavigationRef?.()?.navigate("guilds",{guildId:d})},[]),o=jt?.useStateFromStores?.([Me],function(){return(Me?.getGuildsTree()?.root?.children||[]).filter(function(d){return d.type!=="root"})})??[],s=e?n.useContext(e):null,i=s?.minExpandedContentHeight,a=n.useCallback(function(d){if(!i)return;const S=d.nativeEvent.layout.height;i.get()!==S&&i.set(S)},[i]),u=(Le?n.useContext(Le):null)?.setRestingQuestDockMode,m=s?.questDockWrapperSpecs;n.useEffect(function(){if(!u||!je||!m)return;const d=r.BackHandler.addEventListener("hardwareBackPress",function(){return(m.get()?.height??56)>80?(u(je.COLLAPSED),!0):!1});return function(){return d.remove()}},[u,m]);const{width:g}=r.Dimensions.get("window"),b=Math.max(3,Math.floor((g-Xt*2+q)/(W+q))),p=b*W+(b-1)*q,E=Math.max(0,(g-p)/2);return n.createElement(r.View,{style:X.alignTop},n.createElement(r.View,{style:[X.grid,{paddingHorizontal:E,gap:q}],onLayout:a},n.createElement(Tt,null),o.map(function(d){return d.type==="folder"?n.createElement(wt,{key:d.id,node:d,onPick:t}):n.createElement(Re,{key:d.id,node:d,onPick:t})}),n.createElement(Jt,null),n.createElement(vt,null)))}const X=r.StyleSheet.create({alignTop:{flex:1,justifyContent:"flex-start",alignItems:"flex-start"},grid:{flexDirection:"row",flexWrap:"wrap",paddingTop:4,paddingBottom:16},createJoin:{width:W,height:W,borderRadius:16,alignItems:"center",justifyContent:"center"},createJoinFallback:{fontSize:28,fontWeight:"700",lineHeight:30}}),le=new Map,ae=[];let J=!1;function Kt(e,t,o){le.set(e,{replacement:t,extraProps:o})}function Yt(e,t){ae.push({predicate:e,replacement:t})}function _e(e,t){if(t)for(const{predicate:s,replacement:i}of ae)try{if(s(t))return i?{type:i,props:t}:null}catch{}const o=le.get(e);if(o)return{type:o.replacement,props:o.extraProps?{...t,...o.extraProps}:t}}function Zt(e){if(J)return;const t=c.React.createElement;if(!t){console.warn("[ServerDrawer] React.createElement is null, skipping patch");return}const o=function(a,u,...m){const g=_e(a,u);return g===null?null:g?t.call(c.React,g.type,g.props,...m):t.call(c.React,a,u,...m)};Object.assign(o,t),c.React.createElement=o,J=!0;const s=D(function(a){return typeof a?.jsx=="function"&&typeof a?.jsxs=="function"&&"Fragment"in a}),i=[];if(s)for(const a of["jsx","jsxs"]){const u=s[a];typeof u=="function"&&(s[a]=function(m,g,...b){const p=_e(m,g);return p===null?null:p?u.call(this,p.type,p.props,...b):u.call(this,m,g,...b)},i.push(function(){s[a]=u}))}else console.warn("[ServerDrawer] jsx-runtime module not found, only classic createElement calls will be intercepted");e.push(function(){J&&(c.React.createElement=t,J=!1),i.forEach(function(a){return a()}),le.clear(),ae.length=0})}const ue="[ServerDrawer]";let ce=null;function Ue(){return ce||(ce=D(function(e){return e?.QuestDockGestureContext})?.QuestDockGestureContext??null),ce}function $t(e){const t=D(function(s){return s?.type?.displayName==="QuestDockContentExpanded"||s?.type?.name==="QuestDockContentExpanded"});if(!t?.type)return console.log(ue,"WARN: QuestDockContentExpanded not found (will retry)"),!1;const o=t.type;return Kt(o,Oe,{gestureContext:Ue()}),t.type=function(){return c.React.createElement(Oe,{gestureContext:Ue()})},e.push(function(){t.type=o}),console.log(ue,"PATCH: QuestDockContentExpanded replaced"),!0}function A(e,t){const o=D(function(a){return a?.type?.displayName===e||a?.type?.name===e});if(!o?.type)return console.log(ue,`WARN: ${e} not found`),!1;const s=o.type,i=s;return o.type=function(){return null},i&&(Object.defineProperties(o.type,Object.getOwnPropertyDescriptors(i)),o.type.displayName=e),t.push(function(){o.type=s}),!0}const Nt="[ServerDrawer]";function en(e){return Yt(function(t){return t?.nativeID==="guilds-bar-view"},null),e.push(function(){}),console.log(Nt,"PATCH: guilds-bar-view createElement calls now render nothing"),!0}function tn(e){const t=Ye("ExpandedGuildFolderStore");if(!t?.getExpandedFolders)return!1;const o=function({folderId:s}){if(!f.storage.autoCollapseFolders||s==null)return;const i=t.getExpandedFolders();if(!(!(i instanceof Set)||!i.has(s)))for(const a of i)a!==s&&c.FluxDispatcher.dispatch({type:"TOGGLE_GUILD_FOLDER_EXPAND",folderId:a})};return c.FluxDispatcher.subscribe("TOGGLE_GUILD_FOLDER_EXPAND",o),e.push(function(){return c.FluxDispatcher.unsubscribe("TOGGLE_GUILD_FOLDER_EXPAND",o)}),!0}const{ScrollView:nn,View:on}=c.ReactNative;function rn({children:e}){return c.React.createElement(nn,{style:{flex:1}},e,c.React.createElement(on,{style:{height:24}}))}const{View:sn,Text:ln}=c.ReactNative;function ze({children:e,style:t}){return c.React.createElement(sn,{style:[{marginHorizontal:16,marginVertical:8,padding:10,borderRadius:8,borderWidth:1,borderColor:"rgba(128,128,128,0.25)"},t]},c.React.createElement(ln,{style:{fontSize:12.5,lineHeight:18,opacity:.75}},e))}const{FormSection:We,FormSwitchRow:K}=Ke.Forms;function an(){return $.useProxy(f.storage),c.React.createElement(rn,null,c.React.createElement(ze,null,"Server Drawer takes over the Quest Dock (the strip above the tab bar) to show your servers as a grid instead - tap to expand, long-press a server for its usual context menu, the chat bubble jumps to DMs, the + button creates or joins a server through Discord's own modal, and the check button marks every channel in every server as read."),c.React.createElement(We,{title:"Layout"},c.React.createElement(K,{label:"Hide the left server rail",subLabel:"Your servers and DMs already live in the drawer, so the rail is redundant",value:f.storage.hideGuildsBar!==!1,onValueChange:function(e){f.storage.hideGuildsBar=e,Je()}}),c.React.createElement(K,{label:"Unread badges",subLabel:"Show mention counts and unread dots on server icons in the drawer",value:f.storage.showUnreadBadges!==!1,onValueChange:function(e){f.storage.showUnreadBadges=e}})),c.React.createElement(We,{title:"Folders"},c.React.createElement(K,{label:"Auto-collapse other folders",subLabel:"Opening a folder collapses any other folder that was already open",value:!!f.storage.autoCollapseFolders,onValueChange:function(e){f.storage.autoCollapseFolders=e}}),c.React.createElement(K,{label:"Hide icons in collapsed folders",subLabel:"Show a plain folder icon instead of a 4-server preview",value:!!f.storage.hideFolderIcons,onValueChange:function(e){f.storage.hideFolderIcons=e}})),c.React.createElement(ze,null,"The folder options above are ported from fres621's BetterFolders - its other half (hiding icons in the native left server rail) patched a component that no longer exists in current Discord builds, so it's been rebuilt here instead, where it actually applies to what you see."))}let h=[],k;function un(e,t){try{return t()}catch(o){return Z.logger.error(`[ServerDrawer] "${e}" patch threw, skipping: ${o}`),!1}}function qe(){const e={questDockRender:function(){return Ze(h)},questDockBase:function(){return $e(h)},questDockVisible:function(){return Ne(h)},mobileQuestDock:function(){return et(h)},getQuestAsset:function(){return nt(h)},expanded:function(){return $t(h)},collapsed:function(){return A("QuestDockContentCollapsed",h)},enrolledHeader:function(){return A("QuestDockEnrolledHeader",h)},unenrolledHeader:function(){return A("QuestDockUnenrolledHeader",h)},enrolledBody:function(){return A("QuestDockEnrolledBody",h)},unenrolledBody:function(){return A("QuestDockUnenrolledBody",h)},autoCollapseFolders:function(){return tn(h)},...f.storage.hideGuildsBar?{hideGuildsBar:function(){return en(h)}}:{}};Zt(h);const t=new Set(Object.keys(e)),o=new Set,s=function(){for(const i of t)un(i,e[i])&&(o.add(i),t.delete(i));t.size===0&&k&&(clearInterval(k),k=void 0)};if(s(),t.size>0){let i=0;k=setInterval(function(){s(),++i>=50&&k&&(clearInterval(k),k=void 0,t.size>0&&Z.logger.error(`[ServerDrawer] Gave up waiting on: ${[...t].join(", ")}`))},200)}Z.logger.log(`[ServerDrawer] onLoad: applied immediately - ${[...o].join(", ")||"none"}${t.size?`, still waiting on ${[...t].join(", ")}`:""}`)}function Xe(){k&&(clearInterval(k),k=void 0);for(const e of h)try{e()}catch{}h=[]}function Je(){Xe(),qe()}var cn={onLoad:function(){f.storage.hideGuildsBar??=!0,f.storage.showUnreadBadges??=!0,f.storage.autoCollapseFolders??=!1,f.storage.hideFolderIcons??=!1,qe()},onUnload:function(){return Xe()},settings:an};return Q.default=cn,Q.restart=Je,Object.defineProperty(Q,"__esModule",{value:!0}),Q})({},vendetta,vendetta.plugin,vendetta.metro.common,window.React,vendetta.metro.common.ReactNative,vendetta.metro,vendetta.storage,vendetta.ui.toasts,vendetta.ui,vendetta.ui.assets,vendetta.ui.components); +(function(Q,$,f,c,o,r,l,N,w,M,ee,Ye){"use strict";function I(e){const t=window?.modules;if(t)for(const n in t){const s=t[n];if(!s?.isInitialized)continue;const i=s.publicModule?.exports;if(i)try{if(e(i))return i;if(i.default!=null&&e(i.default))return i.default}catch{}}}function y(...e){return I(function(t){return e.every(function(n){return t?.[n]!==void 0})})}function Ze(e){return I(function(t){return typeof t?.getName=="function"&&t.getName.length===0&&t.getName()===e})}function $e(e){const t=y("useIsMobileQuestDockRendered");if(!t?.useIsMobileQuestDockRendered)return!1;const n=t.useIsMobileQuestDockRendered;return t.useIsMobileQuestDockRendered=function(...s){return n.apply(this,s),!0},e.push(function(){t.useIsMobileQuestDockRendered=n}),!0}function Ne(e){const t=y("useIsMobileQuestDockRenderedBase");if(!t?.useIsMobileQuestDockRenderedBase)return!1;const n=t.useIsMobileQuestDockRenderedBase;return t.useIsMobileQuestDockRenderedBase=function(...s){return n.apply(this,s),!0},e.push(function(){t.useIsMobileQuestDockRenderedBase=n}),!0}function et(e){const t=y("useIsMobileQuestDockVisibleToUser");if(!t?.useIsMobileQuestDockVisibleToUser)return!1;const n=t.useIsMobileQuestDockVisibleToUser;return t.useIsMobileQuestDockVisibleToUser=function(...s){return n.apply(this,s),!0},e.push(function(){t.useIsMobileQuestDockVisibleToUser=n}),!0}function tt(e){const t=y("useMobileQuestDock");if(!t?.useMobileQuestDock)return!1;const n=t.useMobileQuestDock;return t.useMobileQuestDock=function(...s){return n.apply(this,s)||{id:"server-drawer",config:{quest_content_type:0,assets:{questBarHeroVideo:null,questBarHero:null},features:[]},userStatus:{enrolledAt:"2099-01-01",claimedAt:null},benefits:{rewards:[]},guildId:"0",tasks:[]}},e.push(function(){t.useMobileQuestDock=n}),!0}const nt="[ServerDrawer]";function ot(e){const t=y("getQuestAsset");if(!t?.getQuestAsset)return console.log(nt,"WARN: getQuestAsset not found"),!1;const n=t.getQuestAsset;return t.getQuestAsset=function(...s){try{return n.apply(this,s)}catch{return{url:null,isAnimated:!1}}},e.push(function(){t.getQuestAsset=n}),!0}function S(e){let t,n=!1;return function(){if(n)return t;const s=e();return s!=null&&(t=s,n=!0),s??void 0}}const me=l.findByStoreName("GuildStore"),rt=l.findByProps("useStateFromStores"),st=l.findByProps("colors","unsafe_rawColors")?.colors;function be({id:e,size:t=48}){const n=rt?.useStateFromStores?.([me],function(){return me?.getGuild?.(e)},[e])??null;if(!n)return null;const s=t>=40?16:8;return n.icon?o.createElement(r.Image,{source:{uri:`https://cdn.discordapp.com/icons/${n.id}/${n.icon}.png?size=${t*2}`},style:{width:t,height:t,borderRadius:s}}):o.createElement(r.View,{style:[Ce.fallback,{width:t,height:t,borderRadius:s,backgroundColor:st?.BG_ACCENT??"#5865f2"}]},o.createElement(r.Text,{style:[Ce.letter,{fontSize:Math.max(10,t*.4)}]},n.name?.split(" ").map(function(i){return i[0]}).join("").slice(0,2).toUpperCase()||"?"))}const Ce=r.StyleSheet.create({fallback:{alignItems:"center",justifyContent:"center"},letter:{color:"#fff",fontWeight:"700"}}),it=l.findByStoreName("ThemeStore"),lt=l.find(function(e){return e?.default?.internal?.resolveSemanticColor})?.default?.internal?.resolveSemanticColor??l.find(function(e){return e?.meta?.resolveSemanticColor})?.meta?.resolveSemanticColor??function(){};function at(e,t=it?.theme){if(e)try{return lt(t,e)}catch{return}}const Se=l.findByProps("TextStyleSheet")?.TextStyleSheet,ke=l.findByProps("triggerHapticFeedback","HapticFeedbackTypes");function v(e,t){return at(e)??t}const F=12,te=12,Ee=42,ne=220,we=4,x=16,L=20,Ie={tension:200,friction:20};function ut({visible:e,items:t,title:n,anchorX:s,anchorY:i,onClose:a}){const{width:u,height:m}=r.Dimensions.get("window"),g=(n?te+20+we:0)+t.length*Ee;let b=s,p=i+48+10;b+ne>u-F&&(b=u-ne-F),bm-F&&(p=i-g-10),p0?o.createElement(r.View,{style:P.outline},o.createElement(r.View,{style:P.badge},o.createElement(r.Text,{style:P.text},t>99?"99+":String(t)))):n?o.createElement(r.View,{style:P.dotOutline},o.createElement(r.View,{style:P.dot})):null:null}function Fe({node:e,onPick:t}){const n=o.useRef(null),s=o.useRef(new r.Animated.Value(1)).current,i=function(){return r.Animated.spring(s,{toValue:.85,useNativeDriver:!0}).start()},a=function(){return r.Animated.spring(s,{toValue:1,useNativeDriver:!0}).start()},[u,m]=o.useState({visible:!1,items:[],title:"",x:0,y:0}),g=o.useCallback(function(){const E=e.id,d=ct?.getGuild?.(E);if(!d)return;const C=n.current;if(!C?.measure)return;const B=[{label:"Mark as Read",action:function(){return gt(E)}},{label:"Copy Server ID",action:function(){c.clipboard.setString(E),w.showToast("Copied server ID",void 0)}}];C.measure(function(V,H,G,fe,Z,T){m({visible:!0,items:B,title:d.name,x:Z,y:T})})},[e.id]),b=o.useCallback(function(){Re?.triggerHapticFeedback?.(Re.HapticFeedbackTypes.IMPACT_MEDIUM),g()},[g]),p=e.id;return o.createElement(o.Fragment,null,o.createElement(r.Pressable,{onPressIn:i,onPressOut:a,onPress:function(){return t(p)},onLongPress:b,delayLongPress:500},o.createElement(r.View,{ref:n,style:Be.outer,collapsable:!1},o.createElement(r.Animated.View,{style:[Be.icon,{transform:[{scale:s}]}]},o.createElement(be,{id:p})),o.createElement(pt,{guildId:p}))),o.createElement(ut,{visible:u.visible,items:u.items,title:u.title,anchorX:u.x,anchorY:u.y,onClose:function(){return m(function(E){return{...E,visible:!1}})}}))}const Be=r.StyleSheet.create({outer:{width:j,height:j},icon:{width:j,height:j,borderRadius:16,overflow:"hidden"}}),P=r.StyleSheet.create({outline:{position:"absolute",bottom:-3,right:-3,minWidth:23,minHeight:23,borderRadius:12,backgroundColor:"#1a1a2e",alignItems:"center",justifyContent:"center"},badge:{minWidth:19,height:19,borderRadius:9,backgroundColor:"#ed4245",alignItems:"center",justifyContent:"center",paddingHorizontal:5},text:{color:"#fff",fontSize:10,fontWeight:"700",lineHeight:19},dotOutline:{position:"absolute",bottom:-2,right:-2,width:14,height:14,borderRadius:7,backgroundColor:"#1a1a2e",alignItems:"center",justifyContent:"center"},dot:{width:10,height:10,borderRadius:5,backgroundColor:"#ed4245"}}),yt=l.findByProps("useStateFromStores");l.findByProps("colors","unsafe_rawColors")?.colors;const Te=l.findByStoreName("ExpandedGuildFolderStore");function mt(e){return yt?.useStateFromStores?.([Te],function(){const t=Te?.getExpandedFolders?.();return t instanceof Set?t.has(e):!1},[e])??!1}const bt=l.findByProps("toggleGuildFolderExpand"),Ct=l.findByProps("useStateFromStores"),xe=l.findByStoreName("GuildReadStateStore"),D=48,se=16,St=[{top:6,left:6},{top:6,right:6},{bottom:6,left:6},{bottom:6,right:6}],Pe=ee.getAssetIDByName("FolderIcon");function Ae(e){return e==null?"#5865f2":`#${e.toString(16).padStart(6,"0")}`}function kt({node:e}){const t=Ct?.useStateFromStores?.([xe],function(){let n=0;for(const s of e.children)n+=xe?.getMentionCount?.(s.id)??0;return n},[e.children])??0;return t>0?o.createElement(r.View,{style:le.outline},o.createElement(r.View,{style:le.badge},o.createElement(r.Text,{style:le.text},t>99?"99+":String(t)))):null}function Et({node:e}){N.useProxy(f.storage);const t=Ae(e.color);return o.createElement(r.View,{style:_.outer},o.createElement(r.View,{style:[_.icon,{backgroundColor:t}]},f.storage.hideFolderIcons?o.createElement(r.View,{style:_.plainIcon},o.createElement(r.Image,{source:Pe,style:ie.folderImg,tintColor:"#fff"})):e.children.slice(0,4).map(function(n,s){return o.createElement(r.View,{key:n.id,style:[_.cell,St[s]]},o.createElement(be,{id:n.id,size:se}))})),o.createElement(kt,{node:e}))}const _=r.StyleSheet.create({outer:{width:D,height:D},icon:{width:D,height:D,borderRadius:16,overflow:"hidden"},cell:{position:"absolute",width:se,height:se,borderRadius:8,overflow:"hidden"},plainIcon:{width:D,height:D,alignItems:"center",justifyContent:"center"}});function wt({children:e}){const t=o.useRef(new r.Animated.Value(0)).current;return o.useEffect(function(){r.Animated.timing(t,{toValue:1,duration:180,useNativeDriver:!0}).start()},[]),o.createElement(r.Animated.View,{style:{opacity:t}},e)}function It({node:e,onPick:t}){const n=mt(e.id),s=function(){bt?.toggleGuildFolderExpand?.(e.id)};return n?o.createElement(o.Fragment,null,o.createElement(r.Pressable,{onPress:s},o.createElement(r.View,{style:[ie.openIcon,{backgroundColor:Ae(e.color)}]},o.createElement(r.Image,{source:Pe,style:ie.folderImg,tintColor:"#fff"}))),e.children.map(function(i){return o.createElement(wt,{key:i.id},o.createElement(Fe,{node:i,onPick:t}))})):o.createElement(r.Pressable,{onPress:s},o.createElement(Et,{node:e}))}const ie=r.StyleSheet.create({openIcon:{width:D,height:D,borderRadius:16,alignItems:"center",justifyContent:"center"},folderImg:{width:24,height:24}}),le=r.StyleSheet.create({outline:{position:"absolute",bottom:-3,right:-3,minWidth:23,minHeight:23,borderRadius:12,backgroundColor:"#1a1a2e",alignItems:"center",justifyContent:"center"},badge:{minWidth:19,height:19,borderRadius:9,backgroundColor:"#ed4245",alignItems:"center",justifyContent:"center",paddingHorizontal:5},text:{color:"#fff",fontSize:10,fontWeight:"700",lineHeight:19}}),U=48,Dt=ee.getAssetIDByName("ChatIcon"),Ve=l.findByProps("triggerHapticFeedback","HapticFeedbackTypes"),He=l.findByProps("selectPrivateChannel"),Rt=l.findByName("SelectedChannelStore"),Ft=l.findByProps("useStateFromStores"),Ge=l.findByProps("getGuildId"),Bt=l.findByProps("colors","unsafe_rawColors")?.colors;function Tt(){if(Ve?.triggerHapticFeedback(Ve.HapticFeedbackTypes.SOFT),He?.selectPrivateChannel){const e=Rt?.getLastSelectedChannelId?.();He.selectPrivateChannel(e)}}function xt(){const e=Ft?.useStateFromStores?.([Ge],function(){return Ge?.getGuildId?.()==null})??!1;return o.createElement(r.Pressable,{onPress:Tt,style:Qe.outer},o.createElement(r.View,{style:[Qe.icon,{backgroundColor:e?Bt?.BG_ACCENT??"#5865f2":"rgba(128,128,128,0.24)"}]},o.createElement(r.Image,{source:Dt,style:{width:24,height:24,tintColor:"#fff"}})))}const Qe=r.StyleSheet.create({outer:{width:U,height:U},icon:{width:U,height:U,borderRadius:16,alignItems:"center",justifyContent:"center"}}),Me=48,Pt=ee.getAssetIDByName("CheckmarkLargeIcon"),At=l.findByStoreName("SortedGuildStore"),z=l.findByStoreName("GuildChannelStore"),Vt=l.findByStoreName("ChannelStore"),Ht=S(function(){return y("triggerHapticFeedback","HapticFeedbackTypes")}),Gt=S(function(){return y("bulkAck","ackChannel")}),Qt=S(function(){return y("ReadStateTypes","UnreadSetting")?.ReadStateTypes});function Mt(){const e=(At?.getGuildsTree?.()?.root?.children??[]).filter(function(s){return s?.type!=="root"}),t=[],n=function(s){for(const i of s)i.type==="folder"?n(i.children??[]):i.id!=null&&t.push(String(i.id))};return n(e),t}function vt(){const e=Gt(),t=Qt();if(!e?.bulkAck||t?.CHANNEL==null||!z?.getSelectableChannelIds||!z?.getVocalChannelIds){w.showToast("Couldn't find Discord's read-state action - this may be unavailable on your version.",void 0);return}const n=Mt();if(n.length===0){w.showToast("Nothing to mark as read.",void 0);return}const s=[];for(const i of n){const a=[...z.getSelectableChannelIds(i)??[],...z.getVocalChannelIds(i)??[]];for(const u of a)s.push({channelId:u,readStateType:t.CHANNEL,messageId:Vt?.getChannel?.(u)?.lastMessageId??null})}if(s.length===0){w.showToast("Nothing to mark as read.",void 0);return}e.bulkAck(s),w.showToast(`Marked ${s.length} channel${s.length===1?"":"s"} as read`,void 0)}function Lt(){const e=o.useCallback(function(){const t=Ht();t?.triggerHapticFeedback?.(t.HapticFeedbackTypes.SOFT),vt()},[]);return o.createElement(r.Pressable,{onPress:e,style:jt.outer},o.createElement(r.Image,{source:Pt,style:{width:24,height:24,tintColor:"#80848e"}}))}const jt=r.StyleSheet.create({outer:{width:Me,height:Me,alignItems:"center",justifyContent:"center"}}),Ot=l.findByProps("useStateFromStores"),ve=l.findByStoreName("SortedGuildStore"),_t=S(function(){return y("getRootNavigationRef")}),Le=S(function(){return y("triggerHapticFeedback","HapticFeedbackTypes")}),Ut=S(function(){return y("transitionToGuild")}),zt=S(function(){return I(function(e){return typeof e?.handleCreateJoinGuildPress=="function"})}),Wt=S(function(){return I(function(e){return e?.CirclePlusIcon})?.CirclePlusIcon}),qt=S(function(){return y("colors","unsafe_rawColors")?.unsafe_rawColors}),Xt=l.find(function(e){return e?.QuestDockExternalCoordinationContext}),je=Xt?.QuestDockExternalCoordinationContext,Oe=l.find(function(e){return e?.QuestDockMode?.COLLAPSED!=null})?.QuestDockMode,W=48,q=6,Jt=12;function Kt(){const e=o.useRef(new r.Animated.Value(1)).current,t=o.useCallback(function(){r.Animated.spring(e,{toValue:.9,useNativeDriver:!0}).start()},[e]),n=o.useCallback(function(){r.Animated.spring(e,{toValue:1,useNativeDriver:!0}).start()},[e]),s=o.useCallback(function(){const u=Le();u?.triggerHapticFeedback?.(u.HapticFeedbackTypes.SOFT),zt()?.handleCreateJoinGuildPress?.()},[]),i=Wt(),a=qt();return o.createElement(r.Pressable,{onPress:s,onPressIn:t,onPressOut:n},o.createElement(r.Animated.View,{style:[X.createJoin,{backgroundColor:a?.GREEN_360,transform:[{scale:e}]}]},i?o.createElement(i,{size:"md",color:a?.WHITE}):o.createElement(r.Text,{style:[X.createJoinFallback,{color:a?.WHITE}]},"+")))}function _e({gestureContext:e}){const t=o.useCallback(function(d){const C=Le();C?.triggerHapticFeedback?.(C.HapticFeedbackTypes.SOFT);const B=Ut();B?.transitionToGuild?B.transitionToGuild(d):_t()?.getRootNavigationRef?.()?.navigate("guilds",{guildId:d})},[]),n=Ot?.useStateFromStores?.([ve],function(){return(ve?.getGuildsTree()?.root?.children||[]).filter(function(d){return d.type!=="root"})})??[],s=e?o.useContext(e):null,i=s?.minExpandedContentHeight,a=o.useCallback(function(d){if(!i)return;const C=d.nativeEvent.layout.height;i.get()!==C&&i.set(C)},[i]),u=(je?o.useContext(je):null)?.setRestingQuestDockMode,m=s?.questDockWrapperSpecs;o.useEffect(function(){if(!u||!Oe||!m)return;const d=r.BackHandler.addEventListener("hardwareBackPress",function(){return(m.get()?.height??56)>80?(u(Oe.COLLAPSED),!0):!1});return function(){return d.remove()}},[u,m]);const{width:g}=r.Dimensions.get("window"),b=Math.max(3,Math.floor((g-Jt*2+q)/(W+q))),p=b*W+(b-1)*q,E=Math.max(0,(g-p)/2);return o.createElement(r.View,{style:X.alignTop},o.createElement(r.View,{style:[X.grid,{paddingHorizontal:E,gap:q}],onLayout:a},o.createElement(xt,null),n.map(function(d){return d.type==="folder"?o.createElement(It,{key:d.id,node:d,onPick:t}):o.createElement(Fe,{key:d.id,node:d,onPick:t})}),o.createElement(Kt,null),o.createElement(Lt,null)))}const X=r.StyleSheet.create({alignTop:{flex:1,justifyContent:"flex-start",alignItems:"flex-start"},grid:{flexDirection:"row",flexWrap:"wrap",paddingTop:4,paddingBottom:16},createJoin:{width:W,height:W,borderRadius:16,alignItems:"center",justifyContent:"center"},createJoinFallback:{fontSize:28,fontWeight:"700",lineHeight:30}}),ae=new Map,ue=[];let J=[],K=!1;function Yt(e,t,n){ae.set(e,{replacement:t,extraProps:n})}function Zt(e,t){ue.push({predicate:e,replacement:t})}function $t(e){if(J.length===0)return;const t=[];for(const n of J){let s=!1;try{s=n.predicate(e)}catch{}if(s)try{n.onDetected(e)}catch{}else t.push(n)}J=t}function Ue(e,t){if($t(e),t)for(const{predicate:s,replacement:i}of ue)try{if(s(t))return i?{type:i,props:t}:null}catch{}const n=ae.get(e);if(n)return{type:n.replacement,props:n.extraProps?{...t,...n.extraProps}:t}}function Nt(e){if(K)return;const t=c.React.createElement;if(!t){console.warn("[createElementIntercept] React.createElement is null, skipping patch");return}const n=function(a,u,...m){const g=Ue(a,u);return g===null?null:g?t.call(c.React,g.type,g.props,...m):t.call(c.React,a,u,...m)};Object.assign(n,t),c.React.createElement=n,K=!0;const s=I(function(a){return typeof a?.jsx=="function"&&typeof a?.jsxs=="function"&&"Fragment"in a}),i=[];if(s)for(const a of["jsx","jsxs"]){const u=s[a];typeof u=="function"&&(s[a]=function(m,g,...b){const p=Ue(m,g);return p===null?null:p?u.call(this,p.type,p.props,...b):u.call(this,m,g,...b)},i.push(function(){s[a]=u}))}else console.warn("[createElementIntercept] jsx-runtime module not found, only classic createElement calls will be intercepted");e.push(function(){K&&(c.React.createElement=t,K=!1),i.forEach(function(a){return a()}),ae.clear(),ue.length=0,J=[]})}const ce="[ServerDrawer]";let de=null;function ze(){return de||(de=I(function(e){return e?.QuestDockGestureContext})?.QuestDockGestureContext??null),de}function en(e){const t=I(function(s){return s?.type?.displayName==="QuestDockContentExpanded"||s?.type?.name==="QuestDockContentExpanded"});if(!t?.type)return console.log(ce,"WARN: QuestDockContentExpanded not found (will retry)"),!1;const n=t.type;return Yt(n,_e,{gestureContext:ze()}),t.type=function(){return c.React.createElement(_e,{gestureContext:ze()})},e.push(function(){t.type=n}),console.log(ce,"PATCH: QuestDockContentExpanded replaced"),!0}function A(e,t){const n=I(function(a){return a?.type?.displayName===e||a?.type?.name===e});if(!n?.type)return console.log(ce,`WARN: ${e} not found`),!1;const s=n.type,i=s;return n.type=function(){return null},i&&(Object.defineProperties(n.type,Object.getOwnPropertyDescriptors(i)),n.type.displayName=e),t.push(function(){n.type=s}),!0}const tn="[ServerDrawer]";function nn(e){return Zt(function(t){return t?.nativeID==="guilds-bar-view"},null),e.push(function(){}),console.log(tn,"PATCH: guilds-bar-view createElement calls now render nothing"),!0}function on(e){const t=Ze("ExpandedGuildFolderStore");if(!t?.getExpandedFolders)return!1;const n=function({folderId:s}){if(!f.storage.autoCollapseFolders||s==null)return;const i=t.getExpandedFolders();if(!(!(i instanceof Set)||!i.has(s)))for(const a of i)a!==s&&c.FluxDispatcher.dispatch({type:"TOGGLE_GUILD_FOLDER_EXPAND",folderId:a})};return c.FluxDispatcher.subscribe("TOGGLE_GUILD_FOLDER_EXPAND",n),e.push(function(){return c.FluxDispatcher.unsubscribe("TOGGLE_GUILD_FOLDER_EXPAND",n)}),!0}const{ScrollView:rn,View:sn}=c.ReactNative;function ln({children:e}){return c.React.createElement(rn,{style:{flex:1}},e,c.React.createElement(sn,{style:{height:24}}))}const{View:an,Text:un}=c.ReactNative;function We({children:e,style:t}){return c.React.createElement(an,{style:[{marginHorizontal:16,marginVertical:8,padding:10,borderRadius:8,borderWidth:1,borderColor:"rgba(128,128,128,0.25)"},t]},c.React.createElement(un,{style:{fontSize:12.5,lineHeight:18,opacity:.75}},e))}const{FormSection:qe,FormSwitchRow:Y}=Ye.Forms;function cn(){return N.useProxy(f.storage),c.React.createElement(ln,null,c.React.createElement(We,null,"Server Drawer takes over the Quest Dock (the strip above the tab bar) to show your servers as a grid instead - tap to expand, long-press a server for its usual context menu, the chat bubble jumps to DMs, the + button creates or joins a server through Discord's own modal, and the check button marks every channel in every server as read."),c.React.createElement(qe,{title:"Layout"},c.React.createElement(Y,{label:"Hide the left server rail",subLabel:"Your servers and DMs already live in the drawer, so the rail is redundant",value:f.storage.hideGuildsBar!==!1,onValueChange:function(e){f.storage.hideGuildsBar=e,Ke()}}),c.React.createElement(Y,{label:"Unread badges",subLabel:"Show mention counts and unread dots on server icons in the drawer",value:f.storage.showUnreadBadges!==!1,onValueChange:function(e){f.storage.showUnreadBadges=e}})),c.React.createElement(qe,{title:"Folders"},c.React.createElement(Y,{label:"Auto-collapse other folders",subLabel:"Opening a folder collapses any other folder that was already open",value:!!f.storage.autoCollapseFolders,onValueChange:function(e){f.storage.autoCollapseFolders=e}}),c.React.createElement(Y,{label:"Hide icons in collapsed folders",subLabel:"Show a plain folder icon instead of a 4-server preview",value:!!f.storage.hideFolderIcons,onValueChange:function(e){f.storage.hideFolderIcons=e}})),c.React.createElement(We,null,"The folder options above are ported from fres621's BetterFolders - its other half (hiding icons in the native left server rail) patched a component that no longer exists in current Discord builds, so it's been rebuilt here instead, where it actually applies to what you see."))}let h=[],k;function dn(e,t){try{return t()}catch(n){return $.logger.error(`[ServerDrawer] "${e}" patch threw, skipping: ${n}`),!1}}function Xe(){const e={questDockRender:function(){return $e(h)},questDockBase:function(){return Ne(h)},questDockVisible:function(){return et(h)},mobileQuestDock:function(){return tt(h)},getQuestAsset:function(){return ot(h)},expanded:function(){return en(h)},collapsed:function(){return A("QuestDockContentCollapsed",h)},enrolledHeader:function(){return A("QuestDockEnrolledHeader",h)},unenrolledHeader:function(){return A("QuestDockUnenrolledHeader",h)},enrolledBody:function(){return A("QuestDockEnrolledBody",h)},unenrolledBody:function(){return A("QuestDockUnenrolledBody",h)},autoCollapseFolders:function(){return on(h)},...f.storage.hideGuildsBar?{hideGuildsBar:function(){return nn(h)}}:{}};Nt(h);const t=new Set(Object.keys(e)),n=new Set,s=function(){for(const i of t)dn(i,e[i])&&(n.add(i),t.delete(i));t.size===0&&k&&(clearInterval(k),k=void 0)};if(s(),t.size>0){let i=0;k=setInterval(function(){s(),++i>=50&&k&&(clearInterval(k),k=void 0,t.size>0&&$.logger.error(`[ServerDrawer] Gave up waiting on: ${[...t].join(", ")}`))},200)}$.logger.log(`[ServerDrawer] onLoad: applied immediately - ${[...n].join(", ")||"none"}${t.size?`, still waiting on ${[...t].join(", ")}`:""}`)}function Je(){k&&(clearInterval(k),k=void 0);for(const e of h)try{e()}catch{}h=[]}function Ke(){Je(),Xe()}var fn={onLoad:function(){f.storage.hideGuildsBar??=!0,f.storage.showUnreadBadges??=!0,f.storage.autoCollapseFolders??=!1,f.storage.hideFolderIcons??=!1,Xe()},onUnload:function(){return Je()},settings:cn};return Q.default=fn,Q.restart=Ke,Object.defineProperty(Q,"__esModule",{value:!0}),Q})({},vendetta,vendetta.plugin,vendetta.metro.common,window.React,vendetta.metro.common.ReactNative,vendetta.metro,vendetta.storage,vendetta.ui.toasts,vendetta.ui,vendetta.ui.assets,vendetta.ui.components); diff --git a/server-drawer/install/manifest.json b/server-drawer/install/manifest.json index 8860a49..99b5df3 100644 --- a/server-drawer/install/manifest.json +++ b/server-drawer/install/manifest.json @@ -1 +1 @@ -{"name":"ServerDrawer","description":"Replaces the Quest Dock with a server grid drawer above the YouBar - tap to expand, long-press a server for its context menu, plus a one-tap create/join button.","authors":[{"name":"everestmcarthur"},{"name":"kmmiio99o"},{"name":"fres"}],"main":"index.js","vendetta":{"icon":"ServerIcon"},"hash":"14169a67d3a37e0dd49f4b00b085b87bceac665390098d57f709e2d6b18bf1ff"} \ No newline at end of file +{"name":"ServerDrawer","description":"Replaces the Quest Dock with a server grid drawer above the YouBar - tap to expand, long-press a server for its context menu, plus a one-tap create/join button.","authors":[{"name":"everestmcarthur"},{"name":"kmmiio99o"},{"name":"fres"}],"main":"index.js","vendetta":{"icon":"ServerIcon"},"hash":"450fd93a00b2ffc311da74935967fca2504aeb5d35cb490b6814202c33d48d5c"} \ No newline at end of file diff --git a/you-bar-plus/install/index.js b/you-bar-plus/install/index.js index 2260fea..e02610c 100644 --- a/you-bar-plus/install/index.js +++ b/you-bar-plus/install/index.js @@ -1 +1 @@ -(function(d,b,i,h,r,B,p,v,R){"use strict";function S(t,e,o,a){try{return o()}catch(n){return a.error(`[${t}] Failed to apply the "${e}" patch, that surface will be skipped: ${n}`),function(){}}}function E(t,e,o){const a=Object.entries(o).map(function([n,u]){return S(t,n,u,e)});return function(){return a.forEach(function(n){return n()})}}function I(t,e,o=100){let a=!1,n;const u=t();return u?(e(u),{cancel(){}}):(n=setInterval(function(){if(a)return;const l=t();l&&(a=!0,clearInterval(n),e(l))},o),{cancel(){a=!0,n&&clearInterval(n)}})}function P(t){const e=window?.modules;if(e)for(const o in e){const a=e[o];if(!a?.isInitialized)continue;const n=a.publicModule?.exports;if(n)try{if(t(n))return n;if(n.default!=null&&t(n.default))return n.default}catch{}}}function D(t){return P(function(e){return e?.name===t||e?.displayName===t||e?.type?.name===t||e?.type?.displayName===t})}let c=function(){};function F(){let t=function(){};const e=I(function(){return D("YouBarNotificationsButton")},function(o){t=M(o)});return function(){e.cancel(),t()}}function M(t){const e=h.findByProps("openUserSettings"),o=h.findByProps("transitionToGuild"),a=p.getAssetIDByName("ChatIcon"),n=p.getAssetIDByName("SettingsIcon");return B.instead("type",t,function(u,l){const[,A]=r.React.useReducer(function(L){return~L},0);c=function(){return A()};const s=l(...u);if(!s?.props?.children)return s;const w=s.props.children.type,f=s.props.children.props;return r.React.createElement(r.React.Fragment,null,i.storage.showDMButton&&r.React.createElement(w,{variant:f?.variant||"tertiary",size:f?.size||"sm",icon:a,onPress:function(){o?.transitionToGuild?.("@me")}}),i.storage.showSettingsButton&&r.React.createElement(w,{variant:f?.variant||"tertiary",size:f?.size||"sm",icon:n,onPress:function(){e?.openUserSettings?.()}}),s)})}const{ScrollView:m,View:N}=r.ReactNative;function Y({children:t}){return r.React.createElement(m,{style:{flex:1}},t,r.React.createElement(N,{style:{height:24}}))}const{View:z,Text:V}=r.ReactNative;function $({children:t,style:e}){return r.React.createElement(z,{style:[{marginHorizontal:16,marginVertical:8,padding:10,borderRadius:8,borderWidth:1,borderColor:"rgba(128,128,128,0.25)"},e]},r.React.createElement(V,{style:{fontSize:12.5,lineHeight:18,opacity:.75}},t))}const{FormSection:x,FormSwitchRow:y}=R.Forms;function C(){return v.useProxy(i.storage),r.React.useEffect(function(){return function(){return c()}},[]),r.React.createElement(Y,null,r.React.createElement($,null,"Fork of Purple-EyeZ's YouBar+, ported to Revenge's Vendetta-compat API, with a fix for a startup race where Metro hadn't always registered the YouBar component yet by the time this patch ran - if you toggle this on while Discord's already running, the buttons should still appear without a restart once they mount, but a fresh reload is the most reliable way to see them."),r.React.createElement(x,{title:"Buttons"},r.React.createElement(y,{label:"Direct Messages button",subLabel:"Show the DM button in the YouBar",value:!!i.storage.showDMButton,onValueChange:function(t){i.storage.showDMButton=t,c()}}),r.React.createElement(y,{label:"Settings button",subLabel:"Show the Settings button in the YouBar",value:!!i.storage.showSettingsButton,onValueChange:function(t){i.storage.showSettingsButton=t,c()}})))}let g=function(){};var T={onLoad:function(){i.storage.showDMButton??=!1,i.storage.showSettingsButton??=!0,g=E("YouBar+",b.logger,{"YouBar buttons":F})},onUnload:function(){return g()},settings:C};return d.default=T,Object.defineProperty(d,"__esModule",{value:!0}),d})({},vendetta,vendetta.plugin,vendetta.metro,vendetta.metro.common,vendetta.patcher,vendetta.ui.assets,vendetta.storage,vendetta.ui.components); +(function(g,N,s,B,c,x,w,D,I){"use strict";function P(t,e,o,a){try{return o()}catch(n){return a.error(`[${t}] Failed to apply the "${e}" patch, that surface will be skipped: ${n}`),function(){}}}function Y(t,e,o){const a=Object.entries(o).map(function([n,r]){return P(t,n,r,e)});return function(){return a.forEach(function(n){return n()})}}function F(t,e,o=100){let a=!1,n;const r=t();return r?(e(r),{cancel(){}}):(n=setInterval(function(){if(a)return;const i=t();i&&(a=!0,clearInterval(n),e(i))},o),{cancel(){a=!0,n&&clearInterval(n)}})}function R(t){const e=window?.modules;if(e)for(const o in e){const a=e[o];if(!a?.isInitialized)continue;const n=a.publicModule?.exports;if(n)try{if(t(n))return n;if(n.default!=null&&t(n.default))return n.default}catch{}}}function M(t){return R(function(e){return e?.name===t||e?.displayName===t||e?.type?.name===t||e?.type?.displayName===t})}const E=new Map,b=[];let p=[],d=!1;function j(t,e){p.push({predicate:t,onDetected:e})}function z(t){if(p.length===0)return;const e=[];for(const o of p){let a=!1;try{a=o.predicate(t)}catch{}if(a)try{o.onDetected(t)}catch{}else e.push(o)}p=e}function v(t,e){if(z(t),e)for(const{predicate:a,replacement:n}of b)try{if(a(e))return n?{type:n,props:e}:null}catch{}const o=E.get(t);if(o)return{type:o.replacement,props:o.extraProps?{...e,...o.extraProps}:e}}function V(t){if(d)return;const e=c.React.createElement;if(!e){console.warn("[createElementIntercept] React.createElement is null, skipping patch");return}const o=function(r,i,...f){const u=v(r,i);return u===null?null:u?e.call(c.React,u.type,u.props,...f):e.call(c.React,r,i,...f)};Object.assign(o,e),c.React.createElement=o,d=!0;const a=R(function(r){return typeof r?.jsx=="function"&&typeof r?.jsxs=="function"&&"Fragment"in r}),n=[];if(a)for(const r of["jsx","jsxs"]){const i=a[r];typeof i=="function"&&(a[r]=function(f,u,...h){const l=v(f,u);return l===null?null:l?i.call(this,l.type,l.props,...h):i.call(this,f,u,...h)},n.push(function(){a[r]=i}))}else console.warn("[createElementIntercept] jsx-runtime module not found, only classic createElement calls will be intercepted");t.push(function(){d&&(c.React.createElement=e,d=!1),n.forEach(function(r){return r()}),E.clear(),b.length=0,p=[]})}let y=function(){};function $(t){return t?.name==="YouBarNotificationsButton"||t?.displayName==="YouBarNotificationsButton"||t?.type?.name==="YouBarNotificationsButton"||t?.type?.displayName==="YouBarNotificationsButton"}function C(){const t=[];let e=function(){},o=null;function a(r){!r||r===o||(o=r,e=T(r))}V(t),j($,a);const n=F(function(){return M("YouBarNotificationsButton")},a);return t.push(function(){return n.cancel()}),function(){e(),t.forEach(function(r){return r()})}}function T(t){const e=B.findByProps("openUserSettings"),o=B.findByProps("transitionToGuild"),a=w.getAssetIDByName("ChatIcon"),n=w.getAssetIDByName("SettingsIcon");return x.instead("type",t,function(r,i){try{const[,f]=c.React.useReducer(function(Z){return~Z},0);y=function(){return f()};const u=i(...r);if(!u?.props?.children)return u;const h=u.props.children.type,l=u.props.children.props;return c.React.createElement(c.React.Fragment,null,s.storage.showDMButton&&c.React.createElement(h,{variant:l?.variant||"tertiary",size:l?.size||"sm",icon:a,onPress:function(){return o?.transitionToGuild?.("@me")}}),s.storage.showSettingsButton&&c.React.createElement(h,{variant:l?.variant||"tertiary",size:l?.size||"sm",icon:n,onPress:function(){return e?.openUserSettings?.()}}),u)}catch{return i(...r)}})}const{ScrollView:k,View:A}=c.ReactNative;function L({children:t}){return c.React.createElement(k,{style:{flex:1}},t,c.React.createElement(A,{style:{height:24}}))}const{View:O,Text:U}=c.ReactNative;function G({children:t,style:e}){return c.React.createElement(O,{style:[{marginHorizontal:16,marginVertical:8,padding:10,borderRadius:8,borderWidth:1,borderColor:"rgba(128,128,128,0.25)"},e]},c.React.createElement(U,{style:{fontSize:12.5,lineHeight:18,opacity:.75}},t))}const{FormSection:H,FormSwitchRow:m}=I.Forms;function _(){return D.useProxy(s.storage),c.React.useEffect(function(){return function(){return y()}},[]),c.React.createElement(L,null,c.React.createElement(G,null,"Fork of Purple-EyeZ's YouBar+, ported to Revenge's Vendetta-compat API, with a fix for a startup race where Metro hadn't always registered the YouBar component yet by the time this patch ran - if you toggle this on while Discord's already running, the buttons should still appear without a restart once they mount, but a fresh reload is the most reliable way to see them."),c.React.createElement(H,{title:"Buttons"},c.React.createElement(m,{label:"Direct Messages button",subLabel:"Show the DM button in the YouBar",value:!!s.storage.showDMButton,onValueChange:function(t){s.storage.showDMButton=t,y()}}),c.React.createElement(m,{label:"Settings button",subLabel:"Show the Settings button in the YouBar",value:!!s.storage.showSettingsButton,onValueChange:function(t){s.storage.showSettingsButton=t,y()}})))}let S=function(){};var W={onLoad:function(){s.storage.showDMButton??=!1,s.storage.showSettingsButton??=!0,S=Y("YouBar+",N.logger,{"YouBar buttons":C})},onUnload:function(){return S()},settings:_};return g.default=W,Object.defineProperty(g,"__esModule",{value:!0}),g})({},vendetta,vendetta.plugin,vendetta.metro,vendetta.metro.common,vendetta.patcher,vendetta.ui.assets,vendetta.storage,vendetta.ui.components); diff --git a/you-bar-plus/install/manifest.json b/you-bar-plus/install/manifest.json index 1e4e6a8..76db8d9 100644 --- a/you-bar-plus/install/manifest.json +++ b/you-bar-plus/install/manifest.json @@ -1 +1 @@ -{"name":"YouBar+","description":"Adds Settings and DM buttons to the YouBar. Toggling while Discord's already running may need one reload to take effect.","authors":[{"name":"everestmcarthur"},{"name":"Purple_Ξye™"}],"main":"index.js","hash":"13f3ee0a1bd3993a59d1a2b782ffb9833c8f02910074ba6e1ceb333a4d89d9b2"} \ No newline at end of file +{"name":"YouBar+","description":"Adds Settings and DM buttons to the YouBar. Toggling while Discord's already running may need one reload to take effect.","authors":[{"name":"everestmcarthur"},{"name":"Purple_Ξye™"}],"main":"index.js","hash":"098a6fbb641bbe0bba5d5684e357b90dca830a26be7875375384ebe46a2be7ed"} \ No newline at end of file