From 1ca396b6270497af7e6f3bc3450495c307ff2146 Mon Sep 17 00:00:00 2001 From: everestmcarthur Date: Sun, 2 Aug 2026 14:48:30 +0000 Subject: [PATCH] deploy: f1dd4e515f0cd136325eb6aa2a1c47f01f6349c8 --- server-drawer/install/index.js | 2 +- server-drawer/install/manifest.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/server-drawer/install/index.js b/server-drawer/install/index.js index de17eff..6a6cf8d 100644 --- a/server-drawer/install/index.js +++ b/server-drawer/install/index.js @@ -1 +1 @@ -(function(O,te,h,c,r,i,ne,I,M,re,We){"use strict";function m(e){const t=window?.modules;if(t)for(const n in t){const o=t[n];if(!o?.isInitialized)continue;const l=o.publicModule?.exports;if(l)try{if(e(l))return l;if(l.default!=null&&e(l.default))return l.default}catch{}}}function Qe(e){return m(function(t){return t?.name===e||t?.displayName===e})}function x(...e){return m(function(t){return e.every(function(n){return typeof t?.[n]=="function"})})}function z(e){const t=Object.keys(e);return m(function(n){return t.every(function(o){try{return e[o](n?.[o])}catch{return!1}})})}function b(e){return m(function(t){return typeof t?.getName=="function"&&t.getName.length===0&&t.getName()===e})}function qe(e,t,n=100){let o=!1,l;const s=e();return s?(t(s),{cancel(){}}):(l=setInterval(function(){if(o)return;const a=e();a&&(o=!0,clearInterval(l),t(a))},n),{cancel(){o=!0,l&&clearInterval(l)}})}const oe=new Map,Ce=[],ie=[];let G=[],U=!1;function Ee(e,t,n){oe.set(e,{replacement:t,extraProps:n})}function Je(e,t){ie.push({predicate:e,transform:t})}function Xe(e,t){G.push({predicate:e,onDetected:t})}function Ye(e){if(G.length===0)return;const t=[];for(const n of G){let o=!1;try{o=n.predicate(e)}catch{}if(o)try{n.onDetected(e)}catch{}else t.push(n)}G=t}function we(e,t){Ye(e);let n=t;if(n)for(const{predicate:l,transform:s}of ie)try{l(n)&&(n=s(n))}catch{}if(n)for(const{predicate:l,replacement:s}of Ce)try{if(l(n))return s?{type:s,props:n}:null}catch{}const o=oe.get(e);if(o)return{type:o.replacement,props:o.extraProps?{...n,...o.extraProps}:n};if(n!==t)return{type:e,props:n}}function Ke(e){if(U)return;const t=c.React.createElement;if(!t){console.warn("[ServerDrawer] React.createElement is null, skipping patch");return}const n=function(s,a,...g){const p=we(s,a);return p===null?null:p?t.call(c.React,p.type,p.props,...g):t.call(c.React,s,a,...g)};Object.assign(n,t),c.React.createElement=n,U=!0;const o=[],l=qe(function(){return m(function(s){return typeof s?.jsx=="function"&&typeof s?.jsxs=="function"&&"Fragment"in s})},function(s){for(const a of["jsx","jsxs"]){const g=s[a];typeof g=="function"&&(s[a]=function(p,S,...y){const d=we(p,S);return d===null?null:d?g.call(this,d.type,d.props,...y):g.call(this,p,S,...y)},o.push(function(){s[a]=g}))}});e.push(function(){l.cancel(),U&&(c.React.createElement=t,U=!1),o.forEach(function(s){return s()}),oe.clear(),Ce.length=0,ie.length=0,G=[]})}const Ze="[ServerDrawer]";function $e(e){return Je(function(t){const n=t?.value;return!!(n&&typeof n=="object"&&"isRendered"in n&&"isVisibleToUser"in n&&"quest"in n)},function(t){const n=t.value,o=n.quest??Ne();return{...t,value:{...n,isRendered:!0,isVisibleToUser:!0,quest:et(o)}}}),e.push(function(){}),console.log(Ze,"PATCH: watching for the Quest Dock coordination context"),!0}function Ne(){return{id:"server-drawer",config:{quest_content_type:0,assets:{questBarHeroVideo:"",questBarHero:""},features:[]},userStatus:{enrolledAt:"2099-01-01",claimedAt:null},benefits:{rewards:[]},guildId:"0",tasks:[]}}function et(e){const t=e?.config?.assets;if(!t)return e;const n=t.questBarHero,o=t.questBarHeroVideo;return n!=null&&o!=null?e:{...e,config:{...e.config,assets:{...t,questBarHero:n??"",questBarHeroVideo:o??""}}}}function u(e){let t,n=!1;return function(){if(n)return t;const o=e();return o!=null&&(t=o,n=!0),o??void 0}}const A=u(function(){return x("useStateFromStores")}),H=u(function(){return z({triggerHapticFeedback:function(e){return typeof e=="function"},HapticFeedbackTypes:function(e){return e?.SOFT!==void 0}})}),le=u(function(){return z({colors:function(e){return e?.BG_ACCENT!==void 0},unsafe_rawColors:function(e){return e?.WHITE!==void 0}})}),Se=u(function(){return x("bulkAck","ackChannel")}),ke=u(function(){return z({ReadStateTypes:function(e){return e?.CHANNEL!==void 0},UnreadSetting:function(e){return e?.ALL_MESSAGES!==void 0}})}),tt=u(function(){return b("GuildStore")});function Ie({id:e,size:t=48}){const n=A(),o=tt(),l=le()?.colors,s=n?.useStateFromStores?.([o],function(){return o?.getGuild?.(e)},[e])??null;if(!s)return null;const a=t>=40?16:8;return s.icon?r.createElement(i.Image,{source:{uri:`https://cdn.discordapp.com/icons/${s.id}/${s.icon}.png?size=${t*2}`},style:{width:t,height:t,borderRadius:a}}):r.createElement(i.View,{style:[Re.fallback,{width:t,height:t,borderRadius:a,backgroundColor:l?.BG_ACCENT??"#5865f2"}]},r.createElement(i.Text,{style:[Re.letter,{fontSize:Math.max(10,t*.4)}]},s.name?.split(" ").map(function(g){return g[0]}).join("").slice(0,2).toUpperCase()||"?"))}const Re=i.StyleSheet.create({fallback:{alignItems:"center",justifyContent:"center"},letter:{color:"#fff",fontWeight:"700"}}),nt=u(function(){return b("ThemeStore")}),rt=u(function(){return m(function(e){return e?.default?.internal?.resolveSemanticColor})?.default?.internal?.resolveSemanticColor??m(function(e){return e?.meta?.resolveSemanticColor})?.meta?.resolveSemanticColor});function ot(e,t=nt()?.theme){if(e)try{return rt()?.(t,e)}catch{return}}const it=u(function(){return z({TextStyleSheet:function(e){return e?.["text-md/bold"]!==void 0}})?.TextStyleSheet});function W(e,t){return ot(e)??t}const T=12,se=12,Fe=42,ae=220,De=4,v=16,Q=20,xe={tension:200,friction:20};function lt({visible:e,items:t,title:n,anchorX:o,anchorY:l,onClose:s}){const a=it(),g=H(),{width:p,height:S}=i.Dimensions.get("window"),y=(n?se+20+De:0)+t.length*Fe;let d=o,E=l+48+10;d+ae>p-T&&(d=p-ae-T),dS-T&&(E=l-y-10),E0?r.createElement(i.View,{style:_.outline},r.createElement(i.View,{style:_.badge},r.createElement(i.Text,{style:_.text},o>99?"99+":String(o)))):l?r.createElement(i.View,{style:_.dotOutline},r.createElement(i.View,{style:_.dot})):null:null}function Te({node:e,onPick:t}){const n=r.useRef(null),o=r.useRef(new i.Animated.Value(1)).current,l=function(){return i.Animated.spring(o,{toValue:.85,useNativeDriver:!0}).start()},s=function(){return i.Animated.spring(o,{toValue:1,useNativeDriver:!0}).start()},[a,g]=r.useState({visible:!1,items:[],title:"",x:0,y:0}),p=r.useCallback(function(){const d=e.id,E=ct()?.getGuild?.(d);if(!E)return;const B=n.current;if(!B?.measure)return;const V=[{label:"Mark as Read",action:function(){return ht(d)}},{label:"Copy Server ID",action:function(){c.clipboard.setString(d),I.showToast("Copied server ID",void 0)}}];B.measure(function(f,k,F,j,P,N){g({visible:!0,items:V,title:E.name,x:P,y:N})})},[e.id]),S=r.useCallback(function(){const d=H();d?.triggerHapticFeedback?.(d.HapticFeedbackTypes.IMPACT_MEDIUM),p()},[p]),y=e.id;return r.createElement(r.Fragment,null,r.createElement(i.Pressable,{onPressIn:l,onPressOut:s,onPress:function(){return t(y)},onLongPress:S,delayLongPress:500},r.createElement(i.View,{ref:n,style:Ve.outer,collapsable:!1},r.createElement(i.Animated.View,{style:[Ve.icon,{transform:[{scale:o}]}]},r.createElement(Ie,{id:y})),r.createElement(gt,{guildId:y}))),r.createElement(lt,{visible:a.visible,items:a.items,title:a.title,anchorX:a.x,anchorY:a.y,onClose:function(){return g(function(d){return{...d,visible:!1}})}}))}const Ve=i.StyleSheet.create({outer:{width:q,height:q},icon:{width:q,height:q,borderRadius:16,overflow:"hidden"}}),_=i.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=u(function(){return b("ExpandedGuildFolderStore")});function mt(e){const t=A(),n=pt();return t?.useStateFromStores?.([n],function(){const o=n?.getExpandedFolders?.();return o instanceof Set?o.has(e):!1},[e])??!1}const yt=u(function(){return x("toggleGuildFolderExpand")}),bt=u(function(){return b("GuildReadStateStore")}),R=48,ce=16,Ct=[{top:6,left:6},{top:6,right:6},{bottom:6,left:6},{bottom:6,right:6}],Ae=re.getAssetIDByName("FolderIcon");function He(e){return e==null?"#5865f2":`#${e.toString(16).padStart(6,"0")}`}function Et({node:e}){const t=A(),n=bt(),o=t?.useStateFromStores?.([n],function(){let l=0;for(const s of e.children)l+=n?.getMentionCount?.(s.id)??0;return l},[e.children])??0;return o>0?r.createElement(i.View,{style:fe.outline},r.createElement(i.View,{style:fe.badge},r.createElement(i.Text,{style:fe.text},o>99?"99+":String(o)))):null}function wt({node:e}){ne.useProxy(h.storage);const t=He(e.color);return r.createElement(i.View,{style:J.outer},r.createElement(i.View,{style:[J.icon,{backgroundColor:t}]},h.storage.hideFolderIcons?r.createElement(i.View,{style:J.plainIcon},r.createElement(i.Image,{source:Ae,style:de.folderImg,tintColor:"#fff"})):e.children.slice(0,4).map(function(n,o){return r.createElement(i.View,{key:n.id,style:[J.cell,Ct[o]]},r.createElement(Ie,{id:n.id,size:ce}))})),r.createElement(Et,{node:e}))}const J=i.StyleSheet.create({outer:{width:R,height:R},icon:{width:R,height:R,borderRadius:16,overflow:"hidden"},cell:{position:"absolute",width:ce,height:ce,borderRadius:8,overflow:"hidden"},plainIcon:{width:R,height:R,alignItems:"center",justifyContent:"center"}});function St({children:e}){const t=r.useRef(new i.Animated.Value(0)).current;return r.useEffect(function(){i.Animated.timing(t,{toValue:1,duration:180,useNativeDriver:!0}).start()},[]),r.createElement(i.Animated.View,{style:{opacity:t}},e)}function kt({node:e,onPick:t}){const n=mt(e.id),o=function(){yt()?.toggleGuildFolderExpand?.(e.id)};return n?r.createElement(r.Fragment,null,r.createElement(i.Pressable,{onPress:o},r.createElement(i.View,{style:[de.openIcon,{backgroundColor:He(e.color)}]},r.createElement(i.Image,{source:Ae,style:de.folderImg,tintColor:"#fff"}))),e.children.map(function(l){return r.createElement(St,{key:l.id},r.createElement(Te,{node:l,onPick:t}))})):r.createElement(i.Pressable,{onPress:o},r.createElement(wt,{node:e}))}const de=i.StyleSheet.create({openIcon:{width:R,height:R,borderRadius:16,alignItems:"center",justifyContent:"center"},folderImg:{width:24,height:24}}),fe=i.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}}),X=48,It=re.getAssetIDByName("ChatIcon"),Rt=u(function(){return x("selectPrivateChannel")}),Ft=u(function(){return Qe("SelectedChannelStore")}),Dt=u(function(){return x("getGuildId")});function xt(){const e=H();e?.triggerHapticFeedback?.(e.HapticFeedbackTypes.SOFT);const t=Rt();if(t?.selectPrivateChannel){const n=Ft()?.getLastSelectedChannelId?.();t.selectPrivateChannel(n)}}function Tt(){const e=A(),t=Dt(),n=le()?.colors,o=e?.useStateFromStores?.([t],function(){return t?.getGuildId?.()==null})??!1;return r.createElement(i.Pressable,{onPress:xt,style:Be.outer},r.createElement(i.View,{style:[Be.icon,{backgroundColor:o?n?.BG_ACCENT??"#5865f2":"rgba(128,128,128,0.24)"}]},r.createElement(i.Image,{source:It,style:{width:24,height:24,tintColor:"#fff"}})))}const Be=i.StyleSheet.create({outer:{width:X,height:X},icon:{width:X,height:X,borderRadius:16,alignItems:"center",justifyContent:"center"}}),Pe=48,Vt=re.getAssetIDByName("CheckmarkLargeIcon"),At=Se,Ht=u(function(){return ke()?.ReadStateTypes}),Bt=u(function(){return b("SortedGuildStore")}),Pt=u(function(){return b("GuildChannelStore")}),Gt=u(function(){return b("ChannelStore")});function vt(){const e=(Bt()?.getGuildsTree?.()?.root?.children??[]).filter(function(o){return o?.type!=="root"}),t=[],n=function(o){for(const l of o)l.type==="folder"?n(l.children??[]):l.id!=null&&t.push(String(l.id))};return n(e),t}function _t(){const e=At(),t=Ht(),n=Pt(),o=Gt();if(!e?.bulkAck||t?.CHANNEL==null||!n?.getSelectableChannelIds||!n?.getVocalChannelIds){I.showToast("Couldn't find Discord's read-state action - this may be unavailable on your version.",void 0);return}const l=vt();if(l.length===0){I.showToast("Nothing to mark as read.",void 0);return}const s=[];for(const a of l){const g=[...n.getSelectableChannelIds(a)??[],...n.getVocalChannelIds(a)??[]];for(const p of g)s.push({channelId:p,readStateType:t.CHANNEL,messageId:o?.getChannel?.(p)?.lastMessageId??null})}if(s.length===0){I.showToast("Nothing to mark as read.",void 0);return}e.bulkAck(s),I.showToast(`Marked ${s.length} channel${s.length===1?"":"s"} as read`,void 0)}function Lt(){const e=r.useCallback(function(){const t=H();t?.triggerHapticFeedback?.(t.HapticFeedbackTypes.SOFT),_t()},[]);return r.createElement(i.Pressable,{onPress:e,style:jt.outer},r.createElement(i.Image,{source:Vt,style:{width:24,height:24,tintColor:"#80848e"}}))}const jt=i.StyleSheet.create({outer:{width:Pe,height:Pe,alignItems:"center",justifyContent:"center"}}),Ot=u(function(){return x("getRootNavigationRef")}),Mt=u(function(){return x("transitionToGuild")}),zt=u(function(){return m(function(e){return typeof e?.handleCreateJoinGuildPress=="function"})}),Ut=u(function(){return m(function(e){return e?.CirclePlusIcon})?.CirclePlusIcon}),Wt=u(function(){return m(function(e){return e?.QuestDockExternalCoordinationContext})?.QuestDockExternalCoordinationContext}),Qt=u(function(){return m(function(e){return e?.QuestDockMode?.COLLAPSED!=null})?.QuestDockMode}),qt=u(function(){return m(function(e){return typeof e?.getName=="function"&&e.getName.length===0&&e.getName()==="SortedGuildStore"})}),Y=48,K=6,Jt=12;function Xt(){const e=r.useRef(new i.Animated.Value(1)).current,t=r.useCallback(function(){i.Animated.spring(e,{toValue:.9,useNativeDriver:!0}).start()},[e]),n=r.useCallback(function(){i.Animated.spring(e,{toValue:1,useNativeDriver:!0}).start()},[e]),o=r.useCallback(function(){const a=H();a?.triggerHapticFeedback?.(a.HapticFeedbackTypes.SOFT),zt()?.handleCreateJoinGuildPress?.()},[]),l=Ut(),s=le()?.unsafe_rawColors;return r.createElement(i.Pressable,{onPress:o,onPressIn:t,onPressOut:n},r.createElement(i.Animated.View,{style:[Z.createJoin,{backgroundColor:s?.GREEN_360,transform:[{scale:e}]}]},l?r.createElement(l,{size:"md",color:s?.WHITE}):r.createElement(i.Text,{style:[Z.createJoinFallback,{color:s?.WHITE}]},"+")))}function Ge({gestureContext:e}){const t=r.useCallback(function(f){const k=H();k?.triggerHapticFeedback?.(k.HapticFeedbackTypes.SOFT);const F=Mt();F?.transitionToGuild?F.transitionToGuild(f):Ot()?.getRootNavigationRef?.()?.navigate("guilds",{guildId:f})},[]),n=A(),o=qt(),l=n?.useStateFromStores?.([o],function(){return(o?.getGuildsTree()?.root?.children||[]).filter(function(f){return f.type!=="root"})})??[],s=e?r.useContext(e):null,a=s?.minExpandedContentHeight,g=r.useCallback(function(f){if(!a)return;const k=f.nativeEvent.layout.height;a.get()!==k&&a.set(k)},[a]),p=Wt(),S=(p?r.useContext(p):null)?.setRestingQuestDockMode,y=s?.questDockWrapperSpecs;r.useEffect(function(){const f=Qt();if(!S||!f||!y)return;const k=i.BackHandler.addEventListener("hardwareBackPress",function(){return(y.get()?.height??56)>80?(S(f.COLLAPSED),!0):!1});return function(){return k.remove()}},[S,y]);const{width:d}=i.Dimensions.get("window"),E=Math.max(3,Math.floor((d-Jt*2+K)/(Y+K))),B=E*Y+(E-1)*K,V=Math.max(0,(d-B)/2);return r.createElement(i.View,{style:Z.alignTop},r.createElement(i.View,{style:[Z.grid,{paddingHorizontal:V,gap:K}],onLayout:g},r.createElement(Tt,null),l.map(function(f){return f.type==="folder"?r.createElement(kt,{key:f.id,node:f,onPick:t}):r.createElement(Te,{key:f.id,node:f,onPick:t})}),r.createElement(Xt,null),r.createElement(Lt,null)))}const Z=i.StyleSheet.create({alignTop:{flex:1,justifyContent:"flex-start",alignItems:"flex-start"},grid:{flexDirection:"row",flexWrap:"wrap",paddingTop:4,paddingBottom:16},createJoin:{width:Y,height:Y,borderRadius:16,alignItems:"center",justifyContent:"center"},createJoinFallback:{fontSize:28,fontWeight:"700",lineHeight:30}}),he="[ServerDrawer]";let ge=null;function ve(){return ge||(ge=m(function(e){return e?.QuestDockGestureContext})?.QuestDockGestureContext??null),ge}function Yt(e){const t=m(function(o){return o?.type?.displayName==="QuestDockContentExpanded"||o?.type?.name==="QuestDockContentExpanded"});if(!t?.type)return console.log(he,"WARN: QuestDockContentExpanded not found (will retry)"),!1;const n=t.type;return Ee(n,Ge,{gestureContext:ve()}),t.type=function(){return c.React.createElement(Ge,{gestureContext:ve()})},e.push(function(){t.type=n}),console.log(he,"PATCH: QuestDockContentExpanded replaced"),!0}function L(e,t){const n=m(function(s){return s?.type?.displayName===e||s?.type?.name===e});if(!n?.type)return console.log(he,`WARN: ${e} not found`),!1;const o=n.type,l=o;return n.type=function(){return null},l&&(Object.defineProperties(n.type,Object.getOwnPropertyDescriptors(l)),n.type.displayName=e),t.push(function(){n.type=o}),!0}const _e="[ServerDrawer]";function Kt(e){if(e)try{let t=null;if(e._internalFiberInstanceHandleDEV)t=e._internalFiberInstanceHandleDEV;else if(e._internalInstanceHandle)t=e._internalInstanceHandle;else if(e.__internalInstanceHandle)t=e.__internalInstanceHandle;else{const l=Object.keys(e).find(function(s){return s.startsWith("__reactFiber$")||s.startsWith("__reactInternalInstance$")});l&&(t=e[l])}if(!t)return;if(t.return===void 0&&t.child===void 0){const l=t.stateNode??t.fiber??t._debugOwner;if(l&&(l.return!==void 0||l.child!==void 0))t=l;else return}let n=t,o=0;for(;n.return&&o<5e3;)n=n.return,o++;window.__keyInspectorFiberRoot=n,window.__keyInspectorFiberSelf=t}catch{}}function Zt(){return r.createElement(i.View,{ref:Kt,style:{width:1,height:1}})}function $t(e){return e?.name==="GuildsBar"||e?.displayName==="GuildsBar"||e?.type?.name==="GuildsBar"||e?.type?.displayName==="GuildsBar"}function Nt(e){return Xe($t,function(t){Ee(t,Zt),console.log(_e,"PATCH: found the real GuildsBar reference, now rendering nothing")}),e.push(function(){}),console.log(_e,"PATCH: watching for the real GuildsBar to appear"),!0}function en(e){const t=b("ExpandedGuildFolderStore");if(!t?.getExpandedFolders)return!1;const n=function({folderId:o}){if(!h.storage.autoCollapseFolders||o==null)return;const l=t.getExpandedFolders();if(!(!(l instanceof Set)||!l.has(o)))for(const s of l)s!==o&&c.FluxDispatcher.dispatch({type:"TOGGLE_GUILD_FOLDER_EXPAND",folderId:s})};return c.FluxDispatcher.subscribe("TOGGLE_GUILD_FOLDER_EXPAND",n),e.push(function(){return c.FluxDispatcher.unsubscribe("TOGGLE_GUILD_FOLDER_EXPAND",n)}),!0}const{ScrollView:tn,View:nn}=c.ReactNative;function rn({children:e}){return c.React.createElement(tn,{style:{flex:1}},e,c.React.createElement(nn,{style:{height:24}}))}const{View:on,Text:ln}=c.ReactNative;function Le({children:e,style:t}){return c.React.createElement(on,{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:je,FormSwitchRow:$}=We.Forms;function sn(){return ne.useProxy(h.storage),c.React.createElement(rn,null,c.React.createElement(Le,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(je,{title:"Layout"},c.React.createElement($,{label:"Hide the left server rail",subLabel:"Your servers and DMs already live in the drawer, so the rail is redundant",value:h.storage.hideGuildsBar!==!1,onValueChange:function(e){h.storage.hideGuildsBar=e,ze()}}),c.React.createElement($,{label:"Unread badges",subLabel:"Show mention counts and unread dots on server icons in the drawer",value:h.storage.showUnreadBadges!==!1,onValueChange:function(e){h.storage.showUnreadBadges=e}})),c.React.createElement(je,{title:"Folders"},c.React.createElement($,{label:"Auto-collapse other folders",subLabel:"Opening a folder collapses any other folder that was already open",value:!!h.storage.autoCollapseFolders,onValueChange:function(e){h.storage.autoCollapseFolders=e}}),c.React.createElement($,{label:"Hide icons in collapsed folders",subLabel:"Show a plain folder icon instead of a 4-server preview",value:!!h.storage.hideFolderIcons,onValueChange:function(e){h.storage.hideFolderIcons=e}})),c.React.createElement(Le,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 C=[],w;function an(e,t){try{return t()}catch(n){return te.logger.error(`[ServerDrawer] "${e}" patch threw, skipping: ${n}`),!1}}function Oe(){const e={questDockContext:function(){return $e(C)},expanded:function(){return Yt(C)},collapsed:function(){return L("QuestDockContentCollapsed",C)},enrolledHeader:function(){return L("QuestDockEnrolledHeader",C)},unenrolledHeader:function(){return L("QuestDockUnenrolledHeader",C)},enrolledBody:function(){return L("QuestDockEnrolledBody",C)},unenrolledBody:function(){return L("QuestDockUnenrolledBody",C)},autoCollapseFolders:function(){return en(C)},...h.storage.hideGuildsBar?{hideGuildsBar:function(){return Nt(C)}}:{}};Ke(C);const t=new Set(Object.keys(e)),n=new Set,o=function(){for(const l of t)an(l,e[l])&&(n.add(l),t.delete(l));t.size===0&&w&&(clearInterval(w),w=void 0)};if(o(),t.size>0){let l=0;w=setInterval(function(){o(),++l>=50&&w&&(clearInterval(w),w=void 0,t.size>0&&te.logger.error(`[ServerDrawer] Gave up waiting on: ${[...t].join(", ")}`))},200)}te.logger.log(`[ServerDrawer] onLoad: applied immediately - ${[...n].join(", ")||"none"}${t.size?`, still waiting on ${[...t].join(", ")}`:""}`)}function Me(){w&&(clearInterval(w),w=void 0);for(const e of C)try{e()}catch{}C=[]}function ze(){Me(),Oe()}var un={onLoad:function(){h.storage.hideGuildsBar??=!0,h.storage.showUnreadBadges??=!0,h.storage.autoCollapseFolders??=!1,h.storage.hideFolderIcons??=!1,Oe()},onUnload:function(){return Me()},settings:sn};return O.default=un,O.restart=ze,Object.defineProperty(O,"__esModule",{value:!0}),O})({},vendetta,vendetta.plugin,vendetta.metro.common,window.React,vendetta.metro.common.ReactNative,vendetta.storage,vendetta.ui.toasts,vendetta.ui,vendetta.ui.assets,vendetta.ui.components); +(function(O,te,h,c,r,i,ne,I,M,re,We){"use strict";function m(e){const t=window?.modules;if(t)for(const n in t){const o=t[n];if(!o?.isInitialized)continue;const l=o.publicModule?.exports;if(l)try{if(e(l))return l;if(l.default!=null&&e(l.default))return l.default}catch{}}}function Qe(e){return m(function(t){return t?.name===e||t?.displayName===e})}function x(...e){return m(function(t){return e.every(function(n){return typeof t?.[n]=="function"})})}function z(e){const t=Object.keys(e);return m(function(n){return t.every(function(o){try{return e[o](n?.[o])}catch{return!1}})})}function b(e){return m(function(t){return typeof t?.getName=="function"&&t.getName.length===0&&t.getName()===e})}function qe(e,t,n=100){let o=!1,l;const s=e();return s?(t(s),{cancel(){}}):(l=setInterval(function(){if(o)return;const a=e();a&&(o=!0,clearInterval(l),t(a))},n),{cancel(){o=!0,l&&clearInterval(l)}})}const oe=new Map,Ce=[],ie=[];let v=[],U=!1;function we(e,t,n){oe.set(e,{replacement:t,extraProps:n})}function Je(e,t){ie.push({predicate:e,transform:t})}function Xe(e,t){v.push({predicate:e,onDetected:t})}function Ye(e){if(v.length===0)return;const t=[];for(const n of v){let o=!1;try{o=n.predicate(e)}catch{}if(o)try{n.onDetected(e)}catch{}else t.push(n)}v=t}function Ee(e,t){Ye(e);let n=t;if(n)for(const{predicate:l,transform:s}of ie)try{l(n)&&(n=s(n))}catch{}if(n)for(const{predicate:l,replacement:s}of Ce)try{if(l(n))return s?{type:s,props:n}:null}catch{}const o=oe.get(e);if(o)return{type:o.replacement,props:o.extraProps?{...n,...o.extraProps}:n};if(n!==t)return{type:e,props:n}}function Ke(e){if(U)return;const t=c.React.createElement;if(!t){console.warn("[ServerDrawer] React.createElement is null, skipping patch");return}const n=function(s,a,...g){const p=Ee(s,a);return p===null?null:p?t.call(c.React,p.type,p.props,...g):t.call(c.React,s,a,...g)};Object.assign(n,t),c.React.createElement=n,U=!0;const o=[],l=qe(function(){return m(function(s){return typeof s?.jsx=="function"&&typeof s?.jsxs=="function"&&"Fragment"in s})},function(s){for(const a of["jsx","jsxs"]){const g=s[a];typeof g=="function"&&(s[a]=function(p,S,...y){const d=Ee(p,S);return d===null?null:d?g.call(this,d.type,d.props,...y):g.call(this,p,S,...y)},o.push(function(){s[a]=g}))}});e.push(function(){l.cancel(),U&&(c.React.createElement=t,U=!1),o.forEach(function(s){return s()}),oe.clear(),Ce.length=0,ie.length=0,v=[]})}const Ze="[ServerDrawer]";function $e(e){return Je(function(t){const n=t?.value;return!!(n&&typeof n=="object"&&"isRendered"in n&&"isVisibleToUser"in n&&"quest"in n)},function(t){const n=t.value,o=n.quest??Ne();return{...t,value:{...n,isRendered:!0,isVisibleToUser:!0,quest:et(o)}}}),e.push(function(){}),console.log(Ze,"PATCH: watching for the Quest Dock coordination context"),!0}function Ne(){return{id:"server-drawer",config:{quest_content_type:0,assets:{questBarHeroVideo:"",questBarHero:""},features:[]},userStatus:{enrolledAt:"2099-01-01",claimedAt:null},benefits:{rewards:[]},guildId:"0",tasks:[]}}function et(e){const t=e?.config?.assets;if(!t)return e;const n=t.questBarHero,o=t.questBarHeroVideo;return n!=null&&o!=null?e:{...e,config:{...e.config,assets:{...t,questBarHero:n??"",questBarHeroVideo:o??""}}}}function u(e){let t,n=!1;return function(){if(n)return t;const o=e();return o!=null&&(t=o,n=!0),o??void 0}}const A=u(function(){return x("useStateFromStores")}),H=u(function(){return z({triggerHapticFeedback:function(e){return typeof e=="function"},HapticFeedbackTypes:function(e){return e?.SOFT!==void 0}})}),le=u(function(){return z({colors:function(e){return e?.BG_ACCENT!==void 0},unsafe_rawColors:function(e){return e?.WHITE!==void 0}})}),Se=u(function(){return x("bulkAck","ackChannel")}),ke=u(function(){return z({ReadStateTypes:function(e){return e?.CHANNEL!==void 0},UnreadSetting:function(e){return e?.ALL_MESSAGES!==void 0}})}),tt=u(function(){return b("GuildStore")});function Ie({id:e,size:t=48}){const n=A(),o=tt(),l=le()?.colors,s=n?.useStateFromStores?.([o],function(){return o?.getGuild?.(e)},[e])??null;if(!s)return null;const a=t>=40?16:8;return s.icon?r.createElement(i.Image,{source:{uri:`https://cdn.discordapp.com/icons/${s.id}/${s.icon}.png?size=${t*2}`},style:{width:t,height:t,borderRadius:a}}):r.createElement(i.View,{style:[Re.fallback,{width:t,height:t,borderRadius:a,backgroundColor:l?.BG_ACCENT??"#5865f2"}]},r.createElement(i.Text,{style:[Re.letter,{fontSize:Math.max(10,t*.4)}]},s.name?.split(" ").map(function(g){return g[0]}).join("").slice(0,2).toUpperCase()||"?"))}const Re=i.StyleSheet.create({fallback:{alignItems:"center",justifyContent:"center"},letter:{color:"#fff",fontWeight:"700"}}),nt=u(function(){return b("ThemeStore")}),rt=u(function(){return m(function(e){return e?.default?.internal?.resolveSemanticColor})?.default?.internal?.resolveSemanticColor??m(function(e){return e?.meta?.resolveSemanticColor})?.meta?.resolveSemanticColor});function ot(e,t=nt()?.theme){if(e)try{return rt()?.(t,e)}catch{return}}const it=u(function(){return z({TextStyleSheet:function(e){return e?.["text-md/bold"]!==void 0}})?.TextStyleSheet});function W(e,t){return ot(e)??t}const T=12,se=12,De=42,ae=220,Fe=4,G=16,Q=20,xe={tension:200,friction:20};function lt({visible:e,items:t,title:n,anchorX:o,anchorY:l,onClose:s}){const a=it(),g=H(),{width:p,height:S}=i.Dimensions.get("window"),y=(n?se+20+Fe:0)+t.length*De;let d=o,w=l+48+10;d+ae>p-T&&(d=p-ae-T),dS-T&&(w=l-y-10),w0?r.createElement(i.View,{style:_.outline},r.createElement(i.View,{style:_.badge},r.createElement(i.Text,{style:_.text},o>99?"99+":String(o)))):l?r.createElement(i.View,{style:_.dotOutline},r.createElement(i.View,{style:_.dot})):null:null}function Te({node:e,onPick:t}){const n=r.useRef(null),o=r.useRef(new i.Animated.Value(1)).current,l=function(){return i.Animated.spring(o,{toValue:.85,useNativeDriver:!0}).start()},s=function(){return i.Animated.spring(o,{toValue:1,useNativeDriver:!0}).start()},[a,g]=r.useState({visible:!1,items:[],title:"",x:0,y:0}),p=r.useCallback(function(){const d=e.id,w=ct()?.getGuild?.(d);if(!w)return;const B=n.current;if(!B?.measure)return;const V=[{label:"Mark as Read",action:function(){return ht(d)}},{label:"Copy Server ID",action:function(){c.clipboard.setString(d),I.showToast("Copied server ID",void 0)}}];B.measure(function(f,k,D,j,P,N){g({visible:!0,items:V,title:w.name,x:P,y:N})})},[e.id]),S=r.useCallback(function(){const d=H();d?.triggerHapticFeedback?.(d.HapticFeedbackTypes.IMPACT_MEDIUM),p()},[p]),y=e.id;return r.createElement(r.Fragment,null,r.createElement(i.Pressable,{onPressIn:l,onPressOut:s,onPress:function(){return t(y)},onLongPress:S,delayLongPress:500},r.createElement(i.View,{ref:n,style:Ve.outer,collapsable:!1},r.createElement(i.Animated.View,{style:[Ve.icon,{transform:[{scale:o}]}]},r.createElement(Ie,{id:y})),r.createElement(gt,{guildId:y}))),r.createElement(lt,{visible:a.visible,items:a.items,title:a.title,anchorX:a.x,anchorY:a.y,onClose:function(){return g(function(d){return{...d,visible:!1}})}}))}const Ve=i.StyleSheet.create({outer:{width:q,height:q},icon:{width:q,height:q,borderRadius:16,overflow:"hidden"}}),_=i.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=u(function(){return b("ExpandedGuildFolderStore")});function mt(e){const t=A(),n=pt();return t?.useStateFromStores?.([n],function(){const o=n?.getExpandedFolders?.();return o instanceof Set?o.has(e):!1},[e])??!1}const yt=u(function(){return x("toggleGuildFolderExpand")}),bt=u(function(){return b("GuildReadStateStore")}),R=48,ce=16,Ct=[{top:6,left:6},{top:6,right:6},{bottom:6,left:6},{bottom:6,right:6}],Ae=re.getAssetIDByName("FolderIcon");function He(e){return e==null?"#5865f2":`#${e.toString(16).padStart(6,"0")}`}function wt({node:e}){const t=A(),n=bt(),o=t?.useStateFromStores?.([n],function(){let l=0;for(const s of e.children)l+=n?.getMentionCount?.(s.id)??0;return l},[e.children])??0;return o>0?r.createElement(i.View,{style:fe.outline},r.createElement(i.View,{style:fe.badge},r.createElement(i.Text,{style:fe.text},o>99?"99+":String(o)))):null}function Et({node:e}){ne.useProxy(h.storage);const t=He(e.color);return r.createElement(i.View,{style:J.outer},r.createElement(i.View,{style:[J.icon,{backgroundColor:t}]},h.storage.hideFolderIcons?r.createElement(i.View,{style:J.plainIcon},r.createElement(i.Image,{source:Ae,style:de.folderImg,tintColor:"#fff"})):e.children.slice(0,4).map(function(n,o){return r.createElement(i.View,{key:n.id,style:[J.cell,Ct[o]]},r.createElement(Ie,{id:n.id,size:ce}))})),r.createElement(wt,{node:e}))}const J=i.StyleSheet.create({outer:{width:R,height:R},icon:{width:R,height:R,borderRadius:16,overflow:"hidden"},cell:{position:"absolute",width:ce,height:ce,borderRadius:8,overflow:"hidden"},plainIcon:{width:R,height:R,alignItems:"center",justifyContent:"center"}});function St({children:e}){const t=r.useRef(new i.Animated.Value(0)).current;return r.useEffect(function(){i.Animated.timing(t,{toValue:1,duration:180,useNativeDriver:!0}).start()},[]),r.createElement(i.Animated.View,{style:{opacity:t}},e)}function kt({node:e,onPick:t}){const n=mt(e.id),o=function(){yt()?.toggleGuildFolderExpand?.(e.id)};return n?r.createElement(r.Fragment,null,r.createElement(i.Pressable,{onPress:o},r.createElement(i.View,{style:[de.openIcon,{backgroundColor:He(e.color)}]},r.createElement(i.Image,{source:Ae,style:de.folderImg,tintColor:"#fff"}))),e.children.map(function(l){return r.createElement(St,{key:l.id},r.createElement(Te,{node:l,onPick:t}))})):r.createElement(i.Pressable,{onPress:o},r.createElement(Et,{node:e}))}const de=i.StyleSheet.create({openIcon:{width:R,height:R,borderRadius:16,alignItems:"center",justifyContent:"center"},folderImg:{width:24,height:24}}),fe=i.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}}),X=48,It=re.getAssetIDByName("ChatIcon"),Rt=u(function(){return x("selectPrivateChannel")}),Dt=u(function(){return Qe("SelectedChannelStore")}),Ft=u(function(){return x("getGuildId")});function xt(){const e=H();e?.triggerHapticFeedback?.(e.HapticFeedbackTypes.SOFT);const t=Rt();if(t?.selectPrivateChannel){const n=Dt()?.getLastSelectedChannelId?.();t.selectPrivateChannel(n)}}function Tt(){const e=A(),t=Ft(),n=le()?.colors,o=e?.useStateFromStores?.([t],function(){return t?.getGuildId?.()==null})??!1;return r.createElement(i.Pressable,{onPress:xt,style:Be.outer},r.createElement(i.View,{style:[Be.icon,{backgroundColor:o?n?.BG_ACCENT??"#5865f2":"rgba(128,128,128,0.24)"}]},r.createElement(i.Image,{source:It,style:{width:24,height:24,tintColor:"#fff"}})))}const Be=i.StyleSheet.create({outer:{width:X,height:X},icon:{width:X,height:X,borderRadius:16,alignItems:"center",justifyContent:"center"}}),Pe=48,Vt=re.getAssetIDByName("CheckmarkLargeIcon"),At=Se,Ht=u(function(){return ke()?.ReadStateTypes}),Bt=u(function(){return b("SortedGuildStore")}),Pt=u(function(){return b("GuildChannelStore")}),vt=u(function(){return b("ChannelStore")});function Gt(){const e=(Bt()?.getGuildsTree?.()?.root?.children??[]).filter(function(o){return o?.type!=="root"}),t=[],n=function(o){for(const l of o)l.type==="folder"?n(l.children??[]):l.id!=null&&t.push(String(l.id))};return n(e),t}function _t(){const e=At(),t=Ht(),n=Pt(),o=vt();if(!e?.bulkAck||t?.CHANNEL==null||!n?.getSelectableChannelIds||!n?.getVocalChannelIds){I.showToast("Couldn't find Discord's read-state action - this may be unavailable on your version.",void 0);return}const l=Gt();if(l.length===0){I.showToast("Nothing to mark as read.",void 0);return}const s=[];for(const a of l){const g=[...n.getSelectableChannelIds(a)??[],...n.getVocalChannelIds(a)??[]];for(const p of g)s.push({channelId:p,readStateType:t.CHANNEL,messageId:o?.getChannel?.(p)?.lastMessageId??null})}if(s.length===0){I.showToast("Nothing to mark as read.",void 0);return}e.bulkAck(s),I.showToast(`Marked ${s.length} channel${s.length===1?"":"s"} as read`,void 0)}function Lt(){const e=r.useCallback(function(){const t=H();t?.triggerHapticFeedback?.(t.HapticFeedbackTypes.SOFT),_t()},[]);return r.createElement(i.Pressable,{onPress:e,style:jt.outer},r.createElement(i.Image,{source:Vt,style:{width:24,height:24,tintColor:"#80848e"}}))}const jt=i.StyleSheet.create({outer:{width:Pe,height:Pe,alignItems:"center",justifyContent:"center"}}),Ot=u(function(){return x("getRootNavigationRef")}),Mt=u(function(){return x("transitionToGuild")}),zt=u(function(){return m(function(e){return typeof e?.handleCreateJoinGuildPress=="function"})}),Ut=u(function(){return m(function(e){return e?.CirclePlusIcon})?.CirclePlusIcon}),Wt=u(function(){return m(function(e){return e?.QuestDockExternalCoordinationContext})?.QuestDockExternalCoordinationContext}),Qt=u(function(){return m(function(e){return e?.QuestDockMode?.COLLAPSED!=null})?.QuestDockMode}),qt=u(function(){return m(function(e){return typeof e?.getName=="function"&&e.getName.length===0&&e.getName()==="SortedGuildStore"})}),Y=48,K=6,Jt=12;function Xt(){const e=r.useRef(new i.Animated.Value(1)).current,t=r.useCallback(function(){i.Animated.spring(e,{toValue:.9,useNativeDriver:!0}).start()},[e]),n=r.useCallback(function(){i.Animated.spring(e,{toValue:1,useNativeDriver:!0}).start()},[e]),o=r.useCallback(function(){const a=H();a?.triggerHapticFeedback?.(a.HapticFeedbackTypes.SOFT),zt()?.handleCreateJoinGuildPress?.()},[]),l=Ut(),s=le()?.unsafe_rawColors;return r.createElement(i.Pressable,{onPress:o,onPressIn:t,onPressOut:n},r.createElement(i.Animated.View,{style:[Z.createJoin,{backgroundColor:s?.GREEN_360,transform:[{scale:e}]}]},l?r.createElement(l,{size:"md",color:s?.WHITE}):r.createElement(i.Text,{style:[Z.createJoinFallback,{color:s?.WHITE}]},"+")))}function ve({gestureContext:e}){const t=r.useCallback(function(f){const k=H();k?.triggerHapticFeedback?.(k.HapticFeedbackTypes.SOFT);const D=Mt();D?.transitionToGuild?D.transitionToGuild(f):Ot()?.getRootNavigationRef?.()?.navigate("guilds",{guildId:f})},[]),n=A(),o=qt(),l=n?.useStateFromStores?.([o],function(){return(o?.getGuildsTree()?.root?.children||[]).filter(function(f){return f.type!=="root"})})??[],s=e?r.useContext(e):null,a=s?.minExpandedContentHeight,g=r.useCallback(function(f){if(!a)return;const k=f.nativeEvent.layout.height;a.get()!==k&&a.set(k)},[a]),p=Wt(),S=(p?r.useContext(p):null)?.setRestingQuestDockMode,y=s?.questDockWrapperSpecs;r.useEffect(function(){const f=Qt();if(!S||!f||!y)return;const k=i.BackHandler.addEventListener("hardwareBackPress",function(){return(y.get()?.height??56)>80?(S(f.COLLAPSED),!0):!1});return function(){return k.remove()}},[S,y]);const{width:d}=i.Dimensions.get("window"),w=Math.max(3,Math.floor((d-Jt*2+K)/(Y+K))),B=w*Y+(w-1)*K,V=Math.max(0,(d-B)/2);return r.createElement(i.View,{style:Z.alignTop},r.createElement(i.View,{style:[Z.grid,{paddingHorizontal:V,gap:K}],onLayout:g},r.createElement(Tt,null),l.map(function(f){return f.type==="folder"?r.createElement(kt,{key:f.id,node:f,onPick:t}):r.createElement(Te,{key:f.id,node:f,onPick:t})}),r.createElement(Xt,null),r.createElement(Lt,null)))}const Z=i.StyleSheet.create({alignTop:{flex:1,justifyContent:"flex-start",alignItems:"flex-start"},grid:{flexDirection:"row",flexWrap:"wrap",paddingTop:4,paddingBottom:16},createJoin:{width:Y,height:Y,borderRadius:16,alignItems:"center",justifyContent:"center"},createJoinFallback:{fontSize:28,fontWeight:"700",lineHeight:30}}),he="[ServerDrawer]";let ge=null;function Ge(){return ge||(ge=m(function(e){return e?.QuestDockGestureContext})?.QuestDockGestureContext??null),ge}function Yt(e){const t=m(function(o){return o?.type?.displayName==="QuestDockContentExpanded"||o?.type?.name==="QuestDockContentExpanded"});if(!t?.type)return console.log(he,"WARN: QuestDockContentExpanded not found (will retry)"),!1;const n=t.type;return we(n,ve,{gestureContext:Ge()}),t.type=function(){return c.React.createElement(ve,{gestureContext:Ge()})},e.push(function(){t.type=n}),console.log(he,"PATCH: QuestDockContentExpanded replaced"),!0}function L(e,t){const n=m(function(s){return s?.type?.displayName===e||s?.type?.name===e});if(!n?.type)return console.log(he,`WARN: ${e} not found`),!1;const o=n.type,l=o;return n.type=function(){return null},l&&(Object.defineProperties(n.type,Object.getOwnPropertyDescriptors(l)),n.type.displayName=e),t.push(function(){n.type=o}),!0}const _e="[ServerDrawer]";function Kt(e){if(e)try{let t=null;if(e._internalFiberInstanceHandleDEV)t=e._internalFiberInstanceHandleDEV;else if(e._internalInstanceHandle)t=e._internalInstanceHandle;else if(e.__internalInstanceHandle)t=e.__internalInstanceHandle;else{const l=Object.keys(e).find(function(s){return s.startsWith("__reactFiber$")||s.startsWith("__reactInternalInstance$")});l&&(t=e[l])}if(!t)return;if(t.return===void 0&&t.child===void 0){const l=t.stateNode??t.fiber??t._debugOwner;if(l&&(l.return!==void 0||l.child!==void 0))t=l;else return}let n=t,o=0;for(;n.return&&o<5e3;)n=n.return,o++;window.__serverDrawerFiberRoot=n,window.__serverDrawerFiberSelf=t}catch{}}function Zt(){return r.createElement(i.View,{ref:Kt,style:{width:1,height:1}})}function $t(e){return e?.name==="GuildsBar"||e?.displayName==="GuildsBar"||e?.type?.name==="GuildsBar"||e?.type?.displayName==="GuildsBar"}function Nt(e){return Xe($t,function(t){we(t,Zt),console.log(_e,"PATCH: found the real GuildsBar reference, now rendering nothing")}),e.push(function(){}),console.log(_e,"PATCH: watching for the real GuildsBar to appear"),!0}function en(e){const t=b("ExpandedGuildFolderStore");if(!t?.getExpandedFolders)return!1;const n=function({folderId:o}){if(!h.storage.autoCollapseFolders||o==null)return;const l=t.getExpandedFolders();if(!(!(l instanceof Set)||!l.has(o)))for(const s of l)s!==o&&c.FluxDispatcher.dispatch({type:"TOGGLE_GUILD_FOLDER_EXPAND",folderId:s})};return c.FluxDispatcher.subscribe("TOGGLE_GUILD_FOLDER_EXPAND",n),e.push(function(){return c.FluxDispatcher.unsubscribe("TOGGLE_GUILD_FOLDER_EXPAND",n)}),!0}const{ScrollView:tn,View:nn}=c.ReactNative;function rn({children:e}){return c.React.createElement(tn,{style:{flex:1}},e,c.React.createElement(nn,{style:{height:24}}))}const{View:on,Text:ln}=c.ReactNative;function Le({children:e,style:t}){return c.React.createElement(on,{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:je,FormSwitchRow:$}=We.Forms;function sn(){return ne.useProxy(h.storage),c.React.createElement(rn,null,c.React.createElement(Le,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(je,{title:"Layout"},c.React.createElement($,{label:"Hide the left server rail",subLabel:"Your servers and DMs already live in the drawer, so the rail is redundant",value:h.storage.hideGuildsBar!==!1,onValueChange:function(e){h.storage.hideGuildsBar=e,ze()}}),c.React.createElement($,{label:"Unread badges",subLabel:"Show mention counts and unread dots on server icons in the drawer",value:h.storage.showUnreadBadges!==!1,onValueChange:function(e){h.storage.showUnreadBadges=e}})),c.React.createElement(je,{title:"Folders"},c.React.createElement($,{label:"Auto-collapse other folders",subLabel:"Opening a folder collapses any other folder that was already open",value:!!h.storage.autoCollapseFolders,onValueChange:function(e){h.storage.autoCollapseFolders=e}}),c.React.createElement($,{label:"Hide icons in collapsed folders",subLabel:"Show a plain folder icon instead of a 4-server preview",value:!!h.storage.hideFolderIcons,onValueChange:function(e){h.storage.hideFolderIcons=e}})),c.React.createElement(Le,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 C=[],E;function an(e,t){try{return t()}catch(n){return te.logger.error(`[ServerDrawer] "${e}" patch threw, skipping: ${n}`),!1}}function Oe(){const e={questDockContext:function(){return $e(C)},expanded:function(){return Yt(C)},collapsed:function(){return L("QuestDockContentCollapsed",C)},enrolledHeader:function(){return L("QuestDockEnrolledHeader",C)},unenrolledHeader:function(){return L("QuestDockUnenrolledHeader",C)},enrolledBody:function(){return L("QuestDockEnrolledBody",C)},unenrolledBody:function(){return L("QuestDockUnenrolledBody",C)},autoCollapseFolders:function(){return en(C)},...h.storage.hideGuildsBar?{hideGuildsBar:function(){return Nt(C)}}:{}};Ke(C);const t=new Set(Object.keys(e)),n=new Set,o=function(){for(const l of t)an(l,e[l])&&(n.add(l),t.delete(l));t.size===0&&E&&(clearInterval(E),E=void 0)};if(o(),t.size>0){let l=0;E=setInterval(function(){o(),++l>=50&&E&&(clearInterval(E),E=void 0,t.size>0&&te.logger.error(`[ServerDrawer] Gave up waiting on: ${[...t].join(", ")}`))},200)}te.logger.log(`[ServerDrawer] onLoad: applied immediately - ${[...n].join(", ")||"none"}${t.size?`, still waiting on ${[...t].join(", ")}`:""}`)}function Me(){E&&(clearInterval(E),E=void 0);for(const e of C)try{e()}catch{}C=[]}function ze(){Me(),Oe()}var un={onLoad:function(){h.storage.hideGuildsBar??=!0,h.storage.showUnreadBadges??=!0,h.storage.autoCollapseFolders??=!1,h.storage.hideFolderIcons??=!1,Oe()},onUnload:function(){return Me()},settings:sn};return O.default=un,O.restart=ze,Object.defineProperty(O,"__esModule",{value:!0}),O})({},vendetta,vendetta.plugin,vendetta.metro.common,window.React,vendetta.metro.common.ReactNative,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 898f3fc..4bb4929 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":"32e3e03958ce0613c21853b5967c3046fa965cc85b2ddd4ca21607d527d05909"} \ 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":"559ba275380c49ef446f06c483f1d8ae8695e5487ebb6b78f875d40ba68eec1b"} \ No newline at end of file