function j(t){window.enmity.plugins.registerPlugin(t)}const b=window.enmity.modules.common.Constants;window.enmity.modules.common.Clipboard,window.enmity.modules.common.Assets,window.enmity.modules.common.Messages,window.enmity.modules.common.Clyde,window.enmity.modules.common.Avatars,window.enmity.modules.common.Native;const e=window.enmity.modules.common.React;window.enmity.modules.common.Dispatcher,window.enmity.modules.common.Storage;const q=window.enmity.modules.common.Toasts;window.enmity.modules.common.Dialog,window.enmity.modules.common.Token,window.enmity.modules.common.REST,window.enmity.modules.common.Settings,window.enmity.modules.common.Users;const G=window.enmity.modules.common.Navigation;window.enmity.modules.common.NavigationNative,window.enmity.modules.common.NavigationStack,window.enmity.modules.common.Theme;const O=window.enmity.modules.common.Linking,V=window.enmity.modules.common.StyleSheet;window.enmity.modules.common.ColorMap,window.enmity.modules.common.Components;const K=window.enmity.modules.common.Locale;window.enmity.modules.common.Profiles,window.enmity.modules.common.Lodash,window.enmity.modules.common.Logger,window.enmity.modules.common.Flux,window.enmity.modules.common.SVG,window.enmity.modules.common.Scenes,window.enmity.modules.common.Moment;function W(t){return window.enmity.patcher.create(t)}var r="BetterStatusIndicator",z="1.2.0",X="Reveal statuses for every platform user is using with customizable color.",J=[{name:"mafu",id:"519760564755365888"},{name:"Niko",id:"341377368075796483"}],Q="#da70d6",Z={name:r,version:z,description:X,authors:J,color:Q};const{components:o}=window.enmity;o.Alert,o.Button,o.FlatList;const H=o.Image;o.ImageBackground,o.KeyboardAvoidingView,o.Modal;const ee=o.Pressable;o.RefreshControl;const te=o.ScrollView;o.SectionList,o.StatusBar,o.StyleSheet,o.Switch;const R=o.Text;o.TextInput,o.TouchableHighlight;const ne=o.TouchableOpacity;o.TouchableWithoutFeedback,o.Touchable;const I=o.View;o.VirtualizedList,o.Form,o.FormArrow,o.FormCTA,o.FormCTAButton,o.FormCardSection,o.FormCheckbox,o.FormDivider,o.FormHint,o.FormIcon,o.FormInput,o.FormLabel,o.FormRadio;const s=o.FormRow,M=o.FormSection;o.FormSelect,o.FormSubLabel;const T=o.FormSwitch;o.FormTernaryCheckBox,o.FormText,o.FormTextColors,o.FormTextSizes;function g(t){return window.enmity.assets.getIDByName(t)}function _(...t){return window.enmity.modules.getByProps(...t)}function F(...t){return window.enmity.modules.getByName(...t)}window.enmity.modules.common;function S(t){return"#"+("000000"+t.toString(16)).slice(-6)}const Y=_("openLazy","hideActionSheet"),oe=F("CustomColorPickerActionSheet",{default:!1}).default;function A({label:t,color:n,setColor:l,leading:i,onSelect:a=void 0}){const u=V.createThemedStyleSheet({pickedColorText:{color:b.ThemeColorMap.TEXT_NORMAL,marginLeft:10,fontSize:16,width:72,fontFamily:b.Fonts.PRIMARY_MEDIUM},pickerColorPreview:{width:24,height:24,backgroundColor:S(n),borderRadius:3,borderWidth:1,borderColor:b.ThemeColorMap.HEADER_SECONDARY}});return e.createElement(s,{label:t,trailing:e.createElement(I,{style:{flexDirection:"row",alignItems:"center"}},e.createElement(I,{style:u.pickerColorPreview}),e.createElement(R,{style:u.pickedColorText},S(n)),e.createElement(s.Arrow,null)),leading:e.createElement(s.Icon,{source:g(i),style:{tintColor:S(n)}}),onPress:()=>{Y.openLazy(new Promise(c=>c({default:oe})),"CustomColorPickerActionSheet",{color:n,onSelect:c=>{l(c),a&&a(c),Y.hideActionSheet()}})}})}function h(t,n,l){window.enmity.settings.set(t,n,l)}function d(t,n,l){return window.enmity.settings.get(t,n,l)}const ie=g("img_account_sync_github_white"),re=g("Discord"),le=g("img_account_sync_twitter_white"),ae=g("ic_message_retry"),se=g("ic_members"),me=g("ic_friend_wave_24px"),ce=g("ic_profile_24px"),de=g("ic_mail"),ue=g("mobile"),ge=_("acceptInviteAndTransitionToInviteChannel");var pe=({settings:t})=>{const n=V.createThemedStyleSheet({container:{flexDirection:"row",justifyContent:"center",alignItems:"center"},image:{width:70,height:70,marginTop:20,marginLeft:20},title:{flexDirection:"column"},name:{fontSize:25,paddingTop:20,paddingLeft:20,paddingRight:30,color:b.ThemeColorMap.HEADER_PRIMARY,fontFamily:b.Fonts.PRIMARY_MEDIUM},author:{fontSize:15,paddingLeft:50,color:b.ThemeColorMap.HEADER_SECONDARY},info:{height:45,paddingTop:3,paddingBottom:3,justifyContent:"center",alignItems:"center"},footer:{color:b.ThemeColorMap.HEADER_SECONDARY,textAlign:"center",paddingTop:10,paddingBottom:20}}),[l,i]=e.useState(d(r,"online",3908956)),[a,u]=e.useState(d(r,"offline",7634829)),[c,f]=e.useState(d(r,"idle",16426522)),[y,p]=e.useState(d(r,"dnd",15548997)),[v,C]=e.useState(d(r,"streaming",5846677));return e.createElement(te,null,e.createElement(I,{style:n.container},e.createElement(H,{source:{uri:"https://avatars.githubusercontent.com/u/43488869"},style:n.image}),e.createElement(I,{style:n.title},e.createElement(R,{style:n.name},"BetterStatusIndicator"),e.createElement(R,{style:n.author},"by mafu"))),e.createElement(M,{title:"COLOR"},e.createElement(A,{label:"Online",color:l,setColor:i,leading:"StatusOnline",onSelect:m=>{h(r,"online",m)}}),e.createElement(A,{label:"Offline",color:a,setColor:u,leading:"StatusOffline",onSelect:m=>{h(r,"offline",m)}}),e.createElement(A,{label:"Idle",color:c,setColor:f,leading:"StatusIdle",onSelect:m=>{h(r,"idle",m)}}),e.createElement(A,{label:"DND",color:y,setColor:p,leading:"StatusDND",onSelect:m=>{h(r,"dnd",m)}}),e.createElement(A,{label:"Streaming",color:v,setColor:C,leading:"StatusStreaming",onSelect:m=>{h(r,"streaming",m)}}),e.createElement(s,{label:"Reset to default",trailing:s.Arrow,leading:e.createElement(s.Icon,{source:ae}),onPress:()=>{h(r,"offline",7634829),u(7634829),h(r,"online",3908956),i(3908956),h(r,"idle",16426522),f(16426522),h(r,"dnd",15548997),p(15548997),h(r,"streaming",5846677),C(5846677)}}),e.createElement(s,{label:"Colorize Mobile Icons",leading:e.createElement(s.Icon,{source:ue}),trailing:e.createElement(T,{value:t.getBoolean("coloredMobile",!0),onValueChange:m=>{t.set("coloredMobile",m)}})})),e.createElement(M,{title:"PLACE"},e.createElement(s,{label:"Member List",leading:e.createElement(s.Icon,{source:se}),trailing:e.createElement(T,{value:t.getBoolean("member",!0),onValueChange:m=>{t.set("member",m)}})}),e.createElement(s,{label:"Friends Tab",leading:e.createElement(s.Icon,{source:me}),trailing:e.createElement(T,{value:t.getBoolean("friend",!0),onValueChange:m=>{t.set("friend",m)}})}),e.createElement(s,{label:"Profile",leading:e.createElement(s.Icon,{source:ce}),trailing:e.createElement(T,{value:t.getBoolean("profile",!0),onValueChange:m=>{t.set("profile",m)}})}),e.createElement(s,{label:"DM",leading:e.createElement(s.Icon,{source:de}),trailing:e.createElement(T,{value:t.getBoolean("dm",!0),onValueChange:m=>{t.set("dm",m)}})})),e.createElement(M,{title:"INFORMATION"},e.createElement(s,{label:"Follow me on Twitter",style:n.info,trailing:s.Arrow,leading:e.createElement(s.Icon,{source:le}),onPress:()=>{O.openURL("https://twitter.com/m4fn3")}}),e.createElement(s,{label:"Visit my server for help",style:n.info,trailing:s.Arrow,leading:e.createElement(s.Icon,{source:re}),onPress:()=>{ge.acceptInviteAndTransitionToInviteChannel({inviteKey:"TrCqPTCrdq",context:{location:"Invite Button Embed"},callback:()=>{G.pop()}})}}),e.createElement(s,{label:"Check Source on GitHub",style:n.info,trailing:s.Arrow,leading:e.createElement(s.Icon,{source:ie}),onPress:()=>{O.openURL("https://github.com/m4fn3/BetterStatusIndicator")}})),e.createElement(R,{style:n.footer},`v${z}`))};function P(t,n,l){return window.enmity.utilities.findInReactTree(t,n,l)}const{native:B}=window.enmity;B.version;const we=B.build;B.device,B.version;const w=W("BetterStatusIndicator"),D=_("setCurrentUserOnConnectionOpen");let $=F("ProfileBadges",{all:!0,default:!1});const U=_("ProfileBadgesOld"),fe=F("Status",{default:!1}),ye=F("ChatSidebarMembers",{default:!1}),he=g("ic_mobile_status"),Se=g("ic_monitor_24px"),be=g("ic_public"),Ee=g("ic_robot_24px");function k(t){let n=S(d(r,"offline",7634829));return t=="online"?n=S(d(r,"online",3908956)):t=="idle"?n=S(d(r,"idle",16426522)):t=="dnd"?n=S(d(r,"dnd",15548997)):t=="streaming"&&(n=S(d(r,"streaming",5846677))),n}function Ce(t){let n="StatusOffline";return t=="online"?n="StatusOnline":t=="idle"?n="StatusIdle":t=="dnd"?n="StatusDND":t=="streaming"&&(n="StatusStreaming"),g(n)}function L({client:t,stat:n}){let l=be,i;return t=="desktop"?(l=Se,i={}):t=="mobile"?(l=he,i={marginRight:5,marginLeft:8}):t=="web"?i={height:20,width:20,marginRight:2,marginLeft:2}:t=="bot"&&(l=Ee,i={}),e.createElement(ne,{onPress:()=>q.open({content:`${n} (${t.charAt(0).toUpperCase()}${t.slice(1)})`,source:Ce(n)})},e.createElement(H,{source:l,style:{tintColor:k(n),marginLeft:5,...i}}))}function E({userId:t,isBot:n=!1,customStyle:l={}}){const i=D.getState().clientStatuses[t];let a=[];return i&&(n?a.unshift(e.createElement(L,{client:"bot",stat:i.web})):(i.desktop&&a.unshift(e.createElement(L,{client:"desktop",stat:i.desktop})),i.mobile&&a.unshift(e.createElement(L,{client:"mobile",stat:i.mobile})),i.web&&a.unshift(e.createElement(L,{client:"web",stat:i.web})))),e.createElement(I,{style:[{flexDirection:"row",alignItems:"center"},l]},...a)}const Ie={...Z,onStart(){w.after(fe,"default",(n,[l],i)=>{i.props.children.props.style.tintColor=l.streaming?k("streaming"):k(l.status)}),w.instead(D,"isMobileOnline",(n,l,i)=>{var a;if(d(r,"coloredMobile",!0))return(a=D.getState().clientStatuses[l[0]].mobile)!=null?a:!1}),w.after(ee.type,"render",(n,l,i)=>{var a,u,c;if(d(r,"friend",!0)){const f=P(i,y=>{var p;return((p=y.props)==null?void 0:p.children[0][1].type.name)=="FriendPresence"});if(f){const y=f.props.children[0][1].props.userId;i.props.children[0].splice(-1,0,e.createElement(E,{userId:y,customStyle:{marginRight:5}}))}}if(d(r,"dm",!0)){const f=K.Messages.DIRECT_MESSAGE_A11Y_LABEL.message.split("(")[1].replace(")",""),y=P(i,p=>{var v,C;return(C=(v=p.props)==null?void 0:v.accessibilityLabel)==null?void 0:C.includes(f)});if(y){let p=(c=(u=(a=y.props)==null?void 0:a.children[0][0])==null?void 0:u.props)==null?void 0:c.user;p&&y.props.children.push(e.createElement(E,{userId:p.id,isBot:p.bot}))}}});const t=w.after(I,"render",(n,l,i)=>{if(d(r,"member",!0)){const a=P(i,u=>u.props.type==="MEMBER");a&&(w.after(a.type,"type",(u,[c],f)=>{d(r,"member",!0)&&f.props.children.length===3&&f.props.children.push(e.createElement(E,{userId:c.userId,isBot:c.user.bot}))}),t())}});w.after(ye,"default",(n,l,i)=>{d(r,"member",!0)&&i.type.name==="ChatSidebarMembersPrivateChannel"&&w.after(i,"type",(a,u,c)=>{w.after(c.props,"renderItem",(f,y,p)=>{w.after(p.type,"type",(v,C,m)=>{w.after(m.type,"type",(ve,[x],N)=>{N.props.children.length===3&&N.props.children.push(e.createElement(E,{userId:x.user.id,isBot:x.user.bot}))})})})})}),U&&we>="42235"&&($=[U]),$.forEach(n=>{w.after(n,"default",(l,[i],a)=>{if(d(r,"profile",!0)){let u={marginLeft:3,marginRight:3};if(a){let c=a.props.badges?a.props.badges:a.props.children;if(c)c.unshift(e.createElement(E,{userId:i.user.id,isBot:i.user.bot,customStyle:u}));else return e.createElement(E,{userId:i.user.id,isBot:i.user.bot,customStyle:u})}else return e.createElement(E,{userId:i.user.id,isBot:i.user.bot,customStyle:u})}})})},onStop(){w.unpatchAll()},getSettingsPanel({settings:t}){return e.createElement(pe,{settings:t})}};j(Ie);