function G(o){window.enmity.plugins.registerPlugin(o)}const s=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 t=window.enmity.modules.common.React;window.enmity.modules.common.Dispatcher,window.enmity.modules.common.Storage;const M=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 R=window.enmity.modules.common.Navigation,V=window.enmity.modules.common.NavigationNative,D=window.enmity.modules.common.NavigationStack;window.enmity.modules.common.Theme;const K=window.enmity.modules.common.Linking,u=window.enmity.modules.common.StyleSheet;window.enmity.modules.common.ColorMap,window.enmity.modules.common.Components,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;const E={byProps:(...o)=>window.enmity.modules.filters.byProps(...o),byName:(o,n)=>window.enmity.modules.filters.byName(o,n),byTypeName:(o,n)=>window.enmity.modules.filters.byTypeName(o,n),byDisplayName:(o,n)=>window.enmity.modules.filters.byDisplayName(o,n)};function W(...o){return window.enmity.modules.bulk(...o)}function g(...o){return window.enmity.modules.getByProps(...o)}window.enmity.modules.common;function X(o){return window.enmity.patcher.create(o)}const{components:e}=window.enmity;e.Alert,e.Button,e.FlatList;const J=e.Image;e.ImageBackground,e.KeyboardAvoidingView,e.Modal,e.Pressable,e.RefreshControl;const I=e.ScrollView;e.SectionList,e.StatusBar,e.StyleSheet,e.Switch;const m=e.Text;e.TextInput,e.TouchableHighlight;const k=e.TouchableOpacity;e.TouchableWithoutFeedback,e.Touchable;const f=e.View;e.VirtualizedList,e.Form,e.FormArrow,e.FormCTA,e.FormCTAButton,e.FormCardSection,e.FormCheckbox;const v=e.FormDivider;e.FormHint,e.FormIcon;const Q=e.FormInput;e.FormLabel,e.FormRadio;const S=e.FormRow;e.FormSection,e.FormSelect,e.FormSubLabel;const $=e.FormSwitch;e.FormTernaryCheckBox,e.FormText,e.FormTextColors,e.FormTextSizes;var q="EmotesPlus",Z="1.1.1",ee="Enhanced mobile emote management.",oe=[{name:"byeoon",id:"1167275288036655133"}],te="#00007d",ne="https://github.com/byeoon/EmotesPlus",ie=[`
1.0.0: The first initial release of EmotesPlus!
`,`1.1.0: Added the ability to copy emotes as images, and button to copy plugin link in settings.
`],b={name:q,version:Z,description:ee,authors:oe,color:te,sourceUrl:ne,changelog:ie};function me(o,n,i){return window.enmity.settings.get(o,n,i)}const B=D.createStackNavigator();var re=({name:o="Page",component:n=f}={})=>{const i=u.createThemedStyleSheet({container:{backgroundColor:u.ThemeColorMap.BACKGROUND_MOBILE_SECONDARY,flex:.5},card:{backgroundColor:u.ThemeColorMap.BACKGROUND_MOBILE_PRIMARY,color:s.ThemeColorMap.TEXT_NORMAL},header:{backgroundColor:u.ThemeColorMap.BACKGROUND_MOBILE_SECONDARY,shadowColor:"transparent",elevation:0},text:{color:u.ThemeColorMap.HEADER_PRIMARY,fontFamily:s.Fonts.PRIMARY_NORMAL,fontSize:16,marginLeft:16,backgroundColor:"transparent"}}),y=({onPress:a,title:P})=>t.createElement(k,{onPress:a},t.createElement(m,{style:i.text},P));return t.createElement(V.NavigationContainer,{independent:!0},t.createElement(B.Navigator,{initialRouteName:o,style:i.container,screenOptions:{cardOverlayEnabled:!1,cardShadowEnabled:!1,cardStyle:i.card,headerStyle:i.header,headerTitleContainerStyle:{color:s.ThemeColorMap.HEADER_PRIMARY},headerTitleAlign:"center",safeAreaInsets:{top:0}}},t.createElement(B.Screen,{name:o,component:n,options:{headerTitleStyle:{color:"white",fontFamily:s.Fonts.PRIMARY_NORMAL},headerLeft:()=>t.createElement(y,{title:"Cancel",onPress:()=>{R.pop()}}),...D.TransitionPresets.ModalSlideFromBottomIOS}})))};function O(o,n){fetch(o).then(i=>{i.blob().then(y=>{const a=new FileReader;a.readAsDataURL(y),a.onloadend=()=>{n(a.result)}})})}const[se,le,ae,Ae]=W(E.byProps("getGuilds"),E.byProps("can","_dispatcher"),E.byProps("uploadEmoji"),E.byProps("downloadMediaAsset"));function ce(o,n,i){return window.enmity.utilities.findInReactTree(o,n,i)}function _(o){return window.enmity.assets.getIDByName(o)}const de=g("setString");async function ue(){return(await(await fetch("https://raw.githubusercontent.com/byeoon/EmotesPlus/main/version.json")).json()).version}function ye(o){M.open({content:o,icon:_("Check")})}function pe(){const[o,n]=t.useState();return t.useEffect(()=>{ue().then(n)},[]),o}var ge=({settings:o})=>{const n=u.createThemedStyleSheet({title:{flexDirection:"column"},itiswhatitis:{flexDirection:"row",justifyContent:"center",alignItems:"center"},pluginTitle:{fontSize:32,paddingTop:20,paddingLeft:20,paddingRight:30,color:s.ThemeColorMap.HEADER_PRIMARY},pluginAuthor:{fontSize:12,paddingLeft:20,paddingRight:30,color:s.ThemeColorMap.HEADER_SECONDARY},br:{fontSize:0,paddingTop:20,paddingLeft:20,paddingRight:30,color:s.ThemeColorMap.HEADER_SECONDARY},img:{width:72,height:72,marginTop:10,marginLeft:20},tab:{fontSize:14,paddingTop:20,paddingLeft:20,paddingRight:25,color:s.ThemeColorMap.HEADER_SECONDARY}});return t.createElement(I,null,t.createElement(f,{style:n.itiswhatitis},t.createElement(J,{source:{uri:"https://avatars.githubusercontent.com/u/47872200?v=4"},style:n.img}),t.createElement(f,{style:n.title},t.createElement(m,{style:n.pluginTitle},"EmotesPlus"),t.createElement(m,{style:n.pluginAuthor},"Developed by byeoon"),t.createElement(m,{style:n.pluginAuthor}," Version ",b.version," | Remote Version: ",pe()),t.createElement(m,{style:n.br}," "))),t.createElement(m,{style:n.tab},"Settings"),t.createElement(S,{label:"Copy Emotes as Hyperlink",trailing:t.createElement($,{value:o.getBoolean("copyAsHyperlink",!0),onValueChange:()=>o.toggle("copyAsHyperlink",!0)})}),t.createElement(v,null),t.createElement(S,{label:"Open GitHub Repository",icon:"ic_arrow_right",onPress:()=>K.openURL("https://github.com/byeoon/EmotesPlus")}),t.createElement(v,null),t.createElement(S,{label:"Copy Plugin URL",icon:"ic_arrow_right",onPress:()=>{de.setString("https://raw.githubusercontent.com/byeoon/EmotesPlus/main/dist/EmotesPlus.js"),ye("Copied URL!")}}),t.createElement(m,{style:n.tab},"Changelog: "),t.createElement(m,{style:n.pluginAuthor}," ",b.changelog," "))};const C=g("openLazy","hideActionSheet"),x=g("setString"),we=g("setImage"),w=X("EmotesPlus"),{default:l}=g("ButtonColors","ButtonSizes"),he=s.Permissions;function T(o){M.open({content:o,icon:_("Check")})}const Ee={...b,onStart(){const o=w.before(C,"openLazy",(n,[i,y])=>{y==="MessageEmojiActionSheet"&&(o(),i.then(a=>{w.after(a,"default",(P,Se,z)=>{const U=w.after(z,"type",(be,Ce,H)=>{t.useEffect(()=>()=>void U(),[]);const N=ce(H,c=>{var r,p;return(c==null?void 0:c.type)&&((r=c==null?void 0:c.props)==null?void 0:r.emojiNode)&&((p=c==null?void 0:c.props)==null?void 0:p.nonce)});if(!N)return;let A="placeholdername";w.after(N,"type",(c,[{emojiNode:r}],p)=>{var L,F;const Y=Object.entries(se.getGuilds()).filter(([d,h])=>le.can(he.MANAGE_GUILD_EXPRESSIONS,h));(F=(L=p==null?void 0:p.props)==null?void 0:L.children)==null||F.push(t.createElement(m,{text:"EmotesPlus"}),t.createElement(l,{color:l.Colors.BRAND,text:"Copy Emote URL",size:l.Sizes.SMALL,onPress:()=>{T("Copied Emote URL to clipboard!"),me(b.name,"copyAsHyperlink",!1)?x.setString(r.src):x.setString("["+r.alt+"]("+r.src+")"),C.hideActionSheet()}}),t.createElement(m,{text:""}),t.createElement(l,{color:l.Colors.BRAND,text:"Copy Emote as Image",size:l.Sizes.SMALL,onPress:()=>{O(r.src,d=>{console.log("[EmotesPlus] Debug: EmoteURL:"+d),we.setImage(d.split(",")[1])}),T("Copied Emote as image!"),C.hideActionSheet()}}),t.createElement(m,{text:""}),t.createElement(l,{color:l.Colors.BRAND,text:"Clone to Server",size:l.Sizes.SMALL,onPress:()=>{A=r.alt,R.push(re,{component:()=>t.createElement(I,null,t.createElement(Q,{onChange:d=>A=d,placeholder:r.alt,title:"Custom Emote Name"}),t.createElement(v,null),Y.map(([d,h])=>t.createElement(k,{onPress:()=>O(r.src,j=>{ae.uploadEmoji({guildId:d,image:j,name:A,roles:void 0}).then(()=>{T(`Cloned emote to ${h}!`),R.pop()})})},t.createElement(S,{label:" "+h})))),name:"Clone Emote"}),C.hideActionSheet()}}))})})})}))})},onStop(){w.unpatchAll()},getSettingsPanel({settings:o}){return t.createElement(ge,{settings:o})}};G(Ee);