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