(function(y,E,a,d,I,A,N){"use strict";consts={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/"};functionk(t,e){if(!(tinstanceofe))thrownewTypeError("Cannot call a class as a function")}functionP(t,e){for(varn=0;n<e.length;n++){vari=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"ini&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}functionU(t,e,n){returne&&P(t.prototype,e),n&&P(t,n),t}const{SET_ACTIVITY:Z}=d.findByProps("SET_ACTIVITY"),O=d.findByProps("getAssetIds"),x=d.findByStoreName("SelfPresenceStore"),C=d.findByStoreName("UserStore");functionw(){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"})}asyncfunctionB(t,e=s.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;functionm(t,e){v[t]=e}constM=(function(){functiont(){k(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",11:"Service temporarily unavailable",16:"Service temporarily unavailable",29:"Rate limit exceeded"}[e.error]||e.message||"Unknown error";throwconsole.log(`[Last.fm] API Error ${e.error}: ${n}`),newError(`Last.fm API Error ${e.error}: ${n}`)}},{key:"makeRequest",value:asyncfunction(e){constn=newURLSearchParams({...e,api_key:o.apiKey,format:"json"}).toString(),i=awaitfetch(`${s.LFM_API_BASE_URL}?${n}`),p=awaiti.json();return(!i.ok||p.error)&&awaitthis.handleError(p),p}},{key:"fetchLatestScrobble",value:asyncfunction(){try{this.validateSettings();conste=(awaitthis.makeRequest({method:"user.getrecenttracks",user:o.username,limit:"1",extended:"1"}))?.recenttracks?.track?.[0];if(m("lastAPIResponse",e),!e)throwconsole.log("[Last.fm] No tracks found for user"),newError("No tracks found");this.retryCount=0;constn=!!e["@attr"]?.nowplaying,i=n?Math.floor(Date.now()/1e3):parseInt(e?.date?.uts);letp=null;try{constr=awaitthis.makeRequest({method:"track.getInfo",track:e.name,artist:e.artist.name,username:o.username}),f=parseInt(r?.track?.duration);f>0&&(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:awaitthis.handleAlbumCover(e.image?.find(function(r){returnr.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)throwthis.retryCount=0,console.error("[Last.fm] Max retry attempts reached"),e;returnawaitnewPromise(function(n){returnsetTimeout(n,s.RETRY_DELAY)}),this.fetchLatestScrobble()}}},{key:"handleAlbumCover",value:asyncfunction(e){return!e||s.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();functionY(t){conste=Math.floor(t/60),n=Math.floor(t%60);return`${e}:${n.toString().padStart(2,"0")}`}varK=(function(t){returnt[t.PLAYING=0]="PLAYING",t[t.STREAMING=1]="STREAMING",t[t.LIST