diff --git a/Commands/index.js b/Commands/index.js index 1d0e6d3..5d7292e 100644 --- a/Commands/index.js +++ b/Commands/index.js @@ -1,14 +1,14 @@ -(function(q,Ae,r,g,m,M,N,w,n,ne,b,E,_,Le,X){"use strict";const De=async function(){const e=await(await fetch("https://uselessfacts.jsph.pl/api/v2/facts/random")).json();return{text:e.text,source:e.source,language:e.language}},$e=async function(){return{text:(await(await fetch("https://dogapi.dog/api/v2/facts?limit=1")).json()).data[0].attributes.body}},Pe=async function(){const e=await(await fetch("https://catfact.ninja/fact")).json();return{text:e.fact,length:e.length}},xe=async function(e,t){try{const a=await fetch(`https://api.obamabot.me/v2/image/petpet?image=${e.replace("webp","png")}`);if(a.ok){const s=await a.json();if(s&&s.url)return s}}catch(a){console.warn("[PetPet] Obama API failed, falling back to .ru:",a)}if(t)return{url:`https://ptc.pwn3t.ru/${t}.gif`};throw new Error("All PetPet APIs are down")},Be=async function(e="gary"){try{switch(e){case"gary":return(await(await fetch("https://api.garythe.cat/gary")).json()).url;case"goober":return(await(await fetch("https://api.garythe.cat/goober")).json()).url;case"catapi":return(await(await fetch("https://api.thecatapi.com/v1/images/search")).json())[0].url;case"minker":return"https://minky.materii.dev/";default:throw new Error("Invalid Gary image source value")}}catch(t){return console.error(`[Gary API] Error fetching image from ${e}:`,t),null}},Y=g.findByProps("sendMessage"),J=function(e){let t=e.text;return r.storage.factSettings?.includeCitation&&e.source&&(t+=` +(function(q,ke,a,g,m,M,T,w,n,ne,b,E,_,Ae,X){"use strict";const Le=async function(){const e=await(await fetch("https://uselessfacts.jsph.pl/api/v2/facts/random")).json();return{text:e.text,source:e.source,language:e.language}},$e=async function(){return{text:(await(await fetch("https://dogapi.dog/api/v2/facts?limit=1")).json()).data[0].attributes.body}},De=async function(){const e=await(await fetch("https://catfact.ninja/fact")).json();return{text:e.fact,length:e.length}},Pe=async function(e,t){try{const r=await fetch(`https://api.obamabot.me/v2/image/petpet?image=${e.replace("webp","png")}`);if(r.ok){const s=await r.json();if(s&&s.url)return s}}catch(r){console.warn("[PetPet] Obama API failed, falling back to .ru:",r)}if(t)return{url:`https://ptc.pwn3t.ru/${t}.gif`};throw new Error("All PetPet APIs are down")},xe=async function(e="gary"){try{switch(e){case"gary":return(await(await fetch("https://api.garythe.cat/gary")).json()).url;case"goober":return(await(await fetch("https://api.garythe.cat/goober")).json()).url;case"catapi":return(await(await fetch("https://api.thecatapi.com/v1/images/search")).json())[0].url;case"minker":return"https://minky.materii.dev/";default:throw new Error("Invalid Gary image source value")}}catch(t){return console.error(`[Gary API] Error fetching image from ${e}:`,t),null}},Y=g.findByProps("sendMessage"),J=function(e){let t=e.text;return a.storage.factSettings?.includeCitation&&e.source&&(t+=` -Source: ${e.source}`),t},Fe={name:"catfact",displayName:"catfact",description:"Sends a random cat fact.",displayDescription:"Sends a random cat fact.",applicationId:"-1",inputType:1,type:1,execute:async function(e,t){try{const a=await Pe(),s=Date.now().toString();return Y.sendMessage(t.channel.id,{content:J(a)},void 0,{nonce:s}),null}catch(a){return console.error("[CatFact] Error:",a),m.showToast("Failed to fetch cat fact",3e3),null}}},Me={name:"dogfact",displayName:"dogfact",description:"Sends a dog fact.",displayDescription:"Sends a dog fact.",applicationId:"-1",inputType:1,type:1,execute:async function(e,t){try{const a=await $e(),s=Date.now().toString();return Y.sendMessage(t.channel.id,{content:J(a)},void 0,{nonce:s}),null}catch(a){return console.error("[DogFact] Error:",a),m.showToast("Failed to fetch dog fact",3e3),null}}},_e={name:"useless",displayName:"useless",description:"Sends a useless fact.",displayDescription:"Sends a useless fact.",applicationId:"-1",inputType:1,type:1,execute:async function(e,t){try{const a=await De(),s=Date.now().toString();return Y.sendMessage(t.channel.id,{content:J(a)},void 0,{nonce:s}),null}catch(a){return console.error("[UselessFact] Error:",a),m.showToast("Failed to fetch useless fact",3e3),null}}},D={CONTENT:"This list is over 2000 characters. Send anyway?",CONFIRM:"Send",CANCEL:"Cancel"},Ve={DETAILED:"detailed"},Q="",V={SLM_NOT_INSTALLED:"This list is over 2000 characters. Install the Split Large Messages plugin to send it.",SLM_NOT_ENABLED:"This list is over 2000 characters. Enable the Split Large Messages plugin to send it."},ae={SEMICOL:"; ",NEW_LINE:` -`},Ue="Nothing to see here, huh...",re="github.com/fres621/vendetta-plugins",I={ENABLED:"\u2705",DISABLED:"\u274C",SELECTED:"\u2705",NOT_SELECTED:"\u274C"},We=g.findByProps("sendMessage","receiveMessage"),$=g.findByProps("sendBotMessage"),se=(function(){try{return g.findByStoreName("UserStore").getCurrentUser()?.premiumType===2?4e3:2e3}catch{return 2e3}})(),ie=function(e){return Object.keys(e).includes(re)},oe=function(e){return Object.values(e).find(function(t){return t.id==re})?.enabled},ce=function(e){return e.find(function(t){return t.name===Ve.DETAILED})?.value??!1},U=function(e){return!e||!Array.isArray(e)||e.length===0?"Unknown":e.filter(function(t){return t&&(typeof t=="string"||typeof t=="object"&&t.name)}).map(function(t){return typeof t=="string"?t:t.name||"Unknown"}).join(ae.SEMICOL)||"Unknown"},le=function(e){return e.join(ae.NEW_LINE).trimEnd()},W=function(e){return le(e).length},O=async function(e,t){const a=Date.now().toString();await We.sendMessage(e,{content:le(t)},void 0,{nonce:a})},de=function(e,t){return[`**My ${e} List | ${t} ${e}s**`,Q]};async function Oe(e,t){try{const a=ce(e),s=r.storage.themeListAlwaysDetailed??!1;if(!M.themes||typeof M.themes!="object"){const d=t.channel.id;return $.sendBotMessage(d,"No themes found or themes not loaded yet."),null}const i=Object.values(M.themes),o=t.channel.id,c=de("Theme",Object.keys(M.themes).length);if(i.length)for(const d of i){if(!d||typeof d!="object")continue;const{selected:u,data:f,id:C}=d,k=f?.name||"Unknown Theme",T=f?.description||"No description",P=f?.authors;a||s?c.push(`> **Name**: ${k}`,`> **Selected**: ${u?I.SELECTED:I.NOT_SELECTED}`,`> **Description**: ${T}`,`> **Authors**: ${U(P)}`,`> **[Install!](${C||"unknown"})**`,Q):c.push(`> ${u?I.SELECTED:I.NOT_SELECTED} **${k}** by ${U(P)}`)}else c.push(Ue);const l=W(c)>se;if(l&&!ie(N.plugins))$.sendBotMessage(o,V.SLM_NOT_INSTALLED);else if(l&&!oe(N.plugins))$.sendBotMessage(o,V.SLM_NOT_ENABLED);else{if(W(c)>2e3)return w.alerts.showConfirmationAlert({content:D.CONTENT,confirmText:D.CONFIRM,cancelText:D.CANCEL,onConfirm:async function(){return await O(o,c)}});await O(o,c)}}catch(a){return console.error("[ThemeList] Error:",a),null}}async function Ge(e,t){try{const a=ce(e),s=r.storage.pluginListAlwaysDetailed??!1,i=t.channel.id;if(!N.plugins||typeof N.plugins!="object")return $.sendBotMessage(i,"No plugins found or plugins not loaded yet."),null;const o=de("Plugin",Object.keys(N.plugins).length);for(const l of Object.values(N.plugins)){if(!l||typeof l!="object")continue;const{enabled:d,manifest:u,id:f}=l,C=u?.name||"Unknown Plugin",k=u?.description||"No description",T=u?.authors;a||s?o.push(`> **Name**: ${C}`,`> **Status**: ${d?I.ENABLED:I.DISABLED}`,`> **Description**: ${k}`,`> **Authors**: ${U(T)}`,`> **[Install!](${f||"unknown"})**`,Q):o.push(`> ${d?I.ENABLED:I.DISABLED} **${C}** by ${U(T)}`)}const c=W(o)>se;if(c&&!ie(N.plugins))$.sendBotMessage(i,V.SLM_NOT_INSTALLED);else if(c&&!oe(N.plugins))$.sendBotMessage(i,V.SLM_NOT_ENABLED);else{if(W(o)>2e3)return w.alerts.showConfirmationAlert({content:D.CONTENT,confirmText:D.CONFIRM,cancelText:D.CANCEL,onConfirm:async function(){return await O(i,o)}});await O(i,o)}}catch(a){return console.error("[PluginList] Error:",a),null}}const je={name:"plugin-list",displayName:"plugin list",description:"Send your plugin list to the current channel",displayDescription:"Send your plugin list to the current channel",options:[{name:"detailed",description:"Whether to send a list with detailed information.",type:5,required:!1,displayName:"detailed",displayDescription:"Whether to send a list with detailed information."}],execute:Ge,applicationId:"-1",inputType:1,type:1},He={name:"theme-list",displayName:"theme list",description:"Send your theme list to the current channel",displayDescription:"Send your theme list to the current channel",options:[{name:"detailed",description:"Whether to send a list with detailed information.",type:5,required:!1,displayName:"detailed",displayDescription:"Whether to send a list with detailed information."}],execute:Oe,applicationId:"-1",inputType:1,type:1},ze=g.findByStoreName("UserStore"),Ke=g.findByProps("sendMessage"),qe={name:"petpet",displayName:"petpet",description:"PetPet someone",displayDescription:"PetPet someone",options:[{name:"user",description:"The user (or their id) to be patted",type:6,required:!0,displayName:"user",displayDescription:"The user (or their id) to be patted"}],execute:async function(e,t){try{const a=await ze.getUser(e[0].value),s=a.getAvatarURL(512),i=await xe(s,a.id),o=Date.now().toString();return Ke.sendMessage(t.channel.id,{content:i.url},void 0,{nonce:o}),null}catch(a){return console.error("[PetPet] Error:",a),null}},applicationId:"-1",inputType:1,type:1},Xe=g.findByProps("sendMessage"),Ye=g.findByProps("sendBotMessage","sendMessage","receiveMessage"),ue=async function(e){const t="https://konachan.com/post.json",a=e?"rating:explicit":"rating:safe",s=Math.floor(Math.random()*100);try{const i=await(await fetch(`${t}?tags=${a}&limit=1&page=${s}`)).json();return!Array.isArray(i)||i.length===0?null:i[0].file_url}catch(i){return console.error("[KonoChan Randomizer] Error fetching image:",i),null}},fe=function(){return new Promise(function(e){w.alerts.showConfirmationAlert({title:"NSFW Content Warning",content:"NSFW content can only be sent in NSFW channels!",confirmText:"Okay",cancelText:"Cancel",confirmColor:"brand",isDismissable:!0,onConfirm:function(){return e(!0)},onCancel:function(){return e(!1)}})})},ge={name:"nsfw",description:"Include NSFW content?",type:5,required:!1,displayName:"nsfw",displayDescription:"Include NSFW content?"},Je={name:"konoself",displayName:"konoself",description:"Fetch a random image from KonoChan for yourself.",displayDescription:"Fetch a random image from KonoChan for yourself.",options:[ge],execute:async function(e,t){try{const a=new Map((e||[]).map(function(o){return[o.name,o]})).get("nsfw")?.value||!1,s=r.storage.hiddenSettings?.konochanBypassNsfw||!1;if(console.log(`[KonoSelf] NSFW: ${a}, Channel NSFW: ${t.channel.nsfw}, Bypass: ${s}`),a&&!t.channel.nsfw&&!s)return fe(),null;const i=await ue(a);return i&&Ye.sendBotMessage(t.channel.id,`Here's your random image: ${i}`),null}catch(a){return console.error("[KonoSelf] Error:",a),null}},applicationId:"-1",inputType:1,type:1},Qe={name:"konosend",displayName:"konosend",description:"Fetch a random image from KonoChan and send it to the channel.",displayDescription:"Fetch a random image from KonoChan and send it to the channel.",options:[ge],execute:async function(e,t){try{const a=new Map((e||[]).map(function(c){return[c.name,c]})).get("nsfw")?.value||!1,s=r.storage.hiddenSettings?.konochanBypassNsfw||!1;if(console.log(`[KonoSend] NSFW: ${a}, Channel NSFW: ${t.channel.nsfw}, Bypass: ${s}`),a&&!t.channel.nsfw&&!s)return fe(),null;const i=await ue(a);if(!i)return null;const o=Date.now().toString();return Xe.sendMessage(t.channel.id,{content:i},void 0,{nonce:o}),null}catch(a){return console.error("[KonoSend] Error:",a),{type:4}}},applicationId:"-1",inputType:1,type:1},me=g.findByProps("getAPIBaseURL","get"),Ze=g.findByProps("sendMessage"),et=async function(e,t,a){const s=t?`&author_id=${t}`:"",i=a?`&channel_id=${a}`:"",o=t?"":"&min_id=0";return(await me.get({url:`/guilds/${e}/messages/search`,query:`include_nsfw=true${s}${i}${o}&sort_by=timestamp&sort_order=asc&offset=0`})).body.messages[0][0]},tt=async function(e,t){const a=t?`&author_id=${t}`:"",s=t?"":"&min_id=0";return(await me.get({url:`/channels/${e}/messages/search`,query:`&sort_by=timestamp&sort_order=asc&offset=0${a}${s}`})).body.messages[0][0]},nt={name:"firstmessage",displayName:"firstmessage",description:"Tired of scrolling to first message?",displayDescription:"Tired of scrolling to first message?",options:[{name:"user",displayName:"user",description:"Target user to get their first message in this server/dm",displayDescription:"Target user to get their first message in this server/dm",type:6,required:!1},{name:"channel",displayName:"channel",description:"Target channel to get first message of",displayDescription:"Target channel to get first message of",type:7,required:!1},{name:"send",displayName:"send",description:"Whether to send the resulting url",displayDescription:"Whether to send the resulting url",type:5,required:!1}],execute:async function(e,t){try{const a=new Map(e.map(function(C){return[C.name,C]})),s=a.get("user")?.value,i=a.get("channel")?.value,o=a.get("send")?.value,c=t.guild?.id,l=t.channel.id,d=t.channel.type===1;if(d&&i)return m.showToast("Channel option cannot be used in DMs",3e3),null;let u="https://discord.com/channels/",f;if(d)f=await tt(l,s),u+=`@me/${l}/${f.id}`;else{f=await et(c,s,i);const C=i||f.channel_id;u+=`${c}/${C}/${f.id}`}if(o){const C=Date.now().toString();Ze.sendMessage(t.channel.id,{content:u},void 0,{nonce:C})}else n.ReactNative.Linking.openURL(u);return null}catch(a){return console.error("[FirstMessage] Error:",a),m.showToast("Failed to fetch first message",3e3),null}},applicationId:"-1",inputType:1,type:1},at=g.findByProps("sendMessage"),rt=g.findByProps("sendBotMessage","sendMessage","receiveMessage");function st(){let{height:e,width:t,scale:a}=n.ReactNative.Dimensions.get("screen");return e*=a,t*=a,{width:t,height:e}}function it(){try{const e=new Date,t=new Date(e.getTime()+e.getTimezoneOffset()*6e4),a=t.getFullYear(),s=String(t.getMonth()+1).padStart(2,"0"),i=String(t.getDate()).padStart(2,"0"),o=String(t.getHours()).padStart(2,"0"),c=String(t.getMinutes()).padStart(2,"0"),l=String(t.getSeconds()).padStart(2,"0");return`${a}-${s}-${i} ${o}:${c}:${l}`}catch{return"Unknown"}}function ot(){try{const e=g.findByProps("memory");if(!e)return{cpuCoreCount:"N/A",cpuPerc:"N/A",memUsage:"N/A"};const{cpuCoreCount:t,cpuPercentage:a,memory:s}=e,i=a?a.toFixed(2)+"%":"N/A",o=s?parseFloat((s/1e3).toPrecision(3))+" MB":"N/A";return{cpuCoreCount:t,cpuPerc:i,memUsage:o}}catch(e){return console.warn("Hardware info unavailable:",e),{cpuCoreCount:"N/A",cpuPerc:"N/A",memUsage:"N/A"}}}function ct(){try{const{NativeModules:e}=n.ReactNative;return(e.InfoDictionaryManager??e.RTNClientInfoManager)||{}}catch(e){return console.warn("Discord info unavailable:",e),{}}}function lt(){try{const{cpuCoreCount:e,cpuPerc:t,memUsage:a}=ot(),s=ct(),i=(typeof ne.getDebugInfo=="function"?ne.getDebugInfo():{})||{},{vendetta:o,discord:c,react:l,hermes:d,os:u,device:f}=i,C=it(),{version:k,bytecodeVersion:T}=d||{},{version:P,nativeVersion:K}=l||{},{name:v,version:A,sdk:F}=u||{},{manufacturer:L,brand:Ie,model:ke,codename:fn}=f||{},{version:gn}=o||{},{version:mn,build:yn}=c||{},pn=v=="iOS"?fn:`${Ie} ${ke}`,{width:hn,height:bn}=st(),Te={Device:{Device:pn||"Unknown",Model:ke||"Unknown",Manufacturer:L||"Unknown",Brand:Ie||"Unknown",Display:`${hn}x${bn}`},Hardware:{"CPU Cores":e||"N/A","CPU Usage":t,"Memory Usage":a},Software:{OS:v||"Unknown",Version:A||"Unknown"},Discord:{Version:mn||"Unknown",Build:yn||"Unknown",Vendetta:gn||"Unknown"},React:{Version:P||"Unknown","Hermes Bytecode":T||"Unknown",Hermes:k||"Unknown",Native:K||"Unknown"},Time:{UTC:C}};return F&&(Te.Software["SDK Version"]=F),Te}catch(e){throw console.error("Error generating system info:",e),e}}const ye=["device","hardware","software","discord","react","time","ephemeral"];for(const e of ye)r.storage[e]===void 0&&(r.storage[e]=!0);function dt(e,t){try{const a=[`__System Information__ -`],s=lt();Object.keys(s).forEach(function(c){const l=r.storage[c.toLowerCase()],d=e.find(function(u){return u.name==c.toLowerCase()})?.value??l;(d||l)&&!(l&&!d)&&(a.push(`[**${c}**]`),Object.keys(s[c]).forEach(function(u){a.push(`> ${u}: ${s[c][u]}`)}))});const i=r.storage.ephemeral,o=e.find(function(c){return c.name=="ephemeral"})?.value??i;if((o||i)&&!(i&&!o))return rt.sendBotMessage(t.channel.id,a.join(` -`)),null;{const c=Date.now().toString();return at.sendMessage(t.channel.id,{content:a.join(` -`)},void 0,{nonce:c}),null}}catch(a){return console.error("[Sysinfo] Error:",a),null}}const ut={name:"sysinfo",displayName:"sysinfo",description:"Display system information",displayDescription:"Display system information",options:[{name:"ephemeral",displayName:"ephemeral",description:"Keep sysinfo ephemeral (default: true)",displayDescription:"Keep sysinfo ephemeral (default: true)",type:5,required:!1},...ye.slice(0,-1).map(function(e){return{name:e,displayName:e,description:`Display the ${e} section. Set default in settings.`,displayDescription:`Display the ${e} section. Set default in settings.`,type:5,required:!1}})],execute:dt,applicationId:"-1",inputType:1,type:1},pe=g.findByProps("sendMessage","receiveMessage"),ft=g.findByStoreName("SpotifyStore");async function gt(e,t){return r.storage.enabledCommands?.spotifyTrack?G(t,function(a){return`https://open.spotify.com/track/${a.id}`}):null}async function mt(e,t){return r.storage.enabledCommands?.spotifyAlbum?G(t,function(a){return`https://open.spotify.com/album/${a.album.id}`}):null}async function yt(e,t){return r.storage.enabledCommands?.spotifyArtists?G(t,function(a){return a.artists.map(function(s){return`[${s.name}](${s.external_urls.spotify})`}).join(` -`)}):null}async function pt(e,t){return r.storage.enabledCommands?.spotifyCover?G(t,function(a){return a.album.image.url}):null}async function G(e,t){try{const a=e.channel.id,s=ft?.getTrack?.();if(!s){const c=Date.now().toString();return pe.sendMessage(a,{content:"You are not listening to any track."},void 0,{nonce:c}),null}const i=t(s),o=Date.now().toString();return pe.sendMessage(a,{content:i},void 0,{nonce:o}),null}catch(a){return console.error("[Spotify Command] Error:",a),null}}const ht={name:"spotify track",displayName:"spotify track",description:"Sends your current Spotify track",displayDescription:"Sends your current Spotify track",applicationId:"-1",inputType:1,type:1,execute:gt},bt={name:"spotify album",displayName:"spotify album",description:"Sends your current track's album",displayDescription:"Sends your current track's album",applicationId:"-1",inputType:1,type:1,execute:mt},vt={name:"spotify artists",displayName:"spotify artists",description:"Sends your current track's artists",displayDescription:"Sends your current track's artists",applicationId:"-1",inputType:1,type:1,execute:yt},Ct={name:"spotify cover",displayName:"spotify cover",description:"Sends your current track's cover",displayDescription:"Sends your current track's cover",applicationId:"-1",inputType:1,type:1,execute:pt},wt=g.findByProps("sendMessage"),St={name:"gary",displayName:"gary",description:"Send a random Gary image to the channel.",displayDescription:"Send a random Gary image to the channel.",options:[],execute:async function(e,t){try{r.storage.garySettings||(r.storage.garySettings={imageSource:"gary"});const a=r.storage.garySettings.imageSource||"gary";console.log(`[Gary Command] Using image source: ${a}`);const s=await Be(a);if(!s)return console.log("[Gary Command] No image URL received"),null;console.log(`[Gary Command] Sending image: ${s}`);const i=Date.now().toString();return wt.sendMessage(t.channel.id,{content:s},void 0,{nonce:i}),{type:4}}catch(a){return console.error("[Gary] Error:",a),null}},applicationId:"-1",inputType:1,type:1},he=g.findByProps("sendMessage","receiveMessage"),Rt=g.findByProps("getLastSelectedChannelId"),Et=g.findByProps("createBotMessage"),Nt=g.findByProps("BOT_AVATARS");function j(e,t,a){const s=e??Rt?.getChannelId?.(),i=Et.createBotMessage({channelId:s,content:"",embeds:a});i.author.username="Astolfo",i.author.avatar="Astolfo",Nt.BOT_AVATARS.Astolfo="https://i.pinimg.com/736x/50/77/1f/50771f45b1c015cfbb8b0853ba7b8521.jpg",typeof t=="string"?i.content=t:Object.assign(i,t),he.receiveMessage(s,i)}const It={name:"lovefemboys",displayName:"lovefemboys",description:"Get an image of a femboy",displayDescription:"Get an image of a femboy",options:[{name:"nsfw",displayName:"nsfw",description:"Get the result from r/femboys instead of r/femboy (NSFW)",displayDescription:"Get the result from r/femboys instead of r/femboy (NSFW)",required:!1,type:5},{name:"sort",displayName:"sort",description:"Changes the way reddit sorts.",displayDescription:"Changes the way reddit sorts",required:!1,type:3},{name:"silent",displayName:"silent",description:"Makes it so only you can see the message.",displayDescription:"Makes it so only you can see the message.",required:!1,type:5}],applicationId:"-1",inputType:1,type:1,execute:async function(e,t){try{const a=e.find(function(l){return l.name==="nsfw"})?.value;let s=e.find(function(l){return l.name==="sort"})?.value;const i=e.find(function(l){return l.name==="silent"})?.value;if(typeof s>"u"&&(s=r.storage.sortdefs),!["best","hot","new","rising","top","controversial"].includes(s)){j(t.channel.id,"Incorrect sorting type. Valid options are\n`best`, `hot`, `new`, `rising`, `top`, `controversial`.",[]);return}if(a&&!await new Promise(function(l){w.alerts.showConfirmationAlert({title:"\u26A0\uFE0F NSFW Content Warning",content:"This command will send NSFW (Not Safe For Work) content from r/femboys. Are you sure you want to continue?",confirmText:"Yes, Continue",onConfirm:function(){return l(!0)},cancelText:"Cancel",onCancel:function(){return l(!1)}})}))return null;let o=await fetch(`https://www.reddit.com/r/femboy/${s}.json?limit=100`).then(function(l){return l.json()});if(!t.channel.nsfw_&&a&&r.storage.nsfwwarn&&!(i??!0)){j(t.channel.id,`This channel is not marked as NSFW -(You can disable this check in plugin settings)`,[]);return}a&&(o=await fetch(`https://www.reddit.com/r/femboys/${s}.json?limit=100`).then(function(l){return l.json()})),o=o.data?.children?.[Math.floor(Math.random()*o.data?.children?.length)]?.data;const c=await fetch(`https://www.reddit.com/u/${o?.author}/about.json`).then(function(l){return l.json()});if(i??!0)j(t.channel.id,"",[{type:"rich",title:o?.title,url:`https://reddit.com${o?.permalink}`,author:{name:`u/${o?.author} \u2022 r/${o?.subreddit}`,proxy_icon_url:c?.data.icon_img.split("?")[0],icon_url:c?.data.icon_img.split("?")[0]},image:{proxy_url:o?.url_overridden_by_dest?.replace(/.gifv$/g,".gif")??o?.url.replace(/.gifv$/g,".gif"),url:o?.url_overridden_by_dest?.replace(/.gifv$/g,".gif")??o?.url?.replace(/.gifv$/g,".gif"),width:o?.preview?.images?.[0]?.source?.width,height:o?.preview?.images?.[0]?.source?.height},color:"0xf4b8e4"}]);else{const l=Date.now().toString();he.sendMessage(t.channel.id,{content:o?.url_overridden_by_dest??o?.url},void 0,{nonce:l})}}catch(a){console.error("[LoveFemboys] Error:",a),j(t.channel.id,"ERROR !!!!!!!!!!!! \u{1F62D}\u{1F62D}\u{1F62D} Check debug logs!! \u{1F97A}\u{1F97A}\u{1F97A}",[])}}},kt=g.findByProps("sendMessage"),Tt=g.findByProps("sendBotMessage","sendMessage","receiveMessage"),At={name:"ip",displayName:"ip",description:"IP address and domain lookup",displayDescription:"IP address and domain lookup",options:[{name:"query",displayName:"query",description:"Enter IPv4/IPv6 address or domain name",displayDescription:"Enter IPv4/IPv6 address or domain name",type:3,required:!0},{name:"send",displayName:"send",description:"Send to chat",displayDescription:"Send to chat",type:5,required:!1},{name:"ephemeral",displayName:"ephemeral",description:"Send as ephemeral message (only you can see)",displayDescription:"Send as ephemeral message (only you can see)",type:5,required:!1}],execute:async function(e,t){try{const a=e.find(function(u){return u.name==="query"})?.value,s=e.find(function(u){return u.name==="send"})?.value||!1,i=e.find(function(u){return u.name==="ephemeral"})?.value||!1;if(!a){const u="\u274C Query parameter is required!";return i?{type:4,data:{content:u,flags:64}}:(m.showToast(u,b.getAssetIDByName("CircleXIcon")),null)}!i&&!s&&m.showToast(`Looking up IP information for ${a}...`,b.getAssetIDByName("DownloadIcon"));const o=`http://ipwhois.app/json/${encodeURIComponent(a)}?objects=success,ip,type,as,org,isp,continent,country,country_capital,city,region,country_phone,latitude,longitude,timezone,currency,completed_requests`,c=await fetch(o);if(!c.ok)throw new Error(`HTTP ${c.status}: ${c.statusText}`);const l=await c.json();if(!l.success){const u=`\u274C Failed to lookup IP information for: ${a}`;return i?{type:4,data:{content:u,flags:64}}:(m.showToast(u,b.getAssetIDByName("CircleXIcon")),null)}const d=`\`\`\`json -${JSON.stringify(l,null,4)} -\`\`\``;if(i)return{type:4,data:{content:d,flags:64}};if(s){const u=Date.now().toString();return kt.sendMessage(t.channel.id,{content:d},void 0,{nonce:u}),{type:4}}else return Tt.sendBotMessage(t.channel.id,d),null}catch(a){console.error("[IP] Command error:",a);const s=`\u274C An error occurred while looking up IP information: ${a.message||"Unknown error"}`;return e?.find?.(function(i){return i.name==="ephemeral"})?.value??!1?{type:4,data:{content:s,flags:64}}:(m.showToast(s,b.getAssetIDByName("CircleXIcon")),null)}},applicationId:"-1",inputType:1,type:1},Lt=g.findByProps("sendMessage"),Dt=g.findByProps("sendBotMessage","sendMessage","receiveMessage"),$t=["avatar","classic","cuddle","fox_girl","gecg","holo","kemonomimi","kiss","neko","ngif","smug","spank","tickle","waifu","wallpaper","woof"];async function Pt(e,t){const a=[];for(let s=0;s0&&await new Promise(function(c){return setTimeout(c,1e3)});const i=await fetch(`https://nekos.life/api/v2/img/${e}`);if(!i.ok){console.error(`[NekosLife] API request failed: ${i.status}`);continue}const o=await i.json();o.url&&a.push(o.url)}catch(i){console.error(`[NekosLife] Error fetching image ${s+1}:`,i)}return a}function xt(e){return!e||typeof e!="string"?!1:$t.includes(e.toLowerCase().trim())}const Bt={name:"nekoslife",displayName:"nekoslife",description:"Get SFW images/gifs from nekos.life",displayDescription:"Get SFW images/gifs from nekos.life",options:[{name:"category",displayName:"category",description:"Category name (e.g. neko, waifu, cuddle, etc.)",displayDescription:"Category name (e.g. neko, waifu, cuddle, etc.)",type:3,required:!0},{name:"limit",displayName:"limit",description:"Number of images (1-5, default: 1)",displayDescription:"Number of images (1-5, default: 1)",type:4,required:!1},{name:"send",displayName:"send",description:"Send to chat",displayDescription:"Send to chat",type:5,required:!1},{name:"ephemeral",displayName:"ephemeral",description:"Send as ephemeral message (only you can see)",displayDescription:"Send as ephemeral message (only you can see)",type:5,required:!1}],execute:async function(e,t){try{console.log("[NekosLife] Command executed with args:",e);const a=e.find(function(f){return f.name==="category"})?.value,s=e.find(function(f){return f.name==="limit"})?.value,i=e.find(function(f){return f.name==="send"})?.value||!1,o=e.find(function(f){return f.name==="ephemeral"})?.value||!1;if(console.log("[NekosLife] Parsed values:",{categoryInput:a,limitInput:s,shouldSend:i,isEphemeral:o}),!a||typeof a!="string"){const f="\u274C Category is required! Examples: neko, waifu, cuddle, kiss";return console.error("[NekosLife] No category provided"),o?{type:4,data:{content:f,flags:64}}:(m.showToast(f,b.getAssetIDByName("CircleXIcon")),null)}const c=a.toLowerCase().trim();if(!xt(c)){const f=`\u274C Invalid SFW category "${a}". Valid: neko, waifu, cuddle, kiss, holo, etc.`;return o?{type:4,data:{content:f,flags:64}}:(m.showToast(f,b.getAssetIDByName("CircleXIcon")),null)}let l=1;s!=null&&(l=parseInt(String(s))||1,l=Math.max(1,Math.min(5,l))),console.log("[NekosLife] Processing SFW request:",{category:c,limit:l,shouldSend:i,isEphemeral:o}),o||m.showToast(`Fetching ${l} SFW image(s) from nekos.life...`,b.getAssetIDByName("DownloadIcon"));const d=await Pt(c,l);if(d.length===0){const f="\u274C Failed to fetch images from nekos.life. Try again later!";return o?{type:4,data:{content:f,flags:64}}:(m.showToast(f,b.getAssetIDByName("CircleXIcon")),null)}const u=d.join(` -`);if(o)return console.log("[NekosLife] Sending ephemeral response"),{type:4,data:{content:u,flags:64}};if(i){console.log("[NekosLife] Sending to chat");const f=Date.now().toString();return Lt.sendMessage(t.channel.id,{content:u},void 0,{nonce:f}),null}else return console.log("[NekosLife] Sending as bot message"),Dt.sendBotMessage(t.channel.id,u),null}catch(a){console.error("[NekosLife] Command error:",a);const s="\u274C An error occurred while fetching images.";return e?.find?.(function(i){return i.name==="ephemeral"})?.value??!1?{type:4,data:{content:s,flags:64}}:(m.showToast(s,b.getAssetIDByName("CircleXIcon")),null)}},applicationId:"-1",inputType:1,type:1},Ft=g.findByProps("sendBotMessage","sendMessage"),x=g.findByProps("getAllFriendInvites","createFriendInvite","revokeFriendInvites"),Mt=g.findByProps("getCurrentUser")?.getCurrentUser;function be(e,t){const a=Date.now().toString();Ft.sendMessage(e.channel.id,{content:t},void 0,{nonce:a})}const _t={name:"invite create",displayName:"invite create",description:"Generates a friend invite link.",displayDescription:"Generates a friend invite link.",type:1,applicationId:"-1",inputType:1,execute:async function(e,t){try{if(!Mt?.().phone)return m.showToast("You need a phone number connected to your account!",b.getAssetIDByName("Small")),null;const a=await x.createFriendInvite({code:null,recipient_phone_number_or_email:null,contact_visibility:0,filter_visibilities:[],filtered_invite_suggestions_index:0});if(a?.code){const s=Math.floor(new Date(a.expires_at).getTime()/1e3),i=`https://discord.gg/${a.code} \xB7 Expires: `;be(t,i),m.showToast("Friend invite created!",b.getAssetIDByName("Check"))}else throw new Error("No invite code generated");return null}catch(a){return console.error("[FriendInvite] Create error:",a),m.showToast("Error creating friend invite",b.getAssetIDByName("Small")),null}}},Vt={name:"view invites",displayName:"view invites",description:"View your current friend invite links that you've made.",displayDescription:"View your current friend invite links that you've made.",type:1,applicationId:"-1",execute:async function(e,t){try{const a=await x.getAllFriendInvites();if(!a?.length)return m.showToast("No active friend invites found",b.getAssetIDByName("Info")),null;const s=a.map(function(i){const o=Math.floor(new Date(i.expires_at).getTime()/1e3);return`_https://discord.gg/${i.code}_ \xB7 Expires: \xB7 Uses: \`${i.uses}/${i.max_uses}\``});return be(t,`**Your Active Friend Invites:** +Source: ${e.source}`),t},Be={name:"catfact",displayName:"catfact",description:"Sends a random cat fact.",displayDescription:"Sends a random cat fact.",applicationId:"-1",inputType:1,type:1,execute:async function(e,t){try{const r=await De(),s=Date.now().toString();return Y.sendMessage(t.channel.id,{content:J(r)},void 0,{nonce:s}),null}catch(r){return console.error("[CatFact] Error:",r),m.showToast("Failed to fetch cat fact",3e3),null}}},Fe={name:"dogfact",displayName:"dogfact",description:"Sends a dog fact.",displayDescription:"Sends a dog fact.",applicationId:"-1",inputType:1,type:1,execute:async function(e,t){try{const r=await $e(),s=Date.now().toString();return Y.sendMessage(t.channel.id,{content:J(r)},void 0,{nonce:s}),null}catch(r){return console.error("[DogFact] Error:",r),m.showToast("Failed to fetch dog fact",3e3),null}}},Me={name:"useless",displayName:"useless",description:"Sends a useless fact.",displayDescription:"Sends a useless fact.",applicationId:"-1",inputType:1,type:1,execute:async function(e,t){try{const r=await Le(),s=Date.now().toString();return Y.sendMessage(t.channel.id,{content:J(r)},void 0,{nonce:s}),null}catch(r){return console.error("[UselessFact] Error:",r),m.showToast("Failed to fetch useless fact",3e3),null}}},$={CONTENT:"This list is over 2000 characters. Send anyway?",CONFIRM:"Send",CANCEL:"Cancel"},_e={DETAILED:"detailed"},Q="",V={SLM_NOT_INSTALLED:"This list is over 2000 characters. Install the Split Large Messages plugin to send it.",SLM_NOT_ENABLED:"This list is over 2000 characters. Enable the Split Large Messages plugin to send it."},ae={SEMICOL:"; ",NEW_LINE:` +`},Ve="Nothing to see here, huh...",re="github.com/fres621/vendetta-plugins",k={ENABLED:"\u2705",DISABLED:"\u274C",SELECTED:"\u2705",NOT_SELECTED:"\u274C"},Ue=g.findByProps("sendMessage","receiveMessage"),D=g.findByProps("sendBotMessage"),se=(function(){try{return g.findByStoreName("UserStore").getCurrentUser()?.premiumType===2?4e3:2e3}catch{return 2e3}})(),ie=function(e){return Object.keys(e).includes(re)},oe=function(e){return Object.values(e).find(function(t){return t.id==re})?.enabled},le=function(e){return e.find(function(t){return t.name===_e.DETAILED})?.value??!1},U=function(e){return!e||!Array.isArray(e)||e.length===0?"Unknown":e.filter(function(t){return t&&(typeof t=="string"||typeof t=="object"&&t.name)}).map(function(t){return typeof t=="string"?t:t.name||"Unknown"}).join(ae.SEMICOL)||"Unknown"},ce=function(e){return e.join(ae.NEW_LINE).trimEnd()},W=function(e){return ce(e).length},O=async function(e,t){const r=Date.now().toString();await Ue.sendMessage(e,{content:ce(t)},void 0,{nonce:r})},de=function(e,t){return[`**My ${e} List | ${t} ${e}s**`,Q]};async function We(e,t){try{const r=le(e),s=a.storage.themeListAlwaysDetailed??!1;if(!M.themes||typeof M.themes!="object"){const u=t.channel.id;return D.sendBotMessage(u,"No themes found or themes not loaded yet."),null}const i=Object.values(M.themes),o=t.channel.id,l=de("Theme",Object.keys(M.themes).length);if(i.length)for(const u of i){if(!u||typeof u!="object")continue;const{selected:d,data:f,id:v}=u,A=f?.name||"Unknown Theme",L=f?.description||"No description",P=f?.authors;r||s?l.push(`> **Name**: ${A}`,`> **Selected**: ${d?k.SELECTED:k.NOT_SELECTED}`,`> **Description**: ${L}`,`> **Authors**: ${U(P)}`,`> **[Install!](${v||"unknown"})**`,Q):l.push(`> ${d?k.SELECTED:k.NOT_SELECTED} **${A}** by ${U(P)}`)}else l.push(Ve);const c=W(l)>se;if(c&&!ie(T.plugins))D.sendBotMessage(o,V.SLM_NOT_INSTALLED);else if(c&&!oe(T.plugins))D.sendBotMessage(o,V.SLM_NOT_ENABLED);else{if(W(l)>2e3)return w.alerts.showConfirmationAlert({content:$.CONTENT,confirmText:$.CONFIRM,cancelText:$.CANCEL,onConfirm:async function(){return await O(o,l)}});await O(o,l)}}catch(r){return console.error("[ThemeList] Error:",r),null}}async function Oe(e,t){try{const r=le(e),s=a.storage.pluginListAlwaysDetailed??!1,i=t.channel.id;if(!T.plugins||typeof T.plugins!="object")return D.sendBotMessage(i,"No plugins found or plugins not loaded yet."),null;const o=de("Plugin",Object.keys(T.plugins).length);for(const c of Object.values(T.plugins)){if(!c||typeof c!="object")continue;const{enabled:u,manifest:d,id:f}=c,v=d?.name||"Unknown Plugin",A=d?.description||"No description",L=d?.authors;r||s?o.push(`> **Name**: ${v}`,`> **Status**: ${u?k.ENABLED:k.DISABLED}`,`> **Description**: ${A}`,`> **Authors**: ${U(L)}`,`> **[Install!](${f||"unknown"})**`,Q):o.push(`> ${u?k.ENABLED:k.DISABLED} **${v}** by ${U(L)}`)}const l=W(o)>se;if(l&&!ie(T.plugins))D.sendBotMessage(i,V.SLM_NOT_INSTALLED);else if(l&&!oe(T.plugins))D.sendBotMessage(i,V.SLM_NOT_ENABLED);else{if(W(o)>2e3)return w.alerts.showConfirmationAlert({content:$.CONTENT,confirmText:$.CONFIRM,cancelText:$.CANCEL,onConfirm:async function(){return await O(i,o)}});await O(i,o)}}catch(r){return console.error("[PluginList] Error:",r),null}}const Ge={name:"plugin-list",displayName:"plugin list",description:"Send your plugin list to the current channel",displayDescription:"Send your plugin list to the current channel",options:[{name:"detailed",description:"Whether to send a list with detailed information.",type:5,required:!1,displayName:"detailed",displayDescription:"Whether to send a list with detailed information."}],execute:Oe,applicationId:"-1",inputType:1,type:1},je={name:"theme-list",displayName:"theme list",description:"Send your theme list to the current channel",displayDescription:"Send your theme list to the current channel",options:[{name:"detailed",description:"Whether to send a list with detailed information.",type:5,required:!1,displayName:"detailed",displayDescription:"Whether to send a list with detailed information."}],execute:We,applicationId:"-1",inputType:1,type:1},He=g.findByStoreName("UserStore"),ze=g.findByProps("sendMessage"),Ke={name:"petpet",displayName:"petpet",description:"PetPet someone",displayDescription:"PetPet someone",options:[{name:"user",description:"The user (or their id) to be patted",type:6,required:!0,displayName:"user",displayDescription:"The user (or their id) to be patted"}],execute:async function(e,t){try{const r=await He.getUser(e[0].value),s=r.getAvatarURL(512),i=await Pe(s,r.id),o=Date.now().toString();return ze.sendMessage(t.channel.id,{content:i.url},void 0,{nonce:o}),null}catch(r){return console.error("[PetPet] Error:",r),null}},applicationId:"-1",inputType:1,type:1},qe=g.findByProps("sendMessage"),Xe=g.findByProps("sendBotMessage","sendMessage","receiveMessage"),ue=async function(e){const t="https://konachan.com/post.json",r=e?"rating:explicit":"rating:safe",s=Math.floor(Math.random()*100);try{const i=await(await fetch(`${t}?tags=${r}&limit=1&page=${s}`)).json();return!Array.isArray(i)||i.length===0?null:i[0].file_url}catch(i){return console.error("[KonoChan Randomizer] Error fetching image:",i),null}},fe=function(){return new Promise(function(e){w.alerts.showConfirmationAlert({title:"NSFW Content Warning",content:"NSFW content can only be sent in NSFW channels!",confirmText:"Okay",cancelText:"Cancel",confirmColor:"brand",isDismissable:!0,onConfirm:function(){return e(!0)},onCancel:function(){return e(!1)}})})},ge={name:"nsfw",description:"Include NSFW content?",type:5,required:!1,displayName:"nsfw",displayDescription:"Include NSFW content?"},Ye={name:"konoself",displayName:"konoself",description:"Fetch a random image from KonoChan for yourself.",displayDescription:"Fetch a random image from KonoChan for yourself.",options:[ge],execute:async function(e,t){try{const r=new Map((e||[]).map(function(o){return[o.name,o]})).get("nsfw")?.value||!1,s=a.storage.hiddenSettings?.konochanBypassNsfw||!1;if(console.log(`[KonoSelf] NSFW: ${r}, Channel NSFW: ${t.channel.nsfw}, Bypass: ${s}`),r&&!t.channel.nsfw&&!s)return fe(),null;const i=await ue(r);return i&&Xe.sendBotMessage(t.channel.id,`Here's your random image: ${i}`),null}catch(r){return console.error("[KonoSelf] Error:",r),null}},applicationId:"-1",inputType:1,type:1},Je={name:"konosend",displayName:"konosend",description:"Fetch a random image from KonoChan and send it to the channel.",displayDescription:"Fetch a random image from KonoChan and send it to the channel.",options:[ge],execute:async function(e,t){try{const r=new Map((e||[]).map(function(l){return[l.name,l]})).get("nsfw")?.value||!1,s=a.storage.hiddenSettings?.konochanBypassNsfw||!1;if(console.log(`[KonoSend] NSFW: ${r}, Channel NSFW: ${t.channel.nsfw}, Bypass: ${s}`),r&&!t.channel.nsfw&&!s)return fe(),null;const i=await ue(r);if(!i)return null;const o=Date.now().toString();return qe.sendMessage(t.channel.id,{content:i},void 0,{nonce:o}),null}catch(r){return console.error("[KonoSend] Error:",r),{type:4}}},applicationId:"-1",inputType:1,type:1},me=g.findByProps("getAPIBaseURL","get"),Qe=g.findByProps("sendMessage"),Ze=async function(e,t,r){const s=t?`&author_id=${t}`:"",i=r?`&channel_id=${r}`:"",o=t?"":"&min_id=0";return(await me.get({url:`/guilds/${e}/messages/search`,query:`include_nsfw=true${s}${i}${o}&sort_by=timestamp&sort_order=asc&offset=0`})).body.messages[0][0]},et=async function(e,t){const r=t?`&author_id=${t}`:"",s=t?"":"&min_id=0";return(await me.get({url:`/channels/${e}/messages/search`,query:`&sort_by=timestamp&sort_order=asc&offset=0${r}${s}`})).body.messages[0][0]},tt={name:"firstmessage",displayName:"firstmessage",description:"Tired of scrolling to first message?",displayDescription:"Tired of scrolling to first message?",options:[{name:"user",displayName:"user",description:"Target user to get their first message in this server/dm",displayDescription:"Target user to get their first message in this server/dm",type:6,required:!1},{name:"channel",displayName:"channel",description:"Target channel to get first message of",displayDescription:"Target channel to get first message of",type:7,required:!1},{name:"send",displayName:"send",description:"Whether to send the resulting url",displayDescription:"Whether to send the resulting url",type:5,required:!1}],execute:async function(e,t){try{const r=new Map(e.map(function(v){return[v.name,v]})),s=r.get("user")?.value,i=r.get("channel")?.value,o=r.get("send")?.value,l=t.guild?.id,c=t.channel.id,u=t.channel.type===1;if(u&&i)return m.showToast("Channel option cannot be used in DMs",3e3),null;let d="https://discord.com/channels/",f;if(u)f=await et(c,s),d+=`@me/${c}/${f.id}`;else{f=await Ze(l,s,i);const v=i||f.channel_id;d+=`${l}/${v}/${f.id}`}if(o){const v=Date.now().toString();Qe.sendMessage(t.channel.id,{content:d},void 0,{nonce:v})}else n.ReactNative.Linking.openURL(d);return null}catch(r){return console.error("[FirstMessage] Error:",r),m.showToast("Failed to fetch first message",3e3),null}},applicationId:"-1",inputType:1,type:1},nt=g.findByProps("sendMessage"),at=g.findByProps("sendBotMessage","sendMessage","receiveMessage");function rt(){let{height:e,width:t,scale:r}=n.ReactNative.Dimensions.get("screen");return e*=r,t*=r,{width:t,height:e}}function st(){try{const e=new Date,t=new Date(e.getTime()+e.getTimezoneOffset()*6e4),r=t.getFullYear(),s=String(t.getMonth()+1).padStart(2,"0"),i=String(t.getDate()).padStart(2,"0"),o=String(t.getHours()).padStart(2,"0"),l=String(t.getMinutes()).padStart(2,"0"),c=String(t.getSeconds()).padStart(2,"0");return`${r}-${s}-${i} ${o}:${l}:${c}`}catch{return"Unknown"}}function it(){try{const e=g.findByProps("memory");if(!e)return{cpuCoreCount:"N/A",cpuPerc:"N/A",memUsage:"N/A"};const{cpuCoreCount:t,cpuPercentage:r,memory:s}=e,i=r?r.toFixed(2)+"%":"N/A",o=s?parseFloat((s/1e3).toPrecision(3))+" MB":"N/A";return{cpuCoreCount:t,cpuPerc:i,memUsage:o}}catch(e){return console.warn("Hardware info unavailable:",e),{cpuCoreCount:"N/A",cpuPerc:"N/A",memUsage:"N/A"}}}function ot(){try{const{NativeModules:e}=n.ReactNative;return(e.InfoDictionaryManager??e.RTNClientInfoManager)||{}}catch(e){return console.warn("Discord info unavailable:",e),{}}}function lt(){try{const{cpuCoreCount:e,cpuPerc:t,memUsage:r}=it();ot();const s=(typeof ne.getDebugInfo=="function"?ne.getDebugInfo():{})||{},{vendetta:i,discord:o,react:l,hermes:c,os:u,device:d}=s,f=st(),{version:v,bytecodeVersion:A}=c||{},{version:L,nativeVersion:P}=l||{},{name:F,version:C,sdk:N}=u||{},{manufacturer:K,brand:I,model:Ie,codename:un}=d||{},{version:fn}=i||{},{version:gn,build:mn}=o||{},yn=F=="iOS"?un:`${I} ${Ie}`,{width:pn,height:hn}=rt(),Te={Device:{Device:yn||"Unknown",Model:Ie||"Unknown",Manufacturer:K||"Unknown",Brand:I||"Unknown",Display:`${pn}x${hn}`},Hardware:{"CPU Cores":e||"N/A","CPU Usage":t,"Memory Usage":r},Software:{OS:F||"Unknown",Version:C||"Unknown"},Discord:{Version:gn||"Unknown",Build:mn||"Unknown",Vendetta:fn||"Unknown"},React:{Version:L||"Unknown","Hermes Bytecode":A||"Unknown",Hermes:v||"Unknown",Native:P||"Unknown"},Time:{UTC:f}};return N&&(Te.Software["SDK Version"]=N),Te}catch(e){throw console.error("Error generating system info:",e),e}}const ye=["device","hardware","software","discord","react","time","ephemeral"];for(const e of ye)a.storage[e]===void 0&&(a.storage[e]=!0);function ct(e,t){try{const r=[`__System Information__ +`],s=lt();Object.keys(s).forEach(function(l){const c=a.storage[l.toLowerCase()],u=e.find(function(d){return d.name==l.toLowerCase()})?.value??c;(u||c)&&!(c&&!u)&&(r.push(`[**${l}**]`),Object.keys(s[l]).forEach(function(d){r.push(`> ${d}: ${s[l][d]}`)}))});const i=a.storage.ephemeral,o=e.find(function(l){return l.name=="ephemeral"})?.value??i;if((o||i)&&!(i&&!o))return at.sendBotMessage(t.channel.id,r.join(` +`)),null;{const l=Date.now().toString();return nt.sendMessage(t.channel.id,{content:r.join(` +`)},void 0,{nonce:l}),null}}catch(r){return console.error("[Sysinfo] Error:",r),null}}const dt={name:"sysinfo",displayName:"sysinfo",description:"Display system information",displayDescription:"Display system information",options:[{name:"ephemeral",displayName:"ephemeral",description:"Keep sysinfo ephemeral (default: true)",displayDescription:"Keep sysinfo ephemeral (default: true)",type:5,required:!1},...ye.slice(0,-1).map(function(e){return{name:e,displayName:e,description:`Display the ${e} section. Set default in settings.`,displayDescription:`Display the ${e} section. Set default in settings.`,type:5,required:!1}})],execute:ct,applicationId:"-1",inputType:1,type:1},pe=g.findByProps("sendMessage","receiveMessage"),ut=g.findByStoreName("SpotifyStore");async function ft(e,t){return a.storage.enabledCommands?.spotifyTrack?G(t,function(r){return`https://open.spotify.com/track/${r.id}`}):null}async function gt(e,t){return a.storage.enabledCommands?.spotifyAlbum?G(t,function(r){return`https://open.spotify.com/album/${r.album.id}`}):null}async function mt(e,t){return a.storage.enabledCommands?.spotifyArtists?G(t,function(r){return r.artists.map(function(s){return`[${s.name}](${s.external_urls.spotify})`}).join(` +`)}):null}async function yt(e,t){return a.storage.enabledCommands?.spotifyCover?G(t,function(r){return r.album.image.url}):null}async function G(e,t){try{const r=e.channel.id,s=ut?.getTrack?.();if(!s){const l=Date.now().toString();return pe.sendMessage(r,{content:"You are not listening to any track."},void 0,{nonce:l}),null}const i=t(s),o=Date.now().toString();return pe.sendMessage(r,{content:i},void 0,{nonce:o}),null}catch(r){return console.error("[Spotify Command] Error:",r),null}}const pt={name:"spotify track",displayName:"spotify track",description:"Sends your current Spotify track",displayDescription:"Sends your current Spotify track",applicationId:"-1",inputType:1,type:1,execute:ft},ht={name:"spotify album",displayName:"spotify album",description:"Sends your current track's album",displayDescription:"Sends your current track's album",applicationId:"-1",inputType:1,type:1,execute:gt},bt={name:"spotify artists",displayName:"spotify artists",description:"Sends your current track's artists",displayDescription:"Sends your current track's artists",applicationId:"-1",inputType:1,type:1,execute:mt},vt={name:"spotify cover",displayName:"spotify cover",description:"Sends your current track's cover",displayDescription:"Sends your current track's cover",applicationId:"-1",inputType:1,type:1,execute:yt},Ct=g.findByProps("sendMessage"),wt={name:"gary",displayName:"gary",description:"Send a random Gary image to the channel.",displayDescription:"Send a random Gary image to the channel.",options:[],execute:async function(e,t){try{a.storage.garySettings||(a.storage.garySettings={imageSource:"gary"});const r=a.storage.garySettings.imageSource||"gary";console.log(`[Gary Command] Using image source: ${r}`);const s=await xe(r);if(!s)return console.log("[Gary Command] No image URL received"),null;console.log(`[Gary Command] Sending image: ${s}`);const i=Date.now().toString();return Ct.sendMessage(t.channel.id,{content:s},void 0,{nonce:i}),{type:4}}catch(r){return console.error("[Gary] Error:",r),null}},applicationId:"-1",inputType:1,type:1},he=g.findByProps("sendMessage","receiveMessage"),St=g.findByProps("getLastSelectedChannelId"),Rt=g.findByProps("createBotMessage"),Et=g.findByProps("BOT_AVATARS");function j(e,t,r){const s=e??St?.getChannelId?.(),i=Rt.createBotMessage({channelId:s,content:"",embeds:r});i.author.username="Astolfo",i.author.avatar="Astolfo",Et.BOT_AVATARS.Astolfo="https://i.pinimg.com/736x/50/77/1f/50771f45b1c015cfbb8b0853ba7b8521.jpg",typeof t=="string"?i.content=t:Object.assign(i,t),he.receiveMessage(s,i)}const Nt={name:"lovefemboys",displayName:"lovefemboys",description:"Get an image of a femboy",displayDescription:"Get an image of a femboy",options:[{name:"nsfw",displayName:"nsfw",description:"Get the result from r/femboys instead of r/femboy (NSFW)",displayDescription:"Get the result from r/femboys instead of r/femboy (NSFW)",required:!1,type:5},{name:"sort",displayName:"sort",description:"Changes the way reddit sorts.",displayDescription:"Changes the way reddit sorts",required:!1,type:3},{name:"silent",displayName:"silent",description:"Makes it so only you can see the message.",displayDescription:"Makes it so only you can see the message.",required:!1,type:5}],applicationId:"-1",inputType:1,type:1,execute:async function(e,t){try{const r=e.find(function(c){return c.name==="nsfw"})?.value;let s=e.find(function(c){return c.name==="sort"})?.value;const i=e.find(function(c){return c.name==="silent"})?.value;if(typeof s>"u"&&(s=a.storage.sortdefs),!["best","hot","new","rising","top","controversial"].includes(s)){j(t.channel.id,"Incorrect sorting type. Valid options are\n`best`, `hot`, `new`, `rising`, `top`, `controversial`.",[]);return}if(r&&!await new Promise(function(c){w.alerts.showConfirmationAlert({title:"\u26A0\uFE0F NSFW Content Warning",content:"This command will send NSFW (Not Safe For Work) content from r/femboys. Are you sure you want to continue?",confirmText:"Yes, Continue",onConfirm:function(){return c(!0)},cancelText:"Cancel",onCancel:function(){return c(!1)}})}))return null;let o=await fetch(`https://www.reddit.com/r/femboy/${s}.json?limit=100`).then(function(c){return c.json()});if(!t.channel.nsfw_&&r&&a.storage.nsfwwarn&&!(i??!0)){j(t.channel.id,`This channel is not marked as NSFW +(You can disable this check in plugin settings)`,[]);return}r&&(o=await fetch(`https://www.reddit.com/r/femboys/${s}.json?limit=100`).then(function(c){return c.json()})),o=o.data?.children?.[Math.floor(Math.random()*o.data?.children?.length)]?.data;const l=await fetch(`https://www.reddit.com/u/${o?.author}/about.json`).then(function(c){return c.json()});if(i??!0)j(t.channel.id,"",[{type:"rich",title:o?.title,url:`https://reddit.com${o?.permalink}`,author:{name:`u/${o?.author} \u2022 r/${o?.subreddit}`,proxy_icon_url:l?.data.icon_img.split("?")[0],icon_url:l?.data.icon_img.split("?")[0]},image:{proxy_url:o?.url_overridden_by_dest?.replace(/.gifv$/g,".gif")??o?.url.replace(/.gifv$/g,".gif"),url:o?.url_overridden_by_dest?.replace(/.gifv$/g,".gif")??o?.url?.replace(/.gifv$/g,".gif"),width:o?.preview?.images?.[0]?.source?.width,height:o?.preview?.images?.[0]?.source?.height},color:"0xf4b8e4"}]);else{const c=Date.now().toString();he.sendMessage(t.channel.id,{content:o?.url_overridden_by_dest??o?.url},void 0,{nonce:c})}}catch(r){console.error("[LoveFemboys] Error:",r),j(t.channel.id,"ERROR !!!!!!!!!!!! \u{1F62D}\u{1F62D}\u{1F62D} Check debug logs!! \u{1F97A}\u{1F97A}\u{1F97A}",[])}}},It=g.findByProps("sendMessage"),Tt=g.findByProps("sendBotMessage","sendMessage","receiveMessage"),kt={name:"ip",displayName:"ip",description:"IP address and domain lookup",displayDescription:"IP address and domain lookup",options:[{name:"query",displayName:"query",description:"Enter IPv4/IPv6 address or domain name",displayDescription:"Enter IPv4/IPv6 address or domain name",type:3,required:!0},{name:"send",displayName:"send",description:"Send to chat",displayDescription:"Send to chat",type:5,required:!1},{name:"ephemeral",displayName:"ephemeral",description:"Send as ephemeral message (only you can see)",displayDescription:"Send as ephemeral message (only you can see)",type:5,required:!1}],execute:async function(e,t){try{const r=e.find(function(d){return d.name==="query"})?.value,s=e.find(function(d){return d.name==="send"})?.value||!1,i=e.find(function(d){return d.name==="ephemeral"})?.value||!1;if(!r){const d="\u274C Query parameter is required!";return i?{type:4,data:{content:d,flags:64}}:(m.showToast(d,b.getAssetIDByName("CircleXIcon")),null)}!i&&!s&&m.showToast(`Looking up IP information for ${r}...`,b.getAssetIDByName("DownloadIcon"));const o=`http://ipwhois.app/json/${encodeURIComponent(r)}?objects=success,ip,type,as,org,isp,continent,country,country_capital,city,region,country_phone,latitude,longitude,timezone,currency,completed_requests`,l=await fetch(o);if(!l.ok)throw new Error(`HTTP ${l.status}: ${l.statusText}`);const c=await l.json();if(!c.success){const d=`\u274C Failed to lookup IP information for: ${r}`;return i?{type:4,data:{content:d,flags:64}}:(m.showToast(d,b.getAssetIDByName("CircleXIcon")),null)}const u=`\`\`\`json +${JSON.stringify(c,null,4)} +\`\`\``;if(i)return{type:4,data:{content:u,flags:64}};if(s){const d=Date.now().toString();return It.sendMessage(t.channel.id,{content:u},void 0,{nonce:d}),{type:4}}else return Tt.sendBotMessage(t.channel.id,u),null}catch(r){console.error("[IP] Command error:",r);const s=`\u274C An error occurred while looking up IP information: ${r.message||"Unknown error"}`;return e?.find?.(function(i){return i.name==="ephemeral"})?.value??!1?{type:4,data:{content:s,flags:64}}:(m.showToast(s,b.getAssetIDByName("CircleXIcon")),null)}},applicationId:"-1",inputType:1,type:1},At=g.findByProps("sendMessage"),Lt=g.findByProps("sendBotMessage","sendMessage","receiveMessage"),$t=["avatar","classic","cuddle","fox_girl","gecg","holo","kemonomimi","kiss","neko","ngif","smug","spank","tickle","waifu","wallpaper","woof"];async function Dt(e,t){const r=[];for(let s=0;s0&&await new Promise(function(l){return setTimeout(l,1e3)});const i=await fetch(`https://nekos.life/api/v2/img/${e}`);if(!i.ok){console.error(`[NekosLife] API request failed: ${i.status}`);continue}const o=await i.json();o.url&&r.push(o.url)}catch(i){console.error(`[NekosLife] Error fetching image ${s+1}:`,i)}return r}function Pt(e){return!e||typeof e!="string"?!1:$t.includes(e.toLowerCase().trim())}const xt={name:"nekoslife",displayName:"nekoslife",description:"Get SFW images/gifs from nekos.life",displayDescription:"Get SFW images/gifs from nekos.life",options:[{name:"category",displayName:"category",description:"Category name (e.g. neko, waifu, cuddle, etc.)",displayDescription:"Category name (e.g. neko, waifu, cuddle, etc.)",type:3,required:!0},{name:"limit",displayName:"limit",description:"Number of images (1-5, default: 1)",displayDescription:"Number of images (1-5, default: 1)",type:4,required:!1},{name:"send",displayName:"send",description:"Send to chat",displayDescription:"Send to chat",type:5,required:!1},{name:"ephemeral",displayName:"ephemeral",description:"Send as ephemeral message (only you can see)",displayDescription:"Send as ephemeral message (only you can see)",type:5,required:!1}],execute:async function(e,t){try{console.log("[NekosLife] Command executed with args:",e);const r=e.find(function(f){return f.name==="category"})?.value,s=e.find(function(f){return f.name==="limit"})?.value,i=e.find(function(f){return f.name==="send"})?.value||!1,o=e.find(function(f){return f.name==="ephemeral"})?.value||!1;if(console.log("[NekosLife] Parsed values:",{categoryInput:r,limitInput:s,shouldSend:i,isEphemeral:o}),!r||typeof r!="string"){const f="\u274C Category is required! Examples: neko, waifu, cuddle, kiss";return console.error("[NekosLife] No category provided"),o?{type:4,data:{content:f,flags:64}}:(m.showToast(f,b.getAssetIDByName("CircleXIcon")),null)}const l=r.toLowerCase().trim();if(!Pt(l)){const f=`\u274C Invalid SFW category "${r}". Valid: neko, waifu, cuddle, kiss, holo, etc.`;return o?{type:4,data:{content:f,flags:64}}:(m.showToast(f,b.getAssetIDByName("CircleXIcon")),null)}let c=1;s!=null&&(c=parseInt(String(s))||1,c=Math.max(1,Math.min(5,c))),console.log("[NekosLife] Processing SFW request:",{category:l,limit:c,shouldSend:i,isEphemeral:o}),o||m.showToast(`Fetching ${c} SFW image(s) from nekos.life...`,b.getAssetIDByName("DownloadIcon"));const u=await Dt(l,c);if(u.length===0){const f="\u274C Failed to fetch images from nekos.life. Try again later!";return o?{type:4,data:{content:f,flags:64}}:(m.showToast(f,b.getAssetIDByName("CircleXIcon")),null)}const d=u.join(` +`);if(o)return console.log("[NekosLife] Sending ephemeral response"),{type:4,data:{content:d,flags:64}};if(i){console.log("[NekosLife] Sending to chat");const f=Date.now().toString();return At.sendMessage(t.channel.id,{content:d},void 0,{nonce:f}),null}else return console.log("[NekosLife] Sending as bot message"),Lt.sendBotMessage(t.channel.id,d),null}catch(r){console.error("[NekosLife] Command error:",r);const s="\u274C An error occurred while fetching images.";return e?.find?.(function(i){return i.name==="ephemeral"})?.value??!1?{type:4,data:{content:s,flags:64}}:(m.showToast(s,b.getAssetIDByName("CircleXIcon")),null)}},applicationId:"-1",inputType:1,type:1},Bt=g.findByProps("sendBotMessage","sendMessage"),x=g.findByProps("getAllFriendInvites","createFriendInvite","revokeFriendInvites"),Ft=g.findByProps("getCurrentUser")?.getCurrentUser;function be(e,t){const r=Date.now().toString();Bt.sendMessage(e.channel.id,{content:t},void 0,{nonce:r})}const Mt={name:"invite create",displayName:"invite create",description:"Generates a friend invite link.",displayDescription:"Generates a friend invite link.",type:1,applicationId:"-1",inputType:1,execute:async function(e,t){try{if(!Ft?.().phone)return m.showToast("You need a phone number connected to your account!",b.getAssetIDByName("Small")),null;const r=await x.createFriendInvite({code:null,recipient_phone_number_or_email:null,contact_visibility:0,filter_visibilities:[],filtered_invite_suggestions_index:0});if(r?.code){const s=Math.floor(new Date(r.expires_at).getTime()/1e3),i=`https://discord.gg/${r.code} \xB7 Expires: `;be(t,i),m.showToast("Friend invite created!",b.getAssetIDByName("Check"))}else throw new Error("No invite code generated");return null}catch(r){return console.error("[FriendInvite] Create error:",r),m.showToast("Error creating friend invite",b.getAssetIDByName("Small")),null}}},_t={name:"view invites",displayName:"view invites",description:"View your current friend invite links that you've made.",displayDescription:"View your current friend invite links that you've made.",type:1,applicationId:"-1",execute:async function(e,t){try{const r=await x.getAllFriendInvites();if(!r?.length)return m.showToast("No active friend invites found",b.getAssetIDByName("Info")),null;const s=r.map(function(i){const o=Math.floor(new Date(i.expires_at).getTime()/1e3);return`_https://discord.gg/${i.code}_ \xB7 Expires: \xB7 Uses: \`${i.uses}/${i.max_uses}\``});return be(t,`**Your Active Friend Invites:** ${s.join(` -`)}`),null}catch(a){return console.error("[FriendInvite] View error:",a),m.showToast("Error viewing friend invites",b.getAssetIDByName("Small")),null}}},Ut={name:"revoke invites",displayName:"revoke invites",description:"Revoke all your friend invite links.",displayDescription:"Revoke all your friend invite links.",type:1,applicationId:"-1",inputType:1,execute:async function(e,t){try{const a=await x.getAllFriendInvites();if(!a?.length)return m.showToast("No active friend invites to revoke",b.getAssetIDByName("Info")),null;await x.revokeFriendInvites();const s=await x.getAllFriendInvites();return s.length===0?m.showToast(`Successfully revoked all ${a.length} friend invite(s)!`,b.getAssetIDByName("Check")):m.showToast(`\u26A0\uFE0F Partially revoked invites. ${s.length} invite(s) remain active.`,b.getAssetIDByName("Warning")),null}catch(a){return console.error("[FriendInvite] Revoke error:",a),m.showToast("Error revoking friend invites",b.getAssetIDByName("Small")),null}}},{ScrollView:S}=g.findByProps("ScrollView"),{TableRowGroup:h,TableSwitchRow:y,TableCheckboxRow:vn,TableRadioGroup:Wt,TableRadioRow:H,Stack:R,TableRow:p}=g.findByProps("TableSwitchRow","TableCheckboxRow","TableRadioGroup","TableRadioRow","TableRowGroup","Stack","TableRow"),{TextInput:Cn}=g.findByProps("TextInput"),ve=g.findByProps("TextStyleSheet").TextStyleSheet,Ot=g.findByStoreName("ThemeStore"),Ce=g.findByProps("colors","unsafe_rawColors"),Gt=Ce?.internal??Ce?.meta;function we(e,t){const a=Ot?.theme;return e&&Gt?.resolveSemanticColor(a,e)||"#000000"}function jt(){const[e,t]=n.React.useState(0),[a,s]=n.React.useState(null),[i,o]=n.React.useState(null),[c,l]=n.React.useState(!1);n.React.useEffect(function(){r.storage.sidebarEnabled===void 0&&(r.storage.sidebarEnabled=!0)},[]);let d=null;try{d=g.findByProps("getUser","getCurrentUser")?.getCurrentUser?.()}catch(v){console.warn("[Commands Header] Failed to get current user:",v)}let u=null,f=null;try{u=g.findByProps("getUserAvatarURL")?.getUserAvatarURL}catch(v){console.warn("[Commands Header] Failed to get getUserAvatarURL:",v)}try{f=g.findByProps("getDefaultAvatarURL")?.getDefaultAvatarURL}catch(v){console.warn("[Commands Header] Failed to get getDefaultAvatarURL:",v)}const C=n.ReactNative.StyleSheet.create({container:{flexDirection:"row",alignItems:"center",paddingVertical:24,paddingHorizontal:16,width:"100%",justifyContent:"center"},leftSection:{flexDirection:"row",alignItems:"center",flex:1,gap:20,maxWidth:500},avatarContainer:{position:"relative",width:96,height:96,justifyContent:"center",alignItems:"center"},avatarWrapper:{width:96,height:96,borderRadius:24,justifyContent:"center",alignItems:"center",overflow:"hidden",borderWidth:2,borderColor:w.semanticColors.MOBILE_CHATINPUT_BORDER_DEFAULT},avatar:{width:92,height:92,borderRadius:22},cogwheelBackground:{position:"absolute",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.5)",borderRadius:24,justifyContent:"center",alignItems:"center",opacity:0},cogwheelIcon:{width:32,height:32,tintColor:w.semanticColors.INTERACTIVE_ACTIVE},textContainer:{flex:1,marginLeft:4,justifyContent:"center"},animatedIndicator:{position:"absolute",top:8,right:8,backgroundColor:"rgba(0, 0, 0, 0.7)",borderRadius:10,width:20,height:20,justifyContent:"center",alignItems:"center",zIndex:1},gifText:{color:"#FFFFFF",fontSize:10,fontWeight:"bold"},avatarPlaceholder:{width:48,height:48,tintColor:w.semanticColors.INTERACTIVE_NORMAL}});n.React.useEffect(function(){if(d){let v,A=!1;const F=d.avatar?.startsWith("a_");if(u&&d.avatar)try{v=u(d,F),A=F}catch(L){console.warn("[Commands Header] Error getting custom avatar:",L),v=null}if(!v&&f&&typeof f=="function")try{v=f(d)}catch(L){console.warn("[Commands Header] Error getting default avatar URL:",L),v=null}if(!v&&d.avatar){const L=d.avatar.startsWith("a_");v=`https://cdn.discordapp.com/avatars/${d.id}/${d.avatar}.${L?"gif":"png"}?size=256`,A=L}else v||(v=`https://cdn.discordapp.com/embed/avatars/${d.discriminator?parseInt(d.discriminator)%5:(parseInt(d.id)>>22)%6}.png`);o(v),l(A)}},[d]);const k=function(){if(r.storage.hiddenSettings?.enabled){r.storage.hiddenSettings.visible=!r.storage.hiddenSettings.visible,m.showToast(`Hidden settings ${r.storage.hiddenSettings.visible?"visible":"hidden"}`,b.getAssetIDByName("SettingsIcon"));return}a&&clearTimeout(a);const v=setTimeout(function(){t(0)},1e3);s(v);const A=e+1;t(A),!(A<10)&&(m.showToast("Hidden settings unlocked!",b.getAssetIDByName("CheckmarkIcon")),r.storage.hiddenSettings={...r.storage.hiddenSettings,enabled:!0,visible:!0},t(0))},T=function(){const v=!r.storage.sidebarEnabled;r.storage.sidebarEnabled=v,r.storage.pendingRestart=!0,m.showToast(`Sidebar ${v?"enabled":"disabled"}. Restart Discord to apply.`,b.getAssetIDByName(v?"CheckmarkIcon":"XIcon"))},[P,K]=n.React.useState(!1);return n.React.createElement(n.ReactNative.View,{style:C.container},n.React.createElement(n.ReactNative.View,{style:C.leftSection},n.React.createElement(n.ReactNative.Pressable,{style:C.avatarContainer,onPress:k,onPressIn:function(){return K(!0)},onPressOut:function(){return K(!1)},delayLongPress:500,onLongPress:T},n.React.createElement(n.ReactNative.View,{style:C.avatarWrapper},i?n.React.createElement(n.React.Fragment,null,n.React.createElement(n.ReactNative.Image,{source:{uri:i},style:C.avatar,resizeMode:"cover"}),c&&n.React.createElement(n.ReactNative.View,{style:C.animatedIndicator})):n.React.createElement(n.ReactNative.Image,{source:b.getAssetIDByName("ic_account_circle_24px"),style:C.avatarPlaceholder})),n.React.createElement(n.ReactNative.View,{style:[C.cogwheelBackground,{opacity:P?.8:0}]},n.React.createElement(n.ReactNative.Image,{source:b.getAssetIDByName("SettingsIcon"),style:C.cogwheelIcon}))),n.React.createElement(n.ReactNative.View,{style:C.textContainer},n.React.createElement(n.ReactNative.Text,{style:[ve["display-md"],{color:we(w.semanticColors.TEXT_DEFAULT)}]},"Commands"),n.React.createElement(n.ReactNative.Text,{style:[ve["text-md/bold"],{color:we(w.semanticColors.TEXT_MUTED)}]},"A collection of useful commands for Vendetta like clients"))))}function Ht(){E.useProxy(r.storage);const[,e]=n.React.useReducer(function(t){return t+1},0);return n.React.createElement(S,{style:{flex:1},contentContainerStyle:{padding:10}},n.React.createElement(R,{spacing:12},n.React.createElement(h,{title:"Fact Display Settings"},n.React.createElement(y,{label:"Send as Reply",subLabel:"Send facts as a reply to the command message",value:r.storage.factSettings.sendAsReply,onValueChange:function(t){r.storage.factSettings.sendAsReply=t}}),n.React.createElement(y,{label:"Include Source Citation",subLabel:"Include the source of facts when available",value:r.storage.factSettings.includeCitation,onValueChange:function(t){r.storage.factSettings.includeCitation=t}})),n.React.createElement(h,{title:"Available Fact Commands"},n.React.createElement(y,{label:"/catfact",subLabel:"Get random cat facts",value:r.storage.enabledCommands.catfact,onValueChange:function(t){r.storage.enabledCommands.catfact=t,r.storage.pendingRestart=!0,e()}}),n.React.createElement(y,{label:"/dogfact",subLabel:"Get random dog facts",value:r.storage.enabledCommands.dogfact,onValueChange:function(t){r.storage.enabledCommands.dogfact=t,r.storage.pendingRestart=!0,e()}}),n.React.createElement(y,{label:"/useless",subLabel:"Get random useless facts",value:r.storage.enabledCommands.useless,onValueChange:function(t){r.storage.enabledCommands.useless=t,r.storage.pendingRestart=!0,e()}}))))}function zt(){E.useProxy(r.storage);const[,e]=n.React.useReducer(function(t){return t+1},0);return n.React.createElement(S,{style:{flex:1},contentContainerStyle:{padding:10}},n.React.createElement(R,{spacing:12},n.React.createElement(h,{title:"List Display Settings"},n.React.createElement(y,{label:"Always Send Detailed Plugin List",subLabel:"Always use detailed mode when listing plugins",value:r.storage.listSettings.pluginListAlwaysDetailed,onValueChange:function(t){r.storage.listSettings.pluginListAlwaysDetailed=t}}),n.React.createElement(y,{label:"Always Send Detailed Theme List",subLabel:"Always use detailed mode when listing themes",value:r.storage.listSettings.themeListAlwaysDetailed,onValueChange:function(t){r.storage.listSettings.themeListAlwaysDetailed=t}})),n.React.createElement(h,{title:"Available List Commands"},n.React.createElement(y,{label:"/plugin-list",subLabel:"List all installed plugins",value:r.storage.enabledCommands.pluginList,onValueChange:function(t){r.storage.enabledCommands.pluginList=t,r.storage.pendingRestart=!0,e()}}),n.React.createElement(y,{label:"/theme-list",subLabel:"List all installed themes",value:r.storage.enabledCommands.themeList,onValueChange:function(t){r.storage.enabledCommands.themeList=t,r.storage.pendingRestart=!0,e()}}))))}function Kt(){E.useProxy(r.storage);const[,e]=n.React.useReducer(function(t){return t+1},0);return n.React.createElement(S,{style:{flex:1},contentContainerStyle:{padding:10}},n.React.createElement(R,{spacing:12},n.React.createElement(h,{title:"Image Commands"},n.React.createElement(y,{label:"/petpet",subLabel:"Create pet-pet GIF of a user",value:r.storage.enabledCommands.petpet,onValueChange:function(t){r.storage.enabledCommands.petpet=t,r.storage.pendingRestart=!0,e()}})),n.React.createElement(h,{title:"KonoChan Commands"},n.React.createElement(y,{label:"/konoself",subLabel:"Get random image from KonoChan (private)",value:r.storage.enabledCommands.konoself,onValueChange:function(t){r.storage.enabledCommands.konoself=t,r.storage.pendingRestart=!0,e()}}),n.React.createElement(y,{label:"/konosend",subLabel:"Send random image from KonoChan to channel",value:r.storage.enabledCommands.konosend,onValueChange:function(t){r.storage.enabledCommands.konosend=t,r.storage.pendingRestart=!0,e()}}))))}function qt(){E.useProxy(r.storage);const[,e]=n.React.useReducer(function(t){return t+1},0);return n.React.createElement(S,{style:{flex:1},contentContainerStyle:{padding:10}},n.React.createElement(R,{spacing:12},n.React.createElement(h,{title:"Gary Command Settings"},n.React.createElement(y,{label:"/gary",subLabel:"Send random Gary images to channel",value:r.storage.enabledCommands.gary,onValueChange:function(t){r.storage.enabledCommands.gary=t,r.storage.pendingRestart=!0,e()}})),n.React.createElement(h,{title:"Image Source Selection"},n.React.createElement(Wt,{value:r.storage.garySettings.imageSource,onChange:function(t){r.storage.garySettings.imageSource=t,e()}},n.React.createElement(H,{value:"gary",label:"Gary API",subLabel:"Original Gary the cat images from api.garythe.cat"}),n.React.createElement(H,{value:"catapi",label:"Cat API",subLabel:"Random cat pictures from thecatapi.com"}),n.React.createElement(H,{value:"minker",label:"Minker API",subLabel:"Minky images from minky.materii.dev"}),n.React.createElement(H,{value:"goober",label:"Goober API",subLabel:"Goober images from api.garythe.cat/goober"})))))}function Xt(){E.useProxy(r.storage);const[,e]=n.React.useReducer(function(t){return t+1},0);return n.React.createElement(S,{style:{flex:1},contentContainerStyle:{padding:10}},n.React.createElement(R,{spacing:12},n.React.createElement(h,{title:"Spotify Commands"},n.React.createElement(y,{label:"/spotify track",subLabel:"Share your current Spotify track",value:r.storage.enabledCommands.spotifyTrack,onValueChange:function(t){r.storage.enabledCommands.spotifyTrack=t,r.storage.pendingRestart=!0,e()}}),n.React.createElement(y,{label:"/spotify album",subLabel:"Share your current track's album",value:r.storage.enabledCommands.spotifyAlbum,onValueChange:function(t){r.storage.enabledCommands.spotifyAlbum=t,r.storage.pendingRestart=!0,e()}}),n.React.createElement(y,{label:"/spotify artists",subLabel:"Share your current track's artists",value:r.storage.enabledCommands.spotifyArtists,onValueChange:function(t){r.storage.enabledCommands.spotifyArtists=t,r.storage.pendingRestart=!0,e()}}),n.React.createElement(y,{label:"/spotify cover",subLabel:"Share your current track's cover",value:r.storage.enabledCommands.spotifyCover,onValueChange:function(t){r.storage.enabledCommands.spotifyCover=t,r.storage.pendingRestart=!0,e()}})),n.React.createElement(h,{title:"About Spotify Commands"},n.React.createElement(p,{label:"Spotify Integration",subLabel:"These commands allow you to share your current Spotify activity in Discord. Make sure you have Spotify connected to Discord for these commands to work properly."}))))}function Yt(){const e=n.ReactNative.StyleSheet.create({tableHeader:{flexDirection:"row",alignItems:"center",paddingVertical:12,paddingHorizontal:16},headerText:{fontSize:14,fontWeight:"700",color:w.semanticColors.HEADER_PRIMARY,textTransform:"uppercase"},nameHeader:{flex:2},codeHeader:{flex:2,textAlign:"center"},badgeHeader:{flex:1,textAlign:"center"},categoryItem:{flexDirection:"row",alignItems:"center",paddingVertical:12,paddingHorizontal:16},categoryName:{fontSize:16,fontWeight:"500",color:w.semanticColors.HEADER_PRIMARY,flex:2},categoryValue:{fontSize:14,color:w.semanticColors.TEXT_MUTED,fontFamily:"monospace",flex:2,textAlign:"center"},sfwBadgeContainer:{flex:1,alignItems:"center"},sfwBadge:{backgroundColor:w.semanticColors.STATUS_POSITIVE,paddingHorizontal:8,paddingVertical:4,borderRadius:12},badgeText:{fontSize:12,fontWeight:"600",color:w.semanticColors.TEXT_NORMAL}}),t=[{name:"Avatar",value:"avatar"},{name:"Classic",value:"classic"},{name:"Cuddle",value:"cuddle"},{name:"Fox Girl",value:"fox_girl"},{name:"Gecg",value:"gecg"},{name:"Holo",value:"holo"},{name:"Kemonomimi",value:"kemonomimi"},{name:"Kiss",value:"kiss"},{name:"Neko",value:"neko"},{name:"Neko GIF",value:"ngif"},{name:"Smug",value:"smug"},{name:"Spank",value:"spank"},{name:"Tickle",value:"tickle"},{name:"Waifu",value:"waifu"},{name:"Wallpaper",value:"wallpaper"},{name:"Woof",value:"woof"}],a=t.sort(function(s,i){return s.name.localeCompare(i.name)});return n.React.createElement(S,{style:{flex:1},contentContainerStyle:{padding:10}},n.React.createElement(R,{spacing:12},n.React.createElement(h,{title:"Category Statistics"},n.React.createElement(p,{label:`${t.length} SFW Categories`,subLabel:"Use these category names with the /nekoslife command. All categories are Safe For Work (SFW)."})),n.React.createElement(h,{title:"SFW Categories"},n.React.createElement(n.ReactNative.View,{style:e.tableHeader},n.React.createElement(n.ReactNative.Text,{style:[e.headerText,e.nameHeader]},"Category Name"),n.React.createElement(n.ReactNative.Text,{style:[e.headerText,e.codeHeader]},"Command Code"),n.React.createElement(n.ReactNative.Text,{style:[e.headerText,e.badgeHeader]},"Type")),a.map(function(s,i){return n.React.createElement(n.ReactNative.View,{key:i,style:e.categoryItem},n.React.createElement(n.ReactNative.Text,{style:e.categoryName},s.name),n.React.createElement(n.ReactNative.Text,{style:e.categoryValue},s.value),n.React.createElement(n.ReactNative.View,{style:e.sfwBadgeContainer},n.React.createElement(n.ReactNative.View,{style:e.sfwBadge},n.React.createElement(n.ReactNative.Text,{style:e.badgeText},"SFW"))))}))))}function Jt(){E.useProxy(r.storage);const[,e]=n.React.useReducer(function(a){return a+1},0),t=n.NavigationNative.useNavigation();return n.React.createElement(S,{style:{flex:1},contentContainerStyle:{padding:10}},n.React.createElement(R,{spacing:12},n.React.createElement(h,{title:"IP Commands"},n.React.createElement(y,{label:"/ip",subLabel:"Get your current IP address",value:r.storage.enabledCommands.ip,onValueChange:function(a){r.storage.enabledCommands.ip=a,r.storage.pendingRestart=!0,e()}})),n.React.createElement(h,{title:"NekosLife Commands"},n.React.createElement(y,{label:"/nekoslife",subLabel:"Get images/gifs from nekos.life",value:r.storage.enabledCommands.nekoslife,onValueChange:function(a){r.storage.enabledCommands.nekoslife=a,r.storage.pendingRestart=!0,e()}}),n.React.createElement(p,{label:"View Categories",subLabel:"See all 16 available categories",trailing:n.React.createElement(p.Arrow,null),onPress:function(){return t.push("VendettaCustomPage",{title:"NekosLife Categories",render:Yt})}}))))}function Qt(){E.useProxy(r.storage);const[,e]=n.React.useReducer(function(t){return t+1},0);return n.React.createElement(S,{style:{flex:1},contentContainerStyle:{padding:10}},n.React.createElement(R,{spacing:12},n.React.createElement(h,{title:"Message Commands"},n.React.createElement(y,{label:"/firstmessage",subLabel:"Get the first message in a channel",value:r.storage.enabledCommands.firstmessage,onValueChange:function(t){r.storage.enabledCommands.firstmessage=t,r.storage.pendingRestart=!0,e()}})),n.React.createElement(h,{title:"System Commands"},n.React.createElement(y,{label:"/sysinfo",subLabel:"Display system information",value:r.storage.enabledCommands.sysinfo,onValueChange:function(t){r.storage.enabledCommands.sysinfo=t,r.storage.pendingRestart=!0,e()}})),n.React.createElement(h,{title:"Friend Invites"},n.React.createElement(y,{label:"/invite create",subLabel:"Generate a friend invite link",value:r.storage.enabledCommands.friendInviteCreate,onValueChange:function(t){r.storage.enabledCommands.friendInviteCreate=t,r.storage.pendingRestart=!0,e()}}),n.React.createElement(y,{label:"/view invites",subLabel:"View your current friend invites",value:r.storage.enabledCommands.friendInviteView,onValueChange:function(t){r.storage.enabledCommands.friendInviteView=t,r.storage.pendingRestart=!0,e()}}),n.React.createElement(y,{label:"/revoke invites",subLabel:"Revoke all your friend invites",value:r.storage.enabledCommands.friendInviteRevoke,onValueChange:function(t){r.storage.enabledCommands.friendInviteRevoke=t,r.storage.pendingRestart=!0,e()}}))))}function Zt(){E.useProxy(r.storage);const[,e]=n.React.useReducer(function(t){return t+1},0);return n.React.createElement(S,{style:{flex:1},contentContainerStyle:{padding:10}},n.React.createElement(R,{spacing:12},n.React.createElement(h,{title:"Warning"},n.React.createElement(p,{label:"Hidden Commands Warning",subLabel:"These are hidden commands that may contain mature content or experimental features. Use at your own discretion. Commands in this section are disabled by default."})),n.React.createElement(h,{title:"Hidden Commands"},n.React.createElement(y,{label:"/lovefemboys",subLabel:"Get random femboy images from r/femboys (NSFW content available)",value:r.storage.enabledCommands.lovefemboys,onValueChange:function(t){r.storage.enabledCommands.lovefemboys=t,r.storage.pendingRestart=!0,e()}})),n.React.createElement(h,{title:"NSFW Bypass Options"},n.React.createElement(y,{label:"KonoChan NSFW Bypass",subLabel:"Allow NSFW KonoChan content in non-NSFW channels (USE WITH CAUTION)",value:r.storage.hiddenSettings.konochanBypassNsfw,onValueChange:function(t){t?w.alerts.showConfirmationAlert({title:"NSFW Bypass Warning",content:"Enabling this allows NSFW content from KonoChan to be sent in any channel, including non-NSFW channels. This could violate server rules or Discord ToS. Use responsibly!",confirmText:"I Understand",cancelText:"Cancel",onConfirm:function(){r.storage.hiddenSettings.konochanBypassNsfw=!0,e()},onCancel:function(){}}):(r.storage.hiddenSettings.konochanBypassNsfw=!1,e())}})),n.React.createElement(h,{title:"Hidden Settings Control"},n.React.createElement(y,{label:"Keep Hidden Settings Visible",subLabel:"Keep this section visible even when navigating away",value:r.storage.hiddenSettings.visible,onValueChange:function(t){r.storage.hiddenSettings.visible=t}}),n.React.createElement(p,{label:"Reset Hidden Settings",subLabel:"Hide this section and disable all hidden commands",onPress:function(){w.alerts.showConfirmationAlert({title:"Reset Hidden Settings",content:"This will hide the hidden settings section and disable all hidden commands. Are you sure?",confirmText:"Reset",onConfirm:function(){r.storage.hiddenSettings.enabled=!1,r.storage.hiddenSettings.visible=!1,r.storage.hiddenSettings.konochanBypassNsfw=!1,r.storage.enabledCommands.lovefemboys=!1,r.storage.pendingRestart=!0,m.showToast("Hidden settings reset",b.getAssetIDByName("CheckmarkIcon"))},cancelText:"Cancel"})}}))))}const en=[{command:"Facts Commands",author:"jdev082",avatar:"https://github.com/jdev082.png",github:"https://github.com/jdev082"},{command:"List Commands",author:"Kitomanari",avatar:"https://github.com/Kitosight.png",github:"https://github.com/Kitosight"},{command:"PetPet",author:"wolfieeee",avatar:"https://github.com/WolfPlugs.png",github:"https://github.com/WolfPlugs"},{command:"KonoChan Commands",author:"btmc727 & Rico040",avatar:"https://github.com/OTKUSteyler.png",github:"https://github.com/OTKUSteyler"},{command:"FirstMessage Command",author:"sapphire",avatar:"https://github.com/aeongdesu.png",github:"https://github.com/aeongdesu"},{command:"Sysinfo Command",author:"mugman",avatar:"https://github.com/mugman174.png",github:"https://github.com/mugman174"},{command:"Spotify Commands",author:"Kitomanari",avatar:"https://github.com/Kitosight.png",github:"https://github.com/Kitosight"},{command:"Gary Command",author:"Zach Orange",avatar:"https://github.com/IAmGaryTheCat.png",github:"https://github.com/IAmGaryTheCat"},{command:"IP & NekosLife Commands",author:"scruzism",avatar:"https://github.com/scrazzz.png",github:"https://github.com/scrazzz"},{command:"FriendInvites",author:"nikosszzz",avatar:"https://github.com/nikosszzz.png",github:"https://github.com/nikosszzz"}];function tn(){return React.createElement(S,{style:{flex:1},contentContainerStyle:{padding:10}},React.createElement(R,{spacing:12},React.createElement(h,{title:"Plugin Authors"},en.map(function(e){return React.createElement(p,{key:e.github,label:e.command,subLabel:`by ${e.author}`,icon:React.createElement(n.ReactNative.Image,{source:{uri:e.avatar},style:{width:48,height:48,borderRadius:8},resizeMode:"cover"}),trailing:React.createElement(p.Arrow,null),onPress:function(){return n.ReactNative.Linking.openURL(e.github)}})})),React.createElement(h,{title:"About"},React.createElement(p,{label:"Commands Plugin Collection",subLabel:"Version 1.3.0"}))))}r.storage.factSettings==null&&(r.storage.factSettings={sendAsReply:!0,includeCitation:!1}),r.storage.listSettings==null&&(r.storage.listSettings={pluginListAlwaysDetailed:!1,themeListAlwaysDetailed:!1}),r.storage.garySettings==null&&(r.storage.garySettings={imageSource:"gary"}),r.storage.enabledCommands==null&&(r.storage.enabledCommands={catfact:!0,dogfact:!0,useless:!0,petpet:!0,pluginList:!0,themeList:!0,konoself:!0,konosend:!0,firstmessage:!0,sysinfo:!0,spotifyTrack:!0,spotifyAlbum:!0,spotifyArtists:!0,spotifyCover:!0,gary:!0,ip:!0,lovefemboys:!1,nekoslife:!1,friendInviteCreate:!0,friendInviteView:!0,friendInviteRevoke:!0}),r.storage.pendingRestart==null&&(r.storage.pendingRestart=!1),r.storage.hiddenSettings==null&&(r.storage.hiddenSettings={enabled:!1,visible:!1,konochanBypassNsfw:!1}),r.storage.sidebarEnabled==null&&(r.storage.sidebarEnabled=!0);function Se(){E.useProxy(r.storage);const e=n.NavigationNative.useNavigation();n.React.useEffect(function(){return function(){r.storage.pendingRestart&&(r.storage.pendingRestart=!1,w.alerts.showConfirmationAlert({title:"Restart Required",content:"You have made changes to commands. Please restart Discord to apply these changes.",confirmText:"Okay",cancelText:null,onConfirm:function(){}}))}},[]);const t=r.storage.garySettings.imageSource==="gary"?"Gary API":r.storage.garySettings.imageSource==="catapi"?"Cat API":r.storage.garySettings.imageSource==="minker"?"Minker API":r.storage.garySettings.imageSource==="goober"?"Goober API":"Gary API";return n.React.createElement(S,{style:{flex:1},contentContainerStyle:{padding:10}},n.React.createElement(jt,null),n.React.createElement(R,{spacing:12},n.React.createElement(h,{title:"Command Categories"},n.React.createElement(p,{label:"Facts Commands",subLabel:"Cat facts, dog facts, and useless facts",trailing:n.React.createElement(p.Arrow,null),onPress:function(){return e.push("VendettaCustomPage",{title:"Facts Commands",render:Ht})}}),n.React.createElement(p,{label:"List Commands",subLabel:"Plugin lists and theme lists",trailing:n.React.createElement(p.Arrow,null),onPress:function(){return e.push("VendettaCustomPage",{title:"List Commands",render:zt})}}),n.React.createElement(p,{label:"Image Commands",subLabel:"PetPet, KonoChan, and image utilities",trailing:n.React.createElement(p.Arrow,null),onPress:function(){return e.push("VendettaCustomPage",{title:"Image Commands",render:Kt})}}),n.React.createElement(p,{label:"Gary Commands",subLabel:`Gary images - Current: ${t}`,trailing:n.React.createElement(p.Arrow,null),onPress:function(){return e.push("VendettaCustomPage",{title:"Gary Commands",render:qt})}}),n.React.createElement(p,{label:"Spotify Commands",subLabel:"Share your Spotify activity",trailing:n.React.createElement(p.Arrow,null),onPress:function(){return e.push("VendettaCustomPage",{title:"Spotify Commands",render:Xt})}}),n.React.createElement(p,{label:"Aliucord Commands",subLabel:"Commands from Aliucord",trailing:n.React.createElement(p.Arrow,null),onPress:function(){return e.push("VendettaCustomPage",{title:"Aliucord",render:Jt})}}),n.React.createElement(p,{label:"Other Commands",subLabel:"Utility and system commands",trailing:n.React.createElement(p.Arrow,null),onPress:function(){return e.push("VendettaCustomPage",{title:"Other Commands",render:Qt})}})),r.storage.hiddenSettings?.visible&&n.React.createElement(h,{title:"Hidden Settings"},n.React.createElement(p,{label:"Hidden Commands",subLabel:"Access to experimental and NSFW commands",trailing:n.React.createElement(p.Arrow,null),onPress:function(){return e.push("VendettaCustomPage",{title:"Hidden Settings",render:Zt})}})),n.React.createElement(h,{title:"Other"},n.React.createElement(p,{label:"Credits",subLabel:"View original authors of the plugins",trailing:n.React.createElement(p.Arrow,null),onPress:function(){return e.push("VendettaCustomPage",{title:"Credits",render:tn})}}))))}const{FormSection:nn,FormRow:Z}=Le.Forms,{TableRowIcon:an}=g.findByProps("TableRowIcon"),B=window.bunny,Re=B?.metro?.findByPropsLazy("getRootNavigationRef"),ee=B?.metro?.findByPropsLazy("SETTING_RENDERER_CONFIG"),Ee=B?.metro?.findByPropsLazy("createList"),Ne=B?.metro?.findByNameLazy("SettingsOverviewScreen",!1);function rn({tabs:e}){const t=n.NavigationNative.useNavigation();return n.React.createElement(Z,{label:e.title(),leading:n.React.createElement(Z.Icon,{source:e.icon}),trailing:n.React.createElement(n.React.Fragment,{},[e.trailing?e.trailing():null,n.React.createElement(Z.Arrow,{key:"arrow"})]),onPress:function(){const a=e.page;t.navigate("VendettaCustomPage",{title:e.title(),render:function(){return n.React.createElement(a)}})}})}function sn(e,t){try{t.push(_.after("default",B?.metro?.findByPropsLazy(["renderTitle","sections"],!1),function(a,s){const i=X.findInReactTree(s.props.children,function(o){return o.type?.name==="UserSettingsOverview"});i&&t.push(_.after("render",i.type.prototype,function(o,c){const l=X.findInReactTree(c.props.children,function(d){return d?.children?.[1]?.type===nn})?.children;if(l){const d=l.findIndex(function(u){return["BILLING_SETTINGS","PREMIUM_SETTINGS"].includes(u?.props?.label)});l.splice(-~d||4,0,n.React.createElement(rn,{key:e.key,tabs:e}))}}))},!0))}catch{}}function on(e,t){if(!ee||!Re){console.warn("[Commands Plugin] Missing required constants for tabs UI patch");return}const a={[e.key]:{type:"pressable",useTitle:e.title,title:e.title,icon:e.icon,IconComponent:e.icon&&function(){return n.React.createElement(an,{source:e.icon})},usePredicate:e.predicate,useTrailing:e.trailing,onPress:function(){const o=Re.getRootNavigationRef(),c=e.page;o.navigate("VendettaCustomPage",{title:e.title(),render:function(){return n.React.createElement(c)}})},withArrow:!0}};let s=ee.SETTING_RENDERER_CONFIG;Object.defineProperty(ee,"SETTING_RENDERER_CONFIG",{enumerable:!0,configurable:!0,get:function(){return{...s,...a}},set:function(o){return s=o}});const i=Symbol("pinToSettings meow meow");try{if(!Ee)return;t.push(_.after("createList",Ee,function(o,c){if(!o[0][i]){o[0][i]=!0;const[l]=o,d=l.sections?.find(function(u){return["Bunny","Revenge","Kettu","Vencore","ShiggyCord"].some(function(f){return u.label===f&&u.title===f})});d?.settings&&(d.settings=[...d.settings,e.key])}}))}catch{if(!Ne)return;t.push(_.after("default",Ne,function(o,c){if(!o[0][i]){o[0][i]=!0;const{sections:l}=X.findInReactTree(c,function(u){return u.props?.sections}).props,d=l?.find(function(u){return["Bunny","Revenge","Kettu","Vencore","ShiggyCord"].some(function(f){return u.label===f&&u.title===f})});d?.settings&&(d.settings=[...d.settings,e.key])}}))}}function cn(e){const t=[];let a=!1;const s=e.predicate||function(){return!0};return e.predicate=function(){return a?!1:s()},sn(e,t),on(e,t),t.push(function(){return a=!0}),function(){for(const i of t)i()}}function ln(){if(r.storage.sidebarEnabled===!1)return console.log("[Commands Plugin] Sidebar disabled in settings"),function(){};console.log("[Commands Plugin] Patching sidebar...");try{const e=cn({key:"CommandsPlugin",icon:b.getAssetIDByName("SettingsIcon"),title:function(){return"Commands"},predicate:function(){return r.storage.sidebarEnabled!==!1},page:Se});return console.log("[Commands Plugin] Successfully patched sidebar"),e}catch(e){return console.error("[Commands Plugin] Failed to patch sidebar:",e),function(){}}}r.storage.factSettings||(r.storage.factSettings={sendAsReply:!0,includeCitation:!1}),r.storage.listSettings||(r.storage.listSettings={pluginListAlwaysDetailed:!1,themeListAlwaysDetailed:!1}),r.storage.garySettings||(r.storage.garySettings={imageSource:"gary"}),r.storage.enabledCommands||(r.storage.enabledCommands={catfact:!0,dogfact:!0,useless:!0,petpet:!0,pluginList:!0,themeList:!0,konoself:!0,konosend:!0,firstmessage:!0,sysinfo:!0,spotifyTrack:!0,spotifyAlbum:!0,spotifyArtists:!0,spotifyCover:!0,gary:!0,ip:!0,lovefemboys:!1,nekoslife:!1,friendInviteCreate:!0,friendInviteView:!0,friendInviteRevoke:!0}),r.storage.hiddenSettings||(r.storage.hiddenSettings={enabled:!1,visible:!1,konochanBypassNsfw:!1}),r.storage.sidebarEnabled===void 0&&(r.storage.sidebarEnabled=!0);const dn={catfact:Fe,dogfact:Me,useless:_e,petpet:qe,pluginList:je,themeList:He,konoself:Je,konosend:Qe,firstmessage:nt,sysinfo:ut,spotifyTrack:ht,spotifyAlbum:bt,spotifyArtists:vt,spotifyCover:Ct,gary:St,ip:At,lovefemboys:It,nekoslife:Bt,friendInviteCreate:_t,friendInviteView:Vt,friendInviteRevoke:Ut};let te=[],z;var un={onLoad:function(){if(console.log("[Commands Plugin] Loading..."),r.storage.sidebarEnabled!==!1)try{z=ln(),console.log("[Commands Plugin] Sidebar patched successfully")}catch(e){console.error("[Commands Plugin] Failed to patch sidebar:",e)}for(const[e,t]of Object.entries(dn))if(r.storage.enabledCommands[e])try{te.push(Ae.registerCommand(t)),console.log(`[Commands Plugin] Registered command: ${e}`)}catch(a){console.error(`[Commands Plugin] Failed to register command ${e}:`,a)}},onUnload:function(){if(console.log("[Commands Plugin] Unloading..."),te.forEach(function(e){try{e()}catch{}}),te=[],z)try{z(),z=void 0,console.log("[Commands Plugin] Sidebar unpatched")}catch(e){console.error("[Commands Plugin] Failed to unpatch sidebar:",e)}},settings:Se};return q.default=un,Object.defineProperty(q,"__esModule",{value:!0}),q})({},vendetta.commands,vendetta.plugin,vendetta.metro,vendetta.ui.toasts,vendetta.themes,vendetta.plugins,vendetta.ui,vendetta.metro.common,vendetta.debug,vendetta.ui.assets,vendetta.storage,vendetta.patcher,vendetta.ui.components,vendetta.utils); +`)}`),null}catch(r){return console.error("[FriendInvite] View error:",r),m.showToast("Error viewing friend invites",b.getAssetIDByName("Small")),null}}},Vt={name:"revoke invites",displayName:"revoke invites",description:"Revoke all your friend invite links.",displayDescription:"Revoke all your friend invite links.",type:1,applicationId:"-1",inputType:1,execute:async function(){try{const e=await x.getAllFriendInvites();if(!e?.length)return m.showToast("No active friend invites to revoke",b.getAssetIDByName("Info")),null;await x.revokeFriendInvites();const t=await x.getAllFriendInvites();return t.length===0?m.showToast(`Successfully revoked all ${e.length} friend invite(s)!`,b.getAssetIDByName("Check")):m.showToast(`\u26A0\uFE0F Partially revoked invites. ${t.length} invite(s) remain active.`,b.getAssetIDByName("Warning")),null}catch(e){return console.error("[FriendInvite] Revoke error:",e),m.showToast("Error revoking friend invites",b.getAssetIDByName("Small")),null}}},{ScrollView:S}=g.findByProps("ScrollView"),{TableRowGroup:h,TableSwitchRow:y,TableCheckboxRow:bn,TableRadioGroup:Ut,TableRadioRow:H,Stack:R,TableRow:p}=g.findByProps("TableSwitchRow","TableCheckboxRow","TableRadioGroup","TableRadioRow","TableRowGroup","Stack","TableRow"),{TextInput:vn}=g.findByProps("TextInput"),ve=g.findByProps("TextStyleSheet").TextStyleSheet,Wt=g.findByStoreName("ThemeStore"),Ce=g.findByProps("colors","unsafe_rawColors"),Ot=Ce?.internal??Ce?.meta;function we(e,t){const r=Wt?.theme;return e&&Ot?.resolveSemanticColor(r,e)||"#000000"}function Gt(){const[e,t]=n.React.useState(0),[r,s]=n.React.useState(null),[i,o]=n.React.useState(null),[l,c]=n.React.useState(!1);n.React.useEffect(function(){a.storage.sidebarEnabled===void 0&&(a.storage.sidebarEnabled=!0)},[]);let u=null;try{u=g.findByProps("getUser","getCurrentUser")?.getCurrentUser?.()}catch(C){console.warn("[Commands Header] Failed to get current user:",C)}let d=null,f=null;try{d=g.findByProps("getUserAvatarURL")?.getUserAvatarURL}catch(C){console.warn("[Commands Header] Failed to get getUserAvatarURL:",C)}try{f=g.findByProps("getDefaultAvatarURL")?.getDefaultAvatarURL}catch(C){console.warn("[Commands Header] Failed to get getDefaultAvatarURL:",C)}const v=n.ReactNative.StyleSheet.create({container:{flexDirection:"row",alignItems:"center",paddingVertical:24,paddingHorizontal:16,width:"100%",justifyContent:"center"},leftSection:{flexDirection:"row",alignItems:"center",flex:1,gap:20,maxWidth:500},avatarContainer:{position:"relative",width:96,height:96,justifyContent:"center",alignItems:"center"},avatarWrapper:{width:96,height:96,borderRadius:24,justifyContent:"center",alignItems:"center",overflow:"hidden",borderWidth:2,borderColor:w.semanticColors.MOBILE_CHATINPUT_BORDER_DEFAULT},avatar:{width:92,height:92,borderRadius:22},cogwheelBackground:{position:"absolute",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.5)",borderRadius:24,justifyContent:"center",alignItems:"center",opacity:0},cogwheelIcon:{width:32,height:32,tintColor:w.semanticColors.INTERACTIVE_ACTIVE},textContainer:{flex:1,marginLeft:4,justifyContent:"center"},animatedIndicator:{position:"absolute",top:8,right:8,backgroundColor:"rgba(0, 0, 0, 0.7)",borderRadius:10,width:20,height:20,justifyContent:"center",alignItems:"center",zIndex:1},gifText:{color:"#FFFFFF",fontSize:10,fontWeight:"bold"},avatarPlaceholder:{width:48,height:48,tintColor:w.semanticColors.INTERACTIVE_NORMAL}});n.React.useEffect(function(){if(u){let C,N=!1;const K=u.avatar?.startsWith("a_");if(d&&u.avatar)try{C=d(u,K),N=K}catch(I){console.warn("[Commands Header] Error getting custom avatar:",I),C=null}if(!C&&f&&typeof f=="function")try{C=f(u)}catch(I){console.warn("[Commands Header] Error getting default avatar URL:",I),C=null}if(!C&&u.avatar){const I=u.avatar.startsWith("a_");C=`https://cdn.discordapp.com/avatars/${u.id}/${u.avatar}.${I?"gif":"png"}?size=256`,N=I}else C||(C=`https://cdn.discordapp.com/embed/avatars/${u.discriminator?parseInt(u.discriminator)%5:(parseInt(u.id)>>22)%6}.png`);o(C),c(N)}},[u]);const A=function(){if(a.storage.hiddenSettings?.enabled){a.storage.hiddenSettings.visible=!a.storage.hiddenSettings.visible,m.showToast(`Hidden settings ${a.storage.hiddenSettings.visible?"visible":"hidden"}`,b.getAssetIDByName("SettingsIcon"));return}r&&clearTimeout(r);const C=setTimeout(function(){t(0)},1e3);s(C);const N=e+1;t(N),!(N<10)&&(m.showToast("Hidden settings unlocked!",b.getAssetIDByName("CheckmarkIcon")),a.storage.hiddenSettings={...a.storage.hiddenSettings,enabled:!0,visible:!0},t(0))},L=function(){const C=!a.storage.sidebarEnabled;a.storage.sidebarEnabled=C,a.storage.pendingRestart=!0,m.showToast(`Sidebar ${C?"enabled":"disabled"}. Restart Discord to apply.`,b.getAssetIDByName(C?"CheckmarkIcon":"XIcon"))},[P,F]=n.React.useState(!1);return n.React.createElement(n.ReactNative.View,{style:v.container},n.React.createElement(n.ReactNative.View,{style:v.leftSection},n.React.createElement(n.ReactNative.Pressable,{style:v.avatarContainer,onPress:A,onPressIn:function(){return F(!0)},onPressOut:function(){return F(!1)},delayLongPress:500,onLongPress:L},n.React.createElement(n.ReactNative.View,{style:v.avatarWrapper},i?n.React.createElement(n.React.Fragment,null,n.React.createElement(n.ReactNative.Image,{source:{uri:i},style:v.avatar,resizeMode:"cover"}),l&&n.React.createElement(n.ReactNative.View,{style:v.animatedIndicator})):n.React.createElement(n.ReactNative.Image,{source:b.getAssetIDByName("ic_account_circle_24px"),style:v.avatarPlaceholder})),n.React.createElement(n.ReactNative.View,{style:[v.cogwheelBackground,{opacity:P?.8:0}]},n.React.createElement(n.ReactNative.Image,{source:b.getAssetIDByName("SettingsIcon"),style:v.cogwheelIcon}))),n.React.createElement(n.ReactNative.View,{style:v.textContainer},n.React.createElement(n.ReactNative.Text,{style:[ve["display-md"],{color:we(w.semanticColors.TEXT_DEFAULT)}]},"Commands"),n.React.createElement(n.ReactNative.Text,{style:[ve["text-md/bold"],{color:we(w.semanticColors.TEXT_MUTED)}]},"A collection of useful commands for Vendetta like clients"))))}function jt(){E.useProxy(a.storage);const[,e]=n.React.useReducer(function(t){return t+1},0);return n.React.createElement(S,{style:{flex:1},contentContainerStyle:{padding:10}},n.React.createElement(R,{spacing:12},n.React.createElement(h,{title:"Fact Display Settings"},n.React.createElement(y,{label:"Send as Reply",subLabel:"Send facts as a reply to the command message",value:a.storage.factSettings.sendAsReply,onValueChange:function(t){a.storage.factSettings.sendAsReply=t}}),n.React.createElement(y,{label:"Include Source Citation",subLabel:"Include the source of facts when available",value:a.storage.factSettings.includeCitation,onValueChange:function(t){a.storage.factSettings.includeCitation=t}})),n.React.createElement(h,{title:"Available Fact Commands"},n.React.createElement(y,{label:"/catfact",subLabel:"Get random cat facts",value:a.storage.enabledCommands.catfact,onValueChange:function(t){a.storage.enabledCommands.catfact=t,a.storage.pendingRestart=!0,e()}}),n.React.createElement(y,{label:"/dogfact",subLabel:"Get random dog facts",value:a.storage.enabledCommands.dogfact,onValueChange:function(t){a.storage.enabledCommands.dogfact=t,a.storage.pendingRestart=!0,e()}}),n.React.createElement(y,{label:"/useless",subLabel:"Get random useless facts",value:a.storage.enabledCommands.useless,onValueChange:function(t){a.storage.enabledCommands.useless=t,a.storage.pendingRestart=!0,e()}}))))}function Ht(){E.useProxy(a.storage);const[,e]=n.React.useReducer(function(t){return t+1},0);return n.React.createElement(S,{style:{flex:1},contentContainerStyle:{padding:10}},n.React.createElement(R,{spacing:12},n.React.createElement(h,{title:"List Display Settings"},n.React.createElement(y,{label:"Always Send Detailed Plugin List",subLabel:"Always use detailed mode when listing plugins",value:a.storage.listSettings.pluginListAlwaysDetailed,onValueChange:function(t){a.storage.listSettings.pluginListAlwaysDetailed=t}}),n.React.createElement(y,{label:"Always Send Detailed Theme List",subLabel:"Always use detailed mode when listing themes",value:a.storage.listSettings.themeListAlwaysDetailed,onValueChange:function(t){a.storage.listSettings.themeListAlwaysDetailed=t}})),n.React.createElement(h,{title:"Available List Commands"},n.React.createElement(y,{label:"/plugin-list",subLabel:"List all installed plugins",value:a.storage.enabledCommands.pluginList,onValueChange:function(t){a.storage.enabledCommands.pluginList=t,a.storage.pendingRestart=!0,e()}}),n.React.createElement(y,{label:"/theme-list",subLabel:"List all installed themes",value:a.storage.enabledCommands.themeList,onValueChange:function(t){a.storage.enabledCommands.themeList=t,a.storage.pendingRestart=!0,e()}}))))}function zt(){E.useProxy(a.storage);const[,e]=n.React.useReducer(function(t){return t+1},0);return n.React.createElement(S,{style:{flex:1},contentContainerStyle:{padding:10}},n.React.createElement(R,{spacing:12},n.React.createElement(h,{title:"Image Commands"},n.React.createElement(y,{label:"/petpet",subLabel:"Create pet-pet GIF of a user",value:a.storage.enabledCommands.petpet,onValueChange:function(t){a.storage.enabledCommands.petpet=t,a.storage.pendingRestart=!0,e()}})),n.React.createElement(h,{title:"KonoChan Commands"},n.React.createElement(y,{label:"/konoself",subLabel:"Get random image from KonoChan (private)",value:a.storage.enabledCommands.konoself,onValueChange:function(t){a.storage.enabledCommands.konoself=t,a.storage.pendingRestart=!0,e()}}),n.React.createElement(y,{label:"/konosend",subLabel:"Send random image from KonoChan to channel",value:a.storage.enabledCommands.konosend,onValueChange:function(t){a.storage.enabledCommands.konosend=t,a.storage.pendingRestart=!0,e()}}))))}function Kt(){E.useProxy(a.storage);const[,e]=n.React.useReducer(function(t){return t+1},0);return n.React.createElement(S,{style:{flex:1},contentContainerStyle:{padding:10}},n.React.createElement(R,{spacing:12},n.React.createElement(h,{title:"Gary Command Settings"},n.React.createElement(y,{label:"/gary",subLabel:"Send random Gary images to channel",value:a.storage.enabledCommands.gary,onValueChange:function(t){a.storage.enabledCommands.gary=t,a.storage.pendingRestart=!0,e()}})),n.React.createElement(h,{title:"Image Source Selection"},n.React.createElement(Ut,{value:a.storage.garySettings.imageSource,onChange:function(t){a.storage.garySettings.imageSource=t,e()}},n.React.createElement(H,{value:"gary",label:"Gary API",subLabel:"Original Gary the cat images from api.garythe.cat"}),n.React.createElement(H,{value:"catapi",label:"Cat API",subLabel:"Random cat pictures from thecatapi.com"}),n.React.createElement(H,{value:"minker",label:"Minker API",subLabel:"Minky images from minky.materii.dev"}),n.React.createElement(H,{value:"goober",label:"Goober API",subLabel:"Goober images from api.garythe.cat/goober"})))))}function qt(){E.useProxy(a.storage);const[,e]=n.React.useReducer(function(t){return t+1},0);return n.React.createElement(S,{style:{flex:1},contentContainerStyle:{padding:10}},n.React.createElement(R,{spacing:12},n.React.createElement(h,{title:"Spotify Commands"},n.React.createElement(y,{label:"/spotify track",subLabel:"Share your current Spotify track",value:a.storage.enabledCommands.spotifyTrack,onValueChange:function(t){a.storage.enabledCommands.spotifyTrack=t,a.storage.pendingRestart=!0,e()}}),n.React.createElement(y,{label:"/spotify album",subLabel:"Share your current track's album",value:a.storage.enabledCommands.spotifyAlbum,onValueChange:function(t){a.storage.enabledCommands.spotifyAlbum=t,a.storage.pendingRestart=!0,e()}}),n.React.createElement(y,{label:"/spotify artists",subLabel:"Share your current track's artists",value:a.storage.enabledCommands.spotifyArtists,onValueChange:function(t){a.storage.enabledCommands.spotifyArtists=t,a.storage.pendingRestart=!0,e()}}),n.React.createElement(y,{label:"/spotify cover",subLabel:"Share your current track's cover",value:a.storage.enabledCommands.spotifyCover,onValueChange:function(t){a.storage.enabledCommands.spotifyCover=t,a.storage.pendingRestart=!0,e()}})),n.React.createElement(h,{title:"About Spotify Commands"},n.React.createElement(p,{label:"Spotify Integration",subLabel:"These commands allow you to share your current Spotify activity in Discord. Make sure you have Spotify connected to Discord for these commands to work properly."}))))}function Xt(){const e=n.ReactNative.StyleSheet.create({tableHeader:{flexDirection:"row",alignItems:"center",paddingVertical:12,paddingHorizontal:16},headerText:{fontSize:14,fontWeight:"700",color:w.semanticColors.HEADER_PRIMARY,textTransform:"uppercase"},nameHeader:{flex:2},codeHeader:{flex:2,textAlign:"center"},badgeHeader:{flex:1,textAlign:"center"},categoryItem:{flexDirection:"row",alignItems:"center",paddingVertical:12,paddingHorizontal:16},categoryName:{fontSize:16,fontWeight:"500",color:w.semanticColors.HEADER_PRIMARY,flex:2},categoryValue:{fontSize:14,color:w.semanticColors.TEXT_MUTED,fontFamily:"monospace",flex:2,textAlign:"center"},sfwBadgeContainer:{flex:1,alignItems:"center"},sfwBadge:{backgroundColor:w.semanticColors.STATUS_POSITIVE,paddingHorizontal:8,paddingVertical:4,borderRadius:12},badgeText:{fontSize:12,fontWeight:"600",color:w.semanticColors.TEXT_NORMAL}}),t=[{name:"Avatar",value:"avatar"},{name:"Classic",value:"classic"},{name:"Cuddle",value:"cuddle"},{name:"Fox Girl",value:"fox_girl"},{name:"Gecg",value:"gecg"},{name:"Holo",value:"holo"},{name:"Kemonomimi",value:"kemonomimi"},{name:"Kiss",value:"kiss"},{name:"Neko",value:"neko"},{name:"Neko GIF",value:"ngif"},{name:"Smug",value:"smug"},{name:"Spank",value:"spank"},{name:"Tickle",value:"tickle"},{name:"Waifu",value:"waifu"},{name:"Wallpaper",value:"wallpaper"},{name:"Woof",value:"woof"}],r=t.sort(function(s,i){return s.name.localeCompare(i.name)});return n.React.createElement(S,{style:{flex:1},contentContainerStyle:{padding:10}},n.React.createElement(R,{spacing:12},n.React.createElement(h,{title:"Category Statistics"},n.React.createElement(p,{label:`${t.length} SFW Categories`,subLabel:"Use these category names with the /nekoslife command. All categories are Safe For Work (SFW)."})),n.React.createElement(h,{title:"SFW Categories"},n.React.createElement(n.ReactNative.View,{style:e.tableHeader},n.React.createElement(n.ReactNative.Text,{style:[e.headerText,e.nameHeader]},"Category Name"),n.React.createElement(n.ReactNative.Text,{style:[e.headerText,e.codeHeader]},"Command Code"),n.React.createElement(n.ReactNative.Text,{style:[e.headerText,e.badgeHeader]},"Type")),r.map(function(s,i){return n.React.createElement(n.ReactNative.View,{key:i,style:e.categoryItem},n.React.createElement(n.ReactNative.Text,{style:e.categoryName},s.name),n.React.createElement(n.ReactNative.Text,{style:e.categoryValue},s.value),n.React.createElement(n.ReactNative.View,{style:e.sfwBadgeContainer},n.React.createElement(n.ReactNative.View,{style:e.sfwBadge},n.React.createElement(n.ReactNative.Text,{style:e.badgeText},"SFW"))))}))))}function Yt(){E.useProxy(a.storage);const[,e]=n.React.useReducer(function(r){return r+1},0),t=n.NavigationNative.useNavigation();return n.React.createElement(S,{style:{flex:1},contentContainerStyle:{padding:10}},n.React.createElement(R,{spacing:12},n.React.createElement(h,{title:"IP Commands"},n.React.createElement(y,{label:"/ip",subLabel:"Get your current IP address",value:a.storage.enabledCommands.ip,onValueChange:function(r){a.storage.enabledCommands.ip=r,a.storage.pendingRestart=!0,e()}})),n.React.createElement(h,{title:"NekosLife Commands"},n.React.createElement(y,{label:"/nekoslife",subLabel:"Get images/gifs from nekos.life",value:a.storage.enabledCommands.nekoslife,onValueChange:function(r){a.storage.enabledCommands.nekoslife=r,a.storage.pendingRestart=!0,e()}}),n.React.createElement(p,{label:"View Categories",subLabel:"See all 16 available categories",trailing:n.React.createElement(p.Arrow,null),onPress:function(){return t.push("VendettaCustomPage",{title:"NekosLife Categories",render:Xt})}}))))}function Jt(){E.useProxy(a.storage);const[,e]=n.React.useReducer(function(t){return t+1},0);return n.React.createElement(S,{style:{flex:1},contentContainerStyle:{padding:10}},n.React.createElement(R,{spacing:12},n.React.createElement(h,{title:"Message Commands"},n.React.createElement(y,{label:"/firstmessage",subLabel:"Get the first message in a channel",value:a.storage.enabledCommands.firstmessage,onValueChange:function(t){a.storage.enabledCommands.firstmessage=t,a.storage.pendingRestart=!0,e()}})),n.React.createElement(h,{title:"System Commands"},n.React.createElement(y,{label:"/sysinfo",subLabel:"Display system information",value:a.storage.enabledCommands.sysinfo,onValueChange:function(t){a.storage.enabledCommands.sysinfo=t,a.storage.pendingRestart=!0,e()}})),n.React.createElement(h,{title:"Friend Invites"},n.React.createElement(y,{label:"/invite create",subLabel:"Generate a friend invite link",value:a.storage.enabledCommands.friendInviteCreate,onValueChange:function(t){a.storage.enabledCommands.friendInviteCreate=t,a.storage.pendingRestart=!0,e()}}),n.React.createElement(y,{label:"/view invites",subLabel:"View your current friend invites",value:a.storage.enabledCommands.friendInviteView,onValueChange:function(t){a.storage.enabledCommands.friendInviteView=t,a.storage.pendingRestart=!0,e()}}),n.React.createElement(y,{label:"/revoke invites",subLabel:"Revoke all your friend invites",value:a.storage.enabledCommands.friendInviteRevoke,onValueChange:function(t){a.storage.enabledCommands.friendInviteRevoke=t,a.storage.pendingRestart=!0,e()}}))))}function Qt(){E.useProxy(a.storage);const[,e]=n.React.useReducer(function(t){return t+1},0);return n.React.createElement(S,{style:{flex:1},contentContainerStyle:{padding:10}},n.React.createElement(R,{spacing:12},n.React.createElement(h,{title:"Warning"},n.React.createElement(p,{label:"Hidden Commands Warning",subLabel:"These are hidden commands that may contain mature content or experimental features. Use at your own discretion. Commands in this section are disabled by default."})),n.React.createElement(h,{title:"Hidden Commands"},n.React.createElement(y,{label:"/lovefemboys",subLabel:"Get random femboy images from r/femboys (NSFW content available)",value:a.storage.enabledCommands.lovefemboys,onValueChange:function(t){a.storage.enabledCommands.lovefemboys=t,a.storage.pendingRestart=!0,e()}})),n.React.createElement(h,{title:"NSFW Bypass Options"},n.React.createElement(y,{label:"KonoChan NSFW Bypass",subLabel:"Allow NSFW KonoChan content in non-NSFW channels (USE WITH CAUTION)",value:a.storage.hiddenSettings.konochanBypassNsfw,onValueChange:function(t){t?w.alerts.showConfirmationAlert({title:"NSFW Bypass Warning",content:"Enabling this allows NSFW content from KonoChan to be sent in any channel, including non-NSFW channels. This could violate server rules or Discord ToS. Use responsibly!",confirmText:"I Understand",cancelText:"Cancel",onConfirm:function(){a.storage.hiddenSettings.konochanBypassNsfw=!0,e()},onCancel:function(){}}):(a.storage.hiddenSettings.konochanBypassNsfw=!1,e())}})),n.React.createElement(h,{title:"Hidden Settings Control"},n.React.createElement(y,{label:"Keep Hidden Settings Visible",subLabel:"Keep this section visible even when navigating away",value:a.storage.hiddenSettings.visible,onValueChange:function(t){a.storage.hiddenSettings.visible=t}}),n.React.createElement(p,{label:"Reset Hidden Settings",subLabel:"Hide this section and disable all hidden commands",onPress:function(){w.alerts.showConfirmationAlert({title:"Reset Hidden Settings",content:"This will hide the hidden settings section and disable all hidden commands. Are you sure?",confirmText:"Reset",onConfirm:function(){a.storage.hiddenSettings.enabled=!1,a.storage.hiddenSettings.visible=!1,a.storage.hiddenSettings.konochanBypassNsfw=!1,a.storage.enabledCommands.lovefemboys=!1,a.storage.pendingRestart=!0,m.showToast("Hidden settings reset",b.getAssetIDByName("CheckmarkIcon"))},cancelText:"Cancel"})}}))))}const Zt=[{command:"Facts Commands",author:"jdev082",avatar:"https://github.com/jdev082.png",github:"https://github.com/jdev082"},{command:"List Commands",author:"Kitomanari",avatar:"https://github.com/Kitosight.png",github:"https://github.com/Kitosight"},{command:"PetPet",author:"wolfieeee",avatar:"https://github.com/WolfPlugs.png",github:"https://github.com/WolfPlugs"},{command:"KonoChan Commands",author:"btmc727 & Rico040",avatar:"https://github.com/OTKUSteyler.png",github:"https://github.com/OTKUSteyler"},{command:"FirstMessage Command",author:"sapphire",avatar:"https://github.com/aeongdesu.png",github:"https://github.com/aeongdesu"},{command:"Sysinfo Command",author:"mugman",avatar:"https://github.com/mugman174.png",github:"https://github.com/mugman174"},{command:"Spotify Commands",author:"Kitomanari",avatar:"https://github.com/Kitosight.png",github:"https://github.com/Kitosight"},{command:"Gary Command",author:"Zach Orange",avatar:"https://github.com/IAmGaryTheCat.png",github:"https://github.com/IAmGaryTheCat"},{command:"IP & NekosLife Commands",author:"scruzism",avatar:"https://github.com/scrazzz.png",github:"https://github.com/scrazzz"},{command:"FriendInvites",author:"nikosszzz",avatar:"https://github.com/nikosszzz.png",github:"https://github.com/nikosszzz"}];function en(){return React.createElement(S,{style:{flex:1},contentContainerStyle:{padding:10}},React.createElement(R,{spacing:12},React.createElement(h,{title:"Plugin Authors"},Zt.map(function(e){return React.createElement(p,{key:e.github,label:e.command,subLabel:`by ${e.author}`,icon:React.createElement(n.ReactNative.Image,{source:{uri:e.avatar},style:{width:48,height:48,borderRadius:8},resizeMode:"cover"}),trailing:React.createElement(p.Arrow,null),onPress:function(){return n.ReactNative.Linking.openURL(e.github)}})})),React.createElement(h,{title:"About"},React.createElement(p,{label:"Commands Plugin Collection",subLabel:"Version 1.3.0"}))))}a.storage.factSettings==null&&(a.storage.factSettings={sendAsReply:!0,includeCitation:!1}),a.storage.listSettings==null&&(a.storage.listSettings={pluginListAlwaysDetailed:!1,themeListAlwaysDetailed:!1}),a.storage.garySettings==null&&(a.storage.garySettings={imageSource:"gary"}),a.storage.enabledCommands==null&&(a.storage.enabledCommands={catfact:!0,dogfact:!0,useless:!0,petpet:!0,pluginList:!0,themeList:!0,konoself:!0,konosend:!0,firstmessage:!0,sysinfo:!0,spotifyTrack:!0,spotifyAlbum:!0,spotifyArtists:!0,spotifyCover:!0,gary:!0,ip:!0,lovefemboys:!1,nekoslife:!1,friendInviteCreate:!0,friendInviteView:!0,friendInviteRevoke:!0}),a.storage.pendingRestart==null&&(a.storage.pendingRestart=!1),a.storage.hiddenSettings==null&&(a.storage.hiddenSettings={enabled:!1,visible:!1,konochanBypassNsfw:!1}),a.storage.sidebarEnabled==null&&(a.storage.sidebarEnabled=!0);function Se(){E.useProxy(a.storage);const e=n.NavigationNative.useNavigation();n.React.useEffect(function(){return function(){a.storage.pendingRestart&&(a.storage.pendingRestart=!1,w.alerts.showConfirmationAlert({title:"Restart Required",content:"You have made changes to commands. Please restart Discord to apply these changes.",confirmText:"Okay",cancelText:null,onConfirm:function(){}}))}},[]);const t=a.storage.garySettings.imageSource==="gary"?"Gary API":a.storage.garySettings.imageSource==="catapi"?"Cat API":a.storage.garySettings.imageSource==="minker"?"Minker API":a.storage.garySettings.imageSource==="goober"?"Goober API":"Gary API";return n.React.createElement(S,{style:{flex:1},contentContainerStyle:{padding:10}},n.React.createElement(Gt,null),n.React.createElement(R,{spacing:12},n.React.createElement(h,{title:"Command Categories"},n.React.createElement(p,{label:"Facts Commands",subLabel:"Cat facts, dog facts, and useless facts",trailing:n.React.createElement(p.Arrow,null),onPress:function(){return e.push("VendettaCustomPage",{title:"Facts Commands",render:jt})}}),n.React.createElement(p,{label:"List Commands",subLabel:"Plugin lists and theme lists",trailing:n.React.createElement(p.Arrow,null),onPress:function(){return e.push("VendettaCustomPage",{title:"List Commands",render:Ht})}}),n.React.createElement(p,{label:"Image Commands",subLabel:"PetPet, KonoChan, and image utilities",trailing:n.React.createElement(p.Arrow,null),onPress:function(){return e.push("VendettaCustomPage",{title:"Image Commands",render:zt})}}),n.React.createElement(p,{label:"Gary Commands",subLabel:`Gary images - Current: ${t}`,trailing:n.React.createElement(p.Arrow,null),onPress:function(){return e.push("VendettaCustomPage",{title:"Gary Commands",render:Kt})}}),n.React.createElement(p,{label:"Spotify Commands",subLabel:"Share your Spotify activity",trailing:n.React.createElement(p.Arrow,null),onPress:function(){return e.push("VendettaCustomPage",{title:"Spotify Commands",render:qt})}}),n.React.createElement(p,{label:"Aliucord Commands",subLabel:"Commands from Aliucord",trailing:n.React.createElement(p.Arrow,null),onPress:function(){return e.push("VendettaCustomPage",{title:"Aliucord",render:Yt})}}),n.React.createElement(p,{label:"Other Commands",subLabel:"Utility and system commands",trailing:n.React.createElement(p.Arrow,null),onPress:function(){return e.push("VendettaCustomPage",{title:"Other Commands",render:Jt})}})),a.storage.hiddenSettings?.visible&&n.React.createElement(h,{title:"Hidden Settings"},n.React.createElement(p,{label:"Hidden Commands",subLabel:"Access to experimental and NSFW commands",trailing:n.React.createElement(p.Arrow,null),onPress:function(){return e.push("VendettaCustomPage",{title:"Hidden Settings",render:Qt})}})),n.React.createElement(h,{title:"Other"},n.React.createElement(p,{label:"Credits",subLabel:"View original authors of the plugins",trailing:n.React.createElement(p.Arrow,null),onPress:function(){return e.push("VendettaCustomPage",{title:"Credits",render:en})}}))))}const{FormSection:tn,FormRow:Z}=Ae.Forms,{TableRowIcon:nn}=g.findByProps("TableRowIcon"),B=window.bunny,Re=B?.metro?.findByPropsLazy("getRootNavigationRef"),ee=B?.metro?.findByPropsLazy("SETTING_RENDERER_CONFIG"),Ee=B?.metro?.findByPropsLazy("createList"),Ne=B?.metro?.findByNameLazy("SettingsOverviewScreen",!1);function an({tabs:e}){const t=n.NavigationNative.useNavigation();return n.React.createElement(Z,{label:e.title(),leading:n.React.createElement(Z.Icon,{source:e.icon}),trailing:n.React.createElement(n.React.Fragment,{},[e.trailing?e.trailing():null,n.React.createElement(Z.Arrow,{key:"arrow"})]),onPress:function(){const r=e.page;t.navigate("VendettaCustomPage",{title:e.title(),render:function(){return n.React.createElement(r)}})}})}function rn(e,t){try{t.push(_.after("default",B?.metro?.findByPropsLazy(["renderTitle","sections"],!1),function(r,s){const i=X.findInReactTree(s.props.children,function(o){return o.type?.name==="UserSettingsOverview"});i&&t.push(_.after("render",i.type.prototype,function(o,l){const c=X.findInReactTree(l.props.children,function(u){return u?.children?.[1]?.type===tn})?.children;if(c){const u=c.findIndex(function(d){return["BILLING_SETTINGS","PREMIUM_SETTINGS"].includes(d?.props?.label)});c.splice(-~u||4,0,n.React.createElement(an,{key:e.key,tabs:e}))}}))},!0))}catch{}}function sn(e,t){if(!ee||!Re){console.warn("[Commands Plugin] Missing required constants for tabs UI patch");return}const r={[e.key]:{type:"pressable",useTitle:e.title,title:e.title,icon:e.icon,IconComponent:e.icon&&function(){return n.React.createElement(nn,{source:e.icon})},usePredicate:e.predicate,useTrailing:e.trailing,onPress:function(){const o=Re.getRootNavigationRef(),l=e.page;o.navigate("VendettaCustomPage",{title:e.title(),render:function(){return n.React.createElement(l)}})},withArrow:!0}};let s=ee.SETTING_RENDERER_CONFIG;Object.defineProperty(ee,"SETTING_RENDERER_CONFIG",{enumerable:!0,configurable:!0,get:function(){return{...s,...r}},set(o){s=o}});const i=Symbol("pinToSettings meow meow");try{if(!Ee)return;t.push(_.after("createList",Ee,function(o){if(!o[0][i]){o[0][i]=!0;const[l]=o,c=l.sections?.find(function(u){return["Bunny","Revenge","Kettu","Vencore","ShiggyCord"].some(function(d){return u.label===d&&u.title===d})});c?.settings&&(c.settings=[...c.settings,e.key])}}))}catch{if(!Ne)return;t.push(_.after("default",Ne,function(o,l){if(!o[0][i]){o[0][i]=!0;const{sections:c}=X.findInReactTree(l,function(d){return d.props?.sections}).props,u=c?.find(function(d){return["Bunny","Revenge","Kettu","Vencore","ShiggyCord"].some(function(f){return d.label===f&&d.title===f})});u?.settings&&(u.settings=[...u.settings,e.key])}}))}}function on(e){const t=[];let r=!1;const s=e.predicate||function(){return!0};return e.predicate=function(){return r?!1:s()},rn(e,t),sn(e,t),t.push(function(){return r=!0}),function(){for(const i of t)i()}}function ln(){if(a.storage.sidebarEnabled===!1)return console.log("[Commands Plugin] Sidebar disabled in settings"),function(){};console.log("[Commands Plugin] Patching sidebar...");try{const e=on({key:"CommandsPlugin",icon:b.getAssetIDByName("SettingsIcon"),title:function(){return"Commands"},predicate:function(){return a.storage.sidebarEnabled!==!1},page:Se});return console.log("[Commands Plugin] Successfully patched sidebar"),e}catch(e){return console.error("[Commands Plugin] Failed to patch sidebar:",e),function(){}}}a.storage.factSettings||(a.storage.factSettings={sendAsReply:!0,includeCitation:!1}),a.storage.listSettings||(a.storage.listSettings={pluginListAlwaysDetailed:!1,themeListAlwaysDetailed:!1}),a.storage.garySettings||(a.storage.garySettings={imageSource:"gary"}),a.storage.enabledCommands||(a.storage.enabledCommands={catfact:!0,dogfact:!0,useless:!0,petpet:!0,pluginList:!0,themeList:!0,konoself:!0,konosend:!0,firstmessage:!0,sysinfo:!0,spotifyTrack:!0,spotifyAlbum:!0,spotifyArtists:!0,spotifyCover:!0,gary:!0,ip:!0,lovefemboys:!1,nekoslife:!1,friendInviteCreate:!0,friendInviteView:!0,friendInviteRevoke:!0}),a.storage.hiddenSettings||(a.storage.hiddenSettings={enabled:!1,visible:!1,konochanBypassNsfw:!1}),a.storage.sidebarEnabled===void 0&&(a.storage.sidebarEnabled=!0);const cn={catfact:Be,dogfact:Fe,useless:Me,petpet:Ke,pluginList:Ge,themeList:je,konoself:Ye,konosend:Je,firstmessage:tt,sysinfo:dt,spotifyTrack:pt,spotifyAlbum:ht,spotifyArtists:bt,spotifyCover:vt,gary:wt,ip:kt,lovefemboys:Nt,nekoslife:xt,friendInviteCreate:Mt,friendInviteView:_t,friendInviteRevoke:Vt};let te=[],z;var dn={onLoad:function(){if(console.log("[Commands Plugin] Loading..."),a.storage.sidebarEnabled!==!1)try{z=ln(),console.log("[Commands Plugin] Sidebar patched successfully")}catch(e){console.error("[Commands Plugin] Failed to patch sidebar:",e)}for(const[e,t]of Object.entries(cn))if(a.storage.enabledCommands[e])try{te.push(ke.registerCommand(t)),console.log(`[Commands Plugin] Registered command: ${e}`)}catch(r){console.error(`[Commands Plugin] Failed to register command ${e}:`,r)}},onUnload:function(){if(console.log("[Commands Plugin] Unloading..."),te.forEach(function(e){try{e()}catch{}}),te=[],z)try{z(),z=void 0,console.log("[Commands Plugin] Sidebar unpatched")}catch(e){console.error("[Commands Plugin] Failed to unpatch sidebar:",e)}},settings:Se};return q.default=dn,Object.defineProperty(q,"__esModule",{value:!0}),q})({},vendetta.commands,vendetta.plugin,vendetta.metro,vendetta.ui.toasts,vendetta.themes,vendetta.plugins,vendetta.ui,vendetta.metro.common,vendetta.debug,vendetta.ui.assets,vendetta.storage,vendetta.patcher,vendetta.ui.components,vendetta.utils); diff --git a/Commands/manifest.json b/Commands/manifest.json index 8dca4d6..00c3e3a 100644 --- a/Commands/manifest.json +++ b/Commands/manifest.json @@ -1 +1 @@ -{"authors":[{"name":"kmmiio99o","id":"879393496627306587"}],"main":"index.js","vendetta":{"icon":"ic_badge_staff","original":"plugins/all-in-one"},"name":"Commands","description":"A collection of fixed commands including facts, petpet, and more.","version":"1.0.0","hash":"cd82e3b65868eec1eaa2f464d7045434944f58a35bd22af86db0da4cc9800b8a"} \ No newline at end of file +{"authors":[{"name":"kmmiio99o","id":"879393496627306587"}],"main":"index.js","vendetta":{"icon":"ic_badge_staff","original":"plugins/all-in-one"},"name":"Commands","description":"A collection of fixed commands including facts, petpet, and more.","version":"1.0.0","hash":"ce1b167ded70b0493c92802ee4081d120dba7e30aea7c94bf358add49ee357ea"} \ No newline at end of file diff --git a/Last.fm/index.js b/Last.fm/index.js index e5ad7fc..a1c7767 100644 --- a/Last.fm/index.js +++ b/Last.fm/index.js @@ -1 +1 @@ -(function(E,S,a,x,g,A,v,N){"use strict";const s={DEFAULT_APP_NAME:"Music",DEFAULT_TIME_INTERVAL:5,APPLICATION_ID:"1054951789318909972",MIN_UPDATE_INTERVAL:3,MAX_RETRY_ATTEMPTS:3,RETRY_DELAY:5e3,LFM_API_BASE_URL:"http://ws.audioscrobbler.com/2.0",LFM_DEFAULT_COVER_HASHES:["2a96cbd8b46e442fc41c2b86b821562f","c6f59c1e5e7240a4c0d427abd71f3dbb"],DEFAULT_SETTINGS:{username:"",apiKey:"",appName:"Music",timeInterval:5,showTimestamp:!0,listeningTo:!0,ignoreSpotify:!0,verboseLogging:!1},GITHUB_URL:"https://github.com/kmmiio99o/vd-plugins",GITHUB_COMMITS_URL:"https://github.com/kmmiio99o/vd-plugins/commits/main/"};function P(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function U(t,e){for(var n=0;n0&&(f=i+Math.floor(r/1e3))}catch(m){console.warn("[Last.fm] Failed to fetch track duration",m)}return{name:e.name,artist:e.artist.name,album:e.album["#text"],albumArt:await this.handleAlbumCover(e.image?.find(function(m){return m.size==="large"})?.["#text"]),url:e.url,date:e.date?.["#text"]??"now",nowPlaying:n,loved:e.loved==="1",from:i,to:f}}catch(e){if(this.retryCount++,this.retryCount>s.MAX_RETRY_ATTEMPTS)throw this.retryCount=0,console.error("[Last.fm] Max retry attempts reached"),e;return await new Promise(function(n){return setTimeout(n,s.RETRY_DELAY)}),this.fetchLatestScrobble()}}},{key:"handleAlbumCover",value:async function(e){return!e||s.LFM_DEFAULT_COVER_HASHES.some(function(n){return e.includes(n)})?null:e}},{key:"getLastError",value:function(){return this.lastError}},{key:"resetRetryCount",value:function(){this.retryCount=0}}],[{key:"getInstance",value:function(){return t.instance||(t.instance=new t),t.instance}}]),t})().getInstance();function H(t){const e=Math.floor(t/60),n=Math.floor(t%60);return`${e}:${n.toString().padStart(2,"0")}`}var j=(function(t){return t[t.PLAYING=0]="PLAYING",t[t.STREAMING=1]="STREAMING",t[t.LISTENING=2]="LISTENING",t[t.COMPETING=5]="COMPETING",t})(j||{});const d=function(...t){return o.verboseLogging&&console.log("[Last.fm]",...t)},$=(function(){function t(){P(this,t)}return C(t,[{key:"updateActivity",value:async function(){if(c.pluginStopped){d("Plugin is stopped, skipping update"),this.stopUpdates();return}d("Fetching last track...");try{if(!o.username||!o.apiKey)throw new Error("Username or API key not set");if(o.ignoreSpotify){if(Y.findActivity(function(i){return i.sync_id})){d("Spotify is currently playing, clearing activity"),h("isSpotifyIgnored",!0),_();return}h("isSpotifyIgnored",!1)}const e=await M.fetchLatestScrobble();if(h("lastTrack",e),!e.nowPlaying){d("Last track is not currently playing"),_();return}if(c.lastTrackUrl===e.url){d("Track hasn't changed");return}const n={name:o.appName||s.DEFAULT_APP_NAME,flags:0,type:o.listeningTo?2:0,details:e.name,state:`by ${e.artist}`,status_display_type:1,application_id:s.APPLICATION_ID};if(n.name.includes("{{"))for(const i in e)n.name=n.name.replace(`{{${i}}}`,e[i]||"");if(o.showTimestamp&&typeof e.from=="number"&&(n.timestamps={start:e.from*1e3,...typeof e.to=="number"&&{end:e.to*1e3}}),e.album){const i=await K([e.albumArt]);i[0]&&(n.assets={large_image:i[0],large_text:`on ${e.album}${o.showTimestamp&&e.to?` \u2022 ${H((e.to-e.from)/1e3)}`:""}`})}d("Setting activity:",n),h("lastActivity",n),await F(n),c.lastTrackUrl=e.url,c.lastActivity=n,this.consecutiveFailures=0,d("Activity set successfully!")}catch(e){console.error("[Last.fm] Update error:",e),this.handleError(e)}}},{key:"handleError",value:function(e){this.consecutiveFailures++,h("lastError",e),this.consecutiveFailures>=s.MAX_RETRY_ATTEMPTS&&(console.log(`[Last.fm] Failed ${this.consecutiveFailures} times, initiating reconnection...`),this.startReconnection())}},{key:"startReconnection",value:function(){var e=this;this.isReconnecting||(this.isReconnecting=!0,this.stopUpdates(),console.log("[Last.fm] Starting reconnection process"),this.reconnectTimer=setInterval(function(){console.log("[Last.fm] Attempting to reconnect..."),e.initialize().then(function(){console.log("[Last.fm] Reconnection successful"),e.stopReconnection()}).catch(function(n){console.log("[Last.fm] Reconnection failed:",n)})},s.RETRY_DELAY))}},{key:"stopReconnection",value:function(){this.reconnectTimer&&(clearInterval(this.reconnectTimer),this.reconnectTimer=void 0),this.isReconnecting=!1,this.consecutiveFailures=0}},{key:"stopUpdates",value:function(){this.updateTimer&&(clearInterval(this.updateTimer),this.updateTimer=void 0)}},{key:"initialize",value:async function(){var e=this;if(c.pluginStopped)throw new Error("Plugin is stopped");this.stopUpdates(),await this.updateActivity();const n=Math.max((Number(o.timeInterval)||s.DEFAULT_SETTINGS.timeInterval)*1e3,s.MIN_UPDATE_INTERVAL*1e3);this.updateTimer=setInterval(function(){return e.updateActivity()},n),console.log(`[Last.fm] Update timer started with interval: ${n}ms`)}},{key:"stop",value:function(){c.pluginStopped=!0,this.stopUpdates(),this.stopReconnection(),_(),console.log("[Last.fm] Plugin stopped")}}],[{key:"getInstance",value:function(){return t.instance||(t.instance=new t),t.instance}}]),t})().getInstance(),V=function(){return $.initialize()},G=function(){return $.stop()},z=[{version:"2.3.0",date:"2025-09-19",changes:["1. I TRIED SO HARD 2. remove backend error 3. factor settings tab 4. factor V2 5. factor V3 6. factor V4 7. factor V5 8. factor V6 9. Full settings refactor :3"]},{version:"2.2.0",date:"2025-09-13",changes:["Remember kids! Do not sniff crack!"]},{version:"2.0.0",date:"2025-09-13",changes:["Fix settings scrolling"]},{version:"1.3.0",date:"2025-09-13",changes:["fix reanimated"]},{version:"1.2.0",date:"2025-09-13",changes:["test"]},{version:"1.1.0",date:"2025-09-12",changes:["fixed reanimated issue??"]}],q="2.3.0",{ScrollView:X}=g.findByProps("ScrollView"),{TableRowGroup:T,TableSwitchRow:b,Stack:k,TableRow:l}=g.findByProps("TableSwitchRow","TableRowGroup","Stack","TableRow"),{TextInput:R}=g.findByProps("TextInput"),{FormText:re}=g.findByProps("FormText"),u=function(t,e=""){return S.plugin.storage[t]??e},p=function(t,e){return S.plugin.storage[t]=e};function J(){const[t,e]=a.React.useReducer(function(r){return~r},0),n=function(){return e()},[i,f]=a.React.useState(!1),m=async function(){const r=u("username"),y=u("apiKey");if(!r||!y){v.showToast("Please enter both username and API key",A.getAssetIDByName("Small"));return}f(!0);try{await M.fetchLatestScrobble(),v.showToast("Connection successful!",A.getAssetIDByName("Check")),await V()}catch(ee){v.showToast(`Connection failed: ${ee.message}`,A.getAssetIDByName("Small"))}finally{f(!1)}};return a.React.createElement(X,{style:{flex:1},contentContainerStyle:{padding:10}},a.React.createElement(k,{spacing:8},a.React.createElement(T,{title:"Account Settings"},a.React.createElement(k,{spacing:4},a.React.createElement(R,{placeholder:"Last.fm Username",value:u("username"),onChange:function(r){p("username",r),n()},isClearable:!0}),a.React.createElement(R,{placeholder:"API Key",value:u("apiKey"),onChange:function(r){p("apiKey",r),n()},secureTextEntry:!0,isClearable:!0}),a.React.createElement(l,{label:"Get API Key",subLabel:"https://www.last.fm/api/",onPress:function(){return N.Linking.openURL("https://www.last.fm/api/")}})),a.React.createElement(l,{label:"Test Connection",trailing:i?a.React.createElement(l.Arrow,{loading:!0}):a.React.createElement(l.Arrow,null),onPress:m,disabled:i})),a.React.createElement(T,{title:"Display Settings"},a.React.createElement(k,{spacing:4},a.React.createElement(R,{placeholder:`App Name (Default: ${s.DEFAULT_SETTINGS.appName})`,value:u("appName",s.DEFAULT_SETTINGS.appName),onChange:function(r){p("appName",r),n()},isClearable:!0}),a.React.createElement(R,{placeholder:`Update Interval (Default: ${s.DEFAULT_SETTINGS.timeInterval}s)`,value:String(u("timeInterval",s.DEFAULT_SETTINGS.timeInterval)),onChange:function(r){const y=Number(r);y>=s.MIN_UPDATE_INTERVAL?(p("timeInterval",y),n()):v.showToast(`Minimum interval is ${s.MIN_UPDATE_INTERVAL} seconds`,A.getAssetIDByName("Small"))},keyboardType:"numeric",isClearable:!0}))),a.React.createElement(T,{title:"Options"},a.React.createElement(b,{label:"Show 'Listening to' instead of 'Playing'",value:u("listeningTo",s.DEFAULT_SETTINGS.listeningTo),onValueChange:function(r){p("listeningTo",r),n()}}),a.React.createElement(b,{label:"Show Timestamp",value:u("showTimestamp",s.DEFAULT_SETTINGS.showTimestamp),onValueChange:function(r){p("showTimestamp",r),n()}}),a.React.createElement(b,{label:"Ignore when Spotify is playing",value:u("ignoreSpotify",s.DEFAULT_SETTINGS.ignoreSpotify),onValueChange:function(r){p("ignoreSpotify",r),n()}}),a.React.createElement(b,{label:"Verbose Logging",value:u("verboseLogging",s.DEFAULT_SETTINGS.verboseLogging),onValueChange:function(r){p("verboseLogging",r),n()}})),a.React.createElement(T,{title:"Plugin Status"},a.React.createElement(l,{label:"Status",subLabel:c.pluginStopped?"Stopped":"Running"}),a.React.createElement(l,{label:"Last Update",subLabel:c.lastTrackUrl?"Success":"No track data"})),a.React.createElement(T,{title:"About"},a.React.createElement(l,{label:"Version",subLabel:q}),a.React.createElement(l,{label:"View Changelog",trailing:a.React.createElement(l.Arrow,null),onPress:function(){N.Linking.openURL(s.GITHUB_COMMITS_URL)}})),a.React.createElement(T,{title:"Changelog"},z.map(function(r,y){return a.React.createElement(l,{key:y,label:`v${r.version} (${r.date})`,subLabel:r.changes.join(", ")})}))))}const{FormText:ie}=x.Forms,c={pluginStopped:!1,lastActivity:void 0,updateInterval:void 0,lastTrackUrl:void 0},O=s.DEFAULT_SETTINGS;for(const t in O)S.plugin.storage[t]=S.plugin.storage[t]??O[t];const o=new Proxy(S.plugin.storage,{get(t,e){return t[e]},set(t,e,n){return t[e]=n,!0}});let w=0;const Q=3,W=5e3;async function I(){try{await V(),w=0,console.log("[Last.fm] Successfully connected to Last.fm")}catch(t){console.error("[Last.fm] Initialization error:",t),w++,w0&&(p=i+Math.floor(f/1e3))}catch(r){console.warn("[Last.fm] Failed to fetch track duration",r)}return{name:e.name,artist:e.artist.name,album:e.album["#text"],albumArt:await this.handleAlbumCover(e.image?.find(function(r){return r.size==="large"})?.["#text"]),url:e.url,date:e.date?.["#text"]??"now",nowPlaying:n,loved:e.loved==="1",from:i,to:p}}catch(e){if(this.retryCount++,this.retryCount>s.MAX_RETRY_ATTEMPTS)throw this.retryCount=0,console.error("[Last.fm] Max retry attempts reached"),e;return await new Promise(function(n){return setTimeout(n,s.RETRY_DELAY)}),this.fetchLatestScrobble()}}},{key:"handleAlbumCover",value:async function(e){return!e||s.LFM_DEFAULT_COVER_HASHES.some(function(n){return e.includes(n)})?null:e}},{key:"getLastError",value:function(){return this.lastError}},{key:"resetRetryCount",value:function(){this.retryCount=0}}],[{key:"getInstance",value:function(){return t.instance||(t.instance=new t),t.instance}}]),t})().getInstance();function Y(t){const e=Math.floor(t/60),n=Math.floor(t%60);return`${e}:${n.toString().padStart(2,"0")}`}var K=(function(t){return t[t.PLAYING=0]="PLAYING",t[t.STREAMING=1]="STREAMING",t[t.LISTENING=2]="LISTENING",t[t.COMPETING=5]="COMPETING",t})(K||{});const h=function(...t){return o.verboseLogging&&console.log("[Last.fm]",...t)},F=(function(){function t(){k(this,t)}return U(t,[{key:"updateActivity",value:async function(){if(c.pluginStopped){h("Plugin is stopped, skipping update"),this.stopUpdates();return}h("Fetching last track...");try{if(!o.username||!o.apiKey)throw new Error("Username or API key not set");if(o.ignoreSpotify){if(x.findActivity(function(i){return i.sync_id})){h("Spotify is currently playing, clearing activity"),m("isSpotifyIgnored",!0),w();return}m("isSpotifyIgnored",!1)}const e=await M.fetchLatestScrobble();if(m("lastTrack",e),!e.nowPlaying){h("Last track is not currently playing"),w();return}if(c.lastTrackUrl===e.url){h("Track hasn't changed");return}const n={name:o.appName||s.DEFAULT_APP_NAME,flags:0,type:o.listeningTo?2:0,details:e.name,state:`by ${e.artist}`,status_display_type:1,application_id:s.APPLICATION_ID};if(n.name.includes("{{"))for(const i in e)n.name=n.name.replace(`{{${i}}}`,e[i]||"");if(o.showTimestamp&&typeof e.from=="number"&&(n.timestamps={start:e.from*1e3,...typeof e.to=="number"&&{end:e.to*1e3}}),e.album){const i=await B([e.albumArt]);i[0]&&(n.assets={large_image:i[0],large_text:`on ${e.album}${o.showTimestamp&&e.to?` \u2022 ${Y((e.to-e.from)/1e3)}`:""}`})}h("Setting activity:",n),m("lastActivity",n),await D(n),c.lastTrackUrl=e.url,c.lastActivity=n,this.consecutiveFailures=0,h("Activity set successfully!")}catch(e){console.error("[Last.fm] Update error:",e),this.handleError(e)}}},{key:"handleError",value:function(e){this.consecutiveFailures++,m("lastError",e),this.consecutiveFailures>=s.MAX_RETRY_ATTEMPTS&&(console.log(`[Last.fm] Failed ${this.consecutiveFailures} times, initiating reconnection...`),this.startReconnection())}},{key:"startReconnection",value:function(){var e=this;this.isReconnecting||(this.isReconnecting=!0,this.stopUpdates(),console.log("[Last.fm] Starting reconnection process"),this.reconnectTimer=setInterval(function(){console.log("[Last.fm] Attempting to reconnect..."),e.initialize().then(function(){console.log("[Last.fm] Reconnection successful"),e.stopReconnection()}).catch(function(n){console.log("[Last.fm] Reconnection failed:",n)})},s.RETRY_DELAY))}},{key:"stopReconnection",value:function(){this.reconnectTimer&&(clearInterval(this.reconnectTimer),this.reconnectTimer=void 0),this.isReconnecting=!1,this.consecutiveFailures=0}},{key:"stopUpdates",value:function(){this.updateTimer&&(clearInterval(this.updateTimer),this.updateTimer=void 0)}},{key:"initialize",value:async function(){var e=this;if(c.pluginStopped)throw new Error("Plugin is stopped");this.stopUpdates(),await this.updateActivity();const n=Math.max((Number(o.timeInterval)||s.DEFAULT_SETTINGS.timeInterval)*1e3,s.MIN_UPDATE_INTERVAL*1e3);this.updateTimer=setInterval(function(){return e.updateActivity()},n),console.log(`[Last.fm] Update timer started with interval: ${n}ms`)}},{key:"stop",value:function(){c.pluginStopped=!0,this.stopUpdates(),this.stopReconnection(),w(),console.log("[Last.fm] Plugin stopped")}}],[{key:"getInstance",value:function(){return t.instance||(t.instance=new t),t.instance}}]),t})().getInstance(),$=function(){return F.initialize()},V=function(){return F.stop()},H=[{version:"2.3.0",date:"2025-09-19",changes:["1. I TRIED SO HARD 2. remove backend error 3. factor settings tab 4. factor V2 5. factor V3 6. factor V4 7. factor V5 8. factor V6 9. Full settings refactor :3"]},{version:"2.2.0",date:"2025-09-13",changes:["Remember kids! Do not sniff crack!"]},{version:"2.0.0",date:"2025-09-13",changes:["Fix settings scrolling"]},{version:"1.3.0",date:"2025-09-13",changes:["fix reanimated"]},{version:"1.2.0",date:"2025-09-13",changes:["test"]},{version:"1.1.0",date:"2025-09-12",changes:["fixed reanimated issue??"]}],j="2.3.0",{ScrollView:z}=d.findByProps("ScrollView"),{TableRowGroup:T,TableSwitchRow:L,Stack:_,TableRow:l}=d.findByProps("TableSwitchRow","TableRowGroup","Stack","TableRow"),{TextInput:b}=d.findByProps("TextInput"),u=function(t,e=""){return E.plugin.storage[t]??e},g=function(t,e){return E.plugin.storage[t]=e};function q(){const[,t]=a.React.useReducer(function(r){return~r},0),e=function(){return t()},[n,i]=a.React.useState(!1),p=async function(){const r=u("username"),f=u("apiKey");if(!r||!f){A.showToast("Please enter both username and API key",I.getAssetIDByName("Small"));return}i(!0);try{await M.fetchLatestScrobble(),A.showToast("Connection successful!",I.getAssetIDByName("Check")),await $()}catch(W){A.showToast(`Connection failed: ${W.message}`,I.getAssetIDByName("Small"))}finally{i(!1)}};return a.React.createElement(z,{style:{flex:1},contentContainerStyle:{padding:10}},a.React.createElement(_,{spacing:8},a.React.createElement(T,{title:"Account Settings"},a.React.createElement(_,{spacing:4},a.React.createElement(b,{placeholder:"Last.fm Username",value:u("username"),onChange:function(r){g("username",r),e()},isClearable:!0}),a.React.createElement(b,{placeholder:"API Key",value:u("apiKey"),onChange:function(r){g("apiKey",r),e()},secureTextEntry:!0,isClearable:!0}),a.React.createElement(l,{label:"Get API Key",subLabel:"https://www.last.fm/api/",onPress:function(){return N.Linking.openURL("https://www.last.fm/api/")}})),a.React.createElement(l,{label:"Test Connection",trailing:n?a.React.createElement(l.Arrow,{loading:!0}):a.React.createElement(l.Arrow,null),onPress:p,disabled:n})),a.React.createElement(T,{title:"Display Settings"},a.React.createElement(_,{spacing:4},a.React.createElement(b,{placeholder:`App Name (Default: ${s.DEFAULT_SETTINGS.appName})`,value:u("appName",s.DEFAULT_SETTINGS.appName),onChange:function(r){g("appName",r),e()},isClearable:!0}),a.React.createElement(b,{placeholder:`Update Interval (Default: ${s.DEFAULT_SETTINGS.timeInterval}s)`,value:String(u("timeInterval",s.DEFAULT_SETTINGS.timeInterval)),onChange:function(r){const f=Number(r);f>=s.MIN_UPDATE_INTERVAL?(g("timeInterval",f),e()):A.showToast(`Minimum interval is ${s.MIN_UPDATE_INTERVAL} seconds`,I.getAssetIDByName("Small"))},keyboardType:"numeric",isClearable:!0}))),a.React.createElement(T,{title:"Options"},a.React.createElement(L,{label:"Show 'Listening to' instead of 'Playing'",value:u("listeningTo",s.DEFAULT_SETTINGS.listeningTo),onValueChange:function(r){g("listeningTo",r),e()}}),a.React.createElement(L,{label:"Show Timestamp",value:u("showTimestamp",s.DEFAULT_SETTINGS.showTimestamp),onValueChange:function(r){g("showTimestamp",r),e()}}),a.React.createElement(L,{label:"Ignore when Spotify is playing",value:u("ignoreSpotify",s.DEFAULT_SETTINGS.ignoreSpotify),onValueChange:function(r){g("ignoreSpotify",r),e()}}),a.React.createElement(L,{label:"Verbose Logging",value:u("verboseLogging",s.DEFAULT_SETTINGS.verboseLogging),onValueChange:function(r){g("verboseLogging",r),e()}})),a.React.createElement(T,{title:"Plugin Status"},a.React.createElement(l,{label:"Status",subLabel:c.pluginStopped?"Stopped":"Running"}),a.React.createElement(l,{label:"Last Update",subLabel:c.lastTrackUrl?"Success":"No track data"})),a.React.createElement(T,{title:"About"},a.React.createElement(l,{label:"Version",subLabel:j}),a.React.createElement(l,{label:"View Changelog",trailing:a.React.createElement(l.Arrow,null),onPress:function(){N.Linking.openURL(s.GITHUB_COMMITS_URL)}})),a.React.createElement(T,{title:"Changelog"},H.map(function(r,f){return a.React.createElement(l,{key:f,label:`v${r.version} (${r.date})`,subLabel:r.changes.join(", ")})}))))}const c={pluginStopped:!1,lastActivity:void 0,updateInterval:void 0,lastTrackUrl:void 0},G=s.DEFAULT_SETTINGS;for(const t in G)E.plugin.storage[t]=E.plugin.storage[t]??G[t];const o=new Proxy(E.plugin.storage,{get(t,e){return t[e]},set(t,e,n){return t[e]=n,!0}});let R=0;const X=3,J=5e3;async function S(){try{await $(),R=0,console.log("[Last.fm] Successfully connected to Last.fm")}catch(t){console.error("[Last.fm] Initialization error:",t),R++,R10&&(S.serviceErrors[e]=S.serviceErrors[e].slice(-10)),me(`${e} error:`,t)}function we(){S.lastSuccessfulUpdate=new Date().toISOString(),J("Successful update recorded at:",S.lastSuccessfulUpdate)}function ee(e){return ee=Object.setPrototypeOf?Object.getPrototypeOf:function(n){return n.__proto__||Object.getPrototypeOf(n)},ee(e)}function Re(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Re=function(){return!!e})()}function rt(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function nt(e){"@swc/helpers - typeof";return e&&typeof Symbol<"u"&&e.constructor===Symbol?"symbol":typeof e}function at(e,t){return t&&(nt(t)==="object"||typeof t=="function")?t:rt(e)}function ie(e,t,n){return t=ee(t),at(e,Re()?Reflect.construct(t,n||[],ee(e).constructor):t.apply(e,n))}function se(e,t){return se=Object.setPrototypeOf||function(a,i){return a.__proto__=i,a},se(e,t)}function oe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&se(e,t)}const Se=["Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36","Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36","Mozilla/5.0 (Macintosh; Intel Mac OS X 14_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36","Mozilla/5.0 (Macintosh; Intel Mac OS X 14_5) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.5 Safari/605.1.15","Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:127.0) Gecko/20100101 Firefox/127.0","Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36","Mozilla/5.0 (X11; Linux x86_64; rv:127.0) Gecko/20100101 Firefox/127.0","Mozilla/5.0 (iPhone; CPU iPhone OS 17_5_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.5 Mobile/15E148 Safari/604.1"];let le=(function(){function e(){B(this,e)}return O(e,[{key:"log",value:function(...t){console.log(`[${this.getServiceName()}]`,...t)}},{key:"logError",value:function(...t){console.error(`[${this.getServiceName()}] Error:`,...t)}},{key:"logVerbose",value:function(...t){console.log(`[${this.getServiceName()}] Verbose:`,...t)}},{key:"handleError",value:async function(t){this.lastError=t.error||0;const n=this.getErrorMessage(t);throw this.logError(n),Z(this.getServiceName().toLowerCase(),n),new Error(`${this.getServiceName()} API Error: ${n}`)}},{key:"getErrorMessage",value:function(t){return t.error&&b.API_ERROR_CODES[t.error]?b.API_ERROR_CODES[t.error]:t.message||t.toString()||"Unknown error"}},{key:"makeRequest",value:async function(t,n={}){try{this.logVerbose(`Making request to: ${t}`),ve();const a=await fetch(t,{...n,headers:{"User-Agent":Se[Math.floor(Math.random()*Se.length)],...n.headers}});if(!a.ok){const s=new Error(`HTTP ${a.status}: ${a.statusText}`);throw Z(this.getServiceName().toLowerCase(),s.message),s}const i=await a.json();return i.error&&await this.handleError(i),this.retryCount=0,i}catch(a){if(this.retryCount++,this.retryCount>b.MAX_RETRY_ATTEMPTS)throw this.retryCount=0,Z(this.getServiceName().toLowerCase(),`Max retries exceeded: ${a.message}`),a;return this.logVerbose(`Request failed, retrying (${this.retryCount}/${b.MAX_RETRY_ATTEMPTS})`),await new Promise(function(i){return setTimeout(i,b.RETRY_DELAY)}),this.makeRequest(t,n)}}},{key:"isDefaultCover",value:function(t){return t?b.DEFAULT_COVER_HASHES.some(function(n){return t.includes(n)}):!0}},{key:"processAlbumArt",value:function(t){return!t||this.isDefaultCover(t)?null:t}},{key:"getLastError",value:function(){return this.lastError}},{key:"resetRetryCount",value:function(){this.retryCount=0}}]),e})(),it=(function(e){oe(t,e);function t(){return B(this,t),ie(this,t,arguments)}return O(t,[{key:"getServiceName",value:function(){return"Last.fm"}},{key:"logVerbose",value:function(...n){l.verboseLogging&&console.log(`[${this.getServiceName()}] Verbose:`,...n)}},{key:"validateCredentials",value:async function(){try{if(!l.username||!l.apiKey)throw new Error("Username or API key not set");const n=new URLSearchParams({method:"user.getinfo",user:l.username,api_key:l.apiKey,format:"json"}),a=`${b.SERVICES.lastfm.baseUrl}?${n}`;return await this.makeRequest(a),this.log("Credentials validation successful"),!0}catch(n){return this.logError("Credentials validation failed:",n),!1}}},{key:"fetchLatestScrobble",value:async function(){try{if(!l.username||!l.apiKey)throw new Error("Username or API key not set");this.logVerbose("Fetching latest scrobble for user:",l.username);const n=new URLSearchParams({method:"user.getrecenttracks",user:l.username,api_key:l.apiKey,limit:"1",extended:"1",format:"json"}),a=`${b.SERVICES.lastfm.baseUrl}?${n}`,i=(await this.makeRequest(a))?.recenttracks?.track?.[0];if(!i)throw new Error("No tracks found");this.logVerbose("Raw track data:",i);const s=!!i["@attr"]?.nowplaying,o=i.date?.uts?parseInt(i.date.uts):Math.floor(Date.now()/1e3),f=function(k,y="name"){return k?typeof k=="string"?k:k["#text"]??k[y]??"":""};let g=null,h=null;if(s)try{const k=new URLSearchParams({method:"track.getInfo",track:i.name,artist:f(i.artist),api_key:l.apiKey,format:"json"}),y=`${b.SERVICES.lastfm.baseUrl}?${k}`,w=await this.makeRequest(y);w?.track?.duration&&(g=parseInt(w.track.duration),g>0&&(g=Math.floor(g/1e3),h=o+g))}catch(k){this.logVerbose("Failed to fetch track duration:",k)}const A=this.processAlbumArt(i.image?.find(function(k){return k.size==="large"})?.["#text"]),$={name:i.name,artist:f(i.artist),album:f(i.album,"title"),albumArt:A,url:i.url,date:i.date?.["#text"]??"now",nowPlaying:s,loved:i.loved==="1",from:o,to:h,duration:g};return this.logVerbose("Processed track:",$),this.log(`${s?"Now playing":"Last played"}:`,`${$.artist} - ${$.name}`),$}catch(n){throw this.logError("Failed to fetch latest scrobble:",n),n}}}]),t})(le),st=(function(e){oe(t,e);function t(){return B(this,t),ie(this,t,arguments)}return O(t,[{key:"getServiceName",value:function(){return"Libre.fm"}},{key:"logVerbose",value:function(...n){l.verboseLogging&&console.log(`[${this.getServiceName()}] Verbose:`,...n)}},{key:"validateCredentials",value:async function(){try{const n=l.librefmUsername,a=l.librefmApiKey;if(!n||!a)throw new Error("Username or API key not set for Libre.fm");const i=new URLSearchParams({method:"user.getinfo",user:n,api_key:a,format:"json"}),s=`${b.SERVICES.librefm.baseUrl}?${i}`;return await this.makeRequest(s),this.log("Credentials validation successful"),!0}catch(n){return this.logError("Credentials validation failed:",n),!1}}},{key:"fetchLatestScrobble",value:async function(){try{const n=l.librefmUsername,a=l.librefmApiKey;if(!n||!a)throw new Error("Username or API key not set for Libre.fm");this.logVerbose("Fetching latest scrobble for user:",n);const i=new URLSearchParams({method:"user.getrecenttracks",user:n,api_key:a,limit:"1",extended:"1",format:"json"}),s=`${b.SERVICES.librefm.baseUrl}?${i}`,o=(await this.makeRequest(s))?.recenttracks?.track?.[0];if(!o)throw new Error("No tracks found");this.logVerbose("Raw track data:",o);const f=!!o["@attr"]?.nowplaying,g=o.date?.uts?parseInt(o.date.uts):Math.floor(Date.now()/1e3),h=function(w,P="name"){return w?typeof w=="string"?w:w["#text"]??w[P]??"":""};let A=null,$=null;if(f)try{const w=new URLSearchParams({method:"track.getInfo",track:o.name,artist:h(o.artist),api_key:a,format:"json"}),P=`${b.SERVICES.librefm.baseUrl}?${w}`,_=await this.makeRequest(P);_?.track?.duration&&(A=parseInt(_.track.duration),A>0&&(A=Math.floor(A/1e3),$=g+A))}catch(w){this.logVerbose("Failed to fetch track duration:",w)}const k=this.processAlbumArt(o.image?.find(function(w){return w.size==="large"})?.["#text"]),y={name:o.name,artist:h(o.artist),album:h(o.album,"title"),albumArt:k,url:o.url,date:o.date?.["#text"]??"now",nowPlaying:f,loved:o.loved==="1",from:g,to:$,duration:A};return this.logVerbose("Processed track:",y),this.log(`${f?"Now playing":"Last played"}:`,`${y.artist} - ${y.name}`),y}catch(n){throw this.logError("Failed to fetch latest scrobble:",n),n}}}]),t})(le),ot=(function(e){oe(t,e);function t(){return B(this,t),ie(this,t,arguments)}return O(t,[{key:"getServiceName",value:function(){return"ListenBrainz"}},{key:"logVerbose",value:function(...n){l.verboseLogging&&console.log(`[${this.getServiceName()}] Verbose:`,...n)}},{key:"validateCredentials",value:async function(){try{const n=l.listenbrainzUsername,a=l.listenbrainzToken;if(!n)throw new Error("Username not set for ListenBrainz");const i=`${b.SERVICES.listenbrainz.baseUrl}/user/${encodeURIComponent(n)}/listens?count=1`,s={};return a&&(s.Authorization=`Token ${a}`),await this.makeRequest(i,{headers:s}),this.log("Credentials validation successful"),!0}catch(n){return this.logError("Credentials validation failed:",n),!1}}},{key:"fetchLatestScrobble",value:async function(){try{const n=l.listenbrainzUsername,a=l.listenbrainzToken;if(!n)throw new Error("Username not set for ListenBrainz");this.logVerbose("Fetching latest scrobble for user:",n);let i=null;const s=function(y){if(y){if(Array.isArray(y.listens))return y.listens;if(y.payload&&Array.isArray(y.payload.listens))return y.payload.listens;if(y.data&&Array.isArray(y.data.listens))return y.data.listens}};try{const y=`${b.SERVICES.listenbrainz.baseUrl}/user/${encodeURIComponent(n)}/playing-now`,w={};a&&(w.Authorization=`Token ${a}`);const P=await this.makeRequest(y,{headers:w}),_=s(P);_&&_.length>0&&(i=_[0],i.playing_now=!0)}catch(y){this.logVerbose("No currently playing track or failed to fetch:",y)}let o;if(i)o=i,this.logVerbose("Using currently playing track");else{const y=`${b.SERVICES.listenbrainz.baseUrl}/user/${encodeURIComponent(n)}/listens?count=1`,w={};a&&(w.Authorization=`Token ${a}`);const P=await this.makeRequest(y,{headers:w}),_=(function(){if(P){if(Array.isArray(P.listens))return P.listens;if(P.payload&&Array.isArray(P.payload.listens))return P.payload.listens;if(P.data&&Array.isArray(P.data.listens))return P.data.listens}})();if(!_||_.length===0)throw new Error("No listens found");o=_[0],this.logVerbose("Using latest completed listen")}this.logVerbose("Raw listen data:",o);const f=!!o.playing_now,g=o.listened_at||Math.floor(Date.now()/1e3);let h=null,A=null;o.track_metadata.additional_info?.duration_ms&&(h=Math.floor(o.track_metadata.additional_info.duration_ms/1e3),f&&h>0&&(A=g+h));let $=null;o.track_metadata.additional_info?.release_mbid&&($=`https://coverartarchive.org/release/${o.track_metadata.additional_info.release_mbid}/front`);const k={name:o.track_metadata.track_name,artist:o.track_metadata.artist_name,album:o.track_metadata.release_name||"",albumArt:$,url:o.track_metadata.additional_info?.origin_url||`https://listenbrainz.org/player/${o.track_metadata.additional_info?.recording_mbid||`${encodeURIComponent(o.track_metadata.artist_name)}/${encodeURIComponent(o.track_metadata.track_name)}`}`,date:f?"now":new Date(g*1e3).toISOString(),nowPlaying:f,loved:!1,from:g,to:A,duration:h};return this.logVerbose("Processed track:",k),this.log(`${f?"Now playing":"Last played"}:`,`${k.artist} - ${k.name}`),k}catch(n){throw this.logError("Failed to fetch latest listen:",n),n}}},{key:"getErrorMessage",value:function(n){return n.error?n.error:n.message?n.message:n.toString()||"Unknown error"}}]),t})(le);const K=(function(){function e(){B(this,e),this.serviceInstances=new Map}return O(e,[{key:"getService",value:function(t){this.serviceInstances||(this.serviceInstances=new Map);const n=t||l.service;if(!n)throw new Error("[ServiceFactory] No service type specified and no default service configured");return this.serviceInstances.has(n)||this.serviceInstances.set(n,this.createService(n)),this.serviceInstances.get(n)}},{key:"getCurrentService",value:function(){return this.getService(l.service)}},{key:"createService",value:function(t){switch(t){case"lastfm":return new it;case"librefm":return new st;case"listenbrainz":return new ot;default:throw new Error(`[ServiceFactory] Unknown service type: ${t}`)}}},{key:"clearCache",value:function(){this.serviceInstances?this.serviceInstances.clear():this.serviceInstances=new Map}},{key:"validateCurrentService",value:function(){return this.getCurrentService().validateCredentials()}},{key:"testService",value:async function(t){try{return await this.getService(t).validateCredentials()}catch(n){return console.error(`[ServiceFactory] Failed to test ${t}:`,n),!1}}},{key:"getSupportedServices",value:function(){return["lastfm","librefm","listenbrainz"]}},{key:"getServiceDisplayName",value:function(t){return this.getService(t).getServiceName()}}],[{key:"getInstance",value:function(){return e.instance||(e.instance=new e),e.instance}}]),e})().getInstance();function Ee(e){if(!e||e<0)return"0:00";const t=Math.floor(e/3600),n=Math.floor(e%3600/60),a=Math.floor(e%60);return t>0?`${t}:${n.toString().padStart(2,"0")}:${a.toString().padStart(2,"0")}`:`${n}:${a.toString().padStart(2,"0")}`}function Te(){return Math.floor(Date.now()/1e3)}var lt=(function(e){return e[e.PLAYING=0]="PLAYING",e[e.STREAMING=1]="STREAMING",e[e.LISTENING=2]="LISTENING",e[e.COMPETING=5]="COMPETING",e})(lt||{});const C=function(...e){return console.log("[Scrobble Plugin]",...e)},z=function(...e){return console.error("[Scrobble Plugin] Error:",...e)},N=function(...e){return l.verboseLogging&&console.log("[Scrobble Plugin] Verbose:",...e)},ce=(function(){function e(){B(this,e)}return O(e,[{key:"updateActivity",value:async function(){if(E.pluginStopped){C("Plugin is stopped; skipping activity updates and clearing timers"),N("Plugin is stopped, skipping update");try{this.stopUpdates(),N("Update timers cleared due to stopped plugin")}catch(a){z("Error while stopping updates for stopped plugin:",a)}return}const t=K.getCurrentService().getServiceName();N(`Fetching latest track from ${t}...`);let n=!1;try{if(l.ignoreList&&l.ignoreList.length>0){const o=et.findActivity(function(f){return f.name?l.ignoreList.some(function(g){return f.name.toLowerCase().includes(g.toLowerCase())}):!1});if(o){C(`Ignored app (${o.name}) is currently active; clearing activity and skipping updates`),N(`Ignored app (${o.name}) is currently playing, clearing activity`);try{j("ignoredActivity",o.name)}catch(f){N("Failed to set debug info for ignored activity:",f)}ae();return}}ve();const a=await K.getCurrentService().fetchLatestScrobble();if(j("lastTrack",a),!a.nowPlaying){C("No currently playing track reported by service; clearing activity and skipping RPC update"),N("Track is not currently playing");try{j("lastTrack_nowPlaying",!1)}catch(o){N("Failed to set debug info for nowPlaying:",o)}ae();return}if(E.lastTrackUrl===a.url){C("Track unchanged; skipping Discord RPC update"),N("Track hasn't changed"),we(),this.consecutiveFailures=0;return}n=!0,C(`\u{1F3B5} Track changed: ${a.artist} - ${a.name}`);let i;if(a.nowPlaying&&l.showTimestamp&&a.from){const o=Te();let f=a.from;if(f0){const g=Math.min(a.duration*.1,30);f=o-g}else f=o;N("had to estimate start time")}i={start:f*1e3},a.to&&(i.end=a.to*1e3)}N(`\u{1F3AF} Preparing RPC update for: ${a.artist} - ${a.name}`);const s={name:l.appName||b.DEFAULT_APP_NAME,flags:0,type:l.listeningTo?2:0,details:a.name,state:`${a.artist}`,status_display_type:1,application_id:b.APPLICATION_ID};if(s.name.includes("{{")){const o={artist:a.artist,name:a.name,album:a.album,service:t};for(const[f,g]of Object.entries(o))s.name=s.name.replace(new RegExp(`{{${f}}}`,"g"),g||"")}if(i&&(s.timestamps=i,N("Timestamps set:",{start:new Date(i.start).toISOString(),end:i.end?new Date(i.end).toISOString():"none",duration:a.duration?Ee(a.duration):"unknown"})),a.album||a.albumArt){const o=a.albumArt?[a.albumArt]:[];let f=(await tt(o))[0];if(f){if(s.assets={large_image:f},l.showLargeText){let g="";if(l.showAlbumInTooltip&&a.album&&(g+=`on ${a.album}`),l.showDurationInTooltip&&a.duration){const h=Ee(a.duration);g?g+=` \u2022 ${h}`:g=h}g&&(s.assets.large_text=g)}N("Album art set:",f),s.assets.large_text&&N("Tooltip text set:",s.assets.large_text)}else a.album&&l.showLargeText&&l.showAlbumInTooltip&&(s.assets={large_text:`on ${a.album}`})}N("Setting Discord activity:",s),j("lastActivity",s),await ye(s),E.lastTrackUrl=a.url,this.currentActivity=s,E.lastActivity=s,this.consecutiveFailures=0,this.lastUpdateTime=Te(),we(),C(`\u2705 RPC updated successfully: ${a.artist} - ${a.name}`)}catch(a){z("Update failed:",a);try{Z(l.service,a.message)}catch(i){z("Failed to record service error:",i)}try{j("lastUpdateError",{message:a.message,service:l.service,lastTrackUrl:E.lastTrackUrl})}catch(i){N("Failed to set debug info for last update error:",i)}this.handleError(a)}}},{key:"handleError",value:function(t){this.consecutiveFailures++,j("lastError",t),z(`Failure ${this.consecutiveFailures}/${b.MAX_RETRY_ATTEMPTS}:`,t.message),this.consecutiveFailures>=b.MAX_RETRY_ATTEMPTS&&(z("Max retry attempts reached, initiating reconnection..."),this.startReconnection())}},{key:"startReconnection",value:function(){var t=this;this.isReconnecting||(this.isReconnecting=!0,this.stopUpdates(),C("Starting reconnection process..."),this.reconnectTimer=setInterval(function(){C("Attempting to reconnect..."),t.initialize().then(function(){C("Reconnection successful!"),t.stopReconnection()}).catch(function(n){z("Reconnection attempt failed:",n.message)})},b.RETRY_DELAY))}},{key:"stopReconnection",value:function(){try{this.reconnectTimer&&(clearInterval(this.reconnectTimer),this.reconnectTimer=void 0),this.isReconnecting=!1,this.consecutiveFailures=0}catch(t){console.error("[Scrobble Plugin] Reconnection cleanup error:",t)}}},{key:"stopUpdates",value:function(){try{this.updateTimer&&(clearInterval(this.updateTimer),this.updateTimer=void 0)}catch(t){console.error("[Scrobble Plugin] Timer cleanup error:",t)}}},{key:"initialize",value:async function(){var t=this;if(E.pluginStopped)throw new Error("Plugin is stopped");const n=K.getCurrentService().getServiceName();C(`Initializing with ${n}...`);try{if(!await K.validateCurrentService())throw new Error(`Invalid credentials for ${n}`);C(`${n} credentials validated successfully`)}catch(o){throw z(`Failed to validate ${n} credentials:`,o),o}this.stopUpdates(),C("\u{1F3B5} checking for already playing songs..."),await this.updateActivity();const a=l.service;let i=b.MIN_UPDATE_INTERVAL;a==="librefm"&&(i=b.LIBREFM_MIN_UPDATE_INTERVAL,C(`Libre.fm active: enforcing ${i}s minimum update interval`));const s=Math.max((Number(l.timeInterval)||b.DEFAULT_SETTINGS.timeInterval)*1e3,i*1e3);this.updateTimer=setInterval(function(){return t.updateActivity()},s),C(`Update timer started with interval: ${s}ms (${s/1e3}s)`)}},{key:"stop",value:function(){if(!E.pluginStopped){C("Stopping plugin..."),E.pluginStopped=!0;try{this.stopUpdates(),this.stopReconnection(),ae(),C("Plugin stopped successfully")}catch(t){console.error("[Scrobble Plugin] Stop error:",t)}}}},{key:"switchService",value:async function(t){if(E.pluginStopped)return;C(`Switching to ${t}...`);const n=!E.pluginStopped;this.stop();try{K.clearCache(),E.lastTrackUrl=void 0,this.currentActivity=void 0,this.lastUpdateTime=0,n&&(E.pluginStopped=!1,await this.initialize())}catch(a){z("Failed to switch service:",a)}}},{key:"getStatus",value:function(){const t=K.getCurrentService().getServiceName();return{running:!E.pluginStopped,service:t,consecutiveFailures:this.consecutiveFailures,isReconnecting:this.isReconnecting,lastTrackUrl:E.lastTrackUrl,updateInterval:this.updateTimer?"Active":"Inactive"}}}],[{key:"getInstance",value:function(){return e.instance||(e.instance=new e),e.instance}}]),e})().getInstance(),ct=function(){return ce.initialize()},ue=function(){return ce.stop()},ut=function(e){return ce.switchService(e)},{ScrollView:F}=x.findByProps("ScrollView"),{TableRowGroup:T,TableSwitchRow:ke,TableCheckboxRow:W,Stack:U,TableRow:u}=x.findByProps("TableSwitchRow","TableCheckboxRow","TableRowGroup","Stack","TableRow"),{TextInput:D}=x.findByProps("TextInput");function ft(){M.useProxy(p.plugin.storage);const[,e]=r.React.useReducer(function(n){return n+1},0),t=async function(){I.showToast("Testing Last.fm connection...",R.getAssetIDByName("ClockIcon"));try{await X.testService("lastfm")?I.showToast("\u2705 Last.fm connection successful!",R.getAssetIDByName("CheckIcon")):I.showToast("\u274C Last.fm connection failed",R.getAssetIDByName("XIcon"))}catch{I.showToast("\u274C Connection error",R.getAssetIDByName("XIcon"))}};return r.React.createElement(F,{style:{flex:1},contentContainerStyle:{padding:10}},r.React.createElement(U,{spacing:8},r.React.createElement(T,{title:"Credentials"},r.React.createElement(U,{spacing:4},r.React.createElement(D,{placeholder:"Last.fm Username",value:c("username"),onChange:function(n){L("username",n),e()},isClearable:!0}),r.React.createElement(D,{placeholder:"Last.fm API Key",value:c("apiKey"),onChange:function(n){L("apiKey",n),e()},secureTextEntry:!0,isClearable:!0}))),r.React.createElement(T,{title:"Actions"},r.React.createElement(u,{label:"Test Connection",subLabel:"Verify your Last.fm credentials",trailing:r.React.createElement(u.Arrow,null),onPress:t}),r.React.createElement(u,{label:"Get API Key",subLabel:"Create a Last.fm API key at last.fm/api/account/create",trailing:r.React.createElement(u.Arrow,null),onPress:async function(){try{await re.Linking.openURL("https://www.last.fm/api/account/create")}catch(n){console.error("Failed to open Last.fm API URL:",n),I.showToast("Failed to open web browser. Please visit: https://www.last.fm/api/account/create",R.getAssetIDByName("XIcon"))}}}))))}function gt(){M.useProxy(p.plugin.storage);const[,e]=r.React.useReducer(function(n){return n+1},0),t=async function(){I.showToast("Testing Libre.fm connection...",R.getAssetIDByName("ClockIcon"));try{await X.testService("librefm")?I.showToast("\u2705 Libre.fm connection successful!",R.getAssetIDByName("CheckIcon")):I.showToast("\u274C Libre.fm connection failed",R.getAssetIDByName("XIcon"))}catch{I.showToast("\u274C Connection error",R.getAssetIDByName("XIcon"))}};return r.React.createElement(F,{style:{flex:1},contentContainerStyle:{padding:10}},r.React.createElement(U,{spacing:8},r.React.createElement(T,{title:"Credentials"},r.React.createElement(U,{spacing:4},r.React.createElement(D,{placeholder:"Libre.fm Username",value:c("librefmUsername"),onChange:function(n){L("librefmUsername",n),e()},isClearable:!0}),r.React.createElement(D,{placeholder:"Libre.fm API Key",value:c("librefmApiKey"),onChange:function(n){L("librefmApiKey",n),e()},secureTextEntry:!0,isClearable:!0}))),r.React.createElement(T,{title:"Actions"},r.React.createElement(u,{label:"Test Connection",subLabel:"Verify your Libre.fm credentials",trailing:r.React.createElement(u.Arrow,null),onPress:t}),r.React.createElement(u,{label:"Get API Key",subLabel:"Create a Last.fm API key (compatible with Libre.fm)",trailing:r.React.createElement(u.Arrow,null),onPress:async function(){try{await re.Linking.openURL("https://www.last.fm/api/account/create")}catch(n){console.error("Failed to open Last.fm API URL:",n),I.showToast("Failed to open web browser. Please visit: https://www.last.fm/api/account/create",R.getAssetIDByName("XIcon"))}}}))))}function dt(){M.useProxy(p.plugin.storage);const[,e]=r.React.useReducer(function(n){return n+1},0),t=async function(){I.showToast("Testing ListenBrainz connection...",R.getAssetIDByName("ClockIcon"));try{await X.testService("listenbrainz")?I.showToast("\u2705 ListenBrainz connection successful!",R.getAssetIDByName("CheckIcon")):I.showToast("\u274C ListenBrainz connection failed",R.getAssetIDByName("XIcon"))}catch{I.showToast("\u274C Connection error",R.getAssetIDByName("XIcon"))}};return r.React.createElement(F,{style:{flex:1},contentContainerStyle:{padding:10}},r.React.createElement(U,{spacing:8},r.React.createElement(T,{title:"Credentials"},r.React.createElement(U,{spacing:4},r.React.createElement(D,{placeholder:"ListenBrainz Username",value:c("listenbrainzUsername"),onChange:function(n){L("listenbrainzUsername",n),e()},isClearable:!0}),r.React.createElement(D,{placeholder:"ListenBrainz Token",value:c("listenbrainzToken"),onChange:function(n){L("listenbrainzToken",n),e()},secureTextEntry:!0,isClearable:!0}))),r.React.createElement(T,{title:"Actions"},r.React.createElement(u,{label:"Test Connection",subLabel:"Verify your ListenBrainz credentials",trailing:r.React.createElement(u.Arrow,null),onPress:t}),r.React.createElement(u,{label:"Get User Token",subLabel:"Get your ListenBrainz user token at listenbrainz.org/settings/",trailing:r.React.createElement(u.Arrow,null),onPress:async function(){try{await re.Linking.openURL("https://listenbrainz.org/settings/")}catch(n){console.error("Failed to open ListenBrainz settings URL:",n),I.showToast("Failed to open web browser. Please visit: https://listenbrainz.org/settings/",R.getAssetIDByName("XIcon"))}}}))))}function pt(){M.useProxy(p.plugin.storage);const[,e]=r.React.useReducer(function(n){return n+1},0),t=c("service")==="librefm";return r.React.createElement(F,{style:{flex:1},contentContainerStyle:{padding:10}},r.React.createElement(U,{spacing:8},r.React.createElement(T,{title:"Activity Display"},r.React.createElement(U,{spacing:4},r.React.createElement(D,{placeholder:`App Name (Default: ${b.DEFAULT_SETTINGS.appName})`,value:c("appName",b.DEFAULT_SETTINGS.appName),onChange:function(n){L("appName",n),e()},isClearable:!0}),t?r.React.createElement(u,{label:"Update Interval Disabled",subLabel:"Libre.fm requires a fixed 60s update interval to prevent rate limiting",disabled:!0,dimmed:!0}):r.React.createElement(D,{placeholder:`Update Interval (Default: ${b.DEFAULT_SETTINGS.timeInterval}s)`,value:String(c("timeInterval",b.DEFAULT_SETTINGS.timeInterval)),onChange:function(n){const a=Number(n);a>=b.MIN_UPDATE_INTERVAL&&(L("timeInterval",a),e())},keyboardType:"numeric",isClearable:!0}))),r.React.createElement(T,{title:"About Display Settings"},r.React.createElement(u,{label:"App Name",subLabel:"The name shown in Discord for your activity"}),r.React.createElement(u,{label:"Update Interval",subLabel:"How often the plugin checks for new tracks (in seconds)"}),r.React.createElement(u,{label:"Minimum Interval",subLabel:`The plugin will never check more frequently than ${b.MIN_UPDATE_INTERVAL} seconds`}))))}function bt(){M.useProxy(p.plugin.storage);const[e,t]=r.React.useState(null),[n,a]=r.React.useState(!0),[i,s]=r.React.useState(0),[o,f]=r.React.useState(!1),g={name:"Bohemian Rhapsody",artist:"Queen",artists:["Queen"],album:"A Night at the Opera",image:null,nowPlaying:!0,duration:354,startTime:Math.floor(Date.now()/1e3)-120},h=function(d){return d?Array.isArray(d)?d.filter(function(m){return m&&typeof m=="string"}):d["#text"]?d["#text"].split(/[,;&]/).map(function(m){return m.trim()}).filter(function(m){return m.length>0}):typeof d=="string"?d.split(/[,;&]/).map(function(m){return m.trim()}).filter(function(m){return m.length>0}):["Unknown Artist"]:["Unknown Artist"]},A=function(d){return!d||d.length===0?"Unknown Artist":d.length===1?d[0]:d.length===2?`${d[0]} & ${d[1]}`:`${d.slice(0,-1).join(", ")} & ${d[d.length-1]}`};r.React.useEffect(function(){(async function(){if(!c("username")||!c("apiKey")){t(g),f(!0),a(!1);return}try{a(!0);const d=await(await fetch(`https://ws.audioscrobbler.com/2.0/?method=user.getrecenttracks&user=${c("username")}&api_key=${c("apiKey")}&format=json&limit=1`)).json();if(d.recenttracks&&d.recenttracks.track&&d.recenttracks.track.length>0){const m=d.recenttracks.track[0],G=h(m.artist);let Qe=180;try{const Pt=G[0]||"Unknown Artist",pe=await(await fetch(`https://ws.audioscrobbler.com/2.0/?method=track.getInfo&api_key=${c("apiKey")}&artist=${encodeURIComponent(Pt)}&track=${encodeURIComponent(m.name)}&format=json&u[...]`)).json();pe.track&&pe.track.duration&&(Qe=Math.floor(pe.track.duration/1e3))}catch{console.log("Could not fetch track duration, using default")}t({name:m.name||"Unknown Track",artist:A(G),artists:G,album:m.album?.["#text"]||"Unknown Album",image:m.image?.[2]?.["#text"]||m.image?.[1]?.["#text"]||null,nowPlaying:m["@attr"]?.nowplaying==="true",duration:Qe,startTime:m["@attr"]?.nowplaying==="true"?Math.floor(Date.now()/1e3)-60:null}),f(!1)}else t(g),f(!0)}catch(d){console.error("Failed to fetch preview data, using fallback:",d),t(g),f(!0)}finally{a(!1)}})()},[c("username"),c("apiKey")]),r.React.useEffect(function(){if(!e?.nowPlaying||!c("showTimestamp"))return;const d=setInterval(function(){if(e.startTime&&e.duration){const m=Math.floor(Date.now()/1e3)-e.startTime,G=Math.min(m/e.duration,1);s(G)}},1e3);return function(){return clearInterval(d)}},[e,c("showTimestamp")]);const $=function(d){const m=Math.floor(d/60),G=Math.floor(d%60);return`${m}:${G.toString().padStart(2,"0")}`},k=function(){let d="";if(c("showAlbumInTooltip")&&e?.album&&(d+=`on ${e.album}`),c("showDurationInTooltip")&&e?.duration){const m=` \u2022 ${$(e.duration)}`;d?d+=m:d=$(e.duration)}return d||"No tooltip text"},y=function(){return e?.duration?e.nowPlaying?{current:i*e.duration,total:e.duration,progress:i}:{current:e.duration*.3,total:e.duration,progress:.3}:{current:0,total:0,progress:0}},w=c("listeningTo")?"Listening to":"Playing",P=c("appName")||"Music",_=c("showLargeText",!0),Ct=c("showTimestamp",!1);if(n)return r.React.createElement(r.ReactNative.View,{style:v.container},r.React.createElement(r.ReactNative.View,{style:v.loadingContent},r.React.createElement(r.ReactNative.View,{style:v.loadingSpinner}),r.React.createElement(r.ReactNative.Text,{style:v.loadingText},"Loading preview...")));if(!e)return r.React.createElement(r.ReactNative.View,{style:v.container},r.React.createElement(r.ReactNative.Text,{style:v.centeredText},"Unable to load preview"));const de=y(),He=k();return r.React.createElement(r.ReactNative.View,{style:v.previewContainer},r.React.createElement(r.ReactNative.View,{style:v.header},r.React.createElement(r.ReactNative.Text,{style:v.activityType},w," ",P),r.React.createElement(r.ReactNative.Text,{style:v.rpcPreviewText,numberOfLines:1},"RPC Preview")),r.React.createElement(r.ReactNative.View,{style:v.content},r.React.createElement(r.ReactNative.View,{style:v.albumArt},e.image?r.React.createElement(r.ReactNative.Image,{source:{uri:e.image},style:v.albumImage,resizeMode:"cover"}):r.React.createElement(r.ReactNative.Text,{style:v.musicIcon},"\u{1F3B5}")),r.React.createElement(r.ReactNative.View,{style:v.trackInfo},r.React.createElement(r.ReactNative.Text,{style:v.trackName,numberOfLines:1},e.name),r.React.createElement(r.ReactNative.Text,{style:v.artistName,numberOfLines:1},e.artist),_&&He!=="No tooltip text"&&r.React.createElement(r.ReactNative.Text,{style:v.tooltipText,numberOfLines:1},He),Ct&&e.duration?r.React.createElement(r.ReactNative.View,{style:v.progressContainer},r.React.createElement(r.ReactNative.Text,{style:v.timeText},$(de.current)),r.React.createElement(r.ReactNative.View,{style:v.progressBar},r.React.createElement(r.ReactNative.View,{style:[v.progressFill,{width:`${de.progress*100}%`}]})),r.React.createElement(r.ReactNative.Text,{style:v.timeText},$(de.total))):null)))}const v=r.ReactNative.StyleSheet.create({container:{backgroundColor:"#1e1f22",borderRadius:12,padding:16,marginHorizontal:10,marginBottom:16,borderWidth:1,borderColor:"#3a3c41",alignItems:"center",justifyContent:"center",minHeight:120},loadingContent:{alignItems:"center",justifyContent:"center"},loadingSpinner:{width:20,height:20,borderRadius:10,borderWidth:2,borderColor:"#5865f2",borderTopColor:"transparent",marginBottom:8},previewContainer:{backgroundColor:"#1e1f22",borderRadius:12,padding:16,marginHorizontal:10,marginBottom:16,borderWidth:1,borderColor:"#3a3c41"},header:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",marginBottom:12,gap:8},content:{flexDirection:"row",alignItems:"center"},albumArt:{width:80,height:80,backgroundColor:"#2b2d31",borderRadius:12,justifyContent:"center",alignItems:"center",marginRight:16,borderWidth:1,borderColor:"#40444b",overflow:"hidden",flexShrink:0},trackInfo:{flex:1,minWidth:0},progressContainer:{flexDirection:"row",alignItems:"center",gap:8,marginTop:6},progressBar:{flex:1,height:2,backgroundColor:"#2b2d31",borderRadius:3,overflow:"hidden"},progressFill:{height:2,backgroundColor:"#5865f2",borderRadius:3},loadingText:{color:"#949ba4",fontSize:14,fontWeight:"500"},centeredText:{color:"#949ba4",fontSize:14,fontWeight:"500",textAlign:"center"},activityType:{color:"#dbdee1",fontSize:14,fontWeight:"600",flex:1},rpcPreviewText:{color:"#80848e",fontSize:12,fontStyle:"italic",flexShrink:0},albumImage:{width:80,height:80,borderRadius:12},musicIcon:{color:"#80848e",fontSize:32},trackName:{color:"#ffffff",fontSize:16,fontWeight:"700",marginBottom:4},artistName:{color:"#b5bac1",fontSize:14,fontWeight:"500",marginBottom:4},tooltipText:{color:"#80848e",fontSize:12,fontStyle:"italic",marginBottom:6},timeText:{color:"#80848e",fontSize:11,fontWeight:"500",minWidth:35,textAlign:"center"}});function ht(){M.useProxy(p.plugin.storage);const[,e]=r.React.useReducer(function(s){return s+1},0),t=c("listeningTo",b.DEFAULT_SETTINGS.listeningTo),n=c("showTimestamp",b.DEFAULT_SETTINGS.showTimestamp),a=function(){const s=!t;L("listeningTo",s),!s&&n&&L("showTimestamp",!1),e()},i=function(){t&&(L("showTimestamp",!n),e())};return r.React.createElement(F,{style:{flex:1},contentContainerStyle:{padding:10}},r.React.createElement(bt,null),r.React.createElement(U,{spacing:8},r.React.createElement(T,{title:"RPC Display Options"},r.React.createElement(W,{label:"Show as Listening",subLabel:"Display as 'Listening to' instead of 'Playing'",checked:t,onPress:a}),r.React.createElement(W,{label:"Show Tooltip Text",subLabel:"Show album name and track duration in Discord activity tooltip",checked:c("showLargeText",!0),onPress:function(){const s=c("showLargeText",!0);L("showLargeText",!s),e()}}),!t&&r.React.createElement(u,{label:"Timestamp Unavailable",subLabel:"Enable 'Show as Listening' to use timestamp feature",disabled:!0,dimmed:!0}),r.React.createElement(W,{label:"Show Timestamp",subLabel:"Display track progress and duration",checked:n,onPress:i,disabled:!t}),r.React.createElement(W,{label:"Show Album in Tooltip",subLabel:"Include album name in the tooltip text",checked:c("showAlbumInTooltip",!0),onPress:function(){const s=c("showAlbumInTooltip",!0);L("showAlbumInTooltip",!s),e()}}),r.React.createElement(W,{label:"Show Duration in Tooltip",subLabel:"Include track duration in the tooltip text",checked:c("showDurationInTooltip",!0),onPress:function(){const s=c("showDurationInTooltip",!0);L("showDurationInTooltip",!s),e()}}))))}function yt(){M.useProxy(p.plugin.storage);const[,e]=r.React.useReducer(function(s){return s+1},0),[t,n]=r.React.useState(""),a=function(){if(!t.trim()){I.showToast("Please enter an app name",R.getAssetIDByName("Small"));return}const s=c("ignoreList",[]);s.includes(t.trim())?I.showToast("App already in ignore list",R.getAssetIDByName("Warning")):(L("ignoreList",[...s,t.trim()]),n(""),e(),I.showToast("App added to ignore list",R.getAssetIDByName("Check")))},i=function(s){const o=c("ignoreList",[]);L("ignoreList",o.filter(function(f){return f!==s})),e(),I.showToast("App removed from ignore list",R.getAssetIDByName("Check"))};return r.React.createElement(F,{style:{flex:1},contentContainerStyle:{padding:10}},r.React.createElement(U,{spacing:8},r.React.createElement(T,{title:"Add App to Ignore"},r.React.createElement(U,{spacing:4},r.React.createElement(D,{placeholder:"Enter app name",value:t,onChange:n,isClearable:!0,onSubmitEditing:a,returnKeyType:"done"}))),r.React.createElement(T,null,r.React.createElement(u,{label:"Add to Ignore List",subLabel:"Add the current app name to your ignore list",trailing:r.React.createElement(u.Arrow,null),onPress:a})),c("ignoreList",[]).length>0&&r.React.createElement(T,{title:"Ignored Apps"},c("ignoreList",[]).map(function(s,o){return r.React.createElement(u,{key:o,label:s,trailing:r.React.createElement(r.ReactNative.TouchableOpacity,{onPress:function(){return i(s)},style:{padding:8,backgroundColor:"#ff4d4d",borderRadius:12,width:24,height:24,justifyContent:"center",alignItems:"center"}},r.React.createElement(r.ReactNative.Image,{source:R.getAssetIDByName("TrashIcon"),style:{width:14,height:14,tintColor:"#ffffff"}}))})})),r.React.createElement(T,{title:"About Ignore List"},r.React.createElement(u,{label:"How it Works",subLabel:"When any app in your ignore list is active, your music status will be hidden"}),r.React.createElement(u,{label:"Detection",subLabel:"Apps are detected by their Discord activity name"}),r.React.createElement(u,{label:"Examples",subLabel:"Spotify, YouTube Music, Kizzy, Metrolist, echo"}))))}function mt(){M.useProxy(p.plugin.storage);const[,e]=r.React.useReducer(function(t){return t+1},0);return r.React.createElement(F,{style:{flex:1},contentContainerStyle:{padding:10}},r.React.createElement(U,{spacing:8},r.React.createElement(T,{title:"Logging Options"},r.React.createElement(ke,{label:"Verbose Logging",subLabel:"Enable detailed console logging for debugging",value:c("verboseLogging",b.DEFAULT_SETTINGS.verboseLogging),onValueChange:function(t){L("verboseLogging",t),e()}})),r.React.createElement(T,{title:"Debug Information"},r.React.createElement(u,{label:"Console Logging",subLabel:"Logs are written to the browser/app console when verbose is enabled"}),r.React.createElement(u,{label:"Error Tracking",subLabel:"Connection errors and API failures are automatically logged"})),r.React.createElement(T,{title:"Log Information"},r.React.createElement(u,{label:"API Calls",subLabel:"All API requests are logged when verbose is enabled"}),r.React.createElement(u,{label:"Track Updates",subLabel:"Song changes and RPC updates are logged"}),r.React.createElement(u,{label:"Error Details",subLabel:"Connection errors and retries are logged"}))))}var Ie,Le,Ae,Ce,Pe,Ne,$e,Ue,_e,Me,De,xe,ze,Fe,Ve,Be,Oe;(Ie=p.plugin.storage).username??(Ie.username=""),(Le=p.plugin.storage).apiKey??(Le.apiKey=""),(Ae=p.plugin.storage).appName??(Ae.appName="Music"),(Ce=p.plugin.storage).timeInterval??(Ce.timeInterval=5),(Pe=p.plugin.storage).showTimestamp??(Pe.showTimestamp=!0),(Ne=p.plugin.storage).listeningTo??(Ne.listeningTo=!0),($e=p.plugin.storage).verboseLogging??($e.verboseLogging=!1),(Ue=p.plugin.storage).service??(Ue.service="lastfm"),(_e=p.plugin.storage).librefmUsername??(_e.librefmUsername=""),(Me=p.plugin.storage).librefmApiKey??(Me.librefmApiKey=""),(De=p.plugin.storage).listenbrainzUsername??(De.listenbrainzUsername=""),(xe=p.plugin.storage).listenbrainzToken??(xe.listenbrainzToken=""),(ze=p.plugin.storage).addToSidebar??(ze.addToSidebar=!0),(Fe=p.plugin.storage).showLargeText??(Fe.showLargeText=!0),(Ve=p.plugin.storage).ignoreList??(Ve.ignoreList=[]),(Be=p.plugin.storage).showAlbumInTooltip??(Be.showAlbumInTooltip=!0),(Oe=p.plugin.storage).showDurationInTooltip??(Oe.showDurationInTooltip=!0);const c=function(e,t){return p.plugin.storage[e]??t},L=function(e,t){return p.plugin.storage[e]=t},X=(function(){function e(){B(this,e)}return O(e,null,[{key:"getServiceDisplayName",value:function(t){switch(t){case"lastfm":return"Last.fm";case"librefm":return"Libre.fm";case"listenbrainz":return"ListenBrainz";default:return"Unknown"}}},{key:"testService",value:async function(t){try{switch(t){case"lastfm":return await this.testLastFmConnection();case"librefm":return await this.testLibreFmConnection();case"listenbrainz":return await this.testListenBrainzConnection();default:return!1}}catch(n){return console.error(`Error testing ${t}:`,n),!1}}},{key:"testLastFmConnection",value:async function(){const t=c("username"),n=c("apiKey");if(!t||!n)return!1;try{return!(await(await fetch(`https://ws.audioscrobbler.com/2.0/?method=user.getinfo&user=${t}&api_key=${n}&format=json`)).json()).error}catch(a){return console.error("Last.fm connection test failed:",a),!1}}},{key:"testLibreFmConnection",value:async function(){const t=c("librefmUsername"),n=c("librefmApiKey");if(!t||!n)return!1;try{return!(await(await fetch(`https://libre.fm/2.0/?method=user.getinfo&user=${t}&api_key=${n}&format=json`)).json()).error}catch(a){return console.error("Libre.fm connection test failed:",a),!1}}},{key:"testListenBrainzConnection",value:async function(){const t=c("listenbrainzUsername"),n=c("listenbrainzToken");if(!t)return!1;try{const a={"Content-Type":"application/json"};return n&&(a.Authorization=`Token ${n}`),(await fetch(`https://api.listenbrainz.org/1/user/${t}/listen-count`,{headers:a})).status===200}catch(a){return console.error("ListenBrainz connection test failed:",a),!1}}}]),e})();function Ke(){M.useProxy(p.plugin.storage);const e=r.NavigationNative.useNavigation(),[,t]=r.React.useReducer(function(i){return i+1},0),n=c("service"),a=function(i){switch(i){case"lastfm":return c("username")&&c("apiKey")?"\u2705 Configured":"\u274C Missing credentials";case"librefm":return c("librefmUsername")&&c("librefmApiKey")?"\u2705 Configured":"\u274C Missing credentials";case"listenbrainz":return c("listenbrainzUsername")?"\u2705 Configured":"\u274C Missing username";default:return"\u2753 Unknown"}};return r.React.createElement(F,{style:{flex:1},contentContainerStyle:{padding:10}},r.React.createElement(U,{spacing:8},r.React.createElement(T,{title:"Active Service"},r.React.createElement(u,{label:"Current Service",subLabel:n?`Using: ${X.getServiceDisplayName(n)}`:"No service selected"}),["lastfm","librefm","listenbrainz"].map(function(i){return r.React.createElement(W,{key:i,label:X.getServiceDisplayName(i),subLabel:a(i),checked:n===i,onPress:function(){i!==n&&(L("service",i),t())}})})),r.React.createElement(T,{title:"Service Configuration"},r.React.createElement(u,{label:"Last.fm Settings",subLabel:"Configure Last.fm credentials and options",trailing:r.React.createElement(u.Arrow,null),onPress:function(){return e.push("VendettaCustomPage",{title:"Last.fm Settings",render:ft})}}),r.React.createElement(u,{label:"Libre.fm Settings",subLabel:"Configure Libre.fm credentials and options",trailing:r.React.createElement(u.Arrow,null),onPress:function(){return e.push("VendettaCustomPage",{title:"Libre.fm Settings",render:gt})}}),r.React.createElement(u,{label:"ListenBrainz Settings",subLabel:"Configure ListenBrainz credentials and options",trailing:r.React.createElement(u.Arrow,null),onPress:function(){return e.push("VendettaCustomPage",{title:"ListenBrainz Settings",render:dt})}})),r.React.createElement(T,{title:"Plugin Configuration"},r.React.createElement(u,{label:"Display Settings",subLabel:"Customize app name and update interval",trailing:r.React.createElement(u.Arrow,null),onPress:function(){return e.push("VendettaCustomPage",{title:"Display Settings",render:pt})}}),r.React.createElement(u,{label:"RPC Customization",subLabel:"Customize Discord rich presence display options",trailing:r.React.createElement(u.Arrow,null),onPress:function(){return e.push("VendettaCustomPage",{title:"RPC Customization",render:ht})}}),r.React.createElement(u,{label:"Ignore List",subLabel:"Configure apps that should hide your status",trailing:r.React.createElement(u.Arrow,null),onPress:function(){return e.push("VendettaCustomPage",{title:"Ignore List Settings",render:yt})}}),r.React.createElement(u,{label:"Logging Settings",subLabel:"Configure logging and debugging options",trailing:r.React.createElement(u.Arrow,null),onPress:function(){return e.push("VendettaCustomPage",{title:"Logging Settings",render:mt})}}),r.React.createElement(ke,{label:"Add to Sidebar",subLabel:"Show plugin in Discord settings",value:c("addToSidebar",!1),onValueChange:function(i){L("addToSidebar",i),t()}})),r.React.createElement(T,{title:"About"},r.React.createElement(u,{label:"Multi Scrobbler",subLabel:"Show off your music status from multiple services"}),r.React.createElement(u,{label:"Author",subLabel:"kmmiio99o"}),r.React.createElement(u,{label:"Version",subLabel:"1.3.2"}))))}const{FormSection:vt,FormRow:fe}=Je.Forms,{TableRowIcon:wt}=x.findByProps("TableRowIcon"),Y=window.bunny,Ge=Y?.metro?.findByPropsLazy("getRootNavigationRef"),ge=Y?.metro?.findByPropsLazy("SETTING_RENDERER_CONFIG"),je=Y?.metro?.findByPropsLazy("createList"),We=Y?.metro?.findByNameLazy("SettingsOverviewScreen",!1);function Rt({tabs:e}){const t=r.NavigationNative.useNavigation();return r.React.createElement(fe,{label:e.title(),leading:r.React.createElement(fe.Icon,{source:e.icon}),trailing:r.React.createElement(r.React.Fragment,{},[e.trailing?e.trailing():null,r.React.createElement(fe.Arrow,{key:"arrow"})]),onPress:function(){const n=e.page;t.navigate("VendettaCustomPage",{title:e.title(),render:function(){return r.React.createElement(n)}})}})}function St(e,t){try{t.push(Q.after("default",Y?.metro?.findByPropsLazy(["renderTitle","sections"],!1),function(n,a){const i=ne.findInReactTree(a.props.children,function(s){return s.type?.name==="UserSettingsOverview"});i&&t.push(Q.after("render",i.type.prototype,function(s,o){const f=ne.findInReactTree(o.props.children,function(g){return g?.children?.[1]?.type===vt})?.children;if(f){const g=f.findIndex(function(h){return["BILLING_SETTINGS","PREMIUM_SETTINGS"].includes(h?.props?.label)});f.splice(-~g||4,0,r.React.createElement(Rt,{key:e.key,tabs:e}))}}))},!0))}catch(n){p.logger.info("Panel UI patch failed graciously \u{1F494}",n)}}function Et(e,t){if(!ge||!Ge){console.warn("[LastFm] Missing required constants for tabs UI patch");return}const n={[e.key]:{type:"pressable",useTitle:e.title,title:e.title,icon:e.icon,IconComponent:e.icon&&function(){return r.React.createElement(wt,{source:e.icon})},usePredicate:e.predicate,useTrailing:e.trailing,onPress:function(){const s=Ge.getRootNavigationRef(),o=e.page;s.navigate("VendettaCustomPage",{title:e.title(),render:function(){return r.React.createElement(o)}})},withArrow:!0}};let a=ge.SETTING_RENDERER_CONFIG;Object.defineProperty(ge,"SETTING_RENDERER_CONFIG",{enumerable:!0,configurable:!0,get:function(){return{...a,...n}},set:function(s){return a=s}});const i=Symbol("pinToSettings meow meow");try{if(!je)return;t.push(Q.after("createList",je,function(s,o){if(!s[0][i]){s[0][i]=!0;const[f]=s,g=f.sections?.find(function(h){return["Bunny","Revenge","Kettu","Vencore","ShiggyCord"].some(function(A){return h.label===A&&h.title===A})});g?.settings&&(g.settings=[...g.settings,e.key])}}))}catch{if(!We)return;t.push(Q.after("default",We,function(s,o){if(!s[0][i]){s[0][i]=!0;const{sections:f}=ne.findInReactTree(o,function(h){return h.props?.sections}).props,g=f?.find(function(h){return["Bunny","Revenge","Kettu","Vencore","ShiggyCord"].some(function(A){return h.label===A&&h.title===A})});g?.settings&&(g.settings=[...g.settings,e.key])}}))}}function Tt(e){const t=[];let n=!1;const a=e.predicate||function(){return!0};return e.predicate=function(){return n?!1:a()},St(e,t),Et(e,t),t.push(function(){return n=!0}),function(){for(const i of t)i()}}function qe(){if(!p.plugin.storage.addToSidebar)return console.log("[Multi Scrobbler] Sidebar disabled in settings"),function(){};console.log("[Multi Scrobbler] Patching sidebar using custom patchSettingsPin...");try{const e=Tt({key:"LastFmScrobbler",icon:R.getAssetIDByName("MusicIcon"),title:function(){return"Multi Scrobbler"},predicate:function(){return p.plugin.storage.addToSidebar===!0},page:Ke});return console.log("[Multi Scrobbler] Successfully patched sidebar"),e}catch(e){return console.error("[Multi Scrobbler] Failed to patch sidebar:",e),function(){}}}var Xe;const E={pluginStopped:!1,lastActivity:void 0,updateInterval:void 0,lastTrackUrl:void 0};let V;const Ye=b.DEFAULT_SETTINGS;Object.keys(Ye).forEach(function(e){p.plugin.storage[e]=p.plugin.storage[e]??Ye[e]}),(Xe=p.plugin.storage).addToSidebar??(Xe.addToSidebar=!1);const l=new Proxy(p.plugin.storage,{get(e,t){return e[t]},set(e,t,n){return e[t]=n,!0}});let te=0;const kt=3,It=5e3;async function H(){try{await ct(),te=0,console.log("[Multi-Scrobbler] Successfully connected")}catch(e){console.error("[Multi-Scrobbler] Initialization error:",e),te++,te0&&t[0])return t;const a=e.filter(function(i){return i&&(i.startsWith("http:")||i.startsWith("https:"))});return a.length===0?[]:await tt(a,r)}catch(t){return console.error("[Multi-Scrobbler] Failed to fetch assets:",t),[]}}const R={};R.componentMountErrors=[],R.componentMountCount=0,R.settingsLoadAttempts=0,R.serviceErrors={lastfm:[],librefm:[],listenbrainz:[]},R.apiCallCount=0,R.connectionAttempts=0,R.lastCredentialValidation={lastfm:!1,librefm:!1,listenbrainz:!1};const Q=function(...e){return console.log("[Debug]",...e)},me=function(...e){return console.error("[Debug] Error:",...e)};function j(e,r){R[e]=r,e==="lastError"&&r?me("Error recorded:",r.message):e==="lastTrack"&&r?Q("Track updated:",`${r.artist} - ${r.name}`):e==="currentService"&&r&&Q("Service changed to:",r)}function we(){R.apiCallCount=(R.apiCallCount||0)+1,Q(`API call count: ${R.apiCallCount}`)}function Z(e,r){R.serviceErrors=R.serviceErrors||{lastfm:[],librefm:[],listenbrainz:[]},R.serviceErrors[e]=R.serviceErrors[e]||[],R.serviceErrors[e].push(`${new Date().toISOString()}: ${r}`),R.serviceErrors[e].length>10&&(R.serviceErrors[e]=R.serviceErrors[e].slice(-10)),me(`${e} error:`,r)}function ve(){R.lastSuccessfulUpdate=new Date().toISOString(),Q("Successful update recorded at:",R.lastSuccessfulUpdate)}function ee(e){return ee=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},ee(e)}function Se(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Se=function(){return!!e})()}function nt(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function at(e){"@swc/helpers - typeof";return e&&typeof Symbol<"u"&&e.constructor===Symbol?"symbol":typeof e}function it(e,r){return r&&(at(r)==="object"||typeof r=="function")?r:nt(e)}function ie(e,r,t){return r=ee(r),it(e,Se()?Reflect.construct(r,t||[],ee(e).constructor):r.apply(e,t))}function se(e,r){return se=Object.setPrototypeOf||function(a,i){return a.__proto__=i,a},se(e,r)}function oe(e,r){if(typeof r!="function"&&r!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),r&&se(e,r)}const Re=["Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36","Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36","Mozilla/5.0 (Macintosh; Intel Mac OS X 14_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36","Mozilla/5.0 (Macintosh; Intel Mac OS X 14_5) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.5 Safari/605.1.15","Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:127.0) Gecko/20100101 Firefox/127.0","Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36","Mozilla/5.0 (X11; Linux x86_64; rv:127.0) Gecko/20100101 Firefox/127.0","Mozilla/5.0 (iPhone; CPU iPhone OS 17_5_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.5 Mobile/15E148 Safari/604.1"];let le=(function(){function e(){B(this,e)}return O(e,[{key:"log",value:function(...r){console.log(`[${this.getServiceName()}]`,...r)}},{key:"logError",value:function(...r){console.error(`[${this.getServiceName()}] Error:`,...r)}},{key:"logVerbose",value:function(...r){console.log(`[${this.getServiceName()}] Verbose:`,...r)}},{key:"handleError",value:async function(r){this.lastError=r.error||0;const t=this.getErrorMessage(r);throw this.logError(t),Z(this.getServiceName().toLowerCase(),t),new Error(`${this.getServiceName()} API Error: ${t}`)}},{key:"getErrorMessage",value:function(r){return r.error&&d.API_ERROR_CODES[r.error]?d.API_ERROR_CODES[r.error]:r.message||r.toString()||"Unknown error"}},{key:"makeRequest",value:async function(r,t={}){try{this.logVerbose(`Making request to: ${r}`),we();const a=await fetch(r,{...t,headers:{"User-Agent":Re[Math.floor(Math.random()*Re.length)],...t.headers}});if(!a.ok){const s=new Error(`HTTP ${a.status}: ${a.statusText}`);throw Z(this.getServiceName().toLowerCase(),s.message),s}const i=await a.json();return i.error&&await this.handleError(i),this.retryCount=0,i}catch(a){if(this.retryCount++,this.retryCount>d.MAX_RETRY_ATTEMPTS)throw this.retryCount=0,Z(this.getServiceName().toLowerCase(),`Max retries exceeded: ${a.message}`),a;return this.logVerbose(`Request failed, retrying (${this.retryCount}/${d.MAX_RETRY_ATTEMPTS})`),await new Promise(function(i){return setTimeout(i,d.RETRY_DELAY)}),this.makeRequest(r,t)}}},{key:"isDefaultCover",value:function(r){return r?d.DEFAULT_COVER_HASHES.some(function(t){return r.includes(t)}):!0}},{key:"processAlbumArt",value:function(r){return!r||this.isDefaultCover(r)?null:r}},{key:"getLastError",value:function(){return this.lastError}},{key:"resetRetryCount",value:function(){this.retryCount=0}}]),e})(),st=(function(e){oe(r,e);function r(){return B(this,r),ie(this,r,arguments)}return O(r,[{key:"getServiceName",value:function(){return"Last.fm"}},{key:"logVerbose",value:function(...t){l.verboseLogging&&console.log(`[${this.getServiceName()}] Verbose:`,...t)}},{key:"validateCredentials",value:async function(){try{if(!l.username||!l.apiKey)throw new Error("Username or API key not set");const t=new URLSearchParams({method:"user.getinfo",user:l.username,api_key:l.apiKey,format:"json"}),a=`${d.SERVICES.lastfm.baseUrl}?${t}`;return await this.makeRequest(a),this.log("Credentials validation successful"),!0}catch(t){return this.logError("Credentials validation failed:",t),!1}}},{key:"fetchLatestScrobble",value:async function(){try{if(!l.username||!l.apiKey)throw new Error("Username or API key not set");this.logVerbose("Fetching latest scrobble for user:",l.username);const t=new URLSearchParams({method:"user.getrecenttracks",user:l.username,api_key:l.apiKey,limit:"1",extended:"1",format:"json"}),a=`${d.SERVICES.lastfm.baseUrl}?${t}`,i=(await this.makeRequest(a))?.recenttracks?.track?.[0];if(!i)throw new Error("No tracks found");this.logVerbose("Raw track data:",i);const s=!!i["@attr"]?.nowplaying,o=i.date?.uts?parseInt(i.date.uts):Math.floor(Date.now()/1e3),f=function(k,y="name"){return k?typeof k=="string"?k:k["#text"]??k[y]??"":""};let b=null,h=null;if(s)try{const k=new URLSearchParams({method:"track.getInfo",track:i.name,artist:f(i.artist),api_key:l.apiKey,format:"json"}),y=`${d.SERVICES.lastfm.baseUrl}?${k}`,v=await this.makeRequest(y);v?.track?.duration&&(b=parseInt(v.track.duration),b>0&&(b=Math.floor(b/1e3),h=o+b))}catch(k){this.logVerbose("Failed to fetch track duration:",k)}const P=this.processAlbumArt(i.image?.find(function(k){return k.size==="large"})?.["#text"]),_={name:i.name,artist:f(i.artist),album:f(i.album,"title"),albumArt:P,url:i.url,date:i.date?.["#text"]??"now",nowPlaying:s,loved:i.loved==="1",from:o,to:h,duration:b};return this.logVerbose("Processed track:",_),this.log(`${s?"Now playing":"Last played"}:`,`${_.artist} - ${_.name}`),_}catch(t){throw this.logError("Failed to fetch latest scrobble:",t),t}}}]),r})(le),ot=(function(e){oe(r,e);function r(){return B(this,r),ie(this,r,arguments)}return O(r,[{key:"getServiceName",value:function(){return"Libre.fm"}},{key:"logVerbose",value:function(...t){l.verboseLogging&&console.log(`[${this.getServiceName()}] Verbose:`,...t)}},{key:"validateCredentials",value:async function(){try{const t=l.librefmUsername,a=l.librefmApiKey;if(!t||!a)throw new Error("Username or API key not set for Libre.fm");const i=new URLSearchParams({method:"user.getinfo",user:t,api_key:a,format:"json"}),s=`${d.SERVICES.librefm.baseUrl}?${i}`;return await this.makeRequest(s),this.log("Credentials validation successful"),!0}catch(t){return this.logError("Credentials validation failed:",t),!1}}},{key:"fetchLatestScrobble",value:async function(){try{const t=l.librefmUsername,a=l.librefmApiKey;if(!t||!a)throw new Error("Username or API key not set for Libre.fm");this.logVerbose("Fetching latest scrobble for user:",t);const i=new URLSearchParams({method:"user.getrecenttracks",user:t,api_key:a,limit:"1",extended:"1",format:"json"}),s=`${d.SERVICES.librefm.baseUrl}?${i}`,o=(await this.makeRequest(s))?.recenttracks?.track?.[0];if(!o)throw new Error("No tracks found");this.logVerbose("Raw track data:",o);const f=!!o["@attr"]?.nowplaying,b=o.date?.uts?parseInt(o.date.uts):Math.floor(Date.now()/1e3),h=function(v,C="name"){return v?typeof v=="string"?v:v["#text"]??v[C]??"":""};let P=null,_=null;if(f)try{const v=new URLSearchParams({method:"track.getInfo",track:o.name,artist:h(o.artist),api_key:a,format:"json"}),C=`${d.SERVICES.librefm.baseUrl}?${v}`,$=await this.makeRequest(C);$?.track?.duration&&(P=parseInt($.track.duration),P>0&&(P=Math.floor(P/1e3),_=b+P))}catch(v){this.logVerbose("Failed to fetch track duration:",v)}const k=this.processAlbumArt(o.image?.find(function(v){return v.size==="large"})?.["#text"]),y={name:o.name,artist:h(o.artist),album:h(o.album,"title"),albumArt:k,url:o.url,date:o.date?.["#text"]??"now",nowPlaying:f,loved:o.loved==="1",from:b,to:_,duration:P};return this.logVerbose("Processed track:",y),this.log(`${f?"Now playing":"Last played"}:`,`${y.artist} - ${y.name}`),y}catch(t){throw this.logError("Failed to fetch latest scrobble:",t),t}}}]),r})(le),lt=(function(e){oe(r,e);function r(){return B(this,r),ie(this,r,arguments)}return O(r,[{key:"getServiceName",value:function(){return"ListenBrainz"}},{key:"logVerbose",value:function(...t){l.verboseLogging&&console.log(`[${this.getServiceName()}] Verbose:`,...t)}},{key:"validateCredentials",value:async function(){try{const t=l.listenbrainzUsername,a=l.listenbrainzToken;if(!t)throw new Error("Username not set for ListenBrainz");const i=`${d.SERVICES.listenbrainz.baseUrl}/user/${encodeURIComponent(t)}/listens?count=1`,s={};return a&&(s.Authorization=`Token ${a}`),await this.makeRequest(i,{headers:s}),this.log("Credentials validation successful"),!0}catch(t){return this.logError("Credentials validation failed:",t),!1}}},{key:"fetchLatestScrobble",value:async function(){try{const t=l.listenbrainzUsername,a=l.listenbrainzToken;if(!t)throw new Error("Username not set for ListenBrainz");this.logVerbose("Fetching latest scrobble for user:",t);let i=null;const s=function(y){if(y){if(Array.isArray(y.listens))return y.listens;if(y.payload&&Array.isArray(y.payload.listens))return y.payload.listens;if(y.data&&Array.isArray(y.data.listens))return y.data.listens}};try{const y=`${d.SERVICES.listenbrainz.baseUrl}/user/${encodeURIComponent(t)}/playing-now`,v={};a&&(v.Authorization=`Token ${a}`);const C=await this.makeRequest(y,{headers:v}),$=s(C);$&&$.length>0&&(i=$[0],i.playing_now=!0)}catch(y){this.logVerbose("No currently playing track or failed to fetch:",y)}let o;if(i)o=i,this.logVerbose("Using currently playing track");else{const y=`${d.SERVICES.listenbrainz.baseUrl}/user/${encodeURIComponent(t)}/listens?count=1`,v={};a&&(v.Authorization=`Token ${a}`);const C=await this.makeRequest(y,{headers:v}),$=(function(){if(C){if(Array.isArray(C.listens))return C.listens;if(C.payload&&Array.isArray(C.payload.listens))return C.payload.listens;if(C.data&&Array.isArray(C.data.listens))return C.data.listens}})();if(!$||$.length===0)throw new Error("No listens found");o=$[0],this.logVerbose("Using latest completed listen")}this.logVerbose("Raw listen data:",o);const f=!!o.playing_now,b=o.listened_at||Math.floor(Date.now()/1e3);let h=null,P=null;o.track_metadata.additional_info?.duration_ms&&(h=Math.floor(o.track_metadata.additional_info.duration_ms/1e3),f&&h>0&&(P=b+h));let _=null;o.track_metadata.additional_info?.release_mbid&&(_=`https://coverartarchive.org/release/${o.track_metadata.additional_info.release_mbid}/front`);const k={name:o.track_metadata.track_name,artist:o.track_metadata.artist_name,album:o.track_metadata.release_name||"",albumArt:_,url:o.track_metadata.additional_info?.origin_url||`https://listenbrainz.org/player/${o.track_metadata.additional_info?.recording_mbid||`${encodeURIComponent(o.track_metadata.artist_name)}/${encodeURIComponent(o.track_metadata.track_name)}`}`,date:f?"now":new Date(b*1e3).toISOString(),nowPlaying:f,loved:!1,from:b,to:P,duration:h};return this.logVerbose("Processed track:",k),this.log(`${f?"Now playing":"Last played"}:`,`${k.artist} - ${k.name}`),k}catch(t){throw this.logError("Failed to fetch latest listen:",t),t}}},{key:"getErrorMessage",value:function(t){return t.error?t.error:t.message?t.message:t.toString()||"Unknown error"}}]),r})(le);const K=(function(){function e(){B(this,e),this.serviceInstances=new Map}return O(e,[{key:"getService",value:function(r){this.serviceInstances||(this.serviceInstances=new Map);const t=r||l.service;if(!t)throw new Error("[ServiceFactory] No service type specified and no default service configured");return this.serviceInstances.has(t)||this.serviceInstances.set(t,this.createService(t)),this.serviceInstances.get(t)}},{key:"getCurrentService",value:function(){return this.getService(l.service)}},{key:"createService",value:function(r){switch(r){case"lastfm":return new st;case"librefm":return new ot;case"listenbrainz":return new lt;default:throw new Error(`[ServiceFactory] Unknown service type: ${r}`)}}},{key:"clearCache",value:function(){this.serviceInstances?this.serviceInstances.clear():this.serviceInstances=new Map}},{key:"validateCurrentService",value:function(){return this.getCurrentService().validateCredentials()}},{key:"testService",value:async function(r){try{return await this.getService(r).validateCredentials()}catch(t){return console.error(`[ServiceFactory] Failed to test ${r}:`,t),!1}}},{key:"getSupportedServices",value:function(){return["lastfm","librefm","listenbrainz"]}},{key:"getServiceDisplayName",value:function(r){return this.getService(r).getServiceName()}}],[{key:"getInstance",value:function(){return e.instance||(e.instance=new e),e.instance}}]),e})().getInstance();function Ee(e){if(!e||e<0)return"0:00";const r=Math.floor(e/3600),t=Math.floor(e%3600/60),a=Math.floor(e%60);return r>0?`${r}:${t.toString().padStart(2,"0")}:${a.toString().padStart(2,"0")}`:`${t}:${a.toString().padStart(2,"0")}`}function Te(){return Math.floor(Date.now()/1e3)}var ct=(function(e){return e[e.PLAYING=0]="PLAYING",e[e.STREAMING=1]="STREAMING",e[e.LISTENING=2]="LISTENING",e[e.COMPETING=5]="COMPETING",e})(ct||{});const L=function(...e){return console.log("[Scrobble Plugin]",...e)},z=function(...e){return console.error("[Scrobble Plugin] Error:",...e)},N=function(...e){return l.verboseLogging&&console.log("[Scrobble Plugin] Verbose:",...e)},ce=(function(){function e(){B(this,e)}return O(e,[{key:"updateActivity",value:async function(){if(E.pluginStopped){L("Plugin is stopped; skipping activity updates and clearing timers"),N("Plugin is stopped, skipping update");try{this.stopUpdates(),N("Update timers cleared due to stopped plugin")}catch(t){z("Error while stopping updates for stopped plugin:",t)}return}const r=K.getCurrentService().getServiceName();N(`Fetching latest track from ${r}...`);try{if(l.ignoreList&&l.ignoreList.length>0){const s=et.findActivity(function(o){return o.name?l.ignoreList.some(function(f){return o.name.toLowerCase().includes(f.toLowerCase())}):!1});if(s){L(`Ignored app (${s.name}) is currently active; clearing activity and skipping updates`),N(`Ignored app (${s.name}) is currently playing, clearing activity`);try{j("ignoredActivity",s.name)}catch(o){N("Failed to set debug info for ignored activity:",o)}ae();return}}we();const t=await K.getCurrentService().fetchLatestScrobble();if(j("lastTrack",t),!t.nowPlaying){L("No currently playing track reported by service; clearing activity and skipping RPC update"),N("Track is not currently playing");try{j("lastTrack_nowPlaying",!1)}catch(s){N("Failed to set debug info for nowPlaying:",s)}ae();return}if(E.lastTrackUrl===t.url){L("Track unchanged; skipping Discord RPC update"),N("Track hasn't changed"),ve(),this.consecutiveFailures=0;return}L(`\u{1F3B5} Track changed: ${t.artist} - ${t.name}`);let a;if(t.nowPlaying&&l.showTimestamp&&t.from){const s=Te();let o=t.from;if(o0){const f=Math.min(t.duration*.1,30);o=s-f}else o=s;N("had to estimate start time")}a={start:o*1e3},t.to&&(a.end=t.to*1e3)}N(`\u{1F3AF} Preparing RPC update for: ${t.artist} - ${t.name}`);const i={name:l.appName||d.DEFAULT_APP_NAME,flags:0,type:l.listeningTo?2:0,details:t.name,state:`${t.artist}`,status_display_type:1,application_id:d.APPLICATION_ID};if(i.name.includes("{{")){const s={artist:t.artist,name:t.name,album:t.album,service:r};for(const[o,f]of Object.entries(s))i.name=i.name.replace(new RegExp(`{{${o}}}`,"g"),f||"")}if(a&&(i.timestamps=a,N("Timestamps set:",{start:new Date(a.start).toISOString(),end:a.end?new Date(a.end).toISOString():"none",duration:t.duration?Ee(t.duration):"unknown"})),t.album||t.albumArt){const s=t.albumArt?[t.albumArt]:[];let o=(await rt(s))[0];if(o){if(i.assets={large_image:o},l.showLargeText){let f="";if(l.showAlbumInTooltip&&t.album&&(f+=`on ${t.album}`),l.showDurationInTooltip&&t.duration){const b=Ee(t.duration);f?f+=` \u2022 ${b}`:f=b}f&&(i.assets.large_text=f)}N("Album art set:",o),i.assets.large_text&&N("Tooltip text set:",i.assets.large_text)}else t.album&&l.showLargeText&&l.showAlbumInTooltip&&(i.assets={large_text:`on ${t.album}`})}N("Setting Discord activity:",i),j("lastActivity",i),await ye(i),E.lastTrackUrl=t.url,this.currentActivity=i,E.lastActivity=i,this.consecutiveFailures=0,this.lastUpdateTime=Te(),ve(),L(`\u2705 RPC updated successfully: ${t.artist} - ${t.name}`)}catch(t){z("Update failed:",t);try{Z(l.service,t.message)}catch(a){z("Failed to record service error:",a)}try{j("lastUpdateError",{message:t.message,service:l.service,lastTrackUrl:E.lastTrackUrl})}catch(a){N("Failed to set debug info for last update error:",a)}this.handleError(t)}}},{key:"handleError",value:function(r){this.consecutiveFailures++,j("lastError",r),z(`Failure ${this.consecutiveFailures}/${d.MAX_RETRY_ATTEMPTS}:`,r.message),this.consecutiveFailures>=d.MAX_RETRY_ATTEMPTS&&(z("Max retry attempts reached, initiating reconnection..."),this.startReconnection())}},{key:"startReconnection",value:function(){var r=this;this.isReconnecting||(this.isReconnecting=!0,this.stopUpdates(),L("Starting reconnection process..."),this.reconnectTimer=setInterval(function(){L("Attempting to reconnect..."),r.initialize().then(function(){L("Reconnection successful!"),r.stopReconnection()}).catch(function(t){z("Reconnection attempt failed:",t.message)})},d.RETRY_DELAY))}},{key:"stopReconnection",value:function(){try{this.reconnectTimer&&(clearInterval(this.reconnectTimer),this.reconnectTimer=void 0),this.isReconnecting=!1,this.consecutiveFailures=0}catch(r){console.error("[Scrobble Plugin] Reconnection cleanup error:",r)}}},{key:"stopUpdates",value:function(){try{this.updateTimer&&(clearInterval(this.updateTimer),this.updateTimer=void 0)}catch(r){console.error("[Scrobble Plugin] Timer cleanup error:",r)}}},{key:"initialize",value:async function(){var r=this;if(E.pluginStopped)throw new Error("Plugin is stopped");const t=K.getCurrentService().getServiceName();L(`Initializing with ${t}...`);try{if(!await K.validateCurrentService())throw new Error(`Invalid credentials for ${t}`);L(`${t} credentials validated successfully`)}catch(o){throw z(`Failed to validate ${t} credentials:`,o),o}this.stopUpdates(),L("\u{1F3B5} checking for already playing songs..."),await this.updateActivity();const a=l.service;let i=d.MIN_UPDATE_INTERVAL;a==="librefm"&&(i=d.LIBREFM_MIN_UPDATE_INTERVAL,L(`Libre.fm active: enforcing ${i}s minimum update interval`));const s=Math.max((Number(l.timeInterval)||d.DEFAULT_SETTINGS.timeInterval)*1e3,i*1e3);this.updateTimer=setInterval(function(){return r.updateActivity()},s),L(`Update timer started with interval: ${s}ms (${s/1e3}s)`)}},{key:"stop",value:function(){if(!E.pluginStopped){L("Stopping plugin..."),E.pluginStopped=!0;try{this.stopUpdates(),this.stopReconnection(),ae(),L("Plugin stopped successfully")}catch(r){console.error("[Scrobble Plugin] Stop error:",r)}}}},{key:"switchService",value:async function(r){if(E.pluginStopped)return;L(`Switching to ${r}...`);const t=!E.pluginStopped;this.stop();try{K.clearCache(),E.lastTrackUrl=void 0,this.currentActivity=void 0,this.lastUpdateTime=0,t&&(E.pluginStopped=!1,await this.initialize())}catch(a){z("Failed to switch service:",a)}}},{key:"getStatus",value:function(){const r=K.getCurrentService().getServiceName();return{running:!E.pluginStopped,service:r,consecutiveFailures:this.consecutiveFailures,isReconnecting:this.isReconnecting,lastTrackUrl:E.lastTrackUrl,updateInterval:this.updateTimer?"Active":"Inactive"}}}],[{key:"getInstance",value:function(){return e.instance||(e.instance=new e),e.instance}}]),e})().getInstance(),ut=function(){return ce.initialize()},ue=function(){return ce.stop()},ft=function(e){return ce.switchService(e)},{ScrollView:F}=M.findByProps("ScrollView"),{TableRowGroup:T,TableSwitchRow:ke,TableCheckboxRow:W,Stack:U,TableRow:u}=M.findByProps("TableSwitchRow","TableCheckboxRow","TableRowGroup","Stack","TableRow"),{TextInput:x}=M.findByProps("TextInput");function gt(){D.useProxy(g.plugin.storage);const[,e]=n.React.useReducer(function(t){return t+1},0),r=async function(){I.showToast("Testing Last.fm connection...",S.getAssetIDByName("ClockIcon"));try{await X.testService("lastfm")?I.showToast("\u2705 Last.fm connection successful!",S.getAssetIDByName("CheckIcon")):I.showToast("\u274C Last.fm connection failed",S.getAssetIDByName("XIcon"))}catch{I.showToast("\u274C Connection error",S.getAssetIDByName("XIcon"))}};return n.React.createElement(F,{style:{flex:1},contentContainerStyle:{padding:10}},n.React.createElement(U,{spacing:8},n.React.createElement(T,{title:"Credentials"},n.React.createElement(U,{spacing:4},n.React.createElement(x,{placeholder:"Last.fm Username",value:c("username"),onChange:function(t){A("username",t),e()},isClearable:!0}),n.React.createElement(x,{placeholder:"Last.fm API Key",value:c("apiKey"),onChange:function(t){A("apiKey",t),e()},secureTextEntry:!0,isClearable:!0}))),n.React.createElement(T,{title:"Actions"},n.React.createElement(u,{label:"Test Connection",subLabel:"Verify your Last.fm credentials",trailing:n.React.createElement(u.Arrow,null),onPress:r}),n.React.createElement(u,{label:"Get API Key",subLabel:"Create a Last.fm API key at last.fm/api/account/create",trailing:n.React.createElement(u.Arrow,null),onPress:async function(){try{await re.Linking.openURL("https://www.last.fm/api/account/create")}catch(t){console.error("Failed to open Last.fm API URL:",t),I.showToast("Failed to open web browser. Please visit: https://www.last.fm/api/account/create",S.getAssetIDByName("XIcon"))}}}))))}function dt(){D.useProxy(g.plugin.storage);const[,e]=n.React.useReducer(function(t){return t+1},0),r=async function(){I.showToast("Testing Libre.fm connection...",S.getAssetIDByName("ClockIcon"));try{await X.testService("librefm")?I.showToast("\u2705 Libre.fm connection successful!",S.getAssetIDByName("CheckIcon")):I.showToast("\u274C Libre.fm connection failed",S.getAssetIDByName("XIcon"))}catch{I.showToast("\u274C Connection error",S.getAssetIDByName("XIcon"))}};return n.React.createElement(F,{style:{flex:1},contentContainerStyle:{padding:10}},n.React.createElement(U,{spacing:8},n.React.createElement(T,{title:"Credentials"},n.React.createElement(U,{spacing:4},n.React.createElement(x,{placeholder:"Libre.fm Username",value:c("librefmUsername"),onChange:function(t){A("librefmUsername",t),e()},isClearable:!0}),n.React.createElement(x,{placeholder:"Libre.fm API Key",value:c("librefmApiKey"),onChange:function(t){A("librefmApiKey",t),e()},secureTextEntry:!0,isClearable:!0}))),n.React.createElement(T,{title:"Actions"},n.React.createElement(u,{label:"Test Connection",subLabel:"Verify your Libre.fm credentials",trailing:n.React.createElement(u.Arrow,null),onPress:r}),n.React.createElement(u,{label:"Get API Key",subLabel:"Create a Last.fm API key (compatible with Libre.fm)",trailing:n.React.createElement(u.Arrow,null),onPress:async function(){try{await re.Linking.openURL("https://www.last.fm/api/account/create")}catch(t){console.error("Failed to open Last.fm API URL:",t),I.showToast("Failed to open web browser. Please visit: https://www.last.fm/api/account/create",S.getAssetIDByName("XIcon"))}}}))))}function pt(){D.useProxy(g.plugin.storage);const[,e]=n.React.useReducer(function(t){return t+1},0),r=async function(){I.showToast("Testing ListenBrainz connection...",S.getAssetIDByName("ClockIcon"));try{await X.testService("listenbrainz")?I.showToast("\u2705 ListenBrainz connection successful!",S.getAssetIDByName("CheckIcon")):I.showToast("\u274C ListenBrainz connection failed",S.getAssetIDByName("XIcon"))}catch{I.showToast("\u274C Connection error",S.getAssetIDByName("XIcon"))}};return n.React.createElement(F,{style:{flex:1},contentContainerStyle:{padding:10}},n.React.createElement(U,{spacing:8},n.React.createElement(T,{title:"Credentials"},n.React.createElement(U,{spacing:4},n.React.createElement(x,{placeholder:"ListenBrainz Username",value:c("listenbrainzUsername"),onChange:function(t){A("listenbrainzUsername",t),e()},isClearable:!0}),n.React.createElement(x,{placeholder:"ListenBrainz Token",value:c("listenbrainzToken"),onChange:function(t){A("listenbrainzToken",t),e()},secureTextEntry:!0,isClearable:!0}))),n.React.createElement(T,{title:"Actions"},n.React.createElement(u,{label:"Test Connection",subLabel:"Verify your ListenBrainz credentials",trailing:n.React.createElement(u.Arrow,null),onPress:r}),n.React.createElement(u,{label:"Get User Token",subLabel:"Get your ListenBrainz user token at listenbrainz.org/settings/",trailing:n.React.createElement(u.Arrow,null),onPress:async function(){try{await re.Linking.openURL("https://listenbrainz.org/settings/")}catch(t){console.error("Failed to open ListenBrainz settings URL:",t),I.showToast("Failed to open web browser. Please visit: https://listenbrainz.org/settings/",S.getAssetIDByName("XIcon"))}}}))))}function bt(){D.useProxy(g.plugin.storage);const[,e]=n.React.useReducer(function(t){return t+1},0),r=c("service")==="librefm";return n.React.createElement(F,{style:{flex:1},contentContainerStyle:{padding:10}},n.React.createElement(U,{spacing:8},n.React.createElement(T,{title:"Activity Display"},n.React.createElement(U,{spacing:4},n.React.createElement(x,{placeholder:`App Name (Default: ${d.DEFAULT_SETTINGS.appName})`,value:c("appName",d.DEFAULT_SETTINGS.appName),onChange:function(t){A("appName",t),e()},isClearable:!0}),r?n.React.createElement(u,{label:"Update Interval Disabled",subLabel:"Libre.fm requires a fixed 60s update interval to prevent rate limiting",disabled:!0,dimmed:!0}):n.React.createElement(x,{placeholder:`Update Interval (Default: ${d.DEFAULT_SETTINGS.timeInterval}s)`,value:String(c("timeInterval",d.DEFAULT_SETTINGS.timeInterval)),onChange:function(t){const a=Number(t);a>=d.MIN_UPDATE_INTERVAL&&(A("timeInterval",a),e())},keyboardType:"numeric",isClearable:!0}))),n.React.createElement(T,{title:"About Display Settings"},n.React.createElement(u,{label:"App Name",subLabel:"The name shown in Discord for your activity"}),n.React.createElement(u,{label:"Update Interval",subLabel:"How often the plugin checks for new tracks (in seconds)"}),n.React.createElement(u,{label:"Minimum Interval",subLabel:`The plugin will never check more frequently than ${d.MIN_UPDATE_INTERVAL} seconds`}))))}function ht(){D.useProxy(g.plugin.storage);const[e,r]=n.React.useState(null),[t,a]=n.React.useState(!0),[i,s]=n.React.useState(0),o={name:"Bohemian Rhapsody",artist:"Queen",artists:["Queen"],album:"A Night at the Opera",image:null,nowPlaying:!0,duration:354,startTime:Math.floor(Date.now()/1e3)-120},f=function(p){return p?Array.isArray(p)?p.filter(function(m){return m&&typeof m=="string"}):p["#text"]?p["#text"].split(/[,;&]/).map(function(m){return m.trim()}).filter(function(m){return m.length>0}):typeof p=="string"?p.split(/[,;&]/).map(function(m){return m.trim()}).filter(function(m){return m.length>0}):["Unknown Artist"]:["Unknown Artist"]},b=function(p){return!p||p.length===0?"Unknown Artist":p.length===1?p[0]:p.length===2?`${p[0]} & ${p[1]}`:`${p.slice(0,-1).join(", ")} & ${p[p.length-1]}`};n.React.useEffect(function(){(async function(){if(!c("username")||!c("apiKey")){r(o),a(!1);return}try{a(!0);const p=await(await fetch(`https://ws.audioscrobbler.com/2.0/?method=user.getrecenttracks&user=${c("username")}&api_key=${c("apiKey")}&format=json&limit=1`)).json();if(p.recenttracks&&p.recenttracks.track&&p.recenttracks.track.length>0){const m=p.recenttracks.track[0],G=f(m.artist);let Je=180;try{const Pt=G[0]||"Unknown Artist",de=await(await fetch(`https://ws.audioscrobbler.com/2.0/?method=track.getInfo&api_key=${c("apiKey")}&artist=${encodeURIComponent(Pt)}&track=${encodeURIComponent(m.name)}&format=json&u[...]`)).json();de.track&&de.track.duration&&(Je=Math.floor(de.track.duration/1e3))}catch{console.log("Could not fetch track duration, using default")}r({name:m.name||"Unknown Track",artist:b(G),artists:G,album:m.album?.["#text"]||"Unknown Album",image:m.image?.[2]?.["#text"]||m.image?.[1]?.["#text"]||null,nowPlaying:m["@attr"]?.nowplaying==="true",duration:Je,startTime:m["@attr"]?.nowplaying==="true"?Math.floor(Date.now()/1e3)-60:null})}else r(o)}catch{console.error("Failed to fetch preview data, using fallback:"),r(o)}finally{a(!1)}})()},[c("username"),c("apiKey")]),n.React.useEffect(function(){if(!e?.nowPlaying||!c("showTimestamp"))return;const p=setInterval(function(){if(e.startTime&&e.duration){const m=Math.floor(Date.now()/1e3)-e.startTime,G=Math.min(m/e.duration,1);s(G)}},1e3);return function(){return clearInterval(p)}},[e,c("showTimestamp")]);const h=function(p){const m=Math.floor(p/60),G=Math.floor(p%60);return`${m}:${G.toString().padStart(2,"0")}`},P=function(){let p="";if(c("showAlbumInTooltip")&&e?.album&&(p+=`on ${e.album}`),c("showDurationInTooltip")&&e?.duration){const m=` \u2022 ${h(e.duration)}`;p?p+=m:p=h(e.duration)}return p||"No tooltip text"},_=function(){return e?.duration?e.nowPlaying?{current:i*e.duration,total:e.duration,progress:i}:{current:e.duration*.3,total:e.duration,progress:.3}:{current:0,total:0,progress:0}},k=c("listeningTo")?"Listening to":"Playing",y=c("appName")||"Music",v=c("showLargeText",!0),C=c("showTimestamp",!1);if(t)return n.React.createElement(n.ReactNative.View,{style:w.container},n.React.createElement(n.ReactNative.View,{style:w.loadingContent},n.React.createElement(n.ReactNative.View,{style:w.loadingSpinner}),n.React.createElement(n.ReactNative.Text,{style:w.loadingText},"Loading preview...")));if(!e)return n.React.createElement(n.ReactNative.View,{style:w.container},n.React.createElement(n.ReactNative.Text,{style:w.centeredText},"Unable to load preview"));const $=_(),Ye=P();return n.React.createElement(n.ReactNative.View,{style:w.previewContainer},n.React.createElement(n.ReactNative.View,{style:w.header},n.React.createElement(n.ReactNative.Text,{style:w.activityType},k," ",y),n.React.createElement(n.ReactNative.Text,{style:w.rpcPreviewText,numberOfLines:1},"RPC Preview")),n.React.createElement(n.ReactNative.View,{style:w.content},n.React.createElement(n.ReactNative.View,{style:w.albumArt},e.image?n.React.createElement(n.ReactNative.Image,{source:{uri:e.image},style:w.albumImage,resizeMode:"cover"}):n.React.createElement(n.ReactNative.Text,{style:w.musicIcon},"\u{1F3B5}")),n.React.createElement(n.ReactNative.View,{style:w.trackInfo},n.React.createElement(n.ReactNative.Text,{style:w.trackName,numberOfLines:1},e.name),n.React.createElement(n.ReactNative.Text,{style:w.artistName,numberOfLines:1},e.artist),v&&Ye!=="No tooltip text"&&n.React.createElement(n.ReactNative.Text,{style:w.tooltipText,numberOfLines:1},Ye),C&&e.duration?n.React.createElement(n.ReactNative.View,{style:w.progressContainer},n.React.createElement(n.ReactNative.Text,{style:w.timeText},h($.current)),n.React.createElement(n.ReactNative.View,{style:w.progressBar},n.React.createElement(n.ReactNative.View,{style:[w.progressFill,{width:`${$.progress*100}%`}]})),n.React.createElement(n.ReactNative.Text,{style:w.timeText},h($.total))):null)))}const w=n.ReactNative.StyleSheet.create({container:{backgroundColor:"#1e1f22",borderRadius:12,padding:16,marginHorizontal:10,marginBottom:16,borderWidth:1,borderColor:"#3a3c41",alignItems:"center",justifyContent:"center",minHeight:120},loadingContent:{alignItems:"center",justifyContent:"center"},loadingSpinner:{width:20,height:20,borderRadius:10,borderWidth:2,borderColor:"#5865f2",borderTopColor:"transparent",marginBottom:8},previewContainer:{backgroundColor:"#1e1f22",borderRadius:12,padding:16,marginHorizontal:10,marginBottom:16,borderWidth:1,borderColor:"#3a3c41"},header:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",marginBottom:12,gap:8},content:{flexDirection:"row",alignItems:"center"},albumArt:{width:80,height:80,backgroundColor:"#2b2d31",borderRadius:12,justifyContent:"center",alignItems:"center",marginRight:16,borderWidth:1,borderColor:"#40444b",overflow:"hidden",flexShrink:0},trackInfo:{flex:1,minWidth:0},progressContainer:{flexDirection:"row",alignItems:"center",gap:8,marginTop:6},progressBar:{flex:1,height:2,backgroundColor:"#2b2d31",borderRadius:3,overflow:"hidden"},progressFill:{height:2,backgroundColor:"#5865f2",borderRadius:3},loadingText:{color:"#949ba4",fontSize:14,fontWeight:"500"},centeredText:{color:"#949ba4",fontSize:14,fontWeight:"500",textAlign:"center"},activityType:{color:"#dbdee1",fontSize:14,fontWeight:"600",flex:1},rpcPreviewText:{color:"#80848e",fontSize:12,fontStyle:"italic",flexShrink:0},albumImage:{width:80,height:80,borderRadius:12},musicIcon:{color:"#80848e",fontSize:32},trackName:{color:"#ffffff",fontSize:16,fontWeight:"700",marginBottom:4},artistName:{color:"#b5bac1",fontSize:14,fontWeight:"500",marginBottom:4},tooltipText:{color:"#80848e",fontSize:12,fontStyle:"italic",marginBottom:6},timeText:{color:"#80848e",fontSize:11,fontWeight:"500",minWidth:35,textAlign:"center"}});function yt(){D.useProxy(g.plugin.storage);const[,e]=n.React.useReducer(function(s){return s+1},0),r=c("listeningTo",d.DEFAULT_SETTINGS.listeningTo),t=c("showTimestamp",d.DEFAULT_SETTINGS.showTimestamp),a=function(){const s=!r;A("listeningTo",s),!s&&t&&A("showTimestamp",!1),e()},i=function(){r&&(A("showTimestamp",!t),e())};return n.React.createElement(F,{style:{flex:1},contentContainerStyle:{padding:10}},n.React.createElement(ht,null),n.React.createElement(U,{spacing:8},n.React.createElement(T,{title:"RPC Display Options"},n.React.createElement(W,{label:"Show as Listening",subLabel:"Display as 'Listening to' instead of 'Playing'",checked:r,onPress:a}),n.React.createElement(W,{label:"Show Tooltip Text",subLabel:"Show album name and track duration in Discord activity tooltip",checked:c("showLargeText",!0),onPress:function(){const s=c("showLargeText",!0);A("showLargeText",!s),e()}}),!r&&n.React.createElement(u,{label:"Timestamp Unavailable",subLabel:"Enable 'Show as Listening' to use timestamp feature",disabled:!0,dimmed:!0}),n.React.createElement(W,{label:"Show Timestamp",subLabel:"Display track progress and duration",checked:t,onPress:i,disabled:!r}),n.React.createElement(W,{label:"Show Album in Tooltip",subLabel:"Include album name in the tooltip text",checked:c("showAlbumInTooltip",!0),onPress:function(){const s=c("showAlbumInTooltip",!0);A("showAlbumInTooltip",!s),e()}}),n.React.createElement(W,{label:"Show Duration in Tooltip",subLabel:"Include track duration in the tooltip text",checked:c("showDurationInTooltip",!0),onPress:function(){const s=c("showDurationInTooltip",!0);A("showDurationInTooltip",!s),e()}}))))}function mt(){D.useProxy(g.plugin.storage);const[,e]=n.React.useReducer(function(s){return s+1},0),[r,t]=n.React.useState(""),a=function(){if(!r.trim()){I.showToast("Please enter an app name",S.getAssetIDByName("Small"));return}const s=c("ignoreList",[]);s.includes(r.trim())?I.showToast("App already in ignore list",S.getAssetIDByName("Warning")):(A("ignoreList",[...s,r.trim()]),t(""),e(),I.showToast("App added to ignore list",S.getAssetIDByName("Check")))},i=function(s){const o=c("ignoreList",[]);A("ignoreList",o.filter(function(f){return f!==s})),e(),I.showToast("App removed from ignore list",S.getAssetIDByName("Check"))};return n.React.createElement(F,{style:{flex:1},contentContainerStyle:{padding:10}},n.React.createElement(U,{spacing:8},n.React.createElement(T,{title:"Add App to Ignore"},n.React.createElement(U,{spacing:4},n.React.createElement(x,{placeholder:"Enter app name",value:r,onChange:t,isClearable:!0,onSubmitEditing:a,returnKeyType:"done"}))),n.React.createElement(T,null,n.React.createElement(u,{label:"Add to Ignore List",subLabel:"Add the current app name to your ignore list",trailing:n.React.createElement(u.Arrow,null),onPress:a})),c("ignoreList",[]).length>0&&n.React.createElement(T,{title:"Ignored Apps"},c("ignoreList",[]).map(function(s,o){return n.React.createElement(u,{key:o,label:s,trailing:n.React.createElement(n.ReactNative.TouchableOpacity,{onPress:function(){return i(s)},style:{padding:8,backgroundColor:"#ff4d4d",borderRadius:12,width:24,height:24,justifyContent:"center",alignItems:"center"}},n.React.createElement(n.ReactNative.Image,{source:S.getAssetIDByName("TrashIcon"),style:{width:14,height:14,tintColor:"#ffffff"}}))})})),n.React.createElement(T,{title:"About Ignore List"},n.React.createElement(u,{label:"How it Works",subLabel:"When any app in your ignore list is active, your music status will be hidden"}),n.React.createElement(u,{label:"Detection",subLabel:"Apps are detected by their Discord activity name"}),n.React.createElement(u,{label:"Examples",subLabel:"Spotify, YouTube Music, Kizzy, Metrolist, echo"}))))}function wt(){D.useProxy(g.plugin.storage);const[,e]=n.React.useReducer(function(r){return r+1},0);return n.React.createElement(F,{style:{flex:1},contentContainerStyle:{padding:10}},n.React.createElement(U,{spacing:8},n.React.createElement(T,{title:"Logging Options"},n.React.createElement(ke,{label:"Verbose Logging",subLabel:"Enable detailed console logging for debugging",value:c("verboseLogging",d.DEFAULT_SETTINGS.verboseLogging),onValueChange:function(r){A("verboseLogging",r),e()}})),n.React.createElement(T,{title:"Debug Information"},n.React.createElement(u,{label:"Console Logging",subLabel:"Logs are written to the browser/app console when verbose is enabled"}),n.React.createElement(u,{label:"Error Tracking",subLabel:"Connection errors and API failures are automatically logged"})),n.React.createElement(T,{title:"Log Information"},n.React.createElement(u,{label:"API Calls",subLabel:"All API requests are logged when verbose is enabled"}),n.React.createElement(u,{label:"Track Updates",subLabel:"Song changes and RPC updates are logged"}),n.React.createElement(u,{label:"Error Details",subLabel:"Connection errors and retries are logged"}))))}var Ie,Ae,Le,Ce,Pe,Ne,$e,Ue,_e,Me,De,xe,ze,Fe,Ve,Be,Oe;(Ie=g.plugin.storage).username??(Ie.username=""),(Ae=g.plugin.storage).apiKey??(Ae.apiKey=""),(Le=g.plugin.storage).appName??(Le.appName="Music"),(Ce=g.plugin.storage).timeInterval??(Ce.timeInterval=5),(Pe=g.plugin.storage).showTimestamp??(Pe.showTimestamp=!0),(Ne=g.plugin.storage).listeningTo??(Ne.listeningTo=!0),($e=g.plugin.storage).verboseLogging??($e.verboseLogging=!1),(Ue=g.plugin.storage).service??(Ue.service="lastfm"),(_e=g.plugin.storage).librefmUsername??(_e.librefmUsername=""),(Me=g.plugin.storage).librefmApiKey??(Me.librefmApiKey=""),(De=g.plugin.storage).listenbrainzUsername??(De.listenbrainzUsername=""),(xe=g.plugin.storage).listenbrainzToken??(xe.listenbrainzToken=""),(ze=g.plugin.storage).addToSidebar??(ze.addToSidebar=!0),(Fe=g.plugin.storage).showLargeText??(Fe.showLargeText=!0),(Ve=g.plugin.storage).ignoreList??(Ve.ignoreList=[]),(Be=g.plugin.storage).showAlbumInTooltip??(Be.showAlbumInTooltip=!0),(Oe=g.plugin.storage).showDurationInTooltip??(Oe.showDurationInTooltip=!0);const c=function(e,r){return g.plugin.storage[e]??r},A=function(e,r){return g.plugin.storage[e]=r},X=(function(){function e(){B(this,e)}return O(e,null,[{key:"getServiceDisplayName",value:function(r){switch(r){case"lastfm":return"Last.fm";case"librefm":return"Libre.fm";case"listenbrainz":return"ListenBrainz";default:return"Unknown"}}},{key:"testService",value:async function(r){try{switch(r){case"lastfm":return await this.testLastFmConnection();case"librefm":return await this.testLibreFmConnection();case"listenbrainz":return await this.testListenBrainzConnection();default:return!1}}catch(t){return console.error(`Error testing ${r}:`,t),!1}}},{key:"testLastFmConnection",value:async function(){const r=c("username"),t=c("apiKey");if(!r||!t)return!1;try{return!(await(await fetch(`https://ws.audioscrobbler.com/2.0/?method=user.getinfo&user=${r}&api_key=${t}&format=json`)).json()).error}catch(a){return console.error("Last.fm connection test failed:",a),!1}}},{key:"testLibreFmConnection",value:async function(){const r=c("librefmUsername"),t=c("librefmApiKey");if(!r||!t)return!1;try{return!(await(await fetch(`https://libre.fm/2.0/?method=user.getinfo&user=${r}&api_key=${t}&format=json`)).json()).error}catch(a){return console.error("Libre.fm connection test failed:",a),!1}}},{key:"testListenBrainzConnection",value:async function(){const r=c("listenbrainzUsername"),t=c("listenbrainzToken");if(!r)return!1;try{const a={"Content-Type":"application/json"};return t&&(a.Authorization=`Token ${t}`),(await fetch(`https://api.listenbrainz.org/1/user/${r}/listen-count`,{headers:a})).status===200}catch(a){return console.error("ListenBrainz connection test failed:",a),!1}}}]),e})();function Ke(){D.useProxy(g.plugin.storage);const e=n.NavigationNative.useNavigation(),[,r]=n.React.useReducer(function(i){return i+1},0),t=c("service"),a=function(i){switch(i){case"lastfm":return c("username")&&c("apiKey")?"\u2705 Configured":"\u274C Missing credentials";case"librefm":return c("librefmUsername")&&c("librefmApiKey")?"\u2705 Configured":"\u274C Missing credentials";case"listenbrainz":return c("listenbrainzUsername")?"\u2705 Configured":"\u274C Missing username";default:return"\u2753 Unknown"}};return n.React.createElement(F,{style:{flex:1},contentContainerStyle:{padding:10}},n.React.createElement(U,{spacing:8},n.React.createElement(T,{title:"Active Service"},n.React.createElement(u,{label:"Current Service",subLabel:t?`Using: ${X.getServiceDisplayName(t)}`:"No service selected"}),["lastfm","librefm","listenbrainz"].map(function(i){return n.React.createElement(W,{key:i,label:X.getServiceDisplayName(i),subLabel:a(i),checked:t===i,onPress:function(){i!==t&&(A("service",i),r())}})})),n.React.createElement(T,{title:"Service Configuration"},n.React.createElement(u,{label:"Last.fm Settings",subLabel:"Configure Last.fm credentials and options",trailing:n.React.createElement(u.Arrow,null),onPress:function(){return e.push("VendettaCustomPage",{title:"Last.fm Settings",render:gt})}}),n.React.createElement(u,{label:"Libre.fm Settings",subLabel:"Configure Libre.fm credentials and options",trailing:n.React.createElement(u.Arrow,null),onPress:function(){return e.push("VendettaCustomPage",{title:"Libre.fm Settings",render:dt})}}),n.React.createElement(u,{label:"ListenBrainz Settings",subLabel:"Configure ListenBrainz credentials and options",trailing:n.React.createElement(u.Arrow,null),onPress:function(){return e.push("VendettaCustomPage",{title:"ListenBrainz Settings",render:pt})}})),n.React.createElement(T,{title:"Plugin Configuration"},n.React.createElement(u,{label:"Display Settings",subLabel:"Customize app name and update interval",trailing:n.React.createElement(u.Arrow,null),onPress:function(){return e.push("VendettaCustomPage",{title:"Display Settings",render:bt})}}),n.React.createElement(u,{label:"RPC Customization",subLabel:"Customize Discord rich presence display options",trailing:n.React.createElement(u.Arrow,null),onPress:function(){return e.push("VendettaCustomPage",{title:"RPC Customization",render:yt})}}),n.React.createElement(u,{label:"Ignore List",subLabel:"Configure apps that should hide your status",trailing:n.React.createElement(u.Arrow,null),onPress:function(){return e.push("VendettaCustomPage",{title:"Ignore List Settings",render:mt})}}),n.React.createElement(u,{label:"Logging Settings",subLabel:"Configure logging and debugging options",trailing:n.React.createElement(u.Arrow,null),onPress:function(){return e.push("VendettaCustomPage",{title:"Logging Settings",render:wt})}}),n.React.createElement(ke,{label:"Add to Sidebar",subLabel:"Show plugin in Discord settings",value:c("addToSidebar",!1),onValueChange:function(i){A("addToSidebar",i),r()}})),n.React.createElement(T,{title:"About"},n.React.createElement(u,{label:"Multi Scrobbler",subLabel:"Show off your music status from multiple services"}),n.React.createElement(u,{label:"Author",subLabel:"kmmiio99o"}),n.React.createElement(u,{label:"Version",subLabel:"1.3.2"}))))}const{FormSection:vt,FormRow:fe}=Qe.Forms,{TableRowIcon:St}=M.findByProps("TableRowIcon"),H=window.bunny,Ge=H?.metro?.findByPropsLazy("getRootNavigationRef"),ge=H?.metro?.findByPropsLazy("SETTING_RENDERER_CONFIG"),je=H?.metro?.findByPropsLazy("createList"),We=H?.metro?.findByNameLazy("SettingsOverviewScreen",!1);function Rt({tabs:e}){const r=n.NavigationNative.useNavigation();return n.React.createElement(fe,{label:e.title(),leading:n.React.createElement(fe.Icon,{source:e.icon}),trailing:n.React.createElement(n.React.Fragment,{},[e.trailing?e.trailing():null,n.React.createElement(fe.Arrow,{key:"arrow"})]),onPress:function(){const t=e.page;r.navigate("VendettaCustomPage",{title:e.title(),render:function(){return n.React.createElement(t)}})}})}function Et(e,r){try{r.push(J.after("default",H?.metro?.findByPropsLazy(["renderTitle","sections"],!1),function(t,a){const i=ne.findInReactTree(a.props.children,function(s){return s.type?.name==="UserSettingsOverview"});i&&r.push(J.after("render",i.type.prototype,function(s,o){const f=ne.findInReactTree(o.props.children,function(b){return b?.children?.[1]?.type===vt})?.children;if(f){const b=f.findIndex(function(h){return["BILLING_SETTINGS","PREMIUM_SETTINGS"].includes(h?.props?.label)});f.splice(-~b||4,0,n.React.createElement(Rt,{key:e.key,tabs:e}))}}))},!0))}catch(t){g.logger.info("Panel UI patch failed graciously \u{1F494}",t)}}function Tt(e,r){if(!ge||!Ge){console.warn("[LastFm] Missing required constants for tabs UI patch");return}const t={[e.key]:{type:"pressable",useTitle:e.title,title:e.title,icon:e.icon,IconComponent:e.icon&&function(){return n.React.createElement(St,{source:e.icon})},usePredicate:e.predicate,useTrailing:e.trailing,onPress:function(){const s=Ge.getRootNavigationRef(),o=e.page;s.navigate("VendettaCustomPage",{title:e.title(),render:function(){return n.React.createElement(o)}})},withArrow:!0}};let a=ge.SETTING_RENDERER_CONFIG;Object.defineProperty(ge,"SETTING_RENDERER_CONFIG",{enumerable:!0,configurable:!0,get:function(){return{...a,...t}},set(s){a=s}});const i=Symbol("pinToSettings meow meow");try{if(!je)return;r.push(J.after("createList",je,function(s){if(!s[0][i]){s[0][i]=!0;const[o]=s,f=o.sections?.find(function(b){return["Bunny","Revenge","Kettu","Vencore","ShiggyCord"].some(function(h){return b.label===h&&b.title===h})});f?.settings&&(f.settings=[...f.settings,e.key])}}))}catch{if(!We)return;r.push(J.after("default",We,function(s,o){if(!s[0][i]){s[0][i]=!0;const{sections:f}=ne.findInReactTree(o,function(h){return h.props?.sections}).props,b=f?.find(function(h){return["Bunny","Revenge","Kettu","Vencore","ShiggyCord"].some(function(P){return h.label===P&&h.title===P})});b?.settings&&(b.settings=[...b.settings,e.key])}}))}}function kt(e){const r=[];let t=!1;const a=e.predicate||function(){return!0};return e.predicate=function(){return t?!1:a()},Et(e,r),Tt(e,r),r.push(function(){return t=!0}),function(){for(const i of r)i()}}function qe(){if(!g.plugin.storage.addToSidebar)return console.log("[Multi Scrobbler] Sidebar disabled in settings"),function(){};console.log("[Multi Scrobbler] Patching sidebar using custom patchSettingsPin...");try{const e=kt({key:"LastFmScrobbler",icon:S.getAssetIDByName("MusicIcon"),title:function(){return"Multi Scrobbler"},predicate:function(){return g.plugin.storage.addToSidebar===!0},page:Ke});return console.log("[Multi Scrobbler] Successfully patched sidebar"),e}catch(e){return console.error("[Multi Scrobbler] Failed to patch sidebar:",e),function(){}}}var Xe;const E={pluginStopped:!1,lastActivity:void 0,updateInterval:void 0,lastTrackUrl:void 0};let V;const He=d.DEFAULT_SETTINGS;Object.keys(He).forEach(function(e){g.plugin.storage[e]=g.plugin.storage[e]??He[e]}),(Xe=g.plugin.storage).addToSidebar??(Xe.addToSidebar=!1);const l=new Proxy(g.plugin.storage,{get(e,r){return e[r]},set(e,r,t){return e[r]=t,!0}});let te=0;const It=3,At=5e3;async function Y(){try{await ut(),te=0,console.log("[Multi-Scrobbler] Successfully connected")}catch(e){console.error("[Multi-Scrobbler] Initialization error:",e),te++,te