From efefa7bbf751e47f18c516892776bab4ca075eaa Mon Sep 17 00:00:00 2001 From: Roberto Tonino Date: Mon, 1 Mar 2021 21:25:59 +0100 Subject: [PATCH] refactor: CustomWebsocket --- public/js/bundle.js | 14 +++++++------- src/utils/socket.js | 5 ++--- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/public/js/bundle.js b/public/js/bundle.js index 4a0e30d..d9f8df3 100644 --- a/public/js/bundle.js +++ b/public/js/bundle.js @@ -2491,17 +2491,17 @@ a { .table--charts .clickable:hover { text-decoration: underline; } -`;styleInject(css_248z$8);/*! - * vuex v3.6.0 - * (c) 2020 Evan You - * @license MIT - */function applyMixin(e){var a=Number(e.version.split(".")[0]);if(a>=2)e.mixin({beforeCreate:r});else{var n=e.prototype._init;e.prototype._init=function(i){i===void 0&&(i={}),i.init=i.init?[r].concat(i.init):r,n.call(this,i)}}function r(){var i=this.$options;i.store?this.$store=typeof i.store=="function"?i.store():i.store:i.parent&&i.parent.$store&&(this.$store=i.parent.$store)}}var target$2=typeof window!="undefined"?window:typeof global!="undefined"?global:{},devtoolHook=target$2.__VUE_DEVTOOLS_GLOBAL_HOOK__;function devtoolPlugin(e){if(!devtoolHook)return;e._devtoolHook=devtoolHook,devtoolHook.emit("vuex:init",e),devtoolHook.on("vuex:travel-to-state",function(a){e.replaceState(a)}),e.subscribe(function(a,n){devtoolHook.emit("vuex:mutation",a,n)},{prepend:!0}),e.subscribeAction(function(a,n){devtoolHook.emit("vuex:action",a,n)},{prepend:!0})}function find(e,a){return e.filter(a)[0]}function deepCopy(e,a){if(a===void 0&&(a=[]),e===null||typeof e!="object")return e;var n=find(a,function(i){return i.original===e});if(n)return n.copy;var r=Array.isArray(e)?[]:{};return a.push({original:e,copy:r}),Object.keys(e).forEach(function(i){r[i]=deepCopy(e[i],a)}),r}function forEachValue(e,a){Object.keys(e).forEach(function(n){return a(e[n],n)})}function isObject$1(e){return e!==null&&typeof e=="object"}function isPromise$1(e){return e&&typeof e.then=="function"}function partial(e,a){return function(){return e(a)}}var Module=function(a,n){this.runtime=n,this._children=Object.create(null),this._rawModule=a;var r=a.state;this.state=(typeof r=="function"?r():r)||{}},prototypeAccessors$1={namespaced:{configurable:!0}};prototypeAccessors$1.namespaced.get=function(){return!!this._rawModule.namespaced},Module.prototype.addChild=function(a,n){this._children[a]=n},Module.prototype.removeChild=function(a){delete this._children[a]},Module.prototype.getChild=function(a){return this._children[a]},Module.prototype.hasChild=function(a){return a in this._children},Module.prototype.update=function(a){this._rawModule.namespaced=a.namespaced,a.actions&&(this._rawModule.actions=a.actions),a.mutations&&(this._rawModule.mutations=a.mutations),a.getters&&(this._rawModule.getters=a.getters)},Module.prototype.forEachChild=function(a){forEachValue(this._children,a)},Module.prototype.forEachGetter=function(a){this._rawModule.getters&&forEachValue(this._rawModule.getters,a)},Module.prototype.forEachAction=function(a){this._rawModule.actions&&forEachValue(this._rawModule.actions,a)},Module.prototype.forEachMutation=function(a){this._rawModule.mutations&&forEachValue(this._rawModule.mutations,a)},Object.defineProperties(Module.prototype,prototypeAccessors$1);var ModuleCollection=function(a){this.register([],a,!1)};ModuleCollection.prototype.get=function(a){return a.reduce(function(n,r){return n.getChild(r)},this.root)},ModuleCollection.prototype.getNamespace=function(a){var n=this.root;return a.reduce(function(r,i){return n=n.getChild(i),r+(n.namespaced?i+"/":"")},"")},ModuleCollection.prototype.update=function(a){update([],this.root,a)},ModuleCollection.prototype.register=function(a,n,r){var i=this;r===void 0&&(r=!0);var s=new Module(n,r);if(a.length===0)this.root=s;else{var l=this.get(a.slice(0,-1));l.addChild(a[a.length-1],s)}n.modules&&forEachValue(n.modules,function(c,o){i.register(a.concat(o),c,r)})},ModuleCollection.prototype.unregister=function(a){var n=this.get(a.slice(0,-1)),r=a[a.length-1],i=n.getChild(r);if(!i)return;if(!i.runtime)return;n.removeChild(r)},ModuleCollection.prototype.isRegistered=function(a){var n=this.get(a.slice(0,-1)),r=a[a.length-1];return n?n.hasChild(r):!1};function update(e,a,n){if(a.update(n),n.modules)for(var r in n.modules){if(!a.getChild(r))return;update(e.concat(r),a.getChild(r),n.modules[r])}}var Vue$1,Store=function(a){var n=this;a===void 0&&(a={}),!Vue$1&&typeof window!="undefined"&&window.Vue&&install(window.Vue);var r=a.plugins;r===void 0&&(r=[]);var i=a.strict;i===void 0&&(i=!1),this._committing=!1,this._actions=Object.create(null),this._actionSubscribers=[],this._mutations=Object.create(null),this._wrappedGetters=Object.create(null),this._modules=new ModuleCollection(a),this._modulesNamespaceMap=Object.create(null),this._subscribers=[],this._watcherVM=new Vue$1,this._makeLocalGettersCache=Object.create(null);var s=this,l=this,c=l.dispatch,o=l.commit;this.dispatch=function(h,m){return c.call(s,h,m)},this.commit=function(h,m,v){return o.call(s,h,m,v)},this.strict=i;var d=this._modules.root.state;installModule(this,d,[],this._modules.root),resetStoreVM(this,d),r.forEach(function(f){return f(n)});var u=a.devtools!==void 0?a.devtools:Vue$1.config.devtools;u&&devtoolPlugin(this)},prototypeAccessors$1$1={state:{configurable:!0}};prototypeAccessors$1$1.state.get=function(){return this._vm._data.$$state},prototypeAccessors$1$1.state.set=function(e){},Store.prototype.commit=function(a,n,r){var i=this,s=unifyObjectStyle(a,n,r),l=s.type,c=s.payload,o={type:l,payload:c},d=this._mutations[l];if(!d)return;this._withCommit(function(){d.forEach(function(f){f(c)})}),this._subscribers.slice().forEach(function(u){return u(o,i.state)})},Store.prototype.dispatch=function(a,n){var r=this,i=unifyObjectStyle(a,n),s=i.type,l=i.payload,c={type:s,payload:l},o=this._actions[s];if(!o)return;try{this._actionSubscribers.slice().filter(function(u){return u.before}).forEach(function(u){return u.before(c,r.state)})}catch(u){}var d=o.length>1?Promise.all(o.map(function(u){return u(l)})):o[0](l);return new Promise(function(u,f){d.then(function(h){try{r._actionSubscribers.filter(function(m){return m.after}).forEach(function(m){return m.after(c,r.state)})}catch(m){}u(h)},function(h){try{r._actionSubscribers.filter(function(m){return m.error}).forEach(function(m){return m.error(c,r.state,h)})}catch(m){}f(h)})})},Store.prototype.subscribe=function(a,n){return genericSubscribe(a,this._subscribers,n)},Store.prototype.subscribeAction=function(a,n){var r=typeof a=="function"?{before:a}:a;return genericSubscribe(r,this._actionSubscribers,n)},Store.prototype.watch=function(a,n,r){var i=this;return this._watcherVM.$watch(function(){return a(i.state,i.getters)},n,r)},Store.prototype.replaceState=function(a){var n=this;this._withCommit(function(){n._vm._data.$$state=a})},Store.prototype.registerModule=function(a,n,r){r===void 0&&(r={}),typeof a=="string"&&(a=[a]),this._modules.register(a,n),installModule(this,this.state,a,this._modules.get(a),r.preserveState),resetStoreVM(this,this.state)},Store.prototype.unregisterModule=function(a){var n=this;typeof a=="string"&&(a=[a]),this._modules.unregister(a),this._withCommit(function(){var r=getNestedState(n.state,a.slice(0,-1));Vue$1.delete(r,a[a.length-1])}),resetStore(this)},Store.prototype.hasModule=function(a){return typeof a=="string"&&(a=[a]),this._modules.isRegistered(a)},Store.prototype.hotUpdate=function(a){this._modules.update(a),resetStore(this,!0)},Store.prototype._withCommit=function(a){var n=this._committing;this._committing=!0,a(),this._committing=n},Object.defineProperties(Store.prototype,prototypeAccessors$1$1);function genericSubscribe(e,a,n){return a.indexOf(e)<0&&(n&&n.prepend?a.unshift(e):a.push(e)),function(){var r=a.indexOf(e);r>-1&&a.splice(r,1)}}function resetStore(e,a){e._actions=Object.create(null),e._mutations=Object.create(null),e._wrappedGetters=Object.create(null),e._modulesNamespaceMap=Object.create(null);var n=e.state;installModule(e,n,[],e._modules.root,!0),resetStoreVM(e,n,a)}function resetStoreVM(e,a,n){var r=e._vm;e.getters={},e._makeLocalGettersCache=Object.create(null);var i=e._wrappedGetters,s={};forEachValue(i,function(c,o){s[o]=partial(c,e),Object.defineProperty(e.getters,o,{get:function(){return e._vm[o]},enumerable:!0})});var l=Vue$1.config.silent;Vue$1.config.silent=!0,e._vm=new Vue$1({data:{$$state:a},computed:s}),Vue$1.config.silent=l,e.strict&&enableStrictMode(e),r&&(n&&e._withCommit(function(){r._data.$$state=null}),Vue$1.nextTick(function(){return r.$destroy()}))}function installModule(e,a,n,r,i){var s=!n.length,l=e._modules.getNamespace(n);if(r.namespaced&&(e._modulesNamespaceMap[l]&&!1&&console.error("[vuex] duplicate namespace "+l+" for the namespaced module "+n.join("/")),e._modulesNamespaceMap[l]=r),!s&&!i){var c=getNestedState(a,n.slice(0,-1)),o=n[n.length-1];e._withCommit(function(){Vue$1.set(c,o,r.state)})}var d=r.context=makeLocalContext(e,l,n);r.forEachMutation(function(u,f){var h=l+f;registerMutation(e,h,u,d)}),r.forEachAction(function(u,f){var h=u.root?f:l+f,m=u.handler||u;registerAction(e,h,m,d)}),r.forEachGetter(function(u,f){var h=l+f;registerGetter(e,h,u,d)}),r.forEachChild(function(u,f){installModule(e,a,n.concat(f),u,i)})}function makeLocalContext(e,a,n){var r=a==="",i={dispatch:r?e.dispatch:function(s,l,c){var o=unifyObjectStyle(s,l,c),d=o.payload,u=o.options,f=o.type;return(!u||!u.root)&&(f=a+f),e.dispatch(f,d)},commit:r?e.commit:function(s,l,c){var o=unifyObjectStyle(s,l,c),d=o.payload,u=o.options,f=o.type;(!u||!u.root)&&(f=a+f),e.commit(f,d,u)}};return Object.defineProperties(i,{getters:{get:r?function(){return e.getters}:function(){return makeLocalGetters(e,a)}},state:{get:function(){return getNestedState(e.state,n)}}}),i}function makeLocalGetters(e,a){if(!e._makeLocalGettersCache[a]){var n={},r=a.length;Object.keys(e.getters).forEach(function(i){if(i.slice(0,r)!==a)return;var s=i.slice(r);Object.defineProperty(n,s,{get:function(){return e.getters[i]},enumerable:!0})}),e._makeLocalGettersCache[a]=n}return e._makeLocalGettersCache[a]}function registerMutation(e,a,n,r){var i=e._mutations[a]||(e._mutations[a]=[]);i.push(function(l){n.call(e,r.state,l)})}function registerAction(e,a,n,r){var i=e._actions[a]||(e._actions[a]=[]);i.push(function(l){var c=n.call(e,{dispatch:r.dispatch,commit:r.commit,getters:r.getters,state:r.state,rootGetters:e.getters,rootState:e.state},l);return isPromise$1(c)||(c=Promise.resolve(c)),e._devtoolHook?c.catch(function(o){throw e._devtoolHook.emit("vuex:error",o),o}):c})}function registerGetter(e,a,n,r){if(e._wrappedGetters[a])return;e._wrappedGetters[a]=function(s){return n(r.state,r.getters,s.state,s.getters)}}function enableStrictMode(e){e._vm.$watch(function(){return this._data.$$state},function(){},{deep:!0,sync:!0})}function getNestedState(e,a){return a.reduce(function(n,r){return n[r]},e)}function unifyObjectStyle(e,a,n){return isObject$1(e)&&e.type&&(n=a,a=e,e=e.type),{type:e,payload:a,options:n}}function install(e){if(Vue$1&&e===Vue$1)return;Vue$1=e,applyMixin(Vue$1)}var mapState=normalizeNamespace(function(e,a){var n={};return normalizeMap(a).forEach(function(r){var i=r.key,s=r.val;n[i]=function(){var c=this.$store.state,o=this.$store.getters;if(e){var d=getModuleByNamespace(this.$store,"mapState",e);if(!d)return;c=d.context.state,o=d.context.getters}return typeof s=="function"?s.call(this,c,o):c[s]},n[i].vuex=!0}),n}),mapMutations=normalizeNamespace(function(e,a){var n={};return normalizeMap(a).forEach(function(r){var i=r.key,s=r.val;n[i]=function(){for(var c=[],o=arguments.length;o--;)c[o]=arguments[o];var d=this.$store.commit;if(e){var u=getModuleByNamespace(this.$store,"mapMutations",e);if(!u)return;d=u.context.commit}return typeof s=="function"?s.apply(this,[d].concat(c)):d.apply(this.$store,[s].concat(c))}}),n}),mapGetters=normalizeNamespace(function(e,a){var n={};return normalizeMap(a).forEach(function(r){var i=r.key,s=r.val;s=e+s,n[i]=function(){return e&&!getModuleByNamespace(this.$store,"mapGetters",e)?void 0:this.$store.getters[s]},n[i].vuex=!0}),n}),mapActions=normalizeNamespace(function(e,a){var n={};return normalizeMap(a).forEach(function(r){var i=r.key,s=r.val;n[i]=function(){for(var c=[],o=arguments.length;o--;)c[o]=arguments[o];var d=this.$store.dispatch;if(e){var u=getModuleByNamespace(this.$store,"mapActions",e);if(!u)return;d=u.context.dispatch}return typeof s=="function"?s.apply(this,[d].concat(c)):d.apply(this.$store,[s].concat(c))}}),n}),createNamespacedHelpers=function(e){return{mapState:mapState.bind(null,e),mapGetters:mapGetters.bind(null,e),mapMutations:mapMutations.bind(null,e),mapActions:mapActions.bind(null,e)}};function normalizeMap(e){return isValidMap(e)?Array.isArray(e)?e.map(function(a){return{key:a,val:a}}):Object.keys(e).map(function(a){return{key:a,val:e[a]}}):[]}function isValidMap(e){return Array.isArray(e)||isObject$1(e)}function normalizeNamespace(e){return function(a,n){return typeof a!="string"?(n=a,a=""):a.charAt(a.length-1)!=="/"&&(a+="/"),e(a,n)}}function getModuleByNamespace(e,a,n){var r=e._modulesNamespaceMap[n];return r}function createLogger(e){e===void 0&&(e={});var a=e.collapsed;a===void 0&&(a=!0);var n=e.filter;n===void 0&&(n=function(u,f,h){return!0});var r=e.transformer;r===void 0&&(r=function(u){return u});var i=e.mutationTransformer;i===void 0&&(i=function(u){return u});var s=e.actionFilter;s===void 0&&(s=function(u,f){return!0});var l=e.actionTransformer;l===void 0&&(l=function(u){return u});var c=e.logMutations;c===void 0&&(c=!0);var o=e.logActions;o===void 0&&(o=!0);var d=e.logger;return d===void 0&&(d=console),function(u){var f=deepCopy(u.state);if(typeof d=="undefined")return;c&&u.subscribe(function(h,m){var v=deepCopy(m);if(n(h,f,v)){var y=getFormattedTime(),k=i(h),w="mutation "+h.type+y;startMessage(d,w,a),d.log("%c prev state","color: #9E9E9E; font-weight: bold",r(f)),d.log("%c mutation","color: #03A9F4; font-weight: bold",k),d.log("%c next state","color: #4CAF50; font-weight: bold",r(v)),endMessage(d)}f=v}),o&&u.subscribeAction(function(h,m){if(s(h,m)){var v=getFormattedTime(),y=l(h),k="action "+h.type+v;startMessage(d,k,a),d.log("%c action","color: #03A9F4; font-weight: bold",y),endMessage(d)}})}}function startMessage(e,a,n){var r=n?e.groupCollapsed:e.group;try{r.call(e,a)}catch(i){e.log(a)}}function endMessage(e){try{e.groupEnd()}catch(a){e.log("\u2014\u2014 log end \u2014\u2014")}}function getFormattedTime(){var e=new Date;return" @ "+pad(e.getHours(),2)+":"+pad(e.getMinutes(),2)+":"+pad(e.getSeconds(),2)+"."+pad(e.getMilliseconds(),3)}function repeat(e,a){return new Array(a+1).join(e)}function pad(e,a){return repeat("0",a-e.toString().length)+e}var index$2={Store,install,version:"3.6.0",mapState,mapMutations,mapGetters,mapActions,createNamespacedHelpers,createLogger};let settingsData={},defaultSettingsData={},spotifyCredentials={};function getSettingsData(){return socket.emit("get_settings_data"),new Promise((e,a)=>{socket.on("init_settings",(n,r,i)=>{settingsData=n,defaultSettingsData=i,spotifyCredentials=r,socket.off("init_settings"),e({settingsData,defaultSettingsData,spotifyCredentials})})})}function getInitialPreviewVolume(){let e=parseInt(localStorage.getItem("previewVolume"));return isNaN(e)&&(e=80,localStorage.setItem("previewVolume",e.toString())),e}function checkInitialSlimDownloads(){return localStorage.getItem("slimDownloads")==="true"}function checkInitialSlimSidebar(){return localStorage.getItem("slimSidebar")==="true"}const state=()=>({currentCommit:null,latestCommit:null,updateAvailable:!1,deemixVersion:null,previewVolume:getInitialPreviewVolume(),hasSlimDownloads:checkInitialSlimDownloads(),hasSlimSidebar:checkInitialSlimSidebar()}),actions={setAppInfo({commit:e},a){e("SET_CURRENT_COMMIT",a.currentCommit),e("SET_LATEST_COMMIT",a.latestCommit),e("SET_UPDATE_AVAILABLE",a.updateAvailable),e("SET_DEEMIX_VERSION",a.deemixVersion)},setPreviewVolume({commit:e},a){e("SET_PREVIEW_VOLUME",a),localStorage.setItem("previewVolume",a.toString())},setSlimDownloads({commit:e},a){e("SET_SLIM_DOWNLOADS",a),localStorage.setItem("slimDownloads",a.toString())},setSlimSidebar({commit:e},a){e("SET_SLIM_SIDEBAR",a),localStorage.setItem("slimSidebar",a.toString()),Array.from(document.getElementsByClassName("toastify")).forEach(n=>{n.style.transform=`translate(${a?"3rem":"14rem"}, 0)`})}},getters={getAppInfo:e=>e,getPreviewVolume:e=>e.previewVolume,getSlimDownloads:e=>e.hasSlimDownloads,getSlimSidebar:e=>e.hasSlimSidebar},mutations={SET_CURRENT_COMMIT(e,a){e.currentCommit=a},SET_LATEST_COMMIT(e,a){e.latestCommit=a},SET_UPDATE_AVAILABLE(e,a){e.updateAvailable=a},SET_DEEMIX_VERSION(e,a){e.deemixVersion=a},SET_PREVIEW_VOLUME(e,a){e.previewVolume=a},SET_SLIM_DOWNLOADS(e,a){e.hasSlimDownloads=a},SET_SLIM_SIDEBAR(e,a){e.hasSlimSidebar=a}};var appInfo={state,getters,actions,mutations};const getDefaultState=()=>({arl:localStorage.getItem("arl")||"",status:null,user:{id:null,name:"",picture:""},spotifyUser:{id:localStorage.getItem("spotifyUser"),name:null,picture:null},clientMode:!1}),state$1=()=>getDefaultState(),actions$1={login({commit:e,dispatch:a},n){const{arl:r,user:i,status:s}=n;a("setARL",{arl:r}),e("SET_USER",i),e("SET_STATUS",s)},logout({commit:e}){localStorage.removeItem("arl"),e("RESET_LOGIN")},setARL({commit:e},a){let{arl:n,saveOnLocalStorage:r}=a;r=typeof r=="undefined"?!0:r,e("SET_ARL",n),r&&localStorage.setItem("arl",n)},removeARL({commit:e}){e("SET_ARL",""),localStorage.removeItem("arl")},setUser({commit:e},a){e("SET_USER",a)},setClientMode({commit:e},a){e("SET_CLIENT_MODE",a)}},getters$1={getARL:e=>e.arl,getUser:e=>e.user,getSpotifyUser:e=>e.spotifyUser,getClientMode:e=>e.clientMode,isLoggedIn:e=>!!e.arl,isLoggedWithSpotify:e=>!!e.spotifyUser.id},mutations$1={SET_ARL(e,a){e.arl=a},SET_STATUS(e,a){e.status=a},SET_USER(e,a){e.user=a},SET_CLIENT_MODE(e,a){e.clientMode=a},RESET_LOGIN(e){let a=e.clientMode;Object.assign(e,getDefaultState()),e.clientMode=a}};var login={state:state$1,getters:getters$1,actions:actions$1,mutations:mutations$1};const state$2=()=>({artist:"",bitrate:"",cover:"",downloaded:0,errors:[],failed:0,id:"",progress:0,silent:!0,size:0,title:"",type:"",uuid:""}),actions$2={setErrors({commit:e},a){e("SET_ERRORS",a)}},getters$2={getErrors:e=>e},mutations$2={SET_ERRORS(e,a){for(const n in e)if(e.hasOwnProperty(n)){const r=a[n];e[n]=r}}};var errors={state:state$2,getters:getters$2,actions:actions$2,mutations:mutations$2};Vue.use(index$2);var store=new index$2.Store({modules:{appInfo,login,errors},strict:!1});let wasEventListenerAdded=!1;class CustomSocket extends WebSocket{constructor(a){super(a)}emit(a,n){if(this.readyState!==WebSocket.OPEN)return!1;this.send(JSON.stringify({key:a,data:n}))}on(a,n){wasEventListenerAdded||(wasEventListenerAdded=!0,this.addEventListener("message",r=>{const i=JSON.parse(r.data);i.key===a&&n(i.data)}))}off(){console.log("off!")}}const socket=new CustomSocket("ws://"+location.host+"/");var __vue_render__=function(e,a){var n=a._c;return n("div",{directives:[{name:"show",rawName:"v-show",value:!a.props.hidden,expression:"!props.hidden"}],staticClass:"flex justify-center items-center flex-col flex-1 h-full",class:a.props.additionalClasses},[n("span",{staticClass:"mb-5"},[a._v(a._s(a.props.text||"Loading..."))]),a._v(" "),a._m(0)])},__vue_staticRenderFns__=[function(e,a){var n=a._c;return n("div",{staticClass:"lds-ring"},[n("div"),a._v(" "),n("div"),a._v(" "),n("div"),a._v(" "),n("div")])}];const __vue_inject_styles__=function(e){if(!e)return;e("data-v-20045564_0",{source:".lds-ring[data-v-20045564]{display:inline-block;position:relative;width:80px;height:80px}.lds-ring div[data-v-20045564]{box-sizing:border-box;display:block;position:absolute;width:64px;height:64px;margin:8px;border:8px solid #fff;border-radius:50%;animation:lds-ring-data-v-20045564 1.2s cubic-bezier(.5,0,.5,1) infinite;border-color:#fff transparent transparent transparent}.lds-ring div[data-v-20045564]:nth-child(1){animation-delay:-.45s}.lds-ring div[data-v-20045564]:nth-child(2){animation-delay:-.3s}.lds-ring div[data-v-20045564]:nth-child(3){animation-delay:-.15s}@keyframes lds-ring-data-v-20045564{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}",map:void 0,media:void 0})},__vue_scope_id__="data-v-20045564",__vue_module_identifier__=void 0,__vue_is_functional_template__=!0;function __vue_normalize__(e,a,n,r,i,s,l,c){const o=(typeof n=="function"?n.options:n)||{};o.__file="BaseLoadingPlaceholder.vue",o.render||(o.render=e.render,o.staticRenderFns=e.staticRenderFns,o._compiled=!0,i&&(o.functional=!0)),o._scopeId=r;{let d;if(a&&(d=function(u){a.call(this,l(u))}),d!==void 0)if(o.functional){const u=o.render;o.render=function(h,m){return d.call(m),u(h,m)}}else{const u=o.beforeCreate;o.beforeCreate=u?[].concat(u,d):[d]}}return o}function __vue_create_injector__(){const e=document.head||document.getElementsByTagName("head")[0],a=__vue_create_injector__.styles||(__vue_create_injector__.styles={}),n=typeof navigator!="undefined"&&/msie [6-9]\\b/.test(navigator.userAgent.toLowerCase());return function(i,s){if(document.querySelector('style[data-vue-ssr-id~="'+i+'"]'))return;const l=n?s.media||"default":i,c=a[l]||(a[l]={ids:[],parts:[],element:void 0});if(!c.ids.includes(i)){let o=s.source,d=c.ids.length;if(c.ids.push(i),s.map&&(o+=` +`;styleInject(css_248z$8);let wasEventListenerAdded=!1;class CustomSocket extends WebSocket{constructor(a){super(a)}emit(a,n){if(this.readyState!==WebSocket.OPEN)return!1;this.send(JSON.stringify({key:a,data:n}))}on(a,n){wasEventListenerAdded||(wasEventListenerAdded=!0,this.addEventListener("message",r=>{const i=JSON.parse(r.data);i.key===a&&n(i.data)}))}off(){console.log("off!")}}const socket=new CustomSocket("ws://"+location.host+"/");var __vue_render__=function(e,a){var n=a._c;return n("div",{directives:[{name:"show",rawName:"v-show",value:!a.props.hidden,expression:"!props.hidden"}],staticClass:"flex justify-center items-center flex-col flex-1 h-full",class:a.props.additionalClasses},[n("span",{staticClass:"mb-5"},[a._v(a._s(a.props.text||"Loading..."))]),a._v(" "),a._m(0)])},__vue_staticRenderFns__=[function(e,a){var n=a._c;return n("div",{staticClass:"lds-ring"},[n("div"),a._v(" "),n("div"),a._v(" "),n("div"),a._v(" "),n("div")])}];const __vue_inject_styles__=function(e){if(!e)return;e("data-v-20045564_0",{source:".lds-ring[data-v-20045564]{display:inline-block;position:relative;width:80px;height:80px}.lds-ring div[data-v-20045564]{box-sizing:border-box;display:block;position:absolute;width:64px;height:64px;margin:8px;border:8px solid #fff;border-radius:50%;animation:lds-ring-data-v-20045564 1.2s cubic-bezier(.5,0,.5,1) infinite;border-color:#fff transparent transparent transparent}.lds-ring div[data-v-20045564]:nth-child(1){animation-delay:-.45s}.lds-ring div[data-v-20045564]:nth-child(2){animation-delay:-.3s}.lds-ring div[data-v-20045564]:nth-child(3){animation-delay:-.15s}@keyframes lds-ring-data-v-20045564{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}",map:void 0,media:void 0})},__vue_scope_id__="data-v-20045564",__vue_module_identifier__=void 0,__vue_is_functional_template__=!0;function __vue_normalize__(e,a,n,r,i,s,l,c){const o=(typeof n=="function"?n.options:n)||{};o.__file="BaseLoadingPlaceholder.vue",o.render||(o.render=e.render,o.staticRenderFns=e.staticRenderFns,o._compiled=!0,i&&(o.functional=!0)),o._scopeId=r;{let d;if(a&&(d=function(u){a.call(this,l(u))}),d!==void 0)if(o.functional){const u=o.render;o.render=function(h,m){return d.call(m),u(h,m)}}else{const u=o.beforeCreate;o.beforeCreate=u?[].concat(u,d):[d]}}return o}function __vue_create_injector__(){const e=document.head||document.getElementsByTagName("head")[0],a=__vue_create_injector__.styles||(__vue_create_injector__.styles={}),n=typeof navigator!="undefined"&&/msie [6-9]\\b/.test(navigator.userAgent.toLowerCase());return function(i,s){if(document.querySelector('style[data-vue-ssr-id~="'+i+'"]'))return;const l=n?s.media||"default":i,c=a[l]||(a[l]={ids:[],parts:[],element:void 0});if(!c.ids.includes(i)){let o=s.source,d=c.ids.length;if(c.ids.push(i),s.map&&(o+=` /*# sourceURL=`+s.map.sources[0]+" */",o+=` /*# sourceMappingURL=data:application/json;base64,`+btoa(unescape(encodeURIComponent(JSON.stringify(s.map))))+" */"),n&&(c.element=c.element||document.querySelector("style[data-group="+l+"]")),!c.element){const u=c.element=document.createElement("style");u.type="text/css",s.media&&u.setAttribute("media",s.media),n&&(u.setAttribute("data-group",l),u.setAttribute("data-next-index","0")),e.appendChild(u)}if(n&&(d=parseInt(c.element.getAttribute("data-next-index")),c.element.setAttribute("data-next-index",d+1)),c.element.styleSheet)c.parts.push(o),c.element.styleSheet.cssText=c.parts.filter(Boolean).join(` `);else{const u=document.createTextNode(o),f=c.element.childNodes;f[d]&&c.element.removeChild(f[d]),f.length?c.element.insertBefore(u,f[d]):c.element.appendChild(u)}}}}var BaseLoadingPlaceholder=__vue_normalize__({render:__vue_render__,staticRenderFns:__vue_staticRenderFns__},__vue_inject_styles__,{},__vue_scope_id__,__vue_is_functional_template__,__vue_module_identifier__,__vue_create_injector__);const get=function(e,a){let n=`/api/${e}`;if(a){let r=Object.keys(a).map(i=>encodeURIComponent(i)+"="+encodeURIComponent(a[i])).join("&");n+="?"+r}return fetch(n).then(r=>r.json())};function sendAddToQueue(e,a=null){if(!e)throw new Error("No URL given to sendAddToQueue function!");get("addToQueue",{url:e,bitrate:a})}function aggregateDownloadLinks(e){let a=[];return e.forEach(n=>{a.push(n.link)}),a.join(";")}function generatePath(e){if(!e)throw new Error("No element passed to the generatePath function!");let a=[e];for(;(e=e.parentNode)&&e!==document;)a.push(e);return a}function isValidURL(e){let a=e.toLowerCase();if(a.startsWith("http")){if(a.indexOf("deezer.com")>=0||a.indexOf("deezer.page.link")>=0||a.indexOf("open.spotify.com")>=0||a.indexOf("link.tospotify.com")>=0)return!0}else if(a.startsWith("spotify:"))return!0;return!1}function convertDuration(e){let a,n;return a=Math.floor(e/60),n=e-a*60,n<10&&(n="0"+n),a+":"+n}function convertDurationSeparated(e){let a,n,r;return n=Math.floor(e/60),a=Math.floor(n/60),r=e-n*60,n-=a*60,[a,n,r]}function numberWithDots(e){return e.toString().replace(/\B(?=(\d{3})+(?!\d))/g,".")}function debounce(e,a,n){var r;return function(){var i=this,s=arguments,l=function(){r=null,n||e.apply(i,s)},c=n&&!r;clearTimeout(r),r=setTimeout(l,a),c&&e.apply(i,s)}}function copyToClipboard(e){const a=document.createElement("input");document.body.appendChild(a),a.setAttribute("type","text"),a.setAttribute("value",e),a.select(),a.setSelectionRange(0,99999),document.execCommand("copy"),a.remove()}function getPropertyWithFallback(e,...a){for(const n of a){let r=/\./.test(n),i=r?n.split(".").reduce((s,l)=>{if(s)return s[l]},e):e[n];if(typeof i!="undefined")return i}return null}var Utils={isValidURL,convertDuration,convertDurationSeparated,numberWithDots,debounce};const downloadQualities=[{objName:"flac",label:"FLAC",value:9},{objName:"320kbps",label:"MP3 320kbps",value:3},{objName:"128kbps",label:"MP3 128kbps",value:1},{objName:"realityAudioHQ",label:"360 Reality Audio [HQ]",value:15},{objName:"realityAudioMQ",label:"360 Reality Audio [MQ]",value:14},{objName:"realityAudioLQ",label:"360 Reality Audio [LQ]",value:13}];var script={data(){return{menuOpen:!1,xPos:0,yPos:0,deezerHref:"",generalHref:"",imgSrc:""}},computed:{options(){const e={cut:{label:this.$t("globals.cut"),show:!1,position:1,action:()=>{document.execCommand("Cut")}},copy:{label:this.$t("globals.copy"),show:!1,position:2,action:()=>{document.execCommand("Copy")}},copyLink:{label:this.$t("globals.copyLink"),show:!1,position:3,action:()=>{copyToClipboard(this.generalHref)}},copyImageLink:{label:this.$t("globals.copyImageLink"),show:!1,position:4,action:()=>{copyToClipboard(this.imgSrc)}},copyDeezerLink:{label:this.$t("globals.copyDeezerLink"),show:!1,position:5,action:()=>{copyToClipboard(this.deezerHref)}},paste:{label:this.$t("globals.paste"),show:!1,position:6,action:()=>{clipboard in navigator?navigator.clipboard.readText().then(n=>{document.execCommand("insertText",void 0,n)}):document.execCommand("paste")}}};let a=Object.values(e).length+1;return downloadQualities.forEach((n,r)=>{e[n.objName]={label:`${this.$t("globals.download",{thing:n.label})}`,show:!1,position:a+r,action:sendAddToQueue.bind(null,this.deezerHref,n.value)}}),e},sortedOptions(){return Object.values(this.options).sort((e,a)=>e.position{this.menuOpen=!1,this.options.copyLink.show=!1,this.options.copyDeezerLink.show=!1,this.options.copyImageLink.show=!1,downloadQualities.forEach(e=>{this.options[e.objName].show=!1})}).catch(e=>{console.error(e)})},positionMenu(e,a){this.xPos=`${e}px`,this.yPos=`${a}px`,this.$nextTick().then(()=>{const{innerHeight:n,innerWidth:r}=window,i=e+this.$refs.contextMenu.getBoundingClientRect().width,s=a+this.$refs.contextMenu.getBoundingClientRect().height;if(i>r){const l=i-r+15;this.xPos=`${e-l}px`}if(s>n){const l=s-n+15;this.yPos=`${a-l}px`}})},showDeezerOptions(e){e||(this.options.copyDeezerLink.show=!0),downloadQualities.forEach(a=>{this.options[a.objName].show=!0})}}};const __vue_script__=script;var __vue_render__$1=function(){var e=this,a=e.$createElement,n=e._self._c||a;return n("div",{directives:[{name:"show",rawName:"v-show",value:e.menuOpen,expression:"menuOpen"}],ref:"contextMenu",staticClass:"context-menu",style:{top:e.yPos,left:e.xPos}},e._l(e.sortedOptions,function(r){return n("button",{directives:[{name:"show",rawName:"v-show",value:r.show,expression:"option.show"}],key:r.label,staticClass:"btn menu-option",on:{click:function(i){return i.preventDefault(),r.action(i)}}},[n("span",{staticClass:"menu-option__text"},[e._v(e._s(r.label))])])}),0)},__vue_staticRenderFns__$1=[];const __vue_inject_styles__$1=function(e){if(!e)return;e("data-v-ce73bd68_0",{source:".context-menu[data-v-ce73bd68]{position:absolute;top:0;left:0;min-width:100px;border-radius:7px;background:var(--secondary-background);box-shadow:4px 10px 18px 0 rgba(0,0,0,.15);overflow:hidden;z-index:10000}.menu-option[data-v-ce73bd68]{display:flex;align-items:center;width:100%;height:40px;padding-left:10px;padding-right:10px;color:var(--foreground);cursor:pointer}.menu-option[data-v-ce73bd68]:hover{background:var(--table-highlight);filter:brightness(150%)}.menu-option__text[data-v-ce73bd68]{text-transform:capitalize}button[data-v-ce73bd68]{color:var(--primary-text);color:unset;background-color:var(--primary-color);background-color:unset;min-width:unset;position:unset;border:unset;border-radius:unset;font-family:unset;font-weight:unset;font-size:unset;padding:unset;margin-right:unset;height:unset;text-transform:unset;cursor:unset;transition:unset}button[data-v-ce73bd68]:focus{outline:0}button[data-v-ce73bd68]:active{background-color:unset;transform:unset}button[data-v-ce73bd68]:hover{background:unset;border:unset}",map:void 0,media:void 0})},__vue_scope_id__$1="data-v-ce73bd68",__vue_module_identifier__$1=void 0,__vue_is_functional_template__$1=!1;function __vue_normalize__$1(e,a,n,r,i,s,l,c){const o=(typeof n=="function"?n.options:n)||{};o.__file="TheContextMenu.vue",o.render||(o.render=e.render,o.staticRenderFns=e.staticRenderFns,o._compiled=!0,i&&(o.functional=!0)),o._scopeId=r;{let d;if(a&&(d=function(u){a.call(this,l(u))}),d!==void 0)if(o.functional){const u=o.render;o.render=function(h,m){return d.call(m),u(h,m)}}else{const u=o.beforeCreate;o.beforeCreate=u?[].concat(u,d):[d]}}return o}function __vue_create_injector__$1(){const e=document.head||document.getElementsByTagName("head")[0],a=__vue_create_injector__$1.styles||(__vue_create_injector__$1.styles={}),n=typeof navigator!="undefined"&&/msie [6-9]\\b/.test(navigator.userAgent.toLowerCase());return function(i,s){if(document.querySelector('style[data-vue-ssr-id~="'+i+'"]'))return;const l=n?s.media||"default":i,c=a[l]||(a[l]={ids:[],parts:[],element:void 0});if(!c.ids.includes(i)){let o=s.source,d=c.ids.length;if(c.ids.push(i),s.map&&(o+=` /*# sourceURL=`+s.map.sources[0]+" */",o+=` /*# sourceMappingURL=data:application/json;base64,`+btoa(unescape(encodeURIComponent(JSON.stringify(s.map))))+" */"),n&&(c.element=c.element||document.querySelector("style[data-group="+l+"]")),!c.element){const u=c.element=document.createElement("style");u.type="text/css",s.media&&u.setAttribute("media",s.media),n&&(u.setAttribute("data-group",l),u.setAttribute("data-next-index","0")),e.appendChild(u)}if(n&&(d=parseInt(c.element.getAttribute("data-next-index")),c.element.setAttribute("data-next-index",d+1)),c.element.styleSheet)c.parts.push(o),c.element.styleSheet.cssText=c.parts.filter(Boolean).join(` -`);else{const u=document.createTextNode(o),f=c.element.childNodes;f[d]&&c.element.removeChild(f[d]),f.length?c.element.insertBefore(u,f[d]):c.element.appendChild(u)}}}}var TheContextMenu=__vue_normalize__$1({render:__vue_render__$1,staticRenderFns:__vue_staticRenderFns__$1},__vue_inject_styles__$1,__vue_script__,__vue_scope_id__$1,__vue_is_functional_template__$1,__vue_module_identifier__$1,__vue_create_injector__$1),EventBus=new Vue;async function adjustVolume(e,a,{duration:n=1e3,easing:r=swing,interval:i=13}={}){const s=e.volume,l=a-s;if(!l||!n||!r||!i)return e.volume=a,Promise.resolve();const c=Math.floor(n/i);let o=1;return new Promise(d=>{const u=setInterval(()=>{e.volume=s+r(o/c)*l,++o===c&&(clearInterval(u),d())},i)})}function swing(e){return .5-Math.cos(e*Math.PI)/2}function playPausePreview(e){EventBus.$emit("trackPreview:playPausePreview",e)}function previewMouseEnter(e){EventBus.$emit("trackPreview:previewMouseEnter",e)}function previewMouseLeave(e){EventBus.$emit("trackPreview:previewMouseLeave",e)}var script$1={data:()=>({previewStopped:!1}),computed:{...mapGetters({previewVolume:"getPreviewVolume"})},mounted(){this.$refs.preview.volume=1,this.$router.beforeEach((e,a,n)=>{this.stopStackedTabsPreview(),n()}),EventBus.$on("trackPreview:playPausePreview",this.playPausePreview),EventBus.$on("trackPreview:previewMouseEnter",this.previewMouseEnter),EventBus.$on("trackPreview:previewMouseLeave",this.previewMouseLeave)},methods:{async onCanPlay(){await this.$refs.preview.play(),this.previewStopped=!1,await adjustVolume(this.$refs.preview,this.previewVolume/100,{duration:500})},async onTimeUpdate(){if(isNaN(this.$refs.preview.duration))return;let e=this.$refs.preview.duration;if(isFinite(e)||(e=30),e-this.$refs.preview.currentTime>=1)return;if(this.previewStopped)return;await adjustVolume(this.$refs.preview,0,{duration:800}),this.previewStopped=!0,document.querySelectorAll("a[playing] > .preview_controls").forEach(a=>{a.style.opacity=0}),document.querySelectorAll("*").forEach(a=>{a.removeAttribute("playing")}),document.querySelectorAll(".preview_controls, .preview_playlist_controls").forEach(a=>{a.textContent="play_arrow"})},async playPausePreview(e){e.preventDefault(),e.stopPropagation();const{currentTarget:a}=e;var n=a.tagName=="I"?a:a.querySelector("i");a.hasAttribute("playing")?this.$refs.preview.paused?(this.$refs.preview.play(),this.previewStopped=!1,n.innerText="pause",await adjustVolume(this.$refs.preview,this.previewVolume/100,{duration:500})):(this.previewStopped=!0,n.innerText="play_arrow",await adjustVolume(this.$refs.preview,0,{duration:250}),this.$refs.preview.pause()):(document.querySelectorAll("*").forEach(r=>{r.removeAttribute("playing")}),a.setAttribute("playing",!0),document.querySelectorAll(".preview_controls, .preview_playlist_controls").forEach(r=>{r.textContent="play_arrow"}),document.querySelectorAll(".preview_controls").forEach(r=>{r.style.opacity=0}),n.innerText="pause",n.style.opacity=1,this.previewStopped=!1,await adjustVolume(this.$refs.preview,0,{duration:250}),this.$refs.preview.pause(),document.getElementById("preview-track_source").src=a.getAttribute("data-preview"),this.$refs.preview.load())},async stopStackedTabsPreview(){let e=Array.prototype.slice.call(document.querySelectorAll(".preview_playlist_controls[playing]"));if(e.length===0)return;await adjustVolume(this.$refs.preview,0,{duration:250}),this.$refs.preview.pause(),this.previewStopped=!0,e.forEach(a=>{a.removeAttribute("playing"),a.innerText="play_arrow"})},previewMouseEnter(e){e.currentTarget.style.opacity=1},previewMouseLeave(e){const{currentTarget:a}=e,n=a.parentElement.hasAttribute("playing");(n&&this.previewStopped||!n)&&(a.style.opacity=0)}}};const __vue_script__$1=script$1;var __vue_render__$2=function(){var e=this,a=e.$createElement,n=e._self._c||a;return n("audio",{ref:"preview",attrs:{id:"preview-track"},on:{canplay:e.onCanPlay,timeupdate:e.onTimeUpdate}},[n("source",{attrs:{id:"preview-track_source",src:"",type:"audio/mpeg"}})])},__vue_staticRenderFns__$2=[];const __vue_inject_styles__$2=void 0,__vue_scope_id__$2=void 0,__vue_is_functional_template__$2=!1;function __vue_normalize__$2(e,a,n,r,i,s,l,c){const o=(typeof n=="function"?n.options:n)||{};return o.__file="TheTrackPreview.vue",o.render||(o.render=e.render,o.staticRenderFns=e.staticRenderFns,o._compiled=!0,i&&(o.functional=!0)),o._scopeId=r,o}var TheTrackPreview=__vue_normalize__$2({render:__vue_render__$2,staticRenderFns:__vue_staticRenderFns__$2},__vue_inject_styles__$2,__vue_script__$1,__vue_scope_id__$2,__vue_is_functional_template__$2),script$2={data:()=>({open:!1,url:""}),mounted(){this.$root.$on("QualityModal:open",this.openModal),this.$refs.modal.addEventListener("webkitAnimationEnd",this.handleAnimationEnd)},methods:{tryToDownloadTrack(e){const{target:a}=e;if(this.$refs.modal.classList.add("animated","fadeOut"),!a.matches(".quality-button"))return;sendAddToQueue(this.url,a.dataset.qualityValue)},openModal(e){this.url=e,this.open=!0,this.$refs.modal.classList.add("animated","fadeIn")},handleAnimationEnd(e){const{animationName:a}=e;if(this.$refs.modal.classList.remove("animated",a),a==="fadeIn")return;this.open=!1}}};const __vue_script__$2=script$2;var __vue_render__$3=function(){var e=this,a=e.$createElement,n=e._self._c||a;return n("div",{directives:[{name:"show",rawName:"v-show",value:e.open,expression:"open"}],ref:"modal",staticClass:"smallmodal",attrs:{id:"modal_quality"},on:{click:function(r){return e.tryToDownloadTrack(r)}}},[n("div",{staticClass:"smallmodal-content"},[n("button",{staticClass:"btn btn-primary quality-button",attrs:{"data-quality-value":"9"}},[e._v(` +`);else{const u=document.createTextNode(o),f=c.element.childNodes;f[d]&&c.element.removeChild(f[d]),f.length?c.element.insertBefore(u,f[d]):c.element.appendChild(u)}}}}var TheContextMenu=__vue_normalize__$1({render:__vue_render__$1,staticRenderFns:__vue_staticRenderFns__$1},__vue_inject_styles__$1,__vue_script__,__vue_scope_id__$1,__vue_is_functional_template__$1,__vue_module_identifier__$1,__vue_create_injector__$1);/*! + * vuex v3.6.0 + * (c) 2020 Evan You + * @license MIT + */function applyMixin(e){var a=Number(e.version.split(".")[0]);if(a>=2)e.mixin({beforeCreate:r});else{var n=e.prototype._init;e.prototype._init=function(i){i===void 0&&(i={}),i.init=i.init?[r].concat(i.init):r,n.call(this,i)}}function r(){var i=this.$options;i.store?this.$store=typeof i.store=="function"?i.store():i.store:i.parent&&i.parent.$store&&(this.$store=i.parent.$store)}}var target$2=typeof window!="undefined"?window:typeof global!="undefined"?global:{},devtoolHook=target$2.__VUE_DEVTOOLS_GLOBAL_HOOK__;function devtoolPlugin(e){if(!devtoolHook)return;e._devtoolHook=devtoolHook,devtoolHook.emit("vuex:init",e),devtoolHook.on("vuex:travel-to-state",function(a){e.replaceState(a)}),e.subscribe(function(a,n){devtoolHook.emit("vuex:mutation",a,n)},{prepend:!0}),e.subscribeAction(function(a,n){devtoolHook.emit("vuex:action",a,n)},{prepend:!0})}function find(e,a){return e.filter(a)[0]}function deepCopy(e,a){if(a===void 0&&(a=[]),e===null||typeof e!="object")return e;var n=find(a,function(i){return i.original===e});if(n)return n.copy;var r=Array.isArray(e)?[]:{};return a.push({original:e,copy:r}),Object.keys(e).forEach(function(i){r[i]=deepCopy(e[i],a)}),r}function forEachValue(e,a){Object.keys(e).forEach(function(n){return a(e[n],n)})}function isObject$1(e){return e!==null&&typeof e=="object"}function isPromise$1(e){return e&&typeof e.then=="function"}function partial(e,a){return function(){return e(a)}}var Module=function(a,n){this.runtime=n,this._children=Object.create(null),this._rawModule=a;var r=a.state;this.state=(typeof r=="function"?r():r)||{}},prototypeAccessors$1={namespaced:{configurable:!0}};prototypeAccessors$1.namespaced.get=function(){return!!this._rawModule.namespaced},Module.prototype.addChild=function(a,n){this._children[a]=n},Module.prototype.removeChild=function(a){delete this._children[a]},Module.prototype.getChild=function(a){return this._children[a]},Module.prototype.hasChild=function(a){return a in this._children},Module.prototype.update=function(a){this._rawModule.namespaced=a.namespaced,a.actions&&(this._rawModule.actions=a.actions),a.mutations&&(this._rawModule.mutations=a.mutations),a.getters&&(this._rawModule.getters=a.getters)},Module.prototype.forEachChild=function(a){forEachValue(this._children,a)},Module.prototype.forEachGetter=function(a){this._rawModule.getters&&forEachValue(this._rawModule.getters,a)},Module.prototype.forEachAction=function(a){this._rawModule.actions&&forEachValue(this._rawModule.actions,a)},Module.prototype.forEachMutation=function(a){this._rawModule.mutations&&forEachValue(this._rawModule.mutations,a)},Object.defineProperties(Module.prototype,prototypeAccessors$1);var ModuleCollection=function(a){this.register([],a,!1)};ModuleCollection.prototype.get=function(a){return a.reduce(function(n,r){return n.getChild(r)},this.root)},ModuleCollection.prototype.getNamespace=function(a){var n=this.root;return a.reduce(function(r,i){return n=n.getChild(i),r+(n.namespaced?i+"/":"")},"")},ModuleCollection.prototype.update=function(a){update([],this.root,a)},ModuleCollection.prototype.register=function(a,n,r){var i=this;r===void 0&&(r=!0);var s=new Module(n,r);if(a.length===0)this.root=s;else{var l=this.get(a.slice(0,-1));l.addChild(a[a.length-1],s)}n.modules&&forEachValue(n.modules,function(c,o){i.register(a.concat(o),c,r)})},ModuleCollection.prototype.unregister=function(a){var n=this.get(a.slice(0,-1)),r=a[a.length-1],i=n.getChild(r);if(!i)return;if(!i.runtime)return;n.removeChild(r)},ModuleCollection.prototype.isRegistered=function(a){var n=this.get(a.slice(0,-1)),r=a[a.length-1];return n?n.hasChild(r):!1};function update(e,a,n){if(a.update(n),n.modules)for(var r in n.modules){if(!a.getChild(r))return;update(e.concat(r),a.getChild(r),n.modules[r])}}var Vue$1,Store=function(a){var n=this;a===void 0&&(a={}),!Vue$1&&typeof window!="undefined"&&window.Vue&&install(window.Vue);var r=a.plugins;r===void 0&&(r=[]);var i=a.strict;i===void 0&&(i=!1),this._committing=!1,this._actions=Object.create(null),this._actionSubscribers=[],this._mutations=Object.create(null),this._wrappedGetters=Object.create(null),this._modules=new ModuleCollection(a),this._modulesNamespaceMap=Object.create(null),this._subscribers=[],this._watcherVM=new Vue$1,this._makeLocalGettersCache=Object.create(null);var s=this,l=this,c=l.dispatch,o=l.commit;this.dispatch=function(h,m){return c.call(s,h,m)},this.commit=function(h,m,v){return o.call(s,h,m,v)},this.strict=i;var d=this._modules.root.state;installModule(this,d,[],this._modules.root),resetStoreVM(this,d),r.forEach(function(f){return f(n)});var u=a.devtools!==void 0?a.devtools:Vue$1.config.devtools;u&&devtoolPlugin(this)},prototypeAccessors$1$1={state:{configurable:!0}};prototypeAccessors$1$1.state.get=function(){return this._vm._data.$$state},prototypeAccessors$1$1.state.set=function(e){},Store.prototype.commit=function(a,n,r){var i=this,s=unifyObjectStyle(a,n,r),l=s.type,c=s.payload,o={type:l,payload:c},d=this._mutations[l];if(!d)return;this._withCommit(function(){d.forEach(function(f){f(c)})}),this._subscribers.slice().forEach(function(u){return u(o,i.state)})},Store.prototype.dispatch=function(a,n){var r=this,i=unifyObjectStyle(a,n),s=i.type,l=i.payload,c={type:s,payload:l},o=this._actions[s];if(!o)return;try{this._actionSubscribers.slice().filter(function(u){return u.before}).forEach(function(u){return u.before(c,r.state)})}catch(u){}var d=o.length>1?Promise.all(o.map(function(u){return u(l)})):o[0](l);return new Promise(function(u,f){d.then(function(h){try{r._actionSubscribers.filter(function(m){return m.after}).forEach(function(m){return m.after(c,r.state)})}catch(m){}u(h)},function(h){try{r._actionSubscribers.filter(function(m){return m.error}).forEach(function(m){return m.error(c,r.state,h)})}catch(m){}f(h)})})},Store.prototype.subscribe=function(a,n){return genericSubscribe(a,this._subscribers,n)},Store.prototype.subscribeAction=function(a,n){var r=typeof a=="function"?{before:a}:a;return genericSubscribe(r,this._actionSubscribers,n)},Store.prototype.watch=function(a,n,r){var i=this;return this._watcherVM.$watch(function(){return a(i.state,i.getters)},n,r)},Store.prototype.replaceState=function(a){var n=this;this._withCommit(function(){n._vm._data.$$state=a})},Store.prototype.registerModule=function(a,n,r){r===void 0&&(r={}),typeof a=="string"&&(a=[a]),this._modules.register(a,n),installModule(this,this.state,a,this._modules.get(a),r.preserveState),resetStoreVM(this,this.state)},Store.prototype.unregisterModule=function(a){var n=this;typeof a=="string"&&(a=[a]),this._modules.unregister(a),this._withCommit(function(){var r=getNestedState(n.state,a.slice(0,-1));Vue$1.delete(r,a[a.length-1])}),resetStore(this)},Store.prototype.hasModule=function(a){return typeof a=="string"&&(a=[a]),this._modules.isRegistered(a)},Store.prototype.hotUpdate=function(a){this._modules.update(a),resetStore(this,!0)},Store.prototype._withCommit=function(a){var n=this._committing;this._committing=!0,a(),this._committing=n},Object.defineProperties(Store.prototype,prototypeAccessors$1$1);function genericSubscribe(e,a,n){return a.indexOf(e)<0&&(n&&n.prepend?a.unshift(e):a.push(e)),function(){var r=a.indexOf(e);r>-1&&a.splice(r,1)}}function resetStore(e,a){e._actions=Object.create(null),e._mutations=Object.create(null),e._wrappedGetters=Object.create(null),e._modulesNamespaceMap=Object.create(null);var n=e.state;installModule(e,n,[],e._modules.root,!0),resetStoreVM(e,n,a)}function resetStoreVM(e,a,n){var r=e._vm;e.getters={},e._makeLocalGettersCache=Object.create(null);var i=e._wrappedGetters,s={};forEachValue(i,function(c,o){s[o]=partial(c,e),Object.defineProperty(e.getters,o,{get:function(){return e._vm[o]},enumerable:!0})});var l=Vue$1.config.silent;Vue$1.config.silent=!0,e._vm=new Vue$1({data:{$$state:a},computed:s}),Vue$1.config.silent=l,e.strict&&enableStrictMode(e),r&&(n&&e._withCommit(function(){r._data.$$state=null}),Vue$1.nextTick(function(){return r.$destroy()}))}function installModule(e,a,n,r,i){var s=!n.length,l=e._modules.getNamespace(n);if(r.namespaced&&(e._modulesNamespaceMap[l]&&!1&&console.error("[vuex] duplicate namespace "+l+" for the namespaced module "+n.join("/")),e._modulesNamespaceMap[l]=r),!s&&!i){var c=getNestedState(a,n.slice(0,-1)),o=n[n.length-1];e._withCommit(function(){Vue$1.set(c,o,r.state)})}var d=r.context=makeLocalContext(e,l,n);r.forEachMutation(function(u,f){var h=l+f;registerMutation(e,h,u,d)}),r.forEachAction(function(u,f){var h=u.root?f:l+f,m=u.handler||u;registerAction(e,h,m,d)}),r.forEachGetter(function(u,f){var h=l+f;registerGetter(e,h,u,d)}),r.forEachChild(function(u,f){installModule(e,a,n.concat(f),u,i)})}function makeLocalContext(e,a,n){var r=a==="",i={dispatch:r?e.dispatch:function(s,l,c){var o=unifyObjectStyle(s,l,c),d=o.payload,u=o.options,f=o.type;return(!u||!u.root)&&(f=a+f),e.dispatch(f,d)},commit:r?e.commit:function(s,l,c){var o=unifyObjectStyle(s,l,c),d=o.payload,u=o.options,f=o.type;(!u||!u.root)&&(f=a+f),e.commit(f,d,u)}};return Object.defineProperties(i,{getters:{get:r?function(){return e.getters}:function(){return makeLocalGetters(e,a)}},state:{get:function(){return getNestedState(e.state,n)}}}),i}function makeLocalGetters(e,a){if(!e._makeLocalGettersCache[a]){var n={},r=a.length;Object.keys(e.getters).forEach(function(i){if(i.slice(0,r)!==a)return;var s=i.slice(r);Object.defineProperty(n,s,{get:function(){return e.getters[i]},enumerable:!0})}),e._makeLocalGettersCache[a]=n}return e._makeLocalGettersCache[a]}function registerMutation(e,a,n,r){var i=e._mutations[a]||(e._mutations[a]=[]);i.push(function(l){n.call(e,r.state,l)})}function registerAction(e,a,n,r){var i=e._actions[a]||(e._actions[a]=[]);i.push(function(l){var c=n.call(e,{dispatch:r.dispatch,commit:r.commit,getters:r.getters,state:r.state,rootGetters:e.getters,rootState:e.state},l);return isPromise$1(c)||(c=Promise.resolve(c)),e._devtoolHook?c.catch(function(o){throw e._devtoolHook.emit("vuex:error",o),o}):c})}function registerGetter(e,a,n,r){if(e._wrappedGetters[a])return;e._wrappedGetters[a]=function(s){return n(r.state,r.getters,s.state,s.getters)}}function enableStrictMode(e){e._vm.$watch(function(){return this._data.$$state},function(){},{deep:!0,sync:!0})}function getNestedState(e,a){return a.reduce(function(n,r){return n[r]},e)}function unifyObjectStyle(e,a,n){return isObject$1(e)&&e.type&&(n=a,a=e,e=e.type),{type:e,payload:a,options:n}}function install(e){if(Vue$1&&e===Vue$1)return;Vue$1=e,applyMixin(Vue$1)}var mapState=normalizeNamespace(function(e,a){var n={};return normalizeMap(a).forEach(function(r){var i=r.key,s=r.val;n[i]=function(){var c=this.$store.state,o=this.$store.getters;if(e){var d=getModuleByNamespace(this.$store,"mapState",e);if(!d)return;c=d.context.state,o=d.context.getters}return typeof s=="function"?s.call(this,c,o):c[s]},n[i].vuex=!0}),n}),mapMutations=normalizeNamespace(function(e,a){var n={};return normalizeMap(a).forEach(function(r){var i=r.key,s=r.val;n[i]=function(){for(var c=[],o=arguments.length;o--;)c[o]=arguments[o];var d=this.$store.commit;if(e){var u=getModuleByNamespace(this.$store,"mapMutations",e);if(!u)return;d=u.context.commit}return typeof s=="function"?s.apply(this,[d].concat(c)):d.apply(this.$store,[s].concat(c))}}),n}),mapGetters=normalizeNamespace(function(e,a){var n={};return normalizeMap(a).forEach(function(r){var i=r.key,s=r.val;s=e+s,n[i]=function(){return e&&!getModuleByNamespace(this.$store,"mapGetters",e)?void 0:this.$store.getters[s]},n[i].vuex=!0}),n}),mapActions=normalizeNamespace(function(e,a){var n={};return normalizeMap(a).forEach(function(r){var i=r.key,s=r.val;n[i]=function(){for(var c=[],o=arguments.length;o--;)c[o]=arguments[o];var d=this.$store.dispatch;if(e){var u=getModuleByNamespace(this.$store,"mapActions",e);if(!u)return;d=u.context.dispatch}return typeof s=="function"?s.apply(this,[d].concat(c)):d.apply(this.$store,[s].concat(c))}}),n}),createNamespacedHelpers=function(e){return{mapState:mapState.bind(null,e),mapGetters:mapGetters.bind(null,e),mapMutations:mapMutations.bind(null,e),mapActions:mapActions.bind(null,e)}};function normalizeMap(e){return isValidMap(e)?Array.isArray(e)?e.map(function(a){return{key:a,val:a}}):Object.keys(e).map(function(a){return{key:a,val:e[a]}}):[]}function isValidMap(e){return Array.isArray(e)||isObject$1(e)}function normalizeNamespace(e){return function(a,n){return typeof a!="string"?(n=a,a=""):a.charAt(a.length-1)!=="/"&&(a+="/"),e(a,n)}}function getModuleByNamespace(e,a,n){var r=e._modulesNamespaceMap[n];return r}function createLogger(e){e===void 0&&(e={});var a=e.collapsed;a===void 0&&(a=!0);var n=e.filter;n===void 0&&(n=function(u,f,h){return!0});var r=e.transformer;r===void 0&&(r=function(u){return u});var i=e.mutationTransformer;i===void 0&&(i=function(u){return u});var s=e.actionFilter;s===void 0&&(s=function(u,f){return!0});var l=e.actionTransformer;l===void 0&&(l=function(u){return u});var c=e.logMutations;c===void 0&&(c=!0);var o=e.logActions;o===void 0&&(o=!0);var d=e.logger;return d===void 0&&(d=console),function(u){var f=deepCopy(u.state);if(typeof d=="undefined")return;c&&u.subscribe(function(h,m){var v=deepCopy(m);if(n(h,f,v)){var y=getFormattedTime(),k=i(h),w="mutation "+h.type+y;startMessage(d,w,a),d.log("%c prev state","color: #9E9E9E; font-weight: bold",r(f)),d.log("%c mutation","color: #03A9F4; font-weight: bold",k),d.log("%c next state","color: #4CAF50; font-weight: bold",r(v)),endMessage(d)}f=v}),o&&u.subscribeAction(function(h,m){if(s(h,m)){var v=getFormattedTime(),y=l(h),k="action "+h.type+v;startMessage(d,k,a),d.log("%c action","color: #03A9F4; font-weight: bold",y),endMessage(d)}})}}function startMessage(e,a,n){var r=n?e.groupCollapsed:e.group;try{r.call(e,a)}catch(i){e.log(a)}}function endMessage(e){try{e.groupEnd()}catch(a){e.log("\u2014\u2014 log end \u2014\u2014")}}function getFormattedTime(){var e=new Date;return" @ "+pad(e.getHours(),2)+":"+pad(e.getMinutes(),2)+":"+pad(e.getSeconds(),2)+"."+pad(e.getMilliseconds(),3)}function repeat(e,a){return new Array(a+1).join(e)}function pad(e,a){return repeat("0",a-e.toString().length)+e}var index$2={Store,install,version:"3.6.0",mapState,mapMutations,mapGetters,mapActions,createNamespacedHelpers,createLogger},EventBus=new Vue;async function adjustVolume(e,a,{duration:n=1e3,easing:r=swing,interval:i=13}={}){const s=e.volume,l=a-s;if(!l||!n||!r||!i)return e.volume=a,Promise.resolve();const c=Math.floor(n/i);let o=1;return new Promise(d=>{const u=setInterval(()=>{e.volume=s+r(o/c)*l,++o===c&&(clearInterval(u),d())},i)})}function swing(e){return .5-Math.cos(e*Math.PI)/2}function playPausePreview(e){EventBus.$emit("trackPreview:playPausePreview",e)}function previewMouseEnter(e){EventBus.$emit("trackPreview:previewMouseEnter",e)}function previewMouseLeave(e){EventBus.$emit("trackPreview:previewMouseLeave",e)}var script$1={data:()=>({previewStopped:!1}),computed:{...mapGetters({previewVolume:"getPreviewVolume"})},mounted(){this.$refs.preview.volume=1,this.$router.beforeEach((e,a,n)=>{this.stopStackedTabsPreview(),n()}),EventBus.$on("trackPreview:playPausePreview",this.playPausePreview),EventBus.$on("trackPreview:previewMouseEnter",this.previewMouseEnter),EventBus.$on("trackPreview:previewMouseLeave",this.previewMouseLeave)},methods:{async onCanPlay(){await this.$refs.preview.play(),this.previewStopped=!1,await adjustVolume(this.$refs.preview,this.previewVolume/100,{duration:500})},async onTimeUpdate(){if(isNaN(this.$refs.preview.duration))return;let e=this.$refs.preview.duration;if(isFinite(e)||(e=30),e-this.$refs.preview.currentTime>=1)return;if(this.previewStopped)return;await adjustVolume(this.$refs.preview,0,{duration:800}),this.previewStopped=!0,document.querySelectorAll("a[playing] > .preview_controls").forEach(a=>{a.style.opacity=0}),document.querySelectorAll("*").forEach(a=>{a.removeAttribute("playing")}),document.querySelectorAll(".preview_controls, .preview_playlist_controls").forEach(a=>{a.textContent="play_arrow"})},async playPausePreview(e){e.preventDefault(),e.stopPropagation();const{currentTarget:a}=e;var n=a.tagName=="I"?a:a.querySelector("i");a.hasAttribute("playing")?this.$refs.preview.paused?(this.$refs.preview.play(),this.previewStopped=!1,n.innerText="pause",await adjustVolume(this.$refs.preview,this.previewVolume/100,{duration:500})):(this.previewStopped=!0,n.innerText="play_arrow",await adjustVolume(this.$refs.preview,0,{duration:250}),this.$refs.preview.pause()):(document.querySelectorAll("*").forEach(r=>{r.removeAttribute("playing")}),a.setAttribute("playing",!0),document.querySelectorAll(".preview_controls, .preview_playlist_controls").forEach(r=>{r.textContent="play_arrow"}),document.querySelectorAll(".preview_controls").forEach(r=>{r.style.opacity=0}),n.innerText="pause",n.style.opacity=1,this.previewStopped=!1,await adjustVolume(this.$refs.preview,0,{duration:250}),this.$refs.preview.pause(),document.getElementById("preview-track_source").src=a.getAttribute("data-preview"),this.$refs.preview.load())},async stopStackedTabsPreview(){let e=Array.prototype.slice.call(document.querySelectorAll(".preview_playlist_controls[playing]"));if(e.length===0)return;await adjustVolume(this.$refs.preview,0,{duration:250}),this.$refs.preview.pause(),this.previewStopped=!0,e.forEach(a=>{a.removeAttribute("playing"),a.innerText="play_arrow"})},previewMouseEnter(e){e.currentTarget.style.opacity=1},previewMouseLeave(e){const{currentTarget:a}=e,n=a.parentElement.hasAttribute("playing");(n&&this.previewStopped||!n)&&(a.style.opacity=0)}}};const __vue_script__$1=script$1;var __vue_render__$2=function(){var e=this,a=e.$createElement,n=e._self._c||a;return n("audio",{ref:"preview",attrs:{id:"preview-track"},on:{canplay:e.onCanPlay,timeupdate:e.onTimeUpdate}},[n("source",{attrs:{id:"preview-track_source",src:"",type:"audio/mpeg"}})])},__vue_staticRenderFns__$2=[];const __vue_inject_styles__$2=void 0,__vue_scope_id__$2=void 0,__vue_is_functional_template__$2=!1;function __vue_normalize__$2(e,a,n,r,i,s,l,c){const o=(typeof n=="function"?n.options:n)||{};return o.__file="TheTrackPreview.vue",o.render||(o.render=e.render,o.staticRenderFns=e.staticRenderFns,o._compiled=!0,i&&(o.functional=!0)),o._scopeId=r,o}var TheTrackPreview=__vue_normalize__$2({render:__vue_render__$2,staticRenderFns:__vue_staticRenderFns__$2},__vue_inject_styles__$2,__vue_script__$1,__vue_scope_id__$2,__vue_is_functional_template__$2),script$2={data:()=>({open:!1,url:""}),mounted(){this.$root.$on("QualityModal:open",this.openModal),this.$refs.modal.addEventListener("webkitAnimationEnd",this.handleAnimationEnd)},methods:{tryToDownloadTrack(e){const{target:a}=e;if(this.$refs.modal.classList.add("animated","fadeOut"),!a.matches(".quality-button"))return;sendAddToQueue(this.url,a.dataset.qualityValue)},openModal(e){this.url=e,this.open=!0,this.$refs.modal.classList.add("animated","fadeIn")},handleAnimationEnd(e){const{animationName:a}=e;if(this.$refs.modal.classList.remove("animated",a),a==="fadeIn")return;this.open=!1}}};const __vue_script__$2=script$2;var __vue_render__$3=function(){var e=this,a=e.$createElement,n=e._self._c||a;return n("div",{directives:[{name:"show",rawName:"v-show",value:e.open,expression:"open"}],ref:"modal",staticClass:"smallmodal",attrs:{id:"modal_quality"},on:{click:function(r){return e.tryToDownloadTrack(r)}}},[n("div",{staticClass:"smallmodal-content"},[n("button",{staticClass:"btn btn-primary quality-button",attrs:{"data-quality-value":"9"}},[e._v(` `+e._s(e.$t("globals.download",{thing:"FLAC"}))+` `)]),e._v(" "),n("button",{staticClass:"btn btn-primary quality-button",attrs:{"data-quality-value":"3"}},[e._v(` `+e._s(e.$t("globals.download",{thing:"MP3 320kbps"}))+` @@ -2968,7 +2968,7 @@ PERFORMANCE OF THIS SOFTWARE. `)])])],1)}),0)])])])},__vue_staticRenderFns__$f=[];const __vue_inject_styles__$f=void 0,__vue_scope_id__$f=void 0,__vue_is_functional_template__$f=!1;function __vue_normalize__$f(e,a,n,r,i,s,l,c){const o=(typeof n=="function"?n.options:n)||{};return o.__file="Charts.vue",o.render||(o.render=e.render,o.staticRenderFns=e.staticRenderFns,o._compiled=!0,i&&(o.functional=!0)),o._scopeId=r,o}var Charts=__vue_normalize__$f({render:__vue_render__$f,staticRenderFns:__vue_staticRenderFns__$f},__vue_inject_styles__$f,__vue_script__$d,__vue_scope_id__$f,__vue_is_functional_template__$f),script$e={computed:{...mapGetters(["getErrors"]),title(){return`${this.getErrors.artist} - ${this.getErrors.title}`},errors(){return this.getErrors.errors}}};const __vue_script__$e=script$e;var __vue_render__$g=function(){var e=this,a=e.$createElement,n=e._self._c||a;return n("div",[n("h1",{staticClass:"mb-8 text-5xl"},[e._v(e._s(e.$t("errors.title",{name:e.title})))]),e._v(" "),n("table",{staticClass:"table table--tracklist"},[n("tr",[n("th",[e._v("ID")]),e._v(" "),n("th",[e._v(e._s(e.$tc("globals.listTabs.artist",1)))]),e._v(" "),n("th",[e._v(e._s(e.$tc("globals.listTabs.title",1)))]),e._v(" "),n("th",[e._v(e._s(e.$tc("globals.listTabs.error",1)))])]),e._v(" "),e._l(e.errors,function(r){return n("tr",{key:r.data.id},[n("td",[e._v(e._s(r.data.id))]),e._v(" "),n("td",[e._v(e._s(r.data.artist))]),e._v(" "),n("td",[e._v(e._s(r.data.title))]),e._v(" "),n("td",[e._v(e._s(r.errid?e.$t("errors.ids."+r.errid):r.message))])])})],2)])},__vue_staticRenderFns__$g=[];const __vue_inject_styles__$g=void 0,__vue_scope_id__$g=void 0,__vue_is_functional_template__$g=!1;function __vue_normalize__$g(e,a,n,r,i,s,l,c){const o=(typeof n=="function"?n.options:n)||{};return o.__file="Errors.vue",o.render||(o.render=e.render,o.staticRenderFns=e.staticRenderFns,o._compiled=!0,i&&(o.functional=!0)),o._scopeId=r,o}var Errors=__vue_normalize__$g({render:__vue_render__$g,staticRenderFns:__vue_staticRenderFns__$g},__vue_inject_styles__$g,__vue_script__$e,__vue_scope_id__$g,__vue_is_functional_template__$g),script$f={inheritAttrs:!1,props:{cover:{type:String,reqired:!0},isRounded:{type:Boolean,required:!1},isCircle:{type:Boolean,required:!1},link:{type:String,reqired:!0}}};const __vue_script__$f=script$f;var __vue_render__$h=function(){var e=this,a=e.$createElement,n=e._self._c||a;return n("div",{staticClass:"relative cover-container group"},[n("img",{staticClass:"block w-full opacity-100 coverart",class:{rounded:e.isRounded,"rounded-full":e.isCircle},attrs:{"aria-hidden":"true",src:e.cover}}),e._v(" "),n("button",e._g({staticClass:"absolute p-0 text-center bg-black border-0 rounded-full opacity-0 download_overlay hover:bg-primary",attrs:{role:"button","aria-label":"download","data-link":e.link,tabindex:"0"}},e.$listeners),[n("i",{staticClass:"text-white cursor-pointer material-icons",attrs:{title:e.$t("globals.download_hint")}},[e._v("get_app")])])])},__vue_staticRenderFns__$h=[];const __vue_inject_styles__$h=function(e){if(!e)return;e("data-v-5a73b889_0",{source:".cover-container[data-v-5a73b889]{width:156px;height:156px;margin-bottom:10px}.cover-container .coverart[data-v-5a73b889]{backface-visibility:hidden;transition:.5s ease;height:auto}.cover-container .download_overlay[data-v-5a73b889]{top:50%;left:50%;transform:translate(-50%,-50%);transition:.5s ease;opacity:0;min-width:2rem;height:2.75rem;text-align:center}.cover-container .download_overlay i[data-v-5a73b889]{padding:.625rem}.cover-container .download_overlay[data-v-5a73b889]:focus{opacity:1}.cover-container:hover .coverart[data-v-5a73b889]{opacity:.75}.cover-container:hover .download_overlay[data-v-5a73b889]{opacity:1;border:0}",map:void 0,media:void 0})},__vue_scope_id__$h="data-v-5a73b889",__vue_module_identifier__$a=void 0,__vue_is_functional_template__$h=!1;function __vue_normalize__$h(e,a,n,r,i,s,l,c){const o=(typeof n=="function"?n.options:n)||{};o.__file="CoverContainer.vue",o.render||(o.render=e.render,o.staticRenderFns=e.staticRenderFns,o._compiled=!0,i&&(o.functional=!0)),o._scopeId=r;{let d;if(a&&(d=function(u){a.call(this,l(u))}),d!==void 0)if(o.functional){const u=o.render;o.render=function(h,m){return d.call(m),u(h,m)}}else{const u=o.beforeCreate;o.beforeCreate=u?[].concat(u,d):[d]}}return o}function __vue_create_injector__$a(){const e=document.head||document.getElementsByTagName("head")[0],a=__vue_create_injector__$a.styles||(__vue_create_injector__$a.styles={}),n=typeof navigator!="undefined"&&/msie [6-9]\\b/.test(navigator.userAgent.toLowerCase());return function(i,s){if(document.querySelector('style[data-vue-ssr-id~="'+i+'"]'))return;const l=n?s.media||"default":i,c=a[l]||(a[l]={ids:[],parts:[],element:void 0});if(!c.ids.includes(i)){let o=s.source,d=c.ids.length;if(c.ids.push(i),s.map&&(o+=` /*# sourceURL=`+s.map.sources[0]+" */",o+=` /*# sourceMappingURL=data:application/json;base64,`+btoa(unescape(encodeURIComponent(JSON.stringify(s.map))))+" */"),n&&(c.element=c.element||document.querySelector("style[data-group="+l+"]")),!c.element){const u=c.element=document.createElement("style");u.type="text/css",s.media&&u.setAttribute("media",s.media),n&&(u.setAttribute("data-group",l),u.setAttribute("data-next-index","0")),e.appendChild(u)}if(n&&(d=parseInt(c.element.getAttribute("data-next-index")),c.element.setAttribute("data-next-index",d+1)),c.element.styleSheet)c.parts.push(o),c.element.styleSheet.cssText=c.parts.filter(Boolean).join(` -`);else{const u=document.createTextNode(o),f=c.element.childNodes;f[d]&&c.element.removeChild(f[d]),f.length?c.element.insertBefore(u,f[d]):c.element.appendChild(u)}}}}var CoverContainer=__vue_normalize__$h({render:__vue_render__$h,staticRenderFns:__vue_staticRenderFns__$h},__vue_inject_styles__$h,__vue_script__$f,__vue_scope_id__$h,__vue_is_functional_template__$h,__vue_module_identifier__$a,__vue_create_injector__$a);const favoriteArtists=ref$2([]),favoriteAlbums=ref$2([]),favoriteSpotifyPlaylists=ref$2([]),favoritePlaylists=ref$2([]),favoriteTracks=ref$2([]),isRefreshingFavorites=ref$2(!1);store.getters.isLoggedIn&&refreshFavorites({isInitial:!0});function refreshFavorites({isInitial:e=!1}){e||(isRefreshingFavorites.value=!0),socket.emit("get_favorites_data"),store.getters.isLoggedWithSpotify&&socket.emit("update_userSpotifyPlaylists",store.getters.getSpotifyUser.id)}function useFavorites(){return{favoriteArtists,favoriteAlbums,favoriteSpotifyPlaylists,favoritePlaylists,favoriteTracks,isRefreshingFavorites,refreshFavorites}}function setAllFavorites(e){const{tracks:a,albums:n,artists:r,playlists:i}=e;favoriteArtists.value=r,favoriteAlbums.value=n,favoritePlaylists.value=i,favoriteTracks.value=a}socket.on("updated_userFavorites",e=>{setAllFavorites(e)}),socket.on("init_favorites",e=>{setAllFavorites(e),isRefreshingFavorites.value=!1}),socket.on("updated_userSpotifyPlaylists",e=>{favoriteSpotifyPlaylists.value=e}),socket.on("updated_userSpotifyPlaylists",e=>{favoriteSpotifyPlaylists.value=e}),socket.on("updated_userPlaylists",e=>{favoritePlaylists.value=e}),socket.on("updated_userAlbums",e=>{favoriteAlbums.value=e}),socket.on("updated_userArtist",e=>{favoriteArtists.value=e}),socket.on("updated_userTracks",e=>{favoriteTracks.value=e});var script$g=defineComponent({components:{PreviewControls,CoverContainer,BaseTabs,BaseTab},setup(e,a){const n=reactive({activeTab:"playlist",tabs:["playlist","album","artist","track"]}),{favoriteArtists:r,favoriteAlbums:i,favoriteSpotifyPlaylists:s,favoritePlaylists:l,favoriteTracks:c,isRefreshingFavorites:o,refreshFavorites:d}=useFavorites(),u=computed(()=>a.refs.reloadButton);return watch(o,(f,h)=>{const m=h&&!f;if(!m)return;toast(a.root.$t("toasts.refreshFavs"),"done",!0)}),{...toRefs(n),tracks:c,albums:i,artists:r,playlists:l,spotifyPlaylists:s,refreshFavorites:d,isRefreshingFavorites:o}},computed:{activeTabEmpty(){let e=this.getActiveRelease();return e?.length===0}},methods:{playPausePreview,convertDuration,downloadAllOfType(){try{let e=this.getActiveRelease();if(this.activeTab==="track"){let a=this.getLovedTracksPlaylist();sendAddToQueue(a.link)}else sendAddToQueue(aggregateDownloadLinks(e))}catch(e){console.error(e.message)}},addToQueue(e){sendAddToQueue(e.currentTarget.dataset.link)},getActiveRelease(e=this.activeTab){let a;switch(e){case"playlist":a=this.playlists;break;case"album":a=this.albums;break;case"artist":a=this.artists;break;case"track":a=this.tracks;break}return a},getTabLength(e=this.activeTab){let a=this[`${e}s`]?.length;return a||0},getLovedTracksPlaylist(){let e=this.playlists.filter(a=>a.is_loved_track);if(e.length!==0)return e[0];throw new Error("No loved tracks playlist!")}}});const __vue_script__$g=script$g;var __vue_render__$i=function(){var e=this,a=e.$createElement,n=e._self._c||a;return n("div",[n("h1",{staticClass:"mb-8 text-5xl"},[e._v(` +`);else{const u=document.createTextNode(o),f=c.element.childNodes;f[d]&&c.element.removeChild(f[d]),f.length?c.element.insertBefore(u,f[d]):c.element.appendChild(u)}}}}var CoverContainer=__vue_normalize__$h({render:__vue_render__$h,staticRenderFns:__vue_staticRenderFns__$h},__vue_inject_styles__$h,__vue_script__$f,__vue_scope_id__$h,__vue_is_functional_template__$h,__vue_module_identifier__$a,__vue_create_injector__$a);let settingsData={},defaultSettingsData={},spotifyCredentials={};function getSettingsData(){return socket.emit("get_settings_data"),new Promise((e,a)=>{socket.on("init_settings",(n,r,i)=>{settingsData=n,defaultSettingsData=i,spotifyCredentials=r,socket.off("init_settings"),e({settingsData,defaultSettingsData,spotifyCredentials})})})}function getInitialPreviewVolume(){let e=parseInt(localStorage.getItem("previewVolume"));return isNaN(e)&&(e=80,localStorage.setItem("previewVolume",e.toString())),e}function checkInitialSlimDownloads(){return localStorage.getItem("slimDownloads")==="true"}function checkInitialSlimSidebar(){return localStorage.getItem("slimSidebar")==="true"}const state=()=>({currentCommit:null,latestCommit:null,updateAvailable:!1,deemixVersion:null,previewVolume:getInitialPreviewVolume(),hasSlimDownloads:checkInitialSlimDownloads(),hasSlimSidebar:checkInitialSlimSidebar()}),actions={setAppInfo({commit:e},a){e("SET_CURRENT_COMMIT",a.currentCommit),e("SET_LATEST_COMMIT",a.latestCommit),e("SET_UPDATE_AVAILABLE",a.updateAvailable),e("SET_DEEMIX_VERSION",a.deemixVersion)},setPreviewVolume({commit:e},a){e("SET_PREVIEW_VOLUME",a),localStorage.setItem("previewVolume",a.toString())},setSlimDownloads({commit:e},a){e("SET_SLIM_DOWNLOADS",a),localStorage.setItem("slimDownloads",a.toString())},setSlimSidebar({commit:e},a){e("SET_SLIM_SIDEBAR",a),localStorage.setItem("slimSidebar",a.toString()),Array.from(document.getElementsByClassName("toastify")).forEach(n=>{n.style.transform=`translate(${a?"3rem":"14rem"}, 0)`})}},getters={getAppInfo:e=>e,getPreviewVolume:e=>e.previewVolume,getSlimDownloads:e=>e.hasSlimDownloads,getSlimSidebar:e=>e.hasSlimSidebar},mutations={SET_CURRENT_COMMIT(e,a){e.currentCommit=a},SET_LATEST_COMMIT(e,a){e.latestCommit=a},SET_UPDATE_AVAILABLE(e,a){e.updateAvailable=a},SET_DEEMIX_VERSION(e,a){e.deemixVersion=a},SET_PREVIEW_VOLUME(e,a){e.previewVolume=a},SET_SLIM_DOWNLOADS(e,a){e.hasSlimDownloads=a},SET_SLIM_SIDEBAR(e,a){e.hasSlimSidebar=a}};var appInfo={state,getters,actions,mutations};const getDefaultState=()=>({arl:localStorage.getItem("arl")||"",status:null,user:{id:null,name:"",picture:""},spotifyUser:{id:localStorage.getItem("spotifyUser"),name:null,picture:null},clientMode:!1}),state$1=()=>getDefaultState(),actions$1={login({commit:e,dispatch:a},n){const{arl:r,user:i,status:s}=n;a("setARL",{arl:r}),e("SET_USER",i),e("SET_STATUS",s)},logout({commit:e}){localStorage.removeItem("arl"),e("RESET_LOGIN")},setARL({commit:e},a){let{arl:n,saveOnLocalStorage:r}=a;r=typeof r=="undefined"?!0:r,e("SET_ARL",n),r&&localStorage.setItem("arl",n)},removeARL({commit:e}){e("SET_ARL",""),localStorage.removeItem("arl")},setUser({commit:e},a){e("SET_USER",a)},setClientMode({commit:e},a){e("SET_CLIENT_MODE",a)}},getters$1={getARL:e=>e.arl,getUser:e=>e.user,getSpotifyUser:e=>e.spotifyUser,getClientMode:e=>e.clientMode,isLoggedIn:e=>!!e.arl,isLoggedWithSpotify:e=>!!e.spotifyUser.id},mutations$1={SET_ARL(e,a){e.arl=a},SET_STATUS(e,a){e.status=a},SET_USER(e,a){e.user=a},SET_CLIENT_MODE(e,a){e.clientMode=a},RESET_LOGIN(e){let a=e.clientMode;Object.assign(e,getDefaultState()),e.clientMode=a}};var login={state:state$1,getters:getters$1,actions:actions$1,mutations:mutations$1};const state$2=()=>({artist:"",bitrate:"",cover:"",downloaded:0,errors:[],failed:0,id:"",progress:0,silent:!0,size:0,title:"",type:"",uuid:""}),actions$2={setErrors({commit:e},a){e("SET_ERRORS",a)}},getters$2={getErrors:e=>e},mutations$2={SET_ERRORS(e,a){for(const n in e)if(e.hasOwnProperty(n)){const r=a[n];e[n]=r}}};var errors={state:state$2,getters:getters$2,actions:actions$2,mutations:mutations$2};Vue.use(index$2);var store=new index$2.Store({modules:{appInfo,login,errors},strict:!1});const favoriteArtists=ref$2([]),favoriteAlbums=ref$2([]),favoriteSpotifyPlaylists=ref$2([]),favoritePlaylists=ref$2([]),favoriteTracks=ref$2([]),isRefreshingFavorites=ref$2(!1);store.getters.isLoggedIn&&refreshFavorites({isInitial:!0});function refreshFavorites({isInitial:e=!1}){e||(isRefreshingFavorites.value=!0),socket.emit("get_favorites_data"),store.getters.isLoggedWithSpotify&&socket.emit("update_userSpotifyPlaylists",store.getters.getSpotifyUser.id)}function useFavorites(){return{favoriteArtists,favoriteAlbums,favoriteSpotifyPlaylists,favoritePlaylists,favoriteTracks,isRefreshingFavorites,refreshFavorites}}function setAllFavorites(e){const{tracks:a,albums:n,artists:r,playlists:i}=e;favoriteArtists.value=r,favoriteAlbums.value=n,favoritePlaylists.value=i,favoriteTracks.value=a}socket.on("updated_userFavorites",e=>{setAllFavorites(e)}),socket.on("init_favorites",e=>{setAllFavorites(e),isRefreshingFavorites.value=!1}),socket.on("updated_userSpotifyPlaylists",e=>{favoriteSpotifyPlaylists.value=e}),socket.on("updated_userSpotifyPlaylists",e=>{favoriteSpotifyPlaylists.value=e}),socket.on("updated_userPlaylists",e=>{favoritePlaylists.value=e}),socket.on("updated_userAlbums",e=>{favoriteAlbums.value=e}),socket.on("updated_userArtist",e=>{favoriteArtists.value=e}),socket.on("updated_userTracks",e=>{favoriteTracks.value=e});var script$g=defineComponent({components:{PreviewControls,CoverContainer,BaseTabs,BaseTab},setup(e,a){const n=reactive({activeTab:"playlist",tabs:["playlist","album","artist","track"]}),{favoriteArtists:r,favoriteAlbums:i,favoriteSpotifyPlaylists:s,favoritePlaylists:l,favoriteTracks:c,isRefreshingFavorites:o,refreshFavorites:d}=useFavorites(),u=computed(()=>a.refs.reloadButton);return watch(o,(f,h)=>{const m=h&&!f;if(!m)return;toast(a.root.$t("toasts.refreshFavs"),"done",!0)}),{...toRefs(n),tracks:c,albums:i,artists:r,playlists:l,spotifyPlaylists:s,refreshFavorites:d,isRefreshingFavorites:o}},computed:{activeTabEmpty(){let e=this.getActiveRelease();return e?.length===0}},methods:{playPausePreview,convertDuration,downloadAllOfType(){try{let e=this.getActiveRelease();if(this.activeTab==="track"){let a=this.getLovedTracksPlaylist();sendAddToQueue(a.link)}else sendAddToQueue(aggregateDownloadLinks(e))}catch(e){console.error(e.message)}},addToQueue(e){sendAddToQueue(e.currentTarget.dataset.link)},getActiveRelease(e=this.activeTab){let a;switch(e){case"playlist":a=this.playlists;break;case"album":a=this.albums;break;case"artist":a=this.artists;break;case"track":a=this.tracks;break}return a},getTabLength(e=this.activeTab){let a=this[`${e}s`]?.length;return a||0},getLovedTracksPlaylist(){let e=this.playlists.filter(a=>a.is_loved_track);if(e.length!==0)return e[0];throw new Error("No loved tracks playlist!")}}});const __vue_script__$g=script$g;var __vue_render__$i=function(){var e=this,a=e.$createElement,n=e._self._c||a;return n("div",[n("h1",{staticClass:"mb-8 text-5xl"},[e._v(` `+e._s(e.$t("favorites.title"))+` `),n("div",{ref:"reloadButton",staticClass:"inline-block clickable",attrs:{role:"button","aria-label":"reload"},on:{click:e.refreshFavorites}},[n("i",{staticClass:"material-icons",class:{spin:e.isRefreshingFavorites}},[e._v("sync")])])]),e._v(" "),n("BaseTabs",e._l(e.tabs,function(r){return n("BaseTab",{key:r,class:{active:e.activeTab===r},on:{click:function(i){e.activeTab=r}}},[e._v(` `+e._s(e.$tc("globals.listTabs."+r,2))+` diff --git a/src/utils/socket.js b/src/utils/socket.js index e4e4ae1..285ec99 100644 --- a/src/utils/socket.js +++ b/src/utils/socket.js @@ -1,5 +1,3 @@ -import store from '@/store' - let wasEventListenerAdded = false class CustomSocket extends WebSocket { @@ -8,7 +6,8 @@ class CustomSocket extends WebSocket { } emit(key, data) { if (this.readyState !== WebSocket.OPEN) return false - this.send(JSON.stringify({ key: key, data: data })) + + this.send(JSON.stringify({ key, data })) } on(key, cb) { if (!wasEventListenerAdded) {