(function(S,A,a,p,g,Z,T,N){"use strict";consti={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:"https://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/letup",GITHUB_COMMITS_URL:"https://github.com/kmmiio99o/letup/commits/main/"};functionP(t,e){if(!(tinstanceofe))thrownewTypeError("Cannot call a class as a function")}functionk(t,e){for(varn=0;n<e.length;n++){vars=e[n];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"ins&&(s.writable=!0),Object.defineProperty(t,s.key,s)}}functionU(t,e,n){returne&&k(t.prototype,e),n&&k(t,n),t}T.findByProps("SET_ACTIVITY");constO=T.findByProps("getAssetIds"),$=T.findByStoreName("SelfPresenceStore"),C=T.findByStoreName("UserStore");functionL(){returnD(null)}functionD(t){c.pluginStopped&&(V(),t=null),c.lastActivity=t,a.FluxDispatcher.dispatch({type:"LOCAL_ACTIVITY_UPDATE",activity:t,pid:2312,socketId:"Last.fm@Vendetta"})}asyncfunctionx(t,e=i.APPLICATION_ID){if(!t?.length)return[];try{returnawaitO.fetchAssetIds(e,t)}catch(n){returnconsole.error("[Last.fm] Failed to fetch assets:",n),[]}}constv={};v.componentMountErrors=[],v.componentMountCount=0,v.settingsLoadAttempts=0;functiond(t,e){v[t]=e}constF=function(){functiont(){P(this,t)}returnU(t,[{key:"validateSettings",value:function(){if(!o.username)thrownewError("Last.fm username is not set");if(!o.apiKey)thrownewError("Last.fm API key is not set")}},{key:"handleError",value:asyncfunction(e){this.lastError=e.error;constn={2:"Invalid API key",6:"User not found",11:"Service temporarily unavailable",16:"Service temporarily unavailable",29:"Rate limit exceeded"}[e.error]||e.message||"Unknown error";throwg.showToast(`Last.fm Error: ${n}`,p.getAssetIDByName("Small")),newError(`Last.fm API Error ${e.error}: ${n}`)}},{key:"makeRequest",value:asyncfunction(e){constn=newURLSearchParams({...e,api_key:o.apiKey,format:"json"}).toString(),s=awaitfetch(`${i.LFM_API_BASE_URL}?${n}`),E=awaits.json();return(!s.ok||E.error)&&awaitthis.handleError(E),E}},{key:"fetchLatestScrobble",value:asyncfunction(){try{this.validateSettings();conste=(awaitthis.makeRequest({method:"user.getrecenttracks",user:o.username,limit:"1",extended:"1"}))?.recenttracks?.track?.[0];if(d("lastAPIResponse",e),!e)thrownewError("No tracks found");returnthis.retryCount=0,{name:e.name,artist:e.artist.name,album:e.album["#text"],albumArt:awaitthis.handleAlbumCover(e.image?.find(function(n){returnn.size==="large"})?.["#text"]),url:e.url,date:e.date?.["#text"]??"now",nowPlaying:!!e["@attr"]?.nowplaying,loved:e.loved==="1"}}catch(e){if(this.retryCount++,this.retryCount>i.MAX_RETRY_ATTEMPTS)throwthis.retryCount=0,e;returnawaitnewPromise(function(n){returnsetTimeout(n,i.RETRY_DELAY)}),this.fetchLatestScrobble()}}},{key:"handleAlbumCover",value:asyncfunction(e){return!e||i.LFM_DEFAULT_COVER_HASHES.some(function(n){returne.includes(n)})?null:e}},{key:"getLastError",value:function(){returnthis.lastError}},{key:"resetRetryCount",value:function(){this.retryCount=0}}],[{key:"getInstance",value:function(){returnt.instance||(t.instance=newt),t.instance}}]),t}().getInstance();varY=function(t){returnt[t.PLAYING=0]="PLAYING",t[t.STREAMING=1]="STREAMING",t[t.LISTENING=2]="LISTENING",t[t.COMPETING=5]="COMPETING",t}(Y||{});constl=function(...t){returno.verboseLogging&&console.log("[Last.fm]",...t)},M=function(){functiont(){P(this,t)}returnU(t,[{key:"updateActivity",value:asyncfunction(){if(c.pluginStopped){l("Plugin is stopped, skipping update"),this.stopUpdates();return}l("Fetching last track...");try{if(!o.username||!o.apiKey)thrownewError("Username or API key not set");if(o.ignoreSpotify){if($.findActivity(function(s){returns.sync_id})){l("Spotifyiscurrentlyplaying,cleari