dotfiles/.config/spicetify/Extracted/Raw/xpui/xpui-routes-track.js

2 lines
1.3 KiB
JavaScript
Executable File

"use strict";(("undefined"!=typeof self?self:global).webpackChunkopen=("undefined"!=typeof self?self:global).webpackChunkopen||[]).push([[730],{41039:(e,t,n)=>{n.r(t),n.d(t,{default:()=>k});var a=n(59496),i=n(61740),c=n(89605),r=n(50346),s=n(88549),o=n(82108),l=n(72071),u=n(37409),d=n(68640);const f=a.memo((function(){const e=(0,c.s0)(),t=(0,c.TH)(),n=(0,a.useContext)(d.ZF),f=(0,u.g)(),{trackId:k=""}=(0,c.UO)(),{isAnonymous:h}=(0,i.v9)(o.Gg),b=new URLSearchParams(t.search).get("context")||"",g=(0,r.tn)(k).toURI(),m=(0,s.QN)({uri:g},{cacheTime:30*l.y}),p=(0,a.useCallback)(((t,n)=>{const a=f.getState(),i=(0,r.EC)(n)?.toURLPath(!0),c=`${i}?highlight=${g}`;h?e(c):(a&&!a.isPaused||t>-1&&f.play({uri:n},{featureIdentifier:"track",referrerIdentifier:"deeplink"},{skipTo:{index:t}}),e(c,{replace:!0}))}),[e,h,f,g]),U=(0,a.useCallback)((()=>{if(!m.loading&&m.data?.trackUnion&&"Track"===m.data.trackUnion.__typename){const e=(m.data.trackUnion.albumOfTrack?.tracks?.items??[]).findIndex((e=>e.track.uri===g));e>=0&&p(e,m.data.trackUnion.albumOfTrack?.uri||"")}}),[p,m,g]);return(0,a.useEffect)((()=>{const e=(0,r.nK)(b);b&&e?n.getContents(b).then((e=>{const t=e.items.findIndex((e=>e?.uri===g));t<0?U():p(t,b)})):U()}),[b,U,p,n,g]),null})),k=f}}]);
//# sourceMappingURL=xpui-routes-track.js.map