From c6a2f35fbfc1e7e1e60357f68996a62395a22a8a Mon Sep 17 00:00:00 2001 From: RemixDev Date: Mon, 1 Mar 2021 00:01:50 +0100 Subject: [PATCH] Fixed search and websocket debug --- public/js/bundle.js | 14 +++++++------- src/use/main-search.js | 9 +++------ src/use/search.js | 10 +++------- src/utils/downloads.js | 4 ++-- src/utils/socket.js | 1 + 5 files changed, 16 insertions(+), 22 deletions(-) diff --git a/public/js/bundle.js b/public/js/bundle.js index 698e08b..9065844 100644 --- a/public/js/bundle.js +++ b/public/js/bundle.js @@ -2495,10 +2495,10 @@ a { * vuex v3.6.2 * (c) 2021 Evan You * @license MIT - */function applyMixin(e){var a=Number(e.version.split(".")[0]);if(a>=2)e.mixin({beforeCreate:i});else{var n=e.prototype._init;e.prototype._init=function(r){r===void 0&&(r={}),r.init=r.init?[i].concat(r.init):i,n.call(this,r)}}function i(){var r=this.$options;r.store?this.$store=typeof r.store=="function"?r.store():r.store:r.parent&&r.parent.$store&&(this.$store=r.parent.$store)}}var target$2=typeof window!="undefined"?window:typeof global!="undefined"?global:{},devtoolHook=target$2.__VUE_DEVTOOLS_GLOBAL_HOOK__;function devtoolPlugin(e){!devtoolHook||(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(r){return r.original===e});if(n)return n.copy;var i=Array.isArray(e)?[]:{};return a.push({original:e,copy:i}),Object.keys(e).forEach(function(r){i[r]=deepCopy(e[r],a)}),i}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 i=a.state;this.state=(typeof i=="function"?i():i)||{}},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,i){return n.getChild(i)},this.root)},ModuleCollection.prototype.getNamespace=function(a){var n=this.root;return a.reduce(function(i,r){return n=n.getChild(r),i+(n.namespaced?r+"/":"")},"")},ModuleCollection.prototype.update=function(a){update([],this.root,a)},ModuleCollection.prototype.register=function(a,n,i){var r=this;i===void 0&&(i=!0);var s=new Module(n,i);if(a.length===0)this.root=s;else{var o=this.get(a.slice(0,-1));o.addChild(a[a.length-1],s)}n.modules&&forEachValue(n.modules,function(l,c){r.register(a.concat(c),l,i)})},ModuleCollection.prototype.unregister=function(a){var n=this.get(a.slice(0,-1)),i=a[a.length-1],r=n.getChild(i);!r||!r.runtime||n.removeChild(i)},ModuleCollection.prototype.isRegistered=function(a){var n=this.get(a.slice(0,-1)),i=a[a.length-1];return n?n.hasChild(i):!1};function update(e,a,n){if(a.update(n),n.modules)for(var i in n.modules){if(!a.getChild(i))return;update(e.concat(i),a.getChild(i),n.modules[i])}}var Vue$1,Store=function(a){var n=this;a===void 0&&(a={}),!Vue$1&&typeof window!="undefined"&&window.Vue&&install(window.Vue);var i=a.plugins;i===void 0&&(i=[]);var r=a.strict;r===void 0&&(r=!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,o=this,l=o.dispatch,c=o.commit;this.dispatch=function(h,m){return l.call(s,h,m)},this.commit=function(h,m,v){return c.call(s,h,m,v)},this.strict=r;var u=this._modules.root.state;installModule(this,u,[],this._modules.root),resetStoreVM(this,u),i.forEach(function(f){return f(n)});var d=a.devtools!==void 0?a.devtools:Vue$1.config.devtools;d&&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,i){var r=this,s=unifyObjectStyle(a,n,i),o=s.type,l=s.payload,c={type:o,payload:l},u=this._mutations[o];!u||(this._withCommit(function(){u.forEach(function(f){f(l)})}),this._subscribers.slice().forEach(function(d){return d(c,r.state)}))},Store.prototype.dispatch=function(a,n){var i=this,r=unifyObjectStyle(a,n),s=r.type,o=r.payload,l={type:s,payload:o},c=this._actions[s];if(!!c){try{this._actionSubscribers.slice().filter(function(d){return d.before}).forEach(function(d){return d.before(l,i.state)})}catch(d){}var u=c.length>1?Promise.all(c.map(function(d){return d(o)})):c[0](o);return new Promise(function(d,f){u.then(function(h){try{i._actionSubscribers.filter(function(m){return m.after}).forEach(function(m){return m.after(l,i.state)})}catch(m){}d(h)},function(h){try{i._actionSubscribers.filter(function(m){return m.error}).forEach(function(m){return m.error(l,i.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 i=typeof a=="function"?{before:a}:a;return genericSubscribe(i,this._actionSubscribers,n)},Store.prototype.watch=function(a,n,i){var r=this;return this._watcherVM.$watch(function(){return a(r.state,r.getters)},n,i)},Store.prototype.replaceState=function(a){var n=this;this._withCommit(function(){n._vm._data.$$state=a})},Store.prototype.registerModule=function(a,n,i){i===void 0&&(i={}),typeof a=="string"&&(a=[a]),this._modules.register(a,n),installModule(this,this.state,a,this._modules.get(a),i.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 i=getNestedState(n.state,a.slice(0,-1));Vue$1.delete(i,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 i=a.indexOf(e);i>-1&&a.splice(i,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 i=e._vm;e.getters={},e._makeLocalGettersCache=Object.create(null);var r=e._wrappedGetters,s={};forEachValue(r,function(l,c){s[c]=partial(l,e),Object.defineProperty(e.getters,c,{get:function(){return e._vm[c]},enumerable:!0})});var o=Vue$1.config.silent;Vue$1.config.silent=!0,e._vm=new Vue$1({data:{$$state:a},computed:s}),Vue$1.config.silent=o,e.strict&&enableStrictMode(e),i&&(n&&e._withCommit(function(){i._data.$$state=null}),Vue$1.nextTick(function(){return i.$destroy()}))}function installModule(e,a,n,i,r){var s=!n.length,o=e._modules.getNamespace(n);if(i.namespaced&&(e._modulesNamespaceMap[o],e._modulesNamespaceMap[o]=i),!s&&!r){var l=getNestedState(a,n.slice(0,-1)),c=n[n.length-1];e._withCommit(function(){Vue$1.set(l,c,i.state)})}var u=i.context=makeLocalContext(e,o,n);i.forEachMutation(function(d,f){var h=o+f;registerMutation(e,h,d,u)}),i.forEachAction(function(d,f){var h=d.root?f:o+f,m=d.handler||d;registerAction(e,h,m,u)}),i.forEachGetter(function(d,f){var h=o+f;registerGetter(e,h,d,u)}),i.forEachChild(function(d,f){installModule(e,a,n.concat(f),d,r)})}function makeLocalContext(e,a,n){var i=a==="",r={dispatch:i?e.dispatch:function(s,o,l){var c=unifyObjectStyle(s,o,l),u=c.payload,d=c.options,f=c.type;return(!d||!d.root)&&(f=a+f),e.dispatch(f,u)},commit:i?e.commit:function(s,o,l){var c=unifyObjectStyle(s,o,l),u=c.payload,d=c.options,f=c.type;(!d||!d.root)&&(f=a+f),e.commit(f,u,d)}};return Object.defineProperties(r,{getters:{get:i?function(){return e.getters}:function(){return makeLocalGetters(e,a)}},state:{get:function(){return getNestedState(e.state,n)}}}),r}function makeLocalGetters(e,a){if(!e._makeLocalGettersCache[a]){var n={},i=a.length;Object.keys(e.getters).forEach(function(r){if(r.slice(0,i)===a){var s=r.slice(i);Object.defineProperty(n,s,{get:function(){return e.getters[r]},enumerable:!0})}}),e._makeLocalGettersCache[a]=n}return e._makeLocalGettersCache[a]}function registerMutation(e,a,n,i){var r=e._mutations[a]||(e._mutations[a]=[]);r.push(function(o){n.call(e,i.state,o)})}function registerAction(e,a,n,i){var r=e._actions[a]||(e._actions[a]=[]);r.push(function(o){var l=n.call(e,{dispatch:i.dispatch,commit:i.commit,getters:i.getters,state:i.state,rootGetters:e.getters,rootState:e.state},o);return isPromise$1(l)||(l=Promise.resolve(l)),e._devtoolHook?l.catch(function(c){throw e._devtoolHook.emit("vuex:error",c),c}):l})}function registerGetter(e,a,n,i){e._wrappedGetters[a]||(e._wrappedGetters[a]=function(s){return n(i.state,i.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,i){return n[i]},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){Vue$1&&e===Vue$1||(Vue$1=e,applyMixin(Vue$1))}var mapState=normalizeNamespace(function(e,a){var n={};return normalizeMap(a).forEach(function(i){var r=i.key,s=i.val;n[r]=function(){var l=this.$store.state,c=this.$store.getters;if(e){var u=getModuleByNamespace(this.$store,"mapState",e);if(!u)return;l=u.context.state,c=u.context.getters}return typeof s=="function"?s.call(this,l,c):l[s]},n[r].vuex=!0}),n}),mapMutations=normalizeNamespace(function(e,a){var n={};return normalizeMap(a).forEach(function(i){var r=i.key,s=i.val;n[r]=function(){for(var l=[],c=arguments.length;c--;)l[c]=arguments[c];var u=this.$store.commit;if(e){var d=getModuleByNamespace(this.$store,"mapMutations",e);if(!d)return;u=d.context.commit}return typeof s=="function"?s.apply(this,[u].concat(l)):u.apply(this.$store,[s].concat(l))}}),n}),mapGetters=normalizeNamespace(function(e,a){var n={};return normalizeMap(a).forEach(function(i){var r=i.key,s=i.val;s=e+s,n[r]=function(){if(!(e&&!getModuleByNamespace(this.$store,"mapGetters",e)))return this.$store.getters[s]},n[r].vuex=!0}),n}),mapActions=normalizeNamespace(function(e,a){var n={};return normalizeMap(a).forEach(function(i){var r=i.key,s=i.val;n[r]=function(){for(var l=[],c=arguments.length;c--;)l[c]=arguments[c];var u=this.$store.dispatch;if(e){var d=getModuleByNamespace(this.$store,"mapActions",e);if(!d)return;u=d.context.dispatch}return typeof s=="function"?s.apply(this,[u].concat(l)):u.apply(this.$store,[s].concat(l))}}),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 i=e._modulesNamespaceMap[n];return i}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(d,f,h){return!0});var i=e.transformer;i===void 0&&(i=function(d){return d});var r=e.mutationTransformer;r===void 0&&(r=function(d){return d});var s=e.actionFilter;s===void 0&&(s=function(d,f){return!0});var o=e.actionTransformer;o===void 0&&(o=function(d){return d});var l=e.logMutations;l===void 0&&(l=!0);var c=e.logActions;c===void 0&&(c=!0);var u=e.logger;return u===void 0&&(u=console),function(d){var f=deepCopy(d.state);typeof u!="undefined"&&(l&&d.subscribe(function(h,m){var v=deepCopy(m);if(n(h,f,v)){var y=getFormattedTime(),_=r(h),w="mutation "+h.type+y;startMessage(u,w,a),u.log("%c prev state","color: #9E9E9E; font-weight: bold",i(f)),u.log("%c mutation","color: #03A9F4; font-weight: bold",_),u.log("%c next state","color: #4CAF50; font-weight: bold",i(v)),endMessage(u)}f=v}),c&&d.subscribeAction(function(h,m){if(s(h,m)){var v=getFormattedTime(),y=o(h),_="action "+h.type+v;startMessage(u,_,a),u.log("%c action","color: #03A9F4; font-weight: bold",y),endMessage(u)}}))}}function startMessage(e,a,n){var i=n?e.groupCollapsed:e.group;try{i.call(e,a)}catch(r){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.2",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,i,r)=>{settingsData=n,defaultSettingsData=r,spotifyCredentials=i,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:i,user:r,status:s}=n;a("setARL",{arl:i}),e("SET_USER",r),e("SET_STATUS",s)},logout({commit:e}){localStorage.removeItem("arl"),e("RESET_LOGIN")},setARL({commit:e},a){let{arl:n,saveOnLocalStorage:i}=a;i=typeof i=="undefined"?!0:i,e("SET_ARL",n),i&&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 i=a[n];e[n]=i}}};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});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){this.addEventListener("message",function(i){let r=JSON.parse(i.data);r.key==a&&n(r.data)})}}const socket=new CustomSocket("ws://"+location.host+"/");function normalizeComponent(e,a,n,i,r,s,o,l,c,u){typeof o!="boolean"&&(c=l,l=o,o=!1);var d=typeof n=="function"?n.options:n;e&&e.render&&(d.render=e.render,d.staticRenderFns=e.staticRenderFns,d._compiled=!0,r&&(d.functional=!0)),i&&(d._scopeId=i);var f;if(s?(f=function(y){y=y||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,!y&&typeof __VUE_SSR_CONTEXT__!="undefined"&&(y=__VUE_SSR_CONTEXT__),a&&a.call(this,c(y)),y&&y._registeredComponents&&y._registeredComponents.add(s)},d._ssrRegister=f):a&&(f=o?function(){a.call(this,u(this.$root.$options.shadowRoot))}:function(v){a.call(this,l(v))}),f)if(d.functional){var h=d.render;d.render=function(y,_){return f.call(_),h(y,_)}}else{var m=d.beforeCreate;d.beforeCreate=m?[].concat(m,f):[f]}return n}var normalizeComponent_1=normalizeComponent,isOldIE=typeof navigator!="undefined"&&/msie [6-9]\\b/.test(navigator.userAgent.toLowerCase());function createInjector(e){return function(a,n){return addStyle(a,n)}}var HEAD=document.head||document.getElementsByTagName("head")[0],styles={};function addStyle(e,a){var n=isOldIE?a.media||"default":e,i=styles[n]||(styles[n]={ids:new Set,styles:[]});if(!i.ids.has(e)){i.ids.add(e);var r=a.source;if(a.map&&(r+=` + */function applyMixin(e){var a=Number(e.version.split(".")[0]);if(a>=2)e.mixin({beforeCreate:i});else{var n=e.prototype._init;e.prototype._init=function(r){r===void 0&&(r={}),r.init=r.init?[i].concat(r.init):i,n.call(this,r)}}function i(){var r=this.$options;r.store?this.$store=typeof r.store=="function"?r.store():r.store:r.parent&&r.parent.$store&&(this.$store=r.parent.$store)}}var target$2=typeof window!="undefined"?window:typeof global!="undefined"?global:{},devtoolHook=target$2.__VUE_DEVTOOLS_GLOBAL_HOOK__;function devtoolPlugin(e){!devtoolHook||(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(r){return r.original===e});if(n)return n.copy;var i=Array.isArray(e)?[]:{};return a.push({original:e,copy:i}),Object.keys(e).forEach(function(r){i[r]=deepCopy(e[r],a)}),i}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 i=a.state;this.state=(typeof i=="function"?i():i)||{}},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,i){return n.getChild(i)},this.root)},ModuleCollection.prototype.getNamespace=function(a){var n=this.root;return a.reduce(function(i,r){return n=n.getChild(r),i+(n.namespaced?r+"/":"")},"")},ModuleCollection.prototype.update=function(a){update([],this.root,a)},ModuleCollection.prototype.register=function(a,n,i){var r=this;i===void 0&&(i=!0);var s=new Module(n,i);if(a.length===0)this.root=s;else{var o=this.get(a.slice(0,-1));o.addChild(a[a.length-1],s)}n.modules&&forEachValue(n.modules,function(l,c){r.register(a.concat(c),l,i)})},ModuleCollection.prototype.unregister=function(a){var n=this.get(a.slice(0,-1)),i=a[a.length-1],r=n.getChild(i);!r||!r.runtime||n.removeChild(i)},ModuleCollection.prototype.isRegistered=function(a){var n=this.get(a.slice(0,-1)),i=a[a.length-1];return n?n.hasChild(i):!1};function update(e,a,n){if(a.update(n),n.modules)for(var i in n.modules){if(!a.getChild(i))return;update(e.concat(i),a.getChild(i),n.modules[i])}}var Vue$1,Store=function(a){var n=this;a===void 0&&(a={}),!Vue$1&&typeof window!="undefined"&&window.Vue&&install(window.Vue);var i=a.plugins;i===void 0&&(i=[]);var r=a.strict;r===void 0&&(r=!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,o=this,l=o.dispatch,c=o.commit;this.dispatch=function(h,m){return l.call(s,h,m)},this.commit=function(h,m,v){return c.call(s,h,m,v)},this.strict=r;var u=this._modules.root.state;installModule(this,u,[],this._modules.root),resetStoreVM(this,u),i.forEach(function(f){return f(n)});var d=a.devtools!==void 0?a.devtools:Vue$1.config.devtools;d&&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,i){var r=this,s=unifyObjectStyle(a,n,i),o=s.type,l=s.payload,c={type:o,payload:l},u=this._mutations[o];!u||(this._withCommit(function(){u.forEach(function(f){f(l)})}),this._subscribers.slice().forEach(function(d){return d(c,r.state)}))},Store.prototype.dispatch=function(a,n){var i=this,r=unifyObjectStyle(a,n),s=r.type,o=r.payload,l={type:s,payload:o},c=this._actions[s];if(!!c){try{this._actionSubscribers.slice().filter(function(d){return d.before}).forEach(function(d){return d.before(l,i.state)})}catch(d){}var u=c.length>1?Promise.all(c.map(function(d){return d(o)})):c[0](o);return new Promise(function(d,f){u.then(function(h){try{i._actionSubscribers.filter(function(m){return m.after}).forEach(function(m){return m.after(l,i.state)})}catch(m){}d(h)},function(h){try{i._actionSubscribers.filter(function(m){return m.error}).forEach(function(m){return m.error(l,i.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 i=typeof a=="function"?{before:a}:a;return genericSubscribe(i,this._actionSubscribers,n)},Store.prototype.watch=function(a,n,i){var r=this;return this._watcherVM.$watch(function(){return a(r.state,r.getters)},n,i)},Store.prototype.replaceState=function(a){var n=this;this._withCommit(function(){n._vm._data.$$state=a})},Store.prototype.registerModule=function(a,n,i){i===void 0&&(i={}),typeof a=="string"&&(a=[a]),this._modules.register(a,n),installModule(this,this.state,a,this._modules.get(a),i.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 i=getNestedState(n.state,a.slice(0,-1));Vue$1.delete(i,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 i=a.indexOf(e);i>-1&&a.splice(i,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 i=e._vm;e.getters={},e._makeLocalGettersCache=Object.create(null);var r=e._wrappedGetters,s={};forEachValue(r,function(l,c){s[c]=partial(l,e),Object.defineProperty(e.getters,c,{get:function(){return e._vm[c]},enumerable:!0})});var o=Vue$1.config.silent;Vue$1.config.silent=!0,e._vm=new Vue$1({data:{$$state:a},computed:s}),Vue$1.config.silent=o,e.strict&&enableStrictMode(e),i&&(n&&e._withCommit(function(){i._data.$$state=null}),Vue$1.nextTick(function(){return i.$destroy()}))}function installModule(e,a,n,i,r){var s=!n.length,o=e._modules.getNamespace(n);if(i.namespaced&&(e._modulesNamespaceMap[o],e._modulesNamespaceMap[o]=i),!s&&!r){var l=getNestedState(a,n.slice(0,-1)),c=n[n.length-1];e._withCommit(function(){Vue$1.set(l,c,i.state)})}var u=i.context=makeLocalContext(e,o,n);i.forEachMutation(function(d,f){var h=o+f;registerMutation(e,h,d,u)}),i.forEachAction(function(d,f){var h=d.root?f:o+f,m=d.handler||d;registerAction(e,h,m,u)}),i.forEachGetter(function(d,f){var h=o+f;registerGetter(e,h,d,u)}),i.forEachChild(function(d,f){installModule(e,a,n.concat(f),d,r)})}function makeLocalContext(e,a,n){var i=a==="",r={dispatch:i?e.dispatch:function(s,o,l){var c=unifyObjectStyle(s,o,l),u=c.payload,d=c.options,f=c.type;return(!d||!d.root)&&(f=a+f),e.dispatch(f,u)},commit:i?e.commit:function(s,o,l){var c=unifyObjectStyle(s,o,l),u=c.payload,d=c.options,f=c.type;(!d||!d.root)&&(f=a+f),e.commit(f,u,d)}};return Object.defineProperties(r,{getters:{get:i?function(){return e.getters}:function(){return makeLocalGetters(e,a)}},state:{get:function(){return getNestedState(e.state,n)}}}),r}function makeLocalGetters(e,a){if(!e._makeLocalGettersCache[a]){var n={},i=a.length;Object.keys(e.getters).forEach(function(r){if(r.slice(0,i)===a){var s=r.slice(i);Object.defineProperty(n,s,{get:function(){return e.getters[r]},enumerable:!0})}}),e._makeLocalGettersCache[a]=n}return e._makeLocalGettersCache[a]}function registerMutation(e,a,n,i){var r=e._mutations[a]||(e._mutations[a]=[]);r.push(function(o){n.call(e,i.state,o)})}function registerAction(e,a,n,i){var r=e._actions[a]||(e._actions[a]=[]);r.push(function(o){var l=n.call(e,{dispatch:i.dispatch,commit:i.commit,getters:i.getters,state:i.state,rootGetters:e.getters,rootState:e.state},o);return isPromise$1(l)||(l=Promise.resolve(l)),e._devtoolHook?l.catch(function(c){throw e._devtoolHook.emit("vuex:error",c),c}):l})}function registerGetter(e,a,n,i){e._wrappedGetters[a]||(e._wrappedGetters[a]=function(s){return n(i.state,i.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,i){return n[i]},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){Vue$1&&e===Vue$1||(Vue$1=e,applyMixin(Vue$1))}var mapState=normalizeNamespace(function(e,a){var n={};return normalizeMap(a).forEach(function(i){var r=i.key,s=i.val;n[r]=function(){var l=this.$store.state,c=this.$store.getters;if(e){var u=getModuleByNamespace(this.$store,"mapState",e);if(!u)return;l=u.context.state,c=u.context.getters}return typeof s=="function"?s.call(this,l,c):l[s]},n[r].vuex=!0}),n}),mapMutations=normalizeNamespace(function(e,a){var n={};return normalizeMap(a).forEach(function(i){var r=i.key,s=i.val;n[r]=function(){for(var l=[],c=arguments.length;c--;)l[c]=arguments[c];var u=this.$store.commit;if(e){var d=getModuleByNamespace(this.$store,"mapMutations",e);if(!d)return;u=d.context.commit}return typeof s=="function"?s.apply(this,[u].concat(l)):u.apply(this.$store,[s].concat(l))}}),n}),mapGetters=normalizeNamespace(function(e,a){var n={};return normalizeMap(a).forEach(function(i){var r=i.key,s=i.val;s=e+s,n[r]=function(){if(!(e&&!getModuleByNamespace(this.$store,"mapGetters",e)))return this.$store.getters[s]},n[r].vuex=!0}),n}),mapActions=normalizeNamespace(function(e,a){var n={};return normalizeMap(a).forEach(function(i){var r=i.key,s=i.val;n[r]=function(){for(var l=[],c=arguments.length;c--;)l[c]=arguments[c];var u=this.$store.dispatch;if(e){var d=getModuleByNamespace(this.$store,"mapActions",e);if(!d)return;u=d.context.dispatch}return typeof s=="function"?s.apply(this,[u].concat(l)):u.apply(this.$store,[s].concat(l))}}),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 i=e._modulesNamespaceMap[n];return i}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(d,f,h){return!0});var i=e.transformer;i===void 0&&(i=function(d){return d});var r=e.mutationTransformer;r===void 0&&(r=function(d){return d});var s=e.actionFilter;s===void 0&&(s=function(d,f){return!0});var o=e.actionTransformer;o===void 0&&(o=function(d){return d});var l=e.logMutations;l===void 0&&(l=!0);var c=e.logActions;c===void 0&&(c=!0);var u=e.logger;return u===void 0&&(u=console),function(d){var f=deepCopy(d.state);typeof u!="undefined"&&(l&&d.subscribe(function(h,m){var v=deepCopy(m);if(n(h,f,v)){var y=getFormattedTime(),_=r(h),w="mutation "+h.type+y;startMessage(u,w,a),u.log("%c prev state","color: #9E9E9E; font-weight: bold",i(f)),u.log("%c mutation","color: #03A9F4; font-weight: bold",_),u.log("%c next state","color: #4CAF50; font-weight: bold",i(v)),endMessage(u)}f=v}),c&&d.subscribeAction(function(h,m){if(s(h,m)){var v=getFormattedTime(),y=o(h),_="action "+h.type+v;startMessage(u,_,a),u.log("%c action","color: #03A9F4; font-weight: bold",y),endMessage(u)}}))}}function startMessage(e,a,n){var i=n?e.groupCollapsed:e.group;try{i.call(e,a)}catch(r){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.2",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,i,r)=>{settingsData=n,defaultSettingsData=r,spotifyCredentials=i,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:i,user:r,status:s}=n;a("setARL",{arl:i}),e("SET_USER",r),e("SET_STATUS",s)},logout({commit:e}){localStorage.removeItem("arl"),e("RESET_LOGIN")},setARL({commit:e},a){let{arl:n,saveOnLocalStorage:i}=a;i=typeof i=="undefined"?!0:i,e("SET_ARL",n),i&&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 i=a[n];e[n]=i}}};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});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){this.addEventListener("message",function(i){let r=JSON.parse(i.data);console.log(r),r.key==a&&n(r.data)})}}const socket=new CustomSocket("ws://"+location.host+"/");function normalizeComponent(e,a,n,i,r,s,o,l,c,u){typeof o!="boolean"&&(c=l,l=o,o=!1);var d=typeof n=="function"?n.options:n;e&&e.render&&(d.render=e.render,d.staticRenderFns=e.staticRenderFns,d._compiled=!0,r&&(d.functional=!0)),i&&(d._scopeId=i);var f;if(s?(f=function(y){y=y||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,!y&&typeof __VUE_SSR_CONTEXT__!="undefined"&&(y=__VUE_SSR_CONTEXT__),a&&a.call(this,c(y)),y&&y._registeredComponents&&y._registeredComponents.add(s)},d._ssrRegister=f):a&&(f=o?function(){a.call(this,u(this.$root.$options.shadowRoot))}:function(v){a.call(this,l(v))}),f)if(d.functional){var h=d.render;d.render=function(y,_){return f.call(_),h(y,_)}}else{var m=d.beforeCreate;d.beforeCreate=m?[].concat(m,f):[f]}return n}var normalizeComponent_1=normalizeComponent,isOldIE=typeof navigator!="undefined"&&/msie [6-9]\\b/.test(navigator.userAgent.toLowerCase());function createInjector(e){return function(a,n){return addStyle(a,n)}}var HEAD=document.head||document.getElementsByTagName("head")[0],styles={};function addStyle(e,a){var n=isOldIE?a.media||"default":e,i=styles[n]||(styles[n]={ids:new Set,styles:[]});if(!i.ids.has(e)){i.ids.add(e);var r=a.source;if(a.map&&(r+=` /*# sourceURL=`+a.map.sources[0]+" */",r+=` /*# sourceMappingURL=data:application/json;base64,`+btoa(unescape(encodeURIComponent(JSON.stringify(a.map))))+" */"),i.element||(i.element=document.createElement("style"),i.element.type="text/css",a.media&&i.element.setAttribute("media",a.media),HEAD.appendChild(i.element)),"styleSheet"in i.element)i.styles.push(r),i.element.styleSheet.cssText=i.styles.filter(Boolean).join(` -`);else{var s=i.ids.size-1,o=document.createTextNode(r),l=i.element.childNodes;l[s]&&i.element.removeChild(l[s]),l.length?i.element.insertBefore(o,l[s]):i.element.appendChild(o)}}}var browser=createInjector,__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){!e||e("data-v-07f63f2b_0",{source:".lds-ring[data-v-07f63f2b]{display:inline-block;position:relative;width:80px;height:80px}.lds-ring div[data-v-07f63f2b]{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-07f63f2b 1.2s cubic-bezier(.5,0,.5,1) infinite;border-color:#fff transparent transparent transparent}.lds-ring div[data-v-07f63f2b]:nth-child(1){animation-delay:-.45s}.lds-ring div[data-v-07f63f2b]:nth-child(2){animation-delay:-.3s}.lds-ring div[data-v-07f63f2b]:nth-child(3){animation-delay:-.15s}@keyframes lds-ring-data-v-07f63f2b{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}",map:void 0,media:void 0})},__vue_scope_id__="data-v-07f63f2b",__vue_module_identifier__=void 0,__vue_is_functional_template__=!0;var BaseLoadingPlaceholder=normalizeComponent_1({render:__vue_render__,staticRenderFns:__vue_staticRenderFns__},__vue_inject_styles__,{},__vue_scope_id__,__vue_is_functional_template__,__vue_module_identifier__,browser,void 0);function sendAddToQueue(e,a=null){if(!e)throw new Error("No URL given to sendAddToQueue function!");socket.emit("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,i;return n=Math.floor(e/60),a=Math.floor(n/60),i=e-n*60,n-=a*60,[a,n,i]}function numberWithDots(e){return e.toString().replace(/\B(?=(\d{3})+(?!\d))/g,".")}function debounce(e,a,n){var i;return function(){var r=this,s=arguments,o=function(){i=null,n||e.apply(r,s)},l=n&&!i;clearTimeout(i),i=setTimeout(o,a),l&&e.apply(r,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)?n.split(".").reduce((s,o)=>{if(s)return s[o]},e):e[n];if(typeof r!="undefined")return r}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,i)=>{e[n.objName]={label:`${this.$t("globals.download",{thing:n.label})}`,show:!1,position:a+i,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:i}=window,r=e+this.$refs.contextMenu.getBoundingClientRect().width,s=a+this.$refs.contextMenu.getBoundingClientRect().height;if(r>i){const o=r-i+15;this.xPos=`${e-o}px`}if(s>n){const o=s-n+15;this.yPos=`${a-o}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(i){return n("button",{directives:[{name:"show",rawName:"v-show",value:i.show,expression:"option.show"}],key:i.label,staticClass:"btn menu-option",on:{click:function(r){return r.preventDefault(),i.action(r)}}},[n("span",{staticClass:"menu-option__text"},[e._v(e._s(i.label))])])}),0)},__vue_staticRenderFns__$1=[];const __vue_inject_styles__$1=function(e){!e||e("data-v-17a20187_0",{source:".context-menu[data-v-17a20187]{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-17a20187]{display:flex;align-items:center;width:100%;height:40px;padding-left:10px;padding-right:10px;color:var(--foreground);cursor:pointer}.menu-option[data-v-17a20187]:hover{background:var(--table-highlight);filter:brightness(150%)}.menu-option__text[data-v-17a20187]{text-transform:capitalize}button[data-v-17a20187]{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-17a20187]:focus{outline:0}button[data-v-17a20187]:active{background-color:unset;transform:unset}button[data-v-17a20187]:hover{background:unset;border:unset}",map:void 0,media:void 0})},__vue_scope_id__$1="data-v-17a20187",__vue_module_identifier__$1=void 0,__vue_is_functional_template__$1=!1;var TheContextMenu=normalizeComponent_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,browser,void 0),EventBus=new Vue;async function adjustVolume(e,a,{duration:n=1e3,easing:i=swing,interval:r=13}={}){const s=e.volume,o=a-s;if(!o||!n||!i||!r)return e.volume=a,Promise.resolve();const l=Math.floor(n/r);let c=1;return new Promise(u=>{const d=setInterval(()=>{e.volume=s+i(c/l)*o,++c===l&&(clearInterval(d),u())},r)})}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;isFinite(e)||(e=30),!(e-this.$refs.preview.currentTime>=1)&&(this.previewStopped||(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(i=>{i.removeAttribute("playing")}),a.setAttribute("playing",!0),document.querySelectorAll(".preview_controls, .preview_playlist_controls").forEach(i=>{i.textContent="play_arrow"}),document.querySelectorAll(".preview_controls").forEach(i=>{i.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]"));e.length!==0&&(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_module_identifier__$2=void 0,__vue_is_functional_template__$2=!1;var TheTrackPreview=normalizeComponent_1({render:__vue_render__$2,staticRenderFns:__vue_staticRenderFns__$2},__vue_inject_styles__$2,__vue_script__$1,__vue_scope_id__$2,__vue_is_functional_template__$2,__vue_module_identifier__$2,void 0,void 0),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;this.$refs.modal.classList.add("animated","fadeOut"),!!a.matches(".quality-button")&&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;this.$refs.modal.classList.remove("animated",a),a!=="fadeIn"&&(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(i){return e.tryToDownloadTrack(i)}}},[n("div",{staticClass:"smallmodal-content"},[n("button",{staticClass:"btn btn-primary quality-button",attrs:{"data-quality-value":"9"}},[e._v(` +`);else{var s=i.ids.size-1,o=document.createTextNode(r),l=i.element.childNodes;l[s]&&i.element.removeChild(l[s]),l.length?i.element.insertBefore(o,l[s]):i.element.appendChild(o)}}}var browser=createInjector,__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){!e||e("data-v-07f63f2b_0",{source:".lds-ring[data-v-07f63f2b]{display:inline-block;position:relative;width:80px;height:80px}.lds-ring div[data-v-07f63f2b]{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-07f63f2b 1.2s cubic-bezier(.5,0,.5,1) infinite;border-color:#fff transparent transparent transparent}.lds-ring div[data-v-07f63f2b]:nth-child(1){animation-delay:-.45s}.lds-ring div[data-v-07f63f2b]:nth-child(2){animation-delay:-.3s}.lds-ring div[data-v-07f63f2b]:nth-child(3){animation-delay:-.15s}@keyframes lds-ring-data-v-07f63f2b{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}",map:void 0,media:void 0})},__vue_scope_id__="data-v-07f63f2b",__vue_module_identifier__=void 0,__vue_is_functional_template__=!0;var BaseLoadingPlaceholder=normalizeComponent_1({render:__vue_render__,staticRenderFns:__vue_staticRenderFns__},__vue_inject_styles__,{},__vue_scope_id__,__vue_is_functional_template__,__vue_module_identifier__,browser,void 0);const get=function(e,a){let n=`/api/${e}`;if(a){let i=Object.keys(a).map(r=>encodeURIComponent(r)+"="+encodeURIComponent(a[r])).join("&");n+="?"+i}return fetch(n).then(i=>i.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,i;return n=Math.floor(e/60),a=Math.floor(n/60),i=e-n*60,n-=a*60,[a,n,i]}function numberWithDots(e){return e.toString().replace(/\B(?=(\d{3})+(?!\d))/g,".")}function debounce(e,a,n){var i;return function(){var r=this,s=arguments,o=function(){i=null,n||e.apply(r,s)},l=n&&!i;clearTimeout(i),i=setTimeout(o,a),l&&e.apply(r,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)?n.split(".").reduce((s,o)=>{if(s)return s[o]},e):e[n];if(typeof r!="undefined")return r}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,i)=>{e[n.objName]={label:`${this.$t("globals.download",{thing:n.label})}`,show:!1,position:a+i,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:i}=window,r=e+this.$refs.contextMenu.getBoundingClientRect().width,s=a+this.$refs.contextMenu.getBoundingClientRect().height;if(r>i){const o=r-i+15;this.xPos=`${e-o}px`}if(s>n){const o=s-n+15;this.yPos=`${a-o}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(i){return n("button",{directives:[{name:"show",rawName:"v-show",value:i.show,expression:"option.show"}],key:i.label,staticClass:"btn menu-option",on:{click:function(r){return r.preventDefault(),i.action(r)}}},[n("span",{staticClass:"menu-option__text"},[e._v(e._s(i.label))])])}),0)},__vue_staticRenderFns__$1=[];const __vue_inject_styles__$1=function(e){!e||e("data-v-17a20187_0",{source:".context-menu[data-v-17a20187]{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-17a20187]{display:flex;align-items:center;width:100%;height:40px;padding-left:10px;padding-right:10px;color:var(--foreground);cursor:pointer}.menu-option[data-v-17a20187]:hover{background:var(--table-highlight);filter:brightness(150%)}.menu-option__text[data-v-17a20187]{text-transform:capitalize}button[data-v-17a20187]{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-17a20187]:focus{outline:0}button[data-v-17a20187]:active{background-color:unset;transform:unset}button[data-v-17a20187]:hover{background:unset;border:unset}",map:void 0,media:void 0})},__vue_scope_id__$1="data-v-17a20187",__vue_module_identifier__$1=void 0,__vue_is_functional_template__$1=!1;var TheContextMenu=normalizeComponent_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,browser,void 0),EventBus=new Vue;async function adjustVolume(e,a,{duration:n=1e3,easing:i=swing,interval:r=13}={}){const s=e.volume,o=a-s;if(!o||!n||!i||!r)return e.volume=a,Promise.resolve();const l=Math.floor(n/r);let c=1;return new Promise(u=>{const d=setInterval(()=>{e.volume=s+i(c/l)*o,++c===l&&(clearInterval(d),u())},r)})}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;isFinite(e)||(e=30),!(e-this.$refs.preview.currentTime>=1)&&(this.previewStopped||(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(i=>{i.removeAttribute("playing")}),a.setAttribute("playing",!0),document.querySelectorAll(".preview_controls, .preview_playlist_controls").forEach(i=>{i.textContent="play_arrow"}),document.querySelectorAll(".preview_controls").forEach(i=>{i.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]"));e.length!==0&&(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_module_identifier__$2=void 0,__vue_is_functional_template__$2=!1;var TheTrackPreview=normalizeComponent_1({render:__vue_render__$2,staticRenderFns:__vue_staticRenderFns__$2},__vue_inject_styles__$2,__vue_script__$1,__vue_scope_id__$2,__vue_is_functional_template__$2,__vue_module_identifier__$2,void 0,void 0),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;this.$refs.modal.classList.add("animated","fadeOut"),!!a.matches(".quality-button")&&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;this.$refs.modal.classList.remove("animated",a),a!=="fadeIn"&&(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(i){return e.tryToDownloadTrack(i)}}},[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"}))+` @@ -2524,7 +2524,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */var __assign=function(){return __assign=Object.assign||function(a){for(var n,i=1,r=arguments.length;i=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(a?"Object is not iterable.":"Symbol.iterator is not defined.")}function __read(e,a){var n=typeof Symbol=="function"&&e[Symbol.iterator];if(!n)return e;var i=n.call(e),r,s=[],o;try{for(;(a===void 0||a-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(l){o={error:l}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return s}function __spread(){for(var e=[],a=0;a{a!==e&&(localStorage.setItem("selectedTheme",e),document.documentElement.dataset.theme=e,animateAllElements())});function animateAllElements(){const e=document.querySelectorAll("*");e.forEach(a=>{a.classList.add("changing-theme")}),document.documentElement.addEventListener("transitionend",function a(){e.forEach(n=>{n.classList.remove("changing-theme")}),document.documentElement.removeEventListener("transitionend",a)})}const useTheme=()=>({THEMES,currentTheme});var deemixIcon=` + A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.`,e));var w=function(C,N){u(),n(C,N,c)},A=d(w);if(i.immediate){var S=A,M=function(C,N){M=S,w(C,N)};A=function(C,N){M(C,N)}}var P=e.$watch(_,A,{immediate:i.immediate,deep:y,sync:o}),z=e._watchers[e._watchers.length-1];return isReactive(z.value)&&((r=z.value.__ob__)===null||r===void 0?void 0:r.dep)&&y&&z.value.__ob__.dep.addSub({update:function(){z.run()}}),patchWatcherTeardown(z,u),function(){P()}}function watch(e,a,n){var i=null;typeof a=="function"?i=a:(n=a,i=null);var r=getWatcherOption(n),s=getWatcherVM();return createWatcher$1(s,e,i,r)}function computed(e){var a,n=(a=getCurrentInstance())===null||a===void 0?void 0:a.proxy,i,r;typeof e=="function"?i=e:(i=e.get,r=e.set);var s,o;if(n&&!n.$isServer){var l=getVueInternalClasses(),c=l.Watcher,u=l.Dep,d;o=function(){return d||(d=new c(n,i,noopFn,{lazy:!0})),d.dirty&&d.evaluate(),u.target&&d.depend(),d.value},s=function(h){r&&r(h)}}else{var f=defineComponentInstance(getVueConstructor(),{computed:{$$state:{get:i,set:r}}});n&&n.$on("hook:destroyed",function(){return f.$destroy()}),o=function(){return f.$$state},s=function(h){f.$$state=h}}return createRef({get:o,set:s})}function set$1(e,a,n){var i=e.__composition_api_state__=e.__composition_api_state__||{};i[a]=n}function get$1(e,a){return(e.__composition_api_state__||{})[a]}var vmStateManager={set:set$1,get:get$1};function asVmProperty(e,a,n){var i=e.$options.props;!(a in e)&&!(i&&hasOwn$1(i,a))&&(isRef(n)?proxy$1(e,a,{get:function(){return n.value},set:function(r){n.value=r}}):e[a]=n)}function updateTemplateRef(e){var a=vmStateManager.get(e,"rawBindings")||{};if(!(!a||!Object.keys(a).length)){for(var n=e.$refs,i=vmStateManager.get(e,"refs")||[],r=0;r{a!==e&&(localStorage.setItem("selectedTheme",e),document.documentElement.dataset.theme=e,animateAllElements())});function animateAllElements(){const e=document.querySelectorAll("*");e.forEach(a=>{a.classList.add("changing-theme")}),document.documentElement.addEventListener("transitionend",function a(){e.forEach(n=>{n.classList.remove("changing-theme")}),document.documentElement.removeEventListener("transitionend",a)})}const useTheme=()=>({THEMES,currentTheme});var deemixIcon=` @@ -2912,7 +2912,7 @@ PERFORMANCE OF THIS SOFTWARE. `)]),e._v(" "),n("p",{staticClass:"mb-2 text-base"},[e._v("For security reasons you will need to provide your own Client ID and Secret")]),e._v(" "),n("h2",{staticClass:"mt-6 text-3xl"},[e._v("How do I get my Client ID and Secret?")]),e._v(" "),e._m(0),e._v(" "),e._m(1),e._v(" "),e._m(2),e._v(" "),e._m(3),e._v(" "),n("p",{staticClass:"mb-2 text-base"},[e._v("Now you can copy-paste those results in the appropriate fields in the settings.")]),e._v(" "),n("h2",{staticClass:"mt-6 text-3xl"},[e._v("How do I get my Spotify Username?")]),e._v(" "),e._m(4)])},__vue_staticRenderFns__$c=[function(){var e=this,a=e.$createElement,n=e._self._c||a;return n("p",{staticClass:"mb-2 text-base"},[e._v("Connect to "),n("a",{attrs:{href:"https://developer.spotify.com/dashboard",target:"_blank"}},[e._v("Spotify for Developers's Dashboard")]),e._v(" and login with your Spotify account.")])},function(){var e=this,a=e.$createElement,n=e._self._c||a;return n("p",{staticClass:"mb-2 text-base"},[e._v(` Click on "Create an App".`),n("br"),e._v(" "),n("img",{attrs:{src:"https://i.imgur.com/YFz7rHj.png",alt:"Create an App button on Spotify for Developers's Dashboard"}})])},function(){var e=this,a=e.$createElement,n=e._self._c||a;return n("p",{staticClass:"mb-2 text-base"},[e._v(` Fill out the "App name" and "App description" fields and check both checkboxes. Then click on the "Create" button.`),n("br"),e._v(" "),n("img",{attrs:{src:"https://i.imgur.com/A9cvDkK.png",alt:"Create an app form"}})])},function(){var e=this,a=e.$createElement,n=e._self._c||a;return n("p",{staticClass:"mb-2 text-base"},[e._v(` - Now you can see the Client ID. If you click on "Show Client Secret" the client secret will be revealed.`),n("br"),e._v(" "),n("img",{attrs:{src:"https://i.imgur.com/foEfIhO.png",alt:"Screen of client ID and Secret"}})])},function(){var e=this,a=e.$createElement,n=e._self._c||a;return n("p",{staticClass:"mb-2 text-base"},[e._v("You can get your Spotify Username from the "),n("a",{attrs:{href:"https://www.spotify.com/it/account/overview/",target:"_blank"}},[e._v("Overview page on Spotify's Website")]),e._v(".")])}];const __vue_inject_styles__$c=void 0,__vue_scope_id__$c=void 0,__vue_module_identifier__$c=void 0,__vue_is_functional_template__$c=!1;var InfoSpotifyFeatures=normalizeComponent_1({render:__vue_render__$c,staticRenderFns:__vue_staticRenderFns__$c},__vue_inject_styles__$c,__vue_script__$a,__vue_scope_id__$c,__vue_is_functional_template__$c,__vue_module_identifier__$c,void 0,void 0),freeGlobal=typeof global=="object"&&global&&global.Object===Object&&global,freeSelf=typeof self=="object"&&self&&self.Object===Object&&self,root=freeGlobal||freeSelf||Function("return this")(),Symbol$1=root.Symbol,objectProto=Object.prototype,hasOwnProperty$2=objectProto.hasOwnProperty,nativeObjectToString=objectProto.toString,symToStringTag=Symbol$1?Symbol$1.toStringTag:void 0;function getRawTag(e){var a=hasOwnProperty$2.call(e,symToStringTag),n=e[symToStringTag];try{e[symToStringTag]=void 0;var i=!0}catch(s){}var r=nativeObjectToString.call(e);return i&&(a?e[symToStringTag]=n:delete e[symToStringTag]),r}var objectProto$1=Object.prototype,nativeObjectToString$1=objectProto$1.toString;function objectToString(e){return nativeObjectToString$1.call(e)}var nullTag="[object Null]",undefinedTag="[object Undefined]",symToStringTag$1=Symbol$1?Symbol$1.toStringTag:void 0;function baseGetTag(e){return e==null?e===void 0?undefinedTag:nullTag:symToStringTag$1&&symToStringTag$1 in Object(e)?getRawTag(e):objectToString(e)}function isObjectLike(e){return e!=null&&typeof e=="object"}var symbolTag="[object Symbol]";function isSymbol(e){return typeof e=="symbol"||isObjectLike(e)&&baseGetTag(e)==symbolTag}function arrayMap(e,a){for(var n=-1,i=e==null?0:e.length,r=Array(i);++n-1}var MAX_SAFE_INTEGER=9007199254740991,reIsUint=/^(?:0|[1-9]\d*)$/;function isIndex(e,a){var n=typeof e;return a=a??MAX_SAFE_INTEGER,!!a&&(n=="number"||n!="symbol"&&reIsUint.test(e))&&e>-1&&e%1==0&&e-1&&e%1==0&&e<=MAX_SAFE_INTEGER$1}function isArrayLike(e){return e!=null&&isLength(e.length)&&!isFunction$2(e)}var objectProto$3=Object.prototype;function isPrototype(e){var a=e&&e.constructor,n=typeof a=="function"&&a.prototype||objectProto$3;return e===n}function baseTimes(e,a){for(var n=-1,i=Array(e);++n-1}function listCacheSet(e,a){var n=this.__data__,i=assocIndexOf(n,e);return i<0?(++this.size,n.push([e,a])):n[i][1]=a,this}function ListCache(e){var a=-1,n=e==null?0:e.length;for(this.clear();++al))return!1;var u=s.get(e),d=s.get(a);if(u&&d)return u==a&&d==e;var f=-1,h=!0,m=n&COMPARE_UNORDERED_FLAG?new SetCache:void 0;for(s.set(e,a),s.set(a,e);++f=a||C<0||f&&N>=s}function w(){var z=now();if(_(z))return A(z);l=setTimeout(w,y(z))}function A(z){return l=void 0,h&&i?m(z):(i=r=void 0,o)}function S(){l!==void 0&&clearTimeout(l),u=0,i=c=r=l=void 0}function M(){return l===void 0?o:A(now())}function P(){var z=now(),C=_(z);if(i=arguments,r=this,c=z,C){if(l===void 0)return v(c);if(f)return clearTimeout(l),l=setTimeout(w,a),m(c)}return l===void 0&&(l=setTimeout(w,a)),o}return P.cancel=S,P.flush=M,P}function arrayIncludesWith(e,a,n){for(var i=-1,r=e==null?0:e.length;++ia||s&&o&&c&&!l&&!u||i&&o&&c||!n&&c||!r)return 1;if(!i&&!s&&!u&&e=l)return c;var u=n[i];return c*(u=="desc"?-1:1)}}return e.index-a.index}function baseOrderBy(e,a,n){a.length?a=arrayMap(a,function(s){return isArray$2(s)?function(o){return baseGet(o,s.length===1?s[0]:s)}:s}):a=[identity$1];var i=-1;a=arrayMap(a,baseUnary(baseIteratee));var r=baseMap(e,function(s,o,l){var c=arrayMap(a,function(u){return u(s)});return{criteria:c,index:++i,value:s}});return baseSortBy(r,function(s,o){return compareMultiple(s,o,n)})}function orderBy(e,a,n,i){return e==null?[]:(isArray$2(a)||(a=a==null?[]:[a]),n=i?void 0:n,isArray$2(n)||(n=n==null?[]:[n]),baseOrderBy(e,a,n))}var INFINITY$2=1/0,createSet=Set$1&&1/setToArray(new Set$1([,-0]))[1]==INFINITY$2?function(e){return new Set$1(e)}:noop$2,LARGE_ARRAY_SIZE$1=200;function baseUniq(e,a,n){var i=-1,r=arrayIncludes,s=e.length,o=!0,l=[],c=l;if(n)o=!1,r=arrayIncludesWith;else if(s>=LARGE_ARRAY_SIZE$1){var u=a?null:createSet(e);if(u)return setToArray(u);o=!1,r=cacheHas,c=new SetCache}else c=a?[]:l;e:for(;++i{socket.on("show_artist",i=>{socket.off("show_artist"),a(i)})})}function standardizeData(e,a){if(e.hasLoaded){const{data:n}=e,i=[];for(const r of n){let s=a(r);i.push(s)}return{data:i,hasLoaded:e.hasLoaded}}else return null}var script$b=defineComponent({components:{BaseTabs,BaseTab},setup(e,a){const n=reactive({currentTab:"",sortKey:"releaseDate",sortOrder:"desc",artistReleases:{},artistName:"",artistPicture:"",currentRelease:computed(()=>n.artistReleases[n.currentTab])}),i=computed(()=>a.root.$router.currentRoute.params.id),r=ref$2(!1);getArtistData(unref(i)).then(o=>{r.value=!0;const l={data:[o],hasLoaded:unref(r)},{data:[{artistName:c,artistPictureXL:u,artistReleases:d}]}=standardizeData(l,formatArtistData);Object.assign(n,{artistName:c,artistPicture:u,artistReleases:d,currentTab:Object.keys(d)[0]})}).catch(o=>console.error(o));const s=computed(()=>{if(!unref(r))return[];let o=n.sortKey;return o==="releaseTracksNumber"&&(o=l=>new Number(l.releaseTracksNumber)),orderBy(n.currentRelease,o,n.sortOrder)});return{...toRefs(n),downloadLink:computed(()=>`https://www.deezer.com/artist/${unref(i)}`),headerStyle:computed(()=>({backgroundImage:`linear-gradient(to bottom, transparent 0%, var(--main-background) 100%), url(${n.artistPicture})`})),sortedData:s,sendAddToQueue,checkNewRelease}},data(){const e=this.$t.bind(this),a=this.$tc.bind(this);return{head:[{title:a("globals.listTabs.title",1),sortKey:"releaseTitle"},{title:e("globals.listTabs.releaseDate"),sortKey:"releaseDate"},{title:a("globals.listTabs.track",2),sortKey:"releaseTracksNumber"},{title:"",width:null}]}},methods:{sortBy(e){e===this.sortKey?this.sortOrder=this.sortOrder==="asc"?"desc":"asc":(this.sortKey=e,this.sortOrder="asc")}}});const __vue_script__$b=script$b;var __vue_render__$d=function(){var e=this,a=e.$createElement,n=e._self._c||a;return n("div",{staticClass:"relative image-header"},[n("header",{staticClass:"flex items-center",style:e.headerStyle},[n("h1",{staticClass:"m-0"},[e._v(e._s(e.artistName))]),e._v(" "),n("div",{staticClass:"grid w-16 h-16 ml-auto rounded-full cursor-pointer bg-primary text-grayscale-870 place-items-center",attrs:{"aria-label":"download",role:"button","data-cm-link":e.downloadLink},on:{click:function(i){return i.stopPropagation(),e.sendAddToQueue(e.downloadLink)}}},[n("i",{staticClass:"text-4xl material-icons",attrs:{title:e.$t("globals.download_hint")}},[e._v("get_app")])])]),e._v(" "),n("BaseTabs",e._l(e.artistReleases,function(i,r){return n("BaseTab",{key:r,class:{active:e.currentTab===r},on:{click:function(s){e.currentTab=r}}},[e._v(` + Now you can see the Client ID. If you click on "Show Client Secret" the client secret will be revealed.`),n("br"),e._v(" "),n("img",{attrs:{src:"https://i.imgur.com/foEfIhO.png",alt:"Screen of client ID and Secret"}})])},function(){var e=this,a=e.$createElement,n=e._self._c||a;return n("p",{staticClass:"mb-2 text-base"},[e._v("You can get your Spotify Username from the "),n("a",{attrs:{href:"https://www.spotify.com/it/account/overview/",target:"_blank"}},[e._v("Overview page on Spotify's Website")]),e._v(".")])}];const __vue_inject_styles__$c=void 0,__vue_scope_id__$c=void 0,__vue_module_identifier__$c=void 0,__vue_is_functional_template__$c=!1;var InfoSpotifyFeatures=normalizeComponent_1({render:__vue_render__$c,staticRenderFns:__vue_staticRenderFns__$c},__vue_inject_styles__$c,__vue_script__$a,__vue_scope_id__$c,__vue_is_functional_template__$c,__vue_module_identifier__$c,void 0,void 0),freeGlobal=typeof global=="object"&&global&&global.Object===Object&&global,freeSelf=typeof self=="object"&&self&&self.Object===Object&&self,root=freeGlobal||freeSelf||Function("return this")(),Symbol$1=root.Symbol,objectProto=Object.prototype,hasOwnProperty$2=objectProto.hasOwnProperty,nativeObjectToString=objectProto.toString,symToStringTag=Symbol$1?Symbol$1.toStringTag:void 0;function getRawTag(e){var a=hasOwnProperty$2.call(e,symToStringTag),n=e[symToStringTag];try{e[symToStringTag]=void 0;var i=!0}catch(s){}var r=nativeObjectToString.call(e);return i&&(a?e[symToStringTag]=n:delete e[symToStringTag]),r}var objectProto$1=Object.prototype,nativeObjectToString$1=objectProto$1.toString;function objectToString(e){return nativeObjectToString$1.call(e)}var nullTag="[object Null]",undefinedTag="[object Undefined]",symToStringTag$1=Symbol$1?Symbol$1.toStringTag:void 0;function baseGetTag(e){return e==null?e===void 0?undefinedTag:nullTag:symToStringTag$1&&symToStringTag$1 in Object(e)?getRawTag(e):objectToString(e)}function isObjectLike(e){return e!=null&&typeof e=="object"}var symbolTag="[object Symbol]";function isSymbol(e){return typeof e=="symbol"||isObjectLike(e)&&baseGetTag(e)==symbolTag}function arrayMap(e,a){for(var n=-1,i=e==null?0:e.length,r=Array(i);++n-1}var MAX_SAFE_INTEGER=9007199254740991,reIsUint=/^(?:0|[1-9]\d*)$/;function isIndex(e,a){var n=typeof e;return a=a??MAX_SAFE_INTEGER,!!a&&(n=="number"||n!="symbol"&&reIsUint.test(e))&&e>-1&&e%1==0&&e-1&&e%1==0&&e<=MAX_SAFE_INTEGER$1}function isArrayLike(e){return e!=null&&isLength(e.length)&&!isFunction$2(e)}var objectProto$3=Object.prototype;function isPrototype(e){var a=e&&e.constructor,n=typeof a=="function"&&a.prototype||objectProto$3;return e===n}function baseTimes(e,a){for(var n=-1,i=Array(e);++n-1}function listCacheSet(e,a){var n=this.__data__,i=assocIndexOf(n,e);return i<0?(++this.size,n.push([e,a])):n[i][1]=a,this}function ListCache(e){var a=-1,n=e==null?0:e.length;for(this.clear();++al))return!1;var u=s.get(e),d=s.get(a);if(u&&d)return u==a&&d==e;var f=-1,h=!0,m=n&COMPARE_UNORDERED_FLAG?new SetCache:void 0;for(s.set(e,a),s.set(a,e);++f=a||C<0||f&&N>=s}function w(){var z=now();if(_(z))return A(z);l=setTimeout(w,y(z))}function A(z){return l=void 0,h&&i?m(z):(i=r=void 0,o)}function S(){l!==void 0&&clearTimeout(l),u=0,i=c=r=l=void 0}function M(){return l===void 0?o:A(now())}function P(){var z=now(),C=_(z);if(i=arguments,r=this,c=z,C){if(l===void 0)return v(c);if(f)return clearTimeout(l),l=setTimeout(w,a),m(c)}return l===void 0&&(l=setTimeout(w,a)),o}return P.cancel=S,P.flush=M,P}function arrayIncludesWith(e,a,n){for(var i=-1,r=e==null?0:e.length;++ia||s&&o&&c&&!l&&!u||i&&o&&c||!n&&c||!r)return 1;if(!i&&!s&&!u&&e=l)return c;var u=n[i];return c*(u=="desc"?-1:1)}}return e.index-a.index}function baseOrderBy(e,a,n){a.length?a=arrayMap(a,function(s){return isArray$2(s)?function(o){return baseGet(o,s.length===1?s[0]:s)}:s}):a=[identity$1];var i=-1;a=arrayMap(a,baseUnary(baseIteratee));var r=baseMap(e,function(s,o,l){var c=arrayMap(a,function(u){return u(s)});return{criteria:c,index:++i,value:s}});return baseSortBy(r,function(s,o){return compareMultiple(s,o,n)})}function orderBy(e,a,n,i){return e==null?[]:(isArray$2(a)||(a=a==null?[]:[a]),n=i?void 0:n,isArray$2(n)||(n=n==null?[]:[n]),baseOrderBy(e,a,n))}var INFINITY$2=1/0,createSet=Set$1&&1/setToArray(new Set$1([,-0]))[1]==INFINITY$2?function(e){return new Set$1(e)}:noop$2,LARGE_ARRAY_SIZE$1=200;function baseUniq(e,a,n){var i=-1,r=arrayIncludes,s=e.length,o=!0,l=[],c=l;if(n)o=!1,r=arrayIncludesWith;else if(s>=LARGE_ARRAY_SIZE$1){var u=a?null:createSet(e);if(u)return setToArray(u);o=!1,r=cacheHas,c=new SetCache}else c=a?[]:l;e:for(;++i{socket.on("show_artist",i=>{socket.off("show_artist"),a(i)})})}function standardizeData(e,a){if(e.hasLoaded){const{data:n}=e,i=[];for(const r of n){let s=a(r);i.push(s)}return{data:i,hasLoaded:e.hasLoaded}}else return null}var script$b=defineComponent({components:{BaseTabs,BaseTab},setup(e,a){const n=reactive({currentTab:"",sortKey:"releaseDate",sortOrder:"desc",artistReleases:{},artistName:"",artistPicture:"",currentRelease:computed(()=>n.artistReleases[n.currentTab])}),i=computed(()=>a.root.$router.currentRoute.params.id),r=ref$2(!1);getArtistData(unref(i)).then(o=>{r.value=!0;const l={data:[o],hasLoaded:unref(r)},{data:[{artistName:c,artistPictureXL:u,artistReleases:d}]}=standardizeData(l,formatArtistData);Object.assign(n,{artistName:c,artistPicture:u,artistReleases:d,currentTab:Object.keys(d)[0]})}).catch(o=>console.error(o));const s=computed(()=>{if(!unref(r))return[];let o=n.sortKey;return o==="releaseTracksNumber"&&(o=l=>new Number(l.releaseTracksNumber)),orderBy(n.currentRelease,o,n.sortOrder)});return{...toRefs(n),downloadLink:computed(()=>`https://www.deezer.com/artist/${unref(i)}`),headerStyle:computed(()=>({backgroundImage:`linear-gradient(to bottom, transparent 0%, var(--main-background) 100%), url(${n.artistPicture})`})),sortedData:s,sendAddToQueue,checkNewRelease}},data(){const e=this.$t.bind(this),a=this.$tc.bind(this);return{head:[{title:a("globals.listTabs.title",1),sortKey:"releaseTitle"},{title:e("globals.listTabs.releaseDate"),sortKey:"releaseDate"},{title:a("globals.listTabs.track",2),sortKey:"releaseTracksNumber"},{title:"",width:null}]}},methods:{sortBy(e){e===this.sortKey?this.sortOrder=this.sortOrder==="asc"?"desc":"asc":(this.sortKey=e,this.sortOrder="asc")}}});const __vue_script__$b=script$b;var __vue_render__$d=function(){var e=this,a=e.$createElement,n=e._self._c||a;return n("div",{staticClass:"relative image-header"},[n("header",{staticClass:"flex items-center",style:e.headerStyle},[n("h1",{staticClass:"m-0"},[e._v(e._s(e.artistName))]),e._v(" "),n("div",{staticClass:"grid w-16 h-16 ml-auto rounded-full cursor-pointer bg-primary text-grayscale-870 place-items-center",attrs:{"aria-label":"download",role:"button","data-cm-link":e.downloadLink},on:{click:function(i){return i.stopPropagation(),e.sendAddToQueue(e.downloadLink)}}},[n("i",{staticClass:"text-4xl material-icons",attrs:{title:e.$t("globals.download_hint")}},[e._v("get_app")])])]),e._v(" "),n("BaseTabs",e._l(e.artistReleases,function(i,r){return n("BaseTab",{key:r,class:{active:e.currentTab===r},on:{click:function(s){e.currentTab=r}}},[e._v(` `+e._s(e.$tc("globals.listTabs."+r,2))+` `)])}),1),e._v(" "),n("table",{staticClass:"table"},[n("thead",[n("tr",e._l(e.head,function(i){return n("th",{key:i.title,staticClass:"uppercase-first-letter",class:{"sort-asc":i.sortKey===e.sortKey&&e.sortOrder=="asc","sort-desc":i.sortKey===e.sortKey&&e.sortOrder=="desc",sortable:i.sortKey,clickable:i.sortKey},style:{width:i.width?i.width:"auto"},on:{click:function(r){i.sortKey&&e.sortBy(i.sortKey)}}},[e._v(` `+e._s(i.title)+` @@ -3010,7 +3010,7 @@ PERFORMANCE OF THIS SOFTWARE. `+e._s(e.$t("globals.by",{artist:i.artistName})+" - "+e.$tc("globals.listTabs.trackN",i.playlistTracksNumber))+` `)])],1)}),0)]],2)},__vue_staticRenderFns__$p=[];const __vue_inject_styles__$p=void 0,__vue_scope_id__$p=void 0,__vue_module_identifier__$p=void 0,__vue_is_functional_template__$p=!1;var ResultsPlaylists=normalizeComponent_1({render:__vue_render__$p,staticRenderFns:__vue_staticRenderFns__$p},__vue_inject_styles__$p,__vue_script__$n,__vue_scope_id__$p,__vue_is_functional_template__$p,__vue_module_identifier__$p,void 0,void 0),script$o={components:{TopResult,ResultsTracks,ResultsAlbums,ResultsArtists,ResultsPlaylists},props:{viewInfo:{type:Object,required:!1}},computed:{thereAreResults(){return!this.viewInfo?!1:!this.viewInfo.ORDER.every(n=>n==="TOP_RESULT"?this.viewInfo[n].length===0:this.viewInfo[n].data.length===0)}},methods:{convertDuration,upperCaseFirstLowerCaseRest,standardizeData,formatSingleTrack,formatAlbums,formatArtist,formatPlaylist,checkSectionResults(e){return e==="TOP_RESULT"?!!this.viewInfo.TOP_RESULT[0]:!!this.viewInfo[e].data[0]}}};const __vue_script__$o=script$o;var __vue_render__$q=function(){var e=this,a=e.$createElement,n=e._self._c||a;return n("section",[e.thereAreResults?e._l(e.viewInfo.ORDER,function(i){return n("section",{key:i,staticClass:"float-none py-5 border-t border-grayscale-500 first:border-t-0"},[e.checkSectionResults(i)?[n("h2",{staticClass:"mb-6 capitalize",class:{"text-4xl text-center":i==="TOP_RESULT","inline-block cursor-pointer text-3xl hover:text-primary transition-colors duration-200 ease-in-out":i!=="TOP_RESULT"},on:{click:function(r){return e.$emit("change-search-tab",i)}}},[e._v(` `+e._s(e.$tc("globals.listTabs."+i.toLowerCase(),2))+` - `)]),e._v(" "),i==="TOP_RESULT"?n("TopResult",{attrs:{info:e.viewInfo.TOP_RESULT[0]},on:{"add-to-queue":function(r){return e.$emit("add-to-queue",r)}}}):i==="TRACK"?n("ResultsTracks",{attrs:{viewInfo:e.standardizeData(e.viewInfo.TRACK,e.formatSingleTrack),itemsToShow:6},on:{"add-to-queue":function(r){return e.$emit("add-to-queue",r)}}}):i=="ALBUM"?n("ResultsAlbums",{attrs:{viewInfo:e.standardizeData(e.viewInfo.ALBUM,e.formatAlbums),itemsToShow:6},on:{"add-to-queue":function(r){return e.$emit("add-to-queue",r)}}}):i=="PLAYLIST"?n("ResultsPlaylists",{attrs:{viewInfo:e.standardizeData(e.viewInfo.PLAYLIST,e.formatPlaylist),itemsToShow:6},on:{"add-to-queue":function(r){return e.$emit("add-to-queue",r)}}}):i==="ARTIST"?n("ResultsArtists",{attrs:{viewInfo:e.standardizeData(e.viewInfo.ARTIST,e.formatArtist),itemsToShow:6},on:{"add-to-queue":function(r){return e.$emit("add-to-queue",r)}}}):e._e()]:e._e()],2)}):n("div",[n("h1",[e._v(e._s(e.$t("search.noResults")))])])],2)},__vue_staticRenderFns__$q=[];const __vue_inject_styles__$q=void 0,__vue_scope_id__$q=void 0,__vue_module_identifier__$q=void 0,__vue_is_functional_template__$q=!1;var ResultsAll=normalizeComponent_1({render:__vue_render__$q,staticRenderFns:__vue_staticRenderFns__$q},__vue_inject_styles__$q,__vue_script__$o,__vue_scope_id__$q,__vue_is_functional_template__$q,__vue_module_identifier__$q,void 0,void 0);const searchResult=ref$2({});function performMainSearch(e){socket.emit("mainSearch",{term:e}),socket.on("mainSearch",a=>{searchResult.value=a,socket.off("mainSearch")})}function useMainSearch(){return{searchResult,performMainSearch}}const result=ref$2({});function performSearch({term:e,type:a,start:n=0,nb:i=30}){socket.emit("search",{term:e,type:a,start:n,nb:i}),socket.on("search",r=>{result.value=r,socket.off("search")})}function useSearch(){return{result,performSearch}}const resetObj={data:[],next:0,total:0,hasLoaded:!1},lastTab=ref$2(null);var script$p=defineComponent({components:{BaseLoadingPlaceholder,BaseTabs,BaseTab},props:{performScrolledSearch:{type:Boolean,required:!1}},setup(e,a){const n=reactive({currentTab:{name:"",searchType:"",component:{},viewInfo:"",formatFunc:()=>{}},results:{query:"",allTab:{ORDER:[],TOP_RESULT:[],ALBUM:{hasLoaded:!1},ARTIST:{hasLoaded:!1},TRACK:{hasLoaded:!1},PLAYLIST:{hasLoaded:!1}},trackTab:{...resetObj},albumTab:{...resetObj},artistTab:{...resetObj},playlistTab:{...resetObj}},tabs:[{name:a.root.$i18n.t("globals.listTabs.all"),searchType:"all",component:ResultsAll,viewInfo:"allTab"},{name:a.root.$i18n.tc("globals.listTabs.track",2),searchType:"track",component:ResultsTracks,viewInfo:"trackTab",formatFunc:formatSingleTrack},{name:a.root.$i18n.tc("globals.listTabs.album",2),searchType:"album",component:ResultsAlbums,viewInfo:"albumTab",formatFunc:formatAlbums},{name:a.root.$i18n.tc("globals.listTabs.artist",2),searchType:"artist",component:ResultsArtists,viewInfo:"artistTab",formatFunc:formatArtist},{name:a.root.$i18n.tc("globals.listTabs.playlist",2),searchType:"playlist",component:ResultsPlaylists,viewInfo:"playlistTab",formatFunc:formatPlaylist}]}),{searchResult:i,performMainSearch:r}=useMainSearch(),{result:s,performSearch:o}=useSearch(),l=computed(()=>a.root.$route.query.term),c=computed(()=>n.results.query===""),u=ref$2(!1),d=computed(()=>Object.keys(i.value).length!==0),f=computed(()=>i.value.QUERY!==l.value);d.value&&!f.value&&onMounted(()=>{h(i.value)}),l.value&&(!d.value||f.value)&&(r(l.value),u.value=!0);function h(m){u.value=!1,n.results.query=m.QUERY,n.results.allTab=m,n.results.allTab.TRACK.hasLoaded=!0,n.results.allTab.ALBUM.hasLoaded=!0,n.results.allTab.ARTIST.hasLoaded=!0,n.results.allTab.PLAYLIST.hasLoaded=!0,lastTab.value&&lastTab.value.searchType!=="all"?(n.currentTab=lastTab.value,o({term:m.QUERY,type:n.currentTab.searchType})):n.currentTab=n.tabs.find(v=>v.searchType==="all")}return watch(i,h),watch(s,m=>{const{next:v,total:y,type:_,data:w}=m,A=`${_}Tab`;let S=y;if(v&&(S=parseInt(v.match(/index=(\d*)/)[1])),n.results[A].total!==y&&(n.results[A].total=y),n.results[A].next!==S){n.results[A].next=S;const M=n.results[A].data.concat(w),P=uniqWith(M,(z,C)=>z.id===C.id);n.results[A].data=P}n.results[A].hasLoaded=!0}),n.currentTab=n.tabs.find(m=>m.searchType==="all"),{...toRefs(n),isSearching:u,isQueryEmpty:c,searchResult:i,performMainSearch:r,performSearch:o}},computed:{loadedTabs(){const e=[];for(const a in this.results)this.results.hasOwnProperty(a)&&a!=="query"&&this.results[a].hasLoaded&&e.push(a.replace(/Tab/g,""));return e}},methods:{numberWithDots,convertDuration,addToQueue(e){sendAddToQueue(e.currentTarget.dataset.link)},getViewInfo(){return this.currentTab.searchType==="all"?this.results.allTab:standardizeData(this.results[this.currentTab.viewInfo],this.currentTab.formatFunc)},changeSearchTab(e){e=e.toLowerCase();const a=this.tabs.find(n=>n.searchType===e);if(!a){console.error(`No tab ${e} found`);return}window.scrollTo(0,0),this.currentTab=a,lastTab.value=a},scrolledSearch(){if(this.currentTab.searchType==="all")return;const e=`${this.currentTab.searchType}Tab`;this.results[e].next{searchResult.value=a})}function useMainSearch(){return{searchResult,performMainSearch}}const result=ref$2({});function performSearch({term:e,type:a,start:n=0,nb:i=30}){get("search",{term:e,type:a,start:n,nb:i}).then(r=>{result.value=r})}function useSearch(){return{result,performSearch}}const resetObj={data:[],next:0,total:0,hasLoaded:!1},lastTab=ref$2(null);var script$p=defineComponent({components:{BaseLoadingPlaceholder,BaseTabs,BaseTab},props:{performScrolledSearch:{type:Boolean,required:!1}},setup(e,a){const n=reactive({currentTab:{name:"",searchType:"",component:{},viewInfo:"",formatFunc:()=>{}},results:{query:"",allTab:{ORDER:[],TOP_RESULT:[],ALBUM:{hasLoaded:!1},ARTIST:{hasLoaded:!1},TRACK:{hasLoaded:!1},PLAYLIST:{hasLoaded:!1}},trackTab:{...resetObj},albumTab:{...resetObj},artistTab:{...resetObj},playlistTab:{...resetObj}},tabs:[{name:a.root.$i18n.t("globals.listTabs.all"),searchType:"all",component:ResultsAll,viewInfo:"allTab"},{name:a.root.$i18n.tc("globals.listTabs.track",2),searchType:"track",component:ResultsTracks,viewInfo:"trackTab",formatFunc:formatSingleTrack},{name:a.root.$i18n.tc("globals.listTabs.album",2),searchType:"album",component:ResultsAlbums,viewInfo:"albumTab",formatFunc:formatAlbums},{name:a.root.$i18n.tc("globals.listTabs.artist",2),searchType:"artist",component:ResultsArtists,viewInfo:"artistTab",formatFunc:formatArtist},{name:a.root.$i18n.tc("globals.listTabs.playlist",2),searchType:"playlist",component:ResultsPlaylists,viewInfo:"playlistTab",formatFunc:formatPlaylist}]}),{searchResult:i,performMainSearch:r}=useMainSearch(),{result:s,performSearch:o}=useSearch(),l=computed(()=>a.root.$route.query.term),c=computed(()=>n.results.query===""),u=ref$2(!1),d=computed(()=>Object.keys(i.value).length!==0),f=computed(()=>i.value.QUERY!==l.value);d.value&&!f.value&&onMounted(()=>{h(i.value)}),l.value&&(!d.value||f.value)&&(r(l.value),u.value=!0);function h(m){u.value=!1,n.results.query=m.QUERY,n.results.allTab=m,n.results.allTab.TRACK.hasLoaded=!0,n.results.allTab.ALBUM.hasLoaded=!0,n.results.allTab.ARTIST.hasLoaded=!0,n.results.allTab.PLAYLIST.hasLoaded=!0,lastTab.value&&lastTab.value.searchType!=="all"?(n.currentTab=lastTab.value,o({term:m.QUERY,type:n.currentTab.searchType})):n.currentTab=n.tabs.find(v=>v.searchType==="all")}return watch(i,h),watch(s,m=>{const{next:v,total:y,type:_,data:w}=m,A=`${_}Tab`;let S=y;if(v&&(S=parseInt(v.match(/index=(\d*)/)[1])),n.results[A].total!==y&&(n.results[A].total=y),n.results[A].next!==S){n.results[A].next=S;const M=n.results[A].data.concat(w),P=uniqWith(M,(z,C)=>z.id===C.id);n.results[A].data=P}n.results[A].hasLoaded=!0}),n.currentTab=n.tabs.find(m=>m.searchType==="all"),{...toRefs(n),isSearching:u,isQueryEmpty:c,searchResult:i,performMainSearch:r,performSearch:o}},computed:{loadedTabs(){const e=[];for(const a in this.results)this.results.hasOwnProperty(a)&&a!=="query"&&this.results[a].hasLoaded&&e.push(a.replace(/Tab/g,""));return e}},methods:{numberWithDots,convertDuration,addToQueue(e){sendAddToQueue(e.currentTarget.dataset.link)},getViewInfo(){return this.currentTab.searchType==="all"?this.results.allTab:standardizeData(this.results[this.currentTab.viewInfo],this.currentTab.formatFunc)},changeSearchTab(e){e=e.toLowerCase();const a=this.tabs.find(n=>n.searchType===e);if(!a){console.error(`No tab ${e} found`);return}window.scrollTo(0,0),this.currentTab=a,lastTab.value=a},scrolledSearch(){if(this.currentTab.searchType==="all")return;const e=`${this.currentTab.searchType}Tab`;this.results[e].next @@ -4791,5 +4791,5 @@ PERFORMANCE OF THIS SOFTWARE. `)]),e._v(" "),n("td",[e._v(e._s(i.artists[0].name))]),e._v(" "),n("td",[e._v(e._s(i.album.name))]),e._v(" "),n("td",[e._v(e._s(e.convertDuration(Math.floor(i.duration_ms/1e3))))]),e._v(" "),n("td",[n("input",{directives:[{name:"model",rawName:"v-model",value:i.selected,expression:"track.selected"}],staticClass:"clickable",attrs:{type:"checkbox"},domProps:{checked:Array.isArray(i.selected)?e._i(i.selected,null)>-1:i.selected},on:{change:function(s){var o=i.selected,l=s.target,c=!!l.checked;if(Array.isArray(o)){var u=null,d=e._i(o,u);l.checked?d<0&&e.$set(i,"selected",o.concat([u])):d>-1&&e.$set(i,"selected",o.slice(0,d).concat(o.slice(d+1)))}else e.$set(i,"selected",c)}}})])])})],2)]),e._v(" "),e.label?n("span",{staticStyle:{opacity:"0.4","margin-top":"8px",display:"inline-block","font-size":"13px"}},[e._v(e._s(e.label))]):e._e(),e._v(" "),n("footer",{staticClass:"bg-background-main"},[n("button",{staticClass:"mr-2 btn btn-primary",attrs:{"data-link":e.link},on:{click:function(i){return i.stopPropagation(),e.addToQueue(i)}}},[e._v(` `+e._s(""+e.$t("globals.download",{thing:e.$tc("globals.listTabs."+e.type,1)}))+` `)]),e._v(" "),n("button",{staticClass:"flex items-center btn btn-primary",attrs:{"data-link":e.selectedLinks()},on:{click:function(i){return i.stopPropagation(),e.addToQueue(i)}}},[e._v(` - `+e._s(e.$t("tracklist.downloadSelection"))),n("i",{staticClass:"ml-2 material-icons"},[e._v("file_download")])])])])},__vue_staticRenderFns__$v=[function(){var e=this,a=e.$createElement,n=e._self._c||a;return n("th",[n("i",{staticClass:"material-icons"},[e._v("music_note")])])},function(){var e=this,a=e.$createElement,n=e._self._c||a;return n("th",[n("i",{staticClass:"material-icons"},[e._v("timer")])])},function(){var e=this,a=e.$createElement,n=e._self._c||a;return n("td",[n("div",{staticClass:"table__cell-content table__cell-content--vertical-center",staticStyle:{opacity:"0.54"}},[n("i",{staticClass:"material-icons"},[e._v("album")])])])}];const __vue_inject_styles__$v=void 0,__vue_scope_id__$v=void 0,__vue_module_identifier__$v=void 0,__vue_is_functional_template__$v=!1;var Tracklist=normalizeComponent_1({render:__vue_render__$v,staticRenderFns:__vue_staticRenderFns__$v},__vue_inject_styles__$v,__vue_script__$t,__vue_scope_id__$v,__vue_is_functional_template__$v,__vue_module_identifier__$v,void 0,void 0);Vue.use(VueRouter);const routes=[{path:window.location.pathname,name:"Home",component:Home,meta:{notKeepAlive:!0}},{path:"/tracklist/:type/:id",name:"Tracklist",component:Tracklist},{path:"/artist/:id",name:"Artist",component:Artist,meta:{notKeepAlive:!0}},{path:"/album/:id",name:"Album",component:Tracklist},{path:"/playlist/:id",name:"Playlist",component:Tracklist},{path:"/spotify-playlist/:id",name:"Spotify Playlist",component:Tracklist},{path:"/charts",name:"Charts",component:Charts,meta:{notKeepAlive:!0}},{path:"/favorites",name:"Favorites",component:Favorites,meta:{notKeepAlive:!0}},{path:"/errors",name:"Errors",component:Errors},{path:"/link-analyzer",name:"Link Analyzer",component:LinkAnalyzer},{path:"/info-arl",name:"ARL",component:InfoArl},{path:"/info-spotify",name:"Spotify Features",component:InfoSpotifyFeatures},{path:"/settings",name:"Settings",component:Settings},{path:"/search",name:"Search",component:Search,meta:{notKeepAlive:!0}},{path:"*",component:Home}],router=new VueRouter({mode:"history",routes,scrollBehavior(e,a,n){return{x:0,y:0}}});router.beforeEach((e,a,n)=>{let i=null;switch(e.name){case"Tracklist":i={type:e.params.type,id:e.params.id};break;case"Album":i={type:"album",id:e.params.id};break;case"Playlist":i={type:"playlist",id:e.params.id};break;case"Spotify Playlist":i={type:"spotifyplaylist",id:e.params.id};break}i&&socket.emit("getTracklist",i),n()});const get$2=function(e,a){let n=`/api/${e}`;if(a){let i=Object.keys(a).map(r=>encodeURIComponent(r)+"="+encodeURIComponent(a[r])).join("&");n+="?"+i}return fetch(n).then(i=>i.json())};function startApp(){new Vue({store,router,i18n,render:e=>e(App)}).$mount("#app")}function initClient(){store.dispatch("setClientMode",!0),setClientModeKeyBindings()}document.addEventListener("DOMContentLoaded",startApp),window.addEventListener("pywebviewready",initClient),document.addEventListener("paste",e=>{if(e.target.localName==="input")return;let a=e.clipboardData.getData("Text");if(isValidURL(a))router.currentRoute.name==="Link Analyzer"?socket.emit("analyzeLink",a):(a.indexOf(` -`)!=-1&&(a=a.replace(/\n/g,";")),sendAddToQueue(a));else{let n=document.querySelector("#searchbar");n.select(),n.setSelectionRange(0,99999)}});function setClientModeKeyBindings(){document.addEventListener("keyup",e=>{e.altKey&&e.key==="ArrowLeft"&&router.back(),e.altKey&&e.key==="ArrowRight"&&router.forward()})}socket.on("message",function(e){console.log(e)});function loggedIn(e){const{status:a,user:n}=e;switch(a){case 1:case 3:toast(i18n.t("toasts.loggedIn"),"done",!0,"login-toast"),store.dispatch("login",e);break;case 2:toast(i18n.t("toasts.alreadyLogged"),"done",!0,"login-toast"),store.dispatch("setUser",n);break;case 0:toast(i18n.t("toasts.loginFailed"),"close",!0,"login-toast"),store.dispatch("removeARL");break;case-1:toast(i18n.t("toasts.deezerNotAvailable"),"close",!0,"login-toast");return}}fetch("connect").then(e=>e.json()).then(e=>{if(store.dispatch("setAppInfo",e.update),e.autologin){console.log("Autologin");let a=localStorage.getItem("arl"),n=localStorage.getItem("accountNum");if(a){a=a.trim();let i;n!=0?i=get$2("login",{arl:a,force:!0,child:n||0}):i=get$2("login",{arl:a}),i.then(loggedIn)}}}),socket.on("restoringQueue",function(){toast(i18n.t("toasts.restoringQueue"),"loading",!1,"restoring_queue")}),socket.on("cancellingCurrentItem",function(e){toast(i18n.t("toasts.cancellingCurrentItem"),"loading",!1,"cancelling_"+e)}),socket.on("currentItemCancelled",function(e){toast(i18n.t("toasts.currentItemCancelled"),"done",!0,"cancelling_"+e)}),socket.on("startAddingArtist",function(e){toast(i18n.t("toasts.startAddingArtist",{artist:e.name}),"loading",!1,"artist_"+e.id)}),socket.on("finishAddingArtist",function(e){toast(i18n.t("toasts.finishAddingArtist",{artist:e.name}),"done",!0,"artist_"+e.id)}),socket.on("startConvertingSpotifyPlaylist",function(e){toast(i18n.t("toasts.startConvertingSpotifyPlaylist"),"loading",!1,"spotifyplaylist_"+e)}),socket.on("finishConvertingSpotifyPlaylist",function(e){toast(i18n.t("toasts.finishConvertingSpotifyPlaylist"),"done",!0,"spotifyplaylist_"+e)}),socket.on("errorMessage",function(e){toast(e,"error")}),socket.on("queueError",function(e){e.errid?toast(e.link+" - "+i18n.t(`errors.ids.${e.errid}`),"error"):toast(e.link+" - "+e.error,"error")}),socket.on("alreadyInQueue",function(e){toast(i18n.t("toasts.alreadyInQueue",{item:e.title}),"playlist_add_check")}),socket.on("loginNeededToDownload",function(e){toast(i18n.t("toasts.loginNeededToDownload"),"report")}),socket.on("startGeneratingItems",function(e){toast(i18n.t("toasts.startGeneratingItems",{n:e.total}),"loading",!1,"batch_"+e.uuid)}),socket.on("finishGeneratingItems",function(e){toast(i18n.t("toasts.finishGeneratingItems",{n:e.total}),"done",!0,"batch_"+e.uuid)}); + `+e._s(e.$t("tracklist.downloadSelection"))),n("i",{staticClass:"ml-2 material-icons"},[e._v("file_download")])])])])},__vue_staticRenderFns__$v=[function(){var e=this,a=e.$createElement,n=e._self._c||a;return n("th",[n("i",{staticClass:"material-icons"},[e._v("music_note")])])},function(){var e=this,a=e.$createElement,n=e._self._c||a;return n("th",[n("i",{staticClass:"material-icons"},[e._v("timer")])])},function(){var e=this,a=e.$createElement,n=e._self._c||a;return n("td",[n("div",{staticClass:"table__cell-content table__cell-content--vertical-center",staticStyle:{opacity:"0.54"}},[n("i",{staticClass:"material-icons"},[e._v("album")])])])}];const __vue_inject_styles__$v=void 0,__vue_scope_id__$v=void 0,__vue_module_identifier__$v=void 0,__vue_is_functional_template__$v=!1;var Tracklist=normalizeComponent_1({render:__vue_render__$v,staticRenderFns:__vue_staticRenderFns__$v},__vue_inject_styles__$v,__vue_script__$t,__vue_scope_id__$v,__vue_is_functional_template__$v,__vue_module_identifier__$v,void 0,void 0);Vue.use(VueRouter);const routes=[{path:window.location.pathname,name:"Home",component:Home,meta:{notKeepAlive:!0}},{path:"/tracklist/:type/:id",name:"Tracklist",component:Tracklist},{path:"/artist/:id",name:"Artist",component:Artist,meta:{notKeepAlive:!0}},{path:"/album/:id",name:"Album",component:Tracklist},{path:"/playlist/:id",name:"Playlist",component:Tracklist},{path:"/spotify-playlist/:id",name:"Spotify Playlist",component:Tracklist},{path:"/charts",name:"Charts",component:Charts,meta:{notKeepAlive:!0}},{path:"/favorites",name:"Favorites",component:Favorites,meta:{notKeepAlive:!0}},{path:"/errors",name:"Errors",component:Errors},{path:"/link-analyzer",name:"Link Analyzer",component:LinkAnalyzer},{path:"/info-arl",name:"ARL",component:InfoArl},{path:"/info-spotify",name:"Spotify Features",component:InfoSpotifyFeatures},{path:"/settings",name:"Settings",component:Settings},{path:"/search",name:"Search",component:Search,meta:{notKeepAlive:!0}},{path:"*",component:Home}],router=new VueRouter({mode:"history",routes,scrollBehavior(e,a,n){return{x:0,y:0}}});router.beforeEach((e,a,n)=>{let i=null;switch(e.name){case"Tracklist":i={type:e.params.type,id:e.params.id};break;case"Album":i={type:"album",id:e.params.id};break;case"Playlist":i={type:"playlist",id:e.params.id};break;case"Spotify Playlist":i={type:"spotifyplaylist",id:e.params.id};break}i&&socket.emit("getTracklist",i),n()});function startApp(){new Vue({store,router,i18n,render:e=>e(App)}).$mount("#app")}function initClient(){store.dispatch("setClientMode",!0),setClientModeKeyBindings()}document.addEventListener("DOMContentLoaded",startApp),window.addEventListener("pywebviewready",initClient),document.addEventListener("paste",e=>{if(e.target.localName==="input")return;let a=e.clipboardData.getData("Text");if(isValidURL(a))router.currentRoute.name==="Link Analyzer"?socket.emit("analyzeLink",a):(a.indexOf(` +`)!=-1&&(a=a.replace(/\n/g,";")),sendAddToQueue(a));else{let n=document.querySelector("#searchbar");n.select(),n.setSelectionRange(0,99999)}});function setClientModeKeyBindings(){document.addEventListener("keyup",e=>{e.altKey&&e.key==="ArrowLeft"&&router.back(),e.altKey&&e.key==="ArrowRight"&&router.forward()})}socket.on("message",function(e){console.log(e)});function loggedIn(e){const{status:a,user:n}=e;switch(a){case 1:case 3:toast(i18n.t("toasts.loggedIn"),"done",!0,"login-toast"),store.dispatch("login",e);break;case 2:toast(i18n.t("toasts.alreadyLogged"),"done",!0,"login-toast"),store.dispatch("setUser",n);break;case 0:toast(i18n.t("toasts.loginFailed"),"close",!0,"login-toast"),store.dispatch("removeARL");break;case-1:toast(i18n.t("toasts.deezerNotAvailable"),"close",!0,"login-toast");return}}fetch("connect").then(e=>e.json()).then(e=>{if(store.dispatch("setAppInfo",e.update),e.autologin){console.log("Autologin");let a=localStorage.getItem("arl"),n=localStorage.getItem("accountNum");if(a){a=a.trim();let i;n!=0?i=get("login",{arl:a,force:!0,child:n||0}):i=get("login",{arl:a}),i.then(loggedIn)}}}),socket.on("restoringQueue",function(){toast(i18n.t("toasts.restoringQueue"),"loading",!1,"restoring_queue")}),socket.on("cancellingCurrentItem",function(e){toast(i18n.t("toasts.cancellingCurrentItem"),"loading",!1,"cancelling_"+e)}),socket.on("currentItemCancelled",function(e){toast(i18n.t("toasts.currentItemCancelled"),"done",!0,"cancelling_"+e)}),socket.on("startAddingArtist",function(e){toast(i18n.t("toasts.startAddingArtist",{artist:e.name}),"loading",!1,"artist_"+e.id)}),socket.on("finishAddingArtist",function(e){toast(i18n.t("toasts.finishAddingArtist",{artist:e.name}),"done",!0,"artist_"+e.id)}),socket.on("startConvertingSpotifyPlaylist",function(e){toast(i18n.t("toasts.startConvertingSpotifyPlaylist"),"loading",!1,"spotifyplaylist_"+e)}),socket.on("finishConvertingSpotifyPlaylist",function(e){toast(i18n.t("toasts.finishConvertingSpotifyPlaylist"),"done",!0,"spotifyplaylist_"+e)}),socket.on("errorMessage",function(e){toast(e,"error")}),socket.on("queueError",function(e){e.errid?toast(e.link+" - "+i18n.t(`errors.ids.${e.errid}`),"error"):toast(e.link+" - "+e.error,"error")}),socket.on("alreadyInQueue",function(e){toast(i18n.t("toasts.alreadyInQueue",{item:e.title}),"playlist_add_check")}),socket.on("loginNeededToDownload",function(e){toast(i18n.t("toasts.loginNeededToDownload"),"report")}),socket.on("startGeneratingItems",function(e){toast(i18n.t("toasts.startGeneratingItems",{n:e.total}),"loading",!1,"batch_"+e.uuid)}),socket.on("finishGeneratingItems",function(e){toast(i18n.t("toasts.finishGeneratingItems",{n:e.total}),"done",!0,"batch_"+e.uuid)}); diff --git a/src/use/main-search.js b/src/use/main-search.js index d46df42..e10d076 100644 --- a/src/use/main-search.js +++ b/src/use/main-search.js @@ -1,15 +1,12 @@ import { ref } from '@vue/composition-api' -import { socket } from '@/utils/socket' +import { get } from '@/utils/api' const searchResult = ref({}) function performMainSearch(searchTerm) { - socket.emit('mainSearch', { term: searchTerm }) - - socket.on('mainSearch', data => { + get('mainSearch', { term: searchTerm }) + .then(data => { searchResult.value = data - - socket.off('mainSearch') }) } diff --git a/src/use/search.js b/src/use/search.js index 7a6d8de..299dfa6 100644 --- a/src/use/search.js +++ b/src/use/search.js @@ -1,20 +1,16 @@ import { ref } from '@vue/composition-api' -import { socket } from '@/utils/socket' +import { get } from '@/utils/api' const result = ref({}) function performSearch({ term, type, start = 0, nb = 30 }) { - socket.emit('search', { + get('search', { term, type, start, nb - }) - - socket.on('search', data => { + }).then(data => { result.value = data - - socket.off('search') }) } diff --git a/src/utils/downloads.js b/src/utils/downloads.js index 6e8ab3d..f6216fe 100644 --- a/src/utils/downloads.js +++ b/src/utils/downloads.js @@ -1,4 +1,4 @@ -import { socket } from '@/utils/socket' +import { get } from '@/utils/api' /** * @param {string} url @@ -7,7 +7,7 @@ import { socket } from '@/utils/socket' export function sendAddToQueue(url, bitrate = null) { if (!url) throw new Error('No URL given to sendAddToQueue function!') - socket.emit('addToQueue', { url, bitrate }, () => {}) + get('addToQueue', { url, bitrate }) } export function aggregateDownloadLinks(releases) { diff --git a/src/utils/socket.js b/src/utils/socket.js index 225c0d8..9fc2c65 100644 --- a/src/utils/socket.js +++ b/src/utils/socket.js @@ -13,6 +13,7 @@ class CustomSocket extends WebSocket { on(key, callback) { this.addEventListener('message', function(event){ let data = JSON.parse(event.data) + console.log(data) if (data.key == key) callback(data.data) }) }