var firebaseConfig={apiKey:"AIzaSyBPzXE07eBFKBtYI7Wz6Rc9a8gZg6tXdDA",authDomain:"bajaomusic-bf027.firebaseapp.com",databaseURL:"https://bajaomusic-bf027.firebaseio.com",projectId:"bajaomusic-bf027",storageBucket:"bajaomusic-bf027.appspot.com",messagingSenderId:"992465485198",appId:"1:992465485198:web:c95e988b1cc296a5ff38df",measurementId:"G-4JGGKSBQDG"};function resetUI(){clearMessages(),messaging.getToken().then(e=>{e?sendTokenToServer(e):(console.log("No Instance ID token available. Request permission to generate one."),setTokenSentToServer(!1))}).catch(e=>{console.log("An error occurred while retrieving token. ",e),setTokenSentToServer(!1)})}function showToken(e){}function sendTokenToServer(e){isTokenSentToServer()?console.log("Token already sent to server so won't send it again unless it changes"):(console.log("Sending token to server..."),$.ajax({type:"POST",data:"token="+e,url:"/api/user/setToken",dataType:"json"}),setTokenSentToServer(!0))}function isTokenSentToServer(){return"1"===window.localStorage.getItem("sentToServer")}function setTokenSentToServer(e){window.localStorage.setItem("sentToServer",e?"1":"0")}function showHideDiv(e,t){let n=document.querySelector("#"+e);t?n.style="display: visible":n.style="display: none"}function requestPermission(){console.log("Requesting permission..."),Notification.requestPermission().then(e=>{"granted"===e?(console.log("Notification permission granted."),resetUI()):console.log("Unable to get permission to notify.")})}function deleteToken(){messaging.getToken().then(e=>{messaging.deleteToken(e).then(()=>{console.log("Token deleted."),setTokenSentToServer(!1)}).catch(e=>{console.log("Unable to delete token. ",e)})}).catch(e=>{console.log("Error retrieving Instance ID token. ",e),showToken("Error retrieving Instance ID token. ",e)})}function appendMessage(e){console.log("onMessage",e)}function clearMessages(){}function updateUIForPushEnabled(e){}function updateUIForPushPermissionRequired(){}firebase.initializeApp(firebaseConfig),(messaging=firebase.messaging()).usePublicVapidKey("BGC1EjHAFNuvB03466W6KJwRwYv0NsvJlnUqtNcV4150PYa0IVTpnb9xqGliA8Y8_Xnugn7Nuf_RJtwVRSM8Jbo"),messaging.requestPermission().then(function(e){resetUI()}).catch(function(e){console.log("error",e)}),messaging.onTokenRefresh(()=>{messaging.getToken().then(e=>{console.log("Token refreshed."),setTokenSentToServer(!1),sendTokenToServer(e),resetUI()}).catch(e=>{console.log("Unable to retrieve refreshed token ",e),showToken("Unable to retrieve refreshed token ",e)})}),messaging.onMessage(e=>{console.log("Message received. ",e),appendMessage(e);var t={};t.contentId=e.data.content,t.albumId=e.data.album,t.videoId=e.data.video,t.artistId=e.data.artist,t.playlistId=e.data.playlist,t.contentTitle=e.data.title,t.thumbnail=e.data.thumbnail,displayFCMMessageNoty(e.data.body,!1,4e3,"Notification",t)});