dotfiles/.config/spicetify/Extracted/Raw/xpui/5710.js

2 lines
1.8 KiB
JavaScript
Raw Normal View History

2024-07-11 00:01:49 +05:30
"use strict";(("undefined"!=typeof self?self:global).webpackChunkopen=("undefined"!=typeof self?self:global).webpackChunkopen||[]).push([[5710],{65710:(t,e,o)=>{o.r(e),o.d(e,{EpisodeSponsorNowPlayingBarHatIfPodcastAdIsPlaying:()=>E,default:()=>m});var n=o(59496),s=o(37409),a=o(99948),d=o(22508),i=o(89606);const c=["podcast-preroll","podcast-midroll-1","podcast-midroll-2","podcast-midroll-3","podcast-midroll-4","podcast-midroll-5","podcast-postroll"];function r({eventTypesToSubscribeTo:t,onPodcastAdEvent:e,onError:o}){const n=t.flatMap((t=>c.map((n=>(0,i.oc)(t,e,o,{slot:n})))));return()=>n.forEach((({cancel:t})=>t()))}const l=["started","resumed","ended"];const u=250;const p="cta_card_sai";function v({subscribeToPodcastAdEvents:t=r}={}){const[e,o]=(0,n.useState)(),{hidingHat:s,setHidingHat:a}=function(){const[t,e]=(0,n.useState)();return{hidingHat:t,setHidingHat:e}}();return(0,n.useEffect)((()=>{let n=!0;const s=t({eventTypesToSubscribeTo:l,async onPodcastAdEvent(t){const s="started"===(d=t.event_type)||"resumed"===d?d:void 0;var d;const i=Boolean(s&&t.ad.metadata.product_name===p),c=Boolean(e&&i&&e.ad.id===t.ad.id)?void 0:new Promise((t=>setTimeout((()=>{n&&(o(void 0),a(void 0)),t()}),u)));c&&n&&a(c),i&&(await c,n&&o(t))}});return()=>{n=!1,s()}}),[e,a,t]),{activeAdEvent:e,hidingHat:s}}var f=o(4637);const b=(0,n.lazy)((()=>Promise.all([o.e(1814),o.e(5037)]).then(o.bind(o,35037))));function E({subscribeToPodcastAdEvents:t,clickEventPosterForEpisodeSponsorNowPlayingBarHat:e}){const o=(0,s.g)(),i=(0,a.Y)((t=>{const e=t?.item??void 0;return(0,d.k6)(e)&&e.isPodcastAd?e:null}),((t,e)=>t?.uri===e?.uri)),{activeAdEvent:c,hidingHat:r}=v({subscribeToPodcastAdEvents:t});return(i||r)&&c?(0,f.jsx)(n.Suspense,{fallback:!0,children:(0,f.jsx)(b,{adEvent:c,ad:i,hidingHat:r,postClickEvent:e?.(c.ad.id,o)})}):null}const m=E}}]);
//# sourceMappingURL=5710.js.map