1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[405],{8581:function(e,n,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/",function(){return t(4203)}])},4203:function(e,n,t){"use strict";t.r(n),t.d(n,{__N_SSP:function(){return D},default:function(){return H}});var s=t(5893),l=t(9008),r=t(1782),i=t(3299),a=t(7294),o=t(9647),c=t(7539),u=t.n(c),d=t(4155),x=new(u())({clientId:d.env.SPOTIFY_CLIENT_ID,clientSecret:d.env.SPOTIFY_CLIENT_SECRET});var m=function(){var e=(0,i.useSession)(),n=e.data;return e.status,(0,a.useEffect)((function(){var e;"REFRESHACCESSTOKENERROR"===(null===n||void 0===n?void 0:n.error)&&(0,i.signIn)(),x.setAccessToken(null===n||void 0===n||null===(e=n.user)||void 0===e?void 0:e.accessToken)}),[n]),x},h=function(e){var n=Math.floor(e/6e4),t=(e%6e4/1e3).toFixed(0);return 60===t?n+1+":00":n+":"+(t<10?"0":"")+t};var v=function(e){var n=e.song,t=e.index,l=m(),r=(0,o.b)(),i={setCurrentSongId:r.globalFunctions.setCurrentSongId,setIsPlaying:r.globalFunctions.setIsPlaying},a=i.setCurrentSongId,c=i.setIsPlaying;return(0,s.jsxs)("div",{className:"grid grid-cols-2 text-gray-500 py-4 px-5 hover:bg-gray-800 rounded-lg cursor-pointer select-none ",onDoubleClick:function(){var e;l.getAccessToken()&&(a(null===n||void 0===n||null===(e=n.track)||void 0===e?void 0:e.id),c(!0),l.play({uris:["spotify:track:".concat(n.track.id)]}))},children:[(0,s.jsxs)("div",{className:"flex items-center space-x-4 ",children:[(0,s.jsx)("p",{children:t}),(0,s.jsx)("img",{className:"h-10 w-10",src:n.track.album.images[0].url,alt:""}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"w-36 lg:w-64 truncate text-white",children:n.track.name}),(0,s.jsx)("p",{className:"w-40",children:n.track.artists[0].name})]})]}),(0,s.jsxs)("div",{className:"flex items-center justify-between ml-auto md:ml-0",children:[(0,s.jsx)("p",{className:"w-52 hidden md:inline",children:n.track.album.name}),(0,s.jsx)("p",{children:h(n.track.duration_ms)})]})]})};var f=function(){var e,n,t=(0,o.b)().globalStates.selectedPlaylist;return(0,s.jsx)("div",{className:"px-8 flex flex-col space-y-1 pb-28 text-white",children:null===t||void 0===t||null===(e=t.tracks)||void 0===e||null===(n=e.items)||void 0===n?void 0:n.map((function(e,n){return(0,s.jsx)(v,{song:e,index:n+1},e.track.id)}))})},g=["from-indigo-500","from-yellow-500","from-purple-500","from-red-500","from-green-500","from-blue-500","from-pink-500"];var p=function(){var e,n,t,l,c=(0,o.b)(),u=m(),d={playlistId:c.globalStates.playlistId,selectedPlaylist:c.globalStates.selectedPlaylist,setSelectedPlaylist:c.globalFunctions.setSelectedPlaylist},x=d.playlistId,h=d.selectedPlaylist,v=d.setSelectedPlaylist,p=(0,i.useSession)().data,b=(0,a.useState)(null),y=b[0],j=b[1];return(0,a.useEffect)((function(){j(function(e){var n=null===e?0:e.length;return n?e[Math.floor(Math.random()*n)]:void 0}(g))}),[x]),(0,a.useEffect)((function(){u.getAccessToken()&&u.getPlaylist(x).then((function(e){v(null===e||void 0===e?void 0:e.body)})).catch((function(e){return console.log("something went wrong!!11",e)}))}),[u,x]),(0,s.jsxs)("div",{className:"flex-grow h-screen overflow-y-scroll scrollbar-hide",children:[(0,s.jsx)("header",{className:"absolute top-5 right-8",children:(0,s.jsxs)("div",{className:"flex items-center bg-black space-x-3 opacity-90 hover:opacity-80 cursor-pointer rounded-full p-1 pr-2 text-white",onClick:function(){(0,i.signOut)()},children:[(0,s.jsx)("img",{className:"rounded-full w-10 h-10",src:null===p||void 0===p||null===(e=p.user)||void 0===e?void 0:e.image}),(0,s.jsx)("h2",{children:null===p||void 0===p||null===(n=p.user)||void 0===n?void 0:n.name}),(0,s.jsx)(r.Z,{className:"h-5 w-5"})]})}),(0,s.jsxs)("section",{className:"flex items-end space-x-7 bg-gradient-to-b to-black ".concat(y," h-80 p-8\n text-white w-full"),children:[(0,s.jsx)("img",{src:null===h||void 0===h||null===(t=h.images)||void 0===t||null===(l=t[0])||void 0===l?void 0:l.url,className:"h-44 w-44 shadow-2xl"}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{children:"PLAYLIST"}),(0,s.jsx)("h1",{className:"text-2xl md:text-3xl xl:5xl font-bold",children:null===h||void 0===h?void 0:h.name})]})]}),(0,s.jsx)("div",{children:(0,s.jsx)(f,{})})]})},b=t(6266),y=t(1361),j=t(4634),w=t(1005),N=t(6980),k=t(6111),S=t(9406),P=t(1807),I=t(8520),C=t.n(I);function E(e,n,t,s,l,r,i){try{var a=e[r](i),o=a.value}catch(c){return void t(c)}a.done?n(o):Promise.resolve(o).then(s,l)}var _=function(){var e,n=m(),t=(0,o.b)(),s=(0,a.useState)(null),l=s[0],r=s[1],i=t.globalStates.currentSongId,c=(e=C().mark((function e(){var t,s;return C().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!i){e.next=8;break}return e.next=3,fetch("https://api.spotify.com/v1/tracks/".concat(i),{headers:{Authorization:"Bearer ".concat(n.getAccessToken())}});case 3:return t=e.sent,e.next=6,t.json();case 6:s=e.sent,r(s);case 8:case"end":return e.stop()}}),e)})),function(){var n=this,t=arguments;return new Promise((function(s,l){var r=e.apply(n,t);function i(e){E(r,s,l,i,a,"next",e)}function a(e){E(r,s,l,i,a,"throw",e)}i(void 0)}))});return(0,a.useEffect)((function(){c()}),[n,i]),l};function T(e){return function(e){if(Array.isArray(e)){for(var n=0,t=new Array(e.length);n<e.length;n++)t[n]=e[n];return t}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}var A=function(){var e,n,t,l,r=m(),i=_(),c=(0,o.b)(),u=(0,a.useState)(50),d=u[0],x=u[1],h={isPlaying:c.globalStates.isPlaying,currentSongId:c.globalStates.currentSongId,setCurrentSongId:c.globalFunctions.setCurrentSongId,setIsPlaying:c.globalFunctions.setIsPlaying,session:c.globalStates.session},v=h.isPlaying,f=h.currentSongId,g=h.setCurrentSongId,p=h.setIsPlaying,I=h.session,C=function(){r.getMyCurrentPlaybackState().then((function(e){var n;(null===e||void 0===e||null===(n=e.body)||void 0===n?void 0:n.is_playing)?(r.pause(),p(!1)):(r.play(),p(!0))}))};(0,a.useEffect)((function(){r.getAccessToken()&&!f&&(i||(r.getMyCurrentPlayingTrack().then((function(e){var n,t,s;console.log("now playing: ",null===(n=e.body)||void 0===n?void 0:n.item),g(null===(t=e.body)||void 0===t||null===(s=t.item)||void 0===s?void 0:s.id)})),r.getMyCurrentPlaybackState().then((function(e){var n;p(null===(n=e.body)||void 0===n?void 0:n.is_playing)}))),x(50))}),[f,r,I]),(0,a.useEffect)((function(){d>0&&d<100&&E(d)}),[d]);var E=(0,a.useCallback)(function(e,n){var t;return function(){for(var s=arguments.length,l=new Array(s),r=0;r<s;r++)l[r]=arguments[r];t&&clearTimeout(t),t=setTimeout((function(){return e.apply(void 0,T(l))}),n)}}((function(e){r.setVolume(e).catch((function(e){}))}),300),[]);return(0,s.jsxs)("div",{className:"h-24 bg-gradient-to-b from-black to-gray-800 text-white grid grid-cols-3 text-xs md:text-base px-2 md:px-8",children:[(0,s.jsxs)("div",{className:"flex items-center space-x-4",children:[(0,s.jsx)("img",{className:"hidden md:inline h-10 w-10",src:null===i||void 0===i||null===(e=i.album)||void 0===e||null===(n=e.images)||void 0===n||null===(t=n[0])||void 0===t?void 0:t.url,alt:""}),(0,s.jsxs)("div",{children:[(0,s.jsx)("h2",{children:null===i||void 0===i?void 0:i.name}),(0,s.jsx)("p",{children:null===i||void 0===i||null===(l=i.artists)||void 0===l?void 0:l[0].name})]})]}),(0,s.jsxs)("div",{className:"flex items-center justify-evenly",children:[(0,s.jsx)(j.Z,{className:"player-button"}),(0,s.jsx)(w.Z,{className:"player-button"}),v?(0,s.jsx)(N.Z,{onClick:C,className:"player-button w-10 h-10"}):(0,s.jsx)(k.Z,{onClick:C,className:"player-button w-10 h-10"}),(0,s.jsx)(S.Z,{className:"player-button"}),(0,s.jsx)(b.Z,{className:"player-button"})]}),(0,s.jsxs)("div",{className:"flex items-center space-x-3 md:space-x-4 justify-end pr-5",children:[(0,s.jsx)(y.Z,{onClick:function(){return d>0&&x(d-10)},className:"player-button"}),(0,s.jsx)("input",{className:"w-14 md:w-28",type:"range",value:d,onChange:function(e){return x(Number(e.target.value))},min:0,max:100}),(0,s.jsx)(P.Z,{onClick:function(){return d<100&&x(d+10)},className:"player-button"})]})]})}
1,Z=t(243),F=t(3737),O=t(9668),L=t(219),M=t(86),R=t(8113);var Y=function(){var e,n,t=m(),l=(0,o.b)();return(0,a.useEffect)((function(){t.getAccessToken()&&t.getUserPlaylists().then((function(e){l.globalFunctions.setPlaylists(e.body.items)}))}),[l.globalStates.session,t]),(0,s.jsx)("div",{className:"text-gray-500 p-5 text-xs lg:text-sm border-r border-gray-900 overflow-y-scroll h-screen sm:max-w-[12rem] lg:max-w-[15rem] hidden md:inline-flex overflow-hidden pb-36 scrollbar-hide",children:(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("button",{className:"flex items-center space-x-2 hover:text-white",children:[(0,s.jsx)(Z.Z,{className:"h-5 w-5"}),(0,s.jsx)("p",{children:"Home"})]}),(0,s.jsxs)("button",{className:"flex items-center space-x-2 hover:text-white",children:[(0,s.jsx)(F.Z,{className:"h-5 w-5"}),(0,s.jsx)("p",{children:"Search"})]}),(0,s.jsxs)("button",{className:"flex items-center space-x-2 hover:text-white",children:[(0,s.jsx)(O.Z,{className:"h-5 w-5"}),(0,s.jsx)("p",{children:"Your Library"})]}),(0,s.jsx)("hr",{className:"border-t-[0.1px] border-gray-900"}),(0,s.jsxs)("button",{className:"flex items-center space-x-2 hover:text-white ",children:[(0,s.jsx)(L.Z,{className:"h-5 w-5"}),(0,s.jsx)("p",{children:"Create Playlist"})]}),(0,s.jsxs)("button",{className:"flex items-center space-x-2 hover:text-white ",children:[(0,s.jsx)(R.Z,{className:"h-5 w-5 text-blue-500"}),(0,s.jsx)("p",{children:"Liked Songs"})]}),(0,s.jsxs)("button",{className:"flex items-center space-x-2 hover:text-white",children:[(0,s.jsx)(M.Z,{className:"h-5 w-5"}),(0,s.jsx)("p",{children:"Your Episodes"})]}),(0,s.jsx)("hr",{className:"border-t-[0.1px] border-gray-900"}),(n=null===l||void 0===l||null===(e=l.globalStates)||void 0===e?void 0:e.playlists,null===n||void 0===n?void 0:n.map((function(e){return(0,s.jsx)("p",{className:"cursor-pointer hover:text-white truncate w-32 lg:w-52",onClick:function(){return l.globalFunctions.onClickPlaylist(e)},children:e.name},e.id)})))]})})},D=!0;function H(){return(0,s.jsxs)("div",{className:"bg-black h-screen overflow-hidden",children:[(0,s.jsxs)(l.default,{children:[(0,s.jsx)("title",{children:"Turtify"}),(0,s.jsx)("link",{rel:"icon",href:"/favicon.ico"})]}),(0,s.jsxs)("main",{className:"flex",children:[(0,s.jsx)(Y,{}),(0,s.jsx)(p,{})]}),(0,s.jsx)("div",{className:"sticky bottom-0",children:(0,s.jsx)(A,{})})]})}},4654:function(){}},function(e){e.O(0,[318,774,888,179],(function(){return n=8581,e(e.s=n);var n}));var n=e.O();_N_E=n}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.